@kitelev/exocortex-cli 16.19.1 → 16.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +54 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v16.19.
|
|
2
|
+
// @kitelev/exocortex-cli v16.19.2
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
6
|
-
"use strict";var sN=Object.create;var ou=Object.defineProperty;var aN=Object.getOwnPropertyDescriptor;var oN=Object.getOwnPropertyNames;var cN=Object.getPrototypeOf,lN=Object.prototype.hasOwnProperty;var o=(n,e)=>ou(n,"name",{value:e,configurable:!0});var uN=(n,e)=>()=>(n&&(e=n(n=0)),e);var b=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),gy=(n,e)=>{for(var t in e)ou(n,t,{get:e[t],enumerable:!0})},fE=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oN(e))!lN.call(n,i)&&i!==t&&ou(n,i,{get:()=>e[i],enumerable:!(r=aN(e,i))||r.enumerable});return n};var le=(n,e,t)=>(t=n!=null?sN(cN(n)):{},fE(e||!n||!n.__esModule?ou(t,"default",{value:n,enumerable:!0}):t,n)),_d=n=>fE(ou({},"__esModule",{value:!0}),n);var yy=b(()=>{var dE;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:c(),r=i(n);typeof t.Reflect<"u"&&(r=i(t.Reflect,r)),e(r,t),typeof t.Reflect>"u"&&(t.Reflect=n);function i(l,u){return function(f,d){Object.defineProperty(l,f,{configurable:!0,writable:!0,value:d}),u&&u(f,d)}}o(i,"makeExporter");function s(){try{return Function("return this;")()}catch{}}o(s,"functionThis");function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}o(a,"indirectEvalThis");function c(){return s()||a()}o(c,"sloppyModeThis")})(function(e,t){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,f={create:c?function(){return qe(Object.create(null))}:l?function(){return qe({__proto__:null})}:function(){return qe({})},has:u?function(E,A){return r.call(E,A)}:function(E,A){return A in E},get:u?function(E,A){return r.call(E,A)?E[A]:void 0}:function(E,A){return E[A]}},d=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:we(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:it(),y=typeof WeakMap=="function"?WeakMap:Je(),S=i?Symbol.for("@reflect-metadata:registry"):void 0,v=_e(),w=be(v);function T(E,A,x,P){if(z(x)){if(!Ge(E))throw new TypeError;if(!ze(A))throw new TypeError;return Re(E,A)}else{if(!Ge(E))throw new TypeError;if(!re(A))throw new TypeError;if(!re(P)&&!z(P)&&!Ne(P))throw new TypeError;return Ne(P)&&(P=void 0),x=xe(x),et(E,A,x,P)}}o(T,"decorate"),e("decorate",T);function C(E,A){function x(P,Z){if(!re(P))throw new TypeError;if(!z(Z)&&!Xe(Z))throw new TypeError;K(E,A,P,Z)}return o(x,"decorator"),x}o(C,"metadata"),e("metadata",C);function L(E,A,x,P){if(!re(x))throw new TypeError;return z(P)||(P=xe(P)),K(E,A,x,P)}o(L,"defineMetadata"),e("defineMetadata",L);function $(E,A,x){if(!re(A))throw new TypeError;return z(x)||(x=xe(x)),ft(E,A,x)}o($,"hasMetadata"),e("hasMetadata",$);function ee(E,A,x){if(!re(A))throw new TypeError;return z(x)||(x=xe(x)),Ze(E,A,x)}o(ee,"hasOwnMetadata"),e("hasOwnMetadata",ee);function B(E,A,x){if(!re(A))throw new TypeError;return z(x)||(x=xe(x)),te(E,A,x)}o(B,"getMetadata"),e("getMetadata",B);function W(E,A,x){if(!re(A))throw new TypeError;return z(x)||(x=xe(x)),ie(E,A,x)}o(W,"getOwnMetadata"),e("getOwnMetadata",W);function F(E,A){if(!re(E))throw new TypeError;return z(A)||(A=xe(A)),q(E,A)}o(F,"getMetadataKeys"),e("getMetadataKeys",F);function D(E,A){if(!re(E))throw new TypeError;return z(A)||(A=xe(A)),st(E,A)}o(D,"getOwnMetadataKeys"),e("getOwnMetadataKeys",D);function G(E,A,x){if(!re(A))throw new TypeError;if(z(x)||(x=xe(x)),!re(A))throw new TypeError;z(x)||(x=xe(x));var P=ae(A,x,!1);return z(P)?!1:P.OrdinaryDeleteMetadata(E,A,x)}o(G,"deleteMetadata"),e("deleteMetadata",G);function Re(E,A){for(var x=E.length-1;x>=0;--x){var P=E[x],Z=P(A);if(!z(Z)&&!Ne(Z)){if(!ze(Z))throw new TypeError;A=Z}}return A}o(Re,"DecorateConstructor");function et(E,A,x,P){for(var Z=E.length-1;Z>=0;--Z){var bt=E[Z],At=bt(A,x,P);if(!z(At)&&!Ne(At)){if(!re(At))throw new TypeError;P=At}}return P}o(et,"DecorateProperty");function ft(E,A,x){var P=Ze(E,A,x);if(P)return!0;var Z=ce(A);return Ne(Z)?!1:ft(E,Z,x)}o(ft,"OrdinaryHasMetadata");function Ze(E,A,x){var P=ae(A,x,!1);return z(P)?!1:We(P.OrdinaryHasOwnMetadata(E,A,x))}o(Ze,"OrdinaryHasOwnMetadata");function te(E,A,x){var P=Ze(E,A,x);if(P)return ie(E,A,x);var Z=ce(A);if(!Ne(Z))return te(E,Z,x)}o(te,"OrdinaryGetMetadata");function ie(E,A,x){var P=ae(A,x,!1);if(!z(P))return P.OrdinaryGetOwnMetadata(E,A,x)}o(ie,"OrdinaryGetOwnMetadata");function K(E,A,x,P){var Z=ae(x,P,!0);Z.OrdinaryDefineOwnMetadata(E,A,x,P)}o(K,"OrdinaryDefineOwnMetadata");function q(E,A){var x=st(E,A),P=ce(E);if(P===null)return x;var Z=q(P,A);if(Z.length<=0)return x;if(x.length<=0)return Z;for(var bt=new p,At=[],je=0,H=x;je<H.length;je++){var Q=H[je],Y=bt.has(Q);Y||(bt.add(Q),At.push(Q))}for(var X=0,Oe=Z;X<Oe.length;X++){var Q=Oe[X],Y=bt.has(Q);Y||(bt.add(Q),At.push(Q))}return At}o(q,"OrdinaryMetadataKeys");function st(E,A){var x=ae(E,A,!1);return x?x.OrdinaryOwnMetadataKeys(E,A):[]}o(st,"OrdinaryOwnMetadataKeys");function nt(E){if(E===null)return 1;switch(typeof E){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return E===null?1:6;default:return 6}}o(nt,"Type");function z(E){return E===void 0}o(z,"IsUndefined");function Ne(E){return E===null}o(Ne,"IsNull");function He(E){return typeof E=="symbol"}o(He,"IsSymbol");function re(E){return typeof E=="object"?E!==null:typeof E=="function"}o(re,"IsObject");function Qe(E,A){switch(nt(E)){case 0:return E;case 1:return E;case 2:return E;case 3:return E;case 4:return E;case 5:return E}var x=A===3?"string":A===5?"number":"default",P=me(E,s);if(P!==void 0){var Z=P.call(E,x);if(re(Z))throw new TypeError;return Z}return Ke(E,x==="default"?"number":x)}o(Qe,"ToPrimitive");function Ke(E,A){if(A==="string"){var x=E.toString;if(Le(x)){var P=x.call(E);if(!re(P))return P}var Z=E.valueOf;if(Le(Z)){var P=Z.call(E);if(!re(P))return P}}else{var Z=E.valueOf;if(Le(Z)){var P=Z.call(E);if(!re(P))return P}var bt=E.toString;if(Le(bt)){var P=bt.call(E);if(!re(P))return P}}throw new TypeError}o(Ke,"OrdinaryToPrimitive");function We(E){return!!E}o(We,"ToBoolean");function Ye(E){return""+E}o(Ye,"ToString");function xe(E){var A=Qe(E,3);return He(A)?A:Ye(A)}o(xe,"ToPropertyKey");function Ge(E){return Array.isArray?Array.isArray(E):E instanceof Object?E instanceof Array:Object.prototype.toString.call(E)==="[object Array]"}o(Ge,"IsArray");function Le(E){return typeof E=="function"}o(Le,"IsCallable");function ze(E){return typeof E=="function"}o(ze,"IsConstructor");function Xe(E){switch(nt(E)){case 3:return!0;case 4:return!0;default:return!1}}o(Xe,"IsPropertyKey");function ue(E,A){return E===A||E!==E&&A!==A}o(ue,"SameValueZero");function me(E,A){var x=E[A];if(x!=null){if(!Le(x))throw new TypeError;return x}}o(me,"GetMethod");function ge(E){var A=me(E,a);if(!Le(A))throw new TypeError;var x=A.call(E);if(!re(x))throw new TypeError;return x}o(ge,"GetIterator");function fe(E){return E.value}o(fe,"IteratorValue");function de(E){var A=E.next();return A.done?!1:A}o(de,"IteratorStep");function he(E){var A=E.return;A&&A.call(E)}o(he,"IteratorClose");function ce(E){var A=Object.getPrototypeOf(E);if(typeof E!="function"||E===d||A!==d)return A;var x=E.prototype,P=x&&Object.getPrototypeOf(x);if(P==null||P===Object.prototype)return A;var Z=P.constructor;return typeof Z!="function"||Z===E?A:Z}o(ce,"OrdinaryGetPrototypeOf");function ye(){var E;!z(S)&&typeof t.Reflect<"u"&&!(S in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(E=Se(t.Reflect));var A,x,P,Z=new y,bt={registerProvider:At,getProvider:H,setProvider:Y};return bt;function At(X){if(!Object.isExtensible(bt))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case E===X:break;case z(A):A=X;break;case A===X:break;case z(x):x=X;break;case x===X:break;default:P===void 0&&(P=new p),P.add(X);break}}function je(X,Oe){if(!z(A)){if(A.isProviderFor(X,Oe))return A;if(!z(x)){if(x.isProviderFor(X,Oe))return A;if(!z(P))for(var at=ge(P);;){var ot=de(at);if(!ot)return;var Cr=fe(ot);if(Cr.isProviderFor(X,Oe))return he(at),Cr}}}if(!z(E)&&E.isProviderFor(X,Oe))return E}function H(X,Oe){var at=Z.get(X),ot;return z(at)||(ot=at.get(Oe)),z(ot)&&(ot=je(X,Oe),z(ot)||(z(at)&&(at=new h,Z.set(X,at)),at.set(Oe,ot))),ot}function Q(X){if(z(X))throw new TypeError;return A===X||x===X||!z(P)&&P.has(X)}function Y(X,Oe,at){if(!Q(at))throw new Error("Metadata provider not registered.");var ot=H(X,Oe);if(ot!==at){if(!z(ot))return!1;var Cr=Z.get(X);z(Cr)&&(Cr=new h,Z.set(X,Cr)),Cr.set(Oe,at)}return!0}}o(ye,"CreateMetadataRegistry");function _e(){var E;return!z(S)&&re(t.Reflect)&&Object.isExtensible(t.Reflect)&&(E=t.Reflect[S]),z(E)&&(E=ye()),!z(S)&&re(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,S,{enumerable:!1,configurable:!1,writable:!1,value:E}),E}o(_e,"GetOrCreateMetadataRegistry");function be(E){var A=new y,x={isProviderFor:o(function(Q,Y){var X=A.get(Q);return z(X)?!1:X.has(Y)},"isProviderFor"),OrdinaryDefineOwnMetadata:At,OrdinaryHasOwnMetadata:Z,OrdinaryGetOwnMetadata:bt,OrdinaryOwnMetadataKeys:je,OrdinaryDeleteMetadata:H};return v.registerProvider(x),x;function P(Q,Y,X){var Oe=A.get(Q),at=!1;if(z(Oe)){if(!X)return;Oe=new h,A.set(Q,Oe),at=!0}var ot=Oe.get(Y);if(z(ot)){if(!X)return;if(ot=new h,Oe.set(Y,ot),!E.setProvider(Q,Y,x))throw Oe.delete(Y),at&&A.delete(Q),new Error("Wrong provider for target.")}return ot}o(P,"GetOrCreateMetadataMap");function Z(Q,Y,X){var Oe=P(Y,X,!1);return z(Oe)?!1:We(Oe.has(Q))}o(Z,"OrdinaryHasOwnMetadata");function bt(Q,Y,X){var Oe=P(Y,X,!1);if(!z(Oe))return Oe.get(Q)}o(bt,"OrdinaryGetOwnMetadata");function At(Q,Y,X,Oe){var at=P(X,Oe,!0);at.set(Q,Y)}o(At,"OrdinaryDefineOwnMetadata");function je(Q,Y){var X=[],Oe=P(Q,Y,!1);if(z(Oe))return X;for(var at=Oe.keys(),ot=ge(at),Cr=0;;){var vn=de(ot);if(!vn)return X.length=Cr,X;var kn=fe(vn);try{X[Cr]=kn}catch(tn){try{he(ot)}finally{throw tn}}Cr++}}o(je,"OrdinaryOwnMetadataKeys");function H(Q,Y,X){var Oe=P(Y,X,!1);if(z(Oe)||!Oe.delete(Q))return!1;if(Oe.size===0){var at=A.get(Y);z(at)||(at.delete(X),at.size===0&&A.delete(at))}return!0}o(H,"OrdinaryDeleteMetadata")}o(be,"CreateMetadataProvider");function Se(E){var A=E.defineMetadata,x=E.hasOwnMetadata,P=E.getOwnMetadata,Z=E.getOwnMetadataKeys,bt=E.deleteMetadata,At=new y,je={isProviderFor:o(function(H,Q){var Y=At.get(H);return!z(Y)&&Y.has(Q)?!0:Z(H,Q).length?(z(Y)&&(Y=new p,At.set(H,Y)),Y.add(Q),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:A,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:Z,OrdinaryDeleteMetadata:bt};return je}o(Se,"CreateFallbackProvider");function ae(E,A,x){var P=v.getProvider(E,A);if(!z(P))return P;if(x){if(v.setProvider(E,A,w))return w;throw new Error("Illegal state.")}}o(ae,"GetMetadataProvider");function we(){var E={},A=[],x=(function(){function je(H,Q,Y){this._index=0,this._keys=H,this._values=Q,this._selector=Y}return o(je,"MapIterator"),je.prototype["@@iterator"]=function(){return this},je.prototype[a]=function(){return this},je.prototype.next=function(){var H=this._index;if(H>=0&&H<this._keys.length){var Q=this._selector(this._keys[H],this._values[H]);return H+1>=this._keys.length?(this._index=-1,this._keys=A,this._values=A):this._index++,{value:Q,done:!1}}return{value:void 0,done:!0}},je.prototype.throw=function(H){throw this._index>=0&&(this._index=-1,this._keys=A,this._values=A),H},je.prototype.return=function(H){return this._index>=0&&(this._index=-1,this._keys=A,this._values=A),{value:H,done:!0}},je})(),P=(function(){function je(){this._keys=[],this._values=[],this._cacheKey=E,this._cacheIndex=-2}return o(je,"Map"),Object.defineProperty(je.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),je.prototype.has=function(H){return this._find(H,!1)>=0},je.prototype.get=function(H){var Q=this._find(H,!1);return Q>=0?this._values[Q]:void 0},je.prototype.set=function(H,Q){var Y=this._find(H,!0);return this._values[Y]=Q,this},je.prototype.delete=function(H){var Q=this._find(H,!1);if(Q>=0){for(var Y=this._keys.length,X=Q+1;X<Y;X++)this._keys[X-1]=this._keys[X],this._values[X-1]=this._values[X];return this._keys.length--,this._values.length--,ue(H,this._cacheKey)&&(this._cacheKey=E,this._cacheIndex=-2),!0}return!1},je.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=E,this._cacheIndex=-2},je.prototype.keys=function(){return new x(this._keys,this._values,Z)},je.prototype.values=function(){return new x(this._keys,this._values,bt)},je.prototype.entries=function(){return new x(this._keys,this._values,At)},je.prototype["@@iterator"]=function(){return this.entries()},je.prototype[a]=function(){return this.entries()},je.prototype._find=function(H,Q){if(!ue(this._cacheKey,H)){this._cacheIndex=-1;for(var Y=0;Y<this._keys.length;Y++)if(ue(this._keys[Y],H)){this._cacheIndex=Y;break}}return this._cacheIndex<0&&Q&&(this._cacheIndex=this._keys.length,this._keys.push(H),this._values.push(void 0)),this._cacheIndex},je})();return P;function Z(je,H){return je}function bt(je,H){return H}function At(je,H){return[je,H]}}o(we,"CreateMapPolyfill");function it(){var E=(function(){function A(){this._map=new h}return o(A,"Set"),Object.defineProperty(A.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),A.prototype.has=function(x){return this._map.has(x)},A.prototype.add=function(x){return this._map.set(x,x),this},A.prototype.delete=function(x){return this._map.delete(x)},A.prototype.clear=function(){this._map.clear()},A.prototype.keys=function(){return this._map.keys()},A.prototype.values=function(){return this._map.keys()},A.prototype.entries=function(){return this._map.entries()},A.prototype["@@iterator"]=function(){return this.keys()},A.prototype[a]=function(){return this.keys()},A})();return E}o(it,"CreateSetPolyfill");function Je(){var E=16,A=f.create(),x=P();return(function(){function H(){this._key=P()}return o(H,"WeakMap"),H.prototype.has=function(Q){var Y=Z(Q,!1);return Y!==void 0?f.has(Y,this._key):!1},H.prototype.get=function(Q){var Y=Z(Q,!1);return Y!==void 0?f.get(Y,this._key):void 0},H.prototype.set=function(Q,Y){var X=Z(Q,!0);return X[this._key]=Y,this},H.prototype.delete=function(Q){var Y=Z(Q,!1);return Y!==void 0?delete Y[this._key]:!1},H.prototype.clear=function(){this._key=P()},H})();function P(){var H;do H="@@WeakMap@@"+je();while(f.has(A,H));return A[H]=!0,H}function Z(H,Q){if(!r.call(H,x)){if(!Q)return;Object.defineProperty(H,x,{value:f.create()})}return H[x]}function bt(H,Q){for(var Y=0;Y<Q;++Y)H[Y]=Math.random()*255|0;return H}function At(H){if(typeof Uint8Array=="function"){var Q=new Uint8Array(H);return typeof crypto<"u"?crypto.getRandomValues(Q):typeof msCrypto<"u"?msCrypto.getRandomValues(Q):bt(Q,H),Q}return bt(new Array(H),H)}function je(){var H=At(E);H[6]=H[6]&79|64,H[8]=H[8]&191|128;for(var Q="",Y=0;Y<E;++Y){var X=H[Y];(Y===4||Y===6||Y===8)&&(Q+="-"),X<16&&(Q+="0"),Q+=X.toString(16).toLowerCase()}return Q}}o(Je,"CreateWeakMapPolyfill");function qe(E){return E.__=void 0,delete E.__,E}o(qe,"MakeDictionary")})})(dE||(dE={}))});var cu=b(by=>{var bd=class extends Error{static{o(this,"CommanderError")}constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},_y=class extends bd{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};by.CommanderError=bd;by.InvalidArgumentError=_y});var Sd=b(wy=>{var{InvalidArgumentError:fN}=cu(),Sy=class{static{o(this,"Argument")}constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new fN(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function dN(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(dN,"humanReadableArgName");wy.Argument=Sy;wy.humanReadableArgName=dN});var Ty=b(Ey=>{var{humanReadableArgName:hN}=Sd(),vy=class{static{o(this,"Help")}constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let r=o(i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,""),"getSortKey");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),r=e._getHelpOption();if(r&&!r.hidden){let i=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!i&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!i&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let i=r.options.filter(s=>!s.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>hN(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,t,r){return t.length===0?[]:[r.styleTitle(e),...t,""]}groupItems(e,t,r){let i=new Map;return e.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[])}),t.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[]),i.get(a).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(d,h){return t.formatItem(d,r,h,t)}o(s,"callFormatItem");let a=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],c=t.commandDescription(e);c.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(c),i),""]));let l=t.visibleArguments(e).map(d=>s(t.styleArgumentTerm(t.argumentTerm(d)),t.styleArgumentDescription(t.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,h)=>{let p=d.map(y=>s(t.styleOptionTerm(t.optionTerm(y)),t.styleOptionDescription(t.optionDescription(y))));a=a.concat(this.formatItemList(h,p,t))}),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(h=>s(t.styleOptionTerm(t.optionTerm(h)),t.styleOptionDescription(t.optionDescription(h))));a=a.concat(this.formatItemList("Global Options:",d,t))}return this.groupItems(e.commands,t.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,h)=>{let p=d.map(y=>s(t.styleSubcommandTerm(t.subcommandTerm(y)),t.styleSubcommandDescription(t.subcommandDescription(y))));a=a.concat(this.formatItemList(h,p,t))}),a.join(`
|
|
6
|
+
"use strict";var sN=Object.create;var ou=Object.defineProperty;var aN=Object.getOwnPropertyDescriptor;var oN=Object.getOwnPropertyNames;var cN=Object.getPrototypeOf,lN=Object.prototype.hasOwnProperty;var o=(n,e)=>ou(n,"name",{value:e,configurable:!0});var uN=(n,e)=>()=>(n&&(e=n(n=0)),e);var b=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),gy=(n,e)=>{for(var t in e)ou(n,t,{get:e[t],enumerable:!0})},fE=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oN(e))!lN.call(n,i)&&i!==t&&ou(n,i,{get:()=>e[i],enumerable:!(r=aN(e,i))||r.enumerable});return n};var le=(n,e,t)=>(t=n!=null?sN(cN(n)):{},fE(e||!n||!n.__esModule?ou(t,"default",{value:n,enumerable:!0}):t,n)),_d=n=>fE(ou({},"__esModule",{value:!0}),n);var yy=b(()=>{var dE;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:c(),r=i(n);typeof t.Reflect<"u"&&(r=i(t.Reflect,r)),e(r,t),typeof t.Reflect>"u"&&(t.Reflect=n);function i(l,u){return function(f,d){Object.defineProperty(l,f,{configurable:!0,writable:!0,value:d}),u&&u(f,d)}}o(i,"makeExporter");function s(){try{return Function("return this;")()}catch{}}o(s,"functionThis");function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}o(a,"indirectEvalThis");function c(){return s()||a()}o(c,"sloppyModeThis")})(function(e,t){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,f={create:c?function(){return qe(Object.create(null))}:l?function(){return qe({__proto__:null})}:function(){return qe({})},has:u?function(E,A){return r.call(E,A)}:function(E,A){return A in E},get:u?function(E,A){return r.call(E,A)?E[A]:void 0}:function(E,A){return E[A]}},d=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:we(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:it(),y=typeof WeakMap=="function"?WeakMap:Je(),S=i?Symbol.for("@reflect-metadata:registry"):void 0,v=_e(),w=be(v);function T(E,A,x,P){if(Q(x)){if(!Ge(E))throw new TypeError;if(!ze(A))throw new TypeError;return De(E,A)}else{if(!Ge(E))throw new TypeError;if(!te(A))throw new TypeError;if(!te(P)&&!Q(P)&&!Ne(P))throw new TypeError;return Ne(P)&&(P=void 0),x=xe(x),et(E,A,x,P)}}o(T,"decorate"),e("decorate",T);function C(E,A){function x(P,J){if(!te(P))throw new TypeError;if(!Q(J)&&!Xe(J))throw new TypeError;Z(E,A,P,J)}return o(x,"decorator"),x}o(C,"metadata"),e("metadata",C);function L(E,A,x,P){if(!te(x))throw new TypeError;return Q(P)||(P=xe(P)),Z(E,A,x,P)}o(L,"defineMetadata"),e("defineMetadata",L);function $(E,A,x){if(!te(A))throw new TypeError;return Q(x)||(x=xe(x)),ut(E,A,x)}o($,"hasMetadata"),e("hasMetadata",$);function ee(E,A,x){if(!te(A))throw new TypeError;return Q(x)||(x=xe(x)),ae(E,A,x)}o(ee,"hasOwnMetadata"),e("hasOwnMetadata",ee);function B(E,A,x){if(!te(A))throw new TypeError;return Q(x)||(x=xe(x)),Ze(E,A,x)}o(B,"getMetadata"),e("getMetadata",B);function G(E,A,x){if(!te(A))throw new TypeError;return Q(x)||(x=xe(x)),ie(E,A,x)}o(G,"getOwnMetadata"),e("getOwnMetadata",G);function F(E,A){if(!te(E))throw new TypeError;return Q(A)||(A=xe(A)),q(E,A)}o(F,"getMetadataKeys"),e("getMetadataKeys",F);function D(E,A){if(!te(E))throw new TypeError;return Q(A)||(A=xe(A)),tt(E,A)}o(D,"getOwnMetadataKeys"),e("getOwnMetadataKeys",D);function W(E,A,x){if(!te(A))throw new TypeError;if(Q(x)||(x=xe(x)),!te(A))throw new TypeError;Q(x)||(x=xe(x));var P=se(A,x,!1);return Q(P)?!1:P.OrdinaryDeleteMetadata(E,A,x)}o(W,"deleteMetadata"),e("deleteMetadata",W);function De(E,A){for(var x=E.length-1;x>=0;--x){var P=E[x],J=P(A);if(!Q(J)&&!Ne(J)){if(!ze(J))throw new TypeError;A=J}}return A}o(De,"DecorateConstructor");function et(E,A,x,P){for(var J=E.length-1;J>=0;--J){var bt=E[J],At=bt(A,x,P);if(!Q(At)&&!Ne(At)){if(!te(At))throw new TypeError;P=At}}return P}o(et,"DecorateProperty");function ut(E,A,x){var P=ae(E,A,x);if(P)return!0;var J=ce(A);return Ne(J)?!1:ut(E,J,x)}o(ut,"OrdinaryHasMetadata");function ae(E,A,x){var P=se(A,x,!1);return Q(P)?!1:We(P.OrdinaryHasOwnMetadata(E,A,x))}o(ae,"OrdinaryHasOwnMetadata");function Ze(E,A,x){var P=ae(E,A,x);if(P)return ie(E,A,x);var J=ce(A);if(!Ne(J))return Ze(E,J,x)}o(Ze,"OrdinaryGetMetadata");function ie(E,A,x){var P=se(A,x,!1);if(!Q(P))return P.OrdinaryGetOwnMetadata(E,A,x)}o(ie,"OrdinaryGetOwnMetadata");function Z(E,A,x,P){var J=se(x,P,!0);J.OrdinaryDefineOwnMetadata(E,A,x,P)}o(Z,"OrdinaryDefineOwnMetadata");function q(E,A){var x=tt(E,A),P=ce(E);if(P===null)return x;var J=q(P,A);if(J.length<=0)return x;if(x.length<=0)return J;for(var bt=new p,At=[],je=0,z=x;je<z.length;je++){var H=z[je],K=bt.has(H);K||(bt.add(H),At.push(H))}for(var Y=0,Re=J;Y<Re.length;Y++){var H=Re[Y],K=bt.has(H);K||(bt.add(H),At.push(H))}return At}o(q,"OrdinaryMetadataKeys");function tt(E,A){var x=se(E,A,!1);return x?x.OrdinaryOwnMetadataKeys(E,A):[]}o(tt,"OrdinaryOwnMetadataKeys");function st(E){if(E===null)return 1;switch(typeof E){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return E===null?1:6;default:return 6}}o(st,"Type");function Q(E){return E===void 0}o(Q,"IsUndefined");function Ne(E){return E===null}o(Ne,"IsNull");function He(E){return typeof E=="symbol"}o(He,"IsSymbol");function te(E){return typeof E=="object"?E!==null:typeof E=="function"}o(te,"IsObject");function Qe(E,A){switch(st(E)){case 0:return E;case 1:return E;case 2:return E;case 3:return E;case 4:return E;case 5:return E}var x=A===3?"string":A===5?"number":"default",P=me(E,s);if(P!==void 0){var J=P.call(E,x);if(te(J))throw new TypeError;return J}return Ke(E,x==="default"?"number":x)}o(Qe,"ToPrimitive");function Ke(E,A){if(A==="string"){var x=E.toString;if(Le(x)){var P=x.call(E);if(!te(P))return P}var J=E.valueOf;if(Le(J)){var P=J.call(E);if(!te(P))return P}}else{var J=E.valueOf;if(Le(J)){var P=J.call(E);if(!te(P))return P}var bt=E.toString;if(Le(bt)){var P=bt.call(E);if(!te(P))return P}}throw new TypeError}o(Ke,"OrdinaryToPrimitive");function We(E){return!!E}o(We,"ToBoolean");function Ye(E){return""+E}o(Ye,"ToString");function xe(E){var A=Qe(E,3);return He(A)?A:Ye(A)}o(xe,"ToPropertyKey");function Ge(E){return Array.isArray?Array.isArray(E):E instanceof Object?E instanceof Array:Object.prototype.toString.call(E)==="[object Array]"}o(Ge,"IsArray");function Le(E){return typeof E=="function"}o(Le,"IsCallable");function ze(E){return typeof E=="function"}o(ze,"IsConstructor");function Xe(E){switch(st(E)){case 3:return!0;case 4:return!0;default:return!1}}o(Xe,"IsPropertyKey");function ue(E,A){return E===A||E!==E&&A!==A}o(ue,"SameValueZero");function me(E,A){var x=E[A];if(x!=null){if(!Le(x))throw new TypeError;return x}}o(me,"GetMethod");function ge(E){var A=me(E,a);if(!Le(A))throw new TypeError;var x=A.call(E);if(!te(x))throw new TypeError;return x}o(ge,"GetIterator");function fe(E){return E.value}o(fe,"IteratorValue");function de(E){var A=E.next();return A.done?!1:A}o(de,"IteratorStep");function he(E){var A=E.return;A&&A.call(E)}o(he,"IteratorClose");function ce(E){var A=Object.getPrototypeOf(E);if(typeof E!="function"||E===d||A!==d)return A;var x=E.prototype,P=x&&Object.getPrototypeOf(x);if(P==null||P===Object.prototype)return A;var J=P.constructor;return typeof J!="function"||J===E?A:J}o(ce,"OrdinaryGetPrototypeOf");function ye(){var E;!Q(S)&&typeof t.Reflect<"u"&&!(S in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(E=Se(t.Reflect));var A,x,P,J=new y,bt={registerProvider:At,getProvider:z,setProvider:K};return bt;function At(Y){if(!Object.isExtensible(bt))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case E===Y:break;case Q(A):A=Y;break;case A===Y:break;case Q(x):x=Y;break;case x===Y:break;default:P===void 0&&(P=new p),P.add(Y);break}}function je(Y,Re){if(!Q(A)){if(A.isProviderFor(Y,Re))return A;if(!Q(x)){if(x.isProviderFor(Y,Re))return A;if(!Q(P))for(var at=ge(P);;){var ot=de(at);if(!ot)return;var Cr=fe(ot);if(Cr.isProviderFor(Y,Re))return he(at),Cr}}}if(!Q(E)&&E.isProviderFor(Y,Re))return E}function z(Y,Re){var at=J.get(Y),ot;return Q(at)||(ot=at.get(Re)),Q(ot)&&(ot=je(Y,Re),Q(ot)||(Q(at)&&(at=new h,J.set(Y,at)),at.set(Re,ot))),ot}function H(Y){if(Q(Y))throw new TypeError;return A===Y||x===Y||!Q(P)&&P.has(Y)}function K(Y,Re,at){if(!H(at))throw new Error("Metadata provider not registered.");var ot=z(Y,Re);if(ot!==at){if(!Q(ot))return!1;var Cr=J.get(Y);Q(Cr)&&(Cr=new h,J.set(Y,Cr)),Cr.set(Re,at)}return!0}}o(ye,"CreateMetadataRegistry");function _e(){var E;return!Q(S)&&te(t.Reflect)&&Object.isExtensible(t.Reflect)&&(E=t.Reflect[S]),Q(E)&&(E=ye()),!Q(S)&&te(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,S,{enumerable:!1,configurable:!1,writable:!1,value:E}),E}o(_e,"GetOrCreateMetadataRegistry");function be(E){var A=new y,x={isProviderFor:o(function(H,K){var Y=A.get(H);return Q(Y)?!1:Y.has(K)},"isProviderFor"),OrdinaryDefineOwnMetadata:At,OrdinaryHasOwnMetadata:J,OrdinaryGetOwnMetadata:bt,OrdinaryOwnMetadataKeys:je,OrdinaryDeleteMetadata:z};return v.registerProvider(x),x;function P(H,K,Y){var Re=A.get(H),at=!1;if(Q(Re)){if(!Y)return;Re=new h,A.set(H,Re),at=!0}var ot=Re.get(K);if(Q(ot)){if(!Y)return;if(ot=new h,Re.set(K,ot),!E.setProvider(H,K,x))throw Re.delete(K),at&&A.delete(H),new Error("Wrong provider for target.")}return ot}o(P,"GetOrCreateMetadataMap");function J(H,K,Y){var Re=P(K,Y,!1);return Q(Re)?!1:We(Re.has(H))}o(J,"OrdinaryHasOwnMetadata");function bt(H,K,Y){var Re=P(K,Y,!1);if(!Q(Re))return Re.get(H)}o(bt,"OrdinaryGetOwnMetadata");function At(H,K,Y,Re){var at=P(Y,Re,!0);at.set(H,K)}o(At,"OrdinaryDefineOwnMetadata");function je(H,K){var Y=[],Re=P(H,K,!1);if(Q(Re))return Y;for(var at=Re.keys(),ot=ge(at),Cr=0;;){var vn=de(ot);if(!vn)return Y.length=Cr,Y;var kn=fe(vn);try{Y[Cr]=kn}catch(tn){try{he(ot)}finally{throw tn}}Cr++}}o(je,"OrdinaryOwnMetadataKeys");function z(H,K,Y){var Re=P(K,Y,!1);if(Q(Re)||!Re.delete(H))return!1;if(Re.size===0){var at=A.get(K);Q(at)||(at.delete(Y),at.size===0&&A.delete(at))}return!0}o(z,"OrdinaryDeleteMetadata")}o(be,"CreateMetadataProvider");function Se(E){var A=E.defineMetadata,x=E.hasOwnMetadata,P=E.getOwnMetadata,J=E.getOwnMetadataKeys,bt=E.deleteMetadata,At=new y,je={isProviderFor:o(function(z,H){var K=At.get(z);return!Q(K)&&K.has(H)?!0:J(z,H).length?(Q(K)&&(K=new p,At.set(z,K)),K.add(H),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:A,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:J,OrdinaryDeleteMetadata:bt};return je}o(Se,"CreateFallbackProvider");function se(E,A,x){var P=v.getProvider(E,A);if(!Q(P))return P;if(x){if(v.setProvider(E,A,w))return w;throw new Error("Illegal state.")}}o(se,"GetMetadataProvider");function we(){var E={},A=[],x=(function(){function je(z,H,K){this._index=0,this._keys=z,this._values=H,this._selector=K}return o(je,"MapIterator"),je.prototype["@@iterator"]=function(){return this},je.prototype[a]=function(){return this},je.prototype.next=function(){var z=this._index;if(z>=0&&z<this._keys.length){var H=this._selector(this._keys[z],this._values[z]);return z+1>=this._keys.length?(this._index=-1,this._keys=A,this._values=A):this._index++,{value:H,done:!1}}return{value:void 0,done:!0}},je.prototype.throw=function(z){throw this._index>=0&&(this._index=-1,this._keys=A,this._values=A),z},je.prototype.return=function(z){return this._index>=0&&(this._index=-1,this._keys=A,this._values=A),{value:z,done:!0}},je})(),P=(function(){function je(){this._keys=[],this._values=[],this._cacheKey=E,this._cacheIndex=-2}return o(je,"Map"),Object.defineProperty(je.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),je.prototype.has=function(z){return this._find(z,!1)>=0},je.prototype.get=function(z){var H=this._find(z,!1);return H>=0?this._values[H]:void 0},je.prototype.set=function(z,H){var K=this._find(z,!0);return this._values[K]=H,this},je.prototype.delete=function(z){var H=this._find(z,!1);if(H>=0){for(var K=this._keys.length,Y=H+1;Y<K;Y++)this._keys[Y-1]=this._keys[Y],this._values[Y-1]=this._values[Y];return this._keys.length--,this._values.length--,ue(z,this._cacheKey)&&(this._cacheKey=E,this._cacheIndex=-2),!0}return!1},je.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=E,this._cacheIndex=-2},je.prototype.keys=function(){return new x(this._keys,this._values,J)},je.prototype.values=function(){return new x(this._keys,this._values,bt)},je.prototype.entries=function(){return new x(this._keys,this._values,At)},je.prototype["@@iterator"]=function(){return this.entries()},je.prototype[a]=function(){return this.entries()},je.prototype._find=function(z,H){if(!ue(this._cacheKey,z)){this._cacheIndex=-1;for(var K=0;K<this._keys.length;K++)if(ue(this._keys[K],z)){this._cacheIndex=K;break}}return this._cacheIndex<0&&H&&(this._cacheIndex=this._keys.length,this._keys.push(z),this._values.push(void 0)),this._cacheIndex},je})();return P;function J(je,z){return je}function bt(je,z){return z}function At(je,z){return[je,z]}}o(we,"CreateMapPolyfill");function it(){var E=(function(){function A(){this._map=new h}return o(A,"Set"),Object.defineProperty(A.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),A.prototype.has=function(x){return this._map.has(x)},A.prototype.add=function(x){return this._map.set(x,x),this},A.prototype.delete=function(x){return this._map.delete(x)},A.prototype.clear=function(){this._map.clear()},A.prototype.keys=function(){return this._map.keys()},A.prototype.values=function(){return this._map.keys()},A.prototype.entries=function(){return this._map.entries()},A.prototype["@@iterator"]=function(){return this.keys()},A.prototype[a]=function(){return this.keys()},A})();return E}o(it,"CreateSetPolyfill");function Je(){var E=16,A=f.create(),x=P();return(function(){function z(){this._key=P()}return o(z,"WeakMap"),z.prototype.has=function(H){var K=J(H,!1);return K!==void 0?f.has(K,this._key):!1},z.prototype.get=function(H){var K=J(H,!1);return K!==void 0?f.get(K,this._key):void 0},z.prototype.set=function(H,K){var Y=J(H,!0);return Y[this._key]=K,this},z.prototype.delete=function(H){var K=J(H,!1);return K!==void 0?delete K[this._key]:!1},z.prototype.clear=function(){this._key=P()},z})();function P(){var z;do z="@@WeakMap@@"+je();while(f.has(A,z));return A[z]=!0,z}function J(z,H){if(!r.call(z,x)){if(!H)return;Object.defineProperty(z,x,{value:f.create()})}return z[x]}function bt(z,H){for(var K=0;K<H;++K)z[K]=Math.random()*255|0;return z}function At(z){if(typeof Uint8Array=="function"){var H=new Uint8Array(z);return typeof crypto<"u"?crypto.getRandomValues(H):typeof msCrypto<"u"?msCrypto.getRandomValues(H):bt(H,z),H}return bt(new Array(z),z)}function je(){var z=At(E);z[6]=z[6]&79|64,z[8]=z[8]&191|128;for(var H="",K=0;K<E;++K){var Y=z[K];(K===4||K===6||K===8)&&(H+="-"),Y<16&&(H+="0"),H+=Y.toString(16).toLowerCase()}return H}}o(Je,"CreateWeakMapPolyfill");function qe(E){return E.__=void 0,delete E.__,E}o(qe,"MakeDictionary")})})(dE||(dE={}))});var cu=b(by=>{var bd=class extends Error{static{o(this,"CommanderError")}constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},_y=class extends bd{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};by.CommanderError=bd;by.InvalidArgumentError=_y});var Sd=b(wy=>{var{InvalidArgumentError:fN}=cu(),Sy=class{static{o(this,"Argument")}constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new fN(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function dN(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(dN,"humanReadableArgName");wy.Argument=Sy;wy.humanReadableArgName=dN});var Ty=b(Ey=>{var{humanReadableArgName:hN}=Sd(),vy=class{static{o(this,"Help")}constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let r=o(i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,""),"getSortKey");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),r=e._getHelpOption();if(r&&!r.hidden){let i=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!i&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!i&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let i=r.options.filter(s=>!s.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>hN(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,t,r){return t.length===0?[]:[r.styleTitle(e),...t,""]}groupItems(e,t,r){let i=new Map;return e.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[])}),t.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[]),i.get(a).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(d,h){return t.formatItem(d,r,h,t)}o(s,"callFormatItem");let a=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],c=t.commandDescription(e);c.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(c),i),""]));let l=t.visibleArguments(e).map(d=>s(t.styleArgumentTerm(t.argumentTerm(d)),t.styleArgumentDescription(t.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,h)=>{let p=d.map(y=>s(t.styleOptionTerm(t.optionTerm(y)),t.styleOptionDescription(t.optionDescription(y))));a=a.concat(this.formatItemList(h,p,t))}),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(h=>s(t.styleOptionTerm(t.optionTerm(h)),t.styleOptionDescription(t.optionDescription(h))));a=a.concat(this.formatItemList("Global Options:",d,t))}return this.groupItems(e.commands,t.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,h)=>{let p=d.map(y=>s(t.styleSubcommandTerm(t.subcommandTerm(y)),t.styleSubcommandDescription(t.subcommandDescription(y))));a=a.concat(this.formatItemList(h,p,t))}),a.join(`
|
|
7
7
|
`)}displayWidth(e){return hE(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,r,i){let a=" ".repeat(2);if(!r)return a+e;let c=e.padEnd(t+e.length-i.displayWidth(e)),l=2,f=(this.helpWidth??80)-t-l-2,d;return f<this.minWidthToWrap||i.preformatted(r)?d=r:d=i.boxWrap(r,f).replace(/\n/g,`
|
|
8
8
|
`+" ".repeat(t+l)),a+c+" ".repeat(l)+d.replace(/\n/g,`
|
|
9
9
|
${a}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let r=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,s=[];return r.forEach(a=>{let c=a.match(i);if(c===null){s.push("");return}let l=[c.shift()],u=this.displayWidth(l[0]);c.forEach(f=>{let d=this.displayWidth(f);if(u+d<=t){l.push(f),u+=d;return}s.push(l.join(""));let h=f.trimStart();l=[h],u=this.displayWidth(h)}),s.push(l.join(""))}),s.join(`
|
|
@@ -28,15 +28,15 @@ Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
28
28
|
`),this.outputHelp({error:!0}));let r=t||{},i=r.exitCode||1,s=r.code||"commander.error";this._exit(i,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in lt.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,lt.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new EN(this.options),t=o(r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r)),"hasCustomOptionValue");this.options.filter(r=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,r.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=o(a=>{let c=a.attributeName(),l=this.getOptionValue(c),u=this.options.find(d=>d.negate&&c===d.attributeName()),f=this.options.find(d=>!d.negate&&c===d.attributeName());return u&&(u.presetArg===void 0&&l===!1||u.presetArg!==void 0&&l===u.presetArg)?u:f||a},"findBestOptionFromValue"),i=o(a=>{let c=r(a),l=c.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${c.envVar}'`:`option '${c.flags}'`},"getErrorMessage"),s=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(c=>c.long).map(c=>c.long);i=i.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);t=_E(e,i)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(s=>{i.push(s.name()),s.alias()&&i.push(s.alias())}),t=_E(e,i)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let i=this.createOption(t,r);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
29
29
|
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let i=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(r=>SN(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Ls.basename(e,Ls.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let i=t.formatHelp(this,t);return r.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,r,i,s;return t?(r=o(c=>this._outputConfiguration.writeErr(c),"baseWrite"),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(r=o(c=>this._outputConfiguration.writeOut(c),"baseWrite"),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o(c=>(i||(c=this._outputConfiguration.stripColor(c)),r(c)),"write"),hasColors:i,helpWidth:s}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let r=this._getOutputContext(e),i={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation({error:r.error});if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(lt.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
30
30
|
Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,s=>{let a;typeof t=="function"?a=t({error:s.error,command:s.command}):a=t,a&&s.write(`${a}
|
|
31
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function bE(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?i=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],i=s[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}o(bE,"incrementNodeInspectorPort");function Fy(){if(lt.env.NO_COLOR||lt.env.FORCE_COLOR==="0"||lt.env.FORCE_COLOR==="false")return!1;if(lt.env.FORCE_COLOR||lt.env.CLICOLOR_FORCE!==void 0)return!0}o(Fy,"useColor");Dy.Command=Py;Dy.useColor=Fy});var TE=b(Qn=>{var{Argument:wE}=Sd(),{Command:Ny}=SE(),{CommanderError:TN,InvalidArgumentError:vE}=cu(),{Help:AN}=Ty(),{Option:EE}=Cy();Qn.program=new Ny;Qn.createCommand=n=>new Ny(n);Qn.createOption=(n,e)=>new EE(n,e);Qn.createArgument=(n,e)=>new wE(n,e);Qn.Command=Ny;Qn.Option=EE;Qn.Argument=wE;Qn.Help=AN;Qn.CommanderError=TN;Qn.InvalidArgumentError=vE;Qn.InvalidOptionArgumentError=vE});var lu=b(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.AssetClass=void 0;var xE;(function(n){n.AREA="ems__Area",n.TASK="ems__Task",n.PROJECT="ems__Project",n.MEETING="ems__Meeting",n.INITIATIVE="ems__Initiative",n.TASK_PROTOTYPE="ems__TaskPrototype",n.MEETING_PROTOTYPE="ems__MeetingPrototype",n.EVENT_PROTOTYPE="exo__EventPrototype",n.PROJECT_PROTOTYPE="ems__ProjectPrototype",n.EVENT="exo__Event",n.DAILY_NOTE="pn__DailyNote",n.CONCEPT="ims__Concept",n.SESSION_START_EVENT="ems__SessionStartEvent",n.SESSION_END_EVENT="ems__SessionEndEvent",n.PROTOTYPE="exo__Prototype",n.CLASS="exo__Class",n.FLEETING_NOTE="ztlk__FleetingNote",n.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition",n.COMMAND="exocmd__Command",n.PRECONDITION="exocmd__Precondition",n.GROUNDING="exocmd__Grounding",n.COMMAND_BINDING="exocmd__CommandBinding"})(xE||(vd.AssetClass=xE={}))});var uu=b(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.EffortStatus=void 0;var IE;(function(n){n.DRAFT="ems__EffortStatusDraft",n.BACKLOG="ems__EffortStatusBacklog",n.ANALYSIS="ems__EffortStatusAnalysis",n.TODO="ems__EffortStatusToDo",n.DOING="ems__EffortStatusDoing",n.DONE="ems__EffortStatusDone",n.TRASHED="ems__EffortStatusTrashed"})(IE||(Ed.EffortStatus=IE={}))});var Ly=b(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.EFFORT_STATUS_OPTIONS=void 0;Td.EFFORT_STATUS_OPTIONS=[{value:"[[ems__EffortStatusDraft]]",label:"Draft"},{value:"[[ems__EffortStatusBacklog]]",label:"Backlog"},{value:"[[ems__EffortStatusAnalysis]]",label:"Analysis"},{value:"[[ems__EffortStatusToDo]]",label:"To Do"},{value:"[[ems__EffortStatusDoing]]",label:"Doing"},{value:"[[ems__EffortStatusDone]]",label:"Done"},{value:"[[ems__EffortStatusTrashed]]",label:"Trashed"}]});var uo=b(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.GroundingType=void 0;var CE;(function(n){n.SPARQL_UPDATE="sparql_update",n.PROPERTY_DELETE="property_delete",n.PROPERTY_SET="property_set",n.COMPOSITE="composite",n.SERVICE_CALL="service_call",n.CREATE_INSTANCE="create_instance",n.PROPERTY_APPEND="property_append",n.PROPERTY_INCREMENT="property_increment",n.PROPERTY_SHIFT="property_shift"})(CE||(Ad.GroundingType=CE={}))});var ky=b(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.CommandBindingStyleProperty=Kn.CommandBindingProperty=Kn.GroundingProperty=Kn.PreconditionProperty=Kn.CommandProperty=void 0;Kn.CommandProperty={ICON:"exocmd__Command_icon",PRECONDITION:"exocmd__Command_precondition",GROUNDING:"exocmd__Command_grounding",CONFIRM_MESSAGE:"exocmd__Command_confirmMessage",SUCCESS_MESSAGE:"exocmd__Command_successMessage",CATEGORY:"exocmd__Command_category"};Kn.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};Kn.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",TARGET_VALUE:"exocmd__Grounding_targetValue",STEPS:"exocmd__Grounding_steps",IS_DEFINED_BY:"exocmd__Grounding_isDefinedBy"};Kn.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};Kn.CommandBindingStyleProperty={VARIANT:"exocmd__CommandBindingStyle_variant",SHOW_ICON:"exocmd__CommandBindingStyle_showIcon",LABEL_CLASS:"exocmd__CommandBindingStyle_labelClass",ARIA_LABEL:"exocmd__CommandBindingStyle_ariaLabel",TOOLTIP:"exocmd__CommandBindingStyle_tooltip",KEYBOARD_SHORTCUT:"exocmd__CommandBindingStyle_keyboardShortcut",SOURCE:"exocmd__CommandBindingStyle_source"}});var jy=b(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.STYLE_SOURCE_VALUES=Tn.LABEL_CLASS_VALUES=Tn.COMMAND_VARIANT_VALUES=void 0;Tn.isCommandVariant=xN;Tn.isLabelClass=IN;Tn.isStyleSource=CN;Tn.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);Tn.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);Tn.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function xN(n){return typeof n=="string"&&Tn.COMMAND_VARIANT_VALUES.includes(n)}o(xN,"isCommandVariant");function IN(n){return typeof n=="string"&&Tn.LABEL_CLASS_VALUES.includes(n)}o(IN,"isLabelClass");function CN(n){return typeof n=="string"&&Tn.STYLE_SOURCE_VALUES.includes(n)}o(CN,"isStyleSource")});var RE=b(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.isCommandFrontmatter=RN;lc.isPreconditionFrontmatter=ON;lc.isGroundingFrontmatter=PN;lc.isCommandBindingFrontmatter=FN;function RN(n){return xd(n,"exocmd__Command")}o(RN,"isCommandFrontmatter");function ON(n){return xd(n,"exocmd__Precondition")}o(ON,"isPreconditionFrontmatter");function PN(n){return xd(n,"exocmd__Grounding")}o(PN,"isGroundingFrontmatter");function FN(n){return xd(n,"exocmd__CommandBinding")}o(FN,"isCommandBindingFrontmatter");function xd(n,e){let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}o(xd,"hasInstanceClass")});var OE=b(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.hasPosition=DN;Id.isFixed=NN;function DN(n){return typeof n.x=="number"&&typeof n.y=="number"}o(DN,"hasPosition");function NN(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(NN,"isFixed")});var PE=b(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.createEmptyGraphData=LN;Cd.mergeGraphData=kN;function LN(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(LN,"createEmptyGraphData");function kN(n,e){let t=new Map,r=new Set,i=[];for(let s of n.nodes)t.set(s.id,s);for(let s of e.nodes)t.set(s.id,s);for(let s of n.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}for(let s of e.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}o(kN,"mergeGraphData")});var My=b(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.createEdgeId=jN;Rd.edgesEqual=MN;function jN(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(jN,"createEdgeId");function MN(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(MN,"edgesEqual")});var $y=b(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.BUILT_IN_EDGE_STYLES=Mt.BUILT_IN_NODE_STYLES=Mt.DEFAULT_EDGE_STYLE=Mt.DEFAULT_NODE_STYLE=Mt.RDF_TYPE_PREDICATES=void 0;Mt.mergeNodeStyles=$N;Mt.mergeEdgeStyles=VN;Mt.extractLocalName=BN;Mt.isClassType=UN;Mt.isTypePredicate=qN;Mt.isSubClassPredicate=WN;Mt.RDF_TYPE_PREDICATES={RDF_TYPE:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",RDFS_CLASS:"http://www.w3.org/2000/01/rdf-schema#Class",OWL_CLASS:"http://www.w3.org/2002/07/owl#Class",RDFS_SUBCLASS_OF:"http://www.w3.org/2000/01/rdf-schema#subClassOf",OWL_EQUIVALENT_CLASS:"http://www.w3.org/2002/07/owl#equivalentClass",RDFS_LABEL:"http://www.w3.org/2000/01/rdf-schema#label",RDFS_COMMENT:"http://www.w3.org/2000/01/rdf-schema#comment"};Mt.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Mt.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Mt.BUILT_IN_NODE_STYLES={"http://www.w3.org/2000/01/rdf-schema#Class":{color:"#f59e0b",shape:"diamond",size:40},"http://www.w3.org/2002/07/owl#Class":{color:"#f59e0b",shape:"diamond",size:40},ems__Task:{color:"#22c55e",shape:"circle"},ems__Project:{color:"#3b82f6",shape:"square"},ems__Area:{color:"#8b5cf6",shape:"hexagon",size:40},ems__Meeting:{color:"#ec4899",shape:"circle"},exo__Class:{color:"#f59e0b",shape:"diamond"},ims__Person:{color:"#06b6d4",shape:"circle"}};Mt.BUILT_IN_EDGE_STYLES={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":{color:"#f59e0b",lineStyle:"dashed",arrow:"standard"},"http://www.w3.org/2000/01/rdf-schema#subClassOf":{color:"#8b5cf6",width:2,arrow:"triangle"},"https://exocortex.my/ontology/ems#Effort_parent":{color:"#6366f1",width:2,arrow:"standard"},"https://exocortex.my/ontology/exo#Asset_prototype":{color:"#f59e0b",lineStyle:"dashed",arrow:"circle"},"https://exocortex.my/ontology/exo#references":{color:"#22c55e",opacity:.4,arrow:"standard"}};function $N(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o($N,"mergeNodeStyles");function VN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(VN,"mergeEdgeStyles");function BN(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(BN,"extractLocalName");function UN(n){return n===Mt.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Mt.RDF_TYPE_PREDICATES.OWL_CLASS}o(UN,"isClassType");function qN(n){return n===Mt.RDF_TYPE_PREDICATES.RDF_TYPE}o(qN,"isTypePredicate");function WN(n){return n===Mt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(WN,"isSubClassPredicate")});var DE=b(FE=>{"use strict";Object.defineProperty(FE,"__esModule",{value:!0})});var Ee=b(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.IRI=void 0;var Vy=class n{static{o(this,"IRI")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("IRI cannot be empty");if(!n.isValidIRI(t))throw new Error("Invalid IRI format");this._value=t}get value(){return this._value}equals(e){return this._value===e._value}toString(){return this._value}static isValidIRI(e){if(!e||e.trim().length===0||/\s/.test(e)||!/^[a-z][a-z0-9+.-]*:/i.test(e))return!1;let r=["http","https","ftp","ftps","file","mailto","tel","data","ws","wss","urn","obsidian"],i=e.match(/^([a-z][a-z0-9+.-]*?):/i);if(i){let s=i[1].toLowerCase();if(!r.includes(s))return!1}try{return new URL(e),!0}catch{return/^urn:[a-z0-9][a-z0-9-]{0,31}:[^\s]+$/i.test(e)}}};Od.IRI=Vy});var Me=b(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.Literal=void 0;fo.parseLanguageTag=NE;fo.createDirectionalLiteral=zN;fo.createLiteralFromLanguageTag=HN;var GN="http://www.w3.org/2001/XMLSchema#string",fu=class{static{o(this,"Literal")}constructor(e,t,r,i){if(e.length===0)throw new Error("Literal value cannot be empty");if(t&&r)throw new Error("Literal cannot have both datatype and language tag");if(i&&!r)throw new Error("Literal cannot have direction without language tag");if(i&&i!=="ltr"&&i!=="rtl")throw new Error('Direction must be "ltr" or "rtl"');this._value=e,this._datatype=t,this._language=r?r.toLowerCase():void 0,this._direction=i}get value(){return this._value}get datatype(){return this._datatype}get language(){return this._language}get direction(){return this._direction}hasDirection(){return this._direction!==void 0}equals(e){if(this._value!==e._value||this._language!==e._language||this._direction!==e._direction)return!1;let t=this.normalizedDatatype(),r=e.normalizedDatatype();return t===r}normalizedDatatype(){return!this._datatype||this._datatype.value===GN?null:this._datatype.value}toString(){let e=`"${this._value}"`;return this._datatype?e+=`^^<${this._datatype.value}>`:this._language&&(e+=`@${this._language}`,this._direction&&(e+=`--${this._direction}`)),e}};fo.Literal=fu;function NE(n){let t=n.lastIndexOf("--");if(t===-1)return{language:n.toLowerCase()};let r=n.substring(t+2),i=n.substring(0,t);return r==="ltr"||r==="rtl"?{language:i.toLowerCase(),direction:r}:{language:n.toLowerCase()}}o(NE,"parseLanguageTag");function zN(n,e,t){return new fu(n,void 0,e,t)}o(zN,"createDirectionalLiteral");function HN(n,e){let{language:t,direction:r}=NE(e);return new fu(n,void 0,t,r)}o(HN,"createLiteralFromLanguageTag")});var $t=b(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});Fd.BlankNode=void 0;var Pd=class n{static{o(this,"BlankNode")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("BlankNode id cannot be empty");this._id=t}get id(){return this._id}equals(e){return this._id===e._id}toString(){return`_:${this._id}`}static generateId(){return`b${++n.counter}`}static create(){return new n(n.generateId())}};Fd.BlankNode=Pd;Pd.counter=0});var ir=b(Dd=>{"use strict";Object.defineProperty(Dd,"__esModule",{value:!0});Dd.Namespace=void 0;var LE=Ee(),Be=class n{static{o(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new LE.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new LE.IRI(`${this._iri.value}${e}`)}expand(e){let t=e.split(":");if(t.length!==2)return null;let[r,i]=t;return r!==this._prefix?null:this.term(i)}static forPrefix(e){if(!/^[a-z][a-zA-Z0-9]*$/.test(e))return null;let t=n.KNOWN_NAMESPACES.find(r=>r.prefix===e);return t||new n(e,`${n.EXOCORTEX_ONTOLOGY_BASE}${e}#`)}static fromPropertyKey(e){let t=/^([a-z][a-zA-Z0-9]*)__(.+)$/.exec(e);if(!t)return null;let r=n.forPrefix(t[1]);return r?{namespace:r,localName:t[2]}:null}};Dd.Namespace=Be;Be.RDF=new Be("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");Be.RDFS=new Be("rdfs","http://www.w3.org/2000/01/rdf-schema#");Be.OWL=new Be("owl","http://www.w3.org/2002/07/owl#");Be.XSD=new Be("xsd","http://www.w3.org/2001/XMLSchema#");Be.EXO=new Be("exo","https://exocortex.my/ontology/exo#");Be.EMS=new Be("ems","https://exocortex.my/ontology/ems#");Be.EXOCMD=new Be("exocmd","https://exocortex.my/ontology/exocmd#");Be.IMS=new Be("ims","https://exocortex.my/ontology/ims#");Be.ZTLK=new Be("ztlk","https://exocortex.my/ontology/ztlk#");Be.PTMS=new Be("ptms","https://exocortex.my/ontology/ptms#");Be.LIT=new Be("lit","https://exocortex.my/ontology/lit#");Be.INBOX=new Be("inbox","https://exocortex.my/ontology/inbox#");Be.PMBOK=new Be("pmbok","https://exocortex.my/ontology/pmbok#");Be.EXOCORTEX_ONTOLOGY_BASE="https://exocortex.my/ontology/";Be.KNOWN_NAMESPACES=[Be.EXO,Be.EMS,Be.EXOCMD,Be.IMS,Be.ZTLK,Be.PTMS,Be.LIT,Be.INBOX,Be.PMBOK]});var Yn=b(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.Triple=void 0;var By=Ee(),Uy=Me(),qy=$t(),Wy=class{static{o(this,"Triple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof By.IRI&&t instanceof By.IRI||e instanceof qy.BlankNode&&t instanceof qy.BlankNode||e instanceof Uy.Literal&&t instanceof Uy.Literal||this.isQuotedTriple(e)&&this.isQuotedTriple(t)?e.equals(t):!1}isQuotedTriple(e){return typeof e=="object"&&e!==null&&"termType"in e&&e.termType==="QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`${e} ${t} ${r} .`}nodeToString(e){return e instanceof By.IRI?`<${e.value}>`:e instanceof qy.BlankNode||e instanceof Uy.Literal||this.isQuotedTriple(e)?e.toString():""}};Nd.Triple=Wy});var du=b(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.QuotedTriple=void 0;var Gy=Ee(),zy=Me(),Hy=$t(),Qy=class n{static{o(this,"QuotedTriple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof Gy.IRI&&t instanceof Gy.IRI||e instanceof Hy.BlankNode&&t instanceof Hy.BlankNode||e instanceof zy.Literal&&t instanceof zy.Literal||e instanceof n&&t instanceof n?e.equals(t):!1}get termType(){return"QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`<< ${e} ${t} ${r} >>`}nodeToString(e){return e instanceof Gy.IRI?`<${e.value}>`:e instanceof Hy.BlankNode||e instanceof zy.Literal||e instanceof n?e.toString():""}};Ld.QuotedTriple=Qy});var kE=b(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.QuotedTriple=Yt.Triple=Yt.Namespace=Yt.BlankNode=Yt.createLiteralFromLanguageTag=Yt.createDirectionalLiteral=Yt.parseLanguageTag=Yt.Literal=Yt.IRI=void 0;var QN=Ee();Object.defineProperty(Yt,"IRI",{enumerable:!0,get:o(function(){return QN.IRI},"get")});var kd=Me();Object.defineProperty(Yt,"Literal",{enumerable:!0,get:o(function(){return kd.Literal},"get")});Object.defineProperty(Yt,"parseLanguageTag",{enumerable:!0,get:o(function(){return kd.parseLanguageTag},"get")});Object.defineProperty(Yt,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return kd.createDirectionalLiteral},"get")});Object.defineProperty(Yt,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return kd.createLiteralFromLanguageTag},"get")});var KN=$t();Object.defineProperty(Yt,"BlankNode",{enumerable:!0,get:o(function(){return KN.BlankNode},"get")});var YN=ir();Object.defineProperty(Yt,"Namespace",{enumerable:!0,get:o(function(){return YN.Namespace},"get")});var XN=Yn();Object.defineProperty(Yt,"Triple",{enumerable:!0,get:o(function(){return XN.Triple},"get")});var JN=du();Object.defineProperty(Yt,"QuotedTriple",{enumerable:!0,get:o(function(){return JN.QuotedTriple},"get")})});var jd=b(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.UUID_URL_NAMESPACE=Jn.DEFAULT_LANGUAGE_TAG=Jn.REQUIRED_PROPERTIES=Jn.ALLOWED_PROPERTIES=Jn.Exo003MetadataType=void 0;var Xn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(Xn||(Jn.Exo003MetadataType=Xn={}));Jn.ALLOWED_PROPERTIES={[Xn.Namespace]:["metadata","uri","aliases"],[Xn.Anchor]:["metadata","uri","aliases"],[Xn.BlankNode]:["metadata","uri","aliases"],[Xn.Statement]:["metadata","subject","predicate","object","aliases"],[Xn.Body]:["metadata","subject","predicate","aliases"]};Jn.REQUIRED_PROPERTIES={[Xn.Namespace]:["metadata","uri"],[Xn.Anchor]:["metadata","uri"],[Xn.BlankNode]:["metadata","uri"],[Xn.Statement]:["metadata","subject","predicate","object"],[Xn.Body]:["metadata","subject","predicate"]};Jn.DEFAULT_LANGUAGE_TAG="ru";Jn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var jE=b(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var ME=b(Yy=>{"use strict";Object.defineProperty(Yy,"__esModule",{value:!0});Yy.default="00000000-0000-0000-0000-000000000000"});var $E=b(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});Xy.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var hu=b(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});var ZN=$E();function eL(n){return typeof n=="string"&&ZN.default.test(n)}o(eL,"validate");Jy.default=eL});var pu=b(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var tL=hu();function rL(n){if(!(0,tL.default)(n))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(n.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(n.slice(9,13),16))>>>8,e&255,(e=parseInt(n.slice(14,18),16))>>>8,e&255,(e=parseInt(n.slice(19,23),16))>>>8,e&255,(e=parseInt(n.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}o(rL,"parse");Zy.default=rL});var ks=b(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.unsafeStringify=void 0;var nL=hu(),Pr=[];for(let n=0;n<256;++n)Pr.push((n+256).toString(16).slice(1));function VE(n,e=0){return(Pr[n[e+0]]+Pr[n[e+1]]+Pr[n[e+2]]+Pr[n[e+3]]+"-"+Pr[n[e+4]]+Pr[n[e+5]]+"-"+Pr[n[e+6]]+Pr[n[e+7]]+"-"+Pr[n[e+8]]+Pr[n[e+9]]+"-"+Pr[n[e+10]]+Pr[n[e+11]]+Pr[n[e+12]]+Pr[n[e+13]]+Pr[n[e+14]]+Pr[n[e+15]]).toLowerCase()}o(VE,"unsafeStringify");mu.unsafeStringify=VE;function iL(n,e=0){let t=VE(n,e);if(!(0,nL.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(iL,"stringify");mu.default=iL});var Vd=b(e0=>{"use strict";Object.defineProperty(e0,"__esModule",{value:!0});var sL=require("crypto"),$d=new Uint8Array(256),Md=$d.length;function aL(){return Md>$d.length-16&&((0,sL.randomFillSync)($d),Md=0),$d.slice(Md,Md+=16)}o(aL,"rng");e0.default=aL});var t0=b(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.updateV1State=void 0;var BE=Vd(),oL=ks(),gu={};function cL(n,e,t){let r,i=n?._v6??!1;if(n){let s=Object.keys(n);s.length===1&&s[0]==="_v6"&&(n=void 0)}if(n)r=UE(n.random??n.rng?.()??(0,BE.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,BE.default)();qE(gu,s,a),r=UE(a,gu.msecs,gu.nsecs,i?void 0:gu.clockseq,i?void 0:gu.node,e,t)}return e??(0,oL.unsafeStringify)(r)}o(cL,"v1");function qE(n,e,t){return n.msecs??=-1/0,n.nsecs??=0,e===n.msecs?(n.nsecs++,n.nsecs>=1e4&&(n.node=void 0,n.nsecs=0)):e>n.msecs?n.nsecs=0:e<n.msecs&&(n.node=void 0),n.node||(n.node=t.slice(10,16),n.node[0]|=1,n.clockseq=(t[8]<<8|t[9])&16383),n.msecs=e,n}o(qE,"updateV1State");yu.updateV1State=qE;function UE(n,e,t,r,i,s,a=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),a=0;else if(a<0||a+16>s.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);e??=Date.now(),t??=0,r??=(n[8]<<8|n[9])&16383,i??=n.slice(10,16),e+=122192928e5;let c=((e&268435455)*1e4+t)%4294967296;s[a++]=c>>>24&255,s[a++]=c>>>16&255,s[a++]=c>>>8&255,s[a++]=c&255;let l=e/4294967296*1e4&268435455;s[a++]=l>>>8&255,s[a++]=l&255,s[a++]=l>>>24&15|16,s[a++]=l>>>16&255,s[a++]=r>>>8|128,s[a++]=r&255;for(let u=0;u<6;++u)s[a++]=i[u];return s}o(UE,"v1Bytes");yu.default=cL});var n0=b(r0=>{"use strict";Object.defineProperty(r0,"__esModule",{value:!0});var lL=pu(),uL=ks();function fL(n){let e=typeof n=="string"?(0,lL.default)(n):n,t=dL(e);return typeof n=="string"?(0,uL.unsafeStringify)(t):t}o(fL,"v1ToV6");r0.default=fL;function dL(n){return Uint8Array.of((n[6]&15)<<4|n[7]>>4&15,(n[7]&15)<<4|(n[4]&240)>>4,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,(n[1]&15)<<4|(n[2]&240)>>4,96|n[2]&15,n[3],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(dL,"_v1ToV6")});var WE=b(i0=>{"use strict";Object.defineProperty(i0,"__esModule",{value:!0});var hL=require("crypto");function pL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,hL.createHash)("md5").update(n).digest()}o(pL,"md5");i0.default=pL});var _u=b(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.URL=js.DNS=js.stringToBytes=void 0;var GE=pu(),mL=ks();function zE(n){n=unescape(encodeURIComponent(n));let e=new Uint8Array(n.length);for(let t=0;t<n.length;++t)e[t]=n.charCodeAt(t);return e}o(zE,"stringToBytes");js.stringToBytes=zE;js.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";js.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function gL(n,e,t,r,i,s){let a=typeof t=="string"?zE(t):t,c=typeof r=="string"?(0,GE.default)(r):r;if(typeof r=="string"&&(r=(0,GE.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+a.length);if(l.set(c),l.set(a,c.length),l=e(l),l[6]=l[6]&15|n,l[8]=l[8]&63|128,i){s=s||0;for(let u=0;u<16;++u)i[s+u]=l[u];return i}return(0,mL.unsafeStringify)(l)}o(gL,"v35");js.default=gL});var QE=b(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.URL=ho.DNS=void 0;var yL=WE(),s0=_u(),HE=_u();Object.defineProperty(ho,"DNS",{enumerable:!0,get:o(function(){return HE.DNS},"get")});Object.defineProperty(ho,"URL",{enumerable:!0,get:o(function(){return HE.URL},"get")});function a0(n,e,t,r){return(0,s0.default)(48,yL.default,n,e,t,r)}o(a0,"v3");a0.DNS=s0.DNS;a0.URL=s0.URL;ho.default=a0});var KE=b(o0=>{"use strict";Object.defineProperty(o0,"__esModule",{value:!0});var _L=require("crypto");o0.default={randomUUID:_L.randomUUID}});var XE=b(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0});var YE=KE(),bL=Vd(),SL=ks();function wL(n,e,t){if(YE.default.randomUUID&&!e&&!n)return YE.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,bL.default)();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return(0,SL.unsafeStringify)(r)}o(wL,"v4");c0.default=wL});var JE=b(l0=>{"use strict";Object.defineProperty(l0,"__esModule",{value:!0});var vL=require("crypto");function EL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,vL.createHash)("sha1").update(n).digest()}o(EL,"sha1");l0.default=EL});var eT=b(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.URL=po.DNS=void 0;var TL=JE(),u0=_u(),ZE=_u();Object.defineProperty(po,"DNS",{enumerable:!0,get:o(function(){return ZE.DNS},"get")});Object.defineProperty(po,"URL",{enumerable:!0,get:o(function(){return ZE.URL},"get")});function f0(n,e,t,r){return(0,u0.default)(80,TL.default,n,e,t,r)}o(f0,"v5");f0.DNS=u0.DNS;f0.URL=u0.URL;po.default=f0});var tT=b(d0=>{"use strict";Object.defineProperty(d0,"__esModule",{value:!0});var AL=ks(),xL=t0(),IL=n0();function CL(n,e,t){n??={},t??=0;let r=(0,xL.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,IL.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,AL.unsafeStringify)(r)}o(CL,"v6");d0.default=CL});var rT=b(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var RL=pu(),OL=ks();function PL(n){let e=typeof n=="string"?(0,RL.default)(n):n,t=FL(e);return typeof n=="string"?(0,OL.unsafeStringify)(t):t}o(PL,"v6ToV1");h0.default=PL;function FL(n){return Uint8Array.of((n[3]&15)<<4|n[4]>>4&15,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|n[6]&15,n[7],(n[1]&15)<<4|(n[2]&240)>>4,(n[2]&15)<<4|(n[3]&240)>>4,16|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(FL,"_v6ToV1")});var aT=b(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.updateV7State=void 0;var nT=Vd(),DL=ks(),p0={};function NL(n,e,t){let r;if(n)r=iT(n.random??n.rng?.()??(0,nT.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,nT.default)();sT(p0,i,s),r=iT(s,p0.msecs,p0.seq,e,t)}return e??(0,DL.unsafeStringify)(r)}o(NL,"v7");function sT(n,e,t){return n.msecs??=-1/0,n.seq??=0,e>n.msecs?(n.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],n.msecs=e):(n.seq=n.seq+1|0,n.seq===0&&n.msecs++),n}o(sT,"updateV7State");bu.updateV7State=sT;function iT(n,e,t,r,i=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return e??=Date.now(),t??=n[6]*127<<24|n[7]<<16|n[8]<<8|n[9],r[i++]=e/1099511627776&255,r[i++]=e/4294967296&255,r[i++]=e/16777216&255,r[i++]=e/65536&255,r[i++]=e/256&255,r[i++]=e&255,r[i++]=112|t>>>28&15,r[i++]=t>>>20&255,r[i++]=128|t>>>14&63,r[i++]=t>>>6&255,r[i++]=t<<2&255|n[10]&3,r[i++]=n[11],r[i++]=n[12],r[i++]=n[13],r[i++]=n[14],r[i++]=n[15],r}o(iT,"v7Bytes");bu.default=NL});var oT=b(m0=>{"use strict";Object.defineProperty(m0,"__esModule",{value:!0});var LL=hu();function kL(n){if(!(0,LL.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(kL,"version");m0.default=kL});var ui=b(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.version=ut.validate=ut.v7=ut.v6ToV1=ut.v6=ut.v5=ut.v4=ut.v3=ut.v1ToV6=ut.v1=ut.stringify=ut.parse=ut.NIL=ut.MAX=void 0;var jL=jE();Object.defineProperty(ut,"MAX",{enumerable:!0,get:o(function(){return jL.default},"get")});var ML=ME();Object.defineProperty(ut,"NIL",{enumerable:!0,get:o(function(){return ML.default},"get")});var $L=pu();Object.defineProperty(ut,"parse",{enumerable:!0,get:o(function(){return $L.default},"get")});var VL=ks();Object.defineProperty(ut,"stringify",{enumerable:!0,get:o(function(){return VL.default},"get")});var BL=t0();Object.defineProperty(ut,"v1",{enumerable:!0,get:o(function(){return BL.default},"get")});var UL=n0();Object.defineProperty(ut,"v1ToV6",{enumerable:!0,get:o(function(){return UL.default},"get")});var qL=QE();Object.defineProperty(ut,"v3",{enumerable:!0,get:o(function(){return qL.default},"get")});var WL=XE();Object.defineProperty(ut,"v4",{enumerable:!0,get:o(function(){return WL.default},"get")});var GL=eT();Object.defineProperty(ut,"v5",{enumerable:!0,get:o(function(){return GL.default},"get")});var zL=tT();Object.defineProperty(ut,"v6",{enumerable:!0,get:o(function(){return zL.default},"get")});var HL=rT();Object.defineProperty(ut,"v6ToV1",{enumerable:!0,get:o(function(){return HL.default},"get")});var QL=aT();Object.defineProperty(ut,"v7",{enumerable:!0,get:o(function(){return QL.default},"get")});var KL=hu();Object.defineProperty(ut,"validate",{enumerable:!0,get:o(function(){return KL.default},"get")});var YL=oT();Object.defineProperty(ut,"version",{enumerable:!0,get:o(function(){return YL.default},"get")})});var _0=b(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.Exo003UUIDGenerator=void 0;var g0=ui(),cT=jd(),y0=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,g0.v5)(e,cT.UUID_URL_NAMESPACE)}static generateAssetUUID(e,t){if(!t||t.trim().length===0)throw new Error("Local identifier cannot be empty");let r=this.generateNamespaceUUID(e);return(0,g0.v5)(t,r)}static generateFromIRI(e){if(!e||e.trim().length===0)throw new Error("IRI cannot be empty");let{namespace:t,localName:r}=this.splitIRI(e);return r?this.generateAssetUUID(t,r):(0,g0.v5)(e,cT.UUID_URL_NAMESPACE)}static generateBlankNodeUUID(e,t){if(!e||e.trim().length===0)throw new Error("Blank node ID cannot be empty");let r="urn:exocortex:blank-node:",i=t?`${t}#${e}`:e;return this.generateAssetUUID(r,i)}static generateStatementUUID(e,t,r){if(!e||!t||!r)throw new Error("Subject, predicate, and object cannot be empty");let i="urn:exocortex:statement:",s=`${e} ${t} ${r}`;return this.generateAssetUUID(i,s)}static generateBodyUUID(e,t){let r="urn:exocortex:body:",i=e;return t?.datatype?i+=`^^${t.datatype}`:t?.language&&(i+=`@${t.language}`,t.direction&&(i+=`--${t.direction}`)),this.generateAssetUUID(r,i)}static splitIRI(e){let t=e.lastIndexOf("#");if(t!==-1&&t<e.length-1)return{namespace:e.substring(0,t+1),localName:e.substring(t+1)};let r=e.lastIndexOf("/"),i=e.indexOf("://");return r!==-1&&r>i+2&&r<e.length-1?{namespace:e.substring(0,r+1),localName:e.substring(r+1)}:{namespace:e,localName:""}}static isValidUUID(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)}};Bd.Exo003UUIDGenerator=y0});var uT=b(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.Exo003Parser=void 0;var mt=jd(),Su=_0(),_a=Ee(),Ud=Me(),lT=$t(),XL=Yn(),b0=class{static{o(this,"Exo003Parser")}static parse(e,t){let r=this.validate(e);if(!r.valid)return{success:!1,errors:r.errors};let i=e.metadata;try{return{success:!0,metadata:this.parseByType(e,i),bodyContent:i===mt.Exo003MetadataType.Body?t:void 0}}catch(s){return{success:!1,errors:[s instanceof Error?s.message:String(s)]}}}static validate(e){let t=[],r=[];if(!e.metadata)return t.push("Missing required property: metadata"),{valid:!1,errors:t,warnings:r};let i=e.metadata;if(!Object.values(mt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(mt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=mt.ALLOWED_PROPERTIES[s],c=mt.REQUIRED_PROPERTIES[s];for(let l of c)(e[l]===void 0||e[l]===null)&&t.push(`Missing required property: ${l}`);for(let l of Object.keys(e))a.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case mt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case mt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case mt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case mt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case mt.Exo003MetadataType.Body:this.validateBodyMetadata(e,t,r);break}return{valid:t.length===0,errors:t,warnings:r}}static parseByType(e,t){let r={metadata:t,aliases:e.aliases};switch(t){case mt.Exo003MetadataType.Namespace:return{...r,metadata:mt.Exo003MetadataType.Namespace,uri:e.uri};case mt.Exo003MetadataType.Anchor:return{...r,metadata:mt.Exo003MetadataType.Anchor,uri:e.uri};case mt.Exo003MetadataType.BlankNode:return{...r,metadata:mt.Exo003MetadataType.BlankNode,uri:e.uri};case mt.Exo003MetadataType.Statement:return{...r,metadata:mt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case mt.Exo003MetadataType.Body:return{...r,metadata:mt.Exo003MetadataType.Body,subject:e.subject,predicate:e.predicate}}}static validateNamespaceMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new _a.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateAnchorMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new _a.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateBlankNodeMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r){let i=r;if(!i.startsWith("_:"))try{new _a.IRI(i)}catch{t.push(`uri is not a valid IRI or blank node identifier: ${String(r)}`)}}}static validateStatementMetadata(e,t){let r=e.subject,i=e.predicate,s=e.object,a=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of a)l&&typeof l!="string"&&t.push(`${c} must be a string`)}static validateBodyMetadata(e,t,r){let i=e.subject,s=e.predicate;i&&typeof i!="string"&&t.push("subject must be a string"),s&&typeof s!="string"&&t.push("predicate must be a string")}static toTriple(e,t,r){let i=t(e.subject),s;if(i.type==="iri")s=new _a.IRI(i.value);else if(i.type==="blank")s=new lT.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let a=t(e.predicate);if(a.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new _a.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new _a.IRI(l.value);else if(l.type==="blank")u=new lT.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new Ud.Literal(f,new _a.IRI(l.datatype));else{let d=l.language||mt.DEFAULT_LANGUAGE_TAG;u=(0,Ud.createDirectionalLiteral)(f,d,l.direction)}}return new XL.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new Ud.Literal(t,new _a.IRI(r.datatype));let i=r?.language||mt.DEFAULT_LANGUAGE_TAG;return(0,Ud.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(mt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case mt.Exo003MetadataType.Namespace:return Su.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Anchor:return Su.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.BlankNode:return Su.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Statement:{let r=e;return Su.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case mt.Exo003MetadataType.Body:{let r=e;return Su.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};qd.Exo003Parser=b0});var S0=b(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.Exo003Parser=Vr.Exo003UUIDGenerator=Vr.UUID_URL_NAMESPACE=Vr.DEFAULT_LANGUAGE_TAG=Vr.REQUIRED_PROPERTIES=Vr.ALLOWED_PROPERTIES=Vr.Exo003MetadataType=void 0;var wu=jd();Object.defineProperty(Vr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return wu.Exo003MetadataType},"get")});Object.defineProperty(Vr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return wu.ALLOWED_PROPERTIES},"get")});Object.defineProperty(Vr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return wu.REQUIRED_PROPERTIES},"get")});Object.defineProperty(Vr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return wu.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(Vr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return wu.UUID_URL_NAMESPACE},"get")});var JL=_0();Object.defineProperty(Vr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return JL.Exo003UUIDGenerator},"get")});var ZL=uT();Object.defineProperty(Vr,"Exo003Parser",{enumerable:!0,get:o(function(){return ZL.Exo003Parser},"get")})});var Zi=b(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.WikiLinkHelpers=void 0;var vu=class{static{o(this,"WikiLinkHelpers")}static normalize(e){if(!e)return"";let t=e.replace(this.WIKI_LINK_PATTERN,"").trim();if(!t)return"";let r=t.indexOf("|");if(r===-1)return t;let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();return this.UUID_PATTERN.test(i)&&s||i}static normalizeArray(e){return e?(Array.isArray(e)?e:[e]).map(r=>this.normalize(r)).filter(r=>r.length>0):[]}static equals(e,t){return this.normalize(e)===this.normalize(t)}static includes(e,t){let r=this.normalizeArray(e),i=this.normalize(t);return r.includes(i)}static resolveSymbolic(e,t){let r=this.normalize(e);if(!r)return"";if(this.UUID_PATTERN.test(r)){let i=t(r);return i&&i.length>0?i:r}return r}static resolveSymbolicArray(e,t){return e?(Array.isArray(e)?e:[e]).map(i=>this.resolveSymbolic(i,t)).filter(i=>i.length>0):[]}};Wd.WikiLinkHelpers=vu;vu.WIKI_LINK_PATTERN=/\[\[|\]\]/g;vu.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var jn=b(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.CommandBindingProperty=gr.GroundingProperty=gr.PreconditionProperty=gr.CommandProperty=gr.GroundingType=gr.EFFORT_STATUS_OPTIONS=gr.EffortStatus=gr.AssetClass=void 0;var ek=lu();Object.defineProperty(gr,"AssetClass",{enumerable:!0,get:o(function(){return ek.AssetClass},"get")});var tk=uu();Object.defineProperty(gr,"EffortStatus",{enumerable:!0,get:o(function(){return tk.EffortStatus},"get")});var rk=Ly();Object.defineProperty(gr,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return rk.EFFORT_STATUS_OPTIONS},"get")});var nk=uo();Object.defineProperty(gr,"GroundingType",{enumerable:!0,get:o(function(){return nk.GroundingType},"get")});var Gd=ky();Object.defineProperty(gr,"CommandProperty",{enumerable:!0,get:o(function(){return Gd.CommandProperty},"get")});Object.defineProperty(gr,"PreconditionProperty",{enumerable:!0,get:o(function(){return Gd.PreconditionProperty},"get")});Object.defineProperty(gr,"GroundingProperty",{enumerable:!0,get:o(function(){return Gd.GroundingProperty},"get")});Object.defineProperty(gr,"CommandBindingProperty",{enumerable:!0,get:o(function(){return Gd.CommandBindingProperty},"get")})});var yo=b(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.hasClass=go;Br.isAreaOrProject=ik;Br.isEffort=sk;Br.hasStatus=ak;Br.isAssetArchived=ok;Br.hasEmptyProperties=ck;Br.needsFolderRepair=lk;Br.getTodayDateString=w0;Br.isPlannedForToday=uk;Br.hasPlannedStartTimestamp=fk;Br.extractDailyNoteDate=dk;Br.isCurrentDateGteDay=hk;Br.inheritsFromPrototype=hT;Br.isPrototypeClass=mk;var dT=Zi(),mo=jn();function go(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>dT.WikiLinkHelpers.normalize(r)===e):!1}o(go,"hasClass");function ik(n){return go(n,mo.AssetClass.AREA)||go(n,mo.AssetClass.PROJECT)}o(ik,"isAreaOrProject");function sk(n){return go(n,mo.AssetClass.TASK)||go(n,mo.AssetClass.PROJECT)||go(n,mo.AssetClass.MEETING)}o(sk,"isEffort");function ak(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?dT.WikiLinkHelpers.normalize(t)===e:!1}o(ak,"hasStatus");function ok(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(ok,"isAssetArchived");function ck(n){return!n||Object.keys(n).length===0?!1:Object.values(n).some(e=>!!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0))}o(ck,"hasEmptyProperties");function lk(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(lk,"needsFolderRepair");function w0(){let n=new Date,e=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0");return`${e}-${t}-${r}`}o(w0,"getTodayDateString");function uk(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=w0();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(uk,"isPlannedForToday");function fk(n){let e=n.ems__Effort_plannedStartTimestamp;return e?typeof e=="string"?e.trim().length>0:Array.isArray(e)&&e.length>0?String(e[0]).trim().length>0:!1:!1}o(fk,"hasPlannedStartTimestamp");function dk(n){let e=n.pn__DailyNote_day;if(!e)return null;if(typeof e=="string"){let t=e.match(/\[\[([^\[\]]+)\]\]/);return t?t[1]:e}if(Array.isArray(e)&&e.length>0){let t=String(e[0]),r=t.match(/\[\[([^\[\]]+)\]\]/);return r?r[1]:t}return null}o(dk,"extractDailyNoteDate");function hk(n){return w0()>=n}o(hk,"isCurrentDateGteDay");function fT(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(fT,"normalizeWithQuotes");var pk=10;function hT(n,e=pk){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let a of s){let c=fT(a);c&&i.push({className:c,depth:0})}for(;i.length>0;){let a=i.shift();if(!a)continue;let{className:c,depth:l}=a;if(l>e)continue;if(c===mo.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let d=Array.isArray(f)?f:[f];for(let h of d){let p=fT(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(hT,"inheritsFromPrototype");function mk(n,e){return go(n,mo.AssetClass.CLASS)?hT(e):!1}o(mk,"isPrototypeClass")});var pT=b(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.canCreateTask=gk;fc.canCreateRelatedTask=yk;fc.canConvertTaskToProject=_k;fc.canSetCriticalityZone=bk;var uc=yo(),v0=jn();function gk(n){return(0,uc.isAreaOrProject)(n.instanceClass)}o(gk,"canCreateTask");function yk(n){return!(!(0,uc.hasClass)(n.instanceClass,v0.AssetClass.TASK)||(0,uc.isAssetArchived)(n.isArchived))}o(yk,"canCreateRelatedTask");function _k(n){return(0,uc.hasClass)(n.instanceClass,v0.AssetClass.TASK)}o(_k,"canConvertTaskToProject");function bk(n){return!(!(0,uc.hasClass)(n.instanceClass,v0.AssetClass.TASK)||(0,uc.isAssetArchived)(n.isArchived))}o(bk,"canSetCriticalityZone")});var mT=b(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.canCreateProject=Sk;dc.canMoveToAnalysis=wk;dc.canMoveToToDo=vk;dc.canConvertProjectToTask=Ek;var ba=yo(),Sa=jn();function Sk(n){return(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.AREA)||(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.INITIATIVE)||(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.PROJECT)}o(Sk,"canCreateProject");function wk(n){return(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.PROJECT)?(0,ba.hasStatus)(n.currentStatus,Sa.EffortStatus.BACKLOG):!1}o(wk,"canMoveToAnalysis");function vk(n){return(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.PROJECT)?(0,ba.hasStatus)(n.currentStatus,Sa.EffortStatus.ANALYSIS):!1}o(vk,"canMoveToToDo");function Ek(n){return(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.PROJECT)}o(Ek,"canConvertProjectToTask")});var _T=b(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.canCreateChildArea=Tk;zd.canSetActiveFocus=Ak;var gT=yo(),yT=jn();function Tk(n){return(0,gT.hasClass)(n.instanceClass,yT.AssetClass.AREA)}o(Tk,"canCreateChildArea");function Ak(n){return(0,gT.hasClass)(n.instanceClass,yT.AssetClass.AREA)}o(Ak,"canSetActiveFocus")});var ST=b(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.canPlanOnToday=xk;on.canPlanForEvening=Ik;on.canShiftDayBackward=Ck;on.canShiftDayForward=Rk;on.canSetDraftStatus=Ok;on.canMoveToBacklog=Pk;on.canStartEffort=Fk;on.canMarkDone=Dk;on.canTrashEffort=Nk;on.canVoteOnEffort=Lk;on.canRollbackStatus=kk;on.canArchiveTask=jk;on.canMarkReviewed=Mk;var bT=Zi(),ht=yo(),an=jn();function xk(n){return!(!(0,ht.isEffort)(n.instanceClass)||(0,ht.isPlannedForToday)(n.metadata))}o(xk,"canPlanOnToday");function Ik(n){return!(0,ht.hasClass)(n.instanceClass,an.AssetClass.TASK)&&!(0,ht.hasClass)(n.instanceClass,an.AssetClass.MEETING)?!1:(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.BACKLOG)}o(Ik,"canPlanForEvening");function Ck(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasPlannedStartTimestamp)(n.metadata):!1}o(Ck,"canShiftDayBackward");function Rk(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasPlannedStartTimestamp)(n.metadata):!1}o(Rk,"canShiftDayForward");function Ok(n){return(0,ht.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(Ok,"canSetDraftStatus");function Pk(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.DRAFT):!1}o(Pk,"canMoveToBacklog");function Fk(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasClass)(n.instanceClass,an.AssetClass.TASK)||(0,ht.hasClass)(n.instanceClass,an.AssetClass.MEETING)?(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.BACKLOG):(0,ht.hasClass)(n.instanceClass,an.AssetClass.PROJECT)?(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.TODO):!1:!1}o(Fk,"canStartEffort");function Dk(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.DOING):!1}o(Dk,"canMarkDone");function Nk(n){return(0,ht.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=bT.WikiLinkHelpers.normalize(r);return i===an.EffortStatus.TRASHED||i===an.EffortStatus.DONE}):!0:!1}o(Nk,"canTrashEffort");function Lk(n){return!(!(0,ht.isEffort)(n.instanceClass)||(0,ht.isAssetArchived)(n.isArchived))}o(Lk,"canVoteOnEffort");function kk(n){if(!(0,ht.isEffort)(n.instanceClass)||(0,ht.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||bT.WikiLinkHelpers.normalize(e)===an.EffortStatus.TRASHED)}o(kk,"canRollbackStatus");function jk(n){return!(0,ht.isAssetArchived)(n.isArchived)}o(jk,"canArchiveTask");function Mk(n){return!(!(0,ht.hasClass)(n.instanceClass,an.AssetClass.TASK)&&!(0,ht.hasClass)(n.instanceClass,an.AssetClass.PROJECT)||(0,ht.isAssetArchived)(n.isArchived))}o(Mk,"canMarkReviewed")});var wT=b(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.canCreateEvent=Bk;fi.canCreateInstance=Uk;fi.canCleanProperties=qk;fi.canRepairFolder=Wk;fi.canCopyLabelToAliases=Gk;fi.canCreateNarrowerConcept=zk;fi.canCreateSubclass=Hk;fi.canCreateTaskForDailyNote=Qk;fi.canCopyFleetingNoteLabel=Kk;var Ur=yo(),Ms=jn(),$k="75302770-279e-4a59-ba85-09df29725713",Vk="fca0a931-a01f-48e4-b72a-4af206c94bc7";function Bk(n){return(0,Ur.isAreaOrProject)(n.instanceClass)}o(Bk,"canCreateEvent");function Uk(n){return(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.TASK_PROTOTYPE)||(0,Ur.hasClass)(n.instanceClass,$k)||(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.MEETING_PROTOTYPE)||(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.EVENT_PROTOTYPE)||(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.PROJECT_PROTOTYPE)||(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,Ur.isPrototypeClass)(n.instanceClass,n.metadata)}o(Uk,"canCreateInstance");function qk(n){return(0,Ur.hasEmptyProperties)(n.metadata)}o(qk,"canCleanProperties");function Wk(n){return(0,Ur.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(Wk,"canRepairFolder");function Gk(n){let e=n.metadata.exo__Asset_label;if(!e||typeof e!="string"||e.trim()==="")return!1;let t=e.trim(),r=n.metadata.aliases;return!r||!Array.isArray(r)||r.length===0?!0:!r.some(i=>typeof i!="string"?!1:i.trim()===t)}o(Gk,"canCopyLabelToAliases");function zk(n){return(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.CONCEPT)}o(zk,"canCreateNarrowerConcept");function Hk(n){return(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.CLASS)}o(Hk,"canCreateSubclass");function Qk(n){return!(!(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.DAILY_NOTE)||n.isArchived||!(0,Ur.extractDailyNoteDate)(n.metadata))}o(Qk,"canCreateTaskForDailyNote");function Kk(n){return(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.FLEETING_NOTE)||(0,Ur.hasClass)(n.instanceClass,Vk)}o(Kk,"canCopyFleetingNoteLabel")});var ET=b(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.canCopyFleetingNoteLabel=k.canCreateTaskForDailyNote=k.canCreateSubclass=k.canCreateNarrowerConcept=k.canCopyLabelToAliases=k.canRepairFolder=k.canCleanProperties=k.canCreateInstance=k.canCreateEvent=k.canMarkReviewed=k.canArchiveTask=k.canRollbackStatus=k.canVoteOnEffort=k.canTrashEffort=k.canMarkDone=k.canStartEffort=k.canMoveToBacklog=k.canSetDraftStatus=k.canShiftDayForward=k.canShiftDayBackward=k.canPlanForEvening=k.canPlanOnToday=k.canSetActiveFocus=k.canCreateChildArea=k.canConvertProjectToTask=k.canMoveToToDo=k.canMoveToAnalysis=k.canCreateProject=k.canSetCriticalityZone=k.canConvertTaskToProject=k.canCreateRelatedTask=k.canCreateTask=k.isPrototypeClass=k.inheritsFromPrototype=k.isCurrentDateGteDay=k.extractDailyNoteDate=k.hasPlannedStartTimestamp=k.isPlannedForToday=k.getTodayDateString=k.needsFolderRepair=k.hasEmptyProperties=k.isAssetArchived=k.hasStatus=k.isEffort=k.isAreaOrProject=k.hasClass=void 0;var An=yo();Object.defineProperty(k,"hasClass",{enumerable:!0,get:o(function(){return An.hasClass},"get")});Object.defineProperty(k,"isAreaOrProject",{enumerable:!0,get:o(function(){return An.isAreaOrProject},"get")});Object.defineProperty(k,"isEffort",{enumerable:!0,get:o(function(){return An.isEffort},"get")});Object.defineProperty(k,"hasStatus",{enumerable:!0,get:o(function(){return An.hasStatus},"get")});Object.defineProperty(k,"isAssetArchived",{enumerable:!0,get:o(function(){return An.isAssetArchived},"get")});Object.defineProperty(k,"hasEmptyProperties",{enumerable:!0,get:o(function(){return An.hasEmptyProperties},"get")});Object.defineProperty(k,"needsFolderRepair",{enumerable:!0,get:o(function(){return An.needsFolderRepair},"get")});Object.defineProperty(k,"getTodayDateString",{enumerable:!0,get:o(function(){return An.getTodayDateString},"get")});Object.defineProperty(k,"isPlannedForToday",{enumerable:!0,get:o(function(){return An.isPlannedForToday},"get")});Object.defineProperty(k,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return An.hasPlannedStartTimestamp},"get")});Object.defineProperty(k,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return An.extractDailyNoteDate},"get")});Object.defineProperty(k,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return An.isCurrentDateGteDay},"get")});Object.defineProperty(k,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return An.inheritsFromPrototype},"get")});Object.defineProperty(k,"isPrototypeClass",{enumerable:!0,get:o(function(){return An.isPrototypeClass},"get")});var Hd=pT();Object.defineProperty(k,"canCreateTask",{enumerable:!0,get:o(function(){return Hd.canCreateTask},"get")});Object.defineProperty(k,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return Hd.canCreateRelatedTask},"get")});Object.defineProperty(k,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return Hd.canConvertTaskToProject},"get")});Object.defineProperty(k,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return Hd.canSetCriticalityZone},"get")});var Qd=mT();Object.defineProperty(k,"canCreateProject",{enumerable:!0,get:o(function(){return Qd.canCreateProject},"get")});Object.defineProperty(k,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return Qd.canMoveToAnalysis},"get")});Object.defineProperty(k,"canMoveToToDo",{enumerable:!0,get:o(function(){return Qd.canMoveToToDo},"get")});Object.defineProperty(k,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return Qd.canConvertProjectToTask},"get")});var vT=_T();Object.defineProperty(k,"canCreateChildArea",{enumerable:!0,get:o(function(){return vT.canCreateChildArea},"get")});Object.defineProperty(k,"canSetActiveFocus",{enumerable:!0,get:o(function(){return vT.canSetActiveFocus},"get")});var Mn=ST();Object.defineProperty(k,"canPlanOnToday",{enumerable:!0,get:o(function(){return Mn.canPlanOnToday},"get")});Object.defineProperty(k,"canPlanForEvening",{enumerable:!0,get:o(function(){return Mn.canPlanForEvening},"get")});Object.defineProperty(k,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Mn.canShiftDayBackward},"get")});Object.defineProperty(k,"canShiftDayForward",{enumerable:!0,get:o(function(){return Mn.canShiftDayForward},"get")});Object.defineProperty(k,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Mn.canSetDraftStatus},"get")});Object.defineProperty(k,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Mn.canMoveToBacklog},"get")});Object.defineProperty(k,"canStartEffort",{enumerable:!0,get:o(function(){return Mn.canStartEffort},"get")});Object.defineProperty(k,"canMarkDone",{enumerable:!0,get:o(function(){return Mn.canMarkDone},"get")});Object.defineProperty(k,"canTrashEffort",{enumerable:!0,get:o(function(){return Mn.canTrashEffort},"get")});Object.defineProperty(k,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Mn.canVoteOnEffort},"get")});Object.defineProperty(k,"canRollbackStatus",{enumerable:!0,get:o(function(){return Mn.canRollbackStatus},"get")});Object.defineProperty(k,"canArchiveTask",{enumerable:!0,get:o(function(){return Mn.canArchiveTask},"get")});Object.defineProperty(k,"canMarkReviewed",{enumerable:!0,get:o(function(){return Mn.canMarkReviewed},"get")});var $s=wT();Object.defineProperty(k,"canCreateEvent",{enumerable:!0,get:o(function(){return $s.canCreateEvent},"get")});Object.defineProperty(k,"canCreateInstance",{enumerable:!0,get:o(function(){return $s.canCreateInstance},"get")});Object.defineProperty(k,"canCleanProperties",{enumerable:!0,get:o(function(){return $s.canCleanProperties},"get")});Object.defineProperty(k,"canRepairFolder",{enumerable:!0,get:o(function(){return $s.canRepairFolder},"get")});Object.defineProperty(k,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return $s.canCopyLabelToAliases},"get")});Object.defineProperty(k,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return $s.canCreateNarrowerConcept},"get")});Object.defineProperty(k,"canCreateSubclass",{enumerable:!0,get:o(function(){return $s.canCreateSubclass},"get")});Object.defineProperty(k,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return $s.canCreateTaskForDailyNote},"get")});Object.defineProperty(k,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return $s.canCopyFleetingNoteLabel},"get")})});var TT=b(_o=>{"use strict";var Yk=_o&&_o.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Xk=_o&&_o.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Yk(e,n,t)};Object.defineProperty(_o,"__esModule",{value:!0});Xk(ET(),_o)});var Kd=b(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.PropertyFieldType=void 0;Eu.rangeToFieldType=e4;var Fr;(function(n){n.Text="text",n.Number="number",n.Date="date",n.DateTime="datetime",n.Boolean="boolean",n.Reference="reference",n.Enum="enum",n.StatusSelect="status-select",n.SizeSelect="size-select",n.Wikilink="wikilink",n.Timestamp="timestamp",n.Unknown="unknown"})(Fr||(Eu.PropertyFieldType=Fr={}));var AT="http://www.w3.org/2001/XMLSchema#",Jk="https://exocortex.my/ontology/exo#",Zk="https://exocortex.my/ontology/ems#";function e4(n){if(!n)return Fr.Unknown;let e=n.trim();if(!e)return Fr.Unknown;if(e.startsWith(AT)){let t=e.substring(AT.length);return E0(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return E0(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return E0(r)}return e.startsWith(Zk)||e.startsWith("ems:")?t4(e):e.startsWith(Jk)||e.startsWith("exo:")||r4(e)?Fr.Reference:Fr.Text}o(e4,"rangeToFieldType");function E0(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Fr.Text;case"integer":case"int":case"long":case"short":case"byte":case"nonnegativeinteger":case"positiveinteger":case"nonpositiveinteger":case"negativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"decimal":case"float":case"double":return Fr.Number;case"date":return Fr.Date;case"datetime":case"datetimestamp":return Fr.DateTime;case"boolean":return Fr.Boolean;case"time":return Fr.Timestamp;default:return Fr.Text}}o(E0,"xsdTypeToFieldType");function t4(n){let e=n.toLowerCase();return e.includes("effortstatus")?Fr.StatusSelect:e.includes("tasksize")?Fr.SizeSelect:Fr.Reference}o(t4,"emsTypeToFieldType");function r4(n){let e=n.toLowerCase();return e.includes("exocortex.my/ontology")?!0:["asset","task","project","area","effort","class","property","concept"].some(r=>e.includes(r))}o(r4,"isClassReference")});var T0=b(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.propertyNameToUri=n4;Tu.uriToPropertyName=xT;Tu.extractPropertyLabel=i4;function n4(n){return n.replace(/^([a-z]+)__/,"$1:")}o(n4,"propertyNameToUri");function xT(n){if(n.startsWith("http://")||n.startsWith("https://")){let e=n.match(/\/([a-z]+)#([A-Za-z0-9_]+)$/);if(e)return`${e[1]}__${e[2]}`;let t=n.lastIndexOf("#"),r=n.lastIndexOf("/"),i=Math.max(t,r);return i>=0?n.substring(i+1):n}return n.replace(/^([a-z]+):/,"$1__")}o(xT,"uriToPropertyName");function i4(n){let r=(n.includes(":")?xT(n):n).replace(/^[a-z]+__/,"").split("_");return(r.length>1?r.slice(1).join(" "):r[0]).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,s=>s.toUpperCase())}o(i4,"extractPropertyLabel")});var Yd={};gy(Yd,{__assign:()=>x0,__asyncDelegator:()=>y4,__asyncGenerator:()=>g4,__asyncValues:()=>_4,__await:()=>Au,__awaiter:()=>u4,__classPrivateFieldGet:()=>v4,__classPrivateFieldSet:()=>E4,__createBinding:()=>d4,__decorate:()=>o4,__exportStar:()=>h4,__extends:()=>s4,__generator:()=>f4,__importDefault:()=>w4,__importStar:()=>S4,__makeTemplateObject:()=>b4,__metadata:()=>l4,__param:()=>c4,__read:()=>IT,__rest:()=>a4,__spread:()=>p4,__spreadArrays:()=>m4,__values:()=>I0});function s4(n,e){A0(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function a4(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function o4(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function c4(n,e){return function(t,r){e(t,r,n)}}function l4(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function u4(n,e,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return o(i,"adopt"),new(t||(t=Promise))(function(s,a){function c(f){try{u(r.next(f))}catch(d){a(d)}}o(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(d){a(d)}}o(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}o(u,"step"),u((r=r.apply(n,e||[])).next())})}function f4(n,e){var t={label:0,sent:o(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(f){return l([u,f])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(f){u=[6,f],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function d4(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function h4(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function I0(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:o(function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function IT(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s}function p4(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(IT(arguments[e]));return n}function m4(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),i=0,e=0;e<t;e++)for(var s=arguments[e],a=0,c=s.length;a<c;a++,i++)r[i]=s[a];return r}function Au(n){return this instanceof Au?(this.v=n,this):new Au(n)}function g4(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){r[h]&&(i[h]=function(p){return new Promise(function(y,S){s.push([h,p,y,S])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(y){d(s[0][3],y)}}function l(h){h.value instanceof Au?Promise.resolve(h.value.v).then(u,f):d(s[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function y4(n){var e,t;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=n[i]?function(a){return(t=!t)?{value:Au(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function _4(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof I0=="function"?I0(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(a){return new Promise(function(c,l){a=n[s](a),i(c,l,a.done,a.value)})}}function i(s,a,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},a)}}function b4(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function S4(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function w4(n){return n&&n.__esModule?n:{default:n}}function v4(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function E4(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var A0,x0,Xd=uN(()=>{A0=o(function(n,e){return A0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])},A0(n,e)},"extendStatics");o(s4,"__extends");x0=o(function(){return x0=Object.assign||o(function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),x0.apply(this,arguments)},"__assign");o(a4,"__rest");o(o4,"__decorate");o(c4,"__param");o(l4,"__metadata");o(u4,"__awaiter");o(f4,"__generator");o(d4,"__createBinding");o(h4,"__exportStar");o(I0,"__values");o(IT,"__read");o(p4,"__spread");o(m4,"__spreadArrays");o(Au,"__await");o(g4,"__asyncGenerator");o(y4,"__asyncDelegator");o(_4,"__asyncValues");o(b4,"__makeTemplateObject");o(S4,"__importStar");o(w4,"__importDefault");o(v4,"__classPrivateFieldGet");o(E4,"__classPrivateFieldSet")});var O0=b(R0=>{"use strict";Object.defineProperty(R0,"__esModule",{value:!0});var C0;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(C0||(C0={}));R0.default=C0});var CT=b(P0=>{"use strict";Object.defineProperty(P0,"__esModule",{value:!0});var T4=O0();Object.defineProperty(P0,"Lifecycle",{enumerable:!0,get:o(function(){return T4.default},"get")})});var bo=b(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.defineInjectionTokenMetadata=di.getParamInfo=di.INJECTION_TOKEN_METADATA_KEY=void 0;di.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function A4(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(di.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(A4,"getParamInfo");di.getParamInfo=A4;function x4(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(di.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(di.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(x4,"defineInjectionTokenMetadata");di.defineInjectionTokenMetadata=x4});var F0=b(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.isClassProvider=void 0;function I4(n){return!!n.useClass}o(I4,"isClassProvider");Jd.isClassProvider=I4});var D0=b(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.isFactoryProvider=void 0;function C4(n){return!!n.useFactory}o(C4,"isFactoryProvider");Zd.isFactoryProvider=C4});var th=b(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.delay=hc.DelayedConstructor=void 0;var eh=class{static{o(this,"DelayedConstructor")}constructor(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}createProxy(e){let t={},r=!1,i,s=o(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=o(i=>{t[i]=(...s)=>{s[0]=e();let a=Reflect[i];return a(...s)}},"install");return this.reflectMethods.forEach(r),t}};hc.DelayedConstructor=eh;function R4(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new eh(n)}o(R4,"delay");hc.delay=R4});var rh=b(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.isConstructorToken=es.isTransformDescriptor=es.isTokenDescriptor=es.isNormalToken=void 0;var O4=th();function P4(n){return typeof n=="string"||typeof n=="symbol"}o(P4,"isNormalToken");es.isNormalToken=P4;function F4(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(F4,"isTokenDescriptor");es.isTokenDescriptor=F4;function D4(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(D4,"isTransformDescriptor");es.isTransformDescriptor=D4;function N4(n){return typeof n=="function"||n instanceof O4.DelayedConstructor}o(N4,"isConstructorToken");es.isConstructorToken=N4});var N0=b(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.isTokenProvider=void 0;function L4(n){return!!n.useToken}o(L4,"isTokenProvider");nh.isTokenProvider=L4});var L0=b(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.isValueProvider=void 0;function k4(n){return n.useValue!=null}o(k4,"isValueProvider");ih.isValueProvider=k4});var k0=b(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});var j4=F0();Object.defineProperty(So,"isClassProvider",{enumerable:!0,get:o(function(){return j4.isClassProvider},"get")});var M4=D0();Object.defineProperty(So,"isFactoryProvider",{enumerable:!0,get:o(function(){return M4.isFactoryProvider},"get")});var $4=rh();Object.defineProperty(So,"isNormalToken",{enumerable:!0,get:o(function(){return $4.isNormalToken},"get")});var V4=N0();Object.defineProperty(So,"isTokenProvider",{enumerable:!0,get:o(function(){return V4.isTokenProvider},"get")});var B4=L0();Object.defineProperty(So,"isValueProvider",{enumerable:!0,get:o(function(){return B4.isValueProvider},"get")})});var RT=b(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.isProvider=void 0;var U4=F0(),q4=L0(),W4=N0(),G4=D0();function z4(n){return U4.isClassProvider(n)||q4.isValueProvider(n)||W4.isTokenProvider(n)||G4.isFactoryProvider(n)}o(z4,"isProvider");sh.isProvider=z4});var $0=b(M0=>{"use strict";Object.defineProperty(M0,"__esModule",{value:!0});var j0=class{static{o(this,"RegistryBase")}constructor(){this._registryMap=new Map}entries(){return this._registryMap.entries()}getAll(e){return this.ensure(e),this._registryMap.get(e)}get(e){this.ensure(e);let t=this._registryMap.get(e);return t[t.length-1]||null}set(e,t){this.ensure(e),this._registryMap.get(e).push(t)}setAll(e,t){this._registryMap.set(e,t)}has(e){return this.ensure(e),this._registryMap.get(e).length>0}clear(){this._registryMap.clear()}ensure(e){this._registryMap.has(e)||this._registryMap.set(e,[])}};M0.default=j0});var OT=b(B0=>{"use strict";Object.defineProperty(B0,"__esModule",{value:!0});var H4=$0(),V0=class extends H4.default{static{o(this,"Registry")}};B0.default=V0});var PT=b(q0=>{"use strict";Object.defineProperty(q0,"__esModule",{value:!0});var U0=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};q0.default=U0});var W0=b(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.formatErrorCtor=void 0;function Q4(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(Q4,"formatDependency");function K4(n,e,t=" "){return[n,...e.message.split(`
|
|
31
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function bE(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?i=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],i=s[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}o(bE,"incrementNodeInspectorPort");function Fy(){if(lt.env.NO_COLOR||lt.env.FORCE_COLOR==="0"||lt.env.FORCE_COLOR==="false")return!1;if(lt.env.FORCE_COLOR||lt.env.CLICOLOR_FORCE!==void 0)return!0}o(Fy,"useColor");Dy.Command=Py;Dy.useColor=Fy});var TE=b(Qn=>{var{Argument:wE}=Sd(),{Command:Ny}=SE(),{CommanderError:TN,InvalidArgumentError:vE}=cu(),{Help:AN}=Ty(),{Option:EE}=Cy();Qn.program=new Ny;Qn.createCommand=n=>new Ny(n);Qn.createOption=(n,e)=>new EE(n,e);Qn.createArgument=(n,e)=>new wE(n,e);Qn.Command=Ny;Qn.Option=EE;Qn.Argument=wE;Qn.Help=AN;Qn.CommanderError=TN;Qn.InvalidArgumentError=vE;Qn.InvalidOptionArgumentError=vE});var lu=b(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.AssetClass=void 0;var xE;(function(n){n.AREA="ems__Area",n.TASK="ems__Task",n.PROJECT="ems__Project",n.MEETING="ems__Meeting",n.INITIATIVE="ems__Initiative",n.TASK_PROTOTYPE="ems__TaskPrototype",n.MEETING_PROTOTYPE="ems__MeetingPrototype",n.EVENT_PROTOTYPE="exo__EventPrototype",n.PROJECT_PROTOTYPE="ems__ProjectPrototype",n.EVENT="exo__Event",n.DAILY_NOTE="pn__DailyNote",n.CONCEPT="ims__Concept",n.SESSION_START_EVENT="ems__SessionStartEvent",n.SESSION_END_EVENT="ems__SessionEndEvent",n.PROTOTYPE="exo__Prototype",n.CLASS="exo__Class",n.FLEETING_NOTE="ztlk__FleetingNote",n.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition",n.COMMAND="exocmd__Command",n.PRECONDITION="exocmd__Precondition",n.GROUNDING="exocmd__Grounding",n.COMMAND_BINDING="exocmd__CommandBinding"})(xE||(vd.AssetClass=xE={}))});var uu=b(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.EffortStatus=void 0;var IE;(function(n){n.DRAFT="ems__EffortStatusDraft",n.BACKLOG="ems__EffortStatusBacklog",n.ANALYSIS="ems__EffortStatusAnalysis",n.TODO="ems__EffortStatusToDo",n.DOING="ems__EffortStatusDoing",n.DONE="ems__EffortStatusDone",n.TRASHED="ems__EffortStatusTrashed"})(IE||(Ed.EffortStatus=IE={}))});var Ly=b(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.EFFORT_STATUS_OPTIONS=void 0;Td.EFFORT_STATUS_OPTIONS=[{value:"[[ems__EffortStatusDraft]]",label:"Draft"},{value:"[[ems__EffortStatusBacklog]]",label:"Backlog"},{value:"[[ems__EffortStatusAnalysis]]",label:"Analysis"},{value:"[[ems__EffortStatusToDo]]",label:"To Do"},{value:"[[ems__EffortStatusDoing]]",label:"Doing"},{value:"[[ems__EffortStatusDone]]",label:"Done"},{value:"[[ems__EffortStatusTrashed]]",label:"Trashed"}]});var uo=b(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.GroundingType=void 0;var CE;(function(n){n.SPARQL_UPDATE="sparql_update",n.PROPERTY_DELETE="property_delete",n.PROPERTY_SET="property_set",n.COMPOSITE="composite",n.SERVICE_CALL="service_call",n.CREATE_INSTANCE="create_instance",n.PROPERTY_APPEND="property_append",n.PROPERTY_INCREMENT="property_increment",n.PROPERTY_SHIFT="property_shift"})(CE||(Ad.GroundingType=CE={}))});var ky=b(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.CommandBindingStyleProperty=Kn.CommandBindingProperty=Kn.GroundingProperty=Kn.PreconditionProperty=Kn.CommandProperty=void 0;Kn.CommandProperty={ICON:"exocmd__Command_icon",PRECONDITION:"exocmd__Command_precondition",GROUNDING:"exocmd__Command_grounding",CONFIRM_MESSAGE:"exocmd__Command_confirmMessage",SUCCESS_MESSAGE:"exocmd__Command_successMessage",CATEGORY:"exocmd__Command_category"};Kn.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};Kn.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",TARGET_VALUE:"exocmd__Grounding_targetValue",STEPS:"exocmd__Grounding_steps",IS_DEFINED_BY:"exocmd__Grounding_isDefinedBy"};Kn.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};Kn.CommandBindingStyleProperty={VARIANT:"exocmd__CommandBindingStyle_variant",SHOW_ICON:"exocmd__CommandBindingStyle_showIcon",LABEL_CLASS:"exocmd__CommandBindingStyle_labelClass",ARIA_LABEL:"exocmd__CommandBindingStyle_ariaLabel",TOOLTIP:"exocmd__CommandBindingStyle_tooltip",KEYBOARD_SHORTCUT:"exocmd__CommandBindingStyle_keyboardShortcut",SOURCE:"exocmd__CommandBindingStyle_source"}});var jy=b(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.STYLE_SOURCE_VALUES=Tn.LABEL_CLASS_VALUES=Tn.COMMAND_VARIANT_VALUES=void 0;Tn.isCommandVariant=xN;Tn.isLabelClass=IN;Tn.isStyleSource=CN;Tn.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);Tn.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);Tn.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function xN(n){return typeof n=="string"&&Tn.COMMAND_VARIANT_VALUES.includes(n)}o(xN,"isCommandVariant");function IN(n){return typeof n=="string"&&Tn.LABEL_CLASS_VALUES.includes(n)}o(IN,"isLabelClass");function CN(n){return typeof n=="string"&&Tn.STYLE_SOURCE_VALUES.includes(n)}o(CN,"isStyleSource")});var RE=b(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.isCommandFrontmatter=RN;lc.isPreconditionFrontmatter=ON;lc.isGroundingFrontmatter=PN;lc.isCommandBindingFrontmatter=FN;function RN(n){return xd(n,"exocmd__Command")}o(RN,"isCommandFrontmatter");function ON(n){return xd(n,"exocmd__Precondition")}o(ON,"isPreconditionFrontmatter");function PN(n){return xd(n,"exocmd__Grounding")}o(PN,"isGroundingFrontmatter");function FN(n){return xd(n,"exocmd__CommandBinding")}o(FN,"isCommandBindingFrontmatter");function xd(n,e){let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}o(xd,"hasInstanceClass")});var OE=b(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.hasPosition=DN;Id.isFixed=NN;function DN(n){return typeof n.x=="number"&&typeof n.y=="number"}o(DN,"hasPosition");function NN(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(NN,"isFixed")});var PE=b(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.createEmptyGraphData=LN;Cd.mergeGraphData=kN;function LN(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(LN,"createEmptyGraphData");function kN(n,e){let t=new Map,r=new Set,i=[];for(let s of n.nodes)t.set(s.id,s);for(let s of e.nodes)t.set(s.id,s);for(let s of n.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}for(let s of e.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}o(kN,"mergeGraphData")});var My=b(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.createEdgeId=jN;Rd.edgesEqual=MN;function jN(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(jN,"createEdgeId");function MN(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(MN,"edgesEqual")});var $y=b(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.BUILT_IN_EDGE_STYLES=Mt.BUILT_IN_NODE_STYLES=Mt.DEFAULT_EDGE_STYLE=Mt.DEFAULT_NODE_STYLE=Mt.RDF_TYPE_PREDICATES=void 0;Mt.mergeNodeStyles=$N;Mt.mergeEdgeStyles=VN;Mt.extractLocalName=BN;Mt.isClassType=UN;Mt.isTypePredicate=qN;Mt.isSubClassPredicate=WN;Mt.RDF_TYPE_PREDICATES={RDF_TYPE:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",RDFS_CLASS:"http://www.w3.org/2000/01/rdf-schema#Class",OWL_CLASS:"http://www.w3.org/2002/07/owl#Class",RDFS_SUBCLASS_OF:"http://www.w3.org/2000/01/rdf-schema#subClassOf",OWL_EQUIVALENT_CLASS:"http://www.w3.org/2002/07/owl#equivalentClass",RDFS_LABEL:"http://www.w3.org/2000/01/rdf-schema#label",RDFS_COMMENT:"http://www.w3.org/2000/01/rdf-schema#comment"};Mt.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Mt.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Mt.BUILT_IN_NODE_STYLES={"http://www.w3.org/2000/01/rdf-schema#Class":{color:"#f59e0b",shape:"diamond",size:40},"http://www.w3.org/2002/07/owl#Class":{color:"#f59e0b",shape:"diamond",size:40},ems__Task:{color:"#22c55e",shape:"circle"},ems__Project:{color:"#3b82f6",shape:"square"},ems__Area:{color:"#8b5cf6",shape:"hexagon",size:40},ems__Meeting:{color:"#ec4899",shape:"circle"},exo__Class:{color:"#f59e0b",shape:"diamond"},ims__Person:{color:"#06b6d4",shape:"circle"}};Mt.BUILT_IN_EDGE_STYLES={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":{color:"#f59e0b",lineStyle:"dashed",arrow:"standard"},"http://www.w3.org/2000/01/rdf-schema#subClassOf":{color:"#8b5cf6",width:2,arrow:"triangle"},"https://exocortex.my/ontology/ems#Effort_parent":{color:"#6366f1",width:2,arrow:"standard"},"https://exocortex.my/ontology/exo#Asset_prototype":{color:"#f59e0b",lineStyle:"dashed",arrow:"circle"},"https://exocortex.my/ontology/exo#references":{color:"#22c55e",opacity:.4,arrow:"standard"}};function $N(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o($N,"mergeNodeStyles");function VN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(VN,"mergeEdgeStyles");function BN(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(BN,"extractLocalName");function UN(n){return n===Mt.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Mt.RDF_TYPE_PREDICATES.OWL_CLASS}o(UN,"isClassType");function qN(n){return n===Mt.RDF_TYPE_PREDICATES.RDF_TYPE}o(qN,"isTypePredicate");function WN(n){return n===Mt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(WN,"isSubClassPredicate")});var DE=b(FE=>{"use strict";Object.defineProperty(FE,"__esModule",{value:!0})});var Ee=b(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.IRI=void 0;var Vy=class n{static{o(this,"IRI")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("IRI cannot be empty");if(!n.isValidIRI(t))throw new Error("Invalid IRI format");this._value=t}get value(){return this._value}equals(e){return this._value===e._value}toString(){return this._value}static isValidIRI(e){if(!e||e.trim().length===0||/\s/.test(e)||!/^[a-z][a-z0-9+.-]*:/i.test(e))return!1;let r=["http","https","ftp","ftps","file","mailto","tel","data","ws","wss","urn","obsidian"],i=e.match(/^([a-z][a-z0-9+.-]*?):/i);if(i){let s=i[1].toLowerCase();if(!r.includes(s))return!1}try{return new URL(e),!0}catch{return/^urn:[a-z0-9][a-z0-9-]{0,31}:[^\s]+$/i.test(e)}}};Od.IRI=Vy});var Me=b(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.Literal=void 0;fo.parseLanguageTag=NE;fo.createDirectionalLiteral=zN;fo.createLiteralFromLanguageTag=HN;var GN="http://www.w3.org/2001/XMLSchema#string",fu=class{static{o(this,"Literal")}constructor(e,t,r,i){if(e.length===0)throw new Error("Literal value cannot be empty");if(t&&r)throw new Error("Literal cannot have both datatype and language tag");if(i&&!r)throw new Error("Literal cannot have direction without language tag");if(i&&i!=="ltr"&&i!=="rtl")throw new Error('Direction must be "ltr" or "rtl"');this._value=e,this._datatype=t,this._language=r?r.toLowerCase():void 0,this._direction=i}get value(){return this._value}get datatype(){return this._datatype}get language(){return this._language}get direction(){return this._direction}hasDirection(){return this._direction!==void 0}equals(e){if(this._value!==e._value||this._language!==e._language||this._direction!==e._direction)return!1;let t=this.normalizedDatatype(),r=e.normalizedDatatype();return t===r}normalizedDatatype(){return!this._datatype||this._datatype.value===GN?null:this._datatype.value}toString(){let e=`"${this._value}"`;return this._datatype?e+=`^^<${this._datatype.value}>`:this._language&&(e+=`@${this._language}`,this._direction&&(e+=`--${this._direction}`)),e}};fo.Literal=fu;function NE(n){let t=n.lastIndexOf("--");if(t===-1)return{language:n.toLowerCase()};let r=n.substring(t+2),i=n.substring(0,t);return r==="ltr"||r==="rtl"?{language:i.toLowerCase(),direction:r}:{language:n.toLowerCase()}}o(NE,"parseLanguageTag");function zN(n,e,t){return new fu(n,void 0,e,t)}o(zN,"createDirectionalLiteral");function HN(n,e){let{language:t,direction:r}=NE(e);return new fu(n,void 0,t,r)}o(HN,"createLiteralFromLanguageTag")});var $t=b(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});Fd.BlankNode=void 0;var Pd=class n{static{o(this,"BlankNode")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("BlankNode id cannot be empty");this._id=t}get id(){return this._id}equals(e){return this._id===e._id}toString(){return`_:${this._id}`}static generateId(){return`b${++n.counter}`}static create(){return new n(n.generateId())}};Fd.BlankNode=Pd;Pd.counter=0});var ir=b(Dd=>{"use strict";Object.defineProperty(Dd,"__esModule",{value:!0});Dd.Namespace=void 0;var LE=Ee(),Be=class n{static{o(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new LE.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new LE.IRI(`${this._iri.value}${e}`)}expand(e){let t=e.split(":");if(t.length!==2)return null;let[r,i]=t;return r!==this._prefix?null:this.term(i)}static forPrefix(e){if(!/^[a-z][a-zA-Z0-9]*$/.test(e))return null;let t=n.KNOWN_NAMESPACES.find(r=>r.prefix===e);return t||new n(e,`${n.EXOCORTEX_ONTOLOGY_BASE}${e}#`)}static fromPropertyKey(e){let t=/^([a-z][a-zA-Z0-9]*)__(.+)$/.exec(e);if(!t)return null;let r=n.forPrefix(t[1]);return r?{namespace:r,localName:t[2]}:null}};Dd.Namespace=Be;Be.RDF=new Be("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");Be.RDFS=new Be("rdfs","http://www.w3.org/2000/01/rdf-schema#");Be.OWL=new Be("owl","http://www.w3.org/2002/07/owl#");Be.XSD=new Be("xsd","http://www.w3.org/2001/XMLSchema#");Be.EXO=new Be("exo","https://exocortex.my/ontology/exo#");Be.EMS=new Be("ems","https://exocortex.my/ontology/ems#");Be.EXOCMD=new Be("exocmd","https://exocortex.my/ontology/exocmd#");Be.IMS=new Be("ims","https://exocortex.my/ontology/ims#");Be.ZTLK=new Be("ztlk","https://exocortex.my/ontology/ztlk#");Be.PTMS=new Be("ptms","https://exocortex.my/ontology/ptms#");Be.LIT=new Be("lit","https://exocortex.my/ontology/lit#");Be.INBOX=new Be("inbox","https://exocortex.my/ontology/inbox#");Be.PMBOK=new Be("pmbok","https://exocortex.my/ontology/pmbok#");Be.EXOCORTEX_ONTOLOGY_BASE="https://exocortex.my/ontology/";Be.KNOWN_NAMESPACES=[Be.EXO,Be.EMS,Be.EXOCMD,Be.IMS,Be.ZTLK,Be.PTMS,Be.LIT,Be.INBOX,Be.PMBOK]});var Yn=b(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.Triple=void 0;var By=Ee(),Uy=Me(),qy=$t(),Wy=class{static{o(this,"Triple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof By.IRI&&t instanceof By.IRI||e instanceof qy.BlankNode&&t instanceof qy.BlankNode||e instanceof Uy.Literal&&t instanceof Uy.Literal||this.isQuotedTriple(e)&&this.isQuotedTriple(t)?e.equals(t):!1}isQuotedTriple(e){return typeof e=="object"&&e!==null&&"termType"in e&&e.termType==="QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`${e} ${t} ${r} .`}nodeToString(e){return e instanceof By.IRI?`<${e.value}>`:e instanceof qy.BlankNode||e instanceof Uy.Literal||this.isQuotedTriple(e)?e.toString():""}};Nd.Triple=Wy});var du=b(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.QuotedTriple=void 0;var Gy=Ee(),zy=Me(),Hy=$t(),Qy=class n{static{o(this,"QuotedTriple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof Gy.IRI&&t instanceof Gy.IRI||e instanceof Hy.BlankNode&&t instanceof Hy.BlankNode||e instanceof zy.Literal&&t instanceof zy.Literal||e instanceof n&&t instanceof n?e.equals(t):!1}get termType(){return"QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`<< ${e} ${t} ${r} >>`}nodeToString(e){return e instanceof Gy.IRI?`<${e.value}>`:e instanceof Hy.BlankNode||e instanceof zy.Literal||e instanceof n?e.toString():""}};Ld.QuotedTriple=Qy});var kE=b(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.QuotedTriple=Yt.Triple=Yt.Namespace=Yt.BlankNode=Yt.createLiteralFromLanguageTag=Yt.createDirectionalLiteral=Yt.parseLanguageTag=Yt.Literal=Yt.IRI=void 0;var QN=Ee();Object.defineProperty(Yt,"IRI",{enumerable:!0,get:o(function(){return QN.IRI},"get")});var kd=Me();Object.defineProperty(Yt,"Literal",{enumerable:!0,get:o(function(){return kd.Literal},"get")});Object.defineProperty(Yt,"parseLanguageTag",{enumerable:!0,get:o(function(){return kd.parseLanguageTag},"get")});Object.defineProperty(Yt,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return kd.createDirectionalLiteral},"get")});Object.defineProperty(Yt,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return kd.createLiteralFromLanguageTag},"get")});var KN=$t();Object.defineProperty(Yt,"BlankNode",{enumerable:!0,get:o(function(){return KN.BlankNode},"get")});var YN=ir();Object.defineProperty(Yt,"Namespace",{enumerable:!0,get:o(function(){return YN.Namespace},"get")});var XN=Yn();Object.defineProperty(Yt,"Triple",{enumerable:!0,get:o(function(){return XN.Triple},"get")});var JN=du();Object.defineProperty(Yt,"QuotedTriple",{enumerable:!0,get:o(function(){return JN.QuotedTriple},"get")})});var jd=b(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.UUID_URL_NAMESPACE=Jn.DEFAULT_LANGUAGE_TAG=Jn.REQUIRED_PROPERTIES=Jn.ALLOWED_PROPERTIES=Jn.Exo003MetadataType=void 0;var Xn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(Xn||(Jn.Exo003MetadataType=Xn={}));Jn.ALLOWED_PROPERTIES={[Xn.Namespace]:["metadata","uri","aliases"],[Xn.Anchor]:["metadata","uri","aliases"],[Xn.BlankNode]:["metadata","uri","aliases"],[Xn.Statement]:["metadata","subject","predicate","object","aliases"],[Xn.Body]:["metadata","subject","predicate","aliases"]};Jn.REQUIRED_PROPERTIES={[Xn.Namespace]:["metadata","uri"],[Xn.Anchor]:["metadata","uri"],[Xn.BlankNode]:["metadata","uri"],[Xn.Statement]:["metadata","subject","predicate","object"],[Xn.Body]:["metadata","subject","predicate"]};Jn.DEFAULT_LANGUAGE_TAG="ru";Jn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var jE=b(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var ME=b(Yy=>{"use strict";Object.defineProperty(Yy,"__esModule",{value:!0});Yy.default="00000000-0000-0000-0000-000000000000"});var $E=b(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});Xy.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var hu=b(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});var ZN=$E();function eL(n){return typeof n=="string"&&ZN.default.test(n)}o(eL,"validate");Jy.default=eL});var pu=b(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var tL=hu();function rL(n){if(!(0,tL.default)(n))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(n.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(n.slice(9,13),16))>>>8,e&255,(e=parseInt(n.slice(14,18),16))>>>8,e&255,(e=parseInt(n.slice(19,23),16))>>>8,e&255,(e=parseInt(n.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}o(rL,"parse");Zy.default=rL});var ks=b(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.unsafeStringify=void 0;var nL=hu(),Pr=[];for(let n=0;n<256;++n)Pr.push((n+256).toString(16).slice(1));function VE(n,e=0){return(Pr[n[e+0]]+Pr[n[e+1]]+Pr[n[e+2]]+Pr[n[e+3]]+"-"+Pr[n[e+4]]+Pr[n[e+5]]+"-"+Pr[n[e+6]]+Pr[n[e+7]]+"-"+Pr[n[e+8]]+Pr[n[e+9]]+"-"+Pr[n[e+10]]+Pr[n[e+11]]+Pr[n[e+12]]+Pr[n[e+13]]+Pr[n[e+14]]+Pr[n[e+15]]).toLowerCase()}o(VE,"unsafeStringify");mu.unsafeStringify=VE;function iL(n,e=0){let t=VE(n,e);if(!(0,nL.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(iL,"stringify");mu.default=iL});var Vd=b(e0=>{"use strict";Object.defineProperty(e0,"__esModule",{value:!0});var sL=require("crypto"),$d=new Uint8Array(256),Md=$d.length;function aL(){return Md>$d.length-16&&((0,sL.randomFillSync)($d),Md=0),$d.slice(Md,Md+=16)}o(aL,"rng");e0.default=aL});var t0=b(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.updateV1State=void 0;var BE=Vd(),oL=ks(),gu={};function cL(n,e,t){let r,i=n?._v6??!1;if(n){let s=Object.keys(n);s.length===1&&s[0]==="_v6"&&(n=void 0)}if(n)r=UE(n.random??n.rng?.()??(0,BE.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,BE.default)();qE(gu,s,a),r=UE(a,gu.msecs,gu.nsecs,i?void 0:gu.clockseq,i?void 0:gu.node,e,t)}return e??(0,oL.unsafeStringify)(r)}o(cL,"v1");function qE(n,e,t){return n.msecs??=-1/0,n.nsecs??=0,e===n.msecs?(n.nsecs++,n.nsecs>=1e4&&(n.node=void 0,n.nsecs=0)):e>n.msecs?n.nsecs=0:e<n.msecs&&(n.node=void 0),n.node||(n.node=t.slice(10,16),n.node[0]|=1,n.clockseq=(t[8]<<8|t[9])&16383),n.msecs=e,n}o(qE,"updateV1State");yu.updateV1State=qE;function UE(n,e,t,r,i,s,a=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),a=0;else if(a<0||a+16>s.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);e??=Date.now(),t??=0,r??=(n[8]<<8|n[9])&16383,i??=n.slice(10,16),e+=122192928e5;let c=((e&268435455)*1e4+t)%4294967296;s[a++]=c>>>24&255,s[a++]=c>>>16&255,s[a++]=c>>>8&255,s[a++]=c&255;let l=e/4294967296*1e4&268435455;s[a++]=l>>>8&255,s[a++]=l&255,s[a++]=l>>>24&15|16,s[a++]=l>>>16&255,s[a++]=r>>>8|128,s[a++]=r&255;for(let u=0;u<6;++u)s[a++]=i[u];return s}o(UE,"v1Bytes");yu.default=cL});var n0=b(r0=>{"use strict";Object.defineProperty(r0,"__esModule",{value:!0});var lL=pu(),uL=ks();function fL(n){let e=typeof n=="string"?(0,lL.default)(n):n,t=dL(e);return typeof n=="string"?(0,uL.unsafeStringify)(t):t}o(fL,"v1ToV6");r0.default=fL;function dL(n){return Uint8Array.of((n[6]&15)<<4|n[7]>>4&15,(n[7]&15)<<4|(n[4]&240)>>4,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,(n[1]&15)<<4|(n[2]&240)>>4,96|n[2]&15,n[3],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(dL,"_v1ToV6")});var WE=b(i0=>{"use strict";Object.defineProperty(i0,"__esModule",{value:!0});var hL=require("crypto");function pL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,hL.createHash)("md5").update(n).digest()}o(pL,"md5");i0.default=pL});var _u=b(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.URL=js.DNS=js.stringToBytes=void 0;var GE=pu(),mL=ks();function zE(n){n=unescape(encodeURIComponent(n));let e=new Uint8Array(n.length);for(let t=0;t<n.length;++t)e[t]=n.charCodeAt(t);return e}o(zE,"stringToBytes");js.stringToBytes=zE;js.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";js.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function gL(n,e,t,r,i,s){let a=typeof t=="string"?zE(t):t,c=typeof r=="string"?(0,GE.default)(r):r;if(typeof r=="string"&&(r=(0,GE.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+a.length);if(l.set(c),l.set(a,c.length),l=e(l),l[6]=l[6]&15|n,l[8]=l[8]&63|128,i){s=s||0;for(let u=0;u<16;++u)i[s+u]=l[u];return i}return(0,mL.unsafeStringify)(l)}o(gL,"v35");js.default=gL});var QE=b(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.URL=ho.DNS=void 0;var yL=WE(),s0=_u(),HE=_u();Object.defineProperty(ho,"DNS",{enumerable:!0,get:o(function(){return HE.DNS},"get")});Object.defineProperty(ho,"URL",{enumerable:!0,get:o(function(){return HE.URL},"get")});function a0(n,e,t,r){return(0,s0.default)(48,yL.default,n,e,t,r)}o(a0,"v3");a0.DNS=s0.DNS;a0.URL=s0.URL;ho.default=a0});var KE=b(o0=>{"use strict";Object.defineProperty(o0,"__esModule",{value:!0});var _L=require("crypto");o0.default={randomUUID:_L.randomUUID}});var XE=b(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0});var YE=KE(),bL=Vd(),SL=ks();function wL(n,e,t){if(YE.default.randomUUID&&!e&&!n)return YE.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,bL.default)();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return(0,SL.unsafeStringify)(r)}o(wL,"v4");c0.default=wL});var JE=b(l0=>{"use strict";Object.defineProperty(l0,"__esModule",{value:!0});var vL=require("crypto");function EL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,vL.createHash)("sha1").update(n).digest()}o(EL,"sha1");l0.default=EL});var eT=b(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.URL=po.DNS=void 0;var TL=JE(),u0=_u(),ZE=_u();Object.defineProperty(po,"DNS",{enumerable:!0,get:o(function(){return ZE.DNS},"get")});Object.defineProperty(po,"URL",{enumerable:!0,get:o(function(){return ZE.URL},"get")});function f0(n,e,t,r){return(0,u0.default)(80,TL.default,n,e,t,r)}o(f0,"v5");f0.DNS=u0.DNS;f0.URL=u0.URL;po.default=f0});var tT=b(d0=>{"use strict";Object.defineProperty(d0,"__esModule",{value:!0});var AL=ks(),xL=t0(),IL=n0();function CL(n,e,t){n??={},t??=0;let r=(0,xL.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,IL.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,AL.unsafeStringify)(r)}o(CL,"v6");d0.default=CL});var rT=b(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var RL=pu(),OL=ks();function PL(n){let e=typeof n=="string"?(0,RL.default)(n):n,t=FL(e);return typeof n=="string"?(0,OL.unsafeStringify)(t):t}o(PL,"v6ToV1");h0.default=PL;function FL(n){return Uint8Array.of((n[3]&15)<<4|n[4]>>4&15,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|n[6]&15,n[7],(n[1]&15)<<4|(n[2]&240)>>4,(n[2]&15)<<4|(n[3]&240)>>4,16|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(FL,"_v6ToV1")});var aT=b(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.updateV7State=void 0;var nT=Vd(),DL=ks(),p0={};function NL(n,e,t){let r;if(n)r=iT(n.random??n.rng?.()??(0,nT.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,nT.default)();sT(p0,i,s),r=iT(s,p0.msecs,p0.seq,e,t)}return e??(0,DL.unsafeStringify)(r)}o(NL,"v7");function sT(n,e,t){return n.msecs??=-1/0,n.seq??=0,e>n.msecs?(n.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],n.msecs=e):(n.seq=n.seq+1|0,n.seq===0&&n.msecs++),n}o(sT,"updateV7State");bu.updateV7State=sT;function iT(n,e,t,r,i=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return e??=Date.now(),t??=n[6]*127<<24|n[7]<<16|n[8]<<8|n[9],r[i++]=e/1099511627776&255,r[i++]=e/4294967296&255,r[i++]=e/16777216&255,r[i++]=e/65536&255,r[i++]=e/256&255,r[i++]=e&255,r[i++]=112|t>>>28&15,r[i++]=t>>>20&255,r[i++]=128|t>>>14&63,r[i++]=t>>>6&255,r[i++]=t<<2&255|n[10]&3,r[i++]=n[11],r[i++]=n[12],r[i++]=n[13],r[i++]=n[14],r[i++]=n[15],r}o(iT,"v7Bytes");bu.default=NL});var oT=b(m0=>{"use strict";Object.defineProperty(m0,"__esModule",{value:!0});var LL=hu();function kL(n){if(!(0,LL.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(kL,"version");m0.default=kL});var ui=b(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.version=ft.validate=ft.v7=ft.v6ToV1=ft.v6=ft.v5=ft.v4=ft.v3=ft.v1ToV6=ft.v1=ft.stringify=ft.parse=ft.NIL=ft.MAX=void 0;var jL=jE();Object.defineProperty(ft,"MAX",{enumerable:!0,get:o(function(){return jL.default},"get")});var ML=ME();Object.defineProperty(ft,"NIL",{enumerable:!0,get:o(function(){return ML.default},"get")});var $L=pu();Object.defineProperty(ft,"parse",{enumerable:!0,get:o(function(){return $L.default},"get")});var VL=ks();Object.defineProperty(ft,"stringify",{enumerable:!0,get:o(function(){return VL.default},"get")});var BL=t0();Object.defineProperty(ft,"v1",{enumerable:!0,get:o(function(){return BL.default},"get")});var UL=n0();Object.defineProperty(ft,"v1ToV6",{enumerable:!0,get:o(function(){return UL.default},"get")});var qL=QE();Object.defineProperty(ft,"v3",{enumerable:!0,get:o(function(){return qL.default},"get")});var WL=XE();Object.defineProperty(ft,"v4",{enumerable:!0,get:o(function(){return WL.default},"get")});var GL=eT();Object.defineProperty(ft,"v5",{enumerable:!0,get:o(function(){return GL.default},"get")});var zL=tT();Object.defineProperty(ft,"v6",{enumerable:!0,get:o(function(){return zL.default},"get")});var HL=rT();Object.defineProperty(ft,"v6ToV1",{enumerable:!0,get:o(function(){return HL.default},"get")});var QL=aT();Object.defineProperty(ft,"v7",{enumerable:!0,get:o(function(){return QL.default},"get")});var KL=hu();Object.defineProperty(ft,"validate",{enumerable:!0,get:o(function(){return KL.default},"get")});var YL=oT();Object.defineProperty(ft,"version",{enumerable:!0,get:o(function(){return YL.default},"get")})});var _0=b(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.Exo003UUIDGenerator=void 0;var g0=ui(),cT=jd(),y0=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,g0.v5)(e,cT.UUID_URL_NAMESPACE)}static generateAssetUUID(e,t){if(!t||t.trim().length===0)throw new Error("Local identifier cannot be empty");let r=this.generateNamespaceUUID(e);return(0,g0.v5)(t,r)}static generateFromIRI(e){if(!e||e.trim().length===0)throw new Error("IRI cannot be empty");let{namespace:t,localName:r}=this.splitIRI(e);return r?this.generateAssetUUID(t,r):(0,g0.v5)(e,cT.UUID_URL_NAMESPACE)}static generateBlankNodeUUID(e,t){if(!e||e.trim().length===0)throw new Error("Blank node ID cannot be empty");let r="urn:exocortex:blank-node:",i=t?`${t}#${e}`:e;return this.generateAssetUUID(r,i)}static generateStatementUUID(e,t,r){if(!e||!t||!r)throw new Error("Subject, predicate, and object cannot be empty");let i="urn:exocortex:statement:",s=`${e} ${t} ${r}`;return this.generateAssetUUID(i,s)}static generateBodyUUID(e,t){let r="urn:exocortex:body:",i=e;return t?.datatype?i+=`^^${t.datatype}`:t?.language&&(i+=`@${t.language}`,t.direction&&(i+=`--${t.direction}`)),this.generateAssetUUID(r,i)}static splitIRI(e){let t=e.lastIndexOf("#");if(t!==-1&&t<e.length-1)return{namespace:e.substring(0,t+1),localName:e.substring(t+1)};let r=e.lastIndexOf("/"),i=e.indexOf("://");return r!==-1&&r>i+2&&r<e.length-1?{namespace:e.substring(0,r+1),localName:e.substring(r+1)}:{namespace:e,localName:""}}static isValidUUID(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)}};Bd.Exo003UUIDGenerator=y0});var uT=b(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.Exo003Parser=void 0;var mt=jd(),Su=_0(),_a=Ee(),Ud=Me(),lT=$t(),XL=Yn(),b0=class{static{o(this,"Exo003Parser")}static parse(e,t){let r=this.validate(e);if(!r.valid)return{success:!1,errors:r.errors};let i=e.metadata;try{return{success:!0,metadata:this.parseByType(e,i),bodyContent:i===mt.Exo003MetadataType.Body?t:void 0}}catch(s){return{success:!1,errors:[s instanceof Error?s.message:String(s)]}}}static validate(e){let t=[],r=[];if(!e.metadata)return t.push("Missing required property: metadata"),{valid:!1,errors:t,warnings:r};let i=e.metadata;if(!Object.values(mt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(mt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=mt.ALLOWED_PROPERTIES[s],c=mt.REQUIRED_PROPERTIES[s];for(let l of c)(e[l]===void 0||e[l]===null)&&t.push(`Missing required property: ${l}`);for(let l of Object.keys(e))a.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case mt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case mt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case mt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case mt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case mt.Exo003MetadataType.Body:this.validateBodyMetadata(e,t,r);break}return{valid:t.length===0,errors:t,warnings:r}}static parseByType(e,t){let r={metadata:t,aliases:e.aliases};switch(t){case mt.Exo003MetadataType.Namespace:return{...r,metadata:mt.Exo003MetadataType.Namespace,uri:e.uri};case mt.Exo003MetadataType.Anchor:return{...r,metadata:mt.Exo003MetadataType.Anchor,uri:e.uri};case mt.Exo003MetadataType.BlankNode:return{...r,metadata:mt.Exo003MetadataType.BlankNode,uri:e.uri};case mt.Exo003MetadataType.Statement:return{...r,metadata:mt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case mt.Exo003MetadataType.Body:return{...r,metadata:mt.Exo003MetadataType.Body,subject:e.subject,predicate:e.predicate}}}static validateNamespaceMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new _a.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateAnchorMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new _a.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateBlankNodeMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r){let i=r;if(!i.startsWith("_:"))try{new _a.IRI(i)}catch{t.push(`uri is not a valid IRI or blank node identifier: ${String(r)}`)}}}static validateStatementMetadata(e,t){let r=e.subject,i=e.predicate,s=e.object,a=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of a)l&&typeof l!="string"&&t.push(`${c} must be a string`)}static validateBodyMetadata(e,t,r){let i=e.subject,s=e.predicate;i&&typeof i!="string"&&t.push("subject must be a string"),s&&typeof s!="string"&&t.push("predicate must be a string")}static toTriple(e,t,r){let i=t(e.subject),s;if(i.type==="iri")s=new _a.IRI(i.value);else if(i.type==="blank")s=new lT.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let a=t(e.predicate);if(a.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new _a.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new _a.IRI(l.value);else if(l.type==="blank")u=new lT.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new Ud.Literal(f,new _a.IRI(l.datatype));else{let d=l.language||mt.DEFAULT_LANGUAGE_TAG;u=(0,Ud.createDirectionalLiteral)(f,d,l.direction)}}return new XL.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new Ud.Literal(t,new _a.IRI(r.datatype));let i=r?.language||mt.DEFAULT_LANGUAGE_TAG;return(0,Ud.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(mt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case mt.Exo003MetadataType.Namespace:return Su.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Anchor:return Su.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.BlankNode:return Su.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Statement:{let r=e;return Su.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case mt.Exo003MetadataType.Body:{let r=e;return Su.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};qd.Exo003Parser=b0});var S0=b(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.Exo003Parser=Vr.Exo003UUIDGenerator=Vr.UUID_URL_NAMESPACE=Vr.DEFAULT_LANGUAGE_TAG=Vr.REQUIRED_PROPERTIES=Vr.ALLOWED_PROPERTIES=Vr.Exo003MetadataType=void 0;var wu=jd();Object.defineProperty(Vr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return wu.Exo003MetadataType},"get")});Object.defineProperty(Vr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return wu.ALLOWED_PROPERTIES},"get")});Object.defineProperty(Vr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return wu.REQUIRED_PROPERTIES},"get")});Object.defineProperty(Vr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return wu.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(Vr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return wu.UUID_URL_NAMESPACE},"get")});var JL=_0();Object.defineProperty(Vr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return JL.Exo003UUIDGenerator},"get")});var ZL=uT();Object.defineProperty(Vr,"Exo003Parser",{enumerable:!0,get:o(function(){return ZL.Exo003Parser},"get")})});var Zi=b(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.WikiLinkHelpers=void 0;var vu=class{static{o(this,"WikiLinkHelpers")}static normalize(e){if(!e)return"";let t=e.replace(this.WIKI_LINK_PATTERN,"").trim();if(!t)return"";let r=t.indexOf("|");if(r===-1)return t;let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();return this.UUID_PATTERN.test(i)&&s||i}static normalizeArray(e){return e?(Array.isArray(e)?e:[e]).map(r=>this.normalize(r)).filter(r=>r.length>0):[]}static equals(e,t){return this.normalize(e)===this.normalize(t)}static includes(e,t){let r=this.normalizeArray(e),i=this.normalize(t);return r.includes(i)}static resolveSymbolic(e,t){let r=this.normalize(e);if(!r)return"";if(this.UUID_PATTERN.test(r)){let i=t(r);return i&&i.length>0?i:r}return r}static resolveSymbolicArray(e,t){return e?(Array.isArray(e)?e:[e]).map(i=>this.resolveSymbolic(i,t)).filter(i=>i.length>0):[]}};Wd.WikiLinkHelpers=vu;vu.WIKI_LINK_PATTERN=/\[\[|\]\]/g;vu.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var jn=b(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.CommandBindingProperty=gr.GroundingProperty=gr.PreconditionProperty=gr.CommandProperty=gr.GroundingType=gr.EFFORT_STATUS_OPTIONS=gr.EffortStatus=gr.AssetClass=void 0;var ek=lu();Object.defineProperty(gr,"AssetClass",{enumerable:!0,get:o(function(){return ek.AssetClass},"get")});var tk=uu();Object.defineProperty(gr,"EffortStatus",{enumerable:!0,get:o(function(){return tk.EffortStatus},"get")});var rk=Ly();Object.defineProperty(gr,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return rk.EFFORT_STATUS_OPTIONS},"get")});var nk=uo();Object.defineProperty(gr,"GroundingType",{enumerable:!0,get:o(function(){return nk.GroundingType},"get")});var Gd=ky();Object.defineProperty(gr,"CommandProperty",{enumerable:!0,get:o(function(){return Gd.CommandProperty},"get")});Object.defineProperty(gr,"PreconditionProperty",{enumerable:!0,get:o(function(){return Gd.PreconditionProperty},"get")});Object.defineProperty(gr,"GroundingProperty",{enumerable:!0,get:o(function(){return Gd.GroundingProperty},"get")});Object.defineProperty(gr,"CommandBindingProperty",{enumerable:!0,get:o(function(){return Gd.CommandBindingProperty},"get")})});var yo=b(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.hasClass=go;Br.isAreaOrProject=ik;Br.isEffort=sk;Br.hasStatus=ak;Br.isAssetArchived=ok;Br.hasEmptyProperties=ck;Br.needsFolderRepair=lk;Br.getTodayDateString=w0;Br.isPlannedForToday=uk;Br.hasPlannedStartTimestamp=fk;Br.extractDailyNoteDate=dk;Br.isCurrentDateGteDay=hk;Br.inheritsFromPrototype=hT;Br.isPrototypeClass=mk;var dT=Zi(),mo=jn();function go(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>dT.WikiLinkHelpers.normalize(r)===e):!1}o(go,"hasClass");function ik(n){return go(n,mo.AssetClass.AREA)||go(n,mo.AssetClass.PROJECT)}o(ik,"isAreaOrProject");function sk(n){return go(n,mo.AssetClass.TASK)||go(n,mo.AssetClass.PROJECT)||go(n,mo.AssetClass.MEETING)}o(sk,"isEffort");function ak(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?dT.WikiLinkHelpers.normalize(t)===e:!1}o(ak,"hasStatus");function ok(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(ok,"isAssetArchived");function ck(n){return!n||Object.keys(n).length===0?!1:Object.values(n).some(e=>!!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0))}o(ck,"hasEmptyProperties");function lk(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(lk,"needsFolderRepair");function w0(){let n=new Date,e=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0");return`${e}-${t}-${r}`}o(w0,"getTodayDateString");function uk(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=w0();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(uk,"isPlannedForToday");function fk(n){let e=n.ems__Effort_plannedStartTimestamp;return e?typeof e=="string"?e.trim().length>0:Array.isArray(e)&&e.length>0?String(e[0]).trim().length>0:!1:!1}o(fk,"hasPlannedStartTimestamp");function dk(n){let e=n.pn__DailyNote_day;if(!e)return null;if(typeof e=="string"){let t=e.match(/\[\[([^\[\]]+)\]\]/);return t?t[1]:e}if(Array.isArray(e)&&e.length>0){let t=String(e[0]),r=t.match(/\[\[([^\[\]]+)\]\]/);return r?r[1]:t}return null}o(dk,"extractDailyNoteDate");function hk(n){return w0()>=n}o(hk,"isCurrentDateGteDay");function fT(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(fT,"normalizeWithQuotes");var pk=10;function hT(n,e=pk){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let a of s){let c=fT(a);c&&i.push({className:c,depth:0})}for(;i.length>0;){let a=i.shift();if(!a)continue;let{className:c,depth:l}=a;if(l>e)continue;if(c===mo.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let d=Array.isArray(f)?f:[f];for(let h of d){let p=fT(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(hT,"inheritsFromPrototype");function mk(n,e){return go(n,mo.AssetClass.CLASS)?hT(e):!1}o(mk,"isPrototypeClass")});var pT=b(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.canCreateTask=gk;fc.canCreateRelatedTask=yk;fc.canConvertTaskToProject=_k;fc.canSetCriticalityZone=bk;var uc=yo(),v0=jn();function gk(n){return(0,uc.isAreaOrProject)(n.instanceClass)}o(gk,"canCreateTask");function yk(n){return!(!(0,uc.hasClass)(n.instanceClass,v0.AssetClass.TASK)||(0,uc.isAssetArchived)(n.isArchived))}o(yk,"canCreateRelatedTask");function _k(n){return(0,uc.hasClass)(n.instanceClass,v0.AssetClass.TASK)}o(_k,"canConvertTaskToProject");function bk(n){return!(!(0,uc.hasClass)(n.instanceClass,v0.AssetClass.TASK)||(0,uc.isAssetArchived)(n.isArchived))}o(bk,"canSetCriticalityZone")});var mT=b(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.canCreateProject=Sk;dc.canMoveToAnalysis=wk;dc.canMoveToToDo=vk;dc.canConvertProjectToTask=Ek;var ba=yo(),Sa=jn();function Sk(n){return(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.AREA)||(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.INITIATIVE)||(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.PROJECT)}o(Sk,"canCreateProject");function wk(n){return(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.PROJECT)?(0,ba.hasStatus)(n.currentStatus,Sa.EffortStatus.BACKLOG):!1}o(wk,"canMoveToAnalysis");function vk(n){return(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.PROJECT)?(0,ba.hasStatus)(n.currentStatus,Sa.EffortStatus.ANALYSIS):!1}o(vk,"canMoveToToDo");function Ek(n){return(0,ba.hasClass)(n.instanceClass,Sa.AssetClass.PROJECT)}o(Ek,"canConvertProjectToTask")});var _T=b(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.canCreateChildArea=Tk;zd.canSetActiveFocus=Ak;var gT=yo(),yT=jn();function Tk(n){return(0,gT.hasClass)(n.instanceClass,yT.AssetClass.AREA)}o(Tk,"canCreateChildArea");function Ak(n){return(0,gT.hasClass)(n.instanceClass,yT.AssetClass.AREA)}o(Ak,"canSetActiveFocus")});var ST=b(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.canPlanOnToday=xk;on.canPlanForEvening=Ik;on.canShiftDayBackward=Ck;on.canShiftDayForward=Rk;on.canSetDraftStatus=Ok;on.canMoveToBacklog=Pk;on.canStartEffort=Fk;on.canMarkDone=Dk;on.canTrashEffort=Nk;on.canVoteOnEffort=Lk;on.canRollbackStatus=kk;on.canArchiveTask=jk;on.canMarkReviewed=Mk;var bT=Zi(),ht=yo(),an=jn();function xk(n){return!(!(0,ht.isEffort)(n.instanceClass)||(0,ht.isPlannedForToday)(n.metadata))}o(xk,"canPlanOnToday");function Ik(n){return!(0,ht.hasClass)(n.instanceClass,an.AssetClass.TASK)&&!(0,ht.hasClass)(n.instanceClass,an.AssetClass.MEETING)?!1:(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.BACKLOG)}o(Ik,"canPlanForEvening");function Ck(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasPlannedStartTimestamp)(n.metadata):!1}o(Ck,"canShiftDayBackward");function Rk(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasPlannedStartTimestamp)(n.metadata):!1}o(Rk,"canShiftDayForward");function Ok(n){return(0,ht.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(Ok,"canSetDraftStatus");function Pk(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.DRAFT):!1}o(Pk,"canMoveToBacklog");function Fk(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasClass)(n.instanceClass,an.AssetClass.TASK)||(0,ht.hasClass)(n.instanceClass,an.AssetClass.MEETING)?(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.BACKLOG):(0,ht.hasClass)(n.instanceClass,an.AssetClass.PROJECT)?(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.TODO):!1:!1}o(Fk,"canStartEffort");function Dk(n){return(0,ht.isEffort)(n.instanceClass)?(0,ht.hasStatus)(n.currentStatus,an.EffortStatus.DOING):!1}o(Dk,"canMarkDone");function Nk(n){return(0,ht.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=bT.WikiLinkHelpers.normalize(r);return i===an.EffortStatus.TRASHED||i===an.EffortStatus.DONE}):!0:!1}o(Nk,"canTrashEffort");function Lk(n){return!(!(0,ht.isEffort)(n.instanceClass)||(0,ht.isAssetArchived)(n.isArchived))}o(Lk,"canVoteOnEffort");function kk(n){if(!(0,ht.isEffort)(n.instanceClass)||(0,ht.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||bT.WikiLinkHelpers.normalize(e)===an.EffortStatus.TRASHED)}o(kk,"canRollbackStatus");function jk(n){return!(0,ht.isAssetArchived)(n.isArchived)}o(jk,"canArchiveTask");function Mk(n){return!(!(0,ht.hasClass)(n.instanceClass,an.AssetClass.TASK)&&!(0,ht.hasClass)(n.instanceClass,an.AssetClass.PROJECT)||(0,ht.isAssetArchived)(n.isArchived))}o(Mk,"canMarkReviewed")});var wT=b(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.canCreateEvent=Bk;fi.canCreateInstance=Uk;fi.canCleanProperties=qk;fi.canRepairFolder=Wk;fi.canCopyLabelToAliases=Gk;fi.canCreateNarrowerConcept=zk;fi.canCreateSubclass=Hk;fi.canCreateTaskForDailyNote=Qk;fi.canCopyFleetingNoteLabel=Kk;var Ur=yo(),Ms=jn(),$k="75302770-279e-4a59-ba85-09df29725713",Vk="fca0a931-a01f-48e4-b72a-4af206c94bc7";function Bk(n){return(0,Ur.isAreaOrProject)(n.instanceClass)}o(Bk,"canCreateEvent");function Uk(n){return(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.TASK_PROTOTYPE)||(0,Ur.hasClass)(n.instanceClass,$k)||(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.MEETING_PROTOTYPE)||(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.EVENT_PROTOTYPE)||(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.PROJECT_PROTOTYPE)||(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,Ur.isPrototypeClass)(n.instanceClass,n.metadata)}o(Uk,"canCreateInstance");function qk(n){return(0,Ur.hasEmptyProperties)(n.metadata)}o(qk,"canCleanProperties");function Wk(n){return(0,Ur.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(Wk,"canRepairFolder");function Gk(n){let e=n.metadata.exo__Asset_label;if(!e||typeof e!="string"||e.trim()==="")return!1;let t=e.trim(),r=n.metadata.aliases;return!r||!Array.isArray(r)||r.length===0?!0:!r.some(i=>typeof i!="string"?!1:i.trim()===t)}o(Gk,"canCopyLabelToAliases");function zk(n){return(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.CONCEPT)}o(zk,"canCreateNarrowerConcept");function Hk(n){return(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.CLASS)}o(Hk,"canCreateSubclass");function Qk(n){return!(!(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.DAILY_NOTE)||n.isArchived||!(0,Ur.extractDailyNoteDate)(n.metadata))}o(Qk,"canCreateTaskForDailyNote");function Kk(n){return(0,Ur.hasClass)(n.instanceClass,Ms.AssetClass.FLEETING_NOTE)||(0,Ur.hasClass)(n.instanceClass,Vk)}o(Kk,"canCopyFleetingNoteLabel")});var ET=b(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.canCopyFleetingNoteLabel=k.canCreateTaskForDailyNote=k.canCreateSubclass=k.canCreateNarrowerConcept=k.canCopyLabelToAliases=k.canRepairFolder=k.canCleanProperties=k.canCreateInstance=k.canCreateEvent=k.canMarkReviewed=k.canArchiveTask=k.canRollbackStatus=k.canVoteOnEffort=k.canTrashEffort=k.canMarkDone=k.canStartEffort=k.canMoveToBacklog=k.canSetDraftStatus=k.canShiftDayForward=k.canShiftDayBackward=k.canPlanForEvening=k.canPlanOnToday=k.canSetActiveFocus=k.canCreateChildArea=k.canConvertProjectToTask=k.canMoveToToDo=k.canMoveToAnalysis=k.canCreateProject=k.canSetCriticalityZone=k.canConvertTaskToProject=k.canCreateRelatedTask=k.canCreateTask=k.isPrototypeClass=k.inheritsFromPrototype=k.isCurrentDateGteDay=k.extractDailyNoteDate=k.hasPlannedStartTimestamp=k.isPlannedForToday=k.getTodayDateString=k.needsFolderRepair=k.hasEmptyProperties=k.isAssetArchived=k.hasStatus=k.isEffort=k.isAreaOrProject=k.hasClass=void 0;var An=yo();Object.defineProperty(k,"hasClass",{enumerable:!0,get:o(function(){return An.hasClass},"get")});Object.defineProperty(k,"isAreaOrProject",{enumerable:!0,get:o(function(){return An.isAreaOrProject},"get")});Object.defineProperty(k,"isEffort",{enumerable:!0,get:o(function(){return An.isEffort},"get")});Object.defineProperty(k,"hasStatus",{enumerable:!0,get:o(function(){return An.hasStatus},"get")});Object.defineProperty(k,"isAssetArchived",{enumerable:!0,get:o(function(){return An.isAssetArchived},"get")});Object.defineProperty(k,"hasEmptyProperties",{enumerable:!0,get:o(function(){return An.hasEmptyProperties},"get")});Object.defineProperty(k,"needsFolderRepair",{enumerable:!0,get:o(function(){return An.needsFolderRepair},"get")});Object.defineProperty(k,"getTodayDateString",{enumerable:!0,get:o(function(){return An.getTodayDateString},"get")});Object.defineProperty(k,"isPlannedForToday",{enumerable:!0,get:o(function(){return An.isPlannedForToday},"get")});Object.defineProperty(k,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return An.hasPlannedStartTimestamp},"get")});Object.defineProperty(k,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return An.extractDailyNoteDate},"get")});Object.defineProperty(k,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return An.isCurrentDateGteDay},"get")});Object.defineProperty(k,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return An.inheritsFromPrototype},"get")});Object.defineProperty(k,"isPrototypeClass",{enumerable:!0,get:o(function(){return An.isPrototypeClass},"get")});var Hd=pT();Object.defineProperty(k,"canCreateTask",{enumerable:!0,get:o(function(){return Hd.canCreateTask},"get")});Object.defineProperty(k,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return Hd.canCreateRelatedTask},"get")});Object.defineProperty(k,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return Hd.canConvertTaskToProject},"get")});Object.defineProperty(k,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return Hd.canSetCriticalityZone},"get")});var Qd=mT();Object.defineProperty(k,"canCreateProject",{enumerable:!0,get:o(function(){return Qd.canCreateProject},"get")});Object.defineProperty(k,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return Qd.canMoveToAnalysis},"get")});Object.defineProperty(k,"canMoveToToDo",{enumerable:!0,get:o(function(){return Qd.canMoveToToDo},"get")});Object.defineProperty(k,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return Qd.canConvertProjectToTask},"get")});var vT=_T();Object.defineProperty(k,"canCreateChildArea",{enumerable:!0,get:o(function(){return vT.canCreateChildArea},"get")});Object.defineProperty(k,"canSetActiveFocus",{enumerable:!0,get:o(function(){return vT.canSetActiveFocus},"get")});var Mn=ST();Object.defineProperty(k,"canPlanOnToday",{enumerable:!0,get:o(function(){return Mn.canPlanOnToday},"get")});Object.defineProperty(k,"canPlanForEvening",{enumerable:!0,get:o(function(){return Mn.canPlanForEvening},"get")});Object.defineProperty(k,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Mn.canShiftDayBackward},"get")});Object.defineProperty(k,"canShiftDayForward",{enumerable:!0,get:o(function(){return Mn.canShiftDayForward},"get")});Object.defineProperty(k,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Mn.canSetDraftStatus},"get")});Object.defineProperty(k,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Mn.canMoveToBacklog},"get")});Object.defineProperty(k,"canStartEffort",{enumerable:!0,get:o(function(){return Mn.canStartEffort},"get")});Object.defineProperty(k,"canMarkDone",{enumerable:!0,get:o(function(){return Mn.canMarkDone},"get")});Object.defineProperty(k,"canTrashEffort",{enumerable:!0,get:o(function(){return Mn.canTrashEffort},"get")});Object.defineProperty(k,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Mn.canVoteOnEffort},"get")});Object.defineProperty(k,"canRollbackStatus",{enumerable:!0,get:o(function(){return Mn.canRollbackStatus},"get")});Object.defineProperty(k,"canArchiveTask",{enumerable:!0,get:o(function(){return Mn.canArchiveTask},"get")});Object.defineProperty(k,"canMarkReviewed",{enumerable:!0,get:o(function(){return Mn.canMarkReviewed},"get")});var $s=wT();Object.defineProperty(k,"canCreateEvent",{enumerable:!0,get:o(function(){return $s.canCreateEvent},"get")});Object.defineProperty(k,"canCreateInstance",{enumerable:!0,get:o(function(){return $s.canCreateInstance},"get")});Object.defineProperty(k,"canCleanProperties",{enumerable:!0,get:o(function(){return $s.canCleanProperties},"get")});Object.defineProperty(k,"canRepairFolder",{enumerable:!0,get:o(function(){return $s.canRepairFolder},"get")});Object.defineProperty(k,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return $s.canCopyLabelToAliases},"get")});Object.defineProperty(k,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return $s.canCreateNarrowerConcept},"get")});Object.defineProperty(k,"canCreateSubclass",{enumerable:!0,get:o(function(){return $s.canCreateSubclass},"get")});Object.defineProperty(k,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return $s.canCreateTaskForDailyNote},"get")});Object.defineProperty(k,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return $s.canCopyFleetingNoteLabel},"get")})});var TT=b(_o=>{"use strict";var Yk=_o&&_o.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Xk=_o&&_o.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Yk(e,n,t)};Object.defineProperty(_o,"__esModule",{value:!0});Xk(ET(),_o)});var Kd=b(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.PropertyFieldType=void 0;Eu.rangeToFieldType=e4;var Fr;(function(n){n.Text="text",n.Number="number",n.Date="date",n.DateTime="datetime",n.Boolean="boolean",n.Reference="reference",n.Enum="enum",n.StatusSelect="status-select",n.SizeSelect="size-select",n.Wikilink="wikilink",n.Timestamp="timestamp",n.Unknown="unknown"})(Fr||(Eu.PropertyFieldType=Fr={}));var AT="http://www.w3.org/2001/XMLSchema#",Jk="https://exocortex.my/ontology/exo#",Zk="https://exocortex.my/ontology/ems#";function e4(n){if(!n)return Fr.Unknown;let e=n.trim();if(!e)return Fr.Unknown;if(e.startsWith(AT)){let t=e.substring(AT.length);return E0(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return E0(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return E0(r)}return e.startsWith(Zk)||e.startsWith("ems:")?t4(e):e.startsWith(Jk)||e.startsWith("exo:")||r4(e)?Fr.Reference:Fr.Text}o(e4,"rangeToFieldType");function E0(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Fr.Text;case"integer":case"int":case"long":case"short":case"byte":case"nonnegativeinteger":case"positiveinteger":case"nonpositiveinteger":case"negativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"decimal":case"float":case"double":return Fr.Number;case"date":return Fr.Date;case"datetime":case"datetimestamp":return Fr.DateTime;case"boolean":return Fr.Boolean;case"time":return Fr.Timestamp;default:return Fr.Text}}o(E0,"xsdTypeToFieldType");function t4(n){let e=n.toLowerCase();return e.includes("effortstatus")?Fr.StatusSelect:e.includes("tasksize")?Fr.SizeSelect:Fr.Reference}o(t4,"emsTypeToFieldType");function r4(n){let e=n.toLowerCase();return e.includes("exocortex.my/ontology")?!0:["asset","task","project","area","effort","class","property","concept"].some(r=>e.includes(r))}o(r4,"isClassReference")});var T0=b(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.propertyNameToUri=n4;Tu.uriToPropertyName=xT;Tu.extractPropertyLabel=i4;function n4(n){return n.replace(/^([a-z]+)__/,"$1:")}o(n4,"propertyNameToUri");function xT(n){if(n.startsWith("http://")||n.startsWith("https://")){let e=n.match(/\/([a-z]+)#([A-Za-z0-9_]+)$/);if(e)return`${e[1]}__${e[2]}`;let t=n.lastIndexOf("#"),r=n.lastIndexOf("/"),i=Math.max(t,r);return i>=0?n.substring(i+1):n}return n.replace(/^([a-z]+):/,"$1__")}o(xT,"uriToPropertyName");function i4(n){let r=(n.includes(":")?xT(n):n).replace(/^[a-z]+__/,"").split("_");return(r.length>1?r.slice(1).join(" "):r[0]).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,s=>s.toUpperCase())}o(i4,"extractPropertyLabel")});var Yd={};gy(Yd,{__assign:()=>x0,__asyncDelegator:()=>y4,__asyncGenerator:()=>g4,__asyncValues:()=>_4,__await:()=>Au,__awaiter:()=>u4,__classPrivateFieldGet:()=>v4,__classPrivateFieldSet:()=>E4,__createBinding:()=>d4,__decorate:()=>o4,__exportStar:()=>h4,__extends:()=>s4,__generator:()=>f4,__importDefault:()=>w4,__importStar:()=>S4,__makeTemplateObject:()=>b4,__metadata:()=>l4,__param:()=>c4,__read:()=>IT,__rest:()=>a4,__spread:()=>p4,__spreadArrays:()=>m4,__values:()=>I0});function s4(n,e){A0(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function a4(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function o4(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function c4(n,e){return function(t,r){e(t,r,n)}}function l4(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function u4(n,e,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return o(i,"adopt"),new(t||(t=Promise))(function(s,a){function c(f){try{u(r.next(f))}catch(d){a(d)}}o(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(d){a(d)}}o(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}o(u,"step"),u((r=r.apply(n,e||[])).next())})}function f4(n,e){var t={label:0,sent:o(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(f){return l([u,f])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(f){u=[6,f],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function d4(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function h4(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function I0(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:o(function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function IT(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s}function p4(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(IT(arguments[e]));return n}function m4(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),i=0,e=0;e<t;e++)for(var s=arguments[e],a=0,c=s.length;a<c;a++,i++)r[i]=s[a];return r}function Au(n){return this instanceof Au?(this.v=n,this):new Au(n)}function g4(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){r[h]&&(i[h]=function(p){return new Promise(function(y,S){s.push([h,p,y,S])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(y){d(s[0][3],y)}}function l(h){h.value instanceof Au?Promise.resolve(h.value.v).then(u,f):d(s[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function y4(n){var e,t;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=n[i]?function(a){return(t=!t)?{value:Au(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function _4(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof I0=="function"?I0(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(a){return new Promise(function(c,l){a=n[s](a),i(c,l,a.done,a.value)})}}function i(s,a,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},a)}}function b4(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function S4(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function w4(n){return n&&n.__esModule?n:{default:n}}function v4(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function E4(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var A0,x0,Xd=uN(()=>{A0=o(function(n,e){return A0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])},A0(n,e)},"extendStatics");o(s4,"__extends");x0=o(function(){return x0=Object.assign||o(function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),x0.apply(this,arguments)},"__assign");o(a4,"__rest");o(o4,"__decorate");o(c4,"__param");o(l4,"__metadata");o(u4,"__awaiter");o(f4,"__generator");o(d4,"__createBinding");o(h4,"__exportStar");o(I0,"__values");o(IT,"__read");o(p4,"__spread");o(m4,"__spreadArrays");o(Au,"__await");o(g4,"__asyncGenerator");o(y4,"__asyncDelegator");o(_4,"__asyncValues");o(b4,"__makeTemplateObject");o(S4,"__importStar");o(w4,"__importDefault");o(v4,"__classPrivateFieldGet");o(E4,"__classPrivateFieldSet")});var O0=b(R0=>{"use strict";Object.defineProperty(R0,"__esModule",{value:!0});var C0;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(C0||(C0={}));R0.default=C0});var CT=b(P0=>{"use strict";Object.defineProperty(P0,"__esModule",{value:!0});var T4=O0();Object.defineProperty(P0,"Lifecycle",{enumerable:!0,get:o(function(){return T4.default},"get")})});var bo=b(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.defineInjectionTokenMetadata=di.getParamInfo=di.INJECTION_TOKEN_METADATA_KEY=void 0;di.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function A4(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(di.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(A4,"getParamInfo");di.getParamInfo=A4;function x4(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(di.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(di.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(x4,"defineInjectionTokenMetadata");di.defineInjectionTokenMetadata=x4});var F0=b(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.isClassProvider=void 0;function I4(n){return!!n.useClass}o(I4,"isClassProvider");Jd.isClassProvider=I4});var D0=b(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.isFactoryProvider=void 0;function C4(n){return!!n.useFactory}o(C4,"isFactoryProvider");Zd.isFactoryProvider=C4});var th=b(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.delay=hc.DelayedConstructor=void 0;var eh=class{static{o(this,"DelayedConstructor")}constructor(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}createProxy(e){let t={},r=!1,i,s=o(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=o(i=>{t[i]=(...s)=>{s[0]=e();let a=Reflect[i];return a(...s)}},"install");return this.reflectMethods.forEach(r),t}};hc.DelayedConstructor=eh;function R4(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new eh(n)}o(R4,"delay");hc.delay=R4});var rh=b(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.isConstructorToken=es.isTransformDescriptor=es.isTokenDescriptor=es.isNormalToken=void 0;var O4=th();function P4(n){return typeof n=="string"||typeof n=="symbol"}o(P4,"isNormalToken");es.isNormalToken=P4;function F4(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(F4,"isTokenDescriptor");es.isTokenDescriptor=F4;function D4(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(D4,"isTransformDescriptor");es.isTransformDescriptor=D4;function N4(n){return typeof n=="function"||n instanceof O4.DelayedConstructor}o(N4,"isConstructorToken");es.isConstructorToken=N4});var N0=b(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.isTokenProvider=void 0;function L4(n){return!!n.useToken}o(L4,"isTokenProvider");nh.isTokenProvider=L4});var L0=b(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.isValueProvider=void 0;function k4(n){return n.useValue!=null}o(k4,"isValueProvider");ih.isValueProvider=k4});var k0=b(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});var j4=F0();Object.defineProperty(So,"isClassProvider",{enumerable:!0,get:o(function(){return j4.isClassProvider},"get")});var M4=D0();Object.defineProperty(So,"isFactoryProvider",{enumerable:!0,get:o(function(){return M4.isFactoryProvider},"get")});var $4=rh();Object.defineProperty(So,"isNormalToken",{enumerable:!0,get:o(function(){return $4.isNormalToken},"get")});var V4=N0();Object.defineProperty(So,"isTokenProvider",{enumerable:!0,get:o(function(){return V4.isTokenProvider},"get")});var B4=L0();Object.defineProperty(So,"isValueProvider",{enumerable:!0,get:o(function(){return B4.isValueProvider},"get")})});var RT=b(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.isProvider=void 0;var U4=F0(),q4=L0(),W4=N0(),G4=D0();function z4(n){return U4.isClassProvider(n)||q4.isValueProvider(n)||W4.isTokenProvider(n)||G4.isFactoryProvider(n)}o(z4,"isProvider");sh.isProvider=z4});var $0=b(M0=>{"use strict";Object.defineProperty(M0,"__esModule",{value:!0});var j0=class{static{o(this,"RegistryBase")}constructor(){this._registryMap=new Map}entries(){return this._registryMap.entries()}getAll(e){return this.ensure(e),this._registryMap.get(e)}get(e){this.ensure(e);let t=this._registryMap.get(e);return t[t.length-1]||null}set(e,t){this.ensure(e),this._registryMap.get(e).push(t)}setAll(e,t){this._registryMap.set(e,t)}has(e){return this.ensure(e),this._registryMap.get(e).length>0}clear(){this._registryMap.clear()}ensure(e){this._registryMap.has(e)||this._registryMap.set(e,[])}};M0.default=j0});var OT=b(B0=>{"use strict";Object.defineProperty(B0,"__esModule",{value:!0});var H4=$0(),V0=class extends H4.default{static{o(this,"Registry")}};B0.default=V0});var PT=b(q0=>{"use strict";Object.defineProperty(q0,"__esModule",{value:!0});var U0=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};q0.default=U0});var W0=b(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.formatErrorCtor=void 0;function Q4(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(Q4,"formatDependency");function K4(n,e,t=" "){return[n,...e.message.split(`
|
|
32
32
|
`).map(r=>t+r)].join(`
|
|
33
|
-
`)}o(K4,"composeErrorMessage");function Y4(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=Q4(r,e);return K4(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(Y4,"formatErrorCtor");ah.formatErrorCtor=Y4});var FT=b(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.isDisposable=void 0;function X4(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(X4,"isDisposable");oh.isDisposable=X4});var NT=b(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.PostResolutionInterceptors=wo.PreResolutionInterceptors=void 0;var DT=$0(),ch=class extends DT.default{static{o(this,"PreResolutionInterceptors")}};wo.PreResolutionInterceptors=ch;var lh=class extends DT.default{static{o(this,"PostResolutionInterceptors")}};wo.PostResolutionInterceptors=lh;var G0=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new ch,this.postResolution=new lh}};wo.default=G0});var wa=b(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.instance=Vs.typeInfo=void 0;var J4=(Xd(),_d(Yd)),cn=k0(),Z4=RT(),uh=rh(),ej=OT(),xn=O0(),fh=PT(),tj=W0(),rj=th(),nj=FT(),ij=NT();Vs.typeInfo=new Map;var z0=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new ej.default,this.interceptors=new ij.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:xn.default.Transient}){this.ensureNotDisposed();let i;if(Z4.isProvider(t)?i=t:i={useClass:t},cn.isTokenProvider(i)){let s=[e],a=i;for(;a!=null;){let c=a.useToken;if(s.includes(c))throw new Error(`Token registration cycle detected! ${[...s,c].join(" -> ")}`);s.push(c);let l=this._registry.get(c);l&&cn.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===xn.default.Singleton||r.lifecycle==xn.default.ContainerScoped||r.lifecycle==xn.default.ResolutionScoped)&&(cn.isValueProvider(i)||cn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${xn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),cn.isNormalToken(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})}registerInstance(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})}registerSingleton(e,t){if(this.ensureNotDisposed(),cn.isNormalToken(e)){if(cn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:xn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:xn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!cn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:xn.default.Singleton})}resolve(e,t=new fh.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&cn.isNormalToken(e)){if(r)return;throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"Single"),i){let s=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,s,"Single"),s}if(uh.isConstructorToken(e)){let s=this.construct(e,t);return this.executePostResolutionInterceptor(e,s,"Single"),s}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")}executePreResolutionInterceptor(e,t){if(this.interceptors.preResolution.has(e)){let r=[];for(let i of this.interceptors.preResolution.getAll(e))i.options.frequency!="Once"&&r.push(i),i.callback(e,t);this.interceptors.preResolution.setAll(e,r)}}executePostResolutionInterceptor(e,t,r){if(this.interceptors.postResolution.has(e)){let i=[];for(let s of this.interceptors.postResolution.getAll(e))s.options.frequency!="Once"&&i.push(s),s.callback(e,t,r);this.interceptors.postResolution.setAll(e,i)}}resolveRegistration(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===xn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===xn.default.Singleton,i=e.options.lifecycle===xn.default.ContainerScoped,s=r||i,a;return cn.isValueProvider(e.provider)?a=e.provider.useValue:cn.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):cn.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):cn.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===xn.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new fh.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&cn.isNormalToken(e)){if(r)return[];throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"All"),i){let a=i.map(c=>this.resolveRegistration(c,t));return this.executePostResolutionInterceptor(e,a,"All"),a}let s=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,s,"All"),s}isRegistered(e,t=!1){return this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)}reset(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()}clearInstances(){this.ensureNotDisposed();for(let[e,t]of this._registry.entries())this._registry.setAll(e,t.filter(r=>!cn.isValueProvider(r.provider)).map(r=>(r.instance=void 0,r)))}createChildContainer(){this.ensureNotDisposed();let e=new n(this);for(let[t,r]of this._registry.entries())r.some(({options:i})=>i.lifecycle===xn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===xn.default.ContainerScoped?{provider:i.provider,options:i.options}:i));return e}beforeResolution(e,t,r={frequency:"Always"}){this.interceptors.preResolution.set(e,{callback:t,options:r})}afterResolution(e,t,r={frequency:"Always"}){this.interceptors.postResolution.set(e,{callback:t,options:r})}dispose(){return J4.__awaiter(this,void 0,void 0,function*(){this.disposed=!0;let e=[];this.disposables.forEach(t=>{let r=t.dispose();r&&e.push(r)}),yield Promise.all(e)})}getRegistration(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null}getAllRegistrations(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null}construct(e,t){if(e instanceof rj.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Vs.typeInfo.get(e);if(!i||i.length===0){if(e.length===0)return new e;throw new Error(`TypeInfo not known for "${e.name}"`)}let s=i.map(this.resolveParams(t,e));return new e(...s)})();return nj.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return uh.isTokenDescriptor(r)?uh.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new fh.default,r.isOptional),...r.transformArgs):this.resolve(r.transform).transform(this.resolve(r.token,e,r.isOptional),...r.transformArgs):r.multiple?this.resolveAll(r.token,new fh.default,r.isOptional):this.resolve(r.token,e,r.isOptional):uh.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(tj.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Vs.instance=new z0;Vs.default=Vs.instance});var LT=b(Q0=>{"use strict";Object.defineProperty(Q0,"__esModule",{value:!0});var sj=bo(),Bs=wa(),H0=rh(),aj=W0();function oj(){return function(n){let e=sj.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return H0.isTokenDescriptor(r)?H0.isTransformDescriptor(r)?r.multiple?Bs.instance.resolve(r.transform).transform(Bs.instance.resolveAll(r.token),...r.transformArgs):Bs.instance.resolve(r.transform).transform(Bs.instance.resolve(r.token),...r.transformArgs):r.multiple?Bs.instance.resolveAll(r.token):Bs.instance.resolve(r.token):H0.isTransformDescriptor(r)?Bs.instance.resolve(r.transform).transform(Bs.instance.resolve(r.token),...r.transformArgs):Bs.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(aj.formatErrorCtor(n,a,s))}})))}}}}o(oj,"autoInjectable");Q0.default=oj});var kT=b(K0=>{"use strict";Object.defineProperty(K0,"__esModule",{value:!0});var cj=bo();function lj(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return cj.defineInjectionTokenMetadata(t)}o(lj,"inject");K0.default=lj});var dh=b(Y0=>{"use strict";Object.defineProperty(Y0,"__esModule",{value:!0});var uj=bo(),fj=wa(),jT=wa();function dj(n){return function(e){fj.typeInfo.set(e,uj.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{jT.instance.register(t,e)}):jT.instance.register(n.token,e))}}o(dj,"injectable");Y0.default=dj});var MT=b(X0=>{"use strict";Object.defineProperty(X0,"__esModule",{value:!0});var hj=(Xd(),_d(Yd)),pj=wa();function mj(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=hj.__rest(t,["token","options"]);return pj.instance.register(r,s,i)}),e}}o(mj,"registry");X0.default=mj});var $T=b(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});var gj=dh(),yj=wa();function _j(){return function(n){gj.default()(n),yj.instance.registerSingleton(n)}}o(_j,"singleton");J0.default=_j});var VT=b(Z0=>{"use strict";Object.defineProperty(Z0,"__esModule",{value:!0});var bj=bo();function Sj(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return bj.defineInjectionTokenMetadata(t)}o(Sj,"injectAll");Z0.default=Sj});var BT=b(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var wj=bo();function vj(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return wj.defineInjectionTokenMetadata(r)}o(vj,"injectAllWithTransform");e_.default=vj});var UT=b(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var Ej=bo();function Tj(n,e,...t){return Ej.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(Tj,"injectWithTransform");t_.default=Tj});var qT=b(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var Aj=dh(),xj=wa();function Ij(n,e){return function(t){Aj.default()(t),xj.instance.register(e||t,t,{lifecycle:n})}}o(Ij,"scoped");r_.default=Ij});var WT=b(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});var Cj=LT();Object.defineProperty(hi,"autoInjectable",{enumerable:!0,get:o(function(){return Cj.default},"get")});var Rj=kT();Object.defineProperty(hi,"inject",{enumerable:!0,get:o(function(){return Rj.default},"get")});var Oj=dh();Object.defineProperty(hi,"injectable",{enumerable:!0,get:o(function(){return Oj.default},"get")});var Pj=MT();Object.defineProperty(hi,"registry",{enumerable:!0,get:o(function(){return Pj.default},"get")});var Fj=$T();Object.defineProperty(hi,"singleton",{enumerable:!0,get:o(function(){return Fj.default},"get")});var Dj=VT();Object.defineProperty(hi,"injectAll",{enumerable:!0,get:o(function(){return Dj.default},"get")});var Nj=BT();Object.defineProperty(hi,"injectAllWithTransform",{enumerable:!0,get:o(function(){return Nj.default},"get")});var Lj=UT();Object.defineProperty(hi,"injectWithTransform",{enumerable:!0,get:o(function(){return Lj.default},"get")});var kj=qT();Object.defineProperty(hi,"scoped",{enumerable:!0,get:o(function(){return kj.default},"get")})});var GT=b(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});function jj(n){let e;return t=>(e==null&&(e=n(t)),e)}o(jj,"instanceCachingFactory");n_.default=jj});var zT=b(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});function Mj(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(Mj,"instancePerContainerCachingFactory");i_.default=Mj});var HT=b(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});function $j(n,e,t,r=!0){let i,s;return a=>{let c=n(a);return(!r||s!==c)&&((s=c)?i=a.resolve(e):i=a.resolve(t)),i}}o($j,"predicateAwareClassFactory");s_.default=$j});var QT=b(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});var Vj=GT();Object.defineProperty(xu,"instanceCachingFactory",{enumerable:!0,get:o(function(){return Vj.default},"get")});var Bj=zT();Object.defineProperty(xu,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return Bj.default},"get")});var Uj=HT();Object.defineProperty(xu,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return Uj.default},"get")})});var Ce=b(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var a_=(Xd(),_d(Yd));if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var qj=CT();Object.defineProperty(va,"Lifecycle",{enumerable:!0,get:o(function(){return qj.Lifecycle},"get")});a_.__exportStar(WT(),va);a_.__exportStar(QT(),va);a_.__exportStar(k0(),va);var Wj=th();Object.defineProperty(va,"delay",{enumerable:!0,get:o(function(){return Wj.delay},"get")});var Gj=wa();Object.defineProperty(va,"container",{enumerable:!0,get:o(function(){return Gj.instance},"get")})});var pc=b(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});hh.NullLogger=void 0;hh.NullLogger={debug(){},info(){},warn(){},error(){}}});var o_=b((Ete,KT)=>{var mc=class{static{o(this,"Wildcard")}constructor(){return zj||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(mc.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(mc.prototype,"termType",{enumerable:!0,value:"Wildcard"});var zj=new mc;KT.exports.Wildcard=mc});var XT=b((Ate,YT)=>{var Hj=(function(){var n=o(function(R,I,O,N){for(O=O||{},N=R.length;N--;O[R[N]]=I);return O},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],y=[123,126],S=[1,67],v=[39,45,87],w=[13,16,45,197,224,308],T=[1,87],C=[2,281],L=[1,86],$=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],ee=[6,28,29,53,63,70,73,81,83,85],B=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],W=[6,13,16,28,29,45,53,63,70,73,81,82,83,85,87,89,197,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314],F=[6,13,16,28,29,31,39,45,47,48,53,63,70,73,81,82,83,85,87,89,109,112,121,123,126,128,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,337,338,340,341,342,343,344,345,346],D=[13,16,308],G=[112,132,327,334],Re=[13,16,112,132,308],et=[1,111],ft=[1,117],Ze=[112,132,327,328,334],te=[13,16,112,132,308,328],ie=[28,29,45,53,87],K=[1,138],q=[1,151],st=[1,128],nt=[1,127],z=[1,129],Ne=[1,140],He=[1,141],re=[1,142],Qe=[1,143],Ke=[1,144],We=[1,145],Ye=[1,147],xe=[1,148],Ge=[2,457],Le=[1,158],ze=[1,159],Xe=[1,160],ue=[1,152],me=[1,153],ge=[1,156],fe=[1,171],de=[1,172],he=[1,173],ce=[1,174],ye=[1,175],_e=[1,176],be=[1,167],Se=[1,168],ae=[1,169],we=[1,170],it=[1,157],Je=[1,166],qe=[1,161],E=[1,162],A=[1,163],x=[1,164],P=[1,165],Z=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],bt=[1,195],At=[6,31,73,81,83,85],je=[2,285],H=[1,199],Q=[1,201],Y=[6,31,70,73,81,83,85],X=[2,283],Oe=[1,207],at=[1,218],ot=[1,223],Cr=[1,219],vn=[1,225],kn=[1,226],tn=[1,224],E2=[6,63,70,73,81,83,85],T2=[1,236],A2=[2,334],x2=[1,243],I2=[1,241],Rr=[6,193],Yf=[2,349],C2=[2,339],ma=[28,128],R2=[47,48,193,272],Xf=[47,48,193,242,272],Jo=[47,48,193,242,246,272],Zo=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],mr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],O2=[1,271],P2=[1,270],Qt=[6,13,16,29,31,39,45,47,48,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],F2=[1,281],D2=[1,280],rn=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],Xl=[45,89],Jf=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],Zf=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],ed=[31,89],td=[48,87],eo=[6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338],Hi=[6,13,16,39,45,48,82,87,89,231,263,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338,340],N2=[1,313],ec=[6,85],Kg=[6,31,81,83,85],L2=[2,361],Is=[2,353],to=[1,343],Jl=[31,112,335],Cs=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Yg=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335],k2=[6,109,193],ro=[31,112],Kt=[13,16,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],Xg=[1,390],Jg=[1,391],ga=[13,16,87,197,308,314],j2=[13,16,39,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],rd=[1,417],nd=[1,418],M2=[13,16,48,197,229,308],ya=[6,31,85],$2=[6,13,16,31,45,73,81,83,85,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],Zg=[6,13,16,29,31,45,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,231,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,346,347,348,349,350,351],no=[29,31,85,112,159,160,161,163,164],id=[1,443],sd=[1,444],V2=[1,449],io=[31,112,193,232,318,335],ad=[13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],B2=[13,16,31,45,48,82,87,89,112,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],ey=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Zl=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],eu=[31,45],U2=[1,507],q2=[1,508],W2=[6,13,16,29,31,39,45,47,48,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,336,338,341,342,343,344,345,346,347,348,349,350,351],od=[29,31,85,112,159,160,161,163,164,335],so=[6,13,16,31,45,70,73,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],G2=[13,16,31,45,48,82,87,89,112,193,197,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],z2=[2,352],ty=[13,16,197,308,314],H2=[1,565],tc=[6,13,16,31,45,76,78,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],Q2=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Rs=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],K2=[13,16,87,308],Os=[2,364],rc=[29,31,85,112,159,160,161,163,164,193,232,318,335],cd=[31,112,193,232,272,318,335],Ps=[2,359],Y2=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],ld=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],X2=[13,16,31,45,82,87,89,112,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],J2=[2,347],ry={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Query:7,Qry:8,Query_option0:9,Prologue_repetition0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectClauseWildcard:17,Qry_repetition0:18,WhereClause:19,SolutionModifierNoGroup:20,SelectClauseVars:21,Qry_repetition1:22,SolutionModifier:23,CONSTRUCT:24,ConstructTemplate:25,Qry_repetition2:26,Qry_repetition3:27,WHERE:28,"{":29,Qry_option0:30,"}":31,DESCRIBE:32,Qry_group0:33,Qry_repetition4:34,Qry_option1:35,ASK:36,Qry_repetition5:37,SelectClauseBase:38,"*":39,SelectClauseVars_repetition_plus0:40,SELECT:41,SelectClauseBase_option0:42,SelectClauseItem:43,Var:44,"(":45,Expression:46,AS:47,")":48,SubSelect:49,SubSelect_option0:50,SubSelect_option1:51,DatasetClause:52,FROM:53,DatasetClause_option0:54,iri:55,WhereClause_option0:56,GroupGraphPattern:57,SolutionModifier_option0:58,SolutionModifierNoGroup_option0:59,SolutionModifierNoGroup_option1:60,SolutionModifierNoGroup_option2:61,GroupClause:62,GROUP:63,BY:64,GroupClause_repetition_plus0:65,GroupCondition:66,BuiltInCall:67,FunctionCall:68,HavingClause:69,HAVING:70,HavingClause_repetition_plus0:71,OrderClause:72,ORDER:73,OrderClause_repetition_plus0:74,OrderCondition:75,ASC:76,BrackettedExpression:77,DESC:78,Constraint:79,LimitOffsetClauses:80,LIMIT:81,INTEGER:82,OFFSET:83,ValuesClause:84,VALUES:85,InlineData:86,VAR:87,InlineData_repetition0:88,NIL:89,InlineData_repetition1:90,InlineData_repetition_plus2:91,InlineData_repetition3:92,DataBlock:93,DataBlockValueList:94,DataBlockValueList_repetition_plus0:95,Update:96,Update_repetition0:97,Update1:98,Update_option0:99,LOAD:100,Update1_option0:101,Update1_option1:102,Update1_group0:103,Update1_option2:104,GraphRefAll:105,Update1_group1:106,Update1_option3:107,GraphOrDefault:108,TO:109,CREATE:110,Update1_option4:111,GRAPH:112,INSERTDATA:113,QuadPattern:114,DELETEDATA:115,DELETEWHERE:116,Update1_option5:117,InsertDeleteClause:118,Update1_repetition0:119,IntoGraphClause:120,INTO:121,GraphRef:122,DELETE:123,InsertDeleteClause_option0:124,InsertClause:125,INSERT:126,UsingClause:127,USING:128,UsingClause_option0:129,WithClause:130,WITH:131,DEFAULT:132,GraphOrDefault_option0:133,GraphRefAll_group0:134,Quads:135,Quads_option0:136,Quads_repetition0:137,QuadsNotTriples:138,VarOrIri:139,QuadsNotTriples_option0:140,QuadsNotTriples_option1:141,QuadsNotTriples_option2:142,TriplesTemplate:143,TriplesTemplate_repetition0:144,TriplesSameSubject:145,TriplesTemplate_option0:146,GroupGraphPatternSub:147,GroupGraphPatternSub_option0:148,GroupGraphPatternSub_repetition0:149,GroupGraphPatternSubTail:150,GraphPatternNotTriples:151,GroupGraphPatternSubTail_option0:152,GroupGraphPatternSubTail_option1:153,TriplesBlock:154,TriplesBlock_repetition0:155,TriplesSameSubjectPath:156,TriplesBlock_option0:157,GroupOrUnionGraphPattern:158,OPTIONAL:159,MINUS:160,SERVICE:161,GraphPatternNotTriples_option0:162,FILTER:163,BIND:164,InlineDataOneVar:165,InlineDataFull:166,InlineDataOneVar_repetition0:167,InlineDataFull_repetition0:168,InlineDataFull_repetition_plus1:169,InlineDataFull_repetition2:170,DataBlockValue:171,Literal:172,QuotedTriple:173,UNDEF:174,GroupOrUnionGraphPattern_repetition0:175,ArgList:176,ArgList_option0:177,ArgList_repetition0:178,ExpressionList:179,ExpressionList_repetition0:180,ConstructTemplate_option0:181,ConstructTriples:182,ConstructTriples_repetition0:183,ConstructTriples_option0:184,VarOrTermOrQuotedTP:185,PropertyListNotEmpty:186,TriplesNode:187,PropertyList:188,PropertyList_option0:189,VerbObjectList:190,PropertyListNotEmpty_repetition0:191,SemiOptionalVerbObjectList:192,";":193,SemiOptionalVerbObjectList_option0:194,Verb:195,ObjectList:196,a:197,ObjectList_repetition0:198,Object:199,GraphNode:200,Object_option0:201,PropertyListPathNotEmpty:202,TriplesNodePath:203,TriplesSameSubjectPath_option0:204,O:205,PropertyListPathNotEmpty_repetition0:206,PropertyListPathNotEmptyTail:207,O_group0:208,ObjectListPath:209,ObjectListPath_repetition0:210,ObjectPath:211,GraphNodePath:212,ObjectPath_option0:213,Path:214,Path_repetition0:215,PathSequence:216,PathSequence_repetition0:217,PathEltOrInverse:218,PathElt:219,PathPrimary:220,PathElt_option0:221,PathEltOrInverse_option0:222,IriOrA:223,"!":224,PathNegatedPropertySet:225,PathOneInPropertySet:226,PathNegatedPropertySet_repetition0:227,PathNegatedPropertySet_option0:228,"^":229,TriplesNode_repetition_plus0:230,"[":231,"]":232,TriplesNodePath_repetition_plus0:233,VarOrTermOrQuotedTPExpr:234,VarOrTerm:235,GraphTerm:236,BlankNode:237,ConditionalOrExpression:238,ConditionalAndExpression:239,ConditionalOrExpression_repetition0:240,ConditionalOrExpressionTail:241,"||":242,RelationalExpression:243,ConditionalAndExpression_repetition0:244,ConditionalAndExpressionTail:245,"&&":246,NumericExpression:247,RelationalExpression_group0:248,RelationalExpression_option0:249,IN:250,MultiplicativeExpression:251,NumericExpression_repetition0:252,AdditiveExpressionTail:253,AdditiveExpressionTail_group0:254,NumericLiteralPositive:255,AdditiveExpressionTail_repetition0:256,NumericLiteralNegative:257,AdditiveExpressionTail_repetition1:258,UnaryExpression:259,MultiplicativeExpression_repetition0:260,MultiplicativeExpressionTail:261,MultiplicativeExpressionTail_group0:262,"+":263,PrimaryExpression:264,"-":265,ExprQuotedTP:266,Aggregate:267,FUNC_ARITY0:268,FUNC_ARITY1:269,FUNC_ARITY1_SPARQL_STAR:270,FUNC_ARITY2:271,",":272,FUNC_ARITY3:273,FUNC_ARITY3_SPARQL_STAR:274,BuiltInCall_group0:275,BOUND:276,BNODE:277,BuiltInCall_option0:278,EXISTS:279,COUNT:280,Aggregate_option0:281,Aggregate_group0:282,FUNC_AGGREGATE:283,Aggregate_option1:284,GROUP_CONCAT:285,Aggregate_option2:286,Aggregate_option3:287,GroupConcatSeparator:288,SEPARATOR:289,"=":290,String:291,LANGTAG:292,"^^":293,DECIMAL:294,DOUBLE:295,BOOLEAN:296,INTEGER_POSITIVE:297,DECIMAL_POSITIVE:298,DOUBLE_POSITIVE:299,INTEGER_NEGATIVE:300,DECIMAL_NEGATIVE:301,DOUBLE_NEGATIVE:302,STRING_LITERAL1:303,STRING_LITERAL2:304,STRING_LITERAL_LONG1:305,STRING_LITERAL_LONG2:306,PrefixedName:307,PNAME_LN:308,BLANK_NODE_LABEL:309,ANON:310,QuotedTP:311,"<<":312,qtSubjectOrObject:313,">>":314,DataValueTerm:315,AnnotationPattern:316,"{|":317,"|}":318,AnnotationPatternPath:319,ExprVarOrTerm:320,QueryOrUpdate_group0_option0:321,Prologue_repetition0_group0:322,Qry_group0_repetition_plus0:323,SelectClauseBase_option0_group0:324,DISTINCT:325,REDUCED:326,NAMED:327,SILENT:328,CLEAR:329,DROP:330,ADD:331,MOVE:332,COPY:333,ALL:334,".":335,UNION:336,"|":337,"/":338,PathElt_option0_group0:339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,NOT:346,CONCAT:347,COALESCE:348,SUBSTR:349,REGEX:350,REPLACE:351,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"},productions_:[0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]],performAction:o(function(I,O,N,ne,ke,g,sn){var _=g.length-1;switch(ke){case 1:if(g[_-1]=g[_-1]||{},Ve.base&&(g[_-1].base=Ve.base),Ve.base="",g[_-1].prefixes=Ve.prefixes,Ve.prefixes=null,Ve.pathOnly){if(g[_-1].type==="path"||"termType"in g[_-1])return g[_-1];throw new Error("Received full SPARQL query in path only mode")}else if(g[_-1].type==="path"||"termType"in g[_-1])throw new Error("Received only path in full SPARQL mode");if(g[_-1].type==="update"){let St={};for(let Dt of g[_-1].updates)if(Dt.updateType==="insert"){let ct={};for(let dt of Dt.insert)if(dt.type==="bgp"||dt.type==="graph")for(let En of dt.triples)En.subject.termType==="BlankNode"&&(ct[En.subject.value]=!0),En.predicate.termType==="BlankNode"&&(ct[En.predicate.value]=!0),En.object.termType==="BlankNode"&&(ct[En.object.value]=!0);for(let dt of Object.keys(ct)){if(St[dt])throw new Error("Detected reuse blank node across different INSERT DATA clauses");St[dt]=!0}}}return g[_-1];case 2:this.$={...g[_-1],...g[_],type:"query"};break;case 4:Ve.base=tu(g[_]);break;case 5:Ve.prefixes||(Ve.prefixes={}),g[_-1]=g[_-1].substr(0,g[_-1].length-1),g[_]=tu(g[_]),Ve.prefixes[g[_-1]]=g[_];break;case 6:this.$={...g[_-3],...co(g[_-2]),...g[_-1],...g[_]};break;case 7:if(!Ve.skipValidation&&(uy(g[_-3].variables.map(Dt=>ly(Dt.expression))).some(Dt=>Dt.aggregation==="count"&&!(Dt.expression instanceof ud))||g[_].group)){for(let Dt of g[_-3].variables)if(Dt.termType==="Variable"){if(!g[_].group||!g[_].group.map(ct=>ac(ct)).includes(ac(Dt)))throw Error("Projection of ungrouped variable (?"+ac(Dt)+")")}else if(ly(Dt.expression).length===0){let ct=rN(Dt.expression);for(let dt of ct)if(!g[_].group||!g[_].group.map||!g[_].group.map(En=>ac(En)).includes(ac(dt)))throw Error("Use of ungrouped variable in projection of operation (?"+ac(dt)+")")}}let Xi=g[_-1].where.filter(St=>St.type==="query");if(Xi.length>0){let St=g[_-3].variables.filter(ct=>ct.variable&&ct.variable.value).map(ct=>ct.variable.value),Dt=uy(Xi.map(ct=>ct.variables)).map(ct=>ct.value||ct.variable.value);for(let ct of St)if(Dt.indexOf(ct)>=0)throw Error("Target id of 'AS' (?"+ct+") already used in subquery")}this.$=qt(g[_-3],co(g[_-2]),g[_-1],g[_]);break;case 8:this.$=qt({queryType:"CONSTRUCT",template:g[_-3]},co(g[_-2]),g[_-1],g[_]);break;case 9:this.$=qt({queryType:"CONSTRUCT",template:g[_-2]=g[_-2]?g[_-2].triples:[]},co(g[_-5]),{where:[{type:"bgp",triples:oo([],g[_-2])}]},g[_]);break;case 10:this.$=qt({queryType:"DESCRIBE",variables:g[_-3]==="*"?[new ud]:g[_-3]},co(g[_-2]),g[_-1],g[_]);break;case 11:this.$=qt({queryType:"ASK"},co(g[_-2]),g[_-1],g[_]);break;case 12:this.$=qt(g[_-1],{variables:[new ud]});break;case 13:let au=g[_].map(St=>St.value||St.variable.value),oc=nN(au);if(oc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+oc[0]+")");this.$=qt(g[_-1],{variables:g[_]});break;case 14:this.$=qt({queryType:"SELECT"},g[_]&&(g[_-1]=nn(g[_]),g[_]={},g[_][g[_-1]]=!0,g[_]));break;case 16:case 27:this.$=nc(g[_-3],{variable:g[_-1]});break;case 17:case 18:this.$=qt(g[_-3],g[_-2],g[_-1],g[_],{type:"query"});break;case 19:case 58:this.$={iri:g[_],named:!!g[_-1]};break;case 20:this.$={where:g[_].patterns};break;case 21:this.$=qt(g[_-1],g[_]);break;case 22:this.$=qt(g[_-2],g[_-1],g[_]);break;case 23:this.$={group:g[_]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=nc(g[_]);break;case 26:this.$=nc(g[_-1]);break;case 29:this.$={having:g[_]};break;case 30:this.$={order:g[_]};break;case 32:this.$=nc(g[_],{descending:!0});break;case 35:this.$={limit:sc(g[_])};break;case 36:this.$={offset:sc(g[_])};break;case 37:this.$={limit:sc(g[_-2]),offset:sc(g[_])};break;case 38:this.$={limit:sc(g[_]),offset:sc(g[_-2])};break;case 39:case 43:this.$={type:"values",values:g[_]};break;case 40:case 84:this.$=g[_-1].map(St=>({[g[_-3]]:St}));break;case 41:case 85:this.$=g[_-1].map(()=>({}));break;case 42:case 86:var Yi=g[_-4].length;g[_-4]=g[_-4].map(ny),this.$=g[_-1].map(function(St){if(St.length!==Yi)throw Error("Inconsistent VALUES length");for(var Dt={},ct=0;ct<Yi;ct++)Dt["?"+g[_-4][ct].value]=St[ct];return Dt});break;case 44:case 65:case 100:case 126:case 175:this.$=g[_-1];break;case 45:this.$={type:"update",updates:Fs(g[_-2],g[_-1])};break;case 46:this.$=qt({type:"load",silent:!!g[_-2],source:g[_-1]},g[_]&&{destination:g[_]});break;case 47:this.$={type:nn(g[_-2]),silent:!!g[_-1],graph:g[_]};break;case 48:this.$={type:nn(g[_-4]),silent:!!g[_-3],source:g[_-2],destination:g[_]};break;case 49:this.$={type:"create",silent:!!g[_-2],graph:{type:"graph",name:g[_]}};break;case 50:this.$={updateType:"insert",insert:lE(g[_])};break;case 51:this.$={updateType:"delete",delete:hy(lE(g[_]))};break;case 52:this.$={updateType:"deletewhere",delete:hy(g[_])};break;case 53:this.$={updateType:"insertdelete",...g[_-4],...g[_-3],...co(g[_-2],"using"),where:g[_].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=g[_];break;case 55:this.$={delete:hy(g[_-1]),insert:g[_]||[]};break;case 56:this.$={delete:[],insert:g[_]};break;case 59:this.$={graph:g[_]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:g[_]};break;case 64:this.$={[nn(g[_])]:!0};break;case 66:this.$=g[_-1]?Qi(g[_],[g[_-1]]):Qi(g[_]);break;case 67:var iu=qt(g[_-3]||{triples:[]},{type:"graph",name:g[_-5]});this.$=g[_]?[iu,g[_]]:[iu];break;case 68:case 73:this.$={type:"bgp",triples:Qi(g[_-2],[g[_-1]])};break;case 69:this.$={type:"group",patterns:[g[_-1]]};break;case 70:for(let St of g[_-1].filter(Dt=>Dt.type==="bind")){let Dt=g[_-1].indexOf(St),ct=new Set;for(let dt of g[_-1].slice(0,Dt))(dt.type==="group"||dt.type==="bgp")&&oE(dt).forEach(En=>ct.add(En));if(ct.has(St.variable.value))throw Error("Variable used to bind is already bound (?"+St.variable.value+")")}this.$={type:"group",patterns:g[_-1]};break;case 71:this.$=g[_-1]?Qi([g[_-1]],g[_]):Qi(g[_]);break;case 72:this.$=g[_]?[g[_-2],g[_]]:g[_-2];break;case 75:this.$=qt(g[_],{type:"optional"});break;case 76:this.$=qt(g[_],{type:"minus"});break;case 77:this.$=qt(g[_],{type:"graph",name:g[_-1]});break;case 78:this.$=qt(g[_],{type:"service",name:g[_-1],silent:!!g[_-2]});break;case 79:this.$={type:"filter",expression:g[_]};break;case 80:this.$={type:"bind",variable:g[_-1],expression:g[_-3]};break;case 89:this.$=nu(g[_]);break;case 90:this.$=void 0;break;case 91:this.$=g[_-1].length?{type:"union",patterns:Qi(g[_-1].map(sy),[sy(g[_])])}:g[_];break;case 95:this.$={...g[_],function:g[_-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Fs(g[_-2],g[_-1]),distinct:!!g[_-3]};break;case 98:case 115:case 128:case 247:case 249:case 251:case 253:case 255:case 263:case 267:case 297:case 299:case 303:case 307:case 328:case 341:case 349:case 355:case 361:case 367:case 369:case 373:case 375:case 379:case 381:case 385:case 391:case 395:case 401:case 405:case 409:case 411:case 420:case 428:case 430:case 440:case 444:case 446:case 448:this.$=[];break;case 99:this.$=Fs(g[_-2],g[_-1]);break;case 101:this.$=Qi(g[_-2],[g[_-1]]);break;case 102:case 112:this.$=dy(g[_].map(St=>qt(Ds(g[_-1]),St)));break;case 103:this.$=dy(oo(g[_].map(St=>qt(Ds(g[_-1].entity),St)),g[_-1].triples));break;case 105:this.$=Qi([g[_-1]],g[_]);break;case 106:this.$=Qi(g[_]);break;case 107:this.$=cy(g[_-1],g[_]);break;case 109:case 237:this.$=Ve.factory.namedNode(zD);break;case 110:case 118:this.$=Fs(g[_-1],g[_]);break;case 111:this.$=g[_]?{annotation:g[_],object:g[_-1]}:g[_-1];break;case 113:this.$=g[_]?dy(oo(g[_].map(St=>qt(Ds(g[_-1].entity),St)),g[_-1].triples)):g[_-1].triples;break;case 114:this.$=cy(...g[_-1],g[_]);break;case 116:this.$=cy(...g[_]);break;case 117:case 159:case 163:this.$=[g[_-1],g[_]];break;case 119:this.$=g[_]?{object:g[_-1],annotation:g[_]}:g[_-1];break;case 120:this.$=g[_-1].length?ic("|",Fs(g[_-1],g[_])):g[_];break;case 121:this.$=g[_-1].length?ic("/",Fs(g[_-1],g[_])):g[_];break;case 122:this.$=g[_]?ic(g[_],[g[_-1]]):g[_-1];break;case 123:this.$=g[_-1]?ic(g[_-1],[g[_]]):g[_];break;case 125:case 131:this.$=ic(g[_-1],[g[_]]);break;case 129:this.$=ic("|",Fs(g[_-2],g[_-1]));break;case 132:case 134:this.$=eN(g[_-1]);break;case 133:case 135:this.$=tN(g[_-1]);break;case 140:this.$={entity:g[_],triples:[]};break;case 145:this.$=ny(g[_]);break;case 149:this.$=Ve.factory.namedNode(Z2);break;case 151:case 153:case 158:case 162:this.$=iy(g[_-1],g[_]);break;case 152:this.$=["||",g[_]];break;case 154:this.$=["&&",g[_]];break;case 156:this.$=Or(g[_-1],[g[_-2],g[_]]);break;case 157:this.$=Or(g[_-2]?"notin":"in",[g[_-3],g[_]]);break;case 160:this.$=["+",iy(g[_-1],g[_])];break;case 161:var hd=Ki(g[_-1].value.replace("-",""),g[_-1].datatype);this.$=["-",iy(hd,g[_])];break;case 164:this.$=Or("UPLUS",[g[_]]);break;case 165:this.$=Or(g[_-1],[g[_]]);break;case 166:this.$=Or("UMINUS",[g[_]]);break;case 177:this.$=Or(nn(g[_-1]));break;case 178:this.$=Or(nn(g[_-3]),[g[_-1]]);break;case 179:this.$=nu(Or(nn(g[_-3]),[g[_-1]]));break;case 180:this.$=Or(nn(g[_-5]),[g[_-3],g[_-1]]);break;case 181:this.$=Or(nn(g[_-7]),[g[_-5],g[_-3],g[_-1]]);break;case 182:this.$=nu(Or(nn(g[_-7]),[g[_-5],g[_-3],g[_-1]]));break;case 183:this.$=Or(nn(g[_-1]),g[_]);break;case 184:this.$=Or("bound",[ny(g[_-1])]);break;case 185:this.$=Or(g[_-1],[]);break;case 186:this.$=Or(g[_-3],[g[_-1]]);break;case 187:this.$=Or(g[_-2]?"notexists":"exists",[sy(g[_])]);break;case 188:case 189:this.$=nc(g[_-1],{type:"aggregate",aggregation:nn(g[_-4]),distinct:!!g[_-2]});break;case 190:this.$=nc(g[_-2],{type:"aggregate",aggregation:nn(g[_-5]),distinct:!!g[_-3],separator:typeof g[_-1]=="string"?g[_-1]:" "});break;case 192:this.$=Ki(g[_]);break;case 193:this.$=YD(g[_-1],nn(g[_].substr(1)));break;case 194:this.$=Ki(g[_-2],g[_]);break;case 195:case 204:this.$=Ki(g[_],eE);break;case 196:case 205:this.$=Ki(g[_],tE);break;case 197:case 206:this.$=Ki(nn(g[_]),rE);break;case 200:this.$=Ki(g[_].toLowerCase(),KD);break;case 201:this.$=Ki(g[_].substr(1),eE);break;case 202:this.$=Ki(g[_].substr(1),tE);break;case 203:this.$=Ki(g[_].substr(1).toLowerCase(),rE);break;case 207:case 208:this.$=aE(g[_],1);break;case 209:case 210:this.$=aE(g[_],3);break;case 211:this.$=Ve.factory.namedNode(tu(g[_]));break;case 213:var pd=g[_].indexOf(":"),su=g[_].substr(0,pd),md=Ve.prefixes[su];if(!md)throw new Error("Unknown prefix: "+su);var jt=tu(md+g[_].substr(pd+1));this.$=Ve.factory.namedNode(jt);break;case 214:if(g[_]=g[_].substr(0,g[_].length-1),!(g[_]in Ve.prefixes))throw new Error("Unknown prefix: "+g[_]);var jt=tu(Ve.prefixes[g[_]]);this.$=Ve.factory.namedNode(jt);break;case 215:this.$=ru(g[_].replace(/^(_:)/,""));break;case 216:this.$=ru();break;case 217:case 218:case 232:this.$=nu(ay(g[_-3],g[_-2],g[_-1]));break;case 230:case 231:this.$=nu(g[_-1]);break;case 248:case 250:case 252:case 254:case 256:case 260:case 264:case 268:case 270:case 292:case 294:case 296:case 298:case 300:case 302:case 304:case 306:case 329:case 342:case 356:case 368:case 370:case 372:case 374:case 392:case 402:case 425:case 427:case 429:case 431:case 441:case 445:case 447:case 449:g[_-1].push(g[_]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[g[_]];break;case 308:g[_-3].push(g[_-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:g[_-2].push(g[_-1]);break}},"anonymous"),table:[n(e,t,{3:1,4:2,10:3}),{1:[3]},n(r,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:i,16:i,45:i,197:i,224:i,229:i,308:i,24:[1,13],32:[1,14],36:[1,15],41:s}),n([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:a},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(y,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:S,87:h},n(v,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),n(e,[2,248]),n(e,[2,245]),n(e,[2,246]),{13:[1,72]},{16:[1,73]},{1:[2,1]},{6:[2,2]},{6:[2,244]},{45:[1,77],85:[1,78],86:74,87:[1,75],89:[1,76]},n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],[2,120],{337:[1,79]}),n(w,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:T,29:C,52:84,53:L,56:85},{19:88,28:T,29:C,52:89,53:L,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:L},n($,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(ee,[2,263],{34:96}),n(ee,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(ee,[2,262]),n(B,[2,259]),n(W,[2,143]),n(W,[2,144]),n([6,13,16,28,29,31,39,45,47,48,53,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,145]),n(F,[2,211]),n(F,[2,212]),n(F,[2,213]),n(F,[2,214]),{19:98,28:T,29:C,52:99,53:L,56:85},{6:[2,309],99:100,193:[1,101]},n(D,[2,311],{101:102,328:[1,103]}),n(G,[2,317],{104:104,328:[1,105]}),n(Re,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:et,114:110},{29:et,114:112},{29:et,114:113},{118:114,123:[1,115],125:116,126:ft},n(Ze,[2,315]),n(Ze,[2,316]),n(te,[2,319]),n(te,[2,320]),n(te,[2,321]),n(y,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:S,87:h}),n(ie,[2,269]),n(ie,[2,15]),{13:f,16:d,44:136,45:K,46:120,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(v,[2,14]),n(v,[2,274]),n(v,[2,271]),n(v,[2,272]),n(e,[2,4]),{13:[1,177]},n(Z,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:d,45:[1,193],55:194,197:bt,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(w,[2,419]),n(At,je,{20:196,59:197,69:198,70:H}),n(l,[2,250]),{29:Q,57:200},n(D,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(Y,X,{23:204,58:205,62:206,63:Oe}),n(l,[2,252]),{19:208,28:T,29:C,52:209,53:L,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:at,55:220,82:q,87:h,89:ot,145:212,172:221,185:213,187:214,231:Cr,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(E2,[2,265],{56:85,35:227,52:228,19:229,28:T,29:C,53:L}),n(B,[2,260]),n(Y,X,{58:205,62:206,23:230,63:Oe}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:p},n(D,[2,312]),{105:233,112:T2,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(G,[2,318]),n(D,A2,{108:240,133:242,112:x2,132:I2}),n(Re,[2,323]),{112:[1,244]},{112:[2,325]},n(Rr,[2,50]),n($,Yf,{135:245,136:246,143:247,144:248,31:C2,112:C2}),n(Rr,[2,51]),n(Rr,[2,52]),n(ma,[2,328],{119:249}),{29:et,114:250},n(ma,[2,56]),{29:et,114:251},n(y,[2,59]),n(ie,[2,270]),{47:[1,252]},n(R2,[2,150]),n(Xf,[2,428],{240:253}),n(Jo,[2,430],{244:254}),n(Jo,[2,155],{248:255,249:256,250:[2,438],290:[1,257],341:[1,258],342:[1,259],343:[1,260],344:[1,261],345:[1,262],346:[1,263]}),n(Zo,[2,440],{252:264}),n(mr,[2,448],{260:265}),{13:f,16:d,44:136,45:K,55:133,67:132,68:134,77:131,82:q,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,55:133,67:132,68:134,77:131,82:q,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,55:133,67:132,68:134,77:131,82:q,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(mr,[2,167]),n(mr,[2,168]),n(mr,[2,169]),n(mr,[2,170],{176:269,45:O2,89:P2}),n(mr,[2,171]),n(mr,[2,172]),n(mr,[2,173]),n(mr,[2,174]),{13:f,16:d,44:136,45:K,46:272,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Qt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:F2,89:D2,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(rn,[2,192],{292:[1,286],293:[1,287]}),n(rn,[2,195]),n(rn,[2,196]),n(rn,[2,197]),n(rn,[2,198]),n(rn,[2,199]),n(rn,[2,200]),{13:f,16:d,44:39,55:40,82:q,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(Xl,[2,452]),n(Xl,[2,453]),n(Xl,[2,454]),n(Xl,[2,455]),n(Xl,[2,456]),{279:[2,458]},n(Jf,[2,207]),n(Jf,[2,208]),n(Jf,[2,209]),n(Jf,[2,210]),n(rn,[2,201]),n(rn,[2,202]),n(rn,[2,203]),n(rn,[2,204]),n(rn,[2,205]),n(rn,[2,206]),n(e,[2,5]),n(Zf,[2,297],{88:295}),n(ed,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(td,[2,301]),n(Z,[2,43]),n(Z,[2,82]),n(Z,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(eo,[2,123]),n(eo,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(Hi,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:bt,223:312,225:308,226:309,229:N2,307:43,308:p},n(c,i,{215:10,214:314}),n(Hi,[2,236]),n(Hi,[2,237]),n(ec,[2,6]),n(Kg,[2,287],{60:315,72:316,73:[1,317]}),n(At,[2,286]),{13:f,16:d,45:K,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,307:43,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P},n([6,31,63,70,73,81,83,85],[2,20]),n($,L2,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Is,31:Is,85:Is,112:Is,159:Is,160:Is,161:Is,163:Is,164:Is,41:s}),{13:f,16:d,55:331,307:43,308:p},n(D,[2,280]),n(ec,[2,7]),n(At,je,{59:197,69:198,20:332,70:H}),n(Y,[2,284]),{64:[1,333]},n(Y,X,{58:205,62:206,23:334,63:Oe}),n(l,[2,254]),n($,Yf,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:h,139:342,186:339,190:340,195:341,197:to,307:43,308:p},n(Jl,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:d,87:h,197:to,308:p}),n(Cs,[2,227]),n(Cs,[2,228]),n(Cs,[2,229]),{13:f,16:d,44:215,45:at,55:220,82:q,87:h,89:ot,172:221,185:351,187:350,200:348,230:347,231:Cr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:to,307:43,308:p},n(Cs,[2,146]),n(Cs,[2,147]),n(Cs,[2,148]),n(Cs,[2,149]),{13:f,16:d,44:354,55:355,82:q,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:358,312:tn,313:353},n(Yg,[2,215]),n(Yg,[2,216]),n(Y,X,{58:205,62:206,23:359,63:Oe}),n(ee,[2,264]),n(E2,[2,266]),n(ec,[2,11]),n(r,[2,308],{6:[2,310]}),n(Rr,[2,313],{102:360,120:361,121:[1,362]}),n(Rr,[2,47]),n(Rr,[2,63]),n(Rr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(Rr,[2,336]),n(Rr,[2,337]),n(Rr,[2,338]),{109:[1,364]},n(k2,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(D,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(ro,[2,341],{137:368}),n(ro,[2,340]),{13:f,16:d,44:215,45:at,55:220,82:q,87:h,89:ot,145:369,172:221,185:213,187:214,231:Cr,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},{28:[1,370],127:371,128:[1,372]},n(ma,[2,330],{124:373,125:374,126:ft}),n(ma,[2,57]),{44:375,87:h},n(R2,[2,151],{241:376,242:[1,377]}),n(Xf,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:K,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,247:380,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{250:[1,381]},n(Kt,[2,432]),n(Kt,[2,433]),n(Kt,[2,434]),n(Kt,[2,435]),n(Kt,[2,436]),n(Kt,[2,437]),{250:[2,439]},n([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:fe,298:de,299:he,300:ce,301:ye,302:_e}),n(Zo,[2,162],{261:388,262:389,39:Xg,338:Jg}),n(mr,[2,164]),n(mr,[2,165]),n(mr,[2,166]),n(Qt,[2,95]),n(Qt,[2,96]),n(Kt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Qt,[2,177]),{13:f,16:d,44:136,45:K,46:395,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,46:396,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,46:397,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,46:398,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,46:399,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Qt,[2,183]),n(Qt,[2,98]),n(Kt,[2,381],{180:400}),{87:[1,401]},n(Qt,[2,185]),{13:f,16:d,44:136,45:K,46:402,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{29:Q,57:403},n(rn,[2,193]),{13:f,16:d,55:404,307:43,308:p},{13:f,16:d,44:39,55:40,87:h,139:342,195:405,197:to,307:43,308:p},n(ga,[2,233]),n(ga,[2,234]),n(ga,[2,235]),n(j2,[2,459],{281:406,325:[1,407]}),n(Kt,[2,463],{284:408,325:[1,409]}),n(Kt,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:q,171:413,172:415,173:416,174:rd,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:nd},{31:[1,419],89:[1,420]},{29:[1,421]},n(td,[2,302]),n(Zf,[2,367],{167:422}),n(ed,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(td,[2,371]),n(eo,[2,122]),n(eo,[2,417]),n(eo,[2,413]),n(eo,[2,414]),n(eo,[2,415]),n(Hi,[2,125]),n(Hi,[2,127]),n(Hi,[2,128]),n(M2,[2,420],{227:426}),n(Hi,[2,130]),{13:f,16:d,55:194,197:bt,223:427,307:43,308:p},{48:[1,428]},n(ya,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(Kg,[2,288]),{64:[1,433]},n(At,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:d,45:K,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,276:Ye,277:xe,279:Ge,280:Le,283:ze,285:Xe,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P}),n($2,[2,293]),n(Zg,[2,92]),n(Zg,[2,93]),n(Zg,[2,94]),{45:O2,89:P2,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:T,29:C,56:85},{19:438,28:T,29:C,56:85},n(no,[2,355],{149:439}),n(no,[2,354]),{13:f,16:d,44:215,45:id,55:220,82:q,87:h,89:ot,156:440,172:221,185:441,203:442,231:sd,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(ee,[2,19]),n(ya,[2,21]),{13:f,16:d,44:450,45:V2,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,307:43,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P},n(ec,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n($,[2,386],{31:[2,388]}),n(Jl,[2,102]),n(io,[2,391],{191:452}),n($,[2,395],{196:453,198:454}),n($,[2,108]),n($,[2,109]),n(Jl,[2,103]),n(Jl,[2,104]),n(Jl,[2,390]),{13:f,16:d,44:215,45:at,48:[1,455],55:220,82:q,87:h,89:ot,172:221,185:351,187:350,200:456,231:Cr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(ad,[2,424]),n(B2,[2,136]),n(B2,[2,137]),n(ey,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:to,307:43,308:p},n(ga,[2,219]),n(ga,[2,220]),n(ga,[2,221]),n(ga,[2,222]),n(ga,[2,223]),n(ec,[2,10]),n(Rr,[2,46]),n(Rr,[2,314]),{112:T2,122:459},n(Rr,[2,62]),n(D,A2,{133:242,108:460,112:x2,132:I2}),n(k2,[2,61]),n(Rr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(ro,[2,351],{146:463,335:[1,464]}),{29:Q,57:465},n(ma,[2,329]),n(D,[2,332],{129:466,327:[1,467]}),n(ma,[2,55]),n(ma,[2,331]),{48:[1,468]},n(Xf,[2,429]),{13:f,16:d,44:136,45:K,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Jo,[2,431]),{13:f,16:d,44:136,45:K,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,243:470,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Jo,[2,156]),{45:F2,89:D2,179:471},n(Zo,[2,441]),{13:f,16:d,44:136,45:K,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,251:472,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(mr,[2,444],{256:473}),n(mr,[2,446],{258:474}),n(Kt,[2,442]),n(Kt,[2,443]),n(mr,[2,449]),{13:f,16:d,44:136,45:K,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,255:154,257:155,259:475,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Kt,[2,450]),n(Kt,[2,451]),n(Kt,[2,379],{178:476}),n(Kt,[2,378]),n([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:f,16:d,44:136,45:K,46:482,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{48:[1,483]},{48:[1,484]},n(Qt,[2,187]),n(rn,[2,194]),{13:f,16:d,44:39,55:40,82:q,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,320:485},{13:f,16:d,39:[1,487],44:136,45:K,46:488,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,282:486,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(j2,[2,460]),{13:f,16:d,44:136,45:K,46:489,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Kt,[2,464]),{13:f,16:d,44:136,45:K,46:490,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Kt,[2,466]),n(Z,[2,40]),n(Zf,[2,298]),n(Zl,[2,87]),n(Zl,[2,88]),n(Zl,[2,89]),n(Zl,[2,90]),{13:f,16:d,55:492,82:q,172:493,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,311:494,312:tn,315:491},n(Z,[2,41]),n(ed,[2,300]),n(eu,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:q,171:497,172:415,173:416,174:rd,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:nd},{31:[1,498],89:[1,499]},{29:[1,500]},n(td,[2,372]),{13:f,16:d,48:[2,422],55:194,197:bt,223:312,226:502,228:501,229:N2,307:43,308:p},n(Hi,[2,131]),n(Hi,[2,126]),n(ya,[2,22]),n(ya,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:K,55:323,67:321,68:322,74:505,75:506,76:U2,77:320,78:q2,79:509,87:h,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,307:43,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P},n($2,[2,294]),n(W2,[2,69]),n(W2,[2,70]),n(At,je,{59:197,69:198,20:511,70:H}),n(Y,X,{58:205,62:206,23:512,63:Oe}),{29:[2,375],31:[2,71],84:522,85:a,112:[1,518],150:513,151:514,158:515,159:[1,516],160:[1,517],161:[1,519],163:[1,520],164:[1,521],175:523},n(no,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:h}),n(od,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),{13:f,16:d,44:215,45:id,55:220,82:q,87:h,89:ot,172:221,185:351,203:536,212:534,231:sd,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(Y,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:d,45:V2,87:h,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,276:Ye,277:xe,279:Ge,280:Le,283:ze,285:Xe,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P}),n(so,[2,291]),n(so,[2,24]),n(so,[2,25]),{13:f,16:d,44:136,45:K,46:539,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(so,[2,28]),n(Y,X,{58:205,62:206,23:540,63:Oe}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(io,[2,107]),{13:f,16:d,44:215,45:at,55:220,82:q,87:h,89:ot,172:221,185:351,187:350,199:543,200:544,231:Cr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(G2,[2,132]),n(ad,[2,425]),n(G2,[2,133]),{13:f,16:d,44:354,55:355,82:q,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:358,312:tn,313:545},n(Rr,[2,54]),n(Rr,[2,48]),n(ro,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(ro,[2,68]),n($,[2,350],{31:z2,112:z2}),n(Rr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(D,[2,333]),n(ie,[2,16]),n(Xf,[2,152]),n(Jo,[2,154]),n(Jo,[2,157]),n(Zo,[2,159]),n(Zo,[2,160],{262:389,261:548,39:Xg,338:Jg}),n(Zo,[2,161],{262:389,261:549,39:Xg,338:Jg}),n(mr,[2,163]),{13:f,16:d,44:136,45:K,46:550,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Qt,[2,178]),n(Qt,[2,179]),{13:f,16:d,44:136,45:K,46:551,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,46:552,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,46:553,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{48:[1,554],272:[1,555]},n(Qt,[2,184]),n(Qt,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:f,16:d,55:194,197:bt,223:562,307:43,308:p},n(ty,[2,224]),n(ty,[2,225]),n(ty,[2,226]),{31:[1,563],45:H2,94:564},n(Z,[2,84]),n(Zf,[2,368]),n(Z,[2,85]),n(ed,[2,370]),n(eu,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(ya,[2,35],{83:[1,569]}),n(ya,[2,36],{81:[1,570]}),n(Kg,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:f,16:d,45:K,76:U2,78:q2,87:h,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,276:Ye,277:xe,279:Ge,280:Le,283:ze,285:Xe,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P}),n(tc,[2,295]),{45:K,77:572},{45:K,77:573},n(tc,[2,33]),n(tc,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(no,[2,356]),n(Q2,[2,357],{152:578,335:[1,579]}),n(Rs,[2,74]),{29:Q,57:580},{29:Q,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(K2,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:K,55:323,67:321,68:322,77:320,79:585,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,307:43,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P},{45:[1,586]},n(Rs,[2,81]),{29:Q,57:587},n(no,[2,73]),n($,[2,362],{29:Os,31:Os,85:Os,112:Os,159:Os,160:Os,161:Os,163:Os,164:Os}),n(od,[2,112]),n(rc,[2,401],{206:588}),n($,[2,405],{209:589,210:590}),n($,[2,403]),n($,[2,404]),n(od,[2,113]),n(od,[2,400]),{13:f,16:d,44:215,45:id,48:[1,591],55:220,82:q,87:h,89:ot,172:221,185:351,203:536,212:592,231:sd,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(ad,[2,426]),n(ey,[2,138]),n(ey,[2,139]),{232:[1,593]},n(so,[2,292]),{47:[1,595],48:[1,594]},n(ec,[2,9]),n(io,[2,392]),n(io,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:to,308:p}),n(io,[2,110],{272:[1,598]}),n(cd,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(ma,[2,58]),n(mr,[2,445]),n(mr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Qt,[2,99]),n(Kt,[2,382]),n([13,16,39,47,48,87,193,197,242,246,250,263,265,272,290,297,298,299,300,301,302,308,314,338,341,342,343,344,345,346],[2,232]),n(Qt,[2,188]),n(Qt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:q,172:493,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,311:494,312:tn,315:611},n(Z,[2,42]),n(eu,[2,304]),{13:f,16:d,55:414,82:q,95:612,171:613,172:415,173:416,174:rd,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:nd},{31:[1,614],45:H2,94:615},n(Hi,[2,129]),n(M2,[2,421]),{82:[1,616]},{82:[1,617]},n(tc,[2,296]),n(tc,[2,31]),n(tc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n($,L2,{155:330,153:618,154:619,29:Ps,31:Ps,85:Ps,112:Ps,159:Ps,160:Ps,161:Ps,163:Ps,164:Ps}),n(Q2,[2,358]),n(Rs,[2,75]),n(Rs,[2,76]),{29:Q,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(K2,[2,366]),n(Rs,[2,79]),{13:f,16:d,44:136,45:K,46:622,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Rs,[2,91],{336:[1,623]}),n([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),n(rc,[2,117]),{13:f,16:d,44:215,45:id,55:220,82:q,87:h,89:ot,172:221,185:351,203:536,211:626,212:627,231:sd,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(Cs,[2,134]),n(ad,[2,427]),n(Cs,[2,135]),n(so,[2,26]),{44:628,87:h},n(io,[2,106]),n(io,[2,394]),n($,[2,396]),n(cd,[2,111]),n(cd,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:to,307:43,308:p},n(Yg,[2,217]),n($,Yf,{144:248,140:630,143:631,31:[2,343]}),n(Qt,[2,97]),n(Kt,[2,380]),n(Qt,[2,180]),{13:f,16:d,44:136,45:K,46:632,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:K,46:633,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:st,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:nt,264:130,265:z,266:137,267:139,268:Ne,269:He,270:re,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Qt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:q,171:637,172:415,173:416,174:rd,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:ae,306:we,307:43,308:p,312:nd},n(Y2,[2,305]),n(Z,[2,86]),n(eu,[2,374]),n(ya,[2,37]),n(ya,[2,38]),n(no,[2,72]),n(no,[2,360]),n(Rs,[2,77]),{29:Q,57:638},{47:[1,639]},{29:[2,376]},n(rc,[2,402]),n(rc,[2,115],{215:10,208:528,214:529,44:530,205:640,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),n(rc,[2,118],{272:[1,641]}),n(ld,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:be,304:Se,305:ae,306:we},n(Zl,[2,218]),n(eu,[2,44]),n(Y2,[2,306]),n(Rs,[2,78]),{44:651,87:h},n(rc,[2,116]),n($,[2,406]),n(ld,[2,119]),n(ld,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(so,[2,27]),n(cd,[2,230]),n(X2,[2,345],{141:653,335:[1,654]}),n(Qt,[2,181]),n(Qt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n($,Yf,{144:248,142:657,143:658,31:J2,112:J2}),n(X2,[2,346]),n(Rs,[2,80]),n(ld,[2,231]),n(ro,[2,67]),n(ro,[2,348])],defaultActions:{5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]},parseError:o(function(I,O){if(O.recoverable)this.trace(I);else{var N=new Error(I);throw N.hash=O,N}},"parseError"),parse:o(function(I){var O=this,N=[0],ne=[],ke=[null],g=[],sn=this.table,_="",Yi=0,iu=0,hd=0,pd=2,su=1,md=g.slice.call(arguments,1),jt=Object.create(this.lexer),Xi={yy:{}};for(var au in this.yy)Object.prototype.hasOwnProperty.call(this.yy,au)&&(Xi.yy[au]=this.yy[au]);jt.setInput(I,Xi.yy),Xi.yy.lexer=jt,Xi.yy.parser=this,typeof jt.yylloc>"u"&&(jt.yylloc={});var oc=jt.yylloc;g.push(oc);var St=jt.options&&jt.options.ranges;typeof Xi.yy.parseError=="function"?this.parseError=Xi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Dt(Ji){N.length=N.length-2*Ji,ke.length=ke.length-Ji,g.length=g.length-Ji}o(Dt,"popStack");for(var ct=o(function(){var Ji;return Ji=jt.lex()||su,typeof Ji!="number"&&(Ji=O.symbols_[Ji]||Ji),Ji},"lex"),dt,En,lo,Hn,BX,py,cc={},gd,Ns,uE,yd;;){if(lo=N[N.length-1],this.defaultActions[lo]?Hn=this.defaultActions[lo]:((dt===null||typeof dt>"u")&&(dt=ct()),Hn=sn[lo]&&sn[lo][dt]),typeof Hn>"u"||!Hn.length||!Hn[0]){var my="";yd=[];for(gd in sn[lo])this.terminals_[gd]&&gd>pd&&yd.push("'"+this.terminals_[gd]+"'");jt.showPosition?my="Parse error on line "+(Yi+1)+`:
|
|
33
|
+
`)}o(K4,"composeErrorMessage");function Y4(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=Q4(r,e);return K4(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(Y4,"formatErrorCtor");ah.formatErrorCtor=Y4});var FT=b(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.isDisposable=void 0;function X4(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(X4,"isDisposable");oh.isDisposable=X4});var NT=b(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.PostResolutionInterceptors=wo.PreResolutionInterceptors=void 0;var DT=$0(),ch=class extends DT.default{static{o(this,"PreResolutionInterceptors")}};wo.PreResolutionInterceptors=ch;var lh=class extends DT.default{static{o(this,"PostResolutionInterceptors")}};wo.PostResolutionInterceptors=lh;var G0=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new ch,this.postResolution=new lh}};wo.default=G0});var wa=b(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.instance=Vs.typeInfo=void 0;var J4=(Xd(),_d(Yd)),cn=k0(),Z4=RT(),uh=rh(),ej=OT(),xn=O0(),fh=PT(),tj=W0(),rj=th(),nj=FT(),ij=NT();Vs.typeInfo=new Map;var z0=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new ej.default,this.interceptors=new ij.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:xn.default.Transient}){this.ensureNotDisposed();let i;if(Z4.isProvider(t)?i=t:i={useClass:t},cn.isTokenProvider(i)){let s=[e],a=i;for(;a!=null;){let c=a.useToken;if(s.includes(c))throw new Error(`Token registration cycle detected! ${[...s,c].join(" -> ")}`);s.push(c);let l=this._registry.get(c);l&&cn.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===xn.default.Singleton||r.lifecycle==xn.default.ContainerScoped||r.lifecycle==xn.default.ResolutionScoped)&&(cn.isValueProvider(i)||cn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${xn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),cn.isNormalToken(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})}registerInstance(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})}registerSingleton(e,t){if(this.ensureNotDisposed(),cn.isNormalToken(e)){if(cn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:xn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:xn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!cn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:xn.default.Singleton})}resolve(e,t=new fh.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&cn.isNormalToken(e)){if(r)return;throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"Single"),i){let s=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,s,"Single"),s}if(uh.isConstructorToken(e)){let s=this.construct(e,t);return this.executePostResolutionInterceptor(e,s,"Single"),s}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")}executePreResolutionInterceptor(e,t){if(this.interceptors.preResolution.has(e)){let r=[];for(let i of this.interceptors.preResolution.getAll(e))i.options.frequency!="Once"&&r.push(i),i.callback(e,t);this.interceptors.preResolution.setAll(e,r)}}executePostResolutionInterceptor(e,t,r){if(this.interceptors.postResolution.has(e)){let i=[];for(let s of this.interceptors.postResolution.getAll(e))s.options.frequency!="Once"&&i.push(s),s.callback(e,t,r);this.interceptors.postResolution.setAll(e,i)}}resolveRegistration(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===xn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===xn.default.Singleton,i=e.options.lifecycle===xn.default.ContainerScoped,s=r||i,a;return cn.isValueProvider(e.provider)?a=e.provider.useValue:cn.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):cn.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):cn.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===xn.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new fh.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&cn.isNormalToken(e)){if(r)return[];throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"All"),i){let a=i.map(c=>this.resolveRegistration(c,t));return this.executePostResolutionInterceptor(e,a,"All"),a}let s=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,s,"All"),s}isRegistered(e,t=!1){return this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)}reset(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()}clearInstances(){this.ensureNotDisposed();for(let[e,t]of this._registry.entries())this._registry.setAll(e,t.filter(r=>!cn.isValueProvider(r.provider)).map(r=>(r.instance=void 0,r)))}createChildContainer(){this.ensureNotDisposed();let e=new n(this);for(let[t,r]of this._registry.entries())r.some(({options:i})=>i.lifecycle===xn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===xn.default.ContainerScoped?{provider:i.provider,options:i.options}:i));return e}beforeResolution(e,t,r={frequency:"Always"}){this.interceptors.preResolution.set(e,{callback:t,options:r})}afterResolution(e,t,r={frequency:"Always"}){this.interceptors.postResolution.set(e,{callback:t,options:r})}dispose(){return J4.__awaiter(this,void 0,void 0,function*(){this.disposed=!0;let e=[];this.disposables.forEach(t=>{let r=t.dispose();r&&e.push(r)}),yield Promise.all(e)})}getRegistration(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null}getAllRegistrations(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null}construct(e,t){if(e instanceof rj.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Vs.typeInfo.get(e);if(!i||i.length===0){if(e.length===0)return new e;throw new Error(`TypeInfo not known for "${e.name}"`)}let s=i.map(this.resolveParams(t,e));return new e(...s)})();return nj.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return uh.isTokenDescriptor(r)?uh.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new fh.default,r.isOptional),...r.transformArgs):this.resolve(r.transform).transform(this.resolve(r.token,e,r.isOptional),...r.transformArgs):r.multiple?this.resolveAll(r.token,new fh.default,r.isOptional):this.resolve(r.token,e,r.isOptional):uh.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(tj.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Vs.instance=new z0;Vs.default=Vs.instance});var LT=b(Q0=>{"use strict";Object.defineProperty(Q0,"__esModule",{value:!0});var sj=bo(),Bs=wa(),H0=rh(),aj=W0();function oj(){return function(n){let e=sj.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return H0.isTokenDescriptor(r)?H0.isTransformDescriptor(r)?r.multiple?Bs.instance.resolve(r.transform).transform(Bs.instance.resolveAll(r.token),...r.transformArgs):Bs.instance.resolve(r.transform).transform(Bs.instance.resolve(r.token),...r.transformArgs):r.multiple?Bs.instance.resolveAll(r.token):Bs.instance.resolve(r.token):H0.isTransformDescriptor(r)?Bs.instance.resolve(r.transform).transform(Bs.instance.resolve(r.token),...r.transformArgs):Bs.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(aj.formatErrorCtor(n,a,s))}})))}}}}o(oj,"autoInjectable");Q0.default=oj});var kT=b(K0=>{"use strict";Object.defineProperty(K0,"__esModule",{value:!0});var cj=bo();function lj(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return cj.defineInjectionTokenMetadata(t)}o(lj,"inject");K0.default=lj});var dh=b(Y0=>{"use strict";Object.defineProperty(Y0,"__esModule",{value:!0});var uj=bo(),fj=wa(),jT=wa();function dj(n){return function(e){fj.typeInfo.set(e,uj.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{jT.instance.register(t,e)}):jT.instance.register(n.token,e))}}o(dj,"injectable");Y0.default=dj});var MT=b(X0=>{"use strict";Object.defineProperty(X0,"__esModule",{value:!0});var hj=(Xd(),_d(Yd)),pj=wa();function mj(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=hj.__rest(t,["token","options"]);return pj.instance.register(r,s,i)}),e}}o(mj,"registry");X0.default=mj});var $T=b(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});var gj=dh(),yj=wa();function _j(){return function(n){gj.default()(n),yj.instance.registerSingleton(n)}}o(_j,"singleton");J0.default=_j});var VT=b(Z0=>{"use strict";Object.defineProperty(Z0,"__esModule",{value:!0});var bj=bo();function Sj(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return bj.defineInjectionTokenMetadata(t)}o(Sj,"injectAll");Z0.default=Sj});var BT=b(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var wj=bo();function vj(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return wj.defineInjectionTokenMetadata(r)}o(vj,"injectAllWithTransform");e_.default=vj});var UT=b(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var Ej=bo();function Tj(n,e,...t){return Ej.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(Tj,"injectWithTransform");t_.default=Tj});var qT=b(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var Aj=dh(),xj=wa();function Ij(n,e){return function(t){Aj.default()(t),xj.instance.register(e||t,t,{lifecycle:n})}}o(Ij,"scoped");r_.default=Ij});var WT=b(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});var Cj=LT();Object.defineProperty(hi,"autoInjectable",{enumerable:!0,get:o(function(){return Cj.default},"get")});var Rj=kT();Object.defineProperty(hi,"inject",{enumerable:!0,get:o(function(){return Rj.default},"get")});var Oj=dh();Object.defineProperty(hi,"injectable",{enumerable:!0,get:o(function(){return Oj.default},"get")});var Pj=MT();Object.defineProperty(hi,"registry",{enumerable:!0,get:o(function(){return Pj.default},"get")});var Fj=$T();Object.defineProperty(hi,"singleton",{enumerable:!0,get:o(function(){return Fj.default},"get")});var Dj=VT();Object.defineProperty(hi,"injectAll",{enumerable:!0,get:o(function(){return Dj.default},"get")});var Nj=BT();Object.defineProperty(hi,"injectAllWithTransform",{enumerable:!0,get:o(function(){return Nj.default},"get")});var Lj=UT();Object.defineProperty(hi,"injectWithTransform",{enumerable:!0,get:o(function(){return Lj.default},"get")});var kj=qT();Object.defineProperty(hi,"scoped",{enumerable:!0,get:o(function(){return kj.default},"get")})});var GT=b(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});function jj(n){let e;return t=>(e==null&&(e=n(t)),e)}o(jj,"instanceCachingFactory");n_.default=jj});var zT=b(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});function Mj(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(Mj,"instancePerContainerCachingFactory");i_.default=Mj});var HT=b(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});function $j(n,e,t,r=!0){let i,s;return a=>{let c=n(a);return(!r||s!==c)&&((s=c)?i=a.resolve(e):i=a.resolve(t)),i}}o($j,"predicateAwareClassFactory");s_.default=$j});var QT=b(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});var Vj=GT();Object.defineProperty(xu,"instanceCachingFactory",{enumerable:!0,get:o(function(){return Vj.default},"get")});var Bj=zT();Object.defineProperty(xu,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return Bj.default},"get")});var Uj=HT();Object.defineProperty(xu,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return Uj.default},"get")})});var Ce=b(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var a_=(Xd(),_d(Yd));if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var qj=CT();Object.defineProperty(va,"Lifecycle",{enumerable:!0,get:o(function(){return qj.Lifecycle},"get")});a_.__exportStar(WT(),va);a_.__exportStar(QT(),va);a_.__exportStar(k0(),va);var Wj=th();Object.defineProperty(va,"delay",{enumerable:!0,get:o(function(){return Wj.delay},"get")});var Gj=wa();Object.defineProperty(va,"container",{enumerable:!0,get:o(function(){return Gj.instance},"get")})});var pc=b(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});hh.NullLogger=void 0;hh.NullLogger={debug(){},info(){},warn(){},error(){}}});var o_=b((Ete,KT)=>{var mc=class{static{o(this,"Wildcard")}constructor(){return zj||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(mc.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(mc.prototype,"termType",{enumerable:!0,value:"Wildcard"});var zj=new mc;KT.exports.Wildcard=mc});var XT=b((Ate,YT)=>{var Hj=(function(){var n=o(function(R,I,O,N){for(O=O||{},N=R.length;N--;O[R[N]]=I);return O},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],y=[123,126],S=[1,67],v=[39,45,87],w=[13,16,45,197,224,308],T=[1,87],C=[2,281],L=[1,86],$=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],ee=[6,28,29,53,63,70,73,81,83,85],B=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],G=[6,13,16,28,29,45,53,63,70,73,81,82,83,85,87,89,197,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314],F=[6,13,16,28,29,31,39,45,47,48,53,63,70,73,81,82,83,85,87,89,109,112,121,123,126,128,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,337,338,340,341,342,343,344,345,346],D=[13,16,308],W=[112,132,327,334],De=[13,16,112,132,308],et=[1,111],ut=[1,117],ae=[112,132,327,328,334],Ze=[13,16,112,132,308,328],ie=[28,29,45,53,87],Z=[1,138],q=[1,151],tt=[1,128],st=[1,127],Q=[1,129],Ne=[1,140],He=[1,141],te=[1,142],Qe=[1,143],Ke=[1,144],We=[1,145],Ye=[1,147],xe=[1,148],Ge=[2,457],Le=[1,158],ze=[1,159],Xe=[1,160],ue=[1,152],me=[1,153],ge=[1,156],fe=[1,171],de=[1,172],he=[1,173],ce=[1,174],ye=[1,175],_e=[1,176],be=[1,167],Se=[1,168],se=[1,169],we=[1,170],it=[1,157],Je=[1,166],qe=[1,161],E=[1,162],A=[1,163],x=[1,164],P=[1,165],J=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],bt=[1,195],At=[6,31,73,81,83,85],je=[2,285],z=[1,199],H=[1,201],K=[6,31,70,73,81,83,85],Y=[2,283],Re=[1,207],at=[1,218],ot=[1,223],Cr=[1,219],vn=[1,225],kn=[1,226],tn=[1,224],E2=[6,63,70,73,81,83,85],T2=[1,236],A2=[2,334],x2=[1,243],I2=[1,241],Rr=[6,193],Yf=[2,349],C2=[2,339],ma=[28,128],R2=[47,48,193,272],Xf=[47,48,193,242,272],Jo=[47,48,193,242,246,272],Zo=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],mr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],O2=[1,271],P2=[1,270],Qt=[6,13,16,29,31,39,45,47,48,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],F2=[1,281],D2=[1,280],rn=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],Xl=[45,89],Jf=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],Zf=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],ed=[31,89],td=[48,87],eo=[6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338],Hi=[6,13,16,39,45,48,82,87,89,231,263,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338,340],N2=[1,313],ec=[6,85],Kg=[6,31,81,83,85],L2=[2,361],Is=[2,353],to=[1,343],Jl=[31,112,335],Cs=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Yg=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335],k2=[6,109,193],ro=[31,112],Kt=[13,16,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],Xg=[1,390],Jg=[1,391],ga=[13,16,87,197,308,314],j2=[13,16,39,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],rd=[1,417],nd=[1,418],M2=[13,16,48,197,229,308],ya=[6,31,85],$2=[6,13,16,31,45,73,81,83,85,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],Zg=[6,13,16,29,31,45,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,231,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,346,347,348,349,350,351],no=[29,31,85,112,159,160,161,163,164],id=[1,443],sd=[1,444],V2=[1,449],io=[31,112,193,232,318,335],ad=[13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],B2=[13,16,31,45,48,82,87,89,112,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],ey=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Zl=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],eu=[31,45],U2=[1,507],q2=[1,508],W2=[6,13,16,29,31,39,45,47,48,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,336,338,341,342,343,344,345,346,347,348,349,350,351],od=[29,31,85,112,159,160,161,163,164,335],so=[6,13,16,31,45,70,73,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],G2=[13,16,31,45,48,82,87,89,112,193,197,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],z2=[2,352],ty=[13,16,197,308,314],H2=[1,565],tc=[6,13,16,31,45,76,78,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],Q2=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Rs=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],K2=[13,16,87,308],Os=[2,364],rc=[29,31,85,112,159,160,161,163,164,193,232,318,335],cd=[31,112,193,232,272,318,335],Ps=[2,359],Y2=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],ld=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],X2=[13,16,31,45,82,87,89,112,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],J2=[2,347],ry={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Query:7,Qry:8,Query_option0:9,Prologue_repetition0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectClauseWildcard:17,Qry_repetition0:18,WhereClause:19,SolutionModifierNoGroup:20,SelectClauseVars:21,Qry_repetition1:22,SolutionModifier:23,CONSTRUCT:24,ConstructTemplate:25,Qry_repetition2:26,Qry_repetition3:27,WHERE:28,"{":29,Qry_option0:30,"}":31,DESCRIBE:32,Qry_group0:33,Qry_repetition4:34,Qry_option1:35,ASK:36,Qry_repetition5:37,SelectClauseBase:38,"*":39,SelectClauseVars_repetition_plus0:40,SELECT:41,SelectClauseBase_option0:42,SelectClauseItem:43,Var:44,"(":45,Expression:46,AS:47,")":48,SubSelect:49,SubSelect_option0:50,SubSelect_option1:51,DatasetClause:52,FROM:53,DatasetClause_option0:54,iri:55,WhereClause_option0:56,GroupGraphPattern:57,SolutionModifier_option0:58,SolutionModifierNoGroup_option0:59,SolutionModifierNoGroup_option1:60,SolutionModifierNoGroup_option2:61,GroupClause:62,GROUP:63,BY:64,GroupClause_repetition_plus0:65,GroupCondition:66,BuiltInCall:67,FunctionCall:68,HavingClause:69,HAVING:70,HavingClause_repetition_plus0:71,OrderClause:72,ORDER:73,OrderClause_repetition_plus0:74,OrderCondition:75,ASC:76,BrackettedExpression:77,DESC:78,Constraint:79,LimitOffsetClauses:80,LIMIT:81,INTEGER:82,OFFSET:83,ValuesClause:84,VALUES:85,InlineData:86,VAR:87,InlineData_repetition0:88,NIL:89,InlineData_repetition1:90,InlineData_repetition_plus2:91,InlineData_repetition3:92,DataBlock:93,DataBlockValueList:94,DataBlockValueList_repetition_plus0:95,Update:96,Update_repetition0:97,Update1:98,Update_option0:99,LOAD:100,Update1_option0:101,Update1_option1:102,Update1_group0:103,Update1_option2:104,GraphRefAll:105,Update1_group1:106,Update1_option3:107,GraphOrDefault:108,TO:109,CREATE:110,Update1_option4:111,GRAPH:112,INSERTDATA:113,QuadPattern:114,DELETEDATA:115,DELETEWHERE:116,Update1_option5:117,InsertDeleteClause:118,Update1_repetition0:119,IntoGraphClause:120,INTO:121,GraphRef:122,DELETE:123,InsertDeleteClause_option0:124,InsertClause:125,INSERT:126,UsingClause:127,USING:128,UsingClause_option0:129,WithClause:130,WITH:131,DEFAULT:132,GraphOrDefault_option0:133,GraphRefAll_group0:134,Quads:135,Quads_option0:136,Quads_repetition0:137,QuadsNotTriples:138,VarOrIri:139,QuadsNotTriples_option0:140,QuadsNotTriples_option1:141,QuadsNotTriples_option2:142,TriplesTemplate:143,TriplesTemplate_repetition0:144,TriplesSameSubject:145,TriplesTemplate_option0:146,GroupGraphPatternSub:147,GroupGraphPatternSub_option0:148,GroupGraphPatternSub_repetition0:149,GroupGraphPatternSubTail:150,GraphPatternNotTriples:151,GroupGraphPatternSubTail_option0:152,GroupGraphPatternSubTail_option1:153,TriplesBlock:154,TriplesBlock_repetition0:155,TriplesSameSubjectPath:156,TriplesBlock_option0:157,GroupOrUnionGraphPattern:158,OPTIONAL:159,MINUS:160,SERVICE:161,GraphPatternNotTriples_option0:162,FILTER:163,BIND:164,InlineDataOneVar:165,InlineDataFull:166,InlineDataOneVar_repetition0:167,InlineDataFull_repetition0:168,InlineDataFull_repetition_plus1:169,InlineDataFull_repetition2:170,DataBlockValue:171,Literal:172,QuotedTriple:173,UNDEF:174,GroupOrUnionGraphPattern_repetition0:175,ArgList:176,ArgList_option0:177,ArgList_repetition0:178,ExpressionList:179,ExpressionList_repetition0:180,ConstructTemplate_option0:181,ConstructTriples:182,ConstructTriples_repetition0:183,ConstructTriples_option0:184,VarOrTermOrQuotedTP:185,PropertyListNotEmpty:186,TriplesNode:187,PropertyList:188,PropertyList_option0:189,VerbObjectList:190,PropertyListNotEmpty_repetition0:191,SemiOptionalVerbObjectList:192,";":193,SemiOptionalVerbObjectList_option0:194,Verb:195,ObjectList:196,a:197,ObjectList_repetition0:198,Object:199,GraphNode:200,Object_option0:201,PropertyListPathNotEmpty:202,TriplesNodePath:203,TriplesSameSubjectPath_option0:204,O:205,PropertyListPathNotEmpty_repetition0:206,PropertyListPathNotEmptyTail:207,O_group0:208,ObjectListPath:209,ObjectListPath_repetition0:210,ObjectPath:211,GraphNodePath:212,ObjectPath_option0:213,Path:214,Path_repetition0:215,PathSequence:216,PathSequence_repetition0:217,PathEltOrInverse:218,PathElt:219,PathPrimary:220,PathElt_option0:221,PathEltOrInverse_option0:222,IriOrA:223,"!":224,PathNegatedPropertySet:225,PathOneInPropertySet:226,PathNegatedPropertySet_repetition0:227,PathNegatedPropertySet_option0:228,"^":229,TriplesNode_repetition_plus0:230,"[":231,"]":232,TriplesNodePath_repetition_plus0:233,VarOrTermOrQuotedTPExpr:234,VarOrTerm:235,GraphTerm:236,BlankNode:237,ConditionalOrExpression:238,ConditionalAndExpression:239,ConditionalOrExpression_repetition0:240,ConditionalOrExpressionTail:241,"||":242,RelationalExpression:243,ConditionalAndExpression_repetition0:244,ConditionalAndExpressionTail:245,"&&":246,NumericExpression:247,RelationalExpression_group0:248,RelationalExpression_option0:249,IN:250,MultiplicativeExpression:251,NumericExpression_repetition0:252,AdditiveExpressionTail:253,AdditiveExpressionTail_group0:254,NumericLiteralPositive:255,AdditiveExpressionTail_repetition0:256,NumericLiteralNegative:257,AdditiveExpressionTail_repetition1:258,UnaryExpression:259,MultiplicativeExpression_repetition0:260,MultiplicativeExpressionTail:261,MultiplicativeExpressionTail_group0:262,"+":263,PrimaryExpression:264,"-":265,ExprQuotedTP:266,Aggregate:267,FUNC_ARITY0:268,FUNC_ARITY1:269,FUNC_ARITY1_SPARQL_STAR:270,FUNC_ARITY2:271,",":272,FUNC_ARITY3:273,FUNC_ARITY3_SPARQL_STAR:274,BuiltInCall_group0:275,BOUND:276,BNODE:277,BuiltInCall_option0:278,EXISTS:279,COUNT:280,Aggregate_option0:281,Aggregate_group0:282,FUNC_AGGREGATE:283,Aggregate_option1:284,GROUP_CONCAT:285,Aggregate_option2:286,Aggregate_option3:287,GroupConcatSeparator:288,SEPARATOR:289,"=":290,String:291,LANGTAG:292,"^^":293,DECIMAL:294,DOUBLE:295,BOOLEAN:296,INTEGER_POSITIVE:297,DECIMAL_POSITIVE:298,DOUBLE_POSITIVE:299,INTEGER_NEGATIVE:300,DECIMAL_NEGATIVE:301,DOUBLE_NEGATIVE:302,STRING_LITERAL1:303,STRING_LITERAL2:304,STRING_LITERAL_LONG1:305,STRING_LITERAL_LONG2:306,PrefixedName:307,PNAME_LN:308,BLANK_NODE_LABEL:309,ANON:310,QuotedTP:311,"<<":312,qtSubjectOrObject:313,">>":314,DataValueTerm:315,AnnotationPattern:316,"{|":317,"|}":318,AnnotationPatternPath:319,ExprVarOrTerm:320,QueryOrUpdate_group0_option0:321,Prologue_repetition0_group0:322,Qry_group0_repetition_plus0:323,SelectClauseBase_option0_group0:324,DISTINCT:325,REDUCED:326,NAMED:327,SILENT:328,CLEAR:329,DROP:330,ADD:331,MOVE:332,COPY:333,ALL:334,".":335,UNION:336,"|":337,"/":338,PathElt_option0_group0:339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,NOT:346,CONCAT:347,COALESCE:348,SUBSTR:349,REGEX:350,REPLACE:351,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"},productions_:[0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]],performAction:o(function(I,O,N,re,ke,g,sn){var _=g.length-1;switch(ke){case 1:if(g[_-1]=g[_-1]||{},Ve.base&&(g[_-1].base=Ve.base),Ve.base="",g[_-1].prefixes=Ve.prefixes,Ve.prefixes=null,Ve.pathOnly){if(g[_-1].type==="path"||"termType"in g[_-1])return g[_-1];throw new Error("Received full SPARQL query in path only mode")}else if(g[_-1].type==="path"||"termType"in g[_-1])throw new Error("Received only path in full SPARQL mode");if(g[_-1].type==="update"){let St={};for(let Dt of g[_-1].updates)if(Dt.updateType==="insert"){let ct={};for(let dt of Dt.insert)if(dt.type==="bgp"||dt.type==="graph")for(let En of dt.triples)En.subject.termType==="BlankNode"&&(ct[En.subject.value]=!0),En.predicate.termType==="BlankNode"&&(ct[En.predicate.value]=!0),En.object.termType==="BlankNode"&&(ct[En.object.value]=!0);for(let dt of Object.keys(ct)){if(St[dt])throw new Error("Detected reuse blank node across different INSERT DATA clauses");St[dt]=!0}}}return g[_-1];case 2:this.$={...g[_-1],...g[_],type:"query"};break;case 4:Ve.base=tu(g[_]);break;case 5:Ve.prefixes||(Ve.prefixes={}),g[_-1]=g[_-1].substr(0,g[_-1].length-1),g[_]=tu(g[_]),Ve.prefixes[g[_-1]]=g[_];break;case 6:this.$={...g[_-3],...co(g[_-2]),...g[_-1],...g[_]};break;case 7:if(!Ve.skipValidation&&(uy(g[_-3].variables.map(Dt=>ly(Dt.expression))).some(Dt=>Dt.aggregation==="count"&&!(Dt.expression instanceof ud))||g[_].group)){for(let Dt of g[_-3].variables)if(Dt.termType==="Variable"){if(!g[_].group||!g[_].group.map(ct=>ac(ct)).includes(ac(Dt)))throw Error("Projection of ungrouped variable (?"+ac(Dt)+")")}else if(ly(Dt.expression).length===0){let ct=rN(Dt.expression);for(let dt of ct)if(!g[_].group||!g[_].group.map||!g[_].group.map(En=>ac(En)).includes(ac(dt)))throw Error("Use of ungrouped variable in projection of operation (?"+ac(dt)+")")}}let Xi=g[_-1].where.filter(St=>St.type==="query");if(Xi.length>0){let St=g[_-3].variables.filter(ct=>ct.variable&&ct.variable.value).map(ct=>ct.variable.value),Dt=uy(Xi.map(ct=>ct.variables)).map(ct=>ct.value||ct.variable.value);for(let ct of St)if(Dt.indexOf(ct)>=0)throw Error("Target id of 'AS' (?"+ct+") already used in subquery")}this.$=qt(g[_-3],co(g[_-2]),g[_-1],g[_]);break;case 8:this.$=qt({queryType:"CONSTRUCT",template:g[_-3]},co(g[_-2]),g[_-1],g[_]);break;case 9:this.$=qt({queryType:"CONSTRUCT",template:g[_-2]=g[_-2]?g[_-2].triples:[]},co(g[_-5]),{where:[{type:"bgp",triples:oo([],g[_-2])}]},g[_]);break;case 10:this.$=qt({queryType:"DESCRIBE",variables:g[_-3]==="*"?[new ud]:g[_-3]},co(g[_-2]),g[_-1],g[_]);break;case 11:this.$=qt({queryType:"ASK"},co(g[_-2]),g[_-1],g[_]);break;case 12:this.$=qt(g[_-1],{variables:[new ud]});break;case 13:let au=g[_].map(St=>St.value||St.variable.value),oc=nN(au);if(oc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+oc[0]+")");this.$=qt(g[_-1],{variables:g[_]});break;case 14:this.$=qt({queryType:"SELECT"},g[_]&&(g[_-1]=nn(g[_]),g[_]={},g[_][g[_-1]]=!0,g[_]));break;case 16:case 27:this.$=nc(g[_-3],{variable:g[_-1]});break;case 17:case 18:this.$=qt(g[_-3],g[_-2],g[_-1],g[_],{type:"query"});break;case 19:case 58:this.$={iri:g[_],named:!!g[_-1]};break;case 20:this.$={where:g[_].patterns};break;case 21:this.$=qt(g[_-1],g[_]);break;case 22:this.$=qt(g[_-2],g[_-1],g[_]);break;case 23:this.$={group:g[_]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=nc(g[_]);break;case 26:this.$=nc(g[_-1]);break;case 29:this.$={having:g[_]};break;case 30:this.$={order:g[_]};break;case 32:this.$=nc(g[_],{descending:!0});break;case 35:this.$={limit:sc(g[_])};break;case 36:this.$={offset:sc(g[_])};break;case 37:this.$={limit:sc(g[_-2]),offset:sc(g[_])};break;case 38:this.$={limit:sc(g[_]),offset:sc(g[_-2])};break;case 39:case 43:this.$={type:"values",values:g[_]};break;case 40:case 84:this.$=g[_-1].map(St=>({[g[_-3]]:St}));break;case 41:case 85:this.$=g[_-1].map(()=>({}));break;case 42:case 86:var Yi=g[_-4].length;g[_-4]=g[_-4].map(ny),this.$=g[_-1].map(function(St){if(St.length!==Yi)throw Error("Inconsistent VALUES length");for(var Dt={},ct=0;ct<Yi;ct++)Dt["?"+g[_-4][ct].value]=St[ct];return Dt});break;case 44:case 65:case 100:case 126:case 175:this.$=g[_-1];break;case 45:this.$={type:"update",updates:Fs(g[_-2],g[_-1])};break;case 46:this.$=qt({type:"load",silent:!!g[_-2],source:g[_-1]},g[_]&&{destination:g[_]});break;case 47:this.$={type:nn(g[_-2]),silent:!!g[_-1],graph:g[_]};break;case 48:this.$={type:nn(g[_-4]),silent:!!g[_-3],source:g[_-2],destination:g[_]};break;case 49:this.$={type:"create",silent:!!g[_-2],graph:{type:"graph",name:g[_]}};break;case 50:this.$={updateType:"insert",insert:lE(g[_])};break;case 51:this.$={updateType:"delete",delete:hy(lE(g[_]))};break;case 52:this.$={updateType:"deletewhere",delete:hy(g[_])};break;case 53:this.$={updateType:"insertdelete",...g[_-4],...g[_-3],...co(g[_-2],"using"),where:g[_].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=g[_];break;case 55:this.$={delete:hy(g[_-1]),insert:g[_]||[]};break;case 56:this.$={delete:[],insert:g[_]};break;case 59:this.$={graph:g[_]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:g[_]};break;case 64:this.$={[nn(g[_])]:!0};break;case 66:this.$=g[_-1]?Qi(g[_],[g[_-1]]):Qi(g[_]);break;case 67:var iu=qt(g[_-3]||{triples:[]},{type:"graph",name:g[_-5]});this.$=g[_]?[iu,g[_]]:[iu];break;case 68:case 73:this.$={type:"bgp",triples:Qi(g[_-2],[g[_-1]])};break;case 69:this.$={type:"group",patterns:[g[_-1]]};break;case 70:for(let St of g[_-1].filter(Dt=>Dt.type==="bind")){let Dt=g[_-1].indexOf(St),ct=new Set;for(let dt of g[_-1].slice(0,Dt))(dt.type==="group"||dt.type==="bgp")&&oE(dt).forEach(En=>ct.add(En));if(ct.has(St.variable.value))throw Error("Variable used to bind is already bound (?"+St.variable.value+")")}this.$={type:"group",patterns:g[_-1]};break;case 71:this.$=g[_-1]?Qi([g[_-1]],g[_]):Qi(g[_]);break;case 72:this.$=g[_]?[g[_-2],g[_]]:g[_-2];break;case 75:this.$=qt(g[_],{type:"optional"});break;case 76:this.$=qt(g[_],{type:"minus"});break;case 77:this.$=qt(g[_],{type:"graph",name:g[_-1]});break;case 78:this.$=qt(g[_],{type:"service",name:g[_-1],silent:!!g[_-2]});break;case 79:this.$={type:"filter",expression:g[_]};break;case 80:this.$={type:"bind",variable:g[_-1],expression:g[_-3]};break;case 89:this.$=nu(g[_]);break;case 90:this.$=void 0;break;case 91:this.$=g[_-1].length?{type:"union",patterns:Qi(g[_-1].map(sy),[sy(g[_])])}:g[_];break;case 95:this.$={...g[_],function:g[_-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Fs(g[_-2],g[_-1]),distinct:!!g[_-3]};break;case 98:case 115:case 128:case 247:case 249:case 251:case 253:case 255:case 263:case 267:case 297:case 299:case 303:case 307:case 328:case 341:case 349:case 355:case 361:case 367:case 369:case 373:case 375:case 379:case 381:case 385:case 391:case 395:case 401:case 405:case 409:case 411:case 420:case 428:case 430:case 440:case 444:case 446:case 448:this.$=[];break;case 99:this.$=Fs(g[_-2],g[_-1]);break;case 101:this.$=Qi(g[_-2],[g[_-1]]);break;case 102:case 112:this.$=dy(g[_].map(St=>qt(Ds(g[_-1]),St)));break;case 103:this.$=dy(oo(g[_].map(St=>qt(Ds(g[_-1].entity),St)),g[_-1].triples));break;case 105:this.$=Qi([g[_-1]],g[_]);break;case 106:this.$=Qi(g[_]);break;case 107:this.$=cy(g[_-1],g[_]);break;case 109:case 237:this.$=Ve.factory.namedNode(zD);break;case 110:case 118:this.$=Fs(g[_-1],g[_]);break;case 111:this.$=g[_]?{annotation:g[_],object:g[_-1]}:g[_-1];break;case 113:this.$=g[_]?dy(oo(g[_].map(St=>qt(Ds(g[_-1].entity),St)),g[_-1].triples)):g[_-1].triples;break;case 114:this.$=cy(...g[_-1],g[_]);break;case 116:this.$=cy(...g[_]);break;case 117:case 159:case 163:this.$=[g[_-1],g[_]];break;case 119:this.$=g[_]?{object:g[_-1],annotation:g[_]}:g[_-1];break;case 120:this.$=g[_-1].length?ic("|",Fs(g[_-1],g[_])):g[_];break;case 121:this.$=g[_-1].length?ic("/",Fs(g[_-1],g[_])):g[_];break;case 122:this.$=g[_]?ic(g[_],[g[_-1]]):g[_-1];break;case 123:this.$=g[_-1]?ic(g[_-1],[g[_]]):g[_];break;case 125:case 131:this.$=ic(g[_-1],[g[_]]);break;case 129:this.$=ic("|",Fs(g[_-2],g[_-1]));break;case 132:case 134:this.$=eN(g[_-1]);break;case 133:case 135:this.$=tN(g[_-1]);break;case 140:this.$={entity:g[_],triples:[]};break;case 145:this.$=ny(g[_]);break;case 149:this.$=Ve.factory.namedNode(Z2);break;case 151:case 153:case 158:case 162:this.$=iy(g[_-1],g[_]);break;case 152:this.$=["||",g[_]];break;case 154:this.$=["&&",g[_]];break;case 156:this.$=Or(g[_-1],[g[_-2],g[_]]);break;case 157:this.$=Or(g[_-2]?"notin":"in",[g[_-3],g[_]]);break;case 160:this.$=["+",iy(g[_-1],g[_])];break;case 161:var hd=Ki(g[_-1].value.replace("-",""),g[_-1].datatype);this.$=["-",iy(hd,g[_])];break;case 164:this.$=Or("UPLUS",[g[_]]);break;case 165:this.$=Or(g[_-1],[g[_]]);break;case 166:this.$=Or("UMINUS",[g[_]]);break;case 177:this.$=Or(nn(g[_-1]));break;case 178:this.$=Or(nn(g[_-3]),[g[_-1]]);break;case 179:this.$=nu(Or(nn(g[_-3]),[g[_-1]]));break;case 180:this.$=Or(nn(g[_-5]),[g[_-3],g[_-1]]);break;case 181:this.$=Or(nn(g[_-7]),[g[_-5],g[_-3],g[_-1]]);break;case 182:this.$=nu(Or(nn(g[_-7]),[g[_-5],g[_-3],g[_-1]]));break;case 183:this.$=Or(nn(g[_-1]),g[_]);break;case 184:this.$=Or("bound",[ny(g[_-1])]);break;case 185:this.$=Or(g[_-1],[]);break;case 186:this.$=Or(g[_-3],[g[_-1]]);break;case 187:this.$=Or(g[_-2]?"notexists":"exists",[sy(g[_])]);break;case 188:case 189:this.$=nc(g[_-1],{type:"aggregate",aggregation:nn(g[_-4]),distinct:!!g[_-2]});break;case 190:this.$=nc(g[_-2],{type:"aggregate",aggregation:nn(g[_-5]),distinct:!!g[_-3],separator:typeof g[_-1]=="string"?g[_-1]:" "});break;case 192:this.$=Ki(g[_]);break;case 193:this.$=YD(g[_-1],nn(g[_].substr(1)));break;case 194:this.$=Ki(g[_-2],g[_]);break;case 195:case 204:this.$=Ki(g[_],eE);break;case 196:case 205:this.$=Ki(g[_],tE);break;case 197:case 206:this.$=Ki(nn(g[_]),rE);break;case 200:this.$=Ki(g[_].toLowerCase(),KD);break;case 201:this.$=Ki(g[_].substr(1),eE);break;case 202:this.$=Ki(g[_].substr(1),tE);break;case 203:this.$=Ki(g[_].substr(1).toLowerCase(),rE);break;case 207:case 208:this.$=aE(g[_],1);break;case 209:case 210:this.$=aE(g[_],3);break;case 211:this.$=Ve.factory.namedNode(tu(g[_]));break;case 213:var pd=g[_].indexOf(":"),su=g[_].substr(0,pd),md=Ve.prefixes[su];if(!md)throw new Error("Unknown prefix: "+su);var jt=tu(md+g[_].substr(pd+1));this.$=Ve.factory.namedNode(jt);break;case 214:if(g[_]=g[_].substr(0,g[_].length-1),!(g[_]in Ve.prefixes))throw new Error("Unknown prefix: "+g[_]);var jt=tu(Ve.prefixes[g[_]]);this.$=Ve.factory.namedNode(jt);break;case 215:this.$=ru(g[_].replace(/^(_:)/,""));break;case 216:this.$=ru();break;case 217:case 218:case 232:this.$=nu(ay(g[_-3],g[_-2],g[_-1]));break;case 230:case 231:this.$=nu(g[_-1]);break;case 248:case 250:case 252:case 254:case 256:case 260:case 264:case 268:case 270:case 292:case 294:case 296:case 298:case 300:case 302:case 304:case 306:case 329:case 342:case 356:case 368:case 370:case 372:case 374:case 392:case 402:case 425:case 427:case 429:case 431:case 441:case 445:case 447:case 449:g[_-1].push(g[_]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[g[_]];break;case 308:g[_-3].push(g[_-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:g[_-2].push(g[_-1]);break}},"anonymous"),table:[n(e,t,{3:1,4:2,10:3}),{1:[3]},n(r,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:i,16:i,45:i,197:i,224:i,229:i,308:i,24:[1,13],32:[1,14],36:[1,15],41:s}),n([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:a},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(y,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:S,87:h},n(v,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),n(e,[2,248]),n(e,[2,245]),n(e,[2,246]),{13:[1,72]},{16:[1,73]},{1:[2,1]},{6:[2,2]},{6:[2,244]},{45:[1,77],85:[1,78],86:74,87:[1,75],89:[1,76]},n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],[2,120],{337:[1,79]}),n(w,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:T,29:C,52:84,53:L,56:85},{19:88,28:T,29:C,52:89,53:L,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:L},n($,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(ee,[2,263],{34:96}),n(ee,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(ee,[2,262]),n(B,[2,259]),n(G,[2,143]),n(G,[2,144]),n([6,13,16,28,29,31,39,45,47,48,53,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,145]),n(F,[2,211]),n(F,[2,212]),n(F,[2,213]),n(F,[2,214]),{19:98,28:T,29:C,52:99,53:L,56:85},{6:[2,309],99:100,193:[1,101]},n(D,[2,311],{101:102,328:[1,103]}),n(W,[2,317],{104:104,328:[1,105]}),n(De,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:et,114:110},{29:et,114:112},{29:et,114:113},{118:114,123:[1,115],125:116,126:ut},n(ae,[2,315]),n(ae,[2,316]),n(Ze,[2,319]),n(Ze,[2,320]),n(Ze,[2,321]),n(y,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:S,87:h}),n(ie,[2,269]),n(ie,[2,15]),{13:f,16:d,44:136,45:Z,46:120,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(v,[2,14]),n(v,[2,274]),n(v,[2,271]),n(v,[2,272]),n(e,[2,4]),{13:[1,177]},n(J,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:d,45:[1,193],55:194,197:bt,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(w,[2,419]),n(At,je,{20:196,59:197,69:198,70:z}),n(l,[2,250]),{29:H,57:200},n(D,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(K,Y,{23:204,58:205,62:206,63:Re}),n(l,[2,252]),{19:208,28:T,29:C,52:209,53:L,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:at,55:220,82:q,87:h,89:ot,145:212,172:221,185:213,187:214,231:Cr,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(E2,[2,265],{56:85,35:227,52:228,19:229,28:T,29:C,53:L}),n(B,[2,260]),n(K,Y,{58:205,62:206,23:230,63:Re}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:p},n(D,[2,312]),{105:233,112:T2,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(W,[2,318]),n(D,A2,{108:240,133:242,112:x2,132:I2}),n(De,[2,323]),{112:[1,244]},{112:[2,325]},n(Rr,[2,50]),n($,Yf,{135:245,136:246,143:247,144:248,31:C2,112:C2}),n(Rr,[2,51]),n(Rr,[2,52]),n(ma,[2,328],{119:249}),{29:et,114:250},n(ma,[2,56]),{29:et,114:251},n(y,[2,59]),n(ie,[2,270]),{47:[1,252]},n(R2,[2,150]),n(Xf,[2,428],{240:253}),n(Jo,[2,430],{244:254}),n(Jo,[2,155],{248:255,249:256,250:[2,438],290:[1,257],341:[1,258],342:[1,259],343:[1,260],344:[1,261],345:[1,262],346:[1,263]}),n(Zo,[2,440],{252:264}),n(mr,[2,448],{260:265}),{13:f,16:d,44:136,45:Z,55:133,67:132,68:134,77:131,82:q,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,55:133,67:132,68:134,77:131,82:q,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,55:133,67:132,68:134,77:131,82:q,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(mr,[2,167]),n(mr,[2,168]),n(mr,[2,169]),n(mr,[2,170],{176:269,45:O2,89:P2}),n(mr,[2,171]),n(mr,[2,172]),n(mr,[2,173]),n(mr,[2,174]),{13:f,16:d,44:136,45:Z,46:272,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Qt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:F2,89:D2,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(rn,[2,192],{292:[1,286],293:[1,287]}),n(rn,[2,195]),n(rn,[2,196]),n(rn,[2,197]),n(rn,[2,198]),n(rn,[2,199]),n(rn,[2,200]),{13:f,16:d,44:39,55:40,82:q,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(Xl,[2,452]),n(Xl,[2,453]),n(Xl,[2,454]),n(Xl,[2,455]),n(Xl,[2,456]),{279:[2,458]},n(Jf,[2,207]),n(Jf,[2,208]),n(Jf,[2,209]),n(Jf,[2,210]),n(rn,[2,201]),n(rn,[2,202]),n(rn,[2,203]),n(rn,[2,204]),n(rn,[2,205]),n(rn,[2,206]),n(e,[2,5]),n(Zf,[2,297],{88:295}),n(ed,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(td,[2,301]),n(J,[2,43]),n(J,[2,82]),n(J,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(eo,[2,123]),n(eo,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(Hi,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:bt,223:312,225:308,226:309,229:N2,307:43,308:p},n(c,i,{215:10,214:314}),n(Hi,[2,236]),n(Hi,[2,237]),n(ec,[2,6]),n(Kg,[2,287],{60:315,72:316,73:[1,317]}),n(At,[2,286]),{13:f,16:d,45:Z,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,307:43,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P},n([6,31,63,70,73,81,83,85],[2,20]),n($,L2,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Is,31:Is,85:Is,112:Is,159:Is,160:Is,161:Is,163:Is,164:Is,41:s}),{13:f,16:d,55:331,307:43,308:p},n(D,[2,280]),n(ec,[2,7]),n(At,je,{59:197,69:198,20:332,70:z}),n(K,[2,284]),{64:[1,333]},n(K,Y,{58:205,62:206,23:334,63:Re}),n(l,[2,254]),n($,Yf,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:h,139:342,186:339,190:340,195:341,197:to,307:43,308:p},n(Jl,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:d,87:h,197:to,308:p}),n(Cs,[2,227]),n(Cs,[2,228]),n(Cs,[2,229]),{13:f,16:d,44:215,45:at,55:220,82:q,87:h,89:ot,172:221,185:351,187:350,200:348,230:347,231:Cr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:to,307:43,308:p},n(Cs,[2,146]),n(Cs,[2,147]),n(Cs,[2,148]),n(Cs,[2,149]),{13:f,16:d,44:354,55:355,82:q,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:358,312:tn,313:353},n(Yg,[2,215]),n(Yg,[2,216]),n(K,Y,{58:205,62:206,23:359,63:Re}),n(ee,[2,264]),n(E2,[2,266]),n(ec,[2,11]),n(r,[2,308],{6:[2,310]}),n(Rr,[2,313],{102:360,120:361,121:[1,362]}),n(Rr,[2,47]),n(Rr,[2,63]),n(Rr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(Rr,[2,336]),n(Rr,[2,337]),n(Rr,[2,338]),{109:[1,364]},n(k2,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(D,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(ro,[2,341],{137:368}),n(ro,[2,340]),{13:f,16:d,44:215,45:at,55:220,82:q,87:h,89:ot,145:369,172:221,185:213,187:214,231:Cr,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},{28:[1,370],127:371,128:[1,372]},n(ma,[2,330],{124:373,125:374,126:ut}),n(ma,[2,57]),{44:375,87:h},n(R2,[2,151],{241:376,242:[1,377]}),n(Xf,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:Z,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,247:380,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{250:[1,381]},n(Kt,[2,432]),n(Kt,[2,433]),n(Kt,[2,434]),n(Kt,[2,435]),n(Kt,[2,436]),n(Kt,[2,437]),{250:[2,439]},n([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:fe,298:de,299:he,300:ce,301:ye,302:_e}),n(Zo,[2,162],{261:388,262:389,39:Xg,338:Jg}),n(mr,[2,164]),n(mr,[2,165]),n(mr,[2,166]),n(Qt,[2,95]),n(Qt,[2,96]),n(Kt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Qt,[2,177]),{13:f,16:d,44:136,45:Z,46:395,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,46:396,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,46:397,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,46:398,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,46:399,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Qt,[2,183]),n(Qt,[2,98]),n(Kt,[2,381],{180:400}),{87:[1,401]},n(Qt,[2,185]),{13:f,16:d,44:136,45:Z,46:402,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{29:H,57:403},n(rn,[2,193]),{13:f,16:d,55:404,307:43,308:p},{13:f,16:d,44:39,55:40,87:h,139:342,195:405,197:to,307:43,308:p},n(ga,[2,233]),n(ga,[2,234]),n(ga,[2,235]),n(j2,[2,459],{281:406,325:[1,407]}),n(Kt,[2,463],{284:408,325:[1,409]}),n(Kt,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:q,171:413,172:415,173:416,174:rd,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:nd},{31:[1,419],89:[1,420]},{29:[1,421]},n(td,[2,302]),n(Zf,[2,367],{167:422}),n(ed,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(td,[2,371]),n(eo,[2,122]),n(eo,[2,417]),n(eo,[2,413]),n(eo,[2,414]),n(eo,[2,415]),n(Hi,[2,125]),n(Hi,[2,127]),n(Hi,[2,128]),n(M2,[2,420],{227:426}),n(Hi,[2,130]),{13:f,16:d,55:194,197:bt,223:427,307:43,308:p},{48:[1,428]},n(ya,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(Kg,[2,288]),{64:[1,433]},n(At,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:d,45:Z,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,276:Ye,277:xe,279:Ge,280:Le,283:ze,285:Xe,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P}),n($2,[2,293]),n(Zg,[2,92]),n(Zg,[2,93]),n(Zg,[2,94]),{45:O2,89:P2,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:T,29:C,56:85},{19:438,28:T,29:C,56:85},n(no,[2,355],{149:439}),n(no,[2,354]),{13:f,16:d,44:215,45:id,55:220,82:q,87:h,89:ot,156:440,172:221,185:441,203:442,231:sd,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(ee,[2,19]),n(ya,[2,21]),{13:f,16:d,44:450,45:V2,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,307:43,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P},n(ec,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n($,[2,386],{31:[2,388]}),n(Jl,[2,102]),n(io,[2,391],{191:452}),n($,[2,395],{196:453,198:454}),n($,[2,108]),n($,[2,109]),n(Jl,[2,103]),n(Jl,[2,104]),n(Jl,[2,390]),{13:f,16:d,44:215,45:at,48:[1,455],55:220,82:q,87:h,89:ot,172:221,185:351,187:350,200:456,231:Cr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(ad,[2,424]),n(B2,[2,136]),n(B2,[2,137]),n(ey,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:to,307:43,308:p},n(ga,[2,219]),n(ga,[2,220]),n(ga,[2,221]),n(ga,[2,222]),n(ga,[2,223]),n(ec,[2,10]),n(Rr,[2,46]),n(Rr,[2,314]),{112:T2,122:459},n(Rr,[2,62]),n(D,A2,{133:242,108:460,112:x2,132:I2}),n(k2,[2,61]),n(Rr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(ro,[2,351],{146:463,335:[1,464]}),{29:H,57:465},n(ma,[2,329]),n(D,[2,332],{129:466,327:[1,467]}),n(ma,[2,55]),n(ma,[2,331]),{48:[1,468]},n(Xf,[2,429]),{13:f,16:d,44:136,45:Z,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Jo,[2,431]),{13:f,16:d,44:136,45:Z,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,243:470,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Jo,[2,156]),{45:F2,89:D2,179:471},n(Zo,[2,441]),{13:f,16:d,44:136,45:Z,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,251:472,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(mr,[2,444],{256:473}),n(mr,[2,446],{258:474}),n(Kt,[2,442]),n(Kt,[2,443]),n(mr,[2,449]),{13:f,16:d,44:136,45:Z,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,255:154,257:155,259:475,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Kt,[2,450]),n(Kt,[2,451]),n(Kt,[2,379],{178:476}),n(Kt,[2,378]),n([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:f,16:d,44:136,45:Z,46:482,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{48:[1,483]},{48:[1,484]},n(Qt,[2,187]),n(rn,[2,194]),{13:f,16:d,44:39,55:40,82:q,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,320:485},{13:f,16:d,39:[1,487],44:136,45:Z,46:488,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,282:486,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(j2,[2,460]),{13:f,16:d,44:136,45:Z,46:489,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Kt,[2,464]),{13:f,16:d,44:136,45:Z,46:490,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Kt,[2,466]),n(J,[2,40]),n(Zf,[2,298]),n(Zl,[2,87]),n(Zl,[2,88]),n(Zl,[2,89]),n(Zl,[2,90]),{13:f,16:d,55:492,82:q,172:493,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,311:494,312:tn,315:491},n(J,[2,41]),n(ed,[2,300]),n(eu,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:q,171:497,172:415,173:416,174:rd,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:nd},{31:[1,498],89:[1,499]},{29:[1,500]},n(td,[2,372]),{13:f,16:d,48:[2,422],55:194,197:bt,223:312,226:502,228:501,229:N2,307:43,308:p},n(Hi,[2,131]),n(Hi,[2,126]),n(ya,[2,22]),n(ya,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:Z,55:323,67:321,68:322,74:505,75:506,76:U2,77:320,78:q2,79:509,87:h,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,307:43,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P},n($2,[2,294]),n(W2,[2,69]),n(W2,[2,70]),n(At,je,{59:197,69:198,20:511,70:z}),n(K,Y,{58:205,62:206,23:512,63:Re}),{29:[2,375],31:[2,71],84:522,85:a,112:[1,518],150:513,151:514,158:515,159:[1,516],160:[1,517],161:[1,519],163:[1,520],164:[1,521],175:523},n(no,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:h}),n(od,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),{13:f,16:d,44:215,45:id,55:220,82:q,87:h,89:ot,172:221,185:351,203:536,212:534,231:sd,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(K,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:d,45:V2,87:h,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,276:Ye,277:xe,279:Ge,280:Le,283:ze,285:Xe,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P}),n(so,[2,291]),n(so,[2,24]),n(so,[2,25]),{13:f,16:d,44:136,45:Z,46:539,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(so,[2,28]),n(K,Y,{58:205,62:206,23:540,63:Re}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(io,[2,107]),{13:f,16:d,44:215,45:at,55:220,82:q,87:h,89:ot,172:221,185:351,187:350,199:543,200:544,231:Cr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(G2,[2,132]),n(ad,[2,425]),n(G2,[2,133]),{13:f,16:d,44:354,55:355,82:q,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:358,312:tn,313:545},n(Rr,[2,54]),n(Rr,[2,48]),n(ro,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(ro,[2,68]),n($,[2,350],{31:z2,112:z2}),n(Rr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(D,[2,333]),n(ie,[2,16]),n(Xf,[2,152]),n(Jo,[2,154]),n(Jo,[2,157]),n(Zo,[2,159]),n(Zo,[2,160],{262:389,261:548,39:Xg,338:Jg}),n(Zo,[2,161],{262:389,261:549,39:Xg,338:Jg}),n(mr,[2,163]),{13:f,16:d,44:136,45:Z,46:550,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Qt,[2,178]),n(Qt,[2,179]),{13:f,16:d,44:136,45:Z,46:551,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,46:552,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,46:553,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{48:[1,554],272:[1,555]},n(Qt,[2,184]),n(Qt,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:f,16:d,55:194,197:bt,223:562,307:43,308:p},n(ty,[2,224]),n(ty,[2,225]),n(ty,[2,226]),{31:[1,563],45:H2,94:564},n(J,[2,84]),n(Zf,[2,368]),n(J,[2,85]),n(ed,[2,370]),n(eu,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(ya,[2,35],{83:[1,569]}),n(ya,[2,36],{81:[1,570]}),n(Kg,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:f,16:d,45:Z,76:U2,78:q2,87:h,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,276:Ye,277:xe,279:Ge,280:Le,283:ze,285:Xe,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P}),n(tc,[2,295]),{45:Z,77:572},{45:Z,77:573},n(tc,[2,33]),n(tc,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(no,[2,356]),n(Q2,[2,357],{152:578,335:[1,579]}),n(Rs,[2,74]),{29:H,57:580},{29:H,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(K2,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:Z,55:323,67:321,68:322,77:320,79:585,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,307:43,308:p,346:Je,347:qe,348:E,349:A,350:x,351:P},{45:[1,586]},n(Rs,[2,81]),{29:H,57:587},n(no,[2,73]),n($,[2,362],{29:Os,31:Os,85:Os,112:Os,159:Os,160:Os,161:Os,163:Os,164:Os}),n(od,[2,112]),n(rc,[2,401],{206:588}),n($,[2,405],{209:589,210:590}),n($,[2,403]),n($,[2,404]),n(od,[2,113]),n(od,[2,400]),{13:f,16:d,44:215,45:id,48:[1,591],55:220,82:q,87:h,89:ot,172:221,185:351,203:536,212:592,231:sd,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(ad,[2,426]),n(ey,[2,138]),n(ey,[2,139]),{232:[1,593]},n(so,[2,292]),{47:[1,595],48:[1,594]},n(ec,[2,9]),n(io,[2,392]),n(io,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:to,308:p}),n(io,[2,110],{272:[1,598]}),n(cd,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(ma,[2,58]),n(mr,[2,445]),n(mr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Qt,[2,99]),n(Kt,[2,382]),n([13,16,39,47,48,87,193,197,242,246,250,263,265,272,290,297,298,299,300,301,302,308,314,338,341,342,343,344,345,346],[2,232]),n(Qt,[2,188]),n(Qt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:q,172:493,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,311:494,312:tn,315:611},n(J,[2,42]),n(eu,[2,304]),{13:f,16:d,55:414,82:q,95:612,171:613,172:415,173:416,174:rd,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:nd},{31:[1,614],45:H2,94:615},n(Hi,[2,129]),n(M2,[2,421]),{82:[1,616]},{82:[1,617]},n(tc,[2,296]),n(tc,[2,31]),n(tc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n($,L2,{155:330,153:618,154:619,29:Ps,31:Ps,85:Ps,112:Ps,159:Ps,160:Ps,161:Ps,163:Ps,164:Ps}),n(Q2,[2,358]),n(Rs,[2,75]),n(Rs,[2,76]),{29:H,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(K2,[2,366]),n(Rs,[2,79]),{13:f,16:d,44:136,45:Z,46:622,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Rs,[2,91],{336:[1,623]}),n([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),n(rc,[2,117]),{13:f,16:d,44:215,45:id,55:220,82:q,87:h,89:ot,172:221,185:351,203:536,211:626,212:627,231:sd,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,309:vn,310:kn,311:217,312:tn},n(Cs,[2,134]),n(ad,[2,427]),n(Cs,[2,135]),n(so,[2,26]),{44:628,87:h},n(io,[2,106]),n(io,[2,394]),n($,[2,396]),n(cd,[2,111]),n(cd,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:to,307:43,308:p},n(Yg,[2,217]),n($,Yf,{144:248,140:630,143:631,31:[2,343]}),n(Qt,[2,97]),n(Kt,[2,380]),n(Qt,[2,180]),{13:f,16:d,44:136,45:Z,46:632,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},{13:f,16:d,44:136,45:Z,46:633,55:133,67:132,68:134,77:131,82:q,87:h,172:135,224:tt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:st,264:130,265:Q,266:137,267:139,268:Ne,269:He,270:te,271:Qe,273:Ke,274:We,275:146,276:Ye,277:xe,278:149,279:Ge,280:Le,283:ze,285:Xe,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:it,346:Je,347:qe,348:E,349:A,350:x,351:P},n(Qt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:q,171:637,172:415,173:416,174:rd,255:154,257:155,291:150,294:ue,295:me,296:ge,297:fe,298:de,299:he,300:ce,301:ye,302:_e,303:be,304:Se,305:se,306:we,307:43,308:p,312:nd},n(Y2,[2,305]),n(J,[2,86]),n(eu,[2,374]),n(ya,[2,37]),n(ya,[2,38]),n(no,[2,72]),n(no,[2,360]),n(Rs,[2,77]),{29:H,57:638},{47:[1,639]},{29:[2,376]},n(rc,[2,402]),n(rc,[2,115],{215:10,208:528,214:529,44:530,205:640,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),n(rc,[2,118],{272:[1,641]}),n(ld,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:be,304:Se,305:se,306:we},n(Zl,[2,218]),n(eu,[2,44]),n(Y2,[2,306]),n(Rs,[2,78]),{44:651,87:h},n(rc,[2,116]),n($,[2,406]),n(ld,[2,119]),n(ld,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(so,[2,27]),n(cd,[2,230]),n(X2,[2,345],{141:653,335:[1,654]}),n(Qt,[2,181]),n(Qt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n($,Yf,{144:248,142:657,143:658,31:J2,112:J2}),n(X2,[2,346]),n(Rs,[2,80]),n(ld,[2,231]),n(ro,[2,67]),n(ro,[2,348])],defaultActions:{5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]},parseError:o(function(I,O){if(O.recoverable)this.trace(I);else{var N=new Error(I);throw N.hash=O,N}},"parseError"),parse:o(function(I){var O=this,N=[0],re=[],ke=[null],g=[],sn=this.table,_="",Yi=0,iu=0,hd=0,pd=2,su=1,md=g.slice.call(arguments,1),jt=Object.create(this.lexer),Xi={yy:{}};for(var au in this.yy)Object.prototype.hasOwnProperty.call(this.yy,au)&&(Xi.yy[au]=this.yy[au]);jt.setInput(I,Xi.yy),Xi.yy.lexer=jt,Xi.yy.parser=this,typeof jt.yylloc>"u"&&(jt.yylloc={});var oc=jt.yylloc;g.push(oc);var St=jt.options&&jt.options.ranges;typeof Xi.yy.parseError=="function"?this.parseError=Xi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Dt(Ji){N.length=N.length-2*Ji,ke.length=ke.length-Ji,g.length=g.length-Ji}o(Dt,"popStack");for(var ct=o(function(){var Ji;return Ji=jt.lex()||su,typeof Ji!="number"&&(Ji=O.symbols_[Ji]||Ji),Ji},"lex"),dt,En,lo,Hn,BX,py,cc={},gd,Ns,uE,yd;;){if(lo=N[N.length-1],this.defaultActions[lo]?Hn=this.defaultActions[lo]:((dt===null||typeof dt>"u")&&(dt=ct()),Hn=sn[lo]&&sn[lo][dt]),typeof Hn>"u"||!Hn.length||!Hn[0]){var my="";yd=[];for(gd in sn[lo])this.terminals_[gd]&&gd>pd&&yd.push("'"+this.terminals_[gd]+"'");jt.showPosition?my="Parse error on line "+(Yi+1)+`:
|
|
34
34
|
`+jt.showPosition()+`
|
|
35
|
-
Expecting `+yd.join(", ")+", got '"+(this.terminals_[dt]||dt)+"'":my="Parse error on line "+(Yi+1)+": Unexpected "+(dt==su?"end of input":"'"+(this.terminals_[dt]||dt)+"'"),this.parseError(my,{text:jt.match,token:this.terminals_[dt]||dt,line:jt.yylineno,loc:oc,expected:yd})}if(Hn[0]instanceof Array&&Hn.length>1)throw new Error("Parse Error: multiple actions possible at state: "+lo+", token: "+dt);switch(Hn[0]){case 1:N.push(dt),ke.push(jt.yytext),g.push(jt.yylloc),N.push(Hn[1]),dt=null,En?(dt=En,En=null):(iu=jt.yyleng,_=jt.yytext,Yi=jt.yylineno,oc=jt.yylloc,hd>0&&hd--);break;case 2:if(Ns=this.productions_[Hn[1]][1],cc.$=ke[ke.length-Ns],cc._$={first_line:g[g.length-(Ns||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(Ns||1)].first_column,last_column:g[g.length-1].last_column},St&&(cc._$.range=[g[g.length-(Ns||1)].range[0],g[g.length-1].range[1]]),py=this.performAction.apply(cc,[_,iu,Yi,Xi.yy,Hn[1],ke,g].concat(md)),typeof py<"u")return py;Ns&&(N=N.slice(0,-1*Ns*2),ke=ke.slice(0,-1*Ns),g=g.slice(0,-1*Ns)),N.push(this.productions_[Hn[1]][0]),ke.push(cc.$),g.push(cc._$),uE=sn[N[N.length-2]][N[N.length-1]],N.push(uE);break;case 3:return!0}}return!0},"parse")},ud=o_().Wildcard,fd="http://www.w3.org/1999/02/22-rdf-syntax-ns#",zD=fd+"type",HD=fd+"first",QD=fd+"rest",Z2=fd+"nil",dd="http://www.w3.org/2001/XMLSchema#",eE=dd+"integer",tE=dd+"decimal",rE=dd+"double",KD=dd+"boolean",ao="",nE="",iE="";function nn(R){return R.toLowerCase()}o(nn,"lowercase");function Fs(R,I){return R.push(I),R}o(Fs,"appendTo");function oo(R,I){return R.push.apply(R,I),R}o(oo,"appendAllTo");function qt(R){R||(R={});for(var I=1,O=arguments.length,N;I<O&&(N=arguments[I]||{});I++)for(var
|
|
36
|
-
`,r:"\r",f:"\f"},ZD=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,oy=String.fromCharCode;function aE(R,I){R=R.substring(I,R.length-I);try{R=R.replace(XD,function(O,N,
|
|
35
|
+
Expecting `+yd.join(", ")+", got '"+(this.terminals_[dt]||dt)+"'":my="Parse error on line "+(Yi+1)+": Unexpected "+(dt==su?"end of input":"'"+(this.terminals_[dt]||dt)+"'"),this.parseError(my,{text:jt.match,token:this.terminals_[dt]||dt,line:jt.yylineno,loc:oc,expected:yd})}if(Hn[0]instanceof Array&&Hn.length>1)throw new Error("Parse Error: multiple actions possible at state: "+lo+", token: "+dt);switch(Hn[0]){case 1:N.push(dt),ke.push(jt.yytext),g.push(jt.yylloc),N.push(Hn[1]),dt=null,En?(dt=En,En=null):(iu=jt.yyleng,_=jt.yytext,Yi=jt.yylineno,oc=jt.yylloc,hd>0&&hd--);break;case 2:if(Ns=this.productions_[Hn[1]][1],cc.$=ke[ke.length-Ns],cc._$={first_line:g[g.length-(Ns||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(Ns||1)].first_column,last_column:g[g.length-1].last_column},St&&(cc._$.range=[g[g.length-(Ns||1)].range[0],g[g.length-1].range[1]]),py=this.performAction.apply(cc,[_,iu,Yi,Xi.yy,Hn[1],ke,g].concat(md)),typeof py<"u")return py;Ns&&(N=N.slice(0,-1*Ns*2),ke=ke.slice(0,-1*Ns),g=g.slice(0,-1*Ns)),N.push(this.productions_[Hn[1]][0]),ke.push(cc.$),g.push(cc._$),uE=sn[N[N.length-2]][N[N.length-1]],N.push(uE);break;case 3:return!0}}return!0},"parse")},ud=o_().Wildcard,fd="http://www.w3.org/1999/02/22-rdf-syntax-ns#",zD=fd+"type",HD=fd+"first",QD=fd+"rest",Z2=fd+"nil",dd="http://www.w3.org/2001/XMLSchema#",eE=dd+"integer",tE=dd+"decimal",rE=dd+"double",KD=dd+"boolean",ao="",nE="",iE="";function nn(R){return R.toLowerCase()}o(nn,"lowercase");function Fs(R,I){return R.push(I),R}o(Fs,"appendTo");function oo(R,I){return R.push.apply(R,I),R}o(oo,"appendAllTo");function qt(R){R||(R={});for(var I=1,O=arguments.length,N;I<O&&(N=arguments[I]||{});I++)for(var re in N)R[re]=N[re];return R}o(qt,"extend");function Qi(){for(var R=[],I=0,O=arguments.length;I<O;I++)R=R.concat.apply(R,arguments[I]);return R}o(Qi,"unionAll");function tu(R){if(R[0]==="<"&&(R=R.substring(1,R.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(R))return R;if(!Ve.base)throw new Error("Cannot resolve relative IRI "+R+" because no base IRI was set.");switch(ao!==Ve.base&&(ao=Ve.base,nE=ao.replace(/[^\/:]*$/,""),iE=ao.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),R[0]){case void 0:return ao;case"#":return ao+R;case"?":return ao.replace(/(?:\?.*)?$/,R);case"/":return iE+R;default:return nE+R}}o(tu,"resolveIRI");function ny(R){if(R){var I=R[0];if(I==="?"||I==="$")return Ve.factory.variable(R.substr(1))}return R}o(ny,"toVar");function Or(R,I){return{type:"operation",operator:R,args:I||[]}}o(Or,"operation");function nc(R,I){var O={expression:R==="*"?new ud:R};if(I)for(var N in I)O[N]=I[N];return O}o(nc,"expression");function ic(R,I){return{type:"path",pathType:R,items:I}}o(ic,"path");function iy(R,I){for(var O=0,N=I.length,re;O<N&&(re=I[O]);O++)R=Or(re[0],[R,re[1]]);return R}o(iy,"createOperationTree");function co(R,I){var O=[],N=[],re=R.length,ke,g={};if(!re)return null;for(var sn=0;sn<re&&(ke=R[sn]);sn++)(ke.named?N:O).push(ke.iri);return g[I||"from"]={default:O,named:N},g}o(co,"groupDatasets");function sc(R){return parseInt(R,10)}o(sc,"toInt");function sy(R){return R.type==="group"&&R.patterns.length===1?R.patterns[0]:R}o(sy,"degroupSingle");function Ki(R,I){return I&&I.termType!=="NamedNode"&&(I=Ve.factory.namedNode(I)),Ve.factory.literal(R,I)}o(Ki,"createTypedLiteral");function YD(R,I){return Ve.factory.literal(R,I)}o(YD,"createLangLiteral");function ay(R,I,O){if(!("termType"in I))throw new Error("Nested triples cannot contain paths");return Ve.factory.quad(R,I,O)}o(ay,"nestedTriple");function Ds(R,I,O,N){var re={};return R!=null&&(re.subject=R),I!=null&&(re.predicate=I),O!=null&&(re.object=O),N!=null&&(re.annotations=N),re}o(Ds,"triple");function ru(R){return typeof R=="string"?R.startsWith("e_")?Ve.factory.blankNode(R):Ve.factory.blankNode("e_"+R):Ve.factory.blankNode("g_"+sE++)}o(ru,"blank");var sE=0;Ve._resetBlanks=function(){sE=0};var XD=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,JD={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
|
|
36
|
+
`,r:"\r",f:"\f"},ZD=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,oy=String.fromCharCode;function aE(R,I){R=R.substring(I,R.length-I);try{R=R.replace(XD,function(O,N,re,ke){var g;if(N){if(g=parseInt(N,16),isNaN(g))throw new Error;return oy(g)}else if(re){if(g=parseInt(re,16),isNaN(g))throw new Error;return g<65535?oy(g):oy(55296+((g-=65536)>>10),56320+(g&1023))}else{var sn=JD[ke];if(!sn)throw new Error;return sn}})}catch{return""}if(ZD.exec(R))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+R);return R}o(aE,"unescapeString");function eN(R){var I=ru(),O=I,N=[],re,ke=[];R.forEach(function(Yi){N.push(Yi.entity),oo(ke,Yi.triples)});for(var g=0,sn=0,_=N.length,re=Array(_*2);g<_;)re[sn++]=Ds(O,Ve.factory.namedNode(HD),N[g]),re[sn++]=Ds(O,Ve.factory.namedNode(QD),O=++g<_?ru():Ve.factory.namedNode(Z2));return{entity:I,triples:oo(re,ke)}}o(eN,"createList");function tN(R){var I=ru();return{entity:I,triples:R.map(function(O){return qt(Ds(I),O)})}}o(tN,"createAnonymousObject");function cy(R,I,O){var N=[],re=[];return I.forEach(function(ke){let g=null;ke.annotation&&(g=ke.annotation,ke=ke.object),N.push(Ds(null,R,ke.entity,g)),oo(re,ke.triples)}),Qi(N,O||[],re)}o(cy,"objectListToTriples");function $X(R){for(var I=[],O,N=0,re;re=R[N];N++)switch(re.type){case"bgp":re.triples.length&&(O?oo(O.triples,re.triples):Fs(I,O=re));break;default:(!re.patterns||re.patterns.length>0)&&(Fs(I,re),O=null)}return I}o($X,"mergeAdjacentBGPs");function ac(R){return R.variable?R.variable.value:R.value||R.expression.value}o(ac,"getExpressionId");function ly(R){if(!R)return[];if(R.type==="aggregate")return[R];if(R.type==="operation"){let I=[];for(let O of R.args)I.push(...ly(O));return I}return[]}o(ly,"getAggregatesOfExpression");function rN(R){let I=new Set,O=o(function(N){N&&(N.termType==="Variable"?I.add(N):N.type==="operation"&&N.args.forEach(O))},"visitExpression");return O(R),I}o(rN,"getVariablesFromExpression");function uy(R,I=1,O=[]){for(let N of R)I>0&&N instanceof Array?uy(N,I-1,O):O.push(N);return O}o(uy,"flatten");function fy(R){return R.termType==="Variable"}o(fy,"isVariable");function oE(R){if(R.triples){let I=[];for(let O of R.triples)fy(O.subject)&&I.push(O.subject.value),fy(O.predicate)&&I.push(O.predicate.value),fy(O.object)&&I.push(O.object.value);return I}else if(R.patterns){let I=[];for(let O of R.patterns)I.push(...oE(O));return I}return[]}o(oE,"getBoundVarsFromGroupGraphPattern");function nN(R){let I=R.slice().sort(),O=[];for(let N=0;N<I.length-1;N++)I[N+1]==I[N]&&O.push(I[N]);return O}o(nN,"getDuplicatesInArray");function nu(R){if(!Ve.sparqlStar)throw new Error("SPARQL-star support is not enabled");return R}o(nu,"ensureSparqlStar");function cE(R,I,O){for(let N of I){let re=Ds("subject"in N?N.subject:R,N.predicate,N.object);O.push(re),N.annotations&&cE(ay(R,N.predicate,N.object),N.annotations,O)}}o(cE,"_applyAnnotations");function dy(R){if(Ve.sparqlStar){let I=[];return R.forEach(O=>{let N=Ds(O.subject,O.predicate,O.object);I.push(N),O.annotations&&cE(ay(O.subject,O.predicate,O.object),O.annotations,I)}),I}return R}o(dy,"applyAnnotations");function VX(R){if(!Ve.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return R}o(VX,"ensureSparqlStarNestedQuads");function lE(R){for(let I of R){if(I.type==="graph"&&I.name.termType==="Variable")throw new Error("Detected illegal variable in GRAPH");if(I.type==="bgp"||I.type==="graph"){for(let O of I.triples)if(O.subject.termType==="Variable"||O.predicate.termType==="Variable"||O.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return R}o(lE,"ensureNoVariables");function hy(R){for(let I of R)if(I.type==="bgp"){for(let O of I.triples)if(O.subject.termType==="BlankNode"||O.predicate.termType==="BlankNode"||O.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return R}o(hy,"ensureNoBnodes");var iN=(function(){var R={EOF:1,parseError:o(function(O,N){if(this.yy.parser)this.yy.parser.parseError(O,N);else throw new Error(O)},"parseError"),setInput:o(function(I,O){return this.yy=O||this.yy||{},this._input=I,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var I=this._input[0];this.yytext+=I,this.yyleng++,this.offset++,this.match+=I,this.matched+=I;var O=I.match(/(?:\r\n?|\n).*/g);return O?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),I},"input"),unput:o(function(I){var O=I.length,N=I.split(/(?:\r\n?|\n)/g);this._input=I+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-O),this.offset-=O;var re=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),N.length-1&&(this.yylineno-=N.length-1);var ke=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:N?(N.length===re.length?this.yylloc.first_column:0)+re[re.length-N.length].length-N[0].length:this.yylloc.first_column-O},this.options.ranges&&(this.yylloc.range=[ke[0],ke[0]+this.yyleng-O]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
37
37
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(I){this.unput(this.match.slice(I))},"less"),pastInput:o(function(){var I=this.matched.substr(0,this.matched.length-this.match.length);return(I.length>20?"...":"")+I.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var I=this.match;return I.length<20&&(I+=this._input.substr(0,20-I.length)),(I.substr(0,20)+(I.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var I=this.pastInput(),O=new Array(I.length+1).join("-");return I+this.upcomingInput()+`
|
|
38
|
-
`+O+"^"},"showPosition"),test_match:o(function(I,O){var N,
|
|
39
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var O=this.next();return O||this.lex()},"lex"),begin:o(function(O){this.conditionStack.push(O)},"begin"),popState:o(function(){var O=this.conditionStack.length-1;return O>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(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:o(function(O){return O=this.conditionStack.length-1-Math.abs(O||0),O>=0?this.conditionStack[O]:"INITIAL"},"topState"),pushState:o(function(O){this.begin(O)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:o(function(O,N,ne,ke){var g=ke;switch(ne){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(N.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 R})();ry.lexer=iN;function Ve(){this.yy={}}return o(Ve,"Parser"),Ve.prototype=ry,ry.Parser=Ve,new Ve})();YT.exports=Hj});var t3=b((Ite,e3)=>{var Qj="http://www.w3.org/2001/XMLSchema#integer",Kj="http://www.w3.org/2001/XMLSchema#string";function xt(n){this._options=n=n||{};var e=n.prefixes||{};this._prefixByIri={};var t=[];for(var r in e){var i=e[r];Iu(i)&&(this._prefixByIri[i]=r,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=n.sparqlStar,this._indent=Iu(n.indent)?n.indent:" ",this._newline=Iu(n.newline)?n.newline:`
|
|
38
|
+
`+O+"^"},"showPosition"),test_match:o(function(I,O){var N,re,ke;if(this.options.backtrack_lexer&&(ke={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&&(ke.yylloc.range=this.yylloc.range.slice(0))),re=I[0].match(/(?:\r\n?|\n).*/g),re&&(this.yylineno+=re.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:re?re[re.length-1].length-re[re.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+I[0].length},this.yytext+=I[0],this.match+=I[0],this.matches=I,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(I[0].length),this.matched+=I[0],N=this.performAction.call(this,this.yy,this,O,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),N)return N;if(this._backtrack){for(var g in ke)this[g]=ke[g];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var I,O,N,re;this._more||(this.yytext="",this.match="");for(var ke=this._currentRules(),g=0;g<ke.length;g++)if(N=this._input.match(this.rules[ke[g]]),N&&(!O||N[0].length>O[0].length)){if(O=N,re=g,this.options.backtrack_lexer){if(I=this.test_match(N,ke[g]),I!==!1)return I;if(this._backtrack){O=!1;continue}else return!1}else if(!this.options.flex)break}return O?(I=this.test_match(O,ke[re]),I!==!1?I:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
39
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var O=this.next();return O||this.lex()},"lex"),begin:o(function(O){this.conditionStack.push(O)},"begin"),popState:o(function(){var O=this.conditionStack.length-1;return O>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(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:o(function(O){return O=this.conditionStack.length-1-Math.abs(O||0),O>=0?this.conditionStack[O]:"INITIAL"},"topState"),pushState:o(function(O){this.begin(O)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:o(function(O,N,re,ke){var g=ke;switch(re){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(N.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 R})();ry.lexer=iN;function Ve(){this.yy={}}return o(Ve,"Parser"),Ve.prototype=ry,ry.Parser=Ve,new Ve})();YT.exports=Hj});var t3=b((Ite,e3)=>{var Qj="http://www.w3.org/2001/XMLSchema#integer",Kj="http://www.w3.org/2001/XMLSchema#string";function xt(n){this._options=n=n||{};var e=n.prefixes||{};this._prefixByIri={};var t=[];for(var r in e){var i=e[r];Iu(i)&&(this._prefixByIri[i]=r,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=n.sparqlStar,this._indent=Iu(n.indent)?n.indent:" ",this._newline=Iu(n.newline)?n.newline:`
|
|
40
40
|
`,this._explicitDatatype=!!n.explicitDatatype}o(xt,"Generator");xt.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=$n(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:Ea(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+ph(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=$n(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+$n(n.group,void 0,function(t){var r=Ea(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+ph(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+$n(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+$n(n.order,void 0,function(t){var r="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+r:r},this)+this._newline),n.offset&&(e+="OFFSET "+n.offset+this._newline),n.limit&&(e+="LIMIT "+n.limit+this._newline),n.values&&(e+=this.values(n)),e=this.baseAndPrefixes(n)+e,e.trim()};xt.prototype.baseAndPrefixes=function(n){var e=n.base?"BASE <"+n.base+">"+this._newline:"",t="";for(var r in n.prefixes)(this._options.allPrefixes||this._usedPrefixes[r])&&(t+="PREFIX "+r+": <"+n.prefixes[r]+">"+this._newline);return e+t};xt.prototype.toPattern=function(n){var e=n.type||n instanceof Array&&"array"||(n.subject&&n.predicate&&n.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](n)};xt.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};xt.prototype.array=function(n){return $n(n,this._newline,this.toPattern,this)};xt.prototype.bgp=function(n){return this.encodeTriples(n.triples)};xt.prototype.encodeTriples=function(n){if(!n.length)return"";for(var e=[],t=void 0,r=void 0,i=0;i<n.length;i++){var s=n[i];vo(s.subject,t)?vo(s.predicate,r)?e.push(","):(r=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(r))):(t&&e.push("."+this._newline),t=s.subject,r=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(r))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};xt.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};xt.prototype.graphs=function(n,e){return!e||e.length===0?"":$n(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};xt.prototype.group=function(n,e){return n=e!==!0?this.array(n.patterns||n.triples):this.toPattern(n.type!=="group"?n:n.patterns),n.indexOf(this._newline)===-1?"{ "+n+" }":"{"+this._newline+this.indent(n)+this._newline+"}"};xt.prototype.query=function(n){return this.toQuery(n)};xt.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};xt.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+ph(n.variable)+")"};xt.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};xt.prototype.union=function(n){return $n(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};xt.prototype.minus=function(n){return"MINUS "+this.group(n)};xt.prototype.values=function(n){var e=Object.keys(n.values.reduce(function(i,s){for(var a in s)i[a]=!0;return i},{})),t,r;return e.length===1?t=r="":(t="(",r=")"),"VALUES "+t+e.join(" ")+r+" {"+this._newline+$n(n.values,this._newline,function(i){return" "+t+$n(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};xt.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};xt.prototype.toExpression=function(n){if(Ea(n))return this.toEntity(n);switch(n.type.toLowerCase()){case"aggregate":return n.aggregation.toUpperCase()+"("+(n.distinct?"DISTINCT ":"")+this.toExpression(n.expression)+(typeof n.separator=="string"?'; SEPARATOR = "'+n.separator.replace(JT,ZT)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+$n(n.args,", ",this.toExpression,this)+")";case"operation":var e=n.operator.toUpperCase(),t=n.args||[];switch(n.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(Ea(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Ea(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+"("+(Iu(t[1])?t[1]:$n(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+$n(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};xt.prototype.toEntity=function(n){if(Ea(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return ph(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(JT,ZT)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case Kj:return n;case Qj:if(/^\d+$/.test(e))return e+" "}n+="^^"+this.encodeIRI(r.value)}return n;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return n.graph&&n.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(n.graph)+" { "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" } >>":"<< "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" >>";default:return this.encodeIRI(n.value)}else{var i=n.items.map(this.toEntity,this),s=n.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var JT=/["\\\t\n\r\b\f]/g,ZT=o(function(n){return Yj[n]},"escapeReplacer"),Yj={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};xt.prototype.encodeIRI=function(n){var e=this._prefixRegex.exec(n);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+n+">"};xt.prototype.toUpdate=function(n){switch(n.type||n.updateType){case"load":return"LOAD"+(n.source?" "+this.toEntity(n.source):"")+(n.destination?" INTO GRAPH "+this.toEntity(n.destination):"");case"insert":return"INSERT DATA "+this.group(n.insert,!0);case"delete":return"DELETE DATA "+this.group(n.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(n.delete,!0);case"insertdelete":return(n.graph?"WITH "+this.toEntity(n.graph)+this._newline:"")+(n.delete.length?"DELETE "+this.group(n.delete,!0)+this._newline:"")+(n.insert.length?"INSERT "+this.group(n.insert,!0)+this._newline:"")+(n.using?this.graphs("USING ",n.using.default):"")+(n.using?this.graphs("USING NAMED ",n.using.named):"")+"WHERE "+this.group(n.where,!0);case"add":case"copy":case"move":return n.type.toUpperCase()+" "+(n.silent?"SILENT ":"")+(n.source.default?"DEFAULT":this.toEntity(n.source.name))+" TO "+this.toEntity(n.destination.name);case"create":case"clear":case"drop":return n.type.toUpperCase()+(n.silent?" SILENT ":" ")+(n.graph.default?"DEFAULT":n.graph.named?"NAMED":n.graph.all?"ALL":"GRAPH "+this.toEntity(n.graph.name));default:throw new Error("Unknown update query type: "+n.type)}};xt.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function ph(n){return"?"+n.value}o(ph,"variableToString");function Iu(n){return typeof n=="string"}o(Iu,"isString");function Ea(n){return typeof n.termType=="string"}o(Ea,"isTerm");function vo(n,e){if(!n||!Ea(n)||!e||!Ea(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&vo(n.datatype,e.datatype);case"Quad":return vo(n.subject,e.subject)&&vo(n.predicate,e.predicate)&&vo(n.object,e.object)&&vo(n.graph,e.graph);default:return n.value===e.value}}o(vo,"equalTerms");function $n(n,e,t,r){return n.map(t,r).join(Iu(e)?e:" ")}o($n,"mapJoin");function Xj(n={}){return{stringify:o(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new xt(t).toQuery(e)},"stringify"),createGenerator:o(function(){return new xt(n)},"createGenerator")}}o(Xj,"_Generator");e3.exports={Generator:Xj}});var l_=b(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.BlankNode=void 0;var c_=class{static{o(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};mh.BlankNode=c_});var u_=b(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.DefaultGraph=void 0;var Cu=class{static{o(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};gh.DefaultGraph=Cu;Cu.INSTANCE=new Cu});var _h=b(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.NamedNode=void 0;var f_=class{static{o(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};yh.NamedNode=f_});var d_=b(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.Literal=void 0;var r3=_h(),Ru=class n{static{o(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=n.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=n.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};bh.Literal=Ru;Ru.RDF_LANGUAGE_STRING=new r3.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");Ru.XSD_STRING=new r3.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var p_=b(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.Quad=void 0;var h_=class{static{o(this,"Quad")}constructor(e,t,r,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,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)}};Sh.Quad=h_});var g_=b(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.Variable=void 0;var m_=class{static{o(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};wh.Variable=m_});var i3=b(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.DataFactory=void 0;var Jj=l_(),Zj=u_(),n3=d_(),eM=_h(),tM=p_(),rM=g_(),nM=0,y_=class{static{o(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${nM++}_`}namedNode(e){return new eM.NamedNode(e)}blankNode(e){return new Jj.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new n3.Literal(e,t)}variable(e){return new rM.Variable(e)}defaultGraph(){return Zj.DefaultGraph.INSTANCE}quad(e,t,r,i){return new tM.Quad(e,t,r,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(n3.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}};vh.DataFactory=y_});var s3=b(Vn=>{"use strict";var iM=Vn&&Vn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Eo=Vn&&Vn.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&iM(e,n,t)};Object.defineProperty(Vn,"__esModule",{value:!0});Eo(l_(),Vn);Eo(i3(),Vn);Eo(u_(),Vn);Eo(d_(),Vn);Eo(_h(),Vn);Eo(p_(),Vn);Eo(g_(),Vn)});var o3=b((Gte,a3)=>{var{Parser:Us}=XT(),{Generator:sM}=t3(),{Wildcard:aM}=o_(),{DataFactory:oM}=s3();function cM({prefixes:n,baseIRI:e,factory:t,pathOnly:r,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:a}={}){let c={};for(let u in n??{})c[u]=n[u];let l=new Us;return l.parse=function(){return Us.base=e||"",Us.prefixes=Object.create(c),Us.factory=t||new oM,Us.sparqlStar=!!i,Us.pathOnly=!!r,Us.skipValidation=!!s||!!a,Us.prototype.parse.apply(l,arguments)},l._resetBlanks=Us._resetBlanks,l}o(cM,"_Parser");a3.exports={Parser:cM,Generator:sM,Wildcard:aM}});var b_=b(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.CaseWhenTransformerError=gc.CaseWhenTransformer=void 0;var __=class{static{o(this,"CaseWhenTransformer")}transform(e){let t=this.stripLineComments(e),r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new qs("Too many nested CASE expressions (max 100 iterations)");while(t!==r);return t}stripLineComments(e){let t="",r=0;for(;r<e.length;){let i=e[r];if(i==="'"||i==='"'){let s=i;for(t+=i,r++;r<e.length&&e[r]!==s;){if(e[r]==="\\"&&r+1<e.length){t+=e[r]+e[r+1],r+=2;continue}t+=e[r],r++}r<e.length&&(t+=e[r],r++);continue}if(i==="<"){let s=e.indexOf(">",r),a=e.indexOf(`
|
|
41
41
|
`,r);if(s!==-1&&(a===-1||s<a)){t+=e.substring(r,s+1),r=s+1;continue}}if(i==="#"){let s=e.indexOf(`
|
|
42
42
|
`,r),a=s===-1?e.length:s;t+=" ".repeat(a-r),r=a;continue}t+=i,r++}return t}transformSinglePass(e){let t=this.findCasePositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractCaseExpression(r,s);if(a){let c=this.convertCaseToIf(a.content);r=r.substring(0,s)+c+r.substring(s+a.length)}}return r}findCasePositions(e){let t=[],r=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(r.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){t.push(i),i+=4;continue}i++}return t}extractCaseExpression(e,t){let r=1,i=t+4,s=e.toUpperCase();for(;i<e.length&&r>0;){if(e[i]==="'"||e[i]==='"'){let a=e[i];for(i++;i<e.length&&e[i]!==a;)e[i]==="\\"&&i++,i++;i++;continue}if(s.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){r++,i+=4;continue}if(s.substring(i,i+3)==="END"&&this.isWordBoundary(e,i,3)){if(r--,r===0){let a=e.substring(t,i+3);return{content:a,length:a.length}}i+=3;continue}i++}if(r>0)throw new qs(`Unclosed CASE expression at position ${t}`);return null}isWordBoundary(e,t,r){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_?$]/.test(i),a=t+r<e.length?e[t+r]:"",c=t+r>=e.length||!/[a-zA-Z0-9_]/.test(a);return s&&c}convertCaseToIf(e){let t=this.extractWhenClauses(e),r=this.extractElseClause(e);if(t.length===0)throw new qs("CASE expression must have at least one WHEN clause");let i=r!==null?r:'""';for(let s=t.length-1;s>=0;s--){let{condition:a,result:c}=t[s];i=`IF(${a}, ${c}, ${i})`}return i}extractWhenClauses(e){let t=[],r=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),i=this.findKeywordPositions(r,"WHEN"),s=this.findKeywordPositions(r,"ELSE"),a=s.length>0?s[0]:r.length;for(let c=0;c<i.length;c++){let l=i[c]+4,u=c+1<i.length?i[c+1]:a,f=r.substring(l,u).trim(),d=this.parseWhenClause(f);d&&t.push(d)}return t}findKeywordPositions(e,t){let r=[],i=e.toUpperCase(),s=0,a=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==="("){a++,s++;continue}if(c===")"){a--,s++;continue}if(a===0&&i.substring(s,s+t.length)===t&&this.isWordBoundary(e,s,t.length)){r.push(s),s+=t.length;continue}s++}return r}parseWhenClause(e){let t=this.findKeywordPositions(e,"THEN");if(t.length===0)throw new qs(`WHEN clause missing THEN keyword: ${e.substring(0,50)}...`);let r=t[0],i=e.substring(0,r).trim(),s=e.substring(r+4).trim();if(!i)throw new qs("WHEN clause has empty condition");if(!s)throw new qs("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,""),r=this.findKeywordPositions(t,"ELSE");if(r.length>0){let i=r[0];return t.substring(i+4).trim()}return null}};gc.CaseWhenTransformer=__;var qs=class extends Error{static{o(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};gc.CaseWhenTransformerError=qs});var S_=b(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.LateralTransformerError=yc.LateralTransformer=void 0;var Eh=class n{static{o(this,"LateralTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Ta("Too many nested LATERAL joins (max 100 iterations)");while(t!==r);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 r of t.variables)if(r.termType==="Variable"&&r.value===n.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===n.LATERAL_MARKER)return!0}return!1}transformSinglePass(e){let t=this.findLateralPositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractLateralExpression(r,s);if(a){let c=this.transformLateral(a.content);r=r.substring(0,s)+c+r.substring(s+a.length)}}return r}findLateralPositions(e){let t=[],r=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]!==`
|
|
@@ -45,7 +45,7 @@ Expecting `+yd.join(", ")+", got '"+(this.terminals_[dt]||dt)+"'":my="Parse erro
|
|
|
45
45
|
`)+`
|
|
46
46
|
`+s.trimStart()),s}findPrefixStarDeclarations(e){let t=[],r=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(r.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 a=i;for(;i<e.length&&e[i]!==">";)i++;if(e[i]===">"){let c=e.substring(a,i);i++;let l=this.findDeclarationEnd(e,i);t.push({uri:c,startPos:s,endPos:l}),i=l;continue}else throw new _c(`Unclosed IRI in PREFIX* declaration at position ${a}`)}else throw new _c(`Expected IRI after PREFIX* at position ${i}`)}else continue}i++}return t}findDeclarationEnd(e,t){let r=t;for(;r<e.length;){let i=e[r];if(i===`
|
|
47
47
|
`)return r+1;let s=e.substring(r).toUpperCase();if(s.startsWith("PREFIX")||s.startsWith("BASE")||s.startsWith("SELECT")||s.startsWith("CONSTRUCT")||s.startsWith("DESCRIBE")||s.startsWith("ASK"))return r;if(/\s/.test(i)){r++;continue}break}return r}extractPrefixFromUri(e){let t=e.replace(/^https?:\/\//,"");t=t.replace(/\/$/,"").replace(/#$/,"");let r=t.split(/[/.#]+/).filter(Boolean);if(r.length===0)return null;let i=r[r.length-1];return/^(ontology|vocab|schema|ns|core)$/i.test(i)&&r.length>1?r[r.length-2].toLowerCase():i.toLowerCase().replace(/[^a-z0-9]/g,"")}};Aa.PrefixStarTransformer=w_;var _c=class extends Error{static{o(this,"PrefixStarTransformerError")}constructor(e){super(`PREFIX* transformation error: ${e}`),this.name="PrefixStarTransformerError"}};Aa.PrefixStarTransformerError=_c});var v_=b(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.DescribeOptionsTransformer=Sc.DescribeOptionsTransformerError=void 0;var Ah=class extends Error{static{o(this,"DescribeOptionsTransformerError")}constructor(e){super(e),this.name="DescribeOptionsTransformerError"}};Sc.DescribeOptionsTransformerError=Ah;var bc=class n{static{o(this,"DescribeOptionsTransformer")}transform(e){if(!n.DESCRIBE_QUERY_PATTERN.test(e))return{query:e};let t=e,r={},i=!1,s=n.DEPTH_PATTERN.exec(e);if(s){let a=parseInt(s[1],10);if(a<0)throw new Ah(`DESCRIBE DEPTH must be a non-negative integer, got: ${a}`);r.depth=a,i=!0,n.DEPTH_PATTERN.lastIndex=0,t=t.replace(n.DEPTH_PATTERN,"")}return n.DEPTH_PATTERN.lastIndex=0,n.SYMMETRIC_PATTERN.test(e)&&(r.symmetric=!0,i=!0,n.SYMMETRIC_PATTERN.lastIndex=0,t=t.replace(n.SYMMETRIC_PATTERN,"")),n.SYMMETRIC_PATTERN.lastIndex=0,t=t.replace(/\s{2,}/g," ").trim(),{query:t,options:i?r:void 0}}hasDescribeOptions(e){let t=n.DEPTH_PATTERN.test(e);n.DEPTH_PATTERN.lastIndex=0;let r=n.SYMMETRIC_PATTERN.test(e);return n.SYMMETRIC_PATTERN.lastIndex=0,t||r}};Sc.DescribeOptionsTransformer=bc;bc.DEPTH_PATTERN=/\bDEPTH\s+(\d+)/gi;bc.SYMMETRIC_PATTERN=/\bSYMMETRIC\b/gi;bc.DESCRIBE_QUERY_PATTERN=/\bDESCRIBE\b/i});var l3=b(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});wc.DirectionalLangTagTransformerError=wc.DirectionalLangTagTransformer=void 0;var xh=class n{static{o(this,"DirectionalLangTagTransformer")}constructor(){this.directionMappings=new Map}transform(e){return this.directionMappings.clear(),e.replace(n.DIRECTIONAL_TAG_REGEX,(t,r,i,s,a)=>{let c=s.toLowerCase();return this.directionMappings.set(c,a),`${r}${i}${r}@${s}`})}getDirection(e){return this.directionMappings.get(e.toLowerCase())}getAllMappings(){return new Map(this.directionMappings)}hasDirectionalTags(e){return n.DIRECTIONAL_TAG_REGEX.lastIndex=0,n.DIRECTIONAL_TAG_REGEX.test(e)}clearMappings(){this.directionMappings.clear()}};wc.DirectionalLangTagTransformer=xh;xh.DIRECTIONAL_TAG_REGEX=/(["'])((?:[^\\]|\\.)*?)\1@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)--(ltr|rtl)/g;var E_=class extends Error{static{o(this,"DirectionalLangTagTransformerError")}constructor(e){super(`Directional language tag transformation error: ${e}`),this.name="DirectionalLangTagTransformerError"}};wc.DirectionalLangTagTransformerError=E_});var u3=b(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.TripleTermTransformerError=Ec.TripleTermTransformer=void 0;var T_=class{static{o(this,"TripleTermTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new vc("Too many nested triple terms (max 100 iterations)");while(t!==r);return t}hasTripleTermSyntax(e){return this.findTripleTermPositions(e).length>0}transformSinglePass(e){let t=this.findTripleTermPositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractTripleTerm(r,s);if(a){let c=this.convertToStandardSyntax(a.content);r=r.substring(0,s)+c+r.substring(s+a.length)}}return r}findTripleTermPositions(e){let t=[],r=0;for(;r<e.length;){if(e[r]==="'"){r=this.skipStringLiteral(e,r,"'");continue}if(e[r]==='"'){r=this.skipStringLiteral(e,r,'"');continue}if(e.substring(r,r+2)==="<<"&&this.isParenthesizedTripleTerm(e,r)){t.push(r),r+=2;continue}r++}return t}skipStringLiteral(e,t,r){let i=r.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]!==r;)e[t]==="\\"&&t++,t++;return t+1}isParenthesizedTripleTerm(e,t){let r=t+2;for(;r<e.length&&/\s/.test(e[r]);)r++;return e[r]==="("}extractTripleTerm(e,t){let r=t+2;for(;r<e.length&&/\s/.test(e[r]);)r++;if(e[r]!=="(")return null;r++;let i=1;for(;r<e.length&&i>0;){if(e[r]==="'"||e[r]==='"'){r=this.skipStringLiteral(e,r,e[r]);continue}if(e.substring(r,r+2)==="<<"&&this.isParenthesizedTripleTerm(e,r)){for(r+=2;r<e.length&&/\s/.test(e[r]);)r++;e[r]==="("&&(i++,r++);continue}if(e.substring(r,r+2)==="<<"){r+=2;let s=1;for(;r<e.length&&s>0;){if(e[r]==="'"||e[r]==='"'){r=this.skipStringLiteral(e,r,e[r]);continue}if(e.substring(r,r+2)==="<<"){s++,r+=2;continue}if(e.substring(r,r+2)===">>"){s--,r+=2;continue}r++}continue}if(e[r]==="("){i++,r++;continue}if(e[r]===")"){let s=r+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(e.substring(s,s+2)===">>"){if(i--,i===0){let a=e.substring(t,s+2);return{content:a,length:a.length}}r=s+2;continue}r++;continue}r++}if(i>0)throw new vc(`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 vc(`Invalid triple term syntax: ${e.substring(0,50)}...`);return`<< ${t[1]} >>`}};Ec.TripleTermTransformer=T_;var vc=class extends Error{static{o(this,"TripleTermTransformerError")}constructor(e){super(`Triple term transformation error: ${e}`),this.name="TripleTermTransformerError"}};Ec.TripleTermTransformerError=vc});var x_=b(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.VaultPrefixTransformer=void 0;var lM=/PREFIX\s+(\w+)\s*:/gi,uM=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"]),A_=class{static{o(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),r=[];for(let[a,c]of this.vaultPrefixes)!t.has(a.toLowerCase())&&!uM.has(a.toLowerCase())&&r.push({prefix:a,baseIRI:c});if(r.length===0)return e;let i="",s=0;for(;s<e.length;){let a=e[s];if(a==='"'||a==="'"){let l=this.skipLiteral(e,s);i+=e.substring(s,l),s=l;continue}if(a==="<"){let l=e.indexOf(">",s);l!==-1?(i+=e.substring(s,l+1),s=l+1):(i+=a,s++);continue}if(a==="#"){let l=e.indexOf(`
|
|
48
|
-
`,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,r);if(c){i+=c.iri,s=c.endIndex;continue}i+=a,s++}return i}tryReplacePrefixedName(e,t,r){if(t>0&&/[a-zA-Z0-9_]/.test(e[t-1]))return null;for(let{prefix:i,baseIRI:s}of r){if(e.substring(t,t+i.length+1)!==i+":")continue;let a=t+i.length+1,c=a;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===a)continue;let l=e.substring(a,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,r=new RegExp(lM.source,"gi"),i;for(;(i=r.exec(e))!==null;)t.add(i[1].toLowerCase());return t}skipLiteral(e,t){let r=e[t];if(t+2<e.length&&e.substring(t,t+3)===r+r+r){let s=e.indexOf(r+r+r,t+3);return s!==-1?s+3:e.length}let i=t+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;return i<e.length?i+1:e.length}};Ih.VaultPrefixTransformer=A_});var Tc=b(In=>{"use strict";var fM=In&&In.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),dM=In&&In.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),hM=In&&In.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&fM(t,e,r[i]);return dM(t,e),t}})();Object.defineProperty(In,"__esModule",{value:!0});In.SPARQLParser=In.ExoQLParser=In.SPARQLParseError=void 0;var f3=hM(o3()),I_=b_(),C_=S_(),d3=c3(),R_=v_(),pM=l3(),O_=u3(),mM=x_(),sr=class extends Error{static{o(this,"SPARQLParseError")}constructor(e,t,r,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=r}};In.SPARQLParseError=sr;var Ch=class{static{o(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new f3.Parser({sparqlStar:!0}),this.generator=new f3.Generator({sparqlStar:!0}),this.caseWhenTransformer=new I_.CaseWhenTransformer,this.lateralTransformer=new C_.LateralTransformer,this.prefixStarTransformer=new d3.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new R_.DescribeOptionsTransformer,this.directionalLangTagTransformer=new pM.DirectionalLangTagTransformer,this.tripleTermTransformer=new O_.TripleTermTransformer,this.vaultPrefixTransformer=new mM.VaultPrefixTransformer}setVaultPrefixes(e){this.vaultPrefixTransformer.setVaultPrefixes(e)}parse(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.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 R_.DescribeOptionsTransformerError)throw new sr(t.message);if(t instanceof C_.LateralTransformerError)throw new sr(t.message);if(t instanceof I_.CaseWhenTransformerError)throw new sr(t.message);if(t instanceof O_.TripleTermTransformerError)throw new sr(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new sr(`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),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.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 R_.DescribeOptionsTransformerError)throw new sr(t.message);if(t instanceof d3.PrefixStarTransformerError)throw new sr(t.message);if(t instanceof C_.LateralTransformerError)throw new sr(t.message);if(t instanceof I_.CaseWhenTransformerError)throw new sr(t.message);if(t instanceof O_.TripleTermTransformerError)throw new sr(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new sr(`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 sr(`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 sr("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 sr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new sr(`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 sr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};In.ExoQLParser=Ch;In.SPARQLParser=Ch});var To=b(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});Rh.AlgebraTranslatorError=void 0;var P_=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};Rh.AlgebraTranslatorError=P_});var Oh=b(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.isVariableExpression=gM;ts.isVariableTerm=yM;ts.isNamedNode=_M;ts.isLiteral=bM;ts.isPropertyPath=SM;ts.isAggregateExpression=wM;ts.isOperationExpression=vM;ts.isFunctionCallExpression=EM;function gM(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}o(gM,"isVariableExpression");function yM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}o(yM,"isVariableTerm");function _M(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}o(_M,"isNamedNode");function bM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}o(bM,"isLiteral");function SM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}o(SM,"isPropertyPath");function wM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}o(wM,"isAggregateExpression");function vM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}o(vM,"isOperationExpression");function EM(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}o(EM,"isFunctionCallExpression")});var h3=b(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.TripleTranslator=void 0;var ln=To(),F_=class{static{o(this,"TripleTranslator")}constructor(){this.directionMappings=new Map}setDirectionMappings(e){this.directionMappings=e}translateBGP(e){if(!("triples"in e)||!Array.isArray(e.triples))throw new ln.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 ln.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 ln.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new ln.AlgebraTranslatorError("Property path must have items array");let t=e.items.map(r=>this.translatePathItem(r));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new ln.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new ln.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new ln.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new ln.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new ln.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 ln.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new ln.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 r=this.directionMappings.get(e.language.toLowerCase());r&&(t.direction=r)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new ln.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ln.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 ln.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 ln.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};Ph.TripleTranslator=F_});var p3=b(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.ExpressionTranslator=void 0;var Ac=To(),D_=class{static{o(this,"ExpressionTranslator")}constructor(e){this.translateWhereFn=e.translateWhere,this.translateBGPFn=e.translateBGP,this.translatePatternFn=e.translatePattern}translateExpression(e){if(!e)throw new Ac.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 r=e;return{type:"functionCall",function:r.function,args:r.args.map(i=>this.translateExpression(i))}}if("termType"in e)return this.translateTermExpression(e);throw new Ac.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new Ac.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=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"],s=e.args.filter(a=>!("patterns"in a)||"termType"in a);return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:s.map(a=>this.translateExpression(a))}: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(a=>this.translateExpression(a))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new Ac.AlgebraTranslatorError("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&"patterns"in t&&t.patterns?r=this.translateWhereFn(t.patterns):t.type==="bgp"?r=this.translateBGPFn(t):r=this.translatePatternFn(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new Ac.AlgebraTranslatorError("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],r=e.args[1];if(!Array.isArray(r))throw new Ac.AlgebraTranslatorError("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:r.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}};Fh.ExpressionTranslator=D_});var y3=b(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.PatternTranslator=void 0;var m3=S_(),Dr=To(),g3=Oh(),N_=class{static{o(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 Dr.AlgebraTranslatorError("Empty WHERE clause");let t=e.filter(a=>a.type==="filter"),r=e.filter(a=>a.type==="bind"),i=e.filter(a=>a.type!=="filter"&&a.type!=="bind"),s;if(i.length===0)s={type:"bgp",triples:[]};else if(i.length===1)if(i[0].type==="optional"){let a=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:a?this.translateExpressionFn(a):void 0}}else s=this.translatePattern(i[0]);else{if(i[0].type==="optional"){let a=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:a?this.translateExpressionFn(a):void 0}}else s=this.translatePattern(i[0]);for(let a=1;a<i.length;a++){let c=i[a];if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelectFn(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional"){let l=c.expression;s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:l?this.translateExpressionFn(l):void 0}}else{let l=this.translatePattern(c);s={type:"join",left:s,right:l}}}}for(let a of r)s=this.translateBind(a,s);for(let a of t)s={type:"filter",expression:this.translateExpressionFn(a.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new Dr.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 Dr.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Dr.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 Dr.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 Dr.AlgebraTranslatorError("UNION pattern must have at least 2 patterns");let t=o(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"),r={type:"union",left:t(e.patterns[0]),right:t(e.patterns[1])};for(let i=2;i<e.patterns.length;i++)r={type:"union",left:r,right:t(e.patterns[i])};return r}translateMinus(e){if(!e.patterns||e.patterns.length===0)throw new Dr.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 Dr.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 a=s.startsWith("?")?s.slice(1):s;t.add(a)}let r=e.values.map(i=>this.translateValuesBinding(i));return{type:"values",variables:Array.from(t),bindings:r}}translateValuesBinding(e){let t={};for(let[r,i]of Object.entries(e)){let s=r.startsWith("?")?r.slice(1):r,a=i;if(a)if(a.termType==="NamedNode")t[s]={type:"iri",value:a.value};else if(a.termType==="Literal"){let c=a,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 Dr.AlgebraTranslatorError(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Dr.AlgebraTranslatorError("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpressionFn(e.expression),input:t}}translateSubquery(e){if(e.queryType!=="SELECT")throw new Dr.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 Dr.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Dr.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 Dr.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Dr.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 Dr.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 Dr.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,g3.isVariableTerm)(i)&&i.value===m3.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){if(!("variables"in e)||!e.variables)return e;let t=e,r=t.variables;return{...t,variables:r.filter(i=>!((0,g3.isVariableTerm)(i)&&i.value===m3.LateralTransformer.LATERAL_MARKER))}}};Dh.PatternTranslator=N_});var b3=b(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.AggregateTranslator=void 0;var _3=To(),TM=Oh(),L_=class{static{o(this,"AggregateTranslator")}constructor(e){this.aggregateCounter=0,this.translateExpressionFn=e.translateExpression}resetCounter(){this.aggregateCounter=0}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)(0,TM.isVariableExpression)(i)&&("type"in i.expression&&i.expression.type==="aggregate"?(r.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,r,t));return r}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,r){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,r);return e.map(i=>this.transformExpressionWithAggregateVars(i,r))}transformExpressionWithAggregateVars(e,t){let r=t.get(e);if(r!==void 0)return{type:"variable",name:r};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)),a=["=","!=","<",">","<=",">="],c=["&&","||","!"],l=["+","-","*","/"];return a.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,r=o(()=>{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:r(),distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:r(),distinct:e.distinct||!1,separator:e.separator}}let i=t;if(i&&typeof i=="object"){let s,a=i;if(a.termType==="NamedNode"&&typeof a.value=="string")s=a.value;else if("value"in a)s=String(a.value);else throw new _3.AlgebraTranslatorError(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(i)}`);return{type:"aggregate",aggregation:{type:"custom",iri:s},expression:r(),distinct:e.distinct||!1,separator:e.separator}}throw new _3.AlgebraTranslatorError(`Unknown aggregate format: ${JSON.stringify(t)}`)}collectNestedAggregates(e,t,r){if(e){if("type"in e&&e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if("type"in e&&e.type==="operation"&&"args"in e){let i=e;for(let s of i.args)!Array.isArray(s)&&"type"in s&&!("patterns"in s)?this.collectNestedAggregates(s,t,r):"termType"in s&&this.collectNestedAggregates(s,t,r)}}}};Nh.AggregateTranslator=L_});var xc=b(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.AlgebraTranslator=xa.ExoQLAlgebraTranslator=xa.AlgebraTranslatorError=void 0;var Lh=To(),kh=Oh(),AM=h3(),xM=p3(),IM=y3(),CM=b3(),RM=To();Object.defineProperty(xa,"AlgebraTranslatorError",{enumerable:!0,get:o(function(){return RM.AlgebraTranslatorError},"get")});var jh=class{static{o(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new AM.TripleTranslator,this.expressionTranslator=new xM.ExpressionTranslator({translateWhere:o(e=>this.patternTranslator.translateWhere(e),"translateWhere"),translateBGP:o(e=>this.tripleTranslator.translateBGP(e),"translateBGP"),translatePattern:o(e=>this.patternTranslator.translatePattern(e),"translatePattern")}),this.patternTranslator=new IM.PatternTranslator({translateExpression:o(e=>this.expressionTranslator.translateExpression(e),"translateExpression"),translateSelect:o(e=>this.translateSelect(e),"translateSelect"),translateBGP:o(e=>this.tripleTranslator.translateBGP(e),"translateBGP")}),this.aggregateTranslator=new CM.AggregateTranslator({translateExpression:o(e=>this.expressionTranslator.translateExpression(e),"translateExpression")})}setDirectionMappings(e){this.tripleTranslator.setDirectionMappings(e),this.patternTranslator.setDirectionMappings(e)}translate(e){if(e.type!=="query")throw new Lh.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 Lh.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new Lh.AlgebraTranslatorError("SELECT query must have WHERE clause");let t=this.patternTranslator.translateWhere(e.where);this.aggregateTranslator.resetCounter();let r=new Map,i=Array.isArray(e.variables)?e.variables.filter(l=>!("termType"in l&&l.termType==="Wildcard")):[],s=this.aggregateTranslator.extractAggregatesWithMapping(i,r),a=this.aggregateTranslator.extractGroupVariables(e.group),c=this.aggregateTranslator.extractHavingExpressions(e.having,s,r);if((s.length>0||a.length>0||c.length>0)&&(t={type:"group",variables:a,aggregates:s,having:c.length>0?c:void 0,input:t}),i.length>0){for(let u of i)if((0,kh.isVariableExpression)(u)){if("type"in u.expression&&u.expression.type==="aggregate")continue;let f=this.aggregateTranslator.transformExpressionWithAggregateVars(u.expression,r);t={type:"extend",variable:u.variable.value,expression:f,input:t}}let l=i.filter(u=>(0,kh.isVariableTerm)(u)||(0,kh.isVariableExpression)(u)).map(u=>(0,kh.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.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(l=>this.aggregateTranslator.translateOrderComparator(l)),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 Lh.AlgebraTranslatorError("CONSTRUCT query must have WHERE clause");let r=this.patternTranslator.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(r={type:"slice",limit:i.limit,offset:i.offset,input:r}),{type:"construct",template:t,where:r}}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 a of s)a.termType==="Wildcard"||a.value==="*"||(a.termType==="Variable"?t.push({type:"variable",value:a.value}):a.termType==="NamedNode"&&t.push({type:"iri",value:a.value}))}let r;e.where&&e.where.length>0&&(r=this.patternTranslator.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};xa.ExoQLAlgebraTranslator=jh;xa.AlgebraTranslator=jh});var rs=b(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});Mh.SolutionMapping=void 0;var S3=Me(),w3=Ee(),v3=$t(),k_=class n{static{o(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,r]of this.bindings.entries()){let i=e.get(t);if(i!==void 0&&!this.areEqual(r,i))return!1}return!0}merge(e){if(!this.isCompatibleWith(e))return null;let t=new n(this.bindings);for(let[r,i]of e.getBindings().entries())t.set(r,i);return t}clone(){return new n(this.bindings)}areEqual(e,t){return e instanceof S3.Literal&&t instanceof S3.Literal?e.equals(t):e instanceof w3.IRI&&t instanceof w3.IRI?e.value===t.value:e instanceof v3.BlankNode&&t instanceof v3.BlankNode?e.id===t.id:!1}toJSON(){let e={};for(let[t,r]of this.bindings.entries())e[t]=r.toString();return e}size(){return this.bindings.size}};Mh.SolutionMapping=k_});var T3=b(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.PropertyPathExecutor=Ic.PropertyPathExecutorError=void 0;var OM=rs(),$h=Ee(),E3=$t(),PM=Me(),Ou=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Ic.PropertyPathExecutorError=Ou;var j_=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){if(this.isLiteralElement(e)||this.isLiteralElement(r)){let a=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:r,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l;console.warn(`[PropertyPathExecutor] literal-safety guard fired: literal in ${a} position \u2014 yielding 0 solutions. value="${u}"`);return}let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new OM.SolutionMapping;this.isVariable(e)&&u.set(e.value,a),this.isVariable(r)&&u.set(r.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new Ou("Predicate is not a property path");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.object,t);for await(let s of this.execute(r,e.predicate,i)){let a=t.merge(s);a!==null&&(yield a)}}async evaluatePath(e,t,r){switch(t.pathType){case"/":return this.evaluateSequencePath(e,t.items,r);case"|":return this.evaluateAlternativePath(e,t.items,r);case"^":return this.evaluateInversePath(e,t.items[0],r);case"+":return this.evaluateOneOrMorePath(e,t.items[0],r);case"*":return this.evaluateZeroOrMorePath(e,t.items[0],r);case"?":return this.evaluateZeroOrOnePath(e,t.items[0],r)}}async evaluateSequencePath(e,t,r){let i=new Set([e]);for(let s=0;s<t.length;s++){let a=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,a,c?r:null);for(let d of f)l.add(d)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,r){let i=new Set;for(let s of t){let a=await this.evaluatePathItem(e,s,r);for(let c of a)i.add(c)}return i}async evaluateInversePath(e,t,r){if(t.type==="iri"){let i=new $h.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let c=a.shift();if(!c)break;let{node:l,depth:u}=c;if(u>=this.MAX_DEPTH)continue;let f=await this.evaluatePathItem(l,t,null);for(let d of f){let h=this.nodeToKey(d);(r===null||this.nodeInSet(d,r))&&s.add(d),i.has(h)||(i.add(h),a.push({node:d,depth:u+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new $h.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}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 r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new $h.IRI(e.value));break;case"blank":t.add(new E3.BlankNode(e.value));break;default:throw new Ou(`Unsupported element type in subject/object position: ${e.type}`)}return t}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r){if(r instanceof $h.IRI)return{type:"iri",value:r.value};if(r instanceof E3.BlankNode)return{type:"blank",value:r.id};if(r instanceof PM.Literal)return{type:"literal",value:r.value,datatype:r.datatype?.value,language:r.language,direction:r.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 r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};Ic.PropertyPathExecutor=j_});var V_=b(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.BGPExecutor=Cc.BGPExecutorError=void 0;var Vh=rs(),Ia=Ee(),M_=Me(),Bh=$t(),Uh=du(),FM=T3(),qr=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Cc.BGPExecutorError=qr;var $_=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new FM.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new Vh.SolutionMapping;return}let t=this.matchTriplePattern(e.triples[0]);for(let r=1;r<e.triples.length;r++)t=this.joinWithPattern(t,e.triples[r]);for await(let r of t)yield r}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*executeInGraph(e,t){if(e.triples.length===0){yield new Vh.SolutionMapping;return}let r=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)r=this.joinWithPatternInGraph(r,e.triples[i],t);for await(let i of r)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new qr("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:r);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new qr("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,a,t);for(let l of c){let u=new Vh.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){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 t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:t);return}let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new Vh.SolutionMapping;if(this.isVariable(e.subject))l.set(e.subject.value,c.subject);else if(this.isQuotedTriple(e.subject)){let u=this.matchQuotedTriplePattern(e.subject,c.subject);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}if(this.isVariable(t)&&l.set(t.value,c.predicate),this.isVariable(e.object))l.set(e.object.value,c.object);else if(this.isQuotedTriple(e.object)){let u=this.matchQuotedTriplePattern(e.object,c.object);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}yield l}}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 Uh.QuotedTriple))return null;let r=new Map;if(this.isVariable(e.subject))r.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,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.subject,t.subject))return null;if(e.predicate.type==="variable")r.set(e.predicate.value,t.predicate);else if(e.predicate.value!==t.predicate.value)return null;if(this.isVariable(e.object))r.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,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.object,t.object))return null;return r}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof Ia.IRI&&e.value===t.value;case"literal":return!(!(t instanceof M_.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof Bh.BlankNode&&e.value===t.id;case"quoted":return t instanceof Uh.QuotedTriple?this.toRDFQuotedTriple(e).equals(t):!1;default:return!1}}isPropertyPath(e){return e.type==="path"}async*joinWithPattern(e,t){let r=[];for await(let i of e)r.push(i);for(let i of r){let s=this.instantiatePattern(t,i);for await(let a of this.matchTriplePattern(s)){let c=i.merge(a);c!==null&&(yield c)}}}instantiatePattern(e,t){let r=this.isPropertyPath(e.predicate)?e.predicate:this.instantiateElement(e.predicate,t);return{subject:this.instantiateElement(e.subject,t),predicate:r,object:this.instantiateElement(e.object,t)}}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r)return this.toAlgebraElement(r)}return this.isQuotedTriple(e)?this.instantiateQuotedTriple(e,t):e}instantiateQuotedTriple(e,t){let r=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:r,predicate:i,object:s}}instantiatePredicateVariable(e,t){let r=t.get(e.value);return r&&r instanceof Ia.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,r){let i="value"in r?String(r.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i;console.warn(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Ia.IRI(e.value);case"blank":return new Bh.BlankNode(e.value);case"literal":throw new qr("Literals cannot appear in subject position");case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new qr(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new Ia.IRI(e.predicate.value):(()=>{throw new qr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new Uh.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Ia.IRI(e.value);case"literal":throw new qr("Literals cannot appear in predicate position");case"blank":throw new qr("Blank nodes cannot appear in predicate position");case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new qr(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Ia.IRI(e.value);case"literal":return new M_.Literal(e.value,e.datatype?new Ia.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new Bh.BlankNode(e.value);case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new qr(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof Ia.IRI)return{type:"iri",value:e.value};if(e instanceof M_.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof Bh.BlankNode)return{type:"blank",value:e.id};if(e instanceof Uh.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new qr(`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)}}};Cc.BGPExecutor=$_});var A3=b(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.StringFunctions=void 0;var Rc=Ee(),Ca=Me(),B_=$t(),Pu=class n{static{o(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Rc.IRI||e instanceof Ca.Literal?e.value:e instanceof B_.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof Ca.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof Ca.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=n.parseDirectionalLangTag(e),[s,a]=n.parseDirectionalLangTag(t),c=r.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":a&&i!==a?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let r=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[r,i]}static regex(e,t,r){try{let i=r?r.includes("u")?r:r+"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,r){let i=t-1;if(i<0){if(r!==void 0){let s=r+i;return s<=0?"":e.substring(0,s)}return e}return r!==void 0?e.substring(i,i+r):e.substring(i)}static strBefore(e,t){if(t==="")return"";let r=e.indexOf(t);return r===-1?"":e.substring(0,r)}static strAfter(e,t){if(t==="")return e;let r=e.indexOf(t);return r===-1?"":e.substring(r+t.length)}static concat(...e){return e.join("")}static replace(e,t,r,i){try{let s=i||"g",a=s.includes("u")?s:s+"u",c=new RegExp(t,a);return e.replace(c,r)}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 r;if(e instanceof Ca.Literal)r=e.value;else if(e instanceof Rc.IRI)r=e.value;else if(e instanceof B_.BlankNode)r=e.id;else if(typeof e=="string")r=e;else throw new Error("NORMALIZE: first argument must be a string or literal");let i="NFC";if(t!==void 0)if(t instanceof Ca.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Rc.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!n.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=r.normalize(i);return new Ca.Literal(s,new Rc.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 Ca.Literal)t=e.value;else if(e instanceof Rc.IRI)t=e.value;else if(e instanceof B_.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let r=n.unicodeCaseFold(t);return new Ca.Literal(r,new Rc.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=n.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}};qh.StringFunctions=Pu;Pu.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Pu.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 x3=b(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.MathFunctions=void 0;var U_=class{static{o(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()}};Wh.MathFunctions=U_});var Fu=b(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.DateTimeParsing=void 0;var DM=Ee(),NM=Me(),q_=class n{static{o(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,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDayTimeDuration: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=r.indexOf("T"),a="",c="";if(s===-1?a=r:(a=r.substring(0,s),c=r.substring(s+1)),a){let l=a.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(a!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${a}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let h=parseFloat(u[1]);i+=h*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let h=parseFloat(f[1]);i+=h*60*1e3,l=l.substring(f[0].length)}let d=l.match(/^(\d+(?:\.\d+)?)S$/);if(d){let h=parseFloat(d[1]);i+=h*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,r=Math.abs(e),i=Math.floor(r/(1440*60*1e3));r=r%(1440*60*1e3);let s=Math.floor(r/(3600*1e3));r=r%(3600*1e3);let a=Math.floor(r/(60*1e3));r=r%(60*1e3);let c=r/1e3,l=t?"-P":"P";return i>0&&(l+=`${i}D`),(s>0||a>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),a>0&&(l+=`${a}M`),(c>0||s===0&&a===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return n.parseDayTimeDuration(e),new NM.Literal(e,new DM.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(r[1],10),s=parseInt(r[2],10)-1,a=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,a));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),h=parseInt(u[3],10),p=f*(d*60+h)*60*1e3;l=new Date(l.getTime()-p)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),a=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||a<0||a>59||i===24&&(s!==0||a!==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+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let h=d[1]==="+"?1:-1,p=parseInt(d[2],10),y=parseInt(d[3],10),S=h*(p*60+y)*60*1e3;f-=S}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+a;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,a=t?"-P":"P";return i>0&&(a+=`${i}Y`),(s>0||i===0)&&(a+=`${s}M`),a}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:a,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=0,a=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.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,h=d.match(/^(\d+(?:\.\d+)?)H/);h&&(s=parseFloat(h[1]),d=d.substring(h[0].length));let p=d.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),d=d.substring(p[0].length));let y=d.match(/^(\d+(?:\.\d+)?)S$/);if(y&&(c=parseFloat(y[1]),d=d.substring(y[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}};Gh.DateTimeParsing=q_});var I3=b(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.DateTimeArithmetic=void 0;var un=Ee(),Te=Me(),tt=Fu(),W_=class{static{o(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r),a=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${r}'`);if(isNaN(a.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-a.getTime(),l=tt.DateTimeParsing.formatDayTimeDuration(c);return new Te.Literal(l,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=tt.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new Te.Literal(l.toISOString(),new un.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=tt.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new Te.Literal(l.toISOString(),new un.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=tt.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=tt.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Te.Literal(h,new un.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=tt.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=tt.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Te.Literal(h,new un.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=tt.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new Te.Literal(s.toISOString(),new un.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=tt.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new Te.Literal(s.toISOString(),new un.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=tt.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=tt.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+a),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 Te.Literal(d,new un.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=tt.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=tt.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-a),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 Te.Literal(d,new un.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=tt.DateTimeParsing.parseDayTimeDuration(r),a=tt.DateTimeParsing.parseDayTimeDuration(i),c=tt.DateTimeParsing.formatDayTimeDuration(s+a);return new Te.Literal(c,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=tt.DateTimeParsing.parseDayTimeDuration(r),a=tt.DateTimeParsing.parseDayTimeDuration(i),c=tt.DateTimeParsing.formatDayTimeDuration(s-a);return new Te.Literal(c,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof Te.Literal?e.value:e,i=tt.DateTimeParsing.parseDayTimeDuration(r),s=tt.DateTimeParsing.formatDayTimeDuration(i*t);return new Te.Literal(s,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationDivide(e,t){if(t===0)throw new Error("durationDivide: division by zero");let r=e instanceof Te.Literal?e.value:e,i=tt.DateTimeParsing.parseDayTimeDuration(r),s=tt.DateTimeParsing.formatDayTimeDuration(i/t);return new Te.Literal(s,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=tt.DateTimeParsing.parseYearMonthDuration(r),a=tt.DateTimeParsing.parseYearMonthDuration(i),c=tt.DateTimeParsing.formatYearMonthDuration(s+a);return new Te.Literal(c,new un.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=tt.DateTimeParsing.parseYearMonthDuration(r),a=tt.DateTimeParsing.parseYearMonthDuration(i),c=tt.DateTimeParsing.formatYearMonthDuration(s-a);return new Te.Literal(c,new un.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Te.Literal?e.value:e;return tt.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Te.Literal?e.value:e;return tt.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Te.Literal?e.value:e;return tt.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Te.Literal?e.value:e;return tt.DateTimeParsing.parseDayTimeDuration(t)/1e3}};zh.DateTimeArithmetic=W_});var C3=b(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.DateTimeAccessors=void 0;var Du=Ee(),Nt=Me(),Tt=Fu(),G_=class{static{o(this,"DateTimeAccessors")}static year(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return t.getFullYear()}static month(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return t.getMonth()+1}static day(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return t.getDate()}static hours(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return t.getHours()}static minutes(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return t.getMinutes()}static seconds(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return t.getSeconds()+t.getMilliseconds()/1e3}static durationDays(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let r;if(e.endsWith("Z"))r="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),a=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);a===0?r=`${c}PT${l}H`:r=`${c}PT${l}H${a}M`}else{let s=-t.getTimezoneOffset(),a=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?r=`${l}PT${a}H`:r=`${l}PT${a}H${c}M`}}return new Nt.Literal(r,new Du.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 r=e.match(/([+-]\d{2}:\d{2})$/);if(r)return r[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static adjust(e,t){let r=e instanceof Nt.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let ee=i.getUTCFullYear(),B=String(i.getUTCMonth()+1).padStart(2,"0"),W=String(i.getUTCDate()).padStart(2,"0"),F=String(i.getUTCHours()).padStart(2,"0"),D=String(i.getUTCMinutes()).padStart(2,"0"),G=String(i.getUTCSeconds()).padStart(2,"0"),Re=i.getUTCMilliseconds(),et=`${ee}-${B}-${W}T${F}:${D}:${G}`;return Re>0&&(et+=`.${String(Re).padStart(3,"0")}`),new Nt.Literal(et,new Du.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof Nt.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(a)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+a),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),h=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),y=String(u.getUTCMinutes()).padStart(2,"0"),S=String(u.getUTCSeconds()).padStart(2,"0"),v=u.getUTCMilliseconds(),w=a>=0?"+":"-",T=Math.floor(Math.abs(a)/(3600*1e3)),C=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),L=`${w}${String(T).padStart(2,"0")}:${String(C).padStart(2,"0")}`,$=`${f}-${d}-${h}T${p}:${y}:${S}`;return v>0&&($+=`.${String(v).padStart(3,"0")}`),$+=L,new Nt.Literal($,new Du.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static now(){return new Date().toISOString()}static dateBefore(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t);return r<i}static dateAfter(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t);return r>i}static dateInRange(e,t,r){let i=Tt.DateTimeParsing.parseDate(e),s=Tt.DateTimeParsing.parseDate(t),a=Tt.DateTimeParsing.parseDate(r);return i>=s&&i<=a}static compareDurations(e,t,r){let i=e instanceof Nt.Literal?e.value:e,s=t instanceof Nt.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(i),c=Tt.DateTimeParsing.parseDayTimeDuration(s);switch(r){case"=":return a===c;case"!=":return a!==c;case"<":return a<c;case">":return a>c;case"<=":return a<=c;case">=":return a>=c;default:throw new Error(`compareDurations: unknown operator: ${r}`)}}static dateDiffMinutes(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static timeDiff(e,t){let r=e instanceof Nt.Literal?e.value:e,i=t instanceof Nt.Literal?t.value:t,s=Tt.DateTimeParsing.parseXSDTime(r),a=Tt.DateTimeParsing.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${r}'`);if(a===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-a,l=Tt.DateTimeParsing.formatDayTimeDuration(c);return new Nt.Literal(l,new Du.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof Nt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof Nt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof Nt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof Nt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof Nt.Literal?e.value:e,i=t instanceof Nt.Literal?t.value:t,s=Tt.DateTimeParsing.parseXSDDate(r),a=Tt.DateTimeParsing.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${r}'`);if(a===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-a.getTime(),l=Math.round(c/(1440*60*1e3)),u=Tt.DateTimeParsing.formatDateDuration(l);return new Nt.Literal(u,new Du.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};Hh.DateTimeAccessors=G_});var Kh=b(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.DateTimeFunctions=void 0;var Oc=Fu(),ar=I3(),gt=C3(),z_=class{static{o(this,"DateTimeFunctions")}static parseDate(e){return Oc.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Oc.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Oc.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Oc.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Oc.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Oc.DateTimeParsing.formatYearMonthDuration(e)}static year(e){return gt.DateTimeAccessors.year(e)}static month(e){return gt.DateTimeAccessors.month(e)}static day(e){return gt.DateTimeAccessors.day(e)}static hours(e){return gt.DateTimeAccessors.hours(e)}static minutes(e){return gt.DateTimeAccessors.minutes(e)}static seconds(e){return gt.DateTimeAccessors.seconds(e)}static durationDays(e){return gt.DateTimeAccessors.durationDays(e)}static durationHours(e){return gt.DateTimeAccessors.durationHours(e)}static durationMinutes(e){return gt.DateTimeAccessors.durationMinutes(e)}static durationSeconds(e){return gt.DateTimeAccessors.durationSeconds(e)}static durationYears(e){return gt.DateTimeAccessors.durationYears(e)}static durationMonths(e){return gt.DateTimeAccessors.durationMonths(e)}static timezone(e){return gt.DateTimeAccessors.timezone(e)}static tz(e){return gt.DateTimeAccessors.tz(e)}static adjust(e,t){return gt.DateTimeAccessors.adjust(e,t)}static now(){return gt.DateTimeAccessors.now()}static dateBefore(e,t){return gt.DateTimeAccessors.dateBefore(e,t)}static dateAfter(e,t){return gt.DateTimeAccessors.dateAfter(e,t)}static dateInRange(e,t,r){return gt.DateTimeAccessors.dateInRange(e,t,r)}static compareDurations(e,t,r){return gt.DateTimeAccessors.compareDurations(e,t,r)}static dateDiffMinutes(e,t){return gt.DateTimeAccessors.dateDiffMinutes(e,t)}static dateDiffHours(e,t){return gt.DateTimeAccessors.dateDiffHours(e,t)}static timeDiff(e,t){return gt.DateTimeAccessors.timeDiff(e,t)}static dateDiff(e,t){return gt.DateTimeAccessors.dateDiff(e,t)}static isDayTimeDuration(e){return gt.DateTimeAccessors.isDayTimeDuration(e)}static isDate(e){return gt.DateTimeAccessors.isDate(e)}static isYearMonthDuration(e){return gt.DateTimeAccessors.isYearMonthDuration(e)}static isTime(e){return gt.DateTimeAccessors.isTime(e)}static dateTimeDiff(e,t){return ar.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return ar.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return ar.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return ar.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return ar.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return ar.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return ar.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return ar.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return ar.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return ar.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return ar.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return ar.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return ar.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return ar.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return ar.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return ar.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return ar.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return ar.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return ar.DateTimeArithmetic.durationToSeconds(e)}};Qh.DateTimeFunctions=z_});var R3=b(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.LogicalFunctions=void 0;var LM=Ee(),Pc=Me(),kM=$t(),Yh=Kh(),H_=class n{static{o(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return Yh.DateTimeFunctions.compareDurations(e instanceof Pc.Literal?e:String(e),t instanceof Pc.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return Yh.DateTimeFunctions.compareDurations(e instanceof Pc.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return Yh.DateTimeFunctions.compareDurations(e,t instanceof Pc.Literal?t:String(t),r);let i=n.toComparableValue(e),s=n.toComparableValue(t);switch(r){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: ${r}`)}}static isDayTimeDurationValue(e){return e instanceof Pc.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 Pc.Literal){let t=e.datatype?.value;if(t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double")){let r=parseFloat(e.value);if(!isNaN(r))return r}if(t==="http://www.w3.org/2001/XMLSchema#dayTimeDuration")try{return Yh.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof LM.IRI?e.value:e instanceof kM.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,r){return e?t:r}};Xh.LogicalFunctions=H_});var O3=b(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.RDFTermFunctions=void 0;var Nr=Ee(),wt=Me(),pi=$t(),Fc=du(),Q_=ui(),K_=class n{static{o(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof wt.Literal)return e.datatype?e.datatype:e.language?new Nr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Nr.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 Nr.IRI}static isBlank(e){return e===void 0?!1:e instanceof pi.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof wt.Literal}static isTriple(e){return e===void 0?!1:e instanceof Fc.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof wt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof wt.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 wt.Literal(t.toISOString(),new Nr.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 wt.Literal(String(t),new Nr.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 wt.Literal(String(t),new Nr.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||e.constructor!==t.constructor)return!1;if(e instanceof Nr.IRI&&t instanceof Nr.IRI)return e.value===t.value;if(e instanceof pi.BlankNode&&t instanceof pi.BlankNode)return e.id===t.id;if(e instanceof wt.Literal&&t instanceof wt.Literal){if(e.value!==t.value||e.language!==t.language)return!1;let r=e.datatype?.value,i=t.datatype?.value;return r===i}return!1}static iri(e){if(e===void 0)throw new Error("IRI: argument is undefined");if(e instanceof Nr.IRI)return e;if(e instanceof wt.Literal)return new Nr.IRI(e.value);throw e instanceof pi.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return n.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,Q_.v4)().replace(/-/g,"").substring(0,12)}`;return new pi.BlankNode(t)}if(e instanceof wt.Literal)return new pi.BlankNode(e.value);if(e instanceof pi.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 r;if(e instanceof wt.Literal){if(e.language)throw new Error("STRDT: lexical form must not have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRDT: lexical form must be a string literal");let i;if(t instanceof Nr.IRI)i=t;else if(t instanceof wt.Literal)i=new Nr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new wt.Literal(r,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 r;if(e instanceof wt.Literal){if(e.language)throw new Error("STRLANG: lexical form must not already have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRLANG: lexical form must be a string literal");let i;if(t instanceof wt.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 wt.Literal(r,void 0,i)}static strlangdir(e,t,r){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(r===void 0)throw new Error("STRLANGDIR: direction is undefined");let i;if(e instanceof wt.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 wt.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 a;if(r instanceof wt.Literal)a=r.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(a!=="ltr"&&a!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${a}'. Must be 'ltr' or 'rtl'`);return new wt.Literal(i,void 0,s,a)}static uuid(){let e=(0,Q_.v4)();return new Nr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,Q_.v4)();return new wt.Literal(e)}static triple(e,t,r){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(r===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof wt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Nr.IRI)){let c=t instanceof wt.Literal?"Literal":t instanceof pi.BlankNode?"BlankNode":t instanceof Fc.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new Fc.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof Fc.QuotedTriple)){let t=e instanceof Nr.IRI?"IRI":e instanceof wt.Literal?"Literal":e instanceof pi.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 Fc.QuotedTriple)){let t=e instanceof Nr.IRI?"IRI":e instanceof wt.Literal?"Literal":e instanceof pi.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 Fc.QuotedTriple)){let t=e instanceof Nr.IRI?"IRI":e instanceof wt.Literal?"Literal":e instanceof pi.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};Jh.RDFTermFunctions=K_});var P3=b(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.HashFunctions=void 0;var Y_=class{static{o(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")}};Zh.HashFunctions=Y_});var tp=b(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});ep.BuiltInFunctions=void 0;var or=A3(),Ra=x3(),oe=Kh(),Dc=R3(),It=O3(),Nu=P3(),X_=class{static{o(this,"BuiltInFunctions")}static str(...e){return or.StringFunctions.str(...e)}static lang(...e){return or.StringFunctions.lang(...e)}static langdir(...e){return or.StringFunctions.langdir(...e)}static langMatches(...e){return or.StringFunctions.langMatches(...e)}static regex(...e){return or.StringFunctions.regex(...e)}static contains(...e){return or.StringFunctions.contains(...e)}static strStarts(...e){return or.StringFunctions.strStarts(...e)}static strEnds(...e){return or.StringFunctions.strEnds(...e)}static strlen(...e){return or.StringFunctions.strlen(...e)}static ucase(...e){return or.StringFunctions.ucase(...e)}static lcase(...e){return or.StringFunctions.lcase(...e)}static substr(...e){return or.StringFunctions.substr(...e)}static strBefore(...e){return or.StringFunctions.strBefore(...e)}static strAfter(...e){return or.StringFunctions.strAfter(...e)}static concat(...e){return or.StringFunctions.concat(...e)}static replace(...e){return or.StringFunctions.replace(...e)}static encodeForUri(...e){return or.StringFunctions.encodeForUri(...e)}static normalize(...e){return or.StringFunctions.normalize(...e)}static fold(...e){return or.StringFunctions.fold(...e)}static abs(...e){return Ra.MathFunctions.abs(...e)}static round(...e){return Ra.MathFunctions.round(...e)}static ceil(...e){return Ra.MathFunctions.ceil(...e)}static floor(...e){return Ra.MathFunctions.floor(...e)}static rand(){return Ra.MathFunctions.rand()}static msToMinutes(...e){return Ra.MathFunctions.msToMinutes(...e)}static msToHours(...e){return Ra.MathFunctions.msToHours(...e)}static msToSeconds(...e){return Ra.MathFunctions.msToSeconds(...e)}static parseDate(...e){return oe.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return oe.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return oe.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return oe.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return oe.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return oe.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return oe.DateTimeFunctions.year(...e)}static month(...e){return oe.DateTimeFunctions.month(...e)}static day(...e){return oe.DateTimeFunctions.day(...e)}static hours(...e){return oe.DateTimeFunctions.hours(...e)}static minutes(...e){return oe.DateTimeFunctions.minutes(...e)}static seconds(...e){return oe.DateTimeFunctions.seconds(...e)}static timezone(...e){return oe.DateTimeFunctions.timezone(...e)}static tz(...e){return oe.DateTimeFunctions.tz(...e)}static now(){return oe.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return oe.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return oe.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return oe.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return oe.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return oe.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return oe.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return oe.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return oe.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return oe.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return oe.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return oe.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return oe.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return oe.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return oe.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return oe.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return oe.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return oe.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return oe.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return oe.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return oe.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return oe.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return oe.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return oe.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return oe.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return oe.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return oe.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return oe.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return oe.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return oe.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return oe.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return oe.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return oe.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return oe.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return oe.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return oe.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return oe.DateTimeFunctions.adjust(...e)}static isTime(...e){return oe.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return oe.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Dc.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Dc.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Dc.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Dc.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Dc.LogicalFunctions.coalesce(...e)}static if(...e){return Dc.LogicalFunctions.if(...e)}static datatype(...e){return It.RDFTermFunctions.datatype(...e)}static bound(...e){return It.RDFTermFunctions.bound(...e)}static isIRI(...e){return It.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return It.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return It.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return It.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return It.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return It.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return It.RDFTermFunctions.sameTerm(...e)}static iri(...e){return It.RDFTermFunctions.iri(...e)}static uri(...e){return It.RDFTermFunctions.uri(...e)}static bnode(...e){return It.RDFTermFunctions.bnode(...e)}static strdt(...e){return It.RDFTermFunctions.strdt(...e)}static strlang(...e){return It.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return It.RDFTermFunctions.strlangdir(...e)}static uuid(){return It.RDFTermFunctions.uuid()}static struuid(){return It.RDFTermFunctions.struuid()}static xsdDateTime(...e){return It.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return It.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return It.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return It.RDFTermFunctions.triple(...e)}static subject(...e){return It.RDFTermFunctions.subject(...e)}static predicate(...e){return It.RDFTermFunctions.predicate(...e)}static object(...e){return It.RDFTermFunctions.object(...e)}static md5(...e){return Nu.HashFunctions.md5(...e)}static sha1(...e){return Nu.HashFunctions.sha1(...e)}static sha256(...e){return Nu.HashFunctions.sha256(...e)}static sha384(...e){return Nu.HashFunctions.sha384(...e)}static sha512(...e){return Nu.HashFunctions.sha512(...e)}};ep.BuiltInFunctions=X_});var Lu=b(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.ExoQLBudgetExceededError=ns.ExoQLCycleError=ns.ExoQLEvalDisabledError=ns.ExoQLForbiddenKeywordError=void 0;var J_=class extends Error{static{o(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}};ns.ExoQLForbiddenKeywordError=J_;var Z_=class extends Error{static{o(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};ns.ExoQLEvalDisabledError=Z_;var e1=class extends Error{static{o(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};ns.ExoQLCycleError=e1;var t1=class extends Error{static{o(this,"ExoQLBudgetExceededError")}constructor(e,t,r,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${r})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=r}};ns.ExoQLBudgetExceededError=t1});var V3=b(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var j=tp();M.functionHandlers=new Map;M.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.str(t)});M.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.lang(t)});M.functionHandlers.set("langmatches",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.langMatches(t,r)});M.functionHandlers.set("contains",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.contains(t,r)});M.functionHandlers.set("strstarts",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strStarts(t,r)});M.functionHandlers.set("strends",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strEnds(t,r)});M.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.strlen(t)});M.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.ucase(t)});M.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.lcase(t)});M.functionHandlers.set("substr",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=Number(e.evaluateExpression(n[1],e.solution));if(n[2]){let i=Number(e.evaluateExpression(n[2],e.solution));return j.BuiltInFunctions.substr(t,r,i)}return j.BuiltInFunctions.substr(t,r)});M.functionHandlers.set("strbefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strBefore(t,r)});M.functionHandlers.set("strafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strAfter(t,r)});M.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return j.BuiltInFunctions.concat(...t)});M.functionHandlers.set("replace",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution)),s=n[3]?e.getStringValue(e.evaluateExpression(n[3],e.solution)):void 0;return j.BuiltInFunctions.replace(t,r,i,s)});M.functionHandlers.set("regex",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=n[2]?e.getStringValue(e.evaluateExpression(n[2],e.solution)):void 0;return j.BuiltInFunctions.regex(t,r,i)});M.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.encodeForUri(t)});M.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.datatype(t).value});M.functionHandlers.set("bound",(n,e)=>{let t=n[0];if(t.type==="variable"&&t.name){let r=e.solution.get(t.name);return j.BuiltInFunctions.bound(r)}return!0});var F3=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",F3);M.functionHandlers.set("isuri",F3);M.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isBlank(t)});M.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isLiteral(t)});M.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isNumeric(t)});M.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.hasLangdir(t)});M.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isTriple(t)});M.functionHandlers.set("sameterm",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution);return j.BuiltInFunctions.sameTerm(t,r)});M.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return j.BuiltInFunctions.abs(t)});M.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return j.BuiltInFunctions.round(t)});M.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return j.BuiltInFunctions.ceil(t)});M.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return j.BuiltInFunctions.floor(t)});M.functionHandlers.set("rand",()=>j.BuiltInFunctions.rand());M.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.parseDate(t)});M.functionHandlers.set("datebefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateBefore(t,r)});M.functionHandlers.set("dateafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateAfter(t,r)});M.functionHandlers.set("dateinrange",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution));return j.BuiltInFunctions.dateInRange(t,r,i)});M.functionHandlers.set("datediffminutes",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateDiffMinutes(t,r)});M.functionHandlers.set("datediffhours",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateDiffHours(t,r)});var Nc=o((n,e,t)=>(r,i)=>{let s=i.evaluateExpression(r[0],i.solution);return e&&i.isYearMonthDurationValue(s)?e(s):t&&i.isDayTimeDurationValue(s)?t(s):n(i.getStringValue(s))},"createDateTimeAccessor"),D3=Nc(j.BuiltInFunctions.year.bind(j.BuiltInFunctions),j.BuiltInFunctions.durationYears.bind(j.BuiltInFunctions),null);M.functionHandlers.set("year",D3);M.functionHandlers.set("years",D3);var N3=Nc(j.BuiltInFunctions.month.bind(j.BuiltInFunctions),j.BuiltInFunctions.durationMonths.bind(j.BuiltInFunctions),null);M.functionHandlers.set("month",N3);M.functionHandlers.set("months",N3);var L3=Nc(j.BuiltInFunctions.day.bind(j.BuiltInFunctions),null,j.BuiltInFunctions.durationDays.bind(j.BuiltInFunctions));M.functionHandlers.set("day",L3);M.functionHandlers.set("days",L3);M.functionHandlers.set("hours",Nc(j.BuiltInFunctions.hours.bind(j.BuiltInFunctions),null,j.BuiltInFunctions.durationHours.bind(j.BuiltInFunctions)));M.functionHandlers.set("minutes",Nc(j.BuiltInFunctions.minutes.bind(j.BuiltInFunctions),null,j.BuiltInFunctions.durationMinutes.bind(j.BuiltInFunctions)));M.functionHandlers.set("seconds",Nc(j.BuiltInFunctions.seconds.bind(j.BuiltInFunctions),null,j.BuiltInFunctions.durationSeconds.bind(j.BuiltInFunctions)));M.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.timezone(t)});M.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.tz(t)});M.functionHandlers.set("adjust",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=n.length>1?e.evaluateExpression(n[1],e.solution):void 0;return j.BuiltInFunctions.adjust(t,r)});M.functionHandlers.set("now",()=>j.BuiltInFunctions.now());var k3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",k3);M.functionHandlers.set("xsd:datetime",k3);var j3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",j3);M.functionHandlers.set("xsd:integer",j3);var M3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",M3);M.functionHandlers.set("xsd:decimal",M3);var $3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",$3);M.functionHandlers.set("xsd:daytimeduration",$3);M.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToDays(t)});M.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToHours(t)});M.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToMinutes(t)});M.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToSeconds(t)});M.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationDays(t)});M.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationHours(t)});M.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationMinutes(t)});M.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationSeconds(t)});M.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationYears(t)});M.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationMonths(t)});M.functionHandlers.set("datetimediff",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeDiff(t,r)});M.functionHandlers.set("datetimeadd",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeAdd(t,r)});M.functionHandlers.set("datetimesubtract",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeSubtract(t,r)});M.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToMinutes(t)});M.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToHours(t)});M.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToSeconds(t)});M.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.md5(t)});M.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha1(t)});M.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha256(t)});M.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha384(t)});M.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha512(t)});M.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.subject(t)});M.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.predicate(t)});M.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.object(t)});M.functionHandlers.set("triple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution),i=e.getTermFromExpression(n[2],e.solution);return j.BuiltInFunctions.triple(t,r,i)});M.functionHandlers.set("days_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(1440*60*1e3))});M.functionHandlers.set("minutes_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(60*1e3))});M.functionHandlers.set("hours_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return(new Date(r).getTime()-i.getTime())/(3600*1e3)});M.functionHandlers.set("age_days",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t);return Math.floor((new Date().getTime()-r.getTime())/(1440*60*1e3))});M.functionHandlers.set("week_number",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t),i=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.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)});M.functionHandlers.set("format_date",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return r.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"))});M.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:n}=Lu();throw new n})});var rp=b(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.FilterExecutor=Lc.FilterExecutorError=void 0;var yt=tp(),jM=V3(),r1=Ee(),is=Me(),yr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Lc.FilterExecutorError=yr;var n1=class{static{o(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 r=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;r?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(r=>this.expressionContainsExists(r))}if(e.type==="function"||e.type==="functionCall"){let t=e;return Array.isArray(t.args)?t.args.some(r=>this.expressionContainsExists(r)):!1}return!1}async executeAll(e,t){let r=[];async function*i(){for(let s of t)yield s}o(i,"generator");for await(let s of this.execute(e,i()))r.push(s);return r}evaluateExpression(e,t){let r=e;if("termType"in e)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":{let i=r.value,s=r.datatype,a=typeof s=="string"?s:s?.value;return a&&i.length>0&&this.shouldPreserveDatatype(a)?new is.Literal(i,new r1.IRI(a)):i}case"NamedNode":return r.value;default:throw new yr(`Unsupported termType: ${String(r.termType)}`)}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 is.Literal(i.value,new r1.IRI(i.datatype)):i.value}case"in":return this.evaluateIn(e,t);case"exists":throw new yr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new yr(`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 r=e,i=await this.evaluateExpressionAsync(r.left,t),s=await this.evaluateExpressionAsync(r.right,t);return yt.BuiltInFunctions.compare(i,s,r.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 yr("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let r=await this.existsEvaluator(e.pattern,t);return e.negated?!r:r}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let i=await this.evaluateExpressionAsync(e.operands[0],t);return yt.BuiltInFunctions.logicalNot(i)}let r=[];for(let i of e.operands){let s=await this.evaluateExpressionAsync(i,t);r.push(s)}if(e.operator==="&&")return yt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return yt.BuiltInFunctions.logicalOr(r);throw new yr(`Unknown logical operator: ${String(e.operator)}`)}async evaluateInAsync(e,t){let r=await this.evaluateExpressionAsync(e.expression,t),i=!1;for(let s of e.list){let a=await this.evaluateExpressionAsync(s,t);if(yt.BuiltInFunctions.compare(r,a,"=")){i=!0;break}}return e.negated?!i:i}async evaluateFunctionAsync(e,t){let r=e,i=this.extractFunctionName(r.function),s=r.args??[];if(i==="if"){if(s.length!==3)throw new yr("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 a=[];for(let l of s){let u=await this.evaluateExpressionAsync(l,t);a.push(this.wrapAsLiteralExpression(u))}let c={...r,args:a};return this.evaluateFunction(c,t)}wrapAsLiteralExpression(e){return e==null?{type:"literal",value:""}:typeof e=="object"&&"termType"in e?e:e instanceof r1.IRI||e instanceof is.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 r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return yt.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return yt.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return yt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return yt.BuiltInFunctions.logicalOr(r);throw new yr(`Unknown logical operator: ${String(e.operator)}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let a=this.evaluateExpression(s,t);return yt.BuiltInFunctions.compare(r,a,"=")});return e.negated?!i:i}evaluateArithmetic(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(r)&&this.isDateValue(i))return yt.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return yt.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return yt.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return yt.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return yt.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new yr("Division by zero");return yt.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),a=this.toNumericValue(i);switch(e.operator){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":if(a===0)throw new yr("Division by zero");return s/a;default:throw new yr(`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 is.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof is.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof is.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 r=parseFloat(e.value);if(!isNaN(r))return r}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 yr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof is.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 is.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof is.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let r=e,i=this.extractFunctionName(r.function),s=this.evaluateSpecialFunction(i,r.args,t);if(s!==void 0)return s.value;let a=jM.functionHandlers.get(i);if(!a)throw new yr(`Unknown function: ${i}`);let c={evaluateExpression:o((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:o((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:o(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:o(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:o(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return a(r.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 yr(`Unknown function format: ${String(e)}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let i of t)try{let s=this.evaluateExpression(i,r);if(s!=null)return{value:s}}catch{continue}return{value:void 0};case"if":{if(!t||t.length!==3)throw new yr("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],r);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],r):this.evaluateExpression(t[2],r)}}case"byuuid":return{value:this.evaluateByUUID({type:"function",function:"byuuid",args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":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 is.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 r=parseFloat(e.value);return!isNaN(r)&&r!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new yr("exo:byUUID requires exactly 1 argument (UUID string)");let r=this.evaluateExpression(e.args[0],t),i=this.getStringValue(r);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 a=this.tripleStore.findSubjectsByUUIDSync(s);if(a.length===0){this.uuidCache.set(s,null);return}let c=a[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let r=e.toLowerCase();this.uuidCache.set(r,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Lc.FilterExecutor=n1});var s1=b(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.OptionalExecutor=void 0;var i1=class{static{o(this,"OptionalExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(r,i)}async executeAll(e,t){let r=[];for(let i of this.hashJoin(e,t))r.push(i);return r}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let r=new Set;for(let l of e)for(let u of l.variables())r.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 r)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let a="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,a),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,a),f=c.get(u),d=!1;if(f)for(let h of f){let p=l.merge(h);p!==null&&(yield p,d=!0)}d||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let a=e.get(s);i.push(a!==void 0?a.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let a=r.merge(s);a!==null&&(yield a,i=!0)}i||(yield r)}}};np.OptionalExecutor=i1});var o1=b(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.UnionExecutor=void 0;var a1=class{static{o(this,"UnionExecutor")}async*execute(e,t){let r=new Set;for await(let i of e){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}for await(let i of t){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};ip.UnionExecutor=a1});var B3=b(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.MinusExecutor=void 0;var c1=class{static{o(this,"MinusExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);for(let s of r){let a=!1;for(let c of i)if(this.areCompatible(s,c)){a=!0;break}a||(yield s)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}areCompatible(e,t){let r=e.variables(),i=new Set(t.variables()),s=r.filter(a=>i.has(a));if(s.length===0)return!1;for(let a of s){let c=e.get(a),l=t.get(a);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};sp.MinusExecutor=c1});var q3=b(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.ValuesExecutor=kc.ValuesExecutorError=void 0;var MM=rs(),U3=Ee(),$M=Me(),ap=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};kc.ValuesExecutorError=ap;var l1=class{static{o(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 r of this.execute(e))t.push(r);return t}createSolutionMapping(e){let t=new MM.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.toRDFTerm(i);t.set(r,s)}return t}toRDFTerm(e){if(e.type==="iri")return new U3.IRI(e.value);if(e.type==="literal")return new $M.Literal(e.value,e.datatype?new U3.IRI(e.datatype):void 0,e.language,e.direction);throw new ap(`Unknown term type: ${e.type}`)}};kc.ValuesExecutor=l1});var u1=b(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.CustomAggregateRegistry=Mc.CustomAggregateError=void 0;var jc=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Mc.CustomAggregateError=jc;var op=class n{static{o(this,"CustomAggregateRegistry")}constructor(){this.aggregates=new Map}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance&&n.instance.clear(),n.instance=null}register(e,t){if(!e||typeof e!="string")throw new jc("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new jc("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new jc(`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}};Mc.CustomAggregateRegistry=op;op.instance=null});var f1=b(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.BUILT_IN_AGGREGATES=rt.modeAggregate=rt.stddevAggregate=rt.varianceAggregate=rt.medianAggregate=rt.EXO_AGGREGATE_NS=void 0;rt.getNumericValue=cp;rt.createDecimalLiteral=mi;rt.createDoubleLiteral=UM;rt.createPercentileAggregate=Ao;var xo=Me(),$c=Ee(),VM=new $c.IRI("http://www.w3.org/2001/XMLSchema#decimal"),BM=new $c.IRI("http://www.w3.org/2001/XMLSchema#double");rt.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function cp(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof xo.Literal?parseFloat(n.value):n instanceof $c.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(cp,"getNumericValue");function mi(n){return new xo.Literal(String(n),VM)}o(mi,"createDecimalLiteral");function UM(n){return new xo.Literal(String(n),BM)}o(UM,"createDoubleLiteral");rt.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=cp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return mi(0);let r=[...t].sort((a,c)=>a-c),i=Math.floor(r.length/2),s=r.length%2!==0?r[i]:(r[i-1]+r[i])/2;return mi(s)}};rt.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=cp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return mi(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return mi(i)}};rt.stddevAggregate={init(){return{values:[]}},step(n,e){rt.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return mi(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return mi(Math.sqrt(i))}};rt.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof xo.Literal||e instanceof $c.IRI?e.value:e),i=t.counts.get(r)||0;t.counts.set(r,i+1),t.values.set(r,e)},finalize(n){let e=n;if(e.counts.size===0)return new xo.Literal(" ",new $c.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",r=0;for(let[a,c]of e.counts)c>r&&(r=c,t=a);let i=e.values.get(t);if(i instanceof xo.Literal)return i;let s=parseFloat(t);return isNaN(s)?new xo.Literal(t,new $c.IRI("http://www.w3.org/2001/XMLSchema#string")):mi(s)}};function Ao(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=cp(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return mi(0);let s=[...i].sort((d,h)=>d-h),a=r.percentile*(s.length-1),c=Math.floor(a),l=Math.ceil(a);if(c===l)return mi(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return mi(f)}}}o(Ao,"createPercentileAggregate");rt.BUILT_IN_AGGREGATES={[`${rt.EXO_AGGREGATE_NS}median`]:rt.medianAggregate,[`${rt.EXO_AGGREGATE_NS}variance`]:rt.varianceAggregate,[`${rt.EXO_AGGREGATE_NS}stddev`]:rt.stddevAggregate,[`${rt.EXO_AGGREGATE_NS}mode`]:rt.modeAggregate,[`${rt.EXO_AGGREGATE_NS}percentile25`]:Ao(25),[`${rt.EXO_AGGREGATE_NS}percentile50`]:Ao(50),[`${rt.EXO_AGGREGATE_NS}percentile75`]:Ao(75),[`${rt.EXO_AGGREGATE_NS}percentile90`]:Ao(90),[`${rt.EXO_AGGREGATE_NS}percentile95`]:Ao(95),[`${rt.EXO_AGGREGATE_NS}percentile99`]:Ao(99)}});var z3=b(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.AggregateExecutor=Vc.AggregateExecutorError=void 0;var cr=Me(),h1=Ee(),qM=rp(),WM=u1(),GM=f1(),W3=new h1.IRI("http://www.w3.org/2001/XMLSchema#integer"),Io=new h1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),ss=new h1.IRI("http://www.w3.org/2001/XMLSchema#string");function G3(n){return typeof n=="object"&&n.type==="custom"}o(G3,"isCustomAggregation");var ku=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Vc.AggregateExecutorError=ku;var d1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new qM.FilterExecutor}execute(e,t){let r=this.groupSolutions(t,e.variables),i=[];for(let[s,a]of r.entries()){let c=new Map;for(let f of e.variables)if(a.length>0){let d=a[0].get(f);d&&c.set(f,d)}for(let f of e.aggregates){let d=this.computeAggregate(f.expression,a);c.set(f.variable,d)}let{SolutionMapping:l}=rs(),u=new l;for(let[f,d]of c.entries())u.set(f,d);i.push(u)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let r=new Map;if(t.length===0)return r.set("",e),r;for(let i of e){let s=this.computeGroupKey(i,t),a=r.get(s);a?a.push(i):r.set(s,[i])}return r}computeGroupKey(e,t){return t.map(r=>{let i=e.get(r);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(G3(e.aggregation))return this.computeCustomAggregate(e,t);let r=this.extractValues(e,t),i=e.aggregation;switch(i){case"count":{let s=this.computeCount(r,e.distinct);return new cr.Literal(String(s),W3)}case"sum":{let s=this.computeSum(r);return new cr.Literal(String(s),Io)}case"avg":{let s=this.computeAvg(r);return new cr.Literal(String(s),Io)}case"min":{let s=this.computeMin(r);return s===void 0?new cr.Literal("",ss):typeof s=="number"?new cr.Literal(String(s),Io):new cr.Literal(String(s),ss)}case"max":{let s=this.computeMax(r);return s===void 0?new cr.Literal("",ss):typeof s=="number"?new cr.Literal(String(s),Io):new cr.Literal(String(s),ss)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new cr.Literal(s||" ",ss)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new cr.Literal(" ",ss):typeof s=="number"?new cr.Literal(String(s),Io):new cr.Literal(String(s),ss)}default:{let s=i;throw new ku(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=WM.CustomAggregateRegistry.getInstance().get(i);if(a||(a=GM.BUILT_IN_AGGREGATES[i]),!a)throw new ku(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=a.init();for(let l of t){let u=null;if(e.expression){let f=this.evaluateExpression(e.expression,l);f!==void 0&&(u=f)}else u=1;a.step(c,u)}return a.finalize(c)}extractValues(e,t){if(!e.expression)return t.map(()=>1);let r=[];for(let i of t){let s=this.evaluateExpression(e.expression,i);s!=null&&r.push(s)}return r}evaluateExpression(e,t){if(e.type==="variable"){let r=t.get(e.name);return r==null?void 0:typeof r=="number"||typeof r=="string"||typeof r=="boolean"?r:typeof r=="object"&&"value"in r?r.value:r}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(r=>String(r))).size:e.length}computeSum(e){return e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r)).reduce((r,i)=>r+i,0)}computeAvg(e){let t=e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r));return t.length===0?0:t.reduce((r,i)=>r+i,0)/t.length}computeMin(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.min(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s<i?s:i,r[0])}computeMax(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.max(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s>i?s:i,r[0])}computeGroupConcat(e,t,r){let i=e.map(s=>String(s));return r&&(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 a=s[0],c=parseFloat(a);return isNaN(c)?a:c}let r=e[0];if(typeof r=="number")return r;let i=parseFloat(String(r));return isNaN(i)?String(r):i}createEmptyAggregateResult(e){let{SolutionMapping:t}=rs(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(G3(s)){r.set(i.variable,new cr.Literal("0",Io));continue}switch(s){case"count":r.set(i.variable,new cr.Literal("0",W3));break;case"sum":case"avg":r.set(i.variable,new cr.Literal("0",Io));break;case"group_concat":r.set(i.variable,new cr.Literal(" ",ss));break;case"min":case"max":case"sample":r.set(i.variable,new cr.Literal("",ss));break;default:r.set(i.variable,new cr.Literal("",ss))}}return r}};Vc.AggregateExecutor=d1});var y1=b(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.ConstructExecutor=void 0;var zM=Yn(),Co=Ee(),p1=Me(),m1=$t(),HM=du(),g1=class{static{o(this,"ConstructExecutor")}async execute(e,t){let r=[],i=new Set;for(let s of t)for(let a of e)try{let c=this.instantiateTriple(a,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),r.push(c))}catch{continue}return r}instantiateTriple(e,t){if(this.isPropertyPath(e.predicate))throw new Error("Property paths are not supported in CONSTRUCT templates");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.predicate,t),s=this.instantiateElement(e.object,t);return new zM.Triple(r,i,s)}isPropertyPath(e){return e.type==="path"}instantiateElement(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable: ${e.value}`);return r}if(e.type==="iri")return new Co.IRI(e.value);if(e.type==="literal")return new p1.Literal(e.value,e.datatype?new Co.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new m1.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Unknown element type: ${e.type}`)}instantiateQuotedTriple(e,t){let r=this.instantiateQuotedSubject(e.subject,t),i=this.instantiateQuotedPredicate(e.predicate,t),s=this.instantiateQuotedObject(e.object,t);return new HM.QuotedTriple(r,i,s)}instantiateQuotedSubject(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple subject: ${e.value}`);if(r instanceof p1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new Co.IRI(e.value);if(e.type==="blank")return new m1.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 r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple predicate: ${e.value}`);if(!(r instanceof Co.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new Co.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 Co.IRI(e.value);if(e.type==="blank")return new m1.BlankNode(e.value);if(e.type==="literal")return new p1.Literal(e.value,e.datatype?new Co.IRI(e.datatype):void 0,e.language);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);let r=e;throw new Error(`Invalid element type for quoted triple object: ${r.type}`)}};lp.ConstructExecutor=g1});var Q3=b(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.ServiceExecutor=Bc.ServiceExecutorError=void 0;var QM=rs(),H3=Ee(),KM=Me(),YM=$t(),Ro=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Bc.ServiceExecutorError=Ro;var _1=class{static{o(this,"ServiceExecutor")}constructor(e={}){this.timeout=e.timeout??3e4,this.httpClient=e.httpClient??((t,r)=>fetch(t,r)),this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3}async*execute(e,t){try{let r=t(e.pattern),i=await this.executeRemoteQuery(e.endpoint,r);for(let s of i)yield s}catch(r){if(e.silent)return;throw r}}async executeRemoteQuery(e,t){let r;for(let i=0;i<=this.maxRetries;i++)try{let s=new AbortController,a=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 Ro(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(a)}}catch(s){if(r=s instanceof Error?s:new Error(String(s)),this.isRetryableError(r)&&i<this.maxRetries){await this.delay(this.retryDelay);continue}throw new Ro(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Ro(`Failed to query remote SPARQL endpoint ${e} after ${this.maxRetries+1} attempts`,r)}parseJsonResults(e){return!e.results||!Array.isArray(e.results.bindings)?[]:e.results.bindings.map(t=>this.parseBinding(t))}parseBinding(e){let t=new QM.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.parseRDFTerm(i);t.set(r,s)}return t}parseRDFTerm(e){switch(e.type){case"uri":return new H3.IRI(e.value);case"literal":{let t=e.datatype?new H3.IRI(e.datatype):void 0;return new KM.Literal(e.value,t,e["xml:lang"])}case"bnode":return new YM.BlankNode(e.value);default:throw new Ro(`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))}};Bc.ServiceExecutor=_1});var Y3=b(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.GraphExecutor=Uc.GraphExecutorError=void 0;var K3=Ee(),up=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};Uc.GraphExecutorError=up;var b1=class{static{o(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,r){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,r);else throw new up(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new K3.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*r(e,i))}async*executeWithGraphVariable(e,t,r,i){if(i){let a=i.get(t.value);if(a&&a instanceof K3.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:a.value},r);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let a of s)for await(let c of r(e.pattern,a)){let l=c.clone();l.set(t.value,a),yield l}}};Uc.GraphExecutor=b1});var X3=b(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.SPARQLGenerator=Wc.SPARQLGeneratorError=void 0;var qc=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Wc.SPARQLGeneratorError=qc;var S1=class{static{o(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
48
|
+
`,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,r);if(c){i+=c.iri,s=c.endIndex;continue}i+=a,s++}return i}tryReplacePrefixedName(e,t,r){if(t>0&&/[a-zA-Z0-9_]/.test(e[t-1]))return null;for(let{prefix:i,baseIRI:s}of r){if(e.substring(t,t+i.length+1)!==i+":")continue;let a=t+i.length+1,c=a;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===a)continue;let l=e.substring(a,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,r=new RegExp(lM.source,"gi"),i;for(;(i=r.exec(e))!==null;)t.add(i[1].toLowerCase());return t}skipLiteral(e,t){let r=e[t];if(t+2<e.length&&e.substring(t,t+3)===r+r+r){let s=e.indexOf(r+r+r,t+3);return s!==-1?s+3:e.length}let i=t+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;return i<e.length?i+1:e.length}};Ih.VaultPrefixTransformer=A_});var Tc=b(In=>{"use strict";var fM=In&&In.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),dM=In&&In.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),hM=In&&In.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&fM(t,e,r[i]);return dM(t,e),t}})();Object.defineProperty(In,"__esModule",{value:!0});In.SPARQLParser=In.ExoQLParser=In.SPARQLParseError=void 0;var f3=hM(o3()),I_=b_(),C_=S_(),d3=c3(),R_=v_(),pM=l3(),O_=u3(),mM=x_(),sr=class extends Error{static{o(this,"SPARQLParseError")}constructor(e,t,r,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=r}};In.SPARQLParseError=sr;var Ch=class{static{o(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new f3.Parser({sparqlStar:!0}),this.generator=new f3.Generator({sparqlStar:!0}),this.caseWhenTransformer=new I_.CaseWhenTransformer,this.lateralTransformer=new C_.LateralTransformer,this.prefixStarTransformer=new d3.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new R_.DescribeOptionsTransformer,this.directionalLangTagTransformer=new pM.DirectionalLangTagTransformer,this.tripleTermTransformer=new O_.TripleTermTransformer,this.vaultPrefixTransformer=new mM.VaultPrefixTransformer}setVaultPrefixes(e){this.vaultPrefixTransformer.setVaultPrefixes(e)}parse(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.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 R_.DescribeOptionsTransformerError)throw new sr(t.message);if(t instanceof C_.LateralTransformerError)throw new sr(t.message);if(t instanceof I_.CaseWhenTransformerError)throw new sr(t.message);if(t instanceof O_.TripleTermTransformerError)throw new sr(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new sr(`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),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.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 R_.DescribeOptionsTransformerError)throw new sr(t.message);if(t instanceof d3.PrefixStarTransformerError)throw new sr(t.message);if(t instanceof C_.LateralTransformerError)throw new sr(t.message);if(t instanceof I_.CaseWhenTransformerError)throw new sr(t.message);if(t instanceof O_.TripleTermTransformerError)throw new sr(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new sr(`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 sr(`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 sr("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 sr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new sr(`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 sr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};In.ExoQLParser=Ch;In.SPARQLParser=Ch});var To=b(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});Rh.AlgebraTranslatorError=void 0;var P_=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};Rh.AlgebraTranslatorError=P_});var Oh=b(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.isVariableExpression=gM;ts.isVariableTerm=yM;ts.isNamedNode=_M;ts.isLiteral=bM;ts.isPropertyPath=SM;ts.isAggregateExpression=wM;ts.isOperationExpression=vM;ts.isFunctionCallExpression=EM;function gM(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}o(gM,"isVariableExpression");function yM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}o(yM,"isVariableTerm");function _M(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}o(_M,"isNamedNode");function bM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}o(bM,"isLiteral");function SM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}o(SM,"isPropertyPath");function wM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}o(wM,"isAggregateExpression");function vM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}o(vM,"isOperationExpression");function EM(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}o(EM,"isFunctionCallExpression")});var h3=b(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.TripleTranslator=void 0;var ln=To(),F_=class{static{o(this,"TripleTranslator")}constructor(){this.directionMappings=new Map}setDirectionMappings(e){this.directionMappings=e}translateBGP(e){if(!("triples"in e)||!Array.isArray(e.triples))throw new ln.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 ln.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 ln.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new ln.AlgebraTranslatorError("Property path must have items array");let t=e.items.map(r=>this.translatePathItem(r));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new ln.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new ln.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new ln.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new ln.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new ln.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 ln.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new ln.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 r=this.directionMappings.get(e.language.toLowerCase());r&&(t.direction=r)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new ln.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ln.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 ln.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 ln.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};Ph.TripleTranslator=F_});var p3=b(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.ExpressionTranslator=void 0;var Ac=To(),D_=class{static{o(this,"ExpressionTranslator")}constructor(e){this.translateWhereFn=e.translateWhere,this.translateBGPFn=e.translateBGP,this.translatePatternFn=e.translatePattern}translateExpression(e){if(!e)throw new Ac.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 r=e;return{type:"functionCall",function:r.function,args:r.args.map(i=>this.translateExpression(i))}}if("termType"in e)return this.translateTermExpression(e);throw new Ac.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new Ac.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=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"],s=e.args.filter(a=>!("patterns"in a)||"termType"in a);return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:s.map(a=>this.translateExpression(a))}: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(a=>this.translateExpression(a))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new Ac.AlgebraTranslatorError("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&"patterns"in t&&t.patterns?r=this.translateWhereFn(t.patterns):t.type==="bgp"?r=this.translateBGPFn(t):r=this.translatePatternFn(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new Ac.AlgebraTranslatorError("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],r=e.args[1];if(!Array.isArray(r))throw new Ac.AlgebraTranslatorError("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:r.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}};Fh.ExpressionTranslator=D_});var y3=b(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.PatternTranslator=void 0;var m3=S_(),Dr=To(),g3=Oh(),N_=class{static{o(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 Dr.AlgebraTranslatorError("Empty WHERE clause");let t=e.filter(a=>a.type==="filter"),r=e.filter(a=>a.type==="bind"),i=e.filter(a=>a.type!=="filter"&&a.type!=="bind"),s;if(i.length===0)s={type:"bgp",triples:[]};else if(i.length===1)if(i[0].type==="optional"){let a=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:a?this.translateExpressionFn(a):void 0}}else s=this.translatePattern(i[0]);else{if(i[0].type==="optional"){let a=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:a?this.translateExpressionFn(a):void 0}}else s=this.translatePattern(i[0]);for(let a=1;a<i.length;a++){let c=i[a];if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelectFn(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional"){let l=c.expression;s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:l?this.translateExpressionFn(l):void 0}}else{let l=this.translatePattern(c);s={type:"join",left:s,right:l}}}}for(let a of r)s=this.translateBind(a,s);for(let a of t)s={type:"filter",expression:this.translateExpressionFn(a.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new Dr.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 Dr.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Dr.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 Dr.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 Dr.AlgebraTranslatorError("UNION pattern must have at least 2 patterns");let t=o(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"),r={type:"union",left:t(e.patterns[0]),right:t(e.patterns[1])};for(let i=2;i<e.patterns.length;i++)r={type:"union",left:r,right:t(e.patterns[i])};return r}translateMinus(e){if(!e.patterns||e.patterns.length===0)throw new Dr.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 Dr.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 a=s.startsWith("?")?s.slice(1):s;t.add(a)}let r=e.values.map(i=>this.translateValuesBinding(i));return{type:"values",variables:Array.from(t),bindings:r}}translateValuesBinding(e){let t={};for(let[r,i]of Object.entries(e)){let s=r.startsWith("?")?r.slice(1):r,a=i;if(a)if(a.termType==="NamedNode")t[s]={type:"iri",value:a.value};else if(a.termType==="Literal"){let c=a,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 Dr.AlgebraTranslatorError(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Dr.AlgebraTranslatorError("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpressionFn(e.expression),input:t}}translateSubquery(e){if(e.queryType!=="SELECT")throw new Dr.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 Dr.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Dr.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 Dr.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Dr.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 Dr.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 Dr.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,g3.isVariableTerm)(i)&&i.value===m3.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){if(!("variables"in e)||!e.variables)return e;let t=e,r=t.variables;return{...t,variables:r.filter(i=>!((0,g3.isVariableTerm)(i)&&i.value===m3.LateralTransformer.LATERAL_MARKER))}}};Dh.PatternTranslator=N_});var b3=b(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.AggregateTranslator=void 0;var _3=To(),TM=Oh(),L_=class{static{o(this,"AggregateTranslator")}constructor(e){this.aggregateCounter=0,this.translateExpressionFn=e.translateExpression}resetCounter(){this.aggregateCounter=0}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)(0,TM.isVariableExpression)(i)&&("type"in i.expression&&i.expression.type==="aggregate"?(r.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,r,t));return r}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,r){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,r);return e.map(i=>this.transformExpressionWithAggregateVars(i,r))}transformExpressionWithAggregateVars(e,t){let r=t.get(e);if(r!==void 0)return{type:"variable",name:r};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)),a=["=","!=","<",">","<=",">="],c=["&&","||","!"],l=["+","-","*","/"];return a.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,r=o(()=>{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:r(),distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:r(),distinct:e.distinct||!1,separator:e.separator}}let i=t;if(i&&typeof i=="object"){let s,a=i;if(a.termType==="NamedNode"&&typeof a.value=="string")s=a.value;else if("value"in a)s=String(a.value);else throw new _3.AlgebraTranslatorError(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(i)}`);return{type:"aggregate",aggregation:{type:"custom",iri:s},expression:r(),distinct:e.distinct||!1,separator:e.separator}}throw new _3.AlgebraTranslatorError(`Unknown aggregate format: ${JSON.stringify(t)}`)}collectNestedAggregates(e,t,r){if(e){if("type"in e&&e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if("type"in e&&e.type==="operation"&&"args"in e){let i=e;for(let s of i.args)!Array.isArray(s)&&"type"in s&&!("patterns"in s)?this.collectNestedAggregates(s,t,r):"termType"in s&&this.collectNestedAggregates(s,t,r)}}}};Nh.AggregateTranslator=L_});var xc=b(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.AlgebraTranslator=xa.ExoQLAlgebraTranslator=xa.AlgebraTranslatorError=void 0;var Lh=To(),kh=Oh(),AM=h3(),xM=p3(),IM=y3(),CM=b3(),RM=To();Object.defineProperty(xa,"AlgebraTranslatorError",{enumerable:!0,get:o(function(){return RM.AlgebraTranslatorError},"get")});var jh=class{static{o(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new AM.TripleTranslator,this.expressionTranslator=new xM.ExpressionTranslator({translateWhere:o(e=>this.patternTranslator.translateWhere(e),"translateWhere"),translateBGP:o(e=>this.tripleTranslator.translateBGP(e),"translateBGP"),translatePattern:o(e=>this.patternTranslator.translatePattern(e),"translatePattern")}),this.patternTranslator=new IM.PatternTranslator({translateExpression:o(e=>this.expressionTranslator.translateExpression(e),"translateExpression"),translateSelect:o(e=>this.translateSelect(e),"translateSelect"),translateBGP:o(e=>this.tripleTranslator.translateBGP(e),"translateBGP")}),this.aggregateTranslator=new CM.AggregateTranslator({translateExpression:o(e=>this.expressionTranslator.translateExpression(e),"translateExpression")})}setDirectionMappings(e){this.tripleTranslator.setDirectionMappings(e),this.patternTranslator.setDirectionMappings(e)}translate(e){if(e.type!=="query")throw new Lh.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 Lh.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new Lh.AlgebraTranslatorError("SELECT query must have WHERE clause");let t=this.patternTranslator.translateWhere(e.where);this.aggregateTranslator.resetCounter();let r=new Map,i=Array.isArray(e.variables)?e.variables.filter(l=>!("termType"in l&&l.termType==="Wildcard")):[],s=this.aggregateTranslator.extractAggregatesWithMapping(i,r),a=this.aggregateTranslator.extractGroupVariables(e.group),c=this.aggregateTranslator.extractHavingExpressions(e.having,s,r);if((s.length>0||a.length>0||c.length>0)&&(t={type:"group",variables:a,aggregates:s,having:c.length>0?c:void 0,input:t}),i.length>0){for(let u of i)if((0,kh.isVariableExpression)(u)){if("type"in u.expression&&u.expression.type==="aggregate")continue;let f=this.aggregateTranslator.transformExpressionWithAggregateVars(u.expression,r);t={type:"extend",variable:u.variable.value,expression:f,input:t}}let l=i.filter(u=>(0,kh.isVariableTerm)(u)||(0,kh.isVariableExpression)(u)).map(u=>(0,kh.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.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(l=>this.aggregateTranslator.translateOrderComparator(l)),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 Lh.AlgebraTranslatorError("CONSTRUCT query must have WHERE clause");let r=this.patternTranslator.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(r={type:"slice",limit:i.limit,offset:i.offset,input:r}),{type:"construct",template:t,where:r}}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 a of s)a.termType==="Wildcard"||a.value==="*"||(a.termType==="Variable"?t.push({type:"variable",value:a.value}):a.termType==="NamedNode"&&t.push({type:"iri",value:a.value}))}let r;e.where&&e.where.length>0&&(r=this.patternTranslator.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};xa.ExoQLAlgebraTranslator=jh;xa.AlgebraTranslator=jh});var rs=b(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});Mh.SolutionMapping=void 0;var S3=Me(),w3=Ee(),v3=$t(),k_=class n{static{o(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,r]of this.bindings.entries()){let i=e.get(t);if(i!==void 0&&!this.areEqual(r,i))return!1}return!0}merge(e){if(!this.isCompatibleWith(e))return null;let t=new n(this.bindings);for(let[r,i]of e.getBindings().entries())t.set(r,i);return t}clone(){return new n(this.bindings)}areEqual(e,t){return e instanceof S3.Literal&&t instanceof S3.Literal?e.equals(t):e instanceof w3.IRI&&t instanceof w3.IRI?e.value===t.value:e instanceof v3.BlankNode&&t instanceof v3.BlankNode?e.id===t.id:!1}toJSON(){let e={};for(let[t,r]of this.bindings.entries())e[t]=r.toString();return e}size(){return this.bindings.size}};Mh.SolutionMapping=k_});var T3=b(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.PropertyPathExecutor=Ic.PropertyPathExecutorError=void 0;var OM=rs(),$h=Ee(),E3=$t(),PM=Me(),Ou=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Ic.PropertyPathExecutorError=Ou;var j_=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){if(this.isLiteralElement(e)||this.isLiteralElement(r)){let a=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:r,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l;console.warn(`[PropertyPathExecutor] literal-safety guard fired: literal in ${a} position \u2014 yielding 0 solutions. value="${u}"`);return}let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new OM.SolutionMapping;this.isVariable(e)&&u.set(e.value,a),this.isVariable(r)&&u.set(r.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new Ou("Predicate is not a property path");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.object,t);for await(let s of this.execute(r,e.predicate,i)){let a=t.merge(s);a!==null&&(yield a)}}async evaluatePath(e,t,r){switch(t.pathType){case"/":return this.evaluateSequencePath(e,t.items,r);case"|":return this.evaluateAlternativePath(e,t.items,r);case"^":return this.evaluateInversePath(e,t.items[0],r);case"+":return this.evaluateOneOrMorePath(e,t.items[0],r);case"*":return this.evaluateZeroOrMorePath(e,t.items[0],r);case"?":return this.evaluateZeroOrOnePath(e,t.items[0],r)}}async evaluateSequencePath(e,t,r){let i=new Set([e]);for(let s=0;s<t.length;s++){let a=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,a,c?r:null);for(let d of f)l.add(d)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,r){let i=new Set;for(let s of t){let a=await this.evaluatePathItem(e,s,r);for(let c of a)i.add(c)}return i}async evaluateInversePath(e,t,r){if(t.type==="iri"){let i=new $h.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let c=a.shift();if(!c)break;let{node:l,depth:u}=c;if(u>=this.MAX_DEPTH)continue;let f=await this.evaluatePathItem(l,t,null);for(let d of f){let h=this.nodeToKey(d);(r===null||this.nodeInSet(d,r))&&s.add(d),i.has(h)||(i.add(h),a.push({node:d,depth:u+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new $h.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}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 r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new $h.IRI(e.value));break;case"blank":t.add(new E3.BlankNode(e.value));break;default:throw new Ou(`Unsupported element type in subject/object position: ${e.type}`)}return t}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r){if(r instanceof $h.IRI)return{type:"iri",value:r.value};if(r instanceof E3.BlankNode)return{type:"blank",value:r.id};if(r instanceof PM.Literal)return{type:"literal",value:r.value,datatype:r.datatype?.value,language:r.language,direction:r.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 r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};Ic.PropertyPathExecutor=j_});var V_=b(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.BGPExecutor=Cc.BGPExecutorError=void 0;var Vh=rs(),Ia=Ee(),M_=Me(),Bh=$t(),Uh=du(),FM=T3(),qr=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Cc.BGPExecutorError=qr;var $_=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new FM.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new Vh.SolutionMapping;return}let t=this.matchTriplePattern(e.triples[0]);for(let r=1;r<e.triples.length;r++)t=this.joinWithPattern(t,e.triples[r]);for await(let r of t)yield r}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*executeInGraph(e,t){if(e.triples.length===0){yield new Vh.SolutionMapping;return}let r=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)r=this.joinWithPatternInGraph(r,e.triples[i],t);for await(let i of r)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new qr("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:r);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new qr("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,a,t);for(let l of c){let u=new Vh.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){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 t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:t);return}let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new Vh.SolutionMapping;if(this.isVariable(e.subject))l.set(e.subject.value,c.subject);else if(this.isQuotedTriple(e.subject)){let u=this.matchQuotedTriplePattern(e.subject,c.subject);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}if(this.isVariable(t)&&l.set(t.value,c.predicate),this.isVariable(e.object))l.set(e.object.value,c.object);else if(this.isQuotedTriple(e.object)){let u=this.matchQuotedTriplePattern(e.object,c.object);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}yield l}}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 Uh.QuotedTriple))return null;let r=new Map;if(this.isVariable(e.subject))r.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,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.subject,t.subject))return null;if(e.predicate.type==="variable")r.set(e.predicate.value,t.predicate);else if(e.predicate.value!==t.predicate.value)return null;if(this.isVariable(e.object))r.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,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.object,t.object))return null;return r}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof Ia.IRI&&e.value===t.value;case"literal":return!(!(t instanceof M_.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof Bh.BlankNode&&e.value===t.id;case"quoted":return t instanceof Uh.QuotedTriple?this.toRDFQuotedTriple(e).equals(t):!1;default:return!1}}isPropertyPath(e){return e.type==="path"}async*joinWithPattern(e,t){let r=[];for await(let i of e)r.push(i);for(let i of r){let s=this.instantiatePattern(t,i);for await(let a of this.matchTriplePattern(s)){let c=i.merge(a);c!==null&&(yield c)}}}instantiatePattern(e,t){let r=this.isPropertyPath(e.predicate)?e.predicate:this.instantiateElement(e.predicate,t);return{subject:this.instantiateElement(e.subject,t),predicate:r,object:this.instantiateElement(e.object,t)}}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r)return this.toAlgebraElement(r)}return this.isQuotedTriple(e)?this.instantiateQuotedTriple(e,t):e}instantiateQuotedTriple(e,t){let r=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:r,predicate:i,object:s}}instantiatePredicateVariable(e,t){let r=t.get(e.value);return r&&r instanceof Ia.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,r){let i="value"in r?String(r.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i;console.warn(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Ia.IRI(e.value);case"blank":return new Bh.BlankNode(e.value);case"literal":throw new qr("Literals cannot appear in subject position");case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new qr(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new Ia.IRI(e.predicate.value):(()=>{throw new qr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new Uh.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Ia.IRI(e.value);case"literal":throw new qr("Literals cannot appear in predicate position");case"blank":throw new qr("Blank nodes cannot appear in predicate position");case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new qr(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Ia.IRI(e.value);case"literal":return new M_.Literal(e.value,e.datatype?new Ia.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new Bh.BlankNode(e.value);case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new qr(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof Ia.IRI)return{type:"iri",value:e.value};if(e instanceof M_.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof Bh.BlankNode)return{type:"blank",value:e.id};if(e instanceof Uh.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new qr(`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)}}};Cc.BGPExecutor=$_});var A3=b(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.StringFunctions=void 0;var Rc=Ee(),Ca=Me(),B_=$t(),Pu=class n{static{o(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Rc.IRI||e instanceof Ca.Literal?e.value:e instanceof B_.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof Ca.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof Ca.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=n.parseDirectionalLangTag(e),[s,a]=n.parseDirectionalLangTag(t),c=r.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":a&&i!==a?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let r=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[r,i]}static regex(e,t,r){try{let i=r?r.includes("u")?r:r+"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,r){let i=t-1;if(i<0){if(r!==void 0){let s=r+i;return s<=0?"":e.substring(0,s)}return e}return r!==void 0?e.substring(i,i+r):e.substring(i)}static strBefore(e,t){if(t==="")return"";let r=e.indexOf(t);return r===-1?"":e.substring(0,r)}static strAfter(e,t){if(t==="")return e;let r=e.indexOf(t);return r===-1?"":e.substring(r+t.length)}static concat(...e){return e.join("")}static replace(e,t,r,i){try{let s=i||"g",a=s.includes("u")?s:s+"u",c=new RegExp(t,a);return e.replace(c,r)}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 r;if(e instanceof Ca.Literal)r=e.value;else if(e instanceof Rc.IRI)r=e.value;else if(e instanceof B_.BlankNode)r=e.id;else if(typeof e=="string")r=e;else throw new Error("NORMALIZE: first argument must be a string or literal");let i="NFC";if(t!==void 0)if(t instanceof Ca.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Rc.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!n.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=r.normalize(i);return new Ca.Literal(s,new Rc.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 Ca.Literal)t=e.value;else if(e instanceof Rc.IRI)t=e.value;else if(e instanceof B_.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let r=n.unicodeCaseFold(t);return new Ca.Literal(r,new Rc.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=n.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}};qh.StringFunctions=Pu;Pu.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Pu.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 x3=b(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.MathFunctions=void 0;var U_=class{static{o(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()}};Wh.MathFunctions=U_});var Fu=b(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.DateTimeParsing=void 0;var DM=Ee(),NM=Me(),q_=class n{static{o(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,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDayTimeDuration: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=r.indexOf("T"),a="",c="";if(s===-1?a=r:(a=r.substring(0,s),c=r.substring(s+1)),a){let l=a.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(a!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${a}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let h=parseFloat(u[1]);i+=h*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let h=parseFloat(f[1]);i+=h*60*1e3,l=l.substring(f[0].length)}let d=l.match(/^(\d+(?:\.\d+)?)S$/);if(d){let h=parseFloat(d[1]);i+=h*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,r=Math.abs(e),i=Math.floor(r/(1440*60*1e3));r=r%(1440*60*1e3);let s=Math.floor(r/(3600*1e3));r=r%(3600*1e3);let a=Math.floor(r/(60*1e3));r=r%(60*1e3);let c=r/1e3,l=t?"-P":"P";return i>0&&(l+=`${i}D`),(s>0||a>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),a>0&&(l+=`${a}M`),(c>0||s===0&&a===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return n.parseDayTimeDuration(e),new NM.Literal(e,new DM.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(r[1],10),s=parseInt(r[2],10)-1,a=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,a));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),h=parseInt(u[3],10),p=f*(d*60+h)*60*1e3;l=new Date(l.getTime()-p)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),a=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||a<0||a>59||i===24&&(s!==0||a!==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+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let h=d[1]==="+"?1:-1,p=parseInt(d[2],10),y=parseInt(d[3],10),S=h*(p*60+y)*60*1e3;f-=S}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+a;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,a=t?"-P":"P";return i>0&&(a+=`${i}Y`),(s>0||i===0)&&(a+=`${s}M`),a}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:a,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=0,a=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.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,h=d.match(/^(\d+(?:\.\d+)?)H/);h&&(s=parseFloat(h[1]),d=d.substring(h[0].length));let p=d.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),d=d.substring(p[0].length));let y=d.match(/^(\d+(?:\.\d+)?)S$/);if(y&&(c=parseFloat(y[1]),d=d.substring(y[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}};Gh.DateTimeParsing=q_});var I3=b(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.DateTimeArithmetic=void 0;var un=Ee(),Te=Me(),rt=Fu(),W_=class{static{o(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r),a=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${r}'`);if(isNaN(a.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-a.getTime(),l=rt.DateTimeParsing.formatDayTimeDuration(c);return new Te.Literal(l,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=rt.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new Te.Literal(l.toISOString(),new un.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=rt.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new Te.Literal(l.toISOString(),new un.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=rt.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=rt.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Te.Literal(h,new un.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=rt.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=rt.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Te.Literal(h,new un.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=rt.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new Te.Literal(s.toISOString(),new un.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=rt.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new Te.Literal(s.toISOString(),new un.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=rt.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=rt.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+a),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 Te.Literal(d,new un.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=rt.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=rt.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-a),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 Te.Literal(d,new un.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=rt.DateTimeParsing.parseDayTimeDuration(r),a=rt.DateTimeParsing.parseDayTimeDuration(i),c=rt.DateTimeParsing.formatDayTimeDuration(s+a);return new Te.Literal(c,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=rt.DateTimeParsing.parseDayTimeDuration(r),a=rt.DateTimeParsing.parseDayTimeDuration(i),c=rt.DateTimeParsing.formatDayTimeDuration(s-a);return new Te.Literal(c,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof Te.Literal?e.value:e,i=rt.DateTimeParsing.parseDayTimeDuration(r),s=rt.DateTimeParsing.formatDayTimeDuration(i*t);return new Te.Literal(s,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationDivide(e,t){if(t===0)throw new Error("durationDivide: division by zero");let r=e instanceof Te.Literal?e.value:e,i=rt.DateTimeParsing.parseDayTimeDuration(r),s=rt.DateTimeParsing.formatDayTimeDuration(i/t);return new Te.Literal(s,new un.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=rt.DateTimeParsing.parseYearMonthDuration(r),a=rt.DateTimeParsing.parseYearMonthDuration(i),c=rt.DateTimeParsing.formatYearMonthDuration(s+a);return new Te.Literal(c,new un.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=rt.DateTimeParsing.parseYearMonthDuration(r),a=rt.DateTimeParsing.parseYearMonthDuration(i),c=rt.DateTimeParsing.formatYearMonthDuration(s-a);return new Te.Literal(c,new un.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Te.Literal?e.value:e;return rt.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Te.Literal?e.value:e;return rt.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Te.Literal?e.value:e;return rt.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Te.Literal?e.value:e;return rt.DateTimeParsing.parseDayTimeDuration(t)/1e3}};zh.DateTimeArithmetic=W_});var C3=b(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.DateTimeAccessors=void 0;var Du=Ee(),Nt=Me(),Tt=Fu(),G_=class{static{o(this,"DateTimeAccessors")}static year(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return t.getFullYear()}static month(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return t.getMonth()+1}static day(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return t.getDate()}static hours(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return t.getHours()}static minutes(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return t.getMinutes()}static seconds(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return t.getSeconds()+t.getMilliseconds()/1e3}static durationDays(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof Nt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let r;if(e.endsWith("Z"))r="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),a=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);a===0?r=`${c}PT${l}H`:r=`${c}PT${l}H${a}M`}else{let s=-t.getTimezoneOffset(),a=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?r=`${l}PT${a}H`:r=`${l}PT${a}H${c}M`}}return new Nt.Literal(r,new Du.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 r=e.match(/([+-]\d{2}:\d{2})$/);if(r)return r[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static adjust(e,t){let r=e instanceof Nt.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let ee=i.getUTCFullYear(),B=String(i.getUTCMonth()+1).padStart(2,"0"),G=String(i.getUTCDate()).padStart(2,"0"),F=String(i.getUTCHours()).padStart(2,"0"),D=String(i.getUTCMinutes()).padStart(2,"0"),W=String(i.getUTCSeconds()).padStart(2,"0"),De=i.getUTCMilliseconds(),et=`${ee}-${B}-${G}T${F}:${D}:${W}`;return De>0&&(et+=`.${String(De).padStart(3,"0")}`),new Nt.Literal(et,new Du.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof Nt.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(a)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+a),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),h=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),y=String(u.getUTCMinutes()).padStart(2,"0"),S=String(u.getUTCSeconds()).padStart(2,"0"),v=u.getUTCMilliseconds(),w=a>=0?"+":"-",T=Math.floor(Math.abs(a)/(3600*1e3)),C=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),L=`${w}${String(T).padStart(2,"0")}:${String(C).padStart(2,"0")}`,$=`${f}-${d}-${h}T${p}:${y}:${S}`;return v>0&&($+=`.${String(v).padStart(3,"0")}`),$+=L,new Nt.Literal($,new Du.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static now(){return new Date().toISOString()}static dateBefore(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t);return r<i}static dateAfter(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t);return r>i}static dateInRange(e,t,r){let i=Tt.DateTimeParsing.parseDate(e),s=Tt.DateTimeParsing.parseDate(t),a=Tt.DateTimeParsing.parseDate(r);return i>=s&&i<=a}static compareDurations(e,t,r){let i=e instanceof Nt.Literal?e.value:e,s=t instanceof Nt.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(i),c=Tt.DateTimeParsing.parseDayTimeDuration(s);switch(r){case"=":return a===c;case"!=":return a!==c;case"<":return a<c;case">":return a>c;case"<=":return a<=c;case">=":return a>=c;default:throw new Error(`compareDurations: unknown operator: ${r}`)}}static dateDiffMinutes(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static timeDiff(e,t){let r=e instanceof Nt.Literal?e.value:e,i=t instanceof Nt.Literal?t.value:t,s=Tt.DateTimeParsing.parseXSDTime(r),a=Tt.DateTimeParsing.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${r}'`);if(a===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-a,l=Tt.DateTimeParsing.formatDayTimeDuration(c);return new Nt.Literal(l,new Du.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof Nt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof Nt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof Nt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof Nt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof Nt.Literal?e.value:e,i=t instanceof Nt.Literal?t.value:t,s=Tt.DateTimeParsing.parseXSDDate(r),a=Tt.DateTimeParsing.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${r}'`);if(a===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-a.getTime(),l=Math.round(c/(1440*60*1e3)),u=Tt.DateTimeParsing.formatDateDuration(l);return new Nt.Literal(u,new Du.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};Hh.DateTimeAccessors=G_});var Kh=b(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.DateTimeFunctions=void 0;var Oc=Fu(),ar=I3(),gt=C3(),z_=class{static{o(this,"DateTimeFunctions")}static parseDate(e){return Oc.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Oc.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Oc.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Oc.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Oc.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Oc.DateTimeParsing.formatYearMonthDuration(e)}static year(e){return gt.DateTimeAccessors.year(e)}static month(e){return gt.DateTimeAccessors.month(e)}static day(e){return gt.DateTimeAccessors.day(e)}static hours(e){return gt.DateTimeAccessors.hours(e)}static minutes(e){return gt.DateTimeAccessors.minutes(e)}static seconds(e){return gt.DateTimeAccessors.seconds(e)}static durationDays(e){return gt.DateTimeAccessors.durationDays(e)}static durationHours(e){return gt.DateTimeAccessors.durationHours(e)}static durationMinutes(e){return gt.DateTimeAccessors.durationMinutes(e)}static durationSeconds(e){return gt.DateTimeAccessors.durationSeconds(e)}static durationYears(e){return gt.DateTimeAccessors.durationYears(e)}static durationMonths(e){return gt.DateTimeAccessors.durationMonths(e)}static timezone(e){return gt.DateTimeAccessors.timezone(e)}static tz(e){return gt.DateTimeAccessors.tz(e)}static adjust(e,t){return gt.DateTimeAccessors.adjust(e,t)}static now(){return gt.DateTimeAccessors.now()}static dateBefore(e,t){return gt.DateTimeAccessors.dateBefore(e,t)}static dateAfter(e,t){return gt.DateTimeAccessors.dateAfter(e,t)}static dateInRange(e,t,r){return gt.DateTimeAccessors.dateInRange(e,t,r)}static compareDurations(e,t,r){return gt.DateTimeAccessors.compareDurations(e,t,r)}static dateDiffMinutes(e,t){return gt.DateTimeAccessors.dateDiffMinutes(e,t)}static dateDiffHours(e,t){return gt.DateTimeAccessors.dateDiffHours(e,t)}static timeDiff(e,t){return gt.DateTimeAccessors.timeDiff(e,t)}static dateDiff(e,t){return gt.DateTimeAccessors.dateDiff(e,t)}static isDayTimeDuration(e){return gt.DateTimeAccessors.isDayTimeDuration(e)}static isDate(e){return gt.DateTimeAccessors.isDate(e)}static isYearMonthDuration(e){return gt.DateTimeAccessors.isYearMonthDuration(e)}static isTime(e){return gt.DateTimeAccessors.isTime(e)}static dateTimeDiff(e,t){return ar.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return ar.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return ar.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return ar.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return ar.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return ar.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return ar.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return ar.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return ar.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return ar.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return ar.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return ar.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return ar.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return ar.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return ar.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return ar.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return ar.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return ar.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return ar.DateTimeArithmetic.durationToSeconds(e)}};Qh.DateTimeFunctions=z_});var R3=b(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.LogicalFunctions=void 0;var LM=Ee(),Pc=Me(),kM=$t(),Yh=Kh(),H_=class n{static{o(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return Yh.DateTimeFunctions.compareDurations(e instanceof Pc.Literal?e:String(e),t instanceof Pc.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return Yh.DateTimeFunctions.compareDurations(e instanceof Pc.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return Yh.DateTimeFunctions.compareDurations(e,t instanceof Pc.Literal?t:String(t),r);let i=n.toComparableValue(e),s=n.toComparableValue(t);switch(r){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: ${r}`)}}static isDayTimeDurationValue(e){return e instanceof Pc.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 Pc.Literal){let t=e.datatype?.value;if(t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double")){let r=parseFloat(e.value);if(!isNaN(r))return r}if(t==="http://www.w3.org/2001/XMLSchema#dayTimeDuration")try{return Yh.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof LM.IRI?e.value:e instanceof kM.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,r){return e?t:r}};Xh.LogicalFunctions=H_});var O3=b(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.RDFTermFunctions=void 0;var Nr=Ee(),wt=Me(),pi=$t(),Fc=du(),Q_=ui(),K_=class n{static{o(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof wt.Literal)return e.datatype?e.datatype:e.language?new Nr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Nr.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 Nr.IRI}static isBlank(e){return e===void 0?!1:e instanceof pi.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof wt.Literal}static isTriple(e){return e===void 0?!1:e instanceof Fc.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof wt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof wt.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 wt.Literal(t.toISOString(),new Nr.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 wt.Literal(String(t),new Nr.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 wt.Literal(String(t),new Nr.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||e.constructor!==t.constructor)return!1;if(e instanceof Nr.IRI&&t instanceof Nr.IRI)return e.value===t.value;if(e instanceof pi.BlankNode&&t instanceof pi.BlankNode)return e.id===t.id;if(e instanceof wt.Literal&&t instanceof wt.Literal){if(e.value!==t.value||e.language!==t.language)return!1;let r=e.datatype?.value,i=t.datatype?.value;return r===i}return!1}static iri(e){if(e===void 0)throw new Error("IRI: argument is undefined");if(e instanceof Nr.IRI)return e;if(e instanceof wt.Literal)return new Nr.IRI(e.value);throw e instanceof pi.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return n.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,Q_.v4)().replace(/-/g,"").substring(0,12)}`;return new pi.BlankNode(t)}if(e instanceof wt.Literal)return new pi.BlankNode(e.value);if(e instanceof pi.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 r;if(e instanceof wt.Literal){if(e.language)throw new Error("STRDT: lexical form must not have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRDT: lexical form must be a string literal");let i;if(t instanceof Nr.IRI)i=t;else if(t instanceof wt.Literal)i=new Nr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new wt.Literal(r,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 r;if(e instanceof wt.Literal){if(e.language)throw new Error("STRLANG: lexical form must not already have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRLANG: lexical form must be a string literal");let i;if(t instanceof wt.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 wt.Literal(r,void 0,i)}static strlangdir(e,t,r){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(r===void 0)throw new Error("STRLANGDIR: direction is undefined");let i;if(e instanceof wt.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 wt.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 a;if(r instanceof wt.Literal)a=r.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(a!=="ltr"&&a!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${a}'. Must be 'ltr' or 'rtl'`);return new wt.Literal(i,void 0,s,a)}static uuid(){let e=(0,Q_.v4)();return new Nr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,Q_.v4)();return new wt.Literal(e)}static triple(e,t,r){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(r===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof wt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Nr.IRI)){let c=t instanceof wt.Literal?"Literal":t instanceof pi.BlankNode?"BlankNode":t instanceof Fc.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new Fc.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof Fc.QuotedTriple)){let t=e instanceof Nr.IRI?"IRI":e instanceof wt.Literal?"Literal":e instanceof pi.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 Fc.QuotedTriple)){let t=e instanceof Nr.IRI?"IRI":e instanceof wt.Literal?"Literal":e instanceof pi.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 Fc.QuotedTriple)){let t=e instanceof Nr.IRI?"IRI":e instanceof wt.Literal?"Literal":e instanceof pi.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};Jh.RDFTermFunctions=K_});var P3=b(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.HashFunctions=void 0;var Y_=class{static{o(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")}};Zh.HashFunctions=Y_});var tp=b(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});ep.BuiltInFunctions=void 0;var or=A3(),Ra=x3(),oe=Kh(),Dc=R3(),It=O3(),Nu=P3(),X_=class{static{o(this,"BuiltInFunctions")}static str(...e){return or.StringFunctions.str(...e)}static lang(...e){return or.StringFunctions.lang(...e)}static langdir(...e){return or.StringFunctions.langdir(...e)}static langMatches(...e){return or.StringFunctions.langMatches(...e)}static regex(...e){return or.StringFunctions.regex(...e)}static contains(...e){return or.StringFunctions.contains(...e)}static strStarts(...e){return or.StringFunctions.strStarts(...e)}static strEnds(...e){return or.StringFunctions.strEnds(...e)}static strlen(...e){return or.StringFunctions.strlen(...e)}static ucase(...e){return or.StringFunctions.ucase(...e)}static lcase(...e){return or.StringFunctions.lcase(...e)}static substr(...e){return or.StringFunctions.substr(...e)}static strBefore(...e){return or.StringFunctions.strBefore(...e)}static strAfter(...e){return or.StringFunctions.strAfter(...e)}static concat(...e){return or.StringFunctions.concat(...e)}static replace(...e){return or.StringFunctions.replace(...e)}static encodeForUri(...e){return or.StringFunctions.encodeForUri(...e)}static normalize(...e){return or.StringFunctions.normalize(...e)}static fold(...e){return or.StringFunctions.fold(...e)}static abs(...e){return Ra.MathFunctions.abs(...e)}static round(...e){return Ra.MathFunctions.round(...e)}static ceil(...e){return Ra.MathFunctions.ceil(...e)}static floor(...e){return Ra.MathFunctions.floor(...e)}static rand(){return Ra.MathFunctions.rand()}static msToMinutes(...e){return Ra.MathFunctions.msToMinutes(...e)}static msToHours(...e){return Ra.MathFunctions.msToHours(...e)}static msToSeconds(...e){return Ra.MathFunctions.msToSeconds(...e)}static parseDate(...e){return oe.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return oe.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return oe.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return oe.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return oe.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return oe.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return oe.DateTimeFunctions.year(...e)}static month(...e){return oe.DateTimeFunctions.month(...e)}static day(...e){return oe.DateTimeFunctions.day(...e)}static hours(...e){return oe.DateTimeFunctions.hours(...e)}static minutes(...e){return oe.DateTimeFunctions.minutes(...e)}static seconds(...e){return oe.DateTimeFunctions.seconds(...e)}static timezone(...e){return oe.DateTimeFunctions.timezone(...e)}static tz(...e){return oe.DateTimeFunctions.tz(...e)}static now(){return oe.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return oe.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return oe.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return oe.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return oe.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return oe.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return oe.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return oe.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return oe.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return oe.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return oe.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return oe.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return oe.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return oe.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return oe.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return oe.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return oe.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return oe.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return oe.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return oe.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return oe.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return oe.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return oe.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return oe.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return oe.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return oe.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return oe.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return oe.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return oe.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return oe.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return oe.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return oe.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return oe.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return oe.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return oe.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return oe.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return oe.DateTimeFunctions.adjust(...e)}static isTime(...e){return oe.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return oe.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Dc.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Dc.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Dc.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Dc.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Dc.LogicalFunctions.coalesce(...e)}static if(...e){return Dc.LogicalFunctions.if(...e)}static datatype(...e){return It.RDFTermFunctions.datatype(...e)}static bound(...e){return It.RDFTermFunctions.bound(...e)}static isIRI(...e){return It.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return It.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return It.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return It.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return It.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return It.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return It.RDFTermFunctions.sameTerm(...e)}static iri(...e){return It.RDFTermFunctions.iri(...e)}static uri(...e){return It.RDFTermFunctions.uri(...e)}static bnode(...e){return It.RDFTermFunctions.bnode(...e)}static strdt(...e){return It.RDFTermFunctions.strdt(...e)}static strlang(...e){return It.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return It.RDFTermFunctions.strlangdir(...e)}static uuid(){return It.RDFTermFunctions.uuid()}static struuid(){return It.RDFTermFunctions.struuid()}static xsdDateTime(...e){return It.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return It.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return It.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return It.RDFTermFunctions.triple(...e)}static subject(...e){return It.RDFTermFunctions.subject(...e)}static predicate(...e){return It.RDFTermFunctions.predicate(...e)}static object(...e){return It.RDFTermFunctions.object(...e)}static md5(...e){return Nu.HashFunctions.md5(...e)}static sha1(...e){return Nu.HashFunctions.sha1(...e)}static sha256(...e){return Nu.HashFunctions.sha256(...e)}static sha384(...e){return Nu.HashFunctions.sha384(...e)}static sha512(...e){return Nu.HashFunctions.sha512(...e)}};ep.BuiltInFunctions=X_});var Lu=b(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.ExoQLBudgetExceededError=ns.ExoQLCycleError=ns.ExoQLEvalDisabledError=ns.ExoQLForbiddenKeywordError=void 0;var J_=class extends Error{static{o(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}};ns.ExoQLForbiddenKeywordError=J_;var Z_=class extends Error{static{o(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};ns.ExoQLEvalDisabledError=Z_;var e1=class extends Error{static{o(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};ns.ExoQLCycleError=e1;var t1=class extends Error{static{o(this,"ExoQLBudgetExceededError")}constructor(e,t,r,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${r})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=r}};ns.ExoQLBudgetExceededError=t1});var V3=b(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var j=tp();M.functionHandlers=new Map;M.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.str(t)});M.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.lang(t)});M.functionHandlers.set("langmatches",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.langMatches(t,r)});M.functionHandlers.set("contains",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.contains(t,r)});M.functionHandlers.set("strstarts",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strStarts(t,r)});M.functionHandlers.set("strends",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strEnds(t,r)});M.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.strlen(t)});M.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.ucase(t)});M.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.lcase(t)});M.functionHandlers.set("substr",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=Number(e.evaluateExpression(n[1],e.solution));if(n[2]){let i=Number(e.evaluateExpression(n[2],e.solution));return j.BuiltInFunctions.substr(t,r,i)}return j.BuiltInFunctions.substr(t,r)});M.functionHandlers.set("strbefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strBefore(t,r)});M.functionHandlers.set("strafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strAfter(t,r)});M.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return j.BuiltInFunctions.concat(...t)});M.functionHandlers.set("replace",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution)),s=n[3]?e.getStringValue(e.evaluateExpression(n[3],e.solution)):void 0;return j.BuiltInFunctions.replace(t,r,i,s)});M.functionHandlers.set("regex",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=n[2]?e.getStringValue(e.evaluateExpression(n[2],e.solution)):void 0;return j.BuiltInFunctions.regex(t,r,i)});M.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.encodeForUri(t)});M.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.datatype(t).value});M.functionHandlers.set("bound",(n,e)=>{let t=n[0];if(t.type==="variable"&&t.name){let r=e.solution.get(t.name);return j.BuiltInFunctions.bound(r)}return!0});var F3=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",F3);M.functionHandlers.set("isuri",F3);M.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isBlank(t)});M.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isLiteral(t)});M.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isNumeric(t)});M.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.hasLangdir(t)});M.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isTriple(t)});M.functionHandlers.set("sameterm",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution);return j.BuiltInFunctions.sameTerm(t,r)});M.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return j.BuiltInFunctions.abs(t)});M.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return j.BuiltInFunctions.round(t)});M.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return j.BuiltInFunctions.ceil(t)});M.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return j.BuiltInFunctions.floor(t)});M.functionHandlers.set("rand",()=>j.BuiltInFunctions.rand());M.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.parseDate(t)});M.functionHandlers.set("datebefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateBefore(t,r)});M.functionHandlers.set("dateafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateAfter(t,r)});M.functionHandlers.set("dateinrange",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution));return j.BuiltInFunctions.dateInRange(t,r,i)});M.functionHandlers.set("datediffminutes",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateDiffMinutes(t,r)});M.functionHandlers.set("datediffhours",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateDiffHours(t,r)});var Nc=o((n,e,t)=>(r,i)=>{let s=i.evaluateExpression(r[0],i.solution);return e&&i.isYearMonthDurationValue(s)?e(s):t&&i.isDayTimeDurationValue(s)?t(s):n(i.getStringValue(s))},"createDateTimeAccessor"),D3=Nc(j.BuiltInFunctions.year.bind(j.BuiltInFunctions),j.BuiltInFunctions.durationYears.bind(j.BuiltInFunctions),null);M.functionHandlers.set("year",D3);M.functionHandlers.set("years",D3);var N3=Nc(j.BuiltInFunctions.month.bind(j.BuiltInFunctions),j.BuiltInFunctions.durationMonths.bind(j.BuiltInFunctions),null);M.functionHandlers.set("month",N3);M.functionHandlers.set("months",N3);var L3=Nc(j.BuiltInFunctions.day.bind(j.BuiltInFunctions),null,j.BuiltInFunctions.durationDays.bind(j.BuiltInFunctions));M.functionHandlers.set("day",L3);M.functionHandlers.set("days",L3);M.functionHandlers.set("hours",Nc(j.BuiltInFunctions.hours.bind(j.BuiltInFunctions),null,j.BuiltInFunctions.durationHours.bind(j.BuiltInFunctions)));M.functionHandlers.set("minutes",Nc(j.BuiltInFunctions.minutes.bind(j.BuiltInFunctions),null,j.BuiltInFunctions.durationMinutes.bind(j.BuiltInFunctions)));M.functionHandlers.set("seconds",Nc(j.BuiltInFunctions.seconds.bind(j.BuiltInFunctions),null,j.BuiltInFunctions.durationSeconds.bind(j.BuiltInFunctions)));M.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.timezone(t)});M.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.tz(t)});M.functionHandlers.set("adjust",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=n.length>1?e.evaluateExpression(n[1],e.solution):void 0;return j.BuiltInFunctions.adjust(t,r)});M.functionHandlers.set("now",()=>j.BuiltInFunctions.now());var k3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",k3);M.functionHandlers.set("xsd:datetime",k3);var j3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",j3);M.functionHandlers.set("xsd:integer",j3);var M3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",M3);M.functionHandlers.set("xsd:decimal",M3);var $3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",$3);M.functionHandlers.set("xsd:daytimeduration",$3);M.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToDays(t)});M.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToHours(t)});M.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToMinutes(t)});M.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToSeconds(t)});M.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationDays(t)});M.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationHours(t)});M.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationMinutes(t)});M.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationSeconds(t)});M.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationYears(t)});M.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationMonths(t)});M.functionHandlers.set("datetimediff",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeDiff(t,r)});M.functionHandlers.set("datetimeadd",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeAdd(t,r)});M.functionHandlers.set("datetimesubtract",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeSubtract(t,r)});M.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToMinutes(t)});M.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToHours(t)});M.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToSeconds(t)});M.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.md5(t)});M.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha1(t)});M.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha256(t)});M.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha384(t)});M.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha512(t)});M.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.subject(t)});M.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.predicate(t)});M.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.object(t)});M.functionHandlers.set("triple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution),i=e.getTermFromExpression(n[2],e.solution);return j.BuiltInFunctions.triple(t,r,i)});M.functionHandlers.set("days_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(1440*60*1e3))});M.functionHandlers.set("minutes_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(60*1e3))});M.functionHandlers.set("hours_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return(new Date(r).getTime()-i.getTime())/(3600*1e3)});M.functionHandlers.set("age_days",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t);return Math.floor((new Date().getTime()-r.getTime())/(1440*60*1e3))});M.functionHandlers.set("week_number",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t),i=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.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)});M.functionHandlers.set("format_date",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return r.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"))});M.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:n}=Lu();throw new n})});var rp=b(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.FilterExecutor=Lc.FilterExecutorError=void 0;var yt=tp(),jM=V3(),r1=Ee(),is=Me(),yr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Lc.FilterExecutorError=yr;var n1=class{static{o(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 r=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;r?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(r=>this.expressionContainsExists(r))}if(e.type==="function"||e.type==="functionCall"){let t=e;return Array.isArray(t.args)?t.args.some(r=>this.expressionContainsExists(r)):!1}return!1}async executeAll(e,t){let r=[];async function*i(){for(let s of t)yield s}o(i,"generator");for await(let s of this.execute(e,i()))r.push(s);return r}evaluateExpression(e,t){let r=e;if("termType"in e)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":{let i=r.value,s=r.datatype,a=typeof s=="string"?s:s?.value;return a&&i.length>0&&this.shouldPreserveDatatype(a)?new is.Literal(i,new r1.IRI(a)):i}case"NamedNode":return r.value;default:throw new yr(`Unsupported termType: ${String(r.termType)}`)}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 is.Literal(i.value,new r1.IRI(i.datatype)):i.value}case"in":return this.evaluateIn(e,t);case"exists":throw new yr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new yr(`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 r=e,i=await this.evaluateExpressionAsync(r.left,t),s=await this.evaluateExpressionAsync(r.right,t);return yt.BuiltInFunctions.compare(i,s,r.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 yr("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let r=await this.existsEvaluator(e.pattern,t);return e.negated?!r:r}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let i=await this.evaluateExpressionAsync(e.operands[0],t);return yt.BuiltInFunctions.logicalNot(i)}let r=[];for(let i of e.operands){let s=await this.evaluateExpressionAsync(i,t);r.push(s)}if(e.operator==="&&")return yt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return yt.BuiltInFunctions.logicalOr(r);throw new yr(`Unknown logical operator: ${String(e.operator)}`)}async evaluateInAsync(e,t){let r=await this.evaluateExpressionAsync(e.expression,t),i=!1;for(let s of e.list){let a=await this.evaluateExpressionAsync(s,t);if(yt.BuiltInFunctions.compare(r,a,"=")){i=!0;break}}return e.negated?!i:i}async evaluateFunctionAsync(e,t){let r=e,i=this.extractFunctionName(r.function),s=r.args??[];if(i==="if"){if(s.length!==3)throw new yr("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 a=[];for(let l of s){let u=await this.evaluateExpressionAsync(l,t);a.push(this.wrapAsLiteralExpression(u))}let c={...r,args:a};return this.evaluateFunction(c,t)}wrapAsLiteralExpression(e){return e==null?{type:"literal",value:""}:typeof e=="object"&&"termType"in e?e:e instanceof r1.IRI||e instanceof is.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 r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return yt.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return yt.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return yt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return yt.BuiltInFunctions.logicalOr(r);throw new yr(`Unknown logical operator: ${String(e.operator)}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let a=this.evaluateExpression(s,t);return yt.BuiltInFunctions.compare(r,a,"=")});return e.negated?!i:i}evaluateArithmetic(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(r)&&this.isDateValue(i))return yt.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return yt.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return yt.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return yt.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return yt.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new yr("Division by zero");return yt.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),a=this.toNumericValue(i);switch(e.operator){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":if(a===0)throw new yr("Division by zero");return s/a;default:throw new yr(`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 is.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof is.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof is.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 r=parseFloat(e.value);if(!isNaN(r))return r}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 yr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof is.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 is.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof is.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let r=e,i=this.extractFunctionName(r.function),s=this.evaluateSpecialFunction(i,r.args,t);if(s!==void 0)return s.value;let a=jM.functionHandlers.get(i);if(!a)throw new yr(`Unknown function: ${i}`);let c={evaluateExpression:o((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:o((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:o(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:o(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:o(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return a(r.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 yr(`Unknown function format: ${String(e)}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let i of t)try{let s=this.evaluateExpression(i,r);if(s!=null)return{value:s}}catch{continue}return{value:void 0};case"if":{if(!t||t.length!==3)throw new yr("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],r);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],r):this.evaluateExpression(t[2],r)}}case"byuuid":return{value:this.evaluateByUUID({type:"function",function:"byuuid",args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":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 is.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 r=parseFloat(e.value);return!isNaN(r)&&r!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new yr("exo:byUUID requires exactly 1 argument (UUID string)");let r=this.evaluateExpression(e.args[0],t),i=this.getStringValue(r);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 a=this.tripleStore.findSubjectsByUUIDSync(s);if(a.length===0){this.uuidCache.set(s,null);return}let c=a[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let r=e.toLowerCase();this.uuidCache.set(r,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Lc.FilterExecutor=n1});var s1=b(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.OptionalExecutor=void 0;var i1=class{static{o(this,"OptionalExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(r,i)}async executeAll(e,t){let r=[];for(let i of this.hashJoin(e,t))r.push(i);return r}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let r=new Set;for(let l of e)for(let u of l.variables())r.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 r)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let a="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,a),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,a),f=c.get(u),d=!1;if(f)for(let h of f){let p=l.merge(h);p!==null&&(yield p,d=!0)}d||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let a=e.get(s);i.push(a!==void 0?a.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let a=r.merge(s);a!==null&&(yield a,i=!0)}i||(yield r)}}};np.OptionalExecutor=i1});var o1=b(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.UnionExecutor=void 0;var a1=class{static{o(this,"UnionExecutor")}async*execute(e,t){let r=new Set;for await(let i of e){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}for await(let i of t){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};ip.UnionExecutor=a1});var B3=b(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.MinusExecutor=void 0;var c1=class{static{o(this,"MinusExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);for(let s of r){let a=!1;for(let c of i)if(this.areCompatible(s,c)){a=!0;break}a||(yield s)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}areCompatible(e,t){let r=e.variables(),i=new Set(t.variables()),s=r.filter(a=>i.has(a));if(s.length===0)return!1;for(let a of s){let c=e.get(a),l=t.get(a);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};sp.MinusExecutor=c1});var q3=b(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.ValuesExecutor=kc.ValuesExecutorError=void 0;var MM=rs(),U3=Ee(),$M=Me(),ap=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};kc.ValuesExecutorError=ap;var l1=class{static{o(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 r of this.execute(e))t.push(r);return t}createSolutionMapping(e){let t=new MM.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.toRDFTerm(i);t.set(r,s)}return t}toRDFTerm(e){if(e.type==="iri")return new U3.IRI(e.value);if(e.type==="literal")return new $M.Literal(e.value,e.datatype?new U3.IRI(e.datatype):void 0,e.language,e.direction);throw new ap(`Unknown term type: ${e.type}`)}};kc.ValuesExecutor=l1});var u1=b(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.CustomAggregateRegistry=Mc.CustomAggregateError=void 0;var jc=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Mc.CustomAggregateError=jc;var op=class n{static{o(this,"CustomAggregateRegistry")}constructor(){this.aggregates=new Map}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance&&n.instance.clear(),n.instance=null}register(e,t){if(!e||typeof e!="string")throw new jc("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new jc("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new jc(`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}};Mc.CustomAggregateRegistry=op;op.instance=null});var f1=b(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.BUILT_IN_AGGREGATES=nt.modeAggregate=nt.stddevAggregate=nt.varianceAggregate=nt.medianAggregate=nt.EXO_AGGREGATE_NS=void 0;nt.getNumericValue=cp;nt.createDecimalLiteral=mi;nt.createDoubleLiteral=UM;nt.createPercentileAggregate=Ao;var xo=Me(),$c=Ee(),VM=new $c.IRI("http://www.w3.org/2001/XMLSchema#decimal"),BM=new $c.IRI("http://www.w3.org/2001/XMLSchema#double");nt.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function cp(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof xo.Literal?parseFloat(n.value):n instanceof $c.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(cp,"getNumericValue");function mi(n){return new xo.Literal(String(n),VM)}o(mi,"createDecimalLiteral");function UM(n){return new xo.Literal(String(n),BM)}o(UM,"createDoubleLiteral");nt.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=cp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return mi(0);let r=[...t].sort((a,c)=>a-c),i=Math.floor(r.length/2),s=r.length%2!==0?r[i]:(r[i-1]+r[i])/2;return mi(s)}};nt.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=cp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return mi(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return mi(i)}};nt.stddevAggregate={init(){return{values:[]}},step(n,e){nt.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return mi(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return mi(Math.sqrt(i))}};nt.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof xo.Literal||e instanceof $c.IRI?e.value:e),i=t.counts.get(r)||0;t.counts.set(r,i+1),t.values.set(r,e)},finalize(n){let e=n;if(e.counts.size===0)return new xo.Literal(" ",new $c.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",r=0;for(let[a,c]of e.counts)c>r&&(r=c,t=a);let i=e.values.get(t);if(i instanceof xo.Literal)return i;let s=parseFloat(t);return isNaN(s)?new xo.Literal(t,new $c.IRI("http://www.w3.org/2001/XMLSchema#string")):mi(s)}};function Ao(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=cp(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return mi(0);let s=[...i].sort((d,h)=>d-h),a=r.percentile*(s.length-1),c=Math.floor(a),l=Math.ceil(a);if(c===l)return mi(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return mi(f)}}}o(Ao,"createPercentileAggregate");nt.BUILT_IN_AGGREGATES={[`${nt.EXO_AGGREGATE_NS}median`]:nt.medianAggregate,[`${nt.EXO_AGGREGATE_NS}variance`]:nt.varianceAggregate,[`${nt.EXO_AGGREGATE_NS}stddev`]:nt.stddevAggregate,[`${nt.EXO_AGGREGATE_NS}mode`]:nt.modeAggregate,[`${nt.EXO_AGGREGATE_NS}percentile25`]:Ao(25),[`${nt.EXO_AGGREGATE_NS}percentile50`]:Ao(50),[`${nt.EXO_AGGREGATE_NS}percentile75`]:Ao(75),[`${nt.EXO_AGGREGATE_NS}percentile90`]:Ao(90),[`${nt.EXO_AGGREGATE_NS}percentile95`]:Ao(95),[`${nt.EXO_AGGREGATE_NS}percentile99`]:Ao(99)}});var z3=b(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.AggregateExecutor=Vc.AggregateExecutorError=void 0;var cr=Me(),h1=Ee(),qM=rp(),WM=u1(),GM=f1(),W3=new h1.IRI("http://www.w3.org/2001/XMLSchema#integer"),Io=new h1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),ss=new h1.IRI("http://www.w3.org/2001/XMLSchema#string");function G3(n){return typeof n=="object"&&n.type==="custom"}o(G3,"isCustomAggregation");var ku=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Vc.AggregateExecutorError=ku;var d1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new qM.FilterExecutor}execute(e,t){let r=this.groupSolutions(t,e.variables),i=[];for(let[s,a]of r.entries()){let c=new Map;for(let f of e.variables)if(a.length>0){let d=a[0].get(f);d&&c.set(f,d)}for(let f of e.aggregates){let d=this.computeAggregate(f.expression,a);c.set(f.variable,d)}let{SolutionMapping:l}=rs(),u=new l;for(let[f,d]of c.entries())u.set(f,d);i.push(u)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let r=new Map;if(t.length===0)return r.set("",e),r;for(let i of e){let s=this.computeGroupKey(i,t),a=r.get(s);a?a.push(i):r.set(s,[i])}return r}computeGroupKey(e,t){return t.map(r=>{let i=e.get(r);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(G3(e.aggregation))return this.computeCustomAggregate(e,t);let r=this.extractValues(e,t),i=e.aggregation;switch(i){case"count":{let s=this.computeCount(r,e.distinct);return new cr.Literal(String(s),W3)}case"sum":{let s=this.computeSum(r);return new cr.Literal(String(s),Io)}case"avg":{let s=this.computeAvg(r);return new cr.Literal(String(s),Io)}case"min":{let s=this.computeMin(r);return s===void 0?new cr.Literal("",ss):typeof s=="number"?new cr.Literal(String(s),Io):new cr.Literal(String(s),ss)}case"max":{let s=this.computeMax(r);return s===void 0?new cr.Literal("",ss):typeof s=="number"?new cr.Literal(String(s),Io):new cr.Literal(String(s),ss)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new cr.Literal(s||" ",ss)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new cr.Literal(" ",ss):typeof s=="number"?new cr.Literal(String(s),Io):new cr.Literal(String(s),ss)}default:{let s=i;throw new ku(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=WM.CustomAggregateRegistry.getInstance().get(i);if(a||(a=GM.BUILT_IN_AGGREGATES[i]),!a)throw new ku(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=a.init();for(let l of t){let u=null;if(e.expression){let f=this.evaluateExpression(e.expression,l);f!==void 0&&(u=f)}else u=1;a.step(c,u)}return a.finalize(c)}extractValues(e,t){if(!e.expression)return t.map(()=>1);let r=[];for(let i of t){let s=this.evaluateExpression(e.expression,i);s!=null&&r.push(s)}return r}evaluateExpression(e,t){if(e.type==="variable"){let r=t.get(e.name);return r==null?void 0:typeof r=="number"||typeof r=="string"||typeof r=="boolean"?r:typeof r=="object"&&"value"in r?r.value:r}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(r=>String(r))).size:e.length}computeSum(e){return e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r)).reduce((r,i)=>r+i,0)}computeAvg(e){let t=e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r));return t.length===0?0:t.reduce((r,i)=>r+i,0)/t.length}computeMin(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.min(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s<i?s:i,r[0])}computeMax(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.max(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s>i?s:i,r[0])}computeGroupConcat(e,t,r){let i=e.map(s=>String(s));return r&&(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 a=s[0],c=parseFloat(a);return isNaN(c)?a:c}let r=e[0];if(typeof r=="number")return r;let i=parseFloat(String(r));return isNaN(i)?String(r):i}createEmptyAggregateResult(e){let{SolutionMapping:t}=rs(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(G3(s)){r.set(i.variable,new cr.Literal("0",Io));continue}switch(s){case"count":r.set(i.variable,new cr.Literal("0",W3));break;case"sum":case"avg":r.set(i.variable,new cr.Literal("0",Io));break;case"group_concat":r.set(i.variable,new cr.Literal(" ",ss));break;case"min":case"max":case"sample":r.set(i.variable,new cr.Literal("",ss));break;default:r.set(i.variable,new cr.Literal("",ss))}}return r}};Vc.AggregateExecutor=d1});var y1=b(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.ConstructExecutor=void 0;var zM=Yn(),Co=Ee(),p1=Me(),m1=$t(),HM=du(),g1=class{static{o(this,"ConstructExecutor")}async execute(e,t){let r=[],i=new Set;for(let s of t)for(let a of e)try{let c=this.instantiateTriple(a,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),r.push(c))}catch{continue}return r}instantiateTriple(e,t){if(this.isPropertyPath(e.predicate))throw new Error("Property paths are not supported in CONSTRUCT templates");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.predicate,t),s=this.instantiateElement(e.object,t);return new zM.Triple(r,i,s)}isPropertyPath(e){return e.type==="path"}instantiateElement(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable: ${e.value}`);return r}if(e.type==="iri")return new Co.IRI(e.value);if(e.type==="literal")return new p1.Literal(e.value,e.datatype?new Co.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new m1.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Unknown element type: ${e.type}`)}instantiateQuotedTriple(e,t){let r=this.instantiateQuotedSubject(e.subject,t),i=this.instantiateQuotedPredicate(e.predicate,t),s=this.instantiateQuotedObject(e.object,t);return new HM.QuotedTriple(r,i,s)}instantiateQuotedSubject(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple subject: ${e.value}`);if(r instanceof p1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new Co.IRI(e.value);if(e.type==="blank")return new m1.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 r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple predicate: ${e.value}`);if(!(r instanceof Co.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new Co.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 Co.IRI(e.value);if(e.type==="blank")return new m1.BlankNode(e.value);if(e.type==="literal")return new p1.Literal(e.value,e.datatype?new Co.IRI(e.datatype):void 0,e.language);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);let r=e;throw new Error(`Invalid element type for quoted triple object: ${r.type}`)}};lp.ConstructExecutor=g1});var Q3=b(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.ServiceExecutor=Bc.ServiceExecutorError=void 0;var QM=rs(),H3=Ee(),KM=Me(),YM=$t(),Ro=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Bc.ServiceExecutorError=Ro;var _1=class{static{o(this,"ServiceExecutor")}constructor(e={}){this.timeout=e.timeout??3e4,this.httpClient=e.httpClient??((t,r)=>fetch(t,r)),this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3}async*execute(e,t){try{let r=t(e.pattern),i=await this.executeRemoteQuery(e.endpoint,r);for(let s of i)yield s}catch(r){if(e.silent)return;throw r}}async executeRemoteQuery(e,t){let r;for(let i=0;i<=this.maxRetries;i++)try{let s=new AbortController,a=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 Ro(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(a)}}catch(s){if(r=s instanceof Error?s:new Error(String(s)),this.isRetryableError(r)&&i<this.maxRetries){await this.delay(this.retryDelay);continue}throw new Ro(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Ro(`Failed to query remote SPARQL endpoint ${e} after ${this.maxRetries+1} attempts`,r)}parseJsonResults(e){return!e.results||!Array.isArray(e.results.bindings)?[]:e.results.bindings.map(t=>this.parseBinding(t))}parseBinding(e){let t=new QM.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.parseRDFTerm(i);t.set(r,s)}return t}parseRDFTerm(e){switch(e.type){case"uri":return new H3.IRI(e.value);case"literal":{let t=e.datatype?new H3.IRI(e.datatype):void 0;return new KM.Literal(e.value,t,e["xml:lang"])}case"bnode":return new YM.BlankNode(e.value);default:throw new Ro(`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))}};Bc.ServiceExecutor=_1});var Y3=b(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.GraphExecutor=Uc.GraphExecutorError=void 0;var K3=Ee(),up=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};Uc.GraphExecutorError=up;var b1=class{static{o(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,r){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,r);else throw new up(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new K3.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*r(e,i))}async*executeWithGraphVariable(e,t,r,i){if(i){let a=i.get(t.value);if(a&&a instanceof K3.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:a.value},r);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let a of s)for await(let c of r(e.pattern,a)){let l=c.clone();l.set(t.value,a),yield l}}};Uc.GraphExecutor=b1});var X3=b(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.SPARQLGenerator=Wc.SPARQLGeneratorError=void 0;var qc=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Wc.SPARQLGeneratorError=qc;var S1=class{static{o(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
49
49
|
${i}
|
|
50
50
|
}`}generateWhereClause(e,t=2){let r=" ".repeat(t);switch(e.type){case"bgp":return this.generateBGP(e,t);case"filter":return`${this.generateWhereClause(e.input,t)}
|
|
51
51
|
${r}FILTER(${this.generateExpression(e.expression)})`;case"join":return`${this.generateWhereClause(e.left,t)}
|
|
@@ -67,7 +67,7 @@ ${r}}`}default:throw new qc(`Unsupported operation type for SPARQL generation: $
|
|
|
67
67
|
`)}generateTriple(e){let t=this.generateElement(e.subject),r=this.generatePredicate(e.predicate),i=this.generateElement(e.object);return`${t} ${r} ${i}`}generatePredicate(e){return"pathType"in e?this.generatePropertyPath(e):this.generateElement(e)}generatePropertyPath(e){let t=e.items.map(r=>"pathType"in r?`(${this.generatePropertyPath(r)})`:`<${r.value}>`);switch(e.pathType){case"/":return t.join("/");case"|":return t.join("|");case"^":return`^${t[0]}`;case"+":return`${t[0]}+`;case"*":return`${t[0]}*`;case"?":return`${t[0]}?`}}generateElement(e){switch(e.type){case"variable":return`?${e.value}`;case"iri":return`<${e.value}>`;case"literal":{let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}case"blank":return`_:${e.value}`;default:throw new qc(`Unknown element type: ${e.type}`)}}generateValues(e,t){let r=" ".repeat(t);if(e.variables.length===0||e.bindings.length===0)return"";if(e.variables.length===1){let a=e.variables[0],c=e.bindings.map(l=>{let u=l[a];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ");return`${r}VALUES ?${a} { ${c} }`}let i=e.variables.map(a=>`?${a}`).join(" "),s=e.bindings.map(a=>`(${e.variables.map(l=>{let u=a[l];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ")})`);return`${r}VALUES (${i}) {
|
|
68
68
|
${s.map(a=>`${r} ${a}`).join(`
|
|
69
69
|
`)}
|
|
70
|
-
${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}generateExpression(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:typeof e.value=="boolean"?e.value?"true":"false":String(e.value);case"comparison":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"logical":return e.operator==="!"?`!(${this.generateExpression(e.operands[0])})`:`(${e.operands.map(t=>this.generateExpression(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"function":return`${e.function.toUpperCase()}(${e.args.map(t=>this.generateExpression(t)).join(", ")})`;case"functionCall":return`${(typeof e.function=="string"?e.function:e.function.value).toUpperCase()}(${e.args.map(r=>this.generateExpression(r)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),r=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${r})`:`${t} IN (${r})`}default:throw new qc(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let r of e.triples)this.collectVariablesFromTriple(r,t);break;case"filter":this.collectVariablesFromOperation(e.input,t),this.collectVariablesFromExpression(e.expression,t);break;case"join":case"leftjoin":case"union":case"minus":this.collectVariablesFromOperation(e.left,t),this.collectVariablesFromOperation(e.right,t);break;case"values":for(let r of e.variables)t.add(r);break;case"project":for(let r of e.variables)t.add(r);this.collectVariablesFromOperation(e.input,t);break;case"extend":t.add(e.variable),this.collectVariablesFromOperation(e.input,t);break;case"orderby":case"slice":case"distinct":case"reduced":this.collectVariablesFromOperation(e.input,t);break;case"group":for(let r of e.variables)t.add(r);for(let r of e.aggregates)t.add(r.variable);this.collectVariablesFromOperation(e.input,t);break;case"subquery":this.collectVariablesFromOperation(e.query,t);break}}collectVariablesFromTriple(e,t){e.subject.type==="variable"&&t.add(e.subject.value),"type"in e.predicate&&e.predicate.type==="variable"&&t.add(e.predicate.value),e.object.type==="variable"&&t.add(e.object.value)}collectVariablesFromExpression(e,t){switch(e.type){case"variable":t.add(e.name);break;case"comparison":case"arithmetic":this.collectVariablesFromExpression(e.left,t),this.collectVariablesFromExpression(e.right,t);break;case"logical":for(let r of e.operands)this.collectVariablesFromExpression(r,t);break;case"function":case"functionCall":for(let r of e.args)this.collectVariablesFromExpression(r,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let r of e.list)this.collectVariablesFromExpression(r,t);break}}};Wc.SPARQLGenerator=S1});var zc=b(Cn=>{"use strict";var XM=Cn&&Cn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),JM=Cn&&Cn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),J3=Cn&&Cn.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&XM(t,e,r[i]);return JM(t,e),t}})();Object.defineProperty(Cn,"__esModule",{value:!0});Cn.QueryExecutor=Cn.ExoQLQueryExecutor=Cn.QueryExecutorError=void 0;var ZM=V_(),e9=rp(),t9=s1(),r9=o1(),n9=B3(),i9=q3(),s9=z3(),a9=y1(),o9=Q3(),c9=Y3(),l9=X3(),u9=Ee(),f9=Me(),d9=Kh(),Lr="http://www.w3.org/2001/XMLSchema#",h9=new Set([`${Lr}integer`,`${Lr}decimal`,`${Lr}float`,`${Lr}double`,`${Lr}nonPositiveInteger`,`${Lr}negativeInteger`,`${Lr}long`,`${Lr}int`,`${Lr}short`,`${Lr}byte`,`${Lr}nonNegativeInteger`,`${Lr}unsignedLong`,`${Lr}unsignedInt`,`${Lr}unsignedShort`,`${Lr}unsignedByte`,`${Lr}positiveInteger`]),Gc=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};Cn.QueryExecutorError=Gc;var fp=class{static{o(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new ZM.BGPExecutor(e),this.filterExecutor=new e9.FilterExecutor,this.optionalExecutor=new t9.OptionalExecutor,this.unionExecutor=new r9.UnionExecutor,this.minusExecutor=new n9.MinusExecutor,this.valuesExecutor=new i9.ValuesExecutor,this.aggregateExecutor=new s9.AggregateExecutor,this.constructExecutor=new a9.ConstructExecutor,this.serviceExecutor=new o9.ServiceExecutor(t.serviceConfig),this.graphExecutor=new c9.GraphExecutor(e),this.sparqlGenerator=new l9.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(r,i)=>this.evaluateExistsPattern(r,i)),this.filterExecutor.setTripleStore(e)}async evaluateExistsPattern(e,t){for await(let r of this.execute(e))if(t.merge(r)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*execute(e){switch(e.type){case"bgp":yield*this.executeBGP(e);break;case"filter":yield*this.executeFilter(e);break;case"join":yield*this.executeJoin(e);break;case"leftjoin":yield*this.executeLeftJoin(e);break;case"union":yield*this.executeUnion(e);break;case"minus":yield*this.executeMinus(e);break;case"values":yield*this.executeValues(e);break;case"project":yield*this.executeProject(e);break;case"orderby":yield*this.executeOrderBy(e);break;case"slice":yield*this.executeSlice(e);break;case"distinct":yield*this.executeDistinct(e);break;case"reduced":yield*this.executeReduced(e);break;case"group":yield*this.executeGroup(e);break;case"extend":yield*this.executeExtend(e);break;case"subquery":yield*this.executeSubquery(e);break;case"lateraljoin":yield*this.executeLateralJoin(e);break;case"service":yield*this.executeService(e);break;case"graph":yield*this.executeGraph(e);break;default:throw new Gc(`Unknown operation type: ${e.type}`)}}async*executeBGP(e){yield*this.bgpExecutor.execute(e)}async*executeFilter(e){let t=this.execute(e.input);yield*this.filterExecutor.execute(e,t)}async*executeJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);if(t.length===0)return;let r=new Set;for(let a of t)for(let c of a.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(a=>i.has(a)))for(let a of t){let c=this.substituteVariables(e.right,a);for await(let l of this.execute(c)){let u=a.merge(l);u!==null&&(yield u)}}else{let a=[];for await(let c of this.execute(e.right))a.push(c);for(let c of t)for(let l of a){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){let{SolutionMapping:t}=await Promise.resolve().then(()=>J3(rs())),r=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let a of i.variables())if(r.has(a)){let c=i.get(a);c!==void 0&&s.set(a,c)}yield s}}async*executeOrderBy(e){let t=[];for await(let r of this.execute(e.input))t.push(r);t.sort((r,i)=>{for(let s of e.comparators){let a=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(a===void 0&&c===void 0?l=0:a===void 0?l=1:c===void 0?l=-1:typeof a=="number"&&typeof c=="number"?l=a-c:l=String(a).localeCompare(String(c)),s.descending&&(l=-l),l!==0)return l}return 0});for(let r of t)yield r}async*executeSlice(e){let t=0,r=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=r){if(i!==void 0&&t-r>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeReduced(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let r=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of r)e.having.every(a=>this.filterExecutor.evaluateExpression(a,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let r of this.execute(e.input)){let i=r.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,r):this.evaluateExtendExpression(e.expression,r);s!==void 0&&i.set(e.variable,s),yield i}}async*executeSubquery(e){yield*this.execute(e.query)}async*executeLateralJoin(e){let t=[];for await(let r of this.execute(e.left))t.push(r);for(let r of t){let i=this.substituteVariables(e.right,r);for await(let s of this.execute(i)){let a=r.merge(s);a!==null&&(yield a)}}}substituteVariables(e,t){let r=JSON.parse(JSON.stringify(e));return this.substituteInOperation(r,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let r=e;return e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(r.input&&(r.input=this.substituteInOperation(r.input,t)),r.left&&(r.left=this.substituteInOperation(r.left,t)),r.right&&(r.right=this.substituteInOperation(r.right,t)),r.pattern&&(r.pattern=this.substituteInOperation(r.pattern,t)),r.query&&(r.query=this.substituteInOperation(r.query,t)),r.where&&(r.where=this.substituteInOperation(r.where,t)),r.expression&&this.substituteInExpression(r.expression,t),e)}substituteInExpression(e,t){if(!(!e||typeof e!="object")){if(e.type==="exists"&&e.pattern&&(e.pattern=this.substituteInOperation(e.pattern,t)),e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let r of e.operands)this.substituteInExpression(r,t);if(e.args)for(let r of e.args)this.substituteInExpression(r,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let r of e.list)this.substituteInExpression(r,t)}}substituteInTriple(e,t){return{subject:this.substituteInTripleElement(e.subject,t),predicate:e.predicate,object:this.substituteInTripleElement(e.object,t)}}substituteInTripleElement(e,t){if(e&&e.type==="variable"){let r=t.get(e.value);if(r!=null){let i=r;if(r instanceof u9.IRI||i.termType==="NamedNode")return{type:"iri",value:r.value};if(i.termType==="Literal"||typeof i.value=="string")return{type:"literal",value:i.value,datatype:i.datatype?.value??i._datatype?.value,language:i.language??i._language}}}return e}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(r,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{r.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(r,i):yield*this.execute(r)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:r}=await Promise.resolve().then(()=>J3(rs()));yield new r;return}yield*this.bgpExecutor.executeInGraph(e,t)}evaluateExtendExpression(e,t){if(e.type!=="aggregate")try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}async evaluateExtendExpressionAsync(e,t){if(e.type!=="aggregate")try{return await this.filterExecutor.evaluateExpressionAsync(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);if(!r)return;if(r instanceof f9.Literal){let i=r.datatype?.value;if(i===`${Lr}dayTimeDuration`)try{return d9.DateTimeFunctions.parseDayTimeDuration(r.value)}catch{return r.value}if(i&&h9.has(i)){let s=parseFloat(r.value);if(!Number.isNaN(s))return s}return r.value}return r.value??r.id??String(r)}if(e.type==="literal")return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="bgp"&&r.triples)for(let i of r.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(r.type==="values"&&r.variables)for(let i of r.variables)t.add(i);r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.type==="extend"&&r.variable&&t.add(r.variable),r.input&&this.collectVarsFromOperation(r.input,t),r.left&&this.collectVarsFromOperation(r.left,t),r.right&&this.collectVarsFromOperation(r.right,t),r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.query&&this.collectVarsFromOperation(r.query,t),r.where&&this.collectVarsFromOperation(r.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let r=e;r.type==="variable"&&t.add(r.value),r.type==="quoted"&&(this.collectVarsFromElement(r.subject,t),this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="variable"&&r.name&&t.add(r.name),r.type==="exists"&&r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.left&&this.collectVarsFromExpressionTree(r.left,t),r.right&&this.collectVarsFromExpressionTree(r.right,t),r.operands)for(let i of r.operands)this.collectVarsFromExpressionTree(i,t);if(r.args)for(let i of r.args)this.collectVarsFromExpressionTree(i,t);if(r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.list)for(let i of r.list)this.collectVarsFromExpressionTree(i,t)}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}isConstructQuery(e){return e.type==="construct"}async executeConstruct(e){if(e.type!=="construct")throw new Gc("executeConstruct requires a CONSTRUCT operation");let t=await this.executeAll(e.where);return this.constructExecutor.execute(e.template,t)}isAskQuery(e){return e.type==="ask"}async executeAsk(e){if(e.type!=="ask")throw new Gc("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};Cn.ExoQLQueryExecutor=fp;Cn.QueryExecutor=fp});var tA=b(Ws=>{"use strict";var p9=Ws&&Ws.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},m9=Ws&&Ws.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.CommandResolver=void 0;var g9=Ce(),y9=pc(),fn=Ee(),_r=Me(),V=ir(),w1=uo(),Hc=jy(),_9=Tc(),b9=xc(),S9=zc(),v1=10,Z3="08cec529-90eb-4d43-88de-ceecccea12b0",w9=V.Namespace.EXOCMD.term("SubstitutionToken").value,eA=new Set(["today","todayStart","targetFolder","target"]);function v9(n,e){return`__SUBSTITUTE__${n}__${e}__`}o(v9,"buildSubstitutionMarker");var E1=class{static{o(this,"CommandResolver")}constructor(e,t=y9.NullLogger){this.tripleStore=e,this.logger=t,this.cache=new Map,this.multiCache=new Map,this._coexistenceWarnedGroundings=new Set}async resolveForAssetMulti(e,t,r){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${r??""}`,a=this.multiCache.get(s);if(a)return a;let c=new Set,l=[];for(let u of t){let f=await this.resolveForAsset(e,u,r);for(let d of f)c.has(d.binding.id)||(c.add(d.binding.id),l.push(d))}return l.sort((u,f)=>{let d=this.getBindingPriority(u.binding),h=this.getBindingPriority(f.binding);return d!==h?d-h:(u.binding.order??100)-(f.binding.order??100)}),this.multiCache.set(s,l),l}async resolveForAsset(e,t,r){let i=`${e}:${t}:${r??""}`,s=this.cache.get(i);if(s)return s;let a=await this.findBindings(t,r,e),c=[];for(let l of a){let u=await this.loadCommand(l.commandRef);if(!u)continue;let f=l.precondition?{...u,precondition:l.precondition}:u;c.push({command:f,binding:l})}return c.sort((l,u)=>{let f=this.getBindingPriority(l.binding),d=this.getBindingPriority(u.binding);return f!==d?f-d:(l.binding.order??100)-(u.binding.order??100)}),this.cache.set(i,c),c}async loadCommand(e){let t=await this.findSubjectByUID(e);if(!t||(await this.tripleStore.match(t,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("Command"))).length===0)return null;let i=await this.getLiteralValue(t,V.Namespace.EXO.term("Asset_label"))??"Unknown Command",s=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_labelTemplate")),a=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_icon")),c=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_confirmMessage")),l=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_successMessage")),u=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_category")),f=await this.loadLinkedPrecondition(t),d=await this.loadLinkedGrounding(t,0);return d?{id:e,name:i,labelTemplate:s??void 0,icon:a??void 0,precondition:f??void 0,grounding:d,confirmMessage:c??void 0,successMessage:l??void 0,category:u??void 0}:null}async findBindings(e,t,r){let i=await this.tripleStore.match(void 0,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("CommandBinding")),s=[];for(let a of i){let c=a.subject,l=await this.loadBindingDefinition(c);l&&this.bindingMatches(l,e,t,r)&&s.push(l)}return s}async findPaletteEnabledCommands(){let e=await this.tripleStore.match(void 0,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("Command")),t=[],r=new Set;for(let i of e){let s=i.subject;if((await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_paletteEnabled")))?.toLowerCase()!=="true")continue;let c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid"));if(!c){this.logger.warn(`[CommandResolver] paletteEnabled command at ${s.value} has no exo__Asset_uid \u2014 skipped`);continue}let l=await this.loadCommand(c);if(!l){this.logger.warn(`[CommandResolver] paletteEnabled command ${c} could not be loaded (missing grounding?) \u2014 skipped`);continue}let u=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_paletteId")),f=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_cliName")),d=u??f??c;if(r.has(d)){this.logger.warn(`[CommandResolver] duplicate paletteId "${d}" \u2014 first registration wins, dropping ${c}`);continue}r.add(d),t.push({command:l,paletteId:d})}return t}invalidateCache(){this.cache.clear(),this.multiCache.clear()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let r=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:a}of i){let c=await this.evaluateSelectSnippet(a,t);r=r.replace(s,c)}return r}extractPlaceholders(e){let t=[],r=0;for(;r<e.length;)if(e[r]==="{"){let i=1,s=r+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let a=e.slice(r,s),c=e.slice(r+1,s-1);t.push({full:a,body:c})}r=s}else r++;return t}async evaluateSelectSnippet(e,t){try{let r=e.replace(/\$target/g,`<${t}>`),s=new _9.ExoQLParser().parse(r),c=new b9.ExoQLAlgebraTranslator().translate(s),u=await new S9.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let h=f.get(d[0]);return h?h instanceof _r.Literal||h instanceof fn.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,V.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetClass")),a=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!a&&!c)return null;let l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,h=await this.loadLinkedPreconditionFromProperty(e,V.Namespace.EXOCMD.term("CommandBinding_precondition")),p=await this.loadLinkedStyle(e,t);return{id:t,label:r,commandRef:i,targetClass:s??void 0,targetPrototype:a??void 0,targetAsset:c??void 0,position:l??void 0,order:u?parseInt(u,10):void 0,variant:d,precondition:h??void 0,style:p??void 0}}async loadLinkedStyle(e,t){let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(r.length>0){let s=r[0].object,a=null;if(s instanceof fn.IRI)a=s;else if(s instanceof _r.Literal){let c=this.normalizeWikilink(s.value);a=await this.findSubjectByUID(c)}if(a){let c=await this.loadStyleAsset(a);if(c)return c}this.logger.warn(this.capWarning(`CommandBinding ${t}: style reference unresolved, falling back to inline variant`))}let i=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_variant"));if(i!==null){let s=this.coerceVariant(i,t);if(s!==void 0)return{id:`inline:${t}`,label:"",variant:s,inline:!0}}return null}async loadStyleAsset(e){let t=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,a=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(a),l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),h=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),p=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_source")),y=p!==null?this.coerceStyleSource(p,t):void 0;return{id:t,label:r,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:h??void 0,source:y,inline:!1}}coerceVariant(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Hc.COMMAND_VARIANT_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${r}" not in whitelist [${Hc.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Hc.LABEL_CLASS_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${r}" not in whitelist [${Hc.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Hc.STYLE_SOURCE_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle source "${r}" not in whitelist [${Hc.STYLE_SOURCE_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceBoolean(e){if(e===null)return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}capWarning(e){return e.length<=200?e:e.slice(0,197)+"..."}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let a=this.extractPathBasename(r);if(a&&a===i)return!0;let c=this.extractAlias(t);if(c&&r===c)return!0;let l=this.extractAlias(e);return!!(l&&l===i)}extractPathBasename(e){let t=e.match(/\/([^/]+)\.md$/);return t?t[1]:null}extractAlias(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(r+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,V.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof fn.IRI)s=i;else if(i instanceof _r.Literal){let h=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(h)}if(!s)return null;let a=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Precondition_hostFunction")),f=await this.tripleStore.match(s,V.Namespace.EXOCMD.term("Precondition_query"),void 0),d;if(f.length>0){let h=f[0].object;if(h instanceof fn.IRI){let p=await this.getLiteralValue(h,V.Namespace.EXO.term("Asset_uid"));p&&(d=p)}else h instanceof _r.Literal&&(d=this.normalizeWikilink(h.value))}return!a||!l&&!u&&!d?null:{id:a,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u},...d&&{query:d}}}async loadLinkedGrounding(e,t){if(t>=v1)return null;let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Command_grounding"),void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof fn.IRI)s=i;else if(i instanceof _r.Literal){let a=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(a)}return s?this.loadGroundingDefinition(s,t):null}async loadGroundingDefinition(e,t){if(t>=v1)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",s=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_type"));if(!s)return null;let a=this.resolveGroundingType(s);if(!a)return null;let c=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetProperty"));if(c&&this.looksLikeUUID(c)){let te=await this.resolveLabelByUID(c);if(!te)return this.logger.warn(`Grounding ${r}: targetProperty wikilink UID '${c}' is not resolvable to exo__Asset_label \u2014 grounding skipped (would otherwise write a UUID-named frontmatter key).`),null;c=te}if(a===w1.GroundingType.SERVICE_CALL){let te=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_serviceId"));te&&(c=te)}let l=await this.getObsidianWikilinkValue(e,V.Namespace.EXOCMD.term("Grounding_targetValue")),u=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueRef")),f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_targetValueLiteral")),d=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueSubstitution")),h=null;if(d&&this.looksLikeUUID(d)){let te=await this.resolveLabelByUID(d);if(!te)return this.logger.warn(`Grounding ${r}: targetValueSubstitution UID '${d}' is not resolvable to exo__Asset_label (SubstitutionToken instance missing or unlabelled) \u2014 grounding skipped.`),null;h=te}else d&&(h=d);let p=await this.getObsidianWikilinkValue(e,V.Namespace.EXOCMD.term("Grounding_isDefinedBy")),y=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),S=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetClass"));if(S&&!this.looksLikeUUID(S)){let te=await this.findUidByLabel(S);te&&(S=te)}let v=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetPrototype")),w=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_targetFolder")),T=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_linkBackProperty")),C=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_inputSchema")),L=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_incrementBy")),$=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_shiftDelta")),ee;if(L!=null&&L!==""){let te=Number.parseInt(String(L),10);Number.isFinite(te)&&(ee=te)}let B=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_propertyDefaults")),W;if(B){let te;try{te=JSON.parse(B)}catch(K){throw new Error(`Grounding ${r}: exocmd__Grounding_propertyDefaults is not valid JSON: ${K instanceof Error?K.message:String(K)}`)}if(typeof te!="object"||te===null||Array.isArray(te))throw new Error(`Grounding ${r}: exocmd__Grounding_propertyDefaults must be a JSON object literal`);let ie={};for(let[K,q]of Object.entries(te)){if(typeof q!="string")throw new Error(`Grounding ${r}: exocmd__Grounding_propertyDefaults["${K}"] must be a string (got ${typeof q})`);ie[K]=q}W=ie}let F=await this.resolvePropertyDefaults(e,r),D=await this.resolveInheritanceRules(e,r);W!==void 0&&F.length>0&&(this._coexistenceWarnedGroundings.has(r)||(this.logger.warn(`Grounding ${r}: legacy exocmd__Grounding_propertyDefaults JSON ignored \u2014 ref-form exocmd__Grounding_propertyDefault takes precedence. Remove legacy property to silence this warning.`),this._coexistenceWarnedGroundings.add(r)),W=void 0);let G;a===w1.GroundingType.COMPOSITE&&(G=await this.loadCompositeSteps(e,t+1));let Re;if(C)try{let te=JSON.parse(C);te?.properties&&(Re=Object.entries(te.properties).map(([ie,K])=>{let q=K.type,st=q==="string"?"text":q,nt=K.defaultValue!==void 0?K.defaultValue:K.default,z={name:ie,type:st,label:K.title??ie,required:Array.isArray(te.required)&&te.required.includes(ie)};return nt!=null&&(z.defaultValue=String(nt)),z}))}catch{}let et=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_prefillLabelWithDate")),ft=et!==null&&String(et).trim().toLowerCase()==="true",Ze={id:r,label:i,type:a,targetProperty:c??void 0,targetValue:l??void 0,targetValueRef:u??void 0,targetValueLiteral:f??void 0,targetValueSubstitution:h??void 0,sparqlUpdate:y??void 0,steps:G,targetClass:S??void 0,targetPrototype:v??void 0,targetFolder:w??void 0,linkBackProperty:T??void 0,incrementBy:ee,shiftDelta:$??void 0,propertyDefaults:W,propertyDefault:F.length>0?F:void 0,inheritanceRule:D.length>0?D:void 0,isDefinedBy:p??void 0,prefillLabelWithDate:ft||void 0};return Re&&(Ze.inputSchema=Re),Ze}async loadCompositeSteps(e,t){if(t>=v1)return[];let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let a=null;if(s.object instanceof fn.IRI)a=s.object;else if(s.object instanceof _r.Literal){let l=this.normalizeWikilink(s.object.value);a=await this.findSubjectByUID(l)}if(!a)continue;let c=await this.loadGroundingDefinition(a,t);c&&i.push(c)}return i}async resolvePropertyDefaults(e,t){let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_propertyDefault"),void 0),i=[];for(let s of r){let a=await this.resolveRefTripleObject(s.object);if(!a)continue;let c=await this.getObsidianName(a,V.Namespace.EXOCMD.term("PropertyDefault_property"));if(!c){this.logger.warn(`Grounding ${t}: PropertyDefault asset missing exocmd__PropertyDefault_property \u2014 entry skipped.`);continue}let l=this.looksLikeUUID(c)?await this.resolveLabelByUID(c):c;if(!l){this.logger.warn(`Grounding ${t}: PropertyDefault property UID '${c}' is not resolvable to exo__Asset_label \u2014 entry skipped.`);continue}let u=await this.getObsidianName(a,V.Namespace.EXOCMD.term("PropertyDefault_value"));if(!u){this.logger.warn(`Grounding ${t}: PropertyDefault '${l}' missing exocmd__PropertyDefault_value \u2014 entry skipped.`);continue}let f=await this.resolvePropertyDefaultValue(u,t,l);f!==null&&i.push({propertyName:l,value:f})}return i}async resolveInheritanceRules(e,t){let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_inheritanceRule"),void 0),i=[];for(let s of r){let a=await this.resolveRefTripleObject(s.object);if(!a)continue;let c=await this.resolveLabelRef(a,V.Namespace.EXOCMD.term("InheritanceRule_sourceProperty"));if(!c){this.logger.warn(`Grounding ${t}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_sourceProperty \u2014 entry skipped.`);continue}let l=await this.resolveLabelRef(a,V.Namespace.EXOCMD.term("InheritanceRule_targetProperty"));if(!l){this.logger.warn(`Grounding ${t}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_targetProperty \u2014 entry skipped.`);continue}let u=await this.tripleStore.match(a,V.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"),void 0),f;if(u.length>0){let v=await this.resolveLabelRef(a,V.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"));if(!v){this.logger.warn(`Grounding ${t}: InheritanceRule has exocmd__InheritanceRule_targetClassCondition triple but ref is unresolvable \u2014 entire rule skipped (would otherwise apply unconditionally, broadening scope).`);continue}f=v}let d=await this.tripleStore.match(a,V.Namespace.EXOCMD.term("InheritanceRule_targetClassExclusion"),void 0),h=[],p=!1;for(let v of d){let w=null;if(v.object instanceof fn.IRI?w=this.iriToObsidianName(v.object.value)??v.object.value:v.object instanceof _r.Literal&&(w=this.unwrapWikilink(v.object.value)),!w){p=!0;continue}let T=this.looksLikeUUID(w)?await this.resolveLabelByUID(w):w;if(!T){p=!0;continue}h.push(T)}if(p){this.logger.warn(`Grounding ${t}: InheritanceRule has unresolvable exocmd__InheritanceRule_targetClassExclusion entry \u2014 entire rule skipped (would otherwise expand scope by silently dropping the excluded class).`);continue}let y=await this.getLiteralValue(a,V.Namespace.EXOCMD.term("InheritanceRule_priority")),S=50;if(y!==null&&y!==""){let v=Number.parseInt(String(y),10);Number.isFinite(v)&&(S=v)}i.push({sourcePropertyName:c,targetPropertyName:l,targetClassCondition:f,targetClassExclusion:h,priority:S})}return i}async resolveRefTripleObject(e){if(e instanceof fn.IRI)return e;if(e instanceof _r.Literal){let t=this.normalizeWikilink(e.value);return t?this.findSubjectByUID(t):null}return null}async resolveLabelRef(e,t){let r=await this.getObsidianName(e,t);return r?this.looksLikeUUID(r)?this.resolveLabelByUID(r):r:null}async resolvePropertyDefaultValue(e,t,r){if(!this.looksLikeUUID(e))return`"[[${e}]]"`;let i=await this.findSubjectByUID(e);if(!i)return`"[[${e}]]"`;if(!await this.assetIsSubstitutionToken(i))return`"[[${e}]]"`;let a=await this.getLiteralValue(i,V.Namespace.EXOCMD.term("SubstitutionToken_resolver"));if(!a||!a.trim())return this.logger.warn(`Grounding ${t}: PropertyDefault '${r}' references SubstitutionToken '${e}' with no exocmd__SubstitutionToken_resolver \u2014 falling back to wikilink form.`),`"[[${e}]]"`;let c=a.trim();return eA.has(c)?c==="today"?new Date().toISOString().slice(0,10):c==="todayStart"?new Date(new Date().setHours(0,0,0,0)).toISOString():v9(c,e):(this.logger.warn(`Grounding ${t}: PropertyDefault '${r}' SubstitutionToken '${e}' declares unknown resolver-id '${c}' \u2014 falling back to wikilink form. Known ids: ${Array.from(eA).join(", ")}.`),`"[[${e}]]"`)}async assetIsSubstitutionToken(e){let t=await this.tripleStore.match(e,V.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof fn.IRI){if(r.object.value===w9||r.object.value.includes(Z3))return!0}else if(r.object instanceof _r.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__SubstitutionToken"||i===Z3)return!0}return!1}resolveGroundingType(e){let t=e.toLowerCase().trim();return Object.values(w1.GroundingType).includes(t)?t:null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let r=await this.tripleStore.findSubjectsByUUID(e);if(r.length>0)return r[0]}let t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof _r.Literal&&r.object.value===e)return r.subject;return null}async getLiteralValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof _r.Literal||i instanceof fn.IRI?i.value:null}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)}async resolveLabelByUID(e){let t=await this.findSubjectByUID(e);return t?this.getLiteralValue(t,V.Namespace.EXO.term("Asset_label")):null}async findUidByLabel(e){let t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Asset_label"),void 0);for(let r of t)if(r.object instanceof _r.Literal&&r.object.value===e&&r.subject instanceof fn.IRI){let i=await this.tripleStore.match(r.subject,V.Namespace.EXO.term("Asset_uid"),void 0);if(i.length>0&&i[0].object instanceof _r.Literal)return i[0].object.value}return null}async getLinkedUID(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof fn.IRI){let s=await this.tripleStore.match(i,V.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof _r.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof _r.Literal?this.normalizeWikilink(i.value):null}async getLinkedValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof _r.Literal?this.normalizeWikilink(i.value):i instanceof fn.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof _r.Literal?this.unwrapWikilink(i.value):i instanceof fn.IRI?this.iriToObsidianName(i.value)??i.value:null}unwrapWikilink(e){if(!e)return e;let t=e.trim().replace(/^"|"$/g,"");if(t.startsWith("http://")||t.startsWith("https://"))return this.iriToObsidianName(t)??t;let r=t.match(/^\[\[([^\]|]+)\|([^\]]+)\]\]$/);if(r)return r[2].trim();let i=t.match(/^\[\[([^\]|]+)\]\]$/);if(i){let s=i[1].trim();return s.startsWith("http://")||s.startsWith("https://")?this.iriToObsidianName(s)??s:s}return t}async getObsidianWikilinkValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof _r.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof fn.IRI){let s=this.iriToObsidianName(i.value);return s?`"[[${s}]]"`:i.value}return null}async resolveWikilinkAlias(e){let t=e.match(/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\]/);if(!t)return e;let r=t[1],i=await this.findSubjectByUID(r);if(!i)return e;let s=await this.getLiteralValue(i,V.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${r}]]`,`[[${r}|${s}]]`):e}iriToObsidianName(e){let t=e.lastIndexOf("#");if(t>=0){let i=e.substring(0,t+1),s=e.substring(t+1);if(i===V.Namespace.EMS.iri.value)return`ems__${s}`;if(i===V.Namespace.EXO.iri.value)return`exo__${s}`;if(i===V.Namespace.EXOCMD.iri.value)return`exocmd__${s}`;if(i===V.Namespace.IMS.iri.value)return`ims__${s}`;if(i===V.Namespace.ZTLK.iri.value)return`ztlk__${s}`;if(i===V.Namespace.PTMS.iri.value)return`ptms__${s}`;if(i===V.Namespace.LIT.iri.value)return`lit__${s}`;if(i===V.Namespace.INBOX.iri.value)return`inbox__${s}`}let r=e.match(/\/([^/]+)\.md$/);return r?r[1]:null}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(0,r):t}};Ws.CommandResolver=E1;Ws.CommandResolver=E1=p9([(0,g9.injectable)(),m9("design:paramtypes",[Object,Object])],E1)});var A1=b(T1=>{"use strict";Object.defineProperty(T1,"__esModule",{value:!0});T1.validateExoQLAllowlist=E9;var dp=Lu();function E9(n){if(!n||typeof n!="object")return;let e=n;if(e.type==="update"){let t=n.updates??[];for(let r of t)if(r?.type==="load")throw new dp.ExoQLForbiddenKeywordError("LOAD");throw new dp.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,r=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||r)throw new dp.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)hp(t);if(Array.isArray(e.template))for(let t of e.template)hp(t)}}o(E9,"validateExoQLAllowlist");function hp(n){if(!n||typeof n!="object")return;if(n.type==="service")throw new dp.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(n.patterns))for(let t of n.patterns)hp(t);let e=n.where;if(Array.isArray(e))for(let t of e)hp(t)}o(hp,"walkPatternForBannedKeywords")});var x1=b(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});pp.DEFAULT_EVAL_CONFIG=void 0;pp.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var C1=b(I1=>{"use strict";Object.defineProperty(I1,"__esModule",{value:!0});I1.evaluateWithExoEval=O9;var T9=Tc(),A9=xc(),x9=zc(),I9=A1(),C9=x1(),R9=Lu();async function O9(n,e={}){if(typeof n!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let r=new T9.ExoQLParser().parse(n);if((0,I9.validateExoQLAllowlist)(r),!{...C9.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new R9.ExoQLEvalDisabledError;let s="queryType"in r&&typeof r.queryType=="string"?r.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new A9.ExoQLAlgebraTranslator().translate(r),l=new x9.ExoQLQueryExecutor(e.store);return l.isAskQuery(c)?{kind:"ask",result:await l.executeAsk(c)}:l.isConstructQuery(c)?{kind:"construct",triples:await l.executeConstruct(c)}:{kind:"select",rows:await l.executeAll(c)}}o(O9,"evaluateWithExoEval")});var ju=b(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});mp.liveClock=P9;mp.frozenClock=F9;function P9(){return{now:o(()=>new Date,"now")}}o(P9,"liveClock");function F9(n){let e=new Date(n);return{now:o(()=>new Date(e.getTime()),"now")}}o(F9,"frozenClock")});var nA=b(Gs=>{"use strict";var D9=Gs&&Gs.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},N9=Gs&&Gs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Mu;Object.defineProperty(Gs,"__esModule",{value:!0});Gs.PreconditionEvaluator=void 0;var L9=Ce(),k9=Tc(),j9=xc(),rA=zc(),M9=C1(),$9=ju(),$u=Mu=class{static{o(this,"PreconditionEvaluator")}constructor(e,t,r){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t,this.clock=r?.clock??(0,$9.liveClock)()}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.query?this.evaluateQueryRef(e.query,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return!1;let i=this.substituteVariables(r,t),s=await(0,M9.evaluateWithExoEval)(i,{store:this.tripleStore});return s.kind!=="ask"?!1:s.result}catch{return!1}}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Mu.SENTINEL_IRI),i=new k9.ExoQLParser().parse(t),a=new j9.ExoQLAlgebraTranslator().translate(i);return new rA.ExoQLQueryExecutor(this.tripleStore).isAskQuery(a)?a:null}evaluateHostFunction(e,t,r){let i=this.hostFunctions.get(e);if(!i)return!0;let s=r?{...r,targetIRI:t}:{targetIRI:t};return i(s)}async evaluateSparqlAsk(e,t){try{let r=this.askCache.get(e);if(r===void 0){let a=this.compileAsk(e);if(!a)return!1;r=a,this.askCache.set(e,r)}let i=JSON.parse(JSON.stringify(r).replaceAll(Mu.SENTINEL_IRI,t));return await new rA.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=this.clock.now(),i=r.toISOString(),s=i.slice(0,10),a=new Date(r.getTime()+Mu.ALMATY_OFFSET_MS),c=a.getUTCFullYear(),l=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCDay(),h=new Date(Date.UTC(c,l,u-1)).toISOString().slice(0,10),p=(f+6)%7,y=new Date(Date.UTC(c,l,u-p)),S=y.toISOString().slice(0,10),w=new Date(y.getTime()-10080*60*1e3).toISOString().slice(0,10),T=`${c}-${String(l+1).padStart(2,"0")}-01`,C=l===0?11:l-1,$=`${l===0?c-1:c}-${String(C+1).padStart(2,"0")}-01`,ee=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${i}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${S}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${w}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${T}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${$}"^^xsd:date`).replace(/\$thisYearStart/g,`"${ee}"^^xsd:date`).replace(/\$today/g,`"${s}"^^xsd:date`)}};Gs.PreconditionEvaluator=$u;$u.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";$u.ALMATY_OFFSET_MS=300*60*1e3;Gs.PreconditionEvaluator=$u=Mu=D9([(0,L9.injectable)(),N9("design:paramtypes",[Object,Object,Object])],$u)});var iA=b(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.hasNonUidFilename=void 0;Qc.registerDefaultHostFunctions=B9;var V9=o(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t!==e},"hasNonUidFilename");Qc.hasNonUidFilename=V9;function B9(n){n.registerHostFunction("hasNonUidFilename",Qc.hasNonUidFilename)}o(B9,"registerDefaultHostFunctions")});var yp=b(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.liveUidGenerator=U9;gp.seededUidGenerator=W9;var R1=ui();function U9(){return{next:o(()=>(0,R1.v4)(),"next")}}o(U9,"liveUidGenerator");var q9="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function W9(n){let e=0,t=(0,R1.v5)(n,q9);return{next:o(()=>{let r=`${n}#${e}`;return e+=1,(0,R1.v5)(r,t)},"next")}}o(W9,"seededUidGenerator")});var as=b(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.FrontmatterService=void 0;var Vu=class n{static{o(this,"FrontmatterService")}parse(e){let t=e.match(n.FRONTMATTER_REGEX);return t?{exists:!0,content:t[1],originalContent:e}:{exists:!1,content:"",originalContent:e}}parseObject(e){let t=this.parse(e);if(!t.exists)return null;let r={},i=t.content.split(/\r?\n/),s=null,a=null,c=o(()=>{s!==null&&a!==null&&(r[s]=a),s=null,a=null},"flushArray");for(let l of i){let u=/^ {2}- (.*)$/.exec(l);if(u){s!==null&&a!==null&&a.push(u[1].trim());continue}c();let f=/^([^:\s][^:]*):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(s=d,a=[]):r[d]=h}return c(),r}updateProperty(e,t,r){t=n.normalizeIRI(t),typeof r=="string"&&(r=n.normalizeIRIValue(r));let i=this.parse(e),s=this.serializeValue(t,r);if(!i.exists)return`---
|
|
70
|
+
${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}generateExpression(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:typeof e.value=="boolean"?e.value?"true":"false":String(e.value);case"comparison":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"logical":return e.operator==="!"?`!(${this.generateExpression(e.operands[0])})`:`(${e.operands.map(t=>this.generateExpression(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"function":return`${e.function.toUpperCase()}(${e.args.map(t=>this.generateExpression(t)).join(", ")})`;case"functionCall":return`${(typeof e.function=="string"?e.function:e.function.value).toUpperCase()}(${e.args.map(r=>this.generateExpression(r)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),r=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${r})`:`${t} IN (${r})`}default:throw new qc(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let r of e.triples)this.collectVariablesFromTriple(r,t);break;case"filter":this.collectVariablesFromOperation(e.input,t),this.collectVariablesFromExpression(e.expression,t);break;case"join":case"leftjoin":case"union":case"minus":this.collectVariablesFromOperation(e.left,t),this.collectVariablesFromOperation(e.right,t);break;case"values":for(let r of e.variables)t.add(r);break;case"project":for(let r of e.variables)t.add(r);this.collectVariablesFromOperation(e.input,t);break;case"extend":t.add(e.variable),this.collectVariablesFromOperation(e.input,t);break;case"orderby":case"slice":case"distinct":case"reduced":this.collectVariablesFromOperation(e.input,t);break;case"group":for(let r of e.variables)t.add(r);for(let r of e.aggregates)t.add(r.variable);this.collectVariablesFromOperation(e.input,t);break;case"subquery":this.collectVariablesFromOperation(e.query,t);break}}collectVariablesFromTriple(e,t){e.subject.type==="variable"&&t.add(e.subject.value),"type"in e.predicate&&e.predicate.type==="variable"&&t.add(e.predicate.value),e.object.type==="variable"&&t.add(e.object.value)}collectVariablesFromExpression(e,t){switch(e.type){case"variable":t.add(e.name);break;case"comparison":case"arithmetic":this.collectVariablesFromExpression(e.left,t),this.collectVariablesFromExpression(e.right,t);break;case"logical":for(let r of e.operands)this.collectVariablesFromExpression(r,t);break;case"function":case"functionCall":for(let r of e.args)this.collectVariablesFromExpression(r,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let r of e.list)this.collectVariablesFromExpression(r,t);break}}};Wc.SPARQLGenerator=S1});var zc=b(Cn=>{"use strict";var XM=Cn&&Cn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),JM=Cn&&Cn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),J3=Cn&&Cn.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&XM(t,e,r[i]);return JM(t,e),t}})();Object.defineProperty(Cn,"__esModule",{value:!0});Cn.QueryExecutor=Cn.ExoQLQueryExecutor=Cn.QueryExecutorError=void 0;var ZM=V_(),e9=rp(),t9=s1(),r9=o1(),n9=B3(),i9=q3(),s9=z3(),a9=y1(),o9=Q3(),c9=Y3(),l9=X3(),u9=Ee(),f9=Me(),d9=Kh(),Lr="http://www.w3.org/2001/XMLSchema#",h9=new Set([`${Lr}integer`,`${Lr}decimal`,`${Lr}float`,`${Lr}double`,`${Lr}nonPositiveInteger`,`${Lr}negativeInteger`,`${Lr}long`,`${Lr}int`,`${Lr}short`,`${Lr}byte`,`${Lr}nonNegativeInteger`,`${Lr}unsignedLong`,`${Lr}unsignedInt`,`${Lr}unsignedShort`,`${Lr}unsignedByte`,`${Lr}positiveInteger`]),Gc=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};Cn.QueryExecutorError=Gc;var fp=class{static{o(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new ZM.BGPExecutor(e),this.filterExecutor=new e9.FilterExecutor,this.optionalExecutor=new t9.OptionalExecutor,this.unionExecutor=new r9.UnionExecutor,this.minusExecutor=new n9.MinusExecutor,this.valuesExecutor=new i9.ValuesExecutor,this.aggregateExecutor=new s9.AggregateExecutor,this.constructExecutor=new a9.ConstructExecutor,this.serviceExecutor=new o9.ServiceExecutor(t.serviceConfig),this.graphExecutor=new c9.GraphExecutor(e),this.sparqlGenerator=new l9.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(r,i)=>this.evaluateExistsPattern(r,i)),this.filterExecutor.setTripleStore(e)}async evaluateExistsPattern(e,t){for await(let r of this.execute(e))if(t.merge(r)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*execute(e){switch(e.type){case"bgp":yield*this.executeBGP(e);break;case"filter":yield*this.executeFilter(e);break;case"join":yield*this.executeJoin(e);break;case"leftjoin":yield*this.executeLeftJoin(e);break;case"union":yield*this.executeUnion(e);break;case"minus":yield*this.executeMinus(e);break;case"values":yield*this.executeValues(e);break;case"project":yield*this.executeProject(e);break;case"orderby":yield*this.executeOrderBy(e);break;case"slice":yield*this.executeSlice(e);break;case"distinct":yield*this.executeDistinct(e);break;case"reduced":yield*this.executeReduced(e);break;case"group":yield*this.executeGroup(e);break;case"extend":yield*this.executeExtend(e);break;case"subquery":yield*this.executeSubquery(e);break;case"lateraljoin":yield*this.executeLateralJoin(e);break;case"service":yield*this.executeService(e);break;case"graph":yield*this.executeGraph(e);break;default:throw new Gc(`Unknown operation type: ${e.type}`)}}async*executeBGP(e){yield*this.bgpExecutor.execute(e)}async*executeFilter(e){let t=this.execute(e.input);yield*this.filterExecutor.execute(e,t)}async*executeJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);if(t.length===0)return;let r=new Set;for(let a of t)for(let c of a.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(a=>i.has(a)))for(let a of t){let c=this.substituteVariables(e.right,a);for await(let l of this.execute(c)){let u=a.merge(l);u!==null&&(yield u)}}else{let a=[];for await(let c of this.execute(e.right))a.push(c);for(let c of t)for(let l of a){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){let{SolutionMapping:t}=await Promise.resolve().then(()=>J3(rs())),r=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let a of i.variables())if(r.has(a)){let c=i.get(a);c!==void 0&&s.set(a,c)}yield s}}async*executeOrderBy(e){let t=[];for await(let r of this.execute(e.input))t.push(r);t.sort((r,i)=>{for(let s of e.comparators){let a=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(a===void 0&&c===void 0?l=0:a===void 0?l=1:c===void 0?l=-1:typeof a=="number"&&typeof c=="number"?l=a-c:l=String(a).localeCompare(String(c)),s.descending&&(l=-l),l!==0)return l}return 0});for(let r of t)yield r}async*executeSlice(e){let t=0,r=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=r){if(i!==void 0&&t-r>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeReduced(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let r=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of r)e.having.every(a=>this.filterExecutor.evaluateExpression(a,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let r of this.execute(e.input)){let i=r.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,r):this.evaluateExtendExpression(e.expression,r);s!==void 0&&i.set(e.variable,s),yield i}}async*executeSubquery(e){yield*this.execute(e.query)}async*executeLateralJoin(e){let t=[];for await(let r of this.execute(e.left))t.push(r);for(let r of t){let i=this.substituteVariables(e.right,r);for await(let s of this.execute(i)){let a=r.merge(s);a!==null&&(yield a)}}}substituteVariables(e,t){let r=JSON.parse(JSON.stringify(e));return this.substituteInOperation(r,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let r=e;return e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(r.input&&(r.input=this.substituteInOperation(r.input,t)),r.left&&(r.left=this.substituteInOperation(r.left,t)),r.right&&(r.right=this.substituteInOperation(r.right,t)),r.pattern&&(r.pattern=this.substituteInOperation(r.pattern,t)),r.query&&(r.query=this.substituteInOperation(r.query,t)),r.where&&(r.where=this.substituteInOperation(r.where,t)),r.expression&&this.substituteInExpression(r.expression,t),e)}substituteInExpression(e,t){if(!(!e||typeof e!="object")){if(e.type==="exists"&&e.pattern&&(e.pattern=this.substituteInOperation(e.pattern,t)),e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let r of e.operands)this.substituteInExpression(r,t);if(e.args)for(let r of e.args)this.substituteInExpression(r,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let r of e.list)this.substituteInExpression(r,t)}}substituteInTriple(e,t){return{subject:this.substituteInTripleElement(e.subject,t),predicate:e.predicate,object:this.substituteInTripleElement(e.object,t)}}substituteInTripleElement(e,t){if(e&&e.type==="variable"){let r=t.get(e.value);if(r!=null){let i=r;if(r instanceof u9.IRI||i.termType==="NamedNode")return{type:"iri",value:r.value};if(i.termType==="Literal"||typeof i.value=="string")return{type:"literal",value:i.value,datatype:i.datatype?.value??i._datatype?.value,language:i.language??i._language}}}return e}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(r,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{r.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(r,i):yield*this.execute(r)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:r}=await Promise.resolve().then(()=>J3(rs()));yield new r;return}yield*this.bgpExecutor.executeInGraph(e,t)}evaluateExtendExpression(e,t){if(e.type!=="aggregate")try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}async evaluateExtendExpressionAsync(e,t){if(e.type!=="aggregate")try{return await this.filterExecutor.evaluateExpressionAsync(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);if(!r)return;if(r instanceof f9.Literal){let i=r.datatype?.value;if(i===`${Lr}dayTimeDuration`)try{return d9.DateTimeFunctions.parseDayTimeDuration(r.value)}catch{return r.value}if(i&&h9.has(i)){let s=parseFloat(r.value);if(!Number.isNaN(s))return s}return r.value}return r.value??r.id??String(r)}if(e.type==="literal")return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="bgp"&&r.triples)for(let i of r.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(r.type==="values"&&r.variables)for(let i of r.variables)t.add(i);r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.type==="extend"&&r.variable&&t.add(r.variable),r.input&&this.collectVarsFromOperation(r.input,t),r.left&&this.collectVarsFromOperation(r.left,t),r.right&&this.collectVarsFromOperation(r.right,t),r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.query&&this.collectVarsFromOperation(r.query,t),r.where&&this.collectVarsFromOperation(r.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let r=e;r.type==="variable"&&t.add(r.value),r.type==="quoted"&&(this.collectVarsFromElement(r.subject,t),this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="variable"&&r.name&&t.add(r.name),r.type==="exists"&&r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.left&&this.collectVarsFromExpressionTree(r.left,t),r.right&&this.collectVarsFromExpressionTree(r.right,t),r.operands)for(let i of r.operands)this.collectVarsFromExpressionTree(i,t);if(r.args)for(let i of r.args)this.collectVarsFromExpressionTree(i,t);if(r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.list)for(let i of r.list)this.collectVarsFromExpressionTree(i,t)}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}isConstructQuery(e){return e.type==="construct"}async executeConstruct(e){if(e.type!=="construct")throw new Gc("executeConstruct requires a CONSTRUCT operation");let t=await this.executeAll(e.where);return this.constructExecutor.execute(e.template,t)}isAskQuery(e){return e.type==="ask"}async executeAsk(e){if(e.type!=="ask")throw new Gc("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};Cn.ExoQLQueryExecutor=fp;Cn.QueryExecutor=fp});var tA=b(Ws=>{"use strict";var p9=Ws&&Ws.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},m9=Ws&&Ws.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.CommandResolver=void 0;var g9=Ce(),y9=pc(),fn=Ee(),_r=Me(),V=ir(),w1=uo(),Hc=jy(),_9=Tc(),b9=xc(),S9=zc(),v1=10,Z3="08cec529-90eb-4d43-88de-ceecccea12b0",w9=V.Namespace.EXOCMD.term("SubstitutionToken").value,eA=new Set(["today","todayStart","targetFolder","target"]);function v9(n,e){return`__SUBSTITUTE__${n}__${e}__`}o(v9,"buildSubstitutionMarker");var E1=class{static{o(this,"CommandResolver")}constructor(e,t=y9.NullLogger){this.tripleStore=e,this.logger=t,this.cache=new Map,this.multiCache=new Map,this._legacyPropertyDefaultsWarnedGroundings=new Set}async resolveForAssetMulti(e,t,r){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${r??""}`,a=this.multiCache.get(s);if(a)return a;let c=new Set,l=[];for(let u of t){let f=await this.resolveForAsset(e,u,r);for(let d of f)c.has(d.binding.id)||(c.add(d.binding.id),l.push(d))}return l.sort((u,f)=>{let d=this.getBindingPriority(u.binding),h=this.getBindingPriority(f.binding);return d!==h?d-h:(u.binding.order??100)-(f.binding.order??100)}),this.multiCache.set(s,l),l}async resolveForAsset(e,t,r){let i=`${e}:${t}:${r??""}`,s=this.cache.get(i);if(s)return s;let a=await this.findBindings(t,r,e),c=[];for(let l of a){let u=await this.loadCommand(l.commandRef);if(!u)continue;let f=l.precondition?{...u,precondition:l.precondition}:u;c.push({command:f,binding:l})}return c.sort((l,u)=>{let f=this.getBindingPriority(l.binding),d=this.getBindingPriority(u.binding);return f!==d?f-d:(l.binding.order??100)-(u.binding.order??100)}),this.cache.set(i,c),c}async loadCommand(e){let t=await this.findSubjectByUID(e);if(!t||(await this.tripleStore.match(t,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("Command"))).length===0)return null;let i=await this.getLiteralValue(t,V.Namespace.EXO.term("Asset_label"))??"Unknown Command",s=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_labelTemplate")),a=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_icon")),c=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_confirmMessage")),l=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_successMessage")),u=await this.getLiteralValue(t,V.Namespace.EXOCMD.term("Command_category")),f=await this.loadLinkedPrecondition(t),d=await this.loadLinkedGrounding(t,0);return d?{id:e,name:i,labelTemplate:s??void 0,icon:a??void 0,precondition:f??void 0,grounding:d,confirmMessage:c??void 0,successMessage:l??void 0,category:u??void 0}:null}async findBindings(e,t,r){let i=await this.tripleStore.match(void 0,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("CommandBinding")),s=[];for(let a of i){let c=a.subject,l=await this.loadBindingDefinition(c);l&&this.bindingMatches(l,e,t,r)&&s.push(l)}return s}async findPaletteEnabledCommands(){let e=await this.tripleStore.match(void 0,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("Command")),t=[],r=new Set;for(let i of e){let s=i.subject;if((await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_paletteEnabled")))?.toLowerCase()!=="true")continue;let c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid"));if(!c){this.logger.warn(`[CommandResolver] paletteEnabled command at ${s.value} has no exo__Asset_uid \u2014 skipped`);continue}let l=await this.loadCommand(c);if(!l){this.logger.warn(`[CommandResolver] paletteEnabled command ${c} could not be loaded (missing grounding?) \u2014 skipped`);continue}let u=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_paletteId")),f=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_cliName")),d=u??f??c;if(r.has(d)){this.logger.warn(`[CommandResolver] duplicate paletteId "${d}" \u2014 first registration wins, dropping ${c}`);continue}r.add(d),t.push({command:l,paletteId:d})}return t}invalidateCache(){this.cache.clear(),this.multiCache.clear()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let r=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:a}of i){let c=await this.evaluateSelectSnippet(a,t);r=r.replace(s,c)}return r}extractPlaceholders(e){let t=[],r=0;for(;r<e.length;)if(e[r]==="{"){let i=1,s=r+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let a=e.slice(r,s),c=e.slice(r+1,s-1);t.push({full:a,body:c})}r=s}else r++;return t}async evaluateSelectSnippet(e,t){try{let r=e.replace(/\$target/g,`<${t}>`),s=new _9.ExoQLParser().parse(r),c=new b9.ExoQLAlgebraTranslator().translate(s),u=await new S9.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let h=f.get(d[0]);return h?h instanceof _r.Literal||h instanceof fn.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,V.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetClass")),a=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!a&&!c)return null;let l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,h=await this.loadLinkedPreconditionFromProperty(e,V.Namespace.EXOCMD.term("CommandBinding_precondition")),p=await this.loadLinkedStyle(e,t);return{id:t,label:r,commandRef:i,targetClass:s??void 0,targetPrototype:a??void 0,targetAsset:c??void 0,position:l??void 0,order:u?parseInt(u,10):void 0,variant:d,precondition:h??void 0,style:p??void 0}}async loadLinkedStyle(e,t){let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(r.length>0){let s=r[0].object,a=null;if(s instanceof fn.IRI)a=s;else if(s instanceof _r.Literal){let c=this.normalizeWikilink(s.value);a=await this.findSubjectByUID(c)}if(a){let c=await this.loadStyleAsset(a);if(c)return c}this.logger.warn(this.capWarning(`CommandBinding ${t}: style reference unresolved, falling back to inline variant`))}let i=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_variant"));if(i!==null){let s=this.coerceVariant(i,t);if(s!==void 0)return{id:`inline:${t}`,label:"",variant:s,inline:!0}}return null}async loadStyleAsset(e){let t=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,a=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(a),l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),h=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),p=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_source")),y=p!==null?this.coerceStyleSource(p,t):void 0;return{id:t,label:r,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:h??void 0,source:y,inline:!1}}coerceVariant(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Hc.COMMAND_VARIANT_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${r}" not in whitelist [${Hc.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Hc.LABEL_CLASS_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${r}" not in whitelist [${Hc.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Hc.STYLE_SOURCE_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle source "${r}" not in whitelist [${Hc.STYLE_SOURCE_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceBoolean(e){if(e===null)return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}capWarning(e){return e.length<=200?e:e.slice(0,197)+"..."}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let a=this.extractPathBasename(r);if(a&&a===i)return!0;let c=this.extractAlias(t);if(c&&r===c)return!0;let l=this.extractAlias(e);return!!(l&&l===i)}extractPathBasename(e){let t=e.match(/\/([^/]+)\.md$/);return t?t[1]:null}extractAlias(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(r+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,V.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof fn.IRI)s=i;else if(i instanceof _r.Literal){let h=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(h)}if(!s)return null;let a=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Precondition_hostFunction")),f=await this.tripleStore.match(s,V.Namespace.EXOCMD.term("Precondition_query"),void 0),d;if(f.length>0){let h=f[0].object;if(h instanceof fn.IRI){let p=await this.getLiteralValue(h,V.Namespace.EXO.term("Asset_uid"));p&&(d=p)}else h instanceof _r.Literal&&(d=this.normalizeWikilink(h.value))}return!a||!l&&!u&&!d?null:{id:a,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u},...d&&{query:d}}}async loadLinkedGrounding(e,t){if(t>=v1)return null;let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Command_grounding"),void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof fn.IRI)s=i;else if(i instanceof _r.Literal){let a=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(a)}return s?this.loadGroundingDefinition(s,t):null}async loadGroundingDefinition(e,t){if(t>=v1)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",s=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_type"));if(!s)return null;let a=this.resolveGroundingType(s);if(!a)return null;let c=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetProperty"));if(c&&this.looksLikeUUID(c)){let ae=await this.resolveLabelByUID(c);if(!ae)return this.logger.warn(`Grounding ${r}: targetProperty wikilink UID '${c}' is not resolvable to exo__Asset_label \u2014 grounding skipped (would otherwise write a UUID-named frontmatter key).`),null;c=ae}if(a===w1.GroundingType.SERVICE_CALL){let ae=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_serviceId"));ae&&(c=ae)}let l=await this.getObsidianWikilinkValue(e,V.Namespace.EXOCMD.term("Grounding_targetValue")),u=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueRef")),f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_targetValueLiteral")),d=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueSubstitution")),h=null;if(d&&this.looksLikeUUID(d)){let ae=await this.resolveLabelByUID(d);if(!ae)return this.logger.warn(`Grounding ${r}: targetValueSubstitution UID '${d}' is not resolvable to exo__Asset_label (SubstitutionToken instance missing or unlabelled) \u2014 grounding skipped.`),null;h=ae}else d&&(h=d);let p=await this.getObsidianWikilinkValue(e,V.Namespace.EXOCMD.term("Grounding_isDefinedBy")),y=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),S=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetClass"));if(S&&!this.looksLikeUUID(S)){let ae=await this.findUidByLabel(S);ae&&(S=ae)}let v=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetPrototype")),w=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_targetFolder")),T=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_linkBackProperty")),C=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_inputSchema")),L=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_incrementBy")),$=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_shiftDelta")),ee;if(L!=null&&L!==""){let ae=Number.parseInt(String(L),10);Number.isFinite(ae)&&(ee=ae)}let B=await this.resolvePropertyDefaults(e,r),G=await this.resolveInheritanceRules(e,r),F=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_propertyDefaults"));F!==null&&F!==""&&!this._legacyPropertyDefaultsWarnedGroundings.has(r)&&(this.logger.warn(`Grounding ${r}: deprecated exocmd__Grounding_propertyDefaults (plural) JSON predicate detected \u2014 the parser was removed in RFC v2 Phase 5 (#3167); value is ignored. Migrate to ref-form exocmd__Grounding_propertyDefault (singular) pointing to exocmd__PropertyDefault assets. See vault TBox c8f87363-d39c-45cb-9d4d-1be96d70f892 for the canonical replacement.`),this._legacyPropertyDefaultsWarnedGroundings.add(r));let D;a===w1.GroundingType.COMPOSITE&&(D=await this.loadCompositeSteps(e,t+1));let W;if(C)try{let ae=JSON.parse(C);ae?.properties&&(W=Object.entries(ae.properties).map(([Ze,ie])=>{let Z=ie.type,q=Z==="string"?"text":Z,tt=ie.defaultValue!==void 0?ie.defaultValue:ie.default,st={name:Ze,type:q,label:ie.title??Ze,required:Array.isArray(ae.required)&&ae.required.includes(Ze)};return tt!=null&&(st.defaultValue=String(tt)),st}))}catch{}let De=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_prefillLabelWithDate")),et=De!==null&&String(De).trim().toLowerCase()==="true",ut={id:r,label:i,type:a,targetProperty:c??void 0,targetValue:l??void 0,targetValueRef:u??void 0,targetValueLiteral:f??void 0,targetValueSubstitution:h??void 0,sparqlUpdate:y??void 0,steps:D,targetClass:S??void 0,targetPrototype:v??void 0,targetFolder:w??void 0,linkBackProperty:T??void 0,incrementBy:ee,shiftDelta:$??void 0,propertyDefault:B.length>0?B:void 0,inheritanceRule:G.length>0?G:void 0,isDefinedBy:p??void 0,prefillLabelWithDate:et||void 0};return W&&(ut.inputSchema=W),ut}async loadCompositeSteps(e,t){if(t>=v1)return[];let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let a=null;if(s.object instanceof fn.IRI)a=s.object;else if(s.object instanceof _r.Literal){let l=this.normalizeWikilink(s.object.value);a=await this.findSubjectByUID(l)}if(!a)continue;let c=await this.loadGroundingDefinition(a,t);c&&i.push(c)}return i}async resolvePropertyDefaults(e,t){let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_propertyDefault"),void 0),i=[];for(let s of r){let a=await this.resolveRefTripleObject(s.object);if(!a)continue;let c=await this.getObsidianName(a,V.Namespace.EXOCMD.term("PropertyDefault_property"));if(!c){this.logger.warn(`Grounding ${t}: PropertyDefault asset missing exocmd__PropertyDefault_property \u2014 entry skipped.`);continue}let l=this.looksLikeUUID(c)?await this.resolveLabelByUID(c):c;if(!l){this.logger.warn(`Grounding ${t}: PropertyDefault property UID '${c}' is not resolvable to exo__Asset_label \u2014 entry skipped.`);continue}let u=await this.getObsidianName(a,V.Namespace.EXOCMD.term("PropertyDefault_value"));if(!u){this.logger.warn(`Grounding ${t}: PropertyDefault '${l}' missing exocmd__PropertyDefault_value \u2014 entry skipped.`);continue}let f=await this.resolvePropertyDefaultValue(u,t,l);f!==null&&i.push({propertyName:l,value:f})}return i}async resolveInheritanceRules(e,t){let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_inheritanceRule"),void 0),i=[];for(let s of r){let a=await this.resolveRefTripleObject(s.object);if(!a)continue;let c=await this.resolveLabelRef(a,V.Namespace.EXOCMD.term("InheritanceRule_sourceProperty"));if(!c){this.logger.warn(`Grounding ${t}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_sourceProperty \u2014 entry skipped.`);continue}let l=await this.resolveLabelRef(a,V.Namespace.EXOCMD.term("InheritanceRule_targetProperty"));if(!l){this.logger.warn(`Grounding ${t}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_targetProperty \u2014 entry skipped.`);continue}let u=await this.tripleStore.match(a,V.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"),void 0),f;if(u.length>0){let v=await this.resolveLabelRef(a,V.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"));if(!v){this.logger.warn(`Grounding ${t}: InheritanceRule has exocmd__InheritanceRule_targetClassCondition triple but ref is unresolvable \u2014 entire rule skipped (would otherwise apply unconditionally, broadening scope).`);continue}f=v}let d=await this.tripleStore.match(a,V.Namespace.EXOCMD.term("InheritanceRule_targetClassExclusion"),void 0),h=[],p=!1;for(let v of d){let w=null;if(v.object instanceof fn.IRI?w=this.iriToObsidianName(v.object.value)??v.object.value:v.object instanceof _r.Literal&&(w=this.unwrapWikilink(v.object.value)),!w){p=!0;continue}let T=this.looksLikeUUID(w)?await this.resolveLabelByUID(w):w;if(!T){p=!0;continue}h.push(T)}if(p){this.logger.warn(`Grounding ${t}: InheritanceRule has unresolvable exocmd__InheritanceRule_targetClassExclusion entry \u2014 entire rule skipped (would otherwise expand scope by silently dropping the excluded class).`);continue}let y=await this.getLiteralValue(a,V.Namespace.EXOCMD.term("InheritanceRule_priority")),S=50;if(y!==null&&y!==""){let v=Number.parseInt(String(y),10);Number.isFinite(v)&&(S=v)}i.push({sourcePropertyName:c,targetPropertyName:l,targetClassCondition:f,targetClassExclusion:h,priority:S})}return i}async resolveRefTripleObject(e){if(e instanceof fn.IRI)return e;if(e instanceof _r.Literal){let t=this.normalizeWikilink(e.value);return t?this.findSubjectByUID(t):null}return null}async resolveLabelRef(e,t){let r=await this.getObsidianName(e,t);return r?this.looksLikeUUID(r)?this.resolveLabelByUID(r):r:null}async resolvePropertyDefaultValue(e,t,r){if(!this.looksLikeUUID(e))return`"[[${e}]]"`;let i=await this.findSubjectByUID(e);if(!i)return`"[[${e}]]"`;if(!await this.assetIsSubstitutionToken(i))return`"[[${e}]]"`;let a=await this.getLiteralValue(i,V.Namespace.EXOCMD.term("SubstitutionToken_resolver"));if(!a||!a.trim())return this.logger.warn(`Grounding ${t}: PropertyDefault '${r}' references SubstitutionToken '${e}' with no exocmd__SubstitutionToken_resolver \u2014 falling back to wikilink form.`),`"[[${e}]]"`;let c=a.trim();return eA.has(c)?c==="today"?new Date().toISOString().slice(0,10):c==="todayStart"?new Date(new Date().setHours(0,0,0,0)).toISOString():v9(c,e):(this.logger.warn(`Grounding ${t}: PropertyDefault '${r}' SubstitutionToken '${e}' declares unknown resolver-id '${c}' \u2014 falling back to wikilink form. Known ids: ${Array.from(eA).join(", ")}.`),`"[[${e}]]"`)}async assetIsSubstitutionToken(e){let t=await this.tripleStore.match(e,V.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof fn.IRI){if(r.object.value===w9||r.object.value.includes(Z3))return!0}else if(r.object instanceof _r.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__SubstitutionToken"||i===Z3)return!0}return!1}resolveGroundingType(e){let t=e.toLowerCase().trim();return Object.values(w1.GroundingType).includes(t)?t:null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let r=await this.tripleStore.findSubjectsByUUID(e);if(r.length>0)return r[0]}let t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof _r.Literal&&r.object.value===e)return r.subject;return null}async getLiteralValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof _r.Literal||i instanceof fn.IRI?i.value:null}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)}async resolveLabelByUID(e){let t=await this.findSubjectByUID(e);return t?this.getLiteralValue(t,V.Namespace.EXO.term("Asset_label")):null}async findUidByLabel(e){let t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Asset_label"),void 0);for(let r of t)if(r.object instanceof _r.Literal&&r.object.value===e&&r.subject instanceof fn.IRI){let i=await this.tripleStore.match(r.subject,V.Namespace.EXO.term("Asset_uid"),void 0);if(i.length>0&&i[0].object instanceof _r.Literal)return i[0].object.value}return null}async getLinkedUID(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof fn.IRI){let s=await this.tripleStore.match(i,V.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof _r.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof _r.Literal?this.normalizeWikilink(i.value):null}async getLinkedValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof _r.Literal?this.normalizeWikilink(i.value):i instanceof fn.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof _r.Literal?this.unwrapWikilink(i.value):i instanceof fn.IRI?this.iriToObsidianName(i.value)??i.value:null}unwrapWikilink(e){if(!e)return e;let t=e.trim().replace(/^"|"$/g,"");if(t.startsWith("http://")||t.startsWith("https://"))return this.iriToObsidianName(t)??t;let r=t.match(/^\[\[([^\]|]+)\|([^\]]+)\]\]$/);if(r)return r[2].trim();let i=t.match(/^\[\[([^\]|]+)\]\]$/);if(i){let s=i[1].trim();return s.startsWith("http://")||s.startsWith("https://")?this.iriToObsidianName(s)??s:s}return t}async getObsidianWikilinkValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof _r.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof fn.IRI){let s=this.iriToObsidianName(i.value);return s?`"[[${s}]]"`:i.value}return null}async resolveWikilinkAlias(e){let t=e.match(/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\]/);if(!t)return e;let r=t[1],i=await this.findSubjectByUID(r);if(!i)return e;let s=await this.getLiteralValue(i,V.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${r}]]`,`[[${r}|${s}]]`):e}iriToObsidianName(e){let t=e.lastIndexOf("#");if(t>=0){let i=e.substring(0,t+1),s=e.substring(t+1);if(i===V.Namespace.EMS.iri.value)return`ems__${s}`;if(i===V.Namespace.EXO.iri.value)return`exo__${s}`;if(i===V.Namespace.EXOCMD.iri.value)return`exocmd__${s}`;if(i===V.Namespace.IMS.iri.value)return`ims__${s}`;if(i===V.Namespace.ZTLK.iri.value)return`ztlk__${s}`;if(i===V.Namespace.PTMS.iri.value)return`ptms__${s}`;if(i===V.Namespace.LIT.iri.value)return`lit__${s}`;if(i===V.Namespace.INBOX.iri.value)return`inbox__${s}`}let r=e.match(/\/([^/]+)\.md$/);return r?r[1]:null}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(0,r):t}};Ws.CommandResolver=E1;Ws.CommandResolver=E1=p9([(0,g9.injectable)(),m9("design:paramtypes",[Object,Object])],E1)});var A1=b(T1=>{"use strict";Object.defineProperty(T1,"__esModule",{value:!0});T1.validateExoQLAllowlist=E9;var dp=Lu();function E9(n){if(!n||typeof n!="object")return;let e=n;if(e.type==="update"){let t=n.updates??[];for(let r of t)if(r?.type==="load")throw new dp.ExoQLForbiddenKeywordError("LOAD");throw new dp.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,r=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||r)throw new dp.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)hp(t);if(Array.isArray(e.template))for(let t of e.template)hp(t)}}o(E9,"validateExoQLAllowlist");function hp(n){if(!n||typeof n!="object")return;if(n.type==="service")throw new dp.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(n.patterns))for(let t of n.patterns)hp(t);let e=n.where;if(Array.isArray(e))for(let t of e)hp(t)}o(hp,"walkPatternForBannedKeywords")});var x1=b(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});pp.DEFAULT_EVAL_CONFIG=void 0;pp.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var C1=b(I1=>{"use strict";Object.defineProperty(I1,"__esModule",{value:!0});I1.evaluateWithExoEval=O9;var T9=Tc(),A9=xc(),x9=zc(),I9=A1(),C9=x1(),R9=Lu();async function O9(n,e={}){if(typeof n!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let r=new T9.ExoQLParser().parse(n);if((0,I9.validateExoQLAllowlist)(r),!{...C9.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new R9.ExoQLEvalDisabledError;let s="queryType"in r&&typeof r.queryType=="string"?r.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new A9.ExoQLAlgebraTranslator().translate(r),l=new x9.ExoQLQueryExecutor(e.store);return l.isAskQuery(c)?{kind:"ask",result:await l.executeAsk(c)}:l.isConstructQuery(c)?{kind:"construct",triples:await l.executeConstruct(c)}:{kind:"select",rows:await l.executeAll(c)}}o(O9,"evaluateWithExoEval")});var ju=b(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});mp.liveClock=P9;mp.frozenClock=F9;function P9(){return{now:o(()=>new Date,"now")}}o(P9,"liveClock");function F9(n){let e=new Date(n);return{now:o(()=>new Date(e.getTime()),"now")}}o(F9,"frozenClock")});var nA=b(Gs=>{"use strict";var D9=Gs&&Gs.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},N9=Gs&&Gs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Mu;Object.defineProperty(Gs,"__esModule",{value:!0});Gs.PreconditionEvaluator=void 0;var L9=Ce(),k9=Tc(),j9=xc(),rA=zc(),M9=C1(),$9=ju(),$u=Mu=class{static{o(this,"PreconditionEvaluator")}constructor(e,t,r){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t,this.clock=r?.clock??(0,$9.liveClock)()}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.query?this.evaluateQueryRef(e.query,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return!1;let i=this.substituteVariables(r,t),s=await(0,M9.evaluateWithExoEval)(i,{store:this.tripleStore});return s.kind!=="ask"?!1:s.result}catch{return!1}}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Mu.SENTINEL_IRI),i=new k9.ExoQLParser().parse(t),a=new j9.ExoQLAlgebraTranslator().translate(i);return new rA.ExoQLQueryExecutor(this.tripleStore).isAskQuery(a)?a:null}evaluateHostFunction(e,t,r){let i=this.hostFunctions.get(e);if(!i)return!0;let s=r?{...r,targetIRI:t}:{targetIRI:t};return i(s)}async evaluateSparqlAsk(e,t){try{let r=this.askCache.get(e);if(r===void 0){let a=this.compileAsk(e);if(!a)return!1;r=a,this.askCache.set(e,r)}let i=JSON.parse(JSON.stringify(r).replaceAll(Mu.SENTINEL_IRI,t));return await new rA.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=this.clock.now(),i=r.toISOString(),s=i.slice(0,10),a=new Date(r.getTime()+Mu.ALMATY_OFFSET_MS),c=a.getUTCFullYear(),l=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCDay(),h=new Date(Date.UTC(c,l,u-1)).toISOString().slice(0,10),p=(f+6)%7,y=new Date(Date.UTC(c,l,u-p)),S=y.toISOString().slice(0,10),w=new Date(y.getTime()-10080*60*1e3).toISOString().slice(0,10),T=`${c}-${String(l+1).padStart(2,"0")}-01`,C=l===0?11:l-1,$=`${l===0?c-1:c}-${String(C+1).padStart(2,"0")}-01`,ee=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${i}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${S}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${w}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${T}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${$}"^^xsd:date`).replace(/\$thisYearStart/g,`"${ee}"^^xsd:date`).replace(/\$today/g,`"${s}"^^xsd:date`)}};Gs.PreconditionEvaluator=$u;$u.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";$u.ALMATY_OFFSET_MS=300*60*1e3;Gs.PreconditionEvaluator=$u=Mu=D9([(0,L9.injectable)(),N9("design:paramtypes",[Object,Object,Object])],$u)});var iA=b(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.hasNonUidFilename=void 0;Qc.registerDefaultHostFunctions=B9;var V9=o(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t!==e},"hasNonUidFilename");Qc.hasNonUidFilename=V9;function B9(n){n.registerHostFunction("hasNonUidFilename",Qc.hasNonUidFilename)}o(B9,"registerDefaultHostFunctions")});var yp=b(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.liveUidGenerator=U9;gp.seededUidGenerator=W9;var R1=ui();function U9(){return{next:o(()=>(0,R1.v4)(),"next")}}o(U9,"liveUidGenerator");var q9="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function W9(n){let e=0,t=(0,R1.v5)(n,q9);return{next:o(()=>{let r=`${n}#${e}`;return e+=1,(0,R1.v5)(r,t)},"next")}}o(W9,"seededUidGenerator")});var as=b(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.FrontmatterService=void 0;var Vu=class n{static{o(this,"FrontmatterService")}parse(e){let t=e.match(n.FRONTMATTER_REGEX);return t?{exists:!0,content:t[1],originalContent:e}:{exists:!1,content:"",originalContent:e}}parseObject(e){let t=this.parse(e);if(!t.exists)return null;let r={},i=t.content.split(/\r?\n/),s=null,a=null,c=o(()=>{s!==null&&a!==null&&(r[s]=a),s=null,a=null},"flushArray");for(let l of i){let u=/^ {2}- (.*)$/.exec(l);if(u){s!==null&&a!==null&&a.push(u[1].trim());continue}c();let f=/^([^:\s][^:]*):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(s=d,a=[]):r[d]=h}return c(),r}updateProperty(e,t,r){t=n.normalizeIRI(t),typeof r=="string"&&(r=n.normalizeIRIValue(r));let i=this.parse(e),s=this.serializeValue(t,r);if(!i.exists)return`---
|
|
71
71
|
${s}
|
|
72
72
|
---
|
|
73
73
|
${e}`;let a=i.content;if(this.hasProperty(a,t)){let c=new RegExp(`${this.escapeRegex(t)}:.*(?:
|
|
@@ -88,7 +88,7 @@ ${Object.entries(t).map(([a,c])=>this.serializeValue(a,c)).join(`
|
|
|
88
88
|
${r}`}return`${e}: ${String(t)}`}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};_p.FrontmatterService=Vu;Vu.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/;Vu.IRI_PREFIX_MAP={"https://exocortex.my/ontology/ems#":"ems__","https://exocortex.my/ontology/exo#":"exo__","https://exocortex.my/ontology/exocmd#":"exocmd__","https://exocortex.my/ontology/ims#":"ims__","https://exocortex.my/ontology/ztlk#":"ztlk__","https://exocortex.my/ontology/ptms#":"ptms__","https://exocortex.my/ontology/lit#":"lit__","https://exocortex.my/ontology/inbox#":"inbox__","https://exocortex.my/ontology/pmbok#":"pmbok__"}});var Rn=b(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.DateFormatter=void 0;var O1=class n{static{o(this,"DateFormatter")}static toISOTimestamp(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}static toLocalTimestamp(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0");return`${t}-${r}-${i}T${s}:${a}:${c}`}static toDateWikilink(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`"[[${t}-${r}-${i}]]"`}static getTodayWikilink(){return n.toDateWikilink(new Date)}static toDateString(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${i}`}static parseWikilink(e){let r=e.replace(/^["']|["']$/g,"").match(/\[\[(\d{4}-\d{2}-\d{2})\]\]/);return r?r[1]:null}static addDays(e,t){let r=new Date(e);return r.setDate(r.getDate()+t),r}static isSameDay(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}static getTodayStartTimestamp(){let e=new Date;return e.setHours(0,0,0,0),n.toLocalTimestamp(e)}static toTimestampAtStartOfDay(e){let t=e.split("-").map(Number);if(t.length!==3||t.some(isNaN))throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD`);let[r,i,s]=t,a=new Date(r,i-1,s,0,0,0,0);if(isNaN(a.getTime()))throw new Error(`Invalid date values: ${e}`);return n.toLocalTimestamp(a)}static normalizeTimestamp(e){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e;let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid timestamp format: ${e}`);return n.toISOTimestamp(t)}static isISOTimestamp(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e)}};bp.DateFormatter=O1});var Oa=b(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.LoggingService=void 0;var Bu=class{static{o(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,r){let i=this.checkIsDevelopment(),s=r?` [${r}]`:"";if(i){let a=t?.stack?`
|
|
89
89
|
Stack trace:
|
|
90
90
|
${t.stack}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`,t??"")}else{let a=t?.message?`
|
|
91
|
-
Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`)}}};Sp.LoggingService=Bu;Bu.isVerbose=!1;Bu.isDevelopment=void 0});var cA=b(gi=>{"use strict";var G9=gi&&gi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},z9=gi&&gi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Pa;Object.defineProperty(gi,"__esModule",{value:!0});gi.GroundingExecutor=gi.ServiceRegistry=void 0;var H9=Ce(),Q9=ju(),K9=yp(),os=uo(),Y9=as(),P1=Rn(),sA=Fu(),X9=Oa();function J9(n){if(!n)return;let e=n.match(/^"?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]"?$/);return e?e[1]:n}o(J9,"extractClassFromTargetValue");var aA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Z9=/^__SUBSTITUTE__(target|targetFolder)__[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}__$/,wp=class{static{o(this,"ServiceRegistry")}constructor(){this.services=new Map}register(e,t){this.services.set(e,t)}get(e){return this.services.get(e)}has(e){return this.services.has(e)}getRegisteredIds(){return Array.from(this.services.keys())}};gi.ServiceRegistry=wp;var oA=20,Uu=Pa=class{static{o(this,"GroundingExecutor")}constructor(e,t,r,i,s){this.frontmatterService=new Y9.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r,this.classLabelToUid=i,this.clock=s?.clock??(0,Q9.liveClock)(),this.uidGen=s?.uidGenerator??(0,K9.liveUidGenerator)()}async execute(e,t,r,i){try{switch(e.type){case os.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case os.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case os.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case os.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case os.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,r,i);case os.GroundingType.PROPERTY_APPEND:return await this.executePropertyAppend(e,t,r,i);case os.GroundingType.PROPERTY_INCREMENT:return await this.executePropertyIncrement(e,r);case os.GroundingType.PROPERTY_SHIFT:return await this.executePropertyShift(e,r);case os.GroundingType.SPARQL_UPDATE:return{success:!1,error:"sparql_update grounding not yet implemented. Use property_set/property_delete instead."};default:return{success:!1,error:`Unknown grounding type: ${e.type}`}}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}async executePropertySet(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_set requires targetProperty"};let s;if([e.targetValueRef!==void 0,e.targetValueLiteral!==void 0,e.targetValueSubstitution!==void 0].filter(Boolean).length>1)return{success:!1,error:"property_set: more than one of targetValueRef/targetValueLiteral/targetValueSubstitution set (cardinality 0..1 each, mutually exclusive)"};if(e.targetValueRef!==void 0)s=`"[[${e.targetValueRef}]]"`;else if(e.targetValueLiteral!==void 0)s=e.targetValueLiteral;else if(e.targetValueSubstitution!==void 0)s=e.targetValueSubstitution;else return{success:!1,error:"property_set requires one of targetValueRef/targetValueLiteral/targetValueSubstitution"};if(/\$(input|value)\b/.test(s)&&(i===void 0||i.value===void 0||i.value===null))return{success:!1,error:"property_set: substituted value contains $input/$value placeholder but no userInput.value provided"};let l=this.substituteVariables(s,t,i),u=await this.fileReader.readFile(r),f=this.frontmatterService.updateProperty(u,e.targetProperty,l);return await this.fileWriter.updateFile(r,f),{success:!0}}async executePropertyDelete(e,t){if(!e.targetProperty)return{success:!1,error:"property_delete requires targetProperty"};let r=await this.fileReader.readFile(t),i=this.frontmatterService.removeProperty(r,e.targetProperty);return await this.fileWriter.updateFile(t,i),{success:!0}}async executeComposite(e,t,r,i,s){if(s>=oA)return{success:!1,error:`Composite grounding exceeded maximum depth of ${oA}`};let a=e.steps??[];if(a.length===0)return{success:!0};let c;try{c=await this.fileReader.readFile(r)}catch{}let l=[];try{for(let u=0;u<a.length;u++){let f=a[u],d=await this.executeStep(f,t,r,i,s+1);if(!d.success)return await this.rollback(c,r,l),{success:!1,error:`Composite step ${u} failed: ${d.error}`};l.push(u)}return{success:!0}}catch(u){return await this.rollback(c,r,l),{success:!1,error:`Composite execution failed: ${u instanceof Error?u.message:String(u)}`}}}async executeServiceCall(e,t,r,i){let s=e.targetProperty;if(!s)return{success:!1,error:"service_call requires targetProperty as serviceId"};if(s==="convertToTask")return await this.executeConvertToTask(r);if(s==="updateProperty"){let l=J9(e.targetValue);if(l==="ems__Task")return await this.executeConvertToTask(r);if(l==="ems__Project")return await this.executeConvertToProject(r)}let a=this.serviceRegistry.get(s);if(!a)return{success:!1,error:`Service not found: "${s}". Registered services: ${this.serviceRegistry.getRegisteredIds().join(", ")||"none"}`};let c=i;if(e.isDefinedBy&&(c={isDefinedBy:e.isDefinedBy,...c??{}}),e.targetValue)try{let l=this.substituteVariables(e.targetValue,t,i),u=JSON.parse(l);typeof u=="object"&&u!==null&&(c={...u,...c??{}})}catch{}return await a.execute(t,c),{success:!0}}async executeConvertToTask(e){let t=await this.fileReader.readFile(e),r=await this.resolveClassRefToUid("ems__Task"),i=this.frontmatterService.updateProperty(t,"exo__Instance_class",`["[[${r}]]"]`);return await this.fileWriter.updateFile(e,i),{success:!0}}async executeConvertToProject(e){let t=await this.fileReader.readFile(e),r=await this.resolveClassRefToUid("ems__Project"),i=this.frontmatterService.updateProperty(t,"exo__Instance_class",`["[[${r}]]"]`);return await this.fileWriter.updateFile(e,i),{success:!0}}async executeCreateInstance(e,t,r,i){if(!e.targetFolder)return{success:!1,error:"create_instance requires targetFolder"};let s=this.uidGen.next(),a=i?.label??"Untitled",c={exo__Asset_uid:s,exo__Asset_createdAt:P1.DateFormatter.toLocalTimestamp(this.clock.now()),exo__Asset_label:a};if(a!=="Untitled"&&(c.aliases=[a]),e.targetClass){let h=await this.resolveClassRefToUid(e.targetClass);c.exo__Instance_class=[`"[[${h}]]"`]}if(e.propertyDefault&&e.propertyDefault.length>0&&this.applyPropertyDefaultStep(c,e.propertyDefault,t,r),e.propertyDefaults&&!(e.propertyDefault&&e.propertyDefault.length>0))for(let[h,p]of Object.entries(e.propertyDefaults))typeof p=="string"&&(c[h]=this.substituteVariables(p,t,i,void 0,r));if(i)for(let[h,p]of Object.entries(i))h!=="label"&&p!=null&&(c[h]=p);let l=null;if(t&&r){let h;try{h=await this.fileReader.readFile(r)}catch(p){return{success:!1,error:`create_instance: failed to read $target file "${r}": ${p instanceof Error?p.message:String(p)}`}}l=this.frontmatterService.parseObject(h)??null}if(e.inheritanceRule&&e.inheritanceRule.length>0&&l&&await this.applyInheritanceRuleStep(c,e.inheritanceRule,l),l)for(let[h,p]of Object.entries(l))Pa.CREATE_INSTANCE_BLACKLIST.has(h)||c[h]===void 0&&(c[h]=this.reformatCopiedValue(p));if(t){let h=e.linkBackProperty??"exo__Asset_prototype",p=Pa.extractBacklinkTarget(t,r);c[h]=`"[[${p}]]"`}let u=this.frontmatterService.createFrontmatter("",c),f=this.substituteVariables(e.targetFolder,t,i,void 0,r),d=f?`${f}/${s}.md`:`${s}.md`;return await this.fileWriter.createFile(d,u),{success:!0,openPath:d}}async resolveClassRefToUid(e){if(aA.test(e)||!this.classLabelToUid)return e;try{let t=await this.classLabelToUid(e);return t&&t.length>0?t:e}catch{return e}}applyPropertyDefaultStep(e,t,r,i){for(let{propertyName:s,value:a}of t)e[s]===void 0&&(e[s]=this.resolveSubstitutionMarker(a,r,i))}resolveSubstitutionMarker(e,t,r){let i=e.match(Z9);if(!i)return e;let s=i[1];if(s==="target")return`"[[${Pa.extractBacklinkTarget(t,r)}]]"`;if(s==="targetFolder"){if(!r)return"";let a=r.replace(/^\/+/,""),c=a.lastIndexOf("/");return c>=0?a.slice(0,c):""}return e}async applyInheritanceRuleStep(e,t,r){let i=this.extractTargetClassNames(r),s=[];for(let a of t)!await this.inheritanceConditionMatches(a.targetClassCondition,i)||await this.inheritanceExclusionMatches(a.targetClassExclusion,i)||s.push(a);s.sort((a,c)=>c.priority-a.priority);for(let a of s){if(e[a.targetPropertyName]!==void 0)continue;let c=r[a.sourcePropertyName];c!=null&&(e[a.targetPropertyName]=this.formatInheritedValue(c))}}async inheritanceConditionMatches(e,t){return e?this.classMatchesAny(e,t):!0}async inheritanceExclusionMatches(e,t){for(let r of e)if(await this.classMatchesAny(r,t))return!0;return!1}async classMatchesAny(e,t){if(t.includes(e))return!0;if(!this.classLabelToUid)return!1;try{let r=await this.classLabelToUid(e);if(r&&r.length>0&&t.includes(r))return!0}catch{}return!1}extractTargetClassNames(e){let t=e.exo__Instance_class;if(t==null)return[];let r=Array.isArray(t)?t:[t],i=[];for(let s of r){let a=this.extractWikilinkInner(String(s));a&&i.push(a)}return i}extractWikilinkInner(e){let t=e.match(/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/);return t?t[1].trim():e.replace(/^["']|["']$/g,"").trim()}formatInheritedValue(e){return Array.isArray(e)?e.map(t=>this.formatInheritedScalar(String(t))):this.formatInheritedScalar(String(e))}formatInheritedScalar(e){return/^"?\[\[.+\]\]"?$/.test(e)?this.reformatWikilink(e):aA.test(e)?`"[[${e}]]"`:e}reformatCopiedValue(e){return Array.isArray(e)?e.map(t=>this.reformatWikilink(t)):this.reformatWikilink(e)}reformatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:e}async executeStep(e,t,r,i,s){return e.type===os.GroundingType.COMPOSITE?this.executeComposite(e,t,r,i,s):this.execute(e,t,r,i)}async rollback(e,t,r){if(e!==void 0)try{await this.fileWriter.updateFile(t,e)}catch(i){X9.LoggingService.error(`[GroundingExecutor] Rollback failed for ${t}`,i instanceof Error?i:new Error(String(i)))}}substituteVariables(e,t,r,i,s){let a=this.clock.now(),c=a.toISOString(),l=P1.DateFormatter.toLocalTimestamp(a),u=c.slice(0,10),f=`${u}T00:00:00`,d=e.replace(/\$target\.([A-Za-z_][\w]*)/g,(h,p)=>{if(!i)throw new Error(`$target.${p} substitution requires target frontmatter context; none was supplied (asset IRI: ${t})`);let y=i[p];if(y==null)throw new Error(`$target.${p} is undefined on asset ${t}`);if(Array.isArray(y))throw new Error(`$target.${p} resolved to an array on asset ${t}; only scalar properties are supported for substitution`);return String(y).replace(/^["'](.*)["']$/,"$1")});if(/\$targetFolder\b/.test(d)){if(!s)throw new Error("$targetFolder substitution requires targetFilePath context; none was supplied (asset IRI: "+t+")");let h=s.replace(/^\/+/,""),p=h.lastIndexOf("/"),y=p>=0?h.slice(0,p):"";d=d.replace(/\$targetFolder\b/g,y)}if(d=d.replace(/\$target/g,t).replace(/\$nowLocal/g,l).replace(/\$now/g,c).replace(/\$todayStart\b/g,f).replace(/\$today/g,u),r?.value!==void 0&&r.value!==null){let h=String(r.value);d=d.replace(/\$input\b/g,h).replace(/\$value\b/g,h)}return d}async executePropertyAppend(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_append requires targetProperty"};if(e.targetValue===void 0)return{success:!1,error:"property_append requires targetValue"};let s=await this.fileReader.readFile(r),a=this.frontmatterService.parseObject(s)??{},c=this.substituteVariables(e.targetValue,t,i,a),l=a[e.targetProperty],u=Array.isArray(l)?l:l!==void 0?[String(l)]:[],f=o(y=>y.replace(/^["'](.*)["']$/,"$1"),"stripQuotes"),d=new Set(u.map(f)),h;if(d.has(f(c)))h=u;else{let y=`"${f(c)}"`;h=[...u,y]}let p=this.frontmatterService.updateProperty(s,e.targetProperty,h);return await this.fileWriter.updateFile(r,p),{success:!0}}async executePropertyIncrement(e,t){if(!e.targetProperty)return{success:!1,error:"property_increment requires targetProperty"};let r=e.incrementBy??1;if(!Number.isFinite(r)||!Number.isInteger(r))return{success:!1,error:`property_increment: incrementBy must be an integer (got ${String(e.incrementBy)})`};let i=await this.fileReader.readFile(t),a=(this.frontmatterService.parseObject(i)??{})[e.targetProperty],c;if(a==null||a==="")c=0;else{if(Array.isArray(a))return{success:!1,error:`property_increment: targetProperty "${e.targetProperty}" is an array, expected integer`};{let f=String(a).replace(/^["'](.*)["']$/,"$1").trim();if(!/^-?\d+$/.test(f))return{success:!1,error:`property_increment: targetProperty "${e.targetProperty}" current value "${String(a)}" is not a valid integer`};c=Number.parseInt(f,10)}}let l=c+r,u=this.frontmatterService.updateProperty(i,e.targetProperty,l);return await this.fileWriter.updateFile(t,u),{success:!0}}async executePropertyShift(e,t){if(!e.targetProperty)return{success:!1,error:"property_shift requires targetProperty"};if(!e.shiftDelta)return{success:!1,error:"property_shift requires shiftDelta (ISO-8601 duration literal)"};let r=await this.fileReader.readFile(t),s=(this.frontmatterService.parseObject(r)??{})[e.targetProperty];if(s==null||s==="")return{success:!1,error:`property_shift: targetProperty "${e.targetProperty}" is not set on target asset`};if(Array.isArray(s))return{success:!1,error:`property_shift: targetProperty "${e.targetProperty}" is an array, expected single datetime`};let a=String(s).replace(/^["'](.*)["']$/,"$1").trim(),c=new Date(a);if(Number.isNaN(c.getTime()))return{success:!1,error:`property_shift: current value "${a}" is not a valid datetime`};let l;try{l=Pa.applyIsoDuration(c,e.shiftDelta)}catch(d){return{success:!1,error:`property_shift: invalid shiftDelta "${e.shiftDelta}": ${d instanceof Error?d.message:String(d)}`}}let u=P1.DateFormatter.toLocalTimestamp(l),f=this.frontmatterService.updateProperty(r,e.targetProperty,u);return await this.fileWriter.updateFile(t,f),{success:!0}}static applyIsoDuration(e,t){let r=t.trim();if(/^-?P(\d+Y)(\d+M)?$|^-?P\d+M$/.test(r)){let a=sA.DateTimeParsing.parseYearMonthDuration(r),c=new Date(e.getTime());return c.setMonth(c.getMonth()+a),c}let s=sA.DateTimeParsing.parseDayTimeDuration(r);return new Date(e.getTime()+s)}static extractBacklinkTarget(e,t){let r=Pa.resolveTargetPath(e,t),i=r.split("/").pop()??r;return Pa.UUID_BASENAME_RE.test(i)?i:r}static resolveTargetPath(e,t){if(t)return t.replace(/\.md$/i,"").replace(/^\/+/,"");if(e){let r=e.match(/^obsidian:\/\/vault\/(.+?)(?:\.md)?(?:\?|#|$)/i);if(r&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}}return e}};gi.GroundingExecutor=Uu;Uu.CREATE_INSTANCE_BLACKLIST=new Set(["exo__Asset_uid","exo__Asset_createdAt","exo__Asset_updatedAt","exo__Instance_class","exo__Asset_label","aliases","ems__Effort_status","ems__Effort_startTimestamp","ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp","ems__Effort_area","exo__Asset_relates"]);Uu.UUID_BASENAME_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;gi.GroundingExecutor=Uu=Pa=G9([(0,H9.injectable)(),z9("design:paramtypes",[Object,Object,wp,Function,Object])],Uu)});var lA=b(zs=>{"use strict";var e5=zs&&zs.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},t5=zs&&zs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},F1;Object.defineProperty(zs,"__esModule",{value:!0});zs.CommandExecutionFlow=void 0;var r5=Ce(),n5=uo(),i5=Ee(),s5=Me(),a5=ir(),o5=Rn(),D1=F1=class{static{o(this,"CommandExecutionFlow")}constructor(e,t,r,i,s,a){this.groundingExecutor=e,this.notificationService=t,this.logger=r,this.prompts=i,this.tripleStore=s,this.fileOpener=a}async run(e,t){let{command:r}=e;if(r.confirmMessage&&!await this.prompts.confirm(r.confirmMessage))return;let i=t.injectedUserInput,s=F1.extractInputSchema(e);if(s!==null&&s.length>0){let l=await this.applyLabelDatePrefill(s,r.grounding,t.targetIRI),u=await this.prompts.promptInputSchema(l);if(u===null)return;i={...t.injectedUserInput??{},...u}}let a=await this.groundingExecutor.execute(r.grounding,t.targetIRI??"",t.filePath??"",i),c=t.filePath??"<no-file>";if(a.success){if(r.successMessage&&this.notificationService.success(r.successMessage),await new Promise(l=>setTimeout(l,100)),t.onComplete&&await t.onComplete(),a.openPath&&this.fileOpener)try{await this.fileOpener.open(a.openPath)}catch(l){this.logger.info(`[CommandExecutionFlow] Failed to open created file "${a.openPath}": ${l instanceof Error?l.message:String(l)}`)}this.logger.info(`[CommandExecutionFlow] Executed "${r.name}" on ${c}`)}else this.notificationService.error(`Command failed: ${a.error??"unknown error"}`),this.logger.info(`[CommandExecutionFlow] Failed "${r.name}": ${a.error}`)}static extractInputSchema(e){let r=e.command.grounding.inputSchema;return!r||!Array.isArray(r)?null:r}async applyLabelDatePrefill(e,t,r){if(t.type!==n5.GroundingType.CREATE_INSTANCE||!t.prefillLabelWithDate||!r||!this.tripleStore)return e;let i=await this.resolveAssetLabel(r);if(!i)return e;let s=o5.DateFormatter.toDateString(new Date),a=`${i} ${s}`;return e.map(c=>{if(typeof c!="object"||c===null)return c;let l=c;if(l.name!=="label")return c;let u=l.defaultValue;return typeof u=="string"&&u.length>0?c:{...l,defaultValue:a}})}async resolveAssetLabel(e){if(!this.tripleStore)return;let t=new i5.IRI(e),r=await this.tripleStore.match(t,a5.Namespace.EXO.term("Asset_label"),void 0);if(r.length===0)return;let i=r[0].object;if(i instanceof s5.Literal)return i.value.length>0?i.value:void 0}};zs.CommandExecutionFlow=D1;zs.CommandExecutionFlow=D1=F1=e5([(0,r5.injectable)(),t5("design:paramtypes",[Function,Object,Object,Object,Object,Object])],D1)});var qu=b(Hs=>{"use strict";var c5=Hs&&Hs.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},l5=Hs&&Hs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.WorkflowEngine=void 0;var u5=Ce(),N1=class{static{o(this,"WorkflowEngine")}constructor(e){this.definition=e}getAvailableTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&!t.isRollback)}getRollbackTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&t.isRollback)}getAllTransitions(e){return this.definition.transitions.filter(t=>t.from===e)}canTransition(e,t){return this.definition.transitions.some(r=>r.from===e&&r.to===t)}getPreviousStatus(e){return this.definition.transitions.find(r=>r.from===e&&r.isRollback)?.to??null}getNextStates(e){return this.getAvailableTransitions(e).map(t=>t.to)}isTerminalState(e){return this.definition.terminalStates.includes(e)}isInitialState(e){return this.definition.initialState===e}getTimestampsForStatus(e){return this.definition.states.find(r=>r.status===e)?.timestampOnEnter??[]}getTransition(e,t){return this.definition.transitions.find(r=>r.from===e&&r.to===t)}getOrderedStates(){return this.definition.states.map(e=>e.status)}getDefinition(){return this.definition}validate(){let e=[],t=new Set(this.definition.states.map(i=>i.status));this.definition.states.length===0&&e.push("Workflow must have at least one state"),t.has(this.definition.initialState)||e.push(`Initial state "${this.definition.initialState}" is not in the states list`);for(let i of this.definition.terminalStates)t.has(i)||e.push(`Terminal state "${i}" is not in the states list`);for(let i of this.definition.transitions)t.has(i.from)||e.push(`Transition "${i.label}" references unknown source state "${i.from}"`),t.has(i.to)||e.push(`Transition "${i.label}" references unknown target state "${i.to}"`);for(let i of this.definition.states){if(this.definition.terminalStates.includes(i.status))continue;this.definition.transitions.filter(a=>a.from===i.status&&!a.isRollback).length===0&&e.push(`State "${i.status}" has no outgoing forward transitions (dead end)`)}let r=new Set;for(let i of this.definition.transitions){let s=`${i.from}\u2192${i.to}`;r.has(s)&&e.push(`Duplicate transition: ${s}`),r.add(s)}return{valid:e.length===0,errors:e}}};Hs.WorkflowEngine=N1;Hs.WorkflowEngine=N1=c5([(0,u5.injectable)(),l5("design:paramtypes",[Object])],N1)});var uA=b(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.EFFORT_WORKFLOW_PROPERTY=cs.WorkflowTransitionProperty=cs.WorkflowStateProperty=cs.WorkflowProperty=void 0;cs.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};cs.WorkflowStateProperty={WORKFLOW:"ems__WorkflowState_workflow",STATUS:"ems__WorkflowState_status",ORDER:"ems__WorkflowState_order",OPTIONAL:"ems__WorkflowState_optional",TIMESTAMP_ON_ENTER:"ems__WorkflowState_timestampOnEnter",BADGE_COLOR:"ems__WorkflowState_badgeColor"};cs.WorkflowTransitionProperty={WORKFLOW:"ems__WorkflowTransition_workflow",FROM:"ems__WorkflowTransition_from",TO:"ems__WorkflowTransition_to",LABEL:"ems__WorkflowTransition_label",ICON:"ems__WorkflowTransition_icon",IS_ROLLBACK:"ems__WorkflowTransition_isRollback"};cs.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var Qs=b(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});vp.MetadataHelpers=void 0;var L1=class{static{o(this,"MetadataHelpers")}static findAllReferencingProperties(e,t){let r=[];for(let[i,s]of Object.entries(e))this.containsReference(s,t)&&r.push(i);return r}static findReferencingProperty(e,t){for(let[r,i]of Object.entries(e))if(this.containsReference(i,t))return r}static containsReference(e,t){if(!e)return!1;let r=t.replace(/\.md$/,"");if(typeof e=="string"){let i=/\[\[([^\[\]]+)\]\]/g,s;for(;(s=i.exec(e))!==null;){let c=s[1].split("|")[0].trim();if(c===r||c.endsWith(`/${r}`))return!0}return!1}return Array.isArray(e)?e.some(i=>this.containsReference(i,t)):!1}static isAssetArchived(e){let t=e?.exo__Asset_isArchived;if(t!=null){if(t===!0||t===1)return!0;if(typeof t=="string"){let i=t.toLowerCase().trim();if(i==="true"||i==="yes"||i==="1")return!0}if(typeof t=="boolean")return t}let r=e?.archived;if(r==null)return!1;if(typeof r=="boolean")return r;if(typeof r=="number")return r!==0;if(typeof r=="string"){let i=r.toLowerCase().trim();return i==="true"||i==="yes"||i==="1"}return!1}static getPropertyValue(e,t){return t==="Name"||t==="title"?e.title:t==="created"?e.created:t==="modified"?e.modified:t==="path"?e.path:e.metadata?.[t]}static ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}static buildFileContent(e,t){let r=Object.entries(e).map(([a,c])=>{if(Array.isArray(c)){let l=c.map(u=>` - ${u}`).join(`
|
|
91
|
+
Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`)}}};Sp.LoggingService=Bu;Bu.isVerbose=!1;Bu.isDevelopment=void 0});var cA=b(gi=>{"use strict";var G9=gi&&gi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},z9=gi&&gi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Pa;Object.defineProperty(gi,"__esModule",{value:!0});gi.GroundingExecutor=gi.ServiceRegistry=void 0;var H9=Ce(),Q9=ju(),K9=yp(),os=uo(),Y9=as(),P1=Rn(),sA=Fu(),X9=Oa();function J9(n){if(!n)return;let e=n.match(/^"?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]"?$/);return e?e[1]:n}o(J9,"extractClassFromTargetValue");var aA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Z9=/^__SUBSTITUTE__(target|targetFolder)__[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}__$/,wp=class{static{o(this,"ServiceRegistry")}constructor(){this.services=new Map}register(e,t){this.services.set(e,t)}get(e){return this.services.get(e)}has(e){return this.services.has(e)}getRegisteredIds(){return Array.from(this.services.keys())}};gi.ServiceRegistry=wp;var oA=20,Uu=Pa=class{static{o(this,"GroundingExecutor")}constructor(e,t,r,i,s){this.frontmatterService=new Y9.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r,this.classLabelToUid=i,this.clock=s?.clock??(0,Q9.liveClock)(),this.uidGen=s?.uidGenerator??(0,K9.liveUidGenerator)()}async execute(e,t,r,i){try{switch(e.type){case os.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case os.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case os.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case os.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case os.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,r,i);case os.GroundingType.PROPERTY_APPEND:return await this.executePropertyAppend(e,t,r,i);case os.GroundingType.PROPERTY_INCREMENT:return await this.executePropertyIncrement(e,r);case os.GroundingType.PROPERTY_SHIFT:return await this.executePropertyShift(e,r);case os.GroundingType.SPARQL_UPDATE:return{success:!1,error:"sparql_update grounding not yet implemented. Use property_set/property_delete instead."};default:return{success:!1,error:`Unknown grounding type: ${e.type}`}}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}async executePropertySet(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_set requires targetProperty"};let s;if([e.targetValueRef!==void 0,e.targetValueLiteral!==void 0,e.targetValueSubstitution!==void 0].filter(Boolean).length>1)return{success:!1,error:"property_set: more than one of targetValueRef/targetValueLiteral/targetValueSubstitution set (cardinality 0..1 each, mutually exclusive)"};if(e.targetValueRef!==void 0)s=`"[[${e.targetValueRef}]]"`;else if(e.targetValueLiteral!==void 0)s=e.targetValueLiteral;else if(e.targetValueSubstitution!==void 0)s=e.targetValueSubstitution;else return{success:!1,error:"property_set requires one of targetValueRef/targetValueLiteral/targetValueSubstitution"};if(/\$(input|value)\b/.test(s)&&(i===void 0||i.value===void 0||i.value===null))return{success:!1,error:"property_set: substituted value contains $input/$value placeholder but no userInput.value provided"};let l=this.substituteVariables(s,t,i),u=await this.fileReader.readFile(r),f=this.frontmatterService.updateProperty(u,e.targetProperty,l);return await this.fileWriter.updateFile(r,f),{success:!0}}async executePropertyDelete(e,t){if(!e.targetProperty)return{success:!1,error:"property_delete requires targetProperty"};let r=await this.fileReader.readFile(t),i=this.frontmatterService.removeProperty(r,e.targetProperty);return await this.fileWriter.updateFile(t,i),{success:!0}}async executeComposite(e,t,r,i,s){if(s>=oA)return{success:!1,error:`Composite grounding exceeded maximum depth of ${oA}`};let a=e.steps??[];if(a.length===0)return{success:!0};let c;try{c=await this.fileReader.readFile(r)}catch{}let l=[];try{for(let u=0;u<a.length;u++){let f=a[u],d=await this.executeStep(f,t,r,i,s+1);if(!d.success)return await this.rollback(c,r,l),{success:!1,error:`Composite step ${u} failed: ${d.error}`};l.push(u)}return{success:!0}}catch(u){return await this.rollback(c,r,l),{success:!1,error:`Composite execution failed: ${u instanceof Error?u.message:String(u)}`}}}async executeServiceCall(e,t,r,i){let s=e.targetProperty;if(!s)return{success:!1,error:"service_call requires targetProperty as serviceId"};if(s==="convertToTask")return await this.executeConvertToTask(r);if(s==="updateProperty"){let l=J9(e.targetValue);if(l==="ems__Task")return await this.executeConvertToTask(r);if(l==="ems__Project")return await this.executeConvertToProject(r)}let a=this.serviceRegistry.get(s);if(!a)return{success:!1,error:`Service not found: "${s}". Registered services: ${this.serviceRegistry.getRegisteredIds().join(", ")||"none"}`};let c=i;if(e.isDefinedBy&&(c={isDefinedBy:e.isDefinedBy,...c??{}}),e.targetValue)try{let l=this.substituteVariables(e.targetValue,t,i),u=JSON.parse(l);typeof u=="object"&&u!==null&&(c={...u,...c??{}})}catch{}return await a.execute(t,c),{success:!0}}async executeConvertToTask(e){let t=await this.fileReader.readFile(e),r=await this.resolveClassRefToUid("ems__Task"),i=this.frontmatterService.updateProperty(t,"exo__Instance_class",`["[[${r}]]"]`);return await this.fileWriter.updateFile(e,i),{success:!0}}async executeConvertToProject(e){let t=await this.fileReader.readFile(e),r=await this.resolveClassRefToUid("ems__Project"),i=this.frontmatterService.updateProperty(t,"exo__Instance_class",`["[[${r}]]"]`);return await this.fileWriter.updateFile(e,i),{success:!0}}async executeCreateInstance(e,t,r,i){if(!e.targetFolder)return{success:!1,error:"create_instance requires targetFolder"};let s=this.uidGen.next(),a=i?.label??"Untitled",c={exo__Asset_uid:s,exo__Asset_createdAt:P1.DateFormatter.toLocalTimestamp(this.clock.now()),exo__Asset_label:a};if(a!=="Untitled"&&(c.aliases=[a]),e.targetClass){let h=await this.resolveClassRefToUid(e.targetClass);c.exo__Instance_class=[`"[[${h}]]"`]}if(e.propertyDefault&&e.propertyDefault.length>0&&this.applyPropertyDefaultStep(c,e.propertyDefault,t,r),i)for(let[h,p]of Object.entries(i))h!=="label"&&p!=null&&(c[h]=p);let l=null;if(t&&r){let h;try{h=await this.fileReader.readFile(r)}catch(p){return{success:!1,error:`create_instance: failed to read $target file "${r}": ${p instanceof Error?p.message:String(p)}`}}l=this.frontmatterService.parseObject(h)??null}if(e.inheritanceRule&&e.inheritanceRule.length>0&&l&&await this.applyInheritanceRuleStep(c,e.inheritanceRule,l),l)for(let[h,p]of Object.entries(l))Pa.CREATE_INSTANCE_BLACKLIST.has(h)||c[h]===void 0&&(c[h]=this.reformatCopiedValue(p));if(t){let h=e.linkBackProperty??"exo__Asset_prototype",p=Pa.extractBacklinkTarget(t,r);c[h]=`"[[${p}]]"`}let u=this.frontmatterService.createFrontmatter("",c),f=this.substituteVariables(e.targetFolder,t,i,void 0,r),d=f?`${f}/${s}.md`:`${s}.md`;return await this.fileWriter.createFile(d,u),{success:!0,openPath:d}}async resolveClassRefToUid(e){if(aA.test(e)||!this.classLabelToUid)return e;try{let t=await this.classLabelToUid(e);return t&&t.length>0?t:e}catch{return e}}applyPropertyDefaultStep(e,t,r,i){for(let{propertyName:s,value:a}of t)e[s]===void 0&&(e[s]=this.resolveSubstitutionMarker(a,r,i))}resolveSubstitutionMarker(e,t,r){let i=e.match(Z9);if(!i)return e;let s=i[1];if(s==="target")return`"[[${Pa.extractBacklinkTarget(t,r)}]]"`;if(s==="targetFolder"){if(!r)return"";let a=r.replace(/^\/+/,""),c=a.lastIndexOf("/");return c>=0?a.slice(0,c):""}return e}async applyInheritanceRuleStep(e,t,r){let i=this.extractTargetClassNames(r),s=[];for(let a of t)!await this.inheritanceConditionMatches(a.targetClassCondition,i)||await this.inheritanceExclusionMatches(a.targetClassExclusion,i)||s.push(a);s.sort((a,c)=>c.priority-a.priority);for(let a of s){if(e[a.targetPropertyName]!==void 0)continue;let c=r[a.sourcePropertyName];c!=null&&(e[a.targetPropertyName]=this.formatInheritedValue(c))}}async inheritanceConditionMatches(e,t){return e?this.classMatchesAny(e,t):!0}async inheritanceExclusionMatches(e,t){for(let r of e)if(await this.classMatchesAny(r,t))return!0;return!1}async classMatchesAny(e,t){if(t.includes(e))return!0;if(!this.classLabelToUid)return!1;try{let r=await this.classLabelToUid(e);if(r&&r.length>0&&t.includes(r))return!0}catch{}return!1}extractTargetClassNames(e){let t=e.exo__Instance_class;if(t==null)return[];let r=Array.isArray(t)?t:[t],i=[];for(let s of r){let a=this.extractWikilinkInner(String(s));a&&i.push(a)}return i}extractWikilinkInner(e){let t=e.match(/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/);return t?t[1].trim():e.replace(/^["']|["']$/g,"").trim()}formatInheritedValue(e){return Array.isArray(e)?e.map(t=>this.formatInheritedScalar(String(t))):this.formatInheritedScalar(String(e))}formatInheritedScalar(e){return/^"?\[\[.+\]\]"?$/.test(e)?this.reformatWikilink(e):aA.test(e)?`"[[${e}]]"`:e}reformatCopiedValue(e){return Array.isArray(e)?e.map(t=>this.reformatWikilink(t)):this.reformatWikilink(e)}reformatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:e}async executeStep(e,t,r,i,s){return e.type===os.GroundingType.COMPOSITE?this.executeComposite(e,t,r,i,s):this.execute(e,t,r,i)}async rollback(e,t,r){if(e!==void 0)try{await this.fileWriter.updateFile(t,e)}catch(i){X9.LoggingService.error(`[GroundingExecutor] Rollback failed for ${t}`,i instanceof Error?i:new Error(String(i)))}}substituteVariables(e,t,r,i,s){let a=this.clock.now(),c=a.toISOString(),l=P1.DateFormatter.toLocalTimestamp(a),u=c.slice(0,10),f=`${u}T00:00:00`,d=e.replace(/\$target\.([A-Za-z_][\w]*)/g,(h,p)=>{if(!i)throw new Error(`$target.${p} substitution requires target frontmatter context; none was supplied (asset IRI: ${t})`);let y=i[p];if(y==null)throw new Error(`$target.${p} is undefined on asset ${t}`);if(Array.isArray(y))throw new Error(`$target.${p} resolved to an array on asset ${t}; only scalar properties are supported for substitution`);return String(y).replace(/^["'](.*)["']$/,"$1")});if(/\$targetFolder\b/.test(d)){if(!s)throw new Error("$targetFolder substitution requires targetFilePath context; none was supplied (asset IRI: "+t+")");let h=s.replace(/^\/+/,""),p=h.lastIndexOf("/"),y=p>=0?h.slice(0,p):"";d=d.replace(/\$targetFolder\b/g,y)}if(d=d.replace(/\$target/g,t).replace(/\$nowLocal/g,l).replace(/\$now/g,c).replace(/\$todayStart\b/g,f).replace(/\$today/g,u),r?.value!==void 0&&r.value!==null){let h=String(r.value);d=d.replace(/\$input\b/g,h).replace(/\$value\b/g,h)}return d}async executePropertyAppend(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_append requires targetProperty"};if(e.targetValue===void 0)return{success:!1,error:"property_append requires targetValue"};let s=await this.fileReader.readFile(r),a=this.frontmatterService.parseObject(s)??{},c=this.substituteVariables(e.targetValue,t,i,a),l=a[e.targetProperty],u=Array.isArray(l)?l:l!==void 0?[String(l)]:[],f=o(y=>y.replace(/^["'](.*)["']$/,"$1"),"stripQuotes"),d=new Set(u.map(f)),h;if(d.has(f(c)))h=u;else{let y=`"${f(c)}"`;h=[...u,y]}let p=this.frontmatterService.updateProperty(s,e.targetProperty,h);return await this.fileWriter.updateFile(r,p),{success:!0}}async executePropertyIncrement(e,t){if(!e.targetProperty)return{success:!1,error:"property_increment requires targetProperty"};let r=e.incrementBy??1;if(!Number.isFinite(r)||!Number.isInteger(r))return{success:!1,error:`property_increment: incrementBy must be an integer (got ${String(e.incrementBy)})`};let i=await this.fileReader.readFile(t),a=(this.frontmatterService.parseObject(i)??{})[e.targetProperty],c;if(a==null||a==="")c=0;else{if(Array.isArray(a))return{success:!1,error:`property_increment: targetProperty "${e.targetProperty}" is an array, expected integer`};{let f=String(a).replace(/^["'](.*)["']$/,"$1").trim();if(!/^-?\d+$/.test(f))return{success:!1,error:`property_increment: targetProperty "${e.targetProperty}" current value "${String(a)}" is not a valid integer`};c=Number.parseInt(f,10)}}let l=c+r,u=this.frontmatterService.updateProperty(i,e.targetProperty,l);return await this.fileWriter.updateFile(t,u),{success:!0}}async executePropertyShift(e,t){if(!e.targetProperty)return{success:!1,error:"property_shift requires targetProperty"};if(!e.shiftDelta)return{success:!1,error:"property_shift requires shiftDelta (ISO-8601 duration literal)"};let r=await this.fileReader.readFile(t),s=(this.frontmatterService.parseObject(r)??{})[e.targetProperty];if(s==null||s==="")return{success:!1,error:`property_shift: targetProperty "${e.targetProperty}" is not set on target asset`};if(Array.isArray(s))return{success:!1,error:`property_shift: targetProperty "${e.targetProperty}" is an array, expected single datetime`};let a=String(s).replace(/^["'](.*)["']$/,"$1").trim(),c=new Date(a);if(Number.isNaN(c.getTime()))return{success:!1,error:`property_shift: current value "${a}" is not a valid datetime`};let l;try{l=Pa.applyIsoDuration(c,e.shiftDelta)}catch(d){return{success:!1,error:`property_shift: invalid shiftDelta "${e.shiftDelta}": ${d instanceof Error?d.message:String(d)}`}}let u=P1.DateFormatter.toLocalTimestamp(l),f=this.frontmatterService.updateProperty(r,e.targetProperty,u);return await this.fileWriter.updateFile(t,f),{success:!0}}static applyIsoDuration(e,t){let r=t.trim();if(/^-?P(\d+Y)(\d+M)?$|^-?P\d+M$/.test(r)){let a=sA.DateTimeParsing.parseYearMonthDuration(r),c=new Date(e.getTime());return c.setMonth(c.getMonth()+a),c}let s=sA.DateTimeParsing.parseDayTimeDuration(r);return new Date(e.getTime()+s)}static extractBacklinkTarget(e,t){let r=Pa.resolveTargetPath(e,t),i=r.split("/").pop()??r;return Pa.UUID_BASENAME_RE.test(i)?i:r}static resolveTargetPath(e,t){if(t)return t.replace(/\.md$/i,"").replace(/^\/+/,"");if(e){let r=e.match(/^obsidian:\/\/vault\/(.+?)(?:\.md)?(?:\?|#|$)/i);if(r&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}}return e}};gi.GroundingExecutor=Uu;Uu.CREATE_INSTANCE_BLACKLIST=new Set(["exo__Asset_uid","exo__Asset_createdAt","exo__Asset_updatedAt","exo__Instance_class","exo__Asset_label","aliases","ems__Effort_status","ems__Effort_startTimestamp","ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp","ems__Effort_area","exo__Asset_relates"]);Uu.UUID_BASENAME_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;gi.GroundingExecutor=Uu=Pa=G9([(0,H9.injectable)(),z9("design:paramtypes",[Object,Object,wp,Function,Object])],Uu)});var lA=b(zs=>{"use strict";var e5=zs&&zs.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},t5=zs&&zs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},F1;Object.defineProperty(zs,"__esModule",{value:!0});zs.CommandExecutionFlow=void 0;var r5=Ce(),n5=uo(),i5=Ee(),s5=Me(),a5=ir(),o5=Rn(),D1=F1=class{static{o(this,"CommandExecutionFlow")}constructor(e,t,r,i,s,a){this.groundingExecutor=e,this.notificationService=t,this.logger=r,this.prompts=i,this.tripleStore=s,this.fileOpener=a}async run(e,t){let{command:r}=e;if(r.confirmMessage&&!await this.prompts.confirm(r.confirmMessage))return;let i=t.injectedUserInput,s=F1.extractInputSchema(e);if(s!==null&&s.length>0){let l=await this.applyLabelDatePrefill(s,r.grounding,t.targetIRI),u=await this.prompts.promptInputSchema(l);if(u===null)return;i={...t.injectedUserInput??{},...u}}let a=await this.groundingExecutor.execute(r.grounding,t.targetIRI??"",t.filePath??"",i),c=t.filePath??"<no-file>";if(a.success){if(r.successMessage&&this.notificationService.success(r.successMessage),await new Promise(l=>setTimeout(l,100)),t.onComplete&&await t.onComplete(),a.openPath&&this.fileOpener)try{await this.fileOpener.open(a.openPath)}catch(l){this.logger.info(`[CommandExecutionFlow] Failed to open created file "${a.openPath}": ${l instanceof Error?l.message:String(l)}`)}this.logger.info(`[CommandExecutionFlow] Executed "${r.name}" on ${c}`)}else this.notificationService.error(`Command failed: ${a.error??"unknown error"}`),this.logger.info(`[CommandExecutionFlow] Failed "${r.name}": ${a.error}`)}static extractInputSchema(e){let r=e.command.grounding.inputSchema;return!r||!Array.isArray(r)?null:r}async applyLabelDatePrefill(e,t,r){if(t.type!==n5.GroundingType.CREATE_INSTANCE||!t.prefillLabelWithDate||!r||!this.tripleStore)return e;let i=await this.resolveAssetLabel(r);if(!i)return e;let s=o5.DateFormatter.toDateString(new Date),a=`${i} ${s}`;return e.map(c=>{if(typeof c!="object"||c===null)return c;let l=c;if(l.name!=="label")return c;let u=l.defaultValue;return typeof u=="string"&&u.length>0?c:{...l,defaultValue:a}})}async resolveAssetLabel(e){if(!this.tripleStore)return;let t=new i5.IRI(e),r=await this.tripleStore.match(t,a5.Namespace.EXO.term("Asset_label"),void 0);if(r.length===0)return;let i=r[0].object;if(i instanceof s5.Literal)return i.value.length>0?i.value:void 0}};zs.CommandExecutionFlow=D1;zs.CommandExecutionFlow=D1=F1=e5([(0,r5.injectable)(),t5("design:paramtypes",[Function,Object,Object,Object,Object,Object])],D1)});var qu=b(Hs=>{"use strict";var c5=Hs&&Hs.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},l5=Hs&&Hs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.WorkflowEngine=void 0;var u5=Ce(),N1=class{static{o(this,"WorkflowEngine")}constructor(e){this.definition=e}getAvailableTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&!t.isRollback)}getRollbackTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&t.isRollback)}getAllTransitions(e){return this.definition.transitions.filter(t=>t.from===e)}canTransition(e,t){return this.definition.transitions.some(r=>r.from===e&&r.to===t)}getPreviousStatus(e){return this.definition.transitions.find(r=>r.from===e&&r.isRollback)?.to??null}getNextStates(e){return this.getAvailableTransitions(e).map(t=>t.to)}isTerminalState(e){return this.definition.terminalStates.includes(e)}isInitialState(e){return this.definition.initialState===e}getTimestampsForStatus(e){return this.definition.states.find(r=>r.status===e)?.timestampOnEnter??[]}getTransition(e,t){return this.definition.transitions.find(r=>r.from===e&&r.to===t)}getOrderedStates(){return this.definition.states.map(e=>e.status)}getDefinition(){return this.definition}validate(){let e=[],t=new Set(this.definition.states.map(i=>i.status));this.definition.states.length===0&&e.push("Workflow must have at least one state"),t.has(this.definition.initialState)||e.push(`Initial state "${this.definition.initialState}" is not in the states list`);for(let i of this.definition.terminalStates)t.has(i)||e.push(`Terminal state "${i}" is not in the states list`);for(let i of this.definition.transitions)t.has(i.from)||e.push(`Transition "${i.label}" references unknown source state "${i.from}"`),t.has(i.to)||e.push(`Transition "${i.label}" references unknown target state "${i.to}"`);for(let i of this.definition.states){if(this.definition.terminalStates.includes(i.status))continue;this.definition.transitions.filter(a=>a.from===i.status&&!a.isRollback).length===0&&e.push(`State "${i.status}" has no outgoing forward transitions (dead end)`)}let r=new Set;for(let i of this.definition.transitions){let s=`${i.from}\u2192${i.to}`;r.has(s)&&e.push(`Duplicate transition: ${s}`),r.add(s)}return{valid:e.length===0,errors:e}}};Hs.WorkflowEngine=N1;Hs.WorkflowEngine=N1=c5([(0,u5.injectable)(),l5("design:paramtypes",[Object])],N1)});var uA=b(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.EFFORT_WORKFLOW_PROPERTY=cs.WorkflowTransitionProperty=cs.WorkflowStateProperty=cs.WorkflowProperty=void 0;cs.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};cs.WorkflowStateProperty={WORKFLOW:"ems__WorkflowState_workflow",STATUS:"ems__WorkflowState_status",ORDER:"ems__WorkflowState_order",OPTIONAL:"ems__WorkflowState_optional",TIMESTAMP_ON_ENTER:"ems__WorkflowState_timestampOnEnter",BADGE_COLOR:"ems__WorkflowState_badgeColor"};cs.WorkflowTransitionProperty={WORKFLOW:"ems__WorkflowTransition_workflow",FROM:"ems__WorkflowTransition_from",TO:"ems__WorkflowTransition_to",LABEL:"ems__WorkflowTransition_label",ICON:"ems__WorkflowTransition_icon",IS_ROLLBACK:"ems__WorkflowTransition_isRollback"};cs.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var Qs=b(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});vp.MetadataHelpers=void 0;var L1=class{static{o(this,"MetadataHelpers")}static findAllReferencingProperties(e,t){let r=[];for(let[i,s]of Object.entries(e))this.containsReference(s,t)&&r.push(i);return r}static findReferencingProperty(e,t){for(let[r,i]of Object.entries(e))if(this.containsReference(i,t))return r}static containsReference(e,t){if(!e)return!1;let r=t.replace(/\.md$/,"");if(typeof e=="string"){let i=/\[\[([^\[\]]+)\]\]/g,s;for(;(s=i.exec(e))!==null;){let c=s[1].split("|")[0].trim();if(c===r||c.endsWith(`/${r}`))return!0}return!1}return Array.isArray(e)?e.some(i=>this.containsReference(i,t)):!1}static isAssetArchived(e){let t=e?.exo__Asset_isArchived;if(t!=null){if(t===!0||t===1)return!0;if(typeof t=="string"){let i=t.toLowerCase().trim();if(i==="true"||i==="yes"||i==="1")return!0}if(typeof t=="boolean")return t}let r=e?.archived;if(r==null)return!1;if(typeof r=="boolean")return r;if(typeof r=="number")return r!==0;if(typeof r=="string"){let i=r.toLowerCase().trim();return i==="true"||i==="yes"||i==="1"}return!1}static getPropertyValue(e,t){return t==="Name"||t==="title"?e.title:t==="created"?e.created:t==="modified"?e.modified:t==="path"?e.path:e.metadata?.[t]}static ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}static buildFileContent(e,t){let r=Object.entries(e).map(([a,c])=>{if(Array.isArray(c)){let l=c.map(u=>` - ${u}`).join(`
|
|
92
92
|
`);return`${a}:
|
|
93
93
|
${l}`}return`${a}: ${c}`}).join(`
|
|
94
94
|
`),i=t;if(i===void 0){let a=e.exo__Asset_label;typeof a=="string"&&a.trim()!==""&&(i=`# ${a}`)}let s=i?`
|
|
@@ -368,7 +368,7 @@ LIMIT ${this.config.defaultLimit}`,s="\u041D\u0435 \u0443\u0434\u0430\u043B\u043
|
|
|
368
368
|
`,i=this.composePrefixes(t),s=this.serializePrefixes(i,r),a=this.nTriplesSerializer.serialize(e,{newline:r}).trimEnd();return s?a?`${s}${r}${r}${a}${r}`:`${s}${r}`:a?`${a}${r}`:""}serializePrefixes(e,t){let r=Object.entries(e);return r.length===0?"":r.map(([i,s])=>`@prefix ${i}: <${s}> .`).join(t)}composePrefixes(e){return e.includeDefaultPrefixes??!0?{...g8,...e.prefixes??{}}:{...e.prefixes??{}}}serializeTriplesOnly(e,t){return this.nTriplesSerializer.serializeChunk(e,t).trimEnd()}};Mp.TurtleSerializer=rS});var ox=b($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.JSONLDSerializer=void 0;var sx=Ee(),ax=$t(),y8=Me(),Zc=ir(),_8={rdf:Zc.Namespace.RDF.iri.value,rdfs:Zc.Namespace.RDFS.iri.value,owl:Zc.Namespace.OWL.iri.value,xsd:Zc.Namespace.XSD.iri.value,exo:Zc.Namespace.EXO.iri.value,ems:Zc.Namespace.EMS.iri.value},nS=class{static{o(this,"JSONLDSerializer")}toDocument(e,t={}){let r={..._8,...t.context??{}},i=new Map;for(let s of e){let a=this.subjectToId(s.subject),c=this.compactIri(s.predicate.value,r),l=this.objectToJSONLD(s.object,r),u=i.get(a)??{"@id":a},f=u[c];f===void 0?u[c]=l:Array.isArray(f)?f.push(l):u[c]=[f,l],i.set(a,u)}return{"@context":r,"@graph":Array.from(i.values())}}serialize(e,t={}){let r=this.toDocument(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}subjectToId(e){return e instanceof sx.IRI?e.value:e instanceof ax.BlankNode?`_:${e.id}`:String(e)}compactIri(e,t){for(let[r,i]of Object.entries(t))if(e.startsWith(i)){let s=e.slice(i.length);if(s.length>0)return`${r}:${s}`}return e}objectToJSONLD(e,t){if(e instanceof sx.IRI)return{"@id":e.value};if(e instanceof ax.BlankNode)return{"@id":`_:${e.id}`};if(e instanceof y8.Literal){let r={"@value":e.value};return e.datatype?r["@type"]=this.compactIri(e.datatype.value,t):e.language&&(r["@language"]=e.language,e.hasDirection()&&e.direction&&(r["@direction"]=e.direction)),r}return e}};$p.JSONLDSerializer=nS});var aS=b(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});Vp.NTriplesParser=void 0;var b8=Yn(),cx=Ee(),iS=Me(),S8=$t(),el=ir(),w8={rdf:el.Namespace.RDF.iri.value,rdfs:el.Namespace.RDFS.iri.value,owl:el.Namespace.OWL.iri.value,xsd:el.Namespace.XSD.iri.value,exo:el.Namespace.EXO.iri.value,ems:el.Namespace.EMS.iri.value},sS=class{static{o(this,"NTriplesParser")}parse(e,t={}){let r={prefixes:{...w8,...t.prefixes??{}},strict:t.strict??!1},i=[];return e.split(/\r?\n/).forEach((a,c)=>{let l=a.trim();!l||l.startsWith("#")||i.push(this.parseLine(l,c+1,r))}),i}parseLine(e,t,r){if(!e.endsWith("."))throw new Error(`Invalid RDF statement at line ${t}: missing '.' terminator`);let s=e.slice(0,-1).trim(),a=this.parseSubject(s,t,r);s=a.rest.trim();let c=this.parsePredicate(s,t,r);s=c.rest.trim();let l=this.parseObject(s,t,r);if(s=l.rest.trim(),s.length>0)throw new Error(`Unexpected tokens after object at line ${t}`);return new b8.Triple(a.node,c.node,l.node)}parseSubject(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):e.startsWith("_:")?this.consumeBlankNode(e,t):this.consumePrefixedName(e,t,r)}parsePredicate(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):this.consumePrefixedName(e,t,r)}parseObject(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):e.startsWith("_:")?this.consumeBlankNode(e,t):e.startsWith('"')?this.consumeLiteral(e,t,r):this.consumePrefixedName(e,t,r)}consumePrefixedName(e,t,r){let i=e.match(/^([a-zA-Z_][\w-]*):([^\s]+)(?:\s+(.*))?$/);if(!i)throw new Error(`Invalid token at line ${t}: ${e}`);let[,s,a,c]=i,l=r.prefixes[s];if(!l)throw new Error(`Unknown prefix "${s}" at line ${t}`);return{node:new cx.IRI(`${l}${a}`),rest:(c??"").trimStart()}}consumeIRI(e,t,r){let i=this.findClosingBracket(e,"<",">");if(i===-1)throw new Error(`Invalid IRI at line ${t}`);let s=e.slice(1,i),a=new cx.IRI(s),c=e.slice(i+1).trimStart();return{node:a,rest:c}}consumeBlankNode(e,t){let r=e.match(/^_:(\w+)(?:\s+(.*))?$/);if(!r)throw new Error(`Invalid blank node identifier at line ${t}`);let[,i,s]=r;return{node:new S8.BlankNode(i),rest:(s??"").trimStart()}}consumeLiteral(e,t,r){let{value:i,rest:s}=this.consumeQuotedString(e,t),a=s.trimStart();if(a.startsWith("^^")){a=a.slice(2).trimStart();let c=a.startsWith("<")?this.consumeIRI(a,t,r):this.consumePrefixedName(a,t,r);return{node:new iS.Literal(i,c.node),rest:c.rest}}if(a.startsWith("@")){let c=a.match(/^@([a-zA-Z-]+)(?:\s+(.*))?$/);if(!c)throw new Error(`Invalid language tag at line ${t}`);let[,l,u]=c;return{node:new iS.Literal(i,void 0,l),rest:(u??"").trimStart()}}return{node:new iS.Literal(i),rest:a}}consumeQuotedString(e,t){if(!e.startsWith('"'))throw new Error(`Expected quoted string at line ${t}`);let r="";for(let i=1;i<e.length;i++){let s=e[i];if(s==="\\"){if(i+1>=e.length)throw new Error(`Invalid escape sequence at line ${t}`);let a=e[i+1];switch(a){case"t":r+=" ",i+=1;break;case"b":r+="\b",i+=1;break;case"n":r+=`
|
|
369
369
|
`,i+=1;break;case"r":r+="\r",i+=1;break;case"f":r+="\f",i+=1;break;case'"':r+='"',i+=1;break;case"\\":r+="\\",i+=1;break;case"u":{let c=e.slice(i+2,i+6);if(c.length!==4||!/^[0-9a-fA-F]{4}$/.test(c))throw new Error(`Invalid \\u escape at line ${t}`);r+=String.fromCharCode(parseInt(c,16)),i+=5;break}case"U":{let c=e.slice(i+2,i+10);if(c.length!==8||!/^[0-9a-fA-F]{8}$/.test(c))throw new Error(`Invalid \\U escape at line ${t}`);r+=String.fromCodePoint(parseInt(c,16)),i+=9;break}default:throw new Error(`Unknown escape sequence \\${a} at line ${t}`)}continue}if(s==='"'){let a=e.slice(i+1);return{value:r,rest:a}}r+=s}throw new Error(`Unterminated string literal at line ${t}`)}findClosingBracket(e,t,r){let i=0;for(let s=0;s<e.length;s++){let a=e[s];if(a===t){i++;continue}if(a===r&&(i--,i===0))return s}return-1}};Vp.NTriplesParser=sS});var lx=b(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});Bp.TurtleParser=void 0;var tl=ir(),v8=aS(),E8={rdf:tl.Namespace.RDF.iri.value,rdfs:tl.Namespace.RDFS.iri.value,owl:tl.Namespace.OWL.iri.value,xsd:tl.Namespace.XSD.iri.value,exo:tl.Namespace.EXO.iri.value,ems:tl.Namespace.EMS.iri.value},T8=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,oS=class{static{o(this,"TurtleParser")}constructor(){this.nTriplesParser=new v8.NTriplesParser}parse(e,t={}){let r={...E8,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:a,lineNumber:c})=>{if(this.isPrefixStatement(a)){let u=a.match(T8);if(!u)throw new Error(`Invalid prefix declaration at line ${c}`);let[,f,d]=u;r[f]=d;return}if(a.includes(";")||a.includes(","))throw new Error(`Complex Turtle statements with ';' or ',' are not supported (line ${c})`);let l=this.normalizeShortcuts(a);s.push(this.nTriplesParser.parseLine(l,c,{prefixes:r,strict:!1}))}),s}collectStatements(e){let t=e.split(/\r?\n/),r=[],i="",s=0;if(t.forEach((a,c)=>{let l=a.trim();!l||l.startsWith("#")||(i||(s=c+1),i=i?`${i} ${l}`:l,l.endsWith(".")&&(r.push({statement:i,lineNumber:s}),i=""))}),i)throw new Error(`Unterminated Turtle statement near line ${s}`);return r}isPrefixStatement(e){return e.startsWith("@prefix")}normalizeShortcuts(e){return e.includes(" a ")?e.replace(/\sa\s/g," rdf:type "):e}};Bp.TurtleParser=oS});var ux=b(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});Up.RDFSerializer=void 0;var rl=Yn(),Lo=Ee(),ko=Me(),cS=$t(),ds=ir(),A8=ix(),x8=tS(),I8=ox(),C8=lx(),R8=aS(),O8=1024,P8=`
|
|
370
370
|
`,F8={rdf:ds.Namespace.RDF.iri.value,rdfs:ds.Namespace.RDFS.iri.value,owl:ds.Namespace.OWL.iri.value,xsd:ds.Namespace.XSD.iri.value,exo:ds.Namespace.EXO.iri.value,ems:ds.Namespace.EMS.iri.value},lS=class{static{o(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new A8.TurtleSerializer,this.nTriplesSerializer=new x8.NTriplesSerializer,this.jsonldSerializer=new I8.JSONLDSerializer,this.turtleParser=new C8.TurtleParser,this.nTriplesParser=new R8.NTriplesParser}async serialize(e,t={}){let r=await this.store.match();return this.serializeTriples(r,e,t)}serializeTriples(e,t,r={}){switch(t){case"turtle":return this.turtleSerializer.serialize(e,{prefixes:r.prefixes,includeDefaultPrefixes:r.includeDefaultPrefixes,newline:r.newline});case"n-triples":return this.nTriplesSerializer.serialize(e,{newline:r.newline});case"json-ld":return this.jsonldSerializer.serialize(e,{context:r.prefixes,pretty:r.pretty,indent:r.indent});default:throw new Error(`Unsupported serialization format: ${t}`)}}stream(e,t={}){let r=t.newline??P8,i=t.batchSize??O8,s=t.includeDefaultPrefixes,a=t.prefixes,c=this,l=!1,u=[],f=[],d=0,h=o(async()=>{if(!l){if(f=await c.store.match(),e==="json-ld"){let y=c.jsonldSerializer.toDocument(f,{context:a,pretty:!1});u.push(...c.buildJsonLdChunks(y))}else if(e==="turtle"){let y=c.turtleSerializer.serializePrefixes(c.composePrefixes(a,s),r);y&&u.push(`${y}${r}${r}`)}l=!0}},"ensureInitialized");return{async next(){if(await h(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(d>=f.length)return{value:void 0,done:!0};let y=f.slice(d,d+i);d+=y.length;let S="";if(e==="turtle"){let v=c.turtleSerializer.serializeTriplesOnly(y,r);v&&(S=`${v}${r}`)}else e==="n-triples"&&(S=c.nTriplesSerializer.serializeChunk(y,r));return S?{value:S,done:!1}:this.next()},async return(){return u=[],f=[],d=0,{value:void 0,done:!0}},[Symbol.asyncIterator](){return this}}}async load(e,t,r={}){let i=this.parse(e,t,r);return r.mode!=="append"&&await this.store.clear(),await this.store.addAll(i),i.length}parse(e,t,r={}){switch(t){case"turtle":return this.turtleParser.parse(e,this.buildTurtleParseOptions(r));case"n-triples":return this.nTriplesParser.parse(e,this.buildNTriplesParseOptions(r));case"json-ld":return this.parseJsonLd(e,r);default:throw new Error(`Unsupported serialization format: ${t}`)}}buildTurtleParseOptions(e){return{prefixes:this.composePrefixes(e.prefixes,!0),strict:e.strict}}buildNTriplesParseOptions(e){return{prefixes:this.composePrefixes(e.prefixes,!0),strict:e.strict}}composePrefixes(e,t){return t??!0?{...F8,...e??{}}:{...e??{}}}parseJsonLd(e,t){let r;try{r=JSON.parse(e)}catch(u){throw new Error(`Invalid JSON-LD document: ${u.message}`)}let i=this.composePrefixes(t.prefixes,!0),s=this.extractContext(r),a={...i,...s},c=this.extractGraph(r),l=[];return c.forEach((u,f)=>{if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`Invalid JSON-LD node at index ${f}`);let d=this.parseSubjectFromNode(u,a,f),h=Object.entries(u);for(let[p,y]of h){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(d,y,l,a);continue}let S=this.expandTerm(p,a),v=new Lo.IRI(S);this.collectTriplesForValue(d,v,y,l,a)}}),l}extractContext(e){if(!e||typeof e!="object"||Array.isArray(e))return{};let t=e["@context"];if(!t||typeof t!="object"||Array.isArray(t))return{};let r={};return Object.entries(t).forEach(([i,s])=>{typeof s=="string"&&(r[i]=s)}),r}extractGraph(e){if(Array.isArray(e))return e;if(!e||typeof e!="object")return[];let t=e["@graph"];return Array.isArray(t)?t:[e]}parseSubjectFromNode(e,t,r){let i=e["@id"];if(typeof i=="string"){if(i.startsWith("_:"))return new cS.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new Lo.IRI(i);let s=this.expandTerm(i,t);return new Lo.IRI(s)}return new cS.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=ds.Namespace.RDF.term("type");(Array.isArray(t)?t:[t]).forEach(c=>{if(typeof c!="string")throw new Error("Invalid @type value in JSON-LD node");let l=this.expandTerm(c,i);r.push(new rl.Triple(e,s,new Lo.IRI(l)))})}collectTriplesForValue(e,t,r,i,s){if(r!=null){if(Array.isArray(r)){r.forEach(a=>this.collectTriplesForValue(e,t,a,i,s));return}if(typeof r=="object"){let a=r;if(typeof a["@id"]=="string"){let c=this.parseIdNode(a["@id"],s);i.push(new rl.Triple(e,t,c));return}if(a["@value"]!==void 0){let c=this.parseLiteralObject(a,s);i.push(new rl.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new rl.Triple(e,t,new ko.Literal(r)));return}if(typeof r=="number"){let a=Number.isInteger(r)?ds.Namespace.XSD.term("integer"):ds.Namespace.XSD.term("decimal");i.push(new rl.Triple(e,t,new ko.Literal(r.toString(),a)));return}if(typeof r=="boolean"){let a=ds.Namespace.XSD.term("boolean");i.push(new rl.Triple(e,t,new ko.Literal(r.toString(),a)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new cS.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new Lo.IRI(e);let r=this.expandTerm(e,t);return new Lo.IRI(r)}parseLiteralObject(e,t){let r=e["@value"];if(typeof r!="string")throw new Error("JSON-LD literal values must be strings");if(typeof e["@language"]=="string"){let i=e["@direction"];return i==="ltr"||i==="rtl"?new ko.Literal(r,void 0,e["@language"],i):new ko.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new ko.Literal(r,new Lo.IRI(i))}return new ko.Literal(r)}expandTerm(e,t){if(this.isAbsoluteIri(e))return e;let r=e.indexOf(":");if(r>0){let s=e.slice(0,r),a=e.slice(r+1),c=t[s];if(!c)throw new Error(`Unknown prefix "${s}" in JSON-LD document`);return`${c}${a}`}let i=t["@vocab"];if(i)return`${i}${e}`;throw new Error(`Unable to expand JSON-LD term "${e}"`)}isAbsoluteIri(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)}buildJsonLdChunks(e){let t=[],r=JSON.stringify(e["@context"]);return t.push(`{"@context":${r},"@graph":[`),e["@graph"].forEach((i,s)=>{let a=JSON.stringify(i);s>0?t.push(`,${a}`):t.push(a)}),t.push(`]}
|
|
371
|
-
`),t}};Up.RDFSerializer=lS});var uS=b(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.OBSIDIAN_VAULT_SCHEME=void 0;nl.vaultPathToIRI=D8;nl.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function D8(n){let e=n.startsWith("./")?n.slice(2):n;return`${nl.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}o(D8,"vaultPathToIRI")});var dS=b(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});qp.RDFVocabularyMapper=void 0;var Xt=Yn(),fx=Ee(),J=ir(),fS=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",J.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",J.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",J.Namespace.RDFS.term("subClassOf")],["exo__Property_range",J.Namespace.RDFS.term("range")],["exo__Property_domain",J.Namespace.RDFS.term("domain")],["exo__Property_superProperty",J.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new Xt.Triple(J.Namespace.EXO.term("Asset"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDFS.term("Resource"))),e.push(new Xt.Triple(J.Namespace.EXO.term("Class"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDFS.term("Class"))),e.push(new Xt.Triple(J.Namespace.EXO.term("Property"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDF.term("Property"))),e.push(new Xt.Triple(J.Namespace.EMS.term("Task"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EMS.term("Project"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EMS.term("Area"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EMS.term("Workflow"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EMS.term("WorkflowState"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EMS.term("WorkflowTransition"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EXOCMD.term("Command"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EXOCMD.term("Precondition"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EXOCMD.term("Grounding"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(J.Namespace.EXOCMD.term("CommandBinding"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new Xt.Triple(J.Namespace.EXO.term("Instance_class"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDF.term("type"))),e.push(new Xt.Triple(J.Namespace.EXO.term("Asset_isDefinedBy"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("isDefinedBy"))),e.push(new Xt.Triple(J.Namespace.EXO.term("Class_superClass"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("subClassOf"))),e.push(new Xt.Triple(J.Namespace.EXO.term("Property_range"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("range"))),e.push(new Xt.Triple(J.Namespace.EXO.term("Property_domain"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("domain"))),e.push(new Xt.Triple(J.Namespace.EXO.term("Property_superProperty"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof fx.IRI)s=r;else{let a=r.match(/^(ems|exo|exocmd)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?J.Namespace.EMS:c==="exocmd"?J.Namespace.EXOCMD:J.Namespace.EXO).term(l)}else s=new fx.IRI(r)}return new Xt.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};qp.RDFVocabularyMapper=fS});var dx=b(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});Gp.RDFSInferenceEngine=void 0;var N8=Yn(),Wp=Ee(),hS=class{static{o(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(d=>d.value.includes("Class_superClass")),i=t.find(d=>d.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let a=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let d of l)if(d.object instanceof Wp.IRI){let h=a.get(d.object.value);if(h)for(let p of h)u.push(new N8.Triple(d.subject,i,new Wp.IRI(p)))}return u.length>0&&await e.addAll(u),await e.count()-c}async buildDirectParentMap(e,t){let r=await e.match(void 0,t),i=new Map;for(let s of r)if(s.subject instanceof Wp.IRI&&s.object instanceof Wp.IRI){let a=s.subject.value,c=s.object.value;i.has(a)||i.set(a,new Set),i.get(a).add(c)}return i}computeAllAncestors(e){let t=new Map;for(let r of e.keys())t.has(r)||t.set(r,this.computeAncestorsBFS(r,e));return t}computeAncestorsBFS(e,t){let r=new Set,i=new Set,s=[],a=t.get(e);if(a)for(let c of a)s.push(c);for(;s.length>0;){let c=s.shift();if(i.has(c))continue;i.add(c),r.add(c);let l=t.get(c);if(l)for(let u of l)i.has(u)||s.push(u)}return r}};Gp.RDFSInferenceEngine=hS});var gS=b(jo=>{"use strict";var L8=jo&&jo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(jo,"__esModule",{value:!0});jo.NonInheritablePropertyRegistry=void 0;var k8=Ce(),hx=Ee(),px=Me(),pS=ir(),mS=class{static{o(this,"NonInheritablePropertyRegistry")}constructor(){this.nonInheritableIRIs=new Set,this.initialized=!1}async initialize(e){this.nonInheritableIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Instance_class"));if(!r){this.initialized=!0;return}let i=await this.findNonInheritableClassIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let a=t.find(c=>c.value.includes("Asset_label"));if(!a){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,a,void 0);for(let u of l)if(u.object instanceof px.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.nonInheritableIRIs.add(d)}}}catch{}this.initialized=!0}isNonInheritable(e){return this.nonInheritableIRIs.has(e)}get size(){return this.nonInheritableIRIs.size}get isInitialized(){return this.initialized}async findNonInheritableClassIRI(e,t){let r=t.find(a=>a.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new px.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof hx.IRI)return i[0].subject;let s=t.find(a=>a.value.includes("Instance_class"));if(s){let a=await e.match(void 0,s,void 0);for(let c of a)if(c.object instanceof hx.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?pS.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?pS.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?pS.Namespace.EXOCMD.term(e.substring(8)).value:null}};jo.NonInheritablePropertyRegistry=mS;jo.NonInheritablePropertyRegistry=mS=L8([(0,k8.injectable)()],mS)});var bS=b(Mo=>{"use strict";var j8=Mo&&Mo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.PropertyCardinalityRegistry=void 0;var M8=Ce(),mx=Ee(),gx=Me(),yS=ir(),_S=class{static{o(this,"PropertyCardinalityRegistry")}constructor(){this.multiValuedIRIs=new Set,this.initialized=!1}async initialize(e){this.multiValuedIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Property_cardinality"));if(!r){this.initialized=!0;return}let i=await this.findMultipleCardinalityIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let a=t.find(c=>c.value.includes("Asset_label"));if(!a){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,a,void 0);for(let u of l)if(u.object instanceof gx.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.multiValuedIRIs.add(d)}}}catch{}this.initialized=!0}isMultiValued(e){return this.multiValuedIRIs.has(e)}get size(){return this.multiValuedIRIs.size}get isInitialized(){return this.initialized}async findMultipleCardinalityIRI(e,t){let r=t.find(a=>a.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new gx.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof mx.IRI)return i[0].subject;let s=t.find(a=>a.value.includes("Instance_class"));if(s){let a=await e.match(void 0,s,void 0);for(let c of a)if(c.object instanceof mx.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?yS.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?yS.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?yS.Namespace.EXOCMD.term(e.substring(8)).value:null}};Mo.PropertyCardinalityRegistry=_S;Mo.PropertyCardinalityRegistry=_S=j8([(0,M8.injectable)()],_S)});var vS=b(br=>{"use strict";var $8=br&&br.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},V8=br&&br.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(br,"__esModule",{value:!0});br.PrototypeChainMaterializer=br.MAX_PROTOTYPE_DEPTH=br.INFERRED_GRAPH=void 0;br.inferredGraphForDepth=SS;var B8=Ce(),yx=Yn(),La=Ee(),U8=gS(),q8=bS();br.INFERRED_GRAPH=new La.IRI("https://exocortex.my/ontology/exo#inferred");var W8="https://exocortex.my/ontology/exo#inferred/";function SS(n){return new La.IRI(`${W8}${n}`)}o(SS,"inferredGraphForDepth");br.MAX_PROTOTYPE_DEPTH=10;var wS=class{static{o(this,"PrototypeChainMaterializer")}constructor(e,t){this.registry=e,this.cardinalityRegistry=t??null}async materialize(e){let r=(await e.predicates()).find(c=>c.value.includes("Asset_prototype"));if(!r)return 0;let i=await e.match(void 0,r,void 0);if(i.length===0)return 0;let s=new Map;for(let c of i)if(c.subject instanceof La.IRI&&c.object instanceof La.IRI){let l=c.subject.value,u=c.object.value;l!==u&&s.set(l,c.object)}if(s.size===0)return 0;let a=0;for(let[c]of s){let l=new La.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let y=p.object instanceof La.IRI?p.object.value:String(p.object),S=h.get(p.predicate.value);S||(S=new Set,h.set(p.predicate.value,S)),S.add(y)}for(let p=0;p<u.length;p++){let y=u[p],S=p+1,v=new La.IRI(y),w=await e.match(v,void 0,void 0),T=new Set;if(e.matchInGraph){let C=await e.matchInGraph(v,void 0,void 0,br.INFERRED_GRAPH);for(let L of C)T.add(L.predicate.value)}for(let C of w){let L=C.predicate.value;if(this.registry.isNonInheritable(L)||T.has(L))continue;if(d.has(L)&&this.isMultiValued(L)){let ee=C.object instanceof La.IRI?C.object.value:String(C.object);if(h.get(L)?.has(ee))continue;let W=h.get(L);W||(W=new Set,h.set(L,W)),W.add(ee);let F=new yx.Triple(l,C.predicate,C.object);await e.add(F),e.addToGraph&&(await e.addToGraph(F,br.INFERRED_GRAPH),await e.addToGraph(F,SS(S))),a++;continue}if(d.has(L))continue;let $=new yx.Triple(l,C.predicate,C.object);await e.add($),e.addToGraph&&(await e.addToGraph($,br.INFERRED_GRAPH),await e.addToGraph($,SS(S))),d.add(L),a++}}}return a}isMultiValued(e){return this.cardinalityRegistry?this.cardinalityRegistry.isMultiValued(e):!1}resolveChain(e,t){let r=[],i=new Set;i.add(e);let s=[],a=t.get(e);for(a&&s.push(a.value);s.length>0&&r.length<br.MAX_PROTOTYPE_DEPTH;){let c=s.shift();if(c===void 0)break;if(i.has(c))continue;i.add(c),r.push(c);let l=t.get(c);l&&!i.has(l.value)&&s.push(l.value)}return r}};br.PrototypeChainMaterializer=wS;br.PrototypeChainMaterializer=wS=$8([(0,B8.injectable)(),V8("design:paramtypes",[U8.NonInheritablePropertyRegistry,q8.PropertyCardinalityRegistry])],wS)});var TS=b(lr=>{"use strict";var G8=lr&&lr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},z8=lr&&lr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(lr,"__esModule",{value:!0});lr.SourceAnnotator=lr.DEPTH_VARIABLE=lr.SOURCE_VARIABLE=void 0;var H8=Ce(),il=Me(),Q8=Ee(),zp=vS();lr.SOURCE_VARIABLE="_source";lr.DEPTH_VARIABLE="_depth";var ES=class{static{o(this,"SourceAnnotator")}constructor(e){this.tripleStore=e}async annotate(e,t,r,i){if(!this.tripleStore.matchInGraph)return e.map(a=>{let c=a.clone();return c.set(lr.SOURCE_VARIABLE,new il.Literal("own")),c});let s=[];for(let a of e){let c=a.get(t),l=a.get(r),u=a.get(i),f=a.clone();if(!c||!l||!u)f.set(lr.SOURCE_VARIABLE,new il.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(lr.SOURCE_VARIABLE,new il.Literal(d))}s.push(f)}return s}async annotateSingle(e,t,r,i){return(await this.annotate([e],t,r,i))[0]}async determineSource(e,t,r){return this.tripleStore.matchInGraph&&(await this.tripleStore.matchInGraph(e,t,r,zp.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=zp.MAX_PROTOTYPE_DEPTH;i++){let s=(0,zp.inferredGraphForDepth)(i);if((await this.tripleStore.matchInGraph(e,t,r,s)).length>0)return i}return 0}async annotateBySubject(e,t){if(!this.tripleStore.matchInGraph)return e.map(s=>{let a=s.clone();return a.set(lr.SOURCE_VARIABLE,new il.Literal("own")),a});let r=[],i=new Map;for(let s of e){let a=s.get(t),c=s.clone();if(!a||!(a instanceof Q8.IRI))c.set(lr.SOURCE_VARIABLE,new il.Literal("own"));else{let l=a.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(a,void 0,void 0,zp.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(lr.SOURCE_VARIABLE,new il.Literal(u))}r.push(c)}return r}};lr.SourceAnnotator=ES;lr.SourceAnnotator=ES=G8([(0,H8.injectable)(),z8("design:paramtypes",[Object])],ES)});var xS=b(ki=>{"use strict";var K8=ki&&ki.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Y8=ki&&ki.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},_x=ki&&ki.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ki,"__esModule",{value:!0});ki.NoteToRDFConverter=void 0;var AS=Ce(),ur=Yn(),ka=Ee(),hn=Me(),bx=$t(),Wt=ir(),Sx=Ct(),X8=dS(),J8=pc(),wx=uS(),On=S0(),Z8=new Set(["archived","draft","pinned"]),sl=class{static{o(this,"NoteToRDFConverter")}constructor(e,t=J8.NullLogger){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.pendingExtraTriples=[],this.vocabularyMapper=new X8.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);if(!t)return[];let r=this.notePathToIRI(e.path),i=Wt.Namespace.EXO.term("Asset_filename"),s=new ur.Triple(r,i,new hn.Literal(e.basename));if(On.Exo003Parser.isExo003Format(t)){let a=await this.convertExo003Note(e,t);return[s,...a]}return this.convertLegacyNote(e,t,s)}async convertLegacyNote(e,t,r){this.pendingExtraTriples=[];let i=[r],s=this.notePathToIRI(e.path);for(let[f,d]of Object.entries(t)){let h=Z8.has(f)?`exo__Asset_${f}`:f;if(!this.isExocortexProperty(h))continue;let p=this.propertyKeyToIRI(h),y=Array.isArray(d)?d:[d];for(let S of y)if(!(f==="exo__Asset_label"&&typeof S=="string"&&S.trim()===""))if(f==="exo__Instance_class"){let v=this.valueToClassURI(S);i.push(new ur.Triple(s,p,v))}else{let v=await this.valueToRDFObject(S,e,p);for(let w of v)if(i.push(new ur.Triple(s,p,w)),this.vocabularyMapper.hasMappingFor(f)&&w instanceof ka.IRI){let T=this.vocabularyMapper.generateMappedTriple(s,f,w);T&&i.push(T)}}if(f==="exo__Instance_class")for(let S of y){let v=this.valueToClassURI(S);if(v instanceof ka.IRI){let w=Wt.Namespace.RDF.term("type");i.push(new ur.Triple(s,w,v))}}if(f==="exo__Asset_label"){let S=Wt.Namespace.RDFS.term("label");for(let v of y)typeof v=="string"&&v.length>0&&i.push(new ur.Triple(s,S,new hn.Literal(v)))}}let a="exo__Instance_class"in t||"exo__Asset_uid"in t,c=t.exo__Asset_label,l="exo__Asset_label"in t&&c!==null&&c!==void 0&&!(typeof c=="string"&&c.trim()==="")&&!(Array.isArray(c)&&c.length===0);if(a&&!l){let f=Wt.Namespace.RDFS.term("label"),d=Wt.Namespace.EXO.term("Asset_label"),h=new hn.Literal(e.basename);i.push(new ur.Triple(s,f,h)),i.push(new ur.Triple(s,d,h))}i.push(...this.pendingExtraTriples),this.pendingExtraTriples=[];let u=await this.convertBodyWikilinks(e,s);return i.push(...u),i}async convertExo003Note(e,t){let r=On.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case On.Exo003MetadataType.Namespace:break;case On.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case On.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case On.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case On.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new ka.IRI(t.uri);return[new ur.Triple(r,Wt.Namespace.OWL.term("sameAs"),i),new ur.Triple(i,Wt.Namespace.OWL.term("sameAs"),r)]}convertExo003BlankNode(e,t){let r=this.notePathToIRI(e.path),i=t.uri.replace(/[^a-zA-Z0-9_-]/g,"_");return[new ur.Triple(r,Wt.Namespace.OWL.term("sameAs"),new bx.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=On.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new ur.Triple(a,Wt.Namespace.RDF.term("value"),s.subject))}catch{}return r}async convertExo003Body(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.createExo003ReferenceResolver(e),c=a(t.subject),l=a(t.predicate);if(c.type==="literal")throw new Error("Body subject cannot be a literal");if(l.type!=="iri")throw new Error("Body predicate must be an IRI");let u=c.type==="iri"?new ka.IRI(c.value):new bx.BlankNode(c.value),f=new ka.IRI(l.value),d=On.Exo003Parser.toLiteral(t,s.trim());r.push(new ur.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new ur.Triple(h,Wt.Namespace.RDF.term("value"),u))}catch{}return r}createExo003ReferenceResolver(e){return t=>{let r=this.extractWikilink(t),i=r||t,s=this.vault.getFirstLinkpathDest(i,e.path);if(s){let a=this.vault.getFrontmatter(s);if(a&&On.Exo003Parser.isExo003Format(a)){let c=On.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===On.Exo003MetadataType.Anchor||l.metadata===On.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===On.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=this.vault.getFrontmatter(a),l=c?this.validateExocortexAsset(c,a.basename):null;if(l){if(s)throw new Error(`Invariant violation in "${a.path}": ${l.message}`);i.push({path:a.path,reason:`Invariant violation: ${l.message}`}),this.logger.warn(`Skipping file with invariant violation: ${a.path}`,{code:l.code,property:l.property,reason:l.message});continue}let u=await this.convertNote(a);r.push(...u)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),this.logger.warn(`Skipping file with invalid IRI: ${a.path}`,{reason:l})}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}static inferLabelFromBasename(e){return Wt.Namespace.fromPropertyKey(e)!==null?e:null}validateExocortexAsset(e,t){let r=o(d=>d==null?!0:typeof d=="string"?d.trim()==="":Array.isArray(d)?d.length===0||d.every(r):!1,"isEmpty");if(!("exo__Instance_class"in e||"exo__Asset_uid"in e))return null;let s=["exo__Asset_uid","exo__Instance_class"];for(let d of s){if(!(d in e))return{code:"MISSING_PROPERTY",property:d,message:`Required property "${d}" is missing`};if(r(e[d]))return{code:"EMPTY_PROPERTY",property:d,message:`Required property "${d}" is empty`}}let a=["ems__Effort_status","ems__Effort_parent","ems__Effort_lockedBy","ems__Effort_lockExpires","exo__Asset_updatedAt","ems__Effort_startTimestamp"];for(let d of a)if(d in e&&r(e[d]))return{code:"EMPTY_OPTIONAL_PROPERTY",property:d,message:`Optional property "${d}" is present but empty`};let c=e.exo__Instance_class,l=Array.isArray(c)?c:[c],u=null,f=!1;for(let d of l){if(typeof d!="string")continue;let h=this.removeQuotes(d),y=(this.extractWikilink(h)??h).trim();/^[a-z][a-zA-Z0-9]*__/.test(y)&&/[\s()]/.test(y)?u||(u={candidate:d}):f=!0}return u&&!f?{code:"INVALID_INSTANCE_CLASS_IRI",property:"exo__Instance_class",message:`Invalid Instance_class IRI: "${u.candidate}"`}:null}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=(0,wx.vaultPathToIRI)(r.path);ka.IRI.isValidIRI(i)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new ka.IRI((0,wx.vaultPathToIRI)(e))}isExocortexProperty(e){return Wt.Namespace.fromPropertyKey(e)!==null}propertyKeyToIRI(e){let t=Wt.Namespace.fromPropertyKey(e);if(!t)throw new Error(`Invalid property key: ${e}`);return t.namespace.term(t.localName)}emitTypeTripleForEnumInstance(e,t){let r=this.vault.getFrontmatter(t);if(!r)return;let i=r.exo__Instance_class,s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return;let a=this.valueToClassURI(s);a instanceof ka.IRI&&(this.pendingExtraTriples.push(new ur.Triple(e,Wt.Namespace.RDF.term("type"),a)),this.pendingExtraTriples.push(new ur.Triple(e,Wt.Namespace.EXO.term("Instance_class"),a)))}async valueToRDFObject(e,t,r){if(typeof e=="string"){let i=this.removeQuotes(e),s=this.extractWikilink(i);if(s){let a=this.vault.getFirstLinkpathDest(s,t.path);if(a){let l=this.notePathToIRI(a.path),u=s.includes("|")?s.split("|")[0]:s;if(this.isUUID(u)){let d=new hn.Literal(u);if(r?.value.endsWith("#Grounding_targetValueRef")||r?.value.endsWith("#Grounding_targetValueSubstitution")||r?.value.endsWith("#Grounding_targetClass"))return[l];let p=this.expandClassValue(a.basename);if(p)return this.emitTypeTripleForEnumInstance(p,a),[p];let y=this.vault.getFrontmatter(a);if(y){let v=y.exo__Asset_label;if(typeof v=="string"){let w=this.expandClassValue(v);if(w)return this.emitTypeTripleForEnumInstance(w,a),[w]}}return r?.value.endsWith("#Asset_prototype")||r?.value.endsWith("/Asset_prototype")?[l,d]:[l]}let f=this.expandClassValue(a.basename);return f?(this.emitTypeTripleForEnumInstance(f,a),[f]):[l]}if(this.isClassReference(s)){let l=this.expandClassValue(s);if(l)return[l]}let c=s.includes("|")?s.split("|")[0]:s;return this.isUUID(c)?[this.notePathToIRI(`${c}.md`)]:[new hn.Literal(i)]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return this.isISO8601DateTime(i)?[new hn.Literal(i,Wt.Namespace.XSD.term("dateTime"))]:[new hn.Literal(i)]}return typeof e=="boolean"?[new hn.Literal(e.toString())]:typeof e=="number"?[new hn.Literal(e.toString(),Wt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new hn.Literal(e.toISOString(),Wt.Namespace.XSD.term("dateTime"))]:[new hn.Literal(String(e))]}isISO8601DateTime(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/.test(e)}removeQuotes(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.substring(1,t.length-1):e}extractWikilink(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1];return r.includes("|")?r.split("|")[0]:r}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1],i=r.indexOf("|");return i>=0?r.substring(i+1).trim():null}valueToClassURI(e){if(typeof e!="string")return new hn.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);if(s)return s;let a=this.extractWikilinkAlias(t);if(a){let c=this.expandClassValue(a);if(c)return c}if(this.isUUID(i)){let c=this.vault.getFirstLinkpathDest(i,"");if(c){let l=this.expandClassValue(c.basename);if(l)return l;let u=this.vault.getFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return d}}}}return new hn.Literal(t)}isClassReference(e){return/\s/.test(e)?!1:Wt.Namespace.fromPropertyKey(e)!==null}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)}expandClassValue(e){let t=this.removeQuotes(e),r=Wt.Namespace.fromPropertyKey(t);return!r||/[\s()]/.test(r.localName)?null:r.namespace.term(r.localName)}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,r,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(r=i.exec(e))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.extractBodyWikilinks(s),c=Wt.Namespace.EXO.term("Asset_bodyLink");for(let l of a){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new ur.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new ur.Triple(t,c,f)):r.push(new ur.Triple(t,c,new hn.Literal(l)))}else r.push(new ur.Triple(t,c,new hn.Literal(l)))}}catch{}return r}};ki.NoteToRDFConverter=sl;sl.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};sl.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};sl.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};ki.NoteToRDFConverter=sl=K8([(0,AS.injectable)(),_x(0,(0,AS.inject)(Sx.DI_TOKENS.IVaultAdapter)),_x(1,(0,AS.inject)(Sx.DI_TOKENS.ILogger)),Y8("design:paramtypes",[Object,Object])],sl)});var CS=b(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});Hp.FilterContainsOptimizer=void 0;var e$=Ee(),t$=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,IS=class{static{o(this,"FilterContainsOptimizer")}constructor(){this.tripleStore=null,this.lastOptimizationHints=[]}setTripleStore(e){this.tripleStore=e}getLastOptimizationHints(){return this.lastOptimizationHints}clearHints(){this.lastOptimizationHints=[]}async optimize(e){return this.clearHints(),this.optimizeRecursive(e)}optimizeSync(e,t){return this.clearHints(),this.optimizeSyncRecursive(e,t)}async optimizeRecursive(e){return e.type==="filter"?this.optimizeFilter(e):e.type==="join"?{type:"join",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="leftjoin"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="union"?{type:"union",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="minus"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="project"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="orderby"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="slice"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="distinct"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="reduced"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="group"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="extend"?{...e,input:await this.optimizeRecursive(e.input)}:e}optimizeSyncRecursive(e,t){return e.type==="filter"?this.optimizeFilterSync(e,t):e.type==="join"?{type:"join",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="leftjoin"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="union"?{type:"union",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="minus"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="project"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="orderby"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="slice"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="distinct"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="reduced"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="group"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="extend"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e}async optimizeFilter(e){let t=this.detectContainsUUIDPattern(e.expression);if(!t)return{type:"filter",expression:e.expression,input:await this.optimizeRecursive(e.input)};let r=[];return this.tripleStore&&(r=await this.findSubjectsContainingUUID(t.uuid)),this.rewriteFilter(e,t,r)}optimizeFilterSync(e,t){let r=this.detectContainsUUIDPattern(e.expression);if(!r)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input,t)};let i=t?t.filter(s=>s.includes(r.uuid)):[];return this.rewriteFilter(e,r,i)}rewriteFilter(e,t,r){if(this.lastOptimizationHints.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${t.variable}), "${t.uuid}"))`,suggestedRewrite:r.length===1?`VALUES ?${t.variable} { <${r[0]}> }`:r.length>1?`VALUES ?${t.variable} { ${r.map(i=>`<${i}>`).join(" ")} }`:"No matching URIs found for UUID",estimatedSpeedup:r.length>0?"O(n) \u2192 O(1)":"N/A",matchedUri:r.length===1?r[0]:void 0}),r.length===0)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input)};if(r.length===1){let i=this.injectSubjectConstraint(e.input,t.variable,r[0]);if(i!==e.input)return i}return this.createValuesJoin(e,t,r)}detectContainsUUIDPattern(e){if(e.type==="function"||e.type==="functionCall"){let t=e;if((typeof t.function=="string"?t.function.toLowerCase():t.function?.value?.toLowerCase()??"")==="contains"&&t.args.length===2)return this.analyzeContainsArgs(t.args[0],t.args[1],e)}if(e.type==="logical"&&e.operator==="&&")for(let t of e.operands){let r=this.detectContainsUUIDPattern(t);if(r)return r}return null}analyzeContainsArgs(e,t,r){let i=null;if(e.type==="function"||e.type==="functionCall"){let s=e;if((typeof s.function=="string"?s.function.toLowerCase():s.function?.value?.toLowerCase()??"")==="str"&&s.args.length===1){let c=s.args[0];c.type==="variable"&&(i=c.name)}}if(!i&&e.type==="variable"&&(i=e.name),!i)return null;if(t.type==="literal"){let c=String(t.value).match(t$);if(c)return{variable:i,uuid:c[0].toLowerCase(),originalExpression:r}}return null}async findSubjectsContainingUUID(e){if(!this.tripleStore)return[];if(this.tripleStore.findSubjectsByUUID)return(await this.tripleStore.findSubjectsByUUID(e)).map(s=>s.value);let t=await this.tripleStore.subjects(),r=[];for(let i of t)i instanceof e$.IRI&&i.value.toLowerCase().includes(e.toLowerCase())&&r.push(i.value);return r}injectSubjectConstraint(e,t,r){if(e.type==="bgp"){let i=e.triples.map(a=>a.subject.type==="variable"&&a.subject.value===t?{...a,subject:{type:"iri",value:r}}:a);if(i.some((a,c)=>a.subject!==e.triples[c].subject))return{type:"bgp",triples:i}}if(e.type==="join"){let i=this.injectSubjectConstraint(e.left,t,r),s=this.injectSubjectConstraint(e.right,t,r);if(i!==e.left||s!==e.right)return{type:"join",left:i,right:s}}if(e.type==="filter"){let i=this.injectSubjectConstraint(e.input,t,r);if(i!==e.input)return{...e,input:i}}return e}createValuesJoin(e,t,r){return{type:"join",left:{type:"values",variables:[t.variable],bindings:r.map(a=>({[t.variable]:{type:"iri",value:a}}))},right:this.optimizeSyncRecursive(e.input)}}analyzeQuery(e){let t=[];return this.analyzeRecursive(e,t),t}analyzeRecursive(e,t){if(e.type==="filter"){let r=this.detectContainsUUIDPattern(e.expression);r&&t.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${r.variable}), "${r.uuid}"))`,suggestedRewrite:`Use --optimize flag or rewrite as VALUES ?${r.variable} { <uri-containing-uuid> }`,estimatedSpeedup:"O(n) \u2192 O(1) with UUID index lookup"}),this.analyzeRecursive(e.input,t);return}e.type==="join"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="leftjoin"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="union"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="minus"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="project"?this.analyzeRecursive(e.input,t):e.type==="orderby"?this.analyzeRecursive(e.input,t):e.type==="slice"?this.analyzeRecursive(e.input,t):e.type==="distinct"?this.analyzeRecursive(e.input,t):e.type==="reduced"?this.analyzeRecursive(e.input,t):e.type==="group"?this.analyzeRecursive(e.input,t):e.type==="extend"&&this.analyzeRecursive(e.input,t)}};Hp.FilterContainsOptimizer=IS});var vx=b(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});Qp.AlgebraOptimizer=void 0;var r$=CS(),RS=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new r$.FilterContainsOptimizer}setTripleStore(e){this.tripleStore=e,this.filterContainsOptimizer.setTripleStore(e)}getOptimizationHints(){return this.filterContainsOptimizer.getLastOptimizationHints()}analyzeQuery(e){return this.filterContainsOptimizer.analyzeQuery(e)}optimize(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),t=this.filterPushDown(t),t=this.joinReordering(t),t}async optimizeAsync(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),this.tripleStore&&(t=await this.filterContainsOptimizer.optimize(t)),t=this.filterPushDown(t),t=this.joinReordering(t),t}optimizeWithSubjects(e,t){let r=e;return r=this.eliminateEmptyBGPInFilterJoin(r),r=this.filterContainsOptimizer.optimizeSync(r,t),r=this.filterPushDown(r),r=this.joinReordering(r),r}eliminateEmptyBGPInFilterJoin(e){if(e.type==="join"){if(e.left.type==="filter"){let t=e.left;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.right)}}if(e.right.type==="filter"){let t=e.right;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.left)}}return{type:"join",left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}}return e.type==="filter"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="leftjoin"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="union"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="minus"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="project"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="orderby"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="slice"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="distinct"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e}filterPushDown(e){return e.type==="filter"?this.pushDownFilter(e):e.type==="join"?{type:"join",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="leftjoin"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="union"?{type:"union",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="minus"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="project"?{...e,input:this.filterPushDown(e.input)}:e.type==="orderby"?{...e,input:this.filterPushDown(e.input)}:e.type==="slice"?{...e,input:this.filterPushDown(e.input)}:e.type==="distinct"?{...e,input:this.filterPushDown(e.input)}:e}pushDownFilter(e){let t=e.input;if(t.type==="join"){let r=this.getFilterVariables(e.expression),i=this.getOperationVariables(t.left),s=this.getOperationVariables(t.right),a=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return a&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!a?{type:"join",left:this.filterPushDown(t.left),right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:{type:"join",left:this.filterPushDown(t.left),right:this.filterPushDown(t.right)}}}return t.type==="union"?{type:"union",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:this.filterPushDown(t)}}getFilterVariables(e){let t=[];if(e.type==="variable")t.push(e.name);else if(e.type==="comparison")t.push(...this.getFilterVariables(e.left)),t.push(...this.getFilterVariables(e.right));else if(e.type==="logical")for(let r of e.operands)t.push(...this.getFilterVariables(r));else if(e.type==="function")for(let r of e.args)t.push(...this.getFilterVariables(r));return Array.from(new Set(t))}getOperationVariables(e){let t=new Set;if(e.type==="bgp")for(let r of e.triples)r.subject.type==="variable"&&t.add(r.subject.value),r.predicate.type==="variable"&&t.add(r.predicate.value),r.object.type==="variable"&&t.add(r.object.value);else if(e.type==="join"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="filter")return this.getOperationVariables(e.input);if(e.type==="leftjoin"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else if(e.type==="union"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="minus")return this.getOperationVariables(e.left);if(e.type==="project")return new Set(e.variables)}}return t}joinReordering(e){return e.type==="join"?this.reorderJoin(e):e.type==="filter"?{...e,input:this.joinReordering(e.input)}:e.type==="leftjoin"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="union"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="minus"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="project"?{...e,input:this.joinReordering(e.input)}:e.type==="orderby"?{...e,input:this.joinReordering(e.input)}:e.type==="slice"?{...e,input:this.joinReordering(e.input)}:e.type==="distinct"?{...e,input:this.joinReordering(e.input)}:e}reorderJoin(e){let t=this.isConstrained(e.left),r=this.isConstrained(e.right);if(r&&!t)return{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)};if(t&&!r)return{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)};let i=this.estimateCost(e.left);return this.estimateCost(e.right)<i?{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)}:{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)}}isConstrained(e){return e.type==="values"?!0:e.type==="bgp"?e.triples.some(t=>t.object.type!=="variable"||t.subject.type!=="variable"):e.type==="filter"?this.isConstrained(e.input):e.type==="join"?this.isConstrained(e.left)||this.isConstrained(e.right):e.type==="union"?this.isConstrained(e.left)&&this.isConstrained(e.right):!1}estimateCost(e){if(e.type==="bgp"){let t=0;for(let r of e.triples){let i=10;r.subject.type==="variable"&&(i*=10),r.predicate.type==="variable"&&(i*=20),r.object.type==="variable"&&(i*=5),t+=i}return t}if(e.type==="filter")return this.estimateCost(e.input)*.3;if(e.type==="join"){let t=this.estimateCost(e.left),r=this.estimateCost(e.right);return e.left.type==="values"||e.right.type==="values"?Math.min(t,r)*2:t*r}if(e.type==="leftjoin")return this.estimateCost(e.left)+this.estimateCost(e.right)*.5;if(e.type==="union")return this.estimateCost(e.left)+this.estimateCost(e.right);if(e.type==="values"){let t=e.bindings;return Array.isArray(t)?t.length*5:10}return e.type==="minus"?this.estimateCost(e.left)+this.estimateCost(e.right)*.3:100}setStatistics(e,t){this.stats.set(e,t)}getStatistics(e){return this.stats.get(e)}};Qp.AlgebraOptimizer=RS});var Ex=b(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.AlgebraSerializer=void 0;var OS=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
371
|
+
`),t}};Up.RDFSerializer=lS});var uS=b(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.OBSIDIAN_VAULT_SCHEME=void 0;nl.vaultPathToIRI=D8;nl.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function D8(n){let e=n.startsWith("./")?n.slice(2):n;return`${nl.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}o(D8,"vaultPathToIRI")});var dS=b(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});qp.RDFVocabularyMapper=void 0;var Xt=Yn(),fx=Ee(),X=ir(),fS=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",X.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",X.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",X.Namespace.RDFS.term("subClassOf")],["exo__Property_range",X.Namespace.RDFS.term("range")],["exo__Property_domain",X.Namespace.RDFS.term("domain")],["exo__Property_superProperty",X.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new Xt.Triple(X.Namespace.EXO.term("Asset"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDFS.term("Resource"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Class"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDFS.term("Class"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDF.term("Property"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Task"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Project"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Area"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Workflow"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("WorkflowState"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("WorkflowTransition"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Command"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Precondition"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Grounding"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("CommandBinding"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new Xt.Triple(X.Namespace.EXO.term("Instance_class"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDF.term("type"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Asset_isDefinedBy"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("isDefinedBy"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Class_superClass"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("subClassOf"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_range"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("range"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_domain"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("domain"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_superProperty"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof fx.IRI)s=r;else{let a=r.match(/^(ems|exo|exocmd)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?X.Namespace.EMS:c==="exocmd"?X.Namespace.EXOCMD:X.Namespace.EXO).term(l)}else s=new fx.IRI(r)}return new Xt.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};qp.RDFVocabularyMapper=fS});var dx=b(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});Gp.RDFSInferenceEngine=void 0;var N8=Yn(),Wp=Ee(),hS=class{static{o(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(d=>d.value.includes("Class_superClass")),i=t.find(d=>d.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let a=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let d of l)if(d.object instanceof Wp.IRI){let h=a.get(d.object.value);if(h)for(let p of h)u.push(new N8.Triple(d.subject,i,new Wp.IRI(p)))}return u.length>0&&await e.addAll(u),await e.count()-c}async buildDirectParentMap(e,t){let r=await e.match(void 0,t),i=new Map;for(let s of r)if(s.subject instanceof Wp.IRI&&s.object instanceof Wp.IRI){let a=s.subject.value,c=s.object.value;i.has(a)||i.set(a,new Set),i.get(a).add(c)}return i}computeAllAncestors(e){let t=new Map;for(let r of e.keys())t.has(r)||t.set(r,this.computeAncestorsBFS(r,e));return t}computeAncestorsBFS(e,t){let r=new Set,i=new Set,s=[],a=t.get(e);if(a)for(let c of a)s.push(c);for(;s.length>0;){let c=s.shift();if(i.has(c))continue;i.add(c),r.add(c);let l=t.get(c);if(l)for(let u of l)i.has(u)||s.push(u)}return r}};Gp.RDFSInferenceEngine=hS});var gS=b(jo=>{"use strict";var L8=jo&&jo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(jo,"__esModule",{value:!0});jo.NonInheritablePropertyRegistry=void 0;var k8=Ce(),hx=Ee(),px=Me(),pS=ir(),mS=class{static{o(this,"NonInheritablePropertyRegistry")}constructor(){this.nonInheritableIRIs=new Set,this.initialized=!1}async initialize(e){this.nonInheritableIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Instance_class"));if(!r){this.initialized=!0;return}let i=await this.findNonInheritableClassIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let a=t.find(c=>c.value.includes("Asset_label"));if(!a){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,a,void 0);for(let u of l)if(u.object instanceof px.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.nonInheritableIRIs.add(d)}}}catch{}this.initialized=!0}isNonInheritable(e){return this.nonInheritableIRIs.has(e)}get size(){return this.nonInheritableIRIs.size}get isInitialized(){return this.initialized}async findNonInheritableClassIRI(e,t){let r=t.find(a=>a.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new px.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof hx.IRI)return i[0].subject;let s=t.find(a=>a.value.includes("Instance_class"));if(s){let a=await e.match(void 0,s,void 0);for(let c of a)if(c.object instanceof hx.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?pS.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?pS.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?pS.Namespace.EXOCMD.term(e.substring(8)).value:null}};jo.NonInheritablePropertyRegistry=mS;jo.NonInheritablePropertyRegistry=mS=L8([(0,k8.injectable)()],mS)});var bS=b(Mo=>{"use strict";var j8=Mo&&Mo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.PropertyCardinalityRegistry=void 0;var M8=Ce(),mx=Ee(),gx=Me(),yS=ir(),_S=class{static{o(this,"PropertyCardinalityRegistry")}constructor(){this.multiValuedIRIs=new Set,this.initialized=!1}async initialize(e){this.multiValuedIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Property_cardinality"));if(!r){this.initialized=!0;return}let i=await this.findMultipleCardinalityIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let a=t.find(c=>c.value.includes("Asset_label"));if(!a){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,a,void 0);for(let u of l)if(u.object instanceof gx.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.multiValuedIRIs.add(d)}}}catch{}this.initialized=!0}isMultiValued(e){return this.multiValuedIRIs.has(e)}get size(){return this.multiValuedIRIs.size}get isInitialized(){return this.initialized}async findMultipleCardinalityIRI(e,t){let r=t.find(a=>a.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new gx.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof mx.IRI)return i[0].subject;let s=t.find(a=>a.value.includes("Instance_class"));if(s){let a=await e.match(void 0,s,void 0);for(let c of a)if(c.object instanceof mx.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?yS.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?yS.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?yS.Namespace.EXOCMD.term(e.substring(8)).value:null}};Mo.PropertyCardinalityRegistry=_S;Mo.PropertyCardinalityRegistry=_S=j8([(0,M8.injectable)()],_S)});var vS=b(br=>{"use strict";var $8=br&&br.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},V8=br&&br.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(br,"__esModule",{value:!0});br.PrototypeChainMaterializer=br.MAX_PROTOTYPE_DEPTH=br.INFERRED_GRAPH=void 0;br.inferredGraphForDepth=SS;var B8=Ce(),yx=Yn(),La=Ee(),U8=gS(),q8=bS();br.INFERRED_GRAPH=new La.IRI("https://exocortex.my/ontology/exo#inferred");var W8="https://exocortex.my/ontology/exo#inferred/";function SS(n){return new La.IRI(`${W8}${n}`)}o(SS,"inferredGraphForDepth");br.MAX_PROTOTYPE_DEPTH=10;var wS=class{static{o(this,"PrototypeChainMaterializer")}constructor(e,t){this.registry=e,this.cardinalityRegistry=t??null}async materialize(e){let r=(await e.predicates()).find(c=>c.value.includes("Asset_prototype"));if(!r)return 0;let i=await e.match(void 0,r,void 0);if(i.length===0)return 0;let s=new Map;for(let c of i)if(c.subject instanceof La.IRI&&c.object instanceof La.IRI){let l=c.subject.value,u=c.object.value;l!==u&&s.set(l,c.object)}if(s.size===0)return 0;let a=0;for(let[c]of s){let l=new La.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let y=p.object instanceof La.IRI?p.object.value:String(p.object),S=h.get(p.predicate.value);S||(S=new Set,h.set(p.predicate.value,S)),S.add(y)}for(let p=0;p<u.length;p++){let y=u[p],S=p+1,v=new La.IRI(y),w=await e.match(v,void 0,void 0),T=new Set;if(e.matchInGraph){let C=await e.matchInGraph(v,void 0,void 0,br.INFERRED_GRAPH);for(let L of C)T.add(L.predicate.value)}for(let C of w){let L=C.predicate.value;if(this.registry.isNonInheritable(L)||T.has(L))continue;if(d.has(L)&&this.isMultiValued(L)){let ee=C.object instanceof La.IRI?C.object.value:String(C.object);if(h.get(L)?.has(ee))continue;let G=h.get(L);G||(G=new Set,h.set(L,G)),G.add(ee);let F=new yx.Triple(l,C.predicate,C.object);await e.add(F),e.addToGraph&&(await e.addToGraph(F,br.INFERRED_GRAPH),await e.addToGraph(F,SS(S))),a++;continue}if(d.has(L))continue;let $=new yx.Triple(l,C.predicate,C.object);await e.add($),e.addToGraph&&(await e.addToGraph($,br.INFERRED_GRAPH),await e.addToGraph($,SS(S))),d.add(L),a++}}}return a}isMultiValued(e){return this.cardinalityRegistry?this.cardinalityRegistry.isMultiValued(e):!1}resolveChain(e,t){let r=[],i=new Set;i.add(e);let s=[],a=t.get(e);for(a&&s.push(a.value);s.length>0&&r.length<br.MAX_PROTOTYPE_DEPTH;){let c=s.shift();if(c===void 0)break;if(i.has(c))continue;i.add(c),r.push(c);let l=t.get(c);l&&!i.has(l.value)&&s.push(l.value)}return r}};br.PrototypeChainMaterializer=wS;br.PrototypeChainMaterializer=wS=$8([(0,B8.injectable)(),V8("design:paramtypes",[U8.NonInheritablePropertyRegistry,q8.PropertyCardinalityRegistry])],wS)});var TS=b(lr=>{"use strict";var G8=lr&&lr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},z8=lr&&lr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(lr,"__esModule",{value:!0});lr.SourceAnnotator=lr.DEPTH_VARIABLE=lr.SOURCE_VARIABLE=void 0;var H8=Ce(),il=Me(),Q8=Ee(),zp=vS();lr.SOURCE_VARIABLE="_source";lr.DEPTH_VARIABLE="_depth";var ES=class{static{o(this,"SourceAnnotator")}constructor(e){this.tripleStore=e}async annotate(e,t,r,i){if(!this.tripleStore.matchInGraph)return e.map(a=>{let c=a.clone();return c.set(lr.SOURCE_VARIABLE,new il.Literal("own")),c});let s=[];for(let a of e){let c=a.get(t),l=a.get(r),u=a.get(i),f=a.clone();if(!c||!l||!u)f.set(lr.SOURCE_VARIABLE,new il.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(lr.SOURCE_VARIABLE,new il.Literal(d))}s.push(f)}return s}async annotateSingle(e,t,r,i){return(await this.annotate([e],t,r,i))[0]}async determineSource(e,t,r){return this.tripleStore.matchInGraph&&(await this.tripleStore.matchInGraph(e,t,r,zp.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=zp.MAX_PROTOTYPE_DEPTH;i++){let s=(0,zp.inferredGraphForDepth)(i);if((await this.tripleStore.matchInGraph(e,t,r,s)).length>0)return i}return 0}async annotateBySubject(e,t){if(!this.tripleStore.matchInGraph)return e.map(s=>{let a=s.clone();return a.set(lr.SOURCE_VARIABLE,new il.Literal("own")),a});let r=[],i=new Map;for(let s of e){let a=s.get(t),c=s.clone();if(!a||!(a instanceof Q8.IRI))c.set(lr.SOURCE_VARIABLE,new il.Literal("own"));else{let l=a.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(a,void 0,void 0,zp.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(lr.SOURCE_VARIABLE,new il.Literal(u))}r.push(c)}return r}};lr.SourceAnnotator=ES;lr.SourceAnnotator=ES=G8([(0,H8.injectable)(),z8("design:paramtypes",[Object])],ES)});var xS=b(ki=>{"use strict";var K8=ki&&ki.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Y8=ki&&ki.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},_x=ki&&ki.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ki,"__esModule",{value:!0});ki.NoteToRDFConverter=void 0;var AS=Ce(),ur=Yn(),ka=Ee(),hn=Me(),bx=$t(),Wt=ir(),Sx=Ct(),X8=dS(),J8=pc(),wx=uS(),On=S0(),Z8=new Set(["archived","draft","pinned"]),sl=class{static{o(this,"NoteToRDFConverter")}constructor(e,t=J8.NullLogger){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.pendingExtraTriples=[],this.vocabularyMapper=new X8.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);if(!t)return[];let r=this.notePathToIRI(e.path),i=Wt.Namespace.EXO.term("Asset_filename"),s=new ur.Triple(r,i,new hn.Literal(e.basename));if(On.Exo003Parser.isExo003Format(t)){let a=await this.convertExo003Note(e,t);return[s,...a]}return this.convertLegacyNote(e,t,s)}async convertLegacyNote(e,t,r){this.pendingExtraTriples=[];let i=[r],s=this.notePathToIRI(e.path);for(let[f,d]of Object.entries(t)){let h=Z8.has(f)?`exo__Asset_${f}`:f;if(!this.isExocortexProperty(h))continue;let p=this.propertyKeyToIRI(h),y=Array.isArray(d)?d:[d];for(let S of y)if(!(f==="exo__Asset_label"&&typeof S=="string"&&S.trim()===""))if(f==="exo__Instance_class"){let v=this.valueToClassURI(S);i.push(new ur.Triple(s,p,v))}else{let v=await this.valueToRDFObject(S,e,p);for(let w of v)if(i.push(new ur.Triple(s,p,w)),this.vocabularyMapper.hasMappingFor(f)&&w instanceof ka.IRI){let T=this.vocabularyMapper.generateMappedTriple(s,f,w);T&&i.push(T)}}if(f==="exo__Instance_class")for(let S of y){let v=this.valueToClassURI(S);if(v instanceof ka.IRI){let w=Wt.Namespace.RDF.term("type");i.push(new ur.Triple(s,w,v))}}if(f==="exo__Asset_label"){let S=Wt.Namespace.RDFS.term("label");for(let v of y)typeof v=="string"&&v.length>0&&i.push(new ur.Triple(s,S,new hn.Literal(v)))}}let a="exo__Instance_class"in t||"exo__Asset_uid"in t,c=t.exo__Asset_label,l="exo__Asset_label"in t&&c!==null&&c!==void 0&&!(typeof c=="string"&&c.trim()==="")&&!(Array.isArray(c)&&c.length===0);if(a&&!l){let f=Wt.Namespace.RDFS.term("label"),d=Wt.Namespace.EXO.term("Asset_label"),h=new hn.Literal(e.basename);i.push(new ur.Triple(s,f,h)),i.push(new ur.Triple(s,d,h))}i.push(...this.pendingExtraTriples),this.pendingExtraTriples=[];let u=await this.convertBodyWikilinks(e,s);return i.push(...u),i}async convertExo003Note(e,t){let r=On.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case On.Exo003MetadataType.Namespace:break;case On.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case On.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case On.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case On.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new ka.IRI(t.uri);return[new ur.Triple(r,Wt.Namespace.OWL.term("sameAs"),i),new ur.Triple(i,Wt.Namespace.OWL.term("sameAs"),r)]}convertExo003BlankNode(e,t){let r=this.notePathToIRI(e.path),i=t.uri.replace(/[^a-zA-Z0-9_-]/g,"_");return[new ur.Triple(r,Wt.Namespace.OWL.term("sameAs"),new bx.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=On.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new ur.Triple(a,Wt.Namespace.RDF.term("value"),s.subject))}catch{}return r}async convertExo003Body(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.createExo003ReferenceResolver(e),c=a(t.subject),l=a(t.predicate);if(c.type==="literal")throw new Error("Body subject cannot be a literal");if(l.type!=="iri")throw new Error("Body predicate must be an IRI");let u=c.type==="iri"?new ka.IRI(c.value):new bx.BlankNode(c.value),f=new ka.IRI(l.value),d=On.Exo003Parser.toLiteral(t,s.trim());r.push(new ur.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new ur.Triple(h,Wt.Namespace.RDF.term("value"),u))}catch{}return r}createExo003ReferenceResolver(e){return t=>{let r=this.extractWikilink(t),i=r||t,s=this.vault.getFirstLinkpathDest(i,e.path);if(s){let a=this.vault.getFrontmatter(s);if(a&&On.Exo003Parser.isExo003Format(a)){let c=On.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===On.Exo003MetadataType.Anchor||l.metadata===On.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===On.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=this.vault.getFrontmatter(a),l=c?this.validateExocortexAsset(c,a.basename):null;if(l){if(s)throw new Error(`Invariant violation in "${a.path}": ${l.message}`);i.push({path:a.path,reason:`Invariant violation: ${l.message}`}),this.logger.warn(`Skipping file with invariant violation: ${a.path}`,{code:l.code,property:l.property,reason:l.message});continue}let u=await this.convertNote(a);r.push(...u)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),this.logger.warn(`Skipping file with invalid IRI: ${a.path}`,{reason:l})}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}static inferLabelFromBasename(e){return Wt.Namespace.fromPropertyKey(e)!==null?e:null}validateExocortexAsset(e,t){let r=o(d=>d==null?!0:typeof d=="string"?d.trim()==="":Array.isArray(d)?d.length===0||d.every(r):!1,"isEmpty");if(!("exo__Instance_class"in e||"exo__Asset_uid"in e))return null;let s=["exo__Asset_uid","exo__Instance_class"];for(let d of s){if(!(d in e))return{code:"MISSING_PROPERTY",property:d,message:`Required property "${d}" is missing`};if(r(e[d]))return{code:"EMPTY_PROPERTY",property:d,message:`Required property "${d}" is empty`}}let a=["ems__Effort_status","ems__Effort_parent","ems__Effort_lockedBy","ems__Effort_lockExpires","exo__Asset_updatedAt","ems__Effort_startTimestamp"];for(let d of a)if(d in e&&r(e[d]))return{code:"EMPTY_OPTIONAL_PROPERTY",property:d,message:`Optional property "${d}" is present but empty`};let c=e.exo__Instance_class,l=Array.isArray(c)?c:[c],u=null,f=!1;for(let d of l){if(typeof d!="string")continue;let h=this.removeQuotes(d),y=(this.extractWikilink(h)??h).trim();/^[a-z][a-zA-Z0-9]*__/.test(y)&&/[\s()]/.test(y)?u||(u={candidate:d}):f=!0}return u&&!f?{code:"INVALID_INSTANCE_CLASS_IRI",property:"exo__Instance_class",message:`Invalid Instance_class IRI: "${u.candidate}"`}:null}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=(0,wx.vaultPathToIRI)(r.path);ka.IRI.isValidIRI(i)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new ka.IRI((0,wx.vaultPathToIRI)(e))}isExocortexProperty(e){return Wt.Namespace.fromPropertyKey(e)!==null}propertyKeyToIRI(e){let t=Wt.Namespace.fromPropertyKey(e);if(!t)throw new Error(`Invalid property key: ${e}`);return t.namespace.term(t.localName)}emitTypeTripleForEnumInstance(e,t){let r=this.vault.getFrontmatter(t);if(!r)return;let i=r.exo__Instance_class,s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return;let a=this.valueToClassURI(s);a instanceof ka.IRI&&(this.pendingExtraTriples.push(new ur.Triple(e,Wt.Namespace.RDF.term("type"),a)),this.pendingExtraTriples.push(new ur.Triple(e,Wt.Namespace.EXO.term("Instance_class"),a)))}async valueToRDFObject(e,t,r){if(typeof e=="string"){let i=this.removeQuotes(e),s=this.extractWikilink(i);if(s){let a=this.vault.getFirstLinkpathDest(s,t.path);if(a){let l=this.notePathToIRI(a.path),u=s.includes("|")?s.split("|")[0]:s;if(this.isUUID(u)){let d=new hn.Literal(u);if(r?.value.endsWith("#Grounding_targetValueRef")||r?.value.endsWith("#Grounding_targetValueSubstitution")||r?.value.endsWith("#Grounding_targetClass"))return[l];let p=this.expandClassValue(a.basename);if(p)return this.emitTypeTripleForEnumInstance(p,a),[p];let y=this.vault.getFrontmatter(a);if(y){let v=y.exo__Asset_label;if(typeof v=="string"){let w=this.expandClassValue(v);if(w)return this.emitTypeTripleForEnumInstance(w,a),[w]}}return r?.value.endsWith("#Asset_prototype")||r?.value.endsWith("/Asset_prototype")?[l,d]:[l]}let f=this.expandClassValue(a.basename);return f?(this.emitTypeTripleForEnumInstance(f,a),[f]):[l]}if(this.isClassReference(s)){let l=this.expandClassValue(s);if(l)return[l]}let c=s.includes("|")?s.split("|")[0]:s;return this.isUUID(c)?[this.notePathToIRI(`${c}.md`)]:[new hn.Literal(i)]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return this.isISO8601DateTime(i)?[new hn.Literal(i,Wt.Namespace.XSD.term("dateTime"))]:[new hn.Literal(i)]}return typeof e=="boolean"?[new hn.Literal(e.toString())]:typeof e=="number"?[new hn.Literal(e.toString(),Wt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new hn.Literal(e.toISOString(),Wt.Namespace.XSD.term("dateTime"))]:[new hn.Literal(String(e))]}isISO8601DateTime(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/.test(e)}removeQuotes(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.substring(1,t.length-1):e}extractWikilink(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1];return r.includes("|")?r.split("|")[0]:r}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1],i=r.indexOf("|");return i>=0?r.substring(i+1).trim():null}valueToClassURI(e){if(typeof e!="string")return new hn.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);if(s)return s;let a=this.extractWikilinkAlias(t);if(a){let c=this.expandClassValue(a);if(c)return c}if(this.isUUID(i)){let c=this.vault.getFirstLinkpathDest(i,"");if(c){let l=this.expandClassValue(c.basename);if(l)return l;let u=this.vault.getFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return d}}}}return new hn.Literal(t)}isClassReference(e){return/\s/.test(e)?!1:Wt.Namespace.fromPropertyKey(e)!==null}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)}expandClassValue(e){let t=this.removeQuotes(e),r=Wt.Namespace.fromPropertyKey(t);return!r||/[\s()]/.test(r.localName)?null:r.namespace.term(r.localName)}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,r,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(r=i.exec(e))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.extractBodyWikilinks(s),c=Wt.Namespace.EXO.term("Asset_bodyLink");for(let l of a){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new ur.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new ur.Triple(t,c,f)):r.push(new ur.Triple(t,c,new hn.Literal(l)))}else r.push(new ur.Triple(t,c,new hn.Literal(l)))}}catch{}return r}};ki.NoteToRDFConverter=sl;sl.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};sl.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};sl.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};ki.NoteToRDFConverter=sl=K8([(0,AS.injectable)(),_x(0,(0,AS.inject)(Sx.DI_TOKENS.IVaultAdapter)),_x(1,(0,AS.inject)(Sx.DI_TOKENS.ILogger)),Y8("design:paramtypes",[Object,Object])],sl)});var CS=b(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});Hp.FilterContainsOptimizer=void 0;var e$=Ee(),t$=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,IS=class{static{o(this,"FilterContainsOptimizer")}constructor(){this.tripleStore=null,this.lastOptimizationHints=[]}setTripleStore(e){this.tripleStore=e}getLastOptimizationHints(){return this.lastOptimizationHints}clearHints(){this.lastOptimizationHints=[]}async optimize(e){return this.clearHints(),this.optimizeRecursive(e)}optimizeSync(e,t){return this.clearHints(),this.optimizeSyncRecursive(e,t)}async optimizeRecursive(e){return e.type==="filter"?this.optimizeFilter(e):e.type==="join"?{type:"join",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="leftjoin"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="union"?{type:"union",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="minus"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="project"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="orderby"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="slice"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="distinct"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="reduced"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="group"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="extend"?{...e,input:await this.optimizeRecursive(e.input)}:e}optimizeSyncRecursive(e,t){return e.type==="filter"?this.optimizeFilterSync(e,t):e.type==="join"?{type:"join",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="leftjoin"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="union"?{type:"union",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="minus"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="project"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="orderby"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="slice"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="distinct"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="reduced"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="group"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="extend"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e}async optimizeFilter(e){let t=this.detectContainsUUIDPattern(e.expression);if(!t)return{type:"filter",expression:e.expression,input:await this.optimizeRecursive(e.input)};let r=[];return this.tripleStore&&(r=await this.findSubjectsContainingUUID(t.uuid)),this.rewriteFilter(e,t,r)}optimizeFilterSync(e,t){let r=this.detectContainsUUIDPattern(e.expression);if(!r)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input,t)};let i=t?t.filter(s=>s.includes(r.uuid)):[];return this.rewriteFilter(e,r,i)}rewriteFilter(e,t,r){if(this.lastOptimizationHints.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${t.variable}), "${t.uuid}"))`,suggestedRewrite:r.length===1?`VALUES ?${t.variable} { <${r[0]}> }`:r.length>1?`VALUES ?${t.variable} { ${r.map(i=>`<${i}>`).join(" ")} }`:"No matching URIs found for UUID",estimatedSpeedup:r.length>0?"O(n) \u2192 O(1)":"N/A",matchedUri:r.length===1?r[0]:void 0}),r.length===0)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input)};if(r.length===1){let i=this.injectSubjectConstraint(e.input,t.variable,r[0]);if(i!==e.input)return i}return this.createValuesJoin(e,t,r)}detectContainsUUIDPattern(e){if(e.type==="function"||e.type==="functionCall"){let t=e;if((typeof t.function=="string"?t.function.toLowerCase():t.function?.value?.toLowerCase()??"")==="contains"&&t.args.length===2)return this.analyzeContainsArgs(t.args[0],t.args[1],e)}if(e.type==="logical"&&e.operator==="&&")for(let t of e.operands){let r=this.detectContainsUUIDPattern(t);if(r)return r}return null}analyzeContainsArgs(e,t,r){let i=null;if(e.type==="function"||e.type==="functionCall"){let s=e;if((typeof s.function=="string"?s.function.toLowerCase():s.function?.value?.toLowerCase()??"")==="str"&&s.args.length===1){let c=s.args[0];c.type==="variable"&&(i=c.name)}}if(!i&&e.type==="variable"&&(i=e.name),!i)return null;if(t.type==="literal"){let c=String(t.value).match(t$);if(c)return{variable:i,uuid:c[0].toLowerCase(),originalExpression:r}}return null}async findSubjectsContainingUUID(e){if(!this.tripleStore)return[];if(this.tripleStore.findSubjectsByUUID)return(await this.tripleStore.findSubjectsByUUID(e)).map(s=>s.value);let t=await this.tripleStore.subjects(),r=[];for(let i of t)i instanceof e$.IRI&&i.value.toLowerCase().includes(e.toLowerCase())&&r.push(i.value);return r}injectSubjectConstraint(e,t,r){if(e.type==="bgp"){let i=e.triples.map(a=>a.subject.type==="variable"&&a.subject.value===t?{...a,subject:{type:"iri",value:r}}:a);if(i.some((a,c)=>a.subject!==e.triples[c].subject))return{type:"bgp",triples:i}}if(e.type==="join"){let i=this.injectSubjectConstraint(e.left,t,r),s=this.injectSubjectConstraint(e.right,t,r);if(i!==e.left||s!==e.right)return{type:"join",left:i,right:s}}if(e.type==="filter"){let i=this.injectSubjectConstraint(e.input,t,r);if(i!==e.input)return{...e,input:i}}return e}createValuesJoin(e,t,r){return{type:"join",left:{type:"values",variables:[t.variable],bindings:r.map(a=>({[t.variable]:{type:"iri",value:a}}))},right:this.optimizeSyncRecursive(e.input)}}analyzeQuery(e){let t=[];return this.analyzeRecursive(e,t),t}analyzeRecursive(e,t){if(e.type==="filter"){let r=this.detectContainsUUIDPattern(e.expression);r&&t.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${r.variable}), "${r.uuid}"))`,suggestedRewrite:`Use --optimize flag or rewrite as VALUES ?${r.variable} { <uri-containing-uuid> }`,estimatedSpeedup:"O(n) \u2192 O(1) with UUID index lookup"}),this.analyzeRecursive(e.input,t);return}e.type==="join"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="leftjoin"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="union"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="minus"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="project"?this.analyzeRecursive(e.input,t):e.type==="orderby"?this.analyzeRecursive(e.input,t):e.type==="slice"?this.analyzeRecursive(e.input,t):e.type==="distinct"?this.analyzeRecursive(e.input,t):e.type==="reduced"?this.analyzeRecursive(e.input,t):e.type==="group"?this.analyzeRecursive(e.input,t):e.type==="extend"&&this.analyzeRecursive(e.input,t)}};Hp.FilterContainsOptimizer=IS});var vx=b(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});Qp.AlgebraOptimizer=void 0;var r$=CS(),RS=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new r$.FilterContainsOptimizer}setTripleStore(e){this.tripleStore=e,this.filterContainsOptimizer.setTripleStore(e)}getOptimizationHints(){return this.filterContainsOptimizer.getLastOptimizationHints()}analyzeQuery(e){return this.filterContainsOptimizer.analyzeQuery(e)}optimize(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),t=this.filterPushDown(t),t=this.joinReordering(t),t}async optimizeAsync(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),this.tripleStore&&(t=await this.filterContainsOptimizer.optimize(t)),t=this.filterPushDown(t),t=this.joinReordering(t),t}optimizeWithSubjects(e,t){let r=e;return r=this.eliminateEmptyBGPInFilterJoin(r),r=this.filterContainsOptimizer.optimizeSync(r,t),r=this.filterPushDown(r),r=this.joinReordering(r),r}eliminateEmptyBGPInFilterJoin(e){if(e.type==="join"){if(e.left.type==="filter"){let t=e.left;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.right)}}if(e.right.type==="filter"){let t=e.right;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.left)}}return{type:"join",left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}}return e.type==="filter"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="leftjoin"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="union"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="minus"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="project"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="orderby"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="slice"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="distinct"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e}filterPushDown(e){return e.type==="filter"?this.pushDownFilter(e):e.type==="join"?{type:"join",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="leftjoin"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="union"?{type:"union",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="minus"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="project"?{...e,input:this.filterPushDown(e.input)}:e.type==="orderby"?{...e,input:this.filterPushDown(e.input)}:e.type==="slice"?{...e,input:this.filterPushDown(e.input)}:e.type==="distinct"?{...e,input:this.filterPushDown(e.input)}:e}pushDownFilter(e){let t=e.input;if(t.type==="join"){let r=this.getFilterVariables(e.expression),i=this.getOperationVariables(t.left),s=this.getOperationVariables(t.right),a=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return a&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!a?{type:"join",left:this.filterPushDown(t.left),right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:{type:"join",left:this.filterPushDown(t.left),right:this.filterPushDown(t.right)}}}return t.type==="union"?{type:"union",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:this.filterPushDown(t)}}getFilterVariables(e){let t=[];if(e.type==="variable")t.push(e.name);else if(e.type==="comparison")t.push(...this.getFilterVariables(e.left)),t.push(...this.getFilterVariables(e.right));else if(e.type==="logical")for(let r of e.operands)t.push(...this.getFilterVariables(r));else if(e.type==="function")for(let r of e.args)t.push(...this.getFilterVariables(r));return Array.from(new Set(t))}getOperationVariables(e){let t=new Set;if(e.type==="bgp")for(let r of e.triples)r.subject.type==="variable"&&t.add(r.subject.value),r.predicate.type==="variable"&&t.add(r.predicate.value),r.object.type==="variable"&&t.add(r.object.value);else if(e.type==="join"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="filter")return this.getOperationVariables(e.input);if(e.type==="leftjoin"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else if(e.type==="union"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="minus")return this.getOperationVariables(e.left);if(e.type==="project")return new Set(e.variables)}}return t}joinReordering(e){return e.type==="join"?this.reorderJoin(e):e.type==="filter"?{...e,input:this.joinReordering(e.input)}:e.type==="leftjoin"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="union"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="minus"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="project"?{...e,input:this.joinReordering(e.input)}:e.type==="orderby"?{...e,input:this.joinReordering(e.input)}:e.type==="slice"?{...e,input:this.joinReordering(e.input)}:e.type==="distinct"?{...e,input:this.joinReordering(e.input)}:e}reorderJoin(e){let t=this.isConstrained(e.left),r=this.isConstrained(e.right);if(r&&!t)return{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)};if(t&&!r)return{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)};let i=this.estimateCost(e.left);return this.estimateCost(e.right)<i?{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)}:{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)}}isConstrained(e){return e.type==="values"?!0:e.type==="bgp"?e.triples.some(t=>t.object.type!=="variable"||t.subject.type!=="variable"):e.type==="filter"?this.isConstrained(e.input):e.type==="join"?this.isConstrained(e.left)||this.isConstrained(e.right):e.type==="union"?this.isConstrained(e.left)&&this.isConstrained(e.right):!1}estimateCost(e){if(e.type==="bgp"){let t=0;for(let r of e.triples){let i=10;r.subject.type==="variable"&&(i*=10),r.predicate.type==="variable"&&(i*=20),r.object.type==="variable"&&(i*=5),t+=i}return t}if(e.type==="filter")return this.estimateCost(e.input)*.3;if(e.type==="join"){let t=this.estimateCost(e.left),r=this.estimateCost(e.right);return e.left.type==="values"||e.right.type==="values"?Math.min(t,r)*2:t*r}if(e.type==="leftjoin")return this.estimateCost(e.left)+this.estimateCost(e.right)*.5;if(e.type==="union")return this.estimateCost(e.left)+this.estimateCost(e.right);if(e.type==="values"){let t=e.bindings;return Array.isArray(t)?t.length*5:10}return e.type==="minus"?this.estimateCost(e.left)+this.estimateCost(e.right)*.3:100}setStatistics(e,t){this.stats.set(e,t)}getStatistics(e){return this.stats.get(e)}};Qp.AlgebraOptimizer=RS});var Ex=b(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.AlgebraSerializer=void 0;var OS=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
372
372
|
${e.triples.map(u=>`${r} ${this.tripleToString(u)}`).join(`
|
|
373
373
|
`)}
|
|
374
374
|
${r}]`;case"filter":return`${r}Filter(
|
|
@@ -445,16 +445,16 @@ To resolve:
|
|
|
445
445
|
\u2022 Check service initialization parameters
|
|
446
446
|
\u2022 Verify all required dependencies are available
|
|
447
447
|
\u2022 Review service logs for detailed error information
|
|
448
|
-
\u2022 Contact support if the issue persists`}};vm.ServiceError=lw});var cI=b(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.ServiceError=er.ResourceExhaustedError=er.NotFoundError=er.PermissionError=er.StateTransitionError=er.NetworkError=er.ValidationError=er.ApplicationError=er.ErrorCode=void 0;var UV=hs();Object.defineProperty(er,"ErrorCode",{enumerable:!0,get:o(function(){return UV.ErrorCode},"get")});var qV=ps();Object.defineProperty(er,"ApplicationError",{enumerable:!0,get:o(function(){return qV.ApplicationError},"get")});var WV=tI();Object.defineProperty(er,"ValidationError",{enumerable:!0,get:o(function(){return WV.ValidationError},"get")});var GV=rI();Object.defineProperty(er,"NetworkError",{enumerable:!0,get:o(function(){return GV.NetworkError},"get")});var zV=nI();Object.defineProperty(er,"StateTransitionError",{enumerable:!0,get:o(function(){return zV.StateTransitionError},"get")});var HV=iI();Object.defineProperty(er,"PermissionError",{enumerable:!0,get:o(function(){return HV.PermissionError},"get")});var QV=sI();Object.defineProperty(er,"NotFoundError",{enumerable:!0,get:o(function(){return QV.NotFoundError},"get")});var KV=aI();Object.defineProperty(er,"ResourceExhaustedError",{enumerable:!0,get:o(function(){return KV.ResourceExhaustedError},"get")});var YV=oI();Object.defineProperty(er,"ServiceError",{enumerable:!0,get:o(function(){return YV.ServiceError},"get")})});var fw=b(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});Em.ShapeRegistry=void 0;var uw=class{static{o(this,"ShapeRegistry")}constructor(){this.shapes=new Map}get(e){return this.shapes.get(e)}register(e){this.shapes.set(e.propertyIRI,e)}getAll(){return Array.from(this.shapes.values())}get size(){return this.shapes.size}};Em.ShapeRegistry=uw});var mw=b(ms=>{"use strict";var XV=ms&&ms.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),JV=ms&&ms.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),dw=ms&&ms.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&XV(t,e,r[i]);return JV(t,e),t}})();Object.defineProperty(ms,"__esModule",{value:!0});ms.ShapeLoader=void 0;var hw=fw(),$o=Ee(),nf=Me(),Hr=ir(),Tm="http://www.w3.org/ns/shacl#",ZV="http://www.w3.org/2001/XMLSchema#",yce=[["exo__",Hr.Namespace.EXO],["ems__",Hr.Namespace.EMS],["exocmd__",Hr.Namespace.EXOCMD],["ims__",Hr.Namespace.IMS],["ztlk__",Hr.Namespace.ZTLK],["ptms__",Hr.Namespace.PTMS],["lit__",Hr.Namespace.LIT],["inbox__",Hr.Namespace.INBOX],["pmbok__",Hr.Namespace.PMBOK]],pw=class n{static{o(this,"ShapeLoader")}static async loadFromVaultFS(e){let{readdir:t,readFile:r}=await Promise.resolve().then(()=>dw(require("fs/promises"))),i=await Promise.resolve().then(()=>dw(require("path"))),s=new hw.ShapeRegistry;return await n.scanDir(e,s,{readdir:t,readFile:r,path:i}),s}static async loadFromRDFGraph(e){let t=new hw.ShapeRegistry,r=Hr.Namespace.EXO,i=Hr.Namespace.RDFS,s=Hr.Namespace.RDF,[a,c]=await Promise.all([e.match(void 0,s.term("type"),r.term("ObjectProperty")),e.match(void 0,s.term("type"),r.term("Property"))]),l=new Set;for(let u of[...a,...c])u.subject instanceof $o.IRI&&l.add(u.subject.value);for(let u of l){let f;try{f=new $o.IRI(u)}catch{continue}let[d,h,p,y,S,v,w,T,C]=await Promise.all([e.match(f,i.term("domain"),void 0),e.match(f,r.term("Property_domain"),void 0),e.match(f,i.term("range"),void 0),e.match(f,r.term("Property_range"),void 0),e.match(f,r.term("Property_cardinality"),void 0),e.match(f,r.term("Property_severity"),void 0),e.match(f,r.term("Asset_label"),void 0),e.match(f,i.term("label"),void 0),e.match(f,r.term("Property_minCount"),void 0)]),L=[...w,...T],$=[...d,...h],ee=[...p,...y];if($.length===0)continue;let B=null;for(let ie of L)if(ie.object instanceof nf.Literal&&(B=n.labelToIRI(ie.object.value),B))break;if(!B)continue;let W=await Promise.all($.map(async ie=>ie.object instanceof $o.IRI?await n.resolveClassIRI(ie.object.value,e):null)),F=Array.from(new Set(W.filter(ie=>ie!==null))),D=await Promise.all(ee.map(async ie=>{if(ie.object instanceof $o.IRI)return await n.resolveClassIRI(ie.object.value,e);if(ie.object instanceof nf.Literal){let K=ie.object.value;if(K.startsWith("http://")||K.startsWith("https://"))return K}return null})),G=Array.from(new Set(D.filter(ie=>ie!==null))),Re=n.cardinalityFromIRI(S[0]?.object instanceof $o.IRI?S[0].object.value:void 0),et=n.severityFromValue(v[0]?.object instanceof nf.Literal||v[0]?.object instanceof $o.IRI?v[0].object.value:void 0),ft=C[0]?.object,Ze=ft instanceof nf.Literal?parseInt(ft.value,10):NaN,te=isNaN(Ze)?void 0:Ze;t.register({propertyIRI:B,domain:F,range:G.length>0?G:void 0,cardinality:Re,severity:et,minCount:te})}return t}static async loadFromShapeJSON(e){let{readFile:t}=await Promise.resolve().then(()=>dw(require("fs/promises"))),r=await t(e,"utf-8"),i=JSON.parse(r),s=new hw.ShapeRegistry;for(let a of Object.values(i.shapes))s.register(a);return s}static async resolveClassIRI(e,t){if(e.startsWith("https://exocortex.my/ontology/")||e.startsWith("http://www.w3.org/"))return e;let r;try{r=new $o.IRI(e)}catch{return null}let i=Hr.Namespace.RDFS,s=Hr.Namespace.EXO,[a,c]=await Promise.all([t.match(r,i.term("label"),void 0),t.match(r,s.term("Asset_label"),void 0)]);for(let l of[...a,...c])if(l.object instanceof nf.Literal){let u=n.labelToIRI(l.object.value);if(u)return u}return e}static async scanDir(e,t,r){let i;try{i=await r.readdir(e,{withFileTypes:!0})}catch{return}for(let s of i){let a=r.path.join(e,s.name);if(s.isDirectory())await n.scanDir(a,t,r);else if(s.isFile()&&s.name.endsWith(".md"))try{await n.processFile(a,t,r.readFile,r.path)}catch{}}}static async processFile(e,t,r,i){let s;try{s=await r(e,"utf-8")}catch{return}let a=n.parseFrontmatter(s);if(!a)return;let c="38277bfa-d7f9-4a75-b856-b23276ab0db3",l="9a1cf31c-9d41-4ef3-9023-584a8d087d16";if(!n.asArray(a.exo__Instance_class).some(F=>{let D=n.extractWikilinkRef(F);return D==="exo__Property"||D==="exo__ObjectProperty"||D===c||D===l||D?.includes("|exo__Property")||D?.includes("|exo__ObjectProperty")}))return;let d=null,h=a.exo__Asset_label;if(typeof h=="string"&&h.trim().length>0)d=h.trim();else if(i){let F=i.basename(e,".md");Hr.Namespace.fromPropertyKey(F)&&(d=F)}if(!d)return;let p=n.labelToIRI(d);if(!p)return;let y=a.exo__Property_domain,S=a.exo__Property_range,v=a.exo__Property_cardinality,w=a.exo__Property_severity,T=a.exo__Property_minCount,C=n.asArray(y).map(F=>n.wikilinkToIRI(F)).filter(F=>F!==null);if(C.length===0)return;let L=n.asArray(S).map(F=>n.wikilinkToIRI(F)).filter(F=>F!==null),$=n.cardinalityFromLabel(typeof v=="string"?v:void 0),ee=n.severityFromValue(typeof w=="string"?w:void 0),B=typeof T=="string"?parseInt(T,10):void 0,W=B!==void 0&&!isNaN(B)?B:void 0;t.register({propertyIRI:p,domain:C,range:L.length>0?L:void 0,cardinality:$,severity:ee,minCount:W})}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let r=t[1],i={},s=r.split(/\r?\n/),a=null,c=null;for(let l of s){let u=/^ {2}- (.*)$/.exec(l);if(u){a&&c&&c.push(u[1].trim());continue}a&&c&&(i[a]=c,a=null,c=null);let f=/^([^:]+):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(a=d,c=[]):i[d]=h}return a&&c&&(i[a]=c),i}static labelToIRI(e){let t=Hr.Namespace.fromPropertyKey(e);if(!t)return null;try{return t.namespace.term(t.localName).value}catch{return null}}static extractWikilinkRef(e){let t=e.replace(/^["']|["']$/g,""),r=/\[\[([^\]]+)\]\]/.exec(t);return r?r[1]:t}static wikilinkToIRI(e){let t=n.extractWikilinkRef(e);if(!t)return null;let r=t.split("|"),i=r.length>1?[r[1],r[0]]:[r[0]];for(let s of i){let a=n.labelToIRI(s.trim());if(a)return a}return t.startsWith("http")?t:t.startsWith("sh:")?Tm+t.substring(3):t.startsWith("xsd:")?ZV+t.substring(4):null}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static cardinalityFromIRI(e){if(e){if(e.endsWith("PropertyCardinalitySingle"))return"Single";if(e.endsWith("PropertyCardinalityMultiple"))return"Multiple"}}static cardinalityFromLabel(e){if(!e)return;let t=n.extractWikilinkRef(e)??e,r=t.split("|").pop()??t;if(r.includes("Single"))return"Single";if(r.includes("Multiple"))return"Multiple"}static severityFromValue(e){return!e||e.includes("Violation")||e===Tm+"Violation"?"sh:Violation":e.includes("Warning")||e===Tm+"Warning"?"sh:Warning":e.includes("Info")||e===Tm+"Info"?"sh:Info":"sh:Violation"}};ms.ShapeLoader=pw});var yw=b(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.ShapeRegistry=void 0;sf.validate=aB;var gw=class{static{o(this,"ShapeRegistry")}constructor(e=[],t="https://exocortex.my/ontology/exo#Instance_class"){this.shapeMap=new Map(e.map(r=>[r.propertyIRI,r])),this.typePredicateIRI=t}getShape(e){return this.shapeMap.get(e)}getAllShapes(){return Array.from(this.shapeMap.values())}hasShape(e){return this.shapeMap.has(e)}};sf.ShapeRegistry=gw;var eB="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",tB=["http://www.w3.org/2001/XMLSchema#","http://www.w3.org/1999/02/22-rdf-syntax-ns#","http://www.w3.org/2000/01/rdf-schema#","http://www.w3.org/2002/07/owl#","http://www.w3.org/2004/02/skos/core#","http://purl.org/dc/elements/1.1/","http://purl.org/dc/terms/","http://xmlns.com/foaf/0.1/","https://schema.org/","https://exocortex.my/ontology/xsd#","https://exocortex.my/ontology/rdf#","https://exocortex.my/ontology/rdfs#","https://exocortex.my/ontology/owl#","https://exocortex.my/ontology/skos#"];function rB(n){return tB.some(e=>n.startsWith(e))}o(rB,"isExternalOntologyIRI");var nB=["http://www.w3.org/2001/XMLSchema#","https://exocortex.my/ontology/xsd#"];function iB(n){return nB.some(e=>n.startsWith(e))}o(iB,"isXSDDatatypeIRI");var sB=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function lI(n){let e=sB.exec(n);return e?e[1].toLowerCase():null}o(lI,"extractUid");function aB(n,e,t,r){let i=new Map,s=new Map;for(let l of n){let{subject:u,predicate:f,object:d}=l;if(u.type!=="iri"||f.type!=="iri"||d.type!=="iri"&&d.type!=="literal")continue;let h=u.value,p=f.value,y=d;if(p===e.typePredicateIRI||p===eB){if(y.type==="iri"){let v=i.get(h)??[];v.push(y.value),i.set(h,v);let w=lI(h);if(w){let T=`uid:${w}`,C=i.get(T)??[];C.push(y.value),i.set(T,C)}}}else{let v=s.get(h);v||(v=new Map,s.set(h,v));let w=v.get(p)??[];w.push(y),v.set(p,w)}}let a=[],c=new Set([...i.keys(),...s.keys()]);for(let l of c){let u=i.get(l)??[],f=s.get(l)??new Map;for(let d of e.getAllShapes()){if(!(d.domain.length===0||d.domain.some(y=>u.some(S=>S===y||t.isSubClassOf(S,y)))))continue;let p=f.get(d.propertyIRI)??[];if(d.minCount!==void 0&&d.minCount>0&&p.length<d.minCount){a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:minCount violation: expected at least ${d.minCount} value(s) for <${d.propertyIRI}>`});continue}if(p.length!==0){if(d.cardinality==="Single"&&p.length>1){a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:maxCount violation: expected at most 1 value for <${d.propertyIRI}>, got ${p.length}`});continue}if(d.range&&d.range.length>0){for(let y of p)if(y.type==="iri"){if(rB(y.value))continue;let S=i.get(y.value)??[];if(S.length===0){let w=lI(y.value);w&&(S=i.get(`uid:${w}`)??[])}d.range.some(w=>S.some(T=>T===w||t.isSubClassOf(T,w)))||a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:class violation: <${y.value}> does not conform to expected class ${d.range.join(" | ")}`,actualValue:y.value,expectedRange:d.range.join(" | ")})}else if(y.type==="literal"){let S=d.range.filter(T=>iB(T));if(S.length===0)continue;let v=y.datatype??"http://www.w3.org/2001/XMLSchema#string";S.some(T=>T===v)||a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:datatype violation: literal "${y.value}" has datatype <${v}>, expected ${S.join(" | ")}`,actualValue:y.value,expectedRange:S.join(" | ")})}}}}}if(r?.closedWorldMode)for(let l of c){let u=s.get(l)??new Map;for(let f of u.keys())e.hasShape(f)||a.push({focusNode:l,propertyPath:f,severity:"sh:Warning",message:`Unknown property: <${f}> has no registered shape`})}return a.sort((l,u)=>{let f=l.focusNode.localeCompare(u.focusNode);return f!==0?f:l.propertyPath.localeCompare(u.propertyPath)}),{conforms:!a.some(l=>l.severity==="sh:Violation"),violations:a}}o(aB,"validate")});var uI=b(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});Am.ApplicationErrorHandler=void 0;var _w=ps(),oB=hs(),cB=Oa(),bw=class{static{o(this,"ApplicationErrorHandler")}constructor(e={},t,r){this.logger=t,this.notifier=r,this.telemetryHooks=new Set,this.retryConfig={maxRetries:e.maxRetries??3,initialDelayMs:e.initialDelayMs??1e3,backoffMultiplier:e.backoffMultiplier??2,maxDelayMs:e.maxDelayMs??1e4}}handle(e,t){let r=this.ensureApplicationError(e,t);return this.notifier&&this.notifier.error(r.message),this.callTelemetryHooks("onError",r,t),this.formatError(r)}async executeWithRetry(e,t){let r,i=0;for(;i<=this.retryConfig.maxRetries;)try{return await e()}catch(s){if(r=this.ensureApplicationError(s,t),!r.retriable||i>=this.retryConfig.maxRetries)throw this.callTelemetryHooks("onError",r,t),i>=this.retryConfig.maxRetries&&r.retriable&&this.callTelemetryHooks("onRetryExhausted",r,i+1),r;let a=this.calculateDelay(i);this.callTelemetryHooks("onRetry",r,i+1,a),this.logger?.debug(`Retrying after ${a}ms (attempt ${i+1}/${this.retryConfig.maxRetries})`),await this.sleep(a),i++}throw r}registerTelemetryHook(e){this.telemetryHooks.add(e)}unregisterTelemetryHook(e){this.telemetryHooks.delete(e)}ensureApplicationError(e,t){if(e instanceof _w.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends _w.ApplicationError{constructor(){super(...arguments),this.code=i.code,this.retriable=i.retriable,this.guidance=i.guidance}}(e.message,s)}return e}return new class extends _w.ApplicationError{static{o(this,"UnknownError")}constructor(s,a){super(s,{originalError:a.name,...t}),this.code=oB.ErrorCode.UNKNOWN_ERROR,this.retriable=!1,this.guidance="An unexpected error occurred"}}(e.message,e)}formatError(e){let t=[];return t.push(`\u274C ${e.name}: ${e.message}`),e.guidance&&t.push(`\u{1F4A1} ${e.guidance}`),e.context&&Object.keys(e.context).length>0&&t.push(`Context: ${JSON.stringify(e.context,null,2)}`),t.join(`
|
|
448
|
+
\u2022 Contact support if the issue persists`}};vm.ServiceError=lw});var cI=b(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.ServiceError=er.ResourceExhaustedError=er.NotFoundError=er.PermissionError=er.StateTransitionError=er.NetworkError=er.ValidationError=er.ApplicationError=er.ErrorCode=void 0;var UV=hs();Object.defineProperty(er,"ErrorCode",{enumerable:!0,get:o(function(){return UV.ErrorCode},"get")});var qV=ps();Object.defineProperty(er,"ApplicationError",{enumerable:!0,get:o(function(){return qV.ApplicationError},"get")});var WV=tI();Object.defineProperty(er,"ValidationError",{enumerable:!0,get:o(function(){return WV.ValidationError},"get")});var GV=rI();Object.defineProperty(er,"NetworkError",{enumerable:!0,get:o(function(){return GV.NetworkError},"get")});var zV=nI();Object.defineProperty(er,"StateTransitionError",{enumerable:!0,get:o(function(){return zV.StateTransitionError},"get")});var HV=iI();Object.defineProperty(er,"PermissionError",{enumerable:!0,get:o(function(){return HV.PermissionError},"get")});var QV=sI();Object.defineProperty(er,"NotFoundError",{enumerable:!0,get:o(function(){return QV.NotFoundError},"get")});var KV=aI();Object.defineProperty(er,"ResourceExhaustedError",{enumerable:!0,get:o(function(){return KV.ResourceExhaustedError},"get")});var YV=oI();Object.defineProperty(er,"ServiceError",{enumerable:!0,get:o(function(){return YV.ServiceError},"get")})});var fw=b(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});Em.ShapeRegistry=void 0;var uw=class{static{o(this,"ShapeRegistry")}constructor(){this.shapes=new Map}get(e){return this.shapes.get(e)}register(e){this.shapes.set(e.propertyIRI,e)}getAll(){return Array.from(this.shapes.values())}get size(){return this.shapes.size}};Em.ShapeRegistry=uw});var mw=b(ms=>{"use strict";var XV=ms&&ms.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),JV=ms&&ms.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),dw=ms&&ms.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&XV(t,e,r[i]);return JV(t,e),t}})();Object.defineProperty(ms,"__esModule",{value:!0});ms.ShapeLoader=void 0;var hw=fw(),$o=Ee(),nf=Me(),Hr=ir(),Tm="http://www.w3.org/ns/shacl#",ZV="http://www.w3.org/2001/XMLSchema#",yce=[["exo__",Hr.Namespace.EXO],["ems__",Hr.Namespace.EMS],["exocmd__",Hr.Namespace.EXOCMD],["ims__",Hr.Namespace.IMS],["ztlk__",Hr.Namespace.ZTLK],["ptms__",Hr.Namespace.PTMS],["lit__",Hr.Namespace.LIT],["inbox__",Hr.Namespace.INBOX],["pmbok__",Hr.Namespace.PMBOK]],pw=class n{static{o(this,"ShapeLoader")}static async loadFromVaultFS(e){let{readdir:t,readFile:r}=await Promise.resolve().then(()=>dw(require("fs/promises"))),i=await Promise.resolve().then(()=>dw(require("path"))),s=new hw.ShapeRegistry;return await n.scanDir(e,s,{readdir:t,readFile:r,path:i}),s}static async loadFromRDFGraph(e){let t=new hw.ShapeRegistry,r=Hr.Namespace.EXO,i=Hr.Namespace.RDFS,s=Hr.Namespace.RDF,[a,c]=await Promise.all([e.match(void 0,s.term("type"),r.term("ObjectProperty")),e.match(void 0,s.term("type"),r.term("Property"))]),l=new Set;for(let u of[...a,...c])u.subject instanceof $o.IRI&&l.add(u.subject.value);for(let u of l){let f;try{f=new $o.IRI(u)}catch{continue}let[d,h,p,y,S,v,w,T,C]=await Promise.all([e.match(f,i.term("domain"),void 0),e.match(f,r.term("Property_domain"),void 0),e.match(f,i.term("range"),void 0),e.match(f,r.term("Property_range"),void 0),e.match(f,r.term("Property_cardinality"),void 0),e.match(f,r.term("Property_severity"),void 0),e.match(f,r.term("Asset_label"),void 0),e.match(f,i.term("label"),void 0),e.match(f,r.term("Property_minCount"),void 0)]),L=[...w,...T],$=[...d,...h],ee=[...p,...y];if($.length===0)continue;let B=null;for(let ie of L)if(ie.object instanceof nf.Literal&&(B=n.labelToIRI(ie.object.value),B))break;if(!B)continue;let G=await Promise.all($.map(async ie=>ie.object instanceof $o.IRI?await n.resolveClassIRI(ie.object.value,e):null)),F=Array.from(new Set(G.filter(ie=>ie!==null))),D=await Promise.all(ee.map(async ie=>{if(ie.object instanceof $o.IRI)return await n.resolveClassIRI(ie.object.value,e);if(ie.object instanceof nf.Literal){let Z=ie.object.value;if(Z.startsWith("http://")||Z.startsWith("https://"))return Z}return null})),W=Array.from(new Set(D.filter(ie=>ie!==null))),De=n.cardinalityFromIRI(S[0]?.object instanceof $o.IRI?S[0].object.value:void 0),et=n.severityFromValue(v[0]?.object instanceof nf.Literal||v[0]?.object instanceof $o.IRI?v[0].object.value:void 0),ut=C[0]?.object,ae=ut instanceof nf.Literal?parseInt(ut.value,10):NaN,Ze=isNaN(ae)?void 0:ae;t.register({propertyIRI:B,domain:F,range:W.length>0?W:void 0,cardinality:De,severity:et,minCount:Ze})}return t}static async loadFromShapeJSON(e){let{readFile:t}=await Promise.resolve().then(()=>dw(require("fs/promises"))),r=await t(e,"utf-8"),i=JSON.parse(r),s=new hw.ShapeRegistry;for(let a of Object.values(i.shapes))s.register(a);return s}static async resolveClassIRI(e,t){if(e.startsWith("https://exocortex.my/ontology/")||e.startsWith("http://www.w3.org/"))return e;let r;try{r=new $o.IRI(e)}catch{return null}let i=Hr.Namespace.RDFS,s=Hr.Namespace.EXO,[a,c]=await Promise.all([t.match(r,i.term("label"),void 0),t.match(r,s.term("Asset_label"),void 0)]);for(let l of[...a,...c])if(l.object instanceof nf.Literal){let u=n.labelToIRI(l.object.value);if(u)return u}return e}static async scanDir(e,t,r){let i;try{i=await r.readdir(e,{withFileTypes:!0})}catch{return}for(let s of i){let a=r.path.join(e,s.name);if(s.isDirectory())await n.scanDir(a,t,r);else if(s.isFile()&&s.name.endsWith(".md"))try{await n.processFile(a,t,r.readFile,r.path)}catch{}}}static async processFile(e,t,r,i){let s;try{s=await r(e,"utf-8")}catch{return}let a=n.parseFrontmatter(s);if(!a)return;let c="38277bfa-d7f9-4a75-b856-b23276ab0db3",l="9a1cf31c-9d41-4ef3-9023-584a8d087d16";if(!n.asArray(a.exo__Instance_class).some(F=>{let D=n.extractWikilinkRef(F);return D==="exo__Property"||D==="exo__ObjectProperty"||D===c||D===l||D?.includes("|exo__Property")||D?.includes("|exo__ObjectProperty")}))return;let d=null,h=a.exo__Asset_label;if(typeof h=="string"&&h.trim().length>0)d=h.trim();else if(i){let F=i.basename(e,".md");Hr.Namespace.fromPropertyKey(F)&&(d=F)}if(!d)return;let p=n.labelToIRI(d);if(!p)return;let y=a.exo__Property_domain,S=a.exo__Property_range,v=a.exo__Property_cardinality,w=a.exo__Property_severity,T=a.exo__Property_minCount,C=n.asArray(y).map(F=>n.wikilinkToIRI(F)).filter(F=>F!==null);if(C.length===0)return;let L=n.asArray(S).map(F=>n.wikilinkToIRI(F)).filter(F=>F!==null),$=n.cardinalityFromLabel(typeof v=="string"?v:void 0),ee=n.severityFromValue(typeof w=="string"?w:void 0),B=typeof T=="string"?parseInt(T,10):void 0,G=B!==void 0&&!isNaN(B)?B:void 0;t.register({propertyIRI:p,domain:C,range:L.length>0?L:void 0,cardinality:$,severity:ee,minCount:G})}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let r=t[1],i={},s=r.split(/\r?\n/),a=null,c=null;for(let l of s){let u=/^ {2}- (.*)$/.exec(l);if(u){a&&c&&c.push(u[1].trim());continue}a&&c&&(i[a]=c,a=null,c=null);let f=/^([^:]+):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(a=d,c=[]):i[d]=h}return a&&c&&(i[a]=c),i}static labelToIRI(e){let t=Hr.Namespace.fromPropertyKey(e);if(!t)return null;try{return t.namespace.term(t.localName).value}catch{return null}}static extractWikilinkRef(e){let t=e.replace(/^["']|["']$/g,""),r=/\[\[([^\]]+)\]\]/.exec(t);return r?r[1]:t}static wikilinkToIRI(e){let t=n.extractWikilinkRef(e);if(!t)return null;let r=t.split("|"),i=r.length>1?[r[1],r[0]]:[r[0]];for(let s of i){let a=n.labelToIRI(s.trim());if(a)return a}return t.startsWith("http")?t:t.startsWith("sh:")?Tm+t.substring(3):t.startsWith("xsd:")?ZV+t.substring(4):null}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static cardinalityFromIRI(e){if(e){if(e.endsWith("PropertyCardinalitySingle"))return"Single";if(e.endsWith("PropertyCardinalityMultiple"))return"Multiple"}}static cardinalityFromLabel(e){if(!e)return;let t=n.extractWikilinkRef(e)??e,r=t.split("|").pop()??t;if(r.includes("Single"))return"Single";if(r.includes("Multiple"))return"Multiple"}static severityFromValue(e){return!e||e.includes("Violation")||e===Tm+"Violation"?"sh:Violation":e.includes("Warning")||e===Tm+"Warning"?"sh:Warning":e.includes("Info")||e===Tm+"Info"?"sh:Info":"sh:Violation"}};ms.ShapeLoader=pw});var yw=b(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.ShapeRegistry=void 0;sf.validate=aB;var gw=class{static{o(this,"ShapeRegistry")}constructor(e=[],t="https://exocortex.my/ontology/exo#Instance_class"){this.shapeMap=new Map(e.map(r=>[r.propertyIRI,r])),this.typePredicateIRI=t}getShape(e){return this.shapeMap.get(e)}getAllShapes(){return Array.from(this.shapeMap.values())}hasShape(e){return this.shapeMap.has(e)}};sf.ShapeRegistry=gw;var eB="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",tB=["http://www.w3.org/2001/XMLSchema#","http://www.w3.org/1999/02/22-rdf-syntax-ns#","http://www.w3.org/2000/01/rdf-schema#","http://www.w3.org/2002/07/owl#","http://www.w3.org/2004/02/skos/core#","http://purl.org/dc/elements/1.1/","http://purl.org/dc/terms/","http://xmlns.com/foaf/0.1/","https://schema.org/","https://exocortex.my/ontology/xsd#","https://exocortex.my/ontology/rdf#","https://exocortex.my/ontology/rdfs#","https://exocortex.my/ontology/owl#","https://exocortex.my/ontology/skos#"];function rB(n){return tB.some(e=>n.startsWith(e))}o(rB,"isExternalOntologyIRI");var nB=["http://www.w3.org/2001/XMLSchema#","https://exocortex.my/ontology/xsd#"];function iB(n){return nB.some(e=>n.startsWith(e))}o(iB,"isXSDDatatypeIRI");var sB=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function lI(n){let e=sB.exec(n);return e?e[1].toLowerCase():null}o(lI,"extractUid");function aB(n,e,t,r){let i=new Map,s=new Map;for(let l of n){let{subject:u,predicate:f,object:d}=l;if(u.type!=="iri"||f.type!=="iri"||d.type!=="iri"&&d.type!=="literal")continue;let h=u.value,p=f.value,y=d;if(p===e.typePredicateIRI||p===eB){if(y.type==="iri"){let v=i.get(h)??[];v.push(y.value),i.set(h,v);let w=lI(h);if(w){let T=`uid:${w}`,C=i.get(T)??[];C.push(y.value),i.set(T,C)}}}else{let v=s.get(h);v||(v=new Map,s.set(h,v));let w=v.get(p)??[];w.push(y),v.set(p,w)}}let a=[],c=new Set([...i.keys(),...s.keys()]);for(let l of c){let u=i.get(l)??[],f=s.get(l)??new Map;for(let d of e.getAllShapes()){if(!(d.domain.length===0||d.domain.some(y=>u.some(S=>S===y||t.isSubClassOf(S,y)))))continue;let p=f.get(d.propertyIRI)??[];if(d.minCount!==void 0&&d.minCount>0&&p.length<d.minCount){a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:minCount violation: expected at least ${d.minCount} value(s) for <${d.propertyIRI}>`});continue}if(p.length!==0){if(d.cardinality==="Single"&&p.length>1){a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:maxCount violation: expected at most 1 value for <${d.propertyIRI}>, got ${p.length}`});continue}if(d.range&&d.range.length>0){for(let y of p)if(y.type==="iri"){if(rB(y.value))continue;let S=i.get(y.value)??[];if(S.length===0){let w=lI(y.value);w&&(S=i.get(`uid:${w}`)??[])}d.range.some(w=>S.some(T=>T===w||t.isSubClassOf(T,w)))||a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:class violation: <${y.value}> does not conform to expected class ${d.range.join(" | ")}`,actualValue:y.value,expectedRange:d.range.join(" | ")})}else if(y.type==="literal"){let S=d.range.filter(T=>iB(T));if(S.length===0)continue;let v=y.datatype??"http://www.w3.org/2001/XMLSchema#string";S.some(T=>T===v)||a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:datatype violation: literal "${y.value}" has datatype <${v}>, expected ${S.join(" | ")}`,actualValue:y.value,expectedRange:S.join(" | ")})}}}}}if(r?.closedWorldMode)for(let l of c){let u=s.get(l)??new Map;for(let f of u.keys())e.hasShape(f)||a.push({focusNode:l,propertyPath:f,severity:"sh:Warning",message:`Unknown property: <${f}> has no registered shape`})}return a.sort((l,u)=>{let f=l.focusNode.localeCompare(u.focusNode);return f!==0?f:l.propertyPath.localeCompare(u.propertyPath)}),{conforms:!a.some(l=>l.severity==="sh:Violation"),violations:a}}o(aB,"validate")});var uI=b(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});Am.ApplicationErrorHandler=void 0;var _w=ps(),oB=hs(),cB=Oa(),bw=class{static{o(this,"ApplicationErrorHandler")}constructor(e={},t,r){this.logger=t,this.notifier=r,this.telemetryHooks=new Set,this.retryConfig={maxRetries:e.maxRetries??3,initialDelayMs:e.initialDelayMs??1e3,backoffMultiplier:e.backoffMultiplier??2,maxDelayMs:e.maxDelayMs??1e4}}handle(e,t){let r=this.ensureApplicationError(e,t);return this.notifier&&this.notifier.error(r.message),this.callTelemetryHooks("onError",r,t),this.formatError(r)}async executeWithRetry(e,t){let r,i=0;for(;i<=this.retryConfig.maxRetries;)try{return await e()}catch(s){if(r=this.ensureApplicationError(s,t),!r.retriable||i>=this.retryConfig.maxRetries)throw this.callTelemetryHooks("onError",r,t),i>=this.retryConfig.maxRetries&&r.retriable&&this.callTelemetryHooks("onRetryExhausted",r,i+1),r;let a=this.calculateDelay(i);this.callTelemetryHooks("onRetry",r,i+1,a),this.logger?.debug(`Retrying after ${a}ms (attempt ${i+1}/${this.retryConfig.maxRetries})`),await this.sleep(a),i++}throw r}registerTelemetryHook(e){this.telemetryHooks.add(e)}unregisterTelemetryHook(e){this.telemetryHooks.delete(e)}ensureApplicationError(e,t){if(e instanceof _w.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends _w.ApplicationError{constructor(){super(...arguments),this.code=i.code,this.retriable=i.retriable,this.guidance=i.guidance}}(e.message,s)}return e}return new class extends _w.ApplicationError{static{o(this,"UnknownError")}constructor(s,a){super(s,{originalError:a.name,...t}),this.code=oB.ErrorCode.UNKNOWN_ERROR,this.retriable=!1,this.guidance="An unexpected error occurred"}}(e.message,e)}formatError(e){let t=[];return t.push(`\u274C ${e.name}: ${e.message}`),e.guidance&&t.push(`\u{1F4A1} ${e.guidance}`),e.context&&Object.keys(e.context).length>0&&t.push(`Context: ${JSON.stringify(e.context,null,2)}`),t.join(`
|
|
449
449
|
`)}calculateDelay(e){let t=this.retryConfig.initialDelayMs*Math.pow(this.retryConfig.backoffMultiplier,e);return Math.min(t,this.retryConfig.maxDelayMs)}sleep(e){return new Promise(t=>setTimeout(t,e))}callTelemetryHooks(e,...t){for(let r of this.telemetryHooks)try{let i=r[e];i&&i.apply(r,t)}catch(i){cB.LoggingService.error("Error in telemetry hook",i instanceof Error?i:new Error(String(i)))}}};Am.ApplicationErrorHandler=bw});var fI=b(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});xm.ApplicationErrorHandler=void 0;var lB=uI();Object.defineProperty(xm,"ApplicationErrorHandler",{enumerable:!0,get:o(function(){return lB.ApplicationErrorHandler},"get")})});var ww=b(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});Im.ClassHierarchy=void 0;var uB="http://www.w3.org/2000/01/rdf-schema#subClassOf",Sw=class{static{o(this,"ClassHierarchy")}constructor(e){this.adjacency=new Map;for(let t of e){if(t.predicate.type!=="iri"||t.predicate.value!==uB||t.subject.type!=="iri"||t.object.type!=="iri")continue;let r=t.subject.value,i=t.object.value,s=this.adjacency.get(r);s||(s=new Set,this.adjacency.set(r,s)),s.add(i)}}isSubClassOf(e,t){if(e===t)return!0;let r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(r.has(s))continue;r.add(s);let a=this.adjacency.get(s);if(a)for(let c of a){if(c===t)return!0;r.has(c)||i.push(c)}}return!1}getAncestors(e){let t=new Set,r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(r.has(s))continue;r.add(s);let a=this.adjacency.get(s);if(a)for(let c of a)t.add(c),r.has(c)||i.push(c)}return t}};Im.ClassHierarchy=Sw});var hI=b(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.ValidatorDaemon=gs.IDLE_TIMEOUT_MS=gs.DEFAULT_SOCKET_PATH=void 0;var dI=yw(),fB=mw(),dB=ww();gs.DEFAULT_SOCKET_PATH=typeof process<"u"&&process.env?`${process.env.HOME??process.env.USERPROFILE??"/tmp"}/.cache/exocortex/validator.sock`:"/tmp/.cache/exocortex/validator.sock";gs.IDLE_TIMEOUT_MS=300*1e3;var vw=class{static{o(this,"ValidatorDaemon")}constructor(e=gs.DEFAULT_SOCKET_PATH,t=gs.IDLE_TIMEOUT_MS){this.registryCache=new Map,this.server=null,this.idleTimer=null,this.socketPath=e,this.idleTimeoutMs=t}async start(){let e=require("net"),t=require("fs/promises"),r=require("path");await t.mkdir(r.dirname(this.socketPath),{recursive:!0});try{await t.unlink(this.socketPath)}catch{}this.server=e.createServer(a=>{this.handleConnection(a)});let i=this.server;await new Promise((a,c)=>{i.on("error",c),i.listen(this.socketPath,a)}),this.resetIdleTimer();let s=o(()=>{this.stop()},"handleSignal");process.once("SIGTERM",s),process.once("SIGINT",s)}async stop(){if(this.idleTimer!==null&&(clearTimeout(this.idleTimer),this.idleTimer=null),!this.server)return;let e=this.server;this.server=null,await new Promise(t=>{e.close(()=>t())})}resetIdleTimer(){this.idleTimer!==null&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{process.exit(0)},this.idleTimeoutMs)}handleConnection(e){let t="";e.setEncoding("utf-8"),e.on("data",r=>{t+=r;let i=t.split(`
|
|
450
450
|
`);t=i.pop()??"";for(let s of i){let a=s.trim();a&&this.handleRequest(a,e)}}),e.on("error",()=>{e.destroy()})}async handleRequest(e,t){this.resetIdleTimer();let r;try{let i=JSON.parse(e),s=await this.getRegistry(i.registryPath),a=new dB.ClassHierarchy(i.subclassTriples??[]);r={report:(0,dI.validate)(i.triples,s,a,{closedWorldMode:i.closedWorldMode})}}catch(i){r={error:i instanceof Error?i.message:String(i)}}t.destroyed||t.write(JSON.stringify(r)+`
|
|
451
451
|
`)}async getRegistry(e){let t=this.registryCache.get(e);if(t)return t;let r=await fB.ShapeLoader.loadFromShapeJSON(e),i=new dI.ShapeRegistry(r.getAll());return this.registryCache.set(e,i),i}};gs.ValidatorDaemon=vw});var fr=b(m=>{"use strict";var hB=m&&m.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),ti=m&&m.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hB(e,n,t)};Object.defineProperty(m,"__esModule",{value:!0});m.AlgorithmExtractor=m.DynamicFrontmatterGenerator=m.SupervisionCreationService=m.StatusTimestampService=m.RenameToUidService=m.PropertyCleanupService=m.LoggingService=m.LabelToAliasService=m.FolderRepairService=m.EffortVotingService=m.WorkflowCommandAdapter=m.VisibilityGenerator=m.InstantiationRuleResolver=m.WorkflowResolver=m.WorkflowEngine=m.EffortStatusWorkflow=m.ConceptCreationService=m.ClassCreationService=m.AreaHierarchyBuilder=m.AreaCreationService=m.TaskStatusService=m.CommandExecutionFlow=m.ServiceRegistry=m.GroundingExecutor=m.registerDefaultHostFunctions=m.hasNonUidFilename=m.PreconditionEvaluator=m.CommandResolver=m.extractPropertyLabel=m.uriToPropertyName=m.propertyNameToUri=m.rangeToFieldType=m.PropertyFieldType=m.isCommandBindingFrontmatter=m.isGroundingFrontmatter=m.isPreconditionFrontmatter=m.isCommandFrontmatter=m.isStyleSource=m.isLabelClass=m.isCommandVariant=m.STYLE_SOURCE_VALUES=m.LABEL_CLASS_VALUES=m.COMMAND_VARIANT_VALUES=m.CommandBindingStyleProperty=m.CommandBindingProperty=m.GroundingProperty=m.PreconditionProperty=m.CommandProperty=m.GroundingType=m.EFFORT_STATUS_OPTIONS=void 0;m.INFERRED_GRAPH=m.PrototypeChainMaterializer=m.PropertyCardinalityRegistry=m.NonInheritablePropertyRegistry=m.RDFSInferenceEngine=m.RDFVocabularyMapper=m.DomainTriple=m.DomainBlankNode=m.DomainLiteral=m.DomainIRI=m.InMemoryTripleStore=m.OBSIDIAN_VAULT_SCHEME=m.vaultPathToIRI=m.NullLogger=m.RDFSerializer=m.FilenameValidator=m.EffortSortingHelpers=m.MetadataExtractor=m.MetadataHelpers=m.WikiLinkHelpers=m.DateFormatter=m.FrontmatterService=m.CriticalityZoneUUIDs=m.CriticalityZoneService=m.getTemplateByName=m.validateParameters=m.fillTemplate=m.findMatchingTemplates=m.findClassByTerm=m.KNOWN_CLASSES=m.KNOWN_PROTOTYPES=m.EFFORT_STATUSES=m.ASSET_CLASSES=m.PREDICATES=m.SPARQL_PREFIXES=m.SPARQL_TEMPLATES=m.DEFAULT_NL_TO_SPARQL_CONFIG=m.NLToSPARQLService=m.TypeRegistry=m.GraphQueryService=m.FixMissingLabelService=m.ArchiveAssetService=m.GenericAssetCreationService=m.URIConstructionService=m.SessionEventService=m.AssetConversionService=m.EnumValueResolver=m.ClassHierarchyResolver=m.PropertySchemaResolver=m.PlanningService=void 0;m.TripleAlreadyExistsError=m.FileAlreadyExistsError=m.FileNotFoundError=m.FilterContainsOptimizer=m.VaultPrefixTransformer=m.CaseWhenTransformerError=m.CaseWhenTransformer=m.ResultSerializer=m.createIncrementalIndexer=m.IncrementalIndexer=m.createSPARQLResultCache=m.SPARQLResultCache=m.QueryPlanCache=m.createDoubleLiteral=m.createDecimalLiteral=m.getNumericValue=m.createPercentileAggregate=m.modeAggregate=m.stddevAggregate=m.varianceAggregate=m.medianAggregate=m.EXO_AGGREGATE_NS=m.BUILT_IN_AGGREGATES=m.CustomAggregateError=m.CustomAggregateRegistry=m.AggregateFunctions=m.BuiltInFunctions=m.SolutionMapping=m.UpdateExecutorError=m.UpdateExecutor=m.QueryExecutor=m.ExoQLQueryExecutor=m.DescribeExecutor=m.ConstructExecutor=m.UnionExecutor=m.OptionalExecutor=m.FilterExecutor=m.BGPExecutor=m.AlgebraSerializer=m.AlgebraOptimizer=m.AlgebraTranslator=m.ExoQLAlgebraTranslator=m.DescribeOptionsTransformerError=m.DescribeOptionsTransformer=m.SPARQLParseError=m.SPARQLParser=m.ExoQLParser=m.NoteToRDFConverter=m.SOURCE_VARIABLE=m.SourceAnnotator=void 0;m.ShapeLoader=m.selectByPriority=m.LayoutSelector=m.isPropertiesBlock=m.isLayoutBlockFrontmatter=m.isBacklinksTableBlock=m.createLayoutBlockFromFrontmatter=m.PROPERTIES_BLOCK_CLASS_UID=m.PROPERTIES_BLOCK_CLASS_IRI=m.BACKLINKS_TABLE_BLOCK_CLASS_UID=m.BACKLINKS_TABLE_BLOCK_CLASS_IRI=m.isLayoutFrontmatter=m.isLayout=m.createLayoutFromFrontmatter=m.LAYOUT_CLASS_UID=m.LAYOUT_CLASS_IRI=m.RelationColumnSetResolver=m.normalizeRelationColumnSetRef=m.isRelationColumnSetFrontmatter=m.isRelationColumnSet=m.createRelationColumnSetFromFrontmatter=m.RELATION_COLUMN_SET_CLASS_UID=m.RELATION_COLUMN_SET_CLASS_IRI=m.ExoQLError=m.ExoQL=m.createStreamingSource=m.StreamingLoader=m.resetGlobalPool=m.getGlobalPool=m.MemoryPool=m.CompactGraphStore=m.StringTable=m.DEFAULT_COLORS=m.NODE_FLAGS=m.container=m.resetContainer=m.getContainer=m.createChildContainer=m.registerCoreServices=m.DI_TOKENS=m.DEFAULT_FLEETING_NOTE_CLASS_UID=m.DEFAULT_INBOX_FOLDER=m.DEFAULT_OWNER_IDENTITY=m.VaultSettings=m.seededUidGenerator=m.liveUidGenerator=m.frozenClock=m.liveClock=m.TransactionError=m.TripleNotFoundError=void 0;m.TripleClassHierarchy=m.IDLE_TIMEOUT_MS=m.DEFAULT_SOCKET_PATH=m.ValidatorDaemon=m.ShaclShapeRegistry=m.shaclValidate=m.Namespace=m.ShapeRegistry=void 0;ti(lu(),m);ti(uu(),m);var pB=Ly();Object.defineProperty(m,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return pB.EFFORT_STATUS_OPTIONS},"get")});var mB=uo();Object.defineProperty(m,"GroundingType",{enumerable:!0,get:o(function(){return mB.GroundingType},"get")});var af=ky();Object.defineProperty(m,"CommandProperty",{enumerable:!0,get:o(function(){return af.CommandProperty},"get")});Object.defineProperty(m,"PreconditionProperty",{enumerable:!0,get:o(function(){return af.PreconditionProperty},"get")});Object.defineProperty(m,"GroundingProperty",{enumerable:!0,get:o(function(){return af.GroundingProperty},"get")});Object.defineProperty(m,"CommandBindingProperty",{enumerable:!0,get:o(function(){return af.CommandBindingProperty},"get")});Object.defineProperty(m,"CommandBindingStyleProperty",{enumerable:!0,get:o(function(){return af.CommandBindingStyleProperty},"get")});var hl=jy();Object.defineProperty(m,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:o(function(){return hl.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(m,"LABEL_CLASS_VALUES",{enumerable:!0,get:o(function(){return hl.LABEL_CLASS_VALUES},"get")});Object.defineProperty(m,"STYLE_SOURCE_VALUES",{enumerable:!0,get:o(function(){return hl.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(m,"isCommandVariant",{enumerable:!0,get:o(function(){return hl.isCommandVariant},"get")});Object.defineProperty(m,"isLabelClass",{enumerable:!0,get:o(function(){return hl.isLabelClass},"get")});Object.defineProperty(m,"isStyleSource",{enumerable:!0,get:o(function(){return hl.isStyleSource},"get")});var Cm=RE();Object.defineProperty(m,"isCommandFrontmatter",{enumerable:!0,get:o(function(){return Cm.isCommandFrontmatter},"get")});Object.defineProperty(m,"isPreconditionFrontmatter",{enumerable:!0,get:o(function(){return Cm.isPreconditionFrontmatter},"get")});Object.defineProperty(m,"isGroundingFrontmatter",{enumerable:!0,get:o(function(){return Cm.isGroundingFrontmatter},"get")});Object.defineProperty(m,"isCommandBindingFrontmatter",{enumerable:!0,get:o(function(){return Cm.isCommandBindingFrontmatter},"get")});ti(OE(),m);ti(PE(),m);ti(My(),m);ti($y(),m);ti(DE(),m);ti(kE(),m);ti(S0(),m);ti(TT(),m);var pI=Kd();Object.defineProperty(m,"PropertyFieldType",{enumerable:!0,get:o(function(){return pI.PropertyFieldType},"get")});Object.defineProperty(m,"rangeToFieldType",{enumerable:!0,get:o(function(){return pI.rangeToFieldType},"get")});var Ew=T0();Object.defineProperty(m,"propertyNameToUri",{enumerable:!0,get:o(function(){return Ew.propertyNameToUri},"get")});Object.defineProperty(m,"uriToPropertyName",{enumerable:!0,get:o(function(){return Ew.uriToPropertyName},"get")});Object.defineProperty(m,"extractPropertyLabel",{enumerable:!0,get:o(function(){return Ew.extractPropertyLabel},"get")});var gB=tA();Object.defineProperty(m,"CommandResolver",{enumerable:!0,get:o(function(){return gB.CommandResolver},"get")});var yB=nA();Object.defineProperty(m,"PreconditionEvaluator",{enumerable:!0,get:o(function(){return yB.PreconditionEvaluator},"get")});var mI=iA();Object.defineProperty(m,"hasNonUidFilename",{enumerable:!0,get:o(function(){return mI.hasNonUidFilename},"get")});Object.defineProperty(m,"registerDefaultHostFunctions",{enumerable:!0,get:o(function(){return mI.registerDefaultHostFunctions},"get")});var gI=cA();Object.defineProperty(m,"GroundingExecutor",{enumerable:!0,get:o(function(){return gI.GroundingExecutor},"get")});Object.defineProperty(m,"ServiceRegistry",{enumerable:!0,get:o(function(){return gI.ServiceRegistry},"get")});var _B=lA();Object.defineProperty(m,"CommandExecutionFlow",{enumerable:!0,get:o(function(){return _B.CommandExecutionFlow},"get")});var bB=Y1();Object.defineProperty(m,"TaskStatusService",{enumerable:!0,get:o(function(){return bB.TaskStatusService},"get")});var SB=eb();Object.defineProperty(m,"AreaCreationService",{enumerable:!0,get:o(function(){return SB.AreaCreationService},"get")});var wB=rb();Object.defineProperty(m,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return wB.AreaHierarchyBuilder},"get")});var vB=ib();Object.defineProperty(m,"ClassCreationService",{enumerable:!0,get:o(function(){return vB.ClassCreationService},"get")});var EB=ab();Object.defineProperty(m,"ConceptCreationService",{enumerable:!0,get:o(function(){return EB.ConceptCreationService},"get")});var TB=Rp();Object.defineProperty(m,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return TB.EffortStatusWorkflow},"get")});var AB=qu();Object.defineProperty(m,"WorkflowEngine",{enumerable:!0,get:o(function(){return AB.WorkflowEngine},"get")});var xB=M1();Object.defineProperty(m,"WorkflowResolver",{enumerable:!0,get:o(function(){return xB.WorkflowResolver},"get")});var IB=EA();Object.defineProperty(m,"InstantiationRuleResolver",{enumerable:!0,get:o(function(){return IB.InstantiationRuleResolver},"get")});var CB=TA();Object.defineProperty(m,"VisibilityGenerator",{enumerable:!0,get:o(function(){return CB.VisibilityGenerator},"get")});var RB=AA();Object.defineProperty(m,"WorkflowCommandAdapter",{enumerable:!0,get:o(function(){return RB.WorkflowCommandAdapter},"get")});var OB=hb();Object.defineProperty(m,"EffortVotingService",{enumerable:!0,get:o(function(){return OB.EffortVotingService},"get")});var PB=mb();Object.defineProperty(m,"FolderRepairService",{enumerable:!0,get:o(function(){return PB.FolderRepairService},"get")});var FB=yb();Object.defineProperty(m,"LabelToAliasService",{enumerable:!0,get:o(function(){return FB.LabelToAliasService},"get")});var DB=Oa();Object.defineProperty(m,"LoggingService",{enumerable:!0,get:o(function(){return DB.LoggingService},"get")});var NB=Sb();Object.defineProperty(m,"PropertyCleanupService",{enumerable:!0,get:o(function(){return NB.PropertyCleanupService},"get")});var LB=vb();Object.defineProperty(m,"RenameToUidService",{enumerable:!0,get:o(function(){return LB.RenameToUidService},"get")});var kB=Pp();Object.defineProperty(m,"StatusTimestampService",{enumerable:!0,get:o(function(){return kB.StatusTimestampService},"get")});var jB=Ab();Object.defineProperty(m,"SupervisionCreationService",{enumerable:!0,get:o(function(){return jB.SupervisionCreationService},"get")});var MB=Ib();Object.defineProperty(m,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return MB.DynamicFrontmatterGenerator},"get")});var $B=Rb();Object.defineProperty(m,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return $B.AlgorithmExtractor},"get")});var VB=Pb();Object.defineProperty(m,"PlanningService",{enumerable:!0,get:o(function(){return VB.PlanningService},"get")});var BB=kA();Object.defineProperty(m,"PropertySchemaResolver",{enumerable:!0,get:o(function(){return BB.PropertySchemaResolver},"get")});var UB=jA();Object.defineProperty(m,"ClassHierarchyResolver",{enumerable:!0,get:o(function(){return UB.ClassHierarchyResolver},"get")});var qB=MA();Object.defineProperty(m,"EnumValueResolver",{enumerable:!0,get:o(function(){return qB.EnumValueResolver},"get")});var WB=kb();Object.defineProperty(m,"AssetConversionService",{enumerable:!0,get:o(function(){return WB.AssetConversionService},"get")});var GB=$b();Object.defineProperty(m,"SessionEventService",{enumerable:!0,get:o(function(){return GB.SessionEventService},"get")});var zB=Ub();Object.defineProperty(m,"URIConstructionService",{enumerable:!0,get:o(function(){return zB.URIConstructionService},"get")});var HB=Wb();Object.defineProperty(m,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return HB.GenericAssetCreationService},"get")});var QB=QA();Object.defineProperty(m,"ArchiveAssetService",{enumerable:!0,get:o(function(){return QB.ArchiveAssetService},"get")});var KB=YA();Object.defineProperty(m,"FixMissingLabelService",{enumerable:!0,get:o(function(){return KB.FixMissingLabelService},"get")});var YB=XA();Object.defineProperty(m,"GraphQueryService",{enumerable:!0,get:o(function(){return YB.GraphQueryService},"get")});var XB=ZA();Object.defineProperty(m,"TypeRegistry",{enumerable:!0,get:o(function(){return XB.TypeRegistry},"get")});var yI=ex();Object.defineProperty(m,"NLToSPARQLService",{enumerable:!0,get:o(function(){return yI.NLToSPARQLService},"get")});Object.defineProperty(m,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return yI.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var ri=Kb();Object.defineProperty(m,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return ri.SPARQL_TEMPLATES},"get")});Object.defineProperty(m,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return ri.SPARQL_PREFIXES},"get")});Object.defineProperty(m,"PREDICATES",{enumerable:!0,get:o(function(){return ri.PREDICATES},"get")});Object.defineProperty(m,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return ri.ASSET_CLASSES},"get")});Object.defineProperty(m,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return ri.EFFORT_STATUSES},"get")});Object.defineProperty(m,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return ri.KNOWN_PROTOTYPES},"get")});Object.defineProperty(m,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return ri.KNOWN_CLASSES},"get")});Object.defineProperty(m,"findClassByTerm",{enumerable:!0,get:o(function(){return ri.findClassByTerm},"get")});Object.defineProperty(m,"findMatchingTemplates",{enumerable:!0,get:o(function(){return ri.findMatchingTemplates},"get")});Object.defineProperty(m,"fillTemplate",{enumerable:!0,get:o(function(){return ri.fillTemplate},"get")});Object.defineProperty(m,"validateParameters",{enumerable:!0,get:o(function(){return ri.validateParameters},"get")});Object.defineProperty(m,"getTemplateByName",{enumerable:!0,get:o(function(){return ri.getTemplateByName},"get")});var _I=Jb();Object.defineProperty(m,"CriticalityZoneService",{enumerable:!0,get:o(function(){return _I.CriticalityZoneService},"get")});Object.defineProperty(m,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return _I.CriticalityZoneUUIDs},"get")});var JB=as();Object.defineProperty(m,"FrontmatterService",{enumerable:!0,get:o(function(){return JB.FrontmatterService},"get")});var ZB=Rn();Object.defineProperty(m,"DateFormatter",{enumerable:!0,get:o(function(){return ZB.DateFormatter},"get")});var eU=Zi();Object.defineProperty(m,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return eU.WikiLinkHelpers},"get")});var tU=Qs();Object.defineProperty(m,"MetadataHelpers",{enumerable:!0,get:o(function(){return tU.MetadataHelpers},"get")});var rU=J1();Object.defineProperty(m,"MetadataExtractor",{enumerable:!0,get:o(function(){return rU.MetadataExtractor},"get")});var nU=rx();Object.defineProperty(m,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return nU.EffortSortingHelpers},"get")});var iU=nx();Object.defineProperty(m,"FilenameValidator",{enumerable:!0,get:o(function(){return iU.FilenameValidator},"get")});var sU=ux();Object.defineProperty(m,"RDFSerializer",{enumerable:!0,get:o(function(){return sU.RDFSerializer},"get")});var aU=pc();Object.defineProperty(m,"NullLogger",{enumerable:!0,get:o(function(){return aU.NullLogger},"get")});var bI=uS();Object.defineProperty(m,"vaultPathToIRI",{enumerable:!0,get:o(function(){return bI.vaultPathToIRI},"get")});Object.defineProperty(m,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:o(function(){return bI.OBSIDIAN_VAULT_SCHEME},"get")});var oU=z1();Object.defineProperty(m,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return oU.InMemoryTripleStore},"get")});var cU=Ee();Object.defineProperty(m,"DomainIRI",{enumerable:!0,get:o(function(){return cU.IRI},"get")});var lU=Me();Object.defineProperty(m,"DomainLiteral",{enumerable:!0,get:o(function(){return lU.Literal},"get")});var uU=$t();Object.defineProperty(m,"DomainBlankNode",{enumerable:!0,get:o(function(){return uU.BlankNode},"get")});var fU=Yn();Object.defineProperty(m,"DomainTriple",{enumerable:!0,get:o(function(){return fU.Triple},"get")});var dU=dS();Object.defineProperty(m,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return dU.RDFVocabularyMapper},"get")});var hU=dx();Object.defineProperty(m,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return hU.RDFSInferenceEngine},"get")});var pU=gS();Object.defineProperty(m,"NonInheritablePropertyRegistry",{enumerable:!0,get:o(function(){return pU.NonInheritablePropertyRegistry},"get")});var mU=bS();Object.defineProperty(m,"PropertyCardinalityRegistry",{enumerable:!0,get:o(function(){return mU.PropertyCardinalityRegistry},"get")});var SI=vS();Object.defineProperty(m,"PrototypeChainMaterializer",{enumerable:!0,get:o(function(){return SI.PrototypeChainMaterializer},"get")});Object.defineProperty(m,"INFERRED_GRAPH",{enumerable:!0,get:o(function(){return SI.INFERRED_GRAPH},"get")});var wI=TS();Object.defineProperty(m,"SourceAnnotator",{enumerable:!0,get:o(function(){return wI.SourceAnnotator},"get")});Object.defineProperty(m,"SOURCE_VARIABLE",{enumerable:!0,get:o(function(){return wI.SOURCE_VARIABLE},"get")});var gU=xS();Object.defineProperty(m,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return gU.NoteToRDFConverter},"get")});var Tw=Tc();Object.defineProperty(m,"ExoQLParser",{enumerable:!0,get:o(function(){return Tw.ExoQLParser},"get")});Object.defineProperty(m,"SPARQLParser",{enumerable:!0,get:o(function(){return Tw.SPARQLParser},"get")});Object.defineProperty(m,"SPARQLParseError",{enumerable:!0,get:o(function(){return Tw.SPARQLParseError},"get")});var vI=v_();Object.defineProperty(m,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return vI.DescribeOptionsTransformer},"get")});Object.defineProperty(m,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return vI.DescribeOptionsTransformerError},"get")});var EI=xc();Object.defineProperty(m,"ExoQLAlgebraTranslator",{enumerable:!0,get:o(function(){return EI.ExoQLAlgebraTranslator},"get")});Object.defineProperty(m,"AlgebraTranslator",{enumerable:!0,get:o(function(){return EI.AlgebraTranslator},"get")});var yU=vx();Object.defineProperty(m,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return yU.AlgebraOptimizer},"get")});var _U=Ex();Object.defineProperty(m,"AlgebraSerializer",{enumerable:!0,get:o(function(){return _U.AlgebraSerializer},"get")});var bU=V_();Object.defineProperty(m,"BGPExecutor",{enumerable:!0,get:o(function(){return bU.BGPExecutor},"get")});var SU=rp();Object.defineProperty(m,"FilterExecutor",{enumerable:!0,get:o(function(){return SU.FilterExecutor},"get")});var wU=s1();Object.defineProperty(m,"OptionalExecutor",{enumerable:!0,get:o(function(){return wU.OptionalExecutor},"get")});var vU=o1();Object.defineProperty(m,"UnionExecutor",{enumerable:!0,get:o(function(){return vU.UnionExecutor},"get")});var EU=y1();Object.defineProperty(m,"ConstructExecutor",{enumerable:!0,get:o(function(){return EU.ConstructExecutor},"get")});var TU=Ax();Object.defineProperty(m,"DescribeExecutor",{enumerable:!0,get:o(function(){return TU.DescribeExecutor},"get")});var TI=zc();Object.defineProperty(m,"ExoQLQueryExecutor",{enumerable:!0,get:o(function(){return TI.ExoQLQueryExecutor},"get")});Object.defineProperty(m,"QueryExecutor",{enumerable:!0,get:o(function(){return TI.QueryExecutor},"get")});var AI=Ix();Object.defineProperty(m,"UpdateExecutor",{enumerable:!0,get:o(function(){return AI.UpdateExecutor},"get")});Object.defineProperty(m,"UpdateExecutorError",{enumerable:!0,get:o(function(){return AI.UpdateExecutorError},"get")});var AU=rs();Object.defineProperty(m,"SolutionMapping",{enumerable:!0,get:o(function(){return AU.SolutionMapping},"get")});var xU=tp();Object.defineProperty(m,"BuiltInFunctions",{enumerable:!0,get:o(function(){return xU.BuiltInFunctions},"get")});var IU=Rx();Object.defineProperty(m,"AggregateFunctions",{enumerable:!0,get:o(function(){return IU.AggregateFunctions},"get")});var xI=u1();Object.defineProperty(m,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return xI.CustomAggregateRegistry},"get")});Object.defineProperty(m,"CustomAggregateError",{enumerable:!0,get:o(function(){return xI.CustomAggregateError},"get")});var ys=f1();Object.defineProperty(m,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return ys.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(m,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return ys.EXO_AGGREGATE_NS},"get")});Object.defineProperty(m,"medianAggregate",{enumerable:!0,get:o(function(){return ys.medianAggregate},"get")});Object.defineProperty(m,"varianceAggregate",{enumerable:!0,get:o(function(){return ys.varianceAggregate},"get")});Object.defineProperty(m,"stddevAggregate",{enumerable:!0,get:o(function(){return ys.stddevAggregate},"get")});Object.defineProperty(m,"modeAggregate",{enumerable:!0,get:o(function(){return ys.modeAggregate},"get")});Object.defineProperty(m,"createPercentileAggregate",{enumerable:!0,get:o(function(){return ys.createPercentileAggregate},"get")});Object.defineProperty(m,"getNumericValue",{enumerable:!0,get:o(function(){return ys.getNumericValue},"get")});Object.defineProperty(m,"createDecimalLiteral",{enumerable:!0,get:o(function(){return ys.createDecimalLiteral},"get")});Object.defineProperty(m,"createDoubleLiteral",{enumerable:!0,get:o(function(){return ys.createDoubleLiteral},"get")});var CU=Ox();Object.defineProperty(m,"QueryPlanCache",{enumerable:!0,get:o(function(){return CU.QueryPlanCache},"get")});var II=Px();Object.defineProperty(m,"SPARQLResultCache",{enumerable:!0,get:o(function(){return II.SPARQLResultCache},"get")});Object.defineProperty(m,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return II.createSPARQLResultCache},"get")});var CI=Fx();Object.defineProperty(m,"IncrementalIndexer",{enumerable:!0,get:o(function(){return CI.IncrementalIndexer},"get")});Object.defineProperty(m,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return CI.createIncrementalIndexer},"get")});var RU=Dx();Object.defineProperty(m,"ResultSerializer",{enumerable:!0,get:o(function(){return RU.ResultSerializer},"get")});var RI=b_();Object.defineProperty(m,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return RI.CaseWhenTransformer},"get")});Object.defineProperty(m,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return RI.CaseWhenTransformerError},"get")});var OU=x_();Object.defineProperty(m,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return OU.VaultPrefixTransformer},"get")});var PU=CS();Object.defineProperty(m,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return PU.FilterContainsOptimizer},"get")});var OI=Nx();Object.defineProperty(m,"FileNotFoundError",{enumerable:!0,get:o(function(){return OI.FileNotFoundError},"get")});Object.defineProperty(m,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return OI.FileAlreadyExistsError},"get")});var Aw=U1();Object.defineProperty(m,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return Aw.TripleAlreadyExistsError},"get")});Object.defineProperty(m,"TripleNotFoundError",{enumerable:!0,get:o(function(){return Aw.TripleNotFoundError},"get")});Object.defineProperty(m,"TransactionError",{enumerable:!0,get:o(function(){return Aw.TransactionError},"get")});var PI=ju();Object.defineProperty(m,"liveClock",{enumerable:!0,get:o(function(){return PI.liveClock},"get")});Object.defineProperty(m,"frozenClock",{enumerable:!0,get:o(function(){return PI.frozenClock},"get")});var FI=yp();Object.defineProperty(m,"liveUidGenerator",{enumerable:!0,get:o(function(){return FI.liveUidGenerator},"get")});Object.defineProperty(m,"seededUidGenerator",{enumerable:!0,get:o(function(){return FI.seededUidGenerator},"get")});var Rm=BS();Object.defineProperty(m,"VaultSettings",{enumerable:!0,get:o(function(){return Rm.VaultSettings},"get")});Object.defineProperty(m,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:o(function(){return Rm.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(m,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:o(function(){return Rm.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(m,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:o(function(){return Rm.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var FU=Ct();Object.defineProperty(m,"DI_TOKENS",{enumerable:!0,get:o(function(){return FU.DI_TOKENS},"get")});var of=Lx();Object.defineProperty(m,"registerCoreServices",{enumerable:!0,get:o(function(){return of.registerCoreServices},"get")});Object.defineProperty(m,"createChildContainer",{enumerable:!0,get:o(function(){return of.createChildContainer},"get")});Object.defineProperty(m,"getContainer",{enumerable:!0,get:o(function(){return of.getContainer},"get")});Object.defineProperty(m,"resetContainer",{enumerable:!0,get:o(function(){return of.resetContainer},"get")});Object.defineProperty(m,"container",{enumerable:!0,get:o(function(){return of.container},"get")});var aa=Bx();Object.defineProperty(m,"NODE_FLAGS",{enumerable:!0,get:o(function(){return aa.NODE_FLAGS},"get")});Object.defineProperty(m,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return aa.DEFAULT_COLORS},"get")});Object.defineProperty(m,"StringTable",{enumerable:!0,get:o(function(){return aa.StringTable},"get")});Object.defineProperty(m,"CompactGraphStore",{enumerable:!0,get:o(function(){return aa.CompactGraphStore},"get")});Object.defineProperty(m,"MemoryPool",{enumerable:!0,get:o(function(){return aa.MemoryPool},"get")});Object.defineProperty(m,"getGlobalPool",{enumerable:!0,get:o(function(){return aa.getGlobalPool},"get")});Object.defineProperty(m,"resetGlobalPool",{enumerable:!0,get:o(function(){return aa.resetGlobalPool},"get")});Object.defineProperty(m,"StreamingLoader",{enumerable:!0,get:o(function(){return aa.StreamingLoader},"get")});Object.defineProperty(m,"createStreamingSource",{enumerable:!0,get:o(function(){return aa.createStreamingSource},"get")});var DI=Ux();Object.defineProperty(m,"ExoQL",{enumerable:!0,get:o(function(){return DI.ExoQL},"get")});Object.defineProperty(m,"ExoQLError",{enumerable:!0,get:o(function(){return DI.ExoQLError},"get")});var pl=fm();Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_IRI",{enumerable:!0,get:o(function(){return pl.RELATION_COLUMN_SET_CLASS_IRI},"get")});Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_UID",{enumerable:!0,get:o(function(){return pl.RELATION_COLUMN_SET_CLASS_UID},"get")});Object.defineProperty(m,"createRelationColumnSetFromFrontmatter",{enumerable:!0,get:o(function(){return pl.createRelationColumnSetFromFrontmatter},"get")});Object.defineProperty(m,"isRelationColumnSet",{enumerable:!0,get:o(function(){return pl.isRelationColumnSet},"get")});Object.defineProperty(m,"isRelationColumnSetFrontmatter",{enumerable:!0,get:o(function(){return pl.isRelationColumnSetFrontmatter},"get")});Object.defineProperty(m,"normalizeRelationColumnSetRef",{enumerable:!0,get:o(function(){return pl.normalizeRef},"get")});var DU=Xx();Object.defineProperty(m,"RelationColumnSetResolver",{enumerable:!0,get:o(function(){return DU.RelationColumnSetResolver},"get")});var cf=fm();Object.defineProperty(m,"LAYOUT_CLASS_IRI",{enumerable:!0,get:o(function(){return cf.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(m,"LAYOUT_CLASS_UID",{enumerable:!0,get:o(function(){return cf.LAYOUT_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutFromFrontmatter",{enumerable:!0,get:o(function(){return cf.createLayoutFromFrontmatter},"get")});Object.defineProperty(m,"isLayout",{enumerable:!0,get:o(function(){return cf.isLayout},"get")});Object.defineProperty(m,"isLayoutFrontmatter",{enumerable:!0,get:o(function(){return cf.isLayoutFrontmatter},"get")});var $a=fm();Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return $a.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return $a.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return $a.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return $a.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:o(function(){return $a.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(m,"isBacklinksTableBlock",{enumerable:!0,get:o(function(){return $a.isBacklinksTableBlock},"get")});Object.defineProperty(m,"isLayoutBlockFrontmatter",{enumerable:!0,get:o(function(){return $a.isLayoutBlockFrontmatter},"get")});Object.defineProperty(m,"isPropertiesBlock",{enumerable:!0,get:o(function(){return $a.isPropertiesBlock},"get")});var NI=Zx();Object.defineProperty(m,"LayoutSelector",{enumerable:!0,get:o(function(){return NI.LayoutSelector},"get")});Object.defineProperty(m,"selectByPriority",{enumerable:!0,get:o(function(){return NI.selectByPriority},"get")});ti(cI(),m);var NU=mw();Object.defineProperty(m,"ShapeLoader",{enumerable:!0,get:o(function(){return NU.ShapeLoader},"get")});var LU=fw();Object.defineProperty(m,"ShapeRegistry",{enumerable:!0,get:o(function(){return LU.ShapeRegistry},"get")});var kU=ir();Object.defineProperty(m,"Namespace",{enumerable:!0,get:o(function(){return kU.Namespace},"get")});var LI=yw();Object.defineProperty(m,"shaclValidate",{enumerable:!0,get:o(function(){return LI.validate},"get")});Object.defineProperty(m,"ShaclShapeRegistry",{enumerable:!0,get:o(function(){return LI.ShapeRegistry},"get")});ti(fI(),m);var xw=hI();Object.defineProperty(m,"ValidatorDaemon",{enumerable:!0,get:o(function(){return xw.ValidatorDaemon},"get")});Object.defineProperty(m,"DEFAULT_SOCKET_PATH",{enumerable:!0,get:o(function(){return xw.DEFAULT_SOCKET_PATH},"get")});Object.defineProperty(m,"IDLE_TIMEOUT_MS",{enumerable:!0,get:o(function(){return xw.IDLE_TIMEOUT_MS},"get")});var jU=ww();Object.defineProperty(m,"TripleClassHierarchy",{enumerable:!0,get:o(function(){return jU.ClassHierarchy},"get")})});var wr=b(Iw=>{"use strict";Iw.fromCallback=function(n){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")n.apply(this,e);else return new Promise((t,r)=>{e.push((i,s)=>i!=null?r(i):t(s)),n.apply(this,e)})},"name",{value:n.name})};Iw.fromPromise=function(n){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return n.apply(this,e);e.pop(),n.apply(this,e).then(r=>t(null,r),t)},"name",{value:n.name})}});var jI=b((Lce,kI)=>{var Va=require("constants"),MU=process.cwd,Om=null,$U=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Om||(Om=MU.call(process)),Om};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Cw=process.chdir,process.chdir=function(n){Om=null,Cw.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Cw));var Cw;kI.exports=VU;function VU(n){Va.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(n),n.lutimes||t(n),n.chown=s(n.chown),n.fchown=s(n.fchown),n.lchown=s(n.lchown),n.chmod=r(n.chmod),n.fchmod=r(n.fchmod),n.lchmod=r(n.lchmod),n.chownSync=a(n.chownSync),n.fchownSync=a(n.fchownSync),n.lchownSync=a(n.lchownSync),n.chmodSync=i(n.chmodSync),n.fchmodSync=i(n.fchmodSync),n.lchmodSync=i(n.lchmodSync),n.stat=c(n.stat),n.fstat=c(n.fstat),n.lstat=c(n.lstat),n.statSync=l(n.statSync),n.fstatSync=l(n.fstatSync),n.lstatSync=l(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(f,d,h){h&&process.nextTick(h)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(f,d,h,p){p&&process.nextTick(p)},n.lchownSync=function(){}),$U==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function d(h,p,y){var S=Date.now(),v=0;f(h,p,o(function w(T){if(T&&(T.code==="EACCES"||T.code==="EPERM"||T.code==="EBUSY")&&Date.now()-S<6e4){setTimeout(function(){n.stat(p,function(C,L){C&&C.code==="ENOENT"?f(h,p,w):y(T)})},v),v<100&&(v+=10);return}y&&y(T)},"CB"))}return o(d,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(n.rename)),n.read=typeof n.read!="function"?n.read:(function(f){function d(h,p,y,S,v,w){var T;if(w&&typeof w=="function"){var C=0;T=o(function(L,$,ee){if(L&&L.code==="EAGAIN"&&C<10)return C++,f.call(n,h,p,y,S,v,T);w.apply(this,arguments)},"callback")}return f.call(n,h,p,y,S,v,T)}return o(d,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:(function(f){return function(d,h,p,y,S){for(var v=0;;)try{return f.call(n,d,h,p,y,S)}catch(w){if(w.code==="EAGAIN"&&v<10){v++;continue}throw w}}})(n.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,Va.O_WRONLY|Va.O_SYMLINK,h,function(y,S){if(y){p&&p(y);return}f.fchmod(S,h,function(v){f.close(S,function(w){p&&p(v||w)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,Va.O_WRONLY|Va.O_SYMLINK,h),y=!0,S;try{S=f.fchmodSync(p,h),y=!1}finally{if(y)try{f.closeSync(p)}catch{}else f.closeSync(p)}return S}}o(e,"patchLchmod");function t(f){Va.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,y){f.open(d,Va.O_SYMLINK,function(S,v){if(S){y&&y(S);return}f.futimes(v,h,p,function(w){f.close(v,function(T){y&&y(w||T)})})})},f.lutimesSync=function(d,h,p){var y=f.openSync(d,Va.O_SYMLINK),S,v=!0;try{S=f.futimesSync(y,h,p),v=!1}finally{if(v)try{f.closeSync(y)}catch{}else f.closeSync(y)}return S}):f.futimes&&(f.lutimes=function(d,h,p,y){y&&process.nextTick(y)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(d,h,p){return f.call(n,d,h,function(y){u(y)&&(y=null),p&&p.apply(this,arguments)})}}o(r,"chmodFix");function i(f){return f&&function(d,h){try{return f.call(n,d,h)}catch(p){if(!u(p))throw p}}}o(i,"chmodFixSync");function s(f){return f&&function(d,h,p,y){return f.call(n,d,h,p,function(S){u(S)&&(S=null),y&&y.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(d,h,p){try{return f.call(n,d,h,p)}catch(y){if(!u(y))throw y}}}o(a,"chownFixSync");function c(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function y(S,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),p&&p.apply(this,arguments)}return o(y,"callback"),h?f.call(n,d,h,y):f.call(n,d,y)}}o(c,"statFix");function l(f){return f&&function(d,h){var p=h?f.call(n,d,h):f.call(n,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}o(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"))}o(u,"chownErOk")}o(VU,"patch")});var VI=b((jce,$I)=>{var MI=require("stream").Stream;$I.exports=BU;function BU(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);MI.call(this);var s=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var a=Object.keys(i),c=0,l=a.length;c<l;c++){var u=a[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}n.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(r,i){if(!(this instanceof t))return new t(r,i);MI.call(this),this.path=r,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),a=0,c=s.length;a<c;a++){var l=s[a];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=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}o(BU,"legacy")});var UI=b(($ce,BI)=>{"use strict";BI.exports=qU;var UU=Object.getPrototypeOf||function(n){return n.__proto__};function qU(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:UU(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(qU,"clone")});var gl=b((Bce,Pw)=>{var Lt=require("fs"),WU=jI(),GU=VI(),zU=UI(),Pm=require("util"),kr,Dm;typeof Symbol=="function"&&typeof Symbol.for=="function"?(kr=Symbol.for("graceful-fs.queue"),Dm=Symbol.for("graceful-fs.previous")):(kr="___graceful-fs.queue",Dm="___graceful-fs.previous");function HU(){}o(HU,"noop");function GI(n,e){Object.defineProperty(n,kr,{get:o(function(){return e},"get")})}o(GI,"publishQueue");var Vo=HU;Pm.debuglog?Vo=Pm.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Vo=o(function(){var n=Pm.format.apply(Pm,arguments);n="GFS4: "+n.split(/\n/).join(`
|
|
452
|
-
GFS4: `),console.error(n)},"debug"));Lt[kr]||(qI=global[kr]||[],GI(Lt,qI),Lt.close=(function(n){function e(t,r){return n.call(Lt,t,function(i){i||WI(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,Dm,{value:n}),e})(Lt.close),Lt.closeSync=(function(n){function e(t){n.apply(Lt,arguments),WI()}return o(e,"closeSync"),Object.defineProperty(e,Dm,{value:n}),e})(Lt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Vo(Lt[kr]),require("assert").equal(Lt[kr].length,0)}));var qI;global[kr]||GI(global,Lt[kr]);Pw.exports=Rw(zU(Lt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Lt.__patched&&(Pw.exports=Rw(Lt),Lt.__patched=!0);function Rw(n){WU(n),n.gracefulify=Rw,n.createReadStream=$,n.createWriteStream=ee;var e=n.readFile;n.readFile=t;function t(F,D,G){return typeof D=="function"&&(G=D,D=null),Re(F,D,G);function Re(et,ft,Ze,te){return e(et,ft,function(ie){ie&&(ie.code==="EMFILE"||ie.code==="ENFILE")?ml([Re,[et,ft,Ze],ie,te||Date.now(),Date.now()]):typeof Ze=="function"&&Ze.apply(this,arguments)})}o(Re,"go$readFile")}o(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(F,D,G,Re){return typeof G=="function"&&(Re=G,G=null),et(F,D,G,Re);function et(ft,Ze,te,ie,K){return r(ft,Ze,te,function(q){q&&(q.code==="EMFILE"||q.code==="ENFILE")?ml([et,[ft,Ze,te,ie],q,K||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}o(et,"go$writeFile")}o(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=a);function a(F,D,G,Re){return typeof G=="function"&&(Re=G,G=null),et(F,D,G,Re);function et(ft,Ze,te,ie,K){return s(ft,Ze,te,function(q){q&&(q.code==="EMFILE"||q.code==="ENFILE")?ml([et,[ft,Ze,te,ie],q,K||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}o(et,"go$appendFile")}o(a,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(F,D,G,Re){return typeof G=="function"&&(Re=G,G=0),et(F,D,G,Re);function et(ft,Ze,te,ie,K){return c(ft,Ze,te,function(q){q&&(q.code==="EMFILE"||q.code==="ENFILE")?ml([et,[ft,Ze,te,ie],q,K||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}o(et,"go$copyFile")}o(l,"copyFile");var u=n.readdir;n.readdir=d;var f=/^v[0-5]\./;function d(F,D,G){typeof D=="function"&&(G=D,D=null);var Re=f.test(process.version)?o(function(Ze,te,ie,K){return u(Ze,et(Ze,te,ie,K))},"go$readdir"):o(function(Ze,te,ie,K){return u(Ze,te,et(Ze,te,ie,K))},"go$readdir");return Re(F,D,G);function et(ft,Ze,te,ie){return function(K,q){K&&(K.code==="EMFILE"||K.code==="ENFILE")?ml([Re,[ft,Ze,te],K,ie||Date.now(),Date.now()]):(q&&q.sort&&q.sort(),typeof te=="function"&&te.call(this,K,q))}}}if(o(d,"readdir"),process.version.substr(0,4)==="v0.8"){var h=GU(n);w=h.ReadStream,C=h.WriteStream}var p=n.ReadStream;p&&(w.prototype=Object.create(p.prototype),w.prototype.open=T);var y=n.WriteStream;y&&(C.prototype=Object.create(y.prototype),C.prototype.open=L),Object.defineProperty(n,"ReadStream",{get:o(function(){return w},"get"),set:o(function(F){w=F},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return C},"get"),set:o(function(F){C=F},"set"),enumerable:!0,configurable:!0});var S=w;Object.defineProperty(n,"FileReadStream",{get:o(function(){return S},"get"),set:o(function(F){S=F},"set"),enumerable:!0,configurable:!0});var v=C;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return v},"get"),set:o(function(F){v=F},"set"),enumerable:!0,configurable:!0});function w(F,D){return this instanceof w?(p.apply(this,arguments),this):w.apply(Object.create(w.prototype),arguments)}o(w,"ReadStream");function T(){var F=this;W(F.path,F.flags,F.mode,function(D,G){D?(F.autoClose&&F.destroy(),F.emit("error",D)):(F.fd=G,F.emit("open",G),F.read())})}o(T,"ReadStream$open");function C(F,D){return this instanceof C?(y.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}o(C,"WriteStream");function L(){var F=this;W(F.path,F.flags,F.mode,function(D,G){D?(F.destroy(),F.emit("error",D)):(F.fd=G,F.emit("open",G))})}o(L,"WriteStream$open");function $(F,D){return new n.ReadStream(F,D)}o($,"createReadStream");function ee(F,D){return new n.WriteStream(F,D)}o(ee,"createWriteStream");var B=n.open;n.open=W;function W(F,D,G,Re){return typeof G=="function"&&(Re=G,G=null),et(F,D,G,Re);function et(ft,Ze,te,ie,K){return B(ft,Ze,te,function(q,st){q&&(q.code==="EMFILE"||q.code==="ENFILE")?ml([et,[ft,Ze,te,ie],q,K||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}o(et,"go$open")}return o(W,"open"),n}o(Rw,"patch");function ml(n){Vo("ENQUEUE",n[0].name,n[1]),Lt[kr].push(n),Ow()}o(ml,"enqueue");var Fm;function WI(){for(var n=Date.now(),e=0;e<Lt[kr].length;++e)Lt[kr][e].length>2&&(Lt[kr][e][3]=n,Lt[kr][e][4]=n);Ow()}o(WI,"resetQueue");function Ow(){if(clearTimeout(Fm),Fm=void 0,Lt[kr].length!==0){var n=Lt[kr].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Vo("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Vo("TIMEOUT",e.name,t);var a=t.pop();typeof a=="function"&&a.call(null,r)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Vo("RETRY",e.name,t),e.apply(null,t.concat([i]))):Lt[kr].push(n)}Fm===void 0&&(Fm=setTimeout(Ow,0))}}o(Ow,"retry")});var mn=b(oa=>{"use strict";var zI=wr().fromCallback,pn=gl(),QU=["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(n=>typeof pn[n]=="function");Object.assign(oa,pn);QU.forEach(n=>{oa[n]=zI(pn[n])});oa.exists=function(n,e){return typeof e=="function"?pn.exists(n,e):new Promise(t=>pn.exists(n,t))};oa.read=function(n,e,t,r,i,s){return typeof s=="function"?pn.read(n,e,t,r,i,s):new Promise((a,c)=>{pn.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};oa.write=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.write(n,e,...t):new Promise((r,i)=>{pn.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};oa.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.readv(n,e,...t):new Promise((r,i)=>{pn.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};oa.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.writev(n,e,...t):new Promise((r,i)=>{pn.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof pn.realpath.native=="function"?oa.realpath.native=zI(pn.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var QI=b((Wce,HI)=>{"use strict";var KU=require("path");HI.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(KU.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var JI=b((zce,Fw)=>{"use strict";var KI=mn(),{checkPath:YI}=QI(),XI=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");Fw.exports.makeDir=async(n,e)=>(YI(n),KI.mkdir(n,{mode:XI(e),recursive:!0}));Fw.exports.makeDirSync=(n,e)=>(YI(n),KI.mkdirSync(n,{mode:XI(e),recursive:!0}))});var Mi=b((Qce,ZI)=>{"use strict";var YU=wr().fromPromise,{makeDir:XU,makeDirSync:Dw}=JI(),Nw=YU(XU);ZI.exports={mkdirs:Nw,mkdirsSync:Dw,mkdirp:Nw,mkdirpSync:Dw,ensureDir:Nw,ensureDirSync:Dw}});var Ba=b((Kce,tC)=>{"use strict";var JU=wr().fromPromise,eC=mn();function ZU(n){return eC.access(n).then(()=>!0).catch(()=>!1)}o(ZU,"pathExists");tC.exports={pathExists:JU(ZU),pathExistsSync:eC.existsSync}});var Lw=b((Xce,rC)=>{"use strict";var yl=mn(),eq=wr().fromPromise;async function tq(n,e,t){let r=await yl.open(n,"r+"),i=null;try{await yl.futimes(r,e,t)}finally{try{await yl.close(r)}catch(s){i=s}}if(i)throw i}o(tq,"utimesMillis");function rq(n,e,t){let r=yl.openSync(n,"r+");return yl.futimesSync(r,e,t),yl.closeSync(r)}o(rq,"utimesMillisSync");rC.exports={utimesMillis:eq(tq),utimesMillisSync:rq}});var Bo=b((Zce,aC)=>{"use strict";var _l=mn(),vr=require("path"),nC=wr().fromPromise;function nq(n,e,t){let r=t.dereference?i=>_l.stat(i,{bigint:!0}):i=>_l.lstat(i,{bigint:!0});return Promise.all([r(n),r(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}o(nq,"getStats");function iq(n,e,t){let r,i=t.dereference?a=>_l.statSync(a,{bigint:!0}):a=>_l.lstatSync(a,{bigint:!0}),s=i(n);try{r=i(e)}catch(a){if(a.code==="ENOENT")return{srcStat:s,destStat:null};throw a}return{srcStat:s,destStat:r}}o(iq,"getStatsSync");async function sq(n,e,t,r){let{srcStat:i,destStat:s}=await nq(n,e,r);if(s){if(lf(i,s)){let a=vr.basename(n),c=vr.basename(e);if(t==="move"&&a!==c&&a.toLowerCase()===c.toLowerCase())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 '${n}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(i.isDirectory()&&kw(n,e))throw new Error(Nm(n,e,t));return{srcStat:i,destStat:s}}o(sq,"checkPaths");function aq(n,e,t,r){let{srcStat:i,destStat:s}=iq(n,e,r);if(s){if(lf(i,s)){let a=vr.basename(n),c=vr.basename(e);if(t==="move"&&a!==c&&a.toLowerCase()===c.toLowerCase())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 '${n}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(i.isDirectory()&&kw(n,e))throw new Error(Nm(n,e,t));return{srcStat:i,destStat:s}}o(aq,"checkPathsSync");async function iC(n,e,t,r){let i=vr.resolve(vr.dirname(n)),s=vr.resolve(vr.dirname(t));if(s===i||s===vr.parse(s).root)return;let a;try{a=await _l.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(lf(e,a))throw new Error(Nm(n,t,r));return iC(n,e,s,r)}o(iC,"checkParentPaths");function sC(n,e,t,r){let i=vr.resolve(vr.dirname(n)),s=vr.resolve(vr.dirname(t));if(s===i||s===vr.parse(s).root)return;let a;try{a=_l.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(lf(e,a))throw new Error(Nm(n,t,r));return sC(n,e,s,r)}o(sC,"checkParentPathsSync");function lf(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(lf,"areIdentical");function kw(n,e){let t=vr.resolve(n).split(vr.sep).filter(i=>i),r=vr.resolve(e).split(vr.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(kw,"isSrcSubdir");function Nm(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(Nm,"errMsg");aC.exports={checkPaths:nC(sq),checkPathsSync:aq,checkParentPaths:nC(iC),checkParentPathsSync:sC,isSrcSubdir:kw,areIdentical:lf}});var cC=b((tle,oC)=>{"use strict";async function oq(n,e){let t=[];for await(let r of n)t.push(e(r).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(t.map(r=>r.then(i=>{if(i!==null)throw i})))}o(oq,"asyncIteratorConcurrentProcess");oC.exports={asyncIteratorConcurrentProcess:oq}});var hC=b((nle,dC)=>{"use strict";var Qr=mn(),uf=require("path"),{mkdirs:cq}=Mi(),{pathExists:lq}=Ba(),{utimesMillis:uq}=Lw(),ff=Bo(),{asyncIteratorConcurrentProcess:fq}=cC();async function dq(n,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;
|
|
452
|
+
GFS4: `),console.error(n)},"debug"));Lt[kr]||(qI=global[kr]||[],GI(Lt,qI),Lt.close=(function(n){function e(t,r){return n.call(Lt,t,function(i){i||WI(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,Dm,{value:n}),e})(Lt.close),Lt.closeSync=(function(n){function e(t){n.apply(Lt,arguments),WI()}return o(e,"closeSync"),Object.defineProperty(e,Dm,{value:n}),e})(Lt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Vo(Lt[kr]),require("assert").equal(Lt[kr].length,0)}));var qI;global[kr]||GI(global,Lt[kr]);Pw.exports=Rw(zU(Lt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Lt.__patched&&(Pw.exports=Rw(Lt),Lt.__patched=!0);function Rw(n){WU(n),n.gracefulify=Rw,n.createReadStream=$,n.createWriteStream=ee;var e=n.readFile;n.readFile=t;function t(F,D,W){return typeof D=="function"&&(W=D,D=null),De(F,D,W);function De(et,ut,ae,Ze){return e(et,ut,function(ie){ie&&(ie.code==="EMFILE"||ie.code==="ENFILE")?ml([De,[et,ut,ae],ie,Ze||Date.now(),Date.now()]):typeof ae=="function"&&ae.apply(this,arguments)})}o(De,"go$readFile")}o(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(F,D,W,De){return typeof W=="function"&&(De=W,W=null),et(F,D,W,De);function et(ut,ae,Ze,ie,Z){return r(ut,ae,Ze,function(q){q&&(q.code==="EMFILE"||q.code==="ENFILE")?ml([et,[ut,ae,Ze,ie],q,Z||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}o(et,"go$writeFile")}o(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=a);function a(F,D,W,De){return typeof W=="function"&&(De=W,W=null),et(F,D,W,De);function et(ut,ae,Ze,ie,Z){return s(ut,ae,Ze,function(q){q&&(q.code==="EMFILE"||q.code==="ENFILE")?ml([et,[ut,ae,Ze,ie],q,Z||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}o(et,"go$appendFile")}o(a,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(F,D,W,De){return typeof W=="function"&&(De=W,W=0),et(F,D,W,De);function et(ut,ae,Ze,ie,Z){return c(ut,ae,Ze,function(q){q&&(q.code==="EMFILE"||q.code==="ENFILE")?ml([et,[ut,ae,Ze,ie],q,Z||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}o(et,"go$copyFile")}o(l,"copyFile");var u=n.readdir;n.readdir=d;var f=/^v[0-5]\./;function d(F,D,W){typeof D=="function"&&(W=D,D=null);var De=f.test(process.version)?o(function(ae,Ze,ie,Z){return u(ae,et(ae,Ze,ie,Z))},"go$readdir"):o(function(ae,Ze,ie,Z){return u(ae,Ze,et(ae,Ze,ie,Z))},"go$readdir");return De(F,D,W);function et(ut,ae,Ze,ie){return function(Z,q){Z&&(Z.code==="EMFILE"||Z.code==="ENFILE")?ml([De,[ut,ae,Ze],Z,ie||Date.now(),Date.now()]):(q&&q.sort&&q.sort(),typeof Ze=="function"&&Ze.call(this,Z,q))}}}if(o(d,"readdir"),process.version.substr(0,4)==="v0.8"){var h=GU(n);w=h.ReadStream,C=h.WriteStream}var p=n.ReadStream;p&&(w.prototype=Object.create(p.prototype),w.prototype.open=T);var y=n.WriteStream;y&&(C.prototype=Object.create(y.prototype),C.prototype.open=L),Object.defineProperty(n,"ReadStream",{get:o(function(){return w},"get"),set:o(function(F){w=F},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return C},"get"),set:o(function(F){C=F},"set"),enumerable:!0,configurable:!0});var S=w;Object.defineProperty(n,"FileReadStream",{get:o(function(){return S},"get"),set:o(function(F){S=F},"set"),enumerable:!0,configurable:!0});var v=C;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return v},"get"),set:o(function(F){v=F},"set"),enumerable:!0,configurable:!0});function w(F,D){return this instanceof w?(p.apply(this,arguments),this):w.apply(Object.create(w.prototype),arguments)}o(w,"ReadStream");function T(){var F=this;G(F.path,F.flags,F.mode,function(D,W){D?(F.autoClose&&F.destroy(),F.emit("error",D)):(F.fd=W,F.emit("open",W),F.read())})}o(T,"ReadStream$open");function C(F,D){return this instanceof C?(y.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}o(C,"WriteStream");function L(){var F=this;G(F.path,F.flags,F.mode,function(D,W){D?(F.destroy(),F.emit("error",D)):(F.fd=W,F.emit("open",W))})}o(L,"WriteStream$open");function $(F,D){return new n.ReadStream(F,D)}o($,"createReadStream");function ee(F,D){return new n.WriteStream(F,D)}o(ee,"createWriteStream");var B=n.open;n.open=G;function G(F,D,W,De){return typeof W=="function"&&(De=W,W=null),et(F,D,W,De);function et(ut,ae,Ze,ie,Z){return B(ut,ae,Ze,function(q,tt){q&&(q.code==="EMFILE"||q.code==="ENFILE")?ml([et,[ut,ae,Ze,ie],q,Z||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}o(et,"go$open")}return o(G,"open"),n}o(Rw,"patch");function ml(n){Vo("ENQUEUE",n[0].name,n[1]),Lt[kr].push(n),Ow()}o(ml,"enqueue");var Fm;function WI(){for(var n=Date.now(),e=0;e<Lt[kr].length;++e)Lt[kr][e].length>2&&(Lt[kr][e][3]=n,Lt[kr][e][4]=n);Ow()}o(WI,"resetQueue");function Ow(){if(clearTimeout(Fm),Fm=void 0,Lt[kr].length!==0){var n=Lt[kr].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Vo("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Vo("TIMEOUT",e.name,t);var a=t.pop();typeof a=="function"&&a.call(null,r)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Vo("RETRY",e.name,t),e.apply(null,t.concat([i]))):Lt[kr].push(n)}Fm===void 0&&(Fm=setTimeout(Ow,0))}}o(Ow,"retry")});var mn=b(oa=>{"use strict";var zI=wr().fromCallback,pn=gl(),QU=["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(n=>typeof pn[n]=="function");Object.assign(oa,pn);QU.forEach(n=>{oa[n]=zI(pn[n])});oa.exists=function(n,e){return typeof e=="function"?pn.exists(n,e):new Promise(t=>pn.exists(n,t))};oa.read=function(n,e,t,r,i,s){return typeof s=="function"?pn.read(n,e,t,r,i,s):new Promise((a,c)=>{pn.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};oa.write=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.write(n,e,...t):new Promise((r,i)=>{pn.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};oa.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.readv(n,e,...t):new Promise((r,i)=>{pn.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};oa.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.writev(n,e,...t):new Promise((r,i)=>{pn.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof pn.realpath.native=="function"?oa.realpath.native=zI(pn.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var QI=b((Wce,HI)=>{"use strict";var KU=require("path");HI.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(KU.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var JI=b((zce,Fw)=>{"use strict";var KI=mn(),{checkPath:YI}=QI(),XI=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");Fw.exports.makeDir=async(n,e)=>(YI(n),KI.mkdir(n,{mode:XI(e),recursive:!0}));Fw.exports.makeDirSync=(n,e)=>(YI(n),KI.mkdirSync(n,{mode:XI(e),recursive:!0}))});var Mi=b((Qce,ZI)=>{"use strict";var YU=wr().fromPromise,{makeDir:XU,makeDirSync:Dw}=JI(),Nw=YU(XU);ZI.exports={mkdirs:Nw,mkdirsSync:Dw,mkdirp:Nw,mkdirpSync:Dw,ensureDir:Nw,ensureDirSync:Dw}});var Ba=b((Kce,tC)=>{"use strict";var JU=wr().fromPromise,eC=mn();function ZU(n){return eC.access(n).then(()=>!0).catch(()=>!1)}o(ZU,"pathExists");tC.exports={pathExists:JU(ZU),pathExistsSync:eC.existsSync}});var Lw=b((Xce,rC)=>{"use strict";var yl=mn(),eq=wr().fromPromise;async function tq(n,e,t){let r=await yl.open(n,"r+"),i=null;try{await yl.futimes(r,e,t)}finally{try{await yl.close(r)}catch(s){i=s}}if(i)throw i}o(tq,"utimesMillis");function rq(n,e,t){let r=yl.openSync(n,"r+");return yl.futimesSync(r,e,t),yl.closeSync(r)}o(rq,"utimesMillisSync");rC.exports={utimesMillis:eq(tq),utimesMillisSync:rq}});var Bo=b((Zce,aC)=>{"use strict";var _l=mn(),vr=require("path"),nC=wr().fromPromise;function nq(n,e,t){let r=t.dereference?i=>_l.stat(i,{bigint:!0}):i=>_l.lstat(i,{bigint:!0});return Promise.all([r(n),r(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}o(nq,"getStats");function iq(n,e,t){let r,i=t.dereference?a=>_l.statSync(a,{bigint:!0}):a=>_l.lstatSync(a,{bigint:!0}),s=i(n);try{r=i(e)}catch(a){if(a.code==="ENOENT")return{srcStat:s,destStat:null};throw a}return{srcStat:s,destStat:r}}o(iq,"getStatsSync");async function sq(n,e,t,r){let{srcStat:i,destStat:s}=await nq(n,e,r);if(s){if(lf(i,s)){let a=vr.basename(n),c=vr.basename(e);if(t==="move"&&a!==c&&a.toLowerCase()===c.toLowerCase())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 '${n}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(i.isDirectory()&&kw(n,e))throw new Error(Nm(n,e,t));return{srcStat:i,destStat:s}}o(sq,"checkPaths");function aq(n,e,t,r){let{srcStat:i,destStat:s}=iq(n,e,r);if(s){if(lf(i,s)){let a=vr.basename(n),c=vr.basename(e);if(t==="move"&&a!==c&&a.toLowerCase()===c.toLowerCase())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 '${n}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(i.isDirectory()&&kw(n,e))throw new Error(Nm(n,e,t));return{srcStat:i,destStat:s}}o(aq,"checkPathsSync");async function iC(n,e,t,r){let i=vr.resolve(vr.dirname(n)),s=vr.resolve(vr.dirname(t));if(s===i||s===vr.parse(s).root)return;let a;try{a=await _l.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(lf(e,a))throw new Error(Nm(n,t,r));return iC(n,e,s,r)}o(iC,"checkParentPaths");function sC(n,e,t,r){let i=vr.resolve(vr.dirname(n)),s=vr.resolve(vr.dirname(t));if(s===i||s===vr.parse(s).root)return;let a;try{a=_l.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(lf(e,a))throw new Error(Nm(n,t,r));return sC(n,e,s,r)}o(sC,"checkParentPathsSync");function lf(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(lf,"areIdentical");function kw(n,e){let t=vr.resolve(n).split(vr.sep).filter(i=>i),r=vr.resolve(e).split(vr.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(kw,"isSrcSubdir");function Nm(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(Nm,"errMsg");aC.exports={checkPaths:nC(sq),checkPathsSync:aq,checkParentPaths:nC(iC),checkParentPathsSync:sC,isSrcSubdir:kw,areIdentical:lf}});var cC=b((tle,oC)=>{"use strict";async function oq(n,e){let t=[];for await(let r of n)t.push(e(r).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(t.map(r=>r.then(i=>{if(i!==null)throw i})))}o(oq,"asyncIteratorConcurrentProcess");oC.exports={asyncIteratorConcurrentProcess:oq}});var hC=b((nle,dC)=>{"use strict";var Qr=mn(),uf=require("path"),{mkdirs:cq}=Mi(),{pathExists:lq}=Ba(),{utimesMillis:uq}=Lw(),ff=Bo(),{asyncIteratorConcurrentProcess:fq}=cC();async function dq(n,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;
|
|
453
453
|
|
|
454
454
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await ff.checkPaths(n,e,"copy",t);if(await ff.checkParentPaths(n,r,e,"copy"),!await uC(n,e,t))return;let a=uf.dirname(e);await lq(a)||await cq(a),await fC(i,n,e,t)}o(dq,"copy");async function uC(n,e,t){return t.filter?t.filter(n,e):!0}o(uC,"runFilter");async function fC(n,e,t,r){let s=await(r.dereference?Qr.stat:Qr.lstat)(e);if(s.isDirectory())return gq(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return hq(s,n,e,t,r);if(s.isSymbolicLink())return yq(n,e,t,r);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}`)}o(fC,"getStatsAndPerformCopy");async function hq(n,e,t,r,i){if(!e)return lC(n,t,r,i);if(i.overwrite)return await Qr.unlink(r),lC(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}o(hq,"onFile");async function lC(n,e,t,r){if(await Qr.copyFile(e,t),r.preserveTimestamps){pq(n.mode)&&await mq(t,n.mode);let i=await Qr.stat(e);await uq(t,i.atime,i.mtime)}return Qr.chmod(t,n.mode)}o(lC,"copyFile");function pq(n){return(n&128)===0}o(pq,"fileIsNotWritable");function mq(n,e){return Qr.chmod(n,e|128)}o(mq,"makeFileWritable");async function gq(n,e,t,r,i){e||await Qr.mkdir(r),await fq(await Qr.opendir(t),async s=>{let a=uf.join(t,s.name),c=uf.join(r,s.name);if(await uC(a,c,i)){let{destStat:u}=await ff.checkPaths(a,c,"copy",i);await fC(u,a,c,i)}}),e||await Qr.chmod(r,n.mode)}o(gq,"onDir");async function yq(n,e,t,r){let i=await Qr.readlink(e);if(r.dereference&&(i=uf.resolve(process.cwd(),i)),!n)return Qr.symlink(i,t);let s=null;try{s=await Qr.readlink(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Qr.symlink(i,t);throw a}if(r.dereference&&(s=uf.resolve(process.cwd(),s)),ff.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(ff.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await Qr.unlink(t),Qr.symlink(i,t)}o(yq,"onLink");dC.exports=dq});var _C=b((sle,yC)=>{"use strict";var gn=gl(),df=require("path"),_q=Mi().mkdirsSync,bq=Lw().utimesMillisSync,hf=Bo();function Sq(n,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;
|
|
455
455
|
|
|
456
456
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=hf.checkPathsSync(n,e,"copy",t);if(hf.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=df.dirname(e);return gn.existsSync(s)||_q(s),pC(i,n,e,t)}o(Sq,"copySync");function pC(n,e,t,r){let s=(r.dereference?gn.statSync:gn.lstatSync)(e);if(s.isDirectory())return Iq(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return wq(s,n,e,t,r);if(s.isSymbolicLink())return Oq(n,e,t,r);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}`)}o(pC,"getStats");function wq(n,e,t,r,i){return e?vq(n,t,r,i):mC(n,t,r,i)}o(wq,"onFile");function vq(n,e,t,r){if(r.overwrite)return gn.unlinkSync(t),mC(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}o(vq,"mayCopyFile");function mC(n,e,t,r){return gn.copyFileSync(e,t),r.preserveTimestamps&&Eq(n.mode,e,t),jw(t,n.mode)}o(mC,"copyFile");function Eq(n,e,t){return Tq(n)&&Aq(t,n),xq(e,t)}o(Eq,"handleTimestamps");function Tq(n){return(n&128)===0}o(Tq,"fileIsNotWritable");function Aq(n,e){return jw(n,e|128)}o(Aq,"makeFileWritable");function jw(n,e){return gn.chmodSync(n,e)}o(jw,"setDestMode");function xq(n,e){let t=gn.statSync(n);return bq(e,t.atime,t.mtime)}o(xq,"setDestTimestamps");function Iq(n,e,t,r,i){return e?gC(t,r,i):Cq(n.mode,t,r,i)}o(Iq,"onDir");function Cq(n,e,t,r){return gn.mkdirSync(t),gC(e,t,r),jw(t,n)}o(Cq,"mkDirAndCopy");function gC(n,e,t){let r=gn.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)Rq(i.name,n,e,t)}finally{r.closeSync()}}o(gC,"copyDir");function Rq(n,e,t,r){let i=df.join(e,n),s=df.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:a}=hf.checkPathsSync(i,s,"copy",r);return pC(a,i,s,r)}o(Rq,"copyDirItem");function Oq(n,e,t,r){let i=gn.readlinkSync(e);if(r.dereference&&(i=df.resolve(process.cwd(),i)),n){let s;try{s=gn.readlinkSync(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return gn.symlinkSync(i,t);throw a}if(r.dereference&&(s=df.resolve(process.cwd(),s)),hf.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(hf.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return Pq(i,t)}else return gn.symlinkSync(i,t)}o(Oq,"onLink");function Pq(n,e){return gn.unlinkSync(e),gn.symlinkSync(n,e)}o(Pq,"copyLink");yC.exports=Sq});var Lm=b((ole,bC)=>{"use strict";var Fq=wr().fromPromise;bC.exports={copy:Fq(hC()),copySync:_C()}});var pf=b((cle,wC)=>{"use strict";var SC=gl(),Dq=wr().fromCallback;function Nq(n,e){SC.rm(n,{recursive:!0,force:!0},e)}o(Nq,"remove");function Lq(n){SC.rmSync(n,{recursive:!0,force:!0})}o(Lq,"removeSync");wC.exports={remove:Dq(Nq),removeSync:Lq}});var RC=b((ule,CC)=>{"use strict";var kq=wr().fromPromise,TC=mn(),AC=require("path"),xC=Mi(),IC=pf(),vC=kq(o(async function(e){let t;try{t=await TC.readdir(e)}catch{return xC.mkdirs(e)}return Promise.all(t.map(r=>IC.remove(AC.join(e,r))))},"emptyDir"));function EC(n){let e;try{e=TC.readdirSync(n)}catch{return xC.mkdirsSync(n)}e.forEach(t=>{t=AC.join(n,t),IC.removeSync(t)})}o(EC,"emptyDirSync");CC.exports={emptyDirSync:EC,emptydirSync:EC,emptyDir:vC,emptydir:vC}});var DC=b((dle,FC)=>{"use strict";var jq=wr().fromPromise,OC=require("path"),ca=mn(),PC=Mi();async function Mq(n){let e;try{e=await ca.stat(n)}catch{}if(e&&e.isFile())return;let t=OC.dirname(n),r=null;try{r=await ca.stat(t)}catch(i){if(i.code==="ENOENT"){await PC.mkdirs(t),await ca.writeFile(n,"");return}else throw i}r.isDirectory()?await ca.writeFile(n,""):await ca.readdir(t)}o(Mq,"createFile");function $q(n){let e;try{e=ca.statSync(n)}catch{}if(e&&e.isFile())return;let t=OC.dirname(n);try{ca.statSync(t).isDirectory()||ca.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")PC.mkdirsSync(t);else throw r}ca.writeFileSync(n,"")}o($q,"createFileSync");FC.exports={createFile:jq(Mq),createFileSync:$q}});var MC=b((ple,jC)=>{"use strict";var Vq=wr().fromPromise,NC=require("path"),Ua=mn(),LC=Mi(),{pathExists:Bq}=Ba(),{areIdentical:kC}=Bo();async function Uq(n,e){let t;try{t=await Ua.lstat(e)}catch{}let r;try{r=await Ua.lstat(n)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(t&&kC(r,t))return;let i=NC.dirname(e);await Bq(i)||await LC.mkdirs(i),await Ua.link(n,e)}o(Uq,"createLink");function qq(n,e){let t;try{t=Ua.lstatSync(e)}catch{}try{let s=Ua.lstatSync(n);if(t&&kC(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=NC.dirname(e);return Ua.existsSync(r)||LC.mkdirsSync(r),Ua.linkSync(n,e)}o(qq,"createLinkSync");jC.exports={createLink:Vq(Uq),createLinkSync:qq}});var VC=b((gle,$C)=>{"use strict";var qa=require("path"),mf=mn(),{pathExists:Wq}=Ba(),Gq=wr().fromPromise;async function zq(n,e){if(qa.isAbsolute(n)){try{await mf.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=qa.dirname(e),r=qa.join(t,n);if(await Wq(r))return{toCwd:r,toDst:n};try{await mf.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:qa.relative(t,n)}}o(zq,"symlinkPaths");function Hq(n,e){if(qa.isAbsolute(n)){if(!mf.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=qa.dirname(e),r=qa.join(t,n);if(mf.existsSync(r))return{toCwd:r,toDst:n};if(!mf.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:qa.relative(t,n)}}o(Hq,"symlinkPathsSync");$C.exports={symlinkPaths:Gq(zq),symlinkPathsSync:Hq}});var qC=b((_le,UC)=>{"use strict";var BC=mn(),Qq=wr().fromPromise;async function Kq(n,e){if(e)return e;let t;try{t=await BC.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(Kq,"symlinkType");function Yq(n,e){if(e)return e;let t;try{t=BC.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(Yq,"symlinkTypeSync");UC.exports={symlinkType:Qq(Kq),symlinkTypeSync:Yq}});var HC=b((Sle,zC)=>{"use strict";var Xq=wr().fromPromise,WC=require("path"),_s=mn(),{mkdirs:Jq,mkdirsSync:Zq}=Mi(),{symlinkPaths:eW,symlinkPathsSync:tW}=VC(),{symlinkType:rW,symlinkTypeSync:nW}=qC(),{pathExists:iW}=Ba(),{areIdentical:GC}=Bo();async function sW(n,e,t){let r;try{r=await _s.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([_s.stat(n),_s.stat(e)]);if(GC(c,l))return}let i=await eW(n,e);n=i.toDst;let s=await rW(i.toCwd,t),a=WC.dirname(e);return await iW(a)||await Jq(a),_s.symlink(n,e,s)}o(sW,"createSymlink");function aW(n,e,t){let r;try{r=_s.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=_s.statSync(n),l=_s.statSync(e);if(GC(c,l))return}let i=tW(n,e);n=i.toDst,t=nW(i.toCwd,t);let s=WC.dirname(e);return _s.existsSync(s)||Zq(s),_s.symlinkSync(n,e,t)}o(aW,"createSymlinkSync");zC.exports={createSymlink:Xq(sW),createSymlinkSync:aW}});var tR=b((vle,eR)=>{"use strict";var{createFile:QC,createFileSync:KC}=DC(),{createLink:YC,createLinkSync:XC}=MC(),{createSymlink:JC,createSymlinkSync:ZC}=HC();eR.exports={createFile:QC,createFileSync:KC,ensureFile:QC,ensureFileSync:KC,createLink:YC,createLinkSync:XC,ensureLink:YC,ensureLinkSync:XC,createSymlink:JC,createSymlinkSync:ZC,ensureSymlink:JC,ensureSymlinkSync:ZC}});var km=b((Ele,rR)=>{function oW(n,{EOL:e=`
|
|
457
|
-
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(oW,"stringify");function cW(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(cW,"stripBom");rR.exports={stringify:oW,stripBom:cW}});var aR=b((Ale,sR)=>{var bl;try{bl=gl()}catch{bl=require("fs")}var jm=wr(),{stringify:nR,stripBom:iR}=km();async function lW(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||bl,r="throws"in e?e.throws:!0,i=await jm.fromCallback(t.readFile)(n,e);i=iR(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(a){if(r)throw a.message=`${n}: ${a.message}`,a;return null}return s}o(lW,"_readFile");var uW=jm.fromPromise(lW);function fW(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||bl,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=iR(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(fW,"readFileSync");async function dW(n,e,t={}){let r=t.fs||bl,i=nR(e,t);await jm.fromCallback(r.writeFile)(n,i,t)}o(dW,"_writeFile");var hW=jm.fromPromise(dW);function pW(n,e,t={}){let r=t.fs||bl,i=nR(e,t);return r.writeFileSync(n,i,t)}o(pW,"writeFileSync");sR.exports={readFile:uW,readFileSync:fW,writeFile:hW,writeFileSync:pW}});var cR=b((Ile,oR)=>{"use strict";var Mm=aR();oR.exports={readJson:Mm.readFile,readJsonSync:Mm.readFileSync,writeJson:Mm.writeFile,writeJsonSync:Mm.writeFileSync}});var $m=b((Cle,fR)=>{"use strict";var mW=wr().fromPromise,Mw=mn(),lR=require("path"),uR=Mi(),gW=Ba().pathExists;async function yW(n,e,t="utf-8"){let r=lR.dirname(n);return await gW(r)||await uR.mkdirs(r),Mw.writeFile(n,e,t)}o(yW,"outputFile");function _W(n,...e){let t=lR.dirname(n);Mw.existsSync(t)||uR.mkdirsSync(t),Mw.writeFileSync(n,...e)}o(_W,"outputFileSync");fR.exports={outputFile:mW(yW),outputFileSync:_W}});var hR=b((Ole,dR)=>{"use strict";var{stringify:bW}=km(),{outputFile:SW}=$m();async function wW(n,e,t={}){let r=bW(e,t);await SW(n,r,t)}o(wW,"outputJson");dR.exports=wW});var mR=b((Fle,pR)=>{"use strict";var{stringify:vW}=km(),{outputFileSync:EW}=$m();function TW(n,e,t){let r=vW(e,t);EW(n,r,t)}o(TW,"outputJsonSync");pR.exports=TW});var yR=b((Nle,gR)=>{"use strict";var AW=wr().fromPromise,yn=cR();yn.outputJson=AW(hR());yn.outputJsonSync=mR();yn.outputJSON=yn.outputJson;yn.outputJSONSync=yn.outputJsonSync;yn.writeJSON=yn.writeJson;yn.writeJSONSync=yn.writeJsonSync;yn.readJSON=yn.readJson;yn.readJSONSync=yn.readJsonSync;gR.exports=yn});var vR=b((Lle,wR)=>{"use strict";var xW=mn(),_R=require("path"),{copy:IW}=Lm(),{remove:SR}=pf(),{mkdirp:CW}=Mi(),{pathExists:RW}=Ba(),bR=Bo();async function OW(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await bR.checkPaths(n,e,"move",t);await bR.checkParentPaths(n,i,e,"move");let a=_R.dirname(e);return _R.parse(a).root!==a&&await CW(a),PW(n,e,r,s)}o(OW,"move");async function PW(n,e,t,r){if(!r){if(t)await SR(e);else if(await RW(e))throw new Error("dest already exists.")}try{await xW.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await FW(n,e,t)}}o(PW,"doRename");async function FW(n,e,t){return await IW(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),SR(n)}o(FW,"moveAcrossDevice");wR.exports=OW});var IR=b((jle,xR)=>{"use strict";var TR=gl(),Vw=require("path"),DW=Lm().copySync,AR=pf().removeSync,NW=Mi().mkdirpSync,ER=Bo();function LW(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=ER.checkPathsSync(n,e,"move",t);return ER.checkParentPathsSync(n,i,e,"move"),kW(e)||NW(Vw.dirname(e)),jW(n,e,r,s)}o(LW,"moveSync");function kW(n){let e=Vw.dirname(n);return Vw.parse(e).root===e}o(kW,"isParentRoot");function jW(n,e,t,r){if(r)return $w(n,e,t);if(t)return AR(e),$w(n,e,t);if(TR.existsSync(e))throw new Error("dest already exists.");return $w(n,e,t)}o(jW,"doRename");function $w(n,e,t){try{TR.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return MW(n,e,t)}}o($w,"rename");function MW(n,e,t){return DW(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),AR(n)}o(MW,"moveAcrossDevice");xR.exports=LW});var RR=b(($le,CR)=>{"use strict";var $W=wr().fromPromise;CR.exports={move:$W(vR()),moveSync:IR()}});var Sl=b((Vle,OR)=>{"use strict";OR.exports={...mn(),...Lm(),...RC(),...tR(),...yR(),...Mi(),...RR(),...$m(),...Ba(),...pf()}});var MO=b((qle,jO)=>{"use strict";jO.exports=LO;function LO(n,e,t){n instanceof RegExp&&(n=NO(n,t)),e instanceof RegExp&&(e=NO(e,t));var r=kO(n,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+n.length,r[1]),post:t.slice(r[1]+e.length)}}o(LO,"balanced");function NO(n,e){var t=e.match(n);return t?t[0]:null}o(NO,"maybeMatch");LO.range=kO;function kO(n,e,t){var r,i,s,a,c,l=t.indexOf(n),u=t.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(n===e)return[l,u];for(r=[],s=t.length;f>=0&&!c;)f==l?(r.push(f),l=t.indexOf(n,f+1)):r.length==1?c=[r.pop(),u]:(i=r.pop(),i<s&&(s=i,a=u),u=t.indexOf(e,f+1)),f=l<u&&l>=0?l:u;r.length&&(c=[s,a])}return c}o(kO,"range")});var zO=b((Gle,GO)=>{var $O=MO();GO.exports=oH;var VO="\0SLASH"+Math.random()+"\0",BO="\0OPEN"+Math.random()+"\0",rv="\0CLOSE"+Math.random()+"\0",UO="\0COMMA"+Math.random()+"\0",qO="\0PERIOD"+Math.random()+"\0";function tv(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(tv,"numeric");function sH(n){return n.split("\\\\").join(VO).split("\\{").join(BO).split("\\}").join(rv).split("\\,").join(UO).split("\\.").join(qO)}o(sH,"escapeBraces");function aH(n){return n.split(VO).join("\\").split(BO).join("{").split(rv).join("}").split(UO).join(",").split(qO).join(".")}o(aH,"unescapeBraces");function WO(n){if(!n)return[""];var e=[],t=$O("{","}",n);if(!t)return n.split(",");var r=t.pre,i=t.body,s=t.post,a=r.split(",");a[a.length-1]+="{"+i+"}";var c=WO(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(WO,"parseCommaParts");function oH(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),wf(sH(n),!0).map(aH)):[]}o(oH,"expandTop");function cH(n){return"{"+n+"}"}o(cH,"embrace");function lH(n){return/^-?0\d/.test(n)}o(lH,"isPadded");function uH(n,e){return n<=e}o(uH,"lte");function fH(n,e){return n>=e}o(fH,"gte");function wf(n,e){var t=[],r=$O("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?wf(r.post,!1):[""];if(/\$$/.test(r.pre))for(var a=0;a<s.length;a++){var c=i+"{"+r.body+"}"+s[a];t.push(c)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),f=l||u,d=r.body.indexOf(",")>=0;if(!f&&!d)return r.post.match(/,(?!,).*\}/)?(n=r.pre+"{"+r.body+rv+r.post,wf(n)):[n];var h;if(f)h=r.body.split(/\.\./);else if(h=WO(r.body),h.length===1&&(h=wf(h[0],!1).map(cH),h.length===1))return s.map(function(D){return r.pre+h[0]+D});var p;if(f){var y=tv(h[0]),S=tv(h[1]),v=Math.max(h[0].length,h[1].length),w=h.length==3?Math.max(Math.abs(tv(h[2])),1):1,T=uH,C=S<y;C&&(w*=-1,T=fH);var L=h.some(lH);p=[];for(var $=y;T($,S);$+=w){var ee;if(u)ee=String.fromCharCode($),ee==="\\"&&(ee="");else if(ee=String($),L){var B=v-ee.length;if(B>0){var W=new Array(B+1).join("0");$<0?ee="-"+W+ee.slice(1):ee=W+ee}}p.push(ee)}}else{p=[];for(var F=0;F<h.length;F++)p.push.apply(p,wf(h[F],!1))}for(var F=0;F<p.length;F++)for(var a=0;a<s.length;a++){var c=i+p[F]+s[a];(!e||f||c)&&t.push(c)}}return t}o(wf,"expand")});var MD=b(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.createPathBasedTargetResolver=xs;wn.createCreateRelatedTaskService=_X;wn.createCreateRelatedProjectService=bX;wn.createCreateAssetService=SX;wn.createArchiveAssetService=wX;wn.createCleanPropertiesService=vX;wn.createFixMissingLabelService=EX;wn.createRenameToUidService=TX;wn.createRepairFolderService=AX;wn.createPlanForEveningService=xX;wn.createUpdatePropertyService=IX;wn.createRemovePropertyService=CX;wn.createSetStatusService=RX;var jD=fr();function xs(n){return{resolveFile(e){let t=n.getAbstractFileByPath(`${e}.md`);if(!t||!("basename"in t))throw new Error(`Cannot resolve target file for IRI: ${e}`);return t}}}o(xs,"createPathBasedTargetResolver");var b2=o(()=>null,"NULL_CLASS_RESOLVER");function Hg(n){return n.startsWith('"[[')&&n.endsWith(']]"')?n:n.startsWith("[[")&&n.endsWith("]]")?`"${n}"`:`"[[${n}]]"`}o(Hg,"toQuotedWikilink");function _X(n,e,t=xs(n),r,i=b2){return{async execute(s,a){let c=a?.label;if(!c)throw new Error("createRelatedTask requires userInput.label");let l=t.resolveFile(s),u=n.getFrontmatter(l)??{},f=l.parent?.path||"",d={ems__Effort_status:'"[[c42245d0-01de-4c35-bfcf-d910445ea28e]]"'},h=a?.parentProperty;h&&l.basename&&(d[h]=`"[[${l.basename}]]"`);let p=await e.createAsset({className:"ems__Task",label:c,folderPath:f,propertyValues:d,parentFile:l,parentMetadata:u,classResolver:i});r&&await r(p)}}}o(_X,"createCreateRelatedTaskService");function bX(n,e,t=xs(n),r,i=b2){return{async execute(s,a){let c=a?.label;if(!c)throw new Error("createRelatedProject requires userInput.label");let l=t.resolveFile(s),u=n.getFrontmatter(l)??{},f=l.parent?.path||"",d={ems__Effort_status:'"[[c42245d0-01de-4c35-bfcf-d910445ea28e]]"'},h=a?.parentProperty;h&&l.basename&&(d[h]=`"[[${l.basename}]]"`);let p=await e.createAsset({className:"ems__Project",label:c,folderPath:f,propertyValues:d,parentFile:l,parentMetadata:u,classResolver:i});r&&await r(p)}}}o(bX,"createCreateRelatedProjectService");function SX(n,e,t=b2,r=xs(n)){return{async execute(i,s){let a=s?.prototypeUID??s?.prototype,c=s?.label,l=s?.folder,u=s?.ownerIdentity,f=s?.isDefinedBy;if(!a)throw new Error("createAsset requires userInput.prototypeUID");if(!c)throw new Error("createAsset requires userInput.label");let d,h;if(i)try{let $=r.resolveFile(i);d=$.path,h=n.getFrontmatter($)??void 0}catch{}if(!l&&d){let $=d.lastIndexOf("/");l=$>=0?d.substring(0,$):""}if(l===void 0)throw new Error("createAsset requires userInput.folder");let p=a.endsWith("Prototype")?a.slice(0,-9):a,y=crypto.randomUUID(),S=jD.DateFormatter.toISOTimestamp(new Date),v=`${y}.md`,w=l?`${l}/${v}`:v,T=["---",`exo__Asset_uid: ${y}`,`exo__Asset_createdAt: ${S}`,`exo__Asset_label: ${c}`,`exo__Asset_prototype: "[[${a}]]"`,"exo__Instance_class:",` - "[[${p}]]"`],C=!1;if(f&&(T.push(`exo__Asset_isDefinedBy: ${Hg(f)}`),C=!0),h){let $=h.exo__Instance_class,B=(Array.isArray($)?$:$!=null?[$]:[]).some(F=>jD.WikiLinkHelpers.resolveSymbolic(String(F),t).includes("Area")),W=d?d.substring(d.lastIndexOf("/")+1).replace(/\.md$/,""):void 0;if(W){let F=B?"ems__Effort_area":"ems__Effort_parent";T.push(`${F}: "[[${W}]]"`)}!B&&h.ems__Effort_area&&T.push(`ems__Effort_area: ${Hg(String(h.ems__Effort_area))}`),T.push('ems__Effort_status: "[[753a44d5-846c-4b82-9196-4fd9a4d48777]]"'),!C&&h.exo__Asset_isDefinedBy&&(T.push(`exo__Asset_isDefinedBy: ${Hg(String(h.exo__Asset_isDefinedBy))}`),C=!0)}!C&&u&&T.push(`exo__Asset_isDefinedBy: ${Hg(u)}`),T.push("---","");let L=T.join(`
|
|
457
|
+
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(oW,"stringify");function cW(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(cW,"stripBom");rR.exports={stringify:oW,stripBom:cW}});var aR=b((Ale,sR)=>{var bl;try{bl=gl()}catch{bl=require("fs")}var jm=wr(),{stringify:nR,stripBom:iR}=km();async function lW(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||bl,r="throws"in e?e.throws:!0,i=await jm.fromCallback(t.readFile)(n,e);i=iR(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(a){if(r)throw a.message=`${n}: ${a.message}`,a;return null}return s}o(lW,"_readFile");var uW=jm.fromPromise(lW);function fW(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||bl,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=iR(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(fW,"readFileSync");async function dW(n,e,t={}){let r=t.fs||bl,i=nR(e,t);await jm.fromCallback(r.writeFile)(n,i,t)}o(dW,"_writeFile");var hW=jm.fromPromise(dW);function pW(n,e,t={}){let r=t.fs||bl,i=nR(e,t);return r.writeFileSync(n,i,t)}o(pW,"writeFileSync");sR.exports={readFile:uW,readFileSync:fW,writeFile:hW,writeFileSync:pW}});var cR=b((Ile,oR)=>{"use strict";var Mm=aR();oR.exports={readJson:Mm.readFile,readJsonSync:Mm.readFileSync,writeJson:Mm.writeFile,writeJsonSync:Mm.writeFileSync}});var $m=b((Cle,fR)=>{"use strict";var mW=wr().fromPromise,Mw=mn(),lR=require("path"),uR=Mi(),gW=Ba().pathExists;async function yW(n,e,t="utf-8"){let r=lR.dirname(n);return await gW(r)||await uR.mkdirs(r),Mw.writeFile(n,e,t)}o(yW,"outputFile");function _W(n,...e){let t=lR.dirname(n);Mw.existsSync(t)||uR.mkdirsSync(t),Mw.writeFileSync(n,...e)}o(_W,"outputFileSync");fR.exports={outputFile:mW(yW),outputFileSync:_W}});var hR=b((Ole,dR)=>{"use strict";var{stringify:bW}=km(),{outputFile:SW}=$m();async function wW(n,e,t={}){let r=bW(e,t);await SW(n,r,t)}o(wW,"outputJson");dR.exports=wW});var mR=b((Fle,pR)=>{"use strict";var{stringify:vW}=km(),{outputFileSync:EW}=$m();function TW(n,e,t){let r=vW(e,t);EW(n,r,t)}o(TW,"outputJsonSync");pR.exports=TW});var yR=b((Nle,gR)=>{"use strict";var AW=wr().fromPromise,yn=cR();yn.outputJson=AW(hR());yn.outputJsonSync=mR();yn.outputJSON=yn.outputJson;yn.outputJSONSync=yn.outputJsonSync;yn.writeJSON=yn.writeJson;yn.writeJSONSync=yn.writeJsonSync;yn.readJSON=yn.readJson;yn.readJSONSync=yn.readJsonSync;gR.exports=yn});var vR=b((Lle,wR)=>{"use strict";var xW=mn(),_R=require("path"),{copy:IW}=Lm(),{remove:SR}=pf(),{mkdirp:CW}=Mi(),{pathExists:RW}=Ba(),bR=Bo();async function OW(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await bR.checkPaths(n,e,"move",t);await bR.checkParentPaths(n,i,e,"move");let a=_R.dirname(e);return _R.parse(a).root!==a&&await CW(a),PW(n,e,r,s)}o(OW,"move");async function PW(n,e,t,r){if(!r){if(t)await SR(e);else if(await RW(e))throw new Error("dest already exists.")}try{await xW.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await FW(n,e,t)}}o(PW,"doRename");async function FW(n,e,t){return await IW(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),SR(n)}o(FW,"moveAcrossDevice");wR.exports=OW});var IR=b((jle,xR)=>{"use strict";var TR=gl(),Vw=require("path"),DW=Lm().copySync,AR=pf().removeSync,NW=Mi().mkdirpSync,ER=Bo();function LW(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=ER.checkPathsSync(n,e,"move",t);return ER.checkParentPathsSync(n,i,e,"move"),kW(e)||NW(Vw.dirname(e)),jW(n,e,r,s)}o(LW,"moveSync");function kW(n){let e=Vw.dirname(n);return Vw.parse(e).root===e}o(kW,"isParentRoot");function jW(n,e,t,r){if(r)return $w(n,e,t);if(t)return AR(e),$w(n,e,t);if(TR.existsSync(e))throw new Error("dest already exists.");return $w(n,e,t)}o(jW,"doRename");function $w(n,e,t){try{TR.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return MW(n,e,t)}}o($w,"rename");function MW(n,e,t){return DW(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),AR(n)}o(MW,"moveAcrossDevice");xR.exports=LW});var RR=b(($le,CR)=>{"use strict";var $W=wr().fromPromise;CR.exports={move:$W(vR()),moveSync:IR()}});var Sl=b((Vle,OR)=>{"use strict";OR.exports={...mn(),...Lm(),...RC(),...tR(),...yR(),...Mi(),...RR(),...$m(),...Ba(),...pf()}});var MO=b((qle,jO)=>{"use strict";jO.exports=LO;function LO(n,e,t){n instanceof RegExp&&(n=NO(n,t)),e instanceof RegExp&&(e=NO(e,t));var r=kO(n,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+n.length,r[1]),post:t.slice(r[1]+e.length)}}o(LO,"balanced");function NO(n,e){var t=e.match(n);return t?t[0]:null}o(NO,"maybeMatch");LO.range=kO;function kO(n,e,t){var r,i,s,a,c,l=t.indexOf(n),u=t.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(n===e)return[l,u];for(r=[],s=t.length;f>=0&&!c;)f==l?(r.push(f),l=t.indexOf(n,f+1)):r.length==1?c=[r.pop(),u]:(i=r.pop(),i<s&&(s=i,a=u),u=t.indexOf(e,f+1)),f=l<u&&l>=0?l:u;r.length&&(c=[s,a])}return c}o(kO,"range")});var zO=b((Gle,GO)=>{var $O=MO();GO.exports=oH;var VO="\0SLASH"+Math.random()+"\0",BO="\0OPEN"+Math.random()+"\0",rv="\0CLOSE"+Math.random()+"\0",UO="\0COMMA"+Math.random()+"\0",qO="\0PERIOD"+Math.random()+"\0";function tv(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(tv,"numeric");function sH(n){return n.split("\\\\").join(VO).split("\\{").join(BO).split("\\}").join(rv).split("\\,").join(UO).split("\\.").join(qO)}o(sH,"escapeBraces");function aH(n){return n.split(VO).join("\\").split(BO).join("{").split(rv).join("}").split(UO).join(",").split(qO).join(".")}o(aH,"unescapeBraces");function WO(n){if(!n)return[""];var e=[],t=$O("{","}",n);if(!t)return n.split(",");var r=t.pre,i=t.body,s=t.post,a=r.split(",");a[a.length-1]+="{"+i+"}";var c=WO(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(WO,"parseCommaParts");function oH(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),wf(sH(n),!0).map(aH)):[]}o(oH,"expandTop");function cH(n){return"{"+n+"}"}o(cH,"embrace");function lH(n){return/^-?0\d/.test(n)}o(lH,"isPadded");function uH(n,e){return n<=e}o(uH,"lte");function fH(n,e){return n>=e}o(fH,"gte");function wf(n,e){var t=[],r=$O("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?wf(r.post,!1):[""];if(/\$$/.test(r.pre))for(var a=0;a<s.length;a++){var c=i+"{"+r.body+"}"+s[a];t.push(c)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),f=l||u,d=r.body.indexOf(",")>=0;if(!f&&!d)return r.post.match(/,(?!,).*\}/)?(n=r.pre+"{"+r.body+rv+r.post,wf(n)):[n];var h;if(f)h=r.body.split(/\.\./);else if(h=WO(r.body),h.length===1&&(h=wf(h[0],!1).map(cH),h.length===1))return s.map(function(D){return r.pre+h[0]+D});var p;if(f){var y=tv(h[0]),S=tv(h[1]),v=Math.max(h[0].length,h[1].length),w=h.length==3?Math.max(Math.abs(tv(h[2])),1):1,T=uH,C=S<y;C&&(w*=-1,T=fH);var L=h.some(lH);p=[];for(var $=y;T($,S);$+=w){var ee;if(u)ee=String.fromCharCode($),ee==="\\"&&(ee="");else if(ee=String($),L){var B=v-ee.length;if(B>0){var G=new Array(B+1).join("0");$<0?ee="-"+G+ee.slice(1):ee=G+ee}}p.push(ee)}}else{p=[];for(var F=0;F<h.length;F++)p.push.apply(p,wf(h[F],!1))}for(var F=0;F<p.length;F++)for(var a=0;a<s.length;a++){var c=i+p[F]+s[a];(!e||f||c)&&t.push(c)}}return t}o(wf,"expand")});var MD=b(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.createPathBasedTargetResolver=xs;wn.createCreateRelatedTaskService=_X;wn.createCreateRelatedProjectService=bX;wn.createCreateAssetService=SX;wn.createArchiveAssetService=wX;wn.createCleanPropertiesService=vX;wn.createFixMissingLabelService=EX;wn.createRenameToUidService=TX;wn.createRepairFolderService=AX;wn.createPlanForEveningService=xX;wn.createUpdatePropertyService=IX;wn.createRemovePropertyService=CX;wn.createSetStatusService=RX;var jD=fr();function xs(n){return{resolveFile(e){let t=n.getAbstractFileByPath(`${e}.md`);if(!t||!("basename"in t))throw new Error(`Cannot resolve target file for IRI: ${e}`);return t}}}o(xs,"createPathBasedTargetResolver");var b2=o(()=>null,"NULL_CLASS_RESOLVER");function Hg(n){return n.startsWith('"[[')&&n.endsWith(']]"')?n:n.startsWith("[[")&&n.endsWith("]]")?`"${n}"`:`"[[${n}]]"`}o(Hg,"toQuotedWikilink");function _X(n,e,t=xs(n),r,i=b2){return{async execute(s,a){let c=a?.label;if(!c)throw new Error("createRelatedTask requires userInput.label");let l=t.resolveFile(s),u=n.getFrontmatter(l)??{},f=l.parent?.path||"",d={ems__Effort_status:'"[[c42245d0-01de-4c35-bfcf-d910445ea28e]]"'},h=a?.parentProperty;h&&l.basename&&(d[h]=`"[[${l.basename}]]"`);let p=await e.createAsset({className:"ems__Task",label:c,folderPath:f,propertyValues:d,parentFile:l,parentMetadata:u,classResolver:i});r&&await r(p)}}}o(_X,"createCreateRelatedTaskService");function bX(n,e,t=xs(n),r,i=b2){return{async execute(s,a){let c=a?.label;if(!c)throw new Error("createRelatedProject requires userInput.label");let l=t.resolveFile(s),u=n.getFrontmatter(l)??{},f=l.parent?.path||"",d={ems__Effort_status:'"[[c42245d0-01de-4c35-bfcf-d910445ea28e]]"'},h=a?.parentProperty;h&&l.basename&&(d[h]=`"[[${l.basename}]]"`);let p=await e.createAsset({className:"ems__Project",label:c,folderPath:f,propertyValues:d,parentFile:l,parentMetadata:u,classResolver:i});r&&await r(p)}}}o(bX,"createCreateRelatedProjectService");function SX(n,e,t=b2,r=xs(n)){return{async execute(i,s){let a=s?.prototypeUID??s?.prototype,c=s?.label,l=s?.folder,u=s?.ownerIdentity,f=s?.isDefinedBy;if(!a)throw new Error("createAsset requires userInput.prototypeUID");if(!c)throw new Error("createAsset requires userInput.label");let d,h;if(i)try{let $=r.resolveFile(i);d=$.path,h=n.getFrontmatter($)??void 0}catch{}if(!l&&d){let $=d.lastIndexOf("/");l=$>=0?d.substring(0,$):""}if(l===void 0)throw new Error("createAsset requires userInput.folder");let p=a.endsWith("Prototype")?a.slice(0,-9):a,y=crypto.randomUUID(),S=jD.DateFormatter.toISOTimestamp(new Date),v=`${y}.md`,w=l?`${l}/${v}`:v,T=["---",`exo__Asset_uid: ${y}`,`exo__Asset_createdAt: ${S}`,`exo__Asset_label: ${c}`,`exo__Asset_prototype: "[[${a}]]"`,"exo__Instance_class:",` - "[[${p}]]"`],C=!1;if(f&&(T.push(`exo__Asset_isDefinedBy: ${Hg(f)}`),C=!0),h){let $=h.exo__Instance_class,B=(Array.isArray($)?$:$!=null?[$]:[]).some(F=>jD.WikiLinkHelpers.resolveSymbolic(String(F),t).includes("Area")),G=d?d.substring(d.lastIndexOf("/")+1).replace(/\.md$/,""):void 0;if(G){let F=B?"ems__Effort_area":"ems__Effort_parent";T.push(`${F}: "[[${G}]]"`)}!B&&h.ems__Effort_area&&T.push(`ems__Effort_area: ${Hg(String(h.ems__Effort_area))}`),T.push('ems__Effort_status: "[[753a44d5-846c-4b82-9196-4fd9a4d48777]]"'),!C&&h.exo__Asset_isDefinedBy&&(T.push(`exo__Asset_isDefinedBy: ${Hg(String(h.exo__Asset_isDefinedBy))}`),C=!0)}!C&&u&&T.push(`exo__Asset_isDefinedBy: ${Hg(u)}`),T.push("---","");let L=T.join(`
|
|
458
458
|
`);await e.createFile(w,L)}}}o(SX,"createCreateAssetService");function wX(n,e,t=xs(n)){return{async execute(r){let i=t.resolveFile(r);await e.archiveAsset(i)}}}o(wX,"createArchiveAssetService");function vX(n,e,t=xs(n)){return{async execute(r){let i=t.resolveFile(r);await e.cleanEmptyProperties(i)}}}o(vX,"createCleanPropertiesService");function EX(n,e,t=xs(n)){return{async execute(r){let i=t.resolveFile(r);await e.fixMissingLabel(i)}}}o(EX,"createFixMissingLabelService");function TX(n,e,t=xs(n)){return{async execute(r){let i=t.resolveFile(r),s=n.getFrontmatter(i)??{};await e.renameToUid(i,s)}}}o(TX,"createRenameToUidService");function AX(n,e,t=xs(n)){return{async execute(r){let i=t.resolveFile(r),s=n.getFrontmatter(i)??{},a=await e.getExpectedFolder(i,s);if(a===null)throw new Error("repairFolder: cannot determine expected folder (missing exo__Asset_isDefinedBy or referenced asset not found)");(i.parent?.path??"")!==a&&await e.repairFolder(i,a)}}}o(AX,"createRepairFolderService");function xX(n,e,t=xs(n)){return{async execute(r){let i=t.resolveFile(r);await e.planForEvening(i)}}}o(xX,"createPlanForEveningService");function IX(n,e,t){return{async execute(r,i){let s=i?.property,a=i?.value;if(!s)throw new Error("updateProperty requires userInput.property");if(a===void 0)throw new Error("updateProperty requires userInput.value");let c=await t.resolveTargetPath(r),l=await n.readFile(c),u=e.updateProperty(l,s,a);await n.updateFile(c,u)}}}o(IX,"createUpdatePropertyService");function CX(n,e,t){return{async execute(r,i){let s=i?.property;if(!s)throw new Error("removeProperty requires userInput.property");let a=await t.resolveTargetPath(r),c=await n.readFile(a),l=e.removeProperty(c,s);await n.updateFile(a,l)}}}o(CX,"createRemovePropertyService");function RX(n,e,t){return{async execute(r,i){let s=i?.statusUID;if(!s)throw new Error("setStatus requires userInput.statusUID");let a=await t.resolveTargetPath(r),c=await n.readFile(a),l=e.updateProperty(c,"ems__Effort_status",`"[[${s}]]"`);await n.updateFile(a,l)}}}o(RX,"createSetStatusService")});var $D=b(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.createPathBasedTargetResolver=_t.createSetStatusService=_t.createRemovePropertyService=_t.createUpdatePropertyService=_t.createPlanForEveningService=_t.createRepairFolderService=_t.createRenameToUidService=_t.createFixMissingLabelService=_t.createCleanPropertiesService=_t.createArchiveAssetService=_t.createCreateRelatedProjectService=_t.createCreateRelatedTaskService=_t.createCreateAssetService=void 0;var zn=MD();Object.defineProperty(_t,"createCreateAssetService",{enumerable:!0,get:o(function(){return zn.createCreateAssetService},"get")});Object.defineProperty(_t,"createCreateRelatedTaskService",{enumerable:!0,get:o(function(){return zn.createCreateRelatedTaskService},"get")});Object.defineProperty(_t,"createCreateRelatedProjectService",{enumerable:!0,get:o(function(){return zn.createCreateRelatedProjectService},"get")});Object.defineProperty(_t,"createArchiveAssetService",{enumerable:!0,get:o(function(){return zn.createArchiveAssetService},"get")});Object.defineProperty(_t,"createCleanPropertiesService",{enumerable:!0,get:o(function(){return zn.createCleanPropertiesService},"get")});Object.defineProperty(_t,"createFixMissingLabelService",{enumerable:!0,get:o(function(){return zn.createFixMissingLabelService},"get")});Object.defineProperty(_t,"createRenameToUidService",{enumerable:!0,get:o(function(){return zn.createRenameToUidService},"get")});Object.defineProperty(_t,"createRepairFolderService",{enumerable:!0,get:o(function(){return zn.createRepairFolderService},"get")});Object.defineProperty(_t,"createPlanForEveningService",{enumerable:!0,get:o(function(){return zn.createPlanForEveningService},"get")});Object.defineProperty(_t,"createUpdatePropertyService",{enumerable:!0,get:o(function(){return zn.createUpdatePropertyService},"get")});Object.defineProperty(_t,"createRemovePropertyService",{enumerable:!0,get:o(function(){return zn.createRemovePropertyService},"get")});Object.defineProperty(_t,"createSetStatusService",{enumerable:!0,get:o(function(){return zn.createSetStatusService},"get")});Object.defineProperty(_t,"createPathBasedTargetResolver",{enumerable:!0,get:o(function(){return zn.createPathBasedTargetResolver},"get")})});var MX={};gy(MX,{createProgram:()=>GD});module.exports=_d(MX);var E_e=le(yy());var AE=le(TE(),1),{program:sJ,createCommand:aJ,createArgument:oJ,createOption:cJ,CommanderError:lJ,InvalidArgumentError:uJ,InvalidOptionArgumentError:fJ,Command:Ie,Argument:dJ,Option:hJ,Help:pJ}=AE.default;var Wl=require("fs"),Hf=require("path"),Ut=le(fr());var nr=le(Sl()),Ht=le(require("path"));function zR(n){return typeof n>"u"||n===null}o(zR,"isNothing");function VW(n){return typeof n=="object"&&n!==null}o(VW,"isObject");function BW(n){return Array.isArray(n)?n:zR(n)?[]:[n]}o(BW,"toArray");function UW(n,e){var t,r,i,s;if(e)for(s=Object.keys(e),t=0,r=s.length;t<r;t+=1)i=s[t],n[i]=e[i];return n}o(UW,"extend");function qW(n,e){var t="",r;for(r=0;r<e;r+=1)t+=n;return t}o(qW,"repeat");function WW(n){return n===0&&Number.NEGATIVE_INFINITY===1/n}o(WW,"isNegativeZero");var GW=zR,zW=VW,HW=BW,QW=qW,KW=WW,YW=UW,dr={isNothing:GW,isObject:zW,toArray:HW,repeat:QW,isNegativeZero:KW,extend:YW};function HR(n,e){var t="",r=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(t+='in "'+n.mark.name+'" '),t+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!e&&n.mark.snippet&&(t+=`
|
|
459
459
|
|
|
460
460
|
`+n.mark.snippet),r+" "+t):r}o(HR,"formatError");function yf(n,e){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=e,this.message=HR(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}o(yf,"YAMLException$1");yf.prototype=Object.create(Error.prototype);yf.prototype.constructor=yf;yf.prototype.toString=o(function(e){return this.name+": "+HR(this,e)},"toString");var _n=yf;function Bw(n,e,t,r,i){var s="",a="",c=Math.floor(i/2)-1;return r-e>c&&(s=" ... ",e=r-c+s.length),t-r>c&&(a=" ...",t=r+c-a.length),{str:s+n.slice(e,t).replace(/\t/g,"\u2192")+a,pos:r-e+s.length}}o(Bw,"getLine");function Uw(n,e){return dr.repeat(" ",e-n.length)+n}o(Uw,"padStart");function XW(n,e){if(e=Object.create(e||null),!n.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var t=/\r?\n|\r|\0/g,r=[0],i=[],s,a=-1;s=t.exec(n.buffer);)i.push(s.index),r.push(s.index+s[0].length),n.position<=s.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var c="",l,u,f=Math.min(n.line+e.linesAfter,i.length).toString().length,d=e.maxLength-(e.indent+f+3);for(l=1;l<=e.linesBefore&&!(a-l<0);l++)u=Bw(n.buffer,r[a-l],i[a-l],n.position-(r[a]-r[a-l]),d),c=dr.repeat(" ",e.indent)+Uw((n.line-l+1).toString(),f)+" | "+u.str+`
|
|
@@ -463,15 +463,15 @@ GFS4: `),console.error(n)},"debug"));Lt[kr]||(qI=global[kr]||[],GI(Lt,qI),Lt.clo
|
|
|
463
463
|
`,l=1;l<=e.linesAfter&&!(a+l>=i.length);l++)u=Bw(n.buffer,r[a+l],i[a+l],n.position-(r[a]-r[a+l]),d),c+=dr.repeat(" ",e.indent)+Uw((n.line+l+1).toString(),f)+" | "+u.str+`
|
|
464
464
|
`;return c.replace(/\n$/,"")}o(XW,"makeSnippet");var JW=XW,ZW=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],eG=["scalar","sequence","mapping"];function tG(n){var e={};return n!==null&&Object.keys(n).forEach(function(t){n[t].forEach(function(r){e[String(r)]=t})}),e}o(tG,"compileStyleAliases");function rG(n,e){if(e=e||{},Object.keys(e).forEach(function(t){if(ZW.indexOf(t)===-1)throw new _n('Unknown option "'+t+'" is met in definition of "'+n+'" YAML type.')}),this.options=e,this.tag=n,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=tG(e.styleAliases||null),eG.indexOf(this.kind)===-1)throw new _n('Unknown kind "'+this.kind+'" is specified for "'+n+'" YAML type.')}o(rG,"Type$1");var jr=rG;function PR(n,e){var t=[];return n[e].forEach(function(r){var i=t.length;t.forEach(function(s,a){s.tag===r.tag&&s.kind===r.kind&&s.multi===r.multi&&(i=a)}),t[i]=r}),t}o(PR,"compileList");function nG(){var n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,t;function r(i){i.multi?(n.multi[i.kind].push(i),n.multi.fallback.push(i)):n[i.kind][i.tag]=n.fallback[i.tag]=i}for(o(r,"collectType"),e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return n}o(nG,"compileMap");function Ww(n){return this.extend(n)}o(Ww,"Schema$1");Ww.prototype.extend=o(function(e){var t=[],r=[];if(e instanceof jr)r.push(e);else if(Array.isArray(e))r=r.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(r=r.concat(e.explicit));else throw new _n("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(s){if(!(s instanceof jr))throw new _n("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new _n("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new _n("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(s){if(!(s instanceof jr))throw new _n("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Ww.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=PR(i,"implicit"),i.compiledExplicit=PR(i,"explicit"),i.compiledTypeMap=nG(i.compiledImplicit,i.compiledExplicit),i},"extend");var QR=Ww,KR=new jr("tag:yaml.org,2002:str",{kind:"scalar",construct:o(function(n){return n!==null?n:""},"construct")}),YR=new jr("tag:yaml.org,2002:seq",{kind:"sequence",construct:o(function(n){return n!==null?n:[]},"construct")}),XR=new jr("tag:yaml.org,2002:map",{kind:"mapping",construct:o(function(n){return n!==null?n:{}},"construct")}),JR=new QR({explicit:[KR,YR,XR]});function iG(n){if(n===null)return!0;var e=n.length;return e===1&&n==="~"||e===4&&(n==="null"||n==="Null"||n==="NULL")}o(iG,"resolveYamlNull");function sG(){return null}o(sG,"constructYamlNull");function aG(n){return n===null}o(aG,"isNull");var ZR=new jr("tag:yaml.org,2002:null",{kind:"scalar",resolve:iG,construct:sG,predicate:aG,represent:{canonical:o(function(){return"~"},"canonical"),lowercase:o(function(){return"null"},"lowercase"),uppercase:o(function(){return"NULL"},"uppercase"),camelcase:o(function(){return"Null"},"camelcase"),empty:o(function(){return""},"empty")},defaultStyle:"lowercase"});function oG(n){if(n===null)return!1;var e=n.length;return e===4&&(n==="true"||n==="True"||n==="TRUE")||e===5&&(n==="false"||n==="False"||n==="FALSE")}o(oG,"resolveYamlBoolean");function cG(n){return n==="true"||n==="True"||n==="TRUE"}o(cG,"constructYamlBoolean");function lG(n){return Object.prototype.toString.call(n)==="[object Boolean]"}o(lG,"isBoolean");var eO=new jr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:oG,construct:cG,predicate:lG,represent:{lowercase:o(function(n){return n?"true":"false"},"lowercase"),uppercase:o(function(n){return n?"TRUE":"FALSE"},"uppercase"),camelcase:o(function(n){return n?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function uG(n){return 48<=n&&n<=57||65<=n&&n<=70||97<=n&&n<=102}o(uG,"isHexCode");function fG(n){return 48<=n&&n<=55}o(fG,"isOctCode");function dG(n){return 48<=n&&n<=57}o(dG,"isDecCode");function hG(n){if(n===null)return!1;var e=n.length,t=0,r=!1,i;if(!e)return!1;if(i=n[t],(i==="-"||i==="+")&&(i=n[++t]),i==="0"){if(t+1===e)return!0;if(i=n[++t],i==="b"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(!uG(n.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(!fG(n.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;t<e;t++)if(i=n[t],i!=="_"){if(!dG(n.charCodeAt(t)))return!1;r=!0}return!(!r||i==="_")}o(hG,"resolveYamlInteger");function pG(n){var e=n,t=1,r;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),r=e[0],(r==="-"||r==="+")&&(r==="-"&&(t=-1),e=e.slice(1),r=e[0]),e==="0")return 0;if(r==="0"){if(e[1]==="b")return t*parseInt(e.slice(2),2);if(e[1]==="x")return t*parseInt(e.slice(2),16);if(e[1]==="o")return t*parseInt(e.slice(2),8)}return t*parseInt(e,10)}o(pG,"constructYamlInteger");function mG(n){return Object.prototype.toString.call(n)==="[object Number]"&&n%1===0&&!dr.isNegativeZero(n)}o(mG,"isInteger");var tO=new jr("tag:yaml.org,2002:int",{kind:"scalar",resolve:hG,construct:pG,predicate:mG,represent:{binary:o(function(n){return n>=0?"0b"+n.toString(2):"-0b"+n.toString(2).slice(1)},"binary"),octal:o(function(n){return n>=0?"0o"+n.toString(8):"-0o"+n.toString(8).slice(1)},"octal"),decimal:o(function(n){return n.toString(10)},"decimal"),hexadecimal:o(function(n){return n>=0?"0x"+n.toString(16).toUpperCase():"-0x"+n.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),gG=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function yG(n){return!(n===null||!gG.test(n)||n[n.length-1]==="_")}o(yG,"resolveYamlFloat");function _G(n){var e,t;return e=n.replace(/_/g,"").toLowerCase(),t=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:t*parseFloat(e,10)}o(_G,"constructYamlFloat");var bG=/^[-+]?[0-9]+e/;function SG(n,e){var t;if(isNaN(n))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===n)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===n)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(dr.isNegativeZero(n))return"-0.0";return t=n.toString(10),bG.test(t)?t.replace("e",".e"):t}o(SG,"representYamlFloat");function wG(n){return Object.prototype.toString.call(n)==="[object Number]"&&(n%1!==0||dr.isNegativeZero(n))}o(wG,"isFloat");var rO=new jr("tag:yaml.org,2002:float",{kind:"scalar",resolve:yG,construct:_G,predicate:wG,represent:SG,defaultStyle:"lowercase"}),nO=JR.extend({implicit:[ZR,eO,tO,rO]}),iO=nO,sO=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),aO=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function vG(n){return n===null?!1:sO.exec(n)!==null||aO.exec(n)!==null}o(vG,"resolveYamlTimestamp");function EG(n){var e,t,r,i,s,a,c,l=0,u=null,f,d,h;if(e=sO.exec(n),e===null&&(e=aO.exec(n)),e===null)throw new Error("Date resolve error");if(t=+e[1],r=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(t,r,i));if(s=+e[4],a=+e[5],c=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(f=+e[10],d=+(e[11]||0),u=(f*60+d)*6e4,e[9]==="-"&&(u=-u)),h=new Date(Date.UTC(t,r,i,s,a,c,l)),u&&h.setTime(h.getTime()-u),h}o(EG,"constructYamlTimestamp");function TG(n){return n.toISOString()}o(TG,"representYamlTimestamp");var oO=new jr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:vG,construct:EG,instanceOf:Date,represent:TG});function AG(n){return n==="<<"||n===null}o(AG,"resolveYamlMerge");var cO=new jr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:AG}),Kw=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
465
465
|
\r`;function xG(n){if(n===null)return!1;var e,t,r=0,i=n.length,s=Kw;for(t=0;t<i;t++)if(e=s.indexOf(n.charAt(t)),!(e>64)){if(e<0)return!1;r+=6}return r%8===0}o(xG,"resolveYamlBinary");function IG(n){var e,t,r=n.replace(/[\r\n=]/g,""),i=r.length,s=Kw,a=0,c=[];for(e=0;e<i;e++)e%4===0&&e&&(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)),a=a<<6|s.indexOf(r.charAt(e));return t=i%4*6,t===0?(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)):t===18?(c.push(a>>10&255),c.push(a>>2&255)):t===12&&c.push(a>>4&255),new Uint8Array(c)}o(IG,"constructYamlBinary");function CG(n){var e="",t=0,r,i,s=n.length,a=Kw;for(r=0;r<s;r++)r%3===0&&r&&(e+=a[t>>18&63],e+=a[t>>12&63],e+=a[t>>6&63],e+=a[t&63]),t=(t<<8)+n[r];return i=s%3,i===0?(e+=a[t>>18&63],e+=a[t>>12&63],e+=a[t>>6&63],e+=a[t&63]):i===2?(e+=a[t>>10&63],e+=a[t>>4&63],e+=a[t<<2&63],e+=a[64]):i===1&&(e+=a[t>>2&63],e+=a[t<<4&63],e+=a[64],e+=a[64]),e}o(CG,"representYamlBinary");function RG(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}o(RG,"isBinary");var lO=new jr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:xG,construct:IG,predicate:RG,represent:CG}),OG=Object.prototype.hasOwnProperty,PG=Object.prototype.toString;function FG(n){if(n===null)return!0;var e=[],t,r,i,s,a,c=n;for(t=0,r=c.length;t<r;t+=1){if(i=c[t],a=!1,PG.call(i)!=="[object Object]")return!1;for(s in i)if(OG.call(i,s))if(!a)a=!0;else return!1;if(!a)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}o(FG,"resolveYamlOmap");function DG(n){return n!==null?n:[]}o(DG,"constructYamlOmap");var uO=new jr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:FG,construct:DG}),NG=Object.prototype.toString;function LG(n){if(n===null)return!0;var e,t,r,i,s,a=n;for(s=new Array(a.length),e=0,t=a.length;e<t;e+=1){if(r=a[e],NG.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[e]=[i[0],r[i[0]]]}return!0}o(LG,"resolveYamlPairs");function kG(n){if(n===null)return[];var e,t,r,i,s,a=n;for(s=new Array(a.length),e=0,t=a.length;e<t;e+=1)r=a[e],i=Object.keys(r),s[e]=[i[0],r[i[0]]];return s}o(kG,"constructYamlPairs");var fO=new jr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:LG,construct:kG}),jG=Object.prototype.hasOwnProperty;function MG(n){if(n===null)return!0;var e,t=n;for(e in t)if(jG.call(t,e)&&t[e]!==null)return!1;return!0}o(MG,"resolveYamlSet");function $G(n){return n!==null?n:{}}o($G,"constructYamlSet");var dO=new jr("tag:yaml.org,2002:set",{kind:"mapping",resolve:MG,construct:$G}),Yw=iO.extend({implicit:[oO,cO],explicit:[lO,uO,fO,dO]}),Ga=Object.prototype.hasOwnProperty,Vm=1,hO=2,pO=3,Bm=4,qw=1,VG=2,FR=3,BG=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,UG=/[\x85\u2028\u2029]/,qG=/[,\[\]\{\}]/,mO=/^(?:!|!!|![a-z\-]+!)$/i,gO=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function DR(n){return Object.prototype.toString.call(n)}o(DR,"_class");function bs(n){return n===10||n===13}o(bs,"is_EOL");function qo(n){return n===9||n===32}o(qo,"is_WHITE_SPACE");function Fn(n){return n===9||n===32||n===10||n===13}o(Fn,"is_WS_OR_EOL");function vl(n){return n===44||n===91||n===93||n===123||n===125}o(vl,"is_FLOW_INDICATOR");function WG(n){var e;return 48<=n&&n<=57?n-48:(e=n|32,97<=e&&e<=102?e-97+10:-1)}o(WG,"fromHexCode");function GG(n){return n===120?2:n===117?4:n===85?8:0}o(GG,"escapedHexLen");function zG(n){return 48<=n&&n<=57?n-48:-1}o(zG,"fromDecimalCode");function NR(n){return n===48?"\0":n===97?"\x07":n===98?"\b":n===116||n===9?" ":n===110?`
|
|
466
|
-
`:n===118?"\v":n===102?"\f":n===114?"\r":n===101?"\x1B":n===32?" ":n===34?'"':n===47?"/":n===92?"\\":n===78?"\x85":n===95?"\xA0":n===76?"\u2028":n===80?"\u2029":""}o(NR,"simpleEscapeSequence");function HG(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}o(HG,"charFromCodepoint");function yO(n,e,t){e==="__proto__"?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[e]=t}o(yO,"setProperty");var _O=new Array(256),bO=new Array(256);for(Uo=0;Uo<256;Uo++)_O[Uo]=NR(Uo)?1:0,bO[Uo]=NR(Uo);var Uo;function QG(n,e){this.input=n,this.filename=e.filename||null,this.schema=e.schema||Yw,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}o(QG,"State$1");function SO(n,e){var t={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return t.snippet=JW(t),new _n(e,t)}o(SO,"generateError");function
|
|
467
|
-
`,e-1))}o(Jw,"writeFoldedLines");function KG(n,e,t){var r,i,s,a,c,l,u,f,d=n.kind,h=n.result,p;if(p=n.input.charCodeAt(n.position),Fn(p)||vl(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=n.input.charCodeAt(n.position+1),Fn(i)||t&&vl(i)))return!1;for(n.kind="scalar",n.result="",s=a=n.position,c=!1;p!==0;){if(p===58){if(i=n.input.charCodeAt(n.position+1),Fn(i)||t&&vl(i))break}else if(p===35){if(r=n.input.charCodeAt(n.position-1),Fn(r))break}else{if(n.position===n.lineStart&&Gm(n)||t&&vl(p))break;if(bs(p))if(l=n.line,u=n.lineStart,f=n.lineIndent,tr(n,!1,-1),n.lineIndent>=e){c=!0,p=n.input.charCodeAt(n.position);continue}else{n.position=a,n.line=l,n.lineStart=u,n.lineIndent=f;break}}c&&(Wa(n,s,a,!1),Jw(n,n.line-l),s=a=n.position,c=!1),qo(p)||(a=n.position+1),p=n.input.charCodeAt(++n.position)}return Wa(n,s,a,!1),n.result?!0:(n.kind=d,n.result=h,!1)}o(KG,"readPlainScalar");function YG(n,e){var t,r,i;if(t=n.input.charCodeAt(n.position),t!==39)return!1;for(n.kind="scalar",n.result="",n.position++,r=i=n.position;(t=n.input.charCodeAt(n.position))!==0;)if(t===39)if(Wa(n,r,n.position,!0),t=n.input.charCodeAt(++n.position),t===39)r=n.position,n.position++,i=n.position;else return!0;else bs(t)?(Wa(n,r,i,!0),Jw(n,tr(n,!1,e)),r=i=n.position):n.position===n.lineStart&&Gm(n)?
|
|
466
|
+
`:n===118?"\v":n===102?"\f":n===114?"\r":n===101?"\x1B":n===32?" ":n===34?'"':n===47?"/":n===92?"\\":n===78?"\x85":n===95?"\xA0":n===76?"\u2028":n===80?"\u2029":""}o(NR,"simpleEscapeSequence");function HG(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}o(HG,"charFromCodepoint");function yO(n,e,t){e==="__proto__"?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[e]=t}o(yO,"setProperty");var _O=new Array(256),bO=new Array(256);for(Uo=0;Uo<256;Uo++)_O[Uo]=NR(Uo)?1:0,bO[Uo]=NR(Uo);var Uo;function QG(n,e){this.input=n,this.filename=e.filename||null,this.schema=e.schema||Yw,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}o(QG,"State$1");function SO(n,e){var t={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return t.snippet=JW(t),new _n(e,t)}o(SO,"generateError");function ne(n,e){throw SO(n,e)}o(ne,"throwError");function Um(n,e){n.onWarning&&n.onWarning.call(null,SO(n,e))}o(Um,"throwWarning");var LR={YAML:o(function(e,t,r){var i,s,a;e.version!==null&&ne(e,"duplication of %YAML directive"),r.length!==1&&ne(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&ne(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),a=parseInt(i[2],10),s!==1&&ne(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&Um(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:o(function(e,t,r){var i,s;r.length!==2&&ne(e,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],mO.test(i)||ne(e,"ill-formed tag handle (first argument) of the TAG directive"),Ga.call(e.tagMap,i)&&ne(e,'there is a previously declared suffix for "'+i+'" tag handle'),gO.test(s)||ne(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{ne(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function Wa(n,e,t,r){var i,s,a,c;if(e<t){if(c=n.input.slice(e,t),r)for(i=0,s=c.length;i<s;i+=1)a=c.charCodeAt(i),a===9||32<=a&&a<=1114111||ne(n,"expected valid JSON character");else BG.test(c)&&ne(n,"the stream contains non-printable characters");n.result+=c}}o(Wa,"captureSegment");function kR(n,e,t,r){var i,s,a,c;for(dr.isObject(t)||ne(n,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),a=0,c=i.length;a<c;a+=1)s=i[a],Ga.call(e,s)||(yO(e,s,t[s]),r[s]=!0)}o(kR,"mergeMappings");function El(n,e,t,r,i,s,a,c,l){var u,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),u=0,f=i.length;u<f;u+=1)Array.isArray(i[u])&&ne(n,"nested arrays are not supported inside keys"),typeof i=="object"&&DR(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&DR(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(u=0,f=s.length;u<f;u+=1)kR(n,e,s[u],t);else kR(n,e,s,t);else!n.json&&!Ga.call(t,i)&&Ga.call(e,i)&&(n.line=a||n.line,n.lineStart=c||n.lineStart,n.position=l||n.position,ne(n,"duplicated mapping key")),yO(e,i,s),delete t[i];return e}o(El,"storeMappingPair");function Xw(n){var e;e=n.input.charCodeAt(n.position),e===10?n.position++:e===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):ne(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}o(Xw,"readLineBreak");function tr(n,e,t){for(var r=0,i=n.input.charCodeAt(n.position);i!==0;){for(;qo(i);)i===9&&n.firstTabInLine===-1&&(n.firstTabInLine=n.position),i=n.input.charCodeAt(++n.position);if(e&&i===35)do i=n.input.charCodeAt(++n.position);while(i!==10&&i!==13&&i!==0);if(bs(i))for(Xw(n),i=n.input.charCodeAt(n.position),r++,n.lineIndent=0;i===32;)n.lineIndent++,i=n.input.charCodeAt(++n.position);else break}return t!==-1&&r!==0&&n.lineIndent<t&&Um(n,"deficient indentation"),r}o(tr,"skipSeparationSpace");function Gm(n){var e=n.position,t;return t=n.input.charCodeAt(e),!!((t===45||t===46)&&t===n.input.charCodeAt(e+1)&&t===n.input.charCodeAt(e+2)&&(e+=3,t=n.input.charCodeAt(e),t===0||Fn(t)))}o(Gm,"testDocumentSeparator");function Jw(n,e){e===1?n.result+=" ":e>1&&(n.result+=dr.repeat(`
|
|
467
|
+
`,e-1))}o(Jw,"writeFoldedLines");function KG(n,e,t){var r,i,s,a,c,l,u,f,d=n.kind,h=n.result,p;if(p=n.input.charCodeAt(n.position),Fn(p)||vl(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=n.input.charCodeAt(n.position+1),Fn(i)||t&&vl(i)))return!1;for(n.kind="scalar",n.result="",s=a=n.position,c=!1;p!==0;){if(p===58){if(i=n.input.charCodeAt(n.position+1),Fn(i)||t&&vl(i))break}else if(p===35){if(r=n.input.charCodeAt(n.position-1),Fn(r))break}else{if(n.position===n.lineStart&&Gm(n)||t&&vl(p))break;if(bs(p))if(l=n.line,u=n.lineStart,f=n.lineIndent,tr(n,!1,-1),n.lineIndent>=e){c=!0,p=n.input.charCodeAt(n.position);continue}else{n.position=a,n.line=l,n.lineStart=u,n.lineIndent=f;break}}c&&(Wa(n,s,a,!1),Jw(n,n.line-l),s=a=n.position,c=!1),qo(p)||(a=n.position+1),p=n.input.charCodeAt(++n.position)}return Wa(n,s,a,!1),n.result?!0:(n.kind=d,n.result=h,!1)}o(KG,"readPlainScalar");function YG(n,e){var t,r,i;if(t=n.input.charCodeAt(n.position),t!==39)return!1;for(n.kind="scalar",n.result="",n.position++,r=i=n.position;(t=n.input.charCodeAt(n.position))!==0;)if(t===39)if(Wa(n,r,n.position,!0),t=n.input.charCodeAt(++n.position),t===39)r=n.position,n.position++,i=n.position;else return!0;else bs(t)?(Wa(n,r,i,!0),Jw(n,tr(n,!1,e)),r=i=n.position):n.position===n.lineStart&&Gm(n)?ne(n,"unexpected end of the document within a single quoted scalar"):(n.position++,i=n.position);ne(n,"unexpected end of the stream within a single quoted scalar")}o(YG,"readSingleQuotedScalar");function XG(n,e){var t,r,i,s,a,c;if(c=n.input.charCodeAt(n.position),c!==34)return!1;for(n.kind="scalar",n.result="",n.position++,t=r=n.position;(c=n.input.charCodeAt(n.position))!==0;){if(c===34)return Wa(n,t,n.position,!0),n.position++,!0;if(c===92){if(Wa(n,t,n.position,!0),c=n.input.charCodeAt(++n.position),bs(c))tr(n,!1,e);else if(c<256&&_O[c])n.result+=bO[c],n.position++;else if((a=GG(c))>0){for(i=a,s=0;i>0;i--)c=n.input.charCodeAt(++n.position),(a=WG(c))>=0?s=(s<<4)+a:ne(n,"expected hexadecimal character");n.result+=HG(s),n.position++}else ne(n,"unknown escape sequence");t=r=n.position}else bs(c)?(Wa(n,t,r,!0),Jw(n,tr(n,!1,e)),t=r=n.position):n.position===n.lineStart&&Gm(n)?ne(n,"unexpected end of the document within a double quoted scalar"):(n.position++,r=n.position)}ne(n,"unexpected end of the stream within a double quoted scalar")}o(XG,"readDoubleQuotedScalar");function JG(n,e){var t=!0,r,i,s,a=n.tag,c,l=n.anchor,u,f,d,h,p,y=Object.create(null),S,v,w,T;if(T=n.input.charCodeAt(n.position),T===91)f=93,p=!1,c=[];else if(T===123)f=125,p=!0,c={};else return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=c),T=n.input.charCodeAt(++n.position);T!==0;){if(tr(n,!0,e),T=n.input.charCodeAt(n.position),T===f)return n.position++,n.tag=a,n.anchor=l,n.kind=p?"mapping":"sequence",n.result=c,!0;t?T===44&&ne(n,"expected the node content, but found ','"):ne(n,"missed comma between flow collection entries"),v=S=w=null,d=h=!1,T===63&&(u=n.input.charCodeAt(n.position+1),Fn(u)&&(d=h=!0,n.position++,tr(n,!0,e))),r=n.line,i=n.lineStart,s=n.position,Tl(n,e,Vm,!1,!0),v=n.tag,S=n.result,tr(n,!0,e),T=n.input.charCodeAt(n.position),(h||n.line===r)&&T===58&&(d=!0,T=n.input.charCodeAt(++n.position),tr(n,!0,e),Tl(n,e,Vm,!1,!0),w=n.result),p?El(n,c,y,v,S,w,r,i,s):d?c.push(El(n,null,y,v,S,w,r,i,s)):c.push(S),tr(n,!0,e),T=n.input.charCodeAt(n.position),T===44?(t=!0,T=n.input.charCodeAt(++n.position)):t=!1}ne(n,"unexpected end of the stream within a flow collection")}o(JG,"readFlowCollection");function ZG(n,e){var t,r,i=qw,s=!1,a=!1,c=e,l=0,u=!1,f,d;if(d=n.input.charCodeAt(n.position),d===124)r=!1;else if(d===62)r=!0;else return!1;for(n.kind="scalar",n.result="";d!==0;)if(d=n.input.charCodeAt(++n.position),d===43||d===45)qw===i?i=d===43?FR:VG:ne(n,"repeat of a chomping mode identifier");else if((f=zG(d))>=0)f===0?ne(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?ne(n,"repeat of an indentation width identifier"):(c=e+f-1,a=!0);else break;if(qo(d)){do d=n.input.charCodeAt(++n.position);while(qo(d));if(d===35)do d=n.input.charCodeAt(++n.position);while(!bs(d)&&d!==0)}for(;d!==0;){for(Xw(n),n.lineIndent=0,d=n.input.charCodeAt(n.position);(!a||n.lineIndent<c)&&d===32;)n.lineIndent++,d=n.input.charCodeAt(++n.position);if(!a&&n.lineIndent>c&&(c=n.lineIndent),bs(d)){l++;continue}if(n.lineIndent<c){i===FR?n.result+=dr.repeat(`
|
|
468
468
|
`,s?1+l:l):i===qw&&s&&(n.result+=`
|
|
469
469
|
`);break}for(r?qo(d)?(u=!0,n.result+=dr.repeat(`
|
|
470
470
|
`,s?1+l:l)):u?(u=!1,n.result+=dr.repeat(`
|
|
471
471
|
`,l+1)):l===0?s&&(n.result+=" "):n.result+=dr.repeat(`
|
|
472
472
|
`,l):n.result+=dr.repeat(`
|
|
473
|
-
`,s?1+l:l),s=!0,a=!0,l=0,t=n.position;!bs(d)&&d!==0;)d=n.input.charCodeAt(++n.position);Wa(n,t,n.position,!1)}return!0}o(ZG,"readBlockScalar");function jR(n,e){var t,r=n.tag,i=n.anchor,s=[],a,c=!1,l;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=s),l=n.input.charCodeAt(n.position);l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,
|
|
474
|
-
`),n.charCodeAt(0)===65279&&(n=n.slice(1)));var t=new QG(n,e),r=n.indexOf("\0");for(r!==-1&&(t.position=r,
|
|
473
|
+
`,s?1+l:l),s=!0,a=!0,l=0,t=n.position;!bs(d)&&d!==0;)d=n.input.charCodeAt(++n.position);Wa(n,t,n.position,!1)}return!0}o(ZG,"readBlockScalar");function jR(n,e){var t,r=n.tag,i=n.anchor,s=[],a,c=!1,l;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=s),l=n.input.charCodeAt(n.position);l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,ne(n,"tab characters must not be used in indentation")),!(l!==45||(a=n.input.charCodeAt(n.position+1),!Fn(a))));){if(c=!0,n.position++,tr(n,!0,-1)&&n.lineIndent<=e){s.push(null),l=n.input.charCodeAt(n.position);continue}if(t=n.line,Tl(n,e,pO,!1,!0),s.push(n.result),tr(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===t||n.lineIndent>e)&&l!==0)ne(n,"bad indentation of a sequence entry");else if(n.lineIndent<e)break}return c?(n.tag=r,n.anchor=i,n.kind="sequence",n.result=s,!0):!1}o(jR,"readBlockSequence");function ez(n,e,t){var r,i,s,a,c,l,u=n.tag,f=n.anchor,d={},h=Object.create(null),p=null,y=null,S=null,v=!1,w=!1,T;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=d),T=n.input.charCodeAt(n.position);T!==0;){if(!v&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,ne(n,"tab characters must not be used in indentation")),r=n.input.charCodeAt(n.position+1),s=n.line,(T===63||T===58)&&Fn(r))T===63?(v&&(El(n,d,h,p,y,null,a,c,l),p=y=S=null),w=!0,v=!0,i=!0):v?(v=!1,i=!0):ne(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,T=r;else{if(a=n.line,c=n.lineStart,l=n.position,!Tl(n,t,hO,!1,!0))break;if(n.line===s){for(T=n.input.charCodeAt(n.position);qo(T);)T=n.input.charCodeAt(++n.position);if(T===58)T=n.input.charCodeAt(++n.position),Fn(T)||ne(n,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(El(n,d,h,p,y,null,a,c,l),p=y=S=null),w=!0,v=!1,i=!1,p=n.tag,y=n.result;else if(w)ne(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=u,n.anchor=f,!0}else if(w)ne(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=u,n.anchor=f,!0}if((n.line===s||n.lineIndent>e)&&(v&&(a=n.line,c=n.lineStart,l=n.position),Tl(n,e,Bm,!0,i)&&(v?y=n.result:S=n.result),v||(El(n,d,h,p,y,S,a,c,l),p=y=S=null),tr(n,!0,-1),T=n.input.charCodeAt(n.position)),(n.line===s||n.lineIndent>e)&&T!==0)ne(n,"bad indentation of a mapping entry");else if(n.lineIndent<e)break}return v&&El(n,d,h,p,y,null,a,c,l),w&&(n.tag=u,n.anchor=f,n.kind="mapping",n.result=d),w}o(ez,"readBlockMapping");function tz(n){var e,t=!1,r=!1,i,s,a;if(a=n.input.charCodeAt(n.position),a!==33)return!1;if(n.tag!==null&&ne(n,"duplication of a tag property"),a=n.input.charCodeAt(++n.position),a===60?(t=!0,a=n.input.charCodeAt(++n.position)):a===33?(r=!0,i="!!",a=n.input.charCodeAt(++n.position)):i="!",e=n.position,t){do a=n.input.charCodeAt(++n.position);while(a!==0&&a!==62);n.position<n.length?(s=n.input.slice(e,n.position),a=n.input.charCodeAt(++n.position)):ne(n,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!Fn(a);)a===33&&(r?ne(n,"tag suffix cannot contain exclamation marks"):(i=n.input.slice(e-1,n.position+1),mO.test(i)||ne(n,"named tag handle cannot contain such characters"),r=!0,e=n.position+1)),a=n.input.charCodeAt(++n.position);s=n.input.slice(e,n.position),qG.test(s)&&ne(n,"tag suffix cannot contain flow indicator characters")}s&&!gO.test(s)&&ne(n,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ne(n,"tag name is malformed: "+s)}return t?n.tag=s:Ga.call(n.tagMap,i)?n.tag=n.tagMap[i]+s:i==="!"?n.tag="!"+s:i==="!!"?n.tag="tag:yaml.org,2002:"+s:ne(n,'undeclared tag handle "'+i+'"'),!0}o(tz,"readTagProperty");function rz(n){var e,t;if(t=n.input.charCodeAt(n.position),t!==38)return!1;for(n.anchor!==null&&ne(n,"duplication of an anchor property"),t=n.input.charCodeAt(++n.position),e=n.position;t!==0&&!Fn(t)&&!vl(t);)t=n.input.charCodeAt(++n.position);return n.position===e&&ne(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(e,n.position),!0}o(rz,"readAnchorProperty");function nz(n){var e,t,r;if(r=n.input.charCodeAt(n.position),r!==42)return!1;for(r=n.input.charCodeAt(++n.position),e=n.position;r!==0&&!Fn(r)&&!vl(r);)r=n.input.charCodeAt(++n.position);return n.position===e&&ne(n,"name of an alias node must contain at least one character"),t=n.input.slice(e,n.position),Ga.call(n.anchorMap,t)||ne(n,'unidentified alias "'+t+'"'),n.result=n.anchorMap[t],tr(n,!0,-1),!0}o(nz,"readAlias");function Tl(n,e,t,r,i){var s,a,c,l=1,u=!1,f=!1,d,h,p,y,S,v;if(n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null,s=a=c=Bm===t||pO===t,r&&tr(n,!0,-1)&&(u=!0,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)),l===1)for(;tz(n)||rz(n);)tr(n,!0,-1)?(u=!0,c=s,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)):c=!1;if(c&&(c=u||i),(l===1||Bm===t)&&(Vm===t||hO===t?S=e:S=e+1,v=n.position-n.lineStart,l===1?c&&(jR(n,v)||ez(n,v,S))||JG(n,S)?f=!0:(a&&ZG(n,S)||YG(n,S)||XG(n,S)?f=!0:nz(n)?(f=!0,(n.tag!==null||n.anchor!==null)&&ne(n,"alias node should not have any properties")):KG(n,S,Vm===t)&&(f=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):l===0&&(f=c&&jR(n,v))),n.tag===null)n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);else if(n.tag==="?"){for(n.result!==null&&n.kind!=="scalar"&&ne(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"'),d=0,h=n.implicitTypes.length;d<h;d+=1)if(y=n.implicitTypes[d],y.resolve(n.result)){n.result=y.construct(n.result),n.tag=y.tag,n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);break}}else if(n.tag!=="!"){if(Ga.call(n.typeMap[n.kind||"fallback"],n.tag))y=n.typeMap[n.kind||"fallback"][n.tag];else for(y=null,p=n.typeMap.multi[n.kind||"fallback"],d=0,h=p.length;d<h;d+=1)if(n.tag.slice(0,p[d].tag.length)===p[d].tag){y=p[d];break}y||ne(n,"unknown tag !<"+n.tag+">"),n.result!==null&&y.kind!==n.kind&&ne(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+y.kind+'", not "'+n.kind+'"'),y.resolve(n.result,n.tag)?(n.result=y.construct(n.result,n.tag),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):ne(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.tag!==null||n.anchor!==null||f}o(Tl,"composeNode");function iz(n){var e=n.position,t,r,i,s=!1,a;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(a=n.input.charCodeAt(n.position))!==0&&(tr(n,!0,-1),a=n.input.charCodeAt(n.position),!(n.lineIndent>0||a!==37));){for(s=!0,a=n.input.charCodeAt(++n.position),t=n.position;a!==0&&!Fn(a);)a=n.input.charCodeAt(++n.position);for(r=n.input.slice(t,n.position),i=[],r.length<1&&ne(n,"directive name must not be less than one character in length");a!==0;){for(;qo(a);)a=n.input.charCodeAt(++n.position);if(a===35){do a=n.input.charCodeAt(++n.position);while(a!==0&&!bs(a));break}if(bs(a))break;for(t=n.position;a!==0&&!Fn(a);)a=n.input.charCodeAt(++n.position);i.push(n.input.slice(t,n.position))}a!==0&&Xw(n),Ga.call(LR,r)?LR[r](n,r,i):Um(n,'unknown document directive "'+r+'"')}if(tr(n,!0,-1),n.lineIndent===0&&n.input.charCodeAt(n.position)===45&&n.input.charCodeAt(n.position+1)===45&&n.input.charCodeAt(n.position+2)===45?(n.position+=3,tr(n,!0,-1)):s&&ne(n,"directives end mark is expected"),Tl(n,n.lineIndent-1,Bm,!1,!0),tr(n,!0,-1),n.checkLineBreaks&&UG.test(n.input.slice(e,n.position))&&Um(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&Gm(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,tr(n,!0,-1));return}if(n.position<n.length-1)ne(n,"end of the stream or a document separator is expected");else return}o(iz,"readDocument");function wO(n,e){n=String(n),e=e||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
|
|
474
|
+
`),n.charCodeAt(0)===65279&&(n=n.slice(1)));var t=new QG(n,e),r=n.indexOf("\0");for(r!==-1&&(t.position=r,ne(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)iz(t);return t.documents}o(wO,"loadDocuments");function sz(n,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var r=wO(n,t);if(typeof e!="function")return r;for(var i=0,s=r.length;i<s;i+=1)e(r[i])}o(sz,"loadAll$1");function az(n,e){var t=wO(n,e);if(t.length!==0){if(t.length===1)return t[0];throw new _n("expected a single document in the stream, but found more")}}o(az,"load$1");var oz=sz,cz=az,vO={loadAll:oz,load:cz},EO=Object.prototype.toString,TO=Object.prototype.hasOwnProperty,Zw=65279,lz=9,_f=10,uz=13,fz=32,dz=33,hz=34,Gw=35,pz=37,mz=38,gz=39,yz=42,AO=44,_z=45,qm=58,bz=61,Sz=62,wz=63,vz=64,xO=91,IO=93,Ez=96,CO=123,Tz=124,RO=125,Kr={};Kr[0]="\\0";Kr[7]="\\a";Kr[8]="\\b";Kr[9]="\\t";Kr[10]="\\n";Kr[11]="\\v";Kr[12]="\\f";Kr[13]="\\r";Kr[27]="\\e";Kr[34]='\\"';Kr[92]="\\\\";Kr[133]="\\N";Kr[160]="\\_";Kr[8232]="\\L";Kr[8233]="\\P";var Az=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],xz=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Iz(n,e){var t,r,i,s,a,c,l;if(e===null)return{};for(t={},r=Object.keys(e),i=0,s=r.length;i<s;i+=1)a=r[i],c=String(e[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),l=n.compiledTypeMap.fallback[a],l&&TO.call(l.styleAliases,c)&&(c=l.styleAliases[c]),t[a]=c;return t}o(Iz,"compileStyleMap");function Cz(n){var e,t,r;if(e=n.toString(16).toUpperCase(),n<=255)t="x",r=2;else if(n<=65535)t="u",r=4;else if(n<=4294967295)t="U",r=8;else throw new _n("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+dr.repeat("0",r-e.length)+e}o(Cz,"encodeHex");var Rz=1,bf=2;function Oz(n){this.schema=n.schema||Yw,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=dr.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=Iz(this.schema,n.styles||null),this.sortKeys=n.sortKeys||!1,this.lineWidth=n.lineWidth||80,this.noRefs=n.noRefs||!1,this.noCompatMode=n.noCompatMode||!1,this.condenseFlow=n.condenseFlow||!1,this.quotingType=n.quotingType==='"'?bf:Rz,this.forceQuotes=n.forceQuotes||!1,this.replacer=typeof n.replacer=="function"?n.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}o(Oz,"State");function MR(n,e){for(var t=dr.repeat(" ",e),r=0,i=-1,s="",a,c=n.length;r<c;)i=n.indexOf(`
|
|
475
475
|
`,r),i===-1?(a=n.slice(r),r=c):(a=n.slice(r,i+1),r=i+1),a.length&&a!==`
|
|
476
476
|
`&&(s+=t),s+=a;return s}o(MR,"indentString");function zw(n,e){return`
|
|
477
477
|
`+dr.repeat(" ",n.indent*e)}o(zw,"generateNextLine");function Pz(n,e){var t,r,i;for(t=0,r=n.implicitTypes.length;t<r;t+=1)if(i=n.implicitTypes[t],i.resolve(e))return!0;return!1}o(Pz,"testImplicitResolving");function Wm(n){return n===fz||n===lz}o(Wm,"isWhitespace");function Sf(n){return 32<=n&&n<=126||161<=n&&n<=55295&&n!==8232&&n!==8233||57344<=n&&n<=65533&&n!==Zw||65536<=n&&n<=1114111}o(Sf,"isPrintable");function $R(n){return Sf(n)&&n!==Zw&&n!==uz&&n!==_f}o($R,"isNsCharOrWhitespace");function VR(n,e,t){var r=$R(n),i=r&&!Wm(n);return(t?r:r&&n!==AO&&n!==xO&&n!==IO&&n!==CO&&n!==RO)&&n!==Gw&&!(e===qm&&!i)||$R(e)&&!Wm(e)&&n===Gw||e===qm&&i}o(VR,"isPlainSafe");function Fz(n){return Sf(n)&&n!==Zw&&!Wm(n)&&n!==_z&&n!==wz&&n!==qm&&n!==AO&&n!==xO&&n!==IO&&n!==CO&&n!==RO&&n!==Gw&&n!==mz&&n!==yz&&n!==dz&&n!==Tz&&n!==bz&&n!==Sz&&n!==gz&&n!==hz&&n!==pz&&n!==vz&&n!==Ez}o(Fz,"isPlainSafeFirst");function Dz(n){return!Wm(n)&&n!==qm}o(Dz,"isPlainSafeLast");function gf(n,e){var t=n.charCodeAt(e),r;return t>=55296&&t<=56319&&e+1<n.length&&(r=n.charCodeAt(e+1),r>=56320&&r<=57343)?(t-55296)*1024+r-56320+65536:t}o(gf,"codePointAt");function OO(n){var e=/^\n* /;return e.test(n)}o(OO,"needIndentIndicator");var PO=1,Hw=2,FO=3,DO=4,wl=5;function Nz(n,e,t,r,i,s,a,c){var l,u=0,f=null,d=!1,h=!1,p=r!==-1,y=-1,S=Fz(gf(n,0))&&Dz(gf(n,n.length-1));if(e||a)for(l=0;l<n.length;u>=65536?l+=2:l++){if(u=gf(n,l),!Sf(u))return wl;S=S&&VR(u,f,c),f=u}else{for(l=0;l<n.length;u>=65536?l+=2:l++){if(u=gf(n,l),u===_f)d=!0,p&&(h=h||l-y-1>r&&n[y+1]!==" ",y=l);else if(!Sf(u))return wl;S=S&&VR(u,f,c),f=u}h=h||p&&l-y-1>r&&n[y+1]!==" "}return!d&&!h?S&&!a&&!i(n)?PO:s===bf?wl:Hw:t>9&&OO(n)?wl:a?s===bf?wl:Hw:h?DO:FO}o(Nz,"chooseScalarStyle");function Lz(n,e,t,r,i){n.dump=(function(){if(e.length===0)return n.quotingType===bf?'""':"''";if(!n.noCompatMode&&(Az.indexOf(e)!==-1||xz.test(e)))return n.quotingType===bf?'"'+e+'"':"'"+e+"'";var s=n.indent*Math.max(1,t),a=n.lineWidth===-1?-1:Math.max(Math.min(n.lineWidth,40),n.lineWidth-s),c=r||n.flowLevel>-1&&t>=n.flowLevel;function l(u){return Pz(n,u)}switch(o(l,"testAmbiguity"),Nz(e,c,n.indent,a,l,n.quotingType,n.forceQuotes&&!r,i)){case PO:return e;case Hw:return"'"+e.replace(/'/g,"''")+"'";case FO:return"|"+BR(e,n.indent)+UR(MR(e,s));case DO:return">"+BR(e,n.indent)+UR(MR(kz(e,a),s));case wl:return'"'+jz(e)+'"';default:throw new _n("impossible error: invalid scalar style")}})()}o(Lz,"writeScalar");function BR(n,e){var t=OO(n)?String(e):"",r=n[n.length-1]===`
|
|
@@ -486,7 +486,7 @@ GFS4: `),console.error(n)},"debug"));Lt[kr]||(qI=global[kr]||[],GI(Lt,qI),Lt.clo
|
|
|
486
486
|
`+n.slice(i,s),i=s+1),a=c;return l+=`
|
|
487
487
|
`,n.length-i>e&&a>i?l+=n.slice(i,a)+`
|
|
488
488
|
`+n.slice(a+1):l+=n.slice(i),l.slice(1)}o(qR,"foldLine");function jz(n){for(var e="",t=0,r,i=0;i<n.length;t>=65536?i+=2:i++)t=gf(n,i),r=Kr[t],!r&&Sf(t)?(e+=n[i],t>=65536&&(e+=n[i+1])):e+=r||Cz(t);return e}o(jz,"escapeString");function Mz(n,e,t){var r="",i=n.tag,s,a,c;for(s=0,a=t.length;s<a;s+=1)c=t[s],n.replacer&&(c=n.replacer.call(t,String(s),c)),(la(n,e,c,!1,!1)||typeof c>"u"&&la(n,e,null,!1,!1))&&(r!==""&&(r+=","+(n.condenseFlow?"":" ")),r+=n.dump);n.tag=i,n.dump="["+r+"]"}o(Mz,"writeFlowSequence");function WR(n,e,t,r){var i="",s=n.tag,a,c,l;for(a=0,c=t.length;a<c;a+=1)l=t[a],n.replacer&&(l=n.replacer.call(t,String(a),l)),(la(n,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&la(n,e+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=zw(n,e)),n.dump&&_f===n.dump.charCodeAt(0)?i+="-":i+="- ",i+=n.dump);n.tag=s,n.dump=i||"[]"}o(WR,"writeBlockSequence");function $z(n,e,t){var r="",i=n.tag,s=Object.keys(t),a,c,l,u,f;for(a=0,c=s.length;a<c;a+=1)f="",r!==""&&(f+=", "),n.condenseFlow&&(f+='"'),l=s[a],u=t[l],n.replacer&&(u=n.replacer.call(t,l,u)),la(n,e,l,!1,!1)&&(n.dump.length>1024&&(f+="? "),f+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),la(n,e,u,!1,!1)&&(f+=n.dump,r+=f));n.tag=i,n.dump="{"+r+"}"}o($z,"writeFlowMapping");function Vz(n,e,t,r){var i="",s=n.tag,a=Object.keys(t),c,l,u,f,d,h;if(n.sortKeys===!0)a.sort();else if(typeof n.sortKeys=="function")a.sort(n.sortKeys);else if(n.sortKeys)throw new _n("sortKeys must be a boolean or a function");for(c=0,l=a.length;c<l;c+=1)h="",(!r||i!=="")&&(h+=zw(n,e)),u=a[c],f=t[u],n.replacer&&(f=n.replacer.call(t,u,f)),la(n,e+1,u,!0,!0,!0)&&(d=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024,d&&(n.dump&&_f===n.dump.charCodeAt(0)?h+="?":h+="? "),h+=n.dump,d&&(h+=zw(n,e)),la(n,e+1,f,!0,d)&&(n.dump&&_f===n.dump.charCodeAt(0)?h+=":":h+=": ",h+=n.dump,i+=h));n.tag=s,n.dump=i||"{}"}o(Vz,"writeBlockMapping");function GR(n,e,t){var r,i,s,a,c,l;for(i=t?n.explicitTypes:n.implicitTypes,s=0,a=i.length;s<a;s+=1)if(c=i[s],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof e=="object"&&e instanceof c.instanceOf)&&(!c.predicate||c.predicate(e))){if(t?c.multi&&c.representName?n.tag=c.representName(e):n.tag=c.tag:n.tag="?",c.represent){if(l=n.styleMap[c.tag]||c.defaultStyle,EO.call(c.represent)==="[object Function]")r=c.represent(e,l);else if(TO.call(c.represent,l))r=c.represent[l](e,l);else throw new _n("!<"+c.tag+'> tag resolver accepts not "'+l+'" style');n.dump=r}return!0}return!1}o(GR,"detectType");function la(n,e,t,r,i,s,a){n.tag=null,n.dump=t,GR(n,t,!1)||GR(n,t,!0);var c=EO.call(n.dump),l=r,u;r&&(r=n.flowLevel<0||n.flowLevel>e);var f=c==="[object Object]"||c==="[object Array]",d,h;if(f&&(d=n.duplicates.indexOf(t),h=d!==-1),(n.tag!==null&&n.tag!=="?"||h||n.indent!==2&&e>0)&&(i=!1),h&&n.usedDuplicates[d])n.dump="*ref_"+d;else{if(f&&h&&!n.usedDuplicates[d]&&(n.usedDuplicates[d]=!0),c==="[object Object]")r&&Object.keys(n.dump).length!==0?(Vz(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):($z(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object Array]")r&&n.dump.length!==0?(n.noArrayIndent&&!a&&e>0?WR(n,e-1,n.dump,i):WR(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(Mz(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object String]")n.tag!=="?"&&Lz(n,n.dump,e,s,l);else{if(c==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new _n("unacceptable kind of an object to dump "+c)}n.tag!==null&&n.tag!=="?"&&(u=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21"),n.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",n.dump=u+" "+n.dump)}return!0}o(la,"writeNode");function Bz(n,e){var t=[],r=[],i,s;for(Qw(n,t,r),i=0,s=r.length;i<s;i+=1)e.duplicates.push(t[r[i]]);e.usedDuplicates=new Array(s)}o(Bz,"getDuplicateReferences");function Qw(n,e,t){var r,i,s;if(n!==null&&typeof n=="object")if(i=e.indexOf(n),i!==-1)t.indexOf(i)===-1&&t.push(i);else if(e.push(n),Array.isArray(n))for(i=0,s=n.length;i<s;i+=1)Qw(n[i],e,t);else for(r=Object.keys(n),i=0,s=r.length;i<s;i+=1)Qw(n[r[i]],e,t)}o(Qw,"inspectNode");function Uz(n,e){e=e||{};var t=new Oz(e);t.noRefs||Bz(n,t);var r=n;return t.replacer&&(r=t.replacer.call({"":r},"",r)),la(t,0,r,!0,!0)?t.dump+`
|
|
489
|
-
`:""}o(Uz,"dump$1");var qz=Uz,Wz={dump:qz};function ev(n,e){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}o(ev,"renamed");var Gz=jr,zz=QR,Hz=JR,Qz=nO,Kz=iO,Yz=Yw,Xz=vO.load,Jz=vO.loadAll,Zz=Wz.dump,eH=_n,tH={binary:lO,float:rO,map:XR,null:ZR,pairs:fO,set:dO,timestamp:oO,bool:eO,int:tO,merge:cO,omap:uO,seq:YR,str:KR},rH=ev("safeLoad","load"),nH=ev("safeLoadAll","loadAll"),iH=ev("safeDump","dump"),rr={Type:Gz,Schema:zz,FAILSAFE_SCHEMA:Hz,JSON_SCHEMA:Qz,CORE_SCHEMA:Kz,DEFAULT_SCHEMA:Yz,load:Xz,loadAll:Jz,dump:Zz,YAMLException:eH,types:tH,safeLoad:rH,safeLoadAll:nH,safeDump:iH};var wv=le(Sl()),Ho=le(require("path"));var tP=le(zO(),1);var vf=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var dH={"[: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]},Ef=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),hH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),HO=o(n=>n.join(""),"rangesToString"),QO=o((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,a=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<n.length;){let S=n.charAt(s);if((S==="!"||S==="^")&&s===t+1){u=!0,s++;continue}if(S==="]"&&a&&!l){f=s+1;break}if(a=!0,S==="\\"&&!l){l=!0,s++;continue}if(S==="["&&!l){for(let[v,[w,T,C]]of Object.entries(dH))if(n.startsWith(v,s)){if(d)return["$.",!1,n.length-t,!0];s+=v.length,C?i.push(w):r.push(w),c=c||T;continue e}}if(l=!1,d){S>d?r.push(Ef(d)+"-"+Ef(S)):S===d&&r.push(Ef(S)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Ef(S+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=S,s+=2;continue}r.push(Ef(S)),s++}if(f<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let S=r[0].length===2?r[0].slice(-1):r[0];return[hH(S),!1,f-t,!1]}let h="["+(u?"^":"")+HO(r)+"]",p="["+(u?"":"^")+HO(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var $i=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Dn,pH=new Set(["!","?","+","*","@"]),nv=o(n=>pH.has(n),"isExtglobType"),KO=o(n=>nv(n.type),"isExtglobAST"),mH=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),gH=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),yH=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),YO=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),_H="(?!(?:^|/)\\.\\.?(?:$|/))",zm="(?!\\.)",bH=new Set(["[","."]),SH=new Set(["..","."]),wH=new Set("().*{}+?[]^$\\!"),vH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),iv="[^/]",XO=iv+"*?",JO=iv+"+?",Wo=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#_;#i;#u=!1;#s;#l;#a=!1;constructor(e,t,r={}){this.type=e,e&&(this.#n=!0),this.#c=t,this.#e=this.#c?this.#c.#e:this,this.#s=this.#e===this?r:this.#e.#s,this.#i=this.#e===this?[]:this.#e.#i,e==="!"&&!this.#e.#u&&this.#i.push(this),this.#_=this.#c?this.#c.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#l=this.#t.map(e=>String(e)).join("")}#p(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#i.pop();){if(e.type!=="!")continue;let t=e,r=t.#c;for(;r;){for(let i=t.#_+1;!r.type&&i<r.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}t=r,r=t.#c}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Dn&&t.#c===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#c?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#c?.isStart())return!1;if(this.#_===0)return!0;let e=this.#c;for(let t=0;t<this.#_;t++){let r=e.#t[t];if(!(r instanceof Dn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#c?.type==="!")return!0;if(!this.#c?.isEnd())return!1;if(!this.type)return this.#c?.isEnd();let e=this.#c?this.#c.#t.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Dn(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let a=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let S=r,v="";for(;S<e.length;){let w=e.charAt(S++);if(c||w==="\\"){c=!c,v+=w;continue}if(l){S===u+1?(w==="^"||w==="!")&&(f=!0):w==="]"&&!(S===u+2&&f)&&(l=!1),v+=w;continue}else if(w==="["){l=!0,u=S,f=!1,v+=w;continue}if(!i.noext&&nv(w)&&e.charAt(S)==="("&&s<=a){t.push(v),v="";let C=new Dn(w,t);S=Dn.#g(e,C,S,i,s+1),t.push(C);continue}v+=w}return t.push(v),S}let d=r+1,h=new Dn(null,t),p=[],y="";for(;d<e.length;){let S=e.charAt(d++);if(c||S==="\\"){c=!c,y+=S;continue}if(l){d===u+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(d===u+2&&f)&&(l=!1),y+=S;continue}else if(S==="["){l=!0,u=d,f=!1,y+=S;continue}if(nv(S)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(S))){let w=t&&t.#y(S)?0:1;h.push(y),y="";let T=new Dn(S,h);h.push(T),d=Dn.#g(e,T,d,i,s+w);continue}if(S==="|"){h.push(y),y="",p.push(h),h=new Dn(null,t);continue}if(S===")")return y===""&&t.#t.length===0&&(t.#a=!0),h.push(y),y="",t.push(...p,h),d;y+=S}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,gH)}#m(e,t=mH){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,t)}#y(e,t=yH){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Dn(null,r,this.options);i.#t.push(""),r.push(i),this.#E(e,t)}#E(e,t){let r=e.#t[0];this.#t.splice(t,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#c=this);this.#l=void 0}#T(e){return!!YO.get(this.type)?.has(e)}#b(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#T(t.type)}#v(e){let t=YO.get(this.type),r=e.#t[0],i=t?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#c=this);this.type=i,this.#l=void 0,this.#a=!1}#S(){if(KO(this)){let e=0,t=!1;do{t=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#S(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#b(i)&&(t=!1,this.#v(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#S();this.#l=void 0}static fromGlob(e,t={}){let r=new Dn(null,void 0,t);return Dn.#g(e,r,0,t,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let c=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#e===this&&(this.#S(),this.#p()),!KO(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,S,v,w]=typeof p=="string"?Dn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||v,this.#r=this.#r||w,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&SH.has(this.#t[0]))){let y=bH,S=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),v=!t&&!e&&y.has(u.charAt(0));f=S?_H:v?zm:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,$i(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#w(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#n=void 0,[l,$i(this.toString()),!1,!1]}let a=!r||e||t||!zm?"":this.#w(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?zm:"")+JO;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?zm:"")+XO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,$i(s),this.#n=!!this.#n,this.#r]}#w(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,a]=t.toRegExpSource(e);return this.#r=this.#r||a,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#x(e,t,r=!1){let i=!1,s="",a=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(wH.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=QO(e,l);if(h){s+=f,a=a||d,l+=h-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?JO:XO,t=!0;continue}else c=!1;if(u==="?"){s+=iv,t=!0;continue}s+=vH(u)}return[s,$i(e),!!t,a]}};Dn=Wo;var Al=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Mr=o((n,e,t={})=>(vf(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Bn(e,t).match(n)),"minimatch"),EH=/^\*+([^+@!?\*\[\(]*)$/,TH=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),AH=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),xH=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),IH=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),CH=/^\*+\.\*+$/,RH=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),OH=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),PH=/^\.\*+$/,FH=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),DH=/^\*+$/,NH=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),LH=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),kH=/^\?+([^+@!?\*\[\(]*)?$/,jH=o(([n,e=""])=>{let t=rP([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),MH=o(([n,e=""])=>{let t=nP([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),$H=o(([n,e=""])=>{let t=nP([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),VH=o(([n,e=""])=>{let t=rP([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),rP=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),nP=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),iP=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ZO={win32:{sep:"\\"},posix:{sep:"/"}},BH=iP==="win32"?ZO.win32.sep:ZO.posix.sep;Mr.sep=BH;var Gt=Symbol("globstar **");Mr.GLOBSTAR=Gt;var UH="[^/]",qH=UH+"*?",WH="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",GH="(?:(?!(?:\\/|^)\\.).)*?",zH=o((n,e={})=>t=>Mr(t,n,e),"filter");Mr.filter=zH;var ni=o((n,e={})=>Object.assign({},n,e),"ext"),HH=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Mr;let e=Mr;return Object.assign(o((r,i,s={})=>e(r,i,ni(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,ni(n,s))}static defaults(i){return e.defaults(ni(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,ni(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,ni(n,s))}},unescape:o((r,i={})=>e.unescape(r,ni(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,ni(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,ni(n,i)),"filter"),defaults:o(r=>e.defaults(ni(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,ni(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,ni(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,ni(n,s)),"match"),sep:e.sep,GLOBSTAR:Gt})},"defaults");Mr.defaults=HH;var sP=o((n,e={})=>(vf(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,tP.default)(n)),"braceExpand");Mr.braceExpand=sP;var QH=o((n,e={})=>new Bn(n,e).makeRe(),"makeRe");Mr.makeRe=QH;var KH=o((n,e,t={})=>{let r=new Bn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Mr.match=KH;var eP=/[?*]|[+@!]\(.*?\)|\[|\]/,YH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Bn=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){vf(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||iP,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!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 r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,a,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!eP.test(s[2]))&&!eP.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 a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][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 r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),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 r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let a=i;for(;r[a+1]==="**";)a++;a>i&&r.splice(i+1,a-i);let c=r[i+1],l=r[i+2],u=r[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let c=r[a];a===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let a=r[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let i=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(i){e[t]=[],e[r]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let i=0,s=0,a=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])a.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])a.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])a.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",a.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",a.push(t[s]),i++,s++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!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,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,y]=[e[d],t[h]];p.toLowerCase()===y.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Gt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Gt,s),c=t.lastIndexOf(Gt),[l,u,f]=r?[t.slice(s,a),t.slice(a+1),[]]:[t.slice(s,a),t.slice(a+1,c),t.slice(c+1)];if(l.length){let T=e.slice(i,i+l.length);if(!this.#r(T,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let T=e.length-f.length;if(this.#r(e,f,r,T,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(T--,!this.#r(e,f,r,T,0)))return!1;d=f.length+1}}if(!u.length){let T=!!d;for(let C=i;C<e.length-d;C++){let L=String(e[C]);if(T=!0,L==="."||L===".."||!this.options.dot&&L.startsWith("."))return!1}return r||T}let h=[[[],0]],p=h[0],y=0,S=[0];for(let T of u)T===Gt?(S.push(y),p=[[],0],h.push(p)):(p[0].push(T),y++);let v=h.length-1,w=e.length-d;for(let T of h)T[1]=w-(S[v--]+T[0].length);return!!this.#n(e,h,i,0,r,0,!!d)}#n(e,t,r,i,s,a,c){let l=t[i];if(!l){for(let d=r;d<e.length;d++){c=!0;let h=e[d];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return c}let[u,f]=l;for(;r<=f;){if(this.#r(e.slice(0,r+u.length),u,s,r,0)&&a<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,a+1,c);if(p!==!1)return p}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let a,c,l,u;for(a=i,c=s,u=e.length,l=t.length;a<u&&c<l;a++,c++){this.debug("matchOne loop");let f=t[c],d=e[a];if(this.debug(t,f,d),f===!1||f===Gt)return!1;let h;if(typeof f=="string"?(h=d===f,this.debug("string match",f,d,h)):(h=f.test(d),this.debug("pattern match",f,d,h)),!h)return!1}if(a===u&&c===l)return!0;if(a===u)return r;if(c===l)return a===u-1&&e[a]==="";throw new Error("wtf?")}braceExpand(){return sP(this.pattern,this.options)}parse(e){vf(e);let t=this.options;if(e==="**")return Gt;if(e==="")return"";let r,i=null;(r=e.match(DH))?i=t.dot?LH:NH:(r=e.match(EH))?i=(t.nocase?t.dot?IH:xH:t.dot?AH:TH)(r[1]):(r=e.match(kH))?i=(t.nocase?t.dot?MH:jH:t.dot?$H:VH)(r):(r=e.match(CH))?i=t.dot?OH:RH:(r=e.match(PH))&&(i=FH);let s=Wo.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,r=t.noglobstar?qH:t.dot?WH:GH,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?YH(f):f===Gt?Gt:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==Gt||p===Gt||(p===void 0?h!==void 0&&h!==Gt?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==Gt&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=Gt))}),u.filter(f=>f!==Gt).join("/")}).join("|"),[a,c]=e.length>1?["(?:",")"]:["",""];s="^"+a+s+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 r=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 a=i[i.length-1];if(!a)for(let c=i.length-2;!a&&c>=0;c--)a=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Mr.defaults(e).Minimatch}};Mr.AST=Wo;Mr.Minimatch=Bn;Mr.escape=Al;Mr.unescape=$i;var RP=require("node:url");var xl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,oP=new Set,sv=typeof process=="object"&&process?process:{},cP=o((n,e,t,r)=>{typeof sv.emitWarning=="function"?sv.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Hm=globalThis.AbortController,aP=globalThis.AbortSignal;if(typeof Hm>"u"){aP=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Hm=class{static{o(this,"AbortController")}constructor(){e()}signal=new aP;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let n=sv.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,cP("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))},"warnACPolyfill")}var XH=o(n=>!oP.has(n),"shouldWarn");var za=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),lP=o(n=>za(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Il:null:null,"getUintArray"),Il=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},av=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=lP(e);if(!t)return[];n.#e=!0;let r=new n(e,t);return n.#e=!1,r}constructor(e,t){if(!n.#e)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]}},Tf=class n{static{o(this,"LRUCache")}#e;#n;#r;#t;#c;#_;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#a;#p;#g;#d;#m;#y;#f;#E;#T;#b;#v;#S;#w;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#b,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#a,next:e.#p,prev:e.#g,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:o(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:o((t,r,i,s)=>e.#M(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#V(t),"moveToTail"),indexes:o(t=>e.#C(t),"indexes"),rindexes:o(t=>e.#R(t),"rindexes"),isStale:o(t=>e.#A(t),"isStale")}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#i}get fetchMethod(){return this.#c}get memoMethod(){return this.#_}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:h,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:S,fetchMethod:v,memoMethod:w,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:$,ignoreFetchAbort:ee}=e;if(t!==0&&!za(t))throw new TypeError("max option must be a nonnegative integer");let B=t?lP(t):Array;if(!B)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=S,this.sizeCalculation){if(!this.#n&&!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.#_=w,v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=v,this.#S=!!v,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new B(t),this.#g=new B(t),this.#d=0,this.#m=0,this.#y=av.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#v=!!this.#r,this.#w=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!ee,this.maxEntrySize!==0){if(this.#n!==0&&!za(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!za(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=za(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!za(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let W="LRU_CACHE_UNBOUNDED";XH(W)&&(oP.add(W),cP("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",W,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#x(){let e=new Il(this.#e),t=new Il(this.#e);this.#b=e,this.#T=t,this.#F=(s,a,c=xl.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#P(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#I=s=>{t[s]=e[s]!==0?xl.now():0},this.#o=(s,a)=>{if(e[a]){let c=e[a],l=t[a];if(!c||!l)return;s.ttl=c,s.start=l,s.now=r||i();let u=s.now-l;s.remainingTTL=c-u}};let r=0,i=o(()=>{let s=xl.now();if(this.ttlResolution>0){r=s;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return s},"getNow");this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let c=e[a],l=t[a];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#A=s=>{let a=t[s],c=e[s];return!!c&&!!a&&(r||i())-a>c}}#I=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#A=o(()=>!1,"#isStale");#O(){let e=new Il(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#L=(t,r,i,s)=>{if(this.#h(r))return 0;if(!za(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!za(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.#N=(t,r,i)=>{if(e[t]=r,this.#n){let s=this.#n-e[t];for(;this.#u>s;)this.#j(!0)}this.#u+=e[t],i&&(i.entrySize=r,i.totalCalculatedSize=this.#u)}}#D=o(e=>{},"#removeItemSize");#N=o((e,t,r)=>{},"#addItemSize");#L=o((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#C({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#R({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#m));)t=this.#p[t]}#k(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#C())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*rentries(){for(let e of this.#R())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*keys(){for(let e of this.#C()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*values(){for(let e of this.#C())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#R())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#C()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[r],this))return this.get(this.#l[r],t)}}forEach(e,t=this){for(let r of this.#C()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#R()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#R({allowStale:!0}))this.#A(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#a[t],i=this.#h(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#b&&this.#T){let a=this.#b[t],c=this.#T[t];if(a&&c){let l=a-(xl.now()-c);s.ttl=l,s.start=Date.now()}}return this.#E&&(s.size=this.#E[t]),s}dump(){let e=[];for(let t of this.#C({allowStale:!0})){let r=this.#l[t],i=this.#a[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(this.#b&&this.#T){a.ttl=this.#b[t];let c=xl.now()-this.#T[t];a.start=Math.floor(Date.now()-c)}this.#E&&(a.size=this.#E[t]),e.unshift([r,a])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=xl.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#L(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let d=this.#i===0?void 0:this.#s.get(e);if(d===void 0)d=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#j(!1):this.#i,this.#l[d]=e,this.#a[d]=t,this.#s.set(e,d),this.#p[this.#m]=d,this.#g[d]=this.#m,this.#m=d,this.#i++,this.#N(d,f,l),l&&(l.set="add"),u=!1;else{this.#V(d);let h=this.#a[d];if(t!==h){if(this.#S&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!a&&(this.#v&&this.#r?.(p,e,"set"),this.#w&&this.#f?.push([p,e,"set"]))}else a||(this.#v&&this.#r?.(h,e,"set"),this.#w&&this.#f?.push([h,e,"set"]));if(this.#D(d),this.#N(d,f,l),this.#a[d]=t,l){l.set="replace";let p=h&&this.#h(h)?h.__staleWhileFetching:h;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#b&&this.#x(),this.#b&&(u||this.#F(d,i,s),l&&this.#o(l,d)),!a&&this.#w&&this.#f){let h=this.#f,p;for(;p=h?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#a[this.#d];if(this.#j(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#j(e){let t=this.#d,r=this.#l[t],i=this.#a[t];return this.#S&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(i,r,"evict"),this.#w&&this.#f?.push([i,r,"evict"])),this.#D(t),e&&(this.#l[t]=void 0,this.#a[t]=void 0,this.#y.push(t)),this.#i===1?(this.#d=this.#m=0,this.#y.length=0):this.#d=this.#p[t],this.#s.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=this.#s.get(e);if(s!==void 0){let a=this.#a[s];if(this.#h(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#o(i,s));else return r&&this.#I(s),i&&(i.has="hit",this.#o(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=this.#s.get(e);if(i===void 0||!r&&this.#A(i))return;let s=this.#a[i];return this.#h(s)?s.__staleWhileFetching:s}#M(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#h(s))return s;let a=new Hm,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((S,v=!1)=>{let{aborted:w}=a.signal,T=r.ignoreFetchAbort&&S!==void 0;if(r.status&&(w&&!v?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,T&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),w&&!T&&!v)return d(a.signal.reason);let C=p;return this.#a[t]===p&&(S===void 0?C.__staleWhileFetching?this.#a[t]=C.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,S,l.options))),S},"cb"),f=o(S=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=S),d(S)),"eb"),d=o(S=>{let{aborted:v}=a.signal,w=v&&r.allowStaleOnFetchAbort,T=w||r.allowStaleOnFetchRejection,C=T||r.noDeleteOnFetchRejection,L=p;if(this.#a[t]===p&&(!C||L.__staleWhileFetching===void 0?this.#P(e,"fetch"):w||(this.#a[t]=L.__staleWhileFetching)),T)return r.status&&L.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),L.__staleWhileFetching;if(L.__returned===L)throw S},"fetchFail"),h=o((S,v)=>{let w=this.#c?.(e,s,l);w&&w instanceof Promise&&w.then(T=>S(T===void 0?void 0:T),v),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(S(void 0),r.allowStaleOnFetchAbort&&(S=o(T=>u(T,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),y=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,y,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=y,y}#h(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Hm}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:S,forceRefresh:v=!1,status:w,signal:T}=t;if(!this.#S)return w&&(w.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:w});let C={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:w,signal:T},L=this.#s.get(e);if(L===void 0){w&&(w.fetch="miss");let $=this.#M(e,L,C,S);return $.__returned=$}else{let $=this.#a[L];if(this.#h($)){let D=r&&$.__staleWhileFetching!==void 0;return w&&(w.fetch="inflight",D&&(w.returnedStale=!0)),D?$.__staleWhileFetching:$.__returned=$}let ee=this.#A(L);if(!v&&!ee)return w&&(w.fetch="hit"),this.#V(L),i&&this.#I(L),w&&this.#o(w,L),$;let B=this.#M(e,L,C,S),F=B.__staleWhileFetching!==void 0&&r;return w&&(w.fetch=ee?"stale":"refresh",F&&ee&&(w.returnedStale=!0)),F?B.__staleWhileFetching:B.__returned=B}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#_;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,c=this.get(e,a);if(!s&&c!==void 0)return c;let l=r(e,c,{options:a,context:i});return this.set(e,l,a),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#a[c],u=this.#h(l);return a&&this.#o(a,c),this.#A(c)?(a&&(a.get="stale"),u?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#P(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#I(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#V(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#B(t);else{this.#D(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(s,e,t),this.#w&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#a[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#d)this.#d=this.#p[i];else{let a=this.#g[i];this.#p[a]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#w&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#R({allowStale:!0})){let r=this.#a[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#v&&this.#r?.(r,i,e),this.#w&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#b&&this.#T&&(this.#b.fill(0),this.#T.fill(0)),this.#E&&this.#E.fill(0),this.#d=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#w&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var Ol=require("node:path"),bP=require("node:url"),vs=require("fs"),oQ=le(require("node:fs"),1),Ka=require("node:fs/promises");var eg=require("node:events"),hv=le(require("node:stream"),1),pP=require("node:string_decoder");var uP=typeof process=="object"&&process?process:{stdout:null,stderr:null},JH=o(n=>!!n&&typeof n=="object"&&(n instanceof Qa||n instanceof hv.default||ZH(n)||eQ(n)),"isStream"),ZH=o(n=>!!n&&typeof n=="object"&&n instanceof eg.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==hv.default.Writable.prototype.pipe,"isReadable"),eQ=o(n=>!!n&&typeof n=="object"&&n instanceof eg.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),ua=Symbol("EOF"),fa=Symbol("maybeEmitEnd"),Ha=Symbol("emittedEnd"),Qm=Symbol("emittingEnd"),Af=Symbol("emittedError"),Km=Symbol("closed"),fP=Symbol("read"),Ym=Symbol("flush"),dP=Symbol("flushChunk"),Vi=Symbol("encoding"),Cl=Symbol("decoder"),Er=Symbol("flowing"),xf=Symbol("paused"),Rl=Symbol("resume"),Tr=Symbol("buffer"),bn=Symbol("pipes"),Ar=Symbol("bufferLength"),ov=Symbol("bufferPush"),Xm=Symbol("bufferShift"),Yr=Symbol("objectMode"),zt=Symbol("destroyed"),cv=Symbol("error"),lv=Symbol("emitData"),hP=Symbol("emitEnd"),uv=Symbol("emitEnd2"),Ss=Symbol("async"),fv=Symbol("abort"),Jm=Symbol("aborted"),If=Symbol("signal"),Go=Symbol("dataListeners"),Un=Symbol("discarded"),Cf=o(n=>Promise.resolve().then(n),"defer"),tQ=o(n=>n(),"nodefer"),rQ=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),nQ=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),iQ=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Zm=class{static{o(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Rl](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},dv=class extends Zm{static{o(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},sQ=o(n=>!!n.objectMode,"isObjectModeOptions"),aQ=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Qa=class extends eg.EventEmitter{static{o(this,"Minipass")}[Er]=!1;[xf]=!1;[bn]=[];[Tr]=[];[Yr];[Vi];[Ss];[Cl];[ua]=!1;[Ha]=!1;[Qm]=!1;[Km]=!1;[Af]=null;[Ar]=0;[zt]=!1;[If];[Jm]=!1;[Go]=0;[Un]=!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");sQ(t)?(this[Yr]=!0,this[Vi]=null):aQ(t)?(this[Vi]=t.encoding,this[Yr]=!1):(this[Yr]=!1,this[Vi]=null),this[Ss]=!!t.async,this[Cl]=this[Vi]?new pP.StringDecoder(this[Vi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[Tr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[bn],"get")});let{signal:r}=t;r&&(this[If]=r,r.aborted?this[fv]():r.addEventListener("abort",()=>this[fv]()))}get bufferLength(){return this[Ar]}get encoding(){return this[Vi]}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[Yr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ss]}set async(e){this[Ss]=this[Ss]||!!e}[fv](){this[Jm]=!0,this.emit("abort",this[If]?.reason),this.destroy(this[If]?.reason)}get aborted(){return this[Jm]}set aborted(e){}write(e,t,r){if(this[Jm])return!1;if(this[ua])throw new Error("write after end");if(this[zt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||(t="utf8");let i=this[Ss]?Cf:tQ;if(!this[Yr]&&!Buffer.isBuffer(e)){if(iQ(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(nQ(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Yr]?(this[Er]&&this[Ar]!==0&&this[Ym](!0),this[Er]?this.emit("data",e):this[ov](e),this[Ar]!==0&&this.emit("readable"),r&&i(r),this[Er]):e.length?(typeof e=="string"&&!(t===this[Vi]&&!this[Cl]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Vi]&&(e=this[Cl].write(e)),this[Er]&&this[Ar]!==0&&this[Ym](!0),this[Er]?this.emit("data",e):this[ov](e),this[Ar]!==0&&this.emit("readable"),r&&i(r),this[Er]):(this[Ar]!==0&&this.emit("readable"),r&&i(r),this[Er])}read(e){if(this[zt])return null;if(this[Un]=!1,this[Ar]===0||e===0||e&&e>this[Ar])return this[fa](),null;this[Yr]&&(e=null),this[Tr].length>1&&!this[Yr]&&(this[Tr]=[this[Vi]?this[Tr].join(""):Buffer.concat(this[Tr],this[Ar])]);let t=this[fP](e||null,this[Tr][0]);return this[fa](),t}[fP](e,t){if(this[Yr])this[Xm]();else{let r=t;e===r.length||e===null?this[Xm]():typeof r=="string"?(this[Tr][0]=r.slice(e),t=r.slice(0,e),this[Ar]-=e):(this[Tr][0]=r.subarray(e),t=r.subarray(0,e),this[Ar]-=e)}return this.emit("data",t),!this[Tr].length&&!this[ua]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[ua]=!0,this.writable=!1,(this[Er]||!this[xf])&&this[fa](),this}[Rl](){this[zt]||(!this[Go]&&!this[bn].length&&(this[Un]=!0),this[xf]=!1,this[Er]=!0,this.emit("resume"),this[Tr].length?this[Ym]():this[ua]?this[fa]():this.emit("drain"))}resume(){return this[Rl]()}pause(){this[Er]=!1,this[xf]=!0,this[Un]=!1}get destroyed(){return this[zt]}get flowing(){return this[Er]}get paused(){return this[xf]}[ov](e){this[Yr]?this[Ar]+=1:this[Ar]+=e.length,this[Tr].push(e)}[Xm](){return this[Yr]?this[Ar]-=1:this[Ar]-=this[Tr][0].length,this[Tr].shift()}[Ym](e=!1){do;while(this[dP](this[Xm]())&&this[Tr].length);!e&&!this[Tr].length&&!this[ua]&&this.emit("drain")}[dP](e){return this.emit("data",e),this[Er]}pipe(e,t){if(this[zt])return e;this[Un]=!1;let r=this[Ha];return t=t||{},e===uP.stdout||e===uP.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[bn].push(t.proxyErrors?new dv(this,e,t):new Zm(this,e,t)),this[Ss]?Cf(()=>this[Rl]()):this[Rl]()),e}unpipe(e){let t=this[bn].find(r=>r.dest===e);t&&(this[bn].length===1?(this[Er]&&this[Go]===0&&(this[Er]=!1),this[bn]=[]):this[bn].splice(this[bn].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[Un]=!1,this[Go]++,!this[bn].length&&!this[Er]&&this[Rl]();else if(e==="readable"&&this[Ar]!==0)super.emit("readable");else if(rQ(e)&&this[Ha])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Af]){let i=t;this[Ss]?Cf(()=>i.call(this,this[Af])):i.call(this,this[Af])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Go]=this.listeners("data").length,this[Go]===0&&!this[Un]&&!this[bn].length&&(this[Er]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Go]=0,!this[Un]&&!this[bn].length&&(this[Er]=!1)),t}get emittedEnd(){return this[Ha]}[fa](){!this[Qm]&&!this[Ha]&&!this[zt]&&this[Tr].length===0&&this[ua]&&(this[Qm]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Km]&&this.emit("close"),this[Qm]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==zt&&this[zt])return!1;if(e==="data")return!this[Yr]&&!r?!1:this[Ss]?(Cf(()=>this[lv](r)),!0):this[lv](r);if(e==="end")return this[hP]();if(e==="close"){if(this[Km]=!0,!this[Ha]&&!this[zt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Af]=r,super.emit(cv,r);let s=!this[If]||this.listeners("error").length?super.emit("error",r):!1;return this[fa](),s}else if(e==="resume"){let s=super.emit("resume");return this[fa](),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[fa](),i}[lv](e){for(let r of this[bn])r.dest.write(e)===!1&&this.pause();let t=this[Un]?!1:super.emit("data",e);return this[fa](),t}[hP](){return this[Ha]?!1:(this[Ha]=!0,this.readable=!1,this[Ss]?(Cf(()=>this[uv]()),!0):this[uv]())}[uv](){if(this[Cl]){let t=this[Cl].end();if(t){for(let r of this[bn])r.dest.write(t);this[Un]||super.emit("data",t)}}for(let t of this[bn])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Yr]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Yr]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Yr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Vi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(zt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Un]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ua])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(zt,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(zt,f),this.pause(),s({value:d,done:!!this[ua]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(zt,f),t(),s({done:!0,value:void 0})},"onend"),f=o(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,h)=>{a=h,s=d,this.once(zt,f),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Un]=!1;let e=!1,t=o(()=>(this.pause(),this.off(cv,t),this.off(zt,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(cv,t),this.once(zt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[zt])return e?this.emit("error",e):this.emit(zt),this;this[zt]=!0,this[Un]=!0,this[Tr].length=0,this[Ar]=0;let t=this;return typeof t.close=="function"&&!this[Km]&&t.close(),e?this.emit("error",e):this.emit(zt),this}static get isStream(){return JH}};var cQ=vs.realpathSync.native,Of={lstatSync:vs.lstatSync,readdir:vs.readdir,readdirSync:vs.readdirSync,readlinkSync:vs.readlinkSync,realpathSync:cQ,promises:{lstat:Ka.lstat,readdir:Ka.readdir,readlink:Ka.readlink,realpath:Ka.realpath}},SP=o(n=>!n||n===Of||n===oQ?Of:{...Of,...n,promises:{...Of.promises,...n.promises||{}}},"fsFromOption"),wP=/^\\\\\?\\([a-z]:)\\?$/i,lQ=o(n=>n.replace(/\//g,"\\").replace(wP,"$1\\"),"uncToDrive"),uQ=/[\\\/]/,si=0,vP=1,EP=2,ws=4,TP=6,AP=8,zo=10,xP=12,ii=15,Rf=~ii,pv=16,mP=32,Pf=64,Bi=128,tg=256,ng=512,gP=Pf|Bi|ng,fQ=1023,mv=o(n=>n.isFile()?AP:n.isDirectory()?ws:n.isSymbolicLink()?zo:n.isCharacterDevice()?EP:n.isBlockDevice()?TP:n.isSocket()?xP:n.isFIFO()?vP:si,"entToType"),yP=new Map,Ff=o(n=>{let e=yP.get(n);if(e)return e;let t=n.normalize("NFKD");return yP.set(n,t),t},"normalize"),_P=new Map,rg=o(n=>{let e=_P.get(n);if(e)return e;let t=Ff(n.toLowerCase());return _P.set(n,t),t},"normalizeNocase"),ig=class extends Tf{static{o(this,"ResolveCache")}constructor(){super({max:256})}},gv=class extends Tf{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},IP=Symbol("PathScurry setAsCwd"),Xr=class{static{o(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#r;get mode(){return this.#r}#t;get nlink(){return this.#t}#c;get uid(){return this.#c}#_;get gid(){return this.#_}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#a;get blocks(){return this.#a}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#d;get ctimeMs(){return this.#d}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#b;#v;#S;#w;#x;#I;#o;#F;#A;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=si,r,i,s,a,c){this.name=e,this.#b=s?rg(e):Ff(e),this.#o=t&fQ,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#S=c.fullpath,this.#x=c.relative,this.#I=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=SP(c.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#o&=~pv,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?rg(e):Ff(e);for(let l of r)if(l.#b===i)return l;let s=this.parent?this.sep:"",a=this.#S?this.#S+s+e:void 0,c=this.newChild(e,si,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=Bi),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.name;let r=t.relative();return r+(!r||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let e=this.name,t=this.parent;if(!t)return this.#I=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#S=i}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#o&ii)===si}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.#o&ii)===AP}isDirectory(){return(this.#o&ii)===ws}isCharacterDevice(){return(this.#o&ii)===EP}isBlockDevice(){return(this.#o&ii)===TP}isFIFO(){return(this.#o&ii)===vP}isSocket(){return(this.#o&ii)===xP}isSymbolicLink(){return(this.#o&zo)===zo}lstatCached(){return this.#o&mP?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#A)return!0;if(!this.parent)return!1;let e=this.#oⅈreturn!(e!==si&&e!==zo||this.#o&tg||this.#o&Bi)}calledReaddir(){return!!(this.#o&pv)}isENOENT(){return!!(this.#o&Bi)}isNamed(e){return this.nocase?this.#b===rg(e):this.#b===Ff(e)}async readlink(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}#N(e){this.#o|=pv;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&Bi||(this.#o=(this.#o|Bi)&Rf,this.#C())}#C(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#R(){this.#o|=ng,this.#k()}#k(){if(this.#o&Pf)return;let e=this.#o;(e&ii)===ws&&(e&=Rf),this.#o=e|Pf,this.#C()}#j(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#L():this.children().provisional=0}#M(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#L()}#h(e=""){let t=this.#o;t|=tg,e==="ENOENT"&&(t|=Bi),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Rf),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#P(e,t)||this.#V(e,t)}#V(e,t){let r=mv(e),i=this.newChild(e.name,r,{parent:this}),s=i.#oⅈreturn s!==ws&&s!==zo&&s!==si&&(i.#o|=Pf),t.unshift(i),t.provisional++,i}#P(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?rg(e.name):Ff(e.name))===i.#b)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#o=t.#o&Rf|mv(e),s!==e.name&&(t.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&Bi)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#M(e.code)}}lstatSync(){if((this.#o&Bi)===0)try{return this.#G(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#M(e.code)}}#G(e){let{atime:t,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:a,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:h,mode:p,mtime:y,mtimeMs:S,nlink:v,rdev:w,size:T,uid:C}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#d=u,this.#n=f,this.#_=d,this.#s=h,this.#r=p,this.#f=y,this.#g=S,this.#t=v,this.#i=w,this.#l=T,this.#c=C;let L=mv(e);this.#o=this.#o&Rf|L|mP,L!==si&&L!==ws&&L!==zo&&(this.#o|=Pf)}#q=[];#W=!1;#z(e){this.#W=!1;let t=this.#q.slice();this.#q.length=0,t.forEach(r=>r(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#q.push(e),this.#W)return;this.#W=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,a)=>{if(s)this.#j(s.code),r.provisional=0;else{for(let c of a)this.#$(c,r);this.#N(r)}this.#z(r.slice(0,r.provisional))})}#U;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.#U)await this.#U;else{let r=o(()=>{},"resolve");this.#U=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#N(e)}catch(i){this.#j(i.code),e.provisional=0}this.#U=void 0,r()}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 r of this.#e.readdirSync(t,{withFileTypes:!0}))this.#$(r,e);this.#N(e)}catch(r){this.#j(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&gP)return!1;let e=ii&this.#o;return e===si||e===ws||e===zo}shouldWalk(e,t){return(this.#o&ws)===ws&&!(this.#o&gP)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((ng|tg|Bi)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}realpathSync(){if(this.#O)return this.#O;if(!((ng|tg|Bi)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}[IP](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),r=[],i=this;for(;i&&i.parent;)t.add(i),i.#x=r.join(this.sep),i.#I=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#x=void 0,i.#I=void 0,i=i.parent}},sg=class n extends Xr{static{o(this,"PathWin32")}sep="\\";splitSep=uQ;constructor(e,t=si,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=si,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return Ol.win32.parse(e).root}getRoot(e){if(e=lQ(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,r]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=r;return this.roots[e]=new Pl(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(wP,"$1\\"),e===t}},ag=class n extends Xr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=si,r,i,s,a,c){super(e,t,r,i,s,a,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=si,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},og=class{static{o(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:a=Of}={}){this.#t=SP(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,bP.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new ig,this.#n=new ig,this.#r=new gv(s);let l=c.substring(this.rootPath.length).split(r);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.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,h=this.rootPath,p=!1;for(let y of l){let S=f--;u=u.child(y,{relative:new Array(S).fill("..").join(d),relativePosix:new Array(S).fill("..").join("/"),fullpath:h+=(p?"":d)+y}),p=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#e.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#n.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.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 Xr||(t=e,e=this.cwd);let{withFileTypes:r}=t;if(e.canReaddir()){let i=await e.readdir();return r?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 Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0}=t;return e.canReaddir()?r?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 Xr||(t=e.withFileTypes,e=this.cwd);let r=await e.readlink();return t?r:r?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e.withFileTypes,e=this.cwd);let r=e.readlinkSync();return t?r:r?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e.withFileTypes,e=this.cwd);let r=await e.realpath();return t?r:r?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e.withFileTypes,e=this.cwd);let r=e.realpathSync();return t?r:r?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=o((d,h)=>{l.add(d),d.readdirCB((p,y)=>{if(p)return h(p);let S=y.length;if(!S)return h();let v=o(()=>{--S===0&&h()},"next");for(let w of y)(!s||s(w))&&c.push(r?w:w.fullpath()),i&&w.isSymbolicLink()?w.realpath().then(T=>T?.isUnknown()?T.lstat():T).then(T=>T?.shouldWalk(l,a)?u(T,v):v()):w.shouldWalk(l,a)?u(w,v):v()},!0)},"walk"),f=e;return new Promise((d,h)=>{u(f,p=>{if(p)return h(p);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?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(r?d:d.fullpath());let h=d;if(d.isSymbolicLink()){if(!(i&&(h=d.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(l,a)&&l.add(h)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(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 Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t;(!s||s(e))&&(yield r?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 r?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,a)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Qa({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=o((v,w,T=!1)=>{if(v)return c.emit("error",v);if(i&&!T){let C=[];for(let L of w)L.isSymbolicLink()&&C.push(L.realpath().then($=>$?.isUnknown()?$.lstat():$));if(C.length){Promise.all(C).then(()=>y(null,w,!0));return}}for(let C of w)C&&(!s||s(C))&&(c.write(r?C:C.fullpath())||(h=!0));f--;for(let C of w){let L=C.realpathCached()||C;L.shouldWalk(l,a)&&u.push(L)}h&&!c.flowing?c.once("drain",d):S||d()},"onReaddir"),S=!0;p.readdirCB(y,!0),S=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Qa({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let S of y)(!s||s(S))&&(c.write(r?S:S.fullpath())||(h=!0));f--;for(let S of y){let v=S;if(S.isSymbolicLink()){if(!(i&&(v=S.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(l,a)&&u.push(v)}}h&&!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[IP](t)}},Pl=class extends og{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,Ol.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Ol.win32.parse(e).root.toUpperCase()}newRoot(e){return new sg(this.rootPath,ws,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Fl=class extends og{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,Ol.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new ag(this.rootPath,ws,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Df=class extends Fl{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},Tue=process.platform==="win32"?sg:ag,CP=process.platform==="win32"?Pl:process.platform==="darwin"?Df:Fl;var dQ=o(n=>n.length>=1,"isPatternList"),hQ=o(n=>n.length>=1,"isGlobList"),Dl=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!dQ(e))throw new TypeError("empty pattern list");if(!hQ(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,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,a,c,l,...u]=this.#e,[f,d,h,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let S=[s,a,c,l,""].join("/"),v=[f,d,h,p,""].join("/");this.#e=[S,...u],this.#n=[v,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[c,...l]=this.#n;a[0]===""&&(a.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...a],this.#n=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===Gt}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#_=this.#_||(this.#r===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#c!==void 0?this.#c:this.hasMore()?(this.#c=new n(this.#e,this.#n,this.#r+1,this.#t),this.#c.#s=this.#s,this.#c.#u=this.#u,this.#c.#i=this.#i,this.#c):this.#c=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#r===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#i!==void 0?this.#i:this.#i=this.#t==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#s!==void 0?this.#s:this.#s=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var pQ=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Nl=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=pQ}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new Bn(e,this.mmopts);for(let r=0;r<t.set.length;r++){let i=t.set[r],s=t.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let a=new Dl(i,s,0,this.platform),c=new Bn(a.globString(),this.mmopts),l=s[s.length-1]==="**",u=a.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(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let a of this.relative)if(a.match(i)||a.match(s))return!0;for(let a of this.absolute)if(a.match(t)||a.match(r))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var yv=class n{static{o(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let r=e.fullpath(),i=this.store.get(r);i?i.add(t.globString()):this.store.set(r,new Set([t.globString()]))}},_v=class{static{o(this,"MatchRecord")}store=new Map;add(e,t,r){let i=(t?2:0)|(r?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)])}},bv=class{static{o(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let r=this.store.get(e);r?r.find(i=>i.globString()===t.globString())||r.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())}},Nf=class n{static{o(this,"Processor")}hasWalkedCache;matches=new _v;subwalks=new bv;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new yv}processPatterns(e,t){this.patterns=t;let r=t.map(i=>[e,i]);for(let[i,s]of r){this.hasWalkedCache.storeWalked(i,s);let a=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(a){i=i.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);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===Gt){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),h=u?.rest();if(!u||(d===""||d===".")&&!h)this.matches.add(i,c,d===""||d===".");else if(d===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):this.matches.add(p,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let r=this.subwalks.get(e),i=this.child();for(let s of t)for(let a of r){let c=a.isAbsolute(),l=a.pattern(),u=a.rest();l===Gt?i.testGlobstar(s,a,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,r,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()&&(r&&t.checkFollowGlobstar()?this.subwalks.add(e,r):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),r){let s=r.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,r.rest(),i);else if(s===".."){let a=e.parent||e;this.subwalks.add(a,r)}else s instanceof RegExp&&this.testRegExp(e,s,r.rest(),i)}}testRegExp(e,t,r,i){t.test(e.name)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}testString(e,t,r,i){e.isNamed(t)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}};var mQ=o((n,e)=>typeof n=="string"?new Nl([n],e):Array.isArray(n)?new Nl(n,e):n,"makeIgnore"),cg=class{static{o(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#r;signal;maxDepth;includeChildMatches;constructor(e,t,r){if(this.patterns=e,this.path=t,this.opts=r,this.#r=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#n=mQ(r.ignore??[],r),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#c(e){return!!this.#n?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=await s.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.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.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=s.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let s=`${e.relativePosix()}/**`;this.#n.add(s)}let r=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(r){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?a+s+i:"."+i)}}async match(e,t,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,t)}matchSync(e,t,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,t)}walkCB(e,t,r){this.signal?.aborted&&r(),this.walkCB2(e,t,new Nf(this.opts),r)}walkCB2(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,r,a):c.readdirCB((u,f)=>this.walkCB3(c,f,r,a),!0)}a()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),a);a()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new Nf(this.opts),r)}walkCB2Sync(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,r,a)}a()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let[c,l]of r.subwalks.entries())s++,this.walkCB2Sync(c,l,r.child(),a);a()}},Lf=class extends cg{static{o(this,"GlobWalker")}matches=new Set;constructor(e,t,r){super(e,t,r)}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}},kf=class extends cg{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Qa({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 gQ=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ui=class{static{o(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,RP.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||gQ,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"?Pl:t.platform==="darwin"?Df:t.platform?Fl:CP;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,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 Bn(l,i)),[a,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Dl(l,f,0,this.platform)})}async walk(){return[...await new Lf(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 Lf(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 kf(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 kf(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 Sv=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Bn(t,e).hasMagic())return!0;return!1},"hasMagic");function lg(n,e={}){return new Ui(n,e).streamSync()}o(lg,"globStreamSync");function PP(n,e={}){return new Ui(n,e).stream()}o(PP,"globStream");function FP(n,e={}){return new Ui(n,e).walkSync()}o(FP,"globSync");async function OP(n,e={}){return new Ui(n,e).walk()}o(OP,"glob_");function ug(n,e={}){return new Ui(n,e).iterateSync()}o(ug,"globIterateSync");function DP(n,e={}){return new Ui(n,e).iterate()}o(DP,"globIterate");var yQ=lg,_Q=Object.assign(PP,{sync:lg}),bQ=ug,SQ=Object.assign(DP,{sync:ug}),wQ=Object.assign(FP,{stream:lg,iterate:ug}),Ll=Object.assign(OP,{glob:OP,globSync:FP,sync:wQ,globStream:PP,stream:_Q,globStreamSync:lg,streamSync:yQ,globIterate:DP,iterate:SQ,globIterateSync:ug,iterateSync:bQ,Glob:Ui,hasMagic:Sv,escape:Al,unescape:$i});Ll.glob=Ll;async function LP(n,e,t,r={}){let{dryRun:i=!1,excludeRelPath:s}=r,a=Ho.default.join(n,"**/*.md"),c=await Ll(a,{nodir:!0,ignore:[Ho.default.join(n,".obsidian/**"),Ho.default.join(n,".trash/**"),Ho.default.join(n,"**/.obsidian/**"),Ho.default.join(n,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=Ho.default.relative(n,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await wv.default.readFile(u,"utf-8")}catch{continue}let{updated:h,replacements:p}=vQ(d,e,t);p>0&&(l.filesModified+=1,l.replacements+=p,l.modifiedFiles.push(f),i||await wv.default.writeFile(u,h,"utf-8"))}return l}o(LP,"rewriteInboundWikilinks");function vQ(n,e,t){let r=n.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let a=r[s],c=EQ(a,e,t);i+=c.replacements,r[s]=c.updated}return{updated:r.join(""),replacements:i}}o(vQ,"rewriteContent");function EQ(n,e,t){let r=n.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let a=TQ(r[s],e,t);i+=a.replacements,r[s]=a.updated}return{updated:r.join(""),replacements:i}}o(EQ,"rewriteProseSegment");function TQ(n,e,t){let r=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:n.replace(r,(a,c,l)=>c.trim()!==e?a:(i+=1,`[[${t}${l}]]`)),replacements:i}}o(TQ,"replaceWikilinks");var AQ=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,kt=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{o(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return nr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await nr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await nr.default.ensureDir(Ht.default.dirname(r)),await nr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await nr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await nr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await nr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return nr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=nr.default.statSync(t);if(r.isFile())return this.createFileObject(e);if(r.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let r=Ht.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=nr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let r=await this.read(e),i=this.extractFrontmatter(r)||{},s=t(i),a=this.replaceFrontmatter(r,s);await this.modify(e,a)}async rename(e,t){let r=this.resolvePath(e.path),i=this.resolvePath(t);if(!await nr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await nr.default.ensureDir(Ht.default.dirname(i)),await nr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await nr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(AQ.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=Ht.default.dirname(this.resolvePath(t)),s;if(Ht.default.isAbsolute(r)?s=this.resolvePath(r):s=Ht.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),nr.default.existsSync(s)){let u=Ht.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let a=r.toLowerCase(),c=this.basenameIndex.get(a);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(a);return l?this.createFileObject(l):null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=Ht.default.relative(this.rootPath,e),r=Ht.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=nr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let a=s.aliases,c=Array.isArray(a)?a:typeof a=="string"?[a]:[];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 r=Ht.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(r){let i=r[1].toLowerCase(),s=Ht.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let r=await this.read(e),i=t(r);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,r){let i=Ht.default.basename(t,".md");await LP(this.rootPath,r,i,{excludeRelPath:e})}resolvePath(e){return Ht.default.isAbsolute(e)?e:Ht.default.join(this.rootPath,e)}createFileObject(e){let t=Ht.default.basename(e),r=Ht.default.basename(e,Ht.default.extname(e)),i=Ht.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:Ht.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=rr.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=rr.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
|
|
489
|
+
`:""}o(Uz,"dump$1");var qz=Uz,Wz={dump:qz};function ev(n,e){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}o(ev,"renamed");var Gz=jr,zz=QR,Hz=JR,Qz=nO,Kz=iO,Yz=Yw,Xz=vO.load,Jz=vO.loadAll,Zz=Wz.dump,eH=_n,tH={binary:lO,float:rO,map:XR,null:ZR,pairs:fO,set:dO,timestamp:oO,bool:eO,int:tO,merge:cO,omap:uO,seq:YR,str:KR},rH=ev("safeLoad","load"),nH=ev("safeLoadAll","loadAll"),iH=ev("safeDump","dump"),rr={Type:Gz,Schema:zz,FAILSAFE_SCHEMA:Hz,JSON_SCHEMA:Qz,CORE_SCHEMA:Kz,DEFAULT_SCHEMA:Yz,load:Xz,loadAll:Jz,dump:Zz,YAMLException:eH,types:tH,safeLoad:rH,safeLoadAll:nH,safeDump:iH};var wv=le(Sl()),Ho=le(require("path"));var tP=le(zO(),1);var vf=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var dH={"[: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]},Ef=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),hH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),HO=o(n=>n.join(""),"rangesToString"),QO=o((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,a=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<n.length;){let S=n.charAt(s);if((S==="!"||S==="^")&&s===t+1){u=!0,s++;continue}if(S==="]"&&a&&!l){f=s+1;break}if(a=!0,S==="\\"&&!l){l=!0,s++;continue}if(S==="["&&!l){for(let[v,[w,T,C]]of Object.entries(dH))if(n.startsWith(v,s)){if(d)return["$.",!1,n.length-t,!0];s+=v.length,C?i.push(w):r.push(w),c=c||T;continue e}}if(l=!1,d){S>d?r.push(Ef(d)+"-"+Ef(S)):S===d&&r.push(Ef(S)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Ef(S+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=S,s+=2;continue}r.push(Ef(S)),s++}if(f<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let S=r[0].length===2?r[0].slice(-1):r[0];return[hH(S),!1,f-t,!1]}let h="["+(u?"^":"")+HO(r)+"]",p="["+(u?"":"^")+HO(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var $i=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Dn,pH=new Set(["!","?","+","*","@"]),nv=o(n=>pH.has(n),"isExtglobType"),KO=o(n=>nv(n.type),"isExtglobAST"),mH=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),gH=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),yH=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),YO=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),_H="(?!(?:^|/)\\.\\.?(?:$|/))",zm="(?!\\.)",bH=new Set(["[","."]),SH=new Set(["..","."]),wH=new Set("().*{}+?[]^$\\!"),vH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),iv="[^/]",XO=iv+"*?",JO=iv+"+?",Wo=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#_;#i;#u=!1;#s;#l;#a=!1;constructor(e,t,r={}){this.type=e,e&&(this.#n=!0),this.#c=t,this.#e=this.#c?this.#c.#e:this,this.#s=this.#e===this?r:this.#e.#s,this.#i=this.#e===this?[]:this.#e.#i,e==="!"&&!this.#e.#u&&this.#i.push(this),this.#_=this.#c?this.#c.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#l=this.#t.map(e=>String(e)).join("")}#p(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#i.pop();){if(e.type!=="!")continue;let t=e,r=t.#c;for(;r;){for(let i=t.#_+1;!r.type&&i<r.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}t=r,r=t.#c}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Dn&&t.#c===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#c?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#c?.isStart())return!1;if(this.#_===0)return!0;let e=this.#c;for(let t=0;t<this.#_;t++){let r=e.#t[t];if(!(r instanceof Dn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#c?.type==="!")return!0;if(!this.#c?.isEnd())return!1;if(!this.type)return this.#c?.isEnd();let e=this.#c?this.#c.#t.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Dn(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let a=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let S=r,v="";for(;S<e.length;){let w=e.charAt(S++);if(c||w==="\\"){c=!c,v+=w;continue}if(l){S===u+1?(w==="^"||w==="!")&&(f=!0):w==="]"&&!(S===u+2&&f)&&(l=!1),v+=w;continue}else if(w==="["){l=!0,u=S,f=!1,v+=w;continue}if(!i.noext&&nv(w)&&e.charAt(S)==="("&&s<=a){t.push(v),v="";let C=new Dn(w,t);S=Dn.#g(e,C,S,i,s+1),t.push(C);continue}v+=w}return t.push(v),S}let d=r+1,h=new Dn(null,t),p=[],y="";for(;d<e.length;){let S=e.charAt(d++);if(c||S==="\\"){c=!c,y+=S;continue}if(l){d===u+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(d===u+2&&f)&&(l=!1),y+=S;continue}else if(S==="["){l=!0,u=d,f=!1,y+=S;continue}if(nv(S)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(S))){let w=t&&t.#y(S)?0:1;h.push(y),y="";let T=new Dn(S,h);h.push(T),d=Dn.#g(e,T,d,i,s+w);continue}if(S==="|"){h.push(y),y="",p.push(h),h=new Dn(null,t);continue}if(S===")")return y===""&&t.#t.length===0&&(t.#a=!0),h.push(y),y="",t.push(...p,h),d;y+=S}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,gH)}#m(e,t=mH){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,t)}#y(e,t=yH){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Dn(null,r,this.options);i.#t.push(""),r.push(i),this.#E(e,t)}#E(e,t){let r=e.#t[0];this.#t.splice(t,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#c=this);this.#l=void 0}#T(e){return!!YO.get(this.type)?.has(e)}#b(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#T(t.type)}#v(e){let t=YO.get(this.type),r=e.#t[0],i=t?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#c=this);this.type=i,this.#l=void 0,this.#a=!1}#S(){if(KO(this)){let e=0,t=!1;do{t=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#S(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#b(i)&&(t=!1,this.#v(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#S();this.#l=void 0}static fromGlob(e,t={}){let r=new Dn(null,void 0,t);return Dn.#g(e,r,0,t,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let c=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#e===this&&(this.#S(),this.#p()),!KO(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,S,v,w]=typeof p=="string"?Dn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||v,this.#r=this.#r||w,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&SH.has(this.#t[0]))){let y=bH,S=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),v=!t&&!e&&y.has(u.charAt(0));f=S?_H:v?zm:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,$i(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#w(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#n=void 0,[l,$i(this.toString()),!1,!1]}let a=!r||e||t||!zm?"":this.#w(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?zm:"")+JO;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?zm:"")+XO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,$i(s),this.#n=!!this.#n,this.#r]}#w(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,a]=t.toRegExpSource(e);return this.#r=this.#r||a,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#x(e,t,r=!1){let i=!1,s="",a=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(wH.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=QO(e,l);if(h){s+=f,a=a||d,l+=h-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?JO:XO,t=!0;continue}else c=!1;if(u==="?"){s+=iv,t=!0;continue}s+=vH(u)}return[s,$i(e),!!t,a]}};Dn=Wo;var Al=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Mr=o((n,e,t={})=>(vf(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Bn(e,t).match(n)),"minimatch"),EH=/^\*+([^+@!?\*\[\(]*)$/,TH=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),AH=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),xH=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),IH=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),CH=/^\*+\.\*+$/,RH=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),OH=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),PH=/^\.\*+$/,FH=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),DH=/^\*+$/,NH=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),LH=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),kH=/^\?+([^+@!?\*\[\(]*)?$/,jH=o(([n,e=""])=>{let t=rP([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),MH=o(([n,e=""])=>{let t=nP([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),$H=o(([n,e=""])=>{let t=nP([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),VH=o(([n,e=""])=>{let t=rP([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),rP=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),nP=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),iP=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ZO={win32:{sep:"\\"},posix:{sep:"/"}},BH=iP==="win32"?ZO.win32.sep:ZO.posix.sep;Mr.sep=BH;var Gt=Symbol("globstar **");Mr.GLOBSTAR=Gt;var UH="[^/]",qH=UH+"*?",WH="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",GH="(?:(?!(?:\\/|^)\\.).)*?",zH=o((n,e={})=>t=>Mr(t,n,e),"filter");Mr.filter=zH;var ni=o((n,e={})=>Object.assign({},n,e),"ext"),HH=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Mr;let e=Mr;return Object.assign(o((r,i,s={})=>e(r,i,ni(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,ni(n,s))}static defaults(i){return e.defaults(ni(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,ni(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,ni(n,s))}},unescape:o((r,i={})=>e.unescape(r,ni(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,ni(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,ni(n,i)),"filter"),defaults:o(r=>e.defaults(ni(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,ni(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,ni(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,ni(n,s)),"match"),sep:e.sep,GLOBSTAR:Gt})},"defaults");Mr.defaults=HH;var sP=o((n,e={})=>(vf(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,tP.default)(n)),"braceExpand");Mr.braceExpand=sP;var QH=o((n,e={})=>new Bn(n,e).makeRe(),"makeRe");Mr.makeRe=QH;var KH=o((n,e,t={})=>{let r=new Bn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Mr.match=KH;var eP=/[?*]|[+@!]\(.*?\)|\[|\]/,YH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Bn=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){vf(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||iP,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!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 r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,a,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!eP.test(s[2]))&&!eP.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 a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][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 r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),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 r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let a=i;for(;r[a+1]==="**";)a++;a>i&&r.splice(i+1,a-i);let c=r[i+1],l=r[i+2],u=r[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let c=r[a];a===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let a=r[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let i=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(i){e[t]=[],e[r]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let i=0,s=0,a=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])a.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])a.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])a.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",a.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",a.push(t[s]),i++,s++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!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,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,y]=[e[d],t[h]];p.toLowerCase()===y.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Gt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Gt,s),c=t.lastIndexOf(Gt),[l,u,f]=r?[t.slice(s,a),t.slice(a+1),[]]:[t.slice(s,a),t.slice(a+1,c),t.slice(c+1)];if(l.length){let T=e.slice(i,i+l.length);if(!this.#r(T,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let T=e.length-f.length;if(this.#r(e,f,r,T,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(T--,!this.#r(e,f,r,T,0)))return!1;d=f.length+1}}if(!u.length){let T=!!d;for(let C=i;C<e.length-d;C++){let L=String(e[C]);if(T=!0,L==="."||L===".."||!this.options.dot&&L.startsWith("."))return!1}return r||T}let h=[[[],0]],p=h[0],y=0,S=[0];for(let T of u)T===Gt?(S.push(y),p=[[],0],h.push(p)):(p[0].push(T),y++);let v=h.length-1,w=e.length-d;for(let T of h)T[1]=w-(S[v--]+T[0].length);return!!this.#n(e,h,i,0,r,0,!!d)}#n(e,t,r,i,s,a,c){let l=t[i];if(!l){for(let d=r;d<e.length;d++){c=!0;let h=e[d];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return c}let[u,f]=l;for(;r<=f;){if(this.#r(e.slice(0,r+u.length),u,s,r,0)&&a<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,a+1,c);if(p!==!1)return p}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let a,c,l,u;for(a=i,c=s,u=e.length,l=t.length;a<u&&c<l;a++,c++){this.debug("matchOne loop");let f=t[c],d=e[a];if(this.debug(t,f,d),f===!1||f===Gt)return!1;let h;if(typeof f=="string"?(h=d===f,this.debug("string match",f,d,h)):(h=f.test(d),this.debug("pattern match",f,d,h)),!h)return!1}if(a===u&&c===l)return!0;if(a===u)return r;if(c===l)return a===u-1&&e[a]==="";throw new Error("wtf?")}braceExpand(){return sP(this.pattern,this.options)}parse(e){vf(e);let t=this.options;if(e==="**")return Gt;if(e==="")return"";let r,i=null;(r=e.match(DH))?i=t.dot?LH:NH:(r=e.match(EH))?i=(t.nocase?t.dot?IH:xH:t.dot?AH:TH)(r[1]):(r=e.match(kH))?i=(t.nocase?t.dot?MH:jH:t.dot?$H:VH)(r):(r=e.match(CH))?i=t.dot?OH:RH:(r=e.match(PH))&&(i=FH);let s=Wo.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,r=t.noglobstar?qH:t.dot?WH:GH,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?YH(f):f===Gt?Gt:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==Gt||p===Gt||(p===void 0?h!==void 0&&h!==Gt?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==Gt&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=Gt))}),u.filter(f=>f!==Gt).join("/")}).join("|"),[a,c]=e.length>1?["(?:",")"]:["",""];s="^"+a+s+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 r=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 a=i[i.length-1];if(!a)for(let c=i.length-2;!a&&c>=0;c--)a=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Mr.defaults(e).Minimatch}};Mr.AST=Wo;Mr.Minimatch=Bn;Mr.escape=Al;Mr.unescape=$i;var RP=require("node:url");var xl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,oP=new Set,sv=typeof process=="object"&&process?process:{},cP=o((n,e,t,r)=>{typeof sv.emitWarning=="function"?sv.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Hm=globalThis.AbortController,aP=globalThis.AbortSignal;if(typeof Hm>"u"){aP=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Hm=class{static{o(this,"AbortController")}constructor(){e()}signal=new aP;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let n=sv.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,cP("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))},"warnACPolyfill")}var XH=o(n=>!oP.has(n),"shouldWarn");var za=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),lP=o(n=>za(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Il:null:null,"getUintArray"),Il=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},av=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=lP(e);if(!t)return[];n.#e=!0;let r=new n(e,t);return n.#e=!1,r}constructor(e,t){if(!n.#e)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]}},Tf=class n{static{o(this,"LRUCache")}#e;#n;#r;#t;#c;#_;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#a;#p;#g;#d;#m;#y;#f;#E;#T;#b;#v;#S;#w;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#b,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#a,next:e.#p,prev:e.#g,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:o(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:o((t,r,i,s)=>e.#M(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#V(t),"moveToTail"),indexes:o(t=>e.#C(t),"indexes"),rindexes:o(t=>e.#R(t),"rindexes"),isStale:o(t=>e.#A(t),"isStale")}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#i}get fetchMethod(){return this.#c}get memoMethod(){return this.#_}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:h,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:S,fetchMethod:v,memoMethod:w,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:$,ignoreFetchAbort:ee}=e;if(t!==0&&!za(t))throw new TypeError("max option must be a nonnegative integer");let B=t?lP(t):Array;if(!B)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=S,this.sizeCalculation){if(!this.#n&&!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.#_=w,v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=v,this.#S=!!v,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new B(t),this.#g=new B(t),this.#d=0,this.#m=0,this.#y=av.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#v=!!this.#r,this.#w=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!ee,this.maxEntrySize!==0){if(this.#n!==0&&!za(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!za(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=za(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!za(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let G="LRU_CACHE_UNBOUNDED";XH(G)&&(oP.add(G),cP("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",G,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#x(){let e=new Il(this.#e),t=new Il(this.#e);this.#b=e,this.#T=t,this.#F=(s,a,c=xl.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#P(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#I=s=>{t[s]=e[s]!==0?xl.now():0},this.#o=(s,a)=>{if(e[a]){let c=e[a],l=t[a];if(!c||!l)return;s.ttl=c,s.start=l,s.now=r||i();let u=s.now-l;s.remainingTTL=c-u}};let r=0,i=o(()=>{let s=xl.now();if(this.ttlResolution>0){r=s;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return s},"getNow");this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let c=e[a],l=t[a];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#A=s=>{let a=t[s],c=e[s];return!!c&&!!a&&(r||i())-a>c}}#I=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#A=o(()=>!1,"#isStale");#O(){let e=new Il(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#L=(t,r,i,s)=>{if(this.#h(r))return 0;if(!za(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!za(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.#N=(t,r,i)=>{if(e[t]=r,this.#n){let s=this.#n-e[t];for(;this.#u>s;)this.#j(!0)}this.#u+=e[t],i&&(i.entrySize=r,i.totalCalculatedSize=this.#u)}}#D=o(e=>{},"#removeItemSize");#N=o((e,t,r)=>{},"#addItemSize");#L=o((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#C({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#R({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#m));)t=this.#p[t]}#k(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#C())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*rentries(){for(let e of this.#R())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*keys(){for(let e of this.#C()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*values(){for(let e of this.#C())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#R())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#C()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[r],this))return this.get(this.#l[r],t)}}forEach(e,t=this){for(let r of this.#C()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#R()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#R({allowStale:!0}))this.#A(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#a[t],i=this.#h(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#b&&this.#T){let a=this.#b[t],c=this.#T[t];if(a&&c){let l=a-(xl.now()-c);s.ttl=l,s.start=Date.now()}}return this.#E&&(s.size=this.#E[t]),s}dump(){let e=[];for(let t of this.#C({allowStale:!0})){let r=this.#l[t],i=this.#a[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(this.#b&&this.#T){a.ttl=this.#b[t];let c=xl.now()-this.#T[t];a.start=Math.floor(Date.now()-c)}this.#E&&(a.size=this.#E[t]),e.unshift([r,a])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=xl.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#L(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let d=this.#i===0?void 0:this.#s.get(e);if(d===void 0)d=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#j(!1):this.#i,this.#l[d]=e,this.#a[d]=t,this.#s.set(e,d),this.#p[this.#m]=d,this.#g[d]=this.#m,this.#m=d,this.#i++,this.#N(d,f,l),l&&(l.set="add"),u=!1;else{this.#V(d);let h=this.#a[d];if(t!==h){if(this.#S&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!a&&(this.#v&&this.#r?.(p,e,"set"),this.#w&&this.#f?.push([p,e,"set"]))}else a||(this.#v&&this.#r?.(h,e,"set"),this.#w&&this.#f?.push([h,e,"set"]));if(this.#D(d),this.#N(d,f,l),this.#a[d]=t,l){l.set="replace";let p=h&&this.#h(h)?h.__staleWhileFetching:h;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#b&&this.#x(),this.#b&&(u||this.#F(d,i,s),l&&this.#o(l,d)),!a&&this.#w&&this.#f){let h=this.#f,p;for(;p=h?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#a[this.#d];if(this.#j(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#j(e){let t=this.#d,r=this.#l[t],i=this.#a[t];return this.#S&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(i,r,"evict"),this.#w&&this.#f?.push([i,r,"evict"])),this.#D(t),e&&(this.#l[t]=void 0,this.#a[t]=void 0,this.#y.push(t)),this.#i===1?(this.#d=this.#m=0,this.#y.length=0):this.#d=this.#p[t],this.#s.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=this.#s.get(e);if(s!==void 0){let a=this.#a[s];if(this.#h(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#o(i,s));else return r&&this.#I(s),i&&(i.has="hit",this.#o(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=this.#s.get(e);if(i===void 0||!r&&this.#A(i))return;let s=this.#a[i];return this.#h(s)?s.__staleWhileFetching:s}#M(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#h(s))return s;let a=new Hm,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((S,v=!1)=>{let{aborted:w}=a.signal,T=r.ignoreFetchAbort&&S!==void 0;if(r.status&&(w&&!v?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,T&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),w&&!T&&!v)return d(a.signal.reason);let C=p;return this.#a[t]===p&&(S===void 0?C.__staleWhileFetching?this.#a[t]=C.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,S,l.options))),S},"cb"),f=o(S=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=S),d(S)),"eb"),d=o(S=>{let{aborted:v}=a.signal,w=v&&r.allowStaleOnFetchAbort,T=w||r.allowStaleOnFetchRejection,C=T||r.noDeleteOnFetchRejection,L=p;if(this.#a[t]===p&&(!C||L.__staleWhileFetching===void 0?this.#P(e,"fetch"):w||(this.#a[t]=L.__staleWhileFetching)),T)return r.status&&L.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),L.__staleWhileFetching;if(L.__returned===L)throw S},"fetchFail"),h=o((S,v)=>{let w=this.#c?.(e,s,l);w&&w instanceof Promise&&w.then(T=>S(T===void 0?void 0:T),v),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(S(void 0),r.allowStaleOnFetchAbort&&(S=o(T=>u(T,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),y=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,y,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=y,y}#h(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Hm}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:S,forceRefresh:v=!1,status:w,signal:T}=t;if(!this.#S)return w&&(w.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:w});let C={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:w,signal:T},L=this.#s.get(e);if(L===void 0){w&&(w.fetch="miss");let $=this.#M(e,L,C,S);return $.__returned=$}else{let $=this.#a[L];if(this.#h($)){let D=r&&$.__staleWhileFetching!==void 0;return w&&(w.fetch="inflight",D&&(w.returnedStale=!0)),D?$.__staleWhileFetching:$.__returned=$}let ee=this.#A(L);if(!v&&!ee)return w&&(w.fetch="hit"),this.#V(L),i&&this.#I(L),w&&this.#o(w,L),$;let B=this.#M(e,L,C,S),F=B.__staleWhileFetching!==void 0&&r;return w&&(w.fetch=ee?"stale":"refresh",F&&ee&&(w.returnedStale=!0)),F?B.__staleWhileFetching:B.__returned=B}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#_;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,c=this.get(e,a);if(!s&&c!==void 0)return c;let l=r(e,c,{options:a,context:i});return this.set(e,l,a),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#a[c],u=this.#h(l);return a&&this.#o(a,c),this.#A(c)?(a&&(a.get="stale"),u?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#P(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#I(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#V(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#B(t);else{this.#D(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(s,e,t),this.#w&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#a[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#d)this.#d=this.#p[i];else{let a=this.#g[i];this.#p[a]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#w&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#R({allowStale:!0})){let r=this.#a[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#v&&this.#r?.(r,i,e),this.#w&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#b&&this.#T&&(this.#b.fill(0),this.#T.fill(0)),this.#E&&this.#E.fill(0),this.#d=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#w&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var Ol=require("node:path"),bP=require("node:url"),vs=require("fs"),oQ=le(require("node:fs"),1),Ka=require("node:fs/promises");var eg=require("node:events"),hv=le(require("node:stream"),1),pP=require("node:string_decoder");var uP=typeof process=="object"&&process?process:{stdout:null,stderr:null},JH=o(n=>!!n&&typeof n=="object"&&(n instanceof Qa||n instanceof hv.default||ZH(n)||eQ(n)),"isStream"),ZH=o(n=>!!n&&typeof n=="object"&&n instanceof eg.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==hv.default.Writable.prototype.pipe,"isReadable"),eQ=o(n=>!!n&&typeof n=="object"&&n instanceof eg.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),ua=Symbol("EOF"),fa=Symbol("maybeEmitEnd"),Ha=Symbol("emittedEnd"),Qm=Symbol("emittingEnd"),Af=Symbol("emittedError"),Km=Symbol("closed"),fP=Symbol("read"),Ym=Symbol("flush"),dP=Symbol("flushChunk"),Vi=Symbol("encoding"),Cl=Symbol("decoder"),Er=Symbol("flowing"),xf=Symbol("paused"),Rl=Symbol("resume"),Tr=Symbol("buffer"),bn=Symbol("pipes"),Ar=Symbol("bufferLength"),ov=Symbol("bufferPush"),Xm=Symbol("bufferShift"),Yr=Symbol("objectMode"),zt=Symbol("destroyed"),cv=Symbol("error"),lv=Symbol("emitData"),hP=Symbol("emitEnd"),uv=Symbol("emitEnd2"),Ss=Symbol("async"),fv=Symbol("abort"),Jm=Symbol("aborted"),If=Symbol("signal"),Go=Symbol("dataListeners"),Un=Symbol("discarded"),Cf=o(n=>Promise.resolve().then(n),"defer"),tQ=o(n=>n(),"nodefer"),rQ=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),nQ=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),iQ=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Zm=class{static{o(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Rl](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},dv=class extends Zm{static{o(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},sQ=o(n=>!!n.objectMode,"isObjectModeOptions"),aQ=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Qa=class extends eg.EventEmitter{static{o(this,"Minipass")}[Er]=!1;[xf]=!1;[bn]=[];[Tr]=[];[Yr];[Vi];[Ss];[Cl];[ua]=!1;[Ha]=!1;[Qm]=!1;[Km]=!1;[Af]=null;[Ar]=0;[zt]=!1;[If];[Jm]=!1;[Go]=0;[Un]=!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");sQ(t)?(this[Yr]=!0,this[Vi]=null):aQ(t)?(this[Vi]=t.encoding,this[Yr]=!1):(this[Yr]=!1,this[Vi]=null),this[Ss]=!!t.async,this[Cl]=this[Vi]?new pP.StringDecoder(this[Vi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[Tr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[bn],"get")});let{signal:r}=t;r&&(this[If]=r,r.aborted?this[fv]():r.addEventListener("abort",()=>this[fv]()))}get bufferLength(){return this[Ar]}get encoding(){return this[Vi]}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[Yr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ss]}set async(e){this[Ss]=this[Ss]||!!e}[fv](){this[Jm]=!0,this.emit("abort",this[If]?.reason),this.destroy(this[If]?.reason)}get aborted(){return this[Jm]}set aborted(e){}write(e,t,r){if(this[Jm])return!1;if(this[ua])throw new Error("write after end");if(this[zt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||(t="utf8");let i=this[Ss]?Cf:tQ;if(!this[Yr]&&!Buffer.isBuffer(e)){if(iQ(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(nQ(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Yr]?(this[Er]&&this[Ar]!==0&&this[Ym](!0),this[Er]?this.emit("data",e):this[ov](e),this[Ar]!==0&&this.emit("readable"),r&&i(r),this[Er]):e.length?(typeof e=="string"&&!(t===this[Vi]&&!this[Cl]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Vi]&&(e=this[Cl].write(e)),this[Er]&&this[Ar]!==0&&this[Ym](!0),this[Er]?this.emit("data",e):this[ov](e),this[Ar]!==0&&this.emit("readable"),r&&i(r),this[Er]):(this[Ar]!==0&&this.emit("readable"),r&&i(r),this[Er])}read(e){if(this[zt])return null;if(this[Un]=!1,this[Ar]===0||e===0||e&&e>this[Ar])return this[fa](),null;this[Yr]&&(e=null),this[Tr].length>1&&!this[Yr]&&(this[Tr]=[this[Vi]?this[Tr].join(""):Buffer.concat(this[Tr],this[Ar])]);let t=this[fP](e||null,this[Tr][0]);return this[fa](),t}[fP](e,t){if(this[Yr])this[Xm]();else{let r=t;e===r.length||e===null?this[Xm]():typeof r=="string"?(this[Tr][0]=r.slice(e),t=r.slice(0,e),this[Ar]-=e):(this[Tr][0]=r.subarray(e),t=r.subarray(0,e),this[Ar]-=e)}return this.emit("data",t),!this[Tr].length&&!this[ua]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[ua]=!0,this.writable=!1,(this[Er]||!this[xf])&&this[fa](),this}[Rl](){this[zt]||(!this[Go]&&!this[bn].length&&(this[Un]=!0),this[xf]=!1,this[Er]=!0,this.emit("resume"),this[Tr].length?this[Ym]():this[ua]?this[fa]():this.emit("drain"))}resume(){return this[Rl]()}pause(){this[Er]=!1,this[xf]=!0,this[Un]=!1}get destroyed(){return this[zt]}get flowing(){return this[Er]}get paused(){return this[xf]}[ov](e){this[Yr]?this[Ar]+=1:this[Ar]+=e.length,this[Tr].push(e)}[Xm](){return this[Yr]?this[Ar]-=1:this[Ar]-=this[Tr][0].length,this[Tr].shift()}[Ym](e=!1){do;while(this[dP](this[Xm]())&&this[Tr].length);!e&&!this[Tr].length&&!this[ua]&&this.emit("drain")}[dP](e){return this.emit("data",e),this[Er]}pipe(e,t){if(this[zt])return e;this[Un]=!1;let r=this[Ha];return t=t||{},e===uP.stdout||e===uP.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[bn].push(t.proxyErrors?new dv(this,e,t):new Zm(this,e,t)),this[Ss]?Cf(()=>this[Rl]()):this[Rl]()),e}unpipe(e){let t=this[bn].find(r=>r.dest===e);t&&(this[bn].length===1?(this[Er]&&this[Go]===0&&(this[Er]=!1),this[bn]=[]):this[bn].splice(this[bn].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[Un]=!1,this[Go]++,!this[bn].length&&!this[Er]&&this[Rl]();else if(e==="readable"&&this[Ar]!==0)super.emit("readable");else if(rQ(e)&&this[Ha])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Af]){let i=t;this[Ss]?Cf(()=>i.call(this,this[Af])):i.call(this,this[Af])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Go]=this.listeners("data").length,this[Go]===0&&!this[Un]&&!this[bn].length&&(this[Er]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Go]=0,!this[Un]&&!this[bn].length&&(this[Er]=!1)),t}get emittedEnd(){return this[Ha]}[fa](){!this[Qm]&&!this[Ha]&&!this[zt]&&this[Tr].length===0&&this[ua]&&(this[Qm]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Km]&&this.emit("close"),this[Qm]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==zt&&this[zt])return!1;if(e==="data")return!this[Yr]&&!r?!1:this[Ss]?(Cf(()=>this[lv](r)),!0):this[lv](r);if(e==="end")return this[hP]();if(e==="close"){if(this[Km]=!0,!this[Ha]&&!this[zt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Af]=r,super.emit(cv,r);let s=!this[If]||this.listeners("error").length?super.emit("error",r):!1;return this[fa](),s}else if(e==="resume"){let s=super.emit("resume");return this[fa](),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[fa](),i}[lv](e){for(let r of this[bn])r.dest.write(e)===!1&&this.pause();let t=this[Un]?!1:super.emit("data",e);return this[fa](),t}[hP](){return this[Ha]?!1:(this[Ha]=!0,this.readable=!1,this[Ss]?(Cf(()=>this[uv]()),!0):this[uv]())}[uv](){if(this[Cl]){let t=this[Cl].end();if(t){for(let r of this[bn])r.dest.write(t);this[Un]||super.emit("data",t)}}for(let t of this[bn])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Yr]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Yr]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Yr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Vi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(zt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Un]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ua])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(zt,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(zt,f),this.pause(),s({value:d,done:!!this[ua]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(zt,f),t(),s({done:!0,value:void 0})},"onend"),f=o(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,h)=>{a=h,s=d,this.once(zt,f),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Un]=!1;let e=!1,t=o(()=>(this.pause(),this.off(cv,t),this.off(zt,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(cv,t),this.once(zt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[zt])return e?this.emit("error",e):this.emit(zt),this;this[zt]=!0,this[Un]=!0,this[Tr].length=0,this[Ar]=0;let t=this;return typeof t.close=="function"&&!this[Km]&&t.close(),e?this.emit("error",e):this.emit(zt),this}static get isStream(){return JH}};var cQ=vs.realpathSync.native,Of={lstatSync:vs.lstatSync,readdir:vs.readdir,readdirSync:vs.readdirSync,readlinkSync:vs.readlinkSync,realpathSync:cQ,promises:{lstat:Ka.lstat,readdir:Ka.readdir,readlink:Ka.readlink,realpath:Ka.realpath}},SP=o(n=>!n||n===Of||n===oQ?Of:{...Of,...n,promises:{...Of.promises,...n.promises||{}}},"fsFromOption"),wP=/^\\\\\?\\([a-z]:)\\?$/i,lQ=o(n=>n.replace(/\//g,"\\").replace(wP,"$1\\"),"uncToDrive"),uQ=/[\\\/]/,si=0,vP=1,EP=2,ws=4,TP=6,AP=8,zo=10,xP=12,ii=15,Rf=~ii,pv=16,mP=32,Pf=64,Bi=128,tg=256,ng=512,gP=Pf|Bi|ng,fQ=1023,mv=o(n=>n.isFile()?AP:n.isDirectory()?ws:n.isSymbolicLink()?zo:n.isCharacterDevice()?EP:n.isBlockDevice()?TP:n.isSocket()?xP:n.isFIFO()?vP:si,"entToType"),yP=new Map,Ff=o(n=>{let e=yP.get(n);if(e)return e;let t=n.normalize("NFKD");return yP.set(n,t),t},"normalize"),_P=new Map,rg=o(n=>{let e=_P.get(n);if(e)return e;let t=Ff(n.toLowerCase());return _P.set(n,t),t},"normalizeNocase"),ig=class extends Tf{static{o(this,"ResolveCache")}constructor(){super({max:256})}},gv=class extends Tf{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},IP=Symbol("PathScurry setAsCwd"),Xr=class{static{o(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#r;get mode(){return this.#r}#t;get nlink(){return this.#t}#c;get uid(){return this.#c}#_;get gid(){return this.#_}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#a;get blocks(){return this.#a}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#d;get ctimeMs(){return this.#d}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#b;#v;#S;#w;#x;#I;#o;#F;#A;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=si,r,i,s,a,c){this.name=e,this.#b=s?rg(e):Ff(e),this.#o=t&fQ,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#S=c.fullpath,this.#x=c.relative,this.#I=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=SP(c.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#o&=~pv,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?rg(e):Ff(e);for(let l of r)if(l.#b===i)return l;let s=this.parent?this.sep:"",a=this.#S?this.#S+s+e:void 0,c=this.newChild(e,si,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=Bi),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.name;let r=t.relative();return r+(!r||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let e=this.name,t=this.parent;if(!t)return this.#I=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#S=i}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#o&ii)===si}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.#o&ii)===AP}isDirectory(){return(this.#o&ii)===ws}isCharacterDevice(){return(this.#o&ii)===EP}isBlockDevice(){return(this.#o&ii)===TP}isFIFO(){return(this.#o&ii)===vP}isSocket(){return(this.#o&ii)===xP}isSymbolicLink(){return(this.#o&zo)===zo}lstatCached(){return this.#o&mP?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#A)return!0;if(!this.parent)return!1;let e=this.#oⅈreturn!(e!==si&&e!==zo||this.#o&tg||this.#o&Bi)}calledReaddir(){return!!(this.#o&pv)}isENOENT(){return!!(this.#o&Bi)}isNamed(e){return this.nocase?this.#b===rg(e):this.#b===Ff(e)}async readlink(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}#N(e){this.#o|=pv;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&Bi||(this.#o=(this.#o|Bi)&Rf,this.#C())}#C(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#R(){this.#o|=ng,this.#k()}#k(){if(this.#o&Pf)return;let e=this.#o;(e&ii)===ws&&(e&=Rf),this.#o=e|Pf,this.#C()}#j(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#L():this.children().provisional=0}#M(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#L()}#h(e=""){let t=this.#o;t|=tg,e==="ENOENT"&&(t|=Bi),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Rf),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#P(e,t)||this.#V(e,t)}#V(e,t){let r=mv(e),i=this.newChild(e.name,r,{parent:this}),s=i.#oⅈreturn s!==ws&&s!==zo&&s!==si&&(i.#o|=Pf),t.unshift(i),t.provisional++,i}#P(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?rg(e.name):Ff(e.name))===i.#b)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#o=t.#o&Rf|mv(e),s!==e.name&&(t.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&Bi)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#M(e.code)}}lstatSync(){if((this.#o&Bi)===0)try{return this.#G(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#M(e.code)}}#G(e){let{atime:t,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:a,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:h,mode:p,mtime:y,mtimeMs:S,nlink:v,rdev:w,size:T,uid:C}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#d=u,this.#n=f,this.#_=d,this.#s=h,this.#r=p,this.#f=y,this.#g=S,this.#t=v,this.#i=w,this.#l=T,this.#c=C;let L=mv(e);this.#o=this.#o&Rf|L|mP,L!==si&&L!==ws&&L!==zo&&(this.#o|=Pf)}#q=[];#W=!1;#z(e){this.#W=!1;let t=this.#q.slice();this.#q.length=0,t.forEach(r=>r(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#q.push(e),this.#W)return;this.#W=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,a)=>{if(s)this.#j(s.code),r.provisional=0;else{for(let c of a)this.#$(c,r);this.#N(r)}this.#z(r.slice(0,r.provisional))})}#U;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.#U)await this.#U;else{let r=o(()=>{},"resolve");this.#U=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#N(e)}catch(i){this.#j(i.code),e.provisional=0}this.#U=void 0,r()}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 r of this.#e.readdirSync(t,{withFileTypes:!0}))this.#$(r,e);this.#N(e)}catch(r){this.#j(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&gP)return!1;let e=ii&this.#o;return e===si||e===ws||e===zo}shouldWalk(e,t){return(this.#o&ws)===ws&&!(this.#o&gP)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((ng|tg|Bi)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}realpathSync(){if(this.#O)return this.#O;if(!((ng|tg|Bi)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}[IP](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),r=[],i=this;for(;i&&i.parent;)t.add(i),i.#x=r.join(this.sep),i.#I=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#x=void 0,i.#I=void 0,i=i.parent}},sg=class n extends Xr{static{o(this,"PathWin32")}sep="\\";splitSep=uQ;constructor(e,t=si,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=si,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return Ol.win32.parse(e).root}getRoot(e){if(e=lQ(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,r]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=r;return this.roots[e]=new Pl(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(wP,"$1\\"),e===t}},ag=class n extends Xr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=si,r,i,s,a,c){super(e,t,r,i,s,a,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=si,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},og=class{static{o(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:a=Of}={}){this.#t=SP(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,bP.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new ig,this.#n=new ig,this.#r=new gv(s);let l=c.substring(this.rootPath.length).split(r);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.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,h=this.rootPath,p=!1;for(let y of l){let S=f--;u=u.child(y,{relative:new Array(S).fill("..").join(d),relativePosix:new Array(S).fill("..").join("/"),fullpath:h+=(p?"":d)+y}),p=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#e.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#n.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.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 Xr||(t=e,e=this.cwd);let{withFileTypes:r}=t;if(e.canReaddir()){let i=await e.readdir();return r?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 Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0}=t;return e.canReaddir()?r?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 Xr||(t=e.withFileTypes,e=this.cwd);let r=await e.readlink();return t?r:r?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e.withFileTypes,e=this.cwd);let r=e.readlinkSync();return t?r:r?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e.withFileTypes,e=this.cwd);let r=await e.realpath();return t?r:r?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e.withFileTypes,e=this.cwd);let r=e.realpathSync();return t?r:r?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=o((d,h)=>{l.add(d),d.readdirCB((p,y)=>{if(p)return h(p);let S=y.length;if(!S)return h();let v=o(()=>{--S===0&&h()},"next");for(let w of y)(!s||s(w))&&c.push(r?w:w.fullpath()),i&&w.isSymbolicLink()?w.realpath().then(T=>T?.isUnknown()?T.lstat():T).then(T=>T?.shouldWalk(l,a)?u(T,v):v()):w.shouldWalk(l,a)?u(w,v):v()},!0)},"walk"),f=e;return new Promise((d,h)=>{u(f,p=>{if(p)return h(p);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?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(r?d:d.fullpath());let h=d;if(d.isSymbolicLink()){if(!(i&&(h=d.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(l,a)&&l.add(h)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(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 Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t;(!s||s(e))&&(yield r?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 r?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,a)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Qa({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=o((v,w,T=!1)=>{if(v)return c.emit("error",v);if(i&&!T){let C=[];for(let L of w)L.isSymbolicLink()&&C.push(L.realpath().then($=>$?.isUnknown()?$.lstat():$));if(C.length){Promise.all(C).then(()=>y(null,w,!0));return}}for(let C of w)C&&(!s||s(C))&&(c.write(r?C:C.fullpath())||(h=!0));f--;for(let C of w){let L=C.realpathCached()||C;L.shouldWalk(l,a)&&u.push(L)}h&&!c.flowing?c.once("drain",d):S||d()},"onReaddir"),S=!0;p.readdirCB(y,!0),S=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Xr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Qa({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let S of y)(!s||s(S))&&(c.write(r?S:S.fullpath())||(h=!0));f--;for(let S of y){let v=S;if(S.isSymbolicLink()){if(!(i&&(v=S.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(l,a)&&u.push(v)}}h&&!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[IP](t)}},Pl=class extends og{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,Ol.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Ol.win32.parse(e).root.toUpperCase()}newRoot(e){return new sg(this.rootPath,ws,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Fl=class extends og{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,Ol.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new ag(this.rootPath,ws,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Df=class extends Fl{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},Tue=process.platform==="win32"?sg:ag,CP=process.platform==="win32"?Pl:process.platform==="darwin"?Df:Fl;var dQ=o(n=>n.length>=1,"isPatternList"),hQ=o(n=>n.length>=1,"isGlobList"),Dl=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!dQ(e))throw new TypeError("empty pattern list");if(!hQ(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,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,a,c,l,...u]=this.#e,[f,d,h,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let S=[s,a,c,l,""].join("/"),v=[f,d,h,p,""].join("/");this.#e=[S,...u],this.#n=[v,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[c,...l]=this.#n;a[0]===""&&(a.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...a],this.#n=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===Gt}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#_=this.#_||(this.#r===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#c!==void 0?this.#c:this.hasMore()?(this.#c=new n(this.#e,this.#n,this.#r+1,this.#t),this.#c.#s=this.#s,this.#c.#u=this.#u,this.#c.#i=this.#i,this.#c):this.#c=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#r===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#i!==void 0?this.#i:this.#i=this.#t==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#s!==void 0?this.#s:this.#s=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var pQ=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Nl=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=pQ}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new Bn(e,this.mmopts);for(let r=0;r<t.set.length;r++){let i=t.set[r],s=t.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let a=new Dl(i,s,0,this.platform),c=new Bn(a.globString(),this.mmopts),l=s[s.length-1]==="**",u=a.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(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let a of this.relative)if(a.match(i)||a.match(s))return!0;for(let a of this.absolute)if(a.match(t)||a.match(r))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var yv=class n{static{o(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let r=e.fullpath(),i=this.store.get(r);i?i.add(t.globString()):this.store.set(r,new Set([t.globString()]))}},_v=class{static{o(this,"MatchRecord")}store=new Map;add(e,t,r){let i=(t?2:0)|(r?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)])}},bv=class{static{o(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let r=this.store.get(e);r?r.find(i=>i.globString()===t.globString())||r.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())}},Nf=class n{static{o(this,"Processor")}hasWalkedCache;matches=new _v;subwalks=new bv;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new yv}processPatterns(e,t){this.patterns=t;let r=t.map(i=>[e,i]);for(let[i,s]of r){this.hasWalkedCache.storeWalked(i,s);let a=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(a){i=i.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);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===Gt){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),h=u?.rest();if(!u||(d===""||d===".")&&!h)this.matches.add(i,c,d===""||d===".");else if(d===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):this.matches.add(p,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let r=this.subwalks.get(e),i=this.child();for(let s of t)for(let a of r){let c=a.isAbsolute(),l=a.pattern(),u=a.rest();l===Gt?i.testGlobstar(s,a,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,r,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()&&(r&&t.checkFollowGlobstar()?this.subwalks.add(e,r):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),r){let s=r.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,r.rest(),i);else if(s===".."){let a=e.parent||e;this.subwalks.add(a,r)}else s instanceof RegExp&&this.testRegExp(e,s,r.rest(),i)}}testRegExp(e,t,r,i){t.test(e.name)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}testString(e,t,r,i){e.isNamed(t)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}};var mQ=o((n,e)=>typeof n=="string"?new Nl([n],e):Array.isArray(n)?new Nl(n,e):n,"makeIgnore"),cg=class{static{o(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#r;signal;maxDepth;includeChildMatches;constructor(e,t,r){if(this.patterns=e,this.path=t,this.opts=r,this.#r=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#n=mQ(r.ignore??[],r),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#c(e){return!!this.#n?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=await s.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.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.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=s.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let s=`${e.relativePosix()}/**`;this.#n.add(s)}let r=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(r){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?a+s+i:"."+i)}}async match(e,t,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,t)}matchSync(e,t,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,t)}walkCB(e,t,r){this.signal?.aborted&&r(),this.walkCB2(e,t,new Nf(this.opts),r)}walkCB2(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,r,a):c.readdirCB((u,f)=>this.walkCB3(c,f,r,a),!0)}a()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),a);a()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new Nf(this.opts),r)}walkCB2Sync(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,r,a)}a()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let[c,l]of r.subwalks.entries())s++,this.walkCB2Sync(c,l,r.child(),a);a()}},Lf=class extends cg{static{o(this,"GlobWalker")}matches=new Set;constructor(e,t,r){super(e,t,r)}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}},kf=class extends cg{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Qa({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 gQ=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ui=class{static{o(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,RP.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||gQ,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"?Pl:t.platform==="darwin"?Df:t.platform?Fl:CP;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,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 Bn(l,i)),[a,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Dl(l,f,0,this.platform)})}async walk(){return[...await new Lf(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 Lf(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 kf(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 kf(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 Sv=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Bn(t,e).hasMagic())return!0;return!1},"hasMagic");function lg(n,e={}){return new Ui(n,e).streamSync()}o(lg,"globStreamSync");function PP(n,e={}){return new Ui(n,e).stream()}o(PP,"globStream");function FP(n,e={}){return new Ui(n,e).walkSync()}o(FP,"globSync");async function OP(n,e={}){return new Ui(n,e).walk()}o(OP,"glob_");function ug(n,e={}){return new Ui(n,e).iterateSync()}o(ug,"globIterateSync");function DP(n,e={}){return new Ui(n,e).iterate()}o(DP,"globIterate");var yQ=lg,_Q=Object.assign(PP,{sync:lg}),bQ=ug,SQ=Object.assign(DP,{sync:ug}),wQ=Object.assign(FP,{stream:lg,iterate:ug}),Ll=Object.assign(OP,{glob:OP,globSync:FP,sync:wQ,globStream:PP,stream:_Q,globStreamSync:lg,streamSync:yQ,globIterate:DP,iterate:SQ,globIterateSync:ug,iterateSync:bQ,Glob:Ui,hasMagic:Sv,escape:Al,unescape:$i});Ll.glob=Ll;async function LP(n,e,t,r={}){let{dryRun:i=!1,excludeRelPath:s}=r,a=Ho.default.join(n,"**/*.md"),c=await Ll(a,{nodir:!0,ignore:[Ho.default.join(n,".obsidian/**"),Ho.default.join(n,".trash/**"),Ho.default.join(n,"**/.obsidian/**"),Ho.default.join(n,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=Ho.default.relative(n,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await wv.default.readFile(u,"utf-8")}catch{continue}let{updated:h,replacements:p}=vQ(d,e,t);p>0&&(l.filesModified+=1,l.replacements+=p,l.modifiedFiles.push(f),i||await wv.default.writeFile(u,h,"utf-8"))}return l}o(LP,"rewriteInboundWikilinks");function vQ(n,e,t){let r=n.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let a=r[s],c=EQ(a,e,t);i+=c.replacements,r[s]=c.updated}return{updated:r.join(""),replacements:i}}o(vQ,"rewriteContent");function EQ(n,e,t){let r=n.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let a=TQ(r[s],e,t);i+=a.replacements,r[s]=a.updated}return{updated:r.join(""),replacements:i}}o(EQ,"rewriteProseSegment");function TQ(n,e,t){let r=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:n.replace(r,(a,c,l)=>c.trim()!==e?a:(i+=1,`[[${t}${l}]]`)),replacements:i}}o(TQ,"replaceWikilinks");var AQ=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,kt=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{o(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return nr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await nr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await nr.default.ensureDir(Ht.default.dirname(r)),await nr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await nr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await nr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await nr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return nr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=nr.default.statSync(t);if(r.isFile())return this.createFileObject(e);if(r.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let r=Ht.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=nr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let r=await this.read(e),i=this.extractFrontmatter(r)||{},s=t(i),a=this.replaceFrontmatter(r,s);await this.modify(e,a)}async rename(e,t){let r=this.resolvePath(e.path),i=this.resolvePath(t);if(!await nr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await nr.default.ensureDir(Ht.default.dirname(i)),await nr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await nr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(AQ.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=Ht.default.dirname(this.resolvePath(t)),s;if(Ht.default.isAbsolute(r)?s=this.resolvePath(r):s=Ht.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),nr.default.existsSync(s)){let u=Ht.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let a=r.toLowerCase(),c=this.basenameIndex.get(a);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(a);return l?this.createFileObject(l):null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=Ht.default.relative(this.rootPath,e),r=Ht.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=nr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let a=s.aliases,c=Array.isArray(a)?a:typeof a=="string"?[a]:[];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 r=Ht.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(r){let i=r[1].toLowerCase(),s=Ht.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let r=await this.read(e),i=t(r);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,r){let i=Ht.default.basename(t,".md");await LP(this.rootPath,r,i,{excludeRelPath:e})}resolvePath(e){return Ht.default.isAbsolute(e)?e:Ht.default.join(this.rootPath,e)}createFileObject(e){let t=Ht.default.basename(e),r=Ht.default.basename(e,Ht.default.extname(e)),i=Ht.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:Ht.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=rr.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=rr.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
|
|
490
490
|
${r.trim()}
|
|
491
491
|
---`):`---
|
|
492
492
|
${r.trim()}
|
|
@@ -496,14 +496,14 @@ ${e}`}shouldSkipDirectory(e){return e.startsWith(".")}walkDirectory(e,t){let r;t
|
|
|
496
496
|
`)}getAllVariables(e){let t=new Set;for(let r of e)for(let i of r.variables())t.add(i);return Array.from(t).sort()}escapeValue(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
497
497
|
`)||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e}};var Ml=class{static{o(this,"TriplesFormatter")}formatNTriples(e){return e.map(t=>t.toString()).join(`
|
|
498
498
|
`)}formatTable(e){if(e.length===0)return"No triples generated.";let t=[];t.push("Subject | Predicate | Object"),t.push("------- | --------- | ------");for(let r of e){let i=this.formatNode(r.subject),s=this.formatNode(r.predicate),a=this.formatNode(r.object);t.push(`${i} | ${s} | ${a}`)}return t.join(`
|
|
499
|
-
`)}formatJson(e){let t=e.map(r=>({subject:this.nodeToJson(r.subject),predicate:this.nodeToJson(r.predicate),object:this.nodeToJson(r.object)}));return JSON.stringify(t,null,2)}formatNode(e){return e.value!==void 0?String(e.value):String(e)}nodeToJson(e){return"datatype"in e||"language"in e?{type:"literal",value:String(e.value),...e.datatype&&{datatype:e.datatype.value||String(e.datatype)},...e.language&&{language:e.language}}:"id"in e&&String(e.id).startsWith("_:")?{type:"bnode",value:String(e.id)}:{type:"uri",value:String(e.value)}}};function kP(n){return n.startsWith("VALIDATION_")?"validation":n.startsWith("PERMISSION_")?"permission":n.startsWith("STATE_")?"state":"internal"}o(kP,"getErrorCategory");var
|
|
499
|
+
`)}formatJson(e){let t=e.map(r=>({subject:this.nodeToJson(r.subject),predicate:this.nodeToJson(r.predicate),object:this.nodeToJson(r.object)}));return JSON.stringify(t,null,2)}formatNode(e){return e.value!==void 0?String(e.value):String(e)}nodeToJson(e){return"datatype"in e||"language"in e?{type:"literal",value:String(e.value),...e.datatype&&{datatype:e.datatype.value||String(e.datatype)},...e.language&&{language:e.language}}:"id"in e&&String(e.id).startsWith("_:")?{type:"bnode",value:String(e.id)}:{type:"uri",value:String(e.value)}}};function kP(n){return n.startsWith("VALIDATION_")?"validation":n.startsWith("PERMISSION_")?"permission":n.startsWith("STATE_")?"state":"internal"}o(kP,"getErrorCategory");var Oe=class{static{o(this,"ResponseBuilder")}static success(e,t){return{success:!0,data:e,...t&&{meta:t}}}static error(e,t,r,i){return{success:!1,error:{code:e,category:kP(e),message:t,exitCode:r,...i?.recovery&&{recovery:i.recovery},...i?.context&&{context:i.context},...i?.stack&&{stack:i.stack}}}}};var Jr=class extends Error{static{o(this,"CLIError")}constructor(e,t,r){super(e),this.name=this.constructor.name,this.context=t,this.recoveryHint=r,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
|
|
500
500
|
|
|
501
501
|
\u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
|
|
502
502
|
|
|
503
503
|
\u{1F4CB} Context:`;for(let[t,r]of Object.entries(this.context))e+=`
|
|
504
|
-
${t}: ${JSON.stringify(r)}`}return e}toStructuredResponse(e=!1){return
|
|
505
|
-
\u{1F4CD} Stack trace:`),console.error(e.stack));process.exit(e.exitCode)}let{exitCode:t,errorCode:r}=n.classifyError(e);if(n.outputFormat==="json"){let i=n.buildErrorResponse(r,e.message,t,n.isDebugMode()?e.stack:void 0);console.log(JSON.stringify(i,null,2))}else console.error(`\u274C Error: ${e.message}`),n.isDebugMode()&&console.error(e.stack);process.exit(t)}static handleWithMessage(e,t=1,r="INTERNAL_UNKNOWN"){if(n.outputFormat==="json"){let i=n.buildErrorResponse(r,e,t);console.log(JSON.stringify(i,null,2))}else console.error(`\u274C Error: ${e}`);process.exit(t)}static classifyError(e){let t=e.message.toLowerCase();return t.includes("transition")?{exitCode:6,errorCode:"STATE_INVALID_TRANSITION"}:t.includes("transaction")?{exitCode:7,errorCode:"INTERNAL_TRANSACTION_FAILED"}:t.includes("concurrent")||t.includes("modified")?{exitCode:8,errorCode:"STATE_CONCURRENT_MODIFICATION"}:e.message.includes("not found")||e.message.includes("ENOENT")?{exitCode:3,errorCode:"VALIDATION_FILE_NOT_FOUND"}:e.message.includes("EACCES")||e.message.includes("permission denied")?{exitCode:4,errorCode:"PERMISSION_DENIED"}:e.message.includes("Invalid")||e.message.includes("outside vault")||e.message.includes("Not a")?{exitCode:2,errorCode:"VALIDATION_INVALID_ARGUMENTS"}:{exitCode:1,errorCode:"INTERNAL_UNKNOWN"}}static buildErrorResponse(e,t,r,i){return
|
|
506
|
-
Use: exocortex command --help for usage information.`;super(t,i,{message:r||"Check command syntax and argument format",suggestion:"exocortex command --help"});this.exitCode=2;this.errorCode="VALIDATION_INVALID_ARGUMENTS";this.guidance=r||s}static{o(this,"InvalidArgumentsError")}};var
|
|
504
|
+
${t}: ${JSON.stringify(r)}`}return e}toStructuredResponse(e=!1){return Oe.error(this.errorCode,this.message,this.exitCode,{recovery:this.recoveryHint||{message:this.guidance},context:this.context,stack:e?this.stack:void 0})}formatJson(e=!1){return JSON.stringify(this.toStructuredResponse(e),null,2)}};var pe=class n{static{o(this,"ErrorHandler")}static{this.outputFormat="text"}static setFormat(e){n.outputFormat=e}static getFormat(){return n.outputFormat}static isDebugMode(){return!!process.env.DEBUG}static handle(e){if(e instanceof Jr){if(n.outputFormat==="json"){let i=e.toStructuredResponse(n.isDebugMode());console.log(JSON.stringify(i,null,2))}else console.error(e.format()),n.isDebugMode()&&(console.error(`
|
|
505
|
+
\u{1F4CD} Stack trace:`),console.error(e.stack));process.exit(e.exitCode)}let{exitCode:t,errorCode:r}=n.classifyError(e);if(n.outputFormat==="json"){let i=n.buildErrorResponse(r,e.message,t,n.isDebugMode()?e.stack:void 0);console.log(JSON.stringify(i,null,2))}else console.error(`\u274C Error: ${e.message}`),n.isDebugMode()&&console.error(e.stack);process.exit(t)}static handleWithMessage(e,t=1,r="INTERNAL_UNKNOWN"){if(n.outputFormat==="json"){let i=n.buildErrorResponse(r,e,t);console.log(JSON.stringify(i,null,2))}else console.error(`\u274C Error: ${e}`);process.exit(t)}static classifyError(e){let t=e.message.toLowerCase();return t.includes("transition")?{exitCode:6,errorCode:"STATE_INVALID_TRANSITION"}:t.includes("transaction")?{exitCode:7,errorCode:"INTERNAL_TRANSACTION_FAILED"}:t.includes("concurrent")||t.includes("modified")?{exitCode:8,errorCode:"STATE_CONCURRENT_MODIFICATION"}:e.message.includes("not found")||e.message.includes("ENOENT")?{exitCode:3,errorCode:"VALIDATION_FILE_NOT_FOUND"}:e.message.includes("EACCES")||e.message.includes("permission denied")?{exitCode:4,errorCode:"PERMISSION_DENIED"}:e.message.includes("Invalid")||e.message.includes("outside vault")||e.message.includes("Not a")?{exitCode:2,errorCode:"VALIDATION_INVALID_ARGUMENTS"}:{exitCode:1,errorCode:"INTERNAL_UNKNOWN"}}static buildErrorResponse(e,t,r,i){return Oe.error(e,t,r,{recovery:n.getRecoveryHint(e),stack:i})}static getRecoveryHint(e){switch(e){case"VALIDATION_FILE_NOT_FOUND":return{message:"Verify the file path is correct and the file exists",suggestion:"Check file path spelling and ensure the file is in the vault"};case"VALIDATION_VAULT_NOT_FOUND":return{message:"Verify the vault path is correct",suggestion:"Check --vault option or current directory"};case"VALIDATION_INVALID_ARGUMENTS":return{message:"Check command syntax and argument format",suggestion:"Use --help for usage information"};case"STATE_INVALID_TRANSITION":return{message:"The requested state transition is not allowed",suggestion:"Check the current asset state and valid transitions"};case"STATE_CONCURRENT_MODIFICATION":return{message:"File was modified by another process",suggestion:"Wait and retry the command"};case"PERMISSION_DENIED":return{message:"Check file permissions",suggestion:"Ensure you have write access to the vault"};case"INTERNAL_TRANSACTION_FAILED":return{message:"Transaction could not complete",suggestion:"Check for locked files and retry"};default:return{message:"An unexpected error occurred",suggestion:"Check the error details and retry"}}}};var Bt=class extends Jr{constructor(t,r,i){let s=`Check command syntax and argument format.
|
|
506
|
+
Use: exocortex command --help for usage information.`;super(t,i,{message:r||"Check command syntax and argument format",suggestion:"exocortex command --help"});this.exitCode=2;this.errorCode="VALIDATION_INVALID_ARGUMENTS";this.guidance=r||s}static{o(this,"InvalidArgumentsError")}};var Pe=class extends Jr{constructor(t,r){super(`Vault not found: ${t}`,{vaultPath:t,...r},{message:"Verify the vault path is correct and the directory exists",suggestion:`ls -la "${t}" or check --vault option`});this.exitCode=3;this.errorCode="VALIDATION_VAULT_NOT_FOUND";this.guidance=`The specified vault directory does not exist.
|
|
507
507
|
Check:
|
|
508
508
|
\u2022 Path spelling and case sensitivity
|
|
509
509
|
\u2022 Directory exists and is accessible
|
|
@@ -591,25 +591,25 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
591
591
|
`)}formatForJSON(e){return{type:e.type,message:e.message,originalMessage:e.originalMessage,suggestions:e.suggestions,line:e.line,column:e.column,context:e.context?{startLine:e.context.startLine,endLine:e.context.endLine,errorLine:e.context.errorLine,errorColumn:e.context.errorColumn,lines:e.context.lines.map(t=>({number:t.number,content:t.content,isError:t.isError}))}:void 0}}};var Ag=class n{static{o(this,"NTriplesFormatter")}static escapeString(e){let t=e.replace(/\\/g,"\\\\");return t=t.replace(/"/g,'\\"'),t=t.replace(/\n/g,"\\n"),t=t.replace(/\r/g,"\\r"),t=t.replace(/\t/g,"\\t"),t}static formatObject(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("urn:")?`<${e}>`:`"${n.escapeString(e)}"`}};var Yo=require("fs"),Yv=require("path");function Ya(n){let e=new Map,t="obsidian://vault/",r;try{r=(0,Yo.readdirSync)(n)}catch{return e}for(let i of r){let s=(0,Yv.join)(n,i);if(i.startsWith("."))continue;let a;try{a=(0,Yo.statSync)(s)}catch{continue}if(!a.isDirectory())continue;let c;try{c=(0,Yo.readdirSync)(s)}catch{continue}for(let l of c){let u=(0,Yv.join)(s,l);if(l.startsWith("."))continue;let f;try{f=(0,Yo.statSync)(u)}catch{continue}if(!f.isDirectory())continue;let d=!1;try{d=(0,Yo.readdirSync)(u).some(p=>p.endsWith(".md"))}catch{continue}if(d){let h=`${i}/${l}`,p=encodeURI(h),y=`${t}${p}/`;/^[a-zA-Z][a-zA-Z0-9_]*$/.test(l)&&e.set(l,y)}}}return e}o(Ya,"scanVaultNamespaces");var uF=le(fr());var wK="https://exocortex.my/ontology/",vK=/^[a-z][a-zA-Z0-9]*$/,fF=new Set(["exo","ems","ims","gtd","period","lit","inbox","rdf","rdfs","owl","xsd"]),EK=/(<)([a-zA-Z][a-zA-Z0-9]*)__([a-zA-Z][a-zA-Z0-9_]*)(>)/g;function Xa(n){let e=new Set,t=/PREFIX\s+(\w+)\s*:/gi,r;for(;(r=t.exec(n))!==null;)e.add(r[1].toLowerCase());let i=uF.SPARQL_PREFIXES.split(`
|
|
592
592
|
`).filter(f=>f.trim().length>0),s=[];for(let f of i){let d=/PREFIX\s+(\w+)\s*:/i.exec(f);d&&!e.has(d[1].toLowerCase())&&s.push(f)}let a=/(?<![:\w])([a-z][a-zA-Z0-9]*):[a-zA-Z_]/g,c=new Set,l;for(;(l=a.exec(n))!==null;)c.add(l[1]);let u=new Set(e);for(let f of s){let d=/PREFIX\s+(\w+)\s*:/i.exec(f);d&&u.add(d[1].toLowerCase())}for(let f of c)u.has(f.toLowerCase())||vK.test(f)&&(s.push(`PREFIX ${f}: <${wK}${f}#>`),u.add(f.toLowerCase()));return s.length===0?n:s.join(`
|
|
593
593
|
`)+`
|
|
594
|
-
`+n}o(Xa,"injectExocortexPrefixes");function ql(n){return n.replace(EK,(e,t,r,i,s)=>fF.has(r.toLowerCase())?`${r}:${i}`:e)}o(ql,"transformShorthandNotation");function Ja(n){let e=new Map(n);for(let t of fF)e.delete(t);return e}o(Ja,"filterOntologyPrefixes");var TK=300,dF=3e4,AK="EXOCORTEX_SPARQL_TIMEOUT";function xK(){let n=process.env[AK];if(!n)return dF;try{let e=IK(n);if(e!==null&&e>0)return e}catch{}return dF}o(xK,"getDefaultTimeout");function IK(n){let e=n.trim().toLowerCase();if(!e)return null;if(e.endsWith("ms")){let r=parseInt(e.slice(0,-2),10);return isNaN(r)||r<=0?null:r}if(e.endsWith("s")){let r=parseInt(e.slice(0,-1),10);return isNaN(r)||r<=0?null:r*1e3}let t=parseInt(e,10);return isNaN(t)||t<=0?null:t*1e3}o(IK,"parseTimeoutSafe");function CK(n){if(!n)return TK;let e=parseInt(n.trim(),10);if(isNaN(e)||e<=0)throw new Bt(`Invalid cache TTL: "${n}". Must be a positive number (seconds).`,'exocortex sparql query --cache-ttl 600 "SELECT * WHERE { ?s ?p ?o }"');return e}o(CK,"parseCacheTtl");function RK(n){let e=n.trim().toLowerCase();if(e.endsWith("ms")){let r=parseInt(e.slice(0,-2),10);if(isNaN(r)||r<=0)throw new Bt(`Invalid timeout format: "${n}". Value must be a positive number.`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return r}if(e.endsWith("s")){let r=parseInt(e.slice(0,-1),10);if(isNaN(r)||r<=0)throw new Bt(`Invalid timeout format: "${n}". Value must be a positive number.`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return r*1e3}let t=parseInt(e,10);if(isNaN(t)||t<=0)throw new Bt(`Invalid timeout format: "${n}". Use formats like "30s", "5000ms", or just a number (seconds).`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return t*1e3}o(RK,"parseTimeout");async function Xv(n,e,t=Date.now()){let r,i=new Promise((s,a)=>{r=setTimeout(()=>{let c=Date.now()-t;a(new jf(e,c))},e),r&&typeof r=="object"&&"unref"in r&&r.unref()});return Promise.race([n,i])}o(Xv,"executeWithTimeout");function OK(n,e){return e.concat([n])}o(OK,"collectAlso");function pF(){return new Ie("query").description("Execute SPARQL query against Obsidian vault").argument("[query]","SPARQL query string or path to .sparql file (optional if --template is used)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to include in query (repeatable)",OK,[]).option("--format <type>","Output format: table|json|csv|ntriples","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--timeout <duration>","Query timeout (e.g., 30s, 5000ms)","30s").option("--dry-run","Validate query syntax without executing (no vault loading)").option("--explain","Show optimized query plan").option("--stats","Show execution statistics").option("--no-optimize","Disable query optimization").option("--use-cache","Use persistent triple cache (faster vault loading)").option("--cache-ttl <seconds>","Query result cache TTL in seconds (default: 300)").option("--no-cache","Bypass query result cache").option("--template <name>","Use a predefined query template").option("--param <params>","Template parameters (format: key=value,key2=value2)").action(async(n,e)=>{let t=e.output||"text";pe.setFormat(t);let r="";try{let i=Date.now(),s=e.timeout?RK(e.timeout):xK(),a=CK(e.cacheTtl),c=e.cache!==!1;if(e.template){let B=new Eg,
|
|
595
|
-
`);let D=
|
|
594
|
+
`+n}o(Xa,"injectExocortexPrefixes");function ql(n){return n.replace(EK,(e,t,r,i,s)=>fF.has(r.toLowerCase())?`${r}:${i}`:e)}o(ql,"transformShorthandNotation");function Ja(n){let e=new Map(n);for(let t of fF)e.delete(t);return e}o(Ja,"filterOntologyPrefixes");var TK=300,dF=3e4,AK="EXOCORTEX_SPARQL_TIMEOUT";function xK(){let n=process.env[AK];if(!n)return dF;try{let e=IK(n);if(e!==null&&e>0)return e}catch{}return dF}o(xK,"getDefaultTimeout");function IK(n){let e=n.trim().toLowerCase();if(!e)return null;if(e.endsWith("ms")){let r=parseInt(e.slice(0,-2),10);return isNaN(r)||r<=0?null:r}if(e.endsWith("s")){let r=parseInt(e.slice(0,-1),10);return isNaN(r)||r<=0?null:r*1e3}let t=parseInt(e,10);return isNaN(t)||t<=0?null:t*1e3}o(IK,"parseTimeoutSafe");function CK(n){if(!n)return TK;let e=parseInt(n.trim(),10);if(isNaN(e)||e<=0)throw new Bt(`Invalid cache TTL: "${n}". Must be a positive number (seconds).`,'exocortex sparql query --cache-ttl 600 "SELECT * WHERE { ?s ?p ?o }"');return e}o(CK,"parseCacheTtl");function RK(n){let e=n.trim().toLowerCase();if(e.endsWith("ms")){let r=parseInt(e.slice(0,-2),10);if(isNaN(r)||r<=0)throw new Bt(`Invalid timeout format: "${n}". Value must be a positive number.`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return r}if(e.endsWith("s")){let r=parseInt(e.slice(0,-1),10);if(isNaN(r)||r<=0)throw new Bt(`Invalid timeout format: "${n}". Value must be a positive number.`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return r*1e3}let t=parseInt(e,10);if(isNaN(t)||t<=0)throw new Bt(`Invalid timeout format: "${n}". Use formats like "30s", "5000ms", or just a number (seconds).`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return t*1e3}o(RK,"parseTimeout");async function Xv(n,e,t=Date.now()){let r,i=new Promise((s,a)=>{r=setTimeout(()=>{let c=Date.now()-t;a(new jf(e,c))},e),r&&typeof r=="object"&&"unref"in r&&r.unref()});return Promise.race([n,i])}o(Xv,"executeWithTimeout");function OK(n,e){return e.concat([n])}o(OK,"collectAlso");function pF(){return new Ie("query").description("Execute SPARQL query against Obsidian vault").argument("[query]","SPARQL query string or path to .sparql file (optional if --template is used)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to include in query (repeatable)",OK,[]).option("--format <type>","Output format: table|json|csv|ntriples","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--timeout <duration>","Query timeout (e.g., 30s, 5000ms)","30s").option("--dry-run","Validate query syntax without executing (no vault loading)").option("--explain","Show optimized query plan").option("--stats","Show execution statistics").option("--no-optimize","Disable query optimization").option("--use-cache","Use persistent triple cache (faster vault loading)").option("--cache-ttl <seconds>","Query result cache TTL in seconds (default: 300)").option("--no-cache","Bypass query result cache").option("--template <name>","Use a predefined query template").option("--param <params>","Template parameters (format: key=value,key2=value2)").action(async(n,e)=>{let t=e.output||"text";pe.setFormat(t);let r="";try{let i=Date.now(),s=e.timeout?RK(e.timeout):xK(),a=CK(e.cacheTtl),c=e.cache!==!1;if(e.template){let B=new Eg,G=e.param?B.parseParamString(e.param):{};if(r=B.applyTemplate(e.template,G),t==="text"){let F=B.getTemplate(e.template);console.log(`\u{1F4CB} Using template: ${e.template}`),Object.keys(G).length>0&&console.log(` Parameters: ${Object.entries(G).map(([D,W])=>`${D}=${W}`).join(", ")}`),console.log()}}else if(n)r=PK(n);else throw new Bt("Either a query argument or --template flag is required.",'exocortex sparql query "SELECT * WHERE { ?s ?p ?o }" or exocortex sparql query --template tasks-by-date --param date=2024-01-15');if(e.dryRun){await FK(r,e,t);return}let l=(0,Hf.resolve)(e.vault);if(c){let G=await new $l().get(r,a);if(G!==null){let F=Date.now()-i;if(t==="json"){let D=Oe.success(G,{durationMs:F,itemCount:G.count||0,queryResultCacheHit:!0});console.log(JSON.stringify(D,null,2))}else{console.log(`\u{1F4E6} (cached) Query result loaded from cache in ${F}ms
|
|
595
|
+
`);let D=G;D.type==="select"&&D.bindings?(console.log(`\u2705 Found ${D.bindings.length} result(s)
|
|
596
596
|
`),LK(D.bindings,e.format)):D.type==="construct"&&D.triples&&(console.log(`\u2705 Generated ${D.triples.length} triple(s)
|
|
597
|
-
`),kK(D.triples,e.format))}return}}if(!(0,Wl.existsSync)(l))throw new
|
|
598
|
-
`),console.log("\u{1F50D} Parsing SPARQL query...")}let S=new Ut.ExoQLParser;r=ql(r),r=Xa(r);let v=Ja(Ya(l));for(let B of h){let
|
|
599
|
-
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${D}ms`),console.log(` Total time: ${
|
|
597
|
+
`),kK(D.triples,e.format))}return}}if(!(0,Wl.existsSync)(l))throw new Pe(l);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${l}...`);let u=Date.now(),f,d=!1;if(e.useCache){let G=await new oi(l).loadOrBuild();f=G.triples,d=G.cacheHit,t==="text"&&d&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let B=new kt(l);f=await new Ut.NoteToRDFConverter(B).convertVault()}let h=e.also||[];for(let B of h){let G=(0,Hf.resolve)(B);if(!(0,Wl.existsSync)(G))throw new Pe(G);t==="text"&&console.log(`\u{1F4E6} Loading additional vault: ${G}...`);let F=new kt(G),W=await new Ut.NoteToRDFConverter(F).convertVault();f=f.concat(W),t==="text"&&console.log(` \u2795 Added ${W.length} triples from ${G}`)}let p=new Ut.InMemoryTripleStore;await p.addAll(f);let y=Date.now()-u;if(t==="text"){let B=d?" (from cache)":"",G=h.length>0?` (${h.length+1} vaults)`:"";console.log(`\u2705 Loaded ${f.length} triples in ${y}ms${B}${G}
|
|
598
|
+
`),console.log("\u{1F50D} Parsing SPARQL query...")}let S=new Ut.ExoQLParser;r=ql(r),r=Xa(r);let v=Ja(Ya(l));for(let B of h){let G=Ja(Ya((0,Hf.resolve)(B)));for(let[F,D]of G)v.has(F)||v.set(F,D)}v.size>0&&S.setVaultPrefixes(v);let w=S.parse(r);if(w.type==="update"){t==="text"&&console.log("\u{1F504} Executing SPARQL UPDATE...");let B=Date.now(),G=new Ut.UpdateExecutor(p),F=await Xv(G.execute(w),s,B),D=Date.now()-B,W=Date.now()-i;if(t==="json"){let De=Oe.success({query:r,type:"update",results:F},{durationMs:W,itemCount:F.length,loadDurationMs:y,execDurationMs:D,triplesScanned:f.length,cacheHit:d});console.log(JSON.stringify(De,null,2))}else MK(F,e.format),console.log(),console.log("\u26A0\uFE0F Changes applied to in-memory store only (not persisted to vault files)"),e.stats&&(console.log(`
|
|
599
|
+
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${D}ms`),console.log(` Total time: ${W}ms`),console.log(` Triples scanned: ${f.length}`));return}t==="text"&&console.log("\u{1F504} Translating to algebra...");let C=new Ut.ExoQLAlgebraTranslator().translate(w);if(!e.noOptimize&&C.type!=="construct")C=new Ut.AlgebraOptimizer().optimize(C);else if(!e.noOptimize&&C.type==="construct"){let B=new Ut.AlgebraOptimizer,G=C;C={...G,where:B.optimize(G.where)}}if(e.explain&&t==="text"){console.log("\u{1F4CA} Query Plan:");let B=new Ut.AlgebraSerializer;if(C.type==="construct"){let G=C;console.log("CONSTRUCT Template:"),console.log(" (template patterns)"),console.log("WHERE:"),console.log(B.toString(G.where))}else console.log(B.toString(C));console.log()}let L=Date.now(),$=new Ut.ExoQLQueryExecutor(p);typeof $.setTimeout=="function"&&$.setTimeout(s);let ee=t==="text"?new Sg("Executing query",{delayMs:2e3}):null;if($.isConstructQuery(C)){ee?.start();let B=await Xv($.executeConstruct(C),s,L),G=Date.now()-L;ee?.stop();let F=Date.now()-i;if(c){let D=new Ml,W={type:"construct",count:B.length,triples:JSON.parse(D.formatJson(B))};await new $l().set(r,W,a)}if(t==="json"){let D=new Ml,W={query:r,count:B.length,triples:JSON.parse(D.formatJson(B))},De=Oe.success(W,{durationMs:F,itemCount:B.length,loadDurationMs:y,execDurationMs:G,triplesScanned:f.length,cacheHit:d,queryResultCacheHit:!1});console.log(JSON.stringify(De,null,2))}else console.log(`\u2705 Generated ${B.length} triple(s) in ${G}ms
|
|
600
600
|
`),B.length>0?NK(B,e.format):console.log("No triples generated."),e.stats&&(console.log(`
|
|
601
|
-
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${
|
|
601
|
+
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${G}ms`),console.log(` Total time: ${F}ms`),console.log(` Triples scanned: ${f.length}`),console.log(` Triples generated: ${B.length}`),e.useCache&&console.log(` Triple cache: ${d?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}else{ee?.start();let B=await Xv($.executeAll(C),s,L),G=Date.now()-L;ee?.stop();let F=Date.now()-i,D=B.map(W=>W.toJSON());if(c){let W={type:"select",count:B.length,bindings:D};await new $l().set(r,W,a)}if(t==="json"){let W={query:r,count:B.length,bindings:D},De=Oe.success(W,{durationMs:F,itemCount:B.length,loadDurationMs:y,execDurationMs:G,triplesScanned:f.length,cacheHit:d,queryResultCacheHit:!1});console.log(JSON.stringify(De,null,2))}else console.log(`\u2705 Found ${B.length} result(s) in ${G}ms
|
|
602
602
|
`),B.length>0?DK(B,e.format):console.log("No results found."),e.stats&&(console.log(`
|
|
603
|
-
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${
|
|
604
|
-
`),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new Ut.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new Ut.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new Ut.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new Ut.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=
|
|
603
|
+
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${G}ms`),console.log(` Total time: ${F}ms`),console.log(` Triples scanned: ${f.length}`),console.log(` Results returned: ${B.length}`),e.useCache&&console.log(` Triple cache: ${d?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}}catch(i){mF(i,r,t)}})}o(pF,"sparqlQueryCommand");function mF(n,e,t){let r=new Tg;if(r.classifyError(n)!=="unknown"){let s=r.enhanceError(n,e);if(t==="json"){let a=Oe.error("VALIDATION_INVALID_FORMAT",s.message,2,{context:{errorType:s.type,suggestions:s.suggestions,line:s.line,column:s.column,queryContext:s.context?{startLine:s.context.startLine,endLine:s.context.endLine,errorLine:s.context.errorLine}:void 0},recovery:{message:s.suggestions?.[0]||"Check query syntax"}});console.log(JSON.stringify(a,null,2)),process.exit(2)}else console.error(r.formatForText(s)),process.exit(2)}pe.handle(n)}o(mF,"handleSparqlError");function PK(n){if(n.includes("SELECT")||n.includes("CONSTRUCT")||n.includes("INSERT")||n.includes("DELETE"))return n;let e=(0,Hf.resolve)(n);return(0,Wl.existsSync)(e)?(0,Wl.readFileSync)(e,"utf-8"):n}o(PK,"loadQuery");async function FK(n,e,t){if(e.explain){let i=new wg,s=await i.analyze(n,{includeAlgebraPlan:!0,optimize:!e.noOptimize});if(t==="json"){let a=Oe.success(s);console.log(JSON.stringify(a,null,2))}else s.valid?(console.log(`\u2705 Query syntax is valid
|
|
604
|
+
`),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new Ut.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new Ut.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new Ut.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new Ut.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=Oe.success({valid:!0,queryType:hF(i),message:"Query syntax is valid"});console.log(JSON.stringify(s,null,2))}else console.log("\u2705 Query syntax is valid"),console.log(` Query type: ${hF(i)}`)}catch(i){mF(i,n,t)}}o(FK,"executeDryRun");function hF(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}o(hF,"getQueryType");function DK(n,e){switch(e){case"json":let t=new jl;console.log(t.format(n));break;case"csv":let r=new fg;console.log(r.format(n));break;case"table":default:let i=new kl;console.log(i.format(n));break}}o(DK,"formatSelectResults");function NK(n,e){let t=new Ml;switch(e){case"json":console.log(t.formatJson(n));break;case"ntriples":console.log(t.formatNTriples(n));break;case"table":default:console.log(t.formatTable(n));break}}o(NK,"formatConstructResults");function LK(n,e){switch(e){case"json":console.log(JSON.stringify(n,null,2));break;case"csv":if(n.length===0){console.log("");return}let t=Object.keys(n[0]);console.log(t.join(","));for(let i of n){let s=t.map(a=>{let c=i[a];return c==null?"":String(c).includes(",")?`"${c}"`:String(c)});console.log(s.join(","))}break;case"table":default:if(n.length===0){console.log("No results.");return}let r=Object.keys(n[0]);console.log(r.join(" ")),console.log(r.map(()=>"---").join(" "));for(let i of n){let s=r.map(a=>String(i[a]??""));console.log(s.join(" "))}break}}o(LK,"formatCachedSelectResults");function kK(n,e){switch(e){case"json":console.log(JSON.stringify(n,null,2));break;case"ntriples":for(let t of n)console.log(`<${t.subject}> <${t.predicate}> ${jK(t.object)} .`);break;case"table":default:console.log("Subject Predicate Object"),console.log("--- --- ---");for(let t of n)console.log(`${t.subject} ${t.predicate} ${t.object}`);break}}o(kK,"formatCachedConstructResults");function jK(n){return Ag.formatObject(n)}o(jK,"formatNTriplesObject");function MK(n,e){for(let t of n){let r=[`${t.type.toUpperCase()}`];switch(t.inserted!==void 0&&r.push(`inserted: ${t.inserted}`),t.deleted!==void 0&&r.push(`deleted: ${t.deleted}`),r.push(t.success?"OK":"FAILED"),e){case"json":console.log(JSON.stringify(t,null,2));break;case"csv":n.indexOf(t)===0&&console.log("type,inserted,deleted,success"),console.log(`${t.type},${t.inserted??""},${t.deleted??""},${t.success}`);break;case"table":default:console.log(`\u2705 ${r.join(" | ")}`);break}}}o(MK,"formatUpdateResults");var gF=require("fs"),yF=require("path"),Ts=le(fr());function _F(){return new Ie("index").description("Build or refresh the triple cache for faster SPARQL queries").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--stats","Show cache statistics after building").option("--force","Force rebuild even if cache is valid").option("--strict","Fail on first invalid IRI instead of skipping").option("--no-inference","Disable RDFS subClassOf inference materialization").action(async n=>{let e=n.output||"text";pe.setFormat(e);try{let t=(0,yF.resolve)(n.vault);if(!(0,gF.existsSync)(t))throw new Pe(t);let r=new oi(t),i=r.getCachePath();n.force&&(e==="text"&&console.log("\u{1F5D1}\uFE0F Invalidating existing cache..."),await r.invalidate()),e==="text"&&console.log(`\u{1F4E6} Building triple cache for: ${t}...`);let s=Date.now(),a=await r.buildCacheWithValidation({strict:n.strict??!1}),c=0;if(n.inference!==!1){let{triples:u}=await r.loadOrBuild(),f=new Ts.InMemoryTripleStore;await f.addAll(u),c=await new Ts.RDFSInferenceEngine().materialize(f);let h=new Ts.NonInheritablePropertyRegistry;await h.initialize(f);let p=new Ts.PropertyCardinalityRegistry;await p.initialize(f);let S=await new Ts.PrototypeChainMaterializer(h,p).materialize(f);if(c+=S,c>0){let v=await f.match();await r.saveTriples(v),a.tripleCount+=c}e==="text"&&c>0&&console.log(`\u{1F9E0} Materialized ${c} inferred triples (RDFS + prototype chain)`)}let l=Date.now()-s;if(e==="json"){let u={action:"build",cachePath:i,tripleCount:a.tripleCount,durationMs:a.durationMs},f={summary:a.summary,skippedFiles:a.skippedFiles};if(n.stats){let d=await r.getCacheStats();if(d){let h={tripleCount:d.tripleCount,createdAt:d.createdAt.toISOString(),isValid:d.isValid,sizeBytes:d.sizeBytes,cachePath:i},p=Oe.success({cache:u,stats:h,validation:f},{durationMs:l});console.log(JSON.stringify(p,null,2))}}else{let d=Oe.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(d,null,2))}}else{if(a.skippedFiles.length>0){console.log(`
|
|
605
605
|
\u26A0\uFE0F Files skipped due to IRI issues:`);for(let u of a.skippedFiles)console.log(` - ${u.path}`),console.log(` ${u.reason}`);console.log("")}if(console.log(`\u2705 Indexed ${a.summary.indexed} files, skipped ${a.summary.skipped} (total: ${a.summary.total})`),console.log(`\u{1F4CA} Created cache with ${a.tripleCount.toLocaleString()} triples at ${i}`),console.log(`\u23F1\uFE0F Build time: ${a.durationMs}ms`),n.stats){let u=await r.getCacheStats();u&&(console.log(`
|
|
606
|
-
\u{1F4CA} Cache Statistics:`),console.log(` Triples: ${u.tripleCount.toLocaleString()}`),console.log(` Created: ${u.createdAt.toISOString()}`),console.log(` Valid: ${u.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${$K(u.sizeBytes)}`))}}}catch(t){pe.handle(t)}})}o(_F,"sparqlIndexCommand");function $K(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o($K,"formatBytes");var SF=require("path");var da=le(require("fs")),Jv=le(require("path")),bF=require("events");var VK={watch:da.default.watch.bind(da.default),existsSync:da.default.existsSync.bind(da.default),statSync:da.default.statSync.bind(da.default),readFileSync:da.default.readFileSync.bind(da.default)},xg=class extends bF.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=Jv.default.resolve(t),this.fsAdapter=r.fsAdapter??VK,this.options={pattern:r.pattern??"**/*.md",assetType:r.assetType??"",debounceMs:r.debounceMs??100,recursive:r.recursive??!0}}static{o(this,"FileSystemWatcher")}start(){this.isRunning||(this.watcher=this.fsAdapter.watch(this.vaultPath,{recursive:this.options.recursive},(t,r)=>{r&&this.handleFileEvent(t,r.toString())}),this.watcher.on("error",t=>{this.emit("error",t)}),this.isRunning=!0,this.emit("started"))}stop(){if(this.isRunning){for(let t of this.debounceTimers.values())clearTimeout(t);this.debounceTimers.clear(),this.watcher&&(this.watcher.close(),this.watcher=null),this.isRunning=!1,this.emit("stopped")}}isWatching(){return this.isRunning}handleFileEvent(t,r){let i=Jv.default.join(this.vaultPath,r),s=r;if(!this.matchesPattern(s))return;let a=this.debounceTimers.get(i);a&&clearTimeout(a);let c=setTimeout(()=>{this.debounceTimers.delete(i),this.processFileEvent(i,s)},this.options.debounceMs);this.debounceTimers.set(i,c)}processFileEvent(t,r){let i=this.fsAdapter.existsSync(t),s;if(!i)s="delete";else{let l=this.fsAdapter.statSync(t);s=Date.now()-l.birthtimeMs<1e3?"create":"modify"}let a;if(i&&t.endsWith(".md")&&(a=this.extractAssetType(t)),this.options.assetType&&a!==this.options.assetType)return;let c={type:s,path:t,relativePath:r,timestamp:new Date().toISOString(),assetType:a};this.emit("change",c)}matchesPattern(t){return this.options.pattern?Mr(t,this.options.pattern):!0}extractAssetType(t){try{let i=this.fsAdapter.readFileSync(t,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(!i)return;let a=i[1].match(/exo__Instance_class:\s*(?:\[?"?\[\[([^\]]+)\]\]"?\]?|"?\[\[([^\]]+)\]\]"?)/);return a?a[1]||a[2]:void 0}catch{return}}};var Zv=le(require("fs"));function wF(){return new Ie("watch").description("Watch vault for file changes and emit NDJSON events").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--pattern <glob>","Glob pattern to filter files (e.g., '*.md', 'tasks/**')").option("--asset-type <type>","Filter by asset type (e.g., 'ems__Task', 'ems__Project')").option("--debounce <ms>","Debounce interval in milliseconds","100").action(async n=>{pe.setFormat("json");try{let e=(0,SF.resolve)(n.vault);if(!Zv.default.existsSync(e))throw new
|
|
606
|
+
\u{1F4CA} Cache Statistics:`),console.log(` Triples: ${u.tripleCount.toLocaleString()}`),console.log(` Created: ${u.createdAt.toISOString()}`),console.log(` Valid: ${u.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${$K(u.sizeBytes)}`))}}}catch(t){pe.handle(t)}})}o(_F,"sparqlIndexCommand");function $K(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o($K,"formatBytes");var SF=require("path");var da=le(require("fs")),Jv=le(require("path")),bF=require("events");var VK={watch:da.default.watch.bind(da.default),existsSync:da.default.existsSync.bind(da.default),statSync:da.default.statSync.bind(da.default),readFileSync:da.default.readFileSync.bind(da.default)},xg=class extends bF.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=Jv.default.resolve(t),this.fsAdapter=r.fsAdapter??VK,this.options={pattern:r.pattern??"**/*.md",assetType:r.assetType??"",debounceMs:r.debounceMs??100,recursive:r.recursive??!0}}static{o(this,"FileSystemWatcher")}start(){this.isRunning||(this.watcher=this.fsAdapter.watch(this.vaultPath,{recursive:this.options.recursive},(t,r)=>{r&&this.handleFileEvent(t,r.toString())}),this.watcher.on("error",t=>{this.emit("error",t)}),this.isRunning=!0,this.emit("started"))}stop(){if(this.isRunning){for(let t of this.debounceTimers.values())clearTimeout(t);this.debounceTimers.clear(),this.watcher&&(this.watcher.close(),this.watcher=null),this.isRunning=!1,this.emit("stopped")}}isWatching(){return this.isRunning}handleFileEvent(t,r){let i=Jv.default.join(this.vaultPath,r),s=r;if(!this.matchesPattern(s))return;let a=this.debounceTimers.get(i);a&&clearTimeout(a);let c=setTimeout(()=>{this.debounceTimers.delete(i),this.processFileEvent(i,s)},this.options.debounceMs);this.debounceTimers.set(i,c)}processFileEvent(t,r){let i=this.fsAdapter.existsSync(t),s;if(!i)s="delete";else{let l=this.fsAdapter.statSync(t);s=Date.now()-l.birthtimeMs<1e3?"create":"modify"}let a;if(i&&t.endsWith(".md")&&(a=this.extractAssetType(t)),this.options.assetType&&a!==this.options.assetType)return;let c={type:s,path:t,relativePath:r,timestamp:new Date().toISOString(),assetType:a};this.emit("change",c)}matchesPattern(t){return this.options.pattern?Mr(t,this.options.pattern):!0}extractAssetType(t){try{let i=this.fsAdapter.readFileSync(t,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(!i)return;let a=i[1].match(/exo__Instance_class:\s*(?:\[?"?\[\[([^\]]+)\]\]"?\]?|"?\[\[([^\]]+)\]\]"?)/);return a?a[1]||a[2]:void 0}catch{return}}};var Zv=le(require("fs"));function wF(){return new Ie("watch").description("Watch vault for file changes and emit NDJSON events").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--pattern <glob>","Glob pattern to filter files (e.g., '*.md', 'tasks/**')").option("--asset-type <type>","Filter by asset type (e.g., 'ems__Task', 'ems__Project')").option("--debounce <ms>","Debounce interval in milliseconds","100").action(async n=>{pe.setFormat("json");try{let e=(0,SF.resolve)(n.vault);if(!Zv.default.existsSync(e))throw new Pe(e);if(!Zv.default.statSync(e).isDirectory())throw new Bt(`Vault path is not a directory: ${e}`,"Provide a path to a directory, not a file",{vaultPath:e});let t=parseInt(n.debounce?.toString()??"100",10);if(isNaN(t)||t<0)throw new Bt("--debounce must be a non-negative integer","Use a positive integer value for debounce",{debounce:n.debounce});let r=new xg(e,{pattern:n.pattern,assetType:n.assetType,debounceMs:t});r.on("change",s=>{console.log(JSON.stringify(s))}),r.on("error",s=>{let a=Oe.error("INTERNAL_OPERATION_FAILED",s.message,5,{recovery:{message:"Check file permissions and vault access",suggestion:"Ensure the vault directory is accessible"}});console.log(JSON.stringify(a))});let i=o(()=>{r.stop(),process.exit(0)},"shutdown");process.on("SIGINT",i),process.on("SIGTERM",i),console.error(`Watching vault: ${e}`),n.pattern&&console.error(` Pattern filter: ${n.pattern}`),n.assetType&&console.error(` Asset type filter: ${n.assetType}`),console.error(` Debounce: ${t}ms`),console.error("Press Ctrl+C to stop"),r.start()}catch(e){pe.handle(e)}})}o(wF,"watchCommand");var Ig=require("fs"),Gi=require("path");function vF(){return new Ie("resolve").description("Resolve UUID to file path").argument("<uuid>","Full or partial UUID to resolve").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: uri|path|json (default: uri)","uri").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--partial","Match partial UUIDs (returns all matches)").action(async(n,e)=>{let t=e.output||"text";pe.setFormat(t);try{let r=Date.now();if(!BK(n))throw new Bt(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,Gi.resolve)(e.vault);if(!(0,Ig.existsSync)(i))throw new Pe(i);let s=UK(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=Oe.error("VALIDATION_FILE_NOT_FOUND",`UUID not found: ${n}`,3,{context:{uuid:n}});console.log(JSON.stringify(c,null,2))}else console.error(`UUID not found: ${n}`);process.exit(1)}e.partial||s.length>1?WK(s,i,e.format,t,n,a):qK(s[0],i,e.format,t,n,a)}catch(r){pe.handle(r)}})}o(vF,"resolveCommand");function BK(n){if(n.length<4)return!1;let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,t=/^[0-9a-f-]+$/i;return e.test(n)||t.test(n)}o(BK,"isValidUuidFormat");function UK(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,Ig.readdirSync)(a,{withFileTypes:!0});for(let l of c){let u=(0,Gi.join)(a,l.name);if(l.isDirectory())!l.name.startsWith(".")&&l.name!=="node_modules"&&s(u);else if(l.isFile()&&l.name.endsWith(".md")){let f=l.name.toLowerCase();t?f.includes(i)&&r.push(u):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&r.push(u)}}}return o(s,"walk"),s(n),r}o(UK,"findFilesWithUuid");function EF(n){return`obsidian://vault/${encodeURI(n)}`}o(EF,"pathToObsidianUri");function TF(n){let e=n.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);return e?e[1]:(0,Gi.basename)(n,".md")}o(TF,"extractUuidFromFilename");function qK(n,e,t,r,i,s){let a=(0,Gi.relative)(e,n),c=EF(a),l=TF((0,Gi.basename)(n));if(r==="json"){let u={uuid:l,path:a,absolutePath:n,uri:c},f=Oe.success(u,{durationMs:s,searchUuid:i});console.log(JSON.stringify(f,null,2))}else switch(t){case"path":console.log(n);break;case"json":console.log(JSON.stringify({uuid:l,path:a,absolutePath:n,uri:c},null,2));break;case"uri":default:console.log(c);break}}o(qK,"outputSingleResult");function WK(n,e,t,r,i,s){let a=n.map(c=>{let l=(0,Gi.relative)(e,c),u=EF(l);return{uuid:TF((0,Gi.basename)(c)),path:l,absolutePath:c,uri:u}});if(r==="json"){let c=Oe.success({matches:a,count:a.length},{durationMs:s,searchUuid:i,itemCount:a.length});console.log(JSON.stringify(c,null,2))}else switch(t){case"path":for(let c of a)console.log(c.absolutePath);break;case"json":console.log(JSON.stringify(a,null,2));break;case"uri":default:for(let c of a)console.log(c.uri);break}}o(WK,"outputMultipleResults");var AF=require("fs"),xF=require("path"),Nn=le(fr());function IF(){return new Ie("ask").description("Ask a question in natural language about your vault").argument("<question>","Question in natural language (Russian or English)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--show-query","Show the generated SPARQL query").option("--explain","Show explanation of the query conversion").action(async(n,e)=>{let t=e.output||"text";pe.setFormat(t);try{let r=Date.now(),i=(0,xF.resolve)(e.vault);if(!(0,AF.existsSync)(i))throw new Pe(i);let s=new Nn.NLToSPARQLService;t==="text"&&console.log(`\u{1F9E0} Analyzing question: "${n}"
|
|
607
607
|
`);let a=s.convert(n);e.showQuery&&t==="text"&&(console.log("\u{1F4DD} Generated SPARQL Query:"),console.log("\u2500".repeat(50)),console.log(a.query),console.log("\u2500".repeat(50)),console.log()),e.explain&&t==="text"&&(console.log(`\u{1F4D6} Explanation: ${a.explanation}`),console.log(`\u{1F3AF} Confidence: ${(a.confidence*100).toFixed(0)}%`),a.templateName&&console.log(`\u{1F4CB} Template: ${a.templateName}`),a.isFallback&&console.log("\u26A0\uFE0F Using fallback generic search query"),console.log()),t==="text"&&console.log(`\u{1F4E6} Loading vault: ${i}...`);let c=Date.now(),l=new kt(i),f=await new Nn.NoteToRDFConverter(l).convertVault(),d=new Nn.InMemoryTripleStore;await d.addAll(f);let h=Date.now()-c;t==="text"&&console.log(`\u2705 Loaded ${f.length} triples in ${h}ms
|
|
608
|
-
`);let p=a.query;p=ql(p),p=Xa(p);let y=new Nn.ExoQLParser,S=Ja(Ya(i));S.size>0&&y.setVaultPrefixes(S);let v=y.parse(p),T=new Nn.ExoQLAlgebraTranslator().translate(v);T=new Nn.AlgebraOptimizer().optimize(T);let L=Date.now(),ee=await new Nn.ExoQLQueryExecutor(d).executeAll(T),B=Date.now()-L,
|
|
608
|
+
`);let p=a.query;p=ql(p),p=Xa(p);let y=new Nn.ExoQLParser,S=Ja(Ya(i));S.size>0&&y.setVaultPrefixes(S);let v=y.parse(p),T=new Nn.ExoQLAlgebraTranslator().translate(v);T=new Nn.AlgebraOptimizer().optimize(T);let L=Date.now(),ee=await new Nn.ExoQLQueryExecutor(d).executeAll(T),B=Date.now()-L,G=Date.now()-r,F=s.getSuggestions(n);if(t==="json"){let D=ee.map(et=>et.toJSON()),W={question:n,query:a.query,template:a.templateName,parameters:a.parameters,confidence:a.confidence,explanation:a.explanation,count:ee.length,bindings:D,suggestions:F.length>0?F:void 0},De=Oe.success(W,{durationMs:G,itemCount:ee.length,loadDurationMs:h,execDurationMs:B,triplesScanned:f.length});console.log(JSON.stringify(De,null,2))}else{if(console.log(`\u2705 Found ${ee.length} result(s) in ${B}ms
|
|
609
609
|
`),ee.length>0?GK(ee,e.format):console.log("No results found."),F.length>0){console.log(`
|
|
610
610
|
\u{1F4A1} Suggestions:`);for(let D of F)console.log(` \u2022 ${D}`)}if(a.confidence<.6&&a.alternatives.length>0){console.log(`
|
|
611
611
|
\u{1F504} Alternative queries that might work better:`);for(let D=0;D<Math.min(2,a.alternatives.length);D++)console.log(` ${D+1}. ${a.alternatives[D].split(`
|
|
612
|
-
`).slice(-3)[0]?.trim()||"..."}`)}}}catch(r){pe.handle(r)}})}o(IF,"askCommand");function GK(n,e){let t=n;switch(e){case"json":let r=new jl;console.log(r.format(t));break;case"table":default:let i=new kl;console.log(i.format(t));break}}o(GK,"formatResults");var BF=require("fs"),UF=require("path");var li=require("fs"),Ln=require("path"),RF=require("child_process"),Ae=le(fr());var zK=new Set(["aliases","archived","tags","cssclasses","publish","permalink","description","image","cover","banner","title","share","share_link","share_updated","metadata","uri"]),t2=new Map([["exo__","https://exocortex.my/ontology/exo#"],["ems__","https://exocortex.my/ontology/ems#"],["exocmd__","https://exocortex.my/ontology/exocmd#"],["ims__","https://exocortex.my/ontology/ims#"],["ztlk__","https://exocortex.my/ontology/ztlk#"],["ptms__","https://exocortex.my/ontology/ptms#"],["lit__","https://exocortex.my/ontology/lit#"],["inbox__","https://exocortex.my/ontology/inbox#"],["place__","https://exocortex.my/ontology/place#"],["exoob__","https://exocortex.my/ontology/exoob#"],["pn__","https://exocortex.my/ontology/pn#"],["period__","https://exocortex.my/ontology/period#"],["rdf__","http://www.w3.org/1999/02/22-rdf-syntax-ns#"],["rdfs__","http://www.w3.org/2000/01/rdf-schema#"],["owl__","http://www.w3.org/2002/07/owl#"]]);function HK(n,e){if(!n)return!1;let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/),a=s?s[1]:i;if(a===e||a.includes(e))return!0}return!1}o(HK,"frontmatterMatchesClass");function QK(n,e){return e.concat([n])}o(QK,"collectAlso");async function OF(n,e,t,r){t&&e.length>0&&(r&&console.log("\u26A0\uFE0F --use-cache is disabled when --also is specified (per-vault cache cannot represent multi-vault state)."),t=!1);let i,s=!1;if(t){let c=await new oi(n).loadOrBuild();i=c.triples,s=c.cacheHit}else{let a=new kt(n);i=await new Ae.NoteToRDFConverter(a).convertVault()}for(let a of e){let c=(0,Ln.resolve)(a);if(!(0,li.existsSync)(c))throw new
|
|
612
|
+
`).slice(-3)[0]?.trim()||"..."}`)}}}catch(r){pe.handle(r)}})}o(IF,"askCommand");function GK(n,e){let t=n;switch(e){case"json":let r=new jl;console.log(r.format(t));break;case"table":default:let i=new kl;console.log(i.format(t));break}}o(GK,"formatResults");var BF=require("fs"),UF=require("path");var li=require("fs"),Ln=require("path"),RF=require("child_process"),Ae=le(fr());var zK=new Set(["aliases","archived","tags","cssclasses","publish","permalink","description","image","cover","banner","title","share","share_link","share_updated","metadata","uri"]),t2=new Map([["exo__","https://exocortex.my/ontology/exo#"],["ems__","https://exocortex.my/ontology/ems#"],["exocmd__","https://exocortex.my/ontology/exocmd#"],["ims__","https://exocortex.my/ontology/ims#"],["ztlk__","https://exocortex.my/ontology/ztlk#"],["ptms__","https://exocortex.my/ontology/ptms#"],["lit__","https://exocortex.my/ontology/lit#"],["inbox__","https://exocortex.my/ontology/inbox#"],["place__","https://exocortex.my/ontology/place#"],["exoob__","https://exocortex.my/ontology/exoob#"],["pn__","https://exocortex.my/ontology/pn#"],["period__","https://exocortex.my/ontology/period#"],["rdf__","http://www.w3.org/1999/02/22-rdf-syntax-ns#"],["rdfs__","http://www.w3.org/2000/01/rdf-schema#"],["owl__","http://www.w3.org/2002/07/owl#"]]);function HK(n,e){if(!n)return!1;let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/),a=s?s[1]:i;if(a===e||a.includes(e))return!0}return!1}o(HK,"frontmatterMatchesClass");function QK(n,e){return e.concat([n])}o(QK,"collectAlso");async function OF(n,e,t,r){t&&e.length>0&&(r&&console.log("\u26A0\uFE0F --use-cache is disabled when --also is specified (per-vault cache cannot represent multi-vault state)."),t=!1);let i,s=!1;if(t){let c=await new oi(n).loadOrBuild();i=c.triples,s=c.cacheHit}else{let a=new kt(n);i=await new Ae.NoteToRDFConverter(a).convertVault()}for(let a of e){let c=(0,Ln.resolve)(a);if(!(0,li.existsSync)(c))throw new Pe(c);r&&console.log(`\u{1F4E6} Loading additional vault: ${c}...`);let l=new kt(c),f=await new Ae.NoteToRDFConverter(l).convertVault();i=i.concat(f),r&&console.log(` \u2795 Added ${f.length} triples from ${c}`)}if(e.length>0){let a=i.length;if(i=JK(i),r){let c=i.length-a;c>0&&console.log(` \u{1F517} Cross-vault Instance_class resolution: emitted ${c} additional canonical-IRI triple(s)`)}}return{triples:i,cacheHit:s}}o(OF,"loadTriplesFromAllVaults");var CF="https://exocortex.my/ontology/exo#Instance_class",KK="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",YK=/^\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]$/i,XK=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function JK(n){let e=new Map;for(let i of n){if(!(i.subject instanceof Ae.DomainIRI)||!(i.predicate instanceof Ae.DomainIRI)||!(i.object instanceof Ae.DomainLiteral)||i.predicate.value!==NF&&i.predicate.value!==ZK)continue;let s=XK.exec(i.subject.value);if(!s)continue;let a=s[1].toLowerCase();if(e.has(a))continue;let c=i.object.value.trim();if(/\s/.test(c))continue;let l=r2(c);l&&e.set(a,l)}if(e.size===0)return n;let t=new Set,r=[];for(let i of n){if(!(i.subject instanceof Ae.DomainIRI)||!(i.predicate instanceof Ae.DomainIRI)||!(i.object instanceof Ae.DomainLiteral)||i.predicate.value!==CF)continue;let s=i.object.value.trim(),a=YK.exec(s);if(!a)continue;let c=a[1].toLowerCase(),l=e.get(c);if(!l)continue;let f=`${i.subject.value}\0${l}`;if(t.has(f))continue;t.add(f);let d=new Ae.DomainIRI(l);r.push(new Ae.DomainTriple(i.subject,new Ae.DomainIRI(CF),d)),r.push(new Ae.DomainTriple(i.subject,new Ae.DomainIRI(KK),d))}return r.length>0?n.concat(r):n}o(JK,"resolveCrossVaultInstanceClassWikilinks");var ZK="https://exocortex.my/ontology/exo#Asset_label";function eY(n,e){let t="obsidian://vault/",r=n;if(n.startsWith(t))r=decodeURIComponent(n.substring(t.length));else return n;for(let i of e){let s=(0,Ln.join)(i,r);if((0,li.existsSync)(s))return s}return(0,Ln.join)(e[0]??"",r)}o(eY,"qualifyFocusNodePath");function PF(n){let e=n.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return n.match(/^---\r?\n---/)?{}:null;let t=e[1].split(`
|
|
613
613
|
`),r={};for(let i of t){let s=i.match(/^(\w[\w]*):\s*(.*)$/);s&&(r[s[1]]=!0)}return r}o(PF,"extractFrontmatter");function FF(n){for(let e of t2.keys())if(n.startsWith(e))return!0;return!1}o(FF,"hasKnownPrefix");function DF(n){for(let[e,t]of t2)if(n.startsWith(e))return t+n.substring(e.length);return null}o(DF,"keyToURI");function tY(n){let e=[],t=[];for(let r of n)zK.has(r)||(FF(r)?e.push(r):t.push(r));return{toValidate:e,unknownPrefix:t}}o(tY,"classifyKeys");function rY(n){try{return(0,RF.execSync)("git diff --cached --name-only",{cwd:n,encoding:"utf-8"}).split(`
|
|
614
614
|
`).filter(t=>t.endsWith(".md")&&t.trim().length>0)}catch{return[]}}o(rY,"getStagedMdFiles");function nY(n){let e=[];function t(r){let i=(0,li.readdirSync)(r);for(let s of i){if(s.startsWith(".")||s==="node_modules")continue;let a=(0,Ln.join)(r,s);(0,li.statSync)(a).isDirectory()?t(a):s.endsWith(".md")&&e.push((0,Ln.relative)(n,a))}}return o(t,"walk"),t(n),e}o(nY,"collectMdFiles");function iY(n){let e=n.lastIndexOf("/");if(e===-1)return null;let t=decodeURIComponent(n.substring(e+1));return t.endsWith(".md")&&(t=t.slice(0,-3)),FF(t)?t:null}o(iY,"extractPropertyNameFromURI");async function sY(n){let e=new Ae.InMemoryTripleStore;await e.addAll(n);let t=new Ae.ExoQLParser,r=Xa(`SELECT ?s ?label WHERE {
|
|
615
615
|
{
|
|
@@ -628,18 +628,18 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
628
628
|
FILTER(!CONTAINS(STR(?class), "PropertyCardinality"))
|
|
629
629
|
}
|
|
630
630
|
OPTIONAL { ?s exo:Asset_label ?label }
|
|
631
|
-
}`),i=t.parse(r),a=new Ae.ExoQLAlgebraTranslator().translate(i);a=new Ae.AlgebraOptimizer().optimize(a);let u=await new Ae.ExoQLQueryExecutor(e).executeAll(a),f=new Set;for(let d of u){let h=d.toJSON(),p=h.s;if(typeof p=="string"){let S=iY(p);if(S){let v=DF(S);v&&f.add(v)}}let y=h.label;typeof y=="string"&&y.startsWith("https://exocortex.my/ontology/")&&f.add(y)}return f}o(sY,"loadDeclaredProperties");function aY(n,e,t){let r=[],i;try{i=(0,li.readFileSync)(n,"utf-8")}catch{return[]}let s=PF(i);if(!s)return[];let a=Object.keys(s),{toValidate:c,unknownPrefix:l}=tY(a);for(let u of l)r.push({file:e,property:u,reason:`Unknown namespace prefix in "${u}"`});for(let u of c){let f=DF(u);f&&!t.has(f)&&r.push({file:e,property:u,reason:`Property "${u}" is not declared in the ontology`})}return r}o(aY,"validateFile");var oY="http://www.w3.org/2000/01/rdf-schema#subClassOf",cY="https://exocortex.my/ontology/exo#Class_superClass",NF="http://www.w3.org/2000/01/rdf-schema#label";function r2(n){let e=n.indexOf("__");if(e===-1)return null;let t=n.slice(0,e+2),r=n.slice(e+2),i=t2.get(t);return!i||!r?null:i+r}o(r2,"labelToOntologyIRI");function lY(n){let e=decodeURIComponent(n),t=e.lastIndexOf("/");if(t===-1)return null;let r=e.slice(t+1),i=r.endsWith(".md")?r.slice(0,-3):r;return r2(i)}o(lY,"fileIriToOntologyURIFromFilename");function uY(n){let e=o(r=>{if(r instanceof Ae.DomainIRI)return{type:"iri",value:r.value};if(r instanceof Ae.DomainLiteral){let i={type:"literal",value:r.value};return r.datatype&&(i.datatype=r.datatype.value),r.language&&(i.language=r.language),i}return null},"mapNode"),t=[];for(let r of n){let i=e(r.subject),s=e(r.predicate),a=e(r.object);i&&s&&a&&t.push({subject:i,predicate:s,object:a})}return t}o(uY,"domainToAlgebraTriples");var e2=class{constructor(e){this.subClassMap=new Map;let t=new Map,r=new Set,i=o(s=>s===oY||s===cY,"isSubClassPredicate");for(let s of e)s.predicate instanceof Ae.DomainIRI&&i(s.predicate.value)&&s.subject instanceof Ae.DomainIRI&&s.object instanceof Ae.DomainIRI&&(r.add(s.subject.value),r.add(s.object.value));for(let s of e)if(s.predicate instanceof Ae.DomainIRI&&s.predicate.value===NF&&s.subject instanceof Ae.DomainIRI&&s.object instanceof Ae.DomainLiteral){let a=r2(s.object.value);a&&t.set(s.subject.value,a)}for(let s of r)if(!t.has(s)){let a=lY(s);a&&t.set(s,a)}for(let[s,a]of t){let c=this.subClassMap.get(s)??new Set;c.add(a),this.subClassMap.set(s,c)}for(let s of e)if(s.predicate instanceof Ae.DomainIRI&&i(s.predicate.value)&&s.subject instanceof Ae.DomainIRI&&s.object instanceof Ae.DomainIRI){let a=s.subject.value,c=s.object.value,l=this.subClassMap.get(a)??new Set;l.add(c),this.subClassMap.set(a,l);let u=t.get(a),f=c.startsWith("obsidian://")?t.get(c):c;if(u&&f){let d=this.subClassMap.get(u)??new Set;d.add(f),this.subClassMap.set(u,d)}}}static{o(this,"TripleClassHierarchy")}isSubClassOf(e,t){let r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===t)return!0;if(r.has(s))continue;r.add(s);let a=this.subClassMap.get(s);if(a)for(let c of a)i.push(c)}return!1}};function fY(n,e){let t=`file://${n}`,r="https://exocortex.my/cli/shacl-validator",i={earl:"http://www.w3.org/ns/earl#",dc:"http://purl.org/dc/terms/",xsd:"http://www.w3.org/2001/XMLSchema#",sh:"http://www.w3.org/ns/shacl#"},s=[{"@type":"earl:Assertor","@id":r,"dc:title":"Exocortex CLI SHACL-lite Validator"},{"@type":"earl:TestSubject","@id":t,"dc:title":n}];if(e.violations.length===0)s.push({"@type":"earl:Assertion","earl:assertedBy":{"@id":r},"earl:subject":{"@id":t},"earl:result":{"@type":"earl:TestResult","earl:outcome":{"@id":"earl:passed"},"dc:description":"All nodes conform to shapes"}});else for(let a of e.violations)s.push({"@type":"earl:Assertion","earl:assertedBy":{"@id":r},"earl:subject":{"@id":t},"earl:test":{"@id":a.propertyPath},"earl:result":{"@type":"earl:TestResult","earl:outcome":{"@id":"earl:failed"},"dc:description":a.message,"sh:focusNode":a.focusNode,"sh:resultPath":a.propertyPath,"sh:resultSeverity":{"@id":`sh:${a.severity.replace("sh:","")}`},...a.actualValue!==void 0?{"sh:value":a.actualValue}:{}}});return{"@context":i,"@graph":s}}o(fY,"buildEARLReport");var dY="https://exocortex.my/ontology/exo#Asset_legacyValidationException";function hY(n,e){let t=new Set(n.filter(i=>i.predicate instanceof Ae.DomainIRI&&i.predicate.value===dY).map(i=>i.subject instanceof Ae.DomainIRI?i.subject.value:null).filter(i=>i!==null));if(t.size===0)return e;let r=e.violations.filter(i=>!t.has(i.focusNode));return{conforms:r.every(i=>i.severity!=="sh:Violation"),violations:r}}o(hY,"applyLegacyExceptionFilter");async function pY(n,e,t=[]){let r=new Ae.InMemoryTripleStore;await r.addAll(e);let i=new Ae.ShaclShapeRegistry((await Ae.ShapeLoader.loadFromRDFGraph(r)).getAll()),s=new e2(e),a=uY(e);return(0,Ae.shaclValidate)(a,i,s)}o(pY,"runShapesValidation");async function mY(n){let e=n.format||"text";try{let t=(0,Ln.resolve)(n.vault);if(!(0,li.existsSync)(t))throw new
|
|
632
|
-
`);for(let[d,h]of f){let p=i.length>1?u(d):d;console.log(` \u274C ${p}`);for(let y of h){let S=y.severity.replace("sh:","");console.log(` [${S}] ${y.message}`)}}}l.conforms||(process.exitCode=1)}catch(t){pe.handle(t)}}o(mY,"runShapesModeAction");function LF(){return new Ie("schema").description("Check frontmatter properties against ontology (Issue #2713)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to merge into validation graph (repeatable). --use-cache is disabled when --also is present.",QK,[]).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--staged","Only validate git-staged .md files (for pre-commit hooks)").option("--use-cache","Use persistent triple cache (faster vault loading; disabled when --also is set)").option("--shapes-mode","Run SHACL-lite shapes validation instead of schema linting").option("--format <type>","Output format for shapes-mode: text|json|earl","text").option("--class <iri>","Only validate assets whose exo__Instance_class matches this IRI/slug (RFC 8e83442b T1.4)").action(async n=>{let e=n.output||"text";if(pe.setFormat(e),n.shapesMode){await mY(n);return}try{let t=(0,Ln.resolve)(n.vault);if(!(0,li.existsSync)(t))throw new
|
|
633
|
-
`));let u=[];for(let d of r){let h=(0,Ln.resolve)(t,d),p=aY(h,d,l);u.push(...p)}let f={vaultPath:t,filesChecked:r.length,violations:u,healthy:u.length===0};if(e==="json"){let d=
|
|
631
|
+
}`),i=t.parse(r),a=new Ae.ExoQLAlgebraTranslator().translate(i);a=new Ae.AlgebraOptimizer().optimize(a);let u=await new Ae.ExoQLQueryExecutor(e).executeAll(a),f=new Set;for(let d of u){let h=d.toJSON(),p=h.s;if(typeof p=="string"){let S=iY(p);if(S){let v=DF(S);v&&f.add(v)}}let y=h.label;typeof y=="string"&&y.startsWith("https://exocortex.my/ontology/")&&f.add(y)}return f}o(sY,"loadDeclaredProperties");function aY(n,e,t){let r=[],i;try{i=(0,li.readFileSync)(n,"utf-8")}catch{return[]}let s=PF(i);if(!s)return[];let a=Object.keys(s),{toValidate:c,unknownPrefix:l}=tY(a);for(let u of l)r.push({file:e,property:u,reason:`Unknown namespace prefix in "${u}"`});for(let u of c){let f=DF(u);f&&!t.has(f)&&r.push({file:e,property:u,reason:`Property "${u}" is not declared in the ontology`})}return r}o(aY,"validateFile");var oY="http://www.w3.org/2000/01/rdf-schema#subClassOf",cY="https://exocortex.my/ontology/exo#Class_superClass",NF="http://www.w3.org/2000/01/rdf-schema#label";function r2(n){let e=n.indexOf("__");if(e===-1)return null;let t=n.slice(0,e+2),r=n.slice(e+2),i=t2.get(t);return!i||!r?null:i+r}o(r2,"labelToOntologyIRI");function lY(n){let e=decodeURIComponent(n),t=e.lastIndexOf("/");if(t===-1)return null;let r=e.slice(t+1),i=r.endsWith(".md")?r.slice(0,-3):r;return r2(i)}o(lY,"fileIriToOntologyURIFromFilename");function uY(n){let e=o(r=>{if(r instanceof Ae.DomainIRI)return{type:"iri",value:r.value};if(r instanceof Ae.DomainLiteral){let i={type:"literal",value:r.value};return r.datatype&&(i.datatype=r.datatype.value),r.language&&(i.language=r.language),i}return null},"mapNode"),t=[];for(let r of n){let i=e(r.subject),s=e(r.predicate),a=e(r.object);i&&s&&a&&t.push({subject:i,predicate:s,object:a})}return t}o(uY,"domainToAlgebraTriples");var e2=class{constructor(e){this.subClassMap=new Map;let t=new Map,r=new Set,i=o(s=>s===oY||s===cY,"isSubClassPredicate");for(let s of e)s.predicate instanceof Ae.DomainIRI&&i(s.predicate.value)&&s.subject instanceof Ae.DomainIRI&&s.object instanceof Ae.DomainIRI&&(r.add(s.subject.value),r.add(s.object.value));for(let s of e)if(s.predicate instanceof Ae.DomainIRI&&s.predicate.value===NF&&s.subject instanceof Ae.DomainIRI&&s.object instanceof Ae.DomainLiteral){let a=r2(s.object.value);a&&t.set(s.subject.value,a)}for(let s of r)if(!t.has(s)){let a=lY(s);a&&t.set(s,a)}for(let[s,a]of t){let c=this.subClassMap.get(s)??new Set;c.add(a),this.subClassMap.set(s,c)}for(let s of e)if(s.predicate instanceof Ae.DomainIRI&&i(s.predicate.value)&&s.subject instanceof Ae.DomainIRI&&s.object instanceof Ae.DomainIRI){let a=s.subject.value,c=s.object.value,l=this.subClassMap.get(a)??new Set;l.add(c),this.subClassMap.set(a,l);let u=t.get(a),f=c.startsWith("obsidian://")?t.get(c):c;if(u&&f){let d=this.subClassMap.get(u)??new Set;d.add(f),this.subClassMap.set(u,d)}}}static{o(this,"TripleClassHierarchy")}isSubClassOf(e,t){let r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===t)return!0;if(r.has(s))continue;r.add(s);let a=this.subClassMap.get(s);if(a)for(let c of a)i.push(c)}return!1}};function fY(n,e){let t=`file://${n}`,r="https://exocortex.my/cli/shacl-validator",i={earl:"http://www.w3.org/ns/earl#",dc:"http://purl.org/dc/terms/",xsd:"http://www.w3.org/2001/XMLSchema#",sh:"http://www.w3.org/ns/shacl#"},s=[{"@type":"earl:Assertor","@id":r,"dc:title":"Exocortex CLI SHACL-lite Validator"},{"@type":"earl:TestSubject","@id":t,"dc:title":n}];if(e.violations.length===0)s.push({"@type":"earl:Assertion","earl:assertedBy":{"@id":r},"earl:subject":{"@id":t},"earl:result":{"@type":"earl:TestResult","earl:outcome":{"@id":"earl:passed"},"dc:description":"All nodes conform to shapes"}});else for(let a of e.violations)s.push({"@type":"earl:Assertion","earl:assertedBy":{"@id":r},"earl:subject":{"@id":t},"earl:test":{"@id":a.propertyPath},"earl:result":{"@type":"earl:TestResult","earl:outcome":{"@id":"earl:failed"},"dc:description":a.message,"sh:focusNode":a.focusNode,"sh:resultPath":a.propertyPath,"sh:resultSeverity":{"@id":`sh:${a.severity.replace("sh:","")}`},...a.actualValue!==void 0?{"sh:value":a.actualValue}:{}}});return{"@context":i,"@graph":s}}o(fY,"buildEARLReport");var dY="https://exocortex.my/ontology/exo#Asset_legacyValidationException";function hY(n,e){let t=new Set(n.filter(i=>i.predicate instanceof Ae.DomainIRI&&i.predicate.value===dY).map(i=>i.subject instanceof Ae.DomainIRI?i.subject.value:null).filter(i=>i!==null));if(t.size===0)return e;let r=e.violations.filter(i=>!t.has(i.focusNode));return{conforms:r.every(i=>i.severity!=="sh:Violation"),violations:r}}o(hY,"applyLegacyExceptionFilter");async function pY(n,e,t=[]){let r=new Ae.InMemoryTripleStore;await r.addAll(e);let i=new Ae.ShaclShapeRegistry((await Ae.ShapeLoader.loadFromRDFGraph(r)).getAll()),s=new e2(e),a=uY(e);return(0,Ae.shaclValidate)(a,i,s)}o(pY,"runShapesValidation");async function mY(n){let e=n.format||"text";try{let t=(0,Ln.resolve)(n.vault);if(!(0,li.existsSync)(t))throw new Pe(t);let r=n.also??[],i=[t,...r.map(f=>(0,Ln.resolve)(f))];e==="text"&&console.log(`\u{1F4E6} Loading vault (shapes-mode): ${t}...`);let{triples:s,cacheHit:a}=await OF(t,r,!!n.useCache,e==="text");e==="text"&&a&&console.log("\u{1F680} Cache hit! Loading from persistent cache..."),e==="text"&&(console.log(`\u2705 Loaded ${s.length} triples`),console.log("\u{1F50D} Running SHACL-lite validation..."));let c=await pY(t,s,r),l=hY(s,c),u=o(f=>i.length>1?eY(f,i):f,"qualifyNode");if(e==="earl"){let f=fY(t,l);console.log(JSON.stringify(f,null,2))}else if(e==="json"){let f=l.violations.map(h=>({...h,vaultQualifiedPath:u(h.focusNode)})),d=Oe.success({vaultPath:t,alsoPaths:r.map(h=>(0,Ln.resolve)(h)),conforms:l.conforms,violationCount:l.violations.length,violations:f});console.log(JSON.stringify(d,null,2))}else if(l.conforms)console.log(`\u2705 Vault conforms to all shapes (${l.violations.length===0?"no violations":`${l.violations.length} warning(s)`}).`);else{let f=new Map;for(let d of l.violations){let h=f.get(d.focusNode)??[];h.push(d),f.set(d.focusNode,h)}console.log(`\u26A0\uFE0F Found ${l.violations.length} SHACL violation(s) in ${f.size} node(s):
|
|
632
|
+
`);for(let[d,h]of f){let p=i.length>1?u(d):d;console.log(` \u274C ${p}`);for(let y of h){let S=y.severity.replace("sh:","");console.log(` [${S}] ${y.message}`)}}}l.conforms||(process.exitCode=1)}catch(t){pe.handle(t)}}o(mY,"runShapesModeAction");function LF(){return new Ie("schema").description("Check frontmatter properties against ontology (Issue #2713)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to merge into validation graph (repeatable). --use-cache is disabled when --also is present.",QK,[]).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--staged","Only validate git-staged .md files (for pre-commit hooks)").option("--use-cache","Use persistent triple cache (faster vault loading; disabled when --also is set)").option("--shapes-mode","Run SHACL-lite shapes validation instead of schema linting").option("--format <type>","Output format for shapes-mode: text|json|earl","text").option("--class <iri>","Only validate assets whose exo__Instance_class matches this IRI/slug (RFC 8e83442b T1.4)").action(async n=>{let e=n.output||"text";if(pe.setFormat(e),n.shapesMode){await mY(n);return}try{let t=(0,Ln.resolve)(n.vault);if(!(0,li.existsSync)(t))throw new Pe(t);let r;if(n.staged){if(r=rY(t),r.length===0){if(e==="json"){let d=Oe.success({vaultPath:t,filesChecked:0,violations:[],healthy:!0});console.log(JSON.stringify(d,null,2))}else console.log("\u2705 No staged .md files to validate.");return}}else r=nY(t);if(n.class){let d=n.class;r=r.filter(h=>{try{let p=(0,li.readFileSync)((0,Ln.resolve)(t,h),"utf-8"),y=PF(p);return HK(y,d)}catch{return!1}})}e==="text"&&console.log(`\u{1F4E6} Loading vault: ${t}...`);let i=n.also??[],{triples:s,cacheHit:a}=await OF(t,i,!!n.useCache,e==="text"),c=s;e==="text"&&a&&console.log("\u{1F680} Cache hit! Loading from persistent cache..."),e==="text"&&(console.log(`\u2705 Loaded ${c.length} triples`),console.log("\u{1F50D} Querying ontology for declared properties..."));let l=await sY(c);e==="text"&&(console.log(`\u{1F4CB} Found ${l.size} declared properties in ontology`),console.log(`\u{1F50D} Validating ${r.length} file(s)...
|
|
633
|
+
`));let u=[];for(let d of r){let h=(0,Ln.resolve)(t,d),p=aY(h,d,l);u.push(...p)}let f={vaultPath:t,filesChecked:r.length,violations:u,healthy:u.length===0};if(e==="json"){let d=Oe.success(f);console.log(JSON.stringify(d,null,2))}else if(u.length===0)console.log(`\u2705 All ${r.length} file(s) pass schema validation.`);else{let d=new Map;for(let h of u){let p=d.get(h.file)||[];p.push(h),d.set(h.file,p)}console.log(`\u26A0\uFE0F Found ${u.length} schema violation(s) in ${d.size} file(s):
|
|
634
634
|
`);for(let[h,p]of d){console.log(` \u274C ${h}`);for(let y of p)console.log(` \u2022 ${y.reason}`)}console.log(`
|
|
635
635
|
\u{1F4DD} To fix these issues:`),console.log(" - Remove undeclared properties from frontmatter"),console.log(" - Or declare them in the ontology as Property instances")}u.length>0&&(process.exitCode=1)}catch(t){pe.handle(t)}})}o(LF,"validateSchemaCommand");var kF=require("fs"),jF=require("path"),MF=require("child_process"),$F=le(fr());var gY={exo__Asset_uid:"add `exo__Asset_uid: <uuid>` to frontmatter",exo__Asset_isDefinedBy:'add `exo__Asset_isDefinedBy: "[[!kitelev]]"` (or your own ontology marker) to frontmatter',exo__Asset_label:'add `exo__Asset_label: "<short label>"` to frontmatter',exo__Instance_class:'add `exo__Instance_class: ["[[<ClassName>]]"]` to frontmatter'};function yY(n,e){switch(e.code){case"MISSING_PROPERTY":return{file:n,code:e.code,property:e.property,reason:e.message,hint:gY[e.property]??`add \`${e.property}: <value>\` to frontmatter`};case"EMPTY_PROPERTY":return{file:n,code:e.code,property:e.property,reason:e.message,hint:`set a non-empty value for \`${e.property}\` (or remove the asset markers if this file is not an Exocortex asset)`};case"EMPTY_OPTIONAL_PROPERTY":return{file:n,code:e.code,property:e.property,reason:e.message,hint:`remove \`${e.property}\` from frontmatter or fill it with a non-empty value`};case"INVALID_INSTANCE_CLASS_IRI":return{file:n,code:e.code,property:e.property,reason:e.message,hint:`fix the \`${e.property}\` wikilink target \u2014 namespaced classes (e.g. \`ems__\`, \`exo__\`) cannot contain whitespace or parentheses, otherwise they expand into invalid IRIs`}}}o(yY,"violationToError");function _Y(n){try{return(0,MF.execSync)("git diff --cached --name-only",{cwd:n,encoding:"utf-8"}).split(`
|
|
636
|
-
`).filter(t=>t.endsWith(".md")&&t.trim().length>0)}catch{return[]}}o(_Y,"getStagedMdFiles");function VF(){return new Ie("frontmatter").description("Check vault frontmatter for missing/empty properties and malformed IRIs (Issue #2997 Phase 4)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--staged","Only validate git-staged .md files (for pre-commit hooks)").action(async n=>{let e=n.output||"text";pe.setFormat(e);try{let t=(0,jF.resolve)(n.vault);if(!(0,kF.existsSync)(t))throw new
|
|
636
|
+
`).filter(t=>t.endsWith(".md")&&t.trim().length>0)}catch{return[]}}o(_Y,"getStagedMdFiles");function VF(){return new Ie("frontmatter").description("Check vault frontmatter for missing/empty properties and malformed IRIs (Issue #2997 Phase 4)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--staged","Only validate git-staged .md files (for pre-commit hooks)").action(async n=>{let e=n.output||"text";pe.setFormat(e);try{let t=(0,jF.resolve)(n.vault);if(!(0,kF.existsSync)(t))throw new Pe(t);let r=new kt(t),i=new $F.NoteToRDFConverter(r),s=r.getAllFiles();if(n.staged){let l=new Set(_Y(t));s=s.filter(u=>l.has(u.path))}let a=[];for(let l of s){let u=r.getFrontmatter(l);if(u){let f=i.validateExocortexAsset(u);f&&a.push(yY(l.path,f))}try{i.notePathToIRI(l.path)}catch(f){let d=f instanceof Error?f.message:String(f);a.push({file:l.path,code:"INVALID_PATH_IRI",reason:`Invalid IRI format for vault path: ${d}`,hint:`rename the file \u2014 its path \`${l.path}\` cannot be encoded into a valid \`obsidian://vault/...\` IRI (avoid raw whitespace, control characters, and angle brackets)`})}}let c={vaultPath:t,filesChecked:s.length,errors:a,healthy:a.length===0};if(e==="json")console.log(JSON.stringify(Oe.success(c),null,2));else if(a.length===0)console.log(`\u2705 All ${s.length} file(s) pass frontmatter validation.`);else{console.log(`\u26A0\uFE0F Found ${a.length} frontmatter error(s) in ${new Set(a.map(l=>l.file)).size} file(s):
|
|
637
637
|
`);for(let l of a)console.log(` \u274C ${l.file}`),console.log(` ${l.reason}`),console.log(` \u{1F4A1} ${l.hint}`);console.log(`
|
|
638
|
-
\u{1F4DD} These shapes prevented the file from loading into the SPARQL store (Issue #2997 Phase 2). Fix them so the asset can be indexed.`)}a.length>0&&(process.exitCode=1)}catch(t){pe.handle(t)}})}o(VF,"validateFrontmatterCommand");function bY(){return new Ie("iri").description("Check vault files for IRI issues (Issue #2205)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";pe.setFormat(e);try{let t=(0,UF.resolve)(n.vault);if(!(0,BF.existsSync)(t))throw new
|
|
638
|
+
\u{1F4DD} These shapes prevented the file from loading into the SPARQL store (Issue #2997 Phase 2). Fix them so the asset can be indexed.`)}a.length>0&&(process.exitCode=1)}catch(t){pe.handle(t)}})}o(VF,"validateFrontmatterCommand");function bY(){return new Ie("iri").description("Check vault files for IRI issues (Issue #2205)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";pe.setFormat(e);try{let t=(0,UF.resolve)(n.vault);if(!(0,BF.existsSync)(t))throw new Pe(t);let r=new oi(t);e==="text"&&console.log(`\u{1F50D} Validating vault: ${t}...`);let i=await r.validateVault();if(e==="json"){let s=Oe.success({vaultPath:t,issueCount:i.length,issues:i,healthy:i.length===0});console.log(JSON.stringify(s,null,2))}else if(i.length===0)console.log("\u2705 Vault is healthy! No IRI issues found.");else{console.log(`
|
|
639
639
|
\u26A0\uFE0F Found ${i.length} file(s) with IRI issues:
|
|
640
640
|
`);for(let s of i)console.log(` \u274C ${s.path}`),console.log(` ${s.reason}`);console.log(`
|
|
641
641
|
\u{1F4DD} To fix these issues:`),console.log(" - Rename files to remove spaces and special characters"),console.log(" - Use dashes (-) or underscores (_) instead of spaces"),console.log(" - Avoid angle brackets (<>) and other special characters"),console.log(`
|
|
642
|
-
\u{1F4A1} Run 'exocortex sparql index --strict' to fail on first issue`)}i.length>0&&(process.exitCode=1)}catch(t){pe.handle(t)}})}o(bY,"validateIriCommand");function qF(){let n=new Ie("validate").description("Validate vault files (IRI checks, schema linting, frontmatter shapes)");return n.addCommand(bY()),n.addCommand(LF()),n.addCommand(VF()),n}o(qF,"validateCommand");var WF=require("fs"),GF=require("path"),Ir=le(fr());function zF(){return new Ie("classes").alias("describe-class").description("List RDF classes in vault, or describe a class (predicates + counts). Alias `describe-class` is provided per #3043 RFC \xA7B (schema introspection).").argument("[class-name]","Optional class name to show details (e.g., ems__Task)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--use-cache","Use persistent cache (faster for repeated queries)").action(async(n,e)=>{let t=e.output||"text";pe.setFormat(t);try{let r=Date.now(),i=(0,GF.resolve)(e.vault);if(!(0,WF.existsSync)(i))throw new
|
|
642
|
+
\u{1F4A1} Run 'exocortex sparql index --strict' to fail on first issue`)}i.length>0&&(process.exitCode=1)}catch(t){pe.handle(t)}})}o(bY,"validateIriCommand");function qF(){let n=new Ie("validate").description("Validate vault files (IRI checks, schema linting, frontmatter shapes)");return n.addCommand(bY()),n.addCommand(LF()),n.addCommand(VF()),n}o(qF,"validateCommand");var WF=require("fs"),GF=require("path"),Ir=le(fr());function zF(){return new Ie("classes").alias("describe-class").description("List RDF classes in vault, or describe a class (predicates + counts). Alias `describe-class` is provided per #3043 RFC \xA7B (schema introspection).").argument("[class-name]","Optional class name to show details (e.g., ems__Task)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--use-cache","Use persistent cache (faster for repeated queries)").action(async(n,e)=>{let t=e.output||"text";pe.setFormat(t);try{let r=Date.now(),i=(0,GF.resolve)(e.vault);if(!(0,WF.existsSync)(i))throw new Pe(i);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${i}...`);let s,a=!1;if(e.useCache){let f=await new oi(i).loadOrBuild();s=f.triples,a=f.cacheHit,t==="text"&&a&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let u=new kt(i);s=await new Ir.NoteToRDFConverter(u).convertVault()}let c=new Ir.InMemoryTripleStore;await c.addAll(s);let l=Date.now()-r;if(t==="text"){let u=a?" (from cache)":"";console.log(`\u2705 Loaded ${s.length} triples in ${l}ms${u}
|
|
643
643
|
`)}n?await wY(c,n,e,t):await SY(c,e,t)}catch(r){pe.handle(r)}})}o(zF,"classesCommand");async function SY(n,e,t){let s=new Ir.ExoQLParser().parse(`
|
|
644
644
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
645
645
|
SELECT ?class (COUNT(?instance) AS ?count)
|
|
@@ -648,7 +648,7 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
648
648
|
}
|
|
649
649
|
GROUP BY ?class
|
|
650
650
|
ORDER BY DESC(?count)
|
|
651
|
-
`),c=new Ir.ExoQLAlgebraTranslator().translate(s);c=new Ir.AlgebraOptimizer().optimize(c);let d=(await new Ir.ExoQLQueryExecutor(n).executeAll(c)).map(h=>{let p=h.get("class"),y=h.get("count");return{name:p?HF(p.toString()):"unknown",count:y?parseInt(y.toString(),10):0}});if(t==="json"||e.format==="json"){let h=
|
|
651
|
+
`),c=new Ir.ExoQLAlgebraTranslator().translate(s);c=new Ir.AlgebraOptimizer().optimize(c);let d=(await new Ir.ExoQLQueryExecutor(n).executeAll(c)).map(h=>{let p=h.get("class"),y=h.get("count");return{name:p?HF(p.toString()):"unknown",count:y?parseInt(y.toString(),10):0}});if(t==="json"||e.format==="json"){let h=Oe.success({classes:d,totalClasses:d.length});console.log(JSON.stringify(h,null,2))}else{if(console.log(`\u{1F4CA} Found ${d.length} RDF class(es):
|
|
652
652
|
`),d.length===0){console.log("No classes found in vault.");return}let h=Math.max(...d.map(p=>p.name.length),10);console.log("\u250C"+"\u2500".repeat(h+2)+"\u252C"+"\u2500".repeat(12)+"\u2510"),console.log("\u2502 "+"Class".padEnd(h)+" \u2502 "+"Instances".padEnd(10)+" \u2502"),console.log("\u251C"+"\u2500".repeat(h+2)+"\u253C"+"\u2500".repeat(12)+"\u2524");for(let p of d)console.log("\u2502 "+p.name.padEnd(h)+" \u2502 "+p.count.toString().padStart(10)+" \u2502");console.log("\u2514"+"\u2500".repeat(h+2)+"\u2534"+"\u2500".repeat(12)+"\u2518")}}o(SY,"listAllClasses");async function wY(n,e,t,r){let i=`
|
|
653
653
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
654
654
|
SELECT (COUNT(?instance) AS ?count)
|
|
@@ -667,10 +667,10 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
667
667
|
}
|
|
668
668
|
GROUP BY ?property
|
|
669
669
|
ORDER BY DESC(?usageCount)
|
|
670
|
-
`;a=s.parse(p),c=new Ir.ExoQLAlgebraTranslator,l=c.translate(a),u=new Ir.AlgebraOptimizer,l=u.optimize(l);let S=(await f.executeAll(l)).map(w=>{let T=w.get("property"),C=w.get("usageCount");return{name:T?HF(T.toString()):"unknown",usageCount:C?parseInt(C.toString(),10):0}}),v={name:e,instanceCount:h,properties:S};if(r==="json"||t.format==="json"){let w=
|
|
670
|
+
`;a=s.parse(p),c=new Ir.ExoQLAlgebraTranslator,l=c.translate(a),u=new Ir.AlgebraOptimizer,l=u.optimize(l);let S=(await f.executeAll(l)).map(w=>{let T=w.get("property"),C=w.get("usageCount");return{name:T?HF(T.toString()):"unknown",usageCount:C?parseInt(C.toString(),10):0}}),v={name:e,instanceCount:h,properties:S};if(r==="json"||t.format==="json"){let w=Oe.success(v);console.log(JSON.stringify(w,null,2))}else{if(console.log(`\u{1F4CB} Class: ${e}
|
|
671
671
|
`),console.log(` Instances: ${h}`),console.log(` Properties: ${S.length}
|
|
672
672
|
`),S.length===0){console.log(" No properties found.");return}let w=Math.max(...S.map(T=>T.name.length),10);console.log(" \u250C"+"\u2500".repeat(w+2)+"\u252C"+"\u2500".repeat(10)+"\u2510"),console.log(" \u2502 "+"Property".padEnd(w)+" \u2502 "+"Usage".padEnd(8)+" \u2502"),console.log(" \u251C"+"\u2500".repeat(w+2)+"\u253C"+"\u2500".repeat(10)+"\u2524");for(let T of S)console.log(" \u2502 "+T.name.padEnd(w)+" \u2502 "+T.usageCount.toString().padStart(8)+" \u2502");console.log(" \u2514"+"\u2500".repeat(w+2)+"\u2534"+"\u2500".repeat(10)+"\u2518")}}o(wY,"showClassDetails");function HF(n){let e=n.replace(/^<|>$/g,""),t=e.lastIndexOf("#");if(t!==-1)return e.substring(t+1);let r=e.lastIndexOf("/");return r!==-1?e.substring(r+1):e}o(HF,"extractLocalName");var XF=require("path"),c2=require("fs"),JF=require("fs"),ZF=le(fr());var hr=le(Sl()),Za=le(require("path"));var Xo=le(fr());var pr=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await hr.default.pathExists(t))throw new Xo.FileNotFoundError(e);return hr.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return hr.default.pathExists(t)}async getFileMetadata(e){let t=await this.readFile(e);return this.extractFrontmatter(t)}async createFile(e,t){let r=this.resolvePath(e);if(await hr.default.pathExists(r))throw new Xo.FileAlreadyExistsError(e);return await hr.default.ensureDir(Za.default.dirname(r)),await hr.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await hr.default.pathExists(r))throw new Xo.FileNotFoundError(e);await hr.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await hr.default.ensureDir(Za.default.dirname(r)),await hr.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await hr.default.pathExists(t))throw new Xo.FileNotFoundError(e);await hr.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await hr.default.pathExists(r))throw new Xo.FileNotFoundError(e);await hr.default.ensureDir(Za.default.dirname(i)),await hr.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await hr.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await hr.default.pathExists(t)?(await hr.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=Za.default.join(t,"**/*.md");return(await Ll(r,{nodir:!0})).map(a=>Za.default.relative(this.rootPath,a))}async findFilesByMetadata(e){let t=await this.getMarkdownFiles(),r=[];for(let i of t)try{let s=await this.getFileMetadata(i);this.matchesQuery(s,e)&&r.push(i)}catch{continue}return r}async findFileByUID(e){let t=await this.findFilesByMetadata({exo__Asset_uid:e});return t.length>0?t[0]:null}resolvePath(e){return Za.default.isAbsolute(e)?e:Za.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=rr.load(r[1]);return typeof i=="object"&&i!==null?i:{}}catch{return{}}}matchesQuery(e,t){for(let[r,i]of Object.entries(t)){let s=e[r];if(Array.isArray(s)){if(!s.some(a=>this.normalizeValue(a)===this.normalizeValue(i)))return!1}else if(this.normalizeValue(s)!==this.normalizeValue(i))return!1}return!0}normalizeValue(e){return e==null?"":String(e).replace(/["'[\]]/g,"").trim()}};var n2=class extends Error{static{o(this,"ClassNotFoundError")}constructor(e,t){let r=`Class '${e}' not found in vault`;t&&t.length>0&&(r+=`
|
|
673
|
-
Available classes: ${t.join(", ")}`),super(r),this.name="ClassNotFoundError"}},Gl=class{constructor(e){this.fsAdapter=e;this.cache=new Map}static{o(this,"ClassResolverService")}async resolve(e,t){if(this.isUUID(t))return t;let r=await this.getOrBuildIndex(e),i=r.get(t);if(!i){let s=Array.from(r.keys()).filter(a=>!this.isUUID(a));throw new n2(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,r=await this.fsAdapter.getMarkdownFiles();for(let i of r)try{let s=await this.fsAdapter.getFileMetadata(i);if(!this.isClassDefinition(s))continue;let a=this.getBasename(i),c=s.exo__Asset_uid;if(!c&&this.isUUID(a)&&(c=a),!c)continue;let l=String(c);a&&t.set(a,l);let u=s.exo__Asset_label;u&&typeof u=="string"&&u!==a&&t.set(u,l)}catch{continue}return t}isClassDefinition(e){let t=e.exo__Instance_class;return t?(Array.isArray(t)?t:[t]).some(i=>{let s=String(i);return s.includes("ims__Class")||s.includes("exo__Class")}):!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 i2=class extends Error{static{o(this,"WikilinkNotFoundError")}constructor(e,t){let r=t?`|${t}`:"";super(`Wikilink [[${e}${r}]] \u2014 file not found in vault`),this.name="WikilinkNotFoundError"}},Cg=class{constructor(e){this.fsAdapter=e}static{o(this,"WikilinkValidator")}static{this.WIKILINK_PATTERN=/\[\[([^\]|]+)(?:\|[^\]]*)?]]/g}async validatePropertyValues(e){for(let[,t]of Object.entries(e))await this.validateValue(t)}async validateValue(e){let t=this.extractWikilinks(e);for(let r of t)await this.validateWikilink(r.uuid,r.label)}extractWikilinks(e){let t=[],r=/\[\[([^\]|]+)(?:\|([^\]]*))?\]\]/g,i;for(;(i=r.exec(e))!==null;)t.push({uuid:i[1].trim(),label:i[2]?.trim()});return t}async validateWikilink(e,t){if(!this.looksLikeUUID(e))return;if(!await this.fsAdapter.fileExists(`${e}.md`)&&!await this.fsAdapter.findFileByUID(e))throw new i2(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)}};var $r=[];for(let n=0;n<256;++n)$r.push((n+256).toString(16).slice(1));function QF(n,e=0){return($r[n[e+0]]+$r[n[e+1]]+$r[n[e+2]]+$r[n[e+3]]+"-"+$r[n[e+4]]+$r[n[e+5]]+"-"+$r[n[e+6]]+$r[n[e+7]]+"-"+$r[n[e+8]]+$r[n[e+9]]+"-"+$r[n[e+10]]+$r[n[e+11]]+$r[n[e+12]]+$r[n[e+13]]+$r[n[e+14]]+$r[n[e+15]]).toLowerCase()}o(QF,"unsafeStringify");var KF=require("node:crypto");var Og=new Uint8Array(256),Rg=Og.length;function s2(){return Rg>Og.length-16&&((0,KF.randomFillSync)(Og),Rg=0),Og.slice(Rg,Rg+=16)}o(s2,"rng");var YF=require("node:crypto"),a2={randomUUID:YF.randomUUID};function vY(n,e,t){n=n||{};let r=n.random??n.rng?.()??s2();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return QF(r)}o(vY,"_v4");function EY(n,e,t){return a2.randomUUID&&!e&&!n?a2.randomUUID():vY(n,e,t)}o(EY,"v4");var o2=EY;var Fg=le(fr());var TY="de20a3f1-7483-4714-ab28-b45f5cf02c76",AY="Asia/Almaty",Pg=class{constructor(e,t,r,i){this.fsAdapter=e;this.classResolver=t;this.wikilinkValidator=r;this.shapeRegistry=i}static{o(this,"AssetCreationService")}async create(e){if(!e.label||e.label.trim().length===0)throw new Error("Label cannot be empty");let t=e.label.trim(),r=await this.classResolver.resolve(e.vault,e.classShortName);e.properties&&!e.skipWikilinkValidation&&await this.wikilinkValidator.validatePropertyValues(e.properties);let i=o2(),s=this.generateTimestamp(e.timezone),a=this.buildFrontmatter({assetUuid:i,classShortName:e.classShortName,classUuid:r,label:t,aliases:e.aliases,properties:e.properties,createdBy:e.createdBy||TY,timestamp:s}),c=Fg.MetadataHelpers.buildFileContent(a,e.body),l=`01 Inbox/${i}.md`;return e.dryRun||await this.fsAdapter.createFile(l,c),{uuid:i,path:l,label:t,frontmatter:a}}buildFrontmatter(e){let t={};t.exo__Asset_uid=e.assetUuid,t.exo__Asset_label=e.label,t.exo__Asset_createdAt=e.timestamp,t.exo__Asset_createdBy=`"[[${e.createdBy}]]"`,t.exo__Instance_class=[`"[[${e.classUuid}|${e.classShortName}]]"`];let r=[e.label];if(e.aliases&&e.aliases.length>0)for(let i of e.aliases)r.includes(i)||r.push(i);if(t.aliases=r,e.properties)for(let[i,s]of Object.entries(e.properties))i==="exo__Asset_uid"||i==="exo__Asset_label"||i==="exo__Asset_createdAt"||i==="exo__Asset_createdBy"||i==="exo__Instance_class"||i==="aliases"||(t[i]=this.formatPropertyValue(i,s));return t}formatPropertyValue(e,t){if(!t.includes("[["))return t;let r=t.startsWith('"')&&t.endsWith('"')?t:`"${t}"`;return this.isSingleValued(e)?r:[r]}isSingleValued(e){if(!this.shapeRegistry)return!1;let t=Fg.Namespace.fromPropertyKey(e);if(!t)return!1;let r=t.namespace.term(t.localName).value;return this.shapeRegistry.get(r)?.cardinality==="Single"}generateTimestamp(e){let t=e||AY,r=new Date,s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(r),a=o(c=>s.find(l=>l.type===c)?.value||"00","get");return`${a("year")}-${a("month")}-${a("day")}T${a("hour")}:${a("minute")}:${a("second")}`}};function xY(n){if(!n||n.length===0)return{};let e={};for(let t of n){let r=t.indexOf("=");if(r===-1)throw new Error(`Invalid property format: "${t}". Expected "key=value" format.`);let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();if(!i)throw new Error(`Invalid property format: "${t}". Key cannot be empty.`);e[i]=s}return e}o(xY,"parseProperties");async function IY(n){if(n.bodyFile){if(!(0,c2.existsSync)(n.bodyFile))throw new Error(`Body file not found: ${n.bodyFile}`);return(0,JF.readFileSync)(n.bodyFile,"utf-8")}if(n.body==="-")return CY(3e4);if(n.body)return n.body}o(IY,"resolveBody");function CY(n){return new Promise((e,t)=>{let r=[],i=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.destroy(),t(new Error(`Stdin read timed out after ${n}ms. Ensure you pipe content to stdin or close the pipe.`))},n);process.stdin.on("data",s=>{r.push(s)}),process.stdin.on("end",()=>{clearTimeout(i),e(Buffer.concat(r).toString("utf-8"))}),process.stdin.on("error",s=>{clearTimeout(i),t(s)}),process.stdin.isTTY&&(clearTimeout(i),e("")),process.stdin.resume()})}o(CY,"readStdin");function eD(){return new Ie("create").description("Create a new vault asset with auto-generated UUID, timestamp, and frontmatter").requiredOption("--class <name>","Class short name (e.g. ztlk__PermanentNote) or UUID").requiredOption("--label <text>","Human-readable label for the asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--aliases <names...>","Additional aliases for the asset").option("--property <key=value...>","Property key-value pairs (repeatable)",RY,[]).option("--body <text>","Markdown body content (use '-' to read from stdin)").option("--body-file <path>","Read body content from file").option("--dry-run","Preview frontmatter without writing file").option("--created-by <uuid>","Creator UUID (defaults to ExoAssistant)").option("--timezone <tz>","Timezone for timestamps (defaults to Asia/Almaty)").option("--skip-wikilink-validation","Skip wikilink existence validation").action(async n=>{try{let e=(0,XF.resolve)(n.vault);if(!(0,c2.existsSync)(e))throw new
|
|
673
|
+
Available classes: ${t.join(", ")}`),super(r),this.name="ClassNotFoundError"}},Gl=class{constructor(e){this.fsAdapter=e;this.cache=new Map}static{o(this,"ClassResolverService")}async resolve(e,t){if(this.isUUID(t))return t;let r=await this.getOrBuildIndex(e),i=r.get(t);if(!i){let s=Array.from(r.keys()).filter(a=>!this.isUUID(a));throw new n2(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,r=await this.fsAdapter.getMarkdownFiles();for(let i of r)try{let s=await this.fsAdapter.getFileMetadata(i);if(!this.isClassDefinition(s))continue;let a=this.getBasename(i),c=s.exo__Asset_uid;if(!c&&this.isUUID(a)&&(c=a),!c)continue;let l=String(c);a&&t.set(a,l);let u=s.exo__Asset_label;u&&typeof u=="string"&&u!==a&&t.set(u,l)}catch{continue}return t}isClassDefinition(e){let t=e.exo__Instance_class;return t?(Array.isArray(t)?t:[t]).some(i=>{let s=String(i);return s.includes("ims__Class")||s.includes("exo__Class")}):!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 i2=class extends Error{static{o(this,"WikilinkNotFoundError")}constructor(e,t){let r=t?`|${t}`:"";super(`Wikilink [[${e}${r}]] \u2014 file not found in vault`),this.name="WikilinkNotFoundError"}},Cg=class{constructor(e){this.fsAdapter=e}static{o(this,"WikilinkValidator")}static{this.WIKILINK_PATTERN=/\[\[([^\]|]+)(?:\|[^\]]*)?]]/g}async validatePropertyValues(e){for(let[,t]of Object.entries(e))await this.validateValue(t)}async validateValue(e){let t=this.extractWikilinks(e);for(let r of t)await this.validateWikilink(r.uuid,r.label)}extractWikilinks(e){let t=[],r=/\[\[([^\]|]+)(?:\|([^\]]*))?\]\]/g,i;for(;(i=r.exec(e))!==null;)t.push({uuid:i[1].trim(),label:i[2]?.trim()});return t}async validateWikilink(e,t){if(!this.looksLikeUUID(e))return;if(!await this.fsAdapter.fileExists(`${e}.md`)&&!await this.fsAdapter.findFileByUID(e))throw new i2(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)}};var $r=[];for(let n=0;n<256;++n)$r.push((n+256).toString(16).slice(1));function QF(n,e=0){return($r[n[e+0]]+$r[n[e+1]]+$r[n[e+2]]+$r[n[e+3]]+"-"+$r[n[e+4]]+$r[n[e+5]]+"-"+$r[n[e+6]]+$r[n[e+7]]+"-"+$r[n[e+8]]+$r[n[e+9]]+"-"+$r[n[e+10]]+$r[n[e+11]]+$r[n[e+12]]+$r[n[e+13]]+$r[n[e+14]]+$r[n[e+15]]).toLowerCase()}o(QF,"unsafeStringify");var KF=require("node:crypto");var Og=new Uint8Array(256),Rg=Og.length;function s2(){return Rg>Og.length-16&&((0,KF.randomFillSync)(Og),Rg=0),Og.slice(Rg,Rg+=16)}o(s2,"rng");var YF=require("node:crypto"),a2={randomUUID:YF.randomUUID};function vY(n,e,t){n=n||{};let r=n.random??n.rng?.()??s2();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return QF(r)}o(vY,"_v4");function EY(n,e,t){return a2.randomUUID&&!e&&!n?a2.randomUUID():vY(n,e,t)}o(EY,"v4");var o2=EY;var Fg=le(fr());var TY="de20a3f1-7483-4714-ab28-b45f5cf02c76",AY="Asia/Almaty",Pg=class{constructor(e,t,r,i){this.fsAdapter=e;this.classResolver=t;this.wikilinkValidator=r;this.shapeRegistry=i}static{o(this,"AssetCreationService")}async create(e){if(!e.label||e.label.trim().length===0)throw new Error("Label cannot be empty");let t=e.label.trim(),r=await this.classResolver.resolve(e.vault,e.classShortName);e.properties&&!e.skipWikilinkValidation&&await this.wikilinkValidator.validatePropertyValues(e.properties);let i=o2(),s=this.generateTimestamp(e.timezone),a=this.buildFrontmatter({assetUuid:i,classShortName:e.classShortName,classUuid:r,label:t,aliases:e.aliases,properties:e.properties,createdBy:e.createdBy||TY,timestamp:s}),c=Fg.MetadataHelpers.buildFileContent(a,e.body),l=`01 Inbox/${i}.md`;return e.dryRun||await this.fsAdapter.createFile(l,c),{uuid:i,path:l,label:t,frontmatter:a}}buildFrontmatter(e){let t={};t.exo__Asset_uid=e.assetUuid,t.exo__Asset_label=e.label,t.exo__Asset_createdAt=e.timestamp,t.exo__Asset_createdBy=`"[[${e.createdBy}]]"`,t.exo__Instance_class=[`"[[${e.classUuid}|${e.classShortName}]]"`];let r=[e.label];if(e.aliases&&e.aliases.length>0)for(let i of e.aliases)r.includes(i)||r.push(i);if(t.aliases=r,e.properties)for(let[i,s]of Object.entries(e.properties))i==="exo__Asset_uid"||i==="exo__Asset_label"||i==="exo__Asset_createdAt"||i==="exo__Asset_createdBy"||i==="exo__Instance_class"||i==="aliases"||(t[i]=this.formatPropertyValue(i,s));return t}formatPropertyValue(e,t){if(!t.includes("[["))return t;let r=t.startsWith('"')&&t.endsWith('"')?t:`"${t}"`;return this.isSingleValued(e)?r:[r]}isSingleValued(e){if(!this.shapeRegistry)return!1;let t=Fg.Namespace.fromPropertyKey(e);if(!t)return!1;let r=t.namespace.term(t.localName).value;return this.shapeRegistry.get(r)?.cardinality==="Single"}generateTimestamp(e){let t=e||AY,r=new Date,s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(r),a=o(c=>s.find(l=>l.type===c)?.value||"00","get");return`${a("year")}-${a("month")}-${a("day")}T${a("hour")}:${a("minute")}:${a("second")}`}};function xY(n){if(!n||n.length===0)return{};let e={};for(let t of n){let r=t.indexOf("=");if(r===-1)throw new Error(`Invalid property format: "${t}". Expected "key=value" format.`);let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();if(!i)throw new Error(`Invalid property format: "${t}". Key cannot be empty.`);e[i]=s}return e}o(xY,"parseProperties");async function IY(n){if(n.bodyFile){if(!(0,c2.existsSync)(n.bodyFile))throw new Error(`Body file not found: ${n.bodyFile}`);return(0,JF.readFileSync)(n.bodyFile,"utf-8")}if(n.body==="-")return CY(3e4);if(n.body)return n.body}o(IY,"resolveBody");function CY(n){return new Promise((e,t)=>{let r=[],i=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.destroy(),t(new Error(`Stdin read timed out after ${n}ms. Ensure you pipe content to stdin or close the pipe.`))},n);process.stdin.on("data",s=>{r.push(s)}),process.stdin.on("end",()=>{clearTimeout(i),e(Buffer.concat(r).toString("utf-8"))}),process.stdin.on("error",s=>{clearTimeout(i),t(s)}),process.stdin.isTTY&&(clearTimeout(i),e("")),process.stdin.resume()})}o(CY,"readStdin");function eD(){return new Ie("create").description("Create a new vault asset with auto-generated UUID, timestamp, and frontmatter").requiredOption("--class <name>","Class short name (e.g. ztlk__PermanentNote) or UUID").requiredOption("--label <text>","Human-readable label for the asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--aliases <names...>","Additional aliases for the asset").option("--property <key=value...>","Property key-value pairs (repeatable)",RY,[]).option("--body <text>","Markdown body content (use '-' to read from stdin)").option("--body-file <path>","Read body content from file").option("--dry-run","Preview frontmatter without writing file").option("--created-by <uuid>","Creator UUID (defaults to ExoAssistant)").option("--timezone <tz>","Timezone for timestamps (defaults to Asia/Almaty)").option("--skip-wikilink-validation","Skip wikilink existence validation").action(async n=>{try{let e=(0,XF.resolve)(n.vault);if(!(0,c2.existsSync)(e))throw new Pe(e);let t=xY(n.property),r=await IY(n);r&&(r=r.replace(/\\n/g,`
|
|
674
674
|
`));let i=new pr(e),s=new Gl(i),a=new Cg(i),c;try{c=await ZF.ShapeLoader.loadFromVaultFS(e)}catch{c=void 0}let u=await new Pg(i,s,a,c).create({classShortName:n.class,label:n.label,aliases:n.aliases,properties:Object.keys(t).length>0?t:void 0,body:r,vault:e,dryRun:n.dryRun,createdBy:n.createdBy,timezone:n.timezone,skipWikilinkValidation:n.skipWikilinkValidation});if(n.dryRun){let d=OY(u.frontmatter,r);process.stderr.write(d+`
|
|
675
675
|
`)}let f={uuid:u.uuid,path:u.path,label:u.label};process.stdout.write(JSON.stringify(f)+`
|
|
676
676
|
`),process.exit(0)}catch(e){pe.handle(e)}})}o(eD,"createCommand");function RY(n,e){return e.concat([n])}o(RY,"collect");function OY(n,e){let t=["--- DRY RUN PREVIEW ---","---"];for(let[r,i]of Object.entries(n))if(Array.isArray(i)){t.push(`${r}:`);for(let s of i)t.push(` - ${s}`)}else t.push(`${r}: ${i}`);return t.push("---"),e&&(t.push(""),t.push(e)),t.push("--- END PREVIEW ---"),t.join(`
|
|
@@ -678,7 +678,7 @@ Available classes: ${t.join(", ")}`),super(r),this.name="ClassNotFoundError"}},G
|
|
|
678
678
|
${rr.dump(i,{lineWidth:-1})}---
|
|
679
679
|
`}async transferFile(e,t){let r=e.content,i=e.metadata.exo__Asset_isDefinedBy;if(i){let a=this.extractWikilinkTarget(String(i));if(a){let c=this.getArchiveOntologyName(a);r=r.replace(String(i),String(i).replace(a,c))}}let s=e.uuid+".md";await this.archiveFs.writeFile(s,r),await this.activeFs.deleteFile(e.relativePath)}extractWikilinkTarget(e){let t=e.match(/\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/);return t?t[1]:null}extractFrontmatter(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};try{let r=rr.load(t[1]);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}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 l2=le(require("path"));var Ng=class{constructor(e,t){this.activeFs=e;this.archiveFs=t}static{o(this,"ArchiveVerifyService")}async verify(){let e=await this.activeFs.getMarkdownFiles(),t=await this.archiveFs.getMarkdownFiles(),r=new Set;for(let l of t){let u=l2.default.basename(l,".md");this.isUUID(u)&&r.add(u.toLowerCase())}let i=[],s=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;for(let l of e)try{let u=await this.activeFs.readFile(l);if(this.extractFrontmatter(u).archived===!0)continue;let d=u.match(s);if(d){let h=new Set;for(let p of d){let y=p.toLowerCase();r.has(y)&&!h.has(y)&&(h.add(y),i.push({uuid:y,referenced_from:l}))}}}catch{continue}let a=await this.checkArchiveOntologies(t),c=i.length===0&&a.length===0;return{broken_links:i.length,broken_link_details:i,missing_ontologies:a,stats:{active_files:e.length,archive_files:t.length},ok:c}}async checkArchiveOntologies(e){let t=new Set;for(let i of e)if(!l2.default.basename(i,".md").startsWith("!"))try{let a=await this.archiveFs.readFile(i),l=this.extractFrontmatter(a).exo__Asset_isDefinedBy;if(l){let u=this.extractWikilinkTarget(String(l));if(u&&u.startsWith("!")){let f=u.endsWith("_archive")?u:u+"_archive";t.add(f)}}}catch{continue}let r=[];for(let i of t){let s=i+".md";await this.archiveFs.fileExists(s)||r.push(i)}return r.sort()}extractWikilinkTarget(e){let t=e.match(/\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/);return t?t[1]:null}extractFrontmatter(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};try{let r=rr.load(t[1]);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}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 rD=le(require("path"));var u2=100,Lg=class{constructor(e,t){this.activeFs=e;this.archiveFs=t}static{o(this,"ArchiveCascadeService")}async cascade(e){let t={iterations:0,total_moved:0,still_blocked:0,iterations_detail:[]};for(let r=0;r<u2;r++){let i=await this.activeFs.getMarkdownFiles(),s=await this.readAllFiles(i),a=s.filter(d=>d.isArchived&&d.uuid),c=s.filter(d=>!d.isArchived);if(a.length===0)break;let l=this.buildReferenceSet(c.map(d=>d.content)),u=a.filter(d=>!l.has(d.uuid.toLowerCase()));if(u.length===0){t.still_blocked=a.length;break}let f=[];if(e.dryRun)for(let d of u)f.push(d.uuid);else{await this.createArchiveOntologies(u);for(let d of u)await this.transferFile(d),f.push(d.uuid)}if(t.iterations++,t.total_moved+=f.length,t.iterations_detail.push({iteration:t.iterations,moved:f}),e.dryRun){let d=a.length-u.length;t.still_blocked=d;break}}if(t.iterations>=u2)throw new Error(`MAX_ITERATIONS (${u2}) exceeded during cascade archive. This likely indicates a bug. Moved ${t.total_moved} assets before stopping.`);if(t.iterations>0&&t.still_blocked===0&&!e.dryRun){let r=await this.activeFs.getMarkdownFiles(),i=await this.readAllFiles(r);t.still_blocked=i.filter(s=>s.isArchived&&s.uuid).length}return t}async readAllFiles(e){let t=[];for(let r of e)try{let i=await this.activeFs.readFile(r),s=this.extractFrontmatter(i),a=s.archived===!0,c=this.extractUUID(r,s);t.push({relativePath:r,uuid:c||"",metadata:s,content:i,isArchived:a})}catch{continue}return t}buildReferenceSet(e){let t=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,r=new Set;for(let i of e){let s=i.match(t);if(s)for(let a of s)r.add(a.toLowerCase())}return r}async createArchiveOntologies(e){let t=this.collectOntologies(e),r=0;for(let[i]of t.entries()){let s=i+"_archive",a=s+".md";if(!await this.archiveFs.fileExists(a))try{let l=await this.activeFs.readFile(i+".md"),u=this.extractFrontmatter(l),f=u.exo__Ontology_url;if(f){let d=String(f).replace(/#$/,"")+"/archive#",h=this.buildOntologyFile(s,d,u);await this.archiveFs.writeFile(a,h),r++}}catch{continue}}return r}collectOntologies(e){let t=new Map;for(let r of e){let i=r.metadata.exo__Asset_isDefinedBy;if(!i)continue;let s=this.extractWikilinkTarget(String(i));if(!s)continue;let a=t.get(s)||[];a.push(r),t.set(s,a)}return t}buildOntologyFile(e,t,r){let i={exo__Instance_class:r.exo__Instance_class||"exo__Ontology",exo__Asset_label:`${r.exo__Asset_label||e} (Archive)`,exo__Ontology_url:t};return`---
|
|
680
680
|
${rr.dump(i,{lineWidth:-1})}---
|
|
681
|
-
`}async transferFile(e){let t=e.content,r=e.metadata.exo__Asset_isDefinedBy;if(r){let s=this.extractWikilinkTarget(String(r));if(s){let a=s+"_archive";t=t.replace(String(r),String(r).replace(s,a))}}let i=e.uuid+".md";await this.archiveFs.writeFile(i,t),await this.activeFs.deleteFile(e.relativePath)}extractWikilinkTarget(e){let t=e.match(/\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/);return t?t[1]:null}extractFrontmatter(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};try{let r=rr.load(t[1]);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}extractUUID(e,t){let r=t.exo__Asset_uid;if(r)return String(r);let i=rD.default.basename(e,".md");return this.isUUID(i)?i:null}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 kg=class{constructor(e){this.fs=e}static{o(this,"ArchiveStatsService")}async collect(){let e=await this.fs.getMarkdownFiles(),t={total:0,by_class:{},by_year:{},cross:{}};for(let r of e)try{let i=await this.fs.readFile(r),s=this.extractFrontmatter(i);t.total++;let a=this.extractClass(s);t.by_class[a]=(t.by_class[a]??0)+1;let c=this.extractYear(s);t.by_year[c]=(t.by_year[c]??0)+1,t.cross[a]||(t.cross[a]={}),t.cross[a][c]=(t.cross[a][c]??0)+1}catch{continue}return t}extractClass(e){let t=e.exo__Instance_class;if(!t)return"unknown";let r=Array.isArray(t)?t[0]:t,i=String(r).replace(/^"|"$/g,""),s=i.match(/\[\[[^\]|]+\|([^\]]+)\]\]/);if(s)return s[1];let a=i.match(/\[\[([^\]]+)\]\]/);return a?a[1]:i||"unknown"}extractYear(e){let t=e.ems__Effort_resolutionTimestamp??e.ems__Effort_endTimestamp;if(!t)return"unknown";if(t instanceof Date){let s=t.getFullYear();return isNaN(s)?"unknown":s.toString()}let i=String(t).match(/^(\d{4})/);return i?i[1]:"unknown"}extractFrontmatter(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};try{let r=rr.load(t[1]);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}};function nD(){return new Ie("archive").description("Archive assets from active vault to archive vault (automated asset archival)").requiredOption("--vault <path>","Path to the active vault").requiredOption("--archive-vault <path>","Path to the archive vault").option("--class <names>","Comma-separated class short names or UUIDs (e.g. ems__Task,ems__Meeting)").option("--year <year>","Filter by resolution/end timestamp year (e.g. 2025)").option("--dry-run","Preview without writing files",!1).option("--no-referenced","Skip assets referenced by non-archived (default: true)").option("--verify","Verify archive integrity instead of archiving (read-only)",!1).option("--cascade","Iteratively resolve archived-to-archived chains (no --class/--year needed)",!1).option("--stats","Print archive vault statistics by class and year (read-only)",!1).action(async n=>{try{let e=(0,f2.resolve)(n.vault);if(!(0,d2.existsSync)(e))throw new
|
|
681
|
+
`}async transferFile(e){let t=e.content,r=e.metadata.exo__Asset_isDefinedBy;if(r){let s=this.extractWikilinkTarget(String(r));if(s){let a=s+"_archive";t=t.replace(String(r),String(r).replace(s,a))}}let i=e.uuid+".md";await this.archiveFs.writeFile(i,t),await this.activeFs.deleteFile(e.relativePath)}extractWikilinkTarget(e){let t=e.match(/\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/);return t?t[1]:null}extractFrontmatter(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};try{let r=rr.load(t[1]);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}extractUUID(e,t){let r=t.exo__Asset_uid;if(r)return String(r);let i=rD.default.basename(e,".md");return this.isUUID(i)?i:null}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 kg=class{constructor(e){this.fs=e}static{o(this,"ArchiveStatsService")}async collect(){let e=await this.fs.getMarkdownFiles(),t={total:0,by_class:{},by_year:{},cross:{}};for(let r of e)try{let i=await this.fs.readFile(r),s=this.extractFrontmatter(i);t.total++;let a=this.extractClass(s);t.by_class[a]=(t.by_class[a]??0)+1;let c=this.extractYear(s);t.by_year[c]=(t.by_year[c]??0)+1,t.cross[a]||(t.cross[a]={}),t.cross[a][c]=(t.cross[a][c]??0)+1}catch{continue}return t}extractClass(e){let t=e.exo__Instance_class;if(!t)return"unknown";let r=Array.isArray(t)?t[0]:t,i=String(r).replace(/^"|"$/g,""),s=i.match(/\[\[[^\]|]+\|([^\]]+)\]\]/);if(s)return s[1];let a=i.match(/\[\[([^\]]+)\]\]/);return a?a[1]:i||"unknown"}extractYear(e){let t=e.ems__Effort_resolutionTimestamp??e.ems__Effort_endTimestamp;if(!t)return"unknown";if(t instanceof Date){let s=t.getFullYear();return isNaN(s)?"unknown":s.toString()}let i=String(t).match(/^(\d{4})/);return i?i[1]:"unknown"}extractFrontmatter(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};try{let r=rr.load(t[1]);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}};function nD(){return new Ie("archive").description("Archive assets from active vault to archive vault (automated asset archival)").requiredOption("--vault <path>","Path to the active vault").requiredOption("--archive-vault <path>","Path to the archive vault").option("--class <names>","Comma-separated class short names or UUIDs (e.g. ems__Task,ems__Meeting)").option("--year <year>","Filter by resolution/end timestamp year (e.g. 2025)").option("--dry-run","Preview without writing files",!1).option("--no-referenced","Skip assets referenced by non-archived (default: true)").option("--verify","Verify archive integrity instead of archiving (read-only)",!1).option("--cascade","Iteratively resolve archived-to-archived chains (no --class/--year needed)",!1).option("--stats","Print archive vault statistics by class and year (read-only)",!1).action(async n=>{try{let e=(0,f2.resolve)(n.vault);if(!(0,d2.existsSync)(e))throw new Pe(e);let t=(0,f2.resolve)(n.archiveVault);if(!(0,d2.existsSync)(t))throw new Pe(t);if(n.stats){let h=new pr(t),y=await new kg(h).collect();process.stderr.write(PY(y)),process.stdout.write(JSON.stringify(y)+`
|
|
682
682
|
`),process.exit(0)}if(n.verify){let h=new pr(e),p=new pr(t),S=await new Ng(h,p).verify();process.stdout.write(JSON.stringify(S,null,2)+`
|
|
683
683
|
`),process.exit(S.ok?0:1)}if(n.cascade){let h=new pr(e),p=new pr(t),S=await new Lg(h,p).cascade({vaultPath:e,archiveVaultPath:t,dryRun:n.dryRun||!1});n.dryRun&&(process.stderr.write(`--- CASCADE DRY RUN PREVIEW ---
|
|
684
684
|
`),process.stderr.write(`Would move: ${S.total_moved} assets
|
|
@@ -695,20 +695,20 @@ ${rr.dump(i,{lineWidth:-1})}---
|
|
|
695
695
|
`)),process.stdout.write(JSON.stringify(d)+`
|
|
696
696
|
`),process.exit(0)}catch(e){pe.handle(e)}})}o(nD,"archiveCommand");function PY(n){let e=["--- ARCHIVE STATS ---"];if(e.push(`Total assets: ${n.total}`),Object.keys(n.by_class).length>0){e.push(""),e.push("By class:");let t=Object.entries(n.by_class).sort((r,i)=>i[1]-r[1]);for(let[r,i]of t)e.push(` ${r}: ${i}`)}if(Object.keys(n.by_year).length>0){e.push(""),e.push("By year:");let t=Object.entries(n.by_year).sort((r,i)=>r[0].localeCompare(i[0]));for(let[r,i]of t)e.push(` ${r}: ${i}`)}return e.push("--- END STATS ---"),e.join(`
|
|
697
697
|
`)+`
|
|
698
|
-
`}o(PY,"formatStatsSummary");var p2=require("path"),m2=require("fs");var h2=le(require("path"));var jg=class{constructor(e,t){this.activeFs=e;this.archiveFs=t}static{o(this,"UnarchiveService")}async unarchive(e){let{uuid:t,dryRun:r}=e,i=await this.findAssetByUUID(t);if(!i)return{success:!1,uuid:t,error:`UUID ${t} not found in archive vault`};let s=await this.archiveFs.readFile(i),c=this.extractFrontmatter(s).exo__Asset_isDefinedBy,l=c?this.resolveActiveOntology(String(c)):null,u=h2.default.join("03 Knowledge","inbox",h2.default.basename(i));if(r)return{success:!0,uuid:t,movedTo:u,isDefinedBy:l||void 0};let f=s;return c&&l&&(f=f.replace(String(c),l)),await this.activeFs.writeFile(u,f),await this.archiveFs.deleteFile(i),{success:!0,uuid:t,movedTo:u,isDefinedBy:l||void 0}}async findAssetByUUID(e){let t=e+".md";if(await this.archiveFs.fileExists(t))return t;let i=await this.archiveFs.getMarkdownFiles();for(let s of i)try{let a=await this.archiveFs.readFile(s),l=this.extractFrontmatter(a).exo__Asset_uid;if(l&&String(l).toLowerCase()===e.toLowerCase())return s}catch{continue}return null}resolveActiveOntology(e){let t=e.match(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/);if(!t)return null;let r=t[1],i=t[2];if(!r.endsWith("_archive"))return e;let s=r.replace(/_archive$/,"");if(i){let a=i.replace(/\s*\(Archive\)$/,"");return`[[${s}|${a}]]`}return`[[${s}]]`}extractFrontmatter(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};try{let r=rr.load(t[1]);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}};function iD(){return new Ie("unarchive").description("Restore asset from archive vault to active vault (reverse of archive)").requiredOption("--uuid <uuid>","UUID of the asset to restore").requiredOption("--vault <path>","Path to the active vault").requiredOption("--archive-vault <path>","Path to the archive vault").option("--dry-run","Preview without writing files",!1).action(async n=>{try{let e=(0,p2.resolve)(n.vault);if(!(0,m2.existsSync)(e))throw new
|
|
698
|
+
`}o(PY,"formatStatsSummary");var p2=require("path"),m2=require("fs");var h2=le(require("path"));var jg=class{constructor(e,t){this.activeFs=e;this.archiveFs=t}static{o(this,"UnarchiveService")}async unarchive(e){let{uuid:t,dryRun:r}=e,i=await this.findAssetByUUID(t);if(!i)return{success:!1,uuid:t,error:`UUID ${t} not found in archive vault`};let s=await this.archiveFs.readFile(i),c=this.extractFrontmatter(s).exo__Asset_isDefinedBy,l=c?this.resolveActiveOntology(String(c)):null,u=h2.default.join("03 Knowledge","inbox",h2.default.basename(i));if(r)return{success:!0,uuid:t,movedTo:u,isDefinedBy:l||void 0};let f=s;return c&&l&&(f=f.replace(String(c),l)),await this.activeFs.writeFile(u,f),await this.archiveFs.deleteFile(i),{success:!0,uuid:t,movedTo:u,isDefinedBy:l||void 0}}async findAssetByUUID(e){let t=e+".md";if(await this.archiveFs.fileExists(t))return t;let i=await this.archiveFs.getMarkdownFiles();for(let s of i)try{let a=await this.archiveFs.readFile(s),l=this.extractFrontmatter(a).exo__Asset_uid;if(l&&String(l).toLowerCase()===e.toLowerCase())return s}catch{continue}return null}resolveActiveOntology(e){let t=e.match(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/);if(!t)return null;let r=t[1],i=t[2];if(!r.endsWith("_archive"))return e;let s=r.replace(/_archive$/,"");if(i){let a=i.replace(/\s*\(Archive\)$/,"");return`[[${s}|${a}]]`}return`[[${s}]]`}extractFrontmatter(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};try{let r=rr.load(t[1]);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}};function iD(){return new Ie("unarchive").description("Restore asset from archive vault to active vault (reverse of archive)").requiredOption("--uuid <uuid>","UUID of the asset to restore").requiredOption("--vault <path>","Path to the active vault").requiredOption("--archive-vault <path>","Path to the archive vault").option("--dry-run","Preview without writing files",!1).action(async n=>{try{let e=(0,p2.resolve)(n.vault);if(!(0,m2.existsSync)(e))throw new Pe(e);let t=(0,p2.resolve)(n.archiveVault);if(!(0,m2.existsSync)(t))throw new Pe(t);if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.uuid))throw new Error(`Invalid UUID format: ${n.uuid}. Expected format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`);let i=new pr(e),s=new pr(t),c=await new jg(i,s).unarchive({uuid:n.uuid,vaultPath:e,archiveVaultPath:t,dryRun:n.dryRun||!1});c.success||(process.stdout.write(JSON.stringify({error:c.error})+`
|
|
699
699
|
`),process.exit(1)),n.dryRun&&(process.stderr.write(`--- DRY RUN PREVIEW ---
|
|
700
700
|
`),process.stderr.write(`Would restore: ${c.uuid}
|
|
701
701
|
`),process.stderr.write(`Target: ${c.movedTo}
|
|
702
702
|
`),c.isDefinedBy&&process.stderr.write(`isDefinedBy: ${c.isDefinedBy}
|
|
703
703
|
`),process.stderr.write(`--- END PREVIEW ---
|
|
704
704
|
`)),process.stdout.write(JSON.stringify(c)+`
|
|
705
|
-
`),process.exit(0)}catch(e){pe.handle(e)}})}o(iD,"unarchiveCommand");var pa=require("fs"),Hl=require("path"),Sn=le(fr());function aD(){let n=new Ie("workflow").description("Manage custom workflow definitions");return n.command("list").description("List all workflow definitions in the vault").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async e=>{let t=e.output||"text";pe.setFormat(t);try{let r=(0,Hl.resolve)(e.vault);if(!(0,pa.existsSync)(r))throw new
|
|
705
|
+
`),process.exit(0)}catch(e){pe.handle(e)}})}o(iD,"unarchiveCommand");var pa=require("fs"),Hl=require("path"),Sn=le(fr());function aD(){let n=new Ie("workflow").description("Manage custom workflow definitions");return n.command("list").description("List all workflow definitions in the vault").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async e=>{let t=e.output||"text";pe.setFormat(t);try{let r=(0,Hl.resolve)(e.vault);if(!(0,pa.existsSync)(r))throw new Pe(r);let i=cD(r);if(t==="json"){let s=Oe.success({workflows:i,totalWorkflows:i.length});console.log(JSON.stringify(s,null,2))}else{if(i.length===0){console.log("No workflows found in vault.");return}console.log(`
|
|
706
706
|
\u{1F4CB} Found ${i.length} workflow(s):
|
|
707
|
-
`);let s=Math.max(...i.map(c=>c.label.length),4),a=Math.max(...i.map(c=>c.targetClass.length),12);console.log("\u250C"+"\u2500".repeat(s+2)+"\u252C"+"\u2500".repeat(a+2)+"\u252C"+"\u2500".repeat(8)+"\u252C"+"\u2500".repeat(13)+"\u252C"+"\u2500".repeat(9)+"\u2510"),console.log("\u2502 "+"Name".padEnd(s)+" \u2502 "+"Target Class".padEnd(a)+" \u2502 "+"States".padEnd(6)+" \u2502 "+"Transitions".padEnd(11)+" \u2502 "+"Default".padEnd(7)+" \u2502"),console.log("\u251C"+"\u2500".repeat(s+2)+"\u253C"+"\u2500".repeat(a+2)+"\u253C"+"\u2500".repeat(8)+"\u253C"+"\u2500".repeat(13)+"\u253C"+"\u2500".repeat(9)+"\u2524");for(let c of i)console.log("\u2502 "+c.label.padEnd(s)+" \u2502 "+c.targetClass.padEnd(a)+" \u2502 "+c.stateCount.toString().padStart(6)+" \u2502 "+c.transitionCount.toString().padStart(11)+" \u2502 "+(c.isDefault?" yes ":" no ")+" \u2502");console.log("\u2514"+"\u2500".repeat(s+2)+"\u2534"+"\u2500".repeat(a+2)+"\u2534"+"\u2500".repeat(8)+"\u2534"+"\u2500".repeat(13)+"\u2534"+"\u2500".repeat(9)+"\u2518")}}catch(r){pe.handle(r)}}),n.command("show").description("Show details of a workflow definition").argument("<uid>","UID of the workflow asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async(e,t)=>{let r=t.output||"text";pe.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,pa.existsSync)(i))throw new
|
|
707
|
+
`);let s=Math.max(...i.map(c=>c.label.length),4),a=Math.max(...i.map(c=>c.targetClass.length),12);console.log("\u250C"+"\u2500".repeat(s+2)+"\u252C"+"\u2500".repeat(a+2)+"\u252C"+"\u2500".repeat(8)+"\u252C"+"\u2500".repeat(13)+"\u252C"+"\u2500".repeat(9)+"\u2510"),console.log("\u2502 "+"Name".padEnd(s)+" \u2502 "+"Target Class".padEnd(a)+" \u2502 "+"States".padEnd(6)+" \u2502 "+"Transitions".padEnd(11)+" \u2502 "+"Default".padEnd(7)+" \u2502"),console.log("\u251C"+"\u2500".repeat(s+2)+"\u253C"+"\u2500".repeat(a+2)+"\u253C"+"\u2500".repeat(8)+"\u253C"+"\u2500".repeat(13)+"\u253C"+"\u2500".repeat(9)+"\u2524");for(let c of i)console.log("\u2502 "+c.label.padEnd(s)+" \u2502 "+c.targetClass.padEnd(a)+" \u2502 "+c.stateCount.toString().padStart(6)+" \u2502 "+c.transitionCount.toString().padStart(11)+" \u2502 "+(c.isDefault?" yes ":" no ")+" \u2502");console.log("\u2514"+"\u2500".repeat(s+2)+"\u2534"+"\u2500".repeat(a+2)+"\u2534"+"\u2500".repeat(8)+"\u2534"+"\u2500".repeat(13)+"\u2534"+"\u2500".repeat(9)+"\u2518")}}catch(r){pe.handle(r)}}),n.command("show").description("Show details of a workflow definition").argument("<uid>","UID of the workflow asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async(e,t)=>{let r=t.output||"text";pe.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,pa.existsSync)(i))throw new Pe(i);let s=sD(i,e);if(!s){if(r==="json"){let a=Oe.success({error:`Workflow with UID "${e}" not found`});console.log(JSON.stringify(a,null,2))}else console.log(`\u274C Workflow with UID "${e}" not found.`);process.exitCode=1;return}if(r==="json"){let a=Oe.success(s);console.log(JSON.stringify(a,null,2))}else{console.log(`
|
|
708
708
|
\u{1F4CB} Workflow: ${s.name}
|
|
709
709
|
`),console.log(` ID: ${s.id}`),console.log(` Target class: ${s.targetClass}`),console.log(` Initial state: ${s.initialState}`),console.log(` Terminal states: ${s.terminalStates.join(", ")}`),console.log(` Default: ${s.isDefault?"yes":"no"}`),console.log(`
|
|
710
710
|
States (${s.states.length}):`);for(let a of s.states){let c=a.optional?" (optional)":"",l=a.timestampOnEnter.length>0?` [timestamps: ${a.timestampOnEnter.join(", ")}]`:"";console.log(` ${a.order}. ${a.status}${c}${l}`)}console.log(`
|
|
711
|
-
Transitions (${s.transitions.length}):`);for(let a of s.transitions){let c=a.isRollback?" (rollback)":"";console.log(` ${a.label}: ${a.from} \u2192 ${a.to}${c}`)}}}catch(i){pe.handle(i)}}),n.command("validate").description("Validate a workflow definition").argument("<uid>","UID of the workflow asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async(e,t)=>{let r=t.output||"text";pe.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,pa.existsSync)(i))throw new
|
|
711
|
+
Transitions (${s.transitions.length}):`);for(let a of s.transitions){let c=a.isRollback?" (rollback)":"";console.log(` ${a.label}: ${a.from} \u2192 ${a.to}${c}`)}}}catch(i){pe.handle(i)}}),n.command("validate").description("Validate a workflow definition").argument("<uid>","UID of the workflow asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async(e,t)=>{let r=t.output||"text";pe.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,pa.existsSync)(i))throw new Pe(i);let s=sD(i,e);if(!s){if(r==="json"){let l=Oe.success({error:`Workflow with UID "${e}" not found`});console.log(JSON.stringify(l,null,2))}else console.log(`\u274C Workflow with UID "${e}" not found.`);process.exitCode=1;return}let c=new Sn.WorkflowEngine(s).validate();if(r==="json"){let l=Oe.success({workflow:s.name,uid:s.id,...c});console.log(JSON.stringify(l,null,2))}else if(c.valid)console.log(`\u2705 Workflow "${s.name}" is valid.`);else{console.log(`\u274C Workflow "${s.name}" has ${c.errors.length} error(s):
|
|
712
712
|
`);for(let l of c.errors)console.log(` \u2022 ${l}`);process.exitCode=1}}catch(i){pe.handle(i)}}),n}o(aD,"workflowCommand");var oD=new Sn.FrontmatterService;function cD(n){let e=[],t=[];lD(n,t);let r=new Map;for(let{fm:l}of t){let u=l.exo__Asset_uid,f=l.exo__Asset_label;u&&f&&r.set(String(u),String(f))}let i=o(l=>r.get(l)??null,"resolver"),s=o(l=>{let u=Sn.WikiLinkHelpers.resolveSymbolic(typeof l=="string"?l:String(l??""),i);return u.includes("ems__Workflow")&&!u.includes("WorkflowState")&&!u.includes("WorkflowTransition")},"isWorkflowClass"),a=o(l=>Sn.WikiLinkHelpers.resolveSymbolic(typeof l=="string"?l:String(l??""),i).includes("ems__WorkflowState"),"isWorkflowStateClass"),c=o(l=>Sn.WikiLinkHelpers.resolveSymbolic(typeof l=="string"?l:String(l??""),i).includes("ems__WorkflowTransition"),"isWorkflowTransitionClass");for(let{filePath:l,fm:u}of t){let f=u.exo__Instance_class;if(!f||!(Array.isArray(f)?f.some(s):s(f)))continue;let h=u.exo__Asset_uid??"",p=u.exo__Asset_label??FY(l),y=ha(u.ems__Workflow_targetClass??"ems__Task"),S=u.ems__Workflow_isDefault===!0||u.ems__Workflow_isDefault==="true",v=0,w=0;for(let{fm:T}of t){let C=T.exo__Instance_class;if(!ha(T.ems__WorkflowState_workflow??T.ems__WorkflowTransition_workflow??"").includes(h))continue;let ee=Array.isArray(C)?C.some(a):a(C),B=Array.isArray(C)?C.some(c):c(C);ee&&v++,B&&w++}e.push({filePath:l,uid:h,label:p,targetClass:y,isDefault:S,stateCount:v,transitionCount:w})}return e}o(cD,"scanWorkflows");function lD(n,e){let t;try{t=(0,pa.readdirSync)(n,{withFileTypes:!0})}catch{return}for(let r of t){let i=(0,Hl.join)(n,r.name);if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;lD(i,e)}else if(r.name.endsWith(".md"))try{let s=(0,pa.readFileSync)(i,"utf-8"),a=oD.parse(s);a.exists&&e.push({filePath:i,fm:uD(a.content)})}catch{}}}o(lD,"collectParsedFiles");function sD(n,e){let r=cD(n).find(i=>i.uid===e);if(!r)return null;try{let i=(0,pa.readFileSync)(r.filePath,"utf-8"),s=oD.parse(i);if(!s.exists)return null;let a=uD(s.content),c=ha(a.ems__Workflow_targetClass??"ems__Task"),l=ha(a.ems__Workflow_initialState??"ems__EffortStatusDraft"),u=zl(l)??Sn.EffortStatus.DRAFT,d=(Array.isArray(a.ems__Workflow_terminalStates)?a.ems__Workflow_terminalStates.map(w=>ha(w)):[]).map(zl).filter(w=>w!==null),h=a.ems__Workflow_isDefault===!0||a.ems__Workflow_isDefault==="true",y=(Array.isArray(a.ems__Workflow_states)?a.ems__Workflow_states:[]).map((w,T)=>typeof w=="string"?{status:zl(ha(w))??Sn.EffortStatus.DRAFT,order:T+1,optional:!1,timestampOnEnter:[]}:{status:zl(ha(w.status??""))??Sn.EffortStatus.DRAFT,order:w.order??T+1,optional:w.optional===!0||w.optional==="true",timestampOnEnter:Array.isArray(w.timestampOnEnter)?w.timestampOnEnter:[],badgeColor:w.badgeColor}),v=(Array.isArray(a.ems__Workflow_transitions)?a.ems__Workflow_transitions:[]).map(w=>{let T=zl(ha(w.from??"")),C=zl(ha(w.to??""));return!T||!C?null:{from:T,to:C,label:w.label??`${T} \u2192 ${C}`,icon:w.icon,isRollback:w.isRollback===!0||w.isRollback==="true"}}).filter(w=>w!==null);return{id:e,name:r.label,targetClass:c,states:y,transitions:v,initialState:u,terminalStates:d.length>0?d:[Sn.EffortStatus.DONE,Sn.EffortStatus.TRASHED],isDefault:h}}catch{return null}}o(sD,"loadWorkflowByUid");function uD(n){let e={},t=n.split(`
|
|
713
713
|
`),r="",i=null;for(let s of t){if(s.match(/^\s+-\s+/)&&r){let c=s.replace(/^\s+-\s+/,"").trim();i||(i=[]),i.push(c),e[r]=i;continue}let a=s.match(/^([a-zA-Z0-9_]+):\s*(.*)/);if(a){r=a[1],i=null;let c=a[2].trim();if((c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),c==="true"?c=!0:c==="false"&&(c=!1),c===""){e[r]=[],i=e[r];continue}e[r]=c}}return e}o(uD,"parseYamlFrontmatter");function ha(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(ha,"normalizeWikilink");function FY(n){let e=n.split("/");return e[e.length-1].replace(/\.md$/,"")}o(FY,"extractLabelFromFilename");function zl(n){return Object.values(Sn.EffortStatus).includes(n)?n:null}o(zl,"resolveEffortStatus");var mD=require("path"),gD=require("fs");var dD=require("node:crypto");function Qf(n){if(typeof n!="string")return null;let e=n.trim();if(e.length===0)return null;let t=e.match(/^\[\[([^|\]]+)(?:\|[^\]]*)?\]\]$/);return t?t[1].trim():e}o(Qf,"wikilinkInner");function DY(n){if(!Array.isArray(n))return[];let e=[];for(let t of n)typeof t=="string"&&t.trim().length>0&&e.push(t.trim());return e}o(DY,"normaliseColumns");function NY(n){if(Array.isArray(n))return n.map(e=>typeof e=="string"?Qf(e):null).filter(e=>e!==null);if(typeof n=="string"){let e=Qf(n);return e?[e]:[]}return[]}o(NY,"normaliseInstanceClass");function hD(n){let e=NY(n.exo__Instance_class);for(let t of e)if(t==="ui__RelationColumnSet"||t==="97fc9862-c886-4d86-9a60-e0cf9d778575"||t.includes("ui__RelationColumnSet"))return!0;return!1}o(hD,"isRelColSetFrontmatter");function pD(n,e){let t=e.exo__Asset_uid;if(typeof t!="string"||t.trim().length===0)return null;let r=e.exo__Asset_label,i=typeof r=="string"&&r.trim().length>0?r.trim():null,s=e.ui__RelationColumnSet_targetClass,a=Array.isArray(s)?Qf(s[0]):Qf(s),c=Qf(e.ui__RelationColumnSet_referencingProperty),l=DY(e.ui__RelationColumnSet_columns),u=e.ui__RelationColumnSet_priority,f=typeof u=="number"?u:typeof u=="string"&&u.trim()!==""?Number.parseInt(u,10):null;return{uid:t.trim(),path:n,label:i,targetClass:a,referencingProperty:c,columns:l,priority:f!==null&&Number.isNaN(f)?null:f}}o(pD,"extractRelColSetConfig");function fD(n){if(n===null||n.trim().length===0)return"";let e=n.trim();return e.startsWith("[[")&&e.endsWith("]]")?e:`[[${e}]]`}o(fD,"wikilinkOf");function LY(n,e){let t=(0,dD.createHash)("sha256").update(`${n}:${e}:exo-layout-migration-v1`).digest("hex");return t.slice(0,8)+"-"+t.slice(8,12)+"-4"+t.slice(13,16)+"-8"+t.slice(17,20)+"-"+t.slice(20,32)}o(LY,"defaultUidFor");var Mg=class{static{o(this,"RelColSetToExoLayoutMigratorService")}constructor(e={}){this.uidFor=e.uidFor??LY}migrate(e){let t=[],r=[];for(let i of e){if(i.targetClass===null&&i.referencingProperty===null){r.push({sourcePath:i.path,reason:"RelColSet lacks both targetClass and referencingProperty \u2014 nothing to migrate"});continue}t.push(this.migrateOne(i))}return{pairs:t,skipped:r}}migrateOne(e){let t=this.uidFor(e.uid,"layout"),r=this.uidFor(e.uid,"block"),i=[],s=e.label??e.uid,a=`Migrated layout (from ${s})`,c=`Migrated backlinks table (from ${s})`,l=fD(e.targetClass),u=fD(e.referencingProperty);e.targetClass===null&&i.push("RelColSet has no targetClass \u2014 using placeholder; set exo__Layout_targetClass and exo__BacklinksTableBlock_rowClass manually."),e.referencingProperty===null&&i.push("RelColSet has no referencingProperty \u2014 set exo__BacklinksTableBlock_referencingProperty manually."),i.push("RelColSet is additive (appends to Name/InstanceClass); exo__BacklinksTableBlock is replacing. The generated block renders only the configured columns."),i.push("exo__Layout.targetClass is the class of the PAGE the layout renders on. RelColSet encodes the row class, not the page class. Review and adjust before --apply.");let f=e.columns.length===0?"[]":`
|
|
714
714
|
`+e.columns.map(y=>` - "${y}"`).join(`
|
|
@@ -736,7 +736,7 @@ exo__BacklinksTableBlock_referencingProperty: "${u}"
|
|
|
736
736
|
exo__BacklinksTableBlock_columns:${f==="[]"?" []":f}
|
|
737
737
|
# Migrated from ui__RelationColumnSet ${e.uid} (${e.path}).
|
|
738
738
|
---
|
|
739
|
-
`;return{sourceUid:e.uid,sourcePath:e.path,layout:{uid:t,filename:`${t}.md`,content:h},block:{uid:r,filename:`${r}.md`,content:p},warnings:i}}};function yD(){return new Ie("migrate-relcolset-to-exolayout").description("Generate exo__Layout + exo__BacklinksTableBlock pairs from existing ui__RelationColumnSet configs (dry-run by default; --apply to write)").requiredOption("--vault <path>","Path to the source vault").option("--out-dir <path>","Vault-relative folder where generated Layout+Block files land on --apply","exo-layout-migrated").option("--apply","Write generated files to the vault (default: dry-run, prints to stderr)",!1).option("--json","Emit the migration report as JSON to stdout",!1).action(async n=>{try{let e=(0,mD.resolve)(n.vault);if(!(0,gD.existsSync)(e))throw new
|
|
739
|
+
`;return{sourceUid:e.uid,sourcePath:e.path,layout:{uid:t,filename:`${t}.md`,content:h},block:{uid:r,filename:`${r}.md`,content:p},warnings:i}}};function yD(){return new Ie("migrate-relcolset-to-exolayout").description("Generate exo__Layout + exo__BacklinksTableBlock pairs from existing ui__RelationColumnSet configs (dry-run by default; --apply to write)").requiredOption("--vault <path>","Path to the source vault").option("--out-dir <path>","Vault-relative folder where generated Layout+Block files land on --apply","exo-layout-migrated").option("--apply","Write generated files to the vault (default: dry-run, prints to stderr)",!1).option("--json","Emit the migration report as JSON to stdout",!1).action(async n=>{try{let e=(0,mD.resolve)(n.vault);if(!(0,gD.existsSync)(e))throw new Pe(e);let t=new pr(e),r=new Mg,i=await t.getMarkdownFiles(),s=[];for(let c of i)try{let l=await t.getFileMetadata(c);if(!hD(l))continue;let u=pD(c,l);u!==null&&s.push(u)}catch{}let a=r.migrate(s);n.apply?await kY(t,a,n.outDir):jY(a),n.json?process.stdout.write(JSON.stringify($Y(a,n),null,2)+`
|
|
740
740
|
`):process.stderr.write(MY(a,n)),process.exit(0)}catch(e){pe.handle(e)}})}o(yD,"migrateRelColSetToExoLayoutCommand");async function kY(n,e,t){for(let r of e.pairs){let i=`${t}/${r.layout.filename}`,s=`${t}/${r.block.filename}`;await n.writeFile(i,r.layout.content),await n.writeFile(s,r.block.content)}}o(kY,"writePairs");function jY(n){process.stderr.write(`--- DRY RUN PREVIEW ---
|
|
741
741
|
`);for(let e of n.pairs)if(process.stderr.write(`
|
|
742
742
|
# from ${e.sourcePath}
|
|
@@ -758,10 +758,10 @@ exo__BacklinksTableBlock_columns:${f==="[]"?" []":f}
|
|
|
758
758
|
`),console.log(`${"Rank".padEnd(6)}${"Term".padEnd(30)}${"Freq".padEnd(8)}Sample UIDs`),console.log("-".repeat(90)),c.forEach((u,f)=>{let d=`#${f+1}`.padEnd(6),h=u.term.padEnd(30),p=String(u.frequency).padEnd(8),y=u.sample_uids.join(", ");console.log(`${d}${h}${p}${y}`)})})}o(TD,"backfillOrphanTermsCommand");function AD(){let n=new Ie("backfill").description("Concept backfill tools for aiKnow assets");return n.addCommand(ED()),n.addCommand(TD()),n}o(AD,"backfillCommand");var Gg=require("path"),DD=require("fs"),ND=require("os");var qg=require("child_process"),Wg=require("fs"),RD=require("path");var zi=require("fs"),Ug=le(require("path")),ID=require("crypto");var rX=/^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n([\s\S]*))?$/;function xD(n){let e=n.match(rX);if(!e)return null;let[,t,r=""]=e,i=rr.load(t);if(i==null)return{frontmatter:{},body:r};if(typeof i!="object"||Array.isArray(i))throw new Error("frontmatter is not a YAML mapping");return{frontmatter:i,body:r}}o(xD,"parseFile");function nX(n,e){let t=rr.dump(n,{lineWidth:-1,quotingType:'"',forceQuotes:!1,noRefs:!0}),r=e.length>0?e:"";return`---
|
|
759
759
|
${t}---
|
|
760
760
|
${r}`}o(nX,"serializeFile");function CD(n,e,t={}){let r=Ug.default.dirname(n),i=Ug.default.basename(n),s=Ug.default.join(r,`.${i}.tmp.${process.pid}.${(0,ID.randomBytes)(6).toString("hex")}`);try{let a=(0,zi.readFileSync)(n,"utf8"),c;try{c=xD(a)}catch(f){return{success:!1,verified:!1,reason:"parse-error",error:f.message}}if(!c)return{success:!1,verified:!1,reason:"no-frontmatter"};let l={...c.frontmatter,...e},u=nX(l,c.body);if((0,zi.writeFileSync)(s,u,"utf8"),(0,zi.renameSync)(s,n),t.verifyKey!==void 0){let f=(0,zi.readFileSync)(n,"utf8"),d;try{d=xD(f)}catch(p){return{success:!1,verified:!1,reason:"parse-error",error:p.message}}if(!d)return{success:!1,verified:!1,reason:"no-frontmatter"};let h=d.frontmatter[t.verifyKey];return h!==t.verifyValue?{success:!1,verified:!1,reason:"verify-mismatch",error:`expected ${t.verifyKey}=${String(t.verifyValue)}, got ${String(h)}`}:{success:!0,verified:!0}}return{success:!0,verified:!0}}catch(a){if((0,zi.existsSync)(s))try{(0,zi.unlinkSync)(s)}catch{}return{success:!1,verified:!1,reason:"fs-error",error:a.message}}}o(CD,"atomicUpdateFrontmatter");var iX=/^claude-child-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/,sX=/^claude-child-([0-9a-f]{8})-(\d+)$/,aX="EffortStatusDoing";function OD(n){return e=>new Promise((t,r)=>{n(e,(i,s,a)=>{i?r(Object.assign(i,{stdout:s,stderr:a})):t(s)})})}o(OD,"makeExecPromise");async function oX(n=qg.exec){let e=OD(n),t;try{t=await e("tmux list-sessions -F '#{session_name}' 2>/dev/null")}catch{return[]}let r=[];for(let i of t.split(`
|
|
761
|
-
`).map(s=>s.trim()).filter(Boolean)){let s=iX.exec(i);if(s){r.push({sessionName:i,uuid:s[1],type:"full"});continue}let a=sX.exec(i);a&&r.push({sessionName:i,uuid:a[1],type:"short"})}return r}o(oX,"listClaudeChildSessions");function cX(n,e,t){let r=null,i=e.toLowerCase();function s(a){if(r)return;let c;try{c=(0,Wg.readdirSync)(a,{withFileTypes:!0})}catch{return}for(let l of c){if(r)return;if(l.name.startsWith(".")||l.name==="node_modules")continue;let u=(0,RD.join)(a,l.name);if(l.isDirectory())s(u);else if(l.name.endsWith(".md")){let f=l.name.slice(0,-3).toLowerCase();(t==="full"&&f===i||t==="short"&&f.startsWith(i))&&(r=u)}}}return o(s,"walk"),s(n),r}o(cX,"findVaultFile");function lX(n,e){try{let i=(e??(s=>(0,Wg.readFileSync)(s,"utf8")))(n).match(/ems__Effort_status\s*:.*\[\[([^\]]+)\]\]/);return i?i[1].includes(aX):!1}catch{return!1}}o(lX,"isTaskDoing");async function PD(n,e=qg.exec,t){let r=await oX(e),i=[];for(let s of r){let a=cX(n,s.uuid,s.type);if(!a){i.push({sessionName:s.sessionName,taskUuid:s.uuid,taskFilePath:null,reason:"vault task not found"});continue}lX(a,t)||i.push({sessionName:s.sessionName,taskUuid:s.uuid,taskFilePath:a,reason:"vault task status != Doing"})}return i}o(PD,"detectOrphans");async function FD(n,e,t=qg.exec,r=CD){let i=OD(t);if(e)return{ok:!0};let s=new Date().toISOString();if(n.taskFilePath)try{r(n.taskFilePath,{ems__Effort_status:"[[ems__EffortStatusFailed]]",aiTask__Task_lastError:`orphan recovery: ${n.reason}`,exo__Asset_updatedAt:s})}catch(a){return{ok:!1,error:`vault update failed: ${a.message}`}}try{await i(`tmux kill-session -t ${JSON.stringify(n.sessionName)}`)}catch{}return{ok:!0}}o(FD,"recoverOrphan");function uX(){return process.env.EXOCORTEX_VAULT??(0,Gg.join)((0,ND.homedir)(),"vault-2025")}o(uX,"defaultVault");function LD(){return new Ie("recover").description("Detect and recover orphaned claude-child tmux sessions. A session is orphaned when the corresponding vault task is not in Doing status. Default mode: dry-run (no changes). Use --apply to perform recovery.").option("--vault <path>","Path to Obsidian vault",uX()).option("--dry-run","List orphans without applying changes (default)",!1).option("--apply","Apply orphan recovery: set Failed + kill tmux session",!1).action(async n=>{let e=(0,Gg.resolve)(n.vault);if(!(0,DD.existsSync)(e)){console.error(`[recover] vault not found: ${e}`),process.exitCode=1;return}let t=!n.apply;console.log(`[recover] vault=${e} mode=${t?"dry-run":"apply"}`);let r=await PD(e);if(r.length===0){console.log("[recover] No orphaned claude-child sessions found.");return}console.log(`[recover] Found ${r.length} orphan(s):`);for(let a of r){let c=a.taskFilePath??"(not found in vault)";console.log(` session=${a.sessionName} uuid=${a.taskUuid} reason=${a.reason}`),console.log(` file=${c}`)}if(t){console.log("[recover] Dry-run mode: no changes applied. Use --apply to recover.");return}let i=0,s=0;for(let a of r){let c=await FD(a,!1);c.ok?(i++,console.log(`[recover] RECOVERED: ${a.sessionName}`)):(s++,console.error(`[recover] ERROR recovering ${a.sessionName}: ${c.error}`))}console.log(`[recover] Done: recovered=${i} errors=${s}`),s>0&&(process.exitCode=1)})}o(LD,"recoverCommand");var _2=require("fs"),zg=require("path"),Gn=le(fr());function fX(n,e){return e.concat([n])}o(fX,"collectAlso");var dX="https://exocortex.my/ontology/find#Alias_sparql",hX="https://exocortex.my/ontology/exo#Asset_label";function Yl(n){if(n&&typeof n=="object"&&"value"in n){let e=n.value;return typeof e=="string"?e:String(e)}return String(n)}o(Yl,"nodeValue");async function pX(n,e){let t=await n.match(void 0,void 0,void 0),r=[];for(let s of t)Yl(s.predicate)!==hX||Yl(s.object)!==e||r.push(Yl(s.subject));if(r.length===0)return null;let i=[];for(let s of r)for(let a of t)Yl(a.predicate)===dX&&Yl(a.subject)===s&&i.push(Yl(a.object));if(i.length===0)return null;if(i.length>1)throw new Bt(`Ambiguous find__Alias "${e}" \u2014 ${i.length} instances define a sparql fragment`,`Ensure exactly one find__Alias asset has exo:Asset_label "${e}"`);return i[0]}o(pX,"resolveAliasFragment");var mX=/^([a-z][a-zA-Z0-9]*)__([A-Za-z0-9_]+)$/,gX="https://exocortex.my/ontology/";function yX(n,e){let t=mX.exec(e);if(t){let i=`<${gX}${t[1]}#${t[2]}>`;return n.replace(/\?value\b/g,i)}let r=e.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return n.replace(/\?value\b/g,`"${r}"`)}o(yX,"bindValueLiteral");function kD(){return new Ie("find").description("Find vault assets via SPARQL \u2014 outputs file paths one per line (RFC 8e83442b T1.1)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to include (repeatable)",fX,[]).option("--sparql <query>","SPARQL SELECT query (must bind ?path)").option("--class <value>","Filter by class label via find__Alias 'class' (e.g. ems__Task)").action(async n=>{pe.setFormat("text");try{if(n.sparql&&n.class)throw new Bt("--sparql and --class are mutually exclusive","Pass either a raw --sparql query or a find__Alias-backed flag like --class");if(!n.sparql&&!n.class)throw new Bt("one of --sparql <query> or --class <value> is required",'exocortex find --class ems__Task OR exocortex find --sparql "SELECT ?path WHERE { ... }"');let e=(0,zg.resolve)(n.vault);if(!(0,_2.existsSync)(e))throw new
|
|
762
|
-
`)}}catch(e){pe.handle(e),process.exit(5)}})}o(kD,"findCommand");var w2=require("fs"),v2=require("path"),
|
|
763
|
-
`).map(t=>t.trim()).filter(t=>t.length>0)}o(NX,"readStdinLines");function Qg(n){if(n&&typeof n=="object"&&"value"in n){let e=n.value;return typeof e=="string"?e:String(e)}return String(n)}o(Qg,"nodeValue");async function LX(n,e){let t=new
|
|
764
|
-
\u{1F4CA} Applied to ${h}/${d.length} target(s) (${p} failed).`),p>0&&process.exit(5)}catch(r){pe.handle(r),process.exit(5)}})}o(WD,"applyCommand");function GD(n){let e=new Ie;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.19.
|
|
761
|
+
`).map(s=>s.trim()).filter(Boolean)){let s=iX.exec(i);if(s){r.push({sessionName:i,uuid:s[1],type:"full"});continue}let a=sX.exec(i);a&&r.push({sessionName:i,uuid:a[1],type:"short"})}return r}o(oX,"listClaudeChildSessions");function cX(n,e,t){let r=null,i=e.toLowerCase();function s(a){if(r)return;let c;try{c=(0,Wg.readdirSync)(a,{withFileTypes:!0})}catch{return}for(let l of c){if(r)return;if(l.name.startsWith(".")||l.name==="node_modules")continue;let u=(0,RD.join)(a,l.name);if(l.isDirectory())s(u);else if(l.name.endsWith(".md")){let f=l.name.slice(0,-3).toLowerCase();(t==="full"&&f===i||t==="short"&&f.startsWith(i))&&(r=u)}}}return o(s,"walk"),s(n),r}o(cX,"findVaultFile");function lX(n,e){try{let i=(e??(s=>(0,Wg.readFileSync)(s,"utf8")))(n).match(/ems__Effort_status\s*:.*\[\[([^\]]+)\]\]/);return i?i[1].includes(aX):!1}catch{return!1}}o(lX,"isTaskDoing");async function PD(n,e=qg.exec,t){let r=await oX(e),i=[];for(let s of r){let a=cX(n,s.uuid,s.type);if(!a){i.push({sessionName:s.sessionName,taskUuid:s.uuid,taskFilePath:null,reason:"vault task not found"});continue}lX(a,t)||i.push({sessionName:s.sessionName,taskUuid:s.uuid,taskFilePath:a,reason:"vault task status != Doing"})}return i}o(PD,"detectOrphans");async function FD(n,e,t=qg.exec,r=CD){let i=OD(t);if(e)return{ok:!0};let s=new Date().toISOString();if(n.taskFilePath)try{r(n.taskFilePath,{ems__Effort_status:"[[ems__EffortStatusFailed]]",aiTask__Task_lastError:`orphan recovery: ${n.reason}`,exo__Asset_updatedAt:s})}catch(a){return{ok:!1,error:`vault update failed: ${a.message}`}}try{await i(`tmux kill-session -t ${JSON.stringify(n.sessionName)}`)}catch{}return{ok:!0}}o(FD,"recoverOrphan");function uX(){return process.env.EXOCORTEX_VAULT??(0,Gg.join)((0,ND.homedir)(),"vault-2025")}o(uX,"defaultVault");function LD(){return new Ie("recover").description("Detect and recover orphaned claude-child tmux sessions. A session is orphaned when the corresponding vault task is not in Doing status. Default mode: dry-run (no changes). Use --apply to perform recovery.").option("--vault <path>","Path to Obsidian vault",uX()).option("--dry-run","List orphans without applying changes (default)",!1).option("--apply","Apply orphan recovery: set Failed + kill tmux session",!1).action(async n=>{let e=(0,Gg.resolve)(n.vault);if(!(0,DD.existsSync)(e)){console.error(`[recover] vault not found: ${e}`),process.exitCode=1;return}let t=!n.apply;console.log(`[recover] vault=${e} mode=${t?"dry-run":"apply"}`);let r=await PD(e);if(r.length===0){console.log("[recover] No orphaned claude-child sessions found.");return}console.log(`[recover] Found ${r.length} orphan(s):`);for(let a of r){let c=a.taskFilePath??"(not found in vault)";console.log(` session=${a.sessionName} uuid=${a.taskUuid} reason=${a.reason}`),console.log(` file=${c}`)}if(t){console.log("[recover] Dry-run mode: no changes applied. Use --apply to recover.");return}let i=0,s=0;for(let a of r){let c=await FD(a,!1);c.ok?(i++,console.log(`[recover] RECOVERED: ${a.sessionName}`)):(s++,console.error(`[recover] ERROR recovering ${a.sessionName}: ${c.error}`))}console.log(`[recover] Done: recovered=${i} errors=${s}`),s>0&&(process.exitCode=1)})}o(LD,"recoverCommand");var _2=require("fs"),zg=require("path"),Gn=le(fr());function fX(n,e){return e.concat([n])}o(fX,"collectAlso");var dX="https://exocortex.my/ontology/find#Alias_sparql",hX="https://exocortex.my/ontology/exo#Asset_label";function Yl(n){if(n&&typeof n=="object"&&"value"in n){let e=n.value;return typeof e=="string"?e:String(e)}return String(n)}o(Yl,"nodeValue");async function pX(n,e){let t=await n.match(void 0,void 0,void 0),r=[];for(let s of t)Yl(s.predicate)!==hX||Yl(s.object)!==e||r.push(Yl(s.subject));if(r.length===0)return null;let i=[];for(let s of r)for(let a of t)Yl(a.predicate)===dX&&Yl(a.subject)===s&&i.push(Yl(a.object));if(i.length===0)return null;if(i.length>1)throw new Bt(`Ambiguous find__Alias "${e}" \u2014 ${i.length} instances define a sparql fragment`,`Ensure exactly one find__Alias asset has exo:Asset_label "${e}"`);return i[0]}o(pX,"resolveAliasFragment");var mX=/^([a-z][a-zA-Z0-9]*)__([A-Za-z0-9_]+)$/,gX="https://exocortex.my/ontology/";function yX(n,e){let t=mX.exec(e);if(t){let i=`<${gX}${t[1]}#${t[2]}>`;return n.replace(/\?value\b/g,i)}let r=e.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return n.replace(/\?value\b/g,`"${r}"`)}o(yX,"bindValueLiteral");function kD(){return new Ie("find").description("Find vault assets via SPARQL \u2014 outputs file paths one per line (RFC 8e83442b T1.1)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to include (repeatable)",fX,[]).option("--sparql <query>","SPARQL SELECT query (must bind ?path)").option("--class <value>","Filter by class label via find__Alias 'class' (e.g. ems__Task)").action(async n=>{pe.setFormat("text");try{if(n.sparql&&n.class)throw new Bt("--sparql and --class are mutually exclusive","Pass either a raw --sparql query or a find__Alias-backed flag like --class");if(!n.sparql&&!n.class)throw new Bt("one of --sparql <query> or --class <value> is required",'exocortex find --class ems__Task OR exocortex find --sparql "SELECT ?path WHERE { ... }"');let e=(0,zg.resolve)(n.vault);if(!(0,_2.existsSync)(e))throw new Pe(e);let t=new kt(e),i=await new Gn.NoteToRDFConverter(t).convertVault(),s=n.also||[];for(let w of s){let T=(0,zg.resolve)(w);if(!(0,_2.existsSync)(T))throw new Pe(T);let C=new kt(T),$=await new Gn.NoteToRDFConverter(C).convertVault();i=i.concat($)}let a=new Gn.InMemoryTripleStore;await a.addAll(i);let c;if(n.class){let w=await pX(a,"class");if(w===null)throw new Bt('No find__Alias with exo:Asset_label "class" was found in the vault',"Seed a find__Alias asset (label=class) or fall back to exocortex find --sparql");c=`SELECT ?path WHERE { ${yX(w,n.class)} }`}else c=n.sparql;let l=ql(c);l=Xa(l);let u=new Gn.ExoQLParser,f=Ja(Ya(e));for(let w of s){let T=Ja(Ya((0,zg.resolve)(w)));for(let[C,L]of T)f.has(C)||f.set(C,L)}f.size>0&&u.setVaultPrefixes(f);let d=u.parse(l),p=new Gn.ExoQLAlgebraTranslator().translate(d);p.type!=="construct"&&(p=new Gn.AlgebraOptimizer().optimize(p));let S=await new Gn.ExoQLQueryExecutor(a).executeAll(p),v="obsidian://vault/";for(let w of S){let C=w.toJSON().path;if(typeof C!="string"||!C.startsWith(v))continue;let L=C.slice(v.length),$;try{$=decodeURIComponent(L)}catch{$=L}process.stdout.write($+`
|
|
762
|
+
`)}}catch(e){pe.handle(e),process.exit(5)}})}o(kD,"findCommand");var w2=require("fs"),v2=require("path"),Fe=le(fr());var UD=le(fr()),Ft=le($D());var VD="obsidian://vault/";function OX(n){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return{async resolveTargetPath(t){if(!t)throw new Error("Cannot resolve empty targetIRI to a vault path");let r=t;if(r.startsWith(VD))r=decodeURI(r.slice(VD.length));else if(e.test(r)){let i=await n.findFileByUID(r);if(!i)throw new Error(`No vault file found for UID: ${r}`);r=i}if(r.endsWith(".md")||(r=`${r}.md`),!await n.fileExists(r))throw new Error(`Cannot resolve target file for IRI "${t}" (tried "${r}")`);return r}}}o(OX,"createCliPathResolver");var PX=["openFile","sparqlSelect","getActiveFileIRI","getActiveFilePath","trashFile","duplicateFile"],S2=class extends Error{constructor(t){super(`Service "${t}" is not implemented in the CLI (no-op stub). dyncommand exec on this service_call grounding cannot change vault state. See CLI parity issues #2865-#2868 for port status.`);this.serviceId=t;this.name="CliServiceNotImplementedError"}static{o(this,"CliServiceNotImplementedError")}};function BD(n){return{async execute(){throw new S2(n)}}}o(BD,"notImplementedService");function FX(n){return e=>{let t=n.getFirstLinkpathDest(e,"");if(!t||!("basename"in t))return null;let i=n.getFrontmatter(t)?.exo__Asset_label;return typeof i=="string"&&i.length>0?i:null}}o(FX,"createCliClassResolver");function qD(n,e){for(let t of PX)n.register(t,BD(t));for(let t of["updateProperty","removeProperty","setStatus","createAsset"])n.register(t,BD(t));if(e){if(e.fsAdapter){let t=new UD.FrontmatterService,r=OX(e.fsAdapter);n.register("updateProperty",(0,Ft.createUpdatePropertyService)(e.fsAdapter,t,r)),n.register("removeProperty",(0,Ft.createRemovePropertyService)(e.fsAdapter,t,r)),n.register("setStatus",(0,Ft.createSetStatusService)(e.fsAdapter,t,r)),n.register("createAsset",(0,Ft.createCreateAssetService)(e.vaultAdapter,e.fsAdapter,FX(e.vaultAdapter)))}n.register("createRelatedTask",(0,Ft.createCreateRelatedTaskService)(e.vaultAdapter,e.genericAssetCreationService)),n.register("createRelatedProject",(0,Ft.createCreateRelatedProjectService)(e.vaultAdapter,e.genericAssetCreationService)),n.register("archiveAsset",(0,Ft.createArchiveAssetService)(e.vaultAdapter,e.archiveAssetService)),n.register("planForEvening",(0,Ft.createPlanForEveningService)(e.vaultAdapter,e.taskStatusService)),n.register("cleanProperties",(0,Ft.createCleanPropertiesService)(e.vaultAdapter,e.propertyCleanupService)),n.register("renameToUid",(0,Ft.createRenameToUidService)(e.vaultAdapter,e.renameToUidService)),n.register("repairFolder",(0,Ft.createRepairFolderService)(e.vaultAdapter,e.folderRepairService)),n.register("fixMissingLabel",(0,Ft.createFixMissingLabelService)(e.vaultAdapter,e.fixMissingLabelService))}}o(qD,"populateCliServiceRegistry");var DX=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function NX(){if(process.stdin.isTTY)return[];let n=[];for await(let t of process.stdin)n.push(t);return Buffer.concat(n).toString("utf-8").split(`
|
|
763
|
+
`).map(t=>t.trim()).filter(t=>t.length>0)}o(NX,"readStdinLines");function Qg(n){if(n&&typeof n=="object"&&"value"in n){let e=n.value;return typeof e=="string"?e:String(e)}return String(n)}o(Qg,"nodeValue");async function LX(n,e){let t=new Fe.IRI("https://exocortex.my/ontology/exocmd#Command_cliName"),r=await n.match(void 0,t,void 0),i=[];for(let s of r)if(Qg(s.object)===e){let l=Qg(s.subject).match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i);l&&i.push(l[1])}if(i.length===0)return null;if(i.length>1)throw new Bt(`Ambiguous cliName "${e}" \u2014 resolves to ${i.length} commands: ${i.join(", ")}`,"Use the UUID directly: exocortex apply <uuid> <path>");return i[0]}o(LX,"resolveSlugToUuid");async function kX(n,e){let t=new Fe.IRI("https://exocortex.my/ontology/exocmd#Command_destructive"),r=await n.match(void 0,t,void 0);for(let i of r)if(Qg(i.subject).includes(e)){let a=Qg(i.object);if(a==="true"||a==="True")return!0}return!1}o(kX,"isDestructive");async function jX(n,e,t,r,i,s,a){let c=(0,v2.resolve)(n,r);if(!(0,w2.existsSync)(c))return console.error(`\u274C Target file not found: ${r}`),!1;let u=await new Fe.CommandResolver(e).loadCommand(t);if(!u)return console.error(`\u274C Command with UID "${t}" not found.`),!1;if(await kX(e,t)&&!i.dryRun&&!i.yes)return console.error(`\u274C Command "${u.name}" is marked destructive. Add --dry-run to preview, or --yes to apply.`),!1;let d=(0,Fe.vaultPathToIRI)(r);if(!await new Fe.PreconditionEvaluator(e,void 0,{clock:s}).evaluate(u.precondition,d))return console.error(`\u274C Precondition not satisfied for "${u.name}" on "${r}".`),!1;if(i.dryRun)return console.log(`\u{1F50D} Dry-run: would apply "${u.name}" to "${r}" (precondition passed).`),!0;let y=new Fe.ServiceRegistry,S=new kt(n),v=new Fe.GenericAssetCreationService(S).withDeterminism({clock:s,uidGenerator:a}),w=new Fe.ArchiveAssetService(S),T=new Fe.PropertyCleanupService(S),C=new Fe.FixMissingLabelService(S),L=new Fe.RenameToUidService(S),$=new Fe.FolderRepairService(S),ee=new Fe.TaskStatusService(S,new Fe.EffortStatusWorkflow,new Fe.StatusTimestampService(S)),B=new pr(n);qD(y,{vaultAdapter:S,fsAdapter:B,genericAssetCreationService:v,archiveAssetService:w,taskStatusService:ee,propertyCleanupService:T,fixMissingLabelService:C,renameToUidService:L,folderRepairService:$});let G=new Fe.GroundingExecutor(B,B,y,void 0,{clock:s,uidGenerator:a}),F;if(i.input)try{let W=JSON.parse(i.input);if(typeof W!="object"||W===null||Array.isArray(W))throw new Error("must be a JSON object");F=W}catch(W){let De=W instanceof Error?W.message:String(W);return console.error(`\u274C --input: invalid JSON object (${De})`),!1}let D=await G.execute(u.grounding,d,r,F);if(D.success){let W=u.successMessage??`Applied "${u.name}" to "${r}".`;return console.log(`\u2705 ${W}`),!0}else return console.error(`\u274C "${u.name}" failed on "${r}": ${D.error}`),!1}o(jX,"executeOnTarget");function WD(){return new Ie("apply").description("Apply an exocmd__Command to one or more vault assets (RFC 8e83442b T1.2). Pass a path arg or pipe paths via stdin.").argument("<cmd>","Command UUID or cliName slug").argument("[path]","Vault-relative path to target asset (omit to read paths from stdin)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--dry-run","Preview without writing").option("--yes","Skip destructive-command confirmation").option("--input <json>","JSON userInput for service_call groundings").option("--seed <uuid>","Deterministic UID seed for test/replay (uses seededUidGenerator)").option("--frozen-clock <iso>","Freeze clock to ISO timestamp for test/replay (uses frozenClock)").action(async(n,e,t)=>{pe.setFormat("text");try{let r=(0,v2.resolve)(t.vault);if(!(0,w2.existsSync)(r))throw new Pe(r);let i=t.frozenClock?(0,Fe.frozenClock)(t.frozenClock):(0,Fe.liveClock)(),s=t.seed?(0,Fe.seededUidGenerator)(t.seed):(0,Fe.liveUidGenerator)(),a=new kt(r),l=await new Fe.NoteToRDFConverter(a).convertVault(),u=new Fe.InMemoryTripleStore;await u.addAll(l);let f;if(DX.test(n))f=n;else{let y=await LX(u,n);y||(console.error(`\u274C No command found with UUID or cliName "${n}".`),process.exit(3)),f=y}let d;if(e)d=[e];else if(d=await NX(),d.length===0)throw new Bt("No target path provided and stdin is empty.","exocortex apply <uuid> <path> OR exocortex find ... | exocortex apply <uuid>");let h=0,p=0;for(let y of d)await jX(r,u,f,y,t,i,s)?h++:p++;d.length>1&&console.log(`
|
|
764
|
+
\u{1F4CA} Applied to ${h}/${d.length} target(s) (${p} failed).`),p>0&&process.exit(5)}catch(r){pe.handle(r),process.exit(5)}})}o(WD,"applyCommand");function GD(n){let e=new Ie;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.19.2"),e.addCommand(kD()),e.addCommand(WD()),e.addCommand(pF()),e.addCommand(_F()),e.addCommand(qF()),e.addCommand(wF()),e.addCommand(vF()),e.addCommand(IF()),e.addCommand(zF()),e.addCommand(eD()),e.addCommand(nD()),e.addCommand(iD()),e.addCommand(aD()),e.addCommand(yD()),e.addCommand(_D()),e.addCommand(AD()),e.addCommand(LD()),e}o(GD,"createProgram");GD().parse();0&&(module.exports={createProgram});
|
|
765
765
|
/*! Bundled license information:
|
|
766
766
|
|
|
767
767
|
reflect-metadata/Reflect.js:
|