@kitelev/exocortex-cli 15.159.1 → 15.160.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +52 -52
  2. 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.159.1
2
+ // @kitelev/exocortex-cli v15.160.1
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 CN=Object.create;var Cu=Object.defineProperty;var IN=Object.getOwnPropertyDescriptor;var RN=Object.getOwnPropertyNames;var PN=Object.getPrototypeOf,ON=Object.prototype.hasOwnProperty;var o=(n,e)=>Cu(n,"name",{value:e,configurable:!0});var FN=(n,e)=>()=>(n&&(e=n(n=0)),e);var S=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Uy=(n,e)=>{for(var t in e)Cu(n,t,{get:e[t],enumerable:!0})},j2=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of RN(e))!ON.call(n,i)&&i!==t&&Cu(n,i,{get:()=>e[i],enumerable:!(r=IN(e,i))||r.enumerable});return n};var Y=(n,e,t)=>(t=n!=null?CN(PN(n)):{},j2(e||!n||!n.__esModule?Cu(t,"default",{value:n,enumerable:!0}):t,n)),zd=n=>j2(Cu({},"__esModule",{value:!0}),n);var Hd=S(()=>{var $2;(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 je(Object.create(null))}:l?function(){return je({__proto__:null})}:function(){return je({})},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:be(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ze(),y=typeof WeakMap=="function"?WeakMap:He(),v=i?Symbol.for("@reflect-metadata:registry"):void 0,E=_e(),b=Se(E);function A(w,T,x,O){if(H(x)){if(!Ve(w))throw new TypeError;if(!Be(T))throw new TypeError;return Ye(w,T)}else{if(!Ve(w))throw new TypeError;if(!ne(T))throw new TypeError;if(!ne(O)&&!H(O)&&!Re(O))throw new TypeError;return Re(O)&&(O=void 0),x=Ce(x),st(w,T,x,O)}}o(A,"decorate"),e("decorate",A);function I(w,T){function x(O,Z){if(!ne(O))throw new TypeError;if(!H(Z)&&!ze(Z))throw new TypeError;se(w,T,O,Z)}return o(x,"decorator"),x}o(I,"metadata"),e("metadata",I);function j(w,T,x,O){if(!ne(x))throw new TypeError;return H(O)||(O=Ce(O)),se(w,T,x,O)}o(j,"defineMetadata"),e("defineMetadata",j);function B(w,T,x){if(!ne(T))throw new TypeError;return H(x)||(x=Ce(x)),Ot(w,T,x)}o(B,"hasMetadata"),e("hasMetadata",B);function te(w,T,x){if(!ne(T))throw new TypeError;return H(x)||(x=Ce(x)),at(w,T,x)}o(te,"hasOwnMetadata"),e("hasOwnMetadata",te);function z(w,T,x){if(!ne(T))throw new TypeError;return H(x)||(x=Ce(x)),ct(w,T,x)}o(z,"getMetadata"),e("getMetadata",z);function G(w,T,x){if(!ne(T))throw new TypeError;return H(x)||(x=Ce(x)),Ke(w,T,x)}o(G,"getOwnMetadata"),e("getOwnMetadata",G);function F(w,T){if(!ne(w))throw new TypeError;return H(T)||(T=Ce(T)),U(w,T)}o(F,"getMetadataKeys"),e("getMetadataKeys",F);function $(w,T){if(!ne(w))throw new TypeError;return H(T)||(T=Ce(T)),lt(w,T)}o($,"getOwnMetadataKeys"),e("getOwnMetadataKeys",$);function re(w,T,x){if(!ne(T))throw new TypeError;if(H(x)||(x=Ce(x)),!ne(T))throw new TypeError;H(x)||(x=Ce(x));var O=oe(T,x,!1);return H(O)?!1:O.OrdinaryDeleteMetadata(w,T,x)}o(re,"deleteMetadata"),e("deleteMetadata",re);function Ye(w,T){for(var x=w.length-1;x>=0;--x){var O=w[x],Z=O(T);if(!H(Z)&&!Re(Z)){if(!Be(Z))throw new TypeError;T=Z}}return T}o(Ye,"DecorateConstructor");function st(w,T,x,O){for(var Z=w.length-1;Z>=0;--Z){var _t=w[Z],Ct=_t(T,x,O);if(!H(Ct)&&!Re(Ct)){if(!ne(Ct))throw new TypeError;O=Ct}}return O}o(st,"DecorateProperty");function Ot(w,T,x){var O=at(w,T,x);if(O)return!0;var Z=le(T);return Re(Z)?!1:Ot(w,Z,x)}o(Ot,"OrdinaryHasMetadata");function at(w,T,x){var O=oe(T,x,!1);return H(O)?!1:$e(O.OrdinaryHasOwnMetadata(w,T,x))}o(at,"OrdinaryHasOwnMetadata");function ct(w,T,x){var O=at(w,T,x);if(O)return Ke(w,T,x);var Z=le(T);if(!Re(Z))return ct(w,Z,x)}o(ct,"OrdinaryGetMetadata");function Ke(w,T,x){var O=oe(T,x,!1);if(!H(O))return O.OrdinaryGetOwnMetadata(w,T,x)}o(Ke,"OrdinaryGetOwnMetadata");function se(w,T,x,O){var Z=oe(x,O,!0);Z.OrdinaryDefineOwnMetadata(w,T,x,O)}o(se,"OrdinaryDefineOwnMetadata");function U(w,T){var x=lt(w,T),O=le(w);if(O===null)return x;var Z=U(O,T);if(Z.length<=0)return x;if(x.length<=0)return Z;for(var _t=new p,Ct=[],De=0,q=x;De<q.length;De++){var W=q[De],Q=_t.has(W);Q||(_t.add(W),Ct.push(W))}for(var K=0,Ie=Z;K<Ie.length;K++){var W=Ie[K],Q=_t.has(W);Q||(_t.add(W),Ct.push(W))}return Ct}o(U,"OrdinaryMetadataKeys");function lt(w,T){var x=oe(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 Ue(w){return typeof w=="symbol"}o(Ue,"IsSymbol");function ne(w){return typeof w=="object"?w!==null:typeof w=="function"}o(ne,"IsObject");function qe(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",O=me(w,s);if(O!==void 0){var Z=O.call(w,x);if(ne(Z))throw new TypeError;return Z}return We(w,x==="default"?"number":x)}o(qe,"ToPrimitive");function We(w,T){if(T==="string"){var x=w.toString;if(Pe(x)){var O=x.call(w);if(!ne(O))return O}var Z=w.valueOf;if(Pe(Z)){var O=Z.call(w);if(!ne(O))return O}}else{var Z=w.valueOf;if(Pe(Z)){var O=Z.call(w);if(!ne(O))return O}var _t=w.toString;if(Pe(_t)){var O=_t.call(w);if(!ne(O))return O}}throw new TypeError}o(We,"OrdinaryToPrimitive");function $e(w){return!!w}o($e,"ToBoolean");function Ge(w){return""+w}o(Ge,"ToString");function Ce(w){var T=qe(w,3);return Ue(T)?T:Ge(T)}o(Ce,"ToPropertyKey");function Ve(w){return Array.isArray?Array.isArray(w):w instanceof Object?w instanceof Array:Object.prototype.toString.call(w)==="[object Array]"}o(Ve,"IsArray");function Pe(w){return typeof w=="function"}o(Pe,"IsCallable");function Be(w){return typeof w=="function"}o(Be,"IsConstructor");function ze(w){switch(pt(w)){case 3:return!0;case 4:return!0;default:return!1}}o(ze,"IsPropertyKey");function fe(w,T){return w===T||w!==w&&T!==T}o(fe,"SameValueZero");function me(w,T){var x=w[T];if(x!=null){if(!Pe(x))throw new TypeError;return x}}o(me,"GetMethod");function ge(w){var T=me(w,a);if(!Pe(T))throw new TypeError;var x=T.call(w);if(!ne(x))throw new TypeError;return x}o(ge,"GetIterator");function de(w){return w.value}o(de,"IteratorValue");function he(w){var T=w.next();return T.done?!1:T}o(he,"IteratorStep");function pe(w){var T=w.return;T&&T.call(w)}o(pe,"IteratorClose");function le(w){var T=Object.getPrototypeOf(w);if(typeof w!="function"||w===d||T!==d)return T;var x=w.prototype,O=x&&Object.getPrototypeOf(x);if(O==null||O===Object.prototype)return T;var Z=O.constructor;return typeof Z!="function"||Z===w?T:Z}o(le,"OrdinaryGetPrototypeOf");function ye(){var w;!H(v)&&typeof t.Reflect<"u"&&!(v in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(w=ve(t.Reflect));var T,x,O,Z=new y,_t={registerProvider:Ct,getProvider:q,setProvider:Q};return _t;function Ct(K){if(!Object.isExtensible(_t))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case w===K:break;case H(T):T=K;break;case T===K:break;case H(x):x=K;break;case x===K:break;default:O===void 0&&(O=new p),O.add(K);break}}function De(K,Ie){if(!H(T)){if(T.isProviderFor(K,Ie))return T;if(!H(x)){if(x.isProviderFor(K,Ie))return T;if(!H(O))for(var tt=ge(O);;){var rt=he(tt);if(!rt)return;var Rr=de(rt);if(Rr.isProviderFor(K,Ie))return pe(tt),Rr}}}if(!H(w)&&w.isProviderFor(K,Ie))return w}function q(K,Ie){var tt=Z.get(K),rt;return H(tt)||(rt=tt.get(Ie)),H(rt)&&(rt=De(K,Ie),H(rt)||(H(tt)&&(tt=new h,Z.set(K,tt)),tt.set(Ie,rt))),rt}function W(K){if(H(K))throw new TypeError;return T===K||x===K||!H(O)&&O.has(K)}function Q(K,Ie,tt){if(!W(tt))throw new Error("Metadata provider not registered.");var rt=q(K,Ie);if(rt!==tt){if(!H(rt))return!1;var Rr=Z.get(K);H(Rr)&&(Rr=new h,Z.set(K,Rr)),Rr.set(Ie,tt)}return!0}}o(ye,"CreateMetadataRegistry");function _e(){var w;return!H(v)&&ne(t.Reflect)&&Object.isExtensible(t.Reflect)&&(w=t.Reflect[v]),H(w)&&(w=ye()),!H(v)&&ne(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,v,{enumerable:!1,configurable:!1,writable:!1,value:w}),w}o(_e,"GetOrCreateMetadataRegistry");function Se(w){var T=new y,x={isProviderFor:o(function(W,Q){var K=T.get(W);return H(K)?!1:K.has(Q)},"isProviderFor"),OrdinaryDefineOwnMetadata:Ct,OrdinaryHasOwnMetadata:Z,OrdinaryGetOwnMetadata:_t,OrdinaryOwnMetadataKeys:De,OrdinaryDeleteMetadata:q};return E.registerProvider(x),x;function O(W,Q,K){var Ie=T.get(W),tt=!1;if(H(Ie)){if(!K)return;Ie=new h,T.set(W,Ie),tt=!0}var rt=Ie.get(Q);if(H(rt)){if(!K)return;if(rt=new h,Ie.set(Q,rt),!w.setProvider(W,Q,x))throw Ie.delete(Q),tt&&T.delete(W),new Error("Wrong provider for target.")}return rt}o(O,"GetOrCreateMetadataMap");function Z(W,Q,K){var Ie=O(Q,K,!1);return H(Ie)?!1:$e(Ie.has(W))}o(Z,"OrdinaryHasOwnMetadata");function _t(W,Q,K){var Ie=O(Q,K,!1);if(!H(Ie))return Ie.get(W)}o(_t,"OrdinaryGetOwnMetadata");function Ct(W,Q,K,Ie){var tt=O(K,Ie,!0);tt.set(W,Q)}o(Ct,"OrdinaryDefineOwnMetadata");function De(W,Q){var K=[],Ie=O(W,Q,!1);if(H(Ie))return K;for(var tt=Ie.keys(),rt=ge(tt),Rr=0;;){var vn=he(rt);if(!vn)return K.length=Rr,K;var Ln=de(vn);try{K[Rr]=Ln}catch(rn){try{pe(rt)}finally{throw rn}}Rr++}}o(De,"OrdinaryOwnMetadataKeys");function q(W,Q,K){var Ie=O(Q,K,!1);if(H(Ie)||!Ie.delete(W))return!1;if(Ie.size===0){var tt=T.get(Q);H(tt)||(tt.delete(K),tt.size===0&&T.delete(tt))}return!0}o(q,"OrdinaryDeleteMetadata")}o(Se,"CreateMetadataProvider");function ve(w){var T=w.defineMetadata,x=w.hasOwnMetadata,O=w.getOwnMetadata,Z=w.getOwnMetadataKeys,_t=w.deleteMetadata,Ct=new y,De={isProviderFor:o(function(q,W){var Q=Ct.get(q);return!H(Q)&&Q.has(W)?!0:Z(q,W).length?(H(Q)&&(Q=new p,Ct.set(q,Q)),Q.add(W),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:T,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:O,OrdinaryOwnMetadataKeys:Z,OrdinaryDeleteMetadata:_t};return De}o(ve,"CreateFallbackProvider");function oe(w,T,x){var O=E.getProvider(w,T);if(!H(O))return O;if(x){if(E.setProvider(w,T,b))return b;throw new Error("Illegal state.")}}o(oe,"GetMetadataProvider");function be(){var w={},T=[],x=(function(){function De(q,W,Q){this._index=0,this._keys=q,this._values=W,this._selector=Q}return o(De,"MapIterator"),De.prototype["@@iterator"]=function(){return this},De.prototype[a]=function(){return this},De.prototype.next=function(){var q=this._index;if(q>=0&&q<this._keys.length){var W=this._selector(this._keys[q],this._values[q]);return q+1>=this._keys.length?(this._index=-1,this._keys=T,this._values=T):this._index++,{value:W,done:!1}}return{value:void 0,done:!0}},De.prototype.throw=function(q){throw this._index>=0&&(this._index=-1,this._keys=T,this._values=T),q},De.prototype.return=function(q){return this._index>=0&&(this._index=-1,this._keys=T,this._values=T),{value:q,done:!0}},De})(),O=(function(){function De(){this._keys=[],this._values=[],this._cacheKey=w,this._cacheIndex=-2}return o(De,"Map"),Object.defineProperty(De.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),De.prototype.has=function(q){return this._find(q,!1)>=0},De.prototype.get=function(q){var W=this._find(q,!1);return W>=0?this._values[W]:void 0},De.prototype.set=function(q,W){var Q=this._find(q,!0);return this._values[Q]=W,this},De.prototype.delete=function(q){var W=this._find(q,!1);if(W>=0){for(var Q=this._keys.length,K=W+1;K<Q;K++)this._keys[K-1]=this._keys[K],this._values[K-1]=this._values[K];return this._keys.length--,this._values.length--,fe(q,this._cacheKey)&&(this._cacheKey=w,this._cacheIndex=-2),!0}return!1},De.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=w,this._cacheIndex=-2},De.prototype.keys=function(){return new x(this._keys,this._values,Z)},De.prototype.values=function(){return new x(this._keys,this._values,_t)},De.prototype.entries=function(){return new x(this._keys,this._values,Ct)},De.prototype["@@iterator"]=function(){return this.entries()},De.prototype[a]=function(){return this.entries()},De.prototype._find=function(q,W){if(!fe(this._cacheKey,q)){this._cacheIndex=-1;for(var Q=0;Q<this._keys.length;Q++)if(fe(this._keys[Q],q)){this._cacheIndex=Q;break}}return this._cacheIndex<0&&W&&(this._cacheIndex=this._keys.length,this._keys.push(q),this._values.push(void 0)),this._cacheIndex},De})();return O;function Z(De,q){return De}function _t(De,q){return q}function Ct(De,q){return[De,q]}}o(be,"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 He(){var w=16,T=f.create(),x=O();return(function(){function q(){this._key=O()}return o(q,"WeakMap"),q.prototype.has=function(W){var Q=Z(W,!1);return Q!==void 0?f.has(Q,this._key):!1},q.prototype.get=function(W){var Q=Z(W,!1);return Q!==void 0?f.get(Q,this._key):void 0},q.prototype.set=function(W,Q){var K=Z(W,!0);return K[this._key]=Q,this},q.prototype.delete=function(W){var Q=Z(W,!1);return Q!==void 0?delete Q[this._key]:!1},q.prototype.clear=function(){this._key=O()},q})();function O(){var q;do q="@@WeakMap@@"+De();while(f.has(T,q));return T[q]=!0,q}function Z(q,W){if(!r.call(q,x)){if(!W)return;Object.defineProperty(q,x,{value:f.create()})}return q[x]}function _t(q,W){for(var Q=0;Q<W;++Q)q[Q]=Math.random()*255|0;return q}function Ct(q){if(typeof Uint8Array=="function"){var W=new Uint8Array(q);return typeof crypto<"u"?crypto.getRandomValues(W):typeof msCrypto<"u"?msCrypto.getRandomValues(W):_t(W,q),W}return _t(new Array(q),q)}function De(){var q=Ct(w);q[6]=q[6]&79|64,q[8]=q[8]&191|128;for(var W="",Q=0;Q<w;++Q){var K=q[Q];(Q===4||Q===6||Q===8)&&(W+="-"),K<16&&(W+="0"),W+=K.toString(16).toLowerCase()}return W}}o(He,"CreateWeakMapPolyfill");function je(w){return w.__=void 0,delete w.__,w}o(je,"MakeDictionary")})})($2||($2={}))});var Iu=S(Wy=>{var Qd=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}},qy=class extends Qd{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Wy.CommanderError=Qd;Wy.InvalidArgumentError=qy});var Yd=S(zy=>{var{InvalidArgumentError:DN}=Iu(),Gy=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 DN(`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 NN(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(NN,"humanReadableArgName");zy.Argument=Gy;zy.humanReadableArgName=NN});var Yy=S(Qy=>{var{humanReadableArgName:LN}=Yd(),Hy=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=>LN(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,t,r){return t.length===0?[]:[r.styleTitle(e),...t,""]}groupItems(e,t,r){let i=new Map;return e.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[])}),t.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[]),i.get(a).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(d,h){return t.formatItem(d,r,h,t)}o(s,"callFormatItem");let a=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],c=t.commandDescription(e);c.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(c),i),""]));let l=t.visibleArguments(e).map(d=>s(t.styleArgumentTerm(t.argumentTerm(d)),t.styleArgumentDescription(t.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,h)=>{let p=d.map(y=>s(t.styleOptionTerm(t.optionTerm(y)),t.styleOptionDescription(t.optionDescription(y))));a=a.concat(this.formatItemList(h,p,t))}),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(h=>s(t.styleOptionTerm(t.optionTerm(h)),t.styleOptionDescription(t.optionDescription(h))));a=a.concat(this.formatItemList("Global Options:",d,t))}return this.groupItems(e.commands,t.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,h)=>{let p=d.map(y=>s(t.styleSubcommandTerm(t.subcommandTerm(y)),t.styleSubcommandDescription(t.subcommandDescription(y))));a=a.concat(this.formatItemList(h,p,t))}),a.join(`
6
+ "use strict";var CN=Object.create;var Cu=Object.defineProperty;var IN=Object.getOwnPropertyDescriptor;var RN=Object.getOwnPropertyNames;var PN=Object.getPrototypeOf,ON=Object.prototype.hasOwnProperty;var o=(n,e)=>Cu(n,"name",{value:e,configurable:!0});var FN=(n,e)=>()=>(n&&(e=n(n=0)),e);var S=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Uy=(n,e)=>{for(var t in e)Cu(n,t,{get:e[t],enumerable:!0})},j2=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of RN(e))!ON.call(n,i)&&i!==t&&Cu(n,i,{get:()=>e[i],enumerable:!(r=IN(e,i))||r.enumerable});return n};var Y=(n,e,t)=>(t=n!=null?CN(PN(n)):{},j2(e||!n||!n.__esModule?Cu(t,"default",{value:n,enumerable:!0}):t,n)),zd=n=>j2(Cu({},"__esModule",{value:!0}),n);var Hd=S(()=>{var $2;(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 je(Object.create(null))}:l?function(){return je({__proto__:null})}:function(){return je({})},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:be(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ze(),y=typeof WeakMap=="function"?WeakMap:He(),v=i?Symbol.for("@reflect-metadata:registry"):void 0,E=_e(),b=Se(E);function A(w,T,x,O){if(H(x)){if(!Ve(w))throw new TypeError;if(!Be(T))throw new TypeError;return Ye(w,T)}else{if(!Ve(w))throw new TypeError;if(!ne(T))throw new TypeError;if(!ne(O)&&!H(O)&&!Re(O))throw new TypeError;return Re(O)&&(O=void 0),x=Ce(x),st(w,T,x,O)}}o(A,"decorate"),e("decorate",A);function I(w,T){function x(O,Z){if(!ne(O))throw new TypeError;if(!H(Z)&&!ze(Z))throw new TypeError;se(w,T,O,Z)}return o(x,"decorator"),x}o(I,"metadata"),e("metadata",I);function j(w,T,x,O){if(!ne(x))throw new TypeError;return H(O)||(O=Ce(O)),se(w,T,x,O)}o(j,"defineMetadata"),e("defineMetadata",j);function B(w,T,x){if(!ne(T))throw new TypeError;return H(x)||(x=Ce(x)),Ot(w,T,x)}o(B,"hasMetadata"),e("hasMetadata",B);function te(w,T,x){if(!ne(T))throw new TypeError;return H(x)||(x=Ce(x)),at(w,T,x)}o(te,"hasOwnMetadata"),e("hasOwnMetadata",te);function z(w,T,x){if(!ne(T))throw new TypeError;return H(x)||(x=Ce(x)),ct(w,T,x)}o(z,"getMetadata"),e("getMetadata",z);function G(w,T,x){if(!ne(T))throw new TypeError;return H(x)||(x=Ce(x)),Ke(w,T,x)}o(G,"getOwnMetadata"),e("getOwnMetadata",G);function F(w,T){if(!ne(w))throw new TypeError;return H(T)||(T=Ce(T)),U(w,T)}o(F,"getMetadataKeys"),e("getMetadataKeys",F);function $(w,T){if(!ne(w))throw new TypeError;return H(T)||(T=Ce(T)),lt(w,T)}o($,"getOwnMetadataKeys"),e("getOwnMetadataKeys",$);function re(w,T,x){if(!ne(T))throw new TypeError;if(H(x)||(x=Ce(x)),!ne(T))throw new TypeError;H(x)||(x=Ce(x));var O=oe(T,x,!1);return H(O)?!1:O.OrdinaryDeleteMetadata(w,T,x)}o(re,"deleteMetadata"),e("deleteMetadata",re);function Ye(w,T){for(var x=w.length-1;x>=0;--x){var O=w[x],Z=O(T);if(!H(Z)&&!Re(Z)){if(!Be(Z))throw new TypeError;T=Z}}return T}o(Ye,"DecorateConstructor");function st(w,T,x,O){for(var Z=w.length-1;Z>=0;--Z){var _t=w[Z],Ct=_t(T,x,O);if(!H(Ct)&&!Re(Ct)){if(!ne(Ct))throw new TypeError;O=Ct}}return O}o(st,"DecorateProperty");function Ot(w,T,x){var O=at(w,T,x);if(O)return!0;var Z=le(T);return Re(Z)?!1:Ot(w,Z,x)}o(Ot,"OrdinaryHasMetadata");function at(w,T,x){var O=oe(T,x,!1);return H(O)?!1:$e(O.OrdinaryHasOwnMetadata(w,T,x))}o(at,"OrdinaryHasOwnMetadata");function ct(w,T,x){var O=at(w,T,x);if(O)return Ke(w,T,x);var Z=le(T);if(!Re(Z))return ct(w,Z,x)}o(ct,"OrdinaryGetMetadata");function Ke(w,T,x){var O=oe(T,x,!1);if(!H(O))return O.OrdinaryGetOwnMetadata(w,T,x)}o(Ke,"OrdinaryGetOwnMetadata");function se(w,T,x,O){var Z=oe(x,O,!0);Z.OrdinaryDefineOwnMetadata(w,T,x,O)}o(se,"OrdinaryDefineOwnMetadata");function U(w,T){var x=lt(w,T),O=le(w);if(O===null)return x;var Z=U(O,T);if(Z.length<=0)return x;if(x.length<=0)return Z;for(var _t=new p,Ct=[],De=0,q=x;De<q.length;De++){var W=q[De],Q=_t.has(W);Q||(_t.add(W),Ct.push(W))}for(var K=0,Ie=Z;K<Ie.length;K++){var W=Ie[K],Q=_t.has(W);Q||(_t.add(W),Ct.push(W))}return Ct}o(U,"OrdinaryMetadataKeys");function lt(w,T){var x=oe(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 Ue(w){return typeof w=="symbol"}o(Ue,"IsSymbol");function ne(w){return typeof w=="object"?w!==null:typeof w=="function"}o(ne,"IsObject");function qe(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",O=me(w,s);if(O!==void 0){var Z=O.call(w,x);if(ne(Z))throw new TypeError;return Z}return We(w,x==="default"?"number":x)}o(qe,"ToPrimitive");function We(w,T){if(T==="string"){var x=w.toString;if(Pe(x)){var O=x.call(w);if(!ne(O))return O}var Z=w.valueOf;if(Pe(Z)){var O=Z.call(w);if(!ne(O))return O}}else{var Z=w.valueOf;if(Pe(Z)){var O=Z.call(w);if(!ne(O))return O}var _t=w.toString;if(Pe(_t)){var O=_t.call(w);if(!ne(O))return O}}throw new TypeError}o(We,"OrdinaryToPrimitive");function $e(w){return!!w}o($e,"ToBoolean");function Ge(w){return""+w}o(Ge,"ToString");function Ce(w){var T=qe(w,3);return Ue(T)?T:Ge(T)}o(Ce,"ToPropertyKey");function Ve(w){return Array.isArray?Array.isArray(w):w instanceof Object?w instanceof Array:Object.prototype.toString.call(w)==="[object Array]"}o(Ve,"IsArray");function Pe(w){return typeof w=="function"}o(Pe,"IsCallable");function Be(w){return typeof w=="function"}o(Be,"IsConstructor");function ze(w){switch(pt(w)){case 3:return!0;case 4:return!0;default:return!1}}o(ze,"IsPropertyKey");function fe(w,T){return w===T||w!==w&&T!==T}o(fe,"SameValueZero");function me(w,T){var x=w[T];if(x!=null){if(!Pe(x))throw new TypeError;return x}}o(me,"GetMethod");function ge(w){var T=me(w,a);if(!Pe(T))throw new TypeError;var x=T.call(w);if(!ne(x))throw new TypeError;return x}o(ge,"GetIterator");function de(w){return w.value}o(de,"IteratorValue");function he(w){var T=w.next();return T.done?!1:T}o(he,"IteratorStep");function pe(w){var T=w.return;T&&T.call(w)}o(pe,"IteratorClose");function le(w){var T=Object.getPrototypeOf(w);if(typeof w!="function"||w===d||T!==d)return T;var x=w.prototype,O=x&&Object.getPrototypeOf(x);if(O==null||O===Object.prototype)return T;var Z=O.constructor;return typeof Z!="function"||Z===w?T:Z}o(le,"OrdinaryGetPrototypeOf");function ye(){var w;!H(v)&&typeof t.Reflect<"u"&&!(v in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(w=ve(t.Reflect));var T,x,O,Z=new y,_t={registerProvider:Ct,getProvider:q,setProvider:Q};return _t;function Ct(K){if(!Object.isExtensible(_t))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case w===K:break;case H(T):T=K;break;case T===K:break;case H(x):x=K;break;case x===K:break;default:O===void 0&&(O=new p),O.add(K);break}}function De(K,Ie){if(!H(T)){if(T.isProviderFor(K,Ie))return T;if(!H(x)){if(x.isProviderFor(K,Ie))return T;if(!H(O))for(var tt=ge(O);;){var rt=he(tt);if(!rt)return;var Rr=de(rt);if(Rr.isProviderFor(K,Ie))return pe(tt),Rr}}}if(!H(w)&&w.isProviderFor(K,Ie))return w}function q(K,Ie){var tt=Z.get(K),rt;return H(tt)||(rt=tt.get(Ie)),H(rt)&&(rt=De(K,Ie),H(rt)||(H(tt)&&(tt=new h,Z.set(K,tt)),tt.set(Ie,rt))),rt}function W(K){if(H(K))throw new TypeError;return T===K||x===K||!H(O)&&O.has(K)}function Q(K,Ie,tt){if(!W(tt))throw new Error("Metadata provider not registered.");var rt=q(K,Ie);if(rt!==tt){if(!H(rt))return!1;var Rr=Z.get(K);H(Rr)&&(Rr=new h,Z.set(K,Rr)),Rr.set(Ie,tt)}return!0}}o(ye,"CreateMetadataRegistry");function _e(){var w;return!H(v)&&ne(t.Reflect)&&Object.isExtensible(t.Reflect)&&(w=t.Reflect[v]),H(w)&&(w=ye()),!H(v)&&ne(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,v,{enumerable:!1,configurable:!1,writable:!1,value:w}),w}o(_e,"GetOrCreateMetadataRegistry");function Se(w){var T=new y,x={isProviderFor:o(function(W,Q){var K=T.get(W);return H(K)?!1:K.has(Q)},"isProviderFor"),OrdinaryDefineOwnMetadata:Ct,OrdinaryHasOwnMetadata:Z,OrdinaryGetOwnMetadata:_t,OrdinaryOwnMetadataKeys:De,OrdinaryDeleteMetadata:q};return E.registerProvider(x),x;function O(W,Q,K){var Ie=T.get(W),tt=!1;if(H(Ie)){if(!K)return;Ie=new h,T.set(W,Ie),tt=!0}var rt=Ie.get(Q);if(H(rt)){if(!K)return;if(rt=new h,Ie.set(Q,rt),!w.setProvider(W,Q,x))throw Ie.delete(Q),tt&&T.delete(W),new Error("Wrong provider for target.")}return rt}o(O,"GetOrCreateMetadataMap");function Z(W,Q,K){var Ie=O(Q,K,!1);return H(Ie)?!1:$e(Ie.has(W))}o(Z,"OrdinaryHasOwnMetadata");function _t(W,Q,K){var Ie=O(Q,K,!1);if(!H(Ie))return Ie.get(W)}o(_t,"OrdinaryGetOwnMetadata");function Ct(W,Q,K,Ie){var tt=O(K,Ie,!0);tt.set(W,Q)}o(Ct,"OrdinaryDefineOwnMetadata");function De(W,Q){var K=[],Ie=O(W,Q,!1);if(H(Ie))return K;for(var tt=Ie.keys(),rt=ge(tt),Rr=0;;){var vn=he(rt);if(!vn)return K.length=Rr,K;var Ln=de(vn);try{K[Rr]=Ln}catch(nn){try{pe(rt)}finally{throw nn}}Rr++}}o(De,"OrdinaryOwnMetadataKeys");function q(W,Q,K){var Ie=O(Q,K,!1);if(H(Ie)||!Ie.delete(W))return!1;if(Ie.size===0){var tt=T.get(Q);H(tt)||(tt.delete(K),tt.size===0&&T.delete(tt))}return!0}o(q,"OrdinaryDeleteMetadata")}o(Se,"CreateMetadataProvider");function ve(w){var T=w.defineMetadata,x=w.hasOwnMetadata,O=w.getOwnMetadata,Z=w.getOwnMetadataKeys,_t=w.deleteMetadata,Ct=new y,De={isProviderFor:o(function(q,W){var Q=Ct.get(q);return!H(Q)&&Q.has(W)?!0:Z(q,W).length?(H(Q)&&(Q=new p,Ct.set(q,Q)),Q.add(W),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:T,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:O,OrdinaryOwnMetadataKeys:Z,OrdinaryDeleteMetadata:_t};return De}o(ve,"CreateFallbackProvider");function oe(w,T,x){var O=E.getProvider(w,T);if(!H(O))return O;if(x){if(E.setProvider(w,T,b))return b;throw new Error("Illegal state.")}}o(oe,"GetMetadataProvider");function be(){var w={},T=[],x=(function(){function De(q,W,Q){this._index=0,this._keys=q,this._values=W,this._selector=Q}return o(De,"MapIterator"),De.prototype["@@iterator"]=function(){return this},De.prototype[a]=function(){return this},De.prototype.next=function(){var q=this._index;if(q>=0&&q<this._keys.length){var W=this._selector(this._keys[q],this._values[q]);return q+1>=this._keys.length?(this._index=-1,this._keys=T,this._values=T):this._index++,{value:W,done:!1}}return{value:void 0,done:!0}},De.prototype.throw=function(q){throw this._index>=0&&(this._index=-1,this._keys=T,this._values=T),q},De.prototype.return=function(q){return this._index>=0&&(this._index=-1,this._keys=T,this._values=T),{value:q,done:!0}},De})(),O=(function(){function De(){this._keys=[],this._values=[],this._cacheKey=w,this._cacheIndex=-2}return o(De,"Map"),Object.defineProperty(De.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),De.prototype.has=function(q){return this._find(q,!1)>=0},De.prototype.get=function(q){var W=this._find(q,!1);return W>=0?this._values[W]:void 0},De.prototype.set=function(q,W){var Q=this._find(q,!0);return this._values[Q]=W,this},De.prototype.delete=function(q){var W=this._find(q,!1);if(W>=0){for(var Q=this._keys.length,K=W+1;K<Q;K++)this._keys[K-1]=this._keys[K],this._values[K-1]=this._values[K];return this._keys.length--,this._values.length--,fe(q,this._cacheKey)&&(this._cacheKey=w,this._cacheIndex=-2),!0}return!1},De.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=w,this._cacheIndex=-2},De.prototype.keys=function(){return new x(this._keys,this._values,Z)},De.prototype.values=function(){return new x(this._keys,this._values,_t)},De.prototype.entries=function(){return new x(this._keys,this._values,Ct)},De.prototype["@@iterator"]=function(){return this.entries()},De.prototype[a]=function(){return this.entries()},De.prototype._find=function(q,W){if(!fe(this._cacheKey,q)){this._cacheIndex=-1;for(var Q=0;Q<this._keys.length;Q++)if(fe(this._keys[Q],q)){this._cacheIndex=Q;break}}return this._cacheIndex<0&&W&&(this._cacheIndex=this._keys.length,this._keys.push(q),this._values.push(void 0)),this._cacheIndex},De})();return O;function Z(De,q){return De}function _t(De,q){return q}function Ct(De,q){return[De,q]}}o(be,"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 He(){var w=16,T=f.create(),x=O();return(function(){function q(){this._key=O()}return o(q,"WeakMap"),q.prototype.has=function(W){var Q=Z(W,!1);return Q!==void 0?f.has(Q,this._key):!1},q.prototype.get=function(W){var Q=Z(W,!1);return Q!==void 0?f.get(Q,this._key):void 0},q.prototype.set=function(W,Q){var K=Z(W,!0);return K[this._key]=Q,this},q.prototype.delete=function(W){var Q=Z(W,!1);return Q!==void 0?delete Q[this._key]:!1},q.prototype.clear=function(){this._key=O()},q})();function O(){var q;do q="@@WeakMap@@"+De();while(f.has(T,q));return T[q]=!0,q}function Z(q,W){if(!r.call(q,x)){if(!W)return;Object.defineProperty(q,x,{value:f.create()})}return q[x]}function _t(q,W){for(var Q=0;Q<W;++Q)q[Q]=Math.random()*255|0;return q}function Ct(q){if(typeof Uint8Array=="function"){var W=new Uint8Array(q);return typeof crypto<"u"?crypto.getRandomValues(W):typeof msCrypto<"u"?msCrypto.getRandomValues(W):_t(W,q),W}return _t(new Array(q),q)}function De(){var q=Ct(w);q[6]=q[6]&79|64,q[8]=q[8]&191|128;for(var W="",Q=0;Q<w;++Q){var K=q[Q];(Q===4||Q===6||Q===8)&&(W+="-"),K<16&&(W+="0"),W+=K.toString(16).toLowerCase()}return W}}o(He,"CreateWeakMapPolyfill");function je(w){return w.__=void 0,delete w.__,w}o(je,"MakeDictionary")})})($2||($2={}))});var Iu=S(Wy=>{var Qd=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}},qy=class extends Qd{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Wy.CommanderError=Qd;Wy.InvalidArgumentError=qy});var Yd=S(zy=>{var{InvalidArgumentError:DN}=Iu(),Gy=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 DN(`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 NN(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(NN,"humanReadableArgName");zy.Argument=Gy;zy.humanReadableArgName=NN});var Yy=S(Qy=>{var{humanReadableArgName:LN}=Yd(),Hy=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=>LN(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,t,r){return t.length===0?[]:[r.styleTitle(e),...t,""]}groupItems(e,t,r){let i=new Map;return e.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[])}),t.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[]),i.get(a).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(d,h){return t.formatItem(d,r,h,t)}o(s,"callFormatItem");let a=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],c=t.commandDescription(e);c.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(c),i),""]));let l=t.visibleArguments(e).map(d=>s(t.styleArgumentTerm(t.argumentTerm(d)),t.styleArgumentDescription(t.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,h)=>{let p=d.map(y=>s(t.styleOptionTerm(t.optionTerm(y)),t.styleOptionDescription(t.optionDescription(y))));a=a.concat(this.formatItemList(h,p,t))}),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(h=>s(t.styleOptionTerm(t.optionTerm(h)),t.styleOptionDescription(t.optionDescription(h))));a=a.concat(this.formatItemList("Global Options:",d,t))}return this.groupItems(e.commands,t.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,h)=>{let p=d.map(y=>s(t.styleSubcommandTerm(t.subcommandTerm(y)),t.styleSubcommandDescription(t.subcommandDescription(y))));a=a.concat(this.formatItemList(h,p,t))}),a.join(`
7
7
  `)}displayWidth(e){return V2(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,16 +28,16 @@ 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 GN(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=G2(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=G2(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=>UN(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=$s.basename(e,$s.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 z2(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(z2,"incrementNodeInspectorPort");function n0(){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(n0,"useColor");i0.Command=r0;i0.useColor=n0});var X2=S(zn=>{var{Argument:Q2}=Yd(),{Command:s0}=H2(),{CommanderError:zN,InvalidArgumentError:Y2}=Iu(),{Help:HN}=Yy(),{Option:K2}=Zy();zn.program=new s0;zn.createCommand=n=>new s0(n);zn.createOption=(n,e)=>new K2(n,e);zn.createArgument=(n,e)=>new Q2(n,e);zn.Command=s0;zn.Option=K2;zn.Argument=Q2;zn.Help=HN;zn.CommanderError=zN;zn.InvalidArgumentError=Y2;zn.InvalidOptionArgumentError=Y2});var Ru=S(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.AssetClass=void 0;var Z2;(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"})(Z2||(Xd.AssetClass=Z2={}))});var bc=S(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.EffortStatus=void 0;var eT;(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"})(eT||(Jd.EffortStatus=eT={}))});var a0=S(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.EFFORT_STATUS_OPTIONS=Qt.STATUS_NAME_TO_WIKILINK=Qt.STATUS_NAME_TO_ENUM=Qt.EFFORT_STATUS_CONFIG=void 0;Qt.normalizeEffortStatus=QN;Qt.isDoneStatus=YN;Qt.isTrashedStatus=KN;Qt.getEffortStatusLabel=XN;var is=bc();Qt.EFFORT_STATUS_CONFIG=[{name:"Draft",status:is.EffortStatus.DRAFT,wikilink:"[[ems__EffortStatusDraft]]"},{name:"Backlog",status:is.EffortStatus.BACKLOG,wikilink:"[[ems__EffortStatusBacklog]]"},{name:"Analysis",status:is.EffortStatus.ANALYSIS,wikilink:"[[ems__EffortStatusAnalysis]]"},{name:"To Do",status:is.EffortStatus.TODO,wikilink:"[[ems__EffortStatusToDo]]"},{name:"Doing",status:is.EffortStatus.DOING,wikilink:"[[ems__EffortStatusDoing]]"},{name:"Done",status:is.EffortStatus.DONE,wikilink:"[[ems__EffortStatusDone]]"},{name:"Trashed",status:is.EffortStatus.TRASHED,wikilink:"[[ems__EffortStatusTrashed]]"}];Qt.STATUS_NAME_TO_ENUM=Object.fromEntries(Qt.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.status]));Qt.STATUS_NAME_TO_WIKILINK=Object.fromEntries(Qt.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.wikilink]));Qt.EFFORT_STATUS_OPTIONS=Qt.EFFORT_STATUS_CONFIG.map(n=>({value:n.wikilink,label:n.name}));function QN(n,e=is.EffortStatus.DRAFT){if(n.startsWith("ems__")){let r=Qt.EFFORT_STATUS_CONFIG.find(i=>i.status===n);return r?r.status:e}return Qt.STATUS_NAME_TO_ENUM[n]??e}o(QN,"normalizeEffortStatus");function YN(n){return n===is.EffortStatus.DONE}o(YN,"isDoneStatus");function KN(n){return n===is.EffortStatus.TRASHED}o(KN,"isTrashedStatus");function XN(n){if(!n)return"-";let e=String(n);if(e==="")return"-";for(let r of Qt.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 Qt.EFFORT_STATUS_CONFIG)if(r.name.toLowerCase()===t)return r.name;return e}o(XN,"getEffortStatusLabel")});var wc=S(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.GroundingType=void 0;var tT;(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"})(tT||(Zd.GroundingType=tT={}))});var o0=S(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.CommandBindingStyleProperty=Hn.CommandBindingProperty=Hn.GroundingProperty=Hn.PreconditionProperty=Hn.CommandProperty=void 0;Hn.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"};Hn.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};Hn.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",TARGET_VALUE:"exocmd__Grounding_targetValue",STEPS:"exocmd__Grounding_steps"};Hn.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};Hn.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 c0=S(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.STYLE_SOURCE_VALUES=wn.LABEL_CLASS_VALUES=wn.COMMAND_VARIANT_VALUES=void 0;wn.isCommandVariant=JN;wn.isLabelClass=ZN;wn.isStyleSource=eL;wn.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);wn.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);wn.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function JN(n){return typeof n=="string"&&wn.COMMAND_VARIANT_VALUES.includes(n)}o(JN,"isCommandVariant");function ZN(n){return typeof n=="string"&&wn.LABEL_CLASS_VALUES.includes(n)}o(ZN,"isLabelClass");function eL(n){return typeof n=="string"&&wn.STYLE_SOURCE_VALUES.includes(n)}o(eL,"isStyleSource")});var rT=S(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.isCommandFrontmatter=tL;Ec.isPreconditionFrontmatter=rL;Ec.isGroundingFrontmatter=nL;Ec.isCommandBindingFrontmatter=iL;function tL(n){return eh(n,"exocmd__Command")}o(tL,"isCommandFrontmatter");function rL(n){return eh(n,"exocmd__Precondition")}o(rL,"isPreconditionFrontmatter");function nL(n){return eh(n,"exocmd__Grounding")}o(nL,"isGroundingFrontmatter");function iL(n){return eh(n,"exocmd__CommandBinding")}o(iL,"isCommandBindingFrontmatter");function eh(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(eh,"hasInstanceClass")});var nT=S(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.hasPosition=sL;th.isFixed=aL;function sL(n){return typeof n.x=="number"&&typeof n.y=="number"}o(sL,"hasPosition");function aL(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(aL,"isFixed")});var iT=S(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.createEmptyGraphData=oL;rh.mergeGraphData=cL;function oL(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(oL,"createEmptyGraphData");function cL(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(cL,"mergeGraphData")});var l0=S(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.createEdgeId=lL;nh.edgesEqual=uL;function lL(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(lL,"createEdgeId");function uL(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(uL,"edgesEqual")});var u0=S(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.BUILT_IN_EDGE_STYLES=Ut.BUILT_IN_NODE_STYLES=Ut.DEFAULT_EDGE_STYLE=Ut.DEFAULT_NODE_STYLE=Ut.RDF_TYPE_PREDICATES=void 0;Ut.mergeNodeStyles=fL;Ut.mergeEdgeStyles=dL;Ut.extractLocalName=hL;Ut.isClassType=pL;Ut.isTypePredicate=mL;Ut.isSubClassPredicate=gL;Ut.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"};Ut.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Ut.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Ut.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"}};Ut.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 fL(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(fL,"mergeNodeStyles");function dL(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(dL,"mergeEdgeStyles");function hL(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(hL,"extractLocalName");function pL(n){return n===Ut.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Ut.RDF_TYPE_PREDICATES.OWL_CLASS}o(pL,"isClassType");function mL(n){return n===Ut.RDF_TYPE_PREDICATES.RDF_TYPE}o(mL,"isTypePredicate");function gL(n){return n===Ut.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(gL,"isSubClassPredicate")});var aT=S(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0})});var Ae=S(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.IRI=void 0;var f0=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)}}};ih.IRI=f0});var Ne=S(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.Literal=void 0;yo.parseLanguageTag=oT;yo.createDirectionalLiteral=_L;yo.createLiteralFromLanguageTag=SL;var yL="http://www.w3.org/2001/XMLSchema#string",Pu=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===yL?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}};yo.Literal=Pu;function oT(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(oT,"parseLanguageTag");function _L(n,e,t){return new Pu(n,void 0,e,t)}o(_L,"createDirectionalLiteral");function SL(n,e){let{language:t,direction:r}=oT(e);return new Pu(n,void 0,t,r)}o(SL,"createLiteralFromLanguageTag")});var qt=S(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.BlankNode=void 0;var sh=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())}};ah.BlankNode=sh;sh.counter=0});var yr=S(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.Namespace=void 0;var cT=Ae(),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 cT.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new cT.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)}};oh.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 Qn=S(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.Triple=void 0;var d0=Ae(),h0=Ne(),p0=qt(),m0=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 d0.IRI&&t instanceof d0.IRI||e instanceof p0.BlankNode&&t instanceof p0.BlankNode||e instanceof h0.Literal&&t instanceof h0.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 d0.IRI?`<${e.value}>`:e instanceof p0.BlankNode||e instanceof h0.Literal||this.isQuotedTriple(e)?e.toString():""}};ch.Triple=m0});var Ou=S(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.QuotedTriple=void 0;var g0=Ae(),y0=Ne(),_0=qt(),S0=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 g0.IRI&&t instanceof g0.IRI||e instanceof _0.BlankNode&&t instanceof _0.BlankNode||e instanceof y0.Literal&&t instanceof y0.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 g0.IRI?`<${e.value}>`:e instanceof _0.BlankNode||e instanceof y0.Literal||e instanceof n?e.toString():""}};lh.QuotedTriple=S0});var lT=S(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.QuotedTriple=er.Triple=er.Namespace=er.BlankNode=er.createLiteralFromLanguageTag=er.createDirectionalLiteral=er.parseLanguageTag=er.Literal=er.IRI=void 0;var vL=Ae();Object.defineProperty(er,"IRI",{enumerable:!0,get:o(function(){return vL.IRI},"get")});var uh=Ne();Object.defineProperty(er,"Literal",{enumerable:!0,get:o(function(){return uh.Literal},"get")});Object.defineProperty(er,"parseLanguageTag",{enumerable:!0,get:o(function(){return uh.parseLanguageTag},"get")});Object.defineProperty(er,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return uh.createDirectionalLiteral},"get")});Object.defineProperty(er,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return uh.createLiteralFromLanguageTag},"get")});var bL=qt();Object.defineProperty(er,"BlankNode",{enumerable:!0,get:o(function(){return bL.BlankNode},"get")});var wL=yr();Object.defineProperty(er,"Namespace",{enumerable:!0,get:o(function(){return wL.Namespace},"get")});var EL=Qn();Object.defineProperty(er,"Triple",{enumerable:!0,get:o(function(){return EL.Triple},"get")});var TL=Ou();Object.defineProperty(er,"QuotedTriple",{enumerable:!0,get:o(function(){return TL.QuotedTriple},"get")})});var fh=S(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.UUID_URL_NAMESPACE=Kn.DEFAULT_LANGUAGE_TAG=Kn.REQUIRED_PROPERTIES=Kn.ALLOWED_PROPERTIES=Kn.Exo003MetadataType=void 0;var Yn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(Yn||(Kn.Exo003MetadataType=Yn={}));Kn.ALLOWED_PROPERTIES={[Yn.Namespace]:["metadata","uri","aliases"],[Yn.Anchor]:["metadata","uri","aliases"],[Yn.BlankNode]:["metadata","uri","aliases"],[Yn.Statement]:["metadata","subject","predicate","object","aliases"],[Yn.Body]:["metadata","subject","predicate","aliases"]};Kn.REQUIRED_PROPERTIES={[Yn.Namespace]:["metadata","uri"],[Yn.Anchor]:["metadata","uri"],[Yn.BlankNode]:["metadata","uri"],[Yn.Statement]:["metadata","subject","predicate","object"],[Yn.Body]:["metadata","subject","predicate"]};Kn.DEFAULT_LANGUAGE_TAG="ru";Kn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var uT=S(v0=>{"use strict";Object.defineProperty(v0,"__esModule",{value:!0});v0.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var fT=S(b0=>{"use strict";Object.defineProperty(b0,"__esModule",{value:!0});b0.default="00000000-0000-0000-0000-000000000000"});var dT=S(w0=>{"use strict";Object.defineProperty(w0,"__esModule",{value:!0});w0.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 Fu=S(E0=>{"use strict";Object.defineProperty(E0,"__esModule",{value:!0});var AL=dT();function xL(n){return typeof n=="string"&&AL.default.test(n)}o(xL,"validate");E0.default=xL});var Du=S(T0=>{"use strict";Object.defineProperty(T0,"__esModule",{value:!0});var CL=Fu();function IL(n){if(!(0,CL.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(IL,"parse");T0.default=IL});var Vs=S(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.unsafeStringify=void 0;var RL=Fu(),Fr=[];for(let n=0;n<256;++n)Fr.push((n+256).toString(16).slice(1));function hT(n,e=0){return(Fr[n[e+0]]+Fr[n[e+1]]+Fr[n[e+2]]+Fr[n[e+3]]+"-"+Fr[n[e+4]]+Fr[n[e+5]]+"-"+Fr[n[e+6]]+Fr[n[e+7]]+"-"+Fr[n[e+8]]+Fr[n[e+9]]+"-"+Fr[n[e+10]]+Fr[n[e+11]]+Fr[n[e+12]]+Fr[n[e+13]]+Fr[n[e+14]]+Fr[n[e+15]]).toLowerCase()}o(hT,"unsafeStringify");Nu.unsafeStringify=hT;function PL(n,e=0){let t=hT(n,e);if(!(0,RL.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(PL,"stringify");Nu.default=PL});var ph=S(A0=>{"use strict";Object.defineProperty(A0,"__esModule",{value:!0});var OL=require("crypto"),hh=new Uint8Array(256),dh=hh.length;function FL(){return dh>hh.length-16&&((0,OL.randomFillSync)(hh),dh=0),hh.slice(dh,dh+=16)}o(FL,"rng");A0.default=FL});var x0=S(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.updateV1State=void 0;var pT=ph(),DL=Vs(),Lu={};function NL(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=mT(n.random??n.rng?.()??(0,pT.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,pT.default)();gT(Lu,s,a),r=mT(a,Lu.msecs,Lu.nsecs,i?void 0:Lu.clockseq,i?void 0:Lu.node,e,t)}return e??(0,DL.unsafeStringify)(r)}o(NL,"v1");function gT(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(gT,"updateV1State");ku.updateV1State=gT;function mT(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(mT,"v1Bytes");ku.default=NL});var I0=S(C0=>{"use strict";Object.defineProperty(C0,"__esModule",{value:!0});var LL=Du(),kL=Vs();function ML(n){let e=typeof n=="string"?(0,LL.default)(n):n,t=jL(e);return typeof n=="string"?(0,kL.unsafeStringify)(t):t}o(ML,"v1ToV6");C0.default=ML;function jL(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(jL,"_v1ToV6")});var yT=S(R0=>{"use strict";Object.defineProperty(R0,"__esModule",{value:!0});var $L=require("crypto");function VL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,$L.createHash)("md5").update(n).digest()}o(VL,"md5");R0.default=VL});var Mu=S(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.URL=Bs.DNS=Bs.stringToBytes=void 0;var _T=Du(),BL=Vs();function ST(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(ST,"stringToBytes");Bs.stringToBytes=ST;Bs.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Bs.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function UL(n,e,t,r,i,s){let a=typeof t=="string"?ST(t):t,c=typeof r=="string"?(0,_T.default)(r):r;if(typeof r=="string"&&(r=(0,_T.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,BL.unsafeStringify)(l)}o(UL,"v35");Bs.default=UL});var bT=S(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.URL=_o.DNS=void 0;var qL=yT(),P0=Mu(),vT=Mu();Object.defineProperty(_o,"DNS",{enumerable:!0,get:o(function(){return vT.DNS},"get")});Object.defineProperty(_o,"URL",{enumerable:!0,get:o(function(){return vT.URL},"get")});function O0(n,e,t,r){return(0,P0.default)(48,qL.default,n,e,t,r)}o(O0,"v3");O0.DNS=P0.DNS;O0.URL=P0.URL;_o.default=O0});var wT=S(F0=>{"use strict";Object.defineProperty(F0,"__esModule",{value:!0});var WL=require("crypto");F0.default={randomUUID:WL.randomUUID}});var TT=S(D0=>{"use strict";Object.defineProperty(D0,"__esModule",{value:!0});var ET=wT(),GL=ph(),zL=Vs();function HL(n,e,t){if(ET.default.randomUUID&&!e&&!n)return ET.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,GL.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,zL.unsafeStringify)(r)}o(HL,"v4");D0.default=HL});var AT=S(N0=>{"use strict";Object.defineProperty(N0,"__esModule",{value:!0});var QL=require("crypto");function YL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,QL.createHash)("sha1").update(n).digest()}o(YL,"sha1");N0.default=YL});var CT=S(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.URL=So.DNS=void 0;var KL=AT(),L0=Mu(),xT=Mu();Object.defineProperty(So,"DNS",{enumerable:!0,get:o(function(){return xT.DNS},"get")});Object.defineProperty(So,"URL",{enumerable:!0,get:o(function(){return xT.URL},"get")});function k0(n,e,t,r){return(0,L0.default)(80,KL.default,n,e,t,r)}o(k0,"v5");k0.DNS=L0.DNS;k0.URL=L0.URL;So.default=k0});var IT=S(M0=>{"use strict";Object.defineProperty(M0,"__esModule",{value:!0});var XL=Vs(),JL=x0(),ZL=I0();function ek(n,e,t){n??={},t??=0;let r=(0,JL.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,ZL.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,XL.unsafeStringify)(r)}o(ek,"v6");M0.default=ek});var RT=S(j0=>{"use strict";Object.defineProperty(j0,"__esModule",{value:!0});var tk=Du(),rk=Vs();function nk(n){let e=typeof n=="string"?(0,tk.default)(n):n,t=ik(e);return typeof n=="string"?(0,rk.unsafeStringify)(t):t}o(nk,"v6ToV1");j0.default=nk;function ik(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(ik,"_v6ToV1")});var DT=S(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.updateV7State=void 0;var PT=ph(),sk=Vs(),$0={};function ak(n,e,t){let r;if(n)r=OT(n.random??n.rng?.()??(0,PT.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,PT.default)();FT($0,i,s),r=OT(s,$0.msecs,$0.seq,e,t)}return e??(0,sk.unsafeStringify)(r)}o(ak,"v7");function FT(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(FT,"updateV7State");ju.updateV7State=FT;function OT(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(OT,"v7Bytes");ju.default=ak});var NT=S(V0=>{"use strict";Object.defineProperty(V0,"__esModule",{value:!0});var ok=Fu();function ck(n){if(!(0,ok.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(ck,"version");V0.default=ck});var En=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 lk=uT();Object.defineProperty(ot,"MAX",{enumerable:!0,get:o(function(){return lk.default},"get")});var uk=fT();Object.defineProperty(ot,"NIL",{enumerable:!0,get:o(function(){return uk.default},"get")});var fk=Du();Object.defineProperty(ot,"parse",{enumerable:!0,get:o(function(){return fk.default},"get")});var dk=Vs();Object.defineProperty(ot,"stringify",{enumerable:!0,get:o(function(){return dk.default},"get")});var hk=x0();Object.defineProperty(ot,"v1",{enumerable:!0,get:o(function(){return hk.default},"get")});var pk=I0();Object.defineProperty(ot,"v1ToV6",{enumerable:!0,get:o(function(){return pk.default},"get")});var mk=bT();Object.defineProperty(ot,"v3",{enumerable:!0,get:o(function(){return mk.default},"get")});var gk=TT();Object.defineProperty(ot,"v4",{enumerable:!0,get:o(function(){return gk.default},"get")});var yk=CT();Object.defineProperty(ot,"v5",{enumerable:!0,get:o(function(){return yk.default},"get")});var _k=IT();Object.defineProperty(ot,"v6",{enumerable:!0,get:o(function(){return _k.default},"get")});var Sk=RT();Object.defineProperty(ot,"v6ToV1",{enumerable:!0,get:o(function(){return Sk.default},"get")});var vk=DT();Object.defineProperty(ot,"v7",{enumerable:!0,get:o(function(){return vk.default},"get")});var bk=Fu();Object.defineProperty(ot,"validate",{enumerable:!0,get:o(function(){return bk.default},"get")});var wk=NT();Object.defineProperty(ot,"version",{enumerable:!0,get:o(function(){return wk.default},"get")})});var q0=S(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.Exo003UUIDGenerator=void 0;var B0=En(),LT=fh(),U0=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,B0.v5)(e,LT.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,B0.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,B0.v5)(e,LT.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)}};mh.Exo003UUIDGenerator=U0});var MT=S(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.Exo003Parser=void 0;var mt=fh(),$u=q0(),wa=Ae(),gh=Ne(),kT=qt(),Ek=Qn(),W0=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 wa.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 wa.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 wa.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 wa.IRI(i.value);else if(i.type==="blank")s=new kT.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 wa.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new wa.IRI(l.value);else if(l.type==="blank")u=new kT.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new gh.Literal(f,new wa.IRI(l.datatype));else{let d=l.language||mt.DEFAULT_LANGUAGE_TAG;u=(0,gh.createDirectionalLiteral)(f,d,l.direction)}}return new Ek.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new gh.Literal(t,new wa.IRI(r.datatype));let i=r?.language||mt.DEFAULT_LANGUAGE_TAG;return(0,gh.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 $u.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Anchor:return $u.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.BlankNode:return $u.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Statement:{let r=e;return $u.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case mt.Exo003MetadataType.Body:{let r=e;return $u.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};yh.Exo003Parser=W0});var G0=S(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.Exo003Parser=qr.Exo003UUIDGenerator=qr.UUID_URL_NAMESPACE=qr.DEFAULT_LANGUAGE_TAG=qr.REQUIRED_PROPERTIES=qr.ALLOWED_PROPERTIES=qr.Exo003MetadataType=void 0;var Vu=fh();Object.defineProperty(qr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Vu.Exo003MetadataType},"get")});Object.defineProperty(qr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Vu.ALLOWED_PROPERTIES},"get")});Object.defineProperty(qr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Vu.REQUIRED_PROPERTIES},"get")});Object.defineProperty(qr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Vu.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(qr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Vu.UUID_URL_NAMESPACE},"get")});var Tk=q0();Object.defineProperty(qr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return Tk.Exo003UUIDGenerator},"get")});var Ak=MT();Object.defineProperty(qr,"Exo003Parser",{enumerable:!0,get:o(function(){return Ak.Exo003Parser},"get")})});var Us=S(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.WikiLinkHelpers=void 0;var Bu=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)}};_h.WikiLinkHelpers=Bu;Bu.WIKI_LINK_PATTERN=/\[\[|\]\]/g;Bu.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var kn=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 xk=Ru();Object.defineProperty(et,"AssetClass",{enumerable:!0,get:o(function(){return xk.AssetClass},"get")});var Ck=bc();Object.defineProperty(et,"EffortStatus",{enumerable:!0,get:o(function(){return Ck.EffortStatus},"get")});var Ea=a0();Object.defineProperty(et,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return Ea.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(et,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return Ea.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(et,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return Ea.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(et,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return Ea.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(et,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return Ea.normalizeEffortStatus},"get")});Object.defineProperty(et,"isDoneStatus",{enumerable:!0,get:o(function(){return Ea.isDoneStatus},"get")});Object.defineProperty(et,"isTrashedStatus",{enumerable:!0,get:o(function(){return Ea.isTrashedStatus},"get")});Object.defineProperty(et,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return Ea.getEffortStatusLabel},"get")});var Ik=wc();Object.defineProperty(et,"GroundingType",{enumerable:!0,get:o(function(){return Ik.GroundingType},"get")});var Sh=o0();Object.defineProperty(et,"CommandProperty",{enumerable:!0,get:o(function(){return Sh.CommandProperty},"get")});Object.defineProperty(et,"PreconditionProperty",{enumerable:!0,get:o(function(){return Sh.PreconditionProperty},"get")});Object.defineProperty(et,"GroundingProperty",{enumerable:!0,get:o(function(){return Sh.GroundingProperty},"get")});Object.defineProperty(et,"CommandBindingProperty",{enumerable:!0,get:o(function(){return Sh.CommandBindingProperty},"get")})});var wo=S(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.hasClass=bo;Wr.isAreaOrProject=Rk;Wr.isEffort=Pk;Wr.hasStatus=Ok;Wr.isAssetArchived=Fk;Wr.hasEmptyProperties=Dk;Wr.needsFolderRepair=Nk;Wr.getTodayDateString=z0;Wr.isPlannedForToday=Lk;Wr.hasPlannedStartTimestamp=kk;Wr.extractDailyNoteDate=Mk;Wr.isCurrentDateGteDay=jk;Wr.inheritsFromPrototype=VT;Wr.isPrototypeClass=Vk;var $T=Us(),vo=kn();function bo(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>$T.WikiLinkHelpers.normalize(r)===e):!1}o(bo,"hasClass");function Rk(n){return bo(n,vo.AssetClass.AREA)||bo(n,vo.AssetClass.PROJECT)}o(Rk,"isAreaOrProject");function Pk(n){return bo(n,vo.AssetClass.TASK)||bo(n,vo.AssetClass.PROJECT)||bo(n,vo.AssetClass.MEETING)}o(Pk,"isEffort");function Ok(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?$T.WikiLinkHelpers.normalize(t)===e:!1}o(Ok,"hasStatus");function Fk(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(Fk,"isAssetArchived");function Dk(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(Dk,"hasEmptyProperties");function Nk(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(Nk,"needsFolderRepair");function z0(){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(z0,"getTodayDateString");function Lk(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=z0();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(Lk,"isPlannedForToday");function kk(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(kk,"hasPlannedStartTimestamp");function Mk(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(Mk,"extractDailyNoteDate");function jk(n){return z0()>=n}o(jk,"isCurrentDateGteDay");function jT(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(jT,"normalizeWithQuotes");var $k=10;function VT(n,e=$k){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=jT(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===vo.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=jT(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(VT,"inheritsFromPrototype");function Vk(n,e){return bo(n,vo.AssetClass.CLASS)?VT(e):!1}o(Vk,"isPrototypeClass")});var BT=S(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.canCreateTask=Bk;Ac.canCreateRelatedTask=Uk;Ac.canConvertTaskToProject=qk;Ac.canSetCriticalityZone=Wk;var Tc=wo(),H0=kn();function Bk(n){return(0,Tc.isAreaOrProject)(n.instanceClass)}o(Bk,"canCreateTask");function Uk(n){return!(!(0,Tc.hasClass)(n.instanceClass,H0.AssetClass.TASK)||(0,Tc.isAssetArchived)(n.isArchived))}o(Uk,"canCreateRelatedTask");function qk(n){return(0,Tc.hasClass)(n.instanceClass,H0.AssetClass.TASK)}o(qk,"canConvertTaskToProject");function Wk(n){return!(!(0,Tc.hasClass)(n.instanceClass,H0.AssetClass.TASK)||(0,Tc.isAssetArchived)(n.isArchived))}o(Wk,"canSetCriticalityZone")});var UT=S(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.canCreateProject=Gk;xc.canMoveToAnalysis=zk;xc.canMoveToToDo=Hk;xc.canConvertProjectToTask=Qk;var Ta=wo(),Aa=kn();function Gk(n){return(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.AREA)||(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.INITIATIVE)||(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.PROJECT)}o(Gk,"canCreateProject");function zk(n){return(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.PROJECT)?(0,Ta.hasStatus)(n.currentStatus,Aa.EffortStatus.BACKLOG):!1}o(zk,"canMoveToAnalysis");function Hk(n){return(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.PROJECT)?(0,Ta.hasStatus)(n.currentStatus,Aa.EffortStatus.ANALYSIS):!1}o(Hk,"canMoveToToDo");function Qk(n){return(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.PROJECT)}o(Qk,"canConvertProjectToTask")});var GT=S(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.canCreateChildArea=Yk;vh.canSetActiveFocus=Kk;var qT=wo(),WT=kn();function Yk(n){return(0,qT.hasClass)(n.instanceClass,WT.AssetClass.AREA)}o(Yk,"canCreateChildArea");function Kk(n){return(0,qT.hasClass)(n.instanceClass,WT.AssetClass.AREA)}o(Kk,"canSetActiveFocus")});var HT=S(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.canPlanOnToday=Xk;cn.canPlanForEvening=Jk;cn.canShiftDayBackward=Zk;cn.canShiftDayForward=eM;cn.canSetDraftStatus=tM;cn.canMoveToBacklog=rM;cn.canStartEffort=nM;cn.canMarkDone=iM;cn.canTrashEffort=sM;cn.canVoteOnEffort=aM;cn.canRollbackStatus=oM;cn.canArchiveTask=cM;cn.canMarkReviewed=lM;var zT=Us(),dt=wo(),on=kn();function Xk(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isPlannedForToday)(n.metadata))}o(Xk,"canPlanOnToday");function Jk(n){return!(0,dt.hasClass)(n.instanceClass,on.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,on.AssetClass.MEETING)?!1:(0,dt.hasStatus)(n.currentStatus,on.EffortStatus.BACKLOG)}o(Jk,"canPlanForEvening");function Zk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(Zk,"canShiftDayBackward");function eM(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(eM,"canShiftDayForward");function tM(n){return(0,dt.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(tM,"canSetDraftStatus");function rM(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,on.EffortStatus.DRAFT):!1}o(rM,"canMoveToBacklog");function nM(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasClass)(n.instanceClass,on.AssetClass.TASK)||(0,dt.hasClass)(n.instanceClass,on.AssetClass.MEETING)?(0,dt.hasStatus)(n.currentStatus,on.EffortStatus.BACKLOG):(0,dt.hasClass)(n.instanceClass,on.AssetClass.PROJECT)?(0,dt.hasStatus)(n.currentStatus,on.EffortStatus.TODO):!1:!1}o(nM,"canStartEffort");function iM(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,on.EffortStatus.DOING):!1}o(iM,"canMarkDone");function sM(n){return(0,dt.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=zT.WikiLinkHelpers.normalize(r);return i===on.EffortStatus.TRASHED||i===on.EffortStatus.DONE}):!0:!1}o(sM,"canTrashEffort");function aM(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isAssetArchived)(n.isArchived))}o(aM,"canVoteOnEffort");function oM(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||zT.WikiLinkHelpers.normalize(e)===on.EffortStatus.TRASHED)}o(oM,"canRollbackStatus");function cM(n){return!(0,dt.isAssetArchived)(n.isArchived)}o(cM,"canArchiveTask");function lM(n){return!(!(0,dt.hasClass)(n.instanceClass,on.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,on.AssetClass.PROJECT)||(0,dt.isAssetArchived)(n.isArchived))}o(lM,"canMarkReviewed")});var QT=S(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.canCreateEvent=dM;Xn.canCreateInstance=hM;Xn.canCleanProperties=pM;Xn.canRepairFolder=mM;Xn.canRenameToUid=gM;Xn.canCopyLabelToAliases=yM;Xn.canCreateNarrowerConcept=_M;Xn.canCreateSubclass=SM;Xn.canCreateTaskForDailyNote=vM;Xn.canCopyFleetingNoteLabel=bM;var Gr=wo(),qs=kn(),uM="75302770-279e-4a59-ba85-09df29725713",fM="fca0a931-a01f-48e4-b72a-4af206c94bc7";function dM(n){return(0,Gr.isAreaOrProject)(n.instanceClass)}o(dM,"canCreateEvent");function hM(n){return(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.TASK_PROTOTYPE)||(0,Gr.hasClass)(n.instanceClass,uM)||(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.MEETING_PROTOTYPE)||(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.EVENT_PROTOTYPE)||(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.PROJECT_PROTOTYPE)||(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,Gr.isPrototypeClass)(n.instanceClass,n.metadata)}o(hM,"canCreateInstance");function pM(n){return(0,Gr.hasEmptyProperties)(n.metadata)}o(pM,"canCleanProperties");function mM(n){return(0,Gr.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(mM,"canRepairFolder");function gM(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(gM,"canRenameToUid");function yM(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(yM,"canCopyLabelToAliases");function _M(n){return(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.CONCEPT)}o(_M,"canCreateNarrowerConcept");function SM(n){return(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.CLASS)}o(SM,"canCreateSubclass");function vM(n){return!(!(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.DAILY_NOTE)||n.isArchived||!(0,Gr.extractDailyNoteDate)(n.metadata))}o(vM,"canCreateTaskForDailyNote");function bM(n){return(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.FLEETING_NOTE)||(0,Gr.hasClass)(n.instanceClass,fM)}o(bM,"canCopyFleetingNoteLabel")});var KT=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 Tn=wo();Object.defineProperty(L,"hasClass",{enumerable:!0,get:o(function(){return Tn.hasClass},"get")});Object.defineProperty(L,"isAreaOrProject",{enumerable:!0,get:o(function(){return Tn.isAreaOrProject},"get")});Object.defineProperty(L,"isEffort",{enumerable:!0,get:o(function(){return Tn.isEffort},"get")});Object.defineProperty(L,"hasStatus",{enumerable:!0,get:o(function(){return Tn.hasStatus},"get")});Object.defineProperty(L,"isAssetArchived",{enumerable:!0,get:o(function(){return Tn.isAssetArchived},"get")});Object.defineProperty(L,"hasEmptyProperties",{enumerable:!0,get:o(function(){return Tn.hasEmptyProperties},"get")});Object.defineProperty(L,"needsFolderRepair",{enumerable:!0,get:o(function(){return Tn.needsFolderRepair},"get")});Object.defineProperty(L,"getTodayDateString",{enumerable:!0,get:o(function(){return Tn.getTodayDateString},"get")});Object.defineProperty(L,"isPlannedForToday",{enumerable:!0,get:o(function(){return Tn.isPlannedForToday},"get")});Object.defineProperty(L,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return Tn.hasPlannedStartTimestamp},"get")});Object.defineProperty(L,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return Tn.extractDailyNoteDate},"get")});Object.defineProperty(L,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return Tn.isCurrentDateGteDay},"get")});Object.defineProperty(L,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return Tn.inheritsFromPrototype},"get")});Object.defineProperty(L,"isPrototypeClass",{enumerable:!0,get:o(function(){return Tn.isPrototypeClass},"get")});var bh=BT();Object.defineProperty(L,"canCreateTask",{enumerable:!0,get:o(function(){return bh.canCreateTask},"get")});Object.defineProperty(L,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return bh.canCreateRelatedTask},"get")});Object.defineProperty(L,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return bh.canConvertTaskToProject},"get")});Object.defineProperty(L,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return bh.canSetCriticalityZone},"get")});var wh=UT();Object.defineProperty(L,"canCreateProject",{enumerable:!0,get:o(function(){return wh.canCreateProject},"get")});Object.defineProperty(L,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return wh.canMoveToAnalysis},"get")});Object.defineProperty(L,"canMoveToToDo",{enumerable:!0,get:o(function(){return wh.canMoveToToDo},"get")});Object.defineProperty(L,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return wh.canConvertProjectToTask},"get")});var YT=GT();Object.defineProperty(L,"canCreateChildArea",{enumerable:!0,get:o(function(){return YT.canCreateChildArea},"get")});Object.defineProperty(L,"canSetActiveFocus",{enumerable:!0,get:o(function(){return YT.canSetActiveFocus},"get")});var Mn=HT();Object.defineProperty(L,"canPlanOnToday",{enumerable:!0,get:o(function(){return Mn.canPlanOnToday},"get")});Object.defineProperty(L,"canPlanForEvening",{enumerable:!0,get:o(function(){return Mn.canPlanForEvening},"get")});Object.defineProperty(L,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Mn.canShiftDayBackward},"get")});Object.defineProperty(L,"canShiftDayForward",{enumerable:!0,get:o(function(){return Mn.canShiftDayForward},"get")});Object.defineProperty(L,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Mn.canSetDraftStatus},"get")});Object.defineProperty(L,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Mn.canMoveToBacklog},"get")});Object.defineProperty(L,"canStartEffort",{enumerable:!0,get:o(function(){return Mn.canStartEffort},"get")});Object.defineProperty(L,"canMarkDone",{enumerable:!0,get:o(function(){return Mn.canMarkDone},"get")});Object.defineProperty(L,"canTrashEffort",{enumerable:!0,get:o(function(){return Mn.canTrashEffort},"get")});Object.defineProperty(L,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Mn.canVoteOnEffort},"get")});Object.defineProperty(L,"canRollbackStatus",{enumerable:!0,get:o(function(){return Mn.canRollbackStatus},"get")});Object.defineProperty(L,"canArchiveTask",{enumerable:!0,get:o(function(){return Mn.canArchiveTask},"get")});Object.defineProperty(L,"canMarkReviewed",{enumerable:!0,get:o(function(){return Mn.canMarkReviewed},"get")});var ss=QT();Object.defineProperty(L,"canCreateEvent",{enumerable:!0,get:o(function(){return ss.canCreateEvent},"get")});Object.defineProperty(L,"canCreateInstance",{enumerable:!0,get:o(function(){return ss.canCreateInstance},"get")});Object.defineProperty(L,"canCleanProperties",{enumerable:!0,get:o(function(){return ss.canCleanProperties},"get")});Object.defineProperty(L,"canRepairFolder",{enumerable:!0,get:o(function(){return ss.canRepairFolder},"get")});Object.defineProperty(L,"canRenameToUid",{enumerable:!0,get:o(function(){return ss.canRenameToUid},"get")});Object.defineProperty(L,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return ss.canCopyLabelToAliases},"get")});Object.defineProperty(L,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return ss.canCreateNarrowerConcept},"get")});Object.defineProperty(L,"canCreateSubclass",{enumerable:!0,get:o(function(){return ss.canCreateSubclass},"get")});Object.defineProperty(L,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return ss.canCreateTaskForDailyNote},"get")});Object.defineProperty(L,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return ss.canCopyFleetingNoteLabel},"get")})});var XT=S(Eo=>{"use strict";var wM=Eo&&Eo.__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]})),EM=Eo&&Eo.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&wM(e,n,t)};Object.defineProperty(Eo,"__esModule",{value:!0});EM(KT(),Eo)});var Eh=S(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.PropertyFieldType=void 0;Uu.rangeToFieldType=xM;var Dr;(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"})(Dr||(Uu.PropertyFieldType=Dr={}));var JT="http://www.w3.org/2001/XMLSchema#",TM="https://exocortex.my/ontology/exo#",AM="https://exocortex.my/ontology/ems#";function xM(n){if(!n)return Dr.Unknown;let e=n.trim();if(!e)return Dr.Unknown;if(e.startsWith(JT)){let t=e.substring(JT.length);return Q0(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return Q0(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return Q0(r)}return e.startsWith(AM)||e.startsWith("ems:")?CM(e):e.startsWith(TM)||e.startsWith("exo:")||IM(e)?Dr.Reference:Dr.Text}o(xM,"rangeToFieldType");function Q0(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Dr.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 Dr.Number;case"date":return Dr.Date;case"datetime":case"datetimestamp":return Dr.DateTime;case"boolean":return Dr.Boolean;case"time":return Dr.Timestamp;default:return Dr.Text}}o(Q0,"xsdTypeToFieldType");function CM(n){let e=n.toLowerCase();return e.includes("effortstatus")?Dr.StatusSelect:e.includes("tasksize")?Dr.SizeSelect:Dr.Reference}o(CM,"emsTypeToFieldType");function IM(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(IM,"isClassReference")});var Y0=S(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.propertyNameToUri=RM;qu.uriToPropertyName=ZT;qu.extractPropertyLabel=PM;function RM(n){return n.replace(/^([a-z]+)__/,"$1:")}o(RM,"propertyNameToUri");function ZT(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(ZT,"uriToPropertyName");function PM(n){let r=(n.includes(":")?ZT(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(PM,"extractPropertyLabel")});var Th={};Uy(Th,{__assign:()=>X0,__asyncDelegator:()=>qM,__asyncGenerator:()=>UM,__asyncValues:()=>WM,__await:()=>Wu,__awaiter:()=>kM,__classPrivateFieldGet:()=>QM,__classPrivateFieldSet:()=>YM,__createBinding:()=>jM,__decorate:()=>DM,__exportStar:()=>$M,__extends:()=>OM,__generator:()=>MM,__importDefault:()=>HM,__importStar:()=>zM,__makeTemplateObject:()=>GM,__metadata:()=>LM,__param:()=>NM,__read:()=>eA,__rest:()=>FM,__spread:()=>VM,__spreadArrays:()=>BM,__values:()=>J0});function OM(n,e){K0(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function FM(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 DM(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 NM(n,e){return function(t,r){e(t,r,n)}}function LM(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function kM(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 MM(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 jM(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function $M(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function J0(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 eA(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 VM(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(eA(arguments[e]));return n}function BM(){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 Wu(n){return this instanceof Wu?(this.v=n,this):new Wu(n)}function UM(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){r[h]&&(i[h]=function(p){return new Promise(function(y,v){s.push([h,p,y,v])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(y){d(s[0][3],y)}}function l(h){h.value instanceof Wu?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 qM(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:Wu(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function WM(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 J0=="function"?J0(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 GM(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function zM(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 HM(n){return n&&n.__esModule?n:{default:n}}function QM(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function YM(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 K0,X0,Ah=FN(()=>{K0=o(function(n,e){return K0=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])},K0(n,e)},"extendStatics");o(OM,"__extends");X0=o(function(){return X0=Object.assign||o(function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),X0.apply(this,arguments)},"__assign");o(FM,"__rest");o(DM,"__decorate");o(NM,"__param");o(LM,"__metadata");o(kM,"__awaiter");o(MM,"__generator");o(jM,"__createBinding");o($M,"__exportStar");o(J0,"__values");o(eA,"__read");o(VM,"__spread");o(BM,"__spreadArrays");o(Wu,"__await");o(UM,"__asyncGenerator");o(qM,"__asyncDelegator");o(WM,"__asyncValues");o(GM,"__makeTemplateObject");o(zM,"__importStar");o(HM,"__importDefault");o(QM,"__classPrivateFieldGet");o(YM,"__classPrivateFieldSet")});var t_=S(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var Z0;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(Z0||(Z0={}));e_.default=Z0});var tA=S(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var KM=t_();Object.defineProperty(r_,"Lifecycle",{enumerable:!0,get:o(function(){return KM.default},"get")})});var To=S(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.defineInjectionTokenMetadata=fi.getParamInfo=fi.INJECTION_TOKEN_METADATA_KEY=void 0;fi.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function XM(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(fi.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(XM,"getParamInfo");fi.getParamInfo=XM;function JM(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(fi.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(fi.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(JM,"defineInjectionTokenMetadata");fi.defineInjectionTokenMetadata=JM});var n_=S(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.isClassProvider=void 0;function ZM(n){return!!n.useClass}o(ZM,"isClassProvider");xh.isClassProvider=ZM});var i_=S(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.isFactoryProvider=void 0;function e4(n){return!!n.useFactory}o(e4,"isFactoryProvider");Ch.isFactoryProvider=e4});var Rh=S(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.delay=Cc.DelayedConstructor=void 0;var Ih=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}};Cc.DelayedConstructor=Ih;function t4(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new Ih(n)}o(t4,"delay");Cc.delay=t4});var Ph=S(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.isConstructorToken=as.isTransformDescriptor=as.isTokenDescriptor=as.isNormalToken=void 0;var r4=Rh();function n4(n){return typeof n=="string"||typeof n=="symbol"}o(n4,"isNormalToken");as.isNormalToken=n4;function i4(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(i4,"isTokenDescriptor");as.isTokenDescriptor=i4;function s4(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(s4,"isTransformDescriptor");as.isTransformDescriptor=s4;function a4(n){return typeof n=="function"||n instanceof r4.DelayedConstructor}o(a4,"isConstructorToken");as.isConstructorToken=a4});var s_=S(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.isTokenProvider=void 0;function o4(n){return!!n.useToken}o(o4,"isTokenProvider");Oh.isTokenProvider=o4});var a_=S(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.isValueProvider=void 0;function c4(n){return n.useValue!=null}o(c4,"isValueProvider");Fh.isValueProvider=c4});var o_=S(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});var l4=n_();Object.defineProperty(Ao,"isClassProvider",{enumerable:!0,get:o(function(){return l4.isClassProvider},"get")});var u4=i_();Object.defineProperty(Ao,"isFactoryProvider",{enumerable:!0,get:o(function(){return u4.isFactoryProvider},"get")});var f4=Ph();Object.defineProperty(Ao,"isNormalToken",{enumerable:!0,get:o(function(){return f4.isNormalToken},"get")});var d4=s_();Object.defineProperty(Ao,"isTokenProvider",{enumerable:!0,get:o(function(){return d4.isTokenProvider},"get")});var h4=a_();Object.defineProperty(Ao,"isValueProvider",{enumerable:!0,get:o(function(){return h4.isValueProvider},"get")})});var rA=S(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.isProvider=void 0;var p4=n_(),m4=a_(),g4=s_(),y4=i_();function _4(n){return p4.isClassProvider(n)||m4.isValueProvider(n)||g4.isTokenProvider(n)||y4.isFactoryProvider(n)}o(_4,"isProvider");Dh.isProvider=_4});var u_=S(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var c_=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,[])}};l_.default=c_});var nA=S(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var S4=u_(),f_=class extends S4.default{static{o(this,"Registry")}};d_.default=f_});var iA=S(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var h_=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};p_.default=h_});var m_=S(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.formatErrorCtor=void 0;function v4(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(v4,"formatDependency");function b4(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 z2(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(z2,"incrementNodeInspectorPort");function n0(){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(n0,"useColor");i0.Command=r0;i0.useColor=n0});var X2=S(zn=>{var{Argument:Q2}=Yd(),{Command:s0}=H2(),{CommanderError:zN,InvalidArgumentError:Y2}=Iu(),{Help:HN}=Yy(),{Option:K2}=Zy();zn.program=new s0;zn.createCommand=n=>new s0(n);zn.createOption=(n,e)=>new K2(n,e);zn.createArgument=(n,e)=>new Q2(n,e);zn.Command=s0;zn.Option=K2;zn.Argument=Q2;zn.Help=HN;zn.CommanderError=zN;zn.InvalidArgumentError=Y2;zn.InvalidOptionArgumentError=Y2});var Ru=S(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.AssetClass=void 0;var Z2;(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"})(Z2||(Xd.AssetClass=Z2={}))});var bc=S(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.EffortStatus=void 0;var eT;(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"})(eT||(Jd.EffortStatus=eT={}))});var a0=S(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.EFFORT_STATUS_OPTIONS=Yt.STATUS_NAME_TO_WIKILINK=Yt.STATUS_NAME_TO_ENUM=Yt.EFFORT_STATUS_CONFIG=void 0;Yt.normalizeEffortStatus=QN;Yt.isDoneStatus=YN;Yt.isTrashedStatus=KN;Yt.getEffortStatusLabel=XN;var is=bc();Yt.EFFORT_STATUS_CONFIG=[{name:"Draft",status:is.EffortStatus.DRAFT,wikilink:"[[ems__EffortStatusDraft]]"},{name:"Backlog",status:is.EffortStatus.BACKLOG,wikilink:"[[ems__EffortStatusBacklog]]"},{name:"Analysis",status:is.EffortStatus.ANALYSIS,wikilink:"[[ems__EffortStatusAnalysis]]"},{name:"To Do",status:is.EffortStatus.TODO,wikilink:"[[ems__EffortStatusToDo]]"},{name:"Doing",status:is.EffortStatus.DOING,wikilink:"[[ems__EffortStatusDoing]]"},{name:"Done",status:is.EffortStatus.DONE,wikilink:"[[ems__EffortStatusDone]]"},{name:"Trashed",status:is.EffortStatus.TRASHED,wikilink:"[[ems__EffortStatusTrashed]]"}];Yt.STATUS_NAME_TO_ENUM=Object.fromEntries(Yt.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.status]));Yt.STATUS_NAME_TO_WIKILINK=Object.fromEntries(Yt.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.wikilink]));Yt.EFFORT_STATUS_OPTIONS=Yt.EFFORT_STATUS_CONFIG.map(n=>({value:n.wikilink,label:n.name}));function QN(n,e=is.EffortStatus.DRAFT){if(n.startsWith("ems__")){let r=Yt.EFFORT_STATUS_CONFIG.find(i=>i.status===n);return r?r.status:e}return Yt.STATUS_NAME_TO_ENUM[n]??e}o(QN,"normalizeEffortStatus");function YN(n){return n===is.EffortStatus.DONE}o(YN,"isDoneStatus");function KN(n){return n===is.EffortStatus.TRASHED}o(KN,"isTrashedStatus");function XN(n){if(!n)return"-";let e=String(n);if(e==="")return"-";for(let r of Yt.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 Yt.EFFORT_STATUS_CONFIG)if(r.name.toLowerCase()===t)return r.name;return e}o(XN,"getEffortStatusLabel")});var wc=S(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.GroundingType=void 0;var tT;(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"})(tT||(Zd.GroundingType=tT={}))});var o0=S(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.CommandBindingStyleProperty=Hn.CommandBindingProperty=Hn.GroundingProperty=Hn.PreconditionProperty=Hn.CommandProperty=void 0;Hn.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"};Hn.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};Hn.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",TARGET_VALUE:"exocmd__Grounding_targetValue",STEPS:"exocmd__Grounding_steps"};Hn.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};Hn.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 c0=S(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.STYLE_SOURCE_VALUES=wn.LABEL_CLASS_VALUES=wn.COMMAND_VARIANT_VALUES=void 0;wn.isCommandVariant=JN;wn.isLabelClass=ZN;wn.isStyleSource=eL;wn.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);wn.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);wn.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function JN(n){return typeof n=="string"&&wn.COMMAND_VARIANT_VALUES.includes(n)}o(JN,"isCommandVariant");function ZN(n){return typeof n=="string"&&wn.LABEL_CLASS_VALUES.includes(n)}o(ZN,"isLabelClass");function eL(n){return typeof n=="string"&&wn.STYLE_SOURCE_VALUES.includes(n)}o(eL,"isStyleSource")});var rT=S(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.isCommandFrontmatter=tL;Ec.isPreconditionFrontmatter=rL;Ec.isGroundingFrontmatter=nL;Ec.isCommandBindingFrontmatter=iL;function tL(n){return eh(n,"exocmd__Command")}o(tL,"isCommandFrontmatter");function rL(n){return eh(n,"exocmd__Precondition")}o(rL,"isPreconditionFrontmatter");function nL(n){return eh(n,"exocmd__Grounding")}o(nL,"isGroundingFrontmatter");function iL(n){return eh(n,"exocmd__CommandBinding")}o(iL,"isCommandBindingFrontmatter");function eh(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(eh,"hasInstanceClass")});var nT=S(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.hasPosition=sL;th.isFixed=aL;function sL(n){return typeof n.x=="number"&&typeof n.y=="number"}o(sL,"hasPosition");function aL(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(aL,"isFixed")});var iT=S(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.createEmptyGraphData=oL;rh.mergeGraphData=cL;function oL(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(oL,"createEmptyGraphData");function cL(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(cL,"mergeGraphData")});var l0=S(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.createEdgeId=lL;nh.edgesEqual=uL;function lL(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(lL,"createEdgeId");function uL(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(uL,"edgesEqual")});var u0=S(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.BUILT_IN_EDGE_STYLES=Ut.BUILT_IN_NODE_STYLES=Ut.DEFAULT_EDGE_STYLE=Ut.DEFAULT_NODE_STYLE=Ut.RDF_TYPE_PREDICATES=void 0;Ut.mergeNodeStyles=fL;Ut.mergeEdgeStyles=dL;Ut.extractLocalName=hL;Ut.isClassType=pL;Ut.isTypePredicate=mL;Ut.isSubClassPredicate=gL;Ut.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"};Ut.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Ut.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Ut.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"}};Ut.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 fL(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(fL,"mergeNodeStyles");function dL(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(dL,"mergeEdgeStyles");function hL(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(hL,"extractLocalName");function pL(n){return n===Ut.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Ut.RDF_TYPE_PREDICATES.OWL_CLASS}o(pL,"isClassType");function mL(n){return n===Ut.RDF_TYPE_PREDICATES.RDF_TYPE}o(mL,"isTypePredicate");function gL(n){return n===Ut.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(gL,"isSubClassPredicate")});var aT=S(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0})});var Ae=S(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.IRI=void 0;var f0=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)}}};ih.IRI=f0});var Ne=S(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.Literal=void 0;_o.parseLanguageTag=oT;_o.createDirectionalLiteral=_L;_o.createLiteralFromLanguageTag=SL;var yL="http://www.w3.org/2001/XMLSchema#string",Pu=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===yL?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}};_o.Literal=Pu;function oT(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(oT,"parseLanguageTag");function _L(n,e,t){return new Pu(n,void 0,e,t)}o(_L,"createDirectionalLiteral");function SL(n,e){let{language:t,direction:r}=oT(e);return new Pu(n,void 0,t,r)}o(SL,"createLiteralFromLanguageTag")});var qt=S(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.BlankNode=void 0;var sh=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())}};ah.BlankNode=sh;sh.counter=0});var yr=S(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.Namespace=void 0;var cT=Ae(),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 cT.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new cT.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)}};oh.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 Qn=S(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.Triple=void 0;var d0=Ae(),h0=Ne(),p0=qt(),m0=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 d0.IRI&&t instanceof d0.IRI||e instanceof p0.BlankNode&&t instanceof p0.BlankNode||e instanceof h0.Literal&&t instanceof h0.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 d0.IRI?`<${e.value}>`:e instanceof p0.BlankNode||e instanceof h0.Literal||this.isQuotedTriple(e)?e.toString():""}};ch.Triple=m0});var Ou=S(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.QuotedTriple=void 0;var g0=Ae(),y0=Ne(),_0=qt(),S0=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 g0.IRI&&t instanceof g0.IRI||e instanceof _0.BlankNode&&t instanceof _0.BlankNode||e instanceof y0.Literal&&t instanceof y0.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 g0.IRI?`<${e.value}>`:e instanceof _0.BlankNode||e instanceof y0.Literal||e instanceof n?e.toString():""}};lh.QuotedTriple=S0});var lT=S(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.QuotedTriple=er.Triple=er.Namespace=er.BlankNode=er.createLiteralFromLanguageTag=er.createDirectionalLiteral=er.parseLanguageTag=er.Literal=er.IRI=void 0;var vL=Ae();Object.defineProperty(er,"IRI",{enumerable:!0,get:o(function(){return vL.IRI},"get")});var uh=Ne();Object.defineProperty(er,"Literal",{enumerable:!0,get:o(function(){return uh.Literal},"get")});Object.defineProperty(er,"parseLanguageTag",{enumerable:!0,get:o(function(){return uh.parseLanguageTag},"get")});Object.defineProperty(er,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return uh.createDirectionalLiteral},"get")});Object.defineProperty(er,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return uh.createLiteralFromLanguageTag},"get")});var bL=qt();Object.defineProperty(er,"BlankNode",{enumerable:!0,get:o(function(){return bL.BlankNode},"get")});var wL=yr();Object.defineProperty(er,"Namespace",{enumerable:!0,get:o(function(){return wL.Namespace},"get")});var EL=Qn();Object.defineProperty(er,"Triple",{enumerable:!0,get:o(function(){return EL.Triple},"get")});var TL=Ou();Object.defineProperty(er,"QuotedTriple",{enumerable:!0,get:o(function(){return TL.QuotedTriple},"get")})});var fh=S(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.UUID_URL_NAMESPACE=Kn.DEFAULT_LANGUAGE_TAG=Kn.REQUIRED_PROPERTIES=Kn.ALLOWED_PROPERTIES=Kn.Exo003MetadataType=void 0;var Yn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(Yn||(Kn.Exo003MetadataType=Yn={}));Kn.ALLOWED_PROPERTIES={[Yn.Namespace]:["metadata","uri","aliases"],[Yn.Anchor]:["metadata","uri","aliases"],[Yn.BlankNode]:["metadata","uri","aliases"],[Yn.Statement]:["metadata","subject","predicate","object","aliases"],[Yn.Body]:["metadata","subject","predicate","aliases"]};Kn.REQUIRED_PROPERTIES={[Yn.Namespace]:["metadata","uri"],[Yn.Anchor]:["metadata","uri"],[Yn.BlankNode]:["metadata","uri"],[Yn.Statement]:["metadata","subject","predicate","object"],[Yn.Body]:["metadata","subject","predicate"]};Kn.DEFAULT_LANGUAGE_TAG="ru";Kn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var uT=S(v0=>{"use strict";Object.defineProperty(v0,"__esModule",{value:!0});v0.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var fT=S(b0=>{"use strict";Object.defineProperty(b0,"__esModule",{value:!0});b0.default="00000000-0000-0000-0000-000000000000"});var dT=S(w0=>{"use strict";Object.defineProperty(w0,"__esModule",{value:!0});w0.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 Fu=S(E0=>{"use strict";Object.defineProperty(E0,"__esModule",{value:!0});var AL=dT();function xL(n){return typeof n=="string"&&AL.default.test(n)}o(xL,"validate");E0.default=xL});var Du=S(T0=>{"use strict";Object.defineProperty(T0,"__esModule",{value:!0});var CL=Fu();function IL(n){if(!(0,CL.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(IL,"parse");T0.default=IL});var Vs=S(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.unsafeStringify=void 0;var RL=Fu(),Fr=[];for(let n=0;n<256;++n)Fr.push((n+256).toString(16).slice(1));function hT(n,e=0){return(Fr[n[e+0]]+Fr[n[e+1]]+Fr[n[e+2]]+Fr[n[e+3]]+"-"+Fr[n[e+4]]+Fr[n[e+5]]+"-"+Fr[n[e+6]]+Fr[n[e+7]]+"-"+Fr[n[e+8]]+Fr[n[e+9]]+"-"+Fr[n[e+10]]+Fr[n[e+11]]+Fr[n[e+12]]+Fr[n[e+13]]+Fr[n[e+14]]+Fr[n[e+15]]).toLowerCase()}o(hT,"unsafeStringify");Nu.unsafeStringify=hT;function PL(n,e=0){let t=hT(n,e);if(!(0,RL.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(PL,"stringify");Nu.default=PL});var ph=S(A0=>{"use strict";Object.defineProperty(A0,"__esModule",{value:!0});var OL=require("crypto"),hh=new Uint8Array(256),dh=hh.length;function FL(){return dh>hh.length-16&&((0,OL.randomFillSync)(hh),dh=0),hh.slice(dh,dh+=16)}o(FL,"rng");A0.default=FL});var x0=S(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.updateV1State=void 0;var pT=ph(),DL=Vs(),Lu={};function NL(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=mT(n.random??n.rng?.()??(0,pT.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,pT.default)();gT(Lu,s,a),r=mT(a,Lu.msecs,Lu.nsecs,i?void 0:Lu.clockseq,i?void 0:Lu.node,e,t)}return e??(0,DL.unsafeStringify)(r)}o(NL,"v1");function gT(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(gT,"updateV1State");ku.updateV1State=gT;function mT(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(mT,"v1Bytes");ku.default=NL});var I0=S(C0=>{"use strict";Object.defineProperty(C0,"__esModule",{value:!0});var LL=Du(),kL=Vs();function ML(n){let e=typeof n=="string"?(0,LL.default)(n):n,t=jL(e);return typeof n=="string"?(0,kL.unsafeStringify)(t):t}o(ML,"v1ToV6");C0.default=ML;function jL(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(jL,"_v1ToV6")});var yT=S(R0=>{"use strict";Object.defineProperty(R0,"__esModule",{value:!0});var $L=require("crypto");function VL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,$L.createHash)("md5").update(n).digest()}o(VL,"md5");R0.default=VL});var Mu=S(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.URL=Bs.DNS=Bs.stringToBytes=void 0;var _T=Du(),BL=Vs();function ST(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(ST,"stringToBytes");Bs.stringToBytes=ST;Bs.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Bs.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function UL(n,e,t,r,i,s){let a=typeof t=="string"?ST(t):t,c=typeof r=="string"?(0,_T.default)(r):r;if(typeof r=="string"&&(r=(0,_T.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,BL.unsafeStringify)(l)}o(UL,"v35");Bs.default=UL});var bT=S(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.URL=So.DNS=void 0;var qL=yT(),P0=Mu(),vT=Mu();Object.defineProperty(So,"DNS",{enumerable:!0,get:o(function(){return vT.DNS},"get")});Object.defineProperty(So,"URL",{enumerable:!0,get:o(function(){return vT.URL},"get")});function O0(n,e,t,r){return(0,P0.default)(48,qL.default,n,e,t,r)}o(O0,"v3");O0.DNS=P0.DNS;O0.URL=P0.URL;So.default=O0});var wT=S(F0=>{"use strict";Object.defineProperty(F0,"__esModule",{value:!0});var WL=require("crypto");F0.default={randomUUID:WL.randomUUID}});var TT=S(D0=>{"use strict";Object.defineProperty(D0,"__esModule",{value:!0});var ET=wT(),GL=ph(),zL=Vs();function HL(n,e,t){if(ET.default.randomUUID&&!e&&!n)return ET.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,GL.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,zL.unsafeStringify)(r)}o(HL,"v4");D0.default=HL});var AT=S(N0=>{"use strict";Object.defineProperty(N0,"__esModule",{value:!0});var QL=require("crypto");function YL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,QL.createHash)("sha1").update(n).digest()}o(YL,"sha1");N0.default=YL});var CT=S(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.URL=vo.DNS=void 0;var KL=AT(),L0=Mu(),xT=Mu();Object.defineProperty(vo,"DNS",{enumerable:!0,get:o(function(){return xT.DNS},"get")});Object.defineProperty(vo,"URL",{enumerable:!0,get:o(function(){return xT.URL},"get")});function k0(n,e,t,r){return(0,L0.default)(80,KL.default,n,e,t,r)}o(k0,"v5");k0.DNS=L0.DNS;k0.URL=L0.URL;vo.default=k0});var IT=S(M0=>{"use strict";Object.defineProperty(M0,"__esModule",{value:!0});var XL=Vs(),JL=x0(),ZL=I0();function ek(n,e,t){n??={},t??=0;let r=(0,JL.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,ZL.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,XL.unsafeStringify)(r)}o(ek,"v6");M0.default=ek});var RT=S(j0=>{"use strict";Object.defineProperty(j0,"__esModule",{value:!0});var tk=Du(),rk=Vs();function nk(n){let e=typeof n=="string"?(0,tk.default)(n):n,t=ik(e);return typeof n=="string"?(0,rk.unsafeStringify)(t):t}o(nk,"v6ToV1");j0.default=nk;function ik(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(ik,"_v6ToV1")});var DT=S(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.updateV7State=void 0;var PT=ph(),sk=Vs(),$0={};function ak(n,e,t){let r;if(n)r=OT(n.random??n.rng?.()??(0,PT.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,PT.default)();FT($0,i,s),r=OT(s,$0.msecs,$0.seq,e,t)}return e??(0,sk.unsafeStringify)(r)}o(ak,"v7");function FT(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(FT,"updateV7State");ju.updateV7State=FT;function OT(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(OT,"v7Bytes");ju.default=ak});var NT=S(V0=>{"use strict";Object.defineProperty(V0,"__esModule",{value:!0});var ok=Fu();function ck(n){if(!(0,ok.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(ck,"version");V0.default=ck});var En=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 lk=uT();Object.defineProperty(ot,"MAX",{enumerable:!0,get:o(function(){return lk.default},"get")});var uk=fT();Object.defineProperty(ot,"NIL",{enumerable:!0,get:o(function(){return uk.default},"get")});var fk=Du();Object.defineProperty(ot,"parse",{enumerable:!0,get:o(function(){return fk.default},"get")});var dk=Vs();Object.defineProperty(ot,"stringify",{enumerable:!0,get:o(function(){return dk.default},"get")});var hk=x0();Object.defineProperty(ot,"v1",{enumerable:!0,get:o(function(){return hk.default},"get")});var pk=I0();Object.defineProperty(ot,"v1ToV6",{enumerable:!0,get:o(function(){return pk.default},"get")});var mk=bT();Object.defineProperty(ot,"v3",{enumerable:!0,get:o(function(){return mk.default},"get")});var gk=TT();Object.defineProperty(ot,"v4",{enumerable:!0,get:o(function(){return gk.default},"get")});var yk=CT();Object.defineProperty(ot,"v5",{enumerable:!0,get:o(function(){return yk.default},"get")});var _k=IT();Object.defineProperty(ot,"v6",{enumerable:!0,get:o(function(){return _k.default},"get")});var Sk=RT();Object.defineProperty(ot,"v6ToV1",{enumerable:!0,get:o(function(){return Sk.default},"get")});var vk=DT();Object.defineProperty(ot,"v7",{enumerable:!0,get:o(function(){return vk.default},"get")});var bk=Fu();Object.defineProperty(ot,"validate",{enumerable:!0,get:o(function(){return bk.default},"get")});var wk=NT();Object.defineProperty(ot,"version",{enumerable:!0,get:o(function(){return wk.default},"get")})});var q0=S(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.Exo003UUIDGenerator=void 0;var B0=En(),LT=fh(),U0=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,B0.v5)(e,LT.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,B0.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,B0.v5)(e,LT.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)}};mh.Exo003UUIDGenerator=U0});var MT=S(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.Exo003Parser=void 0;var mt=fh(),$u=q0(),wa=Ae(),gh=Ne(),kT=qt(),Ek=Qn(),W0=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 wa.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 wa.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 wa.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 wa.IRI(i.value);else if(i.type==="blank")s=new kT.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 wa.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new wa.IRI(l.value);else if(l.type==="blank")u=new kT.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new gh.Literal(f,new wa.IRI(l.datatype));else{let d=l.language||mt.DEFAULT_LANGUAGE_TAG;u=(0,gh.createDirectionalLiteral)(f,d,l.direction)}}return new Ek.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new gh.Literal(t,new wa.IRI(r.datatype));let i=r?.language||mt.DEFAULT_LANGUAGE_TAG;return(0,gh.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 $u.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Anchor:return $u.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.BlankNode:return $u.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Statement:{let r=e;return $u.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case mt.Exo003MetadataType.Body:{let r=e;return $u.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};yh.Exo003Parser=W0});var G0=S(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.Exo003Parser=qr.Exo003UUIDGenerator=qr.UUID_URL_NAMESPACE=qr.DEFAULT_LANGUAGE_TAG=qr.REQUIRED_PROPERTIES=qr.ALLOWED_PROPERTIES=qr.Exo003MetadataType=void 0;var Vu=fh();Object.defineProperty(qr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Vu.Exo003MetadataType},"get")});Object.defineProperty(qr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Vu.ALLOWED_PROPERTIES},"get")});Object.defineProperty(qr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Vu.REQUIRED_PROPERTIES},"get")});Object.defineProperty(qr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Vu.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(qr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Vu.UUID_URL_NAMESPACE},"get")});var Tk=q0();Object.defineProperty(qr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return Tk.Exo003UUIDGenerator},"get")});var Ak=MT();Object.defineProperty(qr,"Exo003Parser",{enumerable:!0,get:o(function(){return Ak.Exo003Parser},"get")})});var Us=S(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.WikiLinkHelpers=void 0;var Bu=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)}};_h.WikiLinkHelpers=Bu;Bu.WIKI_LINK_PATTERN=/\[\[|\]\]/g;Bu.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var kn=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 xk=Ru();Object.defineProperty(et,"AssetClass",{enumerable:!0,get:o(function(){return xk.AssetClass},"get")});var Ck=bc();Object.defineProperty(et,"EffortStatus",{enumerable:!0,get:o(function(){return Ck.EffortStatus},"get")});var Ea=a0();Object.defineProperty(et,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return Ea.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(et,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return Ea.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(et,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return Ea.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(et,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return Ea.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(et,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return Ea.normalizeEffortStatus},"get")});Object.defineProperty(et,"isDoneStatus",{enumerable:!0,get:o(function(){return Ea.isDoneStatus},"get")});Object.defineProperty(et,"isTrashedStatus",{enumerable:!0,get:o(function(){return Ea.isTrashedStatus},"get")});Object.defineProperty(et,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return Ea.getEffortStatusLabel},"get")});var Ik=wc();Object.defineProperty(et,"GroundingType",{enumerable:!0,get:o(function(){return Ik.GroundingType},"get")});var Sh=o0();Object.defineProperty(et,"CommandProperty",{enumerable:!0,get:o(function(){return Sh.CommandProperty},"get")});Object.defineProperty(et,"PreconditionProperty",{enumerable:!0,get:o(function(){return Sh.PreconditionProperty},"get")});Object.defineProperty(et,"GroundingProperty",{enumerable:!0,get:o(function(){return Sh.GroundingProperty},"get")});Object.defineProperty(et,"CommandBindingProperty",{enumerable:!0,get:o(function(){return Sh.CommandBindingProperty},"get")})});var Eo=S(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.hasClass=wo;Wr.isAreaOrProject=Rk;Wr.isEffort=Pk;Wr.hasStatus=Ok;Wr.isAssetArchived=Fk;Wr.hasEmptyProperties=Dk;Wr.needsFolderRepair=Nk;Wr.getTodayDateString=z0;Wr.isPlannedForToday=Lk;Wr.hasPlannedStartTimestamp=kk;Wr.extractDailyNoteDate=Mk;Wr.isCurrentDateGteDay=jk;Wr.inheritsFromPrototype=VT;Wr.isPrototypeClass=Vk;var $T=Us(),bo=kn();function wo(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>$T.WikiLinkHelpers.normalize(r)===e):!1}o(wo,"hasClass");function Rk(n){return wo(n,bo.AssetClass.AREA)||wo(n,bo.AssetClass.PROJECT)}o(Rk,"isAreaOrProject");function Pk(n){return wo(n,bo.AssetClass.TASK)||wo(n,bo.AssetClass.PROJECT)||wo(n,bo.AssetClass.MEETING)}o(Pk,"isEffort");function Ok(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?$T.WikiLinkHelpers.normalize(t)===e:!1}o(Ok,"hasStatus");function Fk(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(Fk,"isAssetArchived");function Dk(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(Dk,"hasEmptyProperties");function Nk(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(Nk,"needsFolderRepair");function z0(){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(z0,"getTodayDateString");function Lk(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=z0();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(Lk,"isPlannedForToday");function kk(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(kk,"hasPlannedStartTimestamp");function Mk(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(Mk,"extractDailyNoteDate");function jk(n){return z0()>=n}o(jk,"isCurrentDateGteDay");function jT(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(jT,"normalizeWithQuotes");var $k=10;function VT(n,e=$k){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=jT(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===bo.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=jT(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(VT,"inheritsFromPrototype");function Vk(n,e){return wo(n,bo.AssetClass.CLASS)?VT(e):!1}o(Vk,"isPrototypeClass")});var BT=S(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.canCreateTask=Bk;Ac.canCreateRelatedTask=Uk;Ac.canConvertTaskToProject=qk;Ac.canSetCriticalityZone=Wk;var Tc=Eo(),H0=kn();function Bk(n){return(0,Tc.isAreaOrProject)(n.instanceClass)}o(Bk,"canCreateTask");function Uk(n){return!(!(0,Tc.hasClass)(n.instanceClass,H0.AssetClass.TASK)||(0,Tc.isAssetArchived)(n.isArchived))}o(Uk,"canCreateRelatedTask");function qk(n){return(0,Tc.hasClass)(n.instanceClass,H0.AssetClass.TASK)}o(qk,"canConvertTaskToProject");function Wk(n){return!(!(0,Tc.hasClass)(n.instanceClass,H0.AssetClass.TASK)||(0,Tc.isAssetArchived)(n.isArchived))}o(Wk,"canSetCriticalityZone")});var UT=S(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.canCreateProject=Gk;xc.canMoveToAnalysis=zk;xc.canMoveToToDo=Hk;xc.canConvertProjectToTask=Qk;var Ta=Eo(),Aa=kn();function Gk(n){return(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.AREA)||(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.INITIATIVE)||(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.PROJECT)}o(Gk,"canCreateProject");function zk(n){return(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.PROJECT)?(0,Ta.hasStatus)(n.currentStatus,Aa.EffortStatus.BACKLOG):!1}o(zk,"canMoveToAnalysis");function Hk(n){return(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.PROJECT)?(0,Ta.hasStatus)(n.currentStatus,Aa.EffortStatus.ANALYSIS):!1}o(Hk,"canMoveToToDo");function Qk(n){return(0,Ta.hasClass)(n.instanceClass,Aa.AssetClass.PROJECT)}o(Qk,"canConvertProjectToTask")});var GT=S(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.canCreateChildArea=Yk;vh.canSetActiveFocus=Kk;var qT=Eo(),WT=kn();function Yk(n){return(0,qT.hasClass)(n.instanceClass,WT.AssetClass.AREA)}o(Yk,"canCreateChildArea");function Kk(n){return(0,qT.hasClass)(n.instanceClass,WT.AssetClass.AREA)}o(Kk,"canSetActiveFocus")});var HT=S(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.canPlanOnToday=Xk;ln.canPlanForEvening=Jk;ln.canShiftDayBackward=Zk;ln.canShiftDayForward=eM;ln.canSetDraftStatus=tM;ln.canMoveToBacklog=rM;ln.canStartEffort=nM;ln.canMarkDone=iM;ln.canTrashEffort=sM;ln.canVoteOnEffort=aM;ln.canRollbackStatus=oM;ln.canArchiveTask=cM;ln.canMarkReviewed=lM;var zT=Us(),dt=Eo(),cn=kn();function Xk(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isPlannedForToday)(n.metadata))}o(Xk,"canPlanOnToday");function Jk(n){return!(0,dt.hasClass)(n.instanceClass,cn.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,cn.AssetClass.MEETING)?!1:(0,dt.hasStatus)(n.currentStatus,cn.EffortStatus.BACKLOG)}o(Jk,"canPlanForEvening");function Zk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(Zk,"canShiftDayBackward");function eM(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(eM,"canShiftDayForward");function tM(n){return(0,dt.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(tM,"canSetDraftStatus");function rM(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,cn.EffortStatus.DRAFT):!1}o(rM,"canMoveToBacklog");function nM(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasClass)(n.instanceClass,cn.AssetClass.TASK)||(0,dt.hasClass)(n.instanceClass,cn.AssetClass.MEETING)?(0,dt.hasStatus)(n.currentStatus,cn.EffortStatus.BACKLOG):(0,dt.hasClass)(n.instanceClass,cn.AssetClass.PROJECT)?(0,dt.hasStatus)(n.currentStatus,cn.EffortStatus.TODO):!1:!1}o(nM,"canStartEffort");function iM(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,cn.EffortStatus.DOING):!1}o(iM,"canMarkDone");function sM(n){return(0,dt.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=zT.WikiLinkHelpers.normalize(r);return i===cn.EffortStatus.TRASHED||i===cn.EffortStatus.DONE}):!0:!1}o(sM,"canTrashEffort");function aM(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isAssetArchived)(n.isArchived))}o(aM,"canVoteOnEffort");function oM(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||zT.WikiLinkHelpers.normalize(e)===cn.EffortStatus.TRASHED)}o(oM,"canRollbackStatus");function cM(n){return!(0,dt.isAssetArchived)(n.isArchived)}o(cM,"canArchiveTask");function lM(n){return!(!(0,dt.hasClass)(n.instanceClass,cn.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,cn.AssetClass.PROJECT)||(0,dt.isAssetArchived)(n.isArchived))}o(lM,"canMarkReviewed")});var QT=S(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.canCreateEvent=dM;Xn.canCreateInstance=hM;Xn.canCleanProperties=pM;Xn.canRepairFolder=mM;Xn.canRenameToUid=gM;Xn.canCopyLabelToAliases=yM;Xn.canCreateNarrowerConcept=_M;Xn.canCreateSubclass=SM;Xn.canCreateTaskForDailyNote=vM;Xn.canCopyFleetingNoteLabel=bM;var Gr=Eo(),qs=kn(),uM="75302770-279e-4a59-ba85-09df29725713",fM="fca0a931-a01f-48e4-b72a-4af206c94bc7";function dM(n){return(0,Gr.isAreaOrProject)(n.instanceClass)}o(dM,"canCreateEvent");function hM(n){return(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.TASK_PROTOTYPE)||(0,Gr.hasClass)(n.instanceClass,uM)||(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.MEETING_PROTOTYPE)||(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.EVENT_PROTOTYPE)||(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.PROJECT_PROTOTYPE)||(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,Gr.isPrototypeClass)(n.instanceClass,n.metadata)}o(hM,"canCreateInstance");function pM(n){return(0,Gr.hasEmptyProperties)(n.metadata)}o(pM,"canCleanProperties");function mM(n){return(0,Gr.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(mM,"canRepairFolder");function gM(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(gM,"canRenameToUid");function yM(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(yM,"canCopyLabelToAliases");function _M(n){return(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.CONCEPT)}o(_M,"canCreateNarrowerConcept");function SM(n){return(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.CLASS)}o(SM,"canCreateSubclass");function vM(n){return!(!(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.DAILY_NOTE)||n.isArchived||!(0,Gr.extractDailyNoteDate)(n.metadata))}o(vM,"canCreateTaskForDailyNote");function bM(n){return(0,Gr.hasClass)(n.instanceClass,qs.AssetClass.FLEETING_NOTE)||(0,Gr.hasClass)(n.instanceClass,fM)}o(bM,"canCopyFleetingNoteLabel")});var KT=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 Tn=Eo();Object.defineProperty(L,"hasClass",{enumerable:!0,get:o(function(){return Tn.hasClass},"get")});Object.defineProperty(L,"isAreaOrProject",{enumerable:!0,get:o(function(){return Tn.isAreaOrProject},"get")});Object.defineProperty(L,"isEffort",{enumerable:!0,get:o(function(){return Tn.isEffort},"get")});Object.defineProperty(L,"hasStatus",{enumerable:!0,get:o(function(){return Tn.hasStatus},"get")});Object.defineProperty(L,"isAssetArchived",{enumerable:!0,get:o(function(){return Tn.isAssetArchived},"get")});Object.defineProperty(L,"hasEmptyProperties",{enumerable:!0,get:o(function(){return Tn.hasEmptyProperties},"get")});Object.defineProperty(L,"needsFolderRepair",{enumerable:!0,get:o(function(){return Tn.needsFolderRepair},"get")});Object.defineProperty(L,"getTodayDateString",{enumerable:!0,get:o(function(){return Tn.getTodayDateString},"get")});Object.defineProperty(L,"isPlannedForToday",{enumerable:!0,get:o(function(){return Tn.isPlannedForToday},"get")});Object.defineProperty(L,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return Tn.hasPlannedStartTimestamp},"get")});Object.defineProperty(L,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return Tn.extractDailyNoteDate},"get")});Object.defineProperty(L,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return Tn.isCurrentDateGteDay},"get")});Object.defineProperty(L,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return Tn.inheritsFromPrototype},"get")});Object.defineProperty(L,"isPrototypeClass",{enumerable:!0,get:o(function(){return Tn.isPrototypeClass},"get")});var bh=BT();Object.defineProperty(L,"canCreateTask",{enumerable:!0,get:o(function(){return bh.canCreateTask},"get")});Object.defineProperty(L,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return bh.canCreateRelatedTask},"get")});Object.defineProperty(L,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return bh.canConvertTaskToProject},"get")});Object.defineProperty(L,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return bh.canSetCriticalityZone},"get")});var wh=UT();Object.defineProperty(L,"canCreateProject",{enumerable:!0,get:o(function(){return wh.canCreateProject},"get")});Object.defineProperty(L,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return wh.canMoveToAnalysis},"get")});Object.defineProperty(L,"canMoveToToDo",{enumerable:!0,get:o(function(){return wh.canMoveToToDo},"get")});Object.defineProperty(L,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return wh.canConvertProjectToTask},"get")});var YT=GT();Object.defineProperty(L,"canCreateChildArea",{enumerable:!0,get:o(function(){return YT.canCreateChildArea},"get")});Object.defineProperty(L,"canSetActiveFocus",{enumerable:!0,get:o(function(){return YT.canSetActiveFocus},"get")});var Mn=HT();Object.defineProperty(L,"canPlanOnToday",{enumerable:!0,get:o(function(){return Mn.canPlanOnToday},"get")});Object.defineProperty(L,"canPlanForEvening",{enumerable:!0,get:o(function(){return Mn.canPlanForEvening},"get")});Object.defineProperty(L,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Mn.canShiftDayBackward},"get")});Object.defineProperty(L,"canShiftDayForward",{enumerable:!0,get:o(function(){return Mn.canShiftDayForward},"get")});Object.defineProperty(L,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Mn.canSetDraftStatus},"get")});Object.defineProperty(L,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Mn.canMoveToBacklog},"get")});Object.defineProperty(L,"canStartEffort",{enumerable:!0,get:o(function(){return Mn.canStartEffort},"get")});Object.defineProperty(L,"canMarkDone",{enumerable:!0,get:o(function(){return Mn.canMarkDone},"get")});Object.defineProperty(L,"canTrashEffort",{enumerable:!0,get:o(function(){return Mn.canTrashEffort},"get")});Object.defineProperty(L,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Mn.canVoteOnEffort},"get")});Object.defineProperty(L,"canRollbackStatus",{enumerable:!0,get:o(function(){return Mn.canRollbackStatus},"get")});Object.defineProperty(L,"canArchiveTask",{enumerable:!0,get:o(function(){return Mn.canArchiveTask},"get")});Object.defineProperty(L,"canMarkReviewed",{enumerable:!0,get:o(function(){return Mn.canMarkReviewed},"get")});var ss=QT();Object.defineProperty(L,"canCreateEvent",{enumerable:!0,get:o(function(){return ss.canCreateEvent},"get")});Object.defineProperty(L,"canCreateInstance",{enumerable:!0,get:o(function(){return ss.canCreateInstance},"get")});Object.defineProperty(L,"canCleanProperties",{enumerable:!0,get:o(function(){return ss.canCleanProperties},"get")});Object.defineProperty(L,"canRepairFolder",{enumerable:!0,get:o(function(){return ss.canRepairFolder},"get")});Object.defineProperty(L,"canRenameToUid",{enumerable:!0,get:o(function(){return ss.canRenameToUid},"get")});Object.defineProperty(L,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return ss.canCopyLabelToAliases},"get")});Object.defineProperty(L,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return ss.canCreateNarrowerConcept},"get")});Object.defineProperty(L,"canCreateSubclass",{enumerable:!0,get:o(function(){return ss.canCreateSubclass},"get")});Object.defineProperty(L,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return ss.canCreateTaskForDailyNote},"get")});Object.defineProperty(L,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return ss.canCopyFleetingNoteLabel},"get")})});var XT=S(To=>{"use strict";var wM=To&&To.__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]})),EM=To&&To.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&wM(e,n,t)};Object.defineProperty(To,"__esModule",{value:!0});EM(KT(),To)});var Eh=S(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.PropertyFieldType=void 0;Uu.rangeToFieldType=xM;var Dr;(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"})(Dr||(Uu.PropertyFieldType=Dr={}));var JT="http://www.w3.org/2001/XMLSchema#",TM="https://exocortex.my/ontology/exo#",AM="https://exocortex.my/ontology/ems#";function xM(n){if(!n)return Dr.Unknown;let e=n.trim();if(!e)return Dr.Unknown;if(e.startsWith(JT)){let t=e.substring(JT.length);return Q0(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return Q0(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return Q0(r)}return e.startsWith(AM)||e.startsWith("ems:")?CM(e):e.startsWith(TM)||e.startsWith("exo:")||IM(e)?Dr.Reference:Dr.Text}o(xM,"rangeToFieldType");function Q0(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Dr.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 Dr.Number;case"date":return Dr.Date;case"datetime":case"datetimestamp":return Dr.DateTime;case"boolean":return Dr.Boolean;case"time":return Dr.Timestamp;default:return Dr.Text}}o(Q0,"xsdTypeToFieldType");function CM(n){let e=n.toLowerCase();return e.includes("effortstatus")?Dr.StatusSelect:e.includes("tasksize")?Dr.SizeSelect:Dr.Reference}o(CM,"emsTypeToFieldType");function IM(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(IM,"isClassReference")});var Y0=S(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.propertyNameToUri=RM;qu.uriToPropertyName=ZT;qu.extractPropertyLabel=PM;function RM(n){return n.replace(/^([a-z]+)__/,"$1:")}o(RM,"propertyNameToUri");function ZT(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(ZT,"uriToPropertyName");function PM(n){let r=(n.includes(":")?ZT(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(PM,"extractPropertyLabel")});var Th={};Uy(Th,{__assign:()=>X0,__asyncDelegator:()=>qM,__asyncGenerator:()=>UM,__asyncValues:()=>WM,__await:()=>Wu,__awaiter:()=>kM,__classPrivateFieldGet:()=>QM,__classPrivateFieldSet:()=>YM,__createBinding:()=>jM,__decorate:()=>DM,__exportStar:()=>$M,__extends:()=>OM,__generator:()=>MM,__importDefault:()=>HM,__importStar:()=>zM,__makeTemplateObject:()=>GM,__metadata:()=>LM,__param:()=>NM,__read:()=>eA,__rest:()=>FM,__spread:()=>VM,__spreadArrays:()=>BM,__values:()=>J0});function OM(n,e){K0(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function FM(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 DM(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 NM(n,e){return function(t,r){e(t,r,n)}}function LM(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function kM(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 MM(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 jM(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function $M(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function J0(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 eA(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 VM(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(eA(arguments[e]));return n}function BM(){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 Wu(n){return this instanceof Wu?(this.v=n,this):new Wu(n)}function UM(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){r[h]&&(i[h]=function(p){return new Promise(function(y,v){s.push([h,p,y,v])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(y){d(s[0][3],y)}}function l(h){h.value instanceof Wu?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 qM(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:Wu(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function WM(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 J0=="function"?J0(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 GM(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function zM(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 HM(n){return n&&n.__esModule?n:{default:n}}function QM(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function YM(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 K0,X0,Ah=FN(()=>{K0=o(function(n,e){return K0=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])},K0(n,e)},"extendStatics");o(OM,"__extends");X0=o(function(){return X0=Object.assign||o(function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),X0.apply(this,arguments)},"__assign");o(FM,"__rest");o(DM,"__decorate");o(NM,"__param");o(LM,"__metadata");o(kM,"__awaiter");o(MM,"__generator");o(jM,"__createBinding");o($M,"__exportStar");o(J0,"__values");o(eA,"__read");o(VM,"__spread");o(BM,"__spreadArrays");o(Wu,"__await");o(UM,"__asyncGenerator");o(qM,"__asyncDelegator");o(WM,"__asyncValues");o(GM,"__makeTemplateObject");o(zM,"__importStar");o(HM,"__importDefault");o(QM,"__classPrivateFieldGet");o(YM,"__classPrivateFieldSet")});var t_=S(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var Z0;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(Z0||(Z0={}));e_.default=Z0});var tA=S(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var KM=t_();Object.defineProperty(r_,"Lifecycle",{enumerable:!0,get:o(function(){return KM.default},"get")})});var Ao=S(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.defineInjectionTokenMetadata=fi.getParamInfo=fi.INJECTION_TOKEN_METADATA_KEY=void 0;fi.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function XM(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(fi.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(XM,"getParamInfo");fi.getParamInfo=XM;function JM(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(fi.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(fi.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(JM,"defineInjectionTokenMetadata");fi.defineInjectionTokenMetadata=JM});var n_=S(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.isClassProvider=void 0;function ZM(n){return!!n.useClass}o(ZM,"isClassProvider");xh.isClassProvider=ZM});var i_=S(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.isFactoryProvider=void 0;function e4(n){return!!n.useFactory}o(e4,"isFactoryProvider");Ch.isFactoryProvider=e4});var Rh=S(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.delay=Cc.DelayedConstructor=void 0;var Ih=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}};Cc.DelayedConstructor=Ih;function t4(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new Ih(n)}o(t4,"delay");Cc.delay=t4});var Ph=S(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.isConstructorToken=as.isTransformDescriptor=as.isTokenDescriptor=as.isNormalToken=void 0;var r4=Rh();function n4(n){return typeof n=="string"||typeof n=="symbol"}o(n4,"isNormalToken");as.isNormalToken=n4;function i4(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(i4,"isTokenDescriptor");as.isTokenDescriptor=i4;function s4(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(s4,"isTransformDescriptor");as.isTransformDescriptor=s4;function a4(n){return typeof n=="function"||n instanceof r4.DelayedConstructor}o(a4,"isConstructorToken");as.isConstructorToken=a4});var s_=S(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.isTokenProvider=void 0;function o4(n){return!!n.useToken}o(o4,"isTokenProvider");Oh.isTokenProvider=o4});var a_=S(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.isValueProvider=void 0;function c4(n){return n.useValue!=null}o(c4,"isValueProvider");Fh.isValueProvider=c4});var o_=S(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});var l4=n_();Object.defineProperty(xo,"isClassProvider",{enumerable:!0,get:o(function(){return l4.isClassProvider},"get")});var u4=i_();Object.defineProperty(xo,"isFactoryProvider",{enumerable:!0,get:o(function(){return u4.isFactoryProvider},"get")});var f4=Ph();Object.defineProperty(xo,"isNormalToken",{enumerable:!0,get:o(function(){return f4.isNormalToken},"get")});var d4=s_();Object.defineProperty(xo,"isTokenProvider",{enumerable:!0,get:o(function(){return d4.isTokenProvider},"get")});var h4=a_();Object.defineProperty(xo,"isValueProvider",{enumerable:!0,get:o(function(){return h4.isValueProvider},"get")})});var rA=S(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.isProvider=void 0;var p4=n_(),m4=a_(),g4=s_(),y4=i_();function _4(n){return p4.isClassProvider(n)||m4.isValueProvider(n)||g4.isTokenProvider(n)||y4.isFactoryProvider(n)}o(_4,"isProvider");Dh.isProvider=_4});var u_=S(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var c_=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,[])}};l_.default=c_});var nA=S(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var S4=u_(),f_=class extends S4.default{static{o(this,"Registry")}};d_.default=f_});var iA=S(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var h_=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};p_.default=h_});var m_=S(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.formatErrorCtor=void 0;function v4(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(v4,"formatDependency");function b4(n,e,t=" "){return[n,...e.message.split(`
32
32
  `).map(r=>t+r)].join(`
33
- `)}o(b4,"composeErrorMessage");function w4(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=v4(r,e);return b4(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(w4,"formatErrorCtor");Nh.formatErrorCtor=w4});var sA=S(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.isDisposable=void 0;function E4(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(E4,"isDisposable");Lh.isDisposable=E4});var oA=S(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.PostResolutionInterceptors=xo.PreResolutionInterceptors=void 0;var aA=u_(),kh=class extends aA.default{static{o(this,"PreResolutionInterceptors")}};xo.PreResolutionInterceptors=kh;var Mh=class extends aA.default{static{o(this,"PostResolutionInterceptors")}};xo.PostResolutionInterceptors=Mh;var g_=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new kh,this.postResolution=new Mh}};xo.default=g_});var xa=S(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.instance=Ws.typeInfo=void 0;var T4=(Ah(),zd(Th)),ln=o_(),A4=rA(),jh=Ph(),x4=nA(),An=t_(),$h=iA(),C4=m_(),I4=Rh(),R4=sA(),P4=oA();Ws.typeInfo=new Map;var y_=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new x4.default,this.interceptors=new P4.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:An.default.Transient}){this.ensureNotDisposed();let i;if(A4.isProvider(t)?i=t:i={useClass:t},ln.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&&ln.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===An.default.Singleton||r.lifecycle==An.default.ContainerScoped||r.lifecycle==An.default.ResolutionScoped)&&(ln.isValueProvider(i)||ln.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${An.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),ln.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(),ln.isNormalToken(e)){if(ln.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:An.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:An.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!ln.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:An.default.Singleton})}resolve(e,t=new $h.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&ln.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(jh.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===An.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===An.default.Singleton,i=e.options.lifecycle===An.default.ContainerScoped,s=r||i,a;return ln.isValueProvider(e.provider)?a=e.provider.useValue:ln.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):ln.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):ln.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===An.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new $h.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&ln.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=>!ln.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===An.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===An.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 T4.__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 I4.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Ws.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 R4.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return jh.isTokenDescriptor(r)?jh.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new $h.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 $h.default,r.isOptional):this.resolve(r.token,e,r.isOptional):jh.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(C4.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Ws.instance=new y_;Ws.default=Ws.instance});var cA=S(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var O4=To(),Gs=xa(),__=Ph(),F4=m_();function D4(){return function(n){let e=O4.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return __.isTokenDescriptor(r)?__.isTransformDescriptor(r)?r.multiple?Gs.instance.resolve(r.transform).transform(Gs.instance.resolveAll(r.token),...r.transformArgs):Gs.instance.resolve(r.transform).transform(Gs.instance.resolve(r.token),...r.transformArgs):r.multiple?Gs.instance.resolveAll(r.token):Gs.instance.resolve(r.token):__.isTransformDescriptor(r)?Gs.instance.resolve(r.transform).transform(Gs.instance.resolve(r.token),...r.transformArgs):Gs.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(F4.formatErrorCtor(n,a,s))}})))}}}}o(D4,"autoInjectable");S_.default=D4});var lA=S(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});var N4=To();function L4(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return N4.defineInjectionTokenMetadata(t)}o(L4,"inject");v_.default=L4});var Vh=S(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});var k4=To(),M4=xa(),uA=xa();function j4(n){return function(e){M4.typeInfo.set(e,k4.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{uA.instance.register(t,e)}):uA.instance.register(n.token,e))}}o(j4,"injectable");b_.default=j4});var fA=S(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});var $4=(Ah(),zd(Th)),V4=xa();function B4(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=$4.__rest(t,["token","options"]);return V4.instance.register(r,s,i)}),e}}o(B4,"registry");w_.default=B4});var dA=S(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});var U4=Vh(),q4=xa();function W4(){return function(n){U4.default()(n),q4.instance.registerSingleton(n)}}o(W4,"singleton");E_.default=W4});var hA=S(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});var G4=To();function z4(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return G4.defineInjectionTokenMetadata(t)}o(z4,"injectAll");T_.default=z4});var pA=S(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});var H4=To();function Q4(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return H4.defineInjectionTokenMetadata(r)}o(Q4,"injectAllWithTransform");A_.default=Q4});var mA=S(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});var Y4=To();function K4(n,e,...t){return Y4.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(K4,"injectWithTransform");x_.default=K4});var gA=S(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});var X4=Vh(),J4=xa();function Z4(n,e){return function(t){X4.default()(t),J4.instance.register(e||t,t,{lifecycle:n})}}o(Z4,"scoped");C_.default=Z4});var yA=S(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});var ej=cA();Object.defineProperty(di,"autoInjectable",{enumerable:!0,get:o(function(){return ej.default},"get")});var tj=lA();Object.defineProperty(di,"inject",{enumerable:!0,get:o(function(){return tj.default},"get")});var rj=Vh();Object.defineProperty(di,"injectable",{enumerable:!0,get:o(function(){return rj.default},"get")});var nj=fA();Object.defineProperty(di,"registry",{enumerable:!0,get:o(function(){return nj.default},"get")});var ij=dA();Object.defineProperty(di,"singleton",{enumerable:!0,get:o(function(){return ij.default},"get")});var sj=hA();Object.defineProperty(di,"injectAll",{enumerable:!0,get:o(function(){return sj.default},"get")});var aj=pA();Object.defineProperty(di,"injectAllWithTransform",{enumerable:!0,get:o(function(){return aj.default},"get")});var oj=mA();Object.defineProperty(di,"injectWithTransform",{enumerable:!0,get:o(function(){return oj.default},"get")});var cj=gA();Object.defineProperty(di,"scoped",{enumerable:!0,get:o(function(){return cj.default},"get")})});var _A=S(I_=>{"use strict";Object.defineProperty(I_,"__esModule",{value:!0});function lj(n){let e;return t=>(e==null&&(e=n(t)),e)}o(lj,"instanceCachingFactory");I_.default=lj});var SA=S(R_=>{"use strict";Object.defineProperty(R_,"__esModule",{value:!0});function uj(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(uj,"instancePerContainerCachingFactory");R_.default=uj});var vA=S(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});function fj(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(fj,"predicateAwareClassFactory");P_.default=fj});var bA=S(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});var dj=_A();Object.defineProperty(Gu,"instanceCachingFactory",{enumerable:!0,get:o(function(){return dj.default},"get")});var hj=SA();Object.defineProperty(Gu,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return hj.default},"get")});var pj=vA();Object.defineProperty(Gu,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return pj.default},"get")})});var ue=S(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var O_=(Ah(),zd(Th));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 mj=tA();Object.defineProperty(Ca,"Lifecycle",{enumerable:!0,get:o(function(){return mj.Lifecycle},"get")});O_.__exportStar(yA(),Ca);O_.__exportStar(bA(),Ca);O_.__exportStar(o_(),Ca);var gj=Rh();Object.defineProperty(Ca,"delay",{enumerable:!0,get:o(function(){return gj.delay},"get")});var yj=xa();Object.defineProperty(Ca,"container",{enumerable:!0,get:o(function(){return yj.instance},"get")})});var Ic=S(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.NullLogger=void 0;Bh.NullLogger={debug(){},info(){},warn(){},error(){}}});var F_=S((cte,wA)=>{var Rc=class{static{o(this,"Wildcard")}constructor(){return _j||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(Rc.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(Rc.prototype,"termType",{enumerable:!0,value:"Wildcard"});var _j=new Rc;wA.exports.Wildcard=Rc});var TA=S((ute,EA)=>{var Sj=(function(){var n=o(function(R,C,P,N){for(P=P||{},N=R.length;N--;P[R[N]]=C);return P},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],y=[123,126],v=[1,67],E=[39,45,87],b=[13,16,45,197,224,308],A=[1,87],I=[2,281],j=[1,86],B=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],te=[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],$=[13,16,308],re=[112,132,327,334],Ye=[13,16,112,132,308],st=[1,111],Ot=[1,117],at=[112,132,327,328,334],ct=[13,16,112,132,308,328],Ke=[28,29,45,53,87],se=[1,138],U=[1,151],lt=[1,128],pt=[1,127],H=[1,129],Re=[1,140],Ue=[1,141],ne=[1,142],qe=[1,143],We=[1,144],$e=[1,145],Ge=[1,147],Ce=[1,148],Ve=[2,457],Pe=[1,158],Be=[1,159],ze=[1,160],fe=[1,152],me=[1,153],ge=[1,156],de=[1,171],he=[1,172],pe=[1,173],le=[1,174],ye=[1,175],_e=[1,176],Se=[1,167],ve=[1,168],oe=[1,169],be=[1,170],Ze=[1,157],He=[1,166],je=[1,161],w=[1,162],T=[1,163],x=[1,164],O=[1,165],Z=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],_t=[1,195],Ct=[6,31,73,81,83,85],De=[2,285],q=[1,199],W=[1,201],Q=[6,31,70,73,81,83,85],K=[2,283],Ie=[1,207],tt=[1,218],rt=[1,223],Rr=[1,219],vn=[1,225],Ln=[1,226],rn=[1,224],KE=[6,63,70,73,81,83,85],XE=[1,236],JE=[2,334],ZE=[1,243],e2=[1,241],Pr=[6,193],Td=[2,349],t2=[2,339],Sa=[28,128],r2=[47,48,193,272],Ad=[47,48,193,242,272],uc=[47,48,193,242,246,272],fc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],gr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],n2=[1,271],i2=[1,270],Jt=[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],s2=[1,281],a2=[1,280],nn=[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],yu=[45,89],xd=[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],Cd=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Id=[31,89],Rd=[48,87],ao=[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],Ji=[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],o2=[1,313],dc=[6,85],by=[6,31,81,83,85],c2=[2,361],Os=[2,353],oo=[1,343],_u=[31,112,335],Fs=[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],wy=[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],l2=[6,109,193],co=[31,112],Zt=[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],va=[13,16,87,197,308,314],u2=[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],Pd=[1,417],Od=[1,418],f2=[13,16,48,197,229,308],ba=[6,31,85],d2=[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],Ay=[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],lo=[29,31,85,112,159,160,161,163,164],Fd=[1,443],Dd=[1,444],h2=[1,449],uo=[31,112,193,232,318,335],Nd=[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],p2=[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],xy=[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],Su=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],vu=[31,45],m2=[1,507],g2=[1,508],y2=[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],Ld=[29,31,85,112,159,160,161,163,164,335],fo=[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],_2=[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],S2=[2,352],Cy=[13,16,197,308,314],v2=[1,565],hc=[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],b2=[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],Ds=[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],w2=[13,16,87,308],Ns=[2,364],pc=[29,31,85,112,159,160,161,163,164,193,232,318,335],kd=[31,112,193,232,272,318,335],Ls=[2,359],E2=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Md=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],T2=[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],A2=[2,347],Iy={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,P,N,ie,Oe,g,an){var _=g.length-1;switch(Oe){case 1:if(g[_-1]=g[_-1]||{},ke.base&&(g[_-1].base=ke.base),ke.base="",g[_-1].prefixes=ke.prefixes,ke.prefixes=null,ke.pathOnly){if(g[_-1].type==="path"||"termType"in g[_-1])return g[_-1];throw new Error("Received full SPARQL query in path only mode")}else if(g[_-1].type==="path"||"termType"in g[_-1])throw new Error("Received only path in full SPARQL mode");if(g[_-1].type==="update"){let St={};for(let jt of g[_-1].updates)if(jt.updateType==="insert"){let nt={};for(let ut of jt.insert)if(ut.type==="bgp"||ut.type==="graph")for(let bn of ut.triples)bn.subject.termType==="BlankNode"&&(nt[bn.subject.value]=!0),bn.predicate.termType==="BlankNode"&&(nt[bn.predicate.value]=!0),bn.object.termType==="BlankNode"&&(nt[bn.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[_-1];case 2:this.$={...g[_-1],...g[_],type:"query"};break;case 4:ke.base=bu(g[_]);break;case 5:ke.prefixes||(ke.prefixes={}),g[_-1]=g[_-1].substr(0,g[_-1].length-1),g[_]=bu(g[_]),ke.prefixes[g[_-1]]=g[_];break;case 6:this.$={...g[_-3],...mo(g[_-2]),...g[_-1],...g[_]};break;case 7:if(!ke.skipValidation&&(ky(g[_-3].variables.map(jt=>Ly(jt.expression))).some(jt=>jt.aggregation==="count"&&!(jt.expression instanceof jd))||g[_].group)){for(let jt of g[_-3].variables)if(jt.termType==="Variable"){if(!g[_].group||!g[_].group.map(nt=>_c(nt)).includes(_c(jt)))throw Error("Projection of ungrouped variable (?"+_c(jt)+")")}else if(Ly(jt.expression).length===0){let nt=TN(jt.expression);for(let ut of nt)if(!g[_].group||!g[_].group.map||!g[_].group.map(bn=>_c(bn)).includes(_c(ut)))throw Error("Use of ungrouped variable in projection of operation (?"+_c(ut)+")")}}let rs=g[_-1].where.filter(St=>St.type==="query");if(rs.length>0){let St=g[_-3].variables.filter(nt=>nt.variable&&nt.variable.value).map(nt=>nt.variable.value),jt=ky(rs.map(nt=>nt.variables)).map(nt=>nt.value||nt.variable.value);for(let nt of St)if(jt.indexOf(nt)>=0)throw Error("Target id of 'AS' (?"+nt+") already used in subquery")}this.$=Ht(g[_-3],mo(g[_-2]),g[_-1],g[_]);break;case 8:this.$=Ht({queryType:"CONSTRUCT",template:g[_-3]},mo(g[_-2]),g[_-1],g[_]);break;case 9:this.$=Ht({queryType:"CONSTRUCT",template:g[_-2]=g[_-2]?g[_-2].triples:[]},mo(g[_-5]),{where:[{type:"bgp",triples:po([],g[_-2])}]},g[_]);break;case 10:this.$=Ht({queryType:"DESCRIBE",variables:g[_-3]==="*"?[new jd]:g[_-3]},mo(g[_-2]),g[_-1],g[_]);break;case 11:this.$=Ht({queryType:"ASK"},mo(g[_-2]),g[_-1],g[_]);break;case 12:this.$=Ht(g[_-1],{variables:[new jd]});break;case 13:let xu=g[_].map(St=>St.value||St.variable.value),Sc=AN(xu);if(Sc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Sc[0]+")");this.$=Ht(g[_-1],{variables:g[_]});break;case 14:this.$=Ht({queryType:"SELECT"},g[_]&&(g[_-1]=sn(g[_]),g[_]={},g[_][g[_-1]]=!0,g[_]));break;case 16:case 27:this.$=mc(g[_-3],{variable:g[_-1]});break;case 17:case 18:this.$=Ht(g[_-3],g[_-2],g[_-1],g[_],{type:"query"});break;case 19:case 58:this.$={iri:g[_],named:!!g[_-1]};break;case 20:this.$={where:g[_].patterns};break;case 21:this.$=Ht(g[_-1],g[_]);break;case 22:this.$=Ht(g[_-2],g[_-1],g[_]);break;case 23:this.$={group:g[_]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=mc(g[_]);break;case 26:this.$=mc(g[_-1]);break;case 29:this.$={having:g[_]};break;case 30:this.$={order:g[_]};break;case 32:this.$=mc(g[_],{descending:!0});break;case 35:this.$={limit:yc(g[_])};break;case 36:this.$={offset:yc(g[_])};break;case 37:this.$={limit:yc(g[_-2]),offset:yc(g[_])};break;case 38:this.$={limit:yc(g[_]),offset:yc(g[_-2])};break;case 39:case 43:this.$={type:"values",values:g[_]};break;case 40:case 84:this.$=g[_-1].map(St=>({[g[_-3]]:St}));break;case 41:case 85:this.$=g[_-1].map(()=>({}));break;case 42:case 86:var ts=g[_-4].length;g[_-4]=g[_-4].map(Ry),this.$=g[_-1].map(function(St){if(St.length!==ts)throw Error("Inconsistent VALUES length");for(var jt={},nt=0;nt<ts;nt++)jt["?"+g[_-4][nt].value]=St[nt];return jt});break;case 44:case 65:case 100:case 126:case 175:this.$=g[_-1];break;case 45:this.$={type:"update",updates:ks(g[_-2],g[_-1])};break;case 46:this.$=Ht({type:"load",silent:!!g[_-2],source:g[_-1]},g[_]&&{destination:g[_]});break;case 47:this.$={type:sn(g[_-2]),silent:!!g[_-1],graph:g[_]};break;case 48:this.$={type:sn(g[_-4]),silent:!!g[_-3],source:g[_-2],destination:g[_]};break;case 49:this.$={type:"create",silent:!!g[_-2],graph:{type:"graph",name:g[_]}};break;case 50:this.$={updateType:"insert",insert:k2(g[_])};break;case 51:this.$={updateType:"delete",delete:$y(k2(g[_]))};break;case 52:this.$={updateType:"deletewhere",delete:$y(g[_])};break;case 53:this.$={updateType:"insertdelete",...g[_-4],...g[_-3],...mo(g[_-2],"using"),where:g[_].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=g[_];break;case 55:this.$={delete:$y(g[_-1]),insert:g[_]||[]};break;case 56:this.$={delete:[],insert:g[_]};break;case 59:this.$={graph:g[_]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:g[_]};break;case 64:this.$={[sn(g[_])]:!0};break;case 66:this.$=g[_-1]?Zi(g[_],[g[_-1]]):Zi(g[_]);break;case 67:var Tu=Ht(g[_-3]||{triples:[]},{type:"graph",name:g[_-5]});this.$=g[_]?[Tu,g[_]]:[Tu];break;case 68:case 73:this.$={type:"bgp",triples:Zi(g[_-2],[g[_-1]])};break;case 69:this.$={type:"group",patterns:[g[_-1]]};break;case 70:for(let St of g[_-1].filter(jt=>jt.type==="bind")){let jt=g[_-1].indexOf(St),nt=new Set;for(let ut of g[_-1].slice(0,jt))(ut.type==="group"||ut.type==="bgp")&&N2(ut).forEach(bn=>nt.add(bn));if(nt.has(St.variable.value))throw Error("Variable used to bind is already bound (?"+St.variable.value+")")}this.$={type:"group",patterns:g[_-1]};break;case 71:this.$=g[_-1]?Zi([g[_-1]],g[_]):Zi(g[_]);break;case 72:this.$=g[_]?[g[_-2],g[_]]:g[_-2];break;case 75:this.$=Ht(g[_],{type:"optional"});break;case 76:this.$=Ht(g[_],{type:"minus"});break;case 77:this.$=Ht(g[_],{type:"graph",name:g[_-1]});break;case 78:this.$=Ht(g[_],{type:"service",name:g[_-1],silent:!!g[_-2]});break;case 79:this.$={type:"filter",expression:g[_]};break;case 80:this.$={type:"bind",variable:g[_-1],expression:g[_-3]};break;case 89:this.$=Eu(g[_]);break;case 90:this.$=void 0;break;case 91:this.$=g[_-1].length?{type:"union",patterns:Zi(g[_-1].map(Oy),[Oy(g[_])])}:g[_];break;case 95:this.$={...g[_],function:g[_-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:ks(g[_-2],g[_-1]),distinct:!!g[_-3]};break;case 98:case 115:case 128:case 247:case 249:case 251:case 253:case 255:case 263:case 267:case 297:case 299:case 303:case 307:case 328:case 341:case 349:case 355:case 361:case 367:case 369:case 373:case 375:case 379:case 381:case 385:case 391:case 395:case 401:case 405:case 409:case 411:case 420:case 428:case 430:case 440:case 444:case 446:case 448:this.$=[];break;case 99:this.$=ks(g[_-2],g[_-1]);break;case 101:this.$=Zi(g[_-2],[g[_-1]]);break;case 102:case 112:this.$=jy(g[_].map(St=>Ht(Ms(g[_-1]),St)));break;case 103:this.$=jy(po(g[_].map(St=>Ht(Ms(g[_-1].entity),St)),g[_-1].triples));break;case 105:this.$=Zi([g[_-1]],g[_]);break;case 106:this.$=Zi(g[_]);break;case 107:this.$=Ny(g[_-1],g[_]);break;case 109:case 237:this.$=ke.factory.namedNode(pN);break;case 110:case 118:this.$=ks(g[_-1],g[_]);break;case 111:this.$=g[_]?{annotation:g[_],object:g[_-1]}:g[_-1];break;case 113:this.$=g[_]?jy(po(g[_].map(St=>Ht(Ms(g[_-1].entity),St)),g[_-1].triples)):g[_-1].triples;break;case 114:this.$=Ny(...g[_-1],g[_]);break;case 116:this.$=Ny(...g[_]);break;case 117:case 159:case 163:this.$=[g[_-1],g[_]];break;case 119:this.$=g[_]?{object:g[_-1],annotation:g[_]}:g[_-1];break;case 120:this.$=g[_-1].length?gc("|",ks(g[_-1],g[_])):g[_];break;case 121:this.$=g[_-1].length?gc("/",ks(g[_-1],g[_])):g[_];break;case 122:this.$=g[_]?gc(g[_],[g[_-1]]):g[_-1];break;case 123:this.$=g[_-1]?gc(g[_-1],[g[_]]):g[_];break;case 125:case 131:this.$=gc(g[_-1],[g[_]]);break;case 129:this.$=gc("|",ks(g[_-2],g[_-1]));break;case 132:case 134:this.$=wN(g[_-1]);break;case 133:case 135:this.$=EN(g[_-1]);break;case 140:this.$={entity:g[_],triples:[]};break;case 145:this.$=Ry(g[_]);break;case 149:this.$=ke.factory.namedNode(x2);break;case 151:case 153:case 158:case 162:this.$=Py(g[_-1],g[_]);break;case 152:this.$=["||",g[_]];break;case 154:this.$=["&&",g[_]];break;case 156:this.$=Or(g[_-1],[g[_-2],g[_]]);break;case 157:this.$=Or(g[_-2]?"notin":"in",[g[_-3],g[_]]);break;case 160:this.$=["+",Py(g[_-1],g[_])];break;case 161:var Bd=es(g[_-1].value.replace("-",""),g[_-1].datatype);this.$=["-",Py(Bd,g[_])];break;case 164:this.$=Or("UPLUS",[g[_]]);break;case 165:this.$=Or(g[_-1],[g[_]]);break;case 166:this.$=Or("UMINUS",[g[_]]);break;case 177:this.$=Or(sn(g[_-1]));break;case 178:this.$=Or(sn(g[_-3]),[g[_-1]]);break;case 179:this.$=Eu(Or(sn(g[_-3]),[g[_-1]]));break;case 180:this.$=Or(sn(g[_-5]),[g[_-3],g[_-1]]);break;case 181:this.$=Or(sn(g[_-7]),[g[_-5],g[_-3],g[_-1]]);break;case 182:this.$=Eu(Or(sn(g[_-7]),[g[_-5],g[_-3],g[_-1]]));break;case 183:this.$=Or(sn(g[_-1]),g[_]);break;case 184:this.$=Or("bound",[Ry(g[_-1])]);break;case 185:this.$=Or(g[_-1],[]);break;case 186:this.$=Or(g[_-3],[g[_-1]]);break;case 187:this.$=Or(g[_-2]?"notexists":"exists",[Oy(g[_])]);break;case 188:case 189:this.$=mc(g[_-1],{type:"aggregate",aggregation:sn(g[_-4]),distinct:!!g[_-2]});break;case 190:this.$=mc(g[_-2],{type:"aggregate",aggregation:sn(g[_-5]),distinct:!!g[_-3],separator:typeof g[_-1]=="string"?g[_-1]:" "});break;case 192:this.$=es(g[_]);break;case 193:this.$=_N(g[_-1],sn(g[_].substr(1)));break;case 194:this.$=es(g[_-2],g[_]);break;case 195:case 204:this.$=es(g[_],C2);break;case 196:case 205:this.$=es(g[_],I2);break;case 197:case 206:this.$=es(sn(g[_]),R2);break;case 200:this.$=es(g[_].toLowerCase(),yN);break;case 201:this.$=es(g[_].substr(1),C2);break;case 202:this.$=es(g[_].substr(1),I2);break;case 203:this.$=es(g[_].substr(1).toLowerCase(),R2);break;case 207:case 208:this.$=D2(g[_],1);break;case 209:case 210:this.$=D2(g[_],3);break;case 211:this.$=ke.factory.namedNode(bu(g[_]));break;case 213:var Ud=g[_].indexOf(":"),Au=g[_].substr(0,Ud),qd=ke.prefixes[Au];if(!qd)throw new Error("Unknown prefix: "+Au);var Bt=bu(qd+g[_].substr(Ud+1));this.$=ke.factory.namedNode(Bt);break;case 214:if(g[_]=g[_].substr(0,g[_].length-1),!(g[_]in ke.prefixes))throw new Error("Unknown prefix: "+g[_]);var Bt=bu(ke.prefixes[g[_]]);this.$=ke.factory.namedNode(Bt);break;case 215:this.$=wu(g[_].replace(/^(_:)/,""));break;case 216:this.$=wu();break;case 217:case 218:case 232:this.$=Eu(Fy(g[_-3],g[_-2],g[_-1]));break;case 230:case 231:this.$=Eu(g[_-1]);break;case 248:case 250:case 252:case 254:case 256:case 260:case 264:case 268:case 270:case 292:case 294:case 296:case 298:case 300:case 302:case 304:case 306:case 329:case 342:case 356:case 368:case 370:case 372:case 374:case 392:case 402:case 425:case 427:case 429:case 431:case 441:case 445:case 447:case 449:g[_-1].push(g[_]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[g[_]];break;case 308:g[_-3].push(g[_-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:g[_-2].push(g[_-1]);break}},"anonymous"),table:[n(e,t,{3:1,4:2,10:3}),{1:[3]},n(r,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:i,16:i,45:i,197:i,224:i,229:i,308:i,24:[1,13],32:[1,14],36:[1,15],41:s}),n([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:a},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(y,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:v,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(b,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:A,29:I,52:84,53:j,56:85},{19:88,28:A,29:I,52:89,53:j,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:j},n(B,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(te,[2,263],{34:96}),n(te,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(te,[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:I,52:99,53:j,56:85},{6:[2,309],99:100,193:[1,101]},n($,[2,311],{101:102,328:[1,103]}),n(re,[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:Ot},n(at,[2,315]),n(at,[2,316]),n(ct,[2,319]),n(ct,[2,320]),n(ct,[2,321]),n(y,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:v,87:h}),n(Ke,[2,269]),n(Ke,[2,15]),{13:f,16:d,44:136,45:se,46:120,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(E,[2,14]),n(E,[2,274]),n(E,[2,271]),n(E,[2,272]),n(e,[2,4]),{13:[1,177]},n(Z,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:d,45:[1,193],55:194,197:_t,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(b,[2,419]),n(Ct,De,{20:196,59:197,69:198,70:q}),n(l,[2,250]),{29:W,57:200},n($,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(Q,K,{23:204,58:205,62:206,63:Ie}),n(l,[2,252]),{19:208,28:A,29:I,52:209,53:j,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:U,87:h,89:rt,145:212,172:221,185:213,187:214,231:Rr,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},n(KE,[2,265],{56:85,35:227,52:228,19:229,28:A,29:I,53:j}),n(z,[2,260]),n(Q,K,{58:205,62:206,23:230,63:Ie}),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($,[2,312]),{105:233,112:XE,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(re,[2,318]),n($,JE,{108:240,133:242,112:ZE,132:e2}),n(Ye,[2,323]),{112:[1,244]},{112:[2,325]},n(Pr,[2,50]),n(B,Td,{135:245,136:246,143:247,144:248,31:t2,112:t2}),n(Pr,[2,51]),n(Pr,[2,52]),n(Sa,[2,328],{119:249}),{29:st,114:250},n(Sa,[2,56]),{29:st,114:251},n(y,[2,59]),n(Ke,[2,270]),{47:[1,252]},n(r2,[2,150]),n(Ad,[2,428],{240:253}),n(uc,[2,430],{244:254}),n(uc,[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(fc,[2,440],{252:264}),n(gr,[2,448],{260:265}),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(gr,[2,167]),n(gr,[2,168]),n(gr,[2,169]),n(gr,[2,170],{176:269,45:n2,89:i2}),n(gr,[2,171]),n(gr,[2,172]),n(gr,[2,173]),n(gr,[2,174]),{13:f,16:d,44:136,45:se,46:272,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Jt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:s2,89:a2,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(nn,[2,192],{292:[1,286],293:[1,287]}),n(nn,[2,195]),n(nn,[2,196]),n(nn,[2,197]),n(nn,[2,198]),n(nn,[2,199]),n(nn,[2,200]),{13:f,16:d,44:39,55:40,82:U,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(yu,[2,452]),n(yu,[2,453]),n(yu,[2,454]),n(yu,[2,455]),n(yu,[2,456]),{279:[2,458]},n(xd,[2,207]),n(xd,[2,208]),n(xd,[2,209]),n(xd,[2,210]),n(nn,[2,201]),n(nn,[2,202]),n(nn,[2,203]),n(nn,[2,204]),n(nn,[2,205]),n(nn,[2,206]),n(e,[2,5]),n(Cd,[2,297],{88:295}),n(Id,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(Rd,[2,301]),n(Z,[2,43]),n(Z,[2,82]),n(Z,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(ao,[2,123]),n(ao,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(Ji,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:_t,223:312,225:308,226:309,229:o2,307:43,308:p},n(c,i,{215:10,214:314}),n(Ji,[2,236]),n(Ji,[2,237]),n(dc,[2,6]),n(by,[2,287],{60:315,72:316,73:[1,317]}),n(Ct,[2,286]),{13:f,16:d,45:se,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,307:43,308:p,346:He,347:je,348:w,349:T,350:x,351:O},n([6,31,63,70,73,81,83,85],[2,20]),n(B,c2,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Os,31:Os,85:Os,112:Os,159:Os,160:Os,161:Os,163:Os,164:Os,41:s}),{13:f,16:d,55:331,307:43,308:p},n($,[2,280]),n(dc,[2,7]),n(Ct,De,{59:197,69:198,20:332,70:q}),n(Q,[2,284]),{64:[1,333]},n(Q,K,{58:205,62:206,23:334,63:Ie}),n(l,[2,254]),n(B,Td,{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:oo,307:43,308:p},n(_u,[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:oo,308:p}),n(Fs,[2,227]),n(Fs,[2,228]),n(Fs,[2,229]),{13:f,16:d,44:215,45:tt,55:220,82:U,87:h,89:rt,172:221,185:351,187:350,200:348,230:347,231:Rr,234:349,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:oo,307:43,308:p},n(Fs,[2,146]),n(Fs,[2,147]),n(Fs,[2,148]),n(Fs,[2,149]),{13:f,16:d,44:354,55:355,82:U,87:h,172:357,237:356,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:358,312:rn,313:353},n(wy,[2,215]),n(wy,[2,216]),n(Q,K,{58:205,62:206,23:359,63:Ie}),n(te,[2,264]),n(KE,[2,266]),n(dc,[2,11]),n(r,[2,308],{6:[2,310]}),n(Pr,[2,313],{102:360,120:361,121:[1,362]}),n(Pr,[2,47]),n(Pr,[2,63]),n(Pr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(Pr,[2,336]),n(Pr,[2,337]),n(Pr,[2,338]),{109:[1,364]},n(l2,[2,60]),{13:f,16:d,55:365,307:43,308:p},n($,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(co,[2,341],{137:368}),n(co,[2,340]),{13:f,16:d,44:215,45:tt,55:220,82:U,87:h,89:rt,145:369,172:221,185:213,187:214,231:Rr,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},{28:[1,370],127:371,128:[1,372]},n(Sa,[2,330],{124:373,125:374,126:Ot}),n(Sa,[2,57]),{44:375,87:h},n(r2,[2,151],{241:376,242:[1,377]}),n(Ad,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{250:[1,381]},n(Zt,[2,432]),n(Zt,[2,433]),n(Zt,[2,434]),n(Zt,[2,435]),n(Zt,[2,436]),n(Zt,[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:de,298:he,299:pe,300:le,301:ye,302:_e}),n(fc,[2,162],{261:388,262:389,39:Ey,338:Ty}),n(gr,[2,164]),n(gr,[2,165]),n(gr,[2,166]),n(Jt,[2,95]),n(Jt,[2,96]),n(Zt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Jt,[2,177]),{13:f,16:d,44:136,45:se,46:395,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:396,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:397,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:398,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:399,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Jt,[2,183]),n(Jt,[2,98]),n(Zt,[2,381],{180:400}),{87:[1,401]},n(Jt,[2,185]),{13:f,16:d,44:136,45:se,46:402,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{29:W,57:403},n(nn,[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:oo,307:43,308:p},n(va,[2,233]),n(va,[2,234]),n(va,[2,235]),n(u2,[2,459],{281:406,325:[1,407]}),n(Zt,[2,463],{284:408,325:[1,409]}),n(Zt,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:U,171:413,172:415,173:416,174:Pd,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Od},{31:[1,419],89:[1,420]},{29:[1,421]},n(Rd,[2,302]),n(Cd,[2,367],{167:422}),n(Id,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(Rd,[2,371]),n(ao,[2,122]),n(ao,[2,417]),n(ao,[2,413]),n(ao,[2,414]),n(ao,[2,415]),n(Ji,[2,125]),n(Ji,[2,127]),n(Ji,[2,128]),n(f2,[2,420],{227:426}),n(Ji,[2,130]),{13:f,16:d,55:194,197:_t,223:427,307:43,308:p},{48:[1,428]},n(ba,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(by,[2,288]),{64:[1,433]},n(Ct,[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:se,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,276:Ge,277:Ce,279:Ve,280:Pe,283:Be,285:ze,308:p,346:He,347:je,348:w,349:T,350:x,351:O}),n(d2,[2,293]),n(Ay,[2,92]),n(Ay,[2,93]),n(Ay,[2,94]),{45:n2,89:i2,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:A,29:I,56:85},{19:438,28:A,29:I,56:85},n(lo,[2,355],{149:439}),n(lo,[2,354]),{13:f,16:d,44:215,45:Fd,55:220,82:U,87:h,89:rt,156:440,172:221,185:441,203:442,231:Dd,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},n(te,[2,19]),n(ba,[2,21]),{13:f,16:d,44:450,45:h2,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,307:43,308:p,346:He,347:je,348:w,349:T,350:x,351:O},n(dc,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(B,[2,386],{31:[2,388]}),n(_u,[2,102]),n(uo,[2,391],{191:452}),n(B,[2,395],{196:453,198:454}),n(B,[2,108]),n(B,[2,109]),n(_u,[2,103]),n(_u,[2,104]),n(_u,[2,390]),{13:f,16:d,44:215,45:tt,48:[1,455],55:220,82:U,87:h,89:rt,172:221,185:351,187:350,200:456,231:Rr,234:349,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},n(Nd,[2,424]),n(p2,[2,136]),n(p2,[2,137]),n(xy,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:oo,307:43,308:p},n(va,[2,219]),n(va,[2,220]),n(va,[2,221]),n(va,[2,222]),n(va,[2,223]),n(dc,[2,10]),n(Pr,[2,46]),n(Pr,[2,314]),{112:XE,122:459},n(Pr,[2,62]),n($,JE,{133:242,108:460,112:ZE,132:e2}),n(l2,[2,61]),n(Pr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(co,[2,351],{146:463,335:[1,464]}),{29:W,57:465},n(Sa,[2,329]),n($,[2,332],{129:466,327:[1,467]}),n(Sa,[2,55]),n(Sa,[2,331]),{48:[1,468]},n(Ad,[2,429]),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(uc,[2,431]),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(uc,[2,156]),{45:s2,89:a2,179:471},n(fc,[2,441]),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(gr,[2,444],{256:473}),n(gr,[2,446],{258:474}),n(Zt,[2,442]),n(Zt,[2,443]),n(gr,[2,449]),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Zt,[2,450]),n(Zt,[2,451]),n(Zt,[2,379],{178:476}),n(Zt,[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:se,46:482,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{48:[1,483]},{48:[1,484]},n(Jt,[2,187]),n(nn,[2,194]),{13:f,16:d,44:39,55:40,82:U,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,320:485},{13:f,16:d,39:[1,487],44:136,45:se,46:488,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,282:486,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(u2,[2,460]),{13:f,16:d,44:136,45:se,46:489,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Zt,[2,464]),{13:f,16:d,44:136,45:se,46:490,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Zt,[2,466]),n(Z,[2,40]),n(Cd,[2,298]),n(Su,[2,87]),n(Su,[2,88]),n(Su,[2,89]),n(Su,[2,90]),{13:f,16:d,55:492,82:U,172:493,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,311:494,312:rn,315:491},n(Z,[2,41]),n(Id,[2,300]),n(vu,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:U,171:497,172:415,173:416,174:Pd,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Od},{31:[1,498],89:[1,499]},{29:[1,500]},n(Rd,[2,372]),{13:f,16:d,48:[2,422],55:194,197:_t,223:312,226:502,228:501,229:o2,307:43,308:p},n(Ji,[2,131]),n(Ji,[2,126]),n(ba,[2,22]),n(ba,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:se,55:323,67:321,68:322,74:505,75:506,76:m2,77:320,78:g2,79:509,87:h,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,307:43,308:p,346:He,347:je,348:w,349:T,350:x,351:O},n(d2,[2,294]),n(y2,[2,69]),n(y2,[2,70]),n(Ct,De,{59:197,69:198,20:511,70:q}),n(Q,K,{58:205,62:206,23:512,63:Ie}),{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(lo,[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(Ld,[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:Fd,55:220,82:U,87:h,89:rt,172:221,185:351,203:536,212:534,231:Dd,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},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:h2,87:h,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,276:Ge,277:Ce,279:Ve,280:Pe,283:Be,285:ze,308:p,346:He,347:je,348:w,349:T,350:x,351:O}),n(fo,[2,291]),n(fo,[2,24]),n(fo,[2,25]),{13:f,16:d,44:136,45:se,46:539,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(fo,[2,28]),n(Q,K,{58:205,62:206,23:540,63:Ie}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(uo,[2,107]),{13:f,16:d,44:215,45:tt,55:220,82:U,87:h,89:rt,172:221,185:351,187:350,199:543,200:544,231:Rr,234:349,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},n(_2,[2,132]),n(Nd,[2,425]),n(_2,[2,133]),{13:f,16:d,44:354,55:355,82:U,87:h,172:357,237:356,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:358,312:rn,313:545},n(Pr,[2,54]),n(Pr,[2,48]),n(co,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(co,[2,68]),n(B,[2,350],{31:S2,112:S2}),n(Pr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n($,[2,333]),n(Ke,[2,16]),n(Ad,[2,152]),n(uc,[2,154]),n(uc,[2,157]),n(fc,[2,159]),n(fc,[2,160],{262:389,261:548,39:Ey,338:Ty}),n(fc,[2,161],{262:389,261:549,39:Ey,338:Ty}),n(gr,[2,163]),{13:f,16:d,44:136,45:se,46:550,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Jt,[2,178]),n(Jt,[2,179]),{13:f,16:d,44:136,45:se,46:551,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:552,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:553,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{48:[1,554],272:[1,555]},n(Jt,[2,184]),n(Jt,[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(Cy,[2,224]),n(Cy,[2,225]),n(Cy,[2,226]),{31:[1,563],45:v2,94:564},n(Z,[2,84]),n(Cd,[2,368]),n(Z,[2,85]),n(Id,[2,370]),n(vu,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(ba,[2,35],{83:[1,569]}),n(ba,[2,36],{81:[1,570]}),n(by,[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:se,76:m2,78:g2,87:h,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,276:Ge,277:Ce,279:Ve,280:Pe,283:Be,285:ze,308:p,346:He,347:je,348:w,349:T,350:x,351:O}),n(hc,[2,295]),{45:se,77:572},{45:se,77:573},n(hc,[2,33]),n(hc,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(lo,[2,356]),n(b2,[2,357],{152:578,335:[1,579]}),n(Ds,[2,74]),{29:W,57:580},{29:W,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(w2,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:se,55:323,67:321,68:322,77:320,79:585,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,307:43,308:p,346:He,347:je,348:w,349:T,350:x,351:O},{45:[1,586]},n(Ds,[2,81]),{29:W,57:587},n(lo,[2,73]),n(B,[2,362],{29:Ns,31:Ns,85:Ns,112:Ns,159:Ns,160:Ns,161:Ns,163:Ns,164:Ns}),n(Ld,[2,112]),n(pc,[2,401],{206:588}),n(B,[2,405],{209:589,210:590}),n(B,[2,403]),n(B,[2,404]),n(Ld,[2,113]),n(Ld,[2,400]),{13:f,16:d,44:215,45:Fd,48:[1,591],55:220,82:U,87:h,89:rt,172:221,185:351,203:536,212:592,231:Dd,234:535,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},n(Nd,[2,426]),n(xy,[2,138]),n(xy,[2,139]),{232:[1,593]},n(fo,[2,292]),{47:[1,595],48:[1,594]},n(dc,[2,9]),n(uo,[2,392]),n(uo,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:oo,308:p}),n(uo,[2,110],{272:[1,598]}),n(kd,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(Sa,[2,58]),n(gr,[2,445]),n(gr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Jt,[2,99]),n(Zt,[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(Jt,[2,188]),n(Jt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:U,172:493,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,311:494,312:rn,315:611},n(Z,[2,42]),n(vu,[2,304]),{13:f,16:d,55:414,82:U,95:612,171:613,172:415,173:416,174:Pd,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Od},{31:[1,614],45:v2,94:615},n(Ji,[2,129]),n(f2,[2,421]),{82:[1,616]},{82:[1,617]},n(hc,[2,296]),n(hc,[2,31]),n(hc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(B,c2,{155:330,153:618,154:619,29:Ls,31:Ls,85:Ls,112:Ls,159:Ls,160:Ls,161:Ls,163:Ls,164:Ls}),n(b2,[2,358]),n(Ds,[2,75]),n(Ds,[2,76]),{29:W,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(w2,[2,366]),n(Ds,[2,79]),{13:f,16:d,44:136,45:se,46:622,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Ds,[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(pc,[2,117]),{13:f,16:d,44:215,45:Fd,55:220,82:U,87:h,89:rt,172:221,185:351,203:536,211:626,212:627,231:Dd,234:535,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:rn},n(Fs,[2,134]),n(Nd,[2,427]),n(Fs,[2,135]),n(fo,[2,26]),{44:628,87:h},n(uo,[2,106]),n(uo,[2,394]),n(B,[2,396]),n(kd,[2,111]),n(kd,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:oo,307:43,308:p},n(wy,[2,217]),n(B,Td,{144:248,140:630,143:631,31:[2,343]}),n(Jt,[2,97]),n(Zt,[2,380]),n(Jt,[2,180]),{13:f,16:d,44:136,45:se,46:632,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:633,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Jt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:U,171:637,172:415,173:416,174:Pd,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Od},n(E2,[2,305]),n(Z,[2,86]),n(vu,[2,374]),n(ba,[2,37]),n(ba,[2,38]),n(lo,[2,72]),n(lo,[2,360]),n(Ds,[2,77]),{29:W,57:638},{47:[1,639]},{29:[2,376]},n(pc,[2,402]),n(pc,[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(pc,[2,118],{272:[1,641]}),n(Md,[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:Se,304:ve,305:oe,306:be},n(Su,[2,218]),n(vu,[2,44]),n(E2,[2,306]),n(Ds,[2,78]),{44:651,87:h},n(pc,[2,116]),n(B,[2,406]),n(Md,[2,119]),n(Md,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(fo,[2,27]),n(kd,[2,230]),n(T2,[2,345],{141:653,335:[1,654]}),n(Jt,[2,181]),n(Jt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(B,Td,{144:248,142:657,143:658,31:A2,112:A2}),n(T2,[2,346]),n(Ds,[2,80]),n(Md,[2,231]),n(co,[2,67]),n(co,[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,P){if(P.recoverable)this.trace(C);else{var N=new Error(C);throw N.hash=P,N}},"parseError"),parse:o(function(C){var P=this,N=[0],ie=[],Oe=[null],g=[],an=this.table,_="",ts=0,Tu=0,Bd=0,Ud=2,Au=1,qd=g.slice.call(arguments,1),Bt=Object.create(this.lexer),rs={yy:{}};for(var xu in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xu)&&(rs.yy[xu]=this.yy[xu]);Bt.setInput(C,rs.yy),rs.yy.lexer=Bt,rs.yy.parser=this,typeof Bt.yylloc>"u"&&(Bt.yylloc={});var Sc=Bt.yylloc;g.push(Sc);var St=Bt.options&&Bt.options.ranges;typeof rs.yy.parseError=="function"?this.parseError=rs.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function jt(ns){N.length=N.length-2*ns,Oe.length=Oe.length-ns,g.length=g.length-ns}o(jt,"popStack");for(var nt=o(function(){var ns;return ns=Bt.lex()||Au,typeof ns!="number"&&(ns=P.symbols_[ns]||ns),ns},"lex"),ut,bn,go,Gn,AX,Vy,vc={},Wd,js,M2,Gd;;){if(go=N[N.length-1],this.defaultActions[go]?Gn=this.defaultActions[go]:((ut===null||typeof ut>"u")&&(ut=nt()),Gn=an[go]&&an[go][ut]),typeof Gn>"u"||!Gn.length||!Gn[0]){var By="";Gd=[];for(Wd in an[go])this.terminals_[Wd]&&Wd>Ud&&Gd.push("'"+this.terminals_[Wd]+"'");Bt.showPosition?By="Parse error on line "+(ts+1)+`:
33
+ `)}o(b4,"composeErrorMessage");function w4(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=v4(r,e);return b4(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(w4,"formatErrorCtor");Nh.formatErrorCtor=w4});var sA=S(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.isDisposable=void 0;function E4(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(E4,"isDisposable");Lh.isDisposable=E4});var oA=S(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.PostResolutionInterceptors=Co.PreResolutionInterceptors=void 0;var aA=u_(),kh=class extends aA.default{static{o(this,"PreResolutionInterceptors")}};Co.PreResolutionInterceptors=kh;var Mh=class extends aA.default{static{o(this,"PostResolutionInterceptors")}};Co.PostResolutionInterceptors=Mh;var g_=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new kh,this.postResolution=new Mh}};Co.default=g_});var xa=S(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.instance=Ws.typeInfo=void 0;var T4=(Ah(),zd(Th)),un=o_(),A4=rA(),jh=Ph(),x4=nA(),An=t_(),$h=iA(),C4=m_(),I4=Rh(),R4=sA(),P4=oA();Ws.typeInfo=new Map;var y_=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new x4.default,this.interceptors=new P4.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:An.default.Transient}){this.ensureNotDisposed();let i;if(A4.isProvider(t)?i=t:i={useClass:t},un.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&&un.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===An.default.Singleton||r.lifecycle==An.default.ContainerScoped||r.lifecycle==An.default.ResolutionScoped)&&(un.isValueProvider(i)||un.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${An.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),un.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(),un.isNormalToken(e)){if(un.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:An.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:An.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!un.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:An.default.Singleton})}resolve(e,t=new $h.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&un.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(jh.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===An.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===An.default.Singleton,i=e.options.lifecycle===An.default.ContainerScoped,s=r||i,a;return un.isValueProvider(e.provider)?a=e.provider.useValue:un.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):un.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):un.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===An.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new $h.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&un.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=>!un.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===An.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===An.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 T4.__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 I4.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Ws.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 R4.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return jh.isTokenDescriptor(r)?jh.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new $h.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 $h.default,r.isOptional):this.resolve(r.token,e,r.isOptional):jh.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(C4.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Ws.instance=new y_;Ws.default=Ws.instance});var cA=S(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var O4=Ao(),Gs=xa(),__=Ph(),F4=m_();function D4(){return function(n){let e=O4.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return __.isTokenDescriptor(r)?__.isTransformDescriptor(r)?r.multiple?Gs.instance.resolve(r.transform).transform(Gs.instance.resolveAll(r.token),...r.transformArgs):Gs.instance.resolve(r.transform).transform(Gs.instance.resolve(r.token),...r.transformArgs):r.multiple?Gs.instance.resolveAll(r.token):Gs.instance.resolve(r.token):__.isTransformDescriptor(r)?Gs.instance.resolve(r.transform).transform(Gs.instance.resolve(r.token),...r.transformArgs):Gs.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(F4.formatErrorCtor(n,a,s))}})))}}}}o(D4,"autoInjectable");S_.default=D4});var lA=S(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});var N4=Ao();function L4(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return N4.defineInjectionTokenMetadata(t)}o(L4,"inject");v_.default=L4});var Vh=S(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});var k4=Ao(),M4=xa(),uA=xa();function j4(n){return function(e){M4.typeInfo.set(e,k4.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{uA.instance.register(t,e)}):uA.instance.register(n.token,e))}}o(j4,"injectable");b_.default=j4});var fA=S(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});var $4=(Ah(),zd(Th)),V4=xa();function B4(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=$4.__rest(t,["token","options"]);return V4.instance.register(r,s,i)}),e}}o(B4,"registry");w_.default=B4});var dA=S(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});var U4=Vh(),q4=xa();function W4(){return function(n){U4.default()(n),q4.instance.registerSingleton(n)}}o(W4,"singleton");E_.default=W4});var hA=S(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});var G4=Ao();function z4(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return G4.defineInjectionTokenMetadata(t)}o(z4,"injectAll");T_.default=z4});var pA=S(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});var H4=Ao();function Q4(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return H4.defineInjectionTokenMetadata(r)}o(Q4,"injectAllWithTransform");A_.default=Q4});var mA=S(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});var Y4=Ao();function K4(n,e,...t){return Y4.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(K4,"injectWithTransform");x_.default=K4});var gA=S(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});var X4=Vh(),J4=xa();function Z4(n,e){return function(t){X4.default()(t),J4.instance.register(e||t,t,{lifecycle:n})}}o(Z4,"scoped");C_.default=Z4});var yA=S(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});var ej=cA();Object.defineProperty(di,"autoInjectable",{enumerable:!0,get:o(function(){return ej.default},"get")});var tj=lA();Object.defineProperty(di,"inject",{enumerable:!0,get:o(function(){return tj.default},"get")});var rj=Vh();Object.defineProperty(di,"injectable",{enumerable:!0,get:o(function(){return rj.default},"get")});var nj=fA();Object.defineProperty(di,"registry",{enumerable:!0,get:o(function(){return nj.default},"get")});var ij=dA();Object.defineProperty(di,"singleton",{enumerable:!0,get:o(function(){return ij.default},"get")});var sj=hA();Object.defineProperty(di,"injectAll",{enumerable:!0,get:o(function(){return sj.default},"get")});var aj=pA();Object.defineProperty(di,"injectAllWithTransform",{enumerable:!0,get:o(function(){return aj.default},"get")});var oj=mA();Object.defineProperty(di,"injectWithTransform",{enumerable:!0,get:o(function(){return oj.default},"get")});var cj=gA();Object.defineProperty(di,"scoped",{enumerable:!0,get:o(function(){return cj.default},"get")})});var _A=S(I_=>{"use strict";Object.defineProperty(I_,"__esModule",{value:!0});function lj(n){let e;return t=>(e==null&&(e=n(t)),e)}o(lj,"instanceCachingFactory");I_.default=lj});var SA=S(R_=>{"use strict";Object.defineProperty(R_,"__esModule",{value:!0});function uj(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(uj,"instancePerContainerCachingFactory");R_.default=uj});var vA=S(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});function fj(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(fj,"predicateAwareClassFactory");P_.default=fj});var bA=S(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});var dj=_A();Object.defineProperty(Gu,"instanceCachingFactory",{enumerable:!0,get:o(function(){return dj.default},"get")});var hj=SA();Object.defineProperty(Gu,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return hj.default},"get")});var pj=vA();Object.defineProperty(Gu,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return pj.default},"get")})});var ue=S(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var O_=(Ah(),zd(Th));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 mj=tA();Object.defineProperty(Ca,"Lifecycle",{enumerable:!0,get:o(function(){return mj.Lifecycle},"get")});O_.__exportStar(yA(),Ca);O_.__exportStar(bA(),Ca);O_.__exportStar(o_(),Ca);var gj=Rh();Object.defineProperty(Ca,"delay",{enumerable:!0,get:o(function(){return gj.delay},"get")});var yj=xa();Object.defineProperty(Ca,"container",{enumerable:!0,get:o(function(){return yj.instance},"get")})});var Ic=S(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.NullLogger=void 0;Bh.NullLogger={debug(){},info(){},warn(){},error(){}}});var F_=S((cte,wA)=>{var Rc=class{static{o(this,"Wildcard")}constructor(){return _j||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(Rc.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(Rc.prototype,"termType",{enumerable:!0,value:"Wildcard"});var _j=new Rc;wA.exports.Wildcard=Rc});var TA=S((ute,EA)=>{var Sj=(function(){var n=o(function(R,C,P,N){for(P=P||{},N=R.length;N--;P[R[N]]=C);return P},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],y=[123,126],v=[1,67],E=[39,45,87],b=[13,16,45,197,224,308],A=[1,87],I=[2,281],j=[1,86],B=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],te=[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],$=[13,16,308],re=[112,132,327,334],Ye=[13,16,112,132,308],st=[1,111],Ot=[1,117],at=[112,132,327,328,334],ct=[13,16,112,132,308,328],Ke=[28,29,45,53,87],se=[1,138],U=[1,151],lt=[1,128],pt=[1,127],H=[1,129],Re=[1,140],Ue=[1,141],ne=[1,142],qe=[1,143],We=[1,144],$e=[1,145],Ge=[1,147],Ce=[1,148],Ve=[2,457],Pe=[1,158],Be=[1,159],ze=[1,160],fe=[1,152],me=[1,153],ge=[1,156],de=[1,171],he=[1,172],pe=[1,173],le=[1,174],ye=[1,175],_e=[1,176],Se=[1,167],ve=[1,168],oe=[1,169],be=[1,170],Ze=[1,157],He=[1,166],je=[1,161],w=[1,162],T=[1,163],x=[1,164],O=[1,165],Z=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],_t=[1,195],Ct=[6,31,73,81,83,85],De=[2,285],q=[1,199],W=[1,201],Q=[6,31,70,73,81,83,85],K=[2,283],Ie=[1,207],tt=[1,218],rt=[1,223],Rr=[1,219],vn=[1,225],Ln=[1,226],nn=[1,224],KE=[6,63,70,73,81,83,85],XE=[1,236],JE=[2,334],ZE=[1,243],e2=[1,241],Pr=[6,193],Td=[2,349],t2=[2,339],Sa=[28,128],r2=[47,48,193,272],Ad=[47,48,193,242,272],uc=[47,48,193,242,246,272],fc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],gr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],n2=[1,271],i2=[1,270],Jt=[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],s2=[1,281],a2=[1,280],sn=[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],yu=[45,89],xd=[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],Cd=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Id=[31,89],Rd=[48,87],oo=[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],Ji=[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],o2=[1,313],dc=[6,85],by=[6,31,81,83,85],c2=[2,361],Os=[2,353],co=[1,343],_u=[31,112,335],Fs=[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],wy=[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],l2=[6,109,193],lo=[31,112],Zt=[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],va=[13,16,87,197,308,314],u2=[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],Pd=[1,417],Od=[1,418],f2=[13,16,48,197,229,308],ba=[6,31,85],d2=[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],Ay=[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],uo=[29,31,85,112,159,160,161,163,164],Fd=[1,443],Dd=[1,444],h2=[1,449],fo=[31,112,193,232,318,335],Nd=[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],p2=[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],xy=[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],Su=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],vu=[31,45],m2=[1,507],g2=[1,508],y2=[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],Ld=[29,31,85,112,159,160,161,163,164,335],ho=[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],_2=[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],S2=[2,352],Cy=[13,16,197,308,314],v2=[1,565],hc=[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],b2=[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],Ds=[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],w2=[13,16,87,308],Ns=[2,364],pc=[29,31,85,112,159,160,161,163,164,193,232,318,335],kd=[31,112,193,232,272,318,335],Ls=[2,359],E2=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Md=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],T2=[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],A2=[2,347],Iy={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,P,N,ie,Oe,g,on){var _=g.length-1;switch(Oe){case 1:if(g[_-1]=g[_-1]||{},ke.base&&(g[_-1].base=ke.base),ke.base="",g[_-1].prefixes=ke.prefixes,ke.prefixes=null,ke.pathOnly){if(g[_-1].type==="path"||"termType"in g[_-1])return g[_-1];throw new Error("Received full SPARQL query in path only mode")}else if(g[_-1].type==="path"||"termType"in g[_-1])throw new Error("Received only path in full SPARQL mode");if(g[_-1].type==="update"){let St={};for(let jt of g[_-1].updates)if(jt.updateType==="insert"){let nt={};for(let ut of jt.insert)if(ut.type==="bgp"||ut.type==="graph")for(let bn of ut.triples)bn.subject.termType==="BlankNode"&&(nt[bn.subject.value]=!0),bn.predicate.termType==="BlankNode"&&(nt[bn.predicate.value]=!0),bn.object.termType==="BlankNode"&&(nt[bn.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[_-1];case 2:this.$={...g[_-1],...g[_],type:"query"};break;case 4:ke.base=bu(g[_]);break;case 5:ke.prefixes||(ke.prefixes={}),g[_-1]=g[_-1].substr(0,g[_-1].length-1),g[_]=bu(g[_]),ke.prefixes[g[_-1]]=g[_];break;case 6:this.$={...g[_-3],...go(g[_-2]),...g[_-1],...g[_]};break;case 7:if(!ke.skipValidation&&(ky(g[_-3].variables.map(jt=>Ly(jt.expression))).some(jt=>jt.aggregation==="count"&&!(jt.expression instanceof jd))||g[_].group)){for(let jt of g[_-3].variables)if(jt.termType==="Variable"){if(!g[_].group||!g[_].group.map(nt=>_c(nt)).includes(_c(jt)))throw Error("Projection of ungrouped variable (?"+_c(jt)+")")}else if(Ly(jt.expression).length===0){let nt=TN(jt.expression);for(let ut of nt)if(!g[_].group||!g[_].group.map||!g[_].group.map(bn=>_c(bn)).includes(_c(ut)))throw Error("Use of ungrouped variable in projection of operation (?"+_c(ut)+")")}}let rs=g[_-1].where.filter(St=>St.type==="query");if(rs.length>0){let St=g[_-3].variables.filter(nt=>nt.variable&&nt.variable.value).map(nt=>nt.variable.value),jt=ky(rs.map(nt=>nt.variables)).map(nt=>nt.value||nt.variable.value);for(let nt of St)if(jt.indexOf(nt)>=0)throw Error("Target id of 'AS' (?"+nt+") already used in subquery")}this.$=Qt(g[_-3],go(g[_-2]),g[_-1],g[_]);break;case 8:this.$=Qt({queryType:"CONSTRUCT",template:g[_-3]},go(g[_-2]),g[_-1],g[_]);break;case 9:this.$=Qt({queryType:"CONSTRUCT",template:g[_-2]=g[_-2]?g[_-2].triples:[]},go(g[_-5]),{where:[{type:"bgp",triples:mo([],g[_-2])}]},g[_]);break;case 10:this.$=Qt({queryType:"DESCRIBE",variables:g[_-3]==="*"?[new jd]:g[_-3]},go(g[_-2]),g[_-1],g[_]);break;case 11:this.$=Qt({queryType:"ASK"},go(g[_-2]),g[_-1],g[_]);break;case 12:this.$=Qt(g[_-1],{variables:[new jd]});break;case 13:let xu=g[_].map(St=>St.value||St.variable.value),Sc=AN(xu);if(Sc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Sc[0]+")");this.$=Qt(g[_-1],{variables:g[_]});break;case 14:this.$=Qt({queryType:"SELECT"},g[_]&&(g[_-1]=an(g[_]),g[_]={},g[_][g[_-1]]=!0,g[_]));break;case 16:case 27:this.$=mc(g[_-3],{variable:g[_-1]});break;case 17:case 18:this.$=Qt(g[_-3],g[_-2],g[_-1],g[_],{type:"query"});break;case 19:case 58:this.$={iri:g[_],named:!!g[_-1]};break;case 20:this.$={where:g[_].patterns};break;case 21:this.$=Qt(g[_-1],g[_]);break;case 22:this.$=Qt(g[_-2],g[_-1],g[_]);break;case 23:this.$={group:g[_]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=mc(g[_]);break;case 26:this.$=mc(g[_-1]);break;case 29:this.$={having:g[_]};break;case 30:this.$={order:g[_]};break;case 32:this.$=mc(g[_],{descending:!0});break;case 35:this.$={limit:yc(g[_])};break;case 36:this.$={offset:yc(g[_])};break;case 37:this.$={limit:yc(g[_-2]),offset:yc(g[_])};break;case 38:this.$={limit:yc(g[_]),offset:yc(g[_-2])};break;case 39:case 43:this.$={type:"values",values:g[_]};break;case 40:case 84:this.$=g[_-1].map(St=>({[g[_-3]]:St}));break;case 41:case 85:this.$=g[_-1].map(()=>({}));break;case 42:case 86:var ts=g[_-4].length;g[_-4]=g[_-4].map(Ry),this.$=g[_-1].map(function(St){if(St.length!==ts)throw Error("Inconsistent VALUES length");for(var jt={},nt=0;nt<ts;nt++)jt["?"+g[_-4][nt].value]=St[nt];return jt});break;case 44:case 65:case 100:case 126:case 175:this.$=g[_-1];break;case 45:this.$={type:"update",updates:ks(g[_-2],g[_-1])};break;case 46:this.$=Qt({type:"load",silent:!!g[_-2],source:g[_-1]},g[_]&&{destination:g[_]});break;case 47:this.$={type:an(g[_-2]),silent:!!g[_-1],graph:g[_]};break;case 48:this.$={type:an(g[_-4]),silent:!!g[_-3],source:g[_-2],destination:g[_]};break;case 49:this.$={type:"create",silent:!!g[_-2],graph:{type:"graph",name:g[_]}};break;case 50:this.$={updateType:"insert",insert:k2(g[_])};break;case 51:this.$={updateType:"delete",delete:$y(k2(g[_]))};break;case 52:this.$={updateType:"deletewhere",delete:$y(g[_])};break;case 53:this.$={updateType:"insertdelete",...g[_-4],...g[_-3],...go(g[_-2],"using"),where:g[_].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=g[_];break;case 55:this.$={delete:$y(g[_-1]),insert:g[_]||[]};break;case 56:this.$={delete:[],insert:g[_]};break;case 59:this.$={graph:g[_]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:g[_]};break;case 64:this.$={[an(g[_])]:!0};break;case 66:this.$=g[_-1]?Zi(g[_],[g[_-1]]):Zi(g[_]);break;case 67:var Tu=Qt(g[_-3]||{triples:[]},{type:"graph",name:g[_-5]});this.$=g[_]?[Tu,g[_]]:[Tu];break;case 68:case 73:this.$={type:"bgp",triples:Zi(g[_-2],[g[_-1]])};break;case 69:this.$={type:"group",patterns:[g[_-1]]};break;case 70:for(let St of g[_-1].filter(jt=>jt.type==="bind")){let jt=g[_-1].indexOf(St),nt=new Set;for(let ut of g[_-1].slice(0,jt))(ut.type==="group"||ut.type==="bgp")&&N2(ut).forEach(bn=>nt.add(bn));if(nt.has(St.variable.value))throw Error("Variable used to bind is already bound (?"+St.variable.value+")")}this.$={type:"group",patterns:g[_-1]};break;case 71:this.$=g[_-1]?Zi([g[_-1]],g[_]):Zi(g[_]);break;case 72:this.$=g[_]?[g[_-2],g[_]]:g[_-2];break;case 75:this.$=Qt(g[_],{type:"optional"});break;case 76:this.$=Qt(g[_],{type:"minus"});break;case 77:this.$=Qt(g[_],{type:"graph",name:g[_-1]});break;case 78:this.$=Qt(g[_],{type:"service",name:g[_-1],silent:!!g[_-2]});break;case 79:this.$={type:"filter",expression:g[_]};break;case 80:this.$={type:"bind",variable:g[_-1],expression:g[_-3]};break;case 89:this.$=Eu(g[_]);break;case 90:this.$=void 0;break;case 91:this.$=g[_-1].length?{type:"union",patterns:Zi(g[_-1].map(Oy),[Oy(g[_])])}:g[_];break;case 95:this.$={...g[_],function:g[_-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:ks(g[_-2],g[_-1]),distinct:!!g[_-3]};break;case 98:case 115:case 128:case 247:case 249:case 251:case 253:case 255:case 263:case 267:case 297:case 299:case 303:case 307:case 328:case 341:case 349:case 355:case 361:case 367:case 369:case 373:case 375:case 379:case 381:case 385:case 391:case 395:case 401:case 405:case 409:case 411:case 420:case 428:case 430:case 440:case 444:case 446:case 448:this.$=[];break;case 99:this.$=ks(g[_-2],g[_-1]);break;case 101:this.$=Zi(g[_-2],[g[_-1]]);break;case 102:case 112:this.$=jy(g[_].map(St=>Qt(Ms(g[_-1]),St)));break;case 103:this.$=jy(mo(g[_].map(St=>Qt(Ms(g[_-1].entity),St)),g[_-1].triples));break;case 105:this.$=Zi([g[_-1]],g[_]);break;case 106:this.$=Zi(g[_]);break;case 107:this.$=Ny(g[_-1],g[_]);break;case 109:case 237:this.$=ke.factory.namedNode(pN);break;case 110:case 118:this.$=ks(g[_-1],g[_]);break;case 111:this.$=g[_]?{annotation:g[_],object:g[_-1]}:g[_-1];break;case 113:this.$=g[_]?jy(mo(g[_].map(St=>Qt(Ms(g[_-1].entity),St)),g[_-1].triples)):g[_-1].triples;break;case 114:this.$=Ny(...g[_-1],g[_]);break;case 116:this.$=Ny(...g[_]);break;case 117:case 159:case 163:this.$=[g[_-1],g[_]];break;case 119:this.$=g[_]?{object:g[_-1],annotation:g[_]}:g[_-1];break;case 120:this.$=g[_-1].length?gc("|",ks(g[_-1],g[_])):g[_];break;case 121:this.$=g[_-1].length?gc("/",ks(g[_-1],g[_])):g[_];break;case 122:this.$=g[_]?gc(g[_],[g[_-1]]):g[_-1];break;case 123:this.$=g[_-1]?gc(g[_-1],[g[_]]):g[_];break;case 125:case 131:this.$=gc(g[_-1],[g[_]]);break;case 129:this.$=gc("|",ks(g[_-2],g[_-1]));break;case 132:case 134:this.$=wN(g[_-1]);break;case 133:case 135:this.$=EN(g[_-1]);break;case 140:this.$={entity:g[_],triples:[]};break;case 145:this.$=Ry(g[_]);break;case 149:this.$=ke.factory.namedNode(x2);break;case 151:case 153:case 158:case 162:this.$=Py(g[_-1],g[_]);break;case 152:this.$=["||",g[_]];break;case 154:this.$=["&&",g[_]];break;case 156:this.$=Or(g[_-1],[g[_-2],g[_]]);break;case 157:this.$=Or(g[_-2]?"notin":"in",[g[_-3],g[_]]);break;case 160:this.$=["+",Py(g[_-1],g[_])];break;case 161:var Bd=es(g[_-1].value.replace("-",""),g[_-1].datatype);this.$=["-",Py(Bd,g[_])];break;case 164:this.$=Or("UPLUS",[g[_]]);break;case 165:this.$=Or(g[_-1],[g[_]]);break;case 166:this.$=Or("UMINUS",[g[_]]);break;case 177:this.$=Or(an(g[_-1]));break;case 178:this.$=Or(an(g[_-3]),[g[_-1]]);break;case 179:this.$=Eu(Or(an(g[_-3]),[g[_-1]]));break;case 180:this.$=Or(an(g[_-5]),[g[_-3],g[_-1]]);break;case 181:this.$=Or(an(g[_-7]),[g[_-5],g[_-3],g[_-1]]);break;case 182:this.$=Eu(Or(an(g[_-7]),[g[_-5],g[_-3],g[_-1]]));break;case 183:this.$=Or(an(g[_-1]),g[_]);break;case 184:this.$=Or("bound",[Ry(g[_-1])]);break;case 185:this.$=Or(g[_-1],[]);break;case 186:this.$=Or(g[_-3],[g[_-1]]);break;case 187:this.$=Or(g[_-2]?"notexists":"exists",[Oy(g[_])]);break;case 188:case 189:this.$=mc(g[_-1],{type:"aggregate",aggregation:an(g[_-4]),distinct:!!g[_-2]});break;case 190:this.$=mc(g[_-2],{type:"aggregate",aggregation:an(g[_-5]),distinct:!!g[_-3],separator:typeof g[_-1]=="string"?g[_-1]:" "});break;case 192:this.$=es(g[_]);break;case 193:this.$=_N(g[_-1],an(g[_].substr(1)));break;case 194:this.$=es(g[_-2],g[_]);break;case 195:case 204:this.$=es(g[_],C2);break;case 196:case 205:this.$=es(g[_],I2);break;case 197:case 206:this.$=es(an(g[_]),R2);break;case 200:this.$=es(g[_].toLowerCase(),yN);break;case 201:this.$=es(g[_].substr(1),C2);break;case 202:this.$=es(g[_].substr(1),I2);break;case 203:this.$=es(g[_].substr(1).toLowerCase(),R2);break;case 207:case 208:this.$=D2(g[_],1);break;case 209:case 210:this.$=D2(g[_],3);break;case 211:this.$=ke.factory.namedNode(bu(g[_]));break;case 213:var Ud=g[_].indexOf(":"),Au=g[_].substr(0,Ud),qd=ke.prefixes[Au];if(!qd)throw new Error("Unknown prefix: "+Au);var Bt=bu(qd+g[_].substr(Ud+1));this.$=ke.factory.namedNode(Bt);break;case 214:if(g[_]=g[_].substr(0,g[_].length-1),!(g[_]in ke.prefixes))throw new Error("Unknown prefix: "+g[_]);var Bt=bu(ke.prefixes[g[_]]);this.$=ke.factory.namedNode(Bt);break;case 215:this.$=wu(g[_].replace(/^(_:)/,""));break;case 216:this.$=wu();break;case 217:case 218:case 232:this.$=Eu(Fy(g[_-3],g[_-2],g[_-1]));break;case 230:case 231:this.$=Eu(g[_-1]);break;case 248:case 250:case 252:case 254:case 256:case 260:case 264:case 268:case 270:case 292:case 294:case 296:case 298:case 300:case 302:case 304:case 306:case 329:case 342:case 356:case 368:case 370:case 372:case 374:case 392:case 402:case 425:case 427:case 429:case 431:case 441:case 445:case 447:case 449:g[_-1].push(g[_]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[g[_]];break;case 308:g[_-3].push(g[_-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:g[_-2].push(g[_-1]);break}},"anonymous"),table:[n(e,t,{3:1,4:2,10:3}),{1:[3]},n(r,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:i,16:i,45:i,197:i,224:i,229:i,308:i,24:[1,13],32:[1,14],36:[1,15],41:s}),n([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:a},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(y,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:v,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(b,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:A,29:I,52:84,53:j,56:85},{19:88,28:A,29:I,52:89,53:j,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:j},n(B,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(te,[2,263],{34:96}),n(te,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(te,[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:I,52:99,53:j,56:85},{6:[2,309],99:100,193:[1,101]},n($,[2,311],{101:102,328:[1,103]}),n(re,[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:Ot},n(at,[2,315]),n(at,[2,316]),n(ct,[2,319]),n(ct,[2,320]),n(ct,[2,321]),n(y,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:v,87:h}),n(Ke,[2,269]),n(Ke,[2,15]),{13:f,16:d,44:136,45:se,46:120,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(E,[2,14]),n(E,[2,274]),n(E,[2,271]),n(E,[2,272]),n(e,[2,4]),{13:[1,177]},n(Z,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:d,45:[1,193],55:194,197:_t,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(b,[2,419]),n(Ct,De,{20:196,59:197,69:198,70:q}),n(l,[2,250]),{29:W,57:200},n($,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(Q,K,{23:204,58:205,62:206,63:Ie}),n(l,[2,252]),{19:208,28:A,29:I,52:209,53:j,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:U,87:h,89:rt,145:212,172:221,185:213,187:214,231:Rr,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},n(KE,[2,265],{56:85,35:227,52:228,19:229,28:A,29:I,53:j}),n(z,[2,260]),n(Q,K,{58:205,62:206,23:230,63:Ie}),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($,[2,312]),{105:233,112:XE,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(re,[2,318]),n($,JE,{108:240,133:242,112:ZE,132:e2}),n(Ye,[2,323]),{112:[1,244]},{112:[2,325]},n(Pr,[2,50]),n(B,Td,{135:245,136:246,143:247,144:248,31:t2,112:t2}),n(Pr,[2,51]),n(Pr,[2,52]),n(Sa,[2,328],{119:249}),{29:st,114:250},n(Sa,[2,56]),{29:st,114:251},n(y,[2,59]),n(Ke,[2,270]),{47:[1,252]},n(r2,[2,150]),n(Ad,[2,428],{240:253}),n(uc,[2,430],{244:254}),n(uc,[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(fc,[2,440],{252:264}),n(gr,[2,448],{260:265}),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(gr,[2,167]),n(gr,[2,168]),n(gr,[2,169]),n(gr,[2,170],{176:269,45:n2,89:i2}),n(gr,[2,171]),n(gr,[2,172]),n(gr,[2,173]),n(gr,[2,174]),{13:f,16:d,44:136,45:se,46:272,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Jt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:s2,89:a2,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(sn,[2,192],{292:[1,286],293:[1,287]}),n(sn,[2,195]),n(sn,[2,196]),n(sn,[2,197]),n(sn,[2,198]),n(sn,[2,199]),n(sn,[2,200]),{13:f,16:d,44:39,55:40,82:U,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(yu,[2,452]),n(yu,[2,453]),n(yu,[2,454]),n(yu,[2,455]),n(yu,[2,456]),{279:[2,458]},n(xd,[2,207]),n(xd,[2,208]),n(xd,[2,209]),n(xd,[2,210]),n(sn,[2,201]),n(sn,[2,202]),n(sn,[2,203]),n(sn,[2,204]),n(sn,[2,205]),n(sn,[2,206]),n(e,[2,5]),n(Cd,[2,297],{88:295}),n(Id,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(Rd,[2,301]),n(Z,[2,43]),n(Z,[2,82]),n(Z,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(oo,[2,123]),n(oo,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(Ji,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:_t,223:312,225:308,226:309,229:o2,307:43,308:p},n(c,i,{215:10,214:314}),n(Ji,[2,236]),n(Ji,[2,237]),n(dc,[2,6]),n(by,[2,287],{60:315,72:316,73:[1,317]}),n(Ct,[2,286]),{13:f,16:d,45:se,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,307:43,308:p,346:He,347:je,348:w,349:T,350:x,351:O},n([6,31,63,70,73,81,83,85],[2,20]),n(B,c2,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Os,31:Os,85:Os,112:Os,159:Os,160:Os,161:Os,163:Os,164:Os,41:s}),{13:f,16:d,55:331,307:43,308:p},n($,[2,280]),n(dc,[2,7]),n(Ct,De,{59:197,69:198,20:332,70:q}),n(Q,[2,284]),{64:[1,333]},n(Q,K,{58:205,62:206,23:334,63:Ie}),n(l,[2,254]),n(B,Td,{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:co,307:43,308:p},n(_u,[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:co,308:p}),n(Fs,[2,227]),n(Fs,[2,228]),n(Fs,[2,229]),{13:f,16:d,44:215,45:tt,55:220,82:U,87:h,89:rt,172:221,185:351,187:350,200:348,230:347,231:Rr,234:349,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:co,307:43,308:p},n(Fs,[2,146]),n(Fs,[2,147]),n(Fs,[2,148]),n(Fs,[2,149]),{13:f,16:d,44:354,55:355,82:U,87:h,172:357,237:356,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:358,312:nn,313:353},n(wy,[2,215]),n(wy,[2,216]),n(Q,K,{58:205,62:206,23:359,63:Ie}),n(te,[2,264]),n(KE,[2,266]),n(dc,[2,11]),n(r,[2,308],{6:[2,310]}),n(Pr,[2,313],{102:360,120:361,121:[1,362]}),n(Pr,[2,47]),n(Pr,[2,63]),n(Pr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(Pr,[2,336]),n(Pr,[2,337]),n(Pr,[2,338]),{109:[1,364]},n(l2,[2,60]),{13:f,16:d,55:365,307:43,308:p},n($,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(lo,[2,341],{137:368}),n(lo,[2,340]),{13:f,16:d,44:215,45:tt,55:220,82:U,87:h,89:rt,145:369,172:221,185:213,187:214,231:Rr,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},{28:[1,370],127:371,128:[1,372]},n(Sa,[2,330],{124:373,125:374,126:Ot}),n(Sa,[2,57]),{44:375,87:h},n(r2,[2,151],{241:376,242:[1,377]}),n(Ad,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{250:[1,381]},n(Zt,[2,432]),n(Zt,[2,433]),n(Zt,[2,434]),n(Zt,[2,435]),n(Zt,[2,436]),n(Zt,[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:de,298:he,299:pe,300:le,301:ye,302:_e}),n(fc,[2,162],{261:388,262:389,39:Ey,338:Ty}),n(gr,[2,164]),n(gr,[2,165]),n(gr,[2,166]),n(Jt,[2,95]),n(Jt,[2,96]),n(Zt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Jt,[2,177]),{13:f,16:d,44:136,45:se,46:395,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:396,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:397,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:398,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:399,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Jt,[2,183]),n(Jt,[2,98]),n(Zt,[2,381],{180:400}),{87:[1,401]},n(Jt,[2,185]),{13:f,16:d,44:136,45:se,46:402,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{29:W,57:403},n(sn,[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:co,307:43,308:p},n(va,[2,233]),n(va,[2,234]),n(va,[2,235]),n(u2,[2,459],{281:406,325:[1,407]}),n(Zt,[2,463],{284:408,325:[1,409]}),n(Zt,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:U,171:413,172:415,173:416,174:Pd,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Od},{31:[1,419],89:[1,420]},{29:[1,421]},n(Rd,[2,302]),n(Cd,[2,367],{167:422}),n(Id,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(Rd,[2,371]),n(oo,[2,122]),n(oo,[2,417]),n(oo,[2,413]),n(oo,[2,414]),n(oo,[2,415]),n(Ji,[2,125]),n(Ji,[2,127]),n(Ji,[2,128]),n(f2,[2,420],{227:426}),n(Ji,[2,130]),{13:f,16:d,55:194,197:_t,223:427,307:43,308:p},{48:[1,428]},n(ba,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(by,[2,288]),{64:[1,433]},n(Ct,[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:se,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,276:Ge,277:Ce,279:Ve,280:Pe,283:Be,285:ze,308:p,346:He,347:je,348:w,349:T,350:x,351:O}),n(d2,[2,293]),n(Ay,[2,92]),n(Ay,[2,93]),n(Ay,[2,94]),{45:n2,89:i2,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:A,29:I,56:85},{19:438,28:A,29:I,56:85},n(uo,[2,355],{149:439}),n(uo,[2,354]),{13:f,16:d,44:215,45:Fd,55:220,82:U,87:h,89:rt,156:440,172:221,185:441,203:442,231:Dd,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},n(te,[2,19]),n(ba,[2,21]),{13:f,16:d,44:450,45:h2,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,307:43,308:p,346:He,347:je,348:w,349:T,350:x,351:O},n(dc,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(B,[2,386],{31:[2,388]}),n(_u,[2,102]),n(fo,[2,391],{191:452}),n(B,[2,395],{196:453,198:454}),n(B,[2,108]),n(B,[2,109]),n(_u,[2,103]),n(_u,[2,104]),n(_u,[2,390]),{13:f,16:d,44:215,45:tt,48:[1,455],55:220,82:U,87:h,89:rt,172:221,185:351,187:350,200:456,231:Rr,234:349,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},n(Nd,[2,424]),n(p2,[2,136]),n(p2,[2,137]),n(xy,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:co,307:43,308:p},n(va,[2,219]),n(va,[2,220]),n(va,[2,221]),n(va,[2,222]),n(va,[2,223]),n(dc,[2,10]),n(Pr,[2,46]),n(Pr,[2,314]),{112:XE,122:459},n(Pr,[2,62]),n($,JE,{133:242,108:460,112:ZE,132:e2}),n(l2,[2,61]),n(Pr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(lo,[2,351],{146:463,335:[1,464]}),{29:W,57:465},n(Sa,[2,329]),n($,[2,332],{129:466,327:[1,467]}),n(Sa,[2,55]),n(Sa,[2,331]),{48:[1,468]},n(Ad,[2,429]),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(uc,[2,431]),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(uc,[2,156]),{45:s2,89:a2,179:471},n(fc,[2,441]),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(gr,[2,444],{256:473}),n(gr,[2,446],{258:474}),n(Zt,[2,442]),n(Zt,[2,443]),n(gr,[2,449]),{13:f,16:d,44:136,45:se,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Zt,[2,450]),n(Zt,[2,451]),n(Zt,[2,379],{178:476}),n(Zt,[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:se,46:482,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{48:[1,483]},{48:[1,484]},n(Jt,[2,187]),n(sn,[2,194]),{13:f,16:d,44:39,55:40,82:U,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,320:485},{13:f,16:d,39:[1,487],44:136,45:se,46:488,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,282:486,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(u2,[2,460]),{13:f,16:d,44:136,45:se,46:489,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Zt,[2,464]),{13:f,16:d,44:136,45:se,46:490,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Zt,[2,466]),n(Z,[2,40]),n(Cd,[2,298]),n(Su,[2,87]),n(Su,[2,88]),n(Su,[2,89]),n(Su,[2,90]),{13:f,16:d,55:492,82:U,172:493,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,311:494,312:nn,315:491},n(Z,[2,41]),n(Id,[2,300]),n(vu,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:U,171:497,172:415,173:416,174:Pd,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Od},{31:[1,498],89:[1,499]},{29:[1,500]},n(Rd,[2,372]),{13:f,16:d,48:[2,422],55:194,197:_t,223:312,226:502,228:501,229:o2,307:43,308:p},n(Ji,[2,131]),n(Ji,[2,126]),n(ba,[2,22]),n(ba,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:se,55:323,67:321,68:322,74:505,75:506,76:m2,77:320,78:g2,79:509,87:h,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,307:43,308:p,346:He,347:je,348:w,349:T,350:x,351:O},n(d2,[2,294]),n(y2,[2,69]),n(y2,[2,70]),n(Ct,De,{59:197,69:198,20:511,70:q}),n(Q,K,{58:205,62:206,23:512,63:Ie}),{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(uo,[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(Ld,[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:Fd,55:220,82:U,87:h,89:rt,172:221,185:351,203:536,212:534,231:Dd,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},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:h2,87:h,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,276:Ge,277:Ce,279:Ve,280:Pe,283:Be,285:ze,308:p,346:He,347:je,348:w,349:T,350:x,351:O}),n(ho,[2,291]),n(ho,[2,24]),n(ho,[2,25]),{13:f,16:d,44:136,45:se,46:539,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(ho,[2,28]),n(Q,K,{58:205,62:206,23:540,63:Ie}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(fo,[2,107]),{13:f,16:d,44:215,45:tt,55:220,82:U,87:h,89:rt,172:221,185:351,187:350,199:543,200:544,231:Rr,234:349,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},n(_2,[2,132]),n(Nd,[2,425]),n(_2,[2,133]),{13:f,16:d,44:354,55:355,82:U,87:h,172:357,237:356,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:358,312:nn,313:545},n(Pr,[2,54]),n(Pr,[2,48]),n(lo,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(lo,[2,68]),n(B,[2,350],{31:S2,112:S2}),n(Pr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n($,[2,333]),n(Ke,[2,16]),n(Ad,[2,152]),n(uc,[2,154]),n(uc,[2,157]),n(fc,[2,159]),n(fc,[2,160],{262:389,261:548,39:Ey,338:Ty}),n(fc,[2,161],{262:389,261:549,39:Ey,338:Ty}),n(gr,[2,163]),{13:f,16:d,44:136,45:se,46:550,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Jt,[2,178]),n(Jt,[2,179]),{13:f,16:d,44:136,45:se,46:551,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:552,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:553,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{48:[1,554],272:[1,555]},n(Jt,[2,184]),n(Jt,[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(Cy,[2,224]),n(Cy,[2,225]),n(Cy,[2,226]),{31:[1,563],45:v2,94:564},n(Z,[2,84]),n(Cd,[2,368]),n(Z,[2,85]),n(Id,[2,370]),n(vu,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(ba,[2,35],{83:[1,569]}),n(ba,[2,36],{81:[1,570]}),n(by,[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:se,76:m2,78:g2,87:h,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,276:Ge,277:Ce,279:Ve,280:Pe,283:Be,285:ze,308:p,346:He,347:je,348:w,349:T,350:x,351:O}),n(hc,[2,295]),{45:se,77:572},{45:se,77:573},n(hc,[2,33]),n(hc,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(uo,[2,356]),n(b2,[2,357],{152:578,335:[1,579]}),n(Ds,[2,74]),{29:W,57:580},{29:W,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(w2,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:se,55:323,67:321,68:322,77:320,79:585,267:139,268:Re,269:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,307:43,308:p,346:He,347:je,348:w,349:T,350:x,351:O},{45:[1,586]},n(Ds,[2,81]),{29:W,57:587},n(uo,[2,73]),n(B,[2,362],{29:Ns,31:Ns,85:Ns,112:Ns,159:Ns,160:Ns,161:Ns,163:Ns,164:Ns}),n(Ld,[2,112]),n(pc,[2,401],{206:588}),n(B,[2,405],{209:589,210:590}),n(B,[2,403]),n(B,[2,404]),n(Ld,[2,113]),n(Ld,[2,400]),{13:f,16:d,44:215,45:Fd,48:[1,591],55:220,82:U,87:h,89:rt,172:221,185:351,203:536,212:592,231:Dd,234:535,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},n(Nd,[2,426]),n(xy,[2,138]),n(xy,[2,139]),{232:[1,593]},n(ho,[2,292]),{47:[1,595],48:[1,594]},n(dc,[2,9]),n(fo,[2,392]),n(fo,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:co,308:p}),n(fo,[2,110],{272:[1,598]}),n(kd,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(Sa,[2,58]),n(gr,[2,445]),n(gr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Jt,[2,99]),n(Zt,[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(Jt,[2,188]),n(Jt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:U,172:493,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,311:494,312:nn,315:611},n(Z,[2,42]),n(vu,[2,304]),{13:f,16:d,55:414,82:U,95:612,171:613,172:415,173:416,174:Pd,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Od},{31:[1,614],45:v2,94:615},n(Ji,[2,129]),n(f2,[2,421]),{82:[1,616]},{82:[1,617]},n(hc,[2,296]),n(hc,[2,31]),n(hc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(B,c2,{155:330,153:618,154:619,29:Ls,31:Ls,85:Ls,112:Ls,159:Ls,160:Ls,161:Ls,163:Ls,164:Ls}),n(b2,[2,358]),n(Ds,[2,75]),n(Ds,[2,76]),{29:W,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(w2,[2,366]),n(Ds,[2,79]),{13:f,16:d,44:136,45:se,46:622,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Ds,[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(pc,[2,117]),{13:f,16:d,44:215,45:Fd,55:220,82:U,87:h,89:rt,172:221,185:351,203:536,211:626,212:627,231:Dd,234:535,236:216,237:222,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,309:vn,310:Ln,311:217,312:nn},n(Fs,[2,134]),n(Nd,[2,427]),n(Fs,[2,135]),n(ho,[2,26]),{44:628,87:h},n(fo,[2,106]),n(fo,[2,394]),n(B,[2,396]),n(kd,[2,111]),n(kd,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:co,307:43,308:p},n(wy,[2,217]),n(B,Td,{144:248,140:630,143:631,31:[2,343]}),n(Jt,[2,97]),n(Zt,[2,380]),n(Jt,[2,180]),{13:f,16:d,44:136,45:se,46:632,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},{13:f,16:d,44:136,45:se,46:633,55:133,67:132,68:134,77:131,82:U,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:Ue,270:ne,271:qe,273:We,274:$e,275:146,276:Ge,277:Ce,278:149,279:Ve,280:Pe,283:Be,285:ze,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Ze,346:He,347:je,348:w,349:T,350:x,351:O},n(Jt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:U,171:637,172:415,173:416,174:Pd,255:154,257:155,291:150,294:fe,295:me,296:ge,297:de,298:he,299:pe,300:le,301:ye,302:_e,303:Se,304:ve,305:oe,306:be,307:43,308:p,312:Od},n(E2,[2,305]),n(Z,[2,86]),n(vu,[2,374]),n(ba,[2,37]),n(ba,[2,38]),n(uo,[2,72]),n(uo,[2,360]),n(Ds,[2,77]),{29:W,57:638},{47:[1,639]},{29:[2,376]},n(pc,[2,402]),n(pc,[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(pc,[2,118],{272:[1,641]}),n(Md,[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:Se,304:ve,305:oe,306:be},n(Su,[2,218]),n(vu,[2,44]),n(E2,[2,306]),n(Ds,[2,78]),{44:651,87:h},n(pc,[2,116]),n(B,[2,406]),n(Md,[2,119]),n(Md,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(ho,[2,27]),n(kd,[2,230]),n(T2,[2,345],{141:653,335:[1,654]}),n(Jt,[2,181]),n(Jt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(B,Td,{144:248,142:657,143:658,31:A2,112:A2}),n(T2,[2,346]),n(Ds,[2,80]),n(Md,[2,231]),n(lo,[2,67]),n(lo,[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,P){if(P.recoverable)this.trace(C);else{var N=new Error(C);throw N.hash=P,N}},"parseError"),parse:o(function(C){var P=this,N=[0],ie=[],Oe=[null],g=[],on=this.table,_="",ts=0,Tu=0,Bd=0,Ud=2,Au=1,qd=g.slice.call(arguments,1),Bt=Object.create(this.lexer),rs={yy:{}};for(var xu in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xu)&&(rs.yy[xu]=this.yy[xu]);Bt.setInput(C,rs.yy),rs.yy.lexer=Bt,rs.yy.parser=this,typeof Bt.yylloc>"u"&&(Bt.yylloc={});var Sc=Bt.yylloc;g.push(Sc);var St=Bt.options&&Bt.options.ranges;typeof rs.yy.parseError=="function"?this.parseError=rs.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function jt(ns){N.length=N.length-2*ns,Oe.length=Oe.length-ns,g.length=g.length-ns}o(jt,"popStack");for(var nt=o(function(){var ns;return ns=Bt.lex()||Au,typeof ns!="number"&&(ns=P.symbols_[ns]||ns),ns},"lex"),ut,bn,yo,Gn,AX,Vy,vc={},Wd,js,M2,Gd;;){if(yo=N[N.length-1],this.defaultActions[yo]?Gn=this.defaultActions[yo]:((ut===null||typeof ut>"u")&&(ut=nt()),Gn=on[yo]&&on[yo][ut]),typeof Gn>"u"||!Gn.length||!Gn[0]){var By="";Gd=[];for(Wd in on[yo])this.terminals_[Wd]&&Wd>Ud&&Gd.push("'"+this.terminals_[Wd]+"'");Bt.showPosition?By="Parse error on line "+(ts+1)+`:
34
34
  `+Bt.showPosition()+`
35
- Expecting `+Gd.join(", ")+", got '"+(this.terminals_[ut]||ut)+"'":By="Parse error on line "+(ts+1)+": Unexpected "+(ut==Au?"end of input":"'"+(this.terminals_[ut]||ut)+"'"),this.parseError(By,{text:Bt.match,token:this.terminals_[ut]||ut,line:Bt.yylineno,loc:Sc,expected:Gd})}if(Gn[0]instanceof Array&&Gn.length>1)throw new Error("Parse Error: multiple actions possible at state: "+go+", token: "+ut);switch(Gn[0]){case 1:N.push(ut),Oe.push(Bt.yytext),g.push(Bt.yylloc),N.push(Gn[1]),ut=null,bn?(ut=bn,bn=null):(Tu=Bt.yyleng,_=Bt.yytext,ts=Bt.yylineno,Sc=Bt.yylloc,Bd>0&&Bd--);break;case 2:if(js=this.productions_[Gn[1]][1],vc.$=Oe[Oe.length-js],vc._$={first_line:g[g.length-(js||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(js||1)].first_column,last_column:g[g.length-1].last_column},St&&(vc._$.range=[g[g.length-(js||1)].range[0],g[g.length-1].range[1]]),Vy=this.performAction.apply(vc,[_,Tu,ts,rs.yy,Gn[1],Oe,g].concat(qd)),typeof Vy<"u")return Vy;js&&(N=N.slice(0,-1*js*2),Oe=Oe.slice(0,-1*js),g=g.slice(0,-1*js)),N.push(this.productions_[Gn[1]][0]),Oe.push(vc.$),g.push(vc._$),M2=an[N[N.length-2]][N[N.length-1]],N.push(M2);break;case 3:return!0}}return!0},"parse")},jd=F_().Wildcard,$d="http://www.w3.org/1999/02/22-rdf-syntax-ns#",pN=$d+"type",mN=$d+"first",gN=$d+"rest",x2=$d+"nil",Vd="http://www.w3.org/2001/XMLSchema#",C2=Vd+"integer",I2=Vd+"decimal",R2=Vd+"double",yN=Vd+"boolean",ho="",P2="",O2="";function sn(R){return R.toLowerCase()}o(sn,"lowercase");function ks(R,C){return R.push(C),R}o(ks,"appendTo");function po(R,C){return R.push.apply(R,C),R}o(po,"appendAllTo");function Ht(R){R||(R={});for(var C=1,P=arguments.length,N;C<P&&(N=arguments[C]||{});C++)for(var ie in N)R[ie]=N[ie];return R}o(Ht,"extend");function Zi(){for(var R=[],C=0,P=arguments.length;C<P;C++)R=R.concat.apply(R,arguments[C]);return R}o(Zi,"unionAll");function bu(R){if(R[0]==="<"&&(R=R.substring(1,R.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(R))return R;if(!ke.base)throw new Error("Cannot resolve relative IRI "+R+" because no base IRI was set.");switch(ho!==ke.base&&(ho=ke.base,P2=ho.replace(/[^\/:]*$/,""),O2=ho.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),R[0]){case void 0:return ho;case"#":return ho+R;case"?":return ho.replace(/(?:\?.*)?$/,R);case"/":return O2+R;default:return P2+R}}o(bu,"resolveIRI");function Ry(R){if(R){var C=R[0];if(C==="?"||C==="$")return ke.factory.variable(R.substr(1))}return R}o(Ry,"toVar");function Or(R,C){return{type:"operation",operator:R,args:C||[]}}o(Or,"operation");function mc(R,C){var P={expression:R==="*"?new jd:R};if(C)for(var N in C)P[N]=C[N];return P}o(mc,"expression");function gc(R,C){return{type:"path",pathType:R,items:C}}o(gc,"path");function Py(R,C){for(var P=0,N=C.length,ie;P<N&&(ie=C[P]);P++)R=Or(ie[0],[R,ie[1]]);return R}o(Py,"createOperationTree");function mo(R,C){var P=[],N=[],ie=R.length,Oe,g={};if(!ie)return null;for(var an=0;an<ie&&(Oe=R[an]);an++)(Oe.named?N:P).push(Oe.iri);return g[C||"from"]={default:P,named:N},g}o(mo,"groupDatasets");function yc(R){return parseInt(R,10)}o(yc,"toInt");function Oy(R){return R.type==="group"&&R.patterns.length===1?R.patterns[0]:R}o(Oy,"degroupSingle");function es(R,C){return C&&C.termType!=="NamedNode"&&(C=ke.factory.namedNode(C)),ke.factory.literal(R,C)}o(es,"createTypedLiteral");function _N(R,C){return ke.factory.literal(R,C)}o(_N,"createLangLiteral");function Fy(R,C,P){if(!("termType"in C))throw new Error("Nested triples cannot contain paths");return ke.factory.quad(R,C,P)}o(Fy,"nestedTriple");function Ms(R,C,P,N){var ie={};return R!=null&&(ie.subject=R),C!=null&&(ie.predicate=C),P!=null&&(ie.object=P),N!=null&&(ie.annotations=N),ie}o(Ms,"triple");function wu(R){return typeof R=="string"?R.startsWith("e_")?ke.factory.blankNode(R):ke.factory.blankNode("e_"+R):ke.factory.blankNode("g_"+F2++)}o(wu,"blank");var F2=0;ke._resetBlanks=function(){F2=0};var SN=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,vN={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
36
- `,r:"\r",f:"\f"},bN=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,Dy=String.fromCharCode;function D2(R,C){R=R.substring(C,R.length-C);try{R=R.replace(SN,function(P,N,ie,Oe){var g;if(N){if(g=parseInt(N,16),isNaN(g))throw new Error;return Dy(g)}else if(ie){if(g=parseInt(ie,16),isNaN(g))throw new Error;return g<65535?Dy(g):Dy(55296+((g-=65536)>>10),56320+(g&1023))}else{var an=vN[Oe];if(!an)throw new Error;return an}})}catch{return""}if(bN.exec(R))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+R);return R}o(D2,"unescapeString");function wN(R){var C=wu(),P=C,N=[],ie,Oe=[];R.forEach(function(ts){N.push(ts.entity),po(Oe,ts.triples)});for(var g=0,an=0,_=N.length,ie=Array(_*2);g<_;)ie[an++]=Ms(P,ke.factory.namedNode(mN),N[g]),ie[an++]=Ms(P,ke.factory.namedNode(gN),P=++g<_?wu():ke.factory.namedNode(x2));return{entity:C,triples:po(ie,Oe)}}o(wN,"createList");function EN(R){var C=wu();return{entity:C,triples:R.map(function(P){return Ht(Ms(C),P)})}}o(EN,"createAnonymousObject");function Ny(R,C,P){var N=[],ie=[];return C.forEach(function(Oe){let g=null;Oe.annotation&&(g=Oe.annotation,Oe=Oe.object),N.push(Ms(null,R,Oe.entity,g)),po(ie,Oe.triples)}),Zi(N,P||[],ie)}o(Ny,"objectListToTriples");function EX(R){for(var C=[],P,N=0,ie;ie=R[N];N++)switch(ie.type){case"bgp":ie.triples.length&&(P?po(P.triples,ie.triples):ks(C,P=ie));break;default:(!ie.patterns||ie.patterns.length>0)&&(ks(C,ie),P=null)}return C}o(EX,"mergeAdjacentBGPs");function _c(R){return R.variable?R.variable.value:R.value||R.expression.value}o(_c,"getExpressionId");function Ly(R){if(!R)return[];if(R.type==="aggregate")return[R];if(R.type==="operation"){let C=[];for(let P of R.args)C.push(...Ly(P));return C}return[]}o(Ly,"getAggregatesOfExpression");function TN(R){let C=new Set,P=o(function(N){N&&(N.termType==="Variable"?C.add(N):N.type==="operation"&&N.args.forEach(P))},"visitExpression");return P(R),C}o(TN,"getVariablesFromExpression");function ky(R,C=1,P=[]){for(let N of R)C>0&&N instanceof Array?ky(N,C-1,P):P.push(N);return P}o(ky,"flatten");function My(R){return R.termType==="Variable"}o(My,"isVariable");function N2(R){if(R.triples){let C=[];for(let P of R.triples)My(P.subject)&&C.push(P.subject.value),My(P.predicate)&&C.push(P.predicate.value),My(P.object)&&C.push(P.object.value);return C}else if(R.patterns){let C=[];for(let P of R.patterns)C.push(...N2(P));return C}return[]}o(N2,"getBoundVarsFromGroupGraphPattern");function AN(R){let C=R.slice().sort(),P=[];for(let N=0;N<C.length-1;N++)C[N+1]==C[N]&&P.push(C[N]);return P}o(AN,"getDuplicatesInArray");function Eu(R){if(!ke.sparqlStar)throw new Error("SPARQL-star support is not enabled");return R}o(Eu,"ensureSparqlStar");function L2(R,C,P){for(let N of C){let ie=Ms("subject"in N?N.subject:R,N.predicate,N.object);P.push(ie),N.annotations&&L2(Fy(R,N.predicate,N.object),N.annotations,P)}}o(L2,"_applyAnnotations");function jy(R){if(ke.sparqlStar){let C=[];return R.forEach(P=>{let N=Ms(P.subject,P.predicate,P.object);C.push(N),P.annotations&&L2(Fy(P.subject,P.predicate,P.object),P.annotations,C)}),C}return R}o(jy,"applyAnnotations");function TX(R){if(!ke.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return R}o(TX,"ensureSparqlStarNestedQuads");function k2(R){for(let C of R){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 P of C.triples)if(P.subject.termType==="Variable"||P.predicate.termType==="Variable"||P.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return R}o(k2,"ensureNoVariables");function $y(R){for(let C of R)if(C.type==="bgp"){for(let P of C.triples)if(P.subject.termType==="BlankNode"||P.predicate.termType==="BlankNode"||P.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return R}o($y,"ensureNoBnodes");var xN=(function(){var R={EOF:1,parseError:o(function(P,N){if(this.yy.parser)this.yy.parser.parseError(P,N);else throw new Error(P)},"parseError"),setInput:o(function(C,P){return this.yy=P||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 P=C.match(/(?:\r\n?|\n).*/g);return P?(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 P=C.length,N=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-P),this.offset-=P;var ie=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 Oe=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===ie.length?this.yylloc.first_column:0)+ie[ie.length-N.length].length-N[0].length:this.yylloc.first_column-P},this.options.ranges&&(this.yylloc.range=[Oe[0],Oe[0]+this.yyleng-P]),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).
35
+ Expecting `+Gd.join(", ")+", got '"+(this.terminals_[ut]||ut)+"'":By="Parse error on line "+(ts+1)+": Unexpected "+(ut==Au?"end of input":"'"+(this.terminals_[ut]||ut)+"'"),this.parseError(By,{text:Bt.match,token:this.terminals_[ut]||ut,line:Bt.yylineno,loc:Sc,expected:Gd})}if(Gn[0]instanceof Array&&Gn.length>1)throw new Error("Parse Error: multiple actions possible at state: "+yo+", token: "+ut);switch(Gn[0]){case 1:N.push(ut),Oe.push(Bt.yytext),g.push(Bt.yylloc),N.push(Gn[1]),ut=null,bn?(ut=bn,bn=null):(Tu=Bt.yyleng,_=Bt.yytext,ts=Bt.yylineno,Sc=Bt.yylloc,Bd>0&&Bd--);break;case 2:if(js=this.productions_[Gn[1]][1],vc.$=Oe[Oe.length-js],vc._$={first_line:g[g.length-(js||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(js||1)].first_column,last_column:g[g.length-1].last_column},St&&(vc._$.range=[g[g.length-(js||1)].range[0],g[g.length-1].range[1]]),Vy=this.performAction.apply(vc,[_,Tu,ts,rs.yy,Gn[1],Oe,g].concat(qd)),typeof Vy<"u")return Vy;js&&(N=N.slice(0,-1*js*2),Oe=Oe.slice(0,-1*js),g=g.slice(0,-1*js)),N.push(this.productions_[Gn[1]][0]),Oe.push(vc.$),g.push(vc._$),M2=on[N[N.length-2]][N[N.length-1]],N.push(M2);break;case 3:return!0}}return!0},"parse")},jd=F_().Wildcard,$d="http://www.w3.org/1999/02/22-rdf-syntax-ns#",pN=$d+"type",mN=$d+"first",gN=$d+"rest",x2=$d+"nil",Vd="http://www.w3.org/2001/XMLSchema#",C2=Vd+"integer",I2=Vd+"decimal",R2=Vd+"double",yN=Vd+"boolean",po="",P2="",O2="";function an(R){return R.toLowerCase()}o(an,"lowercase");function ks(R,C){return R.push(C),R}o(ks,"appendTo");function mo(R,C){return R.push.apply(R,C),R}o(mo,"appendAllTo");function Qt(R){R||(R={});for(var C=1,P=arguments.length,N;C<P&&(N=arguments[C]||{});C++)for(var ie in N)R[ie]=N[ie];return R}o(Qt,"extend");function Zi(){for(var R=[],C=0,P=arguments.length;C<P;C++)R=R.concat.apply(R,arguments[C]);return R}o(Zi,"unionAll");function bu(R){if(R[0]==="<"&&(R=R.substring(1,R.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(R))return R;if(!ke.base)throw new Error("Cannot resolve relative IRI "+R+" because no base IRI was set.");switch(po!==ke.base&&(po=ke.base,P2=po.replace(/[^\/:]*$/,""),O2=po.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),R[0]){case void 0:return po;case"#":return po+R;case"?":return po.replace(/(?:\?.*)?$/,R);case"/":return O2+R;default:return P2+R}}o(bu,"resolveIRI");function Ry(R){if(R){var C=R[0];if(C==="?"||C==="$")return ke.factory.variable(R.substr(1))}return R}o(Ry,"toVar");function Or(R,C){return{type:"operation",operator:R,args:C||[]}}o(Or,"operation");function mc(R,C){var P={expression:R==="*"?new jd:R};if(C)for(var N in C)P[N]=C[N];return P}o(mc,"expression");function gc(R,C){return{type:"path",pathType:R,items:C}}o(gc,"path");function Py(R,C){for(var P=0,N=C.length,ie;P<N&&(ie=C[P]);P++)R=Or(ie[0],[R,ie[1]]);return R}o(Py,"createOperationTree");function go(R,C){var P=[],N=[],ie=R.length,Oe,g={};if(!ie)return null;for(var on=0;on<ie&&(Oe=R[on]);on++)(Oe.named?N:P).push(Oe.iri);return g[C||"from"]={default:P,named:N},g}o(go,"groupDatasets");function yc(R){return parseInt(R,10)}o(yc,"toInt");function Oy(R){return R.type==="group"&&R.patterns.length===1?R.patterns[0]:R}o(Oy,"degroupSingle");function es(R,C){return C&&C.termType!=="NamedNode"&&(C=ke.factory.namedNode(C)),ke.factory.literal(R,C)}o(es,"createTypedLiteral");function _N(R,C){return ke.factory.literal(R,C)}o(_N,"createLangLiteral");function Fy(R,C,P){if(!("termType"in C))throw new Error("Nested triples cannot contain paths");return ke.factory.quad(R,C,P)}o(Fy,"nestedTriple");function Ms(R,C,P,N){var ie={};return R!=null&&(ie.subject=R),C!=null&&(ie.predicate=C),P!=null&&(ie.object=P),N!=null&&(ie.annotations=N),ie}o(Ms,"triple");function wu(R){return typeof R=="string"?R.startsWith("e_")?ke.factory.blankNode(R):ke.factory.blankNode("e_"+R):ke.factory.blankNode("g_"+F2++)}o(wu,"blank");var F2=0;ke._resetBlanks=function(){F2=0};var SN=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,vN={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
36
+ `,r:"\r",f:"\f"},bN=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,Dy=String.fromCharCode;function D2(R,C){R=R.substring(C,R.length-C);try{R=R.replace(SN,function(P,N,ie,Oe){var g;if(N){if(g=parseInt(N,16),isNaN(g))throw new Error;return Dy(g)}else if(ie){if(g=parseInt(ie,16),isNaN(g))throw new Error;return g<65535?Dy(g):Dy(55296+((g-=65536)>>10),56320+(g&1023))}else{var on=vN[Oe];if(!on)throw new Error;return on}})}catch{return""}if(bN.exec(R))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+R);return R}o(D2,"unescapeString");function wN(R){var C=wu(),P=C,N=[],ie,Oe=[];R.forEach(function(ts){N.push(ts.entity),mo(Oe,ts.triples)});for(var g=0,on=0,_=N.length,ie=Array(_*2);g<_;)ie[on++]=Ms(P,ke.factory.namedNode(mN),N[g]),ie[on++]=Ms(P,ke.factory.namedNode(gN),P=++g<_?wu():ke.factory.namedNode(x2));return{entity:C,triples:mo(ie,Oe)}}o(wN,"createList");function EN(R){var C=wu();return{entity:C,triples:R.map(function(P){return Qt(Ms(C),P)})}}o(EN,"createAnonymousObject");function Ny(R,C,P){var N=[],ie=[];return C.forEach(function(Oe){let g=null;Oe.annotation&&(g=Oe.annotation,Oe=Oe.object),N.push(Ms(null,R,Oe.entity,g)),mo(ie,Oe.triples)}),Zi(N,P||[],ie)}o(Ny,"objectListToTriples");function EX(R){for(var C=[],P,N=0,ie;ie=R[N];N++)switch(ie.type){case"bgp":ie.triples.length&&(P?mo(P.triples,ie.triples):ks(C,P=ie));break;default:(!ie.patterns||ie.patterns.length>0)&&(ks(C,ie),P=null)}return C}o(EX,"mergeAdjacentBGPs");function _c(R){return R.variable?R.variable.value:R.value||R.expression.value}o(_c,"getExpressionId");function Ly(R){if(!R)return[];if(R.type==="aggregate")return[R];if(R.type==="operation"){let C=[];for(let P of R.args)C.push(...Ly(P));return C}return[]}o(Ly,"getAggregatesOfExpression");function TN(R){let C=new Set,P=o(function(N){N&&(N.termType==="Variable"?C.add(N):N.type==="operation"&&N.args.forEach(P))},"visitExpression");return P(R),C}o(TN,"getVariablesFromExpression");function ky(R,C=1,P=[]){for(let N of R)C>0&&N instanceof Array?ky(N,C-1,P):P.push(N);return P}o(ky,"flatten");function My(R){return R.termType==="Variable"}o(My,"isVariable");function N2(R){if(R.triples){let C=[];for(let P of R.triples)My(P.subject)&&C.push(P.subject.value),My(P.predicate)&&C.push(P.predicate.value),My(P.object)&&C.push(P.object.value);return C}else if(R.patterns){let C=[];for(let P of R.patterns)C.push(...N2(P));return C}return[]}o(N2,"getBoundVarsFromGroupGraphPattern");function AN(R){let C=R.slice().sort(),P=[];for(let N=0;N<C.length-1;N++)C[N+1]==C[N]&&P.push(C[N]);return P}o(AN,"getDuplicatesInArray");function Eu(R){if(!ke.sparqlStar)throw new Error("SPARQL-star support is not enabled");return R}o(Eu,"ensureSparqlStar");function L2(R,C,P){for(let N of C){let ie=Ms("subject"in N?N.subject:R,N.predicate,N.object);P.push(ie),N.annotations&&L2(Fy(R,N.predicate,N.object),N.annotations,P)}}o(L2,"_applyAnnotations");function jy(R){if(ke.sparqlStar){let C=[];return R.forEach(P=>{let N=Ms(P.subject,P.predicate,P.object);C.push(N),P.annotations&&L2(Fy(P.subject,P.predicate,P.object),P.annotations,C)}),C}return R}o(jy,"applyAnnotations");function TX(R){if(!ke.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return R}o(TX,"ensureSparqlStarNestedQuads");function k2(R){for(let C of R){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 P of C.triples)if(P.subject.termType==="Variable"||P.predicate.termType==="Variable"||P.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return R}o(k2,"ensureNoVariables");function $y(R){for(let C of R)if(C.type==="bgp"){for(let P of C.triples)if(P.subject.termType==="BlankNode"||P.predicate.termType==="BlankNode"||P.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return R}o($y,"ensureNoBnodes");var xN=(function(){var R={EOF:1,parseError:o(function(P,N){if(this.yy.parser)this.yy.parser.parseError(P,N);else throw new Error(P)},"parseError"),setInput:o(function(C,P){return this.yy=P||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 P=C.match(/(?:\r\n?|\n).*/g);return P?(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 P=C.length,N=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-P),this.offset-=P;var ie=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 Oe=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===ie.length?this.yylloc.first_column:0)+ie[ie.length-N.length].length-N[0].length:this.yylloc.first_column-P},this.options.ranges&&(this.yylloc.range=[Oe[0],Oe[0]+this.yyleng-P]),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(),P=new Array(C.length+1).join("-");return C+this.upcomingInput()+`
38
38
  `+P+"^"},"showPosition"),test_match:o(function(C,P){var N,ie,Oe;if(this.options.backtrack_lexer&&(Oe={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&&(Oe.yylloc.range=this.yylloc.range.slice(0))),ie=C[0].match(/(?:\r\n?|\n).*/g),ie&&(this.yylineno+=ie.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ie?ie[ie.length-1].length-ie[ie.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,P,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),N)return N;if(this._backtrack){for(var g in Oe)this[g]=Oe[g];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,P,N,ie;this._more||(this.yytext="",this.match="");for(var Oe=this._currentRules(),g=0;g<Oe.length;g++)if(N=this._input.match(this.rules[Oe[g]]),N&&(!P||N[0].length>P[0].length)){if(P=N,ie=g,this.options.backtrack_lexer){if(C=this.test_match(N,Oe[g]),C!==!1)return C;if(this._backtrack){P=!1;continue}else return!1}else if(!this.options.flex)break}return P?(C=this.test_match(P,Oe[ie]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
39
39
  `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var P=this.next();return P||this.lex()},"lex"),begin:o(function(P){this.conditionStack.push(P)},"begin"),popState:o(function(){var P=this.conditionStack.length-1;return P>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(P){return P=this.conditionStack.length-1-Math.abs(P||0),P>=0?this.conditionStack[P]:"INITIAL"},"topState"),pushState:o(function(P){this.begin(P)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:o(function(P,N,ie,Oe){var g=Oe;switch(ie){case 0:break;case 1:return 12;case 2:return 15;case 3:return 41;case 4:return 325;case 5:return 326;case 6:return 45;case 7:return 47;case 8:return 48;case 9:return 39;case 10:return 24;case 11:return 28;case 12:return 29;case 13:return 31;case 14:return 32;case 15:return 36;case 16:return 53;case 17:return 327;case 18:return 63;case 19:return 64;case 20:return 70;case 21:return 73;case 22:return 76;case 23:return 78;case 24:return 81;case 25:return 83;case 26:return 85;case 27:return 193;case 28:return 100;case 29:return 328;case 30:return 121;case 31:return 329;case 32:return 330;case 33:return 110;case 34:return 331;case 35:return 109;case 36:return 332;case 37:return 333;case 38:return 113;case 39:return 115;case 40:return 116;case 41:return 131;case 42:return 123;case 43:return 126;case 44:return 128;case 45:return 132;case 46:return 112;case 47:return 334;case 48:return 335;case 49:return 159;case 50:return 161;case 51:return 164;case 52:return 174;case 53:return 160;case 54:return 336;case 55:return 163;case 56:return 312;case 57:return 314;case 58:return 317;case 59:return 318;case 60:return 272;case 61:return 197;case 62:return 337;case 63:return 338;case 64:return 229;case 65:return 340;case 66:return 263;case 67:return 224;case 68:return 231;case 69:return 232;case 70:return 242;case 71:return 246;case 72:return 290;case 73:return 341;case 74:return 342;case 75:return 343;case 76:return 344;case 77:return 345;case 78:return 250;case 79:return 346;case 80:return 265;case 81:return 276;case 82:return 277;case 83:return 268;case 84:return 269;case 85:return 270;case 86:return 271;case 87:return 347;case 88:return 348;case 89:return 273;case 90:return 274;case 91:return 350;case 92:return 349;case 93:return 351;case 94:return 279;case 95:return 280;case 96:return 283;case 97:return 285;case 98:return 289;case 99:return 293;case 100:return 296;case 101:return 13;case 102:return 16;case 103:return 308;case 104:return 309;case 105:return 87;case 106:return 292;case 107:return 82;case 108:return 294;case 109:return 295;case 110:return 297;case 111:return 298;case 112:return 299;case 113:return 300;case 114:return 301;case 115:return 302;case 116:return"EXPONENT";case 117:return 303;case 118:return 304;case 119:return 305;case 120:return 306;case 121:return 89;case 122:return 310;case 123:return 6;case 124:return"INVALID";case 125:console.log(N.yytext);break}},"anonymous"),rules:[/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:\{\|)/i,/^(?:\|\})/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(SUBJECT|PREDICATE|OBJECT|isTRIPLE))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:TRIPLE)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],inclusive:!0}}};return R})();Iy.lexer=xN;function ke(){this.yy={}}return o(ke,"Parser"),ke.prototype=Iy,Iy.Parser=ke,new ke})();EA.exports=Sj});var IA=S((dte,CA)=>{var vj="http://www.w3.org/2001/XMLSchema#integer",bj="http://www.w3.org/2001/XMLSchema#string";function It(n){this._options=n=n||{};var e=n.prefixes||{};this._prefixByIri={};var t=[];for(var r in e){var i=e[r];zu(i)&&(this._prefixByIri[i]=r,t.push(i))}var s=t.join("|").replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^("+s+")([a-zA-Z][\\-_a-zA-Z0-9]*)$"),this._usedPrefixes={},this._sparqlStar=n.sparqlStar,this._indent=zu(n.indent)?n.indent:" ",this._newline=zu(n.newline)?n.newline:`
40
- `,this._explicitDatatype=!!n.explicitDatatype}o(It,"Generator");It.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=jn(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:Ia(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+Uh(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=jn(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+jn(n.group,void 0,function(t){var r=Ia(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+Uh(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+jn(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+jn(n.order,void 0,function(t){var r="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+r:r},this)+this._newline),n.offset&&(e+="OFFSET "+n.offset+this._newline),n.limit&&(e+="LIMIT "+n.limit+this._newline),n.values&&(e+=this.values(n)),e=this.baseAndPrefixes(n)+e,e.trim()};It.prototype.baseAndPrefixes=function(n){var e=n.base?"BASE <"+n.base+">"+this._newline:"",t="";for(var r in n.prefixes)(this._options.allPrefixes||this._usedPrefixes[r])&&(t+="PREFIX "+r+": <"+n.prefixes[r]+">"+this._newline);return e+t};It.prototype.toPattern=function(n){var e=n.type||n instanceof Array&&"array"||(n.subject&&n.predicate&&n.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](n)};It.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};It.prototype.array=function(n){return jn(n,this._newline,this.toPattern,this)};It.prototype.bgp=function(n){return this.encodeTriples(n.triples)};It.prototype.encodeTriples=function(n){if(!n.length)return"";for(var e=[],t=void 0,r=void 0,i=0;i<n.length;i++){var s=n[i];Co(s.subject,t)?Co(s.predicate,r)?e.push(","):(r=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(r))):(t&&e.push("."+this._newline),t=s.subject,r=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(r))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};It.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};It.prototype.graphs=function(n,e){return!e||e.length===0?"":jn(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};It.prototype.group=function(n,e){return n=e!==!0?this.array(n.patterns||n.triples):this.toPattern(n.type!=="group"?n:n.patterns),n.indexOf(this._newline)===-1?"{ "+n+" }":"{"+this._newline+this.indent(n)+this._newline+"}"};It.prototype.query=function(n){return this.toQuery(n)};It.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};It.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+Uh(n.variable)+")"};It.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};It.prototype.union=function(n){return jn(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};It.prototype.minus=function(n){return"MINUS "+this.group(n)};It.prototype.values=function(n){var e=Object.keys(n.values.reduce(function(i,s){for(var a in s)i[a]=!0;return i},{})),t,r;return e.length===1?t=r="":(t="(",r=")"),"VALUES "+t+e.join(" ")+r+" {"+this._newline+jn(n.values,this._newline,function(i){return" "+t+jn(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};It.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};It.prototype.toExpression=function(n){if(Ia(n))return this.toEntity(n);switch(n.type.toLowerCase()){case"aggregate":return n.aggregation.toUpperCase()+"("+(n.distinct?"DISTINCT ":"")+this.toExpression(n.expression)+(typeof n.separator=="string"?'; SEPARATOR = "'+n.separator.replace(AA,xA)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+jn(n.args,", ",this.toExpression,this)+")";case"operation":var e=n.operator.toUpperCase(),t=n.args||[];switch(n.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(Ia(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Ia(t[1])?this.toEntity(t[1]):"("+this.toExpression(t[1])+")");case"!":return"!("+this.toExpression(t[0])+")";case"uplus":return"+("+this.toExpression(t[0])+")";case"uminus":return"-("+this.toExpression(t[0])+")";case"notin":e="NOT IN";case"in":return this.toExpression(t[0])+" "+e+"("+(zu(t[1])?t[1]:jn(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+jn(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};It.prototype.toEntity=function(n){if(Ia(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return Uh(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(AA,xA)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case bj:return n;case vj:if(/^\d+$/.test(e))return e+" "}n+="^^"+this.encodeIRI(r.value)}return n;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return n.graph&&n.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(n.graph)+" { "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" } >>":"<< "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" >>";default:return this.encodeIRI(n.value)}else{var i=n.items.map(this.toEntity,this),s=n.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var AA=/["\\\t\n\r\b\f]/g,xA=o(function(n){return wj[n]},"escapeReplacer"),wj={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};It.prototype.encodeIRI=function(n){var e=this._prefixRegex.exec(n);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+n+">"};It.prototype.toUpdate=function(n){switch(n.type||n.updateType){case"load":return"LOAD"+(n.source?" "+this.toEntity(n.source):"")+(n.destination?" INTO GRAPH "+this.toEntity(n.destination):"");case"insert":return"INSERT DATA "+this.group(n.insert,!0);case"delete":return"DELETE DATA "+this.group(n.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(n.delete,!0);case"insertdelete":return(n.graph?"WITH "+this.toEntity(n.graph)+this._newline:"")+(n.delete.length?"DELETE "+this.group(n.delete,!0)+this._newline:"")+(n.insert.length?"INSERT "+this.group(n.insert,!0)+this._newline:"")+(n.using?this.graphs("USING ",n.using.default):"")+(n.using?this.graphs("USING NAMED ",n.using.named):"")+"WHERE "+this.group(n.where,!0);case"add":case"copy":case"move":return n.type.toUpperCase()+" "+(n.silent?"SILENT ":"")+(n.source.default?"DEFAULT":this.toEntity(n.source.name))+" TO "+this.toEntity(n.destination.name);case"create":case"clear":case"drop":return n.type.toUpperCase()+(n.silent?" SILENT ":" ")+(n.graph.default?"DEFAULT":n.graph.named?"NAMED":n.graph.all?"ALL":"GRAPH "+this.toEntity(n.graph.name));default:throw new Error("Unknown update query type: "+n.type)}};It.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function Uh(n){return"?"+n.value}o(Uh,"variableToString");function zu(n){return typeof n=="string"}o(zu,"isString");function Ia(n){return typeof n.termType=="string"}o(Ia,"isTerm");function Co(n,e){if(!n||!Ia(n)||!e||!Ia(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&Co(n.datatype,e.datatype);case"Quad":return Co(n.subject,e.subject)&&Co(n.predicate,e.predicate)&&Co(n.object,e.object)&&Co(n.graph,e.graph);default:return n.value===e.value}}o(Co,"equalTerms");function jn(n,e,t,r){return n.map(t,r).join(zu(e)?e:" ")}o(jn,"mapJoin");function Ej(n={}){return{stringify:o(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new It(t).toQuery(e)},"stringify"),createGenerator:o(function(){return new It(n)},"createGenerator")}}o(Ej,"_Generator");CA.exports={Generator:Ej}});var N_=S(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.BlankNode=void 0;var D_=class{static{o(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};qh.BlankNode=D_});var L_=S(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.DefaultGraph=void 0;var Hu=class{static{o(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};Wh.DefaultGraph=Hu;Hu.INSTANCE=new Hu});var zh=S(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.NamedNode=void 0;var k_=class{static{o(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};Gh.NamedNode=k_});var M_=S(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.Literal=void 0;var RA=zh(),Qu=class n{static{o(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=n.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=n.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};Hh.Literal=Qu;Qu.RDF_LANGUAGE_STRING=new RA.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");Qu.XSD_STRING=new RA.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var $_=S(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.Quad=void 0;var j_=class{static{o(this,"Quad")}constructor(e,t,r,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}};Qh.Quad=j_});var B_=S(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.Variable=void 0;var V_=class{static{o(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};Yh.Variable=V_});var OA=S(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.DataFactory=void 0;var Tj=N_(),Aj=L_(),PA=M_(),xj=zh(),Cj=$_(),Ij=B_(),Rj=0,U_=class{static{o(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${Rj++}_`}namedNode(e){return new xj.NamedNode(e)}blankNode(e){return new Tj.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new PA.Literal(e,t)}variable(e){return new Ij.Variable(e)}defaultGraph(){return Aj.DefaultGraph.INSTANCE}quad(e,t,r,i){return new Cj.Quad(e,t,r,i||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(PA.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}};Kh.DataFactory=U_});var FA=S($n=>{"use strict";var Pj=$n&&$n.__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]})),Io=$n&&$n.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Pj(e,n,t)};Object.defineProperty($n,"__esModule",{value:!0});Io(N_(),$n);Io(OA(),$n);Io(L_(),$n);Io(M_(),$n);Io(zh(),$n);Io($_(),$n);Io(B_(),$n)});var NA=S((Pte,DA)=>{var{Parser:zs}=TA(),{Generator:Oj}=IA(),{Wildcard:Fj}=F_(),{DataFactory:Dj}=FA();function Nj({prefixes:n,baseIRI:e,factory:t,pathOnly:r,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:a}={}){let c={};for(let u in n??{})c[u]=n[u];let l=new zs;return l.parse=function(){return zs.base=e||"",zs.prefixes=Object.create(c),zs.factory=t||new Dj,zs.sparqlStar=!!i,zs.pathOnly=!!r,zs.skipValidation=!!s||!!a,zs.prototype.parse.apply(l,arguments)},l._resetBlanks=zs._resetBlanks,l}o(Nj,"_Parser");DA.exports={Parser:Nj,Generator:Oj,Wildcard:Fj}});var W_=S(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});Pc.CaseWhenTransformerError=Pc.CaseWhenTransformer=void 0;var q_=class{static{o(this,"CaseWhenTransformer")}transform(e){let t=this.stripLineComments(e),r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Hs("Too many nested CASE expressions (max 100 iterations)");while(t!==r);return t}stripLineComments(e){let t="",r=0;for(;r<e.length;){let i=e[r];if(i==="'"||i==='"'){let s=i;for(t+=i,r++;r<e.length&&e[r]!==s;){if(e[r]==="\\"&&r+1<e.length){t+=e[r]+e[r+1],r+=2;continue}t+=e[r],r++}r<e.length&&(t+=e[r],r++);continue}if(i==="<"){let s=e.indexOf(">",r),a=e.indexOf(`
40
+ `,this._explicitDatatype=!!n.explicitDatatype}o(It,"Generator");It.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=jn(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:Ia(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+Uh(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=jn(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+jn(n.group,void 0,function(t){var r=Ia(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+Uh(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+jn(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+jn(n.order,void 0,function(t){var r="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+r:r},this)+this._newline),n.offset&&(e+="OFFSET "+n.offset+this._newline),n.limit&&(e+="LIMIT "+n.limit+this._newline),n.values&&(e+=this.values(n)),e=this.baseAndPrefixes(n)+e,e.trim()};It.prototype.baseAndPrefixes=function(n){var e=n.base?"BASE <"+n.base+">"+this._newline:"",t="";for(var r in n.prefixes)(this._options.allPrefixes||this._usedPrefixes[r])&&(t+="PREFIX "+r+": <"+n.prefixes[r]+">"+this._newline);return e+t};It.prototype.toPattern=function(n){var e=n.type||n instanceof Array&&"array"||(n.subject&&n.predicate&&n.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](n)};It.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};It.prototype.array=function(n){return jn(n,this._newline,this.toPattern,this)};It.prototype.bgp=function(n){return this.encodeTriples(n.triples)};It.prototype.encodeTriples=function(n){if(!n.length)return"";for(var e=[],t=void 0,r=void 0,i=0;i<n.length;i++){var s=n[i];Io(s.subject,t)?Io(s.predicate,r)?e.push(","):(r=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(r))):(t&&e.push("."+this._newline),t=s.subject,r=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(r))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};It.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};It.prototype.graphs=function(n,e){return!e||e.length===0?"":jn(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};It.prototype.group=function(n,e){return n=e!==!0?this.array(n.patterns||n.triples):this.toPattern(n.type!=="group"?n:n.patterns),n.indexOf(this._newline)===-1?"{ "+n+" }":"{"+this._newline+this.indent(n)+this._newline+"}"};It.prototype.query=function(n){return this.toQuery(n)};It.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};It.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+Uh(n.variable)+")"};It.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};It.prototype.union=function(n){return jn(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};It.prototype.minus=function(n){return"MINUS "+this.group(n)};It.prototype.values=function(n){var e=Object.keys(n.values.reduce(function(i,s){for(var a in s)i[a]=!0;return i},{})),t,r;return e.length===1?t=r="":(t="(",r=")"),"VALUES "+t+e.join(" ")+r+" {"+this._newline+jn(n.values,this._newline,function(i){return" "+t+jn(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};It.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};It.prototype.toExpression=function(n){if(Ia(n))return this.toEntity(n);switch(n.type.toLowerCase()){case"aggregate":return n.aggregation.toUpperCase()+"("+(n.distinct?"DISTINCT ":"")+this.toExpression(n.expression)+(typeof n.separator=="string"?'; SEPARATOR = "'+n.separator.replace(AA,xA)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+jn(n.args,", ",this.toExpression,this)+")";case"operation":var e=n.operator.toUpperCase(),t=n.args||[];switch(n.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(Ia(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Ia(t[1])?this.toEntity(t[1]):"("+this.toExpression(t[1])+")");case"!":return"!("+this.toExpression(t[0])+")";case"uplus":return"+("+this.toExpression(t[0])+")";case"uminus":return"-("+this.toExpression(t[0])+")";case"notin":e="NOT IN";case"in":return this.toExpression(t[0])+" "+e+"("+(zu(t[1])?t[1]:jn(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+jn(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};It.prototype.toEntity=function(n){if(Ia(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return Uh(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(AA,xA)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case bj:return n;case vj:if(/^\d+$/.test(e))return e+" "}n+="^^"+this.encodeIRI(r.value)}return n;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return n.graph&&n.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(n.graph)+" { "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" } >>":"<< "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" >>";default:return this.encodeIRI(n.value)}else{var i=n.items.map(this.toEntity,this),s=n.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var AA=/["\\\t\n\r\b\f]/g,xA=o(function(n){return wj[n]},"escapeReplacer"),wj={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};It.prototype.encodeIRI=function(n){var e=this._prefixRegex.exec(n);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+n+">"};It.prototype.toUpdate=function(n){switch(n.type||n.updateType){case"load":return"LOAD"+(n.source?" "+this.toEntity(n.source):"")+(n.destination?" INTO GRAPH "+this.toEntity(n.destination):"");case"insert":return"INSERT DATA "+this.group(n.insert,!0);case"delete":return"DELETE DATA "+this.group(n.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(n.delete,!0);case"insertdelete":return(n.graph?"WITH "+this.toEntity(n.graph)+this._newline:"")+(n.delete.length?"DELETE "+this.group(n.delete,!0)+this._newline:"")+(n.insert.length?"INSERT "+this.group(n.insert,!0)+this._newline:"")+(n.using?this.graphs("USING ",n.using.default):"")+(n.using?this.graphs("USING NAMED ",n.using.named):"")+"WHERE "+this.group(n.where,!0);case"add":case"copy":case"move":return n.type.toUpperCase()+" "+(n.silent?"SILENT ":"")+(n.source.default?"DEFAULT":this.toEntity(n.source.name))+" TO "+this.toEntity(n.destination.name);case"create":case"clear":case"drop":return n.type.toUpperCase()+(n.silent?" SILENT ":" ")+(n.graph.default?"DEFAULT":n.graph.named?"NAMED":n.graph.all?"ALL":"GRAPH "+this.toEntity(n.graph.name));default:throw new Error("Unknown update query type: "+n.type)}};It.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function Uh(n){return"?"+n.value}o(Uh,"variableToString");function zu(n){return typeof n=="string"}o(zu,"isString");function Ia(n){return typeof n.termType=="string"}o(Ia,"isTerm");function Io(n,e){if(!n||!Ia(n)||!e||!Ia(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&Io(n.datatype,e.datatype);case"Quad":return Io(n.subject,e.subject)&&Io(n.predicate,e.predicate)&&Io(n.object,e.object)&&Io(n.graph,e.graph);default:return n.value===e.value}}o(Io,"equalTerms");function jn(n,e,t,r){return n.map(t,r).join(zu(e)?e:" ")}o(jn,"mapJoin");function Ej(n={}){return{stringify:o(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new It(t).toQuery(e)},"stringify"),createGenerator:o(function(){return new It(n)},"createGenerator")}}o(Ej,"_Generator");CA.exports={Generator:Ej}});var N_=S(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.BlankNode=void 0;var D_=class{static{o(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};qh.BlankNode=D_});var L_=S(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.DefaultGraph=void 0;var Hu=class{static{o(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};Wh.DefaultGraph=Hu;Hu.INSTANCE=new Hu});var zh=S(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.NamedNode=void 0;var k_=class{static{o(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};Gh.NamedNode=k_});var M_=S(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.Literal=void 0;var RA=zh(),Qu=class n{static{o(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=n.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=n.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};Hh.Literal=Qu;Qu.RDF_LANGUAGE_STRING=new RA.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");Qu.XSD_STRING=new RA.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var $_=S(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.Quad=void 0;var j_=class{static{o(this,"Quad")}constructor(e,t,r,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}};Qh.Quad=j_});var B_=S(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.Variable=void 0;var V_=class{static{o(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};Yh.Variable=V_});var OA=S(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.DataFactory=void 0;var Tj=N_(),Aj=L_(),PA=M_(),xj=zh(),Cj=$_(),Ij=B_(),Rj=0,U_=class{static{o(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${Rj++}_`}namedNode(e){return new xj.NamedNode(e)}blankNode(e){return new Tj.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new PA.Literal(e,t)}variable(e){return new Ij.Variable(e)}defaultGraph(){return Aj.DefaultGraph.INSTANCE}quad(e,t,r,i){return new Cj.Quad(e,t,r,i||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(PA.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}};Kh.DataFactory=U_});var FA=S($n=>{"use strict";var Pj=$n&&$n.__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]})),Ro=$n&&$n.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Pj(e,n,t)};Object.defineProperty($n,"__esModule",{value:!0});Ro(N_(),$n);Ro(OA(),$n);Ro(L_(),$n);Ro(M_(),$n);Ro(zh(),$n);Ro($_(),$n);Ro(B_(),$n)});var NA=S((Pte,DA)=>{var{Parser:zs}=TA(),{Generator:Oj}=IA(),{Wildcard:Fj}=F_(),{DataFactory:Dj}=FA();function Nj({prefixes:n,baseIRI:e,factory:t,pathOnly:r,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:a}={}){let c={};for(let u in n??{})c[u]=n[u];let l=new zs;return l.parse=function(){return zs.base=e||"",zs.prefixes=Object.create(c),zs.factory=t||new Dj,zs.sparqlStar=!!i,zs.pathOnly=!!r,zs.skipValidation=!!s||!!a,zs.prototype.parse.apply(l,arguments)},l._resetBlanks=zs._resetBlanks,l}o(Nj,"_Parser");DA.exports={Parser:Nj,Generator:Oj,Wildcard:Fj}});var W_=S(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});Pc.CaseWhenTransformerError=Pc.CaseWhenTransformer=void 0;var q_=class{static{o(this,"CaseWhenTransformer")}transform(e){let t=this.stripLineComments(e),r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Hs("Too many nested CASE expressions (max 100 iterations)");while(t!==r);return t}stripLineComments(e){let t="",r=0;for(;r<e.length;){let i=e[r];if(i==="'"||i==='"'){let s=i;for(t+=i,r++;r<e.length&&e[r]!==s;){if(e[r]==="\\"&&r+1<e.length){t+=e[r]+e[r+1],r+=2;continue}t+=e[r],r++}r<e.length&&(t+=e[r],r++);continue}if(i==="<"){let s=e.indexOf(">",r),a=e.indexOf(`
41
41
  `,r);if(s!==-1&&(a===-1||s<a)){t+=e.substring(r,s+1),r=s+1;continue}}if(i==="#"){let s=e.indexOf(`
42
42
  `,r),a=s===-1?e.length:s;t+=" ".repeat(a-r),r=a;continue}t+=i,r++}return t}transformSinglePass(e){let t=this.findCasePositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractCaseExpression(r,s);if(a){let c=this.convertCaseToIf(a.content);r=r.substring(0,s)+c+r.substring(s+a.length)}}return r}findCasePositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(r.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){t.push(i),i+=4;continue}i++}return t}extractCaseExpression(e,t){let r=1,i=t+4,s=e.toUpperCase();for(;i<e.length&&r>0;){if(e[i]==="'"||e[i]==='"'){let a=e[i];for(i++;i<e.length&&e[i]!==a;)e[i]==="\\"&&i++,i++;i++;continue}if(s.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){r++,i+=4;continue}if(s.substring(i,i+3)==="END"&&this.isWordBoundary(e,i,3)){if(r--,r===0){let a=e.substring(t,i+3);return{content:a,length:a.length}}i+=3;continue}i++}if(r>0)throw new Hs(`Unclosed CASE expression at position ${t}`);return null}isWordBoundary(e,t,r){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_?$]/.test(i),a=t+r<e.length?e[t+r]:"",c=t+r>=e.length||!/[a-zA-Z0-9_]/.test(a);return s&&c}convertCaseToIf(e){let t=this.extractWhenClauses(e),r=this.extractElseClause(e);if(t.length===0)throw new Hs("CASE expression must have at least one WHEN clause");let i=r!==null?r:'""';for(let s=t.length-1;s>=0;s--){let{condition:a,result:c}=t[s];i=`IF(${a}, ${c}, ${i})`}return i}extractWhenClauses(e){let t=[],r=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),i=this.findKeywordPositions(r,"WHEN"),s=this.findKeywordPositions(r,"ELSE"),a=s.length>0?s[0]:r.length;for(let c=0;c<i.length;c++){let l=i[c]+4,u=c+1<i.length?i[c+1]:a,f=r.substring(l,u).trim(),d=this.parseWhenClause(f);d&&t.push(d)}return t}findKeywordPositions(e,t){let r=[],i=e.toUpperCase(),s=0,a=0;for(;s<e.length;){let c=e[s];if(c==="'"||c==='"'){let l=c;for(s++;s<e.length&&e[s]!==l;)e[s]==="\\"&&s++,s++;s++;continue}if(c==="("){a++,s++;continue}if(c===")"){a--,s++;continue}if(a===0&&i.substring(s,s+t.length)===t&&this.isWordBoundary(e,s,t.length)){r.push(s),s+=t.length;continue}s++}return r}parseWhenClause(e){let t=this.findKeywordPositions(e,"THEN");if(t.length===0)throw new Hs(`WHEN clause missing THEN keyword: ${e.substring(0,50)}...`);let r=t[0],i=e.substring(0,r).trim(),s=e.substring(r+4).trim();if(!i)throw new Hs("WHEN clause has empty condition");if(!s)throw new Hs("WHEN clause has empty result");return{condition:i,result:s}}extractElseClause(e){let t=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),r=this.findKeywordPositions(t,"ELSE");if(r.length>0){let i=r[0];return t.substring(i+4).trim()}return null}};Pc.CaseWhenTransformer=q_;var Hs=class extends Error{static{o(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};Pc.CaseWhenTransformerError=Hs});var G_=S(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});Oc.LateralTransformerError=Oc.LateralTransformer=void 0;var Xh=class n{static{o(this,"LateralTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Ra("Too many nested LATERAL joins (max 100 iterations)");while(t!==r);return t}hasLateral(e){return this.findLateralPositions(e).length>0}static isLateralJoin(e){if(e.type==="group"&&e.patterns){for(let t of e.patterns)if(t.type==="query"&&t.queryType==="SELECT"&&t.variables&&Array.isArray(t.variables)){for(let r of t.variables)if(r.termType==="Variable"&&r.value===n.LATERAL_MARKER)return!0}}if(e.type==="query"&&e.queryType==="SELECT"&&e.variables&&Array.isArray(e.variables)){for(let t of e.variables)if(t.termType==="Variable"&&t.value===n.LATERAL_MARKER)return!0}return!1}transformSinglePass(e){let t=this.findLateralPositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractLateralExpression(r,s);if(a){let c=this.transformLateral(a.content);r=r.substring(0,s)+c+r.substring(s+a.length)}}return r}findLateralPositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(e[i]==="#"){for(;i<e.length&&e[i]!==`
43
43
  `;)i++;continue}if(r.substring(i,i+7)==="LATERAL"&&this.isWordBoundary(e,i,7)){t.push(i),i+=7;continue}i++}return t}extractLateralExpression(e,t){let r=t+7;for(;r<e.length&&/\s/.test(e[r]);)r++;if(e[r]!=="{")throw new Ra(`Expected '{' after LATERAL keyword at position ${t}`);let i=1;for(r++;r<e.length&&i>0;){if(e[r]==="'"||e[r]==='"'){let s=e[r];for(r++;r<e.length&&e[r]!==s;)e[r]==="\\"&&r++,r++;r++;continue}if(e[r]==="#"){for(;r<e.length&&e[r]!==`
@@ -45,7 +45,7 @@ Expecting `+Gd.join(", ")+", got '"+(this.terminals_[ut]||ut)+"'":By="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 Fc(`Unclosed IRI in PREFIX* declaration at position ${a}`)}else throw new Fc(`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,"")}};Pa.PrefixStarTransformer=z_;var Fc=class extends Error{static{o(this,"PrefixStarTransformerError")}constructor(e){super(`PREFIX* transformation error: ${e}`),this.name="PrefixStarTransformerError"}};Pa.PrefixStarTransformerError=Fc});var H_=S(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.DescribeOptionsTransformer=Nc.DescribeOptionsTransformerError=void 0;var Zh=class extends Error{static{o(this,"DescribeOptionsTransformerError")}constructor(e){super(e),this.name="DescribeOptionsTransformerError"}};Nc.DescribeOptionsTransformerError=Zh;var Dc=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 Zh(`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}};Nc.DescribeOptionsTransformer=Dc;Dc.DEPTH_PATTERN=/\bDEPTH\s+(\d+)/gi;Dc.SYMMETRIC_PATTERN=/\bSYMMETRIC\b/gi;Dc.DESCRIBE_QUERY_PATTERN=/\bDESCRIBE\b/i});var kA=S(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.DirectionalLangTagTransformerError=Lc.DirectionalLangTagTransformer=void 0;var ep=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()}};Lc.DirectionalLangTagTransformer=ep;ep.DIRECTIONAL_TAG_REGEX=/(["'])((?:[^\\]|\\.)*?)\1@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)--(ltr|rtl)/g;var Q_=class extends Error{static{o(this,"DirectionalLangTagTransformerError")}constructor(e){super(`Directional language tag transformation error: ${e}`),this.name="DirectionalLangTagTransformerError"}};Lc.DirectionalLangTagTransformerError=Q_});var MA=S(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.TripleTermTransformerError=Mc.TripleTermTransformer=void 0;var Y_=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 kc("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 kc(`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 kc(`Invalid triple term syntax: ${e.substring(0,50)}...`);return`<< ${t[1]} >>`}};Mc.TripleTermTransformer=Y_;var kc=class extends Error{static{o(this,"TripleTermTransformerError")}constructor(e){super(`Triple term transformation error: ${e}`),this.name="TripleTermTransformerError"}};Mc.TripleTermTransformerError=kc});var X_=S(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});tp.VaultPrefixTransformer=void 0;var Lj=/PREFIX\s+(\w+)\s*:/gi,kj=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"]),K_=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())&&!kj.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(Lj.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}};tp.VaultPrefixTransformer=K_});var jc=S(xn=>{"use strict";var Mj=xn&&xn.__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]})),jj=xn&&xn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),$j=xn&&xn.__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 jj(t,e),t}})();Object.defineProperty(xn,"__esModule",{value:!0});xn.SPARQLParser=xn.ExoQLParser=xn.SPARQLParseError=void 0;var jA=$j(NA()),J_=W_(),Z_=G_(),$A=LA(),e1=H_(),Vj=kA(),t1=MA(),Bj=X_(),cr=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}};xn.SPARQLParseError=cr;var rp=class{static{o(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new jA.Parser({sparqlStar:!0}),this.generator=new jA.Generator({sparqlStar:!0}),this.caseWhenTransformer=new J_.CaseWhenTransformer,this.lateralTransformer=new Z_.LateralTransformer,this.prefixStarTransformer=new $A.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new e1.DescribeOptionsTransformer,this.directionalLangTagTransformer=new Vj.DirectionalLangTagTransformer,this.tripleTermTransformer=new t1.TripleTermTransformer,this.vaultPrefixTransformer=new Bj.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 e1.DescribeOptionsTransformerError)throw new cr(t.message);if(t instanceof Z_.LateralTransformerError)throw new cr(t.message);if(t instanceof J_.CaseWhenTransformerError)throw new cr(t.message);if(t instanceof t1.TripleTermTransformerError)throw new cr(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 cr(`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 e1.DescribeOptionsTransformerError)throw new cr(t.message);if(t instanceof $A.PrefixStarTransformerError)throw new cr(t.message);if(t instanceof Z_.LateralTransformerError)throw new cr(t.message);if(t instanceof J_.CaseWhenTransformerError)throw new cr(t.message);if(t instanceof t1.TripleTermTransformerError)throw new cr(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 cr(`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 cr(`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 cr("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 cr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new cr(`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 cr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};xn.ExoQLParser=rp;xn.SPARQLParser=rp});var Ro=S(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.AlgebraTranslatorError=void 0;var r1=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};np.AlgebraTranslatorError=r1});var ip=S(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.isVariableExpression=Uj;os.isVariableTerm=qj;os.isNamedNode=Wj;os.isLiteral=Gj;os.isPropertyPath=zj;os.isAggregateExpression=Hj;os.isOperationExpression=Qj;os.isFunctionCallExpression=Yj;function Uj(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}o(Uj,"isVariableExpression");function qj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}o(qj,"isVariableTerm");function Wj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}o(Wj,"isNamedNode");function Gj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}o(Gj,"isLiteral");function zj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}o(zj,"isPropertyPath");function Hj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}o(Hj,"isAggregateExpression");function Qj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}o(Qj,"isOperationExpression");function Yj(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}o(Yj,"isFunctionCallExpression")});var VA=S(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.TripleTranslator=void 0;var un=Ro(),n1=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 un.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 un.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 un.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new un.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 un.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new un.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new un.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new un.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new un.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 un.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new un.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 un.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new un.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 un.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 un.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};sp.TripleTranslator=n1});var BA=S(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.ExpressionTranslator=void 0;var $c=Ro(),i1=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 $c.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 $c.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new $c.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 $c.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 $c.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 $c.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"}}};ap.ExpressionTranslator=i1});var WA=S(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.PatternTranslator=void 0;var UA=G_(),Nr=Ro(),qA=ip(),s1=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 Nr.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 Nr.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 Nr.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Nr.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 Nr.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 Nr.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 Nr.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 Nr.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 Nr.AlgebraTranslatorError(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Nr.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 Nr.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 Nr.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Nr.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 Nr.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Nr.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 Nr.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 Nr.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,qA.isVariableTerm)(i)&&i.value===UA.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,qA.isVariableTerm)(i)&&i.value===UA.LateralTransformer.LATERAL_MARKER))}}};op.PatternTranslator=s1});var zA=S(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});cp.AggregateTranslator=void 0;var GA=Ro(),Kj=ip(),a1=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,Kj.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 GA.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 GA.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)}}}};cp.AggregateTranslator=a1});var Vc=S(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.AlgebraTranslator=Oa.ExoQLAlgebraTranslator=Oa.AlgebraTranslatorError=void 0;var lp=Ro(),up=ip(),Xj=VA(),Jj=BA(),Zj=WA(),e9=zA(),t9=Ro();Object.defineProperty(Oa,"AlgebraTranslatorError",{enumerable:!0,get:o(function(){return t9.AlgebraTranslatorError},"get")});var fp=class{static{o(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new Xj.TripleTranslator,this.expressionTranslator=new Jj.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 Zj.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 e9.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 lp.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 lp.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new lp.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,up.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,up.isVariableTerm)(u)||(0,up.isVariableExpression)(u)).map(u=>(0,up.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 lp.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}}};Oa.ExoQLAlgebraTranslator=fp;Oa.AlgebraTranslator=fp});var cs=S(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});dp.SolutionMapping=void 0;var HA=Ne(),QA=Ae(),YA=qt(),o1=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 HA.Literal&&t instanceof HA.Literal?e.equals(t):e instanceof QA.IRI&&t instanceof QA.IRI?e.value===t.value:e instanceof YA.BlankNode&&t instanceof YA.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}};dp.SolutionMapping=o1});var XA=S(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.PropertyPathExecutor=Bc.PropertyPathExecutorError=void 0;var r9=cs(),hp=Ae(),KA=qt(),n9=Ne(),Yu=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Bc.PropertyPathExecutorError=Yu;var c1=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){if(this.isLiteralElement(e)||this.isLiteralElement(r)){let a=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:r,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l;console.warn(`[PropertyPathExecutor] literal-safety guard fired: literal in ${a} position \u2014 yielding 0 solutions. value="${u}"`);return}let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new r9.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 Yu("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 hp.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let c=a.shift();if(!c)break;let{node:l,depth:u}=c;if(u>=this.MAX_DEPTH)continue;let f=await this.evaluatePathItem(l,t,null);for(let d of f){let h=this.nodeToKey(d);(r===null||this.nodeInSet(d,r))&&s.add(d),i.has(h)||(i.add(h),a.push({node:d,depth:u+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new hp.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"|":return{type:"path",pathType:"|",items:e.items.map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"+":case"*":case"?":{let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new hp.IRI(e.value));break;case"blank":t.add(new KA.BlankNode(e.value));break;default:throw new Yu(`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 hp.IRI)return{type:"iri",value:r.value};if(r instanceof KA.BlankNode)return{type:"blank",value:r.id};if(r instanceof n9.Literal)return{type:"literal",value:r.value,datatype:r.datatype?.value,language:r.language,direction:r.direction}}}return e}isVariable(e){return e.type==="variable"}isLiteralElement(e){return e.type==="literal"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};Bc.PropertyPathExecutor=c1});var f1=S(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.BGPExecutor=Uc.BGPExecutorError=void 0;var pp=cs(),Fa=Ae(),l1=Ne(),mp=qt(),gp=Ou(),i9=XA(),zr=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Uc.BGPExecutorError=zr;var u1=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new i9.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new pp.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 pp.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 zr("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:r);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new zr("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 pp.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){if(this.isLiteral(e.subject)||this.isLiteral(e.object)){this.warnLiteralGuard("matchTriplePattern.propertyPath",this.isLiteral(e.subject)?"subject":"object",this.isLiteral(e.subject)?e.subject:e.object);return}yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:t);return}let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new pp.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 gp.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 Fa.IRI&&e.value===t.value;case"literal":return!(!(t instanceof l1.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof mp.BlankNode&&e.value===t.id;case"quoted":return t instanceof gp.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 Fa.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,r){let i="value"in r?String(r.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i;console.warn(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Fa.IRI(e.value);case"blank":return new mp.BlankNode(e.value);case"literal":throw new zr("Literals cannot appear in subject position");case"variable":throw new zr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new zr(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new Fa.IRI(e.predicate.value):(()=>{throw new zr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new gp.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Fa.IRI(e.value);case"literal":throw new zr("Literals cannot appear in predicate position");case"blank":throw new zr("Blank nodes cannot appear in predicate position");case"variable":throw new zr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new zr(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Fa.IRI(e.value);case"literal":return new l1.Literal(e.value,e.datatype?new Fa.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new mp.BlankNode(e.value);case"variable":throw new zr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new zr(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof Fa.IRI)return{type:"iri",value:e.value};if(e instanceof l1.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof mp.BlankNode)return{type:"blank",value:e.id};if(e instanceof gp.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new zr(`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)}}};Uc.BGPExecutor=u1});var JA=S(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});yp.StringFunctions=void 0;var qc=Ae(),Da=Ne(),d1=qt(),Ku=class n{static{o(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof qc.IRI||e instanceof Da.Literal?e.value:e instanceof d1.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof Da.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof Da.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 Da.Literal)r=e.value;else if(e instanceof qc.IRI)r=e.value;else if(e instanceof d1.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 Da.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof qc.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 Da.Literal(s,new qc.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 Da.Literal)t=e.value;else if(e instanceof qc.IRI)t=e.value;else if(e instanceof d1.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 Da.Literal(r,new qc.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}};yp.StringFunctions=Ku;Ku.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Ku.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 ZA=S(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.MathFunctions=void 0;var h1=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()}};_p.MathFunctions=h1});var vp=S(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.DateTimeParsing=void 0;var s9=Ae(),a9=Ne(),p1=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 a9.Literal(e,new s9.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(r[1],10),s=parseInt(r[2],10)-1,a=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,a));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,d=parseInt(u[2],10),h=parseInt(u[3],10),p=f*(d*60+h)*60*1e3;l=new Date(l.getTime()-p)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),a=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||a<0||a>59||i===24&&(s!==0||a!==0))return null;let u=0;if(c){let d=c.padEnd(3,"0").slice(0,3);u=parseInt(d,10)}let f=i*60*60*1e3+s*60*1e3+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let h=d[1]==="+"?1:-1,p=parseInt(d[2],10),y=parseInt(d[3],10),v=h*(p*60+y)*60*1e3;f-=v}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+a;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,a=t?"-P":"P";return i>0&&(a+=`${i}Y`),(s>0||i===0)&&(a+=`${s}M`),a}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:a,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=0,a=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.substring(l+1)),u){let d=u.match(/^(\d+(?:\.\d+)?)D$/);if(d)i=parseFloat(d[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let d=f,h=d.match(/^(\d+(?:\.\d+)?)H/);h&&(s=parseFloat(h[1]),d=d.substring(h[0].length));let p=d.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),d=d.substring(p[0].length));let y=d.match(/^(\d+(?:\.\d+)?)S$/);if(y&&(c=parseFloat(y[1]),d=d.substring(y[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}};Sp.DateTimeParsing=p1});var e3=S(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.DateTimeArithmetic=void 0;var fn=Ae(),xe=Ne(),Xe=vp(),m1=class{static{o(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(l,new fn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(l.toISOString(),new fn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(l.toISOString(),new fn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(h,new fn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(h,new fn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(s.toISOString(),new fn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(s.toISOString(),new fn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(d,new fn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(d,new fn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s+a);return new xe.Literal(c,new fn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s-a);return new xe.Literal(c,new fn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof xe.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i*t);return new xe.Literal(s,new fn.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 xe.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i/t);return new xe.Literal(s,new fn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s+a);return new xe.Literal(c,new fn.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s-a);return new xe.Literal(c,new fn.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof xe.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof xe.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof xe.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof xe.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/1e3}};bp.DateTimeArithmetic=m1});var t3=S(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.DateTimeAccessors=void 0;var Xu=Ae(),$t=Ne(),Tt=vp(),g1=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 $t.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 $t.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 $t.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 $t.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof $t.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof $t.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 $t.Literal(r,new Xu.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 $t.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let te=i.getUTCFullYear(),z=String(i.getUTCMonth()+1).padStart(2,"0"),G=String(i.getUTCDate()).padStart(2,"0"),F=String(i.getUTCHours()).padStart(2,"0"),$=String(i.getUTCMinutes()).padStart(2,"0"),re=String(i.getUTCSeconds()).padStart(2,"0"),Ye=i.getUTCMilliseconds(),st=`${te}-${z}-${G}T${F}:${$}:${re}`;return Ye>0&&(st+=`.${String(Ye).padStart(3,"0")}`),new $t.Literal(st,new Xu.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof $t.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(a)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+a),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),h=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),y=String(u.getUTCMinutes()).padStart(2,"0"),v=String(u.getUTCSeconds()).padStart(2,"0"),E=u.getUTCMilliseconds(),b=a>=0?"+":"-",A=Math.floor(Math.abs(a)/(3600*1e3)),I=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),j=`${b}${String(A).padStart(2,"0")}:${String(I).padStart(2,"0")}`,B=`${f}-${d}-${h}T${p}:${y}:${v}`;return E>0&&(B+=`.${String(E).padStart(3,"0")}`),B+=j,new $t.Literal(B,new Xu.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 $t.Literal?e.value:e,s=t instanceof $t.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 $t.Literal?e.value:e,i=t instanceof $t.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 $t.Literal(l,new Xu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof $t.Literal?e.value:e,i=t instanceof $t.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 $t.Literal(u,new Xu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};wp.DateTimeAccessors=g1});var Tp=S(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});Ep.DateTimeFunctions=void 0;var Wc=vp(),lr=e3(),gt=t3(),y1=class{static{o(this,"DateTimeFunctions")}static parseDate(e){return Wc.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Wc.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Wc.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Wc.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Wc.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Wc.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 lr.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return lr.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return lr.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return lr.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return lr.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return lr.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return lr.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return lr.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return lr.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return lr.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return lr.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return lr.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return lr.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return lr.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return lr.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return lr.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return lr.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return lr.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return lr.DateTimeArithmetic.durationToSeconds(e)}};Ep.DateTimeFunctions=y1});var r3=S(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});xp.LogicalFunctions=void 0;var o9=Ae(),Gc=Ne(),c9=qt(),Ap=Tp(),_1=class n{static{o(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return Ap.DateTimeFunctions.compareDurations(e instanceof Gc.Literal?e:String(e),t instanceof Gc.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return Ap.DateTimeFunctions.compareDurations(e instanceof Gc.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return Ap.DateTimeFunctions.compareDurations(e,t instanceof Gc.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 Gc.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 Gc.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 Ap.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof o9.IRI?e.value:e instanceof c9.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}};xp.LogicalFunctions=_1});var n3=S(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});Cp.RDFTermFunctions=void 0;var Lr=Ae(),vt=Ne(),hi=qt(),zc=Ou(),S1=En(),v1=class n{static{o(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof vt.Literal)return e.datatype?e.datatype:e.language?new Lr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Lr.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 Lr.IRI}static isBlank(e){return e===void 0?!1:e instanceof hi.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof vt.Literal}static isTriple(e){return e===void 0?!1:e instanceof zc.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof vt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof vt.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 vt.Literal(t.toISOString(),new Lr.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 vt.Literal(String(t),new Lr.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 vt.Literal(String(t),new Lr.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 Lr.IRI&&t instanceof Lr.IRI)return e.value===t.value;if(e instanceof hi.BlankNode&&t instanceof hi.BlankNode)return e.id===t.id;if(e instanceof vt.Literal&&t instanceof vt.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 Lr.IRI)return e;if(e instanceof vt.Literal)return new Lr.IRI(e.value);throw e instanceof hi.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,S1.v4)().replace(/-/g,"").substring(0,12)}`;return new hi.BlankNode(t)}if(e instanceof vt.Literal)return new hi.BlankNode(e.value);if(e instanceof hi.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 vt.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 Lr.IRI)i=t;else if(t instanceof vt.Literal)i=new Lr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new vt.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 vt.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 vt.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 vt.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 vt.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 vt.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 vt.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 vt.Literal(i,void 0,s,a)}static uuid(){let e=(0,S1.v4)();return new Lr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,S1.v4)();return new vt.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 vt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Lr.IRI)){let c=t instanceof vt.Literal?"Literal":t instanceof hi.BlankNode?"BlankNode":t instanceof zc.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new zc.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof zc.QuotedTriple)){let t=e instanceof Lr.IRI?"IRI":e instanceof vt.Literal?"Literal":e instanceof hi.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 zc.QuotedTriple)){let t=e instanceof Lr.IRI?"IRI":e instanceof vt.Literal?"Literal":e instanceof hi.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 zc.QuotedTriple)){let t=e instanceof Lr.IRI?"IRI":e instanceof vt.Literal?"Literal":e instanceof hi.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};Cp.RDFTermFunctions=v1});var i3=S(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.HashFunctions=void 0;var b1=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")}};Ip.HashFunctions=b1});var Pp=S(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});Rp.BuiltInFunctions=void 0;var ur=JA(),Na=ZA(),ce=Tp(),Hc=r3(),Ft=n3(),Ju=i3(),w1=class{static{o(this,"BuiltInFunctions")}static str(...e){return ur.StringFunctions.str(...e)}static lang(...e){return ur.StringFunctions.lang(...e)}static langdir(...e){return ur.StringFunctions.langdir(...e)}static langMatches(...e){return ur.StringFunctions.langMatches(...e)}static regex(...e){return ur.StringFunctions.regex(...e)}static contains(...e){return ur.StringFunctions.contains(...e)}static strStarts(...e){return ur.StringFunctions.strStarts(...e)}static strEnds(...e){return ur.StringFunctions.strEnds(...e)}static strlen(...e){return ur.StringFunctions.strlen(...e)}static ucase(...e){return ur.StringFunctions.ucase(...e)}static lcase(...e){return ur.StringFunctions.lcase(...e)}static substr(...e){return ur.StringFunctions.substr(...e)}static strBefore(...e){return ur.StringFunctions.strBefore(...e)}static strAfter(...e){return ur.StringFunctions.strAfter(...e)}static concat(...e){return ur.StringFunctions.concat(...e)}static replace(...e){return ur.StringFunctions.replace(...e)}static encodeForUri(...e){return ur.StringFunctions.encodeForUri(...e)}static normalize(...e){return ur.StringFunctions.normalize(...e)}static fold(...e){return ur.StringFunctions.fold(...e)}static abs(...e){return Na.MathFunctions.abs(...e)}static round(...e){return Na.MathFunctions.round(...e)}static ceil(...e){return Na.MathFunctions.ceil(...e)}static floor(...e){return Na.MathFunctions.floor(...e)}static rand(){return Na.MathFunctions.rand()}static msToMinutes(...e){return Na.MathFunctions.msToMinutes(...e)}static msToHours(...e){return Na.MathFunctions.msToHours(...e)}static msToSeconds(...e){return Na.MathFunctions.msToSeconds(...e)}static parseDate(...e){return ce.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return ce.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return ce.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return ce.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return ce.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return ce.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return ce.DateTimeFunctions.year(...e)}static month(...e){return ce.DateTimeFunctions.month(...e)}static day(...e){return ce.DateTimeFunctions.day(...e)}static hours(...e){return ce.DateTimeFunctions.hours(...e)}static minutes(...e){return ce.DateTimeFunctions.minutes(...e)}static seconds(...e){return ce.DateTimeFunctions.seconds(...e)}static timezone(...e){return ce.DateTimeFunctions.timezone(...e)}static tz(...e){return ce.DateTimeFunctions.tz(...e)}static now(){return ce.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return ce.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return ce.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return ce.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return ce.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return ce.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return ce.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return ce.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return ce.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return ce.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return ce.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return ce.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return ce.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return ce.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return ce.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return ce.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return ce.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return ce.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return ce.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return ce.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return ce.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return ce.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return ce.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return ce.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return ce.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return ce.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return ce.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return ce.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return ce.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return ce.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return ce.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return ce.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return ce.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return ce.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return ce.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return ce.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return ce.DateTimeFunctions.adjust(...e)}static isTime(...e){return ce.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return ce.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Hc.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Hc.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Hc.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Hc.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Hc.LogicalFunctions.coalesce(...e)}static if(...e){return Hc.LogicalFunctions.if(...e)}static datatype(...e){return Ft.RDFTermFunctions.datatype(...e)}static bound(...e){return Ft.RDFTermFunctions.bound(...e)}static isIRI(...e){return Ft.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return Ft.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return Ft.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return Ft.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return Ft.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return Ft.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return Ft.RDFTermFunctions.sameTerm(...e)}static iri(...e){return Ft.RDFTermFunctions.iri(...e)}static uri(...e){return Ft.RDFTermFunctions.uri(...e)}static bnode(...e){return Ft.RDFTermFunctions.bnode(...e)}static strdt(...e){return Ft.RDFTermFunctions.strdt(...e)}static strlang(...e){return Ft.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return Ft.RDFTermFunctions.strlangdir(...e)}static uuid(){return Ft.RDFTermFunctions.uuid()}static struuid(){return Ft.RDFTermFunctions.struuid()}static xsdDateTime(...e){return Ft.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return Ft.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return Ft.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return Ft.RDFTermFunctions.triple(...e)}static subject(...e){return Ft.RDFTermFunctions.subject(...e)}static predicate(...e){return Ft.RDFTermFunctions.predicate(...e)}static object(...e){return Ft.RDFTermFunctions.object(...e)}static md5(...e){return Ju.HashFunctions.md5(...e)}static sha1(...e){return Ju.HashFunctions.sha1(...e)}static sha256(...e){return Ju.HashFunctions.sha256(...e)}static sha384(...e){return Ju.HashFunctions.sha384(...e)}static sha512(...e){return Ju.HashFunctions.sha512(...e)}};Rp.BuiltInFunctions=w1});var Zu=S(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.ExoQLBudgetExceededError=ls.ExoQLCycleError=ls.ExoQLEvalDisabledError=ls.ExoQLForbiddenKeywordError=void 0;var E1=class extends Error{static{o(this,"ExoQLForbiddenKeywordError")}constructor(e,t){super(t??`ExoQLForbiddenKeywordError: keyword "${e}" is not permitted by the exoql__Query AST allowlist`),this.name="ExoQLForbiddenKeywordError",this.keyword=e}};ls.ExoQLForbiddenKeywordError=E1;var T1=class extends Error{static{o(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};ls.ExoQLEvalDisabledError=T1;var A1=class extends Error{static{o(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};ls.ExoQLCycleError=A1;var x1=class extends Error{static{o(this,"ExoQLBudgetExceededError")}constructor(e,t,r,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${r})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=r}};ls.ExoQLBudgetExceededError=x1});var h3=S(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var k=Pp();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 s3=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",s3);M.functionHandlers.set("isuri",s3);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 Qc=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"),a3=Qc(k.BuiltInFunctions.year.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationYears.bind(k.BuiltInFunctions),null);M.functionHandlers.set("year",a3);M.functionHandlers.set("years",a3);var o3=Qc(k.BuiltInFunctions.month.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationMonths.bind(k.BuiltInFunctions),null);M.functionHandlers.set("month",o3);M.functionHandlers.set("months",o3);var c3=Qc(k.BuiltInFunctions.day.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationDays.bind(k.BuiltInFunctions));M.functionHandlers.set("day",c3);M.functionHandlers.set("days",c3);M.functionHandlers.set("hours",Qc(k.BuiltInFunctions.hours.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationHours.bind(k.BuiltInFunctions)));M.functionHandlers.set("minutes",Qc(k.BuiltInFunctions.minutes.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationMinutes.bind(k.BuiltInFunctions)));M.functionHandlers.set("seconds",Qc(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 l3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",l3);M.functionHandlers.set("xsd:datetime",l3);var u3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",u3);M.functionHandlers.set("xsd:integer",u3);var f3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",f3);M.functionHandlers.set("xsd:decimal",f3);var d3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",d3);M.functionHandlers.set("xsd:daytimeduration",d3);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"))});M.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:n}=Zu();throw new n})});var Op=S(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.FilterExecutor=Yc.FilterExecutorError=void 0;var yt=Pp(),l9=h3(),u9=Ae(),La=Ne(),_r=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Yc.FilterExecutorError=_r;var C1=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 _r(`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 _r("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new _r(`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 _r("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 _r(`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 _r("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:""}:e!==null&&typeof e=="object"&&"termType"in e?e:e instanceof u9.IRI||e instanceof La.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 _r(`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 _r("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 _r("Division by zero");return s/a;default:throw new _r(`Unknown arithmetic operator: ${String(e.operator)}`)}}isDayTimeDurationValue(e){return e instanceof La.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof La.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof La.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 _r(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof La.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 La.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof La.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=l9.functionHandlers.get(i);if(!a)throw new _r(`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 _r(`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 _r("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 La.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 _r("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)}};Yc.FilterExecutor=C1});var R1=S(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.OptionalExecutor=void 0;var I1=class{static{o(this,"OptionalExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(r,i)}async executeAll(e,t){let r=[];for(let i of this.hashJoin(e,t))r.push(i);return r}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let r=new Set;for(let l of e)for(let u of l.variables())r.add(u);let i=new Set;for(let l of t)for(let u of l.variables())i.add(u);let s=[];for(let l of r)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let a="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,a),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,a),f=c.get(u),d=!1;if(f)for(let h of f){let p=l.merge(h);p!==null&&(yield p,d=!0)}d||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let a=e.get(s);i.push(a!==void 0?a.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let a=r.merge(s);a!==null&&(yield a,i=!0)}i||(yield r)}}};Fp.OptionalExecutor=I1});var O1=S(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.UnionExecutor=void 0;var P1=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("|")}};Dp.UnionExecutor=P1});var p3=S(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});Np.MinusExecutor=void 0;var F1=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}};Np.MinusExecutor=F1});var g3=S(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.ValuesExecutor=Kc.ValuesExecutorError=void 0;var f9=cs(),m3=Ae(),d9=Ne(),Lp=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Kc.ValuesExecutorError=Lp;var D1=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 f9.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 m3.IRI(e.value);if(e.type==="literal")return new d9.Literal(e.value,e.datatype?new m3.IRI(e.datatype):void 0,e.language,e.direction);throw new Lp(`Unknown term type: ${e.type}`)}};Kc.ValuesExecutor=D1});var N1=S(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.CustomAggregateRegistry=Jc.CustomAggregateError=void 0;var Xc=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Jc.CustomAggregateError=Xc;var kp=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 Xc("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new Xc("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new Xc(`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}};Jc.CustomAggregateRegistry=kp;kp.instance=null});var L1=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=Mp;Je.createDecimalLiteral=pi;Je.createDoubleLiteral=m9;Je.createPercentileAggregate=Po;var Oo=Ne(),Zc=Ae(),h9=new Zc.IRI("http://www.w3.org/2001/XMLSchema#decimal"),p9=new Zc.IRI("http://www.w3.org/2001/XMLSchema#double");Je.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Mp(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof Oo.Literal?parseFloat(n.value):n instanceof Zc.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(Mp,"getNumericValue");function pi(n){return new Oo.Literal(String(n),h9)}o(pi,"createDecimalLiteral");function m9(n){return new Oo.Literal(String(n),p9)}o(m9,"createDoubleLiteral");Je.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Mp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return pi(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 pi(s)}};Je.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Mp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return pi(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 pi(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 pi(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 pi(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 Oo.Literal||e instanceof Zc.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 Oo.Literal(" ",new Zc.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 Oo.Literal)return i;let s=parseFloat(t);return isNaN(s)?new Oo.Literal(t,new Zc.IRI("http://www.w3.org/2001/XMLSchema#string")):pi(s)}};function Po(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=Mp(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return pi(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 pi(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return pi(f)}}}o(Po,"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`]:Po(25),[`${Je.EXO_AGGREGATE_NS}percentile50`]:Po(50),[`${Je.EXO_AGGREGATE_NS}percentile75`]:Po(75),[`${Je.EXO_AGGREGATE_NS}percentile90`]:Po(90),[`${Je.EXO_AGGREGATE_NS}percentile95`]:Po(95),[`${Je.EXO_AGGREGATE_NS}percentile99`]:Po(99)}});var S3=S(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.AggregateExecutor=el.AggregateExecutorError=void 0;var fr=Ne(),M1=Ae(),g9=Op(),y9=N1(),_9=L1(),y3=new M1.IRI("http://www.w3.org/2001/XMLSchema#integer"),Fo=new M1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),us=new M1.IRI("http://www.w3.org/2001/XMLSchema#string");function _3(n){return typeof n=="object"&&n.type==="custom"}o(_3,"isCustomAggregation");var ef=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};el.AggregateExecutorError=ef;var k1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new g9.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}=cs(),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(_3(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 fr.Literal(String(s),y3)}case"sum":{let s=this.computeSum(r);return new fr.Literal(String(s),Fo)}case"avg":{let s=this.computeAvg(r);return new fr.Literal(String(s),Fo)}case"min":{let s=this.computeMin(r);return s===void 0?new fr.Literal("",us):typeof s=="number"?new fr.Literal(String(s),Fo):new fr.Literal(String(s),us)}case"max":{let s=this.computeMax(r);return s===void 0?new fr.Literal("",us):typeof s=="number"?new fr.Literal(String(s),Fo):new fr.Literal(String(s),us)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new fr.Literal(s||" ",us)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new fr.Literal(" ",us):typeof s=="number"?new fr.Literal(String(s),Fo):new fr.Literal(String(s),us)}default:{let s=i;throw new ef(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=y9.CustomAggregateRegistry.getInstance().get(i);if(a||(a=_9.BUILT_IN_AGGREGATES[i]),!a)throw new ef(`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}=cs(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(_3(s)){r.set(i.variable,new fr.Literal("0",Fo));continue}switch(s){case"count":r.set(i.variable,new fr.Literal("0",y3));break;case"sum":case"avg":r.set(i.variable,new fr.Literal("0",Fo));break;case"group_concat":r.set(i.variable,new fr.Literal(" ",us));break;case"min":case"max":case"sample":r.set(i.variable,new fr.Literal("",us));break;default:r.set(i.variable,new fr.Literal("",us))}}return r}};el.AggregateExecutor=k1});var B1=S(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});jp.ConstructExecutor=void 0;var S9=Qn(),Do=Ae(),j1=Ne(),$1=qt(),v9=Ou(),V1=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 S9.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 Do.IRI(e.value);if(e.type==="literal")return new j1.Literal(e.value,e.datatype?new Do.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new $1.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 v9.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 j1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new Do.IRI(e.value);if(e.type==="blank")return new $1.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 Do.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new Do.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 Do.IRI(e.value);if(e.type==="blank")return new $1.BlankNode(e.value);if(e.type==="literal")return new j1.Literal(e.value,e.datatype?new Do.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}`)}};jp.ConstructExecutor=V1});var b3=S(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.ServiceExecutor=tl.ServiceExecutorError=void 0;var b9=cs(),v3=Ae(),w9=Ne(),E9=qt(),No=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};tl.ServiceExecutorError=No;var U1=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 No(`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 No(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new No(`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 b9.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 v3.IRI(e.value);case"literal":{let t=e.datatype?new v3.IRI(e.datatype):void 0;return new w9.Literal(e.value,t,e["xml:lang"])}case"bnode":return new E9.BlankNode(e.value);default:throw new No(`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))}};tl.ServiceExecutor=U1});var E3=S(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.GraphExecutor=rl.GraphExecutorError=void 0;var w3=Ae(),$p=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};rl.GraphExecutorError=$p;var q1=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 $p(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new w3.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 w3.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}}};rl.GraphExecutor=q1});var T3=S(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.SPARQLGenerator=il.SPARQLGeneratorError=void 0;var nl=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};il.SPARQLGeneratorError=nl;var W1=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(Lj.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}};tp.VaultPrefixTransformer=K_});var jc=S(xn=>{"use strict";var Mj=xn&&xn.__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]})),jj=xn&&xn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),$j=xn&&xn.__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 jj(t,e),t}})();Object.defineProperty(xn,"__esModule",{value:!0});xn.SPARQLParser=xn.ExoQLParser=xn.SPARQLParseError=void 0;var jA=$j(NA()),J_=W_(),Z_=G_(),$A=LA(),e1=H_(),Vj=kA(),t1=MA(),Bj=X_(),cr=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}};xn.SPARQLParseError=cr;var rp=class{static{o(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new jA.Parser({sparqlStar:!0}),this.generator=new jA.Generator({sparqlStar:!0}),this.caseWhenTransformer=new J_.CaseWhenTransformer,this.lateralTransformer=new Z_.LateralTransformer,this.prefixStarTransformer=new $A.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new e1.DescribeOptionsTransformer,this.directionalLangTagTransformer=new Vj.DirectionalLangTagTransformer,this.tripleTermTransformer=new t1.TripleTermTransformer,this.vaultPrefixTransformer=new Bj.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 e1.DescribeOptionsTransformerError)throw new cr(t.message);if(t instanceof Z_.LateralTransformerError)throw new cr(t.message);if(t instanceof J_.CaseWhenTransformerError)throw new cr(t.message);if(t instanceof t1.TripleTermTransformerError)throw new cr(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 cr(`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 e1.DescribeOptionsTransformerError)throw new cr(t.message);if(t instanceof $A.PrefixStarTransformerError)throw new cr(t.message);if(t instanceof Z_.LateralTransformerError)throw new cr(t.message);if(t instanceof J_.CaseWhenTransformerError)throw new cr(t.message);if(t instanceof t1.TripleTermTransformerError)throw new cr(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 cr(`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 cr(`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 cr("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 cr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new cr(`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 cr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};xn.ExoQLParser=rp;xn.SPARQLParser=rp});var Po=S(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.AlgebraTranslatorError=void 0;var r1=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};np.AlgebraTranslatorError=r1});var ip=S(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.isVariableExpression=Uj;os.isVariableTerm=qj;os.isNamedNode=Wj;os.isLiteral=Gj;os.isPropertyPath=zj;os.isAggregateExpression=Hj;os.isOperationExpression=Qj;os.isFunctionCallExpression=Yj;function Uj(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}o(Uj,"isVariableExpression");function qj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}o(qj,"isVariableTerm");function Wj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}o(Wj,"isNamedNode");function Gj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}o(Gj,"isLiteral");function zj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}o(zj,"isPropertyPath");function Hj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}o(Hj,"isAggregateExpression");function Qj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}o(Qj,"isOperationExpression");function Yj(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}o(Yj,"isFunctionCallExpression")});var VA=S(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.TripleTranslator=void 0;var fn=Po(),n1=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 fn.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 fn.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 fn.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new fn.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 fn.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new fn.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new fn.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new fn.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new fn.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 fn.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new fn.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 fn.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new fn.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 fn.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 fn.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};sp.TripleTranslator=n1});var BA=S(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.ExpressionTranslator=void 0;var $c=Po(),i1=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 $c.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 $c.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new $c.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 $c.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 $c.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 $c.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"}}};ap.ExpressionTranslator=i1});var WA=S(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.PatternTranslator=void 0;var UA=G_(),Nr=Po(),qA=ip(),s1=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 Nr.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 Nr.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 Nr.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Nr.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 Nr.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 Nr.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 Nr.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 Nr.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 Nr.AlgebraTranslatorError(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Nr.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 Nr.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 Nr.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Nr.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 Nr.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Nr.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 Nr.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 Nr.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,qA.isVariableTerm)(i)&&i.value===UA.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,qA.isVariableTerm)(i)&&i.value===UA.LateralTransformer.LATERAL_MARKER))}}};op.PatternTranslator=s1});var zA=S(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});cp.AggregateTranslator=void 0;var GA=Po(),Kj=ip(),a1=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,Kj.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 GA.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 GA.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)}}}};cp.AggregateTranslator=a1});var Vc=S(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.AlgebraTranslator=Oa.ExoQLAlgebraTranslator=Oa.AlgebraTranslatorError=void 0;var lp=Po(),up=ip(),Xj=VA(),Jj=BA(),Zj=WA(),e9=zA(),t9=Po();Object.defineProperty(Oa,"AlgebraTranslatorError",{enumerable:!0,get:o(function(){return t9.AlgebraTranslatorError},"get")});var fp=class{static{o(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new Xj.TripleTranslator,this.expressionTranslator=new Jj.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 Zj.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 e9.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 lp.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 lp.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new lp.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,up.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,up.isVariableTerm)(u)||(0,up.isVariableExpression)(u)).map(u=>(0,up.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 lp.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}}};Oa.ExoQLAlgebraTranslator=fp;Oa.AlgebraTranslator=fp});var cs=S(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});dp.SolutionMapping=void 0;var HA=Ne(),QA=Ae(),YA=qt(),o1=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 HA.Literal&&t instanceof HA.Literal?e.equals(t):e instanceof QA.IRI&&t instanceof QA.IRI?e.value===t.value:e instanceof YA.BlankNode&&t instanceof YA.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}};dp.SolutionMapping=o1});var XA=S(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.PropertyPathExecutor=Bc.PropertyPathExecutorError=void 0;var r9=cs(),hp=Ae(),KA=qt(),n9=Ne(),Yu=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Bc.PropertyPathExecutorError=Yu;var c1=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){if(this.isLiteralElement(e)||this.isLiteralElement(r)){let a=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:r,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l;console.warn(`[PropertyPathExecutor] literal-safety guard fired: literal in ${a} position \u2014 yielding 0 solutions. value="${u}"`);return}let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new r9.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 Yu("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 hp.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let c=a.shift();if(!c)break;let{node:l,depth:u}=c;if(u>=this.MAX_DEPTH)continue;let f=await this.evaluatePathItem(l,t,null);for(let d of f){let h=this.nodeToKey(d);(r===null||this.nodeInSet(d,r))&&s.add(d),i.has(h)||(i.add(h),a.push({node:d,depth:u+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new hp.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"|":return{type:"path",pathType:"|",items:e.items.map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"+":case"*":case"?":{let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new hp.IRI(e.value));break;case"blank":t.add(new KA.BlankNode(e.value));break;default:throw new Yu(`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 hp.IRI)return{type:"iri",value:r.value};if(r instanceof KA.BlankNode)return{type:"blank",value:r.id};if(r instanceof n9.Literal)return{type:"literal",value:r.value,datatype:r.datatype?.value,language:r.language,direction:r.direction}}}return e}isVariable(e){return e.type==="variable"}isLiteralElement(e){return e.type==="literal"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};Bc.PropertyPathExecutor=c1});var f1=S(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.BGPExecutor=Uc.BGPExecutorError=void 0;var pp=cs(),Fa=Ae(),l1=Ne(),mp=qt(),gp=Ou(),i9=XA(),zr=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Uc.BGPExecutorError=zr;var u1=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new i9.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new pp.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 pp.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 zr("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:r);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new zr("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 pp.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){if(this.isLiteral(e.subject)||this.isLiteral(e.object)){this.warnLiteralGuard("matchTriplePattern.propertyPath",this.isLiteral(e.subject)?"subject":"object",this.isLiteral(e.subject)?e.subject:e.object);return}yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:t);return}let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new pp.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 gp.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 Fa.IRI&&e.value===t.value;case"literal":return!(!(t instanceof l1.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof mp.BlankNode&&e.value===t.id;case"quoted":return t instanceof gp.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 Fa.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,r){let i="value"in r?String(r.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i;console.warn(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Fa.IRI(e.value);case"blank":return new mp.BlankNode(e.value);case"literal":throw new zr("Literals cannot appear in subject position");case"variable":throw new zr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new zr(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new Fa.IRI(e.predicate.value):(()=>{throw new zr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new gp.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Fa.IRI(e.value);case"literal":throw new zr("Literals cannot appear in predicate position");case"blank":throw new zr("Blank nodes cannot appear in predicate position");case"variable":throw new zr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new zr(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Fa.IRI(e.value);case"literal":return new l1.Literal(e.value,e.datatype?new Fa.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new mp.BlankNode(e.value);case"variable":throw new zr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new zr(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof Fa.IRI)return{type:"iri",value:e.value};if(e instanceof l1.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof mp.BlankNode)return{type:"blank",value:e.id};if(e instanceof gp.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new zr(`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)}}};Uc.BGPExecutor=u1});var JA=S(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});yp.StringFunctions=void 0;var qc=Ae(),Da=Ne(),d1=qt(),Ku=class n{static{o(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof qc.IRI||e instanceof Da.Literal?e.value:e instanceof d1.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof Da.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof Da.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 Da.Literal)r=e.value;else if(e instanceof qc.IRI)r=e.value;else if(e instanceof d1.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 Da.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof qc.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 Da.Literal(s,new qc.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 Da.Literal)t=e.value;else if(e instanceof qc.IRI)t=e.value;else if(e instanceof d1.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 Da.Literal(r,new qc.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}};yp.StringFunctions=Ku;Ku.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Ku.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 ZA=S(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.MathFunctions=void 0;var h1=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()}};_p.MathFunctions=h1});var vp=S(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.DateTimeParsing=void 0;var s9=Ae(),a9=Ne(),p1=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 a9.Literal(e,new s9.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(r[1],10),s=parseInt(r[2],10)-1,a=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,a));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,d=parseInt(u[2],10),h=parseInt(u[3],10),p=f*(d*60+h)*60*1e3;l=new Date(l.getTime()-p)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),a=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||a<0||a>59||i===24&&(s!==0||a!==0))return null;let u=0;if(c){let d=c.padEnd(3,"0").slice(0,3);u=parseInt(d,10)}let f=i*60*60*1e3+s*60*1e3+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let h=d[1]==="+"?1:-1,p=parseInt(d[2],10),y=parseInt(d[3],10),v=h*(p*60+y)*60*1e3;f-=v}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+a;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,a=t?"-P":"P";return i>0&&(a+=`${i}Y`),(s>0||i===0)&&(a+=`${s}M`),a}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:a,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=0,a=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.substring(l+1)),u){let d=u.match(/^(\d+(?:\.\d+)?)D$/);if(d)i=parseFloat(d[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let d=f,h=d.match(/^(\d+(?:\.\d+)?)H/);h&&(s=parseFloat(h[1]),d=d.substring(h[0].length));let p=d.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),d=d.substring(p[0].length));let y=d.match(/^(\d+(?:\.\d+)?)S$/);if(y&&(c=parseFloat(y[1]),d=d.substring(y[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}};Sp.DateTimeParsing=p1});var e3=S(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.DateTimeArithmetic=void 0;var dn=Ae(),xe=Ne(),Xe=vp(),m1=class{static{o(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(l,new dn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(l.toISOString(),new dn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(l.toISOString(),new dn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(h,new dn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(h,new dn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(s.toISOString(),new dn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(s.toISOString(),new dn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(d,new dn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.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 xe.Literal(d,new dn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s+a);return new xe.Literal(c,new dn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s-a);return new xe.Literal(c,new dn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof xe.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i*t);return new xe.Literal(s,new dn.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 xe.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i/t);return new xe.Literal(s,new dn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s+a);return new xe.Literal(c,new dn.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof xe.Literal?e.value:e,i=t instanceof xe.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s-a);return new xe.Literal(c,new dn.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof xe.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof xe.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof xe.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof xe.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/1e3}};bp.DateTimeArithmetic=m1});var t3=S(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.DateTimeAccessors=void 0;var Xu=Ae(),$t=Ne(),Tt=vp(),g1=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 $t.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 $t.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 $t.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 $t.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof $t.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof $t.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 $t.Literal(r,new Xu.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 $t.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let te=i.getUTCFullYear(),z=String(i.getUTCMonth()+1).padStart(2,"0"),G=String(i.getUTCDate()).padStart(2,"0"),F=String(i.getUTCHours()).padStart(2,"0"),$=String(i.getUTCMinutes()).padStart(2,"0"),re=String(i.getUTCSeconds()).padStart(2,"0"),Ye=i.getUTCMilliseconds(),st=`${te}-${z}-${G}T${F}:${$}:${re}`;return Ye>0&&(st+=`.${String(Ye).padStart(3,"0")}`),new $t.Literal(st,new Xu.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof $t.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(a)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+a),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),h=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),y=String(u.getUTCMinutes()).padStart(2,"0"),v=String(u.getUTCSeconds()).padStart(2,"0"),E=u.getUTCMilliseconds(),b=a>=0?"+":"-",A=Math.floor(Math.abs(a)/(3600*1e3)),I=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),j=`${b}${String(A).padStart(2,"0")}:${String(I).padStart(2,"0")}`,B=`${f}-${d}-${h}T${p}:${y}:${v}`;return E>0&&(B+=`.${String(E).padStart(3,"0")}`),B+=j,new $t.Literal(B,new Xu.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 $t.Literal?e.value:e,s=t instanceof $t.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 $t.Literal?e.value:e,i=t instanceof $t.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 $t.Literal(l,new Xu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof $t.Literal?e.value:e,i=t instanceof $t.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 $t.Literal(u,new Xu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};wp.DateTimeAccessors=g1});var Tp=S(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});Ep.DateTimeFunctions=void 0;var Wc=vp(),lr=e3(),gt=t3(),y1=class{static{o(this,"DateTimeFunctions")}static parseDate(e){return Wc.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Wc.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Wc.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Wc.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Wc.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Wc.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 lr.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return lr.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return lr.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return lr.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return lr.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return lr.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return lr.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return lr.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return lr.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return lr.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return lr.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return lr.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return lr.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return lr.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return lr.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return lr.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return lr.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return lr.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return lr.DateTimeArithmetic.durationToSeconds(e)}};Ep.DateTimeFunctions=y1});var r3=S(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});xp.LogicalFunctions=void 0;var o9=Ae(),Gc=Ne(),c9=qt(),Ap=Tp(),_1=class n{static{o(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return Ap.DateTimeFunctions.compareDurations(e instanceof Gc.Literal?e:String(e),t instanceof Gc.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return Ap.DateTimeFunctions.compareDurations(e instanceof Gc.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return Ap.DateTimeFunctions.compareDurations(e,t instanceof Gc.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 Gc.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 Gc.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 Ap.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof o9.IRI?e.value:e instanceof c9.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}};xp.LogicalFunctions=_1});var n3=S(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});Cp.RDFTermFunctions=void 0;var Lr=Ae(),vt=Ne(),hi=qt(),zc=Ou(),S1=En(),v1=class n{static{o(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof vt.Literal)return e.datatype?e.datatype:e.language?new Lr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Lr.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 Lr.IRI}static isBlank(e){return e===void 0?!1:e instanceof hi.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof vt.Literal}static isTriple(e){return e===void 0?!1:e instanceof zc.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof vt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof vt.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 vt.Literal(t.toISOString(),new Lr.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 vt.Literal(String(t),new Lr.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 vt.Literal(String(t),new Lr.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 Lr.IRI&&t instanceof Lr.IRI)return e.value===t.value;if(e instanceof hi.BlankNode&&t instanceof hi.BlankNode)return e.id===t.id;if(e instanceof vt.Literal&&t instanceof vt.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 Lr.IRI)return e;if(e instanceof vt.Literal)return new Lr.IRI(e.value);throw e instanceof hi.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,S1.v4)().replace(/-/g,"").substring(0,12)}`;return new hi.BlankNode(t)}if(e instanceof vt.Literal)return new hi.BlankNode(e.value);if(e instanceof hi.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 vt.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 Lr.IRI)i=t;else if(t instanceof vt.Literal)i=new Lr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new vt.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 vt.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 vt.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 vt.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 vt.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 vt.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 vt.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 vt.Literal(i,void 0,s,a)}static uuid(){let e=(0,S1.v4)();return new Lr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,S1.v4)();return new vt.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 vt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Lr.IRI)){let c=t instanceof vt.Literal?"Literal":t instanceof hi.BlankNode?"BlankNode":t instanceof zc.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new zc.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof zc.QuotedTriple)){let t=e instanceof Lr.IRI?"IRI":e instanceof vt.Literal?"Literal":e instanceof hi.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 zc.QuotedTriple)){let t=e instanceof Lr.IRI?"IRI":e instanceof vt.Literal?"Literal":e instanceof hi.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 zc.QuotedTriple)){let t=e instanceof Lr.IRI?"IRI":e instanceof vt.Literal?"Literal":e instanceof hi.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};Cp.RDFTermFunctions=v1});var i3=S(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.HashFunctions=void 0;var b1=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")}};Ip.HashFunctions=b1});var Pp=S(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});Rp.BuiltInFunctions=void 0;var ur=JA(),Na=ZA(),ce=Tp(),Hc=r3(),Ft=n3(),Ju=i3(),w1=class{static{o(this,"BuiltInFunctions")}static str(...e){return ur.StringFunctions.str(...e)}static lang(...e){return ur.StringFunctions.lang(...e)}static langdir(...e){return ur.StringFunctions.langdir(...e)}static langMatches(...e){return ur.StringFunctions.langMatches(...e)}static regex(...e){return ur.StringFunctions.regex(...e)}static contains(...e){return ur.StringFunctions.contains(...e)}static strStarts(...e){return ur.StringFunctions.strStarts(...e)}static strEnds(...e){return ur.StringFunctions.strEnds(...e)}static strlen(...e){return ur.StringFunctions.strlen(...e)}static ucase(...e){return ur.StringFunctions.ucase(...e)}static lcase(...e){return ur.StringFunctions.lcase(...e)}static substr(...e){return ur.StringFunctions.substr(...e)}static strBefore(...e){return ur.StringFunctions.strBefore(...e)}static strAfter(...e){return ur.StringFunctions.strAfter(...e)}static concat(...e){return ur.StringFunctions.concat(...e)}static replace(...e){return ur.StringFunctions.replace(...e)}static encodeForUri(...e){return ur.StringFunctions.encodeForUri(...e)}static normalize(...e){return ur.StringFunctions.normalize(...e)}static fold(...e){return ur.StringFunctions.fold(...e)}static abs(...e){return Na.MathFunctions.abs(...e)}static round(...e){return Na.MathFunctions.round(...e)}static ceil(...e){return Na.MathFunctions.ceil(...e)}static floor(...e){return Na.MathFunctions.floor(...e)}static rand(){return Na.MathFunctions.rand()}static msToMinutes(...e){return Na.MathFunctions.msToMinutes(...e)}static msToHours(...e){return Na.MathFunctions.msToHours(...e)}static msToSeconds(...e){return Na.MathFunctions.msToSeconds(...e)}static parseDate(...e){return ce.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return ce.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return ce.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return ce.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return ce.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return ce.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return ce.DateTimeFunctions.year(...e)}static month(...e){return ce.DateTimeFunctions.month(...e)}static day(...e){return ce.DateTimeFunctions.day(...e)}static hours(...e){return ce.DateTimeFunctions.hours(...e)}static minutes(...e){return ce.DateTimeFunctions.minutes(...e)}static seconds(...e){return ce.DateTimeFunctions.seconds(...e)}static timezone(...e){return ce.DateTimeFunctions.timezone(...e)}static tz(...e){return ce.DateTimeFunctions.tz(...e)}static now(){return ce.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return ce.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return ce.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return ce.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return ce.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return ce.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return ce.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return ce.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return ce.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return ce.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return ce.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return ce.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return ce.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return ce.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return ce.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return ce.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return ce.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return ce.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return ce.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return ce.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return ce.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return ce.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return ce.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return ce.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return ce.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return ce.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return ce.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return ce.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return ce.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return ce.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return ce.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return ce.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return ce.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return ce.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return ce.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return ce.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return ce.DateTimeFunctions.adjust(...e)}static isTime(...e){return ce.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return ce.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Hc.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Hc.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Hc.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Hc.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Hc.LogicalFunctions.coalesce(...e)}static if(...e){return Hc.LogicalFunctions.if(...e)}static datatype(...e){return Ft.RDFTermFunctions.datatype(...e)}static bound(...e){return Ft.RDFTermFunctions.bound(...e)}static isIRI(...e){return Ft.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return Ft.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return Ft.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return Ft.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return Ft.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return Ft.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return Ft.RDFTermFunctions.sameTerm(...e)}static iri(...e){return Ft.RDFTermFunctions.iri(...e)}static uri(...e){return Ft.RDFTermFunctions.uri(...e)}static bnode(...e){return Ft.RDFTermFunctions.bnode(...e)}static strdt(...e){return Ft.RDFTermFunctions.strdt(...e)}static strlang(...e){return Ft.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return Ft.RDFTermFunctions.strlangdir(...e)}static uuid(){return Ft.RDFTermFunctions.uuid()}static struuid(){return Ft.RDFTermFunctions.struuid()}static xsdDateTime(...e){return Ft.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return Ft.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return Ft.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return Ft.RDFTermFunctions.triple(...e)}static subject(...e){return Ft.RDFTermFunctions.subject(...e)}static predicate(...e){return Ft.RDFTermFunctions.predicate(...e)}static object(...e){return Ft.RDFTermFunctions.object(...e)}static md5(...e){return Ju.HashFunctions.md5(...e)}static sha1(...e){return Ju.HashFunctions.sha1(...e)}static sha256(...e){return Ju.HashFunctions.sha256(...e)}static sha384(...e){return Ju.HashFunctions.sha384(...e)}static sha512(...e){return Ju.HashFunctions.sha512(...e)}};Rp.BuiltInFunctions=w1});var Zu=S(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.ExoQLBudgetExceededError=ls.ExoQLCycleError=ls.ExoQLEvalDisabledError=ls.ExoQLForbiddenKeywordError=void 0;var E1=class extends Error{static{o(this,"ExoQLForbiddenKeywordError")}constructor(e,t){super(t??`ExoQLForbiddenKeywordError: keyword "${e}" is not permitted by the exoql__Query AST allowlist`),this.name="ExoQLForbiddenKeywordError",this.keyword=e}};ls.ExoQLForbiddenKeywordError=E1;var T1=class extends Error{static{o(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};ls.ExoQLEvalDisabledError=T1;var A1=class extends Error{static{o(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};ls.ExoQLCycleError=A1;var x1=class extends Error{static{o(this,"ExoQLBudgetExceededError")}constructor(e,t,r,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${r})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=r}};ls.ExoQLBudgetExceededError=x1});var h3=S(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var k=Pp();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 s3=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",s3);M.functionHandlers.set("isuri",s3);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 Qc=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"),a3=Qc(k.BuiltInFunctions.year.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationYears.bind(k.BuiltInFunctions),null);M.functionHandlers.set("year",a3);M.functionHandlers.set("years",a3);var o3=Qc(k.BuiltInFunctions.month.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationMonths.bind(k.BuiltInFunctions),null);M.functionHandlers.set("month",o3);M.functionHandlers.set("months",o3);var c3=Qc(k.BuiltInFunctions.day.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationDays.bind(k.BuiltInFunctions));M.functionHandlers.set("day",c3);M.functionHandlers.set("days",c3);M.functionHandlers.set("hours",Qc(k.BuiltInFunctions.hours.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationHours.bind(k.BuiltInFunctions)));M.functionHandlers.set("minutes",Qc(k.BuiltInFunctions.minutes.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationMinutes.bind(k.BuiltInFunctions)));M.functionHandlers.set("seconds",Qc(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 l3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",l3);M.functionHandlers.set("xsd:datetime",l3);var u3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",u3);M.functionHandlers.set("xsd:integer",u3);var f3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",f3);M.functionHandlers.set("xsd:decimal",f3);var d3=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",d3);M.functionHandlers.set("xsd:daytimeduration",d3);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"))});M.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:n}=Zu();throw new n})});var Op=S(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.FilterExecutor=Yc.FilterExecutorError=void 0;var yt=Pp(),l9=h3(),u9=Ae(),La=Ne(),_r=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Yc.FilterExecutorError=_r;var C1=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 _r(`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 _r("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new _r(`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 _r("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 _r(`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 _r("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:""}:e!==null&&typeof e=="object"&&"termType"in e?e:e instanceof u9.IRI||e instanceof La.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 _r(`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 _r("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 _r("Division by zero");return s/a;default:throw new _r(`Unknown arithmetic operator: ${String(e.operator)}`)}}isDayTimeDurationValue(e){return e instanceof La.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof La.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof La.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 _r(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof La.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 La.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof La.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=l9.functionHandlers.get(i);if(!a)throw new _r(`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 _r(`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 _r("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 La.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 _r("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)}};Yc.FilterExecutor=C1});var R1=S(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.OptionalExecutor=void 0;var I1=class{static{o(this,"OptionalExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(r,i)}async executeAll(e,t){let r=[];for(let i of this.hashJoin(e,t))r.push(i);return r}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let r=new Set;for(let l of e)for(let u of l.variables())r.add(u);let i=new Set;for(let l of t)for(let u of l.variables())i.add(u);let s=[];for(let l of r)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let a="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,a),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,a),f=c.get(u),d=!1;if(f)for(let h of f){let p=l.merge(h);p!==null&&(yield p,d=!0)}d||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let a=e.get(s);i.push(a!==void 0?a.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let a=r.merge(s);a!==null&&(yield a,i=!0)}i||(yield r)}}};Fp.OptionalExecutor=I1});var O1=S(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.UnionExecutor=void 0;var P1=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("|")}};Dp.UnionExecutor=P1});var p3=S(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});Np.MinusExecutor=void 0;var F1=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}};Np.MinusExecutor=F1});var g3=S(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.ValuesExecutor=Kc.ValuesExecutorError=void 0;var f9=cs(),m3=Ae(),d9=Ne(),Lp=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Kc.ValuesExecutorError=Lp;var D1=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 f9.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 m3.IRI(e.value);if(e.type==="literal")return new d9.Literal(e.value,e.datatype?new m3.IRI(e.datatype):void 0,e.language,e.direction);throw new Lp(`Unknown term type: ${e.type}`)}};Kc.ValuesExecutor=D1});var N1=S(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.CustomAggregateRegistry=Jc.CustomAggregateError=void 0;var Xc=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Jc.CustomAggregateError=Xc;var kp=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 Xc("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new Xc("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new Xc(`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}};Jc.CustomAggregateRegistry=kp;kp.instance=null});var L1=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=Mp;Je.createDecimalLiteral=pi;Je.createDoubleLiteral=m9;Je.createPercentileAggregate=Oo;var Fo=Ne(),Zc=Ae(),h9=new Zc.IRI("http://www.w3.org/2001/XMLSchema#decimal"),p9=new Zc.IRI("http://www.w3.org/2001/XMLSchema#double");Je.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Mp(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof Fo.Literal?parseFloat(n.value):n instanceof Zc.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(Mp,"getNumericValue");function pi(n){return new Fo.Literal(String(n),h9)}o(pi,"createDecimalLiteral");function m9(n){return new Fo.Literal(String(n),p9)}o(m9,"createDoubleLiteral");Je.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Mp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return pi(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 pi(s)}};Je.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Mp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return pi(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 pi(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 pi(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 pi(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 Fo.Literal||e instanceof Zc.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 Fo.Literal(" ",new Zc.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 Fo.Literal)return i;let s=parseFloat(t);return isNaN(s)?new Fo.Literal(t,new Zc.IRI("http://www.w3.org/2001/XMLSchema#string")):pi(s)}};function Oo(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=Mp(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return pi(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 pi(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return pi(f)}}}o(Oo,"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`]:Oo(25),[`${Je.EXO_AGGREGATE_NS}percentile50`]:Oo(50),[`${Je.EXO_AGGREGATE_NS}percentile75`]:Oo(75),[`${Je.EXO_AGGREGATE_NS}percentile90`]:Oo(90),[`${Je.EXO_AGGREGATE_NS}percentile95`]:Oo(95),[`${Je.EXO_AGGREGATE_NS}percentile99`]:Oo(99)}});var S3=S(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.AggregateExecutor=el.AggregateExecutorError=void 0;var fr=Ne(),M1=Ae(),g9=Op(),y9=N1(),_9=L1(),y3=new M1.IRI("http://www.w3.org/2001/XMLSchema#integer"),Do=new M1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),us=new M1.IRI("http://www.w3.org/2001/XMLSchema#string");function _3(n){return typeof n=="object"&&n.type==="custom"}o(_3,"isCustomAggregation");var ef=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};el.AggregateExecutorError=ef;var k1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new g9.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}=cs(),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(_3(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 fr.Literal(String(s),y3)}case"sum":{let s=this.computeSum(r);return new fr.Literal(String(s),Do)}case"avg":{let s=this.computeAvg(r);return new fr.Literal(String(s),Do)}case"min":{let s=this.computeMin(r);return s===void 0?new fr.Literal("",us):typeof s=="number"?new fr.Literal(String(s),Do):new fr.Literal(String(s),us)}case"max":{let s=this.computeMax(r);return s===void 0?new fr.Literal("",us):typeof s=="number"?new fr.Literal(String(s),Do):new fr.Literal(String(s),us)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new fr.Literal(s||" ",us)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new fr.Literal(" ",us):typeof s=="number"?new fr.Literal(String(s),Do):new fr.Literal(String(s),us)}default:{let s=i;throw new ef(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=y9.CustomAggregateRegistry.getInstance().get(i);if(a||(a=_9.BUILT_IN_AGGREGATES[i]),!a)throw new ef(`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}=cs(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(_3(s)){r.set(i.variable,new fr.Literal("0",Do));continue}switch(s){case"count":r.set(i.variable,new fr.Literal("0",y3));break;case"sum":case"avg":r.set(i.variable,new fr.Literal("0",Do));break;case"group_concat":r.set(i.variable,new fr.Literal(" ",us));break;case"min":case"max":case"sample":r.set(i.variable,new fr.Literal("",us));break;default:r.set(i.variable,new fr.Literal("",us))}}return r}};el.AggregateExecutor=k1});var B1=S(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});jp.ConstructExecutor=void 0;var S9=Qn(),No=Ae(),j1=Ne(),$1=qt(),v9=Ou(),V1=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 S9.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 No.IRI(e.value);if(e.type==="literal")return new j1.Literal(e.value,e.datatype?new No.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new $1.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 v9.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 j1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new No.IRI(e.value);if(e.type==="blank")return new $1.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 No.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new No.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 No.IRI(e.value);if(e.type==="blank")return new $1.BlankNode(e.value);if(e.type==="literal")return new j1.Literal(e.value,e.datatype?new No.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}`)}};jp.ConstructExecutor=V1});var b3=S(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.ServiceExecutor=tl.ServiceExecutorError=void 0;var b9=cs(),v3=Ae(),w9=Ne(),E9=qt(),Lo=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};tl.ServiceExecutorError=Lo;var U1=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 Lo(`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 Lo(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Lo(`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 b9.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 v3.IRI(e.value);case"literal":{let t=e.datatype?new v3.IRI(e.datatype):void 0;return new w9.Literal(e.value,t,e["xml:lang"])}case"bnode":return new E9.BlankNode(e.value);default:throw new Lo(`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))}};tl.ServiceExecutor=U1});var E3=S(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.GraphExecutor=rl.GraphExecutorError=void 0;var w3=Ae(),$p=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};rl.GraphExecutorError=$p;var q1=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 $p(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new w3.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 w3.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}}};rl.GraphExecutor=q1});var T3=S(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.SPARQLGenerator=il.SPARQLGeneratorError=void 0;var nl=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};il.SPARQLGeneratorError=nl;var W1=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)}
@@ -88,7 +88,7 @@ ${Object.entries(t).map(([a,c])=>this.serializeValue(a,c)).join(`
88
88
  ${r}`}return`${e}: ${String(t)}`}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};Wp.FrontmatterService=nf;nf.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/;nf.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 Hr=S(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});Gp.DateFormatter=void 0;var Z1=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)}};Gp.DateFormatter=Z1});var ka=S(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.LoggingService=void 0;var sf=class{static{o(this,"LoggingService")}static setVerbose(e){this.isVerbose=e}static setDevelopmentMode(e){this.isDevelopment=e}static checkIsDevelopment(){return this.isDevelopment!==void 0?this.isDevelopment:typeof process<"u"?(this.isDevelopment=!1,this.isDevelopment):(this.isDevelopment=!1,this.isDevelopment)}static debug(e,t){this.isVerbose&&console.debug(`[Exocortex] ${e}`,t??"")}static info(e,t){console.log(`[Exocortex] ${e}`,t??"")}static warn(e,t){console.warn(`[Exocortex] ${e}`,t??"")}static error(e,t,r){let i=this.checkIsDevelopment(),s=r?` [${r}]`:"";if(i){let a=t?.stack?`
89
89
  Stack trace:
90
90
  ${t.stack}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`,t??"")}else{let a=t?.message?`
91
- Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`)}}};zp.LoggingService=sf;sf.isVerbose=!1;sf.isDevelopment=void 0});var P3=S(gi=>{"use strict";var c5=gi&&gi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},l5=gi&&gi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(gi,"__esModule",{value:!0});gi.GroundingExecutor=gi.ServiceRegistry=void 0;var u5=ue(),f5=En(),Lo=wc(),d5=Jn(),h5=Hr(),p5=ka();function m5(n){if(!n)return;let e=n.match(/^"?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]"?$/);return e?e[1]:n}o(m5,"extractClassFromTargetValue");var Hp=class{static{o(this,"ServiceRegistry")}constructor(){this.services=new Map}register(e,t){this.services.set(e,t)}get(e){return this.services.get(e)}has(e){return this.services.has(e)}getRegisteredIds(){return Array.from(this.services.keys())}};gi.ServiceRegistry=Hp;var R3=20,eS=class{static{o(this,"GroundingExecutor")}constructor(e,t,r){this.frontmatterService=new d5.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r}async execute(e,t,r,i){try{switch(e.type){case Lo.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case Lo.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case Lo.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case Lo.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case Lo.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,i);case Lo.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>=R3)return{success:!1,error:`Composite grounding exceeded maximum depth of ${R3}`};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=m5(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=this.substituteVariables(e.targetValue,t,i),u=JSON.parse(l);typeof u=="object"&&u!==null&&(c={...u,...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,f5.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===Lo.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){p5.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=h5.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}};gi.GroundingExecutor=eS;gi.GroundingExecutor=eS=c5([(0,u5.injectable)(),l5("design:paramtypes",[Object,Object,Hp])],eS)});var af=S(Ks=>{"use strict";var g5=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},y5=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.WorkflowEngine=void 0;var _5=ue(),tS=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}}};Ks.WorkflowEngine=tS;Ks.WorkflowEngine=tS=g5([(0,_5.injectable)(),y5("design:paramtypes",[Object])],tS)});var O3=S(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.EFFORT_WORKFLOW_PROPERTY=fs.WorkflowTransitionProperty=fs.WorkflowStateProperty=fs.WorkflowProperty=void 0;fs.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};fs.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"};fs.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"};fs.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var ds=S(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});Qp.MetadataHelpers=void 0;var rS=class{static{o(this,"MetadataHelpers")}static findAllReferencingProperties(e,t){let r=[];for(let[i,s]of Object.entries(e))this.containsReference(s,t)&&r.push(i);return r}static findReferencingProperty(e,t){for(let[r,i]of Object.entries(e))if(this.containsReference(i,t))return r}static containsReference(e,t){if(!e)return!1;let r=t.replace(/\.md$/,"");if(typeof e=="string"){let i=/\[\[([^\[\]]+)\]\]/g,s;for(;(s=i.exec(e))!==null;){let c=s[1].split("|")[0].trim();if(c===r||c.endsWith(`/${r}`))return!0}return!1}return Array.isArray(e)?e.some(i=>this.containsReference(i,t)):!1}static isAssetArchived(e){let t=e?.exo__Asset_isArchived;if(t!=null){if(t===!0||t===1)return!0;if(typeof t=="string"){let i=t.toLowerCase().trim();if(i==="true"||i==="yes"||i==="1")return!0}if(typeof t=="boolean")return t}let r=e?.archived;if(r==null)return!1;if(typeof r=="boolean")return r;if(typeof r=="number")return r!==0;if(typeof r=="string"){let i=r.toLowerCase().trim();return i==="true"||i==="yes"||i==="1"}return!1}static getPropertyValue(e,t){return t==="Name"||t==="title"?e.title:t==="created"?e.created:t==="modified"?e.modified:t==="path"?e.path:e.metadata?.[t]}static ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}static buildFileContent(e,t){let r=Object.entries(e).map(([a,c])=>{if(Array.isArray(c)){let l=c.map(u=>` - ${u}`).join(`
91
+ Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`)}}};zp.LoggingService=sf;sf.isVerbose=!1;sf.isDevelopment=void 0});var P3=S(gi=>{"use strict";var c5=gi&&gi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},l5=gi&&gi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(gi,"__esModule",{value:!0});gi.GroundingExecutor=gi.ServiceRegistry=void 0;var u5=ue(),f5=En(),ko=wc(),d5=Jn(),h5=Hr(),p5=ka();function m5(n){if(!n)return;let e=n.match(/^"?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]"?$/);return e?e[1]:n}o(m5,"extractClassFromTargetValue");var Hp=class{static{o(this,"ServiceRegistry")}constructor(){this.services=new Map}register(e,t){this.services.set(e,t)}get(e){return this.services.get(e)}has(e){return this.services.has(e)}getRegisteredIds(){return Array.from(this.services.keys())}};gi.ServiceRegistry=Hp;var R3=20,eS=class{static{o(this,"GroundingExecutor")}constructor(e,t,r){this.frontmatterService=new d5.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r}async execute(e,t,r,i){try{switch(e.type){case ko.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case ko.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case ko.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case ko.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case ko.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,i);case ko.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>=R3)return{success:!1,error:`Composite grounding exceeded maximum depth of ${R3}`};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=m5(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=this.substituteVariables(e.targetValue,t,i),u=JSON.parse(l);typeof u=="object"&&u!==null&&(c={...u,...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,f5.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===ko.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){p5.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=h5.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}};gi.GroundingExecutor=eS;gi.GroundingExecutor=eS=c5([(0,u5.injectable)(),l5("design:paramtypes",[Object,Object,Hp])],eS)});var af=S(Ks=>{"use strict";var g5=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},y5=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.WorkflowEngine=void 0;var _5=ue(),tS=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}}};Ks.WorkflowEngine=tS;Ks.WorkflowEngine=tS=g5([(0,_5.injectable)(),y5("design:paramtypes",[Object])],tS)});var O3=S(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.EFFORT_WORKFLOW_PROPERTY=fs.WorkflowTransitionProperty=fs.WorkflowStateProperty=fs.WorkflowProperty=void 0;fs.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};fs.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"};fs.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"};fs.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var ds=S(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});Qp.MetadataHelpers=void 0;var rS=class{static{o(this,"MetadataHelpers")}static findAllReferencingProperties(e,t){let r=[];for(let[i,s]of Object.entries(e))this.containsReference(s,t)&&r.push(i);return r}static findReferencingProperty(e,t){for(let[r,i]of Object.entries(e))if(this.containsReference(i,t))return r}static containsReference(e,t){if(!e)return!1;let r=t.replace(/\.md$/,"");if(typeof e=="string"){let i=/\[\[([^\[\]]+)\]\]/g,s;for(;(s=i.exec(e))!==null;){let c=s[1].split("|")[0].trim();if(c===r||c.endsWith(`/${r}`))return!0}return!1}return Array.isArray(e)?e.some(i=>this.containsReference(i,t)):!1}static isAssetArchived(e){let t=e?.exo__Asset_isArchived;if(t!=null){if(t===!0||t===1)return!0;if(typeof t=="string"){let i=t.toLowerCase().trim();if(i==="true"||i==="yes"||i==="1")return!0}if(typeof t=="boolean")return t}let r=e?.archived;if(r==null)return!1;if(typeof r=="boolean")return r;if(typeof r=="number")return r!==0;if(typeof r=="string"){let i=r.toLowerCase().trim();return i==="true"||i==="yes"||i==="1"}return!1}static getPropertyValue(e,t){return t==="Name"||t==="title"?e.title:t==="created"?e.created:t==="modified"?e.modified:t==="path"?e.path:e.metadata?.[t]}static ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}static buildFileContent(e,t){let r=Object.entries(e).map(([a,c])=>{if(Array.isArray(c)){let l=c.map(u=>` - ${u}`).join(`
92
92
  `);return`${a}:
93
93
  ${l}`}return`${a}: ${c}`}).join(`
94
94
  `),i=t;if(i===void 0){let a=e.exo__Asset_label;typeof a=="string"&&a.trim()!==""&&(i=`# ${a}`)}let s=i?`
@@ -97,11 +97,11 @@ ${i}
97
97
  `;return`---
98
98
  ${r}
99
99
  ---
100
- ${s}`}};Qp.MetadataHelpers=rS});var D3=S(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.TASK_DEFAULT_WORKFLOW=ko.PROJECT_DEFAULT_WORKFLOW=void 0;ko.buildWorkflowAssetContent=S5;var F3=En(),of=Ru(),we=bc(),Qr=O3(),nS=ds();ko.PROJECT_DEFAULT_WORKFLOW={id:"a1b2c3d4-1111-4000-a000-000000000001",name:"Project Default Workflow",targetClass:of.AssetClass.PROJECT,initialState:we.EffortStatus.DRAFT,terminalStates:[we.EffortStatus.DONE,we.EffortStatus.TRASHED],isDefault:!0,states:[{status:we.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:we.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:we.EffortStatus.ANALYSIS,order:3,optional:!0,timestampOnEnter:[]},{status:we.EffortStatus.TODO,order:4,optional:!0,timestampOnEnter:[]},{status:we.EffortStatus.DOING,order:5,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:we.EffortStatus.DONE,order:6,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:we.EffortStatus.TRASHED,order:7,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:we.EffortStatus.DRAFT,to:we.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:we.EffortStatus.BACKLOG,to:we.EffortStatus.ANALYSIS,label:"\u2192 Analysis",isRollback:!1},{from:we.EffortStatus.ANALYSIS,to:we.EffortStatus.TODO,label:"\u2192 ToDo",isRollback:!1},{from:we.EffortStatus.TODO,to:we.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:we.EffortStatus.DOING,to:we.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:we.EffortStatus.BACKLOG,to:we.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:we.EffortStatus.ANALYSIS,to:we.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:we.EffortStatus.TODO,to:we.EffortStatus.ANALYSIS,label:"\u2190 Analysis",isRollback:!0},{from:we.EffortStatus.DOING,to:we.EffortStatus.TODO,label:"\u2190 ToDo",isRollback:!0},{from:we.EffortStatus.DONE,to:we.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]};ko.TASK_DEFAULT_WORKFLOW={id:"a1b2c3d4-2222-4000-a000-000000000002",name:"Task Default Workflow",targetClass:of.AssetClass.TASK,initialState:we.EffortStatus.DRAFT,terminalStates:[we.EffortStatus.DONE,we.EffortStatus.TRASHED],isDefault:!0,states:[{status:we.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:we.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:we.EffortStatus.DOING,order:3,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:we.EffortStatus.DONE,order:4,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:we.EffortStatus.TRASHED,order:5,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:we.EffortStatus.DRAFT,to:we.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:we.EffortStatus.BACKLOG,to:we.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:we.EffortStatus.DOING,to:we.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:we.EffortStatus.BACKLOG,to:we.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:we.EffortStatus.DOING,to:we.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:we.EffortStatus.DONE,to:we.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]};function S5(n){let e=new Date().toISOString(),t=[],r=n.id,i={exo__Asset_uid:r,exo__Asset_label:`"${n.name}"`,exo__Asset_createdAt:e,exo__Instance_class:of.AssetClass.WORKFLOW,[Qr.WorkflowProperty.TARGET_CLASS]:`"[[${n.targetClass}]]"`,[Qr.WorkflowProperty.INITIAL_STATE]:`"[[${n.initialState}]]"`,[Qr.WorkflowProperty.TERMINAL_STATES]:n.terminalStates.map(s=>`"[[${s}]]"`),[Qr.WorkflowProperty.IS_DEFAULT]:n.isDefault};t.push({filename:`${r}.md`,content:nS.MetadataHelpers.buildFileContent(i)});for(let s of n.states){let a=(0,F3.v4)(),c={exo__Asset_uid:a,exo__Asset_label:`"${n.name} - ${s.status}"`,exo__Asset_createdAt:e,exo__Instance_class:of.AssetClass.WORKFLOW_STATE,[Qr.WorkflowStateProperty.WORKFLOW]:`"[[${r}]]"`,[Qr.WorkflowStateProperty.STATUS]:`"[[${s.status}]]"`,[Qr.WorkflowStateProperty.ORDER]:s.order,[Qr.WorkflowStateProperty.OPTIONAL]:s.optional};s.timestampOnEnter.length>0&&(c[Qr.WorkflowStateProperty.TIMESTAMP_ON_ENTER]=s.timestampOnEnter),s.badgeColor&&(c[Qr.WorkflowStateProperty.BADGE_COLOR]=`"${s.badgeColor}"`),t.push({filename:`${a}.md`,content:nS.MetadataHelpers.buildFileContent(c)})}for(let s of n.transitions){let a=(0,F3.v4)(),c={exo__Asset_uid:a,exo__Asset_label:`"${n.name} - ${s.label}"`,exo__Asset_createdAt:e,exo__Instance_class:of.AssetClass.WORKFLOW_TRANSITION,[Qr.WorkflowTransitionProperty.WORKFLOW]:`"[[${r}]]"`,[Qr.WorkflowTransitionProperty.FROM]:`"[[${s.from}]]"`,[Qr.WorkflowTransitionProperty.TO]:`"[[${s.to}]]"`,[Qr.WorkflowTransitionProperty.LABEL]:`"${s.label}"`,[Qr.WorkflowTransitionProperty.IS_ROLLBACK]:s.isRollback};s.icon&&(c[Qr.WorkflowTransitionProperty.ICON]=`"${s.icon}"`),t.push({filename:`${a}.md`,content:nS.MetadataHelpers.buildFileContent(c)})}return t}o(S5,"buildWorkflowAssetContent")});var sS=S(Xs=>{"use strict";var v5=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},b5=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.WorkflowResolver=void 0;var w5=ue(),cf=Ae(),dn=Ne(),bt=yr(),Mo=Ru(),Yp=bc(),N3=D3(),iS=class{static{o(this,"WorkflowResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async resolveForClass(e){let t=`class:${e}`,r=this.cache.get(t);if(r)return r;let s=await this.findDefaultWorkflow(e)??this.getHardcodedFallback(e);return this.cache.set(t,s),s}async resolveForAsset(e,t){let r=await this.tripleStore.match(e,bt.Namespace.EMS.term("Effort_workflow"),void 0);if(r.length>0){let i=r[0].object;if(i instanceof cf.IRI){let s=await this.loadWorkflowBySubject(i);if(s)return s}}return this.resolveForClass(t)}invalidateCache(){this.cache.clear()}async findDefaultWorkflow(e){let t=await this.tripleStore.match(void 0,bt.Namespace.RDF.term("type"),bt.Namespace.EMS.term("Workflow"));for(let r of t){let i=r.subject;if(!(!(await this.tripleStore.match(i,bt.Namespace.EMS.term("Workflow_targetClass"),void 0)).some(u=>{let f=u.object;return f instanceof cf.IRI?f.value.endsWith(e.replace(/^ems__/,"")):f instanceof dn.Literal?this.normalizeWikilink(f.value)===e:!1})||!(await this.tripleStore.match(i,bt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(u=>{let f=u.object instanceof dn.Literal?u.object.value:"";return f==="true"||f==="1"})))return this.loadWorkflowBySubject(i)}return null}async loadWorkflowBySubject(e){let t=await this.tripleStore.match(e,bt.Namespace.EXO.term("Asset_label"),void 0),r=t.length>0&&t[0].object instanceof dn.Literal?t[0].object.value:"Unknown Workflow",i=await this.tripleStore.match(e,bt.Namespace.EXO.term("Asset_uid"),void 0),s=i.length>0&&i[0].object instanceof dn.Literal?i[0].object.value:e.value,a=await this.tripleStore.match(e,bt.Namespace.EMS.term("Workflow_targetClass"),void 0),c=this.resolveAssetClass(a),l=await this.tripleStore.match(e,bt.Namespace.EMS.term("Workflow_initialState"),void 0),u=this.resolveEffortStatus(l)??Yp.EffortStatus.DRAFT,f=await this.tripleStore.match(e,bt.Namespace.EMS.term("Workflow_terminalStates"),void 0),d=this.resolveEffortStatuses(f),p=(await this.tripleStore.match(e,bt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(E=>{let b=E.object instanceof dn.Literal?E.object.value:"";return b==="true"||b==="1"}),y=await this.loadStates(e),v=await this.loadTransitions(e);return y.length===0&&v.length===0?null:{id:s,name:r,targetClass:c,states:y,transitions:v,initialState:u,terminalStates:d.length>0?d:[Yp.EffortStatus.DONE,Yp.EffortStatus.TRASHED],isDefault:p}}async loadStates(e){let t=await this.tripleStore.match(void 0,bt.Namespace.RDF.term("type"),bt.Namespace.EMS.term("WorkflowState")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_workflow"),void 0)).some(A=>this.isSameSubject(A.object,e)))continue;let l=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_status"),void 0),u=this.resolveEffortStatus(l);if(!u)continue;let f=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_order"),void 0),d=f.length>0&&f[0].object instanceof dn.Literal&&parseInt(f[0].object.value,10)||0,p=(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_optional"),void 0)).some(A=>{let I=A.object instanceof dn.Literal?A.object.value:"";return I==="true"||I==="1"}),v=(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_timestampOnEnter"),void 0)).map(A=>A.object instanceof dn.Literal?A.object.value:"").filter(A=>A.length>0),E=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_badgeColor"),void 0),b=E.length>0&&E[0].object instanceof dn.Literal?E[0].object.value:void 0;r.push({status:u,order:d,optional:p,timestampOnEnter:v,badgeColor:b})}return r.sort((i,s)=>i.order-s.order)}async loadTransitions(e){let t=await this.tripleStore.match(void 0,bt.Namespace.RDF.term("type"),bt.Namespace.EMS.term("WorkflowTransition")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_workflow"),void 0)).some(A=>this.isSameSubject(A.object,e)))continue;let l=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_from"),void 0),u=this.resolveEffortStatus(l),f=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_to"),void 0),d=this.resolveEffortStatus(f);if(!u||!d)continue;let h=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_label"),void 0),p=h.length>0&&h[0].object instanceof dn.Literal?h[0].object.value:`${u} \u2192 ${d}`,y=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_icon"),void 0),v=y.length>0&&y[0].object instanceof dn.Literal?y[0].object.value:void 0,b=(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_isRollback"),void 0)).some(A=>{let I=A.object instanceof dn.Literal?A.object.value:"";return I==="true"||I==="1"});r.push({from:u,to:d,label:p,icon:v,isRollback:b})}return r}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}resolveAssetClass(e){if(e.length===0)return Mo.AssetClass.TASK;let t=e[0].object;if(t instanceof cf.IRI){let i=`ems__${t.value.split("#").pop()??""}`;return Object.values(Mo.AssetClass).includes(i)?i:Mo.AssetClass.TASK}if(t instanceof dn.Literal){let r=this.normalizeWikilink(t.value);return Object.values(Mo.AssetClass).includes(r)?r:Mo.AssetClass.TASK}return Mo.AssetClass.TASK}resolveEffortStatus(e){if(e.length===0)return null;let t=e[0].object,r;if(t instanceof cf.IRI)r=`ems__${t.value.split("#").pop()??""}`;else if(t instanceof dn.Literal)r=this.normalizeWikilink(t.value);else return null;return Object.values(Yp.EffortStatus).includes(r)?r:null}resolveEffortStatuses(e){return e.map(t=>this.resolveEffortStatus([t])).filter(t=>t!==null)}isSameSubject(e,t){if(e instanceof cf.IRI)return e.value===t.value;if(e instanceof dn.Literal){let r=this.normalizeWikilink(e.value);return t.value.includes(r)}return!1}getHardcodedFallback(e){return e===Mo.AssetClass.PROJECT?{...N3.PROJECT_DEFAULT_WORKFLOW}:{...N3.TASK_DEFAULT_WORKFLOW}}};Xs.WorkflowResolver=iS;Xs.WorkflowResolver=iS=v5([(0,w5.injectable)(),b5("design:paramtypes",[Object])],iS)});var lS=S(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.TransactionError=Ma.TripleNotFoundError=Ma.TripleAlreadyExistsError=void 0;var aS=class extends Error{static{o(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};Ma.TripleAlreadyExistsError=aS;var oS=class extends Error{static{o(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};Ma.TripleNotFoundError=oS;var cS=class extends Error{static{o(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};Ma.TransactionError=cS});var Xp=S(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.LRUCache=void 0;var uS=class{static{o(this,"LRUCache")}constructor(e){this.maxSize=e,this.cache=new Map}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};Kp.LRUCache=uS});var hS=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.InMemoryTripleStore=void 0;var ja=lS(),Jp=Ae(),E5=qt(),T5=Ne(),A5=yr(),x5=Xp(),C5=A5.Namespace.XSD.term("string").value,I5=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,cl="__default__",fS=class n{static{o(this,"InMemoryTripleStore")}constructor(){this.triples=new Map,this.spo=new Map,this.sop=new Map,this.pso=new Map,this.pos=new Map,this.osp=new Map,this.ops=new Map,this.queryCache=new x5.LRUCache(1e3),this.uuidIndex=new Map,this.namedGraphs=new Map}async add(e){let t=this.getTripleKey(e);if(this.triples.has(t))return;this.triples.set(t,e);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);this.addToIndex(this.spo,r,i,s),this.addToIndex(this.sop,r,s,i),this.addToIndex(this.pso,i,r,s),this.addToIndex(this.pos,i,s,r),this.addToIndex(this.osp,s,r,i),this.addToIndex(this.ops,s,i,r),this.addToUUIDIndex(e.subject),this.queryCache.clear()}async remove(e){let t=this.getTripleKey(e);if(!this.triples.has(t))return!1;this.triples.delete(t);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);return this.removeFromIndex(this.spo,r,i,s),this.removeFromIndex(this.sop,r,s,i),this.removeFromIndex(this.pso,i,r,s),this.removeFromIndex(this.pos,i,s,r),this.removeFromIndex(this.osp,s,r,i),this.removeFromIndex(this.ops,s,i,r),this.queryCache.clear(),!0}async has(e){let t=this.getTripleKey(e);return this.triples.has(t)}async match(e,t,r){let i=this.getMatchCacheKey(e,t,r),s=this.queryCache.get(i);if(s!==void 0)return s;let a;return!e&&!t&&!r?a=Array.from(this.triples.values()):e&&t&&r?a=this.matchSPO(e,t,r):e&&t?a=this.matchSP(e,t):e&&r?a=this.matchSO(e,r):t&&r?a=this.matchPO(t,r):e?a=this.matchS(e):t?a=this.matchP(t):r?a=this.matchO(r):a=[],this.queryCache.set(i,a),a}async addAll(e){for(let t of e)await this.add(t)}async removeAll(e){let t=0;for(let r of e)await this.remove(r)&&t++;return t}async clear(){this.triples.clear(),this.spo.clear(),this.sop.clear(),this.pso.clear(),this.pos.clear(),this.osp.clear(),this.ops.clear(),this.uuidIndex.clear(),this.queryCache.clear()}async count(){return this.triples.size}async subjects(){let e=new Set;for(let t of this.triples.values())e.add(t.subject);return Array.from(e)}async predicates(){let e=new Set;for(let t of this.triples.values())e.add(t.predicate);return Array.from(e)}async objects(){let e=new Set;for(let t of this.triples.values())e.add(t.object);return Array.from(e)}async beginTransaction(){return new dS(this)}async findSubjectsByUUID(e){return this.findSubjectsByUUIDSync(e)}findSubjectsByUUIDSync(e){let t=e.toLowerCase(),r=this.uuidIndex.get(t);if(!r||r.size===0)return[];let i=[];for(let s of r)this.spo.has(`i:${s}`)&&i.push(new Jp.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof Jp.IRI))return;let t=e.value,r=t.match(I5);if(r)for(let i of r){let s=i.toLowerCase();this.uuidIndex.has(s)||this.uuidIndex.set(s,new Set),this.uuidIndex.get(s).add(t)}}matchSPO(e,t,r){let i=this.getNodeKey(e),s=this.getNodeKey(t),a=this.getNodeKey(r),c=this.spo.get(i);if(!c)return[];let l=c.get(s);if(!l)return[];if(l.has(a)){let u=this.buildTripleKey(i,s,a),f=this.triples.get(u);return f?[f]:[]}return[]}matchSP(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.spo.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,i,c))):[]}matchSO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.sop.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,c,i))):[]}matchPO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.pos.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(c,r,i))):[]}matchS(e){let t=this.getNodeKey(e),r=this.spo.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(t,s,c));return this.getTriplesByKeys(i)}matchP(e){let t=this.getNodeKey(e),r=this.pso.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,t,c));return this.getTriplesByKeys(i)}matchO(e){let t=this.getNodeKey(e),r=this.osp.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,c,t));return this.getTriplesByKeys(i)}getTriplesByKeys(e){let t=[];for(let r of e){let i=this.triples.get(r);i&&t.push(i)}return t}addToIndex(e,t,r,i){e.has(t)||e.set(t,new Map);let s=e.get(t);s.has(r)||s.set(r,new Set),s.get(r).add(i)}removeFromIndex(e,t,r,i){let s=e.get(t);if(!s)return;let a=s.get(r);a&&(a.delete(i),a.size===0&&s.delete(r),s.size===0&&e.delete(t))}getTripleKey(e){let t=this.getNodeKey(e.subject),r=this.getNodeKey(e.predicate),i=this.getNodeKey(e.object);return this.buildTripleKey(t,r,i)}buildTripleKey(e,t,r){return`${e}|${t}|${r}`}getNodeKey(e){if(e instanceof Jp.IRI)return`i:${e.value}`;if(e instanceof E5.BlankNode)return`b:${e.id}`;if(e instanceof T5.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==C5?t+=`^^${e.datatype.value}`:e.language&&(t+=`@${e.language}`),t}return""}getMatchCacheKey(e,t,r){let i=e?this.getNodeKey(e):"?",s=t?this.getNodeKey(t):"?",a=r?this.getNodeKey(r):"?";return`${i}|${s}|${a}`}getGraphKey(e){return e?e.value:cl}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===cl?this:(this.namedGraphs.has(t)||this.namedGraphs.set(t,new n),this.namedGraphs.get(t))}async addToGraph(e,t){await this.getOrCreateGraphStore(t).add(e)}async removeFromGraph(e,t){let r=this.getGraphKey(t);if(r===cl)return this.remove(e);let i=this.namedGraphs.get(r);return i?i.remove(e):!1}async matchInGraph(e,t,r,i){let s=this.getGraphKey(i);if(s===cl)return this.match(e,t,r);let a=this.namedGraphs.get(s);return a?a.match(e,t,r):[]}async getNamedGraphs(){return Array.from(this.namedGraphs.keys()).map(e=>new Jp.IRI(e))}async hasGraph(e){let t=this.namedGraphs.get(e.value);return t?await t.count()>0:!1}async clearGraph(e){let t=this.getGraphKey(e);if(t===cl){await this.clear();return}let r=this.namedGraphs.get(t);r&&(await r.clear(),this.namedGraphs.delete(t))}async countInGraph(e){let t=this.getGraphKey(e);if(t===cl)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Zp.InMemoryTripleStore=fS;var dS=class{static{o(this,"InMemoryTransaction")}constructor(e){this.store=e,this.operations=[],this.committed=!1,this.rolledBack=!1}async add(e){if(this.committed)throw new ja.TransactionError("Transaction already committed");if(this.rolledBack)throw new ja.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new ja.TransactionError("Transaction already committed");if(this.rolledBack)throw new ja.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new ja.TransactionError("Transaction already committed");if(this.rolledBack)throw new ja.TransactionError("Transaction already rolled back");for(let e of this.operations)e.type==="add"?await this.store.add(e.triple):await this.store.remove(e.triple);this.committed=!0,this.operations=[]}async rollback(){if(this.committed)throw new ja.TransactionError("Transaction already committed");if(this.rolledBack)throw new ja.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var tm=S(Js=>{"use strict";var R5=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},P5=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.EffortStatusWorkflow=void 0;var O5=ue(),em=kn(),F5=af(),D5=sS(),N5=hS(),pS=class{static{o(this,"EffortStatusWorkflow")}constructor(){this.resolver=new D5.WorkflowResolver(new N5.InMemoryTripleStore)}getPreviousStatus(e,t){let r=this.normalizeStatus(e),i=this.resolveDefinition(t),s=new F5.WorkflowEngine(i);if(s.isInitialState(r))return null;let a=s.getPreviousStatus(r);if(a!==null)return this.wrapStatus(a)}normalizeStatus(e){return e.replace(/["'[\]]/g,"").trim()}wrapStatus(e){return`"[[${e}]]"`}resolveDefinition(e){return this.hasInstanceClass(e,em.AssetClass.TASK)||this.hasInstanceClass(e,em.AssetClass.MEETING)?this.resolver.getHardcodedFallback(em.AssetClass.TASK):this.resolver.getHardcodedFallback(em.AssetClass.PROJECT)}hasInstanceClass(e,t){return e?(Array.isArray(e)?e:[e]).some(i=>i.replace(/["'[\]]/g,"").trim()===t):!1}};Js.EffortStatusWorkflow=pS;Js.EffortStatusWorkflow=pS=R5([(0,O5.injectable)(),P5("design:paramtypes",[])],pS)});var wt=S(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.DI_TOKENS=void 0;rm.DI_TOKENS={IFileSystemAdapter:Symbol.for("IFileSystemAdapter"),IVaultAdapter:Symbol.for("IVaultAdapter"),IVaultContext:Symbol.for("IVaultContext"),IMultiVaultManager:Symbol.for("IMultiVaultManager"),ILogger:Symbol.for("ILogger"),IEventBus:Symbol.for("IEventBus"),IConfiguration:Symbol.for("IConfiguration"),INotificationService:Symbol.for("INotificationService"),AreaCreationService:Symbol.for("AreaCreationService"),ClassCreationService:Symbol.for("ClassCreationService"),ConceptCreationService:Symbol.for("ConceptCreationService"),FleetingNoteCreationService:Symbol.for("FleetingNoteCreationService"),SupervisionCreationService:Symbol.for("SupervisionCreationService"),GenericAssetCreationService:Symbol.for("GenericAssetCreationService"),DynamicFrontmatterGenerator:Symbol.for("DynamicFrontmatterGenerator"),AlgorithmExtractor:Symbol.for("AlgorithmExtractor"),TaskStatusService:Symbol.for("TaskStatusService"),EffortStatusWorkflow:Symbol.for("EffortStatusWorkflow"),StatusTimestampService:Symbol.for("StatusTimestampService"),PropertyCleanupService:Symbol.for("PropertyCleanupService"),FolderRepairService:Symbol.for("FolderRepairService"),LabelToAliasService:Symbol.for("LabelToAliasService"),RenameToUidService:Symbol.for("RenameToUidService"),PlanningService:Symbol.for("PlanningService"),EffortVotingService:Symbol.for("EffortVotingService"),SessionEventService:Symbol.for("SessionEventService"),CriticalityZoneService:Symbol.for("CriticalityZoneService"),AssetConversionService:Symbol.for("AssetConversionService"),NoteToRDFConverter:Symbol.for("NoteToRDFConverter"),IVaultSettings:Symbol.for("IVaultSettings"),AreaHierarchyBuilder:Symbol.for("AreaHierarchyBuilder"),URIConstructionService:Symbol.for("URIConstructionService"),ClassHierarchyResolver:Symbol.for("ClassHierarchyResolver")}});var nm=S(yi=>{"use strict";var L5=yi&&yi.__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},k5=yi&&yi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},M5=yi&&yi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(yi,"__esModule",{value:!0});yi.StatusTimestampService=void 0;var L3=ue(),j5=Jn(),ll=Hr(),$5=wt(),mS=class{static{o(this,"StatusTimestampService")}constructor(e){this.vault=e,this.frontmatterService=new j5.FrontmatterService}async addStartTimestamp(e){let t=await this.vault.read(e),r=ll.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_startTimestamp",r);await this.vault.modify(e,i)}async addEndTimestamp(e,t){let r=await this.vault.read(e),i=t||new Date,s=ll.DateFormatter.toLocalTimestamp(i),a=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);await this.vault.modify(e,a)}async addResolutionTimestamp(e){let t=await this.vault.read(e),r=ll.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_resolutionTimestamp",r);await this.vault.modify(e,i)}async addReviewTimestamp(e){let t=await this.vault.read(e),r=ll.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_lastReviewTimestamp",r);await this.vault.modify(e,i)}async addEndAndResolutionTimestamps(e,t){let r=await this.vault.read(e),i=t||new Date,s=ll.DateFormatter.toLocalTimestamp(i),a=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);a=this.frontmatterService.updateProperty(a,"ems__Effort_resolutionTimestamp",s),await this.vault.modify(e,a)}async removeStartTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_startTimestamp");await this.vault.modify(e,r)}async removeEndTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");await this.vault.modify(e,r)}async removeResolutionTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_resolutionTimestamp");await this.vault.modify(e,r)}async removeEndAndResolutionTimestamps(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");r=this.frontmatterService.removeProperty(r,"ems__Effort_resolutionTimestamp"),await this.vault.modify(e,r)}async shiftPlannedEndTimestamp(e,t){let r=await this.vault.read(e),i=this.frontmatterService.parse(r);if(!i.exists)return;let s=this.frontmatterService.getPropertyValue(i.content,"ems__Effort_plannedEndTimestamp");if(!s)return;let a=new Date(s.replace(/["']/g,""));if(isNaN(a.getTime()))return;let c=new Date(a.getTime()+t),l=ll.DateFormatter.toLocalTimestamp(c),u=this.frontmatterService.updateProperty(r,"ems__Effort_plannedEndTimestamp",l);await this.vault.modify(e,u)}};yi.StatusTimestampService=mS;yi.StatusTimestampService=mS=L5([(0,L3.injectable)(),M5(0,(0,L3.inject)($5.DI_TOKENS.IVaultAdapter)),k5("design:paramtypes",[Object])],mS)});var yS=S(_i=>{"use strict";var V5=_i&&_i.__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},B5=_i&&_i.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},U5=_i&&_i.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(_i,"__esModule",{value:!0});_i.TaskStatusService=void 0;var k3=ue(),q5=Jn(),jo=Hr(),W5=tm(),G5=nm(),z5=wt(),gS=class{static{o(this,"TaskStatusService")}constructor(e,t,r){this.vault=e,this.workflow=t,this.timestampService=r,this.frontmatterService=new q5.FrontmatterService}async setDraftStatus(e){await this.updateStatus(e,"ems__EffortStatusDraft")}async moveToBacklog(e){await this.updateStatus(e,"ems__EffortStatusBacklog")}async moveToAnalysis(e){await this.updateStatus(e,"ems__EffortStatusAnalysis")}async moveToToDo(e){await this.updateStatus(e,"ems__EffortStatusToDo")}async startEffort(e){let t=await this.vault.read(e),r=jo.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');i=this.frontmatterService.updateProperty(i,"ems__Effort_startTimestamp",r),await this.vault.modify(e,i)}async markTaskAsDone(e){let t=await this.vault.read(e),r=jo.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');i=this.frontmatterService.updateProperty(i,"ems__Effort_endTimestamp",r),i=this.frontmatterService.updateProperty(i,"ems__Effort_resolutionTimestamp",r),await this.vault.modify(e,i)}async syncEffortEndTimestamp(e,t){await this.timestampService.addEndAndResolutionTimestamps(e,t)}async shiftPlannedEndTimestamp(e,t){await this.timestampService.shiftPlannedEndTimestamp(e,t)}async trashEffort(e,t){let r=await this.vault.read(e),i=jo.DateFormatter.toLocalTimestamp(new Date),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),t&&(s=this.appendTrashReason(s,t)),await this.vault.modify(e,s)}appendTrashReason(e,t){let r=`
100
+ ${s}`}};Qp.MetadataHelpers=rS});var D3=S(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.TASK_DEFAULT_WORKFLOW=Mo.PROJECT_DEFAULT_WORKFLOW=void 0;Mo.buildWorkflowAssetContent=S5;var F3=En(),of=Ru(),we=bc(),Qr=O3(),nS=ds();Mo.PROJECT_DEFAULT_WORKFLOW={id:"a1b2c3d4-1111-4000-a000-000000000001",name:"Project Default Workflow",targetClass:of.AssetClass.PROJECT,initialState:we.EffortStatus.DRAFT,terminalStates:[we.EffortStatus.DONE,we.EffortStatus.TRASHED],isDefault:!0,states:[{status:we.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:we.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:we.EffortStatus.ANALYSIS,order:3,optional:!0,timestampOnEnter:[]},{status:we.EffortStatus.TODO,order:4,optional:!0,timestampOnEnter:[]},{status:we.EffortStatus.DOING,order:5,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:we.EffortStatus.DONE,order:6,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:we.EffortStatus.TRASHED,order:7,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:we.EffortStatus.DRAFT,to:we.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:we.EffortStatus.BACKLOG,to:we.EffortStatus.ANALYSIS,label:"\u2192 Analysis",isRollback:!1},{from:we.EffortStatus.ANALYSIS,to:we.EffortStatus.TODO,label:"\u2192 ToDo",isRollback:!1},{from:we.EffortStatus.TODO,to:we.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:we.EffortStatus.DOING,to:we.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:we.EffortStatus.BACKLOG,to:we.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:we.EffortStatus.ANALYSIS,to:we.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:we.EffortStatus.TODO,to:we.EffortStatus.ANALYSIS,label:"\u2190 Analysis",isRollback:!0},{from:we.EffortStatus.DOING,to:we.EffortStatus.TODO,label:"\u2190 ToDo",isRollback:!0},{from:we.EffortStatus.DONE,to:we.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]};Mo.TASK_DEFAULT_WORKFLOW={id:"a1b2c3d4-2222-4000-a000-000000000002",name:"Task Default Workflow",targetClass:of.AssetClass.TASK,initialState:we.EffortStatus.DRAFT,terminalStates:[we.EffortStatus.DONE,we.EffortStatus.TRASHED],isDefault:!0,states:[{status:we.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:we.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:we.EffortStatus.DOING,order:3,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:we.EffortStatus.DONE,order:4,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:we.EffortStatus.TRASHED,order:5,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:we.EffortStatus.DRAFT,to:we.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:we.EffortStatus.BACKLOG,to:we.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:we.EffortStatus.DOING,to:we.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:we.EffortStatus.BACKLOG,to:we.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:we.EffortStatus.DOING,to:we.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:we.EffortStatus.DONE,to:we.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]};function S5(n){let e=new Date().toISOString(),t=[],r=n.id,i={exo__Asset_uid:r,exo__Asset_label:`"${n.name}"`,exo__Asset_createdAt:e,exo__Instance_class:of.AssetClass.WORKFLOW,[Qr.WorkflowProperty.TARGET_CLASS]:`"[[${n.targetClass}]]"`,[Qr.WorkflowProperty.INITIAL_STATE]:`"[[${n.initialState}]]"`,[Qr.WorkflowProperty.TERMINAL_STATES]:n.terminalStates.map(s=>`"[[${s}]]"`),[Qr.WorkflowProperty.IS_DEFAULT]:n.isDefault};t.push({filename:`${r}.md`,content:nS.MetadataHelpers.buildFileContent(i)});for(let s of n.states){let a=(0,F3.v4)(),c={exo__Asset_uid:a,exo__Asset_label:`"${n.name} - ${s.status}"`,exo__Asset_createdAt:e,exo__Instance_class:of.AssetClass.WORKFLOW_STATE,[Qr.WorkflowStateProperty.WORKFLOW]:`"[[${r}]]"`,[Qr.WorkflowStateProperty.STATUS]:`"[[${s.status}]]"`,[Qr.WorkflowStateProperty.ORDER]:s.order,[Qr.WorkflowStateProperty.OPTIONAL]:s.optional};s.timestampOnEnter.length>0&&(c[Qr.WorkflowStateProperty.TIMESTAMP_ON_ENTER]=s.timestampOnEnter),s.badgeColor&&(c[Qr.WorkflowStateProperty.BADGE_COLOR]=`"${s.badgeColor}"`),t.push({filename:`${a}.md`,content:nS.MetadataHelpers.buildFileContent(c)})}for(let s of n.transitions){let a=(0,F3.v4)(),c={exo__Asset_uid:a,exo__Asset_label:`"${n.name} - ${s.label}"`,exo__Asset_createdAt:e,exo__Instance_class:of.AssetClass.WORKFLOW_TRANSITION,[Qr.WorkflowTransitionProperty.WORKFLOW]:`"[[${r}]]"`,[Qr.WorkflowTransitionProperty.FROM]:`"[[${s.from}]]"`,[Qr.WorkflowTransitionProperty.TO]:`"[[${s.to}]]"`,[Qr.WorkflowTransitionProperty.LABEL]:`"${s.label}"`,[Qr.WorkflowTransitionProperty.IS_ROLLBACK]:s.isRollback};s.icon&&(c[Qr.WorkflowTransitionProperty.ICON]=`"${s.icon}"`),t.push({filename:`${a}.md`,content:nS.MetadataHelpers.buildFileContent(c)})}return t}o(S5,"buildWorkflowAssetContent")});var sS=S(Xs=>{"use strict";var v5=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},b5=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.WorkflowResolver=void 0;var w5=ue(),cf=Ae(),hn=Ne(),bt=yr(),jo=Ru(),Yp=bc(),N3=D3(),iS=class{static{o(this,"WorkflowResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async resolveForClass(e){let t=`class:${e}`,r=this.cache.get(t);if(r)return r;let s=await this.findDefaultWorkflow(e)??this.getHardcodedFallback(e);return this.cache.set(t,s),s}async resolveForAsset(e,t){let r=await this.tripleStore.match(e,bt.Namespace.EMS.term("Effort_workflow"),void 0);if(r.length>0){let i=r[0].object;if(i instanceof cf.IRI){let s=await this.loadWorkflowBySubject(i);if(s)return s}}return this.resolveForClass(t)}invalidateCache(){this.cache.clear()}async findDefaultWorkflow(e){let t=await this.tripleStore.match(void 0,bt.Namespace.RDF.term("type"),bt.Namespace.EMS.term("Workflow"));for(let r of t){let i=r.subject;if(!(!(await this.tripleStore.match(i,bt.Namespace.EMS.term("Workflow_targetClass"),void 0)).some(u=>{let f=u.object;return f instanceof cf.IRI?f.value.endsWith(e.replace(/^ems__/,"")):f instanceof hn.Literal?this.normalizeWikilink(f.value)===e:!1})||!(await this.tripleStore.match(i,bt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(u=>{let f=u.object instanceof hn.Literal?u.object.value:"";return f==="true"||f==="1"})))return this.loadWorkflowBySubject(i)}return null}async loadWorkflowBySubject(e){let t=await this.tripleStore.match(e,bt.Namespace.EXO.term("Asset_label"),void 0),r=t.length>0&&t[0].object instanceof hn.Literal?t[0].object.value:"Unknown Workflow",i=await this.tripleStore.match(e,bt.Namespace.EXO.term("Asset_uid"),void 0),s=i.length>0&&i[0].object instanceof hn.Literal?i[0].object.value:e.value,a=await this.tripleStore.match(e,bt.Namespace.EMS.term("Workflow_targetClass"),void 0),c=this.resolveAssetClass(a),l=await this.tripleStore.match(e,bt.Namespace.EMS.term("Workflow_initialState"),void 0),u=this.resolveEffortStatus(l)??Yp.EffortStatus.DRAFT,f=await this.tripleStore.match(e,bt.Namespace.EMS.term("Workflow_terminalStates"),void 0),d=this.resolveEffortStatuses(f),p=(await this.tripleStore.match(e,bt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(E=>{let b=E.object instanceof hn.Literal?E.object.value:"";return b==="true"||b==="1"}),y=await this.loadStates(e),v=await this.loadTransitions(e);return y.length===0&&v.length===0?null:{id:s,name:r,targetClass:c,states:y,transitions:v,initialState:u,terminalStates:d.length>0?d:[Yp.EffortStatus.DONE,Yp.EffortStatus.TRASHED],isDefault:p}}async loadStates(e){let t=await this.tripleStore.match(void 0,bt.Namespace.RDF.term("type"),bt.Namespace.EMS.term("WorkflowState")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_workflow"),void 0)).some(A=>this.isSameSubject(A.object,e)))continue;let l=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_status"),void 0),u=this.resolveEffortStatus(l);if(!u)continue;let f=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_order"),void 0),d=f.length>0&&f[0].object instanceof hn.Literal&&parseInt(f[0].object.value,10)||0,p=(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_optional"),void 0)).some(A=>{let I=A.object instanceof hn.Literal?A.object.value:"";return I==="true"||I==="1"}),v=(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_timestampOnEnter"),void 0)).map(A=>A.object instanceof hn.Literal?A.object.value:"").filter(A=>A.length>0),E=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowState_badgeColor"),void 0),b=E.length>0&&E[0].object instanceof hn.Literal?E[0].object.value:void 0;r.push({status:u,order:d,optional:p,timestampOnEnter:v,badgeColor:b})}return r.sort((i,s)=>i.order-s.order)}async loadTransitions(e){let t=await this.tripleStore.match(void 0,bt.Namespace.RDF.term("type"),bt.Namespace.EMS.term("WorkflowTransition")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_workflow"),void 0)).some(A=>this.isSameSubject(A.object,e)))continue;let l=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_from"),void 0),u=this.resolveEffortStatus(l),f=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_to"),void 0),d=this.resolveEffortStatus(f);if(!u||!d)continue;let h=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_label"),void 0),p=h.length>0&&h[0].object instanceof hn.Literal?h[0].object.value:`${u} \u2192 ${d}`,y=await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_icon"),void 0),v=y.length>0&&y[0].object instanceof hn.Literal?y[0].object.value:void 0,b=(await this.tripleStore.match(s,bt.Namespace.EMS.term("WorkflowTransition_isRollback"),void 0)).some(A=>{let I=A.object instanceof hn.Literal?A.object.value:"";return I==="true"||I==="1"});r.push({from:u,to:d,label:p,icon:v,isRollback:b})}return r}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}resolveAssetClass(e){if(e.length===0)return jo.AssetClass.TASK;let t=e[0].object;if(t instanceof cf.IRI){let i=`ems__${t.value.split("#").pop()??""}`;return Object.values(jo.AssetClass).includes(i)?i:jo.AssetClass.TASK}if(t instanceof hn.Literal){let r=this.normalizeWikilink(t.value);return Object.values(jo.AssetClass).includes(r)?r:jo.AssetClass.TASK}return jo.AssetClass.TASK}resolveEffortStatus(e){if(e.length===0)return null;let t=e[0].object,r;if(t instanceof cf.IRI)r=`ems__${t.value.split("#").pop()??""}`;else if(t instanceof hn.Literal)r=this.normalizeWikilink(t.value);else return null;return Object.values(Yp.EffortStatus).includes(r)?r:null}resolveEffortStatuses(e){return e.map(t=>this.resolveEffortStatus([t])).filter(t=>t!==null)}isSameSubject(e,t){if(e instanceof cf.IRI)return e.value===t.value;if(e instanceof hn.Literal){let r=this.normalizeWikilink(e.value);return t.value.includes(r)}return!1}getHardcodedFallback(e){return e===jo.AssetClass.PROJECT?{...N3.PROJECT_DEFAULT_WORKFLOW}:{...N3.TASK_DEFAULT_WORKFLOW}}};Xs.WorkflowResolver=iS;Xs.WorkflowResolver=iS=v5([(0,w5.injectable)(),b5("design:paramtypes",[Object])],iS)});var lS=S(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.TransactionError=Ma.TripleNotFoundError=Ma.TripleAlreadyExistsError=void 0;var aS=class extends Error{static{o(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};Ma.TripleAlreadyExistsError=aS;var oS=class extends Error{static{o(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};Ma.TripleNotFoundError=oS;var cS=class extends Error{static{o(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};Ma.TransactionError=cS});var Xp=S(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.LRUCache=void 0;var uS=class{static{o(this,"LRUCache")}constructor(e){this.maxSize=e,this.cache=new Map}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};Kp.LRUCache=uS});var hS=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.InMemoryTripleStore=void 0;var ja=lS(),Jp=Ae(),E5=qt(),T5=Ne(),A5=yr(),x5=Xp(),C5=A5.Namespace.XSD.term("string").value,I5=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,cl="__default__",fS=class n{static{o(this,"InMemoryTripleStore")}constructor(){this.triples=new Map,this.spo=new Map,this.sop=new Map,this.pso=new Map,this.pos=new Map,this.osp=new Map,this.ops=new Map,this.queryCache=new x5.LRUCache(1e3),this.uuidIndex=new Map,this.namedGraphs=new Map}async add(e){let t=this.getTripleKey(e);if(this.triples.has(t))return;this.triples.set(t,e);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);this.addToIndex(this.spo,r,i,s),this.addToIndex(this.sop,r,s,i),this.addToIndex(this.pso,i,r,s),this.addToIndex(this.pos,i,s,r),this.addToIndex(this.osp,s,r,i),this.addToIndex(this.ops,s,i,r),this.addToUUIDIndex(e.subject),this.queryCache.clear()}async remove(e){let t=this.getTripleKey(e);if(!this.triples.has(t))return!1;this.triples.delete(t);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);return this.removeFromIndex(this.spo,r,i,s),this.removeFromIndex(this.sop,r,s,i),this.removeFromIndex(this.pso,i,r,s),this.removeFromIndex(this.pos,i,s,r),this.removeFromIndex(this.osp,s,r,i),this.removeFromIndex(this.ops,s,i,r),this.queryCache.clear(),!0}async has(e){let t=this.getTripleKey(e);return this.triples.has(t)}async match(e,t,r){let i=this.getMatchCacheKey(e,t,r),s=this.queryCache.get(i);if(s!==void 0)return s;let a;return!e&&!t&&!r?a=Array.from(this.triples.values()):e&&t&&r?a=this.matchSPO(e,t,r):e&&t?a=this.matchSP(e,t):e&&r?a=this.matchSO(e,r):t&&r?a=this.matchPO(t,r):e?a=this.matchS(e):t?a=this.matchP(t):r?a=this.matchO(r):a=[],this.queryCache.set(i,a),a}async addAll(e){for(let t of e)await this.add(t)}async removeAll(e){let t=0;for(let r of e)await this.remove(r)&&t++;return t}async clear(){this.triples.clear(),this.spo.clear(),this.sop.clear(),this.pso.clear(),this.pos.clear(),this.osp.clear(),this.ops.clear(),this.uuidIndex.clear(),this.queryCache.clear()}async count(){return this.triples.size}async subjects(){let e=new Set;for(let t of this.triples.values())e.add(t.subject);return Array.from(e)}async predicates(){let e=new Set;for(let t of this.triples.values())e.add(t.predicate);return Array.from(e)}async objects(){let e=new Set;for(let t of this.triples.values())e.add(t.object);return Array.from(e)}async beginTransaction(){return new dS(this)}async findSubjectsByUUID(e){return this.findSubjectsByUUIDSync(e)}findSubjectsByUUIDSync(e){let t=e.toLowerCase(),r=this.uuidIndex.get(t);if(!r||r.size===0)return[];let i=[];for(let s of r)this.spo.has(`i:${s}`)&&i.push(new Jp.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof Jp.IRI))return;let t=e.value,r=t.match(I5);if(r)for(let i of r){let s=i.toLowerCase();this.uuidIndex.has(s)||this.uuidIndex.set(s,new Set),this.uuidIndex.get(s).add(t)}}matchSPO(e,t,r){let i=this.getNodeKey(e),s=this.getNodeKey(t),a=this.getNodeKey(r),c=this.spo.get(i);if(!c)return[];let l=c.get(s);if(!l)return[];if(l.has(a)){let u=this.buildTripleKey(i,s,a),f=this.triples.get(u);return f?[f]:[]}return[]}matchSP(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.spo.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,i,c))):[]}matchSO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.sop.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,c,i))):[]}matchPO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.pos.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(c,r,i))):[]}matchS(e){let t=this.getNodeKey(e),r=this.spo.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(t,s,c));return this.getTriplesByKeys(i)}matchP(e){let t=this.getNodeKey(e),r=this.pso.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,t,c));return this.getTriplesByKeys(i)}matchO(e){let t=this.getNodeKey(e),r=this.osp.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,c,t));return this.getTriplesByKeys(i)}getTriplesByKeys(e){let t=[];for(let r of e){let i=this.triples.get(r);i&&t.push(i)}return t}addToIndex(e,t,r,i){e.has(t)||e.set(t,new Map);let s=e.get(t);s.has(r)||s.set(r,new Set),s.get(r).add(i)}removeFromIndex(e,t,r,i){let s=e.get(t);if(!s)return;let a=s.get(r);a&&(a.delete(i),a.size===0&&s.delete(r),s.size===0&&e.delete(t))}getTripleKey(e){let t=this.getNodeKey(e.subject),r=this.getNodeKey(e.predicate),i=this.getNodeKey(e.object);return this.buildTripleKey(t,r,i)}buildTripleKey(e,t,r){return`${e}|${t}|${r}`}getNodeKey(e){if(e instanceof Jp.IRI)return`i:${e.value}`;if(e instanceof E5.BlankNode)return`b:${e.id}`;if(e instanceof T5.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==C5?t+=`^^${e.datatype.value}`:e.language&&(t+=`@${e.language}`),t}return""}getMatchCacheKey(e,t,r){let i=e?this.getNodeKey(e):"?",s=t?this.getNodeKey(t):"?",a=r?this.getNodeKey(r):"?";return`${i}|${s}|${a}`}getGraphKey(e){return e?e.value:cl}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===cl?this:(this.namedGraphs.has(t)||this.namedGraphs.set(t,new n),this.namedGraphs.get(t))}async addToGraph(e,t){await this.getOrCreateGraphStore(t).add(e)}async removeFromGraph(e,t){let r=this.getGraphKey(t);if(r===cl)return this.remove(e);let i=this.namedGraphs.get(r);return i?i.remove(e):!1}async matchInGraph(e,t,r,i){let s=this.getGraphKey(i);if(s===cl)return this.match(e,t,r);let a=this.namedGraphs.get(s);return a?a.match(e,t,r):[]}async getNamedGraphs(){return Array.from(this.namedGraphs.keys()).map(e=>new Jp.IRI(e))}async hasGraph(e){let t=this.namedGraphs.get(e.value);return t?await t.count()>0:!1}async clearGraph(e){let t=this.getGraphKey(e);if(t===cl){await this.clear();return}let r=this.namedGraphs.get(t);r&&(await r.clear(),this.namedGraphs.delete(t))}async countInGraph(e){let t=this.getGraphKey(e);if(t===cl)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Zp.InMemoryTripleStore=fS;var dS=class{static{o(this,"InMemoryTransaction")}constructor(e){this.store=e,this.operations=[],this.committed=!1,this.rolledBack=!1}async add(e){if(this.committed)throw new ja.TransactionError("Transaction already committed");if(this.rolledBack)throw new ja.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new ja.TransactionError("Transaction already committed");if(this.rolledBack)throw new ja.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new ja.TransactionError("Transaction already committed");if(this.rolledBack)throw new ja.TransactionError("Transaction already rolled back");for(let e of this.operations)e.type==="add"?await this.store.add(e.triple):await this.store.remove(e.triple);this.committed=!0,this.operations=[]}async rollback(){if(this.committed)throw new ja.TransactionError("Transaction already committed");if(this.rolledBack)throw new ja.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var tm=S(Js=>{"use strict";var R5=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},P5=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.EffortStatusWorkflow=void 0;var O5=ue(),em=kn(),F5=af(),D5=sS(),N5=hS(),pS=class{static{o(this,"EffortStatusWorkflow")}constructor(){this.resolver=new D5.WorkflowResolver(new N5.InMemoryTripleStore)}getPreviousStatus(e,t){let r=this.normalizeStatus(e),i=this.resolveDefinition(t),s=new F5.WorkflowEngine(i);if(s.isInitialState(r))return null;let a=s.getPreviousStatus(r);if(a!==null)return this.wrapStatus(a)}normalizeStatus(e){return e.replace(/["'[\]]/g,"").trim()}wrapStatus(e){return`"[[${e}]]"`}resolveDefinition(e){return this.hasInstanceClass(e,em.AssetClass.TASK)||this.hasInstanceClass(e,em.AssetClass.MEETING)?this.resolver.getHardcodedFallback(em.AssetClass.TASK):this.resolver.getHardcodedFallback(em.AssetClass.PROJECT)}hasInstanceClass(e,t){return e?(Array.isArray(e)?e:[e]).some(i=>i.replace(/["'[\]]/g,"").trim()===t):!1}};Js.EffortStatusWorkflow=pS;Js.EffortStatusWorkflow=pS=R5([(0,O5.injectable)(),P5("design:paramtypes",[])],pS)});var wt=S(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.DI_TOKENS=void 0;rm.DI_TOKENS={IFileSystemAdapter:Symbol.for("IFileSystemAdapter"),IVaultAdapter:Symbol.for("IVaultAdapter"),IVaultContext:Symbol.for("IVaultContext"),IMultiVaultManager:Symbol.for("IMultiVaultManager"),ILogger:Symbol.for("ILogger"),IEventBus:Symbol.for("IEventBus"),IConfiguration:Symbol.for("IConfiguration"),INotificationService:Symbol.for("INotificationService"),AreaCreationService:Symbol.for("AreaCreationService"),ClassCreationService:Symbol.for("ClassCreationService"),ConceptCreationService:Symbol.for("ConceptCreationService"),FleetingNoteCreationService:Symbol.for("FleetingNoteCreationService"),SupervisionCreationService:Symbol.for("SupervisionCreationService"),GenericAssetCreationService:Symbol.for("GenericAssetCreationService"),DynamicFrontmatterGenerator:Symbol.for("DynamicFrontmatterGenerator"),AlgorithmExtractor:Symbol.for("AlgorithmExtractor"),TaskStatusService:Symbol.for("TaskStatusService"),EffortStatusWorkflow:Symbol.for("EffortStatusWorkflow"),StatusTimestampService:Symbol.for("StatusTimestampService"),PropertyCleanupService:Symbol.for("PropertyCleanupService"),FolderRepairService:Symbol.for("FolderRepairService"),LabelToAliasService:Symbol.for("LabelToAliasService"),RenameToUidService:Symbol.for("RenameToUidService"),PlanningService:Symbol.for("PlanningService"),EffortVotingService:Symbol.for("EffortVotingService"),SessionEventService:Symbol.for("SessionEventService"),CriticalityZoneService:Symbol.for("CriticalityZoneService"),AssetConversionService:Symbol.for("AssetConversionService"),NoteToRDFConverter:Symbol.for("NoteToRDFConverter"),IVaultSettings:Symbol.for("IVaultSettings"),AreaHierarchyBuilder:Symbol.for("AreaHierarchyBuilder"),URIConstructionService:Symbol.for("URIConstructionService"),ClassHierarchyResolver:Symbol.for("ClassHierarchyResolver")}});var nm=S(yi=>{"use strict";var L5=yi&&yi.__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},k5=yi&&yi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},M5=yi&&yi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(yi,"__esModule",{value:!0});yi.StatusTimestampService=void 0;var L3=ue(),j5=Jn(),ll=Hr(),$5=wt(),mS=class{static{o(this,"StatusTimestampService")}constructor(e){this.vault=e,this.frontmatterService=new j5.FrontmatterService}async addStartTimestamp(e){let t=await this.vault.read(e),r=ll.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_startTimestamp",r);await this.vault.modify(e,i)}async addEndTimestamp(e,t){let r=await this.vault.read(e),i=t||new Date,s=ll.DateFormatter.toLocalTimestamp(i),a=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);await this.vault.modify(e,a)}async addResolutionTimestamp(e){let t=await this.vault.read(e),r=ll.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_resolutionTimestamp",r);await this.vault.modify(e,i)}async addReviewTimestamp(e){let t=await this.vault.read(e),r=ll.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_lastReviewTimestamp",r);await this.vault.modify(e,i)}async addEndAndResolutionTimestamps(e,t){let r=await this.vault.read(e),i=t||new Date,s=ll.DateFormatter.toLocalTimestamp(i),a=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);a=this.frontmatterService.updateProperty(a,"ems__Effort_resolutionTimestamp",s),await this.vault.modify(e,a)}async removeStartTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_startTimestamp");await this.vault.modify(e,r)}async removeEndTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");await this.vault.modify(e,r)}async removeResolutionTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_resolutionTimestamp");await this.vault.modify(e,r)}async removeEndAndResolutionTimestamps(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");r=this.frontmatterService.removeProperty(r,"ems__Effort_resolutionTimestamp"),await this.vault.modify(e,r)}async shiftPlannedEndTimestamp(e,t){let r=await this.vault.read(e),i=this.frontmatterService.parse(r);if(!i.exists)return;let s=this.frontmatterService.getPropertyValue(i.content,"ems__Effort_plannedEndTimestamp");if(!s)return;let a=new Date(s.replace(/["']/g,""));if(isNaN(a.getTime()))return;let c=new Date(a.getTime()+t),l=ll.DateFormatter.toLocalTimestamp(c),u=this.frontmatterService.updateProperty(r,"ems__Effort_plannedEndTimestamp",l);await this.vault.modify(e,u)}};yi.StatusTimestampService=mS;yi.StatusTimestampService=mS=L5([(0,L3.injectable)(),M5(0,(0,L3.inject)($5.DI_TOKENS.IVaultAdapter)),k5("design:paramtypes",[Object])],mS)});var yS=S(_i=>{"use strict";var V5=_i&&_i.__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},B5=_i&&_i.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},U5=_i&&_i.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(_i,"__esModule",{value:!0});_i.TaskStatusService=void 0;var k3=ue(),q5=Jn(),$o=Hr(),W5=tm(),G5=nm(),z5=wt(),gS=class{static{o(this,"TaskStatusService")}constructor(e,t,r){this.vault=e,this.workflow=t,this.timestampService=r,this.frontmatterService=new q5.FrontmatterService}async setDraftStatus(e){await this.updateStatus(e,"ems__EffortStatusDraft")}async moveToBacklog(e){await this.updateStatus(e,"ems__EffortStatusBacklog")}async moveToAnalysis(e){await this.updateStatus(e,"ems__EffortStatusAnalysis")}async moveToToDo(e){await this.updateStatus(e,"ems__EffortStatusToDo")}async startEffort(e){let t=await this.vault.read(e),r=$o.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');i=this.frontmatterService.updateProperty(i,"ems__Effort_startTimestamp",r),await this.vault.modify(e,i)}async markTaskAsDone(e){let t=await this.vault.read(e),r=$o.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');i=this.frontmatterService.updateProperty(i,"ems__Effort_endTimestamp",r),i=this.frontmatterService.updateProperty(i,"ems__Effort_resolutionTimestamp",r),await this.vault.modify(e,i)}async syncEffortEndTimestamp(e,t){await this.timestampService.addEndAndResolutionTimestamps(e,t)}async shiftPlannedEndTimestamp(e,t){await this.timestampService.shiftPlannedEndTimestamp(e,t)}async trashEffort(e,t){let r=await this.vault.read(e),i=$o.DateFormatter.toLocalTimestamp(new Date),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),t&&(s=this.appendTrashReason(s,t)),await this.vault.modify(e,s)}appendTrashReason(e,t){let r=`
101
101
 
102
102
  ## Trash Reason
103
103
 
104
- ${t}`;return e.trimEnd()+r}async archiveTask(e){let t=await this.vault.read(e),r=this.frontmatterService.updateProperty(t,"archived","true");r=this.frontmatterService.removeProperty(r,"aliases"),await this.vault.modify(e,r)}async planOnToday(e){let t=await this.vault.read(e),r=jo.DateFormatter.getTodayStartTimestamp(),i=this.frontmatterService.updateProperty(t,"ems__Effort_plannedStartTimestamp",r);await this.vault.modify(e,i)}async planForEvening(e){let t=await this.vault.read(e),r=new Date;r.setHours(19,0,0,0);let i=jo.DateFormatter.toLocalTimestamp(r),s=this.frontmatterService.updateProperty(t,"ems__Effort_plannedStartTimestamp",i);await this.vault.modify(e,s)}async shiftDayBackward(e){await this.shiftDay(e,-1)}async shiftDayForward(e){await this.shiftDay(e,1)}async markAsReviewed(e){await this.timestampService.addReviewTimestamp(e)}async rollbackStatus(e){let t=await this.vault.read(e),r=this.extractCurrentStatus(t),i=this.extractInstanceClass(t);if(!r)throw new Error("No current status to rollback from");let s=this.workflow.getPreviousStatus(r,i);if(s===void 0)throw new Error("Cannot rollback from current status");let a=t;s===null?a=this.frontmatterService.removeProperty(a,"ems__Effort_status"):a=this.frontmatterService.updateProperty(a,"ems__Effort_status",s);let c=this.workflow.normalizeStatus(r);c==="ems__EffortStatusDone"?(a=this.frontmatterService.removeProperty(a,"ems__Effort_endTimestamp"),a=this.frontmatterService.removeProperty(a,"ems__Effort_resolutionTimestamp")):c==="ems__EffortStatusDoing"&&(a=this.frontmatterService.removeProperty(a,"ems__Effort_startTimestamp")),await this.vault.modify(e,a)}async updateStatus(e,t){let r=await this.vault.read(e),i=this.frontmatterService.updateProperty(r,"ems__Effort_status",`"[[${t}]]"`);await this.vault.modify(e,i)}async shiftDay(e,t){let r=await this.vault.read(e),i=this.extractPlannedStartTimestamp(r);if(!i)throw new Error("ems__Effort_plannedStartTimestamp property not found");let s=this.parseDateFromTimestamp(i);if(!s)throw new Error("Invalid date format in ems__Effort_plannedStartTimestamp");let a=jo.DateFormatter.addDays(s,t);a.setHours(0,0,0,0);let c=jo.DateFormatter.toLocalTimestamp(a),l=this.frontmatterService.updateProperty(r,"ems__Effort_plannedStartTimestamp",c);await this.vault.modify(e,l)}parseDateFromTimestamp(e){let t=new Date(e);return isNaN(t.getTime())?null:t}extractPlannedStartTimestamp(e){let t=this.frontmatterService.parse(e);return t.exists?this.frontmatterService.getPropertyValue(t.content,"ems__Effort_plannedStartTimestamp"):null}extractCurrentStatus(e){let t=this.frontmatterService.parse(e);return t.exists?this.frontmatterService.getPropertyValue(t.content,"ems__Effort_status"):null}extractInstanceClass(e){let t=this.frontmatterService.parse(e);if(!t.exists)return null;let r=t.content.match(/exo__Instance_class:\s*\n((?:\s*-\s*.*\n?)+)/);return r?r[1].split(`
104
+ ${t}`;return e.trimEnd()+r}async archiveTask(e){let t=await this.vault.read(e),r=this.frontmatterService.updateProperty(t,"archived","true");r=this.frontmatterService.removeProperty(r,"aliases"),await this.vault.modify(e,r)}async planOnToday(e){let t=await this.vault.read(e),r=$o.DateFormatter.getTodayStartTimestamp(),i=this.frontmatterService.updateProperty(t,"ems__Effort_plannedStartTimestamp",r);await this.vault.modify(e,i)}async planForEvening(e){let t=await this.vault.read(e),r=new Date;r.setHours(19,0,0,0);let i=$o.DateFormatter.toLocalTimestamp(r),s=this.frontmatterService.updateProperty(t,"ems__Effort_plannedStartTimestamp",i);await this.vault.modify(e,s)}async shiftDayBackward(e){await this.shiftDay(e,-1)}async shiftDayForward(e){await this.shiftDay(e,1)}async markAsReviewed(e){await this.timestampService.addReviewTimestamp(e)}async rollbackStatus(e){let t=await this.vault.read(e),r=this.extractCurrentStatus(t),i=this.extractInstanceClass(t);if(!r)throw new Error("No current status to rollback from");let s=this.workflow.getPreviousStatus(r,i);if(s===void 0)throw new Error("Cannot rollback from current status");let a=t;s===null?a=this.frontmatterService.removeProperty(a,"ems__Effort_status"):a=this.frontmatterService.updateProperty(a,"ems__Effort_status",s);let c=this.workflow.normalizeStatus(r);c==="ems__EffortStatusDone"?(a=this.frontmatterService.removeProperty(a,"ems__Effort_endTimestamp"),a=this.frontmatterService.removeProperty(a,"ems__Effort_resolutionTimestamp")):c==="ems__EffortStatusDoing"&&(a=this.frontmatterService.removeProperty(a,"ems__Effort_startTimestamp")),await this.vault.modify(e,a)}async updateStatus(e,t){let r=await this.vault.read(e),i=this.frontmatterService.updateProperty(r,"ems__Effort_status",`"[[${t}]]"`);await this.vault.modify(e,i)}async shiftDay(e,t){let r=await this.vault.read(e),i=this.extractPlannedStartTimestamp(r);if(!i)throw new Error("ems__Effort_plannedStartTimestamp property not found");let s=this.parseDateFromTimestamp(i);if(!s)throw new Error("Invalid date format in ems__Effort_plannedStartTimestamp");let a=$o.DateFormatter.addDays(s,t);a.setHours(0,0,0,0);let c=$o.DateFormatter.toLocalTimestamp(a),l=this.frontmatterService.updateProperty(r,"ems__Effort_plannedStartTimestamp",c);await this.vault.modify(e,l)}parseDateFromTimestamp(e){let t=new Date(e);return isNaN(t.getTime())?null:t}extractPlannedStartTimestamp(e){let t=this.frontmatterService.parse(e);return t.exists?this.frontmatterService.getPropertyValue(t.content,"ems__Effort_plannedStartTimestamp"):null}extractCurrentStatus(e){let t=this.frontmatterService.parse(e);return t.exists?this.frontmatterService.getPropertyValue(t.content,"ems__Effort_status"):null}extractInstanceClass(e){let t=this.frontmatterService.parse(e);if(!t.exists)return null;let r=t.content.match(/exo__Instance_class:\s*\n((?:\s*-\s*.*\n?)+)/);return r?r[1].split(`
105
105
  `).filter(s=>s.trim()).map(s=>s.replace(/^\s*-\s*/,"").trim()):this.frontmatterService.getPropertyValue(t.content,"exo__Instance_class")}};_i.TaskStatusService=gS;_i.TaskStatusService=gS=V5([(0,k3.injectable)(),U5(0,(0,k3.inject)(z5.DI_TOKENS.IVaultAdapter)),B5("design:paramtypes",[Object,W5.EffortStatusWorkflow,G5.StatusTimestampService])],gS)});var SS=S(im=>{"use strict";Object.defineProperty(im,"__esModule",{value:!0});im.MetadataExtractor=void 0;var H5=ds(),_S=class{static{o(this,"MetadataExtractor")}constructor(e){this.vault=e}extractMetadata(e){return e?this.vault.getFrontmatter(e)||{}:{}}extractInstanceClass(e){return e.exo__Instance_class||null}extractStatus(e){return e.ems__Effort_status||null}extractIsArchived(e){return H5.MetadataHelpers.isAssetArchived(e)}static extractIsDefinedBy(e){let t=e.exo__Asset_isDefinedBy||'""';return Array.isArray(t)&&(t=t[0]||'""'),String(t)}extractExpectedFolder(e){let t=e.exo__Asset_isDefinedBy;if(!t)return null;let r=Array.isArray(t)?t[0]:t;if(!r||typeof r!="string")return null;let i=r.replace(/["'[\]]/g,"").trim();if(!i)return null;let s=i.split("/");return s.pop(),s.join("/")}extractCommandVisibilityContext(e){let t=this.extractMetadata(e),r=this.extractInstanceClass(t),i=this.extractStatus(t),s=this.extractIsArchived(t),a=e.parent?.path||"",c=this.extractExpectedFolder(t);return{instanceClass:r,currentStatus:i,metadata:t,isArchived:s,currentFolder:a,expectedFolder:c}}extractCache(e){return e?this.vault.getFrontmatter(e):null}};im.MetadataExtractor=_S});var bS=S(Si=>{"use strict";var Q5=Si&&Si.__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},Y5=Si&&Si.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},K5=Si&&Si.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Si,"__esModule",{value:!0});Si.AreaCreationService=void 0;var M3=ue(),j3=En(),X5=kn(),J5=Hr(),Z5=SS(),$3=ds(),e6=wt(),vS=class{static{o(this,"AreaCreationService")}constructor(e){this.vault=e}async createChildArea(e,t,r){let i=(0,j3.v4)(),s=`${i}.md`,a=this.generateChildAreaFrontmatter(t,e.basename,r,i),c=$3.MetadataHelpers.buildFileContent(a),l=e.parent?.path||"",u=l?`${l}/${s}`:s;return await this.vault.create(u,c)}generateChildAreaFrontmatter(e,t,r,i){let s=new Date,a=J5.DateFormatter.toLocalTimestamp(s),c=Z5.MetadataExtractor.extractIsDefinedBy(e),l={};if(l.exo__Asset_isDefinedBy=$3.MetadataHelpers.ensureQuoted(c),l.exo__Asset_uid=i||(0,j3.v4)(),l.exo__Asset_createdAt=a,l.exo__Instance_class=[`"[[${X5.AssetClass.AREA}]]"`],l.ems__Area_parent=`"[[${t}]]"`,r&&r.trim()!==""){let u=r.trim();l.exo__Asset_label=u,l.aliases=[u]}return l}};Si.AreaCreationService=vS;Si.AreaCreationService=vS=Q5([(0,M3.injectable)(),K5(0,(0,M3.inject)(e6.DI_TOKENS.IVaultAdapter)),Y5("design:paramtypes",[Object])],vS)});var ES=S(vi=>{"use strict";var t6=vi&&vi.__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=vi&&vi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},n6=vi&&vi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(vi,"__esModule",{value:!0});vi.AreaHierarchyBuilder=void 0;var V3=ue(),B3=kn(),i6=wt(),sm=Us(),wS=class{static{o(this,"AreaHierarchyBuilder")}constructor(e){this.vault=e}buildHierarchy(e,t){let r=this.vault.getAbstractFileByPath(e);if(!this.isFile(r))return null;let i=this.vault.getFrontmatter(r)||{};if(this.extractInstanceClass(i)!==B3.AssetClass.AREA)return null;let a=this.collectAllAreasFromVault(),c=new Set;return this.buildTree(e,a,c,0)}isFile(e){return!!e&&typeof e=="object"&&"basename"in e&&"path"in e}extractInstanceClass(e){let t=e.exo__Instance_class||"";return Array.isArray(t)?sm.WikiLinkHelpers.normalize(String(t[0]||"")):sm.WikiLinkHelpers.normalize(String(t))}collectAllAreasFromVault(){let e=new Map,t=new Map,r=this.vault.getAllFiles();for(let i of r){let s=this.vault.getFrontmatter(i)||{};if(this.extractInstanceClass(s)===B3.AssetClass.AREA){let c=this.extractParentPath(s);e.set(i.path,{path:i.path,title:i.basename,label:s.exo__Asset_label||void 0,isArchived:this.isArchived(s),depth:0,parentPath:c||void 0}),t.set(i.basename,i.path)}}for(let[,i]of e.entries())i.parentPath&&t.has(i.parentPath)&&(i.parentPath=t.get(i.parentPath));return e}extractParentPath(e){let t=e.ems__Area_parent;if(!t)return null;if(Array.isArray(t)){let r=t[0]||"";return sm.WikiLinkHelpers.normalize(String(r))}return sm.WikiLinkHelpers.normalize(String(t))}isArchived(e){let t=e.exo__Asset_archived;if(t===!0||t==="true")return!0;if(Array.isArray(t)&&t.length>0){let r=t[0];return r===!0||r==="true"}return!1}buildTree(e,t,r,i){if(r.has(e))return null;r.add(e);let s=t.get(e);if(!s)return null;let a=[];for(let[c,l]of t.entries())if(l.parentPath===e){let u=this.buildTree(c,t,r,i+1);u&&a.push(u)}return a.sort((c,l)=>{let u=c.label||c.title,f=l.label||l.title;return u.localeCompare(f)}),{path:s.path,title:s.title,label:s.label,isArchived:s.isArchived,depth:i,parentPath:s.parentPath,children:a}}};vi.AreaHierarchyBuilder=wS;vi.AreaHierarchyBuilder=wS=t6([(0,V3.injectable)(),n6(0,(0,V3.inject)(i6.DI_TOKENS.IVaultAdapter)),r6("design:paramtypes",[Object])],wS)});var AS=S(bi=>{"use strict";var s6=bi&&bi.__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},a6=bi&&bi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},o6=bi&&bi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(bi,"__esModule",{value:!0});bi.ClassCreationService=void 0;var U3=ue(),c6=En(),l6=Hr(),u6=ds(),f6=wt(),TS=class{static{o(this,"ClassCreationService")}constructor(e){this.vault=e}async createSubclass(e,t,r){let i=(0,c6.v4)(),s=this.generateFileName(t),a=s.endsWith(".md")?s:`${s}.md`,c=this.generateClassFrontmatter(e.basename,t,i,r),l=u6.MetadataHelpers.buildFileContent(c),u="classes",f=`${u}/${a}`;return this.vault.getAbstractFileByPath(u)||await this.vault.createFolder(u),await this.vault.create(f,l)}generateFileName(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-");for(;t.startsWith("-");)t=t.slice(1);for(;t.endsWith("-");)t=t.slice(0,-1);return t}generateClassFrontmatter(e,t,r,i){let s=new Date,a=l6.DateFormatter.toLocalTimestamp(s),c={};c.exo__Asset_uid=r,c.exo__Asset_label=t,c.exo__Asset_createdAt=a,c.exo__Instance_class=['"[[exo__Class]]"'],c.exo__Class_superClass=`"[[${e}]]"`;let l=i.exo__Asset_isDefinedBy||'"[[Ontology/EXO]]"';return c.exo__Asset_isDefinedBy=l,c.aliases=[t],c}};bi.ClassCreationService=TS;bi.ClassCreationService=TS=s6([(0,U3.injectable)(),o6(0,(0,U3.inject)(f6.DI_TOKENS.IVaultAdapter)),a6("design:paramtypes",[Object])],TS)});var CS=S(wi=>{"use strict";var d6=wi&&wi.__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},h6=wi&&wi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},p6=wi&&wi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(wi,"__esModule",{value:!0});wi.ConceptCreationService=void 0;var q3=ue(),m6=En(),g6=Hr(),y6=ds(),_6=kn(),S6=wt(),xS=class{static{o(this,"ConceptCreationService")}constructor(e){this.vault=e}async createNarrowerConcept(e,t,r,i){let s=(0,m6.v4)(),a=t.endsWith(".md")?t:`${t}.md`,c=this.generateConceptFrontmatter(e.basename,r,i,s),l=y6.MetadataHelpers.buildFileContent(c),u="concepts",f=`${u}/${a}`;return this.vault.getAbstractFileByPath(u)||await this.vault.createFolder(u),await this.vault.create(f,l)}generateConceptFrontmatter(e,t,r,i){let s=new Date,a=g6.DateFormatter.toLocalTimestamp(s),c={};return c.exo__Asset_isDefinedBy='"[[!concepts]]"',c.exo__Asset_uid=i,c.exo__Asset_createdAt=a,c.exo__Instance_class=[`"[[${_6.AssetClass.CONCEPT}]]"`],c.ims__Concept_broader=`"[[${e}]]"`,c.ims__Concept_definition=t,r.length>0&&(c.aliases=r),c}};wi.ConceptCreationService=xS;wi.ConceptCreationService=xS=d6([(0,q3.injectable)(),p6(0,(0,q3.inject)(S6.DI_TOKENS.IVaultAdapter)),h6("design:paramtypes",[Object])],xS)});var W3=S(ea=>{"use strict";var v6=ea&&ea.__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},b6=ea&&ea.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ea,"__esModule",{value:!0});ea.InstantiationRuleResolver=void 0;var w6=ue(),IS=Ae(),ul=Ne(),Zs=yr(),RS=class{static{o(this,"InstantiationRuleResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async getRule(e){let t=this.cache.get(e);if(t!==void 0)return t;let r=await this.findRuleForClass(e);return this.cache.set(e,r),r}invalidateCache(){this.cache.clear()}async findRuleForClass(e){let t=await this.tripleStore.match(void 0,Zs.Namespace.RDF.term("type"),Zs.Namespace.EXO.term("InstantiationRule"));for(let r of t){let i=r.subject;if((await this.tripleStore.match(i,Zs.Namespace.EXO.term("rule_targetClass"),void 0)).some(c=>this.matchesTargetClass(c.object,e)))return this.loadRule(i)}return null}async loadRule(e){let t=await this.tripleStore.match(e,Zs.Namespace.EXO.term("rule_prototypeUID"),void 0),r=t.length>0&&t[0].object instanceof ul.Literal?t[0].object.value:null,i=await this.tripleStore.match(e,Zs.Namespace.EXO.term("rule_defaultFolder"),void 0),s=i.length>0&&i[0].object instanceof ul.Literal?i[0].object.value:null,a=await this.tripleStore.match(e,Zs.Namespace.EXO.term("rule_propertySetRules"),void 0),c=[];for(let l of a){let u=l.object;if(!(u instanceof IS.IRI))continue;let f=await this.loadPropertySetRule(u);f&&c.push(f)}return{prototypeUID:r,defaultFolder:s,propertySetRules:c}}async loadPropertySetRule(e){let t=await this.tripleStore.match(e,Zs.Namespace.EXO.term("rule_property"),void 0);if(t.length===0)return null;let r=t[0].object,i=r instanceof IS.IRI?this.extractLocalName(r):r instanceof ul.Literal?this.normalizeWikilink(r.value):null;if(!i)return null;let s=await this.tripleStore.match(e,Zs.Namespace.EXO.term("rule_value"),void 0),a=s.length>0&&s[0].object instanceof ul.Literal?s[0].object.value:"",c=await this.tripleStore.match(e,Zs.Namespace.EXO.term("rule_valueType"),void 0),l=c.length>0&&c[0].object instanceof ul.Literal?c[0].object.value:"literal";return{property:i,value:a,valueType:l}}matchesTargetClass(e,t){return e instanceof IS.IRI?this.extractLocalName(e)===t:e instanceof ul.Literal?this.normalizeWikilink(e.value)===t:!1}extractLocalName(e){let t=e.value,r=t.lastIndexOf("#");if(r>=0){let s=t.substring(r+1);return t.includes("/ems#")?`ems__${s}`:t.includes("/exo#")?`exo__${s}`:t.includes("/ims#")?`ims__${s}`:s}let i=t.lastIndexOf("/");return i>=0?t.substring(i+1):t}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}};ea.InstantiationRuleResolver=RS;ea.InstantiationRuleResolver=RS=v6([(0,w6.injectable)(),b6("design:paramtypes",[Object])],RS)});var G3=S(ta=>{"use strict";var E6=ta&&ta.__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=ta&&ta.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ta,"__esModule",{value:!0});ta.VisibilityGenerator=void 0;var A6=ue(),x6=af(),PS=class{static{o(this,"VisibilityGenerator")}constructor(e){this.engine=e}getVisibleCommands(e){return this.engine.getAllTransitions(e).map(t=>this.toCommand(t))}getForwardCommands(e){return this.engine.getAvailableTransitions(e).map(t=>this.toCommand(t))}getRollbackCommands(e){return this.engine.getRollbackTransitions(e).map(t=>this.toCommand(t))}toCommand(e){let t=e.from.replace("ems__EffortStatus","").toLowerCase(),r=e.to.replace("ems__EffortStatus","").toLowerCase();return{commandId:`workflow-${t}-to-${r}`,label:e.label,icon:e.icon,targetStatus:e.to,isRollback:e.isRollback}}};ta.VisibilityGenerator=PS;ta.VisibilityGenerator=PS=E6([(0,A6.injectable)(),T6("design:paramtypes",[x6.WorkflowEngine])],PS)});var z3=S(ra=>{"use strict";var C6=ra&&ra.__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},I6=ra&&ra.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ra,"__esModule",{value:!0});ra.WorkflowCommandAdapter=void 0;var R6=ue(),OS=wc(),P6=af(),FS=class{static{o(this,"WorkflowCommandAdapter")}constructor(e){this.workflow=e,this.engine=new P6.WorkflowEngine(e)}adaptTransitions(e){return this.engine.getAllTransitions(e).map(r=>this.transitionToCommand(r))}adaptForwardTransitions(e){return this.engine.getAvailableTransitions(e).map(r=>this.transitionToCommand(r))}adaptRollbackTransitions(e){return this.engine.getRollbackTransitions(e).map(r=>this.transitionToCommand(r))}getEngine(){return this.engine}getWorkflow(){return this.workflow}transitionToCommand(e){let t=this.generateCommandId(e),r=this.buildPrecondition(e),i=this.buildGrounding(e),s=e.isRollback?"rollback":"workflow";return{id:t,name:e.label,icon:e.icon,precondition:r,grounding:i,category:s,confirmMessage:e.isRollback?`Rollback to ${this.shortStatus(e.to)}?`:void 0,successMessage:`Status changed to ${this.shortStatus(e.to)}`}}generateCommandId(e){let t=this.shortStatus(e.from),r=this.shortStatus(e.to);return`workflow-${t}-to-${r}`}buildPrecondition(e){return{id:`precond-${this.generateCommandId(e)}`,label:`Asset status is ${this.shortStatus(e.from)}`,sparqlAsk:`ASK { $target ems:Effort_status "${e.from}" }`}}buildGrounding(e){let t=[];t.push({id:`gnd-status-${this.shortStatus(e.to)}`,label:`Set status to ${this.shortStatus(e.to)}`,type:OS.GroundingType.PROPERTY_SET,targetProperty:"ems__Effort_status",targetValue:e.to});let r=this.engine.getTimestampsForStatus(e.to);for(let i of r)t.push({id:`gnd-ts-${i}`,label:`Set ${i}`,type:OS.GroundingType.PROPERTY_SET,targetProperty:i,targetValue:"$now"});return t.length===1?t[0]:{id:`gnd-composite-${this.generateCommandId(e)}`,label:`Transition to ${this.shortStatus(e.to)}`,type:OS.GroundingType.COMPOSITE,steps:t}}shortStatus(e){return e.replace("ems__EffortStatus","").toLowerCase()}};ra.WorkflowCommandAdapter=FS;ra.WorkflowCommandAdapter=FS=C6([(0,R6.injectable)(),I6("design:paramtypes",[Object])],FS)});var NS=S(Ei=>{"use strict";var O6=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},F6=Ei&&Ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},D6=Ei&&Ei.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.EffortVotingService=void 0;var H3=ue(),N6=wt(),DS=class{static{o(this,"EffortVotingService")}constructor(e){this.vault=e}async incrementEffortVotes(e){let t=await this.vault.read(e),i=this.extractVoteCount(t)+1,s=this.updateFrontmatterWithVotes(t,i);return await this.vault.modify(e,s),i}extractVoteCount(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/,r=e.match(t);if(!r)return 0;let s=r[1].match(/ems__Effort_votes:\s*(\d+)/);return s&&s[1]?parseInt(s[1],10):0}updateFrontmatterWithVotes(e,t){let r=/^---\r?\n([\s\S]*?)\r?\n---/,i=e.match(r),s=e.includes(`\r
106
106
  `)?`\r
107
107
  `:`
@@ -131,14 +131,14 @@ ${a}`}return`${i}: ${String(s)}`}).join(`
131
131
  ---
132
132
 
133
133
  ${t}
134
- `}};Ii.SupervisionCreationService=GS;Ii.SupervisionCreationService=GS=K6([(0,WS.injectable)(),Z3(0,(0,WS.inject)(ex.DI_TOKENS.IVaultAdapter)),Z3(1,(0,WS.inject)(ex.DI_TOKENS.IVaultSettings)),X6("design:paramtypes",[Object,Object])],GS)});var YS=S(Ri=>{"use strict";var e7=Ri&&Ri.__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},t7=Ri&&Ri.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},tx=Ri&&Ri.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.FleetingNoteCreationService=void 0;var HS=ue(),r7=En(),n7=Hr(),i7=ds(),rx=wt(),QS=class{static{o(this,"FleetingNoteCreationService")}constructor(e,t){this.vault=e,this.vaultSettings=t}async createFleetingNote(e){let t=(0,r7.v4)(),r=`${t}.md`,i=this.generateFrontmatter(t,e),s=i7.MetadataHelpers.buildFileContent(i),a=this.vaultSettings.getDefaultInboxFolder(),c=`${a}/${r}`;return await this.ensureFolderExists(a),await this.vault.create(c,s)}async ensureFolderExists(e){await this.vault.exists(e)||await this.vault.createFolder(e)}generateFrontmatter(e,t){let r=new Date,i=n7.DateFormatter.toLocalTimestamp(r),s=t.trim();return{exo__Asset_isDefinedBy:this.vaultSettings.getOwnerIdentity(),exo__Asset_uid:e,exo__Asset_createdAt:i,exo__Instance_class:[`"[[${this.vaultSettings.getFleetingNoteClassUID()}]]"`],exo__Asset_label:s,aliases:[s]}}};Ri.FleetingNoteCreationService=QS;Ri.FleetingNoteCreationService=QS=e7([(0,HS.injectable)(),tx(0,(0,HS.inject)(rx.DI_TOKENS.IVaultAdapter)),tx(1,(0,HS.inject)(rx.DI_TOKENS.IVaultSettings)),t7("design:paramtypes",[Object,Object])],QS)});var XS=S($o=>{"use strict";var s7=$o&&$o.__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($o,"__esModule",{value:!0});$o.DynamicFrontmatterGenerator=void 0;var a7=ue(),o7=En(),lf=Hr(),KS=class{static{o(this,"DynamicFrontmatterGenerator")}generate(e,t,r,i){let s={},a=new Date;i?.isDefinedBy&&(s.exo__Asset_isDefinedBy=this.ensureQuoted(i.isDefinedBy)),s.exo__Asset_uid=i?.uid||(0,o7.v4)(),s.exo__Asset_createdAt=i?.createdAt||lf.DateFormatter.toLocalTimestamp(a),s.exo__Instance_class=[this.formatWikilink(e)];let c=new Map;for(let u of r)c.set(u.name,u.type);for(let[u,f]of Object.entries(t)){if(f==null||u==="exo__Asset_uid"||u==="exo__Asset_createdAt"||u==="exo__Instance_class"||u==="exo__Asset_isDefinedBy")continue;let d=c.get(u);s[u]=this.formatValue(f,d)}let l=t.exo__Asset_label;if(l&&typeof l=="string"&&l.trim()!==""){let u=l.trim();s.exo__Asset_label=u,s.aliases=[u]}return s}formatValue(e,t){if(e==null)return null;if(!t)return this.formatInferredValue(e);switch(t){case"text":return this.formatText(e);case"wikilink":return this.formatWikilink(e);case"status-select":case"size-select":return this.formatWikilink(e);case"number":return this.formatNumber(e);case"boolean":return this.formatBoolean(e);case"timestamp":return this.formatTimestamp(e);default:return this.formatText(e)}}formatText(e){return typeof e=="string"?e:String(e)}formatWikilink(e){let t=String(e);return t.startsWith('"[[')&&t.endsWith(']]"')?t:t.startsWith("[[")&&t.endsWith("]]")?`"${t}"`:`"[[${t}]]"`}formatNumber(e){if(typeof e=="number")return e;let t=Number(e);return isNaN(t)?0:t}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 lf.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:lf.DateFormatter.toLocalTimestamp(t)}if(typeof e=="number"){let t=new Date(e);if(!isNaN(t.getTime()))return lf.DateFormatter.toLocalTimestamp(t)}return String(e)}formatInferredValue(e){return typeof e=="boolean"||typeof e=="number"?e:e instanceof Date?lf.DateFormatter.toLocalTimestamp(e):typeof e=="string"?e.startsWith("[[")||e.startsWith('"[[')?this.formatWikilink(e):e:String(e)}ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}generateYAML(e,t,r,i){let s=this.generate(e,t,r,i);return this.toYAML(s)}toYAML(e){return`---
134
+ `}};Ii.SupervisionCreationService=GS;Ii.SupervisionCreationService=GS=K6([(0,WS.injectable)(),Z3(0,(0,WS.inject)(ex.DI_TOKENS.IVaultAdapter)),Z3(1,(0,WS.inject)(ex.DI_TOKENS.IVaultSettings)),X6("design:paramtypes",[Object,Object])],GS)});var YS=S(Ri=>{"use strict";var e7=Ri&&Ri.__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},t7=Ri&&Ri.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},tx=Ri&&Ri.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.FleetingNoteCreationService=void 0;var HS=ue(),r7=En(),n7=Hr(),i7=ds(),rx=wt(),QS=class{static{o(this,"FleetingNoteCreationService")}constructor(e,t){this.vault=e,this.vaultSettings=t}async createFleetingNote(e){let t=(0,r7.v4)(),r=`${t}.md`,i=this.generateFrontmatter(t,e),s=i7.MetadataHelpers.buildFileContent(i),a=this.vaultSettings.getDefaultInboxFolder(),c=`${a}/${r}`;return await this.ensureFolderExists(a),await this.vault.create(c,s)}async ensureFolderExists(e){await this.vault.exists(e)||await this.vault.createFolder(e)}generateFrontmatter(e,t){let r=new Date,i=n7.DateFormatter.toLocalTimestamp(r),s=t.trim();return{exo__Asset_isDefinedBy:this.vaultSettings.getOwnerIdentity(),exo__Asset_uid:e,exo__Asset_createdAt:i,exo__Instance_class:[`"[[${this.vaultSettings.getFleetingNoteClassUID()}]]"`],exo__Asset_label:s,aliases:[s]}}};Ri.FleetingNoteCreationService=QS;Ri.FleetingNoteCreationService=QS=e7([(0,HS.injectable)(),tx(0,(0,HS.inject)(rx.DI_TOKENS.IVaultAdapter)),tx(1,(0,HS.inject)(rx.DI_TOKENS.IVaultSettings)),t7("design:paramtypes",[Object,Object])],QS)});var XS=S(Vo=>{"use strict";var s7=Vo&&Vo.__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(Vo,"__esModule",{value:!0});Vo.DynamicFrontmatterGenerator=void 0;var a7=ue(),o7=En(),lf=Hr(),KS=class{static{o(this,"DynamicFrontmatterGenerator")}generate(e,t,r,i){let s={},a=new Date;i?.isDefinedBy&&(s.exo__Asset_isDefinedBy=this.ensureQuoted(i.isDefinedBy)),s.exo__Asset_uid=i?.uid||(0,o7.v4)(),s.exo__Asset_createdAt=i?.createdAt||lf.DateFormatter.toLocalTimestamp(a),s.exo__Instance_class=[this.formatWikilink(e)];let c=new Map;for(let u of r)c.set(u.name,u.type);for(let[u,f]of Object.entries(t)){if(f==null||u==="exo__Asset_uid"||u==="exo__Asset_createdAt"||u==="exo__Instance_class"||u==="exo__Asset_isDefinedBy")continue;let d=c.get(u);s[u]=this.formatValue(f,d)}let l=t.exo__Asset_label;if(l&&typeof l=="string"&&l.trim()!==""){let u=l.trim();s.exo__Asset_label=u,s.aliases=[u]}return s}formatValue(e,t){if(e==null)return null;if(!t)return this.formatInferredValue(e);switch(t){case"text":return this.formatText(e);case"wikilink":return this.formatWikilink(e);case"status-select":case"size-select":return this.formatWikilink(e);case"number":return this.formatNumber(e);case"boolean":return this.formatBoolean(e);case"timestamp":return this.formatTimestamp(e);default:return this.formatText(e)}}formatText(e){return typeof e=="string"?e:String(e)}formatWikilink(e){let t=String(e);return t.startsWith('"[[')&&t.endsWith(']]"')?t:t.startsWith("[[")&&t.endsWith("]]")?`"${t}"`:`"[[${t}]]"`}formatNumber(e){if(typeof e=="number")return e;let t=Number(e);return isNaN(t)?0:t}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 lf.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:lf.DateFormatter.toLocalTimestamp(t)}if(typeof e=="number"){let t=new Date(e);if(!isNaN(t.getTime()))return lf.DateFormatter.toLocalTimestamp(t)}return String(e)}formatInferredValue(e){return typeof e=="boolean"||typeof e=="number"?e:e instanceof Date?lf.DateFormatter.toLocalTimestamp(e):typeof e=="string"?e.startsWith("[[")||e.startsWith('"[[')?this.formatWikilink(e):e:String(e)}ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}generateYAML(e,t,r,i){let s=this.generate(e,t,r,i);return this.toYAML(s)}toYAML(e){return`---
135
135
  ${Object.entries(e).map(([r,i])=>{if(Array.isArray(i)){let s=i.map(a=>` - ${a}`).join(`
136
136
  `);return`${r}:
137
137
  ${s}`}return`${r}: ${i}`}).join(`
138
138
  `)}
139
- ---`}};$o.DynamicFrontmatterGenerator=KS;$o.DynamicFrontmatterGenerator=KS=s7([(0,a7.injectable)()],KS)});var ZS=S(Vo=>{"use strict";var c7=Vo&&Vo.__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(Vo,"__esModule",{value:!0});Vo.AlgorithmExtractor=void 0;var l7=ue(),JS=class{static{o(this,"AlgorithmExtractor")}extractH2Section(e,t){let r=e.split(`
139
+ ---`}};Vo.DynamicFrontmatterGenerator=KS;Vo.DynamicFrontmatterGenerator=KS=s7([(0,a7.injectable)()],KS)});var ZS=S(Bo=>{"use strict";var c7=Bo&&Bo.__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(Bo,"__esModule",{value:!0});Bo.AlgorithmExtractor=void 0;var l7=ue(),JS=class{static{o(this,"AlgorithmExtractor")}extractH2Section(e,t){let r=e.split(`
140
140
  `),i=`## ${t}`,s=!1,a=[];for(let l of r){if(l.trim()===i){s=!0;continue}if(s){if(l.startsWith("## ")||l.startsWith("# "))break;a.push(l)}}return a.length===0?null:a.join(`
141
- `).trim()||null}};Vo.AlgorithmExtractor=JS;Vo.AlgorithmExtractor=JS=c7([(0,l7.injectable)()],JS)});var tv=S(Pi=>{"use strict";var u7=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},f7=Pi&&Pi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},d7=Pi&&Pi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.PlanningService=void 0;var nx=ue(),h7=Jn(),p7=Hr(),m7=wt(),ev=class{static{o(this,"PlanningService")}constructor(e){this.vault=e,this.frontmatterService=new h7.FrontmatterService}async planOnToday(e){let t=this.vault.getAbstractFileByPath(e);if(!t||!this.isFile(t))throw new Error(`File not found: ${e}`);let r=await this.vault.read(t),i=p7.DateFormatter.getTodayStartTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_plannedStartTimestamp",i);await this.vault.modify(t,s)}isFile(e){return typeof e=="object"&&e!==null&&"basename"in e}};Pi.PlanningService=ev;Pi.PlanningService=ev=u7([(0,nx.injectable)(),d7(0,(0,nx.inject)(m7.DI_TOKENS.IVaultAdapter)),f7("design:paramtypes",[Object])],ev)});var sx=S(na=>{"use strict";var g7=na&&na.__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},y7=na&&na.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(na,"__esModule",{value:!0});na.PropertySchemaResolver=void 0;var _7=ue(),ix=Eh(),S7=Y0(),rv=class{static{o(this,"PropertySchemaResolver")}constructor(e,t){this.sparqlService=e,this.logger=t,this.cache=new Map,this.allSchemasLoaded=!1}async getSchema(e){let t=this.normalizeIRI(e),r=this.cache.get(t);if(r)return r;try{let i=await this.loadSchemaFromStore(t);return i&&this.cache.set(t,i),i}catch(i){return this.logger?.warn(`Failed to load schema for ${e}`,{error:String(i)}),null}}async getAllSchemas(){if(this.allSchemasLoaded)return new Map(this.cache);try{let e=await this.loadAllSchemasFromStore();for(let[t,r]of e)this.cache.set(t,r);return this.allSchemasLoaded=!0,new Map(this.cache)}catch(e){return this.logger?.warn("Failed to load all schemas",{error:String(e)}),new Map(this.cache)}}invalidateCache(){this.cache.clear(),this.allSchemasLoaded=!1}async loadSchemaFromStore(e){let t=this.toFullIRI(e),r=`
141
+ `).trim()||null}};Bo.AlgorithmExtractor=JS;Bo.AlgorithmExtractor=JS=c7([(0,l7.injectable)()],JS)});var tv=S(Pi=>{"use strict";var u7=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},f7=Pi&&Pi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},d7=Pi&&Pi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.PlanningService=void 0;var nx=ue(),h7=Jn(),p7=Hr(),m7=wt(),ev=class{static{o(this,"PlanningService")}constructor(e){this.vault=e,this.frontmatterService=new h7.FrontmatterService}async planOnToday(e){let t=this.vault.getAbstractFileByPath(e);if(!t||!this.isFile(t))throw new Error(`File not found: ${e}`);let r=await this.vault.read(t),i=p7.DateFormatter.getTodayStartTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_plannedStartTimestamp",i);await this.vault.modify(t,s)}isFile(e){return typeof e=="object"&&e!==null&&"basename"in e}};Pi.PlanningService=ev;Pi.PlanningService=ev=u7([(0,nx.injectable)(),d7(0,(0,nx.inject)(m7.DI_TOKENS.IVaultAdapter)),f7("design:paramtypes",[Object])],ev)});var sx=S(na=>{"use strict";var g7=na&&na.__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},y7=na&&na.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(na,"__esModule",{value:!0});na.PropertySchemaResolver=void 0;var _7=ue(),ix=Eh(),S7=Y0(),rv=class{static{o(this,"PropertySchemaResolver")}constructor(e,t){this.sparqlService=e,this.logger=t,this.cache=new Map,this.allSchemasLoaded=!1}async getSchema(e){let t=this.normalizeIRI(e),r=this.cache.get(t);if(r)return r;try{let i=await this.loadSchemaFromStore(t);return i&&this.cache.set(t,i),i}catch(i){return this.logger?.warn(`Failed to load schema for ${e}`,{error:String(i)}),null}}async getAllSchemas(){if(this.allSchemasLoaded)return new Map(this.cache);try{let e=await this.loadAllSchemasFromStore();for(let[t,r]of e)this.cache.set(t,r);return this.allSchemasLoaded=!0,new Map(this.cache)}catch(e){return this.logger?.warn("Failed to load all schemas",{error:String(e)}),new Map(this.cache)}}invalidateCache(){this.cache.clear(),this.allSchemasLoaded=!1}async loadSchemaFromStore(e){let t=this.toFullIRI(e),r=`
142
142
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
143
143
  PREFIX owl: <http://www.w3.org/2002/07/owl#>
144
144
  PREFIX exo: <https://exocortex.my/ontology/exo#>
@@ -368,13 +368,13 @@ SELECT ?s ?label ?class WHERE {
368
368
  }
369
369
  ORDER BY ?label
370
370
  LIMIT ${this.config.defaultLimit}`,s="\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0442\u043E\u0447\u043D\u043E \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0438\u0442\u044C \u0442\u0438\u043F \u0437\u0430\u043F\u0440\u043E\u0441\u0430. \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F \u043F\u043E\u0438\u0441\u043A \u043F\u043E \u043A\u043B\u044E\u0447\u0435\u0432\u043E\u043C\u0443 \u0441\u043B\u043E\u0432\u0443.";return t?.template&&t?.missingParams&&(s+=` \u0414\u043B\u044F \u0448\u0430\u0431\u043B\u043E\u043D\u0430 "${t.template.name}" \u043D\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432: ${t.missingParams.join(", ")}.`),{query:i,templateName:null,parameters:{keyword:r},confidence:.3,explanation:s,isFallback:!0,alternatives:[]}}calculateConfidence(e,t,r){let i=.5;for(let c of t.keywords)e.includes(c.toLowerCase())&&(i+=.1);let s=t.parameters.filter(c=>c.required),a=s.filter(c=>r[c.name]&&r[c.name].length>0);s.length>0?i+=a.length/s.length*.2:i+=.2;for(let[c]of Object.entries(this.prototypeMapping))if(e.includes(c)){i+=.1;break}return Math.min(i,1)}generateExplanation(e,t){let r=e.description;return Object.keys(t).length>0&&(r+=". \u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B: ",r+=Object.entries(t).filter(([,i])=>i&&i.length>0).map(([i,s])=>`${i}="${s}"`).join(", ")),r}getAvailableTemplates(){return[...Et.SPARQL_TEMPLATES]}getTemplate(e){return(0,Et.getTemplateByName)(e)}setConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}addTemplate(e){Et.SPARQL_TEMPLATES.push(e),S8.LoggingService.debug(`Added custom template: ${e.name}`)}getSuggestions(e){let t=[];return(e.includes("\u0441\u043A\u043E\u043B\u044C\u043A\u043E")||e.includes("\u0441\u0440\u0435\u0434\u043D")||e.includes("\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A"))&&!e.match(/\b20\d{2}\b/)&&!this.containsMonth(e)&&t.push("\u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434 \u0432\u0440\u0435\u043C\u0435\u043D\u0438 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: '\u0437\u0430 \u0434\u0435\u043A\u0430\u0431\u0440\u044C' \u0438\u043B\u0438 '\u0437\u0430 2025-12')"),(e.includes("\u0437\u0430\u0434\u0430\u0447")||e.includes("\u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442"))&&t.push("\u0414\u043B\u044F \u0442\u043E\u0447\u043D\u043E\u0433\u043E \u043F\u043E\u0438\u0441\u043A\u0430 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 UUID \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u0430 \u0432\u043C\u0435\u0441\u0442\u043E \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044F"),e.length<10&&t.push("\u0423\u0442\u043E\u0447\u043D\u0438\u0442\u0435 \u0437\u0430\u043F\u0440\u043E\u0441: \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438 \u0438\u043B\u0438 \u0442\u0438\u043F \u0434\u0430\u043D\u043D\u044B\u0445"),t}containsMonth(e){return Object.keys(this.monthNames).some(t=>e.includes(t))}};Zn.NLToSPARQLService=vv;Zn.NLToSPARQLService=vv=g8([(0,_8.injectable)(),y8("design:paramtypes",[Object])],vv)});var Ax=S(Mi=>{"use strict";var v8=Mi&&Mi.__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},b8=Mi&&Mi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},w8=Mi&&Mi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.AnalyticsService=void 0;var Tx=ue(),E8=wt(),T8=Hr(),A8=Jn(),bv=class{static{o(this,"AnalyticsService")}constructor(e){this.vault=e,this.frontmatterService=new A8.FrontmatterService}getDefaultPeriod(){let e=new Date,t=new Date;return t.setDate(t.getDate()-30),{startDate:t,endDate:e}}async getEffortsInPeriod(e,t){let i=this.vault.getAllFiles().filter(a=>a.path.endsWith(".md")),s=[];for(let a of i)try{let c=await this.vault.read(a),l=this.extractEffortData(a,c);if(!l)continue;if(l.startTimestamp){if(l.startTimestamp<e.startDate||l.startTimestamp>e.endDate)continue}else continue;if(t?.prototypeUri&&l.prototypeUri!==t.prototypeUri||t?.labelContains&&!l.label.toLowerCase().includes(t.labelContains.toLowerCase())||t?.status&&l.status&&!t.status.includes(l.status))continue;s.push(l)}catch{continue}return s}extractEffortData(e,t){let r=this.frontmatterService.parse(t);if(!r.exists)return null;let i=this.frontmatterService.getPropertyValue(r.content,"exo__Asset_label");if(!i)return null;let s=this.frontmatterService.getPropertyValue(r.content,"ems__Effort_status"),a=this.frontmatterService.getPropertyValue(r.content,"ems__Effort_startTimestamp"),c=this.frontmatterService.getPropertyValue(r.content,"ems__Effort_endTimestamp"),l=this.frontmatterService.getPropertyValue(r.content,"exo__Asset_prototype"),u=this.extractInstanceClass(r.content);return{path:e.path,label:this.cleanWikiLink(i),status:s?this.cleanWikiLink(s):null,startTimestamp:a?this.parseTimestamp(a):null,endTimestamp:c?this.parseTimestamp(c):null,prototypeUri:l?this.cleanWikiLink(l):null,instanceClass:u}}extractInstanceClass(e){let t=e.match(/exo__Instance_class:\s*\n((?:\s*-\s*.*\n?)+)/);if(t)return t[1].split(`
371
- `).filter(s=>s.trim()).map(s=>this.cleanWikiLink(s.replace(/^\s*-\s*/,"").trim()));let r=this.frontmatterService.getPropertyValue(e,"exo__Instance_class");return r?this.cleanWikiLink(r):null}cleanWikiLink(e){return e.replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/^"/,"").replace(/"$/,"")}parseTimestamp(e){if(!e)return null;let t=e.replace(/^"/,"").replace(/"$/,""),r=new Date(t);return isNaN(r.getTime())?null:r}calculateDurationStats(e){let t=e.filter(f=>f.startTimestamp&&f.endTimestamp).map(f=>(f.endTimestamp.getTime()-f.startTimestamp.getTime())/6e4).filter(f=>f>0);if(t.length===0)return{count:0,totalMinutes:0,averageMinutes:0,minMinutes:0,maxMinutes:0,stdDevMinutes:0};let r=t.reduce((f,d)=>f+d,0),i=r/t.length,s=Math.min(...t),a=Math.max(...t),l=t.map(f=>Math.pow(f-i,2)).reduce((f,d)=>f+d,0)/t.length,u=Math.sqrt(l);return{count:t.length,totalMinutes:Math.round(r),averageMinutes:Math.round(i*10)/10,minMinutes:Math.round(s),maxMinutes:Math.round(a),stdDevMinutes:Math.round(u*10)/10}}calculateDailyAggregates(e){let t=new Map;for(let r of e){if(!r.startTimestamp)continue;let i=T8.DateFormatter.toDateString(r.startTimestamp);t.has(i)||t.set(i,{count:0,totalMinutes:0});let s=t.get(i);if(s.count++,r.endTimestamp){let a=r.endTimestamp.getTime()-r.startTimestamp.getTime();s.totalMinutes+=a/6e4}}return Array.from(t.entries()).map(([r,i])=>({date:r,count:i.count,totalMinutes:Math.round(i.totalMinutes),averageMinutes:i.count>0?Math.round(i.totalMinutes/i.count*10)/10:0})).sort((r,i)=>r.date.localeCompare(i.date))}calculateHourlyDistribution(e){let t=new Array(24).fill(0);for(let i of e){if(!i.startTimestamp)continue;let s=i.startTimestamp.getHours();t[s]++}let r=t.reduce((i,s)=>i+s,0);return t.map((i,s)=>({hour:s,count:i,percentage:r>0?Math.round(i/r*1e3)/10:0}))}calculateWeekdayDistribution(e){let t=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=new Array(7).fill(0);for(let s of e){if(!s.startTimestamp)continue;let a=s.startTimestamp.getDay();r[a]++}let i=r.reduce((s,a)=>s+a,0);return r.map((s,a)=>({dayOfWeek:a,dayName:t[a],count:s,percentage:i>0?Math.round(s/i*1e3)/10:0}))}async analyzeSleep(e=this.getDefaultPeriod()){let t=await this.getEffortsInPeriod(e,{labelContains:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C"}),r=this.calculateDurationStats(t),i=this.calculateDailyAggregates(t),s=[],a=[];for(let d of t){if(d.startTimestamp){let h=d.startTimestamp.getHours()*60+d.startTimestamp.getMinutes();s.push(h<360?h+1440:h)}if(d.endTimestamp){let h=d.endTimestamp.getHours()*60+d.endTimestamp.getMinutes();a.push(h)}}let c=s.length>0?s.reduce((d,h)=>d+h,0)/s.length:0,l=a.length>0?a.reduce((d,h)=>d+h,0)/a.length:0,u=s.length>1?Math.sqrt(s.map(d=>Math.pow(d-c,2)).reduce((d,h)=>d+h,0)/s.length):0,f=a.length>1?Math.sqrt(a.map(d=>Math.pow(d-l,2)).reduce((d,h)=>d+h,0)/a.length):0;return{period:e,stats:r,dailyData:i,averageBedtime:this.minutesToTimeString(c%1440),averageWakeTime:this.minutesToTimeString(l),bedtimeVariabilityMinutes:Math.round(u),wakeTimeVariabilityMinutes:Math.round(f)}}minutesToTimeString(e){let t=Math.floor(e/60),r=Math.round(e%60);return`${String(t).padStart(2,"0")}:${String(r).padStart(2,"0")}`}async analyzeTaskCompletion(e=this.getDefaultPeriod()){let r=(await this.getEffortsInPeriod(e)).filter(u=>Array.isArray(u.instanceClass)?u.instanceClass.some(f=>f.includes("ems__Task")):u.instanceClass?.includes("ems__Task")??!1),i=r.filter(u=>u.status?.includes("ems__EffortStatusDone")),s=r.filter(u=>u.status?.includes("ems__EffortStatusTrashed")),a=i.filter(u=>u.startTimestamp&&u.endTimestamp).map(u=>(u.endTimestamp.getTime()-u.startTimestamp.getTime())/6e4),c=a.length>0?a.reduce((u,f)=>u+f,0)/a.length:0,l=this.calculateDailyAggregates(i);return{period:e,totalTasks:r.length,completedTasks:i.length,trashedTasks:s.length,completionRate:r.length>0?Math.round(i.length/r.length*1e3)/10:0,averageCompletionTimeMinutes:Math.round(c*10)/10,dailyCompletions:l}}async analyzeActivityFrequency(e,t=this.getDefaultPeriod()){let r=await this.getEffortsInPeriod(t,{labelContains:e}),i=this.calculateDurationStats(r),s=this.calculateDailyAggregates(r),a=this.calculateHourlyDistribution(r),c=this.calculateWeekdayDistribution(r);return{activityLabel:e,period:t,stats:i,dailyData:s,hourlyDistribution:a,weekdayDistribution:c}}async getActivitySummary(e=this.getDefaultPeriod()){let t=await this.getEffortsInPeriod(e),r=new Map;for(let s of t){let a=s.label.split(" ")[0];r.has(a)||r.set(a,[]),r.get(a).push(s)}let i=new Map;for(let[s,a]of r)i.set(s,this.calculateDurationStats(a));return i}};Mi.AnalyticsService=bv;Mi.AnalyticsService=bv=v8([(0,Tx.injectable)(),w8(0,(0,Tx.inject)(E8.DI_TOKENS.IVaultAdapter)),b8("design:paramtypes",[Object])],bv)});var xx=S(Bo=>{"use strict";var x8=Bo&&Bo.__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(Bo,"__esModule",{value:!0});Bo.TrendDetectionService=void 0;var C8=ue(),wv=class{static{o(this,"TrendDetectionService")}constructor(){this.TREND_THRESHOLD=.05,this.ANOMALY_THRESHOLD_STD=2,this.STRONG_CORRELATION_THRESHOLD=.7,this.MODERATE_CORRELATION_THRESHOLD=.4}analyzeTrend(e,t="averageMinutes"){if(e.length<3)return{direction:"stable",strength:"none",slope:0,rSquared:0,changePercentage:0,insight:"Insufficient data for trend analysis (need at least 3 data points)"};let r=e.map(h=>h[t]),{slope:i,rSquared:s}=this.linearRegression(r),a=r[0]||1,l=((r[r.length-1]||0)-a)/a*100,u;Math.abs(l)<this.TREND_THRESHOLD*100?u="stable":i>0?u="increasing":u="decreasing";let f;s>=.7?f="strong":s>=.4?f="moderate":s>=.2?f="weak":f="none";let d=this.generateTrendInsight(u,f,l);return{direction:u,strength:f,slope:Math.round(i*100)/100,rSquared:Math.round(s*100)/100,changePercentage:Math.round(l*10)/10,insight:d}}linearRegression(e){let t=e.length;if(t===0)return{slope:0,intercept:0,rSquared:0};let r=(t-1)/2,i=e.reduce((h,p)=>h+p,0)/t,s=0,a=0;for(let h=0;h<t;h++)s+=(h-r)*(e[h]-i),a+=Math.pow(h-r,2);let c=a!==0?s/a:0,l=i-c*r,u=0,f=0;for(let h=0;h<t;h++){let p=l+c*h;u+=Math.pow(e[h]-p,2),f+=Math.pow(e[h]-i,2)}let d=f!==0?1-u/f:0;return{slope:c,intercept:l,rSquared:Math.max(0,d)}}generateTrendInsight(e,t,r){if(t==="none"||e==="stable")return"Metric is relatively stable with no significant trend.";let i=t==="strong"?"clearly":t==="moderate"?"moderately":"slightly",s=e==="increasing"?"increasing":"decreasing",a=`${Math.abs(Math.round(r))}%`;return`Metric is ${i} ${s} (${a} change over the period).`}detectAnomalies(e,t="averageMinutes"){if(e.length<5)return[];let r=e.map(c=>c[t]),{mean:i,stdDev:s}=this.calculateStats(r),a=[];for(let c=0;c<e.length;c++){let l=r[c],u=(l-i)/(s||1);if(Math.abs(u)>=this.ANOMALY_THRESHOLD_STD){let f=this.determineAnomalySeverity(u),d=this.determineAnomalyType(u,l,i);a.push({date:e[c].date,value:l,expectedValue:Math.round(i*10)/10,deviation:Math.round(u*100)/100,severity:f,type:d,description:this.generateAnomalyDescription(d,f,u,l,i)})}}return a}calculateStats(e){if(e.length===0)return{mean:0,stdDev:0};let t=e.reduce((a,c)=>a+c,0)/e.length,i=e.map(a=>Math.pow(a-t,2)).reduce((a,c)=>a+c,0)/e.length,s=Math.sqrt(i);return{mean:t,stdDev:s}}determineAnomalySeverity(e){let t=Math.abs(e);return t>=3?"critical":t>=2.5?"warning":"info"}determineAnomalyType(e,t,r){return t>r&&e>0?"spike":t<r&&e<0?"drop":"outlier"}generateAnomalyDescription(e,t,r,i,s){let a=t==="critical"?"Significant":t==="warning"?"Notable":"Minor",c=e==="spike"?"spike":e==="drop"?"drop":"unusual value",l=Math.round((i-s)/s*100);return`${a} ${c} detected: ${Math.round(i)} (${l>0?"+":""}${l}% from average of ${Math.round(s)}, ${r.toFixed(1)}\u03C3 from mean).`}calculateCorrelation(e,t,r,i){let s=Math.min(e.length,t.length);if(s<5)return{metric1:r,metric2:i,coefficient:0,strength:"none",direction:"none",insight:"Insufficient data for correlation analysis."};let{mean:a,stdDev:c}=this.calculateStats(e.slice(0,s)),{mean:l,stdDev:u}=this.calculateStats(t.slice(0,s));if(c===0||u===0)return{metric1:r,metric2:i,coefficient:0,strength:"none",direction:"none",insight:"One or both metrics have no variation."};let f=0;for(let E=0;E<s;E++)f+=(e[E]-a)/c*((t[E]-l)/u);let d=f/s,h=Math.abs(d),p;h>=this.STRONG_CORRELATION_THRESHOLD?p="strong":h>=this.MODERATE_CORRELATION_THRESHOLD?p="moderate":h>=.2?p="weak":p="none";let y=p==="none"?"none":d>0?"positive":"negative",v=this.generateCorrelationInsight(r,i,d,p,y);return{metric1:r,metric2:i,coefficient:Math.round(d*100)/100,strength:p,direction:y,insight:v}}generateCorrelationInsight(e,t,r,i,s){if(i==="none")return`No significant correlation found between ${e} and ${t}.`;let a=i==="strong"?"strongly":i==="moderate"?"moderately":"weakly",c=s==="positive"?"When one increases, the other tends to increase":"When one increases, the other tends to decrease";return`${e} and ${t} are ${a} ${s}ly correlated (r=${r.toFixed(2)}). ${c}.`}analyzeWeeklyPattern(e,t="averageMinutes"){let r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i={};for(let l of e){let f=new Date(l.date).getDay();i[f]||(i[f]=[]),i[f].push(l[t])}let s=[],a=0,c=1/0;for(let l=0;l<7;l++){let u=i[l]||[],{mean:f,stdDev:d}=this.calculateStats(u);f>a&&(a=f),f<c&&u.length>0&&(c=f),s.push({dayOfWeek:l,dayName:r[l],averageValue:Math.round(f*10)/10,deviation:Math.round(d*10)/10,isHighPoint:!1,isLowPoint:!1})}for(let l of s)l.averageValue===a&&a>0&&(l.isHighPoint=!0),l.averageValue===c&&c!==1/0&&(l.isLowPoint=!0);return s}generateInsights(e,t,r,i,s){let a=[];t.strength!=="none"&&t.direction!=="stable"&&a.push({type:"trend",severity:t.direction==="decreasing"?"warning":"info",title:`${s} is ${t.direction}`,description:t.insight,metric:s,value:t.changePercentage,actionable:t.direction==="decreasing"});let c=r.filter(f=>f.severity==="critical");if(c.length>0)for(let f of c)a.push({type:"anomaly",severity:"critical",title:`Unusual ${f.type} detected on ${f.date}`,description:f.description,metric:s,value:f.value,actionable:!0});let l=i.filter(f=>f.isHighPoint).map(f=>f.dayName),u=i.filter(f=>f.isLowPoint).map(f=>f.dayName);return l.length>0&&u.length>0&&a.push({type:"pattern",severity:"info",title:"Weekly pattern detected",description:`${s} tends to be highest on ${l.join(", ")} and lowest on ${u.join(", ")}.`,metric:s,actionable:!1}),e.stdDevMinutes>e.averageMinutes*.5&&a.push({type:"recommendation",severity:"warning",title:"High variability detected",description:`${s} shows high variability (std dev: ${e.stdDevMinutes} min). Consider maintaining a more consistent schedule.`,metric:s,value:e.stdDevMinutes,actionable:!0}),a}detectSuddenChanges(e,t="averageMinutes",r=50){let i=[];for(let s=1;s<e.length;s++){let a=e[s-1][t],c=e[s][t];if(a===0)continue;let l=(c-a)/a*100;Math.abs(l)>=r&&i.push({date:e[s].date,previousValue:a,currentValue:c,changePercent:Math.round(l*10)/10})}return i}};Bo.TrendDetectionService=wv;Bo.TrendDetectionService=wv=x8([(0,C8.injectable)()],wv)});var Ix=S(ei=>{"use strict";var I8=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},R8=ei&&ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ei,"__esModule",{value:!0});ei.AutocompleteService=ei.DEFAULT_AUTOCOMPLETE_CONFIG=void 0;var P8=ue(),om=yr(),df=Ae(),Cx=Ne();ei.DEFAULT_AUTOCOMPLETE_CONFIG={limit:10,activeBoost:20,recencyBoost:10,recencyDays:7};var Ev=class{static{o(this,"AutocompleteService")}constructor(e,t){this.tripleStore=e,this.config={...ei.DEFAULT_AUTOCOMPLETE_CONFIG,...t}}async getSuggestions(e,t,r){let i={...this.config,...r},s=await this.getPropertyRange(e);if(s.length===0){let l=this.inferClassFromProperty(e);l&&s.push(l)}let a=[];for(let l of s){let u=await this.getAssetsOfClass(l);a.push(...u)}return a.map(l=>({...l,matchScore:this.calculateMatchScore(l,t,i)})).filter(l=>l.matchScore>0).sort((l,u)=>u.matchScore-l.matchScore).slice(0,i.limit)}async getSuggestionsByClass(e,t,r){let i={...this.config,...r},s=[];for(let c of e){let l=await this.getAssetsOfClass(c);s.push(...l)}return s.map(c=>({...c,matchScore:this.calculateMatchScore(c,t,i)})).filter(c=>c.matchScore>0).sort((c,l)=>l.matchScore-c.matchScore).slice(0,i.limit)}async getPropertyRange(e){let t=this.toFullIri(e),r=[],i=await this.tripleStore.match(new df.IRI(t),om.Namespace.RDFS.term("range"),void 0);for(let s of i)if(s.object instanceof df.IRI){let a=this.toClassName(s.object.value);a&&r.push(a)}return r}async getAssetsOfClass(e){let t=this.toFullIri(e),r=[],i=await this.tripleStore.match(void 0,om.Namespace.RDF.term("type"),new df.IRI(t));for(let s of i)if(s.subject instanceof df.IRI){let a=await this.buildSuggestion(s.subject,e);a&&r.push(a)}return r}async buildSuggestion(e,t){let r=await this.tripleStore.match(e,om.Namespace.EXO.term("Asset_label"),void 0),i="";for(let c of r)if(c.object instanceof Cx.Literal){i=c.object.value;break}if(i||(i=this.extractLabelFromUri(e.value)),!i)return null;let s=await this.checkIfActive(e),a=this.extractPathFromUri(e.value);return{label:i,uri:e.value,path:a,assetClass:t,isActive:s,matchScore:0}}async checkIfActive(e){let t=await this.tripleStore.match(e,om.Namespace.EMS.term("Effort_status"),void 0);for(let r of t){let i=r.object instanceof Cx.Literal||r.object instanceof df.IRI?r.object.value:"";if(i.includes("Active")||i.includes("EffortStatus_Active"))return!0}return!1}calculateMatchScore(e,t,r){if(!t||t.length===0)return e.isActive?100+r.activeBoost:100;let i=e.label.toLowerCase(),s=t.toLowerCase(),a=0;if(i===s)a=100;else if(i.startsWith(s))a=80;else if(i.includes(s))a=60;else if(this.fuzzyMatch(s,i))a=40;else return 0;if(e.isActive&&(a+=r.activeBoost),e.lastModified){let c=(Date.now()-e.lastModified)/864e5;c<=r.recencyDays&&(a+=r.recencyBoost*(1-c/r.recencyDays))}return a}fuzzyMatch(e,t){let r=0;for(let i=0;i<t.length&&r<e.length;i++)t[i]===e[r]&&r++;return r===e.length}inferClassFromProperty(e){let t=e.toLowerCase();return t.includes("project")?"ems__Project":t.includes("area")?"ems__Area":t.includes("task")?"ems__Task":t.includes("effort")?"ems__Effort":null}toFullIri(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;let t=e.match(/^([a-z]+)__(.+)$/);if(t){let[,r,i]=t;switch(r){case"ems":return`https://exocortex.my/ontology/ems#${i}`;case"exo":return`https://exocortex.my/ontology/exo#${i}`;default:return`https://exocortex.my/ontology/${r}#${i}`}}return e}toClassName(e){let t=e.match(/https:\/\/exocortex\.my\/ontology\/([a-z]+)#(.+)$/);if(t){let[,r,i]=t;return`${r}__${i}`}return null}extractLabelFromUri(e){if(e.startsWith("obsidian://")){let r=decodeURIComponent(e),i=r.lastIndexOf("/");if(i>=0){let s=r.substring(i+1);return s.endsWith(".md")&&(s=s.substring(0,s.length-3)),s}}let t=e.lastIndexOf("/");if(t>=0){let r=e.substring(t+1);return r.endsWith(".md")&&(r=r.substring(0,r.length-3)),r}return""}extractPathFromUri(e){if(e.startsWith("obsidian://vault/")){let t=decodeURIComponent(e.substring(17)),r=t.indexOf("/");return r>=0?t.substring(r+1):t}return e}};ei.AutocompleteService=Ev;ei.AutocompleteService=Ev=I8([(0,P8.injectable)(),R8("design:paramtypes",[Object,Object])],Ev)});var Px=S(ji=>{"use strict";var O8=ji&&ji.__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},F8=ji&&ji.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},D8=ji&&ji.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ji,"__esModule",{value:!0});ji.DailyReviewService=void 0;var Rx=ue(),N8=wt(),fl=Hr(),L8=Jn(),k8=En(),Tv=class{static{o(this,"DailyReviewService")}constructor(e){this.vault=e,this.frontmatterService=new L8.FrontmatterService}async getPractices(){let e=this.vault.getAllFiles(),t=[],r=fl.DateFormatter.toDateString(new Date);for(let i of e)if(i.path.endsWith(".md"))try{let s=await this.vault.read(i),a=this.frontmatterService.parse(s);if(!a.exists)continue;let c=this.frontmatterService.getPropertyValue(a.content,"exo__Instance_class");if(!this.isTaskPrototype(c))continue;let l=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_uid");if(!l)continue;let u=l.replace(/"/g,""),f=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_label");if(!f)continue;let d=f.replace(/"/g,""),p=this.frontmatterService.getPropertyValue(a.content,"ems__Recurring_rule")?.replace(/"/g,"")||null,y=this.frontmatterService.getPropertyValue(a.content,"ems__Task_estimatedDuration"),v=null;if(y){let b=parseInt(y,10);isNaN(b)||(v=b)}let E=await this.findTodayInstance(u,r);t.push({uid:u,label:d,path:i.path,recurringRule:p,estimatedDuration:v,doneToday:E?.status==="done",inProgressToday:E?.status==="doing",todayInstancePath:E?.path||null})}catch{continue}return t.sort((i,s)=>i.label.localeCompare(s.label))}async getDailyReviewSummary(e){let t=e||new Date,r=fl.DateFormatter.toDateString(t),i=new Date(t);i.setHours(0,0,0,0);let s=new Date(t);s.setHours(23,59,59,999);let a=this.vault.getAllFiles(),c=0,l=0,u=0,f=0;for(let y of a)if(y.path.endsWith(".md"))try{let v=await this.vault.read(y),E=this.frontmatterService.parse(v);if(!E.exists)continue;let b=this.frontmatterService.getPropertyValue(E.content,"exo__Instance_class");if(!this.isTask(b))continue;let A=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_plannedStartTimestamp"),I=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_startTimestamp"),j=I?new Date(I):null,B=A?new Date(A):null;if(!(B&&B>=i&&B<=s||j&&j>=i&&j<=s))continue;c++;let z=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_status");if(this.isDoneStatus(z)){l++;let G=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_endTimestamp");if(I&&G){let F=this.calculateDurationMinutes(I,G);f+=F}}else this.isDoingStatus(z)&&u++}catch{continue}let h=(await this.getPractices()).filter(y=>!y.doneToday&&y.recurringRule),p=c>0?Math.round(l/c*100):0;return{date:r,plannedCount:c,completedCount:l,inProgressCount:u,practicesDue:h,completionPercentage:p,totalTimeMinutes:Math.round(f)}}async quickCapture(e,t=!0,r){let i=(0,k8.v4)(),s=fl.DateFormatter.toISOTimestamp(new Date),a=`${i}.md`,c="03 Knowledge/kitelev",l=["---",`exo__Asset_uid: "${i}"`,`exo__Asset_label: "${e}"`,'exo__Instance_class: "[[ems__Task]]"'];if(r?.prototypeUid){let d=this.buildPrototypeUri(r.prototypeUid);l.push(`exo__Asset_prototype: "${d}"`)}if(r?.areaUid){let d=this.buildAssetUri(r.areaUid);l.push(`ems__Effort_area: "${d}"`)}if(r?.parentUid){let d=this.buildAssetUri(r.parentUid);l.push(`ems__Effort_parent: "${d}"`)}t?(l.push('ems__Effort_status: "[[ems__EffortStatusDoing]]"'),l.push(`ems__Effort_startTimestamp: ${s}`)):l.push('ems__Effort_status: "[[ems__EffortStatusBacklog]]"'),l.push("---","","");let u=l.join(`
372
- `),f=`${c}/${a}`;return await this.vault.create(f,u),{path:f,uid:i,label:e,started:t}}async createFromPractice(e){let r=(await this.getPractices()).find(a=>a.uid===e.prototypeUid);if(!r)throw new Error(`Practice not found: ${e.prototypeUid}`);if(r.doneToday)throw new Error(`Practice "${r.label}" already completed today`);if(r.inProgressToday&&r.todayInstancePath)return{path:r.todayInstancePath,uid:e.prototypeUid,label:r.label,started:!0};let i=fl.DateFormatter.toDateString(new Date),s=e.label||`${r.label} ${i}`;return this.quickCapture(s,e.startImmediately??!0,{prototypeUid:e.prototypeUid,areaUid:e.areaUid,parentUid:e.parentUid})}async markPracticeDone(e){let r=(await this.getPractices()).find(u=>u.uid===e);if(!r)throw new Error(`Practice not found: ${e}`);if(r.doneToday)return;if(!r.todayInstancePath)throw new Error(`No active instance for practice "${r.label}" today`);let i=this.vault.getAbstractFileByPath(r.todayInstancePath);if(!i||!("basename"in i))throw new Error(`File not found: ${r.todayInstancePath}`);let s=i,a=await this.vault.read(s),c=fl.DateFormatter.toISOTimestamp(new Date),l=this.frontmatterService.updateProperty(a,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');l=this.frontmatterService.updateProperty(l,"ems__Effort_endTimestamp",c),l=this.frontmatterService.updateProperty(l,"ems__Effort_resolutionTimestamp",c),await this.vault.modify(s,l)}async findTodayInstance(e,t){let r=this.vault.getAllFiles();for(let i of r)if(i.path.endsWith(".md"))try{let s=await this.vault.read(i),a=this.frontmatterService.parse(s);if(!a.exists)continue;let c=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_prototype");if(!c||!c.includes(e))continue;let l=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_label"),u=this.frontmatterService.getPropertyValue(a.content,"ems__Effort_startTimestamp"),f=l?.includes(t),d=u?new Date(u):null,h=d&&fl.DateFormatter.toDateString(d)===t;if(!f&&!h)continue;let p=this.frontmatterService.getPropertyValue(a.content,"ems__Effort_status");return this.isDoneStatus(p)?{path:i.path,status:"done"}:this.isDoingStatus(p)?{path:i.path,status:"doing"}:{path:i.path,status:"other"}}catch{continue}return null}isTaskPrototype(e){return e?e.includes("ems__TaskPrototype")||e.includes("TaskPrototype"):!1}isTask(e){return e?(e.includes("ems__Task")||e.includes("[[ems__Task]]"))&&!e.includes("Prototype"):!1}isDoneStatus(e){return e?e.includes("Done")||e.includes("EffortStatusDone"):!1}isDoingStatus(e){return e?e.includes("Doing")||e.includes("EffortStatusDoing"):!1}calculateDurationMinutes(e,t){let r=new Date(e);return(new Date(t).getTime()-r.getTime())/1e3/60}buildPrototypeUri(e){return`obsidian://vault/03%20Knowledge%2Fkitelev%2F${e}.md`}buildAssetUri(e){return`obsidian://vault/03%20Knowledge%2Fkitelev%2F${e}.md`}};ji.DailyReviewService=Tv;ji.DailyReviewService=Tv=O8([(0,Rx.injectable)(),D8(0,(0,Rx.inject)(N8.DI_TOKENS.IVaultAdapter)),F8("design:paramtypes",[Object])],Tv)});var xv=S(Yr=>{"use strict";var M8=Yr&&Yr.__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},j8=Yr&&Yr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},$8=Yr&&Yr.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.CriticalityZoneService=Yr.CriticalityZoneUUIDs=void 0;var Ox=ue(),V8=Jn(),B8=wt();Yr.CriticalityZoneUUIDs={TODAY:"e266a2e9-9eb0-431d-b1fe-b95b9d3e9a3f",THIS_WEEK:"c7f1a968-0959-4ac7-ac82-31b0cdc2aba7",SOMEDAY:"6968a0fc-7a41-4393-82b1-17d767c7ad7c"};var Av=class{static{o(this,"CriticalityZoneService")}constructor(e){this.vault=e,this.frontmatterService=new V8.FrontmatterService}async setZoneToday(e){await this.setZone(e,Yr.CriticalityZoneUUIDs.TODAY)}async setZoneThisWeek(e){await this.setZone(e,Yr.CriticalityZoneUUIDs.THIS_WEEK)}async setZoneSomeday(e){await this.setZone(e,Yr.CriticalityZoneUUIDs.SOMEDAY)}async setZone(e,t){let r=await this.vault.read(e),i=this.frontmatterService.updateProperty(r,"ems__Task_zone",`"[[${t}]]"`);await this.vault.modify(e,i)}};Yr.CriticalityZoneService=Av;Yr.CriticalityZoneService=Av=M8([(0,Ox.injectable)(),$8(0,(0,Ox.inject)(B8.DI_TOKENS.IVaultAdapter)),j8("design:paramtypes",[Object])],Av)});var Fx=S(cm=>{"use strict";Object.defineProperty(cm,"__esModule",{value:!0});cm.EffortSortingHelpers=void 0;var Cv=class n{static{o(this,"EffortSortingHelpers")}static getTimeFromTimestamp(e){if(!e)return"00:00:00";let t=new Date(e);if(isNaN(t.getTime()))return"00:00:00";let r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${r}:${i}:${s}`}static sortByStartTime(e,t){let r=n.getTimeFromTimestamp(e.startTimestamp),i=n.getTimeFromTimestamp(t.startTimestamp),s=r==="00:00:00",a=i==="00:00:00";return s&&!a?1:!s&&a?-1:r.localeCompare(i)}static sortByPriority(e,t){if(e.isTrashed!==t.isTrashed)return e.isTrashed?1:-1;if(e.isDone!==t.isDone)return e.isDone?1:-1;let r=typeof e.metadata.ems__Effort_votes=="number"?e.metadata.ems__Effort_votes:0,i=typeof t.metadata.ems__Effort_votes=="number"?t.metadata.ems__Effort_votes:0;return r!==i?i-r:e.startTime&&t.startTime?e.startTime.localeCompare(t.startTime):e.startTime?-1:t.startTime?1:0}};cm.EffortSortingHelpers=Cv});var Dx=S(lm=>{"use strict";Object.defineProperty(lm,"__esModule",{value:!0});lm.FilenameValidator=void 0;var Uo=class{static{o(this,"FilenameValidator")}static validate(e,t={}){let{maxLength:r=this.DEFAULT_MAX_LENGTH,replacementChar:i=this.DEFAULT_REPLACEMENT,allowEmpty:s=!1}=t,a=[];if(!e||e.trim().length===0)return s||a.push("Filename cannot be empty"),{valid:a.length===0,sanitized:"",errors:a};e.endsWith(" ")&&a.push("Filename should not end with a space");let c=e.trim();this.INVALID_CHARS_PATTERN.test(c)&&a.push('Filename contains invalid characters: / \\ : * ? " < > |');let l=this.getBaseName(c);this.RESERVED_NAMES.has(l.toUpperCase())&&a.push(`"${l}" is a reserved filename on Windows`),c.length>r&&a.push(`Filename exceeds maximum length of ${r} characters`),c.startsWith(".")&&a.push("Filename should not start with a dot"),c.endsWith(".")&&a.push("Filename should not end with a dot");let u=this.sanitize(e,{maxLength:r,replacementChar:i});return{valid:a.length===0,sanitized:u,errors:a}}static sanitize(e,t={}){let{maxLength:r=this.DEFAULT_MAX_LENGTH,replacementChar:i=this.DEFAULT_REPLACEMENT}=t;if(!e||e.trim().length===0)return"";let s=e.trim();for(s=s.replace(this.INVALID_CHARS_PATTERN,i);s.startsWith(".")&&s.length>1;)s=s.substring(1);for(;s.length>0&&(s.endsWith(".")||s.endsWith(" "));)s=s.slice(0,-1);for(s.includes(i)&&(s=s.split(i).filter(u=>u!=="").join(i));s.startsWith(i);)s=s.slice(i.length);for(;s.endsWith(i);)s=s.slice(0,-i.length);let a=this.getBaseName(s);if(this.RESERVED_NAMES.has(a.toUpperCase())){let c=this.getExtension(s);s=a+i+c}if(s.length>r)for(s=s.slice(0,r);s.endsWith(i);)s=s.slice(0,-i.length);return s}static hasInvalidChars(e){return this.INVALID_CHARS_PATTERN.test(e)}static getInvalidChars(e){let t=e.match(this.INVALID_CHARS_PATTERN);return t?[...new Set(t)]:[]}static getBaseName(e){let t=e.lastIndexOf(".");return t===-1||t===0?e:e.substring(0,t)}static getExtension(e){let t=e.lastIndexOf(".");return t===-1||t===0?"":e.substring(t)}};lm.FilenameValidator=Uo;Uo.INVALID_CHARS_PATTERN=/[/\\:*?"<>|\x00-\x1F]/g;Uo.RESERVED_NAMES=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]);Uo.DEFAULT_MAX_LENGTH=200;Uo.DEFAULT_REPLACEMENT="_"});var Rv=S(um=>{"use strict";Object.defineProperty(um,"__esModule",{value:!0});um.NTriplesSerializer=void 0;var Iv=class{static{o(this,"NTriplesSerializer")}serialize(e,t={}){let r=t.newline??`
371
+ `).filter(s=>s.trim()).map(s=>this.cleanWikiLink(s.replace(/^\s*-\s*/,"").trim()));let r=this.frontmatterService.getPropertyValue(e,"exo__Instance_class");return r?this.cleanWikiLink(r):null}cleanWikiLink(e){return e.replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/^"/,"").replace(/"$/,"")}parseTimestamp(e){if(!e)return null;let t=e.replace(/^"/,"").replace(/"$/,""),r=new Date(t);return isNaN(r.getTime())?null:r}calculateDurationStats(e){let t=e.filter(f=>f.startTimestamp&&f.endTimestamp).map(f=>(f.endTimestamp.getTime()-f.startTimestamp.getTime())/6e4).filter(f=>f>0);if(t.length===0)return{count:0,totalMinutes:0,averageMinutes:0,minMinutes:0,maxMinutes:0,stdDevMinutes:0};let r=t.reduce((f,d)=>f+d,0),i=r/t.length,s=Math.min(...t),a=Math.max(...t),l=t.map(f=>Math.pow(f-i,2)).reduce((f,d)=>f+d,0)/t.length,u=Math.sqrt(l);return{count:t.length,totalMinutes:Math.round(r),averageMinutes:Math.round(i*10)/10,minMinutes:Math.round(s),maxMinutes:Math.round(a),stdDevMinutes:Math.round(u*10)/10}}calculateDailyAggregates(e){let t=new Map;for(let r of e){if(!r.startTimestamp)continue;let i=T8.DateFormatter.toDateString(r.startTimestamp);t.has(i)||t.set(i,{count:0,totalMinutes:0});let s=t.get(i);if(s.count++,r.endTimestamp){let a=r.endTimestamp.getTime()-r.startTimestamp.getTime();s.totalMinutes+=a/6e4}}return Array.from(t.entries()).map(([r,i])=>({date:r,count:i.count,totalMinutes:Math.round(i.totalMinutes),averageMinutes:i.count>0?Math.round(i.totalMinutes/i.count*10)/10:0})).sort((r,i)=>r.date.localeCompare(i.date))}calculateHourlyDistribution(e){let t=new Array(24).fill(0);for(let i of e){if(!i.startTimestamp)continue;let s=i.startTimestamp.getHours();t[s]++}let r=t.reduce((i,s)=>i+s,0);return t.map((i,s)=>({hour:s,count:i,percentage:r>0?Math.round(i/r*1e3)/10:0}))}calculateWeekdayDistribution(e){let t=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=new Array(7).fill(0);for(let s of e){if(!s.startTimestamp)continue;let a=s.startTimestamp.getDay();r[a]++}let i=r.reduce((s,a)=>s+a,0);return r.map((s,a)=>({dayOfWeek:a,dayName:t[a],count:s,percentage:i>0?Math.round(s/i*1e3)/10:0}))}async analyzeSleep(e=this.getDefaultPeriod()){let t=await this.getEffortsInPeriod(e,{labelContains:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C"}),r=this.calculateDurationStats(t),i=this.calculateDailyAggregates(t),s=[],a=[];for(let d of t){if(d.startTimestamp){let h=d.startTimestamp.getHours()*60+d.startTimestamp.getMinutes();s.push(h<360?h+1440:h)}if(d.endTimestamp){let h=d.endTimestamp.getHours()*60+d.endTimestamp.getMinutes();a.push(h)}}let c=s.length>0?s.reduce((d,h)=>d+h,0)/s.length:0,l=a.length>0?a.reduce((d,h)=>d+h,0)/a.length:0,u=s.length>1?Math.sqrt(s.map(d=>Math.pow(d-c,2)).reduce((d,h)=>d+h,0)/s.length):0,f=a.length>1?Math.sqrt(a.map(d=>Math.pow(d-l,2)).reduce((d,h)=>d+h,0)/a.length):0;return{period:e,stats:r,dailyData:i,averageBedtime:this.minutesToTimeString(c%1440),averageWakeTime:this.minutesToTimeString(l),bedtimeVariabilityMinutes:Math.round(u),wakeTimeVariabilityMinutes:Math.round(f)}}minutesToTimeString(e){let t=Math.floor(e/60),r=Math.round(e%60);return`${String(t).padStart(2,"0")}:${String(r).padStart(2,"0")}`}async analyzeTaskCompletion(e=this.getDefaultPeriod()){let r=(await this.getEffortsInPeriod(e)).filter(u=>Array.isArray(u.instanceClass)?u.instanceClass.some(f=>f.includes("ems__Task")):u.instanceClass?.includes("ems__Task")??!1),i=r.filter(u=>u.status?.includes("ems__EffortStatusDone")),s=r.filter(u=>u.status?.includes("ems__EffortStatusTrashed")),a=i.filter(u=>u.startTimestamp&&u.endTimestamp).map(u=>(u.endTimestamp.getTime()-u.startTimestamp.getTime())/6e4),c=a.length>0?a.reduce((u,f)=>u+f,0)/a.length:0,l=this.calculateDailyAggregates(i);return{period:e,totalTasks:r.length,completedTasks:i.length,trashedTasks:s.length,completionRate:r.length>0?Math.round(i.length/r.length*1e3)/10:0,averageCompletionTimeMinutes:Math.round(c*10)/10,dailyCompletions:l}}async analyzeActivityFrequency(e,t=this.getDefaultPeriod()){let r=await this.getEffortsInPeriod(t,{labelContains:e}),i=this.calculateDurationStats(r),s=this.calculateDailyAggregates(r),a=this.calculateHourlyDistribution(r),c=this.calculateWeekdayDistribution(r);return{activityLabel:e,period:t,stats:i,dailyData:s,hourlyDistribution:a,weekdayDistribution:c}}async getActivitySummary(e=this.getDefaultPeriod()){let t=await this.getEffortsInPeriod(e),r=new Map;for(let s of t){let a=s.label.split(" ")[0];r.has(a)||r.set(a,[]),r.get(a).push(s)}let i=new Map;for(let[s,a]of r)i.set(s,this.calculateDurationStats(a));return i}};Mi.AnalyticsService=bv;Mi.AnalyticsService=bv=v8([(0,Tx.injectable)(),w8(0,(0,Tx.inject)(E8.DI_TOKENS.IVaultAdapter)),b8("design:paramtypes",[Object])],bv)});var xx=S(Uo=>{"use strict";var x8=Uo&&Uo.__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(Uo,"__esModule",{value:!0});Uo.TrendDetectionService=void 0;var C8=ue(),wv=class{static{o(this,"TrendDetectionService")}constructor(){this.TREND_THRESHOLD=.05,this.ANOMALY_THRESHOLD_STD=2,this.STRONG_CORRELATION_THRESHOLD=.7,this.MODERATE_CORRELATION_THRESHOLD=.4}analyzeTrend(e,t="averageMinutes"){if(e.length<3)return{direction:"stable",strength:"none",slope:0,rSquared:0,changePercentage:0,insight:"Insufficient data for trend analysis (need at least 3 data points)"};let r=e.map(h=>h[t]),{slope:i,rSquared:s}=this.linearRegression(r),a=r[0]||1,l=((r[r.length-1]||0)-a)/a*100,u;Math.abs(l)<this.TREND_THRESHOLD*100?u="stable":i>0?u="increasing":u="decreasing";let f;s>=.7?f="strong":s>=.4?f="moderate":s>=.2?f="weak":f="none";let d=this.generateTrendInsight(u,f,l);return{direction:u,strength:f,slope:Math.round(i*100)/100,rSquared:Math.round(s*100)/100,changePercentage:Math.round(l*10)/10,insight:d}}linearRegression(e){let t=e.length;if(t===0)return{slope:0,intercept:0,rSquared:0};let r=(t-1)/2,i=e.reduce((h,p)=>h+p,0)/t,s=0,a=0;for(let h=0;h<t;h++)s+=(h-r)*(e[h]-i),a+=Math.pow(h-r,2);let c=a!==0?s/a:0,l=i-c*r,u=0,f=0;for(let h=0;h<t;h++){let p=l+c*h;u+=Math.pow(e[h]-p,2),f+=Math.pow(e[h]-i,2)}let d=f!==0?1-u/f:0;return{slope:c,intercept:l,rSquared:Math.max(0,d)}}generateTrendInsight(e,t,r){if(t==="none"||e==="stable")return"Metric is relatively stable with no significant trend.";let i=t==="strong"?"clearly":t==="moderate"?"moderately":"slightly",s=e==="increasing"?"increasing":"decreasing",a=`${Math.abs(Math.round(r))}%`;return`Metric is ${i} ${s} (${a} change over the period).`}detectAnomalies(e,t="averageMinutes"){if(e.length<5)return[];let r=e.map(c=>c[t]),{mean:i,stdDev:s}=this.calculateStats(r),a=[];for(let c=0;c<e.length;c++){let l=r[c],u=(l-i)/(s||1);if(Math.abs(u)>=this.ANOMALY_THRESHOLD_STD){let f=this.determineAnomalySeverity(u),d=this.determineAnomalyType(u,l,i);a.push({date:e[c].date,value:l,expectedValue:Math.round(i*10)/10,deviation:Math.round(u*100)/100,severity:f,type:d,description:this.generateAnomalyDescription(d,f,u,l,i)})}}return a}calculateStats(e){if(e.length===0)return{mean:0,stdDev:0};let t=e.reduce((a,c)=>a+c,0)/e.length,i=e.map(a=>Math.pow(a-t,2)).reduce((a,c)=>a+c,0)/e.length,s=Math.sqrt(i);return{mean:t,stdDev:s}}determineAnomalySeverity(e){let t=Math.abs(e);return t>=3?"critical":t>=2.5?"warning":"info"}determineAnomalyType(e,t,r){return t>r&&e>0?"spike":t<r&&e<0?"drop":"outlier"}generateAnomalyDescription(e,t,r,i,s){let a=t==="critical"?"Significant":t==="warning"?"Notable":"Minor",c=e==="spike"?"spike":e==="drop"?"drop":"unusual value",l=Math.round((i-s)/s*100);return`${a} ${c} detected: ${Math.round(i)} (${l>0?"+":""}${l}% from average of ${Math.round(s)}, ${r.toFixed(1)}\u03C3 from mean).`}calculateCorrelation(e,t,r,i){let s=Math.min(e.length,t.length);if(s<5)return{metric1:r,metric2:i,coefficient:0,strength:"none",direction:"none",insight:"Insufficient data for correlation analysis."};let{mean:a,stdDev:c}=this.calculateStats(e.slice(0,s)),{mean:l,stdDev:u}=this.calculateStats(t.slice(0,s));if(c===0||u===0)return{metric1:r,metric2:i,coefficient:0,strength:"none",direction:"none",insight:"One or both metrics have no variation."};let f=0;for(let E=0;E<s;E++)f+=(e[E]-a)/c*((t[E]-l)/u);let d=f/s,h=Math.abs(d),p;h>=this.STRONG_CORRELATION_THRESHOLD?p="strong":h>=this.MODERATE_CORRELATION_THRESHOLD?p="moderate":h>=.2?p="weak":p="none";let y=p==="none"?"none":d>0?"positive":"negative",v=this.generateCorrelationInsight(r,i,d,p,y);return{metric1:r,metric2:i,coefficient:Math.round(d*100)/100,strength:p,direction:y,insight:v}}generateCorrelationInsight(e,t,r,i,s){if(i==="none")return`No significant correlation found between ${e} and ${t}.`;let a=i==="strong"?"strongly":i==="moderate"?"moderately":"weakly",c=s==="positive"?"When one increases, the other tends to increase":"When one increases, the other tends to decrease";return`${e} and ${t} are ${a} ${s}ly correlated (r=${r.toFixed(2)}). ${c}.`}analyzeWeeklyPattern(e,t="averageMinutes"){let r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i={};for(let l of e){let f=new Date(l.date).getDay();i[f]||(i[f]=[]),i[f].push(l[t])}let s=[],a=0,c=1/0;for(let l=0;l<7;l++){let u=i[l]||[],{mean:f,stdDev:d}=this.calculateStats(u);f>a&&(a=f),f<c&&u.length>0&&(c=f),s.push({dayOfWeek:l,dayName:r[l],averageValue:Math.round(f*10)/10,deviation:Math.round(d*10)/10,isHighPoint:!1,isLowPoint:!1})}for(let l of s)l.averageValue===a&&a>0&&(l.isHighPoint=!0),l.averageValue===c&&c!==1/0&&(l.isLowPoint=!0);return s}generateInsights(e,t,r,i,s){let a=[];t.strength!=="none"&&t.direction!=="stable"&&a.push({type:"trend",severity:t.direction==="decreasing"?"warning":"info",title:`${s} is ${t.direction}`,description:t.insight,metric:s,value:t.changePercentage,actionable:t.direction==="decreasing"});let c=r.filter(f=>f.severity==="critical");if(c.length>0)for(let f of c)a.push({type:"anomaly",severity:"critical",title:`Unusual ${f.type} detected on ${f.date}`,description:f.description,metric:s,value:f.value,actionable:!0});let l=i.filter(f=>f.isHighPoint).map(f=>f.dayName),u=i.filter(f=>f.isLowPoint).map(f=>f.dayName);return l.length>0&&u.length>0&&a.push({type:"pattern",severity:"info",title:"Weekly pattern detected",description:`${s} tends to be highest on ${l.join(", ")} and lowest on ${u.join(", ")}.`,metric:s,actionable:!1}),e.stdDevMinutes>e.averageMinutes*.5&&a.push({type:"recommendation",severity:"warning",title:"High variability detected",description:`${s} shows high variability (std dev: ${e.stdDevMinutes} min). Consider maintaining a more consistent schedule.`,metric:s,value:e.stdDevMinutes,actionable:!0}),a}detectSuddenChanges(e,t="averageMinutes",r=50){let i=[];for(let s=1;s<e.length;s++){let a=e[s-1][t],c=e[s][t];if(a===0)continue;let l=(c-a)/a*100;Math.abs(l)>=r&&i.push({date:e[s].date,previousValue:a,currentValue:c,changePercent:Math.round(l*10)/10})}return i}};Uo.TrendDetectionService=wv;Uo.TrendDetectionService=wv=x8([(0,C8.injectable)()],wv)});var Ix=S(ei=>{"use strict";var I8=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},R8=ei&&ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ei,"__esModule",{value:!0});ei.AutocompleteService=ei.DEFAULT_AUTOCOMPLETE_CONFIG=void 0;var P8=ue(),om=yr(),df=Ae(),Cx=Ne();ei.DEFAULT_AUTOCOMPLETE_CONFIG={limit:10,activeBoost:20,recencyBoost:10,recencyDays:7};var Ev=class{static{o(this,"AutocompleteService")}constructor(e,t){this.tripleStore=e,this.config={...ei.DEFAULT_AUTOCOMPLETE_CONFIG,...t}}async getSuggestions(e,t,r){let i={...this.config,...r},s=await this.getPropertyRange(e);if(s.length===0){let l=this.inferClassFromProperty(e);l&&s.push(l)}let a=[];for(let l of s){let u=await this.getAssetsOfClass(l);a.push(...u)}return a.map(l=>({...l,matchScore:this.calculateMatchScore(l,t,i)})).filter(l=>l.matchScore>0).sort((l,u)=>u.matchScore-l.matchScore).slice(0,i.limit)}async getSuggestionsByClass(e,t,r){let i={...this.config,...r},s=[];for(let c of e){let l=await this.getAssetsOfClass(c);s.push(...l)}return s.map(c=>({...c,matchScore:this.calculateMatchScore(c,t,i)})).filter(c=>c.matchScore>0).sort((c,l)=>l.matchScore-c.matchScore).slice(0,i.limit)}async getPropertyRange(e){let t=this.toFullIri(e),r=[],i=await this.tripleStore.match(new df.IRI(t),om.Namespace.RDFS.term("range"),void 0);for(let s of i)if(s.object instanceof df.IRI){let a=this.toClassName(s.object.value);a&&r.push(a)}return r}async getAssetsOfClass(e){let t=this.toFullIri(e),r=[],i=await this.tripleStore.match(void 0,om.Namespace.RDF.term("type"),new df.IRI(t));for(let s of i)if(s.subject instanceof df.IRI){let a=await this.buildSuggestion(s.subject,e);a&&r.push(a)}return r}async buildSuggestion(e,t){let r=await this.tripleStore.match(e,om.Namespace.EXO.term("Asset_label"),void 0),i="";for(let c of r)if(c.object instanceof Cx.Literal){i=c.object.value;break}if(i||(i=this.extractLabelFromUri(e.value)),!i)return null;let s=await this.checkIfActive(e),a=this.extractPathFromUri(e.value);return{label:i,uri:e.value,path:a,assetClass:t,isActive:s,matchScore:0}}async checkIfActive(e){let t=await this.tripleStore.match(e,om.Namespace.EMS.term("Effort_status"),void 0);for(let r of t){let i=r.object instanceof Cx.Literal||r.object instanceof df.IRI?r.object.value:"";if(i.includes("Active")||i.includes("EffortStatus_Active"))return!0}return!1}calculateMatchScore(e,t,r){if(!t||t.length===0)return e.isActive?100+r.activeBoost:100;let i=e.label.toLowerCase(),s=t.toLowerCase(),a=0;if(i===s)a=100;else if(i.startsWith(s))a=80;else if(i.includes(s))a=60;else if(this.fuzzyMatch(s,i))a=40;else return 0;if(e.isActive&&(a+=r.activeBoost),e.lastModified){let c=(Date.now()-e.lastModified)/864e5;c<=r.recencyDays&&(a+=r.recencyBoost*(1-c/r.recencyDays))}return a}fuzzyMatch(e,t){let r=0;for(let i=0;i<t.length&&r<e.length;i++)t[i]===e[r]&&r++;return r===e.length}inferClassFromProperty(e){let t=e.toLowerCase();return t.includes("project")?"ems__Project":t.includes("area")?"ems__Area":t.includes("task")?"ems__Task":t.includes("effort")?"ems__Effort":null}toFullIri(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;let t=e.match(/^([a-z]+)__(.+)$/);if(t){let[,r,i]=t;switch(r){case"ems":return`https://exocortex.my/ontology/ems#${i}`;case"exo":return`https://exocortex.my/ontology/exo#${i}`;default:return`https://exocortex.my/ontology/${r}#${i}`}}return e}toClassName(e){let t=e.match(/https:\/\/exocortex\.my\/ontology\/([a-z]+)#(.+)$/);if(t){let[,r,i]=t;return`${r}__${i}`}return null}extractLabelFromUri(e){if(e.startsWith("obsidian://")){let r=decodeURIComponent(e),i=r.lastIndexOf("/");if(i>=0){let s=r.substring(i+1);return s.endsWith(".md")&&(s=s.substring(0,s.length-3)),s}}let t=e.lastIndexOf("/");if(t>=0){let r=e.substring(t+1);return r.endsWith(".md")&&(r=r.substring(0,r.length-3)),r}return""}extractPathFromUri(e){if(e.startsWith("obsidian://vault/")){let t=decodeURIComponent(e.substring(17)),r=t.indexOf("/");return r>=0?t.substring(r+1):t}return e}};ei.AutocompleteService=Ev;ei.AutocompleteService=Ev=I8([(0,P8.injectable)(),R8("design:paramtypes",[Object,Object])],Ev)});var Px=S(ji=>{"use strict";var O8=ji&&ji.__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},F8=ji&&ji.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},D8=ji&&ji.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ji,"__esModule",{value:!0});ji.DailyReviewService=void 0;var Rx=ue(),N8=wt(),fl=Hr(),L8=Jn(),k8=En(),Tv=class{static{o(this,"DailyReviewService")}constructor(e){this.vault=e,this.frontmatterService=new L8.FrontmatterService}async getPractices(){let e=this.vault.getAllFiles(),t=[],r=fl.DateFormatter.toDateString(new Date);for(let i of e)if(i.path.endsWith(".md"))try{let s=await this.vault.read(i),a=this.frontmatterService.parse(s);if(!a.exists)continue;let c=this.frontmatterService.getPropertyValue(a.content,"exo__Instance_class");if(!this.isTaskPrototype(c))continue;let l=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_uid");if(!l)continue;let u=l.replace(/"/g,""),f=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_label");if(!f)continue;let d=f.replace(/"/g,""),p=this.frontmatterService.getPropertyValue(a.content,"ems__Recurring_rule")?.replace(/"/g,"")||null,y=this.frontmatterService.getPropertyValue(a.content,"ems__Task_estimatedDuration"),v=null;if(y){let b=parseInt(y,10);isNaN(b)||(v=b)}let E=await this.findTodayInstance(u,r);t.push({uid:u,label:d,path:i.path,recurringRule:p,estimatedDuration:v,doneToday:E?.status==="done",inProgressToday:E?.status==="doing",todayInstancePath:E?.path||null})}catch{continue}return t.sort((i,s)=>i.label.localeCompare(s.label))}async getDailyReviewSummary(e){let t=e||new Date,r=fl.DateFormatter.toDateString(t),i=new Date(t);i.setHours(0,0,0,0);let s=new Date(t);s.setHours(23,59,59,999);let a=this.vault.getAllFiles(),c=0,l=0,u=0,f=0;for(let y of a)if(y.path.endsWith(".md"))try{let v=await this.vault.read(y),E=this.frontmatterService.parse(v);if(!E.exists)continue;let b=this.frontmatterService.getPropertyValue(E.content,"exo__Instance_class");if(!this.isTask(b))continue;let A=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_plannedStartTimestamp"),I=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_startTimestamp"),j=I?new Date(I):null,B=A?new Date(A):null;if(!(B&&B>=i&&B<=s||j&&j>=i&&j<=s))continue;c++;let z=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_status");if(this.isDoneStatus(z)){l++;let G=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_endTimestamp");if(I&&G){let F=this.calculateDurationMinutes(I,G);f+=F}}else this.isDoingStatus(z)&&u++}catch{continue}let h=(await this.getPractices()).filter(y=>!y.doneToday&&y.recurringRule),p=c>0?Math.round(l/c*100):0;return{date:r,plannedCount:c,completedCount:l,inProgressCount:u,practicesDue:h,completionPercentage:p,totalTimeMinutes:Math.round(f)}}async quickCapture(e,t=!0,r){let i=(0,k8.v4)(),s=fl.DateFormatter.toISOTimestamp(new Date),a=`${i}.md`,c="03 Knowledge/kitelev",l=["---",`exo__Asset_uid: "${i}"`,`exo__Asset_label: "${e}"`,'exo__Instance_class: "[[ems__Task]]"'];if(r?.prototypeUid){let d=this.buildPrototypeUri(r.prototypeUid);l.push(`exo__Asset_prototype: "${d}"`)}if(r?.areaUid){let d=this.buildAssetUri(r.areaUid);l.push(`ems__Effort_area: "${d}"`)}if(r?.parentUid){let d=this.buildAssetUri(r.parentUid);l.push(`ems__Effort_parent: "${d}"`)}t?(l.push('ems__Effort_status: "[[ems__EffortStatusDoing]]"'),l.push(`ems__Effort_startTimestamp: ${s}`)):l.push('ems__Effort_status: "[[ems__EffortStatusBacklog]]"'),l.push("---","","");let u=l.join(`
372
+ `),f=`${c}/${a}`;return await this.vault.create(f,u),{path:f,uid:i,label:e,started:t}}async createFromPractice(e){let r=(await this.getPractices()).find(a=>a.uid===e.prototypeUid);if(!r)throw new Error(`Practice not found: ${e.prototypeUid}`);if(r.doneToday)throw new Error(`Practice "${r.label}" already completed today`);if(r.inProgressToday&&r.todayInstancePath)return{path:r.todayInstancePath,uid:e.prototypeUid,label:r.label,started:!0};let i=fl.DateFormatter.toDateString(new Date),s=e.label||`${r.label} ${i}`;return this.quickCapture(s,e.startImmediately??!0,{prototypeUid:e.prototypeUid,areaUid:e.areaUid,parentUid:e.parentUid})}async markPracticeDone(e){let r=(await this.getPractices()).find(u=>u.uid===e);if(!r)throw new Error(`Practice not found: ${e}`);if(r.doneToday)return;if(!r.todayInstancePath)throw new Error(`No active instance for practice "${r.label}" today`);let i=this.vault.getAbstractFileByPath(r.todayInstancePath);if(!i||!("basename"in i))throw new Error(`File not found: ${r.todayInstancePath}`);let s=i,a=await this.vault.read(s),c=fl.DateFormatter.toISOTimestamp(new Date),l=this.frontmatterService.updateProperty(a,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');l=this.frontmatterService.updateProperty(l,"ems__Effort_endTimestamp",c),l=this.frontmatterService.updateProperty(l,"ems__Effort_resolutionTimestamp",c),await this.vault.modify(s,l)}async findTodayInstance(e,t){let r=this.vault.getAllFiles();for(let i of r)if(i.path.endsWith(".md"))try{let s=await this.vault.read(i),a=this.frontmatterService.parse(s);if(!a.exists)continue;let c=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_prototype");if(!c||!c.includes(e))continue;let l=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_label"),u=this.frontmatterService.getPropertyValue(a.content,"ems__Effort_startTimestamp"),f=l?.includes(t),d=u?new Date(u):null,h=d&&fl.DateFormatter.toDateString(d)===t;if(!f&&!h)continue;let p=this.frontmatterService.getPropertyValue(a.content,"ems__Effort_status");return this.isDoneStatus(p)?{path:i.path,status:"done"}:this.isDoingStatus(p)?{path:i.path,status:"doing"}:{path:i.path,status:"other"}}catch{continue}return null}isTaskPrototype(e){return e?e.includes("ems__TaskPrototype")||e.includes("TaskPrototype"):!1}isTask(e){return e?(e.includes("ems__Task")||e.includes("[[ems__Task]]"))&&!e.includes("Prototype"):!1}isDoneStatus(e){return e?e.includes("Done")||e.includes("EffortStatusDone"):!1}isDoingStatus(e){return e?e.includes("Doing")||e.includes("EffortStatusDoing"):!1}calculateDurationMinutes(e,t){let r=new Date(e);return(new Date(t).getTime()-r.getTime())/1e3/60}buildPrototypeUri(e){return`obsidian://vault/03%20Knowledge%2Fkitelev%2F${e}.md`}buildAssetUri(e){return`obsidian://vault/03%20Knowledge%2Fkitelev%2F${e}.md`}};ji.DailyReviewService=Tv;ji.DailyReviewService=Tv=O8([(0,Rx.injectable)(),D8(0,(0,Rx.inject)(N8.DI_TOKENS.IVaultAdapter)),F8("design:paramtypes",[Object])],Tv)});var xv=S(Yr=>{"use strict";var M8=Yr&&Yr.__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},j8=Yr&&Yr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},$8=Yr&&Yr.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.CriticalityZoneService=Yr.CriticalityZoneUUIDs=void 0;var Ox=ue(),V8=Jn(),B8=wt();Yr.CriticalityZoneUUIDs={TODAY:"e266a2e9-9eb0-431d-b1fe-b95b9d3e9a3f",THIS_WEEK:"c7f1a968-0959-4ac7-ac82-31b0cdc2aba7",SOMEDAY:"6968a0fc-7a41-4393-82b1-17d767c7ad7c"};var Av=class{static{o(this,"CriticalityZoneService")}constructor(e){this.vault=e,this.frontmatterService=new V8.FrontmatterService}async setZoneToday(e){await this.setZone(e,Yr.CriticalityZoneUUIDs.TODAY)}async setZoneThisWeek(e){await this.setZone(e,Yr.CriticalityZoneUUIDs.THIS_WEEK)}async setZoneSomeday(e){await this.setZone(e,Yr.CriticalityZoneUUIDs.SOMEDAY)}async setZone(e,t){let r=await this.vault.read(e),i=this.frontmatterService.updateProperty(r,"ems__Task_zone",`"[[${t}]]"`);await this.vault.modify(e,i)}};Yr.CriticalityZoneService=Av;Yr.CriticalityZoneService=Av=M8([(0,Ox.injectable)(),$8(0,(0,Ox.inject)(B8.DI_TOKENS.IVaultAdapter)),j8("design:paramtypes",[Object])],Av)});var Fx=S(cm=>{"use strict";Object.defineProperty(cm,"__esModule",{value:!0});cm.EffortSortingHelpers=void 0;var Cv=class n{static{o(this,"EffortSortingHelpers")}static getTimeFromTimestamp(e){if(!e)return"00:00:00";let t=new Date(e);if(isNaN(t.getTime()))return"00:00:00";let r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${r}:${i}:${s}`}static sortByStartTime(e,t){let r=n.getTimeFromTimestamp(e.startTimestamp),i=n.getTimeFromTimestamp(t.startTimestamp),s=r==="00:00:00",a=i==="00:00:00";return s&&!a?1:!s&&a?-1:r.localeCompare(i)}static sortByPriority(e,t){if(e.isTrashed!==t.isTrashed)return e.isTrashed?1:-1;if(e.isDone!==t.isDone)return e.isDone?1:-1;let r=typeof e.metadata.ems__Effort_votes=="number"?e.metadata.ems__Effort_votes:0,i=typeof t.metadata.ems__Effort_votes=="number"?t.metadata.ems__Effort_votes:0;return r!==i?i-r:e.startTime&&t.startTime?e.startTime.localeCompare(t.startTime):e.startTime?-1:t.startTime?1:0}};cm.EffortSortingHelpers=Cv});var Dx=S(lm=>{"use strict";Object.defineProperty(lm,"__esModule",{value:!0});lm.FilenameValidator=void 0;var qo=class{static{o(this,"FilenameValidator")}static validate(e,t={}){let{maxLength:r=this.DEFAULT_MAX_LENGTH,replacementChar:i=this.DEFAULT_REPLACEMENT,allowEmpty:s=!1}=t,a=[];if(!e||e.trim().length===0)return s||a.push("Filename cannot be empty"),{valid:a.length===0,sanitized:"",errors:a};e.endsWith(" ")&&a.push("Filename should not end with a space");let c=e.trim();this.INVALID_CHARS_PATTERN.test(c)&&a.push('Filename contains invalid characters: / \\ : * ? " < > |');let l=this.getBaseName(c);this.RESERVED_NAMES.has(l.toUpperCase())&&a.push(`"${l}" is a reserved filename on Windows`),c.length>r&&a.push(`Filename exceeds maximum length of ${r} characters`),c.startsWith(".")&&a.push("Filename should not start with a dot"),c.endsWith(".")&&a.push("Filename should not end with a dot");let u=this.sanitize(e,{maxLength:r,replacementChar:i});return{valid:a.length===0,sanitized:u,errors:a}}static sanitize(e,t={}){let{maxLength:r=this.DEFAULT_MAX_LENGTH,replacementChar:i=this.DEFAULT_REPLACEMENT}=t;if(!e||e.trim().length===0)return"";let s=e.trim();for(s=s.replace(this.INVALID_CHARS_PATTERN,i);s.startsWith(".")&&s.length>1;)s=s.substring(1);for(;s.length>0&&(s.endsWith(".")||s.endsWith(" "));)s=s.slice(0,-1);for(s.includes(i)&&(s=s.split(i).filter(u=>u!=="").join(i));s.startsWith(i);)s=s.slice(i.length);for(;s.endsWith(i);)s=s.slice(0,-i.length);let a=this.getBaseName(s);if(this.RESERVED_NAMES.has(a.toUpperCase())){let c=this.getExtension(s);s=a+i+c}if(s.length>r)for(s=s.slice(0,r);s.endsWith(i);)s=s.slice(0,-i.length);return s}static hasInvalidChars(e){return this.INVALID_CHARS_PATTERN.test(e)}static getInvalidChars(e){let t=e.match(this.INVALID_CHARS_PATTERN);return t?[...new Set(t)]:[]}static getBaseName(e){let t=e.lastIndexOf(".");return t===-1||t===0?e:e.substring(0,t)}static getExtension(e){let t=e.lastIndexOf(".");return t===-1||t===0?"":e.substring(t)}};lm.FilenameValidator=qo;qo.INVALID_CHARS_PATTERN=/[/\\:*?"<>|\x00-\x1F]/g;qo.RESERVED_NAMES=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]);qo.DEFAULT_MAX_LENGTH=200;qo.DEFAULT_REPLACEMENT="_"});var Rv=S(um=>{"use strict";Object.defineProperty(um,"__esModule",{value:!0});um.NTriplesSerializer=void 0;var Iv=class{static{o(this,"NTriplesSerializer")}serialize(e,t={}){let r=t.newline??`
373
373
  `;return e.length===0?"":e.map(i=>i.toString()).join(r)+r}serializeChunk(e,t){return e.length===0?"":e.map(r=>r.toString()).join(t)+t}};um.NTriplesSerializer=Iv});var Nx=S(fm=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});fm.TurtleSerializer=void 0;var dl=yr(),U8=Rv(),q8={rdf:dl.Namespace.RDF.iri.value,rdfs:dl.Namespace.RDFS.iri.value,owl:dl.Namespace.OWL.iri.value,xsd:dl.Namespace.XSD.iri.value,exo:dl.Namespace.EXO.iri.value,ems:dl.Namespace.EMS.iri.value},Pv=class{static{o(this,"TurtleSerializer")}constructor(){this.nTriplesSerializer=new U8.NTriplesSerializer}serialize(e,t={}){let r=t.newline??`
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?{...q8,...e.prefixes??{}}:{...e.prefixes??{}}}serializeTriplesOnly(e,t){return this.nTriplesSerializer.serializeChunk(e,t).trimEnd()}};fm.TurtleSerializer=Pv});var Mx=S(dm=>{"use strict";Object.defineProperty(dm,"__esModule",{value:!0});dm.JSONLDSerializer=void 0;var Lx=Ae(),kx=qt(),W8=Ne(),hl=yr(),G8={rdf:hl.Namespace.RDF.iri.value,rdfs:hl.Namespace.RDFS.iri.value,owl:hl.Namespace.OWL.iri.value,xsd:hl.Namespace.XSD.iri.value,exo:hl.Namespace.EXO.iri.value,ems:hl.Namespace.EMS.iri.value},Ov=class{static{o(this,"JSONLDSerializer")}toDocument(e,t={}){let r={...G8,...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 Lx.IRI?e.value:e instanceof kx.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 Lx.IRI)return{"@id":e.value};if(e instanceof kx.BlankNode)return{"@id":`_:${e.id}`};if(e instanceof W8.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}};dm.JSONLDSerializer=Ov});var Nv=S(hm=>{"use strict";Object.defineProperty(hm,"__esModule",{value:!0});hm.NTriplesParser=void 0;var z8=Qn(),jx=Ae(),Fv=Ne(),H8=qt(),pl=yr(),Q8={rdf:pl.Namespace.RDF.iri.value,rdfs:pl.Namespace.RDFS.iri.value,owl:pl.Namespace.OWL.iri.value,xsd:pl.Namespace.XSD.iri.value,exo:pl.Namespace.EXO.iri.value,ems:pl.Namespace.EMS.iri.value},Dv=class{static{o(this,"NTriplesParser")}parse(e,t={}){let r={prefixes:{...Q8,...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 z8.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 jx.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 jx.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 H8.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 Fv.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 Fv.Literal(i,void 0,l),rest:(u??"").trimStart()}}return{node:new Fv.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
- `,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}};hm.NTriplesParser=Dv});var $x=S(pm=>{"use strict";Object.defineProperty(pm,"__esModule",{value:!0});pm.TurtleParser=void 0;var ml=yr(),Y8=Nv(),K8={rdf:ml.Namespace.RDF.iri.value,rdfs:ml.Namespace.RDFS.iri.value,owl:ml.Namespace.OWL.iri.value,xsd:ml.Namespace.XSD.iri.value,exo:ml.Namespace.EXO.iri.value,ems:ml.Namespace.EMS.iri.value},X8=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,Lv=class{static{o(this,"TurtleParser")}constructor(){this.nTriplesParser=new Y8.NTriplesParser}parse(e,t={}){let r={...K8,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:a,lineNumber:c})=>{if(this.isPrefixStatement(a)){let u=a.match(X8);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}};pm.TurtleParser=Lv});var Vx=S(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});mm.RDFSerializer=void 0;var gl=Qn(),qo=Ae(),Wo=Ne(),kv=qt(),gs=yr(),J8=Nx(),Z8=Rv(),e$=Mx(),t$=$x(),r$=Nv(),n$=1024,i$=`
376
- `,s$={rdf:gs.Namespace.RDF.iri.value,rdfs:gs.Namespace.RDFS.iri.value,owl:gs.Namespace.OWL.iri.value,xsd:gs.Namespace.XSD.iri.value,exo:gs.Namespace.EXO.iri.value,ems:gs.Namespace.EMS.iri.value},Mv=class{static{o(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new J8.TurtleSerializer,this.nTriplesSerializer=new Z8.NTriplesSerializer,this.jsonldSerializer=new e$.JSONLDSerializer,this.turtleParser=new t$.TurtleParser,this.nTriplesParser=new r$.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??i$,i=t.batchSize??n$,s=t.includeDefaultPrefixes,a=t.prefixes,c=this,l=!1,u=[],f=[],d=0,h=o(async()=>{if(!l){if(f=await c.store.match(),e==="json-ld"){let y=c.jsonldSerializer.toDocument(f,{context:a,pretty:!1});u.push(...c.buildJsonLdChunks(y))}else if(e==="turtle"){let y=c.turtleSerializer.serializePrefixes(c.composePrefixes(a,s),r);y&&u.push(`${y}${r}${r}`)}l=!0}},"ensureInitialized");return{async next(){if(await h(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(d>=f.length)return{value:void 0,done:!0};let y=f.slice(d,d+i);d+=y.length;let v="";if(e==="turtle"){let E=c.turtleSerializer.serializeTriplesOnly(y,r);E&&(v=`${E}${r}`)}else e==="n-triples"&&(v=c.nTriplesSerializer.serializeChunk(y,r));return v?{value:v,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?{...s$,...e??{}}:{...e??{}}}parseJsonLd(e,t){let r;try{r=JSON.parse(e)}catch(u){throw new Error(`Invalid JSON-LD document: ${u.message}`)}let i=this.composePrefixes(t.prefixes,!0),s=this.extractContext(r),a={...i,...s},c=this.extractGraph(r),l=[];return c.forEach((u,f)=>{if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`Invalid JSON-LD node at index ${f}`);let d=this.parseSubjectFromNode(u,a,f),h=Object.entries(u);for(let[p,y]of h){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(d,y,l,a);continue}let v=this.expandTerm(p,a),E=new qo.IRI(v);this.collectTriplesForValue(d,E,y,l,a)}}),l}extractContext(e){if(!e||typeof e!="object"||Array.isArray(e))return{};let t=e["@context"];if(!t||typeof t!="object"||Array.isArray(t))return{};let r={};return Object.entries(t).forEach(([i,s])=>{typeof s=="string"&&(r[i]=s)}),r}extractGraph(e){if(Array.isArray(e))return e;if(!e||typeof e!="object")return[];let t=e["@graph"];return Array.isArray(t)?t:[e]}parseSubjectFromNode(e,t,r){let i=e["@id"];if(typeof i=="string"){if(i.startsWith("_:"))return new kv.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new qo.IRI(i);let s=this.expandTerm(i,t);return new qo.IRI(s)}return new kv.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=gs.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 gl.Triple(e,s,new qo.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 gl.Triple(e,t,c));return}if(a["@value"]!==void 0){let c=this.parseLiteralObject(a,s);i.push(new gl.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new gl.Triple(e,t,new Wo.Literal(r)));return}if(typeof r=="number"){let a=Number.isInteger(r)?gs.Namespace.XSD.term("integer"):gs.Namespace.XSD.term("decimal");i.push(new gl.Triple(e,t,new Wo.Literal(r.toString(),a)));return}if(typeof r=="boolean"){let a=gs.Namespace.XSD.term("boolean");i.push(new gl.Triple(e,t,new Wo.Literal(r.toString(),a)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new kv.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new qo.IRI(e);let r=this.expandTerm(e,t);return new qo.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 Wo.Literal(r,void 0,e["@language"],i):new Wo.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new Wo.Literal(r,new qo.IRI(i))}return new Wo.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}};mm.RDFSerializer=Mv});var jv=S(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.OBSIDIAN_VAULT_SCHEME=void 0;yl.vaultPathToIRI=a$;yl.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function a$(n){let e=n.startsWith("./")?n.slice(2):n;return`${yl.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}o(a$,"vaultPathToIRI")});var Vv=S(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:!0});gm.RDFVocabularyMapper=void 0;var tr=Qn(),Bx=Ae(),J=yr(),$v=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",J.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",J.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",J.Namespace.RDFS.term("subClassOf")],["exo__Property_range",J.Namespace.RDFS.term("range")],["exo__Property_domain",J.Namespace.RDFS.term("domain")],["exo__Property_superProperty",J.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new tr.Triple(J.Namespace.EXO.term("Asset"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDFS.term("Resource"))),e.push(new tr.Triple(J.Namespace.EXO.term("Class"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDFS.term("Class"))),e.push(new tr.Triple(J.Namespace.EXO.term("Property"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDF.term("Property"))),e.push(new tr.Triple(J.Namespace.EMS.term("Task"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("Project"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("Area"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("Workflow"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("WorkflowState"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("WorkflowTransition"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EXOCMD.term("Command"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EXOCMD.term("Precondition"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EXOCMD.term("Grounding"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EXOCMD.term("CommandBinding"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new tr.Triple(J.Namespace.EXO.term("Instance_class"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDF.term("type"))),e.push(new tr.Triple(J.Namespace.EXO.term("Asset_isDefinedBy"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("isDefinedBy"))),e.push(new tr.Triple(J.Namespace.EXO.term("Class_superClass"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("subClassOf"))),e.push(new tr.Triple(J.Namespace.EXO.term("Property_range"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("range"))),e.push(new tr.Triple(J.Namespace.EXO.term("Property_domain"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("domain"))),e.push(new tr.Triple(J.Namespace.EXO.term("Property_superProperty"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof Bx.IRI)s=r;else{let a=r.match(/^(ems|exo|exocmd)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?J.Namespace.EMS:c==="exocmd"?J.Namespace.EXOCMD:J.Namespace.EXO).term(l)}else s=new Bx.IRI(r)}return new tr.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};gm.RDFVocabularyMapper=$v});var Ux=S(_m=>{"use strict";Object.defineProperty(_m,"__esModule",{value:!0});_m.RDFSInferenceEngine=void 0;var o$=Qn(),ym=Ae(),Bv=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 ym.IRI){let h=a.get(d.object.value);if(h)for(let p of h)u.push(new o$.Triple(d.subject,i,new ym.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 ym.IRI&&s.object instanceof ym.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}};_m.RDFSInferenceEngine=Bv});var Wv=S(Go=>{"use strict";var c$=Go&&Go.__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(Go,"__esModule",{value:!0});Go.NonInheritablePropertyRegistry=void 0;var l$=ue(),qx=Ae(),Wx=Ne(),Uv=yr(),qv=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 Wx.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 Wx.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof qx.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 qx.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?Uv.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?Uv.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?Uv.Namespace.EXOCMD.term(e.substring(8)).value:null}};Go.NonInheritablePropertyRegistry=qv;Go.NonInheritablePropertyRegistry=qv=c$([(0,l$.injectable)()],qv)});var Hv=S(zo=>{"use strict";var u$=zo&&zo.__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(zo,"__esModule",{value:!0});zo.PropertyCardinalityRegistry=void 0;var f$=ue(),Gx=Ae(),zx=Ne(),Gv=yr(),zv=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 zx.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 zx.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof Gx.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 Gx.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?Gv.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?Gv.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?Gv.Namespace.EXOCMD.term(e.substring(8)).value:null}};zo.PropertyCardinalityRegistry=zv;zo.PropertyCardinalityRegistry=zv=u$([(0,f$.injectable)()],zv)});var Kv=S(Sr=>{"use strict";var d$=Sr&&Sr.__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},h$=Sr&&Sr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.PrototypeChainMaterializer=Sr.MAX_PROTOTYPE_DEPTH=Sr.INFERRED_GRAPH=void 0;Sr.inferredGraphForDepth=Qv;var p$=ue(),Hx=Qn(),Va=Ae(),m$=Wv(),g$=Hv();Sr.INFERRED_GRAPH=new Va.IRI("https://exocortex.my/ontology/exo#inferred");var y$="https://exocortex.my/ontology/exo#inferred/";function Qv(n){return new Va.IRI(`${y$}${n}`)}o(Qv,"inferredGraphForDepth");Sr.MAX_PROTOTYPE_DEPTH=10;var Yv=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 Va.IRI&&c.object instanceof Va.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 Va.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let y=p.object instanceof Va.IRI?p.object.value:String(p.object),v=h.get(p.predicate.value);v||(v=new Set,h.set(p.predicate.value,v)),v.add(y)}for(let p=0;p<u.length;p++){let y=u[p],v=p+1,E=new Va.IRI(y),b=await e.match(E,void 0,void 0),A=new Set;if(e.matchInGraph){let I=await e.matchInGraph(E,void 0,void 0,Sr.INFERRED_GRAPH);for(let j of I)A.add(j.predicate.value)}for(let I of b){let j=I.predicate.value;if(this.registry.isNonInheritable(j)||A.has(j))continue;if(d.has(j)&&this.isMultiValued(j)){let te=I.object instanceof Va.IRI?I.object.value:String(I.object);if(h.get(j)?.has(te))continue;let G=h.get(j);G||(G=new Set,h.set(j,G)),G.add(te);let F=new Hx.Triple(l,I.predicate,I.object);await e.add(F),e.addToGraph&&(await e.addToGraph(F,Sr.INFERRED_GRAPH),await e.addToGraph(F,Qv(v))),a++;continue}if(d.has(j))continue;let B=new Hx.Triple(l,I.predicate,I.object);await e.add(B),e.addToGraph&&(await e.addToGraph(B,Sr.INFERRED_GRAPH),await e.addToGraph(B,Qv(v))),d.add(j),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<Sr.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}};Sr.PrototypeChainMaterializer=Yv;Sr.PrototypeChainMaterializer=Yv=d$([(0,p$.injectable)(),h$("design:paramtypes",[m$.NonInheritablePropertyRegistry,g$.PropertyCardinalityRegistry])],Yv)});var Jv=S(dr=>{"use strict";var _$=dr&&dr.__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},S$=dr&&dr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(dr,"__esModule",{value:!0});dr.SourceAnnotator=dr.DEPTH_VARIABLE=dr.SOURCE_VARIABLE=void 0;var v$=ue(),_l=Ne(),b$=Ae(),Sm=Kv();dr.SOURCE_VARIABLE="_source";dr.DEPTH_VARIABLE="_depth";var Xv=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(dr.SOURCE_VARIABLE,new _l.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(dr.SOURCE_VARIABLE,new _l.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(dr.SOURCE_VARIABLE,new _l.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,Sm.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=Sm.MAX_PROTOTYPE_DEPTH;i++){let s=(0,Sm.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(dr.SOURCE_VARIABLE,new _l.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 b$.IRI))c.set(dr.SOURCE_VARIABLE,new _l.Literal("own"));else{let l=a.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(a,void 0,void 0,Sm.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(dr.SOURCE_VARIABLE,new _l.Literal(u))}r.push(c)}return r}};dr.SourceAnnotator=Xv;dr.SourceAnnotator=Xv=_$([(0,v$.injectable)(),S$("design:paramtypes",[Object])],Xv)});var eb=S($i=>{"use strict";var w$=$i&&$i.__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},E$=$i&&$i.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Qx=$i&&$i.__param||function(n,e){return function(t,r){e(t,r,n)}},Sl;Object.defineProperty($i,"__esModule",{value:!0});$i.NoteToRDFConverter=void 0;var Zv=ue(),hn=Qn(),Ho=Ae(),In=Ne(),Yx=qt(),Yt=yr(),Kx=wt(),T$=Vv(),A$=Ic(),Xx=jv(),Rn=G0(),Qo=Sl=class{static{o(this,"NoteToRDFConverter")}constructor(e,t=A$.NullLogger){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new T$.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?Rn.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Yt.Namespace.EXO.term("Asset_fileName");r.push(new hn.Triple(i,s,new In.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 hn.Triple(i,u,h))}else{let h=await this.valueToRDFObject(d,e);for(let p of h)if(r.push(new hn.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof Ho.IRI){let y=this.vocabularyMapper.generateMappedTriple(i,c,p);y&&r.push(y)}}if(c==="exo__Instance_class")for(let d of f){let h=this.valueToClassURI(d);if(h instanceof Ho.IRI){let p=Yt.Namespace.RDF.term("type");r.push(new hn.Triple(i,p,h))}}if(c==="exo__Asset_label"){let d=Yt.Namespace.RDFS.term("label");for(let h of f)typeof h=="string"&&h.length>0&&r.push(new hn.Triple(i,d,new In.Literal(h)))}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=Rn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Rn.Exo003MetadataType.Namespace:break;case Rn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Rn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Rn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Rn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new Ho.IRI(t.uri);return[new hn.Triple(r,Yt.Namespace.OWL.term("sameAs"),i),new hn.Triple(i,Yt.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 hn.Triple(r,Yt.Namespace.OWL.term("sameAs"),new Yx.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Rn.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new hn.Triple(a,Yt.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 Ho.IRI(c.value):new Yx.BlankNode(c.value),f=new Ho.IRI(l.value),d=Rn.Exo003Parser.toLiteral(t,s.trim());r.push(new hn.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new hn.Triple(h,Yt.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&&Rn.Exo003Parser.isExo003Format(a)){let c=Rn.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Rn.Exo003MetadataType.Anchor||l.metadata===Rn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Rn.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=this.vault.getFrontmatter(a),l=c?this.validateExocortexAsset(c):null;if(l){if(s)throw new Error(`Invariant violation in "${a.path}": ${l.message}`);i.push({path:a.path,reason:`Invariant violation: ${l.message}`}),this.logger.warn(`Skipping file with invariant violation: ${a.path}`,{code:l.code,property:l.property,reason:l.message});continue}let u=await this.convertNote(a);r.push(...u)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),this.logger.warn(`Skipping file with invalid IRI: ${a.path}`,{reason:l})}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}validateExocortexAsset(e){let t=o(l=>l==null?!0:typeof l=="string"?l.trim()==="":Array.isArray(l)?l.length===0||l.every(t):!1,"isEmpty");if(!("exo__Instance_class"in e||"exo__Asset_uid"in e))return null;let i=["exo__Asset_uid","exo__Asset_isDefinedBy","exo__Asset_label","exo__Instance_class"];for(let l of i){if(!(l in e))return{code:"MISSING_PROPERTY",property:l,message:`Required property "${l}" is missing`};if(t(e[l]))return{code:"EMPTY_PROPERTY",property:l,message:`Required property "${l}" is empty`}}let s=["ems__Effort_status","ems__Effort_parent","ems__Effort_lockedBy","ems__Effort_lockExpires","exo__Asset_updatedAt","ems__Effort_startTimestamp"];for(let l of s)if(l in e&&t(e[l]))return{code:"EMPTY_OPTIONAL_PROPERTY",property:l,message:`Optional property "${l}" is present but empty`};let a=e.exo__Instance_class,c=Array.isArray(a)?a:[a];for(let l of c){if(typeof l!="string")continue;let u=this.removeQuotes(l),d=(this.extractWikilink(u)??u).trim();if(/^[a-z][a-zA-Z0-9]*__/.test(d)&&/[\s()]/.test(d))return{code:"INVALID_INSTANCE_CLASS_IRI",property:"exo__Instance_class",message:`Invalid Instance_class IRI: "${l}"`}}return null}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=(0,Xx.vaultPathToIRI)(r.path);Ho.IRI.isValidIRI(i)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new Ho.IRI((0,Xx.vaultPathToIRI)(e))}isExocortexProperty(e){return Sl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))}propertyKeyToIRI(e){for(let[t,r]of Sl.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 In.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 In.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new In.Literal(r,Yt.Namespace.XSD.term("dateTime"))]:[new In.Literal(r)]}return typeof e=="boolean"?[new In.Literal(e.toString())]:typeof e=="number"?[new In.Literal(e.toString(),Yt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new In.Literal(e.toISOString(),Yt.Namespace.XSD.term("dateTime"))]:[new In.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 In.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 In.Literal(t)}isClassReference(e){return Sl.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 Sl.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=Yt.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 hn.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new hn.Triple(t,c,f)):r.push(new hn.Triple(t,c,new In.Literal(l)))}else r.push(new hn.Triple(t,c,new In.Literal(l)))}}catch{}return r}};$i.NoteToRDFConverter=Qo;Qo.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Qo.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Qo.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};Qo.NAMESPACE_MAP=[["exo__",Yt.Namespace.EXO],["ems__",Yt.Namespace.EMS],["exocmd__",Yt.Namespace.EXOCMD],["ims__",Yt.Namespace.IMS],["ztlk__",Yt.Namespace.ZTLK],["ptms__",Yt.Namespace.PTMS],["lit__",Yt.Namespace.LIT],["inbox__",Yt.Namespace.INBOX],["pmbok__",Yt.Namespace.PMBOK]];$i.NoteToRDFConverter=Qo=Sl=w$([(0,Zv.injectable)(),Qx(0,(0,Zv.inject)(Kx.DI_TOKENS.IVaultAdapter)),Qx(1,(0,Zv.inject)(Kx.DI_TOKENS.ILogger)),E$("design:paramtypes",[Object,Object])],Qo)});var rb=S(vm=>{"use strict";Object.defineProperty(vm,"__esModule",{value:!0});vm.FilterContainsOptimizer=void 0;var x$=Ae(),C$=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,tb=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(C$);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 x$.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)}};vm.FilterContainsOptimizer=tb});var Jx=S(bm=>{"use strict";Object.defineProperty(bm,"__esModule",{value:!0});bm.AlgebraOptimizer=void 0;var I$=rb(),nb=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new I$.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)}};bm.AlgebraOptimizer=nb});var Zx=S(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});wm.AlgebraSerializer=void 0;var ib=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
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}};hm.NTriplesParser=Dv});var $x=S(pm=>{"use strict";Object.defineProperty(pm,"__esModule",{value:!0});pm.TurtleParser=void 0;var ml=yr(),Y8=Nv(),K8={rdf:ml.Namespace.RDF.iri.value,rdfs:ml.Namespace.RDFS.iri.value,owl:ml.Namespace.OWL.iri.value,xsd:ml.Namespace.XSD.iri.value,exo:ml.Namespace.EXO.iri.value,ems:ml.Namespace.EMS.iri.value},X8=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,Lv=class{static{o(this,"TurtleParser")}constructor(){this.nTriplesParser=new Y8.NTriplesParser}parse(e,t={}){let r={...K8,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:a,lineNumber:c})=>{if(this.isPrefixStatement(a)){let u=a.match(X8);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}};pm.TurtleParser=Lv});var Vx=S(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});mm.RDFSerializer=void 0;var gl=Qn(),Wo=Ae(),Go=Ne(),kv=qt(),gs=yr(),J8=Nx(),Z8=Rv(),e$=Mx(),t$=$x(),r$=Nv(),n$=1024,i$=`
376
+ `,s$={rdf:gs.Namespace.RDF.iri.value,rdfs:gs.Namespace.RDFS.iri.value,owl:gs.Namespace.OWL.iri.value,xsd:gs.Namespace.XSD.iri.value,exo:gs.Namespace.EXO.iri.value,ems:gs.Namespace.EMS.iri.value},Mv=class{static{o(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new J8.TurtleSerializer,this.nTriplesSerializer=new Z8.NTriplesSerializer,this.jsonldSerializer=new e$.JSONLDSerializer,this.turtleParser=new t$.TurtleParser,this.nTriplesParser=new r$.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??i$,i=t.batchSize??n$,s=t.includeDefaultPrefixes,a=t.prefixes,c=this,l=!1,u=[],f=[],d=0,h=o(async()=>{if(!l){if(f=await c.store.match(),e==="json-ld"){let y=c.jsonldSerializer.toDocument(f,{context:a,pretty:!1});u.push(...c.buildJsonLdChunks(y))}else if(e==="turtle"){let y=c.turtleSerializer.serializePrefixes(c.composePrefixes(a,s),r);y&&u.push(`${y}${r}${r}`)}l=!0}},"ensureInitialized");return{async next(){if(await h(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(d>=f.length)return{value:void 0,done:!0};let y=f.slice(d,d+i);d+=y.length;let v="";if(e==="turtle"){let E=c.turtleSerializer.serializeTriplesOnly(y,r);E&&(v=`${E}${r}`)}else e==="n-triples"&&(v=c.nTriplesSerializer.serializeChunk(y,r));return v?{value:v,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?{...s$,...e??{}}:{...e??{}}}parseJsonLd(e,t){let r;try{r=JSON.parse(e)}catch(u){throw new Error(`Invalid JSON-LD document: ${u.message}`)}let i=this.composePrefixes(t.prefixes,!0),s=this.extractContext(r),a={...i,...s},c=this.extractGraph(r),l=[];return c.forEach((u,f)=>{if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`Invalid JSON-LD node at index ${f}`);let d=this.parseSubjectFromNode(u,a,f),h=Object.entries(u);for(let[p,y]of h){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(d,y,l,a);continue}let v=this.expandTerm(p,a),E=new Wo.IRI(v);this.collectTriplesForValue(d,E,y,l,a)}}),l}extractContext(e){if(!e||typeof e!="object"||Array.isArray(e))return{};let t=e["@context"];if(!t||typeof t!="object"||Array.isArray(t))return{};let r={};return Object.entries(t).forEach(([i,s])=>{typeof s=="string"&&(r[i]=s)}),r}extractGraph(e){if(Array.isArray(e))return e;if(!e||typeof e!="object")return[];let t=e["@graph"];return Array.isArray(t)?t:[e]}parseSubjectFromNode(e,t,r){let i=e["@id"];if(typeof i=="string"){if(i.startsWith("_:"))return new kv.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new Wo.IRI(i);let s=this.expandTerm(i,t);return new Wo.IRI(s)}return new kv.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=gs.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 gl.Triple(e,s,new Wo.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 gl.Triple(e,t,c));return}if(a["@value"]!==void 0){let c=this.parseLiteralObject(a,s);i.push(new gl.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new gl.Triple(e,t,new Go.Literal(r)));return}if(typeof r=="number"){let a=Number.isInteger(r)?gs.Namespace.XSD.term("integer"):gs.Namespace.XSD.term("decimal");i.push(new gl.Triple(e,t,new Go.Literal(r.toString(),a)));return}if(typeof r=="boolean"){let a=gs.Namespace.XSD.term("boolean");i.push(new gl.Triple(e,t,new Go.Literal(r.toString(),a)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new kv.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new Wo.IRI(e);let r=this.expandTerm(e,t);return new Wo.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 Go.Literal(r,void 0,e["@language"],i):new Go.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new Go.Literal(r,new Wo.IRI(i))}return new Go.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}};mm.RDFSerializer=Mv});var jv=S(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.OBSIDIAN_VAULT_SCHEME=void 0;yl.vaultPathToIRI=a$;yl.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function a$(n){let e=n.startsWith("./")?n.slice(2):n;return`${yl.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}o(a$,"vaultPathToIRI")});var Vv=S(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:!0});gm.RDFVocabularyMapper=void 0;var tr=Qn(),Bx=Ae(),J=yr(),$v=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",J.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",J.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",J.Namespace.RDFS.term("subClassOf")],["exo__Property_range",J.Namespace.RDFS.term("range")],["exo__Property_domain",J.Namespace.RDFS.term("domain")],["exo__Property_superProperty",J.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new tr.Triple(J.Namespace.EXO.term("Asset"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDFS.term("Resource"))),e.push(new tr.Triple(J.Namespace.EXO.term("Class"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDFS.term("Class"))),e.push(new tr.Triple(J.Namespace.EXO.term("Property"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.RDF.term("Property"))),e.push(new tr.Triple(J.Namespace.EMS.term("Task"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("Project"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("Area"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("Workflow"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("WorkflowState"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EMS.term("WorkflowTransition"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EXOCMD.term("Command"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EXOCMD.term("Precondition"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EXOCMD.term("Grounding"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e.push(new tr.Triple(J.Namespace.EXOCMD.term("CommandBinding"),J.Namespace.RDFS.term("subClassOf"),J.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new tr.Triple(J.Namespace.EXO.term("Instance_class"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDF.term("type"))),e.push(new tr.Triple(J.Namespace.EXO.term("Asset_isDefinedBy"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("isDefinedBy"))),e.push(new tr.Triple(J.Namespace.EXO.term("Class_superClass"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("subClassOf"))),e.push(new tr.Triple(J.Namespace.EXO.term("Property_range"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("range"))),e.push(new tr.Triple(J.Namespace.EXO.term("Property_domain"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("domain"))),e.push(new tr.Triple(J.Namespace.EXO.term("Property_superProperty"),J.Namespace.RDFS.term("subPropertyOf"),J.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof Bx.IRI)s=r;else{let a=r.match(/^(ems|exo|exocmd)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?J.Namespace.EMS:c==="exocmd"?J.Namespace.EXOCMD:J.Namespace.EXO).term(l)}else s=new Bx.IRI(r)}return new tr.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};gm.RDFVocabularyMapper=$v});var Ux=S(_m=>{"use strict";Object.defineProperty(_m,"__esModule",{value:!0});_m.RDFSInferenceEngine=void 0;var o$=Qn(),ym=Ae(),Bv=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 ym.IRI){let h=a.get(d.object.value);if(h)for(let p of h)u.push(new o$.Triple(d.subject,i,new ym.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 ym.IRI&&s.object instanceof ym.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}};_m.RDFSInferenceEngine=Bv});var Wv=S(zo=>{"use strict";var c$=zo&&zo.__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(zo,"__esModule",{value:!0});zo.NonInheritablePropertyRegistry=void 0;var l$=ue(),qx=Ae(),Wx=Ne(),Uv=yr(),qv=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 Wx.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 Wx.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof qx.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 qx.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?Uv.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?Uv.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?Uv.Namespace.EXOCMD.term(e.substring(8)).value:null}};zo.NonInheritablePropertyRegistry=qv;zo.NonInheritablePropertyRegistry=qv=c$([(0,l$.injectable)()],qv)});var Hv=S(Ho=>{"use strict";var u$=Ho&&Ho.__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(Ho,"__esModule",{value:!0});Ho.PropertyCardinalityRegistry=void 0;var f$=ue(),Gx=Ae(),zx=Ne(),Gv=yr(),zv=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 zx.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 zx.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof Gx.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 Gx.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?Gv.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?Gv.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?Gv.Namespace.EXOCMD.term(e.substring(8)).value:null}};Ho.PropertyCardinalityRegistry=zv;Ho.PropertyCardinalityRegistry=zv=u$([(0,f$.injectable)()],zv)});var Kv=S(Sr=>{"use strict";var d$=Sr&&Sr.__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},h$=Sr&&Sr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.PrototypeChainMaterializer=Sr.MAX_PROTOTYPE_DEPTH=Sr.INFERRED_GRAPH=void 0;Sr.inferredGraphForDepth=Qv;var p$=ue(),Hx=Qn(),Va=Ae(),m$=Wv(),g$=Hv();Sr.INFERRED_GRAPH=new Va.IRI("https://exocortex.my/ontology/exo#inferred");var y$="https://exocortex.my/ontology/exo#inferred/";function Qv(n){return new Va.IRI(`${y$}${n}`)}o(Qv,"inferredGraphForDepth");Sr.MAX_PROTOTYPE_DEPTH=10;var Yv=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 Va.IRI&&c.object instanceof Va.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 Va.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let y=p.object instanceof Va.IRI?p.object.value:String(p.object),v=h.get(p.predicate.value);v||(v=new Set,h.set(p.predicate.value,v)),v.add(y)}for(let p=0;p<u.length;p++){let y=u[p],v=p+1,E=new Va.IRI(y),b=await e.match(E,void 0,void 0),A=new Set;if(e.matchInGraph){let I=await e.matchInGraph(E,void 0,void 0,Sr.INFERRED_GRAPH);for(let j of I)A.add(j.predicate.value)}for(let I of b){let j=I.predicate.value;if(this.registry.isNonInheritable(j)||A.has(j))continue;if(d.has(j)&&this.isMultiValued(j)){let te=I.object instanceof Va.IRI?I.object.value:String(I.object);if(h.get(j)?.has(te))continue;let G=h.get(j);G||(G=new Set,h.set(j,G)),G.add(te);let F=new Hx.Triple(l,I.predicate,I.object);await e.add(F),e.addToGraph&&(await e.addToGraph(F,Sr.INFERRED_GRAPH),await e.addToGraph(F,Qv(v))),a++;continue}if(d.has(j))continue;let B=new Hx.Triple(l,I.predicate,I.object);await e.add(B),e.addToGraph&&(await e.addToGraph(B,Sr.INFERRED_GRAPH),await e.addToGraph(B,Qv(v))),d.add(j),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<Sr.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}};Sr.PrototypeChainMaterializer=Yv;Sr.PrototypeChainMaterializer=Yv=d$([(0,p$.injectable)(),h$("design:paramtypes",[m$.NonInheritablePropertyRegistry,g$.PropertyCardinalityRegistry])],Yv)});var Jv=S(dr=>{"use strict";var _$=dr&&dr.__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},S$=dr&&dr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(dr,"__esModule",{value:!0});dr.SourceAnnotator=dr.DEPTH_VARIABLE=dr.SOURCE_VARIABLE=void 0;var v$=ue(),_l=Ne(),b$=Ae(),Sm=Kv();dr.SOURCE_VARIABLE="_source";dr.DEPTH_VARIABLE="_depth";var Xv=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(dr.SOURCE_VARIABLE,new _l.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(dr.SOURCE_VARIABLE,new _l.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(dr.SOURCE_VARIABLE,new _l.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,Sm.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=Sm.MAX_PROTOTYPE_DEPTH;i++){let s=(0,Sm.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(dr.SOURCE_VARIABLE,new _l.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 b$.IRI))c.set(dr.SOURCE_VARIABLE,new _l.Literal("own"));else{let l=a.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(a,void 0,void 0,Sm.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(dr.SOURCE_VARIABLE,new _l.Literal(u))}r.push(c)}return r}};dr.SourceAnnotator=Xv;dr.SourceAnnotator=Xv=_$([(0,v$.injectable)(),S$("design:paramtypes",[Object])],Xv)});var eb=S($i=>{"use strict";var w$=$i&&$i.__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},E$=$i&&$i.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Qx=$i&&$i.__param||function(n,e){return function(t,r){e(t,r,n)}},Sl;Object.defineProperty($i,"__esModule",{value:!0});$i.NoteToRDFConverter=void 0;var Zv=ue(),Kr=Qn(),Ba=Ae(),In=Ne(),Yx=qt(),Wt=yr(),Kx=wt(),T$=Vv(),A$=Ic(),Xx=jv(),Rn=G0(),Qo=Sl=class{static{o(this,"NoteToRDFConverter")}constructor(e,t=A$.NullLogger){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.pendingExtraTriples=[],this.vocabularyMapper=new T$.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?Rn.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){this.pendingExtraTriples=[];let r=[],i=this.notePathToIRI(e.path),s=Wt.Namespace.EXO.term("Asset_fileName");r.push(new Kr.Triple(i,s,new In.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 Kr.Triple(i,u,h))}else{let h=await this.valueToRDFObject(d,e,u);for(let p of h)if(r.push(new Kr.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof Ba.IRI){let y=this.vocabularyMapper.generateMappedTriple(i,c,p);y&&r.push(y)}}if(c==="exo__Instance_class")for(let d of f){let h=this.valueToClassURI(d);if(h instanceof Ba.IRI){let p=Wt.Namespace.RDF.term("type");r.push(new Kr.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 Kr.Triple(i,d,new In.Literal(h)))}}r.push(...this.pendingExtraTriples),this.pendingExtraTriples=[];let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=Rn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Rn.Exo003MetadataType.Namespace:break;case Rn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Rn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Rn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Rn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new Ba.IRI(t.uri);return[new Kr.Triple(r,Wt.Namespace.OWL.term("sameAs"),i),new Kr.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 Kr.Triple(r,Wt.Namespace.OWL.term("sameAs"),new Yx.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Rn.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new Kr.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 Ba.IRI(c.value):new Yx.BlankNode(c.value),f=new Ba.IRI(l.value),d=Rn.Exo003Parser.toLiteral(t,s.trim());r.push(new Kr.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new Kr.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&&Rn.Exo003Parser.isExo003Format(a)){let c=Rn.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Rn.Exo003MetadataType.Anchor||l.metadata===Rn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Rn.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=this.vault.getFrontmatter(a),l=c?this.validateExocortexAsset(c):null;if(l){if(s)throw new Error(`Invariant violation in "${a.path}": ${l.message}`);i.push({path:a.path,reason:`Invariant violation: ${l.message}`}),this.logger.warn(`Skipping file with invariant violation: ${a.path}`,{code:l.code,property:l.property,reason:l.message});continue}let u=await this.convertNote(a);r.push(...u)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),this.logger.warn(`Skipping file with invalid IRI: ${a.path}`,{reason:l})}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}validateExocortexAsset(e){let t=o(l=>l==null?!0:typeof l=="string"?l.trim()==="":Array.isArray(l)?l.length===0||l.every(t):!1,"isEmpty");if(!("exo__Instance_class"in e||"exo__Asset_uid"in e))return null;let i=["exo__Asset_uid","exo__Asset_isDefinedBy","exo__Asset_label","exo__Instance_class"];for(let l of i){if(!(l in e))return{code:"MISSING_PROPERTY",property:l,message:`Required property "${l}" is missing`};if(t(e[l]))return{code:"EMPTY_PROPERTY",property:l,message:`Required property "${l}" is empty`}}let s=["ems__Effort_status","ems__Effort_parent","ems__Effort_lockedBy","ems__Effort_lockExpires","exo__Asset_updatedAt","ems__Effort_startTimestamp"];for(let l of s)if(l in e&&t(e[l]))return{code:"EMPTY_OPTIONAL_PROPERTY",property:l,message:`Optional property "${l}" is present but empty`};let a=e.exo__Instance_class,c=Array.isArray(a)?a:[a];for(let l of c){if(typeof l!="string")continue;let u=this.removeQuotes(l),d=(this.extractWikilink(u)??u).trim();if(/^[a-z][a-zA-Z0-9]*__/.test(d)&&/[\s()]/.test(d))return{code:"INVALID_INSTANCE_CLASS_IRI",property:"exo__Instance_class",message:`Invalid Instance_class IRI: "${l}"`}}return null}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=(0,Xx.vaultPathToIRI)(r.path);Ba.IRI.isValidIRI(i)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new Ba.IRI((0,Xx.vaultPathToIRI)(e))}isExocortexProperty(e){return Sl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))}propertyKeyToIRI(e){for(let[t,r]of Sl.NAMESPACE_MAP)if(e.startsWith(t))return r.term(e.substring(t.length));throw new Error(`Invalid property key: ${e}`)}emitTypeTripleForEnumInstance(e,t){let r=this.vault.getFrontmatter(t);if(!r)return;let i=r.exo__Instance_class,s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return;let a=this.valueToClassURI(s);a instanceof Ba.IRI&&this.pendingExtraTriples.push(new Kr.Triple(e,Wt.Namespace.RDF.term("type"),a))}async valueToRDFObject(e,t,r){if(typeof e=="string"){let i=this.removeQuotes(e),s=this.extractWikilink(i);if(s){let a=this.vault.getFirstLinkpathDest(s,t.path);if(a){let c=this.notePathToIRI(a.path),l=s.includes("|")?s.split("|")[0]:s;if(this.isUUID(l)){let f=new In.Literal(l),d=this.expandClassValue(a.basename);if(d)return this.emitTypeTripleForEnumInstance(d,a),[d];let h=this.vault.getFrontmatter(a);if(h){let y=h.exo__Asset_label;if(typeof y=="string"){let v=this.expandClassValue(y);if(v)return[v]}}return r?.value.endsWith("#Asset_prototype")||r?.value.endsWith("/Asset_prototype")?[c,f]:[c]}let u=this.expandClassValue(a.basename);return u?(this.emitTypeTripleForEnumInstance(u,a),[u]):[c]}if(this.isClassReference(s)){let c=this.expandClassValue(s);if(c)return[c]}return[new In.Literal(i)]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return this.isISO8601DateTime(i)?[new In.Literal(i,Wt.Namespace.XSD.term("dateTime"))]:[new In.Literal(i)]}return typeof e=="boolean"?[new In.Literal(e.toString())]:typeof e=="number"?[new In.Literal(e.toString(),Wt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new In.Literal(e.toISOString(),Wt.Namespace.XSD.term("dateTime"))]:[new In.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 In.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 In.Literal(t)}isClassReference(e){return Sl.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 Sl.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 Kr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new Kr.Triple(t,c,f)):r.push(new Kr.Triple(t,c,new In.Literal(l)))}else r.push(new Kr.Triple(t,c,new In.Literal(l)))}}catch{}return r}};$i.NoteToRDFConverter=Qo;Qo.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Qo.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Qo.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};Qo.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]];$i.NoteToRDFConverter=Qo=Sl=w$([(0,Zv.injectable)(),Qx(0,(0,Zv.inject)(Kx.DI_TOKENS.IVaultAdapter)),Qx(1,(0,Zv.inject)(Kx.DI_TOKENS.ILogger)),E$("design:paramtypes",[Object,Object])],Qo)});var rb=S(vm=>{"use strict";Object.defineProperty(vm,"__esModule",{value:!0});vm.FilterContainsOptimizer=void 0;var x$=Ae(),C$=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,tb=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(C$);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 x$.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)}};vm.FilterContainsOptimizer=tb});var Jx=S(bm=>{"use strict";Object.defineProperty(bm,"__esModule",{value:!0});bm.AlgebraOptimizer=void 0;var I$=rb(),nb=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new I$.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)}};bm.AlgebraOptimizer=nb});var Zx=S(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});wm.AlgebraSerializer=void 0;var ib=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(
@@ -406,11 +406,11 @@ ${r})`;case"extend":return`${r}Extend (?${e.variable} = ${this.expressionToStrin
406
406
  ${this.toString(e.input,t+1)}
407
407
  ${r})`;case"subquery":return`${r}Subquery(
408
408
  ${this.toString(e.query,t+1)}
409
- ${r})`;default:return`${r}Unknown(${e.type})`}}tripleToString(e){return`${this.elementToString(e.subject)} ${this.predicateToString(e.predicate)} ${this.elementToString(e.object)}`}predicateToString(e){return this.isPropertyPath(e)?this.propertyPathToString(e):this.elementToString(e)}isPropertyPath(e){return e.type==="path"}propertyPathToString(e){let t=e.items.map(r=>r.type==="path"?`(${this.propertyPathToString(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]}?`}}elementToString(e){switch(e.type){case"variable":return`?${e.value}`;case"iri":return`<${e.value}>`;case"literal":let t=`"${e.value}"`;return e.language&&(t+=`@${e.language}`),e.datatype&&(t+=`^^<${e.datatype}>`),t;case"blank":return`_:${e.value}`;default:return String(e)}}expressionToString(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value}"`:String(e.value);case"comparison":return`(${this.expressionToString(e.left)} ${e.operator} ${this.expressionToString(e.right)})`;case"logical":return e.operator==="!"?`!(${this.expressionToString(e.operands[0])})`:`(${e.operands.map(t=>this.expressionToString(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.expressionToString(e.left)} ${e.operator} ${this.expressionToString(e.right)})`;case"function":return`${e.function}(${e.args.map(t=>this.expressionToString(t)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.toString(e.pattern,0)} }`;default:return"unknown"}}toJSON(e){return JSON.stringify(e,null,2)}};wm.AlgebraSerializer=ib});var tC=S(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});Em.DescribeExecutor=void 0;var eC=Ae(),sb=class{static{o(this,"DescribeExecutor")}constructor(e){this.tripleStore=e}async execute(e,t){let r=[],i=new Set,s=new Set,a=t?.depth;for(let c of e)await this.describeResourceWithDepth(c,a,1,t?.symmetric??!0,r,i,s);return r}async describeResourceWithDepth(e,t,r,i,s,a,c){let l=e.toString();if(c.has(l)||(c.add(l),t!==void 0&&r>t))return;let u=[],f=await this.tripleStore.match(e,void 0,void 0);if(u.push(...f),i){let h=await this.tripleStore.match(void 0,void 0,e);u.push(...h)}let d=[];for(let h of u){let p=`${h.subject.toString()}|${h.predicate.toString()}|${h.object.toString()}`;a.has(p)||(a.add(p),s.push(h),(t===void 0||r<t)&&(this.isIRI(h.subject)&&h.subject.toString()!==l&&d.push(h.subject),this.isIRI(h.object)&&h.object.toString()!==l&&d.push(h.object)))}for(let h of d)await this.describeResourceWithDepth(h,t,r+1,i,s,a,c)}isIRI(e){if(!e||typeof e!="object")return!1;let t=e;return e instanceof eC.IRI||t.termType==="NamedNode"||typeof t.value=="string"&&t.value.startsWith("http")}async describeByIRI(e,t){let r=new eC.IRI(e);return this.execute([r],t)}};Em.DescribeExecutor=sb});var nC=S(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.UpdateExecutor=bl.UpdateExecutorError=void 0;var R$=Qn(),vl=Ae(),ab=Ne(),rC=qt(),Kr=class extends Error{static{o(this,"UpdateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="UpdateExecutorError"}};bl.UpdateExecutorError=Kr;var ob=class{static{o(this,"UpdateExecutor")}constructor(e){this.tripleStore=e}async execute(e){if(e.type!=="update")throw new Kr("Expected UPDATE request");let t=[];for(let r of e.updates){let i=await this.executeOperation(r);t.push(i)}return t}async executeOperation(e){if("updateType"in e)switch(e.updateType){case"insert":return this.executeInsertData(e);case"delete":return this.executeDeleteData(e);case"insertdelete":throw new Kr("INSERT/DELETE with WHERE clause not yet implemented");case"deletewhere":throw new Kr("DELETE WHERE not yet implemented");default:throw new Kr(`Unknown update type: ${e.updateType}`)}if("type"in e)switch(e.type){case"clear":case"drop":case"load":case"create":case"copy":case"move":case"add":throw new Kr(`${e.type.toUpperCase()} operation not yet implemented`);default:throw new Kr(`Unknown operation type: ${e.type}`)}throw new Kr("Unknown update operation structure")}async executeInsertData(e){if(e.updateType!=="insert")throw new Kr("Expected INSERT DATA operation");let t=e,r=0;for(let i of t.insert)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.insertTriples(i.triples,s)}else if(i.type==="graph"){let s=i,a=this.parseGraphName(s.name);r+=await this.insertTriples(s.triples,a)}return{type:"insert",inserted:r,success:!0}}async executeDeleteData(e){if(e.updateType!=="delete")throw new Kr("Expected DELETE DATA operation");let t=e,r=0;for(let i of t.delete)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.deleteTriples(i.triples,s)}else if(i.type==="graph"){let s=i,a=this.parseGraphName(s.name);r+=await this.deleteTriples(s.triples,a)}return{type:"delete",deleted:r,success:!0}}async insertTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i);t&&this.tripleStore.addToGraph?await this.tripleStore.addToGraph(s,t):await this.tripleStore.add(s),r++}return r}async deleteTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i),a;t&&this.tripleStore.removeFromGraph?a=await this.tripleStore.removeFromGraph(s,t):a=await this.tripleStore.remove(s),a&&r++}return r}convertTriple(e){return new R$.Triple(this.convertSubject(e.subject),this.convertPredicate(e.predicate),this.convertObject(e.object))}convertSubject(e){if(e.termType==="NamedNode")return new vl.IRI(e.value);if(e.termType==="BlankNode")return new rC.BlankNode(e.value);throw new Kr(`Invalid subject term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}convertPredicate(e){if("termType"in e&&e.termType==="NamedNode")return new vl.IRI(e.value);throw new Kr("Invalid predicate term type. Only IRIs are allowed in INSERT DATA.")}convertObject(e){if(e.termType==="NamedNode")return new vl.IRI(e.value);if(e.termType==="BlankNode")return new rC.BlankNode(e.value);if(e.termType==="Literal"){let t=e;return t.language?new ab.Literal(t.value,void 0,t.language):t.datatype?new ab.Literal(t.value,new vl.IRI(t.datatype.value)):new ab.Literal(t.value)}throw new Kr(`Invalid object term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}resolveGraphName(e){if(e&&!e.default&&e.name)return new vl.IRI(e.name.value)}parseGraphName(e){if(e.termType==="Variable")throw new Kr("Variables are not allowed as graph names in INSERT DATA / DELETE DATA.");return new vl.IRI(e.value)}};bl.UpdateExecutor=ob});var sC=S(Tm=>{"use strict";Object.defineProperty(Tm,"__esModule",{value:!0});Tm.AggregateFunctions=void 0;var cb=Ne(),iC=Ae(),lb=class{static{o(this,"AggregateFunctions")}static count(e,t){if(!t)return e.length;let r=0;for(let i of e)i.has(t)&&r++;return r}static countDistinct(e,t){let r=new Set;for(let i of e){let s=i.get(t);s&&r.add(s.toString())}return r.size}static sum(e,t){let r=0;for(let i of e){let s=i.get(t);if(s instanceof cb.Literal){let a=this.toNumber(s);isNaN(a)||(r+=a)}}return r}static avg(e,t){let r=this.sum(e,t),i=this.count(e,t);return i>0?r/i:0}static min(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let a=this.toComparable(s);(r===null||a<r)&&(r=a)}return r}static max(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let a=this.toComparable(s);(r===null||a>r)&&(r=a)}return r}static groupConcat(e,t,r=" "){let i=[];for(let s of e){let a=s.get(t);a&&(a instanceof cb.Literal||a instanceof iC.IRI?i.push(a.value):i.push(a.toString()))}return i.join(r)}static sample(e,t){for(let r of e){let i=r.get(t);if(i)return this.toComparable(i)}return null}static sampleDistinct(e,t){return this.sample(e,t)}static toNumber(e){let t=e.datatype?.value;return t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double"),parseFloat(e.value)}static toComparable(e){if(e instanceof cb.Literal){let t=this.toNumber(e);return isNaN(t)?e.value:t}return e instanceof iC.IRI?e.value:String(e)}};Tm.AggregateFunctions=lb});var aC=S(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});Am.QueryPlanCache=void 0;var P$=Xp(),ub=class{static{o(this,"QueryPlanCache")}constructor(e=100){this.hits=0,this.misses=0,this.cache=new P$.LRUCache(e)}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r!==void 0?this.hits++:this.misses++,r}set(e,t){let r=this.normalizeQuery(e);this.cache.set(r,t)}has(e){let t=this.normalizeQuery(e);return this.cache.get(t)!==void 0}clear(){this.cache.clear()}getStats(){let e=this.hits+this.misses;return{hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0,size:this.cache.size()}}resetStats(){this.hits=0,this.misses=0}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}};Am.QueryPlanCache=ub});var oC=S(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.SPARQLResultCache=void 0;hf.createSPARQLResultCache=D$;var O$=Xp(),F$={maxSize:500,ttlMs:300*1e3,enableFileInvalidation:!0,maxResultSizeBytes:10*1024*1024},xm=class{static{o(this,"SPARQLResultCache")}constructor(e={}){this.fileToQueries=new Map,this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0},this.avgQueryTimeMs=100,this.options={...F$,...e},this.cache=new O$.LRUCache(this.options.maxSize)}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}hashResult(e){return this.isTripleArray(e)?`T:${e.length}`:`S:${e.length}`}isTripleArray(e){return e.length>0&&"subject"in e[0]}estimateResultSize(e){return this.isTripleArray(e)?e.length*300:e.length*200}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);if(r===void 0){this.stats.misses++;return}if(Date.now()-r.timestamp>this.options.ttlMs){this.cache.set(t,void 0),this.stats.ttlInvalidations++,this.stats.misses++;return}return this.stats.hits++,this.stats.totalTimeSavedMs+=this.avgQueryTimeMs,r.result}set(e,t,r,i){if(this.estimateResultSize(t)>this.options.maxResultSizeBytes)return;i!==void 0&&(this.avgQueryTimeMs=(this.avgQueryTimeMs+i)/2);let a=this.normalizeQuery(e),c=r??new Set,l={result:t,timestamp:Date.now(),affectedFiles:c,resultHash:this.hashResult(t)};if(this.cache.size()>=this.options.maxSize&&this.stats.evictions++,this.cache.set(a,l),this.options.enableFileInvalidation)for(let f of c){let d=this.fileToQueries.get(f);d||(d=new Set,this.fileToQueries.set(f,d)),d.add(a)}}has(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r===void 0?!1:Date.now()-r.timestamp<=this.options.ttlMs}invalidateByFile(e){if(!this.options.enableFileInvalidation)return 0;let t=this.fileToQueries.get(e);if(!t)return 0;let r=0;for(let i of t)this.cache.set(i,void 0),r++,this.stats.fileInvalidations++;return this.fileToQueries.delete(e),r}clear(){this.cache.clear(),this.fileToQueries.clear()}getStats(){let e=this.stats.hits+this.stats.misses,t=e>0?this.stats.hits/e:0;return{hits:this.stats.hits,misses:this.stats.misses,hitRate:t,size:this.cache.size(),maxSize:this.options.maxSize,evictions:this.stats.evictions,ttlInvalidations:this.stats.ttlInvalidations,fileInvalidations:this.stats.fileInvalidations,avgTimeSavedMs:this.stats.hits>0?this.stats.totalTimeSavedMs/this.stats.hits:0}}resetStats(){this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0}}size(){return this.cache.size()}pruneExpired(){return 0}};hf.SPARQLResultCache=xm;function D$(n){return new xm(n)}o(D$,"createSPARQLResultCache")});var cC=S(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.IncrementalIndexer=void 0;pf.createIncrementalIndexer=k$;var N$=ka(),L$={throttleMs:500,maxBatchSize:100,useContentHashing:!1},Cm=class{static{o(this,"IncrementalIndexer")}constructor(e={}){this.fileMetadata=new Map,this.pendingChanges=[],this.throttleTimer=null,this.invalidateCallbacks=[],this.lastIndexTime=0,this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]},this.options={...L$,...e}}recordChange(e){this.pendingChanges.push(e),this.stats.totalChanges++,this.throttleTimer===null&&(this.throttleTimer=setTimeout(()=>{this.processPendingChanges(),this.throttleTimer=null},this.options.throttleMs))}processPendingChanges(){if(this.pendingChanges.length===0)return;let e=performance.now(),t=new Map;for(let a of this.pendingChanges)t.set(a.path,a);let r=Array.from(t.values()),i=[];for(let a of r)switch(a.type){case"deleted":this.fileMetadata.delete(a.path),i.push(a);break;case"renamed":a.oldPath&&this.fileMetadata.delete(a.oldPath),i.push(a);break;case"created":case"modified":i.push(a);break}if(i.length>0){this.stats.invalidations+=i.length;for(let a of this.invalidateCallbacks)try{a(i)}catch(c){N$.LoggingService.error("IncrementalIndexer: Error in invalidation callback",c instanceof Error?c:new Error(String(c)))}}let s=performance.now()-e;this.stats.indexDurations.push(s),this.stats.indexDurations.length>100&&this.stats.indexDurations.shift(),this.lastIndexTime=Date.now(),this.pendingChanges=[]}flush(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.processPendingChanges()}updateMetadata(e,t,r,i){this.fileMetadata.set(e,{mtime:t,size:r,contentHash:i})}hasChanged(e,t,r){let i=this.fileMetadata.get(e);return i===void 0||i.mtime!==t||r!==void 0&&i.size!==r}getChangedFiles(e){let t=[];for(let[r,i]of this.fileMetadata.entries())i.mtime>e&&t.push(r);return t}onInvalidate(e){return this.invalidateCallbacks.push(e),()=>{let t=this.invalidateCallbacks.indexOf(e);t!==-1&&this.invalidateCallbacks.splice(t,1)}}getStats(){let e=this.stats.indexDurations,t=e.length>0?e.reduce((i,s)=>i+s,0)/e.length:0,r=e.length>0?e[e.length-1]:0;return{trackedFiles:this.fileMetadata.size,totalChanges:this.stats.totalChanges,invalidations:this.stats.invalidations,noOpChanges:this.stats.noOpChanges,lastIndexDurationMs:r,avgIndexDurationMs:t,lastIndexTime:this.lastIndexTime}}resetStats(){this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]}}clear(){this.fileMetadata.clear(),this.pendingChanges=[],this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null)}size(){return this.fileMetadata.size}isTracked(e){return this.fileMetadata.has(e)}getMetadata(e){return this.fileMetadata.get(e)}dispose(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.invalidateCallbacks=[],this.pendingChanges=[],this.fileMetadata.clear()}};pf.IncrementalIndexer=Cm;function k$(n){return new Cm(n)}o(k$,"createIncrementalIndexer")});var lC=S(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});Om.ResultSerializer=void 0;var Im=Ne(),Rm=Ae(),Pm=qt(),fb=class{static{o(this,"ResultSerializer")}serialize(e,t,r={}){switch(t){case"json":return this.serializeJSON(e,r);case"xml":return this.serializeXML(e,r);case"csv":return this.serializeCSV(e,r);case"turtle":return this.serializeTurtle(e,r);default:throw new Error(`Unsupported result format: ${t}`)}}serializeJSON(e,t={}){let r=this.toJSONResultSet(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}toJSONResultSet(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=e.map(a=>{let c={};for(let l of i){let u=a.get(l);u!==void 0&&(c[l]=this.termToJSONBinding(u))}return c});return{head:{vars:i},results:{bindings:s}}}termToJSONBinding(e){return e instanceof Rm.IRI?{type:"uri",value:e.value}:e instanceof Pm.BlankNode?{type:"bnode",value:e.id}:e instanceof Im.Literal?this.literalToJSONBinding(e):{type:"literal",value:String(e)}}literalToJSONBinding(e){let t={type:"literal",value:e.value};return e.datatype?t.datatype=e.datatype.value:e.language&&(t["xml:lang"]=e.language,e.hasDirection()&&e.direction&&(t.direction=e.direction)),t}serializeXML(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=['<?xml version="1.0"?>','<sparql xmlns="http://www.w3.org/2005/sparql-results#">'," <head>"];for(let a of i)s.push(` <variable name="${this.escapeXML(a)}"/>`);s.push(" </head>"),s.push(" <results>");for(let a of e){s.push(" <result>");for(let c of i){let l=a.get(c);l!==void 0&&(s.push(` <binding name="${this.escapeXML(c)}">`),s.push(" "+this.termToXML(l)),s.push(" </binding>"))}s.push(" </result>")}return s.push(" </results>"),s.push("</sparql>"),s.join(`
409
+ ${r})`;default:return`${r}Unknown(${e.type})`}}tripleToString(e){return`${this.elementToString(e.subject)} ${this.predicateToString(e.predicate)} ${this.elementToString(e.object)}`}predicateToString(e){return this.isPropertyPath(e)?this.propertyPathToString(e):this.elementToString(e)}isPropertyPath(e){return e.type==="path"}propertyPathToString(e){let t=e.items.map(r=>r.type==="path"?`(${this.propertyPathToString(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]}?`}}elementToString(e){switch(e.type){case"variable":return`?${e.value}`;case"iri":return`<${e.value}>`;case"literal":let t=`"${e.value}"`;return e.language&&(t+=`@${e.language}`),e.datatype&&(t+=`^^<${e.datatype}>`),t;case"blank":return`_:${e.value}`;default:return String(e)}}expressionToString(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value}"`:String(e.value);case"comparison":return`(${this.expressionToString(e.left)} ${e.operator} ${this.expressionToString(e.right)})`;case"logical":return e.operator==="!"?`!(${this.expressionToString(e.operands[0])})`:`(${e.operands.map(t=>this.expressionToString(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.expressionToString(e.left)} ${e.operator} ${this.expressionToString(e.right)})`;case"function":return`${e.function}(${e.args.map(t=>this.expressionToString(t)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.toString(e.pattern,0)} }`;default:return"unknown"}}toJSON(e){return JSON.stringify(e,null,2)}};wm.AlgebraSerializer=ib});var tC=S(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});Em.DescribeExecutor=void 0;var eC=Ae(),sb=class{static{o(this,"DescribeExecutor")}constructor(e){this.tripleStore=e}async execute(e,t){let r=[],i=new Set,s=new Set,a=t?.depth;for(let c of e)await this.describeResourceWithDepth(c,a,1,t?.symmetric??!0,r,i,s);return r}async describeResourceWithDepth(e,t,r,i,s,a,c){let l=e.toString();if(c.has(l)||(c.add(l),t!==void 0&&r>t))return;let u=[],f=await this.tripleStore.match(e,void 0,void 0);if(u.push(...f),i){let h=await this.tripleStore.match(void 0,void 0,e);u.push(...h)}let d=[];for(let h of u){let p=`${h.subject.toString()}|${h.predicate.toString()}|${h.object.toString()}`;a.has(p)||(a.add(p),s.push(h),(t===void 0||r<t)&&(this.isIRI(h.subject)&&h.subject.toString()!==l&&d.push(h.subject),this.isIRI(h.object)&&h.object.toString()!==l&&d.push(h.object)))}for(let h of d)await this.describeResourceWithDepth(h,t,r+1,i,s,a,c)}isIRI(e){if(!e||typeof e!="object")return!1;let t=e;return e instanceof eC.IRI||t.termType==="NamedNode"||typeof t.value=="string"&&t.value.startsWith("http")}async describeByIRI(e,t){let r=new eC.IRI(e);return this.execute([r],t)}};Em.DescribeExecutor=sb});var nC=S(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.UpdateExecutor=bl.UpdateExecutorError=void 0;var R$=Qn(),vl=Ae(),ab=Ne(),rC=qt(),Xr=class extends Error{static{o(this,"UpdateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="UpdateExecutorError"}};bl.UpdateExecutorError=Xr;var ob=class{static{o(this,"UpdateExecutor")}constructor(e){this.tripleStore=e}async execute(e){if(e.type!=="update")throw new Xr("Expected UPDATE request");let t=[];for(let r of e.updates){let i=await this.executeOperation(r);t.push(i)}return t}async executeOperation(e){if("updateType"in e)switch(e.updateType){case"insert":return this.executeInsertData(e);case"delete":return this.executeDeleteData(e);case"insertdelete":throw new Xr("INSERT/DELETE with WHERE clause not yet implemented");case"deletewhere":throw new Xr("DELETE WHERE not yet implemented");default:throw new Xr(`Unknown update type: ${e.updateType}`)}if("type"in e)switch(e.type){case"clear":case"drop":case"load":case"create":case"copy":case"move":case"add":throw new Xr(`${e.type.toUpperCase()} operation not yet implemented`);default:throw new Xr(`Unknown operation type: ${e.type}`)}throw new Xr("Unknown update operation structure")}async executeInsertData(e){if(e.updateType!=="insert")throw new Xr("Expected INSERT DATA operation");let t=e,r=0;for(let i of t.insert)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.insertTriples(i.triples,s)}else if(i.type==="graph"){let s=i,a=this.parseGraphName(s.name);r+=await this.insertTriples(s.triples,a)}return{type:"insert",inserted:r,success:!0}}async executeDeleteData(e){if(e.updateType!=="delete")throw new Xr("Expected DELETE DATA operation");let t=e,r=0;for(let i of t.delete)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.deleteTriples(i.triples,s)}else if(i.type==="graph"){let s=i,a=this.parseGraphName(s.name);r+=await this.deleteTriples(s.triples,a)}return{type:"delete",deleted:r,success:!0}}async insertTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i);t&&this.tripleStore.addToGraph?await this.tripleStore.addToGraph(s,t):await this.tripleStore.add(s),r++}return r}async deleteTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i),a;t&&this.tripleStore.removeFromGraph?a=await this.tripleStore.removeFromGraph(s,t):a=await this.tripleStore.remove(s),a&&r++}return r}convertTriple(e){return new R$.Triple(this.convertSubject(e.subject),this.convertPredicate(e.predicate),this.convertObject(e.object))}convertSubject(e){if(e.termType==="NamedNode")return new vl.IRI(e.value);if(e.termType==="BlankNode")return new rC.BlankNode(e.value);throw new Xr(`Invalid subject term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}convertPredicate(e){if("termType"in e&&e.termType==="NamedNode")return new vl.IRI(e.value);throw new Xr("Invalid predicate term type. Only IRIs are allowed in INSERT DATA.")}convertObject(e){if(e.termType==="NamedNode")return new vl.IRI(e.value);if(e.termType==="BlankNode")return new rC.BlankNode(e.value);if(e.termType==="Literal"){let t=e;return t.language?new ab.Literal(t.value,void 0,t.language):t.datatype?new ab.Literal(t.value,new vl.IRI(t.datatype.value)):new ab.Literal(t.value)}throw new Xr(`Invalid object term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}resolveGraphName(e){if(e&&!e.default&&e.name)return new vl.IRI(e.name.value)}parseGraphName(e){if(e.termType==="Variable")throw new Xr("Variables are not allowed as graph names in INSERT DATA / DELETE DATA.");return new vl.IRI(e.value)}};bl.UpdateExecutor=ob});var sC=S(Tm=>{"use strict";Object.defineProperty(Tm,"__esModule",{value:!0});Tm.AggregateFunctions=void 0;var cb=Ne(),iC=Ae(),lb=class{static{o(this,"AggregateFunctions")}static count(e,t){if(!t)return e.length;let r=0;for(let i of e)i.has(t)&&r++;return r}static countDistinct(e,t){let r=new Set;for(let i of e){let s=i.get(t);s&&r.add(s.toString())}return r.size}static sum(e,t){let r=0;for(let i of e){let s=i.get(t);if(s instanceof cb.Literal){let a=this.toNumber(s);isNaN(a)||(r+=a)}}return r}static avg(e,t){let r=this.sum(e,t),i=this.count(e,t);return i>0?r/i:0}static min(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let a=this.toComparable(s);(r===null||a<r)&&(r=a)}return r}static max(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let a=this.toComparable(s);(r===null||a>r)&&(r=a)}return r}static groupConcat(e,t,r=" "){let i=[];for(let s of e){let a=s.get(t);a&&(a instanceof cb.Literal||a instanceof iC.IRI?i.push(a.value):i.push(a.toString()))}return i.join(r)}static sample(e,t){for(let r of e){let i=r.get(t);if(i)return this.toComparable(i)}return null}static sampleDistinct(e,t){return this.sample(e,t)}static toNumber(e){let t=e.datatype?.value;return t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double"),parseFloat(e.value)}static toComparable(e){if(e instanceof cb.Literal){let t=this.toNumber(e);return isNaN(t)?e.value:t}return e instanceof iC.IRI?e.value:String(e)}};Tm.AggregateFunctions=lb});var aC=S(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});Am.QueryPlanCache=void 0;var P$=Xp(),ub=class{static{o(this,"QueryPlanCache")}constructor(e=100){this.hits=0,this.misses=0,this.cache=new P$.LRUCache(e)}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r!==void 0?this.hits++:this.misses++,r}set(e,t){let r=this.normalizeQuery(e);this.cache.set(r,t)}has(e){let t=this.normalizeQuery(e);return this.cache.get(t)!==void 0}clear(){this.cache.clear()}getStats(){let e=this.hits+this.misses;return{hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0,size:this.cache.size()}}resetStats(){this.hits=0,this.misses=0}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}};Am.QueryPlanCache=ub});var oC=S(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.SPARQLResultCache=void 0;hf.createSPARQLResultCache=D$;var O$=Xp(),F$={maxSize:500,ttlMs:300*1e3,enableFileInvalidation:!0,maxResultSizeBytes:10*1024*1024},xm=class{static{o(this,"SPARQLResultCache")}constructor(e={}){this.fileToQueries=new Map,this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0},this.avgQueryTimeMs=100,this.options={...F$,...e},this.cache=new O$.LRUCache(this.options.maxSize)}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}hashResult(e){return this.isTripleArray(e)?`T:${e.length}`:`S:${e.length}`}isTripleArray(e){return e.length>0&&"subject"in e[0]}estimateResultSize(e){return this.isTripleArray(e)?e.length*300:e.length*200}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);if(r===void 0){this.stats.misses++;return}if(Date.now()-r.timestamp>this.options.ttlMs){this.cache.set(t,void 0),this.stats.ttlInvalidations++,this.stats.misses++;return}return this.stats.hits++,this.stats.totalTimeSavedMs+=this.avgQueryTimeMs,r.result}set(e,t,r,i){if(this.estimateResultSize(t)>this.options.maxResultSizeBytes)return;i!==void 0&&(this.avgQueryTimeMs=(this.avgQueryTimeMs+i)/2);let a=this.normalizeQuery(e),c=r??new Set,l={result:t,timestamp:Date.now(),affectedFiles:c,resultHash:this.hashResult(t)};if(this.cache.size()>=this.options.maxSize&&this.stats.evictions++,this.cache.set(a,l),this.options.enableFileInvalidation)for(let f of c){let d=this.fileToQueries.get(f);d||(d=new Set,this.fileToQueries.set(f,d)),d.add(a)}}has(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r===void 0?!1:Date.now()-r.timestamp<=this.options.ttlMs}invalidateByFile(e){if(!this.options.enableFileInvalidation)return 0;let t=this.fileToQueries.get(e);if(!t)return 0;let r=0;for(let i of t)this.cache.set(i,void 0),r++,this.stats.fileInvalidations++;return this.fileToQueries.delete(e),r}clear(){this.cache.clear(),this.fileToQueries.clear()}getStats(){let e=this.stats.hits+this.stats.misses,t=e>0?this.stats.hits/e:0;return{hits:this.stats.hits,misses:this.stats.misses,hitRate:t,size:this.cache.size(),maxSize:this.options.maxSize,evictions:this.stats.evictions,ttlInvalidations:this.stats.ttlInvalidations,fileInvalidations:this.stats.fileInvalidations,avgTimeSavedMs:this.stats.hits>0?this.stats.totalTimeSavedMs/this.stats.hits:0}}resetStats(){this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0}}size(){return this.cache.size()}pruneExpired(){return 0}};hf.SPARQLResultCache=xm;function D$(n){return new xm(n)}o(D$,"createSPARQLResultCache")});var cC=S(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.IncrementalIndexer=void 0;pf.createIncrementalIndexer=k$;var N$=ka(),L$={throttleMs:500,maxBatchSize:100,useContentHashing:!1},Cm=class{static{o(this,"IncrementalIndexer")}constructor(e={}){this.fileMetadata=new Map,this.pendingChanges=[],this.throttleTimer=null,this.invalidateCallbacks=[],this.lastIndexTime=0,this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]},this.options={...L$,...e}}recordChange(e){this.pendingChanges.push(e),this.stats.totalChanges++,this.throttleTimer===null&&(this.throttleTimer=setTimeout(()=>{this.processPendingChanges(),this.throttleTimer=null},this.options.throttleMs))}processPendingChanges(){if(this.pendingChanges.length===0)return;let e=performance.now(),t=new Map;for(let a of this.pendingChanges)t.set(a.path,a);let r=Array.from(t.values()),i=[];for(let a of r)switch(a.type){case"deleted":this.fileMetadata.delete(a.path),i.push(a);break;case"renamed":a.oldPath&&this.fileMetadata.delete(a.oldPath),i.push(a);break;case"created":case"modified":i.push(a);break}if(i.length>0){this.stats.invalidations+=i.length;for(let a of this.invalidateCallbacks)try{a(i)}catch(c){N$.LoggingService.error("IncrementalIndexer: Error in invalidation callback",c instanceof Error?c:new Error(String(c)))}}let s=performance.now()-e;this.stats.indexDurations.push(s),this.stats.indexDurations.length>100&&this.stats.indexDurations.shift(),this.lastIndexTime=Date.now(),this.pendingChanges=[]}flush(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.processPendingChanges()}updateMetadata(e,t,r,i){this.fileMetadata.set(e,{mtime:t,size:r,contentHash:i})}hasChanged(e,t,r){let i=this.fileMetadata.get(e);return i===void 0||i.mtime!==t||r!==void 0&&i.size!==r}getChangedFiles(e){let t=[];for(let[r,i]of this.fileMetadata.entries())i.mtime>e&&t.push(r);return t}onInvalidate(e){return this.invalidateCallbacks.push(e),()=>{let t=this.invalidateCallbacks.indexOf(e);t!==-1&&this.invalidateCallbacks.splice(t,1)}}getStats(){let e=this.stats.indexDurations,t=e.length>0?e.reduce((i,s)=>i+s,0)/e.length:0,r=e.length>0?e[e.length-1]:0;return{trackedFiles:this.fileMetadata.size,totalChanges:this.stats.totalChanges,invalidations:this.stats.invalidations,noOpChanges:this.stats.noOpChanges,lastIndexDurationMs:r,avgIndexDurationMs:t,lastIndexTime:this.lastIndexTime}}resetStats(){this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]}}clear(){this.fileMetadata.clear(),this.pendingChanges=[],this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null)}size(){return this.fileMetadata.size}isTracked(e){return this.fileMetadata.has(e)}getMetadata(e){return this.fileMetadata.get(e)}dispose(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.invalidateCallbacks=[],this.pendingChanges=[],this.fileMetadata.clear()}};pf.IncrementalIndexer=Cm;function k$(n){return new Cm(n)}o(k$,"createIncrementalIndexer")});var lC=S(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});Om.ResultSerializer=void 0;var Im=Ne(),Rm=Ae(),Pm=qt(),fb=class{static{o(this,"ResultSerializer")}serialize(e,t,r={}){switch(t){case"json":return this.serializeJSON(e,r);case"xml":return this.serializeXML(e,r);case"csv":return this.serializeCSV(e,r);case"turtle":return this.serializeTurtle(e,r);default:throw new Error(`Unsupported result format: ${t}`)}}serializeJSON(e,t={}){let r=this.toJSONResultSet(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}toJSONResultSet(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=e.map(a=>{let c={};for(let l of i){let u=a.get(l);u!==void 0&&(c[l]=this.termToJSONBinding(u))}return c});return{head:{vars:i},results:{bindings:s}}}termToJSONBinding(e){return e instanceof Rm.IRI?{type:"uri",value:e.value}:e instanceof Pm.BlankNode?{type:"bnode",value:e.id}:e instanceof Im.Literal?this.literalToJSONBinding(e):{type:"literal",value:String(e)}}literalToJSONBinding(e){let t={type:"literal",value:e.value};return e.datatype?t.datatype=e.datatype.value:e.language&&(t["xml:lang"]=e.language,e.hasDirection()&&e.direction&&(t.direction=e.direction)),t}serializeXML(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=['<?xml version="1.0"?>','<sparql xmlns="http://www.w3.org/2005/sparql-results#">'," <head>"];for(let a of i)s.push(` <variable name="${this.escapeXML(a)}"/>`);s.push(" </head>"),s.push(" <results>");for(let a of e){s.push(" <result>");for(let c of i){let l=a.get(c);l!==void 0&&(s.push(` <binding name="${this.escapeXML(c)}">`),s.push(" "+this.termToXML(l)),s.push(" </binding>"))}s.push(" </result>")}return s.push(" </results>"),s.push("</sparql>"),s.join(`
410
410
  `)}termToXML(e){return e instanceof Rm.IRI?`<uri>${this.escapeXML(e.value)}</uri>`:e instanceof Pm.BlankNode?`<bnode>${this.escapeXML(e.id)}</bnode>`:e instanceof Im.Literal?this.literalToXML(e):`<literal>${this.escapeXML(String(e))}</literal>`}literalToXML(e){let t=this.escapeXML(e.value);if(e.datatype)return`<literal datatype="${this.escapeXML(e.datatype.value)}">${t}</literal>`;if(e.language){let r=`xml:lang="${this.escapeXML(e.language)}"`;return e.hasDirection()&&e.direction&&(r+=` direction="${e.direction}"`),`<literal ${r}>${t}</literal>`}return`<literal>${t}</literal>`}serializeCSV(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=[];s.push(i.map(a=>this.escapeCSV(a)).join(","));for(let a of e){let c=i.map(l=>{let u=a.get(l);return u===void 0?"":this.escapeCSV(this.termToCSV(u))});s.push(c.join(","))}return s.join(`
411
411
  `)}termToCSV(e){return e instanceof Rm.IRI?e.value:e instanceof Pm.BlankNode?`_:${e.id}`:e instanceof Im.Literal?this.literalToCSV(e):String(e)}literalToCSV(e){if(e.datatype)return`${e.value}^^<${e.datatype.value}>`;if(e.language){let t=e.language;return e.hasDirection()&&e.direction&&(t+=`--${e.direction}`),`${e.value}@${t}`}return e.value}serializeTurtle(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=[];s.push(`# SPARQL Results - ${e.length} solution(s)`),s.push(`# Variables: ${i.join(", ")}`),s.push("");for(let a=0;a<e.length;a++){let c=e[a];s.push(`# Solution ${a+1}`);for(let l of i){let u=c.get(l);u!==void 0&&s.push(`?${l} = ${this.termToTurtle(u)}`)}s.push("")}return s.join(`
412
412
  `).trimEnd()}termToTurtle(e){return e instanceof Rm.IRI?`<${e.value}>`:e instanceof Pm.BlankNode?`_:${e.id}`:e instanceof Im.Literal?e.toString():`"${String(e)}"`}escapeXML(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}escapeCSV(e){return e.includes(",")||e.includes('"')||e.includes(`
413
- `)?`"${e.replace(/"/g,'""')}"`:e}};Om.ResultSerializer=fb});var uC=S(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.FileAlreadyExistsError=wl.FileNotFoundError=void 0;var db=class extends Error{static{o(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};wl.FileNotFoundError=db;var hb=class extends Error{static{o(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};wl.FileAlreadyExistsError=hb});var mb=S(vr=>{"use strict";var M$=vr&&vr.__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},j$=vr&&vr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(vr,"__esModule",{value:!0});vr.VaultSettings=vr.DEFAULT_FLEETING_NOTE_CLASS_UID=vr.DEFAULT_INBOX_FOLDER=vr.DEFAULT_OWNER_IDENTITY=void 0;var $$=ue();vr.DEFAULT_OWNER_IDENTITY='"[[!kitelev]]"';vr.DEFAULT_INBOX_FOLDER="01 Inbox";vr.DEFAULT_FLEETING_NOTE_CLASS_UID="fca0a931-a01f-48e4-b72a-4af206c94bc7";var pb=class{static{o(this,"VaultSettings")}constructor(e){this.ownerIdentity=e?.ownerIdentity??vr.DEFAULT_OWNER_IDENTITY,this.defaultInboxFolder=e?.defaultInboxFolder??vr.DEFAULT_INBOX_FOLDER,this.fleetingNoteClassUID=e?.fleetingNoteClassUID??vr.DEFAULT_FLEETING_NOTE_CLASS_UID}getOwnerIdentity(){return this.ownerIdentity}getDefaultInboxFolder(){return this.defaultInboxFolder}getFleetingNoteClassUID(){return this.fleetingNoteClassUID}};vr.VaultSettings=pb;vr.VaultSettings=pb=M$([(0,$$.injectable)(),j$("design:paramtypes",[Object])],pb)});var fC=S(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.container=void 0;Ba.registerCoreServices=uV;Ba.createChildContainer=fV;Ba.getContainer=dV;Ba.resetContainer=hV;Hd();var mf=ue();Object.defineProperty(Ba,"container",{enumerable:!0,get:o(function(){return mf.container},"get")});var Rt=wt(),V$=XS(),B$=ZS(),U$=BS(),q$=bS(),W$=yS(),G$=tm(),z$=nm(),H$=kS(),Q$=jS(),Y$=qS(),K$=NS(),X$=tv(),J$=lv(),Z$=av(),eV=AS(),tV=CS(),rV=YS(),nV=zS(),iV=eb(),sV=ES(),aV=dv(),oV=pv(),cV=xv(),lV=mb();function uV(n){let e=n||mf.container;e.registerSingleton(Rt.DI_TOKENS.DynamicFrontmatterGenerator,V$.DynamicFrontmatterGenerator),e.registerSingleton(Rt.DI_TOKENS.AlgorithmExtractor,B$.AlgorithmExtractor),e.isRegistered(Rt.DI_TOKENS.IVaultSettings)||e.register(Rt.DI_TOKENS.IVaultSettings,{useValue:new lV.VaultSettings}),e.registerSingleton(Rt.DI_TOKENS.EffortStatusWorkflow,G$.EffortStatusWorkflow),e.registerSingleton(Rt.DI_TOKENS.StatusTimestampService,z$.StatusTimestampService),e.registerSingleton(Rt.DI_TOKENS.TaskStatusService,W$.TaskStatusService),e.registerSingleton(Rt.DI_TOKENS.AreaCreationService,q$.AreaCreationService),e.registerSingleton(Rt.DI_TOKENS.ClassCreationService,eV.ClassCreationService),e.registerSingleton(Rt.DI_TOKENS.ConceptCreationService,tV.ConceptCreationService),e.registerSingleton(Rt.DI_TOKENS.FleetingNoteCreationService,rV.FleetingNoteCreationService),e.registerSingleton(Rt.DI_TOKENS.SupervisionCreationService,nV.SupervisionCreationService),e.registerSingleton(Rt.DI_TOKENS.GenericAssetCreationService,oV.GenericAssetCreationService),e.registerSingleton(Rt.DI_TOKENS.PropertyCleanupService,U$.PropertyCleanupService),e.registerSingleton(Rt.DI_TOKENS.FolderRepairService,H$.FolderRepairService),e.registerSingleton(Rt.DI_TOKENS.LabelToAliasService,Q$.LabelToAliasService),e.registerSingleton(Rt.DI_TOKENS.RenameToUidService,Y$.RenameToUidService),e.registerSingleton(Rt.DI_TOKENS.PlanningService,X$.PlanningService),e.registerSingleton(Rt.DI_TOKENS.EffortVotingService,K$.EffortVotingService),e.registerSingleton(Rt.DI_TOKENS.SessionEventService,J$.SessionEventService),e.registerSingleton(Rt.DI_TOKENS.AssetConversionService,Z$.AssetConversionService),e.registerSingleton(Rt.DI_TOKENS.NoteToRDFConverter,iV.NoteToRDFConverter),e.registerSingleton(Rt.DI_TOKENS.AreaHierarchyBuilder,sV.AreaHierarchyBuilder),e.registerSingleton(Rt.DI_TOKENS.URIConstructionService,aV.URIConstructionService),e.registerSingleton(Rt.DI_TOKENS.CriticalityZoneService,cV.CriticalityZoneService)}o(uV,"registerCoreServices");function fV(){return mf.container.createChildContainer()}o(fV,"createChildContainer");function dV(){return mf.container}o(dV,"getContainer");function hV(){mf.container.reset()}o(hV,"resetContainer")});var gb=S(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.DEFAULT_COLORS=El.NODE_FLAGS=void 0;El.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};El.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var _b=S(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.StringTable=void 0;var yb=class n{static{o(this,"StringTable")}constructor(e){if(this.stringToIndex=new Map,this.strings=[],this.memoryBytes=0,e)for(let t of e)this.intern(t)}intern(e){let t=this.stringToIndex.get(e);if(t!==void 0)return t;let r=this.strings.length;return this.strings.push(e),this.stringToIndex.set(e,r),this.memoryBytes+=e.length*2+50,r}getIndex(e){return this.stringToIndex.get(e)??-1}getString(e){if(e<0||e>=this.strings.length)throw new RangeError(`StringTable index out of bounds: ${e}`);return this.strings[e]}has(e){return this.stringToIndex.has(e)}hasIndex(e){return e>=0&&e<this.strings.length}get size(){return this.strings.length}getMemoryBytes(){return this.memoryBytes}*entries(){for(let e=0;e<this.strings.length;e++)yield[e,this.strings[e]]}*values(){for(let e of this.strings)yield e}toArray(){return[...this.strings]}clear(){this.stringToIndex.clear(),this.strings=[],this.memoryBytes=0}static fromJSON(e){return new n(e)}toJSON(){return this.strings}internAll(e){return e.map(t=>this.intern(t))}getStrings(e){return e.map(t=>this.getString(t))}search(e){let t=typeof e=="string"?new RegExp(e):e,r=[];for(let i=0;i<this.strings.length;i++)t.test(this.strings[i])&&r.push([i,this.strings[i]]);return r}getStats(){let e=this.strings.reduce((t,r)=>t+r.length,0);return{count:this.strings.length,memoryBytes:this.memoryBytes,avgStringLength:this.strings.length>0?e/this.strings.length:0}}};Fm.StringTable=yb});var dC=S(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});Nm.CompactGraphStore=void 0;var Dm=_b(),Pn=gb(),pV={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function Sb(n,e){if(n===void 0)return e;if(typeof n=="number")return n;if(n.startsWith("#")){let t=n.slice(1);if(t.length===6)return parseInt(t,16)<<8|255;if(t.length===8)return parseInt(t,16)}return e}o(Sb,"parseColor");var vb=class{static{o(this,"CompactGraphStore")}constructor(e){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex=new Map,this.indexToNodeId=[],this.edgeIdToIndex=new Map,this.config={...pV,...e},this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity),this.uriTable=new Dm.StringTable,this.labelTable=new Dm.StringTable,this.typeTable=new Dm.StringTable,this.predicateTable=new Dm.StringTable}allocateNodeArrays(e){return{positions:new Float32Array(e*2),radii:new Float32Array(e),colors:new Uint32Array(e),types:new Uint16Array(e),flags:new Uint8Array(e)}}allocateEdgeArrays(e){return{sourceIndices:new Uint32Array(e),targetIndices:new Uint32Array(e),predicateIndices:new Uint16Array(e),widths:new Float32Array(e),colors:new Uint32Array(e)}}resizeNodeArrays(e){if(e<=this.nodeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateNodeArrays(e);t.positions.set(this.nodes.positions.subarray(0,this.nodeCount*2)),t.radii.set(this.nodes.radii.subarray(0,this.nodeCount)),t.colors.set(this.nodes.colors.subarray(0,this.nodeCount)),t.types.set(this.nodes.types.subarray(0,this.nodeCount)),t.flags.set(this.nodes.flags.subarray(0,this.nodeCount)),this.nodes=t,this.nodeCapacity=e}resizeEdgeArrays(e){if(e<=this.edgeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateEdgeArrays(e);t.sourceIndices.set(this.edges.sourceIndices.subarray(0,this.edgeCount)),t.targetIndices.set(this.edges.targetIndices.subarray(0,this.edgeCount)),t.predicateIndices.set(this.edges.predicateIndices.subarray(0,this.edgeCount)),t.widths.set(this.edges.widths.subarray(0,this.edgeCount)),t.colors.set(this.edges.colors.subarray(0,this.edgeCount)),this.edges=t,this.edgeCapacity=e}ensureNodeCapacity(e){let t=this.nodeCount+e;if(t>this.nodeCapacity){let r=Math.max(t,Math.floor(this.nodeCapacity*this.config.growthFactor));this.resizeNodeArrays(r)}}ensureEdgeCapacity(e){let t=this.edgeCount+e;if(t>this.edgeCapacity){let r=Math.max(t,Math.floor(this.edgeCapacity*this.config.growthFactor));this.resizeEdgeArrays(r)}}addNode(e){let t=this.nodeIdToIndex.get(e.id);if(t!==void 0)return this.updateNodeAt(t,e),t;this.ensureNodeCapacity(1);let r=this.nodeCount++,i=r*2;this.nodes.positions[i]=e.x??Math.random()*1e3-500,this.nodes.positions[i+1]=e.y??Math.random()*1e3-500,this.nodes.radii[r]=e.radius??8,this.nodes.colors[r]=Sb(e.color,Pn.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=Pn.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=Pn.NODE_FLAGS.PINNED),e.isArchived&&(s|=Pn.NODE_FLAGS.ARCHIVED),this.nodes.flags[r]=s,this.nodeIdToIndex.set(e.id,r),this.indexToNodeId[r]=e.id,this.uriTable.intern(e.id),e.label&&this.labelTable.intern(e.label),r}updateNodeAt(e,t){let r=e*2;t.x!==void 0&&(this.nodes.positions[r]=t.x),t.y!==void 0&&(this.nodes.positions[r+1]=t.y),t.radius!==void 0&&(this.nodes.radii[e]=t.radius),t.color!==void 0&&(this.nodes.colors[e]=Sb(t.color,Pn.DEFAULT_COLORS.NODE)),t.assetClass!==void 0&&(this.nodes.types[e]=this.typeTable.intern(t.assetClass));let i=this.nodes.flags[e];t.isPinned!==void 0&&(i=t.isPinned?i|Pn.NODE_FLAGS.PINNED:i&~Pn.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|Pn.NODE_FLAGS.ARCHIVED:i&~Pn.NODE_FLAGS.ARCHIVED),this.nodes.flags[e]=i}addEdge(e){let t=this.nodeIdToIndex.get(e.sourceId),r=this.nodeIdToIndex.get(e.targetId);if(t===void 0||r===void 0)return-1;let i=`${e.sourceId}->${e.targetId}:${e.predicate??"link"}`,s=this.edgeIdToIndex.get(i);if(s!==void 0)return s;this.ensureEdgeCapacity(1);let a=this.edgeCount++;return this.edges.sourceIndices[a]=t,this.edges.targetIndices[a]=r,this.edges.widths[a]=e.width??1,this.edges.colors[a]=Sb(e.color,Pn.DEFAULT_COLORS.EDGE),e.predicate?this.edges.predicateIndices[a]=this.predicateTable.intern(e.predicate):this.edges.predicateIndices[a]=0,this.edgeIdToIndex.set(i,a),a}addNodes(e){return this.ensureNodeCapacity(e.length),e.map(t=>this.addNode(t))}addEdges(e){return this.ensureEdgeCapacity(e.length),e.map(t=>this.addEdge(t))}loadChunk(e){let r=this.addNodes(e.nodes).filter(a=>a>=0).length,s=this.addEdges(e.edges).filter(a=>a>=0).length;return{nodesAdded:r,edgesAdded:s}}getNodePosition(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return null;let r=t*2;return{x:this.nodes.positions[r],y:this.nodes.positions[r+1]}}getNodePositionByIndex(e){let t=e*2;return{x:this.nodes.positions[t],y:this.nodes.positions[t+1]}}setNodePosition(e,t,r){let i=this.nodeIdToIndex.get(e);if(i===void 0)return!1;let s=i*2;return this.nodes.positions[s]=t,this.nodes.positions[s+1]=r,!0}setNodePositionByIndex(e,t,r){let i=e*2;this.nodes.positions[i]=t,this.nodes.positions[i+1]=r}updateNodePositions(e){let t=0;for(let[r,i]of e)this.setNodePosition(r,i.x,i.y)&&t++;return t}applyNodeUpdates(e){let t=performance.now(),r=0;for(let i of e){let s=i.index;if(!(s<0||s>=this.nodeCount)){if(i.x!==void 0||i.y!==void 0){let a=s*2;i.x!==void 0&&(this.nodes.positions[a]=i.x),i.y!==void 0&&(this.nodes.positions[a+1]=i.y)}i.radius!==void 0&&(this.nodes.radii[s]=i.radius),i.color!==void 0&&(this.nodes.colors[s]=i.color),i.setFlags!==void 0&&(this.nodes.flags[s]|=i.setFlags),i.clearFlags!==void 0&&(this.nodes.flags[s]&=~i.clearFlags),r++}}return{nodesUpdated:r,edgesUpdated:0,timeMs:performance.now()-t}}getNodeFlags(e){let t=this.nodeIdToIndex.get(e);return t===void 0?0:this.nodes.flags[t]}setNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]|=t,!0)}clearNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]&=~t,!0)}hasNodeFlag(e,t){return(this.getNodeFlags(e)&t)!==0}selectNode(e){return this.setNodeFlag(e,Pn.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,Pn.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~Pn.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&Pn.NODE_FLAGS.SELECTED&&e.push(this.indexToNodeId[t]);return e}getNodeId(e){return this.indexToNodeId[e]}getNodeIndex(e){return this.nodeIdToIndex.get(e)}hasNode(e){return this.nodeIdToIndex.has(e)}getNodeCount(){return this.nodeCount}getEdgeCount(){return this.edgeCount}getNodeEdges(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=[];for(let i=0;i<this.edgeCount;i++)this.edges.sourceIndices[i]===t?r.push({edgeIndex:i,isSource:!0}):this.edges.targetIndices[i]===t&&r.push({edgeIndex:i,isSource:!1});return r}getNeighbors(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=new Set;for(let i=0;i<this.edgeCount;i++)if(this.edges.sourceIndices[i]===t){let s=this.edges.targetIndices[i];r.add(this.indexToNodeId[s])}else if(this.edges.targetIndices[i]===t){let s=this.edges.sourceIndices[i];r.add(this.indexToNodeId[s])}return Array.from(r)}getRawArrays(){return{nodes:this.nodes,edges:this.edges,nodeCount:this.nodeCount,edgeCount:this.edgeCount}}getPositionsArray(){return this.nodes.positions.subarray(0,this.nodeCount*2)}getMemoryStats(){let e=this.nodeCapacity*2*4+this.nodeCapacity*4+this.nodeCapacity*4+this.nodeCapacity*2+this.nodeCapacity,t=this.edgeCapacity*4+this.edgeCapacity*4+this.edgeCapacity*2+this.edgeCapacity*4+this.edgeCapacity*4,r=this.uriTable.getMemoryBytes()+this.labelTable.getMemoryBytes()+this.typeTable.getMemoryBytes()+this.predicateTable.getMemoryBytes();return{nodeCount:this.nodeCount,edgeCount:this.edgeCount,nodeCapacity:this.nodeCapacity,edgeCapacity:this.edgeCapacity,nodeMemoryBytes:e,edgeMemoryBytes:t,stringTableBytes:r,totalBytes:e+t+r,internedStringCount:this.uriTable.size+this.labelTable.size+this.typeTable.size+this.predicateTable.size}}clear(){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex.clear(),this.indexToNodeId=[],this.edgeIdToIndex.clear(),this.uriTable.clear(),this.labelTable.clear(),this.typeTable.clear(),this.predicateTable.clear(),this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity)}getTypeTable(){return this.typeTable}getLabelTable(){return this.labelTable}getUriTable(){return this.uriTable}getPredicateTable(){return this.predicateTable}};Nm.CompactGraphStore=vb});var hC=S(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.MemoryPool=void 0;Al.getGlobalPool=gV;Al.resetGlobalPool=yV;var mV={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},Lm=class{static{o(this,"MemoryPool")}constructor(e){this.float32Pool=new Map,this.uint32Pool=new Map,this.uint16Pool=new Map,this.uint8Pool=new Map,this.stats={poolHits:0,poolMisses:0,pooledArrays:0,pooledMemory:0,returned:0,rejected:0},this.config={...mV,...e};for(let t of this.config.sizeBuckets)this.float32Pool.set(t,[]),this.uint32Pool.set(t,[]),this.uint16Pool.set(t,[]),this.uint8Pool.set(t,[])}getBucketSize(e){for(let t of this.config.sizeBuckets)if(t>=e)return t;return e}getFloat32(e){let t=this.getBucketSize(e),r=this.float32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Float32Array(t)}getUint32(e){let t=this.getBucketSize(e),r=this.uint32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint32Array(t)}getUint16(e){let t=this.getBucketSize(e),r=this.uint16Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*2;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint16Array(t)}getUint8(e){let t=this.getBucketSize(e),r=this.uint8Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint8Array(t)}releaseFloat32(e){this.releaseToPool(this.float32Pool,e,4)}releaseUint32(e){this.releaseToPool(this.uint32Pool,e,4)}releaseUint16(e){this.releaseToPool(this.uint16Pool,e,2)}releaseUint8(e){this.releaseToPool(this.uint8Pool,e,1)}releaseToPool(e,t,r){let i=t.length,s=e.get(i);if(s&&s.length<this.config.maxPooledArrays){if(this.config.autoCleanup&&this.stats.pooledMemory+i*r>this.config.maxPoolMemory){this.stats.rejected++;return}s.push(t),this.stats.returned++,this.stats.pooledArrays++,this.stats.pooledMemory+=i*r}else this.stats.rejected++}getStats(){return{...this.stats}}getHitRatio(){let e=this.stats.poolHits+this.stats.poolMisses;return e>0?this.stats.poolHits/e:0}clear(){for(let e of this.float32Pool.values())e.length=0;for(let e of this.uint32Pool.values())e.length=0;for(let e of this.uint16Pool.values())e.length=0;for(let e of this.uint8Pool.values())e.length=0;this.stats.pooledArrays=0,this.stats.pooledMemory=0}cleanup(e){if(this.stats.pooledMemory<=e)return;let t=[...this.config.sizeBuckets].sort((r,i)=>i-r);for(let r of t){if(this.stats.pooledMemory<=e)break;for(let[i,s]of[[this.float32Pool,4],[this.uint32Pool,4],[this.uint16Pool,2],[this.uint8Pool,1]]){let a=i.get(r);if(a)for(;a.length>0&&this.stats.pooledMemory>e;)a.pop(),this.stats.pooledArrays--,this.stats.pooledMemory-=r*s}}}resetStats(){this.stats.poolHits=0,this.stats.poolMisses=0,this.stats.returned=0,this.stats.rejected=0}};Al.MemoryPool=Lm;var Tl=null;function gV(){return Tl||(Tl=new Lm),Tl}o(gV,"getGlobalPool");function yV(){Tl&&Tl.clear(),Tl=null}o(yV,"resetGlobalPool")});var pC=S(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.StreamingLoader=void 0;gf.createStreamingSource=SV;var _V={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},bb=class{static{o(this,"StreamingLoader")}constructor(e,t){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.progressCallbacks=[],this.abortController=null,this.store=e,this.config={..._V,...t}}getState(){return this.state}getProgress(){let e=this.totalChunks!==void 0&&this.totalChunks>0?this.chunksProcessed/this.totalChunks:0;return{currentChunk:this.chunksProcessed,totalChunks:this.totalChunks,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,progress:e,isComplete:this.state==="completed"}}onProgress(e){return this.progressCallbacks.push(e),()=>{let t=this.progressCallbacks.indexOf(e);t>=0&&this.progressCallbacks.splice(t,1)}}notifyProgress(){let e=this.getProgress();for(let t of this.progressCallbacks)t(e)}loadChunk(e){if(this.state==="error")throw new Error("Loader is in error state");this.state="loading",e.totalChunks!==void 0&&(this.totalChunks=e.totalChunks);for(let t of e.nodes)this.store.addNode(t),this.nodesLoaded++;for(let t of e.edges)this.store.addEdge(t)>=0?this.edgesLoaded++:this.pendingEdges.push(t);this.chunksProcessed++,e.isLast&&this.finishLoading(),this.notifyProgress()}finishLoading(){if(this.config.autoResolveEdges&&this.pendingEdges.length>0){for(let e of this.pendingEdges)this.store.addEdge(e)>=0&&this.edgesLoaded++;this.pendingEdges=[]}this.state="completed",this.notifyProgress()}async loadFromIterator(e){this.reset(),this.state="loading",this.abortController=new AbortController;try{for await(let r of e){if(this.abortController.signal.aborted){this.state="paused";return}this.loadChunk(r),this.config.chunkDelay>0&&await this.delay(this.config.chunkDelay)}this.state!=="completed"&&this.finishLoading()}catch(t){throw this.state="error",t}finally{this.abortController=null}}async loadFromArrays(e,t){let r=this.createChunks(e,t);await this.loadFromIterator(this.arrayToAsyncIterator(r))}createChunks(e,t){let r=[],{chunkSize:i}=this.config,s=Math.ceil(e.length/i),a=Array(s).fill(null).map(()=>[]);for(let c of t){let l=e.findIndex(u=>u.id===c.sourceId);if(l>=0){let u=Math.floor(l/i);a[u].push(c)}}for(let c=0;c<s;c++){let l=c*i,u=Math.min(l+i,e.length);r.push({chunkIndex:c,totalChunks:s,nodes:e.slice(l,u),edges:a[c],isLast:c===s-1})}return r}async*arrayToAsyncIterator(e){for(let t of e)yield t}delay(e){return new Promise(t=>setTimeout(t,e))}cancel(){this.abortController&&this.abortController.abort(),this.state="paused"}reset(){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.totalChunks=void 0,this.abortController=null}getPendingEdgeCount(){return this.pendingEdges.length}getStats(){return{state:this.state,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,chunksProcessed:this.chunksProcessed,totalChunks:this.totalChunks,pendingEdges:this.pendingEdges.length,storeStats:this.store.getMemoryStats()}}};gf.StreamingLoader=bb;async function*SV(n,e,t=1e3){let r=0,i=0,s;for(;;){let a=await e(n,r,t);if(a.totalCount!==void 0&&s===void 0&&(s=Math.ceil(a.totalCount/t)),yield{chunkIndex:i,totalChunks:s,nodes:a.nodes,edges:a.edges,isLast:!a.hasMore},!a.hasMore)break;r+=t,i++}}o(SV,"createStreamingSource")});var yC=S(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.createStreamingSource=rr.StreamingLoader=rr.resetGlobalPool=rr.getGlobalPool=rr.MemoryPool=rr.CompactGraphStore=rr.StringTable=rr.DEFAULT_COLORS=rr.NODE_FLAGS=void 0;var mC=gb();Object.defineProperty(rr,"NODE_FLAGS",{enumerable:!0,get:o(function(){return mC.NODE_FLAGS},"get")});Object.defineProperty(rr,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return mC.DEFAULT_COLORS},"get")});var vV=_b();Object.defineProperty(rr,"StringTable",{enumerable:!0,get:o(function(){return vV.StringTable},"get")});var bV=dC();Object.defineProperty(rr,"CompactGraphStore",{enumerable:!0,get:o(function(){return bV.CompactGraphStore},"get")});var wb=hC();Object.defineProperty(rr,"MemoryPool",{enumerable:!0,get:o(function(){return wb.MemoryPool},"get")});Object.defineProperty(rr,"getGlobalPool",{enumerable:!0,get:o(function(){return wb.getGlobalPool},"get")});Object.defineProperty(rr,"resetGlobalPool",{enumerable:!0,get:o(function(){return wb.resetGlobalPool},"get")});var gC=pC();Object.defineProperty(rr,"StreamingLoader",{enumerable:!0,get:o(function(){return gC.StreamingLoader},"get")});Object.defineProperty(rr,"createStreamingSource",{enumerable:!0,get:o(function(){return gC.createStreamingSource},"get")})});var _C=S(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.ExoQLError=nr.ExoQL=nr.ExoQLBudgetExceededError=nr.ExoQLCycleError=nr.ExoQLEvalDisabledError=nr.ExoQLForbiddenKeywordError=nr.DEFAULT_EVAL_CONFIG=nr.validateExoQLAllowlist=nr.evaluateWithExoEval=void 0;var wV=jc(),EV=Vc(),TV=al(),Eb=Jv(),AV=Ne(),xV=J1();Object.defineProperty(nr,"evaluateWithExoEval",{enumerable:!0,get:o(function(){return xV.evaluateWithExoEval},"get")});var CV=Y1();Object.defineProperty(nr,"validateExoQLAllowlist",{enumerable:!0,get:o(function(){return CV.validateExoQLAllowlist},"get")});var IV=K1();Object.defineProperty(nr,"DEFAULT_EVAL_CONFIG",{enumerable:!0,get:o(function(){return IV.DEFAULT_EVAL_CONFIG},"get")});var km=Zu();Object.defineProperty(nr,"ExoQLForbiddenKeywordError",{enumerable:!0,get:o(function(){return km.ExoQLForbiddenKeywordError},"get")});Object.defineProperty(nr,"ExoQLEvalDisabledError",{enumerable:!0,get:o(function(){return km.ExoQLEvalDisabledError},"get")});Object.defineProperty(nr,"ExoQLCycleError",{enumerable:!0,get:o(function(){return km.ExoQLCycleError},"get")});Object.defineProperty(nr,"ExoQLBudgetExceededError",{enumerable:!0,get:o(function(){return km.ExoQLBudgetExceededError},"get")});var Tb=class n{static{o(this,"ExoQL")}static async query(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);return s.executeAll(i)}static async ask(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);if(!s.isAskQuery(i))throw new yf("ExoQL.ask() requires an ASK query");return s.executeAsk(i)}static async construct(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);if(!s.isConstructQuery(i))throw new yf("ExoQL.construct() requires a CONSTRUCT query");return s.executeConstruct(i)}static async queryOwn(e,t,r,i){let s=await n.query(e,t,i);if(s.length===0)return[];let a=r?.subjectVar??"s",c=r?.predicateVar??"p",l=r?.objectVar??"o";return(await new Eb.SourceAnnotator(t).annotate(s,a,c,l)).filter(d=>{let h=d.get(Eb.SOURCE_VARIABLE);return h instanceof AV.Literal&&h.value==="own"})}static async isOwn(e,t,r,i){return await new Eb.SourceAnnotator(i).determineSource(e,t,r)==="own"}static prepare(e,t,r){let i=new wV.ExoQLParser,s=new EV.ExoQLAlgebraTranslator,a=i.parse(e),c=s.translate(a),l=new TV.ExoQLQueryExecutor(t,r);return{algebra:c,executor:l}}};nr.ExoQL=Tb;var yf=class extends Error{static{o(this,"ExoQLError")}constructor(e){super(e),this.name="ExoQLError"}};nr.ExoQLError=yf});var _f=S(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.RELATION_COLUMN_SET_CLASS_UID=ti.RELATION_COLUMN_SET_CLASS_IRI=void 0;ti.normalizeRef=Ab;ti.createRelationColumnSetFromFrontmatter=PV;ti.isRelationColumnSet=OV;ti.isRelationColumnSetFrontmatter=DV;var SC=Us();function Ab(n){if(typeof n!="string")return null;let e=SC.WikiLinkHelpers.normalize(n);return e.length>0?e:null}o(Ab,"normalizeRef");function xb(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}o(xb,"toStringArray");function RV(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}o(RV,"basenameFromPath");function PV(n,e){let t=e.warn??(()=>{}),r=e.sourcePath;if(!n||typeof n!="object")return t(`RelationColumnSet: missing frontmatter at ${r}`),null;let i=n.exo__Asset_uid,s=typeof i=="string"?i.trim():"";if(s.length===0)return t(`RelationColumnSet: exo__Asset_uid missing at ${r}`),null;let a=xb(n.ui__RelationColumnSet_targetClass),c=[];for(let E of a){let b=Ab(E);b!==null&&c.push(b)}let l=c.length>0?c:null,u=Ab(n.ui__RelationColumnSet_referencingProperty);if(l===null&&u===null)return t(`RelationColumnSet ${s}: at least one of targetClass / referencingProperty required (${r})`),null;let f=xb(n.ui__RelationColumnSet_columns),d=[];for(let E of f){let b=SC.WikiLinkHelpers.normalize(E);b.length>0&&d.push(b)}if(d.length===0)return t(`RelationColumnSet ${s}: columns array must contain at least one entry (${r})`),null;let h=n.ui__RelationColumnSet_label,p=typeof h=="string"&&h.trim().length>0?h.trim():RV(r),y=n.ui__RelationColumnSet_priority,v=0;if(typeof y=="number"&&Number.isFinite(y))v=y;else if(typeof y=="string"){let E=Number.parseFloat(y);Number.isFinite(E)&&(v=E)}return{uid:s,label:p,targetClasses:l,referencingProperty:u,columns:d,priority:v,sourcePath:r}}o(PV,"createRelationColumnSetFromFrontmatter");function OV(n){if(!n||typeof n!="object")return!1;let e=n;return!(typeof e.uid!="string"||e.uid.length===0||typeof e.label!="string"||e.targetClasses!==null&&(!Array.isArray(e.targetClasses)||e.targetClasses.some(t=>typeof t!="string"))||e.referencingProperty!==null&&typeof e.referencingProperty!="string"||!Array.isArray(e.columns)||e.columns.length===0||e.columns.some(t=>typeof t!="string")||typeof e.priority!="number"||!Number.isFinite(e.priority)||typeof e.sourcePath!="string")}o(OV,"isRelationColumnSet");ti.RELATION_COLUMN_SET_CLASS_IRI="ui__RelationColumnSet";ti.RELATION_COLUMN_SET_CLASS_UID="97fc9862-c886-4d86-9a60-e0cf9d778575";function FV(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(s=>s.trim()).filter(s=>s.length>0)}o(FV,"extractClassIdentifiers");function DV(n){if(!n)return!1;let e=n.exo__Instance_class,t=xb(e);for(let r of t)for(let i of FV(r))if(i===ti.RELATION_COLUMN_SET_CLASS_IRI||i===ti.RELATION_COLUMN_SET_CLASS_UID)return!0;return!1}o(DV,"isRelationColumnSetFrontmatter")});var bC=S(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.LAYOUT_CLASS_UID=Vi.LAYOUT_CLASS_IRI=void 0;Vi.createLayoutFromFrontmatter=$V;Vi.isLayout=VV;Vi.isLayoutFrontmatter=UV;var NV=Us(),LV=_f();Vi.LAYOUT_CLASS_IRI="exo__Layout";Vi.LAYOUT_CLASS_UID="08d00289-a5c8-4df1-8885-40a00a014004";function vC(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}o(vC,"toStringArray");function kV(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}o(kV,"basenameFromPath");function MV(n,e){if(typeof n=="boolean")return n;if(typeof n=="string"){let t=n.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}o(MV,"parseBoolean");function jV(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let e=Number.parseFloat(n);if(Number.isFinite(e))return e}return 0}o(jV,"parsePriority");function $V(n,e){let t=e.warn??(()=>{}),r=e.sourcePath;if(!n||typeof n!="object")return t(`Layout: missing frontmatter at ${r}`),null;let i=n.exo__Asset_uid,s=typeof i=="string"?i.trim():"";if(s.length===0)return t(`Layout: exo__Asset_uid missing at ${r}`),null;let a=(0,LV.normalizeRef)(n.exo__Layout_targetClass);if(a===null)return t(`Layout ${s}: exo__Layout_targetClass required (${r})`),null;let c=vC(n.exo__Layout_blocks),l=[];for(let p of c){let y=NV.WikiLinkHelpers.normalize(p);y.length>0&&l.push(y)}if(l.length===0)return t(`Layout ${s}: exo__Layout_blocks must contain at least one block (${r})`),null;let u=n.exo__Asset_label,f=typeof u=="string"&&u.trim().length>0?u.trim():kV(r),d=jV(n.exo__Layout_priority),h=MV(n.exo__Layout_coexistsWithDefault,!1);return{uid:s,label:f,targetClass:a,blocks:l,priority:d,coexistsWithDefault:h,sourcePath:r}}o($V,"createLayoutFromFrontmatter");function VV(n){if(!n||typeof n!="object")return!1;let e=n;return!(typeof e.uid!="string"||e.uid.length===0||typeof e.label!="string"||typeof e.targetClass!="string"||e.targetClass.length===0||!Array.isArray(e.blocks)||e.blocks.length===0||e.blocks.some(t=>typeof t!="string")||typeof e.priority!="number"||!Number.isFinite(e.priority)||typeof e.coexistsWithDefault!="boolean"||typeof e.sourcePath!="string")}o(VV,"isLayout");function BV(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(i=>i.trim()).filter(i=>i.length>0)}o(BV,"extractClassIdentifiers");function UV(n){if(!n)return!1;let e=vC(n.exo__Instance_class);for(let t of e)for(let r of BV(t))if(r===Vi.LAYOUT_CLASS_IRI||r===Vi.LAYOUT_CLASS_UID)return!0;return!1}o(UV,"isLayoutFrontmatter")});var TC=S(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.BACKLINKS_TABLE_BLOCK_CLASS_UID=Wt.BACKLINKS_TABLE_BLOCK_CLASS_IRI=Wt.PROPERTIES_BLOCK_CLASS_UID=Wt.PROPERTIES_BLOCK_CLASS_IRI=void 0;Wt.createLayoutBlockFromFrontmatter=QV;Wt.isLayoutBlockFrontmatter=YV;Wt.isPropertiesBlock=KV;Wt.isBacklinksTableBlock=XV;var qV=Us(),Cb=_f();Wt.PROPERTIES_BLOCK_CLASS_IRI="exo__PropertiesBlock";Wt.PROPERTIES_BLOCK_CLASS_UID="fd039b3c-ed2b-41c2-a42e-bbfcdd074bfe";Wt.BACKLINKS_TABLE_BLOCK_CLASS_IRI="exo__BacklinksTableBlock";Wt.BACKLINKS_TABLE_BLOCK_CLASS_UID="2e868956-d81e-43fd-9817-1addde9cb311";function wC(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}o(wC,"toStringArray");function WV(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}o(WV,"basenameFromPath");function EC(n,e){if(typeof n=="boolean")return n;if(typeof n=="string"){let t=n.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}o(EC,"parseBoolean");function GV(n){if(typeof n=="number"&&Number.isFinite(n)&&Number.isInteger(n))return n;if(typeof n=="string"){let e=Number.parseInt(n,10);if(Number.isFinite(e))return e}return null}o(GV,"parseInteger");function zV(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(i=>i.trim()).filter(i=>i.length>0)}o(zV,"extractClassIdentifiers");function Mm(n,e,t){let r=wC(n.exo__Instance_class);for(let i of r)for(let s of zV(i))if(s===e||s===t)return!0;return!1}o(Mm,"classOf");function HV(n,e){let t=e.warn??(()=>{}),r=n.exo__Asset_uid,i=typeof r=="string"?r.trim():"";if(i.length===0)return t(`LayoutBlock: exo__Asset_uid missing at ${e.sourcePath}`),null;let s=n.exo__LayoutBlock_title,a=n.exo__Asset_label,c=typeof s=="string"&&s.trim().length>0?s.trim():typeof a=="string"&&a.trim().length>0?a.trim():WV(e.sourcePath),l=EC(n.exo__LayoutBlock_collapsed,!1);return{uid:i,title:c,collapsed:l,sourcePath:e.sourcePath}}o(HV,"extractBase");function QV(n,e){let t=e.warn??(()=>{});if(!n||typeof n!="object")return t(`LayoutBlock: missing frontmatter at ${e.sourcePath}`),null;let r=HV(n,e);if(r===null)return null;if(Mm(n,Wt.PROPERTIES_BLOCK_CLASS_IRI,Wt.PROPERTIES_BLOCK_CLASS_UID))return{...r,kind:"properties"};if(Mm(n,Wt.BACKLINKS_TABLE_BLOCK_CLASS_IRI,Wt.BACKLINKS_TABLE_BLOCK_CLASS_UID)){let i=(0,Cb.normalizeRef)(n.exo__BacklinksTableBlock_rowClass),s=(0,Cb.normalizeRef)(n.exo__BacklinksTableBlock_referencingProperty);if(i===null||s===null)return t(`BacklinksTableBlock ${r.uid}: rowClass and referencingProperty required (${e.sourcePath})`),null;let a=wC(n.exo__BacklinksTableBlock_columns),c=[];for(let p of a){let y=qV.WikiLinkHelpers.normalize(p);y.length>0&&c.push(y)}let l=(0,Cb.normalizeRef)(n.exo__BacklinksTableBlock_sortBy),u=n.exo__BacklinksTableBlock_sortOrder,f=typeof u=="string"&&u.trim().toLowerCase()==="desc"?"desc":"asc",d=GV(n.exo__BacklinksTableBlock_limit),h=EC(n.exo__BacklinksTableBlock_showArchived,!1);return{...r,kind:"backlinks-table",rowClass:i,referencingProperty:s,columns:c,sortBy:l,sortOrder:f,limit:d,showArchived:h}}return t(`LayoutBlock ${r.uid}: unknown block class at ${e.sourcePath} \u2014 expected exo__PropertiesBlock or exo__BacklinksTableBlock`),null}o(QV,"createLayoutBlockFromFrontmatter");function YV(n){return n?Mm(n,Wt.PROPERTIES_BLOCK_CLASS_IRI,Wt.PROPERTIES_BLOCK_CLASS_UID)||Mm(n,Wt.BACKLINKS_TABLE_BLOCK_CLASS_IRI,Wt.BACKLINKS_TABLE_BLOCK_CLASS_UID):!1}o(YV,"isLayoutBlockFrontmatter");function KV(n){return n.kind==="properties"}o(KV,"isPropertiesBlock");function XV(n){return n.kind==="backlinks-table"}o(XV,"isBacklinksTableBlock")});var jm=S(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.isPropertiesBlock=Me.isLayoutBlockFrontmatter=Me.isBacklinksTableBlock=Me.createLayoutBlockFromFrontmatter=Me.PROPERTIES_BLOCK_CLASS_UID=Me.PROPERTIES_BLOCK_CLASS_IRI=Me.BACKLINKS_TABLE_BLOCK_CLASS_UID=Me.BACKLINKS_TABLE_BLOCK_CLASS_IRI=Me.isLayoutFrontmatter=Me.isLayout=Me.createLayoutFromFrontmatter=Me.LAYOUT_CLASS_UID=Me.LAYOUT_CLASS_IRI=Me.normalizeRef=Me.isRelationColumnSetFrontmatter=Me.isRelationColumnSet=Me.createRelationColumnSetFromFrontmatter=Me.RELATION_COLUMN_SET_CLASS_UID=Me.RELATION_COLUMN_SET_CLASS_IRI=void 0;var xl=_f();Object.defineProperty(Me,"RELATION_COLUMN_SET_CLASS_IRI",{enumerable:!0,get:o(function(){return xl.RELATION_COLUMN_SET_CLASS_IRI},"get")});Object.defineProperty(Me,"RELATION_COLUMN_SET_CLASS_UID",{enumerable:!0,get:o(function(){return xl.RELATION_COLUMN_SET_CLASS_UID},"get")});Object.defineProperty(Me,"createRelationColumnSetFromFrontmatter",{enumerable:!0,get:o(function(){return xl.createRelationColumnSetFromFrontmatter},"get")});Object.defineProperty(Me,"isRelationColumnSet",{enumerable:!0,get:o(function(){return xl.isRelationColumnSet},"get")});Object.defineProperty(Me,"isRelationColumnSetFrontmatter",{enumerable:!0,get:o(function(){return xl.isRelationColumnSetFrontmatter},"get")});Object.defineProperty(Me,"normalizeRef",{enumerable:!0,get:o(function(){return xl.normalizeRef},"get")});var Sf=bC();Object.defineProperty(Me,"LAYOUT_CLASS_IRI",{enumerable:!0,get:o(function(){return Sf.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(Me,"LAYOUT_CLASS_UID",{enumerable:!0,get:o(function(){return Sf.LAYOUT_CLASS_UID},"get")});Object.defineProperty(Me,"createLayoutFromFrontmatter",{enumerable:!0,get:o(function(){return Sf.createLayoutFromFrontmatter},"get")});Object.defineProperty(Me,"isLayout",{enumerable:!0,get:o(function(){return Sf.isLayout},"get")});Object.defineProperty(Me,"isLayoutFrontmatter",{enumerable:!0,get:o(function(){return Sf.isLayoutFrontmatter},"get")});var Ua=TC();Object.defineProperty(Me,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Ua.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(Me,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Ua.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(Me,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Ua.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(Me,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Ua.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(Me,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:o(function(){return Ua.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(Me,"isBacklinksTableBlock",{enumerable:!0,get:o(function(){return Ua.isBacklinksTableBlock},"get")});Object.defineProperty(Me,"isLayoutBlockFrontmatter",{enumerable:!0,get:o(function(){return Ua.isLayoutBlockFrontmatter},"get")});Object.defineProperty(Me,"isPropertiesBlock",{enumerable:!0,get:o(function(){return Ua.isPropertiesBlock},"get")})});var xC=S($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.RelationColumnSetResolver=void 0;var AC=_f(),JV={warn:o(()=>{},"warn")},Ib=class{static{o(this,"RelationColumnSetResolver")}constructor(e,t={}){this.provider=e,this.logger=t.logger??JV}resolve(e,t){if(!e||e.length===0)return null;let r=t!=null?(0,AC.normalizeRef)(t):null,i=this.provider();if(i.length===0)return null;for(let s of e){let a=(0,AC.normalizeRef)(s);if(a===null)continue;if(r!==null){let l=this.filterTier1(i,a,r);if(l.length>0)return this.tiebreak(l,1)}let c=this.filterTier2(i,a);if(c.length>0)return this.tiebreak(c,2);if(r!==null){let l=this.filterTier3(i,r);if(l.length>0)return this.tiebreak(l,3)}}return null}filterTier1(e,t,r){let i=[];for(let s of e)s.targetClasses!==null&&s.referencingProperty===r&&s.targetClasses.includes(t)&&i.push(s);return i}filterTier2(e,t){let r=[];for(let i of e)i.targetClasses!==null&&i.referencingProperty===null&&i.targetClasses.includes(t)&&r.push(i);return r}filterTier3(e,t){let r=[];for(let i of e)i.targetClasses===null&&i.referencingProperty===t&&r.push(i);return r}tiebreak(e,t){let r=e.slice().sort((s,a)=>{let c=a.priority-s.priority;return c!==0?c:s.uid.localeCompare(a.uid)}),i=r[0];if(r.length>1){let s=i.priority,a=r.filter(c=>c.priority===s);if(a.length>1){let c=a.slice(1).map(l=>l.uid).join(", ");this.logger.warn(`RelationColumnSetResolver: tier=${t} priority=${s} collision \u2014 selected ${i.uid}; tied losers: ${c}`)}}return i}};$m.RelationColumnSetResolver=Ib});var CC=S(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.RelationColumnSetResolver=void 0;var ZV=xC();Object.defineProperty(Vm,"RelationColumnSetResolver",{enumerable:!0,get:o(function(){return ZV.RelationColumnSetResolver},"get")})});var RC=S(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.LayoutSelector=void 0;vf.selectByPriority=IC;var eB=Us(),Rb=class{static{o(this,"LayoutSelector")}constructor(e){this.source=e}resolve(e){if(!Array.isArray(e)||e.length===0)return null;let t=this.source.all;if(t.length===0)return null;for(let r of e){if(typeof r!="string")continue;let i=eB.WikiLinkHelpers.normalize(r);if(i.length===0)continue;let s=t.filter(a=>a.targetClass===i);if(s.length!==0)return IC(s)}return null}};vf.LayoutSelector=Rb;function IC(n){if(n.length===0)throw new Error("selectByPriority: expected at least one candidate");return n.length===1?n[0]:[...n].sort((t,r)=>t.priority!==r.priority?r.priority-t.priority:t.uid<r.uid?-1:t.uid>r.uid?1:0)[0]}o(IC,"selectByPriority")});var ys=S(Bm=>{"use strict";Object.defineProperty(Bm,"__esModule",{value:!0});Bm.ErrorCode=void 0;var PC;(function(n){n[n.INVALID_INPUT=1e3]="INVALID_INPUT",n[n.INVALID_FORMAT=1001]="INVALID_FORMAT",n[n.MISSING_REQUIRED_FIELD=1002]="MISSING_REQUIRED_FIELD",n[n.INVALID_SCHEMA=1003]="INVALID_SCHEMA",n[n.NETWORK_ERROR=2e3]="NETWORK_ERROR",n[n.REQUEST_TIMEOUT=2001]="REQUEST_TIMEOUT",n[n.CONNECTION_FAILED=2002]="CONNECTION_FAILED",n[n.FILE_READ_ERROR=2003]="FILE_READ_ERROR",n[n.FILE_WRITE_ERROR=2004]="FILE_WRITE_ERROR",n[n.INVALID_STATE=3e3]="INVALID_STATE",n[n.INVALID_TRANSITION=3001]="INVALID_TRANSITION",n[n.OPERATION_FAILED=3002]="OPERATION_FAILED",n[n.CONCURRENT_MODIFICATION=3003]="CONCURRENT_MODIFICATION",n[n.PERMISSION_DENIED=4e3]="PERMISSION_DENIED",n[n.UNAUTHORIZED=4001]="UNAUTHORIZED",n[n.FORBIDDEN=4003]="FORBIDDEN",n[n.NOT_FOUND=5e3]="NOT_FOUND",n[n.RESOURCE_EXHAUSTED=5001]="RESOURCE_EXHAUSTED",n[n.ALREADY_EXISTS=5002]="ALREADY_EXISTS",n[n.UNKNOWN_ERROR=9e3]="UNKNOWN_ERROR",n[n.INTERNAL_ERROR=9001]="INTERNAL_ERROR"})(PC||(Bm.ErrorCode=PC={}))});var _s=S(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.ApplicationError=void 0;var Pb=class extends Error{static{o(this,"ApplicationError")}constructor(e,t){super(e),this.name=this.constructor.name,this.context=t,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
413
+ `)?`"${e.replace(/"/g,'""')}"`:e}};Om.ResultSerializer=fb});var uC=S(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.FileAlreadyExistsError=wl.FileNotFoundError=void 0;var db=class extends Error{static{o(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};wl.FileNotFoundError=db;var hb=class extends Error{static{o(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};wl.FileAlreadyExistsError=hb});var mb=S(vr=>{"use strict";var M$=vr&&vr.__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},j$=vr&&vr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(vr,"__esModule",{value:!0});vr.VaultSettings=vr.DEFAULT_FLEETING_NOTE_CLASS_UID=vr.DEFAULT_INBOX_FOLDER=vr.DEFAULT_OWNER_IDENTITY=void 0;var $$=ue();vr.DEFAULT_OWNER_IDENTITY='"[[!kitelev]]"';vr.DEFAULT_INBOX_FOLDER="01 Inbox";vr.DEFAULT_FLEETING_NOTE_CLASS_UID="fca0a931-a01f-48e4-b72a-4af206c94bc7";var pb=class{static{o(this,"VaultSettings")}constructor(e){this.ownerIdentity=e?.ownerIdentity??vr.DEFAULT_OWNER_IDENTITY,this.defaultInboxFolder=e?.defaultInboxFolder??vr.DEFAULT_INBOX_FOLDER,this.fleetingNoteClassUID=e?.fleetingNoteClassUID??vr.DEFAULT_FLEETING_NOTE_CLASS_UID}getOwnerIdentity(){return this.ownerIdentity}getDefaultInboxFolder(){return this.defaultInboxFolder}getFleetingNoteClassUID(){return this.fleetingNoteClassUID}};vr.VaultSettings=pb;vr.VaultSettings=pb=M$([(0,$$.injectable)(),j$("design:paramtypes",[Object])],pb)});var fC=S(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.container=void 0;Ua.registerCoreServices=uV;Ua.createChildContainer=fV;Ua.getContainer=dV;Ua.resetContainer=hV;Hd();var mf=ue();Object.defineProperty(Ua,"container",{enumerable:!0,get:o(function(){return mf.container},"get")});var Rt=wt(),V$=XS(),B$=ZS(),U$=BS(),q$=bS(),W$=yS(),G$=tm(),z$=nm(),H$=kS(),Q$=jS(),Y$=qS(),K$=NS(),X$=tv(),J$=lv(),Z$=av(),eV=AS(),tV=CS(),rV=YS(),nV=zS(),iV=eb(),sV=ES(),aV=dv(),oV=pv(),cV=xv(),lV=mb();function uV(n){let e=n||mf.container;e.registerSingleton(Rt.DI_TOKENS.DynamicFrontmatterGenerator,V$.DynamicFrontmatterGenerator),e.registerSingleton(Rt.DI_TOKENS.AlgorithmExtractor,B$.AlgorithmExtractor),e.isRegistered(Rt.DI_TOKENS.IVaultSettings)||e.register(Rt.DI_TOKENS.IVaultSettings,{useValue:new lV.VaultSettings}),e.registerSingleton(Rt.DI_TOKENS.EffortStatusWorkflow,G$.EffortStatusWorkflow),e.registerSingleton(Rt.DI_TOKENS.StatusTimestampService,z$.StatusTimestampService),e.registerSingleton(Rt.DI_TOKENS.TaskStatusService,W$.TaskStatusService),e.registerSingleton(Rt.DI_TOKENS.AreaCreationService,q$.AreaCreationService),e.registerSingleton(Rt.DI_TOKENS.ClassCreationService,eV.ClassCreationService),e.registerSingleton(Rt.DI_TOKENS.ConceptCreationService,tV.ConceptCreationService),e.registerSingleton(Rt.DI_TOKENS.FleetingNoteCreationService,rV.FleetingNoteCreationService),e.registerSingleton(Rt.DI_TOKENS.SupervisionCreationService,nV.SupervisionCreationService),e.registerSingleton(Rt.DI_TOKENS.GenericAssetCreationService,oV.GenericAssetCreationService),e.registerSingleton(Rt.DI_TOKENS.PropertyCleanupService,U$.PropertyCleanupService),e.registerSingleton(Rt.DI_TOKENS.FolderRepairService,H$.FolderRepairService),e.registerSingleton(Rt.DI_TOKENS.LabelToAliasService,Q$.LabelToAliasService),e.registerSingleton(Rt.DI_TOKENS.RenameToUidService,Y$.RenameToUidService),e.registerSingleton(Rt.DI_TOKENS.PlanningService,X$.PlanningService),e.registerSingleton(Rt.DI_TOKENS.EffortVotingService,K$.EffortVotingService),e.registerSingleton(Rt.DI_TOKENS.SessionEventService,J$.SessionEventService),e.registerSingleton(Rt.DI_TOKENS.AssetConversionService,Z$.AssetConversionService),e.registerSingleton(Rt.DI_TOKENS.NoteToRDFConverter,iV.NoteToRDFConverter),e.registerSingleton(Rt.DI_TOKENS.AreaHierarchyBuilder,sV.AreaHierarchyBuilder),e.registerSingleton(Rt.DI_TOKENS.URIConstructionService,aV.URIConstructionService),e.registerSingleton(Rt.DI_TOKENS.CriticalityZoneService,cV.CriticalityZoneService)}o(uV,"registerCoreServices");function fV(){return mf.container.createChildContainer()}o(fV,"createChildContainer");function dV(){return mf.container}o(dV,"getContainer");function hV(){mf.container.reset()}o(hV,"resetContainer")});var gb=S(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.DEFAULT_COLORS=El.NODE_FLAGS=void 0;El.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};El.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var _b=S(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.StringTable=void 0;var yb=class n{static{o(this,"StringTable")}constructor(e){if(this.stringToIndex=new Map,this.strings=[],this.memoryBytes=0,e)for(let t of e)this.intern(t)}intern(e){let t=this.stringToIndex.get(e);if(t!==void 0)return t;let r=this.strings.length;return this.strings.push(e),this.stringToIndex.set(e,r),this.memoryBytes+=e.length*2+50,r}getIndex(e){return this.stringToIndex.get(e)??-1}getString(e){if(e<0||e>=this.strings.length)throw new RangeError(`StringTable index out of bounds: ${e}`);return this.strings[e]}has(e){return this.stringToIndex.has(e)}hasIndex(e){return e>=0&&e<this.strings.length}get size(){return this.strings.length}getMemoryBytes(){return this.memoryBytes}*entries(){for(let e=0;e<this.strings.length;e++)yield[e,this.strings[e]]}*values(){for(let e of this.strings)yield e}toArray(){return[...this.strings]}clear(){this.stringToIndex.clear(),this.strings=[],this.memoryBytes=0}static fromJSON(e){return new n(e)}toJSON(){return this.strings}internAll(e){return e.map(t=>this.intern(t))}getStrings(e){return e.map(t=>this.getString(t))}search(e){let t=typeof e=="string"?new RegExp(e):e,r=[];for(let i=0;i<this.strings.length;i++)t.test(this.strings[i])&&r.push([i,this.strings[i]]);return r}getStats(){let e=this.strings.reduce((t,r)=>t+r.length,0);return{count:this.strings.length,memoryBytes:this.memoryBytes,avgStringLength:this.strings.length>0?e/this.strings.length:0}}};Fm.StringTable=yb});var dC=S(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});Nm.CompactGraphStore=void 0;var Dm=_b(),Pn=gb(),pV={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function Sb(n,e){if(n===void 0)return e;if(typeof n=="number")return n;if(n.startsWith("#")){let t=n.slice(1);if(t.length===6)return parseInt(t,16)<<8|255;if(t.length===8)return parseInt(t,16)}return e}o(Sb,"parseColor");var vb=class{static{o(this,"CompactGraphStore")}constructor(e){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex=new Map,this.indexToNodeId=[],this.edgeIdToIndex=new Map,this.config={...pV,...e},this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity),this.uriTable=new Dm.StringTable,this.labelTable=new Dm.StringTable,this.typeTable=new Dm.StringTable,this.predicateTable=new Dm.StringTable}allocateNodeArrays(e){return{positions:new Float32Array(e*2),radii:new Float32Array(e),colors:new Uint32Array(e),types:new Uint16Array(e),flags:new Uint8Array(e)}}allocateEdgeArrays(e){return{sourceIndices:new Uint32Array(e),targetIndices:new Uint32Array(e),predicateIndices:new Uint16Array(e),widths:new Float32Array(e),colors:new Uint32Array(e)}}resizeNodeArrays(e){if(e<=this.nodeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateNodeArrays(e);t.positions.set(this.nodes.positions.subarray(0,this.nodeCount*2)),t.radii.set(this.nodes.radii.subarray(0,this.nodeCount)),t.colors.set(this.nodes.colors.subarray(0,this.nodeCount)),t.types.set(this.nodes.types.subarray(0,this.nodeCount)),t.flags.set(this.nodes.flags.subarray(0,this.nodeCount)),this.nodes=t,this.nodeCapacity=e}resizeEdgeArrays(e){if(e<=this.edgeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateEdgeArrays(e);t.sourceIndices.set(this.edges.sourceIndices.subarray(0,this.edgeCount)),t.targetIndices.set(this.edges.targetIndices.subarray(0,this.edgeCount)),t.predicateIndices.set(this.edges.predicateIndices.subarray(0,this.edgeCount)),t.widths.set(this.edges.widths.subarray(0,this.edgeCount)),t.colors.set(this.edges.colors.subarray(0,this.edgeCount)),this.edges=t,this.edgeCapacity=e}ensureNodeCapacity(e){let t=this.nodeCount+e;if(t>this.nodeCapacity){let r=Math.max(t,Math.floor(this.nodeCapacity*this.config.growthFactor));this.resizeNodeArrays(r)}}ensureEdgeCapacity(e){let t=this.edgeCount+e;if(t>this.edgeCapacity){let r=Math.max(t,Math.floor(this.edgeCapacity*this.config.growthFactor));this.resizeEdgeArrays(r)}}addNode(e){let t=this.nodeIdToIndex.get(e.id);if(t!==void 0)return this.updateNodeAt(t,e),t;this.ensureNodeCapacity(1);let r=this.nodeCount++,i=r*2;this.nodes.positions[i]=e.x??Math.random()*1e3-500,this.nodes.positions[i+1]=e.y??Math.random()*1e3-500,this.nodes.radii[r]=e.radius??8,this.nodes.colors[r]=Sb(e.color,Pn.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=Pn.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=Pn.NODE_FLAGS.PINNED),e.isArchived&&(s|=Pn.NODE_FLAGS.ARCHIVED),this.nodes.flags[r]=s,this.nodeIdToIndex.set(e.id,r),this.indexToNodeId[r]=e.id,this.uriTable.intern(e.id),e.label&&this.labelTable.intern(e.label),r}updateNodeAt(e,t){let r=e*2;t.x!==void 0&&(this.nodes.positions[r]=t.x),t.y!==void 0&&(this.nodes.positions[r+1]=t.y),t.radius!==void 0&&(this.nodes.radii[e]=t.radius),t.color!==void 0&&(this.nodes.colors[e]=Sb(t.color,Pn.DEFAULT_COLORS.NODE)),t.assetClass!==void 0&&(this.nodes.types[e]=this.typeTable.intern(t.assetClass));let i=this.nodes.flags[e];t.isPinned!==void 0&&(i=t.isPinned?i|Pn.NODE_FLAGS.PINNED:i&~Pn.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|Pn.NODE_FLAGS.ARCHIVED:i&~Pn.NODE_FLAGS.ARCHIVED),this.nodes.flags[e]=i}addEdge(e){let t=this.nodeIdToIndex.get(e.sourceId),r=this.nodeIdToIndex.get(e.targetId);if(t===void 0||r===void 0)return-1;let i=`${e.sourceId}->${e.targetId}:${e.predicate??"link"}`,s=this.edgeIdToIndex.get(i);if(s!==void 0)return s;this.ensureEdgeCapacity(1);let a=this.edgeCount++;return this.edges.sourceIndices[a]=t,this.edges.targetIndices[a]=r,this.edges.widths[a]=e.width??1,this.edges.colors[a]=Sb(e.color,Pn.DEFAULT_COLORS.EDGE),e.predicate?this.edges.predicateIndices[a]=this.predicateTable.intern(e.predicate):this.edges.predicateIndices[a]=0,this.edgeIdToIndex.set(i,a),a}addNodes(e){return this.ensureNodeCapacity(e.length),e.map(t=>this.addNode(t))}addEdges(e){return this.ensureEdgeCapacity(e.length),e.map(t=>this.addEdge(t))}loadChunk(e){let r=this.addNodes(e.nodes).filter(a=>a>=0).length,s=this.addEdges(e.edges).filter(a=>a>=0).length;return{nodesAdded:r,edgesAdded:s}}getNodePosition(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return null;let r=t*2;return{x:this.nodes.positions[r],y:this.nodes.positions[r+1]}}getNodePositionByIndex(e){let t=e*2;return{x:this.nodes.positions[t],y:this.nodes.positions[t+1]}}setNodePosition(e,t,r){let i=this.nodeIdToIndex.get(e);if(i===void 0)return!1;let s=i*2;return this.nodes.positions[s]=t,this.nodes.positions[s+1]=r,!0}setNodePositionByIndex(e,t,r){let i=e*2;this.nodes.positions[i]=t,this.nodes.positions[i+1]=r}updateNodePositions(e){let t=0;for(let[r,i]of e)this.setNodePosition(r,i.x,i.y)&&t++;return t}applyNodeUpdates(e){let t=performance.now(),r=0;for(let i of e){let s=i.index;if(!(s<0||s>=this.nodeCount)){if(i.x!==void 0||i.y!==void 0){let a=s*2;i.x!==void 0&&(this.nodes.positions[a]=i.x),i.y!==void 0&&(this.nodes.positions[a+1]=i.y)}i.radius!==void 0&&(this.nodes.radii[s]=i.radius),i.color!==void 0&&(this.nodes.colors[s]=i.color),i.setFlags!==void 0&&(this.nodes.flags[s]|=i.setFlags),i.clearFlags!==void 0&&(this.nodes.flags[s]&=~i.clearFlags),r++}}return{nodesUpdated:r,edgesUpdated:0,timeMs:performance.now()-t}}getNodeFlags(e){let t=this.nodeIdToIndex.get(e);return t===void 0?0:this.nodes.flags[t]}setNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]|=t,!0)}clearNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]&=~t,!0)}hasNodeFlag(e,t){return(this.getNodeFlags(e)&t)!==0}selectNode(e){return this.setNodeFlag(e,Pn.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,Pn.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~Pn.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&Pn.NODE_FLAGS.SELECTED&&e.push(this.indexToNodeId[t]);return e}getNodeId(e){return this.indexToNodeId[e]}getNodeIndex(e){return this.nodeIdToIndex.get(e)}hasNode(e){return this.nodeIdToIndex.has(e)}getNodeCount(){return this.nodeCount}getEdgeCount(){return this.edgeCount}getNodeEdges(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=[];for(let i=0;i<this.edgeCount;i++)this.edges.sourceIndices[i]===t?r.push({edgeIndex:i,isSource:!0}):this.edges.targetIndices[i]===t&&r.push({edgeIndex:i,isSource:!1});return r}getNeighbors(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=new Set;for(let i=0;i<this.edgeCount;i++)if(this.edges.sourceIndices[i]===t){let s=this.edges.targetIndices[i];r.add(this.indexToNodeId[s])}else if(this.edges.targetIndices[i]===t){let s=this.edges.sourceIndices[i];r.add(this.indexToNodeId[s])}return Array.from(r)}getRawArrays(){return{nodes:this.nodes,edges:this.edges,nodeCount:this.nodeCount,edgeCount:this.edgeCount}}getPositionsArray(){return this.nodes.positions.subarray(0,this.nodeCount*2)}getMemoryStats(){let e=this.nodeCapacity*2*4+this.nodeCapacity*4+this.nodeCapacity*4+this.nodeCapacity*2+this.nodeCapacity,t=this.edgeCapacity*4+this.edgeCapacity*4+this.edgeCapacity*2+this.edgeCapacity*4+this.edgeCapacity*4,r=this.uriTable.getMemoryBytes()+this.labelTable.getMemoryBytes()+this.typeTable.getMemoryBytes()+this.predicateTable.getMemoryBytes();return{nodeCount:this.nodeCount,edgeCount:this.edgeCount,nodeCapacity:this.nodeCapacity,edgeCapacity:this.edgeCapacity,nodeMemoryBytes:e,edgeMemoryBytes:t,stringTableBytes:r,totalBytes:e+t+r,internedStringCount:this.uriTable.size+this.labelTable.size+this.typeTable.size+this.predicateTable.size}}clear(){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex.clear(),this.indexToNodeId=[],this.edgeIdToIndex.clear(),this.uriTable.clear(),this.labelTable.clear(),this.typeTable.clear(),this.predicateTable.clear(),this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity)}getTypeTable(){return this.typeTable}getLabelTable(){return this.labelTable}getUriTable(){return this.uriTable}getPredicateTable(){return this.predicateTable}};Nm.CompactGraphStore=vb});var hC=S(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.MemoryPool=void 0;Al.getGlobalPool=gV;Al.resetGlobalPool=yV;var mV={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},Lm=class{static{o(this,"MemoryPool")}constructor(e){this.float32Pool=new Map,this.uint32Pool=new Map,this.uint16Pool=new Map,this.uint8Pool=new Map,this.stats={poolHits:0,poolMisses:0,pooledArrays:0,pooledMemory:0,returned:0,rejected:0},this.config={...mV,...e};for(let t of this.config.sizeBuckets)this.float32Pool.set(t,[]),this.uint32Pool.set(t,[]),this.uint16Pool.set(t,[]),this.uint8Pool.set(t,[])}getBucketSize(e){for(let t of this.config.sizeBuckets)if(t>=e)return t;return e}getFloat32(e){let t=this.getBucketSize(e),r=this.float32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Float32Array(t)}getUint32(e){let t=this.getBucketSize(e),r=this.uint32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint32Array(t)}getUint16(e){let t=this.getBucketSize(e),r=this.uint16Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*2;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint16Array(t)}getUint8(e){let t=this.getBucketSize(e),r=this.uint8Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint8Array(t)}releaseFloat32(e){this.releaseToPool(this.float32Pool,e,4)}releaseUint32(e){this.releaseToPool(this.uint32Pool,e,4)}releaseUint16(e){this.releaseToPool(this.uint16Pool,e,2)}releaseUint8(e){this.releaseToPool(this.uint8Pool,e,1)}releaseToPool(e,t,r){let i=t.length,s=e.get(i);if(s&&s.length<this.config.maxPooledArrays){if(this.config.autoCleanup&&this.stats.pooledMemory+i*r>this.config.maxPoolMemory){this.stats.rejected++;return}s.push(t),this.stats.returned++,this.stats.pooledArrays++,this.stats.pooledMemory+=i*r}else this.stats.rejected++}getStats(){return{...this.stats}}getHitRatio(){let e=this.stats.poolHits+this.stats.poolMisses;return e>0?this.stats.poolHits/e:0}clear(){for(let e of this.float32Pool.values())e.length=0;for(let e of this.uint32Pool.values())e.length=0;for(let e of this.uint16Pool.values())e.length=0;for(let e of this.uint8Pool.values())e.length=0;this.stats.pooledArrays=0,this.stats.pooledMemory=0}cleanup(e){if(this.stats.pooledMemory<=e)return;let t=[...this.config.sizeBuckets].sort((r,i)=>i-r);for(let r of t){if(this.stats.pooledMemory<=e)break;for(let[i,s]of[[this.float32Pool,4],[this.uint32Pool,4],[this.uint16Pool,2],[this.uint8Pool,1]]){let a=i.get(r);if(a)for(;a.length>0&&this.stats.pooledMemory>e;)a.pop(),this.stats.pooledArrays--,this.stats.pooledMemory-=r*s}}}resetStats(){this.stats.poolHits=0,this.stats.poolMisses=0,this.stats.returned=0,this.stats.rejected=0}};Al.MemoryPool=Lm;var Tl=null;function gV(){return Tl||(Tl=new Lm),Tl}o(gV,"getGlobalPool");function yV(){Tl&&Tl.clear(),Tl=null}o(yV,"resetGlobalPool")});var pC=S(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.StreamingLoader=void 0;gf.createStreamingSource=SV;var _V={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},bb=class{static{o(this,"StreamingLoader")}constructor(e,t){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.progressCallbacks=[],this.abortController=null,this.store=e,this.config={..._V,...t}}getState(){return this.state}getProgress(){let e=this.totalChunks!==void 0&&this.totalChunks>0?this.chunksProcessed/this.totalChunks:0;return{currentChunk:this.chunksProcessed,totalChunks:this.totalChunks,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,progress:e,isComplete:this.state==="completed"}}onProgress(e){return this.progressCallbacks.push(e),()=>{let t=this.progressCallbacks.indexOf(e);t>=0&&this.progressCallbacks.splice(t,1)}}notifyProgress(){let e=this.getProgress();for(let t of this.progressCallbacks)t(e)}loadChunk(e){if(this.state==="error")throw new Error("Loader is in error state");this.state="loading",e.totalChunks!==void 0&&(this.totalChunks=e.totalChunks);for(let t of e.nodes)this.store.addNode(t),this.nodesLoaded++;for(let t of e.edges)this.store.addEdge(t)>=0?this.edgesLoaded++:this.pendingEdges.push(t);this.chunksProcessed++,e.isLast&&this.finishLoading(),this.notifyProgress()}finishLoading(){if(this.config.autoResolveEdges&&this.pendingEdges.length>0){for(let e of this.pendingEdges)this.store.addEdge(e)>=0&&this.edgesLoaded++;this.pendingEdges=[]}this.state="completed",this.notifyProgress()}async loadFromIterator(e){this.reset(),this.state="loading",this.abortController=new AbortController;try{for await(let r of e){if(this.abortController.signal.aborted){this.state="paused";return}this.loadChunk(r),this.config.chunkDelay>0&&await this.delay(this.config.chunkDelay)}this.state!=="completed"&&this.finishLoading()}catch(t){throw this.state="error",t}finally{this.abortController=null}}async loadFromArrays(e,t){let r=this.createChunks(e,t);await this.loadFromIterator(this.arrayToAsyncIterator(r))}createChunks(e,t){let r=[],{chunkSize:i}=this.config,s=Math.ceil(e.length/i),a=Array(s).fill(null).map(()=>[]);for(let c of t){let l=e.findIndex(u=>u.id===c.sourceId);if(l>=0){let u=Math.floor(l/i);a[u].push(c)}}for(let c=0;c<s;c++){let l=c*i,u=Math.min(l+i,e.length);r.push({chunkIndex:c,totalChunks:s,nodes:e.slice(l,u),edges:a[c],isLast:c===s-1})}return r}async*arrayToAsyncIterator(e){for(let t of e)yield t}delay(e){return new Promise(t=>setTimeout(t,e))}cancel(){this.abortController&&this.abortController.abort(),this.state="paused"}reset(){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.totalChunks=void 0,this.abortController=null}getPendingEdgeCount(){return this.pendingEdges.length}getStats(){return{state:this.state,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,chunksProcessed:this.chunksProcessed,totalChunks:this.totalChunks,pendingEdges:this.pendingEdges.length,storeStats:this.store.getMemoryStats()}}};gf.StreamingLoader=bb;async function*SV(n,e,t=1e3){let r=0,i=0,s;for(;;){let a=await e(n,r,t);if(a.totalCount!==void 0&&s===void 0&&(s=Math.ceil(a.totalCount/t)),yield{chunkIndex:i,totalChunks:s,nodes:a.nodes,edges:a.edges,isLast:!a.hasMore},!a.hasMore)break;r+=t,i++}}o(SV,"createStreamingSource")});var yC=S(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.createStreamingSource=rr.StreamingLoader=rr.resetGlobalPool=rr.getGlobalPool=rr.MemoryPool=rr.CompactGraphStore=rr.StringTable=rr.DEFAULT_COLORS=rr.NODE_FLAGS=void 0;var mC=gb();Object.defineProperty(rr,"NODE_FLAGS",{enumerable:!0,get:o(function(){return mC.NODE_FLAGS},"get")});Object.defineProperty(rr,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return mC.DEFAULT_COLORS},"get")});var vV=_b();Object.defineProperty(rr,"StringTable",{enumerable:!0,get:o(function(){return vV.StringTable},"get")});var bV=dC();Object.defineProperty(rr,"CompactGraphStore",{enumerable:!0,get:o(function(){return bV.CompactGraphStore},"get")});var wb=hC();Object.defineProperty(rr,"MemoryPool",{enumerable:!0,get:o(function(){return wb.MemoryPool},"get")});Object.defineProperty(rr,"getGlobalPool",{enumerable:!0,get:o(function(){return wb.getGlobalPool},"get")});Object.defineProperty(rr,"resetGlobalPool",{enumerable:!0,get:o(function(){return wb.resetGlobalPool},"get")});var gC=pC();Object.defineProperty(rr,"StreamingLoader",{enumerable:!0,get:o(function(){return gC.StreamingLoader},"get")});Object.defineProperty(rr,"createStreamingSource",{enumerable:!0,get:o(function(){return gC.createStreamingSource},"get")})});var _C=S(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.ExoQLError=nr.ExoQL=nr.ExoQLBudgetExceededError=nr.ExoQLCycleError=nr.ExoQLEvalDisabledError=nr.ExoQLForbiddenKeywordError=nr.DEFAULT_EVAL_CONFIG=nr.validateExoQLAllowlist=nr.evaluateWithExoEval=void 0;var wV=jc(),EV=Vc(),TV=al(),Eb=Jv(),AV=Ne(),xV=J1();Object.defineProperty(nr,"evaluateWithExoEval",{enumerable:!0,get:o(function(){return xV.evaluateWithExoEval},"get")});var CV=Y1();Object.defineProperty(nr,"validateExoQLAllowlist",{enumerable:!0,get:o(function(){return CV.validateExoQLAllowlist},"get")});var IV=K1();Object.defineProperty(nr,"DEFAULT_EVAL_CONFIG",{enumerable:!0,get:o(function(){return IV.DEFAULT_EVAL_CONFIG},"get")});var km=Zu();Object.defineProperty(nr,"ExoQLForbiddenKeywordError",{enumerable:!0,get:o(function(){return km.ExoQLForbiddenKeywordError},"get")});Object.defineProperty(nr,"ExoQLEvalDisabledError",{enumerable:!0,get:o(function(){return km.ExoQLEvalDisabledError},"get")});Object.defineProperty(nr,"ExoQLCycleError",{enumerable:!0,get:o(function(){return km.ExoQLCycleError},"get")});Object.defineProperty(nr,"ExoQLBudgetExceededError",{enumerable:!0,get:o(function(){return km.ExoQLBudgetExceededError},"get")});var Tb=class n{static{o(this,"ExoQL")}static async query(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);return s.executeAll(i)}static async ask(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);if(!s.isAskQuery(i))throw new yf("ExoQL.ask() requires an ASK query");return s.executeAsk(i)}static async construct(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);if(!s.isConstructQuery(i))throw new yf("ExoQL.construct() requires a CONSTRUCT query");return s.executeConstruct(i)}static async queryOwn(e,t,r,i){let s=await n.query(e,t,i);if(s.length===0)return[];let a=r?.subjectVar??"s",c=r?.predicateVar??"p",l=r?.objectVar??"o";return(await new Eb.SourceAnnotator(t).annotate(s,a,c,l)).filter(d=>{let h=d.get(Eb.SOURCE_VARIABLE);return h instanceof AV.Literal&&h.value==="own"})}static async isOwn(e,t,r,i){return await new Eb.SourceAnnotator(i).determineSource(e,t,r)==="own"}static prepare(e,t,r){let i=new wV.ExoQLParser,s=new EV.ExoQLAlgebraTranslator,a=i.parse(e),c=s.translate(a),l=new TV.ExoQLQueryExecutor(t,r);return{algebra:c,executor:l}}};nr.ExoQL=Tb;var yf=class extends Error{static{o(this,"ExoQLError")}constructor(e){super(e),this.name="ExoQLError"}};nr.ExoQLError=yf});var _f=S(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.RELATION_COLUMN_SET_CLASS_UID=ti.RELATION_COLUMN_SET_CLASS_IRI=void 0;ti.normalizeRef=Ab;ti.createRelationColumnSetFromFrontmatter=PV;ti.isRelationColumnSet=OV;ti.isRelationColumnSetFrontmatter=DV;var SC=Us();function Ab(n){if(typeof n!="string")return null;let e=SC.WikiLinkHelpers.normalize(n);return e.length>0?e:null}o(Ab,"normalizeRef");function xb(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}o(xb,"toStringArray");function RV(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}o(RV,"basenameFromPath");function PV(n,e){let t=e.warn??(()=>{}),r=e.sourcePath;if(!n||typeof n!="object")return t(`RelationColumnSet: missing frontmatter at ${r}`),null;let i=n.exo__Asset_uid,s=typeof i=="string"?i.trim():"";if(s.length===0)return t(`RelationColumnSet: exo__Asset_uid missing at ${r}`),null;let a=xb(n.ui__RelationColumnSet_targetClass),c=[];for(let E of a){let b=Ab(E);b!==null&&c.push(b)}let l=c.length>0?c:null,u=Ab(n.ui__RelationColumnSet_referencingProperty);if(l===null&&u===null)return t(`RelationColumnSet ${s}: at least one of targetClass / referencingProperty required (${r})`),null;let f=xb(n.ui__RelationColumnSet_columns),d=[];for(let E of f){let b=SC.WikiLinkHelpers.normalize(E);b.length>0&&d.push(b)}if(d.length===0)return t(`RelationColumnSet ${s}: columns array must contain at least one entry (${r})`),null;let h=n.ui__RelationColumnSet_label,p=typeof h=="string"&&h.trim().length>0?h.trim():RV(r),y=n.ui__RelationColumnSet_priority,v=0;if(typeof y=="number"&&Number.isFinite(y))v=y;else if(typeof y=="string"){let E=Number.parseFloat(y);Number.isFinite(E)&&(v=E)}return{uid:s,label:p,targetClasses:l,referencingProperty:u,columns:d,priority:v,sourcePath:r}}o(PV,"createRelationColumnSetFromFrontmatter");function OV(n){if(!n||typeof n!="object")return!1;let e=n;return!(typeof e.uid!="string"||e.uid.length===0||typeof e.label!="string"||e.targetClasses!==null&&(!Array.isArray(e.targetClasses)||e.targetClasses.some(t=>typeof t!="string"))||e.referencingProperty!==null&&typeof e.referencingProperty!="string"||!Array.isArray(e.columns)||e.columns.length===0||e.columns.some(t=>typeof t!="string")||typeof e.priority!="number"||!Number.isFinite(e.priority)||typeof e.sourcePath!="string")}o(OV,"isRelationColumnSet");ti.RELATION_COLUMN_SET_CLASS_IRI="ui__RelationColumnSet";ti.RELATION_COLUMN_SET_CLASS_UID="97fc9862-c886-4d86-9a60-e0cf9d778575";function FV(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(s=>s.trim()).filter(s=>s.length>0)}o(FV,"extractClassIdentifiers");function DV(n){if(!n)return!1;let e=n.exo__Instance_class,t=xb(e);for(let r of t)for(let i of FV(r))if(i===ti.RELATION_COLUMN_SET_CLASS_IRI||i===ti.RELATION_COLUMN_SET_CLASS_UID)return!0;return!1}o(DV,"isRelationColumnSetFrontmatter")});var bC=S(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.LAYOUT_CLASS_UID=Vi.LAYOUT_CLASS_IRI=void 0;Vi.createLayoutFromFrontmatter=$V;Vi.isLayout=VV;Vi.isLayoutFrontmatter=UV;var NV=Us(),LV=_f();Vi.LAYOUT_CLASS_IRI="exo__Layout";Vi.LAYOUT_CLASS_UID="08d00289-a5c8-4df1-8885-40a00a014004";function vC(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}o(vC,"toStringArray");function kV(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}o(kV,"basenameFromPath");function MV(n,e){if(typeof n=="boolean")return n;if(typeof n=="string"){let t=n.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}o(MV,"parseBoolean");function jV(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let e=Number.parseFloat(n);if(Number.isFinite(e))return e}return 0}o(jV,"parsePriority");function $V(n,e){let t=e.warn??(()=>{}),r=e.sourcePath;if(!n||typeof n!="object")return t(`Layout: missing frontmatter at ${r}`),null;let i=n.exo__Asset_uid,s=typeof i=="string"?i.trim():"";if(s.length===0)return t(`Layout: exo__Asset_uid missing at ${r}`),null;let a=(0,LV.normalizeRef)(n.exo__Layout_targetClass);if(a===null)return t(`Layout ${s}: exo__Layout_targetClass required (${r})`),null;let c=vC(n.exo__Layout_blocks),l=[];for(let p of c){let y=NV.WikiLinkHelpers.normalize(p);y.length>0&&l.push(y)}if(l.length===0)return t(`Layout ${s}: exo__Layout_blocks must contain at least one block (${r})`),null;let u=n.exo__Asset_label,f=typeof u=="string"&&u.trim().length>0?u.trim():kV(r),d=jV(n.exo__Layout_priority),h=MV(n.exo__Layout_coexistsWithDefault,!1);return{uid:s,label:f,targetClass:a,blocks:l,priority:d,coexistsWithDefault:h,sourcePath:r}}o($V,"createLayoutFromFrontmatter");function VV(n){if(!n||typeof n!="object")return!1;let e=n;return!(typeof e.uid!="string"||e.uid.length===0||typeof e.label!="string"||typeof e.targetClass!="string"||e.targetClass.length===0||!Array.isArray(e.blocks)||e.blocks.length===0||e.blocks.some(t=>typeof t!="string")||typeof e.priority!="number"||!Number.isFinite(e.priority)||typeof e.coexistsWithDefault!="boolean"||typeof e.sourcePath!="string")}o(VV,"isLayout");function BV(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(i=>i.trim()).filter(i=>i.length>0)}o(BV,"extractClassIdentifiers");function UV(n){if(!n)return!1;let e=vC(n.exo__Instance_class);for(let t of e)for(let r of BV(t))if(r===Vi.LAYOUT_CLASS_IRI||r===Vi.LAYOUT_CLASS_UID)return!0;return!1}o(UV,"isLayoutFrontmatter")});var TC=S(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.BACKLINKS_TABLE_BLOCK_CLASS_UID=Gt.BACKLINKS_TABLE_BLOCK_CLASS_IRI=Gt.PROPERTIES_BLOCK_CLASS_UID=Gt.PROPERTIES_BLOCK_CLASS_IRI=void 0;Gt.createLayoutBlockFromFrontmatter=QV;Gt.isLayoutBlockFrontmatter=YV;Gt.isPropertiesBlock=KV;Gt.isBacklinksTableBlock=XV;var qV=Us(),Cb=_f();Gt.PROPERTIES_BLOCK_CLASS_IRI="exo__PropertiesBlock";Gt.PROPERTIES_BLOCK_CLASS_UID="fd039b3c-ed2b-41c2-a42e-bbfcdd074bfe";Gt.BACKLINKS_TABLE_BLOCK_CLASS_IRI="exo__BacklinksTableBlock";Gt.BACKLINKS_TABLE_BLOCK_CLASS_UID="2e868956-d81e-43fd-9817-1addde9cb311";function wC(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}o(wC,"toStringArray");function WV(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}o(WV,"basenameFromPath");function EC(n,e){if(typeof n=="boolean")return n;if(typeof n=="string"){let t=n.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}o(EC,"parseBoolean");function GV(n){if(typeof n=="number"&&Number.isFinite(n)&&Number.isInteger(n))return n;if(typeof n=="string"){let e=Number.parseInt(n,10);if(Number.isFinite(e))return e}return null}o(GV,"parseInteger");function zV(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(i=>i.trim()).filter(i=>i.length>0)}o(zV,"extractClassIdentifiers");function Mm(n,e,t){let r=wC(n.exo__Instance_class);for(let i of r)for(let s of zV(i))if(s===e||s===t)return!0;return!1}o(Mm,"classOf");function HV(n,e){let t=e.warn??(()=>{}),r=n.exo__Asset_uid,i=typeof r=="string"?r.trim():"";if(i.length===0)return t(`LayoutBlock: exo__Asset_uid missing at ${e.sourcePath}`),null;let s=n.exo__LayoutBlock_title,a=n.exo__Asset_label,c=typeof s=="string"&&s.trim().length>0?s.trim():typeof a=="string"&&a.trim().length>0?a.trim():WV(e.sourcePath),l=EC(n.exo__LayoutBlock_collapsed,!1);return{uid:i,title:c,collapsed:l,sourcePath:e.sourcePath}}o(HV,"extractBase");function QV(n,e){let t=e.warn??(()=>{});if(!n||typeof n!="object")return t(`LayoutBlock: missing frontmatter at ${e.sourcePath}`),null;let r=HV(n,e);if(r===null)return null;if(Mm(n,Gt.PROPERTIES_BLOCK_CLASS_IRI,Gt.PROPERTIES_BLOCK_CLASS_UID))return{...r,kind:"properties"};if(Mm(n,Gt.BACKLINKS_TABLE_BLOCK_CLASS_IRI,Gt.BACKLINKS_TABLE_BLOCK_CLASS_UID)){let i=(0,Cb.normalizeRef)(n.exo__BacklinksTableBlock_rowClass),s=(0,Cb.normalizeRef)(n.exo__BacklinksTableBlock_referencingProperty);if(i===null||s===null)return t(`BacklinksTableBlock ${r.uid}: rowClass and referencingProperty required (${e.sourcePath})`),null;let a=wC(n.exo__BacklinksTableBlock_columns),c=[];for(let p of a){let y=qV.WikiLinkHelpers.normalize(p);y.length>0&&c.push(y)}let l=(0,Cb.normalizeRef)(n.exo__BacklinksTableBlock_sortBy),u=n.exo__BacklinksTableBlock_sortOrder,f=typeof u=="string"&&u.trim().toLowerCase()==="desc"?"desc":"asc",d=GV(n.exo__BacklinksTableBlock_limit),h=EC(n.exo__BacklinksTableBlock_showArchived,!1);return{...r,kind:"backlinks-table",rowClass:i,referencingProperty:s,columns:c,sortBy:l,sortOrder:f,limit:d,showArchived:h}}return t(`LayoutBlock ${r.uid}: unknown block class at ${e.sourcePath} \u2014 expected exo__PropertiesBlock or exo__BacklinksTableBlock`),null}o(QV,"createLayoutBlockFromFrontmatter");function YV(n){return n?Mm(n,Gt.PROPERTIES_BLOCK_CLASS_IRI,Gt.PROPERTIES_BLOCK_CLASS_UID)||Mm(n,Gt.BACKLINKS_TABLE_BLOCK_CLASS_IRI,Gt.BACKLINKS_TABLE_BLOCK_CLASS_UID):!1}o(YV,"isLayoutBlockFrontmatter");function KV(n){return n.kind==="properties"}o(KV,"isPropertiesBlock");function XV(n){return n.kind==="backlinks-table"}o(XV,"isBacklinksTableBlock")});var jm=S(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.isPropertiesBlock=Me.isLayoutBlockFrontmatter=Me.isBacklinksTableBlock=Me.createLayoutBlockFromFrontmatter=Me.PROPERTIES_BLOCK_CLASS_UID=Me.PROPERTIES_BLOCK_CLASS_IRI=Me.BACKLINKS_TABLE_BLOCK_CLASS_UID=Me.BACKLINKS_TABLE_BLOCK_CLASS_IRI=Me.isLayoutFrontmatter=Me.isLayout=Me.createLayoutFromFrontmatter=Me.LAYOUT_CLASS_UID=Me.LAYOUT_CLASS_IRI=Me.normalizeRef=Me.isRelationColumnSetFrontmatter=Me.isRelationColumnSet=Me.createRelationColumnSetFromFrontmatter=Me.RELATION_COLUMN_SET_CLASS_UID=Me.RELATION_COLUMN_SET_CLASS_IRI=void 0;var xl=_f();Object.defineProperty(Me,"RELATION_COLUMN_SET_CLASS_IRI",{enumerable:!0,get:o(function(){return xl.RELATION_COLUMN_SET_CLASS_IRI},"get")});Object.defineProperty(Me,"RELATION_COLUMN_SET_CLASS_UID",{enumerable:!0,get:o(function(){return xl.RELATION_COLUMN_SET_CLASS_UID},"get")});Object.defineProperty(Me,"createRelationColumnSetFromFrontmatter",{enumerable:!0,get:o(function(){return xl.createRelationColumnSetFromFrontmatter},"get")});Object.defineProperty(Me,"isRelationColumnSet",{enumerable:!0,get:o(function(){return xl.isRelationColumnSet},"get")});Object.defineProperty(Me,"isRelationColumnSetFrontmatter",{enumerable:!0,get:o(function(){return xl.isRelationColumnSetFrontmatter},"get")});Object.defineProperty(Me,"normalizeRef",{enumerable:!0,get:o(function(){return xl.normalizeRef},"get")});var Sf=bC();Object.defineProperty(Me,"LAYOUT_CLASS_IRI",{enumerable:!0,get:o(function(){return Sf.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(Me,"LAYOUT_CLASS_UID",{enumerable:!0,get:o(function(){return Sf.LAYOUT_CLASS_UID},"get")});Object.defineProperty(Me,"createLayoutFromFrontmatter",{enumerable:!0,get:o(function(){return Sf.createLayoutFromFrontmatter},"get")});Object.defineProperty(Me,"isLayout",{enumerable:!0,get:o(function(){return Sf.isLayout},"get")});Object.defineProperty(Me,"isLayoutFrontmatter",{enumerable:!0,get:o(function(){return Sf.isLayoutFrontmatter},"get")});var qa=TC();Object.defineProperty(Me,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return qa.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(Me,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return qa.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(Me,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return qa.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(Me,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return qa.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(Me,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:o(function(){return qa.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(Me,"isBacklinksTableBlock",{enumerable:!0,get:o(function(){return qa.isBacklinksTableBlock},"get")});Object.defineProperty(Me,"isLayoutBlockFrontmatter",{enumerable:!0,get:o(function(){return qa.isLayoutBlockFrontmatter},"get")});Object.defineProperty(Me,"isPropertiesBlock",{enumerable:!0,get:o(function(){return qa.isPropertiesBlock},"get")})});var xC=S($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.RelationColumnSetResolver=void 0;var AC=_f(),JV={warn:o(()=>{},"warn")},Ib=class{static{o(this,"RelationColumnSetResolver")}constructor(e,t={}){this.provider=e,this.logger=t.logger??JV}resolve(e,t){if(!e||e.length===0)return null;let r=t!=null?(0,AC.normalizeRef)(t):null,i=this.provider();if(i.length===0)return null;for(let s of e){let a=(0,AC.normalizeRef)(s);if(a===null)continue;if(r!==null){let l=this.filterTier1(i,a,r);if(l.length>0)return this.tiebreak(l,1)}let c=this.filterTier2(i,a);if(c.length>0)return this.tiebreak(c,2);if(r!==null){let l=this.filterTier3(i,r);if(l.length>0)return this.tiebreak(l,3)}}return null}filterTier1(e,t,r){let i=[];for(let s of e)s.targetClasses!==null&&s.referencingProperty===r&&s.targetClasses.includes(t)&&i.push(s);return i}filterTier2(e,t){let r=[];for(let i of e)i.targetClasses!==null&&i.referencingProperty===null&&i.targetClasses.includes(t)&&r.push(i);return r}filterTier3(e,t){let r=[];for(let i of e)i.targetClasses===null&&i.referencingProperty===t&&r.push(i);return r}tiebreak(e,t){let r=e.slice().sort((s,a)=>{let c=a.priority-s.priority;return c!==0?c:s.uid.localeCompare(a.uid)}),i=r[0];if(r.length>1){let s=i.priority,a=r.filter(c=>c.priority===s);if(a.length>1){let c=a.slice(1).map(l=>l.uid).join(", ");this.logger.warn(`RelationColumnSetResolver: tier=${t} priority=${s} collision \u2014 selected ${i.uid}; tied losers: ${c}`)}}return i}};$m.RelationColumnSetResolver=Ib});var CC=S(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.RelationColumnSetResolver=void 0;var ZV=xC();Object.defineProperty(Vm,"RelationColumnSetResolver",{enumerable:!0,get:o(function(){return ZV.RelationColumnSetResolver},"get")})});var RC=S(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.LayoutSelector=void 0;vf.selectByPriority=IC;var eB=Us(),Rb=class{static{o(this,"LayoutSelector")}constructor(e){this.source=e}resolve(e){if(!Array.isArray(e)||e.length===0)return null;let t=this.source.all;if(t.length===0)return null;for(let r of e){if(typeof r!="string")continue;let i=eB.WikiLinkHelpers.normalize(r);if(i.length===0)continue;let s=t.filter(a=>a.targetClass===i);if(s.length!==0)return IC(s)}return null}};vf.LayoutSelector=Rb;function IC(n){if(n.length===0)throw new Error("selectByPriority: expected at least one candidate");return n.length===1?n[0]:[...n].sort((t,r)=>t.priority!==r.priority?r.priority-t.priority:t.uid<r.uid?-1:t.uid>r.uid?1:0)[0]}o(IC,"selectByPriority")});var ys=S(Bm=>{"use strict";Object.defineProperty(Bm,"__esModule",{value:!0});Bm.ErrorCode=void 0;var PC;(function(n){n[n.INVALID_INPUT=1e3]="INVALID_INPUT",n[n.INVALID_FORMAT=1001]="INVALID_FORMAT",n[n.MISSING_REQUIRED_FIELD=1002]="MISSING_REQUIRED_FIELD",n[n.INVALID_SCHEMA=1003]="INVALID_SCHEMA",n[n.NETWORK_ERROR=2e3]="NETWORK_ERROR",n[n.REQUEST_TIMEOUT=2001]="REQUEST_TIMEOUT",n[n.CONNECTION_FAILED=2002]="CONNECTION_FAILED",n[n.FILE_READ_ERROR=2003]="FILE_READ_ERROR",n[n.FILE_WRITE_ERROR=2004]="FILE_WRITE_ERROR",n[n.INVALID_STATE=3e3]="INVALID_STATE",n[n.INVALID_TRANSITION=3001]="INVALID_TRANSITION",n[n.OPERATION_FAILED=3002]="OPERATION_FAILED",n[n.CONCURRENT_MODIFICATION=3003]="CONCURRENT_MODIFICATION",n[n.PERMISSION_DENIED=4e3]="PERMISSION_DENIED",n[n.UNAUTHORIZED=4001]="UNAUTHORIZED",n[n.FORBIDDEN=4003]="FORBIDDEN",n[n.NOT_FOUND=5e3]="NOT_FOUND",n[n.RESOURCE_EXHAUSTED=5001]="RESOURCE_EXHAUSTED",n[n.ALREADY_EXISTS=5002]="ALREADY_EXISTS",n[n.UNKNOWN_ERROR=9e3]="UNKNOWN_ERROR",n[n.INTERNAL_ERROR=9001]="INTERNAL_ERROR"})(PC||(Bm.ErrorCode=PC={}))});var _s=S(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.ApplicationError=void 0;var Pb=class extends Error{static{o(this,"ApplicationError")}constructor(e,t){super(e),this.name=this.constructor.name,this.context=t,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
414
414
 
415
415
  \u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
416
416
 
@@ -451,32 +451,32 @@ To resolve:
451
451
  \u2022 Check service initialization parameters
452
452
  \u2022 Verify all required dependencies are available
453
453
  \u2022 Review service logs for detailed error information
454
- \u2022 Contact support if the issue persists`}};Ym.ServiceError=Mb});var jC=S(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.ServiceError=ir.ResourceExhaustedError=ir.NotFoundError=ir.PermissionError=ir.StateTransitionError=ir.NetworkError=ir.ValidationError=ir.ApplicationError=ir.ErrorCode=void 0;var mB=ys();Object.defineProperty(ir,"ErrorCode",{enumerable:!0,get:o(function(){return mB.ErrorCode},"get")});var gB=_s();Object.defineProperty(ir,"ApplicationError",{enumerable:!0,get:o(function(){return gB.ApplicationError},"get")});var yB=OC();Object.defineProperty(ir,"ValidationError",{enumerable:!0,get:o(function(){return yB.ValidationError},"get")});var _B=FC();Object.defineProperty(ir,"NetworkError",{enumerable:!0,get:o(function(){return _B.NetworkError},"get")});var SB=DC();Object.defineProperty(ir,"StateTransitionError",{enumerable:!0,get:o(function(){return SB.StateTransitionError},"get")});var vB=NC();Object.defineProperty(ir,"PermissionError",{enumerable:!0,get:o(function(){return vB.PermissionError},"get")});var bB=LC();Object.defineProperty(ir,"NotFoundError",{enumerable:!0,get:o(function(){return bB.NotFoundError},"get")});var wB=kC();Object.defineProperty(ir,"ResourceExhaustedError",{enumerable:!0,get:o(function(){return wB.ResourceExhaustedError},"get")});var EB=MC();Object.defineProperty(ir,"ServiceError",{enumerable:!0,get:o(function(){return EB.ServiceError},"get")})});var $b=S(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.ShapeRegistry=void 0;var jb=class{static{o(this,"ShapeRegistry")}constructor(){this.shapes=new Map}get(e){return this.shapes.get(e)}register(e){this.shapes.set(e.propertyIRI,e)}getAll(){return Array.from(this.shapes.values())}get size(){return this.shapes.size}};Km.ShapeRegistry=jb});var qb=S(Ss=>{"use strict";var TB=Ss&&Ss.__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]})),AB=Ss&&Ss.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Vb=Ss&&Ss.__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"&&TB(t,e,r[i]);return AB(t,e),t}})();Object.defineProperty(Ss,"__esModule",{value:!0});Ss.ShapeLoader=void 0;var Bb=$b(),Cl=Ae(),$C=Ne(),ri=yr(),Xm="http://www.w3.org/ns/shacl#",xB=[["exo__",ri.Namespace.EXO],["ems__",ri.Namespace.EMS],["exocmd__",ri.Namespace.EXOCMD],["ims__",ri.Namespace.IMS],["ztlk__",ri.Namespace.ZTLK],["ptms__",ri.Namespace.PTMS],["lit__",ri.Namespace.LIT],["inbox__",ri.Namespace.INBOX],["pmbok__",ri.Namespace.PMBOK]],Ub=class n{static{o(this,"ShapeLoader")}static async loadFromVaultFS(e){let{readdir:t,readFile:r}=await Promise.resolve().then(()=>Vb(require("fs/promises"))),i=await Promise.resolve().then(()=>Vb(require("path"))),s=new Bb.ShapeRegistry;return await n.scanDir(e,s,{readdir:t,readFile:r,path:i}),s}static async loadFromRDFGraph(e){let t=new Bb.ShapeRegistry,r=ri.Namespace.EXO,i=ri.Namespace.RDFS,s=ri.Namespace.RDF,[a,c]=await Promise.all([e.match(void 0,s.term("type"),r.term("ObjectProperty")),e.match(void 0,s.term("type"),r.term("Property"))]),l=new Set;for(let u of[...a,...c])u.subject instanceof Cl.IRI&&l.add(u.subject.value);for(let u of l){let f=new Cl.IRI(u),[d,h,p,y,v]=await Promise.all([e.match(f,i.term("domain"),void 0),e.match(f,i.term("range"),void 0),e.match(f,r.term("Property_cardinality"),void 0),e.match(f,r.term("Property_severity"),void 0),e.match(f,r.term("Asset_label"),void 0)]);if(d.length===0)continue;let E=v[0]?.object;if(!(E instanceof $C.Literal))continue;let b=n.labelToIRI(E.value);if(!b)continue;let A=d.map(te=>te.object instanceof Cl.IRI?te.object.value:null).filter(te=>te!==null),I=h.map(te=>te.object instanceof Cl.IRI?te.object.value:null).filter(te=>te!==null),j=n.cardinalityFromIRI(p[0]?.object instanceof Cl.IRI?p[0].object.value:void 0),B=n.severityFromValue(y[0]?.object instanceof $C.Literal||y[0]?.object instanceof Cl.IRI?y[0].object.value:void 0);t.register({propertyIRI:b,domain:A,range:I.length>0?I:void 0,cardinality:j,severity:B})}return t}static async loadFromShapeJSON(e){let{readFile:t}=await Promise.resolve().then(()=>Vb(require("fs/promises"))),r=await t(e,"utf-8"),i=JSON.parse(r),s=new Bb.ShapeRegistry;for(let a of Object.values(i.shapes))s.register(a);return s}static async scanDir(e,t,r){let i;try{i=await r.readdir(e,{withFileTypes:!0})}catch{return}for(let s of i){let a=r.path.join(e,s.name);s.isDirectory()?await n.scanDir(a,t,r):s.isFile()&&s.name.endsWith(".md")&&await n.processFile(a,t,r.readFile)}}static async processFile(e,t,r){let i;try{i=await r(e,"utf-8")}catch{return}let s=n.parseFrontmatter(i);if(!s||!n.asArray(s.exo__Instance_class).some(I=>{let j=n.extractWikilinkRef(I);return j==="exo__Property"||j==="exo__ObjectProperty"||j?.includes("|exo__Property")||j?.includes("|exo__ObjectProperty")}))return;let l=s.exo__Asset_label;if(!l||typeof l!="string")return;let u=l.trim(),f=n.labelToIRI(u);if(!f)return;let d=s.exo__Property_domain,h=s.exo__Property_range,p=s.exo__Property_cardinality,y=s.exo__Property_severity,v=n.asArray(d).map(I=>n.wikilinkToIRI(I)).filter(I=>I!==null);if(v.length===0)return;let E=n.asArray(h).map(I=>n.wikilinkToIRI(I)).filter(I=>I!==null),b=n.cardinalityFromLabel(typeof p=="string"?p:void 0),A=n.severityFromValue(typeof y=="string"?y:void 0);t.register({propertyIRI:f,domain:v,range:E.length>0?E:void 0,cardinality:b,severity:A})}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let r=t[1],i={},s=r.split(/\r?\n/),a=null,c=null;for(let l of s){let u=/^ {2}- (.*)$/.exec(l);if(u){a&&c&&c.push(u[1].trim());continue}a&&c&&(i[a]=c,a=null,c=null);let f=/^([^:]+):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(a=d,c=[]):i[d]=h}return a&&c&&(i[a]=c),i}static labelToIRI(e){for(let[t,r]of xB)if(e.startsWith(t))return r.term(e.substring(t.length)).value;return null}static extractWikilinkRef(e){let t=e.replace(/^["']|["']$/g,""),r=/\[\[([^\]]+)\]\]/.exec(t);return r?r[1]:t}static wikilinkToIRI(e){let t=n.extractWikilinkRef(e);if(!t)return null;let r=t.split("|"),i=r.length>1?[r[1],r[0]]:[r[0]];for(let s of i){let a=n.labelToIRI(s.trim());if(a)return a}return t.startsWith("http")?t:t.startsWith("sh:")?Xm+t.substring(3):null}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static cardinalityFromIRI(e){if(e){if(e.endsWith("PropertyCardinalitySingle"))return"Single";if(e.endsWith("PropertyCardinalityMultiple"))return"Multiple"}}static cardinalityFromLabel(e){if(!e)return;let t=n.extractWikilinkRef(e)??e,r=t.split("|").pop()??t;if(r.includes("Single"))return"Single";if(r.includes("Multiple"))return"Multiple"}static severityFromValue(e){return!e||e.includes("Violation")||e===Xm+"Violation"?"sh:Violation":e.includes("Warning")||e===Xm+"Warning"?"sh:Warning":e.includes("Info")||e===Xm+"Info"?"sh:Info":"sh:Violation"}};Ss.ShapeLoader=Ub});var Gb=S(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.ShapeRegistry=void 0;bf.validate=CB;var Wb=class{static{o(this,"ShapeRegistry")}constructor(e=[],t="https://exocortex.my/ontology/exo#Instance_class"){this.shapeMap=new Map(e.map(r=>[r.propertyIRI,r])),this.typePredicateIRI=t}getShape(e){return this.shapeMap.get(e)}getAllShapes(){return Array.from(this.shapeMap.values())}hasShape(e){return this.shapeMap.has(e)}};bf.ShapeRegistry=Wb;function CB(n,e,t){let r=new Map,i=new Map;for(let c of n){let{subject:l,predicate:u,object:f}=c;if(l.type!=="iri"||u.type!=="iri"||f.type!=="iri"&&f.type!=="literal")continue;let d=l.value,h=u.value,p=f;if(h===e.typePredicateIRI){if(p.type==="iri"){let y=r.get(d)??[];y.push(p.value),r.set(d,y)}}else{let y=i.get(d);y||(y=new Map,i.set(d,y));let v=y.get(h)??[];v.push(p),y.set(h,v)}}let s=[],a=new Set([...r.keys(),...i.keys()]);for(let c of a){let l=r.get(c)??[],u=i.get(c)??new Map;for(let f of e.getAllShapes()){if(!(f.domain.length===0||f.domain.some(p=>l.some(y=>y===p||t.isSubClassOf(y,p)))))continue;let h=u.get(f.propertyIRI)??[];if(f.minCount!==void 0&&f.minCount>0&&h.length<f.minCount){s.push({focusNode:c,propertyPath:f.propertyIRI,severity:f.severity,message:f.message??`sh:minCount violation: expected at least ${f.minCount} value(s) for <${f.propertyIRI}>`});continue}if(h.length!==0){if(f.cardinality==="Single"&&h.length>1){s.push({focusNode:c,propertyPath:f.propertyIRI,severity:f.severity,message:f.message??`sh:maxCount violation: expected at most 1 value for <${f.propertyIRI}>, got ${h.length}`});continue}if(f.range&&f.range.length>0){for(let p of h)if(p.type==="iri"){let y=r.get(p.value)??[];f.range.some(E=>y.some(b=>b===E||t.isSubClassOf(b,E)))||s.push({focusNode:c,propertyPath:f.propertyIRI,severity:f.severity,message:f.message??`sh:class violation: <${p.value}> does not conform to expected class ${f.range.join(" | ")}`,actualValue:p.value,expectedRange:f.range.join(" | ")})}else if(p.type==="literal"){let y=p.datatype??"http://www.w3.org/2001/XMLSchema#string";f.range.some(E=>E===y)||s.push({focusNode:c,propertyPath:f.propertyIRI,severity:f.severity,message:f.message??`sh:datatype violation: literal "${p.value}" has datatype <${y}>, expected ${f.range.join(" | ")}`,actualValue:p.value,expectedRange:f.range.join(" | ")})}}}}}return s.sort((c,l)=>{let u=c.focusNode.localeCompare(l.focusNode);return u!==0?u:c.propertyPath.localeCompare(l.propertyPath)}),{conforms:!s.some(c=>c.severity==="sh:Violation"),violations:s}}o(CB,"validate")});var VC=S(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.ApplicationErrorHandler=void 0;var zb=_s(),IB=ys(),RB=ka(),Hb=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 zb.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends zb.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 zb.ApplicationError{static{o(this,"UnknownError")}constructor(s,a){super(s,{originalError:a.name,...t}),this.code=IB.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(`
454
+ \u2022 Contact support if the issue persists`}};Ym.ServiceError=Mb});var jC=S(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.ServiceError=ir.ResourceExhaustedError=ir.NotFoundError=ir.PermissionError=ir.StateTransitionError=ir.NetworkError=ir.ValidationError=ir.ApplicationError=ir.ErrorCode=void 0;var mB=ys();Object.defineProperty(ir,"ErrorCode",{enumerable:!0,get:o(function(){return mB.ErrorCode},"get")});var gB=_s();Object.defineProperty(ir,"ApplicationError",{enumerable:!0,get:o(function(){return gB.ApplicationError},"get")});var yB=OC();Object.defineProperty(ir,"ValidationError",{enumerable:!0,get:o(function(){return yB.ValidationError},"get")});var _B=FC();Object.defineProperty(ir,"NetworkError",{enumerable:!0,get:o(function(){return _B.NetworkError},"get")});var SB=DC();Object.defineProperty(ir,"StateTransitionError",{enumerable:!0,get:o(function(){return SB.StateTransitionError},"get")});var vB=NC();Object.defineProperty(ir,"PermissionError",{enumerable:!0,get:o(function(){return vB.PermissionError},"get")});var bB=LC();Object.defineProperty(ir,"NotFoundError",{enumerable:!0,get:o(function(){return bB.NotFoundError},"get")});var wB=kC();Object.defineProperty(ir,"ResourceExhaustedError",{enumerable:!0,get:o(function(){return wB.ResourceExhaustedError},"get")});var EB=MC();Object.defineProperty(ir,"ServiceError",{enumerable:!0,get:o(function(){return EB.ServiceError},"get")})});var $b=S(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.ShapeRegistry=void 0;var jb=class{static{o(this,"ShapeRegistry")}constructor(){this.shapes=new Map}get(e){return this.shapes.get(e)}register(e){this.shapes.set(e.propertyIRI,e)}getAll(){return Array.from(this.shapes.values())}get size(){return this.shapes.size}};Km.ShapeRegistry=jb});var qb=S(Ss=>{"use strict";var TB=Ss&&Ss.__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]})),AB=Ss&&Ss.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Vb=Ss&&Ss.__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"&&TB(t,e,r[i]);return AB(t,e),t}})();Object.defineProperty(Ss,"__esModule",{value:!0});Ss.ShapeLoader=void 0;var Bb=$b(),Cl=Ae(),$C=Ne(),ri=yr(),Xm="http://www.w3.org/ns/shacl#",xB=[["exo__",ri.Namespace.EXO],["ems__",ri.Namespace.EMS],["exocmd__",ri.Namespace.EXOCMD],["ims__",ri.Namespace.IMS],["ztlk__",ri.Namespace.ZTLK],["ptms__",ri.Namespace.PTMS],["lit__",ri.Namespace.LIT],["inbox__",ri.Namespace.INBOX],["pmbok__",ri.Namespace.PMBOK]],Ub=class n{static{o(this,"ShapeLoader")}static async loadFromVaultFS(e){let{readdir:t,readFile:r}=await Promise.resolve().then(()=>Vb(require("fs/promises"))),i=await Promise.resolve().then(()=>Vb(require("path"))),s=new Bb.ShapeRegistry;return await n.scanDir(e,s,{readdir:t,readFile:r,path:i}),s}static async loadFromRDFGraph(e){let t=new Bb.ShapeRegistry,r=ri.Namespace.EXO,i=ri.Namespace.RDFS,s=ri.Namespace.RDF,[a,c]=await Promise.all([e.match(void 0,s.term("type"),r.term("ObjectProperty")),e.match(void 0,s.term("type"),r.term("Property"))]),l=new Set;for(let u of[...a,...c])u.subject instanceof Cl.IRI&&l.add(u.subject.value);for(let u of l){let f=new Cl.IRI(u),[d,h,p,y,v]=await Promise.all([e.match(f,i.term("domain"),void 0),e.match(f,i.term("range"),void 0),e.match(f,r.term("Property_cardinality"),void 0),e.match(f,r.term("Property_severity"),void 0),e.match(f,r.term("Asset_label"),void 0)]);if(d.length===0)continue;let E=v[0]?.object;if(!(E instanceof $C.Literal))continue;let b=n.labelToIRI(E.value);if(!b)continue;let A=d.map(te=>te.object instanceof Cl.IRI?te.object.value:null).filter(te=>te!==null),I=h.map(te=>te.object instanceof Cl.IRI?te.object.value:null).filter(te=>te!==null),j=n.cardinalityFromIRI(p[0]?.object instanceof Cl.IRI?p[0].object.value:void 0),B=n.severityFromValue(y[0]?.object instanceof $C.Literal||y[0]?.object instanceof Cl.IRI?y[0].object.value:void 0);t.register({propertyIRI:b,domain:A,range:I.length>0?I:void 0,cardinality:j,severity:B})}return t}static async loadFromShapeJSON(e){let{readFile:t}=await Promise.resolve().then(()=>Vb(require("fs/promises"))),r=await t(e,"utf-8"),i=JSON.parse(r),s=new Bb.ShapeRegistry;for(let a of Object.values(i.shapes))s.register(a);return s}static async scanDir(e,t,r){let i;try{i=await r.readdir(e,{withFileTypes:!0})}catch{return}for(let s of i){let a=r.path.join(e,s.name);s.isDirectory()?await n.scanDir(a,t,r):s.isFile()&&s.name.endsWith(".md")&&await n.processFile(a,t,r.readFile)}}static async processFile(e,t,r){let i;try{i=await r(e,"utf-8")}catch{return}let s=n.parseFrontmatter(i);if(!s||!n.asArray(s.exo__Instance_class).some(I=>{let j=n.extractWikilinkRef(I);return j==="exo__Property"||j==="exo__ObjectProperty"||j?.includes("|exo__Property")||j?.includes("|exo__ObjectProperty")}))return;let l=s.exo__Asset_label;if(!l||typeof l!="string")return;let u=l.trim(),f=n.labelToIRI(u);if(!f)return;let d=s.exo__Property_domain,h=s.exo__Property_range,p=s.exo__Property_cardinality,y=s.exo__Property_severity,v=n.asArray(d).map(I=>n.wikilinkToIRI(I)).filter(I=>I!==null);if(v.length===0)return;let E=n.asArray(h).map(I=>n.wikilinkToIRI(I)).filter(I=>I!==null),b=n.cardinalityFromLabel(typeof p=="string"?p:void 0),A=n.severityFromValue(typeof y=="string"?y:void 0);t.register({propertyIRI:f,domain:v,range:E.length>0?E:void 0,cardinality:b,severity:A})}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let r=t[1],i={},s=r.split(/\r?\n/),a=null,c=null;for(let l of s){let u=/^ {2}- (.*)$/.exec(l);if(u){a&&c&&c.push(u[1].trim());continue}a&&c&&(i[a]=c,a=null,c=null);let f=/^([^:]+):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(a=d,c=[]):i[d]=h}return a&&c&&(i[a]=c),i}static labelToIRI(e){for(let[t,r]of xB)if(e.startsWith(t))return r.term(e.substring(t.length)).value;return null}static extractWikilinkRef(e){let t=e.replace(/^["']|["']$/g,""),r=/\[\[([^\]]+)\]\]/.exec(t);return r?r[1]:t}static wikilinkToIRI(e){let t=n.extractWikilinkRef(e);if(!t)return null;let r=t.split("|"),i=r.length>1?[r[1],r[0]]:[r[0]];for(let s of i){let a=n.labelToIRI(s.trim());if(a)return a}return t.startsWith("http")?t:t.startsWith("sh:")?Xm+t.substring(3):null}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static cardinalityFromIRI(e){if(e){if(e.endsWith("PropertyCardinalitySingle"))return"Single";if(e.endsWith("PropertyCardinalityMultiple"))return"Multiple"}}static cardinalityFromLabel(e){if(!e)return;let t=n.extractWikilinkRef(e)??e,r=t.split("|").pop()??t;if(r.includes("Single"))return"Single";if(r.includes("Multiple"))return"Multiple"}static severityFromValue(e){return!e||e.includes("Violation")||e===Xm+"Violation"?"sh:Violation":e.includes("Warning")||e===Xm+"Warning"?"sh:Warning":e.includes("Info")||e===Xm+"Info"?"sh:Info":"sh:Violation"}};Ss.ShapeLoader=Ub});var Gb=S(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.ShapeRegistry=void 0;bf.validate=CB;var Wb=class{static{o(this,"ShapeRegistry")}constructor(e=[],t="https://exocortex.my/ontology/exo#Instance_class"){this.shapeMap=new Map(e.map(r=>[r.propertyIRI,r])),this.typePredicateIRI=t}getShape(e){return this.shapeMap.get(e)}getAllShapes(){return Array.from(this.shapeMap.values())}hasShape(e){return this.shapeMap.has(e)}};bf.ShapeRegistry=Wb;function CB(n,e,t,r){let i=new Map,s=new Map;for(let l of n){let{subject:u,predicate:f,object:d}=l;if(u.type!=="iri"||f.type!=="iri"||d.type!=="iri"&&d.type!=="literal")continue;let h=u.value,p=f.value,y=d;if(p===e.typePredicateIRI){if(y.type==="iri"){let v=i.get(h)??[];v.push(y.value),i.set(h,v)}}else{let v=s.get(h);v||(v=new Map,s.set(h,v));let E=v.get(p)??[];E.push(y),v.set(p,E)}}let a=[],c=new Set([...i.keys(),...s.keys()]);for(let l of c){let u=i.get(l)??[],f=s.get(l)??new Map;for(let d of e.getAllShapes()){if(!(d.domain.length===0||d.domain.some(y=>u.some(v=>v===y||t.isSubClassOf(v,y)))))continue;let p=f.get(d.propertyIRI)??[];if(d.minCount!==void 0&&d.minCount>0&&p.length<d.minCount){a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:minCount violation: expected at least ${d.minCount} value(s) for <${d.propertyIRI}>`});continue}if(p.length!==0){if(d.cardinality==="Single"&&p.length>1){a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:maxCount violation: expected at most 1 value for <${d.propertyIRI}>, got ${p.length}`});continue}if(d.range&&d.range.length>0){for(let y of p)if(y.type==="iri"){let v=i.get(y.value)??[];d.range.some(b=>v.some(A=>A===b||t.isSubClassOf(A,b)))||a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:class violation: <${y.value}> does not conform to expected class ${d.range.join(" | ")}`,actualValue:y.value,expectedRange:d.range.join(" | ")})}else if(y.type==="literal"){let v=y.datatype??"http://www.w3.org/2001/XMLSchema#string";d.range.some(b=>b===v)||a.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,message:d.message??`sh:datatype violation: literal "${y.value}" has datatype <${v}>, expected ${d.range.join(" | ")}`,actualValue:y.value,expectedRange:d.range.join(" | ")})}}}}}if(r?.closedWorldMode)for(let l of c){let u=s.get(l)??new Map;for(let f of u.keys())e.hasShape(f)||a.push({focusNode:l,propertyPath:f,severity:"sh:Warning",message:`Unknown property: <${f}> has no registered shape`})}return a.sort((l,u)=>{let f=l.focusNode.localeCompare(u.focusNode);return f!==0?f:l.propertyPath.localeCompare(u.propertyPath)}),{conforms:!a.some(l=>l.severity==="sh:Violation"),violations:a}}o(CB,"validate")});var VC=S(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.ApplicationErrorHandler=void 0;var zb=_s(),IB=ys(),RB=ka(),Hb=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 zb.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends zb.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 zb.ApplicationError{static{o(this,"UnknownError")}constructor(s,a){super(s,{originalError:a.name,...t}),this.code=IB.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
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){RB.LoggingService.error("Error in telemetry hook",i instanceof Error?i:new Error(String(i)))}}};Jm.ApplicationErrorHandler=Hb});var BC=S(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});Zm.ApplicationErrorHandler=void 0;var PB=VC();Object.defineProperty(Zm,"ApplicationErrorHandler",{enumerable:!0,get:o(function(){return PB.ApplicationErrorHandler},"get")})});var Yb=S(eg=>{"use strict";Object.defineProperty(eg,"__esModule",{value:!0});eg.ClassHierarchy=void 0;var OB="http://www.w3.org/2000/01/rdf-schema#subClassOf",Qb=class{static{o(this,"ClassHierarchy")}constructor(e){this.adjacency=new Map;for(let t of e){if(t.predicate.type!=="iri"||t.predicate.value!==OB||t.subject.type!=="iri"||t.object.type!=="iri")continue;let r=t.subject.value,i=t.object.value,s=this.adjacency.get(r);s||(s=new Set,this.adjacency.set(r,s)),s.add(i)}}isSubClassOf(e,t){if(e===t)return!0;let r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(r.has(s))continue;r.add(s);let a=this.adjacency.get(s);if(a)for(let c of a){if(c===t)return!0;r.has(c)||i.push(c)}}return!1}getAncestors(e){let t=new Set,r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(r.has(s))continue;r.add(s);let a=this.adjacency.get(s);if(a)for(let c of a)t.add(c),r.has(c)||i.push(c)}return t}};eg.ClassHierarchy=Qb});var qC=S(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.ValidatorDaemon=vs.IDLE_TIMEOUT_MS=vs.DEFAULT_SOCKET_PATH=void 0;var UC=Gb(),FB=qb(),DB=Yb();vs.DEFAULT_SOCKET_PATH=`${process.env.HOME??process.env.USERPROFILE??"/tmp"}/.cache/exocortex/validator.sock`;vs.IDLE_TIMEOUT_MS=300*1e3;var Kb=class{static{o(this,"ValidatorDaemon")}constructor(e=vs.DEFAULT_SOCKET_PATH,t=vs.IDLE_TIMEOUT_MS){this.registryCache=new Map,this.server=null,this.idleTimer=null,this.socketPath=e,this.idleTimeoutMs=t}async start(){let e=require("net"),t=require("fs/promises"),r=require("path");await t.mkdir(r.dirname(this.socketPath),{recursive:!0});try{await t.unlink(this.socketPath)}catch{}this.server=e.createServer(a=>{this.handleConnection(a)});let i=this.server;await new Promise((a,c)=>{i.on("error",c),i.listen(this.socketPath,a)}),this.resetIdleTimer();let s=o(()=>{this.stop()},"handleSignal");process.once("SIGTERM",s),process.once("SIGINT",s)}async stop(){if(this.idleTimer!==null&&(clearTimeout(this.idleTimer),this.idleTimer=null),!this.server)return;let e=this.server;this.server=null,await new Promise(t=>{e.close(()=>t())})}resetIdleTimer(){this.idleTimer!==null&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{process.exit(0)},this.idleTimeoutMs)}handleConnection(e){let t="";e.setEncoding("utf-8"),e.on("data",r=>{t+=r;let i=t.split(`
456
- `);t=i.pop()??"";for(let s of i){let a=s.trim();a&&this.handleRequest(a,e)}}),e.on("error",()=>{e.destroy()})}async handleRequest(e,t){this.resetIdleTimer();let r;try{let i=JSON.parse(e),s=await this.getRegistry(i.registryPath),a=new DB.ClassHierarchy(i.subclassTriples??[]);r={report:(0,UC.validate)(i.triples,s,a)}}catch(i){r={error:i instanceof Error?i.message:String(i)}}t.destroyed||t.write(JSON.stringify(r)+`
457
- `)}async getRegistry(e){let t=this.registryCache.get(e);if(t)return t;let r=await FB.ShapeLoader.loadFromShapeJSON(e),i=new UC.ShapeRegistry(r.getAll());return this.registryCache.set(e,i),i}};vs.ValidatorDaemon=Kb});var Dt=S(m=>{"use strict";var NB=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]})),ni=m&&m.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&NB(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.InMemoryTripleStore=m.OBSIDIAN_VAULT_SCHEME=m.vaultPathToIRI=m.NullLogger=m.RDFSerializer=m.FilenameValidator=m.EffortSortingHelpers=m.MetadataExtractor=m.MetadataHelpers=m.WikiLinkHelpers=m.DateFormatter=m.FrontmatterService=m.CriticalityZoneUUIDs=m.CriticalityZoneService=m.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.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=m.RDFSInferenceEngine=m.RDFVocabularyMapper=m.DomainTriple=m.DomainBlankNode=m.DomainLiteral=m.DomainIRI=void 0;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=m.VaultPrefixTransformer=m.CaseWhenTransformerError=m.CaseWhenTransformer=m.ResultSerializer=m.createIncrementalIndexer=m.IncrementalIndexer=void 0;m.TripleClassHierarchy=m.IDLE_TIMEOUT_MS=m.DEFAULT_SOCKET_PATH=m.ValidatorDaemon=m.ShaclShapeRegistry=m.shaclValidate=m.ShapeRegistry=m.ShapeLoader=m.selectByPriority=m.LayoutSelector=m.isPropertiesBlock=m.isLayoutBlockFrontmatter=m.isBacklinksTableBlock=void 0;ni(Ru(),m);ni(bc(),m);var qa=a0();Object.defineProperty(m,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return qa.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(m,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return qa.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(m,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return qa.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(m,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return qa.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(m,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return qa.normalizeEffortStatus},"get")});Object.defineProperty(m,"isDoneStatus",{enumerable:!0,get:o(function(){return qa.isDoneStatus},"get")});Object.defineProperty(m,"isTrashedStatus",{enumerable:!0,get:o(function(){return qa.isTrashedStatus},"get")});Object.defineProperty(m,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return qa.getEffortStatusLabel},"get")});var LB=wc();Object.defineProperty(m,"GroundingType",{enumerable:!0,get:o(function(){return LB.GroundingType},"get")});var wf=o0();Object.defineProperty(m,"CommandProperty",{enumerable:!0,get:o(function(){return wf.CommandProperty},"get")});Object.defineProperty(m,"PreconditionProperty",{enumerable:!0,get:o(function(){return wf.PreconditionProperty},"get")});Object.defineProperty(m,"GroundingProperty",{enumerable:!0,get:o(function(){return wf.GroundingProperty},"get")});Object.defineProperty(m,"CommandBindingProperty",{enumerable:!0,get:o(function(){return wf.CommandBindingProperty},"get")});Object.defineProperty(m,"CommandBindingStyleProperty",{enumerable:!0,get:o(function(){return wf.CommandBindingStyleProperty},"get")});var Il=c0();Object.defineProperty(m,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:o(function(){return Il.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(m,"LABEL_CLASS_VALUES",{enumerable:!0,get:o(function(){return Il.LABEL_CLASS_VALUES},"get")});Object.defineProperty(m,"STYLE_SOURCE_VALUES",{enumerable:!0,get:o(function(){return Il.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(m,"isCommandVariant",{enumerable:!0,get:o(function(){return Il.isCommandVariant},"get")});Object.defineProperty(m,"isLabelClass",{enumerable:!0,get:o(function(){return Il.isLabelClass},"get")});Object.defineProperty(m,"isStyleSource",{enumerable:!0,get:o(function(){return Il.isStyleSource},"get")});var tg=rT();Object.defineProperty(m,"isCommandFrontmatter",{enumerable:!0,get:o(function(){return tg.isCommandFrontmatter},"get")});Object.defineProperty(m,"isPreconditionFrontmatter",{enumerable:!0,get:o(function(){return tg.isPreconditionFrontmatter},"get")});Object.defineProperty(m,"isGroundingFrontmatter",{enumerable:!0,get:o(function(){return tg.isGroundingFrontmatter},"get")});Object.defineProperty(m,"isCommandBindingFrontmatter",{enumerable:!0,get:o(function(){return tg.isCommandBindingFrontmatter},"get")});ni(nT(),m);ni(iT(),m);ni(l0(),m);ni(u0(),m);ni(aT(),m);ni(lT(),m);ni(G0(),m);ni(XT(),m);var WC=Eh();Object.defineProperty(m,"PropertyFieldType",{enumerable:!0,get:o(function(){return WC.PropertyFieldType},"get")});Object.defineProperty(m,"rangeToFieldType",{enumerable:!0,get:o(function(){return WC.rangeToFieldType},"get")});var Xb=Y0();Object.defineProperty(m,"propertyNameToUri",{enumerable:!0,get:o(function(){return Xb.propertyNameToUri},"get")});Object.defineProperty(m,"uriToPropertyName",{enumerable:!0,get:o(function(){return Xb.uriToPropertyName},"get")});Object.defineProperty(m,"extractPropertyLabel",{enumerable:!0,get:o(function(){return Xb.extractPropertyLabel},"get")});var kB=x3();Object.defineProperty(m,"CommandResolver",{enumerable:!0,get:o(function(){return kB.CommandResolver},"get")});var MB=I3();Object.defineProperty(m,"PreconditionEvaluator",{enumerable:!0,get:o(function(){return MB.PreconditionEvaluator},"get")});var GC=P3();Object.defineProperty(m,"GroundingExecutor",{enumerable:!0,get:o(function(){return GC.GroundingExecutor},"get")});Object.defineProperty(m,"ServiceRegistry",{enumerable:!0,get:o(function(){return GC.ServiceRegistry},"get")});var jB=yS();Object.defineProperty(m,"TaskStatusService",{enumerable:!0,get:o(function(){return jB.TaskStatusService},"get")});var $B=bS();Object.defineProperty(m,"AreaCreationService",{enumerable:!0,get:o(function(){return $B.AreaCreationService},"get")});var VB=ES();Object.defineProperty(m,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return VB.AreaHierarchyBuilder},"get")});var BB=AS();Object.defineProperty(m,"ClassCreationService",{enumerable:!0,get:o(function(){return BB.ClassCreationService},"get")});var UB=CS();Object.defineProperty(m,"ConceptCreationService",{enumerable:!0,get:o(function(){return UB.ConceptCreationService},"get")});var qB=tm();Object.defineProperty(m,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return qB.EffortStatusWorkflow},"get")});var WB=af();Object.defineProperty(m,"WorkflowEngine",{enumerable:!0,get:o(function(){return WB.WorkflowEngine},"get")});var GB=sS();Object.defineProperty(m,"WorkflowResolver",{enumerable:!0,get:o(function(){return GB.WorkflowResolver},"get")});var zB=W3();Object.defineProperty(m,"InstantiationRuleResolver",{enumerable:!0,get:o(function(){return zB.InstantiationRuleResolver},"get")});var HB=G3();Object.defineProperty(m,"VisibilityGenerator",{enumerable:!0,get:o(function(){return HB.VisibilityGenerator},"get")});var QB=z3();Object.defineProperty(m,"WorkflowCommandAdapter",{enumerable:!0,get:o(function(){return QB.WorkflowCommandAdapter},"get")});var YB=NS();Object.defineProperty(m,"EffortVotingService",{enumerable:!0,get:o(function(){return YB.EffortVotingService},"get")});var KB=kS();Object.defineProperty(m,"FolderRepairService",{enumerable:!0,get:o(function(){return KB.FolderRepairService},"get")});var XB=jS();Object.defineProperty(m,"LabelToAliasService",{enumerable:!0,get:o(function(){return XB.LabelToAliasService},"get")});var JB=ka();Object.defineProperty(m,"LoggingService",{enumerable:!0,get:o(function(){return JB.LoggingService},"get")});var ZB=BS();Object.defineProperty(m,"PropertyCleanupService",{enumerable:!0,get:o(function(){return ZB.PropertyCleanupService},"get")});var eU=qS();Object.defineProperty(m,"RenameToUidService",{enumerable:!0,get:o(function(){return eU.RenameToUidService},"get")});var tU=nm();Object.defineProperty(m,"StatusTimestampService",{enumerable:!0,get:o(function(){return tU.StatusTimestampService},"get")});var rU=zS();Object.defineProperty(m,"SupervisionCreationService",{enumerable:!0,get:o(function(){return rU.SupervisionCreationService},"get")});var nU=YS();Object.defineProperty(m,"FleetingNoteCreationService",{enumerable:!0,get:o(function(){return nU.FleetingNoteCreationService},"get")});var iU=XS();Object.defineProperty(m,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return iU.DynamicFrontmatterGenerator},"get")});var sU=ZS();Object.defineProperty(m,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return sU.AlgorithmExtractor},"get")});var aU=tv();Object.defineProperty(m,"PlanningService",{enumerable:!0,get:o(function(){return aU.PlanningService},"get")});var oU=sx();Object.defineProperty(m,"PropertySchemaResolver",{enumerable:!0,get:o(function(){return oU.PropertySchemaResolver},"get")});var cU=ax();Object.defineProperty(m,"ClassHierarchyResolver",{enumerable:!0,get:o(function(){return cU.ClassHierarchyResolver},"get")});var lU=ox();Object.defineProperty(m,"EnumValueResolver",{enumerable:!0,get:o(function(){return lU.EnumValueResolver},"get")});var uU=av();Object.defineProperty(m,"AssetConversionService",{enumerable:!0,get:o(function(){return uU.AssetConversionService},"get")});var fU=lv();Object.defineProperty(m,"SessionEventService",{enumerable:!0,get:o(function(){return fU.SessionEventService},"get")});var dU=dv();Object.defineProperty(m,"URIConstructionService",{enumerable:!0,get:o(function(){return dU.URIConstructionService},"get")});var hU=pv();Object.defineProperty(m,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return hU.GenericAssetCreationService},"get")});var pU=yx();Object.defineProperty(m,"ArchiveAssetService",{enumerable:!0,get:o(function(){return pU.ArchiveAssetService},"get")});var mU=Sx();Object.defineProperty(m,"FixMissingLabelService",{enumerable:!0,get:o(function(){return mU.FixMissingLabelService},"get")});var gU=vx();Object.defineProperty(m,"GraphQueryService",{enumerable:!0,get:o(function(){return gU.GraphQueryService},"get")});var yU=wx();Object.defineProperty(m,"TypeRegistry",{enumerable:!0,get:o(function(){return yU.TypeRegistry},"get")});var zC=Ex();Object.defineProperty(m,"NLToSPARQLService",{enumerable:!0,get:o(function(){return zC.NLToSPARQLService},"get")});Object.defineProperty(m,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return zC.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var ii=Sv();Object.defineProperty(m,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return ii.SPARQL_TEMPLATES},"get")});Object.defineProperty(m,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return ii.SPARQL_PREFIXES},"get")});Object.defineProperty(m,"PREDICATES",{enumerable:!0,get:o(function(){return ii.PREDICATES},"get")});Object.defineProperty(m,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return ii.ASSET_CLASSES},"get")});Object.defineProperty(m,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return ii.EFFORT_STATUSES},"get")});Object.defineProperty(m,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return ii.KNOWN_PROTOTYPES},"get")});Object.defineProperty(m,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return ii.KNOWN_CLASSES},"get")});Object.defineProperty(m,"findClassByTerm",{enumerable:!0,get:o(function(){return ii.findClassByTerm},"get")});Object.defineProperty(m,"findMatchingTemplates",{enumerable:!0,get:o(function(){return ii.findMatchingTemplates},"get")});Object.defineProperty(m,"fillTemplate",{enumerable:!0,get:o(function(){return ii.fillTemplate},"get")});Object.defineProperty(m,"validateParameters",{enumerable:!0,get:o(function(){return ii.validateParameters},"get")});Object.defineProperty(m,"getTemplateByName",{enumerable:!0,get:o(function(){return ii.getTemplateByName},"get")});var _U=Ax();Object.defineProperty(m,"AnalyticsService",{enumerable:!0,get:o(function(){return _U.AnalyticsService},"get")});var SU=xx();Object.defineProperty(m,"TrendDetectionService",{enumerable:!0,get:o(function(){return SU.TrendDetectionService},"get")});var HC=Ix();Object.defineProperty(m,"AutocompleteService",{enumerable:!0,get:o(function(){return HC.AutocompleteService},"get")});Object.defineProperty(m,"DEFAULT_AUTOCOMPLETE_CONFIG",{enumerable:!0,get:o(function(){return HC.DEFAULT_AUTOCOMPLETE_CONFIG},"get")});var vU=Px();Object.defineProperty(m,"DailyReviewService",{enumerable:!0,get:o(function(){return vU.DailyReviewService},"get")});var QC=xv();Object.defineProperty(m,"CriticalityZoneService",{enumerable:!0,get:o(function(){return QC.CriticalityZoneService},"get")});Object.defineProperty(m,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return QC.CriticalityZoneUUIDs},"get")});var bU=Jn();Object.defineProperty(m,"FrontmatterService",{enumerable:!0,get:o(function(){return bU.FrontmatterService},"get")});var wU=Hr();Object.defineProperty(m,"DateFormatter",{enumerable:!0,get:o(function(){return wU.DateFormatter},"get")});var EU=Us();Object.defineProperty(m,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return EU.WikiLinkHelpers},"get")});var TU=ds();Object.defineProperty(m,"MetadataHelpers",{enumerable:!0,get:o(function(){return TU.MetadataHelpers},"get")});var AU=SS();Object.defineProperty(m,"MetadataExtractor",{enumerable:!0,get:o(function(){return AU.MetadataExtractor},"get")});var xU=Fx();Object.defineProperty(m,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return xU.EffortSortingHelpers},"get")});var CU=Dx();Object.defineProperty(m,"FilenameValidator",{enumerable:!0,get:o(function(){return CU.FilenameValidator},"get")});var IU=Vx();Object.defineProperty(m,"RDFSerializer",{enumerable:!0,get:o(function(){return IU.RDFSerializer},"get")});var RU=Ic();Object.defineProperty(m,"NullLogger",{enumerable:!0,get:o(function(){return RU.NullLogger},"get")});var YC=jv();Object.defineProperty(m,"vaultPathToIRI",{enumerable:!0,get:o(function(){return YC.vaultPathToIRI},"get")});Object.defineProperty(m,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:o(function(){return YC.OBSIDIAN_VAULT_SCHEME},"get")});var PU=hS();Object.defineProperty(m,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return PU.InMemoryTripleStore},"get")});var OU=Ae();Object.defineProperty(m,"DomainIRI",{enumerable:!0,get:o(function(){return OU.IRI},"get")});var FU=Ne();Object.defineProperty(m,"DomainLiteral",{enumerable:!0,get:o(function(){return FU.Literal},"get")});var DU=qt();Object.defineProperty(m,"DomainBlankNode",{enumerable:!0,get:o(function(){return DU.BlankNode},"get")});var NU=Qn();Object.defineProperty(m,"DomainTriple",{enumerable:!0,get:o(function(){return NU.Triple},"get")});var LU=Vv();Object.defineProperty(m,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return LU.RDFVocabularyMapper},"get")});var kU=Ux();Object.defineProperty(m,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return kU.RDFSInferenceEngine},"get")});var MU=Wv();Object.defineProperty(m,"NonInheritablePropertyRegistry",{enumerable:!0,get:o(function(){return MU.NonInheritablePropertyRegistry},"get")});var jU=Hv();Object.defineProperty(m,"PropertyCardinalityRegistry",{enumerable:!0,get:o(function(){return jU.PropertyCardinalityRegistry},"get")});var KC=Kv();Object.defineProperty(m,"PrototypeChainMaterializer",{enumerable:!0,get:o(function(){return KC.PrototypeChainMaterializer},"get")});Object.defineProperty(m,"INFERRED_GRAPH",{enumerable:!0,get:o(function(){return KC.INFERRED_GRAPH},"get")});var XC=Jv();Object.defineProperty(m,"SourceAnnotator",{enumerable:!0,get:o(function(){return XC.SourceAnnotator},"get")});Object.defineProperty(m,"SOURCE_VARIABLE",{enumerable:!0,get:o(function(){return XC.SOURCE_VARIABLE},"get")});var $U=eb();Object.defineProperty(m,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return $U.NoteToRDFConverter},"get")});var Jb=jc();Object.defineProperty(m,"ExoQLParser",{enumerable:!0,get:o(function(){return Jb.ExoQLParser},"get")});Object.defineProperty(m,"SPARQLParser",{enumerable:!0,get:o(function(){return Jb.SPARQLParser},"get")});Object.defineProperty(m,"SPARQLParseError",{enumerable:!0,get:o(function(){return Jb.SPARQLParseError},"get")});var JC=H_();Object.defineProperty(m,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return JC.DescribeOptionsTransformer},"get")});Object.defineProperty(m,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return JC.DescribeOptionsTransformerError},"get")});var ZC=Vc();Object.defineProperty(m,"ExoQLAlgebraTranslator",{enumerable:!0,get:o(function(){return ZC.ExoQLAlgebraTranslator},"get")});Object.defineProperty(m,"AlgebraTranslator",{enumerable:!0,get:o(function(){return ZC.AlgebraTranslator},"get")});var VU=Jx();Object.defineProperty(m,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return VU.AlgebraOptimizer},"get")});var BU=Zx();Object.defineProperty(m,"AlgebraSerializer",{enumerable:!0,get:o(function(){return BU.AlgebraSerializer},"get")});var UU=f1();Object.defineProperty(m,"BGPExecutor",{enumerable:!0,get:o(function(){return UU.BGPExecutor},"get")});var qU=Op();Object.defineProperty(m,"FilterExecutor",{enumerable:!0,get:o(function(){return qU.FilterExecutor},"get")});var WU=R1();Object.defineProperty(m,"OptionalExecutor",{enumerable:!0,get:o(function(){return WU.OptionalExecutor},"get")});var GU=O1();Object.defineProperty(m,"UnionExecutor",{enumerable:!0,get:o(function(){return GU.UnionExecutor},"get")});var zU=B1();Object.defineProperty(m,"ConstructExecutor",{enumerable:!0,get:o(function(){return zU.ConstructExecutor},"get")});var HU=tC();Object.defineProperty(m,"DescribeExecutor",{enumerable:!0,get:o(function(){return HU.DescribeExecutor},"get")});var eI=al();Object.defineProperty(m,"ExoQLQueryExecutor",{enumerable:!0,get:o(function(){return eI.ExoQLQueryExecutor},"get")});Object.defineProperty(m,"QueryExecutor",{enumerable:!0,get:o(function(){return eI.QueryExecutor},"get")});var tI=nC();Object.defineProperty(m,"UpdateExecutor",{enumerable:!0,get:o(function(){return tI.UpdateExecutor},"get")});Object.defineProperty(m,"UpdateExecutorError",{enumerable:!0,get:o(function(){return tI.UpdateExecutorError},"get")});var QU=cs();Object.defineProperty(m,"SolutionMapping",{enumerable:!0,get:o(function(){return QU.SolutionMapping},"get")});var YU=Pp();Object.defineProperty(m,"BuiltInFunctions",{enumerable:!0,get:o(function(){return YU.BuiltInFunctions},"get")});var KU=sC();Object.defineProperty(m,"AggregateFunctions",{enumerable:!0,get:o(function(){return KU.AggregateFunctions},"get")});var rI=N1();Object.defineProperty(m,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return rI.CustomAggregateRegistry},"get")});Object.defineProperty(m,"CustomAggregateError",{enumerable:!0,get:o(function(){return rI.CustomAggregateError},"get")});var bs=L1();Object.defineProperty(m,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return bs.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(m,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return bs.EXO_AGGREGATE_NS},"get")});Object.defineProperty(m,"medianAggregate",{enumerable:!0,get:o(function(){return bs.medianAggregate},"get")});Object.defineProperty(m,"varianceAggregate",{enumerable:!0,get:o(function(){return bs.varianceAggregate},"get")});Object.defineProperty(m,"stddevAggregate",{enumerable:!0,get:o(function(){return bs.stddevAggregate},"get")});Object.defineProperty(m,"modeAggregate",{enumerable:!0,get:o(function(){return bs.modeAggregate},"get")});Object.defineProperty(m,"createPercentileAggregate",{enumerable:!0,get:o(function(){return bs.createPercentileAggregate},"get")});Object.defineProperty(m,"getNumericValue",{enumerable:!0,get:o(function(){return bs.getNumericValue},"get")});Object.defineProperty(m,"createDecimalLiteral",{enumerable:!0,get:o(function(){return bs.createDecimalLiteral},"get")});Object.defineProperty(m,"createDoubleLiteral",{enumerable:!0,get:o(function(){return bs.createDoubleLiteral},"get")});var XU=aC();Object.defineProperty(m,"QueryPlanCache",{enumerable:!0,get:o(function(){return XU.QueryPlanCache},"get")});var nI=oC();Object.defineProperty(m,"SPARQLResultCache",{enumerable:!0,get:o(function(){return nI.SPARQLResultCache},"get")});Object.defineProperty(m,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return nI.createSPARQLResultCache},"get")});var iI=cC();Object.defineProperty(m,"IncrementalIndexer",{enumerable:!0,get:o(function(){return iI.IncrementalIndexer},"get")});Object.defineProperty(m,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return iI.createIncrementalIndexer},"get")});var JU=lC();Object.defineProperty(m,"ResultSerializer",{enumerable:!0,get:o(function(){return JU.ResultSerializer},"get")});var sI=W_();Object.defineProperty(m,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return sI.CaseWhenTransformer},"get")});Object.defineProperty(m,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return sI.CaseWhenTransformerError},"get")});var ZU=X_();Object.defineProperty(m,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return ZU.VaultPrefixTransformer},"get")});var eq=rb();Object.defineProperty(m,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return eq.FilterContainsOptimizer},"get")});var aI=uC();Object.defineProperty(m,"FileNotFoundError",{enumerable:!0,get:o(function(){return aI.FileNotFoundError},"get")});Object.defineProperty(m,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return aI.FileAlreadyExistsError},"get")});var Zb=lS();Object.defineProperty(m,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return Zb.TripleAlreadyExistsError},"get")});Object.defineProperty(m,"TripleNotFoundError",{enumerable:!0,get:o(function(){return Zb.TripleNotFoundError},"get")});Object.defineProperty(m,"TransactionError",{enumerable:!0,get:o(function(){return Zb.TransactionError},"get")});var rg=mb();Object.defineProperty(m,"VaultSettings",{enumerable:!0,get:o(function(){return rg.VaultSettings},"get")});Object.defineProperty(m,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:o(function(){return rg.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(m,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:o(function(){return rg.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(m,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:o(function(){return rg.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var tq=wt();Object.defineProperty(m,"DI_TOKENS",{enumerable:!0,get:o(function(){return tq.DI_TOKENS},"get")});var Ef=fC();Object.defineProperty(m,"registerCoreServices",{enumerable:!0,get:o(function(){return Ef.registerCoreServices},"get")});Object.defineProperty(m,"createChildContainer",{enumerable:!0,get:o(function(){return Ef.createChildContainer},"get")});Object.defineProperty(m,"getContainer",{enumerable:!0,get:o(function(){return Ef.getContainer},"get")});Object.defineProperty(m,"resetContainer",{enumerable:!0,get:o(function(){return Ef.resetContainer},"get")});Object.defineProperty(m,"container",{enumerable:!0,get:o(function(){return Ef.container},"get")});var ca=yC();Object.defineProperty(m,"NODE_FLAGS",{enumerable:!0,get:o(function(){return ca.NODE_FLAGS},"get")});Object.defineProperty(m,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return ca.DEFAULT_COLORS},"get")});Object.defineProperty(m,"StringTable",{enumerable:!0,get:o(function(){return ca.StringTable},"get")});Object.defineProperty(m,"CompactGraphStore",{enumerable:!0,get:o(function(){return ca.CompactGraphStore},"get")});Object.defineProperty(m,"MemoryPool",{enumerable:!0,get:o(function(){return ca.MemoryPool},"get")});Object.defineProperty(m,"getGlobalPool",{enumerable:!0,get:o(function(){return ca.getGlobalPool},"get")});Object.defineProperty(m,"resetGlobalPool",{enumerable:!0,get:o(function(){return ca.resetGlobalPool},"get")});Object.defineProperty(m,"StreamingLoader",{enumerable:!0,get:o(function(){return ca.StreamingLoader},"get")});Object.defineProperty(m,"createStreamingSource",{enumerable:!0,get:o(function(){return ca.createStreamingSource},"get")});var oI=_C();Object.defineProperty(m,"ExoQL",{enumerable:!0,get:o(function(){return oI.ExoQL},"get")});Object.defineProperty(m,"ExoQLError",{enumerable:!0,get:o(function(){return oI.ExoQLError},"get")});var Rl=jm();Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_IRI",{enumerable:!0,get:o(function(){return Rl.RELATION_COLUMN_SET_CLASS_IRI},"get")});Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_UID",{enumerable:!0,get:o(function(){return Rl.RELATION_COLUMN_SET_CLASS_UID},"get")});Object.defineProperty(m,"createRelationColumnSetFromFrontmatter",{enumerable:!0,get:o(function(){return Rl.createRelationColumnSetFromFrontmatter},"get")});Object.defineProperty(m,"isRelationColumnSet",{enumerable:!0,get:o(function(){return Rl.isRelationColumnSet},"get")});Object.defineProperty(m,"isRelationColumnSetFrontmatter",{enumerable:!0,get:o(function(){return Rl.isRelationColumnSetFrontmatter},"get")});Object.defineProperty(m,"normalizeRelationColumnSetRef",{enumerable:!0,get:o(function(){return Rl.normalizeRef},"get")});var rq=CC();Object.defineProperty(m,"RelationColumnSetResolver",{enumerable:!0,get:o(function(){return rq.RelationColumnSetResolver},"get")});var Tf=jm();Object.defineProperty(m,"LAYOUT_CLASS_IRI",{enumerable:!0,get:o(function(){return Tf.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(m,"LAYOUT_CLASS_UID",{enumerable:!0,get:o(function(){return Tf.LAYOUT_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutFromFrontmatter",{enumerable:!0,get:o(function(){return Tf.createLayoutFromFrontmatter},"get")});Object.defineProperty(m,"isLayout",{enumerable:!0,get:o(function(){return Tf.isLayout},"get")});Object.defineProperty(m,"isLayoutFrontmatter",{enumerable:!0,get:o(function(){return Tf.isLayoutFrontmatter},"get")});var Wa=jm();Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Wa.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Wa.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Wa.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Wa.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:o(function(){return Wa.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(m,"isBacklinksTableBlock",{enumerable:!0,get:o(function(){return Wa.isBacklinksTableBlock},"get")});Object.defineProperty(m,"isLayoutBlockFrontmatter",{enumerable:!0,get:o(function(){return Wa.isLayoutBlockFrontmatter},"get")});Object.defineProperty(m,"isPropertiesBlock",{enumerable:!0,get:o(function(){return Wa.isPropertiesBlock},"get")});var cI=RC();Object.defineProperty(m,"LayoutSelector",{enumerable:!0,get:o(function(){return cI.LayoutSelector},"get")});Object.defineProperty(m,"selectByPriority",{enumerable:!0,get:o(function(){return cI.selectByPriority},"get")});ni(jC(),m);var nq=qb();Object.defineProperty(m,"ShapeLoader",{enumerable:!0,get:o(function(){return nq.ShapeLoader},"get")});var iq=$b();Object.defineProperty(m,"ShapeRegistry",{enumerable:!0,get:o(function(){return iq.ShapeRegistry},"get")});var lI=Gb();Object.defineProperty(m,"shaclValidate",{enumerable:!0,get:o(function(){return lI.validate},"get")});Object.defineProperty(m,"ShaclShapeRegistry",{enumerable:!0,get:o(function(){return lI.ShapeRegistry},"get")});ni(BC(),m);var ew=qC();Object.defineProperty(m,"ValidatorDaemon",{enumerable:!0,get:o(function(){return ew.ValidatorDaemon},"get")});Object.defineProperty(m,"DEFAULT_SOCKET_PATH",{enumerable:!0,get:o(function(){return ew.DEFAULT_SOCKET_PATH},"get")});Object.defineProperty(m,"IDLE_TIMEOUT_MS",{enumerable:!0,get:o(function(){return ew.IDLE_TIMEOUT_MS},"get")});var sq=Yb();Object.defineProperty(m,"TripleClassHierarchy",{enumerable:!0,get:o(function(){return sq.ClassHierarchy},"get")})});var br=S(tw=>{"use strict";tw.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})};tw.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 fI=S((Ace,uI)=>{var Ga=require("constants"),aq=process.cwd,ng=null,oq=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ng||(ng=aq.call(process)),ng};try{process.cwd()}catch{}typeof process.chdir=="function"&&(rw=process.chdir,process.chdir=function(n){ng=null,rw.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,rw));var rw;uI.exports=cq;function cq(n){Ga.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(){}),oq==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function d(h,p,y){var v=Date.now(),E=0;f(h,p,o(function b(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-v<6e4){setTimeout(function(){n.stat(p,function(I,j){I&&I.code==="ENOENT"?f(h,p,b):y(A)})},E),E<100&&(E+=10);return}y&&y(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,y,v,E,b){var A;if(b&&typeof b=="function"){var I=0;A=o(function(j,B,te){if(j&&j.code==="EAGAIN"&&I<10)return I++,f.call(n,h,p,y,v,E,A);b.apply(this,arguments)},"callback")}return f.call(n,h,p,y,v,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,y,v){for(var E=0;;)try{return f.call(n,d,h,p,y,v)}catch(b){if(b.code==="EAGAIN"&&E<10){E++;continue}throw b}}})(n.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,Ga.O_WRONLY|Ga.O_SYMLINK,h,function(y,v){if(y){p&&p(y);return}f.fchmod(v,h,function(E){f.close(v,function(b){p&&p(E||b)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,Ga.O_WRONLY|Ga.O_SYMLINK,h),y=!0,v;try{v=f.fchmodSync(p,h),y=!1}finally{if(y)try{f.closeSync(p)}catch{}else f.closeSync(p)}return v}}o(e,"patchLchmod");function t(f){Ga.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,y){f.open(d,Ga.O_SYMLINK,function(v,E){if(v){y&&y(v);return}f.futimes(E,h,p,function(b){f.close(E,function(A){y&&y(b||A)})})})},f.lutimesSync=function(d,h,p){var y=f.openSync(d,Ga.O_SYMLINK),v,E=!0;try{v=f.futimesSync(y,h,p),E=!1}finally{if(E)try{f.closeSync(y)}catch{}else f.closeSync(y)}return v}):f.futimes&&(f.lutimes=function(d,h,p,y){y&&process.nextTick(y)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(d,h,p){return f.call(n,d,h,function(y){u(y)&&(y=null),p&&p.apply(this,arguments)})}}o(r,"chmodFix");function i(f){return f&&function(d,h){try{return f.call(n,d,h)}catch(p){if(!u(p))throw p}}}o(i,"chmodFixSync");function s(f){return f&&function(d,h,p,y){return f.call(n,d,h,p,function(v){u(v)&&(v=null),y&&y.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(d,h,p){try{return f.call(n,d,h,p)}catch(y){if(!u(y))throw y}}}o(a,"chownFixSync");function c(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function y(v,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),p&&p.apply(this,arguments)}return o(y,"callback"),h?f.call(n,d,h,y):f.call(n,d,y)}}o(c,"statFix");function l(f){return f&&function(d,h){var p=h?f.call(n,d,h):f.call(n,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}o(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}o(u,"chownErOk")}o(cq,"patch")});var pI=S((Cce,hI)=>{var dI=require("stream").Stream;hI.exports=lq;function lq(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);dI.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);dI.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(lq,"legacy")});var gI=S((Rce,mI)=>{"use strict";mI.exports=fq;var uq=Object.getPrototypeOf||function(n){return n.__proto__};function fq(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:uq(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(fq,"clone")});var Ol=S((Oce,sw)=>{var Vt=require("fs"),dq=fI(),hq=pI(),pq=gI(),ig=require("util"),Mr,ag;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Mr=Symbol.for("graceful-fs.queue"),ag=Symbol.for("graceful-fs.previous")):(Mr="___graceful-fs.queue",ag="___graceful-fs.previous");function mq(){}o(mq,"noop");function SI(n,e){Object.defineProperty(n,Mr,{get:o(function(){return e},"get")})}o(SI,"publishQueue");var Yo=mq;ig.debuglog?Yo=ig.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Yo=o(function(){var n=ig.format.apply(ig,arguments);n="GFS4: "+n.split(/\n/).join(`
458
- GFS4: `),console.error(n)},"debug"));Vt[Mr]||(yI=global[Mr]||[],SI(Vt,yI),Vt.close=(function(n){function e(t,r){return n.call(Vt,t,function(i){i||_I(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,ag,{value:n}),e})(Vt.close),Vt.closeSync=(function(n){function e(t){n.apply(Vt,arguments),_I()}return o(e,"closeSync"),Object.defineProperty(e,ag,{value:n}),e})(Vt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Yo(Vt[Mr]),require("assert").equal(Vt[Mr].length,0)}));var yI;global[Mr]||SI(global,Vt[Mr]);sw.exports=nw(pq(Vt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Vt.__patched&&(sw.exports=nw(Vt),Vt.__patched=!0);function nw(n){dq(n),n.gracefulify=nw,n.createReadStream=B,n.createWriteStream=te;var e=n.readFile;n.readFile=t;function t(F,$,re){return typeof $=="function"&&(re=$,$=null),Ye(F,$,re);function Ye(st,Ot,at,ct){return e(st,Ot,function(Ke){Ke&&(Ke.code==="EMFILE"||Ke.code==="ENFILE")?Pl([Ye,[st,Ot,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,$,re,Ye){return typeof re=="function"&&(Ye=re,re=null),st(F,$,re,Ye);function st(Ot,at,ct,Ke,se){return r(Ot,at,ct,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Pl([st,[Ot,at,ct,Ke],U,se||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,$,re,Ye){return typeof re=="function"&&(Ye=re,re=null),st(F,$,re,Ye);function st(Ot,at,ct,Ke,se){return s(Ot,at,ct,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Pl([st,[Ot,at,ct,Ke],U,se||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,$,re,Ye){return typeof re=="function"&&(Ye=re,re=0),st(F,$,re,Ye);function st(Ot,at,ct,Ke,se){return c(Ot,at,ct,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Pl([st,[Ot,at,ct,Ke],U,se||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,$,re){typeof $=="function"&&(re=$,$=null);var Ye=f.test(process.version)?o(function(at,ct,Ke,se){return u(at,st(at,ct,Ke,se))},"go$readdir"):o(function(at,ct,Ke,se){return u(at,ct,st(at,ct,Ke,se))},"go$readdir");return Ye(F,$,re);function st(Ot,at,ct,Ke){return function(se,U){se&&(se.code==="EMFILE"||se.code==="ENFILE")?Pl([Ye,[Ot,at,ct],se,Ke||Date.now(),Date.now()]):(U&&U.sort&&U.sort(),typeof ct=="function"&&ct.call(this,se,U))}}}if(o(d,"readdir"),process.version.substr(0,4)==="v0.8"){var h=hq(n);b=h.ReadStream,I=h.WriteStream}var p=n.ReadStream;p&&(b.prototype=Object.create(p.prototype),b.prototype.open=A);var y=n.WriteStream;y&&(I.prototype=Object.create(y.prototype),I.prototype.open=j),Object.defineProperty(n,"ReadStream",{get:o(function(){return b},"get"),set:o(function(F){b=F},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return I},"get"),set:o(function(F){I=F},"set"),enumerable:!0,configurable:!0});var v=b;Object.defineProperty(n,"FileReadStream",{get:o(function(){return v},"get"),set:o(function(F){v=F},"set"),enumerable:!0,configurable:!0});var E=I;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return E},"get"),set:o(function(F){E=F},"set"),enumerable:!0,configurable:!0});function b(F,$){return this instanceof b?(p.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}o(b,"ReadStream");function A(){var F=this;G(F.path,F.flags,F.mode,function($,re){$?(F.autoClose&&F.destroy(),F.emit("error",$)):(F.fd=re,F.emit("open",re),F.read())})}o(A,"ReadStream$open");function I(F,$){return this instanceof I?(y.apply(this,arguments),this):I.apply(Object.create(I.prototype),arguments)}o(I,"WriteStream");function j(){var F=this;G(F.path,F.flags,F.mode,function($,re){$?(F.destroy(),F.emit("error",$)):(F.fd=re,F.emit("open",re))})}o(j,"WriteStream$open");function B(F,$){return new n.ReadStream(F,$)}o(B,"createReadStream");function te(F,$){return new n.WriteStream(F,$)}o(te,"createWriteStream");var z=n.open;n.open=G;function G(F,$,re,Ye){return typeof re=="function"&&(Ye=re,re=null),st(F,$,re,Ye);function st(Ot,at,ct,Ke,se){return z(Ot,at,ct,function(U,lt){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Pl([st,[Ot,at,ct,Ke],U,se||Date.now(),Date.now()]):typeof Ke=="function"&&Ke.apply(this,arguments)})}o(st,"go$open")}return o(G,"open"),n}o(nw,"patch");function Pl(n){Yo("ENQUEUE",n[0].name,n[1]),Vt[Mr].push(n),iw()}o(Pl,"enqueue");var sg;function _I(){for(var n=Date.now(),e=0;e<Vt[Mr].length;++e)Vt[Mr][e].length>2&&(Vt[Mr][e][3]=n,Vt[Mr][e][4]=n);iw()}o(_I,"resetQueue");function iw(){if(clearTimeout(sg),sg=void 0,Vt[Mr].length!==0){var n=Vt[Mr].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Yo("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Yo("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?(Yo("RETRY",e.name,t),e.apply(null,t.concat([i]))):Vt[Mr].push(n)}sg===void 0&&(sg=setTimeout(iw,0))}}o(iw,"retry")});var mn=S(la=>{"use strict";var vI=br().fromCallback,pn=Ol(),gq=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(n=>typeof pn[n]=="function");Object.assign(la,pn);gq.forEach(n=>{la[n]=vI(pn[n])});la.exists=function(n,e){return typeof e=="function"?pn.exists(n,e):new Promise(t=>pn.exists(n,t))};la.read=function(n,e,t,r,i,s){return typeof s=="function"?pn.read(n,e,t,r,i,s):new Promise((a,c)=>{pn.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};la.write=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.write(n,e,...t):new Promise((r,i)=>{pn.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};la.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.readv(n,e,...t):new Promise((r,i)=>{pn.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};la.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.writev(n,e,...t):new Promise((r,i)=>{pn.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof pn.realpath.native=="function"?la.realpath.native=vI(pn.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var wI=S((Nce,bI)=>{"use strict";var yq=require("path");bI.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(yq.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var xI=S((kce,aw)=>{"use strict";var EI=mn(),{checkPath:TI}=wI(),AI=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");aw.exports.makeDir=async(n,e)=>(TI(n),EI.mkdir(n,{mode:AI(e),recursive:!0}));aw.exports.makeDirSync=(n,e)=>(TI(n),EI.mkdirSync(n,{mode:AI(e),recursive:!0}))});var Bi=S((jce,CI)=>{"use strict";var _q=br().fromPromise,{makeDir:Sq,makeDirSync:ow}=xI(),cw=_q(Sq);CI.exports={mkdirs:cw,mkdirsSync:ow,mkdirp:cw,mkdirpSync:ow,ensureDir:cw,ensureDirSync:ow}});var za=S(($ce,RI)=>{"use strict";var vq=br().fromPromise,II=mn();function bq(n){return II.access(n).then(()=>!0).catch(()=>!1)}o(bq,"pathExists");RI.exports={pathExists:vq(bq),pathExistsSync:II.existsSync}});var lw=S((Bce,PI)=>{"use strict";var Fl=mn(),wq=br().fromPromise;async function Eq(n,e,t){let r=await Fl.open(n,"r+"),i=null;try{await Fl.futimes(r,e,t)}finally{try{await Fl.close(r)}catch(s){i=s}}if(i)throw i}o(Eq,"utimesMillis");function Tq(n,e,t){let r=Fl.openSync(n,"r+");return Fl.futimesSync(r,e,t),Fl.closeSync(r)}o(Tq,"utimesMillisSync");PI.exports={utimesMillis:wq(Eq),utimesMillisSync:Tq}});var Ko=S((qce,NI)=>{"use strict";var Dl=mn(),wr=require("path"),OI=br().fromPromise;function Aq(n,e,t){let r=t.dereference?i=>Dl.stat(i,{bigint:!0}):i=>Dl.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(Aq,"getStats");function xq(n,e,t){let r,i=t.dereference?a=>Dl.statSync(a,{bigint:!0}):a=>Dl.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(xq,"getStatsSync");async function Cq(n,e,t,r){let{srcStat:i,destStat:s}=await Aq(n,e,r);if(s){if(Af(i,s)){let a=wr.basename(n),c=wr.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()&&uw(n,e))throw new Error(og(n,e,t));return{srcStat:i,destStat:s}}o(Cq,"checkPaths");function Iq(n,e,t,r){let{srcStat:i,destStat:s}=xq(n,e,r);if(s){if(Af(i,s)){let a=wr.basename(n),c=wr.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()&&uw(n,e))throw new Error(og(n,e,t));return{srcStat:i,destStat:s}}o(Iq,"checkPathsSync");async function FI(n,e,t,r){let i=wr.resolve(wr.dirname(n)),s=wr.resolve(wr.dirname(t));if(s===i||s===wr.parse(s).root)return;let a;try{a=await Dl.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Af(e,a))throw new Error(og(n,t,r));return FI(n,e,s,r)}o(FI,"checkParentPaths");function DI(n,e,t,r){let i=wr.resolve(wr.dirname(n)),s=wr.resolve(wr.dirname(t));if(s===i||s===wr.parse(s).root)return;let a;try{a=Dl.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Af(e,a))throw new Error(og(n,t,r));return DI(n,e,s,r)}o(DI,"checkParentPathsSync");function Af(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(Af,"areIdentical");function uw(n,e){let t=wr.resolve(n).split(wr.sep).filter(i=>i),r=wr.resolve(e).split(wr.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(uw,"isSrcSubdir");function og(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(og,"errMsg");NI.exports={checkPaths:OI(Cq),checkPathsSync:Iq,checkParentPaths:OI(FI),checkParentPathsSync:DI,isSrcSubdir:uw,areIdentical:Af}});var kI=S((Gce,LI)=>{"use strict";async function Rq(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(Rq,"asyncIteratorConcurrentProcess");LI.exports={asyncIteratorConcurrentProcess:Rq}});var BI=S((Hce,VI)=>{"use strict";var Xr=mn(),xf=require("path"),{mkdirs:Pq}=Bi(),{pathExists:Oq}=za(),{utimesMillis:Fq}=lw(),Cf=Ko(),{asyncIteratorConcurrentProcess:Dq}=kI();async function Nq(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;
456
+ `);t=i.pop()??"";for(let s of i){let a=s.trim();a&&this.handleRequest(a,e)}}),e.on("error",()=>{e.destroy()})}async handleRequest(e,t){this.resetIdleTimer();let r;try{let i=JSON.parse(e),s=await this.getRegistry(i.registryPath),a=new DB.ClassHierarchy(i.subclassTriples??[]);r={report:(0,UC.validate)(i.triples,s,a,{closedWorldMode:i.closedWorldMode})}}catch(i){r={error:i instanceof Error?i.message:String(i)}}t.destroyed||t.write(JSON.stringify(r)+`
457
+ `)}async getRegistry(e){let t=this.registryCache.get(e);if(t)return t;let r=await FB.ShapeLoader.loadFromShapeJSON(e),i=new UC.ShapeRegistry(r.getAll());return this.registryCache.set(e,i),i}};vs.ValidatorDaemon=Kb});var Dt=S(m=>{"use strict";var NB=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]})),ni=m&&m.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&NB(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.InMemoryTripleStore=m.OBSIDIAN_VAULT_SCHEME=m.vaultPathToIRI=m.NullLogger=m.RDFSerializer=m.FilenameValidator=m.EffortSortingHelpers=m.MetadataExtractor=m.MetadataHelpers=m.WikiLinkHelpers=m.DateFormatter=m.FrontmatterService=m.CriticalityZoneUUIDs=m.CriticalityZoneService=m.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.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=m.RDFSInferenceEngine=m.RDFVocabularyMapper=m.DomainTriple=m.DomainBlankNode=m.DomainLiteral=m.DomainIRI=void 0;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=m.VaultPrefixTransformer=m.CaseWhenTransformerError=m.CaseWhenTransformer=m.ResultSerializer=m.createIncrementalIndexer=m.IncrementalIndexer=void 0;m.TripleClassHierarchy=m.IDLE_TIMEOUT_MS=m.DEFAULT_SOCKET_PATH=m.ValidatorDaemon=m.ShaclShapeRegistry=m.shaclValidate=m.ShapeRegistry=m.ShapeLoader=m.selectByPriority=m.LayoutSelector=m.isPropertiesBlock=m.isLayoutBlockFrontmatter=m.isBacklinksTableBlock=void 0;ni(Ru(),m);ni(bc(),m);var Wa=a0();Object.defineProperty(m,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return Wa.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(m,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return Wa.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(m,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return Wa.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(m,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return Wa.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(m,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return Wa.normalizeEffortStatus},"get")});Object.defineProperty(m,"isDoneStatus",{enumerable:!0,get:o(function(){return Wa.isDoneStatus},"get")});Object.defineProperty(m,"isTrashedStatus",{enumerable:!0,get:o(function(){return Wa.isTrashedStatus},"get")});Object.defineProperty(m,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return Wa.getEffortStatusLabel},"get")});var LB=wc();Object.defineProperty(m,"GroundingType",{enumerable:!0,get:o(function(){return LB.GroundingType},"get")});var wf=o0();Object.defineProperty(m,"CommandProperty",{enumerable:!0,get:o(function(){return wf.CommandProperty},"get")});Object.defineProperty(m,"PreconditionProperty",{enumerable:!0,get:o(function(){return wf.PreconditionProperty},"get")});Object.defineProperty(m,"GroundingProperty",{enumerable:!0,get:o(function(){return wf.GroundingProperty},"get")});Object.defineProperty(m,"CommandBindingProperty",{enumerable:!0,get:o(function(){return wf.CommandBindingProperty},"get")});Object.defineProperty(m,"CommandBindingStyleProperty",{enumerable:!0,get:o(function(){return wf.CommandBindingStyleProperty},"get")});var Il=c0();Object.defineProperty(m,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:o(function(){return Il.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(m,"LABEL_CLASS_VALUES",{enumerable:!0,get:o(function(){return Il.LABEL_CLASS_VALUES},"get")});Object.defineProperty(m,"STYLE_SOURCE_VALUES",{enumerable:!0,get:o(function(){return Il.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(m,"isCommandVariant",{enumerable:!0,get:o(function(){return Il.isCommandVariant},"get")});Object.defineProperty(m,"isLabelClass",{enumerable:!0,get:o(function(){return Il.isLabelClass},"get")});Object.defineProperty(m,"isStyleSource",{enumerable:!0,get:o(function(){return Il.isStyleSource},"get")});var tg=rT();Object.defineProperty(m,"isCommandFrontmatter",{enumerable:!0,get:o(function(){return tg.isCommandFrontmatter},"get")});Object.defineProperty(m,"isPreconditionFrontmatter",{enumerable:!0,get:o(function(){return tg.isPreconditionFrontmatter},"get")});Object.defineProperty(m,"isGroundingFrontmatter",{enumerable:!0,get:o(function(){return tg.isGroundingFrontmatter},"get")});Object.defineProperty(m,"isCommandBindingFrontmatter",{enumerable:!0,get:o(function(){return tg.isCommandBindingFrontmatter},"get")});ni(nT(),m);ni(iT(),m);ni(l0(),m);ni(u0(),m);ni(aT(),m);ni(lT(),m);ni(G0(),m);ni(XT(),m);var WC=Eh();Object.defineProperty(m,"PropertyFieldType",{enumerable:!0,get:o(function(){return WC.PropertyFieldType},"get")});Object.defineProperty(m,"rangeToFieldType",{enumerable:!0,get:o(function(){return WC.rangeToFieldType},"get")});var Xb=Y0();Object.defineProperty(m,"propertyNameToUri",{enumerable:!0,get:o(function(){return Xb.propertyNameToUri},"get")});Object.defineProperty(m,"uriToPropertyName",{enumerable:!0,get:o(function(){return Xb.uriToPropertyName},"get")});Object.defineProperty(m,"extractPropertyLabel",{enumerable:!0,get:o(function(){return Xb.extractPropertyLabel},"get")});var kB=x3();Object.defineProperty(m,"CommandResolver",{enumerable:!0,get:o(function(){return kB.CommandResolver},"get")});var MB=I3();Object.defineProperty(m,"PreconditionEvaluator",{enumerable:!0,get:o(function(){return MB.PreconditionEvaluator},"get")});var GC=P3();Object.defineProperty(m,"GroundingExecutor",{enumerable:!0,get:o(function(){return GC.GroundingExecutor},"get")});Object.defineProperty(m,"ServiceRegistry",{enumerable:!0,get:o(function(){return GC.ServiceRegistry},"get")});var jB=yS();Object.defineProperty(m,"TaskStatusService",{enumerable:!0,get:o(function(){return jB.TaskStatusService},"get")});var $B=bS();Object.defineProperty(m,"AreaCreationService",{enumerable:!0,get:o(function(){return $B.AreaCreationService},"get")});var VB=ES();Object.defineProperty(m,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return VB.AreaHierarchyBuilder},"get")});var BB=AS();Object.defineProperty(m,"ClassCreationService",{enumerable:!0,get:o(function(){return BB.ClassCreationService},"get")});var UB=CS();Object.defineProperty(m,"ConceptCreationService",{enumerable:!0,get:o(function(){return UB.ConceptCreationService},"get")});var qB=tm();Object.defineProperty(m,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return qB.EffortStatusWorkflow},"get")});var WB=af();Object.defineProperty(m,"WorkflowEngine",{enumerable:!0,get:o(function(){return WB.WorkflowEngine},"get")});var GB=sS();Object.defineProperty(m,"WorkflowResolver",{enumerable:!0,get:o(function(){return GB.WorkflowResolver},"get")});var zB=W3();Object.defineProperty(m,"InstantiationRuleResolver",{enumerable:!0,get:o(function(){return zB.InstantiationRuleResolver},"get")});var HB=G3();Object.defineProperty(m,"VisibilityGenerator",{enumerable:!0,get:o(function(){return HB.VisibilityGenerator},"get")});var QB=z3();Object.defineProperty(m,"WorkflowCommandAdapter",{enumerable:!0,get:o(function(){return QB.WorkflowCommandAdapter},"get")});var YB=NS();Object.defineProperty(m,"EffortVotingService",{enumerable:!0,get:o(function(){return YB.EffortVotingService},"get")});var KB=kS();Object.defineProperty(m,"FolderRepairService",{enumerable:!0,get:o(function(){return KB.FolderRepairService},"get")});var XB=jS();Object.defineProperty(m,"LabelToAliasService",{enumerable:!0,get:o(function(){return XB.LabelToAliasService},"get")});var JB=ka();Object.defineProperty(m,"LoggingService",{enumerable:!0,get:o(function(){return JB.LoggingService},"get")});var ZB=BS();Object.defineProperty(m,"PropertyCleanupService",{enumerable:!0,get:o(function(){return ZB.PropertyCleanupService},"get")});var eU=qS();Object.defineProperty(m,"RenameToUidService",{enumerable:!0,get:o(function(){return eU.RenameToUidService},"get")});var tU=nm();Object.defineProperty(m,"StatusTimestampService",{enumerable:!0,get:o(function(){return tU.StatusTimestampService},"get")});var rU=zS();Object.defineProperty(m,"SupervisionCreationService",{enumerable:!0,get:o(function(){return rU.SupervisionCreationService},"get")});var nU=YS();Object.defineProperty(m,"FleetingNoteCreationService",{enumerable:!0,get:o(function(){return nU.FleetingNoteCreationService},"get")});var iU=XS();Object.defineProperty(m,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return iU.DynamicFrontmatterGenerator},"get")});var sU=ZS();Object.defineProperty(m,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return sU.AlgorithmExtractor},"get")});var aU=tv();Object.defineProperty(m,"PlanningService",{enumerable:!0,get:o(function(){return aU.PlanningService},"get")});var oU=sx();Object.defineProperty(m,"PropertySchemaResolver",{enumerable:!0,get:o(function(){return oU.PropertySchemaResolver},"get")});var cU=ax();Object.defineProperty(m,"ClassHierarchyResolver",{enumerable:!0,get:o(function(){return cU.ClassHierarchyResolver},"get")});var lU=ox();Object.defineProperty(m,"EnumValueResolver",{enumerable:!0,get:o(function(){return lU.EnumValueResolver},"get")});var uU=av();Object.defineProperty(m,"AssetConversionService",{enumerable:!0,get:o(function(){return uU.AssetConversionService},"get")});var fU=lv();Object.defineProperty(m,"SessionEventService",{enumerable:!0,get:o(function(){return fU.SessionEventService},"get")});var dU=dv();Object.defineProperty(m,"URIConstructionService",{enumerable:!0,get:o(function(){return dU.URIConstructionService},"get")});var hU=pv();Object.defineProperty(m,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return hU.GenericAssetCreationService},"get")});var pU=yx();Object.defineProperty(m,"ArchiveAssetService",{enumerable:!0,get:o(function(){return pU.ArchiveAssetService},"get")});var mU=Sx();Object.defineProperty(m,"FixMissingLabelService",{enumerable:!0,get:o(function(){return mU.FixMissingLabelService},"get")});var gU=vx();Object.defineProperty(m,"GraphQueryService",{enumerable:!0,get:o(function(){return gU.GraphQueryService},"get")});var yU=wx();Object.defineProperty(m,"TypeRegistry",{enumerable:!0,get:o(function(){return yU.TypeRegistry},"get")});var zC=Ex();Object.defineProperty(m,"NLToSPARQLService",{enumerable:!0,get:o(function(){return zC.NLToSPARQLService},"get")});Object.defineProperty(m,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return zC.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var ii=Sv();Object.defineProperty(m,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return ii.SPARQL_TEMPLATES},"get")});Object.defineProperty(m,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return ii.SPARQL_PREFIXES},"get")});Object.defineProperty(m,"PREDICATES",{enumerable:!0,get:o(function(){return ii.PREDICATES},"get")});Object.defineProperty(m,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return ii.ASSET_CLASSES},"get")});Object.defineProperty(m,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return ii.EFFORT_STATUSES},"get")});Object.defineProperty(m,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return ii.KNOWN_PROTOTYPES},"get")});Object.defineProperty(m,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return ii.KNOWN_CLASSES},"get")});Object.defineProperty(m,"findClassByTerm",{enumerable:!0,get:o(function(){return ii.findClassByTerm},"get")});Object.defineProperty(m,"findMatchingTemplates",{enumerable:!0,get:o(function(){return ii.findMatchingTemplates},"get")});Object.defineProperty(m,"fillTemplate",{enumerable:!0,get:o(function(){return ii.fillTemplate},"get")});Object.defineProperty(m,"validateParameters",{enumerable:!0,get:o(function(){return ii.validateParameters},"get")});Object.defineProperty(m,"getTemplateByName",{enumerable:!0,get:o(function(){return ii.getTemplateByName},"get")});var _U=Ax();Object.defineProperty(m,"AnalyticsService",{enumerable:!0,get:o(function(){return _U.AnalyticsService},"get")});var SU=xx();Object.defineProperty(m,"TrendDetectionService",{enumerable:!0,get:o(function(){return SU.TrendDetectionService},"get")});var HC=Ix();Object.defineProperty(m,"AutocompleteService",{enumerable:!0,get:o(function(){return HC.AutocompleteService},"get")});Object.defineProperty(m,"DEFAULT_AUTOCOMPLETE_CONFIG",{enumerable:!0,get:o(function(){return HC.DEFAULT_AUTOCOMPLETE_CONFIG},"get")});var vU=Px();Object.defineProperty(m,"DailyReviewService",{enumerable:!0,get:o(function(){return vU.DailyReviewService},"get")});var QC=xv();Object.defineProperty(m,"CriticalityZoneService",{enumerable:!0,get:o(function(){return QC.CriticalityZoneService},"get")});Object.defineProperty(m,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return QC.CriticalityZoneUUIDs},"get")});var bU=Jn();Object.defineProperty(m,"FrontmatterService",{enumerable:!0,get:o(function(){return bU.FrontmatterService},"get")});var wU=Hr();Object.defineProperty(m,"DateFormatter",{enumerable:!0,get:o(function(){return wU.DateFormatter},"get")});var EU=Us();Object.defineProperty(m,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return EU.WikiLinkHelpers},"get")});var TU=ds();Object.defineProperty(m,"MetadataHelpers",{enumerable:!0,get:o(function(){return TU.MetadataHelpers},"get")});var AU=SS();Object.defineProperty(m,"MetadataExtractor",{enumerable:!0,get:o(function(){return AU.MetadataExtractor},"get")});var xU=Fx();Object.defineProperty(m,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return xU.EffortSortingHelpers},"get")});var CU=Dx();Object.defineProperty(m,"FilenameValidator",{enumerable:!0,get:o(function(){return CU.FilenameValidator},"get")});var IU=Vx();Object.defineProperty(m,"RDFSerializer",{enumerable:!0,get:o(function(){return IU.RDFSerializer},"get")});var RU=Ic();Object.defineProperty(m,"NullLogger",{enumerable:!0,get:o(function(){return RU.NullLogger},"get")});var YC=jv();Object.defineProperty(m,"vaultPathToIRI",{enumerable:!0,get:o(function(){return YC.vaultPathToIRI},"get")});Object.defineProperty(m,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:o(function(){return YC.OBSIDIAN_VAULT_SCHEME},"get")});var PU=hS();Object.defineProperty(m,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return PU.InMemoryTripleStore},"get")});var OU=Ae();Object.defineProperty(m,"DomainIRI",{enumerable:!0,get:o(function(){return OU.IRI},"get")});var FU=Ne();Object.defineProperty(m,"DomainLiteral",{enumerable:!0,get:o(function(){return FU.Literal},"get")});var DU=qt();Object.defineProperty(m,"DomainBlankNode",{enumerable:!0,get:o(function(){return DU.BlankNode},"get")});var NU=Qn();Object.defineProperty(m,"DomainTriple",{enumerable:!0,get:o(function(){return NU.Triple},"get")});var LU=Vv();Object.defineProperty(m,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return LU.RDFVocabularyMapper},"get")});var kU=Ux();Object.defineProperty(m,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return kU.RDFSInferenceEngine},"get")});var MU=Wv();Object.defineProperty(m,"NonInheritablePropertyRegistry",{enumerable:!0,get:o(function(){return MU.NonInheritablePropertyRegistry},"get")});var jU=Hv();Object.defineProperty(m,"PropertyCardinalityRegistry",{enumerable:!0,get:o(function(){return jU.PropertyCardinalityRegistry},"get")});var KC=Kv();Object.defineProperty(m,"PrototypeChainMaterializer",{enumerable:!0,get:o(function(){return KC.PrototypeChainMaterializer},"get")});Object.defineProperty(m,"INFERRED_GRAPH",{enumerable:!0,get:o(function(){return KC.INFERRED_GRAPH},"get")});var XC=Jv();Object.defineProperty(m,"SourceAnnotator",{enumerable:!0,get:o(function(){return XC.SourceAnnotator},"get")});Object.defineProperty(m,"SOURCE_VARIABLE",{enumerable:!0,get:o(function(){return XC.SOURCE_VARIABLE},"get")});var $U=eb();Object.defineProperty(m,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return $U.NoteToRDFConverter},"get")});var Jb=jc();Object.defineProperty(m,"ExoQLParser",{enumerable:!0,get:o(function(){return Jb.ExoQLParser},"get")});Object.defineProperty(m,"SPARQLParser",{enumerable:!0,get:o(function(){return Jb.SPARQLParser},"get")});Object.defineProperty(m,"SPARQLParseError",{enumerable:!0,get:o(function(){return Jb.SPARQLParseError},"get")});var JC=H_();Object.defineProperty(m,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return JC.DescribeOptionsTransformer},"get")});Object.defineProperty(m,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return JC.DescribeOptionsTransformerError},"get")});var ZC=Vc();Object.defineProperty(m,"ExoQLAlgebraTranslator",{enumerable:!0,get:o(function(){return ZC.ExoQLAlgebraTranslator},"get")});Object.defineProperty(m,"AlgebraTranslator",{enumerable:!0,get:o(function(){return ZC.AlgebraTranslator},"get")});var VU=Jx();Object.defineProperty(m,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return VU.AlgebraOptimizer},"get")});var BU=Zx();Object.defineProperty(m,"AlgebraSerializer",{enumerable:!0,get:o(function(){return BU.AlgebraSerializer},"get")});var UU=f1();Object.defineProperty(m,"BGPExecutor",{enumerable:!0,get:o(function(){return UU.BGPExecutor},"get")});var qU=Op();Object.defineProperty(m,"FilterExecutor",{enumerable:!0,get:o(function(){return qU.FilterExecutor},"get")});var WU=R1();Object.defineProperty(m,"OptionalExecutor",{enumerable:!0,get:o(function(){return WU.OptionalExecutor},"get")});var GU=O1();Object.defineProperty(m,"UnionExecutor",{enumerable:!0,get:o(function(){return GU.UnionExecutor},"get")});var zU=B1();Object.defineProperty(m,"ConstructExecutor",{enumerable:!0,get:o(function(){return zU.ConstructExecutor},"get")});var HU=tC();Object.defineProperty(m,"DescribeExecutor",{enumerable:!0,get:o(function(){return HU.DescribeExecutor},"get")});var eI=al();Object.defineProperty(m,"ExoQLQueryExecutor",{enumerable:!0,get:o(function(){return eI.ExoQLQueryExecutor},"get")});Object.defineProperty(m,"QueryExecutor",{enumerable:!0,get:o(function(){return eI.QueryExecutor},"get")});var tI=nC();Object.defineProperty(m,"UpdateExecutor",{enumerable:!0,get:o(function(){return tI.UpdateExecutor},"get")});Object.defineProperty(m,"UpdateExecutorError",{enumerable:!0,get:o(function(){return tI.UpdateExecutorError},"get")});var QU=cs();Object.defineProperty(m,"SolutionMapping",{enumerable:!0,get:o(function(){return QU.SolutionMapping},"get")});var YU=Pp();Object.defineProperty(m,"BuiltInFunctions",{enumerable:!0,get:o(function(){return YU.BuiltInFunctions},"get")});var KU=sC();Object.defineProperty(m,"AggregateFunctions",{enumerable:!0,get:o(function(){return KU.AggregateFunctions},"get")});var rI=N1();Object.defineProperty(m,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return rI.CustomAggregateRegistry},"get")});Object.defineProperty(m,"CustomAggregateError",{enumerable:!0,get:o(function(){return rI.CustomAggregateError},"get")});var bs=L1();Object.defineProperty(m,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return bs.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(m,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return bs.EXO_AGGREGATE_NS},"get")});Object.defineProperty(m,"medianAggregate",{enumerable:!0,get:o(function(){return bs.medianAggregate},"get")});Object.defineProperty(m,"varianceAggregate",{enumerable:!0,get:o(function(){return bs.varianceAggregate},"get")});Object.defineProperty(m,"stddevAggregate",{enumerable:!0,get:o(function(){return bs.stddevAggregate},"get")});Object.defineProperty(m,"modeAggregate",{enumerable:!0,get:o(function(){return bs.modeAggregate},"get")});Object.defineProperty(m,"createPercentileAggregate",{enumerable:!0,get:o(function(){return bs.createPercentileAggregate},"get")});Object.defineProperty(m,"getNumericValue",{enumerable:!0,get:o(function(){return bs.getNumericValue},"get")});Object.defineProperty(m,"createDecimalLiteral",{enumerable:!0,get:o(function(){return bs.createDecimalLiteral},"get")});Object.defineProperty(m,"createDoubleLiteral",{enumerable:!0,get:o(function(){return bs.createDoubleLiteral},"get")});var XU=aC();Object.defineProperty(m,"QueryPlanCache",{enumerable:!0,get:o(function(){return XU.QueryPlanCache},"get")});var nI=oC();Object.defineProperty(m,"SPARQLResultCache",{enumerable:!0,get:o(function(){return nI.SPARQLResultCache},"get")});Object.defineProperty(m,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return nI.createSPARQLResultCache},"get")});var iI=cC();Object.defineProperty(m,"IncrementalIndexer",{enumerable:!0,get:o(function(){return iI.IncrementalIndexer},"get")});Object.defineProperty(m,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return iI.createIncrementalIndexer},"get")});var JU=lC();Object.defineProperty(m,"ResultSerializer",{enumerable:!0,get:o(function(){return JU.ResultSerializer},"get")});var sI=W_();Object.defineProperty(m,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return sI.CaseWhenTransformer},"get")});Object.defineProperty(m,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return sI.CaseWhenTransformerError},"get")});var ZU=X_();Object.defineProperty(m,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return ZU.VaultPrefixTransformer},"get")});var eq=rb();Object.defineProperty(m,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return eq.FilterContainsOptimizer},"get")});var aI=uC();Object.defineProperty(m,"FileNotFoundError",{enumerable:!0,get:o(function(){return aI.FileNotFoundError},"get")});Object.defineProperty(m,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return aI.FileAlreadyExistsError},"get")});var Zb=lS();Object.defineProperty(m,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return Zb.TripleAlreadyExistsError},"get")});Object.defineProperty(m,"TripleNotFoundError",{enumerable:!0,get:o(function(){return Zb.TripleNotFoundError},"get")});Object.defineProperty(m,"TransactionError",{enumerable:!0,get:o(function(){return Zb.TransactionError},"get")});var rg=mb();Object.defineProperty(m,"VaultSettings",{enumerable:!0,get:o(function(){return rg.VaultSettings},"get")});Object.defineProperty(m,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:o(function(){return rg.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(m,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:o(function(){return rg.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(m,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:o(function(){return rg.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var tq=wt();Object.defineProperty(m,"DI_TOKENS",{enumerable:!0,get:o(function(){return tq.DI_TOKENS},"get")});var Ef=fC();Object.defineProperty(m,"registerCoreServices",{enumerable:!0,get:o(function(){return Ef.registerCoreServices},"get")});Object.defineProperty(m,"createChildContainer",{enumerable:!0,get:o(function(){return Ef.createChildContainer},"get")});Object.defineProperty(m,"getContainer",{enumerable:!0,get:o(function(){return Ef.getContainer},"get")});Object.defineProperty(m,"resetContainer",{enumerable:!0,get:o(function(){return Ef.resetContainer},"get")});Object.defineProperty(m,"container",{enumerable:!0,get:o(function(){return Ef.container},"get")});var ca=yC();Object.defineProperty(m,"NODE_FLAGS",{enumerable:!0,get:o(function(){return ca.NODE_FLAGS},"get")});Object.defineProperty(m,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return ca.DEFAULT_COLORS},"get")});Object.defineProperty(m,"StringTable",{enumerable:!0,get:o(function(){return ca.StringTable},"get")});Object.defineProperty(m,"CompactGraphStore",{enumerable:!0,get:o(function(){return ca.CompactGraphStore},"get")});Object.defineProperty(m,"MemoryPool",{enumerable:!0,get:o(function(){return ca.MemoryPool},"get")});Object.defineProperty(m,"getGlobalPool",{enumerable:!0,get:o(function(){return ca.getGlobalPool},"get")});Object.defineProperty(m,"resetGlobalPool",{enumerable:!0,get:o(function(){return ca.resetGlobalPool},"get")});Object.defineProperty(m,"StreamingLoader",{enumerable:!0,get:o(function(){return ca.StreamingLoader},"get")});Object.defineProperty(m,"createStreamingSource",{enumerable:!0,get:o(function(){return ca.createStreamingSource},"get")});var oI=_C();Object.defineProperty(m,"ExoQL",{enumerable:!0,get:o(function(){return oI.ExoQL},"get")});Object.defineProperty(m,"ExoQLError",{enumerable:!0,get:o(function(){return oI.ExoQLError},"get")});var Rl=jm();Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_IRI",{enumerable:!0,get:o(function(){return Rl.RELATION_COLUMN_SET_CLASS_IRI},"get")});Object.defineProperty(m,"RELATION_COLUMN_SET_CLASS_UID",{enumerable:!0,get:o(function(){return Rl.RELATION_COLUMN_SET_CLASS_UID},"get")});Object.defineProperty(m,"createRelationColumnSetFromFrontmatter",{enumerable:!0,get:o(function(){return Rl.createRelationColumnSetFromFrontmatter},"get")});Object.defineProperty(m,"isRelationColumnSet",{enumerable:!0,get:o(function(){return Rl.isRelationColumnSet},"get")});Object.defineProperty(m,"isRelationColumnSetFrontmatter",{enumerable:!0,get:o(function(){return Rl.isRelationColumnSetFrontmatter},"get")});Object.defineProperty(m,"normalizeRelationColumnSetRef",{enumerable:!0,get:o(function(){return Rl.normalizeRef},"get")});var rq=CC();Object.defineProperty(m,"RelationColumnSetResolver",{enumerable:!0,get:o(function(){return rq.RelationColumnSetResolver},"get")});var Tf=jm();Object.defineProperty(m,"LAYOUT_CLASS_IRI",{enumerable:!0,get:o(function(){return Tf.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(m,"LAYOUT_CLASS_UID",{enumerable:!0,get:o(function(){return Tf.LAYOUT_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutFromFrontmatter",{enumerable:!0,get:o(function(){return Tf.createLayoutFromFrontmatter},"get")});Object.defineProperty(m,"isLayout",{enumerable:!0,get:o(function(){return Tf.isLayout},"get")});Object.defineProperty(m,"isLayoutFrontmatter",{enumerable:!0,get:o(function(){return Tf.isLayoutFrontmatter},"get")});var Ga=jm();Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Ga.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Ga.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:o(function(){return Ga.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:o(function(){return Ga.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:o(function(){return Ga.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(m,"isBacklinksTableBlock",{enumerable:!0,get:o(function(){return Ga.isBacklinksTableBlock},"get")});Object.defineProperty(m,"isLayoutBlockFrontmatter",{enumerable:!0,get:o(function(){return Ga.isLayoutBlockFrontmatter},"get")});Object.defineProperty(m,"isPropertiesBlock",{enumerable:!0,get:o(function(){return Ga.isPropertiesBlock},"get")});var cI=RC();Object.defineProperty(m,"LayoutSelector",{enumerable:!0,get:o(function(){return cI.LayoutSelector},"get")});Object.defineProperty(m,"selectByPriority",{enumerable:!0,get:o(function(){return cI.selectByPriority},"get")});ni(jC(),m);var nq=qb();Object.defineProperty(m,"ShapeLoader",{enumerable:!0,get:o(function(){return nq.ShapeLoader},"get")});var iq=$b();Object.defineProperty(m,"ShapeRegistry",{enumerable:!0,get:o(function(){return iq.ShapeRegistry},"get")});var lI=Gb();Object.defineProperty(m,"shaclValidate",{enumerable:!0,get:o(function(){return lI.validate},"get")});Object.defineProperty(m,"ShaclShapeRegistry",{enumerable:!0,get:o(function(){return lI.ShapeRegistry},"get")});ni(BC(),m);var ew=qC();Object.defineProperty(m,"ValidatorDaemon",{enumerable:!0,get:o(function(){return ew.ValidatorDaemon},"get")});Object.defineProperty(m,"DEFAULT_SOCKET_PATH",{enumerable:!0,get:o(function(){return ew.DEFAULT_SOCKET_PATH},"get")});Object.defineProperty(m,"IDLE_TIMEOUT_MS",{enumerable:!0,get:o(function(){return ew.IDLE_TIMEOUT_MS},"get")});var sq=Yb();Object.defineProperty(m,"TripleClassHierarchy",{enumerable:!0,get:o(function(){return sq.ClassHierarchy},"get")})});var br=S(tw=>{"use strict";tw.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})};tw.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 fI=S((Ace,uI)=>{var za=require("constants"),aq=process.cwd,ng=null,oq=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ng||(ng=aq.call(process)),ng};try{process.cwd()}catch{}typeof process.chdir=="function"&&(rw=process.chdir,process.chdir=function(n){ng=null,rw.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,rw));var rw;uI.exports=cq;function cq(n){za.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(){}),oq==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function d(h,p,y){var v=Date.now(),E=0;f(h,p,o(function b(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-v<6e4){setTimeout(function(){n.stat(p,function(I,j){I&&I.code==="ENOENT"?f(h,p,b):y(A)})},E),E<100&&(E+=10);return}y&&y(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,y,v,E,b){var A;if(b&&typeof b=="function"){var I=0;A=o(function(j,B,te){if(j&&j.code==="EAGAIN"&&I<10)return I++,f.call(n,h,p,y,v,E,A);b.apply(this,arguments)},"callback")}return f.call(n,h,p,y,v,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,y,v){for(var E=0;;)try{return f.call(n,d,h,p,y,v)}catch(b){if(b.code==="EAGAIN"&&E<10){E++;continue}throw b}}})(n.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,za.O_WRONLY|za.O_SYMLINK,h,function(y,v){if(y){p&&p(y);return}f.fchmod(v,h,function(E){f.close(v,function(b){p&&p(E||b)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,za.O_WRONLY|za.O_SYMLINK,h),y=!0,v;try{v=f.fchmodSync(p,h),y=!1}finally{if(y)try{f.closeSync(p)}catch{}else f.closeSync(p)}return v}}o(e,"patchLchmod");function t(f){za.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,y){f.open(d,za.O_SYMLINK,function(v,E){if(v){y&&y(v);return}f.futimes(E,h,p,function(b){f.close(E,function(A){y&&y(b||A)})})})},f.lutimesSync=function(d,h,p){var y=f.openSync(d,za.O_SYMLINK),v,E=!0;try{v=f.futimesSync(y,h,p),E=!1}finally{if(E)try{f.closeSync(y)}catch{}else f.closeSync(y)}return v}):f.futimes&&(f.lutimes=function(d,h,p,y){y&&process.nextTick(y)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(d,h,p){return f.call(n,d,h,function(y){u(y)&&(y=null),p&&p.apply(this,arguments)})}}o(r,"chmodFix");function i(f){return f&&function(d,h){try{return f.call(n,d,h)}catch(p){if(!u(p))throw p}}}o(i,"chmodFixSync");function s(f){return f&&function(d,h,p,y){return f.call(n,d,h,p,function(v){u(v)&&(v=null),y&&y.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(d,h,p){try{return f.call(n,d,h,p)}catch(y){if(!u(y))throw y}}}o(a,"chownFixSync");function c(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function y(v,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),p&&p.apply(this,arguments)}return o(y,"callback"),h?f.call(n,d,h,y):f.call(n,d,y)}}o(c,"statFix");function l(f){return f&&function(d,h){var p=h?f.call(n,d,h):f.call(n,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}o(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}o(u,"chownErOk")}o(cq,"patch")});var pI=S((Cce,hI)=>{var dI=require("stream").Stream;hI.exports=lq;function lq(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);dI.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);dI.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(lq,"legacy")});var gI=S((Rce,mI)=>{"use strict";mI.exports=fq;var uq=Object.getPrototypeOf||function(n){return n.__proto__};function fq(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:uq(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(fq,"clone")});var Ol=S((Oce,sw)=>{var Vt=require("fs"),dq=fI(),hq=pI(),pq=gI(),ig=require("util"),Mr,ag;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Mr=Symbol.for("graceful-fs.queue"),ag=Symbol.for("graceful-fs.previous")):(Mr="___graceful-fs.queue",ag="___graceful-fs.previous");function mq(){}o(mq,"noop");function SI(n,e){Object.defineProperty(n,Mr,{get:o(function(){return e},"get")})}o(SI,"publishQueue");var Yo=mq;ig.debuglog?Yo=ig.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Yo=o(function(){var n=ig.format.apply(ig,arguments);n="GFS4: "+n.split(/\n/).join(`
458
+ GFS4: `),console.error(n)},"debug"));Vt[Mr]||(yI=global[Mr]||[],SI(Vt,yI),Vt.close=(function(n){function e(t,r){return n.call(Vt,t,function(i){i||_I(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,ag,{value:n}),e})(Vt.close),Vt.closeSync=(function(n){function e(t){n.apply(Vt,arguments),_I()}return o(e,"closeSync"),Object.defineProperty(e,ag,{value:n}),e})(Vt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Yo(Vt[Mr]),require("assert").equal(Vt[Mr].length,0)}));var yI;global[Mr]||SI(global,Vt[Mr]);sw.exports=nw(pq(Vt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Vt.__patched&&(sw.exports=nw(Vt),Vt.__patched=!0);function nw(n){dq(n),n.gracefulify=nw,n.createReadStream=B,n.createWriteStream=te;var e=n.readFile;n.readFile=t;function t(F,$,re){return typeof $=="function"&&(re=$,$=null),Ye(F,$,re);function Ye(st,Ot,at,ct){return e(st,Ot,function(Ke){Ke&&(Ke.code==="EMFILE"||Ke.code==="ENFILE")?Pl([Ye,[st,Ot,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,$,re,Ye){return typeof re=="function"&&(Ye=re,re=null),st(F,$,re,Ye);function st(Ot,at,ct,Ke,se){return r(Ot,at,ct,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Pl([st,[Ot,at,ct,Ke],U,se||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,$,re,Ye){return typeof re=="function"&&(Ye=re,re=null),st(F,$,re,Ye);function st(Ot,at,ct,Ke,se){return s(Ot,at,ct,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Pl([st,[Ot,at,ct,Ke],U,se||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,$,re,Ye){return typeof re=="function"&&(Ye=re,re=0),st(F,$,re,Ye);function st(Ot,at,ct,Ke,se){return c(Ot,at,ct,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Pl([st,[Ot,at,ct,Ke],U,se||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,$,re){typeof $=="function"&&(re=$,$=null);var Ye=f.test(process.version)?o(function(at,ct,Ke,se){return u(at,st(at,ct,Ke,se))},"go$readdir"):o(function(at,ct,Ke,se){return u(at,ct,st(at,ct,Ke,se))},"go$readdir");return Ye(F,$,re);function st(Ot,at,ct,Ke){return function(se,U){se&&(se.code==="EMFILE"||se.code==="ENFILE")?Pl([Ye,[Ot,at,ct],se,Ke||Date.now(),Date.now()]):(U&&U.sort&&U.sort(),typeof ct=="function"&&ct.call(this,se,U))}}}if(o(d,"readdir"),process.version.substr(0,4)==="v0.8"){var h=hq(n);b=h.ReadStream,I=h.WriteStream}var p=n.ReadStream;p&&(b.prototype=Object.create(p.prototype),b.prototype.open=A);var y=n.WriteStream;y&&(I.prototype=Object.create(y.prototype),I.prototype.open=j),Object.defineProperty(n,"ReadStream",{get:o(function(){return b},"get"),set:o(function(F){b=F},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return I},"get"),set:o(function(F){I=F},"set"),enumerable:!0,configurable:!0});var v=b;Object.defineProperty(n,"FileReadStream",{get:o(function(){return v},"get"),set:o(function(F){v=F},"set"),enumerable:!0,configurable:!0});var E=I;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return E},"get"),set:o(function(F){E=F},"set"),enumerable:!0,configurable:!0});function b(F,$){return this instanceof b?(p.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}o(b,"ReadStream");function A(){var F=this;G(F.path,F.flags,F.mode,function($,re){$?(F.autoClose&&F.destroy(),F.emit("error",$)):(F.fd=re,F.emit("open",re),F.read())})}o(A,"ReadStream$open");function I(F,$){return this instanceof I?(y.apply(this,arguments),this):I.apply(Object.create(I.prototype),arguments)}o(I,"WriteStream");function j(){var F=this;G(F.path,F.flags,F.mode,function($,re){$?(F.destroy(),F.emit("error",$)):(F.fd=re,F.emit("open",re))})}o(j,"WriteStream$open");function B(F,$){return new n.ReadStream(F,$)}o(B,"createReadStream");function te(F,$){return new n.WriteStream(F,$)}o(te,"createWriteStream");var z=n.open;n.open=G;function G(F,$,re,Ye){return typeof re=="function"&&(Ye=re,re=null),st(F,$,re,Ye);function st(Ot,at,ct,Ke,se){return z(Ot,at,ct,function(U,lt){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Pl([st,[Ot,at,ct,Ke],U,se||Date.now(),Date.now()]):typeof Ke=="function"&&Ke.apply(this,arguments)})}o(st,"go$open")}return o(G,"open"),n}o(nw,"patch");function Pl(n){Yo("ENQUEUE",n[0].name,n[1]),Vt[Mr].push(n),iw()}o(Pl,"enqueue");var sg;function _I(){for(var n=Date.now(),e=0;e<Vt[Mr].length;++e)Vt[Mr][e].length>2&&(Vt[Mr][e][3]=n,Vt[Mr][e][4]=n);iw()}o(_I,"resetQueue");function iw(){if(clearTimeout(sg),sg=void 0,Vt[Mr].length!==0){var n=Vt[Mr].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Yo("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Yo("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?(Yo("RETRY",e.name,t),e.apply(null,t.concat([i]))):Vt[Mr].push(n)}sg===void 0&&(sg=setTimeout(iw,0))}}o(iw,"retry")});var mn=S(la=>{"use strict";var vI=br().fromCallback,pn=Ol(),gq=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(n=>typeof pn[n]=="function");Object.assign(la,pn);gq.forEach(n=>{la[n]=vI(pn[n])});la.exists=function(n,e){return typeof e=="function"?pn.exists(n,e):new Promise(t=>pn.exists(n,t))};la.read=function(n,e,t,r,i,s){return typeof s=="function"?pn.read(n,e,t,r,i,s):new Promise((a,c)=>{pn.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};la.write=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.write(n,e,...t):new Promise((r,i)=>{pn.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};la.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.readv(n,e,...t):new Promise((r,i)=>{pn.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};la.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?pn.writev(n,e,...t):new Promise((r,i)=>{pn.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof pn.realpath.native=="function"?la.realpath.native=vI(pn.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var wI=S((Nce,bI)=>{"use strict";var yq=require("path");bI.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(yq.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var xI=S((kce,aw)=>{"use strict";var EI=mn(),{checkPath:TI}=wI(),AI=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");aw.exports.makeDir=async(n,e)=>(TI(n),EI.mkdir(n,{mode:AI(e),recursive:!0}));aw.exports.makeDirSync=(n,e)=>(TI(n),EI.mkdirSync(n,{mode:AI(e),recursive:!0}))});var Bi=S((jce,CI)=>{"use strict";var _q=br().fromPromise,{makeDir:Sq,makeDirSync:ow}=xI(),cw=_q(Sq);CI.exports={mkdirs:cw,mkdirsSync:ow,mkdirp:cw,mkdirpSync:ow,ensureDir:cw,ensureDirSync:ow}});var Ha=S(($ce,RI)=>{"use strict";var vq=br().fromPromise,II=mn();function bq(n){return II.access(n).then(()=>!0).catch(()=>!1)}o(bq,"pathExists");RI.exports={pathExists:vq(bq),pathExistsSync:II.existsSync}});var lw=S((Bce,PI)=>{"use strict";var Fl=mn(),wq=br().fromPromise;async function Eq(n,e,t){let r=await Fl.open(n,"r+"),i=null;try{await Fl.futimes(r,e,t)}finally{try{await Fl.close(r)}catch(s){i=s}}if(i)throw i}o(Eq,"utimesMillis");function Tq(n,e,t){let r=Fl.openSync(n,"r+");return Fl.futimesSync(r,e,t),Fl.closeSync(r)}o(Tq,"utimesMillisSync");PI.exports={utimesMillis:wq(Eq),utimesMillisSync:Tq}});var Ko=S((qce,NI)=>{"use strict";var Dl=mn(),wr=require("path"),OI=br().fromPromise;function Aq(n,e,t){let r=t.dereference?i=>Dl.stat(i,{bigint:!0}):i=>Dl.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(Aq,"getStats");function xq(n,e,t){let r,i=t.dereference?a=>Dl.statSync(a,{bigint:!0}):a=>Dl.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(xq,"getStatsSync");async function Cq(n,e,t,r){let{srcStat:i,destStat:s}=await Aq(n,e,r);if(s){if(Af(i,s)){let a=wr.basename(n),c=wr.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()&&uw(n,e))throw new Error(og(n,e,t));return{srcStat:i,destStat:s}}o(Cq,"checkPaths");function Iq(n,e,t,r){let{srcStat:i,destStat:s}=xq(n,e,r);if(s){if(Af(i,s)){let a=wr.basename(n),c=wr.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()&&uw(n,e))throw new Error(og(n,e,t));return{srcStat:i,destStat:s}}o(Iq,"checkPathsSync");async function FI(n,e,t,r){let i=wr.resolve(wr.dirname(n)),s=wr.resolve(wr.dirname(t));if(s===i||s===wr.parse(s).root)return;let a;try{a=await Dl.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Af(e,a))throw new Error(og(n,t,r));return FI(n,e,s,r)}o(FI,"checkParentPaths");function DI(n,e,t,r){let i=wr.resolve(wr.dirname(n)),s=wr.resolve(wr.dirname(t));if(s===i||s===wr.parse(s).root)return;let a;try{a=Dl.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Af(e,a))throw new Error(og(n,t,r));return DI(n,e,s,r)}o(DI,"checkParentPathsSync");function Af(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(Af,"areIdentical");function uw(n,e){let t=wr.resolve(n).split(wr.sep).filter(i=>i),r=wr.resolve(e).split(wr.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(uw,"isSrcSubdir");function og(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(og,"errMsg");NI.exports={checkPaths:OI(Cq),checkPathsSync:Iq,checkParentPaths:OI(FI),checkParentPathsSync:DI,isSrcSubdir:uw,areIdentical:Af}});var kI=S((Gce,LI)=>{"use strict";async function Rq(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(Rq,"asyncIteratorConcurrentProcess");LI.exports={asyncIteratorConcurrentProcess:Rq}});var BI=S((Hce,VI)=>{"use strict";var Jr=mn(),xf=require("path"),{mkdirs:Pq}=Bi(),{pathExists:Oq}=Ha(),{utimesMillis:Fq}=lw(),Cf=Ko(),{asyncIteratorConcurrentProcess:Dq}=kI();async function Nq(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;
459
459
 
460
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await Cf.checkPaths(n,e,"copy",t);if(await Cf.checkParentPaths(n,r,e,"copy"),!await jI(n,e,t))return;let a=xf.dirname(e);await Oq(a)||await Pq(a),await $I(i,n,e,t)}o(Nq,"copy");async function jI(n,e,t){return t.filter?t.filter(n,e):!0}o(jI,"runFilter");async function $I(n,e,t,r){let s=await(r.dereference?Xr.stat:Xr.lstat)(e);if(s.isDirectory())return jq(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Lq(s,n,e,t,r);if(s.isSymbolicLink())return $q(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($I,"getStatsAndPerformCopy");async function Lq(n,e,t,r,i){if(!e)return MI(n,t,r,i);if(i.overwrite)return await Xr.unlink(r),MI(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}o(Lq,"onFile");async function MI(n,e,t,r){if(await Xr.copyFile(e,t),r.preserveTimestamps){kq(n.mode)&&await Mq(t,n.mode);let i=await Xr.stat(e);await Fq(t,i.atime,i.mtime)}return Xr.chmod(t,n.mode)}o(MI,"copyFile");function kq(n){return(n&128)===0}o(kq,"fileIsNotWritable");function Mq(n,e){return Xr.chmod(n,e|128)}o(Mq,"makeFileWritable");async function jq(n,e,t,r,i){e||await Xr.mkdir(r),await Dq(await Xr.opendir(t),async s=>{let a=xf.join(t,s.name),c=xf.join(r,s.name);if(await jI(a,c,i)){let{destStat:u}=await Cf.checkPaths(a,c,"copy",i);await $I(u,a,c,i)}}),e||await Xr.chmod(r,n.mode)}o(jq,"onDir");async function $q(n,e,t,r){let i=await Xr.readlink(e);if(r.dereference&&(i=xf.resolve(process.cwd(),i)),!n)return Xr.symlink(i,t);let s=null;try{s=await Xr.readlink(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Xr.symlink(i,t);throw a}if(r.dereference&&(s=xf.resolve(process.cwd(),s)),Cf.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Cf.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await Xr.unlink(t),Xr.symlink(i,t)}o($q,"onLink");VI.exports=Nq});var zI=S((Yce,GI)=>{"use strict";var gn=Ol(),If=require("path"),Vq=Bi().mkdirsSync,Bq=lw().utimesMillisSync,Rf=Ko();function Uq(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;
460
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await Cf.checkPaths(n,e,"copy",t);if(await Cf.checkParentPaths(n,r,e,"copy"),!await jI(n,e,t))return;let a=xf.dirname(e);await Oq(a)||await Pq(a),await $I(i,n,e,t)}o(Nq,"copy");async function jI(n,e,t){return t.filter?t.filter(n,e):!0}o(jI,"runFilter");async function $I(n,e,t,r){let s=await(r.dereference?Jr.stat:Jr.lstat)(e);if(s.isDirectory())return jq(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Lq(s,n,e,t,r);if(s.isSymbolicLink())return $q(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($I,"getStatsAndPerformCopy");async function Lq(n,e,t,r,i){if(!e)return MI(n,t,r,i);if(i.overwrite)return await Jr.unlink(r),MI(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}o(Lq,"onFile");async function MI(n,e,t,r){if(await Jr.copyFile(e,t),r.preserveTimestamps){kq(n.mode)&&await Mq(t,n.mode);let i=await Jr.stat(e);await Fq(t,i.atime,i.mtime)}return Jr.chmod(t,n.mode)}o(MI,"copyFile");function kq(n){return(n&128)===0}o(kq,"fileIsNotWritable");function Mq(n,e){return Jr.chmod(n,e|128)}o(Mq,"makeFileWritable");async function jq(n,e,t,r,i){e||await Jr.mkdir(r),await Dq(await Jr.opendir(t),async s=>{let a=xf.join(t,s.name),c=xf.join(r,s.name);if(await jI(a,c,i)){let{destStat:u}=await Cf.checkPaths(a,c,"copy",i);await $I(u,a,c,i)}}),e||await Jr.chmod(r,n.mode)}o(jq,"onDir");async function $q(n,e,t,r){let i=await Jr.readlink(e);if(r.dereference&&(i=xf.resolve(process.cwd(),i)),!n)return Jr.symlink(i,t);let s=null;try{s=await Jr.readlink(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Jr.symlink(i,t);throw a}if(r.dereference&&(s=xf.resolve(process.cwd(),s)),Cf.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Cf.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await Jr.unlink(t),Jr.symlink(i,t)}o($q,"onLink");VI.exports=Nq});var zI=S((Yce,GI)=>{"use strict";var gn=Ol(),If=require("path"),Vq=Bi().mkdirsSync,Bq=lw().utimesMillisSync,Rf=Ko();function Uq(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;
461
461
 
462
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=Rf.checkPathsSync(n,e,"copy",t);if(Rf.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=If.dirname(e);return gn.existsSync(s)||Vq(s),UI(i,n,e,t)}o(Uq,"copySync");function UI(n,e,t,r){let s=(r.dereference?gn.statSync:gn.lstatSync)(e);if(s.isDirectory())return Yq(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return qq(s,n,e,t,r);if(s.isSymbolicLink())return Jq(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(UI,"getStats");function qq(n,e,t,r,i){return e?Wq(n,t,r,i):qI(n,t,r,i)}o(qq,"onFile");function Wq(n,e,t,r){if(r.overwrite)return gn.unlinkSync(t),qI(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}o(Wq,"mayCopyFile");function qI(n,e,t,r){return gn.copyFileSync(e,t),r.preserveTimestamps&&Gq(n.mode,e,t),fw(t,n.mode)}o(qI,"copyFile");function Gq(n,e,t){return zq(n)&&Hq(t,n),Qq(e,t)}o(Gq,"handleTimestamps");function zq(n){return(n&128)===0}o(zq,"fileIsNotWritable");function Hq(n,e){return fw(n,e|128)}o(Hq,"makeFileWritable");function fw(n,e){return gn.chmodSync(n,e)}o(fw,"setDestMode");function Qq(n,e){let t=gn.statSync(n);return Bq(e,t.atime,t.mtime)}o(Qq,"setDestTimestamps");function Yq(n,e,t,r,i){return e?WI(t,r,i):Kq(n.mode,t,r,i)}o(Yq,"onDir");function Kq(n,e,t,r){return gn.mkdirSync(t),WI(e,t,r),fw(t,n)}o(Kq,"mkDirAndCopy");function WI(n,e,t){let r=gn.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)Xq(i.name,n,e,t)}finally{r.closeSync()}}o(WI,"copyDir");function Xq(n,e,t,r){let i=If.join(e,n),s=If.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:a}=Rf.checkPathsSync(i,s,"copy",r);return UI(a,i,s,r)}o(Xq,"copyDirItem");function Jq(n,e,t,r){let i=gn.readlinkSync(e);if(r.dereference&&(i=If.resolve(process.cwd(),i)),n){let s;try{s=gn.readlinkSync(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return gn.symlinkSync(i,t);throw a}if(r.dereference&&(s=If.resolve(process.cwd(),s)),Rf.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Rf.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return Zq(i,t)}else return gn.symlinkSync(i,t)}o(Jq,"onLink");function Zq(n,e){return gn.unlinkSync(e),gn.symlinkSync(n,e)}o(Zq,"copyLink");GI.exports=Uq});var cg=S((Xce,HI)=>{"use strict";var eW=br().fromPromise;HI.exports={copy:eW(BI()),copySync:zI()}});var Pf=S((Jce,YI)=>{"use strict";var QI=Ol(),tW=br().fromCallback;function rW(n,e){QI.rm(n,{recursive:!0,force:!0},e)}o(rW,"remove");function nW(n){QI.rmSync(n,{recursive:!0,force:!0})}o(nW,"removeSync");YI.exports={remove:tW(rW),removeSync:nW}});var nR=S((ele,rR)=>{"use strict";var iW=br().fromPromise,JI=mn(),ZI=require("path"),eR=Bi(),tR=Pf(),KI=iW(o(async function(e){let t;try{t=await JI.readdir(e)}catch{return eR.mkdirs(e)}return Promise.all(t.map(r=>tR.remove(ZI.join(e,r))))},"emptyDir"));function XI(n){let e;try{e=JI.readdirSync(n)}catch{return eR.mkdirsSync(n)}e.forEach(t=>{t=ZI.join(n,t),tR.removeSync(t)})}o(XI,"emptyDirSync");rR.exports={emptyDirSync:XI,emptydirSync:XI,emptyDir:KI,emptydir:KI}});var oR=S((rle,aR)=>{"use strict";var sW=br().fromPromise,iR=require("path"),ua=mn(),sR=Bi();async function aW(n){let e;try{e=await ua.stat(n)}catch{}if(e&&e.isFile())return;let t=iR.dirname(n),r=null;try{r=await ua.stat(t)}catch(i){if(i.code==="ENOENT"){await sR.mkdirs(t),await ua.writeFile(n,"");return}else throw i}r.isDirectory()?await ua.writeFile(n,""):await ua.readdir(t)}o(aW,"createFile");function oW(n){let e;try{e=ua.statSync(n)}catch{}if(e&&e.isFile())return;let t=iR.dirname(n);try{ua.statSync(t).isDirectory()||ua.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")sR.mkdirsSync(t);else throw r}ua.writeFileSync(n,"")}o(oW,"createFileSync");aR.exports={createFile:sW(aW),createFileSync:oW}});var dR=S((ile,fR)=>{"use strict";var cW=br().fromPromise,cR=require("path"),Ha=mn(),lR=Bi(),{pathExists:lW}=za(),{areIdentical:uR}=Ko();async function uW(n,e){let t;try{t=await Ha.lstat(e)}catch{}let r;try{r=await Ha.lstat(n)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(t&&uR(r,t))return;let i=cR.dirname(e);await lW(i)||await lR.mkdirs(i),await Ha.link(n,e)}o(uW,"createLink");function fW(n,e){let t;try{t=Ha.lstatSync(e)}catch{}try{let s=Ha.lstatSync(n);if(t&&uR(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=cR.dirname(e);return Ha.existsSync(r)||lR.mkdirsSync(r),Ha.linkSync(n,e)}o(fW,"createLinkSync");fR.exports={createLink:cW(uW),createLinkSync:fW}});var pR=S((ale,hR)=>{"use strict";var Qa=require("path"),Of=mn(),{pathExists:dW}=za(),hW=br().fromPromise;async function pW(n,e){if(Qa.isAbsolute(n)){try{await Of.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=Qa.dirname(e),r=Qa.join(t,n);if(await dW(r))return{toCwd:r,toDst:n};try{await Of.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:Qa.relative(t,n)}}o(pW,"symlinkPaths");function mW(n,e){if(Qa.isAbsolute(n)){if(!Of.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=Qa.dirname(e),r=Qa.join(t,n);if(Of.existsSync(r))return{toCwd:r,toDst:n};if(!Of.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:Qa.relative(t,n)}}o(mW,"symlinkPathsSync");hR.exports={symlinkPaths:hW(pW),symlinkPathsSync:mW}});var yR=S((cle,gR)=>{"use strict";var mR=mn(),gW=br().fromPromise;async function yW(n,e){if(e)return e;let t;try{t=await mR.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(yW,"symlinkType");function _W(n,e){if(e)return e;let t;try{t=mR.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(_W,"symlinkTypeSync");gR.exports={symlinkType:gW(yW),symlinkTypeSync:_W}});var bR=S((ule,vR)=>{"use strict";var SW=br().fromPromise,_R=require("path"),ws=mn(),{mkdirs:vW,mkdirsSync:bW}=Bi(),{symlinkPaths:wW,symlinkPathsSync:EW}=pR(),{symlinkType:TW,symlinkTypeSync:AW}=yR(),{pathExists:xW}=za(),{areIdentical:SR}=Ko();async function CW(n,e,t){let r;try{r=await ws.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([ws.stat(n),ws.stat(e)]);if(SR(c,l))return}let i=await wW(n,e);n=i.toDst;let s=await TW(i.toCwd,t),a=_R.dirname(e);return await xW(a)||await vW(a),ws.symlink(n,e,s)}o(CW,"createSymlink");function IW(n,e,t){let r;try{r=ws.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=ws.statSync(n),l=ws.statSync(e);if(SR(c,l))return}let i=EW(n,e);n=i.toDst,t=AW(i.toCwd,t);let s=_R.dirname(e);return ws.existsSync(s)||bW(s),ws.symlinkSync(n,e,t)}o(IW,"createSymlinkSync");vR.exports={createSymlink:SW(CW),createSymlinkSync:IW}});var RR=S((dle,IR)=>{"use strict";var{createFile:wR,createFileSync:ER}=oR(),{createLink:TR,createLinkSync:AR}=dR(),{createSymlink:xR,createSymlinkSync:CR}=bR();IR.exports={createFile:wR,createFileSync:ER,ensureFile:wR,ensureFileSync:ER,createLink:TR,createLinkSync:AR,ensureLink:TR,ensureLinkSync:AR,createSymlink:xR,createSymlinkSync:CR,ensureSymlink:xR,ensureSymlinkSync:CR}});var lg=S((hle,PR)=>{function RW(n,{EOL:e=`
463
- `,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(RW,"stringify");function PW(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(PW,"stripBom");PR.exports={stringify:RW,stripBom:PW}});var NR=S((mle,DR)=>{var Nl;try{Nl=Ol()}catch{Nl=require("fs")}var ug=br(),{stringify:OR,stripBom:FR}=lg();async function OW(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Nl,r="throws"in e?e.throws:!0,i=await ug.fromCallback(t.readFile)(n,e);i=FR(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(OW,"_readFile");var FW=ug.fromPromise(OW);function DW(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Nl,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=FR(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(DW,"readFileSync");async function NW(n,e,t={}){let r=t.fs||Nl,i=OR(e,t);await ug.fromCallback(r.writeFile)(n,i,t)}o(NW,"_writeFile");var LW=ug.fromPromise(NW);function kW(n,e,t={}){let r=t.fs||Nl,i=OR(e,t);return r.writeFileSync(n,i,t)}o(kW,"writeFileSync");DR.exports={readFile:FW,readFileSync:DW,writeFile:LW,writeFileSync:kW}});var kR=S((yle,LR)=>{"use strict";var fg=NR();LR.exports={readJson:fg.readFile,readJsonSync:fg.readFileSync,writeJson:fg.writeFile,writeJsonSync:fg.writeFileSync}});var dg=S((_le,$R)=>{"use strict";var MW=br().fromPromise,dw=mn(),MR=require("path"),jR=Bi(),jW=za().pathExists;async function $W(n,e,t="utf-8"){let r=MR.dirname(n);return await jW(r)||await jR.mkdirs(r),dw.writeFile(n,e,t)}o($W,"outputFile");function VW(n,...e){let t=MR.dirname(n);dw.existsSync(t)||jR.mkdirsSync(t),dw.writeFileSync(n,...e)}o(VW,"outputFileSync");$R.exports={outputFile:MW($W),outputFileSync:VW}});var BR=S((vle,VR)=>{"use strict";var{stringify:BW}=lg(),{outputFile:UW}=dg();async function qW(n,e,t={}){let r=BW(e,t);await UW(n,r,t)}o(qW,"outputJson");VR.exports=qW});var qR=S((wle,UR)=>{"use strict";var{stringify:WW}=lg(),{outputFileSync:GW}=dg();function zW(n,e,t){let r=WW(e,t);GW(n,r,t)}o(zW,"outputJsonSync");UR.exports=zW});var GR=S((Tle,WR)=>{"use strict";var HW=br().fromPromise,yn=kR();yn.outputJson=HW(BR());yn.outputJsonSync=qR();yn.outputJSON=yn.outputJson;yn.outputJSONSync=yn.outputJsonSync;yn.writeJSON=yn.writeJson;yn.writeJSONSync=yn.writeJsonSync;yn.readJSON=yn.readJson;yn.readJSONSync=yn.readJsonSync;WR.exports=yn});var KR=S((Ale,YR)=>{"use strict";var QW=mn(),zR=require("path"),{copy:YW}=cg(),{remove:QR}=Pf(),{mkdirp:KW}=Bi(),{pathExists:XW}=za(),HR=Ko();async function JW(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await HR.checkPaths(n,e,"move",t);await HR.checkParentPaths(n,i,e,"move");let a=zR.dirname(e);return zR.parse(a).root!==a&&await KW(a),ZW(n,e,r,s)}o(JW,"move");async function ZW(n,e,t,r){if(!r){if(t)await QR(e);else if(await XW(e))throw new Error("dest already exists.")}try{await QW.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await eG(n,e,t)}}o(ZW,"doRename");async function eG(n,e,t){return await YW(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),QR(n)}o(eG,"moveAcrossDevice");YR.exports=JW});var tP=S((Cle,eP)=>{"use strict";var JR=Ol(),pw=require("path"),tG=cg().copySync,ZR=Pf().removeSync,rG=Bi().mkdirpSync,XR=Ko();function nG(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=XR.checkPathsSync(n,e,"move",t);return XR.checkParentPathsSync(n,i,e,"move"),iG(e)||rG(pw.dirname(e)),sG(n,e,r,s)}o(nG,"moveSync");function iG(n){let e=pw.dirname(n);return pw.parse(e).root===e}o(iG,"isParentRoot");function sG(n,e,t,r){if(r)return hw(n,e,t);if(t)return ZR(e),hw(n,e,t);if(JR.existsSync(e))throw new Error("dest already exists.");return hw(n,e,t)}o(sG,"doRename");function hw(n,e,t){try{JR.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return aG(n,e,t)}}o(hw,"rename");function aG(n,e,t){return tG(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),ZR(n)}o(aG,"moveAcrossDevice");eP.exports=nG});var nP=S((Rle,rP)=>{"use strict";var oG=br().fromPromise;rP.exports={move:oG(KR()),moveSync:tP()}});var Ya=S((Ple,iP)=>{"use strict";iP.exports={...mn(),...cg(),...nR(),...RR(),...GR(),...Bi(),...nP(),...dg(),...za(),...Pf()}});var KO=S((cpe,YO)=>{"use strict";YO.exports=HO;function HO(n,e,t){n instanceof RegExp&&(n=zO(n,t)),e instanceof RegExp&&(e=zO(e,t));var r=QO(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(HO,"balanced");function zO(n,e){var t=e.match(n);return t?t[0]:null}o(zO,"maybeMatch");HO.range=QO;function QO(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(QO,"range")});var iF=S((upe,nF)=>{var XO=KO();nF.exports=UQ;var JO="\0SLASH"+Math.random()+"\0",ZO="\0OPEN"+Math.random()+"\0",aE="\0CLOSE"+Math.random()+"\0",eF="\0COMMA"+Math.random()+"\0",tF="\0PERIOD"+Math.random()+"\0";function sE(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(sE,"numeric");function VQ(n){return n.split("\\\\").join(JO).split("\\{").join(ZO).split("\\}").join(aE).split("\\,").join(eF).split("\\.").join(tF)}o(VQ,"escapeBraces");function BQ(n){return n.split(JO).join("\\").split(ZO).join("{").split(aE).join("}").split(eF).join(",").split(tF).join(".")}o(BQ,"unescapeBraces");function rF(n){if(!n)return[""];var e=[],t=XO("{","}",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=rF(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(rF,"parseCommaParts");function UQ(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Jf(VQ(n),!0).map(BQ)):[]}o(UQ,"expandTop");function qQ(n){return"{"+n+"}"}o(qQ,"embrace");function WQ(n){return/^-?0\d/.test(n)}o(WQ,"isPadded");function GQ(n,e){return n<=e}o(GQ,"lte");function zQ(n,e){return n>=e}o(zQ,"gte");function Jf(n,e){var t=[],r=XO("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?Jf(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+aE+r.post,Jf(n)):[n];var h;if(f)h=r.body.split(/\.\./);else if(h=rF(r.body),h.length===1&&(h=Jf(h[0],!1).map(qQ),h.length===1))return s.map(function($){return r.pre+h[0]+$});var p;if(f){var y=sE(h[0]),v=sE(h[1]),E=Math.max(h[0].length,h[1].length),b=h.length==3?Math.max(Math.abs(sE(h[2])),1):1,A=GQ,I=v<y;I&&(b*=-1,A=zQ);var j=h.some(WQ);p=[];for(var B=y;A(B,v);B+=b){var te;if(u)te=String.fromCharCode(B),te==="\\"&&(te="");else if(te=String(B),j){var z=E-te.length;if(z>0){var G=new Array(z+1).join("0");B<0?te="-"+G+te.slice(1):te=G+te}}p.push(te)}}else{p=[];for(var F=0;F<h.length;F++)p.push.apply(p,Jf(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(Jf,"expand")});var HD=S(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.createPathBasedTargetResolver=_a;Nn.createCreateRelatedTaskService=WK;Nn.createCreateRelatedProjectService=GK;Nn.createArchiveAssetService=zK;Nn.createCleanPropertiesService=HK;Nn.createFixMissingLabelService=QK;Nn.createRenameToUidService=YK;Nn.createRepairFolderService=KK;Nn.createPlanForEveningService=XK;Nn.createUpdatePropertyService=JK;Nn.createRemovePropertyService=ZK;Nn.createSetStatusService=eX;function _a(n){return{resolveFile(e){let t=n.getAbstractFileByPath(`${e}.md`);if(!t||!("basename"in t))throw new Error(`Cannot resolve target file for IRI: ${e}`);return t}}}o(_a,"createPathBasedTargetResolver");function WK(n,e,t=_a(n)){return{async execute(r,i){let s=i?.label;if(!s)throw new Error("createRelatedTask requires userInput.label");let a=t.resolveFile(r),c=n.getFrontmatter(a)??{},l=a.parent?.path||"",u={ems__Effort_status:'"[[ems__EffortStatusDraft]]"'},f=i?.parentProperty;f&&a.basename&&(u[f]=`"[[${a.basename}]]"`),await e.createAsset({className:"ems__Task",label:s,folderPath:l,propertyValues:u,parentFile:a,parentMetadata:c})}}}o(WK,"createCreateRelatedTaskService");function GK(n,e,t=_a(n)){return{async execute(r,i){let s=i?.label;if(!s)throw new Error("createRelatedProject requires userInput.label");let a=t.resolveFile(r),c=n.getFrontmatter(a)??{},l=a.parent?.path||"",u={ems__Effort_status:'"[[ems__EffortStatusDraft]]"'},f=i?.parentProperty;f&&a.basename&&(u[f]=`"[[${a.basename}]]"`),await e.createAsset({className:"ems__Project",label:s,folderPath:l,propertyValues:u,parentFile:a,parentMetadata:c})}}}o(GK,"createCreateRelatedProjectService");function zK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r);await e.archiveAsset(i)}}}o(zK,"createArchiveAssetService");function HK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r);await e.cleanEmptyProperties(i)}}}o(HK,"createCleanPropertiesService");function QK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r);await e.fixMissingLabel(i)}}}o(QK,"createFixMissingLabelService");function YK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r),s=n.getFrontmatter(i)??{};await e.renameToUid(i,s)}}}o(YK,"createRenameToUidService");function KK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r),s=n.getFrontmatter(i)??{},a=await e.getExpectedFolder(i,s);if(a===null)throw new Error("repairFolder: cannot determine expected folder (missing exo__Asset_isDefinedBy or referenced asset not found)");(i.parent?.path??"")!==a&&await e.repairFolder(i,a)}}}o(KK,"createRepairFolderService");function XK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r);await e.planForEvening(i)}}}o(XK,"createPlanForEveningService");function JK(n,e,t){return{async execute(r,i){let s=i?.property,a=i?.value;if(!s)throw new Error("updateProperty requires userInput.property");if(a===void 0)throw new Error("updateProperty requires userInput.value");let c=await t.resolveTargetPath(r),l=await n.readFile(c),u=e.updateProperty(l,s,a);await n.updateFile(c,u)}}}o(JK,"createUpdatePropertyService");function ZK(n,e,t){return{async execute(r,i){let s=i?.property;if(!s)throw new Error("removeProperty requires userInput.property");let a=await t.resolveTargetPath(r),c=await n.readFile(a),l=e.removeProperty(c,s);await n.updateFile(a,l)}}}o(ZK,"createRemovePropertyService");function eX(n,e,t){return{async execute(r,i){let s=i?.statusUID;if(!s)throw new Error("setStatus requires userInput.statusUID");let a=await t.resolveTargetPath(r),c=await n.readFile(a),l=e.updateProperty(c,"ems__Effort_status",`"[[${s}]]"`);await n.updateFile(a,l)}}}o(eX,"createSetStatusService")});var QD=S(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.createPathBasedTargetResolver=xt.createSetStatusService=xt.createRemovePropertyService=xt.createUpdatePropertyService=xt.createPlanForEveningService=xt.createRepairFolderService=xt.createRenameToUidService=xt.createFixMissingLabelService=xt.createCleanPropertiesService=xt.createArchiveAssetService=xt.createCreateRelatedProjectService=xt.createCreateRelatedTaskService=void 0;var ui=HD();Object.defineProperty(xt,"createCreateRelatedTaskService",{enumerable:!0,get:o(function(){return ui.createCreateRelatedTaskService},"get")});Object.defineProperty(xt,"createCreateRelatedProjectService",{enumerable:!0,get:o(function(){return ui.createCreateRelatedProjectService},"get")});Object.defineProperty(xt,"createArchiveAssetService",{enumerable:!0,get:o(function(){return ui.createArchiveAssetService},"get")});Object.defineProperty(xt,"createCleanPropertiesService",{enumerable:!0,get:o(function(){return ui.createCleanPropertiesService},"get")});Object.defineProperty(xt,"createFixMissingLabelService",{enumerable:!0,get:o(function(){return ui.createFixMissingLabelService},"get")});Object.defineProperty(xt,"createRenameToUidService",{enumerable:!0,get:o(function(){return ui.createRenameToUidService},"get")});Object.defineProperty(xt,"createRepairFolderService",{enumerable:!0,get:o(function(){return ui.createRepairFolderService},"get")});Object.defineProperty(xt,"createPlanForEveningService",{enumerable:!0,get:o(function(){return ui.createPlanForEveningService},"get")});Object.defineProperty(xt,"createUpdatePropertyService",{enumerable:!0,get:o(function(){return ui.createUpdatePropertyService},"get")});Object.defineProperty(xt,"createRemovePropertyService",{enumerable:!0,get:o(function(){return ui.createRemovePropertyService},"get")});Object.defineProperty(xt,"createSetStatusService",{enumerable:!0,get:o(function(){return ui.createSetStatusService},"get")});Object.defineProperty(xt,"createPathBasedTargetResolver",{enumerable:!0,get:o(function(){return ui.createPathBasedTargetResolver},"get")})});var wX={};Uy(wX,{createProgram:()=>hN});module.exports=zd(wX);var M1e=Y(Hd());var J2=Y(X2(),1),{program:qX,createCommand:WX,createArgument:GX,createOption:zX,CommanderError:HX,InvalidArgumentError:QX,InvalidOptionArgumentError:YX,Command:Te,Argument:KX,Option:XX,Help:JX}=J2.default;var Ql=require("fs"),Xf=require("path"),Gt=Y(Dt());var ar=Y(Ya()),or=Y(require("path"));function vP(n){return typeof n>"u"||n===null}o(vP,"isNothing");function cG(n){return typeof n=="object"&&n!==null}o(cG,"isObject");function lG(n){return Array.isArray(n)?n:vP(n)?[]:[n]}o(lG,"toArray");function uG(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(uG,"extend");function fG(n,e){var t="",r;for(r=0;r<e;r+=1)t+=n;return t}o(fG,"repeat");function dG(n){return n===0&&Number.NEGATIVE_INFINITY===1/n}o(dG,"isNegativeZero");var hG=vP,pG=cG,mG=lG,gG=fG,yG=dG,_G=uG,hr={isNothing:hG,isObject:pG,toArray:mG,repeat:gG,isNegativeZero:yG,extend:_G};function bP(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
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=Rf.checkPathsSync(n,e,"copy",t);if(Rf.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=If.dirname(e);return gn.existsSync(s)||Vq(s),UI(i,n,e,t)}o(Uq,"copySync");function UI(n,e,t,r){let s=(r.dereference?gn.statSync:gn.lstatSync)(e);if(s.isDirectory())return Yq(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return qq(s,n,e,t,r);if(s.isSymbolicLink())return Jq(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(UI,"getStats");function qq(n,e,t,r,i){return e?Wq(n,t,r,i):qI(n,t,r,i)}o(qq,"onFile");function Wq(n,e,t,r){if(r.overwrite)return gn.unlinkSync(t),qI(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}o(Wq,"mayCopyFile");function qI(n,e,t,r){return gn.copyFileSync(e,t),r.preserveTimestamps&&Gq(n.mode,e,t),fw(t,n.mode)}o(qI,"copyFile");function Gq(n,e,t){return zq(n)&&Hq(t,n),Qq(e,t)}o(Gq,"handleTimestamps");function zq(n){return(n&128)===0}o(zq,"fileIsNotWritable");function Hq(n,e){return fw(n,e|128)}o(Hq,"makeFileWritable");function fw(n,e){return gn.chmodSync(n,e)}o(fw,"setDestMode");function Qq(n,e){let t=gn.statSync(n);return Bq(e,t.atime,t.mtime)}o(Qq,"setDestTimestamps");function Yq(n,e,t,r,i){return e?WI(t,r,i):Kq(n.mode,t,r,i)}o(Yq,"onDir");function Kq(n,e,t,r){return gn.mkdirSync(t),WI(e,t,r),fw(t,n)}o(Kq,"mkDirAndCopy");function WI(n,e,t){let r=gn.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)Xq(i.name,n,e,t)}finally{r.closeSync()}}o(WI,"copyDir");function Xq(n,e,t,r){let i=If.join(e,n),s=If.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:a}=Rf.checkPathsSync(i,s,"copy",r);return UI(a,i,s,r)}o(Xq,"copyDirItem");function Jq(n,e,t,r){let i=gn.readlinkSync(e);if(r.dereference&&(i=If.resolve(process.cwd(),i)),n){let s;try{s=gn.readlinkSync(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return gn.symlinkSync(i,t);throw a}if(r.dereference&&(s=If.resolve(process.cwd(),s)),Rf.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Rf.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return Zq(i,t)}else return gn.symlinkSync(i,t)}o(Jq,"onLink");function Zq(n,e){return gn.unlinkSync(e),gn.symlinkSync(n,e)}o(Zq,"copyLink");GI.exports=Uq});var cg=S((Xce,HI)=>{"use strict";var eW=br().fromPromise;HI.exports={copy:eW(BI()),copySync:zI()}});var Pf=S((Jce,YI)=>{"use strict";var QI=Ol(),tW=br().fromCallback;function rW(n,e){QI.rm(n,{recursive:!0,force:!0},e)}o(rW,"remove");function nW(n){QI.rmSync(n,{recursive:!0,force:!0})}o(nW,"removeSync");YI.exports={remove:tW(rW),removeSync:nW}});var nR=S((ele,rR)=>{"use strict";var iW=br().fromPromise,JI=mn(),ZI=require("path"),eR=Bi(),tR=Pf(),KI=iW(o(async function(e){let t;try{t=await JI.readdir(e)}catch{return eR.mkdirs(e)}return Promise.all(t.map(r=>tR.remove(ZI.join(e,r))))},"emptyDir"));function XI(n){let e;try{e=JI.readdirSync(n)}catch{return eR.mkdirsSync(n)}e.forEach(t=>{t=ZI.join(n,t),tR.removeSync(t)})}o(XI,"emptyDirSync");rR.exports={emptyDirSync:XI,emptydirSync:XI,emptyDir:KI,emptydir:KI}});var oR=S((rle,aR)=>{"use strict";var sW=br().fromPromise,iR=require("path"),ua=mn(),sR=Bi();async function aW(n){let e;try{e=await ua.stat(n)}catch{}if(e&&e.isFile())return;let t=iR.dirname(n),r=null;try{r=await ua.stat(t)}catch(i){if(i.code==="ENOENT"){await sR.mkdirs(t),await ua.writeFile(n,"");return}else throw i}r.isDirectory()?await ua.writeFile(n,""):await ua.readdir(t)}o(aW,"createFile");function oW(n){let e;try{e=ua.statSync(n)}catch{}if(e&&e.isFile())return;let t=iR.dirname(n);try{ua.statSync(t).isDirectory()||ua.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")sR.mkdirsSync(t);else throw r}ua.writeFileSync(n,"")}o(oW,"createFileSync");aR.exports={createFile:sW(aW),createFileSync:oW}});var dR=S((ile,fR)=>{"use strict";var cW=br().fromPromise,cR=require("path"),Qa=mn(),lR=Bi(),{pathExists:lW}=Ha(),{areIdentical:uR}=Ko();async function uW(n,e){let t;try{t=await Qa.lstat(e)}catch{}let r;try{r=await Qa.lstat(n)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(t&&uR(r,t))return;let i=cR.dirname(e);await lW(i)||await lR.mkdirs(i),await Qa.link(n,e)}o(uW,"createLink");function fW(n,e){let t;try{t=Qa.lstatSync(e)}catch{}try{let s=Qa.lstatSync(n);if(t&&uR(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=cR.dirname(e);return Qa.existsSync(r)||lR.mkdirsSync(r),Qa.linkSync(n,e)}o(fW,"createLinkSync");fR.exports={createLink:cW(uW),createLinkSync:fW}});var pR=S((ale,hR)=>{"use strict";var Ya=require("path"),Of=mn(),{pathExists:dW}=Ha(),hW=br().fromPromise;async function pW(n,e){if(Ya.isAbsolute(n)){try{await Of.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=Ya.dirname(e),r=Ya.join(t,n);if(await dW(r))return{toCwd:r,toDst:n};try{await Of.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:Ya.relative(t,n)}}o(pW,"symlinkPaths");function mW(n,e){if(Ya.isAbsolute(n)){if(!Of.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=Ya.dirname(e),r=Ya.join(t,n);if(Of.existsSync(r))return{toCwd:r,toDst:n};if(!Of.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:Ya.relative(t,n)}}o(mW,"symlinkPathsSync");hR.exports={symlinkPaths:hW(pW),symlinkPathsSync:mW}});var yR=S((cle,gR)=>{"use strict";var mR=mn(),gW=br().fromPromise;async function yW(n,e){if(e)return e;let t;try{t=await mR.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(yW,"symlinkType");function _W(n,e){if(e)return e;let t;try{t=mR.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(_W,"symlinkTypeSync");gR.exports={symlinkType:gW(yW),symlinkTypeSync:_W}});var bR=S((ule,vR)=>{"use strict";var SW=br().fromPromise,_R=require("path"),ws=mn(),{mkdirs:vW,mkdirsSync:bW}=Bi(),{symlinkPaths:wW,symlinkPathsSync:EW}=pR(),{symlinkType:TW,symlinkTypeSync:AW}=yR(),{pathExists:xW}=Ha(),{areIdentical:SR}=Ko();async function CW(n,e,t){let r;try{r=await ws.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([ws.stat(n),ws.stat(e)]);if(SR(c,l))return}let i=await wW(n,e);n=i.toDst;let s=await TW(i.toCwd,t),a=_R.dirname(e);return await xW(a)||await vW(a),ws.symlink(n,e,s)}o(CW,"createSymlink");function IW(n,e,t){let r;try{r=ws.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=ws.statSync(n),l=ws.statSync(e);if(SR(c,l))return}let i=EW(n,e);n=i.toDst,t=AW(i.toCwd,t);let s=_R.dirname(e);return ws.existsSync(s)||bW(s),ws.symlinkSync(n,e,t)}o(IW,"createSymlinkSync");vR.exports={createSymlink:SW(CW),createSymlinkSync:IW}});var RR=S((dle,IR)=>{"use strict";var{createFile:wR,createFileSync:ER}=oR(),{createLink:TR,createLinkSync:AR}=dR(),{createSymlink:xR,createSymlinkSync:CR}=bR();IR.exports={createFile:wR,createFileSync:ER,ensureFile:wR,ensureFileSync:ER,createLink:TR,createLinkSync:AR,ensureLink:TR,ensureLinkSync:AR,createSymlink:xR,createSymlinkSync:CR,ensureSymlink:xR,ensureSymlinkSync:CR}});var lg=S((hle,PR)=>{function RW(n,{EOL:e=`
463
+ `,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(RW,"stringify");function PW(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(PW,"stripBom");PR.exports={stringify:RW,stripBom:PW}});var NR=S((mle,DR)=>{var Nl;try{Nl=Ol()}catch{Nl=require("fs")}var ug=br(),{stringify:OR,stripBom:FR}=lg();async function OW(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Nl,r="throws"in e?e.throws:!0,i=await ug.fromCallback(t.readFile)(n,e);i=FR(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(OW,"_readFile");var FW=ug.fromPromise(OW);function DW(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Nl,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=FR(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(DW,"readFileSync");async function NW(n,e,t={}){let r=t.fs||Nl,i=OR(e,t);await ug.fromCallback(r.writeFile)(n,i,t)}o(NW,"_writeFile");var LW=ug.fromPromise(NW);function kW(n,e,t={}){let r=t.fs||Nl,i=OR(e,t);return r.writeFileSync(n,i,t)}o(kW,"writeFileSync");DR.exports={readFile:FW,readFileSync:DW,writeFile:LW,writeFileSync:kW}});var kR=S((yle,LR)=>{"use strict";var fg=NR();LR.exports={readJson:fg.readFile,readJsonSync:fg.readFileSync,writeJson:fg.writeFile,writeJsonSync:fg.writeFileSync}});var dg=S((_le,$R)=>{"use strict";var MW=br().fromPromise,dw=mn(),MR=require("path"),jR=Bi(),jW=Ha().pathExists;async function $W(n,e,t="utf-8"){let r=MR.dirname(n);return await jW(r)||await jR.mkdirs(r),dw.writeFile(n,e,t)}o($W,"outputFile");function VW(n,...e){let t=MR.dirname(n);dw.existsSync(t)||jR.mkdirsSync(t),dw.writeFileSync(n,...e)}o(VW,"outputFileSync");$R.exports={outputFile:MW($W),outputFileSync:VW}});var BR=S((vle,VR)=>{"use strict";var{stringify:BW}=lg(),{outputFile:UW}=dg();async function qW(n,e,t={}){let r=BW(e,t);await UW(n,r,t)}o(qW,"outputJson");VR.exports=qW});var qR=S((wle,UR)=>{"use strict";var{stringify:WW}=lg(),{outputFileSync:GW}=dg();function zW(n,e,t){let r=WW(e,t);GW(n,r,t)}o(zW,"outputJsonSync");UR.exports=zW});var GR=S((Tle,WR)=>{"use strict";var HW=br().fromPromise,yn=kR();yn.outputJson=HW(BR());yn.outputJsonSync=qR();yn.outputJSON=yn.outputJson;yn.outputJSONSync=yn.outputJsonSync;yn.writeJSON=yn.writeJson;yn.writeJSONSync=yn.writeJsonSync;yn.readJSON=yn.readJson;yn.readJSONSync=yn.readJsonSync;WR.exports=yn});var KR=S((Ale,YR)=>{"use strict";var QW=mn(),zR=require("path"),{copy:YW}=cg(),{remove:QR}=Pf(),{mkdirp:KW}=Bi(),{pathExists:XW}=Ha(),HR=Ko();async function JW(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await HR.checkPaths(n,e,"move",t);await HR.checkParentPaths(n,i,e,"move");let a=zR.dirname(e);return zR.parse(a).root!==a&&await KW(a),ZW(n,e,r,s)}o(JW,"move");async function ZW(n,e,t,r){if(!r){if(t)await QR(e);else if(await XW(e))throw new Error("dest already exists.")}try{await QW.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await eG(n,e,t)}}o(ZW,"doRename");async function eG(n,e,t){return await YW(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),QR(n)}o(eG,"moveAcrossDevice");YR.exports=JW});var tP=S((Cle,eP)=>{"use strict";var JR=Ol(),pw=require("path"),tG=cg().copySync,ZR=Pf().removeSync,rG=Bi().mkdirpSync,XR=Ko();function nG(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=XR.checkPathsSync(n,e,"move",t);return XR.checkParentPathsSync(n,i,e,"move"),iG(e)||rG(pw.dirname(e)),sG(n,e,r,s)}o(nG,"moveSync");function iG(n){let e=pw.dirname(n);return pw.parse(e).root===e}o(iG,"isParentRoot");function sG(n,e,t,r){if(r)return hw(n,e,t);if(t)return ZR(e),hw(n,e,t);if(JR.existsSync(e))throw new Error("dest already exists.");return hw(n,e,t)}o(sG,"doRename");function hw(n,e,t){try{JR.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return aG(n,e,t)}}o(hw,"rename");function aG(n,e,t){return tG(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),ZR(n)}o(aG,"moveAcrossDevice");eP.exports=nG});var nP=S((Rle,rP)=>{"use strict";var oG=br().fromPromise;rP.exports={move:oG(KR()),moveSync:tP()}});var Ka=S((Ple,iP)=>{"use strict";iP.exports={...mn(),...cg(),...nR(),...RR(),...GR(),...Bi(),...nP(),...dg(),...Ha(),...Pf()}});var KO=S((cpe,YO)=>{"use strict";YO.exports=HO;function HO(n,e,t){n instanceof RegExp&&(n=zO(n,t)),e instanceof RegExp&&(e=zO(e,t));var r=QO(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(HO,"balanced");function zO(n,e){var t=e.match(n);return t?t[0]:null}o(zO,"maybeMatch");HO.range=QO;function QO(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(QO,"range")});var iF=S((upe,nF)=>{var XO=KO();nF.exports=UQ;var JO="\0SLASH"+Math.random()+"\0",ZO="\0OPEN"+Math.random()+"\0",aE="\0CLOSE"+Math.random()+"\0",eF="\0COMMA"+Math.random()+"\0",tF="\0PERIOD"+Math.random()+"\0";function sE(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(sE,"numeric");function VQ(n){return n.split("\\\\").join(JO).split("\\{").join(ZO).split("\\}").join(aE).split("\\,").join(eF).split("\\.").join(tF)}o(VQ,"escapeBraces");function BQ(n){return n.split(JO).join("\\").split(ZO).join("{").split(aE).join("}").split(eF).join(",").split(tF).join(".")}o(BQ,"unescapeBraces");function rF(n){if(!n)return[""];var e=[],t=XO("{","}",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=rF(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(rF,"parseCommaParts");function UQ(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Jf(VQ(n),!0).map(BQ)):[]}o(UQ,"expandTop");function qQ(n){return"{"+n+"}"}o(qQ,"embrace");function WQ(n){return/^-?0\d/.test(n)}o(WQ,"isPadded");function GQ(n,e){return n<=e}o(GQ,"lte");function zQ(n,e){return n>=e}o(zQ,"gte");function Jf(n,e){var t=[],r=XO("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?Jf(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+aE+r.post,Jf(n)):[n];var h;if(f)h=r.body.split(/\.\./);else if(h=rF(r.body),h.length===1&&(h=Jf(h[0],!1).map(qQ),h.length===1))return s.map(function($){return r.pre+h[0]+$});var p;if(f){var y=sE(h[0]),v=sE(h[1]),E=Math.max(h[0].length,h[1].length),b=h.length==3?Math.max(Math.abs(sE(h[2])),1):1,A=GQ,I=v<y;I&&(b*=-1,A=zQ);var j=h.some(WQ);p=[];for(var B=y;A(B,v);B+=b){var te;if(u)te=String.fromCharCode(B),te==="\\"&&(te="");else if(te=String(B),j){var z=E-te.length;if(z>0){var G=new Array(z+1).join("0");B<0?te="-"+G+te.slice(1):te=G+te}}p.push(te)}}else{p=[];for(var F=0;F<h.length;F++)p.push.apply(p,Jf(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(Jf,"expand")});var HD=S(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.createPathBasedTargetResolver=_a;Nn.createCreateRelatedTaskService=WK;Nn.createCreateRelatedProjectService=GK;Nn.createArchiveAssetService=zK;Nn.createCleanPropertiesService=HK;Nn.createFixMissingLabelService=QK;Nn.createRenameToUidService=YK;Nn.createRepairFolderService=KK;Nn.createPlanForEveningService=XK;Nn.createUpdatePropertyService=JK;Nn.createRemovePropertyService=ZK;Nn.createSetStatusService=eX;function _a(n){return{resolveFile(e){let t=n.getAbstractFileByPath(`${e}.md`);if(!t||!("basename"in t))throw new Error(`Cannot resolve target file for IRI: ${e}`);return t}}}o(_a,"createPathBasedTargetResolver");function WK(n,e,t=_a(n)){return{async execute(r,i){let s=i?.label;if(!s)throw new Error("createRelatedTask requires userInput.label");let a=t.resolveFile(r),c=n.getFrontmatter(a)??{},l=a.parent?.path||"",u={ems__Effort_status:'"[[ems__EffortStatusDraft]]"'},f=i?.parentProperty;f&&a.basename&&(u[f]=`"[[${a.basename}]]"`),await e.createAsset({className:"ems__Task",label:s,folderPath:l,propertyValues:u,parentFile:a,parentMetadata:c})}}}o(WK,"createCreateRelatedTaskService");function GK(n,e,t=_a(n)){return{async execute(r,i){let s=i?.label;if(!s)throw new Error("createRelatedProject requires userInput.label");let a=t.resolveFile(r),c=n.getFrontmatter(a)??{},l=a.parent?.path||"",u={ems__Effort_status:'"[[ems__EffortStatusDraft]]"'},f=i?.parentProperty;f&&a.basename&&(u[f]=`"[[${a.basename}]]"`),await e.createAsset({className:"ems__Project",label:s,folderPath:l,propertyValues:u,parentFile:a,parentMetadata:c})}}}o(GK,"createCreateRelatedProjectService");function zK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r);await e.archiveAsset(i)}}}o(zK,"createArchiveAssetService");function HK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r);await e.cleanEmptyProperties(i)}}}o(HK,"createCleanPropertiesService");function QK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r);await e.fixMissingLabel(i)}}}o(QK,"createFixMissingLabelService");function YK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r),s=n.getFrontmatter(i)??{};await e.renameToUid(i,s)}}}o(YK,"createRenameToUidService");function KK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r),s=n.getFrontmatter(i)??{},a=await e.getExpectedFolder(i,s);if(a===null)throw new Error("repairFolder: cannot determine expected folder (missing exo__Asset_isDefinedBy or referenced asset not found)");(i.parent?.path??"")!==a&&await e.repairFolder(i,a)}}}o(KK,"createRepairFolderService");function XK(n,e,t=_a(n)){return{async execute(r){let i=t.resolveFile(r);await e.planForEvening(i)}}}o(XK,"createPlanForEveningService");function JK(n,e,t){return{async execute(r,i){let s=i?.property,a=i?.value;if(!s)throw new Error("updateProperty requires userInput.property");if(a===void 0)throw new Error("updateProperty requires userInput.value");let c=await t.resolveTargetPath(r),l=await n.readFile(c),u=e.updateProperty(l,s,a);await n.updateFile(c,u)}}}o(JK,"createUpdatePropertyService");function ZK(n,e,t){return{async execute(r,i){let s=i?.property;if(!s)throw new Error("removeProperty requires userInput.property");let a=await t.resolveTargetPath(r),c=await n.readFile(a),l=e.removeProperty(c,s);await n.updateFile(a,l)}}}o(ZK,"createRemovePropertyService");function eX(n,e,t){return{async execute(r,i){let s=i?.statusUID;if(!s)throw new Error("setStatus requires userInput.statusUID");let a=await t.resolveTargetPath(r),c=await n.readFile(a),l=e.updateProperty(c,"ems__Effort_status",`"[[${s}]]"`);await n.updateFile(a,l)}}}o(eX,"createSetStatusService")});var QD=S(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.createPathBasedTargetResolver=xt.createSetStatusService=xt.createRemovePropertyService=xt.createUpdatePropertyService=xt.createPlanForEveningService=xt.createRepairFolderService=xt.createRenameToUidService=xt.createFixMissingLabelService=xt.createCleanPropertiesService=xt.createArchiveAssetService=xt.createCreateRelatedProjectService=xt.createCreateRelatedTaskService=void 0;var ui=HD();Object.defineProperty(xt,"createCreateRelatedTaskService",{enumerable:!0,get:o(function(){return ui.createCreateRelatedTaskService},"get")});Object.defineProperty(xt,"createCreateRelatedProjectService",{enumerable:!0,get:o(function(){return ui.createCreateRelatedProjectService},"get")});Object.defineProperty(xt,"createArchiveAssetService",{enumerable:!0,get:o(function(){return ui.createArchiveAssetService},"get")});Object.defineProperty(xt,"createCleanPropertiesService",{enumerable:!0,get:o(function(){return ui.createCleanPropertiesService},"get")});Object.defineProperty(xt,"createFixMissingLabelService",{enumerable:!0,get:o(function(){return ui.createFixMissingLabelService},"get")});Object.defineProperty(xt,"createRenameToUidService",{enumerable:!0,get:o(function(){return ui.createRenameToUidService},"get")});Object.defineProperty(xt,"createRepairFolderService",{enumerable:!0,get:o(function(){return ui.createRepairFolderService},"get")});Object.defineProperty(xt,"createPlanForEveningService",{enumerable:!0,get:o(function(){return ui.createPlanForEveningService},"get")});Object.defineProperty(xt,"createUpdatePropertyService",{enumerable:!0,get:o(function(){return ui.createUpdatePropertyService},"get")});Object.defineProperty(xt,"createRemovePropertyService",{enumerable:!0,get:o(function(){return ui.createRemovePropertyService},"get")});Object.defineProperty(xt,"createSetStatusService",{enumerable:!0,get:o(function(){return ui.createSetStatusService},"get")});Object.defineProperty(xt,"createPathBasedTargetResolver",{enumerable:!0,get:o(function(){return ui.createPathBasedTargetResolver},"get")})});var wX={};Uy(wX,{createProgram:()=>hN});module.exports=zd(wX);var M1e=Y(Hd());var J2=Y(X2(),1),{program:qX,createCommand:WX,createArgument:GX,createOption:zX,CommanderError:HX,InvalidArgumentError:QX,InvalidOptionArgumentError:YX,Command:Te,Argument:KX,Option:XX,Help:JX}=J2.default;var Ql=require("fs"),Xf=require("path"),zt=Y(Dt());var ar=Y(Ka()),or=Y(require("path"));function vP(n){return typeof n>"u"||n===null}o(vP,"isNothing");function cG(n){return typeof n=="object"&&n!==null}o(cG,"isObject");function lG(n){return Array.isArray(n)?n:vP(n)?[]:[n]}o(lG,"toArray");function uG(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(uG,"extend");function fG(n,e){var t="",r;for(r=0;r<e;r+=1)t+=n;return t}o(fG,"repeat");function dG(n){return n===0&&Number.NEGATIVE_INFINITY===1/n}o(dG,"isNegativeZero");var hG=vP,pG=cG,mG=lG,gG=fG,yG=dG,_G=uG,hr={isNothing:hG,isObject:pG,toArray:mG,repeat:gG,isNegativeZero:yG,extend:_G};function bP(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+=`
464
464
 
465
465
  `+n.mark.snippet),r+" "+t):r}o(bP,"formatError");function Df(n,e){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=e,this.message=bP(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}o(Df,"YAMLException$1");Df.prototype=Object.create(Error.prototype);Df.prototype.constructor=Df;Df.prototype.toString=o(function(e){return this.name+": "+bP(this,e)},"toString");var _n=Df;function mw(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(mw,"getLine");function gw(n,e){return hr.repeat(" ",e-n.length)+n}o(gw,"padStart");function SG(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=mw(n.buffer,r[a-l],i[a-l],n.position-(r[a]-r[a-l]),d),c=hr.repeat(" ",e.indent)+gw((n.line-l+1).toString(),f)+" | "+u.str+`
466
466
  `+c;for(u=mw(n.buffer,r[a],i[a],n.position,d),c+=hr.repeat(" ",e.indent)+gw((n.line+1).toString(),f)+" | "+u.str+`
467
467
  `,c+=hr.repeat("-",e.indent+f+3+u.pos)+`^
468
468
  `,l=1;l<=e.linesAfter&&!(a+l>=i.length);l++)u=mw(n.buffer,r[a+l],i[a+l],n.position-(r[a]-r[a+l]),d),c+=hr.repeat(" ",e.indent)+gw((n.line+l+1).toString(),f)+" | "+u.str+`
469
469
  `;return c.replace(/\n$/,"")}o(SG,"makeSnippet");var vG=SG,bG=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],wG=["scalar","sequence","mapping"];function EG(n){var e={};return n!==null&&Object.keys(n).forEach(function(t){n[t].forEach(function(r){e[String(r)]=t})}),e}o(EG,"compileStyleAliases");function TG(n,e){if(e=e||{},Object.keys(e).forEach(function(t){if(bG.indexOf(t)===-1)throw new _n('Unknown option "'+t+'" is met in definition of "'+n+'" YAML type.')}),this.options=e,this.tag=n,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=EG(e.styleAliases||null),wG.indexOf(this.kind)===-1)throw new _n('Unknown kind "'+this.kind+'" is specified for "'+n+'" YAML type.')}o(TG,"Type$1");var jr=TG;function sP(n,e){var t=[];return n[e].forEach(function(r){var i=t.length;t.forEach(function(s,a){s.tag===r.tag&&s.kind===r.kind&&s.multi===r.multi&&(i=a)}),t[i]=r}),t}o(sP,"compileList");function AG(){var n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,t;function r(i){i.multi?(n.multi[i.kind].push(i),n.multi.fallback.push(i)):n[i.kind][i.tag]=n.fallback[i.tag]=i}for(o(r,"collectType"),e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return n}o(AG,"compileMap");function _w(n){return this.extend(n)}o(_w,"Schema$1");_w.prototype.extend=o(function(e){var t=[],r=[];if(e instanceof jr)r.push(e);else if(Array.isArray(e))r=r.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(r=r.concat(e.explicit));else throw new _n("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(s){if(!(s instanceof jr))throw new _n("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new _n("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new _n("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(s){if(!(s instanceof jr))throw new _n("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(_w.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=sP(i,"implicit"),i.compiledExplicit=sP(i,"explicit"),i.compiledTypeMap=AG(i.compiledImplicit,i.compiledExplicit),i},"extend");var wP=_w,EP=new jr("tag:yaml.org,2002:str",{kind:"scalar",construct:o(function(n){return n!==null?n:""},"construct")}),TP=new jr("tag:yaml.org,2002:seq",{kind:"sequence",construct:o(function(n){return n!==null?n:[]},"construct")}),AP=new jr("tag:yaml.org,2002:map",{kind:"mapping",construct:o(function(n){return n!==null?n:{}},"construct")}),xP=new wP({explicit:[EP,TP,AP]});function xG(n){if(n===null)return!0;var e=n.length;return e===1&&n==="~"||e===4&&(n==="null"||n==="Null"||n==="NULL")}o(xG,"resolveYamlNull");function CG(){return null}o(CG,"constructYamlNull");function IG(n){return n===null}o(IG,"isNull");var CP=new jr("tag:yaml.org,2002:null",{kind:"scalar",resolve:xG,construct:CG,predicate:IG,represent:{canonical:o(function(){return"~"},"canonical"),lowercase:o(function(){return"null"},"lowercase"),uppercase:o(function(){return"NULL"},"uppercase"),camelcase:o(function(){return"Null"},"camelcase"),empty:o(function(){return""},"empty")},defaultStyle:"lowercase"});function RG(n){if(n===null)return!1;var e=n.length;return e===4&&(n==="true"||n==="True"||n==="TRUE")||e===5&&(n==="false"||n==="False"||n==="FALSE")}o(RG,"resolveYamlBoolean");function PG(n){return n==="true"||n==="True"||n==="TRUE"}o(PG,"constructYamlBoolean");function OG(n){return Object.prototype.toString.call(n)==="[object Boolean]"}o(OG,"isBoolean");var IP=new jr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:RG,construct:PG,predicate:OG,represent:{lowercase:o(function(n){return n?"true":"false"},"lowercase"),uppercase:o(function(n){return n?"TRUE":"FALSE"},"uppercase"),camelcase:o(function(n){return n?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function FG(n){return 48<=n&&n<=57||65<=n&&n<=70||97<=n&&n<=102}o(FG,"isHexCode");function DG(n){return 48<=n&&n<=55}o(DG,"isOctCode");function NG(n){return 48<=n&&n<=57}o(NG,"isDecCode");function LG(n){if(n===null)return!1;var e=n.length,t=0,r=!1,i;if(!e)return!1;if(i=n[t],(i==="-"||i==="+")&&(i=n[++t]),i==="0"){if(t+1===e)return!0;if(i=n[++t],i==="b"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(!FG(n.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(!DG(n.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;t<e;t++)if(i=n[t],i!=="_"){if(!NG(n.charCodeAt(t)))return!1;r=!0}return!(!r||i==="_")}o(LG,"resolveYamlInteger");function kG(n){var e=n,t=1,r;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),r=e[0],(r==="-"||r==="+")&&(r==="-"&&(t=-1),e=e.slice(1),r=e[0]),e==="0")return 0;if(r==="0"){if(e[1]==="b")return t*parseInt(e.slice(2),2);if(e[1]==="x")return t*parseInt(e.slice(2),16);if(e[1]==="o")return t*parseInt(e.slice(2),8)}return t*parseInt(e,10)}o(kG,"constructYamlInteger");function MG(n){return Object.prototype.toString.call(n)==="[object Number]"&&n%1===0&&!hr.isNegativeZero(n)}o(MG,"isInteger");var RP=new jr("tag:yaml.org,2002:int",{kind:"scalar",resolve:LG,construct:kG,predicate:MG,represent:{binary:o(function(n){return n>=0?"0b"+n.toString(2):"-0b"+n.toString(2).slice(1)},"binary"),octal:o(function(n){return n>=0?"0o"+n.toString(8):"-0o"+n.toString(8).slice(1)},"octal"),decimal:o(function(n){return n.toString(10)},"decimal"),hexadecimal:o(function(n){return n>=0?"0x"+n.toString(16).toUpperCase():"-0x"+n.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),jG=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function $G(n){return!(n===null||!jG.test(n)||n[n.length-1]==="_")}o($G,"resolveYamlFloat");function VG(n){var e,t;return e=n.replace(/_/g,"").toLowerCase(),t=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:t*parseFloat(e,10)}o(VG,"constructYamlFloat");var BG=/^[-+]?[0-9]+e/;function UG(n,e){var t;if(isNaN(n))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===n)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===n)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(hr.isNegativeZero(n))return"-0.0";return t=n.toString(10),BG.test(t)?t.replace("e",".e"):t}o(UG,"representYamlFloat");function qG(n){return Object.prototype.toString.call(n)==="[object Number]"&&(n%1!==0||hr.isNegativeZero(n))}o(qG,"isFloat");var PP=new jr("tag:yaml.org,2002:float",{kind:"scalar",resolve:$G,construct:VG,predicate:qG,represent:UG,defaultStyle:"lowercase"}),OP=xP.extend({implicit:[CP,IP,RP,PP]}),FP=OP,DP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),NP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function WG(n){return n===null?!1:DP.exec(n)!==null||NP.exec(n)!==null}o(WG,"resolveYamlTimestamp");function GG(n){var e,t,r,i,s,a,c,l=0,u=null,f,d,h;if(e=DP.exec(n),e===null&&(e=NP.exec(n)),e===null)throw new Error("Date resolve error");if(t=+e[1],r=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(t,r,i));if(s=+e[4],a=+e[5],c=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(f=+e[10],d=+(e[11]||0),u=(f*60+d)*6e4,e[9]==="-"&&(u=-u)),h=new Date(Date.UTC(t,r,i,s,a,c,l)),u&&h.setTime(h.getTime()-u),h}o(GG,"constructYamlTimestamp");function zG(n){return n.toISOString()}o(zG,"representYamlTimestamp");var LP=new jr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:WG,construct:GG,instanceOf:Date,represent:zG});function HG(n){return n==="<<"||n===null}o(HG,"resolveYamlMerge");var kP=new jr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:HG}),Ew=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
470
- \r`;function QG(n){if(n===null)return!1;var e,t,r=0,i=n.length,s=Ew;for(t=0;t<i;t++)if(e=s.indexOf(n.charAt(t)),!(e>64)){if(e<0)return!1;r+=6}return r%8===0}o(QG,"resolveYamlBinary");function YG(n){var e,t,r=n.replace(/[\r\n=]/g,""),i=r.length,s=Ew,a=0,c=[];for(e=0;e<i;e++)e%4===0&&e&&(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)),a=a<<6|s.indexOf(r.charAt(e));return t=i%4*6,t===0?(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)):t===18?(c.push(a>>10&255),c.push(a>>2&255)):t===12&&c.push(a>>4&255),new Uint8Array(c)}o(YG,"constructYamlBinary");function KG(n){var e="",t=0,r,i,s=n.length,a=Ew;for(r=0;r<s;r++)r%3===0&&r&&(e+=a[t>>18&63],e+=a[t>>12&63],e+=a[t>>6&63],e+=a[t&63]),t=(t<<8)+n[r];return i=s%3,i===0?(e+=a[t>>18&63],e+=a[t>>12&63],e+=a[t>>6&63],e+=a[t&63]):i===2?(e+=a[t>>10&63],e+=a[t>>4&63],e+=a[t<<2&63],e+=a[64]):i===1&&(e+=a[t>>2&63],e+=a[t<<4&63],e+=a[64],e+=a[64]),e}o(KG,"representYamlBinary");function XG(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}o(XG,"isBinary");var MP=new jr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:QG,construct:YG,predicate:XG,represent:KG}),JG=Object.prototype.hasOwnProperty,ZG=Object.prototype.toString;function ez(n){if(n===null)return!0;var e=[],t,r,i,s,a,c=n;for(t=0,r=c.length;t<r;t+=1){if(i=c[t],a=!1,ZG.call(i)!=="[object Object]")return!1;for(s in i)if(JG.call(i,s))if(!a)a=!0;else return!1;if(!a)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}o(ez,"resolveYamlOmap");function tz(n){return n!==null?n:[]}o(tz,"constructYamlOmap");var jP=new jr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:ez,construct:tz}),rz=Object.prototype.toString;function nz(n){if(n===null)return!0;var e,t,r,i,s,a=n;for(s=new Array(a.length),e=0,t=a.length;e<t;e+=1){if(r=a[e],rz.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[e]=[i[0],r[i[0]]]}return!0}o(nz,"resolveYamlPairs");function iz(n){if(n===null)return[];var e,t,r,i,s,a=n;for(s=new Array(a.length),e=0,t=a.length;e<t;e+=1)r=a[e],i=Object.keys(r),s[e]=[i[0],r[i[0]]];return s}o(iz,"constructYamlPairs");var $P=new jr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:nz,construct:iz}),sz=Object.prototype.hasOwnProperty;function az(n){if(n===null)return!0;var e,t=n;for(e in t)if(sz.call(t,e)&&t[e]!==null)return!1;return!0}o(az,"resolveYamlSet");function oz(n){return n!==null?n:{}}o(oz,"constructYamlSet");var VP=new jr("tag:yaml.org,2002:set",{kind:"mapping",resolve:az,construct:oz}),Tw=FP.extend({implicit:[LP,kP],explicit:[MP,jP,$P,VP]}),Xa=Object.prototype.hasOwnProperty,hg=1,BP=2,UP=3,pg=4,yw=1,cz=2,aP=3,lz=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,uz=/[\x85\u2028\u2029]/,fz=/[,\[\]\{\}]/,qP=/^(?:!|!!|![a-z\-]+!)$/i,WP=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function oP(n){return Object.prototype.toString.call(n)}o(oP,"_class");function Es(n){return n===10||n===13}o(Es,"is_EOL");function Jo(n){return n===9||n===32}o(Jo,"is_WHITE_SPACE");function On(n){return n===9||n===32||n===10||n===13}o(On,"is_WS_OR_EOL");function kl(n){return n===44||n===91||n===93||n===123||n===125}o(kl,"is_FLOW_INDICATOR");function dz(n){var e;return 48<=n&&n<=57?n-48:(e=n|32,97<=e&&e<=102?e-97+10:-1)}o(dz,"fromHexCode");function hz(n){return n===120?2:n===117?4:n===85?8:0}o(hz,"escapedHexLen");function pz(n){return 48<=n&&n<=57?n-48:-1}o(pz,"fromDecimalCode");function cP(n){return n===48?"\0":n===97?"\x07":n===98?"\b":n===116||n===9?" ":n===110?`
471
- `:n===118?"\v":n===102?"\f":n===114?"\r":n===101?"\x1B":n===32?" ":n===34?'"':n===47?"/":n===92?"\\":n===78?"\x85":n===95?"\xA0":n===76?"\u2028":n===80?"\u2029":""}o(cP,"simpleEscapeSequence");function mz(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}o(mz,"charFromCodepoint");function GP(n,e,t){e==="__proto__"?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[e]=t}o(GP,"setProperty");var zP=new Array(256),HP=new Array(256);for(Xo=0;Xo<256;Xo++)zP[Xo]=cP(Xo)?1:0,HP[Xo]=cP(Xo);var Xo;function gz(n,e){this.input=n,this.filename=e.filename||null,this.schema=e.schema||Tw,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}o(gz,"State$1");function QP(n,e){var t={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return t.snippet=vG(t),new _n(e,t)}o(QP,"generateError");function ae(n,e){throw QP(n,e)}o(ae,"throwError");function mg(n,e){n.onWarning&&n.onWarning.call(null,QP(n,e))}o(mg,"throwWarning");var lP={YAML:o(function(e,t,r){var i,s,a;e.version!==null&&ae(e,"duplication of %YAML directive"),r.length!==1&&ae(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&ae(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),a=parseInt(i[2],10),s!==1&&ae(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&mg(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:o(function(e,t,r){var i,s;r.length!==2&&ae(e,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],qP.test(i)||ae(e,"ill-formed tag handle (first argument) of the TAG directive"),Xa.call(e.tagMap,i)&&ae(e,'there is a previously declared suffix for "'+i+'" tag handle'),WP.test(s)||ae(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{ae(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function Ka(n,e,t,r){var i,s,a,c;if(e<t){if(c=n.input.slice(e,t),r)for(i=0,s=c.length;i<s;i+=1)a=c.charCodeAt(i),a===9||32<=a&&a<=1114111||ae(n,"expected valid JSON character");else lz.test(c)&&ae(n,"the stream contains non-printable characters");n.result+=c}}o(Ka,"captureSegment");function uP(n,e,t,r){var i,s,a,c;for(hr.isObject(t)||ae(n,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),a=0,c=i.length;a<c;a+=1)s=i[a],Xa.call(e,s)||(GP(e,s,t[s]),r[s]=!0)}o(uP,"mergeMappings");function Ml(n,e,t,r,i,s,a,c,l){var u,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),u=0,f=i.length;u<f;u+=1)Array.isArray(i[u])&&ae(n,"nested arrays are not supported inside keys"),typeof i=="object"&&oP(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&oP(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(u=0,f=s.length;u<f;u+=1)uP(n,e,s[u],t);else uP(n,e,s,t);else!n.json&&!Xa.call(t,i)&&Xa.call(e,i)&&(n.line=a||n.line,n.lineStart=c||n.lineStart,n.position=l||n.position,ae(n,"duplicated mapping key")),GP(e,i,s),delete t[i];return e}o(Ml,"storeMappingPair");function Aw(n){var e;e=n.input.charCodeAt(n.position),e===10?n.position++:e===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):ae(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}o(Aw,"readLineBreak");function sr(n,e,t){for(var r=0,i=n.input.charCodeAt(n.position);i!==0;){for(;Jo(i);)i===9&&n.firstTabInLine===-1&&(n.firstTabInLine=n.position),i=n.input.charCodeAt(++n.position);if(e&&i===35)do i=n.input.charCodeAt(++n.position);while(i!==10&&i!==13&&i!==0);if(Es(i))for(Aw(n),i=n.input.charCodeAt(n.position),r++,n.lineIndent=0;i===32;)n.lineIndent++,i=n.input.charCodeAt(++n.position);else break}return t!==-1&&r!==0&&n.lineIndent<t&&mg(n,"deficient indentation"),r}o(sr,"skipSeparationSpace");function _g(n){var e=n.position,t;return t=n.input.charCodeAt(e),!!((t===45||t===46)&&t===n.input.charCodeAt(e+1)&&t===n.input.charCodeAt(e+2)&&(e+=3,t=n.input.charCodeAt(e),t===0||On(t)))}o(_g,"testDocumentSeparator");function xw(n,e){e===1?n.result+=" ":e>1&&(n.result+=hr.repeat(`
472
- `,e-1))}o(xw,"writeFoldedLines");function yz(n,e,t){var r,i,s,a,c,l,u,f,d=n.kind,h=n.result,p;if(p=n.input.charCodeAt(n.position),On(p)||kl(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=n.input.charCodeAt(n.position+1),On(i)||t&&kl(i)))return!1;for(n.kind="scalar",n.result="",s=a=n.position,c=!1;p!==0;){if(p===58){if(i=n.input.charCodeAt(n.position+1),On(i)||t&&kl(i))break}else if(p===35){if(r=n.input.charCodeAt(n.position-1),On(r))break}else{if(n.position===n.lineStart&&_g(n)||t&&kl(p))break;if(Es(p))if(l=n.line,u=n.lineStart,f=n.lineIndent,sr(n,!1,-1),n.lineIndent>=e){c=!0,p=n.input.charCodeAt(n.position);continue}else{n.position=a,n.line=l,n.lineStart=u,n.lineIndent=f;break}}c&&(Ka(n,s,a,!1),xw(n,n.line-l),s=a=n.position,c=!1),Jo(p)||(a=n.position+1),p=n.input.charCodeAt(++n.position)}return Ka(n,s,a,!1),n.result?!0:(n.kind=d,n.result=h,!1)}o(yz,"readPlainScalar");function _z(n,e){var t,r,i;if(t=n.input.charCodeAt(n.position),t!==39)return!1;for(n.kind="scalar",n.result="",n.position++,r=i=n.position;(t=n.input.charCodeAt(n.position))!==0;)if(t===39)if(Ka(n,r,n.position,!0),t=n.input.charCodeAt(++n.position),t===39)r=n.position,n.position++,i=n.position;else return!0;else Es(t)?(Ka(n,r,i,!0),xw(n,sr(n,!1,e)),r=i=n.position):n.position===n.lineStart&&_g(n)?ae(n,"unexpected end of the document within a single quoted scalar"):(n.position++,i=n.position);ae(n,"unexpected end of the stream within a single quoted scalar")}o(_z,"readSingleQuotedScalar");function Sz(n,e){var t,r,i,s,a,c;if(c=n.input.charCodeAt(n.position),c!==34)return!1;for(n.kind="scalar",n.result="",n.position++,t=r=n.position;(c=n.input.charCodeAt(n.position))!==0;){if(c===34)return Ka(n,t,n.position,!0),n.position++,!0;if(c===92){if(Ka(n,t,n.position,!0),c=n.input.charCodeAt(++n.position),Es(c))sr(n,!1,e);else if(c<256&&zP[c])n.result+=HP[c],n.position++;else if((a=hz(c))>0){for(i=a,s=0;i>0;i--)c=n.input.charCodeAt(++n.position),(a=dz(c))>=0?s=(s<<4)+a:ae(n,"expected hexadecimal character");n.result+=mz(s),n.position++}else ae(n,"unknown escape sequence");t=r=n.position}else Es(c)?(Ka(n,t,r,!0),xw(n,sr(n,!1,e)),t=r=n.position):n.position===n.lineStart&&_g(n)?ae(n,"unexpected end of the document within a double quoted scalar"):(n.position++,r=n.position)}ae(n,"unexpected end of the stream within a double quoted scalar")}o(Sz,"readDoubleQuotedScalar");function vz(n,e){var t=!0,r,i,s,a=n.tag,c,l=n.anchor,u,f,d,h,p,y=Object.create(null),v,E,b,A;if(A=n.input.charCodeAt(n.position),A===91)f=93,p=!1,c=[];else if(A===123)f=125,p=!0,c={};else return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=c),A=n.input.charCodeAt(++n.position);A!==0;){if(sr(n,!0,e),A=n.input.charCodeAt(n.position),A===f)return n.position++,n.tag=a,n.anchor=l,n.kind=p?"mapping":"sequence",n.result=c,!0;t?A===44&&ae(n,"expected the node content, but found ','"):ae(n,"missed comma between flow collection entries"),E=v=b=null,d=h=!1,A===63&&(u=n.input.charCodeAt(n.position+1),On(u)&&(d=h=!0,n.position++,sr(n,!0,e))),r=n.line,i=n.lineStart,s=n.position,jl(n,e,hg,!1,!0),E=n.tag,v=n.result,sr(n,!0,e),A=n.input.charCodeAt(n.position),(h||n.line===r)&&A===58&&(d=!0,A=n.input.charCodeAt(++n.position),sr(n,!0,e),jl(n,e,hg,!1,!0),b=n.result),p?Ml(n,c,y,E,v,b,r,i,s):d?c.push(Ml(n,null,y,E,v,b,r,i,s)):c.push(v),sr(n,!0,e),A=n.input.charCodeAt(n.position),A===44?(t=!0,A=n.input.charCodeAt(++n.position)):t=!1}ae(n,"unexpected end of the stream within a flow collection")}o(vz,"readFlowCollection");function bz(n,e){var t,r,i=yw,s=!1,a=!1,c=e,l=0,u=!1,f,d;if(d=n.input.charCodeAt(n.position),d===124)r=!1;else if(d===62)r=!0;else return!1;for(n.kind="scalar",n.result="";d!==0;)if(d=n.input.charCodeAt(++n.position),d===43||d===45)yw===i?i=d===43?aP:cz:ae(n,"repeat of a chomping mode identifier");else if((f=pz(d))>=0)f===0?ae(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?ae(n,"repeat of an indentation width identifier"):(c=e+f-1,a=!0);else break;if(Jo(d)){do d=n.input.charCodeAt(++n.position);while(Jo(d));if(d===35)do d=n.input.charCodeAt(++n.position);while(!Es(d)&&d!==0)}for(;d!==0;){for(Aw(n),n.lineIndent=0,d=n.input.charCodeAt(n.position);(!a||n.lineIndent<c)&&d===32;)n.lineIndent++,d=n.input.charCodeAt(++n.position);if(!a&&n.lineIndent>c&&(c=n.lineIndent),Es(d)){l++;continue}if(n.lineIndent<c){i===aP?n.result+=hr.repeat(`
470
+ \r`;function QG(n){if(n===null)return!1;var e,t,r=0,i=n.length,s=Ew;for(t=0;t<i;t++)if(e=s.indexOf(n.charAt(t)),!(e>64)){if(e<0)return!1;r+=6}return r%8===0}o(QG,"resolveYamlBinary");function YG(n){var e,t,r=n.replace(/[\r\n=]/g,""),i=r.length,s=Ew,a=0,c=[];for(e=0;e<i;e++)e%4===0&&e&&(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)),a=a<<6|s.indexOf(r.charAt(e));return t=i%4*6,t===0?(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)):t===18?(c.push(a>>10&255),c.push(a>>2&255)):t===12&&c.push(a>>4&255),new Uint8Array(c)}o(YG,"constructYamlBinary");function KG(n){var e="",t=0,r,i,s=n.length,a=Ew;for(r=0;r<s;r++)r%3===0&&r&&(e+=a[t>>18&63],e+=a[t>>12&63],e+=a[t>>6&63],e+=a[t&63]),t=(t<<8)+n[r];return i=s%3,i===0?(e+=a[t>>18&63],e+=a[t>>12&63],e+=a[t>>6&63],e+=a[t&63]):i===2?(e+=a[t>>10&63],e+=a[t>>4&63],e+=a[t<<2&63],e+=a[64]):i===1&&(e+=a[t>>2&63],e+=a[t<<4&63],e+=a[64],e+=a[64]),e}o(KG,"representYamlBinary");function XG(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}o(XG,"isBinary");var MP=new jr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:QG,construct:YG,predicate:XG,represent:KG}),JG=Object.prototype.hasOwnProperty,ZG=Object.prototype.toString;function ez(n){if(n===null)return!0;var e=[],t,r,i,s,a,c=n;for(t=0,r=c.length;t<r;t+=1){if(i=c[t],a=!1,ZG.call(i)!=="[object Object]")return!1;for(s in i)if(JG.call(i,s))if(!a)a=!0;else return!1;if(!a)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}o(ez,"resolveYamlOmap");function tz(n){return n!==null?n:[]}o(tz,"constructYamlOmap");var jP=new jr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:ez,construct:tz}),rz=Object.prototype.toString;function nz(n){if(n===null)return!0;var e,t,r,i,s,a=n;for(s=new Array(a.length),e=0,t=a.length;e<t;e+=1){if(r=a[e],rz.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[e]=[i[0],r[i[0]]]}return!0}o(nz,"resolveYamlPairs");function iz(n){if(n===null)return[];var e,t,r,i,s,a=n;for(s=new Array(a.length),e=0,t=a.length;e<t;e+=1)r=a[e],i=Object.keys(r),s[e]=[i[0],r[i[0]]];return s}o(iz,"constructYamlPairs");var $P=new jr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:nz,construct:iz}),sz=Object.prototype.hasOwnProperty;function az(n){if(n===null)return!0;var e,t=n;for(e in t)if(sz.call(t,e)&&t[e]!==null)return!1;return!0}o(az,"resolveYamlSet");function oz(n){return n!==null?n:{}}o(oz,"constructYamlSet");var VP=new jr("tag:yaml.org,2002:set",{kind:"mapping",resolve:az,construct:oz}),Tw=FP.extend({implicit:[LP,kP],explicit:[MP,jP,$P,VP]}),Ja=Object.prototype.hasOwnProperty,hg=1,BP=2,UP=3,pg=4,yw=1,cz=2,aP=3,lz=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,uz=/[\x85\u2028\u2029]/,fz=/[,\[\]\{\}]/,qP=/^(?:!|!!|![a-z\-]+!)$/i,WP=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function oP(n){return Object.prototype.toString.call(n)}o(oP,"_class");function Es(n){return n===10||n===13}o(Es,"is_EOL");function Jo(n){return n===9||n===32}o(Jo,"is_WHITE_SPACE");function On(n){return n===9||n===32||n===10||n===13}o(On,"is_WS_OR_EOL");function kl(n){return n===44||n===91||n===93||n===123||n===125}o(kl,"is_FLOW_INDICATOR");function dz(n){var e;return 48<=n&&n<=57?n-48:(e=n|32,97<=e&&e<=102?e-97+10:-1)}o(dz,"fromHexCode");function hz(n){return n===120?2:n===117?4:n===85?8:0}o(hz,"escapedHexLen");function pz(n){return 48<=n&&n<=57?n-48:-1}o(pz,"fromDecimalCode");function cP(n){return n===48?"\0":n===97?"\x07":n===98?"\b":n===116||n===9?" ":n===110?`
471
+ `:n===118?"\v":n===102?"\f":n===114?"\r":n===101?"\x1B":n===32?" ":n===34?'"':n===47?"/":n===92?"\\":n===78?"\x85":n===95?"\xA0":n===76?"\u2028":n===80?"\u2029":""}o(cP,"simpleEscapeSequence");function mz(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}o(mz,"charFromCodepoint");function GP(n,e,t){e==="__proto__"?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[e]=t}o(GP,"setProperty");var zP=new Array(256),HP=new Array(256);for(Xo=0;Xo<256;Xo++)zP[Xo]=cP(Xo)?1:0,HP[Xo]=cP(Xo);var Xo;function gz(n,e){this.input=n,this.filename=e.filename||null,this.schema=e.schema||Tw,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}o(gz,"State$1");function QP(n,e){var t={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return t.snippet=vG(t),new _n(e,t)}o(QP,"generateError");function ae(n,e){throw QP(n,e)}o(ae,"throwError");function mg(n,e){n.onWarning&&n.onWarning.call(null,QP(n,e))}o(mg,"throwWarning");var lP={YAML:o(function(e,t,r){var i,s,a;e.version!==null&&ae(e,"duplication of %YAML directive"),r.length!==1&&ae(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&ae(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),a=parseInt(i[2],10),s!==1&&ae(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&mg(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:o(function(e,t,r){var i,s;r.length!==2&&ae(e,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],qP.test(i)||ae(e,"ill-formed tag handle (first argument) of the TAG directive"),Ja.call(e.tagMap,i)&&ae(e,'there is a previously declared suffix for "'+i+'" tag handle'),WP.test(s)||ae(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{ae(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function Xa(n,e,t,r){var i,s,a,c;if(e<t){if(c=n.input.slice(e,t),r)for(i=0,s=c.length;i<s;i+=1)a=c.charCodeAt(i),a===9||32<=a&&a<=1114111||ae(n,"expected valid JSON character");else lz.test(c)&&ae(n,"the stream contains non-printable characters");n.result+=c}}o(Xa,"captureSegment");function uP(n,e,t,r){var i,s,a,c;for(hr.isObject(t)||ae(n,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),a=0,c=i.length;a<c;a+=1)s=i[a],Ja.call(e,s)||(GP(e,s,t[s]),r[s]=!0)}o(uP,"mergeMappings");function Ml(n,e,t,r,i,s,a,c,l){var u,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),u=0,f=i.length;u<f;u+=1)Array.isArray(i[u])&&ae(n,"nested arrays are not supported inside keys"),typeof i=="object"&&oP(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&oP(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(u=0,f=s.length;u<f;u+=1)uP(n,e,s[u],t);else uP(n,e,s,t);else!n.json&&!Ja.call(t,i)&&Ja.call(e,i)&&(n.line=a||n.line,n.lineStart=c||n.lineStart,n.position=l||n.position,ae(n,"duplicated mapping key")),GP(e,i,s),delete t[i];return e}o(Ml,"storeMappingPair");function Aw(n){var e;e=n.input.charCodeAt(n.position),e===10?n.position++:e===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):ae(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}o(Aw,"readLineBreak");function sr(n,e,t){for(var r=0,i=n.input.charCodeAt(n.position);i!==0;){for(;Jo(i);)i===9&&n.firstTabInLine===-1&&(n.firstTabInLine=n.position),i=n.input.charCodeAt(++n.position);if(e&&i===35)do i=n.input.charCodeAt(++n.position);while(i!==10&&i!==13&&i!==0);if(Es(i))for(Aw(n),i=n.input.charCodeAt(n.position),r++,n.lineIndent=0;i===32;)n.lineIndent++,i=n.input.charCodeAt(++n.position);else break}return t!==-1&&r!==0&&n.lineIndent<t&&mg(n,"deficient indentation"),r}o(sr,"skipSeparationSpace");function _g(n){var e=n.position,t;return t=n.input.charCodeAt(e),!!((t===45||t===46)&&t===n.input.charCodeAt(e+1)&&t===n.input.charCodeAt(e+2)&&(e+=3,t=n.input.charCodeAt(e),t===0||On(t)))}o(_g,"testDocumentSeparator");function xw(n,e){e===1?n.result+=" ":e>1&&(n.result+=hr.repeat(`
472
+ `,e-1))}o(xw,"writeFoldedLines");function yz(n,e,t){var r,i,s,a,c,l,u,f,d=n.kind,h=n.result,p;if(p=n.input.charCodeAt(n.position),On(p)||kl(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=n.input.charCodeAt(n.position+1),On(i)||t&&kl(i)))return!1;for(n.kind="scalar",n.result="",s=a=n.position,c=!1;p!==0;){if(p===58){if(i=n.input.charCodeAt(n.position+1),On(i)||t&&kl(i))break}else if(p===35){if(r=n.input.charCodeAt(n.position-1),On(r))break}else{if(n.position===n.lineStart&&_g(n)||t&&kl(p))break;if(Es(p))if(l=n.line,u=n.lineStart,f=n.lineIndent,sr(n,!1,-1),n.lineIndent>=e){c=!0,p=n.input.charCodeAt(n.position);continue}else{n.position=a,n.line=l,n.lineStart=u,n.lineIndent=f;break}}c&&(Xa(n,s,a,!1),xw(n,n.line-l),s=a=n.position,c=!1),Jo(p)||(a=n.position+1),p=n.input.charCodeAt(++n.position)}return Xa(n,s,a,!1),n.result?!0:(n.kind=d,n.result=h,!1)}o(yz,"readPlainScalar");function _z(n,e){var t,r,i;if(t=n.input.charCodeAt(n.position),t!==39)return!1;for(n.kind="scalar",n.result="",n.position++,r=i=n.position;(t=n.input.charCodeAt(n.position))!==0;)if(t===39)if(Xa(n,r,n.position,!0),t=n.input.charCodeAt(++n.position),t===39)r=n.position,n.position++,i=n.position;else return!0;else Es(t)?(Xa(n,r,i,!0),xw(n,sr(n,!1,e)),r=i=n.position):n.position===n.lineStart&&_g(n)?ae(n,"unexpected end of the document within a single quoted scalar"):(n.position++,i=n.position);ae(n,"unexpected end of the stream within a single quoted scalar")}o(_z,"readSingleQuotedScalar");function Sz(n,e){var t,r,i,s,a,c;if(c=n.input.charCodeAt(n.position),c!==34)return!1;for(n.kind="scalar",n.result="",n.position++,t=r=n.position;(c=n.input.charCodeAt(n.position))!==0;){if(c===34)return Xa(n,t,n.position,!0),n.position++,!0;if(c===92){if(Xa(n,t,n.position,!0),c=n.input.charCodeAt(++n.position),Es(c))sr(n,!1,e);else if(c<256&&zP[c])n.result+=HP[c],n.position++;else if((a=hz(c))>0){for(i=a,s=0;i>0;i--)c=n.input.charCodeAt(++n.position),(a=dz(c))>=0?s=(s<<4)+a:ae(n,"expected hexadecimal character");n.result+=mz(s),n.position++}else ae(n,"unknown escape sequence");t=r=n.position}else Es(c)?(Xa(n,t,r,!0),xw(n,sr(n,!1,e)),t=r=n.position):n.position===n.lineStart&&_g(n)?ae(n,"unexpected end of the document within a double quoted scalar"):(n.position++,r=n.position)}ae(n,"unexpected end of the stream within a double quoted scalar")}o(Sz,"readDoubleQuotedScalar");function vz(n,e){var t=!0,r,i,s,a=n.tag,c,l=n.anchor,u,f,d,h,p,y=Object.create(null),v,E,b,A;if(A=n.input.charCodeAt(n.position),A===91)f=93,p=!1,c=[];else if(A===123)f=125,p=!0,c={};else return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=c),A=n.input.charCodeAt(++n.position);A!==0;){if(sr(n,!0,e),A=n.input.charCodeAt(n.position),A===f)return n.position++,n.tag=a,n.anchor=l,n.kind=p?"mapping":"sequence",n.result=c,!0;t?A===44&&ae(n,"expected the node content, but found ','"):ae(n,"missed comma between flow collection entries"),E=v=b=null,d=h=!1,A===63&&(u=n.input.charCodeAt(n.position+1),On(u)&&(d=h=!0,n.position++,sr(n,!0,e))),r=n.line,i=n.lineStart,s=n.position,jl(n,e,hg,!1,!0),E=n.tag,v=n.result,sr(n,!0,e),A=n.input.charCodeAt(n.position),(h||n.line===r)&&A===58&&(d=!0,A=n.input.charCodeAt(++n.position),sr(n,!0,e),jl(n,e,hg,!1,!0),b=n.result),p?Ml(n,c,y,E,v,b,r,i,s):d?c.push(Ml(n,null,y,E,v,b,r,i,s)):c.push(v),sr(n,!0,e),A=n.input.charCodeAt(n.position),A===44?(t=!0,A=n.input.charCodeAt(++n.position)):t=!1}ae(n,"unexpected end of the stream within a flow collection")}o(vz,"readFlowCollection");function bz(n,e){var t,r,i=yw,s=!1,a=!1,c=e,l=0,u=!1,f,d;if(d=n.input.charCodeAt(n.position),d===124)r=!1;else if(d===62)r=!0;else return!1;for(n.kind="scalar",n.result="";d!==0;)if(d=n.input.charCodeAt(++n.position),d===43||d===45)yw===i?i=d===43?aP:cz:ae(n,"repeat of a chomping mode identifier");else if((f=pz(d))>=0)f===0?ae(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?ae(n,"repeat of an indentation width identifier"):(c=e+f-1,a=!0);else break;if(Jo(d)){do d=n.input.charCodeAt(++n.position);while(Jo(d));if(d===35)do d=n.input.charCodeAt(++n.position);while(!Es(d)&&d!==0)}for(;d!==0;){for(Aw(n),n.lineIndent=0,d=n.input.charCodeAt(n.position);(!a||n.lineIndent<c)&&d===32;)n.lineIndent++,d=n.input.charCodeAt(++n.position);if(!a&&n.lineIndent>c&&(c=n.lineIndent),Es(d)){l++;continue}if(n.lineIndent<c){i===aP?n.result+=hr.repeat(`
473
473
  `,s?1+l:l):i===yw&&s&&(n.result+=`
474
474
  `);break}for(r?Jo(d)?(u=!0,n.result+=hr.repeat(`
475
475
  `,s?1+l:l)):u?(u=!1,n.result+=hr.repeat(`
476
476
  `,l+1)):l===0?s&&(n.result+=" "):n.result+=hr.repeat(`
477
477
  `,l):n.result+=hr.repeat(`
478
- `,s?1+l:l),s=!0,a=!0,l=0,t=n.position;!Es(d)&&d!==0;)d=n.input.charCodeAt(++n.position);Ka(n,t,n.position,!1)}return!0}o(bz,"readBlockScalar");function fP(n,e){var t,r=n.tag,i=n.anchor,s=[],a,c=!1,l;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=s),l=n.input.charCodeAt(n.position);l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,ae(n,"tab characters must not be used in indentation")),!(l!==45||(a=n.input.charCodeAt(n.position+1),!On(a))));){if(c=!0,n.position++,sr(n,!0,-1)&&n.lineIndent<=e){s.push(null),l=n.input.charCodeAt(n.position);continue}if(t=n.line,jl(n,e,UP,!1,!0),s.push(n.result),sr(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===t||n.lineIndent>e)&&l!==0)ae(n,"bad indentation of a sequence entry");else if(n.lineIndent<e)break}return c?(n.tag=r,n.anchor=i,n.kind="sequence",n.result=s,!0):!1}o(fP,"readBlockSequence");function wz(n,e,t){var r,i,s,a,c,l,u=n.tag,f=n.anchor,d={},h=Object.create(null),p=null,y=null,v=null,E=!1,b=!1,A;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=d),A=n.input.charCodeAt(n.position);A!==0;){if(!E&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,ae(n,"tab characters must not be used in indentation")),r=n.input.charCodeAt(n.position+1),s=n.line,(A===63||A===58)&&On(r))A===63?(E&&(Ml(n,d,h,p,y,null,a,c,l),p=y=v=null),b=!0,E=!0,i=!0):E?(E=!1,i=!0):ae(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,A=r;else{if(a=n.line,c=n.lineStart,l=n.position,!jl(n,t,BP,!1,!0))break;if(n.line===s){for(A=n.input.charCodeAt(n.position);Jo(A);)A=n.input.charCodeAt(++n.position);if(A===58)A=n.input.charCodeAt(++n.position),On(A)||ae(n,"a whitespace character is expected after the key-value separator within a block mapping"),E&&(Ml(n,d,h,p,y,null,a,c,l),p=y=v=null),b=!0,E=!1,i=!1,p=n.tag,y=n.result;else if(b)ae(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=u,n.anchor=f,!0}else if(b)ae(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=u,n.anchor=f,!0}if((n.line===s||n.lineIndent>e)&&(E&&(a=n.line,c=n.lineStart,l=n.position),jl(n,e,pg,!0,i)&&(E?y=n.result:v=n.result),E||(Ml(n,d,h,p,y,v,a,c,l),p=y=v=null),sr(n,!0,-1),A=n.input.charCodeAt(n.position)),(n.line===s||n.lineIndent>e)&&A!==0)ae(n,"bad indentation of a mapping entry");else if(n.lineIndent<e)break}return E&&Ml(n,d,h,p,y,null,a,c,l),b&&(n.tag=u,n.anchor=f,n.kind="mapping",n.result=d),b}o(wz,"readBlockMapping");function Ez(n){var e,t=!1,r=!1,i,s,a;if(a=n.input.charCodeAt(n.position),a!==33)return!1;if(n.tag!==null&&ae(n,"duplication of a tag property"),a=n.input.charCodeAt(++n.position),a===60?(t=!0,a=n.input.charCodeAt(++n.position)):a===33?(r=!0,i="!!",a=n.input.charCodeAt(++n.position)):i="!",e=n.position,t){do a=n.input.charCodeAt(++n.position);while(a!==0&&a!==62);n.position<n.length?(s=n.input.slice(e,n.position),a=n.input.charCodeAt(++n.position)):ae(n,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!On(a);)a===33&&(r?ae(n,"tag suffix cannot contain exclamation marks"):(i=n.input.slice(e-1,n.position+1),qP.test(i)||ae(n,"named tag handle cannot contain such characters"),r=!0,e=n.position+1)),a=n.input.charCodeAt(++n.position);s=n.input.slice(e,n.position),fz.test(s)&&ae(n,"tag suffix cannot contain flow indicator characters")}s&&!WP.test(s)&&ae(n,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ae(n,"tag name is malformed: "+s)}return t?n.tag=s:Xa.call(n.tagMap,i)?n.tag=n.tagMap[i]+s:i==="!"?n.tag="!"+s:i==="!!"?n.tag="tag:yaml.org,2002:"+s:ae(n,'undeclared tag handle "'+i+'"'),!0}o(Ez,"readTagProperty");function Tz(n){var e,t;if(t=n.input.charCodeAt(n.position),t!==38)return!1;for(n.anchor!==null&&ae(n,"duplication of an anchor property"),t=n.input.charCodeAt(++n.position),e=n.position;t!==0&&!On(t)&&!kl(t);)t=n.input.charCodeAt(++n.position);return n.position===e&&ae(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(e,n.position),!0}o(Tz,"readAnchorProperty");function Az(n){var e,t,r;if(r=n.input.charCodeAt(n.position),r!==42)return!1;for(r=n.input.charCodeAt(++n.position),e=n.position;r!==0&&!On(r)&&!kl(r);)r=n.input.charCodeAt(++n.position);return n.position===e&&ae(n,"name of an alias node must contain at least one character"),t=n.input.slice(e,n.position),Xa.call(n.anchorMap,t)||ae(n,'unidentified alias "'+t+'"'),n.result=n.anchorMap[t],sr(n,!0,-1),!0}o(Az,"readAlias");function jl(n,e,t,r,i){var s,a,c,l=1,u=!1,f=!1,d,h,p,y,v,E;if(n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null,s=a=c=pg===t||UP===t,r&&sr(n,!0,-1)&&(u=!0,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)),l===1)for(;Ez(n)||Tz(n);)sr(n,!0,-1)?(u=!0,c=s,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)):c=!1;if(c&&(c=u||i),(l===1||pg===t)&&(hg===t||BP===t?v=e:v=e+1,E=n.position-n.lineStart,l===1?c&&(fP(n,E)||wz(n,E,v))||vz(n,v)?f=!0:(a&&bz(n,v)||_z(n,v)||Sz(n,v)?f=!0:Az(n)?(f=!0,(n.tag!==null||n.anchor!==null)&&ae(n,"alias node should not have any properties")):yz(n,v,hg===t)&&(f=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):l===0&&(f=c&&fP(n,E))),n.tag===null)n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);else if(n.tag==="?"){for(n.result!==null&&n.kind!=="scalar"&&ae(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"'),d=0,h=n.implicitTypes.length;d<h;d+=1)if(y=n.implicitTypes[d],y.resolve(n.result)){n.result=y.construct(n.result),n.tag=y.tag,n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);break}}else if(n.tag!=="!"){if(Xa.call(n.typeMap[n.kind||"fallback"],n.tag))y=n.typeMap[n.kind||"fallback"][n.tag];else for(y=null,p=n.typeMap.multi[n.kind||"fallback"],d=0,h=p.length;d<h;d+=1)if(n.tag.slice(0,p[d].tag.length)===p[d].tag){y=p[d];break}y||ae(n,"unknown tag !<"+n.tag+">"),n.result!==null&&y.kind!==n.kind&&ae(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+y.kind+'", not "'+n.kind+'"'),y.resolve(n.result,n.tag)?(n.result=y.construct(n.result,n.tag),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):ae(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.tag!==null||n.anchor!==null||f}o(jl,"composeNode");function xz(n){var e=n.position,t,r,i,s=!1,a;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(a=n.input.charCodeAt(n.position))!==0&&(sr(n,!0,-1),a=n.input.charCodeAt(n.position),!(n.lineIndent>0||a!==37));){for(s=!0,a=n.input.charCodeAt(++n.position),t=n.position;a!==0&&!On(a);)a=n.input.charCodeAt(++n.position);for(r=n.input.slice(t,n.position),i=[],r.length<1&&ae(n,"directive name must not be less than one character in length");a!==0;){for(;Jo(a);)a=n.input.charCodeAt(++n.position);if(a===35){do a=n.input.charCodeAt(++n.position);while(a!==0&&!Es(a));break}if(Es(a))break;for(t=n.position;a!==0&&!On(a);)a=n.input.charCodeAt(++n.position);i.push(n.input.slice(t,n.position))}a!==0&&Aw(n),Xa.call(lP,r)?lP[r](n,r,i):mg(n,'unknown document directive "'+r+'"')}if(sr(n,!0,-1),n.lineIndent===0&&n.input.charCodeAt(n.position)===45&&n.input.charCodeAt(n.position+1)===45&&n.input.charCodeAt(n.position+2)===45?(n.position+=3,sr(n,!0,-1)):s&&ae(n,"directives end mark is expected"),jl(n,n.lineIndent-1,pg,!1,!0),sr(n,!0,-1),n.checkLineBreaks&&uz.test(n.input.slice(e,n.position))&&mg(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&_g(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,sr(n,!0,-1));return}if(n.position<n.length-1)ae(n,"end of the stream or a document separator is expected");else return}o(xz,"readDocument");function YP(n,e){n=String(n),e=e||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
479
- `),n.charCodeAt(0)===65279&&(n=n.slice(1)));var t=new gz(n,e),r=n.indexOf("\0");for(r!==-1&&(t.position=r,ae(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)xz(t);return t.documents}o(YP,"loadDocuments");function Cz(n,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var r=YP(n,t);if(typeof e!="function")return r;for(var i=0,s=r.length;i<s;i+=1)e(r[i])}o(Cz,"loadAll$1");function Iz(n,e){var t=YP(n,e);if(t.length!==0){if(t.length===1)return t[0];throw new _n("expected a single document in the stream, but found more")}}o(Iz,"load$1");var Rz=Cz,Pz=Iz,KP={loadAll:Rz,load:Pz},XP=Object.prototype.toString,JP=Object.prototype.hasOwnProperty,Cw=65279,Oz=9,Nf=10,Fz=13,Dz=32,Nz=33,Lz=34,Sw=35,kz=37,Mz=38,jz=39,$z=42,ZP=44,Vz=45,gg=58,Bz=61,Uz=62,qz=63,Wz=64,eO=91,tO=93,Gz=96,rO=123,zz=124,nO=125,Jr={};Jr[0]="\\0";Jr[7]="\\a";Jr[8]="\\b";Jr[9]="\\t";Jr[10]="\\n";Jr[11]="\\v";Jr[12]="\\f";Jr[13]="\\r";Jr[27]="\\e";Jr[34]='\\"';Jr[92]="\\\\";Jr[133]="\\N";Jr[160]="\\_";Jr[8232]="\\L";Jr[8233]="\\P";var Hz=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Qz=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Yz(n,e){var t,r,i,s,a,c,l;if(e===null)return{};for(t={},r=Object.keys(e),i=0,s=r.length;i<s;i+=1)a=r[i],c=String(e[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),l=n.compiledTypeMap.fallback[a],l&&JP.call(l.styleAliases,c)&&(c=l.styleAliases[c]),t[a]=c;return t}o(Yz,"compileStyleMap");function Kz(n){var e,t,r;if(e=n.toString(16).toUpperCase(),n<=255)t="x",r=2;else if(n<=65535)t="u",r=4;else if(n<=4294967295)t="U",r=8;else throw new _n("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+hr.repeat("0",r-e.length)+e}o(Kz,"encodeHex");var Xz=1,Lf=2;function Jz(n){this.schema=n.schema||Tw,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=hr.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=Yz(this.schema,n.styles||null),this.sortKeys=n.sortKeys||!1,this.lineWidth=n.lineWidth||80,this.noRefs=n.noRefs||!1,this.noCompatMode=n.noCompatMode||!1,this.condenseFlow=n.condenseFlow||!1,this.quotingType=n.quotingType==='"'?Lf:Xz,this.forceQuotes=n.forceQuotes||!1,this.replacer=typeof n.replacer=="function"?n.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}o(Jz,"State");function dP(n,e){for(var t=hr.repeat(" ",e),r=0,i=-1,s="",a,c=n.length;r<c;)i=n.indexOf(`
478
+ `,s?1+l:l),s=!0,a=!0,l=0,t=n.position;!Es(d)&&d!==0;)d=n.input.charCodeAt(++n.position);Xa(n,t,n.position,!1)}return!0}o(bz,"readBlockScalar");function fP(n,e){var t,r=n.tag,i=n.anchor,s=[],a,c=!1,l;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=s),l=n.input.charCodeAt(n.position);l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,ae(n,"tab characters must not be used in indentation")),!(l!==45||(a=n.input.charCodeAt(n.position+1),!On(a))));){if(c=!0,n.position++,sr(n,!0,-1)&&n.lineIndent<=e){s.push(null),l=n.input.charCodeAt(n.position);continue}if(t=n.line,jl(n,e,UP,!1,!0),s.push(n.result),sr(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===t||n.lineIndent>e)&&l!==0)ae(n,"bad indentation of a sequence entry");else if(n.lineIndent<e)break}return c?(n.tag=r,n.anchor=i,n.kind="sequence",n.result=s,!0):!1}o(fP,"readBlockSequence");function wz(n,e,t){var r,i,s,a,c,l,u=n.tag,f=n.anchor,d={},h=Object.create(null),p=null,y=null,v=null,E=!1,b=!1,A;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=d),A=n.input.charCodeAt(n.position);A!==0;){if(!E&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,ae(n,"tab characters must not be used in indentation")),r=n.input.charCodeAt(n.position+1),s=n.line,(A===63||A===58)&&On(r))A===63?(E&&(Ml(n,d,h,p,y,null,a,c,l),p=y=v=null),b=!0,E=!0,i=!0):E?(E=!1,i=!0):ae(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,A=r;else{if(a=n.line,c=n.lineStart,l=n.position,!jl(n,t,BP,!1,!0))break;if(n.line===s){for(A=n.input.charCodeAt(n.position);Jo(A);)A=n.input.charCodeAt(++n.position);if(A===58)A=n.input.charCodeAt(++n.position),On(A)||ae(n,"a whitespace character is expected after the key-value separator within a block mapping"),E&&(Ml(n,d,h,p,y,null,a,c,l),p=y=v=null),b=!0,E=!1,i=!1,p=n.tag,y=n.result;else if(b)ae(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=u,n.anchor=f,!0}else if(b)ae(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=u,n.anchor=f,!0}if((n.line===s||n.lineIndent>e)&&(E&&(a=n.line,c=n.lineStart,l=n.position),jl(n,e,pg,!0,i)&&(E?y=n.result:v=n.result),E||(Ml(n,d,h,p,y,v,a,c,l),p=y=v=null),sr(n,!0,-1),A=n.input.charCodeAt(n.position)),(n.line===s||n.lineIndent>e)&&A!==0)ae(n,"bad indentation of a mapping entry");else if(n.lineIndent<e)break}return E&&Ml(n,d,h,p,y,null,a,c,l),b&&(n.tag=u,n.anchor=f,n.kind="mapping",n.result=d),b}o(wz,"readBlockMapping");function Ez(n){var e,t=!1,r=!1,i,s,a;if(a=n.input.charCodeAt(n.position),a!==33)return!1;if(n.tag!==null&&ae(n,"duplication of a tag property"),a=n.input.charCodeAt(++n.position),a===60?(t=!0,a=n.input.charCodeAt(++n.position)):a===33?(r=!0,i="!!",a=n.input.charCodeAt(++n.position)):i="!",e=n.position,t){do a=n.input.charCodeAt(++n.position);while(a!==0&&a!==62);n.position<n.length?(s=n.input.slice(e,n.position),a=n.input.charCodeAt(++n.position)):ae(n,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!On(a);)a===33&&(r?ae(n,"tag suffix cannot contain exclamation marks"):(i=n.input.slice(e-1,n.position+1),qP.test(i)||ae(n,"named tag handle cannot contain such characters"),r=!0,e=n.position+1)),a=n.input.charCodeAt(++n.position);s=n.input.slice(e,n.position),fz.test(s)&&ae(n,"tag suffix cannot contain flow indicator characters")}s&&!WP.test(s)&&ae(n,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ae(n,"tag name is malformed: "+s)}return t?n.tag=s:Ja.call(n.tagMap,i)?n.tag=n.tagMap[i]+s:i==="!"?n.tag="!"+s:i==="!!"?n.tag="tag:yaml.org,2002:"+s:ae(n,'undeclared tag handle "'+i+'"'),!0}o(Ez,"readTagProperty");function Tz(n){var e,t;if(t=n.input.charCodeAt(n.position),t!==38)return!1;for(n.anchor!==null&&ae(n,"duplication of an anchor property"),t=n.input.charCodeAt(++n.position),e=n.position;t!==0&&!On(t)&&!kl(t);)t=n.input.charCodeAt(++n.position);return n.position===e&&ae(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(e,n.position),!0}o(Tz,"readAnchorProperty");function Az(n){var e,t,r;if(r=n.input.charCodeAt(n.position),r!==42)return!1;for(r=n.input.charCodeAt(++n.position),e=n.position;r!==0&&!On(r)&&!kl(r);)r=n.input.charCodeAt(++n.position);return n.position===e&&ae(n,"name of an alias node must contain at least one character"),t=n.input.slice(e,n.position),Ja.call(n.anchorMap,t)||ae(n,'unidentified alias "'+t+'"'),n.result=n.anchorMap[t],sr(n,!0,-1),!0}o(Az,"readAlias");function jl(n,e,t,r,i){var s,a,c,l=1,u=!1,f=!1,d,h,p,y,v,E;if(n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null,s=a=c=pg===t||UP===t,r&&sr(n,!0,-1)&&(u=!0,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)),l===1)for(;Ez(n)||Tz(n);)sr(n,!0,-1)?(u=!0,c=s,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)):c=!1;if(c&&(c=u||i),(l===1||pg===t)&&(hg===t||BP===t?v=e:v=e+1,E=n.position-n.lineStart,l===1?c&&(fP(n,E)||wz(n,E,v))||vz(n,v)?f=!0:(a&&bz(n,v)||_z(n,v)||Sz(n,v)?f=!0:Az(n)?(f=!0,(n.tag!==null||n.anchor!==null)&&ae(n,"alias node should not have any properties")):yz(n,v,hg===t)&&(f=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):l===0&&(f=c&&fP(n,E))),n.tag===null)n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);else if(n.tag==="?"){for(n.result!==null&&n.kind!=="scalar"&&ae(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"'),d=0,h=n.implicitTypes.length;d<h;d+=1)if(y=n.implicitTypes[d],y.resolve(n.result)){n.result=y.construct(n.result),n.tag=y.tag,n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);break}}else if(n.tag!=="!"){if(Ja.call(n.typeMap[n.kind||"fallback"],n.tag))y=n.typeMap[n.kind||"fallback"][n.tag];else for(y=null,p=n.typeMap.multi[n.kind||"fallback"],d=0,h=p.length;d<h;d+=1)if(n.tag.slice(0,p[d].tag.length)===p[d].tag){y=p[d];break}y||ae(n,"unknown tag !<"+n.tag+">"),n.result!==null&&y.kind!==n.kind&&ae(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+y.kind+'", not "'+n.kind+'"'),y.resolve(n.result,n.tag)?(n.result=y.construct(n.result,n.tag),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):ae(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.tag!==null||n.anchor!==null||f}o(jl,"composeNode");function xz(n){var e=n.position,t,r,i,s=!1,a;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(a=n.input.charCodeAt(n.position))!==0&&(sr(n,!0,-1),a=n.input.charCodeAt(n.position),!(n.lineIndent>0||a!==37));){for(s=!0,a=n.input.charCodeAt(++n.position),t=n.position;a!==0&&!On(a);)a=n.input.charCodeAt(++n.position);for(r=n.input.slice(t,n.position),i=[],r.length<1&&ae(n,"directive name must not be less than one character in length");a!==0;){for(;Jo(a);)a=n.input.charCodeAt(++n.position);if(a===35){do a=n.input.charCodeAt(++n.position);while(a!==0&&!Es(a));break}if(Es(a))break;for(t=n.position;a!==0&&!On(a);)a=n.input.charCodeAt(++n.position);i.push(n.input.slice(t,n.position))}a!==0&&Aw(n),Ja.call(lP,r)?lP[r](n,r,i):mg(n,'unknown document directive "'+r+'"')}if(sr(n,!0,-1),n.lineIndent===0&&n.input.charCodeAt(n.position)===45&&n.input.charCodeAt(n.position+1)===45&&n.input.charCodeAt(n.position+2)===45?(n.position+=3,sr(n,!0,-1)):s&&ae(n,"directives end mark is expected"),jl(n,n.lineIndent-1,pg,!1,!0),sr(n,!0,-1),n.checkLineBreaks&&uz.test(n.input.slice(e,n.position))&&mg(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&_g(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,sr(n,!0,-1));return}if(n.position<n.length-1)ae(n,"end of the stream or a document separator is expected");else return}o(xz,"readDocument");function YP(n,e){n=String(n),e=e||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
479
+ `),n.charCodeAt(0)===65279&&(n=n.slice(1)));var t=new gz(n,e),r=n.indexOf("\0");for(r!==-1&&(t.position=r,ae(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)xz(t);return t.documents}o(YP,"loadDocuments");function Cz(n,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var r=YP(n,t);if(typeof e!="function")return r;for(var i=0,s=r.length;i<s;i+=1)e(r[i])}o(Cz,"loadAll$1");function Iz(n,e){var t=YP(n,e);if(t.length!==0){if(t.length===1)return t[0];throw new _n("expected a single document in the stream, but found more")}}o(Iz,"load$1");var Rz=Cz,Pz=Iz,KP={loadAll:Rz,load:Pz},XP=Object.prototype.toString,JP=Object.prototype.hasOwnProperty,Cw=65279,Oz=9,Nf=10,Fz=13,Dz=32,Nz=33,Lz=34,Sw=35,kz=37,Mz=38,jz=39,$z=42,ZP=44,Vz=45,gg=58,Bz=61,Uz=62,qz=63,Wz=64,eO=91,tO=93,Gz=96,rO=123,zz=124,nO=125,Zr={};Zr[0]="\\0";Zr[7]="\\a";Zr[8]="\\b";Zr[9]="\\t";Zr[10]="\\n";Zr[11]="\\v";Zr[12]="\\f";Zr[13]="\\r";Zr[27]="\\e";Zr[34]='\\"';Zr[92]="\\\\";Zr[133]="\\N";Zr[160]="\\_";Zr[8232]="\\L";Zr[8233]="\\P";var Hz=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Qz=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Yz(n,e){var t,r,i,s,a,c,l;if(e===null)return{};for(t={},r=Object.keys(e),i=0,s=r.length;i<s;i+=1)a=r[i],c=String(e[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),l=n.compiledTypeMap.fallback[a],l&&JP.call(l.styleAliases,c)&&(c=l.styleAliases[c]),t[a]=c;return t}o(Yz,"compileStyleMap");function Kz(n){var e,t,r;if(e=n.toString(16).toUpperCase(),n<=255)t="x",r=2;else if(n<=65535)t="u",r=4;else if(n<=4294967295)t="U",r=8;else throw new _n("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+hr.repeat("0",r-e.length)+e}o(Kz,"encodeHex");var Xz=1,Lf=2;function Jz(n){this.schema=n.schema||Tw,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=hr.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=Yz(this.schema,n.styles||null),this.sortKeys=n.sortKeys||!1,this.lineWidth=n.lineWidth||80,this.noRefs=n.noRefs||!1,this.noCompatMode=n.noCompatMode||!1,this.condenseFlow=n.condenseFlow||!1,this.quotingType=n.quotingType==='"'?Lf:Xz,this.forceQuotes=n.forceQuotes||!1,this.replacer=typeof n.replacer=="function"?n.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}o(Jz,"State");function dP(n,e){for(var t=hr.repeat(" ",e),r=0,i=-1,s="",a,c=n.length;r<c;)i=n.indexOf(`
480
480
  `,r),i===-1?(a=n.slice(r),r=c):(a=n.slice(r,i+1),r=i+1),a.length&&a!==`
481
481
  `&&(s+=t),s+=a;return s}o(dP,"indentString");function vw(n,e){return`
482
482
  `+hr.repeat(" ",n.indent*e)}o(vw,"generateNextLine");function Zz(n,e){var t,r,i;for(t=0,r=n.implicitTypes.length;t<r;t+=1)if(i=n.implicitTypes[t],i.resolve(e))return!0;return!1}o(Zz,"testImplicitResolving");function yg(n){return n===Dz||n===Oz}o(yg,"isWhitespace");function kf(n){return 32<=n&&n<=126||161<=n&&n<=55295&&n!==8232&&n!==8233||57344<=n&&n<=65533&&n!==Cw||65536<=n&&n<=1114111}o(kf,"isPrintable");function hP(n){return kf(n)&&n!==Cw&&n!==Fz&&n!==Nf}o(hP,"isNsCharOrWhitespace");function pP(n,e,t){var r=hP(n),i=r&&!yg(n);return(t?r:r&&n!==ZP&&n!==eO&&n!==tO&&n!==rO&&n!==nO)&&n!==Sw&&!(e===gg&&!i)||hP(e)&&!yg(e)&&n===Sw||e===gg&&i}o(pP,"isPlainSafe");function eH(n){return kf(n)&&n!==Cw&&!yg(n)&&n!==Vz&&n!==qz&&n!==gg&&n!==ZP&&n!==eO&&n!==tO&&n!==rO&&n!==nO&&n!==Sw&&n!==Mz&&n!==$z&&n!==Nz&&n!==zz&&n!==Bz&&n!==Uz&&n!==jz&&n!==Lz&&n!==kz&&n!==Wz&&n!==Gz}o(eH,"isPlainSafeFirst");function tH(n){return!yg(n)&&n!==gg}o(tH,"isPlainSafeLast");function Ff(n,e){var t=n.charCodeAt(e),r;return t>=55296&&t<=56319&&e+1<n.length&&(r=n.charCodeAt(e+1),r>=56320&&r<=57343)?(t-55296)*1024+r-56320+65536:t}o(Ff,"codePointAt");function iO(n){var e=/^\n* /;return e.test(n)}o(iO,"needIndentIndicator");var sO=1,bw=2,aO=3,oO=4,Ll=5;function rH(n,e,t,r,i,s,a,c){var l,u=0,f=null,d=!1,h=!1,p=r!==-1,y=-1,v=eH(Ff(n,0))&&tH(Ff(n,n.length-1));if(e||a)for(l=0;l<n.length;u>=65536?l+=2:l++){if(u=Ff(n,l),!kf(u))return Ll;v=v&&pP(u,f,c),f=u}else{for(l=0;l<n.length;u>=65536?l+=2:l++){if(u=Ff(n,l),u===Nf)d=!0,p&&(h=h||l-y-1>r&&n[y+1]!==" ",y=l);else if(!kf(u))return Ll;v=v&&pP(u,f,c),f=u}h=h||p&&l-y-1>r&&n[y+1]!==" "}return!d&&!h?v&&!a&&!i(n)?sO:s===Lf?Ll:bw:t>9&&iO(n)?Ll:a?s===Lf?Ll:bw:h?oO:aO}o(rH,"chooseScalarStyle");function nH(n,e,t,r,i){n.dump=(function(){if(e.length===0)return n.quotingType===Lf?'""':"''";if(!n.noCompatMode&&(Hz.indexOf(e)!==-1||Qz.test(e)))return n.quotingType===Lf?'"'+e+'"':"'"+e+"'";var s=n.indent*Math.max(1,t),a=n.lineWidth===-1?-1:Math.max(Math.min(n.lineWidth,40),n.lineWidth-s),c=r||n.flowLevel>-1&&t>=n.flowLevel;function l(u){return Zz(n,u)}switch(o(l,"testAmbiguity"),rH(e,c,n.indent,a,l,n.quotingType,n.forceQuotes&&!r,i)){case sO:return e;case bw:return"'"+e.replace(/'/g,"''")+"'";case aO:return"|"+mP(e,n.indent)+gP(dP(e,s));case oO:return">"+mP(e,n.indent)+gP(dP(iH(e,a),s));case Ll:return'"'+sH(e)+'"';default:throw new _n("impossible error: invalid scalar style")}})()}o(nH,"writeScalar");function mP(n,e){var t=iO(n)?String(e):"",r=n[n.length-1]===`
@@ -490,7 +490,7 @@ GFS4: `),console.error(n)},"debug"));Vt[Mr]||(yI=global[Mr]||[],SI(Vt,yI),Vt.clo
490
490
  `:"")+yP(l,e),i=s}return r}o(iH,"foldString");function yP(n,e){if(n===""||n[0]===" ")return n;for(var t=/ [^ ]/g,r,i=0,s,a=0,c=0,l="";r=t.exec(n);)c=r.index,c-i>e&&(s=a>i?a:c,l+=`
491
491
  `+n.slice(i,s),i=s+1),a=c;return l+=`
492
492
  `,n.length-i>e&&a>i?l+=n.slice(i,a)+`
493
- `+n.slice(a+1):l+=n.slice(i),l.slice(1)}o(yP,"foldLine");function sH(n){for(var e="",t=0,r,i=0;i<n.length;t>=65536?i+=2:i++)t=Ff(n,i),r=Jr[t],!r&&kf(t)?(e+=n[i],t>=65536&&(e+=n[i+1])):e+=r||Kz(t);return e}o(sH,"escapeString");function aH(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)),(fa(n,e,c,!1,!1)||typeof c>"u"&&fa(n,e,null,!1,!1))&&(r!==""&&(r+=","+(n.condenseFlow?"":" ")),r+=n.dump);n.tag=i,n.dump="["+r+"]"}o(aH,"writeFlowSequence");function _P(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)),(fa(n,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&fa(n,e+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=vw(n,e)),n.dump&&Nf===n.dump.charCodeAt(0)?i+="-":i+="- ",i+=n.dump);n.tag=s,n.dump=i||"[]"}o(_P,"writeBlockSequence");function oH(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)),fa(n,e,l,!1,!1)&&(n.dump.length>1024&&(f+="? "),f+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),fa(n,e,u,!1,!1)&&(f+=n.dump,r+=f));n.tag=i,n.dump="{"+r+"}"}o(oH,"writeFlowMapping");function cH(n,e,t,r){var i="",s=n.tag,a=Object.keys(t),c,l,u,f,d,h;if(n.sortKeys===!0)a.sort();else if(typeof n.sortKeys=="function")a.sort(n.sortKeys);else if(n.sortKeys)throw new _n("sortKeys must be a boolean or a function");for(c=0,l=a.length;c<l;c+=1)h="",(!r||i!=="")&&(h+=vw(n,e)),u=a[c],f=t[u],n.replacer&&(f=n.replacer.call(t,u,f)),fa(n,e+1,u,!0,!0,!0)&&(d=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024,d&&(n.dump&&Nf===n.dump.charCodeAt(0)?h+="?":h+="? "),h+=n.dump,d&&(h+=vw(n,e)),fa(n,e+1,f,!0,d)&&(n.dump&&Nf===n.dump.charCodeAt(0)?h+=":":h+=": ",h+=n.dump,i+=h));n.tag=s,n.dump=i||"{}"}o(cH,"writeBlockMapping");function SP(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,XP.call(c.represent)==="[object Function]")r=c.represent(e,l);else if(JP.call(c.represent,l))r=c.represent[l](e,l);else throw new _n("!<"+c.tag+'> tag resolver accepts not "'+l+'" style');n.dump=r}return!0}return!1}o(SP,"detectType");function fa(n,e,t,r,i,s,a){n.tag=null,n.dump=t,SP(n,t,!1)||SP(n,t,!0);var c=XP.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?(cH(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(oH(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?_P(n,e-1,n.dump,i):_P(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(aH(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object String]")n.tag!=="?"&&nH(n,n.dump,e,s,l);else{if(c==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new _n("unacceptable kind of an object to dump "+c)}n.tag!==null&&n.tag!=="?"&&(u=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21"),n.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",n.dump=u+" "+n.dump)}return!0}o(fa,"writeNode");function lH(n,e){var t=[],r=[],i,s;for(ww(n,t,r),i=0,s=r.length;i<s;i+=1)e.duplicates.push(t[r[i]]);e.usedDuplicates=new Array(s)}o(lH,"getDuplicateReferences");function ww(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)ww(n[i],e,t);else for(r=Object.keys(n),i=0,s=r.length;i<s;i+=1)ww(n[r[i]],e,t)}o(ww,"inspectNode");function uH(n,e){e=e||{};var t=new Jz(e);t.noRefs||lH(n,t);var r=n;return t.replacer&&(r=t.replacer.call({"":r},"",r)),fa(t,0,r,!0,!0)?t.dump+`
493
+ `+n.slice(a+1):l+=n.slice(i),l.slice(1)}o(yP,"foldLine");function sH(n){for(var e="",t=0,r,i=0;i<n.length;t>=65536?i+=2:i++)t=Ff(n,i),r=Zr[t],!r&&kf(t)?(e+=n[i],t>=65536&&(e+=n[i+1])):e+=r||Kz(t);return e}o(sH,"escapeString");function aH(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)),(fa(n,e,c,!1,!1)||typeof c>"u"&&fa(n,e,null,!1,!1))&&(r!==""&&(r+=","+(n.condenseFlow?"":" ")),r+=n.dump);n.tag=i,n.dump="["+r+"]"}o(aH,"writeFlowSequence");function _P(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)),(fa(n,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&fa(n,e+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=vw(n,e)),n.dump&&Nf===n.dump.charCodeAt(0)?i+="-":i+="- ",i+=n.dump);n.tag=s,n.dump=i||"[]"}o(_P,"writeBlockSequence");function oH(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)),fa(n,e,l,!1,!1)&&(n.dump.length>1024&&(f+="? "),f+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),fa(n,e,u,!1,!1)&&(f+=n.dump,r+=f));n.tag=i,n.dump="{"+r+"}"}o(oH,"writeFlowMapping");function cH(n,e,t,r){var i="",s=n.tag,a=Object.keys(t),c,l,u,f,d,h;if(n.sortKeys===!0)a.sort();else if(typeof n.sortKeys=="function")a.sort(n.sortKeys);else if(n.sortKeys)throw new _n("sortKeys must be a boolean or a function");for(c=0,l=a.length;c<l;c+=1)h="",(!r||i!=="")&&(h+=vw(n,e)),u=a[c],f=t[u],n.replacer&&(f=n.replacer.call(t,u,f)),fa(n,e+1,u,!0,!0,!0)&&(d=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024,d&&(n.dump&&Nf===n.dump.charCodeAt(0)?h+="?":h+="? "),h+=n.dump,d&&(h+=vw(n,e)),fa(n,e+1,f,!0,d)&&(n.dump&&Nf===n.dump.charCodeAt(0)?h+=":":h+=": ",h+=n.dump,i+=h));n.tag=s,n.dump=i||"{}"}o(cH,"writeBlockMapping");function SP(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,XP.call(c.represent)==="[object Function]")r=c.represent(e,l);else if(JP.call(c.represent,l))r=c.represent[l](e,l);else throw new _n("!<"+c.tag+'> tag resolver accepts not "'+l+'" style');n.dump=r}return!0}return!1}o(SP,"detectType");function fa(n,e,t,r,i,s,a){n.tag=null,n.dump=t,SP(n,t,!1)||SP(n,t,!0);var c=XP.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?(cH(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(oH(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?_P(n,e-1,n.dump,i):_P(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(aH(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object String]")n.tag!=="?"&&nH(n,n.dump,e,s,l);else{if(c==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new _n("unacceptable kind of an object to dump "+c)}n.tag!==null&&n.tag!=="?"&&(u=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21"),n.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",n.dump=u+" "+n.dump)}return!0}o(fa,"writeNode");function lH(n,e){var t=[],r=[],i,s;for(ww(n,t,r),i=0,s=r.length;i<s;i+=1)e.duplicates.push(t[r[i]]);e.usedDuplicates=new Array(s)}o(lH,"getDuplicateReferences");function ww(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)ww(n[i],e,t);else for(r=Object.keys(n),i=0,s=r.length;i<s;i+=1)ww(n[r[i]],e,t)}o(ww,"inspectNode");function uH(n,e){e=e||{};var t=new Jz(e);t.noRefs||lH(n,t);var r=n;return t.replacer&&(r=t.replacer.call({"":r},"",r)),fa(t,0,r,!0,!0)?t.dump+`
494
494
  `:""}o(uH,"dump$1");var fH=uH,dH={dump:fH};function Iw(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(Iw,"renamed");var hH=jr,pH=wP,mH=xP,gH=OP,yH=FP,_H=Tw,SH=KP.load,vH=KP.loadAll,bH=dH.dump,wH=_n,EH={binary:MP,float:PP,map:AP,null:CP,pairs:$P,set:VP,timestamp:LP,bool:IP,int:RP,merge:kP,omap:jP,seq:TP,str:EP},TH=Iw("safeLoad","load"),AH=Iw("safeLoadAll","loadAll"),xH=Iw("safeDump","dump"),$r={Type:hH,Schema:pH,FAILSAFE_SCHEMA:mH,JSON_SCHEMA:gH,CORE_SCHEMA:yH,DEFAULT_SCHEMA:_H,load:SH,loadAll:vH,dump:bH,YAMLException:wH,types:EH,safeLoad:TH,safeLoadAll:AH,safeDump:xH};var CH=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Nt=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{o(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await ar.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return ar.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await ar.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await ar.default.ensureDir(or.default.dirname(r)),await ar.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await ar.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await ar.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await ar.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await ar.default.remove(t)}async exists(e){let t=this.resolvePath(e);return ar.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=ar.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=or.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=ar.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 ar.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await ar.default.ensureDir(or.default.dirname(i)),await ar.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await ar.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(CH.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=or.default.dirname(this.resolvePath(t)),s;if(or.default.isAbsolute(r)?s=this.resolvePath(r):s=or.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),ar.default.existsSync(s)){let u=or.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let a=r.toLowerCase(),c=this.basenameIndex.get(a);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(a);return l?this.createFileObject(l):null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=or.default.relative(this.rootPath,e),r=or.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=ar.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let a=s.aliases,c=Array.isArray(a)?a:typeof a=="string"?[a]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let r=or.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=or.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 or.default.isAbsolute(e)?e:or.default.join(this.rootPath,e)}createFileObject(e){let t=or.default.basename(e),r=or.default.basename(e,or.default.extname(e)),i=or.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:or.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=$r.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=$r.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
495
495
  ${r.trim()}
496
496
  ---`):`---
@@ -526,7 +526,7 @@ To fix this:
526
526
  3. Simplify query: reduce WHERE clauses or add LIMIT
527
527
  4. Use cache: --use-cache for faster vault loading${i!==void 0?`
528
528
 
529
- Partial results: ${i} result(s) were collected before timeout.`:""}`}static{o(this,"QueryTimeoutError")}};var Vf=Y(require("path")),Zr=Y(Ya()),Tr=Y(Dt());var Bn=class{constructor(e){this.cliVersion="1.0.0";this.vaultPath=Vf.default.resolve(e),this.cachePath=Vf.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{o(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){try{if(!await Zr.default.pathExists(this.cachePath))return!1;let e=await Zr.default.readJson(this.cachePath);return!(!e.metadata||typeof e.metadata.vaultMtime!="number"||typeof e.metadata.tripleCount!="number"||(await Zr.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 Zr.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 Nt(this.vaultPath),s=await new Tr.NoteToRDFConverter(r).convertVaultWithValidation({strict:e.strict??!1}),a=await Zr.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 Zr.default.ensureDir(Vf.default.dirname(this.cachePath)),await Zr.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 Nt(this.vaultPath);return new Tr.NoteToRDFConverter(e).validateVault()}async invalidate(){await Zr.default.pathExists(this.cachePath)&&await Zr.default.remove(this.cachePath)}async getCacheStats(){try{if(!await Zr.default.pathExists(this.cachePath))return null;let e=await Zr.default.readJson(this.cachePath),t=await Zr.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 Zr.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 Zr.default.ensureDir(Vf.default.dirname(this.cachePath)),await Zr.default.writeJson(this.cachePath,i,{spaces:0})}serializeTriple(e){return{subject:Rw(e.subject),predicate:Rw(e.predicate),object:Rw(e.object)}}deserializeTriple(e){return new Tr.Triple(Pw(e.subject),Pw(e.predicate),Pw(e.object))}};function Rw(n){if(n instanceof Tr.IRI)return{type:"IRI",value:n.value};if(n instanceof Tr.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 Tr.BlankNode?{type:"BlankNode",value:n.value}:{type:"IRI",value:String(n)}}o(Rw,"serializeNode");function Pw(n){switch(n.type){case"IRI":return new Tr.IRI(n.value);case"Literal":return n.datatype?new Tr.Literal(n.value,new Tr.IRI(n.datatype)):n.language?new Tr.Literal(n.value,void 0,n.language):new Tr.Literal(n.value);case"BlankNode":return new Tr.BlankNode(n.value);default:return new Tr.IRI(n.value)}}o(Pw,"deserializeNode");var lO=Y(require("crypto")),Bf=Y(require("path")),uO=Y(require("os")),Un=Y(Ya());var Ul=class{static{o(this,"QueryResultCache")}constructor(e={}){this.cacheDir=e.cacheDir??Bf.default.join(uO.default.homedir(),".exocortex","cache","query-results")}getCacheDir(){return this.cacheDir}getCacheKey(e){let t=e.trim().replace(/\s+/g," ");return lO.default.createHash("sha256").update(t).digest("hex")}async get(e,t){let r=this.getCacheKey(e),i=this.getCachePath(r);try{if(!await Un.default.pathExists(i))return null;let s=await Un.default.readJson(i),a=Date.now()-s.timestamp,c=t*1e3;return a>c?(await Un.default.remove(i),null):s.result}catch{return null}}async set(e,t,r){let i=this.getCacheKey(e),s=this.getCachePath(i);await Un.default.ensureDir(this.cacheDir);let a={timestamp:Date.now(),result:t};await Un.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 Un.default.remove(r)}catch{}}async clear(){try{if(await Un.default.pathExists(this.cacheDir)){let e=await Un.default.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>Un.default.remove(Bf.default.join(this.cacheDir,t))))}}catch{}}async getCacheStats(){try{if(!await Un.default.pathExists(this.cacheDir))return{entryCount:0,totalSizeBytes:0};let t=(await Un.default.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),r=0;for(let i of t){let s=await Un.default.stat(Bf.default.join(this.cacheDir,i));r+=s.size}return{entryCount:t.length,totalSizeBytes:r}}catch{return{entryCount:0,totalSizeBytes:0}}}getCachePath(e){return Bf.default.join(this.cacheDir,`${e}.json`)}};var Qf=Y(require("node:process"),1);var fO=o((n=0)=>e=>`\x1B[${e+n}m`,"wrapAnsi16"),dO=o((n=0)=>e=>`\x1B[${38+n};5;${e}m`,"wrapAnsi256"),hO=o((n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,"wrapAnsi16m"),Lt={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]}},lfe=Object.keys(Lt.modifier),IH=Object.keys(Lt.color),RH=Object.keys(Lt.bgColor),ufe=[...IH,...RH];function PH(){let n=new Map;for(let[e,t]of Object.entries(Lt)){for(let[r,i]of Object.entries(t))Lt[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=Lt[r],n.set(i[0],i[1]);Object.defineProperty(Lt,e,{value:t,enumerable:!1})}return Object.defineProperty(Lt,"codes",{value:n,enumerable:!1}),Lt.color.close="\x1B[39m",Lt.bgColor.close="\x1B[49m",Lt.color.ansi=fO(),Lt.color.ansi256=dO(),Lt.color.ansi16m=hO(),Lt.bgColor.ansi=fO(10),Lt.bgColor.ansi256=dO(10),Lt.bgColor.ansi16m=hO(10),Object.defineProperties(Lt,{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=>Lt.rgbToAnsi256(...Lt.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)=>Lt.ansi256ToAnsi(Lt.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:o(e=>Lt.ansi256ToAnsi(Lt.hexToAnsi256(e)),"value"),enumerable:!1}}),Lt}o(PH,"assembleStyles");var OH=PH(),Ui=OH;var bg=Y(require("node:process"),1),mO=Y(require("node:os"),1),Ow=Y(require("node:tty"),1);function ai(n,e=globalThis.Deno?globalThis.Deno.args:bg.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(ai,"hasFlag");var{env:kt}=bg.default,vg;ai("no-color")||ai("no-colors")||ai("color=false")||ai("color=never")?vg=0:(ai("color")||ai("colors")||ai("color=true")||ai("color=always"))&&(vg=1);function FH(){if("FORCE_COLOR"in kt)return kt.FORCE_COLOR==="true"?1:kt.FORCE_COLOR==="false"?0:kt.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(kt.FORCE_COLOR,10),3)}o(FH,"envForceColor");function DH(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}o(DH,"translateLevel");function NH(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=FH();r!==void 0&&(vg=r);let i=t?vg:r;if(i===0)return 0;if(t){if(ai("color=16m")||ai("color=full")||ai("color=truecolor"))return 3;if(ai("color=256"))return 2}if("TF_BUILD"in kt&&"AGENT_NAME"in kt)return 1;if(n&&!e&&i===void 0)return 0;let s=i||0;if(kt.TERM==="dumb")return s;if(bg.default.platform==="win32"){let a=mO.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in kt)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in kt)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in kt)||kt.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in kt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(kt.TEAMCITY_VERSION)?1:0;if(kt.COLORTERM==="truecolor"||kt.TERM==="xterm-kitty"||kt.TERM==="xterm-ghostty"||kt.TERM==="wezterm")return 3;if("TERM_PROGRAM"in kt){let a=Number.parseInt((kt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(kt.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(kt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(kt.TERM)||"COLORTERM"in kt?1:s}o(NH,"_supportsColor");function pO(n,e={}){let t=NH(n,{streamIsTTY:n&&n.isTTY,...e});return DH(t)}o(pO,"createSupportsColor");var LH={stdout:pO({isTTY:Ow.default.isatty(1)}),stderr:pO({isTTY:Ow.default.isatty(2)})},gO=LH;function yO(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(yO,"stringReplaceAll");function _O(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
529
+ Partial results: ${i} result(s) were collected before timeout.`:""}`}static{o(this,"QueryTimeoutError")}};var Vf=Y(require("path")),en=Y(Ka()),Tr=Y(Dt());var Bn=class{constructor(e){this.cliVersion="1.0.0";this.vaultPath=Vf.default.resolve(e),this.cachePath=Vf.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{o(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){try{if(!await en.default.pathExists(this.cachePath))return!1;let e=await en.default.readJson(this.cachePath);return!(!e.metadata||typeof e.metadata.vaultMtime!="number"||typeof e.metadata.tripleCount!="number"||(await en.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 en.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 Nt(this.vaultPath),s=await new Tr.NoteToRDFConverter(r).convertVaultWithValidation({strict:e.strict??!1}),a=await en.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 en.default.ensureDir(Vf.default.dirname(this.cachePath)),await en.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 Nt(this.vaultPath);return new Tr.NoteToRDFConverter(e).validateVault()}async invalidate(){await en.default.pathExists(this.cachePath)&&await en.default.remove(this.cachePath)}async getCacheStats(){try{if(!await en.default.pathExists(this.cachePath))return null;let e=await en.default.readJson(this.cachePath),t=await en.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 en.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 en.default.ensureDir(Vf.default.dirname(this.cachePath)),await en.default.writeJson(this.cachePath,i,{spaces:0})}serializeTriple(e){return{subject:Rw(e.subject),predicate:Rw(e.predicate),object:Rw(e.object)}}deserializeTriple(e){return new Tr.Triple(Pw(e.subject),Pw(e.predicate),Pw(e.object))}};function Rw(n){if(n instanceof Tr.IRI)return{type:"IRI",value:n.value};if(n instanceof Tr.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 Tr.BlankNode?{type:"BlankNode",value:n.value}:{type:"IRI",value:String(n)}}o(Rw,"serializeNode");function Pw(n){switch(n.type){case"IRI":return new Tr.IRI(n.value);case"Literal":return n.datatype?new Tr.Literal(n.value,new Tr.IRI(n.datatype)):n.language?new Tr.Literal(n.value,void 0,n.language):new Tr.Literal(n.value);case"BlankNode":return new Tr.BlankNode(n.value);default:return new Tr.IRI(n.value)}}o(Pw,"deserializeNode");var lO=Y(require("crypto")),Bf=Y(require("path")),uO=Y(require("os")),Un=Y(Ka());var Ul=class{static{o(this,"QueryResultCache")}constructor(e={}){this.cacheDir=e.cacheDir??Bf.default.join(uO.default.homedir(),".exocortex","cache","query-results")}getCacheDir(){return this.cacheDir}getCacheKey(e){let t=e.trim().replace(/\s+/g," ");return lO.default.createHash("sha256").update(t).digest("hex")}async get(e,t){let r=this.getCacheKey(e),i=this.getCachePath(r);try{if(!await Un.default.pathExists(i))return null;let s=await Un.default.readJson(i),a=Date.now()-s.timestamp,c=t*1e3;return a>c?(await Un.default.remove(i),null):s.result}catch{return null}}async set(e,t,r){let i=this.getCacheKey(e),s=this.getCachePath(i);await Un.default.ensureDir(this.cacheDir);let a={timestamp:Date.now(),result:t};await Un.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 Un.default.remove(r)}catch{}}async clear(){try{if(await Un.default.pathExists(this.cacheDir)){let e=await Un.default.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>Un.default.remove(Bf.default.join(this.cacheDir,t))))}}catch{}}async getCacheStats(){try{if(!await Un.default.pathExists(this.cacheDir))return{entryCount:0,totalSizeBytes:0};let t=(await Un.default.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),r=0;for(let i of t){let s=await Un.default.stat(Bf.default.join(this.cacheDir,i));r+=s.size}return{entryCount:t.length,totalSizeBytes:r}}catch{return{entryCount:0,totalSizeBytes:0}}}getCachePath(e){return Bf.default.join(this.cacheDir,`${e}.json`)}};var Qf=Y(require("node:process"),1);var fO=o((n=0)=>e=>`\x1B[${e+n}m`,"wrapAnsi16"),dO=o((n=0)=>e=>`\x1B[${38+n};5;${e}m`,"wrapAnsi256"),hO=o((n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,"wrapAnsi16m"),Lt={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]}},lfe=Object.keys(Lt.modifier),IH=Object.keys(Lt.color),RH=Object.keys(Lt.bgColor),ufe=[...IH,...RH];function PH(){let n=new Map;for(let[e,t]of Object.entries(Lt)){for(let[r,i]of Object.entries(t))Lt[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=Lt[r],n.set(i[0],i[1]);Object.defineProperty(Lt,e,{value:t,enumerable:!1})}return Object.defineProperty(Lt,"codes",{value:n,enumerable:!1}),Lt.color.close="\x1B[39m",Lt.bgColor.close="\x1B[49m",Lt.color.ansi=fO(),Lt.color.ansi256=dO(),Lt.color.ansi16m=hO(),Lt.bgColor.ansi=fO(10),Lt.bgColor.ansi256=dO(10),Lt.bgColor.ansi16m=hO(10),Object.defineProperties(Lt,{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=>Lt.rgbToAnsi256(...Lt.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)=>Lt.ansi256ToAnsi(Lt.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:o(e=>Lt.ansi256ToAnsi(Lt.hexToAnsi256(e)),"value"),enumerable:!1}}),Lt}o(PH,"assembleStyles");var OH=PH(),Ui=OH;var bg=Y(require("node:process"),1),mO=Y(require("node:os"),1),Ow=Y(require("node:tty"),1);function ai(n,e=globalThis.Deno?globalThis.Deno.args:bg.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(ai,"hasFlag");var{env:kt}=bg.default,vg;ai("no-color")||ai("no-colors")||ai("color=false")||ai("color=never")?vg=0:(ai("color")||ai("colors")||ai("color=true")||ai("color=always"))&&(vg=1);function FH(){if("FORCE_COLOR"in kt)return kt.FORCE_COLOR==="true"?1:kt.FORCE_COLOR==="false"?0:kt.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(kt.FORCE_COLOR,10),3)}o(FH,"envForceColor");function DH(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}o(DH,"translateLevel");function NH(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=FH();r!==void 0&&(vg=r);let i=t?vg:r;if(i===0)return 0;if(t){if(ai("color=16m")||ai("color=full")||ai("color=truecolor"))return 3;if(ai("color=256"))return 2}if("TF_BUILD"in kt&&"AGENT_NAME"in kt)return 1;if(n&&!e&&i===void 0)return 0;let s=i||0;if(kt.TERM==="dumb")return s;if(bg.default.platform==="win32"){let a=mO.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in kt)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in kt)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in kt)||kt.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in kt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(kt.TEAMCITY_VERSION)?1:0;if(kt.COLORTERM==="truecolor"||kt.TERM==="xterm-kitty"||kt.TERM==="xterm-ghostty"||kt.TERM==="wezterm")return 3;if("TERM_PROGRAM"in kt){let a=Number.parseInt((kt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(kt.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(kt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(kt.TERM)||"COLORTERM"in kt?1:s}o(NH,"_supportsColor");function pO(n,e={}){let t=NH(n,{streamIsTTY:n&&n.isTTY,...e});return DH(t)}o(pO,"createSupportsColor");var LH={stdout:pO({isTTY:Ow.default.isatty(1)}),stderr:pO({isTTY:Ow.default.isatty(2)})},gO=LH;function yO(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(yO,"stringReplaceAll");function _O(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
530
530
  `:`
531
531
  `)+t,i=r+1,r=n.indexOf(`
532
532
  `,i)}while(r!==-1);return s+=n.slice(i),s}o(_O,"stringEncaseCRLFWithFirstIndex");var{stdout:SO,stderr:vO}=gO,Fw=Symbol("GENERATOR"),ql=Symbol("STYLER"),Uf=Symbol("IS_EMPTY"),bO=["ansi","ansi","ansi256","ansi16m"],Wl=Object.create(null),kH=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=SO?SO.level:0;n.level=e.level===void 0?t:e.level},"applyOptions");var MH=o(n=>{let e=o((...t)=>t.join(" "),"chalk");return kH(e,n),Object.setPrototypeOf(e,qf.prototype),e},"chalkFactory");function qf(n){return MH(n)}o(qf,"createChalk");Object.setPrototypeOf(qf.prototype,Function.prototype);for(let[n,e]of Object.entries(Ui))Wl[n]={get(){let t=wg(this,Nw(e.open,e.close,this[ql]),this[Uf]);return Object.defineProperty(this,n,{value:t}),t}};Wl.visible={get(){let n=wg(this,this[ql],!0);return Object.defineProperty(this,"visible",{value:n}),n}};var Dw=o((n,e,t,...r)=>n==="rgb"?e==="ansi16m"?Ui[t].ansi16m(...r):e==="ansi256"?Ui[t].ansi256(Ui.rgbToAnsi256(...r)):Ui[t].ansi(Ui.rgbToAnsi(...r)):n==="hex"?Dw("rgb",e,t,...Ui.hexToRgb(...r)):Ui[t][n](...r),"getModelAnsi"),jH=["rgb","hex","ansi256"];for(let n of jH){Wl[n]={get(){let{level:t}=this;return function(...r){let i=Nw(Dw(n,bO[t],"color",...r),Ui.color.close,this[ql]);return wg(this,i,this[Uf])}}};let e="bg"+n[0].toUpperCase()+n.slice(1);Wl[e]={get(){let{level:t}=this;return function(...r){let i=Nw(Dw(n,bO[t],"bgColor",...r),Ui.bgColor.close,this[ql]);return wg(this,i,this[Uf])}}}}var $H=Object.defineProperties(()=>{},{...Wl,level:{enumerable:!0,get(){return this[Fw].level},set(n){this[Fw].level=n}}}),Nw=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"),wg=o((n,e,t)=>{let r=o((...i)=>VH(r,i.length===1?""+i[0]:i.join(" ")),"builder");return Object.setPrototypeOf(r,$H),r[Fw]=n,r[ql]=e,r[Uf]=t,r},"createBuilder"),VH=o((n,e)=>{if(n.level<=0||!e)return n[Uf]?"":e;let t=n[ql];if(t===void 0)return e;let{openAll:r,closeAll:i}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=yO(e,t.close,t.open),t=t.parent;let s=e.indexOf(`
@@ -605,24 +605,24 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
605
605
  `+n}o(Hl,"injectExocortexPrefixes");function Dg(n){return n.replace(EQ,(e,t,r,i,s)=>MO.has(r.toLowerCase())?`${r}:${i}`:e)}o(Dg,"transformShorthandNotation");function Kf(n){let e=new Map(n);for(let t of MO)e.delete(t);return e}o(Kf,"filterOntologyPrefixes");var TQ=300,jO=3e4,AQ="EXOCORTEX_SPARQL_TIMEOUT";function xQ(){let n=process.env[AQ];if(!n)return jO;try{let e=CQ(n);if(e!==null&&e>0)return e}catch{}return jO}o(xQ,"getDefaultTimeout");function CQ(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(CQ,"parseTimeoutSafe");function IQ(n){if(!n)return TQ;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(IQ,"parseCacheTtl");function RQ(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(RQ,"parseTimeout");async function iE(n,e,t=Date.now()){let r,i=new Promise((s,a)=>{r=setTimeout(()=>{let c=Date.now()-t;a(new $f(e,c))},e),r&&typeof r=="object"&&"unref"in r&&r.unref()});return Promise.race([n,i])}o(iE,"executeWithTimeout");function PQ(n,e){return e.concat([n])}o(PQ,"collectAlso");function VO(){return new Te("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)",PQ,[]).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?RQ(e.timeout):xQ(),a=IQ(e.cacheTtl),c=e.cache!==!1;if(e.template){let z=new zl,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(([$,re])=>`${$}=${re}`).join(", ")}`),console.log()}}else if(n)r=OQ(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 FQ(r,e,t);return}let l=(0,Xf.resolve)(e.vault);if(c){let G=await new Ul().get(r,a);if(G!==null){let F=Date.now()-i;if(t==="json"){let $=X.success(G,{durationMs:F,itemCount:G.count||0,queryResultCacheHit:!0});console.log(JSON.stringify($,null,2))}else{console.log(`\u{1F4E6} (cached) Query result loaded from cache in ${F}ms
606
606
  `);let $=G;$.type==="select"&&$.bindings?(console.log(`\u2705 Found ${$.bindings.length} result(s)
607
607
  `),LQ($.bindings,e.format)):$.type==="construct"&&$.triples&&(console.log(`\u2705 Generated ${$.triples.length} triple(s)
608
- `),kQ($.triples,e.format))}return}}if(!(0,Ql.existsSync)(l))throw new Ee(l);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${l}...`);let u=Date.now(),f,d=!1;if(e.useCache){let G=await new Bn(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 Nt(l);f=await new Gt.NoteToRDFConverter(z).convertVault()}let h=e.also||[];for(let z of h){let G=(0,Xf.resolve)(z);if(!(0,Ql.existsSync)(G))throw new Ee(G);t==="text"&&console.log(`\u{1F4E6} Loading additional vault: ${G}...`);let F=new Nt(G),re=await new Gt.NoteToRDFConverter(F).convertVault();f=f.concat(re),t==="text"&&console.log(` \u2795 Added ${re.length} triples from ${G}`)}let p=new Gt.InMemoryTripleStore;await p.addAll(f);let y=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 ${y}ms${z}${G}
609
- `),console.log("\u{1F50D} Parsing SPARQL query...")}let v=new Gt.ExoQLParser;r=Dg(r),r=Hl(r);let E=Kf(Yf(l));for(let z of h){let G=Kf(Yf((0,Xf.resolve)(z)));for(let[F,$]of G)E.has(F)||E.set(F,$)}E.size>0&&v.setVaultPrefixes(E);let b=v.parse(r);if(b.type==="update"){t==="text"&&console.log("\u{1F504} Executing SPARQL UPDATE...");let z=Date.now(),G=new Gt.UpdateExecutor(p),F=await iE(G.execute(b),s,z),$=Date.now()-z,re=Date.now()-i;if(t==="json"){let Ye=X.success({query:r,type:"update",results:F},{durationMs:re,itemCount:F.length,loadDurationMs:y,execDurationMs:$,triplesScanned:f.length,cacheHit:d});console.log(JSON.stringify(Ye,null,2))}else jQ(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(`
610
- \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${$}ms`),console.log(` Total time: ${re}ms`),console.log(` Triples scanned: ${f.length}`));return}t==="text"&&console.log("\u{1F504} Translating to algebra...");let I=new Gt.ExoQLAlgebraTranslator().translate(b);if(!e.noOptimize&&I.type!=="construct")I=new Gt.AlgebraOptimizer().optimize(I);else if(!e.noOptimize&&I.type==="construct"){let z=new Gt.AlgebraOptimizer,G=I;I={...G,where:z.optimize(G.where)}}if(e.explain&&t==="text"){console.log("\u{1F4CA} Query Plan:");let z=new Gt.AlgebraSerializer;if(I.type==="construct"){let G=I;console.log("CONSTRUCT Template:"),console.log(" (template patterns)"),console.log("WHERE:"),console.log(z.toString(G.where))}else console.log(z.toString(I));console.log()}let j=Date.now(),B=new Gt.ExoQLQueryExecutor(p);typeof B.setTimeout=="function"&&B.setTimeout(s);let te=t==="text"?new Ig("Executing query",{delayMs:2e3}):null;if(B.isConstructQuery(I)){te?.start();let z=await iE(B.executeConstruct(I),s,j),G=Date.now()-j;te?.stop();let F=Date.now()-i;if(c){let $=new Bl,re={type:"construct",count:z.length,triples:JSON.parse($.formatJson(z))};await new Ul().set(r,re,a)}if(t==="json"){let $=new Bl,re={query:r,count:z.length,triples:JSON.parse($.formatJson(z))},Ye=X.success(re,{durationMs:F,itemCount:z.length,loadDurationMs:y,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
608
+ `),kQ($.triples,e.format))}return}}if(!(0,Ql.existsSync)(l))throw new Ee(l);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${l}...`);let u=Date.now(),f,d=!1;if(e.useCache){let G=await new Bn(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 Nt(l);f=await new zt.NoteToRDFConverter(z).convertVault()}let h=e.also||[];for(let z of h){let G=(0,Xf.resolve)(z);if(!(0,Ql.existsSync)(G))throw new Ee(G);t==="text"&&console.log(`\u{1F4E6} Loading additional vault: ${G}...`);let F=new Nt(G),re=await new zt.NoteToRDFConverter(F).convertVault();f=f.concat(re),t==="text"&&console.log(` \u2795 Added ${re.length} triples from ${G}`)}let p=new zt.InMemoryTripleStore;await p.addAll(f);let y=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 ${y}ms${z}${G}
609
+ `),console.log("\u{1F50D} Parsing SPARQL query...")}let v=new zt.ExoQLParser;r=Dg(r),r=Hl(r);let E=Kf(Yf(l));for(let z of h){let G=Kf(Yf((0,Xf.resolve)(z)));for(let[F,$]of G)E.has(F)||E.set(F,$)}E.size>0&&v.setVaultPrefixes(E);let b=v.parse(r);if(b.type==="update"){t==="text"&&console.log("\u{1F504} Executing SPARQL UPDATE...");let z=Date.now(),G=new zt.UpdateExecutor(p),F=await iE(G.execute(b),s,z),$=Date.now()-z,re=Date.now()-i;if(t==="json"){let Ye=X.success({query:r,type:"update",results:F},{durationMs:re,itemCount:F.length,loadDurationMs:y,execDurationMs:$,triplesScanned:f.length,cacheHit:d});console.log(JSON.stringify(Ye,null,2))}else jQ(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(`
610
+ \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${$}ms`),console.log(` Total time: ${re}ms`),console.log(` Triples scanned: ${f.length}`));return}t==="text"&&console.log("\u{1F504} Translating to algebra...");let I=new zt.ExoQLAlgebraTranslator().translate(b);if(!e.noOptimize&&I.type!=="construct")I=new zt.AlgebraOptimizer().optimize(I);else if(!e.noOptimize&&I.type==="construct"){let z=new zt.AlgebraOptimizer,G=I;I={...G,where:z.optimize(G.where)}}if(e.explain&&t==="text"){console.log("\u{1F4CA} Query Plan:");let z=new zt.AlgebraSerializer;if(I.type==="construct"){let G=I;console.log("CONSTRUCT Template:"),console.log(" (template patterns)"),console.log("WHERE:"),console.log(z.toString(G.where))}else console.log(z.toString(I));console.log()}let j=Date.now(),B=new zt.ExoQLQueryExecutor(p);typeof B.setTimeout=="function"&&B.setTimeout(s);let te=t==="text"?new Ig("Executing query",{delayMs:2e3}):null;if(B.isConstructQuery(I)){te?.start();let z=await iE(B.executeConstruct(I),s,j),G=Date.now()-j;te?.stop();let F=Date.now()-i;if(c){let $=new Bl,re={type:"construct",count:z.length,triples:JSON.parse($.formatJson(z))};await new Ul().set(r,re,a)}if(t==="json"){let $=new Bl,re={query:r,count:z.length,triples:JSON.parse($.formatJson(z))},Ye=X.success(re,{durationMs:F,itemCount:z.length,loadDurationMs:y,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
611
611
  `),z.length>0?NQ(z,e.format):console.log("No triples generated."),e.stats&&(console.log(`
612
612
  \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${G}ms`),console.log(` Total time: ${F}ms`),console.log(` Triples scanned: ${f.length}`),console.log(` Triples generated: ${z.length}`),e.useCache&&console.log(` Triple cache: ${d?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}else{te?.start();let z=await iE(B.executeAll(I),s,j),G=Date.now()-j;te?.stop();let F=Date.now()-i,$=z.map(re=>re.toJSON());if(c){let re={type:"select",count:z.length,bindings:$};await new Ul().set(r,re,a)}if(t==="json"){let re={query:r,count:z.length,bindings:$},Ye=X.success(re,{durationMs:F,itemCount:z.length,loadDurationMs:y,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
613
613
  `),z.length>0?DQ(z,e.format):console.log("No results found."),e.stats&&(console.log(`
614
614
  \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${d?" (from cache)":""}`),console.log(` Query execution: ${G}ms`),console.log(` Total time: ${F}ms`),console.log(` Triples scanned: ${f.length}`),console.log(` Results returned: ${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){BO(i,r,t)}})}o(VO,"sparqlQueryCommand");function BO(n,e,t){let r=new Og;if(r.classifyError(n)!=="unknown"){let s=r.enhanceError(n,e);if(t==="json"){let a=X.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(BO,"handleSparqlError");function OQ(n){if(n.includes("SELECT")||n.includes("CONSTRUCT")||n.includes("INSERT")||n.includes("DELETE"))return n;let e=(0,Xf.resolve)(n);return(0,Ql.existsSync)(e)?(0,Ql.readFileSync)(e,"utf-8"):n}o(OQ,"loadQuery");async function FQ(n,e,t){if(e.explain){let i=new Rg,s=await i.analyze(n,{includeAlgebraPlan:!0,optimize:!e.noOptimize});if(t==="json"){let a=X.success(s);console.log(JSON.stringify(a,null,2))}else s.valid?(console.log(`\u2705 Query syntax is valid
615
- `),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new Gt.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new Gt.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new Gt.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new Gt.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=X.success({valid:!0,queryType:$O(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: ${$O(i)}`)}catch(i){BO(i,n,t)}}o(FQ,"executeDryRun");function $O(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}o($O,"getQueryType");function DQ(n,e){switch(e){case"json":let t=new Vl;console.log(t.format(n));break;case"csv":let r=new Sg;console.log(r.format(n));break;case"table":default:let i=new $l;console.log(i.format(n));break}}o(DQ,"formatSelectResults");function NQ(n,e){let t=new Bl;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(NQ,"formatConstructResults");function LQ(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(LQ,"formatCachedSelectResults");function kQ(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}> ${MQ(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(kQ,"formatCachedConstructResults");function MQ(n){return Fg.formatObject(n)}o(MQ,"formatNTriplesObject");function jQ(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(jQ,"formatUpdateResults");var UO=require("fs"),qO=require("path"),As=Y(Dt());function WO(){return new Te("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,qO.resolve)(n.vault);if(!(0,UO.existsSync)(t))throw new Ee(t);let r=new Bn(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 As.InMemoryTripleStore;await f.addAll(u),c=await new As.RDFSInferenceEngine().materialize(f);let h=new As.NonInheritablePropertyRegistry;await h.initialize(f);let p=new As.PropertyCardinalityRegistry;await p.initialize(f);let v=await new As.PrototypeChainMaterializer(h,p).materialize(f);if(c+=v,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=X.success({cache:u,stats:h,validation:f},{durationMs:l});console.log(JSON.stringify(p,null,2))}}else{let d=X.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(d,null,2))}}else{if(a.skippedFiles.length>0){console.log(`
615
+ `),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new zt.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new zt.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new zt.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new zt.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=X.success({valid:!0,queryType:$O(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: ${$O(i)}`)}catch(i){BO(i,n,t)}}o(FQ,"executeDryRun");function $O(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}o($O,"getQueryType");function DQ(n,e){switch(e){case"json":let t=new Vl;console.log(t.format(n));break;case"csv":let r=new Sg;console.log(r.format(n));break;case"table":default:let i=new $l;console.log(i.format(n));break}}o(DQ,"formatSelectResults");function NQ(n,e){let t=new Bl;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(NQ,"formatConstructResults");function LQ(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(LQ,"formatCachedSelectResults");function kQ(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}> ${MQ(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(kQ,"formatCachedConstructResults");function MQ(n){return Fg.formatObject(n)}o(MQ,"formatNTriplesObject");function jQ(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(jQ,"formatUpdateResults");var UO=require("fs"),qO=require("path"),As=Y(Dt());function WO(){return new Te("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,qO.resolve)(n.vault);if(!(0,UO.existsSync)(t))throw new Ee(t);let r=new Bn(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 As.InMemoryTripleStore;await f.addAll(u),c=await new As.RDFSInferenceEngine().materialize(f);let h=new As.NonInheritablePropertyRegistry;await h.initialize(f);let p=new As.PropertyCardinalityRegistry;await p.initialize(f);let v=await new As.PrototypeChainMaterializer(h,p).materialize(f);if(c+=v,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=X.success({cache:u,stats:h,validation:f},{durationMs:l});console.log(JSON.stringify(p,null,2))}}else{let d=X.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(d,null,2))}}else{if(a.skippedFiles.length>0){console.log(`
616
616
  \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(`
617
- \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: ${$Q(u.sizeBytes)}`))}}}catch(t){D.handle(t)}})}o(WO,"sparqlIndexCommand");function $Q(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o($Q,"formatBytes");function GO(){return new Te("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 zl,r=t.listTemplates();if(e==="json"){let i=X.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(GO,"sparqlTemplatesCommand");var JF=require("path");var mr=Y(Ya()),ro=Y(require("path"));var hF=Y(iF(),1);var Zf=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var HQ={"[: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]},ed=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),QQ=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),sF=o(n=>n.join(""),"rangesToString"),aF=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 v=n.charAt(s);if((v==="!"||v==="^")&&s===t+1){u=!0,s++;continue}if(v==="]"&&a&&!l){f=s+1;break}if(a=!0,v==="\\"&&!l){l=!0,s++;continue}if(v==="["&&!l){for(let[E,[b,A,I]]of Object.entries(HQ))if(n.startsWith(E,s)){if(d)return["$.",!1,n.length-t,!0];s+=E.length,I?i.push(b):r.push(b),c=c||A;continue e}}if(l=!1,d){v>d?r.push(ed(d)+"-"+ed(v)):v===d&&r.push(ed(v)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(ed(v+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=v,s+=2;continue}r.push(ed(v)),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 v=r[0].length===2?r[0].slice(-1):r[0];return[QQ(v),!1,f-t,!1]}let h="["+(u?"^":"")+sF(r)+"]",p="["+(u?"":"^")+sF(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var Wi=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Fn,YQ=new Set(["!","?","+","*","@"]),oE=o(n=>YQ.has(n),"isExtglobType"),oF=o(n=>oE(n.type),"isExtglobAST"),KQ=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),XQ=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),JQ=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),cF=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),ZQ="(?!(?:^|/)\\.\\.?(?:$|/))",Ng="(?!\\.)",eY=new Set(["[","."]),tY=new Set(["..","."]),rY=new Set("().*{}+?[]^$\\!"),nY=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),cE="[^/]",lF=cE+"*?",uF=cE+"+?",rc=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 Fn&&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 Fn&&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 Fn(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 v=r,E="";for(;v<e.length;){let b=e.charAt(v++);if(c||b==="\\"){c=!c,E+=b;continue}if(l){v===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(v===u+2&&f)&&(l=!1),E+=b;continue}else if(b==="["){l=!0,u=v,f=!1,E+=b;continue}if(!i.noext&&oE(b)&&e.charAt(v)==="("&&s<=a){t.push(E),E="";let I=new Fn(b,t);v=Fn.#g(e,I,v,i,s+1),t.push(I);continue}E+=b}return t.push(E),v}let d=r+1,h=new Fn(null,t),p=[],y="";for(;d<e.length;){let v=e.charAt(d++);if(c||v==="\\"){c=!c,y+=v;continue}if(l){d===u+1?(v==="^"||v==="!")&&(f=!0):v==="]"&&!(d===u+2&&f)&&(l=!1),y+=v;continue}else if(v==="["){l=!0,u=d,f=!1,y+=v;continue}if(oE(v)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(v))){let b=t&&t.#y(v)?0:1;h.push(y),y="";let A=new Fn(v,h);h.push(A),d=Fn.#g(e,A,d,i,s+b);continue}if(v==="|"){h.push(y),y="",p.push(h),h=new Fn(null,t);continue}if(v===")")return y===""&&t.#t.length===0&&(t.#a=!0),h.push(y),y="",t.push(...p,h),d;y+=v}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,XQ)}#m(e,t=KQ){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=JQ){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Fn(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!!cF.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=cF.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}#v(){if(oF(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.#v(),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.#v();this.#l=void 0}static fromGlob(e,t={}){let r=new Fn(null,void 0,t);return Fn.#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.#v(),this.#p()),!oF(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,v,E,b]=typeof p=="string"?Fn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||E,this.#r=this.#r||b,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&tY.has(this.#t[0]))){let y=eY,v=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),E=!t&&!e&&y.has(u.charAt(0));f=v?ZQ:E?Ng:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,Wi(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#b(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,Wi(this.toString()),!1,!1]}let a=!r||e||t||!Ng?"":this.#b(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?Ng:"")+uF;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Ng:"")+lF+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,Wi(s),this.#n=!!this.#n,this.#r]}#b(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+=(rY.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=aF(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)?uF:lF,t=!0;continue}else c=!1;if(u==="?"){s+=cE,t=!0;continue}s+=nY(u)}return[s,Wi(e),!!t,a]}};Fn=rc;var Yl=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Vr=o((n,e,t={})=>(Zf(e),!t.nocomment&&e.charAt(0)==="#"?!1:new qn(e,t).match(n)),"minimatch"),iY=/^\*+([^+@!?\*\[\(]*)$/,sY=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),aY=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),oY=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),cY=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),lY=/^\*+\.\*+$/,uY=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),fY=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),dY=/^\.\*+$/,hY=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),pY=/^\*+$/,mY=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),gY=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),yY=/^\?+([^+@!?\*\[\(]*)?$/,_Y=o(([n,e=""])=>{let t=pF([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),SY=o(([n,e=""])=>{let t=mF([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),vY=o(([n,e=""])=>{let t=mF([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),bY=o(([n,e=""])=>{let t=pF([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),pF=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),mF=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),gF=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",fF={win32:{sep:"\\"},posix:{sep:"/"}},wY=gF==="win32"?fF.win32.sep:fF.posix.sep;Vr.sep=wY;var Kt=Symbol("globstar **");Vr.GLOBSTAR=Kt;var EY="[^/]",TY=EY+"*?",AY="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",xY="(?:(?!(?:\\/|^)\\.).)*?",CY=o((n,e={})=>t=>Vr(t,n,e),"filter");Vr.filter=CY;var oi=o((n,e={})=>Object.assign({},n,e),"ext"),IY=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Vr;let e=Vr;return Object.assign(o((r,i,s={})=>e(r,i,oi(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,oi(n,s))}static defaults(i){return e.defaults(oi(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,oi(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,oi(n,s))}},unescape:o((r,i={})=>e.unescape(r,oi(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,oi(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,oi(n,i)),"filter"),defaults:o(r=>e.defaults(oi(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,oi(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,oi(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,oi(n,s)),"match"),sep:e.sep,GLOBSTAR:Kt})},"defaults");Vr.defaults=IY;var yF=o((n,e={})=>(Zf(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,hF.default)(n)),"braceExpand");Vr.braceExpand=yF;var RY=o((n,e={})=>new qn(n,e).makeRe(),"makeRe");Vr.makeRe=RY;var PY=o((n,e,t={})=>{let r=new qn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Vr.match=PY;var dF=/[?*]|[+@!]\(.*?\)|\[|\]/,OY=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),qn=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={}){Zf(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||gF,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]==="?"||!dF.test(s[2]))&&!dF.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let a=i;for(;r[a+1]==="**";)a++;a>i&&r.splice(i+1,a-i);let c=r[i+1],l=r[i+2],u=r[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let c=r[a];a===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let a=r[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let i=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(i){e[t]=[],e[r]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let i=0,s=0,a=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])a.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])a.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])a.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",a.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",a.push(t[s]),i++,s++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),d=l?3:c?0:void 0,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,y]=[e[d],t[h]];p.toLowerCase()===y.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Kt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Kt,s),c=t.lastIndexOf(Kt),[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 I=i;I<e.length-d;I++){let j=String(e[I]);if(A=!0,j==="."||j===".."||!this.options.dot&&j.startsWith("."))return!1}return r||A}let h=[[[],0]],p=h[0],y=0,v=[0];for(let A of u)A===Kt?(v.push(y),p=[[],0],h.push(p)):(p[0].push(A),y++);let E=h.length-1,b=e.length-d;for(let A of h)A[1]=b-(v[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===Kt)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 yF(this.pattern,this.options)}parse(e){Zf(e);let t=this.options;if(e==="**")return Kt;if(e==="")return"";let r,i=null;(r=e.match(pY))?i=t.dot?gY:mY:(r=e.match(iY))?i=(t.nocase?t.dot?cY:oY:t.dot?aY:sY)(r[1]):(r=e.match(yY))?i=(t.nocase?t.dot?SY:_Y:t.dot?vY:bY)(r):(r=e.match(lY))?i=t.dot?fY:uY:(r=e.match(dY))&&(i=hY);let s=rc.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?TY:t.dot?AY:xY,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"?OY(f):f===Kt?Kt:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==Kt||p===Kt||(p===void 0?h!==void 0&&h!==Kt?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==Kt&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=Kt))}),u.filter(f=>f!==Kt).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 Vr.defaults(e).Minimatch}};Vr.AST=rc;Vr.Minimatch=qn;Vr.escape=Yl;Vr.unescape=Wi;var BF=require("node:url");var Kl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,SF=new Set,lE=typeof process=="object"&&process?process:{},vF=o((n,e,t,r)=>{typeof lE.emitWarning=="function"?lE.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Lg=globalThis.AbortController,_F=globalThis.AbortSignal;if(typeof Lg>"u"){_F=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Lg=class{static{o(this,"AbortController")}constructor(){e()}signal=new _F;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=lE.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,vF("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 FY=o(n=>!SF.has(n),"shouldWarn");var Ja=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),bF=o(n=>Ja(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Xl:null:null,"getUintArray"),Xl=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},uE=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=bF(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]}},td=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;#v;#b;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.#V(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:y=0,sizeCalculation:v,fetchMethod:E,memoMethod:b,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:B,ignoreFetchAbort:te}=e;if(t!==0&&!Ja(t))throw new TypeError("max option must be a nonnegative integer");let z=t?bF(t):Array;if(!z)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=v,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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#_=b,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=E,this.#v=!!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=uE.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.#b=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!B,this.ignoreFetchAbort=!!te,this.maxEntrySize!==0){if(this.#n!==0&&!Ja(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ja(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#P()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Ja(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ja(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";FY(G)&&(SF.add(G),vF("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 Xl(this.#e),t=new Xl(this.#e);this.#S=e,this.#T=t,this.#F=(s,a,c=Kl.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#O(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#C=s=>{t[s]=e[s]!==0?Kl.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=Kl.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");#P(){let e=new Xl(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(!Ja(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Ja(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.#O(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-(Kl.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=Kl.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=Kl.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.#O(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.#V(d);let h=this.#a[d];if(t!==h){if(this.#v&&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.#b&&this.#f?.push([p,e,"set"]))}else a||(this.#w&&this.#r?.(h,e,"set"),this.#b&&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.#b&&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.#b&&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.#v&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#w||this.#b)&&(this.#w&&this.#r?.(i,r,"evict"),this.#b&&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 Lg,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((v,E=!1)=>{let{aborted:b}=a.signal,A=r.ignoreFetchAbort&&v!==void 0;if(r.status&&(b&&!E?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,A&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),b&&!A&&!E)return d(a.signal.reason);let I=p;return this.#a[t]===p&&(v===void 0?I.__staleWhileFetching?this.#a[t]=I.__staleWhileFetching:this.#O(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,v,l.options))),v},"cb"),f=o(v=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=v),d(v)),"eb"),d=o(v=>{let{aborted:E}=a.signal,b=E&&r.allowStaleOnFetchAbort,A=b||r.allowStaleOnFetchRejection,I=A||r.noDeleteOnFetchRejection,j=p;if(this.#a[t]===p&&(!I||j.__staleWhileFetching===void 0?this.#O(e,"fetch"):b||(this.#a[t]=j.__staleWhileFetching)),A)return r.status&&j.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),j.__staleWhileFetching;if(j.__returned===j)throw v},"fetchFail"),h=o((v,E)=>{let b=this.#c?.(e,s,l);b&&b instanceof Promise&&b.then(A=>v(A===void 0?void 0:A),E),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(v(void 0),r.allowStaleOnFetchAbort&&(v=o(A=>u(A,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),y=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,y,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=y,y}#h(e){if(!this.#v)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Lg}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:v,forceRefresh:E=!1,status:b,signal:A}=t;if(!this.#v)return b&&(b.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:b});let I={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:b,signal:A},j=this.#s.get(e);if(j===void 0){b&&(b.fetch="miss");let B=this.#j(e,j,I,v);return B.__returned=B}else{let B=this.#a[j];if(this.#h(B)){let $=r&&B.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",$&&(b.returnedStale=!0)),$?B.__staleWhileFetching:B.__returned=B}let te=this.#A(j);if(!E&&!te)return b&&(b.fetch="hit"),this.#V(j),i&&this.#C(j),b&&this.#o(b,j),B;let z=this.#j(e,j,I,v),F=z.__staleWhileFetching!==void 0&&r;return b&&(b.fetch=te?"stale":"refresh",F&&te&&(b.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.#O(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#C(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#V(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#O(e,"delete")}#O(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#B(t);else{this.#D(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#b)&&(this.#w&&this.#r?.(s,e,t),this.#b&&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.#b&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#R({allowStale:!0})){let r=this.#a[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#w&&this.#r?.(r,i,e),this.#b&&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.#b&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var eu=require("node:path"),OF=require("node:url"),Is=require("fs"),UY=Y(require("node:fs"),1),to=require("node:fs/promises");var Ug=require("node:events"),yE=Y(require("node:stream"),1),xF=require("node:string_decoder");var wF=typeof process=="object"&&process?process:{stdout:null,stderr:null},DY=o(n=>!!n&&typeof n=="object"&&(n instanceof eo||n instanceof yE.default||NY(n)||LY(n)),"isStream"),NY=o(n=>!!n&&typeof n=="object"&&n instanceof Ug.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==yE.default.Writable.prototype.pipe,"isReadable"),LY=o(n=>!!n&&typeof n=="object"&&n instanceof Ug.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),da=Symbol("EOF"),ha=Symbol("maybeEmitEnd"),Za=Symbol("emittedEnd"),kg=Symbol("emittingEnd"),rd=Symbol("emittedError"),Mg=Symbol("closed"),EF=Symbol("read"),jg=Symbol("flush"),TF=Symbol("flushChunk"),Gi=Symbol("encoding"),Jl=Symbol("decoder"),Ar=Symbol("flowing"),nd=Symbol("paused"),Zl=Symbol("resume"),xr=Symbol("buffer"),Sn=Symbol("pipes"),Cr=Symbol("bufferLength"),fE=Symbol("bufferPush"),$g=Symbol("bufferShift"),en=Symbol("objectMode"),Xt=Symbol("destroyed"),dE=Symbol("error"),hE=Symbol("emitData"),AF=Symbol("emitEnd"),pE=Symbol("emitEnd2"),xs=Symbol("async"),mE=Symbol("abort"),Vg=Symbol("aborted"),id=Symbol("signal"),nc=Symbol("dataListeners"),Wn=Symbol("discarded"),sd=o(n=>Promise.resolve().then(n),"defer"),kY=o(n=>n(),"nodefer"),MY=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),jY=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),$Y=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Bg=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[Zl](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},gE=class extends Bg{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)}},VY=o(n=>!!n.objectMode,"isObjectModeOptions"),BY=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),eo=class extends Ug.EventEmitter{static{o(this,"Minipass")}[Ar]=!1;[nd]=!1;[Sn]=[];[xr]=[];[en];[Gi];[xs];[Jl];[da]=!1;[Za]=!1;[kg]=!1;[Mg]=!1;[rd]=null;[Cr]=0;[Xt]=!1;[id];[Vg]=!1;[nc]=0;[Wn]=!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");VY(t)?(this[en]=!0,this[Gi]=null):BY(t)?(this[Gi]=t.encoding,this[en]=!1):(this[en]=!1,this[Gi]=null),this[xs]=!!t.async,this[Jl]=this[Gi]?new xF.StringDecoder(this[Gi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[xr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[Sn],"get")});let{signal:r}=t;r&&(this[id]=r,r.aborted?this[mE]():r.addEventListener("abort",()=>this[mE]()))}get bufferLength(){return this[Cr]}get encoding(){return this[Gi]}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[en]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[xs]}set async(e){this[xs]=this[xs]||!!e}[mE](){this[Vg]=!0,this.emit("abort",this[id]?.reason),this.destroy(this[id]?.reason)}get aborted(){return this[Vg]}set aborted(e){}write(e,t,r){if(this[Vg])return!1;if(this[da])throw new Error("write after end");if(this[Xt])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[xs]?sd:kY;if(!this[en]&&!Buffer.isBuffer(e)){if($Y(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(jY(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[en]?(this[Ar]&&this[Cr]!==0&&this[jg](!0),this[Ar]?this.emit("data",e):this[fE](e),this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Ar]):e.length?(typeof e=="string"&&!(t===this[Gi]&&!this[Jl]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Gi]&&(e=this[Jl].write(e)),this[Ar]&&this[Cr]!==0&&this[jg](!0),this[Ar]?this.emit("data",e):this[fE](e),this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Ar]):(this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Ar])}read(e){if(this[Xt])return null;if(this[Wn]=!1,this[Cr]===0||e===0||e&&e>this[Cr])return this[ha](),null;this[en]&&(e=null),this[xr].length>1&&!this[en]&&(this[xr]=[this[Gi]?this[xr].join(""):Buffer.concat(this[xr],this[Cr])]);let t=this[EF](e||null,this[xr][0]);return this[ha](),t}[EF](e,t){if(this[en])this[$g]();else{let r=t;e===r.length||e===null?this[$g]():typeof r=="string"?(this[xr][0]=r.slice(e),t=r.slice(0,e),this[Cr]-=e):(this[xr][0]=r.subarray(e),t=r.subarray(0,e),this[Cr]-=e)}return this.emit("data",t),!this[xr].length&&!this[da]&&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[da]=!0,this.writable=!1,(this[Ar]||!this[nd])&&this[ha](),this}[Zl](){this[Xt]||(!this[nc]&&!this[Sn].length&&(this[Wn]=!0),this[nd]=!1,this[Ar]=!0,this.emit("resume"),this[xr].length?this[jg]():this[da]?this[ha]():this.emit("drain"))}resume(){return this[Zl]()}pause(){this[Ar]=!1,this[nd]=!0,this[Wn]=!1}get destroyed(){return this[Xt]}get flowing(){return this[Ar]}get paused(){return this[nd]}[fE](e){this[en]?this[Cr]+=1:this[Cr]+=e.length,this[xr].push(e)}[$g](){return this[en]?this[Cr]-=1:this[Cr]-=this[xr][0].length,this[xr].shift()}[jg](e=!1){do;while(this[TF](this[$g]())&&this[xr].length);!e&&!this[xr].length&&!this[da]&&this.emit("drain")}[TF](e){return this.emit("data",e),this[Ar]}pipe(e,t){if(this[Xt])return e;this[Wn]=!1;let r=this[Za];return t=t||{},e===wF.stdout||e===wF.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[Sn].push(t.proxyErrors?new gE(this,e,t):new Bg(this,e,t)),this[xs]?sd(()=>this[Zl]()):this[Zl]()),e}unpipe(e){let t=this[Sn].find(r=>r.dest===e);t&&(this[Sn].length===1?(this[Ar]&&this[nc]===0&&(this[Ar]=!1),this[Sn]=[]):this[Sn].splice(this[Sn].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[Wn]=!1,this[nc]++,!this[Sn].length&&!this[Ar]&&this[Zl]();else if(e==="readable"&&this[Cr]!==0)super.emit("readable");else if(MY(e)&&this[Za])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[rd]){let i=t;this[xs]?sd(()=>i.call(this,this[rd])):i.call(this,this[rd])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[nc]=this.listeners("data").length,this[nc]===0&&!this[Wn]&&!this[Sn].length&&(this[Ar]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[nc]=0,!this[Wn]&&!this[Sn].length&&(this[Ar]=!1)),t}get emittedEnd(){return this[Za]}[ha](){!this[kg]&&!this[Za]&&!this[Xt]&&this[xr].length===0&&this[da]&&(this[kg]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Mg]&&this.emit("close"),this[kg]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Xt&&this[Xt])return!1;if(e==="data")return!this[en]&&!r?!1:this[xs]?(sd(()=>this[hE](r)),!0):this[hE](r);if(e==="end")return this[AF]();if(e==="close"){if(this[Mg]=!0,!this[Za]&&!this[Xt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[rd]=r,super.emit(dE,r);let s=!this[id]||this.listeners("error").length?super.emit("error",r):!1;return this[ha](),s}else if(e==="resume"){let s=super.emit("resume");return this[ha](),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[ha](),i}[hE](e){for(let r of this[Sn])r.dest.write(e)===!1&&this.pause();let t=this[Wn]?!1:super.emit("data",e);return this[ha](),t}[AF](){return this[Za]?!1:(this[Za]=!0,this.readable=!1,this[xs]?(sd(()=>this[pE]()),!0):this[pE]())}[pE](){if(this[Jl]){let t=this[Jl].end();if(t){for(let r of this[Sn])r.dest.write(t);this[Wn]||super.emit("data",t)}}for(let t of this[Sn])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[en]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[en]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[en])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Gi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Xt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Wn]=!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[da])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(Xt,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(Xt,f),this.pause(),s({value:d,done:!!this[da]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Xt,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(Xt,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[Wn]=!1;let e=!1,t=o(()=>(this.pause(),this.off(dE,t),this.off(Xt,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(dE,t),this.once(Xt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Xt])return e?this.emit("error",e):this.emit(Xt),this;this[Xt]=!0,this[Wn]=!0,this[xr].length=0,this[Cr]=0;let t=this;return typeof t.close=="function"&&!this[Mg]&&t.close(),e?this.emit("error",e):this.emit(Xt),this}static get isStream(){return DY}};var qY=Is.realpathSync.native,od={lstatSync:Is.lstatSync,readdir:Is.readdir,readdirSync:Is.readdirSync,readlinkSync:Is.readlinkSync,realpathSync:qY,promises:{lstat:to.lstat,readdir:to.readdir,readlink:to.readlink,realpath:to.realpath}},FF=o(n=>!n||n===od||n===UY?od:{...od,...n,promises:{...od.promises,...n.promises||{}}},"fsFromOption"),DF=/^\\\\\?\\([a-z]:)\\?$/i,WY=o(n=>n.replace(/\//g,"\\").replace(DF,"$1\\"),"uncToDrive"),GY=/[\\\/]/,li=0,NF=1,LF=2,Cs=4,kF=6,MF=8,ic=10,jF=12,ci=15,ad=~ci,_E=16,CF=32,cd=64,zi=128,qg=256,Gg=512,IF=cd|zi|Gg,zY=1023,SE=o(n=>n.isFile()?MF:n.isDirectory()?Cs:n.isSymbolicLink()?ic:n.isCharacterDevice()?LF:n.isBlockDevice()?kF:n.isSocket()?jF:n.isFIFO()?NF:li,"entToType"),RF=new Map,ld=o(n=>{let e=RF.get(n);if(e)return e;let t=n.normalize("NFKD");return RF.set(n,t),t},"normalize"),PF=new Map,Wg=o(n=>{let e=PF.get(n);if(e)return e;let t=ld(n.toLowerCase());return PF.set(n,t),t},"normalizeNocase"),zg=class extends td{static{o(this,"ResolveCache")}constructor(){super({max:256})}},vE=class extends td{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},$F=Symbol("PathScurry setAsCwd"),tn=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;#v;#b;#x;#C;#o;#F;#A;#P;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=li,r,i,s,a,c){this.name=e,this.#S=s?Wg(e):ld(e),this.#o=t&zY,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#v=c.fullpath,this.#x=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=FF(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&=~_E,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Wg(e):ld(e);for(let l of r)if(l.#S===i)return l;let s=this.parent?this.sep:"",a=this.#v?this.#v+s+e:void 0,c=this.newChild(e,li,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=zi),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.#v!==void 0)return this.#v;let e=this.name,t=this.parent;if(!t)return this.#v=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#v=i}fullpathPosix(){if(this.#b!==void 0)return this.#b;if(this.sep==="/")return this.#b=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#b=`//?/${i}`:this.#b=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#b=r}isUnknown(){return(this.#o&ci)===li}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&ci)===MF}isDirectory(){return(this.#o&ci)===Cs}isCharacterDevice(){return(this.#o&ci)===LF}isBlockDevice(){return(this.#o&ci)===kF}isFIFO(){return(this.#o&ci)===NF}isSocket(){return(this.#o&ci)===jF}isSymbolicLink(){return(this.#o&ic)===ic}lstatCached(){return this.#o&CF?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#P}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&ci;return!(e!==li&&e!==ic||this.#o&qg||this.#o&zi)}calledReaddir(){return!!(this.#o&_E)}isENOENT(){return!!(this.#o&zi)}isNamed(e){return this.nocase?this.#S===Wg(e):this.#S===ld(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|=_E;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&zi||(this.#o=(this.#o|zi)&ad,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#R(){this.#o|=Gg,this.#k()}#k(){if(this.#o&cd)return;let e=this.#o;(e&ci)===Cs&&(e&=ad),this.#o=e|cd,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|=qg,e==="ENOENT"&&(t|=zi),(e==="EINVAL"||e==="UNKNOWN")&&(t&=ad),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#O(e,t)||this.#V(e,t)}#V(e,t){let r=SE(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&ci;return s!==Cs&&s!==ic&&s!==li&&(i.#o|=cd),t.unshift(i),t.provisional++,i}#O(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Wg(e.name):ld(e.name))===i.#S)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#o=t.#o&ad|SE(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&zi)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&zi)===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:y,mtimeMs:v,nlink:E,rdev:b,size:A,uid:I}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#d=u,this.#n=f,this.#_=d,this.#s=h,this.#r=p,this.#f=y,this.#g=v,this.#t=E,this.#i=b,this.#l=A,this.#c=I;let j=SE(e);this.#o=this.#o&ad|j|CF,j!==li&&j!==Cs&&j!==ic&&(this.#o|=cd)}#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&IF)return!1;let e=ci&this.#o;return e===li||e===Cs||e===ic}shouldWalk(e,t){return(this.#o&Cs)===Cs&&!(this.#o&IF)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#P)return this.#P;if(!((Gg|qg|zi)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#P=this.resolve(e)}catch{this.#R()}}realpathSync(){if(this.#P)return this.#P;if(!((Gg|qg|zi)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#P=this.resolve(e)}catch{this.#R()}}[$F](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}},Hg=class n extends tn{static{o(this,"PathWin32")}sep="\\";splitSep=GY;constructor(e,t=li,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=li,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return eu.win32.parse(e).root}getRoot(e){if(e=WY(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 tu(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(DF,"$1\\"),e===t}},Qg=class n extends tn{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=li,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=li,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Yg=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=od}={}){this.#t=FF(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,OF.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new zg,this.#n=new zg,this.#r=new vE(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,h=this.rootPath,p=!1;for(let y of l){let v=f--;u=u.child(y,{relative:new Array(v).fill("..").join(d),relativePosix:new Array(v).fill("..").join("/"),fullpath:h+=(p?"":d)+y}),p=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#e.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#n.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof tn||(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 tn||(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 tn||(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 tn||(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 tn||(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 tn||(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 tn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=o((d,h)=>{l.add(d),d.readdirCB((p,y)=>{if(p)return h(p);let v=y.length;if(!v)return h();let E=o(()=>{--v===0&&h()},"next");for(let b of y)(!s||s(b))&&c.push(r?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(A=>A?.isUnknown()?A.lstat():A).then(A=>A?.shouldWalk(l,a)?u(A,E):E()):b.shouldWalk(l,a)?u(b,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 tn||(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 tn||(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 tn||(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 tn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new eo({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=o((E,b,A=!1)=>{if(E)return c.emit("error",E);if(i&&!A){let I=[];for(let j of b)j.isSymbolicLink()&&I.push(j.realpath().then(B=>B?.isUnknown()?B.lstat():B));if(I.length){Promise.all(I).then(()=>y(null,b,!0));return}}for(let I of b)I&&(!s||s(I))&&(c.write(r?I:I.fullpath())||(h=!0));f--;for(let I of b){let j=I.realpathCached()||I;j.shouldWalk(l,a)&&u.push(j)}h&&!c.flowing?c.once("drain",d):v||d()},"onReaddir"),v=!0;p.readdirCB(y,!0),v=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof tn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new eo({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let v of y)(!s||s(v))&&(c.write(r?v:v.fullpath())||(h=!0));f--;for(let v of y){let E=v;if(v.isSymbolicLink()){if(!(i&&(E=v.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[$F](t)}},tu=class extends Yg{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,eu.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return eu.win32.parse(e).root.toUpperCase()}newRoot(e){return new Hg(this.rootPath,Cs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},ru=class extends Yg{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,eu.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new Qg(this.rootPath,Cs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},ud=class extends ru{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},qpe=process.platform==="win32"?Hg:Qg,VF=process.platform==="win32"?tu:process.platform==="darwin"?ud:ru;var HY=o(n=>n.length>=1,"isPatternList"),QY=o(n=>n.length>=1,"isGlobList"),nu=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!HY(e))throw new TypeError("empty pattern list");if(!QY(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,a,c,l,...u]=this.#e,[f,d,h,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let v=[s,a,c,l,""].join("/"),E=[f,d,h,p,""].join("/");this.#e=[v,...u],this.#n=[E,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[c,...l]=this.#n;a[0]===""&&(a.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...a],this.#n=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===Kt}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 YY=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",iu=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=YY}){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 qn(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 nu(i,s,0,this.platform),c=new qn(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 bE=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()]))}},wE=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)])}},EE=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())}},fd=class n{static{o(this,"Processor")}hasWalkedCache;matches=new wE;subwalks=new EE;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new bE}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===Kt){(!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===Kt?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 KY=o((n,e)=>typeof n=="string"?new iu([n],e):Array.isArray(n)?new iu(n,e):n,"makeIgnore"),Kg=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=KY(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 fd(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 fd(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()}},dd=class extends Kg{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}},hd=class extends Kg{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new eo({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 XY=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Hi=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,BF.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||XY,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"?tu:t.platform==="darwin"?ud:t.platform?ru:VF;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 qn(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 nu(l,f,0,this.platform)})}async walk(){return[...await new dd(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 dd(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 hd(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 hd(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 TE=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new qn(t,e).hasMagic())return!0;return!1},"hasMagic");function Jg(n,e={}){return new Hi(n,e).streamSync()}o(Jg,"globStreamSync");function qF(n,e={}){return new Hi(n,e).stream()}o(qF,"globStream");function WF(n,e={}){return new Hi(n,e).walkSync()}o(WF,"globSync");async function UF(n,e={}){return new Hi(n,e).walk()}o(UF,"glob_");function Zg(n,e={}){return new Hi(n,e).iterateSync()}o(Zg,"globIterateSync");function GF(n,e={}){return new Hi(n,e).iterate()}o(GF,"globIterate");var JY=Jg,ZY=Object.assign(qF,{sync:Jg}),eK=Zg,tK=Object.assign(GF,{sync:Zg}),rK=Object.assign(WF,{stream:Jg,iterate:Zg}),Xg=Object.assign(UF,{glob:UF,globSync:WF,sync:rK,globStream:qF,stream:ZY,globStreamSync:Jg,streamSync:JY,globIterate:GF,iterate:tK,globIterateSync:Zg,iterateSync:eK,Glob:Hi,hasMagic:TE,escape:Yl,unescape:Wi});Xg.glob=Xg;var sc=Y(Dt());var Pt=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await mr.default.pathExists(t))throw new sc.FileNotFoundError(e);return mr.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return mr.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 mr.default.pathExists(r))throw new sc.FileAlreadyExistsError(e);return await mr.default.ensureDir(ro.default.dirname(r)),await mr.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await mr.default.pathExists(r))throw new sc.FileNotFoundError(e);await mr.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await mr.default.ensureDir(ro.default.dirname(r)),await mr.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await mr.default.pathExists(t))throw new sc.FileNotFoundError(e);await mr.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await mr.default.pathExists(r))throw new sc.FileNotFoundError(e);await mr.default.ensureDir(ro.default.dirname(i)),await mr.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await mr.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await mr.default.pathExists(t)?(await mr.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=ro.default.join(t,"**/*.md");return(await Xg(r,{nodir:!0})).map(a=>ro.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 ro.default.isAbsolute(e)?e:ro.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=$r.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 pd=Y(require("path")),AE=Y(Ya());var su=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!pd.default.isAbsolute(e))return pd.default.resolve(this.vaultRoot,e);let t=pd.default.resolve(e),r=pd.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(!AE.default.existsSync(e))throw new Mf(e);if(!AE.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 XF=Y(Dt());var zF=Y(Dt());var Qi=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 zF.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(`
617
+ \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: ${$Q(u.sizeBytes)}`))}}}catch(t){D.handle(t)}})}o(WO,"sparqlIndexCommand");function $Q(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o($Q,"formatBytes");function GO(){return new Te("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 zl,r=t.listTemplates();if(e==="json"){let i=X.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(GO,"sparqlTemplatesCommand");var JF=require("path");var mr=Y(Ka()),no=Y(require("path"));var hF=Y(iF(),1);var Zf=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var HQ={"[: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]},ed=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),QQ=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),sF=o(n=>n.join(""),"rangesToString"),aF=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 v=n.charAt(s);if((v==="!"||v==="^")&&s===t+1){u=!0,s++;continue}if(v==="]"&&a&&!l){f=s+1;break}if(a=!0,v==="\\"&&!l){l=!0,s++;continue}if(v==="["&&!l){for(let[E,[b,A,I]]of Object.entries(HQ))if(n.startsWith(E,s)){if(d)return["$.",!1,n.length-t,!0];s+=E.length,I?i.push(b):r.push(b),c=c||A;continue e}}if(l=!1,d){v>d?r.push(ed(d)+"-"+ed(v)):v===d&&r.push(ed(v)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(ed(v+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=v,s+=2;continue}r.push(ed(v)),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 v=r[0].length===2?r[0].slice(-1):r[0];return[QQ(v),!1,f-t,!1]}let h="["+(u?"^":"")+sF(r)+"]",p="["+(u?"":"^")+sF(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var Wi=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Fn,YQ=new Set(["!","?","+","*","@"]),oE=o(n=>YQ.has(n),"isExtglobType"),oF=o(n=>oE(n.type),"isExtglobAST"),KQ=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),XQ=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),JQ=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),cF=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),ZQ="(?!(?:^|/)\\.\\.?(?:$|/))",Ng="(?!\\.)",eY=new Set(["[","."]),tY=new Set(["..","."]),rY=new Set("().*{}+?[]^$\\!"),nY=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),cE="[^/]",lF=cE+"*?",uF=cE+"+?",rc=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 Fn&&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 Fn&&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 Fn(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 v=r,E="";for(;v<e.length;){let b=e.charAt(v++);if(c||b==="\\"){c=!c,E+=b;continue}if(l){v===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(v===u+2&&f)&&(l=!1),E+=b;continue}else if(b==="["){l=!0,u=v,f=!1,E+=b;continue}if(!i.noext&&oE(b)&&e.charAt(v)==="("&&s<=a){t.push(E),E="";let I=new Fn(b,t);v=Fn.#g(e,I,v,i,s+1),t.push(I);continue}E+=b}return t.push(E),v}let d=r+1,h=new Fn(null,t),p=[],y="";for(;d<e.length;){let v=e.charAt(d++);if(c||v==="\\"){c=!c,y+=v;continue}if(l){d===u+1?(v==="^"||v==="!")&&(f=!0):v==="]"&&!(d===u+2&&f)&&(l=!1),y+=v;continue}else if(v==="["){l=!0,u=d,f=!1,y+=v;continue}if(oE(v)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(v))){let b=t&&t.#y(v)?0:1;h.push(y),y="";let A=new Fn(v,h);h.push(A),d=Fn.#g(e,A,d,i,s+b);continue}if(v==="|"){h.push(y),y="",p.push(h),h=new Fn(null,t);continue}if(v===")")return y===""&&t.#t.length===0&&(t.#a=!0),h.push(y),y="",t.push(...p,h),d;y+=v}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,XQ)}#m(e,t=KQ){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=JQ){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Fn(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!!cF.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=cF.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}#v(){if(oF(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.#v(),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.#v();this.#l=void 0}static fromGlob(e,t={}){let r=new Fn(null,void 0,t);return Fn.#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.#v(),this.#p()),!oF(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,v,E,b]=typeof p=="string"?Fn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||E,this.#r=this.#r||b,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&tY.has(this.#t[0]))){let y=eY,v=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),E=!t&&!e&&y.has(u.charAt(0));f=v?ZQ:E?Ng:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,Wi(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#b(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,Wi(this.toString()),!1,!1]}let a=!r||e||t||!Ng?"":this.#b(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?Ng:"")+uF;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Ng:"")+lF+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,Wi(s),this.#n=!!this.#n,this.#r]}#b(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+=(rY.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=aF(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)?uF:lF,t=!0;continue}else c=!1;if(u==="?"){s+=cE,t=!0;continue}s+=nY(u)}return[s,Wi(e),!!t,a]}};Fn=rc;var Yl=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Vr=o((n,e,t={})=>(Zf(e),!t.nocomment&&e.charAt(0)==="#"?!1:new qn(e,t).match(n)),"minimatch"),iY=/^\*+([^+@!?\*\[\(]*)$/,sY=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),aY=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),oY=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),cY=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),lY=/^\*+\.\*+$/,uY=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),fY=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),dY=/^\.\*+$/,hY=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),pY=/^\*+$/,mY=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),gY=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),yY=/^\?+([^+@!?\*\[\(]*)?$/,_Y=o(([n,e=""])=>{let t=pF([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),SY=o(([n,e=""])=>{let t=mF([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),vY=o(([n,e=""])=>{let t=mF([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),bY=o(([n,e=""])=>{let t=pF([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),pF=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),mF=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),gF=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",fF={win32:{sep:"\\"},posix:{sep:"/"}},wY=gF==="win32"?fF.win32.sep:fF.posix.sep;Vr.sep=wY;var Kt=Symbol("globstar **");Vr.GLOBSTAR=Kt;var EY="[^/]",TY=EY+"*?",AY="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",xY="(?:(?!(?:\\/|^)\\.).)*?",CY=o((n,e={})=>t=>Vr(t,n,e),"filter");Vr.filter=CY;var oi=o((n,e={})=>Object.assign({},n,e),"ext"),IY=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Vr;let e=Vr;return Object.assign(o((r,i,s={})=>e(r,i,oi(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,oi(n,s))}static defaults(i){return e.defaults(oi(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,oi(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,oi(n,s))}},unescape:o((r,i={})=>e.unescape(r,oi(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,oi(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,oi(n,i)),"filter"),defaults:o(r=>e.defaults(oi(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,oi(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,oi(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,oi(n,s)),"match"),sep:e.sep,GLOBSTAR:Kt})},"defaults");Vr.defaults=IY;var yF=o((n,e={})=>(Zf(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,hF.default)(n)),"braceExpand");Vr.braceExpand=yF;var RY=o((n,e={})=>new qn(n,e).makeRe(),"makeRe");Vr.makeRe=RY;var PY=o((n,e,t={})=>{let r=new qn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Vr.match=PY;var dF=/[?*]|[+@!]\(.*?\)|\[|\]/,OY=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),qn=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={}){Zf(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||gF,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]==="?"||!dF.test(s[2]))&&!dF.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let a=i;for(;r[a+1]==="**";)a++;a>i&&r.splice(i+1,a-i);let c=r[i+1],l=r[i+2],u=r[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let c=r[a];a===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let a=r[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let i=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(i){e[t]=[],e[r]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let i=0,s=0,a=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])a.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])a.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])a.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",a.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",a.push(t[s]),i++,s++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),d=l?3:c?0:void 0,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,y]=[e[d],t[h]];p.toLowerCase()===y.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Kt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Kt,s),c=t.lastIndexOf(Kt),[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 I=i;I<e.length-d;I++){let j=String(e[I]);if(A=!0,j==="."||j===".."||!this.options.dot&&j.startsWith("."))return!1}return r||A}let h=[[[],0]],p=h[0],y=0,v=[0];for(let A of u)A===Kt?(v.push(y),p=[[],0],h.push(p)):(p[0].push(A),y++);let E=h.length-1,b=e.length-d;for(let A of h)A[1]=b-(v[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===Kt)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 yF(this.pattern,this.options)}parse(e){Zf(e);let t=this.options;if(e==="**")return Kt;if(e==="")return"";let r,i=null;(r=e.match(pY))?i=t.dot?gY:mY:(r=e.match(iY))?i=(t.nocase?t.dot?cY:oY:t.dot?aY:sY)(r[1]):(r=e.match(yY))?i=(t.nocase?t.dot?SY:_Y:t.dot?vY:bY)(r):(r=e.match(lY))?i=t.dot?fY:uY:(r=e.match(dY))&&(i=hY);let s=rc.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?TY:t.dot?AY:xY,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"?OY(f):f===Kt?Kt:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==Kt||p===Kt||(p===void 0?h!==void 0&&h!==Kt?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==Kt&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=Kt))}),u.filter(f=>f!==Kt).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 Vr.defaults(e).Minimatch}};Vr.AST=rc;Vr.Minimatch=qn;Vr.escape=Yl;Vr.unescape=Wi;var BF=require("node:url");var Kl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,SF=new Set,lE=typeof process=="object"&&process?process:{},vF=o((n,e,t,r)=>{typeof lE.emitWarning=="function"?lE.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Lg=globalThis.AbortController,_F=globalThis.AbortSignal;if(typeof Lg>"u"){_F=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Lg=class{static{o(this,"AbortController")}constructor(){e()}signal=new _F;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=lE.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,vF("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 FY=o(n=>!SF.has(n),"shouldWarn");var Za=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),bF=o(n=>Za(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Xl:null:null,"getUintArray"),Xl=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},uE=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=bF(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]}},td=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;#v;#b;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.#V(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:y=0,sizeCalculation:v,fetchMethod:E,memoMethod:b,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:B,ignoreFetchAbort:te}=e;if(t!==0&&!Za(t))throw new TypeError("max option must be a nonnegative integer");let z=t?bF(t):Array;if(!z)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=v,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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#_=b,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=E,this.#v=!!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=uE.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.#b=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!B,this.ignoreFetchAbort=!!te,this.maxEntrySize!==0){if(this.#n!==0&&!Za(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Za(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#P()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Za(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Za(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let G="LRU_CACHE_UNBOUNDED";FY(G)&&(SF.add(G),vF("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 Xl(this.#e),t=new Xl(this.#e);this.#S=e,this.#T=t,this.#F=(s,a,c=Kl.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#O(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#C=s=>{t[s]=e[s]!==0?Kl.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=Kl.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");#P(){let e=new Xl(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#L=(t,r,i,s)=>{if(this.#h(r))return 0;if(!Za(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Za(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#N=(t,r,i)=>{if(e[t]=r,this.#n){let s=this.#n-e[t];for(;this.#u>s;)this.#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.#O(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-(Kl.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=Kl.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=Kl.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.#O(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.#V(d);let h=this.#a[d];if(t!==h){if(this.#v&&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.#b&&this.#f?.push([p,e,"set"]))}else a||(this.#w&&this.#r?.(h,e,"set"),this.#b&&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.#b&&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.#b&&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.#v&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#w||this.#b)&&(this.#w&&this.#r?.(i,r,"evict"),this.#b&&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 Lg,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((v,E=!1)=>{let{aborted:b}=a.signal,A=r.ignoreFetchAbort&&v!==void 0;if(r.status&&(b&&!E?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,A&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),b&&!A&&!E)return d(a.signal.reason);let I=p;return this.#a[t]===p&&(v===void 0?I.__staleWhileFetching?this.#a[t]=I.__staleWhileFetching:this.#O(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,v,l.options))),v},"cb"),f=o(v=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=v),d(v)),"eb"),d=o(v=>{let{aborted:E}=a.signal,b=E&&r.allowStaleOnFetchAbort,A=b||r.allowStaleOnFetchRejection,I=A||r.noDeleteOnFetchRejection,j=p;if(this.#a[t]===p&&(!I||j.__staleWhileFetching===void 0?this.#O(e,"fetch"):b||(this.#a[t]=j.__staleWhileFetching)),A)return r.status&&j.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),j.__staleWhileFetching;if(j.__returned===j)throw v},"fetchFail"),h=o((v,E)=>{let b=this.#c?.(e,s,l);b&&b instanceof Promise&&b.then(A=>v(A===void 0?void 0:A),E),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(v(void 0),r.allowStaleOnFetchAbort&&(v=o(A=>u(A,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),y=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,y,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=y,y}#h(e){if(!this.#v)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Lg}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:v,forceRefresh:E=!1,status:b,signal:A}=t;if(!this.#v)return b&&(b.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:b});let I={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:b,signal:A},j=this.#s.get(e);if(j===void 0){b&&(b.fetch="miss");let B=this.#j(e,j,I,v);return B.__returned=B}else{let B=this.#a[j];if(this.#h(B)){let $=r&&B.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",$&&(b.returnedStale=!0)),$?B.__staleWhileFetching:B.__returned=B}let te=this.#A(j);if(!E&&!te)return b&&(b.fetch="hit"),this.#V(j),i&&this.#C(j),b&&this.#o(b,j),B;let z=this.#j(e,j,I,v),F=z.__staleWhileFetching!==void 0&&r;return b&&(b.fetch=te?"stale":"refresh",F&&te&&(b.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.#O(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#C(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#V(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#O(e,"delete")}#O(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#B(t);else{this.#D(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#b)&&(this.#w&&this.#r?.(s,e,t),this.#b&&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.#b&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#R({allowStale:!0})){let r=this.#a[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#w&&this.#r?.(r,i,e),this.#b&&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.#b&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var eu=require("node:path"),OF=require("node:url"),Is=require("fs"),UY=Y(require("node:fs"),1),ro=require("node:fs/promises");var Ug=require("node:events"),yE=Y(require("node:stream"),1),xF=require("node:string_decoder");var wF=typeof process=="object"&&process?process:{stdout:null,stderr:null},DY=o(n=>!!n&&typeof n=="object"&&(n instanceof to||n instanceof yE.default||NY(n)||LY(n)),"isStream"),NY=o(n=>!!n&&typeof n=="object"&&n instanceof Ug.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==yE.default.Writable.prototype.pipe,"isReadable"),LY=o(n=>!!n&&typeof n=="object"&&n instanceof Ug.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),da=Symbol("EOF"),ha=Symbol("maybeEmitEnd"),eo=Symbol("emittedEnd"),kg=Symbol("emittingEnd"),rd=Symbol("emittedError"),Mg=Symbol("closed"),EF=Symbol("read"),jg=Symbol("flush"),TF=Symbol("flushChunk"),Gi=Symbol("encoding"),Jl=Symbol("decoder"),Ar=Symbol("flowing"),nd=Symbol("paused"),Zl=Symbol("resume"),xr=Symbol("buffer"),Sn=Symbol("pipes"),Cr=Symbol("bufferLength"),fE=Symbol("bufferPush"),$g=Symbol("bufferShift"),tn=Symbol("objectMode"),Xt=Symbol("destroyed"),dE=Symbol("error"),hE=Symbol("emitData"),AF=Symbol("emitEnd"),pE=Symbol("emitEnd2"),xs=Symbol("async"),mE=Symbol("abort"),Vg=Symbol("aborted"),id=Symbol("signal"),nc=Symbol("dataListeners"),Wn=Symbol("discarded"),sd=o(n=>Promise.resolve().then(n),"defer"),kY=o(n=>n(),"nodefer"),MY=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),jY=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),$Y=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Bg=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[Zl](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},gE=class extends Bg{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)}},VY=o(n=>!!n.objectMode,"isObjectModeOptions"),BY=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),to=class extends Ug.EventEmitter{static{o(this,"Minipass")}[Ar]=!1;[nd]=!1;[Sn]=[];[xr]=[];[tn];[Gi];[xs];[Jl];[da]=!1;[eo]=!1;[kg]=!1;[Mg]=!1;[rd]=null;[Cr]=0;[Xt]=!1;[id];[Vg]=!1;[nc]=0;[Wn]=!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");VY(t)?(this[tn]=!0,this[Gi]=null):BY(t)?(this[Gi]=t.encoding,this[tn]=!1):(this[tn]=!1,this[Gi]=null),this[xs]=!!t.async,this[Jl]=this[Gi]?new xF.StringDecoder(this[Gi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[xr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[Sn],"get")});let{signal:r}=t;r&&(this[id]=r,r.aborted?this[mE]():r.addEventListener("abort",()=>this[mE]()))}get bufferLength(){return this[Cr]}get encoding(){return this[Gi]}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[tn]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[xs]}set async(e){this[xs]=this[xs]||!!e}[mE](){this[Vg]=!0,this.emit("abort",this[id]?.reason),this.destroy(this[id]?.reason)}get aborted(){return this[Vg]}set aborted(e){}write(e,t,r){if(this[Vg])return!1;if(this[da])throw new Error("write after end");if(this[Xt])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[xs]?sd:kY;if(!this[tn]&&!Buffer.isBuffer(e)){if($Y(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(jY(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[tn]?(this[Ar]&&this[Cr]!==0&&this[jg](!0),this[Ar]?this.emit("data",e):this[fE](e),this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Ar]):e.length?(typeof e=="string"&&!(t===this[Gi]&&!this[Jl]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Gi]&&(e=this[Jl].write(e)),this[Ar]&&this[Cr]!==0&&this[jg](!0),this[Ar]?this.emit("data",e):this[fE](e),this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Ar]):(this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Ar])}read(e){if(this[Xt])return null;if(this[Wn]=!1,this[Cr]===0||e===0||e&&e>this[Cr])return this[ha](),null;this[tn]&&(e=null),this[xr].length>1&&!this[tn]&&(this[xr]=[this[Gi]?this[xr].join(""):Buffer.concat(this[xr],this[Cr])]);let t=this[EF](e||null,this[xr][0]);return this[ha](),t}[EF](e,t){if(this[tn])this[$g]();else{let r=t;e===r.length||e===null?this[$g]():typeof r=="string"?(this[xr][0]=r.slice(e),t=r.slice(0,e),this[Cr]-=e):(this[xr][0]=r.subarray(e),t=r.subarray(0,e),this[Cr]-=e)}return this.emit("data",t),!this[xr].length&&!this[da]&&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[da]=!0,this.writable=!1,(this[Ar]||!this[nd])&&this[ha](),this}[Zl](){this[Xt]||(!this[nc]&&!this[Sn].length&&(this[Wn]=!0),this[nd]=!1,this[Ar]=!0,this.emit("resume"),this[xr].length?this[jg]():this[da]?this[ha]():this.emit("drain"))}resume(){return this[Zl]()}pause(){this[Ar]=!1,this[nd]=!0,this[Wn]=!1}get destroyed(){return this[Xt]}get flowing(){return this[Ar]}get paused(){return this[nd]}[fE](e){this[tn]?this[Cr]+=1:this[Cr]+=e.length,this[xr].push(e)}[$g](){return this[tn]?this[Cr]-=1:this[Cr]-=this[xr][0].length,this[xr].shift()}[jg](e=!1){do;while(this[TF](this[$g]())&&this[xr].length);!e&&!this[xr].length&&!this[da]&&this.emit("drain")}[TF](e){return this.emit("data",e),this[Ar]}pipe(e,t){if(this[Xt])return e;this[Wn]=!1;let r=this[eo];return t=t||{},e===wF.stdout||e===wF.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[Sn].push(t.proxyErrors?new gE(this,e,t):new Bg(this,e,t)),this[xs]?sd(()=>this[Zl]()):this[Zl]()),e}unpipe(e){let t=this[Sn].find(r=>r.dest===e);t&&(this[Sn].length===1?(this[Ar]&&this[nc]===0&&(this[Ar]=!1),this[Sn]=[]):this[Sn].splice(this[Sn].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[Wn]=!1,this[nc]++,!this[Sn].length&&!this[Ar]&&this[Zl]();else if(e==="readable"&&this[Cr]!==0)super.emit("readable");else if(MY(e)&&this[eo])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[rd]){let i=t;this[xs]?sd(()=>i.call(this,this[rd])):i.call(this,this[rd])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[nc]=this.listeners("data").length,this[nc]===0&&!this[Wn]&&!this[Sn].length&&(this[Ar]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[nc]=0,!this[Wn]&&!this[Sn].length&&(this[Ar]=!1)),t}get emittedEnd(){return this[eo]}[ha](){!this[kg]&&!this[eo]&&!this[Xt]&&this[xr].length===0&&this[da]&&(this[kg]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Mg]&&this.emit("close"),this[kg]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Xt&&this[Xt])return!1;if(e==="data")return!this[tn]&&!r?!1:this[xs]?(sd(()=>this[hE](r)),!0):this[hE](r);if(e==="end")return this[AF]();if(e==="close"){if(this[Mg]=!0,!this[eo]&&!this[Xt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[rd]=r,super.emit(dE,r);let s=!this[id]||this.listeners("error").length?super.emit("error",r):!1;return this[ha](),s}else if(e==="resume"){let s=super.emit("resume");return this[ha](),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[ha](),i}[hE](e){for(let r of this[Sn])r.dest.write(e)===!1&&this.pause();let t=this[Wn]?!1:super.emit("data",e);return this[ha](),t}[AF](){return this[eo]?!1:(this[eo]=!0,this.readable=!1,this[xs]?(sd(()=>this[pE]()),!0):this[pE]())}[pE](){if(this[Jl]){let t=this[Jl].end();if(t){for(let r of this[Sn])r.dest.write(t);this[Wn]||super.emit("data",t)}}for(let t of this[Sn])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[tn]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[tn]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[tn])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Gi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Xt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Wn]=!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[da])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(Xt,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(Xt,f),this.pause(),s({value:d,done:!!this[da]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Xt,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(Xt,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[Wn]=!1;let e=!1,t=o(()=>(this.pause(),this.off(dE,t),this.off(Xt,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(dE,t),this.once(Xt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Xt])return e?this.emit("error",e):this.emit(Xt),this;this[Xt]=!0,this[Wn]=!0,this[xr].length=0,this[Cr]=0;let t=this;return typeof t.close=="function"&&!this[Mg]&&t.close(),e?this.emit("error",e):this.emit(Xt),this}static get isStream(){return DY}};var qY=Is.realpathSync.native,od={lstatSync:Is.lstatSync,readdir:Is.readdir,readdirSync:Is.readdirSync,readlinkSync:Is.readlinkSync,realpathSync:qY,promises:{lstat:ro.lstat,readdir:ro.readdir,readlink:ro.readlink,realpath:ro.realpath}},FF=o(n=>!n||n===od||n===UY?od:{...od,...n,promises:{...od.promises,...n.promises||{}}},"fsFromOption"),DF=/^\\\\\?\\([a-z]:)\\?$/i,WY=o(n=>n.replace(/\//g,"\\").replace(DF,"$1\\"),"uncToDrive"),GY=/[\\\/]/,li=0,NF=1,LF=2,Cs=4,kF=6,MF=8,ic=10,jF=12,ci=15,ad=~ci,_E=16,CF=32,cd=64,zi=128,qg=256,Gg=512,IF=cd|zi|Gg,zY=1023,SE=o(n=>n.isFile()?MF:n.isDirectory()?Cs:n.isSymbolicLink()?ic:n.isCharacterDevice()?LF:n.isBlockDevice()?kF:n.isSocket()?jF:n.isFIFO()?NF:li,"entToType"),RF=new Map,ld=o(n=>{let e=RF.get(n);if(e)return e;let t=n.normalize("NFKD");return RF.set(n,t),t},"normalize"),PF=new Map,Wg=o(n=>{let e=PF.get(n);if(e)return e;let t=ld(n.toLowerCase());return PF.set(n,t),t},"normalizeNocase"),zg=class extends td{static{o(this,"ResolveCache")}constructor(){super({max:256})}},vE=class extends td{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},$F=Symbol("PathScurry setAsCwd"),rn=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;#v;#b;#x;#C;#o;#F;#A;#P;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=li,r,i,s,a,c){this.name=e,this.#S=s?Wg(e):ld(e),this.#o=t&zY,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#v=c.fullpath,this.#x=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=FF(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&=~_E,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Wg(e):ld(e);for(let l of r)if(l.#S===i)return l;let s=this.parent?this.sep:"",a=this.#v?this.#v+s+e:void 0,c=this.newChild(e,li,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=zi),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.#v!==void 0)return this.#v;let e=this.name,t=this.parent;if(!t)return this.#v=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#v=i}fullpathPosix(){if(this.#b!==void 0)return this.#b;if(this.sep==="/")return this.#b=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#b=`//?/${i}`:this.#b=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#b=r}isUnknown(){return(this.#o&ci)===li}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&ci)===MF}isDirectory(){return(this.#o&ci)===Cs}isCharacterDevice(){return(this.#o&ci)===LF}isBlockDevice(){return(this.#o&ci)===kF}isFIFO(){return(this.#o&ci)===NF}isSocket(){return(this.#o&ci)===jF}isSymbolicLink(){return(this.#o&ic)===ic}lstatCached(){return this.#o&CF?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#P}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&ci;return!(e!==li&&e!==ic||this.#o&qg||this.#o&zi)}calledReaddir(){return!!(this.#o&_E)}isENOENT(){return!!(this.#o&zi)}isNamed(e){return this.nocase?this.#S===Wg(e):this.#S===ld(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|=_E;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&zi||(this.#o=(this.#o|zi)&ad,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#R(){this.#o|=Gg,this.#k()}#k(){if(this.#o&cd)return;let e=this.#o;(e&ci)===Cs&&(e&=ad),this.#o=e|cd,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|=qg,e==="ENOENT"&&(t|=zi),(e==="EINVAL"||e==="UNKNOWN")&&(t&=ad),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#O(e,t)||this.#V(e,t)}#V(e,t){let r=SE(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&ci;return s!==Cs&&s!==ic&&s!==li&&(i.#o|=cd),t.unshift(i),t.provisional++,i}#O(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Wg(e.name):ld(e.name))===i.#S)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#o=t.#o&ad|SE(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&zi)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&zi)===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:y,mtimeMs:v,nlink:E,rdev:b,size:A,uid:I}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#d=u,this.#n=f,this.#_=d,this.#s=h,this.#r=p,this.#f=y,this.#g=v,this.#t=E,this.#i=b,this.#l=A,this.#c=I;let j=SE(e);this.#o=this.#o&ad|j|CF,j!==li&&j!==Cs&&j!==ic&&(this.#o|=cd)}#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&IF)return!1;let e=ci&this.#o;return e===li||e===Cs||e===ic}shouldWalk(e,t){return(this.#o&Cs)===Cs&&!(this.#o&IF)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#P)return this.#P;if(!((Gg|qg|zi)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#P=this.resolve(e)}catch{this.#R()}}realpathSync(){if(this.#P)return this.#P;if(!((Gg|qg|zi)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#P=this.resolve(e)}catch{this.#R()}}[$F](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}},Hg=class n extends rn{static{o(this,"PathWin32")}sep="\\";splitSep=GY;constructor(e,t=li,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=li,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return eu.win32.parse(e).root}getRoot(e){if(e=WY(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 tu(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(DF,"$1\\"),e===t}},Qg=class n extends rn{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=li,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=li,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Yg=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=od}={}){this.#t=FF(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,OF.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new zg,this.#n=new zg,this.#r=new vE(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,h=this.rootPath,p=!1;for(let y of l){let v=f--;u=u.child(y,{relative:new Array(v).fill("..").join(d),relativePosix:new Array(v).fill("..").join("/"),fullpath:h+=(p?"":d)+y}),p=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#e.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#n.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof rn||(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 rn||(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 rn||(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 rn||(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 rn||(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 rn||(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 rn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=o((d,h)=>{l.add(d),d.readdirCB((p,y)=>{if(p)return h(p);let v=y.length;if(!v)return h();let E=o(()=>{--v===0&&h()},"next");for(let b of y)(!s||s(b))&&c.push(r?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(A=>A?.isUnknown()?A.lstat():A).then(A=>A?.shouldWalk(l,a)?u(A,E):E()):b.shouldWalk(l,a)?u(b,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 rn||(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 rn||(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 rn||(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 rn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new to({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=o((E,b,A=!1)=>{if(E)return c.emit("error",E);if(i&&!A){let I=[];for(let j of b)j.isSymbolicLink()&&I.push(j.realpath().then(B=>B?.isUnknown()?B.lstat():B));if(I.length){Promise.all(I).then(()=>y(null,b,!0));return}}for(let I of b)I&&(!s||s(I))&&(c.write(r?I:I.fullpath())||(h=!0));f--;for(let I of b){let j=I.realpathCached()||I;j.shouldWalk(l,a)&&u.push(j)}h&&!c.flowing?c.once("drain",d):v||d()},"onReaddir"),v=!0;p.readdirCB(y,!0),v=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof rn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new to({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let v of y)(!s||s(v))&&(c.write(r?v:v.fullpath())||(h=!0));f--;for(let v of y){let E=v;if(v.isSymbolicLink()){if(!(i&&(E=v.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[$F](t)}},tu=class extends Yg{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,eu.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return eu.win32.parse(e).root.toUpperCase()}newRoot(e){return new Hg(this.rootPath,Cs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},ru=class extends Yg{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,eu.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new Qg(this.rootPath,Cs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},ud=class extends ru{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},qpe=process.platform==="win32"?Hg:Qg,VF=process.platform==="win32"?tu:process.platform==="darwin"?ud:ru;var HY=o(n=>n.length>=1,"isPatternList"),QY=o(n=>n.length>=1,"isGlobList"),nu=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!HY(e))throw new TypeError("empty pattern list");if(!QY(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,a,c,l,...u]=this.#e,[f,d,h,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let v=[s,a,c,l,""].join("/"),E=[f,d,h,p,""].join("/");this.#e=[v,...u],this.#n=[E,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[c,...l]=this.#n;a[0]===""&&(a.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...a],this.#n=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===Kt}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 YY=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",iu=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=YY}){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 qn(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 nu(i,s,0,this.platform),c=new qn(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 bE=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()]))}},wE=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)])}},EE=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())}},fd=class n{static{o(this,"Processor")}hasWalkedCache;matches=new wE;subwalks=new EE;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new bE}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===Kt){(!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===Kt?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 KY=o((n,e)=>typeof n=="string"?new iu([n],e):Array.isArray(n)?new iu(n,e):n,"makeIgnore"),Kg=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=KY(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 fd(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 fd(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()}},dd=class extends Kg{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}},hd=class extends Kg{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new to({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 XY=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Hi=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,BF.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||XY,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"?tu:t.platform==="darwin"?ud:t.platform?ru:VF;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 qn(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 nu(l,f,0,this.platform)})}async walk(){return[...await new dd(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 dd(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 hd(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 hd(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 TE=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new qn(t,e).hasMagic())return!0;return!1},"hasMagic");function Jg(n,e={}){return new Hi(n,e).streamSync()}o(Jg,"globStreamSync");function qF(n,e={}){return new Hi(n,e).stream()}o(qF,"globStream");function WF(n,e={}){return new Hi(n,e).walkSync()}o(WF,"globSync");async function UF(n,e={}){return new Hi(n,e).walk()}o(UF,"glob_");function Zg(n,e={}){return new Hi(n,e).iterateSync()}o(Zg,"globIterateSync");function GF(n,e={}){return new Hi(n,e).iterate()}o(GF,"globIterate");var JY=Jg,ZY=Object.assign(qF,{sync:Jg}),eK=Zg,tK=Object.assign(GF,{sync:Zg}),rK=Object.assign(WF,{stream:Jg,iterate:Zg}),Xg=Object.assign(UF,{glob:UF,globSync:WF,sync:rK,globStream:qF,stream:ZY,globStreamSync:Jg,streamSync:JY,globIterate:GF,iterate:tK,globIterateSync:Zg,iterateSync:eK,Glob:Hi,hasMagic:TE,escape:Yl,unescape:Wi});Xg.glob=Xg;var sc=Y(Dt());var Pt=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await mr.default.pathExists(t))throw new sc.FileNotFoundError(e);return mr.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return mr.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 mr.default.pathExists(r))throw new sc.FileAlreadyExistsError(e);return await mr.default.ensureDir(no.default.dirname(r)),await mr.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await mr.default.pathExists(r))throw new sc.FileNotFoundError(e);await mr.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await mr.default.ensureDir(no.default.dirname(r)),await mr.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await mr.default.pathExists(t))throw new sc.FileNotFoundError(e);await mr.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await mr.default.pathExists(r))throw new sc.FileNotFoundError(e);await mr.default.ensureDir(no.default.dirname(i)),await mr.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await mr.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await mr.default.pathExists(t)?(await mr.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=no.default.join(t,"**/*.md");return(await Xg(r,{nodir:!0})).map(a=>no.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 no.default.isAbsolute(e)?e:no.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=$r.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 pd=Y(require("path")),AE=Y(Ka());var su=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!pd.default.isAbsolute(e))return pd.default.resolve(this.vaultRoot,e);let t=pd.default.resolve(e),r=pd.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(!AE.default.existsSync(e))throw new Mf(e);if(!AE.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 XF=Y(Dt());var zF=Y(Dt());var Qi=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 zF.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(`
618
618
  `).filter(i=>i.trim()).map(i=>i.replace(/^\s*-\s*/,"").trim()):[]}};var md=class extends Qi{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 Br=[];for(let n=0;n<256;++n)Br.push((n+256).toString(16).slice(1));function HF(n,e=0){return(Br[n[e+0]]+Br[n[e+1]]+Br[n[e+2]]+Br[n[e+3]]+"-"+Br[n[e+4]]+Br[n[e+5]]+"-"+Br[n[e+6]]+Br[n[e+7]]+"-"+Br[n[e+8]]+Br[n[e+9]]+"-"+Br[n[e+10]]+Br[n[e+11]]+Br[n[e+12]]+Br[n[e+13]]+Br[n[e+14]]+Br[n[e+15]]).toLowerCase()}o(HF,"unsafeStringify");var QF=require("node:crypto");var ty=new Uint8Array(256),ey=ty.length;function xE(){return ey>ty.length-16&&((0,QF.randomFillSync)(ty),ey=0),ty.slice(ey,ey+=16)}o(xE,"rng");var YF=require("node:crypto"),CE={randomUUID:YF.randomUUID};function iK(n,e,t){n=n||{};let r=n.random??n.rng?.()??xE();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 HF(r)}o(iK,"_v4");function sK(n,e,t){return CE.randomUUID&&!e&&!n?CE.randomUUID():iK(n,e,t)}o(sK,"v4");var gd=sK;var au=Y(Dt());var yd=class extends Qi{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 au.FileAlreadyExistsError(e);let l=gd(),u=this.buildAssetFrontmatter(r,l,s,i),f=au.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=au.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 IE=Y(require("path"));var KF=Y(Dt());var _d=class extends Qi{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=IE.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",`
619
619
  - ${i}`)),await this.fsAdapter.updateFile(t,d),console.log(` Updated label: "${i}"`)}let a=IE.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",`
620
620
  - ${r}`):a=this.frontmatterService.updateProperty(a,"aliases",`${l.map(u=>`
621
621
  - ${u}`).join("")}
622
622
  - ${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(`
623
- \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=KF.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 no=Y(require("path"));var Sd=class extends Qi{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=no.default.dirname(a),l=c==="."?"":c,u=no.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 y=no.default.basename(t),v=l?`${l}/${y}`:y;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: ${v}`),console.log(`
624
- \u{1F4A1} Run without --dry-run to apply changes`),process.exit(0),{moved:!1,oldPath:t,newPath:v,expectedFolder:l}}let d=no.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=no.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=no.default.basename(f,".md"),h=no.default.basename(r,".md");return d===h})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};var ry=class{static{o(this,"CommandExecutor")}constructor(e,t=!1){this.context={pathResolver:new su(e),fsAdapter:new Pt(e),frontmatterService:new XF.FrontmatterService,dryRun:t},this.statusExecutor=new md(this.context),this.creationExecutor=new yd(this.context),this.propertyExecutor=new _d(this.context),this.folderRepairExecutor=new Sd(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(`
625
- \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 Ur(n,e,t,r,i){if(n==="json"){let s={command:e,filepath:t,action:r,...i&&{changes:i}},a=X.success(s);console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 ${r}`)}o(Ur,"outputResult");function ac(n,e,t,r){let i=new Qe(`--${e} option is required for ${t} command`,r,{command:t,missingOption:e});D.handle(i)}o(ac,"handleMissingOption");function ZF(){return new Te("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),n==="start"&&console.error("\u26A0\uFE0F DEPRECATED: `command start <path>` is deprecated. Use `dyncommand exec <uid>` instead. `command start <path>` will be removed in 2 minor releases (T7.3).");try{let i=(0,JF.resolve)(t.vault),s=new ry(i,t.dryRun);switch(n){case"rename-to-uid":await s.executeRenameToUid(e),Ur(r,n,e,"Renamed file to UID-based name");break;case"update-label":t.label||ac(r,"label","update-label",'exocortex command update-label <filepath> --label "<value>"'),await s.executeUpdateLabel(e,t.label),Ur(r,n,e,`Updated label to "${t.label}"`,{label:t.label});break;case"start":await s.executeStart(e),Ur(r,n,e,"Started task");break;case"complete":await s.executeComplete(e),Ur(r,n,e,"Completed task");break;case"trash":await s.executeTrash(e),Ur(r,n,e,"Moved task to trash");break;case"archive":await s.executeArchive(e),Ur(r,n,e,"Archived task");break;case"move-to-backlog":await s.executeMoveToBacklog(e),Ur(r,n,e,"Moved task to backlog");break;case"move-to-analysis":await s.executeMoveToAnalysis(e),Ur(r,n,e,"Moved task to analysis");break;case"move-to-todo":await s.executeMoveToToDo(e),Ur(r,n,e,"Moved task to todo");break;case"create-task":t.label||ac(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}),Ur(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||ac(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}),Ur(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||ac(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}),Ur(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||ac(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}),Ur(r,n,e,`Created area "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"schedule":t.date||ac(r,"date","schedule",'exocortex command schedule <filepath> --date "YYYY-MM-DD"'),await s.executeSchedule(e,t.date),Ur(r,n,e,`Scheduled task for ${t.date}`,{date:t.date});break;case"set-deadline":t.date||ac(r,"date","set-deadline",'exocortex command set-deadline <filepath> --date "YYYY-MM-DD"'),await s.executeSetDeadline(e,t.date),Ur(r,n,e,`Set deadline to ${t.date}`,{date:t.date});break;case"repair-folder":{let a=await s.executeRepairFolder(e);Ur(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),Ur(r,n,e,`Executed ${n}`);break}}catch(i){D.handle(i)}})}o(ZF,"commandCommand");var tD=require("path");var pa=Y(require("fs")),RE=Y(require("path")),eD=require("events");var aK={watch:pa.default.watch.bind(pa.default),existsSync:pa.default.existsSync.bind(pa.default),statSync:pa.default.statSync.bind(pa.default),readFileSync:pa.default.readFileSync.bind(pa.default)},ny=class extends eD.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=RE.default.resolve(t),this.fsAdapter=r.fsAdapter??aK,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=RE.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?Vr(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 PE=Y(require("fs"));function rD(){return new Te("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,tD.resolve)(n.vault);if(!PE.default.existsSync(e))throw new Ee(e);if(!PE.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 ny(e,{pattern:n.pattern,assetType:n.assetType,debounceMs:t});r.on("change",s=>{console.log(JSON.stringify(s))}),r.on("error",s=>{let a=X.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(rD,"watchCommand");var FE=require("path"),DE=Y(Ya());var oc=Y(require("path"));var ou=Y(Dt());var Yi=Y(Ya()),OE=Y(require("crypto"));var iy=class{constructor(){this.backups=new Map;this.fileHashes=new Map}static{o(this,"TransactionManager")}async begin(e){if(!Yi.default.existsSync(e))throw new Error(`Cannot backup non-existent file: ${e}`);let t=await Yi.default.readFile(e,"utf-8"),r=OE.default.createHash("sha256").update(t).digest("hex");this.fileHashes.set(e,r);let i=`${e}.backup.${Date.now()}`;await Yi.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(!Yi.default.existsSync(e))return!1;let r=await Yi.default.readFile(e,"utf-8");return OE.default.createHash("sha256").update(r).digest("hex")===t}async commit(){for(let e of this.backups.values())Yi.default.existsSync(e)&&await Yi.default.remove(e);this.backups.clear(),this.fileHashes.clear()}async rollback(){for(let[e,t]of this.backups.entries())Yi.default.existsSync(t)&&(await Yi.default.copy(t,e,{overwrite:!0}),await Yi.default.remove(t));this.backups.clear(),this.fileHashes.clear()}getTrackedFiles(){return Array.from(this.backups.keys())}};var cc=class{static{o(this,"BatchExecutor")}constructor(e,t=!1){this.pathResolver=new su(e),this.fsAdapter=new Pt(e),this.frontmatterService=new ou.FrontmatterService,this.transactionManager=new iy,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 ou.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=ou.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=ou.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=oc.default.dirname(a),l=c==="."?"":c,u=oc.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=oc.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=oc.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=oc.default.basename(f,".md"),h=oc.default.basename(r,".md");return d===h})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};function oK(n,e){if(n==="json"){let t=X.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
623
+ \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=KF.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 io=Y(require("path"));var Sd=class extends Qi{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=io.default.dirname(a),l=c==="."?"":c,u=io.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 y=io.default.basename(t),v=l?`${l}/${y}`:y;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: ${v}`),console.log(`
624
+ \u{1F4A1} Run without --dry-run to apply changes`),process.exit(0),{moved:!1,oldPath:t,newPath:v,expectedFolder:l}}let d=io.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=io.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=io.default.basename(f,".md"),h=io.default.basename(r,".md");return d===h})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};var ry=class{static{o(this,"CommandExecutor")}constructor(e,t=!1){this.context={pathResolver:new su(e),fsAdapter:new Pt(e),frontmatterService:new XF.FrontmatterService,dryRun:t},this.statusExecutor=new md(this.context),this.creationExecutor=new yd(this.context),this.propertyExecutor=new _d(this.context),this.folderRepairExecutor=new Sd(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(`
625
+ \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 Ur(n,e,t,r,i){if(n==="json"){let s={command:e,filepath:t,action:r,...i&&{changes:i}},a=X.success(s);console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 ${r}`)}o(Ur,"outputResult");function ac(n,e,t,r){let i=new Qe(`--${e} option is required for ${t} command`,r,{command:t,missingOption:e});D.handle(i)}o(ac,"handleMissingOption");function ZF(){return new Te("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),n==="start"&&console.error("\u26A0\uFE0F DEPRECATED: `command start <path>` is deprecated. Use `dyncommand exec <uid>` instead. `command start <path>` will be removed in 2 minor releases (T7.3).");try{let i=(0,JF.resolve)(t.vault),s=new ry(i,t.dryRun);switch(n){case"rename-to-uid":await s.executeRenameToUid(e),Ur(r,n,e,"Renamed file to UID-based name");break;case"update-label":t.label||ac(r,"label","update-label",'exocortex command update-label <filepath> --label "<value>"'),await s.executeUpdateLabel(e,t.label),Ur(r,n,e,`Updated label to "${t.label}"`,{label:t.label});break;case"start":await s.executeStart(e),Ur(r,n,e,"Started task");break;case"complete":await s.executeComplete(e),Ur(r,n,e,"Completed task");break;case"trash":await s.executeTrash(e),Ur(r,n,e,"Moved task to trash");break;case"archive":await s.executeArchive(e),Ur(r,n,e,"Archived task");break;case"move-to-backlog":await s.executeMoveToBacklog(e),Ur(r,n,e,"Moved task to backlog");break;case"move-to-analysis":await s.executeMoveToAnalysis(e),Ur(r,n,e,"Moved task to analysis");break;case"move-to-todo":await s.executeMoveToToDo(e),Ur(r,n,e,"Moved task to todo");break;case"create-task":t.label||ac(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}),Ur(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||ac(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}),Ur(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||ac(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}),Ur(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||ac(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}),Ur(r,n,e,`Created area "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"schedule":t.date||ac(r,"date","schedule",'exocortex command schedule <filepath> --date "YYYY-MM-DD"'),await s.executeSchedule(e,t.date),Ur(r,n,e,`Scheduled task for ${t.date}`,{date:t.date});break;case"set-deadline":t.date||ac(r,"date","set-deadline",'exocortex command set-deadline <filepath> --date "YYYY-MM-DD"'),await s.executeSetDeadline(e,t.date),Ur(r,n,e,`Set deadline to ${t.date}`,{date:t.date});break;case"repair-folder":{let a=await s.executeRepairFolder(e);Ur(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),Ur(r,n,e,`Executed ${n}`);break}}catch(i){D.handle(i)}})}o(ZF,"commandCommand");var tD=require("path");var pa=Y(require("fs")),RE=Y(require("path")),eD=require("events");var aK={watch:pa.default.watch.bind(pa.default),existsSync:pa.default.existsSync.bind(pa.default),statSync:pa.default.statSync.bind(pa.default),readFileSync:pa.default.readFileSync.bind(pa.default)},ny=class extends eD.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=RE.default.resolve(t),this.fsAdapter=r.fsAdapter??aK,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=RE.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?Vr(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 PE=Y(require("fs"));function rD(){return new Te("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,tD.resolve)(n.vault);if(!PE.default.existsSync(e))throw new Ee(e);if(!PE.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 ny(e,{pattern:n.pattern,assetType:n.assetType,debounceMs:t});r.on("change",s=>{console.log(JSON.stringify(s))}),r.on("error",s=>{let a=X.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(rD,"watchCommand");var FE=require("path"),DE=Y(Ka());var oc=Y(require("path"));var ou=Y(Dt());var Yi=Y(Ka()),OE=Y(require("crypto"));var iy=class{constructor(){this.backups=new Map;this.fileHashes=new Map}static{o(this,"TransactionManager")}async begin(e){if(!Yi.default.existsSync(e))throw new Error(`Cannot backup non-existent file: ${e}`);let t=await Yi.default.readFile(e,"utf-8"),r=OE.default.createHash("sha256").update(t).digest("hex");this.fileHashes.set(e,r);let i=`${e}.backup.${Date.now()}`;await Yi.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(!Yi.default.existsSync(e))return!1;let r=await Yi.default.readFile(e,"utf-8");return OE.default.createHash("sha256").update(r).digest("hex")===t}async commit(){for(let e of this.backups.values())Yi.default.existsSync(e)&&await Yi.default.remove(e);this.backups.clear(),this.fileHashes.clear()}async rollback(){for(let[e,t]of this.backups.entries())Yi.default.existsSync(t)&&(await Yi.default.copy(t,e,{overwrite:!0}),await Yi.default.remove(t));this.backups.clear(),this.fileHashes.clear()}getTrackedFiles(){return Array.from(this.backups.keys())}};var cc=class{static{o(this,"BatchExecutor")}constructor(e,t=!1){this.pathResolver=new su(e),this.fsAdapter=new Pt(e),this.frontmatterService=new ou.FrontmatterService,this.transactionManager=new iy,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 ou.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=ou.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=ou.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=oc.default.dirname(a),l=c==="."?"":c,u=oc.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=oc.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=oc.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=oc.default.basename(f,".md"),h=oc.default.basename(r,".md");return d===h})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};function oK(n,e){if(n==="json"){let t=X.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
626
626
  \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(`
627
627
  \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(`
628
628
  \u{1F4CB} Successful Operations:`);for(let t of e.results.filter(r=>r.success))console.log(` \u2705 ${t.command} ${t.filepath}: ${t.action}`)}}}o(oK,"outputResult");function nD(){return new Te("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,FE.resolve)(n.vault),r;if(n.input)r=n.input;else if(n.file){let c=(0,FE.resolve)(n.file);if(!DE.default.existsSync(c))throw new Qe(`Batch file not found: ${c}`,"exocortex batch --file operations.json");r=await DE.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=cc.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 cc(t,n.dryRun).executeBatch(i,n.atomic);oK(e,a),process.exit(a.success?0:5)}catch(t){D.handle(t)}})}o(nD,"batchCommand");var iD=require("path");function cK(n,e){if(n==="json"){let t=X.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
@@ -636,13 +636,13 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
636
636
  `),te.length>0?hK(te,e.format):console.log("No results found."),F.length>0){console.log(`
637
637
  \u{1F4A1} Suggestions:`);for(let $ of F)console.log(` \u2022 ${$}`)}if(a.confidence<.6&&a.alternatives.length>0){console.log(`
638
638
  \u{1F504} Alternative queries that might work better:`);for(let $=0;$<Math.min(2,a.alternatives.length);$++)console.log(` ${$+1}. ${a.alternatives[$].split(`
639
- `).slice(-3)[0]?.trim()||"..."}`)}}}catch(r){D.handle(r)}})}o(fD,"askCommand");function hK(n,e){let t=n;switch(e){case"json":let r=new Vl;console.log(r.format(t));break;case"table":default:let i=new $l;console.log(i.format(t));break}}o(hK,"formatResults");var lu=require("path"),uu=require("fs"),lc=Y(ue()),io=Y(Dt());var zye=Y(Hd()),cu=Y(ue()),vd=Y(Dt());var ay=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 oy=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 ly=Y(require("fs/promises")),dD=Y(require("path")),hD=Y(require("os"));var cy=class{constructor(e=".exocortexrc"){this.config={};this.configPath=dD.join(hD.homedir(),e)}static{o(this,"NodeConfiguration")}async load(){try{let e=await ly.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 ly.writeFile(this.configPath,JSON.stringify(this.config,null,2),"utf-8")}};var pD=Y(require("readline"));var uy=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=pD.createInterface({input:process.stdin,output:process.stdout});return new Promise(i=>{r.question(`${e}
639
+ `).slice(-3)[0]?.trim()||"..."}`)}}}catch(r){D.handle(r)}})}o(fD,"askCommand");function hK(n,e){let t=n;switch(e){case"json":let r=new Vl;console.log(r.format(t));break;case"table":default:let i=new $l;console.log(i.format(t));break}}o(hK,"formatResults");var lu=require("path"),uu=require("fs"),lc=Y(ue()),so=Y(Dt());var zye=Y(Hd()),cu=Y(ue()),vd=Y(Dt());var ay=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 oy=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 ly=Y(require("fs/promises")),dD=Y(require("path")),hD=Y(require("os"));var cy=class{constructor(e=".exocortexrc"){this.config={};this.configPath=dD.join(hD.homedir(),e)}static{o(this,"NodeConfiguration")}async load(){try{let e=await ly.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 ly.writeFile(this.configPath,JSON.stringify(this.config,null,2),"utf-8")}};var pD=Y(require("readline"));var uy=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=pD.createInterface({input:process.stdin,output:process.stdout});return new Promise(i=>{r.question(`${e}
640
640
  ${t}
641
- Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes")})})}};var fy=class{static{o(this,"CLIContainer")}static setup(){cu.container.register(vd.DI_TOKENS.ILogger,{useFactory:o(()=>new ay("exocortex-cli"),"useFactory")}),cu.container.register(vd.DI_TOKENS.IEventBus,{useClass:oy}),cu.container.register(vd.DI_TOKENS.IConfiguration,{useClass:cy}),cu.container.register(vd.DI_TOKENS.INotificationService,{useClass:uy})}static reset(){cu.container.clearInstances()}};function bd(n){fy.setup(),lc.container.register(io.DI_TOKENS.IVaultAdapter,{useFactory:o(()=>new Nt(n),"useFactory")})}o(bd,"setupContainer");function pK(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(`
641
+ Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes")})})}};var fy=class{static{o(this,"CLIContainer")}static setup(){cu.container.register(vd.DI_TOKENS.ILogger,{useFactory:o(()=>new ay("exocortex-cli"),"useFactory")}),cu.container.register(vd.DI_TOKENS.IEventBus,{useClass:oy}),cu.container.register(vd.DI_TOKENS.IConfiguration,{useClass:cy}),cu.container.register(vd.DI_TOKENS.INotificationService,{useClass:uy})}static reset(){cu.container.clearInstances()}};function bd(n){fy.setup(),lc.container.register(so.DI_TOKENS.IVaultAdapter,{useFactory:o(()=>new Nt(n),"useFactory")})}o(bd,"setupContainer");function pK(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(`
642
642
  `)}o(pK,"formatPractices");function mK(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(`
643
- `)}o(mK,"formatSummary");function mD(){let n=new Te("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,lu.resolve)(e.vault);if(!(0,uu.existsSync)(r))throw new Ee(r);bd(r);let s=await lc.container.resolve(io.DailyReviewService).getPractices();if(t==="json"){let a=X.success({practices:s,count:s.length});console.log(JSON.stringify(a,null,2))}else console.log(pK(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,lu.resolve)(e.vault);if(!(0,uu.existsSync)(r))throw new Ee(r);bd(r);let i=lc.container.resolve(io.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=X.success(a);console.log(JSON.stringify(c,null,2))}else console.log(mK(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,lu.resolve)(t.vault);if(!(0,uu.existsSync)(i))throw new Ee(i);bd(i);let s=lc.container.resolve(io.DailyReviewService),a=t.start!==!1,c=await s.quickCapture(e,a);if(r==="json"){let l=X.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,lu.resolve)(t.vault);if(!(0,uu.existsSync)(i))throw new Ee(i);bd(i);let a=await lc.container.resolve(io.DailyReviewService).createFromPractice({prototypeUid:e,startImmediately:!0});if(r==="json"){let c=X.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,lu.resolve)(t.vault);if(!(0,uu.existsSync)(i))throw new Ee(i);if(bd(i),await lc.container.resolve(io.DailyReviewService).markPracticeDone(e),r==="json"){let a=X.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(mD,"dailyReviewCommand");var xD=require("fs"),CD=require("path");var ma=require("fs"),so=require("path"),gD=require("child_process"),At=Y(Dt());var gK=new Set(["aliases","archived","tags","cssclasses","publish","permalink","description","image","cover","banner","title","share","share_link","share_updated","metadata","uri"]),yD=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 yK(n){let e=n.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return n.match(/^---\r?\n---/)?{}:null;let t=e[1].split(`
643
+ `)}o(mK,"formatSummary");function mD(){let n=new Te("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,lu.resolve)(e.vault);if(!(0,uu.existsSync)(r))throw new Ee(r);bd(r);let s=await lc.container.resolve(so.DailyReviewService).getPractices();if(t==="json"){let a=X.success({practices:s,count:s.length});console.log(JSON.stringify(a,null,2))}else console.log(pK(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,lu.resolve)(e.vault);if(!(0,uu.existsSync)(r))throw new Ee(r);bd(r);let i=lc.container.resolve(so.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=X.success(a);console.log(JSON.stringify(c,null,2))}else console.log(mK(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,lu.resolve)(t.vault);if(!(0,uu.existsSync)(i))throw new Ee(i);bd(i);let s=lc.container.resolve(so.DailyReviewService),a=t.start!==!1,c=await s.quickCapture(e,a);if(r==="json"){let l=X.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,lu.resolve)(t.vault);if(!(0,uu.existsSync)(i))throw new Ee(i);bd(i);let a=await lc.container.resolve(so.DailyReviewService).createFromPractice({prototypeUid:e,startImmediately:!0});if(r==="json"){let c=X.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,lu.resolve)(t.vault);if(!(0,uu.existsSync)(i))throw new Ee(i);if(bd(i),await lc.container.resolve(so.DailyReviewService).markPracticeDone(e),r==="json"){let a=X.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(mD,"dailyReviewCommand");var xD=require("fs"),CD=require("path");var ma=require("fs"),ao=require("path"),gD=require("child_process"),At=Y(Dt());var gK=new Set(["aliases","archived","tags","cssclasses","publish","permalink","description","image","cover","banner","title","share","share_link","share_updated","metadata","uri"]),yD=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 yK(n){let e=n.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return n.match(/^---\r?\n---/)?{}:null;let t=e[1].split(`
644
644
  `),r={};for(let i of t){let s=i.match(/^(\w[\w]*):\s*(.*)$/);s&&(r[s[1]]=!0)}return r}o(yK,"extractFrontmatter");function _D(n){for(let e of yD.keys())if(n.startsWith(e))return!0;return!1}o(_D,"hasKnownPrefix");function SD(n){for(let[e,t]of yD)if(n.startsWith(e))return t+n.substring(e.length);return null}o(SD,"keyToURI");function _K(n){let e=[],t=[];for(let r of n)gK.has(r)||(_D(r)?e.push(r):t.push(r));return{toValidate:e,unknownPrefix:t}}o(_K,"classifyKeys");function SK(n){try{return(0,gD.execSync)("git diff --cached --name-only",{cwd:n,encoding:"utf-8"}).split(`
645
- `).filter(t=>t.endsWith(".md")&&t.trim().length>0)}catch{return[]}}o(SK,"getStagedMdFiles");function vK(n){let e=[];function t(r){let i=(0,ma.readdirSync)(r);for(let s of i){if(s.startsWith(".")||s==="node_modules")continue;let a=(0,so.join)(r,s);(0,ma.statSync)(a).isDirectory()?t(a):s.endsWith(".md")&&e.push((0,so.relative)(n,a))}}return o(t,"walk"),t(n),e}o(vK,"collectMdFiles");function bK(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)),_D(t)?t:null}o(bK,"extractPropertyNameFromURI");async function wK(n){let e=new At.InMemoryTripleStore;await e.addAll(n);let t=new At.ExoQLParser,r=Hl(`SELECT ?s ?label WHERE {
645
+ `).filter(t=>t.endsWith(".md")&&t.trim().length>0)}catch{return[]}}o(SK,"getStagedMdFiles");function vK(n){let e=[];function t(r){let i=(0,ma.readdirSync)(r);for(let s of i){if(s.startsWith(".")||s==="node_modules")continue;let a=(0,ao.join)(r,s);(0,ma.statSync)(a).isDirectory()?t(a):s.endsWith(".md")&&e.push((0,ao.relative)(n,a))}}return o(t,"walk"),t(n),e}o(vK,"collectMdFiles");function bK(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)),_D(t)?t:null}o(bK,"extractPropertyNameFromURI");async function wK(n){let e=new At.InMemoryTripleStore;await e.addAll(n);let t=new At.ExoQLParser,r=Hl(`SELECT ?s ?label WHERE {
646
646
  {
647
647
  ?s a ?type .
648
648
  FILTER(CONTAINS(STR(?type), "Property"))
@@ -659,9 +659,9 @@ Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes
659
659
  FILTER(!CONTAINS(STR(?class), "PropertyCardinality"))
660
660
  }
661
661
  OPTIONAL { ?s exo:Asset_label ?label }
662
- }`),i=t.parse(r),a=new At.ExoQLAlgebraTranslator().translate(i);a=new At.AlgebraOptimizer().optimize(a);let u=await new At.ExoQLQueryExecutor(e).executeAll(a),f=new Set;for(let d of u){let h=d.toJSON(),p=h.s;if(typeof p=="string"){let v=bK(p);if(v){let E=SD(v);E&&f.add(E)}}let y=h.label;typeof y=="string"&&y.startsWith("https://exocortex.my/ontology/")&&f.add(y)}return f}o(wK,"loadDeclaredProperties");function EK(n,e,t){let r=[],i;try{i=(0,ma.readFileSync)(n,"utf-8")}catch{return[]}let s=yK(i);if(!s)return[];let a=Object.keys(s),{toValidate:c,unknownPrefix:l}=_K(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=SD(u);f&&!t.has(f)&&r.push({file:e,property:u,reason:`Property "${u}" is not declared in the ontology`})}return r}o(EK,"validateFile");var TK="http://www.w3.org/2000/01/rdf-schema#subClassOf";function AK(n){let e=o(r=>{if(r instanceof At.DomainIRI)return{type:"iri",value:r.value};if(r instanceof At.DomainLiteral){let i={type:"literal",value:r.value};return r.datatype&&(i.datatype=r.datatype.value),r.language&&(i.language=r.language),i}return null},"mapNode"),t=[];for(let r of n){let i=e(r.subject),s=e(r.predicate),a=e(r.object);i&&s&&a&&t.push({subject:i,predicate:s,object:a})}return t}o(AK,"domainToAlgebraTriples");var NE=class{constructor(e){this.subClassMap=new Map;for(let t of e)if(t.predicate instanceof At.DomainIRI&&t.predicate.value===TK&&t.subject instanceof At.DomainIRI&&t.object instanceof At.DomainIRI){let r=this.subClassMap.get(t.subject.value)??new Set;r.add(t.object.value),this.subClassMap.set(t.subject.value,r)}}static{o(this,"TripleClassHierarchy")}isSubClassOf(e,t){let r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===t)return!0;if(r.has(s))continue;r.add(s);let a=this.subClassMap.get(s);if(a)for(let c of a)i.push(c)}return!1}};function xK(n,e){let t=`file://${n}`,r="https://exocortex.my/cli/shacl-validator",i={earl:"http://www.w3.org/ns/earl#",dc:"http://purl.org/dc/terms/",xsd:"http://www.w3.org/2001/XMLSchema#",sh:"http://www.w3.org/ns/shacl#"},s=[{"@type":"earl:Assertor","@id":r,"dc:title":"Exocortex CLI SHACL-lite Validator"},{"@type":"earl:TestSubject","@id":t,"dc:title":n}];if(e.violations.length===0)s.push({"@type":"earl:Assertion","earl:assertedBy":{"@id":r},"earl:subject":{"@id":t},"earl:result":{"@type":"earl:TestResult","earl:outcome":{"@id":"earl:passed"},"dc:description":"All nodes conform to shapes"}});else for(let a of e.violations)s.push({"@type":"earl:Assertion","earl:assertedBy":{"@id":r},"earl:subject":{"@id":t},"earl:test":{"@id":a.propertyPath},"earl:result":{"@type":"earl:TestResult","earl:outcome":{"@id":"earl:failed"},"dc:description":a.message,"sh:focusNode":a.focusNode,"sh:resultPath":a.propertyPath,"sh:resultSeverity":{"@id":`sh:${a.severity.replace("sh:","")}`},...a.actualValue!==void 0?{"sh:value":a.actualValue}:{}}});return{"@context":i,"@graph":s}}o(xK,"buildEARLReport");async function CK(n,e){let r=(await At.ShapeLoader.loadFromVaultFS(n)).getAll(),i=new At.ShaclShapeRegistry(r),s=new NE(e),a=AK(e);return(0,At.shaclValidate)(a,i,s)}o(CK,"runShapesValidation");async function IK(n){let e=n.format||"text";try{let t=(0,so.resolve)(n.vault);if(!(0,ma.existsSync)(t))throw new Ee(t);e==="text"&&console.log(`\u{1F4E6} Loading vault (shapes-mode): ${t}...`);let r;if(n.useCache){let a=await new Bn(t).loadOrBuild();r=a.triples,e==="text"&&a.cacheHit&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let s=new Nt(t);r=await new At.NoteToRDFConverter(s).convertVault()}e==="text"&&(console.log(`\u2705 Loaded ${r.length} triples`),console.log("\u{1F50D} Running SHACL-lite validation..."));let i=await CK(t,r);if(e==="earl"){let s=xK(t,i);console.log(JSON.stringify(s,null,2))}else if(e==="json"){let s=X.success({vaultPath:t,conforms:i.conforms,violationCount:i.violations.length,violations:i.violations});console.log(JSON.stringify(s,null,2))}else if(i.conforms)console.log(`\u2705 Vault conforms to all shapes (${i.violations.length===0?"no violations":`${i.violations.length} warning(s)`}).`);else{let s=new Map;for(let a of i.violations){let c=s.get(a.focusNode)??[];c.push(a),s.set(a.focusNode,c)}console.log(`\u26A0\uFE0F Found ${i.violations.length} SHACL violation(s) in ${s.size} node(s):
663
- `);for(let[a,c]of s){console.log(` \u274C ${a}`);for(let l of c){let u=l.severity.replace("sh:","");console.log(` [${u}] ${l.message}`)}}}i.conforms||(process.exitCode=1)}catch(t){D.handle(t)}}o(IK,"runShapesModeAction");function vD(){return new Te("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)").option("--shapes-mode","Run SHACL-lite shapes validation instead of schema linting").option("--format <type>","Output format for shapes-mode: text|json|earl","text").action(async n=>{let e=n.output||"text";if(D.setFormat(e),n.shapesMode){await IK(n);return}try{let t=(0,so.resolve)(n.vault);if(!(0,ma.existsSync)(t))throw new Ee(t);let r;if(n.staged){if(r=SK(t),r.length===0){if(e==="json"){let l=X.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=vK(t);e==="text"&&console.log(`\u{1F4E6} Loading vault: ${t}...`);let i;if(n.useCache){let u=await new Bn(t).loadOrBuild();i=u.triples,e==="text"&&u.cacheHit&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let l=new Nt(t);i=await new At.NoteToRDFConverter(l).convertVault()}e==="text"&&(console.log(`\u2705 Loaded ${i.length} triples`),console.log("\u{1F50D} Querying ontology for declared properties..."));let s=await wK(i);e==="text"&&(console.log(`\u{1F4CB} Found ${s.size} declared properties in ontology`),console.log(`\u{1F50D} Validating ${r.length} file(s)...
664
- `));let a=[];for(let l of r){let u=(0,so.resolve)(t,l),f=EK(u,l,s);a.push(...f)}let c={vaultPath:t,filesChecked:r.length,violations:a,healthy:a.length===0};if(e==="json"){let l=X.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
+ }`),i=t.parse(r),a=new At.ExoQLAlgebraTranslator().translate(i);a=new At.AlgebraOptimizer().optimize(a);let u=await new At.ExoQLQueryExecutor(e).executeAll(a),f=new Set;for(let d of u){let h=d.toJSON(),p=h.s;if(typeof p=="string"){let v=bK(p);if(v){let E=SD(v);E&&f.add(E)}}let y=h.label;typeof y=="string"&&y.startsWith("https://exocortex.my/ontology/")&&f.add(y)}return f}o(wK,"loadDeclaredProperties");function EK(n,e,t){let r=[],i;try{i=(0,ma.readFileSync)(n,"utf-8")}catch{return[]}let s=yK(i);if(!s)return[];let a=Object.keys(s),{toValidate:c,unknownPrefix:l}=_K(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=SD(u);f&&!t.has(f)&&r.push({file:e,property:u,reason:`Property "${u}" is not declared in the ontology`})}return r}o(EK,"validateFile");var TK="http://www.w3.org/2000/01/rdf-schema#subClassOf";function AK(n){let e=o(r=>{if(r instanceof At.DomainIRI)return{type:"iri",value:r.value};if(r instanceof At.DomainLiteral){let i={type:"literal",value:r.value};return r.datatype&&(i.datatype=r.datatype.value),r.language&&(i.language=r.language),i}return null},"mapNode"),t=[];for(let r of n){let i=e(r.subject),s=e(r.predicate),a=e(r.object);i&&s&&a&&t.push({subject:i,predicate:s,object:a})}return t}o(AK,"domainToAlgebraTriples");var NE=class{constructor(e){this.subClassMap=new Map;for(let t of e)if(t.predicate instanceof At.DomainIRI&&t.predicate.value===TK&&t.subject instanceof At.DomainIRI&&t.object instanceof At.DomainIRI){let r=this.subClassMap.get(t.subject.value)??new Set;r.add(t.object.value),this.subClassMap.set(t.subject.value,r)}}static{o(this,"TripleClassHierarchy")}isSubClassOf(e,t){let r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===t)return!0;if(r.has(s))continue;r.add(s);let a=this.subClassMap.get(s);if(a)for(let c of a)i.push(c)}return!1}};function xK(n,e){let t=`file://${n}`,r="https://exocortex.my/cli/shacl-validator",i={earl:"http://www.w3.org/ns/earl#",dc:"http://purl.org/dc/terms/",xsd:"http://www.w3.org/2001/XMLSchema#",sh:"http://www.w3.org/ns/shacl#"},s=[{"@type":"earl:Assertor","@id":r,"dc:title":"Exocortex CLI SHACL-lite Validator"},{"@type":"earl:TestSubject","@id":t,"dc:title":n}];if(e.violations.length===0)s.push({"@type":"earl:Assertion","earl:assertedBy":{"@id":r},"earl:subject":{"@id":t},"earl:result":{"@type":"earl:TestResult","earl:outcome":{"@id":"earl:passed"},"dc:description":"All nodes conform to shapes"}});else for(let a of e.violations)s.push({"@type":"earl:Assertion","earl:assertedBy":{"@id":r},"earl:subject":{"@id":t},"earl:test":{"@id":a.propertyPath},"earl:result":{"@type":"earl:TestResult","earl:outcome":{"@id":"earl:failed"},"dc:description":a.message,"sh:focusNode":a.focusNode,"sh:resultPath":a.propertyPath,"sh:resultSeverity":{"@id":`sh:${a.severity.replace("sh:","")}`},...a.actualValue!==void 0?{"sh:value":a.actualValue}:{}}});return{"@context":i,"@graph":s}}o(xK,"buildEARLReport");async function CK(n,e){let r=(await At.ShapeLoader.loadFromVaultFS(n)).getAll(),i=new At.ShaclShapeRegistry(r),s=new NE(e),a=AK(e);return(0,At.shaclValidate)(a,i,s)}o(CK,"runShapesValidation");async function IK(n){let e=n.format||"text";try{let t=(0,ao.resolve)(n.vault);if(!(0,ma.existsSync)(t))throw new Ee(t);e==="text"&&console.log(`\u{1F4E6} Loading vault (shapes-mode): ${t}...`);let r;if(n.useCache){let a=await new Bn(t).loadOrBuild();r=a.triples,e==="text"&&a.cacheHit&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let s=new Nt(t);r=await new At.NoteToRDFConverter(s).convertVault()}e==="text"&&(console.log(`\u2705 Loaded ${r.length} triples`),console.log("\u{1F50D} Running SHACL-lite validation..."));let i=await CK(t,r);if(e==="earl"){let s=xK(t,i);console.log(JSON.stringify(s,null,2))}else if(e==="json"){let s=X.success({vaultPath:t,conforms:i.conforms,violationCount:i.violations.length,violations:i.violations});console.log(JSON.stringify(s,null,2))}else if(i.conforms)console.log(`\u2705 Vault conforms to all shapes (${i.violations.length===0?"no violations":`${i.violations.length} warning(s)`}).`);else{let s=new Map;for(let a of i.violations){let c=s.get(a.focusNode)??[];c.push(a),s.set(a.focusNode,c)}console.log(`\u26A0\uFE0F Found ${i.violations.length} SHACL violation(s) in ${s.size} node(s):
663
+ `);for(let[a,c]of s){console.log(` \u274C ${a}`);for(let l of c){let u=l.severity.replace("sh:","");console.log(` [${u}] ${l.message}`)}}}i.conforms||(process.exitCode=1)}catch(t){D.handle(t)}}o(IK,"runShapesModeAction");function vD(){return new Te("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)").option("--shapes-mode","Run SHACL-lite shapes validation instead of schema linting").option("--format <type>","Output format for shapes-mode: text|json|earl","text").action(async n=>{let e=n.output||"text";if(D.setFormat(e),n.shapesMode){await IK(n);return}try{let t=(0,ao.resolve)(n.vault);if(!(0,ma.existsSync)(t))throw new Ee(t);let r;if(n.staged){if(r=SK(t),r.length===0){if(e==="json"){let l=X.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=vK(t);e==="text"&&console.log(`\u{1F4E6} Loading vault: ${t}...`);let i;if(n.useCache){let u=await new Bn(t).loadOrBuild();i=u.triples,e==="text"&&u.cacheHit&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let l=new Nt(t);i=await new At.NoteToRDFConverter(l).convertVault()}e==="text"&&(console.log(`\u2705 Loaded ${i.length} triples`),console.log("\u{1F50D} Querying ontology for declared properties..."));let s=await wK(i);e==="text"&&(console.log(`\u{1F4CB} Found ${s.size} declared properties in ontology`),console.log(`\u{1F50D} Validating ${r.length} file(s)...
664
+ `));let a=[];for(let l of r){let u=(0,ao.resolve)(t,l),f=EK(u,l,s);a.push(...f)}let c={vaultPath:t,filesChecked:r.length,violations:a,healthy:a.length===0};if(e==="json"){let l=X.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):
665
665
  `);for(let[u,f]of l){console.log(` \u274C ${u}`);for(let d of f)console.log(` \u2022 ${d.reason}`)}console.log(`
666
666
  \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(vD,"validateSchemaCommand");var bD=require("fs"),wD=require("path"),ED=require("child_process"),TD=Y(Dt());var RK={exo__Asset_uid:"add `exo__Asset_uid: <uuid>` to frontmatter",exo__Asset_isDefinedBy:'add `exo__Asset_isDefinedBy: "[[!kitelev]]"` (or your own ontology marker) to frontmatter',exo__Asset_label:'add `exo__Asset_label: "<short label>"` to frontmatter',exo__Instance_class:'add `exo__Instance_class: ["[[<ClassName>]]"]` to frontmatter'};function PK(n,e){switch(e.code){case"MISSING_PROPERTY":return{file:n,code:e.code,property:e.property,reason:e.message,hint:RK[e.property]??`add \`${e.property}: <value>\` to frontmatter`};case"EMPTY_PROPERTY":return{file:n,code:e.code,property:e.property,reason:e.message,hint:`set a non-empty value for \`${e.property}\` (or remove the asset markers if this file is not an Exocortex asset)`};case"EMPTY_OPTIONAL_PROPERTY":return{file:n,code:e.code,property:e.property,reason:e.message,hint:`remove \`${e.property}\` from frontmatter or fill it with a non-empty value`};case"INVALID_INSTANCE_CLASS_IRI":return{file:n,code:e.code,property:e.property,reason:e.message,hint:`fix the \`${e.property}\` wikilink target \u2014 namespaced classes (e.g. \`ems__\`, \`exo__\`) cannot contain whitespace or parentheses, otherwise they expand into invalid IRIs`}}}o(PK,"violationToError");function OK(n){try{return(0,ED.execSync)("git diff --cached --name-only",{cwd:n,encoding:"utf-8"}).split(`
667
667
  `).filter(t=>t.endsWith(".md")&&t.trim().length>0)}catch{return[]}}o(OK,"getStagedMdFiles");function AD(){return new Te("frontmatter").description("Check vault frontmatter for missing/empty properties and malformed IRIs (Issue #2997 Phase 4)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--staged","Only validate git-staged .md files (for pre-commit hooks)").action(async n=>{let e=n.output||"text";D.setFormat(e);try{let t=(0,wD.resolve)(n.vault);if(!(0,bD.existsSync)(t))throw new Ee(t);let r=new Nt(t),i=new TD.NoteToRDFConverter(r),s=r.getAllFiles();if(n.staged){let l=new Set(OK(t));s=s.filter(u=>l.has(u.path))}let a=[];for(let l of s){let u=r.getFrontmatter(l);if(u){let f=i.validateExocortexAsset(u);f&&a.push(PK(l.path,f))}try{i.notePathToIRI(l.path)}catch(f){let d=f instanceof Error?f.message:String(f);a.push({file:l.path,code:"INVALID_PATH_IRI",reason:`Invalid IRI format for vault path: ${d}`,hint:`rename the file \u2014 its path \`${l.path}\` cannot be encoded into a valid \`obsidian://vault/...\` IRI (avoid raw whitespace, control characters, and angle brackets)`})}}let c={vaultPath:t,filesChecked:s.length,errors:a,healthy:a.length===0};if(e==="json")console.log(JSON.stringify(X.success(c),null,2));else if(a.length===0)console.log(`\u2705 All ${s.length} file(s) pass frontmatter validation.`);else{console.log(`\u26A0\uFE0F Found ${a.length} frontmatter error(s) in ${new Set(a.map(l=>l.file)).size} file(s):
@@ -741,7 +741,7 @@ ${$r.dump(i,{lineWidth:-1})}---
741
741
  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(`
742
742
  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,hu.resolve)(t.vault);if(!(0,ya.existsSync)(i))throw new Ee(i);let s=BD(i,e);if(!s){if(r==="json"){let l=X.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 Xi.WorkflowEngine(s).validate();if(r==="json"){let l=X.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):
743
743
  `);for(let l of c.errors)console.log(` \u2022 ${l}`);process.exitCode=1}}catch(i){D.handle(i)}}),n}o(UD,"workflowCommand");var qD=new Xi.FrontmatterService;function WD(n){let e=[],t=[];GD(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??qK(r),u=ga(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 y=p.exo__Instance_class;if(!ga(p.ems__WorkflowState_workflow??p.ems__WorkflowTransition_workflow??"").includes(c))continue;let b=Array.isArray(y)?y.some(I=>I.includes("ems__WorkflowState")):typeof y=="string"&&y.includes("ems__WorkflowState"),A=Array.isArray(y)?y.some(I=>I.includes("ems__WorkflowTransition")):typeof y=="string"&&y.includes("ems__WorkflowTransition");b&&d++,A&&h++}e.push({filePath:r,uid:c,label:l,targetClass:u,isDefault:f,stateCount:d,transitionCount:h})}return e}o(WD,"scanWorkflows");function GD(n,e){let t;try{t=(0,ya.readdirSync)(n,{withFileTypes:!0})}catch{return}for(let r of t){let i=(0,hu.join)(n,r.name);if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;GD(i,e)}else if(r.name.endsWith(".md"))try{let s=(0,ya.readFileSync)(i,"utf-8"),a=qD.parse(s);a.exists&&e.push({filePath:i,fm:zD(a.content)})}catch{}}}o(GD,"collectParsedFiles");function BD(n,e){let r=WD(n).find(i=>i.uid===e);if(!r)return null;try{let i=(0,ya.readFileSync)(r.filePath,"utf-8"),s=qD.parse(i);if(!s.exists)return null;let a=zD(s.content),c=ga(a.ems__Workflow_targetClass??"ems__Task"),l=ga(a.ems__Workflow_initialState??"ems__EffortStatusDraft"),u=du(l)??Xi.EffortStatus.DRAFT,d=(Array.isArray(a.ems__Workflow_terminalStates)?a.ems__Workflow_terminalStates.map(b=>ga(b)):[]).map(du).filter(b=>b!==null),h=a.ems__Workflow_isDefault===!0||a.ems__Workflow_isDefault==="true",y=(Array.isArray(a.ems__Workflow_states)?a.ems__Workflow_states:[]).map((b,A)=>typeof b=="string"?{status:du(ga(b))??Xi.EffortStatus.DRAFT,order:A+1,optional:!1,timestampOnEnter:[]}:{status:du(ga(b.status??""))??Xi.EffortStatus.DRAFT,order:b.order??A+1,optional:b.optional===!0||b.optional==="true",timestampOnEnter:Array.isArray(b.timestampOnEnter)?b.timestampOnEnter:[],badgeColor:b.badgeColor}),E=(Array.isArray(a.ems__Workflow_transitions)?a.ems__Workflow_transitions:[]).map(b=>{let A=du(ga(b.from??"")),I=du(ga(b.to??""));return!A||!I?null:{from:A,to:I,label:b.label??`${A} \u2192 ${I}`,icon:b.icon,isRollback:b.isRollback===!0||b.isRollback==="true"}}).filter(b=>b!==null);return{id:e,name:r.label,targetClass:c,states:y,transitions:E,initialState:u,terminalStates:d.length>0?d:[Xi.EffortStatus.DONE,Xi.EffortStatus.TRASHED],isDefault:h}}catch{return null}}o(BD,"loadWorkflowByUid");function zD(n){let e={},t=n.split(`
744
- `),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(zD,"parseYamlFrontmatter");function ga(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(ga,"normalizeWikilink");function qK(n){let e=n.split("/");return e[e.length-1].replace(/\.md$/,"")}o(qK,"extractLabelFromFilename");function du(n){return Object.values(Xi.EffortStatus).includes(n)?n:null}o(du,"resolveEffortStatus");var Rs=require("fs"),Ps=require("path"),Fe=Y(Dt());var XD=Y(Dt()),zt=Y(QD());var YD="obsidian://vault/";function tX(n){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return{async resolveTargetPath(t){if(!t)throw new Error("Cannot resolve empty targetIRI to a vault path");let r=t;if(r.startsWith(YD))r=decodeURI(r.slice(YD.length));else if(e.test(r)){let i=await n.findFileByUID(r);if(!i)throw new Error(`No vault file found for UID: ${r}`);r=i}if(r.endsWith(".md")||(r=`${r}.md`),!await n.fileExists(r))throw new Error(`Cannot resolve target file for IRI "${t}" (tried "${r}")`);return r}}}o(tX,"createCliPathResolver");var rX=["createAsset","openFile","sparqlSelect","getActiveFileIRI","getActiveFilePath","trashFile","duplicateFile"],GE=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 KD(n){return{async execute(){throw new GE(n)}}}o(KD,"notImplementedService");function JD(n,e){for(let t of rX)n.register(t,KD(t));for(let t of["updateProperty","removeProperty","setStatus"])n.register(t,KD(t));if(e){if(e.fsAdapter){let t=new XD.FrontmatterService,r=tX(e.fsAdapter);n.register("updateProperty",(0,zt.createUpdatePropertyService)(e.fsAdapter,t,r)),n.register("removeProperty",(0,zt.createRemovePropertyService)(e.fsAdapter,t,r)),n.register("setStatus",(0,zt.createSetStatusService)(e.fsAdapter,t,r))}n.register("createRelatedTask",(0,zt.createCreateRelatedTaskService)(e.vaultAdapter,e.genericAssetCreationService)),n.register("createRelatedProject",(0,zt.createCreateRelatedProjectService)(e.vaultAdapter,e.genericAssetCreationService)),n.register("archiveAsset",(0,zt.createArchiveAssetService)(e.vaultAdapter,e.archiveAssetService)),n.register("planForEvening",(0,zt.createPlanForEveningService)(e.vaultAdapter,e.taskStatusService)),n.register("cleanProperties",(0,zt.createCleanPropertiesService)(e.vaultAdapter,e.propertyCleanupService)),n.register("renameToUid",(0,zt.createRenameToUidService)(e.vaultAdapter,e.renameToUidService)),n.register("repairFolder",(0,zt.createRepairFolderService)(e.vaultAdapter,e.folderRepairService)),n.register("fixMissingLabel",(0,zt.createFixMissingLabelService)(e.vaultAdapter,e.fixMissingLabelService))}}o(JD,"populateCliServiceRegistry");var nX=new Fe.FrontmatterService;function ZD(){let n=new Te("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,Ps.resolve)(e.vault);if(!(0,Rs.existsSync)(r))throw new Ee(r);let i;if(e.target?i=await sX(r,e.target):i=iX(r),t==="json"){let s=X.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(`
744
+ `),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(zD,"parseYamlFrontmatter");function ga(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(ga,"normalizeWikilink");function qK(n){let e=n.split("/");return e[e.length-1].replace(/\.md$/,"")}o(qK,"extractLabelFromFilename");function du(n){return Object.values(Xi.EffortStatus).includes(n)?n:null}o(du,"resolveEffortStatus");var Rs=require("fs"),Ps=require("path"),Fe=Y(Dt());var XD=Y(Dt()),Ht=Y(QD());var YD="obsidian://vault/";function tX(n){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return{async resolveTargetPath(t){if(!t)throw new Error("Cannot resolve empty targetIRI to a vault path");let r=t;if(r.startsWith(YD))r=decodeURI(r.slice(YD.length));else if(e.test(r)){let i=await n.findFileByUID(r);if(!i)throw new Error(`No vault file found for UID: ${r}`);r=i}if(r.endsWith(".md")||(r=`${r}.md`),!await n.fileExists(r))throw new Error(`Cannot resolve target file for IRI "${t}" (tried "${r}")`);return r}}}o(tX,"createCliPathResolver");var rX=["createAsset","openFile","sparqlSelect","getActiveFileIRI","getActiveFilePath","trashFile","duplicateFile"],GE=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 KD(n){return{async execute(){throw new GE(n)}}}o(KD,"notImplementedService");function JD(n,e){for(let t of rX)n.register(t,KD(t));for(let t of["updateProperty","removeProperty","setStatus"])n.register(t,KD(t));if(e){if(e.fsAdapter){let t=new XD.FrontmatterService,r=tX(e.fsAdapter);n.register("updateProperty",(0,Ht.createUpdatePropertyService)(e.fsAdapter,t,r)),n.register("removeProperty",(0,Ht.createRemovePropertyService)(e.fsAdapter,t,r)),n.register("setStatus",(0,Ht.createSetStatusService)(e.fsAdapter,t,r))}n.register("createRelatedTask",(0,Ht.createCreateRelatedTaskService)(e.vaultAdapter,e.genericAssetCreationService)),n.register("createRelatedProject",(0,Ht.createCreateRelatedProjectService)(e.vaultAdapter,e.genericAssetCreationService)),n.register("archiveAsset",(0,Ht.createArchiveAssetService)(e.vaultAdapter,e.archiveAssetService)),n.register("planForEvening",(0,Ht.createPlanForEveningService)(e.vaultAdapter,e.taskStatusService)),n.register("cleanProperties",(0,Ht.createCleanPropertiesService)(e.vaultAdapter,e.propertyCleanupService)),n.register("renameToUid",(0,Ht.createRenameToUidService)(e.vaultAdapter,e.renameToUidService)),n.register("repairFolder",(0,Ht.createRepairFolderService)(e.vaultAdapter,e.folderRepairService)),n.register("fixMissingLabel",(0,Ht.createFixMissingLabelService)(e.vaultAdapter,e.fixMissingLabelService))}}o(JD,"populateCliServiceRegistry");var nX=new Fe.FrontmatterService;function ZD(){let n=new Te("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,Ps.resolve)(e.vault);if(!(0,Rs.existsSync)(r))throw new Ee(r);let i;if(e.target?i=await sX(r,e.target):i=iX(r),t==="json"){let s=X.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(`
745
745
  \u{1F4CB} Found ${i.length} dynamic command(s)${s}:
746
746
  `);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,Ps.resolve)(t.vault);if(!(0,Rs.existsSync)(i))throw new Ee(i);let{tripleStore:s}=await HE(i),a=new Fe.CommandResolver(s),c=await a.loadCommand(e);if(!c){if(r==="json"){let f=X.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=X.success({command:c,bindings:u});console.log(JSON.stringify(f,null,2))}else if(console.log(`
747
747
  \u{1F4CB} Command: ${c.name}
@@ -797,7 +797,7 @@ exo__BacklinksTableBlock_columns:${f==="[]"?" []":f}
797
797
  --- END PREVIEW ---
798
798
  `)}o(_X,"printDryRunReport");function SX(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 ---
799
799
  `),r.join(`
800
- `)}o(SX,"formatSummary");function vX(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(vX,"summariseResult");var gu=Y(Dt());function bX(){return new Te("start").description("Start the ValidatorDaemon process (long-running, Unix socket)").option("--socket <path>","Unix socket path",gu.DEFAULT_SOCKET_PATH).option("--idle-timeout <seconds>","Exit after N seconds of inactivity",String(Math.floor(gu.IDLE_TIMEOUT_MS/1e3))).action(async n=>{let e=n.socket,t=Number(n.idleTimeout)*1e3;await new gu.ValidatorDaemon(e,t).start()})}o(bX,"daemonStartCommand");function fN(){let n=new Te("daemon").description("Manage the ValidatorDaemon background process");return n.addCommand(bX()),n}o(fN,"daemonCommand");function dN(n){n.addCommand(VO()),n.addCommand(WO()),n.addCommand(GO())}o(dN,"addQuerySubcommands");function hN(n){let e=new Te;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.159.1");let t=e.command("exoql").description("ExoQL query execution and cache management");dN(t);let r=e.command("sparql").description("(deprecated) Use 'exoql' instead");return dN(r),r.hook("preAction",()=>{console.error('\u26A0\uFE0F "sparql" is deprecated. Use "exoql" instead.')}),e.addCommand(ZF()),e.addCommand(rD()),e.addCommand(nD()),e.addCommand(sD()),e.addCommand(aD()),e.addCommand(fD()),e.addCommand(mD()),e.addCommand(ID()),e.addCommand(OD()),e.addCommand(kD()),e.addCommand($D()),e.addCommand(VD()),e.addCommand(UD()),e.addCommand(ZD()),e.addCommand(nN()),e.addCommand(uN()),e.addCommand(fN()),e}o(hN,"createProgram");hN().parse();0&&(module.exports={createProgram});
800
+ `)}o(SX,"formatSummary");function vX(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(vX,"summariseResult");var gu=Y(Dt());function bX(){return new Te("start").description("Start the ValidatorDaemon process (long-running, Unix socket)").option("--socket <path>","Unix socket path",gu.DEFAULT_SOCKET_PATH).option("--idle-timeout <seconds>","Exit after N seconds of inactivity",String(Math.floor(gu.IDLE_TIMEOUT_MS/1e3))).action(async n=>{let e=n.socket,t=Number(n.idleTimeout)*1e3;await new gu.ValidatorDaemon(e,t).start()})}o(bX,"daemonStartCommand");function fN(){let n=new Te("daemon").description("Manage the ValidatorDaemon background process");return n.addCommand(bX()),n}o(fN,"daemonCommand");function dN(n){n.addCommand(VO()),n.addCommand(WO()),n.addCommand(GO())}o(dN,"addQuerySubcommands");function hN(n){let e=new Te;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.160.1");let t=e.command("exoql").description("ExoQL query execution and cache management");dN(t);let r=e.command("sparql").description("(deprecated) Use 'exoql' instead");return dN(r),r.hook("preAction",()=>{console.error('\u26A0\uFE0F "sparql" is deprecated. Use "exoql" instead.')}),e.addCommand(ZF()),e.addCommand(rD()),e.addCommand(nD()),e.addCommand(sD()),e.addCommand(aD()),e.addCommand(fD()),e.addCommand(mD()),e.addCommand(ID()),e.addCommand(OD()),e.addCommand(kD()),e.addCommand($D()),e.addCommand(VD()),e.addCommand(UD()),e.addCommand(ZD()),e.addCommand(nN()),e.addCommand(uN()),e.addCommand(fN()),e}o(hN,"createProgram");hN().parse();0&&(module.exports={createProgram});
801
801
  /*! Bundled license information:
802
802
 
803
803
  reflect-metadata/Reflect.js: