@kitelev/exocortex-cli 15.125.0 → 15.126.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +35 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v15.
|
|
2
|
+
// @kitelev/exocortex-cli v15.126.0
|
|
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 SD=Object.create;var uu=Object.defineProperty;var bD=Object.getOwnPropertyDescriptor;var vD=Object.getOwnPropertyNames;var wD=Object.getPrototypeOf,ED=Object.prototype.hasOwnProperty;var o=(n,e)=>uu(n,"name",{value:e,configurable:!0});var TD=(n,e)=>()=>(n&&(e=n(n=0)),e);var S=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Sy=(n,e)=>{for(var t in e)uu(n,t,{get:e[t],enumerable:!0})},z2=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vD(e))!ED.call(n,i)&&i!==t&&uu(n,i,{get:()=>e[i],enumerable:!(r=bD(e,i))||r.enumerable});return n};var K=(n,e,t)=>(t=n!=null?SD(wD(n)):{},z2(e||!n||!n.__esModule?uu(t,"default",{value:n,enumerable:!0}):t,n)),Pd=n=>z2(uu({},"__esModule",{value:!0}),n);var Fd=S(()=>{var H2;(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 Me(Object.create(null))}:l?function(){return Me({__proto__:null})}:function(){return Me({})},has:u?function(w,T){return r.call(w,T)}:function(w,T){return T in w},get:u?function(w,T){return r.call(w,T)?w[T]:void 0}:function(w,T){return w[T]}},d=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Se(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ze(),_=typeof WeakMap=="function"?WeakMap:ze(),b=i?Symbol.for("@reflect-metadata:registry"):void 0,E=ge(),v=ye(E);function A(w,T,x,P){if(H(x)){if(!$e(w))throw new TypeError;if(!Be(T))throw new TypeError;return Ye(w,T)}else{if(!$e(w))throw new TypeError;if(!te(T))throw new TypeError;if(!te(P)&&!H(P)&&!Re(P))throw new TypeError;return Re(P)&&(P=void 0),x=Ae(x),st(w,T,x,P)}}o(A,"decorate"),e("decorate",A);function R(w,T){function x(P,J){if(!te(P))throw new TypeError;if(!H(J)&&!Ge(J))throw new TypeError;ne(w,T,P,J)}return o(x,"decorator"),x}o(R,"metadata"),e("metadata",R);function B(w,T,x,P){if(!te(x))throw new TypeError;return H(P)||(P=Ae(P)),ne(w,T,x,P)}o(B,"defineMetadata"),e("defineMetadata",B);function W(w,T,x){if(!te(T))throw new TypeError;return H(x)||(x=Ae(x)),Rt(w,T,x)}o(W,"hasMetadata"),e("hasMetadata",W);function ve(w,T,x){if(!te(T))throw new TypeError;return H(x)||(x=Ae(x)),at(w,T,x)}o(ve,"hasOwnMetadata"),e("hasOwnMetadata",ve);function z(w,T,x){if(!te(T))throw new TypeError;return H(x)||(x=Ae(x)),ct(w,T,x)}o(z,"getMetadata"),e("getMetadata",z);function G(w,T,x){if(!te(T))throw new TypeError;return H(x)||(x=Ae(x)),Ke(w,T,x)}o(G,"getOwnMetadata"),e("getOwnMetadata",G);function F(w,T){if(!te(w))throw new TypeError;return H(T)||(T=Ae(T)),V(w,T)}o(F,"getMetadataKeys"),e("getMetadataKeys",F);function j(w,T){if(!te(w))throw new TypeError;return H(T)||(T=Ae(T)),lt(w,T)}o(j,"getOwnMetadataKeys"),e("getOwnMetadataKeys",j);function ee(w,T,x){if(!te(T))throw new TypeError;if(H(x)||(x=Ae(x)),!te(T))throw new TypeError;H(x)||(x=Ae(x));var P=se(T,x,!1);return H(P)?!1:P.OrdinaryDeleteMetadata(w,T,x)}o(ee,"deleteMetadata"),e("deleteMetadata",ee);function Ye(w,T){for(var x=w.length-1;x>=0;--x){var P=w[x],J=P(T);if(!H(J)&&!Re(J)){if(!Be(J))throw new TypeError;T=J}}return T}o(Ye,"DecorateConstructor");function st(w,T,x,P){for(var J=w.length-1;J>=0;--J){var yt=w[J],At=yt(T,x,P);if(!H(At)&&!Re(At)){if(!te(At))throw new TypeError;P=At}}return P}o(st,"DecorateProperty");function Rt(w,T,x){var P=at(w,T,x);if(P)return!0;var J=oe(T);return Re(J)?!1:Rt(w,J,x)}o(Rt,"OrdinaryHasMetadata");function at(w,T,x){var P=se(T,x,!1);return H(P)?!1:je(P.OrdinaryHasOwnMetadata(w,T,x))}o(at,"OrdinaryHasOwnMetadata");function ct(w,T,x){var P=at(w,T,x);if(P)return Ke(w,T,x);var J=oe(T);if(!Re(J))return ct(w,J,x)}o(ct,"OrdinaryGetMetadata");function Ke(w,T,x){var P=se(T,x,!1);if(!H(P))return P.OrdinaryGetOwnMetadata(w,T,x)}o(Ke,"OrdinaryGetOwnMetadata");function ne(w,T,x,P){var J=se(x,P,!0);J.OrdinaryDefineOwnMetadata(w,T,x,P)}o(ne,"OrdinaryDefineOwnMetadata");function V(w,T){var x=lt(w,T),P=oe(w);if(P===null)return x;var J=V(P,T);if(J.length<=0)return x;if(x.length<=0)return J;for(var yt=new p,At=[],Fe=0,U=x;Fe<U.length;Fe++){var q=U[Fe],Q=yt.has(q);Q||(yt.add(q),At.push(q))}for(var Y=0,Ce=J;Y<Ce.length;Y++){var q=Ce[Y],Q=yt.has(q);Q||(yt.add(q),At.push(q))}return At}o(V,"OrdinaryMetadataKeys");function lt(w,T){var x=se(w,T,!1);return x?x.OrdinaryOwnMetadataKeys(w,T):[]}o(lt,"OrdinaryOwnMetadataKeys");function ht(w){if(w===null)return 1;switch(typeof w){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return w===null?1:6;default:return 6}}o(ht,"Type");function H(w){return w===void 0}o(H,"IsUndefined");function Re(w){return w===null}o(Re,"IsNull");function Ve(w){return typeof w=="symbol"}o(Ve,"IsSymbol");function te(w){return typeof w=="object"?w!==null:typeof w=="function"}o(te,"IsObject");function Ue(w,T){switch(ht(w)){case 0:return w;case 1:return w;case 2:return w;case 3:return w;case 4:return w;case 5:return w}var x=T===3?"string":T===5?"number":"default",P=he(w,s);if(P!==void 0){var J=P.call(w,x);if(te(J))throw new TypeError;return J}return qe(w,x==="default"?"number":x)}o(Ue,"ToPrimitive");function qe(w,T){if(T==="string"){var x=w.toString;if(Oe(x)){var P=x.call(w);if(!te(P))return P}var J=w.valueOf;if(Oe(J)){var P=J.call(w);if(!te(P))return P}}else{var J=w.valueOf;if(Oe(J)){var P=J.call(w);if(!te(P))return P}var yt=w.toString;if(Oe(yt)){var P=yt.call(w);if(!te(P))return P}}throw new TypeError}o(qe,"OrdinaryToPrimitive");function je(w){return!!w}o(je,"ToBoolean");function We(w){return""+w}o(We,"ToString");function Ae(w){var T=Ue(w,3);return Ve(T)?T:We(T)}o(Ae,"ToPropertyKey");function $e(w){return Array.isArray?Array.isArray(w):w instanceof Object?w instanceof Array:Object.prototype.toString.call(w)==="[object Array]"}o($e,"IsArray");function Oe(w){return typeof w=="function"}o(Oe,"IsCallable");function Be(w){return typeof w=="function"}o(Be,"IsConstructor");function Ge(w){switch(ht(w)){case 3:return!0;case 4:return!0;default:return!1}}o(Ge,"IsPropertyKey");function le(w,T){return w===T||w!==w&&T!==T}o(le,"SameValueZero");function he(w,T){var x=w[T];if(x!=null){if(!Oe(x))throw new TypeError;return x}}o(he,"GetMethod");function pe(w){var T=he(w,a);if(!Oe(T))throw new TypeError;var x=T.call(w);if(!te(x))throw new TypeError;return x}o(pe,"GetIterator");function ue(w){return w.value}o(ue,"IteratorValue");function fe(w){var T=w.next();return T.done?!1:T}o(fe,"IteratorStep");function de(w){var T=w.return;T&&T.call(w)}o(de,"IteratorClose");function oe(w){var T=Object.getPrototypeOf(w);if(typeof w!="function"||w===d||T!==d)return T;var x=w.prototype,P=x&&Object.getPrototypeOf(x);if(P==null||P===Object.prototype)return T;var J=P.constructor;return typeof J!="function"||J===w?T:J}o(oe,"OrdinaryGetPrototypeOf");function me(){var w;!H(b)&&typeof t.Reflect<"u"&&!(b in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(w=_e(t.Reflect));var T,x,P,J=new _,yt={registerProvider:At,getProvider:U,setProvider:Q};return yt;function At(Y){if(!Object.isExtensible(yt))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case w===Y:break;case H(T):T=Y;break;case T===Y:break;case H(x):x=Y;break;case x===Y:break;default:P===void 0&&(P=new p),P.add(Y);break}}function Fe(Y,Ce){if(!H(T)){if(T.isProviderFor(Y,Ce))return T;if(!H(x)){if(x.isProviderFor(Y,Ce))return T;if(!H(P))for(var tt=pe(P);;){var rt=fe(tt);if(!rt)return;var Tr=ue(rt);if(Tr.isProviderFor(Y,Ce))return de(tt),Tr}}}if(!H(w)&&w.isProviderFor(Y,Ce))return w}function U(Y,Ce){var tt=J.get(Y),rt;return H(tt)||(rt=tt.get(Ce)),H(rt)&&(rt=Fe(Y,Ce),H(rt)||(H(tt)&&(tt=new h,J.set(Y,tt)),tt.set(Ce,rt))),rt}function q(Y){if(H(Y))throw new TypeError;return T===Y||x===Y||!H(P)&&P.has(Y)}function Q(Y,Ce,tt){if(!q(tt))throw new Error("Metadata provider not registered.");var rt=U(Y,Ce);if(rt!==tt){if(!H(rt))return!1;var Tr=J.get(Y);H(Tr)&&(Tr=new h,J.set(Y,Tr)),Tr.set(Ce,tt)}return!0}}o(me,"CreateMetadataRegistry");function ge(){var w;return!H(b)&&te(t.Reflect)&&Object.isExtensible(t.Reflect)&&(w=t.Reflect[b]),H(w)&&(w=me()),!H(b)&&te(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,b,{enumerable:!1,configurable:!1,writable:!1,value:w}),w}o(ge,"GetOrCreateMetadataRegistry");function ye(w){var T=new _,x={isProviderFor:o(function(q,Q){var Y=T.get(q);return H(Y)?!1:Y.has(Q)},"isProviderFor"),OrdinaryDefineOwnMetadata:At,OrdinaryHasOwnMetadata:J,OrdinaryGetOwnMetadata:yt,OrdinaryOwnMetadataKeys:Fe,OrdinaryDeleteMetadata:U};return E.registerProvider(x),x;function P(q,Q,Y){var Ce=T.get(q),tt=!1;if(H(Ce)){if(!Y)return;Ce=new h,T.set(q,Ce),tt=!0}var rt=Ce.get(Q);if(H(rt)){if(!Y)return;if(rt=new h,Ce.set(Q,rt),!w.setProvider(q,Q,x))throw Ce.delete(Q),tt&&T.delete(q),new Error("Wrong provider for target.")}return rt}o(P,"GetOrCreateMetadataMap");function J(q,Q,Y){var Ce=P(Q,Y,!1);return H(Ce)?!1:je(Ce.has(q))}o(J,"OrdinaryHasOwnMetadata");function yt(q,Q,Y){var Ce=P(Q,Y,!1);if(!H(Ce))return Ce.get(q)}o(yt,"OrdinaryGetOwnMetadata");function At(q,Q,Y,Ce){var tt=P(Y,Ce,!0);tt.set(q,Q)}o(At,"OrdinaryDefineOwnMetadata");function Fe(q,Q){var Y=[],Ce=P(q,Q,!1);if(H(Ce))return Y;for(var tt=Ce.keys(),rt=pe(tt),Tr=0;;){var mn=fe(rt);if(!mn)return Y.length=Tr,Y;var Rn=ue(mn);try{Y[Tr]=Rn}catch(Xr){try{de(rt)}finally{throw Xr}}Tr++}}o(Fe,"OrdinaryOwnMetadataKeys");function U(q,Q,Y){var Ce=P(Q,Y,!1);if(H(Ce)||!Ce.delete(q))return!1;if(Ce.size===0){var tt=T.get(Q);H(tt)||(tt.delete(Y),tt.size===0&&T.delete(tt))}return!0}o(U,"OrdinaryDeleteMetadata")}o(ye,"CreateMetadataProvider");function _e(w){var T=w.defineMetadata,x=w.hasOwnMetadata,P=w.getOwnMetadata,J=w.getOwnMetadataKeys,yt=w.deleteMetadata,At=new _,Fe={isProviderFor:o(function(U,q){var Q=At.get(U);return!H(Q)&&Q.has(q)?!0:J(U,q).length?(H(Q)&&(Q=new p,At.set(U,Q)),Q.add(q),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:T,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:J,OrdinaryDeleteMetadata:yt};return Fe}o(_e,"CreateFallbackProvider");function se(w,T,x){var P=E.getProvider(w,T);if(!H(P))return P;if(x){if(E.setProvider(w,T,v))return v;throw new Error("Illegal state.")}}o(se,"GetMetadataProvider");function Se(){var w={},T=[],x=(function(){function Fe(U,q,Q){this._index=0,this._keys=U,this._values=q,this._selector=Q}return o(Fe,"MapIterator"),Fe.prototype["@@iterator"]=function(){return this},Fe.prototype[a]=function(){return this},Fe.prototype.next=function(){var U=this._index;if(U>=0&&U<this._keys.length){var q=this._selector(this._keys[U],this._values[U]);return U+1>=this._keys.length?(this._index=-1,this._keys=T,this._values=T):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},Fe.prototype.throw=function(U){throw this._index>=0&&(this._index=-1,this._keys=T,this._values=T),U},Fe.prototype.return=function(U){return this._index>=0&&(this._index=-1,this._keys=T,this._values=T),{value:U,done:!0}},Fe})(),P=(function(){function Fe(){this._keys=[],this._values=[],this._cacheKey=w,this._cacheIndex=-2}return o(Fe,"Map"),Object.defineProperty(Fe.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),Fe.prototype.has=function(U){return this._find(U,!1)>=0},Fe.prototype.get=function(U){var q=this._find(U,!1);return q>=0?this._values[q]:void 0},Fe.prototype.set=function(U,q){var Q=this._find(U,!0);return this._values[Q]=q,this},Fe.prototype.delete=function(U){var q=this._find(U,!1);if(q>=0){for(var Q=this._keys.length,Y=q+1;Y<Q;Y++)this._keys[Y-1]=this._keys[Y],this._values[Y-1]=this._values[Y];return this._keys.length--,this._values.length--,le(U,this._cacheKey)&&(this._cacheKey=w,this._cacheIndex=-2),!0}return!1},Fe.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=w,this._cacheIndex=-2},Fe.prototype.keys=function(){return new x(this._keys,this._values,J)},Fe.prototype.values=function(){return new x(this._keys,this._values,yt)},Fe.prototype.entries=function(){return new x(this._keys,this._values,At)},Fe.prototype["@@iterator"]=function(){return this.entries()},Fe.prototype[a]=function(){return this.entries()},Fe.prototype._find=function(U,q){if(!le(this._cacheKey,U)){this._cacheIndex=-1;for(var Q=0;Q<this._keys.length;Q++)if(le(this._keys[Q],U)){this._cacheIndex=Q;break}}return this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(U),this._values.push(void 0)),this._cacheIndex},Fe})();return P;function J(Fe,U){return Fe}function yt(Fe,U){return U}function At(Fe,U){return[Fe,U]}}o(Se,"CreateMapPolyfill");function Ze(){var w=(function(){function T(){this._map=new h}return o(T,"Set"),Object.defineProperty(T.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),T.prototype.has=function(x){return this._map.has(x)},T.prototype.add=function(x){return this._map.set(x,x),this},T.prototype.delete=function(x){return this._map.delete(x)},T.prototype.clear=function(){this._map.clear()},T.prototype.keys=function(){return this._map.keys()},T.prototype.values=function(){return this._map.keys()},T.prototype.entries=function(){return this._map.entries()},T.prototype["@@iterator"]=function(){return this.keys()},T.prototype[a]=function(){return this.keys()},T})();return w}o(Ze,"CreateSetPolyfill");function ze(){var w=16,T=f.create(),x=P();return(function(){function U(){this._key=P()}return o(U,"WeakMap"),U.prototype.has=function(q){var Q=J(q,!1);return Q!==void 0?f.has(Q,this._key):!1},U.prototype.get=function(q){var Q=J(q,!1);return Q!==void 0?f.get(Q,this._key):void 0},U.prototype.set=function(q,Q){var Y=J(q,!0);return Y[this._key]=Q,this},U.prototype.delete=function(q){var Q=J(q,!1);return Q!==void 0?delete Q[this._key]:!1},U.prototype.clear=function(){this._key=P()},U})();function P(){var U;do U="@@WeakMap@@"+Fe();while(f.has(T,U));return T[U]=!0,U}function J(U,q){if(!r.call(U,x)){if(!q)return;Object.defineProperty(U,x,{value:f.create()})}return U[x]}function yt(U,q){for(var Q=0;Q<q;++Q)U[Q]=Math.random()*255|0;return U}function At(U){if(typeof Uint8Array=="function"){var q=new Uint8Array(U);return typeof crypto<"u"?crypto.getRandomValues(q):typeof msCrypto<"u"?msCrypto.getRandomValues(q):yt(q,U),q}return yt(new Array(U),U)}function Fe(){var U=At(w);U[6]=U[6]&79|64,U[8]=U[8]&191|128;for(var q="",Q=0;Q<w;++Q){var Y=U[Q];(Q===4||Q===6||Q===8)&&(q+="-"),Y<16&&(q+="0"),q+=Y.toString(16).toLowerCase()}return q}}o(ze,"CreateWeakMapPolyfill");function Me(w){return w.__=void 0,delete w.__,w}o(Me,"MakeDictionary")})})(H2||(H2={}))});var fu=S(vy=>{var Dd=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}},by=class extends Dd{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};vy.CommanderError=Dd;vy.InvalidArgumentError=by});var Nd=S(Ey=>{var{InvalidArgumentError:AD}=fu(),wy=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 AD(`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 xD(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(xD,"humanReadableArgName");Ey.Argument=wy;Ey.humanReadableArgName=xD});var xy=S(Ay=>{var{humanReadableArgName:CD}=Nd(),Ty=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=>CD(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(_=>s(t.styleOptionTerm(t.optionTerm(_)),t.styleOptionDescription(t.optionDescription(_))));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(_=>s(t.styleSubcommandTerm(t.subcommandTerm(_)),t.styleSubcommandDescription(t.subcommandDescription(_))));a=a.concat(this.formatItemList(h,p,t))}),a.join(`
|
|
6
|
+
"use strict";var SD=Object.create;var uu=Object.defineProperty;var bD=Object.getOwnPropertyDescriptor;var vD=Object.getOwnPropertyNames;var wD=Object.getPrototypeOf,ED=Object.prototype.hasOwnProperty;var o=(n,e)=>uu(n,"name",{value:e,configurable:!0});var TD=(n,e)=>()=>(n&&(e=n(n=0)),e);var S=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Sy=(n,e)=>{for(var t in e)uu(n,t,{get:e[t],enumerable:!0})},z2=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vD(e))!ED.call(n,i)&&i!==t&&uu(n,i,{get:()=>e[i],enumerable:!(r=bD(e,i))||r.enumerable});return n};var K=(n,e,t)=>(t=n!=null?SD(wD(n)):{},z2(e||!n||!n.__esModule?uu(t,"default",{value:n,enumerable:!0}):t,n)),Pd=n=>z2(uu({},"__esModule",{value:!0}),n);var Fd=S(()=>{var H2;(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 Me(Object.create(null))}:l?function(){return Me({__proto__:null})}:function(){return Me({})},has:u?function(w,T){return r.call(w,T)}:function(w,T){return T in w},get:u?function(w,T){return r.call(w,T)?w[T]:void 0}:function(w,T){return w[T]}},d=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Se(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ze(),_=typeof WeakMap=="function"?WeakMap:ze(),b=i?Symbol.for("@reflect-metadata:registry"):void 0,E=ge(),v=ye(E);function A(w,T,x,P){if(H(x)){if(!$e(w))throw new TypeError;if(!Be(T))throw new TypeError;return Ye(w,T)}else{if(!$e(w))throw new TypeError;if(!te(T))throw new TypeError;if(!te(P)&&!H(P)&&!Re(P))throw new TypeError;return Re(P)&&(P=void 0),x=Ae(x),st(w,T,x,P)}}o(A,"decorate"),e("decorate",A);function R(w,T){function x(P,J){if(!te(P))throw new TypeError;if(!H(J)&&!Ge(J))throw new TypeError;ne(w,T,P,J)}return o(x,"decorator"),x}o(R,"metadata"),e("metadata",R);function B(w,T,x,P){if(!te(x))throw new TypeError;return H(P)||(P=Ae(P)),ne(w,T,x,P)}o(B,"defineMetadata"),e("defineMetadata",B);function W(w,T,x){if(!te(T))throw new TypeError;return H(x)||(x=Ae(x)),Rt(w,T,x)}o(W,"hasMetadata"),e("hasMetadata",W);function ve(w,T,x){if(!te(T))throw new TypeError;return H(x)||(x=Ae(x)),at(w,T,x)}o(ve,"hasOwnMetadata"),e("hasOwnMetadata",ve);function z(w,T,x){if(!te(T))throw new TypeError;return H(x)||(x=Ae(x)),ct(w,T,x)}o(z,"getMetadata"),e("getMetadata",z);function G(w,T,x){if(!te(T))throw new TypeError;return H(x)||(x=Ae(x)),Ke(w,T,x)}o(G,"getOwnMetadata"),e("getOwnMetadata",G);function F(w,T){if(!te(w))throw new TypeError;return H(T)||(T=Ae(T)),V(w,T)}o(F,"getMetadataKeys"),e("getMetadataKeys",F);function j(w,T){if(!te(w))throw new TypeError;return H(T)||(T=Ae(T)),lt(w,T)}o(j,"getOwnMetadataKeys"),e("getOwnMetadataKeys",j);function ee(w,T,x){if(!te(T))throw new TypeError;if(H(x)||(x=Ae(x)),!te(T))throw new TypeError;H(x)||(x=Ae(x));var P=se(T,x,!1);return H(P)?!1:P.OrdinaryDeleteMetadata(w,T,x)}o(ee,"deleteMetadata"),e("deleteMetadata",ee);function Ye(w,T){for(var x=w.length-1;x>=0;--x){var P=w[x],J=P(T);if(!H(J)&&!Re(J)){if(!Be(J))throw new TypeError;T=J}}return T}o(Ye,"DecorateConstructor");function st(w,T,x,P){for(var J=w.length-1;J>=0;--J){var _t=w[J],At=_t(T,x,P);if(!H(At)&&!Re(At)){if(!te(At))throw new TypeError;P=At}}return P}o(st,"DecorateProperty");function Rt(w,T,x){var P=at(w,T,x);if(P)return!0;var J=oe(T);return Re(J)?!1:Rt(w,J,x)}o(Rt,"OrdinaryHasMetadata");function at(w,T,x){var P=se(T,x,!1);return H(P)?!1:je(P.OrdinaryHasOwnMetadata(w,T,x))}o(at,"OrdinaryHasOwnMetadata");function ct(w,T,x){var P=at(w,T,x);if(P)return Ke(w,T,x);var J=oe(T);if(!Re(J))return ct(w,J,x)}o(ct,"OrdinaryGetMetadata");function Ke(w,T,x){var P=se(T,x,!1);if(!H(P))return P.OrdinaryGetOwnMetadata(w,T,x)}o(Ke,"OrdinaryGetOwnMetadata");function ne(w,T,x,P){var J=se(x,P,!0);J.OrdinaryDefineOwnMetadata(w,T,x,P)}o(ne,"OrdinaryDefineOwnMetadata");function V(w,T){var x=lt(w,T),P=oe(w);if(P===null)return x;var J=V(P,T);if(J.length<=0)return x;if(x.length<=0)return J;for(var _t=new p,At=[],Fe=0,U=x;Fe<U.length;Fe++){var q=U[Fe],Q=_t.has(q);Q||(_t.add(q),At.push(q))}for(var Y=0,Ce=J;Y<Ce.length;Y++){var q=Ce[Y],Q=_t.has(q);Q||(_t.add(q),At.push(q))}return At}o(V,"OrdinaryMetadataKeys");function lt(w,T){var x=se(w,T,!1);return x?x.OrdinaryOwnMetadataKeys(w,T):[]}o(lt,"OrdinaryOwnMetadataKeys");function pt(w){if(w===null)return 1;switch(typeof w){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return w===null?1:6;default:return 6}}o(pt,"Type");function H(w){return w===void 0}o(H,"IsUndefined");function Re(w){return w===null}o(Re,"IsNull");function Ve(w){return typeof w=="symbol"}o(Ve,"IsSymbol");function te(w){return typeof w=="object"?w!==null:typeof w=="function"}o(te,"IsObject");function Ue(w,T){switch(pt(w)){case 0:return w;case 1:return w;case 2:return w;case 3:return w;case 4:return w;case 5:return w}var x=T===3?"string":T===5?"number":"default",P=he(w,s);if(P!==void 0){var J=P.call(w,x);if(te(J))throw new TypeError;return J}return qe(w,x==="default"?"number":x)}o(Ue,"ToPrimitive");function qe(w,T){if(T==="string"){var x=w.toString;if(Oe(x)){var P=x.call(w);if(!te(P))return P}var J=w.valueOf;if(Oe(J)){var P=J.call(w);if(!te(P))return P}}else{var J=w.valueOf;if(Oe(J)){var P=J.call(w);if(!te(P))return P}var _t=w.toString;if(Oe(_t)){var P=_t.call(w);if(!te(P))return P}}throw new TypeError}o(qe,"OrdinaryToPrimitive");function je(w){return!!w}o(je,"ToBoolean");function We(w){return""+w}o(We,"ToString");function Ae(w){var T=Ue(w,3);return Ve(T)?T:We(T)}o(Ae,"ToPropertyKey");function $e(w){return Array.isArray?Array.isArray(w):w instanceof Object?w instanceof Array:Object.prototype.toString.call(w)==="[object Array]"}o($e,"IsArray");function Oe(w){return typeof w=="function"}o(Oe,"IsCallable");function Be(w){return typeof w=="function"}o(Be,"IsConstructor");function Ge(w){switch(pt(w)){case 3:return!0;case 4:return!0;default:return!1}}o(Ge,"IsPropertyKey");function le(w,T){return w===T||w!==w&&T!==T}o(le,"SameValueZero");function he(w,T){var x=w[T];if(x!=null){if(!Oe(x))throw new TypeError;return x}}o(he,"GetMethod");function pe(w){var T=he(w,a);if(!Oe(T))throw new TypeError;var x=T.call(w);if(!te(x))throw new TypeError;return x}o(pe,"GetIterator");function ue(w){return w.value}o(ue,"IteratorValue");function fe(w){var T=w.next();return T.done?!1:T}o(fe,"IteratorStep");function de(w){var T=w.return;T&&T.call(w)}o(de,"IteratorClose");function oe(w){var T=Object.getPrototypeOf(w);if(typeof w!="function"||w===d||T!==d)return T;var x=w.prototype,P=x&&Object.getPrototypeOf(x);if(P==null||P===Object.prototype)return T;var J=P.constructor;return typeof J!="function"||J===w?T:J}o(oe,"OrdinaryGetPrototypeOf");function me(){var w;!H(b)&&typeof t.Reflect<"u"&&!(b in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(w=_e(t.Reflect));var T,x,P,J=new _,_t={registerProvider:At,getProvider:U,setProvider:Q};return _t;function At(Y){if(!Object.isExtensible(_t))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case w===Y:break;case H(T):T=Y;break;case T===Y:break;case H(x):x=Y;break;case x===Y:break;default:P===void 0&&(P=new p),P.add(Y);break}}function Fe(Y,Ce){if(!H(T)){if(T.isProviderFor(Y,Ce))return T;if(!H(x)){if(x.isProviderFor(Y,Ce))return T;if(!H(P))for(var tt=pe(P);;){var rt=fe(tt);if(!rt)return;var Tr=ue(rt);if(Tr.isProviderFor(Y,Ce))return de(tt),Tr}}}if(!H(w)&&w.isProviderFor(Y,Ce))return w}function U(Y,Ce){var tt=J.get(Y),rt;return H(tt)||(rt=tt.get(Ce)),H(rt)&&(rt=Fe(Y,Ce),H(rt)||(H(tt)&&(tt=new h,J.set(Y,tt)),tt.set(Ce,rt))),rt}function q(Y){if(H(Y))throw new TypeError;return T===Y||x===Y||!H(P)&&P.has(Y)}function Q(Y,Ce,tt){if(!q(tt))throw new Error("Metadata provider not registered.");var rt=U(Y,Ce);if(rt!==tt){if(!H(rt))return!1;var Tr=J.get(Y);H(Tr)&&(Tr=new h,J.set(Y,Tr)),Tr.set(Ce,tt)}return!0}}o(me,"CreateMetadataRegistry");function ge(){var w;return!H(b)&&te(t.Reflect)&&Object.isExtensible(t.Reflect)&&(w=t.Reflect[b]),H(w)&&(w=me()),!H(b)&&te(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,b,{enumerable:!1,configurable:!1,writable:!1,value:w}),w}o(ge,"GetOrCreateMetadataRegistry");function ye(w){var T=new _,x={isProviderFor:o(function(q,Q){var Y=T.get(q);return H(Y)?!1:Y.has(Q)},"isProviderFor"),OrdinaryDefineOwnMetadata:At,OrdinaryHasOwnMetadata:J,OrdinaryGetOwnMetadata:_t,OrdinaryOwnMetadataKeys:Fe,OrdinaryDeleteMetadata:U};return E.registerProvider(x),x;function P(q,Q,Y){var Ce=T.get(q),tt=!1;if(H(Ce)){if(!Y)return;Ce=new h,T.set(q,Ce),tt=!0}var rt=Ce.get(Q);if(H(rt)){if(!Y)return;if(rt=new h,Ce.set(Q,rt),!w.setProvider(q,Q,x))throw Ce.delete(Q),tt&&T.delete(q),new Error("Wrong provider for target.")}return rt}o(P,"GetOrCreateMetadataMap");function J(q,Q,Y){var Ce=P(Q,Y,!1);return H(Ce)?!1:je(Ce.has(q))}o(J,"OrdinaryHasOwnMetadata");function _t(q,Q,Y){var Ce=P(Q,Y,!1);if(!H(Ce))return Ce.get(q)}o(_t,"OrdinaryGetOwnMetadata");function At(q,Q,Y,Ce){var tt=P(Y,Ce,!0);tt.set(q,Q)}o(At,"OrdinaryDefineOwnMetadata");function Fe(q,Q){var Y=[],Ce=P(q,Q,!1);if(H(Ce))return Y;for(var tt=Ce.keys(),rt=pe(tt),Tr=0;;){var mn=fe(rt);if(!mn)return Y.length=Tr,Y;var Rn=ue(mn);try{Y[Tr]=Rn}catch(Xr){try{de(rt)}finally{throw Xr}}Tr++}}o(Fe,"OrdinaryOwnMetadataKeys");function U(q,Q,Y){var Ce=P(Q,Y,!1);if(H(Ce)||!Ce.delete(q))return!1;if(Ce.size===0){var tt=T.get(Q);H(tt)||(tt.delete(Y),tt.size===0&&T.delete(tt))}return!0}o(U,"OrdinaryDeleteMetadata")}o(ye,"CreateMetadataProvider");function _e(w){var T=w.defineMetadata,x=w.hasOwnMetadata,P=w.getOwnMetadata,J=w.getOwnMetadataKeys,_t=w.deleteMetadata,At=new _,Fe={isProviderFor:o(function(U,q){var Q=At.get(U);return!H(Q)&&Q.has(q)?!0:J(U,q).length?(H(Q)&&(Q=new p,At.set(U,Q)),Q.add(q),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:T,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:J,OrdinaryDeleteMetadata:_t};return Fe}o(_e,"CreateFallbackProvider");function se(w,T,x){var P=E.getProvider(w,T);if(!H(P))return P;if(x){if(E.setProvider(w,T,v))return v;throw new Error("Illegal state.")}}o(se,"GetMetadataProvider");function Se(){var w={},T=[],x=(function(){function Fe(U,q,Q){this._index=0,this._keys=U,this._values=q,this._selector=Q}return o(Fe,"MapIterator"),Fe.prototype["@@iterator"]=function(){return this},Fe.prototype[a]=function(){return this},Fe.prototype.next=function(){var U=this._index;if(U>=0&&U<this._keys.length){var q=this._selector(this._keys[U],this._values[U]);return U+1>=this._keys.length?(this._index=-1,this._keys=T,this._values=T):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},Fe.prototype.throw=function(U){throw this._index>=0&&(this._index=-1,this._keys=T,this._values=T),U},Fe.prototype.return=function(U){return this._index>=0&&(this._index=-1,this._keys=T,this._values=T),{value:U,done:!0}},Fe})(),P=(function(){function Fe(){this._keys=[],this._values=[],this._cacheKey=w,this._cacheIndex=-2}return o(Fe,"Map"),Object.defineProperty(Fe.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),Fe.prototype.has=function(U){return this._find(U,!1)>=0},Fe.prototype.get=function(U){var q=this._find(U,!1);return q>=0?this._values[q]:void 0},Fe.prototype.set=function(U,q){var Q=this._find(U,!0);return this._values[Q]=q,this},Fe.prototype.delete=function(U){var q=this._find(U,!1);if(q>=0){for(var Q=this._keys.length,Y=q+1;Y<Q;Y++)this._keys[Y-1]=this._keys[Y],this._values[Y-1]=this._values[Y];return this._keys.length--,this._values.length--,le(U,this._cacheKey)&&(this._cacheKey=w,this._cacheIndex=-2),!0}return!1},Fe.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=w,this._cacheIndex=-2},Fe.prototype.keys=function(){return new x(this._keys,this._values,J)},Fe.prototype.values=function(){return new x(this._keys,this._values,_t)},Fe.prototype.entries=function(){return new x(this._keys,this._values,At)},Fe.prototype["@@iterator"]=function(){return this.entries()},Fe.prototype[a]=function(){return this.entries()},Fe.prototype._find=function(U,q){if(!le(this._cacheKey,U)){this._cacheIndex=-1;for(var Q=0;Q<this._keys.length;Q++)if(le(this._keys[Q],U)){this._cacheIndex=Q;break}}return this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(U),this._values.push(void 0)),this._cacheIndex},Fe})();return P;function J(Fe,U){return Fe}function _t(Fe,U){return U}function At(Fe,U){return[Fe,U]}}o(Se,"CreateMapPolyfill");function Ze(){var w=(function(){function T(){this._map=new h}return o(T,"Set"),Object.defineProperty(T.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),T.prototype.has=function(x){return this._map.has(x)},T.prototype.add=function(x){return this._map.set(x,x),this},T.prototype.delete=function(x){return this._map.delete(x)},T.prototype.clear=function(){this._map.clear()},T.prototype.keys=function(){return this._map.keys()},T.prototype.values=function(){return this._map.keys()},T.prototype.entries=function(){return this._map.entries()},T.prototype["@@iterator"]=function(){return this.keys()},T.prototype[a]=function(){return this.keys()},T})();return w}o(Ze,"CreateSetPolyfill");function ze(){var w=16,T=f.create(),x=P();return(function(){function U(){this._key=P()}return o(U,"WeakMap"),U.prototype.has=function(q){var Q=J(q,!1);return Q!==void 0?f.has(Q,this._key):!1},U.prototype.get=function(q){var Q=J(q,!1);return Q!==void 0?f.get(Q,this._key):void 0},U.prototype.set=function(q,Q){var Y=J(q,!0);return Y[this._key]=Q,this},U.prototype.delete=function(q){var Q=J(q,!1);return Q!==void 0?delete Q[this._key]:!1},U.prototype.clear=function(){this._key=P()},U})();function P(){var U;do U="@@WeakMap@@"+Fe();while(f.has(T,U));return T[U]=!0,U}function J(U,q){if(!r.call(U,x)){if(!q)return;Object.defineProperty(U,x,{value:f.create()})}return U[x]}function _t(U,q){for(var Q=0;Q<q;++Q)U[Q]=Math.random()*255|0;return U}function At(U){if(typeof Uint8Array=="function"){var q=new Uint8Array(U);return typeof crypto<"u"?crypto.getRandomValues(q):typeof msCrypto<"u"?msCrypto.getRandomValues(q):_t(q,U),q}return _t(new Array(U),U)}function Fe(){var U=At(w);U[6]=U[6]&79|64,U[8]=U[8]&191|128;for(var q="",Q=0;Q<w;++Q){var Y=U[Q];(Q===4||Q===6||Q===8)&&(q+="-"),Y<16&&(q+="0"),q+=Y.toString(16).toLowerCase()}return q}}o(ze,"CreateWeakMapPolyfill");function Me(w){return w.__=void 0,delete w.__,w}o(Me,"MakeDictionary")})})(H2||(H2={}))});var fu=S(vy=>{var Dd=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}},by=class extends Dd{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};vy.CommanderError=Dd;vy.InvalidArgumentError=by});var Nd=S(Ey=>{var{InvalidArgumentError:AD}=fu(),wy=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 AD(`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 xD(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(xD,"humanReadableArgName");Ey.Argument=wy;Ey.humanReadableArgName=xD});var xy=S(Ay=>{var{humanReadableArgName:CD}=Nd(),Ty=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=>CD(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(_=>s(t.styleOptionTerm(t.optionTerm(_)),t.styleOptionDescription(t.optionDescription(_))));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(_=>s(t.styleSubcommandTerm(t.subcommandTerm(_)),t.styleSubcommandDescription(t.subcommandDescription(_))));a=a.concat(this.formatItemList(h,p,t))}),a.join(`
|
|
7
7
|
`)}displayWidth(e){return Q2(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,11 +28,11 @@ 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 it.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()}`,it.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new MD(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=Z2(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=Z2(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=>ND(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=Is.basename(e,Is.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(it.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 eE(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(eE,"incrementNodeInspectorPort");function Ny(){if(it.env.NO_COLOR||it.env.FORCE_COLOR==="0"||it.env.FORCE_COLOR==="false")return!1;if(it.env.FORCE_COLOR||it.env.CLICOLOR_FORCE!==void 0)return!0}o(Ny,"useColor");Ly.Command=Dy;Ly.useColor=Ny});var sE=S(jn=>{var{Argument:rE}=Nd(),{Command:ky}=tE(),{CommanderError:jD,InvalidArgumentError:nE}=fu(),{Help:$D}=xy(),{Option:iE}=Oy();jn.program=new ky;jn.createCommand=n=>new ky(n);jn.createOption=(n,e)=>new iE(n,e);jn.createArgument=(n,e)=>new rE(n,e);jn.Command=ky;jn.Option=iE;jn.Argument=rE;jn.Help=$D;jn.CommanderError=jD;jn.InvalidArgumentError=nE;jn.InvalidOptionArgumentError=nE});var du=S(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});kd.AssetClass=void 0;var oE;(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"})(oE||(kd.AssetClass=oE={}))});var fc=S(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.EffortStatus=void 0;var cE;(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"})(cE||(Md.EffortStatus=cE={}))});var My=S(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.EFFORT_STATUS_OPTIONS=Ut.STATUS_NAME_TO_WIKILINK=Ut.STATUS_NAME_TO_ENUM=Ut.EFFORT_STATUS_CONFIG=void 0;Ut.normalizeEffortStatus=BD;Ut.isDoneStatus=VD;Ut.isTrashedStatus=UD;Ut.getEffortStatusLabel=qD;var Ki=fc();Ut.EFFORT_STATUS_CONFIG=[{name:"Draft",status:Ki.EffortStatus.DRAFT,wikilink:"[[ems__EffortStatusDraft]]"},{name:"Backlog",status:Ki.EffortStatus.BACKLOG,wikilink:"[[ems__EffortStatusBacklog]]"},{name:"Analysis",status:Ki.EffortStatus.ANALYSIS,wikilink:"[[ems__EffortStatusAnalysis]]"},{name:"To Do",status:Ki.EffortStatus.TODO,wikilink:"[[ems__EffortStatusToDo]]"},{name:"Doing",status:Ki.EffortStatus.DOING,wikilink:"[[ems__EffortStatusDoing]]"},{name:"Done",status:Ki.EffortStatus.DONE,wikilink:"[[ems__EffortStatusDone]]"},{name:"Trashed",status:Ki.EffortStatus.TRASHED,wikilink:"[[ems__EffortStatusTrashed]]"}];Ut.STATUS_NAME_TO_ENUM=Object.fromEntries(Ut.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.status]));Ut.STATUS_NAME_TO_WIKILINK=Object.fromEntries(Ut.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.wikilink]));Ut.EFFORT_STATUS_OPTIONS=Ut.EFFORT_STATUS_CONFIG.map(n=>({value:n.wikilink,label:n.name}));function BD(n,e=Ki.EffortStatus.DRAFT){if(n.startsWith("ems__")){let r=Ut.EFFORT_STATUS_CONFIG.find(i=>i.status===n);return r?r.status:e}return Ut.STATUS_NAME_TO_ENUM[n]??e}o(BD,"normalizeEffortStatus");function VD(n){return n===Ki.EffortStatus.DONE}o(VD,"isDoneStatus");function UD(n){return n===Ki.EffortStatus.TRASHED}o(UD,"isTrashedStatus");function qD(n){if(!n)return"-";let e=String(n);if(e==="")return"-";for(let r of Ut.EFFORT_STATUS_CONFIG)if(r.wikilink===e||`[[${e}]]`===r.wikilink||r.status===e||r.name===e)return r.name;let t=e.toLowerCase();for(let r of Ut.EFFORT_STATUS_CONFIG)if(r.name.toLowerCase()===t)return r.name;return e}o(qD,"getEffortStatusLabel")});var dc=S(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.GroundingType=void 0;var lE;(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"})(lE||(jd.GroundingType=lE={}))});var jy=S($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.CommandBindingStyleProperty=$n.CommandBindingProperty=$n.GroundingProperty=$n.PreconditionProperty=$n.CommandProperty=void 0;$n.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"};$n.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk"};$n.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",TARGET_VALUE:"exocmd__Grounding_targetValue",STEPS:"exocmd__Grounding_steps"};$n.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",GROUP:"exocmd__CommandBinding_group",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};$n.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 uE=S(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.STYLE_SOURCE_VALUES=yn.LABEL_CLASS_VALUES=yn.COMMAND_VARIANT_VALUES=void 0;yn.isCommandVariant=WD;yn.isLabelClass=GD;yn.isStyleSource=zD;yn.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);yn.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);yn.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function WD(n){return typeof n=="string"&&yn.COMMAND_VARIANT_VALUES.includes(n)}o(WD,"isCommandVariant");function GD(n){return typeof n=="string"&&yn.LABEL_CLASS_VALUES.includes(n)}o(GD,"isLabelClass");function zD(n){return typeof n=="string"&&yn.STYLE_SOURCE_VALUES.includes(n)}o(zD,"isStyleSource")});var fE=S(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.isCommandFrontmatter=HD;hc.isPreconditionFrontmatter=QD;hc.isGroundingFrontmatter=YD;hc.isCommandBindingFrontmatter=KD;function HD(n){return $d(n,"exocmd__Command")}o(HD,"isCommandFrontmatter");function QD(n){return $d(n,"exocmd__Precondition")}o(QD,"isPreconditionFrontmatter");function YD(n){return $d(n,"exocmd__Grounding")}o(YD,"isGroundingFrontmatter");function KD(n){return $d(n,"exocmd__CommandBinding")}o(KD,"isCommandBindingFrontmatter");function $d(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($d,"hasInstanceClass")});var dE=S(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.hasPosition=XD;Bd.isFixed=JD;function XD(n){return typeof n.x=="number"&&typeof n.y=="number"}o(XD,"hasPosition");function JD(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(JD,"isFixed")});var hE=S(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.createEmptyGraphData=ZD;Vd.mergeGraphData=eN;function ZD(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(ZD,"createEmptyGraphData");function eN(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(eN,"mergeGraphData")});var $y=S(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.createEdgeId=tN;Ud.edgesEqual=rN;function tN(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(tN,"createEdgeId");function rN(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(rN,"edgesEqual")});var By=S(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.BUILT_IN_EDGE_STYLES=jt.BUILT_IN_NODE_STYLES=jt.DEFAULT_EDGE_STYLE=jt.DEFAULT_NODE_STYLE=jt.RDF_TYPE_PREDICATES=void 0;jt.mergeNodeStyles=nN;jt.mergeEdgeStyles=iN;jt.extractLocalName=sN;jt.isClassType=aN;jt.isTypePredicate=oN;jt.isSubClassPredicate=cN;jt.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"};jt.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};jt.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};jt.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"}};jt.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 nN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(nN,"mergeNodeStyles");function iN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(iN,"mergeEdgeStyles");function sN(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(sN,"extractLocalName");function aN(n){return n===jt.RDF_TYPE_PREDICATES.RDFS_CLASS||n===jt.RDF_TYPE_PREDICATES.OWL_CLASS}o(aN,"isClassType");function oN(n){return n===jt.RDF_TYPE_PREDICATES.RDF_TYPE}o(oN,"isTypePredicate");function cN(n){return n===jt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(cN,"isSubClassPredicate")});var mE=S(pE=>{"use strict";Object.defineProperty(pE,"__esModule",{value:!0})});var xe=S(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.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)}}};qd.IRI=Vy});var He=S(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.Literal=void 0;so.parseLanguageTag=gE;so.createDirectionalLiteral=uN;so.createLiteralFromLanguageTag=fN;var lN="http://www.w3.org/2001/XMLSchema#string",hu=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===lN?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}};so.Literal=hu;function gE(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(gE,"parseLanguageTag");function uN(n,e,t){return new hu(n,void 0,e,t)}o(uN,"createDirectionalLiteral");function fN(n,e){let{language:t,direction:r}=gE(e);return new hu(n,void 0,t,r)}o(fN,"createLiteralFromLanguageTag")});var qt=S(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.BlankNode=void 0;var Wd=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())}};Gd.BlankNode=Wd;Wd.counter=0});var Cr=S(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.Namespace=void 0;var yE=xe(),St=class{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 yE.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new yE.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)}};zd.Namespace=St;St.RDF=new St("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");St.RDFS=new St("rdfs","http://www.w3.org/2000/01/rdf-schema#");St.OWL=new St("owl","http://www.w3.org/2002/07/owl#");St.XSD=new St("xsd","http://www.w3.org/2001/XMLSchema#");St.EXO=new St("exo","https://exocortex.my/ontology/exo#");St.EMS=new St("ems","https://exocortex.my/ontology/ems#");St.EXOCMD=new St("exocmd","https://exocortex.my/ontology/exocmd#");St.IMS=new St("ims","https://exocortex.my/ontology/ims#");St.ZTLK=new St("ztlk","https://exocortex.my/ontology/ztlk#");St.PTMS=new St("ptms","https://exocortex.my/ontology/ptms#");St.LIT=new St("lit","https://exocortex.my/ontology/lit#");St.INBOX=new St("inbox","https://exocortex.my/ontology/inbox#")});var ri=S(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.Triple=void 0;var Uy=xe(),qy=He(),Wy=qt(),Gy=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 Uy.IRI&&t instanceof Uy.IRI||e instanceof Wy.BlankNode&&t instanceof Wy.BlankNode||e instanceof qy.Literal&&t instanceof qy.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 Uy.IRI?`<${e.value}>`:e instanceof Wy.BlankNode||e instanceof qy.Literal||this.isQuotedTriple(e)?e.toString():""}};Hd.Triple=Gy});var pu=S(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.QuotedTriple=void 0;var zy=xe(),Hy=He(),Qy=qt(),Yy=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 zy.IRI&&t instanceof zy.IRI||e instanceof Qy.BlankNode&&t instanceof Qy.BlankNode||e instanceof Hy.Literal&&t instanceof Hy.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 zy.IRI?`<${e.value}>`:e instanceof Qy.BlankNode||e instanceof Hy.Literal||e instanceof n?e.toString():""}};Qd.QuotedTriple=Yy});var _E=S(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.QuotedTriple=Kt.Triple=Kt.Namespace=Kt.BlankNode=Kt.createLiteralFromLanguageTag=Kt.createDirectionalLiteral=Kt.parseLanguageTag=Kt.Literal=Kt.IRI=void 0;var dN=xe();Object.defineProperty(Kt,"IRI",{enumerable:!0,get:o(function(){return dN.IRI},"get")});var Yd=He();Object.defineProperty(Kt,"Literal",{enumerable:!0,get:o(function(){return Yd.Literal},"get")});Object.defineProperty(Kt,"parseLanguageTag",{enumerable:!0,get:o(function(){return Yd.parseLanguageTag},"get")});Object.defineProperty(Kt,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return Yd.createDirectionalLiteral},"get")});Object.defineProperty(Kt,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return Yd.createLiteralFromLanguageTag},"get")});var hN=qt();Object.defineProperty(Kt,"BlankNode",{enumerable:!0,get:o(function(){return hN.BlankNode},"get")});var pN=Cr();Object.defineProperty(Kt,"Namespace",{enumerable:!0,get:o(function(){return pN.Namespace},"get")});var mN=ri();Object.defineProperty(Kt,"Triple",{enumerable:!0,get:o(function(){return mN.Triple},"get")});var gN=pu();Object.defineProperty(Kt,"QuotedTriple",{enumerable:!0,get:o(function(){return gN.QuotedTriple},"get")})});var Kd=S(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.UUID_URL_NAMESPACE=Vn.DEFAULT_LANGUAGE_TAG=Vn.REQUIRED_PROPERTIES=Vn.ALLOWED_PROPERTIES=Vn.Exo003MetadataType=void 0;var Bn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(Bn||(Vn.Exo003MetadataType=Bn={}));Vn.ALLOWED_PROPERTIES={[Bn.Namespace]:["metadata","uri","aliases"],[Bn.Anchor]:["metadata","uri","aliases"],[Bn.BlankNode]:["metadata","uri","aliases"],[Bn.Statement]:["metadata","subject","predicate","object","aliases"],[Bn.Body]:["metadata","subject","predicate","aliases"]};Vn.REQUIRED_PROPERTIES={[Bn.Namespace]:["metadata","uri"],[Bn.Anchor]:["metadata","uri"],[Bn.BlankNode]:["metadata","uri"],[Bn.Statement]:["metadata","subject","predicate","object"],[Bn.Body]:["metadata","subject","predicate"]};Vn.DEFAULT_LANGUAGE_TAG="ru";Vn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var SE=S(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var bE=S(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});Xy.default="00000000-0000-0000-0000-000000000000"});var vE=S(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});Jy.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 mu=S(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var yN=vE();function _N(n){return typeof n=="string"&&yN.default.test(n)}o(_N,"validate");Zy.default=_N});var gu=S(e0=>{"use strict";Object.defineProperty(e0,"__esModule",{value:!0});var SN=mu();function bN(n){if(!(0,SN.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(bN,"parse");e0.default=bN});var Rs=S(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.unsafeStringify=void 0;var vN=mu(),Ir=[];for(let n=0;n<256;++n)Ir.push((n+256).toString(16).slice(1));function wE(n,e=0){return(Ir[n[e+0]]+Ir[n[e+1]]+Ir[n[e+2]]+Ir[n[e+3]]+"-"+Ir[n[e+4]]+Ir[n[e+5]]+"-"+Ir[n[e+6]]+Ir[n[e+7]]+"-"+Ir[n[e+8]]+Ir[n[e+9]]+"-"+Ir[n[e+10]]+Ir[n[e+11]]+Ir[n[e+12]]+Ir[n[e+13]]+Ir[n[e+14]]+Ir[n[e+15]]).toLowerCase()}o(wE,"unsafeStringify");yu.unsafeStringify=wE;function wN(n,e=0){let t=wE(n,e);if(!(0,vN.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(wN,"stringify");yu.default=wN});var Zd=S(t0=>{"use strict";Object.defineProperty(t0,"__esModule",{value:!0});var EN=require("crypto"),Jd=new Uint8Array(256),Xd=Jd.length;function TN(){return Xd>Jd.length-16&&((0,EN.randomFillSync)(Jd),Xd=0),Jd.slice(Xd,Xd+=16)}o(TN,"rng");t0.default=TN});var r0=S(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.updateV1State=void 0;var EE=Zd(),AN=Rs(),_u={};function xN(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=TE(n.random??n.rng?.()??(0,EE.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,EE.default)();AE(_u,s,a),r=TE(a,_u.msecs,_u.nsecs,i?void 0:_u.clockseq,i?void 0:_u.node,e,t)}return e??(0,AN.unsafeStringify)(r)}o(xN,"v1");function AE(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(AE,"updateV1State");Su.updateV1State=AE;function TE(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(TE,"v1Bytes");Su.default=xN});var i0=S(n0=>{"use strict";Object.defineProperty(n0,"__esModule",{value:!0});var CN=gu(),IN=Rs();function RN(n){let e=typeof n=="string"?(0,CN.default)(n):n,t=ON(e);return typeof n=="string"?(0,IN.unsafeStringify)(t):t}o(RN,"v1ToV6");n0.default=RN;function ON(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(ON,"_v1ToV6")});var xE=S(s0=>{"use strict";Object.defineProperty(s0,"__esModule",{value:!0});var PN=require("crypto");function FN(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,PN.createHash)("md5").update(n).digest()}o(FN,"md5");s0.default=FN});var bu=S(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.URL=Os.DNS=Os.stringToBytes=void 0;var CE=gu(),DN=Rs();function IE(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(IE,"stringToBytes");Os.stringToBytes=IE;Os.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Os.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function NN(n,e,t,r,i,s){let a=typeof t=="string"?IE(t):t,c=typeof r=="string"?(0,CE.default)(r):r;if(typeof r=="string"&&(r=(0,CE.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,DN.unsafeStringify)(l)}o(NN,"v35");Os.default=NN});var OE=S(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.URL=ao.DNS=void 0;var LN=xE(),a0=bu(),RE=bu();Object.defineProperty(ao,"DNS",{enumerable:!0,get:o(function(){return RE.DNS},"get")});Object.defineProperty(ao,"URL",{enumerable:!0,get:o(function(){return RE.URL},"get")});function o0(n,e,t,r){return(0,a0.default)(48,LN.default,n,e,t,r)}o(o0,"v3");o0.DNS=a0.DNS;o0.URL=a0.URL;ao.default=o0});var PE=S(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0});var kN=require("crypto");c0.default={randomUUID:kN.randomUUID}});var DE=S(l0=>{"use strict";Object.defineProperty(l0,"__esModule",{value:!0});var FE=PE(),MN=Zd(),jN=Rs();function $N(n,e,t){if(FE.default.randomUUID&&!e&&!n)return FE.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,MN.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,jN.unsafeStringify)(r)}o($N,"v4");l0.default=$N});var NE=S(u0=>{"use strict";Object.defineProperty(u0,"__esModule",{value:!0});var BN=require("crypto");function VN(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,BN.createHash)("sha1").update(n).digest()}o(VN,"sha1");u0.default=VN});var kE=S(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.URL=oo.DNS=void 0;var UN=NE(),f0=bu(),LE=bu();Object.defineProperty(oo,"DNS",{enumerable:!0,get:o(function(){return LE.DNS},"get")});Object.defineProperty(oo,"URL",{enumerable:!0,get:o(function(){return LE.URL},"get")});function d0(n,e,t,r){return(0,f0.default)(80,UN.default,n,e,t,r)}o(d0,"v5");d0.DNS=f0.DNS;d0.URL=f0.URL;oo.default=d0});var ME=S(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var qN=Rs(),WN=r0(),GN=i0();function zN(n,e,t){n??={},t??=0;let r=(0,WN.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,GN.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,qN.unsafeStringify)(r)}o(zN,"v6");h0.default=zN});var jE=S(p0=>{"use strict";Object.defineProperty(p0,"__esModule",{value:!0});var HN=gu(),QN=Rs();function YN(n){let e=typeof n=="string"?(0,HN.default)(n):n,t=KN(e);return typeof n=="string"?(0,QN.unsafeStringify)(t):t}o(YN,"v6ToV1");p0.default=YN;function KN(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(KN,"_v6ToV1")});var UE=S(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.updateV7State=void 0;var $E=Zd(),XN=Rs(),m0={};function JN(n,e,t){let r;if(n)r=BE(n.random??n.rng?.()??(0,$E.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,$E.default)();VE(m0,i,s),r=BE(s,m0.msecs,m0.seq,e,t)}return e??(0,XN.unsafeStringify)(r)}o(JN,"v7");function VE(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(VE,"updateV7State");vu.updateV7State=VE;function BE(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(BE,"v7Bytes");vu.default=JN});var qE=S(g0=>{"use strict";Object.defineProperty(g0,"__esModule",{value:!0});var ZN=mu();function eL(n){if(!(0,ZN.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(eL,"version");g0.default=eL});var _n=S(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.version=ot.validate=ot.v7=ot.v6ToV1=ot.v6=ot.v5=ot.v4=ot.v3=ot.v1ToV6=ot.v1=ot.stringify=ot.parse=ot.NIL=ot.MAX=void 0;var tL=SE();Object.defineProperty(ot,"MAX",{enumerable:!0,get:o(function(){return tL.default},"get")});var rL=bE();Object.defineProperty(ot,"NIL",{enumerable:!0,get:o(function(){return rL.default},"get")});var nL=gu();Object.defineProperty(ot,"parse",{enumerable:!0,get:o(function(){return nL.default},"get")});var iL=Rs();Object.defineProperty(ot,"stringify",{enumerable:!0,get:o(function(){return iL.default},"get")});var sL=r0();Object.defineProperty(ot,"v1",{enumerable:!0,get:o(function(){return sL.default},"get")});var aL=i0();Object.defineProperty(ot,"v1ToV6",{enumerable:!0,get:o(function(){return aL.default},"get")});var oL=OE();Object.defineProperty(ot,"v3",{enumerable:!0,get:o(function(){return oL.default},"get")});var cL=DE();Object.defineProperty(ot,"v4",{enumerable:!0,get:o(function(){return cL.default},"get")});var lL=kE();Object.defineProperty(ot,"v5",{enumerable:!0,get:o(function(){return lL.default},"get")});var uL=ME();Object.defineProperty(ot,"v6",{enumerable:!0,get:o(function(){return uL.default},"get")});var fL=jE();Object.defineProperty(ot,"v6ToV1",{enumerable:!0,get:o(function(){return fL.default},"get")});var dL=UE();Object.defineProperty(ot,"v7",{enumerable:!0,get:o(function(){return dL.default},"get")});var hL=mu();Object.defineProperty(ot,"validate",{enumerable:!0,get:o(function(){return hL.default},"get")});var pL=qE();Object.defineProperty(ot,"version",{enumerable:!0,get:o(function(){return pL.default},"get")})});var S0=S(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.Exo003UUIDGenerator=void 0;var y0=_n(),WE=Kd(),_0=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,y0.v5)(e,WE.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,y0.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,y0.v5)(e,WE.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)}};eh.Exo003UUIDGenerator=_0});var zE=S(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.Exo003Parser=void 0;var pt=Kd(),wu=S0(),ua=xe(),th=He(),GE=qt(),mL=ri(),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===pt.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(pt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(pt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=pt.ALLOWED_PROPERTIES[s],c=pt.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 pt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case pt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case pt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case pt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case pt.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 pt.Exo003MetadataType.Namespace:return{...r,metadata:pt.Exo003MetadataType.Namespace,uri:e.uri};case pt.Exo003MetadataType.Anchor:return{...r,metadata:pt.Exo003MetadataType.Anchor,uri:e.uri};case pt.Exo003MetadataType.BlankNode:return{...r,metadata:pt.Exo003MetadataType.BlankNode,uri:e.uri};case pt.Exo003MetadataType.Statement:return{...r,metadata:pt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case pt.Exo003MetadataType.Body:return{...r,metadata:pt.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 ua.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 ua.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 ua.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 ua.IRI(i.value);else if(i.type==="blank")s=new GE.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 ua.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new ua.IRI(l.value);else if(l.type==="blank")u=new GE.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new th.Literal(f,new ua.IRI(l.datatype));else{let d=l.language||pt.DEFAULT_LANGUAGE_TAG;u=(0,th.createDirectionalLiteral)(f,d,l.direction)}}return new mL.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new th.Literal(t,new ua.IRI(r.datatype));let i=r?.language||pt.DEFAULT_LANGUAGE_TAG;return(0,th.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(pt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case pt.Exo003MetadataType.Namespace:return wu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case pt.Exo003MetadataType.Anchor:return wu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case pt.Exo003MetadataType.BlankNode:return wu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case pt.Exo003MetadataType.Statement:{let r=e;return wu.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case pt.Exo003MetadataType.Body:{let r=e;return wu.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};rh.Exo003Parser=b0});var v0=S(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.Exo003Parser=jr.Exo003UUIDGenerator=jr.UUID_URL_NAMESPACE=jr.DEFAULT_LANGUAGE_TAG=jr.REQUIRED_PROPERTIES=jr.ALLOWED_PROPERTIES=jr.Exo003MetadataType=void 0;var Eu=Kd();Object.defineProperty(jr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Eu.Exo003MetadataType},"get")});Object.defineProperty(jr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Eu.ALLOWED_PROPERTIES},"get")});Object.defineProperty(jr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Eu.REQUIRED_PROPERTIES},"get")});Object.defineProperty(jr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Eu.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(jr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Eu.UUID_URL_NAMESPACE},"get")});var gL=S0();Object.defineProperty(jr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return gL.Exo003UUIDGenerator},"get")});var yL=zE();Object.defineProperty(jr,"Exo003Parser",{enumerable:!0,get:o(function(){return yL.Exo003Parser},"get")})});var Ps=S(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.WikiLinkHelpers=void 0;var Tu=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)}};nh.WikiLinkHelpers=Tu;Tu.WIKI_LINK_PATTERN=/\[\[|\]\]/g;Tu.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var On=S(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.CommandBindingProperty=et.GroundingProperty=et.PreconditionProperty=et.CommandProperty=et.GroundingType=et.getEffortStatusLabel=et.isTrashedStatus=et.isDoneStatus=et.normalizeEffortStatus=et.EFFORT_STATUS_OPTIONS=et.STATUS_NAME_TO_WIKILINK=et.STATUS_NAME_TO_ENUM=et.EFFORT_STATUS_CONFIG=et.EffortStatus=et.AssetClass=void 0;var _L=du();Object.defineProperty(et,"AssetClass",{enumerable:!0,get:o(function(){return _L.AssetClass},"get")});var SL=fc();Object.defineProperty(et,"EffortStatus",{enumerable:!0,get:o(function(){return SL.EffortStatus},"get")});var fa=My();Object.defineProperty(et,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return fa.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(et,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return fa.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(et,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return fa.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(et,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return fa.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(et,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return fa.normalizeEffortStatus},"get")});Object.defineProperty(et,"isDoneStatus",{enumerable:!0,get:o(function(){return fa.isDoneStatus},"get")});Object.defineProperty(et,"isTrashedStatus",{enumerable:!0,get:o(function(){return fa.isTrashedStatus},"get")});Object.defineProperty(et,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return fa.getEffortStatusLabel},"get")});var bL=dc();Object.defineProperty(et,"GroundingType",{enumerable:!0,get:o(function(){return bL.GroundingType},"get")});var ih=jy();Object.defineProperty(et,"CommandProperty",{enumerable:!0,get:o(function(){return ih.CommandProperty},"get")});Object.defineProperty(et,"PreconditionProperty",{enumerable:!0,get:o(function(){return ih.PreconditionProperty},"get")});Object.defineProperty(et,"GroundingProperty",{enumerable:!0,get:o(function(){return ih.GroundingProperty},"get")});Object.defineProperty(et,"CommandBindingProperty",{enumerable:!0,get:o(function(){return ih.CommandBindingProperty},"get")})});var uo=S($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.hasClass=lo;$r.isAreaOrProject=vL;$r.isEffort=wL;$r.hasStatus=EL;$r.isAssetArchived=TL;$r.hasEmptyProperties=AL;$r.needsFolderRepair=xL;$r.getTodayDateString=w0;$r.isPlannedForToday=CL;$r.hasPlannedStartTimestamp=IL;$r.extractDailyNoteDate=RL;$r.isCurrentDateGteDay=OL;$r.inheritsFromPrototype=YE;$r.isPrototypeClass=FL;var QE=Ps(),co=On();function lo(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>QE.WikiLinkHelpers.normalize(r)===e):!1}o(lo,"hasClass");function vL(n){return lo(n,co.AssetClass.AREA)||lo(n,co.AssetClass.PROJECT)}o(vL,"isAreaOrProject");function wL(n){return lo(n,co.AssetClass.TASK)||lo(n,co.AssetClass.PROJECT)||lo(n,co.AssetClass.MEETING)}o(wL,"isEffort");function EL(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?QE.WikiLinkHelpers.normalize(t)===e:!1}o(EL,"hasStatus");function TL(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(TL,"isAssetArchived");function AL(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(AL,"hasEmptyProperties");function xL(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(xL,"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 CL(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(CL,"isPlannedForToday");function IL(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(IL,"hasPlannedStartTimestamp");function RL(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(RL,"extractDailyNoteDate");function OL(n){return w0()>=n}o(OL,"isCurrentDateGteDay");function HE(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(HE,"normalizeWithQuotes");var PL=10;function YE(n,e=PL){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=HE(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===co.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=HE(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(YE,"inheritsFromPrototype");function FL(n,e){return lo(n,co.AssetClass.CLASS)?YE(e):!1}o(FL,"isPrototypeClass")});var KE=S(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.canCreateTask=DL;mc.canCreateRelatedTask=NL;mc.canConvertTaskToProject=LL;mc.canSetCriticalityZone=kL;var pc=uo(),E0=On();function DL(n){return(0,pc.isAreaOrProject)(n.instanceClass)}o(DL,"canCreateTask");function NL(n){return!(!(0,pc.hasClass)(n.instanceClass,E0.AssetClass.TASK)||(0,pc.isAssetArchived)(n.isArchived))}o(NL,"canCreateRelatedTask");function LL(n){return(0,pc.hasClass)(n.instanceClass,E0.AssetClass.TASK)}o(LL,"canConvertTaskToProject");function kL(n){return!(!(0,pc.hasClass)(n.instanceClass,E0.AssetClass.TASK)||(0,pc.isAssetArchived)(n.isArchived))}o(kL,"canSetCriticalityZone")});var XE=S(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.canCreateProject=ML;gc.canMoveToAnalysis=jL;gc.canMoveToToDo=$L;gc.canConvertProjectToTask=BL;var da=uo(),ha=On();function ML(n){return(0,da.hasClass)(n.instanceClass,ha.AssetClass.AREA)||(0,da.hasClass)(n.instanceClass,ha.AssetClass.INITIATIVE)||(0,da.hasClass)(n.instanceClass,ha.AssetClass.PROJECT)}o(ML,"canCreateProject");function jL(n){return(0,da.hasClass)(n.instanceClass,ha.AssetClass.PROJECT)?(0,da.hasStatus)(n.currentStatus,ha.EffortStatus.BACKLOG):!1}o(jL,"canMoveToAnalysis");function $L(n){return(0,da.hasClass)(n.instanceClass,ha.AssetClass.PROJECT)?(0,da.hasStatus)(n.currentStatus,ha.EffortStatus.ANALYSIS):!1}o($L,"canMoveToToDo");function BL(n){return(0,da.hasClass)(n.instanceClass,ha.AssetClass.PROJECT)}o(BL,"canConvertProjectToTask")});var eT=S(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.canCreateChildArea=VL;sh.canSetActiveFocus=UL;var JE=uo(),ZE=On();function VL(n){return(0,JE.hasClass)(n.instanceClass,ZE.AssetClass.AREA)}o(VL,"canCreateChildArea");function UL(n){return(0,JE.hasClass)(n.instanceClass,ZE.AssetClass.AREA)}o(UL,"canSetActiveFocus")});var rT=S(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.canPlanOnToday=qL;rn.canPlanForEvening=WL;rn.canShiftDayBackward=GL;rn.canShiftDayForward=zL;rn.canSetDraftStatus=HL;rn.canMoveToBacklog=QL;rn.canStartEffort=YL;rn.canMarkDone=KL;rn.canTrashEffort=XL;rn.canVoteOnEffort=JL;rn.canRollbackStatus=ZL;rn.canArchiveTask=ek;rn.canMarkReviewed=tk;var tT=Ps(),ft=uo(),tn=On();function qL(n){return!(!(0,ft.isEffort)(n.instanceClass)||(0,ft.isPlannedForToday)(n.metadata))}o(qL,"canPlanOnToday");function WL(n){return!(0,ft.hasClass)(n.instanceClass,tn.AssetClass.TASK)&&!(0,ft.hasClass)(n.instanceClass,tn.AssetClass.MEETING)?!1:(0,ft.hasStatus)(n.currentStatus,tn.EffortStatus.BACKLOG)}o(WL,"canPlanForEvening");function GL(n){return(0,ft.isEffort)(n.instanceClass)?(0,ft.hasPlannedStartTimestamp)(n.metadata):!1}o(GL,"canShiftDayBackward");function zL(n){return(0,ft.isEffort)(n.instanceClass)?(0,ft.hasPlannedStartTimestamp)(n.metadata):!1}o(zL,"canShiftDayForward");function HL(n){return(0,ft.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(HL,"canSetDraftStatus");function QL(n){return(0,ft.isEffort)(n.instanceClass)?(0,ft.hasStatus)(n.currentStatus,tn.EffortStatus.DRAFT):!1}o(QL,"canMoveToBacklog");function YL(n){return(0,ft.isEffort)(n.instanceClass)?(0,ft.hasClass)(n.instanceClass,tn.AssetClass.TASK)||(0,ft.hasClass)(n.instanceClass,tn.AssetClass.MEETING)?(0,ft.hasStatus)(n.currentStatus,tn.EffortStatus.BACKLOG):(0,ft.hasClass)(n.instanceClass,tn.AssetClass.PROJECT)?(0,ft.hasStatus)(n.currentStatus,tn.EffortStatus.TODO):!1:!1}o(YL,"canStartEffort");function KL(n){return(0,ft.isEffort)(n.instanceClass)?(0,ft.hasStatus)(n.currentStatus,tn.EffortStatus.DOING):!1}o(KL,"canMarkDone");function XL(n){return(0,ft.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=tT.WikiLinkHelpers.normalize(r);return i===tn.EffortStatus.TRASHED||i===tn.EffortStatus.DONE}):!0:!1}o(XL,"canTrashEffort");function JL(n){return!(!(0,ft.isEffort)(n.instanceClass)||(0,ft.isAssetArchived)(n.isArchived))}o(JL,"canVoteOnEffort");function ZL(n){if(!(0,ft.isEffort)(n.instanceClass)||(0,ft.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||tT.WikiLinkHelpers.normalize(e)===tn.EffortStatus.TRASHED)}o(ZL,"canRollbackStatus");function ek(n){return!(0,ft.isAssetArchived)(n.isArchived)}o(ek,"canArchiveTask");function tk(n){return!(!(0,ft.hasClass)(n.instanceClass,tn.AssetClass.TASK)&&!(0,ft.hasClass)(n.instanceClass,tn.AssetClass.PROJECT)||(0,ft.isAssetArchived)(n.isArchived))}o(tk,"canMarkReviewed")});var nT=S(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.canCreateEvent=ik;Un.canCreateInstance=sk;Un.canCleanProperties=ak;Un.canRepairFolder=ok;Un.canRenameToUid=ck;Un.canCopyLabelToAliases=lk;Un.canCreateNarrowerConcept=uk;Un.canCreateSubclass=fk;Un.canCreateTaskForDailyNote=dk;Un.canCopyFleetingNoteLabel=hk;var Br=uo(),Fs=On(),rk="75302770-279e-4a59-ba85-09df29725713",nk="fca0a931-a01f-48e4-b72a-4af206c94bc7";function ik(n){return(0,Br.isAreaOrProject)(n.instanceClass)}o(ik,"canCreateEvent");function sk(n){return(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.TASK_PROTOTYPE)||(0,Br.hasClass)(n.instanceClass,rk)||(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.MEETING_PROTOTYPE)||(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.EVENT_PROTOTYPE)||(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.PROJECT_PROTOTYPE)||(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,Br.isPrototypeClass)(n.instanceClass,n.metadata)}o(sk,"canCreateInstance");function ak(n){return(0,Br.hasEmptyProperties)(n.metadata)}o(ak,"canCleanProperties");function ok(n){return(0,Br.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(ok,"canRepairFolder");function ck(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(ck,"canRenameToUid");function lk(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(lk,"canCopyLabelToAliases");function uk(n){return(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.CONCEPT)}o(uk,"canCreateNarrowerConcept");function fk(n){return(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.CLASS)}o(fk,"canCreateSubclass");function dk(n){return!(!(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.DAILY_NOTE)||n.isArchived||!(0,Br.extractDailyNoteDate)(n.metadata))}o(dk,"canCreateTaskForDailyNote");function hk(n){return(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.FLEETING_NOTE)||(0,Br.hasClass)(n.instanceClass,nk)}o(hk,"canCopyFleetingNoteLabel")});var sT=S(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.canCopyFleetingNoteLabel=L.canCreateTaskForDailyNote=L.canCreateSubclass=L.canCreateNarrowerConcept=L.canCopyLabelToAliases=L.canRenameToUid=L.canRepairFolder=L.canCleanProperties=L.canCreateInstance=L.canCreateEvent=L.canMarkReviewed=L.canArchiveTask=L.canRollbackStatus=L.canVoteOnEffort=L.canTrashEffort=L.canMarkDone=L.canStartEffort=L.canMoveToBacklog=L.canSetDraftStatus=L.canShiftDayForward=L.canShiftDayBackward=L.canPlanForEvening=L.canPlanOnToday=L.canSetActiveFocus=L.canCreateChildArea=L.canConvertProjectToTask=L.canMoveToToDo=L.canMoveToAnalysis=L.canCreateProject=L.canSetCriticalityZone=L.canConvertTaskToProject=L.canCreateRelatedTask=L.canCreateTask=L.isPrototypeClass=L.inheritsFromPrototype=L.isCurrentDateGteDay=L.extractDailyNoteDate=L.hasPlannedStartTimestamp=L.isPlannedForToday=L.getTodayDateString=L.needsFolderRepair=L.hasEmptyProperties=L.isAssetArchived=L.hasStatus=L.isEffort=L.isAreaOrProject=L.hasClass=void 0;var Sn=uo();Object.defineProperty(L,"hasClass",{enumerable:!0,get:o(function(){return Sn.hasClass},"get")});Object.defineProperty(L,"isAreaOrProject",{enumerable:!0,get:o(function(){return Sn.isAreaOrProject},"get")});Object.defineProperty(L,"isEffort",{enumerable:!0,get:o(function(){return Sn.isEffort},"get")});Object.defineProperty(L,"hasStatus",{enumerable:!0,get:o(function(){return Sn.hasStatus},"get")});Object.defineProperty(L,"isAssetArchived",{enumerable:!0,get:o(function(){return Sn.isAssetArchived},"get")});Object.defineProperty(L,"hasEmptyProperties",{enumerable:!0,get:o(function(){return Sn.hasEmptyProperties},"get")});Object.defineProperty(L,"needsFolderRepair",{enumerable:!0,get:o(function(){return Sn.needsFolderRepair},"get")});Object.defineProperty(L,"getTodayDateString",{enumerable:!0,get:o(function(){return Sn.getTodayDateString},"get")});Object.defineProperty(L,"isPlannedForToday",{enumerable:!0,get:o(function(){return Sn.isPlannedForToday},"get")});Object.defineProperty(L,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return Sn.hasPlannedStartTimestamp},"get")});Object.defineProperty(L,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return Sn.extractDailyNoteDate},"get")});Object.defineProperty(L,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return Sn.isCurrentDateGteDay},"get")});Object.defineProperty(L,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return Sn.inheritsFromPrototype},"get")});Object.defineProperty(L,"isPrototypeClass",{enumerable:!0,get:o(function(){return Sn.isPrototypeClass},"get")});var ah=KE();Object.defineProperty(L,"canCreateTask",{enumerable:!0,get:o(function(){return ah.canCreateTask},"get")});Object.defineProperty(L,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return ah.canCreateRelatedTask},"get")});Object.defineProperty(L,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return ah.canConvertTaskToProject},"get")});Object.defineProperty(L,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return ah.canSetCriticalityZone},"get")});var oh=XE();Object.defineProperty(L,"canCreateProject",{enumerable:!0,get:o(function(){return oh.canCreateProject},"get")});Object.defineProperty(L,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return oh.canMoveToAnalysis},"get")});Object.defineProperty(L,"canMoveToToDo",{enumerable:!0,get:o(function(){return oh.canMoveToToDo},"get")});Object.defineProperty(L,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return oh.canConvertProjectToTask},"get")});var iT=eT();Object.defineProperty(L,"canCreateChildArea",{enumerable:!0,get:o(function(){return iT.canCreateChildArea},"get")});Object.defineProperty(L,"canSetActiveFocus",{enumerable:!0,get:o(function(){return iT.canSetActiveFocus},"get")});var Pn=rT();Object.defineProperty(L,"canPlanOnToday",{enumerable:!0,get:o(function(){return Pn.canPlanOnToday},"get")});Object.defineProperty(L,"canPlanForEvening",{enumerable:!0,get:o(function(){return Pn.canPlanForEvening},"get")});Object.defineProperty(L,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Pn.canShiftDayBackward},"get")});Object.defineProperty(L,"canShiftDayForward",{enumerable:!0,get:o(function(){return Pn.canShiftDayForward},"get")});Object.defineProperty(L,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Pn.canSetDraftStatus},"get")});Object.defineProperty(L,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Pn.canMoveToBacklog},"get")});Object.defineProperty(L,"canStartEffort",{enumerable:!0,get:o(function(){return Pn.canStartEffort},"get")});Object.defineProperty(L,"canMarkDone",{enumerable:!0,get:o(function(){return Pn.canMarkDone},"get")});Object.defineProperty(L,"canTrashEffort",{enumerable:!0,get:o(function(){return Pn.canTrashEffort},"get")});Object.defineProperty(L,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Pn.canVoteOnEffort},"get")});Object.defineProperty(L,"canRollbackStatus",{enumerable:!0,get:o(function(){return Pn.canRollbackStatus},"get")});Object.defineProperty(L,"canArchiveTask",{enumerable:!0,get:o(function(){return Pn.canArchiveTask},"get")});Object.defineProperty(L,"canMarkReviewed",{enumerable:!0,get:o(function(){return Pn.canMarkReviewed},"get")});var Xi=nT();Object.defineProperty(L,"canCreateEvent",{enumerable:!0,get:o(function(){return Xi.canCreateEvent},"get")});Object.defineProperty(L,"canCreateInstance",{enumerable:!0,get:o(function(){return Xi.canCreateInstance},"get")});Object.defineProperty(L,"canCleanProperties",{enumerable:!0,get:o(function(){return Xi.canCleanProperties},"get")});Object.defineProperty(L,"canRepairFolder",{enumerable:!0,get:o(function(){return Xi.canRepairFolder},"get")});Object.defineProperty(L,"canRenameToUid",{enumerable:!0,get:o(function(){return Xi.canRenameToUid},"get")});Object.defineProperty(L,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return Xi.canCopyLabelToAliases},"get")});Object.defineProperty(L,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return Xi.canCreateNarrowerConcept},"get")});Object.defineProperty(L,"canCreateSubclass",{enumerable:!0,get:o(function(){return Xi.canCreateSubclass},"get")});Object.defineProperty(L,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return Xi.canCreateTaskForDailyNote},"get")});Object.defineProperty(L,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return Xi.canCopyFleetingNoteLabel},"get")})});var aT=S(fo=>{"use strict";var pk=fo&&fo.__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]})),mk=fo&&fo.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&pk(e,n,t)};Object.defineProperty(fo,"__esModule",{value:!0});mk(sT(),fo)});var ch=S(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.PropertyFieldType=void 0;Au.rangeToFieldType=_k;var Rr;(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"})(Rr||(Au.PropertyFieldType=Rr={}));var oT="http://www.w3.org/2001/XMLSchema#",gk="https://exocortex.my/ontology/exo#",yk="https://exocortex.my/ontology/ems#";function _k(n){if(!n)return Rr.Unknown;let e=n.trim();if(!e)return Rr.Unknown;if(e.startsWith(oT)){let t=e.substring(oT.length);return T0(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return T0(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return T0(r)}return e.startsWith(yk)||e.startsWith("ems:")?Sk(e):e.startsWith(gk)||e.startsWith("exo:")||bk(e)?Rr.Reference:Rr.Text}o(_k,"rangeToFieldType");function T0(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Rr.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 Rr.Number;case"date":return Rr.Date;case"datetime":case"datetimestamp":return Rr.DateTime;case"boolean":return Rr.Boolean;case"time":return Rr.Timestamp;default:return Rr.Text}}o(T0,"xsdTypeToFieldType");function Sk(n){let e=n.toLowerCase();return e.includes("effortstatus")?Rr.StatusSelect:e.includes("tasksize")?Rr.SizeSelect:Rr.Reference}o(Sk,"emsTypeToFieldType");function bk(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(bk,"isClassReference")});var A0=S(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.propertyNameToUri=vk;xu.uriToPropertyName=cT;xu.extractPropertyLabel=wk;function vk(n){return n.replace(/^([a-z]+)__/,"$1:")}o(vk,"propertyNameToUri");function cT(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(cT,"uriToPropertyName");function wk(n){let r=(n.includes(":")?cT(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(wk,"extractPropertyLabel")});var lh={};Sy(lh,{__assign:()=>C0,__asyncDelegator:()=>Lk,__asyncGenerator:()=>Nk,__asyncValues:()=>kk,__await:()=>Cu,__awaiter:()=>Ik,__classPrivateFieldGet:()=>Bk,__classPrivateFieldSet:()=>Vk,__createBinding:()=>Ok,__decorate:()=>Ak,__exportStar:()=>Pk,__extends:()=>Ek,__generator:()=>Rk,__importDefault:()=>$k,__importStar:()=>jk,__makeTemplateObject:()=>Mk,__metadata:()=>Ck,__param:()=>xk,__read:()=>lT,__rest:()=>Tk,__spread:()=>Fk,__spreadArrays:()=>Dk,__values:()=>I0});function Ek(n,e){x0(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Tk(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 Ak(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 xk(n,e){return function(t,r){e(t,r,n)}}function Ck(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function Ik(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 Rk(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 Ok(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function Pk(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 lT(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 Fk(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(lT(arguments[e]));return n}function Dk(){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 Cu(n){return this instanceof Cu?(this.v=n,this):new Cu(n)}function Nk(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(_,b){s.push([h,p,_,b])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(_){d(s[0][3],_)}}function l(h){h.value instanceof Cu?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 Lk(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:Cu(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function kk(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 Mk(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function jk(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 $k(n){return n&&n.__esModule?n:{default:n}}function Bk(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function Vk(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 x0,C0,uh=TD(()=>{x0=o(function(n,e){return x0=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])},x0(n,e)},"extendStatics");o(Ek,"__extends");C0=o(function(){return C0=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"),C0.apply(this,arguments)},"__assign");o(Tk,"__rest");o(Ak,"__decorate");o(xk,"__param");o(Ck,"__metadata");o(Ik,"__awaiter");o(Rk,"__generator");o(Ok,"__createBinding");o(Pk,"__exportStar");o(I0,"__values");o(lT,"__read");o(Fk,"__spread");o(Dk,"__spreadArrays");o(Cu,"__await");o(Nk,"__asyncGenerator");o(Lk,"__asyncDelegator");o(kk,"__asyncValues");o(Mk,"__makeTemplateObject");o(jk,"__importStar");o($k,"__importDefault");o(Bk,"__classPrivateFieldGet");o(Vk,"__classPrivateFieldSet")});var P0=S(O0=>{"use strict";Object.defineProperty(O0,"__esModule",{value:!0});var R0;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(R0||(R0={}));O0.default=R0});var uT=S(F0=>{"use strict";Object.defineProperty(F0,"__esModule",{value:!0});var Uk=P0();Object.defineProperty(F0,"Lifecycle",{enumerable:!0,get:o(function(){return Uk.default},"get")})});var ho=S(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.defineInjectionTokenMetadata=ni.getParamInfo=ni.INJECTION_TOKEN_METADATA_KEY=void 0;ni.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function qk(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(ni.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(qk,"getParamInfo");ni.getParamInfo=qk;function Wk(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(ni.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(ni.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(Wk,"defineInjectionTokenMetadata");ni.defineInjectionTokenMetadata=Wk});var D0=S(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});fh.isClassProvider=void 0;function Gk(n){return!!n.useClass}o(Gk,"isClassProvider");fh.isClassProvider=Gk});var N0=S(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.isFactoryProvider=void 0;function zk(n){return!!n.useFactory}o(zk,"isFactoryProvider");dh.isFactoryProvider=zk});var ph=S(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.delay=yc.DelayedConstructor=void 0;var hh=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}};yc.DelayedConstructor=hh;function Hk(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new hh(n)}o(Hk,"delay");yc.delay=Hk});var mh=S(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.isConstructorToken=Ji.isTransformDescriptor=Ji.isTokenDescriptor=Ji.isNormalToken=void 0;var Qk=ph();function Yk(n){return typeof n=="string"||typeof n=="symbol"}o(Yk,"isNormalToken");Ji.isNormalToken=Yk;function Kk(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(Kk,"isTokenDescriptor");Ji.isTokenDescriptor=Kk;function Xk(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(Xk,"isTransformDescriptor");Ji.isTransformDescriptor=Xk;function Jk(n){return typeof n=="function"||n instanceof Qk.DelayedConstructor}o(Jk,"isConstructorToken");Ji.isConstructorToken=Jk});var L0=S(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.isTokenProvider=void 0;function Zk(n){return!!n.useToken}o(Zk,"isTokenProvider");gh.isTokenProvider=Zk});var k0=S(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.isValueProvider=void 0;function e4(n){return n.useValue!=null}o(e4,"isValueProvider");yh.isValueProvider=e4});var M0=S(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});var t4=D0();Object.defineProperty(po,"isClassProvider",{enumerable:!0,get:o(function(){return t4.isClassProvider},"get")});var r4=N0();Object.defineProperty(po,"isFactoryProvider",{enumerable:!0,get:o(function(){return r4.isFactoryProvider},"get")});var n4=mh();Object.defineProperty(po,"isNormalToken",{enumerable:!0,get:o(function(){return n4.isNormalToken},"get")});var i4=L0();Object.defineProperty(po,"isTokenProvider",{enumerable:!0,get:o(function(){return i4.isTokenProvider},"get")});var s4=k0();Object.defineProperty(po,"isValueProvider",{enumerable:!0,get:o(function(){return s4.isValueProvider},"get")})});var fT=S(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.isProvider=void 0;var a4=D0(),o4=k0(),c4=L0(),l4=N0();function u4(n){return a4.isClassProvider(n)||o4.isValueProvider(n)||c4.isTokenProvider(n)||l4.isFactoryProvider(n)}o(u4,"isProvider");_h.isProvider=u4});var B0=S($0=>{"use strict";Object.defineProperty($0,"__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,[])}};$0.default=j0});var dT=S(U0=>{"use strict";Object.defineProperty(U0,"__esModule",{value:!0});var f4=B0(),V0=class extends f4.default{static{o(this,"Registry")}};U0.default=V0});var hT=S(W0=>{"use strict";Object.defineProperty(W0,"__esModule",{value:!0});var q0=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};W0.default=q0});var G0=S(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.formatErrorCtor=void 0;function d4(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(d4,"formatDependency");function h4(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 eE(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(eE,"incrementNodeInspectorPort");function Ny(){if(it.env.NO_COLOR||it.env.FORCE_COLOR==="0"||it.env.FORCE_COLOR==="false")return!1;if(it.env.FORCE_COLOR||it.env.CLICOLOR_FORCE!==void 0)return!0}o(Ny,"useColor");Ly.Command=Dy;Ly.useColor=Ny});var sE=S(jn=>{var{Argument:rE}=Nd(),{Command:ky}=tE(),{CommanderError:jD,InvalidArgumentError:nE}=fu(),{Help:$D}=xy(),{Option:iE}=Oy();jn.program=new ky;jn.createCommand=n=>new ky(n);jn.createOption=(n,e)=>new iE(n,e);jn.createArgument=(n,e)=>new rE(n,e);jn.Command=ky;jn.Option=iE;jn.Argument=rE;jn.Help=$D;jn.CommanderError=jD;jn.InvalidArgumentError=nE;jn.InvalidOptionArgumentError=nE});var du=S(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});kd.AssetClass=void 0;var oE;(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"})(oE||(kd.AssetClass=oE={}))});var fc=S(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.EffortStatus=void 0;var cE;(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"})(cE||(Md.EffortStatus=cE={}))});var My=S(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.EFFORT_STATUS_OPTIONS=Ut.STATUS_NAME_TO_WIKILINK=Ut.STATUS_NAME_TO_ENUM=Ut.EFFORT_STATUS_CONFIG=void 0;Ut.normalizeEffortStatus=BD;Ut.isDoneStatus=VD;Ut.isTrashedStatus=UD;Ut.getEffortStatusLabel=qD;var Ki=fc();Ut.EFFORT_STATUS_CONFIG=[{name:"Draft",status:Ki.EffortStatus.DRAFT,wikilink:"[[ems__EffortStatusDraft]]"},{name:"Backlog",status:Ki.EffortStatus.BACKLOG,wikilink:"[[ems__EffortStatusBacklog]]"},{name:"Analysis",status:Ki.EffortStatus.ANALYSIS,wikilink:"[[ems__EffortStatusAnalysis]]"},{name:"To Do",status:Ki.EffortStatus.TODO,wikilink:"[[ems__EffortStatusToDo]]"},{name:"Doing",status:Ki.EffortStatus.DOING,wikilink:"[[ems__EffortStatusDoing]]"},{name:"Done",status:Ki.EffortStatus.DONE,wikilink:"[[ems__EffortStatusDone]]"},{name:"Trashed",status:Ki.EffortStatus.TRASHED,wikilink:"[[ems__EffortStatusTrashed]]"}];Ut.STATUS_NAME_TO_ENUM=Object.fromEntries(Ut.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.status]));Ut.STATUS_NAME_TO_WIKILINK=Object.fromEntries(Ut.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.wikilink]));Ut.EFFORT_STATUS_OPTIONS=Ut.EFFORT_STATUS_CONFIG.map(n=>({value:n.wikilink,label:n.name}));function BD(n,e=Ki.EffortStatus.DRAFT){if(n.startsWith("ems__")){let r=Ut.EFFORT_STATUS_CONFIG.find(i=>i.status===n);return r?r.status:e}return Ut.STATUS_NAME_TO_ENUM[n]??e}o(BD,"normalizeEffortStatus");function VD(n){return n===Ki.EffortStatus.DONE}o(VD,"isDoneStatus");function UD(n){return n===Ki.EffortStatus.TRASHED}o(UD,"isTrashedStatus");function qD(n){if(!n)return"-";let e=String(n);if(e==="")return"-";for(let r of Ut.EFFORT_STATUS_CONFIG)if(r.wikilink===e||`[[${e}]]`===r.wikilink||r.status===e||r.name===e)return r.name;let t=e.toLowerCase();for(let r of Ut.EFFORT_STATUS_CONFIG)if(r.name.toLowerCase()===t)return r.name;return e}o(qD,"getEffortStatusLabel")});var dc=S(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.GroundingType=void 0;var lE;(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"})(lE||(jd.GroundingType=lE={}))});var jy=S($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.CommandBindingStyleProperty=$n.CommandBindingProperty=$n.GroundingProperty=$n.PreconditionProperty=$n.CommandProperty=void 0;$n.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"};$n.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk"};$n.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",TARGET_VALUE:"exocmd__Grounding_targetValue",STEPS:"exocmd__Grounding_steps"};$n.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",GROUP:"exocmd__CommandBinding_group",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};$n.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 uE=S(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.STYLE_SOURCE_VALUES=yn.LABEL_CLASS_VALUES=yn.COMMAND_VARIANT_VALUES=void 0;yn.isCommandVariant=WD;yn.isLabelClass=GD;yn.isStyleSource=zD;yn.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);yn.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);yn.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function WD(n){return typeof n=="string"&&yn.COMMAND_VARIANT_VALUES.includes(n)}o(WD,"isCommandVariant");function GD(n){return typeof n=="string"&&yn.LABEL_CLASS_VALUES.includes(n)}o(GD,"isLabelClass");function zD(n){return typeof n=="string"&&yn.STYLE_SOURCE_VALUES.includes(n)}o(zD,"isStyleSource")});var fE=S(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.isCommandFrontmatter=HD;hc.isPreconditionFrontmatter=QD;hc.isGroundingFrontmatter=YD;hc.isCommandBindingFrontmatter=KD;function HD(n){return $d(n,"exocmd__Command")}o(HD,"isCommandFrontmatter");function QD(n){return $d(n,"exocmd__Precondition")}o(QD,"isPreconditionFrontmatter");function YD(n){return $d(n,"exocmd__Grounding")}o(YD,"isGroundingFrontmatter");function KD(n){return $d(n,"exocmd__CommandBinding")}o(KD,"isCommandBindingFrontmatter");function $d(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($d,"hasInstanceClass")});var dE=S(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.hasPosition=XD;Bd.isFixed=JD;function XD(n){return typeof n.x=="number"&&typeof n.y=="number"}o(XD,"hasPosition");function JD(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(JD,"isFixed")});var hE=S(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.createEmptyGraphData=ZD;Vd.mergeGraphData=eN;function ZD(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(ZD,"createEmptyGraphData");function eN(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(eN,"mergeGraphData")});var $y=S(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.createEdgeId=tN;Ud.edgesEqual=rN;function tN(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(tN,"createEdgeId");function rN(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(rN,"edgesEqual")});var By=S(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.BUILT_IN_EDGE_STYLES=jt.BUILT_IN_NODE_STYLES=jt.DEFAULT_EDGE_STYLE=jt.DEFAULT_NODE_STYLE=jt.RDF_TYPE_PREDICATES=void 0;jt.mergeNodeStyles=nN;jt.mergeEdgeStyles=iN;jt.extractLocalName=sN;jt.isClassType=aN;jt.isTypePredicate=oN;jt.isSubClassPredicate=cN;jt.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"};jt.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};jt.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};jt.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"}};jt.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 nN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(nN,"mergeNodeStyles");function iN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(iN,"mergeEdgeStyles");function sN(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(sN,"extractLocalName");function aN(n){return n===jt.RDF_TYPE_PREDICATES.RDFS_CLASS||n===jt.RDF_TYPE_PREDICATES.OWL_CLASS}o(aN,"isClassType");function oN(n){return n===jt.RDF_TYPE_PREDICATES.RDF_TYPE}o(oN,"isTypePredicate");function cN(n){return n===jt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(cN,"isSubClassPredicate")});var mE=S(pE=>{"use strict";Object.defineProperty(pE,"__esModule",{value:!0})});var xe=S(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.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)}}};qd.IRI=Vy});var He=S(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.Literal=void 0;so.parseLanguageTag=gE;so.createDirectionalLiteral=uN;so.createLiteralFromLanguageTag=fN;var lN="http://www.w3.org/2001/XMLSchema#string",hu=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===lN?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}};so.Literal=hu;function gE(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(gE,"parseLanguageTag");function uN(n,e,t){return new hu(n,void 0,e,t)}o(uN,"createDirectionalLiteral");function fN(n,e){let{language:t,direction:r}=gE(e);return new hu(n,void 0,t,r)}o(fN,"createLiteralFromLanguageTag")});var qt=S(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.BlankNode=void 0;var Wd=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())}};Gd.BlankNode=Wd;Wd.counter=0});var Cr=S(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.Namespace=void 0;var yE=xe(),ft=class{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 yE.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new yE.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)}};zd.Namespace=ft;ft.RDF=new ft("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");ft.RDFS=new ft("rdfs","http://www.w3.org/2000/01/rdf-schema#");ft.OWL=new ft("owl","http://www.w3.org/2002/07/owl#");ft.XSD=new ft("xsd","http://www.w3.org/2001/XMLSchema#");ft.EXO=new ft("exo","https://exocortex.my/ontology/exo#");ft.EMS=new ft("ems","https://exocortex.my/ontology/ems#");ft.EXOCMD=new ft("exocmd","https://exocortex.my/ontology/exocmd#");ft.IMS=new ft("ims","https://exocortex.my/ontology/ims#");ft.ZTLK=new ft("ztlk","https://exocortex.my/ontology/ztlk#");ft.PTMS=new ft("ptms","https://exocortex.my/ontology/ptms#");ft.LIT=new ft("lit","https://exocortex.my/ontology/lit#");ft.INBOX=new ft("inbox","https://exocortex.my/ontology/inbox#");ft.PMBOK=new ft("pmbok","https://exocortex.my/ontology/pmbok#")});var ri=S(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.Triple=void 0;var Uy=xe(),qy=He(),Wy=qt(),Gy=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 Uy.IRI&&t instanceof Uy.IRI||e instanceof Wy.BlankNode&&t instanceof Wy.BlankNode||e instanceof qy.Literal&&t instanceof qy.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 Uy.IRI?`<${e.value}>`:e instanceof Wy.BlankNode||e instanceof qy.Literal||this.isQuotedTriple(e)?e.toString():""}};Hd.Triple=Gy});var pu=S(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.QuotedTriple=void 0;var zy=xe(),Hy=He(),Qy=qt(),Yy=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 zy.IRI&&t instanceof zy.IRI||e instanceof Qy.BlankNode&&t instanceof Qy.BlankNode||e instanceof Hy.Literal&&t instanceof Hy.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 zy.IRI?`<${e.value}>`:e instanceof Qy.BlankNode||e instanceof Hy.Literal||e instanceof n?e.toString():""}};Qd.QuotedTriple=Yy});var _E=S(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.QuotedTriple=Xt.Triple=Xt.Namespace=Xt.BlankNode=Xt.createLiteralFromLanguageTag=Xt.createDirectionalLiteral=Xt.parseLanguageTag=Xt.Literal=Xt.IRI=void 0;var dN=xe();Object.defineProperty(Xt,"IRI",{enumerable:!0,get:o(function(){return dN.IRI},"get")});var Yd=He();Object.defineProperty(Xt,"Literal",{enumerable:!0,get:o(function(){return Yd.Literal},"get")});Object.defineProperty(Xt,"parseLanguageTag",{enumerable:!0,get:o(function(){return Yd.parseLanguageTag},"get")});Object.defineProperty(Xt,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return Yd.createDirectionalLiteral},"get")});Object.defineProperty(Xt,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return Yd.createLiteralFromLanguageTag},"get")});var hN=qt();Object.defineProperty(Xt,"BlankNode",{enumerable:!0,get:o(function(){return hN.BlankNode},"get")});var pN=Cr();Object.defineProperty(Xt,"Namespace",{enumerable:!0,get:o(function(){return pN.Namespace},"get")});var mN=ri();Object.defineProperty(Xt,"Triple",{enumerable:!0,get:o(function(){return mN.Triple},"get")});var gN=pu();Object.defineProperty(Xt,"QuotedTriple",{enumerable:!0,get:o(function(){return gN.QuotedTriple},"get")})});var Kd=S(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.UUID_URL_NAMESPACE=Vn.DEFAULT_LANGUAGE_TAG=Vn.REQUIRED_PROPERTIES=Vn.ALLOWED_PROPERTIES=Vn.Exo003MetadataType=void 0;var Bn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(Bn||(Vn.Exo003MetadataType=Bn={}));Vn.ALLOWED_PROPERTIES={[Bn.Namespace]:["metadata","uri","aliases"],[Bn.Anchor]:["metadata","uri","aliases"],[Bn.BlankNode]:["metadata","uri","aliases"],[Bn.Statement]:["metadata","subject","predicate","object","aliases"],[Bn.Body]:["metadata","subject","predicate","aliases"]};Vn.REQUIRED_PROPERTIES={[Bn.Namespace]:["metadata","uri"],[Bn.Anchor]:["metadata","uri"],[Bn.BlankNode]:["metadata","uri"],[Bn.Statement]:["metadata","subject","predicate","object"],[Bn.Body]:["metadata","subject","predicate"]};Vn.DEFAULT_LANGUAGE_TAG="ru";Vn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var SE=S(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var bE=S(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});Xy.default="00000000-0000-0000-0000-000000000000"});var vE=S(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});Jy.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 mu=S(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var yN=vE();function _N(n){return typeof n=="string"&&yN.default.test(n)}o(_N,"validate");Zy.default=_N});var gu=S(e0=>{"use strict";Object.defineProperty(e0,"__esModule",{value:!0});var SN=mu();function bN(n){if(!(0,SN.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(bN,"parse");e0.default=bN});var Rs=S(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.unsafeStringify=void 0;var vN=mu(),Ir=[];for(let n=0;n<256;++n)Ir.push((n+256).toString(16).slice(1));function wE(n,e=0){return(Ir[n[e+0]]+Ir[n[e+1]]+Ir[n[e+2]]+Ir[n[e+3]]+"-"+Ir[n[e+4]]+Ir[n[e+5]]+"-"+Ir[n[e+6]]+Ir[n[e+7]]+"-"+Ir[n[e+8]]+Ir[n[e+9]]+"-"+Ir[n[e+10]]+Ir[n[e+11]]+Ir[n[e+12]]+Ir[n[e+13]]+Ir[n[e+14]]+Ir[n[e+15]]).toLowerCase()}o(wE,"unsafeStringify");yu.unsafeStringify=wE;function wN(n,e=0){let t=wE(n,e);if(!(0,vN.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(wN,"stringify");yu.default=wN});var Zd=S(t0=>{"use strict";Object.defineProperty(t0,"__esModule",{value:!0});var EN=require("crypto"),Jd=new Uint8Array(256),Xd=Jd.length;function TN(){return Xd>Jd.length-16&&((0,EN.randomFillSync)(Jd),Xd=0),Jd.slice(Xd,Xd+=16)}o(TN,"rng");t0.default=TN});var r0=S(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.updateV1State=void 0;var EE=Zd(),AN=Rs(),_u={};function xN(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=TE(n.random??n.rng?.()??(0,EE.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,EE.default)();AE(_u,s,a),r=TE(a,_u.msecs,_u.nsecs,i?void 0:_u.clockseq,i?void 0:_u.node,e,t)}return e??(0,AN.unsafeStringify)(r)}o(xN,"v1");function AE(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(AE,"updateV1State");Su.updateV1State=AE;function TE(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(TE,"v1Bytes");Su.default=xN});var i0=S(n0=>{"use strict";Object.defineProperty(n0,"__esModule",{value:!0});var CN=gu(),IN=Rs();function RN(n){let e=typeof n=="string"?(0,CN.default)(n):n,t=ON(e);return typeof n=="string"?(0,IN.unsafeStringify)(t):t}o(RN,"v1ToV6");n0.default=RN;function ON(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(ON,"_v1ToV6")});var xE=S(s0=>{"use strict";Object.defineProperty(s0,"__esModule",{value:!0});var PN=require("crypto");function FN(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,PN.createHash)("md5").update(n).digest()}o(FN,"md5");s0.default=FN});var bu=S(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.URL=Os.DNS=Os.stringToBytes=void 0;var CE=gu(),DN=Rs();function IE(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(IE,"stringToBytes");Os.stringToBytes=IE;Os.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Os.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function NN(n,e,t,r,i,s){let a=typeof t=="string"?IE(t):t,c=typeof r=="string"?(0,CE.default)(r):r;if(typeof r=="string"&&(r=(0,CE.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,DN.unsafeStringify)(l)}o(NN,"v35");Os.default=NN});var OE=S(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.URL=ao.DNS=void 0;var LN=xE(),a0=bu(),RE=bu();Object.defineProperty(ao,"DNS",{enumerable:!0,get:o(function(){return RE.DNS},"get")});Object.defineProperty(ao,"URL",{enumerable:!0,get:o(function(){return RE.URL},"get")});function o0(n,e,t,r){return(0,a0.default)(48,LN.default,n,e,t,r)}o(o0,"v3");o0.DNS=a0.DNS;o0.URL=a0.URL;ao.default=o0});var PE=S(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0});var kN=require("crypto");c0.default={randomUUID:kN.randomUUID}});var DE=S(l0=>{"use strict";Object.defineProperty(l0,"__esModule",{value:!0});var FE=PE(),MN=Zd(),jN=Rs();function $N(n,e,t){if(FE.default.randomUUID&&!e&&!n)return FE.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,MN.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,jN.unsafeStringify)(r)}o($N,"v4");l0.default=$N});var NE=S(u0=>{"use strict";Object.defineProperty(u0,"__esModule",{value:!0});var BN=require("crypto");function VN(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,BN.createHash)("sha1").update(n).digest()}o(VN,"sha1");u0.default=VN});var kE=S(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.URL=oo.DNS=void 0;var UN=NE(),f0=bu(),LE=bu();Object.defineProperty(oo,"DNS",{enumerable:!0,get:o(function(){return LE.DNS},"get")});Object.defineProperty(oo,"URL",{enumerable:!0,get:o(function(){return LE.URL},"get")});function d0(n,e,t,r){return(0,f0.default)(80,UN.default,n,e,t,r)}o(d0,"v5");d0.DNS=f0.DNS;d0.URL=f0.URL;oo.default=d0});var ME=S(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var qN=Rs(),WN=r0(),GN=i0();function zN(n,e,t){n??={},t??=0;let r=(0,WN.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,GN.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,qN.unsafeStringify)(r)}o(zN,"v6");h0.default=zN});var jE=S(p0=>{"use strict";Object.defineProperty(p0,"__esModule",{value:!0});var HN=gu(),QN=Rs();function YN(n){let e=typeof n=="string"?(0,HN.default)(n):n,t=KN(e);return typeof n=="string"?(0,QN.unsafeStringify)(t):t}o(YN,"v6ToV1");p0.default=YN;function KN(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(KN,"_v6ToV1")});var UE=S(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.updateV7State=void 0;var $E=Zd(),XN=Rs(),m0={};function JN(n,e,t){let r;if(n)r=BE(n.random??n.rng?.()??(0,$E.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,$E.default)();VE(m0,i,s),r=BE(s,m0.msecs,m0.seq,e,t)}return e??(0,XN.unsafeStringify)(r)}o(JN,"v7");function VE(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(VE,"updateV7State");vu.updateV7State=VE;function BE(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(BE,"v7Bytes");vu.default=JN});var qE=S(g0=>{"use strict";Object.defineProperty(g0,"__esModule",{value:!0});var ZN=mu();function eL(n){if(!(0,ZN.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(eL,"version");g0.default=eL});var _n=S(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.version=ot.validate=ot.v7=ot.v6ToV1=ot.v6=ot.v5=ot.v4=ot.v3=ot.v1ToV6=ot.v1=ot.stringify=ot.parse=ot.NIL=ot.MAX=void 0;var tL=SE();Object.defineProperty(ot,"MAX",{enumerable:!0,get:o(function(){return tL.default},"get")});var rL=bE();Object.defineProperty(ot,"NIL",{enumerable:!0,get:o(function(){return rL.default},"get")});var nL=gu();Object.defineProperty(ot,"parse",{enumerable:!0,get:o(function(){return nL.default},"get")});var iL=Rs();Object.defineProperty(ot,"stringify",{enumerable:!0,get:o(function(){return iL.default},"get")});var sL=r0();Object.defineProperty(ot,"v1",{enumerable:!0,get:o(function(){return sL.default},"get")});var aL=i0();Object.defineProperty(ot,"v1ToV6",{enumerable:!0,get:o(function(){return aL.default},"get")});var oL=OE();Object.defineProperty(ot,"v3",{enumerable:!0,get:o(function(){return oL.default},"get")});var cL=DE();Object.defineProperty(ot,"v4",{enumerable:!0,get:o(function(){return cL.default},"get")});var lL=kE();Object.defineProperty(ot,"v5",{enumerable:!0,get:o(function(){return lL.default},"get")});var uL=ME();Object.defineProperty(ot,"v6",{enumerable:!0,get:o(function(){return uL.default},"get")});var fL=jE();Object.defineProperty(ot,"v6ToV1",{enumerable:!0,get:o(function(){return fL.default},"get")});var dL=UE();Object.defineProperty(ot,"v7",{enumerable:!0,get:o(function(){return dL.default},"get")});var hL=mu();Object.defineProperty(ot,"validate",{enumerable:!0,get:o(function(){return hL.default},"get")});var pL=qE();Object.defineProperty(ot,"version",{enumerable:!0,get:o(function(){return pL.default},"get")})});var S0=S(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.Exo003UUIDGenerator=void 0;var y0=_n(),WE=Kd(),_0=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,y0.v5)(e,WE.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,y0.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,y0.v5)(e,WE.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)}};eh.Exo003UUIDGenerator=_0});var zE=S(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.Exo003Parser=void 0;var mt=Kd(),wu=S0(),ua=xe(),th=He(),GE=qt(),mL=ri(),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 ua.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 ua.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 ua.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 ua.IRI(i.value);else if(i.type==="blank")s=new GE.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 ua.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new ua.IRI(l.value);else if(l.type==="blank")u=new GE.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new th.Literal(f,new ua.IRI(l.datatype));else{let d=l.language||mt.DEFAULT_LANGUAGE_TAG;u=(0,th.createDirectionalLiteral)(f,d,l.direction)}}return new mL.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new th.Literal(t,new ua.IRI(r.datatype));let i=r?.language||mt.DEFAULT_LANGUAGE_TAG;return(0,th.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 wu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Anchor:return wu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.BlankNode:return wu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Statement:{let r=e;return wu.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case mt.Exo003MetadataType.Body:{let r=e;return wu.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};rh.Exo003Parser=b0});var v0=S(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.Exo003Parser=jr.Exo003UUIDGenerator=jr.UUID_URL_NAMESPACE=jr.DEFAULT_LANGUAGE_TAG=jr.REQUIRED_PROPERTIES=jr.ALLOWED_PROPERTIES=jr.Exo003MetadataType=void 0;var Eu=Kd();Object.defineProperty(jr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Eu.Exo003MetadataType},"get")});Object.defineProperty(jr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Eu.ALLOWED_PROPERTIES},"get")});Object.defineProperty(jr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Eu.REQUIRED_PROPERTIES},"get")});Object.defineProperty(jr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Eu.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(jr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Eu.UUID_URL_NAMESPACE},"get")});var gL=S0();Object.defineProperty(jr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return gL.Exo003UUIDGenerator},"get")});var yL=zE();Object.defineProperty(jr,"Exo003Parser",{enumerable:!0,get:o(function(){return yL.Exo003Parser},"get")})});var Ps=S(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.WikiLinkHelpers=void 0;var Tu=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)}};nh.WikiLinkHelpers=Tu;Tu.WIKI_LINK_PATTERN=/\[\[|\]\]/g;Tu.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var On=S(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.CommandBindingProperty=et.GroundingProperty=et.PreconditionProperty=et.CommandProperty=et.GroundingType=et.getEffortStatusLabel=et.isTrashedStatus=et.isDoneStatus=et.normalizeEffortStatus=et.EFFORT_STATUS_OPTIONS=et.STATUS_NAME_TO_WIKILINK=et.STATUS_NAME_TO_ENUM=et.EFFORT_STATUS_CONFIG=et.EffortStatus=et.AssetClass=void 0;var _L=du();Object.defineProperty(et,"AssetClass",{enumerable:!0,get:o(function(){return _L.AssetClass},"get")});var SL=fc();Object.defineProperty(et,"EffortStatus",{enumerable:!0,get:o(function(){return SL.EffortStatus},"get")});var fa=My();Object.defineProperty(et,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return fa.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(et,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return fa.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(et,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return fa.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(et,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return fa.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(et,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return fa.normalizeEffortStatus},"get")});Object.defineProperty(et,"isDoneStatus",{enumerable:!0,get:o(function(){return fa.isDoneStatus},"get")});Object.defineProperty(et,"isTrashedStatus",{enumerable:!0,get:o(function(){return fa.isTrashedStatus},"get")});Object.defineProperty(et,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return fa.getEffortStatusLabel},"get")});var bL=dc();Object.defineProperty(et,"GroundingType",{enumerable:!0,get:o(function(){return bL.GroundingType},"get")});var ih=jy();Object.defineProperty(et,"CommandProperty",{enumerable:!0,get:o(function(){return ih.CommandProperty},"get")});Object.defineProperty(et,"PreconditionProperty",{enumerable:!0,get:o(function(){return ih.PreconditionProperty},"get")});Object.defineProperty(et,"GroundingProperty",{enumerable:!0,get:o(function(){return ih.GroundingProperty},"get")});Object.defineProperty(et,"CommandBindingProperty",{enumerable:!0,get:o(function(){return ih.CommandBindingProperty},"get")})});var uo=S($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.hasClass=lo;$r.isAreaOrProject=vL;$r.isEffort=wL;$r.hasStatus=EL;$r.isAssetArchived=TL;$r.hasEmptyProperties=AL;$r.needsFolderRepair=xL;$r.getTodayDateString=w0;$r.isPlannedForToday=CL;$r.hasPlannedStartTimestamp=IL;$r.extractDailyNoteDate=RL;$r.isCurrentDateGteDay=OL;$r.inheritsFromPrototype=YE;$r.isPrototypeClass=FL;var QE=Ps(),co=On();function lo(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>QE.WikiLinkHelpers.normalize(r)===e):!1}o(lo,"hasClass");function vL(n){return lo(n,co.AssetClass.AREA)||lo(n,co.AssetClass.PROJECT)}o(vL,"isAreaOrProject");function wL(n){return lo(n,co.AssetClass.TASK)||lo(n,co.AssetClass.PROJECT)||lo(n,co.AssetClass.MEETING)}o(wL,"isEffort");function EL(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?QE.WikiLinkHelpers.normalize(t)===e:!1}o(EL,"hasStatus");function TL(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(TL,"isAssetArchived");function AL(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(AL,"hasEmptyProperties");function xL(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(xL,"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 CL(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(CL,"isPlannedForToday");function IL(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(IL,"hasPlannedStartTimestamp");function RL(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(RL,"extractDailyNoteDate");function OL(n){return w0()>=n}o(OL,"isCurrentDateGteDay");function HE(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(HE,"normalizeWithQuotes");var PL=10;function YE(n,e=PL){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=HE(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===co.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=HE(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(YE,"inheritsFromPrototype");function FL(n,e){return lo(n,co.AssetClass.CLASS)?YE(e):!1}o(FL,"isPrototypeClass")});var KE=S(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.canCreateTask=DL;mc.canCreateRelatedTask=NL;mc.canConvertTaskToProject=LL;mc.canSetCriticalityZone=kL;var pc=uo(),E0=On();function DL(n){return(0,pc.isAreaOrProject)(n.instanceClass)}o(DL,"canCreateTask");function NL(n){return!(!(0,pc.hasClass)(n.instanceClass,E0.AssetClass.TASK)||(0,pc.isAssetArchived)(n.isArchived))}o(NL,"canCreateRelatedTask");function LL(n){return(0,pc.hasClass)(n.instanceClass,E0.AssetClass.TASK)}o(LL,"canConvertTaskToProject");function kL(n){return!(!(0,pc.hasClass)(n.instanceClass,E0.AssetClass.TASK)||(0,pc.isAssetArchived)(n.isArchived))}o(kL,"canSetCriticalityZone")});var XE=S(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.canCreateProject=ML;gc.canMoveToAnalysis=jL;gc.canMoveToToDo=$L;gc.canConvertProjectToTask=BL;var da=uo(),ha=On();function ML(n){return(0,da.hasClass)(n.instanceClass,ha.AssetClass.AREA)||(0,da.hasClass)(n.instanceClass,ha.AssetClass.INITIATIVE)||(0,da.hasClass)(n.instanceClass,ha.AssetClass.PROJECT)}o(ML,"canCreateProject");function jL(n){return(0,da.hasClass)(n.instanceClass,ha.AssetClass.PROJECT)?(0,da.hasStatus)(n.currentStatus,ha.EffortStatus.BACKLOG):!1}o(jL,"canMoveToAnalysis");function $L(n){return(0,da.hasClass)(n.instanceClass,ha.AssetClass.PROJECT)?(0,da.hasStatus)(n.currentStatus,ha.EffortStatus.ANALYSIS):!1}o($L,"canMoveToToDo");function BL(n){return(0,da.hasClass)(n.instanceClass,ha.AssetClass.PROJECT)}o(BL,"canConvertProjectToTask")});var eT=S(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.canCreateChildArea=VL;sh.canSetActiveFocus=UL;var JE=uo(),ZE=On();function VL(n){return(0,JE.hasClass)(n.instanceClass,ZE.AssetClass.AREA)}o(VL,"canCreateChildArea");function UL(n){return(0,JE.hasClass)(n.instanceClass,ZE.AssetClass.AREA)}o(UL,"canSetActiveFocus")});var rT=S(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.canPlanOnToday=qL;rn.canPlanForEvening=WL;rn.canShiftDayBackward=GL;rn.canShiftDayForward=zL;rn.canSetDraftStatus=HL;rn.canMoveToBacklog=QL;rn.canStartEffort=YL;rn.canMarkDone=KL;rn.canTrashEffort=XL;rn.canVoteOnEffort=JL;rn.canRollbackStatus=ZL;rn.canArchiveTask=ek;rn.canMarkReviewed=tk;var tT=Ps(),dt=uo(),tn=On();function qL(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isPlannedForToday)(n.metadata))}o(qL,"canPlanOnToday");function WL(n){return!(0,dt.hasClass)(n.instanceClass,tn.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,tn.AssetClass.MEETING)?!1:(0,dt.hasStatus)(n.currentStatus,tn.EffortStatus.BACKLOG)}o(WL,"canPlanForEvening");function GL(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(GL,"canShiftDayBackward");function zL(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(zL,"canShiftDayForward");function HL(n){return(0,dt.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(HL,"canSetDraftStatus");function QL(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,tn.EffortStatus.DRAFT):!1}o(QL,"canMoveToBacklog");function YL(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasClass)(n.instanceClass,tn.AssetClass.TASK)||(0,dt.hasClass)(n.instanceClass,tn.AssetClass.MEETING)?(0,dt.hasStatus)(n.currentStatus,tn.EffortStatus.BACKLOG):(0,dt.hasClass)(n.instanceClass,tn.AssetClass.PROJECT)?(0,dt.hasStatus)(n.currentStatus,tn.EffortStatus.TODO):!1:!1}o(YL,"canStartEffort");function KL(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,tn.EffortStatus.DOING):!1}o(KL,"canMarkDone");function XL(n){return(0,dt.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=tT.WikiLinkHelpers.normalize(r);return i===tn.EffortStatus.TRASHED||i===tn.EffortStatus.DONE}):!0:!1}o(XL,"canTrashEffort");function JL(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isAssetArchived)(n.isArchived))}o(JL,"canVoteOnEffort");function ZL(n){if(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||tT.WikiLinkHelpers.normalize(e)===tn.EffortStatus.TRASHED)}o(ZL,"canRollbackStatus");function ek(n){return!(0,dt.isAssetArchived)(n.isArchived)}o(ek,"canArchiveTask");function tk(n){return!(!(0,dt.hasClass)(n.instanceClass,tn.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,tn.AssetClass.PROJECT)||(0,dt.isAssetArchived)(n.isArchived))}o(tk,"canMarkReviewed")});var nT=S(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.canCreateEvent=ik;Un.canCreateInstance=sk;Un.canCleanProperties=ak;Un.canRepairFolder=ok;Un.canRenameToUid=ck;Un.canCopyLabelToAliases=lk;Un.canCreateNarrowerConcept=uk;Un.canCreateSubclass=fk;Un.canCreateTaskForDailyNote=dk;Un.canCopyFleetingNoteLabel=hk;var Br=uo(),Fs=On(),rk="75302770-279e-4a59-ba85-09df29725713",nk="fca0a931-a01f-48e4-b72a-4af206c94bc7";function ik(n){return(0,Br.isAreaOrProject)(n.instanceClass)}o(ik,"canCreateEvent");function sk(n){return(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.TASK_PROTOTYPE)||(0,Br.hasClass)(n.instanceClass,rk)||(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.MEETING_PROTOTYPE)||(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.EVENT_PROTOTYPE)||(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.PROJECT_PROTOTYPE)||(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,Br.isPrototypeClass)(n.instanceClass,n.metadata)}o(sk,"canCreateInstance");function ak(n){return(0,Br.hasEmptyProperties)(n.metadata)}o(ak,"canCleanProperties");function ok(n){return(0,Br.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(ok,"canRepairFolder");function ck(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(ck,"canRenameToUid");function lk(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(lk,"canCopyLabelToAliases");function uk(n){return(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.CONCEPT)}o(uk,"canCreateNarrowerConcept");function fk(n){return(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.CLASS)}o(fk,"canCreateSubclass");function dk(n){return!(!(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.DAILY_NOTE)||n.isArchived||!(0,Br.extractDailyNoteDate)(n.metadata))}o(dk,"canCreateTaskForDailyNote");function hk(n){return(0,Br.hasClass)(n.instanceClass,Fs.AssetClass.FLEETING_NOTE)||(0,Br.hasClass)(n.instanceClass,nk)}o(hk,"canCopyFleetingNoteLabel")});var sT=S(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.canCopyFleetingNoteLabel=L.canCreateTaskForDailyNote=L.canCreateSubclass=L.canCreateNarrowerConcept=L.canCopyLabelToAliases=L.canRenameToUid=L.canRepairFolder=L.canCleanProperties=L.canCreateInstance=L.canCreateEvent=L.canMarkReviewed=L.canArchiveTask=L.canRollbackStatus=L.canVoteOnEffort=L.canTrashEffort=L.canMarkDone=L.canStartEffort=L.canMoveToBacklog=L.canSetDraftStatus=L.canShiftDayForward=L.canShiftDayBackward=L.canPlanForEvening=L.canPlanOnToday=L.canSetActiveFocus=L.canCreateChildArea=L.canConvertProjectToTask=L.canMoveToToDo=L.canMoveToAnalysis=L.canCreateProject=L.canSetCriticalityZone=L.canConvertTaskToProject=L.canCreateRelatedTask=L.canCreateTask=L.isPrototypeClass=L.inheritsFromPrototype=L.isCurrentDateGteDay=L.extractDailyNoteDate=L.hasPlannedStartTimestamp=L.isPlannedForToday=L.getTodayDateString=L.needsFolderRepair=L.hasEmptyProperties=L.isAssetArchived=L.hasStatus=L.isEffort=L.isAreaOrProject=L.hasClass=void 0;var Sn=uo();Object.defineProperty(L,"hasClass",{enumerable:!0,get:o(function(){return Sn.hasClass},"get")});Object.defineProperty(L,"isAreaOrProject",{enumerable:!0,get:o(function(){return Sn.isAreaOrProject},"get")});Object.defineProperty(L,"isEffort",{enumerable:!0,get:o(function(){return Sn.isEffort},"get")});Object.defineProperty(L,"hasStatus",{enumerable:!0,get:o(function(){return Sn.hasStatus},"get")});Object.defineProperty(L,"isAssetArchived",{enumerable:!0,get:o(function(){return Sn.isAssetArchived},"get")});Object.defineProperty(L,"hasEmptyProperties",{enumerable:!0,get:o(function(){return Sn.hasEmptyProperties},"get")});Object.defineProperty(L,"needsFolderRepair",{enumerable:!0,get:o(function(){return Sn.needsFolderRepair},"get")});Object.defineProperty(L,"getTodayDateString",{enumerable:!0,get:o(function(){return Sn.getTodayDateString},"get")});Object.defineProperty(L,"isPlannedForToday",{enumerable:!0,get:o(function(){return Sn.isPlannedForToday},"get")});Object.defineProperty(L,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return Sn.hasPlannedStartTimestamp},"get")});Object.defineProperty(L,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return Sn.extractDailyNoteDate},"get")});Object.defineProperty(L,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return Sn.isCurrentDateGteDay},"get")});Object.defineProperty(L,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return Sn.inheritsFromPrototype},"get")});Object.defineProperty(L,"isPrototypeClass",{enumerable:!0,get:o(function(){return Sn.isPrototypeClass},"get")});var ah=KE();Object.defineProperty(L,"canCreateTask",{enumerable:!0,get:o(function(){return ah.canCreateTask},"get")});Object.defineProperty(L,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return ah.canCreateRelatedTask},"get")});Object.defineProperty(L,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return ah.canConvertTaskToProject},"get")});Object.defineProperty(L,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return ah.canSetCriticalityZone},"get")});var oh=XE();Object.defineProperty(L,"canCreateProject",{enumerable:!0,get:o(function(){return oh.canCreateProject},"get")});Object.defineProperty(L,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return oh.canMoveToAnalysis},"get")});Object.defineProperty(L,"canMoveToToDo",{enumerable:!0,get:o(function(){return oh.canMoveToToDo},"get")});Object.defineProperty(L,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return oh.canConvertProjectToTask},"get")});var iT=eT();Object.defineProperty(L,"canCreateChildArea",{enumerable:!0,get:o(function(){return iT.canCreateChildArea},"get")});Object.defineProperty(L,"canSetActiveFocus",{enumerable:!0,get:o(function(){return iT.canSetActiveFocus},"get")});var Pn=rT();Object.defineProperty(L,"canPlanOnToday",{enumerable:!0,get:o(function(){return Pn.canPlanOnToday},"get")});Object.defineProperty(L,"canPlanForEvening",{enumerable:!0,get:o(function(){return Pn.canPlanForEvening},"get")});Object.defineProperty(L,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Pn.canShiftDayBackward},"get")});Object.defineProperty(L,"canShiftDayForward",{enumerable:!0,get:o(function(){return Pn.canShiftDayForward},"get")});Object.defineProperty(L,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Pn.canSetDraftStatus},"get")});Object.defineProperty(L,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Pn.canMoveToBacklog},"get")});Object.defineProperty(L,"canStartEffort",{enumerable:!0,get:o(function(){return Pn.canStartEffort},"get")});Object.defineProperty(L,"canMarkDone",{enumerable:!0,get:o(function(){return Pn.canMarkDone},"get")});Object.defineProperty(L,"canTrashEffort",{enumerable:!0,get:o(function(){return Pn.canTrashEffort},"get")});Object.defineProperty(L,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Pn.canVoteOnEffort},"get")});Object.defineProperty(L,"canRollbackStatus",{enumerable:!0,get:o(function(){return Pn.canRollbackStatus},"get")});Object.defineProperty(L,"canArchiveTask",{enumerable:!0,get:o(function(){return Pn.canArchiveTask},"get")});Object.defineProperty(L,"canMarkReviewed",{enumerable:!0,get:o(function(){return Pn.canMarkReviewed},"get")});var Xi=nT();Object.defineProperty(L,"canCreateEvent",{enumerable:!0,get:o(function(){return Xi.canCreateEvent},"get")});Object.defineProperty(L,"canCreateInstance",{enumerable:!0,get:o(function(){return Xi.canCreateInstance},"get")});Object.defineProperty(L,"canCleanProperties",{enumerable:!0,get:o(function(){return Xi.canCleanProperties},"get")});Object.defineProperty(L,"canRepairFolder",{enumerable:!0,get:o(function(){return Xi.canRepairFolder},"get")});Object.defineProperty(L,"canRenameToUid",{enumerable:!0,get:o(function(){return Xi.canRenameToUid},"get")});Object.defineProperty(L,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return Xi.canCopyLabelToAliases},"get")});Object.defineProperty(L,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return Xi.canCreateNarrowerConcept},"get")});Object.defineProperty(L,"canCreateSubclass",{enumerable:!0,get:o(function(){return Xi.canCreateSubclass},"get")});Object.defineProperty(L,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return Xi.canCreateTaskForDailyNote},"get")});Object.defineProperty(L,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return Xi.canCopyFleetingNoteLabel},"get")})});var aT=S(fo=>{"use strict";var pk=fo&&fo.__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]})),mk=fo&&fo.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&pk(e,n,t)};Object.defineProperty(fo,"__esModule",{value:!0});mk(sT(),fo)});var ch=S(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.PropertyFieldType=void 0;Au.rangeToFieldType=_k;var Rr;(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"})(Rr||(Au.PropertyFieldType=Rr={}));var oT="http://www.w3.org/2001/XMLSchema#",gk="https://exocortex.my/ontology/exo#",yk="https://exocortex.my/ontology/ems#";function _k(n){if(!n)return Rr.Unknown;let e=n.trim();if(!e)return Rr.Unknown;if(e.startsWith(oT)){let t=e.substring(oT.length);return T0(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return T0(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return T0(r)}return e.startsWith(yk)||e.startsWith("ems:")?Sk(e):e.startsWith(gk)||e.startsWith("exo:")||bk(e)?Rr.Reference:Rr.Text}o(_k,"rangeToFieldType");function T0(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Rr.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 Rr.Number;case"date":return Rr.Date;case"datetime":case"datetimestamp":return Rr.DateTime;case"boolean":return Rr.Boolean;case"time":return Rr.Timestamp;default:return Rr.Text}}o(T0,"xsdTypeToFieldType");function Sk(n){let e=n.toLowerCase();return e.includes("effortstatus")?Rr.StatusSelect:e.includes("tasksize")?Rr.SizeSelect:Rr.Reference}o(Sk,"emsTypeToFieldType");function bk(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(bk,"isClassReference")});var A0=S(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.propertyNameToUri=vk;xu.uriToPropertyName=cT;xu.extractPropertyLabel=wk;function vk(n){return n.replace(/^([a-z]+)__/,"$1:")}o(vk,"propertyNameToUri");function cT(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(cT,"uriToPropertyName");function wk(n){let r=(n.includes(":")?cT(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(wk,"extractPropertyLabel")});var lh={};Sy(lh,{__assign:()=>C0,__asyncDelegator:()=>Lk,__asyncGenerator:()=>Nk,__asyncValues:()=>kk,__await:()=>Cu,__awaiter:()=>Ik,__classPrivateFieldGet:()=>Bk,__classPrivateFieldSet:()=>Vk,__createBinding:()=>Ok,__decorate:()=>Ak,__exportStar:()=>Pk,__extends:()=>Ek,__generator:()=>Rk,__importDefault:()=>$k,__importStar:()=>jk,__makeTemplateObject:()=>Mk,__metadata:()=>Ck,__param:()=>xk,__read:()=>lT,__rest:()=>Tk,__spread:()=>Fk,__spreadArrays:()=>Dk,__values:()=>I0});function Ek(n,e){x0(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Tk(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 Ak(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 xk(n,e){return function(t,r){e(t,r,n)}}function Ck(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function Ik(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 Rk(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 Ok(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function Pk(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 lT(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 Fk(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(lT(arguments[e]));return n}function Dk(){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 Cu(n){return this instanceof Cu?(this.v=n,this):new Cu(n)}function Nk(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(_,b){s.push([h,p,_,b])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(_){d(s[0][3],_)}}function l(h){h.value instanceof Cu?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 Lk(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:Cu(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function kk(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 Mk(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function jk(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 $k(n){return n&&n.__esModule?n:{default:n}}function Bk(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function Vk(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 x0,C0,uh=TD(()=>{x0=o(function(n,e){return x0=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])},x0(n,e)},"extendStatics");o(Ek,"__extends");C0=o(function(){return C0=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"),C0.apply(this,arguments)},"__assign");o(Tk,"__rest");o(Ak,"__decorate");o(xk,"__param");o(Ck,"__metadata");o(Ik,"__awaiter");o(Rk,"__generator");o(Ok,"__createBinding");o(Pk,"__exportStar");o(I0,"__values");o(lT,"__read");o(Fk,"__spread");o(Dk,"__spreadArrays");o(Cu,"__await");o(Nk,"__asyncGenerator");o(Lk,"__asyncDelegator");o(kk,"__asyncValues");o(Mk,"__makeTemplateObject");o(jk,"__importStar");o($k,"__importDefault");o(Bk,"__classPrivateFieldGet");o(Vk,"__classPrivateFieldSet")});var P0=S(O0=>{"use strict";Object.defineProperty(O0,"__esModule",{value:!0});var R0;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(R0||(R0={}));O0.default=R0});var uT=S(F0=>{"use strict";Object.defineProperty(F0,"__esModule",{value:!0});var Uk=P0();Object.defineProperty(F0,"Lifecycle",{enumerable:!0,get:o(function(){return Uk.default},"get")})});var ho=S(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.defineInjectionTokenMetadata=ni.getParamInfo=ni.INJECTION_TOKEN_METADATA_KEY=void 0;ni.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function qk(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(ni.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(qk,"getParamInfo");ni.getParamInfo=qk;function Wk(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(ni.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(ni.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(Wk,"defineInjectionTokenMetadata");ni.defineInjectionTokenMetadata=Wk});var D0=S(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});fh.isClassProvider=void 0;function Gk(n){return!!n.useClass}o(Gk,"isClassProvider");fh.isClassProvider=Gk});var N0=S(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.isFactoryProvider=void 0;function zk(n){return!!n.useFactory}o(zk,"isFactoryProvider");dh.isFactoryProvider=zk});var ph=S(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.delay=yc.DelayedConstructor=void 0;var hh=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}};yc.DelayedConstructor=hh;function Hk(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new hh(n)}o(Hk,"delay");yc.delay=Hk});var mh=S(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.isConstructorToken=Ji.isTransformDescriptor=Ji.isTokenDescriptor=Ji.isNormalToken=void 0;var Qk=ph();function Yk(n){return typeof n=="string"||typeof n=="symbol"}o(Yk,"isNormalToken");Ji.isNormalToken=Yk;function Kk(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(Kk,"isTokenDescriptor");Ji.isTokenDescriptor=Kk;function Xk(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(Xk,"isTransformDescriptor");Ji.isTransformDescriptor=Xk;function Jk(n){return typeof n=="function"||n instanceof Qk.DelayedConstructor}o(Jk,"isConstructorToken");Ji.isConstructorToken=Jk});var L0=S(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.isTokenProvider=void 0;function Zk(n){return!!n.useToken}o(Zk,"isTokenProvider");gh.isTokenProvider=Zk});var k0=S(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.isValueProvider=void 0;function e4(n){return n.useValue!=null}o(e4,"isValueProvider");yh.isValueProvider=e4});var M0=S(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});var t4=D0();Object.defineProperty(po,"isClassProvider",{enumerable:!0,get:o(function(){return t4.isClassProvider},"get")});var r4=N0();Object.defineProperty(po,"isFactoryProvider",{enumerable:!0,get:o(function(){return r4.isFactoryProvider},"get")});var n4=mh();Object.defineProperty(po,"isNormalToken",{enumerable:!0,get:o(function(){return n4.isNormalToken},"get")});var i4=L0();Object.defineProperty(po,"isTokenProvider",{enumerable:!0,get:o(function(){return i4.isTokenProvider},"get")});var s4=k0();Object.defineProperty(po,"isValueProvider",{enumerable:!0,get:o(function(){return s4.isValueProvider},"get")})});var fT=S(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.isProvider=void 0;var a4=D0(),o4=k0(),c4=L0(),l4=N0();function u4(n){return a4.isClassProvider(n)||o4.isValueProvider(n)||c4.isTokenProvider(n)||l4.isFactoryProvider(n)}o(u4,"isProvider");_h.isProvider=u4});var B0=S($0=>{"use strict";Object.defineProperty($0,"__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,[])}};$0.default=j0});var dT=S(U0=>{"use strict";Object.defineProperty(U0,"__esModule",{value:!0});var f4=B0(),V0=class extends f4.default{static{o(this,"Registry")}};U0.default=V0});var hT=S(W0=>{"use strict";Object.defineProperty(W0,"__esModule",{value:!0});var q0=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};W0.default=q0});var G0=S(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.formatErrorCtor=void 0;function d4(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(d4,"formatDependency");function h4(n,e,t=" "){return[n,...e.message.split(`
|
|
32
32
|
`).map(r=>t+r)].join(`
|
|
33
|
-
`)}o(h4,"composeErrorMessage");function p4(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=d4(r,e);return h4(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(p4,"formatErrorCtor");Sh.formatErrorCtor=p4});var pT=S(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.isDisposable=void 0;function m4(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(m4,"isDisposable");bh.isDisposable=m4});var gT=S(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.PostResolutionInterceptors=mo.PreResolutionInterceptors=void 0;var mT=B0(),vh=class extends mT.default{static{o(this,"PreResolutionInterceptors")}};mo.PreResolutionInterceptors=vh;var wh=class extends mT.default{static{o(this,"PostResolutionInterceptors")}};mo.PostResolutionInterceptors=wh;var z0=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new vh,this.postResolution=new wh}};mo.default=z0});var pa=S(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.instance=Ds.typeInfo=void 0;var g4=(uh(),Pd(lh)),nn=M0(),y4=fT(),Eh=mh(),_4=dT(),bn=P0(),Th=hT(),S4=G0(),b4=ph(),v4=pT(),w4=gT();Ds.typeInfo=new Map;var H0=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new _4.default,this.interceptors=new w4.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:bn.default.Transient}){this.ensureNotDisposed();let i;if(y4.isProvider(t)?i=t:i={useClass:t},nn.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&&nn.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===bn.default.Singleton||r.lifecycle==bn.default.ContainerScoped||r.lifecycle==bn.default.ResolutionScoped)&&(nn.isValueProvider(i)||nn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${bn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),nn.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(),nn.isNormalToken(e)){if(nn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:bn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:bn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!nn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:bn.default.Singleton})}resolve(e,t=new Th.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&nn.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(Eh.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===bn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===bn.default.Singleton,i=e.options.lifecycle===bn.default.ContainerScoped,s=r||i,a;return nn.isValueProvider(e.provider)?a=e.provider.useValue:nn.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):nn.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):nn.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===bn.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new Th.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&nn.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=>!nn.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===bn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===bn.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 g4.__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 b4.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Ds.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 v4.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return Eh.isTokenDescriptor(r)?Eh.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Th.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 Th.default,r.isOptional):this.resolve(r.token,e,r.isOptional):Eh.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(S4.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Ds.instance=new H0;Ds.default=Ds.instance});var yT=S(Y0=>{"use strict";Object.defineProperty(Y0,"__esModule",{value:!0});var E4=ho(),Ns=pa(),Q0=mh(),T4=G0();function A4(){return function(n){let e=E4.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return Q0.isTokenDescriptor(r)?Q0.isTransformDescriptor(r)?r.multiple?Ns.instance.resolve(r.transform).transform(Ns.instance.resolveAll(r.token),...r.transformArgs):Ns.instance.resolve(r.transform).transform(Ns.instance.resolve(r.token),...r.transformArgs):r.multiple?Ns.instance.resolveAll(r.token):Ns.instance.resolve(r.token):Q0.isTransformDescriptor(r)?Ns.instance.resolve(r.transform).transform(Ns.instance.resolve(r.token),...r.transformArgs):Ns.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(T4.formatErrorCtor(n,a,s))}})))}}}}o(A4,"autoInjectable");Y0.default=A4});var _T=S(K0=>{"use strict";Object.defineProperty(K0,"__esModule",{value:!0});var x4=ho();function C4(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return x4.defineInjectionTokenMetadata(t)}o(C4,"inject");K0.default=C4});var Ah=S(X0=>{"use strict";Object.defineProperty(X0,"__esModule",{value:!0});var I4=ho(),R4=pa(),ST=pa();function O4(n){return function(e){R4.typeInfo.set(e,I4.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{ST.instance.register(t,e)}):ST.instance.register(n.token,e))}}o(O4,"injectable");X0.default=O4});var bT=S(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});var P4=(uh(),Pd(lh)),F4=pa();function D4(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=P4.__rest(t,["token","options"]);return F4.instance.register(r,s,i)}),e}}o(D4,"registry");J0.default=D4});var vT=S(Z0=>{"use strict";Object.defineProperty(Z0,"__esModule",{value:!0});var N4=Ah(),L4=pa();function k4(){return function(n){N4.default()(n),L4.instance.registerSingleton(n)}}o(k4,"singleton");Z0.default=k4});var wT=S(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var M4=ho();function j4(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return M4.defineInjectionTokenMetadata(t)}o(j4,"injectAll");e_.default=j4});var ET=S(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var $4=ho();function B4(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return $4.defineInjectionTokenMetadata(r)}o(B4,"injectAllWithTransform");t_.default=B4});var TT=S(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var V4=ho();function U4(n,e,...t){return V4.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(U4,"injectWithTransform");r_.default=U4});var AT=S(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});var q4=Ah(),W4=pa();function G4(n,e){return function(t){q4.default()(t),W4.instance.register(e||t,t,{lifecycle:n})}}o(G4,"scoped");n_.default=G4});var xT=S(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});var z4=yT();Object.defineProperty(ii,"autoInjectable",{enumerable:!0,get:o(function(){return z4.default},"get")});var H4=_T();Object.defineProperty(ii,"inject",{enumerable:!0,get:o(function(){return H4.default},"get")});var Q4=Ah();Object.defineProperty(ii,"injectable",{enumerable:!0,get:o(function(){return Q4.default},"get")});var Y4=bT();Object.defineProperty(ii,"registry",{enumerable:!0,get:o(function(){return Y4.default},"get")});var K4=vT();Object.defineProperty(ii,"singleton",{enumerable:!0,get:o(function(){return K4.default},"get")});var X4=wT();Object.defineProperty(ii,"injectAll",{enumerable:!0,get:o(function(){return X4.default},"get")});var J4=ET();Object.defineProperty(ii,"injectAllWithTransform",{enumerable:!0,get:o(function(){return J4.default},"get")});var Z4=TT();Object.defineProperty(ii,"injectWithTransform",{enumerable:!0,get:o(function(){return Z4.default},"get")});var eM=AT();Object.defineProperty(ii,"scoped",{enumerable:!0,get:o(function(){return eM.default},"get")})});var CT=S(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});function tM(n){let e;return t=>(e==null&&(e=n(t)),e)}o(tM,"instanceCachingFactory");i_.default=tM});var IT=S(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});function rM(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(rM,"instancePerContainerCachingFactory");s_.default=rM});var RT=S(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});function nM(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(nM,"predicateAwareClassFactory");a_.default=nM});var OT=S(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});var iM=CT();Object.defineProperty(Iu,"instanceCachingFactory",{enumerable:!0,get:o(function(){return iM.default},"get")});var sM=IT();Object.defineProperty(Iu,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return sM.default},"get")});var aM=RT();Object.defineProperty(Iu,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return aM.default},"get")})});var ce=S(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var o_=(uh(),Pd(lh));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 oM=uT();Object.defineProperty(ma,"Lifecycle",{enumerable:!0,get:o(function(){return oM.Lifecycle},"get")});o_.__exportStar(xT(),ma);o_.__exportStar(OT(),ma);o_.__exportStar(M0(),ma);var cM=ph();Object.defineProperty(ma,"delay",{enumerable:!0,get:o(function(){return cM.delay},"get")});var lM=pa();Object.defineProperty(ma,"container",{enumerable:!0,get:o(function(){return lM.instance},"get")})});var c_=S((oZ,PT)=>{var _c=class{static{o(this,"Wildcard")}constructor(){return uM||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(_c.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(_c.prototype,"termType",{enumerable:!0,value:"Wildcard"});var uM=new _c;PT.exports.Wildcard=_c});var DT=S((lZ,FT)=>{var fM=(function(){var n=o(function(I,C,O,N){for(O=O||{},N=I.length;N--;O[I[N]]=C);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],_=[123,126],b=[1,67],E=[39,45,87],v=[13,16,45,197,224,308],A=[1,87],R=[2,281],B=[1,86],W=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],ve=[6,28,29,53,63,70,73,81,83,85],z=[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],j=[13,16,308],ee=[112,132,327,334],Ye=[13,16,112,132,308],st=[1,111],Rt=[1,117],at=[112,132,327,328,334],ct=[13,16,112,132,308,328],Ke=[28,29,45,53,87],ne=[1,138],V=[1,151],lt=[1,128],ht=[1,127],H=[1,129],Re=[1,140],Ve=[1,141],te=[1,142],Ue=[1,143],qe=[1,144],je=[1,145],We=[1,147],Ae=[1,148],$e=[2,457],Oe=[1,158],Be=[1,159],Ge=[1,160],le=[1,152],he=[1,153],pe=[1,156],ue=[1,171],fe=[1,172],de=[1,173],oe=[1,174],me=[1,175],ge=[1,176],ye=[1,167],_e=[1,168],se=[1,169],Se=[1,170],Ze=[1,157],ze=[1,166],Me=[1,161],w=[1,162],T=[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],yt=[1,195],At=[6,31,73,81,83,85],Fe=[2,285],U=[1,199],q=[1,201],Q=[6,31,70,73,81,83,85],Y=[2,283],Ce=[1,207],tt=[1,218],rt=[1,223],Tr=[1,219],mn=[1,225],Rn=[1,226],Xr=[1,224],i2=[6,63,70,73,81,83,85],s2=[1,236],a2=[2,334],o2=[1,243],c2=[1,241],Ar=[6,193],ld=[2,349],l2=[2,339],oa=[28,128],u2=[47,48,193,272],ud=[47,48,193,242,272],ec=[47,48,193,242,246,272],tc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],fr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],f2=[1,271],d2=[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],h2=[1,281],p2=[1,280],Jr=[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],eu=[45,89],fd=[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],dd=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],hd=[31,89],pd=[48,87],Ya=[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],Wi=[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],m2=[1,313],rc=[6,85],Jg=[6,31,81,83,85],g2=[2,361],bs=[2,353],Ka=[1,343],tu=[31,112,335],vs=[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],Zg=[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],y2=[6,109,193],Xa=[31,112],Yt=[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],ey=[1,390],ty=[1,391],ca=[13,16,87,197,308,314],_2=[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],md=[1,417],gd=[1,418],S2=[13,16,48,197,229,308],la=[6,31,85],b2=[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],ry=[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],Ja=[29,31,85,112,159,160,161,163,164],yd=[1,443],_d=[1,444],v2=[1,449],Za=[31,112,193,232,318,335],Sd=[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],w2=[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],ny=[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],ru=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],nu=[31,45],E2=[1,507],T2=[1,508],A2=[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],bd=[29,31,85,112,159,160,161,163,164,335],eo=[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],x2=[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],C2=[2,352],iy=[13,16,197,308,314],I2=[1,565],nc=[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],R2=[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],ws=[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],O2=[13,16,87,308],Es=[2,364],ic=[29,31,85,112,159,160,161,163,164,193,232,318,335],vd=[31,112,193,232,272,318,335],Ts=[2,359],P2=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],wd=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],F2=[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],D2=[2,347],sy={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(C,O,N,re,Pe,g,en){var y=g.length-1;switch(Pe){case 1:if(g[y-1]=g[y-1]||{},Ne.base&&(g[y-1].base=Ne.base),Ne.base="",g[y-1].prefixes=Ne.prefixes,Ne.prefixes=null,Ne.pathOnly){if(g[y-1].type==="path"||"termType"in g[y-1])return g[y-1];throw new Error("Received full SPARQL query in path only mode")}else if(g[y-1].type==="path"||"termType"in g[y-1])throw new Error("Received only path in full SPARQL mode");if(g[y-1].type==="update"){let _t={};for(let Nt of g[y-1].updates)if(Nt.updateType==="insert"){let nt={};for(let ut of Nt.insert)if(ut.type==="bgp"||ut.type==="graph")for(let gn of ut.triples)gn.subject.termType==="BlankNode"&&(nt[gn.subject.value]=!0),gn.predicate.termType==="BlankNode"&&(nt[gn.predicate.value]=!0),gn.object.termType==="BlankNode"&&(nt[gn.object.value]=!0);for(let ut of Object.keys(nt)){if(_t[ut])throw new Error("Detected reuse blank node across different INSERT DATA clauses");_t[ut]=!0}}}return g[y-1];case 2:this.$={...g[y-1],...g[y],type:"query"};break;case 4:Ne.base=iu(g[y]);break;case 5:Ne.prefixes||(Ne.prefixes={}),g[y-1]=g[y-1].substr(0,g[y-1].length-1),g[y]=iu(g[y]),Ne.prefixes[g[y-1]]=g[y];break;case 6:this.$={...g[y-3],...no(g[y-2]),...g[y-1],...g[y]};break;case 7:if(!Ne.skipValidation&&(hy(g[y-3].variables.map(Nt=>dy(Nt.expression))).some(Nt=>Nt.aggregation==="count"&&!(Nt.expression instanceof Ed))||g[y].group)){for(let Nt of g[y-3].variables)if(Nt.termType==="Variable"){if(!g[y].group||!g[y].group.map(nt=>cc(nt)).includes(cc(Nt)))throw Error("Projection of ungrouped variable (?"+cc(Nt)+")")}else if(dy(Nt.expression).length===0){let nt=gD(Nt.expression);for(let ut of nt)if(!g[y].group||!g[y].group.map||!g[y].group.map(gn=>cc(gn)).includes(cc(ut)))throw Error("Use of ungrouped variable in projection of operation (?"+cc(ut)+")")}}let Qi=g[y-1].where.filter(_t=>_t.type==="query");if(Qi.length>0){let _t=g[y-3].variables.filter(nt=>nt.variable&&nt.variable.value).map(nt=>nt.variable.value),Nt=hy(Qi.map(nt=>nt.variables)).map(nt=>nt.value||nt.variable.value);for(let nt of _t)if(Nt.indexOf(nt)>=0)throw Error("Target id of 'AS' (?"+nt+") already used in subquery")}this.$=Vt(g[y-3],no(g[y-2]),g[y-1],g[y]);break;case 8:this.$=Vt({queryType:"CONSTRUCT",template:g[y-3]},no(g[y-2]),g[y-1],g[y]);break;case 9:this.$=Vt({queryType:"CONSTRUCT",template:g[y-2]=g[y-2]?g[y-2].triples:[]},no(g[y-5]),{where:[{type:"bgp",triples:ro([],g[y-2])}]},g[y]);break;case 10:this.$=Vt({queryType:"DESCRIBE",variables:g[y-3]==="*"?[new Ed]:g[y-3]},no(g[y-2]),g[y-1],g[y]);break;case 11:this.$=Vt({queryType:"ASK"},no(g[y-2]),g[y-1],g[y]);break;case 12:this.$=Vt(g[y-1],{variables:[new Ed]});break;case 13:let lu=g[y].map(_t=>_t.value||_t.variable.value),lc=yD(lu);if(lc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+lc[0]+")");this.$=Vt(g[y-1],{variables:g[y]});break;case 14:this.$=Vt({queryType:"SELECT"},g[y]&&(g[y-1]=Zr(g[y]),g[y]={},g[y][g[y-1]]=!0,g[y]));break;case 16:case 27:this.$=sc(g[y-3],{variable:g[y-1]});break;case 17:case 18:this.$=Vt(g[y-3],g[y-2],g[y-1],g[y],{type:"query"});break;case 19:case 58:this.$={iri:g[y],named:!!g[y-1]};break;case 20:this.$={where:g[y].patterns};break;case 21:this.$=Vt(g[y-1],g[y]);break;case 22:this.$=Vt(g[y-2],g[y-1],g[y]);break;case 23:this.$={group:g[y]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=sc(g[y]);break;case 26:this.$=sc(g[y-1]);break;case 29:this.$={having:g[y]};break;case 30:this.$={order:g[y]};break;case 32:this.$=sc(g[y],{descending:!0});break;case 35:this.$={limit:oc(g[y])};break;case 36:this.$={offset:oc(g[y])};break;case 37:this.$={limit:oc(g[y-2]),offset:oc(g[y])};break;case 38:this.$={limit:oc(g[y]),offset:oc(g[y-2])};break;case 39:case 43:this.$={type:"values",values:g[y]};break;case 40:case 84:this.$=g[y-1].map(_t=>({[g[y-3]]:_t}));break;case 41:case 85:this.$=g[y-1].map(()=>({}));break;case 42:case 86:var Hi=g[y-4].length;g[y-4]=g[y-4].map(ay),this.$=g[y-1].map(function(_t){if(_t.length!==Hi)throw Error("Inconsistent VALUES length");for(var Nt={},nt=0;nt<Hi;nt++)Nt["?"+g[y-4][nt].value]=_t[nt];return Nt});break;case 44:case 65:case 100:case 126:case 175:this.$=g[y-1];break;case 45:this.$={type:"update",updates:As(g[y-2],g[y-1])};break;case 46:this.$=Vt({type:"load",silent:!!g[y-2],source:g[y-1]},g[y]&&{destination:g[y]});break;case 47:this.$={type:Zr(g[y-2]),silent:!!g[y-1],graph:g[y]};break;case 48:this.$={type:Zr(g[y-4]),silent:!!g[y-3],source:g[y-2],destination:g[y]};break;case 49:this.$={type:"create",silent:!!g[y-2],graph:{type:"graph",name:g[y]}};break;case 50:this.$={updateType:"insert",insert:W2(g[y])};break;case 51:this.$={updateType:"delete",delete:gy(W2(g[y]))};break;case 52:this.$={updateType:"deletewhere",delete:gy(g[y])};break;case 53:this.$={updateType:"insertdelete",...g[y-4],...g[y-3],...no(g[y-2],"using"),where:g[y].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=g[y];break;case 55:this.$={delete:gy(g[y-1]),insert:g[y]||[]};break;case 56:this.$={delete:[],insert:g[y]};break;case 59:this.$={graph:g[y]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:g[y]};break;case 64:this.$={[Zr(g[y])]:!0};break;case 66:this.$=g[y-1]?Gi(g[y],[g[y-1]]):Gi(g[y]);break;case 67:var ou=Vt(g[y-3]||{triples:[]},{type:"graph",name:g[y-5]});this.$=g[y]?[ou,g[y]]:[ou];break;case 68:case 73:this.$={type:"bgp",triples:Gi(g[y-2],[g[y-1]])};break;case 69:this.$={type:"group",patterns:[g[y-1]]};break;case 70:for(let _t of g[y-1].filter(Nt=>Nt.type==="bind")){let Nt=g[y-1].indexOf(_t),nt=new Set;for(let ut of g[y-1].slice(0,Nt))(ut.type==="group"||ut.type==="bgp")&&U2(ut).forEach(gn=>nt.add(gn));if(nt.has(_t.variable.value))throw Error("Variable used to bind is already bound (?"+_t.variable.value+")")}this.$={type:"group",patterns:g[y-1]};break;case 71:this.$=g[y-1]?Gi([g[y-1]],g[y]):Gi(g[y]);break;case 72:this.$=g[y]?[g[y-2],g[y]]:g[y-2];break;case 75:this.$=Vt(g[y],{type:"optional"});break;case 76:this.$=Vt(g[y],{type:"minus"});break;case 77:this.$=Vt(g[y],{type:"graph",name:g[y-1]});break;case 78:this.$=Vt(g[y],{type:"service",name:g[y-1],silent:!!g[y-2]});break;case 79:this.$={type:"filter",expression:g[y]};break;case 80:this.$={type:"bind",variable:g[y-1],expression:g[y-3]};break;case 89:this.$=au(g[y]);break;case 90:this.$=void 0;break;case 91:this.$=g[y-1].length?{type:"union",patterns:Gi(g[y-1].map(cy),[cy(g[y])])}:g[y];break;case 95:this.$={...g[y],function:g[y-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:As(g[y-2],g[y-1]),distinct:!!g[y-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.$=As(g[y-2],g[y-1]);break;case 101:this.$=Gi(g[y-2],[g[y-1]]);break;case 102:case 112:this.$=my(g[y].map(_t=>Vt(xs(g[y-1]),_t)));break;case 103:this.$=my(ro(g[y].map(_t=>Vt(xs(g[y-1].entity),_t)),g[y-1].triples));break;case 105:this.$=Gi([g[y-1]],g[y]);break;case 106:this.$=Gi(g[y]);break;case 107:this.$=fy(g[y-1],g[y]);break;case 109:case 237:this.$=Ne.factory.namedNode(aD);break;case 110:case 118:this.$=As(g[y-1],g[y]);break;case 111:this.$=g[y]?{annotation:g[y],object:g[y-1]}:g[y-1];break;case 113:this.$=g[y]?my(ro(g[y].map(_t=>Vt(xs(g[y-1].entity),_t)),g[y-1].triples)):g[y-1].triples;break;case 114:this.$=fy(...g[y-1],g[y]);break;case 116:this.$=fy(...g[y]);break;case 117:case 159:case 163:this.$=[g[y-1],g[y]];break;case 119:this.$=g[y]?{object:g[y-1],annotation:g[y]}:g[y-1];break;case 120:this.$=g[y-1].length?ac("|",As(g[y-1],g[y])):g[y];break;case 121:this.$=g[y-1].length?ac("/",As(g[y-1],g[y])):g[y];break;case 122:this.$=g[y]?ac(g[y],[g[y-1]]):g[y-1];break;case 123:this.$=g[y-1]?ac(g[y-1],[g[y]]):g[y];break;case 125:case 131:this.$=ac(g[y-1],[g[y]]);break;case 129:this.$=ac("|",As(g[y-2],g[y-1]));break;case 132:case 134:this.$=pD(g[y-1]);break;case 133:case 135:this.$=mD(g[y-1]);break;case 140:this.$={entity:g[y],triples:[]};break;case 145:this.$=ay(g[y]);break;case 149:this.$=Ne.factory.namedNode(N2);break;case 151:case 153:case 158:case 162:this.$=oy(g[y-1],g[y]);break;case 152:this.$=["||",g[y]];break;case 154:this.$=["&&",g[y]];break;case 156:this.$=xr(g[y-1],[g[y-2],g[y]]);break;case 157:this.$=xr(g[y-2]?"notin":"in",[g[y-3],g[y]]);break;case 160:this.$=["+",oy(g[y-1],g[y])];break;case 161:var xd=zi(g[y-1].value.replace("-",""),g[y-1].datatype);this.$=["-",oy(xd,g[y])];break;case 164:this.$=xr("UPLUS",[g[y]]);break;case 165:this.$=xr(g[y-1],[g[y]]);break;case 166:this.$=xr("UMINUS",[g[y]]);break;case 177:this.$=xr(Zr(g[y-1]));break;case 178:this.$=xr(Zr(g[y-3]),[g[y-1]]);break;case 179:this.$=au(xr(Zr(g[y-3]),[g[y-1]]));break;case 180:this.$=xr(Zr(g[y-5]),[g[y-3],g[y-1]]);break;case 181:this.$=xr(Zr(g[y-7]),[g[y-5],g[y-3],g[y-1]]);break;case 182:this.$=au(xr(Zr(g[y-7]),[g[y-5],g[y-3],g[y-1]]));break;case 183:this.$=xr(Zr(g[y-1]),g[y]);break;case 184:this.$=xr("bound",[ay(g[y-1])]);break;case 185:this.$=xr(g[y-1],[]);break;case 186:this.$=xr(g[y-3],[g[y-1]]);break;case 187:this.$=xr(g[y-2]?"notexists":"exists",[cy(g[y])]);break;case 188:case 189:this.$=sc(g[y-1],{type:"aggregate",aggregation:Zr(g[y-4]),distinct:!!g[y-2]});break;case 190:this.$=sc(g[y-2],{type:"aggregate",aggregation:Zr(g[y-5]),distinct:!!g[y-3],separator:typeof g[y-1]=="string"?g[y-1]:" "});break;case 192:this.$=zi(g[y]);break;case 193:this.$=uD(g[y-1],Zr(g[y].substr(1)));break;case 194:this.$=zi(g[y-2],g[y]);break;case 195:case 204:this.$=zi(g[y],L2);break;case 196:case 205:this.$=zi(g[y],k2);break;case 197:case 206:this.$=zi(Zr(g[y]),M2);break;case 200:this.$=zi(g[y].toLowerCase(),lD);break;case 201:this.$=zi(g[y].substr(1),L2);break;case 202:this.$=zi(g[y].substr(1),k2);break;case 203:this.$=zi(g[y].substr(1).toLowerCase(),M2);break;case 207:case 208:this.$=V2(g[y],1);break;case 209:case 210:this.$=V2(g[y],3);break;case 211:this.$=Ne.factory.namedNode(iu(g[y]));break;case 213:var Cd=g[y].indexOf(":"),cu=g[y].substr(0,Cd),Id=Ne.prefixes[cu];if(!Id)throw new Error("Unknown prefix: "+cu);var Mt=iu(Id+g[y].substr(Cd+1));this.$=Ne.factory.namedNode(Mt);break;case 214:if(g[y]=g[y].substr(0,g[y].length-1),!(g[y]in Ne.prefixes))throw new Error("Unknown prefix: "+g[y]);var Mt=iu(Ne.prefixes[g[y]]);this.$=Ne.factory.namedNode(Mt);break;case 215:this.$=su(g[y].replace(/^(_:)/,""));break;case 216:this.$=su();break;case 217:case 218:case 232:this.$=au(ly(g[y-3],g[y-2],g[y-1]));break;case 230:case 231:this.$=au(g[y-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[y-1].push(g[y]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[g[y]];break;case 308:g[y-3].push(g[y-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[y-2].push(g[y-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(_,[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:b,87:h},n(E,[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(v,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:A,29:R,52:84,53:B,56:85},{19:88,28:A,29:R,52:89,53:B,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:B},n(W,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(ve,[2,263],{34:96}),n(ve,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(ve,[2,262]),n(z,[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:A,29:R,52:99,53:B,56:85},{6:[2,309],99:100,193:[1,101]},n(j,[2,311],{101:102,328:[1,103]}),n(ee,[2,317],{104:104,328:[1,105]}),n(Ye,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:st,114:110},{29:st,114:112},{29:st,114:113},{118:114,123:[1,115],125:116,126:Rt},n(at,[2,315]),n(at,[2,316]),n(ct,[2,319]),n(ct,[2,320]),n(ct,[2,321]),n(_,[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:b,87:h}),n(Ke,[2,269]),n(Ke,[2,15]),{13:f,16:d,44:136,45:ne,46:120,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(E,[2,14]),n(E,[2,274]),n(E,[2,271]),n(E,[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:yt,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(v,[2,419]),n(At,Fe,{20:196,59:197,69:198,70:U}),n(l,[2,250]),{29:q,57:200},n(j,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(Q,Y,{23:204,58:205,62:206,63:Ce}),n(l,[2,252]),{19:208,28:A,29:R,52:209,53:B,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,145:212,172:221,185:213,187:214,231:Tr,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(i2,[2,265],{56:85,35:227,52:228,19:229,28:A,29:R,53:B}),n(z,[2,260]),n(Q,Y,{58:205,62:206,23:230,63:Ce}),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(j,[2,312]),{105:233,112:s2,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(ee,[2,318]),n(j,a2,{108:240,133:242,112:o2,132:c2}),n(Ye,[2,323]),{112:[1,244]},{112:[2,325]},n(Ar,[2,50]),n(W,ld,{135:245,136:246,143:247,144:248,31:l2,112:l2}),n(Ar,[2,51]),n(Ar,[2,52]),n(oa,[2,328],{119:249}),{29:st,114:250},n(oa,[2,56]),{29:st,114:251},n(_,[2,59]),n(Ke,[2,270]),{47:[1,252]},n(u2,[2,150]),n(ud,[2,428],{240:253}),n(ec,[2,430],{244:254}),n(ec,[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(tc,[2,440],{252:264}),n(fr,[2,448],{260:265}),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(fr,[2,167]),n(fr,[2,168]),n(fr,[2,169]),n(fr,[2,170],{176:269,45:f2,89:d2}),n(fr,[2,171]),n(fr,[2,172]),n(fr,[2,173]),n(fr,[2,174]),{13:f,16:d,44:136,45:ne,46:272,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,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:h2,89:p2,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(Jr,[2,192],{292:[1,286],293:[1,287]}),n(Jr,[2,195]),n(Jr,[2,196]),n(Jr,[2,197]),n(Jr,[2,198]),n(Jr,[2,199]),n(Jr,[2,200]),{13:f,16:d,44:39,55:40,82:V,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(eu,[2,452]),n(eu,[2,453]),n(eu,[2,454]),n(eu,[2,455]),n(eu,[2,456]),{279:[2,458]},n(fd,[2,207]),n(fd,[2,208]),n(fd,[2,209]),n(fd,[2,210]),n(Jr,[2,201]),n(Jr,[2,202]),n(Jr,[2,203]),n(Jr,[2,204]),n(Jr,[2,205]),n(Jr,[2,206]),n(e,[2,5]),n(dd,[2,297],{88:295}),n(hd,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(pd,[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(Ya,[2,123]),n(Ya,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(Wi,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:yt,223:312,225:308,226:309,229:m2,307:43,308:p},n(c,i,{215:10,214:314}),n(Wi,[2,236]),n(Wi,[2,237]),n(rc,[2,6]),n(Jg,[2,287],{60:315,72:316,73:[1,317]}),n(At,[2,286]),{13:f,16:d,45:ne,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,307:43,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P},n([6,31,63,70,73,81,83,85],[2,20]),n(W,g2,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:bs,31:bs,85:bs,112:bs,159:bs,160:bs,161:bs,163:bs,164:bs,41:s}),{13:f,16:d,55:331,307:43,308:p},n(j,[2,280]),n(rc,[2,7]),n(At,Fe,{59:197,69:198,20:332,70:U}),n(Q,[2,284]),{64:[1,333]},n(Q,Y,{58:205,62:206,23:334,63:Ce}),n(l,[2,254]),n(W,ld,{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:Ka,307:43,308:p},n(tu,[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:Ka,308:p}),n(vs,[2,227]),n(vs,[2,228]),n(vs,[2,229]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,172:221,185:351,187:350,200:348,230:347,231:Tr,234:349,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:Ka,307:43,308:p},n(vs,[2,146]),n(vs,[2,147]),n(vs,[2,148]),n(vs,[2,149]),{13:f,16:d,44:354,55:355,82:V,87:h,172:357,237:356,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:358,312:Xr,313:353},n(Zg,[2,215]),n(Zg,[2,216]),n(Q,Y,{58:205,62:206,23:359,63:Ce}),n(ve,[2,264]),n(i2,[2,266]),n(rc,[2,11]),n(r,[2,308],{6:[2,310]}),n(Ar,[2,313],{102:360,120:361,121:[1,362]}),n(Ar,[2,47]),n(Ar,[2,63]),n(Ar,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(Ar,[2,336]),n(Ar,[2,337]),n(Ar,[2,338]),{109:[1,364]},n(y2,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(j,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(Xa,[2,341],{137:368}),n(Xa,[2,340]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,145:369,172:221,185:213,187:214,231:Tr,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},{28:[1,370],127:371,128:[1,372]},n(oa,[2,330],{124:373,125:374,126:Rt}),n(oa,[2,57]),{44:375,87:h},n(u2,[2,151],{241:376,242:[1,377]}),n(ud,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,247:380,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{250:[1,381]},n(Yt,[2,432]),n(Yt,[2,433]),n(Yt,[2,434]),n(Yt,[2,435]),n(Yt,[2,436]),n(Yt,[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:ue,298:fe,299:de,300:oe,301:me,302:ge}),n(tc,[2,162],{261:388,262:389,39:ey,338:ty}),n(fr,[2,164]),n(fr,[2,165]),n(fr,[2,166]),n(Qt,[2,95]),n(Qt,[2,96]),n(Yt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Qt,[2,177]),{13:f,16:d,44:136,45:ne,46:395,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:396,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:397,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:398,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:399,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Qt,[2,183]),n(Qt,[2,98]),n(Yt,[2,381],{180:400}),{87:[1,401]},n(Qt,[2,185]),{13:f,16:d,44:136,45:ne,46:402,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{29:q,57:403},n(Jr,[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:Ka,307:43,308:p},n(ca,[2,233]),n(ca,[2,234]),n(ca,[2,235]),n(_2,[2,459],{281:406,325:[1,407]}),n(Yt,[2,463],{284:408,325:[1,409]}),n(Yt,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:V,171:413,172:415,173:416,174:md,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:gd},{31:[1,419],89:[1,420]},{29:[1,421]},n(pd,[2,302]),n(dd,[2,367],{167:422}),n(hd,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(pd,[2,371]),n(Ya,[2,122]),n(Ya,[2,417]),n(Ya,[2,413]),n(Ya,[2,414]),n(Ya,[2,415]),n(Wi,[2,125]),n(Wi,[2,127]),n(Wi,[2,128]),n(S2,[2,420],{227:426}),n(Wi,[2,130]),{13:f,16:d,55:194,197:yt,223:427,307:43,308:p},{48:[1,428]},n(la,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(Jg,[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:ne,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,276:We,277:Ae,279:$e,280:Oe,283:Be,285:Ge,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P}),n(b2,[2,293]),n(ry,[2,92]),n(ry,[2,93]),n(ry,[2,94]),{45:f2,89:d2,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:A,29:R,56:85},{19:438,28:A,29:R,56:85},n(Ja,[2,355],{149:439}),n(Ja,[2,354]),{13:f,16:d,44:215,45:yd,55:220,82:V,87:h,89:rt,156:440,172:221,185:441,203:442,231:_d,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(ve,[2,19]),n(la,[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:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,307:43,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P},n(rc,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(W,[2,386],{31:[2,388]}),n(tu,[2,102]),n(Za,[2,391],{191:452}),n(W,[2,395],{196:453,198:454}),n(W,[2,108]),n(W,[2,109]),n(tu,[2,103]),n(tu,[2,104]),n(tu,[2,390]),{13:f,16:d,44:215,45:tt,48:[1,455],55:220,82:V,87:h,89:rt,172:221,185:351,187:350,200:456,231:Tr,234:349,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(Sd,[2,424]),n(w2,[2,136]),n(w2,[2,137]),n(ny,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:Ka,307:43,308:p},n(ca,[2,219]),n(ca,[2,220]),n(ca,[2,221]),n(ca,[2,222]),n(ca,[2,223]),n(rc,[2,10]),n(Ar,[2,46]),n(Ar,[2,314]),{112:s2,122:459},n(Ar,[2,62]),n(j,a2,{133:242,108:460,112:o2,132:c2}),n(y2,[2,61]),n(Ar,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Xa,[2,351],{146:463,335:[1,464]}),{29:q,57:465},n(oa,[2,329]),n(j,[2,332],{129:466,327:[1,467]}),n(oa,[2,55]),n(oa,[2,331]),{48:[1,468]},n(ud,[2,429]),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(ec,[2,431]),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,243:470,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(ec,[2,156]),{45:h2,89:p2,179:471},n(tc,[2,441]),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,251:472,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(fr,[2,444],{256:473}),n(fr,[2,446],{258:474}),n(Yt,[2,442]),n(Yt,[2,443]),n(fr,[2,449]),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,255:154,257:155,259:475,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,450]),n(Yt,[2,451]),n(Yt,[2,379],{178:476}),n(Yt,[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:ne,46:482,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{48:[1,483]},{48:[1,484]},n(Qt,[2,187]),n(Jr,[2,194]),{13:f,16:d,44:39,55:40,82:V,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,320:485},{13:f,16:d,39:[1,487],44:136,45:ne,46:488,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,282:486,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(_2,[2,460]),{13:f,16:d,44:136,45:ne,46:489,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,464]),{13:f,16:d,44:136,45:ne,46:490,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,466]),n(J,[2,40]),n(dd,[2,298]),n(ru,[2,87]),n(ru,[2,88]),n(ru,[2,89]),n(ru,[2,90]),{13:f,16:d,55:492,82:V,172:493,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,311:494,312:Xr,315:491},n(J,[2,41]),n(hd,[2,300]),n(nu,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:V,171:497,172:415,173:416,174:md,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:gd},{31:[1,498],89:[1,499]},{29:[1,500]},n(pd,[2,372]),{13:f,16:d,48:[2,422],55:194,197:yt,223:312,226:502,228:501,229:m2,307:43,308:p},n(Wi,[2,131]),n(Wi,[2,126]),n(la,[2,22]),n(la,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:ne,55:323,67:321,68:322,74:505,75:506,76:E2,77:320,78:T2,79:509,87:h,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,307:43,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P},n(b2,[2,294]),n(A2,[2,69]),n(A2,[2,70]),n(At,Fe,{59:197,69:198,20:511,70:U}),n(Q,Y,{58:205,62:206,23:512,63:Ce}),{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(Ja,[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(bd,[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:yd,55:220,82:V,87:h,89:rt,172:221,185:351,203:536,212:534,231:_d,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(Q,[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:Re,269:Ve,270:te,271:Ue,273:qe,274:je,276:We,277:Ae,279:$e,280:Oe,283:Be,285:Ge,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P}),n(eo,[2,291]),n(eo,[2,24]),n(eo,[2,25]),{13:f,16:d,44:136,45:ne,46:539,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(eo,[2,28]),n(Q,Y,{58:205,62:206,23:540,63:Ce}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(Za,[2,107]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,172:221,185:351,187:350,199:543,200:544,231:Tr,234:349,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(x2,[2,132]),n(Sd,[2,425]),n(x2,[2,133]),{13:f,16:d,44:354,55:355,82:V,87:h,172:357,237:356,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:358,312:Xr,313:545},n(Ar,[2,54]),n(Ar,[2,48]),n(Xa,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(Xa,[2,68]),n(W,[2,350],{31:C2,112:C2}),n(Ar,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(j,[2,333]),n(Ke,[2,16]),n(ud,[2,152]),n(ec,[2,154]),n(ec,[2,157]),n(tc,[2,159]),n(tc,[2,160],{262:389,261:548,39:ey,338:ty}),n(tc,[2,161],{262:389,261:549,39:ey,338:ty}),n(fr,[2,163]),{13:f,16:d,44:136,45:ne,46:550,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Qt,[2,178]),n(Qt,[2,179]),{13:f,16:d,44:136,45:ne,46:551,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:552,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:553,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,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:yt,223:562,307:43,308:p},n(iy,[2,224]),n(iy,[2,225]),n(iy,[2,226]),{31:[1,563],45:I2,94:564},n(J,[2,84]),n(dd,[2,368]),n(J,[2,85]),n(hd,[2,370]),n(nu,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(la,[2,35],{83:[1,569]}),n(la,[2,36],{81:[1,570]}),n(Jg,[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:ne,76:E2,78:T2,87:h,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,276:We,277:Ae,279:$e,280:Oe,283:Be,285:Ge,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P}),n(nc,[2,295]),{45:ne,77:572},{45:ne,77:573},n(nc,[2,33]),n(nc,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(Ja,[2,356]),n(R2,[2,357],{152:578,335:[1,579]}),n(ws,[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(O2,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:ne,55:323,67:321,68:322,77:320,79:585,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,307:43,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P},{45:[1,586]},n(ws,[2,81]),{29:q,57:587},n(Ja,[2,73]),n(W,[2,362],{29:Es,31:Es,85:Es,112:Es,159:Es,160:Es,161:Es,163:Es,164:Es}),n(bd,[2,112]),n(ic,[2,401],{206:588}),n(W,[2,405],{209:589,210:590}),n(W,[2,403]),n(W,[2,404]),n(bd,[2,113]),n(bd,[2,400]),{13:f,16:d,44:215,45:yd,48:[1,591],55:220,82:V,87:h,89:rt,172:221,185:351,203:536,212:592,231:_d,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(Sd,[2,426]),n(ny,[2,138]),n(ny,[2,139]),{232:[1,593]},n(eo,[2,292]),{47:[1,595],48:[1,594]},n(rc,[2,9]),n(Za,[2,392]),n(Za,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:Ka,308:p}),n(Za,[2,110],{272:[1,598]}),n(vd,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(oa,[2,58]),n(fr,[2,445]),n(fr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Qt,[2,99]),n(Yt,[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:V,172:493,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,311:494,312:Xr,315:611},n(J,[2,42]),n(nu,[2,304]),{13:f,16:d,55:414,82:V,95:612,171:613,172:415,173:416,174:md,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:gd},{31:[1,614],45:I2,94:615},n(Wi,[2,129]),n(S2,[2,421]),{82:[1,616]},{82:[1,617]},n(nc,[2,296]),n(nc,[2,31]),n(nc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(W,g2,{155:330,153:618,154:619,29:Ts,31:Ts,85:Ts,112:Ts,159:Ts,160:Ts,161:Ts,163:Ts,164:Ts}),n(R2,[2,358]),n(ws,[2,75]),n(ws,[2,76]),{29:q,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(O2,[2,366]),n(ws,[2,79]),{13:f,16:d,44:136,45:ne,46:622,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(ws,[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(ic,[2,117]),{13:f,16:d,44:215,45:yd,55:220,82:V,87:h,89:rt,172:221,185:351,203:536,211:626,212:627,231:_d,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(vs,[2,134]),n(Sd,[2,427]),n(vs,[2,135]),n(eo,[2,26]),{44:628,87:h},n(Za,[2,106]),n(Za,[2,394]),n(W,[2,396]),n(vd,[2,111]),n(vd,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:Ka,307:43,308:p},n(Zg,[2,217]),n(W,ld,{144:248,140:630,143:631,31:[2,343]}),n(Qt,[2,97]),n(Yt,[2,380]),n(Qt,[2,180]),{13:f,16:d,44:136,45:ne,46:632,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:633,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ht,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Qt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:V,171:637,172:415,173:416,174:md,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:gd},n(P2,[2,305]),n(J,[2,86]),n(nu,[2,374]),n(la,[2,37]),n(la,[2,38]),n(Ja,[2,72]),n(Ja,[2,360]),n(ws,[2,77]),{29:q,57:638},{47:[1,639]},{29:[2,376]},n(ic,[2,402]),n(ic,[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(ic,[2,118],{272:[1,641]}),n(wd,[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:ye,304:_e,305:se,306:Se},n(ru,[2,218]),n(nu,[2,44]),n(P2,[2,306]),n(ws,[2,78]),{44:651,87:h},n(ic,[2,116]),n(W,[2,406]),n(wd,[2,119]),n(wd,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(eo,[2,27]),n(vd,[2,230]),n(F2,[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(W,ld,{144:248,142:657,143:658,31:D2,112:D2}),n(F2,[2,346]),n(ws,[2,80]),n(wd,[2,231]),n(Xa,[2,67]),n(Xa,[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(C,O){if(O.recoverable)this.trace(C);else{var N=new Error(C);throw N.hash=O,N}},"parseError"),parse:o(function(C){var O=this,N=[0],re=[],Pe=[null],g=[],en=this.table,y="",Hi=0,ou=0,xd=0,Cd=2,cu=1,Id=g.slice.call(arguments,1),Mt=Object.create(this.lexer),Qi={yy:{}};for(var lu in this.yy)Object.prototype.hasOwnProperty.call(this.yy,lu)&&(Qi.yy[lu]=this.yy[lu]);Mt.setInput(C,Qi.yy),Qi.yy.lexer=Mt,Qi.yy.parser=this,typeof Mt.yylloc>"u"&&(Mt.yylloc={});var lc=Mt.yylloc;g.push(lc);var _t=Mt.options&&Mt.options.ranges;typeof Qi.yy.parseError=="function"?this.parseError=Qi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Nt(Yi){N.length=N.length-2*Yi,Pe.length=Pe.length-Yi,g.length=g.length-Yi}o(Nt,"popStack");for(var nt=o(function(){var Yi;return Yi=Mt.lex()||cu,typeof Yi!="number"&&(Yi=O.symbols_[Yi]||Yi),Yi},"lex"),ut,gn,io,Mn,AY,yy,uc={},Rd,Cs,G2,Od;;){if(io=N[N.length-1],this.defaultActions[io]?Mn=this.defaultActions[io]:((ut===null||typeof ut>"u")&&(ut=nt()),Mn=en[io]&&en[io][ut]),typeof Mn>"u"||!Mn.length||!Mn[0]){var _y="";Od=[];for(Rd in en[io])this.terminals_[Rd]&&Rd>Cd&&Od.push("'"+this.terminals_[Rd]+"'");Mt.showPosition?_y="Parse error on line "+(Hi+1)+`:
|
|
33
|
+
`)}o(h4,"composeErrorMessage");function p4(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=d4(r,e);return h4(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(p4,"formatErrorCtor");Sh.formatErrorCtor=p4});var pT=S(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.isDisposable=void 0;function m4(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(m4,"isDisposable");bh.isDisposable=m4});var gT=S(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.PostResolutionInterceptors=mo.PreResolutionInterceptors=void 0;var mT=B0(),vh=class extends mT.default{static{o(this,"PreResolutionInterceptors")}};mo.PreResolutionInterceptors=vh;var wh=class extends mT.default{static{o(this,"PostResolutionInterceptors")}};mo.PostResolutionInterceptors=wh;var z0=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new vh,this.postResolution=new wh}};mo.default=z0});var pa=S(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.instance=Ds.typeInfo=void 0;var g4=(uh(),Pd(lh)),nn=M0(),y4=fT(),Eh=mh(),_4=dT(),bn=P0(),Th=hT(),S4=G0(),b4=ph(),v4=pT(),w4=gT();Ds.typeInfo=new Map;var H0=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new _4.default,this.interceptors=new w4.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:bn.default.Transient}){this.ensureNotDisposed();let i;if(y4.isProvider(t)?i=t:i={useClass:t},nn.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&&nn.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===bn.default.Singleton||r.lifecycle==bn.default.ContainerScoped||r.lifecycle==bn.default.ResolutionScoped)&&(nn.isValueProvider(i)||nn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${bn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),nn.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(),nn.isNormalToken(e)){if(nn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:bn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:bn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!nn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:bn.default.Singleton})}resolve(e,t=new Th.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&nn.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(Eh.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===bn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===bn.default.Singleton,i=e.options.lifecycle===bn.default.ContainerScoped,s=r||i,a;return nn.isValueProvider(e.provider)?a=e.provider.useValue:nn.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):nn.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):nn.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===bn.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new Th.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&nn.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=>!nn.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===bn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===bn.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 g4.__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 b4.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Ds.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 v4.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return Eh.isTokenDescriptor(r)?Eh.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Th.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 Th.default,r.isOptional):this.resolve(r.token,e,r.isOptional):Eh.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(S4.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Ds.instance=new H0;Ds.default=Ds.instance});var yT=S(Y0=>{"use strict";Object.defineProperty(Y0,"__esModule",{value:!0});var E4=ho(),Ns=pa(),Q0=mh(),T4=G0();function A4(){return function(n){let e=E4.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return Q0.isTokenDescriptor(r)?Q0.isTransformDescriptor(r)?r.multiple?Ns.instance.resolve(r.transform).transform(Ns.instance.resolveAll(r.token),...r.transformArgs):Ns.instance.resolve(r.transform).transform(Ns.instance.resolve(r.token),...r.transformArgs):r.multiple?Ns.instance.resolveAll(r.token):Ns.instance.resolve(r.token):Q0.isTransformDescriptor(r)?Ns.instance.resolve(r.transform).transform(Ns.instance.resolve(r.token),...r.transformArgs):Ns.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(T4.formatErrorCtor(n,a,s))}})))}}}}o(A4,"autoInjectable");Y0.default=A4});var _T=S(K0=>{"use strict";Object.defineProperty(K0,"__esModule",{value:!0});var x4=ho();function C4(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return x4.defineInjectionTokenMetadata(t)}o(C4,"inject");K0.default=C4});var Ah=S(X0=>{"use strict";Object.defineProperty(X0,"__esModule",{value:!0});var I4=ho(),R4=pa(),ST=pa();function O4(n){return function(e){R4.typeInfo.set(e,I4.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{ST.instance.register(t,e)}):ST.instance.register(n.token,e))}}o(O4,"injectable");X0.default=O4});var bT=S(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});var P4=(uh(),Pd(lh)),F4=pa();function D4(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=P4.__rest(t,["token","options"]);return F4.instance.register(r,s,i)}),e}}o(D4,"registry");J0.default=D4});var vT=S(Z0=>{"use strict";Object.defineProperty(Z0,"__esModule",{value:!0});var N4=Ah(),L4=pa();function k4(){return function(n){N4.default()(n),L4.instance.registerSingleton(n)}}o(k4,"singleton");Z0.default=k4});var wT=S(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var M4=ho();function j4(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return M4.defineInjectionTokenMetadata(t)}o(j4,"injectAll");e_.default=j4});var ET=S(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var $4=ho();function B4(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return $4.defineInjectionTokenMetadata(r)}o(B4,"injectAllWithTransform");t_.default=B4});var TT=S(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var V4=ho();function U4(n,e,...t){return V4.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(U4,"injectWithTransform");r_.default=U4});var AT=S(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});var q4=Ah(),W4=pa();function G4(n,e){return function(t){q4.default()(t),W4.instance.register(e||t,t,{lifecycle:n})}}o(G4,"scoped");n_.default=G4});var xT=S(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});var z4=yT();Object.defineProperty(ii,"autoInjectable",{enumerable:!0,get:o(function(){return z4.default},"get")});var H4=_T();Object.defineProperty(ii,"inject",{enumerable:!0,get:o(function(){return H4.default},"get")});var Q4=Ah();Object.defineProperty(ii,"injectable",{enumerable:!0,get:o(function(){return Q4.default},"get")});var Y4=bT();Object.defineProperty(ii,"registry",{enumerable:!0,get:o(function(){return Y4.default},"get")});var K4=vT();Object.defineProperty(ii,"singleton",{enumerable:!0,get:o(function(){return K4.default},"get")});var X4=wT();Object.defineProperty(ii,"injectAll",{enumerable:!0,get:o(function(){return X4.default},"get")});var J4=ET();Object.defineProperty(ii,"injectAllWithTransform",{enumerable:!0,get:o(function(){return J4.default},"get")});var Z4=TT();Object.defineProperty(ii,"injectWithTransform",{enumerable:!0,get:o(function(){return Z4.default},"get")});var eM=AT();Object.defineProperty(ii,"scoped",{enumerable:!0,get:o(function(){return eM.default},"get")})});var CT=S(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});function tM(n){let e;return t=>(e==null&&(e=n(t)),e)}o(tM,"instanceCachingFactory");i_.default=tM});var IT=S(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});function rM(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(rM,"instancePerContainerCachingFactory");s_.default=rM});var RT=S(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});function nM(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(nM,"predicateAwareClassFactory");a_.default=nM});var OT=S(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});var iM=CT();Object.defineProperty(Iu,"instanceCachingFactory",{enumerable:!0,get:o(function(){return iM.default},"get")});var sM=IT();Object.defineProperty(Iu,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return sM.default},"get")});var aM=RT();Object.defineProperty(Iu,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return aM.default},"get")})});var ce=S(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var o_=(uh(),Pd(lh));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 oM=uT();Object.defineProperty(ma,"Lifecycle",{enumerable:!0,get:o(function(){return oM.Lifecycle},"get")});o_.__exportStar(xT(),ma);o_.__exportStar(OT(),ma);o_.__exportStar(M0(),ma);var cM=ph();Object.defineProperty(ma,"delay",{enumerable:!0,get:o(function(){return cM.delay},"get")});var lM=pa();Object.defineProperty(ma,"container",{enumerable:!0,get:o(function(){return lM.instance},"get")})});var c_=S((oZ,PT)=>{var _c=class{static{o(this,"Wildcard")}constructor(){return uM||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(_c.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(_c.prototype,"termType",{enumerable:!0,value:"Wildcard"});var uM=new _c;PT.exports.Wildcard=_c});var DT=S((lZ,FT)=>{var fM=(function(){var n=o(function(I,C,O,N){for(O=O||{},N=I.length;N--;O[I[N]]=C);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],_=[123,126],b=[1,67],E=[39,45,87],v=[13,16,45,197,224,308],A=[1,87],R=[2,281],B=[1,86],W=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],ve=[6,28,29,53,63,70,73,81,83,85],z=[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],j=[13,16,308],ee=[112,132,327,334],Ye=[13,16,112,132,308],st=[1,111],Rt=[1,117],at=[112,132,327,328,334],ct=[13,16,112,132,308,328],Ke=[28,29,45,53,87],ne=[1,138],V=[1,151],lt=[1,128],pt=[1,127],H=[1,129],Re=[1,140],Ve=[1,141],te=[1,142],Ue=[1,143],qe=[1,144],je=[1,145],We=[1,147],Ae=[1,148],$e=[2,457],Oe=[1,158],Be=[1,159],Ge=[1,160],le=[1,152],he=[1,153],pe=[1,156],ue=[1,171],fe=[1,172],de=[1,173],oe=[1,174],me=[1,175],ge=[1,176],ye=[1,167],_e=[1,168],se=[1,169],Se=[1,170],Ze=[1,157],ze=[1,166],Me=[1,161],w=[1,162],T=[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],_t=[1,195],At=[6,31,73,81,83,85],Fe=[2,285],U=[1,199],q=[1,201],Q=[6,31,70,73,81,83,85],Y=[2,283],Ce=[1,207],tt=[1,218],rt=[1,223],Tr=[1,219],mn=[1,225],Rn=[1,226],Xr=[1,224],i2=[6,63,70,73,81,83,85],s2=[1,236],a2=[2,334],o2=[1,243],c2=[1,241],Ar=[6,193],ld=[2,349],l2=[2,339],oa=[28,128],u2=[47,48,193,272],ud=[47,48,193,242,272],ec=[47,48,193,242,246,272],tc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],fr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],f2=[1,271],d2=[1,270],Yt=[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],h2=[1,281],p2=[1,280],Jr=[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],eu=[45,89],fd=[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],dd=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],hd=[31,89],pd=[48,87],Ya=[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],Wi=[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],m2=[1,313],rc=[6,85],Jg=[6,31,81,83,85],g2=[2,361],bs=[2,353],Ka=[1,343],tu=[31,112,335],vs=[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],Zg=[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],y2=[6,109,193],Xa=[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],ey=[1,390],ty=[1,391],ca=[13,16,87,197,308,314],_2=[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],md=[1,417],gd=[1,418],S2=[13,16,48,197,229,308],la=[6,31,85],b2=[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],ry=[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],Ja=[29,31,85,112,159,160,161,163,164],yd=[1,443],_d=[1,444],v2=[1,449],Za=[31,112,193,232,318,335],Sd=[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],w2=[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],ny=[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],ru=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],nu=[31,45],E2=[1,507],T2=[1,508],A2=[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],bd=[29,31,85,112,159,160,161,163,164,335],eo=[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],x2=[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],C2=[2,352],iy=[13,16,197,308,314],I2=[1,565],nc=[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],R2=[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],ws=[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],O2=[13,16,87,308],Es=[2,364],ic=[29,31,85,112,159,160,161,163,164,193,232,318,335],vd=[31,112,193,232,272,318,335],Ts=[2,359],P2=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],wd=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],F2=[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],D2=[2,347],sy={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(C,O,N,re,Pe,g,en){var y=g.length-1;switch(Pe){case 1:if(g[y-1]=g[y-1]||{},Ne.base&&(g[y-1].base=Ne.base),Ne.base="",g[y-1].prefixes=Ne.prefixes,Ne.prefixes=null,Ne.pathOnly){if(g[y-1].type==="path"||"termType"in g[y-1])return g[y-1];throw new Error("Received full SPARQL query in path only mode")}else if(g[y-1].type==="path"||"termType"in g[y-1])throw new Error("Received only path in full SPARQL mode");if(g[y-1].type==="update"){let St={};for(let Nt of g[y-1].updates)if(Nt.updateType==="insert"){let nt={};for(let ut of Nt.insert)if(ut.type==="bgp"||ut.type==="graph")for(let gn of ut.triples)gn.subject.termType==="BlankNode"&&(nt[gn.subject.value]=!0),gn.predicate.termType==="BlankNode"&&(nt[gn.predicate.value]=!0),gn.object.termType==="BlankNode"&&(nt[gn.object.value]=!0);for(let ut of Object.keys(nt)){if(St[ut])throw new Error("Detected reuse blank node across different INSERT DATA clauses");St[ut]=!0}}}return g[y-1];case 2:this.$={...g[y-1],...g[y],type:"query"};break;case 4:Ne.base=iu(g[y]);break;case 5:Ne.prefixes||(Ne.prefixes={}),g[y-1]=g[y-1].substr(0,g[y-1].length-1),g[y]=iu(g[y]),Ne.prefixes[g[y-1]]=g[y];break;case 6:this.$={...g[y-3],...no(g[y-2]),...g[y-1],...g[y]};break;case 7:if(!Ne.skipValidation&&(hy(g[y-3].variables.map(Nt=>dy(Nt.expression))).some(Nt=>Nt.aggregation==="count"&&!(Nt.expression instanceof Ed))||g[y].group)){for(let Nt of g[y-3].variables)if(Nt.termType==="Variable"){if(!g[y].group||!g[y].group.map(nt=>cc(nt)).includes(cc(Nt)))throw Error("Projection of ungrouped variable (?"+cc(Nt)+")")}else if(dy(Nt.expression).length===0){let nt=gD(Nt.expression);for(let ut of nt)if(!g[y].group||!g[y].group.map||!g[y].group.map(gn=>cc(gn)).includes(cc(ut)))throw Error("Use of ungrouped variable in projection of operation (?"+cc(ut)+")")}}let Qi=g[y-1].where.filter(St=>St.type==="query");if(Qi.length>0){let St=g[y-3].variables.filter(nt=>nt.variable&&nt.variable.value).map(nt=>nt.variable.value),Nt=hy(Qi.map(nt=>nt.variables)).map(nt=>nt.value||nt.variable.value);for(let nt of St)if(Nt.indexOf(nt)>=0)throw Error("Target id of 'AS' (?"+nt+") already used in subquery")}this.$=Vt(g[y-3],no(g[y-2]),g[y-1],g[y]);break;case 8:this.$=Vt({queryType:"CONSTRUCT",template:g[y-3]},no(g[y-2]),g[y-1],g[y]);break;case 9:this.$=Vt({queryType:"CONSTRUCT",template:g[y-2]=g[y-2]?g[y-2].triples:[]},no(g[y-5]),{where:[{type:"bgp",triples:ro([],g[y-2])}]},g[y]);break;case 10:this.$=Vt({queryType:"DESCRIBE",variables:g[y-3]==="*"?[new Ed]:g[y-3]},no(g[y-2]),g[y-1],g[y]);break;case 11:this.$=Vt({queryType:"ASK"},no(g[y-2]),g[y-1],g[y]);break;case 12:this.$=Vt(g[y-1],{variables:[new Ed]});break;case 13:let lu=g[y].map(St=>St.value||St.variable.value),lc=yD(lu);if(lc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+lc[0]+")");this.$=Vt(g[y-1],{variables:g[y]});break;case 14:this.$=Vt({queryType:"SELECT"},g[y]&&(g[y-1]=Zr(g[y]),g[y]={},g[y][g[y-1]]=!0,g[y]));break;case 16:case 27:this.$=sc(g[y-3],{variable:g[y-1]});break;case 17:case 18:this.$=Vt(g[y-3],g[y-2],g[y-1],g[y],{type:"query"});break;case 19:case 58:this.$={iri:g[y],named:!!g[y-1]};break;case 20:this.$={where:g[y].patterns};break;case 21:this.$=Vt(g[y-1],g[y]);break;case 22:this.$=Vt(g[y-2],g[y-1],g[y]);break;case 23:this.$={group:g[y]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=sc(g[y]);break;case 26:this.$=sc(g[y-1]);break;case 29:this.$={having:g[y]};break;case 30:this.$={order:g[y]};break;case 32:this.$=sc(g[y],{descending:!0});break;case 35:this.$={limit:oc(g[y])};break;case 36:this.$={offset:oc(g[y])};break;case 37:this.$={limit:oc(g[y-2]),offset:oc(g[y])};break;case 38:this.$={limit:oc(g[y]),offset:oc(g[y-2])};break;case 39:case 43:this.$={type:"values",values:g[y]};break;case 40:case 84:this.$=g[y-1].map(St=>({[g[y-3]]:St}));break;case 41:case 85:this.$=g[y-1].map(()=>({}));break;case 42:case 86:var Hi=g[y-4].length;g[y-4]=g[y-4].map(ay),this.$=g[y-1].map(function(St){if(St.length!==Hi)throw Error("Inconsistent VALUES length");for(var Nt={},nt=0;nt<Hi;nt++)Nt["?"+g[y-4][nt].value]=St[nt];return Nt});break;case 44:case 65:case 100:case 126:case 175:this.$=g[y-1];break;case 45:this.$={type:"update",updates:As(g[y-2],g[y-1])};break;case 46:this.$=Vt({type:"load",silent:!!g[y-2],source:g[y-1]},g[y]&&{destination:g[y]});break;case 47:this.$={type:Zr(g[y-2]),silent:!!g[y-1],graph:g[y]};break;case 48:this.$={type:Zr(g[y-4]),silent:!!g[y-3],source:g[y-2],destination:g[y]};break;case 49:this.$={type:"create",silent:!!g[y-2],graph:{type:"graph",name:g[y]}};break;case 50:this.$={updateType:"insert",insert:W2(g[y])};break;case 51:this.$={updateType:"delete",delete:gy(W2(g[y]))};break;case 52:this.$={updateType:"deletewhere",delete:gy(g[y])};break;case 53:this.$={updateType:"insertdelete",...g[y-4],...g[y-3],...no(g[y-2],"using"),where:g[y].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=g[y];break;case 55:this.$={delete:gy(g[y-1]),insert:g[y]||[]};break;case 56:this.$={delete:[],insert:g[y]};break;case 59:this.$={graph:g[y]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:g[y]};break;case 64:this.$={[Zr(g[y])]:!0};break;case 66:this.$=g[y-1]?Gi(g[y],[g[y-1]]):Gi(g[y]);break;case 67:var ou=Vt(g[y-3]||{triples:[]},{type:"graph",name:g[y-5]});this.$=g[y]?[ou,g[y]]:[ou];break;case 68:case 73:this.$={type:"bgp",triples:Gi(g[y-2],[g[y-1]])};break;case 69:this.$={type:"group",patterns:[g[y-1]]};break;case 70:for(let St of g[y-1].filter(Nt=>Nt.type==="bind")){let Nt=g[y-1].indexOf(St),nt=new Set;for(let ut of g[y-1].slice(0,Nt))(ut.type==="group"||ut.type==="bgp")&&U2(ut).forEach(gn=>nt.add(gn));if(nt.has(St.variable.value))throw Error("Variable used to bind is already bound (?"+St.variable.value+")")}this.$={type:"group",patterns:g[y-1]};break;case 71:this.$=g[y-1]?Gi([g[y-1]],g[y]):Gi(g[y]);break;case 72:this.$=g[y]?[g[y-2],g[y]]:g[y-2];break;case 75:this.$=Vt(g[y],{type:"optional"});break;case 76:this.$=Vt(g[y],{type:"minus"});break;case 77:this.$=Vt(g[y],{type:"graph",name:g[y-1]});break;case 78:this.$=Vt(g[y],{type:"service",name:g[y-1],silent:!!g[y-2]});break;case 79:this.$={type:"filter",expression:g[y]};break;case 80:this.$={type:"bind",variable:g[y-1],expression:g[y-3]};break;case 89:this.$=au(g[y]);break;case 90:this.$=void 0;break;case 91:this.$=g[y-1].length?{type:"union",patterns:Gi(g[y-1].map(cy),[cy(g[y])])}:g[y];break;case 95:this.$={...g[y],function:g[y-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:As(g[y-2],g[y-1]),distinct:!!g[y-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.$=As(g[y-2],g[y-1]);break;case 101:this.$=Gi(g[y-2],[g[y-1]]);break;case 102:case 112:this.$=my(g[y].map(St=>Vt(xs(g[y-1]),St)));break;case 103:this.$=my(ro(g[y].map(St=>Vt(xs(g[y-1].entity),St)),g[y-1].triples));break;case 105:this.$=Gi([g[y-1]],g[y]);break;case 106:this.$=Gi(g[y]);break;case 107:this.$=fy(g[y-1],g[y]);break;case 109:case 237:this.$=Ne.factory.namedNode(aD);break;case 110:case 118:this.$=As(g[y-1],g[y]);break;case 111:this.$=g[y]?{annotation:g[y],object:g[y-1]}:g[y-1];break;case 113:this.$=g[y]?my(ro(g[y].map(St=>Vt(xs(g[y-1].entity),St)),g[y-1].triples)):g[y-1].triples;break;case 114:this.$=fy(...g[y-1],g[y]);break;case 116:this.$=fy(...g[y]);break;case 117:case 159:case 163:this.$=[g[y-1],g[y]];break;case 119:this.$=g[y]?{object:g[y-1],annotation:g[y]}:g[y-1];break;case 120:this.$=g[y-1].length?ac("|",As(g[y-1],g[y])):g[y];break;case 121:this.$=g[y-1].length?ac("/",As(g[y-1],g[y])):g[y];break;case 122:this.$=g[y]?ac(g[y],[g[y-1]]):g[y-1];break;case 123:this.$=g[y-1]?ac(g[y-1],[g[y]]):g[y];break;case 125:case 131:this.$=ac(g[y-1],[g[y]]);break;case 129:this.$=ac("|",As(g[y-2],g[y-1]));break;case 132:case 134:this.$=pD(g[y-1]);break;case 133:case 135:this.$=mD(g[y-1]);break;case 140:this.$={entity:g[y],triples:[]};break;case 145:this.$=ay(g[y]);break;case 149:this.$=Ne.factory.namedNode(N2);break;case 151:case 153:case 158:case 162:this.$=oy(g[y-1],g[y]);break;case 152:this.$=["||",g[y]];break;case 154:this.$=["&&",g[y]];break;case 156:this.$=xr(g[y-1],[g[y-2],g[y]]);break;case 157:this.$=xr(g[y-2]?"notin":"in",[g[y-3],g[y]]);break;case 160:this.$=["+",oy(g[y-1],g[y])];break;case 161:var xd=zi(g[y-1].value.replace("-",""),g[y-1].datatype);this.$=["-",oy(xd,g[y])];break;case 164:this.$=xr("UPLUS",[g[y]]);break;case 165:this.$=xr(g[y-1],[g[y]]);break;case 166:this.$=xr("UMINUS",[g[y]]);break;case 177:this.$=xr(Zr(g[y-1]));break;case 178:this.$=xr(Zr(g[y-3]),[g[y-1]]);break;case 179:this.$=au(xr(Zr(g[y-3]),[g[y-1]]));break;case 180:this.$=xr(Zr(g[y-5]),[g[y-3],g[y-1]]);break;case 181:this.$=xr(Zr(g[y-7]),[g[y-5],g[y-3],g[y-1]]);break;case 182:this.$=au(xr(Zr(g[y-7]),[g[y-5],g[y-3],g[y-1]]));break;case 183:this.$=xr(Zr(g[y-1]),g[y]);break;case 184:this.$=xr("bound",[ay(g[y-1])]);break;case 185:this.$=xr(g[y-1],[]);break;case 186:this.$=xr(g[y-3],[g[y-1]]);break;case 187:this.$=xr(g[y-2]?"notexists":"exists",[cy(g[y])]);break;case 188:case 189:this.$=sc(g[y-1],{type:"aggregate",aggregation:Zr(g[y-4]),distinct:!!g[y-2]});break;case 190:this.$=sc(g[y-2],{type:"aggregate",aggregation:Zr(g[y-5]),distinct:!!g[y-3],separator:typeof g[y-1]=="string"?g[y-1]:" "});break;case 192:this.$=zi(g[y]);break;case 193:this.$=uD(g[y-1],Zr(g[y].substr(1)));break;case 194:this.$=zi(g[y-2],g[y]);break;case 195:case 204:this.$=zi(g[y],L2);break;case 196:case 205:this.$=zi(g[y],k2);break;case 197:case 206:this.$=zi(Zr(g[y]),M2);break;case 200:this.$=zi(g[y].toLowerCase(),lD);break;case 201:this.$=zi(g[y].substr(1),L2);break;case 202:this.$=zi(g[y].substr(1),k2);break;case 203:this.$=zi(g[y].substr(1).toLowerCase(),M2);break;case 207:case 208:this.$=V2(g[y],1);break;case 209:case 210:this.$=V2(g[y],3);break;case 211:this.$=Ne.factory.namedNode(iu(g[y]));break;case 213:var Cd=g[y].indexOf(":"),cu=g[y].substr(0,Cd),Id=Ne.prefixes[cu];if(!Id)throw new Error("Unknown prefix: "+cu);var Mt=iu(Id+g[y].substr(Cd+1));this.$=Ne.factory.namedNode(Mt);break;case 214:if(g[y]=g[y].substr(0,g[y].length-1),!(g[y]in Ne.prefixes))throw new Error("Unknown prefix: "+g[y]);var Mt=iu(Ne.prefixes[g[y]]);this.$=Ne.factory.namedNode(Mt);break;case 215:this.$=su(g[y].replace(/^(_:)/,""));break;case 216:this.$=su();break;case 217:case 218:case 232:this.$=au(ly(g[y-3],g[y-2],g[y-1]));break;case 230:case 231:this.$=au(g[y-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[y-1].push(g[y]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[g[y]];break;case 308:g[y-3].push(g[y-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[y-2].push(g[y-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(_,[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:b,87:h},n(E,[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(v,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:A,29:R,52:84,53:B,56:85},{19:88,28:A,29:R,52:89,53:B,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:B},n(W,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(ve,[2,263],{34:96}),n(ve,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(ve,[2,262]),n(z,[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:A,29:R,52:99,53:B,56:85},{6:[2,309],99:100,193:[1,101]},n(j,[2,311],{101:102,328:[1,103]}),n(ee,[2,317],{104:104,328:[1,105]}),n(Ye,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:st,114:110},{29:st,114:112},{29:st,114:113},{118:114,123:[1,115],125:116,126:Rt},n(at,[2,315]),n(at,[2,316]),n(ct,[2,319]),n(ct,[2,320]),n(ct,[2,321]),n(_,[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:b,87:h}),n(Ke,[2,269]),n(Ke,[2,15]),{13:f,16:d,44:136,45:ne,46:120,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(E,[2,14]),n(E,[2,274]),n(E,[2,271]),n(E,[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:_t,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(v,[2,419]),n(At,Fe,{20:196,59:197,69:198,70:U}),n(l,[2,250]),{29:q,57:200},n(j,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(Q,Y,{23:204,58:205,62:206,63:Ce}),n(l,[2,252]),{19:208,28:A,29:R,52:209,53:B,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,145:212,172:221,185:213,187:214,231:Tr,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(i2,[2,265],{56:85,35:227,52:228,19:229,28:A,29:R,53:B}),n(z,[2,260]),n(Q,Y,{58:205,62:206,23:230,63:Ce}),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(j,[2,312]),{105:233,112:s2,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(ee,[2,318]),n(j,a2,{108:240,133:242,112:o2,132:c2}),n(Ye,[2,323]),{112:[1,244]},{112:[2,325]},n(Ar,[2,50]),n(W,ld,{135:245,136:246,143:247,144:248,31:l2,112:l2}),n(Ar,[2,51]),n(Ar,[2,52]),n(oa,[2,328],{119:249}),{29:st,114:250},n(oa,[2,56]),{29:st,114:251},n(_,[2,59]),n(Ke,[2,270]),{47:[1,252]},n(u2,[2,150]),n(ud,[2,428],{240:253}),n(ec,[2,430],{244:254}),n(ec,[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(tc,[2,440],{252:264}),n(fr,[2,448],{260:265}),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(fr,[2,167]),n(fr,[2,168]),n(fr,[2,169]),n(fr,[2,170],{176:269,45:f2,89:d2}),n(fr,[2,171]),n(fr,[2,172]),n(fr,[2,173]),n(fr,[2,174]),{13:f,16:d,44:136,45:ne,46:272,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:h2,89:p2,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(Jr,[2,192],{292:[1,286],293:[1,287]}),n(Jr,[2,195]),n(Jr,[2,196]),n(Jr,[2,197]),n(Jr,[2,198]),n(Jr,[2,199]),n(Jr,[2,200]),{13:f,16:d,44:39,55:40,82:V,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(eu,[2,452]),n(eu,[2,453]),n(eu,[2,454]),n(eu,[2,455]),n(eu,[2,456]),{279:[2,458]},n(fd,[2,207]),n(fd,[2,208]),n(fd,[2,209]),n(fd,[2,210]),n(Jr,[2,201]),n(Jr,[2,202]),n(Jr,[2,203]),n(Jr,[2,204]),n(Jr,[2,205]),n(Jr,[2,206]),n(e,[2,5]),n(dd,[2,297],{88:295}),n(hd,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(pd,[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(Ya,[2,123]),n(Ya,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(Wi,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:_t,223:312,225:308,226:309,229:m2,307:43,308:p},n(c,i,{215:10,214:314}),n(Wi,[2,236]),n(Wi,[2,237]),n(rc,[2,6]),n(Jg,[2,287],{60:315,72:316,73:[1,317]}),n(At,[2,286]),{13:f,16:d,45:ne,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,307:43,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P},n([6,31,63,70,73,81,83,85],[2,20]),n(W,g2,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:bs,31:bs,85:bs,112:bs,159:bs,160:bs,161:bs,163:bs,164:bs,41:s}),{13:f,16:d,55:331,307:43,308:p},n(j,[2,280]),n(rc,[2,7]),n(At,Fe,{59:197,69:198,20:332,70:U}),n(Q,[2,284]),{64:[1,333]},n(Q,Y,{58:205,62:206,23:334,63:Ce}),n(l,[2,254]),n(W,ld,{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:Ka,307:43,308:p},n(tu,[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:Ka,308:p}),n(vs,[2,227]),n(vs,[2,228]),n(vs,[2,229]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,172:221,185:351,187:350,200:348,230:347,231:Tr,234:349,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:Ka,307:43,308:p},n(vs,[2,146]),n(vs,[2,147]),n(vs,[2,148]),n(vs,[2,149]),{13:f,16:d,44:354,55:355,82:V,87:h,172:357,237:356,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:358,312:Xr,313:353},n(Zg,[2,215]),n(Zg,[2,216]),n(Q,Y,{58:205,62:206,23:359,63:Ce}),n(ve,[2,264]),n(i2,[2,266]),n(rc,[2,11]),n(r,[2,308],{6:[2,310]}),n(Ar,[2,313],{102:360,120:361,121:[1,362]}),n(Ar,[2,47]),n(Ar,[2,63]),n(Ar,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(Ar,[2,336]),n(Ar,[2,337]),n(Ar,[2,338]),{109:[1,364]},n(y2,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(j,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(Xa,[2,341],{137:368}),n(Xa,[2,340]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,145:369,172:221,185:213,187:214,231:Tr,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},{28:[1,370],127:371,128:[1,372]},n(oa,[2,330],{124:373,125:374,126:Rt}),n(oa,[2,57]),{44:375,87:h},n(u2,[2,151],{241:376,242:[1,377]}),n(ud,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,247:380,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,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:ue,298:fe,299:de,300:oe,301:me,302:ge}),n(tc,[2,162],{261:388,262:389,39:ey,338:ty}),n(fr,[2,164]),n(fr,[2,165]),n(fr,[2,166]),n(Yt,[2,95]),n(Yt,[2,96]),n(Kt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Yt,[2,177]),{13:f,16:d,44:136,45:ne,46:395,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:396,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:397,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:398,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:399,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,183]),n(Yt,[2,98]),n(Kt,[2,381],{180:400}),{87:[1,401]},n(Yt,[2,185]),{13:f,16:d,44:136,45:ne,46:402,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{29:q,57:403},n(Jr,[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:Ka,307:43,308:p},n(ca,[2,233]),n(ca,[2,234]),n(ca,[2,235]),n(_2,[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:V,171:413,172:415,173:416,174:md,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:gd},{31:[1,419],89:[1,420]},{29:[1,421]},n(pd,[2,302]),n(dd,[2,367],{167:422}),n(hd,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(pd,[2,371]),n(Ya,[2,122]),n(Ya,[2,417]),n(Ya,[2,413]),n(Ya,[2,414]),n(Ya,[2,415]),n(Wi,[2,125]),n(Wi,[2,127]),n(Wi,[2,128]),n(S2,[2,420],{227:426}),n(Wi,[2,130]),{13:f,16:d,55:194,197:_t,223:427,307:43,308:p},{48:[1,428]},n(la,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(Jg,[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:ne,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,276:We,277:Ae,279:$e,280:Oe,283:Be,285:Ge,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P}),n(b2,[2,293]),n(ry,[2,92]),n(ry,[2,93]),n(ry,[2,94]),{45:f2,89:d2,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:A,29:R,56:85},{19:438,28:A,29:R,56:85},n(Ja,[2,355],{149:439}),n(Ja,[2,354]),{13:f,16:d,44:215,45:yd,55:220,82:V,87:h,89:rt,156:440,172:221,185:441,203:442,231:_d,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(ve,[2,19]),n(la,[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:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,307:43,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P},n(rc,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(W,[2,386],{31:[2,388]}),n(tu,[2,102]),n(Za,[2,391],{191:452}),n(W,[2,395],{196:453,198:454}),n(W,[2,108]),n(W,[2,109]),n(tu,[2,103]),n(tu,[2,104]),n(tu,[2,390]),{13:f,16:d,44:215,45:tt,48:[1,455],55:220,82:V,87:h,89:rt,172:221,185:351,187:350,200:456,231:Tr,234:349,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(Sd,[2,424]),n(w2,[2,136]),n(w2,[2,137]),n(ny,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:Ka,307:43,308:p},n(ca,[2,219]),n(ca,[2,220]),n(ca,[2,221]),n(ca,[2,222]),n(ca,[2,223]),n(rc,[2,10]),n(Ar,[2,46]),n(Ar,[2,314]),{112:s2,122:459},n(Ar,[2,62]),n(j,a2,{133:242,108:460,112:o2,132:c2}),n(y2,[2,61]),n(Ar,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Xa,[2,351],{146:463,335:[1,464]}),{29:q,57:465},n(oa,[2,329]),n(j,[2,332],{129:466,327:[1,467]}),n(oa,[2,55]),n(oa,[2,331]),{48:[1,468]},n(ud,[2,429]),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(ec,[2,431]),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,243:470,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(ec,[2,156]),{45:h2,89:p2,179:471},n(tc,[2,441]),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,251:472,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(fr,[2,444],{256:473}),n(fr,[2,446],{258:474}),n(Kt,[2,442]),n(Kt,[2,443]),n(fr,[2,449]),{13:f,16:d,44:136,45:ne,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,255:154,257:155,259:475,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,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:ne,46:482,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{48:[1,483]},{48:[1,484]},n(Yt,[2,187]),n(Jr,[2,194]),{13:f,16:d,44:39,55:40,82:V,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,320:485},{13:f,16:d,39:[1,487],44:136,45:ne,46:488,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,282:486,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(_2,[2,460]),{13:f,16:d,44:136,45:ne,46:489,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Kt,[2,464]),{13:f,16:d,44:136,45:ne,46:490,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Kt,[2,466]),n(J,[2,40]),n(dd,[2,298]),n(ru,[2,87]),n(ru,[2,88]),n(ru,[2,89]),n(ru,[2,90]),{13:f,16:d,55:492,82:V,172:493,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,311:494,312:Xr,315:491},n(J,[2,41]),n(hd,[2,300]),n(nu,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:V,171:497,172:415,173:416,174:md,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:gd},{31:[1,498],89:[1,499]},{29:[1,500]},n(pd,[2,372]),{13:f,16:d,48:[2,422],55:194,197:_t,223:312,226:502,228:501,229:m2,307:43,308:p},n(Wi,[2,131]),n(Wi,[2,126]),n(la,[2,22]),n(la,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:ne,55:323,67:321,68:322,74:505,75:506,76:E2,77:320,78:T2,79:509,87:h,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,307:43,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P},n(b2,[2,294]),n(A2,[2,69]),n(A2,[2,70]),n(At,Fe,{59:197,69:198,20:511,70:U}),n(Q,Y,{58:205,62:206,23:512,63:Ce}),{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(Ja,[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(bd,[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:yd,55:220,82:V,87:h,89:rt,172:221,185:351,203:536,212:534,231:_d,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(Q,[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:Re,269:Ve,270:te,271:Ue,273:qe,274:je,276:We,277:Ae,279:$e,280:Oe,283:Be,285:Ge,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P}),n(eo,[2,291]),n(eo,[2,24]),n(eo,[2,25]),{13:f,16:d,44:136,45:ne,46:539,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(eo,[2,28]),n(Q,Y,{58:205,62:206,23:540,63:Ce}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(Za,[2,107]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,172:221,185:351,187:350,199:543,200:544,231:Tr,234:349,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(x2,[2,132]),n(Sd,[2,425]),n(x2,[2,133]),{13:f,16:d,44:354,55:355,82:V,87:h,172:357,237:356,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:358,312:Xr,313:545},n(Ar,[2,54]),n(Ar,[2,48]),n(Xa,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(Xa,[2,68]),n(W,[2,350],{31:C2,112:C2}),n(Ar,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(j,[2,333]),n(Ke,[2,16]),n(ud,[2,152]),n(ec,[2,154]),n(ec,[2,157]),n(tc,[2,159]),n(tc,[2,160],{262:389,261:548,39:ey,338:ty}),n(tc,[2,161],{262:389,261:549,39:ey,338:ty}),n(fr,[2,163]),{13:f,16:d,44:136,45:ne,46:550,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,178]),n(Yt,[2,179]),{13:f,16:d,44:136,45:ne,46:551,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:552,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:553,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{48:[1,554],272:[1,555]},n(Yt,[2,184]),n(Yt,[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:_t,223:562,307:43,308:p},n(iy,[2,224]),n(iy,[2,225]),n(iy,[2,226]),{31:[1,563],45:I2,94:564},n(J,[2,84]),n(dd,[2,368]),n(J,[2,85]),n(hd,[2,370]),n(nu,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(la,[2,35],{83:[1,569]}),n(la,[2,36],{81:[1,570]}),n(Jg,[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:ne,76:E2,78:T2,87:h,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,276:We,277:Ae,279:$e,280:Oe,283:Be,285:Ge,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P}),n(nc,[2,295]),{45:ne,77:572},{45:ne,77:573},n(nc,[2,33]),n(nc,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(Ja,[2,356]),n(R2,[2,357],{152:578,335:[1,579]}),n(ws,[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(O2,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:ne,55:323,67:321,68:322,77:320,79:585,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,307:43,308:p,346:ze,347:Me,348:w,349:T,350:x,351:P},{45:[1,586]},n(ws,[2,81]),{29:q,57:587},n(Ja,[2,73]),n(W,[2,362],{29:Es,31:Es,85:Es,112:Es,159:Es,160:Es,161:Es,163:Es,164:Es}),n(bd,[2,112]),n(ic,[2,401],{206:588}),n(W,[2,405],{209:589,210:590}),n(W,[2,403]),n(W,[2,404]),n(bd,[2,113]),n(bd,[2,400]),{13:f,16:d,44:215,45:yd,48:[1,591],55:220,82:V,87:h,89:rt,172:221,185:351,203:536,212:592,231:_d,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(Sd,[2,426]),n(ny,[2,138]),n(ny,[2,139]),{232:[1,593]},n(eo,[2,292]),{47:[1,595],48:[1,594]},n(rc,[2,9]),n(Za,[2,392]),n(Za,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:Ka,308:p}),n(Za,[2,110],{272:[1,598]}),n(vd,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(oa,[2,58]),n(fr,[2,445]),n(fr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Yt,[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(Yt,[2,188]),n(Yt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:V,172:493,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,311:494,312:Xr,315:611},n(J,[2,42]),n(nu,[2,304]),{13:f,16:d,55:414,82:V,95:612,171:613,172:415,173:416,174:md,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:gd},{31:[1,614],45:I2,94:615},n(Wi,[2,129]),n(S2,[2,421]),{82:[1,616]},{82:[1,617]},n(nc,[2,296]),n(nc,[2,31]),n(nc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(W,g2,{155:330,153:618,154:619,29:Ts,31:Ts,85:Ts,112:Ts,159:Ts,160:Ts,161:Ts,163:Ts,164:Ts}),n(R2,[2,358]),n(ws,[2,75]),n(ws,[2,76]),{29:q,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(O2,[2,366]),n(ws,[2,79]),{13:f,16:d,44:136,45:ne,46:622,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(ws,[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(ic,[2,117]),{13:f,16:d,44:215,45:yd,55:220,82:V,87:h,89:rt,172:221,185:351,203:536,211:626,212:627,231:_d,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,309:mn,310:Rn,311:217,312:Xr},n(vs,[2,134]),n(Sd,[2,427]),n(vs,[2,135]),n(eo,[2,26]),{44:628,87:h},n(Za,[2,106]),n(Za,[2,394]),n(W,[2,396]),n(vd,[2,111]),n(vd,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:Ka,307:43,308:p},n(Zg,[2,217]),n(W,ld,{144:248,140:630,143:631,31:[2,343]}),n(Yt,[2,97]),n(Kt,[2,380]),n(Yt,[2,180]),{13:f,16:d,44:136,45:ne,46:632,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ne,46:633,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ve,270:te,271:Ue,273:qe,274:je,275:146,276:We,277:Ae,278:149,279:$e,280:Oe,283:Be,285:Ge,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:Ze,346:ze,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:V,171:637,172:415,173:416,174:md,255:154,257:155,291:150,294:le,295:he,296:pe,297:ue,298:fe,299:de,300:oe,301:me,302:ge,303:ye,304:_e,305:se,306:Se,307:43,308:p,312:gd},n(P2,[2,305]),n(J,[2,86]),n(nu,[2,374]),n(la,[2,37]),n(la,[2,38]),n(Ja,[2,72]),n(Ja,[2,360]),n(ws,[2,77]),{29:q,57:638},{47:[1,639]},{29:[2,376]},n(ic,[2,402]),n(ic,[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(ic,[2,118],{272:[1,641]}),n(wd,[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:ye,304:_e,305:se,306:Se},n(ru,[2,218]),n(nu,[2,44]),n(P2,[2,306]),n(ws,[2,78]),{44:651,87:h},n(ic,[2,116]),n(W,[2,406]),n(wd,[2,119]),n(wd,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(eo,[2,27]),n(vd,[2,230]),n(F2,[2,345],{141:653,335:[1,654]}),n(Yt,[2,181]),n(Yt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(W,ld,{144:248,142:657,143:658,31:D2,112:D2}),n(F2,[2,346]),n(ws,[2,80]),n(wd,[2,231]),n(Xa,[2,67]),n(Xa,[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(C,O){if(O.recoverable)this.trace(C);else{var N=new Error(C);throw N.hash=O,N}},"parseError"),parse:o(function(C){var O=this,N=[0],re=[],Pe=[null],g=[],en=this.table,y="",Hi=0,ou=0,xd=0,Cd=2,cu=1,Id=g.slice.call(arguments,1),Mt=Object.create(this.lexer),Qi={yy:{}};for(var lu in this.yy)Object.prototype.hasOwnProperty.call(this.yy,lu)&&(Qi.yy[lu]=this.yy[lu]);Mt.setInput(C,Qi.yy),Qi.yy.lexer=Mt,Qi.yy.parser=this,typeof Mt.yylloc>"u"&&(Mt.yylloc={});var lc=Mt.yylloc;g.push(lc);var St=Mt.options&&Mt.options.ranges;typeof Qi.yy.parseError=="function"?this.parseError=Qi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Nt(Yi){N.length=N.length-2*Yi,Pe.length=Pe.length-Yi,g.length=g.length-Yi}o(Nt,"popStack");for(var nt=o(function(){var Yi;return Yi=Mt.lex()||cu,typeof Yi!="number"&&(Yi=O.symbols_[Yi]||Yi),Yi},"lex"),ut,gn,io,Mn,AY,yy,uc={},Rd,Cs,G2,Od;;){if(io=N[N.length-1],this.defaultActions[io]?Mn=this.defaultActions[io]:((ut===null||typeof ut>"u")&&(ut=nt()),Mn=en[io]&&en[io][ut]),typeof Mn>"u"||!Mn.length||!Mn[0]){var _y="";Od=[];for(Rd in en[io])this.terminals_[Rd]&&Rd>Cd&&Od.push("'"+this.terminals_[Rd]+"'");Mt.showPosition?_y="Parse error on line "+(Hi+1)+`:
|
|
34
34
|
`+Mt.showPosition()+`
|
|
35
|
-
Expecting `+Od.join(", ")+", got '"+(this.terminals_[ut]||ut)+"'":_y="Parse error on line "+(Hi+1)+": Unexpected "+(ut==cu?"end of input":"'"+(this.terminals_[ut]||ut)+"'"),this.parseError(_y,{text:Mt.match,token:this.terminals_[ut]||ut,line:Mt.yylineno,loc:lc,expected:Od})}if(Mn[0]instanceof Array&&Mn.length>1)throw new Error("Parse Error: multiple actions possible at state: "+io+", token: "+ut);switch(Mn[0]){case 1:N.push(ut),Pe.push(Mt.yytext),g.push(Mt.yylloc),N.push(Mn[1]),ut=null,gn?(ut=gn,gn=null):(ou=Mt.yyleng,y=Mt.yytext,Hi=Mt.yylineno,lc=Mt.yylloc,xd>0&&xd--);break;case 2:if(Cs=this.productions_[Mn[1]][1],uc.$=Pe[Pe.length-Cs],uc._$={first_line:g[g.length-(Cs||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(Cs||1)].first_column,last_column:g[g.length-1].last_column},
|
|
35
|
+
Expecting `+Od.join(", ")+", got '"+(this.terminals_[ut]||ut)+"'":_y="Parse error on line "+(Hi+1)+": Unexpected "+(ut==cu?"end of input":"'"+(this.terminals_[ut]||ut)+"'"),this.parseError(_y,{text:Mt.match,token:this.terminals_[ut]||ut,line:Mt.yylineno,loc:lc,expected:Od})}if(Mn[0]instanceof Array&&Mn.length>1)throw new Error("Parse Error: multiple actions possible at state: "+io+", token: "+ut);switch(Mn[0]){case 1:N.push(ut),Pe.push(Mt.yytext),g.push(Mt.yylloc),N.push(Mn[1]),ut=null,gn?(ut=gn,gn=null):(ou=Mt.yyleng,y=Mt.yytext,Hi=Mt.yylineno,lc=Mt.yylloc,xd>0&&xd--);break;case 2:if(Cs=this.productions_[Mn[1]][1],uc.$=Pe[Pe.length-Cs],uc._$={first_line:g[g.length-(Cs||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(Cs||1)].first_column,last_column:g[g.length-1].last_column},St&&(uc._$.range=[g[g.length-(Cs||1)].range[0],g[g.length-1].range[1]]),yy=this.performAction.apply(uc,[y,ou,Hi,Qi.yy,Mn[1],Pe,g].concat(Id)),typeof yy<"u")return yy;Cs&&(N=N.slice(0,-1*Cs*2),Pe=Pe.slice(0,-1*Cs),g=g.slice(0,-1*Cs)),N.push(this.productions_[Mn[1]][0]),Pe.push(uc.$),g.push(uc._$),G2=en[N[N.length-2]][N[N.length-1]],N.push(G2);break;case 3:return!0}}return!0},"parse")},Ed=c_().Wildcard,Td="http://www.w3.org/1999/02/22-rdf-syntax-ns#",aD=Td+"type",oD=Td+"first",cD=Td+"rest",N2=Td+"nil",Ad="http://www.w3.org/2001/XMLSchema#",L2=Ad+"integer",k2=Ad+"decimal",M2=Ad+"double",lD=Ad+"boolean",to="",j2="",$2="";function Zr(I){return I.toLowerCase()}o(Zr,"lowercase");function As(I,C){return I.push(C),I}o(As,"appendTo");function ro(I,C){return I.push.apply(I,C),I}o(ro,"appendAllTo");function Vt(I){I||(I={});for(var C=1,O=arguments.length,N;C<O&&(N=arguments[C]||{});C++)for(var re in N)I[re]=N[re];return I}o(Vt,"extend");function Gi(){for(var I=[],C=0,O=arguments.length;C<O;C++)I=I.concat.apply(I,arguments[C]);return I}o(Gi,"unionAll");function iu(I){if(I[0]==="<"&&(I=I.substring(1,I.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(I))return I;if(!Ne.base)throw new Error("Cannot resolve relative IRI "+I+" because no base IRI was set.");switch(to!==Ne.base&&(to=Ne.base,j2=to.replace(/[^\/:]*$/,""),$2=to.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),I[0]){case void 0:return to;case"#":return to+I;case"?":return to.replace(/(?:\?.*)?$/,I);case"/":return $2+I;default:return j2+I}}o(iu,"resolveIRI");function ay(I){if(I){var C=I[0];if(C==="?"||C==="$")return Ne.factory.variable(I.substr(1))}return I}o(ay,"toVar");function xr(I,C){return{type:"operation",operator:I,args:C||[]}}o(xr,"operation");function sc(I,C){var O={expression:I==="*"?new Ed:I};if(C)for(var N in C)O[N]=C[N];return O}o(sc,"expression");function ac(I,C){return{type:"path",pathType:I,items:C}}o(ac,"path");function oy(I,C){for(var O=0,N=C.length,re;O<N&&(re=C[O]);O++)I=xr(re[0],[I,re[1]]);return I}o(oy,"createOperationTree");function no(I,C){var O=[],N=[],re=I.length,Pe,g={};if(!re)return null;for(var en=0;en<re&&(Pe=I[en]);en++)(Pe.named?N:O).push(Pe.iri);return g[C||"from"]={default:O,named:N},g}o(no,"groupDatasets");function oc(I){return parseInt(I,10)}o(oc,"toInt");function cy(I){return I.type==="group"&&I.patterns.length===1?I.patterns[0]:I}o(cy,"degroupSingle");function zi(I,C){return C&&C.termType!=="NamedNode"&&(C=Ne.factory.namedNode(C)),Ne.factory.literal(I,C)}o(zi,"createTypedLiteral");function uD(I,C){return Ne.factory.literal(I,C)}o(uD,"createLangLiteral");function ly(I,C,O){if(!("termType"in C))throw new Error("Nested triples cannot contain paths");return Ne.factory.quad(I,C,O)}o(ly,"nestedTriple");function xs(I,C,O,N){var re={};return I!=null&&(re.subject=I),C!=null&&(re.predicate=C),O!=null&&(re.object=O),N!=null&&(re.annotations=N),re}o(xs,"triple");function su(I){return typeof I=="string"?I.startsWith("e_")?Ne.factory.blankNode(I):Ne.factory.blankNode("e_"+I):Ne.factory.blankNode("g_"+B2++)}o(su,"blank");var B2=0;Ne._resetBlanks=function(){B2=0};var fD=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,dD={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
|
|
36
36
|
`,r:"\r",f:"\f"},hD=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,uy=String.fromCharCode;function V2(I,C){I=I.substring(C,I.length-C);try{I=I.replace(fD,function(O,N,re,Pe){var g;if(N){if(g=parseInt(N,16),isNaN(g))throw new Error;return uy(g)}else if(re){if(g=parseInt(re,16),isNaN(g))throw new Error;return g<65535?uy(g):uy(55296+((g-=65536)>>10),56320+(g&1023))}else{var en=dD[Pe];if(!en)throw new Error;return en}})}catch{return""}if(hD.exec(I))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+I);return I}o(V2,"unescapeString");function pD(I){var C=su(),O=C,N=[],re,Pe=[];I.forEach(function(Hi){N.push(Hi.entity),ro(Pe,Hi.triples)});for(var g=0,en=0,y=N.length,re=Array(y*2);g<y;)re[en++]=xs(O,Ne.factory.namedNode(oD),N[g]),re[en++]=xs(O,Ne.factory.namedNode(cD),O=++g<y?su():Ne.factory.namedNode(N2));return{entity:C,triples:ro(re,Pe)}}o(pD,"createList");function mD(I){var C=su();return{entity:C,triples:I.map(function(O){return Vt(xs(C),O)})}}o(mD,"createAnonymousObject");function fy(I,C,O){var N=[],re=[];return C.forEach(function(Pe){let g=null;Pe.annotation&&(g=Pe.annotation,Pe=Pe.object),N.push(xs(null,I,Pe.entity,g)),ro(re,Pe.triples)}),Gi(N,O||[],re)}o(fy,"objectListToTriples");function EY(I){for(var C=[],O,N=0,re;re=I[N];N++)switch(re.type){case"bgp":re.triples.length&&(O?ro(O.triples,re.triples):As(C,O=re));break;default:(!re.patterns||re.patterns.length>0)&&(As(C,re),O=null)}return C}o(EY,"mergeAdjacentBGPs");function cc(I){return I.variable?I.variable.value:I.value||I.expression.value}o(cc,"getExpressionId");function dy(I){if(!I)return[];if(I.type==="aggregate")return[I];if(I.type==="operation"){let C=[];for(let O of I.args)C.push(...dy(O));return C}return[]}o(dy,"getAggregatesOfExpression");function gD(I){let C=new Set,O=o(function(N){N&&(N.termType==="Variable"?C.add(N):N.type==="operation"&&N.args.forEach(O))},"visitExpression");return O(I),C}o(gD,"getVariablesFromExpression");function hy(I,C=1,O=[]){for(let N of I)C>0&&N instanceof Array?hy(N,C-1,O):O.push(N);return O}o(hy,"flatten");function py(I){return I.termType==="Variable"}o(py,"isVariable");function U2(I){if(I.triples){let C=[];for(let O of I.triples)py(O.subject)&&C.push(O.subject.value),py(O.predicate)&&C.push(O.predicate.value),py(O.object)&&C.push(O.object.value);return C}else if(I.patterns){let C=[];for(let O of I.patterns)C.push(...U2(O));return C}return[]}o(U2,"getBoundVarsFromGroupGraphPattern");function yD(I){let C=I.slice().sort(),O=[];for(let N=0;N<C.length-1;N++)C[N+1]==C[N]&&O.push(C[N]);return O}o(yD,"getDuplicatesInArray");function au(I){if(!Ne.sparqlStar)throw new Error("SPARQL-star support is not enabled");return I}o(au,"ensureSparqlStar");function q2(I,C,O){for(let N of C){let re=xs("subject"in N?N.subject:I,N.predicate,N.object);O.push(re),N.annotations&&q2(ly(I,N.predicate,N.object),N.annotations,O)}}o(q2,"_applyAnnotations");function my(I){if(Ne.sparqlStar){let C=[];return I.forEach(O=>{let N=xs(O.subject,O.predicate,O.object);C.push(N),O.annotations&&q2(ly(O.subject,O.predicate,O.object),O.annotations,C)}),C}return I}o(my,"applyAnnotations");function TY(I){if(!Ne.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return I}o(TY,"ensureSparqlStarNestedQuads");function W2(I){for(let C of I){if(C.type==="graph"&&C.name.termType==="Variable")throw new Error("Detected illegal variable in GRAPH");if(C.type==="bgp"||C.type==="graph"){for(let O of C.triples)if(O.subject.termType==="Variable"||O.predicate.termType==="Variable"||O.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return I}o(W2,"ensureNoVariables");function gy(I){for(let C of I)if(C.type==="bgp"){for(let O of C.triples)if(O.subject.termType==="BlankNode"||O.predicate.termType==="BlankNode"||O.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return I}o(gy,"ensureNoBnodes");var _D=(function(){var I={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(C,O){return this.yy=O||this.yy||{},this._input=C,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 C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var O=C.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),C},"input"),unput:o(function(C){var O=C.length,N=C.split(/(?:\r\n?|\n)/g);this._input=C+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 Pe=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=[Pe[0],Pe[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(C){this.unput(this.match.slice(C))},"less"),pastInput:o(function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var C=this.pastInput(),O=new Array(C.length+1).join("-");return C+this.upcomingInput()+`
|
|
38
38
|
`+O+"^"},"showPosition"),test_match:o(function(C,O){var N,re,Pe;if(this.options.backtrack_lexer&&(Pe={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&&(Pe.yylloc.range=this.yylloc.range.slice(0))),re=C[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+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,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(C[0].length),this.matched+=C[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 Pe)this[g]=Pe[g];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,O,N,re;this._more||(this.yytext="",this.match="");for(var Pe=this._currentRules(),g=0;g<Pe.length;g++)if(N=this._input.match(this.rules[Pe[g]]),N&&(!O||N[0].length>O[0].length)){if(O=N,re=g,this.options.backtrack_lexer){if(C=this.test_match(N,Pe[g]),C!==!1)return C;if(this._backtrack){O=!1;continue}else return!1}else if(!this.options.flex)break}return O?(C=this.test_match(O,Pe[re]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
@@ -45,7 +45,7 @@ Expecting `+Od.join(", ")+", got '"+(this.terminals_[ut]||ut)+"'":_y="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 vc(`Unclosed IRI in PREFIX* declaration at position ${a}`)}else throw new vc(`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,"")}};_a.PrefixStarTransformer=w_;var vc=class extends Error{static{o(this,"PrefixStarTransformerError")}constructor(e){super(`PREFIX* transformation error: ${e}`),this.name="PrefixStarTransformerError"}};_a.PrefixStarTransformerError=vc});var E_=S(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.DescribeOptionsTransformer=Ec.DescribeOptionsTransformerError=void 0;var Mh=class extends Error{static{o(this,"DescribeOptionsTransformerError")}constructor(e){super(e),this.name="DescribeOptionsTransformerError"}};Ec.DescribeOptionsTransformerError=Mh;var wc=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 Mh(`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}};Ec.DescribeOptionsTransformer=wc;wc.DEPTH_PATTERN=/\bDEPTH\s+(\d+)/gi;wc.SYMMETRIC_PATTERN=/\bSYMMETRIC\b/gi;wc.DESCRIBE_QUERY_PATTERN=/\bDESCRIBE\b/i});var GT=S(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.DirectionalLangTagTransformerError=Tc.DirectionalLangTagTransformer=void 0;var jh=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()}};Tc.DirectionalLangTagTransformer=jh;jh.DIRECTIONAL_TAG_REGEX=/(["'])((?:[^\\]|\\.)*?)\1@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)--(ltr|rtl)/g;var T_=class extends Error{static{o(this,"DirectionalLangTagTransformerError")}constructor(e){super(`Directional language tag transformation error: ${e}`),this.name="DirectionalLangTagTransformerError"}};Tc.DirectionalLangTagTransformerError=T_});var zT=S(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.TripleTermTransformerError=xc.TripleTermTransformer=void 0;var A_=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 Ac("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 Ac(`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 Ac(`Invalid triple term syntax: ${e.substring(0,50)}...`);return`<< ${t[1]} >>`}};xc.TripleTermTransformer=A_;var Ac=class extends Error{static{o(this,"TripleTermTransformerError")}constructor(e){super(`Triple term transformation error: ${e}`),this.name="TripleTermTransformerError"}};xc.TripleTermTransformerError=Ac});var C_=S($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.VaultPrefixTransformer=void 0;var CM=/PREFIX\s+(\w+)\s*:/gi,IM=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"]),x_=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())&&!IM.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(CM.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}};$h.VaultPrefixTransformer=x_});var Fu=S(vn=>{"use strict";var RM=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]})),OM=vn&&vn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),PM=vn&&vn.__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"&&RM(t,e,r[i]);return OM(t,e),t}})();Object.defineProperty(vn,"__esModule",{value:!0});vn.SPARQLParser=vn.ExoQLParser=vn.SPARQLParseError=void 0;var HT=PM(qT()),I_=b_(),R_=v_(),QT=WT(),O_=E_(),FM=GT(),P_=zT(),DM=C_(),rr=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}};vn.SPARQLParseError=rr;var Bh=class{static{o(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new HT.Parser({sparqlStar:!0}),this.generator=new HT.Generator({sparqlStar:!0}),this.caseWhenTransformer=new I_.CaseWhenTransformer,this.lateralTransformer=new R_.LateralTransformer,this.prefixStarTransformer=new QT.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new O_.DescribeOptionsTransformer,this.directionalLangTagTransformer=new FM.DirectionalLangTagTransformer,this.tripleTermTransformer=new P_.TripleTermTransformer,this.vaultPrefixTransformer=new DM.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 O_.DescribeOptionsTransformerError)throw new rr(t.message);if(t instanceof R_.LateralTransformerError)throw new rr(t.message);if(t instanceof I_.CaseWhenTransformerError)throw new rr(t.message);if(t instanceof P_.TripleTermTransformerError)throw new rr(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 rr(`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 O_.DescribeOptionsTransformerError)throw new rr(t.message);if(t instanceof QT.PrefixStarTransformerError)throw new rr(t.message);if(t instanceof R_.LateralTransformerError)throw new rr(t.message);if(t instanceof I_.CaseWhenTransformerError)throw new rr(t.message);if(t instanceof P_.TripleTermTransformerError)throw new rr(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 rr(`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 rr(`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 rr("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 rr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new rr(`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 rr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};vn.ExoQLParser=Bh;vn.SPARQLParser=Bh});var _o=S(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.AlgebraTranslatorError=void 0;var F_=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};Vh.AlgebraTranslatorError=F_});var Uh=S(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.isVariableExpression=NM;Zi.isVariableTerm=LM;Zi.isNamedNode=kM;Zi.isLiteral=MM;Zi.isPropertyPath=jM;Zi.isAggregateExpression=$M;Zi.isOperationExpression=BM;Zi.isFunctionCallExpression=VM;function NM(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}o(NM,"isVariableExpression");function LM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}o(LM,"isVariableTerm");function kM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}o(kM,"isNamedNode");function MM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}o(MM,"isLiteral");function jM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}o(jM,"isPropertyPath");function $M(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}o($M,"isAggregateExpression");function BM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}o(BM,"isOperationExpression");function VM(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}o(VM,"isFunctionCallExpression")});var YT=S(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.TripleTranslator=void 0;var sn=_o(),D_=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 sn.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 sn.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 sn.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new sn.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 sn.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new sn.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new sn.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new sn.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new sn.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 sn.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new sn.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 sn.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new sn.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 sn.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 sn.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};qh.TripleTranslator=D_});var KT=S(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.ExpressionTranslator=void 0;var Cc=_o(),N_=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 Cc.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 Cc.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new Cc.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 Cc.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 Cc.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 Cc.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"}}};Wh.ExpressionTranslator=N_});var ZT=S(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.PatternTranslator=void 0;var XT=v_(),Or=_o(),JT=Uh(),L_=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 Or.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 Or.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 Or.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Or.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 Or.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 Or.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 Or.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 Or.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 Or.AlgebraTranslatorError(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Or.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 Or.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 Or.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Or.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 Or.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Or.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 Or.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 Or.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,JT.isVariableTerm)(i)&&i.value===XT.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,JT.isVariableTerm)(i)&&i.value===XT.LateralTransformer.LATERAL_MARKER))}}};Gh.PatternTranslator=L_});var t3=S(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.AggregateTranslator=void 0;var e3=_o(),UM=Uh(),k_=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,UM.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 e3.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 e3.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)}}}};zh.AggregateTranslator=k_});var Du=S(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.AlgebraTranslator=Sa.ExoQLAlgebraTranslator=Sa.AlgebraTranslatorError=void 0;var Hh=_o(),Qh=Uh(),qM=YT(),WM=KT(),GM=ZT(),zM=t3(),HM=_o();Object.defineProperty(Sa,"AlgebraTranslatorError",{enumerable:!0,get:o(function(){return HM.AlgebraTranslatorError},"get")});var Yh=class{static{o(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new qM.TripleTranslator,this.expressionTranslator=new WM.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 GM.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 zM.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 Hh.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 Hh.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new Hh.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,Qh.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,Qh.isVariableTerm)(u)||(0,Qh.isVariableExpression)(u)).map(u=>(0,Qh.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 Hh.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}}};Sa.ExoQLAlgebraTranslator=Yh;Sa.AlgebraTranslator=Yh});var es=S(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.SolutionMapping=void 0;var r3=He(),n3=xe(),i3=qt(),M_=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 r3.Literal&&t instanceof r3.Literal?e.equals(t):e instanceof n3.IRI&&t instanceof n3.IRI?e.value===t.value:e instanceof i3.BlankNode&&t instanceof i3.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}};Kh.SolutionMapping=M_});var a3=S(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.PropertyPathExecutor=Ic.PropertyPathExecutorError=void 0;var QM=es(),Xh=xe(),s3=qt(),Nu=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Ic.PropertyPathExecutorError=Nu;var j_=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){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 QM.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 Nu("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 Xh.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{node:c,depth:l}=a.shift();if(l>=this.MAX_DEPTH)continue;let u=await this.evaluatePathItem(c,t,null);for(let f of u){let d=this.nodeToKey(f);(r===null||this.nodeInSet(f,r))&&s.add(f),i.has(d)||(i.add(d),a.push({node:f,depth:l+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 Xh.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(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"|":return{type:"path",pathType:"|",items:e.items.map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};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 Xh.IRI(e.value));break;case"blank":t.add(new s3.BlankNode(e.value));break;default:throw new Nu(`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 Xh.IRI)return{type:"iri",value:r.value};if(r instanceof s3.BlankNode)return{type:"blank",value:r.id}}}return e}isVariable(e){return e.type==="variable"}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_=S(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.BGPExecutor=Rc.BGPExecutorError=void 0;var Jh=es(),ba=xe(),$_=He(),Zh=qt(),ep=pu(),YM=a3(),Vr=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Rc.BGPExecutorError=Vr;var B_=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new YM.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new Jh.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 Jh.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 Vr("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(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 Vr("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 Jh.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)){yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(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 Jh.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 ep.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 ba.IRI&&e.value===t.value;case"literal":return!(!(t instanceof $_.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof Zh.BlankNode&&e.value===t.id;case"quoted":return t instanceof ep.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 ba.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"}toRDFTermAsSubject(e){switch(e.type){case"iri":return new ba.IRI(e.value);case"blank":return new Zh.BlankNode(e.value);case"literal":throw new Vr("Literals cannot appear in subject position");case"variable":throw new Vr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Vr(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new ba.IRI(e.predicate.value):(()=>{throw new Vr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new ep.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new ba.IRI(e.value);case"literal":throw new Vr("Literals cannot appear in predicate position");case"blank":throw new Vr("Blank nodes cannot appear in predicate position");case"variable":throw new Vr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new Vr(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new ba.IRI(e.value);case"literal":return new $_.Literal(e.value,e.datatype?new ba.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new Zh.BlankNode(e.value);case"variable":throw new Vr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Vr(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof ba.IRI)return{type:"iri",value:e.value};if(e instanceof $_.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof Zh.BlankNode)return{type:"blank",value:e.id};if(e instanceof ep.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new Vr(`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)}}};Rc.BGPExecutor=B_});var o3=S(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});tp.StringFunctions=void 0;var Oc=xe(),va=He(),U_=qt(),Lu=class n{static{o(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Oc.IRI||e instanceof va.Literal?e.value:e instanceof U_.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof va.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof va.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 va.Literal)r=e.value;else if(e instanceof Oc.IRI)r=e.value;else if(e instanceof U_.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 va.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Oc.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 va.Literal(s,new Oc.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 va.Literal)t=e.value;else if(e instanceof Oc.IRI)t=e.value;else if(e instanceof U_.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 va.Literal(r,new Oc.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}};tp.StringFunctions=Lu;Lu.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Lu.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 c3=S(rp=>{"use strict";Object.defineProperty(rp,"__esModule",{value:!0});rp.MathFunctions=void 0;var q_=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()}};rp.MathFunctions=q_});var ip=S(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.DateTimeParsing=void 0;var KM=xe(),XM=He(),W_=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 XM.Literal(e,new KM.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),_=parseInt(d[3],10),b=h*(p*60+_)*60*1e3;f-=b}}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 _=d.match(/^(\d+(?:\.\d+)?)S$/);if(_&&(c=parseFloat(_[1]),d=d.substring(_[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}};np.DateTimeParsing=W_});var l3=S(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.DateTimeArithmetic=void 0;var an=xe(),Ee=He(),Xe=ip(),G_=class{static{o(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.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=Xe.DateTimeParsing.formatDayTimeDuration(c);return new Ee.Literal(l,new an.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new Ee.Literal(l.toISOString(),new an.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new Ee.Literal(l.toISOString(),new an.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=Xe.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 Ee.Literal(h,new an.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=Xe.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 Ee.Literal(h,new an.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new Ee.Literal(s.toISOString(),new an.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new Ee.Literal(s.toISOString(),new an.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=Xe.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 Ee.Literal(d,new an.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=Xe.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 Ee.Literal(d,new an.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s+a);return new Ee.Literal(c,new an.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s-a);return new Ee.Literal(c,new an.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof Ee.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i*t);return new Ee.Literal(s,new an.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 Ee.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i/t);return new Ee.Literal(s,new an.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s+a);return new Ee.Literal(c,new an.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s-a);return new Ee.Literal(c,new an.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Ee.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Ee.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Ee.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Ee.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/1e3}};sp.DateTimeArithmetic=G_});var u3=S(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.DateTimeAccessors=void 0;var ku=xe(),Lt=He(),Tt=ip(),z_=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 Lt.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 Lt.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 Lt.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 Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof Lt.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 Lt.Literal(r,new ku.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 Lt.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let ve=i.getUTCFullYear(),z=String(i.getUTCMonth()+1).padStart(2,"0"),G=String(i.getUTCDate()).padStart(2,"0"),F=String(i.getUTCHours()).padStart(2,"0"),j=String(i.getUTCMinutes()).padStart(2,"0"),ee=String(i.getUTCSeconds()).padStart(2,"0"),Ye=i.getUTCMilliseconds(),st=`${ve}-${z}-${G}T${F}:${j}:${ee}`;return Ye>0&&(st+=`.${String(Ye).padStart(3,"0")}`),new Lt.Literal(st,new ku.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof Lt.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"),_=String(u.getUTCMinutes()).padStart(2,"0"),b=String(u.getUTCSeconds()).padStart(2,"0"),E=u.getUTCMilliseconds(),v=a>=0?"+":"-",A=Math.floor(Math.abs(a)/(3600*1e3)),R=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),B=`${v}${String(A).padStart(2,"0")}:${String(R).padStart(2,"0")}`,W=`${f}-${d}-${h}T${p}:${_}:${b}`;return E>0&&(W+=`.${String(E).padStart(3,"0")}`),W+=B,new Lt.Literal(W,new ku.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 Lt.Literal?e.value:e,s=t instanceof Lt.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 Lt.Literal?e.value:e,i=t instanceof Lt.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 Lt.Literal(l,new ku.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof Lt.Literal?e.value:e,i=t instanceof Lt.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 Lt.Literal(u,new ku.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};ap.DateTimeAccessors=z_});var Q_=S(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.DateTimeFunctions=void 0;var Pc=ip(),nr=l3(),mt=u3(),H_=class{static{o(this,"DateTimeFunctions")}static parseDate(e){return Pc.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Pc.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Pc.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Pc.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Pc.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Pc.DateTimeParsing.formatYearMonthDuration(e)}static year(e){return mt.DateTimeAccessors.year(e)}static month(e){return mt.DateTimeAccessors.month(e)}static day(e){return mt.DateTimeAccessors.day(e)}static hours(e){return mt.DateTimeAccessors.hours(e)}static minutes(e){return mt.DateTimeAccessors.minutes(e)}static seconds(e){return mt.DateTimeAccessors.seconds(e)}static durationDays(e){return mt.DateTimeAccessors.durationDays(e)}static durationHours(e){return mt.DateTimeAccessors.durationHours(e)}static durationMinutes(e){return mt.DateTimeAccessors.durationMinutes(e)}static durationSeconds(e){return mt.DateTimeAccessors.durationSeconds(e)}static durationYears(e){return mt.DateTimeAccessors.durationYears(e)}static durationMonths(e){return mt.DateTimeAccessors.durationMonths(e)}static timezone(e){return mt.DateTimeAccessors.timezone(e)}static tz(e){return mt.DateTimeAccessors.tz(e)}static adjust(e,t){return mt.DateTimeAccessors.adjust(e,t)}static now(){return mt.DateTimeAccessors.now()}static dateBefore(e,t){return mt.DateTimeAccessors.dateBefore(e,t)}static dateAfter(e,t){return mt.DateTimeAccessors.dateAfter(e,t)}static dateInRange(e,t,r){return mt.DateTimeAccessors.dateInRange(e,t,r)}static compareDurations(e,t,r){return mt.DateTimeAccessors.compareDurations(e,t,r)}static dateDiffMinutes(e,t){return mt.DateTimeAccessors.dateDiffMinutes(e,t)}static dateDiffHours(e,t){return mt.DateTimeAccessors.dateDiffHours(e,t)}static timeDiff(e,t){return mt.DateTimeAccessors.timeDiff(e,t)}static dateDiff(e,t){return mt.DateTimeAccessors.dateDiff(e,t)}static isDayTimeDuration(e){return mt.DateTimeAccessors.isDayTimeDuration(e)}static isDate(e){return mt.DateTimeAccessors.isDate(e)}static isYearMonthDuration(e){return mt.DateTimeAccessors.isYearMonthDuration(e)}static isTime(e){return mt.DateTimeAccessors.isTime(e)}static dateTimeDiff(e,t){return nr.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return nr.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return nr.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return nr.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return nr.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return nr.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return nr.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return nr.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return nr.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return nr.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return nr.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return nr.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return nr.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return nr.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return nr.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return nr.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return nr.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return nr.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return nr.DateTimeArithmetic.durationToSeconds(e)}};op.DateTimeFunctions=H_});var f3=S(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.LogicalFunctions=void 0;var JM=xe(),Fc=He(),ZM=qt(),cp=Q_(),Y_=class n{static{o(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return cp.DateTimeFunctions.compareDurations(e instanceof Fc.Literal?e:String(e),t instanceof Fc.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return cp.DateTimeFunctions.compareDurations(e instanceof Fc.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return cp.DateTimeFunctions.compareDurations(e,t instanceof Fc.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 Fc.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 Fc.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 cp.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof JM.IRI?e.value:e instanceof ZM.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}};lp.LogicalFunctions=Y_});var d3=S(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});up.RDFTermFunctions=void 0;var Pr=xe(),bt=He(),si=qt(),Dc=pu(),K_=_n(),X_=class n{static{o(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof bt.Literal)return e.datatype?e.datatype:e.language?new Pr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Pr.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 Pr.IRI}static isBlank(e){return e===void 0?!1:e instanceof si.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof bt.Literal}static isTriple(e){return e===void 0?!1:e instanceof Dc.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof bt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof bt.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 bt.Literal(t.toISOString(),new Pr.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 bt.Literal(String(t),new Pr.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 bt.Literal(String(t),new Pr.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 Pr.IRI&&t instanceof Pr.IRI)return e.value===t.value;if(e instanceof si.BlankNode&&t instanceof si.BlankNode)return e.id===t.id;if(e instanceof bt.Literal&&t instanceof bt.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 Pr.IRI)return e;if(e instanceof bt.Literal)return new Pr.IRI(e.value);throw e instanceof si.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,K_.v4)().replace(/-/g,"").substring(0,12)}`;return new si.BlankNode(t)}if(e instanceof bt.Literal)return new si.BlankNode(e.value);if(e instanceof si.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 bt.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 Pr.IRI)i=t;else if(t instanceof bt.Literal)i=new Pr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new bt.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 bt.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 bt.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 bt.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 bt.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 bt.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 bt.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 bt.Literal(i,void 0,s,a)}static uuid(){let e=(0,K_.v4)();return new Pr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,K_.v4)();return new bt.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 bt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Pr.IRI)){let c=t instanceof bt.Literal?"Literal":t instanceof si.BlankNode?"BlankNode":t instanceof Dc.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new Dc.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof Dc.QuotedTriple)){let t=e instanceof Pr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof si.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 Dc.QuotedTriple)){let t=e instanceof Pr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof si.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 Dc.QuotedTriple)){let t=e instanceof Pr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof si.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};up.RDFTermFunctions=X_});var h3=S(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});fp.HashFunctions=void 0;var J_=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")}};fp.HashFunctions=J_});var hp=S(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});dp.BuiltInFunctions=void 0;var ir=o3(),wa=c3(),ae=Q_(),Nc=f3(),Ot=d3(),Mu=h3(),Z_=class{static{o(this,"BuiltInFunctions")}static str(...e){return ir.StringFunctions.str(...e)}static lang(...e){return ir.StringFunctions.lang(...e)}static langdir(...e){return ir.StringFunctions.langdir(...e)}static langMatches(...e){return ir.StringFunctions.langMatches(...e)}static regex(...e){return ir.StringFunctions.regex(...e)}static contains(...e){return ir.StringFunctions.contains(...e)}static strStarts(...e){return ir.StringFunctions.strStarts(...e)}static strEnds(...e){return ir.StringFunctions.strEnds(...e)}static strlen(...e){return ir.StringFunctions.strlen(...e)}static ucase(...e){return ir.StringFunctions.ucase(...e)}static lcase(...e){return ir.StringFunctions.lcase(...e)}static substr(...e){return ir.StringFunctions.substr(...e)}static strBefore(...e){return ir.StringFunctions.strBefore(...e)}static strAfter(...e){return ir.StringFunctions.strAfter(...e)}static concat(...e){return ir.StringFunctions.concat(...e)}static replace(...e){return ir.StringFunctions.replace(...e)}static encodeForUri(...e){return ir.StringFunctions.encodeForUri(...e)}static normalize(...e){return ir.StringFunctions.normalize(...e)}static fold(...e){return ir.StringFunctions.fold(...e)}static abs(...e){return wa.MathFunctions.abs(...e)}static round(...e){return wa.MathFunctions.round(...e)}static ceil(...e){return wa.MathFunctions.ceil(...e)}static floor(...e){return wa.MathFunctions.floor(...e)}static rand(){return wa.MathFunctions.rand()}static msToMinutes(...e){return wa.MathFunctions.msToMinutes(...e)}static msToHours(...e){return wa.MathFunctions.msToHours(...e)}static msToSeconds(...e){return wa.MathFunctions.msToSeconds(...e)}static parseDate(...e){return ae.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return ae.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return ae.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return ae.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return ae.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return ae.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return ae.DateTimeFunctions.year(...e)}static month(...e){return ae.DateTimeFunctions.month(...e)}static day(...e){return ae.DateTimeFunctions.day(...e)}static hours(...e){return ae.DateTimeFunctions.hours(...e)}static minutes(...e){return ae.DateTimeFunctions.minutes(...e)}static seconds(...e){return ae.DateTimeFunctions.seconds(...e)}static timezone(...e){return ae.DateTimeFunctions.timezone(...e)}static tz(...e){return ae.DateTimeFunctions.tz(...e)}static now(){return ae.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return ae.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return ae.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return ae.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return ae.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return ae.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return ae.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return ae.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return ae.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return ae.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return ae.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return ae.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return ae.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return ae.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return ae.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return ae.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return ae.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return ae.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return ae.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return ae.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return ae.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return ae.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return ae.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return ae.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return ae.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return ae.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return ae.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return ae.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return ae.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return ae.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return ae.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return ae.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return ae.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return ae.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return ae.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return ae.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return ae.DateTimeFunctions.adjust(...e)}static isTime(...e){return ae.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return ae.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Nc.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Nc.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Nc.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Nc.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Nc.LogicalFunctions.coalesce(...e)}static if(...e){return Nc.LogicalFunctions.if(...e)}static datatype(...e){return Ot.RDFTermFunctions.datatype(...e)}static bound(...e){return Ot.RDFTermFunctions.bound(...e)}static isIRI(...e){return Ot.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return Ot.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return Ot.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return Ot.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return Ot.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return Ot.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return Ot.RDFTermFunctions.sameTerm(...e)}static iri(...e){return Ot.RDFTermFunctions.iri(...e)}static uri(...e){return Ot.RDFTermFunctions.uri(...e)}static bnode(...e){return Ot.RDFTermFunctions.bnode(...e)}static strdt(...e){return Ot.RDFTermFunctions.strdt(...e)}static strlang(...e){return Ot.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return Ot.RDFTermFunctions.strlangdir(...e)}static uuid(){return Ot.RDFTermFunctions.uuid()}static struuid(){return Ot.RDFTermFunctions.struuid()}static xsdDateTime(...e){return Ot.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return Ot.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return Ot.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return Ot.RDFTermFunctions.triple(...e)}static subject(...e){return Ot.RDFTermFunctions.subject(...e)}static predicate(...e){return Ot.RDFTermFunctions.predicate(...e)}static object(...e){return Ot.RDFTermFunctions.object(...e)}static md5(...e){return Mu.HashFunctions.md5(...e)}static sha1(...e){return Mu.HashFunctions.sha1(...e)}static sha256(...e){return Mu.HashFunctions.sha256(...e)}static sha384(...e){return Mu.HashFunctions.sha384(...e)}static sha512(...e){return Mu.HashFunctions.sha512(...e)}};dp.BuiltInFunctions=Z_});var w3=S(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var k=hp();M.functionHandlers=new Map;M.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.str(t)});M.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.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 k.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 k.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 k.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 k.BuiltInFunctions.strEnds(t,r)});M.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.strlen(t)});M.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.ucase(t)});M.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.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 k.BuiltInFunctions.substr(t,r,i)}return k.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 k.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 k.BuiltInFunctions.strAfter(t,r)});M.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return k.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 k.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 k.BuiltInFunctions.regex(t,r,i)});M.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.encodeForUri(t)});M.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.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 k.BuiltInFunctions.bound(r)}return!0});var p3=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",p3);M.functionHandlers.set("isuri",p3);M.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isBlank(t)});M.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isLiteral(t)});M.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isNumeric(t)});M.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.hasLangdir(t)});M.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.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 k.BuiltInFunctions.sameTerm(t,r)});M.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.abs(t)});M.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.round(t)});M.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.ceil(t)});M.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.floor(t)});M.functionHandlers.set("rand",()=>k.BuiltInFunctions.rand());M.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.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 k.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 k.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 k.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 k.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 k.BuiltInFunctions.dateDiffHours(t,r)});var Lc=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"),m3=Lc(k.BuiltInFunctions.year.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationYears.bind(k.BuiltInFunctions),null);M.functionHandlers.set("year",m3);M.functionHandlers.set("years",m3);var g3=Lc(k.BuiltInFunctions.month.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationMonths.bind(k.BuiltInFunctions),null);M.functionHandlers.set("month",g3);M.functionHandlers.set("months",g3);var y3=Lc(k.BuiltInFunctions.day.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationDays.bind(k.BuiltInFunctions));M.functionHandlers.set("day",y3);M.functionHandlers.set("days",y3);M.functionHandlers.set("hours",Lc(k.BuiltInFunctions.hours.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationHours.bind(k.BuiltInFunctions)));M.functionHandlers.set("minutes",Lc(k.BuiltInFunctions.minutes.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationMinutes.bind(k.BuiltInFunctions)));M.functionHandlers.set("seconds",Lc(k.BuiltInFunctions.seconds.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationSeconds.bind(k.BuiltInFunctions)));M.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.timezone(t)});M.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.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 k.BuiltInFunctions.adjust(t,r)});M.functionHandlers.set("now",()=>k.BuiltInFunctions.now());var _3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",_3);M.functionHandlers.set("xsd:datetime",_3);var S3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",S3);M.functionHandlers.set("xsd:integer",S3);var b3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",b3);M.functionHandlers.set("xsd:decimal",b3);var v3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",v3);M.functionHandlers.set("xsd:daytimeduration",v3);M.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToDays(t)});M.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToHours(t)});M.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToMinutes(t)});M.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToSeconds(t)});M.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationDays(t)});M.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationHours(t)});M.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationMinutes(t)});M.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationSeconds(t)});M.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationYears(t)});M.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.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 k.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 k.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 k.BuiltInFunctions.dateTimeSubtract(t,r)});M.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToMinutes(t)});M.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToHours(t)});M.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToSeconds(t)});M.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.md5(t)});M.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha1(t)});M.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha256(t)});M.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha384(t)});M.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha512(t)});M.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.subject(t)});M.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.predicate(t)});M.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.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 k.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"))})});var pp=S(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.FilterExecutor=kc.FilterExecutorError=void 0;var gt=hp(),ej=w3(),tj=xe(),Ea=He(),dr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};kc.FilterExecutorError=dr;var e1=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":return r.value;case"NamedNode":return r.value;default:throw new dr(`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":return e.value;case"in":return this.evaluateIn(e,t);case"exists":throw new dr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new dr(`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 gt.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 dr("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 gt.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 gt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return gt.BuiltInFunctions.logicalOr(r);throw new dr(`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(gt.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 dr("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"&&e!==null&&"termType"in e?e:e instanceof tj.IRI||e instanceof Ea.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 gt.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return gt.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return gt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return gt.BuiltInFunctions.logicalOr(r);throw new dr(`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 gt.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 gt.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return gt.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return gt.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return gt.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return gt.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new dr("Division by zero");return gt.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return gt.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 dr("Division by zero");return s/a;default:throw new dr(`Unknown arithmetic operator: ${String(e.operator)}`)}}isDayTimeDurationValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof Ea.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 dr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof Ea.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 Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof Ea.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=ej.functionHandlers.get(i);if(!a)throw new dr(`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 dr(`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 dr("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 Ea.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 dr("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)}};kc.FilterExecutor=e1});var r1=S(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});mp.OptionalExecutor=void 0;var t1=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)}}};mp.OptionalExecutor=t1});var i1=S(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.UnionExecutor=void 0;var n1=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("|")}};gp.UnionExecutor=n1});var E3=S(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});yp.MinusExecutor=void 0;var s1=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}};yp.MinusExecutor=s1});var A3=S(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.ValuesExecutor=Mc.ValuesExecutorError=void 0;var rj=es(),T3=xe(),nj=He(),_p=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Mc.ValuesExecutorError=_p;var a1=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 rj.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 T3.IRI(e.value);if(e.type==="literal")return new nj.Literal(e.value,e.datatype?new T3.IRI(e.datatype):void 0,e.language,e.direction);throw new _p(`Unknown term type: ${e.type}`)}};Mc.ValuesExecutor=a1});var o1=S($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.CustomAggregateRegistry=$c.CustomAggregateError=void 0;var jc=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};$c.CustomAggregateError=jc;var Sp=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}};$c.CustomAggregateRegistry=Sp;Sp.instance=null});var c1=S(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.BUILT_IN_AGGREGATES=Je.modeAggregate=Je.stddevAggregate=Je.varianceAggregate=Je.medianAggregate=Je.EXO_AGGREGATE_NS=void 0;Je.getNumericValue=bp;Je.createDecimalLiteral=ai;Je.createDoubleLiteral=aj;Je.createPercentileAggregate=So;var bo=He(),Bc=xe(),ij=new Bc.IRI("http://www.w3.org/2001/XMLSchema#decimal"),sj=new Bc.IRI("http://www.w3.org/2001/XMLSchema#double");Je.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function bp(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof bo.Literal?parseFloat(n.value):n instanceof Bc.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(bp,"getNumericValue");function ai(n){return new bo.Literal(String(n),ij)}o(ai,"createDecimalLiteral");function aj(n){return new bo.Literal(String(n),sj)}o(aj,"createDoubleLiteral");Je.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=bp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ai(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 ai(s)}};Je.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=bp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ai(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 ai(i)}};Je.stddevAggregate={init(){return{values:[]}},step(n,e){Je.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ai(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 ai(Math.sqrt(i))}};Je.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof bo.Literal||e instanceof Bc.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 bo.Literal(" ",new Bc.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 bo.Literal)return i;let s=parseFloat(t);return isNaN(s)?new bo.Literal(t,new Bc.IRI("http://www.w3.org/2001/XMLSchema#string")):ai(s)}};function So(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=bp(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return ai(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 ai(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return ai(f)}}}o(So,"createPercentileAggregate");Je.BUILT_IN_AGGREGATES={[`${Je.EXO_AGGREGATE_NS}median`]:Je.medianAggregate,[`${Je.EXO_AGGREGATE_NS}variance`]:Je.varianceAggregate,[`${Je.EXO_AGGREGATE_NS}stddev`]:Je.stddevAggregate,[`${Je.EXO_AGGREGATE_NS}mode`]:Je.modeAggregate,[`${Je.EXO_AGGREGATE_NS}percentile25`]:So(25),[`${Je.EXO_AGGREGATE_NS}percentile50`]:So(50),[`${Je.EXO_AGGREGATE_NS}percentile75`]:So(75),[`${Je.EXO_AGGREGATE_NS}percentile90`]:So(90),[`${Je.EXO_AGGREGATE_NS}percentile95`]:So(95),[`${Je.EXO_AGGREGATE_NS}percentile99`]:So(99)}});var I3=S(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.AggregateExecutor=Vc.AggregateExecutorError=void 0;var sr=He(),u1=xe(),oj=pp(),cj=o1(),lj=c1(),x3=new u1.IRI("http://www.w3.org/2001/XMLSchema#integer"),vo=new u1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),ts=new u1.IRI("http://www.w3.org/2001/XMLSchema#string");function C3(n){return typeof n=="object"&&n.type==="custom"}o(C3,"isCustomAggregation");var ju=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Vc.AggregateExecutorError=ju;var l1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new oj.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}=es(),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(C3(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 sr.Literal(String(s),x3)}case"sum":{let s=this.computeSum(r);return new sr.Literal(String(s),vo)}case"avg":{let s=this.computeAvg(r);return new sr.Literal(String(s),vo)}case"min":{let s=this.computeMin(r);return s===void 0?new sr.Literal("",ts):typeof s=="number"?new sr.Literal(String(s),vo):new sr.Literal(String(s),ts)}case"max":{let s=this.computeMax(r);return s===void 0?new sr.Literal("",ts):typeof s=="number"?new sr.Literal(String(s),vo):new sr.Literal(String(s),ts)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new sr.Literal(s||" ",ts)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new sr.Literal(" ",ts):typeof s=="number"?new sr.Literal(String(s),vo):new sr.Literal(String(s),ts)}default:{let s=i;throw new ju(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=cj.CustomAggregateRegistry.getInstance().get(i);if(a||(a=lj.BUILT_IN_AGGREGATES[i]),!a)throw new ju(`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}=es(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(C3(s)){r.set(i.variable,new sr.Literal("0",vo));continue}switch(s){case"count":r.set(i.variable,new sr.Literal("0",x3));break;case"sum":case"avg":r.set(i.variable,new sr.Literal("0",vo));break;case"group_concat":r.set(i.variable,new sr.Literal(" ",ts));break;case"min":case"max":case"sample":r.set(i.variable,new sr.Literal("",ts));break;default:r.set(i.variable,new sr.Literal("",ts))}}return r}};Vc.AggregateExecutor=l1});var p1=S(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});vp.ConstructExecutor=void 0;var uj=ri(),wo=xe(),f1=He(),d1=qt(),fj=pu(),h1=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 uj.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 wo.IRI(e.value);if(e.type==="literal")return new f1.Literal(e.value,e.datatype?new wo.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new d1.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 fj.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 f1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new wo.IRI(e.value);if(e.type==="blank")return new d1.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 wo.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new wo.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 wo.IRI(e.value);if(e.type==="blank")return new d1.BlankNode(e.value);if(e.type==="literal")return new f1.Literal(e.value,e.datatype?new wo.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}`)}};vp.ConstructExecutor=h1});var O3=S(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.ServiceExecutor=Uc.ServiceExecutorError=void 0;var dj=es(),R3=xe(),hj=He(),pj=qt(),Eo=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Uc.ServiceExecutorError=Eo;var m1=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 Eo(`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 Eo(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Eo(`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 dj.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 R3.IRI(e.value);case"literal":{let t=e.datatype?new R3.IRI(e.datatype):void 0;return new hj.Literal(e.value,t,e["xml:lang"])}case"bnode":return new pj.BlankNode(e.value);default:throw new Eo(`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))}};Uc.ServiceExecutor=m1});var F3=S(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.GraphExecutor=qc.GraphExecutorError=void 0;var P3=xe(),wp=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};qc.GraphExecutorError=wp;var g1=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 wp(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new P3.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 P3.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}}};qc.GraphExecutor=g1});var D3=S(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});Gc.SPARQLGenerator=Gc.SPARQLGeneratorError=void 0;var Wc=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Gc.SPARQLGeneratorError=Wc;var y1=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(CM.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}};$h.VaultPrefixTransformer=x_});var Fu=S(vn=>{"use strict";var RM=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]})),OM=vn&&vn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),PM=vn&&vn.__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"&&RM(t,e,r[i]);return OM(t,e),t}})();Object.defineProperty(vn,"__esModule",{value:!0});vn.SPARQLParser=vn.ExoQLParser=vn.SPARQLParseError=void 0;var HT=PM(qT()),I_=b_(),R_=v_(),QT=WT(),O_=E_(),FM=GT(),P_=zT(),DM=C_(),rr=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}};vn.SPARQLParseError=rr;var Bh=class{static{o(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new HT.Parser({sparqlStar:!0}),this.generator=new HT.Generator({sparqlStar:!0}),this.caseWhenTransformer=new I_.CaseWhenTransformer,this.lateralTransformer=new R_.LateralTransformer,this.prefixStarTransformer=new QT.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new O_.DescribeOptionsTransformer,this.directionalLangTagTransformer=new FM.DirectionalLangTagTransformer,this.tripleTermTransformer=new P_.TripleTermTransformer,this.vaultPrefixTransformer=new DM.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 O_.DescribeOptionsTransformerError)throw new rr(t.message);if(t instanceof R_.LateralTransformerError)throw new rr(t.message);if(t instanceof I_.CaseWhenTransformerError)throw new rr(t.message);if(t instanceof P_.TripleTermTransformerError)throw new rr(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 rr(`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 O_.DescribeOptionsTransformerError)throw new rr(t.message);if(t instanceof QT.PrefixStarTransformerError)throw new rr(t.message);if(t instanceof R_.LateralTransformerError)throw new rr(t.message);if(t instanceof I_.CaseWhenTransformerError)throw new rr(t.message);if(t instanceof P_.TripleTermTransformerError)throw new rr(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 rr(`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 rr(`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 rr("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 rr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new rr(`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 rr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};vn.ExoQLParser=Bh;vn.SPARQLParser=Bh});var _o=S(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.AlgebraTranslatorError=void 0;var F_=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};Vh.AlgebraTranslatorError=F_});var Uh=S(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.isVariableExpression=NM;Zi.isVariableTerm=LM;Zi.isNamedNode=kM;Zi.isLiteral=MM;Zi.isPropertyPath=jM;Zi.isAggregateExpression=$M;Zi.isOperationExpression=BM;Zi.isFunctionCallExpression=VM;function NM(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}o(NM,"isVariableExpression");function LM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}o(LM,"isVariableTerm");function kM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}o(kM,"isNamedNode");function MM(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}o(MM,"isLiteral");function jM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}o(jM,"isPropertyPath");function $M(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}o($M,"isAggregateExpression");function BM(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}o(BM,"isOperationExpression");function VM(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}o(VM,"isFunctionCallExpression")});var YT=S(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.TripleTranslator=void 0;var sn=_o(),D_=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 sn.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 sn.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 sn.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new sn.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 sn.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new sn.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new sn.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new sn.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new sn.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 sn.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new sn.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 sn.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new sn.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 sn.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 sn.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};qh.TripleTranslator=D_});var KT=S(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.ExpressionTranslator=void 0;var Cc=_o(),N_=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 Cc.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 Cc.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new Cc.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 Cc.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 Cc.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 Cc.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"}}};Wh.ExpressionTranslator=N_});var ZT=S(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.PatternTranslator=void 0;var XT=v_(),Or=_o(),JT=Uh(),L_=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 Or.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 Or.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 Or.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Or.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 Or.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 Or.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 Or.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 Or.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 Or.AlgebraTranslatorError(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Or.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 Or.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 Or.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Or.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 Or.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Or.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 Or.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 Or.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,JT.isVariableTerm)(i)&&i.value===XT.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,JT.isVariableTerm)(i)&&i.value===XT.LateralTransformer.LATERAL_MARKER))}}};Gh.PatternTranslator=L_});var t3=S(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.AggregateTranslator=void 0;var e3=_o(),UM=Uh(),k_=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,UM.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 e3.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 e3.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)}}}};zh.AggregateTranslator=k_});var Du=S(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.AlgebraTranslator=Sa.ExoQLAlgebraTranslator=Sa.AlgebraTranslatorError=void 0;var Hh=_o(),Qh=Uh(),qM=YT(),WM=KT(),GM=ZT(),zM=t3(),HM=_o();Object.defineProperty(Sa,"AlgebraTranslatorError",{enumerable:!0,get:o(function(){return HM.AlgebraTranslatorError},"get")});var Yh=class{static{o(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new qM.TripleTranslator,this.expressionTranslator=new WM.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 GM.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 zM.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 Hh.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 Hh.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new Hh.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,Qh.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,Qh.isVariableTerm)(u)||(0,Qh.isVariableExpression)(u)).map(u=>(0,Qh.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 Hh.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}}};Sa.ExoQLAlgebraTranslator=Yh;Sa.AlgebraTranslator=Yh});var es=S(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.SolutionMapping=void 0;var r3=He(),n3=xe(),i3=qt(),M_=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 r3.Literal&&t instanceof r3.Literal?e.equals(t):e instanceof n3.IRI&&t instanceof n3.IRI?e.value===t.value:e instanceof i3.BlankNode&&t instanceof i3.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}};Kh.SolutionMapping=M_});var a3=S(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.PropertyPathExecutor=Ic.PropertyPathExecutorError=void 0;var QM=es(),Xh=xe(),s3=qt(),Nu=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Ic.PropertyPathExecutorError=Nu;var j_=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){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 QM.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 Nu("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 Xh.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{node:c,depth:l}=a.shift();if(l>=this.MAX_DEPTH)continue;let u=await this.evaluatePathItem(c,t,null);for(let f of u){let d=this.nodeToKey(f);(r===null||this.nodeInSet(f,r))&&s.add(f),i.has(d)||(i.add(d),a.push({node:f,depth:l+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 Xh.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(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"|":return{type:"path",pathType:"|",items:e.items.map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};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 Xh.IRI(e.value));break;case"blank":t.add(new s3.BlankNode(e.value));break;default:throw new Nu(`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 Xh.IRI)return{type:"iri",value:r.value};if(r instanceof s3.BlankNode)return{type:"blank",value:r.id}}}return e}isVariable(e){return e.type==="variable"}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_=S(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.BGPExecutor=Rc.BGPExecutorError=void 0;var Jh=es(),ba=xe(),$_=He(),Zh=qt(),ep=pu(),YM=a3(),Vr=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Rc.BGPExecutorError=Vr;var B_=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new YM.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new Jh.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 Jh.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 Vr("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(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 Vr("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 Jh.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)){yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(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 Jh.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 ep.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 ba.IRI&&e.value===t.value;case"literal":return!(!(t instanceof $_.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof Zh.BlankNode&&e.value===t.id;case"quoted":return t instanceof ep.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 ba.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"}toRDFTermAsSubject(e){switch(e.type){case"iri":return new ba.IRI(e.value);case"blank":return new Zh.BlankNode(e.value);case"literal":throw new Vr("Literals cannot appear in subject position");case"variable":throw new Vr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Vr(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new ba.IRI(e.predicate.value):(()=>{throw new Vr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new ep.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new ba.IRI(e.value);case"literal":throw new Vr("Literals cannot appear in predicate position");case"blank":throw new Vr("Blank nodes cannot appear in predicate position");case"variable":throw new Vr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new Vr(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new ba.IRI(e.value);case"literal":return new $_.Literal(e.value,e.datatype?new ba.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new Zh.BlankNode(e.value);case"variable":throw new Vr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Vr(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof ba.IRI)return{type:"iri",value:e.value};if(e instanceof $_.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof Zh.BlankNode)return{type:"blank",value:e.id};if(e instanceof ep.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new Vr(`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)}}};Rc.BGPExecutor=B_});var o3=S(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});tp.StringFunctions=void 0;var Oc=xe(),va=He(),U_=qt(),Lu=class n{static{o(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Oc.IRI||e instanceof va.Literal?e.value:e instanceof U_.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof va.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof va.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 va.Literal)r=e.value;else if(e instanceof Oc.IRI)r=e.value;else if(e instanceof U_.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 va.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Oc.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 va.Literal(s,new Oc.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 va.Literal)t=e.value;else if(e instanceof Oc.IRI)t=e.value;else if(e instanceof U_.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 va.Literal(r,new Oc.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}};tp.StringFunctions=Lu;Lu.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Lu.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 c3=S(rp=>{"use strict";Object.defineProperty(rp,"__esModule",{value:!0});rp.MathFunctions=void 0;var q_=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()}};rp.MathFunctions=q_});var ip=S(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.DateTimeParsing=void 0;var KM=xe(),XM=He(),W_=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 XM.Literal(e,new KM.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),_=parseInt(d[3],10),b=h*(p*60+_)*60*1e3;f-=b}}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 _=d.match(/^(\d+(?:\.\d+)?)S$/);if(_&&(c=parseFloat(_[1]),d=d.substring(_[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}};np.DateTimeParsing=W_});var l3=S(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.DateTimeArithmetic=void 0;var an=xe(),Ee=He(),Xe=ip(),G_=class{static{o(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.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=Xe.DateTimeParsing.formatDayTimeDuration(c);return new Ee.Literal(l,new an.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new Ee.Literal(l.toISOString(),new an.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new Ee.Literal(l.toISOString(),new an.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=Xe.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 Ee.Literal(h,new an.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=Xe.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 Ee.Literal(h,new an.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new Ee.Literal(s.toISOString(),new an.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new Ee.Literal(s.toISOString(),new an.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=Xe.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 Ee.Literal(d,new an.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=Xe.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 Ee.Literal(d,new an.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s+a);return new Ee.Literal(c,new an.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s-a);return new Ee.Literal(c,new an.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof Ee.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i*t);return new Ee.Literal(s,new an.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 Ee.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i/t);return new Ee.Literal(s,new an.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s+a);return new Ee.Literal(c,new an.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof Ee.Literal?e.value:e,i=t instanceof Ee.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s-a);return new Ee.Literal(c,new an.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Ee.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Ee.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Ee.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Ee.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/1e3}};sp.DateTimeArithmetic=G_});var u3=S(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.DateTimeAccessors=void 0;var ku=xe(),Lt=He(),Tt=ip(),z_=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 Lt.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 Lt.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 Lt.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 Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof Lt.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 Lt.Literal(r,new ku.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 Lt.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let ve=i.getUTCFullYear(),z=String(i.getUTCMonth()+1).padStart(2,"0"),G=String(i.getUTCDate()).padStart(2,"0"),F=String(i.getUTCHours()).padStart(2,"0"),j=String(i.getUTCMinutes()).padStart(2,"0"),ee=String(i.getUTCSeconds()).padStart(2,"0"),Ye=i.getUTCMilliseconds(),st=`${ve}-${z}-${G}T${F}:${j}:${ee}`;return Ye>0&&(st+=`.${String(Ye).padStart(3,"0")}`),new Lt.Literal(st,new ku.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof Lt.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"),_=String(u.getUTCMinutes()).padStart(2,"0"),b=String(u.getUTCSeconds()).padStart(2,"0"),E=u.getUTCMilliseconds(),v=a>=0?"+":"-",A=Math.floor(Math.abs(a)/(3600*1e3)),R=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),B=`${v}${String(A).padStart(2,"0")}:${String(R).padStart(2,"0")}`,W=`${f}-${d}-${h}T${p}:${_}:${b}`;return E>0&&(W+=`.${String(E).padStart(3,"0")}`),W+=B,new Lt.Literal(W,new ku.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 Lt.Literal?e.value:e,s=t instanceof Lt.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 Lt.Literal?e.value:e,i=t instanceof Lt.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 Lt.Literal(l,new ku.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof Lt.Literal?e.value:e,i=t instanceof Lt.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 Lt.Literal(u,new ku.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};ap.DateTimeAccessors=z_});var Q_=S(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.DateTimeFunctions=void 0;var Pc=ip(),nr=l3(),gt=u3(),H_=class{static{o(this,"DateTimeFunctions")}static parseDate(e){return Pc.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Pc.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Pc.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Pc.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Pc.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Pc.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 nr.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return nr.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return nr.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return nr.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return nr.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return nr.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return nr.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return nr.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return nr.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return nr.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return nr.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return nr.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return nr.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return nr.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return nr.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return nr.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return nr.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return nr.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return nr.DateTimeArithmetic.durationToSeconds(e)}};op.DateTimeFunctions=H_});var f3=S(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.LogicalFunctions=void 0;var JM=xe(),Fc=He(),ZM=qt(),cp=Q_(),Y_=class n{static{o(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return cp.DateTimeFunctions.compareDurations(e instanceof Fc.Literal?e:String(e),t instanceof Fc.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return cp.DateTimeFunctions.compareDurations(e instanceof Fc.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return cp.DateTimeFunctions.compareDurations(e,t instanceof Fc.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 Fc.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 Fc.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 cp.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof JM.IRI?e.value:e instanceof ZM.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}};lp.LogicalFunctions=Y_});var d3=S(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});up.RDFTermFunctions=void 0;var Pr=xe(),bt=He(),si=qt(),Dc=pu(),K_=_n(),X_=class n{static{o(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof bt.Literal)return e.datatype?e.datatype:e.language?new Pr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Pr.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 Pr.IRI}static isBlank(e){return e===void 0?!1:e instanceof si.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof bt.Literal}static isTriple(e){return e===void 0?!1:e instanceof Dc.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof bt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof bt.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 bt.Literal(t.toISOString(),new Pr.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 bt.Literal(String(t),new Pr.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 bt.Literal(String(t),new Pr.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 Pr.IRI&&t instanceof Pr.IRI)return e.value===t.value;if(e instanceof si.BlankNode&&t instanceof si.BlankNode)return e.id===t.id;if(e instanceof bt.Literal&&t instanceof bt.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 Pr.IRI)return e;if(e instanceof bt.Literal)return new Pr.IRI(e.value);throw e instanceof si.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,K_.v4)().replace(/-/g,"").substring(0,12)}`;return new si.BlankNode(t)}if(e instanceof bt.Literal)return new si.BlankNode(e.value);if(e instanceof si.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 bt.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 Pr.IRI)i=t;else if(t instanceof bt.Literal)i=new Pr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new bt.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 bt.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 bt.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 bt.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 bt.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 bt.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 bt.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 bt.Literal(i,void 0,s,a)}static uuid(){let e=(0,K_.v4)();return new Pr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,K_.v4)();return new bt.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 bt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Pr.IRI)){let c=t instanceof bt.Literal?"Literal":t instanceof si.BlankNode?"BlankNode":t instanceof Dc.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new Dc.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof Dc.QuotedTriple)){let t=e instanceof Pr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof si.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 Dc.QuotedTriple)){let t=e instanceof Pr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof si.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 Dc.QuotedTriple)){let t=e instanceof Pr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof si.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};up.RDFTermFunctions=X_});var h3=S(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});fp.HashFunctions=void 0;var J_=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")}};fp.HashFunctions=J_});var hp=S(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});dp.BuiltInFunctions=void 0;var ir=o3(),wa=c3(),ae=Q_(),Nc=f3(),Ot=d3(),Mu=h3(),Z_=class{static{o(this,"BuiltInFunctions")}static str(...e){return ir.StringFunctions.str(...e)}static lang(...e){return ir.StringFunctions.lang(...e)}static langdir(...e){return ir.StringFunctions.langdir(...e)}static langMatches(...e){return ir.StringFunctions.langMatches(...e)}static regex(...e){return ir.StringFunctions.regex(...e)}static contains(...e){return ir.StringFunctions.contains(...e)}static strStarts(...e){return ir.StringFunctions.strStarts(...e)}static strEnds(...e){return ir.StringFunctions.strEnds(...e)}static strlen(...e){return ir.StringFunctions.strlen(...e)}static ucase(...e){return ir.StringFunctions.ucase(...e)}static lcase(...e){return ir.StringFunctions.lcase(...e)}static substr(...e){return ir.StringFunctions.substr(...e)}static strBefore(...e){return ir.StringFunctions.strBefore(...e)}static strAfter(...e){return ir.StringFunctions.strAfter(...e)}static concat(...e){return ir.StringFunctions.concat(...e)}static replace(...e){return ir.StringFunctions.replace(...e)}static encodeForUri(...e){return ir.StringFunctions.encodeForUri(...e)}static normalize(...e){return ir.StringFunctions.normalize(...e)}static fold(...e){return ir.StringFunctions.fold(...e)}static abs(...e){return wa.MathFunctions.abs(...e)}static round(...e){return wa.MathFunctions.round(...e)}static ceil(...e){return wa.MathFunctions.ceil(...e)}static floor(...e){return wa.MathFunctions.floor(...e)}static rand(){return wa.MathFunctions.rand()}static msToMinutes(...e){return wa.MathFunctions.msToMinutes(...e)}static msToHours(...e){return wa.MathFunctions.msToHours(...e)}static msToSeconds(...e){return wa.MathFunctions.msToSeconds(...e)}static parseDate(...e){return ae.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return ae.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return ae.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return ae.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return ae.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return ae.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return ae.DateTimeFunctions.year(...e)}static month(...e){return ae.DateTimeFunctions.month(...e)}static day(...e){return ae.DateTimeFunctions.day(...e)}static hours(...e){return ae.DateTimeFunctions.hours(...e)}static minutes(...e){return ae.DateTimeFunctions.minutes(...e)}static seconds(...e){return ae.DateTimeFunctions.seconds(...e)}static timezone(...e){return ae.DateTimeFunctions.timezone(...e)}static tz(...e){return ae.DateTimeFunctions.tz(...e)}static now(){return ae.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return ae.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return ae.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return ae.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return ae.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return ae.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return ae.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return ae.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return ae.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return ae.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return ae.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return ae.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return ae.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return ae.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return ae.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return ae.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return ae.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return ae.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return ae.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return ae.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return ae.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return ae.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return ae.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return ae.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return ae.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return ae.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return ae.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return ae.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return ae.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return ae.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return ae.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return ae.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return ae.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return ae.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return ae.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return ae.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return ae.DateTimeFunctions.adjust(...e)}static isTime(...e){return ae.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return ae.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Nc.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Nc.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Nc.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Nc.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Nc.LogicalFunctions.coalesce(...e)}static if(...e){return Nc.LogicalFunctions.if(...e)}static datatype(...e){return Ot.RDFTermFunctions.datatype(...e)}static bound(...e){return Ot.RDFTermFunctions.bound(...e)}static isIRI(...e){return Ot.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return Ot.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return Ot.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return Ot.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return Ot.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return Ot.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return Ot.RDFTermFunctions.sameTerm(...e)}static iri(...e){return Ot.RDFTermFunctions.iri(...e)}static uri(...e){return Ot.RDFTermFunctions.uri(...e)}static bnode(...e){return Ot.RDFTermFunctions.bnode(...e)}static strdt(...e){return Ot.RDFTermFunctions.strdt(...e)}static strlang(...e){return Ot.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return Ot.RDFTermFunctions.strlangdir(...e)}static uuid(){return Ot.RDFTermFunctions.uuid()}static struuid(){return Ot.RDFTermFunctions.struuid()}static xsdDateTime(...e){return Ot.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return Ot.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return Ot.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return Ot.RDFTermFunctions.triple(...e)}static subject(...e){return Ot.RDFTermFunctions.subject(...e)}static predicate(...e){return Ot.RDFTermFunctions.predicate(...e)}static object(...e){return Ot.RDFTermFunctions.object(...e)}static md5(...e){return Mu.HashFunctions.md5(...e)}static sha1(...e){return Mu.HashFunctions.sha1(...e)}static sha256(...e){return Mu.HashFunctions.sha256(...e)}static sha384(...e){return Mu.HashFunctions.sha384(...e)}static sha512(...e){return Mu.HashFunctions.sha512(...e)}};dp.BuiltInFunctions=Z_});var w3=S(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var k=hp();M.functionHandlers=new Map;M.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.str(t)});M.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.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 k.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 k.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 k.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 k.BuiltInFunctions.strEnds(t,r)});M.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.strlen(t)});M.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.ucase(t)});M.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.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 k.BuiltInFunctions.substr(t,r,i)}return k.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 k.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 k.BuiltInFunctions.strAfter(t,r)});M.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return k.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 k.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 k.BuiltInFunctions.regex(t,r,i)});M.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.encodeForUri(t)});M.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.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 k.BuiltInFunctions.bound(r)}return!0});var p3=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",p3);M.functionHandlers.set("isuri",p3);M.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isBlank(t)});M.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isLiteral(t)});M.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isNumeric(t)});M.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.hasLangdir(t)});M.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.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 k.BuiltInFunctions.sameTerm(t,r)});M.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.abs(t)});M.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.round(t)});M.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.ceil(t)});M.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.floor(t)});M.functionHandlers.set("rand",()=>k.BuiltInFunctions.rand());M.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.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 k.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 k.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 k.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 k.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 k.BuiltInFunctions.dateDiffHours(t,r)});var Lc=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"),m3=Lc(k.BuiltInFunctions.year.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationYears.bind(k.BuiltInFunctions),null);M.functionHandlers.set("year",m3);M.functionHandlers.set("years",m3);var g3=Lc(k.BuiltInFunctions.month.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationMonths.bind(k.BuiltInFunctions),null);M.functionHandlers.set("month",g3);M.functionHandlers.set("months",g3);var y3=Lc(k.BuiltInFunctions.day.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationDays.bind(k.BuiltInFunctions));M.functionHandlers.set("day",y3);M.functionHandlers.set("days",y3);M.functionHandlers.set("hours",Lc(k.BuiltInFunctions.hours.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationHours.bind(k.BuiltInFunctions)));M.functionHandlers.set("minutes",Lc(k.BuiltInFunctions.minutes.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationMinutes.bind(k.BuiltInFunctions)));M.functionHandlers.set("seconds",Lc(k.BuiltInFunctions.seconds.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationSeconds.bind(k.BuiltInFunctions)));M.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.timezone(t)});M.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.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 k.BuiltInFunctions.adjust(t,r)});M.functionHandlers.set("now",()=>k.BuiltInFunctions.now());var _3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",_3);M.functionHandlers.set("xsd:datetime",_3);var S3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",S3);M.functionHandlers.set("xsd:integer",S3);var b3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",b3);M.functionHandlers.set("xsd:decimal",b3);var v3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",v3);M.functionHandlers.set("xsd:daytimeduration",v3);M.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToDays(t)});M.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToHours(t)});M.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToMinutes(t)});M.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToSeconds(t)});M.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationDays(t)});M.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationHours(t)});M.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationMinutes(t)});M.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationSeconds(t)});M.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationYears(t)});M.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.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 k.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 k.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 k.BuiltInFunctions.dateTimeSubtract(t,r)});M.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToMinutes(t)});M.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToHours(t)});M.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToSeconds(t)});M.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.md5(t)});M.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha1(t)});M.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha256(t)});M.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha384(t)});M.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha512(t)});M.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.subject(t)});M.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.predicate(t)});M.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.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 k.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"))})});var pp=S(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.FilterExecutor=kc.FilterExecutorError=void 0;var yt=hp(),ej=w3(),tj=xe(),Ea=He(),dr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};kc.FilterExecutorError=dr;var e1=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":return r.value;case"NamedNode":return r.value;default:throw new dr(`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":return e.value;case"in":return this.evaluateIn(e,t);case"exists":throw new dr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new dr(`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 dr("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 dr(`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 dr("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"&&e!==null&&"termType"in e?e:e instanceof tj.IRI||e instanceof Ea.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 dr(`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 dr("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 dr("Division by zero");return s/a;default:throw new dr(`Unknown arithmetic operator: ${String(e.operator)}`)}}isDayTimeDurationValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof Ea.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 dr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof Ea.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 Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof Ea.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=ej.functionHandlers.get(i);if(!a)throw new dr(`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 dr(`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 dr("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 Ea.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 dr("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)}};kc.FilterExecutor=e1});var r1=S(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});mp.OptionalExecutor=void 0;var t1=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)}}};mp.OptionalExecutor=t1});var i1=S(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.UnionExecutor=void 0;var n1=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("|")}};gp.UnionExecutor=n1});var E3=S(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});yp.MinusExecutor=void 0;var s1=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}};yp.MinusExecutor=s1});var A3=S(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.ValuesExecutor=Mc.ValuesExecutorError=void 0;var rj=es(),T3=xe(),nj=He(),_p=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Mc.ValuesExecutorError=_p;var a1=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 rj.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 T3.IRI(e.value);if(e.type==="literal")return new nj.Literal(e.value,e.datatype?new T3.IRI(e.datatype):void 0,e.language,e.direction);throw new _p(`Unknown term type: ${e.type}`)}};Mc.ValuesExecutor=a1});var o1=S($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.CustomAggregateRegistry=$c.CustomAggregateError=void 0;var jc=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};$c.CustomAggregateError=jc;var Sp=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}};$c.CustomAggregateRegistry=Sp;Sp.instance=null});var c1=S(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.BUILT_IN_AGGREGATES=Je.modeAggregate=Je.stddevAggregate=Je.varianceAggregate=Je.medianAggregate=Je.EXO_AGGREGATE_NS=void 0;Je.getNumericValue=bp;Je.createDecimalLiteral=ai;Je.createDoubleLiteral=aj;Je.createPercentileAggregate=So;var bo=He(),Bc=xe(),ij=new Bc.IRI("http://www.w3.org/2001/XMLSchema#decimal"),sj=new Bc.IRI("http://www.w3.org/2001/XMLSchema#double");Je.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function bp(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof bo.Literal?parseFloat(n.value):n instanceof Bc.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(bp,"getNumericValue");function ai(n){return new bo.Literal(String(n),ij)}o(ai,"createDecimalLiteral");function aj(n){return new bo.Literal(String(n),sj)}o(aj,"createDoubleLiteral");Je.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=bp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ai(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 ai(s)}};Je.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=bp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ai(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 ai(i)}};Je.stddevAggregate={init(){return{values:[]}},step(n,e){Je.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ai(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 ai(Math.sqrt(i))}};Je.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof bo.Literal||e instanceof Bc.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 bo.Literal(" ",new Bc.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 bo.Literal)return i;let s=parseFloat(t);return isNaN(s)?new bo.Literal(t,new Bc.IRI("http://www.w3.org/2001/XMLSchema#string")):ai(s)}};function So(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=bp(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return ai(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 ai(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return ai(f)}}}o(So,"createPercentileAggregate");Je.BUILT_IN_AGGREGATES={[`${Je.EXO_AGGREGATE_NS}median`]:Je.medianAggregate,[`${Je.EXO_AGGREGATE_NS}variance`]:Je.varianceAggregate,[`${Je.EXO_AGGREGATE_NS}stddev`]:Je.stddevAggregate,[`${Je.EXO_AGGREGATE_NS}mode`]:Je.modeAggregate,[`${Je.EXO_AGGREGATE_NS}percentile25`]:So(25),[`${Je.EXO_AGGREGATE_NS}percentile50`]:So(50),[`${Je.EXO_AGGREGATE_NS}percentile75`]:So(75),[`${Je.EXO_AGGREGATE_NS}percentile90`]:So(90),[`${Je.EXO_AGGREGATE_NS}percentile95`]:So(95),[`${Je.EXO_AGGREGATE_NS}percentile99`]:So(99)}});var I3=S(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.AggregateExecutor=Vc.AggregateExecutorError=void 0;var sr=He(),u1=xe(),oj=pp(),cj=o1(),lj=c1(),x3=new u1.IRI("http://www.w3.org/2001/XMLSchema#integer"),vo=new u1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),ts=new u1.IRI("http://www.w3.org/2001/XMLSchema#string");function C3(n){return typeof n=="object"&&n.type==="custom"}o(C3,"isCustomAggregation");var ju=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Vc.AggregateExecutorError=ju;var l1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new oj.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}=es(),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(C3(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 sr.Literal(String(s),x3)}case"sum":{let s=this.computeSum(r);return new sr.Literal(String(s),vo)}case"avg":{let s=this.computeAvg(r);return new sr.Literal(String(s),vo)}case"min":{let s=this.computeMin(r);return s===void 0?new sr.Literal("",ts):typeof s=="number"?new sr.Literal(String(s),vo):new sr.Literal(String(s),ts)}case"max":{let s=this.computeMax(r);return s===void 0?new sr.Literal("",ts):typeof s=="number"?new sr.Literal(String(s),vo):new sr.Literal(String(s),ts)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new sr.Literal(s||" ",ts)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new sr.Literal(" ",ts):typeof s=="number"?new sr.Literal(String(s),vo):new sr.Literal(String(s),ts)}default:{let s=i;throw new ju(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=cj.CustomAggregateRegistry.getInstance().get(i);if(a||(a=lj.BUILT_IN_AGGREGATES[i]),!a)throw new ju(`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}=es(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(C3(s)){r.set(i.variable,new sr.Literal("0",vo));continue}switch(s){case"count":r.set(i.variable,new sr.Literal("0",x3));break;case"sum":case"avg":r.set(i.variable,new sr.Literal("0",vo));break;case"group_concat":r.set(i.variable,new sr.Literal(" ",ts));break;case"min":case"max":case"sample":r.set(i.variable,new sr.Literal("",ts));break;default:r.set(i.variable,new sr.Literal("",ts))}}return r}};Vc.AggregateExecutor=l1});var p1=S(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});vp.ConstructExecutor=void 0;var uj=ri(),wo=xe(),f1=He(),d1=qt(),fj=pu(),h1=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 uj.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 wo.IRI(e.value);if(e.type==="literal")return new f1.Literal(e.value,e.datatype?new wo.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new d1.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 fj.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 f1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new wo.IRI(e.value);if(e.type==="blank")return new d1.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 wo.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new wo.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 wo.IRI(e.value);if(e.type==="blank")return new d1.BlankNode(e.value);if(e.type==="literal")return new f1.Literal(e.value,e.datatype?new wo.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}`)}};vp.ConstructExecutor=h1});var O3=S(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.ServiceExecutor=Uc.ServiceExecutorError=void 0;var dj=es(),R3=xe(),hj=He(),pj=qt(),Eo=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Uc.ServiceExecutorError=Eo;var m1=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 Eo(`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 Eo(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Eo(`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 dj.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 R3.IRI(e.value);case"literal":{let t=e.datatype?new R3.IRI(e.datatype):void 0;return new hj.Literal(e.value,t,e["xml:lang"])}case"bnode":return new pj.BlankNode(e.value);default:throw new Eo(`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))}};Uc.ServiceExecutor=m1});var F3=S(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.GraphExecutor=qc.GraphExecutorError=void 0;var P3=xe(),wp=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};qc.GraphExecutorError=wp;var g1=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 wp(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new P3.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 P3.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}}};qc.GraphExecutor=g1});var D3=S(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});Gc.SPARQLGenerator=Gc.SPARQLGeneratorError=void 0;var Wc=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Gc.SPARQLGeneratorError=Wc;var y1=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 Wc(`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 Wc(`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 Wc(`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}}};Gc.SPARQLGenerator=y1});var $u=S(wn=>{"use strict";var mj=wn&&wn.__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]})),gj=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),N3=wn&&wn.__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"&&mj(t,e,r[i]);return gj(t,e),t}})();Object.defineProperty(wn,"__esModule",{value:!0});wn.QueryExecutor=wn.ExoQLQueryExecutor=wn.QueryExecutorError=void 0;var yj=V_(),_j=pp(),Sj=r1(),bj=i1(),vj=E3(),wj=A3(),Ej=I3(),Tj=p1(),Aj=O3(),xj=F3(),Cj=D3(),Ij=xe(),zc=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};wn.QueryExecutorError=zc;var Ep=class{static{o(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new yj.BGPExecutor(e),this.filterExecutor=new _j.FilterExecutor,this.optionalExecutor=new Sj.OptionalExecutor,this.unionExecutor=new bj.UnionExecutor,this.minusExecutor=new vj.MinusExecutor,this.valuesExecutor=new wj.ValuesExecutor,this.aggregateExecutor=new Ej.AggregateExecutor,this.constructExecutor=new Tj.ConstructExecutor,this.serviceExecutor=new Aj.ServiceExecutor(t.serviceConfig),this.graphExecutor=new xj.GraphExecutor(e),this.sparqlGenerator=new Cj.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 zc(`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(()=>N3(es())),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 Ij.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(()=>N3(es()));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);return r?r.value??r.id??String(r):void 0}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 zc("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 zc("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};wn.ExoQLQueryExecutor=Ep;wn.QueryExecutor=Ep});var L3=S(js=>{"use strict";var Rj=js&&js.__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},Oj=js&&js.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(js,"__esModule",{value:!0});js.CommandResolver=void 0;var Pj=ce(),Ms=xe(),oi=He(),we=Cr(),_1=dc(),Fj=Fu(),Dj=Du(),Nj=$u(),S1=10,b1=class{static{o(this,"CommandResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}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,we.Namespace.RDF.term("type"),we.Namespace.EXOCMD.term("Command"))).length===0)return null;let i=await this.getLiteralValue(t,we.Namespace.EXO.term("Asset_label"))??"Unknown Command",s=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_labelTemplate")),a=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_icon")),c=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_confirmMessage")),l=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_successMessage")),u=await this.getLiteralValue(t,we.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,we.Namespace.RDF.term("type"),we.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}invalidateCache(){this.cache.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 Fj.ExoQLParser().parse(r),c=new Dj.ExoQLAlgebraTranslator().translate(s),u=await new Nj.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 oi.Literal||h instanceof Ms.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,we.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetClass")),a=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!a&&!c)return null;let l=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_group")),d=await this.loadLinkedPreconditionFromProperty(e,we.Namespace.EXOCMD.term("CommandBinding_precondition"));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,group:f??void 0,precondition:d??void 0}}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,we.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 Ms.IRI)s=i;else if(i instanceof oi.Literal){let f=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(f)}if(!s)return null;let a=await this.getLiteralValue(s,we.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,we.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,we.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,we.Namespace.EXOCMD.term("Precondition_hostFunction"));return!a||!l&&!u?null:{id:a,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u}}}async loadLinkedGrounding(e,t){if(t>=S1)return null;let r=await this.tripleStore.match(e,we.Namespace.EXOCMD.term("Command_grounding"),void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Ms.IRI)s=i;else if(i instanceof oi.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>=S1)return null;let r=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_label"))??"",s=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_type"));if(!s)return null;let a=this.resolveGroundingType(s);if(!a)return null;let c=await this.getObsidianName(e,we.Namespace.EXOCMD.term("Grounding_targetProperty"));if(a===_1.GroundingType.SERVICE_CALL){let v=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_serviceId"));v&&(c=v)}let l=await this.getObsidianWikilinkValue(e,we.Namespace.EXOCMD.term("Grounding_targetValue")),u=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),f=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetClass")),d=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetPrototype")),h=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetFolder")),p=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_inputSchema")),_;a===_1.GroundingType.COMPOSITE&&(_=await this.loadCompositeSteps(e,t+1));let b;if(p)try{let v=JSON.parse(p);v?.properties&&(b=Object.entries(v.properties).map(([A,R])=>({name:A,type:R.type==="string"?"text":R.type,label:R.title??A,required:Array.isArray(v.required)&&v.required.includes(A)})))}catch{}let E={id:r,label:i,type:a,targetProperty:c??void 0,targetValue:l??void 0,sparqlUpdate:u??void 0,steps:_,targetClass:f??void 0,targetPrototype:d??void 0,targetFolder:h??void 0};return b&&(E.inputSchema=b),E}async loadCompositeSteps(e,t){if(t>=S1)return[];let r=await this.tripleStore.match(e,we.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let a=null;if(s.object instanceof Ms.IRI)a=s.object;else if(s.object instanceof oi.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}resolveGroundingType(e){let t=e.toLowerCase().trim();return Object.values(_1.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,we.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof oi.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 oi.Literal||i instanceof Ms.IRI?i.value: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 Ms.IRI){let s=await this.tripleStore.match(i,we.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof oi.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof oi.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 oi.Literal?this.normalizeWikilink(i.value):i instanceof Ms.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 oi.Literal?i.value:i instanceof Ms.IRI?this.iriToObsidianName(i.value)??i.value:null}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 oi.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof Ms.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,we.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===we.Namespace.EMS.iri.value)return`ems__${s}`;if(i===we.Namespace.EXO.iri.value)return`exo__${s}`;if(i===we.Namespace.EXOCMD.iri.value)return`exocmd__${s}`;if(i===we.Namespace.IMS.iri.value)return`ims__${s}`;if(i===we.Namespace.ZTLK.iri.value)return`ztlk__${s}`;if(i===we.Namespace.PTMS.iri.value)return`ptms__${s}`;if(i===we.Namespace.LIT.iri.value)return`lit__${s}`;if(i===we.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}};js.CommandResolver=b1;js.CommandResolver=b1=Rj([(0,Pj.injectable)(),Oj("design:paramtypes",[Object])],b1)});var M3=S($s=>{"use strict";var Lj=$s&&$s.__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},kj=$s&&$s.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Bu;Object.defineProperty($s,"__esModule",{value:!0});$s.PreconditionEvaluator=void 0;var Mj=ce(),jj=Fu(),$j=Du(),k3=$u(),Vu=Bu=class{static{o(this,"PreconditionEvaluator")}constructor(e){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}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,Bu.SENTINEL_IRI),i=new jj.ExoQLParser().parse(t),a=new $j.ExoQLAlgebraTranslator().translate(i);return new k3.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(Bu.SENTINEL_IRI,t));return await new k3.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=new Date().toISOString(),i=r.slice(0,10),s=new Date,a=new Date(s.getTime()+Bu.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,_=new Date(Date.UTC(c,l,u-p)),b=_.toISOString().slice(0,10),v=new Date(_.getTime()-10080*60*1e3).toISOString().slice(0,10),A=`${c}-${String(l+1).padStart(2,"0")}-01`,R=l===0?11:l-1,W=`${l===0?c-1:c}-${String(R+1).padStart(2,"0")}-01`,ve=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${r}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${b}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${v}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${A}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${W}"^^xsd:date`).replace(/\$thisYearStart/g,`"${ve}"^^xsd:date`).replace(/\$today/g,`"${i}"^^xsd:date`)}};$s.PreconditionEvaluator=Vu;Vu.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";Vu.ALMATY_OFFSET_MS=300*60*1e3;$s.PreconditionEvaluator=Vu=Bu=Lj([(0,Mj.injectable)(),kj("design:paramtypes",[Object])],Vu)});var qn=S(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.FrontmatterService=void 0;var Uu=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}}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 Wc(`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}}};Gc.SPARQLGenerator=y1});var $u=S(wn=>{"use strict";var mj=wn&&wn.__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]})),gj=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),N3=wn&&wn.__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"&&mj(t,e,r[i]);return gj(t,e),t}})();Object.defineProperty(wn,"__esModule",{value:!0});wn.QueryExecutor=wn.ExoQLQueryExecutor=wn.QueryExecutorError=void 0;var yj=V_(),_j=pp(),Sj=r1(),bj=i1(),vj=E3(),wj=A3(),Ej=I3(),Tj=p1(),Aj=O3(),xj=F3(),Cj=D3(),Ij=xe(),zc=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};wn.QueryExecutorError=zc;var Ep=class{static{o(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new yj.BGPExecutor(e),this.filterExecutor=new _j.FilterExecutor,this.optionalExecutor=new Sj.OptionalExecutor,this.unionExecutor=new bj.UnionExecutor,this.minusExecutor=new vj.MinusExecutor,this.valuesExecutor=new wj.ValuesExecutor,this.aggregateExecutor=new Ej.AggregateExecutor,this.constructExecutor=new Tj.ConstructExecutor,this.serviceExecutor=new Aj.ServiceExecutor(t.serviceConfig),this.graphExecutor=new xj.GraphExecutor(e),this.sparqlGenerator=new Cj.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 zc(`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(()=>N3(es())),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 Ij.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(()=>N3(es()));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);return r?r.value??r.id??String(r):void 0}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 zc("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 zc("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};wn.ExoQLQueryExecutor=Ep;wn.QueryExecutor=Ep});var L3=S(js=>{"use strict";var Rj=js&&js.__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},Oj=js&&js.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(js,"__esModule",{value:!0});js.CommandResolver=void 0;var Pj=ce(),Ms=xe(),oi=He(),we=Cr(),_1=dc(),Fj=Fu(),Dj=Du(),Nj=$u(),S1=10,b1=class{static{o(this,"CommandResolver")}constructor(e){this.tripleStore=e,this.cache=new Map,this.multiCache=new Map}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,we.Namespace.RDF.term("type"),we.Namespace.EXOCMD.term("Command"))).length===0)return null;let i=await this.getLiteralValue(t,we.Namespace.EXO.term("Asset_label"))??"Unknown Command",s=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_labelTemplate")),a=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_icon")),c=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_confirmMessage")),l=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_successMessage")),u=await this.getLiteralValue(t,we.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,we.Namespace.RDF.term("type"),we.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}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 Fj.ExoQLParser().parse(r),c=new Dj.ExoQLAlgebraTranslator().translate(s),u=await new Nj.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 oi.Literal||h instanceof Ms.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,we.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetClass")),a=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!a&&!c)return null;let l=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_group")),d=await this.loadLinkedPreconditionFromProperty(e,we.Namespace.EXOCMD.term("CommandBinding_precondition"));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,group:f??void 0,precondition:d??void 0}}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,we.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 Ms.IRI)s=i;else if(i instanceof oi.Literal){let f=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(f)}if(!s)return null;let a=await this.getLiteralValue(s,we.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,we.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,we.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,we.Namespace.EXOCMD.term("Precondition_hostFunction"));return!a||!l&&!u?null:{id:a,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u}}}async loadLinkedGrounding(e,t){if(t>=S1)return null;let r=await this.tripleStore.match(e,we.Namespace.EXOCMD.term("Command_grounding"),void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Ms.IRI)s=i;else if(i instanceof oi.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>=S1)return null;let r=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_label"))??"",s=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_type"));if(!s)return null;let a=this.resolveGroundingType(s);if(!a)return null;let c=await this.getObsidianName(e,we.Namespace.EXOCMD.term("Grounding_targetProperty"));if(a===_1.GroundingType.SERVICE_CALL){let v=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_serviceId"));v&&(c=v)}let l=await this.getObsidianWikilinkValue(e,we.Namespace.EXOCMD.term("Grounding_targetValue")),u=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),f=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetClass")),d=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetPrototype")),h=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetFolder")),p=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_inputSchema")),_;a===_1.GroundingType.COMPOSITE&&(_=await this.loadCompositeSteps(e,t+1));let b;if(p)try{let v=JSON.parse(p);v?.properties&&(b=Object.entries(v.properties).map(([A,R])=>({name:A,type:R.type==="string"?"text":R.type,label:R.title??A,required:Array.isArray(v.required)&&v.required.includes(A)})))}catch{}let E={id:r,label:i,type:a,targetProperty:c??void 0,targetValue:l??void 0,sparqlUpdate:u??void 0,steps:_,targetClass:f??void 0,targetPrototype:d??void 0,targetFolder:h??void 0};return b&&(E.inputSchema=b),E}async loadCompositeSteps(e,t){if(t>=S1)return[];let r=await this.tripleStore.match(e,we.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let a=null;if(s.object instanceof Ms.IRI)a=s.object;else if(s.object instanceof oi.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}resolveGroundingType(e){let t=e.toLowerCase().trim();return Object.values(_1.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,we.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof oi.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 oi.Literal||i instanceof Ms.IRI?i.value: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 Ms.IRI){let s=await this.tripleStore.match(i,we.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof oi.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof oi.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 oi.Literal?this.normalizeWikilink(i.value):i instanceof Ms.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 oi.Literal?i.value:i instanceof Ms.IRI?this.iriToObsidianName(i.value)??i.value:null}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 oi.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof Ms.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,we.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===we.Namespace.EMS.iri.value)return`ems__${s}`;if(i===we.Namespace.EXO.iri.value)return`exo__${s}`;if(i===we.Namespace.EXOCMD.iri.value)return`exocmd__${s}`;if(i===we.Namespace.IMS.iri.value)return`ims__${s}`;if(i===we.Namespace.ZTLK.iri.value)return`ztlk__${s}`;if(i===we.Namespace.PTMS.iri.value)return`ptms__${s}`;if(i===we.Namespace.LIT.iri.value)return`lit__${s}`;if(i===we.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}};js.CommandResolver=b1;js.CommandResolver=b1=Rj([(0,Pj.injectable)(),Oj("design:paramtypes",[Object])],b1)});var M3=S($s=>{"use strict";var Lj=$s&&$s.__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},kj=$s&&$s.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Bu;Object.defineProperty($s,"__esModule",{value:!0});$s.PreconditionEvaluator=void 0;var Mj=ce(),jj=Fu(),$j=Du(),k3=$u(),Vu=Bu=class{static{o(this,"PreconditionEvaluator")}constructor(e){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}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,Bu.SENTINEL_IRI),i=new jj.ExoQLParser().parse(t),a=new $j.ExoQLAlgebraTranslator().translate(i);return new k3.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(Bu.SENTINEL_IRI,t));return await new k3.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=new Date().toISOString(),i=r.slice(0,10),s=new Date,a=new Date(s.getTime()+Bu.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,_=new Date(Date.UTC(c,l,u-p)),b=_.toISOString().slice(0,10),v=new Date(_.getTime()-10080*60*1e3).toISOString().slice(0,10),A=`${c}-${String(l+1).padStart(2,"0")}-01`,R=l===0?11:l-1,W=`${l===0?c-1:c}-${String(R+1).padStart(2,"0")}-01`,ve=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${r}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${b}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${v}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${A}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${W}"^^xsd:date`).replace(/\$thisYearStart/g,`"${ve}"^^xsd:date`).replace(/\$today/g,`"${i}"^^xsd:date`)}};$s.PreconditionEvaluator=Vu;Vu.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";Vu.ALMATY_OFFSET_MS=300*60*1e3;$s.PreconditionEvaluator=Vu=Bu=Lj([(0,Mj.injectable)(),kj("design:paramtypes",[Object])],Vu)});var qn=S(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.FrontmatterService=void 0;var Uu=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}}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)}:.*(?:
|
|
@@ -85,7 +85,7 @@ ${Object.entries(t).map(([a,c])=>this.serializeValue(a,c)).join(`
|
|
|
85
85
|
`)?"":`
|
|
86
86
|
`;return`${i}${s}${e}`}getPropertyValue(e,t){let r=new RegExp(`${this.escapeRegex(t)}:\\s*(.*)$`,"m"),i=e.match(r);return i?i[1].trim():null}serializeValue(e,t){if(Array.isArray(t)){if(t.length===0)return`${e}:`;let r=t.map(i=>` - ${i}`).join(`
|
|
87
87
|
`);return`${e}:
|
|
88
|
-
${r}`}return`${e}: ${String(t)}`}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};Tp.FrontmatterService=Uu;Uu.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/;Uu.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__"}});var Ur=S(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.DateFormatter=void 0;var v1=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)}};Ap.DateFormatter=v1});var Ta=S(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});xp.LoggingService=void 0;var qu=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?`
|
|
88
|
+
${r}`}return`${e}: ${String(t)}`}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};Tp.FrontmatterService=Uu;Uu.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/;Uu.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 Ur=S(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.DateFormatter=void 0;var v1=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)}};Ap.DateFormatter=v1});var Ta=S(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});xp.LoggingService=void 0;var qu=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
91
|
Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`)}}};xp.LoggingService=qu;qu.isVerbose=!1;qu.isDevelopment=void 0});var $3=S(ci=>{"use strict";var Bj=ci&&ci.__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},Vj=ci&&ci.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ci,"__esModule",{value:!0});ci.GroundingExecutor=ci.ServiceRegistry=void 0;var Uj=ce(),qj=_n(),To=dc(),Wj=qn(),Gj=Ur(),zj=Ta();function Hj(n){if(!n)return;let e=n.match(/^"?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]"?$/);return e?e[1]:n}o(Hj,"extractClassFromTargetValue");var Cp=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())}};ci.ServiceRegistry=Cp;var j3=20,w1=class{static{o(this,"GroundingExecutor")}constructor(e,t,r){this.frontmatterService=new Wj.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r}async execute(e,t,r,i){try{switch(e.type){case To.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case To.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case To.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case To.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case To.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,i);case To.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"};if(e.targetValue===void 0)return{success:!1,error:"property_set requires targetValue"};if(/\$(input|value)\b/.test(e.targetValue)&&(i===void 0||i.value===void 0||i.value===null))return{success:!1,error:"property_set: targetValue contains $input/$value placeholder but no userInput.value provided"};let a=this.substituteVariables(e.targetValue,t,i),c=await this.fileReader.readFile(r),l=this.frontmatterService.updateProperty(c,e.targetProperty,a);return await this.fileWriter.updateFile(r,l),{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>=j3)return{success:!1,error:`Composite grounding exceeded maximum depth of ${j3}`};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=Hj(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.targetValue)try{let l=JSON.parse(e.targetValue);typeof l=="object"&&l!==null&&(c={...l,...i??{}})}catch{}return await a.execute(t,c),{success:!0}}async executeConvertToTask(e){let t=await this.fileReader.readFile(e),r=this.frontmatterService.updateProperty(t,"exo__Instance_class",'["[[ems__Task]]"]');return await this.fileWriter.updateFile(e,r),{success:!0}}async executeConvertToProject(e){let t=await this.fileReader.readFile(e),r=this.frontmatterService.updateProperty(t,"exo__Instance_class",'["[[ems__Project]]"]');return await this.fileWriter.updateFile(e,r),{success:!0}}async executeCreateInstance(e,t,r){if(!e.targetFolder)return{success:!1,error:"create_instance requires targetFolder"};let i=(0,qj.v4)(),s=r?.label??"Untitled",a={exo__Asset_uid:i,exo__Asset_createdAt:new Date().toISOString(),exo__Asset_label:s};if(s!=="Untitled"&&(a.aliases=[s]),e.targetClass&&(a.exo__Instance_class=[`"[[${e.targetClass}]]"`]),e.targetPrototype&&(a.exo__Asset_prototype=`"[[${e.targetPrototype}]]"`),t&&(a.exo__Asset_source=`"[[${t}]]"`),r)for(let[u,f]of Object.entries(r))u!=="label"&&f!=null&&(a[u]=f);let c=this.frontmatterService.createFrontmatter("",a),l=`${e.targetFolder}/${i}.md`;return await this.fileWriter.createFile(l,c),{success:!0}}async executeStep(e,t,r,i,s){return e.type===To.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){zj.LoggingService.error(`[GroundingExecutor] Rollback failed for ${t}`,i instanceof Error?i:new Error(String(i)))}}substituteVariables(e,t,r){let i=new Date,s=i.toISOString(),a=Gj.DateFormatter.toLocalTimestamp(i),c=s.slice(0,10),l=e.replace(/\$target/g,t).replace(/\$nowLocal/g,a).replace(/\$now/g,s).replace(/\$today/g,c);if(r?.value!==void 0&&r.value!==null){let u=String(r.value);l=l.replace(/\$input\b/g,u).replace(/\$value\b/g,u)}return l}};ci.GroundingExecutor=w1;ci.GroundingExecutor=w1=Bj([(0,Uj.injectable)(),Vj("design:paramtypes",[Object,Object,Cp])],w1)});var Wu=S(Bs=>{"use strict";var Qj=Bs&&Bs.__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},Yj=Bs&&Bs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.WorkflowEngine=void 0;var Kj=ce(),E1=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}}};Bs.WorkflowEngine=E1;Bs.WorkflowEngine=E1=Qj([(0,Kj.injectable)(),Yj("design:paramtypes",[Object])],E1)});var B3=S(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.EFFORT_WORKFLOW_PROPERTY=rs.WorkflowTransitionProperty=rs.WorkflowStateProperty=rs.WorkflowProperty=void 0;rs.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};rs.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"};rs.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"};rs.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var ns=S(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.MetadataHelpers=void 0;var T1=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(`
|
|
@@ -214,7 +214,7 @@ ${s}`}return`${r}: ${i}`}).join(`
|
|
|
214
214
|
`,a=await this.sparqlService.query(s);return this.buildEnumValues(a)}buildEnumValues(e){let t=[],r=new Set;for(let i of e){let s=this.getBindingValue(i,"instance");if(!s||r.has(s))continue;r.add(s);let a=this.getBindingValue(i,"label")??s,l=`[[${this.fromFullIRI(s)}]]`;t.push({value:l,label:a})}return t}buildRankProperty(e){let t=e.match(/^([a-z]+)__(.+)$/);if(!t)return null;let[,r,i]=t;return`${r}__${i}_rank`}normalizeClassName(e){return e.replace(/\[\[|\]\]/g,"").trim()}getBindingValue(e,t){let r=e.get(t);if(r!=null)return String(r)}toFullIRI(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;let t=e.match(/^([a-z]+)__(.+)$/);if(t){let[,r,i]=t;return`https://exocortex.my/ontology/${r}#${i}`}return e}fromFullIRI(e){let t=e.match(/https:\/\/exocortex\.my\/ontology\/([a-z]+)#(.+)$/);if(t){let[,r,i]=t;return`${r}__${i}`}return e}};Ys.EnumValueResolver=xS;Ys.EnumValueResolver=xS=t6([(0,n6.injectable)(),r6("design:paramtypes",[Object,Object])],xS)});var IS=S(Ei=>{"use strict";var i6=Ei&&Ei.__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},s6=Ei&&Ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},a6=Ei&&Ei.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.AssetConversionService=void 0;var yA=ce(),_A=On(),o6=qn(),Vp=Ta(),c6=wt(),CS=class{static{o(this,"AssetConversionService")}constructor(e){this.vault=e,this.frontmatterService=new o6.FrontmatterService}async convertTaskToProject(e){try{let t=await this.vault.read(e),r=this.removeInstanceClassProperty(t);return r=this.frontmatterService.updateProperty(r,"exo__Instance_class",`["[[${_A.AssetClass.PROJECT}]]"]`),await this.vault.modify(e,r),Vp.LoggingService.info(`Converted Task to Project: ${e.basename} (${e.path})`),e}catch(t){let r=`Failed to convert Task to Project: ${e.path}`;throw Vp.LoggingService.error(r,t instanceof Error?t:void 0),new Error(r)}}async convertProjectToTask(e){try{let t=await this.vault.read(e),r=this.removeInstanceClassProperty(t);return r=this.frontmatterService.updateProperty(r,"exo__Instance_class",`["[[${_A.AssetClass.TASK}]]"]`),await this.vault.modify(e,r),Vp.LoggingService.info(`Converted Project to Task: ${e.basename} (${e.path})`),e}catch(t){let r=`Failed to convert Project to Task: ${e.path}`;throw Vp.LoggingService.error(r,t instanceof Error?t:void 0),new Error(r)}}removeInstanceClassProperty(e){let t=this.frontmatterService.parse(e);if(!t.exists)return e;let r=/^exo__Instance_class:.*$(\n -.*$)*/gm,i=t.content.replace(r,"").replace(/\n\n+/g,`
|
|
215
215
|
`).trim();return e.replace(/^---\n[\s\S]*?\n---/,`---
|
|
216
216
|
${i}
|
|
217
|
-
---`)}};Ei.AssetConversionService=CS;Ei.AssetConversionService=CS=i6([(0,yA.injectable)(),a6(0,(0,yA.inject)(c6.DI_TOKENS.IVaultAdapter)),s6("design:paramtypes",[Object])],CS)});var PS=S(Ti=>{"use strict";var l6=Ti&&Ti.__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},u6=Ti&&Ti.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},SA=Ti&&Ti.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.SessionEventService=void 0;var RS=ce(),f6=_n(),bA=On(),d6=Ur(),h6=ns(),vA=wt(),OS=class{static{o(this,"SessionEventService")}constructor(e,t){this.vault=e,this.vaultSettings=t,this.folderPathCache=null}async createSessionStartEvent(e){return this.createSessionEvent(e,bA.AssetClass.SESSION_START_EVENT)}async createSessionEndEvent(e){return this.createSessionEvent(e,bA.AssetClass.SESSION_END_EVENT)}getSessionEventFolder(){if(this.folderPathCache!==null)return this.folderPathCache;let e=this.vault.getDefaultNewFileParent();return this.folderPathCache=e?.path||"",this.folderPathCache}async createSessionEvent(e,t){let r=(0,f6.v4)(),i=d6.DateFormatter.toLocalTimestamp(new Date),s={exo__Asset_uid:r,exo__Asset_createdAt:i,exo__Asset_isDefinedBy:this.vaultSettings.getOwnerIdentity(),exo__Instance_class:[`"[[${t}]]"`],ems__SessionEvent_timestamp:i,ems__Session_area:`"[[${e}]]"`},a=h6.MetadataHelpers.buildFileContent(s),c=this.getSessionEventFolder();c&&!await this.vault.exists(c)&&await this.vault.createFolder(c);let l=c?`${c}/${r}.md`:`${r}.md`;return await this.vault.create(l,a)}};Ti.SessionEventService=OS;Ti.SessionEventService=OS=l6([(0,RS.injectable)(),SA(0,(0,RS.inject)(vA.DI_TOKENS.IVaultAdapter)),SA(1,(0,RS.inject)(vA.DI_TOKENS.IVaultSettings)),u6("design:paramtypes",[Object,Object])],OS)});var NS=S(Ai=>{"use strict";var p6=Ai&&Ai.__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},m6=Ai&&Ai.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},wA=Ai&&Ai.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.URIConstructionService=void 0;var FS=ce(),EA=wt(),g6=Hu(),DS=class{static{o(this,"URIConstructionService")}constructor(e,t=g6.NullLogger){this.fileSystem=e,this.logger=t,this.defaultOntologyURL="https://exocortex.my/default/",this.strictValidation=!0}configure(e){e?.defaultOntologyURL&&(this.defaultOntologyURL=e.defaultOntologyURL),e?.strictValidation!==void 0&&(this.strictValidation=e.strictValidation)}async constructAssetURI(e){let t=this.extractUID(e);if(!t){if(this.strictValidation)throw new Error(`Asset missing exo__Asset_uid: ${e.path}`);return this.logger.warn(`Asset ${e.path} missing UID, using filename fallback`),this.constructFallbackURI(e)}let r=await this.resolveOntologyURL(e);if(!this.validateOntologyURL(r))throw new Error(`Invalid ontology URL: ${r}`);return`${r.endsWith("/")?r:`${r}/`}${t}`}validateOntologyURL(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}async resolveOntologyURL(e){let t=e.frontmatter?.exo__Asset_isDefinedBy;if(!t||typeof t!="string")return this.defaultOntologyURL;let r=this.extractWikiLink(t),i=r,s=await this.fileSystem.fileExists(r);return!s&&!r.endsWith(".md")&&(i=`${r}.md`,s=await this.fileSystem.fileExists(i)),s?(await this.fileSystem.getFileMetadata(i))?.exo__Ontology_url||this.defaultOntologyURL:(this.logger.warn(`Ontology file not found: ${r}, using default`),this.defaultOntologyURL)}extractUID(e){let t=e.frontmatter?.exo__Asset_uid;return typeof t=="string"?t:null}extractWikiLink(e){return e.replace(/^\[\[|\]\]$/g,"")}constructFallbackURI(e){let t=e.path.split("/").pop()?.replace(".md","")||"unknown";return`${this.defaultOntologyURL}${t}`}};Ai.URIConstructionService=DS;Ai.URIConstructionService=DS=p6([(0,FS.injectable)(),wA(0,(0,FS.inject)(EA.DI_TOKENS.IFileSystemAdapter)),wA(1,(0,FS.inject)(EA.DI_TOKENS.ILogger)),m6("design:paramtypes",[Object,Object])],DS)});var kS=S(xi=>{"use strict";var y6=xi&&xi.__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},_6=xi&&xi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},S6=xi&&xi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(xi,"__esModule",{value:!0});xi.GenericAssetCreationService=void 0;var TA=ce(),b6=_n(),Yu=Ur(),v6=ns(),w6=wt(),is=ch(),LS=class{static{o(this,"GenericAssetCreationService")}constructor(e){this.vault=e}async createAsset(e,t){let r=(0,b6.v4)(),i=`${r}.md`,s=this.generateFrontmatter(e,t||[],r),a=v6.MetadataHelpers.buildFileContent(s),c=e.folderPath||this.getDefaultFolderPath(e);this.vault.getAbstractFileByPath(c)||await this.vault.createFolder(c);let u=c?`${c}/${i}`:i;return await this.vault.create(u,a)}generateFrontmatter(e,t,r){let i=new Date,s={},a=new Map;for(let c of t)a.set(c.name,c.fieldType);if(s.exo__Asset_uid=r,s.exo__Asset_createdAt=Yu.DateFormatter.toLocalTimestamp(i),s.exo__Instance_class=[this.formatWikilink(e.className)],e.label&&e.label.trim()!==""){let c=e.label.trim();s.exo__Asset_label=c,s.aliases=[c]}if(e.parentFile&&e.parentMetadata&&this.inheritParentContext(s,e),e.propertyValues)for(let[c,l]of Object.entries(e.propertyValues)){if(c==="exo__Asset_uid"||c==="exo__Asset_createdAt"||c==="exo__Instance_class"||c==="exo__Asset_label"||c==="aliases"||l==null)continue;let u=a.get(c);s[c]=this.formatValue(l,u)}return s}inheritParentContext(e,t){let r=t.parentMetadata||{},i=t.parentFile?.basename;if(t.className==="ems__Task"||t.className.startsWith("ems__Task")){let s=r.exo__Instance_class,c=this.isAreaClass(s)?"ems__Effort_area":"ems__Effort_parent";e[c]=i?this.formatWikilink(i):null}if(t.className==="ems__Project"||t.className.startsWith("ems__Project")){let s=r.exo__Instance_class,c=this.isAreaClass(s)?"ems__Effort_area":"ems__Effort_parent";e[c]=i?this.formatWikilink(i):null}if(r.exo__Asset_isDefinedBy){let s=r.exo__Asset_isDefinedBy;e.exo__Asset_isDefinedBy=typeof s=="string"?this.formatWikilink(s):s}}isAreaClass(e){return e?(Array.isArray(e)?e:[e]).some(r=>String(r).includes("Area")||String(r).includes("ems__Area")):!1}getDefaultFolderPath(e){if(e.parentFile?.parent?.path)return e.parentFile.parent.path;let t={ems__Task:"tasks",ems__Project:"projects",ems__Area:"areas",ems__Meeting:"meetings",exo__Event:"events",ims__Concept:"concepts"};if(t[e.className])return t[e.className];for(let[r,i]of Object.entries(t))if(e.className.startsWith(r))return i;return"assets"}formatValue(e,t){if(e==null)return null;if(!t)return this.formatInferredValue(e);switch(t){case is.PropertyFieldType.Text:return String(e);case is.PropertyFieldType.Wikilink:case is.PropertyFieldType.Reference:case is.PropertyFieldType.StatusSelect:case is.PropertyFieldType.SizeSelect:return this.formatWikilink(String(e));case is.PropertyFieldType.Number:return typeof e=="number"?e:Number(e)||0;case is.PropertyFieldType.Boolean:return this.formatBoolean(e);case is.PropertyFieldType.Date:case is.PropertyFieldType.DateTime:case is.PropertyFieldType.Timestamp:return this.formatTimestamp(e);default:return String(e)}}formatInferredValue(e){return typeof e=="boolean"||typeof e=="number"?e:e instanceof Date?Yu.DateFormatter.toLocalTimestamp(e):typeof e=="string"?e.startsWith("[[")||e.startsWith('"[[')?this.formatWikilink(e):e:String(e)}formatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:`"[[${e}]]"`}formatBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"}return typeof e=="number"?e!==0:!!e}formatTimestamp(e){if(e instanceof Date)return Yu.DateFormatter.toLocalTimestamp(e);if(typeof e=="string"){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))return e;if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e.replace("Z","");let t=new Date(e);return isNaN(t.getTime())?e:Yu.DateFormatter.toLocalTimestamp(t)}if(typeof e=="number"){let t=new Date(e);if(!isNaN(t.getTime()))return Yu.DateFormatter.toLocalTimestamp(t)}return String(e)}};xi.GenericAssetCreationService=LS;xi.GenericAssetCreationService=LS=y6([(0,TA.injectable)(),S6(0,(0,TA.inject)(w6.DI_TOKENS.IVaultAdapter)),_6("design:paramtypes",[Object])],LS)});var xA=S(Ci=>{"use strict";var E6=Ci&&Ci.__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},T6=Ci&&Ci.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},A6=Ci&&Ci.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.ArchiveAssetService=void 0;var AA=ce(),x6=wt(),C6=qn(),MS=class{static{o(this,"ArchiveAssetService")}constructor(e){this.vault=e,this.frontmatterService=new C6.FrontmatterService}async archiveAsset(e){let t=await this.vault.read(e),r=this.frontmatterService.updateProperty(t,"archived","true");r=this.frontmatterService.removeProperty(r,"aliases"),r!==t&&await this.vault.modify(e,r)}};Ci.ArchiveAssetService=MS;Ci.ArchiveAssetService=MS=E6([(0,AA.injectable)(),A6(0,(0,AA.inject)(x6.DI_TOKENS.IVaultAdapter)),T6("design:paramtypes",[Object])],MS)});var IA=S(Ii=>{"use strict";var I6=Ii&&Ii.__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},R6=Ii&&Ii.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},O6=Ii&&Ii.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.FixMissingLabelService=void 0;var CA=ce(),P6=wt(),F6=qn(),jS=class{static{o(this,"FixMissingLabelService")}constructor(e){this.vault=e,this.frontmatterService=new F6.FrontmatterService}async fixMissingLabel(e){let t=await this.vault.read(e);if(this.hasNonEmptyLabel(t))return;let r=this.frontmatterService.updateProperty(t,"exo__Asset_label",e.basename);r!==t&&await this.vault.modify(e,r)}hasNonEmptyLabel(e){let t=this.frontmatterService.parse(e);if(!t.exists)return!1;let r=t.content.match(/^exo__Asset_label:\s*(.*)$/m);if(!r)return!1;let i=r[1].trim();return!(i===""||i==='""'||i==="''")}};Ii.FixMissingLabelService=jS;Ii.FixMissingLabelService=jS=I6([(0,CA.injectable)(),O6(0,(0,CA.inject)(P6.DI_TOKENS.IVaultAdapter)),R6("design:paramtypes",[Object])],jS)});var RA=S(Ks=>{"use strict";var D6=Ks&&Ks.__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},N6=Ks&&Ks.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.GraphQueryService=void 0;var L6=ce(),Ku=xe(),k6=He(),Ca=Cr(),M6=$y(),ss={INSTANCE_CLASS:Ca.Namespace.EXO.term("Instance_class"),ASSET_LABEL:Ca.Namespace.EXO.term("Asset_label"),ASSET_PROTOTYPE:Ca.Namespace.EXO.term("Asset_prototype"),ASSET_IS_ARCHIVED:Ca.Namespace.EXO.term("Asset_isArchived"),EFFORT_PARENT:Ca.Namespace.EMS.term("Effort_parent"),REFERENCES:Ca.Namespace.EXO.term("references"),REFERENCED_BY:Ca.Namespace.EXO.term("referencedBy"),RDF_TYPE:Ca.Namespace.RDF.term("type")},$S=class{static{o(this,"GraphQueryService")}constructor(e,t={},r){this.subscribers=new Set,this.nodeCache=new Map,this.lastCacheUpdate=0,this.tripleStore=e,this.logger=r,this.config={defaultLimit:t.defaultLimit??100,maxLimit:t.maxLimit??1e4,defaultDepth:t.defaultDepth??2,maxDepth:t.maxDepth??10,includeArchivedByDefault:t.includeArchivedByDefault??!1,cacheTTL:t.cacheTTL??3e4}}async loadGraphData(e={}){let t=Date.now(),r=await this.loadNodes(e),i=await this.loadEdges(r,e),s=this.computeStats(r,i),a=Date.now()-t;return a>100&&r.length>0&&this.logger?.debug(`GraphQueryService: loaded ${r.length} nodes in ${a}ms (${(a/r.length).toFixed(2)}ms/node)`),{nodes:r,edges:i,stats:s,lastUpdated:Date.now(),version:1}}async loadNodesIncremental(e={}){let t=Math.min(e.limit??this.config.defaultLimit,this.config.maxLimit),r=e.offset??0,i=await this.loadNodes({...e,limit:t+1,offset:r}),s=i.length>t,a=s?i.slice(0,t):i,c=await this.loadEdges(a,e);return{nodes:a,edges:c,hasMore:s,totalCount:void 0,cursor:s?String(r+t):void 0}}async loadConnectedNodes(e,t={}){let r=Math.min(t.depth??this.config.defaultDepth,this.config.maxDepth),i=Math.min(t.limit??this.config.maxLimit,this.config.maxLimit),s=new Set,a=[{id:e,currentDepth:0}],c=[];for(;a.length>0&&c.length<i;){let u=a.shift();if(!u)break;let{id:f,currentDepth:d}=u;if(s.has(f))continue;s.add(f);let h=await this.getNodeById(f,t);if(h&&(c.push(h),d<r)){let p=await this.getConnectedNodeIds(f);for(let _ of p)s.has(_)||a.push({id:_,currentDepth:d+1})}}let l=await this.loadEdges(c,t);return{nodes:c,edges:l,hasMore:a.length>0,totalCount:s.size+a.length}}async getNodeById(e,t={}){let r=this.getCachedNode(e);if(r)return{...r};let i=this.idToIRI(e),s=await this.tripleStore.match(i,void 0,void 0);if(s.length===0)return null;let a=this.triplesToNode(e,s,t);return a&&this.cacheNode(a),a}subscribe(e){return this.subscribers.add(e),{unsubscribe:o(()=>{this.subscribers.delete(e)},"unsubscribe")}}notifyChange(e){for(let t of this.subscribers)try{t(e)}catch(r){this.logger?.error("GraphQueryService: error in subscriber callback",r instanceof Error?r:new Error(String(r)))}this.invalidateCache()}async getStats(){let e=await this.loadNodes({includeArchived:!0}),t=await this.loadEdges(e,{});return this.computeStats(e,t)}clearCache(){this.nodeCache.clear(),this.lastCacheUpdate=0}async loadNodes(e){let t=e.includeArchived??this.config.includeArchivedByDefault,r=e.limit??this.config.maxLimit,i=e.offset??0,s=await this.tripleStore.match(void 0,ss.INSTANCE_CLASS,void 0),a=s;if(e.classes&&e.classes.length>0){let p=new Set(e.classes);a=s.filter(_=>{let b=this.getObjectValue(_.object);return b&&p.has(b)})}let c=new Set;for(let p of a)c.add(this.subjectToId(p.subject));let f=Array.from(c).slice(i,i+r).map(p=>this.getNodeById(p,e));return(await Promise.all(f)).filter(p=>!(!p||!t&&p.isArchived))}async loadEdges(e,t){let r=new Set(e.map(a=>a.id)),i=[],s=new Set;for(let a of e){let c=this.idToIRI(a.id),l=await this.tripleStore.match(c,void 0,void 0);for(let u of l){let f=this.tripleToEdge(a.id,u,r);f&&f.id&&!s.has(f.id)&&(!t.edgeTypes||t.edgeTypes.includes(f.type))&&(s.add(f.id),i.push(f))}}return i}async getConnectedNodeIds(e){let t=this.idToIRI(e),r=[],i=await this.tripleStore.match(t,void 0,void 0);for(let a of i){let c=this.objectToId(a.object);c&&r.push(c)}let s=await this.tripleStore.match(void 0,void 0,t);for(let a of s)r.push(this.subjectToId(a.subject));return[...new Set(r)]}triplesToNode(e,t,r){let i={},s,a,c,l,u=!1;for(let h of t){let p=h.predicate.value,_=this.getObjectValue(h.object);if(p===ss.INSTANCE_CLASS.value)s=_;else if(p===ss.ASSET_LABEL.value)a=_;else if(p===ss.ASSET_PROTOTYPE.value)c=this.objectToId(h.object)??_;else if(p===ss.EFFORT_PARENT.value)l=this.objectToId(h.object)??_;else if(p===ss.ASSET_IS_ARCHIVED.value)u=_==="true"||_==="1";else{let b=this.predicateToPropertyName(p);b&&(i[b]=_)}}if(u&&!(r.includeArchived??this.config.includeArchivedByDefault))return null;let f=this.idToPath(e),d=a??this.pathToTitle(f);return{id:e,path:f,title:d,label:d,assetClass:s,isArchived:u,uri:e.startsWith("http")?e:void 0,prototype:c,parent:l,properties:Object.keys(i).length>0?i:void 0}}tripleToEdge(e,t,r){let i=t.predicate.value,s=this.objectToId(t.object);if(!s||!r.has(s)||s===e)return null;let a=this.predicateToEdgeType(i);if(!a)return null;let c=(0,M6.createEdgeId)(e,s,a,i),l=this.predicateToLabel(i);return{id:c,source:e,target:s,type:a,predicate:i,label:l}}predicateToEdgeType(e){return e===ss.EFFORT_PARENT.value?"hierarchy":e===ss.ASSET_PROTOTYPE.value?"prototype":e===ss.REFERENCES.value?"forward-link":e===ss.REFERENCED_BY.value?"backlink":e.includes("Asset_")||e.includes("Instance_")?null:"semantic"}predicateToLabel(e){let t=e.lastIndexOf("#"),r=e.lastIndexOf("/"),i=Math.max(t,r);return i>=0?e.substring(i+1):e}predicateToPropertyName(e){return this.predicateToLabel(e).replace(/_/g,"__").replace(/#/g,"_")}computeStats(e,t){let r={},i={backlink:0,"forward-link":0,hierarchy:0,prototype:0,semantic:0,reference:0};for(let c of e){let l=c.assetClass??"unknown";r[l]=(r[l]??0)+1}for(let c of t)i[c.type]=(i[c.type]??0)+1;let s=new Map,a=new Map;for(let c of t)a.set(c.source,(a.get(c.source)??0)+1),s.set(c.target,(s.get(c.target)??0)+1);for(let c of e)c.inDegree=s.get(c.id)??0,c.outDegree=a.get(c.id)??0,c.weight=c.inDegree+c.outDegree;return{nodeCount:e.length,edgeCount:t.length,nodesByClass:r,edgesByType:i,computedAt:Date.now()}}idToIRI(e){return e.startsWith("http://")||e.startsWith("https://")?new Ku.IRI(e):new Ku.IRI(`obsidian://vault/${encodeURIComponent(e)}`)}subjectToId(e){if(e instanceof Ku.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return e.toString()}objectToId(e){if(e instanceof Ku.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return null}getObjectValue(e){if(e instanceof k6.Literal||e instanceof Ku.IRI)return e.value}idToPath(e){if(e.startsWith("obsidian://vault/"))return decodeURIComponent(e.replace("obsidian://vault/",""));if(e.startsWith("http://")||e.startsWith("https://")){let t=e.match(/\/([^/]+\.md)$/);if(t)return t[1]}return e}pathToTitle(e){return(e.split("/").pop()??e).replace(/\.md$/,"")}getCachedNode(e){return Date.now()-this.lastCacheUpdate>this.config.cacheTTL?(this.clearCache(),null):this.nodeCache.get(e)??null}cacheNode(e){this.nodeCache.set(e.id,e),this.lastCacheUpdate===0&&(this.lastCacheUpdate=Date.now())}invalidateCache(){this.clearCache()}};Ks.GraphQueryService=$S;Ks.GraphQueryService=$S=D6([(0,L6.injectable)(),N6("design:paramtypes",[Object,Object,Object])],$S)});var PA=S(Xs=>{"use strict";var j6=Xs&&Xs.__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},$6=Xs&&Xs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.TypeRegistry=void 0;var B6=ce(),as=xe(),OA=qt(),V6=He(),U6=Ta(),dt=By(),BS=class{static{o(this,"TypeRegistry")}constructor(e=null,t={}){this.nodeTypes=new Map,this.edgeTypes=new Map,this.typeHierarchy=new Map,this.subscribers=new Set,this.discoveryComplete=!1,this.tripleStore=e,this.config={autoDiscoverTypes:t.autoDiscoverTypes??!0,includeBuiltInStyles:t.includeBuiltInStyles??!0,styleResolution:t.styleResolution??{mergeStyles:!0,inheritParentStyles:!0,defaultNodeStyle:dt.DEFAULT_NODE_STYLE,defaultEdgeStyle:dt.DEFAULT_EDGE_STYLE},maxInheritanceDepth:t.maxInheritanceDepth??10},this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerNodeType(e){let r=this.nodeTypes.get(e.uri)?"type-updated":"type-added";this.nodeTypes.set(e.uri,e),e.parentTypes&&e.parentTypes.length>0&&this.typeHierarchy.set(e.uri,e.parentTypes),this.emit({type:r,typeUri:e.uri,definition:e})}registerEdgeType(e){let r=this.edgeTypes.get(e.uri)?"type-updated":"type-added";this.edgeTypes.set(e.uri,e),this.emit({type:r,typeUri:e.uri,definition:e})}unregisterType(e){let t=this.nodeTypes.delete(e),r=this.edgeTypes.delete(e);this.typeHierarchy.delete(e),(t||r)&&this.emit({type:"type-removed",typeUri:e})}getNodeType(e){return this.nodeTypes.get(e)}getEdgeType(e){return this.edgeTypes.get(e)}getAllNodeTypes(){return Array.from(this.nodeTypes.values())}getAllEdgeTypes(){return Array.from(this.edgeTypes.values())}getParentTypes(e,t=this.config.maxInheritanceDepth){let r=[],i=new Set,s=[{uri:e,currentDepth:0}];for(;s.length>0;){let a=s.shift();if(!a)break;let{uri:c,currentDepth:l}=a;if(i.has(c)||(i.add(c),l>=t))continue;let u=this.typeHierarchy.get(c)??[];for(let f of u)i.has(f)||(r.push(f),s.push({uri:f,currentDepth:l+1}))}return r}getChildTypes(e){let t=[];for(let[r,i]of this.typeHierarchy)i.includes(e)&&t.push(r);return t}isSubtypeOf(e,t){return e===t?!0:this.getParentTypes(e).includes(t)}resolveNodeType(e){let t=[],r="unknown",i="custom";if(e.assetClass){let c=this.normalizeTypeUri(e.assetClass);t.push(c),r=c,i="exo:Instance_class"}let s=e.properties?.[dt.RDF_TYPE_PREDICATES.RDF_TYPE];s&&!t.includes(s)&&(t.push(s),r==="unknown"&&(r=s,i="rdf:type"));for(let c of[...t]){let l=this.getParentTypes(c);for(let u of l)t.includes(u)||t.push(u)}let a=this.resolveNodeStyle(t);return{primaryType:r,types:t,resolvedStyle:a,source:i}}resolveEdgeType(e){let t=e.predicate??e.type,r=e.predicate?"rdf:type":"custom",i=this.resolveEdgeStyle(t);return{primaryType:t,resolvedStyle:i,source:r}}resolveNodeStyle(e){let{mergeStyles:t,defaultNodeStyle:r}=this.config.styleResolution,i={...r},s=[];for(let a of e){let c=this.nodeTypes.get(a);c&&s.push(c)}if(s.sort((a,c)=>a.priority-c.priority),t)for(let a of s)i=(0,dt.mergeNodeStyles)(i,a.style);else if(s.length>0){let a=s[s.length-1];i=(0,dt.mergeNodeStyles)(i,a.style)}return i}resolveEdgeStyle(e){let{defaultEdgeStyle:t}=this.config.styleResolution,r={...t},i=this.edgeTypes.get(e);return i&&(r=(0,dt.mergeEdgeStyles)(r,i.style)),r}filterNodes(e,t){return e.filter(r=>{let i=this.resolveNodeType(r);return!(t.includeNodeTypes&&t.includeNodeTypes.length>0&&!t.includeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||t.excludeNodeTypes&&t.excludeNodeTypes.length>0&&t.excludeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||!t.includeDeprecated&&this.nodeTypes.get(i.primaryType)?.deprecated)})}filterEdges(e,t){return e.filter(r=>{let i=r.predicate??r.type;return!(t.includeEdgeTypes&&t.includeEdgeTypes.length>0&&!t.includeEdgeTypes.includes(i)||t.excludeEdgeTypes&&t.excludeEdgeTypes.length>0&&t.excludeEdgeTypes.includes(i))})}groupNodesByType(e,t,r={}){let{groupByNodeType:i=!0,groupByParentType:s=!1,groupLevel:a=0,maxGroups:c=20,customGroupFn:l}=r,u=new Map;for(let h of e){let p=this.resolveNodeType(h),_;if(l?_=l(p.types):s&&p.types.length>a?_=p.types[a]??p.primaryType:i?_=p.primaryType:_="all",!u.has(_)){let v=this.nodeTypes.get(_)?.label??(0,dt.extractLocalName)(_);u.set(_,{nodeIds:new Set,label:v})}let b=u.get(_);b&&b.nodeIds.add(h.id)}let f=Array.from(u.entries()).map(([h,p])=>({id:h,label:p.label,nodeIds:Array.from(p.nodeIds)}));if(f.length>c){f.sort((_,b)=>b.nodeIds.length-_.nodeIds.length);let h=f.slice(0,c-1),p=f.slice(c-1).flatMap(_=>_.nodeIds);h.push({id:"other",label:"Other",nodeIds:p}),f=h}let d=new Map;for(let h of f)for(let p of h.nodeIds)d.set(p,h.id);return f.map((h,p)=>{let _=new Set(h.nodeIds),b=[],E=[];for(let R of t){let B=_.has(R.source),W=_.has(R.target);B&&W?R.id&&b.push(R.id):(B||W)&&R.id&&E.push(R.id)}let A=`hsl(${p*137.5%360}, 70%, 50%)`;return{id:h.id,label:h.label,nodeIds:h.nodeIds,internalEdgeIds:b,externalEdgeIds:E,color:A,stats:{nodeCount:h.nodeIds.length,internalEdgeCount:b.length,externalEdgeCount:E.length}}})}validateTypes(e,t){let r=[],i=[];for(let s of e){let a=this.resolveNodeType(s);if(a.primaryType!=="unknown"){let c=this.nodeTypes.get(a.primaryType);!c&&a.source!=="inferred"&&i.push({code:"UNREGISTERED_NODE_TYPE",message:`Node type "${a.primaryType}" is not registered`,elementId:s.id,suggestion:"Register the type with registerNodeType()"}),c?.deprecated&&i.push({code:"DEPRECATED_NODE_TYPE",message:`Node uses deprecated type "${a.primaryType}"`,elementId:s.id,suggestion:"Migrate to a non-deprecated type"})}else i.push({code:"MISSING_NODE_TYPE",message:"Node has no type information",elementId:s.id,suggestion:"Add exo:Instance_class or rdf:type to the node"})}for(let s of t){let a=s.predicate??s.type,c=this.edgeTypes.get(a);if(c?.domain&&c.domain.length>0){let l=e.find(u=>u.id===s.source);if(l){let u=this.resolveNodeType(l);c.domain.some(d=>u.types.includes(d))||r.push({code:"DOMAIN_VIOLATION",message:"Edge source does not match expected domain",elementId:s.id,expected:c.domain,actual:u.types})}}if(c?.range&&c.range.length>0){let l=e.find(u=>u.id===s.target);if(l){let u=this.resolveNodeType(l);c.range.some(d=>u.types.includes(d))||r.push({code:"RANGE_VIOLATION",message:"Edge target does not match expected range",elementId:s.id,expected:c.range,actual:u.types})}}}return{valid:r.length===0,errors:r,warnings:i}}async discoverTypes(){if(!this.tripleStore||this.discoveryComplete)return;let e=await this.tripleStore.match(void 0,new as.IRI(dt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let r of e){let i=this.getObjectValue(r.object);if(i&&(0,dt.isClassType)(i)){let s=this.getSubjectValue(r.subject);s&&await this.discoverNodeType(s)}}let t=await this.tripleStore.match(void 0,new as.IRI(dt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF),void 0);for(let r of t){let i=this.getSubjectValue(r.subject),s=this.getObjectValue(r.object);if(i&&s){let a=this.typeHierarchy.get(i)??[];if(!a.includes(s)){a.push(s),this.typeHierarchy.set(i,a);let c=this.nodeTypes.get(i);c&&(c.parentTypes=a)}}}this.discoveryComplete=!0,this.emit({type:"hierarchy-updated",rootTypes:this.getRootTypes()})}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}clear(){this.nodeTypes.clear(),this.edgeTypes.clear(),this.typeHierarchy.clear(),this.discoveryComplete=!1,this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerBuiltInTypes(){for(let[e,t]of Object.entries(dt.BUILT_IN_NODE_STYLES))this.nodeTypes.set(e,{uri:e,label:(0,dt.extractLocalName)(e),source:"custom",style:(0,dt.mergeNodeStyles)(dt.DEFAULT_NODE_STYLE,t),priority:1});for(let[e,t]of Object.entries(dt.BUILT_IN_EDGE_STYLES))this.edgeTypes.set(e,{uri:e,label:(0,dt.extractLocalName)(e),source:"custom",style:(0,dt.mergeEdgeStyles)(dt.DEFAULT_EDGE_STYLE,t),priority:1})}async discoverNodeType(e){if(this.nodeTypes.has(e)||!this.tripleStore)return;let t=await this.tripleStore.match(new as.IRI(e),new as.IRI(dt.RDF_TYPE_PREDICATES.RDFS_LABEL),void 0),r=await this.tripleStore.match(new as.IRI(e),new as.IRI(dt.RDF_TYPE_PREDICATES.RDFS_COMMENT),void 0),i=t.length>0?this.getObjectValue(t[0].object)??(0,dt.extractLocalName)(e):(0,dt.extractLocalName)(e),s=r.length>0?this.getObjectValue(r[0].object):void 0,a="rdfs:Class",c=await this.tripleStore.match(new as.IRI(e),new as.IRI(dt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let f of c)if(this.getObjectValue(f.object)===dt.RDF_TYPE_PREDICATES.OWL_CLASS){a="owl:Class";break}let l=dt.BUILT_IN_NODE_STYLES[e]??dt.BUILT_IN_NODE_STYLES[(0,dt.extractLocalName)(e)],u={uri:e,label:i,description:s,source:a,style:(0,dt.mergeNodeStyles)(dt.DEFAULT_NODE_STYLE,l??{}),priority:1};this.registerNodeType(u)}normalizeTypeUri(e){let t=e.match(/^\[\[(.+?)\]\]$/);return t?t[1]:e}getSubjectValue(e){if(e instanceof as.IRI)return e.value;if(e instanceof OA.BlankNode)return`_:${e.id}`;if(typeof e=="object"&&e!==null&&"termType"in e)return e.toString()}getObjectValue(e){if(e instanceof V6.Literal||e instanceof as.IRI)return e.value;if(e instanceof OA.BlankNode)return`_:${e.id}`}getRootTypes(){let e=new Set;for(let r of this.typeHierarchy.values())for(let i of r)e.add(i);let t=[];for(let r of this.nodeTypes.keys()){let i=this.typeHierarchy.get(r);(!i||i.length===0)&&e.has(r)&&t.push(r)}return t}emit(e){for(let t of this.subscribers)try{t(e)}catch(r){U6.LoggingService.error("TypeRegistry: error in subscriber callback",r instanceof Error?r:new Error(String(r)))}}};Xs.TypeRegistry=BS;Xs.TypeRegistry=BS=j6([(0,B6.injectable)(),$6("design:paramtypes",[Object,Object])],BS)});var VS=S($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.SPARQL_TEMPLATES=$.KNOWN_CLASSES=$.KNOWN_PROTOTYPES=$.EFFORT_STATUSES=$.ASSET_CLASSES=$.PREDICATES=$.SPARQL_PREFIXES=void 0;$.findClassByTerm=q6;$.getTemplateByName=W6;$.findMatchingTemplates=G6;$.fillTemplate=z6;$.validateParameters=H6;$.SPARQL_PREFIXES=`PREFIX exo: <https://exocortex.my/ontology/exo#>
|
|
217
|
+
---`)}};Ei.AssetConversionService=CS;Ei.AssetConversionService=CS=i6([(0,yA.injectable)(),a6(0,(0,yA.inject)(c6.DI_TOKENS.IVaultAdapter)),s6("design:paramtypes",[Object])],CS)});var PS=S(Ti=>{"use strict";var l6=Ti&&Ti.__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},u6=Ti&&Ti.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},SA=Ti&&Ti.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.SessionEventService=void 0;var RS=ce(),f6=_n(),bA=On(),d6=Ur(),h6=ns(),vA=wt(),OS=class{static{o(this,"SessionEventService")}constructor(e,t){this.vault=e,this.vaultSettings=t,this.folderPathCache=null}async createSessionStartEvent(e){return this.createSessionEvent(e,bA.AssetClass.SESSION_START_EVENT)}async createSessionEndEvent(e){return this.createSessionEvent(e,bA.AssetClass.SESSION_END_EVENT)}getSessionEventFolder(){if(this.folderPathCache!==null)return this.folderPathCache;let e=this.vault.getDefaultNewFileParent();return this.folderPathCache=e?.path||"",this.folderPathCache}async createSessionEvent(e,t){let r=(0,f6.v4)(),i=d6.DateFormatter.toLocalTimestamp(new Date),s={exo__Asset_uid:r,exo__Asset_createdAt:i,exo__Asset_isDefinedBy:this.vaultSettings.getOwnerIdentity(),exo__Instance_class:[`"[[${t}]]"`],ems__SessionEvent_timestamp:i,ems__Session_area:`"[[${e}]]"`},a=h6.MetadataHelpers.buildFileContent(s),c=this.getSessionEventFolder();c&&!await this.vault.exists(c)&&await this.vault.createFolder(c);let l=c?`${c}/${r}.md`:`${r}.md`;return await this.vault.create(l,a)}};Ti.SessionEventService=OS;Ti.SessionEventService=OS=l6([(0,RS.injectable)(),SA(0,(0,RS.inject)(vA.DI_TOKENS.IVaultAdapter)),SA(1,(0,RS.inject)(vA.DI_TOKENS.IVaultSettings)),u6("design:paramtypes",[Object,Object])],OS)});var NS=S(Ai=>{"use strict";var p6=Ai&&Ai.__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},m6=Ai&&Ai.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},wA=Ai&&Ai.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.URIConstructionService=void 0;var FS=ce(),EA=wt(),g6=Hu(),DS=class{static{o(this,"URIConstructionService")}constructor(e,t=g6.NullLogger){this.fileSystem=e,this.logger=t,this.defaultOntologyURL="https://exocortex.my/default/",this.strictValidation=!0}configure(e){e?.defaultOntologyURL&&(this.defaultOntologyURL=e.defaultOntologyURL),e?.strictValidation!==void 0&&(this.strictValidation=e.strictValidation)}async constructAssetURI(e){let t=this.extractUID(e);if(!t){if(this.strictValidation)throw new Error(`Asset missing exo__Asset_uid: ${e.path}`);return this.logger.warn(`Asset ${e.path} missing UID, using filename fallback`),this.constructFallbackURI(e)}let r=await this.resolveOntologyURL(e);if(!this.validateOntologyURL(r))throw new Error(`Invalid ontology URL: ${r}`);return`${r.endsWith("/")?r:`${r}/`}${t}`}validateOntologyURL(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}async resolveOntologyURL(e){let t=e.frontmatter?.exo__Asset_isDefinedBy;if(!t||typeof t!="string")return this.defaultOntologyURL;let r=this.extractWikiLink(t),i=r,s=await this.fileSystem.fileExists(r);return!s&&!r.endsWith(".md")&&(i=`${r}.md`,s=await this.fileSystem.fileExists(i)),s?(await this.fileSystem.getFileMetadata(i))?.exo__Ontology_url||this.defaultOntologyURL:(this.logger.warn(`Ontology file not found: ${r}, using default`),this.defaultOntologyURL)}extractUID(e){let t=e.frontmatter?.exo__Asset_uid;return typeof t=="string"?t:null}extractWikiLink(e){return e.replace(/^\[\[|\]\]$/g,"")}constructFallbackURI(e){let t=e.path.split("/").pop()?.replace(".md","")||"unknown";return`${this.defaultOntologyURL}${t}`}};Ai.URIConstructionService=DS;Ai.URIConstructionService=DS=p6([(0,FS.injectable)(),wA(0,(0,FS.inject)(EA.DI_TOKENS.IFileSystemAdapter)),wA(1,(0,FS.inject)(EA.DI_TOKENS.ILogger)),m6("design:paramtypes",[Object,Object])],DS)});var kS=S(xi=>{"use strict";var y6=xi&&xi.__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},_6=xi&&xi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},S6=xi&&xi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(xi,"__esModule",{value:!0});xi.GenericAssetCreationService=void 0;var TA=ce(),b6=_n(),Yu=Ur(),v6=ns(),w6=wt(),is=ch(),LS=class{static{o(this,"GenericAssetCreationService")}constructor(e){this.vault=e}async createAsset(e,t){let r=(0,b6.v4)(),i=`${r}.md`,s=this.generateFrontmatter(e,t||[],r),a=v6.MetadataHelpers.buildFileContent(s),c=e.folderPath||this.getDefaultFolderPath(e);this.vault.getAbstractFileByPath(c)||await this.vault.createFolder(c);let u=c?`${c}/${i}`:i;return await this.vault.create(u,a)}generateFrontmatter(e,t,r){let i=new Date,s={},a=new Map;for(let c of t)a.set(c.name,c.fieldType);if(s.exo__Asset_uid=r,s.exo__Asset_createdAt=Yu.DateFormatter.toLocalTimestamp(i),s.exo__Instance_class=[this.formatWikilink(e.className)],e.label&&e.label.trim()!==""){let c=e.label.trim();s.exo__Asset_label=c,s.aliases=[c]}if(e.parentFile&&e.parentMetadata&&this.inheritParentContext(s,e),e.propertyValues)for(let[c,l]of Object.entries(e.propertyValues)){if(c==="exo__Asset_uid"||c==="exo__Asset_createdAt"||c==="exo__Instance_class"||c==="exo__Asset_label"||c==="aliases"||l==null)continue;let u=a.get(c);s[c]=this.formatValue(l,u)}return s}inheritParentContext(e,t){let r=t.parentMetadata||{},i=t.parentFile?.basename;if(t.className==="ems__Task"||t.className.startsWith("ems__Task")){let s=r.exo__Instance_class,c=this.isAreaClass(s)?"ems__Effort_area":"ems__Effort_parent";e[c]=i?this.formatWikilink(i):null}if(t.className==="ems__Project"||t.className.startsWith("ems__Project")){let s=r.exo__Instance_class,c=this.isAreaClass(s)?"ems__Effort_area":"ems__Effort_parent";e[c]=i?this.formatWikilink(i):null}if(r.exo__Asset_isDefinedBy){let s=r.exo__Asset_isDefinedBy;e.exo__Asset_isDefinedBy=typeof s=="string"?this.formatWikilink(s):s}}isAreaClass(e){return e?(Array.isArray(e)?e:[e]).some(r=>String(r).includes("Area")||String(r).includes("ems__Area")):!1}getDefaultFolderPath(e){if(e.parentFile?.parent?.path)return e.parentFile.parent.path;let t={ems__Task:"tasks",ems__Project:"projects",ems__Area:"areas",ems__Meeting:"meetings",exo__Event:"events",ims__Concept:"concepts"};if(t[e.className])return t[e.className];for(let[r,i]of Object.entries(t))if(e.className.startsWith(r))return i;return"assets"}formatValue(e,t){if(e==null)return null;if(!t)return this.formatInferredValue(e);switch(t){case is.PropertyFieldType.Text:return String(e);case is.PropertyFieldType.Wikilink:case is.PropertyFieldType.Reference:case is.PropertyFieldType.StatusSelect:case is.PropertyFieldType.SizeSelect:return this.formatWikilink(String(e));case is.PropertyFieldType.Number:return typeof e=="number"?e:Number(e)||0;case is.PropertyFieldType.Boolean:return this.formatBoolean(e);case is.PropertyFieldType.Date:case is.PropertyFieldType.DateTime:case is.PropertyFieldType.Timestamp:return this.formatTimestamp(e);default:return String(e)}}formatInferredValue(e){return typeof e=="boolean"||typeof e=="number"?e:e instanceof Date?Yu.DateFormatter.toLocalTimestamp(e):typeof e=="string"?e.startsWith("[[")||e.startsWith('"[[')?this.formatWikilink(e):e:String(e)}formatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:`"[[${e}]]"`}formatBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"}return typeof e=="number"?e!==0:!!e}formatTimestamp(e){if(e instanceof Date)return Yu.DateFormatter.toLocalTimestamp(e);if(typeof e=="string"){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))return e;if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e.replace("Z","");let t=new Date(e);return isNaN(t.getTime())?e:Yu.DateFormatter.toLocalTimestamp(t)}if(typeof e=="number"){let t=new Date(e);if(!isNaN(t.getTime()))return Yu.DateFormatter.toLocalTimestamp(t)}return String(e)}};xi.GenericAssetCreationService=LS;xi.GenericAssetCreationService=LS=y6([(0,TA.injectable)(),S6(0,(0,TA.inject)(w6.DI_TOKENS.IVaultAdapter)),_6("design:paramtypes",[Object])],LS)});var xA=S(Ci=>{"use strict";var E6=Ci&&Ci.__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},T6=Ci&&Ci.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},A6=Ci&&Ci.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.ArchiveAssetService=void 0;var AA=ce(),x6=wt(),C6=qn(),MS=class{static{o(this,"ArchiveAssetService")}constructor(e){this.vault=e,this.frontmatterService=new C6.FrontmatterService}async archiveAsset(e){let t=await this.vault.read(e),r=this.frontmatterService.updateProperty(t,"archived","true");r=this.frontmatterService.removeProperty(r,"aliases"),r!==t&&await this.vault.modify(e,r)}};Ci.ArchiveAssetService=MS;Ci.ArchiveAssetService=MS=E6([(0,AA.injectable)(),A6(0,(0,AA.inject)(x6.DI_TOKENS.IVaultAdapter)),T6("design:paramtypes",[Object])],MS)});var IA=S(Ii=>{"use strict";var I6=Ii&&Ii.__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},R6=Ii&&Ii.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},O6=Ii&&Ii.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.FixMissingLabelService=void 0;var CA=ce(),P6=wt(),F6=qn(),jS=class{static{o(this,"FixMissingLabelService")}constructor(e){this.vault=e,this.frontmatterService=new F6.FrontmatterService}async fixMissingLabel(e){let t=await this.vault.read(e);if(this.hasNonEmptyLabel(t))return;let r=this.frontmatterService.updateProperty(t,"exo__Asset_label",e.basename);r!==t&&await this.vault.modify(e,r)}hasNonEmptyLabel(e){let t=this.frontmatterService.parse(e);if(!t.exists)return!1;let r=t.content.match(/^exo__Asset_label:\s*(.*)$/m);if(!r)return!1;let i=r[1].trim();return!(i===""||i==='""'||i==="''")}};Ii.FixMissingLabelService=jS;Ii.FixMissingLabelService=jS=I6([(0,CA.injectable)(),O6(0,(0,CA.inject)(P6.DI_TOKENS.IVaultAdapter)),R6("design:paramtypes",[Object])],jS)});var RA=S(Ks=>{"use strict";var D6=Ks&&Ks.__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},N6=Ks&&Ks.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.GraphQueryService=void 0;var L6=ce(),Ku=xe(),k6=He(),Ca=Cr(),M6=$y(),ss={INSTANCE_CLASS:Ca.Namespace.EXO.term("Instance_class"),ASSET_LABEL:Ca.Namespace.EXO.term("Asset_label"),ASSET_PROTOTYPE:Ca.Namespace.EXO.term("Asset_prototype"),ASSET_IS_ARCHIVED:Ca.Namespace.EXO.term("Asset_isArchived"),EFFORT_PARENT:Ca.Namespace.EMS.term("Effort_parent"),REFERENCES:Ca.Namespace.EXO.term("references"),REFERENCED_BY:Ca.Namespace.EXO.term("referencedBy"),RDF_TYPE:Ca.Namespace.RDF.term("type")},$S=class{static{o(this,"GraphQueryService")}constructor(e,t={},r){this.subscribers=new Set,this.nodeCache=new Map,this.lastCacheUpdate=0,this.tripleStore=e,this.logger=r,this.config={defaultLimit:t.defaultLimit??100,maxLimit:t.maxLimit??1e4,defaultDepth:t.defaultDepth??2,maxDepth:t.maxDepth??10,includeArchivedByDefault:t.includeArchivedByDefault??!1,cacheTTL:t.cacheTTL??3e4}}async loadGraphData(e={}){let t=Date.now(),r=await this.loadNodes(e),i=await this.loadEdges(r,e),s=this.computeStats(r,i),a=Date.now()-t;return a>100&&r.length>0&&this.logger?.debug(`GraphQueryService: loaded ${r.length} nodes in ${a}ms (${(a/r.length).toFixed(2)}ms/node)`),{nodes:r,edges:i,stats:s,lastUpdated:Date.now(),version:1}}async loadNodesIncremental(e={}){let t=Math.min(e.limit??this.config.defaultLimit,this.config.maxLimit),r=e.offset??0,i=await this.loadNodes({...e,limit:t+1,offset:r}),s=i.length>t,a=s?i.slice(0,t):i,c=await this.loadEdges(a,e);return{nodes:a,edges:c,hasMore:s,totalCount:void 0,cursor:s?String(r+t):void 0}}async loadConnectedNodes(e,t={}){let r=Math.min(t.depth??this.config.defaultDepth,this.config.maxDepth),i=Math.min(t.limit??this.config.maxLimit,this.config.maxLimit),s=new Set,a=[{id:e,currentDepth:0}],c=[];for(;a.length>0&&c.length<i;){let u=a.shift();if(!u)break;let{id:f,currentDepth:d}=u;if(s.has(f))continue;s.add(f);let h=await this.getNodeById(f,t);if(h&&(c.push(h),d<r)){let p=await this.getConnectedNodeIds(f);for(let _ of p)s.has(_)||a.push({id:_,currentDepth:d+1})}}let l=await this.loadEdges(c,t);return{nodes:c,edges:l,hasMore:a.length>0,totalCount:s.size+a.length}}async getNodeById(e,t={}){let r=this.getCachedNode(e);if(r)return{...r};let i=this.idToIRI(e),s=await this.tripleStore.match(i,void 0,void 0);if(s.length===0)return null;let a=this.triplesToNode(e,s,t);return a&&this.cacheNode(a),a}subscribe(e){return this.subscribers.add(e),{unsubscribe:o(()=>{this.subscribers.delete(e)},"unsubscribe")}}notifyChange(e){for(let t of this.subscribers)try{t(e)}catch(r){this.logger?.error("GraphQueryService: error in subscriber callback",r instanceof Error?r:new Error(String(r)))}this.invalidateCache()}async getStats(){let e=await this.loadNodes({includeArchived:!0}),t=await this.loadEdges(e,{});return this.computeStats(e,t)}clearCache(){this.nodeCache.clear(),this.lastCacheUpdate=0}async loadNodes(e){let t=e.includeArchived??this.config.includeArchivedByDefault,r=e.limit??this.config.maxLimit,i=e.offset??0,s=await this.tripleStore.match(void 0,ss.INSTANCE_CLASS,void 0),a=s;if(e.classes&&e.classes.length>0){let p=new Set(e.classes);a=s.filter(_=>{let b=this.getObjectValue(_.object);return b&&p.has(b)})}let c=new Set;for(let p of a)c.add(this.subjectToId(p.subject));let f=Array.from(c).slice(i,i+r).map(p=>this.getNodeById(p,e));return(await Promise.all(f)).filter(p=>!(!p||!t&&p.isArchived))}async loadEdges(e,t){let r=new Set(e.map(a=>a.id)),i=[],s=new Set;for(let a of e){let c=this.idToIRI(a.id),l=await this.tripleStore.match(c,void 0,void 0);for(let u of l){let f=this.tripleToEdge(a.id,u,r);f&&f.id&&!s.has(f.id)&&(!t.edgeTypes||t.edgeTypes.includes(f.type))&&(s.add(f.id),i.push(f))}}return i}async getConnectedNodeIds(e){let t=this.idToIRI(e),r=[],i=await this.tripleStore.match(t,void 0,void 0);for(let a of i){let c=this.objectToId(a.object);c&&r.push(c)}let s=await this.tripleStore.match(void 0,void 0,t);for(let a of s)r.push(this.subjectToId(a.subject));return[...new Set(r)]}triplesToNode(e,t,r){let i={},s,a,c,l,u=!1;for(let h of t){let p=h.predicate.value,_=this.getObjectValue(h.object);if(p===ss.INSTANCE_CLASS.value)s=_;else if(p===ss.ASSET_LABEL.value)a=_;else if(p===ss.ASSET_PROTOTYPE.value)c=this.objectToId(h.object)??_;else if(p===ss.EFFORT_PARENT.value)l=this.objectToId(h.object)??_;else if(p===ss.ASSET_IS_ARCHIVED.value)u=_==="true"||_==="1";else{let b=this.predicateToPropertyName(p);b&&(i[b]=_)}}if(u&&!(r.includeArchived??this.config.includeArchivedByDefault))return null;let f=this.idToPath(e),d=a??this.pathToTitle(f);return{id:e,path:f,title:d,label:d,assetClass:s,isArchived:u,uri:e.startsWith("http")?e:void 0,prototype:c,parent:l,properties:Object.keys(i).length>0?i:void 0}}tripleToEdge(e,t,r){let i=t.predicate.value,s=this.objectToId(t.object);if(!s||!r.has(s)||s===e)return null;let a=this.predicateToEdgeType(i);if(!a)return null;let c=(0,M6.createEdgeId)(e,s,a,i),l=this.predicateToLabel(i);return{id:c,source:e,target:s,type:a,predicate:i,label:l}}predicateToEdgeType(e){return e===ss.EFFORT_PARENT.value?"hierarchy":e===ss.ASSET_PROTOTYPE.value?"prototype":e===ss.REFERENCES.value?"forward-link":e===ss.REFERENCED_BY.value?"backlink":e.includes("Asset_")||e.includes("Instance_")?null:"semantic"}predicateToLabel(e){let t=e.lastIndexOf("#"),r=e.lastIndexOf("/"),i=Math.max(t,r);return i>=0?e.substring(i+1):e}predicateToPropertyName(e){return this.predicateToLabel(e).replace(/_/g,"__").replace(/#/g,"_")}computeStats(e,t){let r={},i={backlink:0,"forward-link":0,hierarchy:0,prototype:0,semantic:0,reference:0};for(let c of e){let l=c.assetClass??"unknown";r[l]=(r[l]??0)+1}for(let c of t)i[c.type]=(i[c.type]??0)+1;let s=new Map,a=new Map;for(let c of t)a.set(c.source,(a.get(c.source)??0)+1),s.set(c.target,(s.get(c.target)??0)+1);for(let c of e)c.inDegree=s.get(c.id)??0,c.outDegree=a.get(c.id)??0,c.weight=c.inDegree+c.outDegree;return{nodeCount:e.length,edgeCount:t.length,nodesByClass:r,edgesByType:i,computedAt:Date.now()}}idToIRI(e){return e.startsWith("http://")||e.startsWith("https://")?new Ku.IRI(e):new Ku.IRI(`obsidian://vault/${encodeURIComponent(e)}`)}subjectToId(e){if(e instanceof Ku.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return e.toString()}objectToId(e){if(e instanceof Ku.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return null}getObjectValue(e){if(e instanceof k6.Literal||e instanceof Ku.IRI)return e.value}idToPath(e){if(e.startsWith("obsidian://vault/"))return decodeURIComponent(e.replace("obsidian://vault/",""));if(e.startsWith("http://")||e.startsWith("https://")){let t=e.match(/\/([^/]+\.md)$/);if(t)return t[1]}return e}pathToTitle(e){return(e.split("/").pop()??e).replace(/\.md$/,"")}getCachedNode(e){return Date.now()-this.lastCacheUpdate>this.config.cacheTTL?(this.clearCache(),null):this.nodeCache.get(e)??null}cacheNode(e){this.nodeCache.set(e.id,e),this.lastCacheUpdate===0&&(this.lastCacheUpdate=Date.now())}invalidateCache(){this.clearCache()}};Ks.GraphQueryService=$S;Ks.GraphQueryService=$S=D6([(0,L6.injectable)(),N6("design:paramtypes",[Object,Object,Object])],$S)});var PA=S(Xs=>{"use strict";var j6=Xs&&Xs.__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},$6=Xs&&Xs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.TypeRegistry=void 0;var B6=ce(),as=xe(),OA=qt(),V6=He(),U6=Ta(),ht=By(),BS=class{static{o(this,"TypeRegistry")}constructor(e=null,t={}){this.nodeTypes=new Map,this.edgeTypes=new Map,this.typeHierarchy=new Map,this.subscribers=new Set,this.discoveryComplete=!1,this.tripleStore=e,this.config={autoDiscoverTypes:t.autoDiscoverTypes??!0,includeBuiltInStyles:t.includeBuiltInStyles??!0,styleResolution:t.styleResolution??{mergeStyles:!0,inheritParentStyles:!0,defaultNodeStyle:ht.DEFAULT_NODE_STYLE,defaultEdgeStyle:ht.DEFAULT_EDGE_STYLE},maxInheritanceDepth:t.maxInheritanceDepth??10},this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerNodeType(e){let r=this.nodeTypes.get(e.uri)?"type-updated":"type-added";this.nodeTypes.set(e.uri,e),e.parentTypes&&e.parentTypes.length>0&&this.typeHierarchy.set(e.uri,e.parentTypes),this.emit({type:r,typeUri:e.uri,definition:e})}registerEdgeType(e){let r=this.edgeTypes.get(e.uri)?"type-updated":"type-added";this.edgeTypes.set(e.uri,e),this.emit({type:r,typeUri:e.uri,definition:e})}unregisterType(e){let t=this.nodeTypes.delete(e),r=this.edgeTypes.delete(e);this.typeHierarchy.delete(e),(t||r)&&this.emit({type:"type-removed",typeUri:e})}getNodeType(e){return this.nodeTypes.get(e)}getEdgeType(e){return this.edgeTypes.get(e)}getAllNodeTypes(){return Array.from(this.nodeTypes.values())}getAllEdgeTypes(){return Array.from(this.edgeTypes.values())}getParentTypes(e,t=this.config.maxInheritanceDepth){let r=[],i=new Set,s=[{uri:e,currentDepth:0}];for(;s.length>0;){let a=s.shift();if(!a)break;let{uri:c,currentDepth:l}=a;if(i.has(c)||(i.add(c),l>=t))continue;let u=this.typeHierarchy.get(c)??[];for(let f of u)i.has(f)||(r.push(f),s.push({uri:f,currentDepth:l+1}))}return r}getChildTypes(e){let t=[];for(let[r,i]of this.typeHierarchy)i.includes(e)&&t.push(r);return t}isSubtypeOf(e,t){return e===t?!0:this.getParentTypes(e).includes(t)}resolveNodeType(e){let t=[],r="unknown",i="custom";if(e.assetClass){let c=this.normalizeTypeUri(e.assetClass);t.push(c),r=c,i="exo:Instance_class"}let s=e.properties?.[ht.RDF_TYPE_PREDICATES.RDF_TYPE];s&&!t.includes(s)&&(t.push(s),r==="unknown"&&(r=s,i="rdf:type"));for(let c of[...t]){let l=this.getParentTypes(c);for(let u of l)t.includes(u)||t.push(u)}let a=this.resolveNodeStyle(t);return{primaryType:r,types:t,resolvedStyle:a,source:i}}resolveEdgeType(e){let t=e.predicate??e.type,r=e.predicate?"rdf:type":"custom",i=this.resolveEdgeStyle(t);return{primaryType:t,resolvedStyle:i,source:r}}resolveNodeStyle(e){let{mergeStyles:t,defaultNodeStyle:r}=this.config.styleResolution,i={...r},s=[];for(let a of e){let c=this.nodeTypes.get(a);c&&s.push(c)}if(s.sort((a,c)=>a.priority-c.priority),t)for(let a of s)i=(0,ht.mergeNodeStyles)(i,a.style);else if(s.length>0){let a=s[s.length-1];i=(0,ht.mergeNodeStyles)(i,a.style)}return i}resolveEdgeStyle(e){let{defaultEdgeStyle:t}=this.config.styleResolution,r={...t},i=this.edgeTypes.get(e);return i&&(r=(0,ht.mergeEdgeStyles)(r,i.style)),r}filterNodes(e,t){return e.filter(r=>{let i=this.resolveNodeType(r);return!(t.includeNodeTypes&&t.includeNodeTypes.length>0&&!t.includeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||t.excludeNodeTypes&&t.excludeNodeTypes.length>0&&t.excludeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||!t.includeDeprecated&&this.nodeTypes.get(i.primaryType)?.deprecated)})}filterEdges(e,t){return e.filter(r=>{let i=r.predicate??r.type;return!(t.includeEdgeTypes&&t.includeEdgeTypes.length>0&&!t.includeEdgeTypes.includes(i)||t.excludeEdgeTypes&&t.excludeEdgeTypes.length>0&&t.excludeEdgeTypes.includes(i))})}groupNodesByType(e,t,r={}){let{groupByNodeType:i=!0,groupByParentType:s=!1,groupLevel:a=0,maxGroups:c=20,customGroupFn:l}=r,u=new Map;for(let h of e){let p=this.resolveNodeType(h),_;if(l?_=l(p.types):s&&p.types.length>a?_=p.types[a]??p.primaryType:i?_=p.primaryType:_="all",!u.has(_)){let v=this.nodeTypes.get(_)?.label??(0,ht.extractLocalName)(_);u.set(_,{nodeIds:new Set,label:v})}let b=u.get(_);b&&b.nodeIds.add(h.id)}let f=Array.from(u.entries()).map(([h,p])=>({id:h,label:p.label,nodeIds:Array.from(p.nodeIds)}));if(f.length>c){f.sort((_,b)=>b.nodeIds.length-_.nodeIds.length);let h=f.slice(0,c-1),p=f.slice(c-1).flatMap(_=>_.nodeIds);h.push({id:"other",label:"Other",nodeIds:p}),f=h}let d=new Map;for(let h of f)for(let p of h.nodeIds)d.set(p,h.id);return f.map((h,p)=>{let _=new Set(h.nodeIds),b=[],E=[];for(let R of t){let B=_.has(R.source),W=_.has(R.target);B&&W?R.id&&b.push(R.id):(B||W)&&R.id&&E.push(R.id)}let A=`hsl(${p*137.5%360}, 70%, 50%)`;return{id:h.id,label:h.label,nodeIds:h.nodeIds,internalEdgeIds:b,externalEdgeIds:E,color:A,stats:{nodeCount:h.nodeIds.length,internalEdgeCount:b.length,externalEdgeCount:E.length}}})}validateTypes(e,t){let r=[],i=[];for(let s of e){let a=this.resolveNodeType(s);if(a.primaryType!=="unknown"){let c=this.nodeTypes.get(a.primaryType);!c&&a.source!=="inferred"&&i.push({code:"UNREGISTERED_NODE_TYPE",message:`Node type "${a.primaryType}" is not registered`,elementId:s.id,suggestion:"Register the type with registerNodeType()"}),c?.deprecated&&i.push({code:"DEPRECATED_NODE_TYPE",message:`Node uses deprecated type "${a.primaryType}"`,elementId:s.id,suggestion:"Migrate to a non-deprecated type"})}else i.push({code:"MISSING_NODE_TYPE",message:"Node has no type information",elementId:s.id,suggestion:"Add exo:Instance_class or rdf:type to the node"})}for(let s of t){let a=s.predicate??s.type,c=this.edgeTypes.get(a);if(c?.domain&&c.domain.length>0){let l=e.find(u=>u.id===s.source);if(l){let u=this.resolveNodeType(l);c.domain.some(d=>u.types.includes(d))||r.push({code:"DOMAIN_VIOLATION",message:"Edge source does not match expected domain",elementId:s.id,expected:c.domain,actual:u.types})}}if(c?.range&&c.range.length>0){let l=e.find(u=>u.id===s.target);if(l){let u=this.resolveNodeType(l);c.range.some(d=>u.types.includes(d))||r.push({code:"RANGE_VIOLATION",message:"Edge target does not match expected range",elementId:s.id,expected:c.range,actual:u.types})}}}return{valid:r.length===0,errors:r,warnings:i}}async discoverTypes(){if(!this.tripleStore||this.discoveryComplete)return;let e=await this.tripleStore.match(void 0,new as.IRI(ht.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let r of e){let i=this.getObjectValue(r.object);if(i&&(0,ht.isClassType)(i)){let s=this.getSubjectValue(r.subject);s&&await this.discoverNodeType(s)}}let t=await this.tripleStore.match(void 0,new as.IRI(ht.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF),void 0);for(let r of t){let i=this.getSubjectValue(r.subject),s=this.getObjectValue(r.object);if(i&&s){let a=this.typeHierarchy.get(i)??[];if(!a.includes(s)){a.push(s),this.typeHierarchy.set(i,a);let c=this.nodeTypes.get(i);c&&(c.parentTypes=a)}}}this.discoveryComplete=!0,this.emit({type:"hierarchy-updated",rootTypes:this.getRootTypes()})}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}clear(){this.nodeTypes.clear(),this.edgeTypes.clear(),this.typeHierarchy.clear(),this.discoveryComplete=!1,this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerBuiltInTypes(){for(let[e,t]of Object.entries(ht.BUILT_IN_NODE_STYLES))this.nodeTypes.set(e,{uri:e,label:(0,ht.extractLocalName)(e),source:"custom",style:(0,ht.mergeNodeStyles)(ht.DEFAULT_NODE_STYLE,t),priority:1});for(let[e,t]of Object.entries(ht.BUILT_IN_EDGE_STYLES))this.edgeTypes.set(e,{uri:e,label:(0,ht.extractLocalName)(e),source:"custom",style:(0,ht.mergeEdgeStyles)(ht.DEFAULT_EDGE_STYLE,t),priority:1})}async discoverNodeType(e){if(this.nodeTypes.has(e)||!this.tripleStore)return;let t=await this.tripleStore.match(new as.IRI(e),new as.IRI(ht.RDF_TYPE_PREDICATES.RDFS_LABEL),void 0),r=await this.tripleStore.match(new as.IRI(e),new as.IRI(ht.RDF_TYPE_PREDICATES.RDFS_COMMENT),void 0),i=t.length>0?this.getObjectValue(t[0].object)??(0,ht.extractLocalName)(e):(0,ht.extractLocalName)(e),s=r.length>0?this.getObjectValue(r[0].object):void 0,a="rdfs:Class",c=await this.tripleStore.match(new as.IRI(e),new as.IRI(ht.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let f of c)if(this.getObjectValue(f.object)===ht.RDF_TYPE_PREDICATES.OWL_CLASS){a="owl:Class";break}let l=ht.BUILT_IN_NODE_STYLES[e]??ht.BUILT_IN_NODE_STYLES[(0,ht.extractLocalName)(e)],u={uri:e,label:i,description:s,source:a,style:(0,ht.mergeNodeStyles)(ht.DEFAULT_NODE_STYLE,l??{}),priority:1};this.registerNodeType(u)}normalizeTypeUri(e){let t=e.match(/^\[\[(.+?)\]\]$/);return t?t[1]:e}getSubjectValue(e){if(e instanceof as.IRI)return e.value;if(e instanceof OA.BlankNode)return`_:${e.id}`;if(typeof e=="object"&&e!==null&&"termType"in e)return e.toString()}getObjectValue(e){if(e instanceof V6.Literal||e instanceof as.IRI)return e.value;if(e instanceof OA.BlankNode)return`_:${e.id}`}getRootTypes(){let e=new Set;for(let r of this.typeHierarchy.values())for(let i of r)e.add(i);let t=[];for(let r of this.nodeTypes.keys()){let i=this.typeHierarchy.get(r);(!i||i.length===0)&&e.has(r)&&t.push(r)}return t}emit(e){for(let t of this.subscribers)try{t(e)}catch(r){U6.LoggingService.error("TypeRegistry: error in subscriber callback",r instanceof Error?r:new Error(String(r)))}}};Xs.TypeRegistry=BS;Xs.TypeRegistry=BS=j6([(0,B6.injectable)(),$6("design:paramtypes",[Object,Object])],BS)});var VS=S($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.SPARQL_TEMPLATES=$.KNOWN_CLASSES=$.KNOWN_PROTOTYPES=$.EFFORT_STATUSES=$.ASSET_CLASSES=$.PREDICATES=$.SPARQL_PREFIXES=void 0;$.findClassByTerm=q6;$.getTemplateByName=W6;$.findMatchingTemplates=G6;$.fillTemplate=z6;$.validateParameters=H6;$.SPARQL_PREFIXES=`PREFIX exo: <https://exocortex.my/ontology/exo#>
|
|
218
218
|
PREFIX ems: <https://exocortex.my/ontology/ems#>
|
|
219
219
|
PREFIX ims: <https://exocortex.my/ontology/ims#>
|
|
220
220
|
PREFIX gtd: <https://exocortex.my/ontology/gtd#>
|
|
@@ -374,7 +374,7 @@ LIMIT ${this.config.defaultLimit}`,s="\u041D\u0435 \u0443\u0434\u0430\u043B\u043
|
|
|
374
374
|
`,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?{...v7,...e.prefixes??{}}:{...e.prefixes??{}}}serializeTriplesOnly(e,t){return this.nTriplesSerializer.serializeChunk(e,t).trimEnd()}};zp.TurtleSerializer=JS});var zA=S(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});Hp.JSONLDSerializer=void 0;var WA=xe(),GA=qt(),w7=He(),Jc=Cr(),E7={rdf:Jc.Namespace.RDF.iri.value,rdfs:Jc.Namespace.RDFS.iri.value,owl:Jc.Namespace.OWL.iri.value,xsd:Jc.Namespace.XSD.iri.value,exo:Jc.Namespace.EXO.iri.value,ems:Jc.Namespace.EMS.iri.value},ZS=class{static{o(this,"JSONLDSerializer")}toDocument(e,t={}){let r={...E7,...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 WA.IRI?e.value:e instanceof GA.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 WA.IRI)return{"@id":e.value};if(e instanceof GA.BlankNode)return{"@id":`_:${e.id}`};if(e instanceof w7.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}};Hp.JSONLDSerializer=ZS});var rb=S(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});Qp.NTriplesParser=void 0;var T7=ri(),HA=xe(),eb=He(),A7=qt(),Zc=Cr(),x7={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},tb=class{static{o(this,"NTriplesParser")}parse(e,t={}){let r={prefixes:{...x7,...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 T7.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 HA.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 HA.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 A7.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 eb.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 eb.Literal(i,void 0,l),rest:(u??"").trimStart()}}return{node:new eb.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+=`
|
|
375
375
|
`,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}};Qp.NTriplesParser=tb});var QA=S(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});Yp.TurtleParser=void 0;var el=Cr(),C7=rb(),I7={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},R7=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,nb=class{static{o(this,"TurtleParser")}constructor(){this.nTriplesParser=new C7.NTriplesParser}parse(e,t={}){let r={...I7,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:a,lineNumber:c})=>{if(this.isPrefixStatement(a)){let u=a.match(R7);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}};Yp.TurtleParser=nb});var YA=S(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.RDFSerializer=void 0;var tl=ri(),Fo=xe(),Do=He(),ib=qt(),os=Cr(),O7=qA(),P7=XS(),F7=zA(),D7=QA(),N7=rb(),L7=1024,k7=`
|
|
376
376
|
`,M7={rdf:os.Namespace.RDF.iri.value,rdfs:os.Namespace.RDFS.iri.value,owl:os.Namespace.OWL.iri.value,xsd:os.Namespace.XSD.iri.value,exo:os.Namespace.EXO.iri.value,ems:os.Namespace.EMS.iri.value},sb=class{static{o(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new O7.TurtleSerializer,this.nTriplesSerializer=new P7.NTriplesSerializer,this.jsonldSerializer=new F7.JSONLDSerializer,this.turtleParser=new D7.TurtleParser,this.nTriplesParser=new N7.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??k7,i=t.batchSize??L7,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 _=c.jsonldSerializer.toDocument(f,{context:a,pretty:!1});u.push(...c.buildJsonLdChunks(_))}else if(e==="turtle"){let _=c.turtleSerializer.serializePrefixes(c.composePrefixes(a,s),r);_&&u.push(`${_}${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 _=f.slice(d,d+i);d+=_.length;let b="";if(e==="turtle"){let E=c.turtleSerializer.serializeTriplesOnly(_,r);E&&(b=`${E}${r}`)}else e==="n-triples"&&(b=c.nTriplesSerializer.serializeChunk(_,r));return b?{value:b,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?{...M7,...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,_]of h){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(d,_,l,a);continue}let b=this.expandTerm(p,a),E=new Fo.IRI(b);this.collectTriplesForValue(d,E,_,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 ib.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new Fo.IRI(i);let s=this.expandTerm(i,t);return new Fo.IRI(s)}return new ib.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=os.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 tl.Triple(e,s,new Fo.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 tl.Triple(e,t,c));return}if(a["@value"]!==void 0){let c=this.parseLiteralObject(a,s);i.push(new tl.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new tl.Triple(e,t,new Do.Literal(r)));return}if(typeof r=="number"){let a=Number.isInteger(r)?os.Namespace.XSD.term("integer"):os.Namespace.XSD.term("decimal");i.push(new tl.Triple(e,t,new Do.Literal(r.toString(),a)));return}if(typeof r=="boolean"){let a=os.Namespace.XSD.term("boolean");i.push(new tl.Triple(e,t,new Do.Literal(r.toString(),a)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new ib.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new Fo.IRI(e);let r=this.expandTerm(e,t);return new Fo.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 Do.Literal(r,void 0,e["@language"],i):new Do.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new Do.Literal(r,new Fo.IRI(i))}return new Do.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(`]}
|
|
377
|
-
`),t}};Kp.RDFSerializer=sb});var ob=S(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});Xp.RDFVocabularyMapper=void 0;var Xt=ri(),KA=xe(),X=Cr(),ab=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 KA.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 KA.IRI(r)}return new Xt.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Xp.RDFVocabularyMapper=ab});var XA=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.RDFSInferenceEngine=void 0;var j7=ri(),Jp=xe(),cb=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 Jp.IRI){let h=a.get(d.object.value);if(h)for(let p of h)u.push(new j7.Triple(d.subject,i,new Jp.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 Jp.IRI&&s.object instanceof Jp.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}};Zp.RDFSInferenceEngine=cb});var fb=S(No=>{"use strict";var $7=No&&No.__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(No,"__esModule",{value:!0});No.NonInheritablePropertyRegistry=void 0;var B7=ce(),JA=xe(),ZA=He(),lb=Cr(),ub=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 ZA.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 ZA.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof JA.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 JA.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?lb.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?lb.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?lb.Namespace.EXOCMD.term(e.substring(8)).value:null}};No.NonInheritablePropertyRegistry=ub;No.NonInheritablePropertyRegistry=ub=$7([(0,B7.injectable)()],ub)});var pb=S(Lo=>{"use strict";var V7=Lo&&Lo.__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(Lo,"__esModule",{value:!0});Lo.PropertyCardinalityRegistry=void 0;var U7=ce(),ex=xe(),tx=He(),db=Cr(),hb=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 tx.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 tx.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof ex.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 ex.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?db.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?db.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?db.Namespace.EXOCMD.term(e.substring(8)).value:null}};Lo.PropertyCardinalityRegistry=hb;Lo.PropertyCardinalityRegistry=hb=V7([(0,U7.injectable)()],hb)});var yb=S(hr=>{"use strict";var q7=hr&&hr.__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},W7=hr&&hr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(hr,"__esModule",{value:!0});hr.PrototypeChainMaterializer=hr.MAX_PROTOTYPE_DEPTH=hr.INFERRED_GRAPH=void 0;hr.inferredGraphForDepth=mb;var G7=ce(),rx=ri(),Ia=xe(),z7=fb(),H7=pb();hr.INFERRED_GRAPH=new Ia.IRI("https://exocortex.my/ontology/exo#inferred");var Q7="https://exocortex.my/ontology/exo#inferred/";function mb(n){return new Ia.IRI(`${Q7}${n}`)}o(mb,"inferredGraphForDepth");hr.MAX_PROTOTYPE_DEPTH=10;var gb=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 Ia.IRI&&c.object instanceof Ia.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 Ia.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 _=p.object instanceof Ia.IRI?p.object.value:String(p.object),b=h.get(p.predicate.value);b||(b=new Set,h.set(p.predicate.value,b)),b.add(_)}for(let p=0;p<u.length;p++){let _=u[p],b=p+1,E=new Ia.IRI(_),v=await e.match(E,void 0,void 0),A=new Set;if(e.matchInGraph){let R=await e.matchInGraph(E,void 0,void 0,hr.INFERRED_GRAPH);for(let B of R)A.add(B.predicate.value)}for(let R of v){let B=R.predicate.value;if(this.registry.isNonInheritable(B)||A.has(B))continue;if(d.has(B)&&this.isMultiValued(B)){let ve=R.object instanceof Ia.IRI?R.object.value:String(R.object);if(h.get(B)?.has(ve))continue;let G=h.get(B);G||(G=new Set,h.set(B,G)),G.add(ve);let F=new rx.Triple(l,R.predicate,R.object);await e.add(F),e.addToGraph&&(await e.addToGraph(F,hr.INFERRED_GRAPH),await e.addToGraph(F,mb(b))),a++;continue}if(d.has(B))continue;let W=new rx.Triple(l,R.predicate,R.object);await e.add(W),e.addToGraph&&(await e.addToGraph(W,hr.INFERRED_GRAPH),await e.addToGraph(W,mb(b))),d.add(B),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<hr.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}};hr.PrototypeChainMaterializer=gb;hr.PrototypeChainMaterializer=gb=q7([(0,G7.injectable)(),W7("design:paramtypes",[z7.NonInheritablePropertyRegistry,H7.PropertyCardinalityRegistry])],gb)});var Sb=S(ar=>{"use strict";var Y7=ar&&ar.__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},K7=ar&&ar.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ar,"__esModule",{value:!0});ar.SourceAnnotator=ar.DEPTH_VARIABLE=ar.SOURCE_VARIABLE=void 0;var X7=ce(),rl=He(),J7=xe(),em=yb();ar.SOURCE_VARIABLE="_source";ar.DEPTH_VARIABLE="_depth";var _b=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(ar.SOURCE_VARIABLE,new rl.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(ar.SOURCE_VARIABLE,new rl.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(ar.SOURCE_VARIABLE,new rl.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,em.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=em.MAX_PROTOTYPE_DEPTH;i++){let s=(0,em.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(ar.SOURCE_VARIABLE,new rl.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 J7.IRI))c.set(ar.SOURCE_VARIABLE,new rl.Literal("own"));else{let l=a.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(a,void 0,void 0,em.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(ar.SOURCE_VARIABLE,new rl.Literal(u))}r.push(c)}return r}};ar.SourceAnnotator=_b;ar.SourceAnnotator=_b=Y7([(0,X7.injectable)(),K7("design:paramtypes",[Object])],_b)});var vb=S(Pi=>{"use strict";var Z7=Pi&&Pi.__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},e8=Pi&&Pi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},nx=Pi&&Pi.__param||function(n,e){return function(t,r){e(t,r,n)}},nl;Object.defineProperty(Pi,"__esModule",{value:!0});Pi.NoteToRDFConverter=void 0;var bb=ce(),cn=ri(),ko=xe(),En=He(),ix=qt(),Jt=Cr(),sx=wt(),t8=ob(),r8=Hu(),Tn=v0(),Mo=nl=class{static{o(this,"NoteToRDFConverter")}constructor(e,t=r8.NullLogger){this.vault=e,this.logger=t,this.OBSIDIAN_VAULT_SCHEME="obsidian://vault/",this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new t8.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?Tn.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Jt.Namespace.EXO.term("Asset_fileName");r.push(new cn.Triple(i,s,new En.Literal(e.basename)));for(let[c,l]of Object.entries(t)){if(!this.isExocortexProperty(c))continue;let u=this.propertyKeyToIRI(c),f=Array.isArray(l)?l:[l];for(let d of f)if(c==="exo__Instance_class"){let h=this.valueToClassURI(d);r.push(new cn.Triple(i,u,h))}else{let h=await this.valueToRDFObject(d,e);for(let p of h)if(r.push(new cn.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof ko.IRI){let _=this.vocabularyMapper.generateMappedTriple(i,c,p);_&&r.push(_)}}if(c==="exo__Instance_class")for(let d of f){let h=this.valueToClassURI(d);if(h instanceof ko.IRI){let p=Jt.Namespace.RDF.term("type");r.push(new cn.Triple(i,p,h))}}if(c==="exo__Asset_label"){let d=Jt.Namespace.RDFS.term("label");for(let h of f)typeof h=="string"&&h.length>0&&r.push(new cn.Triple(i,d,new En.Literal(h)))}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=Tn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Tn.Exo003MetadataType.Namespace:break;case Tn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Tn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Tn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Tn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new ko.IRI(t.uri);return[new cn.Triple(r,Jt.Namespace.OWL.term("sameAs"),i),new cn.Triple(i,Jt.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 cn.Triple(r,Jt.Namespace.OWL.term("sameAs"),new ix.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Tn.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new cn.Triple(a,Jt.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 ko.IRI(c.value):new ix.BlankNode(c.value),f=new ko.IRI(l.value),d=Tn.Exo003Parser.toLiteral(t,s.trim());r.push(new cn.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new cn.Triple(h,Jt.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&&Tn.Exo003Parser.isExo003Format(a)){let c=Tn.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Tn.Exo003MetadataType.Anchor||l.metadata===Tn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Tn.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=await this.convertNote(a);r.push(...c)}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}}}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=encodeURI(r.path),s=`${this.OBSIDIAN_VAULT_SCHEME}${i}`;ko.IRI.isValidIRI(s)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){let t=encodeURI(e);return new ko.IRI(`${this.OBSIDIAN_VAULT_SCHEME}${t}`)}isExocortexProperty(e){return nl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))}propertyKeyToIRI(e){for(let[t,r]of nl.NAMESPACE_MAP)if(e.startsWith(t))return r.term(e.substring(t.length));throw new Error(`Invalid property key: ${e}`)}async valueToRDFObject(e,t){if(typeof e=="string"){let r=this.removeQuotes(e),i=this.extractWikilink(r);if(i){let s=this.vault.getFirstLinkpathDest(i,t.path);if(s){let a=this.notePathToIRI(s.path),c=i.includes("|")?i.split("|")[0]:i;if(this.isUUID(c)){let l=new En.Literal(c),u=this.expandClassValue(s.basename);if(u)return[u];let f=this.vault.getFrontmatter(s);if(f){let d=f.exo__Asset_label;if(typeof d=="string"){let h=this.expandClassValue(d);if(h)return[h]}}return[a,l]}return[a]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return[new En.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new En.Literal(r,Jt.Namespace.XSD.term("dateTime"))]:[new En.Literal(r)]}return typeof e=="boolean"?[new En.Literal(e.toString())]:typeof e=="number"?[new En.Literal(e.toString(),Jt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new En.Literal(e.toISOString(),Jt.Namespace.XSD.term("dateTime"))]:[new En.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 En.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 En.Literal(t)}isClassReference(e){return nl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))&&!/\s/.test(e)}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);for(let[r,i]of nl.NAMESPACE_MAP)if(t.startsWith(r))return i.term(t.substring(r.length));return null}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=Jt.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 cn.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new cn.Triple(t,c,f)):r.push(new cn.Triple(t,c,new En.Literal(l)))}else r.push(new cn.Triple(t,c,new En.Literal(l)))}}catch{}return r}};Pi.NoteToRDFConverter=Mo;Mo.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Mo.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Mo.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};Mo.NAMESPACE_MAP=[["exo__",Jt.Namespace.EXO],["ems__",Jt.Namespace.EMS],["exocmd__",Jt.Namespace.EXOCMD],["ims__",Jt.Namespace.IMS],["ztlk__",Jt.Namespace.ZTLK],["ptms__",Jt.Namespace.PTMS],["lit__",Jt.Namespace.LIT],["inbox__",Jt.Namespace.INBOX]];Pi.NoteToRDFConverter=Mo=nl=Z7([(0,bb.injectable)(),nx(0,(0,bb.inject)(sx.DI_TOKENS.IVaultAdapter)),nx(1,(0,bb.inject)(sx.DI_TOKENS.ILogger)),e8("design:paramtypes",[Object,Object])],Mo)});var Eb=S(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.FilterContainsOptimizer=void 0;var n8=xe(),i8=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,wb=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(i8);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 n8.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)}};tm.FilterContainsOptimizer=wb});var ax=S(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.AlgebraOptimizer=void 0;var s8=Eb(),Tb=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new s8.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)}};rm.AlgebraOptimizer=Tb});var ox=S(nm=>{"use strict";Object.defineProperty(nm,"__esModule",{value:!0});nm.AlgebraSerializer=void 0;var Ab=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
377
|
+
`),t}};Kp.RDFSerializer=sb});var ob=S(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});Xp.RDFVocabularyMapper=void 0;var Jt=ri(),KA=xe(),X=Cr(),ab=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 Jt.Triple(X.Namespace.EXO.term("Asset"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDFS.term("Resource"))),e.push(new Jt.Triple(X.Namespace.EXO.term("Class"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDFS.term("Class"))),e.push(new Jt.Triple(X.Namespace.EXO.term("Property"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDF.term("Property"))),e.push(new Jt.Triple(X.Namespace.EMS.term("Task"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EMS.term("Project"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EMS.term("Area"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EMS.term("Workflow"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EMS.term("WorkflowState"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EMS.term("WorkflowTransition"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EXOCMD.term("Command"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EXOCMD.term("Precondition"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EXOCMD.term("Grounding"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Jt.Triple(X.Namespace.EXOCMD.term("CommandBinding"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new Jt.Triple(X.Namespace.EXO.term("Instance_class"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDF.term("type"))),e.push(new Jt.Triple(X.Namespace.EXO.term("Asset_isDefinedBy"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("isDefinedBy"))),e.push(new Jt.Triple(X.Namespace.EXO.term("Class_superClass"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("subClassOf"))),e.push(new Jt.Triple(X.Namespace.EXO.term("Property_range"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("range"))),e.push(new Jt.Triple(X.Namespace.EXO.term("Property_domain"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("domain"))),e.push(new Jt.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 KA.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 KA.IRI(r)}return new Jt.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Xp.RDFVocabularyMapper=ab});var XA=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.RDFSInferenceEngine=void 0;var j7=ri(),Jp=xe(),cb=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 Jp.IRI){let h=a.get(d.object.value);if(h)for(let p of h)u.push(new j7.Triple(d.subject,i,new Jp.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 Jp.IRI&&s.object instanceof Jp.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}};Zp.RDFSInferenceEngine=cb});var fb=S(No=>{"use strict";var $7=No&&No.__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(No,"__esModule",{value:!0});No.NonInheritablePropertyRegistry=void 0;var B7=ce(),JA=xe(),ZA=He(),lb=Cr(),ub=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 ZA.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 ZA.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof JA.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 JA.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?lb.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?lb.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?lb.Namespace.EXOCMD.term(e.substring(8)).value:null}};No.NonInheritablePropertyRegistry=ub;No.NonInheritablePropertyRegistry=ub=$7([(0,B7.injectable)()],ub)});var pb=S(Lo=>{"use strict";var V7=Lo&&Lo.__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(Lo,"__esModule",{value:!0});Lo.PropertyCardinalityRegistry=void 0;var U7=ce(),ex=xe(),tx=He(),db=Cr(),hb=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 tx.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 tx.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof ex.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 ex.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?db.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?db.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?db.Namespace.EXOCMD.term(e.substring(8)).value:null}};Lo.PropertyCardinalityRegistry=hb;Lo.PropertyCardinalityRegistry=hb=V7([(0,U7.injectable)()],hb)});var yb=S(hr=>{"use strict";var q7=hr&&hr.__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},W7=hr&&hr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(hr,"__esModule",{value:!0});hr.PrototypeChainMaterializer=hr.MAX_PROTOTYPE_DEPTH=hr.INFERRED_GRAPH=void 0;hr.inferredGraphForDepth=mb;var G7=ce(),rx=ri(),Ia=xe(),z7=fb(),H7=pb();hr.INFERRED_GRAPH=new Ia.IRI("https://exocortex.my/ontology/exo#inferred");var Q7="https://exocortex.my/ontology/exo#inferred/";function mb(n){return new Ia.IRI(`${Q7}${n}`)}o(mb,"inferredGraphForDepth");hr.MAX_PROTOTYPE_DEPTH=10;var gb=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 Ia.IRI&&c.object instanceof Ia.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 Ia.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 _=p.object instanceof Ia.IRI?p.object.value:String(p.object),b=h.get(p.predicate.value);b||(b=new Set,h.set(p.predicate.value,b)),b.add(_)}for(let p=0;p<u.length;p++){let _=u[p],b=p+1,E=new Ia.IRI(_),v=await e.match(E,void 0,void 0),A=new Set;if(e.matchInGraph){let R=await e.matchInGraph(E,void 0,void 0,hr.INFERRED_GRAPH);for(let B of R)A.add(B.predicate.value)}for(let R of v){let B=R.predicate.value;if(this.registry.isNonInheritable(B)||A.has(B))continue;if(d.has(B)&&this.isMultiValued(B)){let ve=R.object instanceof Ia.IRI?R.object.value:String(R.object);if(h.get(B)?.has(ve))continue;let G=h.get(B);G||(G=new Set,h.set(B,G)),G.add(ve);let F=new rx.Triple(l,R.predicate,R.object);await e.add(F),e.addToGraph&&(await e.addToGraph(F,hr.INFERRED_GRAPH),await e.addToGraph(F,mb(b))),a++;continue}if(d.has(B))continue;let W=new rx.Triple(l,R.predicate,R.object);await e.add(W),e.addToGraph&&(await e.addToGraph(W,hr.INFERRED_GRAPH),await e.addToGraph(W,mb(b))),d.add(B),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<hr.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}};hr.PrototypeChainMaterializer=gb;hr.PrototypeChainMaterializer=gb=q7([(0,G7.injectable)(),W7("design:paramtypes",[z7.NonInheritablePropertyRegistry,H7.PropertyCardinalityRegistry])],gb)});var Sb=S(ar=>{"use strict";var Y7=ar&&ar.__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},K7=ar&&ar.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ar,"__esModule",{value:!0});ar.SourceAnnotator=ar.DEPTH_VARIABLE=ar.SOURCE_VARIABLE=void 0;var X7=ce(),rl=He(),J7=xe(),em=yb();ar.SOURCE_VARIABLE="_source";ar.DEPTH_VARIABLE="_depth";var _b=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(ar.SOURCE_VARIABLE,new rl.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(ar.SOURCE_VARIABLE,new rl.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(ar.SOURCE_VARIABLE,new rl.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,em.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=em.MAX_PROTOTYPE_DEPTH;i++){let s=(0,em.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(ar.SOURCE_VARIABLE,new rl.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 J7.IRI))c.set(ar.SOURCE_VARIABLE,new rl.Literal("own"));else{let l=a.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(a,void 0,void 0,em.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(ar.SOURCE_VARIABLE,new rl.Literal(u))}r.push(c)}return r}};ar.SourceAnnotator=_b;ar.SourceAnnotator=_b=Y7([(0,X7.injectable)(),K7("design:paramtypes",[Object])],_b)});var vb=S(Pi=>{"use strict";var Z7=Pi&&Pi.__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},e8=Pi&&Pi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},nx=Pi&&Pi.__param||function(n,e){return function(t,r){e(t,r,n)}},nl;Object.defineProperty(Pi,"__esModule",{value:!0});Pi.NoteToRDFConverter=void 0;var bb=ce(),cn=ri(),ko=xe(),En=He(),ix=qt(),Wt=Cr(),sx=wt(),t8=ob(),r8=Hu(),Tn=v0(),Mo=nl=class{static{o(this,"NoteToRDFConverter")}constructor(e,t=r8.NullLogger){this.vault=e,this.logger=t,this.OBSIDIAN_VAULT_SCHEME="obsidian://vault/",this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new t8.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?Tn.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Wt.Namespace.EXO.term("Asset_fileName");r.push(new cn.Triple(i,s,new En.Literal(e.basename)));for(let[c,l]of Object.entries(t)){if(!this.isExocortexProperty(c))continue;let u=this.propertyKeyToIRI(c),f=Array.isArray(l)?l:[l];for(let d of f)if(c==="exo__Instance_class"){let h=this.valueToClassURI(d);r.push(new cn.Triple(i,u,h))}else{let h=await this.valueToRDFObject(d,e);for(let p of h)if(r.push(new cn.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof ko.IRI){let _=this.vocabularyMapper.generateMappedTriple(i,c,p);_&&r.push(_)}}if(c==="exo__Instance_class")for(let d of f){let h=this.valueToClassURI(d);if(h instanceof ko.IRI){let p=Wt.Namespace.RDF.term("type");r.push(new cn.Triple(i,p,h))}}if(c==="exo__Asset_label"){let d=Wt.Namespace.RDFS.term("label");for(let h of f)typeof h=="string"&&h.length>0&&r.push(new cn.Triple(i,d,new En.Literal(h)))}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=Tn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Tn.Exo003MetadataType.Namespace:break;case Tn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Tn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Tn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Tn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new ko.IRI(t.uri);return[new cn.Triple(r,Wt.Namespace.OWL.term("sameAs"),i),new cn.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 cn.Triple(r,Wt.Namespace.OWL.term("sameAs"),new ix.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Tn.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new cn.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 ko.IRI(c.value):new ix.BlankNode(c.value),f=new ko.IRI(l.value),d=Tn.Exo003Parser.toLiteral(t,s.trim());r.push(new cn.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new cn.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&&Tn.Exo003Parser.isExo003Format(a)){let c=Tn.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Tn.Exo003MetadataType.Anchor||l.metadata===Tn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Tn.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=await this.convertNote(a);r.push(...c)}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}}}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=encodeURI(r.path),s=`${this.OBSIDIAN_VAULT_SCHEME}${i}`;ko.IRI.isValidIRI(s)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){let t=encodeURI(e);return new ko.IRI(`${this.OBSIDIAN_VAULT_SCHEME}${t}`)}isExocortexProperty(e){return nl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))}propertyKeyToIRI(e){for(let[t,r]of nl.NAMESPACE_MAP)if(e.startsWith(t))return r.term(e.substring(t.length));throw new Error(`Invalid property key: ${e}`)}async valueToRDFObject(e,t){if(typeof e=="string"){let r=this.removeQuotes(e),i=this.extractWikilink(r);if(i){let s=this.vault.getFirstLinkpathDest(i,t.path);if(s){let a=this.notePathToIRI(s.path),c=i.includes("|")?i.split("|")[0]:i;if(this.isUUID(c)){let u=new En.Literal(c),f=this.expandClassValue(s.basename);if(f)return[f];let d=this.vault.getFrontmatter(s);if(d){let h=d.exo__Asset_label;if(typeof h=="string"){let p=this.expandClassValue(h);if(p)return[p]}}return[a,u]}let l=this.expandClassValue(s.basename);return l?[l]:[a]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return[new En.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new En.Literal(r,Wt.Namespace.XSD.term("dateTime"))]:[new En.Literal(r)]}return typeof e=="boolean"?[new En.Literal(e.toString())]:typeof e=="number"?[new En.Literal(e.toString(),Wt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new En.Literal(e.toISOString(),Wt.Namespace.XSD.term("dateTime"))]:[new En.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 En.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 En.Literal(t)}isClassReference(e){return nl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))&&!/\s/.test(e)}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);for(let[r,i]of nl.NAMESPACE_MAP)if(t.startsWith(r))return i.term(t.substring(r.length));return null}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 cn.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new cn.Triple(t,c,f)):r.push(new cn.Triple(t,c,new En.Literal(l)))}else r.push(new cn.Triple(t,c,new En.Literal(l)))}}catch{}return r}};Pi.NoteToRDFConverter=Mo;Mo.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Mo.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Mo.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};Mo.NAMESPACE_MAP=[["exo__",Wt.Namespace.EXO],["ems__",Wt.Namespace.EMS],["exocmd__",Wt.Namespace.EXOCMD],["ims__",Wt.Namespace.IMS],["ztlk__",Wt.Namespace.ZTLK],["ptms__",Wt.Namespace.PTMS],["lit__",Wt.Namespace.LIT],["inbox__",Wt.Namespace.INBOX],["pmbok__",Wt.Namespace.PMBOK]];Pi.NoteToRDFConverter=Mo=nl=Z7([(0,bb.injectable)(),nx(0,(0,bb.inject)(sx.DI_TOKENS.IVaultAdapter)),nx(1,(0,bb.inject)(sx.DI_TOKENS.ILogger)),e8("design:paramtypes",[Object,Object])],Mo)});var Eb=S(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.FilterContainsOptimizer=void 0;var n8=xe(),i8=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,wb=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(i8);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 n8.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)}};tm.FilterContainsOptimizer=wb});var ax=S(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.AlgebraOptimizer=void 0;var s8=Eb(),Tb=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new s8.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)}};rm.AlgebraOptimizer=Tb});var ox=S(nm=>{"use strict";Object.defineProperty(nm,"__esModule",{value:!0});nm.AlgebraSerializer=void 0;var Ab=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
378
378
|
${e.triples.map(u=>`${r} ${this.tripleToString(u)}`).join(`
|
|
379
379
|
`)}
|
|
380
380
|
${r}]`;case"filter":return`${r}Filter(
|
|
@@ -452,13 +452,13 @@ To resolve:
|
|
|
452
452
|
\u2022 Verify all required dependencies are available
|
|
453
453
|
\u2022 Review service logs for detailed error information
|
|
454
454
|
\u2022 Contact support if the issue persists`}};Rm.ServiceError=iv});var zx=S(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 q$=cs();Object.defineProperty(er,"ErrorCode",{enumerable:!0,get:o(function(){return q$.ErrorCode},"get")});var W$=ls();Object.defineProperty(er,"ApplicationError",{enumerable:!0,get:o(function(){return W$.ApplicationError},"get")});var G$=$x();Object.defineProperty(er,"ValidationError",{enumerable:!0,get:o(function(){return G$.ValidationError},"get")});var z$=Bx();Object.defineProperty(er,"NetworkError",{enumerable:!0,get:o(function(){return z$.NetworkError},"get")});var H$=Vx();Object.defineProperty(er,"StateTransitionError",{enumerable:!0,get:o(function(){return H$.StateTransitionError},"get")});var Q$=Ux();Object.defineProperty(er,"PermissionError",{enumerable:!0,get:o(function(){return Q$.PermissionError},"get")});var Y$=qx();Object.defineProperty(er,"NotFoundError",{enumerable:!0,get:o(function(){return Y$.NotFoundError},"get")});var K$=Wx();Object.defineProperty(er,"ResourceExhaustedError",{enumerable:!0,get:o(function(){return K$.ResourceExhaustedError},"get")});var X$=Gx();Object.defineProperty(er,"ServiceError",{enumerable:!0,get:o(function(){return X$.ServiceError},"get")})});var Hx=S(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});Om.ApplicationErrorHandler=void 0;var sv=ls(),J$=cs(),Z$=Ta(),av=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 sv.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends sv.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 sv.ApplicationError{static{o(this,"UnknownError")}constructor(s,a){super(s,{originalError:a.name,...t}),this.code=J$.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(`
|
|
455
|
-
`)}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){Z$.LoggingService.error("Error in telemetry hook",i instanceof Error?i:new Error(String(i)))}}};Om.ApplicationErrorHandler=av});var Qx=S(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.ApplicationErrorHandler=void 0;var eB=Hx();Object.defineProperty(Pm,"ApplicationErrorHandler",{enumerable:!0,get:o(function(){return eB.ApplicationErrorHandler},"get")})});var Wt=S(m=>{"use strict";var tB=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]})),Hn=m&&m.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&tB(e,n,t)};Object.defineProperty(m,"__esModule",{value:!0});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.ServiceRegistry=m.GroundingExecutor=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.getEffortStatusLabel=m.isTrashedStatus=m.isDoneStatus=m.normalizeEffortStatus=m.EFFORT_STATUS_OPTIONS=m.STATUS_NAME_TO_WIKILINK=m.STATUS_NAME_TO_ENUM=m.EFFORT_STATUS_CONFIG=void 0;m.RDFSInferenceEngine=m.RDFVocabularyMapper=m.InMemoryTripleStore=m.NullLogger=m.RDFSerializer=m.FilenameValidator=m.EffortSortingHelpers=m.MetadataExtractor=m.MetadataHelpers=m.WikiLinkHelpers=m.DateFormatter=m.FrontmatterService=m.CriticalityZoneUUIDs=m.CriticalityZoneService=m.DailyReviewService=m.DEFAULT_AUTOCOMPLETE_CONFIG=m.AutocompleteService=m.TrendDetectionService=m.AnalyticsService=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=m.AlgorithmExtractor=m.DynamicFrontmatterGenerator=m.FleetingNoteCreationService=m.SupervisionCreationService=m.StatusTimestampService=void 0;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=m.INFERRED_GRAPH=m.PrototypeChainMaterializer=m.PropertyCardinalityRegistry=m.NonInheritablePropertyRegistry=void 0;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.TransactionError=m.TripleNotFoundError=m.TripleAlreadyExistsError=m.FileAlreadyExistsError=m.FileNotFoundError=m.FilterContainsOptimizer=void 0;Hn(du(),m);Hn(fc(),m);var Pa=My();Object.defineProperty(m,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return Pa.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(m,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return Pa.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(m,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return Pa.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(m,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return Pa.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(m,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return Pa.normalizeEffortStatus},"get")});Object.defineProperty(m,"isDoneStatus",{enumerable:!0,get:o(function(){return Pa.isDoneStatus},"get")});Object.defineProperty(m,"isTrashedStatus",{enumerable:!0,get:o(function(){return Pa.isTrashedStatus},"get")});Object.defineProperty(m,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return Pa.getEffortStatusLabel},"get")});var rB=dc();Object.defineProperty(m,"GroundingType",{enumerable:!0,get:o(function(){return rB.GroundingType},"get")});var of=jy();Object.defineProperty(m,"CommandProperty",{enumerable:!0,get:o(function(){return of.CommandProperty},"get")});Object.defineProperty(m,"PreconditionProperty",{enumerable:!0,get:o(function(){return of.PreconditionProperty},"get")});Object.defineProperty(m,"GroundingProperty",{enumerable:!0,get:o(function(){return of.GroundingProperty},"get")});Object.defineProperty(m,"CommandBindingProperty",{enumerable:!0,get:o(function(){return of.CommandBindingProperty},"get")});Object.defineProperty(m,"CommandBindingStyleProperty",{enumerable:!0,get:o(function(){return of.CommandBindingStyleProperty},"get")});var dl=uE();Object.defineProperty(m,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:o(function(){return dl.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(m,"LABEL_CLASS_VALUES",{enumerable:!0,get:o(function(){return dl.LABEL_CLASS_VALUES},"get")});Object.defineProperty(m,"STYLE_SOURCE_VALUES",{enumerable:!0,get:o(function(){return dl.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(m,"isCommandVariant",{enumerable:!0,get:o(function(){return dl.isCommandVariant},"get")});Object.defineProperty(m,"isLabelClass",{enumerable:!0,get:o(function(){return dl.isLabelClass},"get")});Object.defineProperty(m,"isStyleSource",{enumerable:!0,get:o(function(){return dl.isStyleSource},"get")});var Fm=fE();Object.defineProperty(m,"isCommandFrontmatter",{enumerable:!0,get:o(function(){return Fm.isCommandFrontmatter},"get")});Object.defineProperty(m,"isPreconditionFrontmatter",{enumerable:!0,get:o(function(){return Fm.isPreconditionFrontmatter},"get")});Object.defineProperty(m,"isGroundingFrontmatter",{enumerable:!0,get:o(function(){return Fm.isGroundingFrontmatter},"get")});Object.defineProperty(m,"isCommandBindingFrontmatter",{enumerable:!0,get:o(function(){return Fm.isCommandBindingFrontmatter},"get")});Hn(dE(),m);Hn(hE(),m);Hn($y(),m);Hn(By(),m);Hn(mE(),m);Hn(_E(),m);Hn(v0(),m);Hn(aT(),m);var Yx=ch();Object.defineProperty(m,"PropertyFieldType",{enumerable:!0,get:o(function(){return Yx.PropertyFieldType},"get")});Object.defineProperty(m,"rangeToFieldType",{enumerable:!0,get:o(function(){return Yx.rangeToFieldType},"get")});var ov=A0();Object.defineProperty(m,"propertyNameToUri",{enumerable:!0,get:o(function(){return ov.propertyNameToUri},"get")});Object.defineProperty(m,"uriToPropertyName",{enumerable:!0,get:o(function(){return ov.uriToPropertyName},"get")});Object.defineProperty(m,"extractPropertyLabel",{enumerable:!0,get:o(function(){return ov.extractPropertyLabel},"get")});var nB=L3();Object.defineProperty(m,"CommandResolver",{enumerable:!0,get:o(function(){return nB.CommandResolver},"get")});var iB=M3();Object.defineProperty(m,"PreconditionEvaluator",{enumerable:!0,get:o(function(){return iB.PreconditionEvaluator},"get")});var Kx=$3();Object.defineProperty(m,"GroundingExecutor",{enumerable:!0,get:o(function(){return Kx.GroundingExecutor},"get")});Object.defineProperty(m,"ServiceRegistry",{enumerable:!0,get:o(function(){return Kx.ServiceRegistry},"get")});var sB=$1();Object.defineProperty(m,"TaskStatusService",{enumerable:!0,get:o(function(){return sB.TaskStatusService},"get")});var aB=q1();Object.defineProperty(m,"AreaCreationService",{enumerable:!0,get:o(function(){return aB.AreaCreationService},"get")});var oB=G1();Object.defineProperty(m,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return oB.AreaHierarchyBuilder},"get")});var cB=H1();Object.defineProperty(m,"ClassCreationService",{enumerable:!0,get:o(function(){return cB.ClassCreationService},"get")});var lB=Y1();Object.defineProperty(m,"ConceptCreationService",{enumerable:!0,get:o(function(){return lB.ConceptCreationService},"get")});var uB=Lp();Object.defineProperty(m,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return uB.EffortStatusWorkflow},"get")});var fB=Wu();Object.defineProperty(m,"WorkflowEngine",{enumerable:!0,get:o(function(){return fB.WorkflowEngine},"get")});var dB=C1();Object.defineProperty(m,"WorkflowResolver",{enumerable:!0,get:o(function(){return dB.WorkflowResolver},"get")});var hB=Z3();Object.defineProperty(m,"InstantiationRuleResolver",{enumerable:!0,get:o(function(){return hB.InstantiationRuleResolver},"get")});var pB=eA();Object.defineProperty(m,"VisibilityGenerator",{enumerable:!0,get:o(function(){return pB.VisibilityGenerator},"get")});var mB=tA();Object.defineProperty(m,"WorkflowCommandAdapter",{enumerable:!0,get:o(function(){return mB.WorkflowCommandAdapter},"get")});var gB=rS();Object.defineProperty(m,"EffortVotingService",{enumerable:!0,get:o(function(){return gB.EffortVotingService},"get")});var yB=iS();Object.defineProperty(m,"FolderRepairService",{enumerable:!0,get:o(function(){return yB.FolderRepairService},"get")});var _B=aS();Object.defineProperty(m,"LabelToAliasService",{enumerable:!0,get:o(function(){return _B.LabelToAliasService},"get")});var SB=Ta();Object.defineProperty(m,"LoggingService",{enumerable:!0,get:o(function(){return SB.LoggingService},"get")});var bB=lS();Object.defineProperty(m,"PropertyCleanupService",{enumerable:!0,get:o(function(){return bB.PropertyCleanupService},"get")});var vB=fS();Object.defineProperty(m,"RenameToUidService",{enumerable:!0,get:o(function(){return vB.RenameToUidService},"get")});var wB=Mp();Object.defineProperty(m,"StatusTimestampService",{enumerable:!0,get:o(function(){return wB.StatusTimestampService},"get")});var EB=pS();Object.defineProperty(m,"SupervisionCreationService",{enumerable:!0,get:o(function(){return EB.SupervisionCreationService},"get")});var TB=yS();Object.defineProperty(m,"FleetingNoteCreationService",{enumerable:!0,get:o(function(){return TB.FleetingNoteCreationService},"get")});var AB=SS();Object.defineProperty(m,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return AB.DynamicFrontmatterGenerator},"get")});var xB=vS();Object.defineProperty(m,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return xB.AlgorithmExtractor},"get")});var CB=ES();Object.defineProperty(m,"PlanningService",{enumerable:!0,get:o(function(){return CB.PlanningService},"get")});var IB=pA();Object.defineProperty(m,"PropertySchemaResolver",{enumerable:!0,get:o(function(){return IB.PropertySchemaResolver},"get")});var RB=mA();Object.defineProperty(m,"ClassHierarchyResolver",{enumerable:!0,get:o(function(){return RB.ClassHierarchyResolver},"get")});var OB=gA();Object.defineProperty(m,"EnumValueResolver",{enumerable:!0,get:o(function(){return OB.EnumValueResolver},"get")});var PB=IS();Object.defineProperty(m,"AssetConversionService",{enumerable:!0,get:o(function(){return PB.AssetConversionService},"get")});var FB=PS();Object.defineProperty(m,"SessionEventService",{enumerable:!0,get:o(function(){return FB.SessionEventService},"get")});var DB=NS();Object.defineProperty(m,"URIConstructionService",{enumerable:!0,get:o(function(){return DB.URIConstructionService},"get")});var NB=kS();Object.defineProperty(m,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return NB.GenericAssetCreationService},"get")});var LB=xA();Object.defineProperty(m,"ArchiveAssetService",{enumerable:!0,get:o(function(){return LB.ArchiveAssetService},"get")});var kB=IA();Object.defineProperty(m,"FixMissingLabelService",{enumerable:!0,get:o(function(){return kB.FixMissingLabelService},"get")});var MB=RA();Object.defineProperty(m,"GraphQueryService",{enumerable:!0,get:o(function(){return MB.GraphQueryService},"get")});var jB=PA();Object.defineProperty(m,"TypeRegistry",{enumerable:!0,get:o(function(){return jB.TypeRegistry},"get")});var Xx=FA();Object.defineProperty(m,"NLToSPARQLService",{enumerable:!0,get:o(function(){return Xx.NLToSPARQLService},"get")});Object.defineProperty(m,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return Xx.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var Qn=VS();Object.defineProperty(m,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return Qn.SPARQL_TEMPLATES},"get")});Object.defineProperty(m,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return Qn.SPARQL_PREFIXES},"get")});Object.defineProperty(m,"PREDICATES",{enumerable:!0,get:o(function(){return Qn.PREDICATES},"get")});Object.defineProperty(m,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return Qn.ASSET_CLASSES},"get")});Object.defineProperty(m,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return Qn.EFFORT_STATUSES},"get")});Object.defineProperty(m,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return Qn.KNOWN_PROTOTYPES},"get")});Object.defineProperty(m,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return Qn.KNOWN_CLASSES},"get")});Object.defineProperty(m,"findClassByTerm",{enumerable:!0,get:o(function(){return Qn.findClassByTerm},"get")});Object.defineProperty(m,"findMatchingTemplates",{enumerable:!0,get:o(function(){return Qn.findMatchingTemplates},"get")});Object.defineProperty(m,"fillTemplate",{enumerable:!0,get:o(function(){return Qn.fillTemplate},"get")});Object.defineProperty(m,"validateParameters",{enumerable:!0,get:o(function(){return Qn.validateParameters},"get")});Object.defineProperty(m,"getTemplateByName",{enumerable:!0,get:o(function(){return Qn.getTemplateByName},"get")});var $B=NA();Object.defineProperty(m,"AnalyticsService",{enumerable:!0,get:o(function(){return $B.AnalyticsService},"get")});var BB=LA();Object.defineProperty(m,"TrendDetectionService",{enumerable:!0,get:o(function(){return BB.TrendDetectionService},"get")});var Jx=MA();Object.defineProperty(m,"AutocompleteService",{enumerable:!0,get:o(function(){return Jx.AutocompleteService},"get")});Object.defineProperty(m,"DEFAULT_AUTOCOMPLETE_CONFIG",{enumerable:!0,get:o(function(){return Jx.DEFAULT_AUTOCOMPLETE_CONFIG},"get")});var VB=$A();Object.defineProperty(m,"DailyReviewService",{enumerable:!0,get:o(function(){return VB.DailyReviewService},"get")});var Zx=QS();Object.defineProperty(m,"CriticalityZoneService",{enumerable:!0,get:o(function(){return Zx.CriticalityZoneService},"get")});Object.defineProperty(m,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return Zx.CriticalityZoneUUIDs},"get")});var UB=qn();Object.defineProperty(m,"FrontmatterService",{enumerable:!0,get:o(function(){return UB.FrontmatterService},"get")});var qB=Ur();Object.defineProperty(m,"DateFormatter",{enumerable:!0,get:o(function(){return qB.DateFormatter},"get")});var WB=Ps();Object.defineProperty(m,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return WB.WikiLinkHelpers},"get")});var GB=ns();Object.defineProperty(m,"MetadataHelpers",{enumerable:!0,get:o(function(){return GB.MetadataHelpers},"get")});var zB=V1();Object.defineProperty(m,"MetadataExtractor",{enumerable:!0,get:o(function(){return zB.MetadataExtractor},"get")});var HB=VA();Object.defineProperty(m,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return HB.EffortSortingHelpers},"get")});var QB=UA();Object.defineProperty(m,"FilenameValidator",{enumerable:!0,get:o(function(){return QB.FilenameValidator},"get")});var YB=YA();Object.defineProperty(m,"RDFSerializer",{enumerable:!0,get:o(function(){return YB.RDFSerializer},"get")});var KB=Hu();Object.defineProperty(m,"NullLogger",{enumerable:!0,get:o(function(){return KB.NullLogger},"get")});var XB=L1();Object.defineProperty(m,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return XB.InMemoryTripleStore},"get")});var JB=ob();Object.defineProperty(m,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return JB.RDFVocabularyMapper},"get")});var ZB=XA();Object.defineProperty(m,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return ZB.RDFSInferenceEngine},"get")});var eV=fb();Object.defineProperty(m,"NonInheritablePropertyRegistry",{enumerable:!0,get:o(function(){return eV.NonInheritablePropertyRegistry},"get")});var tV=pb();Object.defineProperty(m,"PropertyCardinalityRegistry",{enumerable:!0,get:o(function(){return tV.PropertyCardinalityRegistry},"get")});var eC=yb();Object.defineProperty(m,"PrototypeChainMaterializer",{enumerable:!0,get:o(function(){return eC.PrototypeChainMaterializer},"get")});Object.defineProperty(m,"INFERRED_GRAPH",{enumerable:!0,get:o(function(){return eC.INFERRED_GRAPH},"get")});var tC=Sb();Object.defineProperty(m,"SourceAnnotator",{enumerable:!0,get:o(function(){return tC.SourceAnnotator},"get")});Object.defineProperty(m,"SOURCE_VARIABLE",{enumerable:!0,get:o(function(){return tC.SOURCE_VARIABLE},"get")});var rV=vb();Object.defineProperty(m,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return rV.NoteToRDFConverter},"get")});var cv=Fu();Object.defineProperty(m,"ExoQLParser",{enumerable:!0,get:o(function(){return cv.ExoQLParser},"get")});Object.defineProperty(m,"SPARQLParser",{enumerable:!0,get:o(function(){return cv.SPARQLParser},"get")});Object.defineProperty(m,"SPARQLParseError",{enumerable:!0,get:o(function(){return cv.SPARQLParseError},"get")});var rC=E_();Object.defineProperty(m,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return rC.DescribeOptionsTransformer},"get")});Object.defineProperty(m,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return rC.DescribeOptionsTransformerError},"get")});var nC=Du();Object.defineProperty(m,"ExoQLAlgebraTranslator",{enumerable:!0,get:o(function(){return nC.ExoQLAlgebraTranslator},"get")});Object.defineProperty(m,"AlgebraTranslator",{enumerable:!0,get:o(function(){return nC.AlgebraTranslator},"get")});var nV=ax();Object.defineProperty(m,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return nV.AlgebraOptimizer},"get")});var iV=ox();Object.defineProperty(m,"AlgebraSerializer",{enumerable:!0,get:o(function(){return iV.AlgebraSerializer},"get")});var sV=V_();Object.defineProperty(m,"BGPExecutor",{enumerable:!0,get:o(function(){return sV.BGPExecutor},"get")});var aV=pp();Object.defineProperty(m,"FilterExecutor",{enumerable:!0,get:o(function(){return aV.FilterExecutor},"get")});var oV=r1();Object.defineProperty(m,"OptionalExecutor",{enumerable:!0,get:o(function(){return oV.OptionalExecutor},"get")});var cV=i1();Object.defineProperty(m,"UnionExecutor",{enumerable:!0,get:o(function(){return cV.UnionExecutor},"get")});var lV=p1();Object.defineProperty(m,"ConstructExecutor",{enumerable:!0,get:o(function(){return lV.ConstructExecutor},"get")});var uV=lx();Object.defineProperty(m,"DescribeExecutor",{enumerable:!0,get:o(function(){return uV.DescribeExecutor},"get")});var iC=$u();Object.defineProperty(m,"ExoQLQueryExecutor",{enumerable:!0,get:o(function(){return iC.ExoQLQueryExecutor},"get")});Object.defineProperty(m,"QueryExecutor",{enumerable:!0,get:o(function(){return iC.QueryExecutor},"get")});var sC=fx();Object.defineProperty(m,"UpdateExecutor",{enumerable:!0,get:o(function(){return sC.UpdateExecutor},"get")});Object.defineProperty(m,"UpdateExecutorError",{enumerable:!0,get:o(function(){return sC.UpdateExecutorError},"get")});var fV=es();Object.defineProperty(m,"SolutionMapping",{enumerable:!0,get:o(function(){return fV.SolutionMapping},"get")});var dV=hp();Object.defineProperty(m,"BuiltInFunctions",{enumerable:!0,get:o(function(){return dV.BuiltInFunctions},"get")});var hV=hx();Object.defineProperty(m,"AggregateFunctions",{enumerable:!0,get:o(function(){return hV.AggregateFunctions},"get")});var aC=o1();Object.defineProperty(m,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return aC.CustomAggregateRegistry},"get")});Object.defineProperty(m,"CustomAggregateError",{enumerable:!0,get:o(function(){return aC.CustomAggregateError},"get")});var us=c1();Object.defineProperty(m,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return us.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(m,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return us.EXO_AGGREGATE_NS},"get")});Object.defineProperty(m,"medianAggregate",{enumerable:!0,get:o(function(){return us.medianAggregate},"get")});Object.defineProperty(m,"varianceAggregate",{enumerable:!0,get:o(function(){return us.varianceAggregate},"get")});Object.defineProperty(m,"stddevAggregate",{enumerable:!0,get:o(function(){return us.stddevAggregate},"get")});Object.defineProperty(m,"modeAggregate",{enumerable:!0,get:o(function(){return us.modeAggregate},"get")});Object.defineProperty(m,"createPercentileAggregate",{enumerable:!0,get:o(function(){return us.createPercentileAggregate},"get")});Object.defineProperty(m,"getNumericValue",{enumerable:!0,get:o(function(){return us.getNumericValue},"get")});Object.defineProperty(m,"createDecimalLiteral",{enumerable:!0,get:o(function(){return us.createDecimalLiteral},"get")});Object.defineProperty(m,"createDoubleLiteral",{enumerable:!0,get:o(function(){return us.createDoubleLiteral},"get")});var pV=px();Object.defineProperty(m,"QueryPlanCache",{enumerable:!0,get:o(function(){return pV.QueryPlanCache},"get")});var oC=mx();Object.defineProperty(m,"SPARQLResultCache",{enumerable:!0,get:o(function(){return oC.SPARQLResultCache},"get")});Object.defineProperty(m,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return oC.createSPARQLResultCache},"get")});var cC=gx();Object.defineProperty(m,"IncrementalIndexer",{enumerable:!0,get:o(function(){return cC.IncrementalIndexer},"get")});Object.defineProperty(m,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return cC.createIncrementalIndexer},"get")});var mV=yx();Object.defineProperty(m,"ResultSerializer",{enumerable:!0,get:o(function(){return mV.ResultSerializer},"get")});var lC=b_();Object.defineProperty(m,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return lC.CaseWhenTransformer},"get")});Object.defineProperty(m,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return lC.CaseWhenTransformerError},"get")});var gV=C_();Object.defineProperty(m,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return gV.VaultPrefixTransformer},"get")});var yV=Eb();Object.defineProperty(m,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return yV.FilterContainsOptimizer},"get")});var uC=_x();Object.defineProperty(m,"FileNotFoundError",{enumerable:!0,get:o(function(){return uC.FileNotFoundError},"get")});Object.defineProperty(m,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return uC.FileAlreadyExistsError},"get")});var lv=P1();Object.defineProperty(m,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return lv.TripleAlreadyExistsError},"get")});Object.defineProperty(m,"TripleNotFoundError",{enumerable:!0,get:o(function(){return lv.TripleNotFoundError},"get")});Object.defineProperty(m,"TransactionError",{enumerable:!0,get:o(function(){return lv.TransactionError},"get")});var Dm=kb();Object.defineProperty(m,"VaultSettings",{enumerable:!0,get:o(function(){return Dm.VaultSettings},"get")});Object.defineProperty(m,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:o(function(){return Dm.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(m,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:o(function(){return Dm.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(m,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:o(function(){return Dm.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var _V=wt();Object.defineProperty(m,"DI_TOKENS",{enumerable:!0,get:o(function(){return _V.DI_TOKENS},"get")});var cf=Sx();Object.defineProperty(m,"registerCoreServices",{enumerable:!0,get:o(function(){return cf.registerCoreServices},"get")});Object.defineProperty(m,"createChildContainer",{enumerable:!0,get:o(function(){return cf.createChildContainer},"get")});Object.defineProperty(m,"getContainer",{enumerable:!0,get:o(function(){return cf.getContainer},"get")});Object.defineProperty(m,"resetContainer",{enumerable:!0,get:o(function(){return cf.resetContainer},"get")});Object.defineProperty(m,"container",{enumerable:!0,get:o(function(){return cf.container},"get")});var Js=Ax();Object.defineProperty(m,"NODE_FLAGS",{enumerable:!0,get:o(function(){return Js.NODE_FLAGS},"get")});Object.defineProperty(m,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return Js.DEFAULT_COLORS},"get")});Object.defineProperty(m,"StringTable",{enumerable:!0,get:o(function(){return Js.StringTable},"get")});Object.defineProperty(m,"CompactGraphStore",{enumerable:!0,get:o(function(){return Js.CompactGraphStore},"get")});Object.defineProperty(m,"MemoryPool",{enumerable:!0,get:o(function(){return Js.MemoryPool},"get")});Object.defineProperty(m,"getGlobalPool",{enumerable:!0,get:o(function(){return Js.getGlobalPool},"get")});Object.defineProperty(m,"resetGlobalPool",{enumerable:!0,get:o(function(){return Js.resetGlobalPool},"get")});Object.defineProperty(m,"StreamingLoader",{enumerable:!0,get:o(function(){return Js.StreamingLoader},"get")});Object.defineProperty(m,"createStreamingSource",{enumerable:!0,get:o(function(){return Js.createStreamingSource},"get")});var fC=xx();Object.defineProperty(m,"ExoQL",{enumerable:!0,get:o(function(){return fC.ExoQL},"get")});Object.defineProperty(m,"ExoQLError",{enumerable:!0,get:o(function(){return fC.ExoQLError},"get")});var hl=_m();Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_IRI",{enumerable:!0,get:o(function(){return hl.RELATION_COLUMN_SET_CLASS_IRI},"get")});Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_UID",{enumerable:!0,get:o(function(){return hl.RELATION_COLUMN_SET_CLASS_UID},"get")});Object.defineProperty(m,"createRelationColumnSetFromFrontmatter",{enumerable:!0,get:o(function(){return hl.createRelationColumnSetFromFrontmatter},"get")});Object.defineProperty(m,"isRelationColumnSet",{enumerable:!0,get:o(function(){return hl.isRelationColumnSet},"get")});Object.defineProperty(m,"isRelationColumnSetFrontmatter",{enumerable:!0,get:o(function(){return hl.isRelationColumnSetFrontmatter},"get")});Object.defineProperty(m,"normalizeRelationColumnSetRef",{enumerable:!0,get:o(function(){return hl.normalizeRef},"get")});var SV=Lx();Object.defineProperty(m,"RelationColumnSetResolver",{enumerable:!0,get:o(function(){return SV.RelationColumnSetResolver},"get")});var lf=_m();Object.defineProperty(m,"LAYOUT_CLASS_IRI",{enumerable:!0,get:o(function(){return lf.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(m,"LAYOUT_CLASS_UID",{enumerable:!0,get:o(function(){return lf.LAYOUT_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutFromFrontmatter",{enumerable:!0,get:o(function(){return lf.createLayoutFromFrontmatter},"get")});Object.defineProperty(m,"isLayout",{enumerable:!0,get:o(function(){return lf.isLayout},"get")});Object.defineProperty(m,"isLayoutFrontmatter",{enumerable:!0,get:o(function(){return lf.isLayoutFrontmatter},"get")});var Fa=_m();Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Fa.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Fa.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Fa.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Fa.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:o(function(){return Fa.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(m,"isBacklinksTableBlock",{enumerable:!0,get:o(function(){return Fa.isBacklinksTableBlock},"get")});Object.defineProperty(m,"isLayoutBlockFrontmatter",{enumerable:!0,get:o(function(){return Fa.isLayoutBlockFrontmatter},"get")});Object.defineProperty(m,"isPropertiesBlock",{enumerable:!0,get:o(function(){return Fa.isPropertiesBlock},"get")});var dC=Mx();Object.defineProperty(m,"LayoutSelector",{enumerable:!0,get:o(function(){return dC.LayoutSelector},"get")});Object.defineProperty(m,"selectByPriority",{enumerable:!0,get:o(function(){return dC.selectByPriority},"get")});Hn(zx(),m);Hn(Qx(),m)});var mr=S(uv=>{"use strict";uv.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})};uv.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 pC=S((aae,hC)=>{var Da=require("constants"),bV=process.cwd,Nm=null,vV=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Nm||(Nm=bV.call(process)),Nm};try{process.cwd()}catch{}typeof process.chdir=="function"&&(fv=process.chdir,process.chdir=function(n){Nm=null,fv.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,fv));var fv;hC.exports=wV;function wV(n){Da.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(){}),vV==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function d(h,p,_){var b=Date.now(),E=0;f(h,p,o(function v(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){n.stat(p,function(R,B){R&&R.code==="ENOENT"?f(h,p,v):_(A)})},E),E<100&&(E+=10);return}_&&_(A)},"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,_,b,E,v){var A;if(v&&typeof v=="function"){var R=0;A=o(function(B,W,ve){if(B&&B.code==="EAGAIN"&&R<10)return R++,f.call(n,h,p,_,b,E,A);v.apply(this,arguments)},"callback")}return f.call(n,h,p,_,b,E,A)}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,_,b){for(var E=0;;)try{return f.call(n,d,h,p,_,b)}catch(v){if(v.code==="EAGAIN"&&E<10){E++;continue}throw v}}})(n.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,Da.O_WRONLY|Da.O_SYMLINK,h,function(_,b){if(_){p&&p(_);return}f.fchmod(b,h,function(E){f.close(b,function(v){p&&p(E||v)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,Da.O_WRONLY|Da.O_SYMLINK,h),_=!0,b;try{b=f.fchmodSync(p,h),_=!1}finally{if(_)try{f.closeSync(p)}catch{}else f.closeSync(p)}return b}}o(e,"patchLchmod");function t(f){Da.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,_){f.open(d,Da.O_SYMLINK,function(b,E){if(b){_&&_(b);return}f.futimes(E,h,p,function(v){f.close(E,function(A){_&&_(v||A)})})})},f.lutimesSync=function(d,h,p){var _=f.openSync(d,Da.O_SYMLINK),b,E=!0;try{b=f.futimesSync(_,h,p),E=!1}finally{if(E)try{f.closeSync(_)}catch{}else f.closeSync(_)}return b}):f.futimes&&(f.lutimes=function(d,h,p,_){_&&process.nextTick(_)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(d,h,p){return f.call(n,d,h,function(_){u(_)&&(_=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,_){return f.call(n,d,h,p,function(b){u(b)&&(b=null),_&&_.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(d,h,p){try{return f.call(n,d,h,p)}catch(_){if(!u(_))throw _}}}o(a,"chownFixSync");function c(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function _(b,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),p&&p.apply(this,arguments)}return o(_,"callback"),h?f.call(n,d,h,_):f.call(n,d,_)}}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(wV,"patch")});var yC=S((cae,gC)=>{var mC=require("stream").Stream;gC.exports=EV;function EV(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);mC.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);mC.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(EV,"legacy")});var SC=S((uae,_C)=>{"use strict";_C.exports=AV;var TV=Object.getPrototypeOf||function(n){return n.__proto__};function AV(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:TV(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(AV,"clone")});var ml=S((dae,pv)=>{var kt=require("fs"),xV=pC(),CV=yC(),IV=SC(),Lm=require("util"),Fr,Mm;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Fr=Symbol.for("graceful-fs.queue"),Mm=Symbol.for("graceful-fs.previous")):(Fr="___graceful-fs.queue",Mm="___graceful-fs.previous");function RV(){}o(RV,"noop");function wC(n,e){Object.defineProperty(n,Fr,{get:o(function(){return e},"get")})}o(wC,"publishQueue");var jo=RV;Lm.debuglog?jo=Lm.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(jo=o(function(){var n=Lm.format.apply(Lm,arguments);n="GFS4: "+n.split(/\n/).join(`
|
|
455
|
+
`)}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){Z$.LoggingService.error("Error in telemetry hook",i instanceof Error?i:new Error(String(i)))}}};Om.ApplicationErrorHandler=av});var Qx=S(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.ApplicationErrorHandler=void 0;var eB=Hx();Object.defineProperty(Pm,"ApplicationErrorHandler",{enumerable:!0,get:o(function(){return eB.ApplicationErrorHandler},"get")})});var Gt=S(m=>{"use strict";var tB=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]})),Hn=m&&m.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&tB(e,n,t)};Object.defineProperty(m,"__esModule",{value:!0});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.ServiceRegistry=m.GroundingExecutor=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.getEffortStatusLabel=m.isTrashedStatus=m.isDoneStatus=m.normalizeEffortStatus=m.EFFORT_STATUS_OPTIONS=m.STATUS_NAME_TO_WIKILINK=m.STATUS_NAME_TO_ENUM=m.EFFORT_STATUS_CONFIG=void 0;m.RDFSInferenceEngine=m.RDFVocabularyMapper=m.InMemoryTripleStore=m.NullLogger=m.RDFSerializer=m.FilenameValidator=m.EffortSortingHelpers=m.MetadataExtractor=m.MetadataHelpers=m.WikiLinkHelpers=m.DateFormatter=m.FrontmatterService=m.CriticalityZoneUUIDs=m.CriticalityZoneService=m.DailyReviewService=m.DEFAULT_AUTOCOMPLETE_CONFIG=m.AutocompleteService=m.TrendDetectionService=m.AnalyticsService=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=m.AlgorithmExtractor=m.DynamicFrontmatterGenerator=m.FleetingNoteCreationService=m.SupervisionCreationService=m.StatusTimestampService=void 0;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=m.INFERRED_GRAPH=m.PrototypeChainMaterializer=m.PropertyCardinalityRegistry=m.NonInheritablePropertyRegistry=void 0;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.TransactionError=m.TripleNotFoundError=m.TripleAlreadyExistsError=m.FileAlreadyExistsError=m.FileNotFoundError=m.FilterContainsOptimizer=void 0;Hn(du(),m);Hn(fc(),m);var Pa=My();Object.defineProperty(m,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return Pa.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(m,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return Pa.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(m,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return Pa.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(m,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return Pa.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(m,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return Pa.normalizeEffortStatus},"get")});Object.defineProperty(m,"isDoneStatus",{enumerable:!0,get:o(function(){return Pa.isDoneStatus},"get")});Object.defineProperty(m,"isTrashedStatus",{enumerable:!0,get:o(function(){return Pa.isTrashedStatus},"get")});Object.defineProperty(m,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return Pa.getEffortStatusLabel},"get")});var rB=dc();Object.defineProperty(m,"GroundingType",{enumerable:!0,get:o(function(){return rB.GroundingType},"get")});var of=jy();Object.defineProperty(m,"CommandProperty",{enumerable:!0,get:o(function(){return of.CommandProperty},"get")});Object.defineProperty(m,"PreconditionProperty",{enumerable:!0,get:o(function(){return of.PreconditionProperty},"get")});Object.defineProperty(m,"GroundingProperty",{enumerable:!0,get:o(function(){return of.GroundingProperty},"get")});Object.defineProperty(m,"CommandBindingProperty",{enumerable:!0,get:o(function(){return of.CommandBindingProperty},"get")});Object.defineProperty(m,"CommandBindingStyleProperty",{enumerable:!0,get:o(function(){return of.CommandBindingStyleProperty},"get")});var dl=uE();Object.defineProperty(m,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:o(function(){return dl.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(m,"LABEL_CLASS_VALUES",{enumerable:!0,get:o(function(){return dl.LABEL_CLASS_VALUES},"get")});Object.defineProperty(m,"STYLE_SOURCE_VALUES",{enumerable:!0,get:o(function(){return dl.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(m,"isCommandVariant",{enumerable:!0,get:o(function(){return dl.isCommandVariant},"get")});Object.defineProperty(m,"isLabelClass",{enumerable:!0,get:o(function(){return dl.isLabelClass},"get")});Object.defineProperty(m,"isStyleSource",{enumerable:!0,get:o(function(){return dl.isStyleSource},"get")});var Fm=fE();Object.defineProperty(m,"isCommandFrontmatter",{enumerable:!0,get:o(function(){return Fm.isCommandFrontmatter},"get")});Object.defineProperty(m,"isPreconditionFrontmatter",{enumerable:!0,get:o(function(){return Fm.isPreconditionFrontmatter},"get")});Object.defineProperty(m,"isGroundingFrontmatter",{enumerable:!0,get:o(function(){return Fm.isGroundingFrontmatter},"get")});Object.defineProperty(m,"isCommandBindingFrontmatter",{enumerable:!0,get:o(function(){return Fm.isCommandBindingFrontmatter},"get")});Hn(dE(),m);Hn(hE(),m);Hn($y(),m);Hn(By(),m);Hn(mE(),m);Hn(_E(),m);Hn(v0(),m);Hn(aT(),m);var Yx=ch();Object.defineProperty(m,"PropertyFieldType",{enumerable:!0,get:o(function(){return Yx.PropertyFieldType},"get")});Object.defineProperty(m,"rangeToFieldType",{enumerable:!0,get:o(function(){return Yx.rangeToFieldType},"get")});var ov=A0();Object.defineProperty(m,"propertyNameToUri",{enumerable:!0,get:o(function(){return ov.propertyNameToUri},"get")});Object.defineProperty(m,"uriToPropertyName",{enumerable:!0,get:o(function(){return ov.uriToPropertyName},"get")});Object.defineProperty(m,"extractPropertyLabel",{enumerable:!0,get:o(function(){return ov.extractPropertyLabel},"get")});var nB=L3();Object.defineProperty(m,"CommandResolver",{enumerable:!0,get:o(function(){return nB.CommandResolver},"get")});var iB=M3();Object.defineProperty(m,"PreconditionEvaluator",{enumerable:!0,get:o(function(){return iB.PreconditionEvaluator},"get")});var Kx=$3();Object.defineProperty(m,"GroundingExecutor",{enumerable:!0,get:o(function(){return Kx.GroundingExecutor},"get")});Object.defineProperty(m,"ServiceRegistry",{enumerable:!0,get:o(function(){return Kx.ServiceRegistry},"get")});var sB=$1();Object.defineProperty(m,"TaskStatusService",{enumerable:!0,get:o(function(){return sB.TaskStatusService},"get")});var aB=q1();Object.defineProperty(m,"AreaCreationService",{enumerable:!0,get:o(function(){return aB.AreaCreationService},"get")});var oB=G1();Object.defineProperty(m,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return oB.AreaHierarchyBuilder},"get")});var cB=H1();Object.defineProperty(m,"ClassCreationService",{enumerable:!0,get:o(function(){return cB.ClassCreationService},"get")});var lB=Y1();Object.defineProperty(m,"ConceptCreationService",{enumerable:!0,get:o(function(){return lB.ConceptCreationService},"get")});var uB=Lp();Object.defineProperty(m,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return uB.EffortStatusWorkflow},"get")});var fB=Wu();Object.defineProperty(m,"WorkflowEngine",{enumerable:!0,get:o(function(){return fB.WorkflowEngine},"get")});var dB=C1();Object.defineProperty(m,"WorkflowResolver",{enumerable:!0,get:o(function(){return dB.WorkflowResolver},"get")});var hB=Z3();Object.defineProperty(m,"InstantiationRuleResolver",{enumerable:!0,get:o(function(){return hB.InstantiationRuleResolver},"get")});var pB=eA();Object.defineProperty(m,"VisibilityGenerator",{enumerable:!0,get:o(function(){return pB.VisibilityGenerator},"get")});var mB=tA();Object.defineProperty(m,"WorkflowCommandAdapter",{enumerable:!0,get:o(function(){return mB.WorkflowCommandAdapter},"get")});var gB=rS();Object.defineProperty(m,"EffortVotingService",{enumerable:!0,get:o(function(){return gB.EffortVotingService},"get")});var yB=iS();Object.defineProperty(m,"FolderRepairService",{enumerable:!0,get:o(function(){return yB.FolderRepairService},"get")});var _B=aS();Object.defineProperty(m,"LabelToAliasService",{enumerable:!0,get:o(function(){return _B.LabelToAliasService},"get")});var SB=Ta();Object.defineProperty(m,"LoggingService",{enumerable:!0,get:o(function(){return SB.LoggingService},"get")});var bB=lS();Object.defineProperty(m,"PropertyCleanupService",{enumerable:!0,get:o(function(){return bB.PropertyCleanupService},"get")});var vB=fS();Object.defineProperty(m,"RenameToUidService",{enumerable:!0,get:o(function(){return vB.RenameToUidService},"get")});var wB=Mp();Object.defineProperty(m,"StatusTimestampService",{enumerable:!0,get:o(function(){return wB.StatusTimestampService},"get")});var EB=pS();Object.defineProperty(m,"SupervisionCreationService",{enumerable:!0,get:o(function(){return EB.SupervisionCreationService},"get")});var TB=yS();Object.defineProperty(m,"FleetingNoteCreationService",{enumerable:!0,get:o(function(){return TB.FleetingNoteCreationService},"get")});var AB=SS();Object.defineProperty(m,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return AB.DynamicFrontmatterGenerator},"get")});var xB=vS();Object.defineProperty(m,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return xB.AlgorithmExtractor},"get")});var CB=ES();Object.defineProperty(m,"PlanningService",{enumerable:!0,get:o(function(){return CB.PlanningService},"get")});var IB=pA();Object.defineProperty(m,"PropertySchemaResolver",{enumerable:!0,get:o(function(){return IB.PropertySchemaResolver},"get")});var RB=mA();Object.defineProperty(m,"ClassHierarchyResolver",{enumerable:!0,get:o(function(){return RB.ClassHierarchyResolver},"get")});var OB=gA();Object.defineProperty(m,"EnumValueResolver",{enumerable:!0,get:o(function(){return OB.EnumValueResolver},"get")});var PB=IS();Object.defineProperty(m,"AssetConversionService",{enumerable:!0,get:o(function(){return PB.AssetConversionService},"get")});var FB=PS();Object.defineProperty(m,"SessionEventService",{enumerable:!0,get:o(function(){return FB.SessionEventService},"get")});var DB=NS();Object.defineProperty(m,"URIConstructionService",{enumerable:!0,get:o(function(){return DB.URIConstructionService},"get")});var NB=kS();Object.defineProperty(m,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return NB.GenericAssetCreationService},"get")});var LB=xA();Object.defineProperty(m,"ArchiveAssetService",{enumerable:!0,get:o(function(){return LB.ArchiveAssetService},"get")});var kB=IA();Object.defineProperty(m,"FixMissingLabelService",{enumerable:!0,get:o(function(){return kB.FixMissingLabelService},"get")});var MB=RA();Object.defineProperty(m,"GraphQueryService",{enumerable:!0,get:o(function(){return MB.GraphQueryService},"get")});var jB=PA();Object.defineProperty(m,"TypeRegistry",{enumerable:!0,get:o(function(){return jB.TypeRegistry},"get")});var Xx=FA();Object.defineProperty(m,"NLToSPARQLService",{enumerable:!0,get:o(function(){return Xx.NLToSPARQLService},"get")});Object.defineProperty(m,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return Xx.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var Qn=VS();Object.defineProperty(m,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return Qn.SPARQL_TEMPLATES},"get")});Object.defineProperty(m,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return Qn.SPARQL_PREFIXES},"get")});Object.defineProperty(m,"PREDICATES",{enumerable:!0,get:o(function(){return Qn.PREDICATES},"get")});Object.defineProperty(m,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return Qn.ASSET_CLASSES},"get")});Object.defineProperty(m,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return Qn.EFFORT_STATUSES},"get")});Object.defineProperty(m,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return Qn.KNOWN_PROTOTYPES},"get")});Object.defineProperty(m,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return Qn.KNOWN_CLASSES},"get")});Object.defineProperty(m,"findClassByTerm",{enumerable:!0,get:o(function(){return Qn.findClassByTerm},"get")});Object.defineProperty(m,"findMatchingTemplates",{enumerable:!0,get:o(function(){return Qn.findMatchingTemplates},"get")});Object.defineProperty(m,"fillTemplate",{enumerable:!0,get:o(function(){return Qn.fillTemplate},"get")});Object.defineProperty(m,"validateParameters",{enumerable:!0,get:o(function(){return Qn.validateParameters},"get")});Object.defineProperty(m,"getTemplateByName",{enumerable:!0,get:o(function(){return Qn.getTemplateByName},"get")});var $B=NA();Object.defineProperty(m,"AnalyticsService",{enumerable:!0,get:o(function(){return $B.AnalyticsService},"get")});var BB=LA();Object.defineProperty(m,"TrendDetectionService",{enumerable:!0,get:o(function(){return BB.TrendDetectionService},"get")});var Jx=MA();Object.defineProperty(m,"AutocompleteService",{enumerable:!0,get:o(function(){return Jx.AutocompleteService},"get")});Object.defineProperty(m,"DEFAULT_AUTOCOMPLETE_CONFIG",{enumerable:!0,get:o(function(){return Jx.DEFAULT_AUTOCOMPLETE_CONFIG},"get")});var VB=$A();Object.defineProperty(m,"DailyReviewService",{enumerable:!0,get:o(function(){return VB.DailyReviewService},"get")});var Zx=QS();Object.defineProperty(m,"CriticalityZoneService",{enumerable:!0,get:o(function(){return Zx.CriticalityZoneService},"get")});Object.defineProperty(m,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return Zx.CriticalityZoneUUIDs},"get")});var UB=qn();Object.defineProperty(m,"FrontmatterService",{enumerable:!0,get:o(function(){return UB.FrontmatterService},"get")});var qB=Ur();Object.defineProperty(m,"DateFormatter",{enumerable:!0,get:o(function(){return qB.DateFormatter},"get")});var WB=Ps();Object.defineProperty(m,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return WB.WikiLinkHelpers},"get")});var GB=ns();Object.defineProperty(m,"MetadataHelpers",{enumerable:!0,get:o(function(){return GB.MetadataHelpers},"get")});var zB=V1();Object.defineProperty(m,"MetadataExtractor",{enumerable:!0,get:o(function(){return zB.MetadataExtractor},"get")});var HB=VA();Object.defineProperty(m,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return HB.EffortSortingHelpers},"get")});var QB=UA();Object.defineProperty(m,"FilenameValidator",{enumerable:!0,get:o(function(){return QB.FilenameValidator},"get")});var YB=YA();Object.defineProperty(m,"RDFSerializer",{enumerable:!0,get:o(function(){return YB.RDFSerializer},"get")});var KB=Hu();Object.defineProperty(m,"NullLogger",{enumerable:!0,get:o(function(){return KB.NullLogger},"get")});var XB=L1();Object.defineProperty(m,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return XB.InMemoryTripleStore},"get")});var JB=ob();Object.defineProperty(m,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return JB.RDFVocabularyMapper},"get")});var ZB=XA();Object.defineProperty(m,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return ZB.RDFSInferenceEngine},"get")});var eV=fb();Object.defineProperty(m,"NonInheritablePropertyRegistry",{enumerable:!0,get:o(function(){return eV.NonInheritablePropertyRegistry},"get")});var tV=pb();Object.defineProperty(m,"PropertyCardinalityRegistry",{enumerable:!0,get:o(function(){return tV.PropertyCardinalityRegistry},"get")});var eC=yb();Object.defineProperty(m,"PrototypeChainMaterializer",{enumerable:!0,get:o(function(){return eC.PrototypeChainMaterializer},"get")});Object.defineProperty(m,"INFERRED_GRAPH",{enumerable:!0,get:o(function(){return eC.INFERRED_GRAPH},"get")});var tC=Sb();Object.defineProperty(m,"SourceAnnotator",{enumerable:!0,get:o(function(){return tC.SourceAnnotator},"get")});Object.defineProperty(m,"SOURCE_VARIABLE",{enumerable:!0,get:o(function(){return tC.SOURCE_VARIABLE},"get")});var rV=vb();Object.defineProperty(m,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return rV.NoteToRDFConverter},"get")});var cv=Fu();Object.defineProperty(m,"ExoQLParser",{enumerable:!0,get:o(function(){return cv.ExoQLParser},"get")});Object.defineProperty(m,"SPARQLParser",{enumerable:!0,get:o(function(){return cv.SPARQLParser},"get")});Object.defineProperty(m,"SPARQLParseError",{enumerable:!0,get:o(function(){return cv.SPARQLParseError},"get")});var rC=E_();Object.defineProperty(m,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return rC.DescribeOptionsTransformer},"get")});Object.defineProperty(m,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return rC.DescribeOptionsTransformerError},"get")});var nC=Du();Object.defineProperty(m,"ExoQLAlgebraTranslator",{enumerable:!0,get:o(function(){return nC.ExoQLAlgebraTranslator},"get")});Object.defineProperty(m,"AlgebraTranslator",{enumerable:!0,get:o(function(){return nC.AlgebraTranslator},"get")});var nV=ax();Object.defineProperty(m,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return nV.AlgebraOptimizer},"get")});var iV=ox();Object.defineProperty(m,"AlgebraSerializer",{enumerable:!0,get:o(function(){return iV.AlgebraSerializer},"get")});var sV=V_();Object.defineProperty(m,"BGPExecutor",{enumerable:!0,get:o(function(){return sV.BGPExecutor},"get")});var aV=pp();Object.defineProperty(m,"FilterExecutor",{enumerable:!0,get:o(function(){return aV.FilterExecutor},"get")});var oV=r1();Object.defineProperty(m,"OptionalExecutor",{enumerable:!0,get:o(function(){return oV.OptionalExecutor},"get")});var cV=i1();Object.defineProperty(m,"UnionExecutor",{enumerable:!0,get:o(function(){return cV.UnionExecutor},"get")});var lV=p1();Object.defineProperty(m,"ConstructExecutor",{enumerable:!0,get:o(function(){return lV.ConstructExecutor},"get")});var uV=lx();Object.defineProperty(m,"DescribeExecutor",{enumerable:!0,get:o(function(){return uV.DescribeExecutor},"get")});var iC=$u();Object.defineProperty(m,"ExoQLQueryExecutor",{enumerable:!0,get:o(function(){return iC.ExoQLQueryExecutor},"get")});Object.defineProperty(m,"QueryExecutor",{enumerable:!0,get:o(function(){return iC.QueryExecutor},"get")});var sC=fx();Object.defineProperty(m,"UpdateExecutor",{enumerable:!0,get:o(function(){return sC.UpdateExecutor},"get")});Object.defineProperty(m,"UpdateExecutorError",{enumerable:!0,get:o(function(){return sC.UpdateExecutorError},"get")});var fV=es();Object.defineProperty(m,"SolutionMapping",{enumerable:!0,get:o(function(){return fV.SolutionMapping},"get")});var dV=hp();Object.defineProperty(m,"BuiltInFunctions",{enumerable:!0,get:o(function(){return dV.BuiltInFunctions},"get")});var hV=hx();Object.defineProperty(m,"AggregateFunctions",{enumerable:!0,get:o(function(){return hV.AggregateFunctions},"get")});var aC=o1();Object.defineProperty(m,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return aC.CustomAggregateRegistry},"get")});Object.defineProperty(m,"CustomAggregateError",{enumerable:!0,get:o(function(){return aC.CustomAggregateError},"get")});var us=c1();Object.defineProperty(m,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return us.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(m,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return us.EXO_AGGREGATE_NS},"get")});Object.defineProperty(m,"medianAggregate",{enumerable:!0,get:o(function(){return us.medianAggregate},"get")});Object.defineProperty(m,"varianceAggregate",{enumerable:!0,get:o(function(){return us.varianceAggregate},"get")});Object.defineProperty(m,"stddevAggregate",{enumerable:!0,get:o(function(){return us.stddevAggregate},"get")});Object.defineProperty(m,"modeAggregate",{enumerable:!0,get:o(function(){return us.modeAggregate},"get")});Object.defineProperty(m,"createPercentileAggregate",{enumerable:!0,get:o(function(){return us.createPercentileAggregate},"get")});Object.defineProperty(m,"getNumericValue",{enumerable:!0,get:o(function(){return us.getNumericValue},"get")});Object.defineProperty(m,"createDecimalLiteral",{enumerable:!0,get:o(function(){return us.createDecimalLiteral},"get")});Object.defineProperty(m,"createDoubleLiteral",{enumerable:!0,get:o(function(){return us.createDoubleLiteral},"get")});var pV=px();Object.defineProperty(m,"QueryPlanCache",{enumerable:!0,get:o(function(){return pV.QueryPlanCache},"get")});var oC=mx();Object.defineProperty(m,"SPARQLResultCache",{enumerable:!0,get:o(function(){return oC.SPARQLResultCache},"get")});Object.defineProperty(m,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return oC.createSPARQLResultCache},"get")});var cC=gx();Object.defineProperty(m,"IncrementalIndexer",{enumerable:!0,get:o(function(){return cC.IncrementalIndexer},"get")});Object.defineProperty(m,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return cC.createIncrementalIndexer},"get")});var mV=yx();Object.defineProperty(m,"ResultSerializer",{enumerable:!0,get:o(function(){return mV.ResultSerializer},"get")});var lC=b_();Object.defineProperty(m,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return lC.CaseWhenTransformer},"get")});Object.defineProperty(m,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return lC.CaseWhenTransformerError},"get")});var gV=C_();Object.defineProperty(m,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return gV.VaultPrefixTransformer},"get")});var yV=Eb();Object.defineProperty(m,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return yV.FilterContainsOptimizer},"get")});var uC=_x();Object.defineProperty(m,"FileNotFoundError",{enumerable:!0,get:o(function(){return uC.FileNotFoundError},"get")});Object.defineProperty(m,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return uC.FileAlreadyExistsError},"get")});var lv=P1();Object.defineProperty(m,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return lv.TripleAlreadyExistsError},"get")});Object.defineProperty(m,"TripleNotFoundError",{enumerable:!0,get:o(function(){return lv.TripleNotFoundError},"get")});Object.defineProperty(m,"TransactionError",{enumerable:!0,get:o(function(){return lv.TransactionError},"get")});var Dm=kb();Object.defineProperty(m,"VaultSettings",{enumerable:!0,get:o(function(){return Dm.VaultSettings},"get")});Object.defineProperty(m,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:o(function(){return Dm.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(m,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:o(function(){return Dm.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(m,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:o(function(){return Dm.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var _V=wt();Object.defineProperty(m,"DI_TOKENS",{enumerable:!0,get:o(function(){return _V.DI_TOKENS},"get")});var cf=Sx();Object.defineProperty(m,"registerCoreServices",{enumerable:!0,get:o(function(){return cf.registerCoreServices},"get")});Object.defineProperty(m,"createChildContainer",{enumerable:!0,get:o(function(){return cf.createChildContainer},"get")});Object.defineProperty(m,"getContainer",{enumerable:!0,get:o(function(){return cf.getContainer},"get")});Object.defineProperty(m,"resetContainer",{enumerable:!0,get:o(function(){return cf.resetContainer},"get")});Object.defineProperty(m,"container",{enumerable:!0,get:o(function(){return cf.container},"get")});var Js=Ax();Object.defineProperty(m,"NODE_FLAGS",{enumerable:!0,get:o(function(){return Js.NODE_FLAGS},"get")});Object.defineProperty(m,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return Js.DEFAULT_COLORS},"get")});Object.defineProperty(m,"StringTable",{enumerable:!0,get:o(function(){return Js.StringTable},"get")});Object.defineProperty(m,"CompactGraphStore",{enumerable:!0,get:o(function(){return Js.CompactGraphStore},"get")});Object.defineProperty(m,"MemoryPool",{enumerable:!0,get:o(function(){return Js.MemoryPool},"get")});Object.defineProperty(m,"getGlobalPool",{enumerable:!0,get:o(function(){return Js.getGlobalPool},"get")});Object.defineProperty(m,"resetGlobalPool",{enumerable:!0,get:o(function(){return Js.resetGlobalPool},"get")});Object.defineProperty(m,"StreamingLoader",{enumerable:!0,get:o(function(){return Js.StreamingLoader},"get")});Object.defineProperty(m,"createStreamingSource",{enumerable:!0,get:o(function(){return Js.createStreamingSource},"get")});var fC=xx();Object.defineProperty(m,"ExoQL",{enumerable:!0,get:o(function(){return fC.ExoQL},"get")});Object.defineProperty(m,"ExoQLError",{enumerable:!0,get:o(function(){return fC.ExoQLError},"get")});var hl=_m();Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_IRI",{enumerable:!0,get:o(function(){return hl.RELATION_COLUMN_SET_CLASS_IRI},"get")});Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_UID",{enumerable:!0,get:o(function(){return hl.RELATION_COLUMN_SET_CLASS_UID},"get")});Object.defineProperty(m,"createRelationColumnSetFromFrontmatter",{enumerable:!0,get:o(function(){return hl.createRelationColumnSetFromFrontmatter},"get")});Object.defineProperty(m,"isRelationColumnSet",{enumerable:!0,get:o(function(){return hl.isRelationColumnSet},"get")});Object.defineProperty(m,"isRelationColumnSetFrontmatter",{enumerable:!0,get:o(function(){return hl.isRelationColumnSetFrontmatter},"get")});Object.defineProperty(m,"normalizeRelationColumnSetRef",{enumerable:!0,get:o(function(){return hl.normalizeRef},"get")});var SV=Lx();Object.defineProperty(m,"RelationColumnSetResolver",{enumerable:!0,get:o(function(){return SV.RelationColumnSetResolver},"get")});var lf=_m();Object.defineProperty(m,"LAYOUT_CLASS_IRI",{enumerable:!0,get:o(function(){return lf.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(m,"LAYOUT_CLASS_UID",{enumerable:!0,get:o(function(){return lf.LAYOUT_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutFromFrontmatter",{enumerable:!0,get:o(function(){return lf.createLayoutFromFrontmatter},"get")});Object.defineProperty(m,"isLayout",{enumerable:!0,get:o(function(){return lf.isLayout},"get")});Object.defineProperty(m,"isLayoutFrontmatter",{enumerable:!0,get:o(function(){return lf.isLayoutFrontmatter},"get")});var Fa=_m();Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Fa.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Fa.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Fa.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Fa.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:o(function(){return Fa.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(m,"isBacklinksTableBlock",{enumerable:!0,get:o(function(){return Fa.isBacklinksTableBlock},"get")});Object.defineProperty(m,"isLayoutBlockFrontmatter",{enumerable:!0,get:o(function(){return Fa.isLayoutBlockFrontmatter},"get")});Object.defineProperty(m,"isPropertiesBlock",{enumerable:!0,get:o(function(){return Fa.isPropertiesBlock},"get")});var dC=Mx();Object.defineProperty(m,"LayoutSelector",{enumerable:!0,get:o(function(){return dC.LayoutSelector},"get")});Object.defineProperty(m,"selectByPriority",{enumerable:!0,get:o(function(){return dC.selectByPriority},"get")});Hn(zx(),m);Hn(Qx(),m)});var mr=S(uv=>{"use strict";uv.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})};uv.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 pC=S((aae,hC)=>{var Da=require("constants"),bV=process.cwd,Nm=null,vV=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Nm||(Nm=bV.call(process)),Nm};try{process.cwd()}catch{}typeof process.chdir=="function"&&(fv=process.chdir,process.chdir=function(n){Nm=null,fv.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,fv));var fv;hC.exports=wV;function wV(n){Da.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(){}),vV==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function d(h,p,_){var b=Date.now(),E=0;f(h,p,o(function v(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){n.stat(p,function(R,B){R&&R.code==="ENOENT"?f(h,p,v):_(A)})},E),E<100&&(E+=10);return}_&&_(A)},"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,_,b,E,v){var A;if(v&&typeof v=="function"){var R=0;A=o(function(B,W,ve){if(B&&B.code==="EAGAIN"&&R<10)return R++,f.call(n,h,p,_,b,E,A);v.apply(this,arguments)},"callback")}return f.call(n,h,p,_,b,E,A)}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,_,b){for(var E=0;;)try{return f.call(n,d,h,p,_,b)}catch(v){if(v.code==="EAGAIN"&&E<10){E++;continue}throw v}}})(n.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,Da.O_WRONLY|Da.O_SYMLINK,h,function(_,b){if(_){p&&p(_);return}f.fchmod(b,h,function(E){f.close(b,function(v){p&&p(E||v)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,Da.O_WRONLY|Da.O_SYMLINK,h),_=!0,b;try{b=f.fchmodSync(p,h),_=!1}finally{if(_)try{f.closeSync(p)}catch{}else f.closeSync(p)}return b}}o(e,"patchLchmod");function t(f){Da.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,_){f.open(d,Da.O_SYMLINK,function(b,E){if(b){_&&_(b);return}f.futimes(E,h,p,function(v){f.close(E,function(A){_&&_(v||A)})})})},f.lutimesSync=function(d,h,p){var _=f.openSync(d,Da.O_SYMLINK),b,E=!0;try{b=f.futimesSync(_,h,p),E=!1}finally{if(E)try{f.closeSync(_)}catch{}else f.closeSync(_)}return b}):f.futimes&&(f.lutimes=function(d,h,p,_){_&&process.nextTick(_)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(d,h,p){return f.call(n,d,h,function(_){u(_)&&(_=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,_){return f.call(n,d,h,p,function(b){u(b)&&(b=null),_&&_.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(d,h,p){try{return f.call(n,d,h,p)}catch(_){if(!u(_))throw _}}}o(a,"chownFixSync");function c(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function _(b,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),p&&p.apply(this,arguments)}return o(_,"callback"),h?f.call(n,d,h,_):f.call(n,d,_)}}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(wV,"patch")});var yC=S((cae,gC)=>{var mC=require("stream").Stream;gC.exports=EV;function EV(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);mC.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);mC.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(EV,"legacy")});var SC=S((uae,_C)=>{"use strict";_C.exports=AV;var TV=Object.getPrototypeOf||function(n){return n.__proto__};function AV(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:TV(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(AV,"clone")});var ml=S((dae,pv)=>{var kt=require("fs"),xV=pC(),CV=yC(),IV=SC(),Lm=require("util"),Fr,Mm;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Fr=Symbol.for("graceful-fs.queue"),Mm=Symbol.for("graceful-fs.previous")):(Fr="___graceful-fs.queue",Mm="___graceful-fs.previous");function RV(){}o(RV,"noop");function wC(n,e){Object.defineProperty(n,Fr,{get:o(function(){return e},"get")})}o(wC,"publishQueue");var jo=RV;Lm.debuglog?jo=Lm.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(jo=o(function(){var n=Lm.format.apply(Lm,arguments);n="GFS4: "+n.split(/\n/).join(`
|
|
456
456
|
GFS4: `),console.error(n)},"debug"));kt[Fr]||(bC=global[Fr]||[],wC(kt,bC),kt.close=(function(n){function e(t,r){return n.call(kt,t,function(i){i||vC(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,Mm,{value:n}),e})(kt.close),kt.closeSync=(function(n){function e(t){n.apply(kt,arguments),vC()}return o(e,"closeSync"),Object.defineProperty(e,Mm,{value:n}),e})(kt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){jo(kt[Fr]),require("assert").equal(kt[Fr].length,0)}));var bC;global[Fr]||wC(global,kt[Fr]);pv.exports=dv(IV(kt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!kt.__patched&&(pv.exports=dv(kt),kt.__patched=!0);function dv(n){xV(n),n.gracefulify=dv,n.createReadStream=W,n.createWriteStream=ve;var e=n.readFile;n.readFile=t;function t(F,j,ee){return typeof j=="function"&&(ee=j,j=null),Ye(F,j,ee);function Ye(st,Rt,at,ct){return e(st,Rt,function(Ke){Ke&&(Ke.code==="EMFILE"||Ke.code==="ENFILE")?pl([Ye,[st,Rt,at],Ke,ct||Date.now(),Date.now()]):typeof at=="function"&&at.apply(this,arguments)})}o(Ye,"go$readFile")}o(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(F,j,ee,Ye){return typeof ee=="function"&&(Ye=ee,ee=null),st(F,j,ee,Ye);function st(Rt,at,ct,Ke,ne){return r(Rt,at,ct,function(V){V&&(V.code==="EMFILE"||V.code==="ENFILE")?pl([st,[Rt,at,ct,Ke],V,ne||Date.now(),Date.now()]):typeof Ke=="function"&&Ke.apply(this,arguments)})}o(st,"go$writeFile")}o(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=a);function a(F,j,ee,Ye){return typeof ee=="function"&&(Ye=ee,ee=null),st(F,j,ee,Ye);function st(Rt,at,ct,Ke,ne){return s(Rt,at,ct,function(V){V&&(V.code==="EMFILE"||V.code==="ENFILE")?pl([st,[Rt,at,ct,Ke],V,ne||Date.now(),Date.now()]):typeof Ke=="function"&&Ke.apply(this,arguments)})}o(st,"go$appendFile")}o(a,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(F,j,ee,Ye){return typeof ee=="function"&&(Ye=ee,ee=0),st(F,j,ee,Ye);function st(Rt,at,ct,Ke,ne){return c(Rt,at,ct,function(V){V&&(V.code==="EMFILE"||V.code==="ENFILE")?pl([st,[Rt,at,ct,Ke],V,ne||Date.now(),Date.now()]):typeof Ke=="function"&&Ke.apply(this,arguments)})}o(st,"go$copyFile")}o(l,"copyFile");var u=n.readdir;n.readdir=d;var f=/^v[0-5]\./;function d(F,j,ee){typeof j=="function"&&(ee=j,j=null);var Ye=f.test(process.version)?o(function(at,ct,Ke,ne){return u(at,st(at,ct,Ke,ne))},"go$readdir"):o(function(at,ct,Ke,ne){return u(at,ct,st(at,ct,Ke,ne))},"go$readdir");return Ye(F,j,ee);function st(Rt,at,ct,Ke){return function(ne,V){ne&&(ne.code==="EMFILE"||ne.code==="ENFILE")?pl([Ye,[Rt,at,ct],ne,Ke||Date.now(),Date.now()]):(V&&V.sort&&V.sort(),typeof ct=="function"&&ct.call(this,ne,V))}}}if(o(d,"readdir"),process.version.substr(0,4)==="v0.8"){var h=CV(n);v=h.ReadStream,R=h.WriteStream}var p=n.ReadStream;p&&(v.prototype=Object.create(p.prototype),v.prototype.open=A);var _=n.WriteStream;_&&(R.prototype=Object.create(_.prototype),R.prototype.open=B),Object.defineProperty(n,"ReadStream",{get:o(function(){return v},"get"),set:o(function(F){v=F},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return R},"get"),set:o(function(F){R=F},"set"),enumerable:!0,configurable:!0});var b=v;Object.defineProperty(n,"FileReadStream",{get:o(function(){return b},"get"),set:o(function(F){b=F},"set"),enumerable:!0,configurable:!0});var E=R;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return E},"get"),set:o(function(F){E=F},"set"),enumerable:!0,configurable:!0});function v(F,j){return this instanceof v?(p.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}o(v,"ReadStream");function A(){var F=this;G(F.path,F.flags,F.mode,function(j,ee){j?(F.autoClose&&F.destroy(),F.emit("error",j)):(F.fd=ee,F.emit("open",ee),F.read())})}o(A,"ReadStream$open");function R(F,j){return this instanceof R?(_.apply(this,arguments),this):R.apply(Object.create(R.prototype),arguments)}o(R,"WriteStream");function B(){var F=this;G(F.path,F.flags,F.mode,function(j,ee){j?(F.destroy(),F.emit("error",j)):(F.fd=ee,F.emit("open",ee))})}o(B,"WriteStream$open");function W(F,j){return new n.ReadStream(F,j)}o(W,"createReadStream");function ve(F,j){return new n.WriteStream(F,j)}o(ve,"createWriteStream");var z=n.open;n.open=G;function G(F,j,ee,Ye){return typeof ee=="function"&&(Ye=ee,ee=null),st(F,j,ee,Ye);function st(Rt,at,ct,Ke,ne){return z(Rt,at,ct,function(V,lt){V&&(V.code==="EMFILE"||V.code==="ENFILE")?pl([st,[Rt,at,ct,Ke],V,ne||Date.now(),Date.now()]):typeof Ke=="function"&&Ke.apply(this,arguments)})}o(st,"go$open")}return o(G,"open"),n}o(dv,"patch");function pl(n){jo("ENQUEUE",n[0].name,n[1]),kt[Fr].push(n),hv()}o(pl,"enqueue");var km;function vC(){for(var n=Date.now(),e=0;e<kt[Fr].length;++e)kt[Fr][e].length>2&&(kt[Fr][e][3]=n,kt[Fr][e][4]=n);hv()}o(vC,"resetQueue");function hv(){if(clearTimeout(km),km=void 0,kt[Fr].length!==0){var n=kt[Fr].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)jo("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){jo("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?(jo("RETRY",e.name,t),e.apply(null,t.concat([i]))):kt[Fr].push(n)}km===void 0&&(km=setTimeout(hv,0))}}o(hv,"retry")});var un=S(Zs=>{"use strict";var EC=mr().fromCallback,ln=ml(),OV=["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 ln[n]=="function");Object.assign(Zs,ln);OV.forEach(n=>{Zs[n]=EC(ln[n])});Zs.exists=function(n,e){return typeof e=="function"?ln.exists(n,e):new Promise(t=>ln.exists(n,t))};Zs.read=function(n,e,t,r,i,s){return typeof s=="function"?ln.read(n,e,t,r,i,s):new Promise((a,c)=>{ln.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};Zs.write=function(n,e,...t){return typeof t[t.length-1]=="function"?ln.write(n,e,...t):new Promise((r,i)=>{ln.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};Zs.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?ln.readv(n,e,...t):new Promise((r,i)=>{ln.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};Zs.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?ln.writev(n,e,...t):new Promise((r,i)=>{ln.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof ln.realpath.native=="function"?Zs.realpath.native=EC(ln.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var AC=S((mae,TC)=>{"use strict";var PV=require("path");TC.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(PV.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var RC=S((yae,mv)=>{"use strict";var xC=un(),{checkPath:CC}=AC(),IC=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");mv.exports.makeDir=async(n,e)=>(CC(n),xC.mkdir(n,{mode:IC(e),recursive:!0}));mv.exports.makeDirSync=(n,e)=>(CC(n),xC.mkdirSync(n,{mode:IC(e),recursive:!0}))});var Di=S((Sae,OC)=>{"use strict";var FV=mr().fromPromise,{makeDir:DV,makeDirSync:gv}=RC(),yv=FV(DV);OC.exports={mkdirs:yv,mkdirsSync:gv,mkdirp:yv,mkdirpSync:gv,ensureDir:yv,ensureDirSync:gv}});var Na=S((bae,FC)=>{"use strict";var NV=mr().fromPromise,PC=un();function LV(n){return PC.access(n).then(()=>!0).catch(()=>!1)}o(LV,"pathExists");FC.exports={pathExists:NV(LV),pathExistsSync:PC.existsSync}});var _v=S((wae,DC)=>{"use strict";var gl=un(),kV=mr().fromPromise;async function MV(n,e,t){let r=await gl.open(n,"r+"),i=null;try{await gl.futimes(r,e,t)}finally{try{await gl.close(r)}catch(s){i=s}}if(i)throw i}o(MV,"utimesMillis");function jV(n,e,t){let r=gl.openSync(n,"r+");return gl.futimesSync(r,e,t),gl.closeSync(r)}o(jV,"utimesMillisSync");DC.exports={utimesMillis:kV(MV),utimesMillisSync:jV}});var $o=S((Tae,MC)=>{"use strict";var yl=un(),gr=require("path"),NC=mr().fromPromise;function $V(n,e,t){let r=t.dereference?i=>yl.stat(i,{bigint:!0}):i=>yl.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($V,"getStats");function BV(n,e,t){let r,i=t.dereference?a=>yl.statSync(a,{bigint:!0}):a=>yl.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(BV,"getStatsSync");async function VV(n,e,t,r){let{srcStat:i,destStat:s}=await $V(n,e,r);if(s){if(uf(i,s)){let a=gr.basename(n),c=gr.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()&&Sv(n,e))throw new Error(jm(n,e,t));return{srcStat:i,destStat:s}}o(VV,"checkPaths");function UV(n,e,t,r){let{srcStat:i,destStat:s}=BV(n,e,r);if(s){if(uf(i,s)){let a=gr.basename(n),c=gr.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()&&Sv(n,e))throw new Error(jm(n,e,t));return{srcStat:i,destStat:s}}o(UV,"checkPathsSync");async function LC(n,e,t,r){let i=gr.resolve(gr.dirname(n)),s=gr.resolve(gr.dirname(t));if(s===i||s===gr.parse(s).root)return;let a;try{a=await yl.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(uf(e,a))throw new Error(jm(n,t,r));return LC(n,e,s,r)}o(LC,"checkParentPaths");function kC(n,e,t,r){let i=gr.resolve(gr.dirname(n)),s=gr.resolve(gr.dirname(t));if(s===i||s===gr.parse(s).root)return;let a;try{a=yl.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(uf(e,a))throw new Error(jm(n,t,r));return kC(n,e,s,r)}o(kC,"checkParentPathsSync");function uf(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(uf,"areIdentical");function Sv(n,e){let t=gr.resolve(n).split(gr.sep).filter(i=>i),r=gr.resolve(e).split(gr.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(Sv,"isSrcSubdir");function jm(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(jm,"errMsg");MC.exports={checkPaths:NC(VV),checkPathsSync:UV,checkParentPaths:NC(LC),checkParentPathsSync:kC,isSrcSubdir:Sv,areIdentical:uf}});var $C=S((xae,jC)=>{"use strict";async function qV(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(qV,"asyncIteratorConcurrentProcess");jC.exports={asyncIteratorConcurrentProcess:qV}});var WC=S((Iae,qC)=>{"use strict";var zr=un(),ff=require("path"),{mkdirs:WV}=Di(),{pathExists:GV}=Na(),{utimesMillis:zV}=_v(),df=$o(),{asyncIteratorConcurrentProcess:HV}=$C();async function QV(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;
|
|
457
457
|
|
|
458
458
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await df.checkPaths(n,e,"copy",t);if(await df.checkParentPaths(n,r,e,"copy"),!await VC(n,e,t))return;let a=ff.dirname(e);await GV(a)||await WV(a),await UC(i,n,e,t)}o(QV,"copy");async function VC(n,e,t){return t.filter?t.filter(n,e):!0}o(VC,"runFilter");async function UC(n,e,t,r){let s=await(r.dereference?zr.stat:zr.lstat)(e);if(s.isDirectory())return JV(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return YV(s,n,e,t,r);if(s.isSymbolicLink())return ZV(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(UC,"getStatsAndPerformCopy");async function YV(n,e,t,r,i){if(!e)return BC(n,t,r,i);if(i.overwrite)return await zr.unlink(r),BC(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}o(YV,"onFile");async function BC(n,e,t,r){if(await zr.copyFile(e,t),r.preserveTimestamps){KV(n.mode)&&await XV(t,n.mode);let i=await zr.stat(e);await zV(t,i.atime,i.mtime)}return zr.chmod(t,n.mode)}o(BC,"copyFile");function KV(n){return(n&128)===0}o(KV,"fileIsNotWritable");function XV(n,e){return zr.chmod(n,e|128)}o(XV,"makeFileWritable");async function JV(n,e,t,r,i){e||await zr.mkdir(r),await HV(await zr.opendir(t),async s=>{let a=ff.join(t,s.name),c=ff.join(r,s.name);if(await VC(a,c,i)){let{destStat:u}=await df.checkPaths(a,c,"copy",i);await UC(u,a,c,i)}}),e||await zr.chmod(r,n.mode)}o(JV,"onDir");async function ZV(n,e,t,r){let i=await zr.readlink(e);if(r.dereference&&(i=ff.resolve(process.cwd(),i)),!n)return zr.symlink(i,t);let s=null;try{s=await zr.readlink(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return zr.symlink(i,t);throw a}if(r.dereference&&(s=ff.resolve(process.cwd(),s)),df.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(df.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await zr.unlink(t),zr.symlink(i,t)}o(ZV,"onLink");qC.exports=QV});var YC=S((Oae,QC)=>{"use strict";var fn=ml(),hf=require("path"),eU=Di().mkdirsSync,tU=_v().utimesMillisSync,pf=$o();function rU(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;
|
|
459
459
|
|
|
460
460
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=pf.checkPathsSync(n,e,"copy",t);if(pf.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=hf.dirname(e);return fn.existsSync(s)||eU(s),GC(i,n,e,t)}o(rU,"copySync");function GC(n,e,t,r){let s=(r.dereference?fn.statSync:fn.lstatSync)(e);if(s.isDirectory())return lU(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return nU(s,n,e,t,r);if(s.isSymbolicLink())return dU(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(GC,"getStats");function nU(n,e,t,r,i){return e?iU(n,t,r,i):zC(n,t,r,i)}o(nU,"onFile");function iU(n,e,t,r){if(r.overwrite)return fn.unlinkSync(t),zC(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}o(iU,"mayCopyFile");function zC(n,e,t,r){return fn.copyFileSync(e,t),r.preserveTimestamps&&sU(n.mode,e,t),bv(t,n.mode)}o(zC,"copyFile");function sU(n,e,t){return aU(n)&&oU(t,n),cU(e,t)}o(sU,"handleTimestamps");function aU(n){return(n&128)===0}o(aU,"fileIsNotWritable");function oU(n,e){return bv(n,e|128)}o(oU,"makeFileWritable");function bv(n,e){return fn.chmodSync(n,e)}o(bv,"setDestMode");function cU(n,e){let t=fn.statSync(n);return tU(e,t.atime,t.mtime)}o(cU,"setDestTimestamps");function lU(n,e,t,r,i){return e?HC(t,r,i):uU(n.mode,t,r,i)}o(lU,"onDir");function uU(n,e,t,r){return fn.mkdirSync(t),HC(e,t,r),bv(t,n)}o(uU,"mkDirAndCopy");function HC(n,e,t){let r=fn.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)fU(i.name,n,e,t)}finally{r.closeSync()}}o(HC,"copyDir");function fU(n,e,t,r){let i=hf.join(e,n),s=hf.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:a}=pf.checkPathsSync(i,s,"copy",r);return GC(a,i,s,r)}o(fU,"copyDirItem");function dU(n,e,t,r){let i=fn.readlinkSync(e);if(r.dereference&&(i=hf.resolve(process.cwd(),i)),n){let s;try{s=fn.readlinkSync(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return fn.symlinkSync(i,t);throw a}if(r.dereference&&(s=hf.resolve(process.cwd(),s)),pf.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(pf.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return hU(i,t)}else return fn.symlinkSync(i,t)}o(dU,"onLink");function hU(n,e){return fn.unlinkSync(e),fn.symlinkSync(n,e)}o(hU,"copyLink");QC.exports=rU});var $m=S((Fae,KC)=>{"use strict";var pU=mr().fromPromise;KC.exports={copy:pU(WC()),copySync:YC()}});var mf=S((Dae,JC)=>{"use strict";var XC=ml(),mU=mr().fromCallback;function gU(n,e){XC.rm(n,{recursive:!0,force:!0},e)}o(gU,"remove");function yU(n){XC.rmSync(n,{recursive:!0,force:!0})}o(yU,"removeSync");JC.exports={remove:mU(gU),removeSync:yU}});var aI=S((Lae,sI)=>{"use strict";var _U=mr().fromPromise,tI=un(),rI=require("path"),nI=Di(),iI=mf(),ZC=_U(o(async function(e){let t;try{t=await tI.readdir(e)}catch{return nI.mkdirs(e)}return Promise.all(t.map(r=>iI.remove(rI.join(e,r))))},"emptyDir"));function eI(n){let e;try{e=tI.readdirSync(n)}catch{return nI.mkdirsSync(n)}e.forEach(t=>{t=rI.join(n,t),iI.removeSync(t)})}o(eI,"emptyDirSync");sI.exports={emptyDirSync:eI,emptydirSync:eI,emptyDir:ZC,emptydir:ZC}});var uI=S((Mae,lI)=>{"use strict";var SU=mr().fromPromise,oI=require("path"),ea=un(),cI=Di();async function bU(n){let e;try{e=await ea.stat(n)}catch{}if(e&&e.isFile())return;let t=oI.dirname(n),r=null;try{r=await ea.stat(t)}catch(i){if(i.code==="ENOENT"){await cI.mkdirs(t),await ea.writeFile(n,"");return}else throw i}r.isDirectory()?await ea.writeFile(n,""):await ea.readdir(t)}o(bU,"createFile");function vU(n){let e;try{e=ea.statSync(n)}catch{}if(e&&e.isFile())return;let t=oI.dirname(n);try{ea.statSync(t).isDirectory()||ea.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")cI.mkdirsSync(t);else throw r}ea.writeFileSync(n,"")}o(vU,"createFileSync");lI.exports={createFile:SU(bU),createFileSync:vU}});var mI=S(($ae,pI)=>{"use strict";var wU=mr().fromPromise,fI=require("path"),La=un(),dI=Di(),{pathExists:EU}=Na(),{areIdentical:hI}=$o();async function TU(n,e){let t;try{t=await La.lstat(e)}catch{}let r;try{r=await La.lstat(n)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(t&&hI(r,t))return;let i=fI.dirname(e);await EU(i)||await dI.mkdirs(i),await La.link(n,e)}o(TU,"createLink");function AU(n,e){let t;try{t=La.lstatSync(e)}catch{}try{let s=La.lstatSync(n);if(t&&hI(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=fI.dirname(e);return La.existsSync(r)||dI.mkdirsSync(r),La.linkSync(n,e)}o(AU,"createLinkSync");pI.exports={createLink:wU(TU),createLinkSync:AU}});var yI=S((Vae,gI)=>{"use strict";var ka=require("path"),gf=un(),{pathExists:xU}=Na(),CU=mr().fromPromise;async function IU(n,e){if(ka.isAbsolute(n)){try{await gf.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=ka.dirname(e),r=ka.join(t,n);if(await xU(r))return{toCwd:r,toDst:n};try{await gf.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:ka.relative(t,n)}}o(IU,"symlinkPaths");function RU(n,e){if(ka.isAbsolute(n)){if(!gf.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=ka.dirname(e),r=ka.join(t,n);if(gf.existsSync(r))return{toCwd:r,toDst:n};if(!gf.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:ka.relative(t,n)}}o(RU,"symlinkPathsSync");gI.exports={symlinkPaths:CU(IU),symlinkPathsSync:RU}});var bI=S((qae,SI)=>{"use strict";var _I=un(),OU=mr().fromPromise;async function PU(n,e){if(e)return e;let t;try{t=await _I.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(PU,"symlinkType");function FU(n,e){if(e)return e;let t;try{t=_I.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(FU,"symlinkTypeSync");SI.exports={symlinkType:OU(PU),symlinkTypeSync:FU}});var TI=S((Gae,EI)=>{"use strict";var DU=mr().fromPromise,vI=require("path"),fs=un(),{mkdirs:NU,mkdirsSync:LU}=Di(),{symlinkPaths:kU,symlinkPathsSync:MU}=yI(),{symlinkType:jU,symlinkTypeSync:$U}=bI(),{pathExists:BU}=Na(),{areIdentical:wI}=$o();async function VU(n,e,t){let r;try{r=await fs.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([fs.stat(n),fs.stat(e)]);if(wI(c,l))return}let i=await kU(n,e);n=i.toDst;let s=await jU(i.toCwd,t),a=vI.dirname(e);return await BU(a)||await NU(a),fs.symlink(n,e,s)}o(VU,"createSymlink");function UU(n,e,t){let r;try{r=fs.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=fs.statSync(n),l=fs.statSync(e);if(wI(c,l))return}let i=MU(n,e);n=i.toDst,t=$U(i.toCwd,t);let s=vI.dirname(e);return fs.existsSync(s)||LU(s),fs.symlinkSync(n,e,t)}o(UU,"createSymlinkSync");EI.exports={createSymlink:DU(VU),createSymlinkSync:UU}});var FI=S((Hae,PI)=>{"use strict";var{createFile:AI,createFileSync:xI}=uI(),{createLink:CI,createLinkSync:II}=mI(),{createSymlink:RI,createSymlinkSync:OI}=TI();PI.exports={createFile:AI,createFileSync:xI,ensureFile:AI,ensureFileSync:xI,createLink:CI,createLinkSync:II,ensureLink:CI,ensureLinkSync:II,createSymlink:RI,createSymlinkSync:OI,ensureSymlink:RI,ensureSymlinkSync:OI}});var Bm=S((Qae,DI)=>{function qU(n,{EOL:e=`
|
|
461
|
-
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(qU,"stringify");function WU(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(WU,"stripBom");DI.exports={stringify:qU,stripBom:WU}});var MI=S((Kae,kI)=>{var _l;try{_l=ml()}catch{_l=require("fs")}var Vm=mr(),{stringify:NI,stripBom:LI}=Bm();async function GU(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||_l,r="throws"in e?e.throws:!0,i=await Vm.fromCallback(t.readFile)(n,e);i=LI(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(GU,"_readFile");var zU=Vm.fromPromise(GU);function HU(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||_l,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=LI(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(HU,"readFileSync");async function QU(n,e,t={}){let r=t.fs||_l,i=NI(e,t);await Vm.fromCallback(r.writeFile)(n,i,t)}o(QU,"_writeFile");var YU=Vm.fromPromise(QU);function KU(n,e,t={}){let r=t.fs||_l,i=NI(e,t);return r.writeFileSync(n,i,t)}o(KU,"writeFileSync");kI.exports={readFile:zU,readFileSync:HU,writeFile:YU,writeFileSync:KU}});var $I=S((Jae,jI)=>{"use strict";var Um=MI();jI.exports={readJson:Um.readFile,readJsonSync:Um.readFileSync,writeJson:Um.writeFile,writeJsonSync:Um.writeFileSync}});var qm=S((Zae,UI)=>{"use strict";var XU=mr().fromPromise,vv=un(),BI=require("path"),VI=Di(),JU=Na().pathExists;async function ZU(n,e,t="utf-8"){let r=BI.dirname(n);return await JU(r)||await VI.mkdirs(r),vv.writeFile(n,e,t)}o(ZU,"outputFile");function eq(n,...e){let t=BI.dirname(n);vv.existsSync(t)||VI.mkdirsSync(t),vv.writeFileSync(n,...e)}o(eq,"outputFileSync");UI.exports={outputFile:XU(ZU),outputFileSync:eq}});var WI=S((toe,qI)=>{"use strict";var{stringify:tq}=Bm(),{outputFile:rq}=qm();async function nq(n,e,t={}){let r=tq(e,t);await rq(n,r,t)}o(nq,"outputJson");qI.exports=nq});var zI=S((noe,GI)=>{"use strict";var{stringify:iq}=Bm(),{outputFileSync:sq}=qm();function aq(n,e,t){let r=iq(e,t);sq(n,r,t)}o(aq,"outputJsonSync");GI.exports=aq});var QI=S((soe,HI)=>{"use strict";var oq=mr().fromPromise,dn=$I();dn.outputJson=oq(WI());dn.outputJsonSync=zI();dn.outputJSON=dn.outputJson;dn.outputJSONSync=dn.outputJsonSync;dn.writeJSON=dn.writeJson;dn.writeJSONSync=dn.writeJsonSync;dn.readJSON=dn.readJson;dn.readJSONSync=dn.readJsonSync;HI.exports=dn});var ZI=S((aoe,JI)=>{"use strict";var cq=un(),YI=require("path"),{copy:lq}=$m(),{remove:XI}=mf(),{mkdirp:uq}=Di(),{pathExists:fq}=Na(),KI=$o();async function dq(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await KI.checkPaths(n,e,"move",t);await KI.checkParentPaths(n,i,e,"move");let a=YI.dirname(e);return YI.parse(a).root!==a&&await uq(a),hq(n,e,r,s)}o(dq,"move");async function hq(n,e,t,r){if(!r){if(t)await XI(e);else if(await fq(e))throw new Error("dest already exists.")}try{await cq.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await pq(n,e,t)}}o(hq,"doRename");async function pq(n,e,t){return await lq(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),XI(n)}o(pq,"moveAcrossDevice");JI.exports=dq});var iR=S((coe,nR)=>{"use strict";var tR=ml(),Ev=require("path"),mq=$m().copySync,rR=mf().removeSync,gq=Di().mkdirpSync,eR=$o();function yq(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"),_q(e)||gq(Ev.dirname(e)),Sq(n,e,r,s)}o(yq,"moveSync");function _q(n){let e=Ev.dirname(n);return Ev.parse(e).root===e}o(_q,"isParentRoot");function Sq(n,e,t,r){if(r)return wv(n,e,t);if(t)return rR(e),wv(n,e,t);if(tR.existsSync(e))throw new Error("dest already exists.");return wv(n,e,t)}o(Sq,"doRename");function wv(n,e,t){try{tR.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return bq(n,e,t)}}o(wv,"rename");function bq(n,e,t){return mq(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),rR(n)}o(bq,"moveAcrossDevice");nR.exports=yq});var aR=S((uoe,sR)=>{"use strict";var vq=mr().fromPromise;sR.exports={move:vq(ZI()),moveSync:iR()}});var Ma=S((foe,oR)=>{"use strict";oR.exports={...un(),...$m(),...aI(),...FI(),...QI(),...Di(),...aR(),...qm(),...Na(),...mf()}});var ZO=S((qfe,JO)=>{"use strict";JO.exports=KO;function KO(n,e,t){n instanceof RegExp&&(n=YO(n,t)),e instanceof RegExp&&(e=YO(e,t));var r=XO(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(KO,"balanced");function YO(n,e){var t=e.match(n);return t?t[0]:null}o(YO,"maybeMatch");KO.range=XO;function XO(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(XO,"range")});var oP=S((Gfe,aP)=>{var eP=ZO();aP.exports=rH;var tP="\0SLASH"+Math.random()+"\0",rP="\0OPEN"+Math.random()+"\0",mw="\0CLOSE"+Math.random()+"\0",nP="\0COMMA"+Math.random()+"\0",iP="\0PERIOD"+Math.random()+"\0";function pw(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(pw,"numeric");function eH(n){return n.split("\\\\").join(tP).split("\\{").join(rP).split("\\}").join(mw).split("\\,").join(nP).split("\\.").join(iP)}o(eH,"escapeBraces");function tH(n){return n.split(tP).join("\\").split(rP).join("{").split(mw).join("}").split(nP).join(",").split(iP).join(".")}o(tH,"unescapeBraces");function sP(n){if(!n)return[""];var e=[],t=eP("{","}",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=sP(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(sP,"parseCommaParts");function rH(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Mf(eH(n),!0).map(tH)):[]}o(rH,"expandTop");function nH(n){return"{"+n+"}"}o(nH,"embrace");function iH(n){return/^-?0\d/.test(n)}o(iH,"isPadded");function sH(n,e){return n<=e}o(sH,"lte");function aH(n,e){return n>=e}o(aH,"gte");function Mf(n,e){var t=[],r=eP("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?Mf(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+mw+r.post,Mf(n)):[n];var h;if(f)h=r.body.split(/\.\./);else if(h=sP(r.body),h.length===1&&(h=Mf(h[0],!1).map(nH),h.length===1))return s.map(function(j){return r.pre+h[0]+j});var p;if(f){var _=pw(h[0]),b=pw(h[1]),E=Math.max(h[0].length,h[1].length),v=h.length==3?Math.max(Math.abs(pw(h[2])),1):1,A=sH,R=b<_;R&&(v*=-1,A=aH);var B=h.some(iH);p=[];for(var W=_;A(W,b);W+=v){var ve;if(u)ve=String.fromCharCode(W),ve==="\\"&&(ve="");else if(ve=String(W),B){var z=E-ve.length;if(z>0){var G=new Array(z+1).join("0");W<0?ve="-"+G+ve.slice(1):ve=G+ve}}p.push(ve)}}else{p=[];for(var F=0;F<h.length;F++)p.push.apply(p,Mf(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(Mf,"expand")});var wY={};Sy(wY,{createProgram:()=>sD});module.exports=Pd(wY);var Qye=K(Fd());var aE=K(sE(),1),{program:qY,createCommand:WY,createArgument:GY,createOption:zY,CommanderError:HY,InvalidArgumentError:QY,InvalidOptionArgumentError:YY,Command:Ie,Argument:KY,Option:XY,Help:JY}=aE.default;var Fl=require("fs"),kf=require("path"),Bt=K(
|
|
461
|
+
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(qU,"stringify");function WU(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(WU,"stripBom");DI.exports={stringify:qU,stripBom:WU}});var MI=S((Kae,kI)=>{var _l;try{_l=ml()}catch{_l=require("fs")}var Vm=mr(),{stringify:NI,stripBom:LI}=Bm();async function GU(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||_l,r="throws"in e?e.throws:!0,i=await Vm.fromCallback(t.readFile)(n,e);i=LI(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(GU,"_readFile");var zU=Vm.fromPromise(GU);function HU(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||_l,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=LI(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(HU,"readFileSync");async function QU(n,e,t={}){let r=t.fs||_l,i=NI(e,t);await Vm.fromCallback(r.writeFile)(n,i,t)}o(QU,"_writeFile");var YU=Vm.fromPromise(QU);function KU(n,e,t={}){let r=t.fs||_l,i=NI(e,t);return r.writeFileSync(n,i,t)}o(KU,"writeFileSync");kI.exports={readFile:zU,readFileSync:HU,writeFile:YU,writeFileSync:KU}});var $I=S((Jae,jI)=>{"use strict";var Um=MI();jI.exports={readJson:Um.readFile,readJsonSync:Um.readFileSync,writeJson:Um.writeFile,writeJsonSync:Um.writeFileSync}});var qm=S((Zae,UI)=>{"use strict";var XU=mr().fromPromise,vv=un(),BI=require("path"),VI=Di(),JU=Na().pathExists;async function ZU(n,e,t="utf-8"){let r=BI.dirname(n);return await JU(r)||await VI.mkdirs(r),vv.writeFile(n,e,t)}o(ZU,"outputFile");function eq(n,...e){let t=BI.dirname(n);vv.existsSync(t)||VI.mkdirsSync(t),vv.writeFileSync(n,...e)}o(eq,"outputFileSync");UI.exports={outputFile:XU(ZU),outputFileSync:eq}});var WI=S((toe,qI)=>{"use strict";var{stringify:tq}=Bm(),{outputFile:rq}=qm();async function nq(n,e,t={}){let r=tq(e,t);await rq(n,r,t)}o(nq,"outputJson");qI.exports=nq});var zI=S((noe,GI)=>{"use strict";var{stringify:iq}=Bm(),{outputFileSync:sq}=qm();function aq(n,e,t){let r=iq(e,t);sq(n,r,t)}o(aq,"outputJsonSync");GI.exports=aq});var QI=S((soe,HI)=>{"use strict";var oq=mr().fromPromise,dn=$I();dn.outputJson=oq(WI());dn.outputJsonSync=zI();dn.outputJSON=dn.outputJson;dn.outputJSONSync=dn.outputJsonSync;dn.writeJSON=dn.writeJson;dn.writeJSONSync=dn.writeJsonSync;dn.readJSON=dn.readJson;dn.readJSONSync=dn.readJsonSync;HI.exports=dn});var ZI=S((aoe,JI)=>{"use strict";var cq=un(),YI=require("path"),{copy:lq}=$m(),{remove:XI}=mf(),{mkdirp:uq}=Di(),{pathExists:fq}=Na(),KI=$o();async function dq(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await KI.checkPaths(n,e,"move",t);await KI.checkParentPaths(n,i,e,"move");let a=YI.dirname(e);return YI.parse(a).root!==a&&await uq(a),hq(n,e,r,s)}o(dq,"move");async function hq(n,e,t,r){if(!r){if(t)await XI(e);else if(await fq(e))throw new Error("dest already exists.")}try{await cq.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await pq(n,e,t)}}o(hq,"doRename");async function pq(n,e,t){return await lq(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),XI(n)}o(pq,"moveAcrossDevice");JI.exports=dq});var iR=S((coe,nR)=>{"use strict";var tR=ml(),Ev=require("path"),mq=$m().copySync,rR=mf().removeSync,gq=Di().mkdirpSync,eR=$o();function yq(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"),_q(e)||gq(Ev.dirname(e)),Sq(n,e,r,s)}o(yq,"moveSync");function _q(n){let e=Ev.dirname(n);return Ev.parse(e).root===e}o(_q,"isParentRoot");function Sq(n,e,t,r){if(r)return wv(n,e,t);if(t)return rR(e),wv(n,e,t);if(tR.existsSync(e))throw new Error("dest already exists.");return wv(n,e,t)}o(Sq,"doRename");function wv(n,e,t){try{tR.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return bq(n,e,t)}}o(wv,"rename");function bq(n,e,t){return mq(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),rR(n)}o(bq,"moveAcrossDevice");nR.exports=yq});var aR=S((uoe,sR)=>{"use strict";var vq=mr().fromPromise;sR.exports={move:vq(ZI()),moveSync:iR()}});var Ma=S((foe,oR)=>{"use strict";oR.exports={...un(),...$m(),...aI(),...FI(),...QI(),...Di(),...aR(),...qm(),...Na(),...mf()}});var ZO=S((qfe,JO)=>{"use strict";JO.exports=KO;function KO(n,e,t){n instanceof RegExp&&(n=YO(n,t)),e instanceof RegExp&&(e=YO(e,t));var r=XO(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(KO,"balanced");function YO(n,e){var t=e.match(n);return t?t[0]:null}o(YO,"maybeMatch");KO.range=XO;function XO(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(XO,"range")});var oP=S((Gfe,aP)=>{var eP=ZO();aP.exports=rH;var tP="\0SLASH"+Math.random()+"\0",rP="\0OPEN"+Math.random()+"\0",mw="\0CLOSE"+Math.random()+"\0",nP="\0COMMA"+Math.random()+"\0",iP="\0PERIOD"+Math.random()+"\0";function pw(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(pw,"numeric");function eH(n){return n.split("\\\\").join(tP).split("\\{").join(rP).split("\\}").join(mw).split("\\,").join(nP).split("\\.").join(iP)}o(eH,"escapeBraces");function tH(n){return n.split(tP).join("\\").split(rP).join("{").split(mw).join("}").split(nP).join(",").split(iP).join(".")}o(tH,"unescapeBraces");function sP(n){if(!n)return[""];var e=[],t=eP("{","}",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=sP(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(sP,"parseCommaParts");function rH(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Mf(eH(n),!0).map(tH)):[]}o(rH,"expandTop");function nH(n){return"{"+n+"}"}o(nH,"embrace");function iH(n){return/^-?0\d/.test(n)}o(iH,"isPadded");function sH(n,e){return n<=e}o(sH,"lte");function aH(n,e){return n>=e}o(aH,"gte");function Mf(n,e){var t=[],r=eP("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?Mf(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+mw+r.post,Mf(n)):[n];var h;if(f)h=r.body.split(/\.\./);else if(h=sP(r.body),h.length===1&&(h=Mf(h[0],!1).map(nH),h.length===1))return s.map(function(j){return r.pre+h[0]+j});var p;if(f){var _=pw(h[0]),b=pw(h[1]),E=Math.max(h[0].length,h[1].length),v=h.length==3?Math.max(Math.abs(pw(h[2])),1):1,A=sH,R=b<_;R&&(v*=-1,A=aH);var B=h.some(iH);p=[];for(var W=_;A(W,b);W+=v){var ve;if(u)ve=String.fromCharCode(W),ve==="\\"&&(ve="");else if(ve=String(W),B){var z=E-ve.length;if(z>0){var G=new Array(z+1).join("0");W<0?ve="-"+G+ve.slice(1):ve=G+ve}}p.push(ve)}}else{p=[];for(var F=0;F<h.length;F++)p.push.apply(p,Mf(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(Mf,"expand")});var wY={};Sy(wY,{createProgram:()=>sD});module.exports=Pd(wY);var Qye=K(Fd());var aE=K(sE(),1),{program:qY,createCommand:WY,createArgument:GY,createOption:zY,CommanderError:HY,InvalidArgumentError:QY,InvalidOptionArgumentError:YY,Command:Ie,Argument:KY,Option:XY,Help:JY}=aE.default;var Fl=require("fs"),kf=require("path"),Bt=K(Gt());var cr=K(Ma()),yr=K(require("path"));function ER(n){return typeof n>"u"||n===null}o(ER,"isNothing");function wq(n){return typeof n=="object"&&n!==null}o(wq,"isObject");function Eq(n){return Array.isArray(n)?n:ER(n)?[]:[n]}o(Eq,"toArray");function Tq(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(Tq,"extend");function Aq(n,e){var t="",r;for(r=0;r<e;r+=1)t+=n;return t}o(Aq,"repeat");function xq(n){return n===0&&Number.NEGATIVE_INFINITY===1/n}o(xq,"isNegativeZero");var Cq=ER,Iq=wq,Rq=Eq,Oq=Aq,Pq=xq,Fq=Tq,or={isNothing:Cq,isObject:Iq,toArray:Rq,repeat:Oq,isNegativeZero:Pq,extend:Fq};function TR(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+=`
|
|
462
462
|
|
|
463
463
|
`+n.mark.snippet),r+" "+t):r}o(TR,"formatError");function _f(n,e){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=e,this.message=TR(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}o(_f,"YAMLException$1");_f.prototype=Object.create(Error.prototype);_f.prototype.constructor=_f;_f.prototype.toString=o(function(e){return this.name+": "+TR(this,e)},"toString");var hn=_f;function Tv(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(Tv,"getLine");function Av(n,e){return or.repeat(" ",e-n.length)+n}o(Av,"padStart");function Dq(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=Tv(n.buffer,r[a-l],i[a-l],n.position-(r[a]-r[a-l]),d),c=or.repeat(" ",e.indent)+Av((n.line-l+1).toString(),f)+" | "+u.str+`
|
|
464
464
|
`+c;for(u=Tv(n.buffer,r[a],i[a],n.position,d),c+=or.repeat(" ",e.indent)+Av((n.line+1).toString(),f)+" | "+u.str+`
|
|
@@ -489,7 +489,7 @@ GFS4: `),console.error(n)},"debug"));kt[Fr]||(bC=global[Fr]||[],wC(kt,bC),kt.clo
|
|
|
489
489
|
`+n.slice(i,s),i=s+1),a=c;return l+=`
|
|
490
490
|
`,n.length-i>e&&a>i?l+=n.slice(i,a)+`
|
|
491
491
|
`+n.slice(a+1):l+=n.slice(i),l.slice(1)}o(bR,"foldLine");function SG(n){for(var e="",t=0,r,i=0;i<n.length;t>=65536?i+=2:i++)t=yf(n,i),r=Hr[t],!r&&vf(t)?(e+=n[i],t>=65536&&(e+=n[i+1])):e+=r||uG(t);return e}o(SG,"escapeString");function bG(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)),(ta(n,e,c,!1,!1)||typeof c>"u"&&ta(n,e,null,!1,!1))&&(r!==""&&(r+=","+(n.condenseFlow?"":" ")),r+=n.dump);n.tag=i,n.dump="["+r+"]"}o(bG,"writeFlowSequence");function vR(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)),(ta(n,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&ta(n,e+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=Rv(n,e)),n.dump&&Sf===n.dump.charCodeAt(0)?i+="-":i+="- ",i+=n.dump);n.tag=s,n.dump=i||"[]"}o(vR,"writeBlockSequence");function vG(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)),ta(n,e,l,!1,!1)&&(n.dump.length>1024&&(f+="? "),f+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),ta(n,e,u,!1,!1)&&(f+=n.dump,r+=f));n.tag=i,n.dump="{"+r+"}"}o(vG,"writeFlowMapping");function wG(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 hn("sortKeys must be a boolean or a function");for(c=0,l=a.length;c<l;c+=1)h="",(!r||i!=="")&&(h+=Rv(n,e)),u=a[c],f=t[u],n.replacer&&(f=n.replacer.call(t,u,f)),ta(n,e+1,u,!0,!0,!0)&&(d=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024,d&&(n.dump&&Sf===n.dump.charCodeAt(0)?h+="?":h+="? "),h+=n.dump,d&&(h+=Rv(n,e)),ta(n,e+1,f,!0,d)&&(n.dump&&Sf===n.dump.charCodeAt(0)?h+=":":h+=": ",h+=n.dump,i+=h));n.tag=s,n.dump=i||"{}"}o(wG,"writeBlockMapping");function wR(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 hn("!<"+c.tag+'> tag resolver accepts not "'+l+'" style');n.dump=r}return!0}return!1}o(wR,"detectType");function ta(n,e,t,r,i,s,a){n.tag=null,n.dump=t,wR(n,t,!1)||wR(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?(wG(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(vG(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?vR(n,e-1,n.dump,i):vR(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(bG(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object String]")n.tag!=="?"&&yG(n,n.dump,e,s,l);else{if(c==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new hn("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(ta,"writeNode");function EG(n,e){var t=[],r=[],i,s;for(Pv(n,t,r),i=0,s=r.length;i<s;i+=1)e.duplicates.push(t[r[i]]);e.usedDuplicates=new Array(s)}o(EG,"getDuplicateReferences");function Pv(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)Pv(n[i],e,t);else for(r=Object.keys(n),i=0,s=r.length;i<s;i+=1)Pv(n[r[i]],e,t)}o(Pv,"inspectNode");function TG(n,e){e=e||{};var t=new dG(e);t.noRefs||EG(n,t);var r=n;return t.replacer&&(r=t.replacer.call({"":r},"",r)),ta(t,0,r,!0,!0)?t.dump+`
|
|
492
|
-
`:""}o(TG,"dump$1");var AG=TG,xG={dump:AG};function Mv(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(Mv,"renamed");var CG=Dr,IG=AR,RG=RR,OG=NR,PG=LR,FG=Dv,DG=ZR.load,NG=ZR.loadAll,LG=xG.dump,kG=hn,MG={binary:BR,float:DR,map:IR,null:OR,pairs:UR,set:qR,timestamp:jR,bool:PR,int:FR,merge:$R,omap:VR,seq:CR,str:xR},jG=Mv("safeLoad","load"),$G=Mv("safeLoadAll","loadAll"),BG=Mv("safeDump","dump"),Nr={Type:CG,Schema:IG,FAILSAFE_SCHEMA:RG,JSON_SCHEMA:OG,CORE_SCHEMA:PG,DEFAULT_SCHEMA:FG,load:DG,loadAll:NG,dump:LG,YAMLException:kG,types:MG,safeLoad:jG,safeLoadAll:$G,safeDump:BG};var VG=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
492
|
+
`:""}o(TG,"dump$1");var AG=TG,xG={dump:AG};function Mv(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(Mv,"renamed");var CG=Dr,IG=AR,RG=RR,OG=NR,PG=LR,FG=Dv,DG=ZR.load,NG=ZR.loadAll,LG=xG.dump,kG=hn,MG={binary:BR,float:DR,map:IR,null:OR,pairs:UR,set:qR,timestamp:jR,bool:PR,int:FR,merge:$R,omap:VR,seq:CR,str:xR},jG=Mv("safeLoad","load"),$G=Mv("safeLoadAll","loadAll"),BG=Mv("safeDump","dump"),Nr={Type:CG,Schema:IG,FAILSAFE_SCHEMA:RG,JSON_SCHEMA:OG,CORE_SCHEMA:PG,DEFAULT_SCHEMA:FG,load:DG,loadAll:NG,dump:LG,YAMLException:kG,types:MG,safeLoad:jG,safeLoadAll:$G,safeDump:BG};var VG=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,zt=class{constructor(e){this.rootPath=e;this.uuidIndex=null}static{o(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await cr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return cr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await cr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await cr.default.ensureDir(yr.default.dirname(r)),await cr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await cr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await cr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await cr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await cr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return cr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=cr.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=yr.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=cr.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 cr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await cr.default.ensureDir(yr.default.dirname(i)),await cr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await cr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(VG.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let a=r.toLowerCase(),c=this.uuidIndex.get(a);return c?this.createFileObject(c):null}let i=yr.default.dirname(this.resolvePath(t)),s;if(yr.default.isAbsolute(r)?s=this.resolvePath(r):s=yr.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),cr.default.existsSync(s)){let a=yr.default.relative(this.rootPath,s);return this.createFileObject(a)}return null}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let r=yr.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=yr.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){return Promise.resolve()}resolvePath(e){return yr.default.isAbsolute(e)?e:yr.default.join(this.rootPath,e)}createFileObject(e){let t=yr.default.basename(e),r=yr.default.basename(e,yr.default.extname(e)),i=yr.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:yr.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=Nr.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=Nr.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
|
|
493
493
|
${r.trim()}
|
|
494
494
|
---`):`---
|
|
495
495
|
${r.trim()}
|
|
@@ -524,7 +524,7 @@ To fix this:
|
|
|
524
524
|
3. Simplify query: reduce WHERE clauses or add LIMIT
|
|
525
525
|
4. Use cache: --use-cache for faster vault loading${i!==void 0?`
|
|
526
526
|
|
|
527
|
-
Partial results: ${i} result(s) were collected before timeout.`:""}`}static{o(this,"QueryTimeoutError")}};var Af=K(require("path")),Qr=K(Ma()),Sr=K(Wt());var Kn=class{constructor(e){this.cliVersion="1.0.0";this.vaultPath=Af.default.resolve(e),this.cachePath=Af.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{o(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){try{if(!await Qr.default.pathExists(this.cachePath))return!1;let e=await Qr.default.readJson(this.cachePath);return!(!e.metadata||typeof e.metadata.vaultMtime!="number"||typeof e.metadata.tripleCount!="number"||(await Qr.default.stat(this.vaultPath)).mtimeMs!==e.metadata.vaultMtime)}catch{return!1}}async loadOrBuild(){let e=Date.now();if(await this.isCacheValid())return{triples:await this.loadFromCache(),cacheHit:!0,durationMs:Date.now()-e};let{tripleCount:t}=await this.buildCache();return{triples:await this.loadFromCache(),cacheHit:!1,durationMs:Date.now()-e}}async loadFromCache(){return(await Qr.default.readJson(this.cachePath)).triples.map(this.deserializeTriple)}async buildCache(){let e=await this.buildCacheWithValidation({strict:!1});return{tripleCount:e.tripleCount,durationMs:e.durationMs}}async buildCacheWithValidation(e={}){let t=Date.now(),r=new Gt(this.vaultPath),s=await new Sr.NoteToRDFConverter(r).convertVaultWithValidation({strict:e.strict??!1}),a=await Qr.default.stat(this.vaultPath),c=s.triples.map(this.serializeTriple),l={metadata:{version:this.cliVersion,timestamp:Date.now(),vaultPath:this.vaultPath,tripleCount:s.triples.length,vaultMtime:a.mtimeMs},triples:c};return await Qr.default.ensureDir(Af.default.dirname(this.cachePath)),await Qr.default.writeJson(this.cachePath,l,{spaces:0}),{tripleCount:s.triples.length,durationMs:Date.now()-t,skippedFiles:s.skippedFiles,summary:s.summary}}async validateVault(){let e=new Gt(this.vaultPath);return new Sr.NoteToRDFConverter(e).validateVault()}async invalidate(){await Qr.default.pathExists(this.cachePath)&&await Qr.default.remove(this.cachePath)}async getCacheStats(){try{if(!await Qr.default.pathExists(this.cachePath))return null;let e=await Qr.default.readJson(this.cachePath),t=await Qr.default.stat(this.cachePath),r=await this.isCacheValid();return{tripleCount:e.metadata.tripleCount,createdAt:new Date(e.metadata.timestamp),isValid:r,sizeBytes:t.size}}catch{return null}}async saveTriples(e){let t=await Qr.default.stat(this.vaultPath),r=e.map(this.serializeTriple),i={metadata:{version:this.cliVersion,timestamp:Date.now(),vaultPath:this.vaultPath,tripleCount:e.length,vaultMtime:t.mtimeMs},triples:r};await Qr.default.ensureDir(Af.default.dirname(this.cachePath)),await Qr.default.writeJson(this.cachePath,i,{spaces:0})}serializeTriple(e){return{subject:jv(e.subject),predicate:jv(e.predicate),object:jv(e.object)}}deserializeTriple(e){return new Sr.Triple($v(e.subject),$v(e.predicate),$v(e.object))}};function jv(n){if(n instanceof Sr.IRI)return{type:"IRI",value:n.value};if(n instanceof Sr.Literal){let e={type:"Literal",value:n.value};return n.datatype&&(e.datatype=n.datatype.value),n.language&&(e.language=n.language),e}return n instanceof Sr.BlankNode?{type:"BlankNode",value:n.value}:{type:"IRI",value:String(n)}}o(jv,"serializeNode");function $v(n){switch(n.type){case"IRI":return new Sr.IRI(n.value);case"Literal":return n.datatype?new Sr.Literal(n.value,new Sr.IRI(n.datatype)):n.language?new Sr.Literal(n.value,void 0,n.language):new Sr.Literal(n.value);case"BlankNode":return new Sr.BlankNode(n.value);default:return new Sr.IRI(n.value)}}o($v,"deserializeNode");var dO=K(require("crypto")),xf=K(require("path")),hO=K(require("os")),Nn=K(Ma());var xl=class{static{o(this,"QueryResultCache")}constructor(e={}){this.cacheDir=e.cacheDir??xf.default.join(hO.default.homedir(),".exocortex","cache","query-results")}getCacheDir(){return this.cacheDir}getCacheKey(e){let t=e.trim().replace(/\s+/g," ");return dO.default.createHash("sha256").update(t).digest("hex")}async get(e,t){let r=this.getCacheKey(e),i=this.getCachePath(r);try{if(!await Nn.default.pathExists(i))return null;let s=await Nn.default.readJson(i),a=Date.now()-s.timestamp,c=t*1e3;return a>c?(await Nn.default.remove(i),null):s.result}catch{return null}}async set(e,t,r){let i=this.getCacheKey(e),s=this.getCachePath(i);await Nn.default.ensureDir(this.cacheDir);let a={timestamp:Date.now(),result:t};await Nn.default.writeJson(s,a,{spaces:0})}async isCached(e,t){return await this.get(e,t)!==null}async invalidate(e){let t=this.getCacheKey(e),r=this.getCachePath(t);try{await Nn.default.remove(r)}catch{}}async clear(){try{if(await Nn.default.pathExists(this.cacheDir)){let e=await Nn.default.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>Nn.default.remove(xf.default.join(this.cacheDir,t))))}}catch{}}async getCacheStats(){try{if(!await Nn.default.pathExists(this.cacheDir))return{entryCount:0,totalSizeBytes:0};let t=(await Nn.default.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),r=0;for(let i of t){let s=await Nn.default.stat(xf.default.join(this.cacheDir,i));r+=s.size}return{entryCount:t.length,totalSizeBytes:r}}catch{return{entryCount:0,totalSizeBytes:0}}}getCachePath(e){return xf.default.join(this.cacheDir,`${e}.json`)}};var Df=K(require("node:process"),1);var pO=o((n=0)=>e=>`\x1B[${e+n}m`,"wrapAnsi16"),mO=o((n=0)=>e=>`\x1B[${38+n};5;${e}m`,"wrapAnsi256"),gO=o((n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,"wrapAnsi16m"),Pt={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Wce=Object.keys(Pt.modifier),UG=Object.keys(Pt.color),qG=Object.keys(Pt.bgColor),Gce=[...UG,...qG];function WG(){let n=new Map;for(let[e,t]of Object.entries(Pt)){for(let[r,i]of Object.entries(t))Pt[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=Pt[r],n.set(i[0],i[1]);Object.defineProperty(Pt,e,{value:t,enumerable:!1})}return Object.defineProperty(Pt,"codes",{value:n,enumerable:!1}),Pt.color.close="\x1B[39m",Pt.bgColor.close="\x1B[49m",Pt.color.ansi=pO(),Pt.color.ansi256=mO(),Pt.color.ansi16m=gO(),Pt.bgColor.ansi=pO(10),Pt.bgColor.ansi256=mO(10),Pt.bgColor.ansi16m=gO(10),Object.defineProperties(Pt,{rgbToAnsi256:{value(e,t,r){return e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;r.length===3&&(r=[...r].map(s=>s+s).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:o(e=>Pt.rgbToAnsi256(...Pt.hexToRgb(e)),"value"),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,r,i;if(e>=232)t=((e-232)*10+8)/255,r=t,i=t;else{e-=16;let c=e%36;t=Math.floor(e/36)/5,r=Math.floor(c/6)/5,i=c%6/5}let s=Math.max(t,r,i)*2;if(s===0)return 30;let a=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(t));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:o((e,t,r)=>Pt.ansi256ToAnsi(Pt.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:o(e=>Pt.ansi256ToAnsi(Pt.hexToAnsi256(e)),"value"),enumerable:!1}}),Pt}o(WG,"assembleStyles");var GG=WG(),Ni=GG;var Jm=K(require("node:process"),1),_O=K(require("node:os"),1),Bv=K(require("node:tty"),1);function Xn(n,e=globalThis.Deno?globalThis.Deno.args:Jm.default.argv){let t=n.startsWith("-")?"":n.length===1?"-":"--",r=e.indexOf(t+n),i=e.indexOf("--");return r!==-1&&(i===-1||r<i)}o(Xn,"hasFlag");var{env:Ft}=Jm.default,Xm;Xn("no-color")||Xn("no-colors")||Xn("color=false")||Xn("color=never")?Xm=0:(Xn("color")||Xn("colors")||Xn("color=true")||Xn("color=always"))&&(Xm=1);function zG(){if("FORCE_COLOR"in Ft)return Ft.FORCE_COLOR==="true"?1:Ft.FORCE_COLOR==="false"?0:Ft.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ft.FORCE_COLOR,10),3)}o(zG,"envForceColor");function HG(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}o(HG,"translateLevel");function QG(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=zG();r!==void 0&&(Xm=r);let i=t?Xm:r;if(i===0)return 0;if(t){if(Xn("color=16m")||Xn("color=full")||Xn("color=truecolor"))return 3;if(Xn("color=256"))return 2}if("TF_BUILD"in Ft&&"AGENT_NAME"in Ft)return 1;if(n&&!e&&i===void 0)return 0;let s=i||0;if(Ft.TERM==="dumb")return s;if(Jm.default.platform==="win32"){let a=_O.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Ft)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in Ft)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Ft)||Ft.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in Ft)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ft.TEAMCITY_VERSION)?1:0;if(Ft.COLORTERM==="truecolor"||Ft.TERM==="xterm-kitty"||Ft.TERM==="xterm-ghostty"||Ft.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Ft){let a=Number.parseInt((Ft.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ft.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ft.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ft.TERM)||"COLORTERM"in Ft?1:s}o(QG,"_supportsColor");function yO(n,e={}){let t=QG(n,{streamIsTTY:n&&n.isTTY,...e});return HG(t)}o(yO,"createSupportsColor");var YG={stdout:yO({isTTY:Bv.default.isatty(1)}),stderr:yO({isTTY:Bv.default.isatty(2)})},SO=YG;function bO(n,e,t){let r=n.indexOf(e);if(r===-1)return n;let i=e.length,s=0,a="";do a+=n.slice(s,r)+e+t,s=r+i,r=n.indexOf(e,s);while(r!==-1);return a+=n.slice(s),a}o(bO,"stringReplaceAll");function vO(n,e,t,r){let i=0,s="";do{let a=n[r-1]==="\r";s+=n.slice(i,a?r-1:r)+e+(a?`\r
|
|
527
|
+
Partial results: ${i} result(s) were collected before timeout.`:""}`}static{o(this,"QueryTimeoutError")}};var Af=K(require("path")),Qr=K(Ma()),Sr=K(Gt());var Kn=class{constructor(e){this.cliVersion="1.0.0";this.vaultPath=Af.default.resolve(e),this.cachePath=Af.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{o(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){try{if(!await Qr.default.pathExists(this.cachePath))return!1;let e=await Qr.default.readJson(this.cachePath);return!(!e.metadata||typeof e.metadata.vaultMtime!="number"||typeof e.metadata.tripleCount!="number"||(await Qr.default.stat(this.vaultPath)).mtimeMs!==e.metadata.vaultMtime)}catch{return!1}}async loadOrBuild(){let e=Date.now();if(await this.isCacheValid())return{triples:await this.loadFromCache(),cacheHit:!0,durationMs:Date.now()-e};let{tripleCount:t}=await this.buildCache();return{triples:await this.loadFromCache(),cacheHit:!1,durationMs:Date.now()-e}}async loadFromCache(){return(await Qr.default.readJson(this.cachePath)).triples.map(this.deserializeTriple)}async buildCache(){let e=await this.buildCacheWithValidation({strict:!1});return{tripleCount:e.tripleCount,durationMs:e.durationMs}}async buildCacheWithValidation(e={}){let t=Date.now(),r=new zt(this.vaultPath),s=await new Sr.NoteToRDFConverter(r).convertVaultWithValidation({strict:e.strict??!1}),a=await Qr.default.stat(this.vaultPath),c=s.triples.map(this.serializeTriple),l={metadata:{version:this.cliVersion,timestamp:Date.now(),vaultPath:this.vaultPath,tripleCount:s.triples.length,vaultMtime:a.mtimeMs},triples:c};return await Qr.default.ensureDir(Af.default.dirname(this.cachePath)),await Qr.default.writeJson(this.cachePath,l,{spaces:0}),{tripleCount:s.triples.length,durationMs:Date.now()-t,skippedFiles:s.skippedFiles,summary:s.summary}}async validateVault(){let e=new zt(this.vaultPath);return new Sr.NoteToRDFConverter(e).validateVault()}async invalidate(){await Qr.default.pathExists(this.cachePath)&&await Qr.default.remove(this.cachePath)}async getCacheStats(){try{if(!await Qr.default.pathExists(this.cachePath))return null;let e=await Qr.default.readJson(this.cachePath),t=await Qr.default.stat(this.cachePath),r=await this.isCacheValid();return{tripleCount:e.metadata.tripleCount,createdAt:new Date(e.metadata.timestamp),isValid:r,sizeBytes:t.size}}catch{return null}}async saveTriples(e){let t=await Qr.default.stat(this.vaultPath),r=e.map(this.serializeTriple),i={metadata:{version:this.cliVersion,timestamp:Date.now(),vaultPath:this.vaultPath,tripleCount:e.length,vaultMtime:t.mtimeMs},triples:r};await Qr.default.ensureDir(Af.default.dirname(this.cachePath)),await Qr.default.writeJson(this.cachePath,i,{spaces:0})}serializeTriple(e){return{subject:jv(e.subject),predicate:jv(e.predicate),object:jv(e.object)}}deserializeTriple(e){return new Sr.Triple($v(e.subject),$v(e.predicate),$v(e.object))}};function jv(n){if(n instanceof Sr.IRI)return{type:"IRI",value:n.value};if(n instanceof Sr.Literal){let e={type:"Literal",value:n.value};return n.datatype&&(e.datatype=n.datatype.value),n.language&&(e.language=n.language),e}return n instanceof Sr.BlankNode?{type:"BlankNode",value:n.value}:{type:"IRI",value:String(n)}}o(jv,"serializeNode");function $v(n){switch(n.type){case"IRI":return new Sr.IRI(n.value);case"Literal":return n.datatype?new Sr.Literal(n.value,new Sr.IRI(n.datatype)):n.language?new Sr.Literal(n.value,void 0,n.language):new Sr.Literal(n.value);case"BlankNode":return new Sr.BlankNode(n.value);default:return new Sr.IRI(n.value)}}o($v,"deserializeNode");var dO=K(require("crypto")),xf=K(require("path")),hO=K(require("os")),Nn=K(Ma());var xl=class{static{o(this,"QueryResultCache")}constructor(e={}){this.cacheDir=e.cacheDir??xf.default.join(hO.default.homedir(),".exocortex","cache","query-results")}getCacheDir(){return this.cacheDir}getCacheKey(e){let t=e.trim().replace(/\s+/g," ");return dO.default.createHash("sha256").update(t).digest("hex")}async get(e,t){let r=this.getCacheKey(e),i=this.getCachePath(r);try{if(!await Nn.default.pathExists(i))return null;let s=await Nn.default.readJson(i),a=Date.now()-s.timestamp,c=t*1e3;return a>c?(await Nn.default.remove(i),null):s.result}catch{return null}}async set(e,t,r){let i=this.getCacheKey(e),s=this.getCachePath(i);await Nn.default.ensureDir(this.cacheDir);let a={timestamp:Date.now(),result:t};await Nn.default.writeJson(s,a,{spaces:0})}async isCached(e,t){return await this.get(e,t)!==null}async invalidate(e){let t=this.getCacheKey(e),r=this.getCachePath(t);try{await Nn.default.remove(r)}catch{}}async clear(){try{if(await Nn.default.pathExists(this.cacheDir)){let e=await Nn.default.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>Nn.default.remove(xf.default.join(this.cacheDir,t))))}}catch{}}async getCacheStats(){try{if(!await Nn.default.pathExists(this.cacheDir))return{entryCount:0,totalSizeBytes:0};let t=(await Nn.default.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),r=0;for(let i of t){let s=await Nn.default.stat(xf.default.join(this.cacheDir,i));r+=s.size}return{entryCount:t.length,totalSizeBytes:r}}catch{return{entryCount:0,totalSizeBytes:0}}}getCachePath(e){return xf.default.join(this.cacheDir,`${e}.json`)}};var Df=K(require("node:process"),1);var pO=o((n=0)=>e=>`\x1B[${e+n}m`,"wrapAnsi16"),mO=o((n=0)=>e=>`\x1B[${38+n};5;${e}m`,"wrapAnsi256"),gO=o((n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,"wrapAnsi16m"),Pt={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Wce=Object.keys(Pt.modifier),UG=Object.keys(Pt.color),qG=Object.keys(Pt.bgColor),Gce=[...UG,...qG];function WG(){let n=new Map;for(let[e,t]of Object.entries(Pt)){for(let[r,i]of Object.entries(t))Pt[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=Pt[r],n.set(i[0],i[1]);Object.defineProperty(Pt,e,{value:t,enumerable:!1})}return Object.defineProperty(Pt,"codes",{value:n,enumerable:!1}),Pt.color.close="\x1B[39m",Pt.bgColor.close="\x1B[49m",Pt.color.ansi=pO(),Pt.color.ansi256=mO(),Pt.color.ansi16m=gO(),Pt.bgColor.ansi=pO(10),Pt.bgColor.ansi256=mO(10),Pt.bgColor.ansi16m=gO(10),Object.defineProperties(Pt,{rgbToAnsi256:{value(e,t,r){return e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;r.length===3&&(r=[...r].map(s=>s+s).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:o(e=>Pt.rgbToAnsi256(...Pt.hexToRgb(e)),"value"),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,r,i;if(e>=232)t=((e-232)*10+8)/255,r=t,i=t;else{e-=16;let c=e%36;t=Math.floor(e/36)/5,r=Math.floor(c/6)/5,i=c%6/5}let s=Math.max(t,r,i)*2;if(s===0)return 30;let a=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(t));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:o((e,t,r)=>Pt.ansi256ToAnsi(Pt.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:o(e=>Pt.ansi256ToAnsi(Pt.hexToAnsi256(e)),"value"),enumerable:!1}}),Pt}o(WG,"assembleStyles");var GG=WG(),Ni=GG;var Jm=K(require("node:process"),1),_O=K(require("node:os"),1),Bv=K(require("node:tty"),1);function Xn(n,e=globalThis.Deno?globalThis.Deno.args:Jm.default.argv){let t=n.startsWith("-")?"":n.length===1?"-":"--",r=e.indexOf(t+n),i=e.indexOf("--");return r!==-1&&(i===-1||r<i)}o(Xn,"hasFlag");var{env:Ft}=Jm.default,Xm;Xn("no-color")||Xn("no-colors")||Xn("color=false")||Xn("color=never")?Xm=0:(Xn("color")||Xn("colors")||Xn("color=true")||Xn("color=always"))&&(Xm=1);function zG(){if("FORCE_COLOR"in Ft)return Ft.FORCE_COLOR==="true"?1:Ft.FORCE_COLOR==="false"?0:Ft.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ft.FORCE_COLOR,10),3)}o(zG,"envForceColor");function HG(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}o(HG,"translateLevel");function QG(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=zG();r!==void 0&&(Xm=r);let i=t?Xm:r;if(i===0)return 0;if(t){if(Xn("color=16m")||Xn("color=full")||Xn("color=truecolor"))return 3;if(Xn("color=256"))return 2}if("TF_BUILD"in Ft&&"AGENT_NAME"in Ft)return 1;if(n&&!e&&i===void 0)return 0;let s=i||0;if(Ft.TERM==="dumb")return s;if(Jm.default.platform==="win32"){let a=_O.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Ft)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in Ft)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Ft)||Ft.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in Ft)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ft.TEAMCITY_VERSION)?1:0;if(Ft.COLORTERM==="truecolor"||Ft.TERM==="xterm-kitty"||Ft.TERM==="xterm-ghostty"||Ft.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Ft){let a=Number.parseInt((Ft.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ft.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ft.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ft.TERM)||"COLORTERM"in Ft?1:s}o(QG,"_supportsColor");function yO(n,e={}){let t=QG(n,{streamIsTTY:n&&n.isTTY,...e});return HG(t)}o(yO,"createSupportsColor");var YG={stdout:yO({isTTY:Bv.default.isatty(1)}),stderr:yO({isTTY:Bv.default.isatty(2)})},SO=YG;function bO(n,e,t){let r=n.indexOf(e);if(r===-1)return n;let i=e.length,s=0,a="";do a+=n.slice(s,r)+e+t,s=r+i,r=n.indexOf(e,s);while(r!==-1);return a+=n.slice(s),a}o(bO,"stringReplaceAll");function vO(n,e,t,r){let i=0,s="";do{let a=n[r-1]==="\r";s+=n.slice(i,a?r-1:r)+e+(a?`\r
|
|
528
528
|
`:`
|
|
529
529
|
`)+t,i=r+1,r=n.indexOf(`
|
|
530
530
|
`,i)}while(r!==-1);return s+=n.slice(i),s}o(vO,"stringEncaseCRLFWithFirstIndex");var{stdout:wO,stderr:EO}=SO,Vv=Symbol("GENERATOR"),Cl=Symbol("STYLER"),Cf=Symbol("IS_EMPTY"),TO=["ansi","ansi","ansi256","ansi16m"],Il=Object.create(null),KG=o((n,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=wO?wO.level:0;n.level=e.level===void 0?t:e.level},"applyOptions");var XG=o(n=>{let e=o((...t)=>t.join(" "),"chalk");return KG(e,n),Object.setPrototypeOf(e,If.prototype),e},"chalkFactory");function If(n){return XG(n)}o(If,"createChalk");Object.setPrototypeOf(If.prototype,Function.prototype);for(let[n,e]of Object.entries(Ni))Il[n]={get(){let t=Zm(this,qv(e.open,e.close,this[Cl]),this[Cf]);return Object.defineProperty(this,n,{value:t}),t}};Il.visible={get(){let n=Zm(this,this[Cl],!0);return Object.defineProperty(this,"visible",{value:n}),n}};var Uv=o((n,e,t,...r)=>n==="rgb"?e==="ansi16m"?Ni[t].ansi16m(...r):e==="ansi256"?Ni[t].ansi256(Ni.rgbToAnsi256(...r)):Ni[t].ansi(Ni.rgbToAnsi(...r)):n==="hex"?Uv("rgb",e,t,...Ni.hexToRgb(...r)):Ni[t][n](...r),"getModelAnsi"),JG=["rgb","hex","ansi256"];for(let n of JG){Il[n]={get(){let{level:t}=this;return function(...r){let i=qv(Uv(n,TO[t],"color",...r),Ni.color.close,this[Cl]);return Zm(this,i,this[Cf])}}};let e="bg"+n[0].toUpperCase()+n.slice(1);Il[e]={get(){let{level:t}=this;return function(...r){let i=qv(Uv(n,TO[t],"bgColor",...r),Ni.bgColor.close,this[Cl]);return Zm(this,i,this[Cf])}}}}var ZG=Object.defineProperties(()=>{},{...Il,level:{enumerable:!0,get(){return this[Vv].level},set(n){this[Vv].level=n}}}),qv=o((n,e,t)=>{let r,i;return t===void 0?(r=n,i=e):(r=t.openAll+n,i=e+t.closeAll),{open:n,close:e,openAll:r,closeAll:i,parent:t}},"createStyler"),Zm=o((n,e,t)=>{let r=o((...i)=>ez(r,i.length===1?""+i[0]:i.join(" ")),"builder");return Object.setPrototypeOf(r,ZG),r[Vv]=n,r[Cl]=e,r[Cf]=t,r},"createBuilder"),ez=o((n,e)=>{if(n.level<=0||!e)return n[Cf]?"":e;let t=n[Cl];if(t===void 0)return e;let{openAll:r,closeAll:i}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=bO(e,t.close,t.open),t=t.parent;let s=e.indexOf(`
|
|
@@ -534,7 +534,7 @@ ${e}`,"wrappedToString"),az=Object.getOwnPropertyDescriptor(Function.prototype,"
|
|
|
534
534
|
`),a=i-1;e=[...s.slice(0,a),"... (content truncated to fit terminal)"].join(`
|
|
535
535
|
`)}return this.#s.write(e),this.#e=this.#w(e,t),this}start(e){if(e&&(this.text=e),this.#g)return this;if(!this.#p){let t=" ".repeat(this.#d)+this.#T(this.#y," ")+(this.text?`- ${this.text}`:"")+this.#S(this.#f," ");return t.trim()!==""&&this.#s.write(t+`
|
|
536
536
|
`),this}return this.isSpinning?this:(this.#i.hideCursor&&Jv.hide(this.#s),this.#i.discardStdin&&Df.default.stdin.isTTY&&(this.#n=!0,aw.start()),this.render(),this.#l=setInterval(this.render.bind(this),this.interval),this)}stop(){return clearInterval(this.#l),this.#l=void 0,this.#t=0,this.#p&&(this.clear(),this.#i.hideCursor&&Jv.show(this.#s)),this.#i.discardStdin&&Df.default.stdin.isTTY&&this.#n&&(aw.stop(),this.#n=!1),this}succeed(e){return this.stopAndPersist({symbol:qo.success,text:e})}fail(e){return this.stopAndPersist({symbol:qo.error,text:e})}warn(e){return this.stopAndPersist({symbol:qo.warning,text:e})}info(e){return this.stopAndPersist({symbol:qo.info,text:e})}stopAndPersist(e={}){if(this.#g)return this;let t=e.prefixText??this.#y,r=this.#T(t," "),i=e.symbol??" ",s=e.text??this.text,c=typeof s=="string"?(i?" ":"")+s:"",l=e.suffixText??this.#f,u=this.#S(l," "),f=r+i+c+u+`
|
|
537
|
-
`;return this.stop(),this.#s.write(f),this}};function cw(n){return new ow(n)}o(cw,"ora");var sg=class{constructor(e,t={}){this.delayTimeout=null;this.updateInterval=null;this.startTime=0;this.isSpinnerVisible=!1;this.message=e,this.delayMs=t.delayMs??2e3,this.isTTY=!!process.stdout.isTTY,this.spinner=cw({text:e,isEnabled:this.isTTY})}static{o(this,"ProgressIndicator")}start(){this.isTTY&&(this.startTime=Date.now(),this.delayTimeout=setTimeout(()=>{this.showSpinner()},this.delayMs))}showSpinner(){!this.isTTY||this.isSpinnerVisible||(this.isSpinnerVisible=!0,this.updateSpinnerText(),this.spinner.start(),this.updateInterval=setInterval(()=>{this.updateSpinnerText()},1e3))}updateSpinnerText(){let e=Date.now()-this.startTime,t=this.formatElapsedTime(e);this.spinner.text=`${this.message} (${t})`}formatElapsedTime(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),i=t%60;return r>0?`${r}m ${i}s`:`${i}s`}cleanup(){this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),this.updateInterval&&(clearInterval(this.updateInterval),this.updateInterval=null)}succeed(e){this.cleanup(),this.isSpinnerVisible&&this.spinner.succeed(e),this.isSpinnerVisible=!1}fail(e){this.cleanup(),this.isSpinnerVisible&&this.spinner.fail(e),this.isSpinnerVisible=!1}stop(){this.cleanup(),this.isSpinnerVisible&&this.spinner.stop(),this.isSpinnerVisible=!1}async wrap(e,t){this.start();try{let r=await e();return this.succeed(t),r}catch(r){let i=r instanceof Error?r.message:"Operation failed";throw this.fail(i),r}}};var hs=K(
|
|
537
|
+
`;return this.stop(),this.#s.write(f),this}};function cw(n){return new ow(n)}o(cw,"ora");var sg=class{constructor(e,t={}){this.delayTimeout=null;this.updateInterval=null;this.startTime=0;this.isSpinnerVisible=!1;this.message=e,this.delayMs=t.delayMs??2e3,this.isTTY=!!process.stdout.isTTY,this.spinner=cw({text:e,isEnabled:this.isTTY})}static{o(this,"ProgressIndicator")}start(){this.isTTY&&(this.startTime=Date.now(),this.delayTimeout=setTimeout(()=>{this.showSpinner()},this.delayMs))}showSpinner(){!this.isTTY||this.isSpinnerVisible||(this.isSpinnerVisible=!0,this.updateSpinnerText(),this.spinner.start(),this.updateInterval=setInterval(()=>{this.updateSpinnerText()},1e3))}updateSpinnerText(){let e=Date.now()-this.startTime,t=this.formatElapsedTime(e);this.spinner.text=`${this.message} (${t})`}formatElapsedTime(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),i=t%60;return r>0?`${r}m ${i}s`:`${i}s`}cleanup(){this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),this.updateInterval&&(clearInterval(this.updateInterval),this.updateInterval=null)}succeed(e){this.cleanup(),this.isSpinnerVisible&&this.spinner.succeed(e),this.isSpinnerVisible=!1}fail(e){this.cleanup(),this.isSpinnerVisible&&this.spinner.fail(e),this.isSpinnerVisible=!1}stop(){this.cleanup(),this.isSpinnerVisible&&this.spinner.stop(),this.isSpinnerVisible=!1}async wrap(e,t){this.start();try{let r=await e();return this.succeed(t),r}catch(r){let i=r instanceof Error?r.message:"Operation failed";throw this.fail(i),r}}};var hs=K(Gt());var ag=class{static{o(this,"QueryAnalyzer")}constructor(){this.parser=new hs.ExoQLParser,this.translator=new hs.ExoQLAlgebraTranslator,this.optimizer=new hs.AlgebraOptimizer,this.serializer=new hs.AlgebraSerializer}async analyze(e,t={}){try{let r=this.parser.parse(e),i={valid:!0,queryType:this.extractQueryType(r),prefixes:this.extractPrefixes(r),variables:this.extractVariables(r),triplePatternCount:this.countTriplePatterns(r),hasFilter:this.hasPatternType(r,"filter"),hasUnion:this.hasPatternType(r,"union"),hasOptional:this.hasPatternType(r,"optional")};if(i.complexity=this.estimateComplexity(i),t.includeAlgebraPlan){let s=this.translator.translate(r);t.optimize!==!1&&(s.type==="construct"?s={...s,where:this.optimizer.optimize(s.where)}:s=this.optimizer.optimize(s)),i.algebraPlan=this.serializer.toString(s)}return i}catch(r){return this.handleParseError(r)}}formatAnalysis(e,t){if(t==="json")return JSON.stringify(e,null,2);if(!e.valid)return this.formatError(e.error);let r=[];if(r.push(`Query Type: ${e.queryType}`),r.push(""),e.prefixes&&e.prefixes.length>0){r.push("Prefixes:");for(let s of e.prefixes)r.push(` ${s.prefix}: <${s.iri}>`);r.push("")}e.variables&&(r.push("Variables:"),e.variables.length===1&&e.variables[0]==="*"?r.push(" * (all variables)"):r.push(` ${e.variables.join(", ")}`),r.push("")),r.push(`Triple Patterns: ${e.triplePatternCount??0}`),r.push("");let i=[];return e.hasFilter&&i.push("FILTER"),e.hasUnion&&i.push("UNION"),e.hasOptional&&i.push("OPTIONAL"),i.length>0&&(r.push(`Features: ${i.join(", ")}`),r.push("")),r.push(`Complexity: ${e.complexity}`),e.algebraPlan&&(r.push(""),r.push("Query Plan:"),r.push(e.algebraPlan)),r.join(`
|
|
538
538
|
`)}extractQueryType(e){return e.type==="update"?"UPDATE":"queryType"in e?e.queryType:"UNKNOWN"}extractPrefixes(e){let t=[];if(e.prefixes&&typeof e.prefixes=="object")for(let[r,i]of Object.entries(e.prefixes))t.push({prefix:r,iri:i});return t}extractVariables(e){return e.variables?Array.isArray(e.variables)?e.variables.length===1&&e.variables[0]==="*"?["*"]:e.variables.map(t=>typeof t=="string"?t:t.termType==="Variable"?`?${t.value}`:t.variable&&t.variable.termType==="Variable"?`?${t.variable.value}`:String(t)):[]:[]}countTriplePatterns(e){let t=e.where||[];return this.countTriplesInPatterns(t)}countTriplesInPatterns(e){let t=0;for(let r of e)r&&(r.type==="bgp"&&Array.isArray(r.triples)?t+=r.triples.length:r.patterns&&Array.isArray(r.patterns)&&(t+=this.countTriplesInPatterns(r.patterns)));return t}hasPatternType(e,t){let r=e.where||[];return this.containsPatternType(r,t)}containsPatternType(e,t){for(let r of e)if(r&&(r.type===t||r.patterns&&this.containsPatternType(r.patterns,t)))return!0;return!1}estimateComplexity(e){let t=0,r=e.triplePatternCount??0;return r<=3?t+=1:r<=7?t+=2:t+=3,e.hasOptional&&(t+=1),e.hasUnion&&(t+=2),e.hasFilter&&(t+=.5),t<=2?"low":t<=4?"medium":"high"}handleParseError(e){return e instanceof hs.SPARQLParseError?{valid:!1,error:{message:e.message,line:e.line,column:e.column,suggestions:this.generateSuggestions(e.message)}}:e instanceof Error?{valid:!1,error:{message:e.message,suggestions:this.generateSuggestions(e.message)}}:{valid:!1,error:{message:String(e)}}}generateSuggestions(e){let t=[],r=e.toLowerCase();if(r.includes("unknown prefix")||r.includes("prefix")){let i=e.match(/prefix[:\s]+(\w+)/i);if(i){let s=i[1].toLowerCase(),a={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",xsd:"http://www.w3.org/2001/XMLSchema#",owl:"http://www.w3.org/2002/07/owl#",ems:"http://exocortex.local/ems#",exo:"http://exocortex.local/exo#",ims:"http://exocortex.local/ims#"};a[s]?t.push(`Add prefix declaration: PREFIX ${s}: <${a[s]}>`):t.push(`Add a PREFIX declaration for '${s}' at the start of your query`)}}return(r.includes("where")||r.includes("expected"))&&t.push("Ensure your query has a WHERE clause: SELECT ?s WHERE { ... }"),(r.includes("bracket")||r.includes("brace")||r.includes("{")||r.includes("}"))&&t.push("Check that all braces { } are properly balanced"),(r.includes("variable")||r.includes("?"))&&t.push("Variables must start with '?' (e.g., ?subject, ?predicate, ?object)"),t.length===0&&t.push("Check SPARQL syntax - see https://www.w3.org/TR/sparql11-query/"),t}formatError(e){let t=[];if(t.push("Syntax Error:"),e.line!==void 0){let r=e.column!==void 0?`line ${e.line}, column ${e.column}`:`line ${e.line}`;t.push(` Position: ${r}`)}if(t.push(` ${e.message}`),e.suggestions&&e.suggestions.length>0){t.push(""),t.push("Suggestions:");for(let r of e.suggestions)t.push(` - ${r}`)}return t.join(`
|
|
539
539
|
`)}};var lw=class extends Error{static{o(this,"TemplateNotFoundError")}constructor(e){super(`Template not found: "${e}". Use --list-templates to see available templates.`),this.name="TemplateNotFoundError"}},uw=class extends Error{static{o(this,"InvalidParameterError")}constructor(e,t,r){super(`Invalid parameter "${e}" for template "${t}". Valid parameters: ${r.length>0?r.join(", "):"none"}`),this.name="InvalidParameterError"}},fw=class extends Error{static{o(this,"MissingParameterError")}constructor(e,t){super(`Missing required parameter(s) for template "${t}": ${e.join(", ")}. Use --param to provide values.`),this.name="MissingParameterError"}},og=class extends Error{static{o(this,"InvalidParamFormatError")}constructor(e){super(`Invalid parameter format: "${e}". Use format: key=value or key1=value1,key2=value2`),this.name="InvalidParamFormatError"}},Rz=[{name:"tasks-by-date",description:"Find tasks scheduled for a specific date",query:`PREFIX ems: <http://example.org/ems#>
|
|
540
540
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
@@ -597,30 +597,30 @@ LIMIT 30`,parameters:[],examples:{}}],Ol=class{static{o(this,"TemplateRegistry")
|
|
|
597
597
|
`),s=i.length,a=Math.max(1,e-t),c=Math.min(s,e+t),l=[];for(let u=a;u<=c;u++)l.push({number:u,content:i[u-1],isError:u===e});return{startLine:a,endLine:c,errorLine:e,errorColumn:r,lines:l}}o(Fz,"getQueryContext");function Dz(n){let e=/PREFIX\s+(\w+):\s*</gi,t=[],r;for(;(r=e.exec(n))!==null;)t.push(r[1]);return t}o(Dz,"extractDeclaredPrefixes");function Nz(n){let e=[/unknown prefix[:\s]+['"]?(\w+)['"]?/i,/prefix\s+['"]?(\w+)['"]?\s+not\s+defined/i,/undefined\s+prefix[:\s]+['"]?(\w+)['"]?/i];for(let t of e){let r=n.match(t);if(r)return r[1]}return null}o(Nz,"extractUnknownPrefix");function Lz(n){let e=[/line\s+(\d+),?\s*column\s+(\d+)/i,/line\s+(\d+):(\d+)/i,/at\s+(\d+):(\d+)/i,/\((\d+),\s*(\d+)\)/];for(let r of e){let i=n.match(r);if(i)return{line:parseInt(i[1],10),column:parseInt(i[2],10)}}let t=n.match(/line\s+(\d+)/i);return t?{line:parseInt(t[1],10)}:{}}o(Lz,"extractPosition");function kz(n){let e=[/timeout[^\d]*(\d+)\s*ms/i,/timeout[^\d]*(\d+)\s*milliseconds/i,/(\d+)\s*ms\s*timeout/i,/exceeded[^\d]*(\d+)\s*ms/i];for(let t of e){let r=n.match(t);if(r)return parseInt(r[1],10)}return null}o(kz,"extractTimeoutDuration");var cg=class{constructor(){this.wellKnownPrefixes={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",xsd:"http://www.w3.org/2001/XMLSchema#",owl:"http://www.w3.org/2002/07/owl#",ems:"http://exocortex.local/ems#",exo:"http://exocortex.local/exo#",ims:"http://exocortex.local/ims#"}}static{o(this,"SPARQLErrorEnhancer")}classifyError(e){let t=e.message.toLowerCase();return t.includes("unknown prefix")||t.includes("prefix")&&(t.includes("not defined")||t.includes("undefined"))?"unknown_prefix":t.includes("parse error")||t.includes("syntax error")||t.includes("unexpected")||t.includes("expected")?"syntax":t.includes("timeout")||t.includes("timed out")||t.includes("exceeded")?"timeout":t.includes("econnrefused")||t.includes("connection refused")||t.includes("network")||t.includes("connect")?"connection":"unknown"}enhanceError(e,t){switch(this.classifyError(e)){case"unknown_prefix":return this.enhanceUnknownPrefixError(e,t);case"syntax":return this.enhanceSyntaxError(e,t);case"timeout":return this.enhanceTimeoutError(e,t);case"connection":return this.enhanceConnectionError(e,t);default:return this.enhanceUnknownError(e,t)}}enhanceUnknownPrefixError(e,t){let r=Nz(e.message),i=Dz(t),s=[...new Set([...i,...Object.keys(this.wellKnownPrefixes)])],a,c=[];if(r){let l=Pz(r,s);l.length>0?(a=`Unknown prefix '${r}'. Did you mean: ${l.join(", ")}?`,c.push(`Replace '${r}:' with '${l[0]}:'`)):a=`Unknown prefix '${r}'.`;let u=i.length>0?i.join(", "):Object.keys(this.wellKnownPrefixes).join(", ");a+=`
|
|
598
598
|
|
|
599
599
|
Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <${this.wellKnownPrefixes[r]}>`)}else a=e.message;return{type:"unknown_prefix",message:a,originalMessage:e.message,originalStack:e.stack,suggestions:c.length>0?c:void 0}}enhanceSyntaxError(e,t){let r=e,i=r.line!==void 0?{line:r.line,column:r.column}:Lz(e.message),s,a;i.line?(s=`Syntax error at line ${i.line}`,i.column&&(s+=`, column ${i.column}`),s+=`: ${e.message.replace(/.*line\s+\d+.*?:\s*/i,"")}`,a=Fz(t,i.line,2,i.column)):s=`Syntax error: ${e.message}`;let c=this.generateSyntaxSuggestions(e.message);return{type:"syntax",message:s,originalMessage:e.message,originalStack:e.stack,suggestions:c.length>0?c:void 0,context:a,line:i.line,column:i.column}}generateSyntaxSuggestions(e){let t=[],r=e.toLowerCase();return(r.includes("where")||r.includes("expected"))&&t.push("Ensure your query has a WHERE clause: SELECT ?s WHERE { ... }"),(r.includes("{")||r.includes("}")||r.includes("brace")||r.includes("bracket"))&&t.push("Check that all braces { } are properly balanced"),(r.includes("variable")||r.includes("?"))&&t.push("Variables must start with '?' (e.g., ?subject, ?predicate, ?object)"),(r.includes("end of input")||r.includes("eof"))&&t.push("Query may be incomplete - check for missing closing braces or statements"),r.includes("prefix")&&t.push("Add PREFIX declarations at the start of your query"),t.length===0&&t.push("Check SPARQL syntax reference: https://www.w3.org/TR/sparql11-query/"),t}enhanceTimeoutError(e,t){let r=kz(e.message),i=r?Math.round(r/1e3):null,s;i?s=`Query timed out after ${i} second${i!==1?"s":""}`:s="Query timed out";let a=["Try limiting results with LIMIT (e.g., LIMIT 100)","Add more specific FILTER conditions to reduce result set","Use more selective triple patterns","Consider using OPTIONAL sparingly (it can be expensive)"];return/\bLIMIT\b/i.test(t)||a.unshift("Add LIMIT clause to restrict result count"),/SELECT\s+\*/i.test(t)&&a.push("Replace SELECT * with specific variables to reduce data transfer"),{type:"timeout",message:s,originalMessage:e.message,originalStack:e.stack,suggestions:a}}enhanceConnectionError(e,t){let r="Connection failed to SPARQL endpoint",i=["Check that the SPARQL endpoint is running","Verify network connectivity","Check firewall settings"];return{type:"connection",message:r,originalMessage:e.message,originalStack:e.stack,suggestions:i}}enhanceUnknownError(e,t){return{type:"unknown",message:e.message,originalMessage:e.message,originalStack:e.stack,suggestions:["Check query syntax and try again"]}}formatForText(e){let t=[];if(t.push(`\u274C ${e.message}`),e.context){t.push(""),t.push("Context:");for(let r of e.context.lines){let i=r.isError?">>> ":" ";if(t.push(`${i}${r.number.toString().padStart(3)}: ${r.content}`),r.isError&&e.context.errorColumn){let s=" ".repeat(8+r.number.toString().length+e.context.errorColumn-1)+"^";t.push(s)}}}if(e.suggestions&&e.suggestions.length>0){t.push(""),t.push("Suggestions:");for(let r of e.suggestions)t.push(` \u2022 ${r}`)}return t.join(`
|
|
600
|
-
`)}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 lg=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 Wo=require("fs"),dw=require("path");function Nf(n){let e=new Map,t="obsidian://vault/",r;try{r=(0,Wo.readdirSync)(n)}catch{return e}for(let i of r){let s=(0,dw.join)(n,i);if(i.startsWith("."))continue;let a;try{a=(0,Wo.statSync)(s)}catch{continue}if(!a.isDirectory())continue;let c;try{c=(0,Wo.readdirSync)(s)}catch{continue}for(let l of c){let u=(0,dw.join)(s,l);if(l.startsWith("."))continue;let f;try{f=(0,Wo.statSync)(u)}catch{continue}if(!f.isDirectory())continue;let d=!1;try{d=(0,Wo.readdirSync)(u).some(p=>p.endsWith(".md"))}catch{continue}if(d){let h=`${i}/${l}`,p=encodeURI(h),_=`${t}${p}/`;/^[a-zA-Z][a-zA-Z0-9_]*$/.test(l)&&e.set(l,_)}}}return e}o(Nf,"scanVaultNamespaces");var $O=K(
|
|
600
|
+
`)}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 lg=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 Wo=require("fs"),dw=require("path");function Nf(n){let e=new Map,t="obsidian://vault/",r;try{r=(0,Wo.readdirSync)(n)}catch{return e}for(let i of r){let s=(0,dw.join)(n,i);if(i.startsWith("."))continue;let a;try{a=(0,Wo.statSync)(s)}catch{continue}if(!a.isDirectory())continue;let c;try{c=(0,Wo.readdirSync)(s)}catch{continue}for(let l of c){let u=(0,dw.join)(s,l);if(l.startsWith("."))continue;let f;try{f=(0,Wo.statSync)(u)}catch{continue}if(!f.isDirectory())continue;let d=!1;try{d=(0,Wo.readdirSync)(u).some(p=>p.endsWith(".md"))}catch{continue}if(d){let h=`${i}/${l}`,p=encodeURI(h),_=`${t}${p}/`;/^[a-zA-Z][a-zA-Z0-9_]*$/.test(l)&&e.set(l,_)}}}return e}o(Nf,"scanVaultNamespaces");var $O=K(Gt());var BO=new Set(["exo","ems","ims","gtd","period","lit","inbox","rdf","rdfs","owl","xsd"]),Mz=/(<)([a-zA-Z][a-zA-Z0-9]*)__([a-zA-Z][a-zA-Z0-9_]*)(>)/g;function Pl(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=$O.SPARQL_PREFIXES.split(`
|
|
601
601
|
`).filter(a=>a.trim().length>0),s=[];for(let a of i){let c=/PREFIX\s+(\w+)\s*:/i.exec(a);c&&!e.has(c[1].toLowerCase())&&s.push(a)}return s.length===0?n:s.join(`
|
|
602
602
|
`)+`
|
|
603
603
|
`+n}o(Pl,"injectExocortexPrefixes");function ug(n){return n.replace(Mz,(e,t,r,i,s)=>BO.has(r.toLowerCase())?`${r}:${i}`:e)}o(ug,"transformShorthandNotation");function Lf(n){let e=new Map(n);for(let t of BO)e.delete(t);return e}o(Lf,"filterOntologyPrefixes");var jz=300,VO=3e4,$z="EXOCORTEX_SPARQL_TIMEOUT";function Bz(){let n=process.env[$z];if(!n)return VO;try{let e=Vz(n);if(e!==null&&e>0)return e}catch{}return VO}o(Bz,"getDefaultTimeout");function Vz(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(Vz,"parseTimeoutSafe");function Uz(n){if(!n)return jz;let e=parseInt(n.trim(),10);if(isNaN(e)||e<=0)throw new Qe(`Invalid cache TTL: "${n}". Must be a positive number (seconds).`,'exocortex sparql query --cache-ttl 600 "SELECT * WHERE { ?s ?p ?o }"');return e}o(Uz,"parseCacheTtl");function qz(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 Qe(`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 Qe(`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 Qe(`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(qz,"parseTimeout");async function hw(n,e,t=Date.now()){let r,i=new Promise((s,a)=>{r=setTimeout(()=>{let c=Date.now()-t;a(new Tf(e,c))},e),r&&typeof r=="object"&&"unref"in r&&r.unref()});return Promise.race([n,i])}o(hw,"executeWithTimeout");function Wz(n,e){return e.concat([n])}o(Wz,"collectAlso");function qO(){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)",Wz,[]).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";D.setFormat(t);let r="";try{let i=Date.now(),s=e.timeout?qz(e.timeout):Bz(),a=Uz(e.cacheTtl),c=e.cache!==!1;if(e.template){let z=new Ol,G=e.param?z.parseParamString(e.param):{};if(r=z.applyTemplate(e.template,G),t==="text"){let F=z.getTemplate(e.template);console.log(`\u{1F4CB} Using template: ${e.template}`),Object.keys(G).length>0&&console.log(` Parameters: ${Object.entries(G).map(([j,ee])=>`${j}=${ee}`).join(", ")}`),console.log()}}else if(n)r=Gz(n);else throw new Qe("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 zz(r,e,t);return}let l=(0,kf.resolve)(e.vault);if(c){let G=await new xl().get(r,a);if(G!==null){let F=Date.now()-i;if(t==="json"){let j=Z.success(G,{durationMs:F,itemCount:G.count||0,queryResultCacheHit:!0});console.log(JSON.stringify(j,null,2))}else{console.log(`\u{1F4E6} (cached) Query result loaded from cache in ${F}ms
|
|
604
604
|
`);let j=G;j.type==="select"&&j.bindings?(console.log(`\u2705 Found ${j.bindings.length} result(s)
|
|
605
605
|
`),Yz(j.bindings,e.format)):j.type==="construct"&&j.triples&&(console.log(`\u2705 Generated ${j.triples.length} triple(s)
|
|
606
|
-
`),Kz(j.triples,e.format))}return}}if(!(0,Fl.existsSync)(l))throw new Te(l);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${l}...`);let u=Date.now(),f,d=!1;if(e.useCache){let G=await new Kn(l).loadOrBuild();f=G.triples,d=G.cacheHit,t==="text"&&d&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let z=new
|
|
606
|
+
`),Kz(j.triples,e.format))}return}}if(!(0,Fl.existsSync)(l))throw new Te(l);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${l}...`);let u=Date.now(),f,d=!1;if(e.useCache){let G=await new Kn(l).loadOrBuild();f=G.triples,d=G.cacheHit,t==="text"&&d&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let z=new zt(l);f=await new Bt.NoteToRDFConverter(z).convertVault()}let h=e.also||[];for(let z of h){let G=(0,kf.resolve)(z);if(!(0,Fl.existsSync)(G))throw new Te(G);t==="text"&&console.log(`\u{1F4E6} Loading additional vault: ${G}...`);let F=new zt(G),ee=await new Bt.NoteToRDFConverter(F).convertVault();f=f.concat(ee),t==="text"&&console.log(` \u2795 Added ${ee.length} triples from ${G}`)}let p=new Bt.InMemoryTripleStore;await p.addAll(f);let _=Date.now()-u;if(t==="text"){let z=d?" (from cache)":"",G=h.length>0?` (${h.length+1} vaults)`:"";console.log(`\u2705 Loaded ${f.length} triples in ${_}ms${z}${G}
|
|
607
607
|
`),console.log("\u{1F50D} Parsing SPARQL query...")}let b=new Bt.ExoQLParser;r=ug(r),r=Pl(r);let E=Lf(Nf(l));for(let z of h){let G=Lf(Nf((0,kf.resolve)(z)));for(let[F,j]of G)E.has(F)||E.set(F,j)}E.size>0&&b.setVaultPrefixes(E);let v=b.parse(r);if(v.type==="update"){t==="text"&&console.log("\u{1F504} Executing SPARQL UPDATE...");let z=Date.now(),G=new Bt.UpdateExecutor(p),F=await hw(G.execute(v),s,z),j=Date.now()-z,ee=Date.now()-i;if(t==="json"){let Ye=Z.success({query:r,type:"update",results:F},{durationMs:ee,itemCount:F.length,loadDurationMs:_,execDurationMs:j,triplesScanned:f.length,cacheHit:d});console.log(JSON.stringify(Ye,null,2))}else Jz(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(`
|
|
608
608
|
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${_}ms${d?" (from cache)":""}`),console.log(` Query execution: ${j}ms`),console.log(` Total time: ${ee}ms`),console.log(` Triples scanned: ${f.length}`));return}t==="text"&&console.log("\u{1F504} Translating to algebra...");let R=new Bt.ExoQLAlgebraTranslator().translate(v);if(!e.noOptimize&&R.type!=="construct")R=new Bt.AlgebraOptimizer().optimize(R);else if(!e.noOptimize&&R.type==="construct"){let z=new Bt.AlgebraOptimizer,G=R;R={...G,where:z.optimize(G.where)}}if(e.explain&&t==="text"){console.log("\u{1F4CA} Query Plan:");let z=new Bt.AlgebraSerializer;if(R.type==="construct"){let G=R;console.log("CONSTRUCT Template:"),console.log(" (template patterns)"),console.log("WHERE:"),console.log(z.toString(G.where))}else console.log(z.toString(R));console.log()}let B=Date.now(),W=new Bt.ExoQLQueryExecutor(p);typeof W.setTimeout=="function"&&W.setTimeout(s);let ve=t==="text"?new sg("Executing query",{delayMs:2e3}):null;if(W.isConstructQuery(R)){ve?.start();let z=await hw(W.executeConstruct(R),s,B),G=Date.now()-B;ve?.stop();let F=Date.now()-i;if(c){let j=new Al,ee={type:"construct",count:z.length,triples:JSON.parse(j.formatJson(z))};await new xl().set(r,ee,a)}if(t==="json"){let j=new Al,ee={query:r,count:z.length,triples:JSON.parse(j.formatJson(z))},Ye=Z.success(ee,{durationMs:F,itemCount:z.length,loadDurationMs:_,execDurationMs:G,triplesScanned:f.length,cacheHit:d,queryResultCacheHit:!1});console.log(JSON.stringify(Ye,null,2))}else console.log(`\u2705 Generated ${z.length} triple(s) in ${G}ms
|
|
609
609
|
`),z.length>0?Qz(z,e.format):console.log("No triples generated."),e.stats&&(console.log(`
|
|
610
610
|
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${_}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: ${z.length}`),e.useCache&&console.log(` Triple cache: ${d?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}else{ve?.start();let z=await hw(W.executeAll(R),s,B),G=Date.now()-B;ve?.stop();let F=Date.now()-i,j=z.map(ee=>ee.toJSON());if(c){let ee={type:"select",count:z.length,bindings:j};await new xl().set(r,ee,a)}if(t==="json"){let ee={query:r,count:z.length,bindings:j},Ye=Z.success(ee,{durationMs:F,itemCount:z.length,loadDurationMs:_,execDurationMs:G,triplesScanned:f.length,cacheHit:d,queryResultCacheHit:!1});console.log(JSON.stringify(Ye,null,2))}else console.log(`\u2705 Found ${z.length} result(s) in ${G}ms
|
|
611
611
|
`),z.length>0?Hz(z,e.format):console.log("No results found."),e.stats&&(console.log(`
|
|
612
612
|
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${_}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: ${z.length}`),e.useCache&&console.log(` Triple cache: ${d?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}}catch(i){WO(i,r,t)}})}o(qO,"sparqlQueryCommand");function WO(n,e,t){let r=new cg;if(r.classifyError(n)!=="unknown"){let s=r.enhanceError(n,e);if(t==="json"){let a=Z.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)}D.handle(n)}o(WO,"handleSparqlError");function Gz(n){if(n.includes("SELECT")||n.includes("CONSTRUCT")||n.includes("INSERT")||n.includes("DELETE"))return n;let e=(0,kf.resolve)(n);return(0,Fl.existsSync)(e)?(0,Fl.readFileSync)(e,"utf-8"):n}o(Gz,"loadQuery");async function zz(n,e,t){if(e.explain){let i=new ag,s=await i.analyze(n,{includeAlgebraPlan:!0,optimize:!e.noOptimize});if(t==="json"){let a=Z.success(s);console.log(JSON.stringify(a,null,2))}else s.valid?(console.log(`\u2705 Query syntax is valid
|
|
613
|
-
`),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new Bt.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new Bt.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new Bt.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new Bt.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=Z.success({valid:!0,queryType:UO(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: ${UO(i)}`)}catch(i){WO(i,n,t)}}o(zz,"executeDryRun");function UO(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}o(UO,"getQueryType");function Hz(n,e){switch(e){case"json":let t=new Tl;console.log(t.format(n));break;case"csv":let r=new Km;console.log(r.format(n));break;case"table":default:let i=new El;console.log(i.format(n));break}}o(Hz,"formatSelectResults");function Qz(n,e){let t=new Al;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(Qz,"formatConstructResults");function Yz(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(Yz,"formatCachedSelectResults");function Kz(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}> ${Xz(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(Kz,"formatCachedConstructResults");function Xz(n){return lg.formatObject(n)}o(Xz,"formatNTriplesObject");function Jz(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(Jz,"formatUpdateResults");var GO=require("fs"),zO=require("path"),ps=K(
|
|
613
|
+
`),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new Bt.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new Bt.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new Bt.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new Bt.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=Z.success({valid:!0,queryType:UO(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: ${UO(i)}`)}catch(i){WO(i,n,t)}}o(zz,"executeDryRun");function UO(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}o(UO,"getQueryType");function Hz(n,e){switch(e){case"json":let t=new Tl;console.log(t.format(n));break;case"csv":let r=new Km;console.log(r.format(n));break;case"table":default:let i=new El;console.log(i.format(n));break}}o(Hz,"formatSelectResults");function Qz(n,e){let t=new Al;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(Qz,"formatConstructResults");function Yz(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(Yz,"formatCachedSelectResults");function Kz(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}> ${Xz(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(Kz,"formatCachedConstructResults");function Xz(n){return lg.formatObject(n)}o(Xz,"formatNTriplesObject");function Jz(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(Jz,"formatUpdateResults");var GO=require("fs"),zO=require("path"),ps=K(Gt());function HO(){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";D.setFormat(e);try{let t=(0,zO.resolve)(n.vault);if(!(0,GO.existsSync)(t))throw new Te(t);let r=new Kn(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 ps.InMemoryTripleStore;await f.addAll(u),c=await new ps.RDFSInferenceEngine().materialize(f);let h=new ps.NonInheritablePropertyRegistry;await h.initialize(f);let p=new ps.PropertyCardinalityRegistry;await p.initialize(f);let b=await new ps.PrototypeChainMaterializer(h,p).materialize(f);if(c+=b,c>0){let E=await f.match();await r.saveTriples(E),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=Z.success({cache:u,stats:h,validation:f},{durationMs:l});console.log(JSON.stringify(p,null,2))}}else{let d=Z.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(d,null,2))}}else{if(a.skippedFiles.length>0){console.log(`
|
|
614
614
|
\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(`
|
|
615
|
-
\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: ${Zz(u.sizeBytes)}`))}}}catch(t){D.handle(t)}})}o(HO,"sparqlIndexCommand");function Zz(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o(Zz,"formatBytes");function QO(){return new Ie("templates").description("List available SPARQL query templates").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";D.setFormat(e);try{let t=new Ol,r=t.listTemplates();if(e==="json"){let i=Z.success({templates:r,count:r.length});console.log(JSON.stringify(i,null,2))}else console.log(t.formatList("text"))}catch(t){D.handle(t)}})}o(QO,"sparqlTemplatesCommand");var tF=require("path");var ur=K(Ma()),Wa=K(require("path"));var gP=K(oP(),1);var jf=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var oH={"[: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]},$f=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),cH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),cP=o(n=>n.join(""),"rangesToString"),lP=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 b=n.charAt(s);if((b==="!"||b==="^")&&s===t+1){u=!0,s++;continue}if(b==="]"&&a&&!l){f=s+1;break}if(a=!0,b==="\\"&&!l){l=!0,s++;continue}if(b==="["&&!l){for(let[E,[v,A,R]]of Object.entries(oH))if(n.startsWith(E,s)){if(d)return["$.",!1,n.length-t,!0];s+=E.length,R?i.push(v):r.push(v),c=c||A;continue e}}if(l=!1,d){b>d?r.push($f(d)+"-"+$f(b)):b===d&&r.push($f(b)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push($f(b+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=b,s+=2;continue}r.push($f(b)),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 b=r[0].length===2?r[0].slice(-1):r[0];return[cH(b),!1,f-t,!1]}let h="["+(u?"^":"")+cP(r)+"]",p="["+(u?"":"^")+cP(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var ki=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Cn,lH=new Set(["!","?","+","*","@"]),gw=o(n=>lH.has(n),"isExtglobType"),uP=o(n=>gw(n.type),"isExtglobAST"),uH=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),fH=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),dH=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),fP=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),hH="(?!(?:^|/)\\.\\.?(?:$|/))",fg="(?!\\.)",pH=new Set(["[","."]),mH=new Set(["..","."]),gH=new Set("().*{}+?[]^$\\!"),yH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),yw="[^/]",dP=yw+"*?",hP=yw+"+?",Go=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 Cn&&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 Cn&&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 Cn(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 b=r,E="";for(;b<e.length;){let v=e.charAt(b++);if(c||v==="\\"){c=!c,E+=v;continue}if(l){b===u+1?(v==="^"||v==="!")&&(f=!0):v==="]"&&!(b===u+2&&f)&&(l=!1),E+=v;continue}else if(v==="["){l=!0,u=b,f=!1,E+=v;continue}if(!i.noext&&gw(v)&&e.charAt(b)==="("&&s<=a){t.push(E),E="";let R=new Cn(v,t);b=Cn.#g(e,R,b,i,s+1),t.push(R);continue}E+=v}return t.push(E),b}let d=r+1,h=new Cn(null,t),p=[],_="";for(;d<e.length;){let b=e.charAt(d++);if(c||b==="\\"){c=!c,_+=b;continue}if(l){d===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(d===u+2&&f)&&(l=!1),_+=b;continue}else if(b==="["){l=!0,u=d,f=!1,_+=b;continue}if(gw(b)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(b))){let v=t&&t.#y(b)?0:1;h.push(_),_="";let A=new Cn(b,h);h.push(A),d=Cn.#g(e,A,d,i,s+v);continue}if(b==="|"){h.push(_),_="",p.push(h),h=new Cn(null,t);continue}if(b===")")return _===""&&t.#t.length===0&&(t.#a=!0),h.push(_),_="",t.push(...p,h),d;_+=b}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,fH)}#m(e,t=uH){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=dH){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Cn(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!!fP.get(this.type)?.has(e)}#S(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)}#w(e){let t=fP.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}#b(){if(uP(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.#b(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#S(i)&&(t=!1,this.#w(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#b();this.#l=void 0}static fromGlob(e,t={}){let r=new Cn(null,void 0,t);return Cn.#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.#b(),this.#p()),!uP(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[_,b,E,v]=typeof p=="string"?Cn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||E,this.#r=this.#r||v,_}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&mH.has(this.#t[0]))){let _=pH,b=t&&_.has(u.charAt(0))||u.startsWith("\\.")&&_.has(u.charAt(2))||u.startsWith("\\.\\.")&&_.has(u.charAt(4)),E=!t&&!e&&_.has(u.charAt(0));f=b?hH:E?fg:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,ki(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(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,ki(this.toString()),!1,!1]}let a=!r||e||t||!fg?"":this.#v(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?fg:"")+hP;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?fg:"")+dP+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,ki(s),this.#n=!!this.#n,this.#r]}#v(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+=(gH.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=lP(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)?hP:dP,t=!0;continue}else c=!1;if(u==="?"){s+=yw,t=!0;continue}s+=yH(u)}return[s,ki(e),!!t,a]}};Cn=Go;var Dl=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Lr=o((n,e,t={})=>(jf(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Ln(e,t).match(n)),"minimatch"),_H=/^\*+([^+@!?\*\[\(]*)$/,SH=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),bH=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),vH=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),wH=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),EH=/^\*+\.\*+$/,TH=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),AH=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),xH=/^\.\*+$/,CH=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),IH=/^\*+$/,RH=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),OH=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),PH=/^\?+([^+@!?\*\[\(]*)?$/,FH=o(([n,e=""])=>{let t=yP([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),DH=o(([n,e=""])=>{let t=_P([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),NH=o(([n,e=""])=>{let t=_P([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),LH=o(([n,e=""])=>{let t=yP([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),yP=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),_P=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),SP=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",pP={win32:{sep:"\\"},posix:{sep:"/"}},kH=SP==="win32"?pP.win32.sep:pP.posix.sep;Lr.sep=kH;var zt=Symbol("globstar **");Lr.GLOBSTAR=zt;var MH="[^/]",jH=MH+"*?",$H="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",BH="(?:(?!(?:\\/|^)\\.).)*?",VH=o((n,e={})=>t=>Lr(t,n,e),"filter");Lr.filter=VH;var Jn=o((n,e={})=>Object.assign({},n,e),"ext"),UH=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Lr;let e=Lr;return Object.assign(o((r,i,s={})=>e(r,i,Jn(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,Jn(n,s))}static defaults(i){return e.defaults(Jn(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,Jn(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Jn(n,s))}},unescape:o((r,i={})=>e.unescape(r,Jn(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,Jn(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,Jn(n,i)),"filter"),defaults:o(r=>e.defaults(Jn(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,Jn(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,Jn(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,Jn(n,s)),"match"),sep:e.sep,GLOBSTAR:zt})},"defaults");Lr.defaults=UH;var bP=o((n,e={})=>(jf(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,gP.default)(n)),"braceExpand");Lr.braceExpand=bP;var qH=o((n,e={})=>new Ln(n,e).makeRe(),"makeRe");Lr.makeRe=qH;var WH=o((n,e,t={})=>{let r=new Ln(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Lr.match=WH;var mP=/[?*]|[+@!]\(.*?\)|\[|\]/,GH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Ln=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={}){jf(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||SP,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]==="?"||!mP.test(s[2]))&&!mP.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,_]=[e[d],t[h]];p.toLowerCase()===_.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(zt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(zt,s),c=t.lastIndexOf(zt),[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 A=e.slice(i,i+l.length);if(!this.#r(A,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let A=e.length-f.length;if(this.#r(e,f,r,A,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(A--,!this.#r(e,f,r,A,0)))return!1;d=f.length+1}}if(!u.length){let A=!!d;for(let R=i;R<e.length-d;R++){let B=String(e[R]);if(A=!0,B==="."||B===".."||!this.options.dot&&B.startsWith("."))return!1}return r||A}let h=[[[],0]],p=h[0],_=0,b=[0];for(let A of u)A===zt?(b.push(_),p=[[],0],h.push(p)):(p[0].push(A),_++);let E=h.length-1,v=e.length-d;for(let A of h)A[1]=v-(b[E--]+A[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===zt)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 bP(this.pattern,this.options)}parse(e){jf(e);let t=this.options;if(e==="**")return zt;if(e==="")return"";let r,i=null;(r=e.match(IH))?i=t.dot?OH:RH:(r=e.match(_H))?i=(t.nocase?t.dot?wH:vH:t.dot?bH:SH)(r[1]):(r=e.match(PH))?i=(t.nocase?t.dot?DH:FH:t.dot?NH:LH)(r):(r=e.match(EH))?i=t.dot?AH:TH:(r=e.match(xH))&&(i=CH);let s=Go.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?jH:t.dot?$H:BH,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"?GH(f):f===zt?zt:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==zt||p===zt||(p===void 0?h!==void 0&&h!==zt?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==zt&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=zt))}),u.filter(f=>f!==zt).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 Lr.defaults(e).Minimatch}};Lr.AST=Go;Lr.Minimatch=Ln;Lr.escape=Dl;Lr.unescape=ki;var WP=require("node:url");var Nl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,wP=new Set,_w=typeof process=="object"&&process?process:{},EP=o((n,e,t,r)=>{typeof _w.emitWarning=="function"?_w.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),dg=globalThis.AbortController,vP=globalThis.AbortSignal;if(typeof dg>"u"){vP=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},dg=class{static{o(this,"AbortController")}constructor(){e()}signal=new vP;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=_w.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,EP("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 zH=o(n=>!wP.has(n),"shouldWarn");var Ba=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),TP=o(n=>Ba(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ll:null:null,"getUintArray"),Ll=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},Sw=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=TP(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]}},Bf=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;#S;#w;#b;#v;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#S,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.#j(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#B(t),"moveToTail"),indexes:o(t=>e.#I(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:_=0,sizeCalculation:b,fetchMethod:E,memoMethod:v,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:B,allowStaleOnFetchAbort:W,ignoreFetchAbort:ve}=e;if(t!==0&&!Ba(t))throw new TypeError("max option must be a nonnegative integer");let z=t?TP(t):Array;if(!z)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=_||this.#n,this.sizeCalculation=b,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(v!==void 0&&typeof v!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#_=v,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=E,this.#b=!!E,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new z(t),this.#g=new z(t),this.#d=0,this.#m=0,this.#y=Sw.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.#w=!!this.#r,this.#v=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!B,this.allowStaleOnFetchAbort=!!W,this.ignoreFetchAbort=!!ve,this.maxEntrySize!==0){if(this.#n!==0&&!Ba(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ba(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Ba(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ba(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";zH(G)&&(wP.add(G),EP("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 Ll(this.#e),t=new Ll(this.#e);this.#S=e,this.#T=t,this.#F=(s,a,c=Nl.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.#C=s=>{t[s]=e[s]!==0?Nl.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=Nl.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}}#C=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#A=o(()=>!1,"#isStale");#O(){let e=new Ll(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(!Ba(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Ba(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.#M(!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");*#I({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.#I())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.#I()){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.#I())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.#I()){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.#I()){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.#S&&this.#T){let a=this.#S[t],c=this.#T[t];if(a&&c){let l=a-(Nl.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.#I({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.#S&&this.#T){a.ttl=this.#S[t];let c=Nl.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=Nl.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.#M(!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.#B(d);let h=this.#a[d];if(t!==h){if(this.#b&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!a&&(this.#w&&this.#r?.(p,e,"set"),this.#v&&this.#f?.push([p,e,"set"]))}else a||(this.#w&&this.#r?.(h,e,"set"),this.#v&&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.#S&&this.#x(),this.#S&&(u||this.#F(d,i,s),l&&this.#o(l,d)),!a&&this.#v&&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.#M(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#v&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#d,r=this.#l[t],i=this.#a[t];return this.#b&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#w||this.#v)&&(this.#w&&this.#r?.(i,r,"evict"),this.#v&&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.#C(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}#j(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#h(s))return s;let a=new dg,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((b,E=!1)=>{let{aborted:v}=a.signal,A=r.ignoreFetchAbort&&b!==void 0;if(r.status&&(v&&!E?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,A&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),v&&!A&&!E)return d(a.signal.reason);let R=p;return this.#a[t]===p&&(b===void 0?R.__staleWhileFetching?this.#a[t]=R.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,b,l.options))),b},"cb"),f=o(b=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=b),d(b)),"eb"),d=o(b=>{let{aborted:E}=a.signal,v=E&&r.allowStaleOnFetchAbort,A=v||r.allowStaleOnFetchRejection,R=A||r.noDeleteOnFetchRejection,B=p;if(this.#a[t]===p&&(!R||B.__staleWhileFetching===void 0?this.#P(e,"fetch"):v||(this.#a[t]=B.__staleWhileFetching)),A)return r.status&&B.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),B.__staleWhileFetching;if(B.__returned===B)throw b},"fetchFail"),h=o((b,E)=>{let v=this.#c?.(e,s,l);v&&v instanceof Promise&&v.then(A=>b(A===void 0?void 0:A),E),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=o(A=>u(A,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),_=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,_,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=_,_}#h(e){if(!this.#b)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof dg}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:_=this.allowStaleOnFetchAbort,context:b,forceRefresh:E=!1,status:v,signal:A}=t;if(!this.#b)return v&&(v.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:v});let R={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:_,ignoreFetchAbort:p,status:v,signal:A},B=this.#s.get(e);if(B===void 0){v&&(v.fetch="miss");let W=this.#j(e,B,R,b);return W.__returned=W}else{let W=this.#a[B];if(this.#h(W)){let j=r&&W.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",j&&(v.returnedStale=!0)),j?W.__staleWhileFetching:W.__returned=W}let ve=this.#A(B);if(!E&&!ve)return v&&(v.fetch="hit"),this.#B(B),i&&this.#C(B),v&&this.#o(v,B),W;let z=this.#j(e,B,R,b),F=z.__staleWhileFetching!==void 0&&r;return v&&(v.fetch=ve?"stale":"refresh",F&&ve&&(v.returnedStale=!0)),F?z.__staleWhileFetching:z.__returned=z}}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.#B(c),i&&this.#C(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#B(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.#V(t);else{this.#D(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#v)&&(this.#w&&this.#r?.(s,e,t),this.#v&&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.#v&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#V("delete")}#V(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.#w&&this.#r?.(r,i,e),this.#v&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#S&&this.#T&&(this.#S.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.#v&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var jl=require("node:path"),NP=require("node:url"),ys=require("fs"),rQ=K(require("node:fs"),1),qa=require("node:fs/promises");var Sg=require("node:events"),xw=K(require("node:stream"),1),RP=require("node:string_decoder");var AP=typeof process=="object"&&process?process:{stdout:null,stderr:null},HH=o(n=>!!n&&typeof n=="object"&&(n instanceof Ua||n instanceof xw.default||QH(n)||YH(n)),"isStream"),QH=o(n=>!!n&&typeof n=="object"&&n instanceof Sg.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==xw.default.Writable.prototype.pipe,"isReadable"),YH=o(n=>!!n&&typeof n=="object"&&n instanceof Sg.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),ra=Symbol("EOF"),na=Symbol("maybeEmitEnd"),Va=Symbol("emittedEnd"),hg=Symbol("emittingEnd"),Vf=Symbol("emittedError"),pg=Symbol("closed"),xP=Symbol("read"),mg=Symbol("flush"),CP=Symbol("flushChunk"),Mi=Symbol("encoding"),kl=Symbol("decoder"),br=Symbol("flowing"),Uf=Symbol("paused"),Ml=Symbol("resume"),vr=Symbol("buffer"),pn=Symbol("pipes"),wr=Symbol("bufferLength"),bw=Symbol("bufferPush"),gg=Symbol("bufferShift"),Yr=Symbol("objectMode"),Ht=Symbol("destroyed"),vw=Symbol("error"),ww=Symbol("emitData"),IP=Symbol("emitEnd"),Ew=Symbol("emitEnd2"),ms=Symbol("async"),Tw=Symbol("abort"),yg=Symbol("aborted"),qf=Symbol("signal"),zo=Symbol("dataListeners"),kn=Symbol("discarded"),Wf=o(n=>Promise.resolve().then(n),"defer"),KH=o(n=>n(),"nodefer"),XH=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),JH=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),ZH=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),_g=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[Ml](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Aw=class extends _g{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)}},eQ=o(n=>!!n.objectMode,"isObjectModeOptions"),tQ=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Ua=class extends Sg.EventEmitter{static{o(this,"Minipass")}[br]=!1;[Uf]=!1;[pn]=[];[vr]=[];[Yr];[Mi];[ms];[kl];[ra]=!1;[Va]=!1;[hg]=!1;[pg]=!1;[Vf]=null;[wr]=0;[Ht]=!1;[qf];[yg]=!1;[zo]=0;[kn]=!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");eQ(t)?(this[Yr]=!0,this[Mi]=null):tQ(t)?(this[Mi]=t.encoding,this[Yr]=!1):(this[Yr]=!1,this[Mi]=null),this[ms]=!!t.async,this[kl]=this[Mi]?new RP.StringDecoder(this[Mi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[vr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[pn],"get")});let{signal:r}=t;r&&(this[qf]=r,r.aborted?this[Tw]():r.addEventListener("abort",()=>this[Tw]()))}get bufferLength(){return this[wr]}get encoding(){return this[Mi]}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[ms]}set async(e){this[ms]=this[ms]||!!e}[Tw](){this[yg]=!0,this.emit("abort",this[qf]?.reason),this.destroy(this[qf]?.reason)}get aborted(){return this[yg]}set aborted(e){}write(e,t,r){if(this[yg])return!1;if(this[ra])throw new Error("write after end");if(this[Ht])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[ms]?Wf:KH;if(!this[Yr]&&!Buffer.isBuffer(e)){if(ZH(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(JH(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[br]&&this[wr]!==0&&this[mg](!0),this[br]?this.emit("data",e):this[bw](e),this[wr]!==0&&this.emit("readable"),r&&i(r),this[br]):e.length?(typeof e=="string"&&!(t===this[Mi]&&!this[kl]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Mi]&&(e=this[kl].write(e)),this[br]&&this[wr]!==0&&this[mg](!0),this[br]?this.emit("data",e):this[bw](e),this[wr]!==0&&this.emit("readable"),r&&i(r),this[br]):(this[wr]!==0&&this.emit("readable"),r&&i(r),this[br])}read(e){if(this[Ht])return null;if(this[kn]=!1,this[wr]===0||e===0||e&&e>this[wr])return this[na](),null;this[Yr]&&(e=null),this[vr].length>1&&!this[Yr]&&(this[vr]=[this[Mi]?this[vr].join(""):Buffer.concat(this[vr],this[wr])]);let t=this[xP](e||null,this[vr][0]);return this[na](),t}[xP](e,t){if(this[Yr])this[gg]();else{let r=t;e===r.length||e===null?this[gg]():typeof r=="string"?(this[vr][0]=r.slice(e),t=r.slice(0,e),this[wr]-=e):(this[vr][0]=r.subarray(e),t=r.subarray(0,e),this[wr]-=e)}return this.emit("data",t),!this[vr].length&&!this[ra]&&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[ra]=!0,this.writable=!1,(this[br]||!this[Uf])&&this[na](),this}[Ml](){this[Ht]||(!this[zo]&&!this[pn].length&&(this[kn]=!0),this[Uf]=!1,this[br]=!0,this.emit("resume"),this[vr].length?this[mg]():this[ra]?this[na]():this.emit("drain"))}resume(){return this[Ml]()}pause(){this[br]=!1,this[Uf]=!0,this[kn]=!1}get destroyed(){return this[Ht]}get flowing(){return this[br]}get paused(){return this[Uf]}[bw](e){this[Yr]?this[wr]+=1:this[wr]+=e.length,this[vr].push(e)}[gg](){return this[Yr]?this[wr]-=1:this[wr]-=this[vr][0].length,this[vr].shift()}[mg](e=!1){do;while(this[CP](this[gg]())&&this[vr].length);!e&&!this[vr].length&&!this[ra]&&this.emit("drain")}[CP](e){return this.emit("data",e),this[br]}pipe(e,t){if(this[Ht])return e;this[kn]=!1;let r=this[Va];return t=t||{},e===AP.stdout||e===AP.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[pn].push(t.proxyErrors?new Aw(this,e,t):new _g(this,e,t)),this[ms]?Wf(()=>this[Ml]()):this[Ml]()),e}unpipe(e){let t=this[pn].find(r=>r.dest===e);t&&(this[pn].length===1?(this[br]&&this[zo]===0&&(this[br]=!1),this[pn]=[]):this[pn].splice(this[pn].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[kn]=!1,this[zo]++,!this[pn].length&&!this[br]&&this[Ml]();else if(e==="readable"&&this[wr]!==0)super.emit("readable");else if(XH(e)&&this[Va])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Vf]){let i=t;this[ms]?Wf(()=>i.call(this,this[Vf])):i.call(this,this[Vf])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[zo]=this.listeners("data").length,this[zo]===0&&!this[kn]&&!this[pn].length&&(this[br]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[zo]=0,!this[kn]&&!this[pn].length&&(this[br]=!1)),t}get emittedEnd(){return this[Va]}[na](){!this[hg]&&!this[Va]&&!this[Ht]&&this[vr].length===0&&this[ra]&&(this[hg]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[pg]&&this.emit("close"),this[hg]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Ht&&this[Ht])return!1;if(e==="data")return!this[Yr]&&!r?!1:this[ms]?(Wf(()=>this[ww](r)),!0):this[ww](r);if(e==="end")return this[IP]();if(e==="close"){if(this[pg]=!0,!this[Va]&&!this[Ht])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Vf]=r,super.emit(vw,r);let s=!this[qf]||this.listeners("error").length?super.emit("error",r):!1;return this[na](),s}else if(e==="resume"){let s=super.emit("resume");return this[na](),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[na](),i}[ww](e){for(let r of this[pn])r.dest.write(e)===!1&&this.pause();let t=this[kn]?!1:super.emit("data",e);return this[na](),t}[IP](){return this[Va]?!1:(this[Va]=!0,this.readable=!1,this[ms]?(Wf(()=>this[Ew]()),!0):this[Ew]())}[Ew](){if(this[kl]){let t=this[kl].end();if(t){for(let r of this[pn])r.dest.write(t);this[kn]||super.emit("data",t)}}for(let t of this[pn])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[Mi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Ht,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[kn]=!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[ra])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(Ht,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(Ht,f),this.pause(),s({value:d,done:!!this[ra]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Ht,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(Ht,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[kn]=!1;let e=!1,t=o(()=>(this.pause(),this.off(vw,t),this.off(Ht,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(vw,t),this.once(Ht,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Ht])return e?this.emit("error",e):this.emit(Ht),this;this[Ht]=!0,this[kn]=!0,this[vr].length=0,this[wr]=0;let t=this;return typeof t.close=="function"&&!this[pg]&&t.close(),e?this.emit("error",e):this.emit(Ht),this}static get isStream(){return HH}};var nQ=ys.realpathSync.native,zf={lstatSync:ys.lstatSync,readdir:ys.readdir,readdirSync:ys.readdirSync,readlinkSync:ys.readlinkSync,realpathSync:nQ,promises:{lstat:qa.lstat,readdir:qa.readdir,readlink:qa.readlink,realpath:qa.realpath}},LP=o(n=>!n||n===zf||n===rQ?zf:{...zf,...n,promises:{...zf.promises,...n.promises||{}}},"fsFromOption"),kP=/^\\\\\?\\([a-z]:)\\?$/i,iQ=o(n=>n.replace(/\//g,"\\").replace(kP,"$1\\"),"uncToDrive"),sQ=/[\\\/]/,ei=0,MP=1,jP=2,gs=4,$P=6,BP=8,Ho=10,VP=12,Zn=15,Gf=~Zn,Cw=16,OP=32,Hf=64,ji=128,bg=256,wg=512,PP=Hf|ji|wg,aQ=1023,Iw=o(n=>n.isFile()?BP:n.isDirectory()?gs:n.isSymbolicLink()?Ho:n.isCharacterDevice()?jP:n.isBlockDevice()?$P:n.isSocket()?VP:n.isFIFO()?MP:ei,"entToType"),FP=new Map,Qf=o(n=>{let e=FP.get(n);if(e)return e;let t=n.normalize("NFKD");return FP.set(n,t),t},"normalize"),DP=new Map,vg=o(n=>{let e=DP.get(n);if(e)return e;let t=Qf(n.toLowerCase());return DP.set(n,t),t},"normalizeNocase"),Eg=class extends Bf{static{o(this,"ResolveCache")}constructor(){super({max:256})}},Rw=class extends Bf{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},UP=Symbol("PathScurry setAsCwd"),Kr=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}#S;#w;#b;#v;#x;#C;#o;#F;#A;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=ei,r,i,s,a,c){this.name=e,this.#S=s?vg(e):Qf(e),this.#o=t&aQ,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#b=c.fullpath,this.#x=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=LP(c.fs)}depth(){return this.#w!==void 0?this.#w:this.parent?this.#w=this.parent.depth()+1:this.#w=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&=~Cw,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?vg(e):Qf(e);for(let l of r)if(l.#S===i)return l;let s=this.parent?this.sep:"",a=this.#b?this.#b+s+e:void 0,c=this.newChild(e,ei,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=ji),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.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#b!==void 0)return this.#b;let e=this.name,t=this.parent;if(!t)return this.#b=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#b=i}fullpathPosix(){if(this.#v!==void 0)return this.#v;if(this.sep==="/")return this.#v=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#v=`//?/${i}`:this.#v=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#v=r}isUnknown(){return(this.#o&Zn)===ei}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&Zn)===BP}isDirectory(){return(this.#o&Zn)===gs}isCharacterDevice(){return(this.#o&Zn)===jP}isBlockDevice(){return(this.#o&Zn)===$P}isFIFO(){return(this.#o&Zn)===MP}isSocket(){return(this.#o&Zn)===VP}isSymbolicLink(){return(this.#o&Ho)===Ho}lstatCached(){return this.#o&OP?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&Zn;return!(e!==ei&&e!==Ho||this.#o&bg||this.#o&ji)}calledReaddir(){return!!(this.#o&Cw)}isENOENT(){return!!(this.#o&ji)}isNamed(e){return this.nocase?this.#S===vg(e):this.#S===Qf(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|=Cw;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&ji||(this.#o=(this.#o|ji)&Gf,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#R(){this.#o|=wg,this.#k()}#k(){if(this.#o&Hf)return;let e=this.#o;(e&Zn)===gs&&(e&=Gf),this.#o=e|Hf,this.#I()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#L():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#L()}#h(e=""){let t=this.#o;t|=bg,e==="ENOENT"&&(t|=ji),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Gf),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#P(e,t)||this.#B(e,t)}#B(e,t){let r=Iw(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&Zn;return s!==gs&&s!==Ho&&s!==ei&&(i.#o|=Hf),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?vg(e.name):Qf(e.name))===i.#S)return this.#V(e,i,r,t)}}#V(e,t,r,i){let s=t.name;return t.#o=t.#o&Gf|Iw(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&ji)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&ji)===0)try{return this.#G(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#j(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:_,mtimeMs:b,nlink:E,rdev:v,size:A,uid:R}=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=_,this.#g=b,this.#t=E,this.#i=v,this.#l=A,this.#c=R;let B=Iw(e);this.#o=this.#o&Gf|B|OP,B!==ei&&B!==gs&&B!==Ho&&(this.#o|=Hf)}#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.#M(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.#M(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.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&PP)return!1;let e=Zn&this.#o;return e===ei||e===gs||e===Ho}shouldWalk(e,t){return(this.#o&gs)===gs&&!(this.#o&PP)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((wg|bg|ji)&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(!((wg|bg|ji)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}[UP](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.#C=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#x=void 0,i.#C=void 0,i=i.parent}},Tg=class n extends Kr{static{o(this,"PathWin32")}sep="\\";splitSep=sQ;constructor(e,t=ei,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=ei,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return jl.win32.parse(e).root}getRoot(e){if(e=iQ(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 $l(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(kP,"$1\\"),e===t}},Ag=class n extends Kr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=ei,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=ei,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},xg=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=zf}={}){this.#t=LP(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,NP.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new Eg,this.#n=new Eg,this.#r=new Rw(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 _ of l){let b=f--;u=u.child(_,{relative:new Array(b).fill("..").join(d),relativePosix:new Array(b).fill("..").join("/"),fullpath:h+=(p?"":d)+_}),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 Kr||(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 Kr||(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 Kr||(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 Kr||(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 Kr||(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 Kr||(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 Kr||(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,_)=>{if(p)return h(p);let b=_.length;if(!b)return h();let E=o(()=>{--b===0&&h()},"next");for(let v of _)(!s||s(v))&&c.push(r?v:v.fullpath()),i&&v.isSymbolicLink()?v.realpath().then(A=>A?.isUnknown()?A.lstat():A).then(A=>A?.shouldWalk(l,a)?u(A,E):E()):v.shouldWalk(l,a)?u(v,E):E()},!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 Kr||(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 Kr||(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 Kr||(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 Kr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ua({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 _=o((E,v,A=!1)=>{if(E)return c.emit("error",E);if(i&&!A){let R=[];for(let B of v)B.isSymbolicLink()&&R.push(B.realpath().then(W=>W?.isUnknown()?W.lstat():W));if(R.length){Promise.all(R).then(()=>_(null,v,!0));return}}for(let R of v)R&&(!s||s(R))&&(c.write(r?R:R.fullpath())||(h=!0));f--;for(let R of v){let B=R.realpathCached()||R;B.shouldWalk(l,a)&&u.push(B)}h&&!c.flowing?c.once("drain",d):b||d()},"onReaddir"),b=!0;p.readdirCB(_,!0),b=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ua({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 _=p.readdirSync();for(let b of _)(!s||s(b))&&(c.write(r?b:b.fullpath())||(h=!0));f--;for(let b of _){let E=b;if(b.isSymbolicLink()){if(!(i&&(E=b.realpathSync())))continue;E.isUnknown()&&E.lstatSync()}E.shouldWalk(l,a)&&u.push(E)}}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[UP](t)}},$l=class extends xg{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,jl.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return jl.win32.parse(e).root.toUpperCase()}newRoot(e){return new Tg(this.rootPath,gs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Bl=class extends xg{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,jl.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new Ag(this.rootPath,gs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Yf=class extends Bl{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},Tde=process.platform==="win32"?Tg:Ag,qP=process.platform==="win32"?$l:process.platform==="darwin"?Yf:Bl;var oQ=o(n=>n.length>=1,"isPatternList"),cQ=o(n=>n.length>=1,"isGlobList"),Vl=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!oQ(e))throw new TypeError("empty pattern list");if(!cQ(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,..._]=this.#n;u[0]===""&&(u.shift(),_.shift());let b=[s,a,c,l,""].join("/"),E=[f,d,h,p,""].join("/");this.#e=[b,...u],this.#n=[E,..._],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]===zt}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 lQ=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ul=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=lQ}){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 Ln(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 Vl(i,s,0,this.platform),c=new Ln(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 Ow=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()]))}},Pw=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)])}},Fw=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())}},Kf=class n{static{o(this,"Processor")}hasWalkedCache;matches=new Pw;subwalks=new Fw;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new Ow}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===zt){(!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===zt?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 uQ=o((n,e)=>typeof n=="string"?new Ul([n],e):Array.isArray(n)?new Ul(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=uQ(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 Kf(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 Kf(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()}},Xf=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}},Jf=class extends Cg{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Ua({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 fQ=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",$i=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,WP.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||fQ,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"?$l:t.platform==="darwin"?Yf:t.platform?Bl:qP;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 Ln(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 Vl(l,f,0,this.platform)})}async walk(){return[...await new Xf(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 Xf(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 Jf(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 Jf(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 Dw=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Ln(t,e).hasMagic())return!0;return!1},"hasMagic");function Rg(n,e={}){return new $i(n,e).streamSync()}o(Rg,"globStreamSync");function zP(n,e={}){return new $i(n,e).stream()}o(zP,"globStream");function HP(n,e={}){return new $i(n,e).walkSync()}o(HP,"globSync");async function GP(n,e={}){return new $i(n,e).walk()}o(GP,"glob_");function Og(n,e={}){return new $i(n,e).iterateSync()}o(Og,"globIterateSync");function QP(n,e={}){return new $i(n,e).iterate()}o(QP,"globIterate");var dQ=Rg,hQ=Object.assign(zP,{sync:Rg}),pQ=Og,mQ=Object.assign(QP,{sync:Og}),gQ=Object.assign(HP,{stream:Rg,iterate:Og}),Ig=Object.assign(GP,{glob:GP,globSync:HP,sync:gQ,globStream:zP,stream:hQ,globStreamSync:Rg,streamSync:dQ,globIterate:QP,iterate:mQ,globIterateSync:Og,iterateSync:pQ,Glob:$i,hasMagic:Dw,escape:Dl,unescape:ki});Ig.glob=Ig;var Qo=K(Wt());var It=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await ur.default.pathExists(t))throw new Qo.FileNotFoundError(e);return ur.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return ur.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 ur.default.pathExists(r))throw new Qo.FileAlreadyExistsError(e);return await ur.default.ensureDir(Wa.default.dirname(r)),await ur.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await ur.default.pathExists(r))throw new Qo.FileNotFoundError(e);await ur.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await ur.default.ensureDir(Wa.default.dirname(r)),await ur.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await ur.default.pathExists(t))throw new Qo.FileNotFoundError(e);await ur.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await ur.default.pathExists(r))throw new Qo.FileNotFoundError(e);await ur.default.ensureDir(Wa.default.dirname(i)),await ur.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await ur.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await ur.default.pathExists(t)?(await ur.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=Wa.default.join(t,"**/*.md");return(await Ig(r,{nodir:!0})).map(a=>Wa.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 Wa.default.isAbsolute(e)?e:Wa.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=Nr.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 Zf=K(require("path")),Nw=K(Ma());var ql=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!Zf.default.isAbsolute(e))return Zf.default.resolve(this.vaultRoot,e);let t=Zf.default.resolve(e),r=Zf.default.resolve(this.vaultRoot);if(!t.startsWith(r))throw new Qe(`File path ${e} is outside vault root ${this.vaultRoot}`,"Provide a file path within the vault directory.",{filepath:e,vaultRoot:this.vaultRoot});return t}validate(e){if(!Nw.default.existsSync(e))throw new wf(e);if(!Nw.default.statSync(e).isFile())throw new Qe(`Not a file: ${e}`,"Provide a path to a file, not a directory.",{filepath:e});if(!e.endsWith(".md"))throw new Qe(`Not a Markdown file: ${e}`,"Provide a path to a .md file.",{filepath:e})}getVaultRoot(){return this.vaultRoot}};var eF=K(Wt());var YP=K(Wt());var Bi=class{static{o(this,"BaseCommandExecutor")}constructor(e){this.pathResolver=e.pathResolver,this.fsAdapter=e.fsAdapter,this.frontmatterService=e.frontmatterService,this.dryRun=e.dryRun}resolveAndValidate(e){let t=this.pathResolver.resolve(e);this.pathResolver.validate(t);let r=t.replace(this.pathResolver.getVaultRoot()+"/","");return{resolvedPath:t,relativePath:r}}getCurrentTimestamp(){return YP.DateFormatter.toLocalTimestamp(new Date)}isAssetArchived(e){if(e?.exo__Asset_isArchived===!0)return!0;let t=e?.archived;if(t==null)return!1;if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){let r=t.toLowerCase().trim();return r==="true"||r==="yes"||r==="1"}return!1}extractAliasesFromFrontmatter(e){let t=e.match(/aliases:\s*\n((?: - .*\n?)*)/);return t?t[1].split(`
|
|
616
|
-
`).filter(i=>i.trim()).map(i=>i.replace(/^\s*-\s*/,"").trim()):[]}};var ed=class extends Bi{static{o(this,"StatusCommandExecutor")}constructor(e){super(e)}async executeStart(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_startTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Started: ${e}`),console.log(" Status: Doing"),console.log(` Start time: ${i}`),process.exit(0)}catch(t){D.handle(t)}}async executeComplete(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_endTimestamp",i),s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Completed: ${e}`),console.log(" Status: Done"),console.log(` Completion time: ${i}`),process.exit(0)}catch(t){D.handle(t)}}async executeTrash(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Trashed: ${e}`),console.log(" Status: Trashed"),console.log(` Resolution time: ${i}`),process.exit(0)}catch(t){D.handle(t)}}async executeArchive(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.frontmatterService.updateProperty(r,"archived","true");i=this.frontmatterService.removeProperty(i,"aliases"),await this.fsAdapter.updateFile(t,i),console.log(`\u2705 Archived: ${e}`),console.log(" Archived: true"),console.log(" Aliases removed"),process.exit(0)}catch(t){D.handle(t)}}async executeMoveToBacklog(e){try{await this.updateStatus(e,"ems__EffortStatusBacklog","Backlog"),process.exit(0)}catch(t){D.handle(t)}}async executeMoveToAnalysis(e){try{await this.updateStatus(e,"ems__EffortStatusAnalysis","Analysis"),process.exit(0)}catch(t){D.handle(t)}}async executeMoveToToDo(e){try{await this.updateStatus(e,"ems__EffortStatusToDo","ToDo"),process.exit(0)}catch(t){D.handle(t)}}async updateStatus(e,t,r){let{relativePath:i}=this.resolveAndValidate(e),s=await this.fsAdapter.readFile(i),a=this.frontmatterService.updateProperty(s,"ems__Effort_status",`"[[${t}]]"`);await this.fsAdapter.updateFile(i,a),console.log(`\u2705 Moved to ${r}: ${e}`),console.log(` Status: ${r}`)}};var kr=[];for(let n=0;n<256;++n)kr.push((n+256).toString(16).slice(1));function KP(n,e=0){return(kr[n[e+0]]+kr[n[e+1]]+kr[n[e+2]]+kr[n[e+3]]+"-"+kr[n[e+4]]+kr[n[e+5]]+"-"+kr[n[e+6]]+kr[n[e+7]]+"-"+kr[n[e+8]]+kr[n[e+9]]+"-"+kr[n[e+10]]+kr[n[e+11]]+kr[n[e+12]]+kr[n[e+13]]+kr[n[e+14]]+kr[n[e+15]]).toLowerCase()}o(KP,"unsafeStringify");var XP=require("node:crypto");var Fg=new Uint8Array(256),Pg=Fg.length;function Lw(){return Pg>Fg.length-16&&((0,XP.randomFillSync)(Fg),Pg=0),Fg.slice(Pg,Pg+=16)}o(Lw,"rng");var JP=require("node:crypto"),kw={randomUUID:JP.randomUUID};function _Q(n,e,t){n=n||{};let r=n.random??n.rng?.()??Lw();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 KP(r)}o(_Q,"_v4");function SQ(n,e,t){return kw.randomUUID&&!e&&!n?kw.randomUUID():_Q(n,e,t)}o(SQ,"v4");var td=SQ;var Wl=K(
|
|
615
|
+
\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: ${Zz(u.sizeBytes)}`))}}}catch(t){D.handle(t)}})}o(HO,"sparqlIndexCommand");function Zz(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o(Zz,"formatBytes");function QO(){return new Ie("templates").description("List available SPARQL query templates").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";D.setFormat(e);try{let t=new Ol,r=t.listTemplates();if(e==="json"){let i=Z.success({templates:r,count:r.length});console.log(JSON.stringify(i,null,2))}else console.log(t.formatList("text"))}catch(t){D.handle(t)}})}o(QO,"sparqlTemplatesCommand");var tF=require("path");var ur=K(Ma()),Wa=K(require("path"));var gP=K(oP(),1);var jf=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var oH={"[: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]},$f=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),cH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),cP=o(n=>n.join(""),"rangesToString"),lP=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 b=n.charAt(s);if((b==="!"||b==="^")&&s===t+1){u=!0,s++;continue}if(b==="]"&&a&&!l){f=s+1;break}if(a=!0,b==="\\"&&!l){l=!0,s++;continue}if(b==="["&&!l){for(let[E,[v,A,R]]of Object.entries(oH))if(n.startsWith(E,s)){if(d)return["$.",!1,n.length-t,!0];s+=E.length,R?i.push(v):r.push(v),c=c||A;continue e}}if(l=!1,d){b>d?r.push($f(d)+"-"+$f(b)):b===d&&r.push($f(b)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push($f(b+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=b,s+=2;continue}r.push($f(b)),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 b=r[0].length===2?r[0].slice(-1):r[0];return[cH(b),!1,f-t,!1]}let h="["+(u?"^":"")+cP(r)+"]",p="["+(u?"":"^")+cP(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var ki=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Cn,lH=new Set(["!","?","+","*","@"]),gw=o(n=>lH.has(n),"isExtglobType"),uP=o(n=>gw(n.type),"isExtglobAST"),uH=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),fH=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),dH=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),fP=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),hH="(?!(?:^|/)\\.\\.?(?:$|/))",fg="(?!\\.)",pH=new Set(["[","."]),mH=new Set(["..","."]),gH=new Set("().*{}+?[]^$\\!"),yH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),yw="[^/]",dP=yw+"*?",hP=yw+"+?",Go=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 Cn&&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 Cn&&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 Cn(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 b=r,E="";for(;b<e.length;){let v=e.charAt(b++);if(c||v==="\\"){c=!c,E+=v;continue}if(l){b===u+1?(v==="^"||v==="!")&&(f=!0):v==="]"&&!(b===u+2&&f)&&(l=!1),E+=v;continue}else if(v==="["){l=!0,u=b,f=!1,E+=v;continue}if(!i.noext&&gw(v)&&e.charAt(b)==="("&&s<=a){t.push(E),E="";let R=new Cn(v,t);b=Cn.#g(e,R,b,i,s+1),t.push(R);continue}E+=v}return t.push(E),b}let d=r+1,h=new Cn(null,t),p=[],_="";for(;d<e.length;){let b=e.charAt(d++);if(c||b==="\\"){c=!c,_+=b;continue}if(l){d===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(d===u+2&&f)&&(l=!1),_+=b;continue}else if(b==="["){l=!0,u=d,f=!1,_+=b;continue}if(gw(b)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(b))){let v=t&&t.#y(b)?0:1;h.push(_),_="";let A=new Cn(b,h);h.push(A),d=Cn.#g(e,A,d,i,s+v);continue}if(b==="|"){h.push(_),_="",p.push(h),h=new Cn(null,t);continue}if(b===")")return _===""&&t.#t.length===0&&(t.#a=!0),h.push(_),_="",t.push(...p,h),d;_+=b}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,fH)}#m(e,t=uH){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=dH){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Cn(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!!fP.get(this.type)?.has(e)}#S(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)}#w(e){let t=fP.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}#b(){if(uP(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.#b(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#S(i)&&(t=!1,this.#w(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#b();this.#l=void 0}static fromGlob(e,t={}){let r=new Cn(null,void 0,t);return Cn.#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.#b(),this.#p()),!uP(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[_,b,E,v]=typeof p=="string"?Cn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||E,this.#r=this.#r||v,_}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&mH.has(this.#t[0]))){let _=pH,b=t&&_.has(u.charAt(0))||u.startsWith("\\.")&&_.has(u.charAt(2))||u.startsWith("\\.\\.")&&_.has(u.charAt(4)),E=!t&&!e&&_.has(u.charAt(0));f=b?hH:E?fg:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,ki(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(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,ki(this.toString()),!1,!1]}let a=!r||e||t||!fg?"":this.#v(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?fg:"")+hP;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?fg:"")+dP+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,ki(s),this.#n=!!this.#n,this.#r]}#v(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+=(gH.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=lP(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)?hP:dP,t=!0;continue}else c=!1;if(u==="?"){s+=yw,t=!0;continue}s+=yH(u)}return[s,ki(e),!!t,a]}};Cn=Go;var Dl=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Lr=o((n,e,t={})=>(jf(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Ln(e,t).match(n)),"minimatch"),_H=/^\*+([^+@!?\*\[\(]*)$/,SH=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),bH=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),vH=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),wH=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),EH=/^\*+\.\*+$/,TH=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),AH=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),xH=/^\.\*+$/,CH=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),IH=/^\*+$/,RH=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),OH=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),PH=/^\?+([^+@!?\*\[\(]*)?$/,FH=o(([n,e=""])=>{let t=yP([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),DH=o(([n,e=""])=>{let t=_P([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),NH=o(([n,e=""])=>{let t=_P([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),LH=o(([n,e=""])=>{let t=yP([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),yP=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),_P=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),SP=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",pP={win32:{sep:"\\"},posix:{sep:"/"}},kH=SP==="win32"?pP.win32.sep:pP.posix.sep;Lr.sep=kH;var Ht=Symbol("globstar **");Lr.GLOBSTAR=Ht;var MH="[^/]",jH=MH+"*?",$H="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",BH="(?:(?!(?:\\/|^)\\.).)*?",VH=o((n,e={})=>t=>Lr(t,n,e),"filter");Lr.filter=VH;var Jn=o((n,e={})=>Object.assign({},n,e),"ext"),UH=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Lr;let e=Lr;return Object.assign(o((r,i,s={})=>e(r,i,Jn(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,Jn(n,s))}static defaults(i){return e.defaults(Jn(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,Jn(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Jn(n,s))}},unescape:o((r,i={})=>e.unescape(r,Jn(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,Jn(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,Jn(n,i)),"filter"),defaults:o(r=>e.defaults(Jn(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,Jn(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,Jn(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,Jn(n,s)),"match"),sep:e.sep,GLOBSTAR:Ht})},"defaults");Lr.defaults=UH;var bP=o((n,e={})=>(jf(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,gP.default)(n)),"braceExpand");Lr.braceExpand=bP;var qH=o((n,e={})=>new Ln(n,e).makeRe(),"makeRe");Lr.makeRe=qH;var WH=o((n,e,t={})=>{let r=new Ln(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Lr.match=WH;var mP=/[?*]|[+@!]\(.*?\)|\[|\]/,GH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Ln=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={}){jf(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||SP,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]==="?"||!mP.test(s[2]))&&!mP.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,_]=[e[d],t[h]];p.toLowerCase()===_.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Ht)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Ht,s),c=t.lastIndexOf(Ht),[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 A=e.slice(i,i+l.length);if(!this.#r(A,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let A=e.length-f.length;if(this.#r(e,f,r,A,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(A--,!this.#r(e,f,r,A,0)))return!1;d=f.length+1}}if(!u.length){let A=!!d;for(let R=i;R<e.length-d;R++){let B=String(e[R]);if(A=!0,B==="."||B===".."||!this.options.dot&&B.startsWith("."))return!1}return r||A}let h=[[[],0]],p=h[0],_=0,b=[0];for(let A of u)A===Ht?(b.push(_),p=[[],0],h.push(p)):(p[0].push(A),_++);let E=h.length-1,v=e.length-d;for(let A of h)A[1]=v-(b[E--]+A[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===Ht)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 bP(this.pattern,this.options)}parse(e){jf(e);let t=this.options;if(e==="**")return Ht;if(e==="")return"";let r,i=null;(r=e.match(IH))?i=t.dot?OH:RH:(r=e.match(_H))?i=(t.nocase?t.dot?wH:vH:t.dot?bH:SH)(r[1]):(r=e.match(PH))?i=(t.nocase?t.dot?DH:FH:t.dot?NH:LH)(r):(r=e.match(EH))?i=t.dot?AH:TH:(r=e.match(xH))&&(i=CH);let s=Go.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?jH:t.dot?$H:BH,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"?GH(f):f===Ht?Ht:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==Ht||p===Ht||(p===void 0?h!==void 0&&h!==Ht?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==Ht&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=Ht))}),u.filter(f=>f!==Ht).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 Lr.defaults(e).Minimatch}};Lr.AST=Go;Lr.Minimatch=Ln;Lr.escape=Dl;Lr.unescape=ki;var WP=require("node:url");var Nl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,wP=new Set,_w=typeof process=="object"&&process?process:{},EP=o((n,e,t,r)=>{typeof _w.emitWarning=="function"?_w.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),dg=globalThis.AbortController,vP=globalThis.AbortSignal;if(typeof dg>"u"){vP=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},dg=class{static{o(this,"AbortController")}constructor(){e()}signal=new vP;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=_w.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,EP("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 zH=o(n=>!wP.has(n),"shouldWarn");var Ba=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),TP=o(n=>Ba(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ll:null:null,"getUintArray"),Ll=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},Sw=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=TP(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]}},Bf=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;#S;#w;#b;#v;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#S,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.#j(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#B(t),"moveToTail"),indexes:o(t=>e.#I(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:_=0,sizeCalculation:b,fetchMethod:E,memoMethod:v,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:B,allowStaleOnFetchAbort:W,ignoreFetchAbort:ve}=e;if(t!==0&&!Ba(t))throw new TypeError("max option must be a nonnegative integer");let z=t?TP(t):Array;if(!z)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=_||this.#n,this.sizeCalculation=b,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(v!==void 0&&typeof v!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#_=v,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=E,this.#b=!!E,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new z(t),this.#g=new z(t),this.#d=0,this.#m=0,this.#y=Sw.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.#w=!!this.#r,this.#v=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!B,this.allowStaleOnFetchAbort=!!W,this.ignoreFetchAbort=!!ve,this.maxEntrySize!==0){if(this.#n!==0&&!Ba(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ba(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Ba(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ba(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";zH(G)&&(wP.add(G),EP("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 Ll(this.#e),t=new Ll(this.#e);this.#S=e,this.#T=t,this.#F=(s,a,c=Nl.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.#C=s=>{t[s]=e[s]!==0?Nl.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=Nl.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}}#C=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#A=o(()=>!1,"#isStale");#O(){let e=new Ll(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(!Ba(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Ba(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.#M(!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");*#I({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.#I())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.#I()){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.#I())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.#I()){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.#I()){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.#S&&this.#T){let a=this.#S[t],c=this.#T[t];if(a&&c){let l=a-(Nl.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.#I({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.#S&&this.#T){a.ttl=this.#S[t];let c=Nl.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=Nl.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.#M(!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.#B(d);let h=this.#a[d];if(t!==h){if(this.#b&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!a&&(this.#w&&this.#r?.(p,e,"set"),this.#v&&this.#f?.push([p,e,"set"]))}else a||(this.#w&&this.#r?.(h,e,"set"),this.#v&&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.#S&&this.#x(),this.#S&&(u||this.#F(d,i,s),l&&this.#o(l,d)),!a&&this.#v&&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.#M(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#v&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#d,r=this.#l[t],i=this.#a[t];return this.#b&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#w||this.#v)&&(this.#w&&this.#r?.(i,r,"evict"),this.#v&&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.#C(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}#j(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#h(s))return s;let a=new dg,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((b,E=!1)=>{let{aborted:v}=a.signal,A=r.ignoreFetchAbort&&b!==void 0;if(r.status&&(v&&!E?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,A&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),v&&!A&&!E)return d(a.signal.reason);let R=p;return this.#a[t]===p&&(b===void 0?R.__staleWhileFetching?this.#a[t]=R.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,b,l.options))),b},"cb"),f=o(b=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=b),d(b)),"eb"),d=o(b=>{let{aborted:E}=a.signal,v=E&&r.allowStaleOnFetchAbort,A=v||r.allowStaleOnFetchRejection,R=A||r.noDeleteOnFetchRejection,B=p;if(this.#a[t]===p&&(!R||B.__staleWhileFetching===void 0?this.#P(e,"fetch"):v||(this.#a[t]=B.__staleWhileFetching)),A)return r.status&&B.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),B.__staleWhileFetching;if(B.__returned===B)throw b},"fetchFail"),h=o((b,E)=>{let v=this.#c?.(e,s,l);v&&v instanceof Promise&&v.then(A=>b(A===void 0?void 0:A),E),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=o(A=>u(A,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),_=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,_,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=_,_}#h(e){if(!this.#b)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof dg}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:_=this.allowStaleOnFetchAbort,context:b,forceRefresh:E=!1,status:v,signal:A}=t;if(!this.#b)return v&&(v.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:v});let R={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:_,ignoreFetchAbort:p,status:v,signal:A},B=this.#s.get(e);if(B===void 0){v&&(v.fetch="miss");let W=this.#j(e,B,R,b);return W.__returned=W}else{let W=this.#a[B];if(this.#h(W)){let j=r&&W.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",j&&(v.returnedStale=!0)),j?W.__staleWhileFetching:W.__returned=W}let ve=this.#A(B);if(!E&&!ve)return v&&(v.fetch="hit"),this.#B(B),i&&this.#C(B),v&&this.#o(v,B),W;let z=this.#j(e,B,R,b),F=z.__staleWhileFetching!==void 0&&r;return v&&(v.fetch=ve?"stale":"refresh",F&&ve&&(v.returnedStale=!0)),F?z.__staleWhileFetching:z.__returned=z}}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.#B(c),i&&this.#C(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#B(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.#V(t);else{this.#D(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#v)&&(this.#w&&this.#r?.(s,e,t),this.#v&&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.#v&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#V("delete")}#V(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.#w&&this.#r?.(r,i,e),this.#v&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#S&&this.#T&&(this.#S.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.#v&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var jl=require("node:path"),NP=require("node:url"),ys=require("fs"),rQ=K(require("node:fs"),1),qa=require("node:fs/promises");var Sg=require("node:events"),xw=K(require("node:stream"),1),RP=require("node:string_decoder");var AP=typeof process=="object"&&process?process:{stdout:null,stderr:null},HH=o(n=>!!n&&typeof n=="object"&&(n instanceof Ua||n instanceof xw.default||QH(n)||YH(n)),"isStream"),QH=o(n=>!!n&&typeof n=="object"&&n instanceof Sg.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==xw.default.Writable.prototype.pipe,"isReadable"),YH=o(n=>!!n&&typeof n=="object"&&n instanceof Sg.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),ra=Symbol("EOF"),na=Symbol("maybeEmitEnd"),Va=Symbol("emittedEnd"),hg=Symbol("emittingEnd"),Vf=Symbol("emittedError"),pg=Symbol("closed"),xP=Symbol("read"),mg=Symbol("flush"),CP=Symbol("flushChunk"),Mi=Symbol("encoding"),kl=Symbol("decoder"),br=Symbol("flowing"),Uf=Symbol("paused"),Ml=Symbol("resume"),vr=Symbol("buffer"),pn=Symbol("pipes"),wr=Symbol("bufferLength"),bw=Symbol("bufferPush"),gg=Symbol("bufferShift"),Yr=Symbol("objectMode"),Qt=Symbol("destroyed"),vw=Symbol("error"),ww=Symbol("emitData"),IP=Symbol("emitEnd"),Ew=Symbol("emitEnd2"),ms=Symbol("async"),Tw=Symbol("abort"),yg=Symbol("aborted"),qf=Symbol("signal"),zo=Symbol("dataListeners"),kn=Symbol("discarded"),Wf=o(n=>Promise.resolve().then(n),"defer"),KH=o(n=>n(),"nodefer"),XH=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),JH=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),ZH=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),_g=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[Ml](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Aw=class extends _g{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)}},eQ=o(n=>!!n.objectMode,"isObjectModeOptions"),tQ=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Ua=class extends Sg.EventEmitter{static{o(this,"Minipass")}[br]=!1;[Uf]=!1;[pn]=[];[vr]=[];[Yr];[Mi];[ms];[kl];[ra]=!1;[Va]=!1;[hg]=!1;[pg]=!1;[Vf]=null;[wr]=0;[Qt]=!1;[qf];[yg]=!1;[zo]=0;[kn]=!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");eQ(t)?(this[Yr]=!0,this[Mi]=null):tQ(t)?(this[Mi]=t.encoding,this[Yr]=!1):(this[Yr]=!1,this[Mi]=null),this[ms]=!!t.async,this[kl]=this[Mi]?new RP.StringDecoder(this[Mi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[vr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[pn],"get")});let{signal:r}=t;r&&(this[qf]=r,r.aborted?this[Tw]():r.addEventListener("abort",()=>this[Tw]()))}get bufferLength(){return this[wr]}get encoding(){return this[Mi]}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[ms]}set async(e){this[ms]=this[ms]||!!e}[Tw](){this[yg]=!0,this.emit("abort",this[qf]?.reason),this.destroy(this[qf]?.reason)}get aborted(){return this[yg]}set aborted(e){}write(e,t,r){if(this[yg])return!1;if(this[ra])throw new Error("write after end");if(this[Qt])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[ms]?Wf:KH;if(!this[Yr]&&!Buffer.isBuffer(e)){if(ZH(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(JH(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[br]&&this[wr]!==0&&this[mg](!0),this[br]?this.emit("data",e):this[bw](e),this[wr]!==0&&this.emit("readable"),r&&i(r),this[br]):e.length?(typeof e=="string"&&!(t===this[Mi]&&!this[kl]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Mi]&&(e=this[kl].write(e)),this[br]&&this[wr]!==0&&this[mg](!0),this[br]?this.emit("data",e):this[bw](e),this[wr]!==0&&this.emit("readable"),r&&i(r),this[br]):(this[wr]!==0&&this.emit("readable"),r&&i(r),this[br])}read(e){if(this[Qt])return null;if(this[kn]=!1,this[wr]===0||e===0||e&&e>this[wr])return this[na](),null;this[Yr]&&(e=null),this[vr].length>1&&!this[Yr]&&(this[vr]=[this[Mi]?this[vr].join(""):Buffer.concat(this[vr],this[wr])]);let t=this[xP](e||null,this[vr][0]);return this[na](),t}[xP](e,t){if(this[Yr])this[gg]();else{let r=t;e===r.length||e===null?this[gg]():typeof r=="string"?(this[vr][0]=r.slice(e),t=r.slice(0,e),this[wr]-=e):(this[vr][0]=r.subarray(e),t=r.subarray(0,e),this[wr]-=e)}return this.emit("data",t),!this[vr].length&&!this[ra]&&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[ra]=!0,this.writable=!1,(this[br]||!this[Uf])&&this[na](),this}[Ml](){this[Qt]||(!this[zo]&&!this[pn].length&&(this[kn]=!0),this[Uf]=!1,this[br]=!0,this.emit("resume"),this[vr].length?this[mg]():this[ra]?this[na]():this.emit("drain"))}resume(){return this[Ml]()}pause(){this[br]=!1,this[Uf]=!0,this[kn]=!1}get destroyed(){return this[Qt]}get flowing(){return this[br]}get paused(){return this[Uf]}[bw](e){this[Yr]?this[wr]+=1:this[wr]+=e.length,this[vr].push(e)}[gg](){return this[Yr]?this[wr]-=1:this[wr]-=this[vr][0].length,this[vr].shift()}[mg](e=!1){do;while(this[CP](this[gg]())&&this[vr].length);!e&&!this[vr].length&&!this[ra]&&this.emit("drain")}[CP](e){return this.emit("data",e),this[br]}pipe(e,t){if(this[Qt])return e;this[kn]=!1;let r=this[Va];return t=t||{},e===AP.stdout||e===AP.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[pn].push(t.proxyErrors?new Aw(this,e,t):new _g(this,e,t)),this[ms]?Wf(()=>this[Ml]()):this[Ml]()),e}unpipe(e){let t=this[pn].find(r=>r.dest===e);t&&(this[pn].length===1?(this[br]&&this[zo]===0&&(this[br]=!1),this[pn]=[]):this[pn].splice(this[pn].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[kn]=!1,this[zo]++,!this[pn].length&&!this[br]&&this[Ml]();else if(e==="readable"&&this[wr]!==0)super.emit("readable");else if(XH(e)&&this[Va])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Vf]){let i=t;this[ms]?Wf(()=>i.call(this,this[Vf])):i.call(this,this[Vf])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[zo]=this.listeners("data").length,this[zo]===0&&!this[kn]&&!this[pn].length&&(this[br]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[zo]=0,!this[kn]&&!this[pn].length&&(this[br]=!1)),t}get emittedEnd(){return this[Va]}[na](){!this[hg]&&!this[Va]&&!this[Qt]&&this[vr].length===0&&this[ra]&&(this[hg]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[pg]&&this.emit("close"),this[hg]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Qt&&this[Qt])return!1;if(e==="data")return!this[Yr]&&!r?!1:this[ms]?(Wf(()=>this[ww](r)),!0):this[ww](r);if(e==="end")return this[IP]();if(e==="close"){if(this[pg]=!0,!this[Va]&&!this[Qt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Vf]=r,super.emit(vw,r);let s=!this[qf]||this.listeners("error").length?super.emit("error",r):!1;return this[na](),s}else if(e==="resume"){let s=super.emit("resume");return this[na](),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[na](),i}[ww](e){for(let r of this[pn])r.dest.write(e)===!1&&this.pause();let t=this[kn]?!1:super.emit("data",e);return this[na](),t}[IP](){return this[Va]?!1:(this[Va]=!0,this.readable=!1,this[ms]?(Wf(()=>this[Ew]()),!0):this[Ew]())}[Ew](){if(this[kl]){let t=this[kl].end();if(t){for(let r of this[pn])r.dest.write(t);this[kn]||super.emit("data",t)}}for(let t of this[pn])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[Mi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Qt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[kn]=!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[ra])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(Qt,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(Qt,f),this.pause(),s({value:d,done:!!this[ra]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Qt,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(Qt,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[kn]=!1;let e=!1,t=o(()=>(this.pause(),this.off(vw,t),this.off(Qt,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(vw,t),this.once(Qt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Qt])return e?this.emit("error",e):this.emit(Qt),this;this[Qt]=!0,this[kn]=!0,this[vr].length=0,this[wr]=0;let t=this;return typeof t.close=="function"&&!this[pg]&&t.close(),e?this.emit("error",e):this.emit(Qt),this}static get isStream(){return HH}};var nQ=ys.realpathSync.native,zf={lstatSync:ys.lstatSync,readdir:ys.readdir,readdirSync:ys.readdirSync,readlinkSync:ys.readlinkSync,realpathSync:nQ,promises:{lstat:qa.lstat,readdir:qa.readdir,readlink:qa.readlink,realpath:qa.realpath}},LP=o(n=>!n||n===zf||n===rQ?zf:{...zf,...n,promises:{...zf.promises,...n.promises||{}}},"fsFromOption"),kP=/^\\\\\?\\([a-z]:)\\?$/i,iQ=o(n=>n.replace(/\//g,"\\").replace(kP,"$1\\"),"uncToDrive"),sQ=/[\\\/]/,ei=0,MP=1,jP=2,gs=4,$P=6,BP=8,Ho=10,VP=12,Zn=15,Gf=~Zn,Cw=16,OP=32,Hf=64,ji=128,bg=256,wg=512,PP=Hf|ji|wg,aQ=1023,Iw=o(n=>n.isFile()?BP:n.isDirectory()?gs:n.isSymbolicLink()?Ho:n.isCharacterDevice()?jP:n.isBlockDevice()?$P:n.isSocket()?VP:n.isFIFO()?MP:ei,"entToType"),FP=new Map,Qf=o(n=>{let e=FP.get(n);if(e)return e;let t=n.normalize("NFKD");return FP.set(n,t),t},"normalize"),DP=new Map,vg=o(n=>{let e=DP.get(n);if(e)return e;let t=Qf(n.toLowerCase());return DP.set(n,t),t},"normalizeNocase"),Eg=class extends Bf{static{o(this,"ResolveCache")}constructor(){super({max:256})}},Rw=class extends Bf{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},UP=Symbol("PathScurry setAsCwd"),Kr=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}#S;#w;#b;#v;#x;#C;#o;#F;#A;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=ei,r,i,s,a,c){this.name=e,this.#S=s?vg(e):Qf(e),this.#o=t&aQ,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#b=c.fullpath,this.#x=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=LP(c.fs)}depth(){return this.#w!==void 0?this.#w:this.parent?this.#w=this.parent.depth()+1:this.#w=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&=~Cw,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?vg(e):Qf(e);for(let l of r)if(l.#S===i)return l;let s=this.parent?this.sep:"",a=this.#b?this.#b+s+e:void 0,c=this.newChild(e,ei,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=ji),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.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#b!==void 0)return this.#b;let e=this.name,t=this.parent;if(!t)return this.#b=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#b=i}fullpathPosix(){if(this.#v!==void 0)return this.#v;if(this.sep==="/")return this.#v=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#v=`//?/${i}`:this.#v=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#v=r}isUnknown(){return(this.#o&Zn)===ei}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&Zn)===BP}isDirectory(){return(this.#o&Zn)===gs}isCharacterDevice(){return(this.#o&Zn)===jP}isBlockDevice(){return(this.#o&Zn)===$P}isFIFO(){return(this.#o&Zn)===MP}isSocket(){return(this.#o&Zn)===VP}isSymbolicLink(){return(this.#o&Ho)===Ho}lstatCached(){return this.#o&OP?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&Zn;return!(e!==ei&&e!==Ho||this.#o&bg||this.#o&ji)}calledReaddir(){return!!(this.#o&Cw)}isENOENT(){return!!(this.#o&ji)}isNamed(e){return this.nocase?this.#S===vg(e):this.#S===Qf(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|=Cw;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&ji||(this.#o=(this.#o|ji)&Gf,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#R(){this.#o|=wg,this.#k()}#k(){if(this.#o&Hf)return;let e=this.#o;(e&Zn)===gs&&(e&=Gf),this.#o=e|Hf,this.#I()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#L():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#L()}#h(e=""){let t=this.#o;t|=bg,e==="ENOENT"&&(t|=ji),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Gf),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#P(e,t)||this.#B(e,t)}#B(e,t){let r=Iw(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&Zn;return s!==gs&&s!==Ho&&s!==ei&&(i.#o|=Hf),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?vg(e.name):Qf(e.name))===i.#S)return this.#V(e,i,r,t)}}#V(e,t,r,i){let s=t.name;return t.#o=t.#o&Gf|Iw(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&ji)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&ji)===0)try{return this.#G(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#j(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:_,mtimeMs:b,nlink:E,rdev:v,size:A,uid:R}=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=_,this.#g=b,this.#t=E,this.#i=v,this.#l=A,this.#c=R;let B=Iw(e);this.#o=this.#o&Gf|B|OP,B!==ei&&B!==gs&&B!==Ho&&(this.#o|=Hf)}#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.#M(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.#M(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.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&PP)return!1;let e=Zn&this.#o;return e===ei||e===gs||e===Ho}shouldWalk(e,t){return(this.#o&gs)===gs&&!(this.#o&PP)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((wg|bg|ji)&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(!((wg|bg|ji)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}[UP](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.#C=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#x=void 0,i.#C=void 0,i=i.parent}},Tg=class n extends Kr{static{o(this,"PathWin32")}sep="\\";splitSep=sQ;constructor(e,t=ei,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=ei,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return jl.win32.parse(e).root}getRoot(e){if(e=iQ(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 $l(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(kP,"$1\\"),e===t}},Ag=class n extends Kr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=ei,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=ei,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},xg=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=zf}={}){this.#t=LP(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,NP.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new Eg,this.#n=new Eg,this.#r=new Rw(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 _ of l){let b=f--;u=u.child(_,{relative:new Array(b).fill("..").join(d),relativePosix:new Array(b).fill("..").join("/"),fullpath:h+=(p?"":d)+_}),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 Kr||(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 Kr||(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 Kr||(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 Kr||(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 Kr||(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 Kr||(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 Kr||(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,_)=>{if(p)return h(p);let b=_.length;if(!b)return h();let E=o(()=>{--b===0&&h()},"next");for(let v of _)(!s||s(v))&&c.push(r?v:v.fullpath()),i&&v.isSymbolicLink()?v.realpath().then(A=>A?.isUnknown()?A.lstat():A).then(A=>A?.shouldWalk(l,a)?u(A,E):E()):v.shouldWalk(l,a)?u(v,E):E()},!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 Kr||(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 Kr||(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 Kr||(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 Kr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ua({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 _=o((E,v,A=!1)=>{if(E)return c.emit("error",E);if(i&&!A){let R=[];for(let B of v)B.isSymbolicLink()&&R.push(B.realpath().then(W=>W?.isUnknown()?W.lstat():W));if(R.length){Promise.all(R).then(()=>_(null,v,!0));return}}for(let R of v)R&&(!s||s(R))&&(c.write(r?R:R.fullpath())||(h=!0));f--;for(let R of v){let B=R.realpathCached()||R;B.shouldWalk(l,a)&&u.push(B)}h&&!c.flowing?c.once("drain",d):b||d()},"onReaddir"),b=!0;p.readdirCB(_,!0),b=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ua({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 _=p.readdirSync();for(let b of _)(!s||s(b))&&(c.write(r?b:b.fullpath())||(h=!0));f--;for(let b of _){let E=b;if(b.isSymbolicLink()){if(!(i&&(E=b.realpathSync())))continue;E.isUnknown()&&E.lstatSync()}E.shouldWalk(l,a)&&u.push(E)}}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[UP](t)}},$l=class extends xg{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,jl.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return jl.win32.parse(e).root.toUpperCase()}newRoot(e){return new Tg(this.rootPath,gs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Bl=class extends xg{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,jl.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new Ag(this.rootPath,gs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Yf=class extends Bl{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},Tde=process.platform==="win32"?Tg:Ag,qP=process.platform==="win32"?$l:process.platform==="darwin"?Yf:Bl;var oQ=o(n=>n.length>=1,"isPatternList"),cQ=o(n=>n.length>=1,"isGlobList"),Vl=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!oQ(e))throw new TypeError("empty pattern list");if(!cQ(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,..._]=this.#n;u[0]===""&&(u.shift(),_.shift());let b=[s,a,c,l,""].join("/"),E=[f,d,h,p,""].join("/");this.#e=[b,...u],this.#n=[E,..._],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]===Ht}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 lQ=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ul=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=lQ}){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 Ln(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 Vl(i,s,0,this.platform),c=new Ln(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 Ow=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()]))}},Pw=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)])}},Fw=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())}},Kf=class n{static{o(this,"Processor")}hasWalkedCache;matches=new Pw;subwalks=new Fw;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new Ow}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===Ht){(!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===Ht?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 uQ=o((n,e)=>typeof n=="string"?new Ul([n],e):Array.isArray(n)?new Ul(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=uQ(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 Kf(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 Kf(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()}},Xf=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}},Jf=class extends Cg{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Ua({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 fQ=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",$i=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,WP.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||fQ,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"?$l:t.platform==="darwin"?Yf:t.platform?Bl:qP;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 Ln(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 Vl(l,f,0,this.platform)})}async walk(){return[...await new Xf(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 Xf(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 Jf(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 Jf(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 Dw=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Ln(t,e).hasMagic())return!0;return!1},"hasMagic");function Rg(n,e={}){return new $i(n,e).streamSync()}o(Rg,"globStreamSync");function zP(n,e={}){return new $i(n,e).stream()}o(zP,"globStream");function HP(n,e={}){return new $i(n,e).walkSync()}o(HP,"globSync");async function GP(n,e={}){return new $i(n,e).walk()}o(GP,"glob_");function Og(n,e={}){return new $i(n,e).iterateSync()}o(Og,"globIterateSync");function QP(n,e={}){return new $i(n,e).iterate()}o(QP,"globIterate");var dQ=Rg,hQ=Object.assign(zP,{sync:Rg}),pQ=Og,mQ=Object.assign(QP,{sync:Og}),gQ=Object.assign(HP,{stream:Rg,iterate:Og}),Ig=Object.assign(GP,{glob:GP,globSync:HP,sync:gQ,globStream:zP,stream:hQ,globStreamSync:Rg,streamSync:dQ,globIterate:QP,iterate:mQ,globIterateSync:Og,iterateSync:pQ,Glob:$i,hasMagic:Dw,escape:Dl,unescape:ki});Ig.glob=Ig;var Qo=K(Gt());var It=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await ur.default.pathExists(t))throw new Qo.FileNotFoundError(e);return ur.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return ur.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 ur.default.pathExists(r))throw new Qo.FileAlreadyExistsError(e);return await ur.default.ensureDir(Wa.default.dirname(r)),await ur.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await ur.default.pathExists(r))throw new Qo.FileNotFoundError(e);await ur.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await ur.default.ensureDir(Wa.default.dirname(r)),await ur.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await ur.default.pathExists(t))throw new Qo.FileNotFoundError(e);await ur.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await ur.default.pathExists(r))throw new Qo.FileNotFoundError(e);await ur.default.ensureDir(Wa.default.dirname(i)),await ur.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await ur.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await ur.default.pathExists(t)?(await ur.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=Wa.default.join(t,"**/*.md");return(await Ig(r,{nodir:!0})).map(a=>Wa.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 Wa.default.isAbsolute(e)?e:Wa.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=Nr.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 Zf=K(require("path")),Nw=K(Ma());var ql=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!Zf.default.isAbsolute(e))return Zf.default.resolve(this.vaultRoot,e);let t=Zf.default.resolve(e),r=Zf.default.resolve(this.vaultRoot);if(!t.startsWith(r))throw new Qe(`File path ${e} is outside vault root ${this.vaultRoot}`,"Provide a file path within the vault directory.",{filepath:e,vaultRoot:this.vaultRoot});return t}validate(e){if(!Nw.default.existsSync(e))throw new wf(e);if(!Nw.default.statSync(e).isFile())throw new Qe(`Not a file: ${e}`,"Provide a path to a file, not a directory.",{filepath:e});if(!e.endsWith(".md"))throw new Qe(`Not a Markdown file: ${e}`,"Provide a path to a .md file.",{filepath:e})}getVaultRoot(){return this.vaultRoot}};var eF=K(Gt());var YP=K(Gt());var Bi=class{static{o(this,"BaseCommandExecutor")}constructor(e){this.pathResolver=e.pathResolver,this.fsAdapter=e.fsAdapter,this.frontmatterService=e.frontmatterService,this.dryRun=e.dryRun}resolveAndValidate(e){let t=this.pathResolver.resolve(e);this.pathResolver.validate(t);let r=t.replace(this.pathResolver.getVaultRoot()+"/","");return{resolvedPath:t,relativePath:r}}getCurrentTimestamp(){return YP.DateFormatter.toLocalTimestamp(new Date)}isAssetArchived(e){if(e?.exo__Asset_isArchived===!0)return!0;let t=e?.archived;if(t==null)return!1;if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){let r=t.toLowerCase().trim();return r==="true"||r==="yes"||r==="1"}return!1}extractAliasesFromFrontmatter(e){let t=e.match(/aliases:\s*\n((?: - .*\n?)*)/);return t?t[1].split(`
|
|
616
|
+
`).filter(i=>i.trim()).map(i=>i.replace(/^\s*-\s*/,"").trim()):[]}};var ed=class extends Bi{static{o(this,"StatusCommandExecutor")}constructor(e){super(e)}async executeStart(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_startTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Started: ${e}`),console.log(" Status: Doing"),console.log(` Start time: ${i}`),process.exit(0)}catch(t){D.handle(t)}}async executeComplete(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_endTimestamp",i),s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Completed: ${e}`),console.log(" Status: Done"),console.log(` Completion time: ${i}`),process.exit(0)}catch(t){D.handle(t)}}async executeTrash(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Trashed: ${e}`),console.log(" Status: Trashed"),console.log(` Resolution time: ${i}`),process.exit(0)}catch(t){D.handle(t)}}async executeArchive(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.frontmatterService.updateProperty(r,"archived","true");i=this.frontmatterService.removeProperty(i,"aliases"),await this.fsAdapter.updateFile(t,i),console.log(`\u2705 Archived: ${e}`),console.log(" Archived: true"),console.log(" Aliases removed"),process.exit(0)}catch(t){D.handle(t)}}async executeMoveToBacklog(e){try{await this.updateStatus(e,"ems__EffortStatusBacklog","Backlog"),process.exit(0)}catch(t){D.handle(t)}}async executeMoveToAnalysis(e){try{await this.updateStatus(e,"ems__EffortStatusAnalysis","Analysis"),process.exit(0)}catch(t){D.handle(t)}}async executeMoveToToDo(e){try{await this.updateStatus(e,"ems__EffortStatusToDo","ToDo"),process.exit(0)}catch(t){D.handle(t)}}async updateStatus(e,t,r){let{relativePath:i}=this.resolveAndValidate(e),s=await this.fsAdapter.readFile(i),a=this.frontmatterService.updateProperty(s,"ems__Effort_status",`"[[${t}]]"`);await this.fsAdapter.updateFile(i,a),console.log(`\u2705 Moved to ${r}: ${e}`),console.log(` Status: ${r}`)}};var kr=[];for(let n=0;n<256;++n)kr.push((n+256).toString(16).slice(1));function KP(n,e=0){return(kr[n[e+0]]+kr[n[e+1]]+kr[n[e+2]]+kr[n[e+3]]+"-"+kr[n[e+4]]+kr[n[e+5]]+"-"+kr[n[e+6]]+kr[n[e+7]]+"-"+kr[n[e+8]]+kr[n[e+9]]+"-"+kr[n[e+10]]+kr[n[e+11]]+kr[n[e+12]]+kr[n[e+13]]+kr[n[e+14]]+kr[n[e+15]]).toLowerCase()}o(KP,"unsafeStringify");var XP=require("node:crypto");var Fg=new Uint8Array(256),Pg=Fg.length;function Lw(){return Pg>Fg.length-16&&((0,XP.randomFillSync)(Fg),Pg=0),Fg.slice(Pg,Pg+=16)}o(Lw,"rng");var JP=require("node:crypto"),kw={randomUUID:JP.randomUUID};function _Q(n,e,t){n=n||{};let r=n.random??n.rng?.()??Lw();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 KP(r)}o(_Q,"_v4");function SQ(n,e,t){return kw.randomUUID&&!e&&!n?kw.randomUUID():_Q(n,e,t)}o(SQ,"v4");var td=SQ;var Wl=K(Gt());var rd=class extends Bi{static{o(this,"AssetCreationExecutor")}constructor(e){super(e)}async executeCreateTask(e,t,r={}){try{await this.createAsset(e,t,"ems__Task",r),process.exit(0)}catch(i){D.handle(i)}}async executeCreateMeeting(e,t,r={}){try{await this.createAsset(e,t,"ems__Meeting",r),process.exit(0)}catch(i){D.handle(i)}}async executeCreateProject(e,t,r={}){try{await this.createAsset(e,t,"ems__Project",r),process.exit(0)}catch(i){D.handle(i)}}async executeCreateArea(e,t,r={}){try{await this.createAsset(e,t,"ems__Area",r),process.exit(0)}catch(i){D.handle(i)}}async createAsset(e,t,r,i={}){if(!t||t.trim().length===0)throw new Error("Label cannot be empty");let s=t.trim(),{relativePath:a}=this.resolveAndValidate(e);if(await this.fsAdapter.fileExists(a))throw new Wl.FileAlreadyExistsError(e);let l=td(),u=this.buildAssetFrontmatter(r,l,s,i),f=Wl.MetadataHelpers.buildFileContent(u);await this.fsAdapter.createFile(a,f),console.log(`\u2705 Created ${this.getAssetTypeName(r)}: ${e}`),console.log(` UID: ${l}`),console.log(` Label: ${s}`),console.log(` Class: ${r}`)}buildAssetFrontmatter(e,t,r,i={}){let s=Wl.DateFormatter.toLocalTimestamp(new Date),a={exo__Asset_isDefinedBy:'"[[Ontology/EMS]]"',exo__Asset_uid:t,exo__Asset_label:r,exo__Asset_createdAt:s,exo__Instance_class:[`"[[${e}]]"`],aliases:[r]};return(e==="ems__Task"||e==="ems__Project"||e==="ems__Meeting")&&(a.ems__Effort_status='"[[ems__EffortStatusDraft]]"'),i.prototype&&(a.exo__Asset_prototype=`"[[${i.prototype}]]"`),i.area&&(a.ems__Effort_area=`"[[${i.area}]]"`),i.parent&&(a.ems__Effort_parent=`"[[${i.parent}]]"`),a}getAssetTypeName(e){return{ems__Task:"task",ems__Meeting:"meeting",ems__Project:"project",ems__Area:"area"}[e]||"asset"}};var Mw=K(require("path"));var ZP=K(Gt());var nd=class extends Bi{static{o(this,"PropertyCommandExecutor")}constructor(e){super(e)}async executeRenameToUid(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.getFileMetadata(t);if(!r.exo__Asset_uid)throw new Error("Asset missing exo__Asset_uid property");let i=Mw.default.basename(t,".md"),s=r.exo__Asset_uid;if(i===s&&(console.log(`\u2705 Already renamed: ${e}`),console.log(` Current filename matches UID: ${s}.md`),process.exit(0)),!r.exo__Asset_label||r.exo__Asset_label.trim()===""){let l=await this.fsAdapter.readFile(t),u=this.frontmatterService.updateProperty(l,"exo__Asset_label",i),f=this.isAssetArchived(r),d=u;f||(d=this.frontmatterService.updateProperty(u,"aliases",`
|
|
617
617
|
- ${i}`)),await this.fsAdapter.updateFile(t,d),console.log(` Updated label: "${i}"`)}let a=Mw.default.dirname(t),c=a!=="."?`${a}/${s}.md`:`${s}.md`;await this.fsAdapter.renameFile(t,c),console.log("\u2705 Renamed to UID format"),console.log(` Old: ${t}`),console.log(` New: ${c}`),process.exit(0)}catch(t){D.handle(t)}}async executeUpdateLabel(e,t){try{if(!t||t.trim().length===0)throw new Error("Label cannot be empty");let r=t.trim(),{relativePath:i}=this.resolveAndValidate(e),s=await this.fsAdapter.readFile(i),a=this.frontmatterService.updateProperty(s,"exo__Asset_label",r),c=this.frontmatterService.parse(a),l=this.extractAliasesFromFrontmatter(c.content);if(l.includes(r)||(l.length===0?a=this.frontmatterService.updateProperty(a,"aliases",`
|
|
618
618
|
- ${r}`):a=this.frontmatterService.updateProperty(a,"aliases",`${l.map(u=>`
|
|
619
619
|
- ${u}`).join("")}
|
|
620
620
|
- ${r}`)),this.dryRun){if(console.log("\u{1F50D} DRY RUN: Preview of changes (not applied)"),console.log(` File: ${e}`),console.log(" Changes:"),console.log(` \u2022 exo__Asset_label: "${r}"`),l.includes(r))console.log(" \u2022 aliases: unchanged (label already present)");else{let u=l.length===0?[r]:[...l,r];console.log(` \u2022 aliases: [${u.map(f=>`"${f}"`).join(", ")}]`)}console.log(`
|
|
621
621
|
\u{1F4A1} Run without --dry-run to apply changes`),process.exit(0)}await this.fsAdapter.updateFile(i,a),console.log("\u2705 Updated label"),console.log(` File: ${e}`),console.log(` New label: "${r}"`),console.log(" Aliases synchronized"),process.exit(0)}catch(r){D.handle(r)}}async executeSchedule(e,t){try{await this.updatePlannedTimestamp(e,t,"ems__Effort_plannedStartTimestamp"),process.exit(0)}catch(r){D.handle(r)}}async executeSetDeadline(e,t){try{await this.updatePlannedTimestamp(e,t,"ems__Effort_plannedEndTimestamp"),process.exit(0)}catch(r){D.handle(r)}}async updatePlannedTimestamp(e,t,r){let{relativePath:i}=this.resolveAndValidate(e);if(!await this.fsAdapter.fileExists(i))throw new Error(`File not found: ${e}`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t))throw new Error(`Invalid date format: ${t}. Expected YYYY-MM-DD (e.g., 2025-11-25)`);let a=ZP.DateFormatter.toTimestampAtStartOfDay(t),c=await this.fsAdapter.readFile(i),l=this.frontmatterService.updateProperty(c,r,a);await this.fsAdapter.writeFile(i,l),console.log(`\u2705 ${r==="ems__Effort_plannedStartTimestamp"?"Scheduled":"Set deadline for"}: ${e}`),console.log(` Date: ${t}`),console.log(` Timestamp: ${a}`)}};var Ga=K(require("path"));var id=class extends Bi{static{o(this,"FolderRepairExecutor")}constructor(e){super(e)}async executeRepairFolder(e){try{let{relativePath:t}=this.resolveAndValidate(e),i=(await this.fsAdapter.getFileMetadata(t))?.exo__Asset_isDefinedBy;if(!i)throw new Error("Cannot determine expected folder: missing exo__Asset_isDefinedBy");let s=this.extractReference(i);if(!s)throw new Error("Cannot determine expected folder: invalid exo__Asset_isDefinedBy format");let a=await this.findReferencedFile(s,t);if(!a)throw new Error(`Cannot determine expected folder: referenced asset not found: ${s}`);let c=Ga.default.dirname(a),l=c==="."?"":c,u=Ga.default.dirname(t),f=u==="."?"":u;if(this.normalizePath(f)===this.normalizePath(l))return console.log("\u2705 Already in correct folder"),console.log(` File: ${e}`),console.log(` Folder: ${l||"(root)"}`),process.exit(0),{moved:!1,oldPath:t,newPath:t,expectedFolder:l};if(this.dryRun){let _=Ga.default.basename(t),b=l?`${l}/${_}`:_;return console.log("\u{1F50D} DRY RUN: Preview of changes (not applied)"),console.log(` File: ${e}`),console.log(` Current folder: ${f||"(root)"}`),console.log(` Expected folder: ${l||"(root)"}`),console.log(` Would move to: ${b}`),console.log(`
|
|
622
622
|
\u{1F4A1} Run without --dry-run to apply changes`),process.exit(0),{moved:!1,oldPath:t,newPath:b,expectedFolder:l}}let d=Ga.default.basename(t),h=l?`${l}/${d}`:d;if(await this.fsAdapter.fileExists(h))throw new Error(`Cannot move file: ${h} already exists`);return l&&(await this.fsAdapter.directoryExists(l)||await this.fsAdapter.createDirectory(l)),await this.fsAdapter.renameFile(t,h),console.log("\u2705 Moved to correct folder"),console.log(` Old path: ${t}`),console.log(` New path: ${h}`),console.log(` Expected folder: ${l||"(root)"}`),process.exit(0),{moved:!0,oldPath:t,newPath:h,expectedFolder:l}}catch(t){D.handle(t)}}extractReference(e){if(typeof e!="string")return null;let t=e.trim().replace(/^["']|["']$/g,"");return t=t.replace(/^\[\[|\]\]$/g,""),t||null}async findReferencedFile(e,t){let r=e.endsWith(".md")?e:`${e}.md`;if(e.includes("/")&&await this.fsAdapter.fileExists(r))return r;let i=Ga.default.dirname(t),s=i?`${i}/${r}`:r;if(await this.fsAdapter.fileExists(s))return s;let c=await this.fsAdapter.findFileByUID(e);return c||(await this.fsAdapter.getMarkdownFiles()).find(f=>{let d=Ga.default.basename(f,".md"),h=Ga.default.basename(r,".md");return d===h})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};var Dg=class{static{o(this,"CommandExecutor")}constructor(e,t=!1){this.context={pathResolver:new ql(e),fsAdapter:new It(e),frontmatterService:new eF.FrontmatterService,dryRun:t},this.statusExecutor=new ed(this.context),this.creationExecutor=new rd(this.context),this.propertyExecutor=new nd(this.context),this.folderRepairExecutor=new id(this.context)}async execute(e,t,r){try{let i=this.context.pathResolver.resolve(t);this.context.pathResolver.validate(i),await this.context.fsAdapter.readFile(i.replace(this.context.pathResolver.getVaultRoot()+"/","")),console.log("\u2705 Command infrastructure verified"),console.log(` Command: ${e}`),console.log(` File: ${i}`),console.log(` Vault: ${this.context.pathResolver.getVaultRoot()}`),Object.keys(r).length>0&&console.log(` Options: ${JSON.stringify(r,null,2)}`),console.log(`
|
|
623
|
-
\u{1F4DD} Note: Actual command execution will be implemented in follow-up issues.`),console.log(" This PR establishes the infrastructure foundation."),process.exit(0)}catch(i){D.handle(i)}}getVaultRoot(){return this.context.pathResolver.getVaultRoot()}async executeStart(e){return this.statusExecutor.executeStart(e)}async executeComplete(e){return this.statusExecutor.executeComplete(e)}async executeTrash(e){return this.statusExecutor.executeTrash(e)}async executeArchive(e){return this.statusExecutor.executeArchive(e)}async executeMoveToBacklog(e){return this.statusExecutor.executeMoveToBacklog(e)}async executeMoveToAnalysis(e){return this.statusExecutor.executeMoveToAnalysis(e)}async executeMoveToToDo(e){return this.statusExecutor.executeMoveToToDo(e)}async executeCreateTask(e,t,r={}){return this.creationExecutor.executeCreateTask(e,t,r)}async executeCreateMeeting(e,t,r={}){return this.creationExecutor.executeCreateMeeting(e,t,r)}async executeCreateProject(e,t,r={}){return this.creationExecutor.executeCreateProject(e,t,r)}async executeCreateArea(e,t,r={}){return this.creationExecutor.executeCreateArea(e,t,r)}async executeRenameToUid(e){return this.propertyExecutor.executeRenameToUid(e)}async executeUpdateLabel(e,t){return this.propertyExecutor.executeUpdateLabel(e,t)}async executeSchedule(e,t){return this.propertyExecutor.executeSchedule(e,t)}async executeSetDeadline(e,t){return this.propertyExecutor.executeSetDeadline(e,t)}async executeRepairFolder(e){return this.folderRepairExecutor.executeRepairFolder(e)}};function Mr(n,e,t,r,i){if(n==="json"){let s={command:e,filepath:t,action:r,...i&&{changes:i}},a=Z.success(s);console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 ${r}`)}o(Mr,"outputResult");function Yo(n,e,t,r){let i=new Qe(`--${e} option is required for ${t} command`,r,{command:t,missingOption:e});D.handle(i)}o(Yo,"handleMissingOption");function rF(){return new Ie("command").description("Execute plugin command on single asset").argument("<command-name>","Command to execute (rename-to-uid, start, complete, schedule, set-deadline, etc.)").argument("<filepath>","Path to asset file (relative to vault root or absolute)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--label <value>","Asset label (required for update-label and creation commands)").option("--prototype <uid>","Prototype UID for inheritance (creation commands)").option("--area <uid>","Area UID for effort linkage (creation commands)").option("--parent <uid>","Parent UID for effort linkage (creation commands)").option("--date <value>","Date in YYYY-MM-DD format (required for schedule and set-deadline commands)").option("--dry-run","Preview changes without modifying files").option("--format <type>","Output format: text|json (default: text)","text").action(async(n,e,t)=>{let r=t.format||"text";D.setFormat(r);try{let i=(0,tF.resolve)(t.vault),s=new Dg(i,t.dryRun);switch(n){case"rename-to-uid":await s.executeRenameToUid(e),Mr(r,n,e,"Renamed file to UID-based name");break;case"update-label":t.label||Yo(r,"label","update-label",'exocortex command update-label <filepath> --label "<value>"'),await s.executeUpdateLabel(e,t.label),Mr(r,n,e,`Updated label to "${t.label}"`,{label:t.label});break;case"start":await s.executeStart(e),Mr(r,n,e,"Started task");break;case"complete":await s.executeComplete(e),Mr(r,n,e,"Completed task");break;case"trash":await s.executeTrash(e),Mr(r,n,e,"Moved task to trash");break;case"archive":await s.executeArchive(e),Mr(r,n,e,"Archived task");break;case"move-to-backlog":await s.executeMoveToBacklog(e),Mr(r,n,e,"Moved task to backlog");break;case"move-to-analysis":await s.executeMoveToAnalysis(e),Mr(r,n,e,"Moved task to analysis");break;case"move-to-todo":await s.executeMoveToToDo(e),Mr(r,n,e,"Moved task to todo");break;case"create-task":t.label||Yo(r,"label","create-task",'exocortex command create-task <filepath> --label "<value>"'),await s.executeCreateTask(e,t.label,{prototype:t.prototype,area:t.area,parent:t.parent}),Mr(r,n,e,`Created task "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"create-meeting":t.label||Yo(r,"label","create-meeting",'exocortex command create-meeting <filepath> --label "<value>"'),await s.executeCreateMeeting(e,t.label,{prototype:t.prototype,area:t.area,parent:t.parent}),Mr(r,n,e,`Created meeting "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"create-project":t.label||Yo(r,"label","create-project",'exocortex command create-project <filepath> --label "<value>"'),await s.executeCreateProject(e,t.label,{prototype:t.prototype,area:t.area,parent:t.parent}),Mr(r,n,e,`Created project "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"create-area":t.label||Yo(r,"label","create-area",'exocortex command create-area <filepath> --label "<value>"'),await s.executeCreateArea(e,t.label,{prototype:t.prototype,area:t.area,parent:t.parent}),Mr(r,n,e,`Created area "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"schedule":t.date||Yo(r,"date","schedule",'exocortex command schedule <filepath> --date "YYYY-MM-DD"'),await s.executeSchedule(e,t.date),Mr(r,n,e,`Scheduled task for ${t.date}`,{date:t.date});break;case"set-deadline":t.date||Yo(r,"date","set-deadline",'exocortex command set-deadline <filepath> --date "YYYY-MM-DD"'),await s.executeSetDeadline(e,t.date),Mr(r,n,e,`Set deadline to ${t.date}`,{date:t.date});break;case"repair-folder":{let a=await s.executeRepairFolder(e);Mr(r,n,e,a.moved?`Moved to correct folder: ${a.newPath}`:"Already in correct folder",{moved:a.moved,oldPath:a.oldPath,newPath:a.newPath,expectedFolder:a.expectedFolder});break}default:await s.execute(n,e,t),Mr(r,n,e,`Executed ${n}`);break}}catch(i){D.handle(i)}})}o(rF,"commandCommand");var iF=require("path");var ia=K(require("fs")),jw=K(require("path")),nF=require("events");var bQ={watch:ia.default.watch.bind(ia.default),existsSync:ia.default.existsSync.bind(ia.default),statSync:ia.default.statSync.bind(ia.default),readFileSync:ia.default.readFileSync.bind(ia.default)},Ng=class extends nF.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=jw.default.resolve(t),this.fsAdapter=r.fsAdapter??bQ,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=jw.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?Lr(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 $w=K(require("fs"));function sF(){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=>{D.setFormat("json");try{let e=(0,iF.resolve)(n.vault);if(!$w.default.existsSync(e))throw new Te(e);if(!$w.default.statSync(e).isDirectory())throw new Qe(`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 Qe("--debounce must be a non-negative integer","Use a positive integer value for debounce",{debounce:n.debounce});let r=new Ng(e,{pattern:n.pattern,assetType:n.assetType,debounceMs:t});r.on("change",s=>{console.log(JSON.stringify(s))}),r.on("error",s=>{let a=Z.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){D.handle(e)}})}o(sF,"watchCommand");var Vw=require("path"),Uw=K(Ma());var Ko=K(require("path"));var Gl=K(Wt());var Vi=K(Ma()),Bw=K(require("crypto"));var Lg=class{constructor(){this.backups=new Map;this.fileHashes=new Map}static{o(this,"TransactionManager")}async begin(e){if(!Vi.default.existsSync(e))throw new Error(`Cannot backup non-existent file: ${e}`);let t=await Vi.default.readFile(e,"utf-8"),r=Bw.default.createHash("sha256").update(t).digest("hex");this.fileHashes.set(e,r);let i=`${e}.backup.${Date.now()}`;await Vi.default.writeFile(i,t,"utf-8"),this.backups.set(e,i)}async verify(e){let t=this.fileHashes.get(e);if(!t)return!0;if(!Vi.default.existsSync(e))return!1;let r=await Vi.default.readFile(e,"utf-8");return Bw.default.createHash("sha256").update(r).digest("hex")===t}async commit(){for(let e of this.backups.values())Vi.default.existsSync(e)&&await Vi.default.remove(e);this.backups.clear(),this.fileHashes.clear()}async rollback(){for(let[e,t]of this.backups.entries())Vi.default.existsSync(t)&&(await Vi.default.copy(t,e,{overwrite:!0}),await Vi.default.remove(t));this.backups.clear(),this.fileHashes.clear()}getTrackedFiles(){return Array.from(this.backups.keys())}};var Xo=class{static{o(this,"BatchExecutor")}constructor(e,t=!1){this.pathResolver=new ql(e),this.fsAdapter=new It(e),this.frontmatterService=new Gl.FrontmatterService,this.transactionManager=new Lg,this.dryRun=t}async executeBatch(e,t=!1){let r=Date.now(),i=[],s=0,a=0;if(e.length===0)return{success:!0,total:0,succeeded:0,failed:0,results:[],durationMs:Date.now()-r,atomic:t};if(t&&!this.dryRun)try{await this.backupAllFiles(e)}catch(l){return{success:!1,total:e.length,succeeded:0,failed:e.length,results:e.map(u=>({success:!1,command:u.command,filepath:u.filepath,error:`Backup failed: ${l.message}`})),durationMs:Date.now()-r,atomic:t}}for(let l of e){let u=await this.executeSingleOperation(l);if(i.push(u),u.success)s++;else if(a++,t&&!this.dryRun){await this.transactionManager.rollback();let f=i.length;for(let d=f;d<e.length;d++)i.push({success:!1,command:e[d].command,filepath:e[d].filepath,error:"Not executed due to atomic rollback"}),a++;return{success:!1,total:e.length,succeeded:0,failed:e.length,results:i,durationMs:Date.now()-r,atomic:t,rolledBack:!0}}}return t&&!this.dryRun&&await this.transactionManager.commit(),{success:a===0,total:e.length,succeeded:s,failed:a,results:i,durationMs:Date.now()-r,atomic:t,...t&&{rolledBack:!1}}}static parseInput(e){try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Qe("Batch input must be a JSON array of operations",`exo batch --input '[{"command":"start","filepath":"task.md"}]'`);for(let r of t){if(!r.command||typeof r.command!="string")throw new Qe('Each operation must have a "command" string property','{"command":"start","filepath":"task.md"}');if(!r.filepath||typeof r.filepath!="string")throw new Qe('Each operation must have a "filepath" string property','{"command":"start","filepath":"task.md"}')}return t}catch(t){throw t instanceof Qe?t:new Qe(`Failed to parse batch input: ${t.message}`,`exo batch --input '[{"command":"start","filepath":"task.md"}]'`)}}async backupAllFiles(e){let t=new Set;for(let r of e){let i=this.pathResolver.resolve(r.filepath);t.add(i)}for(let r of t)await this.transactionManager.begin(r)}async executeSingleOperation(e){try{let t=this.pathResolver.resolve(e.filepath);this.pathResolver.validate(t);let r=t.replace(this.pathResolver.getVaultRoot()+"/","");if(await this.fsAdapter.readFile(r),this.dryRun)return{success:!0,command:e.command,filepath:e.filepath,action:`Would execute ${e.command} (dry-run)`};switch(e.command){case"start":return await this.executeStart(r,e);case"complete":return await this.executeComplete(r,e);case"trash":return await this.executeTrash(r,e);case"archive":return await this.executeArchive(r,e);case"move-to-backlog":return await this.executeStatusUpdate(r,e,"ems__EffortStatusBacklog","Moved to backlog");case"move-to-analysis":return await this.executeStatusUpdate(r,e,"ems__EffortStatusAnalysis","Moved to analysis");case"move-to-todo":return await this.executeStatusUpdate(r,e,"ems__EffortStatusToDo","Moved to todo");case"update-label":return await this.executeUpdateLabel(r,e);case"schedule":return await this.executeSchedule(r,e);case"set-deadline":return await this.executeSetDeadline(r,e);case"repair-folder":return await this.executeRepairFolder(r,e);default:return{success:!1,command:e.command,filepath:e.filepath,error:`Unknown command: ${e.command}`}}}catch(t){return{success:!1,command:e.command,filepath:e.filepath,error:t.message}}}getCurrentTimestamp(){return Gl.DateFormatter.toLocalTimestamp(new Date)}async executeStart(e,t){let r=await this.fsAdapter.readFile(e),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');return s=this.frontmatterService.updateProperty(s,"ems__Effort_startTimestamp",i),await this.fsAdapter.updateFile(e,s),{success:!0,command:t.command,filepath:t.filepath,action:"Started task",changes:{status:"Doing",startTimestamp:i}}}async executeComplete(e,t){let r=await this.fsAdapter.readFile(e),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');return s=this.frontmatterService.updateProperty(s,"ems__Effort_endTimestamp",i),s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(e,s),{success:!0,command:t.command,filepath:t.filepath,action:"Completed task",changes:{status:"Done",endTimestamp:i,resolutionTimestamp:i}}}async executeTrash(e,t){let r=await this.fsAdapter.readFile(e),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');return s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(e,s),{success:!0,command:t.command,filepath:t.filepath,action:"Trashed task",changes:{status:"Trashed",resolutionTimestamp:i}}}async executeArchive(e,t){let r=await this.fsAdapter.readFile(e),i=this.frontmatterService.updateProperty(r,"archived","true");return i=this.frontmatterService.removeProperty(i,"aliases"),await this.fsAdapter.updateFile(e,i),{success:!0,command:t.command,filepath:t.filepath,action:"Archived task",changes:{archived:!0,aliasesRemoved:!0}}}async executeStatusUpdate(e,t,r,i){let s=await this.fsAdapter.readFile(e),a=this.frontmatterService.updateProperty(s,"ems__Effort_status",`"[[${r}]]"`);return await this.fsAdapter.updateFile(e,a),{success:!0,command:t.command,filepath:t.filepath,action:i,changes:{status:r.replace("ems__EffortStatus","")}}}async executeUpdateLabel(e,t){let r=t.options?.label;if(!r||r.trim()==="")return{success:!1,command:t.command,filepath:t.filepath,error:'Missing required option: "label"'};let i=r.trim(),s=await this.fsAdapter.readFile(e),a=this.frontmatterService.updateProperty(s,"exo__Asset_label",`"${i}"`);return await this.fsAdapter.updateFile(e,a),{success:!0,command:t.command,filepath:t.filepath,action:`Updated label to "${i}"`,changes:{label:i}}}async executeSchedule(e,t){let r=t.options?.date;if(!r)return{success:!1,command:t.command,filepath:t.filepath,error:'Missing required option: "date"'};if(!/^\d{4}-\d{2}-\d{2}$/.test(r))return{success:!1,command:t.command,filepath:t.filepath,error:`Invalid date format: ${r}. Expected YYYY-MM-DD`};let i=await this.fsAdapter.readFile(e),s=Gl.DateFormatter.toTimestampAtStartOfDay(r),a=this.frontmatterService.updateProperty(i,"ems__Effort_scheduledTimestamp",s);return await this.fsAdapter.updateFile(e,a),{success:!0,command:t.command,filepath:t.filepath,action:`Scheduled for ${r}`,changes:{scheduledTimestamp:s}}}async executeSetDeadline(e,t){let r=t.options?.date;if(!r)return{success:!1,command:t.command,filepath:t.filepath,error:'Missing required option: "date"'};if(!/^\d{4}-\d{2}-\d{2}$/.test(r))return{success:!1,command:t.command,filepath:t.filepath,error:`Invalid date format: ${r}. Expected YYYY-MM-DD`};let i=await this.fsAdapter.readFile(e),s=Gl.DateFormatter.toTimestampAtStartOfDay(r),a=this.frontmatterService.updateProperty(i,"ems__Effort_deadlineTimestamp",s);return await this.fsAdapter.updateFile(e,a),{success:!0,command:t.command,filepath:t.filepath,action:`Set deadline to ${r}`,changes:{deadlineTimestamp:s}}}async executeRepairFolder(e,t){let i=(await this.fsAdapter.getFileMetadata(e))?.exo__Asset_isDefinedBy;if(!i)return{success:!1,command:t.command,filepath:t.filepath,error:"Cannot determine expected folder: missing exo__Asset_isDefinedBy"};let s=this.extractReference(i);if(!s)return{success:!1,command:t.command,filepath:t.filepath,error:"Cannot determine expected folder: invalid exo__Asset_isDefinedBy format"};let a=await this.findReferencedFile(s,e);if(!a)return{success:!1,command:t.command,filepath:t.filepath,error:`Cannot determine expected folder: referenced asset not found: ${s}`};let c=Ko.default.dirname(a),l=c==="."?"":c,u=Ko.default.dirname(e),f=u==="."?"":u;if(this.normalizePath(f)===this.normalizePath(l))return{success:!0,command:t.command,filepath:t.filepath,action:"Already in correct folder",changes:{moved:!1,folder:l||"(root)"}};let d=Ko.default.basename(e),h=l?`${l}/${d}`:d;return await this.fsAdapter.fileExists(h)?{success:!1,command:t.command,filepath:t.filepath,error:`Cannot move file: ${h} already exists`}:(await this.fsAdapter.renameFile(e,h),{success:!0,command:t.command,filepath:t.filepath,action:`Moved to ${l||"(root)"}`,changes:{moved:!0,oldPath:e,newPath:h,expectedFolder:l||"(root)"}})}extractReference(e){if(typeof e!="string")return null;let t=e.trim().replace(/^["']|["']$/g,"");return t=t.replace(/^\[\[|\]\]$/g,""),t||null}async findReferencedFile(e,t){let r=e.endsWith(".md")?e:`${e}.md`;if(e.includes("/")&&await this.fsAdapter.fileExists(r))return r;let i=Ko.default.dirname(t),s=i!=="."?`${i}/${r}`:r;if(await this.fsAdapter.fileExists(s))return s;let c=await this.fsAdapter.findFileByUID(e);return c||(await this.fsAdapter.getMarkdownFiles()).find(f=>{let d=Ko.default.basename(f,".md"),h=Ko.default.basename(r,".md");return d===h})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};function vQ(n,e){if(n==="json"){let t=Z.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
|
|
623
|
+
\u{1F4DD} Note: Actual command execution will be implemented in follow-up issues.`),console.log(" This PR establishes the infrastructure foundation."),process.exit(0)}catch(i){D.handle(i)}}getVaultRoot(){return this.context.pathResolver.getVaultRoot()}async executeStart(e){return this.statusExecutor.executeStart(e)}async executeComplete(e){return this.statusExecutor.executeComplete(e)}async executeTrash(e){return this.statusExecutor.executeTrash(e)}async executeArchive(e){return this.statusExecutor.executeArchive(e)}async executeMoveToBacklog(e){return this.statusExecutor.executeMoveToBacklog(e)}async executeMoveToAnalysis(e){return this.statusExecutor.executeMoveToAnalysis(e)}async executeMoveToToDo(e){return this.statusExecutor.executeMoveToToDo(e)}async executeCreateTask(e,t,r={}){return this.creationExecutor.executeCreateTask(e,t,r)}async executeCreateMeeting(e,t,r={}){return this.creationExecutor.executeCreateMeeting(e,t,r)}async executeCreateProject(e,t,r={}){return this.creationExecutor.executeCreateProject(e,t,r)}async executeCreateArea(e,t,r={}){return this.creationExecutor.executeCreateArea(e,t,r)}async executeRenameToUid(e){return this.propertyExecutor.executeRenameToUid(e)}async executeUpdateLabel(e,t){return this.propertyExecutor.executeUpdateLabel(e,t)}async executeSchedule(e,t){return this.propertyExecutor.executeSchedule(e,t)}async executeSetDeadline(e,t){return this.propertyExecutor.executeSetDeadline(e,t)}async executeRepairFolder(e){return this.folderRepairExecutor.executeRepairFolder(e)}};function Mr(n,e,t,r,i){if(n==="json"){let s={command:e,filepath:t,action:r,...i&&{changes:i}},a=Z.success(s);console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 ${r}`)}o(Mr,"outputResult");function Yo(n,e,t,r){let i=new Qe(`--${e} option is required for ${t} command`,r,{command:t,missingOption:e});D.handle(i)}o(Yo,"handleMissingOption");function rF(){return new Ie("command").description("Execute plugin command on single asset").argument("<command-name>","Command to execute (rename-to-uid, start, complete, schedule, set-deadline, etc.)").argument("<filepath>","Path to asset file (relative to vault root or absolute)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--label <value>","Asset label (required for update-label and creation commands)").option("--prototype <uid>","Prototype UID for inheritance (creation commands)").option("--area <uid>","Area UID for effort linkage (creation commands)").option("--parent <uid>","Parent UID for effort linkage (creation commands)").option("--date <value>","Date in YYYY-MM-DD format (required for schedule and set-deadline commands)").option("--dry-run","Preview changes without modifying files").option("--format <type>","Output format: text|json (default: text)","text").action(async(n,e,t)=>{let r=t.format||"text";D.setFormat(r);try{let i=(0,tF.resolve)(t.vault),s=new Dg(i,t.dryRun);switch(n){case"rename-to-uid":await s.executeRenameToUid(e),Mr(r,n,e,"Renamed file to UID-based name");break;case"update-label":t.label||Yo(r,"label","update-label",'exocortex command update-label <filepath> --label "<value>"'),await s.executeUpdateLabel(e,t.label),Mr(r,n,e,`Updated label to "${t.label}"`,{label:t.label});break;case"start":await s.executeStart(e),Mr(r,n,e,"Started task");break;case"complete":await s.executeComplete(e),Mr(r,n,e,"Completed task");break;case"trash":await s.executeTrash(e),Mr(r,n,e,"Moved task to trash");break;case"archive":await s.executeArchive(e),Mr(r,n,e,"Archived task");break;case"move-to-backlog":await s.executeMoveToBacklog(e),Mr(r,n,e,"Moved task to backlog");break;case"move-to-analysis":await s.executeMoveToAnalysis(e),Mr(r,n,e,"Moved task to analysis");break;case"move-to-todo":await s.executeMoveToToDo(e),Mr(r,n,e,"Moved task to todo");break;case"create-task":t.label||Yo(r,"label","create-task",'exocortex command create-task <filepath> --label "<value>"'),await s.executeCreateTask(e,t.label,{prototype:t.prototype,area:t.area,parent:t.parent}),Mr(r,n,e,`Created task "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"create-meeting":t.label||Yo(r,"label","create-meeting",'exocortex command create-meeting <filepath> --label "<value>"'),await s.executeCreateMeeting(e,t.label,{prototype:t.prototype,area:t.area,parent:t.parent}),Mr(r,n,e,`Created meeting "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"create-project":t.label||Yo(r,"label","create-project",'exocortex command create-project <filepath> --label "<value>"'),await s.executeCreateProject(e,t.label,{prototype:t.prototype,area:t.area,parent:t.parent}),Mr(r,n,e,`Created project "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"create-area":t.label||Yo(r,"label","create-area",'exocortex command create-area <filepath> --label "<value>"'),await s.executeCreateArea(e,t.label,{prototype:t.prototype,area:t.area,parent:t.parent}),Mr(r,n,e,`Created area "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"schedule":t.date||Yo(r,"date","schedule",'exocortex command schedule <filepath> --date "YYYY-MM-DD"'),await s.executeSchedule(e,t.date),Mr(r,n,e,`Scheduled task for ${t.date}`,{date:t.date});break;case"set-deadline":t.date||Yo(r,"date","set-deadline",'exocortex command set-deadline <filepath> --date "YYYY-MM-DD"'),await s.executeSetDeadline(e,t.date),Mr(r,n,e,`Set deadline to ${t.date}`,{date:t.date});break;case"repair-folder":{let a=await s.executeRepairFolder(e);Mr(r,n,e,a.moved?`Moved to correct folder: ${a.newPath}`:"Already in correct folder",{moved:a.moved,oldPath:a.oldPath,newPath:a.newPath,expectedFolder:a.expectedFolder});break}default:await s.execute(n,e,t),Mr(r,n,e,`Executed ${n}`);break}}catch(i){D.handle(i)}})}o(rF,"commandCommand");var iF=require("path");var ia=K(require("fs")),jw=K(require("path")),nF=require("events");var bQ={watch:ia.default.watch.bind(ia.default),existsSync:ia.default.existsSync.bind(ia.default),statSync:ia.default.statSync.bind(ia.default),readFileSync:ia.default.readFileSync.bind(ia.default)},Ng=class extends nF.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=jw.default.resolve(t),this.fsAdapter=r.fsAdapter??bQ,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=jw.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?Lr(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 $w=K(require("fs"));function sF(){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=>{D.setFormat("json");try{let e=(0,iF.resolve)(n.vault);if(!$w.default.existsSync(e))throw new Te(e);if(!$w.default.statSync(e).isDirectory())throw new Qe(`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 Qe("--debounce must be a non-negative integer","Use a positive integer value for debounce",{debounce:n.debounce});let r=new Ng(e,{pattern:n.pattern,assetType:n.assetType,debounceMs:t});r.on("change",s=>{console.log(JSON.stringify(s))}),r.on("error",s=>{let a=Z.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){D.handle(e)}})}o(sF,"watchCommand");var Vw=require("path"),Uw=K(Ma());var Ko=K(require("path"));var Gl=K(Gt());var Vi=K(Ma()),Bw=K(require("crypto"));var Lg=class{constructor(){this.backups=new Map;this.fileHashes=new Map}static{o(this,"TransactionManager")}async begin(e){if(!Vi.default.existsSync(e))throw new Error(`Cannot backup non-existent file: ${e}`);let t=await Vi.default.readFile(e,"utf-8"),r=Bw.default.createHash("sha256").update(t).digest("hex");this.fileHashes.set(e,r);let i=`${e}.backup.${Date.now()}`;await Vi.default.writeFile(i,t,"utf-8"),this.backups.set(e,i)}async verify(e){let t=this.fileHashes.get(e);if(!t)return!0;if(!Vi.default.existsSync(e))return!1;let r=await Vi.default.readFile(e,"utf-8");return Bw.default.createHash("sha256").update(r).digest("hex")===t}async commit(){for(let e of this.backups.values())Vi.default.existsSync(e)&&await Vi.default.remove(e);this.backups.clear(),this.fileHashes.clear()}async rollback(){for(let[e,t]of this.backups.entries())Vi.default.existsSync(t)&&(await Vi.default.copy(t,e,{overwrite:!0}),await Vi.default.remove(t));this.backups.clear(),this.fileHashes.clear()}getTrackedFiles(){return Array.from(this.backups.keys())}};var Xo=class{static{o(this,"BatchExecutor")}constructor(e,t=!1){this.pathResolver=new ql(e),this.fsAdapter=new It(e),this.frontmatterService=new Gl.FrontmatterService,this.transactionManager=new Lg,this.dryRun=t}async executeBatch(e,t=!1){let r=Date.now(),i=[],s=0,a=0;if(e.length===0)return{success:!0,total:0,succeeded:0,failed:0,results:[],durationMs:Date.now()-r,atomic:t};if(t&&!this.dryRun)try{await this.backupAllFiles(e)}catch(l){return{success:!1,total:e.length,succeeded:0,failed:e.length,results:e.map(u=>({success:!1,command:u.command,filepath:u.filepath,error:`Backup failed: ${l.message}`})),durationMs:Date.now()-r,atomic:t}}for(let l of e){let u=await this.executeSingleOperation(l);if(i.push(u),u.success)s++;else if(a++,t&&!this.dryRun){await this.transactionManager.rollback();let f=i.length;for(let d=f;d<e.length;d++)i.push({success:!1,command:e[d].command,filepath:e[d].filepath,error:"Not executed due to atomic rollback"}),a++;return{success:!1,total:e.length,succeeded:0,failed:e.length,results:i,durationMs:Date.now()-r,atomic:t,rolledBack:!0}}}return t&&!this.dryRun&&await this.transactionManager.commit(),{success:a===0,total:e.length,succeeded:s,failed:a,results:i,durationMs:Date.now()-r,atomic:t,...t&&{rolledBack:!1}}}static parseInput(e){try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Qe("Batch input must be a JSON array of operations",`exo batch --input '[{"command":"start","filepath":"task.md"}]'`);for(let r of t){if(!r.command||typeof r.command!="string")throw new Qe('Each operation must have a "command" string property','{"command":"start","filepath":"task.md"}');if(!r.filepath||typeof r.filepath!="string")throw new Qe('Each operation must have a "filepath" string property','{"command":"start","filepath":"task.md"}')}return t}catch(t){throw t instanceof Qe?t:new Qe(`Failed to parse batch input: ${t.message}`,`exo batch --input '[{"command":"start","filepath":"task.md"}]'`)}}async backupAllFiles(e){let t=new Set;for(let r of e){let i=this.pathResolver.resolve(r.filepath);t.add(i)}for(let r of t)await this.transactionManager.begin(r)}async executeSingleOperation(e){try{let t=this.pathResolver.resolve(e.filepath);this.pathResolver.validate(t);let r=t.replace(this.pathResolver.getVaultRoot()+"/","");if(await this.fsAdapter.readFile(r),this.dryRun)return{success:!0,command:e.command,filepath:e.filepath,action:`Would execute ${e.command} (dry-run)`};switch(e.command){case"start":return await this.executeStart(r,e);case"complete":return await this.executeComplete(r,e);case"trash":return await this.executeTrash(r,e);case"archive":return await this.executeArchive(r,e);case"move-to-backlog":return await this.executeStatusUpdate(r,e,"ems__EffortStatusBacklog","Moved to backlog");case"move-to-analysis":return await this.executeStatusUpdate(r,e,"ems__EffortStatusAnalysis","Moved to analysis");case"move-to-todo":return await this.executeStatusUpdate(r,e,"ems__EffortStatusToDo","Moved to todo");case"update-label":return await this.executeUpdateLabel(r,e);case"schedule":return await this.executeSchedule(r,e);case"set-deadline":return await this.executeSetDeadline(r,e);case"repair-folder":return await this.executeRepairFolder(r,e);default:return{success:!1,command:e.command,filepath:e.filepath,error:`Unknown command: ${e.command}`}}}catch(t){return{success:!1,command:e.command,filepath:e.filepath,error:t.message}}}getCurrentTimestamp(){return Gl.DateFormatter.toLocalTimestamp(new Date)}async executeStart(e,t){let r=await this.fsAdapter.readFile(e),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');return s=this.frontmatterService.updateProperty(s,"ems__Effort_startTimestamp",i),await this.fsAdapter.updateFile(e,s),{success:!0,command:t.command,filepath:t.filepath,action:"Started task",changes:{status:"Doing",startTimestamp:i}}}async executeComplete(e,t){let r=await this.fsAdapter.readFile(e),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');return s=this.frontmatterService.updateProperty(s,"ems__Effort_endTimestamp",i),s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(e,s),{success:!0,command:t.command,filepath:t.filepath,action:"Completed task",changes:{status:"Done",endTimestamp:i,resolutionTimestamp:i}}}async executeTrash(e,t){let r=await this.fsAdapter.readFile(e),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');return s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(e,s),{success:!0,command:t.command,filepath:t.filepath,action:"Trashed task",changes:{status:"Trashed",resolutionTimestamp:i}}}async executeArchive(e,t){let r=await this.fsAdapter.readFile(e),i=this.frontmatterService.updateProperty(r,"archived","true");return i=this.frontmatterService.removeProperty(i,"aliases"),await this.fsAdapter.updateFile(e,i),{success:!0,command:t.command,filepath:t.filepath,action:"Archived task",changes:{archived:!0,aliasesRemoved:!0}}}async executeStatusUpdate(e,t,r,i){let s=await this.fsAdapter.readFile(e),a=this.frontmatterService.updateProperty(s,"ems__Effort_status",`"[[${r}]]"`);return await this.fsAdapter.updateFile(e,a),{success:!0,command:t.command,filepath:t.filepath,action:i,changes:{status:r.replace("ems__EffortStatus","")}}}async executeUpdateLabel(e,t){let r=t.options?.label;if(!r||r.trim()==="")return{success:!1,command:t.command,filepath:t.filepath,error:'Missing required option: "label"'};let i=r.trim(),s=await this.fsAdapter.readFile(e),a=this.frontmatterService.updateProperty(s,"exo__Asset_label",`"${i}"`);return await this.fsAdapter.updateFile(e,a),{success:!0,command:t.command,filepath:t.filepath,action:`Updated label to "${i}"`,changes:{label:i}}}async executeSchedule(e,t){let r=t.options?.date;if(!r)return{success:!1,command:t.command,filepath:t.filepath,error:'Missing required option: "date"'};if(!/^\d{4}-\d{2}-\d{2}$/.test(r))return{success:!1,command:t.command,filepath:t.filepath,error:`Invalid date format: ${r}. Expected YYYY-MM-DD`};let i=await this.fsAdapter.readFile(e),s=Gl.DateFormatter.toTimestampAtStartOfDay(r),a=this.frontmatterService.updateProperty(i,"ems__Effort_scheduledTimestamp",s);return await this.fsAdapter.updateFile(e,a),{success:!0,command:t.command,filepath:t.filepath,action:`Scheduled for ${r}`,changes:{scheduledTimestamp:s}}}async executeSetDeadline(e,t){let r=t.options?.date;if(!r)return{success:!1,command:t.command,filepath:t.filepath,error:'Missing required option: "date"'};if(!/^\d{4}-\d{2}-\d{2}$/.test(r))return{success:!1,command:t.command,filepath:t.filepath,error:`Invalid date format: ${r}. Expected YYYY-MM-DD`};let i=await this.fsAdapter.readFile(e),s=Gl.DateFormatter.toTimestampAtStartOfDay(r),a=this.frontmatterService.updateProperty(i,"ems__Effort_deadlineTimestamp",s);return await this.fsAdapter.updateFile(e,a),{success:!0,command:t.command,filepath:t.filepath,action:`Set deadline to ${r}`,changes:{deadlineTimestamp:s}}}async executeRepairFolder(e,t){let i=(await this.fsAdapter.getFileMetadata(e))?.exo__Asset_isDefinedBy;if(!i)return{success:!1,command:t.command,filepath:t.filepath,error:"Cannot determine expected folder: missing exo__Asset_isDefinedBy"};let s=this.extractReference(i);if(!s)return{success:!1,command:t.command,filepath:t.filepath,error:"Cannot determine expected folder: invalid exo__Asset_isDefinedBy format"};let a=await this.findReferencedFile(s,e);if(!a)return{success:!1,command:t.command,filepath:t.filepath,error:`Cannot determine expected folder: referenced asset not found: ${s}`};let c=Ko.default.dirname(a),l=c==="."?"":c,u=Ko.default.dirname(e),f=u==="."?"":u;if(this.normalizePath(f)===this.normalizePath(l))return{success:!0,command:t.command,filepath:t.filepath,action:"Already in correct folder",changes:{moved:!1,folder:l||"(root)"}};let d=Ko.default.basename(e),h=l?`${l}/${d}`:d;return await this.fsAdapter.fileExists(h)?{success:!1,command:t.command,filepath:t.filepath,error:`Cannot move file: ${h} already exists`}:(await this.fsAdapter.renameFile(e,h),{success:!0,command:t.command,filepath:t.filepath,action:`Moved to ${l||"(root)"}`,changes:{moved:!0,oldPath:e,newPath:h,expectedFolder:l||"(root)"}})}extractReference(e){if(typeof e!="string")return null;let t=e.trim().replace(/^["']|["']$/g,"");return t=t.replace(/^\[\[|\]\]$/g,""),t||null}async findReferencedFile(e,t){let r=e.endsWith(".md")?e:`${e}.md`;if(e.includes("/")&&await this.fsAdapter.fileExists(r))return r;let i=Ko.default.dirname(t),s=i!=="."?`${i}/${r}`:r;if(await this.fsAdapter.fileExists(s))return s;let c=await this.fsAdapter.findFileByUID(e);return c||(await this.fsAdapter.getMarkdownFiles()).find(f=>{let d=Ko.default.basename(f,".md"),h=Ko.default.basename(r,".md");return d===h})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};function vQ(n,e){if(n==="json"){let t=Z.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
|
|
624
624
|
\u{1F4E6} Batch Execution ${e.success?"Complete":"Failed"}`),console.log(` Total: ${e.total} operations`),console.log(` \u2705 Succeeded: ${e.succeeded}`),console.log(` \u274C Failed: ${e.failed}`),console.log(` \u23F1\uFE0F Duration: ${e.durationMs}ms`),e.atomic&&console.log(` \u{1F512} Atomic mode: ${e.rolledBack?"Rolled back":"Committed"}`),e.failed>0){console.log(`
|
|
625
625
|
\u{1F4CB} Failed Operations:`);for(let t of e.results.filter(r=>!r.success))console.log(` \u274C ${t.command} ${t.filepath}: ${t.error}`)}if(e.succeeded>0&&n==="text"){console.log(`
|
|
626
626
|
\u{1F4CB} Successful Operations:`);for(let t of e.results.filter(r=>r.success))console.log(` \u2705 ${t.command} ${t.filepath}: ${t.action}`)}}}o(vQ,"outputResult");function aF(){return new Ie("batch").description("Execute multiple operations in a single CLI invocation").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--input <json>","JSON array of operations to execute").option("--file <path>","Path to JSON file containing operations").option("--atomic","All-or-nothing execution (rollback on any failure)").option("--dry-run","Preview changes without modifying files").option("--format <type>","Output format: text|json (default: text)","text").action(async n=>{let e=n.format||"text";D.setFormat(e);try{let t=(0,Vw.resolve)(n.vault),r;if(n.input)r=n.input;else if(n.file){let c=(0,Vw.resolve)(n.file);if(!Uw.default.existsSync(c))throw new Qe(`Batch file not found: ${c}`,"exocortex batch --file operations.json");r=await Uw.default.readFile(c,"utf-8")}else throw new Qe("Either --input or --file option is required",`exocortex batch --input '[{"command":"start","filepath":"task.md"}]' or exocortex batch --file operations.json`);let i=Xo.parseInput(r);if(i.length===0)throw new Qe("Batch input contains no operations",`exocortex batch --input '[{"command":"start","filepath":"task.md"}]'`);let a=await new Xo(t,n.dryRun).executeBatch(i,n.atomic);vQ(e,a),process.exit(a.success?0:5)}catch(t){D.handle(t)}})}o(aF,"batchCommand");var oF=require("path");function wQ(n,e){if(n==="json"){let t=Z.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
|
|
@@ -628,17 +628,17 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
628
628
|
\u{1F4CB} Failed Files:`);for(let t of e.results.filter(r=>!r.success))console.log(` \u274C ${t.filepath}: ${t.error}`)}if(e.movedCount>0&&n==="text"){console.log(`
|
|
629
629
|
\u{1F4CB} Moved Files:`);for(let t of e.results.filter(r=>r.success&&r.changes?.moved))console.log(` \u{1F4C1} ${t.filepath} \u2192 ${t.changes?.newPath}`)}}}o(wQ,"outputResult");function cF(){return new Ie("batch-repair").description("Batch repair folder locations for all markdown files in a directory").argument("<directory>","Directory to process (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--dry-run","Preview changes without modifying files").option("--format <type>","Output format: text|json (default: text)","text").option("--progress","Show progress during processing (default: true)",!0).option("--no-progress","Disable progress output").action(async(n,e)=>{let t=e.format||"text";D.setFormat(t);try{let r=(0,oF.resolve)(e.vault),i=new It(r),s=n;if(!await i.directoryExists(s))throw new Qe(`Directory not found: ${s}`,"exocortex batch-repair <existing-directory>");let c=await i.getMarkdownFiles(s);if(c.length===0){if(t==="json"){let v=Z.success({success:!0,total:0,movedCount:0,alreadyCorrectCount:0,errorCount:0,results:[],durationMs:0,atomic:!1});console.log(JSON.stringify(v,null,2))}else console.log(`
|
|
630
630
|
\u{1F4C2} No markdown files found in ${s}`);process.exit(0)}let l=c.map(v=>({command:"repair-folder",filepath:v})),u=e.progress!==!1&&t==="text",f=0;u&&console.log(`
|
|
631
|
-
\u{1F50D} Processing ${c.length} files in ${s}...`);let h=await new Xo(r,e.dryRun).executeBatch(l,!1),p=0,_=0,b=0;for(let v of h.results)if(v.success?v.changes?.moved?p++:_++:b++,u&&!e.dryRun){f++;let A=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${A}%)...`)}u&&process.stdout.write("\r"+" ".repeat(60)+"\r");let E={...h,movedCount:p,alreadyCorrectCount:_,errorCount:b};wQ(t,E),process.exit(E.success?0:5)}catch(r){D.handle(r)}})}o(cF,"batchRepairCommand");var kg=require("fs"),Ui=require("path");function lF(){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";D.setFormat(t);try{let r=Date.now();if(!EQ(n))throw new Qe(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,Ui.resolve)(e.vault);if(!(0,kg.existsSync)(i))throw new Te(i);let s=TQ(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=Z.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?xQ(s,i,e.format,t,n,a):AQ(s[0],i,e.format,t,n,a)}catch(r){D.handle(r)}})}o(lF,"resolveCommand");function EQ(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(EQ,"isValidUuidFormat");function TQ(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,kg.readdirSync)(a,{withFileTypes:!0});for(let l of c){let u=(0,Ui.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(TQ,"findFilesWithUuid");function uF(n){return`obsidian://vault/${encodeURI(n)}`}o(uF,"pathToObsidianUri");function fF(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,Ui.basename)(n,".md")}o(fF,"extractUuidFromFilename");function AQ(n,e,t,r,i,s){let a=(0,Ui.relative)(e,n),c=uF(a),l=fF((0,Ui.basename)(n));if(r==="json"){let u={uuid:l,path:a,absolutePath:n,uri:c},f=Z.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(AQ,"outputSingleResult");function xQ(n,e,t,r,i,s){let a=n.map(c=>{let l=(0,Ui.relative)(e,c),u=uF(l);return{uuid:fF((0,Ui.basename)(c)),path:l,absolutePath:c,uri:u}});if(r==="json"){let c=Z.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(xQ,"outputMultipleResults");var dF=require("fs"),hF=require("path"),In=K(
|
|
632
|
-
`);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
|
|
631
|
+
\u{1F50D} Processing ${c.length} files in ${s}...`);let h=await new Xo(r,e.dryRun).executeBatch(l,!1),p=0,_=0,b=0;for(let v of h.results)if(v.success?v.changes?.moved?p++:_++:b++,u&&!e.dryRun){f++;let A=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${A}%)...`)}u&&process.stdout.write("\r"+" ".repeat(60)+"\r");let E={...h,movedCount:p,alreadyCorrectCount:_,errorCount:b};wQ(t,E),process.exit(E.success?0:5)}catch(r){D.handle(r)}})}o(cF,"batchRepairCommand");var kg=require("fs"),Ui=require("path");function lF(){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";D.setFormat(t);try{let r=Date.now();if(!EQ(n))throw new Qe(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,Ui.resolve)(e.vault);if(!(0,kg.existsSync)(i))throw new Te(i);let s=TQ(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=Z.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?xQ(s,i,e.format,t,n,a):AQ(s[0],i,e.format,t,n,a)}catch(r){D.handle(r)}})}o(lF,"resolveCommand");function EQ(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(EQ,"isValidUuidFormat");function TQ(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,kg.readdirSync)(a,{withFileTypes:!0});for(let l of c){let u=(0,Ui.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(TQ,"findFilesWithUuid");function uF(n){return`obsidian://vault/${encodeURI(n)}`}o(uF,"pathToObsidianUri");function fF(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,Ui.basename)(n,".md")}o(fF,"extractUuidFromFilename");function AQ(n,e,t,r,i,s){let a=(0,Ui.relative)(e,n),c=uF(a),l=fF((0,Ui.basename)(n));if(r==="json"){let u={uuid:l,path:a,absolutePath:n,uri:c},f=Z.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(AQ,"outputSingleResult");function xQ(n,e,t,r,i,s){let a=n.map(c=>{let l=(0,Ui.relative)(e,c),u=uF(l);return{uuid:fF((0,Ui.basename)(c)),path:l,absolutePath:c,uri:u}});if(r==="json"){let c=Z.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(xQ,"outputMultipleResults");var dF=require("fs"),hF=require("path"),In=K(Gt());function pF(){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";D.setFormat(t);try{let r=Date.now(),i=(0,hF.resolve)(e.vault);if(!(0,dF.existsSync)(i))throw new Te(i);let s=new In.NLToSPARQLService;t==="text"&&console.log(`\u{1F9E0} Analyzing question: "${n}"
|
|
632
|
+
`);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 zt(i),f=await new In.NoteToRDFConverter(l).convertVault(),d=new In.InMemoryTripleStore;await d.addAll(f);let h=Date.now()-c;t==="text"&&console.log(`\u2705 Loaded ${f.length} triples in ${h}ms
|
|
633
633
|
`);let p=a.query;p=ug(p),p=Pl(p);let _=new In.ExoQLParser,b=Lf(Nf(i));b.size>0&&_.setVaultPrefixes(b);let E=_.parse(p),A=new In.ExoQLAlgebraTranslator().translate(E);A=new In.AlgebraOptimizer().optimize(A);let B=Date.now(),ve=await new In.ExoQLQueryExecutor(d).executeAll(A),z=Date.now()-B,G=Date.now()-r,F=s.getSuggestions(n);if(t==="json"){let j=ve.map(st=>st.toJSON()),ee={question:n,query:a.query,template:a.templateName,parameters:a.parameters,confidence:a.confidence,explanation:a.explanation,count:ve.length,bindings:j,suggestions:F.length>0?F:void 0},Ye=Z.success(ee,{durationMs:G,itemCount:ve.length,loadDurationMs:h,execDurationMs:z,triplesScanned:f.length});console.log(JSON.stringify(Ye,null,2))}else{if(console.log(`\u2705 Found ${ve.length} result(s) in ${z}ms
|
|
634
634
|
`),ve.length>0?CQ(ve,e.format):console.log("No results found."),F.length>0){console.log(`
|
|
635
635
|
\u{1F4A1} Suggestions:`);for(let j of F)console.log(` \u2022 ${j}`)}if(a.confidence<.6&&a.alternatives.length>0){console.log(`
|
|
636
636
|
\u{1F504} Alternative queries that might work better:`);for(let j=0;j<Math.min(2,a.alternatives.length);j++)console.log(` ${j+1}. ${a.alternatives[j].split(`
|
|
637
|
-
`).slice(-3)[0]?.trim()||"..."}`)}}}catch(r){D.handle(r)}})}o(pF,"askCommand");function CQ(n,e){let t=n;switch(e){case"json":let r=new Tl;console.log(r.format(t));break;case"table":default:let i=new El;console.log(i.format(t));break}}o(CQ,"formatResults");var Hl=require("path"),Ql=require("fs"),Jo=K(ce()),za=K(
|
|
637
|
+
`).slice(-3)[0]?.trim()||"..."}`)}}}catch(r){D.handle(r)}})}o(pF,"askCommand");function CQ(n,e){let t=n;switch(e){case"json":let r=new Tl;console.log(r.format(t));break;case"table":default:let i=new El;console.log(i.format(t));break}}o(CQ,"formatResults");var Hl=require("path"),Ql=require("fs"),Jo=K(ce()),za=K(Gt());var Cme=K(Fd()),zl=K(ce()),sd=K(Gt());var Mg=class{constructor(e="exocortex-cli"){this.appName=e}static{o(this,"NodeLogger")}debug(e,t){console.debug(`[${this.appName}]`,e,t||"")}info(e,t){console.info(`[${this.appName}]`,e,t||"")}warn(e,t){console.warn(`[${this.appName}]`,e,t||"")}error(e,t,r){console.error(`[${this.appName}]`,e,t||"",r||""),t?.stack&&console.error(t.stack)}};var jg=class{constructor(){this.handlers=new Map}static{o(this,"NodeEventBus")}publish(e,t){let r=this.handlers.get(e);r&&r.forEach(i=>{try{i(t)}catch(s){console.error(`[EventBus] Error in handler for event "${e}":`,s)}})}subscribe(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){let r=this.handlers.get(e);r&&(r.delete(t),r.size===0&&this.handlers.delete(e))}};var Bg=K(require("fs/promises")),mF=K(require("path")),gF=K(require("os"));var $g=class{constructor(e=".exocortexrc"){this.config={};this.configPath=mF.join(gF.homedir(),e)}static{o(this,"NodeConfiguration")}async load(){try{let e=await Bg.readFile(this.configPath,"utf-8");this.config=JSON.parse(e)}catch{this.config={}}}get(e){let t=e.split("."),r=this.config;for(let i of t)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return r}async set(e,t){let r=e.split("."),i=r.pop(),s=this.config;for(let a of r)(!s[a]||typeof s[a]!="object")&&(s[a]={}),s=s[a];s[i]=t,await this.save()}getAll(){return{...this.config}}async save(){await Bg.writeFile(this.configPath,JSON.stringify(this.config,null,2),"utf-8")}};var yF=K(require("readline"));var Vg=class{static{o(this,"NodeNotificationService")}info(e,t){console.log(`\u2139 ${e}`)}success(e,t){console.log(`\u2713 ${e}`)}error(e,t){console.error(`\u2717 ${e}`)}warn(e,t){console.warn(`\u26A0 ${e}`)}async confirm(e,t){let r=yF.createInterface({input:process.stdin,output:process.stdout});return new Promise(i=>{r.question(`${e}
|
|
638
638
|
${t}
|
|
639
|
-
Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes")})})}};var Ug=class{static{o(this,"CLIContainer")}static setup(){zl.container.register(sd.DI_TOKENS.ILogger,{useFactory:o(()=>new Mg("exocortex-cli"),"useFactory")}),zl.container.register(sd.DI_TOKENS.IEventBus,{useClass:jg}),zl.container.register(sd.DI_TOKENS.IConfiguration,{useClass:$g}),zl.container.register(sd.DI_TOKENS.INotificationService,{useClass:Vg})}static reset(){zl.container.clearInstances()}};function ad(n){Ug.setup(),Jo.container.register(za.DI_TOKENS.IVaultAdapter,{useFactory:o(()=>new
|
|
639
|
+
Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes")})})}};var Ug=class{static{o(this,"CLIContainer")}static setup(){zl.container.register(sd.DI_TOKENS.ILogger,{useFactory:o(()=>new Mg("exocortex-cli"),"useFactory")}),zl.container.register(sd.DI_TOKENS.IEventBus,{useClass:jg}),zl.container.register(sd.DI_TOKENS.IConfiguration,{useClass:$g}),zl.container.register(sd.DI_TOKENS.INotificationService,{useClass:Vg})}static reset(){zl.container.clearInstances()}};function ad(n){Ug.setup(),Jo.container.register(za.DI_TOKENS.IVaultAdapter,{useFactory:o(()=>new zt(n),"useFactory")})}o(ad,"setupContainer");function IQ(n){if(n.length===0)return"No practices found.";let e=[];for(let t of n){let r="\u2B1C";t.doneToday?r="\u2705":t.inProgressToday&&(r="\u{1F504}");let i=t.estimatedDuration?` (${t.estimatedDuration}m)`:"";e.push(`${r} ${t.label}${i}`)}return e.join(`
|
|
640
640
|
`)}o(IQ,"formatPractices");function RQ(n){let e=[`\u{1F4C5} Daily Review: ${n.date}`,"","\u{1F4CA} Tasks:",` Planned: ${n.plannedCount}`,` Completed: ${n.completedCount}`,` In Progress: ${n.inProgressCount}`,` Progress: ${n.completionPercentage}%`,"",`\u23F1\uFE0F Total time: ${Math.round(n.totalTimeMinutes)} minutes`];if(n.practicesDue.length>0){e.push(""),e.push(`\u{1F4CB} Practices due (${n.practicesDue.length}):`);for(let t of n.practicesDue){let r=t.estimatedDuration?` (${t.estimatedDuration}m)`:"";e.push(` \u2B1C ${t.label}${r}`)}}return e.join(`
|
|
641
|
-
`)}o(RQ,"formatSummary");function _F(){let n=new Ie("daily").description("Daily review operations for mobile-friendly workflow");return n.command("practices").description("List today's practices (recurring tasks)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async e=>{let t=e.format||"text";D.setFormat(t);try{let r=(0,Hl.resolve)(e.vault);if(!(0,Ql.existsSync)(r))throw new Te(r);ad(r);let s=await Jo.container.resolve(za.DailyReviewService).getPractices();if(t==="json"){let a=Z.success({practices:s,count:s.length});console.log(JSON.stringify(a,null,2))}else console.log(IQ(s))}catch(r){D.handle(r)}}),n.command("summary").description("Show today's daily review summary").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").option("--date <value>","Date in YYYY-MM-DD format (default: today)").action(async e=>{let t=e.format||"text";D.setFormat(t);try{let r=(0,Hl.resolve)(e.vault);if(!(0,Ql.existsSync)(r))throw new Te(r);ad(r);let i=Jo.container.resolve(za.DailyReviewService),s;if(e.date&&(s=new Date(e.date),isNaN(s.getTime())))throw new Qe(`Invalid date format: ${e.date}`,"exocortex daily summary --date YYYY-MM-DD",{date:e.date});let a=await i.getDailyReviewSummary(s);if(t==="json"){let c=Z.success(a);console.log(JSON.stringify(c,null,2))}else console.log(RQ(a))}catch(r){D.handle(r)}}),n.command("log").description("Quick capture an activity").argument("<label>","Activity label/description").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").option("--start","Start the task immediately (default: true)").option("--no-start","Don't start the task immediately").action(async(e,t)=>{let r=t.format||"text";D.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,Ql.existsSync)(i))throw new Te(i);ad(i);let s=Jo.container.resolve(za.DailyReviewService),a=t.start!==!1,c=await s.quickCapture(e,a);if(r==="json"){let l=Z.success(c);console.log(JSON.stringify(l,null,2))}else{let l=c.started?"\u{1F504}":"\u2B1C";console.log(`${l} Created: ${c.label}`),console.log(` Path: ${c.path}`)}}catch(i){D.handle(i)}}),n.command("start").description("Start a practice (create task instance from prototype)").argument("<prototype-uid>","Practice/prototype UID to start").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async(e,t)=>{let r=t.format||"text";D.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,Ql.existsSync)(i))throw new Te(i);ad(i);let a=await Jo.container.resolve(za.DailyReviewService).createFromPractice({prototypeUid:e,startImmediately:!0});if(r==="json"){let c=Z.success(a);console.log(JSON.stringify(c,null,2))}else console.log(`\u{1F504} Started: ${a.label}`),console.log(` Path: ${a.path}`)}catch(i){D.handle(i)}}),n.command("done").description("Mark a practice as done").argument("<prototype-uid>","Practice/prototype UID to mark as done").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async(e,t)=>{let r=t.format||"text";D.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,Ql.existsSync)(i))throw new Te(i);if(ad(i),await Jo.container.resolve(za.DailyReviewService).markPracticeDone(e),r==="json"){let a=Z.success({prototypeUid:e,status:"done"});console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 Marked as done: ${e}`)}catch(i){D.handle(i)}}),n}o(_F,"dailyReviewCommand");var TF=require("fs"),AF=require("path");var Ha=require("fs"),Zo=require("path"),SF=require("child_process"),ti=K(
|
|
641
|
+
`)}o(RQ,"formatSummary");function _F(){let n=new Ie("daily").description("Daily review operations for mobile-friendly workflow");return n.command("practices").description("List today's practices (recurring tasks)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async e=>{let t=e.format||"text";D.setFormat(t);try{let r=(0,Hl.resolve)(e.vault);if(!(0,Ql.existsSync)(r))throw new Te(r);ad(r);let s=await Jo.container.resolve(za.DailyReviewService).getPractices();if(t==="json"){let a=Z.success({practices:s,count:s.length});console.log(JSON.stringify(a,null,2))}else console.log(IQ(s))}catch(r){D.handle(r)}}),n.command("summary").description("Show today's daily review summary").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").option("--date <value>","Date in YYYY-MM-DD format (default: today)").action(async e=>{let t=e.format||"text";D.setFormat(t);try{let r=(0,Hl.resolve)(e.vault);if(!(0,Ql.existsSync)(r))throw new Te(r);ad(r);let i=Jo.container.resolve(za.DailyReviewService),s;if(e.date&&(s=new Date(e.date),isNaN(s.getTime())))throw new Qe(`Invalid date format: ${e.date}`,"exocortex daily summary --date YYYY-MM-DD",{date:e.date});let a=await i.getDailyReviewSummary(s);if(t==="json"){let c=Z.success(a);console.log(JSON.stringify(c,null,2))}else console.log(RQ(a))}catch(r){D.handle(r)}}),n.command("log").description("Quick capture an activity").argument("<label>","Activity label/description").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").option("--start","Start the task immediately (default: true)").option("--no-start","Don't start the task immediately").action(async(e,t)=>{let r=t.format||"text";D.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,Ql.existsSync)(i))throw new Te(i);ad(i);let s=Jo.container.resolve(za.DailyReviewService),a=t.start!==!1,c=await s.quickCapture(e,a);if(r==="json"){let l=Z.success(c);console.log(JSON.stringify(l,null,2))}else{let l=c.started?"\u{1F504}":"\u2B1C";console.log(`${l} Created: ${c.label}`),console.log(` Path: ${c.path}`)}}catch(i){D.handle(i)}}),n.command("start").description("Start a practice (create task instance from prototype)").argument("<prototype-uid>","Practice/prototype UID to start").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async(e,t)=>{let r=t.format||"text";D.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,Ql.existsSync)(i))throw new Te(i);ad(i);let a=await Jo.container.resolve(za.DailyReviewService).createFromPractice({prototypeUid:e,startImmediately:!0});if(r==="json"){let c=Z.success(a);console.log(JSON.stringify(c,null,2))}else console.log(`\u{1F504} Started: ${a.label}`),console.log(` Path: ${a.path}`)}catch(i){D.handle(i)}}),n.command("done").description("Mark a practice as done").argument("<prototype-uid>","Practice/prototype UID to mark as done").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async(e,t)=>{let r=t.format||"text";D.setFormat(r);try{let i=(0,Hl.resolve)(t.vault);if(!(0,Ql.existsSync)(i))throw new Te(i);if(ad(i),await Jo.container.resolve(za.DailyReviewService).markPracticeDone(e),r==="json"){let a=Z.success({prototypeUid:e,status:"done"});console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 Marked as done: ${e}`)}catch(i){D.handle(i)}}),n}o(_F,"dailyReviewCommand");var TF=require("fs"),AF=require("path");var Ha=require("fs"),Zo=require("path"),SF=require("child_process"),ti=K(Gt());var OQ=new Set(["aliases","archived","tags","cssclasses","publish","permalink","description","image","cover","banner","title","share","share_link","share_updated","metadata","uri"]),bF=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 PQ(n){let e=n.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return n.match(/^---\r?\n---/)?{}:null;let t=e[1].split(`
|
|
642
642
|
`),r={};for(let i of t){let s=i.match(/^(\w[\w]*):\s*(.*)$/);s&&(r[s[1]]=!0)}return r}o(PQ,"extractFrontmatter");function vF(n){for(let e of bF.keys())if(n.startsWith(e))return!0;return!1}o(vF,"hasKnownPrefix");function wF(n){for(let[e,t]of bF)if(n.startsWith(e))return t+n.substring(e.length);return null}o(wF,"keyToURI");function FQ(n){let e=[],t=[];for(let r of n)OQ.has(r)||(vF(r)?e.push(r):t.push(r));return{toValidate:e,unknownPrefix:t}}o(FQ,"classifyKeys");function DQ(n){try{return(0,SF.execSync)("git diff --cached --name-only",{cwd:n,encoding:"utf-8"}).split(`
|
|
643
643
|
`).filter(t=>t.endsWith(".md")&&t.trim().length>0)}catch{return[]}}o(DQ,"getStagedMdFiles");function NQ(n){let e=[];function t(r){let i=(0,Ha.readdirSync)(r);for(let s of i){if(s.startsWith(".")||s==="node_modules")continue;let a=(0,Zo.join)(r,s);(0,Ha.statSync)(a).isDirectory()?t(a):s.endsWith(".md")&&e.push((0,Zo.relative)(n,a))}}return o(t,"walk"),t(n),e}o(NQ,"collectMdFiles");function LQ(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)),vF(t)?t:null}o(LQ,"extractPropertyNameFromURI");async function kQ(n){let e=new ti.InMemoryTripleStore;await e.addAll(n);let t=new ti.ExoQLParser,r=Pl(`SELECT ?s ?label WHERE {
|
|
644
644
|
{
|
|
@@ -657,14 +657,14 @@ Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes
|
|
|
657
657
|
FILTER(!CONTAINS(STR(?class), "PropertyCardinality"))
|
|
658
658
|
}
|
|
659
659
|
OPTIONAL { ?s exo:Asset_label ?label }
|
|
660
|
-
}`),i=t.parse(r),a=new ti.ExoQLAlgebraTranslator().translate(i);a=new ti.AlgebraOptimizer().optimize(a);let u=await new ti.ExoQLQueryExecutor(e).executeAll(a),f=new Set;for(let d of u){let h=d.toJSON(),p=h.s;if(typeof p=="string"){let b=LQ(p);if(b){let E=wF(b);E&&f.add(E)}}let _=h.label;typeof _=="string"&&_.startsWith("https://exocortex.my/ontology/")&&f.add(_)}return f}o(kQ,"loadDeclaredProperties");function MQ(n,e,t){let r=[],i;try{i=(0,Ha.readFileSync)(n,"utf-8")}catch{return[]}let s=PQ(i);if(!s)return[];let a=Object.keys(s),{toValidate:c,unknownPrefix:l}=FQ(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=wF(u);f&&!t.has(f)&&r.push({file:e,property:u,reason:`Property "${u}" is not declared in the ontology`})}return r}o(MQ,"validateFile");function EF(){return new Ie("schema").description("Check frontmatter properties against ontology (Issue #2713)").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)").option("--use-cache","Use persistent triple cache (faster vault loading)").action(async n=>{let e=n.output||"text";D.setFormat(e);try{let t=(0,Zo.resolve)(n.vault);if(!(0,Ha.existsSync)(t))throw new Te(t);let r;if(n.staged){if(r=DQ(t),r.length===0){if(e==="json"){let l=Z.success({vaultPath:t,filesChecked:0,violations:[],healthy:!0});console.log(JSON.stringify(l,null,2))}else console.log("\u2705 No staged .md files to validate.");return}}else r=NQ(t);e==="text"&&console.log(`\u{1F4E6} Loading vault: ${t}...`);let i;if(n.useCache){let u=await new Kn(t).loadOrBuild();i=u.triples,e==="text"&&u.cacheHit&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let l=new
|
|
660
|
+
}`),i=t.parse(r),a=new ti.ExoQLAlgebraTranslator().translate(i);a=new ti.AlgebraOptimizer().optimize(a);let u=await new ti.ExoQLQueryExecutor(e).executeAll(a),f=new Set;for(let d of u){let h=d.toJSON(),p=h.s;if(typeof p=="string"){let b=LQ(p);if(b){let E=wF(b);E&&f.add(E)}}let _=h.label;typeof _=="string"&&_.startsWith("https://exocortex.my/ontology/")&&f.add(_)}return f}o(kQ,"loadDeclaredProperties");function MQ(n,e,t){let r=[],i;try{i=(0,Ha.readFileSync)(n,"utf-8")}catch{return[]}let s=PQ(i);if(!s)return[];let a=Object.keys(s),{toValidate:c,unknownPrefix:l}=FQ(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=wF(u);f&&!t.has(f)&&r.push({file:e,property:u,reason:`Property "${u}" is not declared in the ontology`})}return r}o(MQ,"validateFile");function EF(){return new Ie("schema").description("Check frontmatter properties against ontology (Issue #2713)").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)").option("--use-cache","Use persistent triple cache (faster vault loading)").action(async n=>{let e=n.output||"text";D.setFormat(e);try{let t=(0,Zo.resolve)(n.vault);if(!(0,Ha.existsSync)(t))throw new Te(t);let r;if(n.staged){if(r=DQ(t),r.length===0){if(e==="json"){let l=Z.success({vaultPath:t,filesChecked:0,violations:[],healthy:!0});console.log(JSON.stringify(l,null,2))}else console.log("\u2705 No staged .md files to validate.");return}}else r=NQ(t);e==="text"&&console.log(`\u{1F4E6} Loading vault: ${t}...`);let i;if(n.useCache){let u=await new Kn(t).loadOrBuild();i=u.triples,e==="text"&&u.cacheHit&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let l=new zt(t);i=await new ti.NoteToRDFConverter(l).convertVault()}e==="text"&&(console.log(`\u2705 Loaded ${i.length} triples`),console.log("\u{1F50D} Querying ontology for declared properties..."));let s=await kQ(i);e==="text"&&(console.log(`\u{1F4CB} Found ${s.size} declared properties in ontology`),console.log(`\u{1F50D} Validating ${r.length} file(s)...
|
|
661
661
|
`));let a=[];for(let l of r){let u=(0,Zo.resolve)(t,l),f=MQ(u,l,s);a.push(...f)}let c={vaultPath:t,filesChecked:r.length,violations:a,healthy:a.length===0};if(e==="json"){let l=Z.success(c);console.log(JSON.stringify(l,null,2))}else if(a.length===0)console.log(`\u2705 All ${r.length} file(s) pass schema validation.`);else{let l=new Map;for(let u of a){let f=l.get(u.file)||[];f.push(u),l.set(u.file,f)}console.log(`\u26A0\uFE0F Found ${a.length} schema violation(s) in ${l.size} file(s):
|
|
662
662
|
`);for(let[u,f]of l){console.log(` \u274C ${u}`);for(let d of f)console.log(` \u2022 ${d.reason}`)}console.log(`
|
|
663
663
|
\u{1F4DD} To fix these issues:`),console.log(" - Remove undeclared properties from frontmatter"),console.log(" - Or declare them in the ontology as Property instances")}a.length>0&&(process.exitCode=1)}catch(t){D.handle(t)}})}o(EF,"validateSchemaCommand");function jQ(){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";D.setFormat(e);try{let t=(0,AF.resolve)(n.vault);if(!(0,TF.existsSync)(t))throw new Te(t);let r=new Kn(t);e==="text"&&console.log(`\u{1F50D} Validating vault: ${t}...`);let i=await r.validateVault();if(e==="json"){let s=Z.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(`
|
|
664
664
|
\u26A0\uFE0F Found ${i.length} file(s) with IRI issues:
|
|
665
665
|
`);for(let s of i)console.log(` \u274C ${s.path}`),console.log(` ${s.reason}`);console.log(`
|
|
666
666
|
\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(`
|
|
667
|
-
\u{1F4A1} Run 'exocortex sparql index --strict' to fail on first issue`)}i.length>0&&(process.exitCode=1)}catch(t){D.handle(t)}})}o(jQ,"validateIriCommand");function xF(){let n=new Ie("validate").description("Validate vault files (IRI checks, schema linting)");return n.addCommand(jQ()),n.addCommand(EF()),n}o(xF,"validateCommand");var CF=require("fs"),IF=require("path"),Er=K(
|
|
667
|
+
\u{1F4A1} Run 'exocortex sparql index --strict' to fail on first issue`)}i.length>0&&(process.exitCode=1)}catch(t){D.handle(t)}})}o(jQ,"validateIriCommand");function xF(){let n=new Ie("validate").description("Validate vault files (IRI checks, schema linting)");return n.addCommand(jQ()),n.addCommand(EF()),n}o(xF,"validateCommand");var CF=require("fs"),IF=require("path"),Er=K(Gt());function RF(){return new Ie("classes").description("List RDF classes in Obsidian vault or show class details").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";D.setFormat(t);try{let r=Date.now(),i=(0,IF.resolve)(e.vault);if(!(0,CF.existsSync)(i))throw new Te(i);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${i}...`);let s,a=!1;if(e.useCache){let f=await new Kn(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 zt(i);s=await new Er.NoteToRDFConverter(u).convertVault()}let c=new Er.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}
|
|
668
668
|
`)}n?await BQ(c,n,e,t):await $Q(c,e,t)}catch(r){D.handle(r)}})}o(RF,"classesCommand");async function $Q(n,e,t){let s=new Er.ExoQLParser().parse(`
|
|
669
669
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
670
670
|
SELECT ?class (COUNT(?instance) AS ?count)
|
|
@@ -695,7 +695,7 @@ Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes
|
|
|
695
695
|
`;a=s.parse(p),c=new Er.ExoQLAlgebraTranslator,l=c.translate(a),u=new Er.AlgebraOptimizer,l=u.optimize(l);let b=(await f.executeAll(l)).map(v=>{let A=v.get("property"),R=v.get("usageCount");return{name:A?OF(A.toString()):"unknown",usageCount:R?parseInt(R.toString(),10):0}}),E={name:e,instanceCount:h,properties:b};if(r==="json"||t.format==="json"){let v=Z.success(E);console.log(JSON.stringify(v,null,2))}else{if(console.log(`\u{1F4CB} Class: ${e}
|
|
696
696
|
`),console.log(` Instances: ${h}`),console.log(` Properties: ${b.length}
|
|
697
697
|
`),b.length===0){console.log(" No properties found.");return}let v=Math.max(...b.map(A=>A.name.length),10);console.log(" \u250C"+"\u2500".repeat(v+2)+"\u252C"+"\u2500".repeat(10)+"\u2510"),console.log(" \u2502 "+"Property".padEnd(v)+" \u2502 "+"Usage".padEnd(8)+" \u2502"),console.log(" \u251C"+"\u2500".repeat(v+2)+"\u253C"+"\u2500".repeat(10)+"\u2524");for(let A of b)console.log(" \u2502 "+A.name.padEnd(v)+" \u2502 "+A.usageCount.toString().padStart(8)+" \u2502");console.log(" \u2514"+"\u2500".repeat(v+2)+"\u2534"+"\u2500".repeat(10)+"\u2518")}}o(BQ,"showClassDetails");function OF(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(OF,"extractLocalName");var FF=require("path"),Gw=require("fs"),DF=require("fs");var qw=class extends Error{static{o(this,"ClassNotFoundError")}constructor(e,t){let r=`Class '${e}' not found in vault`;t&&t.length>0&&(r+=`
|
|
698
|
-
Available classes: ${t.join(", ")}`),super(r),this.name="ClassNotFoundError"}},Yl=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 qw(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 Ww=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"}},qg=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 Ww(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 PF=K(
|
|
698
|
+
Available classes: ${t.join(", ")}`),super(r),this.name="ClassNotFoundError"}},Yl=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 qw(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 Ww=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"}},qg=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 Ww(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 PF=K(Gt());var VQ="de20a3f1-7483-4714-ab28-b45f5cf02c76",UQ="Asia/Almaty",Wg=class{constructor(e,t,r){this.fsAdapter=e;this.classResolver=t;this.wikilinkValidator=r}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=td(),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||VQ,timestamp:s}),c=PF.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(s));return t}formatPropertyValue(e){return e.includes("[[")?[e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`]:e}generateTimestamp(e){let t=e||UQ,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 qQ(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(qQ,"parseProperties");async function WQ(n){if(n.bodyFile){if(!(0,Gw.existsSync)(n.bodyFile))throw new Error(`Body file not found: ${n.bodyFile}`);return(0,DF.readFileSync)(n.bodyFile,"utf-8")}if(n.body==="-")return GQ(3e4);if(n.body)return n.body}o(WQ,"resolveBody");function GQ(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(GQ,"readStdin");function NF(){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)",zQ,[]).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,FF.resolve)(n.vault);if(!(0,Gw.existsSync)(e))throw new Te(e);let t=qQ(n.property),r=await WQ(n);r&&(r=r.replace(/\\n/g,`
|
|
699
699
|
`));let i=new It(e),s=new Yl(i),a=new qg(i),l=await new Wg(i,s,a).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 f=HQ(l.frontmatter,r);process.stderr.write(f+`
|
|
700
700
|
`)}let u={uuid:l.uuid,path:l.path,label:l.label};process.stdout.write(JSON.stringify(u)+`
|
|
701
701
|
`),process.exit(0)}catch(e){D.handle(e)}})}o(NF,"createCommand");function zQ(n,e){return e.concat([n])}o(zQ,"collect");function HQ(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(`
|
|
@@ -727,7 +727,7 @@ ${Nr.dump(i,{lineWidth:-1})}---
|
|
|
727
727
|
`),c.isDefinedBy&&process.stderr.write(`isDefinedBy: ${c.isDefinedBy}
|
|
728
728
|
`),process.stderr.write(`--- END PREVIEW ---
|
|
729
729
|
`)),process.stdout.write(JSON.stringify(c)+`
|
|
730
|
-
`),process.exit(0)}catch(e){D.handle(e)}})}o(jF,"unarchiveCommand");var aa=require("fs"),Xl=require("path"),qi=K(
|
|
730
|
+
`),process.exit(0)}catch(e){D.handle(e)}})}o(jF,"unarchiveCommand");var aa=require("fs"),Xl=require("path"),qi=K(Gt());function BF(){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";D.setFormat(t);try{let r=(0,Xl.resolve)(e.vault);if(!(0,aa.existsSync)(r))throw new Te(r);let i=UF(r);if(t==="json"){let s=Z.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(`
|
|
731
731
|
\u{1F4CB} Found ${i.length} workflow(s):
|
|
732
732
|
`);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){D.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";D.setFormat(r);try{let i=(0,Xl.resolve)(t.vault);if(!(0,aa.existsSync)(i))throw new Te(i);let s=$F(i,e);if(!s){if(r==="json"){let a=Z.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=Z.success(s);console.log(JSON.stringify(a,null,2))}else{console.log(`
|
|
733
733
|
\u{1F4CB} Workflow: ${s.name}
|
|
@@ -735,7 +735,7 @@ ${Nr.dump(i,{lineWidth:-1})}---
|
|
|
735
735
|
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(`
|
|
736
736
|
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){D.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";D.setFormat(r);try{let i=(0,Xl.resolve)(t.vault);if(!(0,aa.existsSync)(i))throw new Te(i);let s=$F(i,e);if(!s){if(r==="json"){let l=Z.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 qi.WorkflowEngine(s).validate();if(r==="json"){let l=Z.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):
|
|
737
737
|
`);for(let l of c.errors)console.log(` \u2022 ${l}`);process.exitCode=1}}catch(i){D.handle(i)}}),n}o(BF,"workflowCommand");var VF=new qi.FrontmatterService;function UF(n){let e=[],t=[];qF(n,t);for(let{filePath:r,fm:i}of t){let s=i.exo__Instance_class;if(!s||!(Array.isArray(s)?s.some(p=>p.includes("ems__Workflow")&&!p.includes("WorkflowState")&&!p.includes("WorkflowTransition")):typeof s=="string"&&s.includes("ems__Workflow")&&!s.includes("WorkflowState")&&!s.includes("WorkflowTransition")))continue;let c=i.exo__Asset_uid??"",l=i.exo__Asset_label??YQ(r),u=sa(i.ems__Workflow_targetClass??"ems__Task"),f=i.ems__Workflow_isDefault===!0||i.ems__Workflow_isDefault==="true",d=0,h=0;for(let{fm:p}of t){let _=p.exo__Instance_class;if(!sa(p.ems__WorkflowState_workflow??p.ems__WorkflowTransition_workflow??"").includes(c))continue;let v=Array.isArray(_)?_.some(R=>R.includes("ems__WorkflowState")):typeof _=="string"&&_.includes("ems__WorkflowState"),A=Array.isArray(_)?_.some(R=>R.includes("ems__WorkflowTransition")):typeof _=="string"&&_.includes("ems__WorkflowTransition");v&&d++,A&&h++}e.push({filePath:r,uid:c,label:l,targetClass:u,isDefault:f,stateCount:d,transitionCount:h})}return e}o(UF,"scanWorkflows");function qF(n,e){let t;try{t=(0,aa.readdirSync)(n,{withFileTypes:!0})}catch{return}for(let r of t){let i=(0,Xl.join)(n,r.name);if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;qF(i,e)}else if(r.name.endsWith(".md"))try{let s=(0,aa.readFileSync)(i,"utf-8"),a=VF.parse(s);a.exists&&e.push({filePath:i,fm:WF(a.content)})}catch{}}}o(qF,"collectParsedFiles");function $F(n,e){let r=UF(n).find(i=>i.uid===e);if(!r)return null;try{let i=(0,aa.readFileSync)(r.filePath,"utf-8"),s=VF.parse(i);if(!s.exists)return null;let a=WF(s.content),c=sa(a.ems__Workflow_targetClass??"ems__Task"),l=sa(a.ems__Workflow_initialState??"ems__EffortStatusDraft"),u=Kl(l)??qi.EffortStatus.DRAFT,d=(Array.isArray(a.ems__Workflow_terminalStates)?a.ems__Workflow_terminalStates.map(v=>sa(v)):[]).map(Kl).filter(v=>v!==null),h=a.ems__Workflow_isDefault===!0||a.ems__Workflow_isDefault==="true",_=(Array.isArray(a.ems__Workflow_states)?a.ems__Workflow_states:[]).map((v,A)=>typeof v=="string"?{status:Kl(sa(v))??qi.EffortStatus.DRAFT,order:A+1,optional:!1,timestampOnEnter:[]}:{status:Kl(sa(v.status??""))??qi.EffortStatus.DRAFT,order:v.order??A+1,optional:v.optional===!0||v.optional==="true",timestampOnEnter:Array.isArray(v.timestampOnEnter)?v.timestampOnEnter:[],badgeColor:v.badgeColor}),E=(Array.isArray(a.ems__Workflow_transitions)?a.ems__Workflow_transitions:[]).map(v=>{let A=Kl(sa(v.from??"")),R=Kl(sa(v.to??""));return!A||!R?null:{from:A,to:R,label:v.label??`${A} \u2192 ${R}`,icon:v.icon,isRollback:v.isRollback===!0||v.isRollback==="true"}}).filter(v=>v!==null);return{id:e,name:r.label,targetClass:c,states:_,transitions:E,initialState:u,terminalStates:d.length>0?d:[qi.EffortStatus.DONE,qi.EffortStatus.TRASHED],isDefault:h}}catch{return null}}o($F,"loadWorkflowByUid");function WF(n){let e={},t=n.split(`
|
|
738
|
-
`),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(WF,"parseYamlFrontmatter");function sa(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(sa,"normalizeWikilink");function YQ(n){let e=n.split("/");return e[e.length-1].replace(/\.md$/,"")}o(YQ,"extractLabelFromFilename");function Kl(n){return Object.values(qi.EffortStatus).includes(n)?n:null}o(Kl,"resolveEffortStatus");var _s=require("fs"),Ss=require("path"),ke=K(
|
|
738
|
+
`),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(WF,"parseYamlFrontmatter");function sa(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(sa,"normalizeWikilink");function YQ(n){let e=n.split("/");return e[e.length-1].replace(/\.md$/,"")}o(YQ,"extractLabelFromFilename");function Kl(n){return Object.values(qi.EffortStatus).includes(n)?n:null}o(Kl,"resolveEffortStatus");var _s=require("fs"),Ss=require("path"),ke=K(Gt());var KQ=["updateProperty","removeProperty","setStatus","createAsset","openFile","sparqlSelect","getActiveFileIRI","getActiveFilePath","trashFile","duplicateFile"],Zw=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 XQ(n){return{async execute(){throw new Zw(n)}}}o(XQ,"notImplementedService");function Qa(n,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(Qa,"resolveTargetFile");function JQ(n,e){return{async execute(t,r){let i=r?.label;if(!i)throw new Error("createRelatedTask requires userInput.label");let s=Qa(n,t),a=n.getFrontmatter(s)??{},c=s.parent?.path||"",l={ems__Effort_status:'"[[ems__EffortStatusDraft]]"'},u=r?.parentProperty;u&&s.basename&&(l[u]=`"[[${s.basename}]]"`),await e.createAsset({className:"ems__Task",label:i,folderPath:c,propertyValues:l,parentFile:s,parentMetadata:a})}}}o(JQ,"createCreateRelatedTaskService");function ZQ(n,e){return{async execute(t,r){let i=r?.label;if(!i)throw new Error("createRelatedProject requires userInput.label");let s=Qa(n,t),a=n.getFrontmatter(s)??{},c=s.parent?.path||"",l={ems__Effort_status:'"[[ems__EffortStatusDraft]]"'},u=r?.parentProperty;u&&s.basename&&(l[u]=`"[[${s.basename}]]"`),await e.createAsset({className:"ems__Project",label:i,folderPath:c,propertyValues:l,parentFile:s,parentMetadata:a})}}}o(ZQ,"createCreateRelatedProjectService");function eY(n,e){return{async execute(t){let r=Qa(n,t);await e.archiveAsset(r)}}}o(eY,"createArchiveAssetService");function tY(n,e){return{async execute(t){let r=Qa(n,t);await e.cleanEmptyProperties(r)}}}o(tY,"createCleanPropertiesService");function rY(n,e){return{async execute(t){let r=Qa(n,t);await e.fixMissingLabel(r)}}}o(rY,"createFixMissingLabelService");function nY(n,e){return{async execute(t){let r=Qa(n,t),i=n.getFrontmatter(r)??{};await e.renameToUid(r,i)}}}o(nY,"createRenameToUidService");function iY(n,e){return{async execute(t){let r=Qa(n,t),i=n.getFrontmatter(r)??{},s=await e.getExpectedFolder(r,i);if(s===null)throw new Error("repairFolder: cannot determine expected folder (missing exo__Asset_isDefinedBy or referenced asset not found)");(r.parent?.path??"")!==s&&await e.repairFolder(r,s)}}}o(iY,"createRepairFolderService");function sY(n,e){return{async execute(t){let r=Qa(n,t);await e.planForEvening(r)}}}o(sY,"createPlanForEveningService");function GF(n,e){for(let t of KQ)n.register(t,XQ(t));e&&(n.register("createRelatedTask",JQ(e.vaultAdapter,e.genericAssetCreationService)),n.register("createRelatedProject",ZQ(e.vaultAdapter,e.genericAssetCreationService)),n.register("archiveAsset",eY(e.vaultAdapter,e.archiveAssetService)),n.register("planForEvening",sY(e.vaultAdapter,e.taskStatusService)),n.register("cleanProperties",tY(e.vaultAdapter,e.propertyCleanupService)),n.register("renameToUid",nY(e.vaultAdapter,e.renameToUidService)),n.register("repairFolder",iY(e.vaultAdapter,e.folderRepairService)),n.register("fixMissingLabel",rY(e.vaultAdapter,e.fixMissingLabelService)))}o(GF,"populateCliServiceRegistry");var aY=new ke.FrontmatterService;function zF(){let n=new Ie("dyncommand").description("Manage vault-defined dynamic commands (RFC-009)");return n.command("list").description("List all dynamic commands defined in vault").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").option("--target <iri>","Filter commands applicable to a specific asset IRI").action(async e=>{let t=e.output||"text";D.setFormat(t);try{let r=(0,Ss.resolve)(e.vault);if(!(0,_s.existsSync)(r))throw new Te(r);let i;if(e.target?i=await oY(r,e.target):i=e2(r),t==="json"){let s=Z.success({commands:i,totalCommands:i.length,...e.target&&{target:e.target}});console.log(JSON.stringify(s,null,2))}else{if(i.length===0){console.log("No dynamic commands found in vault.");return}let s=e.target?` for target ${e.target}`:"";console.log(`
|
|
739
739
|
\u{1F4CB} Found ${i.length} dynamic command(s)${s}:
|
|
740
740
|
`);let a=Math.max(...i.map(l=>l.label.length),4),c=Math.max(...i.map(l=>(l.category??"").length),8);console.log("\u250C"+"\u2500".repeat(a+2)+"\u252C"+"\u2500".repeat(c+2)+"\u252C"+"\u2500".repeat(14)+"\u252C"+"\u2500".repeat(14)+"\u2510"),console.log("\u2502 "+"Name".padEnd(a)+" \u2502 "+"Category".padEnd(c)+" \u2502 "+"Precondition".padEnd(12)+" \u2502 "+"Grounding".padEnd(12)+" \u2502"),console.log("\u251C"+"\u2500".repeat(a+2)+"\u253C"+"\u2500".repeat(c+2)+"\u253C"+"\u2500".repeat(14)+"\u253C"+"\u2500".repeat(14)+"\u2524");for(let l of i)console.log("\u2502 "+l.label.padEnd(a)+" \u2502 "+(l.category??"").padEnd(c)+" \u2502 "+(l.hasPrecondition?" yes ":" no ")+" \u2502 "+(l.groundingType??"").padEnd(12)+" \u2502");console.log("\u2514"+"\u2500".repeat(a+2)+"\u2534"+"\u2500".repeat(c+2)+"\u2534"+"\u2500".repeat(14)+"\u2534"+"\u2500".repeat(14)+"\u2518")}}catch(r){D.handle(r)}}),n.command("show").description("Show full details of a dynamic command").argument("<uid>","UID of the command 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";D.setFormat(r);try{let i=(0,Ss.resolve)(t.vault);if(!(0,_s.existsSync)(i))throw new Te(i);let{tripleStore:s}=await t2(i),a=new ke.CommandResolver(s),c=await a.loadCommand(e);if(!c){if(r==="json"){let f=Z.success({error:`Command with UID "${e}" not found`});console.log(JSON.stringify(f,null,2))}else console.log(`\u274C Command with UID "${e}" not found.`);process.exitCode=3;return}let u=(await a.findBindings()).filter(f=>f.commandRef===e);if(r==="json"){let f=Z.success({command:c,bindings:u});console.log(JSON.stringify(f,null,2))}else if(console.log(`
|
|
741
741
|
\u{1F4CB} Command: ${c.name}
|
|
@@ -746,9 +746,9 @@ ${Nr.dump(i,{lineWidth:-1})}---
|
|
|
746
746
|
Bindings (${u.length}):`);for(let f of u){let d=[];f.targetClass&&d.push(`class=${f.targetClass}`),f.targetPrototype&&d.push(`prototype=${f.targetPrototype}`),f.targetAsset&&d.push(`asset=${f.targetAsset}`),console.log(` \u2022 ${f.label||f.id}: ${d.join(", ")}`)}}else console.log(`
|
|
747
747
|
Bindings: none`)}catch(i){D.handle(i)}}),n.command("exec").description("Execute a dynamic command on a target asset").argument("<uid>","UID of the command to execute").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--target <filepath>","Path to target asset file (relative to vault)").option("--output <type>","Response format: text|json","text").option("--dry-run","Preview changes without modifying files").option("--input <json>",`JSON userInput for service_call groundings, e.g. '{"label":"Task name"}'`).action(async(e,t)=>{let r=t.output||"text";D.setFormat(r);try{let i=(0,Ss.resolve)(t.vault);if(!(0,_s.existsSync)(i))throw new Te(i);if(!t.target){console.error("\u274C --target option is required for exec command"),process.exitCode=2;return}let s=(0,Ss.resolve)(i,t.target);if(!(0,_s.existsSync)(s)){console.error(`\u274C Target file not found: ${t.target}`),process.exitCode=3;return}let{tripleStore:a}=await t2(i),l=await new ke.CommandResolver(a).loadCommand(e);if(!l){if(r==="json"){let F=Z.success({error:`Command with UID "${e}" not found`});console.log(JSON.stringify(F,null,2))}else console.log(`\u274C Command with UID "${e}" not found.`);process.exitCode=3;return}let u=t.target.replace(/\.md$/,"");if(!await new ke.PreconditionEvaluator(a).evaluate(l.precondition,u)){if(r==="json"){let F=Z.success({command:l.name,target:t.target,preconditionPassed:!1,executed:!1,reason:"Precondition not satisfied"});console.log(JSON.stringify(F,null,2))}else console.log(`\u274C Precondition not satisfied for command "${l.name}" on target "${t.target}".`),l.precondition&&(console.log(` Precondition: ${l.precondition.label}`),console.log(` SPARQL ASK: ${l.precondition.sparqlAsk}`));process.exitCode=5;return}if(t.dryRun){if(r==="json"){let F=Z.success({command:l.name,target:t.target,preconditionPassed:!0,dryRun:!0,grounding:l.grounding});console.log(JSON.stringify(F,null,2))}else console.log(`
|
|
748
748
|
\u{1F50D} Dry-run: command "${l.name}" on "${t.target}"
|
|
749
|
-
`),console.log(" Precondition: passed \u2705"),console.log(" Grounding (would execute):"),r2(l.grounding," ");return}let h=new ke.ServiceRegistry,p=new
|
|
750
|
-
`);for(let c of i){console.log(` \u{1F4C4} ${c.label} (${c.uid}):`);for(let l of c.issues)console.log(` \u2022 ${l}`);console.log()}process.exitCode=5}}}catch(r){D.handle(r)}}),n}o(zF,"dynamicCommandCommand");function e2(n){let e=[],t=[];n2(n,t);let r=HF(t);for(let{filePath:i,fm:s}of t){if(!Jl(s,"exocmd__Command",r))continue;let a=s.exo__Asset_uid??"",c=s.exo__Asset_label??QF(i),l=s.exocmd__Command_category,u=s.exocmd__Command_icon,f=!!s.exocmd__Command_precondition,d=s.exocmd__Command_grounding,h;if(d){let p=Kg(String(d)),_=t.find(b=>b.fm.exo__Asset_uid===p&&Jl(b.fm,"exocmd__Grounding",r));_&&(h=_.fm.exocmd__Grounding_type)}e.push({filePath:i,uid:a,label:c,category:l,icon:u,hasPrecondition:f,groundingType:h})}return e}o(e2,"scanCommands");async function oY(n,e){let{tripleStore:t}=await t2(n),r=new ke.CommandResolver(t),i=await r.findBindings(),s=new Set;for(let c of i)s.add(c.commandRef);let a=[];for(let c of s){let l=await r.loadCommand(c);l&&a.push({filePath:"",uid:l.id,label:l.name,category:l.category,icon:l.icon,hasPrecondition:!!l.precondition,groundingType:l.grounding.type})}return a}o(oY,"listCommandsForTarget");function cY(n){let e=[],t=[];n2(n,t);let r=HF(t),i=new Map;for(let s of t){let a=s.fm.exo__Asset_uid;a&&i.set(a,s)}for(let{filePath:s,fm:a}of t){if(!Jl(a,"exocmd__Command",r))continue;let c=a.exo__Asset_uid??"",l=a.exo__Asset_label??QF(s),u=[];c||u.push("Missing exo__Asset_uid"),a.exo__Asset_label||u.push("Missing exo__Asset_label");let f=a.exocmd__Command_grounding;if(!f)u.push("Missing exocmd__Command_grounding (required)");else{let p=Kg(String(f)),_=i.get(p);if(!_)u.push(`Grounding reference "${p}" not found in vault`);else if(!Jl(_.fm,"exocmd__Grounding",r))u.push(`Grounding reference "${p}" is not an exocmd__Grounding asset`);else{let b=_.fm,E=b.exocmd__Grounding_type;E?(Object.values(ke.GroundingType).includes(E)||u.push(`Grounding "${p}" has invalid type "${E}"`),(E===ke.GroundingType.PROPERTY_SET||E===ke.GroundingType.PROPERTY_DELETE)&&!b.exocmd__Grounding_targetProperty&&u.push(`Grounding "${p}" (${E}) missing targetProperty`),E===ke.GroundingType.PROPERTY_SET&&!b.exocmd__Grounding_targetValue&&u.push(`Grounding "${p}" (property_set) missing targetValue`),E===ke.GroundingType.SERVICE_CALL&&((b.exocmd__Grounding_serviceId??b.exocmd__Grounding_targetProperty)||u.push(`Grounding "${p}" (service_call) missing serviceId and targetProperty`))):u.push(`Grounding "${p}" missing exocmd__Grounding_type`)}}let d=a.exocmd__Command_precondition;if(d){let p=Kg(String(d)),_=i.get(p);if(!_)u.push(`Precondition reference "${p}" not found in vault`);else if(!Jl(_.fm,"exocmd__Precondition",r))u.push(`Precondition reference "${p}" is not an exocmd__Precondition asset`);else{let b=_.fm.exocmd__Precondition_sparqlAsk,E=_.fm.exocmd__Precondition_hostFunction;!b&&!E&&u.push(`Precondition "${p}" missing both sparqlAsk and hostFunction`)}}t.some(p=>Jl(p.fm,"exocmd__CommandBinding",r)?Kg(String(p.fm.exocmd__CommandBinding_command??""))===c:!1)||u.push("No CommandBinding references this command (command will be unused)"),u.length>0&&e.push({uid:c,label:l,filePath:s,issues:u})}return e}o(cY,"validateCommands");async function t2(n){let e=new
|
|
751
|
-
`),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(lY,"parseYamlFrontmatter");var uY=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function HF(n){let e=new Map;for(let{fm:t}of n){let r=t.exo__Asset_uid,i=t.exo__Asset_label;typeof r=="string"&&typeof i=="string"&&e.set(r,i)}return e}o(HF,"buildClassLabelIndex");function Jl(n,e,t){let r=n.exo__Instance_class;if(!r)return!1;let i=Array.isArray(r)?r:[r];for(let s of i){if(typeof s!="string")continue;let a=s.match(/\[\[([^|\]]+)/),c=a?a[1]:s;if(c===e||t&&uY.test(c)&&t.get(c)===e)return!0}return!1}o(Jl,"hasClass");function Kg(n){if(typeof n!="string")return"";let e=n.replace(/["'[\]]/g,"").trim(),t=e.indexOf("|");return t>=0?e.substring(0,t).trim():e}o(Kg,"normalizeWikilink");function QF(n){return(0,Ss.basename)(n,".md")}o(QF,"extractLabelFromFilename");var Zl=require("fs"),od=require("path"),Dt=K(
|
|
749
|
+
`),console.log(" Precondition: passed \u2705"),console.log(" Grounding (would execute):"),r2(l.grounding," ");return}let h=new ke.ServiceRegistry,p=new zt(i),_=new ke.GenericAssetCreationService(p),b=new ke.ArchiveAssetService(p),E=new ke.PropertyCleanupService(p),v=new ke.FixMissingLabelService(p),A=new ke.RenameToUidService(p),R=new ke.FolderRepairService(p),B=new ke.TaskStatusService(p,new ke.EffortStatusWorkflow,new ke.StatusTimestampService(p));GF(h,{vaultAdapter:p,genericAssetCreationService:_,archiveAssetService:b,taskStatusService:B,propertyCleanupService:E,fixMissingLabelService:v,renameToUidService:A,folderRepairService:R});let W=new It(i),ve=new ke.GroundingExecutor(W,W,h),z;if(t.input)try{let F=JSON.parse(t.input);if(typeof F!="object"||F===null||Array.isArray(F))throw new Error("must be a JSON object");z=F}catch(F){let j=F instanceof Error?F.message:String(F);console.error(`\u274C --input: invalid JSON object (${j})`),process.exitCode=2;return}let G=await ve.execute(l.grounding,u,t.target,z);if(r==="json"){let F=Z.success({command:l.name,target:t.target,preconditionPassed:!0,executed:!0,success:G.success,...G.error&&{error:G.error},...l.successMessage&&G.success&&{message:l.successMessage}});console.log(JSON.stringify(F,null,2))}else if(G.success){let F=l.successMessage??`Command "${l.name}" executed successfully.`;console.log(`\u2705 ${F}`)}else console.log(`\u274C Command "${l.name}" failed: ${G.error}`),process.exitCode=5}catch(i){D.handle(i)}}),n.command("validate").description("Validate all dynamic command definitions in 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";D.setFormat(t);try{let r=(0,Ss.resolve)(e.vault);if(!(0,_s.existsSync)(r))throw new Te(r);let i=cY(r);if(t==="json"){let s=Z.success({totalCommands:e2(r).length,totalIssues:i.reduce((a,c)=>a+c.issues.length,0),commandsWithIssues:i.length,issues:i});console.log(JSON.stringify(s,null,2))}else{let s=e2(r);if(i.length===0)console.log(`\u2705 All ${s.length} dynamic command(s) are valid.`);else{let a=i.reduce((c,l)=>c+l.issues.length,0);console.log(`\u274C Found ${a} issue(s) in ${i.length} command(s) out of ${s.length} total:
|
|
750
|
+
`);for(let c of i){console.log(` \u{1F4C4} ${c.label} (${c.uid}):`);for(let l of c.issues)console.log(` \u2022 ${l}`);console.log()}process.exitCode=5}}}catch(r){D.handle(r)}}),n}o(zF,"dynamicCommandCommand");function e2(n){let e=[],t=[];n2(n,t);let r=HF(t);for(let{filePath:i,fm:s}of t){if(!Jl(s,"exocmd__Command",r))continue;let a=s.exo__Asset_uid??"",c=s.exo__Asset_label??QF(i),l=s.exocmd__Command_category,u=s.exocmd__Command_icon,f=!!s.exocmd__Command_precondition,d=s.exocmd__Command_grounding,h;if(d){let p=Kg(String(d)),_=t.find(b=>b.fm.exo__Asset_uid===p&&Jl(b.fm,"exocmd__Grounding",r));_&&(h=_.fm.exocmd__Grounding_type)}e.push({filePath:i,uid:a,label:c,category:l,icon:u,hasPrecondition:f,groundingType:h})}return e}o(e2,"scanCommands");async function oY(n,e){let{tripleStore:t}=await t2(n),r=new ke.CommandResolver(t),i=await r.findBindings(),s=new Set;for(let c of i)s.add(c.commandRef);let a=[];for(let c of s){let l=await r.loadCommand(c);l&&a.push({filePath:"",uid:l.id,label:l.name,category:l.category,icon:l.icon,hasPrecondition:!!l.precondition,groundingType:l.grounding.type})}return a}o(oY,"listCommandsForTarget");function cY(n){let e=[],t=[];n2(n,t);let r=HF(t),i=new Map;for(let s of t){let a=s.fm.exo__Asset_uid;a&&i.set(a,s)}for(let{filePath:s,fm:a}of t){if(!Jl(a,"exocmd__Command",r))continue;let c=a.exo__Asset_uid??"",l=a.exo__Asset_label??QF(s),u=[];c||u.push("Missing exo__Asset_uid"),a.exo__Asset_label||u.push("Missing exo__Asset_label");let f=a.exocmd__Command_grounding;if(!f)u.push("Missing exocmd__Command_grounding (required)");else{let p=Kg(String(f)),_=i.get(p);if(!_)u.push(`Grounding reference "${p}" not found in vault`);else if(!Jl(_.fm,"exocmd__Grounding",r))u.push(`Grounding reference "${p}" is not an exocmd__Grounding asset`);else{let b=_.fm,E=b.exocmd__Grounding_type;E?(Object.values(ke.GroundingType).includes(E)||u.push(`Grounding "${p}" has invalid type "${E}"`),(E===ke.GroundingType.PROPERTY_SET||E===ke.GroundingType.PROPERTY_DELETE)&&!b.exocmd__Grounding_targetProperty&&u.push(`Grounding "${p}" (${E}) missing targetProperty`),E===ke.GroundingType.PROPERTY_SET&&!b.exocmd__Grounding_targetValue&&u.push(`Grounding "${p}" (property_set) missing targetValue`),E===ke.GroundingType.SERVICE_CALL&&((b.exocmd__Grounding_serviceId??b.exocmd__Grounding_targetProperty)||u.push(`Grounding "${p}" (service_call) missing serviceId and targetProperty`))):u.push(`Grounding "${p}" missing exocmd__Grounding_type`)}}let d=a.exocmd__Command_precondition;if(d){let p=Kg(String(d)),_=i.get(p);if(!_)u.push(`Precondition reference "${p}" not found in vault`);else if(!Jl(_.fm,"exocmd__Precondition",r))u.push(`Precondition reference "${p}" is not an exocmd__Precondition asset`);else{let b=_.fm.exocmd__Precondition_sparqlAsk,E=_.fm.exocmd__Precondition_hostFunction;!b&&!E&&u.push(`Precondition "${p}" missing both sparqlAsk and hostFunction`)}}t.some(p=>Jl(p.fm,"exocmd__CommandBinding",r)?Kg(String(p.fm.exocmd__CommandBinding_command??""))===c:!1)||u.push("No CommandBinding references this command (command will be unused)"),u.length>0&&e.push({uid:c,label:l,filePath:s,issues:u})}return e}o(cY,"validateCommands");async function t2(n){let e=new zt(n),r=await new ke.NoteToRDFConverter(e).convertVault(),i=new ke.InMemoryTripleStore;return await i.addAll(r),{tripleStore:i}}o(t2,"buildTripleStore");function r2(n,e){if(console.log(`${e}ID: ${n.id}`),console.log(`${e}Label: ${n.label}`),console.log(`${e}Type: ${n.type}`),n.targetProperty&&console.log(`${e}Target property: ${n.targetProperty}`),n.targetValue!==void 0&&console.log(`${e}Target value: ${n.targetValue}`),n.sparqlUpdate&&console.log(`${e}SPARQL UPDATE: ${n.sparqlUpdate}`),n.steps&&n.steps.length>0){console.log(`${e}Steps (${n.steps.length}):`);for(let t=0;t<n.steps.length;t++)console.log(`${e} Step ${t+1}:`),r2(n.steps[t],e+" ")}}o(r2,"printGrounding");function n2(n,e){let t;try{t=(0,_s.readdirSync)(n,{withFileTypes:!0})}catch{return}for(let r of t){let i=(0,Ss.join)(n,r.name);if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;n2(i,e)}else if(r.name.endsWith(".md"))try{let s=(0,_s.readFileSync)(i,"utf-8"),a=aY.parse(s);a.exists&&e.push({filePath:i,fm:lY(a.content)})}catch{}}}o(n2,"collectParsedFiles");function lY(n){let e={},t=n.split(`
|
|
751
|
+
`),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(lY,"parseYamlFrontmatter");var uY=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function HF(n){let e=new Map;for(let{fm:t}of n){let r=t.exo__Asset_uid,i=t.exo__Asset_label;typeof r=="string"&&typeof i=="string"&&e.set(r,i)}return e}o(HF,"buildClassLabelIndex");function Jl(n,e,t){let r=n.exo__Instance_class;if(!r)return!1;let i=Array.isArray(r)?r:[r];for(let s of i){if(typeof s!="string")continue;let a=s.match(/\[\[([^|\]]+)/),c=a?a[1]:s;if(c===e||t&&uY.test(c)&&t.get(c)===e)return!0}return!1}o(Jl,"hasClass");function Kg(n){if(typeof n!="string")return"";let e=n.replace(/["'[\]]/g,"").trim(),t=e.indexOf("|");return t>=0?e.substring(0,t).trim():e}o(Kg,"normalizeWikilink");function QF(n){return(0,Ss.basename)(n,".md")}o(QF,"extractLabelFromFilename");var Zl=require("fs"),od=require("path"),Dt=K(Gt());var fY={turtle:"turtle",ntriples:"n-triples",jsonld:"json-ld"},dY=new Dt.IRI(`${Dt.Namespace.RDF.iri.value}type`),YF=[Dt.Namespace.RDF,Dt.Namespace.RDFS,Dt.Namespace.OWL,Dt.Namespace.XSD,Dt.Namespace.EXO,Dt.Namespace.EMS,Dt.Namespace.EXOCMD,Dt.Namespace.IMS,Dt.Namespace.ZTLK,Dt.Namespace.PTMS,Dt.Namespace.LIT,Dt.Namespace.INBOX];function hY(n){let e=n.trim();if(e.startsWith("http://")||e.startsWith("https://"))return new Dt.IRI(e);let t=e.match(/^([a-zA-Z][a-zA-Z0-9]*)__(.+)$/);if(t){let[,i,s]=t,a=YF.find(c=>c.prefix===i);if(a)return a.term(s)}let r=e.match(/^([a-zA-Z][a-zA-Z0-9]*):(.+)$/);if(r){let[,i,s]=r,a=YF.find(c=>c.prefix===i);if(a)return a.term(s)}throw new Qe(`Unable to resolve class filter "${n}" to an IRI.`,'Use shorthand like "ems__Task", prefixed like "ems:Task", or a full IRI.')}o(hY,"resolveClassIri");function pY(n,e){let t=new Set;for(let r of n)r.predicate.equals(dY)&&r.object instanceof Dt.IRI&&r.object.equals(e)&&t.add(r.subject.toString());return t.size===0?[]:n.filter(r=>t.has(r.subject.toString()))}o(pY,"filterByClass");function KF(){return new Ie("convert").description("Dump vault graph as RDF (Turtle/N-Triples/JSON-LD)").option("--format <type>","Serialization format: turtle|ntriples|jsonld","turtle").option("--out <path>","Write serialized output to file (default: stdout)").option("--filter <class>","Keep only instances of the given class (e.g. ems__Task, ems:Task, or full IRI)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format for errors: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";D.setFormat(e);try{let t=fY[n.format];if(!t)throw new Qe(`Unknown format: "${n.format}". Expected one of turtle|ntriples|jsonld.`,"exocortex convert --format turtle --out vault.ttl");let r=(0,od.resolve)(n.vault);if(!(0,Zl.existsSync)(r))throw new Te(r);e==="text"&&!n.out||e==="text"&&console.error(`\u{1F4E6} Loading vault: ${r}...`);let i=new zt(r),a=await new Dt.NoteToRDFConverter(i).convertVault();if(n.filter){let f=hY(n.filter);a=pY(a,f)}let c=new Dt.InMemoryTripleStore;await c.addAll(a);let u=new Dt.RDFSerializer(c).serializeTriples(a,t,{pretty:t==="json-ld",indent:2});if(n.out){let f=(0,od.resolve)(n.out);try{(0,Zl.mkdirSync)((0,od.dirname)(f),{recursive:!0}),(0,Zl.writeFileSync)(f,u,"utf-8")}catch(d){throw new Ef("convert",`failed to write output to ${f}: ${d.message}`,"Check destination directory exists and is writable.",{outPath:f})}e==="text"&&console.error(`\u2705 Wrote ${a.length} triple(s) to ${f} (${n.format}).`)}else process.stdout.write(u),u.endsWith(`
|
|
752
752
|
`)||process.stdout.write(`
|
|
753
753
|
`)}catch(t){D.handle(t)}})}o(KF,"convertCommand");var tD=require("path"),rD=require("fs");var JF=require("node:crypto");function cd(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(cd,"wikilinkInner");function mY(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(mY,"normaliseColumns");function gY(n){if(Array.isArray(n))return n.map(e=>typeof e=="string"?cd(e):null).filter(e=>e!==null);if(typeof n=="string"){let e=cd(n);return e?[e]:[]}return[]}o(gY,"normaliseInstanceClass");function ZF(n){let e=gY(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(ZF,"isRelColSetFrontmatter");function eD(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)?cd(s[0]):cd(s),c=cd(e.ui__RelationColumnSet_referencingProperty),l=mY(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(eD,"extractRelColSetConfig");function XF(n){if(n===null||n.trim().length===0)return"";let e=n.trim();return e.startsWith("[[")&&e.endsWith("]]")?e:`[[${e}]]`}o(XF,"wikilinkOf");function yY(n,e){let t=(0,JF.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(yY,"defaultUidFor");var Xg=class{static{o(this,"RelColSetToExoLayoutMigratorService")}constructor(e={}){this.uidFor=e.uidFor??yY}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=XF(e.targetClass),u=XF(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?"[]":`
|
|
754
754
|
`+e.columns.map(_=>` - "${_}"`).join(`
|
|
@@ -790,7 +790,7 @@ exo__BacklinksTableBlock_columns:${f==="[]"?" []":f}
|
|
|
790
790
|
--- END PREVIEW ---
|
|
791
791
|
`)}o(SY,"printDryRunReport");function bY(n,e){let r=[`--- MIGRATION ${e.apply?"APPLY":"DRY RUN"} ---`,`Migrated pairs: ${n.pairs.length}`,`Skipped configs: ${n.skipped.length}`];e.apply&&(r.push(`Files written to: ${e.outDir}/ (relative to vault root)`),r.push(`Total files written: ${n.pairs.length*2} (${n.pairs.length} Layout + ${n.pairs.length} Block)`));for(let i of n.skipped)r.push(` SKIPPED: ${i.sourcePath} \u2014 ${i.reason}`);return r.push(`--- END SUMMARY ---
|
|
792
792
|
`),r.join(`
|
|
793
|
-
`)}o(bY,"formatSummary");function vY(n,e){return{mode:e.apply?"apply":"dry-run",outDir:e.outDir,pairsCount:n.pairs.length,skippedCount:n.skipped.length,pairs:n.pairs.map(t=>({sourceUid:t.sourceUid,sourcePath:t.sourcePath,layoutUid:t.layout.uid,blockUid:t.block.uid,warnings:t.warnings})),skipped:n.skipped}}o(vY,"summariseResult");function iD(n){n.addCommand(qO()),n.addCommand(HO()),n.addCommand(QO())}o(iD,"addQuerySubcommands");function sD(n){let e=new Ie;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.
|
|
793
|
+
`)}o(bY,"formatSummary");function vY(n,e){return{mode:e.apply?"apply":"dry-run",outDir:e.outDir,pairsCount:n.pairs.length,skippedCount:n.skipped.length,pairs:n.pairs.map(t=>({sourceUid:t.sourceUid,sourcePath:t.sourcePath,layoutUid:t.layout.uid,blockUid:t.block.uid,warnings:t.warnings})),skipped:n.skipped}}o(vY,"summariseResult");function iD(n){n.addCommand(qO()),n.addCommand(HO()),n.addCommand(QO())}o(iD,"addQuerySubcommands");function sD(n){let e=new Ie;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.126.0");let t=e.command("exoql").description("ExoQL query execution and cache management");iD(t);let r=e.command("sparql").description("(deprecated) Use 'exoql' instead");return iD(r),r.hook("preAction",()=>{console.error('\u26A0\uFE0F "sparql" is deprecated. Use "exoql" instead.')}),e.addCommand(rF()),e.addCommand(sF()),e.addCommand(aF()),e.addCommand(cF()),e.addCommand(lF()),e.addCommand(pF()),e.addCommand(_F()),e.addCommand(xF()),e.addCommand(RF()),e.addCommand(NF()),e.addCommand(MF()),e.addCommand(jF()),e.addCommand(BF()),e.addCommand(zF()),e.addCommand(KF()),e.addCommand(nD()),e}o(sD,"createProgram");sD().parse();0&&(module.exports={createProgram});
|
|
794
794
|
/*! Bundled license information:
|
|
795
795
|
|
|
796
796
|
reflect-metadata/Reflect.js:
|