@kitelev/exocortex-cli 15.45.0 → 15.45.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +47 -47
- 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.45.
|
|
2
|
+
// @kitelev/exocortex-cli v15.45.2
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
6
|
-
"use strict";var WI=Object.create;var Uc=Object.defineProperty;var GI=Object.getOwnPropertyDescriptor;var HI=Object.getOwnPropertyNames;var zI=Object.getPrototypeOf,QI=Object.prototype.hasOwnProperty;var o=(n,e)=>Uc(n,"name",{value:e,configurable:!0});var YI=(n,e)=>()=>(n&&(e=n(n=0)),e);var _=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),O_=(n,e)=>{for(var t in e)Uc(n,t,{get:e[t],enumerable:!0})},R_=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of HI(e))!QI.call(n,i)&&i!==t&&Uc(n,i,{get:()=>e[i],enumerable:!(r=GI(e,i))||r.enumerable});return n};var X=(n,e,t)=>(t=n!=null?WI(zI(n)):{},R_(e||!n||!n.__esModule?Uc(t,"default",{value:n,enumerable:!0}):t,n)),rm=n=>R_(Uc({},"__esModule",{value:!0}),n);var Vu=_(()=>{var P_;(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,h){Object.defineProperty(l,f,{configurable:!0,writable:!0,value:h}),u&&u(f,h)}}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 Pe(Object.create(null))}:l?function(){return Pe({__proto__:null})}:function(){return Pe({})},has:u?function(b,E){return r.call(b,E)}:function(b,E){return E in b},get:u?function(b,E){return r.call(b,E)?b[E]:void 0}:function(b,E){return b[E]}},h=Object.getPrototypeOf(Function),d=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:_e(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ye(),y=typeof WeakMap=="function"?WeakMap:Ve(),w=i?Symbol.for("@reflect-metadata:registry"):void 0,T=ge(),S=ye(T);function A(b,E,x,R){if(W(x)){if(!De(b))throw new TypeError;if(!Ne(E))throw new TypeError;return qe(b,E)}else{if(!De(b))throw new TypeError;if(!ee(E))throw new TypeError;if(!ee(R)&&!W(R)&&!xe(R))throw new TypeError;return xe(R)&&(R=void 0),x=we(x),et(b,E,x,R)}}o(A,"decorate"),e("decorate",A);function F(b,E){function x(R,Y){if(!ee(R))throw new TypeError;if(!W(Y)&&!$e(Y))throw new TypeError;re(b,E,R,Y)}return o(x,"decorator"),x}o(F,"metadata"),e("metadata",F);function Q(b,E,x,R){if(!ee(x))throw new TypeError;return W(R)||(R=we(R)),re(b,E,x,R)}o(Q,"defineMetadata"),e("defineMetadata",Q);function K(b,E,x){if(!ee(E))throw new TypeError;return W(x)||(x=we(x)),wt(b,E,x)}o(K,"hasMetadata"),e("hasMetadata",K);function Te(b,E,x){if(!ee(E))throw new TypeError;return W(x)||(x=we(x)),tt(b,E,x)}o(Te,"hasOwnMetadata"),e("hasOwnMetadata",Te);function H(b,E,x){if(!ee(E))throw new TypeError;return W(x)||(x=we(x)),nt(b,E,x)}o(H,"getMetadata"),e("getMetadata",H);function J(b,E,x){if(!ee(E))throw new TypeError;return W(x)||(x=we(x)),We(b,E,x)}o(J,"getOwnMetadata"),e("getOwnMetadata",J);function L(b,E){if(!ee(b))throw new TypeError;return W(E)||(E=we(E)),U(b,E)}o(L,"getMetadataKeys"),e("getMetadataKeys",L);function $(b,E){if(!ee(b))throw new TypeError;return W(E)||(E=we(E)),it(b,E)}o($,"getOwnMetadataKeys"),e("getOwnMetadataKeys",$);function Z(b,E,x){if(!ee(E))throw new TypeError;if(W(x)||(x=we(x)),!ee(E))throw new TypeError;W(x)||(x=we(x));var R=ie(E,x,!1);return W(R)?!1:R.OrdinaryDeleteMetadata(b,E,x)}o(Z,"deleteMetadata"),e("deleteMetadata",Z);function qe(b,E){for(var x=b.length-1;x>=0;--x){var R=b[x],Y=R(E);if(!W(Y)&&!xe(Y)){if(!Ne(Y))throw new TypeError;E=Y}}return E}o(qe,"DecorateConstructor");function et(b,E,x,R){for(var Y=b.length-1;Y>=0;--Y){var ut=b[Y],vt=ut(E,x,R);if(!W(vt)&&!xe(vt)){if(!ee(vt))throw new TypeError;R=vt}}return R}o(et,"DecorateProperty");function wt(b,E,x){var R=tt(b,E,x);if(R)return!0;var Y=oe(E);return xe(Y)?!1:wt(b,Y,x)}o(wt,"OrdinaryHasMetadata");function tt(b,E,x){var R=ie(E,x,!1);return W(R)?!1:Fe(R.OrdinaryHasOwnMetadata(b,E,x))}o(tt,"OrdinaryHasOwnMetadata");function nt(b,E,x){var R=tt(b,E,x);if(R)return We(b,E,x);var Y=oe(E);if(!xe(Y))return nt(b,Y,x)}o(nt,"OrdinaryGetMetadata");function We(b,E,x){var R=ie(E,x,!1);if(!W(R))return R.OrdinaryGetOwnMetadata(b,E,x)}o(We,"OrdinaryGetOwnMetadata");function re(b,E,x,R){var Y=ie(x,R,!0);Y.OrdinaryDefineOwnMetadata(b,E,x,R)}o(re,"OrdinaryDefineOwnMetadata");function U(b,E){var x=it(b,E),R=oe(b);if(R===null)return x;var Y=U(R,E);if(Y.length<=0)return x;if(x.length<=0)return Y;for(var ut=new p,vt=[],Ie=0,B=x;Ie<B.length;Ie++){var q=B[Ie],G=ut.has(q);G||(ut.add(q),vt.push(q))}for(var z=0,Ee=Y;z<Ee.length;z++){var q=Ee[z],G=ut.has(q);G||(ut.add(q),vt.push(q))}return vt}o(U,"OrdinaryMetadataKeys");function it(b,E){var x=ie(b,E,!1);return x?x.OrdinaryOwnMetadataKeys(b,E):[]}o(it,"OrdinaryOwnMetadataKeys");function ct(b){if(b===null)return 1;switch(typeof b){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return b===null?1:6;default:return 6}}o(ct,"Type");function W(b){return b===void 0}o(W,"IsUndefined");function xe(b){return b===null}o(xe,"IsNull");function ke(b){return typeof b=="symbol"}o(ke,"IsSymbol");function ee(b){return typeof b=="object"?b!==null:typeof b=="function"}o(ee,"IsObject");function Le(b,E){switch(ct(b)){case 0:return b;case 1:return b;case 2:return b;case 3:return b;case 4:return b;case 5:return b}var x=E===3?"string":E===5?"number":"default",R=de(b,s);if(R!==void 0){var Y=R.call(b,x);if(ee(Y))throw new TypeError;return Y}return Me(b,x==="default"?"number":x)}o(Le,"ToPrimitive");function Me(b,E){if(E==="string"){var x=b.toString;if(Ae(x)){var R=x.call(b);if(!ee(R))return R}var Y=b.valueOf;if(Ae(Y)){var R=Y.call(b);if(!ee(R))return R}}else{var Y=b.valueOf;if(Ae(Y)){var R=Y.call(b);if(!ee(R))return R}var ut=b.toString;if(Ae(ut)){var R=ut.call(b);if(!ee(R))return R}}throw new TypeError}o(Me,"OrdinaryToPrimitive");function Fe(b){return!!b}o(Fe,"ToBoolean");function je(b){return""+b}o(je,"ToString");function we(b){var E=Le(b,3);return ke(E)?E:je(E)}o(we,"ToPropertyKey");function De(b){return Array.isArray?Array.isArray(b):b instanceof Object?b instanceof Array:Object.prototype.toString.call(b)==="[object Array]"}o(De,"IsArray");function Ae(b){return typeof b=="function"}o(Ae,"IsCallable");function Ne(b){return typeof b=="function"}o(Ne,"IsConstructor");function $e(b){switch(ct(b)){case 3:return!0;case 4:return!0;default:return!1}}o($e,"IsPropertyKey");function le(b,E){return b===E||b!==b&&E!==E}o(le,"SameValueZero");function de(b,E){var x=b[E];if(x!=null){if(!Ae(x))throw new TypeError;return x}}o(de,"GetMethod");function pe(b){var E=de(b,a);if(!Ae(E))throw new TypeError;var x=E.call(b);if(!ee(x))throw new TypeError;return x}o(pe,"GetIterator");function ue(b){return b.value}o(ue,"IteratorValue");function fe(b){var E=b.next();return E.done?!1:E}o(fe,"IteratorStep");function he(b){var E=b.return;E&&E.call(b)}o(he,"IteratorClose");function oe(b){var E=Object.getPrototypeOf(b);if(typeof b!="function"||b===h||E!==h)return E;var x=b.prototype,R=x&&Object.getPrototypeOf(x);if(R==null||R===Object.prototype)return E;var Y=R.constructor;return typeof Y!="function"||Y===b?E:Y}o(oe,"OrdinaryGetPrototypeOf");function me(){var b;!W(w)&&typeof t.Reflect<"u"&&!(w in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(b=ve(t.Reflect));var E,x,R,Y=new y,ut={registerProvider:vt,getProvider:B,setProvider:G};return ut;function vt(z){if(!Object.isExtensible(ut))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case b===z:break;case W(E):E=z;break;case E===z:break;case W(x):x=z;break;case x===z:break;default:R===void 0&&(R=new p),R.add(z);break}}function Ie(z,Ee){if(!W(E)){if(E.isProviderFor(z,Ee))return E;if(!W(x)){if(x.isProviderFor(z,Ee))return E;if(!W(R))for(var Ke=pe(R);;){var Xe=fe(Ke);if(!Xe)return;var rr=ue(Xe);if(rr.isProviderFor(z,Ee))return he(Ke),rr}}}if(!W(b)&&b.isProviderFor(z,Ee))return b}function B(z,Ee){var Ke=Y.get(z),Xe;return W(Ke)||(Xe=Ke.get(Ee)),W(Xe)&&(Xe=Ie(z,Ee),W(Xe)||(W(Ke)&&(Ke=new d,Y.set(z,Ke)),Ke.set(Ee,Xe))),Xe}function q(z){if(W(z))throw new TypeError;return E===z||x===z||!W(R)&&R.has(z)}function G(z,Ee,Ke){if(!q(Ke))throw new Error("Metadata provider not registered.");var Xe=B(z,Ee);if(Xe!==Ke){if(!W(Xe))return!1;var rr=Y.get(z);W(rr)&&(rr=new d,Y.set(z,rr)),rr.set(Ee,Ke)}return!0}}o(me,"CreateMetadataRegistry");function ge(){var b;return!W(w)&&ee(t.Reflect)&&Object.isExtensible(t.Reflect)&&(b=t.Reflect[w]),W(b)&&(b=me()),!W(w)&&ee(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,w,{enumerable:!1,configurable:!1,writable:!1,value:b}),b}o(ge,"GetOrCreateMetadataRegistry");function ye(b){var E=new y,x={isProviderFor:o(function(q,G){var z=E.get(q);return W(z)?!1:z.has(G)},"isProviderFor"),OrdinaryDefineOwnMetadata:vt,OrdinaryHasOwnMetadata:Y,OrdinaryGetOwnMetadata:ut,OrdinaryOwnMetadataKeys:Ie,OrdinaryDeleteMetadata:B};return T.registerProvider(x),x;function R(q,G,z){var Ee=E.get(q),Ke=!1;if(W(Ee)){if(!z)return;Ee=new d,E.set(q,Ee),Ke=!0}var Xe=Ee.get(G);if(W(Xe)){if(!z)return;if(Xe=new d,Ee.set(G,Xe),!b.setProvider(q,G,x))throw Ee.delete(G),Ke&&E.delete(q),new Error("Wrong provider for target.")}return Xe}o(R,"GetOrCreateMetadataMap");function Y(q,G,z){var Ee=R(G,z,!1);return W(Ee)?!1:Fe(Ee.has(q))}o(Y,"OrdinaryHasOwnMetadata");function ut(q,G,z){var Ee=R(G,z,!1);if(!W(Ee))return Ee.get(q)}o(ut,"OrdinaryGetOwnMetadata");function vt(q,G,z,Ee){var Ke=R(z,Ee,!0);Ke.set(q,G)}o(vt,"OrdinaryDefineOwnMetadata");function Ie(q,G){var z=[],Ee=R(q,G,!1);if(W(Ee))return z;for(var Ke=Ee.keys(),Xe=pe(Ke),rr=0;;){var Yr=fe(Xe);if(!Yr)return z.length=rr,z;var on=ue(Yr);try{z[rr]=on}catch(Pr){try{he(Xe)}finally{throw Pr}}rr++}}o(Ie,"OrdinaryOwnMetadataKeys");function B(q,G,z){var Ee=R(G,z,!1);if(W(Ee)||!Ee.delete(q))return!1;if(Ee.size===0){var Ke=E.get(G);W(Ke)||(Ke.delete(z),Ke.size===0&&E.delete(Ke))}return!0}o(B,"OrdinaryDeleteMetadata")}o(ye,"CreateMetadataProvider");function ve(b){var E=b.defineMetadata,x=b.hasOwnMetadata,R=b.getOwnMetadata,Y=b.getOwnMetadataKeys,ut=b.deleteMetadata,vt=new y,Ie={isProviderFor:o(function(B,q){var G=vt.get(B);return!W(G)&&G.has(q)?!0:Y(B,q).length?(W(G)&&(G=new p,vt.set(B,G)),G.add(q),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:E,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:R,OrdinaryOwnMetadataKeys:Y,OrdinaryDeleteMetadata:ut};return Ie}o(ve,"CreateFallbackProvider");function ie(b,E,x){var R=T.getProvider(b,E);if(!W(R))return R;if(x){if(T.setProvider(b,E,S))return S;throw new Error("Illegal state.")}}o(ie,"GetMetadataProvider");function _e(){var b={},E=[],x=(function(){function Ie(B,q,G){this._index=0,this._keys=B,this._values=q,this._selector=G}return o(Ie,"MapIterator"),Ie.prototype["@@iterator"]=function(){return this},Ie.prototype[a]=function(){return this},Ie.prototype.next=function(){var B=this._index;if(B>=0&&B<this._keys.length){var q=this._selector(this._keys[B],this._values[B]);return B+1>=this._keys.length?(this._index=-1,this._keys=E,this._values=E):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},Ie.prototype.throw=function(B){throw this._index>=0&&(this._index=-1,this._keys=E,this._values=E),B},Ie.prototype.return=function(B){return this._index>=0&&(this._index=-1,this._keys=E,this._values=E),{value:B,done:!0}},Ie})(),R=(function(){function Ie(){this._keys=[],this._values=[],this._cacheKey=b,this._cacheIndex=-2}return o(Ie,"Map"),Object.defineProperty(Ie.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),Ie.prototype.has=function(B){return this._find(B,!1)>=0},Ie.prototype.get=function(B){var q=this._find(B,!1);return q>=0?this._values[q]:void 0},Ie.prototype.set=function(B,q){var G=this._find(B,!0);return this._values[G]=q,this},Ie.prototype.delete=function(B){var q=this._find(B,!1);if(q>=0){for(var G=this._keys.length,z=q+1;z<G;z++)this._keys[z-1]=this._keys[z],this._values[z-1]=this._values[z];return this._keys.length--,this._values.length--,le(B,this._cacheKey)&&(this._cacheKey=b,this._cacheIndex=-2),!0}return!1},Ie.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=b,this._cacheIndex=-2},Ie.prototype.keys=function(){return new x(this._keys,this._values,Y)},Ie.prototype.values=function(){return new x(this._keys,this._values,ut)},Ie.prototype.entries=function(){return new x(this._keys,this._values,vt)},Ie.prototype["@@iterator"]=function(){return this.entries()},Ie.prototype[a]=function(){return this.entries()},Ie.prototype._find=function(B,q){if(!le(this._cacheKey,B)){this._cacheIndex=-1;for(var G=0;G<this._keys.length;G++)if(le(this._keys[G],B)){this._cacheIndex=G;break}}return this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(B),this._values.push(void 0)),this._cacheIndex},Ie})();return R;function Y(Ie,B){return Ie}function ut(Ie,B){return B}function vt(Ie,B){return[Ie,B]}}o(_e,"CreateMapPolyfill");function Ye(){var b=(function(){function E(){this._map=new d}return o(E,"Set"),Object.defineProperty(E.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),E.prototype.has=function(x){return this._map.has(x)},E.prototype.add=function(x){return this._map.set(x,x),this},E.prototype.delete=function(x){return this._map.delete(x)},E.prototype.clear=function(){this._map.clear()},E.prototype.keys=function(){return this._map.keys()},E.prototype.values=function(){return this._map.keys()},E.prototype.entries=function(){return this._map.entries()},E.prototype["@@iterator"]=function(){return this.keys()},E.prototype[a]=function(){return this.keys()},E})();return b}o(Ye,"CreateSetPolyfill");function Ve(){var b=16,E=f.create(),x=R();return(function(){function B(){this._key=R()}return o(B,"WeakMap"),B.prototype.has=function(q){var G=Y(q,!1);return G!==void 0?f.has(G,this._key):!1},B.prototype.get=function(q){var G=Y(q,!1);return G!==void 0?f.get(G,this._key):void 0},B.prototype.set=function(q,G){var z=Y(q,!0);return z[this._key]=G,this},B.prototype.delete=function(q){var G=Y(q,!1);return G!==void 0?delete G[this._key]:!1},B.prototype.clear=function(){this._key=R()},B})();function R(){var B;do B="@@WeakMap@@"+Ie();while(f.has(E,B));return E[B]=!0,B}function Y(B,q){if(!r.call(B,x)){if(!q)return;Object.defineProperty(B,x,{value:f.create()})}return B[x]}function ut(B,q){for(var G=0;G<q;++G)B[G]=Math.random()*255|0;return B}function vt(B){if(typeof Uint8Array=="function"){var q=new Uint8Array(B);return typeof crypto<"u"?crypto.getRandomValues(q):typeof msCrypto<"u"?msCrypto.getRandomValues(q):ut(q,B),q}return ut(new Array(B),B)}function Ie(){var B=vt(b);B[6]=B[6]&79|64,B[8]=B[8]&191|128;for(var q="",G=0;G<b;++G){var z=B[G];(G===4||G===6||G===8)&&(q+="-"),z<16&&(q+="0"),q+=z.toString(16).toLowerCase()}return q}}o(Ve,"CreateWeakMapPolyfill");function Pe(b){return b.__=void 0,delete b.__,b}o(Pe,"MakeDictionary")})})(P_||(P_={}))});var Bc=_(im=>{var Uu=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}},nm=class extends Uu{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};im.CommanderError=Uu;im.InvalidArgumentError=nm});var Bu=_(am=>{var{InvalidArgumentError:KI}=Bc(),sm=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 KI(`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 XI(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(XI,"humanReadableArgName");am.Argument=sm;am.humanReadableArgName=XI});var lm=_(cm=>{var{humanReadableArgName:JI}=Bu(),om=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=>JI(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(h,d){return t.formatItem(h,r,d,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(h=>s(t.styleArgumentTerm(t.argumentTerm(h)),t.styleArgumentDescription(t.argumentDescription(h))));if(a=a.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),h=>h.helpGroupHeading??"Options:").forEach((h,d)=>{let p=h.map(y=>s(t.styleOptionTerm(t.optionTerm(y)),t.styleOptionDescription(t.optionDescription(y))));a=a.concat(this.formatItemList(d,p,t))}),t.showGlobalOptions){let h=t.visibleGlobalOptions(e).map(d=>s(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",h,t))}return this.groupItems(e.commands,t.visibleCommands(e),h=>h.helpGroup()||"Commands:").forEach((h,d)=>{let p=h.map(y=>s(t.styleSubcommandTerm(t.subcommandTerm(y)),t.styleSubcommandDescription(t.subcommandDescription(y))));a=a.concat(this.formatItemList(d,p,t))}),a.join(`
|
|
6
|
+
"use strict";var WI=Object.create;var Uc=Object.defineProperty;var GI=Object.getOwnPropertyDescriptor;var HI=Object.getOwnPropertyNames;var zI=Object.getPrototypeOf,QI=Object.prototype.hasOwnProperty;var o=(n,e)=>Uc(n,"name",{value:e,configurable:!0});var YI=(n,e)=>()=>(n&&(e=n(n=0)),e);var _=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),O_=(n,e)=>{for(var t in e)Uc(n,t,{get:e[t],enumerable:!0})},R_=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of HI(e))!QI.call(n,i)&&i!==t&&Uc(n,i,{get:()=>e[i],enumerable:!(r=GI(e,i))||r.enumerable});return n};var X=(n,e,t)=>(t=n!=null?WI(zI(n)):{},R_(e||!n||!n.__esModule?Uc(t,"default",{value:n,enumerable:!0}):t,n)),rm=n=>R_(Uc({},"__esModule",{value:!0}),n);var Vu=_(()=>{var P_;(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,h){Object.defineProperty(l,f,{configurable:!0,writable:!0,value:h}),u&&u(f,h)}}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 Pe(Object.create(null))}:l?function(){return Pe({__proto__:null})}:function(){return Pe({})},has:u?function(b,E){return r.call(b,E)}:function(b,E){return E in b},get:u?function(b,E){return r.call(b,E)?b[E]:void 0}:function(b,E){return b[E]}},h=Object.getPrototypeOf(Function),d=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:_e(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ye(),y=typeof WeakMap=="function"?WeakMap:Ve(),w=i?Symbol.for("@reflect-metadata:registry"):void 0,T=ge(),S=ye(T);function x(b,E,A,R){if(W(A)){if(!De(b))throw new TypeError;if(!Ne(E))throw new TypeError;return qe(b,E)}else{if(!De(b))throw new TypeError;if(!ee(E))throw new TypeError;if(!ee(R)&&!W(R)&&!xe(R))throw new TypeError;return xe(R)&&(R=void 0),A=we(A),et(b,E,A,R)}}o(x,"decorate"),e("decorate",x);function F(b,E){function A(R,Y){if(!ee(R))throw new TypeError;if(!W(Y)&&!$e(Y))throw new TypeError;re(b,E,R,Y)}return o(A,"decorator"),A}o(F,"metadata"),e("metadata",F);function Q(b,E,A,R){if(!ee(A))throw new TypeError;return W(R)||(R=we(R)),re(b,E,A,R)}o(Q,"defineMetadata"),e("defineMetadata",Q);function K(b,E,A){if(!ee(E))throw new TypeError;return W(A)||(A=we(A)),wt(b,E,A)}o(K,"hasMetadata"),e("hasMetadata",K);function Te(b,E,A){if(!ee(E))throw new TypeError;return W(A)||(A=we(A)),tt(b,E,A)}o(Te,"hasOwnMetadata"),e("hasOwnMetadata",Te);function H(b,E,A){if(!ee(E))throw new TypeError;return W(A)||(A=we(A)),nt(b,E,A)}o(H,"getMetadata"),e("getMetadata",H);function J(b,E,A){if(!ee(E))throw new TypeError;return W(A)||(A=we(A)),We(b,E,A)}o(J,"getOwnMetadata"),e("getOwnMetadata",J);function L(b,E){if(!ee(b))throw new TypeError;return W(E)||(E=we(E)),U(b,E)}o(L,"getMetadataKeys"),e("getMetadataKeys",L);function $(b,E){if(!ee(b))throw new TypeError;return W(E)||(E=we(E)),it(b,E)}o($,"getOwnMetadataKeys"),e("getOwnMetadataKeys",$);function Z(b,E,A){if(!ee(E))throw new TypeError;if(W(A)||(A=we(A)),!ee(E))throw new TypeError;W(A)||(A=we(A));var R=ie(E,A,!1);return W(R)?!1:R.OrdinaryDeleteMetadata(b,E,A)}o(Z,"deleteMetadata"),e("deleteMetadata",Z);function qe(b,E){for(var A=b.length-1;A>=0;--A){var R=b[A],Y=R(E);if(!W(Y)&&!xe(Y)){if(!Ne(Y))throw new TypeError;E=Y}}return E}o(qe,"DecorateConstructor");function et(b,E,A,R){for(var Y=b.length-1;Y>=0;--Y){var ut=b[Y],vt=ut(E,A,R);if(!W(vt)&&!xe(vt)){if(!ee(vt))throw new TypeError;R=vt}}return R}o(et,"DecorateProperty");function wt(b,E,A){var R=tt(b,E,A);if(R)return!0;var Y=oe(E);return xe(Y)?!1:wt(b,Y,A)}o(wt,"OrdinaryHasMetadata");function tt(b,E,A){var R=ie(E,A,!1);return W(R)?!1:Fe(R.OrdinaryHasOwnMetadata(b,E,A))}o(tt,"OrdinaryHasOwnMetadata");function nt(b,E,A){var R=tt(b,E,A);if(R)return We(b,E,A);var Y=oe(E);if(!xe(Y))return nt(b,Y,A)}o(nt,"OrdinaryGetMetadata");function We(b,E,A){var R=ie(E,A,!1);if(!W(R))return R.OrdinaryGetOwnMetadata(b,E,A)}o(We,"OrdinaryGetOwnMetadata");function re(b,E,A,R){var Y=ie(A,R,!0);Y.OrdinaryDefineOwnMetadata(b,E,A,R)}o(re,"OrdinaryDefineOwnMetadata");function U(b,E){var A=it(b,E),R=oe(b);if(R===null)return A;var Y=U(R,E);if(Y.length<=0)return A;if(A.length<=0)return Y;for(var ut=new p,vt=[],Ie=0,B=A;Ie<B.length;Ie++){var q=B[Ie],G=ut.has(q);G||(ut.add(q),vt.push(q))}for(var z=0,Ee=Y;z<Ee.length;z++){var q=Ee[z],G=ut.has(q);G||(ut.add(q),vt.push(q))}return vt}o(U,"OrdinaryMetadataKeys");function it(b,E){var A=ie(b,E,!1);return A?A.OrdinaryOwnMetadataKeys(b,E):[]}o(it,"OrdinaryOwnMetadataKeys");function ct(b){if(b===null)return 1;switch(typeof b){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return b===null?1:6;default:return 6}}o(ct,"Type");function W(b){return b===void 0}o(W,"IsUndefined");function xe(b){return b===null}o(xe,"IsNull");function ke(b){return typeof b=="symbol"}o(ke,"IsSymbol");function ee(b){return typeof b=="object"?b!==null:typeof b=="function"}o(ee,"IsObject");function Le(b,E){switch(ct(b)){case 0:return b;case 1:return b;case 2:return b;case 3:return b;case 4:return b;case 5:return b}var A=E===3?"string":E===5?"number":"default",R=de(b,s);if(R!==void 0){var Y=R.call(b,A);if(ee(Y))throw new TypeError;return Y}return Me(b,A==="default"?"number":A)}o(Le,"ToPrimitive");function Me(b,E){if(E==="string"){var A=b.toString;if(Ae(A)){var R=A.call(b);if(!ee(R))return R}var Y=b.valueOf;if(Ae(Y)){var R=Y.call(b);if(!ee(R))return R}}else{var Y=b.valueOf;if(Ae(Y)){var R=Y.call(b);if(!ee(R))return R}var ut=b.toString;if(Ae(ut)){var R=ut.call(b);if(!ee(R))return R}}throw new TypeError}o(Me,"OrdinaryToPrimitive");function Fe(b){return!!b}o(Fe,"ToBoolean");function je(b){return""+b}o(je,"ToString");function we(b){var E=Le(b,3);return ke(E)?E:je(E)}o(we,"ToPropertyKey");function De(b){return Array.isArray?Array.isArray(b):b instanceof Object?b instanceof Array:Object.prototype.toString.call(b)==="[object Array]"}o(De,"IsArray");function Ae(b){return typeof b=="function"}o(Ae,"IsCallable");function Ne(b){return typeof b=="function"}o(Ne,"IsConstructor");function $e(b){switch(ct(b)){case 3:return!0;case 4:return!0;default:return!1}}o($e,"IsPropertyKey");function le(b,E){return b===E||b!==b&&E!==E}o(le,"SameValueZero");function de(b,E){var A=b[E];if(A!=null){if(!Ae(A))throw new TypeError;return A}}o(de,"GetMethod");function pe(b){var E=de(b,a);if(!Ae(E))throw new TypeError;var A=E.call(b);if(!ee(A))throw new TypeError;return A}o(pe,"GetIterator");function ue(b){return b.value}o(ue,"IteratorValue");function fe(b){var E=b.next();return E.done?!1:E}o(fe,"IteratorStep");function he(b){var E=b.return;E&&E.call(b)}o(he,"IteratorClose");function oe(b){var E=Object.getPrototypeOf(b);if(typeof b!="function"||b===h||E!==h)return E;var A=b.prototype,R=A&&Object.getPrototypeOf(A);if(R==null||R===Object.prototype)return E;var Y=R.constructor;return typeof Y!="function"||Y===b?E:Y}o(oe,"OrdinaryGetPrototypeOf");function me(){var b;!W(w)&&typeof t.Reflect<"u"&&!(w in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(b=ve(t.Reflect));var E,A,R,Y=new y,ut={registerProvider:vt,getProvider:B,setProvider:G};return ut;function vt(z){if(!Object.isExtensible(ut))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case b===z:break;case W(E):E=z;break;case E===z:break;case W(A):A=z;break;case A===z:break;default:R===void 0&&(R=new p),R.add(z);break}}function Ie(z,Ee){if(!W(E)){if(E.isProviderFor(z,Ee))return E;if(!W(A)){if(A.isProviderFor(z,Ee))return E;if(!W(R))for(var Ke=pe(R);;){var Xe=fe(Ke);if(!Xe)return;var rr=ue(Xe);if(rr.isProviderFor(z,Ee))return he(Ke),rr}}}if(!W(b)&&b.isProviderFor(z,Ee))return b}function B(z,Ee){var Ke=Y.get(z),Xe;return W(Ke)||(Xe=Ke.get(Ee)),W(Xe)&&(Xe=Ie(z,Ee),W(Xe)||(W(Ke)&&(Ke=new d,Y.set(z,Ke)),Ke.set(Ee,Xe))),Xe}function q(z){if(W(z))throw new TypeError;return E===z||A===z||!W(R)&&R.has(z)}function G(z,Ee,Ke){if(!q(Ke))throw new Error("Metadata provider not registered.");var Xe=B(z,Ee);if(Xe!==Ke){if(!W(Xe))return!1;var rr=Y.get(z);W(rr)&&(rr=new d,Y.set(z,rr)),rr.set(Ee,Ke)}return!0}}o(me,"CreateMetadataRegistry");function ge(){var b;return!W(w)&&ee(t.Reflect)&&Object.isExtensible(t.Reflect)&&(b=t.Reflect[w]),W(b)&&(b=me()),!W(w)&&ee(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,w,{enumerable:!1,configurable:!1,writable:!1,value:b}),b}o(ge,"GetOrCreateMetadataRegistry");function ye(b){var E=new y,A={isProviderFor:o(function(q,G){var z=E.get(q);return W(z)?!1:z.has(G)},"isProviderFor"),OrdinaryDefineOwnMetadata:vt,OrdinaryHasOwnMetadata:Y,OrdinaryGetOwnMetadata:ut,OrdinaryOwnMetadataKeys:Ie,OrdinaryDeleteMetadata:B};return T.registerProvider(A),A;function R(q,G,z){var Ee=E.get(q),Ke=!1;if(W(Ee)){if(!z)return;Ee=new d,E.set(q,Ee),Ke=!0}var Xe=Ee.get(G);if(W(Xe)){if(!z)return;if(Xe=new d,Ee.set(G,Xe),!b.setProvider(q,G,A))throw Ee.delete(G),Ke&&E.delete(q),new Error("Wrong provider for target.")}return Xe}o(R,"GetOrCreateMetadataMap");function Y(q,G,z){var Ee=R(G,z,!1);return W(Ee)?!1:Fe(Ee.has(q))}o(Y,"OrdinaryHasOwnMetadata");function ut(q,G,z){var Ee=R(G,z,!1);if(!W(Ee))return Ee.get(q)}o(ut,"OrdinaryGetOwnMetadata");function vt(q,G,z,Ee){var Ke=R(z,Ee,!0);Ke.set(q,G)}o(vt,"OrdinaryDefineOwnMetadata");function Ie(q,G){var z=[],Ee=R(q,G,!1);if(W(Ee))return z;for(var Ke=Ee.keys(),Xe=pe(Ke),rr=0;;){var Yr=fe(Xe);if(!Yr)return z.length=rr,z;var on=ue(Yr);try{z[rr]=on}catch(Pr){try{he(Xe)}finally{throw Pr}}rr++}}o(Ie,"OrdinaryOwnMetadataKeys");function B(q,G,z){var Ee=R(G,z,!1);if(W(Ee)||!Ee.delete(q))return!1;if(Ee.size===0){var Ke=E.get(G);W(Ke)||(Ke.delete(z),Ke.size===0&&E.delete(Ke))}return!0}o(B,"OrdinaryDeleteMetadata")}o(ye,"CreateMetadataProvider");function ve(b){var E=b.defineMetadata,A=b.hasOwnMetadata,R=b.getOwnMetadata,Y=b.getOwnMetadataKeys,ut=b.deleteMetadata,vt=new y,Ie={isProviderFor:o(function(B,q){var G=vt.get(B);return!W(G)&&G.has(q)?!0:Y(B,q).length?(W(G)&&(G=new p,vt.set(B,G)),G.add(q),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:E,OrdinaryHasOwnMetadata:A,OrdinaryGetOwnMetadata:R,OrdinaryOwnMetadataKeys:Y,OrdinaryDeleteMetadata:ut};return Ie}o(ve,"CreateFallbackProvider");function ie(b,E,A){var R=T.getProvider(b,E);if(!W(R))return R;if(A){if(T.setProvider(b,E,S))return S;throw new Error("Illegal state.")}}o(ie,"GetMetadataProvider");function _e(){var b={},E=[],A=(function(){function Ie(B,q,G){this._index=0,this._keys=B,this._values=q,this._selector=G}return o(Ie,"MapIterator"),Ie.prototype["@@iterator"]=function(){return this},Ie.prototype[a]=function(){return this},Ie.prototype.next=function(){var B=this._index;if(B>=0&&B<this._keys.length){var q=this._selector(this._keys[B],this._values[B]);return B+1>=this._keys.length?(this._index=-1,this._keys=E,this._values=E):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},Ie.prototype.throw=function(B){throw this._index>=0&&(this._index=-1,this._keys=E,this._values=E),B},Ie.prototype.return=function(B){return this._index>=0&&(this._index=-1,this._keys=E,this._values=E),{value:B,done:!0}},Ie})(),R=(function(){function Ie(){this._keys=[],this._values=[],this._cacheKey=b,this._cacheIndex=-2}return o(Ie,"Map"),Object.defineProperty(Ie.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),Ie.prototype.has=function(B){return this._find(B,!1)>=0},Ie.prototype.get=function(B){var q=this._find(B,!1);return q>=0?this._values[q]:void 0},Ie.prototype.set=function(B,q){var G=this._find(B,!0);return this._values[G]=q,this},Ie.prototype.delete=function(B){var q=this._find(B,!1);if(q>=0){for(var G=this._keys.length,z=q+1;z<G;z++)this._keys[z-1]=this._keys[z],this._values[z-1]=this._values[z];return this._keys.length--,this._values.length--,le(B,this._cacheKey)&&(this._cacheKey=b,this._cacheIndex=-2),!0}return!1},Ie.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=b,this._cacheIndex=-2},Ie.prototype.keys=function(){return new A(this._keys,this._values,Y)},Ie.prototype.values=function(){return new A(this._keys,this._values,ut)},Ie.prototype.entries=function(){return new A(this._keys,this._values,vt)},Ie.prototype["@@iterator"]=function(){return this.entries()},Ie.prototype[a]=function(){return this.entries()},Ie.prototype._find=function(B,q){if(!le(this._cacheKey,B)){this._cacheIndex=-1;for(var G=0;G<this._keys.length;G++)if(le(this._keys[G],B)){this._cacheIndex=G;break}}return this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(B),this._values.push(void 0)),this._cacheIndex},Ie})();return R;function Y(Ie,B){return Ie}function ut(Ie,B){return B}function vt(Ie,B){return[Ie,B]}}o(_e,"CreateMapPolyfill");function Ye(){var b=(function(){function E(){this._map=new d}return o(E,"Set"),Object.defineProperty(E.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),E.prototype.has=function(A){return this._map.has(A)},E.prototype.add=function(A){return this._map.set(A,A),this},E.prototype.delete=function(A){return this._map.delete(A)},E.prototype.clear=function(){this._map.clear()},E.prototype.keys=function(){return this._map.keys()},E.prototype.values=function(){return this._map.keys()},E.prototype.entries=function(){return this._map.entries()},E.prototype["@@iterator"]=function(){return this.keys()},E.prototype[a]=function(){return this.keys()},E})();return b}o(Ye,"CreateSetPolyfill");function Ve(){var b=16,E=f.create(),A=R();return(function(){function B(){this._key=R()}return o(B,"WeakMap"),B.prototype.has=function(q){var G=Y(q,!1);return G!==void 0?f.has(G,this._key):!1},B.prototype.get=function(q){var G=Y(q,!1);return G!==void 0?f.get(G,this._key):void 0},B.prototype.set=function(q,G){var z=Y(q,!0);return z[this._key]=G,this},B.prototype.delete=function(q){var G=Y(q,!1);return G!==void 0?delete G[this._key]:!1},B.prototype.clear=function(){this._key=R()},B})();function R(){var B;do B="@@WeakMap@@"+Ie();while(f.has(E,B));return E[B]=!0,B}function Y(B,q){if(!r.call(B,A)){if(!q)return;Object.defineProperty(B,A,{value:f.create()})}return B[A]}function ut(B,q){for(var G=0;G<q;++G)B[G]=Math.random()*255|0;return B}function vt(B){if(typeof Uint8Array=="function"){var q=new Uint8Array(B);return typeof crypto<"u"?crypto.getRandomValues(q):typeof msCrypto<"u"?msCrypto.getRandomValues(q):ut(q,B),q}return ut(new Array(B),B)}function Ie(){var B=vt(b);B[6]=B[6]&79|64,B[8]=B[8]&191|128;for(var q="",G=0;G<b;++G){var z=B[G];(G===4||G===6||G===8)&&(q+="-"),z<16&&(q+="0"),q+=z.toString(16).toLowerCase()}return q}}o(Ve,"CreateWeakMapPolyfill");function Pe(b){return b.__=void 0,delete b.__,b}o(Pe,"MakeDictionary")})})(P_||(P_={}))});var Bc=_(im=>{var Uu=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}},nm=class extends Uu{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};im.CommanderError=Uu;im.InvalidArgumentError=nm});var Bu=_(am=>{var{InvalidArgumentError:KI}=Bc(),sm=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 KI(`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 XI(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(XI,"humanReadableArgName");am.Argument=sm;am.humanReadableArgName=XI});var lm=_(cm=>{var{humanReadableArgName:JI}=Bu(),om=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=>JI(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(h,d){return t.formatItem(h,r,d,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(h=>s(t.styleArgumentTerm(t.argumentTerm(h)),t.styleArgumentDescription(t.argumentDescription(h))));if(a=a.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),h=>h.helpGroupHeading??"Options:").forEach((h,d)=>{let p=h.map(y=>s(t.styleOptionTerm(t.optionTerm(y)),t.styleOptionDescription(t.optionDescription(y))));a=a.concat(this.formatItemList(d,p,t))}),t.showGlobalOptions){let h=t.visibleGlobalOptions(e).map(d=>s(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",h,t))}return this.groupItems(e.commands,t.visibleCommands(e),h=>h.helpGroup()||"Commands:").forEach((h,d)=>{let p=h.map(y=>s(t.styleSubcommandTerm(t.subcommandTerm(y)),t.styleSubcommandDescription(t.subcommandDescription(y))));a=a.concat(this.formatItemList(d,p,t))}),a.join(`
|
|
7
7
|
`)}displayWidth(e){return F_(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,h;return f<this.minWidthToWrap||i.preformatted(r)?h=r:h=i.boxWrap(r,f).replace(/\n/g,`
|
|
8
8
|
`+" ".repeat(t+l)),a+c+" ".repeat(l)+h.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 h=this.displayWidth(f);if(u+h<=t){l.push(f),u+=h;return}s.push(l.join(""));let d=f.trimStart();l=[d],u=this.displayWidth(d)}),s.push(l.join(""))}),s.join(`
|
|
@@ -28,9 +28,9 @@ 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 Ze.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()}`,Ze.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new cO(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(h=>h.negate&&c===h.attributeName()),f=this.options.find(h=>!h.negate&&c===h.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=M_(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=M_(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=>sO(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=Qi.basename(e,Qi.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(Ze.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 j_(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(j_,"incrementNodeInspectorPort");function ym(){if(Ze.env.NO_COLOR||Ze.env.FORCE_COLOR==="0"||Ze.env.FORCE_COLOR==="false")return!1;if(Ze.env.FORCE_COLOR||Ze.env.CLICOLOR_FORCE!==void 0)return!0}o(ym,"useColor");vm.Command=gm;vm.useColor=ym});var q_=_(yn=>{var{Argument:V_}=Bu(),{Command:_m}=$_(),{CommanderError:lO,InvalidArgumentError:U_}=Bc(),{Help:uO}=lm(),{Option:B_}=dm();yn.program=new _m;yn.createCommand=n=>new _m(n);yn.createOption=(n,e)=>new B_(n,e);yn.createArgument=(n,e)=>new V_(n,e);yn.Command=_m;yn.Option=B_;yn.Argument=V_;yn.Help=uO;yn.CommanderError=lO;yn.InvalidArgumentError=U_;yn.InvalidOptionArgumentError=U_});var Gu=_(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.AssetClass=void 0;var G_;(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.TASK_PROTOTYPE_UID="75302770-279e-4a59-ba85-09df29725713",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.FLEETING_NOTE_UID="fca0a931-a01f-48e4-b72a-4af206c94bc7",n.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition"})(G_||(Wu.AssetClass=G_={}))});var zu=_(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.EffortStatus=void 0;var H_;(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"})(H_||(Hu.EffortStatus=H_={}))});var z_=_(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.hasPosition=fO;Qu.isFixed=hO;function fO(n){return typeof n.x=="number"&&typeof n.y=="number"}o(fO,"hasPosition");function hO(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(hO,"isFixed")});var Q_=_(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.createEmptyGraphData=dO;Yu.mergeGraphData=pO;function dO(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(dO,"createEmptyGraphData");function pO(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(pO,"mergeGraphData")});var wm=_(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.createEdgeId=mO;Ku.edgesEqual=gO;function mO(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(mO,"createEdgeId");function gO(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(gO,"edgesEqual")});var bm=_(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.BUILT_IN_EDGE_STYLES=At.BUILT_IN_NODE_STYLES=At.DEFAULT_EDGE_STYLE=At.DEFAULT_NODE_STYLE=At.RDF_TYPE_PREDICATES=void 0;At.mergeNodeStyles=yO;At.mergeEdgeStyles=vO;At.extractLocalName=_O;At.isClassType=wO;At.isTypePredicate=bO;At.isSubClassPredicate=SO;At.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"};At.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};At.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};At.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"}};At.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 yO(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(yO,"mergeNodeStyles");function vO(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(vO,"mergeEdgeStyles");function _O(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(_O,"extractLocalName");function wO(n){return n===At.RDF_TYPE_PREDICATES.RDFS_CLASS||n===At.RDF_TYPE_PREDICATES.OWL_CLASS}o(wO,"isClassType");function bO(n){return n===At.RDF_TYPE_PREDICATES.RDF_TYPE}o(bO,"isTypePredicate");function SO(n){return n===At.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(SO,"isSubClassPredicate")});var K_=_(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0})});var ze=_(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.IRI=void 0;var Sm=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)}}};Xu.IRI=Sm});var mt=_(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.Literal=void 0;na.parseLanguageTag=X_;na.createDirectionalLiteral=TO;na.createLiteralFromLanguageTag=xO;var EO="http://www.w3.org/2001/XMLSchema#string",qc=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===EO?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}};na.Literal=qc;function X_(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(X_,"parseLanguageTag");function TO(n,e,t){return new qc(n,void 0,e,t)}o(TO,"createDirectionalLiteral");function xO(n,e){let{language:t,direction:r}=X_(e);return new qc(n,void 0,t,r)}o(xO,"createLiteralFromLanguageTag")});var $t=_(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.BlankNode=void 0;var Ju=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())}};Zu.BlankNode=Ju;Ju.counter=0});var cn=_(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.Namespace=void 0;var J_=ze(),kr=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 J_.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new J_.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)}};ef.Namespace=kr;kr.RDF=new kr("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");kr.RDFS=new kr("rdfs","http://www.w3.org/2000/01/rdf-schema#");kr.OWL=new kr("owl","http://www.w3.org/2002/07/owl#");kr.XSD=new kr("xsd","http://www.w3.org/2001/XMLSchema#");kr.EXO=new kr("exo","https://exocortex.my/ontology/exo#");kr.EMS=new kr("ems","https://exocortex.my/ontology/ems#")});var Si=_(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.Triple=void 0;var Em=ze(),Tm=mt(),xm=$t(),Am=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 Em.IRI&&t instanceof Em.IRI||e instanceof xm.BlankNode&&t instanceof xm.BlankNode||e instanceof Tm.Literal&&t instanceof Tm.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 Em.IRI?`<${e.value}>`:e instanceof xm.BlankNode||e instanceof Tm.Literal||this.isQuotedTriple(e)?e.toString():""}};tf.Triple=Am});var Wc=_(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.QuotedTriple=void 0;var Cm=ze(),Im=mt(),Om=$t(),Rm=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 Cm.IRI&&t instanceof Cm.IRI||e instanceof Om.BlankNode&&t instanceof Om.BlankNode||e instanceof Im.Literal&&t instanceof Im.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 Cm.IRI?`<${e.value}>`:e instanceof Om.BlankNode||e instanceof Im.Literal||e instanceof n?e.toString():""}};rf.QuotedTriple=Rm});var Z_=_(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.QuotedTriple=kt.Triple=kt.Namespace=kt.BlankNode=kt.createLiteralFromLanguageTag=kt.createDirectionalLiteral=kt.parseLanguageTag=kt.Literal=kt.IRI=void 0;var AO=ze();Object.defineProperty(kt,"IRI",{enumerable:!0,get:o(function(){return AO.IRI},"get")});var nf=mt();Object.defineProperty(kt,"Literal",{enumerable:!0,get:o(function(){return nf.Literal},"get")});Object.defineProperty(kt,"parseLanguageTag",{enumerable:!0,get:o(function(){return nf.parseLanguageTag},"get")});Object.defineProperty(kt,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return nf.createDirectionalLiteral},"get")});Object.defineProperty(kt,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return nf.createLiteralFromLanguageTag},"get")});var CO=$t();Object.defineProperty(kt,"BlankNode",{enumerable:!0,get:o(function(){return CO.BlankNode},"get")});var IO=cn();Object.defineProperty(kt,"Namespace",{enumerable:!0,get:o(function(){return IO.Namespace},"get")});var OO=Si();Object.defineProperty(kt,"Triple",{enumerable:!0,get:o(function(){return OO.Triple},"get")});var RO=Wc();Object.defineProperty(kt,"QuotedTriple",{enumerable:!0,get:o(function(){return RO.QuotedTriple},"get")})});var sf=_(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.UUID_URL_NAMESPACE=_n.DEFAULT_LANGUAGE_TAG=_n.REQUIRED_PROPERTIES=_n.ALLOWED_PROPERTIES=_n.Exo003MetadataType=void 0;var vn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(vn||(_n.Exo003MetadataType=vn={}));_n.ALLOWED_PROPERTIES={[vn.Namespace]:["metadata","uri","aliases"],[vn.Anchor]:["metadata","uri","aliases"],[vn.BlankNode]:["metadata","uri","aliases"],[vn.Statement]:["metadata","subject","predicate","object","aliases"],[vn.Body]:["metadata","subject","predicate","aliases"]};_n.REQUIRED_PROPERTIES={[vn.Namespace]:["metadata","uri"],[vn.Anchor]:["metadata","uri"],[vn.BlankNode]:["metadata","uri"],[vn.Statement]:["metadata","subject","predicate","object"],[vn.Body]:["metadata","subject","predicate"]};_n.DEFAULT_LANGUAGE_TAG="ru";_n.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var ew=_(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var tw=_(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.default="00000000-0000-0000-0000-000000000000"});var rw=_(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.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 Gc=_(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});var PO=rw();function FO(n){return typeof n=="string"&&PO.default.test(n)}o(FO,"validate");Nm.default=FO});var Hc=_(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});var DO=Gc();function NO(n){if(!(0,DO.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(NO,"parse");km.default=NO});var Yi=_(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.unsafeStringify=void 0;var kO=Gc(),sr=[];for(let n=0;n<256;++n)sr.push((n+256).toString(16).slice(1));function nw(n,e=0){return(sr[n[e+0]]+sr[n[e+1]]+sr[n[e+2]]+sr[n[e+3]]+"-"+sr[n[e+4]]+sr[n[e+5]]+"-"+sr[n[e+6]]+sr[n[e+7]]+"-"+sr[n[e+8]]+sr[n[e+9]]+"-"+sr[n[e+10]]+sr[n[e+11]]+sr[n[e+12]]+sr[n[e+13]]+sr[n[e+14]]+sr[n[e+15]]).toLowerCase()}o(nw,"unsafeStringify");zc.unsafeStringify=nw;function LO(n,e=0){let t=nw(n,e);if(!(0,kO.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(LO,"stringify");zc.default=LO});var cf=_(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});var MO=require("crypto"),of=new Uint8Array(256),af=of.length;function jO(){return af>of.length-16&&((0,MO.randomFillSync)(of),af=0),of.slice(af,af+=16)}o(jO,"rng");Lm.default=jO});var Mm=_(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.updateV1State=void 0;var iw=cf(),$O=Yi(),Qc={};function VO(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=sw(n.random??n.rng?.()??(0,iw.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,iw.default)();aw(Qc,s,a),r=sw(a,Qc.msecs,Qc.nsecs,i?void 0:Qc.clockseq,i?void 0:Qc.node,e,t)}return e??(0,$O.unsafeStringify)(r)}o(VO,"v1");function aw(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(aw,"updateV1State");Yc.updateV1State=aw;function sw(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(sw,"v1Bytes");Yc.default=VO});var $m=_(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var UO=Hc(),BO=Yi();function qO(n){let e=typeof n=="string"?(0,UO.default)(n):n,t=WO(e);return typeof n=="string"?(0,BO.unsafeStringify)(t):t}o(qO,"v1ToV6");jm.default=qO;function WO(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(WO,"_v1ToV6")});var ow=_(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});var GO=require("crypto");function HO(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,GO.createHash)("md5").update(n).digest()}o(HO,"md5");Vm.default=HO});var Kc=_(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.URL=Ki.DNS=Ki.stringToBytes=void 0;var cw=Hc(),zO=Yi();function lw(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(lw,"stringToBytes");Ki.stringToBytes=lw;Ki.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ki.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function QO(n,e,t,r,i,s){let a=typeof t=="string"?lw(t):t,c=typeof r=="string"?(0,cw.default)(r):r;if(typeof r=="string"&&(r=(0,cw.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,zO.unsafeStringify)(l)}o(QO,"v35");Ki.default=QO});var fw=_(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.URL=ia.DNS=void 0;var YO=ow(),Um=Kc(),uw=Kc();Object.defineProperty(ia,"DNS",{enumerable:!0,get:o(function(){return uw.DNS},"get")});Object.defineProperty(ia,"URL",{enumerable:!0,get:o(function(){return uw.URL},"get")});function Bm(n,e,t,r){return(0,Um.default)(48,YO.default,n,e,t,r)}o(Bm,"v3");Bm.DNS=Um.DNS;Bm.URL=Um.URL;ia.default=Bm});var hw=_(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});var KO=require("crypto");qm.default={randomUUID:KO.randomUUID}});var pw=_(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});var dw=hw(),XO=cf(),JO=Yi();function ZO(n,e,t){if(dw.default.randomUUID&&!e&&!n)return dw.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,XO.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,JO.unsafeStringify)(r)}o(ZO,"v4");Wm.default=ZO});var mw=_(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});var eR=require("crypto");function tR(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,eR.createHash)("sha1").update(n).digest()}o(tR,"sha1");Gm.default=tR});var yw=_(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.URL=sa.DNS=void 0;var rR=mw(),Hm=Kc(),gw=Kc();Object.defineProperty(sa,"DNS",{enumerable:!0,get:o(function(){return gw.DNS},"get")});Object.defineProperty(sa,"URL",{enumerable:!0,get:o(function(){return gw.URL},"get")});function zm(n,e,t,r){return(0,Hm.default)(80,rR.default,n,e,t,r)}o(zm,"v5");zm.DNS=Hm.DNS;zm.URL=Hm.URL;sa.default=zm});var vw=_(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});var nR=Yi(),iR=Mm(),sR=$m();function aR(n,e,t){n??={},t??=0;let r=(0,iR.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,sR.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,nR.unsafeStringify)(r)}o(aR,"v6");Qm.default=aR});var _w=_(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});var oR=Hc(),cR=Yi();function lR(n){let e=typeof n=="string"?(0,oR.default)(n):n,t=uR(e);return typeof n=="string"?(0,cR.unsafeStringify)(t):t}o(lR,"v6ToV1");Ym.default=lR;function uR(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(uR,"_v6ToV1")});var Ew=_(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.updateV7State=void 0;var ww=cf(),fR=Yi(),Km={};function hR(n,e,t){let r;if(n)r=bw(n.random??n.rng?.()??(0,ww.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,ww.default)();Sw(Km,i,s),r=bw(s,Km.msecs,Km.seq,e,t)}return e??(0,fR.unsafeStringify)(r)}o(hR,"v7");function Sw(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(Sw,"updateV7State");Xc.updateV7State=Sw;function bw(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(bw,"v7Bytes");Xc.default=hR});var Tw=_(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});var dR=Gc();function pR(n){if(!(0,dR.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(pR,"version");Xm.default=pR});var Lr=_(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.version=rt.validate=rt.v7=rt.v6ToV1=rt.v6=rt.v5=rt.v4=rt.v3=rt.v1ToV6=rt.v1=rt.stringify=rt.parse=rt.NIL=rt.MAX=void 0;var mR=ew();Object.defineProperty(rt,"MAX",{enumerable:!0,get:o(function(){return mR.default},"get")});var gR=tw();Object.defineProperty(rt,"NIL",{enumerable:!0,get:o(function(){return gR.default},"get")});var yR=Hc();Object.defineProperty(rt,"parse",{enumerable:!0,get:o(function(){return yR.default},"get")});var vR=Yi();Object.defineProperty(rt,"stringify",{enumerable:!0,get:o(function(){return vR.default},"get")});var _R=Mm();Object.defineProperty(rt,"v1",{enumerable:!0,get:o(function(){return _R.default},"get")});var wR=$m();Object.defineProperty(rt,"v1ToV6",{enumerable:!0,get:o(function(){return wR.default},"get")});var bR=fw();Object.defineProperty(rt,"v3",{enumerable:!0,get:o(function(){return bR.default},"get")});var SR=pw();Object.defineProperty(rt,"v4",{enumerable:!0,get:o(function(){return SR.default},"get")});var ER=yw();Object.defineProperty(rt,"v5",{enumerable:!0,get:o(function(){return ER.default},"get")});var TR=vw();Object.defineProperty(rt,"v6",{enumerable:!0,get:o(function(){return TR.default},"get")});var xR=_w();Object.defineProperty(rt,"v6ToV1",{enumerable:!0,get:o(function(){return xR.default},"get")});var AR=Ew();Object.defineProperty(rt,"v7",{enumerable:!0,get:o(function(){return AR.default},"get")});var CR=Gc();Object.defineProperty(rt,"validate",{enumerable:!0,get:o(function(){return CR.default},"get")});var IR=Tw();Object.defineProperty(rt,"version",{enumerable:!0,get:o(function(){return IR.default},"get")})});var eg=_(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.Exo003UUIDGenerator=void 0;var Jm=Lr(),xw=sf(),Zm=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,Jm.v5)(e,xw.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,Jm.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,Jm.v5)(e,xw.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)}};lf.Exo003UUIDGenerator=Zm});var Cw=_(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});ff.Exo003Parser=void 0;var lt=sf(),Jc=eg(),vs=ze(),uf=mt(),Aw=$t(),OR=Si(),tg=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===lt.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(lt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(lt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=lt.ALLOWED_PROPERTIES[s],c=lt.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 lt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case lt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case lt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case lt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case lt.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 lt.Exo003MetadataType.Namespace:return{...r,metadata:lt.Exo003MetadataType.Namespace,uri:e.uri};case lt.Exo003MetadataType.Anchor:return{...r,metadata:lt.Exo003MetadataType.Anchor,uri:e.uri};case lt.Exo003MetadataType.BlankNode:return{...r,metadata:lt.Exo003MetadataType.BlankNode,uri:e.uri};case lt.Exo003MetadataType.Statement:return{...r,metadata:lt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case lt.Exo003MetadataType.Body:return{...r,metadata:lt.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 vs.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 vs.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 vs.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 vs.IRI(i.value);else if(i.type==="blank")s=new Aw.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 vs.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new vs.IRI(l.value);else if(l.type==="blank")u=new Aw.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new uf.Literal(f,new vs.IRI(l.datatype));else{let h=l.language||lt.DEFAULT_LANGUAGE_TAG;u=(0,uf.createDirectionalLiteral)(f,h,l.direction)}}return new OR.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new uf.Literal(t,new vs.IRI(r.datatype));let i=r?.language||lt.DEFAULT_LANGUAGE_TAG;return(0,uf.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(lt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case lt.Exo003MetadataType.Namespace:return Jc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case lt.Exo003MetadataType.Anchor:return Jc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case lt.Exo003MetadataType.BlankNode:return Jc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case lt.Exo003MetadataType.Statement:{let r=e;return Jc.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case lt.Exo003MetadataType.Body:{let r=e;return Jc.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};ff.Exo003Parser=tg});var rg=_(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.Exo003Parser=yr.Exo003UUIDGenerator=yr.UUID_URL_NAMESPACE=yr.DEFAULT_LANGUAGE_TAG=yr.REQUIRED_PROPERTIES=yr.ALLOWED_PROPERTIES=yr.Exo003MetadataType=void 0;var Zc=sf();Object.defineProperty(yr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Zc.Exo003MetadataType},"get")});Object.defineProperty(yr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Zc.ALLOWED_PROPERTIES},"get")});Object.defineProperty(yr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Zc.REQUIRED_PROPERTIES},"get")});Object.defineProperty(yr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Zc.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(yr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Zc.UUID_URL_NAMESPACE},"get")});var RR=eg();Object.defineProperty(yr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return RR.Exo003UUIDGenerator},"get")});var PR=Cw();Object.defineProperty(yr,"Exo003Parser",{enumerable:!0,get:o(function(){return PR.Exo003Parser},"get")})});var aa=_(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.WikiLinkHelpers=void 0;var hf=class{static{o(this,"WikiLinkHelpers")}static normalize(e){return e?e.replace(this.WIKI_LINK_PATTERN,"").trim():""}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)}};df.WikiLinkHelpers=hf;hf.WIKI_LINK_PATTERN=/\[\[|\]\]/g});var vr=_(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.EffortStatus=to.AssetClass=void 0;var FR=Gu();Object.defineProperty(to,"AssetClass",{enumerable:!0,get:o(function(){return FR.AssetClass},"get")});var DR=zu();Object.defineProperty(to,"EffortStatus",{enumerable:!0,get:o(function(){return DR.EffortStatus},"get")})});var _s=_(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.hasClass=ca;_r.isAreaOrProject=NR;_r.isEffort=kR;_r.hasStatus=LR;_r.isAssetArchived=MR;_r.hasEmptyProperties=jR;_r.needsFolderRepair=$R;_r.getTodayDateString=ng;_r.isPlannedForToday=VR;_r.hasPlannedStartTimestamp=UR;_r.extractDailyNoteDate=BR;_r.isCurrentDateGteDay=qR;_r.inheritsFromPrototype=Rw;_r.isPrototypeClass=GR;var Ow=aa(),oa=vr();function ca(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>Ow.WikiLinkHelpers.normalize(r)===e):!1}o(ca,"hasClass");function NR(n){return ca(n,oa.AssetClass.AREA)||ca(n,oa.AssetClass.PROJECT)}o(NR,"isAreaOrProject");function kR(n){return ca(n,oa.AssetClass.TASK)||ca(n,oa.AssetClass.PROJECT)||ca(n,oa.AssetClass.MEETING)}o(kR,"isEffort");function LR(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?Ow.WikiLinkHelpers.normalize(t)===e:!1}o(LR,"hasStatus");function MR(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(MR,"isAssetArchived");function jR(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(jR,"hasEmptyProperties");function $R(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o($R,"needsFolderRepair");function ng(){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(ng,"getTodayDateString");function VR(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=ng();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(VR,"isPlannedForToday");function UR(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(UR,"hasPlannedStartTimestamp");function BR(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(BR,"extractDailyNoteDate");function qR(n){return ng()>=n}o(qR,"isCurrentDateGteDay");function Iw(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(Iw,"normalizeWithQuotes");var WR=10;function Rw(n,e=WR){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=Iw(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===oa.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let h=Array.isArray(f)?f:[f];for(let d of h){let p=Iw(d);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(Rw,"inheritsFromPrototype");function GR(n,e){return ca(n,oa.AssetClass.CLASS)?Rw(e):!1}o(GR,"isPrototypeClass")});var Pw=_(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.canCreateTask=HR;no.canCreateRelatedTask=zR;no.canConvertTaskToProject=QR;no.canSetCriticalityZone=YR;var ro=_s(),ig=vr();function HR(n){return(0,ro.isAreaOrProject)(n.instanceClass)}o(HR,"canCreateTask");function zR(n){return!(!(0,ro.hasClass)(n.instanceClass,ig.AssetClass.TASK)||(0,ro.isAssetArchived)(n.isArchived))}o(zR,"canCreateRelatedTask");function QR(n){return(0,ro.hasClass)(n.instanceClass,ig.AssetClass.TASK)}o(QR,"canConvertTaskToProject");function YR(n){return!(!(0,ro.hasClass)(n.instanceClass,ig.AssetClass.TASK)||(0,ro.isAssetArchived)(n.isArchived))}o(YR,"canSetCriticalityZone")});var Fw=_(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.canCreateProject=KR;io.canMoveToAnalysis=XR;io.canMoveToToDo=JR;io.canConvertProjectToTask=ZR;var ws=_s(),bs=vr();function KR(n){return(0,ws.hasClass)(n.instanceClass,bs.AssetClass.AREA)||(0,ws.hasClass)(n.instanceClass,bs.AssetClass.INITIATIVE)||(0,ws.hasClass)(n.instanceClass,bs.AssetClass.PROJECT)}o(KR,"canCreateProject");function XR(n){return(0,ws.hasClass)(n.instanceClass,bs.AssetClass.PROJECT)?(0,ws.hasStatus)(n.currentStatus,bs.EffortStatus.BACKLOG):!1}o(XR,"canMoveToAnalysis");function JR(n){return(0,ws.hasClass)(n.instanceClass,bs.AssetClass.PROJECT)?(0,ws.hasStatus)(n.currentStatus,bs.EffortStatus.ANALYSIS):!1}o(JR,"canMoveToToDo");function ZR(n){return(0,ws.hasClass)(n.instanceClass,bs.AssetClass.PROJECT)}o(ZR,"canConvertProjectToTask")});var kw=_(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.canCreateChildArea=eP;pf.canSetActiveFocus=tP;var Dw=_s(),Nw=vr();function eP(n){return(0,Dw.hasClass)(n.instanceClass,Nw.AssetClass.AREA)}o(eP,"canCreateChildArea");function tP(n){return(0,Dw.hasClass)(n.instanceClass,Nw.AssetClass.AREA)}o(tP,"canSetActiveFocus")});var Mw=_(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.canPlanOnToday=rP;jr.canPlanForEvening=nP;jr.canShiftDayBackward=iP;jr.canShiftDayForward=sP;jr.canSetDraftStatus=aP;jr.canMoveToBacklog=oP;jr.canStartEffort=cP;jr.canMarkDone=lP;jr.canTrashEffort=uP;jr.canVoteOnEffort=fP;jr.canRollbackStatus=hP;jr.canArchiveTask=dP;jr.canMarkReviewed=pP;var Lw=aa(),at=_s(),Mr=vr();function rP(n){return!(!(0,at.isEffort)(n.instanceClass)||(0,at.isPlannedForToday)(n.metadata))}o(rP,"canPlanOnToday");function nP(n){return!(0,at.hasClass)(n.instanceClass,Mr.AssetClass.TASK)&&!(0,at.hasClass)(n.instanceClass,Mr.AssetClass.MEETING)?!1:(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.BACKLOG)}o(nP,"canPlanForEvening");function iP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasPlannedStartTimestamp)(n.metadata):!1}o(iP,"canShiftDayBackward");function sP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasPlannedStartTimestamp)(n.metadata):!1}o(sP,"canShiftDayForward");function aP(n){return(0,at.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(aP,"canSetDraftStatus");function oP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.DRAFT):!1}o(oP,"canMoveToBacklog");function cP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasClass)(n.instanceClass,Mr.AssetClass.TASK)||(0,at.hasClass)(n.instanceClass,Mr.AssetClass.MEETING)?(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.BACKLOG):(0,at.hasClass)(n.instanceClass,Mr.AssetClass.PROJECT)?(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.TODO):!1:!1}o(cP,"canStartEffort");function lP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.DOING):!1}o(lP,"canMarkDone");function uP(n){return(0,at.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=Lw.WikiLinkHelpers.normalize(r);return i===Mr.EffortStatus.TRASHED||i===Mr.EffortStatus.DONE}):!0:!1}o(uP,"canTrashEffort");function fP(n){return!(!(0,at.isEffort)(n.instanceClass)||(0,at.isAssetArchived)(n.isArchived))}o(fP,"canVoteOnEffort");function hP(n){if(!(0,at.isEffort)(n.instanceClass)||(0,at.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||Lw.WikiLinkHelpers.normalize(e)===Mr.EffortStatus.TRASHED)}o(hP,"canRollbackStatus");function dP(n){return!(0,at.isAssetArchived)(n.isArchived)}o(dP,"canArchiveTask");function pP(n){return!(!(0,at.hasClass)(n.instanceClass,Mr.AssetClass.TASK)&&!(0,at.hasClass)(n.instanceClass,Mr.AssetClass.PROJECT)||(0,at.isAssetArchived)(n.isArchived))}o(pP,"canMarkReviewed")});var jw=_(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.canCreateEvent=mP;wn.canCreateInstance=gP;wn.canCleanProperties=yP;wn.canRepairFolder=vP;wn.canRenameToUid=_P;wn.canCopyLabelToAliases=wP;wn.canCreateNarrowerConcept=bP;wn.canCreateSubclass=SP;wn.canCreateTaskForDailyNote=EP;wn.canCopyFleetingNoteLabel=TP;var wr=_s(),Dn=vr();function mP(n){return(0,wr.isAreaOrProject)(n.instanceClass)}o(mP,"canCreateEvent");function gP(n){return(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.TASK_PROTOTYPE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.TASK_PROTOTYPE_UID)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.MEETING_PROTOTYPE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.EVENT_PROTOTYPE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.PROJECT_PROTOTYPE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,wr.isPrototypeClass)(n.instanceClass,n.metadata)}o(gP,"canCreateInstance");function yP(n){return(0,wr.hasEmptyProperties)(n.metadata)}o(yP,"canCleanProperties");function vP(n){return(0,wr.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(vP,"canRepairFolder");function _P(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(_P,"canRenameToUid");function wP(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(wP,"canCopyLabelToAliases");function bP(n){return(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.CONCEPT)}o(bP,"canCreateNarrowerConcept");function SP(n){return(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.CLASS)}o(SP,"canCreateSubclass");function EP(n){return!(!(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.DAILY_NOTE)||n.isArchived||!(0,wr.extractDailyNoteDate)(n.metadata))}o(EP,"canCreateTaskForDailyNote");function TP(n){return(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.FLEETING_NOTE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.FLEETING_NOTE_UID)}o(TP,"canCopyFleetingNoteLabel")});var Vw=_(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.canCopyFleetingNoteLabel=N.canCreateTaskForDailyNote=N.canCreateSubclass=N.canCreateNarrowerConcept=N.canCopyLabelToAliases=N.canRenameToUid=N.canRepairFolder=N.canCleanProperties=N.canCreateInstance=N.canCreateEvent=N.canMarkReviewed=N.canArchiveTask=N.canRollbackStatus=N.canVoteOnEffort=N.canTrashEffort=N.canMarkDone=N.canStartEffort=N.canMoveToBacklog=N.canSetDraftStatus=N.canShiftDayForward=N.canShiftDayBackward=N.canPlanForEvening=N.canPlanOnToday=N.canSetActiveFocus=N.canCreateChildArea=N.canConvertProjectToTask=N.canMoveToToDo=N.canMoveToAnalysis=N.canCreateProject=N.canSetCriticalityZone=N.canConvertTaskToProject=N.canCreateRelatedTask=N.canCreateTask=N.isPrototypeClass=N.inheritsFromPrototype=N.isCurrentDateGteDay=N.extractDailyNoteDate=N.hasPlannedStartTimestamp=N.isPlannedForToday=N.getTodayDateString=N.needsFolderRepair=N.hasEmptyProperties=N.isAssetArchived=N.hasStatus=N.isEffort=N.isAreaOrProject=N.hasClass=void 0;var Xr=_s();Object.defineProperty(N,"hasClass",{enumerable:!0,get:o(function(){return Xr.hasClass},"get")});Object.defineProperty(N,"isAreaOrProject",{enumerable:!0,get:o(function(){return Xr.isAreaOrProject},"get")});Object.defineProperty(N,"isEffort",{enumerable:!0,get:o(function(){return Xr.isEffort},"get")});Object.defineProperty(N,"hasStatus",{enumerable:!0,get:o(function(){return Xr.hasStatus},"get")});Object.defineProperty(N,"isAssetArchived",{enumerable:!0,get:o(function(){return Xr.isAssetArchived},"get")});Object.defineProperty(N,"hasEmptyProperties",{enumerable:!0,get:o(function(){return Xr.hasEmptyProperties},"get")});Object.defineProperty(N,"needsFolderRepair",{enumerable:!0,get:o(function(){return Xr.needsFolderRepair},"get")});Object.defineProperty(N,"getTodayDateString",{enumerable:!0,get:o(function(){return Xr.getTodayDateString},"get")});Object.defineProperty(N,"isPlannedForToday",{enumerable:!0,get:o(function(){return Xr.isPlannedForToday},"get")});Object.defineProperty(N,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return Xr.hasPlannedStartTimestamp},"get")});Object.defineProperty(N,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return Xr.extractDailyNoteDate},"get")});Object.defineProperty(N,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return Xr.isCurrentDateGteDay},"get")});Object.defineProperty(N,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return Xr.inheritsFromPrototype},"get")});Object.defineProperty(N,"isPrototypeClass",{enumerable:!0,get:o(function(){return Xr.isPrototypeClass},"get")});var mf=Pw();Object.defineProperty(N,"canCreateTask",{enumerable:!0,get:o(function(){return mf.canCreateTask},"get")});Object.defineProperty(N,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return mf.canCreateRelatedTask},"get")});Object.defineProperty(N,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return mf.canConvertTaskToProject},"get")});Object.defineProperty(N,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return mf.canSetCriticalityZone},"get")});var gf=Fw();Object.defineProperty(N,"canCreateProject",{enumerable:!0,get:o(function(){return gf.canCreateProject},"get")});Object.defineProperty(N,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return gf.canMoveToAnalysis},"get")});Object.defineProperty(N,"canMoveToToDo",{enumerable:!0,get:o(function(){return gf.canMoveToToDo},"get")});Object.defineProperty(N,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return gf.canConvertProjectToTask},"get")});var $w=kw();Object.defineProperty(N,"canCreateChildArea",{enumerable:!0,get:o(function(){return $w.canCreateChildArea},"get")});Object.defineProperty(N,"canSetActiveFocus",{enumerable:!0,get:o(function(){return $w.canSetActiveFocus},"get")});var ln=Mw();Object.defineProperty(N,"canPlanOnToday",{enumerable:!0,get:o(function(){return ln.canPlanOnToday},"get")});Object.defineProperty(N,"canPlanForEvening",{enumerable:!0,get:o(function(){return ln.canPlanForEvening},"get")});Object.defineProperty(N,"canShiftDayBackward",{enumerable:!0,get:o(function(){return ln.canShiftDayBackward},"get")});Object.defineProperty(N,"canShiftDayForward",{enumerable:!0,get:o(function(){return ln.canShiftDayForward},"get")});Object.defineProperty(N,"canSetDraftStatus",{enumerable:!0,get:o(function(){return ln.canSetDraftStatus},"get")});Object.defineProperty(N,"canMoveToBacklog",{enumerable:!0,get:o(function(){return ln.canMoveToBacklog},"get")});Object.defineProperty(N,"canStartEffort",{enumerable:!0,get:o(function(){return ln.canStartEffort},"get")});Object.defineProperty(N,"canMarkDone",{enumerable:!0,get:o(function(){return ln.canMarkDone},"get")});Object.defineProperty(N,"canTrashEffort",{enumerable:!0,get:o(function(){return ln.canTrashEffort},"get")});Object.defineProperty(N,"canVoteOnEffort",{enumerable:!0,get:o(function(){return ln.canVoteOnEffort},"get")});Object.defineProperty(N,"canRollbackStatus",{enumerable:!0,get:o(function(){return ln.canRollbackStatus},"get")});Object.defineProperty(N,"canArchiveTask",{enumerable:!0,get:o(function(){return ln.canArchiveTask},"get")});Object.defineProperty(N,"canMarkReviewed",{enumerable:!0,get:o(function(){return ln.canMarkReviewed},"get")});var Ei=jw();Object.defineProperty(N,"canCreateEvent",{enumerable:!0,get:o(function(){return Ei.canCreateEvent},"get")});Object.defineProperty(N,"canCreateInstance",{enumerable:!0,get:o(function(){return Ei.canCreateInstance},"get")});Object.defineProperty(N,"canCleanProperties",{enumerable:!0,get:o(function(){return Ei.canCleanProperties},"get")});Object.defineProperty(N,"canRepairFolder",{enumerable:!0,get:o(function(){return Ei.canRepairFolder},"get")});Object.defineProperty(N,"canRenameToUid",{enumerable:!0,get:o(function(){return Ei.canRenameToUid},"get")});Object.defineProperty(N,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return Ei.canCopyLabelToAliases},"get")});Object.defineProperty(N,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return Ei.canCreateNarrowerConcept},"get")});Object.defineProperty(N,"canCreateSubclass",{enumerable:!0,get:o(function(){return Ei.canCreateSubclass},"get")});Object.defineProperty(N,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return Ei.canCreateTaskForDailyNote},"get")});Object.defineProperty(N,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return Ei.canCopyFleetingNoteLabel},"get")})});var Uw=_(la=>{"use strict";var xP=la&&la.__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]})),AP=la&&la.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&xP(e,n,t)};Object.defineProperty(la,"__esModule",{value:!0});AP(Vw(),la)});var ag=_(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.PropertyFieldType=void 0;el.rangeToFieldType=OP;var ar;(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"})(ar||(el.PropertyFieldType=ar={}));var Bw="http://www.w3.org/2001/XMLSchema#",CP="https://exocortex.my/ontology/exo#",IP="https://exocortex.my/ontology/ems#";function OP(n){if(!n)return ar.Unknown;let e=n.trim();if(!e)return ar.Unknown;if(e.startsWith(Bw)){let t=e.substring(Bw.length);return sg(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return sg(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return sg(r)}return e.startsWith(IP)||e.startsWith("ems:")?RP(e):e.startsWith(CP)||e.startsWith("exo:")||PP(e)?ar.Reference:ar.Text}o(OP,"rangeToFieldType");function sg(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return ar.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 ar.Number;case"date":return ar.Date;case"datetime":case"datetimestamp":return ar.DateTime;case"boolean":return ar.Boolean;case"time":return ar.Timestamp;default:return ar.Text}}o(sg,"xsdTypeToFieldType");function RP(n){let e=n.toLowerCase();return e.includes("effortstatus")?ar.StatusSelect:e.includes("tasksize")?ar.SizeSelect:ar.Reference}o(RP,"emsTypeToFieldType");function PP(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(PP,"isClassReference")});var Ww=_(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.propertyNameToUri=FP;tl.uriToPropertyName=qw;tl.extractPropertyLabel=DP;function FP(n){return n.replace(/^([a-z]+)__/,"$1:")}o(FP,"propertyNameToUri");function qw(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(qw,"uriToPropertyName");function DP(n){let r=(n.includes(":")?qw(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(DP,"extractPropertyLabel")});var yf={};O_(yf,{__assign:()=>cg,__asyncDelegator:()=>HP,__asyncGenerator:()=>GP,__asyncValues:()=>zP,__await:()=>rl,__awaiter:()=>$P,__classPrivateFieldGet:()=>XP,__classPrivateFieldSet:()=>JP,__createBinding:()=>UP,__decorate:()=>LP,__exportStar:()=>BP,__extends:()=>NP,__generator:()=>VP,__importDefault:()=>KP,__importStar:()=>YP,__makeTemplateObject:()=>QP,__metadata:()=>jP,__param:()=>MP,__read:()=>Gw,__rest:()=>kP,__spread:()=>qP,__spreadArrays:()=>WP,__values:()=>lg});function NP(n,e){og(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function kP(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 LP(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 MP(n,e){return function(t,r){e(t,r,n)}}function jP(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function $P(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(h){a(h)}}o(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(h){a(h)}}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 VP(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 UP(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function BP(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function lg(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 Gw(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 qP(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Gw(arguments[e]));return n}function WP(){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 rl(n){return this instanceof rl?(this.v=n,this):new rl(n)}function GP(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(d){r[d]&&(i[d]=function(p){return new Promise(function(y,w){s.push([d,p,y,w])>1||c(d,p)})})}function c(d,p){try{l(r[d](p))}catch(y){h(s[0][3],y)}}function l(d){d.value instanceof rl?Promise.resolve(d.value.v).then(u,f):h(s[0][2],d)}function u(d){c("next",d)}function f(d){c("throw",d)}function h(d,p){d(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function HP(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:rl(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function zP(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 lg=="function"?lg(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 QP(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function YP(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 KP(n){return n&&n.__esModule?n:{default:n}}function XP(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function JP(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 og,cg,vf=YI(()=>{og=o(function(n,e){return og=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])},og(n,e)},"extendStatics");o(NP,"__extends");cg=o(function(){return cg=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"),cg.apply(this,arguments)},"__assign");o(kP,"__rest");o(LP,"__decorate");o(MP,"__param");o(jP,"__metadata");o($P,"__awaiter");o(VP,"__generator");o(UP,"__createBinding");o(BP,"__exportStar");o(lg,"__values");o(Gw,"__read");o(qP,"__spread");o(WP,"__spreadArrays");o(rl,"__await");o(GP,"__asyncGenerator");o(HP,"__asyncDelegator");o(zP,"__asyncValues");o(QP,"__makeTemplateObject");o(YP,"__importStar");o(KP,"__importDefault");o(XP,"__classPrivateFieldGet");o(JP,"__classPrivateFieldSet")});var hg=_(fg=>{"use strict";Object.defineProperty(fg,"__esModule",{value:!0});var ug;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(ug||(ug={}));fg.default=ug});var Hw=_(dg=>{"use strict";Object.defineProperty(dg,"__esModule",{value:!0});var ZP=hg();Object.defineProperty(dg,"Lifecycle",{enumerable:!0,get:o(function(){return ZP.default},"get")})});var ua=_(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.defineInjectionTokenMetadata=Nn.getParamInfo=Nn.INJECTION_TOKEN_METADATA_KEY=void 0;Nn.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function eF(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(Nn.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(eF,"getParamInfo");Nn.getParamInfo=eF;function tF(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(Nn.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(Nn.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(tF,"defineInjectionTokenMetadata");Nn.defineInjectionTokenMetadata=tF});var pg=_(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.isClassProvider=void 0;function rF(n){return!!n.useClass}o(rF,"isClassProvider");_f.isClassProvider=rF});var mg=_(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.isFactoryProvider=void 0;function nF(n){return!!n.useFactory}o(nF,"isFactoryProvider");wf.isFactoryProvider=nF});var Sf=_(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.delay=so.DelayedConstructor=void 0;var bf=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}};so.DelayedConstructor=bf;function iF(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new bf(n)}o(iF,"delay");so.delay=iF});var Ef=_(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.isConstructorToken=Ti.isTransformDescriptor=Ti.isTokenDescriptor=Ti.isNormalToken=void 0;var sF=Sf();function aF(n){return typeof n=="string"||typeof n=="symbol"}o(aF,"isNormalToken");Ti.isNormalToken=aF;function oF(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(oF,"isTokenDescriptor");Ti.isTokenDescriptor=oF;function cF(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(cF,"isTransformDescriptor");Ti.isTransformDescriptor=cF;function lF(n){return typeof n=="function"||n instanceof sF.DelayedConstructor}o(lF,"isConstructorToken");Ti.isConstructorToken=lF});var gg=_(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.isTokenProvider=void 0;function uF(n){return!!n.useToken}o(uF,"isTokenProvider");Tf.isTokenProvider=uF});var yg=_(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});xf.isValueProvider=void 0;function fF(n){return n.useValue!=null}o(fF,"isValueProvider");xf.isValueProvider=fF});var vg=_(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var hF=pg();Object.defineProperty(fa,"isClassProvider",{enumerable:!0,get:o(function(){return hF.isClassProvider},"get")});var dF=mg();Object.defineProperty(fa,"isFactoryProvider",{enumerable:!0,get:o(function(){return dF.isFactoryProvider},"get")});var pF=Ef();Object.defineProperty(fa,"isNormalToken",{enumerable:!0,get:o(function(){return pF.isNormalToken},"get")});var mF=gg();Object.defineProperty(fa,"isTokenProvider",{enumerable:!0,get:o(function(){return mF.isTokenProvider},"get")});var gF=yg();Object.defineProperty(fa,"isValueProvider",{enumerable:!0,get:o(function(){return gF.isValueProvider},"get")})});var zw=_(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.isProvider=void 0;var yF=pg(),vF=yg(),_F=gg(),wF=mg();function bF(n){return yF.isClassProvider(n)||vF.isValueProvider(n)||_F.isTokenProvider(n)||wF.isFactoryProvider(n)}o(bF,"isProvider");Af.isProvider=bF});var bg=_(wg=>{"use strict";Object.defineProperty(wg,"__esModule",{value:!0});var _g=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,[])}};wg.default=_g});var Qw=_(Eg=>{"use strict";Object.defineProperty(Eg,"__esModule",{value:!0});var SF=bg(),Sg=class extends SF.default{static{o(this,"Registry")}};Eg.default=Sg});var Yw=_(xg=>{"use strict";Object.defineProperty(xg,"__esModule",{value:!0});var Tg=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};xg.default=Tg});var Ag=_(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.formatErrorCtor=void 0;function EF(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(EF,"formatDependency");function TF(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 j_(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(j_,"incrementNodeInspectorPort");function ym(){if(Ze.env.NO_COLOR||Ze.env.FORCE_COLOR==="0"||Ze.env.FORCE_COLOR==="false")return!1;if(Ze.env.FORCE_COLOR||Ze.env.CLICOLOR_FORCE!==void 0)return!0}o(ym,"useColor");vm.Command=gm;vm.useColor=ym});var q_=_(yn=>{var{Argument:V_}=Bu(),{Command:_m}=$_(),{CommanderError:lO,InvalidArgumentError:U_}=Bc(),{Help:uO}=lm(),{Option:B_}=dm();yn.program=new _m;yn.createCommand=n=>new _m(n);yn.createOption=(n,e)=>new B_(n,e);yn.createArgument=(n,e)=>new V_(n,e);yn.Command=_m;yn.Option=B_;yn.Argument=V_;yn.Help=uO;yn.CommanderError=lO;yn.InvalidArgumentError=U_;yn.InvalidOptionArgumentError=U_});var Gu=_(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.AssetClass=void 0;var G_;(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.TASK_PROTOTYPE_UID="75302770-279e-4a59-ba85-09df29725713",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.FLEETING_NOTE_UID="fca0a931-a01f-48e4-b72a-4af206c94bc7",n.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition"})(G_||(Wu.AssetClass=G_={}))});var zu=_(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.EffortStatus=void 0;var H_;(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"})(H_||(Hu.EffortStatus=H_={}))});var z_=_(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.hasPosition=fO;Qu.isFixed=hO;function fO(n){return typeof n.x=="number"&&typeof n.y=="number"}o(fO,"hasPosition");function hO(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(hO,"isFixed")});var Q_=_(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.createEmptyGraphData=dO;Yu.mergeGraphData=pO;function dO(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(dO,"createEmptyGraphData");function pO(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(pO,"mergeGraphData")});var wm=_(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.createEdgeId=mO;Ku.edgesEqual=gO;function mO(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(mO,"createEdgeId");function gO(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(gO,"edgesEqual")});var bm=_(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.BUILT_IN_EDGE_STYLES=At.BUILT_IN_NODE_STYLES=At.DEFAULT_EDGE_STYLE=At.DEFAULT_NODE_STYLE=At.RDF_TYPE_PREDICATES=void 0;At.mergeNodeStyles=yO;At.mergeEdgeStyles=vO;At.extractLocalName=_O;At.isClassType=wO;At.isTypePredicate=bO;At.isSubClassPredicate=SO;At.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"};At.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};At.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};At.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"}};At.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 yO(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(yO,"mergeNodeStyles");function vO(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(vO,"mergeEdgeStyles");function _O(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(_O,"extractLocalName");function wO(n){return n===At.RDF_TYPE_PREDICATES.RDFS_CLASS||n===At.RDF_TYPE_PREDICATES.OWL_CLASS}o(wO,"isClassType");function bO(n){return n===At.RDF_TYPE_PREDICATES.RDF_TYPE}o(bO,"isTypePredicate");function SO(n){return n===At.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(SO,"isSubClassPredicate")});var K_=_(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0})});var ze=_(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.IRI=void 0;var Sm=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)}}};Xu.IRI=Sm});var mt=_(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.Literal=void 0;na.parseLanguageTag=X_;na.createDirectionalLiteral=TO;na.createLiteralFromLanguageTag=xO;var EO="http://www.w3.org/2001/XMLSchema#string",qc=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===EO?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}};na.Literal=qc;function X_(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(X_,"parseLanguageTag");function TO(n,e,t){return new qc(n,void 0,e,t)}o(TO,"createDirectionalLiteral");function xO(n,e){let{language:t,direction:r}=X_(e);return new qc(n,void 0,t,r)}o(xO,"createLiteralFromLanguageTag")});var $t=_(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.BlankNode=void 0;var Ju=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())}};Zu.BlankNode=Ju;Ju.counter=0});var cn=_(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.Namespace=void 0;var J_=ze(),kr=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 J_.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new J_.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)}};ef.Namespace=kr;kr.RDF=new kr("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");kr.RDFS=new kr("rdfs","http://www.w3.org/2000/01/rdf-schema#");kr.OWL=new kr("owl","http://www.w3.org/2002/07/owl#");kr.XSD=new kr("xsd","http://www.w3.org/2001/XMLSchema#");kr.EXO=new kr("exo","https://exocortex.my/ontology/exo#");kr.EMS=new kr("ems","https://exocortex.my/ontology/ems#")});var Si=_(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.Triple=void 0;var Em=ze(),Tm=mt(),xm=$t(),Am=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 Em.IRI&&t instanceof Em.IRI||e instanceof xm.BlankNode&&t instanceof xm.BlankNode||e instanceof Tm.Literal&&t instanceof Tm.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 Em.IRI?`<${e.value}>`:e instanceof xm.BlankNode||e instanceof Tm.Literal||this.isQuotedTriple(e)?e.toString():""}};tf.Triple=Am});var Wc=_(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.QuotedTriple=void 0;var Cm=ze(),Im=mt(),Om=$t(),Rm=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 Cm.IRI&&t instanceof Cm.IRI||e instanceof Om.BlankNode&&t instanceof Om.BlankNode||e instanceof Im.Literal&&t instanceof Im.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 Cm.IRI?`<${e.value}>`:e instanceof Om.BlankNode||e instanceof Im.Literal||e instanceof n?e.toString():""}};rf.QuotedTriple=Rm});var Z_=_(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.QuotedTriple=kt.Triple=kt.Namespace=kt.BlankNode=kt.createLiteralFromLanguageTag=kt.createDirectionalLiteral=kt.parseLanguageTag=kt.Literal=kt.IRI=void 0;var AO=ze();Object.defineProperty(kt,"IRI",{enumerable:!0,get:o(function(){return AO.IRI},"get")});var nf=mt();Object.defineProperty(kt,"Literal",{enumerable:!0,get:o(function(){return nf.Literal},"get")});Object.defineProperty(kt,"parseLanguageTag",{enumerable:!0,get:o(function(){return nf.parseLanguageTag},"get")});Object.defineProperty(kt,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return nf.createDirectionalLiteral},"get")});Object.defineProperty(kt,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return nf.createLiteralFromLanguageTag},"get")});var CO=$t();Object.defineProperty(kt,"BlankNode",{enumerable:!0,get:o(function(){return CO.BlankNode},"get")});var IO=cn();Object.defineProperty(kt,"Namespace",{enumerable:!0,get:o(function(){return IO.Namespace},"get")});var OO=Si();Object.defineProperty(kt,"Triple",{enumerable:!0,get:o(function(){return OO.Triple},"get")});var RO=Wc();Object.defineProperty(kt,"QuotedTriple",{enumerable:!0,get:o(function(){return RO.QuotedTriple},"get")})});var sf=_(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.UUID_URL_NAMESPACE=_n.DEFAULT_LANGUAGE_TAG=_n.REQUIRED_PROPERTIES=_n.ALLOWED_PROPERTIES=_n.Exo003MetadataType=void 0;var vn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(vn||(_n.Exo003MetadataType=vn={}));_n.ALLOWED_PROPERTIES={[vn.Namespace]:["metadata","uri","aliases"],[vn.Anchor]:["metadata","uri","aliases"],[vn.BlankNode]:["metadata","uri","aliases"],[vn.Statement]:["metadata","subject","predicate","object","aliases"],[vn.Body]:["metadata","subject","predicate","aliases"]};_n.REQUIRED_PROPERTIES={[vn.Namespace]:["metadata","uri"],[vn.Anchor]:["metadata","uri"],[vn.BlankNode]:["metadata","uri"],[vn.Statement]:["metadata","subject","predicate","object"],[vn.Body]:["metadata","subject","predicate"]};_n.DEFAULT_LANGUAGE_TAG="ru";_n.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var ew=_(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var tw=_(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.default="00000000-0000-0000-0000-000000000000"});var rw=_(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.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 Gc=_(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});var PO=rw();function FO(n){return typeof n=="string"&&PO.default.test(n)}o(FO,"validate");Nm.default=FO});var Hc=_(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});var DO=Gc();function NO(n){if(!(0,DO.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(NO,"parse");km.default=NO});var Yi=_(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.unsafeStringify=void 0;var kO=Gc(),sr=[];for(let n=0;n<256;++n)sr.push((n+256).toString(16).slice(1));function nw(n,e=0){return(sr[n[e+0]]+sr[n[e+1]]+sr[n[e+2]]+sr[n[e+3]]+"-"+sr[n[e+4]]+sr[n[e+5]]+"-"+sr[n[e+6]]+sr[n[e+7]]+"-"+sr[n[e+8]]+sr[n[e+9]]+"-"+sr[n[e+10]]+sr[n[e+11]]+sr[n[e+12]]+sr[n[e+13]]+sr[n[e+14]]+sr[n[e+15]]).toLowerCase()}o(nw,"unsafeStringify");zc.unsafeStringify=nw;function LO(n,e=0){let t=nw(n,e);if(!(0,kO.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(LO,"stringify");zc.default=LO});var cf=_(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});var MO=require("crypto"),of=new Uint8Array(256),af=of.length;function jO(){return af>of.length-16&&((0,MO.randomFillSync)(of),af=0),of.slice(af,af+=16)}o(jO,"rng");Lm.default=jO});var Mm=_(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.updateV1State=void 0;var iw=cf(),$O=Yi(),Qc={};function VO(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=sw(n.random??n.rng?.()??(0,iw.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,iw.default)();aw(Qc,s,a),r=sw(a,Qc.msecs,Qc.nsecs,i?void 0:Qc.clockseq,i?void 0:Qc.node,e,t)}return e??(0,$O.unsafeStringify)(r)}o(VO,"v1");function aw(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(aw,"updateV1State");Yc.updateV1State=aw;function sw(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(sw,"v1Bytes");Yc.default=VO});var $m=_(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var UO=Hc(),BO=Yi();function qO(n){let e=typeof n=="string"?(0,UO.default)(n):n,t=WO(e);return typeof n=="string"?(0,BO.unsafeStringify)(t):t}o(qO,"v1ToV6");jm.default=qO;function WO(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(WO,"_v1ToV6")});var ow=_(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});var GO=require("crypto");function HO(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,GO.createHash)("md5").update(n).digest()}o(HO,"md5");Vm.default=HO});var Kc=_(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.URL=Ki.DNS=Ki.stringToBytes=void 0;var cw=Hc(),zO=Yi();function lw(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(lw,"stringToBytes");Ki.stringToBytes=lw;Ki.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ki.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function QO(n,e,t,r,i,s){let a=typeof t=="string"?lw(t):t,c=typeof r=="string"?(0,cw.default)(r):r;if(typeof r=="string"&&(r=(0,cw.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,zO.unsafeStringify)(l)}o(QO,"v35");Ki.default=QO});var fw=_(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.URL=ia.DNS=void 0;var YO=ow(),Um=Kc(),uw=Kc();Object.defineProperty(ia,"DNS",{enumerable:!0,get:o(function(){return uw.DNS},"get")});Object.defineProperty(ia,"URL",{enumerable:!0,get:o(function(){return uw.URL},"get")});function Bm(n,e,t,r){return(0,Um.default)(48,YO.default,n,e,t,r)}o(Bm,"v3");Bm.DNS=Um.DNS;Bm.URL=Um.URL;ia.default=Bm});var hw=_(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});var KO=require("crypto");qm.default={randomUUID:KO.randomUUID}});var pw=_(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});var dw=hw(),XO=cf(),JO=Yi();function ZO(n,e,t){if(dw.default.randomUUID&&!e&&!n)return dw.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,XO.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,JO.unsafeStringify)(r)}o(ZO,"v4");Wm.default=ZO});var mw=_(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});var eR=require("crypto");function tR(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,eR.createHash)("sha1").update(n).digest()}o(tR,"sha1");Gm.default=tR});var yw=_(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.URL=sa.DNS=void 0;var rR=mw(),Hm=Kc(),gw=Kc();Object.defineProperty(sa,"DNS",{enumerable:!0,get:o(function(){return gw.DNS},"get")});Object.defineProperty(sa,"URL",{enumerable:!0,get:o(function(){return gw.URL},"get")});function zm(n,e,t,r){return(0,Hm.default)(80,rR.default,n,e,t,r)}o(zm,"v5");zm.DNS=Hm.DNS;zm.URL=Hm.URL;sa.default=zm});var vw=_(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});var nR=Yi(),iR=Mm(),sR=$m();function aR(n,e,t){n??={},t??=0;let r=(0,iR.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,sR.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,nR.unsafeStringify)(r)}o(aR,"v6");Qm.default=aR});var _w=_(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});var oR=Hc(),cR=Yi();function lR(n){let e=typeof n=="string"?(0,oR.default)(n):n,t=uR(e);return typeof n=="string"?(0,cR.unsafeStringify)(t):t}o(lR,"v6ToV1");Ym.default=lR;function uR(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(uR,"_v6ToV1")});var Ew=_(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.updateV7State=void 0;var ww=cf(),fR=Yi(),Km={};function hR(n,e,t){let r;if(n)r=bw(n.random??n.rng?.()??(0,ww.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,ww.default)();Sw(Km,i,s),r=bw(s,Km.msecs,Km.seq,e,t)}return e??(0,fR.unsafeStringify)(r)}o(hR,"v7");function Sw(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(Sw,"updateV7State");Xc.updateV7State=Sw;function bw(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(bw,"v7Bytes");Xc.default=hR});var Tw=_(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});var dR=Gc();function pR(n){if(!(0,dR.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(pR,"version");Xm.default=pR});var Lr=_(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.version=rt.validate=rt.v7=rt.v6ToV1=rt.v6=rt.v5=rt.v4=rt.v3=rt.v1ToV6=rt.v1=rt.stringify=rt.parse=rt.NIL=rt.MAX=void 0;var mR=ew();Object.defineProperty(rt,"MAX",{enumerable:!0,get:o(function(){return mR.default},"get")});var gR=tw();Object.defineProperty(rt,"NIL",{enumerable:!0,get:o(function(){return gR.default},"get")});var yR=Hc();Object.defineProperty(rt,"parse",{enumerable:!0,get:o(function(){return yR.default},"get")});var vR=Yi();Object.defineProperty(rt,"stringify",{enumerable:!0,get:o(function(){return vR.default},"get")});var _R=Mm();Object.defineProperty(rt,"v1",{enumerable:!0,get:o(function(){return _R.default},"get")});var wR=$m();Object.defineProperty(rt,"v1ToV6",{enumerable:!0,get:o(function(){return wR.default},"get")});var bR=fw();Object.defineProperty(rt,"v3",{enumerable:!0,get:o(function(){return bR.default},"get")});var SR=pw();Object.defineProperty(rt,"v4",{enumerable:!0,get:o(function(){return SR.default},"get")});var ER=yw();Object.defineProperty(rt,"v5",{enumerable:!0,get:o(function(){return ER.default},"get")});var TR=vw();Object.defineProperty(rt,"v6",{enumerable:!0,get:o(function(){return TR.default},"get")});var xR=_w();Object.defineProperty(rt,"v6ToV1",{enumerable:!0,get:o(function(){return xR.default},"get")});var AR=Ew();Object.defineProperty(rt,"v7",{enumerable:!0,get:o(function(){return AR.default},"get")});var CR=Gc();Object.defineProperty(rt,"validate",{enumerable:!0,get:o(function(){return CR.default},"get")});var IR=Tw();Object.defineProperty(rt,"version",{enumerable:!0,get:o(function(){return IR.default},"get")})});var eg=_(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.Exo003UUIDGenerator=void 0;var Jm=Lr(),xw=sf(),Zm=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,Jm.v5)(e,xw.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,Jm.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,Jm.v5)(e,xw.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)}};lf.Exo003UUIDGenerator=Zm});var Cw=_(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});ff.Exo003Parser=void 0;var lt=sf(),Jc=eg(),_s=ze(),uf=mt(),Aw=$t(),OR=Si(),tg=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===lt.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(lt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(lt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=lt.ALLOWED_PROPERTIES[s],c=lt.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 lt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case lt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case lt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case lt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case lt.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 lt.Exo003MetadataType.Namespace:return{...r,metadata:lt.Exo003MetadataType.Namespace,uri:e.uri};case lt.Exo003MetadataType.Anchor:return{...r,metadata:lt.Exo003MetadataType.Anchor,uri:e.uri};case lt.Exo003MetadataType.BlankNode:return{...r,metadata:lt.Exo003MetadataType.BlankNode,uri:e.uri};case lt.Exo003MetadataType.Statement:return{...r,metadata:lt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case lt.Exo003MetadataType.Body:return{...r,metadata:lt.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 _s.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 _s.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 _s.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 _s.IRI(i.value);else if(i.type==="blank")s=new Aw.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 _s.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new _s.IRI(l.value);else if(l.type==="blank")u=new Aw.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new uf.Literal(f,new _s.IRI(l.datatype));else{let h=l.language||lt.DEFAULT_LANGUAGE_TAG;u=(0,uf.createDirectionalLiteral)(f,h,l.direction)}}return new OR.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new uf.Literal(t,new _s.IRI(r.datatype));let i=r?.language||lt.DEFAULT_LANGUAGE_TAG;return(0,uf.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(lt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case lt.Exo003MetadataType.Namespace:return Jc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case lt.Exo003MetadataType.Anchor:return Jc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case lt.Exo003MetadataType.BlankNode:return Jc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case lt.Exo003MetadataType.Statement:{let r=e;return Jc.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case lt.Exo003MetadataType.Body:{let r=e;return Jc.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};ff.Exo003Parser=tg});var rg=_(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.Exo003Parser=yr.Exo003UUIDGenerator=yr.UUID_URL_NAMESPACE=yr.DEFAULT_LANGUAGE_TAG=yr.REQUIRED_PROPERTIES=yr.ALLOWED_PROPERTIES=yr.Exo003MetadataType=void 0;var Zc=sf();Object.defineProperty(yr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Zc.Exo003MetadataType},"get")});Object.defineProperty(yr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Zc.ALLOWED_PROPERTIES},"get")});Object.defineProperty(yr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Zc.REQUIRED_PROPERTIES},"get")});Object.defineProperty(yr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Zc.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(yr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Zc.UUID_URL_NAMESPACE},"get")});var RR=eg();Object.defineProperty(yr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return RR.Exo003UUIDGenerator},"get")});var PR=Cw();Object.defineProperty(yr,"Exo003Parser",{enumerable:!0,get:o(function(){return PR.Exo003Parser},"get")})});var aa=_(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.WikiLinkHelpers=void 0;var hf=class{static{o(this,"WikiLinkHelpers")}static normalize(e){return e?e.replace(this.WIKI_LINK_PATTERN,"").trim():""}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)}};df.WikiLinkHelpers=hf;hf.WIKI_LINK_PATTERN=/\[\[|\]\]/g});var vr=_(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.EffortStatus=to.AssetClass=void 0;var FR=Gu();Object.defineProperty(to,"AssetClass",{enumerable:!0,get:o(function(){return FR.AssetClass},"get")});var DR=zu();Object.defineProperty(to,"EffortStatus",{enumerable:!0,get:o(function(){return DR.EffortStatus},"get")})});var ws=_(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.hasClass=ca;_r.isAreaOrProject=NR;_r.isEffort=kR;_r.hasStatus=LR;_r.isAssetArchived=MR;_r.hasEmptyProperties=jR;_r.needsFolderRepair=$R;_r.getTodayDateString=ng;_r.isPlannedForToday=VR;_r.hasPlannedStartTimestamp=UR;_r.extractDailyNoteDate=BR;_r.isCurrentDateGteDay=qR;_r.inheritsFromPrototype=Rw;_r.isPrototypeClass=GR;var Ow=aa(),oa=vr();function ca(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>Ow.WikiLinkHelpers.normalize(r)===e):!1}o(ca,"hasClass");function NR(n){return ca(n,oa.AssetClass.AREA)||ca(n,oa.AssetClass.PROJECT)}o(NR,"isAreaOrProject");function kR(n){return ca(n,oa.AssetClass.TASK)||ca(n,oa.AssetClass.PROJECT)||ca(n,oa.AssetClass.MEETING)}o(kR,"isEffort");function LR(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?Ow.WikiLinkHelpers.normalize(t)===e:!1}o(LR,"hasStatus");function MR(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(MR,"isAssetArchived");function jR(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(jR,"hasEmptyProperties");function $R(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o($R,"needsFolderRepair");function ng(){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(ng,"getTodayDateString");function VR(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=ng();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(VR,"isPlannedForToday");function UR(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(UR,"hasPlannedStartTimestamp");function BR(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(BR,"extractDailyNoteDate");function qR(n){return ng()>=n}o(qR,"isCurrentDateGteDay");function Iw(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(Iw,"normalizeWithQuotes");var WR=10;function Rw(n,e=WR){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=Iw(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===oa.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let h=Array.isArray(f)?f:[f];for(let d of h){let p=Iw(d);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(Rw,"inheritsFromPrototype");function GR(n,e){return ca(n,oa.AssetClass.CLASS)?Rw(e):!1}o(GR,"isPrototypeClass")});var Pw=_(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.canCreateTask=HR;no.canCreateRelatedTask=zR;no.canConvertTaskToProject=QR;no.canSetCriticalityZone=YR;var ro=ws(),ig=vr();function HR(n){return(0,ro.isAreaOrProject)(n.instanceClass)}o(HR,"canCreateTask");function zR(n){return!(!(0,ro.hasClass)(n.instanceClass,ig.AssetClass.TASK)||(0,ro.isAssetArchived)(n.isArchived))}o(zR,"canCreateRelatedTask");function QR(n){return(0,ro.hasClass)(n.instanceClass,ig.AssetClass.TASK)}o(QR,"canConvertTaskToProject");function YR(n){return!(!(0,ro.hasClass)(n.instanceClass,ig.AssetClass.TASK)||(0,ro.isAssetArchived)(n.isArchived))}o(YR,"canSetCriticalityZone")});var Fw=_(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.canCreateProject=KR;io.canMoveToAnalysis=XR;io.canMoveToToDo=JR;io.canConvertProjectToTask=ZR;var bs=ws(),Ss=vr();function KR(n){return(0,bs.hasClass)(n.instanceClass,Ss.AssetClass.AREA)||(0,bs.hasClass)(n.instanceClass,Ss.AssetClass.INITIATIVE)||(0,bs.hasClass)(n.instanceClass,Ss.AssetClass.PROJECT)}o(KR,"canCreateProject");function XR(n){return(0,bs.hasClass)(n.instanceClass,Ss.AssetClass.PROJECT)?(0,bs.hasStatus)(n.currentStatus,Ss.EffortStatus.BACKLOG):!1}o(XR,"canMoveToAnalysis");function JR(n){return(0,bs.hasClass)(n.instanceClass,Ss.AssetClass.PROJECT)?(0,bs.hasStatus)(n.currentStatus,Ss.EffortStatus.ANALYSIS):!1}o(JR,"canMoveToToDo");function ZR(n){return(0,bs.hasClass)(n.instanceClass,Ss.AssetClass.PROJECT)}o(ZR,"canConvertProjectToTask")});var kw=_(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.canCreateChildArea=eP;pf.canSetActiveFocus=tP;var Dw=ws(),Nw=vr();function eP(n){return(0,Dw.hasClass)(n.instanceClass,Nw.AssetClass.AREA)}o(eP,"canCreateChildArea");function tP(n){return(0,Dw.hasClass)(n.instanceClass,Nw.AssetClass.AREA)}o(tP,"canSetActiveFocus")});var Mw=_(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.canPlanOnToday=rP;jr.canPlanForEvening=nP;jr.canShiftDayBackward=iP;jr.canShiftDayForward=sP;jr.canSetDraftStatus=aP;jr.canMoveToBacklog=oP;jr.canStartEffort=cP;jr.canMarkDone=lP;jr.canTrashEffort=uP;jr.canVoteOnEffort=fP;jr.canRollbackStatus=hP;jr.canArchiveTask=dP;jr.canMarkReviewed=pP;var Lw=aa(),at=ws(),Mr=vr();function rP(n){return!(!(0,at.isEffort)(n.instanceClass)||(0,at.isPlannedForToday)(n.metadata))}o(rP,"canPlanOnToday");function nP(n){return!(0,at.hasClass)(n.instanceClass,Mr.AssetClass.TASK)&&!(0,at.hasClass)(n.instanceClass,Mr.AssetClass.MEETING)?!1:(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.BACKLOG)}o(nP,"canPlanForEvening");function iP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasPlannedStartTimestamp)(n.metadata):!1}o(iP,"canShiftDayBackward");function sP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasPlannedStartTimestamp)(n.metadata):!1}o(sP,"canShiftDayForward");function aP(n){return(0,at.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(aP,"canSetDraftStatus");function oP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.DRAFT):!1}o(oP,"canMoveToBacklog");function cP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasClass)(n.instanceClass,Mr.AssetClass.TASK)||(0,at.hasClass)(n.instanceClass,Mr.AssetClass.MEETING)?(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.BACKLOG):(0,at.hasClass)(n.instanceClass,Mr.AssetClass.PROJECT)?(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.TODO):!1:!1}o(cP,"canStartEffort");function lP(n){return(0,at.isEffort)(n.instanceClass)?(0,at.hasStatus)(n.currentStatus,Mr.EffortStatus.DOING):!1}o(lP,"canMarkDone");function uP(n){return(0,at.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=Lw.WikiLinkHelpers.normalize(r);return i===Mr.EffortStatus.TRASHED||i===Mr.EffortStatus.DONE}):!0:!1}o(uP,"canTrashEffort");function fP(n){return!(!(0,at.isEffort)(n.instanceClass)||(0,at.isAssetArchived)(n.isArchived))}o(fP,"canVoteOnEffort");function hP(n){if(!(0,at.isEffort)(n.instanceClass)||(0,at.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||Lw.WikiLinkHelpers.normalize(e)===Mr.EffortStatus.TRASHED)}o(hP,"canRollbackStatus");function dP(n){return!(0,at.isAssetArchived)(n.isArchived)}o(dP,"canArchiveTask");function pP(n){return!(!(0,at.hasClass)(n.instanceClass,Mr.AssetClass.TASK)&&!(0,at.hasClass)(n.instanceClass,Mr.AssetClass.PROJECT)||(0,at.isAssetArchived)(n.isArchived))}o(pP,"canMarkReviewed")});var jw=_(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.canCreateEvent=mP;wn.canCreateInstance=gP;wn.canCleanProperties=yP;wn.canRepairFolder=vP;wn.canRenameToUid=_P;wn.canCopyLabelToAliases=wP;wn.canCreateNarrowerConcept=bP;wn.canCreateSubclass=SP;wn.canCreateTaskForDailyNote=EP;wn.canCopyFleetingNoteLabel=TP;var wr=ws(),Dn=vr();function mP(n){return(0,wr.isAreaOrProject)(n.instanceClass)}o(mP,"canCreateEvent");function gP(n){return(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.TASK_PROTOTYPE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.TASK_PROTOTYPE_UID)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.MEETING_PROTOTYPE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.EVENT_PROTOTYPE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.PROJECT_PROTOTYPE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,wr.isPrototypeClass)(n.instanceClass,n.metadata)}o(gP,"canCreateInstance");function yP(n){return(0,wr.hasEmptyProperties)(n.metadata)}o(yP,"canCleanProperties");function vP(n){return(0,wr.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(vP,"canRepairFolder");function _P(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(_P,"canRenameToUid");function wP(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(wP,"canCopyLabelToAliases");function bP(n){return(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.CONCEPT)}o(bP,"canCreateNarrowerConcept");function SP(n){return(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.CLASS)}o(SP,"canCreateSubclass");function EP(n){return!(!(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.DAILY_NOTE)||n.isArchived||!(0,wr.extractDailyNoteDate)(n.metadata))}o(EP,"canCreateTaskForDailyNote");function TP(n){return(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.FLEETING_NOTE)||(0,wr.hasClass)(n.instanceClass,Dn.AssetClass.FLEETING_NOTE_UID)}o(TP,"canCopyFleetingNoteLabel")});var Vw=_(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.canCopyFleetingNoteLabel=N.canCreateTaskForDailyNote=N.canCreateSubclass=N.canCreateNarrowerConcept=N.canCopyLabelToAliases=N.canRenameToUid=N.canRepairFolder=N.canCleanProperties=N.canCreateInstance=N.canCreateEvent=N.canMarkReviewed=N.canArchiveTask=N.canRollbackStatus=N.canVoteOnEffort=N.canTrashEffort=N.canMarkDone=N.canStartEffort=N.canMoveToBacklog=N.canSetDraftStatus=N.canShiftDayForward=N.canShiftDayBackward=N.canPlanForEvening=N.canPlanOnToday=N.canSetActiveFocus=N.canCreateChildArea=N.canConvertProjectToTask=N.canMoveToToDo=N.canMoveToAnalysis=N.canCreateProject=N.canSetCriticalityZone=N.canConvertTaskToProject=N.canCreateRelatedTask=N.canCreateTask=N.isPrototypeClass=N.inheritsFromPrototype=N.isCurrentDateGteDay=N.extractDailyNoteDate=N.hasPlannedStartTimestamp=N.isPlannedForToday=N.getTodayDateString=N.needsFolderRepair=N.hasEmptyProperties=N.isAssetArchived=N.hasStatus=N.isEffort=N.isAreaOrProject=N.hasClass=void 0;var Xr=ws();Object.defineProperty(N,"hasClass",{enumerable:!0,get:o(function(){return Xr.hasClass},"get")});Object.defineProperty(N,"isAreaOrProject",{enumerable:!0,get:o(function(){return Xr.isAreaOrProject},"get")});Object.defineProperty(N,"isEffort",{enumerable:!0,get:o(function(){return Xr.isEffort},"get")});Object.defineProperty(N,"hasStatus",{enumerable:!0,get:o(function(){return Xr.hasStatus},"get")});Object.defineProperty(N,"isAssetArchived",{enumerable:!0,get:o(function(){return Xr.isAssetArchived},"get")});Object.defineProperty(N,"hasEmptyProperties",{enumerable:!0,get:o(function(){return Xr.hasEmptyProperties},"get")});Object.defineProperty(N,"needsFolderRepair",{enumerable:!0,get:o(function(){return Xr.needsFolderRepair},"get")});Object.defineProperty(N,"getTodayDateString",{enumerable:!0,get:o(function(){return Xr.getTodayDateString},"get")});Object.defineProperty(N,"isPlannedForToday",{enumerable:!0,get:o(function(){return Xr.isPlannedForToday},"get")});Object.defineProperty(N,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return Xr.hasPlannedStartTimestamp},"get")});Object.defineProperty(N,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return Xr.extractDailyNoteDate},"get")});Object.defineProperty(N,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return Xr.isCurrentDateGteDay},"get")});Object.defineProperty(N,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return Xr.inheritsFromPrototype},"get")});Object.defineProperty(N,"isPrototypeClass",{enumerable:!0,get:o(function(){return Xr.isPrototypeClass},"get")});var mf=Pw();Object.defineProperty(N,"canCreateTask",{enumerable:!0,get:o(function(){return mf.canCreateTask},"get")});Object.defineProperty(N,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return mf.canCreateRelatedTask},"get")});Object.defineProperty(N,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return mf.canConvertTaskToProject},"get")});Object.defineProperty(N,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return mf.canSetCriticalityZone},"get")});var gf=Fw();Object.defineProperty(N,"canCreateProject",{enumerable:!0,get:o(function(){return gf.canCreateProject},"get")});Object.defineProperty(N,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return gf.canMoveToAnalysis},"get")});Object.defineProperty(N,"canMoveToToDo",{enumerable:!0,get:o(function(){return gf.canMoveToToDo},"get")});Object.defineProperty(N,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return gf.canConvertProjectToTask},"get")});var $w=kw();Object.defineProperty(N,"canCreateChildArea",{enumerable:!0,get:o(function(){return $w.canCreateChildArea},"get")});Object.defineProperty(N,"canSetActiveFocus",{enumerable:!0,get:o(function(){return $w.canSetActiveFocus},"get")});var ln=Mw();Object.defineProperty(N,"canPlanOnToday",{enumerable:!0,get:o(function(){return ln.canPlanOnToday},"get")});Object.defineProperty(N,"canPlanForEvening",{enumerable:!0,get:o(function(){return ln.canPlanForEvening},"get")});Object.defineProperty(N,"canShiftDayBackward",{enumerable:!0,get:o(function(){return ln.canShiftDayBackward},"get")});Object.defineProperty(N,"canShiftDayForward",{enumerable:!0,get:o(function(){return ln.canShiftDayForward},"get")});Object.defineProperty(N,"canSetDraftStatus",{enumerable:!0,get:o(function(){return ln.canSetDraftStatus},"get")});Object.defineProperty(N,"canMoveToBacklog",{enumerable:!0,get:o(function(){return ln.canMoveToBacklog},"get")});Object.defineProperty(N,"canStartEffort",{enumerable:!0,get:o(function(){return ln.canStartEffort},"get")});Object.defineProperty(N,"canMarkDone",{enumerable:!0,get:o(function(){return ln.canMarkDone},"get")});Object.defineProperty(N,"canTrashEffort",{enumerable:!0,get:o(function(){return ln.canTrashEffort},"get")});Object.defineProperty(N,"canVoteOnEffort",{enumerable:!0,get:o(function(){return ln.canVoteOnEffort},"get")});Object.defineProperty(N,"canRollbackStatus",{enumerable:!0,get:o(function(){return ln.canRollbackStatus},"get")});Object.defineProperty(N,"canArchiveTask",{enumerable:!0,get:o(function(){return ln.canArchiveTask},"get")});Object.defineProperty(N,"canMarkReviewed",{enumerable:!0,get:o(function(){return ln.canMarkReviewed},"get")});var Ei=jw();Object.defineProperty(N,"canCreateEvent",{enumerable:!0,get:o(function(){return Ei.canCreateEvent},"get")});Object.defineProperty(N,"canCreateInstance",{enumerable:!0,get:o(function(){return Ei.canCreateInstance},"get")});Object.defineProperty(N,"canCleanProperties",{enumerable:!0,get:o(function(){return Ei.canCleanProperties},"get")});Object.defineProperty(N,"canRepairFolder",{enumerable:!0,get:o(function(){return Ei.canRepairFolder},"get")});Object.defineProperty(N,"canRenameToUid",{enumerable:!0,get:o(function(){return Ei.canRenameToUid},"get")});Object.defineProperty(N,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return Ei.canCopyLabelToAliases},"get")});Object.defineProperty(N,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return Ei.canCreateNarrowerConcept},"get")});Object.defineProperty(N,"canCreateSubclass",{enumerable:!0,get:o(function(){return Ei.canCreateSubclass},"get")});Object.defineProperty(N,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return Ei.canCreateTaskForDailyNote},"get")});Object.defineProperty(N,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return Ei.canCopyFleetingNoteLabel},"get")})});var Uw=_(la=>{"use strict";var xP=la&&la.__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]})),AP=la&&la.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&xP(e,n,t)};Object.defineProperty(la,"__esModule",{value:!0});AP(Vw(),la)});var ag=_(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.PropertyFieldType=void 0;el.rangeToFieldType=OP;var ar;(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"})(ar||(el.PropertyFieldType=ar={}));var Bw="http://www.w3.org/2001/XMLSchema#",CP="https://exocortex.my/ontology/exo#",IP="https://exocortex.my/ontology/ems#";function OP(n){if(!n)return ar.Unknown;let e=n.trim();if(!e)return ar.Unknown;if(e.startsWith(Bw)){let t=e.substring(Bw.length);return sg(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return sg(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return sg(r)}return e.startsWith(IP)||e.startsWith("ems:")?RP(e):e.startsWith(CP)||e.startsWith("exo:")||PP(e)?ar.Reference:ar.Text}o(OP,"rangeToFieldType");function sg(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return ar.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 ar.Number;case"date":return ar.Date;case"datetime":case"datetimestamp":return ar.DateTime;case"boolean":return ar.Boolean;case"time":return ar.Timestamp;default:return ar.Text}}o(sg,"xsdTypeToFieldType");function RP(n){let e=n.toLowerCase();return e.includes("effortstatus")?ar.StatusSelect:e.includes("tasksize")?ar.SizeSelect:ar.Reference}o(RP,"emsTypeToFieldType");function PP(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(PP,"isClassReference")});var Ww=_(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.propertyNameToUri=FP;tl.uriToPropertyName=qw;tl.extractPropertyLabel=DP;function FP(n){return n.replace(/^([a-z]+)__/,"$1:")}o(FP,"propertyNameToUri");function qw(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(qw,"uriToPropertyName");function DP(n){let r=(n.includes(":")?qw(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(DP,"extractPropertyLabel")});var yf={};O_(yf,{__assign:()=>cg,__asyncDelegator:()=>HP,__asyncGenerator:()=>GP,__asyncValues:()=>zP,__await:()=>rl,__awaiter:()=>$P,__classPrivateFieldGet:()=>XP,__classPrivateFieldSet:()=>JP,__createBinding:()=>UP,__decorate:()=>LP,__exportStar:()=>BP,__extends:()=>NP,__generator:()=>VP,__importDefault:()=>KP,__importStar:()=>YP,__makeTemplateObject:()=>QP,__metadata:()=>jP,__param:()=>MP,__read:()=>Gw,__rest:()=>kP,__spread:()=>qP,__spreadArrays:()=>WP,__values:()=>lg});function NP(n,e){og(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function kP(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 LP(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 MP(n,e){return function(t,r){e(t,r,n)}}function jP(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function $P(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(h){a(h)}}o(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(h){a(h)}}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 VP(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 UP(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function BP(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function lg(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 Gw(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 qP(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Gw(arguments[e]));return n}function WP(){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 rl(n){return this instanceof rl?(this.v=n,this):new rl(n)}function GP(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(d){r[d]&&(i[d]=function(p){return new Promise(function(y,w){s.push([d,p,y,w])>1||c(d,p)})})}function c(d,p){try{l(r[d](p))}catch(y){h(s[0][3],y)}}function l(d){d.value instanceof rl?Promise.resolve(d.value.v).then(u,f):h(s[0][2],d)}function u(d){c("next",d)}function f(d){c("throw",d)}function h(d,p){d(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function HP(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:rl(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function zP(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 lg=="function"?lg(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 QP(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function YP(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 KP(n){return n&&n.__esModule?n:{default:n}}function XP(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function JP(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 og,cg,vf=YI(()=>{og=o(function(n,e){return og=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])},og(n,e)},"extendStatics");o(NP,"__extends");cg=o(function(){return cg=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"),cg.apply(this,arguments)},"__assign");o(kP,"__rest");o(LP,"__decorate");o(MP,"__param");o(jP,"__metadata");o($P,"__awaiter");o(VP,"__generator");o(UP,"__createBinding");o(BP,"__exportStar");o(lg,"__values");o(Gw,"__read");o(qP,"__spread");o(WP,"__spreadArrays");o(rl,"__await");o(GP,"__asyncGenerator");o(HP,"__asyncDelegator");o(zP,"__asyncValues");o(QP,"__makeTemplateObject");o(YP,"__importStar");o(KP,"__importDefault");o(XP,"__classPrivateFieldGet");o(JP,"__classPrivateFieldSet")});var hg=_(fg=>{"use strict";Object.defineProperty(fg,"__esModule",{value:!0});var ug;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(ug||(ug={}));fg.default=ug});var Hw=_(dg=>{"use strict";Object.defineProperty(dg,"__esModule",{value:!0});var ZP=hg();Object.defineProperty(dg,"Lifecycle",{enumerable:!0,get:o(function(){return ZP.default},"get")})});var ua=_(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.defineInjectionTokenMetadata=Nn.getParamInfo=Nn.INJECTION_TOKEN_METADATA_KEY=void 0;Nn.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function eF(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(Nn.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(eF,"getParamInfo");Nn.getParamInfo=eF;function tF(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(Nn.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(Nn.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(tF,"defineInjectionTokenMetadata");Nn.defineInjectionTokenMetadata=tF});var pg=_(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.isClassProvider=void 0;function rF(n){return!!n.useClass}o(rF,"isClassProvider");_f.isClassProvider=rF});var mg=_(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.isFactoryProvider=void 0;function nF(n){return!!n.useFactory}o(nF,"isFactoryProvider");wf.isFactoryProvider=nF});var Sf=_(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.delay=so.DelayedConstructor=void 0;var bf=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}};so.DelayedConstructor=bf;function iF(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new bf(n)}o(iF,"delay");so.delay=iF});var Ef=_(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.isConstructorToken=Ti.isTransformDescriptor=Ti.isTokenDescriptor=Ti.isNormalToken=void 0;var sF=Sf();function aF(n){return typeof n=="string"||typeof n=="symbol"}o(aF,"isNormalToken");Ti.isNormalToken=aF;function oF(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(oF,"isTokenDescriptor");Ti.isTokenDescriptor=oF;function cF(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(cF,"isTransformDescriptor");Ti.isTransformDescriptor=cF;function lF(n){return typeof n=="function"||n instanceof sF.DelayedConstructor}o(lF,"isConstructorToken");Ti.isConstructorToken=lF});var gg=_(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.isTokenProvider=void 0;function uF(n){return!!n.useToken}o(uF,"isTokenProvider");Tf.isTokenProvider=uF});var yg=_(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});xf.isValueProvider=void 0;function fF(n){return n.useValue!=null}o(fF,"isValueProvider");xf.isValueProvider=fF});var vg=_(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var hF=pg();Object.defineProperty(fa,"isClassProvider",{enumerable:!0,get:o(function(){return hF.isClassProvider},"get")});var dF=mg();Object.defineProperty(fa,"isFactoryProvider",{enumerable:!0,get:o(function(){return dF.isFactoryProvider},"get")});var pF=Ef();Object.defineProperty(fa,"isNormalToken",{enumerable:!0,get:o(function(){return pF.isNormalToken},"get")});var mF=gg();Object.defineProperty(fa,"isTokenProvider",{enumerable:!0,get:o(function(){return mF.isTokenProvider},"get")});var gF=yg();Object.defineProperty(fa,"isValueProvider",{enumerable:!0,get:o(function(){return gF.isValueProvider},"get")})});var zw=_(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.isProvider=void 0;var yF=pg(),vF=yg(),_F=gg(),wF=mg();function bF(n){return yF.isClassProvider(n)||vF.isValueProvider(n)||_F.isTokenProvider(n)||wF.isFactoryProvider(n)}o(bF,"isProvider");Af.isProvider=bF});var bg=_(wg=>{"use strict";Object.defineProperty(wg,"__esModule",{value:!0});var _g=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,[])}};wg.default=_g});var Qw=_(Eg=>{"use strict";Object.defineProperty(Eg,"__esModule",{value:!0});var SF=bg(),Sg=class extends SF.default{static{o(this,"Registry")}};Eg.default=Sg});var Yw=_(xg=>{"use strict";Object.defineProperty(xg,"__esModule",{value:!0});var Tg=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};xg.default=Tg});var Ag=_(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.formatErrorCtor=void 0;function EF(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(EF,"formatDependency");function TF(n,e,t=" "){return[n,...e.message.split(`
|
|
32
32
|
`).map(r=>t+r)].join(`
|
|
33
|
-
`)}o(TF,"composeErrorMessage");function xF(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=EF(r,e);return TF(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(xF,"formatErrorCtor");Cf.formatErrorCtor=xF});var Kw=_(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.isDisposable=void 0;function AF(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(AF,"isDisposable");If.isDisposable=AF});var Jw=_(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.PostResolutionInterceptors=ha.PreResolutionInterceptors=void 0;var Xw=bg(),Of=class extends Xw.default{static{o(this,"PreResolutionInterceptors")}};ha.PreResolutionInterceptors=Of;var Rf=class extends Xw.default{static{o(this,"PostResolutionInterceptors")}};ha.PostResolutionInterceptors=Rf;var Cg=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new Of,this.postResolution=new Rf}};ha.default=Cg});var Ss=_(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.instance=Xi.typeInfo=void 0;var CF=(vf(),rm(yf)),$r=vg(),IF=zw(),Pf=Ef(),OF=Qw(),Jr=hg(),Ff=Yw(),RF=Ag(),PF=Sf(),FF=Kw(),DF=Jw();Xi.typeInfo=new Map;var Ig=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new OF.default,this.interceptors=new DF.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:Jr.default.Transient}){this.ensureNotDisposed();let i;if(IF.isProvider(t)?i=t:i={useClass:t},$r.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&&$r.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===Jr.default.Singleton||r.lifecycle==Jr.default.ContainerScoped||r.lifecycle==Jr.default.ResolutionScoped)&&($r.isValueProvider(i)||$r.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${Jr.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),$r.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(),$r.isNormalToken(e)){if($r.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:Jr.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Jr.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!$r.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:Jr.default.Singleton})}resolve(e,t=new Ff.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&$r.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(Pf.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===Jr.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===Jr.default.Singleton,i=e.options.lifecycle===Jr.default.ContainerScoped,s=r||i,a;return $r.isValueProvider(e.provider)?a=e.provider.useValue:$r.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):$r.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):$r.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===Jr.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new Ff.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&$r.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=>!$r.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===Jr.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===Jr.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 CF.__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 PF.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Xi.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 FF.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return Pf.isTokenDescriptor(r)?Pf.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Ff.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 Ff.default,r.isOptional):this.resolve(r.token,e,r.isOptional):Pf.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(RF.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Xi.instance=new Ig;Xi.default=Xi.instance});var Zw=_(Rg=>{"use strict";Object.defineProperty(Rg,"__esModule",{value:!0});var NF=ua(),Ji=Ss(),Og=Ef(),kF=Ag();function LF(){return function(n){let e=NF.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return Og.isTokenDescriptor(r)?Og.isTransformDescriptor(r)?r.multiple?Ji.instance.resolve(r.transform).transform(Ji.instance.resolveAll(r.token),...r.transformArgs):Ji.instance.resolve(r.transform).transform(Ji.instance.resolve(r.token),...r.transformArgs):r.multiple?Ji.instance.resolveAll(r.token):Ji.instance.resolve(r.token):Og.isTransformDescriptor(r)?Ji.instance.resolve(r.transform).transform(Ji.instance.resolve(r.token),...r.transformArgs):Ji.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(kF.formatErrorCtor(n,a,s))}})))}}}}o(LF,"autoInjectable");Rg.default=LF});var eb=_(Pg=>{"use strict";Object.defineProperty(Pg,"__esModule",{value:!0});var MF=ua();function jF(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return MF.defineInjectionTokenMetadata(t)}o(jF,"inject");Pg.default=jF});var Df=_(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});var $F=ua(),VF=Ss(),tb=Ss();function UF(n){return function(e){VF.typeInfo.set(e,$F.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{tb.instance.register(t,e)}):tb.instance.register(n.token,e))}}o(UF,"injectable");Fg.default=UF});var rb=_(Dg=>{"use strict";Object.defineProperty(Dg,"__esModule",{value:!0});var BF=(vf(),rm(yf)),qF=Ss();function WF(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=BF.__rest(t,["token","options"]);return qF.instance.register(r,s,i)}),e}}o(WF,"registry");Dg.default=WF});var nb=_(Ng=>{"use strict";Object.defineProperty(Ng,"__esModule",{value:!0});var GF=Df(),HF=Ss();function zF(){return function(n){GF.default()(n),HF.instance.registerSingleton(n)}}o(zF,"singleton");Ng.default=zF});var ib=_(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});var QF=ua();function YF(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return QF.defineInjectionTokenMetadata(t)}o(YF,"injectAll");kg.default=YF});var sb=_(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});var KF=ua();function XF(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return KF.defineInjectionTokenMetadata(r)}o(XF,"injectAllWithTransform");Lg.default=XF});var ab=_(Mg=>{"use strict";Object.defineProperty(Mg,"__esModule",{value:!0});var JF=ua();function ZF(n,e,...t){return JF.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(ZF,"injectWithTransform");Mg.default=ZF});var ob=_(jg=>{"use strict";Object.defineProperty(jg,"__esModule",{value:!0});var eD=Df(),tD=Ss();function rD(n,e){return function(t){eD.default()(t),tD.instance.register(e||t,t,{lifecycle:n})}}o(rD,"scoped");jg.default=rD});var cb=_(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});var nD=Zw();Object.defineProperty(kn,"autoInjectable",{enumerable:!0,get:o(function(){return nD.default},"get")});var iD=eb();Object.defineProperty(kn,"inject",{enumerable:!0,get:o(function(){return iD.default},"get")});var sD=Df();Object.defineProperty(kn,"injectable",{enumerable:!0,get:o(function(){return sD.default},"get")});var aD=rb();Object.defineProperty(kn,"registry",{enumerable:!0,get:o(function(){return aD.default},"get")});var oD=nb();Object.defineProperty(kn,"singleton",{enumerable:!0,get:o(function(){return oD.default},"get")});var cD=ib();Object.defineProperty(kn,"injectAll",{enumerable:!0,get:o(function(){return cD.default},"get")});var lD=sb();Object.defineProperty(kn,"injectAllWithTransform",{enumerable:!0,get:o(function(){return lD.default},"get")});var uD=ab();Object.defineProperty(kn,"injectWithTransform",{enumerable:!0,get:o(function(){return uD.default},"get")});var fD=ob();Object.defineProperty(kn,"scoped",{enumerable:!0,get:o(function(){return fD.default},"get")})});var lb=_($g=>{"use strict";Object.defineProperty($g,"__esModule",{value:!0});function hD(n){let e;return t=>(e==null&&(e=n(t)),e)}o(hD,"instanceCachingFactory");$g.default=hD});var ub=_(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});function dD(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(dD,"instancePerContainerCachingFactory");Vg.default=dD});var fb=_(Ug=>{"use strict";Object.defineProperty(Ug,"__esModule",{value:!0});function pD(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(pD,"predicateAwareClassFactory");Ug.default=pD});var hb=_(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});var mD=lb();Object.defineProperty(nl,"instanceCachingFactory",{enumerable:!0,get:o(function(){return mD.default},"get")});var gD=ub();Object.defineProperty(nl,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return gD.default},"get")});var yD=fb();Object.defineProperty(nl,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return yD.default},"get")})});var Ue=_(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});var Bg=(vf(),rm(yf));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 vD=Hw();Object.defineProperty(Es,"Lifecycle",{enumerable:!0,get:o(function(){return vD.Lifecycle},"get")});Bg.__exportStar(cb(),Es);Bg.__exportStar(hb(),Es);Bg.__exportStar(vg(),Es);var _D=Sf();Object.defineProperty(Es,"delay",{enumerable:!0,get:o(function(){return _D.delay},"get")});var wD=Ss();Object.defineProperty(Es,"container",{enumerable:!0,get:o(function(){return wD.instance},"get")})});var bn=_(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.MetadataHelpers=void 0;var qg=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(([s,a])=>{if(Array.isArray(a)){let c=a.map(l=>` - ${l}`).join(`
|
|
33
|
+
`)}o(TF,"composeErrorMessage");function xF(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=EF(r,e);return TF(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(xF,"formatErrorCtor");Cf.formatErrorCtor=xF});var Kw=_(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.isDisposable=void 0;function AF(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(AF,"isDisposable");If.isDisposable=AF});var Jw=_(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.PostResolutionInterceptors=ha.PreResolutionInterceptors=void 0;var Xw=bg(),Of=class extends Xw.default{static{o(this,"PreResolutionInterceptors")}};ha.PreResolutionInterceptors=Of;var Rf=class extends Xw.default{static{o(this,"PostResolutionInterceptors")}};ha.PostResolutionInterceptors=Rf;var Cg=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new Of,this.postResolution=new Rf}};ha.default=Cg});var Es=_(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.instance=Xi.typeInfo=void 0;var CF=(vf(),rm(yf)),$r=vg(),IF=zw(),Pf=Ef(),OF=Qw(),Jr=hg(),Ff=Yw(),RF=Ag(),PF=Sf(),FF=Kw(),DF=Jw();Xi.typeInfo=new Map;var Ig=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new OF.default,this.interceptors=new DF.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:Jr.default.Transient}){this.ensureNotDisposed();let i;if(IF.isProvider(t)?i=t:i={useClass:t},$r.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&&$r.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===Jr.default.Singleton||r.lifecycle==Jr.default.ContainerScoped||r.lifecycle==Jr.default.ResolutionScoped)&&($r.isValueProvider(i)||$r.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${Jr.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),$r.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(),$r.isNormalToken(e)){if($r.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:Jr.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Jr.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!$r.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:Jr.default.Singleton})}resolve(e,t=new Ff.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&$r.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(Pf.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===Jr.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===Jr.default.Singleton,i=e.options.lifecycle===Jr.default.ContainerScoped,s=r||i,a;return $r.isValueProvider(e.provider)?a=e.provider.useValue:$r.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):$r.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):$r.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===Jr.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new Ff.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&$r.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=>!$r.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===Jr.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===Jr.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 CF.__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 PF.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Xi.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 FF.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return Pf.isTokenDescriptor(r)?Pf.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Ff.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 Ff.default,r.isOptional):this.resolve(r.token,e,r.isOptional):Pf.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(RF.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Xi.instance=new Ig;Xi.default=Xi.instance});var Zw=_(Rg=>{"use strict";Object.defineProperty(Rg,"__esModule",{value:!0});var NF=ua(),Ji=Es(),Og=Ef(),kF=Ag();function LF(){return function(n){let e=NF.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return Og.isTokenDescriptor(r)?Og.isTransformDescriptor(r)?r.multiple?Ji.instance.resolve(r.transform).transform(Ji.instance.resolveAll(r.token),...r.transformArgs):Ji.instance.resolve(r.transform).transform(Ji.instance.resolve(r.token),...r.transformArgs):r.multiple?Ji.instance.resolveAll(r.token):Ji.instance.resolve(r.token):Og.isTransformDescriptor(r)?Ji.instance.resolve(r.transform).transform(Ji.instance.resolve(r.token),...r.transformArgs):Ji.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(kF.formatErrorCtor(n,a,s))}})))}}}}o(LF,"autoInjectable");Rg.default=LF});var eb=_(Pg=>{"use strict";Object.defineProperty(Pg,"__esModule",{value:!0});var MF=ua();function jF(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return MF.defineInjectionTokenMetadata(t)}o(jF,"inject");Pg.default=jF});var Df=_(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});var $F=ua(),VF=Es(),tb=Es();function UF(n){return function(e){VF.typeInfo.set(e,$F.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{tb.instance.register(t,e)}):tb.instance.register(n.token,e))}}o(UF,"injectable");Fg.default=UF});var rb=_(Dg=>{"use strict";Object.defineProperty(Dg,"__esModule",{value:!0});var BF=(vf(),rm(yf)),qF=Es();function WF(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=BF.__rest(t,["token","options"]);return qF.instance.register(r,s,i)}),e}}o(WF,"registry");Dg.default=WF});var nb=_(Ng=>{"use strict";Object.defineProperty(Ng,"__esModule",{value:!0});var GF=Df(),HF=Es();function zF(){return function(n){GF.default()(n),HF.instance.registerSingleton(n)}}o(zF,"singleton");Ng.default=zF});var ib=_(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});var QF=ua();function YF(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return QF.defineInjectionTokenMetadata(t)}o(YF,"injectAll");kg.default=YF});var sb=_(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});var KF=ua();function XF(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return KF.defineInjectionTokenMetadata(r)}o(XF,"injectAllWithTransform");Lg.default=XF});var ab=_(Mg=>{"use strict";Object.defineProperty(Mg,"__esModule",{value:!0});var JF=ua();function ZF(n,e,...t){return JF.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(ZF,"injectWithTransform");Mg.default=ZF});var ob=_(jg=>{"use strict";Object.defineProperty(jg,"__esModule",{value:!0});var eD=Df(),tD=Es();function rD(n,e){return function(t){eD.default()(t),tD.instance.register(e||t,t,{lifecycle:n})}}o(rD,"scoped");jg.default=rD});var cb=_(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});var nD=Zw();Object.defineProperty(kn,"autoInjectable",{enumerable:!0,get:o(function(){return nD.default},"get")});var iD=eb();Object.defineProperty(kn,"inject",{enumerable:!0,get:o(function(){return iD.default},"get")});var sD=Df();Object.defineProperty(kn,"injectable",{enumerable:!0,get:o(function(){return sD.default},"get")});var aD=rb();Object.defineProperty(kn,"registry",{enumerable:!0,get:o(function(){return aD.default},"get")});var oD=nb();Object.defineProperty(kn,"singleton",{enumerable:!0,get:o(function(){return oD.default},"get")});var cD=ib();Object.defineProperty(kn,"injectAll",{enumerable:!0,get:o(function(){return cD.default},"get")});var lD=sb();Object.defineProperty(kn,"injectAllWithTransform",{enumerable:!0,get:o(function(){return lD.default},"get")});var uD=ab();Object.defineProperty(kn,"injectWithTransform",{enumerable:!0,get:o(function(){return uD.default},"get")});var fD=ob();Object.defineProperty(kn,"scoped",{enumerable:!0,get:o(function(){return fD.default},"get")})});var lb=_($g=>{"use strict";Object.defineProperty($g,"__esModule",{value:!0});function hD(n){let e;return t=>(e==null&&(e=n(t)),e)}o(hD,"instanceCachingFactory");$g.default=hD});var ub=_(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});function dD(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(dD,"instancePerContainerCachingFactory");Vg.default=dD});var fb=_(Ug=>{"use strict";Object.defineProperty(Ug,"__esModule",{value:!0});function pD(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(pD,"predicateAwareClassFactory");Ug.default=pD});var hb=_(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});var mD=lb();Object.defineProperty(nl,"instanceCachingFactory",{enumerable:!0,get:o(function(){return mD.default},"get")});var gD=ub();Object.defineProperty(nl,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return gD.default},"get")});var yD=fb();Object.defineProperty(nl,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return yD.default},"get")})});var Ue=_(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var Bg=(vf(),rm(yf));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 vD=Hw();Object.defineProperty(Ts,"Lifecycle",{enumerable:!0,get:o(function(){return vD.Lifecycle},"get")});Bg.__exportStar(cb(),Ts);Bg.__exportStar(hb(),Ts);Bg.__exportStar(vg(),Ts);var _D=Sf();Object.defineProperty(Ts,"delay",{enumerable:!0,get:o(function(){return _D.delay},"get")});var wD=Es();Object.defineProperty(Ts,"container",{enumerable:!0,get:o(function(){return wD.instance},"get")})});var bn=_(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.MetadataHelpers=void 0;var qg=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(([s,a])=>{if(Array.isArray(a)){let c=a.map(l=>` - ${l}`).join(`
|
|
34
34
|
`);return`${s}:
|
|
35
35
|
${c}`}return`${s}: ${a}`}).join(`
|
|
36
36
|
`),i=t?`
|
|
@@ -39,9 +39,9 @@ ${t}
|
|
|
39
39
|
`;return`---
|
|
40
40
|
${r}
|
|
41
41
|
---
|
|
42
|
-
${i}`}};Nf.MetadataHelpers=qg});var or=_(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.DateFormatter=void 0;var Wg=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)}};kf.DateFormatter=Wg});var il=_(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.MetadataExtractor=void 0;var bD=bn(),Gg=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 bD.MetadataHelpers.isAssetArchived(e)}static extractIsDefinedBy(e){let t=e.exo__Asset_isDefinedBy||'""';return Array.isArray(t)&&(t=t[0]||'""'),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}};Lf.MetadataExtractor=Gg});var Mf=_(da=>{"use strict";var SD=da&&da.__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(da,"__esModule",{value:!0});da.TaskFrontmatterGenerator=void 0;var ED=Ue(),db=Lr(),Hg=or(),TD=aa(),pb=il(),mb=bn(),Ot=vr(),xD=
|
|
42
|
+
${i}`}};Nf.MetadataHelpers=qg});var or=_(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.DateFormatter=void 0;var Wg=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)}};kf.DateFormatter=Wg});var il=_(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.MetadataExtractor=void 0;var bD=bn(),Gg=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 bD.MetadataHelpers.isAssetArchived(e)}static extractIsDefinedBy(e){let t=e.exo__Asset_isDefinedBy||'""';return Array.isArray(t)&&(t=t[0]||'""'),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}};Lf.MetadataExtractor=Gg});var Mf=_(da=>{"use strict";var SD=da&&da.__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(da,"__esModule",{value:!0});da.TaskFrontmatterGenerator=void 0;var ED=Ue(),db=Lr(),Hg=or(),TD=aa(),pb=il(),mb=bn(),Ot=vr(),xD=ws(),AD={[Ot.AssetClass.AREA]:"ems__Effort_area",[Ot.AssetClass.PROJECT]:"ems__Effort_parent",[Ot.AssetClass.TASK_PROTOTYPE]:"exo__Asset_prototype",[Ot.AssetClass.MEETING_PROTOTYPE]:"exo__Asset_prototype",[Ot.AssetClass.EVENT_PROTOTYPE]:"exo__Asset_prototype",[Ot.AssetClass.PROJECT_PROTOTYPE]:"exo__Asset_prototype"},CD={[Ot.AssetClass.AREA]:Ot.AssetClass.TASK,[Ot.AssetClass.PROJECT]:Ot.AssetClass.TASK,[Ot.AssetClass.TASK_PROTOTYPE]:Ot.AssetClass.TASK,[Ot.AssetClass.MEETING_PROTOTYPE]:Ot.AssetClass.MEETING,[Ot.AssetClass.EVENT_PROTOTYPE]:Ot.AssetClass.EVENT,[Ot.AssetClass.PROJECT_PROTOTYPE]:Ot.AssetClass.PROJECT},zg=class{static{o(this,"TaskFrontmatterGenerator")}generateTaskFrontmatter(e,t,r,i,s,a,c){let l=new Date,u=Hg.DateFormatter.toLocalTimestamp(l),f=pb.MetadataExtractor.extractIsDefinedBy(e),h=TD.WikiLinkHelpers.normalize(r),d=AD[h],p=CD[h]||Ot.AssetClass.TASK,y={};y.exo__Asset_isDefinedBy=mb.MetadataHelpers.ensureQuoted(f),y.exo__Asset_uid=s||(0,db.v4)(),y.exo__Asset_createdAt=u,y.exo__Instance_class=[`"[[${p}]]"`],y.ems__Effort_status='"[[ems__EffortStatusDraft]]"',d?y[d]=`"[[${t}]]"`:(0,xD.isPrototypeClass)(r,e)&&(y.exo__Asset_prototype=`"[[${t}]]"`);let w=i;if(p===Ot.AssetClass.MEETING&&(!i||i.trim()==="")){let T=e.exo__Asset_label||t,S=Hg.DateFormatter.toDateString(l);w=`${T} ${S}`}if(w&&w.trim()!==""){let T=w.trim();y.exo__Asset_label=T,y.aliases=[T]}return a&&(y.ems__Task_size=a),c&&(y.ems__Effort_plannedStartTimestamp=c),y}generateRelatedTaskFrontmatter(e,t,r,i,s){let a=new Date,c=Hg.DateFormatter.toLocalTimestamp(a),l=pb.MetadataExtractor.extractIsDefinedBy(e),u={};if(u.exo__Asset_isDefinedBy=mb.MetadataHelpers.ensureQuoted(l),u.exo__Asset_uid=i||(0,db.v4)(),u.exo__Asset_createdAt=c,u.exo__Instance_class=[`"[[${Ot.AssetClass.TASK}]]"`],u.ems__Effort_status='"[[ems__EffortStatusDraft]]"',u.exo__Asset_relates=[`"[[${t}]]"`],r&&r.trim()!==""){let f=r.trim();u.exo__Asset_label=f,u.aliases=[f]}return s&&(u.ems__Task_size=s),u}};da.TaskFrontmatterGenerator=zg;da.TaskFrontmatterGenerator=zg=SD([(0,ED.injectable)()],zg)});var jf=_(pa=>{"use strict";var ID=pa&&pa.__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(pa,"__esModule",{value:!0});pa.AlgorithmExtractor=void 0;var OD=Ue(),Qg=class{static{o(this,"AlgorithmExtractor")}extractH2Section(e,t){let r=e.split(`
|
|
43
43
|
`),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(`
|
|
44
|
-
`).trim()||null}};pa.AlgorithmExtractor=Qg;pa.AlgorithmExtractor=Qg=ID([(0,OD.injectable)()],Qg)});var yb=_(gb=>{"use strict";Object.defineProperty(gb,"__esModule",{value:!0})});var ht=_($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.DI_TOKENS=void 0;$f.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"),TaskCreationService:Symbol.for("TaskCreationService"),ProjectCreationService:Symbol.for("ProjectCreationService"),AreaCreationService:Symbol.for("AreaCreationService"),ClassCreationService:Symbol.for("ClassCreationService"),ConceptCreationService:Symbol.for("ConceptCreationService"),FleetingNoteCreationService:Symbol.for("FleetingNoteCreationService"),SupervisionCreationService:Symbol.for("SupervisionCreationService"),GenericAssetCreationService:Symbol.for("GenericAssetCreationService"),TaskFrontmatterGenerator:Symbol.for("TaskFrontmatterGenerator"),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"),AreaHierarchyBuilder:Symbol.for("AreaHierarchyBuilder"),URIConstructionService:Symbol.for("URIConstructionService")}});var Kg=_(cr=>{"use strict";var RD=cr&&cr.__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]})),PD=cr&&cr.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),FD=cr&&cr.__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},DD=cr&&cr.__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"&&RD(t,e,r[i]);return PD(t,e),t}})(),ND=cr&&cr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},kD=cr&&cr.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(cr,"__esModule",{value:!0});cr.TaskCreationService=void 0;var vb=Ue(),_b=Lr(),LD=aa(),wb=bn(),MD=vr(),jD=Mf(),$D=jf(),
|
|
44
|
+
`).trim()||null}};pa.AlgorithmExtractor=Qg;pa.AlgorithmExtractor=Qg=ID([(0,OD.injectable)()],Qg)});var yb=_(gb=>{"use strict";Object.defineProperty(gb,"__esModule",{value:!0})});var ht=_($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.DI_TOKENS=void 0;$f.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"),TaskCreationService:Symbol.for("TaskCreationService"),ProjectCreationService:Symbol.for("ProjectCreationService"),AreaCreationService:Symbol.for("AreaCreationService"),ClassCreationService:Symbol.for("ClassCreationService"),ConceptCreationService:Symbol.for("ConceptCreationService"),FleetingNoteCreationService:Symbol.for("FleetingNoteCreationService"),SupervisionCreationService:Symbol.for("SupervisionCreationService"),GenericAssetCreationService:Symbol.for("GenericAssetCreationService"),TaskFrontmatterGenerator:Symbol.for("TaskFrontmatterGenerator"),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"),AreaHierarchyBuilder:Symbol.for("AreaHierarchyBuilder"),URIConstructionService:Symbol.for("URIConstructionService")}});var Kg=_(cr=>{"use strict";var RD=cr&&cr.__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]})),PD=cr&&cr.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),FD=cr&&cr.__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},DD=cr&&cr.__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"&&RD(t,e,r[i]);return PD(t,e),t}})(),ND=cr&&cr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},kD=cr&&cr.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(cr,"__esModule",{value:!0});cr.TaskCreationService=void 0;var vb=Ue(),_b=Lr(),LD=aa(),wb=bn(),MD=vr(),jD=Mf(),$D=jf(),WG=DD(yb()),VD=ht(),Yg=class{static{o(this,"TaskCreationService")}constructor(e,t,r){this.vault=e,this.frontmatterGenerator=t,this.algorithmExtractor=r}async createTask(e,t,r,i,s,a){let c=(0,_b.v4)(),l=`${c}.md`,u=this.frontmatterGenerator.generateTaskFrontmatter(t,e.basename,r,i,c,s,a),f="";if(LD.WikiLinkHelpers.normalize(r)===MD.AssetClass.TASK_PROTOTYPE){let T=await this.vault.read(e),S=this.algorithmExtractor.extractH2Section(T,"Algorithm");S&&(f=`## Algorithm
|
|
45
45
|
|
|
46
46
|
${S}`)}let d=wb.MetadataHelpers.buildFileContent(u,f),p=e.parent?.path||"",y=p?`${p}/${l}`:l;return await this.vault.create(y,d)}async createRelatedTask(e,t,r,i){let s=(0,_b.v4)(),a=`${s}.md`,c=this.frontmatterGenerator.generateRelatedTaskFrontmatter(t,e.basename,r,s,i),l=wb.MetadataHelpers.buildFileContent(c),u=e.parent?.path||"",f=u?`${u}/${a}`:a,h=await this.vault.create(f,l);return await this.addRelationToSourceFile(e,s),h}generateTaskFrontmatter(e,t,r,i,s,a,c){return this.frontmatterGenerator.generateTaskFrontmatter(e,t,r,i,s,a,c)}generateRelatedTaskFrontmatter(e,t,r,i,s){return this.frontmatterGenerator.generateRelatedTaskFrontmatter(e,t,r,i,s)}extractH2Section(e,t){return this.algorithmExtractor.extractH2Section(e,t)}async addRelationToSourceFile(e,t){let r=await this.vault.read(e),i=this.addRelationToFrontmatter(r,t);await this.vault.modify(e,i)}addRelationToFrontmatter(e,t){let r=/^---\r?\n([\s\S]*?)\r?\n---/,i=e.match(r),s=e.includes(`\r
|
|
47
47
|
`)?`\r
|
|
@@ -58,7 +58,7 @@ ${Object.entries(t).map(([a,c])=>`${a}: ${c}`).join(`
|
|
|
58
58
|
`)}
|
|
59
59
|
---`,s=e.startsWith(`
|
|
60
60
|
`)?"":`
|
|
61
|
-
`;return`${i}${s}${e}`}getPropertyValue(e,t){let r=new RegExp(`${this.escapeRegex(t)}:\\s*(.*)$`,"m"),i=e.match(r);return i?i[1].trim():null}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};Bf.FrontmatterService=Uf;Uf.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/});var e0=_(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.WorkflowEngine=void 0;var Zg=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}}};qf.WorkflowEngine=Zg});var Tb=_(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.WorkflowResolver=void 0;var sl=ze(),Vr=mt(),dt=cn(),es=Gu(),se=zu(),t0=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,dt.Namespace.EMS.term("Effort_workflow"),void 0);if(r.length>0){let i=r[0].object;if(i instanceof sl.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,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("Workflow"));for(let r of t){let i=r.subject;if(!(!(await this.tripleStore.match(i,dt.Namespace.EMS.term("Workflow_targetClass"),void 0)).some(u=>{let f=u.object;return f instanceof sl.IRI?f.value.endsWith(e.replace(/^ems__/,"")):f instanceof Vr.Literal?this.normalizeWikilink(f.value)===e:!1})||!(await this.tripleStore.match(i,dt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(u=>{let f=u.object instanceof Vr.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,dt.Namespace.EXO.term("Asset_label"),void 0),r=t.length>0&&t[0].object instanceof Vr.Literal?t[0].object.value:"Unknown Workflow",i=await this.tripleStore.match(e,dt.Namespace.EXO.term("Asset_uid"),void 0),s=i.length>0&&i[0].object instanceof Vr.Literal?i[0].object.value:e.value,a=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_targetClass"),void 0),c=this.resolveAssetClass(a),l=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_initialState"),void 0),u=this.resolveEffortStatus(l)??se.EffortStatus.DRAFT,f=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_terminalStates"),void 0),h=this.resolveEffortStatuses(f),p=(await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(T=>{let S=T.object instanceof Vr.Literal?T.object.value:"";return S==="true"||S==="1"}),y=await this.loadStates(e),w=await this.loadTransitions(e);return{id:s,name:r,targetClass:c,states:y,transitions:w,initialState:u,terminalStates:h.length>0?h:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:p}}async loadStates(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("WorkflowState")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_workflow"),void 0)).some(A=>this.isSameSubject(A.object,e)))continue;let l=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_status"),void 0),u=this.resolveEffortStatus(l);if(!u)continue;let f=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_order"),void 0),h=f.length>0&&f[0].object instanceof Vr.Literal&&parseInt(f[0].object.value,10)||0,p=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_optional"),void 0)).some(A=>{let F=A.object instanceof Vr.Literal?A.object.value:"";return F==="true"||F==="1"}),w=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_timestampOnEnter"),void 0)).map(A=>A.object instanceof Vr.Literal?A.object.value:"").filter(A=>A.length>0),T=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_badgeColor"),void 0),S=T.length>0&&T[0].object instanceof Vr.Literal?T[0].object.value:void 0;r.push({status:u,order:h,optional:p,timestampOnEnter:w,badgeColor:S})}return r.sort((i,s)=>i.order-s.order)}async loadTransitions(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("WorkflowTransition")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_workflow"),void 0)).some(A=>this.isSameSubject(A.object,e)))continue;let l=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_from"),void 0),u=this.resolveEffortStatus(l),f=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_to"),void 0),h=this.resolveEffortStatus(f);if(!u||!h)continue;let d=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_label"),void 0),p=d.length>0&&d[0].object instanceof Vr.Literal?d[0].object.value:`${u} \u2192 ${h}`,y=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_icon"),void 0),w=y.length>0&&y[0].object instanceof Vr.Literal?y[0].object.value:void 0,S=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_isRollback"),void 0)).some(A=>{let F=A.object instanceof Vr.Literal?A.object.value:"";return F==="true"||F==="1"});r.push({from:u,to:h,label:p,icon:w,isRollback:S})}return r}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}resolveAssetClass(e){if(e.length===0)return es.AssetClass.TASK;let t=e[0].object;if(t instanceof sl.IRI){let i=`ems__${t.value.split("#").pop()??""}`;return Object.values(es.AssetClass).includes(i)?i:es.AssetClass.TASK}if(t instanceof Vr.Literal){let r=this.normalizeWikilink(t.value);return Object.values(es.AssetClass).includes(r)?r:es.AssetClass.TASK}return es.AssetClass.TASK}resolveEffortStatus(e){if(e.length===0)return null;let t=e[0].object,r;if(t instanceof sl.IRI)r=`ems__${t.value.split("#").pop()??""}`;else if(t instanceof Vr.Literal)r=this.normalizeWikilink(t.value);else return null;return Object.values(se.EffortStatus).includes(r)?r:null}resolveEffortStatuses(e){return e.map(t=>this.resolveEffortStatus([t])).filter(t=>t!==null)}isSameSubject(e,t){if(e instanceof sl.IRI)return e.value===t.value;if(e instanceof Vr.Literal){let r=this.normalizeWikilink(e.value);return t.value.includes(r)}return!1}getHardcodedFallback(e){return e===es.AssetClass.PROJECT?this.getProjectFallback():this.getTaskFallback()}getProjectFallback(){return{id:"hardcoded-project-default",name:"Project Default (hardcoded)",targetClass:es.AssetClass.PROJECT,initialState:se.EffortStatus.DRAFT,terminalStates:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:!0,states:[{status:se.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.ANALYSIS,order:3,optional:!0,timestampOnEnter:[]},{status:se.EffortStatus.TODO,order:4,optional:!0,timestampOnEnter:[]},{status:se.EffortStatus.DOING,order:5,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:se.EffortStatus.DONE,order:6,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:se.EffortStatus.TRASHED,order:7,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:se.EffortStatus.DRAFT,to:se.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.ANALYSIS,label:"\u2192 Analysis",isRollback:!1},{from:se.EffortStatus.ANALYSIS,to:se.EffortStatus.TODO,label:"\u2192 ToDo",isRollback:!1},{from:se.EffortStatus.TODO,to:se.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:se.EffortStatus.DOING,to:se.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:se.EffortStatus.ANALYSIS,to:se.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:se.EffortStatus.TODO,to:se.EffortStatus.ANALYSIS,label:"\u2190 Analysis",isRollback:!0},{from:se.EffortStatus.DOING,to:se.EffortStatus.TODO,label:"\u2190 ToDo",isRollback:!0},{from:se.EffortStatus.DONE,to:se.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]}}getTaskFallback(){return{id:"hardcoded-task-default",name:"Task Default (hardcoded)",targetClass:es.AssetClass.TASK,initialState:se.EffortStatus.DRAFT,terminalStates:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:!0,states:[{status:se.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.DOING,order:3,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:se.EffortStatus.DONE,order:4,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:se.EffortStatus.TRASHED,order:5,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:se.EffortStatus.DRAFT,to:se.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:se.EffortStatus.DOING,to:se.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:se.EffortStatus.DOING,to:se.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:se.EffortStatus.DONE,to:se.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]}}};Wf.WorkflowResolver=t0});var s0=_(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.TransactionError=Ts.TripleNotFoundError=Ts.TripleAlreadyExistsError=void 0;var r0=class extends Error{static{o(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};Ts.TripleAlreadyExistsError=r0;var n0=class extends Error{static{o(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};Ts.TripleNotFoundError=n0;var i0=class extends Error{static{o(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};Ts.TransactionError=i0});var Hf=_(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.LRUCache=void 0;var a0=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}};Gf.LRUCache=a0});var l0=_(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.InMemoryTripleStore=void 0;var xs=s0(),zf=ze(),YD=$t(),KD=mt(),XD=cn(),JD=Hf(),ZD=XD.Namespace.XSD.term("string").value,eN=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,ao="__default__",o0=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 JD.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 c0(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 zf.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof zf.IRI))return;let t=e.value,r=t.match(eN);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 zf.IRI)return`i:${e.value}`;if(e instanceof YD.BlankNode)return`b:${e.id}`;if(e instanceof KD.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==ZD?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:ao}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===ao?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===ao)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===ao)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 zf.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===ao){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===ao)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Qf.InMemoryTripleStore=o0;var c0=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 xs.TransactionError("Transaction already committed");if(this.rolledBack)throw new xs.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new xs.TransactionError("Transaction already committed");if(this.rolledBack)throw new xs.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new xs.TransactionError("Transaction already committed");if(this.rolledBack)throw new xs.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 xs.TransactionError("Transaction already committed");if(this.rolledBack)throw new xs.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var Kf=_(ts=>{"use strict";var tN=ts&&ts.__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},rN=ts&&ts.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ts,"__esModule",{value:!0});ts.EffortStatusWorkflow=void 0;var nN=Ue(),Yf=vr(),iN=e0(),sN=Tb(),aN=l0(),u0=class{static{o(this,"EffortStatusWorkflow")}constructor(){this.resolver=new sN.WorkflowResolver(new aN.InMemoryTripleStore)}getPreviousStatus(e,t){let r=this.normalizeStatus(e),i=this.resolveDefinition(t),s=new iN.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,Yf.AssetClass.TASK)||this.hasInstanceClass(e,Yf.AssetClass.MEETING)?this.resolver.getHardcodedFallback(Yf.AssetClass.TASK):this.resolver.getHardcodedFallback(Yf.AssetClass.PROJECT)}hasInstanceClass(e,t){return e?(Array.isArray(e)?e:[e]).some(i=>i.replace(/["'[\]]/g,"").trim()===t):!1}};ts.EffortStatusWorkflow=u0;ts.EffortStatusWorkflow=u0=tN([(0,nN.injectable)(),rN("design:paramtypes",[])],u0)});var Xf=_(Mn=>{"use strict";var oN=Mn&&Mn.__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},cN=Mn&&Mn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},lN=Mn&&Mn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.StatusTimestampService=void 0;var xb=Ue(),uN=Zi(),oo=or(),fN=ht(),f0=class{static{o(this,"StatusTimestampService")}constructor(e){this.vault=e,this.frontmatterService=new uN.FrontmatterService}async addStartTimestamp(e){let t=await this.vault.read(e),r=oo.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=oo.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=oo.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=oo.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=oo.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=oo.DateFormatter.toLocalTimestamp(c),u=this.frontmatterService.updateProperty(r,"ems__Effort_plannedEndTimestamp",l);await this.vault.modify(e,u)}};Mn.StatusTimestampService=f0;Mn.StatusTimestampService=f0=oN([(0,xb.injectable)(),lN(0,(0,xb.inject)(fN.DI_TOKENS.IVaultAdapter)),cN("design:paramtypes",[Object])],f0)});var d0=_(jn=>{"use strict";var hN=jn&&jn.__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},dN=jn&&jn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},pN=jn&&jn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(jn,"__esModule",{value:!0});jn.TaskStatusService=void 0;var Ab=Ue(),mN=Zi(),ma=or(),gN=Kf(),yN=Xf(),vN=ht(),h0=class{static{o(this,"TaskStatusService")}constructor(e,t,r){this.vault=e,this.workflow=t,this.timestampService=r,this.frontmatterService=new mN.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=ma.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=ma.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=ma.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=`
|
|
61
|
+
`;return`${i}${s}${e}`}getPropertyValue(e,t){let r=new RegExp(`${this.escapeRegex(t)}:\\s*(.*)$`,"m"),i=e.match(r);return i?i[1].trim():null}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};Bf.FrontmatterService=Uf;Uf.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/});var e0=_(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.WorkflowEngine=void 0;var Zg=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}}};qf.WorkflowEngine=Zg});var Tb=_(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.WorkflowResolver=void 0;var sl=ze(),Vr=mt(),dt=cn(),es=Gu(),se=zu(),t0=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,dt.Namespace.EMS.term("Effort_workflow"),void 0);if(r.length>0){let i=r[0].object;if(i instanceof sl.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,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("Workflow"));for(let r of t){let i=r.subject;if(!(!(await this.tripleStore.match(i,dt.Namespace.EMS.term("Workflow_targetClass"),void 0)).some(u=>{let f=u.object;return f instanceof sl.IRI?f.value.endsWith(e.replace(/^ems__/,"")):f instanceof Vr.Literal?this.normalizeWikilink(f.value)===e:!1})||!(await this.tripleStore.match(i,dt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(u=>{let f=u.object instanceof Vr.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,dt.Namespace.EXO.term("Asset_label"),void 0),r=t.length>0&&t[0].object instanceof Vr.Literal?t[0].object.value:"Unknown Workflow",i=await this.tripleStore.match(e,dt.Namespace.EXO.term("Asset_uid"),void 0),s=i.length>0&&i[0].object instanceof Vr.Literal?i[0].object.value:e.value,a=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_targetClass"),void 0),c=this.resolveAssetClass(a),l=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_initialState"),void 0),u=this.resolveEffortStatus(l)??se.EffortStatus.DRAFT,f=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_terminalStates"),void 0),h=this.resolveEffortStatuses(f),p=(await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(T=>{let S=T.object instanceof Vr.Literal?T.object.value:"";return S==="true"||S==="1"}),y=await this.loadStates(e),w=await this.loadTransitions(e);return{id:s,name:r,targetClass:c,states:y,transitions:w,initialState:u,terminalStates:h.length>0?h:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:p}}async loadStates(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("WorkflowState")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_workflow"),void 0)).some(x=>this.isSameSubject(x.object,e)))continue;let l=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_status"),void 0),u=this.resolveEffortStatus(l);if(!u)continue;let f=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_order"),void 0),h=f.length>0&&f[0].object instanceof Vr.Literal&&parseInt(f[0].object.value,10)||0,p=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_optional"),void 0)).some(x=>{let F=x.object instanceof Vr.Literal?x.object.value:"";return F==="true"||F==="1"}),w=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_timestampOnEnter"),void 0)).map(x=>x.object instanceof Vr.Literal?x.object.value:"").filter(x=>x.length>0),T=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_badgeColor"),void 0),S=T.length>0&&T[0].object instanceof Vr.Literal?T[0].object.value:void 0;r.push({status:u,order:h,optional:p,timestampOnEnter:w,badgeColor:S})}return r.sort((i,s)=>i.order-s.order)}async loadTransitions(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("WorkflowTransition")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_workflow"),void 0)).some(x=>this.isSameSubject(x.object,e)))continue;let l=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_from"),void 0),u=this.resolveEffortStatus(l),f=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_to"),void 0),h=this.resolveEffortStatus(f);if(!u||!h)continue;let d=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_label"),void 0),p=d.length>0&&d[0].object instanceof Vr.Literal?d[0].object.value:`${u} \u2192 ${h}`,y=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_icon"),void 0),w=y.length>0&&y[0].object instanceof Vr.Literal?y[0].object.value:void 0,S=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_isRollback"),void 0)).some(x=>{let F=x.object instanceof Vr.Literal?x.object.value:"";return F==="true"||F==="1"});r.push({from:u,to:h,label:p,icon:w,isRollback:S})}return r}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}resolveAssetClass(e){if(e.length===0)return es.AssetClass.TASK;let t=e[0].object;if(t instanceof sl.IRI){let i=`ems__${t.value.split("#").pop()??""}`;return Object.values(es.AssetClass).includes(i)?i:es.AssetClass.TASK}if(t instanceof Vr.Literal){let r=this.normalizeWikilink(t.value);return Object.values(es.AssetClass).includes(r)?r:es.AssetClass.TASK}return es.AssetClass.TASK}resolveEffortStatus(e){if(e.length===0)return null;let t=e[0].object,r;if(t instanceof sl.IRI)r=`ems__${t.value.split("#").pop()??""}`;else if(t instanceof Vr.Literal)r=this.normalizeWikilink(t.value);else return null;return Object.values(se.EffortStatus).includes(r)?r:null}resolveEffortStatuses(e){return e.map(t=>this.resolveEffortStatus([t])).filter(t=>t!==null)}isSameSubject(e,t){if(e instanceof sl.IRI)return e.value===t.value;if(e instanceof Vr.Literal){let r=this.normalizeWikilink(e.value);return t.value.includes(r)}return!1}getHardcodedFallback(e){return e===es.AssetClass.PROJECT?this.getProjectFallback():this.getTaskFallback()}getProjectFallback(){return{id:"hardcoded-project-default",name:"Project Default (hardcoded)",targetClass:es.AssetClass.PROJECT,initialState:se.EffortStatus.DRAFT,terminalStates:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:!0,states:[{status:se.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.ANALYSIS,order:3,optional:!0,timestampOnEnter:[]},{status:se.EffortStatus.TODO,order:4,optional:!0,timestampOnEnter:[]},{status:se.EffortStatus.DOING,order:5,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:se.EffortStatus.DONE,order:6,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:se.EffortStatus.TRASHED,order:7,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:se.EffortStatus.DRAFT,to:se.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.ANALYSIS,label:"\u2192 Analysis",isRollback:!1},{from:se.EffortStatus.ANALYSIS,to:se.EffortStatus.TODO,label:"\u2192 ToDo",isRollback:!1},{from:se.EffortStatus.TODO,to:se.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:se.EffortStatus.DOING,to:se.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:se.EffortStatus.ANALYSIS,to:se.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:se.EffortStatus.TODO,to:se.EffortStatus.ANALYSIS,label:"\u2190 Analysis",isRollback:!0},{from:se.EffortStatus.DOING,to:se.EffortStatus.TODO,label:"\u2190 ToDo",isRollback:!0},{from:se.EffortStatus.DONE,to:se.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]}}getTaskFallback(){return{id:"hardcoded-task-default",name:"Task Default (hardcoded)",targetClass:es.AssetClass.TASK,initialState:se.EffortStatus.DRAFT,terminalStates:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:!0,states:[{status:se.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.DOING,order:3,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:se.EffortStatus.DONE,order:4,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:se.EffortStatus.TRASHED,order:5,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:se.EffortStatus.DRAFT,to:se.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:se.EffortStatus.DOING,to:se.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:se.EffortStatus.DOING,to:se.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:se.EffortStatus.DONE,to:se.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]}}};Wf.WorkflowResolver=t0});var s0=_(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.TransactionError=xs.TripleNotFoundError=xs.TripleAlreadyExistsError=void 0;var r0=class extends Error{static{o(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};xs.TripleAlreadyExistsError=r0;var n0=class extends Error{static{o(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};xs.TripleNotFoundError=n0;var i0=class extends Error{static{o(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};xs.TransactionError=i0});var Hf=_(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.LRUCache=void 0;var a0=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}};Gf.LRUCache=a0});var l0=_(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.InMemoryTripleStore=void 0;var As=s0(),zf=ze(),YD=$t(),KD=mt(),XD=cn(),JD=Hf(),ZD=XD.Namespace.XSD.term("string").value,eN=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,ao="__default__",o0=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 JD.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 c0(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 zf.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof zf.IRI))return;let t=e.value,r=t.match(eN);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 zf.IRI)return`i:${e.value}`;if(e instanceof YD.BlankNode)return`b:${e.id}`;if(e instanceof KD.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==ZD?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:ao}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===ao?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===ao)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===ao)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 zf.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===ao){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===ao)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Qf.InMemoryTripleStore=o0;var c0=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 As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.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 As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var Kf=_(ts=>{"use strict";var tN=ts&&ts.__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},rN=ts&&ts.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ts,"__esModule",{value:!0});ts.EffortStatusWorkflow=void 0;var nN=Ue(),Yf=vr(),iN=e0(),sN=Tb(),aN=l0(),u0=class{static{o(this,"EffortStatusWorkflow")}constructor(){this.resolver=new sN.WorkflowResolver(new aN.InMemoryTripleStore)}getPreviousStatus(e,t){let r=this.normalizeStatus(e),i=this.resolveDefinition(t),s=new iN.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,Yf.AssetClass.TASK)||this.hasInstanceClass(e,Yf.AssetClass.MEETING)?this.resolver.getHardcodedFallback(Yf.AssetClass.TASK):this.resolver.getHardcodedFallback(Yf.AssetClass.PROJECT)}hasInstanceClass(e,t){return e?(Array.isArray(e)?e:[e]).some(i=>i.replace(/["'[\]]/g,"").trim()===t):!1}};ts.EffortStatusWorkflow=u0;ts.EffortStatusWorkflow=u0=tN([(0,nN.injectable)(),rN("design:paramtypes",[])],u0)});var Xf=_(Mn=>{"use strict";var oN=Mn&&Mn.__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},cN=Mn&&Mn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},lN=Mn&&Mn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.StatusTimestampService=void 0;var xb=Ue(),uN=Zi(),oo=or(),fN=ht(),f0=class{static{o(this,"StatusTimestampService")}constructor(e){this.vault=e,this.frontmatterService=new uN.FrontmatterService}async addStartTimestamp(e){let t=await this.vault.read(e),r=oo.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=oo.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=oo.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=oo.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=oo.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=oo.DateFormatter.toLocalTimestamp(c),u=this.frontmatterService.updateProperty(r,"ems__Effort_plannedEndTimestamp",l);await this.vault.modify(e,u)}};Mn.StatusTimestampService=f0;Mn.StatusTimestampService=f0=oN([(0,xb.injectable)(),lN(0,(0,xb.inject)(fN.DI_TOKENS.IVaultAdapter)),cN("design:paramtypes",[Object])],f0)});var d0=_(jn=>{"use strict";var hN=jn&&jn.__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},dN=jn&&jn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},pN=jn&&jn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(jn,"__esModule",{value:!0});jn.TaskStatusService=void 0;var Ab=Ue(),mN=Zi(),ma=or(),gN=Kf(),yN=Xf(),vN=ht(),h0=class{static{o(this,"TaskStatusService")}constructor(e,t,r){this.vault=e,this.workflow=t,this.timestampService=r,this.frontmatterService=new mN.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=ma.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=ma.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=ma.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=`
|
|
62
62
|
|
|
63
63
|
## Trash Reason
|
|
64
64
|
|
|
@@ -73,7 +73,7 @@ ${t}`;return e.trimEnd()+r}async archiveTask(e){let t=await this.vault.read(e),r
|
|
|
73
73
|
Stack trace:
|
|
74
74
|
${t.stack}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`,t??"")}else{let a=t?.message?`
|
|
75
75
|
Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`)}}};Jf.LoggingService=al;al.isVerbose=!1;al.isDevelopment=void 0});var R0=_(Hn=>{"use strict";var n4=Hn&&Hn.__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},i4=Hn&&Hn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Mb=Hn&&Hn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Hn,"__esModule",{value:!0});Hn.PropertyCleanupService=void 0;var I0=Ue(),jb=ht(),O0=class{static{o(this,"PropertyCleanupService")}constructor(e,t){this.vault=e,this.logger=t,this.logger.debug("PropertyCleanupService initialized")}async cleanEmptyProperties(e){this.logger.debug("Cleaning empty properties",{path:e.path});let t=await this.vault.read(e),r=this.removeEmptyPropertiesFromContent(t);await this.vault.modify(e,r),this.logger.info("Empty properties cleaned",{path:e.path})}removeEmptyPropertiesFromContent(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return e;let s=r[1].split(`
|
|
76
|
-
`),a=[],c=0;for(;c<s.length;){let u=s[c],f=u.trim();if(f===""){a.push(u),c++;continue}let h=f.match(/^([^:]+):\s*(.*)$/);if(h){let d=h[2];if(d===""&&c+1<s.length&&s[c+1].match(/^\s+- /)){let y=[],w=c+1;for(;w<s.length&&s[w].match(/^\s+- /);)y.push(s[w]),w++;if(y.every(S=>{let
|
|
76
|
+
`),a=[],c=0;for(;c<s.length;){let u=s[c],f=u.trim();if(f===""){a.push(u),c++;continue}let h=f.match(/^([^:]+):\s*(.*)$/);if(h){let d=h[2];if(d===""&&c+1<s.length&&s[c+1].match(/^\s+- /)){let y=[],w=c+1;for(;w<s.length&&s[w].match(/^\s+- /);)y.push(s[w]),w++;if(y.every(S=>{let x=S.replace(/^\s+- /,"").trim();return this.isEmptyValue(x)})){c=w;continue}else{a.push(u);for(let S=c+1;S<w;S++)a.push(s[S]);c=w;continue}}if(this.isEmptyValue(d)){c++;continue}a.push(u),c++}else f.match(/^\s*- /)||a.push(u),c++}let l=a.join(`
|
|
77
77
|
`);return e.replace(t,`---
|
|
78
78
|
${l}
|
|
79
79
|
---`)}isEmptyValue(e){let t=e.trim();return t===""||t==="null"||t==="undefined"||t==="[]"||t==="{}"||t==='""'||t==="''"}};Hn.PropertyCleanupService=O0;Hn.PropertyCleanupService=O0=n4([(0,I0.injectable)(),Mb(0,(0,I0.inject)(jb.DI_TOKENS.IVaultAdapter)),Mb(1,(0,I0.inject)(jb.DI_TOKENS.ILogger)),i4("design:paramtypes",[Object,Object])],O0)});var F0=_(zn=>{"use strict";var s4=zn&&zn.__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},a4=zn&&zn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},o4=zn&&zn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(zn,"__esModule",{value:!0});zn.RenameToUidService=void 0;var $b=Ue(),c4=ht(),P0=class{static{o(this,"RenameToUidService")}constructor(e){this.vault=e}async renameToUid(e,t){let r=t.exo__Asset_uid;if(!r)throw new Error("Asset has no exo__Asset_uid property");let i=e.basename,s=r;if(i===s)throw new Error("File is already named according to UID");let a=t.exo__Asset_label;if(!a||a.trim()===""){let f=this.isAssetArchived(t);await this.updateLabel(e,i,f)}let l=e.parent?.path||"",u=l?`${l}/${s}.md`:`${s}.md`;await this.vault.updateLinks(e.path,u,i),await this.vault.rename(e,u)}async updateLabel(e,t,r){await this.vault.process(e,i=>{let s=/^---\n([\s\S]*?)\n---/,a=i.match(s);if(!a)return i;let c=a[1];return c=`${c}
|
|
@@ -103,7 +103,7 @@ ${s}`}return`${r}: ${i}`}).join(`
|
|
|
103
103
|
---`}};ga.DynamicFrontmatterGenerator=M0;ga.DynamicFrontmatterGenerator=M0=S4([(0,E4.injectable)()],M0)});var V0=_(Kn=>{"use strict";var x4=Kn&&Kn.__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},A4=Kn&&Kn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},C4=Kn&&Kn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.PlanningService=void 0;var Bb=Ue(),I4=Zi(),O4=or(),R4=ht(),$0=class{static{o(this,"PlanningService")}constructor(e){this.vault=e,this.frontmatterService=new I4.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=O4.DateFormatter.getTodayStartTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_plannedStartTimestamp",i);await this.vault.modify(t,s)}isFile(e){return"basename"in e}};Kn.PlanningService=$0;Kn.PlanningService=$0=x4([(0,Bb.injectable)(),C4(0,(0,Bb.inject)(R4.DI_TOKENS.IVaultAdapter)),A4("design:paramtypes",[Object])],$0)});var B0=_(Xn=>{"use strict";var P4=Xn&&Xn.__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},F4=Xn&&Xn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},D4=Xn&&Xn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.AssetConversionService=void 0;var qb=Ue(),Wb=vr(),N4=Zi(),th=Zf(),k4=ht(),U0=class{static{o(this,"AssetConversionService")}constructor(e){this.vault=e,this.frontmatterService=new N4.FrontmatterService}async convertTaskToProject(e){try{let t=await this.vault.read(e),r=this.removeInstanceClassProperty(t);return r=this.frontmatterService.updateProperty(r,"exo__Instance_class",`["[[${Wb.AssetClass.PROJECT}]]"]`),await this.vault.modify(e,r),th.LoggingService.info(`Converted Task to Project: ${e.basename} (${e.path})`),e}catch(t){let r=`Failed to convert Task to Project: ${e.path}`;throw th.LoggingService.error(r,t instanceof Error?t:void 0),new Error(r)}}async convertProjectToTask(e){try{let t=await this.vault.read(e),r=this.removeInstanceClassProperty(t);return r=this.frontmatterService.updateProperty(r,"exo__Instance_class",`["[[${Wb.AssetClass.TASK}]]"]`),await this.vault.modify(e,r),th.LoggingService.info(`Converted Project to Task: ${e.basename} (${e.path})`),e}catch(t){let r=`Failed to convert Project to Task: ${e.path}`;throw th.LoggingService.error(r,t instanceof Error?t:void 0),new Error(r)}}removeInstanceClassProperty(e){let t=this.frontmatterService.parse(e);if(!t.exists)return e;let r=/^exo__Instance_class:.*$(\n -.*$)*/gm,i=t.content.replace(r,"").replace(/\n\n+/g,`
|
|
104
104
|
`).trim();return e.replace(/^---\n[\s\S]*?\n---/,`---
|
|
105
105
|
${i}
|
|
106
|
-
---`)}};Xn.AssetConversionService=U0;Xn.AssetConversionService=U0=P4([(0,qb.injectable)(),D4(0,(0,qb.inject)(k4.DI_TOKENS.IVaultAdapter)),F4("design:paramtypes",[Object])],U0)});var W0=_(Jn=>{"use strict";var L4=Jn&&Jn.__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},M4=Jn&&Jn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},j4=Jn&&Jn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.SessionEventService=void 0;var Gb=Ue(),$4=Lr(),Hb=vr(),V4=or(),U4=bn(),B4=ht(),q0=class{static{o(this,"SessionEventService")}constructor(e){this.vault=e,this.folderPathCache=null}async createSessionStartEvent(e){return this.createSessionEvent(e,Hb.AssetClass.SESSION_START_EVENT)}async createSessionEndEvent(e){return this.createSessionEvent(e,Hb.AssetClass.SESSION_END_EVENT)}getSessionEventFolder(){if(this.folderPathCache!==null)return this.folderPathCache;let e=this.vault.getDefaultNewFileParent();return this.folderPathCache=e?.path||"",this.folderPathCache}async createSessionEvent(e,t){let r=(0,$4.v4)(),i=V4.DateFormatter.toLocalTimestamp(new Date),s={exo__Asset_uid:r,exo__Asset_createdAt:i,exo__Asset_isDefinedBy:'"[[!kitelev]]"',exo__Instance_class:[`"[[${t}]]"`],ems__SessionEvent_timestamp:i,ems__Session_area:`"[[${e}]]"`},a=U4.MetadataHelpers.buildFileContent(s),c=this.getSessionEventFolder();c&&!await this.vault.exists(c)&&await this.vault.createFolder(c);let l=c?`${c}/${r}.md`:`${r}.md`;return await this.vault.create(l,a)}};Jn.SessionEventService=q0;Jn.SessionEventService=q0=L4([(0,Gb.injectable)(),j4(0,(0,Gb.inject)(B4.DI_TOKENS.IVaultAdapter)),M4("design:paramtypes",[Object])],q0)});var z0=_(Zn=>{"use strict";var q4=Zn&&Zn.__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},W4=Zn&&Zn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},zb=Zn&&Zn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.URIConstructionService=void 0;var G0=Ue(),Qb=ht(),H0=class{static{o(this,"URIConstructionService")}constructor(e,t){this.fileSystem=e,this.logger=t,this.defaultOntologyURL="https://exocortex.my/default/",this.strictValidation=!0}configure(e){e?.defaultOntologyURL&&(this.defaultOntologyURL=e.defaultOntologyURL),e?.strictValidation!==void 0&&(this.strictValidation=e.strictValidation)}async constructAssetURI(e){let t=this.extractUID(e);if(!t){if(this.strictValidation)throw new Error(`Asset missing exo__Asset_uid: ${e.path}`);return this.logger.warn(`Asset ${e.path} missing UID, using filename fallback`),this.constructFallbackURI(e)}let r=await this.resolveOntologyURL(e);if(!this.validateOntologyURL(r))throw new Error(`Invalid ontology URL: ${r}`);return`${r.endsWith("/")?r:`${r}/`}${t}`}validateOntologyURL(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}async resolveOntologyURL(e){let t=e.frontmatter?.exo__Asset_isDefinedBy;if(!t||typeof t!="string")return this.defaultOntologyURL;let r=this.extractWikiLink(t),i=r,s=await this.fileSystem.fileExists(r);return!s&&!r.endsWith(".md")&&(i=`${r}.md`,s=await this.fileSystem.fileExists(i)),s?(await this.fileSystem.getFileMetadata(i))?.exo__Ontology_url||this.defaultOntologyURL:(this.logger.warn(`Ontology file not found: ${r}, using default`),this.defaultOntologyURL)}extractUID(e){let t=e.frontmatter?.exo__Asset_uid;return typeof t=="string"?t:null}extractWikiLink(e){return e.replace(/^\[\[|\]\]$/g,"")}constructFallbackURI(e){let t=e.path.split("/").pop()?.replace(".md","")||"unknown";return`${this.defaultOntologyURL}${t}`}};Zn.URIConstructionService=H0;Zn.URIConstructionService=H0=q4([(0,G0.injectable)(),zb(0,(0,G0.inject)(Qb.DI_TOKENS.IFileSystemAdapter)),zb(1,(0,G0.inject)(Qb.DI_TOKENS.ILogger)),W4("design:paramtypes",[Object,Object])],H0)});var Y0=_(ei=>{"use strict";var G4=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},H4=ei&&ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},z4=ei&&ei.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ei,"__esModule",{value:!0});ei.GenericAssetCreationService=void 0;var Yb=Ue(),Q4=Lr(),cl=or(),Y4=bn(),K4=ht(),xi=ag(),Q0=class{static{o(this,"GenericAssetCreationService")}constructor(e){this.vault=e}async createAsset(e,t){let r=(0,Q4.v4)(),i=`${r}.md`,s=this.generateFrontmatter(e,t||[],r),a=Y4.MetadataHelpers.buildFileContent(s),c=e.folderPath||this.getDefaultFolderPath(e);this.vault.getAbstractFileByPath(c)||await this.vault.createFolder(c);let u=c?`${c}/${i}`:i;return await this.vault.create(u,a)}generateFrontmatter(e,t,r){let i=new Date,s={},a=new Map;for(let c of t)a.set(c.name,c.fieldType);if(s.exo__Asset_uid=r,s.exo__Asset_createdAt=cl.DateFormatter.toLocalTimestamp(i),s.exo__Instance_class=[this.formatWikilink(e.className)],e.label&&e.label.trim()!==""){let c=e.label.trim();s.exo__Asset_label=c,s.aliases=[c]}if(e.parentFile&&e.parentMetadata&&this.inheritParentContext(s,e),e.propertyValues)for(let[c,l]of Object.entries(e.propertyValues)){if(c==="exo__Asset_uid"||c==="exo__Asset_createdAt"||c==="exo__Instance_class"||c==="exo__Asset_label"||c==="aliases"||l==null)continue;let u=a.get(c);s[c]=this.formatValue(l,u)}return s}inheritParentContext(e,t){let r=t.parentMetadata||{},i=t.parentFile?.basename;if((t.className==="ems__Task"||t.className.startsWith("ems__Task"))&&(e.ems__Effort_parent=i?this.formatWikilink(i):null),t.className==="ems__Project"||t.className.startsWith("ems__Project")){let s=r.exo__Instance_class;this.isAreaClass(s)&&(e.ems__Project_area=i?this.formatWikilink(i):null)}r.exo__Asset_isDefinedBy&&(e.exo__Asset_isDefinedBy=r.exo__Asset_isDefinedBy)}isAreaClass(e){return e?(Array.isArray(e)?e:[e]).some(r=>String(r).includes("Area")||String(r).includes("ems__Area")):!1}getDefaultFolderPath(e){if(e.parentFile?.parent?.path)return e.parentFile.parent.path;let t={ems__Task:"tasks",ems__Project:"projects",ems__Area:"areas",ems__Meeting:"meetings",exo__Event:"events",ims__Concept:"concepts"};if(t[e.className])return t[e.className];for(let[r,i]of Object.entries(t))if(e.className.startsWith(r))return i;return"assets"}formatValue(e,t){if(e==null)return null;if(!t)return this.formatInferredValue(e);switch(t){case xi.PropertyFieldType.Text:return String(e);case xi.PropertyFieldType.Wikilink:case xi.PropertyFieldType.Reference:case xi.PropertyFieldType.StatusSelect:case xi.PropertyFieldType.SizeSelect:return this.formatWikilink(String(e));case xi.PropertyFieldType.Number:return typeof e=="number"?e:Number(e)||0;case xi.PropertyFieldType.Boolean:return this.formatBoolean(e);case xi.PropertyFieldType.Date:case xi.PropertyFieldType.DateTime:case xi.PropertyFieldType.Timestamp:return this.formatTimestamp(e);default:return String(e)}}formatInferredValue(e){return typeof e=="boolean"||typeof e=="number"?e:e instanceof Date?cl.DateFormatter.toLocalTimestamp(e):typeof e=="string"?e.startsWith("[[")||e.startsWith('"[[')?this.formatWikilink(e):e:String(e)}formatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:`"[[${e}]]"`}formatBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"}return typeof e=="number"?e!==0:!!e}formatTimestamp(e){if(e instanceof Date)return cl.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:cl.DateFormatter.toLocalTimestamp(t)}if(typeof e=="number"){let t=new Date(e);if(!isNaN(t.getTime()))return cl.DateFormatter.toLocalTimestamp(t)}return String(e)}};ei.GenericAssetCreationService=Q0;ei.GenericAssetCreationService=Q0=G4([(0,Yb.injectable)(),z4(0,(0,Yb.inject)(K4.DI_TOKENS.IVaultAdapter)),H4("design:paramtypes",[Object])],Q0)});var Kb=_(rs=>{"use strict";var X4=rs&&rs.__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},J4=rs&&rs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(rs,"__esModule",{value:!0});rs.GraphQueryService=void 0;var Z4=Ue(),ll=ze(),ek=mt(),As=cn(),tk=wm(),Ai={INSTANCE_CLASS:As.Namespace.EXO.term("Instance_class"),ASSET_LABEL:As.Namespace.EXO.term("Asset_label"),ASSET_PROTOTYPE:As.Namespace.EXO.term("Asset_prototype"),ASSET_IS_ARCHIVED:As.Namespace.EXO.term("Asset_isArchived"),EFFORT_PARENT:As.Namespace.EMS.term("Effort_parent"),REFERENCES:As.Namespace.EXO.term("references"),REFERENCED_BY:As.Namespace.EXO.term("referencedBy"),RDF_TYPE:As.Namespace.RDF.term("type")},K0=class{static{o(this,"GraphQueryService")}constructor(e,t={},r){this.subscribers=new Set,this.nodeCache=new Map,this.lastCacheUpdate=0,this.tripleStore=e,this.logger=r,this.config={defaultLimit:t.defaultLimit??100,maxLimit:t.maxLimit??1e4,defaultDepth:t.defaultDepth??2,maxDepth:t.maxDepth??10,includeArchivedByDefault:t.includeArchivedByDefault??!1,cacheTTL:t.cacheTTL??3e4}}async loadGraphData(e={}){let t=Date.now(),r=await this.loadNodes(e),i=await this.loadEdges(r,e),s=this.computeStats(r,i),a=Date.now()-t;return a>100&&r.length>0&&this.logger?.debug(`GraphQueryService: loaded ${r.length} nodes in ${a}ms (${(a/r.length).toFixed(2)}ms/node)`),{nodes:r,edges:i,stats:s,lastUpdated:Date.now(),version:1}}async loadNodesIncremental(e={}){let t=Math.min(e.limit??this.config.defaultLimit,this.config.maxLimit),r=e.offset??0,i=await this.loadNodes({...e,limit:t+1,offset:r}),s=i.length>t,a=s?i.slice(0,t):i,c=await this.loadEdges(a,e);return{nodes:a,edges:c,hasMore:s,totalCount:void 0,cursor:s?String(r+t):void 0}}async loadConnectedNodes(e,t={}){let r=Math.min(t.depth??this.config.defaultDepth,this.config.maxDepth),i=Math.min(t.limit??this.config.maxLimit,this.config.maxLimit),s=new Set,a=[{id:e,currentDepth:0}],c=[];for(;a.length>0&&c.length<i;){let u=a.shift();if(!u)break;let{id:f,currentDepth:h}=u;if(s.has(f))continue;s.add(f);let d=await this.getNodeById(f,t);if(d&&(c.push(d),h<r)){let p=await this.getConnectedNodeIds(f);for(let y of p)s.has(y)||a.push({id:y,currentDepth:h+1})}}let l=await this.loadEdges(c,t);return{nodes:c,edges:l,hasMore:a.length>0,totalCount:s.size+a.length}}async getNodeById(e,t={}){let r=this.getCachedNode(e);if(r)return{...r};let i=this.idToIRI(e),s=await this.tripleStore.match(i,void 0,void 0);if(s.length===0)return null;let a=this.triplesToNode(e,s,t);return a&&this.cacheNode(a),a}subscribe(e){return this.subscribers.add(e),{unsubscribe:o(()=>{this.subscribers.delete(e)},"unsubscribe")}}notifyChange(e){for(let t of this.subscribers)try{t(e)}catch(r){this.logger?.error("GraphQueryService: error in subscriber callback",r instanceof Error?r:new Error(String(r)))}this.invalidateCache()}async getStats(){let e=await this.loadNodes({includeArchived:!0}),t=await this.loadEdges(e,{});return this.computeStats(e,t)}clearCache(){this.nodeCache.clear(),this.lastCacheUpdate=0}async loadNodes(e){let t=e.includeArchived??this.config.includeArchivedByDefault,r=e.limit??this.config.maxLimit,i=e.offset??0,s=await this.tripleStore.match(void 0,Ai.INSTANCE_CLASS,void 0),a=s;if(e.classes&&e.classes.length>0){let p=new Set(e.classes);a=s.filter(y=>{let w=this.getObjectValue(y.object);return w&&p.has(w)})}let c=new Set;for(let p of a)c.add(this.subjectToId(p.subject));let f=Array.from(c).slice(i,i+r).map(p=>this.getNodeById(p,e));return(await Promise.all(f)).filter(p=>!(!p||!t&&p.isArchived))}async loadEdges(e,t){let r=new Set(e.map(a=>a.id)),i=[],s=new Set;for(let a of e){let c=this.idToIRI(a.id),l=await this.tripleStore.match(c,void 0,void 0);for(let u of l){let f=this.tripleToEdge(a.id,u,r);f&&f.id&&!s.has(f.id)&&(!t.edgeTypes||t.edgeTypes.includes(f.type))&&(s.add(f.id),i.push(f))}}return i}async getConnectedNodeIds(e){let t=this.idToIRI(e),r=[],i=await this.tripleStore.match(t,void 0,void 0);for(let a of i){let c=this.objectToId(a.object);c&&r.push(c)}let s=await this.tripleStore.match(void 0,void 0,t);for(let a of s)r.push(this.subjectToId(a.subject));return[...new Set(r)]}triplesToNode(e,t,r){let i={},s,a,c,l,u=!1;for(let d of t){let p=d.predicate.value,y=this.getObjectValue(d.object);if(p===Ai.INSTANCE_CLASS.value)s=y;else if(p===Ai.ASSET_LABEL.value)a=y;else if(p===Ai.ASSET_PROTOTYPE.value)c=this.objectToId(d.object)??y;else if(p===Ai.EFFORT_PARENT.value)l=this.objectToId(d.object)??y;else if(p===Ai.ASSET_IS_ARCHIVED.value)u=y==="true"||y==="1";else{let w=this.predicateToPropertyName(p);w&&(i[w]=y)}}if(u&&!(r.includeArchived??this.config.includeArchivedByDefault))return null;let f=this.idToPath(e),h=a??this.pathToTitle(f);return{id:e,path:f,title:h,label:h,assetClass:s,isArchived:u,uri:e.startsWith("http")?e:void 0,prototype:c,parent:l,properties:Object.keys(i).length>0?i:void 0}}tripleToEdge(e,t,r){let i=t.predicate.value,s=this.objectToId(t.object);if(!s||!r.has(s)||s===e)return null;let a=this.predicateToEdgeType(i);if(!a)return null;let c=(0,tk.createEdgeId)(e,s,a,i),l=this.predicateToLabel(i);return{id:c,source:e,target:s,type:a,predicate:i,label:l}}predicateToEdgeType(e){return e===Ai.EFFORT_PARENT.value?"hierarchy":e===Ai.ASSET_PROTOTYPE.value?"prototype":e===Ai.REFERENCES.value?"forward-link":e===Ai.REFERENCED_BY.value?"backlink":e.includes("Asset_")||e.includes("Instance_")?null:"semantic"}predicateToLabel(e){let t=e.lastIndexOf("#"),r=e.lastIndexOf("/"),i=Math.max(t,r);return i>=0?e.substring(i+1):e}predicateToPropertyName(e){return this.predicateToLabel(e).replace(/_/g,"__").replace(/#/g,"_")}computeStats(e,t){let r={},i={backlink:0,"forward-link":0,hierarchy:0,prototype:0,semantic:0,reference:0};for(let c of e){let l=c.assetClass??"unknown";r[l]=(r[l]??0)+1}for(let c of t)i[c.type]=(i[c.type]??0)+1;let s=new Map,a=new Map;for(let c of t)a.set(c.source,(a.get(c.source)??0)+1),s.set(c.target,(s.get(c.target)??0)+1);for(let c of e)c.inDegree=s.get(c.id)??0,c.outDegree=a.get(c.id)??0,c.weight=c.inDegree+c.outDegree;return{nodeCount:e.length,edgeCount:t.length,nodesByClass:r,edgesByType:i,computedAt:Date.now()}}idToIRI(e){return e.startsWith("http://")||e.startsWith("https://")?new ll.IRI(e):new ll.IRI(`obsidian://vault/${encodeURIComponent(e)}`)}subjectToId(e){if(e instanceof ll.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return e.toString()}objectToId(e){if(e instanceof ll.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return null}getObjectValue(e){if(e instanceof ek.Literal||e instanceof ll.IRI)return e.value}idToPath(e){if(e.startsWith("obsidian://vault/"))return decodeURIComponent(e.replace("obsidian://vault/",""));if(e.startsWith("http://")||e.startsWith("https://")){let t=e.match(/\/([^/]+\.md)$/);if(t)return t[1]}return e}pathToTitle(e){return(e.split("/").pop()??e).replace(/\.md$/,"")}getCachedNode(e){return Date.now()-this.lastCacheUpdate>this.config.cacheTTL?(this.clearCache(),null):this.nodeCache.get(e)??null}cacheNode(e){this.nodeCache.set(e.id,e),this.lastCacheUpdate===0&&(this.lastCacheUpdate=Date.now())}invalidateCache(){this.clearCache()}};rs.GraphQueryService=K0;rs.GraphQueryService=K0=X4([(0,Z4.injectable)(),J4("design:paramtypes",[Object,Object,Object])],K0)});var Jb=_(ns=>{"use strict";var rk=ns&&ns.__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},nk=ns&&ns.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ns,"__esModule",{value:!0});ns.TypeRegistry=void 0;var ik=Ue(),Ci=ze(),Xb=$t(),sk=mt(),ot=bm(),X0=class{static{o(this,"TypeRegistry")}constructor(e=null,t={}){this.nodeTypes=new Map,this.edgeTypes=new Map,this.typeHierarchy=new Map,this.subscribers=new Set,this.discoveryComplete=!1,this.tripleStore=e,this.config={autoDiscoverTypes:t.autoDiscoverTypes??!0,includeBuiltInStyles:t.includeBuiltInStyles??!0,styleResolution:t.styleResolution??{mergeStyles:!0,inheritParentStyles:!0,defaultNodeStyle:ot.DEFAULT_NODE_STYLE,defaultEdgeStyle:ot.DEFAULT_EDGE_STYLE},maxInheritanceDepth:t.maxInheritanceDepth??10},this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerNodeType(e){let r=this.nodeTypes.get(e.uri)?"type-updated":"type-added";this.nodeTypes.set(e.uri,e),e.parentTypes&&e.parentTypes.length>0&&this.typeHierarchy.set(e.uri,e.parentTypes),this.emit({type:r,typeUri:e.uri,definition:e})}registerEdgeType(e){let r=this.edgeTypes.get(e.uri)?"type-updated":"type-added";this.edgeTypes.set(e.uri,e),this.emit({type:r,typeUri:e.uri,definition:e})}unregisterType(e){let t=this.nodeTypes.delete(e),r=this.edgeTypes.delete(e);this.typeHierarchy.delete(e),(t||r)&&this.emit({type:"type-removed",typeUri:e})}getNodeType(e){return this.nodeTypes.get(e)}getEdgeType(e){return this.edgeTypes.get(e)}getAllNodeTypes(){return Array.from(this.nodeTypes.values())}getAllEdgeTypes(){return Array.from(this.edgeTypes.values())}getParentTypes(e,t=this.config.maxInheritanceDepth){let r=[],i=new Set,s=[{uri:e,currentDepth:0}];for(;s.length>0;){let a=s.shift();if(!a)break;let{uri:c,currentDepth:l}=a;if(i.has(c)||(i.add(c),l>=t))continue;let u=this.typeHierarchy.get(c)??[];for(let f of u)i.has(f)||(r.push(f),s.push({uri:f,currentDepth:l+1}))}return r}getChildTypes(e){let t=[];for(let[r,i]of this.typeHierarchy)i.includes(e)&&t.push(r);return t}isSubtypeOf(e,t){return e===t?!0:this.getParentTypes(e).includes(t)}resolveNodeType(e){let t=[],r="unknown",i="custom";if(e.assetClass){let c=this.normalizeTypeUri(e.assetClass);t.push(c),r=c,i="exo:Instance_class"}let s=e.properties?.[ot.RDF_TYPE_PREDICATES.RDF_TYPE];s&&!t.includes(s)&&(t.push(s),r==="unknown"&&(r=s,i="rdf:type"));for(let c of[...t]){let l=this.getParentTypes(c);for(let u of l)t.includes(u)||t.push(u)}let a=this.resolveNodeStyle(t);return{primaryType:r,types:t,resolvedStyle:a,source:i}}resolveEdgeType(e){let t=e.predicate??e.type,r=e.predicate?"rdf:type":"custom",i=this.resolveEdgeStyle(t);return{primaryType:t,resolvedStyle:i,source:r}}resolveNodeStyle(e){let{mergeStyles:t,defaultNodeStyle:r}=this.config.styleResolution,i={...r},s=[];for(let a of e){let c=this.nodeTypes.get(a);c&&s.push(c)}if(s.sort((a,c)=>a.priority-c.priority),t)for(let a of s)i=(0,ot.mergeNodeStyles)(i,a.style);else if(s.length>0){let a=s[s.length-1];i=(0,ot.mergeNodeStyles)(i,a.style)}return i}resolveEdgeStyle(e){let{defaultEdgeStyle:t}=this.config.styleResolution,r={...t},i=this.edgeTypes.get(e);return i&&(r=(0,ot.mergeEdgeStyles)(r,i.style)),r}filterNodes(e,t){return e.filter(r=>{let i=this.resolveNodeType(r);return!(t.includeNodeTypes&&t.includeNodeTypes.length>0&&!t.includeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||t.excludeNodeTypes&&t.excludeNodeTypes.length>0&&t.excludeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||!t.includeDeprecated&&this.nodeTypes.get(i.primaryType)?.deprecated)})}filterEdges(e,t){return e.filter(r=>{let i=r.predicate??r.type;return!(t.includeEdgeTypes&&t.includeEdgeTypes.length>0&&!t.includeEdgeTypes.includes(i)||t.excludeEdgeTypes&&t.excludeEdgeTypes.length>0&&t.excludeEdgeTypes.includes(i))})}groupNodesByType(e,t,r={}){let{groupByNodeType:i=!0,groupByParentType:s=!1,groupLevel:a=0,maxGroups:c=20,customGroupFn:l}=r,u=new Map;for(let d of e){let p=this.resolveNodeType(d),y;if(l?y=l(p.types):s&&p.types.length>a?y=p.types[a]??p.primaryType:i?y=p.primaryType:y="all",!u.has(y)){let S=this.nodeTypes.get(y)?.label??(0,ot.extractLocalName)(y);u.set(y,{nodeIds:new Set,label:S})}let w=u.get(y);w&&w.nodeIds.add(d.id)}let f=Array.from(u.entries()).map(([d,p])=>({id:d,label:p.label,nodeIds:Array.from(p.nodeIds)}));if(f.length>c){f.sort((y,w)=>w.nodeIds.length-y.nodeIds.length);let d=f.slice(0,c-1),p=f.slice(c-1).flatMap(y=>y.nodeIds);d.push({id:"other",label:"Other",nodeIds:p}),f=d}let h=new Map;for(let d of f)for(let p of d.nodeIds)h.set(p,d.id);return f.map((d,p)=>{let y=new Set(d.nodeIds),w=[],T=[];for(let F of t){let Q=y.has(F.source),K=y.has(F.target);Q&&K?F.id&&w.push(F.id):(Q||K)&&F.id&&T.push(F.id)}let A=`hsl(${p*137.5%360}, 70%, 50%)`;return{id:d.id,label:d.label,nodeIds:d.nodeIds,internalEdgeIds:w,externalEdgeIds:T,color:A,stats:{nodeCount:d.nodeIds.length,internalEdgeCount:w.length,externalEdgeCount:T.length}}})}validateTypes(e,t){let r=[],i=[];for(let s of e){let a=this.resolveNodeType(s);if(a.primaryType!=="unknown"){let c=this.nodeTypes.get(a.primaryType);!c&&a.source!=="inferred"&&i.push({code:"UNREGISTERED_NODE_TYPE",message:`Node type "${a.primaryType}" is not registered`,elementId:s.id,suggestion:"Register the type with registerNodeType()"}),c?.deprecated&&i.push({code:"DEPRECATED_NODE_TYPE",message:`Node uses deprecated type "${a.primaryType}"`,elementId:s.id,suggestion:"Migrate to a non-deprecated type"})}else i.push({code:"MISSING_NODE_TYPE",message:"Node has no type information",elementId:s.id,suggestion:"Add exo:Instance_class or rdf:type to the node"})}for(let s of t){let a=s.predicate??s.type,c=this.edgeTypes.get(a);if(c?.domain&&c.domain.length>0){let l=e.find(u=>u.id===s.source);if(l){let u=this.resolveNodeType(l);c.domain.some(h=>u.types.includes(h))||r.push({code:"DOMAIN_VIOLATION",message:"Edge source does not match expected domain",elementId:s.id,expected:c.domain,actual:u.types})}}if(c?.range&&c.range.length>0){let l=e.find(u=>u.id===s.target);if(l){let u=this.resolveNodeType(l);c.range.some(h=>u.types.includes(h))||r.push({code:"RANGE_VIOLATION",message:"Edge target does not match expected range",elementId:s.id,expected:c.range,actual:u.types})}}}return{valid:r.length===0,errors:r,warnings:i}}async discoverTypes(){if(!this.tripleStore||this.discoveryComplete)return;let e=await this.tripleStore.match(void 0,new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let r of e){let i=this.getObjectValue(r.object);if(i&&(0,ot.isClassType)(i)){let s=this.getSubjectValue(r.subject);s&&await this.discoverNodeType(s)}}let t=await this.tripleStore.match(void 0,new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF),void 0);for(let r of t){let i=this.getSubjectValue(r.subject),s=this.getObjectValue(r.object);if(i&&s){let a=this.typeHierarchy.get(i)??[];if(!a.includes(s)){a.push(s),this.typeHierarchy.set(i,a);let c=this.nodeTypes.get(i);c&&(c.parentTypes=a)}}}this.discoveryComplete=!0,this.emit({type:"hierarchy-updated",rootTypes:this.getRootTypes()})}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}clear(){this.nodeTypes.clear(),this.edgeTypes.clear(),this.typeHierarchy.clear(),this.discoveryComplete=!1,this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerBuiltInTypes(){for(let[e,t]of Object.entries(ot.BUILT_IN_NODE_STYLES))this.nodeTypes.set(e,{uri:e,label:(0,ot.extractLocalName)(e),source:"custom",style:(0,ot.mergeNodeStyles)(ot.DEFAULT_NODE_STYLE,t),priority:1});for(let[e,t]of Object.entries(ot.BUILT_IN_EDGE_STYLES))this.edgeTypes.set(e,{uri:e,label:(0,ot.extractLocalName)(e),source:"custom",style:(0,ot.mergeEdgeStyles)(ot.DEFAULT_EDGE_STYLE,t),priority:1})}async discoverNodeType(e){if(this.nodeTypes.has(e)||!this.tripleStore)return;let t=await this.tripleStore.match(new Ci.IRI(e),new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDFS_LABEL),void 0),r=await this.tripleStore.match(new Ci.IRI(e),new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDFS_COMMENT),void 0),i=t.length>0?this.getObjectValue(t[0].object)??(0,ot.extractLocalName)(e):(0,ot.extractLocalName)(e),s=r.length>0?this.getObjectValue(r[0].object):void 0,a="rdfs:Class",c=await this.tripleStore.match(new Ci.IRI(e),new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let f of c)if(this.getObjectValue(f.object)===ot.RDF_TYPE_PREDICATES.OWL_CLASS){a="owl:Class";break}let l=ot.BUILT_IN_NODE_STYLES[e]??ot.BUILT_IN_NODE_STYLES[(0,ot.extractLocalName)(e)],u={uri:e,label:i,description:s,source:a,style:(0,ot.mergeNodeStyles)(ot.DEFAULT_NODE_STYLE,l??{}),priority:1};this.registerNodeType(u)}normalizeTypeUri(e){let t=e.match(/^\[\[(.+?)\]\]$/);return t?t[1]:e}getSubjectValue(e){if(e instanceof Ci.IRI)return e.value;if(e instanceof Xb.BlankNode)return`_:${e.id}`;if(typeof e=="object"&&e!==null&&"termType"in e)return e.toString()}getObjectValue(e){if(e instanceof sk.Literal||e instanceof Ci.IRI)return e.value;if(e instanceof Xb.BlankNode)return`_:${e.id}`}getRootTypes(){let e=new Set;for(let r of this.typeHierarchy.values())for(let i of r)e.add(i);let t=[];for(let r of this.nodeTypes.keys()){let i=this.typeHierarchy.get(r);(!i||i.length===0)&&e.has(r)&&t.push(r)}return t}emit(e){for(let t of this.subscribers)try{t(e)}catch(r){console.error("TypeRegistry: error in subscriber callback",r)}}};ns.TypeRegistry=X0;ns.TypeRegistry=X0=rk([(0,ik.injectable)(),nk("design:paramtypes",[Object,Object])],X0)});var J0=_(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.SPARQL_TEMPLATES=j.KNOWN_CLASSES=j.KNOWN_PROTOTYPES=j.EFFORT_STATUSES=j.ASSET_CLASSES=j.PREDICATES=j.SPARQL_PREFIXES=void 0;j.findClassByTerm=ak;j.getTemplateByName=ok;j.findMatchingTemplates=ck;j.fillTemplate=lk;j.validateParameters=uk;j.SPARQL_PREFIXES=`PREFIX exo: <https://exocortex.my/ontology/exo#>
|
|
106
|
+
---`)}};Xn.AssetConversionService=U0;Xn.AssetConversionService=U0=P4([(0,qb.injectable)(),D4(0,(0,qb.inject)(k4.DI_TOKENS.IVaultAdapter)),F4("design:paramtypes",[Object])],U0)});var W0=_(Jn=>{"use strict";var L4=Jn&&Jn.__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},M4=Jn&&Jn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},j4=Jn&&Jn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.SessionEventService=void 0;var Gb=Ue(),$4=Lr(),Hb=vr(),V4=or(),U4=bn(),B4=ht(),q0=class{static{o(this,"SessionEventService")}constructor(e){this.vault=e,this.folderPathCache=null}async createSessionStartEvent(e){return this.createSessionEvent(e,Hb.AssetClass.SESSION_START_EVENT)}async createSessionEndEvent(e){return this.createSessionEvent(e,Hb.AssetClass.SESSION_END_EVENT)}getSessionEventFolder(){if(this.folderPathCache!==null)return this.folderPathCache;let e=this.vault.getDefaultNewFileParent();return this.folderPathCache=e?.path||"",this.folderPathCache}async createSessionEvent(e,t){let r=(0,$4.v4)(),i=V4.DateFormatter.toLocalTimestamp(new Date),s={exo__Asset_uid:r,exo__Asset_createdAt:i,exo__Asset_isDefinedBy:'"[[!kitelev]]"',exo__Instance_class:[`"[[${t}]]"`],ems__SessionEvent_timestamp:i,ems__Session_area:`"[[${e}]]"`},a=U4.MetadataHelpers.buildFileContent(s),c=this.getSessionEventFolder();c&&!await this.vault.exists(c)&&await this.vault.createFolder(c);let l=c?`${c}/${r}.md`:`${r}.md`;return await this.vault.create(l,a)}};Jn.SessionEventService=q0;Jn.SessionEventService=q0=L4([(0,Gb.injectable)(),j4(0,(0,Gb.inject)(B4.DI_TOKENS.IVaultAdapter)),M4("design:paramtypes",[Object])],q0)});var z0=_(Zn=>{"use strict";var q4=Zn&&Zn.__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},W4=Zn&&Zn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},zb=Zn&&Zn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.URIConstructionService=void 0;var G0=Ue(),Qb=ht(),H0=class{static{o(this,"URIConstructionService")}constructor(e,t){this.fileSystem=e,this.logger=t,this.defaultOntologyURL="https://exocortex.my/default/",this.strictValidation=!0}configure(e){e?.defaultOntologyURL&&(this.defaultOntologyURL=e.defaultOntologyURL),e?.strictValidation!==void 0&&(this.strictValidation=e.strictValidation)}async constructAssetURI(e){let t=this.extractUID(e);if(!t){if(this.strictValidation)throw new Error(`Asset missing exo__Asset_uid: ${e.path}`);return this.logger.warn(`Asset ${e.path} missing UID, using filename fallback`),this.constructFallbackURI(e)}let r=await this.resolveOntologyURL(e);if(!this.validateOntologyURL(r))throw new Error(`Invalid ontology URL: ${r}`);return`${r.endsWith("/")?r:`${r}/`}${t}`}validateOntologyURL(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}async resolveOntologyURL(e){let t=e.frontmatter?.exo__Asset_isDefinedBy;if(!t||typeof t!="string")return this.defaultOntologyURL;let r=this.extractWikiLink(t),i=r,s=await this.fileSystem.fileExists(r);return!s&&!r.endsWith(".md")&&(i=`${r}.md`,s=await this.fileSystem.fileExists(i)),s?(await this.fileSystem.getFileMetadata(i))?.exo__Ontology_url||this.defaultOntologyURL:(this.logger.warn(`Ontology file not found: ${r}, using default`),this.defaultOntologyURL)}extractUID(e){let t=e.frontmatter?.exo__Asset_uid;return typeof t=="string"?t:null}extractWikiLink(e){return e.replace(/^\[\[|\]\]$/g,"")}constructFallbackURI(e){let t=e.path.split("/").pop()?.replace(".md","")||"unknown";return`${this.defaultOntologyURL}${t}`}};Zn.URIConstructionService=H0;Zn.URIConstructionService=H0=q4([(0,G0.injectable)(),zb(0,(0,G0.inject)(Qb.DI_TOKENS.IFileSystemAdapter)),zb(1,(0,G0.inject)(Qb.DI_TOKENS.ILogger)),W4("design:paramtypes",[Object,Object])],H0)});var Y0=_(ei=>{"use strict";var G4=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},H4=ei&&ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},z4=ei&&ei.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ei,"__esModule",{value:!0});ei.GenericAssetCreationService=void 0;var Yb=Ue(),Q4=Lr(),cl=or(),Y4=bn(),K4=ht(),xi=ag(),Q0=class{static{o(this,"GenericAssetCreationService")}constructor(e){this.vault=e}async createAsset(e,t){let r=(0,Q4.v4)(),i=`${r}.md`,s=this.generateFrontmatter(e,t||[],r),a=Y4.MetadataHelpers.buildFileContent(s),c=e.folderPath||this.getDefaultFolderPath(e);this.vault.getAbstractFileByPath(c)||await this.vault.createFolder(c);let u=c?`${c}/${i}`:i;return await this.vault.create(u,a)}generateFrontmatter(e,t,r){let i=new Date,s={},a=new Map;for(let c of t)a.set(c.name,c.fieldType);if(s.exo__Asset_uid=r,s.exo__Asset_createdAt=cl.DateFormatter.toLocalTimestamp(i),s.exo__Instance_class=[this.formatWikilink(e.className)],e.label&&e.label.trim()!==""){let c=e.label.trim();s.exo__Asset_label=c,s.aliases=[c]}if(e.parentFile&&e.parentMetadata&&this.inheritParentContext(s,e),e.propertyValues)for(let[c,l]of Object.entries(e.propertyValues)){if(c==="exo__Asset_uid"||c==="exo__Asset_createdAt"||c==="exo__Instance_class"||c==="exo__Asset_label"||c==="aliases"||l==null)continue;let u=a.get(c);s[c]=this.formatValue(l,u)}return s}inheritParentContext(e,t){let r=t.parentMetadata||{},i=t.parentFile?.basename;if((t.className==="ems__Task"||t.className.startsWith("ems__Task"))&&(e.ems__Effort_parent=i?this.formatWikilink(i):null),t.className==="ems__Project"||t.className.startsWith("ems__Project")){let s=r.exo__Instance_class;this.isAreaClass(s)&&(e.ems__Project_area=i?this.formatWikilink(i):null)}r.exo__Asset_isDefinedBy&&(e.exo__Asset_isDefinedBy=r.exo__Asset_isDefinedBy)}isAreaClass(e){return e?(Array.isArray(e)?e:[e]).some(r=>String(r).includes("Area")||String(r).includes("ems__Area")):!1}getDefaultFolderPath(e){if(e.parentFile?.parent?.path)return e.parentFile.parent.path;let t={ems__Task:"tasks",ems__Project:"projects",ems__Area:"areas",ems__Meeting:"meetings",exo__Event:"events",ims__Concept:"concepts"};if(t[e.className])return t[e.className];for(let[r,i]of Object.entries(t))if(e.className.startsWith(r))return i;return"assets"}formatValue(e,t){if(e==null)return null;if(!t)return this.formatInferredValue(e);switch(t){case xi.PropertyFieldType.Text:return String(e);case xi.PropertyFieldType.Wikilink:case xi.PropertyFieldType.Reference:case xi.PropertyFieldType.StatusSelect:case xi.PropertyFieldType.SizeSelect:return this.formatWikilink(String(e));case xi.PropertyFieldType.Number:return typeof e=="number"?e:Number(e)||0;case xi.PropertyFieldType.Boolean:return this.formatBoolean(e);case xi.PropertyFieldType.Date:case xi.PropertyFieldType.DateTime:case xi.PropertyFieldType.Timestamp:return this.formatTimestamp(e);default:return String(e)}}formatInferredValue(e){return typeof e=="boolean"||typeof e=="number"?e:e instanceof Date?cl.DateFormatter.toLocalTimestamp(e):typeof e=="string"?e.startsWith("[[")||e.startsWith('"[[')?this.formatWikilink(e):e:String(e)}formatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:`"[[${e}]]"`}formatBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"}return typeof e=="number"?e!==0:!!e}formatTimestamp(e){if(e instanceof Date)return cl.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:cl.DateFormatter.toLocalTimestamp(t)}if(typeof e=="number"){let t=new Date(e);if(!isNaN(t.getTime()))return cl.DateFormatter.toLocalTimestamp(t)}return String(e)}};ei.GenericAssetCreationService=Q0;ei.GenericAssetCreationService=Q0=G4([(0,Yb.injectable)(),z4(0,(0,Yb.inject)(K4.DI_TOKENS.IVaultAdapter)),H4("design:paramtypes",[Object])],Q0)});var Kb=_(rs=>{"use strict";var X4=rs&&rs.__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},J4=rs&&rs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(rs,"__esModule",{value:!0});rs.GraphQueryService=void 0;var Z4=Ue(),ll=ze(),ek=mt(),Cs=cn(),tk=wm(),Ai={INSTANCE_CLASS:Cs.Namespace.EXO.term("Instance_class"),ASSET_LABEL:Cs.Namespace.EXO.term("Asset_label"),ASSET_PROTOTYPE:Cs.Namespace.EXO.term("Asset_prototype"),ASSET_IS_ARCHIVED:Cs.Namespace.EXO.term("Asset_isArchived"),EFFORT_PARENT:Cs.Namespace.EMS.term("Effort_parent"),REFERENCES:Cs.Namespace.EXO.term("references"),REFERENCED_BY:Cs.Namespace.EXO.term("referencedBy"),RDF_TYPE:Cs.Namespace.RDF.term("type")},K0=class{static{o(this,"GraphQueryService")}constructor(e,t={},r){this.subscribers=new Set,this.nodeCache=new Map,this.lastCacheUpdate=0,this.tripleStore=e,this.logger=r,this.config={defaultLimit:t.defaultLimit??100,maxLimit:t.maxLimit??1e4,defaultDepth:t.defaultDepth??2,maxDepth:t.maxDepth??10,includeArchivedByDefault:t.includeArchivedByDefault??!1,cacheTTL:t.cacheTTL??3e4}}async loadGraphData(e={}){let t=Date.now(),r=await this.loadNodes(e),i=await this.loadEdges(r,e),s=this.computeStats(r,i),a=Date.now()-t;return a>100&&r.length>0&&this.logger?.debug(`GraphQueryService: loaded ${r.length} nodes in ${a}ms (${(a/r.length).toFixed(2)}ms/node)`),{nodes:r,edges:i,stats:s,lastUpdated:Date.now(),version:1}}async loadNodesIncremental(e={}){let t=Math.min(e.limit??this.config.defaultLimit,this.config.maxLimit),r=e.offset??0,i=await this.loadNodes({...e,limit:t+1,offset:r}),s=i.length>t,a=s?i.slice(0,t):i,c=await this.loadEdges(a,e);return{nodes:a,edges:c,hasMore:s,totalCount:void 0,cursor:s?String(r+t):void 0}}async loadConnectedNodes(e,t={}){let r=Math.min(t.depth??this.config.defaultDepth,this.config.maxDepth),i=Math.min(t.limit??this.config.maxLimit,this.config.maxLimit),s=new Set,a=[{id:e,currentDepth:0}],c=[];for(;a.length>0&&c.length<i;){let u=a.shift();if(!u)break;let{id:f,currentDepth:h}=u;if(s.has(f))continue;s.add(f);let d=await this.getNodeById(f,t);if(d&&(c.push(d),h<r)){let p=await this.getConnectedNodeIds(f);for(let y of p)s.has(y)||a.push({id:y,currentDepth:h+1})}}let l=await this.loadEdges(c,t);return{nodes:c,edges:l,hasMore:a.length>0,totalCount:s.size+a.length}}async getNodeById(e,t={}){let r=this.getCachedNode(e);if(r)return{...r};let i=this.idToIRI(e),s=await this.tripleStore.match(i,void 0,void 0);if(s.length===0)return null;let a=this.triplesToNode(e,s,t);return a&&this.cacheNode(a),a}subscribe(e){return this.subscribers.add(e),{unsubscribe:o(()=>{this.subscribers.delete(e)},"unsubscribe")}}notifyChange(e){for(let t of this.subscribers)try{t(e)}catch(r){this.logger?.error("GraphQueryService: error in subscriber callback",r instanceof Error?r:new Error(String(r)))}this.invalidateCache()}async getStats(){let e=await this.loadNodes({includeArchived:!0}),t=await this.loadEdges(e,{});return this.computeStats(e,t)}clearCache(){this.nodeCache.clear(),this.lastCacheUpdate=0}async loadNodes(e){let t=e.includeArchived??this.config.includeArchivedByDefault,r=e.limit??this.config.maxLimit,i=e.offset??0,s=await this.tripleStore.match(void 0,Ai.INSTANCE_CLASS,void 0),a=s;if(e.classes&&e.classes.length>0){let p=new Set(e.classes);a=s.filter(y=>{let w=this.getObjectValue(y.object);return w&&p.has(w)})}let c=new Set;for(let p of a)c.add(this.subjectToId(p.subject));let f=Array.from(c).slice(i,i+r).map(p=>this.getNodeById(p,e));return(await Promise.all(f)).filter(p=>!(!p||!t&&p.isArchived))}async loadEdges(e,t){let r=new Set(e.map(a=>a.id)),i=[],s=new Set;for(let a of e){let c=this.idToIRI(a.id),l=await this.tripleStore.match(c,void 0,void 0);for(let u of l){let f=this.tripleToEdge(a.id,u,r);f&&f.id&&!s.has(f.id)&&(!t.edgeTypes||t.edgeTypes.includes(f.type))&&(s.add(f.id),i.push(f))}}return i}async getConnectedNodeIds(e){let t=this.idToIRI(e),r=[],i=await this.tripleStore.match(t,void 0,void 0);for(let a of i){let c=this.objectToId(a.object);c&&r.push(c)}let s=await this.tripleStore.match(void 0,void 0,t);for(let a of s)r.push(this.subjectToId(a.subject));return[...new Set(r)]}triplesToNode(e,t,r){let i={},s,a,c,l,u=!1;for(let d of t){let p=d.predicate.value,y=this.getObjectValue(d.object);if(p===Ai.INSTANCE_CLASS.value)s=y;else if(p===Ai.ASSET_LABEL.value)a=y;else if(p===Ai.ASSET_PROTOTYPE.value)c=this.objectToId(d.object)??y;else if(p===Ai.EFFORT_PARENT.value)l=this.objectToId(d.object)??y;else if(p===Ai.ASSET_IS_ARCHIVED.value)u=y==="true"||y==="1";else{let w=this.predicateToPropertyName(p);w&&(i[w]=y)}}if(u&&!(r.includeArchived??this.config.includeArchivedByDefault))return null;let f=this.idToPath(e),h=a??this.pathToTitle(f);return{id:e,path:f,title:h,label:h,assetClass:s,isArchived:u,uri:e.startsWith("http")?e:void 0,prototype:c,parent:l,properties:Object.keys(i).length>0?i:void 0}}tripleToEdge(e,t,r){let i=t.predicate.value,s=this.objectToId(t.object);if(!s||!r.has(s)||s===e)return null;let a=this.predicateToEdgeType(i);if(!a)return null;let c=(0,tk.createEdgeId)(e,s,a,i),l=this.predicateToLabel(i);return{id:c,source:e,target:s,type:a,predicate:i,label:l}}predicateToEdgeType(e){return e===Ai.EFFORT_PARENT.value?"hierarchy":e===Ai.ASSET_PROTOTYPE.value?"prototype":e===Ai.REFERENCES.value?"forward-link":e===Ai.REFERENCED_BY.value?"backlink":e.includes("Asset_")||e.includes("Instance_")?null:"semantic"}predicateToLabel(e){let t=e.lastIndexOf("#"),r=e.lastIndexOf("/"),i=Math.max(t,r);return i>=0?e.substring(i+1):e}predicateToPropertyName(e){return this.predicateToLabel(e).replace(/_/g,"__").replace(/#/g,"_")}computeStats(e,t){let r={},i={backlink:0,"forward-link":0,hierarchy:0,prototype:0,semantic:0,reference:0};for(let c of e){let l=c.assetClass??"unknown";r[l]=(r[l]??0)+1}for(let c of t)i[c.type]=(i[c.type]??0)+1;let s=new Map,a=new Map;for(let c of t)a.set(c.source,(a.get(c.source)??0)+1),s.set(c.target,(s.get(c.target)??0)+1);for(let c of e)c.inDegree=s.get(c.id)??0,c.outDegree=a.get(c.id)??0,c.weight=c.inDegree+c.outDegree;return{nodeCount:e.length,edgeCount:t.length,nodesByClass:r,edgesByType:i,computedAt:Date.now()}}idToIRI(e){return e.startsWith("http://")||e.startsWith("https://")?new ll.IRI(e):new ll.IRI(`obsidian://vault/${encodeURIComponent(e)}`)}subjectToId(e){if(e instanceof ll.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return e.toString()}objectToId(e){if(e instanceof ll.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return null}getObjectValue(e){if(e instanceof ek.Literal||e instanceof ll.IRI)return e.value}idToPath(e){if(e.startsWith("obsidian://vault/"))return decodeURIComponent(e.replace("obsidian://vault/",""));if(e.startsWith("http://")||e.startsWith("https://")){let t=e.match(/\/([^/]+\.md)$/);if(t)return t[1]}return e}pathToTitle(e){return(e.split("/").pop()??e).replace(/\.md$/,"")}getCachedNode(e){return Date.now()-this.lastCacheUpdate>this.config.cacheTTL?(this.clearCache(),null):this.nodeCache.get(e)??null}cacheNode(e){this.nodeCache.set(e.id,e),this.lastCacheUpdate===0&&(this.lastCacheUpdate=Date.now())}invalidateCache(){this.clearCache()}};rs.GraphQueryService=K0;rs.GraphQueryService=K0=X4([(0,Z4.injectable)(),J4("design:paramtypes",[Object,Object,Object])],K0)});var Jb=_(ns=>{"use strict";var rk=ns&&ns.__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},nk=ns&&ns.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ns,"__esModule",{value:!0});ns.TypeRegistry=void 0;var ik=Ue(),Ci=ze(),Xb=$t(),sk=mt(),ot=bm(),X0=class{static{o(this,"TypeRegistry")}constructor(e=null,t={}){this.nodeTypes=new Map,this.edgeTypes=new Map,this.typeHierarchy=new Map,this.subscribers=new Set,this.discoveryComplete=!1,this.tripleStore=e,this.config={autoDiscoverTypes:t.autoDiscoverTypes??!0,includeBuiltInStyles:t.includeBuiltInStyles??!0,styleResolution:t.styleResolution??{mergeStyles:!0,inheritParentStyles:!0,defaultNodeStyle:ot.DEFAULT_NODE_STYLE,defaultEdgeStyle:ot.DEFAULT_EDGE_STYLE},maxInheritanceDepth:t.maxInheritanceDepth??10},this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerNodeType(e){let r=this.nodeTypes.get(e.uri)?"type-updated":"type-added";this.nodeTypes.set(e.uri,e),e.parentTypes&&e.parentTypes.length>0&&this.typeHierarchy.set(e.uri,e.parentTypes),this.emit({type:r,typeUri:e.uri,definition:e})}registerEdgeType(e){let r=this.edgeTypes.get(e.uri)?"type-updated":"type-added";this.edgeTypes.set(e.uri,e),this.emit({type:r,typeUri:e.uri,definition:e})}unregisterType(e){let t=this.nodeTypes.delete(e),r=this.edgeTypes.delete(e);this.typeHierarchy.delete(e),(t||r)&&this.emit({type:"type-removed",typeUri:e})}getNodeType(e){return this.nodeTypes.get(e)}getEdgeType(e){return this.edgeTypes.get(e)}getAllNodeTypes(){return Array.from(this.nodeTypes.values())}getAllEdgeTypes(){return Array.from(this.edgeTypes.values())}getParentTypes(e,t=this.config.maxInheritanceDepth){let r=[],i=new Set,s=[{uri:e,currentDepth:0}];for(;s.length>0;){let a=s.shift();if(!a)break;let{uri:c,currentDepth:l}=a;if(i.has(c)||(i.add(c),l>=t))continue;let u=this.typeHierarchy.get(c)??[];for(let f of u)i.has(f)||(r.push(f),s.push({uri:f,currentDepth:l+1}))}return r}getChildTypes(e){let t=[];for(let[r,i]of this.typeHierarchy)i.includes(e)&&t.push(r);return t}isSubtypeOf(e,t){return e===t?!0:this.getParentTypes(e).includes(t)}resolveNodeType(e){let t=[],r="unknown",i="custom";if(e.assetClass){let c=this.normalizeTypeUri(e.assetClass);t.push(c),r=c,i="exo:Instance_class"}let s=e.properties?.[ot.RDF_TYPE_PREDICATES.RDF_TYPE];s&&!t.includes(s)&&(t.push(s),r==="unknown"&&(r=s,i="rdf:type"));for(let c of[...t]){let l=this.getParentTypes(c);for(let u of l)t.includes(u)||t.push(u)}let a=this.resolveNodeStyle(t);return{primaryType:r,types:t,resolvedStyle:a,source:i}}resolveEdgeType(e){let t=e.predicate??e.type,r=e.predicate?"rdf:type":"custom",i=this.resolveEdgeStyle(t);return{primaryType:t,resolvedStyle:i,source:r}}resolveNodeStyle(e){let{mergeStyles:t,defaultNodeStyle:r}=this.config.styleResolution,i={...r},s=[];for(let a of e){let c=this.nodeTypes.get(a);c&&s.push(c)}if(s.sort((a,c)=>a.priority-c.priority),t)for(let a of s)i=(0,ot.mergeNodeStyles)(i,a.style);else if(s.length>0){let a=s[s.length-1];i=(0,ot.mergeNodeStyles)(i,a.style)}return i}resolveEdgeStyle(e){let{defaultEdgeStyle:t}=this.config.styleResolution,r={...t},i=this.edgeTypes.get(e);return i&&(r=(0,ot.mergeEdgeStyles)(r,i.style)),r}filterNodes(e,t){return e.filter(r=>{let i=this.resolveNodeType(r);return!(t.includeNodeTypes&&t.includeNodeTypes.length>0&&!t.includeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||t.excludeNodeTypes&&t.excludeNodeTypes.length>0&&t.excludeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||!t.includeDeprecated&&this.nodeTypes.get(i.primaryType)?.deprecated)})}filterEdges(e,t){return e.filter(r=>{let i=r.predicate??r.type;return!(t.includeEdgeTypes&&t.includeEdgeTypes.length>0&&!t.includeEdgeTypes.includes(i)||t.excludeEdgeTypes&&t.excludeEdgeTypes.length>0&&t.excludeEdgeTypes.includes(i))})}groupNodesByType(e,t,r={}){let{groupByNodeType:i=!0,groupByParentType:s=!1,groupLevel:a=0,maxGroups:c=20,customGroupFn:l}=r,u=new Map;for(let d of e){let p=this.resolveNodeType(d),y;if(l?y=l(p.types):s&&p.types.length>a?y=p.types[a]??p.primaryType:i?y=p.primaryType:y="all",!u.has(y)){let S=this.nodeTypes.get(y)?.label??(0,ot.extractLocalName)(y);u.set(y,{nodeIds:new Set,label:S})}let w=u.get(y);w&&w.nodeIds.add(d.id)}let f=Array.from(u.entries()).map(([d,p])=>({id:d,label:p.label,nodeIds:Array.from(p.nodeIds)}));if(f.length>c){f.sort((y,w)=>w.nodeIds.length-y.nodeIds.length);let d=f.slice(0,c-1),p=f.slice(c-1).flatMap(y=>y.nodeIds);d.push({id:"other",label:"Other",nodeIds:p}),f=d}let h=new Map;for(let d of f)for(let p of d.nodeIds)h.set(p,d.id);return f.map((d,p)=>{let y=new Set(d.nodeIds),w=[],T=[];for(let F of t){let Q=y.has(F.source),K=y.has(F.target);Q&&K?F.id&&w.push(F.id):(Q||K)&&F.id&&T.push(F.id)}let x=`hsl(${p*137.5%360}, 70%, 50%)`;return{id:d.id,label:d.label,nodeIds:d.nodeIds,internalEdgeIds:w,externalEdgeIds:T,color:x,stats:{nodeCount:d.nodeIds.length,internalEdgeCount:w.length,externalEdgeCount:T.length}}})}validateTypes(e,t){let r=[],i=[];for(let s of e){let a=this.resolveNodeType(s);if(a.primaryType!=="unknown"){let c=this.nodeTypes.get(a.primaryType);!c&&a.source!=="inferred"&&i.push({code:"UNREGISTERED_NODE_TYPE",message:`Node type "${a.primaryType}" is not registered`,elementId:s.id,suggestion:"Register the type with registerNodeType()"}),c?.deprecated&&i.push({code:"DEPRECATED_NODE_TYPE",message:`Node uses deprecated type "${a.primaryType}"`,elementId:s.id,suggestion:"Migrate to a non-deprecated type"})}else i.push({code:"MISSING_NODE_TYPE",message:"Node has no type information",elementId:s.id,suggestion:"Add exo:Instance_class or rdf:type to the node"})}for(let s of t){let a=s.predicate??s.type,c=this.edgeTypes.get(a);if(c?.domain&&c.domain.length>0){let l=e.find(u=>u.id===s.source);if(l){let u=this.resolveNodeType(l);c.domain.some(h=>u.types.includes(h))||r.push({code:"DOMAIN_VIOLATION",message:"Edge source does not match expected domain",elementId:s.id,expected:c.domain,actual:u.types})}}if(c?.range&&c.range.length>0){let l=e.find(u=>u.id===s.target);if(l){let u=this.resolveNodeType(l);c.range.some(h=>u.types.includes(h))||r.push({code:"RANGE_VIOLATION",message:"Edge target does not match expected range",elementId:s.id,expected:c.range,actual:u.types})}}}return{valid:r.length===0,errors:r,warnings:i}}async discoverTypes(){if(!this.tripleStore||this.discoveryComplete)return;let e=await this.tripleStore.match(void 0,new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let r of e){let i=this.getObjectValue(r.object);if(i&&(0,ot.isClassType)(i)){let s=this.getSubjectValue(r.subject);s&&await this.discoverNodeType(s)}}let t=await this.tripleStore.match(void 0,new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF),void 0);for(let r of t){let i=this.getSubjectValue(r.subject),s=this.getObjectValue(r.object);if(i&&s){let a=this.typeHierarchy.get(i)??[];if(!a.includes(s)){a.push(s),this.typeHierarchy.set(i,a);let c=this.nodeTypes.get(i);c&&(c.parentTypes=a)}}}this.discoveryComplete=!0,this.emit({type:"hierarchy-updated",rootTypes:this.getRootTypes()})}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}clear(){this.nodeTypes.clear(),this.edgeTypes.clear(),this.typeHierarchy.clear(),this.discoveryComplete=!1,this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerBuiltInTypes(){for(let[e,t]of Object.entries(ot.BUILT_IN_NODE_STYLES))this.nodeTypes.set(e,{uri:e,label:(0,ot.extractLocalName)(e),source:"custom",style:(0,ot.mergeNodeStyles)(ot.DEFAULT_NODE_STYLE,t),priority:1});for(let[e,t]of Object.entries(ot.BUILT_IN_EDGE_STYLES))this.edgeTypes.set(e,{uri:e,label:(0,ot.extractLocalName)(e),source:"custom",style:(0,ot.mergeEdgeStyles)(ot.DEFAULT_EDGE_STYLE,t),priority:1})}async discoverNodeType(e){if(this.nodeTypes.has(e)||!this.tripleStore)return;let t=await this.tripleStore.match(new Ci.IRI(e),new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDFS_LABEL),void 0),r=await this.tripleStore.match(new Ci.IRI(e),new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDFS_COMMENT),void 0),i=t.length>0?this.getObjectValue(t[0].object)??(0,ot.extractLocalName)(e):(0,ot.extractLocalName)(e),s=r.length>0?this.getObjectValue(r[0].object):void 0,a="rdfs:Class",c=await this.tripleStore.match(new Ci.IRI(e),new Ci.IRI(ot.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let f of c)if(this.getObjectValue(f.object)===ot.RDF_TYPE_PREDICATES.OWL_CLASS){a="owl:Class";break}let l=ot.BUILT_IN_NODE_STYLES[e]??ot.BUILT_IN_NODE_STYLES[(0,ot.extractLocalName)(e)],u={uri:e,label:i,description:s,source:a,style:(0,ot.mergeNodeStyles)(ot.DEFAULT_NODE_STYLE,l??{}),priority:1};this.registerNodeType(u)}normalizeTypeUri(e){let t=e.match(/^\[\[(.+?)\]\]$/);return t?t[1]:e}getSubjectValue(e){if(e instanceof Ci.IRI)return e.value;if(e instanceof Xb.BlankNode)return`_:${e.id}`;if(typeof e=="object"&&e!==null&&"termType"in e)return e.toString()}getObjectValue(e){if(e instanceof sk.Literal||e instanceof Ci.IRI)return e.value;if(e instanceof Xb.BlankNode)return`_:${e.id}`}getRootTypes(){let e=new Set;for(let r of this.typeHierarchy.values())for(let i of r)e.add(i);let t=[];for(let r of this.nodeTypes.keys()){let i=this.typeHierarchy.get(r);(!i||i.length===0)&&e.has(r)&&t.push(r)}return t}emit(e){for(let t of this.subscribers)try{t(e)}catch(r){console.error("TypeRegistry: error in subscriber callback",r)}}};ns.TypeRegistry=X0;ns.TypeRegistry=X0=rk([(0,ik.injectable)(),nk("design:paramtypes",[Object,Object])],X0)});var J0=_(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.SPARQL_TEMPLATES=j.KNOWN_CLASSES=j.KNOWN_PROTOTYPES=j.EFFORT_STATUSES=j.ASSET_CLASSES=j.PREDICATES=j.SPARQL_PREFIXES=void 0;j.findClassByTerm=ak;j.getTemplateByName=ok;j.findMatchingTemplates=ck;j.fillTemplate=lk;j.validateParameters=uk;j.SPARQL_PREFIXES=`PREFIX exo: <https://exocortex.my/ontology/exo#>
|
|
107
107
|
PREFIX ems: <https://exocortex.my/ontology/ems#>
|
|
108
108
|
PREFIX ims: <https://exocortex.my/ontology/ims#>
|
|
109
109
|
PREFIX gtd: <https://exocortex.my/ontology/gtd#>
|
|
@@ -257,25 +257,25 @@ SELECT ?s ?label ?class WHERE {
|
|
|
257
257
|
}
|
|
258
258
|
ORDER BY ?label
|
|
259
259
|
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[...pt.SPARQL_TEMPLATES]}getTemplate(e){return(0,pt.getTemplateByName)(e)}setConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}addTemplate(e){pt.SPARQL_TEMPLATES.push(e),pk.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))}};Sn.NLToSPARQLService=Z0;Sn.NLToSPARQLService=Z0=fk([(0,dk.injectable)(),hk("design:paramtypes",[Object])],Z0)});var tS=_(ti=>{"use strict";var mk=ti&&ti.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},gk=ti&&ti.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},yk=ti&&ti.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ti,"__esModule",{value:!0});ti.AnalyticsService=void 0;var eS=Ue(),vk=ht(),_k=or(),wk=Zi(),ey=class{static{o(this,"AnalyticsService")}constructor(e){this.vault=e,this.frontmatterService=new wk.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(`
|
|
260
|
-
`).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,h)=>f+h,0),i=r/t.length,s=Math.min(...t),a=Math.max(...t),l=t.map(f=>Math.pow(f-i,2)).reduce((f,h)=>f+h,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=_k.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 h of t){if(h.startTimestamp){let d=h.startTimestamp.getHours()*60+h.startTimestamp.getMinutes();s.push(d<360?d+1440:d)}if(h.endTimestamp){let d=h.endTimestamp.getHours()*60+h.endTimestamp.getMinutes();a.push(d)}}let c=s.length>0?s.reduce((h,d)=>h+d,0)/s.length:0,l=a.length>0?a.reduce((h,d)=>h+d,0)/a.length:0,u=s.length>1?Math.sqrt(s.map(h=>Math.pow(h-c,2)).reduce((h,d)=>h+d,0)/s.length):0,f=a.length>1?Math.sqrt(a.map(h=>Math.pow(h-l,2)).reduce((h,d)=>h+d,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}};ti.AnalyticsService=ey;ti.AnalyticsService=ey=mk([(0,eS.injectable)(),yk(0,(0,eS.inject)(vk.DI_TOKENS.IVaultAdapter)),gk("design:paramtypes",[Object])],ey)});var rS=_(ya=>{"use strict";var bk=ya&&ya.__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(ya,"__esModule",{value:!0});ya.TrendDetectionService=void 0;var Sk=Ue(),ty=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(d=>d[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 h=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:h}}linearRegression(e){let t=e.length;if(t===0)return{slope:0,intercept:0,rSquared:0};let r=(t-1)/2,i=e.reduce((d,p)=>d+p,0)/t,s=0,a=0;for(let d=0;d<t;d++)s+=(d-r)*(e[d]-i),a+=Math.pow(d-r,2);let c=a!==0?s/a:0,l=i-c*r,u=0,f=0;for(let d=0;d<t;d++){let p=l+c*d;u+=Math.pow(e[d]-p,2),f+=Math.pow(e[d]-i,2)}let h=f!==0?1-u/f:0;return{slope:c,intercept:l,rSquared:Math.max(0,h)}}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),h=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:h,description:this.generateAnomalyDescription(h,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 T=0;T<s;T++)f+=(e[T]-a)/c*((t[T]-l)/u);let h=f/s,d=Math.abs(h),p;d>=this.STRONG_CORRELATION_THRESHOLD?p="strong":d>=this.MODERATE_CORRELATION_THRESHOLD?p="moderate":d>=.2?p="weak":p="none";let y=p==="none"?"none":h>0?"positive":"negative",w=this.generateCorrelationInsight(r,i,h,p,y);return{metric1:r,metric2:i,coefficient:Math.round(h*100)/100,strength:p,direction:y,insight:w}}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:h}=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(h*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}};ya.TrendDetectionService=ty;ya.TrendDetectionService=ty=bk([(0,Sk.injectable)()],ty)});var iS=_(En=>{"use strict";var Ek=En&&En.__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},Tk=En&&En.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(En,"__esModule",{value:!0});En.AutocompleteService=En.DEFAULT_AUTOCOMPLETE_CONFIG=void 0;var xk=Ue(),rh=cn(),ul=ze(),nS=mt();En.DEFAULT_AUTOCOMPLETE_CONFIG={limit:10,activeBoost:20,recencyBoost:10,recencyDays:7};var ry=class{static{o(this,"AutocompleteService")}constructor(e,t){this.tripleStore=e,this.config={...En.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 ul.IRI(t),rh.Namespace.RDFS.term("range"),void 0);for(let s of i)if(s.object instanceof ul.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,rh.Namespace.RDF.term("type"),new ul.IRI(t));for(let s of i)if(s.subject instanceof ul.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,rh.Namespace.EXO.term("Asset_label"),void 0),i="";for(let c of r)if(c.object instanceof nS.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,rh.Namespace.EMS.term("Effort_status"),void 0);for(let r of t){let i=r.object instanceof nS.Literal||r.object instanceof ul.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}};En.AutocompleteService=ry;En.AutocompleteService=ry=Ek([(0,xk.injectable)(),Tk("design:paramtypes",[Object,Object])],ry)});var aS=_(ri=>{"use strict";var Ak=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},Ck=ri&&ri.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Ik=ri&&ri.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ri,"__esModule",{value:!0});ri.DailyReviewService=void 0;var sS=Ue(),Ok=ht(),co=or(),Rk=Zi(),Pk=Lr(),ny=class{static{o(this,"DailyReviewService")}constructor(e){this.vault=e,this.frontmatterService=new Rk.FrontmatterService}async getPractices(){let e=this.vault.getAllFiles(),t=[],r=co.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 h=f.replace(/"/g,""),p=this.frontmatterService.getPropertyValue(a.content,"ems__Recurring_rule")?.replace(/"/g,"")||null,y=this.frontmatterService.getPropertyValue(a.content,"ems__Task_estimatedDuration"),w=null;if(y){let S=parseInt(y,10);isNaN(S)||(w=S)}let T=await this.findTodayInstance(u,r);t.push({uid:u,label:h,path:i.path,recurringRule:p,estimatedDuration:w,doneToday:T?.status==="done",inProgressToday:T?.status==="doing",todayInstancePath:T?.path||null})}catch{continue}return t.sort((i,s)=>i.label.localeCompare(s.label))}async getDailyReviewSummary(e){let t=e||new Date,r=co.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 w=await this.vault.read(y),T=this.frontmatterService.parse(w);if(!T.exists)continue;let S=this.frontmatterService.getPropertyValue(T.content,"exo__Instance_class");if(!this.isTask(S))continue;let A=this.frontmatterService.getPropertyValue(T.content,"ems__Effort_plannedStartTimestamp"),F=this.frontmatterService.getPropertyValue(T.content,"ems__Effort_startTimestamp"),Q=F?new Date(F):null,K=A?new Date(A):null;if(!(K&&K>=i&&K<=s||Q&&Q>=i&&Q<=s))continue;c++;let H=this.frontmatterService.getPropertyValue(T.content,"ems__Effort_status");if(this.isDoneStatus(H)){l++;let J=this.frontmatterService.getPropertyValue(T.content,"ems__Effort_endTimestamp");if(F&&J){let L=this.calculateDurationMinutes(F,J);f+=L}}else this.isDoingStatus(H)&&u++}catch{continue}let d=(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:d,completionPercentage:p,totalTimeMinutes:Math.round(f)}}async quickCapture(e,t=!0,r){let i=(0,Pk.v4)(),s=co.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 h=this.buildPrototypeUri(r.prototypeUid);l.push(`exo__Asset_prototype: "${h}"`)}if(r?.areaUid){let h=this.buildAssetUri(r.areaUid);l.push(`ems__Effort_area: "${h}"`)}if(r?.parentUid){let h=this.buildAssetUri(r.parentUid);l.push(`ems__Effort_parent: "${h}"`)}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(`
|
|
260
|
+
`).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,h)=>f+h,0),i=r/t.length,s=Math.min(...t),a=Math.max(...t),l=t.map(f=>Math.pow(f-i,2)).reduce((f,h)=>f+h,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=_k.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 h of t){if(h.startTimestamp){let d=h.startTimestamp.getHours()*60+h.startTimestamp.getMinutes();s.push(d<360?d+1440:d)}if(h.endTimestamp){let d=h.endTimestamp.getHours()*60+h.endTimestamp.getMinutes();a.push(d)}}let c=s.length>0?s.reduce((h,d)=>h+d,0)/s.length:0,l=a.length>0?a.reduce((h,d)=>h+d,0)/a.length:0,u=s.length>1?Math.sqrt(s.map(h=>Math.pow(h-c,2)).reduce((h,d)=>h+d,0)/s.length):0,f=a.length>1?Math.sqrt(a.map(h=>Math.pow(h-l,2)).reduce((h,d)=>h+d,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}};ti.AnalyticsService=ey;ti.AnalyticsService=ey=mk([(0,eS.injectable)(),yk(0,(0,eS.inject)(vk.DI_TOKENS.IVaultAdapter)),gk("design:paramtypes",[Object])],ey)});var rS=_(ya=>{"use strict";var bk=ya&&ya.__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(ya,"__esModule",{value:!0});ya.TrendDetectionService=void 0;var Sk=Ue(),ty=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(d=>d[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 h=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:h}}linearRegression(e){let t=e.length;if(t===0)return{slope:0,intercept:0,rSquared:0};let r=(t-1)/2,i=e.reduce((d,p)=>d+p,0)/t,s=0,a=0;for(let d=0;d<t;d++)s+=(d-r)*(e[d]-i),a+=Math.pow(d-r,2);let c=a!==0?s/a:0,l=i-c*r,u=0,f=0;for(let d=0;d<t;d++){let p=l+c*d;u+=Math.pow(e[d]-p,2),f+=Math.pow(e[d]-i,2)}let h=f!==0?1-u/f:0;return{slope:c,intercept:l,rSquared:Math.max(0,h)}}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),h=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:h,description:this.generateAnomalyDescription(h,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 T=0;T<s;T++)f+=(e[T]-a)/c*((t[T]-l)/u);let h=f/s,d=Math.abs(h),p;d>=this.STRONG_CORRELATION_THRESHOLD?p="strong":d>=this.MODERATE_CORRELATION_THRESHOLD?p="moderate":d>=.2?p="weak":p="none";let y=p==="none"?"none":h>0?"positive":"negative",w=this.generateCorrelationInsight(r,i,h,p,y);return{metric1:r,metric2:i,coefficient:Math.round(h*100)/100,strength:p,direction:y,insight:w}}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:h}=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(h*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}};ya.TrendDetectionService=ty;ya.TrendDetectionService=ty=bk([(0,Sk.injectable)()],ty)});var iS=_(En=>{"use strict";var Ek=En&&En.__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},Tk=En&&En.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(En,"__esModule",{value:!0});En.AutocompleteService=En.DEFAULT_AUTOCOMPLETE_CONFIG=void 0;var xk=Ue(),rh=cn(),ul=ze(),nS=mt();En.DEFAULT_AUTOCOMPLETE_CONFIG={limit:10,activeBoost:20,recencyBoost:10,recencyDays:7};var ry=class{static{o(this,"AutocompleteService")}constructor(e,t){this.tripleStore=e,this.config={...En.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 ul.IRI(t),rh.Namespace.RDFS.term("range"),void 0);for(let s of i)if(s.object instanceof ul.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,rh.Namespace.RDF.term("type"),new ul.IRI(t));for(let s of i)if(s.subject instanceof ul.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,rh.Namespace.EXO.term("Asset_label"),void 0),i="";for(let c of r)if(c.object instanceof nS.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,rh.Namespace.EMS.term("Effort_status"),void 0);for(let r of t){let i=r.object instanceof nS.Literal||r.object instanceof ul.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}};En.AutocompleteService=ry;En.AutocompleteService=ry=Ek([(0,xk.injectable)(),Tk("design:paramtypes",[Object,Object])],ry)});var aS=_(ri=>{"use strict";var Ak=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},Ck=ri&&ri.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Ik=ri&&ri.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ri,"__esModule",{value:!0});ri.DailyReviewService=void 0;var sS=Ue(),Ok=ht(),co=or(),Rk=Zi(),Pk=Lr(),ny=class{static{o(this,"DailyReviewService")}constructor(e){this.vault=e,this.frontmatterService=new Rk.FrontmatterService}async getPractices(){let e=this.vault.getAllFiles(),t=[],r=co.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 h=f.replace(/"/g,""),p=this.frontmatterService.getPropertyValue(a.content,"ems__Recurring_rule")?.replace(/"/g,"")||null,y=this.frontmatterService.getPropertyValue(a.content,"ems__Task_estimatedDuration"),w=null;if(y){let S=parseInt(y,10);isNaN(S)||(w=S)}let T=await this.findTodayInstance(u,r);t.push({uid:u,label:h,path:i.path,recurringRule:p,estimatedDuration:w,doneToday:T?.status==="done",inProgressToday:T?.status==="doing",todayInstancePath:T?.path||null})}catch{continue}return t.sort((i,s)=>i.label.localeCompare(s.label))}async getDailyReviewSummary(e){let t=e||new Date,r=co.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 w=await this.vault.read(y),T=this.frontmatterService.parse(w);if(!T.exists)continue;let S=this.frontmatterService.getPropertyValue(T.content,"exo__Instance_class");if(!this.isTask(S))continue;let x=this.frontmatterService.getPropertyValue(T.content,"ems__Effort_plannedStartTimestamp"),F=this.frontmatterService.getPropertyValue(T.content,"ems__Effort_startTimestamp"),Q=F?new Date(F):null,K=x?new Date(x):null;if(!(K&&K>=i&&K<=s||Q&&Q>=i&&Q<=s))continue;c++;let H=this.frontmatterService.getPropertyValue(T.content,"ems__Effort_status");if(this.isDoneStatus(H)){l++;let J=this.frontmatterService.getPropertyValue(T.content,"ems__Effort_endTimestamp");if(F&&J){let L=this.calculateDurationMinutes(F,J);f+=L}}else this.isDoingStatus(H)&&u++}catch{continue}let d=(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:d,completionPercentage:p,totalTimeMinutes:Math.round(f)}}async quickCapture(e,t=!0,r){let i=(0,Pk.v4)(),s=co.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 h=this.buildPrototypeUri(r.prototypeUid);l.push(`exo__Asset_prototype: "${h}"`)}if(r?.areaUid){let h=this.buildAssetUri(r.areaUid);l.push(`ems__Effort_area: "${h}"`)}if(r?.parentUid){let h=this.buildAssetUri(r.parentUid);l.push(`ems__Effort_parent: "${h}"`)}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(`
|
|
261
261
|
`),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=co.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=co.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),h=u?new Date(u):null,d=h&&co.DateFormatter.toDateString(h)===t;if(!f&&!d)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`}};ri.DailyReviewService=ny;ri.DailyReviewService=ny=Ak([(0,sS.injectable)(),Ik(0,(0,sS.inject)(Ok.DI_TOKENS.IVaultAdapter)),Ck("design:paramtypes",[Object])],ny)});var sy=_(br=>{"use strict";var Fk=br&&br.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Dk=br&&br.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Nk=br&&br.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(br,"__esModule",{value:!0});br.CriticalityZoneService=br.CriticalityZoneUUIDs=void 0;var oS=Ue(),kk=Zi(),Lk=ht();br.CriticalityZoneUUIDs={TODAY:"e266a2e9-9eb0-431d-b1fe-b95b9d3e9a3f",THIS_WEEK:"c7f1a968-0959-4ac7-ac82-31b0cdc2aba7",SOMEDAY:"6968a0fc-7a41-4393-82b1-17d767c7ad7c"};var iy=class{static{o(this,"CriticalityZoneService")}constructor(e){this.vault=e,this.frontmatterService=new kk.FrontmatterService}async setZoneToday(e){await this.setZone(e,br.CriticalityZoneUUIDs.TODAY)}async setZoneThisWeek(e){await this.setZone(e,br.CriticalityZoneUUIDs.THIS_WEEK)}async setZoneSomeday(e){await this.setZone(e,br.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)}};br.CriticalityZoneService=iy;br.CriticalityZoneService=iy=Fk([(0,oS.injectable)(),Nk(0,(0,oS.inject)(Lk.DI_TOKENS.IVaultAdapter)),Dk("design:paramtypes",[Object])],iy)});var cS=_(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.EffortSortingHelpers=void 0;var ay=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}};nh.EffortSortingHelpers=ay});var lS=_(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.FilenameValidator=void 0;var va=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)}};ih.FilenameValidator=va;va.INVALID_CHARS_PATTERN=/[/\\:*?"<>|\x00-\x1F]/g;va.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"]);va.DEFAULT_MAX_LENGTH=200;va.DEFAULT_REPLACEMENT="_"});var cy=_(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.NTriplesSerializer=void 0;var oy=class{static{o(this,"NTriplesSerializer")}serialize(e,t={}){let r=t.newline??`
|
|
262
262
|
`;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}};sh.NTriplesSerializer=oy});var uS=_(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.TurtleSerializer=void 0;var lo=cn(),Mk=cy(),jk={rdf:lo.Namespace.RDF.iri.value,rdfs:lo.Namespace.RDFS.iri.value,owl:lo.Namespace.OWL.iri.value,xsd:lo.Namespace.XSD.iri.value,exo:lo.Namespace.EXO.iri.value,ems:lo.Namespace.EMS.iri.value},ly=class{static{o(this,"TurtleSerializer")}constructor(){this.nTriplesSerializer=new Mk.NTriplesSerializer}serialize(e,t={}){let r=t.newline??`
|
|
263
263
|
`,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?{...jk,...e.prefixes??{}}:{...e.prefixes??{}}}serializeTriplesOnly(e,t){return this.nTriplesSerializer.serializeChunk(e,t).trimEnd()}};ah.TurtleSerializer=ly});var dS=_(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.JSONLDSerializer=void 0;var fS=ze(),hS=$t(),$k=mt(),uo=cn(),Vk={rdf:uo.Namespace.RDF.iri.value,rdfs:uo.Namespace.RDFS.iri.value,owl:uo.Namespace.OWL.iri.value,xsd:uo.Namespace.XSD.iri.value,exo:uo.Namespace.EXO.iri.value,ems:uo.Namespace.EMS.iri.value},uy=class{static{o(this,"JSONLDSerializer")}toDocument(e,t={}){let r={...Vk,...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 fS.IRI?e.value:e instanceof hS.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 fS.IRI)return{"@id":e.value};if(e instanceof hS.BlankNode)return{"@id":`_:${e.id}`};if(e instanceof $k.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}};oh.JSONLDSerializer=uy});var dy=_(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.NTriplesParser=void 0;var Uk=Si(),pS=ze(),fy=mt(),Bk=$t(),fo=cn(),qk={rdf:fo.Namespace.RDF.iri.value,rdfs:fo.Namespace.RDFS.iri.value,owl:fo.Namespace.OWL.iri.value,xsd:fo.Namespace.XSD.iri.value,exo:fo.Namespace.EXO.iri.value,ems:fo.Namespace.EMS.iri.value},hy=class{static{o(this,"NTriplesParser")}parse(e,t={}){let r={prefixes:{...qk,...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 Uk.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 pS.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 pS.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 Bk.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 fy.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 fy.Literal(i,void 0,l),rest:(u??"").trimStart()}}return{node:new fy.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+=`
|
|
264
264
|
`,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}};ch.NTriplesParser=hy});var mS=_(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.TurtleParser=void 0;var ho=cn(),Wk=dy(),Gk={rdf:ho.Namespace.RDF.iri.value,rdfs:ho.Namespace.RDFS.iri.value,owl:ho.Namespace.OWL.iri.value,xsd:ho.Namespace.XSD.iri.value,exo:ho.Namespace.EXO.iri.value,ems:ho.Namespace.EMS.iri.value},Hk=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,py=class{static{o(this,"TurtleParser")}constructor(){this.nTriplesParser=new Wk.NTriplesParser}parse(e,t={}){let r={...Gk,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:a,lineNumber:c})=>{if(this.isPrefixStatement(a)){let u=a.match(Hk);if(!u)throw new Error(`Invalid prefix declaration at line ${c}`);let[,f,h]=u;r[f]=h;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}};lh.TurtleParser=py});var gS=_(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.RDFSerializer=void 0;var po=Si(),_a=ze(),wa=mt(),my=$t(),Ii=cn(),zk=uS(),Qk=cy(),Yk=dS(),Kk=mS(),Xk=dy(),Jk=1024,Zk=`
|
|
265
265
|
`,e5={rdf:Ii.Namespace.RDF.iri.value,rdfs:Ii.Namespace.RDFS.iri.value,owl:Ii.Namespace.OWL.iri.value,xsd:Ii.Namespace.XSD.iri.value,exo:Ii.Namespace.EXO.iri.value,ems:Ii.Namespace.EMS.iri.value},gy=class{static{o(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new zk.TurtleSerializer,this.nTriplesSerializer=new Qk.NTriplesSerializer,this.jsonldSerializer=new Yk.JSONLDSerializer,this.turtleParser=new Kk.TurtleParser,this.nTriplesParser=new Xk.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??Zk,i=t.batchSize??Jk,s=t.includeDefaultPrefixes,a=t.prefixes,c=this,l=!1,u=[],f=[],h=0,d=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 d(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(h>=f.length)return{value:void 0,done:!0};let y=f.slice(h,h+i);h+=y.length;let w="";if(e==="turtle"){let T=c.turtleSerializer.serializeTriplesOnly(y,r);T&&(w=`${T}${r}`)}else e==="n-triples"&&(w=c.nTriplesSerializer.serializeChunk(y,r));return w?{value:w,done:!1}:this.next()},async return(){return u=[],f=[],h=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?{...e5,...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 h=this.parseSubjectFromNode(u,a,f),d=Object.entries(u);for(let[p,y]of d){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(h,y,l,a);continue}let w=this.expandTerm(p,a),T=new _a.IRI(w);this.collectTriplesForValue(h,T,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 my.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new _a.IRI(i);let s=this.expandTerm(i,t);return new _a.IRI(s)}return new my.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=Ii.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 po.Triple(e,s,new _a.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 po.Triple(e,t,c));return}if(a["@value"]!==void 0){let c=this.parseLiteralObject(a,s);i.push(new po.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new po.Triple(e,t,new wa.Literal(r)));return}if(typeof r=="number"){let a=Number.isInteger(r)?Ii.Namespace.XSD.term("integer"):Ii.Namespace.XSD.term("decimal");i.push(new po.Triple(e,t,new wa.Literal(r.toString(),a)));return}if(typeof r=="boolean"){let a=Ii.Namespace.XSD.term("boolean");i.push(new po.Triple(e,t,new wa.Literal(r.toString(),a)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new my.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new _a.IRI(e);let r=this.expandTerm(e,t);return new _a.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 wa.Literal(r,void 0,e["@language"],i):new wa.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new wa.Literal(r,new _a.IRI(i))}return new wa.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(`]}
|
|
266
|
-
`),t}};uh.RDFSerializer=gy});var vy=_(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});fh.RDFVocabularyMapper=void 0;var Sr=Si(),yS=ze(),ae=cn(),yy=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",ae.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",ae.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",ae.Namespace.RDFS.term("subClassOf")],["exo__Property_range",ae.Namespace.RDFS.term("range")],["exo__Property_domain",ae.Namespace.RDFS.term("domain")],["exo__Property_superProperty",ae.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new Sr.Triple(ae.Namespace.EXO.term("Asset"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.RDFS.term("Resource"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Class"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.RDFS.term("Class"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Property"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.RDF.term("Property"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("Task"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("Project"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("Area"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("Workflow"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("WorkflowState"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("WorkflowTransition"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new Sr.Triple(ae.Namespace.EXO.term("Instance_class"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDF.term("type"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Asset_isDefinedBy"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("isDefinedBy"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Class_superClass"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("subClassOf"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Property_range"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("range"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Property_domain"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("domain"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Property_superProperty"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof yS.IRI)s=r;else{let a=r.match(/^(ems|exo)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?ae.Namespace.EMS:ae.Namespace.EXO).term(l)}else s=new yS.IRI(r)}return new Sr.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};fh.RDFVocabularyMapper=yy});var vS=_(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.RDFSInferenceEngine=void 0;var t5=Si(),hh=ze(),_y=class{static{o(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(h=>h.value.includes("Class_superClass")),i=t.find(h=>h.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 h of l)if(h.object instanceof hh.IRI){let d=a.get(h.object.value);if(d)for(let p of d)u.push(new t5.Triple(h.subject,i,new hh.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 hh.IRI&&s.object instanceof hh.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}};dh.RDFSInferenceEngine=_y});var by=_(ni=>{"use strict";var r5=ni&&ni.__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},n5=ni&&ni.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},_S=ni&&ni.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ni,"__esModule",{value:!0});ni.NoteToRDFConverter=void 0;var wy=Ue(),Zr=Si(),mo=ze(),un=mt(),wS=$t(),Ur=cn(),bS=ht(),i5=vy(),en=rg(),go=class{static{o(this,"NoteToRDFConverter")}constructor(e,t){this.vault=e,this.logger=t,this.OBSIDIAN_VAULT_SCHEME="obsidian://vault/",this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new i5.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?en.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Ur.Namespace.EXO.term("Asset_fileName");r.push(new Zr.Triple(i,s,new un.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 h of f)if(c==="exo__Instance_class"){let d=this.valueToClassURI(h);r.push(new Zr.Triple(i,u,d))}else{let d=await this.valueToRDFObject(h,e);for(let p of d)if(r.push(new Zr.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof mo.IRI){let y=this.vocabularyMapper.generateMappedTriple(i,c,p);y&&r.push(y)}}if(c==="exo__Instance_class")for(let h of f){let d=this.expandClassValue(h);if(d){let p=Ur.Namespace.RDF.term("type");r.push(new Zr.Triple(i,p,d))}}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=en.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case en.Exo003MetadataType.Namespace:break;case en.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case en.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case en.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case en.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new mo.IRI(t.uri);return[new Zr.Triple(r,Ur.Namespace.OWL.term("sameAs"),i),new Zr.Triple(i,Ur.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 Zr.Triple(r,Ur.Namespace.OWL.term("sameAs"),new wS.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=en.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new Zr.Triple(a,Ur.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 mo.IRI(c.value):new wS.BlankNode(c.value),f=new mo.IRI(l.value),h=en.Exo003Parser.toLiteral(t,s.trim());r.push(new Zr.Triple(u,f,h));let d=this.notePathToIRI(e.path);r.push(new Zr.Triple(d,Ur.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&&en.Exo003Parser.isExo003Format(a)){let c=en.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===en.Exo003MetadataType.Anchor||l.metadata===en.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===en.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=await this.convertNote(a);r.push(...c)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),this.logger.warn(`Skipping file with invalid IRI: ${a.path}`,{reason:l})}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=encodeURI(r.path),s=`${this.OBSIDIAN_VAULT_SCHEME}${i}`;mo.IRI.isValidIRI(s)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){let t=encodeURI(e);return new mo.IRI(`${this.OBSIDIAN_VAULT_SCHEME}${t}`)}isExocortexProperty(e){return e.startsWith("exo__")||e.startsWith("ems__")}propertyKeyToIRI(e){if(e.startsWith("exo__")){let t=e.substring(5);return Ur.Namespace.EXO.term(t)}if(e.startsWith("ems__")){let t=e.substring(5);return Ur.Namespace.EMS.term(t)}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);if(this.isUUID(i)){let c=new un.Literal(i);return[a,c]}return[a]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return[new un.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new un.Literal(r,Ur.Namespace.XSD.term("dateTime"))]:[new un.Literal(r)]}return typeof e=="boolean"?[new un.Literal(e.toString())]:typeof e=="number"?[new un.Literal(e.toString(),Ur.Namespace.XSD.term("decimal"))]:e instanceof Date?[new un.Literal(e.toISOString(),Ur.Namespace.XSD.term("dateTime"))]:[new un.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(/^\[\[([^\]]+)\]\]$/);return t?t[1]:null}valueToClassURI(e){if(typeof e!="string")return new un.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);return s||new un.Literal(t)}isClassReference(e){return(e.startsWith("ems__")||e.startsWith("exo__"))&&!/\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);if(t.startsWith("ems__")){let r=t.substring(5);return Ur.Namespace.EMS.term(r)}if(t.startsWith("exo__")){let r=t.substring(5);return Ur.Namespace.EXO.term(r)}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=Ur.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 Zr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new Zr.Triple(t,c,f)):r.push(new Zr.Triple(t,c,new un.Literal(l)))}else r.push(new Zr.Triple(t,c,new un.Literal(l)))}}catch{}return r}};ni.NoteToRDFConverter=go;go.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};go.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};go.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};ni.NoteToRDFConverter=go=r5([(0,wy.injectable)(),_S(0,(0,wy.inject)(bS.DI_TOKENS.IVaultAdapter)),_S(1,(0,wy.inject)(bS.DI_TOKENS.ILogger)),n5("design:paramtypes",[Object,Object])],go)});var Sy=_((gQ,SS)=>{var yo=class{static{o(this,"Wildcard")}constructor(){return s5||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(yo.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(yo.prototype,"termType",{enumerable:!0,value:"Wildcard"});var s5=new yo;SS.exports.Wildcard=yo});var TS=_((vQ,ES)=>{var a5=(function(){var n=o(function(I,C,O,D){for(O=O||{},D=I.length;D--;O[I[D]]=C);return O},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],h=[1,45],d=[1,41],p=[1,44],y=[123,126],w=[1,67],T=[39,45,87],S=[13,16,45,197,224,308],A=[1,87],F=[2,281],Q=[1,86],K=[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],H=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],J=[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],L=[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],Z=[112,132,327,334],qe=[13,16,112,132,308],et=[1,111],wt=[1,117],tt=[112,132,327,328,334],nt=[13,16,112,132,308,328],We=[28,29,45,53,87],re=[1,138],U=[1,151],it=[1,128],ct=[1,127],W=[1,129],xe=[1,140],ke=[1,141],ee=[1,142],Le=[1,143],Me=[1,144],Fe=[1,145],je=[1,147],we=[1,148],De=[2,457],Ae=[1,158],Ne=[1,159],$e=[1,160],le=[1,152],de=[1,153],pe=[1,156],ue=[1,171],fe=[1,172],he=[1,173],oe=[1,174],me=[1,175],ge=[1,176],ye=[1,167],ve=[1,168],ie=[1,169],_e=[1,170],Ye=[1,157],Ve=[1,166],Pe=[1,161],b=[1,162],E=[1,163],x=[1,164],R=[1,165],Y=[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],ut=[1,195],vt=[6,31,73,81,83,85],Ie=[2,285],B=[1,199],q=[1,201],G=[6,31,70,73,81,83,85],z=[2,283],Ee=[1,207],Ke=[1,218],Xe=[1,223],rr=[1,219],Yr=[1,225],on=[1,226],Pr=[1,224],Uv=[6,63,70,73,81,83,85],Bv=[1,236],qv=[2,334],Wv=[1,243],Gv=[1,241],nr=[6,193],vu=[2,349],Hv=[2,339],ms=[28,128],zv=[47,48,193,272],_u=[47,48,193,242,272],Wa=[47,48,193,242,246,272],Ga=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Gt=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],Qv=[1,271],Yv=[1,270],Dt=[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],Kv=[1,281],Xv=[1,280],Fr=[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],Pc=[45,89],wu=[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],bu=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Su=[31,89],Eu=[48,87],zs=[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],gi=[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],Jv=[1,313],Ha=[6,85],kp=[6,31,81,83,85],Zv=[2,361],Vi=[2,353],Qs=[1,343],Fc=[31,112,335],Ui=[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],Lp=[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],e_=[6,109,193],Ys=[31,112],Nt=[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],Mp=[1,390],jp=[1,391],gs=[13,16,87,197,308,314],t_=[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],Tu=[1,417],xu=[1,418],r_=[13,16,48,197,229,308],ys=[6,31,85],n_=[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],$p=[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],Ks=[29,31,85,112,159,160,161,163,164],Au=[1,443],Cu=[1,444],i_=[1,449],Xs=[31,112,193,232,318,335],Iu=[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],s_=[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],Vp=[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],Dc=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Nc=[31,45],a_=[1,507],o_=[1,508],c_=[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],Ou=[29,31,85,112,159,160,161,163,164,335],Js=[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],l_=[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],u_=[2,352],Up=[13,16,197,308,314],f_=[1,565],za=[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],h_=[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],Bi=[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],d_=[13,16,87,308],qi=[2,364],Qa=[29,31,85,112,159,160,161,163,164,193,232,318,335],Ru=[31,112,193,232,272,318,335],Wi=[2,359],p_=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Pu=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],m_=[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],g_=[2,347],Bp={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Query:7,Qry:8,Query_option0:9,Prologue_repetition0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectClauseWildcard:17,Qry_repetition0:18,WhereClause:19,SolutionModifierNoGroup:20,SelectClauseVars:21,Qry_repetition1:22,SolutionModifier:23,CONSTRUCT:24,ConstructTemplate:25,Qry_repetition2:26,Qry_repetition3:27,WHERE:28,"{":29,Qry_option0:30,"}":31,DESCRIBE:32,Qry_group0:33,Qry_repetition4:34,Qry_option1:35,ASK:36,Qry_repetition5:37,SelectClauseBase:38,"*":39,SelectClauseVars_repetition_plus0:40,SELECT:41,SelectClauseBase_option0:42,SelectClauseItem:43,Var:44,"(":45,Expression:46,AS:47,")":48,SubSelect:49,SubSelect_option0:50,SubSelect_option1:51,DatasetClause:52,FROM:53,DatasetClause_option0:54,iri:55,WhereClause_option0:56,GroupGraphPattern:57,SolutionModifier_option0:58,SolutionModifierNoGroup_option0:59,SolutionModifierNoGroup_option1:60,SolutionModifierNoGroup_option2:61,GroupClause:62,GROUP:63,BY:64,GroupClause_repetition_plus0:65,GroupCondition:66,BuiltInCall:67,FunctionCall:68,HavingClause:69,HAVING:70,HavingClause_repetition_plus0:71,OrderClause:72,ORDER:73,OrderClause_repetition_plus0:74,OrderCondition:75,ASC:76,BrackettedExpression:77,DESC:78,Constraint:79,LimitOffsetClauses:80,LIMIT:81,INTEGER:82,OFFSET:83,ValuesClause:84,VALUES:85,InlineData:86,VAR:87,InlineData_repetition0:88,NIL:89,InlineData_repetition1:90,InlineData_repetition_plus2:91,InlineData_repetition3:92,DataBlock:93,DataBlockValueList:94,DataBlockValueList_repetition_plus0:95,Update:96,Update_repetition0:97,Update1:98,Update_option0:99,LOAD:100,Update1_option0:101,Update1_option1:102,Update1_group0:103,Update1_option2:104,GraphRefAll:105,Update1_group1:106,Update1_option3:107,GraphOrDefault:108,TO:109,CREATE:110,Update1_option4:111,GRAPH:112,INSERTDATA:113,QuadPattern:114,DELETEDATA:115,DELETEWHERE:116,Update1_option5:117,InsertDeleteClause:118,Update1_repetition0:119,IntoGraphClause:120,INTO:121,GraphRef:122,DELETE:123,InsertDeleteClause_option0:124,InsertClause:125,INSERT:126,UsingClause:127,USING:128,UsingClause_option0:129,WithClause:130,WITH:131,DEFAULT:132,GraphOrDefault_option0:133,GraphRefAll_group0:134,Quads:135,Quads_option0:136,Quads_repetition0:137,QuadsNotTriples:138,VarOrIri:139,QuadsNotTriples_option0:140,QuadsNotTriples_option1:141,QuadsNotTriples_option2:142,TriplesTemplate:143,TriplesTemplate_repetition0:144,TriplesSameSubject:145,TriplesTemplate_option0:146,GroupGraphPatternSub:147,GroupGraphPatternSub_option0:148,GroupGraphPatternSub_repetition0:149,GroupGraphPatternSubTail:150,GraphPatternNotTriples:151,GroupGraphPatternSubTail_option0:152,GroupGraphPatternSubTail_option1:153,TriplesBlock:154,TriplesBlock_repetition0:155,TriplesSameSubjectPath:156,TriplesBlock_option0:157,GroupOrUnionGraphPattern:158,OPTIONAL:159,MINUS:160,SERVICE:161,GraphPatternNotTriples_option0:162,FILTER:163,BIND:164,InlineDataOneVar:165,InlineDataFull:166,InlineDataOneVar_repetition0:167,InlineDataFull_repetition0:168,InlineDataFull_repetition_plus1:169,InlineDataFull_repetition2:170,DataBlockValue:171,Literal:172,QuotedTriple:173,UNDEF:174,GroupOrUnionGraphPattern_repetition0:175,ArgList:176,ArgList_option0:177,ArgList_repetition0:178,ExpressionList:179,ExpressionList_repetition0:180,ConstructTemplate_option0:181,ConstructTriples:182,ConstructTriples_repetition0:183,ConstructTriples_option0:184,VarOrTermOrQuotedTP:185,PropertyListNotEmpty:186,TriplesNode:187,PropertyList:188,PropertyList_option0:189,VerbObjectList:190,PropertyListNotEmpty_repetition0:191,SemiOptionalVerbObjectList:192,";":193,SemiOptionalVerbObjectList_option0:194,Verb:195,ObjectList:196,a:197,ObjectList_repetition0:198,Object:199,GraphNode:200,Object_option0:201,PropertyListPathNotEmpty:202,TriplesNodePath:203,TriplesSameSubjectPath_option0:204,O:205,PropertyListPathNotEmpty_repetition0:206,PropertyListPathNotEmptyTail:207,O_group0:208,ObjectListPath:209,ObjectListPath_repetition0:210,ObjectPath:211,GraphNodePath:212,ObjectPath_option0:213,Path:214,Path_repetition0:215,PathSequence:216,PathSequence_repetition0:217,PathEltOrInverse:218,PathElt:219,PathPrimary:220,PathElt_option0:221,PathEltOrInverse_option0:222,IriOrA:223,"!":224,PathNegatedPropertySet:225,PathOneInPropertySet:226,PathNegatedPropertySet_repetition0:227,PathNegatedPropertySet_option0:228,"^":229,TriplesNode_repetition_plus0:230,"[":231,"]":232,TriplesNodePath_repetition_plus0:233,VarOrTermOrQuotedTPExpr:234,VarOrTerm:235,GraphTerm:236,BlankNode:237,ConditionalOrExpression:238,ConditionalAndExpression:239,ConditionalOrExpression_repetition0:240,ConditionalOrExpressionTail:241,"||":242,RelationalExpression:243,ConditionalAndExpression_repetition0:244,ConditionalAndExpressionTail:245,"&&":246,NumericExpression:247,RelationalExpression_group0:248,RelationalExpression_option0:249,IN:250,MultiplicativeExpression:251,NumericExpression_repetition0:252,AdditiveExpressionTail:253,AdditiveExpressionTail_group0:254,NumericLiteralPositive:255,AdditiveExpressionTail_repetition0:256,NumericLiteralNegative:257,AdditiveExpressionTail_repetition1:258,UnaryExpression:259,MultiplicativeExpression_repetition0:260,MultiplicativeExpressionTail:261,MultiplicativeExpressionTail_group0:262,"+":263,PrimaryExpression:264,"-":265,ExprQuotedTP:266,Aggregate:267,FUNC_ARITY0:268,FUNC_ARITY1:269,FUNC_ARITY1_SPARQL_STAR:270,FUNC_ARITY2:271,",":272,FUNC_ARITY3:273,FUNC_ARITY3_SPARQL_STAR:274,BuiltInCall_group0:275,BOUND:276,BNODE:277,BuiltInCall_option0:278,EXISTS:279,COUNT:280,Aggregate_option0:281,Aggregate_group0:282,FUNC_AGGREGATE:283,Aggregate_option1:284,GROUP_CONCAT:285,Aggregate_option2:286,Aggregate_option3:287,GroupConcatSeparator:288,SEPARATOR:289,"=":290,String:291,LANGTAG:292,"^^":293,DECIMAL:294,DOUBLE:295,BOOLEAN:296,INTEGER_POSITIVE:297,DECIMAL_POSITIVE:298,DOUBLE_POSITIVE:299,INTEGER_NEGATIVE:300,DECIMAL_NEGATIVE:301,DOUBLE_NEGATIVE:302,STRING_LITERAL1:303,STRING_LITERAL2:304,STRING_LITERAL_LONG1:305,STRING_LITERAL_LONG2:306,PrefixedName:307,PNAME_LN:308,BLANK_NODE_LABEL:309,ANON:310,QuotedTP:311,"<<":312,qtSubjectOrObject:313,">>":314,DataValueTerm:315,AnnotationPattern:316,"{|":317,"|}":318,AnnotationPatternPath:319,ExprVarOrTerm:320,QueryOrUpdate_group0_option0:321,Prologue_repetition0_group0:322,Qry_group0_repetition_plus0:323,SelectClauseBase_option0_group0:324,DISTINCT:325,REDUCED:326,NAMED:327,SILENT:328,CLEAR:329,DROP:330,ADD:331,MOVE:332,COPY:333,ALL:334,".":335,UNION:336,"|":337,"/":338,PathElt_option0_group0:339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,NOT:346,CONCAT:347,COALESCE:348,SUBSTR:349,REGEX:350,REPLACE:351,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"},productions_:[0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]],performAction:o(function(C,O,D,te,Ce,m,Nr){var g=m.length-1;switch(Ce){case 1:if(m[g-1]=m[g-1]||{},Re.base&&(m[g-1].base=Re.base),Re.base="",m[g-1].prefixes=Re.prefixes,Re.prefixes=null,Re.pathOnly){if(m[g-1].type==="path"||"termType"in m[g-1])return m[g-1];throw new Error("Received full SPARQL query in path only mode")}else if(m[g-1].type==="path"||"termType"in m[g-1])throw new Error("Received only path in full SPARQL mode");if(m[g-1].type==="update"){let ft={};for(let Et of m[g-1].updates)if(Et.updateType==="insert"){let Je={};for(let st of Et.insert)if(st.type==="bgp"||st.type==="graph")for(let Kr of st.triples)Kr.subject.termType==="BlankNode"&&(Je[Kr.subject.value]=!0),Kr.predicate.termType==="BlankNode"&&(Je[Kr.predicate.value]=!0),Kr.object.termType==="BlankNode"&&(Je[Kr.object.value]=!0);for(let st of Object.keys(Je)){if(ft[st])throw new Error("Detected reuse blank node across different INSERT DATA clauses");ft[st]=!0}}}return m[g-1];case 2:this.$={...m[g-1],...m[g],type:"query"};break;case 4:Re.base=kc(m[g]);break;case 5:Re.prefixes||(Re.prefixes={}),m[g-1]=m[g-1].substr(0,m[g-1].length-1),m[g]=kc(m[g]),Re.prefixes[m[g-1]]=m[g];break;case 6:this.$={...m[g-3],...ta(m[g-2]),...m[g-1],...m[g]};break;case 7:if(!Re.skipValidation&&(Kp(m[g-3].variables.map(Et=>Yp(Et.expression))).some(Et=>Et.aggregation==="count"&&!(Et.expression instanceof Fu))||m[g].group)){for(let Et of m[g-3].variables)if(Et.termType==="Variable"){if(!m[g].group||!m[g].group.map(Je=>Ja(Je)).includes(Ja(Et)))throw Error("Projection of ungrouped variable (?"+Ja(Et)+")")}else if(Yp(Et.expression).length===0){let Je=UI(Et.expression);for(let st of Je)if(!m[g].group||!m[g].group.map||!m[g].group.map(Kr=>Ja(Kr)).includes(Ja(st)))throw Error("Use of ungrouped variable in projection of operation (?"+Ja(st)+")")}}let wi=m[g-1].where.filter(ft=>ft.type==="query");if(wi.length>0){let ft=m[g-3].variables.filter(Je=>Je.variable&&Je.variable.value).map(Je=>Je.variable.value),Et=Kp(wi.map(Je=>Je.variables)).map(Je=>Je.value||Je.variable.value);for(let Je of ft)if(Et.indexOf(Je)>=0)throw Error("Target id of 'AS' (?"+Je+") already used in subquery")}this.$=It(m[g-3],ta(m[g-2]),m[g-1],m[g]);break;case 8:this.$=It({queryType:"CONSTRUCT",template:m[g-3]},ta(m[g-2]),m[g-1],m[g]);break;case 9:this.$=It({queryType:"CONSTRUCT",template:m[g-2]=m[g-2]?m[g-2].triples:[]},ta(m[g-5]),{where:[{type:"bgp",triples:ea([],m[g-2])}]},m[g]);break;case 10:this.$=It({queryType:"DESCRIBE",variables:m[g-3]==="*"?[new Fu]:m[g-3]},ta(m[g-2]),m[g-1],m[g]);break;case 11:this.$=It({queryType:"ASK"},ta(m[g-2]),m[g-1],m[g]);break;case 12:this.$=It(m[g-1],{variables:[new Fu]});break;case 13:let Vc=m[g].map(ft=>ft.value||ft.variable.value),Za=BI(Vc);if(Za.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Za[0]+")");this.$=It(m[g-1],{variables:m[g]});break;case 14:this.$=It({queryType:"SELECT"},m[g]&&(m[g-1]=Dr(m[g]),m[g]={},m[g][m[g-1]]=!0,m[g]));break;case 16:case 27:this.$=Ya(m[g-3],{variable:m[g-1]});break;case 17:case 18:this.$=It(m[g-3],m[g-2],m[g-1],m[g],{type:"query"});break;case 19:case 58:this.$={iri:m[g],named:!!m[g-1]};break;case 20:this.$={where:m[g].patterns};break;case 21:this.$=It(m[g-1],m[g]);break;case 22:this.$=It(m[g-2],m[g-1],m[g]);break;case 23:this.$={group:m[g]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=Ya(m[g]);break;case 26:this.$=Ya(m[g-1]);break;case 29:this.$={having:m[g]};break;case 30:this.$={order:m[g]};break;case 32:this.$=Ya(m[g],{descending:!0});break;case 35:this.$={limit:Xa(m[g])};break;case 36:this.$={offset:Xa(m[g])};break;case 37:this.$={limit:Xa(m[g-2]),offset:Xa(m[g])};break;case 38:this.$={limit:Xa(m[g]),offset:Xa(m[g-2])};break;case 39:case 43:this.$={type:"values",values:m[g]};break;case 40:case 84:this.$=m[g-1].map(ft=>({[m[g-3]]:ft}));break;case 41:case 85:this.$=m[g-1].map(()=>({}));break;case 42:case 86:var _i=m[g-4].length;m[g-4]=m[g-4].map(qp),this.$=m[g-1].map(function(ft){if(ft.length!==_i)throw Error("Inconsistent VALUES length");for(var Et={},Je=0;Je<_i;Je++)Et["?"+m[g-4][Je].value]=ft[Je];return Et});break;case 44:case 65:case 100:case 126:case 175:this.$=m[g-1];break;case 45:this.$={type:"update",updates:Gi(m[g-2],m[g-1])};break;case 46:this.$=It({type:"load",silent:!!m[g-2],source:m[g-1]},m[g]&&{destination:m[g]});break;case 47:this.$={type:Dr(m[g-2]),silent:!!m[g-1],graph:m[g]};break;case 48:this.$={type:Dr(m[g-4]),silent:!!m[g-3],source:m[g-2],destination:m[g]};break;case 49:this.$={type:"create",silent:!!m[g-2],graph:{type:"graph",name:m[g]}};break;case 50:this.$={updateType:"insert",insert:C_(m[g])};break;case 51:this.$={updateType:"delete",delete:Zp(C_(m[g]))};break;case 52:this.$={updateType:"deletewhere",delete:Zp(m[g])};break;case 53:this.$={updateType:"insertdelete",...m[g-4],...m[g-3],...ta(m[g-2],"using"),where:m[g].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=m[g];break;case 55:this.$={delete:Zp(m[g-1]),insert:m[g]||[]};break;case 56:this.$={delete:[],insert:m[g]};break;case 59:this.$={graph:m[g]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:m[g]};break;case 64:this.$={[Dr(m[g])]:!0};break;case 66:this.$=m[g-1]?yi(m[g],[m[g-1]]):yi(m[g]);break;case 67:var jc=It(m[g-3]||{triples:[]},{type:"graph",name:m[g-5]});this.$=m[g]?[jc,m[g]]:[jc];break;case 68:case 73:this.$={type:"bgp",triples:yi(m[g-2],[m[g-1]])};break;case 69:this.$={type:"group",patterns:[m[g-1]]};break;case 70:for(let ft of m[g-1].filter(Et=>Et.type==="bind")){let Et=m[g-1].indexOf(ft),Je=new Set;for(let st of m[g-1].slice(0,Et))(st.type==="group"||st.type==="bgp")&&x_(st).forEach(Kr=>Je.add(Kr));if(Je.has(ft.variable.value))throw Error("Variable used to bind is already bound (?"+ft.variable.value+")")}this.$={type:"group",patterns:m[g-1]};break;case 71:this.$=m[g-1]?yi([m[g-1]],m[g]):yi(m[g]);break;case 72:this.$=m[g]?[m[g-2],m[g]]:m[g-2];break;case 75:this.$=It(m[g],{type:"optional"});break;case 76:this.$=It(m[g],{type:"minus"});break;case 77:this.$=It(m[g],{type:"graph",name:m[g-1]});break;case 78:this.$=It(m[g],{type:"service",name:m[g-1],silent:!!m[g-2]});break;case 79:this.$={type:"filter",expression:m[g]};break;case 80:this.$={type:"bind",variable:m[g-1],expression:m[g-3]};break;case 89:this.$=Mc(m[g]);break;case 90:this.$=void 0;break;case 91:this.$=m[g-1].length?{type:"union",patterns:yi(m[g-1].map(Gp),[Gp(m[g])])}:m[g];break;case 95:this.$={...m[g],function:m[g-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Gi(m[g-2],m[g-1]),distinct:!!m[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.$=Gi(m[g-2],m[g-1]);break;case 101:this.$=yi(m[g-2],[m[g-1]]);break;case 102:case 112:this.$=Jp(m[g].map(ft=>It(Hi(m[g-1]),ft)));break;case 103:this.$=Jp(ea(m[g].map(ft=>It(Hi(m[g-1].entity),ft)),m[g-1].triples));break;case 105:this.$=yi([m[g-1]],m[g]);break;case 106:this.$=yi(m[g]);break;case 107:this.$=Qp(m[g-1],m[g]);break;case 109:case 237:this.$=Re.factory.namedNode(PI);break;case 110:case 118:this.$=Gi(m[g-1],m[g]);break;case 111:this.$=m[g]?{annotation:m[g],object:m[g-1]}:m[g-1];break;case 113:this.$=m[g]?Jp(ea(m[g].map(ft=>It(Hi(m[g-1].entity),ft)),m[g-1].triples)):m[g-1].triples;break;case 114:this.$=Qp(...m[g-1],m[g]);break;case 116:this.$=Qp(...m[g]);break;case 117:case 159:case 163:this.$=[m[g-1],m[g]];break;case 119:this.$=m[g]?{object:m[g-1],annotation:m[g]}:m[g-1];break;case 120:this.$=m[g-1].length?Ka("|",Gi(m[g-1],m[g])):m[g];break;case 121:this.$=m[g-1].length?Ka("/",Gi(m[g-1],m[g])):m[g];break;case 122:this.$=m[g]?Ka(m[g],[m[g-1]]):m[g-1];break;case 123:this.$=m[g-1]?Ka(m[g-1],[m[g]]):m[g];break;case 125:case 131:this.$=Ka(m[g-1],[m[g]]);break;case 129:this.$=Ka("|",Gi(m[g-2],m[g-1]));break;case 132:case 134:this.$=$I(m[g-1]);break;case 133:case 135:this.$=VI(m[g-1]);break;case 140:this.$={entity:m[g],triples:[]};break;case 145:this.$=qp(m[g]);break;case 149:this.$=Re.factory.namedNode(y_);break;case 151:case 153:case 158:case 162:this.$=Wp(m[g-1],m[g]);break;case 152:this.$=["||",m[g]];break;case 154:this.$=["&&",m[g]];break;case 156:this.$=ir(m[g-1],[m[g-2],m[g]]);break;case 157:this.$=ir(m[g-2]?"notin":"in",[m[g-3],m[g]]);break;case 160:this.$=["+",Wp(m[g-1],m[g])];break;case 161:var ku=vi(m[g-1].value.replace("-",""),m[g-1].datatype);this.$=["-",Wp(ku,m[g])];break;case 164:this.$=ir("UPLUS",[m[g]]);break;case 165:this.$=ir(m[g-1],[m[g]]);break;case 166:this.$=ir("UMINUS",[m[g]]);break;case 177:this.$=ir(Dr(m[g-1]));break;case 178:this.$=ir(Dr(m[g-3]),[m[g-1]]);break;case 179:this.$=Mc(ir(Dr(m[g-3]),[m[g-1]]));break;case 180:this.$=ir(Dr(m[g-5]),[m[g-3],m[g-1]]);break;case 181:this.$=ir(Dr(m[g-7]),[m[g-5],m[g-3],m[g-1]]);break;case 182:this.$=Mc(ir(Dr(m[g-7]),[m[g-5],m[g-3],m[g-1]]));break;case 183:this.$=ir(Dr(m[g-1]),m[g]);break;case 184:this.$=ir("bound",[qp(m[g-1])]);break;case 185:this.$=ir(m[g-1],[]);break;case 186:this.$=ir(m[g-3],[m[g-1]]);break;case 187:this.$=ir(m[g-2]?"notexists":"exists",[Gp(m[g])]);break;case 188:case 189:this.$=Ya(m[g-1],{type:"aggregate",aggregation:Dr(m[g-4]),distinct:!!m[g-2]});break;case 190:this.$=Ya(m[g-2],{type:"aggregate",aggregation:Dr(m[g-5]),distinct:!!m[g-3],separator:typeof m[g-1]=="string"?m[g-1]:" "});break;case 192:this.$=vi(m[g]);break;case 193:this.$=kI(m[g-1],Dr(m[g].substr(1)));break;case 194:this.$=vi(m[g-2],m[g]);break;case 195:case 204:this.$=vi(m[g],v_);break;case 196:case 205:this.$=vi(m[g],__);break;case 197:case 206:this.$=vi(Dr(m[g]),w_);break;case 200:this.$=vi(m[g].toLowerCase(),NI);break;case 201:this.$=vi(m[g].substr(1),v_);break;case 202:this.$=vi(m[g].substr(1),__);break;case 203:this.$=vi(m[g].substr(1).toLowerCase(),w_);break;case 207:case 208:this.$=T_(m[g],1);break;case 209:case 210:this.$=T_(m[g],3);break;case 211:this.$=Re.factory.namedNode(kc(m[g]));break;case 213:var Lu=m[g].indexOf(":"),$c=m[g].substr(0,Lu),Mu=Re.prefixes[$c];if(!Mu)throw new Error("Unknown prefix: "+$c);var xt=kc(Mu+m[g].substr(Lu+1));this.$=Re.factory.namedNode(xt);break;case 214:if(m[g]=m[g].substr(0,m[g].length-1),!(m[g]in Re.prefixes))throw new Error("Unknown prefix: "+m[g]);var xt=kc(Re.prefixes[m[g]]);this.$=Re.factory.namedNode(xt);break;case 215:this.$=Lc(m[g].replace(/^(_:)/,""));break;case 216:this.$=Lc();break;case 217:case 218:case 232:this.$=Mc(Hp(m[g-3],m[g-2],m[g-1]));break;case 230:case 231:this.$=Mc(m[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:m[g-1].push(m[g]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[m[g]];break;case 308:m[g-3].push(m[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:m[g-2].push(m[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:h,33:35,39:[1,37],44:39,55:40,87:d,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:w,87:d},n(T,[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(S,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:A,29:F,52:84,53:Q,56:85},{19:88,28:A,29:F,52:89,53:Q,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:Q},n(K,[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:h,87:d,308:p}),n(Te,[2,262]),n(H,[2,259]),n(J,[2,143]),n(J,[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(L,[2,211]),n(L,[2,212]),n(L,[2,213]),n(L,[2,214]),{19:98,28:A,29:F,52:99,53:Q,56:85},{6:[2,309],99:100,193:[1,101]},n($,[2,311],{101:102,328:[1,103]}),n(Z,[2,317],{104:104,328:[1,105]}),n(qe,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:et,114:110},{29:et,114:112},{29:et,114:113},{118:114,123:[1,115],125:116,126:wt},n(tt,[2,315]),n(tt,[2,316]),n(nt,[2,319]),n(nt,[2,320]),n(nt,[2,321]),n(y,[2,327]),{13:f,16:h,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:w,87:d}),n(We,[2,269]),n(We,[2,15]),{13:f,16:h,44:136,45:re,46:120,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(T,[2,14]),n(T,[2,274]),n(T,[2,271]),n(T,[2,272]),n(e,[2,4]),{13:[1,177]},n(Y,[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:h,45:[1,193],55:194,197:ut,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(S,[2,419]),n(vt,Ie,{20:196,59:197,69:198,70:B}),n(l,[2,250]),{29:q,57:200},n($,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(G,z,{23:204,58:205,62:206,63:Ee}),n(l,[2,252]),{19:208,28:A,29:F,52:209,53:Q,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:h,44:215,45:Ke,55:220,82:U,87:d,89:Xe,145:212,172:221,185:213,187:214,231:rr,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Uv,[2,265],{56:85,35:227,52:228,19:229,28:A,29:F,53:Q}),n(H,[2,260]),n(G,z,{58:205,62:206,23:230,63:Ee}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:h,55:232,307:43,308:p},n($,[2,312]),{105:233,112:Bv,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(Z,[2,318]),n($,qv,{108:240,133:242,112:Wv,132:Gv}),n(qe,[2,323]),{112:[1,244]},{112:[2,325]},n(nr,[2,50]),n(K,vu,{135:245,136:246,143:247,144:248,31:Hv,112:Hv}),n(nr,[2,51]),n(nr,[2,52]),n(ms,[2,328],{119:249}),{29:et,114:250},n(ms,[2,56]),{29:et,114:251},n(y,[2,59]),n(We,[2,270]),{47:[1,252]},n(zv,[2,150]),n(_u,[2,428],{240:253}),n(Wa,[2,430],{244:254}),n(Wa,[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(Ga,[2,440],{252:264}),n(Gt,[2,448],{260:265}),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,255:154,257:155,264:266,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,255:154,257:155,264:267,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,255:154,257:155,264:268,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Gt,[2,167]),n(Gt,[2,168]),n(Gt,[2,169]),n(Gt,[2,170],{176:269,45:Qv,89:Yv}),n(Gt,[2,171]),n(Gt,[2,172]),n(Gt,[2,173]),n(Gt,[2,174]),{13:f,16:h,44:136,45:re,46:272,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Dt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:Kv,89:Xv,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(Fr,[2,192],{292:[1,286],293:[1,287]}),n(Fr,[2,195]),n(Fr,[2,196]),n(Fr,[2,197]),n(Fr,[2,198]),n(Fr,[2,199]),n(Fr,[2,200]),{13:f,16:h,44:39,55:40,82:U,87:d,139:289,172:291,255:154,257:155,266:290,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(Pc,[2,452]),n(Pc,[2,453]),n(Pc,[2,454]),n(Pc,[2,455]),n(Pc,[2,456]),{279:[2,458]},n(wu,[2,207]),n(wu,[2,208]),n(wu,[2,209]),n(wu,[2,210]),n(Fr,[2,201]),n(Fr,[2,202]),n(Fr,[2,203]),n(Fr,[2,204]),n(Fr,[2,205]),n(Fr,[2,206]),n(e,[2,5]),n(bu,[2,297],{88:295}),n(Su,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(Eu,[2,301]),n(Y,[2,43]),n(Y,[2,82]),n(Y,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(zs,[2,123]),n(zs,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(gi,[2,124]),{13:f,16:h,45:[1,311],55:194,89:[1,310],197:ut,223:312,225:308,226:309,229:Jv,307:43,308:p},n(c,i,{215:10,214:314}),n(gi,[2,236]),n(gi,[2,237]),n(Ha,[2,6]),n(kp,[2,287],{60:315,72:316,73:[1,317]}),n(vt,[2,286]),{13:f,16:h,45:re,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,307:43,308:p,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n([6,31,63,70,73,81,83,85],[2,20]),n(K,Zv,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Vi,31:Vi,85:Vi,112:Vi,159:Vi,160:Vi,161:Vi,163:Vi,164:Vi,41:s}),{13:f,16:h,55:331,307:43,308:p},n($,[2,280]),n(Ha,[2,7]),n(vt,Ie,{59:197,69:198,20:332,70:B}),n(G,[2,284]),{64:[1,333]},n(G,z,{58:205,62:206,23:334,63:Ee}),n(l,[2,254]),n(K,vu,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:h,44:39,55:40,87:d,139:342,186:339,190:340,195:341,197:Qs,307:43,308:p},n(Fc,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:h,87:d,197:Qs,308:p}),n(Ui,[2,227]),n(Ui,[2,228]),n(Ui,[2,229]),{13:f,16:h,44:215,45:Ke,55:220,82:U,87:d,89:Xe,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:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},{13:f,16:h,44:39,55:40,87:d,139:342,186:352,190:340,195:341,197:Qs,307:43,308:p},n(Ui,[2,146]),n(Ui,[2,147]),n(Ui,[2,148]),n(Ui,[2,149]),{13:f,16:h,44:354,55:355,82:U,87:d,172:357,237:356,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:358,312:Pr,313:353},n(Lp,[2,215]),n(Lp,[2,216]),n(G,z,{58:205,62:206,23:359,63:Ee}),n(Te,[2,264]),n(Uv,[2,266]),n(Ha,[2,11]),n(r,[2,308],{6:[2,310]}),n(nr,[2,313],{102:360,120:361,121:[1,362]}),n(nr,[2,47]),n(nr,[2,63]),n(nr,[2,64]),{13:f,16:h,55:363,307:43,308:p},n(nr,[2,336]),n(nr,[2,337]),n(nr,[2,338]),{109:[1,364]},n(e_,[2,60]),{13:f,16:h,55:365,307:43,308:p},n($,[2,335]),{13:f,16:h,55:366,307:43,308:p},{31:[1,367]},n(Ys,[2,341],{137:368}),n(Ys,[2,340]),{13:f,16:h,44:215,45:Ke,55:220,82:U,87:d,89:Xe,145:369,172:221,185:213,187:214,231:rr,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},{28:[1,370],127:371,128:[1,372]},n(ms,[2,330],{124:373,125:374,126:wt}),n(ms,[2,57]),{44:375,87:d},n(zv,[2,151],{241:376,242:[1,377]}),n(_u,[2,153],{245:378,246:[1,379]}),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,247:380,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{250:[1,381]},n(Nt,[2,432]),n(Nt,[2,433]),n(Nt,[2,434]),n(Nt,[2,435]),n(Nt,[2,436]),n(Nt,[2,437]),{250:[2,439]},n([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:ue,298:fe,299:he,300:oe,301:me,302:ge}),n(Ga,[2,162],{261:388,262:389,39:Mp,338:jp}),n(Gt,[2,164]),n(Gt,[2,165]),n(Gt,[2,166]),n(Dt,[2,95]),n(Dt,[2,96]),n(Nt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Dt,[2,177]),{13:f,16:h,44:136,45:re,46:395,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,46:396,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,46:397,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,46:398,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,46:399,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Dt,[2,183]),n(Dt,[2,98]),n(Nt,[2,381],{180:400}),{87:[1,401]},n(Dt,[2,185]),{13:f,16:h,44:136,45:re,46:402,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{29:q,57:403},n(Fr,[2,193]),{13:f,16:h,55:404,307:43,308:p},{13:f,16:h,44:39,55:40,87:d,139:342,195:405,197:Qs,307:43,308:p},n(gs,[2,233]),n(gs,[2,234]),n(gs,[2,235]),n(t_,[2,459],{281:406,325:[1,407]}),n(Nt,[2,463],{284:408,325:[1,409]}),n(Nt,[2,465],{286:410,325:[1,411]}),{13:f,16:h,31:[1,412],55:414,82:U,171:413,172:415,173:416,174:Tu,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:xu},{31:[1,419],89:[1,420]},{29:[1,421]},n(Eu,[2,302]),n(bu,[2,367],{167:422}),n(Su,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(Eu,[2,371]),n(zs,[2,122]),n(zs,[2,417]),n(zs,[2,413]),n(zs,[2,414]),n(zs,[2,415]),n(gi,[2,125]),n(gi,[2,127]),n(gi,[2,128]),n(r_,[2,420],{227:426}),n(gi,[2,130]),{13:f,16:h,55:194,197:ut,223:427,307:43,308:p},{48:[1,428]},n(ys,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(kp,[2,288]),{64:[1,433]},n(vt,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:h,45:re,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,276:je,277:we,279:De,280:Ae,283:Ne,285:$e,308:p,346:Ve,347:Pe,348:b,349:E,350:x,351:R}),n(n_,[2,293]),n($p,[2,92]),n($p,[2,93]),n($p,[2,94]),{45:Qv,89:Yv,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:A,29:F,56:85},{19:438,28:A,29:F,56:85},n(Ks,[2,355],{149:439}),n(Ks,[2,354]),{13:f,16:h,44:215,45:Au,55:220,82:U,87:d,89:Xe,156:440,172:221,185:441,203:442,231:Cu,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Te,[2,19]),n(ys,[2,21]),{13:f,16:h,44:450,45:i_,55:323,65:445,66:446,67:447,68:448,87:d,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,307:43,308:p,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Ha,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(K,[2,386],{31:[2,388]}),n(Fc,[2,102]),n(Xs,[2,391],{191:452}),n(K,[2,395],{196:453,198:454}),n(K,[2,108]),n(K,[2,109]),n(Fc,[2,103]),n(Fc,[2,104]),n(Fc,[2,390]),{13:f,16:h,44:215,45:Ke,48:[1,455],55:220,82:U,87:d,89:Xe,172:221,185:351,187:350,200:456,231:rr,234:349,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Iu,[2,424]),n(s_,[2,136]),n(s_,[2,137]),n(Vp,[2,140]),{232:[1,457]},{13:f,16:h,44:39,55:40,87:d,139:342,195:458,197:Qs,307:43,308:p},n(gs,[2,219]),n(gs,[2,220]),n(gs,[2,221]),n(gs,[2,222]),n(gs,[2,223]),n(Ha,[2,10]),n(nr,[2,46]),n(nr,[2,314]),{112:Bv,122:459},n(nr,[2,62]),n($,qv,{133:242,108:460,112:Wv,132:Gv}),n(e_,[2,61]),n(nr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Ys,[2,351],{146:463,335:[1,464]}),{29:q,57:465},n(ms,[2,329]),n($,[2,332],{129:466,327:[1,467]}),n(ms,[2,55]),n(ms,[2,331]),{48:[1,468]},n(_u,[2,429]),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Wa,[2,431]),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,243:470,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Wa,[2,156]),{45:Kv,89:Xv,179:471},n(Ga,[2,441]),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,251:472,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Gt,[2,444],{256:473}),n(Gt,[2,446],{258:474}),n(Nt,[2,442]),n(Nt,[2,443]),n(Gt,[2,449]),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,255:154,257:155,259:475,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Nt,[2,450]),n(Nt,[2,451]),n(Nt,[2,379],{178:476}),n(Nt,[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:h,44:136,45:re,46:482,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{48:[1,483]},{48:[1,484]},n(Dt,[2,187]),n(Fr,[2,194]),{13:f,16:h,44:39,55:40,82:U,87:d,139:289,172:291,255:154,257:155,266:290,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,320:485},{13:f,16:h,39:[1,487],44:136,45:re,46:488,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,282:486,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(t_,[2,460]),{13:f,16:h,44:136,45:re,46:489,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Nt,[2,464]),{13:f,16:h,44:136,45:re,46:490,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Nt,[2,466]),n(Y,[2,40]),n(bu,[2,298]),n(Dc,[2,87]),n(Dc,[2,88]),n(Dc,[2,89]),n(Dc,[2,90]),{13:f,16:h,55:492,82:U,172:493,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,311:494,312:Pr,315:491},n(Y,[2,41]),n(Su,[2,300]),n(Nc,[2,303],{92:495}),{13:f,16:h,31:[1,496],55:414,82:U,171:497,172:415,173:416,174:Tu,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:xu},{31:[1,498],89:[1,499]},{29:[1,500]},n(Eu,[2,372]),{13:f,16:h,48:[2,422],55:194,197:ut,223:312,226:502,228:501,229:Jv,307:43,308:p},n(gi,[2,131]),n(gi,[2,126]),n(ys,[2,22]),n(ys,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:h,44:510,45:re,55:323,67:321,68:322,74:505,75:506,76:a_,77:320,78:o_,79:509,87:d,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,307:43,308:p,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(n_,[2,294]),n(c_,[2,69]),n(c_,[2,70]),n(vt,Ie,{59:197,69:198,20:511,70:B}),n(G,z,{58:205,62:206,23:512,63:Ee}),{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(Ks,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:d}),n(Ou,[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:d}),{13:f,16:h,44:215,45:Au,55:220,82:U,87:d,89:Xe,172:221,185:351,203:536,212:534,231:Cu,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:d}),n(G,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:h,45:i_,87:d,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,276:je,277:we,279:De,280:Ae,283:Ne,285:$e,308:p,346:Ve,347:Pe,348:b,349:E,350:x,351:R}),n(Js,[2,291]),n(Js,[2,24]),n(Js,[2,25]),{13:f,16:h,44:136,45:re,46:539,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Js,[2,28]),n(G,z,{58:205,62:206,23:540,63:Ee}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(Xs,[2,107]),{13:f,16:h,44:215,45:Ke,55:220,82:U,87:d,89:Xe,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:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(l_,[2,132]),n(Iu,[2,425]),n(l_,[2,133]),{13:f,16:h,44:354,55:355,82:U,87:d,172:357,237:356,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:358,312:Pr,313:545},n(nr,[2,54]),n(nr,[2,48]),n(Ys,[2,342]),{13:f,16:h,44:39,55:40,87:d,139:546,307:43,308:p},n(Ys,[2,68]),n(K,[2,350],{31:u_,112:u_}),n(nr,[2,53]),{13:f,16:h,55:547,307:43,308:p},n($,[2,333]),n(We,[2,16]),n(_u,[2,152]),n(Wa,[2,154]),n(Wa,[2,157]),n(Ga,[2,159]),n(Ga,[2,160],{262:389,261:548,39:Mp,338:jp}),n(Ga,[2,161],{262:389,261:549,39:Mp,338:jp}),n(Gt,[2,163]),{13:f,16:h,44:136,45:re,46:550,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Dt,[2,178]),n(Dt,[2,179]),{13:f,16:h,44:136,45:re,46:551,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,46:552,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,46:553,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{48:[1,554],272:[1,555]},n(Dt,[2,184]),n(Dt,[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:h,55:194,197:ut,223:562,307:43,308:p},n(Up,[2,224]),n(Up,[2,225]),n(Up,[2,226]),{31:[1,563],45:f_,94:564},n(Y,[2,84]),n(bu,[2,368]),n(Y,[2,85]),n(Su,[2,370]),n(Nc,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(ys,[2,35],{83:[1,569]}),n(ys,[2,36],{81:[1,570]}),n(kp,[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:h,45:re,76:a_,78:o_,87:d,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,276:je,277:we,279:De,280:Ae,283:Ne,285:$e,308:p,346:Ve,347:Pe,348:b,349:E,350:x,351:R}),n(za,[2,295]),{45:re,77:572},{45:re,77:573},n(za,[2,33]),n(za,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(Ks,[2,356]),n(h_,[2,357],{152:578,335:[1,579]}),n(Bi,[2,74]),{29:q,57:580},{29:q,57:581},{13:f,16:h,44:39,55:40,87:d,139:582,307:43,308:p},n(d_,[2,365],{162:583,328:[1,584]}),{13:f,16:h,45:re,55:323,67:321,68:322,77:320,79:585,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,307:43,308:p,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{45:[1,586]},n(Bi,[2,81]),{29:q,57:587},n(Ks,[2,73]),n(K,[2,362],{29:qi,31:qi,85:qi,112:qi,159:qi,160:qi,161:qi,163:qi,164:qi}),n(Ou,[2,112]),n(Qa,[2,401],{206:588}),n(K,[2,405],{209:589,210:590}),n(K,[2,403]),n(K,[2,404]),n(Ou,[2,113]),n(Ou,[2,400]),{13:f,16:h,44:215,45:Au,48:[1,591],55:220,82:U,87:d,89:Xe,172:221,185:351,203:536,212:592,231:Cu,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Iu,[2,426]),n(Vp,[2,138]),n(Vp,[2,139]),{232:[1,593]},n(Js,[2,292]),{47:[1,595],48:[1,594]},n(Ha,[2,9]),n(Xs,[2,392]),n(Xs,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:h,87:d,197:Qs,308:p}),n(Xs,[2,110],{272:[1,598]}),n(Ru,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(ms,[2,58]),n(Gt,[2,445]),n(Gt,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Dt,[2,99]),n(Nt,[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(Dt,[2,188]),n(Dt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:h,55:492,82:U,172:493,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,311:494,312:Pr,315:611},n(Y,[2,42]),n(Nc,[2,304]),{13:f,16:h,55:414,82:U,95:612,171:613,172:415,173:416,174:Tu,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:xu},{31:[1,614],45:f_,94:615},n(gi,[2,129]),n(r_,[2,421]),{82:[1,616]},{82:[1,617]},n(za,[2,296]),n(za,[2,31]),n(za,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(K,Zv,{155:330,153:618,154:619,29:Wi,31:Wi,85:Wi,112:Wi,159:Wi,160:Wi,161:Wi,163:Wi,164:Wi}),n(h_,[2,358]),n(Bi,[2,75]),n(Bi,[2,76]),{29:q,57:620},{13:f,16:h,44:39,55:40,87:d,139:621,307:43,308:p},n(d_,[2,366]),n(Bi,[2,79]),{13:f,16:h,44:136,45:re,46:622,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Bi,[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(Qa,[2,117]),{13:f,16:h,44:215,45:Au,55:220,82:U,87:d,89:Xe,172:221,185:351,203:536,211:626,212:627,231:Cu,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Ui,[2,134]),n(Iu,[2,427]),n(Ui,[2,135]),n(Js,[2,26]),{44:628,87:d},n(Xs,[2,106]),n(Xs,[2,394]),n(K,[2,396]),n(Ru,[2,111]),n(Ru,[2,398]),{13:f,16:h,44:39,55:40,87:d,139:342,186:629,190:340,195:341,197:Qs,307:43,308:p},n(Lp,[2,217]),n(K,vu,{144:248,140:630,143:631,31:[2,343]}),n(Dt,[2,97]),n(Nt,[2,380]),n(Dt,[2,180]),{13:f,16:h,44:136,45:re,46:632,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},{13:f,16:h,44:136,45:re,46:633,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:x,351:R},n(Dt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:h,48:[1,636],55:414,82:U,171:637,172:415,173:416,174:Tu,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:xu},n(p_,[2,305]),n(Y,[2,86]),n(Nc,[2,374]),n(ys,[2,37]),n(ys,[2,38]),n(Ks,[2,72]),n(Ks,[2,360]),n(Bi,[2,77]),{29:q,57:638},{47:[1,639]},{29:[2,376]},n(Qa,[2,402]),n(Qa,[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:d}),n(Qa,[2,118],{272:[1,641]}),n(Pu,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:ye,304:ve,305:ie,306:_e},n(Dc,[2,218]),n(Nc,[2,44]),n(p_,[2,306]),n(Bi,[2,78]),{44:651,87:d},n(Qa,[2,116]),n(K,[2,406]),n(Pu,[2,119]),n(Pu,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:d}),n(Js,[2,27]),n(Ru,[2,230]),n(m_,[2,345],{141:653,335:[1,654]}),n(Dt,[2,181]),n(Dt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(K,vu,{144:248,142:657,143:658,31:g_,112:g_}),n(m_,[2,346]),n(Bi,[2,80]),n(Pu,[2,231]),n(Ys,[2,67]),n(Ys,[2,348])],defaultActions:{5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]},parseError:o(function(C,O){if(O.recoverable)this.trace(C);else{var D=new Error(C);throw D.hash=O,D}},"parseError"),parse:o(function(C){var O=this,D=[0],te=[],Ce=[null],m=[],Nr=this.table,g="",_i=0,jc=0,ku=0,Lu=2,$c=1,Mu=m.slice.call(arguments,1),xt=Object.create(this.lexer),wi={yy:{}};for(var Vc in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Vc)&&(wi.yy[Vc]=this.yy[Vc]);xt.setInput(C,wi.yy),wi.yy.lexer=xt,wi.yy.parser=this,typeof xt.yylloc>"u"&&(xt.yylloc={});var Za=xt.yylloc;m.push(Za);var ft=xt.options&&xt.options.ranges;typeof wi.yy.parseError=="function"?this.parseError=wi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Et(bi){D.length=D.length-2*bi,Ce.length=Ce.length-bi,m.length=m.length-bi}o(Et,"popStack");for(var Je=o(function(){var bi;return bi=xt.lex()||$c,typeof bi!="number"&&(bi=O.symbols_[bi]||bi),bi},"lex"),st,Kr,ra,gn,nB,em,eo={},ju,zi,I_,$u;;){if(ra=D[D.length-1],this.defaultActions[ra]?gn=this.defaultActions[ra]:((st===null||typeof st>"u")&&(st=Je()),gn=Nr[ra]&&Nr[ra][st]),typeof gn>"u"||!gn.length||!gn[0]){var tm="";$u=[];for(ju in Nr[ra])this.terminals_[ju]&&ju>Lu&&$u.push("'"+this.terminals_[ju]+"'");xt.showPosition?tm="Parse error on line "+(_i+1)+`:
|
|
266
|
+
`),t}};uh.RDFSerializer=gy});var vy=_(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});fh.RDFVocabularyMapper=void 0;var Sr=Si(),yS=ze(),ae=cn(),yy=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",ae.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",ae.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",ae.Namespace.RDFS.term("subClassOf")],["exo__Property_range",ae.Namespace.RDFS.term("range")],["exo__Property_domain",ae.Namespace.RDFS.term("domain")],["exo__Property_superProperty",ae.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new Sr.Triple(ae.Namespace.EXO.term("Asset"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.RDFS.term("Resource"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Class"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.RDFS.term("Class"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Property"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.RDF.term("Property"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("Task"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("Project"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("Area"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("Workflow"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("WorkflowState"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e.push(new Sr.Triple(ae.Namespace.EMS.term("WorkflowTransition"),ae.Namespace.RDFS.term("subClassOf"),ae.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new Sr.Triple(ae.Namespace.EXO.term("Instance_class"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDF.term("type"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Asset_isDefinedBy"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("isDefinedBy"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Class_superClass"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("subClassOf"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Property_range"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("range"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Property_domain"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("domain"))),e.push(new Sr.Triple(ae.Namespace.EXO.term("Property_superProperty"),ae.Namespace.RDFS.term("subPropertyOf"),ae.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof yS.IRI)s=r;else{let a=r.match(/^(ems|exo)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?ae.Namespace.EMS:ae.Namespace.EXO).term(l)}else s=new yS.IRI(r)}return new Sr.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};fh.RDFVocabularyMapper=yy});var vS=_(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.RDFSInferenceEngine=void 0;var t5=Si(),hh=ze(),_y=class{static{o(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(h=>h.value.includes("Class_superClass")),i=t.find(h=>h.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 h of l)if(h.object instanceof hh.IRI){let d=a.get(h.object.value);if(d)for(let p of d)u.push(new t5.Triple(h.subject,i,new hh.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 hh.IRI&&s.object instanceof hh.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}};dh.RDFSInferenceEngine=_y});var by=_(ni=>{"use strict";var r5=ni&&ni.__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},n5=ni&&ni.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},_S=ni&&ni.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ni,"__esModule",{value:!0});ni.NoteToRDFConverter=void 0;var wy=Ue(),Zr=Si(),mo=ze(),un=mt(),wS=$t(),Ur=cn(),bS=ht(),i5=vy(),en=rg(),go=class{static{o(this,"NoteToRDFConverter")}constructor(e,t){this.vault=e,this.logger=t,this.OBSIDIAN_VAULT_SCHEME="obsidian://vault/",this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new i5.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?en.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Ur.Namespace.EXO.term("Asset_fileName");r.push(new Zr.Triple(i,s,new un.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 h of f)if(c==="exo__Instance_class"){let d=this.valueToClassURI(h);r.push(new Zr.Triple(i,u,d))}else{let d=await this.valueToRDFObject(h,e);for(let p of d)if(r.push(new Zr.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof mo.IRI){let y=this.vocabularyMapper.generateMappedTriple(i,c,p);y&&r.push(y)}}if(c==="exo__Instance_class")for(let h of f){let d=this.expandClassValue(h);if(d){let p=Ur.Namespace.RDF.term("type");r.push(new Zr.Triple(i,p,d))}}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=en.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case en.Exo003MetadataType.Namespace:break;case en.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case en.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case en.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case en.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new mo.IRI(t.uri);return[new Zr.Triple(r,Ur.Namespace.OWL.term("sameAs"),i),new Zr.Triple(i,Ur.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 Zr.Triple(r,Ur.Namespace.OWL.term("sameAs"),new wS.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=en.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new Zr.Triple(a,Ur.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 mo.IRI(c.value):new wS.BlankNode(c.value),f=new mo.IRI(l.value),h=en.Exo003Parser.toLiteral(t,s.trim());r.push(new Zr.Triple(u,f,h));let d=this.notePathToIRI(e.path);r.push(new Zr.Triple(d,Ur.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&&en.Exo003Parser.isExo003Format(a)){let c=en.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===en.Exo003MetadataType.Anchor||l.metadata===en.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===en.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=await this.convertNote(a);r.push(...c)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),this.logger.warn(`Skipping file with invalid IRI: ${a.path}`,{reason:l})}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=encodeURI(r.path),s=`${this.OBSIDIAN_VAULT_SCHEME}${i}`;mo.IRI.isValidIRI(s)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){let t=encodeURI(e);return new mo.IRI(`${this.OBSIDIAN_VAULT_SCHEME}${t}`)}isExocortexProperty(e){return e.startsWith("exo__")||e.startsWith("ems__")}propertyKeyToIRI(e){if(e.startsWith("exo__")){let t=e.substring(5);return Ur.Namespace.EXO.term(t)}if(e.startsWith("ems__")){let t=e.substring(5);return Ur.Namespace.EMS.term(t)}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);if(this.isUUID(i)){let c=new un.Literal(i);return[a,c]}return[a]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return[new un.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new un.Literal(r,Ur.Namespace.XSD.term("dateTime"))]:[new un.Literal(r)]}return typeof e=="boolean"?[new un.Literal(e.toString())]:typeof e=="number"?[new un.Literal(e.toString(),Ur.Namespace.XSD.term("decimal"))]:e instanceof Date?[new un.Literal(e.toISOString(),Ur.Namespace.XSD.term("dateTime"))]:[new un.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(/^\[\[([^\]]+)\]\]$/);return t?t[1]:null}valueToClassURI(e){if(typeof e!="string")return new un.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);return s||new un.Literal(t)}isClassReference(e){return(e.startsWith("ems__")||e.startsWith("exo__"))&&!/\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);if(t.startsWith("ems__")){let r=t.substring(5);return Ur.Namespace.EMS.term(r)}if(t.startsWith("exo__")){let r=t.substring(5);return Ur.Namespace.EXO.term(r)}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=Ur.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 Zr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new Zr.Triple(t,c,f)):r.push(new Zr.Triple(t,c,new un.Literal(l)))}else r.push(new Zr.Triple(t,c,new un.Literal(l)))}}catch{}return r}};ni.NoteToRDFConverter=go;go.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};go.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};go.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};ni.NoteToRDFConverter=go=r5([(0,wy.injectable)(),_S(0,(0,wy.inject)(bS.DI_TOKENS.IVaultAdapter)),_S(1,(0,wy.inject)(bS.DI_TOKENS.ILogger)),n5("design:paramtypes",[Object,Object])],go)});var Sy=_((mQ,SS)=>{var yo=class{static{o(this,"Wildcard")}constructor(){return s5||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(yo.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(yo.prototype,"termType",{enumerable:!0,value:"Wildcard"});var s5=new yo;SS.exports.Wildcard=yo});var TS=_((yQ,ES)=>{var a5=(function(){var n=o(function(I,C,O,D){for(O=O||{},D=I.length;D--;O[I[D]]=C);return O},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],h=[1,45],d=[1,41],p=[1,44],y=[123,126],w=[1,67],T=[39,45,87],S=[13,16,45,197,224,308],x=[1,87],F=[2,281],Q=[1,86],K=[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],H=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],J=[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],L=[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],Z=[112,132,327,334],qe=[13,16,112,132,308],et=[1,111],wt=[1,117],tt=[112,132,327,328,334],nt=[13,16,112,132,308,328],We=[28,29,45,53,87],re=[1,138],U=[1,151],it=[1,128],ct=[1,127],W=[1,129],xe=[1,140],ke=[1,141],ee=[1,142],Le=[1,143],Me=[1,144],Fe=[1,145],je=[1,147],we=[1,148],De=[2,457],Ae=[1,158],Ne=[1,159],$e=[1,160],le=[1,152],de=[1,153],pe=[1,156],ue=[1,171],fe=[1,172],he=[1,173],oe=[1,174],me=[1,175],ge=[1,176],ye=[1,167],ve=[1,168],ie=[1,169],_e=[1,170],Ye=[1,157],Ve=[1,166],Pe=[1,161],b=[1,162],E=[1,163],A=[1,164],R=[1,165],Y=[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],ut=[1,195],vt=[6,31,73,81,83,85],Ie=[2,285],B=[1,199],q=[1,201],G=[6,31,70,73,81,83,85],z=[2,283],Ee=[1,207],Ke=[1,218],Xe=[1,223],rr=[1,219],Yr=[1,225],on=[1,226],Pr=[1,224],Uv=[6,63,70,73,81,83,85],Bv=[1,236],qv=[2,334],Wv=[1,243],Gv=[1,241],nr=[6,193],vu=[2,349],Hv=[2,339],gs=[28,128],zv=[47,48,193,272],_u=[47,48,193,242,272],Wa=[47,48,193,242,246,272],Ga=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Gt=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],Qv=[1,271],Yv=[1,270],Dt=[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],Kv=[1,281],Xv=[1,280],Fr=[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],Pc=[45,89],wu=[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],bu=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Su=[31,89],Eu=[48,87],zs=[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],gi=[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],Jv=[1,313],Ha=[6,85],kp=[6,31,81,83,85],Zv=[2,361],Vi=[2,353],Qs=[1,343],Fc=[31,112,335],Ui=[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],Lp=[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],e_=[6,109,193],Ys=[31,112],Nt=[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],Mp=[1,390],jp=[1,391],ys=[13,16,87,197,308,314],t_=[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],Tu=[1,417],xu=[1,418],r_=[13,16,48,197,229,308],vs=[6,31,85],n_=[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],$p=[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],Ks=[29,31,85,112,159,160,161,163,164],Au=[1,443],Cu=[1,444],i_=[1,449],Xs=[31,112,193,232,318,335],Iu=[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],s_=[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],Vp=[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],Dc=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Nc=[31,45],a_=[1,507],o_=[1,508],c_=[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],Ou=[29,31,85,112,159,160,161,163,164,335],Js=[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],l_=[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],u_=[2,352],Up=[13,16,197,308,314],f_=[1,565],za=[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],h_=[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],Bi=[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],d_=[13,16,87,308],qi=[2,364],Qa=[29,31,85,112,159,160,161,163,164,193,232,318,335],Ru=[31,112,193,232,272,318,335],Wi=[2,359],p_=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Pu=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],m_=[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],g_=[2,347],Bp={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Query:7,Qry:8,Query_option0:9,Prologue_repetition0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectClauseWildcard:17,Qry_repetition0:18,WhereClause:19,SolutionModifierNoGroup:20,SelectClauseVars:21,Qry_repetition1:22,SolutionModifier:23,CONSTRUCT:24,ConstructTemplate:25,Qry_repetition2:26,Qry_repetition3:27,WHERE:28,"{":29,Qry_option0:30,"}":31,DESCRIBE:32,Qry_group0:33,Qry_repetition4:34,Qry_option1:35,ASK:36,Qry_repetition5:37,SelectClauseBase:38,"*":39,SelectClauseVars_repetition_plus0:40,SELECT:41,SelectClauseBase_option0:42,SelectClauseItem:43,Var:44,"(":45,Expression:46,AS:47,")":48,SubSelect:49,SubSelect_option0:50,SubSelect_option1:51,DatasetClause:52,FROM:53,DatasetClause_option0:54,iri:55,WhereClause_option0:56,GroupGraphPattern:57,SolutionModifier_option0:58,SolutionModifierNoGroup_option0:59,SolutionModifierNoGroup_option1:60,SolutionModifierNoGroup_option2:61,GroupClause:62,GROUP:63,BY:64,GroupClause_repetition_plus0:65,GroupCondition:66,BuiltInCall:67,FunctionCall:68,HavingClause:69,HAVING:70,HavingClause_repetition_plus0:71,OrderClause:72,ORDER:73,OrderClause_repetition_plus0:74,OrderCondition:75,ASC:76,BrackettedExpression:77,DESC:78,Constraint:79,LimitOffsetClauses:80,LIMIT:81,INTEGER:82,OFFSET:83,ValuesClause:84,VALUES:85,InlineData:86,VAR:87,InlineData_repetition0:88,NIL:89,InlineData_repetition1:90,InlineData_repetition_plus2:91,InlineData_repetition3:92,DataBlock:93,DataBlockValueList:94,DataBlockValueList_repetition_plus0:95,Update:96,Update_repetition0:97,Update1:98,Update_option0:99,LOAD:100,Update1_option0:101,Update1_option1:102,Update1_group0:103,Update1_option2:104,GraphRefAll:105,Update1_group1:106,Update1_option3:107,GraphOrDefault:108,TO:109,CREATE:110,Update1_option4:111,GRAPH:112,INSERTDATA:113,QuadPattern:114,DELETEDATA:115,DELETEWHERE:116,Update1_option5:117,InsertDeleteClause:118,Update1_repetition0:119,IntoGraphClause:120,INTO:121,GraphRef:122,DELETE:123,InsertDeleteClause_option0:124,InsertClause:125,INSERT:126,UsingClause:127,USING:128,UsingClause_option0:129,WithClause:130,WITH:131,DEFAULT:132,GraphOrDefault_option0:133,GraphRefAll_group0:134,Quads:135,Quads_option0:136,Quads_repetition0:137,QuadsNotTriples:138,VarOrIri:139,QuadsNotTriples_option0:140,QuadsNotTriples_option1:141,QuadsNotTriples_option2:142,TriplesTemplate:143,TriplesTemplate_repetition0:144,TriplesSameSubject:145,TriplesTemplate_option0:146,GroupGraphPatternSub:147,GroupGraphPatternSub_option0:148,GroupGraphPatternSub_repetition0:149,GroupGraphPatternSubTail:150,GraphPatternNotTriples:151,GroupGraphPatternSubTail_option0:152,GroupGraphPatternSubTail_option1:153,TriplesBlock:154,TriplesBlock_repetition0:155,TriplesSameSubjectPath:156,TriplesBlock_option0:157,GroupOrUnionGraphPattern:158,OPTIONAL:159,MINUS:160,SERVICE:161,GraphPatternNotTriples_option0:162,FILTER:163,BIND:164,InlineDataOneVar:165,InlineDataFull:166,InlineDataOneVar_repetition0:167,InlineDataFull_repetition0:168,InlineDataFull_repetition_plus1:169,InlineDataFull_repetition2:170,DataBlockValue:171,Literal:172,QuotedTriple:173,UNDEF:174,GroupOrUnionGraphPattern_repetition0:175,ArgList:176,ArgList_option0:177,ArgList_repetition0:178,ExpressionList:179,ExpressionList_repetition0:180,ConstructTemplate_option0:181,ConstructTriples:182,ConstructTriples_repetition0:183,ConstructTriples_option0:184,VarOrTermOrQuotedTP:185,PropertyListNotEmpty:186,TriplesNode:187,PropertyList:188,PropertyList_option0:189,VerbObjectList:190,PropertyListNotEmpty_repetition0:191,SemiOptionalVerbObjectList:192,";":193,SemiOptionalVerbObjectList_option0:194,Verb:195,ObjectList:196,a:197,ObjectList_repetition0:198,Object:199,GraphNode:200,Object_option0:201,PropertyListPathNotEmpty:202,TriplesNodePath:203,TriplesSameSubjectPath_option0:204,O:205,PropertyListPathNotEmpty_repetition0:206,PropertyListPathNotEmptyTail:207,O_group0:208,ObjectListPath:209,ObjectListPath_repetition0:210,ObjectPath:211,GraphNodePath:212,ObjectPath_option0:213,Path:214,Path_repetition0:215,PathSequence:216,PathSequence_repetition0:217,PathEltOrInverse:218,PathElt:219,PathPrimary:220,PathElt_option0:221,PathEltOrInverse_option0:222,IriOrA:223,"!":224,PathNegatedPropertySet:225,PathOneInPropertySet:226,PathNegatedPropertySet_repetition0:227,PathNegatedPropertySet_option0:228,"^":229,TriplesNode_repetition_plus0:230,"[":231,"]":232,TriplesNodePath_repetition_plus0:233,VarOrTermOrQuotedTPExpr:234,VarOrTerm:235,GraphTerm:236,BlankNode:237,ConditionalOrExpression:238,ConditionalAndExpression:239,ConditionalOrExpression_repetition0:240,ConditionalOrExpressionTail:241,"||":242,RelationalExpression:243,ConditionalAndExpression_repetition0:244,ConditionalAndExpressionTail:245,"&&":246,NumericExpression:247,RelationalExpression_group0:248,RelationalExpression_option0:249,IN:250,MultiplicativeExpression:251,NumericExpression_repetition0:252,AdditiveExpressionTail:253,AdditiveExpressionTail_group0:254,NumericLiteralPositive:255,AdditiveExpressionTail_repetition0:256,NumericLiteralNegative:257,AdditiveExpressionTail_repetition1:258,UnaryExpression:259,MultiplicativeExpression_repetition0:260,MultiplicativeExpressionTail:261,MultiplicativeExpressionTail_group0:262,"+":263,PrimaryExpression:264,"-":265,ExprQuotedTP:266,Aggregate:267,FUNC_ARITY0:268,FUNC_ARITY1:269,FUNC_ARITY1_SPARQL_STAR:270,FUNC_ARITY2:271,",":272,FUNC_ARITY3:273,FUNC_ARITY3_SPARQL_STAR:274,BuiltInCall_group0:275,BOUND:276,BNODE:277,BuiltInCall_option0:278,EXISTS:279,COUNT:280,Aggregate_option0:281,Aggregate_group0:282,FUNC_AGGREGATE:283,Aggregate_option1:284,GROUP_CONCAT:285,Aggregate_option2:286,Aggregate_option3:287,GroupConcatSeparator:288,SEPARATOR:289,"=":290,String:291,LANGTAG:292,"^^":293,DECIMAL:294,DOUBLE:295,BOOLEAN:296,INTEGER_POSITIVE:297,DECIMAL_POSITIVE:298,DOUBLE_POSITIVE:299,INTEGER_NEGATIVE:300,DECIMAL_NEGATIVE:301,DOUBLE_NEGATIVE:302,STRING_LITERAL1:303,STRING_LITERAL2:304,STRING_LITERAL_LONG1:305,STRING_LITERAL_LONG2:306,PrefixedName:307,PNAME_LN:308,BLANK_NODE_LABEL:309,ANON:310,QuotedTP:311,"<<":312,qtSubjectOrObject:313,">>":314,DataValueTerm:315,AnnotationPattern:316,"{|":317,"|}":318,AnnotationPatternPath:319,ExprVarOrTerm:320,QueryOrUpdate_group0_option0:321,Prologue_repetition0_group0:322,Qry_group0_repetition_plus0:323,SelectClauseBase_option0_group0:324,DISTINCT:325,REDUCED:326,NAMED:327,SILENT:328,CLEAR:329,DROP:330,ADD:331,MOVE:332,COPY:333,ALL:334,".":335,UNION:336,"|":337,"/":338,PathElt_option0_group0:339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,NOT:346,CONCAT:347,COALESCE:348,SUBSTR:349,REGEX:350,REPLACE:351,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"},productions_:[0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]],performAction:o(function(C,O,D,te,Ce,m,Nr){var g=m.length-1;switch(Ce){case 1:if(m[g-1]=m[g-1]||{},Re.base&&(m[g-1].base=Re.base),Re.base="",m[g-1].prefixes=Re.prefixes,Re.prefixes=null,Re.pathOnly){if(m[g-1].type==="path"||"termType"in m[g-1])return m[g-1];throw new Error("Received full SPARQL query in path only mode")}else if(m[g-1].type==="path"||"termType"in m[g-1])throw new Error("Received only path in full SPARQL mode");if(m[g-1].type==="update"){let ft={};for(let Et of m[g-1].updates)if(Et.updateType==="insert"){let Je={};for(let st of Et.insert)if(st.type==="bgp"||st.type==="graph")for(let Kr of st.triples)Kr.subject.termType==="BlankNode"&&(Je[Kr.subject.value]=!0),Kr.predicate.termType==="BlankNode"&&(Je[Kr.predicate.value]=!0),Kr.object.termType==="BlankNode"&&(Je[Kr.object.value]=!0);for(let st of Object.keys(Je)){if(ft[st])throw new Error("Detected reuse blank node across different INSERT DATA clauses");ft[st]=!0}}}return m[g-1];case 2:this.$={...m[g-1],...m[g],type:"query"};break;case 4:Re.base=kc(m[g]);break;case 5:Re.prefixes||(Re.prefixes={}),m[g-1]=m[g-1].substr(0,m[g-1].length-1),m[g]=kc(m[g]),Re.prefixes[m[g-1]]=m[g];break;case 6:this.$={...m[g-3],...ta(m[g-2]),...m[g-1],...m[g]};break;case 7:if(!Re.skipValidation&&(Kp(m[g-3].variables.map(Et=>Yp(Et.expression))).some(Et=>Et.aggregation==="count"&&!(Et.expression instanceof Fu))||m[g].group)){for(let Et of m[g-3].variables)if(Et.termType==="Variable"){if(!m[g].group||!m[g].group.map(Je=>Ja(Je)).includes(Ja(Et)))throw Error("Projection of ungrouped variable (?"+Ja(Et)+")")}else if(Yp(Et.expression).length===0){let Je=UI(Et.expression);for(let st of Je)if(!m[g].group||!m[g].group.map||!m[g].group.map(Kr=>Ja(Kr)).includes(Ja(st)))throw Error("Use of ungrouped variable in projection of operation (?"+Ja(st)+")")}}let wi=m[g-1].where.filter(ft=>ft.type==="query");if(wi.length>0){let ft=m[g-3].variables.filter(Je=>Je.variable&&Je.variable.value).map(Je=>Je.variable.value),Et=Kp(wi.map(Je=>Je.variables)).map(Je=>Je.value||Je.variable.value);for(let Je of ft)if(Et.indexOf(Je)>=0)throw Error("Target id of 'AS' (?"+Je+") already used in subquery")}this.$=It(m[g-3],ta(m[g-2]),m[g-1],m[g]);break;case 8:this.$=It({queryType:"CONSTRUCT",template:m[g-3]},ta(m[g-2]),m[g-1],m[g]);break;case 9:this.$=It({queryType:"CONSTRUCT",template:m[g-2]=m[g-2]?m[g-2].triples:[]},ta(m[g-5]),{where:[{type:"bgp",triples:ea([],m[g-2])}]},m[g]);break;case 10:this.$=It({queryType:"DESCRIBE",variables:m[g-3]==="*"?[new Fu]:m[g-3]},ta(m[g-2]),m[g-1],m[g]);break;case 11:this.$=It({queryType:"ASK"},ta(m[g-2]),m[g-1],m[g]);break;case 12:this.$=It(m[g-1],{variables:[new Fu]});break;case 13:let Vc=m[g].map(ft=>ft.value||ft.variable.value),Za=BI(Vc);if(Za.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Za[0]+")");this.$=It(m[g-1],{variables:m[g]});break;case 14:this.$=It({queryType:"SELECT"},m[g]&&(m[g-1]=Dr(m[g]),m[g]={},m[g][m[g-1]]=!0,m[g]));break;case 16:case 27:this.$=Ya(m[g-3],{variable:m[g-1]});break;case 17:case 18:this.$=It(m[g-3],m[g-2],m[g-1],m[g],{type:"query"});break;case 19:case 58:this.$={iri:m[g],named:!!m[g-1]};break;case 20:this.$={where:m[g].patterns};break;case 21:this.$=It(m[g-1],m[g]);break;case 22:this.$=It(m[g-2],m[g-1],m[g]);break;case 23:this.$={group:m[g]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=Ya(m[g]);break;case 26:this.$=Ya(m[g-1]);break;case 29:this.$={having:m[g]};break;case 30:this.$={order:m[g]};break;case 32:this.$=Ya(m[g],{descending:!0});break;case 35:this.$={limit:Xa(m[g])};break;case 36:this.$={offset:Xa(m[g])};break;case 37:this.$={limit:Xa(m[g-2]),offset:Xa(m[g])};break;case 38:this.$={limit:Xa(m[g]),offset:Xa(m[g-2])};break;case 39:case 43:this.$={type:"values",values:m[g]};break;case 40:case 84:this.$=m[g-1].map(ft=>({[m[g-3]]:ft}));break;case 41:case 85:this.$=m[g-1].map(()=>({}));break;case 42:case 86:var _i=m[g-4].length;m[g-4]=m[g-4].map(qp),this.$=m[g-1].map(function(ft){if(ft.length!==_i)throw Error("Inconsistent VALUES length");for(var Et={},Je=0;Je<_i;Je++)Et["?"+m[g-4][Je].value]=ft[Je];return Et});break;case 44:case 65:case 100:case 126:case 175:this.$=m[g-1];break;case 45:this.$={type:"update",updates:Gi(m[g-2],m[g-1])};break;case 46:this.$=It({type:"load",silent:!!m[g-2],source:m[g-1]},m[g]&&{destination:m[g]});break;case 47:this.$={type:Dr(m[g-2]),silent:!!m[g-1],graph:m[g]};break;case 48:this.$={type:Dr(m[g-4]),silent:!!m[g-3],source:m[g-2],destination:m[g]};break;case 49:this.$={type:"create",silent:!!m[g-2],graph:{type:"graph",name:m[g]}};break;case 50:this.$={updateType:"insert",insert:C_(m[g])};break;case 51:this.$={updateType:"delete",delete:Zp(C_(m[g]))};break;case 52:this.$={updateType:"deletewhere",delete:Zp(m[g])};break;case 53:this.$={updateType:"insertdelete",...m[g-4],...m[g-3],...ta(m[g-2],"using"),where:m[g].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=m[g];break;case 55:this.$={delete:Zp(m[g-1]),insert:m[g]||[]};break;case 56:this.$={delete:[],insert:m[g]};break;case 59:this.$={graph:m[g]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:m[g]};break;case 64:this.$={[Dr(m[g])]:!0};break;case 66:this.$=m[g-1]?yi(m[g],[m[g-1]]):yi(m[g]);break;case 67:var jc=It(m[g-3]||{triples:[]},{type:"graph",name:m[g-5]});this.$=m[g]?[jc,m[g]]:[jc];break;case 68:case 73:this.$={type:"bgp",triples:yi(m[g-2],[m[g-1]])};break;case 69:this.$={type:"group",patterns:[m[g-1]]};break;case 70:for(let ft of m[g-1].filter(Et=>Et.type==="bind")){let Et=m[g-1].indexOf(ft),Je=new Set;for(let st of m[g-1].slice(0,Et))(st.type==="group"||st.type==="bgp")&&x_(st).forEach(Kr=>Je.add(Kr));if(Je.has(ft.variable.value))throw Error("Variable used to bind is already bound (?"+ft.variable.value+")")}this.$={type:"group",patterns:m[g-1]};break;case 71:this.$=m[g-1]?yi([m[g-1]],m[g]):yi(m[g]);break;case 72:this.$=m[g]?[m[g-2],m[g]]:m[g-2];break;case 75:this.$=It(m[g],{type:"optional"});break;case 76:this.$=It(m[g],{type:"minus"});break;case 77:this.$=It(m[g],{type:"graph",name:m[g-1]});break;case 78:this.$=It(m[g],{type:"service",name:m[g-1],silent:!!m[g-2]});break;case 79:this.$={type:"filter",expression:m[g]};break;case 80:this.$={type:"bind",variable:m[g-1],expression:m[g-3]};break;case 89:this.$=Mc(m[g]);break;case 90:this.$=void 0;break;case 91:this.$=m[g-1].length?{type:"union",patterns:yi(m[g-1].map(Gp),[Gp(m[g])])}:m[g];break;case 95:this.$={...m[g],function:m[g-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Gi(m[g-2],m[g-1]),distinct:!!m[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.$=Gi(m[g-2],m[g-1]);break;case 101:this.$=yi(m[g-2],[m[g-1]]);break;case 102:case 112:this.$=Jp(m[g].map(ft=>It(Hi(m[g-1]),ft)));break;case 103:this.$=Jp(ea(m[g].map(ft=>It(Hi(m[g-1].entity),ft)),m[g-1].triples));break;case 105:this.$=yi([m[g-1]],m[g]);break;case 106:this.$=yi(m[g]);break;case 107:this.$=Qp(m[g-1],m[g]);break;case 109:case 237:this.$=Re.factory.namedNode(PI);break;case 110:case 118:this.$=Gi(m[g-1],m[g]);break;case 111:this.$=m[g]?{annotation:m[g],object:m[g-1]}:m[g-1];break;case 113:this.$=m[g]?Jp(ea(m[g].map(ft=>It(Hi(m[g-1].entity),ft)),m[g-1].triples)):m[g-1].triples;break;case 114:this.$=Qp(...m[g-1],m[g]);break;case 116:this.$=Qp(...m[g]);break;case 117:case 159:case 163:this.$=[m[g-1],m[g]];break;case 119:this.$=m[g]?{object:m[g-1],annotation:m[g]}:m[g-1];break;case 120:this.$=m[g-1].length?Ka("|",Gi(m[g-1],m[g])):m[g];break;case 121:this.$=m[g-1].length?Ka("/",Gi(m[g-1],m[g])):m[g];break;case 122:this.$=m[g]?Ka(m[g],[m[g-1]]):m[g-1];break;case 123:this.$=m[g-1]?Ka(m[g-1],[m[g]]):m[g];break;case 125:case 131:this.$=Ka(m[g-1],[m[g]]);break;case 129:this.$=Ka("|",Gi(m[g-2],m[g-1]));break;case 132:case 134:this.$=$I(m[g-1]);break;case 133:case 135:this.$=VI(m[g-1]);break;case 140:this.$={entity:m[g],triples:[]};break;case 145:this.$=qp(m[g]);break;case 149:this.$=Re.factory.namedNode(y_);break;case 151:case 153:case 158:case 162:this.$=Wp(m[g-1],m[g]);break;case 152:this.$=["||",m[g]];break;case 154:this.$=["&&",m[g]];break;case 156:this.$=ir(m[g-1],[m[g-2],m[g]]);break;case 157:this.$=ir(m[g-2]?"notin":"in",[m[g-3],m[g]]);break;case 160:this.$=["+",Wp(m[g-1],m[g])];break;case 161:var ku=vi(m[g-1].value.replace("-",""),m[g-1].datatype);this.$=["-",Wp(ku,m[g])];break;case 164:this.$=ir("UPLUS",[m[g]]);break;case 165:this.$=ir(m[g-1],[m[g]]);break;case 166:this.$=ir("UMINUS",[m[g]]);break;case 177:this.$=ir(Dr(m[g-1]));break;case 178:this.$=ir(Dr(m[g-3]),[m[g-1]]);break;case 179:this.$=Mc(ir(Dr(m[g-3]),[m[g-1]]));break;case 180:this.$=ir(Dr(m[g-5]),[m[g-3],m[g-1]]);break;case 181:this.$=ir(Dr(m[g-7]),[m[g-5],m[g-3],m[g-1]]);break;case 182:this.$=Mc(ir(Dr(m[g-7]),[m[g-5],m[g-3],m[g-1]]));break;case 183:this.$=ir(Dr(m[g-1]),m[g]);break;case 184:this.$=ir("bound",[qp(m[g-1])]);break;case 185:this.$=ir(m[g-1],[]);break;case 186:this.$=ir(m[g-3],[m[g-1]]);break;case 187:this.$=ir(m[g-2]?"notexists":"exists",[Gp(m[g])]);break;case 188:case 189:this.$=Ya(m[g-1],{type:"aggregate",aggregation:Dr(m[g-4]),distinct:!!m[g-2]});break;case 190:this.$=Ya(m[g-2],{type:"aggregate",aggregation:Dr(m[g-5]),distinct:!!m[g-3],separator:typeof m[g-1]=="string"?m[g-1]:" "});break;case 192:this.$=vi(m[g]);break;case 193:this.$=kI(m[g-1],Dr(m[g].substr(1)));break;case 194:this.$=vi(m[g-2],m[g]);break;case 195:case 204:this.$=vi(m[g],v_);break;case 196:case 205:this.$=vi(m[g],__);break;case 197:case 206:this.$=vi(Dr(m[g]),w_);break;case 200:this.$=vi(m[g].toLowerCase(),NI);break;case 201:this.$=vi(m[g].substr(1),v_);break;case 202:this.$=vi(m[g].substr(1),__);break;case 203:this.$=vi(m[g].substr(1).toLowerCase(),w_);break;case 207:case 208:this.$=T_(m[g],1);break;case 209:case 210:this.$=T_(m[g],3);break;case 211:this.$=Re.factory.namedNode(kc(m[g]));break;case 213:var Lu=m[g].indexOf(":"),$c=m[g].substr(0,Lu),Mu=Re.prefixes[$c];if(!Mu)throw new Error("Unknown prefix: "+$c);var xt=kc(Mu+m[g].substr(Lu+1));this.$=Re.factory.namedNode(xt);break;case 214:if(m[g]=m[g].substr(0,m[g].length-1),!(m[g]in Re.prefixes))throw new Error("Unknown prefix: "+m[g]);var xt=kc(Re.prefixes[m[g]]);this.$=Re.factory.namedNode(xt);break;case 215:this.$=Lc(m[g].replace(/^(_:)/,""));break;case 216:this.$=Lc();break;case 217:case 218:case 232:this.$=Mc(Hp(m[g-3],m[g-2],m[g-1]));break;case 230:case 231:this.$=Mc(m[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:m[g-1].push(m[g]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[m[g]];break;case 308:m[g-3].push(m[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:m[g-2].push(m[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:h,33:35,39:[1,37],44:39,55:40,87:d,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:w,87:d},n(T,[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(S,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:x,29:F,52:84,53:Q,56:85},{19:88,28:x,29:F,52:89,53:Q,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:Q},n(K,[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:h,87:d,308:p}),n(Te,[2,262]),n(H,[2,259]),n(J,[2,143]),n(J,[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(L,[2,211]),n(L,[2,212]),n(L,[2,213]),n(L,[2,214]),{19:98,28:x,29:F,52:99,53:Q,56:85},{6:[2,309],99:100,193:[1,101]},n($,[2,311],{101:102,328:[1,103]}),n(Z,[2,317],{104:104,328:[1,105]}),n(qe,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:et,114:110},{29:et,114:112},{29:et,114:113},{118:114,123:[1,115],125:116,126:wt},n(tt,[2,315]),n(tt,[2,316]),n(nt,[2,319]),n(nt,[2,320]),n(nt,[2,321]),n(y,[2,327]),{13:f,16:h,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:w,87:d}),n(We,[2,269]),n(We,[2,15]),{13:f,16:h,44:136,45:re,46:120,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(T,[2,14]),n(T,[2,274]),n(T,[2,271]),n(T,[2,272]),n(e,[2,4]),{13:[1,177]},n(Y,[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:h,45:[1,193],55:194,197:ut,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(S,[2,419]),n(vt,Ie,{20:196,59:197,69:198,70:B}),n(l,[2,250]),{29:q,57:200},n($,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(G,z,{23:204,58:205,62:206,63:Ee}),n(l,[2,252]),{19:208,28:x,29:F,52:209,53:Q,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:h,44:215,45:Ke,55:220,82:U,87:d,89:Xe,145:212,172:221,185:213,187:214,231:rr,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Uv,[2,265],{56:85,35:227,52:228,19:229,28:x,29:F,53:Q}),n(H,[2,260]),n(G,z,{58:205,62:206,23:230,63:Ee}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:h,55:232,307:43,308:p},n($,[2,312]),{105:233,112:Bv,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(Z,[2,318]),n($,qv,{108:240,133:242,112:Wv,132:Gv}),n(qe,[2,323]),{112:[1,244]},{112:[2,325]},n(nr,[2,50]),n(K,vu,{135:245,136:246,143:247,144:248,31:Hv,112:Hv}),n(nr,[2,51]),n(nr,[2,52]),n(gs,[2,328],{119:249}),{29:et,114:250},n(gs,[2,56]),{29:et,114:251},n(y,[2,59]),n(We,[2,270]),{47:[1,252]},n(zv,[2,150]),n(_u,[2,428],{240:253}),n(Wa,[2,430],{244:254}),n(Wa,[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(Ga,[2,440],{252:264}),n(Gt,[2,448],{260:265}),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,255:154,257:155,264:266,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,255:154,257:155,264:267,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,255:154,257:155,264:268,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Gt,[2,167]),n(Gt,[2,168]),n(Gt,[2,169]),n(Gt,[2,170],{176:269,45:Qv,89:Yv}),n(Gt,[2,171]),n(Gt,[2,172]),n(Gt,[2,173]),n(Gt,[2,174]),{13:f,16:h,44:136,45:re,46:272,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Dt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:Kv,89:Xv,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(Fr,[2,192],{292:[1,286],293:[1,287]}),n(Fr,[2,195]),n(Fr,[2,196]),n(Fr,[2,197]),n(Fr,[2,198]),n(Fr,[2,199]),n(Fr,[2,200]),{13:f,16:h,44:39,55:40,82:U,87:d,139:289,172:291,255:154,257:155,266:290,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(Pc,[2,452]),n(Pc,[2,453]),n(Pc,[2,454]),n(Pc,[2,455]),n(Pc,[2,456]),{279:[2,458]},n(wu,[2,207]),n(wu,[2,208]),n(wu,[2,209]),n(wu,[2,210]),n(Fr,[2,201]),n(Fr,[2,202]),n(Fr,[2,203]),n(Fr,[2,204]),n(Fr,[2,205]),n(Fr,[2,206]),n(e,[2,5]),n(bu,[2,297],{88:295}),n(Su,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(Eu,[2,301]),n(Y,[2,43]),n(Y,[2,82]),n(Y,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(zs,[2,123]),n(zs,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(gi,[2,124]),{13:f,16:h,45:[1,311],55:194,89:[1,310],197:ut,223:312,225:308,226:309,229:Jv,307:43,308:p},n(c,i,{215:10,214:314}),n(gi,[2,236]),n(gi,[2,237]),n(Ha,[2,6]),n(kp,[2,287],{60:315,72:316,73:[1,317]}),n(vt,[2,286]),{13:f,16:h,45:re,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,307:43,308:p,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n([6,31,63,70,73,81,83,85],[2,20]),n(K,Zv,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Vi,31:Vi,85:Vi,112:Vi,159:Vi,160:Vi,161:Vi,163:Vi,164:Vi,41:s}),{13:f,16:h,55:331,307:43,308:p},n($,[2,280]),n(Ha,[2,7]),n(vt,Ie,{59:197,69:198,20:332,70:B}),n(G,[2,284]),{64:[1,333]},n(G,z,{58:205,62:206,23:334,63:Ee}),n(l,[2,254]),n(K,vu,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:h,44:39,55:40,87:d,139:342,186:339,190:340,195:341,197:Qs,307:43,308:p},n(Fc,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:h,87:d,197:Qs,308:p}),n(Ui,[2,227]),n(Ui,[2,228]),n(Ui,[2,229]),{13:f,16:h,44:215,45:Ke,55:220,82:U,87:d,89:Xe,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:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},{13:f,16:h,44:39,55:40,87:d,139:342,186:352,190:340,195:341,197:Qs,307:43,308:p},n(Ui,[2,146]),n(Ui,[2,147]),n(Ui,[2,148]),n(Ui,[2,149]),{13:f,16:h,44:354,55:355,82:U,87:d,172:357,237:356,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:358,312:Pr,313:353},n(Lp,[2,215]),n(Lp,[2,216]),n(G,z,{58:205,62:206,23:359,63:Ee}),n(Te,[2,264]),n(Uv,[2,266]),n(Ha,[2,11]),n(r,[2,308],{6:[2,310]}),n(nr,[2,313],{102:360,120:361,121:[1,362]}),n(nr,[2,47]),n(nr,[2,63]),n(nr,[2,64]),{13:f,16:h,55:363,307:43,308:p},n(nr,[2,336]),n(nr,[2,337]),n(nr,[2,338]),{109:[1,364]},n(e_,[2,60]),{13:f,16:h,55:365,307:43,308:p},n($,[2,335]),{13:f,16:h,55:366,307:43,308:p},{31:[1,367]},n(Ys,[2,341],{137:368}),n(Ys,[2,340]),{13:f,16:h,44:215,45:Ke,55:220,82:U,87:d,89:Xe,145:369,172:221,185:213,187:214,231:rr,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},{28:[1,370],127:371,128:[1,372]},n(gs,[2,330],{124:373,125:374,126:wt}),n(gs,[2,57]),{44:375,87:d},n(zv,[2,151],{241:376,242:[1,377]}),n(_u,[2,153],{245:378,246:[1,379]}),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,247:380,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{250:[1,381]},n(Nt,[2,432]),n(Nt,[2,433]),n(Nt,[2,434]),n(Nt,[2,435]),n(Nt,[2,436]),n(Nt,[2,437]),{250:[2,439]},n([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:ue,298:fe,299:he,300:oe,301:me,302:ge}),n(Ga,[2,162],{261:388,262:389,39:Mp,338:jp}),n(Gt,[2,164]),n(Gt,[2,165]),n(Gt,[2,166]),n(Dt,[2,95]),n(Dt,[2,96]),n(Nt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Dt,[2,177]),{13:f,16:h,44:136,45:re,46:395,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,46:396,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,46:397,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,46:398,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,46:399,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Dt,[2,183]),n(Dt,[2,98]),n(Nt,[2,381],{180:400}),{87:[1,401]},n(Dt,[2,185]),{13:f,16:h,44:136,45:re,46:402,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{29:q,57:403},n(Fr,[2,193]),{13:f,16:h,55:404,307:43,308:p},{13:f,16:h,44:39,55:40,87:d,139:342,195:405,197:Qs,307:43,308:p},n(ys,[2,233]),n(ys,[2,234]),n(ys,[2,235]),n(t_,[2,459],{281:406,325:[1,407]}),n(Nt,[2,463],{284:408,325:[1,409]}),n(Nt,[2,465],{286:410,325:[1,411]}),{13:f,16:h,31:[1,412],55:414,82:U,171:413,172:415,173:416,174:Tu,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:xu},{31:[1,419],89:[1,420]},{29:[1,421]},n(Eu,[2,302]),n(bu,[2,367],{167:422}),n(Su,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(Eu,[2,371]),n(zs,[2,122]),n(zs,[2,417]),n(zs,[2,413]),n(zs,[2,414]),n(zs,[2,415]),n(gi,[2,125]),n(gi,[2,127]),n(gi,[2,128]),n(r_,[2,420],{227:426}),n(gi,[2,130]),{13:f,16:h,55:194,197:ut,223:427,307:43,308:p},{48:[1,428]},n(vs,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(kp,[2,288]),{64:[1,433]},n(vt,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:h,45:re,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,276:je,277:we,279:De,280:Ae,283:Ne,285:$e,308:p,346:Ve,347:Pe,348:b,349:E,350:A,351:R}),n(n_,[2,293]),n($p,[2,92]),n($p,[2,93]),n($p,[2,94]),{45:Qv,89:Yv,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:x,29:F,56:85},{19:438,28:x,29:F,56:85},n(Ks,[2,355],{149:439}),n(Ks,[2,354]),{13:f,16:h,44:215,45:Au,55:220,82:U,87:d,89:Xe,156:440,172:221,185:441,203:442,231:Cu,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Te,[2,19]),n(vs,[2,21]),{13:f,16:h,44:450,45:i_,55:323,65:445,66:446,67:447,68:448,87:d,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,307:43,308:p,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Ha,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(K,[2,386],{31:[2,388]}),n(Fc,[2,102]),n(Xs,[2,391],{191:452}),n(K,[2,395],{196:453,198:454}),n(K,[2,108]),n(K,[2,109]),n(Fc,[2,103]),n(Fc,[2,104]),n(Fc,[2,390]),{13:f,16:h,44:215,45:Ke,48:[1,455],55:220,82:U,87:d,89:Xe,172:221,185:351,187:350,200:456,231:rr,234:349,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Iu,[2,424]),n(s_,[2,136]),n(s_,[2,137]),n(Vp,[2,140]),{232:[1,457]},{13:f,16:h,44:39,55:40,87:d,139:342,195:458,197:Qs,307:43,308:p},n(ys,[2,219]),n(ys,[2,220]),n(ys,[2,221]),n(ys,[2,222]),n(ys,[2,223]),n(Ha,[2,10]),n(nr,[2,46]),n(nr,[2,314]),{112:Bv,122:459},n(nr,[2,62]),n($,qv,{133:242,108:460,112:Wv,132:Gv}),n(e_,[2,61]),n(nr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Ys,[2,351],{146:463,335:[1,464]}),{29:q,57:465},n(gs,[2,329]),n($,[2,332],{129:466,327:[1,467]}),n(gs,[2,55]),n(gs,[2,331]),{48:[1,468]},n(_u,[2,429]),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Wa,[2,431]),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,243:470,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Wa,[2,156]),{45:Kv,89:Xv,179:471},n(Ga,[2,441]),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,251:472,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Gt,[2,444],{256:473}),n(Gt,[2,446],{258:474}),n(Nt,[2,442]),n(Nt,[2,443]),n(Gt,[2,449]),{13:f,16:h,44:136,45:re,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,255:154,257:155,259:475,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Nt,[2,450]),n(Nt,[2,451]),n(Nt,[2,379],{178:476}),n(Nt,[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:h,44:136,45:re,46:482,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{48:[1,483]},{48:[1,484]},n(Dt,[2,187]),n(Fr,[2,194]),{13:f,16:h,44:39,55:40,82:U,87:d,139:289,172:291,255:154,257:155,266:290,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,320:485},{13:f,16:h,39:[1,487],44:136,45:re,46:488,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,282:486,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(t_,[2,460]),{13:f,16:h,44:136,45:re,46:489,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Nt,[2,464]),{13:f,16:h,44:136,45:re,46:490,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Nt,[2,466]),n(Y,[2,40]),n(bu,[2,298]),n(Dc,[2,87]),n(Dc,[2,88]),n(Dc,[2,89]),n(Dc,[2,90]),{13:f,16:h,55:492,82:U,172:493,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,311:494,312:Pr,315:491},n(Y,[2,41]),n(Su,[2,300]),n(Nc,[2,303],{92:495}),{13:f,16:h,31:[1,496],55:414,82:U,171:497,172:415,173:416,174:Tu,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:xu},{31:[1,498],89:[1,499]},{29:[1,500]},n(Eu,[2,372]),{13:f,16:h,48:[2,422],55:194,197:ut,223:312,226:502,228:501,229:Jv,307:43,308:p},n(gi,[2,131]),n(gi,[2,126]),n(vs,[2,22]),n(vs,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:h,44:510,45:re,55:323,67:321,68:322,74:505,75:506,76:a_,77:320,78:o_,79:509,87:d,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,307:43,308:p,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(n_,[2,294]),n(c_,[2,69]),n(c_,[2,70]),n(vt,Ie,{59:197,69:198,20:511,70:B}),n(G,z,{58:205,62:206,23:512,63:Ee}),{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(Ks,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:d}),n(Ou,[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:d}),{13:f,16:h,44:215,45:Au,55:220,82:U,87:d,89:Xe,172:221,185:351,203:536,212:534,231:Cu,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:d}),n(G,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:h,45:i_,87:d,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,276:je,277:we,279:De,280:Ae,283:Ne,285:$e,308:p,346:Ve,347:Pe,348:b,349:E,350:A,351:R}),n(Js,[2,291]),n(Js,[2,24]),n(Js,[2,25]),{13:f,16:h,44:136,45:re,46:539,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Js,[2,28]),n(G,z,{58:205,62:206,23:540,63:Ee}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(Xs,[2,107]),{13:f,16:h,44:215,45:Ke,55:220,82:U,87:d,89:Xe,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:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(l_,[2,132]),n(Iu,[2,425]),n(l_,[2,133]),{13:f,16:h,44:354,55:355,82:U,87:d,172:357,237:356,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:358,312:Pr,313:545},n(nr,[2,54]),n(nr,[2,48]),n(Ys,[2,342]),{13:f,16:h,44:39,55:40,87:d,139:546,307:43,308:p},n(Ys,[2,68]),n(K,[2,350],{31:u_,112:u_}),n(nr,[2,53]),{13:f,16:h,55:547,307:43,308:p},n($,[2,333]),n(We,[2,16]),n(_u,[2,152]),n(Wa,[2,154]),n(Wa,[2,157]),n(Ga,[2,159]),n(Ga,[2,160],{262:389,261:548,39:Mp,338:jp}),n(Ga,[2,161],{262:389,261:549,39:Mp,338:jp}),n(Gt,[2,163]),{13:f,16:h,44:136,45:re,46:550,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Dt,[2,178]),n(Dt,[2,179]),{13:f,16:h,44:136,45:re,46:551,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,46:552,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,46:553,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{48:[1,554],272:[1,555]},n(Dt,[2,184]),n(Dt,[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:h,55:194,197:ut,223:562,307:43,308:p},n(Up,[2,224]),n(Up,[2,225]),n(Up,[2,226]),{31:[1,563],45:f_,94:564},n(Y,[2,84]),n(bu,[2,368]),n(Y,[2,85]),n(Su,[2,370]),n(Nc,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(vs,[2,35],{83:[1,569]}),n(vs,[2,36],{81:[1,570]}),n(kp,[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:h,45:re,76:a_,78:o_,87:d,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,276:je,277:we,279:De,280:Ae,283:Ne,285:$e,308:p,346:Ve,347:Pe,348:b,349:E,350:A,351:R}),n(za,[2,295]),{45:re,77:572},{45:re,77:573},n(za,[2,33]),n(za,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(Ks,[2,356]),n(h_,[2,357],{152:578,335:[1,579]}),n(Bi,[2,74]),{29:q,57:580},{29:q,57:581},{13:f,16:h,44:39,55:40,87:d,139:582,307:43,308:p},n(d_,[2,365],{162:583,328:[1,584]}),{13:f,16:h,45:re,55:323,67:321,68:322,77:320,79:585,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,307:43,308:p,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{45:[1,586]},n(Bi,[2,81]),{29:q,57:587},n(Ks,[2,73]),n(K,[2,362],{29:qi,31:qi,85:qi,112:qi,159:qi,160:qi,161:qi,163:qi,164:qi}),n(Ou,[2,112]),n(Qa,[2,401],{206:588}),n(K,[2,405],{209:589,210:590}),n(K,[2,403]),n(K,[2,404]),n(Ou,[2,113]),n(Ou,[2,400]),{13:f,16:h,44:215,45:Au,48:[1,591],55:220,82:U,87:d,89:Xe,172:221,185:351,203:536,212:592,231:Cu,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Iu,[2,426]),n(Vp,[2,138]),n(Vp,[2,139]),{232:[1,593]},n(Js,[2,292]),{47:[1,595],48:[1,594]},n(Ha,[2,9]),n(Xs,[2,392]),n(Xs,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:h,87:d,197:Qs,308:p}),n(Xs,[2,110],{272:[1,598]}),n(Ru,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(gs,[2,58]),n(Gt,[2,445]),n(Gt,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Dt,[2,99]),n(Nt,[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(Dt,[2,188]),n(Dt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:h,55:492,82:U,172:493,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,311:494,312:Pr,315:611},n(Y,[2,42]),n(Nc,[2,304]),{13:f,16:h,55:414,82:U,95:612,171:613,172:415,173:416,174:Tu,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:xu},{31:[1,614],45:f_,94:615},n(gi,[2,129]),n(r_,[2,421]),{82:[1,616]},{82:[1,617]},n(za,[2,296]),n(za,[2,31]),n(za,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(K,Zv,{155:330,153:618,154:619,29:Wi,31:Wi,85:Wi,112:Wi,159:Wi,160:Wi,161:Wi,163:Wi,164:Wi}),n(h_,[2,358]),n(Bi,[2,75]),n(Bi,[2,76]),{29:q,57:620},{13:f,16:h,44:39,55:40,87:d,139:621,307:43,308:p},n(d_,[2,366]),n(Bi,[2,79]),{13:f,16:h,44:136,45:re,46:622,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Bi,[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(Qa,[2,117]),{13:f,16:h,44:215,45:Au,55:220,82:U,87:d,89:Xe,172:221,185:351,203:536,211:626,212:627,231:Cu,234:535,236:216,237:222,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,309:Yr,310:on,311:217,312:Pr},n(Ui,[2,134]),n(Iu,[2,427]),n(Ui,[2,135]),n(Js,[2,26]),{44:628,87:d},n(Xs,[2,106]),n(Xs,[2,394]),n(K,[2,396]),n(Ru,[2,111]),n(Ru,[2,398]),{13:f,16:h,44:39,55:40,87:d,139:342,186:629,190:340,195:341,197:Qs,307:43,308:p},n(Lp,[2,217]),n(K,vu,{144:248,140:630,143:631,31:[2,343]}),n(Dt,[2,97]),n(Nt,[2,380]),n(Dt,[2,180]),{13:f,16:h,44:136,45:re,46:632,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},{13:f,16:h,44:136,45:re,46:633,55:133,67:132,68:134,77:131,82:U,87:d,172:135,224:it,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ct,264:130,265:W,266:137,267:139,268:xe,269:ke,270:ee,271:Le,273:Me,274:Fe,275:146,276:je,277:we,278:149,279:De,280:Ae,283:Ne,285:$e,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:Ye,346:Ve,347:Pe,348:b,349:E,350:A,351:R},n(Dt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:h,48:[1,636],55:414,82:U,171:637,172:415,173:416,174:Tu,255:154,257:155,291:150,294:le,295:de,296:pe,297:ue,298:fe,299:he,300:oe,301:me,302:ge,303:ye,304:ve,305:ie,306:_e,307:43,308:p,312:xu},n(p_,[2,305]),n(Y,[2,86]),n(Nc,[2,374]),n(vs,[2,37]),n(vs,[2,38]),n(Ks,[2,72]),n(Ks,[2,360]),n(Bi,[2,77]),{29:q,57:638},{47:[1,639]},{29:[2,376]},n(Qa,[2,402]),n(Qa,[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:d}),n(Qa,[2,118],{272:[1,641]}),n(Pu,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:ye,304:ve,305:ie,306:_e},n(Dc,[2,218]),n(Nc,[2,44]),n(p_,[2,306]),n(Bi,[2,78]),{44:651,87:d},n(Qa,[2,116]),n(K,[2,406]),n(Pu,[2,119]),n(Pu,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:d}),n(Js,[2,27]),n(Ru,[2,230]),n(m_,[2,345],{141:653,335:[1,654]}),n(Dt,[2,181]),n(Dt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(K,vu,{144:248,142:657,143:658,31:g_,112:g_}),n(m_,[2,346]),n(Bi,[2,80]),n(Pu,[2,231]),n(Ys,[2,67]),n(Ys,[2,348])],defaultActions:{5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]},parseError:o(function(C,O){if(O.recoverable)this.trace(C);else{var D=new Error(C);throw D.hash=O,D}},"parseError"),parse:o(function(C){var O=this,D=[0],te=[],Ce=[null],m=[],Nr=this.table,g="",_i=0,jc=0,ku=0,Lu=2,$c=1,Mu=m.slice.call(arguments,1),xt=Object.create(this.lexer),wi={yy:{}};for(var Vc in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Vc)&&(wi.yy[Vc]=this.yy[Vc]);xt.setInput(C,wi.yy),wi.yy.lexer=xt,wi.yy.parser=this,typeof xt.yylloc>"u"&&(xt.yylloc={});var Za=xt.yylloc;m.push(Za);var ft=xt.options&&xt.options.ranges;typeof wi.yy.parseError=="function"?this.parseError=wi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Et(bi){D.length=D.length-2*bi,Ce.length=Ce.length-bi,m.length=m.length-bi}o(Et,"popStack");for(var Je=o(function(){var bi;return bi=xt.lex()||$c,typeof bi!="number"&&(bi=O.symbols_[bi]||bi),bi},"lex"),st,Kr,ra,gn,rB,em,eo={},ju,zi,I_,$u;;){if(ra=D[D.length-1],this.defaultActions[ra]?gn=this.defaultActions[ra]:((st===null||typeof st>"u")&&(st=Je()),gn=Nr[ra]&&Nr[ra][st]),typeof gn>"u"||!gn.length||!gn[0]){var tm="";$u=[];for(ju in Nr[ra])this.terminals_[ju]&&ju>Lu&&$u.push("'"+this.terminals_[ju]+"'");xt.showPosition?tm="Parse error on line "+(_i+1)+`:
|
|
267
267
|
`+xt.showPosition()+`
|
|
268
268
|
Expecting `+$u.join(", ")+", got '"+(this.terminals_[st]||st)+"'":tm="Parse error on line "+(_i+1)+": Unexpected "+(st==$c?"end of input":"'"+(this.terminals_[st]||st)+"'"),this.parseError(tm,{text:xt.match,token:this.terminals_[st]||st,line:xt.yylineno,loc:Za,expected:$u})}if(gn[0]instanceof Array&&gn.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ra+", token: "+st);switch(gn[0]){case 1:D.push(st),Ce.push(xt.yytext),m.push(xt.yylloc),D.push(gn[1]),st=null,Kr?(st=Kr,Kr=null):(jc=xt.yyleng,g=xt.yytext,_i=xt.yylineno,Za=xt.yylloc,ku>0&&ku--);break;case 2:if(zi=this.productions_[gn[1]][1],eo.$=Ce[Ce.length-zi],eo._$={first_line:m[m.length-(zi||1)].first_line,last_line:m[m.length-1].last_line,first_column:m[m.length-(zi||1)].first_column,last_column:m[m.length-1].last_column},ft&&(eo._$.range=[m[m.length-(zi||1)].range[0],m[m.length-1].range[1]]),em=this.performAction.apply(eo,[g,jc,_i,wi.yy,gn[1],Ce,m].concat(Mu)),typeof em<"u")return em;zi&&(D=D.slice(0,-1*zi*2),Ce=Ce.slice(0,-1*zi),m=m.slice(0,-1*zi)),D.push(this.productions_[gn[1]][0]),Ce.push(eo.$),m.push(eo._$),I_=Nr[D[D.length-2]][D[D.length-1]],D.push(I_);break;case 3:return!0}}return!0},"parse")},Fu=Sy().Wildcard,Du="http://www.w3.org/1999/02/22-rdf-syntax-ns#",PI=Du+"type",FI=Du+"first",DI=Du+"rest",y_=Du+"nil",Nu="http://www.w3.org/2001/XMLSchema#",v_=Nu+"integer",__=Nu+"decimal",w_=Nu+"double",NI=Nu+"boolean",Zs="",b_="",S_="";function Dr(I){return I.toLowerCase()}o(Dr,"lowercase");function Gi(I,C){return I.push(C),I}o(Gi,"appendTo");function ea(I,C){return I.push.apply(I,C),I}o(ea,"appendAllTo");function It(I){I||(I={});for(var C=1,O=arguments.length,D;C<O&&(D=arguments[C]||{});C++)for(var te in D)I[te]=D[te];return I}o(It,"extend");function yi(){for(var I=[],C=0,O=arguments.length;C<O;C++)I=I.concat.apply(I,arguments[C]);return I}o(yi,"unionAll");function kc(I){if(I[0]==="<"&&(I=I.substring(1,I.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(I))return I;if(!Re.base)throw new Error("Cannot resolve relative IRI "+I+" because no base IRI was set.");switch(Zs!==Re.base&&(Zs=Re.base,b_=Zs.replace(/[^\/:]*$/,""),S_=Zs.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),I[0]){case void 0:return Zs;case"#":return Zs+I;case"?":return Zs.replace(/(?:\?.*)?$/,I);case"/":return S_+I;default:return b_+I}}o(kc,"resolveIRI");function qp(I){if(I){var C=I[0];if(C==="?"||C==="$")return Re.factory.variable(I.substr(1))}return I}o(qp,"toVar");function ir(I,C){return{type:"operation",operator:I,args:C||[]}}o(ir,"operation");function Ya(I,C){var O={expression:I==="*"?new Fu:I};if(C)for(var D in C)O[D]=C[D];return O}o(Ya,"expression");function Ka(I,C){return{type:"path",pathType:I,items:C}}o(Ka,"path");function Wp(I,C){for(var O=0,D=C.length,te;O<D&&(te=C[O]);O++)I=ir(te[0],[I,te[1]]);return I}o(Wp,"createOperationTree");function ta(I,C){var O=[],D=[],te=I.length,Ce,m={};if(!te)return null;for(var Nr=0;Nr<te&&(Ce=I[Nr]);Nr++)(Ce.named?D:O).push(Ce.iri);return m[C||"from"]={default:O,named:D},m}o(ta,"groupDatasets");function Xa(I){return parseInt(I,10)}o(Xa,"toInt");function Gp(I){return I.type==="group"&&I.patterns.length===1?I.patterns[0]:I}o(Gp,"degroupSingle");function vi(I,C){return C&&C.termType!=="NamedNode"&&(C=Re.factory.namedNode(C)),Re.factory.literal(I,C)}o(vi,"createTypedLiteral");function kI(I,C){return Re.factory.literal(I,C)}o(kI,"createLangLiteral");function Hp(I,C,O){if(!("termType"in C))throw new Error("Nested triples cannot contain paths");return Re.factory.quad(I,C,O)}o(Hp,"nestedTriple");function Hi(I,C,O,D){var te={};return I!=null&&(te.subject=I),C!=null&&(te.predicate=C),O!=null&&(te.object=O),D!=null&&(te.annotations=D),te}o(Hi,"triple");function Lc(I){return typeof I=="string"?I.startsWith("e_")?Re.factory.blankNode(I):Re.factory.blankNode("e_"+I):Re.factory.blankNode("g_"+E_++)}o(Lc,"blank");var E_=0;Re._resetBlanks=function(){E_=0};var LI=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,MI={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
|
|
269
|
-
`,r:"\r",f:"\f"},jI=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,zp=String.fromCharCode;function T_(I,C){I=I.substring(C,I.length-C);try{I=I.replace(LI,function(O,D,te,Ce){var m;if(D){if(m=parseInt(D,16),isNaN(m))throw new Error;return zp(m)}else if(te){if(m=parseInt(te,16),isNaN(m))throw new Error;return m<65535?zp(m):zp(55296+((m-=65536)>>10),56320+(m&1023))}else{var Nr=MI[Ce];if(!Nr)throw new Error;return Nr}})}catch{return""}if(jI.exec(I))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+I);return I}o(T_,"unescapeString");function $I(I){var C=Lc(),O=C,D=[],te,Ce=[];I.forEach(function(_i){D.push(_i.entity),ea(Ce,_i.triples)});for(var m=0,Nr=0,g=D.length,te=Array(g*2);m<g;)te[Nr++]=Hi(O,Re.factory.namedNode(FI),D[m]),te[Nr++]=Hi(O,Re.factory.namedNode(DI),O=++m<g?Lc():Re.factory.namedNode(y_));return{entity:C,triples:ea(te,Ce)}}o($I,"createList");function VI(I){var C=Lc();return{entity:C,triples:I.map(function(O){return It(Hi(C),O)})}}o(VI,"createAnonymousObject");function Qp(I,C,O){var D=[],te=[];return C.forEach(function(Ce){let m=null;Ce.annotation&&(m=Ce.annotation,Ce=Ce.object),D.push(Hi(null,I,Ce.entity,m)),ea(te,Ce.triples)}),yi(D,O||[],te)}o(Qp,"objectListToTriples");function
|
|
269
|
+
`,r:"\r",f:"\f"},jI=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,zp=String.fromCharCode;function T_(I,C){I=I.substring(C,I.length-C);try{I=I.replace(LI,function(O,D,te,Ce){var m;if(D){if(m=parseInt(D,16),isNaN(m))throw new Error;return zp(m)}else if(te){if(m=parseInt(te,16),isNaN(m))throw new Error;return m<65535?zp(m):zp(55296+((m-=65536)>>10),56320+(m&1023))}else{var Nr=MI[Ce];if(!Nr)throw new Error;return Nr}})}catch{return""}if(jI.exec(I))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+I);return I}o(T_,"unescapeString");function $I(I){var C=Lc(),O=C,D=[],te,Ce=[];I.forEach(function(_i){D.push(_i.entity),ea(Ce,_i.triples)});for(var m=0,Nr=0,g=D.length,te=Array(g*2);m<g;)te[Nr++]=Hi(O,Re.factory.namedNode(FI),D[m]),te[Nr++]=Hi(O,Re.factory.namedNode(DI),O=++m<g?Lc():Re.factory.namedNode(y_));return{entity:C,triples:ea(te,Ce)}}o($I,"createList");function VI(I){var C=Lc();return{entity:C,triples:I.map(function(O){return It(Hi(C),O)})}}o(VI,"createAnonymousObject");function Qp(I,C,O){var D=[],te=[];return C.forEach(function(Ce){let m=null;Ce.annotation&&(m=Ce.annotation,Ce=Ce.object),D.push(Hi(null,I,Ce.entity,m)),ea(te,Ce.triples)}),yi(D,O||[],te)}o(Qp,"objectListToTriples");function eB(I){for(var C=[],O,D=0,te;te=I[D];D++)switch(te.type){case"bgp":te.triples.length&&(O?ea(O.triples,te.triples):Gi(C,O=te));break;default:(!te.patterns||te.patterns.length>0)&&(Gi(C,te),O=null)}return C}o(eB,"mergeAdjacentBGPs");function Ja(I){return I.variable?I.variable.value:I.value||I.expression.value}o(Ja,"getExpressionId");function Yp(I){if(!I)return[];if(I.type==="aggregate")return[I];if(I.type==="operation"){let C=[];for(let O of I.args)C.push(...Yp(O));return C}return[]}o(Yp,"getAggregatesOfExpression");function UI(I){let C=new Set,O=o(function(D){D&&(D.termType==="Variable"?C.add(D):D.type==="operation"&&D.args.forEach(O))},"visitExpression");return O(I),C}o(UI,"getVariablesFromExpression");function Kp(I,C=1,O=[]){for(let D of I)C>0&&D instanceof Array?Kp(D,C-1,O):O.push(D);return O}o(Kp,"flatten");function Xp(I){return I.termType==="Variable"}o(Xp,"isVariable");function x_(I){if(I.triples){let C=[];for(let O of I.triples)Xp(O.subject)&&C.push(O.subject.value),Xp(O.predicate)&&C.push(O.predicate.value),Xp(O.object)&&C.push(O.object.value);return C}else if(I.patterns){let C=[];for(let O of I.patterns)C.push(...x_(O));return C}return[]}o(x_,"getBoundVarsFromGroupGraphPattern");function BI(I){let C=I.slice().sort(),O=[];for(let D=0;D<C.length-1;D++)C[D+1]==C[D]&&O.push(C[D]);return O}o(BI,"getDuplicatesInArray");function Mc(I){if(!Re.sparqlStar)throw new Error("SPARQL-star support is not enabled");return I}o(Mc,"ensureSparqlStar");function A_(I,C,O){for(let D of C){let te=Hi("subject"in D?D.subject:I,D.predicate,D.object);O.push(te),D.annotations&&A_(Hp(I,D.predicate,D.object),D.annotations,O)}}o(A_,"_applyAnnotations");function Jp(I){if(Re.sparqlStar){let C=[];return I.forEach(O=>{let D=Hi(O.subject,O.predicate,O.object);C.push(D),O.annotations&&A_(Hp(O.subject,O.predicate,O.object),O.annotations,C)}),C}return I}o(Jp,"applyAnnotations");function tB(I){if(!Re.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return I}o(tB,"ensureSparqlStarNestedQuads");function C_(I){for(let C of I){if(C.type==="graph"&&C.name.termType==="Variable")throw new Error("Detected illegal variable in GRAPH");if(C.type==="bgp"||C.type==="graph"){for(let O of C.triples)if(O.subject.termType==="Variable"||O.predicate.termType==="Variable"||O.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return I}o(C_,"ensureNoVariables");function Zp(I){for(let C of I)if(C.type==="bgp"){for(let O of C.triples)if(O.subject.termType==="BlankNode"||O.predicate.termType==="BlankNode"||O.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return I}o(Zp,"ensureNoBnodes");var qI=(function(){var I={EOF:1,parseError:o(function(O,D){if(this.yy.parser)this.yy.parser.parseError(O,D);else throw new Error(O)},"parseError"),setInput:o(function(C,O){return this.yy=O||this.yy||{},this._input=C,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var O=C.match(/(?:\r\n?|\n).*/g);return O?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),C},"input"),unput:o(function(C){var O=C.length,D=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-O),this.offset-=O;var te=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),D.length-1&&(this.yylineno-=D.length-1);var Ce=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:D?(D.length===te.length?this.yylloc.first_column:0)+te[te.length-D.length].length-D[0].length:this.yylloc.first_column-O},this.options.ranges&&(this.yylloc.range=[Ce[0],Ce[0]+this.yyleng-O]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
270
270
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(C){this.unput(this.match.slice(C))},"less"),pastInput:o(function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var C=this.pastInput(),O=new Array(C.length+1).join("-");return C+this.upcomingInput()+`
|
|
271
271
|
`+O+"^"},"showPosition"),test_match:o(function(C,O){var D,te,Ce;if(this.options.backtrack_lexer&&(Ce={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&&(Ce.yylloc.range=this.yylloc.range.slice(0))),te=C[0].match(/(?:\r\n?|\n).*/g),te&&(this.yylineno+=te.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:te?te[te.length-1].length-te[te.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],D=this.performAction.call(this,this.yy,this,O,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),D)return D;if(this._backtrack){for(var m in Ce)this[m]=Ce[m];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,O,D,te;this._more||(this.yytext="",this.match="");for(var Ce=this._currentRules(),m=0;m<Ce.length;m++)if(D=this._input.match(this.rules[Ce[m]]),D&&(!O||D[0].length>O[0].length)){if(O=D,te=m,this.options.backtrack_lexer){if(C=this.test_match(D,Ce[m]),C!==!1)return C;if(this._backtrack){O=!1;continue}else return!1}else if(!this.options.flex)break}return O?(C=this.test_match(O,Ce[te]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
272
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var O=this.next();return O||this.lex()},"lex"),begin:o(function(O){this.conditionStack.push(O)},"begin"),popState:o(function(){var O=this.conditionStack.length-1;return O>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(O){return O=this.conditionStack.length-1-Math.abs(O||0),O>=0?this.conditionStack[O]:"INITIAL"},"topState"),pushState:o(function(O){this.begin(O)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:o(function(O,D,te,Ce){var m=Ce;switch(te){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(D.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 I})();Bp.lexer=qI;function Re(){this.yy={}}return o(Re,"Parser"),Re.prototype=Bp,Bp.Parser=Re,new Re})();ES.exports=a5});var IS=_((wQ,CS)=>{var o5="http://www.w3.org/2001/XMLSchema#integer",c5="http://www.w3.org/2001/XMLSchema#string";function _t(n){this._options=n=n||{};var e=n.prefixes||{};this._prefixByIri={};var t=[];for(var r in e){var i=e[r];fl(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=fl(n.indent)?n.indent:" ",this._newline=fl(n.newline)?n.newline:`
|
|
273
|
-
`,this._explicitDatatype=!!n.explicitDatatype}o(_t,"Generator");_t.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=fn(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:Cs(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+ph(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=fn(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+fn(n.group,void 0,function(t){var r=Cs(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+ph(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+fn(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+fn(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()};_t.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};_t.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)};_t.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};_t.prototype.array=function(n){return fn(n,this._newline,this.toPattern,this)};_t.prototype.bgp=function(n){return this.encodeTriples(n.triples)};_t.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];ba(s.subject,t)?ba(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("")};_t.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};_t.prototype.graphs=function(n,e){return!e||e.length===0?"":fn(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};_t.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+"}"};_t.prototype.query=function(n){return this.toQuery(n)};_t.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};_t.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+ph(n.variable)+")"};_t.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};_t.prototype.union=function(n){return fn(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};_t.prototype.minus=function(n){return"MINUS "+this.group(n)};_t.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+fn(n.values,this._newline,function(i){return" "+t+fn(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};_t.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};_t.prototype.toExpression=function(n){if(Cs(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(xS,AS)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+fn(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(Cs(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Cs(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+"("+(fl(t[1])?t[1]:fn(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+fn(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};_t.prototype.toEntity=function(n){if(Cs(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return ph(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(xS,AS)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case c5:return n;case o5: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 xS=/["\\\t\n\r\b\f]/g,AS=o(function(n){return l5[n]},"escapeReplacer"),l5={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};_t.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+">"};_t.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)}};_t.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function ph(n){return"?"+n.value}o(ph,"variableToString");function fl(n){return typeof n=="string"}o(fl,"isString");function Cs(n){return typeof n.termType=="string"}o(Cs,"isTerm");function ba(n,e){if(!n||!Cs(n)||!e||!Cs(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&ba(n.datatype,e.datatype);case"Quad":return ba(n.subject,e.subject)&&ba(n.predicate,e.predicate)&&ba(n.object,e.object)&&ba(n.graph,e.graph);default:return n.value===e.value}}o(ba,"equalTerms");function fn(n,e,t,r){return n.map(t,r).join(fl(e)?e:" ")}o(fn,"mapJoin");function u5(n={}){return{stringify:o(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new _t(t).toQuery(e)},"stringify"),createGenerator:o(function(){return new _t(n)},"createGenerator")}}o(u5,"_Generator");CS.exports={Generator:u5}});var Ty=_(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.BlankNode=void 0;var Ey=class{static{o(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};mh.BlankNode=Ey});var xy=_(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.DefaultGraph=void 0;var hl=class{static{o(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};gh.DefaultGraph=hl;hl.INSTANCE=new hl});var vh=_(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.NamedNode=void 0;var Ay=class{static{o(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};yh.NamedNode=Ay});var Cy=_(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.Literal=void 0;var OS=vh(),dl=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)}};_h.Literal=dl;dl.RDF_LANGUAGE_STRING=new OS.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");dl.XSD_STRING=new OS.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var Oy=_(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.Quad=void 0;var Iy=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)}};wh.Quad=Iy});var Py=_(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.Variable=void 0;var Ry=class{static{o(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};bh.Variable=Ry});var PS=_(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.DataFactory=void 0;var f5=Ty(),h5=xy(),RS=Cy(),d5=vh(),p5=Oy(),m5=Py(),g5=0,Fy=class{static{o(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${g5++}_`}namedNode(e){return new d5.NamedNode(e)}blankNode(e){return new f5.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new RS.Literal(e,t)}variable(e){return new m5.Variable(e)}defaultGraph(){return h5.DefaultGraph.INSTANCE}quad(e,t,r,i){return new p5.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(RS.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}};Sh.DataFactory=Fy});var FS=_(hn=>{"use strict";var y5=hn&&hn.__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]})),Sa=hn&&hn.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&y5(e,n,t)};Object.defineProperty(hn,"__esModule",{value:!0});Sa(Ty(),hn);Sa(PS(),hn);Sa(xy(),hn);Sa(Cy(),hn);Sa(vh(),hn);Sa(Oy(),hn);Sa(Py(),hn)});var NS=_((jQ,DS)=>{var{Parser:is}=TS(),{Generator:v5}=IS(),{Wildcard:_5}=Sy(),{DataFactory:w5}=FS();function b5({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 is;return l.parse=function(){return is.base=e||"",is.prefixes=Object.create(c),is.factory=t||new w5,is.sparqlStar=!!i,is.pathOnly=!!r,is.skipValidation=!!s||!!a,is.prototype.parse.apply(l,arguments)},l._resetBlanks=is._resetBlanks,l}o(b5,"_Parser");DS.exports={Parser:b5,Generator:v5,Wildcard:_5}});var Ny=_(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.CaseWhenTransformerError=vo.CaseWhenTransformer=void 0;var Dy=class{static{o(this,"CaseWhenTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new ss("Too many nested CASE expressions (max 100 iterations)");while(t!==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 ss(`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 ss("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(),h=this.parseWhenClause(f);h&&t.push(h)}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 ss(`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 ss("WHEN clause has empty condition");if(!s)throw new ss("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}};vo.CaseWhenTransformer=Dy;var ss=class extends Error{static{o(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};vo.CaseWhenTransformerError=ss});var ky=_(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.LateralTransformerError=_o.LateralTransformer=void 0;var Eh=class n{static{o(this,"LateralTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Is("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]!==`
|
|
274
|
-
`;)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
|
|
275
|
-
`;)r++;continue}if(e[r]==="{"){i++,r++;continue}if(e[r]==="}"){if(i--,i===0){let s=e.substring(t,r+1);return{content:s,length:s.length}}r++;continue}r++}if(i>0)throw new
|
|
272
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var O=this.next();return O||this.lex()},"lex"),begin:o(function(O){this.conditionStack.push(O)},"begin"),popState:o(function(){var O=this.conditionStack.length-1;return O>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(O){return O=this.conditionStack.length-1-Math.abs(O||0),O>=0?this.conditionStack[O]:"INITIAL"},"topState"),pushState:o(function(O){this.begin(O)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:o(function(O,D,te,Ce){var m=Ce;switch(te){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(D.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 I})();Bp.lexer=qI;function Re(){this.yy={}}return o(Re,"Parser"),Re.prototype=Bp,Bp.Parser=Re,new Re})();ES.exports=a5});var IS=_((_Q,CS)=>{var o5="http://www.w3.org/2001/XMLSchema#integer",c5="http://www.w3.org/2001/XMLSchema#string";function _t(n){this._options=n=n||{};var e=n.prefixes||{};this._prefixByIri={};var t=[];for(var r in e){var i=e[r];fl(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=fl(n.indent)?n.indent:" ",this._newline=fl(n.newline)?n.newline:`
|
|
273
|
+
`,this._explicitDatatype=!!n.explicitDatatype}o(_t,"Generator");_t.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=fn(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:Is(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+ph(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=fn(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+fn(n.group,void 0,function(t){var r=Is(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+ph(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+fn(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+fn(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()};_t.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};_t.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)};_t.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};_t.prototype.array=function(n){return fn(n,this._newline,this.toPattern,this)};_t.prototype.bgp=function(n){return this.encodeTriples(n.triples)};_t.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];ba(s.subject,t)?ba(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("")};_t.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};_t.prototype.graphs=function(n,e){return!e||e.length===0?"":fn(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};_t.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+"}"};_t.prototype.query=function(n){return this.toQuery(n)};_t.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};_t.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+ph(n.variable)+")"};_t.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};_t.prototype.union=function(n){return fn(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};_t.prototype.minus=function(n){return"MINUS "+this.group(n)};_t.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+fn(n.values,this._newline,function(i){return" "+t+fn(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};_t.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};_t.prototype.toExpression=function(n){if(Is(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(xS,AS)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+fn(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(Is(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Is(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+"("+(fl(t[1])?t[1]:fn(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+fn(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};_t.prototype.toEntity=function(n){if(Is(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return ph(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(xS,AS)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case c5:return n;case o5: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 xS=/["\\\t\n\r\b\f]/g,AS=o(function(n){return l5[n]},"escapeReplacer"),l5={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};_t.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+">"};_t.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)}};_t.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function ph(n){return"?"+n.value}o(ph,"variableToString");function fl(n){return typeof n=="string"}o(fl,"isString");function Is(n){return typeof n.termType=="string"}o(Is,"isTerm");function ba(n,e){if(!n||!Is(n)||!e||!Is(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&ba(n.datatype,e.datatype);case"Quad":return ba(n.subject,e.subject)&&ba(n.predicate,e.predicate)&&ba(n.object,e.object)&&ba(n.graph,e.graph);default:return n.value===e.value}}o(ba,"equalTerms");function fn(n,e,t,r){return n.map(t,r).join(fl(e)?e:" ")}o(fn,"mapJoin");function u5(n={}){return{stringify:o(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new _t(t).toQuery(e)},"stringify"),createGenerator:o(function(){return new _t(n)},"createGenerator")}}o(u5,"_Generator");CS.exports={Generator:u5}});var Ty=_(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.BlankNode=void 0;var Ey=class{static{o(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};mh.BlankNode=Ey});var xy=_(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.DefaultGraph=void 0;var hl=class{static{o(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};gh.DefaultGraph=hl;hl.INSTANCE=new hl});var vh=_(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.NamedNode=void 0;var Ay=class{static{o(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};yh.NamedNode=Ay});var Cy=_(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.Literal=void 0;var OS=vh(),dl=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)}};_h.Literal=dl;dl.RDF_LANGUAGE_STRING=new OS.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");dl.XSD_STRING=new OS.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var Oy=_(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.Quad=void 0;var Iy=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)}};wh.Quad=Iy});var Py=_(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.Variable=void 0;var Ry=class{static{o(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};bh.Variable=Ry});var PS=_(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.DataFactory=void 0;var f5=Ty(),h5=xy(),RS=Cy(),d5=vh(),p5=Oy(),m5=Py(),g5=0,Fy=class{static{o(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${g5++}_`}namedNode(e){return new d5.NamedNode(e)}blankNode(e){return new f5.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new RS.Literal(e,t)}variable(e){return new m5.Variable(e)}defaultGraph(){return h5.DefaultGraph.INSTANCE}quad(e,t,r,i){return new p5.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(RS.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}};Sh.DataFactory=Fy});var FS=_(hn=>{"use strict";var y5=hn&&hn.__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]})),Sa=hn&&hn.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&y5(e,n,t)};Object.defineProperty(hn,"__esModule",{value:!0});Sa(Ty(),hn);Sa(PS(),hn);Sa(xy(),hn);Sa(Cy(),hn);Sa(vh(),hn);Sa(Oy(),hn);Sa(Py(),hn)});var NS=_((MQ,DS)=>{var{Parser:is}=TS(),{Generator:v5}=IS(),{Wildcard:_5}=Sy(),{DataFactory:w5}=FS();function b5({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 is;return l.parse=function(){return is.base=e||"",is.prefixes=Object.create(c),is.factory=t||new w5,is.sparqlStar=!!i,is.pathOnly=!!r,is.skipValidation=!!s||!!a,is.prototype.parse.apply(l,arguments)},l._resetBlanks=is._resetBlanks,l}o(b5,"_Parser");DS.exports={Parser:b5,Generator:v5,Wildcard:_5}});var Ny=_(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.CaseWhenTransformerError=vo.CaseWhenTransformer=void 0;var Dy=class{static{o(this,"CaseWhenTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new ss("Too many nested CASE expressions (max 100 iterations)");while(t!==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 ss(`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 ss("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(),h=this.parseWhenClause(f);h&&t.push(h)}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 ss(`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 ss("WHEN clause has empty condition");if(!s)throw new ss("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}};vo.CaseWhenTransformer=Dy;var ss=class extends Error{static{o(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};vo.CaseWhenTransformerError=ss});var ky=_(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.LateralTransformerError=_o.LateralTransformer=void 0;var Eh=class n{static{o(this,"LateralTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Os("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]!==`
|
|
274
|
+
`;)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 Os(`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]!==`
|
|
275
|
+
`;)r++;continue}if(e[r]==="{"){i++,r++;continue}if(e[r]==="}"){if(i--,i===0){let s=e.substring(t,r+1);return{content:s,length:s.length}}r++;continue}r++}if(i>0)throw new Os(`Unclosed LATERAL block at position ${t}`);return null}transformLateral(e){let t=e.indexOf("{");if(t===-1)throw new Os("LATERAL expression missing opening brace");let r=e.substring(t+1,e.length-1).trim();if(!r.toUpperCase().trim().startsWith("SELECT"))throw new Os("LATERAL block must contain a SELECT subquery");let a=r.toUpperCase().indexOf("SELECT")+6;for(;a<r.length&&/\s/.test(r[a]);)a++;let c=r.substring(a).toUpperCase();return c.startsWith("DISTINCT")?a+=8:c.startsWith("REDUCED")&&(a+=7),`{ ${r.substring(0,a)+` ?${n.LATERAL_MARKER}`+r.substring(a)} }`}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}};_o.LateralTransformer=Eh;Eh.LATERAL_MARKER="__LATERAL_JOIN__";var Os=class extends Error{static{o(this,"LateralTransformerError")}constructor(e){super(`LATERAL transformation error: ${e}`),this.name="LateralTransformerError"}};_o.LateralTransformerError=Os});var kS=_(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.PrefixStarTransformerError=Rs.PrefixStarTransformer=Rs.WellKnownPrefixResolver=void 0;var Th=class{static{o(this,"WellKnownPrefixResolver")}constructor(){this.wellKnownPrefixes=new Map;let e=new Map;e.set("schema","http://schema.org/"),this.wellKnownPrefixes.set("http://schema.org/",e);let t=new Map;t.set("foaf","http://xmlns.com/foaf/0.1/"),this.wellKnownPrefixes.set("http://xmlns.com/foaf/0.1/",t);let r=new Map;r.set("dc","http://purl.org/dc/elements/1.1/"),r.set("dcterms","http://purl.org/dc/terms/"),this.wellKnownPrefixes.set("http://purl.org/dc/elements/1.1/",r),this.wellKnownPrefixes.set("http://purl.org/dc/terms/",r);let i=new Map;i.set("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),i.set("rdfs","http://www.w3.org/2000/01/rdf-schema#"),this.wellKnownPrefixes.set("http://www.w3.org/1999/02/22-rdf-syntax-ns#",i),this.wellKnownPrefixes.set("http://www.w3.org/2000/01/rdf-schema#",i);let s=new Map;s.set("owl","http://www.w3.org/2002/07/owl#"),this.wellKnownPrefixes.set("http://www.w3.org/2002/07/owl#",s);let a=new Map;a.set("xsd","http://www.w3.org/2001/XMLSchema#"),this.wellKnownPrefixes.set("http://www.w3.org/2001/XMLSchema#",a);let c=new Map;c.set("skos","http://www.w3.org/2004/02/skos/core#"),this.wellKnownPrefixes.set("http://www.w3.org/2004/02/skos/core#",c);let l=new Map;l.set("prov","http://www.w3.org/ns/prov#"),this.wellKnownPrefixes.set("http://www.w3.org/ns/prov#",l);let u=new Map;u.set("geo","http://www.w3.org/2003/01/geo/wgs84_pos#"),this.wellKnownPrefixes.set("http://www.w3.org/2003/01/geo/wgs84_pos#",u);let f=new Map;f.set("dcat","http://www.w3.org/ns/dcat#"),this.wellKnownPrefixes.set("http://www.w3.org/ns/dcat#",f)}async resolve(e){let t=e.endsWith("#")||e.endsWith("/")?e:e+(e.includes("#")?"":"/"),r=this.wellKnownPrefixes.get(t);if(r)return r;let i=t.slice(0,-1),s=this.wellKnownPrefixes.get(i);return s||new Map}addVocabulary(e,t){this.wellKnownPrefixes.set(e,t)}};Rs.WellKnownPrefixResolver=Th;var Ly=class{static{o(this,"PrefixStarTransformer")}constructor(e){this.resolver=e??new Th}async transform(e){let t=this.findPrefixStarDeclarations(e);if(t.length===0)return e;let r=[],i=[];for(let a of t)try{let c=await this.resolver.resolve(a.uri);for(let[l,u]of c)r.push(`PREFIX ${l}: <${u}>`);if(c.size===0){let l=this.extractPrefixFromUri(a.uri);l&&r.push(`PREFIX ${l}: <${a.uri}>`)}}catch(c){let l=c instanceof Error?c.message:String(c);i.push(`Failed to resolve vocabulary ${a.uri}: ${l}`)}if(r.length===0&&i.length>0)throw new wo(i.join("; "));let s=e;for(let a=t.length-1;a>=0;a--){let c=t[a];s=s.substring(0,c.startPos)+s.substring(c.endPos)}return r.length>0&&(s=r.join(`
|
|
276
276
|
`)+`
|
|
277
277
|
`+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 wo(`Unclosed IRI in PREFIX* declaration at position ${a}`)}else throw new wo(`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===`
|
|
278
|
-
`)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,"")}};
|
|
278
|
+
`)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,"")}};Rs.PrefixStarTransformer=Ly;var wo=class extends Error{static{o(this,"PrefixStarTransformerError")}constructor(e){super(`PREFIX* transformation error: ${e}`),this.name="PrefixStarTransformerError"}};Rs.PrefixStarTransformerError=wo});var My=_(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.DescribeOptionsTransformer=So.DescribeOptionsTransformerError=void 0;var xh=class extends Error{static{o(this,"DescribeOptionsTransformerError")}constructor(e){super(e),this.name="DescribeOptionsTransformerError"}};So.DescribeOptionsTransformerError=xh;var bo=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 xh(`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}};So.DescribeOptionsTransformer=bo;bo.DEPTH_PATTERN=/\bDEPTH\s+(\d+)/gi;bo.SYMMETRIC_PATTERN=/\bSYMMETRIC\b/gi;bo.DESCRIBE_QUERY_PATTERN=/\bDESCRIBE\b/i});var LS=_(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.DirectionalLangTagTransformerError=Eo.DirectionalLangTagTransformer=void 0;var Ah=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()}};Eo.DirectionalLangTagTransformer=Ah;Ah.DIRECTIONAL_TAG_REGEX=/(["'])((?:[^\\]|\\.)*?)\1@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)--(ltr|rtl)/g;var jy=class extends Error{static{o(this,"DirectionalLangTagTransformerError")}constructor(e){super(`Directional language tag transformation error: ${e}`),this.name="DirectionalLangTagTransformerError"}};Eo.DirectionalLangTagTransformerError=jy});var MS=_(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.TripleTermTransformerError=xo.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 To("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 To(`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 To(`Invalid triple term syntax: ${e.substring(0,50)}...`);return`<< ${t[1]} >>`}};xo.TripleTermTransformer=$y;var To=class extends Error{static{o(this,"TripleTermTransformerError")}constructor(e){super(`Triple term transformation error: ${e}`),this.name="TripleTermTransformerError"}};xo.TripleTermTransformerError=To});var Uy=_(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.VaultPrefixTransformer=void 0;var S5=/PREFIX\s+(\w+)\s*:/gi,E5=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"]),Vy=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())&&!E5.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(`
|
|
279
279
|
`,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(S5.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}};Ch.VaultPrefixTransformer=Vy});var VS=_(Tn=>{"use strict";var T5=Tn&&Tn.__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]})),x5=Tn&&Tn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),A5=Tn&&Tn.__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"&&T5(t,e,r[i]);return x5(t,e),t}})();Object.defineProperty(Tn,"__esModule",{value:!0});Tn.SPARQLParser=Tn.SPARQLParseError=void 0;var jS=A5(NS()),By=Ny(),qy=ky(),$S=kS(),Wy=My(),C5=LS(),Gy=MS(),I5=Uy(),Vt=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}};Tn.SPARQLParseError=Vt;var Hy=class{static{o(this,"SPARQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new jS.Parser({sparqlStar:!0}),this.generator=new jS.Generator({sparqlStar:!0}),this.caseWhenTransformer=new By.CaseWhenTransformer,this.lateralTransformer=new qy.LateralTransformer,this.prefixStarTransformer=new $S.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new Wy.DescribeOptionsTransformer,this.directionalLangTagTransformer=new C5.DirectionalLangTagTransformer,this.tripleTermTransformer=new Gy.TripleTermTransformer,this.vaultPrefixTransformer=new I5.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 Wy.DescribeOptionsTransformerError)throw new Vt(t.message);if(t instanceof qy.LateralTransformerError)throw new Vt(t.message);if(t instanceof By.CaseWhenTransformerError)throw new Vt(t.message);if(t instanceof Gy.TripleTermTransformerError)throw new Vt(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 Vt(`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 Wy.DescribeOptionsTransformerError)throw new Vt(t.message);if(t instanceof $S.PrefixStarTransformerError)throw new Vt(t.message);if(t instanceof qy.LateralTransformerError)throw new Vt(t.message);if(t instanceof By.CaseWhenTransformerError)throw new Vt(t.message);if(t instanceof Gy.TripleTermTransformerError)throw new Vt(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 Vt(`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 Vt(`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 Vt("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 Vt("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new Vt(`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 Vt(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};Tn.SPARQLParser=Hy});var BS=_(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.AlgebraTranslator=Ao.AlgebraTranslatorError=void 0;var US=ky(),be=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};Ao.AlgebraTranslatorError=be;var zy=class{static{o(this,"AlgebraTranslator")}constructor(){this.directionMappings=new Map,this.aggregateCounter=0}setDirectionMappings(e){this.directionMappings=e}translate(e){if(e.type!=="query")throw new be("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 be(`Query type ${e.queryType} not yet supported`)}translateSelect(e){let t;if(!e.where||e.where.length===0)throw new be("SELECT query must have WHERE clause");t=this.translateWhere(e.where),this.aggregateCounter=0;let r=new Map,i=this.extractAggregatesWithMapping(e.variables,r),s=this.extractGroupVariables(e.group),a=this.extractHavingExpressions(e.having,i,r);if((i.length>0||s.length>0||a.length>0)&&(t={type:"group",variables:s,aggregates:i,having:a.length>0?a:void 0,input:t}),e.variables&&e.variables.length>0){for(let l of e.variables){let u=l;if(u.expression&&u.variable){if(u.expression.type==="aggregate")continue;let f=this.transformExpressionWithAggregateVars(u.expression,r);t={type:"extend",variable:u.variable.value,expression:f,input:t}}}let c=e.variables.filter(l=>l.termType==="Variable"||l.variable).map(l=>l.termType==="Variable"?l.value:l.variable.value);c.length>0&&(t={type:"project",variables:c,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(c=>this.translateOrderComparator(c)),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.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new be("CONSTRUCT query must have WHERE clause");let r=this.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}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translateAsk(e){return{type:"ask",where:e.where&&e.where.length>0?this.translateWhere(e.where):{type:"bgp",triples:[]}}}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)!i.expression||!i.variable||(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}collectNestedAggregates(e,t,r){if(e){if(e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if(e.type==="operation"&&e.args)for(let i of e.args)this.collectNestedAggregates(i,t,r)}}transformExpressionWithAggregateVars(e,t){if(t.has(e))return{type:"variable",name:t.get(e)};if(e.type==="operation"&&e.args){let r=e.args.map(c=>this.transformExpressionWithAggregateVars(c,t)),i=["=","!=","<",">","<=",">="],s=["&&","||","!"],a=["+","-","*","/"];return i.includes(e.operator)?{type:"comparison",operator:e.operator,left:r[0],right:r[1]}:s.includes(e.operator)?{type:"logical",operator:e.operator,operands:r}:a.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:r[0],right:r[1]}:{type:"function",function:e.operator,args:r}}return this.translateExpression(e)}extractGroupVariables(e){return e?e.filter(t=>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))}translateAggregateExpression(e){let t=e.aggregation;if(typeof t=="string"){let r=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(r)?{type:"aggregate",aggregation:r,expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}}if(t&&typeof t=="object"){let r;if(t.termType==="NamedNode"&&t.value)r=t.value;else if("value"in t)r=String(t.value);else throw new be(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(t)}`);return{type:"aggregate",aggregation:{type:"custom",iri:r},expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}}throw new be(`Unknown aggregate format: ${JSON.stringify(t)}`)}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)return e.patterns[0];throw new be("Invalid lateral pattern structure")}translateWhere(e){if(e.length===0)throw new be("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)i[0].type==="optional"?s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:i[0].expression?this.translateExpression(i[0].expression):void 0}:s=this.translatePattern(i[0]);else{i[0].type==="optional"?s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:i[0].expression?this.translateExpression(i[0].expression):void 0}: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.translateSelect(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional")s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:c.expression?this.translateExpression(c.expression):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.translateExpression(a.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new be("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGP(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 be(`Unsupported pattern type: ${e.type}`)}}translateBGP(e){if(!e.triples||!Array.isArray(e.triples))throw new be("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 be("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translatePredicate(e){return e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!e.pathType)throw new be("Property path must have pathType");if(!e.items||!Array.isArray(e.items))throw new be("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 be("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new be("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new be("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new be("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new be(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if(e.type==="path")return this.translatePropertyPath(e);if(e.termType==="NamedNode")return{type:"iri",value:e.value};throw new be(`Unsupported path item type: ${e.type||e.termType}`)}translateTripleElement(e){if(!e||!e.termType)throw new be("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 be(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new be("Quoted triple must have subject, predicate, and object");let t=this.translateTripleElement(e.subject),r=this.translateQuotedTriplePredicate(e.predicate),i=this.translateTripleElement(e.object);return{type:"quoted",subject:t,predicate:r,object:i}}translateQuotedTriplePredicate(e){if(!e||!e.termType)throw new be("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 be(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}translateFilter(e){if(!e.expression)throw new be("Filter pattern must have expression");let t=e.patterns?this.translateWhere(e.patterns):{type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateExpression(e){if(!e)throw new be("Expression cannot be null or undefined");if(e.type==="operation")return this.translateOperationExpression(e);if(e.type==="functioncall"||e.type==="functionCall")return{type:"functionCall",function:e.function,args:e.args.map(t=>this.translateExpression(t))};if(e.termType)return this.translateTermExpression(e);throw new be(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"];return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(e.args[0]),right:this.translateExpression(e.args[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:e.args.map(s=>this.translateExpression(s))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(e.args[0]),right:this.translateExpression(e.args[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:e.args.map(s=>this.translateExpression(s))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new be("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&t.patterns?r=this.translateWhere(t.patterns):t.type==="bgp"?r=this.translateBGP(t):r=this.translatePattern(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new be("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 be("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"}}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)}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new be("OPTIONAL pattern must have patterns");return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:e.expression?this.translateExpression(e.expression):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new be("UNION pattern must have at least 2 patterns");let t=o(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(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 be("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 be("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={type:"literal",value:a.value,datatype:a.datatype?.value,language:a.language||void 0};if(a.language){let l=this.directionMappings.get(a.language.toLowerCase());l&&(c.direction=l)}t[s]=c}else throw new be(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new be("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpression(e.expression),input:t}}translateOrderComparator(e){return{expression:this.translateExpression(e.expression),descending:e.descending||!1}}isLateralSubquery(e){return e.queryType!=="SELECT"||!e.variables?!1:e.variables.some(t=>t.termType==="Variable"&&t.value===US.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){return e.variables?{...e,variables:e.variables.filter(t=>!(t.termType==="Variable"&&t.value===US.LateralTransformer.LATERAL_MARKER))}:e}translateSubquery(e){if(e.queryType!=="SELECT")throw new be(`Only SELECT subqueries are supported, got: ${e.queryType}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelect(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new be("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new be("SERVICE pattern must have patterns array");let t=this.translateWhere(e.patterns);return{type:"service",endpoint:e.name.value,pattern:t,silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new be("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new be("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 be(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);let r=this.translateWhere(e.patterns);return{type:"graph",name:t,pattern:r}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables))for(let s of e.variables){let a=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.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};Ao.AlgebraTranslator=zy});var Yy=_(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.FilterContainsOptimizer=void 0;var O5=ze(),R5=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,Qy=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(R5);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 O5.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)}};Ih.FilterContainsOptimizer=Qy});var qS=_(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.AlgebraOptimizer=void 0;var P5=Yy(),Ky=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new P5.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)}};Oh.AlgebraOptimizer=Ky});var WS=_(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});Rh.AlgebraSerializer=void 0;var Xy=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
280
280
|
${e.triples.map(u=>`${r} ${this.tripleToString(u)}`).join(`
|
|
281
281
|
`)}
|
|
@@ -308,7 +308,7 @@ ${r})`;case"extend":return`${r}Extend (?${e.variable} = ${this.expressionToStrin
|
|
|
308
308
|
${this.toString(e.input,t+1)}
|
|
309
309
|
${r})`;case"subquery":return`${r}Subquery(
|
|
310
310
|
${this.toString(e.query,t+1)}
|
|
311
|
-
${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)}};Rh.AlgebraSerializer=Xy});var as=_(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.SolutionMapping=void 0;var GS=mt(),HS=ze(),zS=$t(),Jy=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 GS.Literal&&t instanceof GS.Literal?e.equals(t):e instanceof HS.IRI&&t instanceof HS.IRI?e.value===t.value:e instanceof zS.BlankNode&&t instanceof zS.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}};Ph.SolutionMapping=Jy});var YS=_(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.PropertyPathExecutor=Co.PropertyPathExecutorError=void 0;var F5=as(),Fh=ze(),QS=$t(),pl=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Co.PropertyPathExecutorError=pl;var Zy=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new F5.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 pl("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 h of f)l.add(h)}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 Fh.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let{node:c,depth:l}=a.shift();if(l>=this.MAX_DEPTH)continue;let u=await this.evaluatePathItem(c,t,null);for(let f of u){let h=this.nodeToKey(f);(r===null||this.nodeInSet(f,r))&&s.add(f),i.has(h)||(i.add(h),a.push({node:f,depth:l+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new Fh.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"|":return{type:"path",pathType:"|",items:e.items.map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"+":case"*":case"?":let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new Fh.IRI(e.value));break;case"blank":t.add(new QS.BlankNode(e.value));break;default:throw new pl(`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 Fh.IRI)return{type:"iri",value:r.value};if(r instanceof QS.BlankNode)return{type:"blank",value:r.id}}}return e}isVariable(e){return e.type==="variable"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};Co.PropertyPathExecutor=Zy});var r1=_(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.BGPExecutor=Io.BGPExecutorError=void 0;var Dh=as(),Rs=ze(),e1=mt(),Nh=$t(),kh=Wc(),D5=YS(),Er=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Io.BGPExecutorError=Er;var t1=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new D5.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new Dh.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 Dh.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 Er("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r))return;let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new Er("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 Dh.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t))return;let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new Dh.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,h]of u.entries())l.set(f,h)}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,h]of u.entries())l.set(f,h)}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 kh.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 Rs.IRI&&e.value===t.value;case"literal":return!(!(t instanceof e1.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof Nh.BlankNode&&e.value===t.id;case"quoted":return t instanceof kh.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 Rs.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Rs.IRI(e.value);case"blank":return new Nh.BlankNode(e.value);case"literal":throw new Er("Literals cannot appear in subject position");case"variable":throw new Er(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Er(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new Rs.IRI(e.predicate.value):(()=>{throw new Er("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new kh.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Rs.IRI(e.value);case"literal":throw new Er("Literals cannot appear in predicate position");case"blank":throw new Er("Blank nodes cannot appear in predicate position");case"variable":throw new Er(`Cannot convert variable to RDF term: ${e.value}`);default:throw new Er(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Rs.IRI(e.value);case"literal":return new e1.Literal(e.value,e.datatype?new Rs.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new Nh.BlankNode(e.value);case"variable":throw new Er(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Er(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof Rs.IRI)return{type:"iri",value:e.value};if(e instanceof e1.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof Nh.BlankNode)return{type:"blank",value:e.id};if(e instanceof kh.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new Er(`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)}}};Io.BGPExecutor=t1});var Mh=_(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.BuiltInFunctions=void 0;var Se=ze(),P=mt(),Br=$t(),Oo=Wc(),n1=Lr(),ml=class{static{o(this,"BuiltInFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Se.IRI||e instanceof P.Literal?e.value:e instanceof Br.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof P.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof P.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=this.parseDirectionalLangTag(e),[s,a]=this.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 datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof P.Literal)return e.datatype?e.datatype:e.language?new Se.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Se.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 Se.IRI}static isBlank(e){return e===void 0?!1:e instanceof Br.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof P.Literal}static isTriple(e){return e===void 0?!1:e instanceof Oo.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof P.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof P.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 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 compare(e,t,r){if(this.isDayTimeDurationValue(e)&&this.isDayTimeDurationValue(t))return this.compareDurations(e instanceof P.Literal?e:String(e),t instanceof P.Literal?t:String(t),r);if(this.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return this.compareDurations(e instanceof P.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&this.isDayTimeDurationValue(t))return this.compareDurations(e,t instanceof P.Literal?t:String(t),r);let i=this.toComparableValue(e),s=this.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 P.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 P.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 this.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof Se.IRI?e.value:e instanceof Br.BlankNode?e.id:String(e)}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 parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static dateBefore(e,t){let r=this.parseDate(e),i=this.parseDate(t);return r<i}static dateAfter(e,t){let r=this.parseDate(e),i=this.parseDate(t);return r>i}static dateInRange(e,t,r){let i=this.parseDate(e),s=this.parseDate(t),a=this.parseDate(r);return i>=s&&i<=a}static dateDiffMinutes(e,t){let r=this.parseDate(e),i=this.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=this.parseDate(e),i=this.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}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 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 P.Literal(r,new Se.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 now(){return new Date().toISOString()}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()}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,r){return e?t:r}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new P.Literal(t.toISOString(),new Se.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 P.Literal(String(t),new Se.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 P.Literal(String(t),new Se.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static encodeForUri(e){return encodeURIComponent(e)}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")}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 Se.IRI&&t instanceof Se.IRI)return e.value===t.value;if(e instanceof Br.BlankNode&&t instanceof Br.BlankNode)return e.id===t.id;if(e instanceof P.Literal&&t instanceof P.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 Se.IRI)return e;if(e instanceof P.Literal)return new Se.IRI(e.value);throw e instanceof Br.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return this.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,n1.v4)().replace(/-/g,"").substring(0,12)}`;return new Br.BlankNode(t)}if(e instanceof P.Literal)return new Br.BlankNode(e.value);if(e instanceof Br.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 P.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 Se.IRI)i=t;else if(t instanceof P.Literal)i=new Se.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new P.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 P.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 P.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 P.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 P.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 P.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 P.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 P.Literal(i,void 0,s,a)}static uuid(){let e=(0,n1.v4)();return new Se.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,n1.v4)();return new P.Literal(e)}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 d=parseFloat(u[1]);i+=d*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let d=parseFloat(f[1]);i+=d*60*1e3,l=l.substring(f[0].length)}let h=l.match(/^(\d+(?:\.\d+)?)S$/);if(h){let d=parseFloat(h[1]);i+=d*1e3,l=l.substring(h[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 this.parseDayTimeDuration(e),new P.Literal(e,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static compareDurations(e,t,r){let i=e instanceof P.Literal?e.value:e,s=t instanceof P.Literal?t.value:t,a=this.parseDayTimeDuration(i),c=this.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 isDayTimeDuration(e){return e instanceof P.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof P.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static dateDiff(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r),a=this.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=this.formatDateDuration(l);return new P.Literal(u,new Se.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,h=parseInt(u[2],10),d=parseInt(u[3],10),p=f*(h*60+d)*60*1e3;l=new Date(l.getTime()-p)}}return l}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 dateTimeDiff(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.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=this.formatDayTimeDuration(c);return new P.Literal(l,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new P.Literal(l.toISOString(),new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new P.Literal(l.toISOString(),new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),h=String(l.getUTCDate()).padStart(2,"0"),d=`${u}-${f}-${h}`;return new P.Literal(d,new Se.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),h=String(l.getUTCDate()).padStart(2,"0"),d=`${u}-${f}-${h}`;return new P.Literal(d,new Se.IRI("http://www.w3.org/2001/XMLSchema#date"))}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 isYearMonthDuration(e){return e instanceof P.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static dateTimeAddYearMonth(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new P.Literal(s.toISOString(),new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new P.Literal(s.toISOString(),new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=this.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"),h=`${l}-${u}-${f}`;return new P.Literal(h,new Se.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=this.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"),h=`${l}-${u}-${f}`;return new P.Literal(h,new Se.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseDayTimeDuration(r),a=this.parseDayTimeDuration(i),c=this.formatDayTimeDuration(s+a);return new P.Literal(c,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseDayTimeDuration(r),a=this.parseDayTimeDuration(i),c=this.formatDayTimeDuration(s-a);return new P.Literal(c,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof P.Literal?e.value:e,i=this.parseDayTimeDuration(r),s=this.formatDayTimeDuration(i*t);return new P.Literal(s,new Se.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 P.Literal?e.value:e,i=this.parseDayTimeDuration(r),s=this.formatDayTimeDuration(i/t);return new P.Literal(s,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}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 yearMonthDurationAdd(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseYearMonthDuration(r),a=this.parseYearMonthDuration(i),c=this.formatYearMonthDuration(s+a);return new P.Literal(c,new Se.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseYearMonthDuration(r),a=this.parseYearMonthDuration(i),c=this.formatYearMonthDuration(s-a);return new P.Literal(c,new Se.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}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 durationYears(e){let t=e instanceof P.Literal?e.value:e,r=this.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof P.Literal?e.value:e,r=this.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static durationToDays(e){let t=e instanceof P.Literal?e.value:e;return this.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof P.Literal?e.value:e;return this.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof P.Literal?e.value:e;return this.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof P.Literal?e.value:e;return this.parseDayTimeDuration(t)/1e3}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 h=u.match(/^(\d+(?:\.\d+)?)D$/);if(h)i=parseFloat(h[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let h=f,d=h.match(/^(\d+(?:\.\d+)?)H/);d&&(s=parseFloat(d[1]),h=h.substring(d[0].length));let p=h.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),h=h.substring(p[0].length));let y=h.match(/^(\d+(?:\.\d+)?)S$/);if(y&&(c=parseFloat(y[1]),h=h.substring(y[0].length)),h!=="")throw new Error(`parseDurationComponents: invalid time component: '${h}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}static durationDays(e){let t=e instanceof P.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof P.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof P.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof P.Literal?e.value:e,r=this.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static adjust(e,t){let r=e instanceof P.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(),H=String(i.getUTCMonth()+1).padStart(2,"0"),J=String(i.getUTCDate()).padStart(2,"0"),L=String(i.getUTCHours()).padStart(2,"0"),$=String(i.getUTCMinutes()).padStart(2,"0"),Z=String(i.getUTCSeconds()).padStart(2,"0"),qe=i.getUTCMilliseconds(),et=`${Te}-${H}-${J}T${L}:${$}:${Z}`;return qe>0&&(et+=`.${String(qe).padStart(3,"0")}`),new P.Literal(et,new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof P.Literal?t.value:t,a=this.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(),h=String(u.getUTCMonth()+1).padStart(2,"0"),d=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),y=String(u.getUTCMinutes()).padStart(2,"0"),w=String(u.getUTCSeconds()).padStart(2,"0"),T=u.getUTCMilliseconds(),S=a>=0?"+":"-",A=Math.floor(Math.abs(a)/(3600*1e3)),F=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),Q=`${S}${String(A).padStart(2,"0")}:${String(F).padStart(2,"0")}`,K=`${f}-${h}-${d}T${p}:${y}:${w}`;return T>0&&(K+=`.${String(T).padStart(3,"0")}`),K+=Q,new P.Literal(K,new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let r;if(e instanceof P.Literal)r=e.value;else if(e instanceof Se.IRI)r=e.value;else if(e instanceof Br.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 P.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Se.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!this.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 P.Literal(s,new Se.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 P.Literal)t=e.value;else if(e instanceof Se.IRI)t=e.value;else if(e instanceof Br.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=this.unicodeCaseFold(t);return new P.Literal(r,new Se.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=this.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}static isTime(e){return e instanceof P.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static timeDiff(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDTime(r),a=this.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=this.formatDayTimeDuration(c);return new P.Literal(l,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}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 h=c.padEnd(3,"0").slice(0,3);u=parseInt(h,10)}let f=i*60*60*1e3+s*60*1e3+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let h=l.match(/([+-])(\d{2}):(\d{2})/);if(h){let d=h[1]==="+"?1:-1,p=parseInt(h[2],10),y=parseInt(h[3],10),w=d*(p*60+y)*60*1e3;f-=w}}return f}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 P.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Se.IRI)){let c=t instanceof P.Literal?"Literal":t instanceof Br.BlankNode?"BlankNode":t instanceof Oo.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new Oo.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof Oo.QuotedTriple)){let t=e instanceof Se.IRI?"IRI":e instanceof P.Literal?"Literal":e instanceof Br.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 Oo.QuotedTriple)){let t=e instanceof Se.IRI?"IRI":e instanceof P.Literal?"Literal":e instanceof Br.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 Oo.QuotedTriple)){let t=e instanceof Se.IRI?"IRI":e instanceof P.Literal?"Literal":e instanceof Br.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};Lh.BuiltInFunctions=ml;ml.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];ml.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 iE=_(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var k=Mh();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 KS=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",KS);M.functionHandlers.set("isuri",KS);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 Ro=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"),XS=Ro(k.BuiltInFunctions.year.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationYears.bind(k.BuiltInFunctions),null);M.functionHandlers.set("year",XS);M.functionHandlers.set("years",XS);var JS=Ro(k.BuiltInFunctions.month.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationMonths.bind(k.BuiltInFunctions),null);M.functionHandlers.set("month",JS);M.functionHandlers.set("months",JS);var ZS=Ro(k.BuiltInFunctions.day.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationDays.bind(k.BuiltInFunctions));M.functionHandlers.set("day",ZS);M.functionHandlers.set("days",ZS);M.functionHandlers.set("hours",Ro(k.BuiltInFunctions.hours.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationHours.bind(k.BuiltInFunctions)));M.functionHandlers.set("minutes",Ro(k.BuiltInFunctions.minutes.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationMinutes.bind(k.BuiltInFunctions)));M.functionHandlers.set("seconds",Ro(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 eE=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",eE);M.functionHandlers.set("xsd:datetime",eE);var tE=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",tE);M.functionHandlers.set("xsd:integer",tE);var rE=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",rE);M.functionHandlers.set("xsd:decimal",rE);var nE=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",nE);M.functionHandlers.set("xsd:daytimeduration",nE);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)})});var jh=_(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.FilterExecutor=Po.FilterExecutorError=void 0;var gt=Mh(),N5=iE(),Ea=mt(),lr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Po.FilterExecutorError=lr;var i1=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.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison")return this.expressionContainsExists(e.left)||this.expressionContainsExists(e.right);if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(r=>this.expressionContainsExists(r))}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(r.termType)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":return r.value;case"NamedNode":return r.value;default:throw new lr(`Unsupported termType: ${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 lr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new lr(`Unsupported expression type: ${e.type}, expr.termType=${r.termType}`)}}async evaluateExpressionAsync(e,t){return e.type==="exists"?this.evaluateExists(e,t):e.type==="logical"?this.evaluateLogicalAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new lr("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let r=await this.existsEvaluator(e.pattern,t);return e.negated?!r:r}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let i=await this.evaluateExpressionAsync(e.operands[0],t);return gt.BuiltInFunctions.logicalNot(i)}let r=[];for(let i of e.operands){let s=await this.evaluateExpressionAsync(i,t);r.push(s)}if(e.operator==="&&")return gt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return gt.BuiltInFunctions.logicalOr(r);throw new lr(`Unknown logical operator: ${e.operator}`)}evaluateComparison(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return gt.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return gt.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return gt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return gt.BuiltInFunctions.logicalOr(r);throw new lr(`Unknown logical operator: ${e.operator}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let a=this.evaluateExpression(s,t);return gt.BuiltInFunctions.compare(r,a,"=")});return e.negated?!i:i}evaluateArithmetic(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(r)&&this.isDateValue(i))return gt.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return gt.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return gt.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return gt.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return gt.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new lr("Division by zero");return gt.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),a=this.toNumericValue(i);switch(e.operator){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":if(a===0)throw new lr("Division by zero");return s/a;default:throw new lr(`Unknown arithmetic operator: ${e.operator}`)}}isDayTimeDurationValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof Ea.Literal){let t=e.datatype?.value||"";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let i=parseFloat(e.value);if(!isNaN(i))return i}let r=parseFloat(e.value);if(!isNaN(r))return r}if(typeof e=="string"){let t=parseFloat(e);if(!isNaN(t))return t}if(e&&typeof e=="object"&&"value"in e){let t=parseFloat(String(e.value));if(!isNaN(t))return t}throw new lr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof Ea.Literal){let t=e.datatype?.value||"";return t.includes("#dateTime")||t.includes("#date")?!0:/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e.value)}return typeof e=="string"?/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e):!1}isDateValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let r=e,i=this.extractFunctionName(r.function),s=this.evaluateSpecialFunction(i,r.args,t);if(s!==void 0)return s.value;let a=N5.functionHandlers.get(i);if(!a)throw new lr(`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 lr(`Unknown function format: ${e}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let c of t)try{let l=this.evaluateExpression(c,r);if(l!=null)return{value:l}}catch{continue}return{value:void 0};case"if":if(!t||t.length!==3)throw new lr("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({args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof Ea.Literal){let t=e.datatype?.value||"";if(t.includes("#boolean"))return e.value==="true"||e.value==="1";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let r=parseFloat(e.value);return!isNaN(r)&&r!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new lr("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)}};Po.FilterExecutor=i1});var a1=_($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.OptionalExecutor=void 0;var s1=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),h=!1;if(f)for(let d of f){let p=l.merge(d);p!==null&&(yield p,h=!0)}h||(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)}}};$h.OptionalExecutor=s1});var c1=_(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.UnionExecutor=void 0;var o1=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("|")}};Vh.UnionExecutor=o1});var h1=_(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.ConstructExecutor=void 0;var k5=Si(),Ta=ze(),l1=mt(),u1=$t(),L5=Wc(),f1=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 k5.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 Ta.IRI(e.value);if(e.type==="literal")return new l1.Literal(e.value,e.datatype?new Ta.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new u1.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 L5.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 l1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new Ta.IRI(e.value);if(e.type==="blank")return new u1.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 Ta.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new Ta.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 Ta.IRI(e.value);if(e.type==="blank")return new u1.BlankNode(e.value);if(e.type==="literal")return new l1.Literal(e.value,e.datatype?new Ta.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}`)}};Uh.ConstructExecutor=f1});var aE=_(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.DescribeExecutor=void 0;var sE=ze(),d1=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 d=await this.tripleStore.match(void 0,void 0,e);u.push(...d)}let h=[];for(let d of u){let p=`${d.subject.toString()}|${d.predicate.toString()}|${d.object.toString()}`;a.has(p)||(a.add(p),s.push(d),(t===void 0||r<t)&&(this.isIRI(d.subject)&&d.subject.toString()!==l&&h.push(d.subject),this.isIRI(d.object)&&d.object.toString()!==l&&h.push(d.object)))}for(let d of h)await this.describeResourceWithDepth(d,t,r+1,i,s,a,c)}isIRI(e){return e?e instanceof sE.IRI||e.termType==="NamedNode"||typeof e.value=="string"&&e.value.startsWith("http"):!1}async describeByIRI(e,t){let r=new sE.IRI(e);return this.execute([r],t)}};Bh.DescribeExecutor=d1});var oE=_(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.MinusExecutor=void 0;var p1=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}};qh.MinusExecutor=p1});var lE=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.ValuesExecutor=Fo.ValuesExecutorError=void 0;var M5=as(),cE=ze(),j5=mt(),Wh=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Fo.ValuesExecutorError=Wh;var m1=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 M5.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 cE.IRI(e.value);if(e.type==="literal")return new j5.Literal(e.value,e.datatype?new cE.IRI(e.datatype):void 0,e.language,e.direction);throw new Wh(`Unknown term type: ${e.type}`)}};Fo.ValuesExecutor=m1});var g1=_(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.CustomAggregateRegistry=No.CustomAggregateError=void 0;var Do=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};No.CustomAggregateError=Do;var Gh=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 Do("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new Do("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new Do(`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}};No.CustomAggregateRegistry=Gh;Gh.instance=null});var y1=_(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.BUILT_IN_AGGREGATES=Qe.modeAggregate=Qe.stddevAggregate=Qe.varianceAggregate=Qe.medianAggregate=Qe.EXO_AGGREGATE_NS=void 0;Qe.getNumericValue=Hh;Qe.createDecimalLiteral=ii;Qe.createDoubleLiteral=U5;Qe.createPercentileAggregate=xa;var Aa=mt(),ko=ze(),$5=new ko.IRI("http://www.w3.org/2001/XMLSchema#decimal"),V5=new ko.IRI("http://www.w3.org/2001/XMLSchema#double");Qe.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Hh(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof Aa.Literal?parseFloat(n.value):n instanceof ko.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(Hh,"getNumericValue");function ii(n){return new Aa.Literal(String(n),$5)}o(ii,"createDecimalLiteral");function U5(n){return new Aa.Literal(String(n),V5)}o(U5,"createDoubleLiteral");Qe.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Hh(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ii(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 ii(s)}};Qe.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Hh(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ii(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 ii(i)}};Qe.stddevAggregate={init(){return{values:[]}},step(n,e){Qe.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ii(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 ii(Math.sqrt(i))}};Qe.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof Aa.Literal||e instanceof ko.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 Aa.Literal(" ",new ko.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 Aa.Literal)return i;let s=parseFloat(t);return isNaN(s)?new Aa.Literal(t,new ko.IRI("http://www.w3.org/2001/XMLSchema#string")):ii(s)}};function xa(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=Hh(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return ii(0);let s=[...i].sort((h,d)=>h-d),a=r.percentile*(s.length-1),c=Math.floor(a),l=Math.ceil(a);if(c===l)return ii(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return ii(f)}}}o(xa,"createPercentileAggregate");Qe.BUILT_IN_AGGREGATES={[`${Qe.EXO_AGGREGATE_NS}median`]:Qe.medianAggregate,[`${Qe.EXO_AGGREGATE_NS}variance`]:Qe.varianceAggregate,[`${Qe.EXO_AGGREGATE_NS}stddev`]:Qe.stddevAggregate,[`${Qe.EXO_AGGREGATE_NS}mode`]:Qe.modeAggregate,[`${Qe.EXO_AGGREGATE_NS}percentile25`]:xa(25),[`${Qe.EXO_AGGREGATE_NS}percentile50`]:xa(50),[`${Qe.EXO_AGGREGATE_NS}percentile75`]:xa(75),[`${Qe.EXO_AGGREGATE_NS}percentile90`]:xa(90),[`${Qe.EXO_AGGREGATE_NS}percentile95`]:xa(95),[`${Qe.EXO_AGGREGATE_NS}percentile99`]:xa(99)}});var hE=_(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.AggregateExecutor=Lo.AggregateExecutorError=void 0;var Ut=mt(),_1=ze(),B5=jh(),q5=g1(),W5=y1(),uE=new _1.IRI("http://www.w3.org/2001/XMLSchema#integer"),Ca=new _1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),Oi=new _1.IRI("http://www.w3.org/2001/XMLSchema#string");function fE(n){return typeof n=="object"&&n.type==="custom"}o(fE,"isCustomAggregation");var gl=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Lo.AggregateExecutorError=gl;var v1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new B5.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 h=a[0].get(f);h&&c.set(f,h)}for(let f of e.aggregates){let h=this.computeAggregate(f.expression,a);c.set(f.variable,h)}let{SolutionMapping:l}=as(),u=new l;for(let[f,h]of c.entries())u.set(f,h);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(fE(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 Ut.Literal(String(s),uE)}case"sum":{let s=this.computeSum(r);return new Ut.Literal(String(s),Ca)}case"avg":{let s=this.computeAvg(r);return new Ut.Literal(String(s),Ca)}case"min":{let s=this.computeMin(r);return s===void 0?new Ut.Literal("",Oi):typeof s=="number"?new Ut.Literal(String(s),Ca):new Ut.Literal(String(s),Oi)}case"max":{let s=this.computeMax(r);return s===void 0?new Ut.Literal("",Oi):typeof s=="number"?new Ut.Literal(String(s),Ca):new Ut.Literal(String(s),Oi)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new Ut.Literal(s||" ",Oi)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new Ut.Literal(" ",Oi):typeof s=="number"?new Ut.Literal(String(s),Ca):new Ut.Literal(String(s),Oi)}default:{let s=i;throw new gl(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=q5.CustomAggregateRegistry.getInstance().get(i);if(a||(a=W5.BUILT_IN_AGGREGATES[i]),!a)throw new gl(`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}=as(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(fE(s)){r.set(i.variable,new Ut.Literal("0",Ca));continue}switch(s){case"count":r.set(i.variable,new Ut.Literal("0",uE));break;case"sum":case"avg":r.set(i.variable,new Ut.Literal("0",Ca));break;case"group_concat":r.set(i.variable,new Ut.Literal(" ",Oi));break;case"min":case"max":case"sample":r.set(i.variable,new Ut.Literal("",Oi));break;default:r.set(i.variable,new Ut.Literal("",Oi))}}return r}};Lo.AggregateExecutor=v1});var pE=_(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ServiceExecutor=Mo.ServiceExecutorError=void 0;var G5=as(),dE=ze(),H5=mt(),z5=$t(),Ia=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Mo.ServiceExecutorError=Ia;var w1=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 Ia(`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 Ia(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Ia(`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 G5.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 dE.IRI(e.value);case"literal":{let t=e.datatype?new dE.IRI(e.datatype):void 0;return new H5.Literal(e.value,t,e["xml:lang"])}case"bnode":return new z5.BlankNode(e.value);default:throw new Ia(`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))}};Mo.ServiceExecutor=w1});var gE=_(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.GraphExecutor=jo.GraphExecutorError=void 0;var mE=ze(),zh=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};jo.GraphExecutorError=zh;var b1=class{static{o(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,r){let i=e.name;if(i.type==="iri")yield*this.executeWithGraph(e.pattern,i,t);else if(i.type==="variable")yield*this.executeWithGraphVariable(e,i,t,r);else throw new zh(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new mE.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 mE.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}}};jo.GraphExecutor=b1});var yE=_(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.SPARQLGenerator=Vo.SPARQLGeneratorError=void 0;var $o=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Vo.SPARQLGeneratorError=$o;var S1=class{static{o(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
311
|
+
${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)}};Rh.AlgebraSerializer=Xy});var as=_(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.SolutionMapping=void 0;var GS=mt(),HS=ze(),zS=$t(),Jy=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 GS.Literal&&t instanceof GS.Literal?e.equals(t):e instanceof HS.IRI&&t instanceof HS.IRI?e.value===t.value:e instanceof zS.BlankNode&&t instanceof zS.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}};Ph.SolutionMapping=Jy});var YS=_(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.PropertyPathExecutor=Co.PropertyPathExecutorError=void 0;var F5=as(),Fh=ze(),QS=$t(),pl=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Co.PropertyPathExecutorError=pl;var Zy=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new F5.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 pl("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 h of f)l.add(h)}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 Fh.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let{node:c,depth:l}=a.shift();if(l>=this.MAX_DEPTH)continue;let u=await this.evaluatePathItem(c,t,null);for(let f of u){let h=this.nodeToKey(f);(r===null||this.nodeInSet(f,r))&&s.add(f),i.has(h)||(i.add(h),a.push({node:f,depth:l+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new Fh.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"|":return{type:"path",pathType:"|",items:e.items.map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"+":case"*":case"?":let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new Fh.IRI(e.value));break;case"blank":t.add(new QS.BlankNode(e.value));break;default:throw new pl(`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 Fh.IRI)return{type:"iri",value:r.value};if(r instanceof QS.BlankNode)return{type:"blank",value:r.id}}}return e}isVariable(e){return e.type==="variable"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};Co.PropertyPathExecutor=Zy});var r1=_(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.BGPExecutor=Io.BGPExecutorError=void 0;var Dh=as(),Ps=ze(),e1=mt(),Nh=$t(),kh=Wc(),D5=YS(),Er=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Io.BGPExecutorError=Er;var t1=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new D5.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new Dh.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 Dh.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 Er("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r))return;let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new Er("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 Dh.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t))return;let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new Dh.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,h]of u.entries())l.set(f,h)}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,h]of u.entries())l.set(f,h)}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 kh.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 Ps.IRI&&e.value===t.value;case"literal":return!(!(t instanceof e1.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof Nh.BlankNode&&e.value===t.id;case"quoted":return t instanceof kh.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 Ps.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Ps.IRI(e.value);case"blank":return new Nh.BlankNode(e.value);case"literal":throw new Er("Literals cannot appear in subject position");case"variable":throw new Er(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Er(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new Ps.IRI(e.predicate.value):(()=>{throw new Er("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new kh.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Ps.IRI(e.value);case"literal":throw new Er("Literals cannot appear in predicate position");case"blank":throw new Er("Blank nodes cannot appear in predicate position");case"variable":throw new Er(`Cannot convert variable to RDF term: ${e.value}`);default:throw new Er(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Ps.IRI(e.value);case"literal":return new e1.Literal(e.value,e.datatype?new Ps.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new Nh.BlankNode(e.value);case"variable":throw new Er(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Er(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof Ps.IRI)return{type:"iri",value:e.value};if(e instanceof e1.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof Nh.BlankNode)return{type:"blank",value:e.id};if(e instanceof kh.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new Er(`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)}}};Io.BGPExecutor=t1});var Mh=_(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.BuiltInFunctions=void 0;var Se=ze(),P=mt(),Br=$t(),Oo=Wc(),n1=Lr(),ml=class{static{o(this,"BuiltInFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Se.IRI||e instanceof P.Literal?e.value:e instanceof Br.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof P.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof P.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=this.parseDirectionalLangTag(e),[s,a]=this.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 datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof P.Literal)return e.datatype?e.datatype:e.language?new Se.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Se.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 Se.IRI}static isBlank(e){return e===void 0?!1:e instanceof Br.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof P.Literal}static isTriple(e){return e===void 0?!1:e instanceof Oo.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof P.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof P.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 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 compare(e,t,r){if(this.isDayTimeDurationValue(e)&&this.isDayTimeDurationValue(t))return this.compareDurations(e instanceof P.Literal?e:String(e),t instanceof P.Literal?t:String(t),r);if(this.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return this.compareDurations(e instanceof P.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&this.isDayTimeDurationValue(t))return this.compareDurations(e,t instanceof P.Literal?t:String(t),r);let i=this.toComparableValue(e),s=this.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 P.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 P.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 this.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof Se.IRI?e.value:e instanceof Br.BlankNode?e.id:String(e)}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 parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static dateBefore(e,t){let r=this.parseDate(e),i=this.parseDate(t);return r<i}static dateAfter(e,t){let r=this.parseDate(e),i=this.parseDate(t);return r>i}static dateInRange(e,t,r){let i=this.parseDate(e),s=this.parseDate(t),a=this.parseDate(r);return i>=s&&i<=a}static dateDiffMinutes(e,t){let r=this.parseDate(e),i=this.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=this.parseDate(e),i=this.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}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 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 P.Literal(r,new Se.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 now(){return new Date().toISOString()}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()}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,r){return e?t:r}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new P.Literal(t.toISOString(),new Se.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 P.Literal(String(t),new Se.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 P.Literal(String(t),new Se.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static encodeForUri(e){return encodeURIComponent(e)}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")}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 Se.IRI&&t instanceof Se.IRI)return e.value===t.value;if(e instanceof Br.BlankNode&&t instanceof Br.BlankNode)return e.id===t.id;if(e instanceof P.Literal&&t instanceof P.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 Se.IRI)return e;if(e instanceof P.Literal)return new Se.IRI(e.value);throw e instanceof Br.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return this.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,n1.v4)().replace(/-/g,"").substring(0,12)}`;return new Br.BlankNode(t)}if(e instanceof P.Literal)return new Br.BlankNode(e.value);if(e instanceof Br.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 P.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 Se.IRI)i=t;else if(t instanceof P.Literal)i=new Se.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new P.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 P.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 P.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 P.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 P.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 P.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 P.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 P.Literal(i,void 0,s,a)}static uuid(){let e=(0,n1.v4)();return new Se.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,n1.v4)();return new P.Literal(e)}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 d=parseFloat(u[1]);i+=d*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let d=parseFloat(f[1]);i+=d*60*1e3,l=l.substring(f[0].length)}let h=l.match(/^(\d+(?:\.\d+)?)S$/);if(h){let d=parseFloat(h[1]);i+=d*1e3,l=l.substring(h[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 this.parseDayTimeDuration(e),new P.Literal(e,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static compareDurations(e,t,r){let i=e instanceof P.Literal?e.value:e,s=t instanceof P.Literal?t.value:t,a=this.parseDayTimeDuration(i),c=this.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 isDayTimeDuration(e){return e instanceof P.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof P.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static dateDiff(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r),a=this.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=this.formatDateDuration(l);return new P.Literal(u,new Se.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,h=parseInt(u[2],10),d=parseInt(u[3],10),p=f*(h*60+d)*60*1e3;l=new Date(l.getTime()-p)}}return l}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 dateTimeDiff(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.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=this.formatDayTimeDuration(c);return new P.Literal(l,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new P.Literal(l.toISOString(),new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new P.Literal(l.toISOString(),new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),h=String(l.getUTCDate()).padStart(2,"0"),d=`${u}-${f}-${h}`;return new P.Literal(d,new Se.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),h=String(l.getUTCDate()).padStart(2,"0"),d=`${u}-${f}-${h}`;return new P.Literal(d,new Se.IRI("http://www.w3.org/2001/XMLSchema#date"))}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 isYearMonthDuration(e){return e instanceof P.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static dateTimeAddYearMonth(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new P.Literal(s.toISOString(),new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new P.Literal(s.toISOString(),new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=this.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"),h=`${l}-${u}-${f}`;return new P.Literal(h,new Se.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=this.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"),h=`${l}-${u}-${f}`;return new P.Literal(h,new Se.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseDayTimeDuration(r),a=this.parseDayTimeDuration(i),c=this.formatDayTimeDuration(s+a);return new P.Literal(c,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseDayTimeDuration(r),a=this.parseDayTimeDuration(i),c=this.formatDayTimeDuration(s-a);return new P.Literal(c,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof P.Literal?e.value:e,i=this.parseDayTimeDuration(r),s=this.formatDayTimeDuration(i*t);return new P.Literal(s,new Se.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 P.Literal?e.value:e,i=this.parseDayTimeDuration(r),s=this.formatDayTimeDuration(i/t);return new P.Literal(s,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}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 yearMonthDurationAdd(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseYearMonthDuration(r),a=this.parseYearMonthDuration(i),c=this.formatYearMonthDuration(s+a);return new P.Literal(c,new Se.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseYearMonthDuration(r),a=this.parseYearMonthDuration(i),c=this.formatYearMonthDuration(s-a);return new P.Literal(c,new Se.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}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 durationYears(e){let t=e instanceof P.Literal?e.value:e,r=this.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof P.Literal?e.value:e,r=this.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static durationToDays(e){let t=e instanceof P.Literal?e.value:e;return this.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof P.Literal?e.value:e;return this.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof P.Literal?e.value:e;return this.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof P.Literal?e.value:e;return this.parseDayTimeDuration(t)/1e3}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 h=u.match(/^(\d+(?:\.\d+)?)D$/);if(h)i=parseFloat(h[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let h=f,d=h.match(/^(\d+(?:\.\d+)?)H/);d&&(s=parseFloat(d[1]),h=h.substring(d[0].length));let p=h.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),h=h.substring(p[0].length));let y=h.match(/^(\d+(?:\.\d+)?)S$/);if(y&&(c=parseFloat(y[1]),h=h.substring(y[0].length)),h!=="")throw new Error(`parseDurationComponents: invalid time component: '${h}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}static durationDays(e){let t=e instanceof P.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof P.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof P.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof P.Literal?e.value:e,r=this.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static adjust(e,t){let r=e instanceof P.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(),H=String(i.getUTCMonth()+1).padStart(2,"0"),J=String(i.getUTCDate()).padStart(2,"0"),L=String(i.getUTCHours()).padStart(2,"0"),$=String(i.getUTCMinutes()).padStart(2,"0"),Z=String(i.getUTCSeconds()).padStart(2,"0"),qe=i.getUTCMilliseconds(),et=`${Te}-${H}-${J}T${L}:${$}:${Z}`;return qe>0&&(et+=`.${String(qe).padStart(3,"0")}`),new P.Literal(et,new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof P.Literal?t.value:t,a=this.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(),h=String(u.getUTCMonth()+1).padStart(2,"0"),d=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),y=String(u.getUTCMinutes()).padStart(2,"0"),w=String(u.getUTCSeconds()).padStart(2,"0"),T=u.getUTCMilliseconds(),S=a>=0?"+":"-",x=Math.floor(Math.abs(a)/(3600*1e3)),F=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),Q=`${S}${String(x).padStart(2,"0")}:${String(F).padStart(2,"0")}`,K=`${f}-${h}-${d}T${p}:${y}:${w}`;return T>0&&(K+=`.${String(T).padStart(3,"0")}`),K+=Q,new P.Literal(K,new Se.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let r;if(e instanceof P.Literal)r=e.value;else if(e instanceof Se.IRI)r=e.value;else if(e instanceof Br.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 P.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Se.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!this.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 P.Literal(s,new Se.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 P.Literal)t=e.value;else if(e instanceof Se.IRI)t=e.value;else if(e instanceof Br.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=this.unicodeCaseFold(t);return new P.Literal(r,new Se.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=this.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}static isTime(e){return e instanceof P.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static timeDiff(e,t){let r=e instanceof P.Literal?e.value:e,i=t instanceof P.Literal?t.value:t,s=this.parseXSDTime(r),a=this.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=this.formatDayTimeDuration(c);return new P.Literal(l,new Se.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}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 h=c.padEnd(3,"0").slice(0,3);u=parseInt(h,10)}let f=i*60*60*1e3+s*60*1e3+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let h=l.match(/([+-])(\d{2}):(\d{2})/);if(h){let d=h[1]==="+"?1:-1,p=parseInt(h[2],10),y=parseInt(h[3],10),w=d*(p*60+y)*60*1e3;f-=w}}return f}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 P.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Se.IRI)){let c=t instanceof P.Literal?"Literal":t instanceof Br.BlankNode?"BlankNode":t instanceof Oo.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new Oo.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof Oo.QuotedTriple)){let t=e instanceof Se.IRI?"IRI":e instanceof P.Literal?"Literal":e instanceof Br.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 Oo.QuotedTriple)){let t=e instanceof Se.IRI?"IRI":e instanceof P.Literal?"Literal":e instanceof Br.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 Oo.QuotedTriple)){let t=e instanceof Se.IRI?"IRI":e instanceof P.Literal?"Literal":e instanceof Br.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};Lh.BuiltInFunctions=ml;ml.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];ml.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 iE=_(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var k=Mh();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 KS=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",KS);M.functionHandlers.set("isuri",KS);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 Ro=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"),XS=Ro(k.BuiltInFunctions.year.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationYears.bind(k.BuiltInFunctions),null);M.functionHandlers.set("year",XS);M.functionHandlers.set("years",XS);var JS=Ro(k.BuiltInFunctions.month.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationMonths.bind(k.BuiltInFunctions),null);M.functionHandlers.set("month",JS);M.functionHandlers.set("months",JS);var ZS=Ro(k.BuiltInFunctions.day.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationDays.bind(k.BuiltInFunctions));M.functionHandlers.set("day",ZS);M.functionHandlers.set("days",ZS);M.functionHandlers.set("hours",Ro(k.BuiltInFunctions.hours.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationHours.bind(k.BuiltInFunctions)));M.functionHandlers.set("minutes",Ro(k.BuiltInFunctions.minutes.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationMinutes.bind(k.BuiltInFunctions)));M.functionHandlers.set("seconds",Ro(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 eE=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",eE);M.functionHandlers.set("xsd:datetime",eE);var tE=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",tE);M.functionHandlers.set("xsd:integer",tE);var rE=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",rE);M.functionHandlers.set("xsd:decimal",rE);var nE=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",nE);M.functionHandlers.set("xsd:daytimeduration",nE);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)})});var jh=_(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.FilterExecutor=Po.FilterExecutorError=void 0;var gt=Mh(),N5=iE(),Ea=mt(),lr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Po.FilterExecutorError=lr;var i1=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.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison")return this.expressionContainsExists(e.left)||this.expressionContainsExists(e.right);if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(r=>this.expressionContainsExists(r))}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(r.termType)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":return r.value;case"NamedNode":return r.value;default:throw new lr(`Unsupported termType: ${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 lr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new lr(`Unsupported expression type: ${e.type}, expr.termType=${r.termType}`)}}async evaluateExpressionAsync(e,t){return e.type==="exists"?this.evaluateExists(e,t):e.type==="logical"?this.evaluateLogicalAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new lr("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let r=await this.existsEvaluator(e.pattern,t);return e.negated?!r:r}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let i=await this.evaluateExpressionAsync(e.operands[0],t);return gt.BuiltInFunctions.logicalNot(i)}let r=[];for(let i of e.operands){let s=await this.evaluateExpressionAsync(i,t);r.push(s)}if(e.operator==="&&")return gt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return gt.BuiltInFunctions.logicalOr(r);throw new lr(`Unknown logical operator: ${e.operator}`)}evaluateComparison(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return gt.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return gt.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return gt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return gt.BuiltInFunctions.logicalOr(r);throw new lr(`Unknown logical operator: ${e.operator}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let a=this.evaluateExpression(s,t);return gt.BuiltInFunctions.compare(r,a,"=")});return e.negated?!i:i}evaluateArithmetic(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(r)&&this.isDateValue(i))return gt.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return gt.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return gt.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return gt.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return gt.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return gt.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new lr("Division by zero");return gt.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return gt.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),a=this.toNumericValue(i);switch(e.operator){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":if(a===0)throw new lr("Division by zero");return s/a;default:throw new lr(`Unknown arithmetic operator: ${e.operator}`)}}isDayTimeDurationValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof Ea.Literal){let t=e.datatype?.value||"";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let i=parseFloat(e.value);if(!isNaN(i))return i}let r=parseFloat(e.value);if(!isNaN(r))return r}if(typeof e=="string"){let t=parseFloat(e);if(!isNaN(t))return t}if(e&&typeof e=="object"&&"value"in e){let t=parseFloat(String(e.value));if(!isNaN(t))return t}throw new lr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof Ea.Literal){let t=e.datatype?.value||"";return t.includes("#dateTime")||t.includes("#date")?!0:/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e.value)}return typeof e=="string"?/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e):!1}isDateValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof Ea.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let r=e,i=this.extractFunctionName(r.function),s=this.evaluateSpecialFunction(i,r.args,t);if(s!==void 0)return s.value;let a=N5.functionHandlers.get(i);if(!a)throw new lr(`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 lr(`Unknown function format: ${e}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let c of t)try{let l=this.evaluateExpression(c,r);if(l!=null)return{value:l}}catch{continue}return{value:void 0};case"if":if(!t||t.length!==3)throw new lr("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({args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof Ea.Literal){let t=e.datatype?.value||"";if(t.includes("#boolean"))return e.value==="true"||e.value==="1";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let r=parseFloat(e.value);return!isNaN(r)&&r!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new lr("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)}};Po.FilterExecutor=i1});var a1=_($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.OptionalExecutor=void 0;var s1=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),h=!1;if(f)for(let d of f){let p=l.merge(d);p!==null&&(yield p,h=!0)}h||(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)}}};$h.OptionalExecutor=s1});var c1=_(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.UnionExecutor=void 0;var o1=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("|")}};Vh.UnionExecutor=o1});var h1=_(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.ConstructExecutor=void 0;var k5=Si(),Ta=ze(),l1=mt(),u1=$t(),L5=Wc(),f1=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 k5.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 Ta.IRI(e.value);if(e.type==="literal")return new l1.Literal(e.value,e.datatype?new Ta.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new u1.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 L5.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 l1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new Ta.IRI(e.value);if(e.type==="blank")return new u1.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 Ta.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new Ta.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 Ta.IRI(e.value);if(e.type==="blank")return new u1.BlankNode(e.value);if(e.type==="literal")return new l1.Literal(e.value,e.datatype?new Ta.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}`)}};Uh.ConstructExecutor=f1});var aE=_(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.DescribeExecutor=void 0;var sE=ze(),d1=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 d=await this.tripleStore.match(void 0,void 0,e);u.push(...d)}let h=[];for(let d of u){let p=`${d.subject.toString()}|${d.predicate.toString()}|${d.object.toString()}`;a.has(p)||(a.add(p),s.push(d),(t===void 0||r<t)&&(this.isIRI(d.subject)&&d.subject.toString()!==l&&h.push(d.subject),this.isIRI(d.object)&&d.object.toString()!==l&&h.push(d.object)))}for(let d of h)await this.describeResourceWithDepth(d,t,r+1,i,s,a,c)}isIRI(e){return e?e instanceof sE.IRI||e.termType==="NamedNode"||typeof e.value=="string"&&e.value.startsWith("http"):!1}async describeByIRI(e,t){let r=new sE.IRI(e);return this.execute([r],t)}};Bh.DescribeExecutor=d1});var oE=_(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.MinusExecutor=void 0;var p1=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}};qh.MinusExecutor=p1});var lE=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.ValuesExecutor=Fo.ValuesExecutorError=void 0;var M5=as(),cE=ze(),j5=mt(),Wh=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Fo.ValuesExecutorError=Wh;var m1=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 M5.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 cE.IRI(e.value);if(e.type==="literal")return new j5.Literal(e.value,e.datatype?new cE.IRI(e.datatype):void 0,e.language,e.direction);throw new Wh(`Unknown term type: ${e.type}`)}};Fo.ValuesExecutor=m1});var g1=_(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.CustomAggregateRegistry=No.CustomAggregateError=void 0;var Do=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};No.CustomAggregateError=Do;var Gh=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 Do("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new Do("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new Do(`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}};No.CustomAggregateRegistry=Gh;Gh.instance=null});var y1=_(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.BUILT_IN_AGGREGATES=Qe.modeAggregate=Qe.stddevAggregate=Qe.varianceAggregate=Qe.medianAggregate=Qe.EXO_AGGREGATE_NS=void 0;Qe.getNumericValue=Hh;Qe.createDecimalLiteral=ii;Qe.createDoubleLiteral=U5;Qe.createPercentileAggregate=xa;var Aa=mt(),ko=ze(),$5=new ko.IRI("http://www.w3.org/2001/XMLSchema#decimal"),V5=new ko.IRI("http://www.w3.org/2001/XMLSchema#double");Qe.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Hh(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof Aa.Literal?parseFloat(n.value):n instanceof ko.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(Hh,"getNumericValue");function ii(n){return new Aa.Literal(String(n),$5)}o(ii,"createDecimalLiteral");function U5(n){return new Aa.Literal(String(n),V5)}o(U5,"createDoubleLiteral");Qe.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Hh(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ii(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 ii(s)}};Qe.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Hh(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ii(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 ii(i)}};Qe.stddevAggregate={init(){return{values:[]}},step(n,e){Qe.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ii(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 ii(Math.sqrt(i))}};Qe.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof Aa.Literal||e instanceof ko.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 Aa.Literal(" ",new ko.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 Aa.Literal)return i;let s=parseFloat(t);return isNaN(s)?new Aa.Literal(t,new ko.IRI("http://www.w3.org/2001/XMLSchema#string")):ii(s)}};function xa(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=Hh(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return ii(0);let s=[...i].sort((h,d)=>h-d),a=r.percentile*(s.length-1),c=Math.floor(a),l=Math.ceil(a);if(c===l)return ii(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return ii(f)}}}o(xa,"createPercentileAggregate");Qe.BUILT_IN_AGGREGATES={[`${Qe.EXO_AGGREGATE_NS}median`]:Qe.medianAggregate,[`${Qe.EXO_AGGREGATE_NS}variance`]:Qe.varianceAggregate,[`${Qe.EXO_AGGREGATE_NS}stddev`]:Qe.stddevAggregate,[`${Qe.EXO_AGGREGATE_NS}mode`]:Qe.modeAggregate,[`${Qe.EXO_AGGREGATE_NS}percentile25`]:xa(25),[`${Qe.EXO_AGGREGATE_NS}percentile50`]:xa(50),[`${Qe.EXO_AGGREGATE_NS}percentile75`]:xa(75),[`${Qe.EXO_AGGREGATE_NS}percentile90`]:xa(90),[`${Qe.EXO_AGGREGATE_NS}percentile95`]:xa(95),[`${Qe.EXO_AGGREGATE_NS}percentile99`]:xa(99)}});var hE=_(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.AggregateExecutor=Lo.AggregateExecutorError=void 0;var Ut=mt(),_1=ze(),B5=jh(),q5=g1(),W5=y1(),uE=new _1.IRI("http://www.w3.org/2001/XMLSchema#integer"),Ca=new _1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),Oi=new _1.IRI("http://www.w3.org/2001/XMLSchema#string");function fE(n){return typeof n=="object"&&n.type==="custom"}o(fE,"isCustomAggregation");var gl=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Lo.AggregateExecutorError=gl;var v1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new B5.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 h=a[0].get(f);h&&c.set(f,h)}for(let f of e.aggregates){let h=this.computeAggregate(f.expression,a);c.set(f.variable,h)}let{SolutionMapping:l}=as(),u=new l;for(let[f,h]of c.entries())u.set(f,h);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(fE(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 Ut.Literal(String(s),uE)}case"sum":{let s=this.computeSum(r);return new Ut.Literal(String(s),Ca)}case"avg":{let s=this.computeAvg(r);return new Ut.Literal(String(s),Ca)}case"min":{let s=this.computeMin(r);return s===void 0?new Ut.Literal("",Oi):typeof s=="number"?new Ut.Literal(String(s),Ca):new Ut.Literal(String(s),Oi)}case"max":{let s=this.computeMax(r);return s===void 0?new Ut.Literal("",Oi):typeof s=="number"?new Ut.Literal(String(s),Ca):new Ut.Literal(String(s),Oi)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new Ut.Literal(s||" ",Oi)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new Ut.Literal(" ",Oi):typeof s=="number"?new Ut.Literal(String(s),Ca):new Ut.Literal(String(s),Oi)}default:{let s=i;throw new gl(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=q5.CustomAggregateRegistry.getInstance().get(i);if(a||(a=W5.BUILT_IN_AGGREGATES[i]),!a)throw new gl(`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}=as(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(fE(s)){r.set(i.variable,new Ut.Literal("0",Ca));continue}switch(s){case"count":r.set(i.variable,new Ut.Literal("0",uE));break;case"sum":case"avg":r.set(i.variable,new Ut.Literal("0",Ca));break;case"group_concat":r.set(i.variable,new Ut.Literal(" ",Oi));break;case"min":case"max":case"sample":r.set(i.variable,new Ut.Literal("",Oi));break;default:r.set(i.variable,new Ut.Literal("",Oi))}}return r}};Lo.AggregateExecutor=v1});var pE=_(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ServiceExecutor=Mo.ServiceExecutorError=void 0;var G5=as(),dE=ze(),H5=mt(),z5=$t(),Ia=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Mo.ServiceExecutorError=Ia;var w1=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 Ia(`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 Ia(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Ia(`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 G5.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 dE.IRI(e.value);case"literal":{let t=e.datatype?new dE.IRI(e.datatype):void 0;return new H5.Literal(e.value,t,e["xml:lang"])}case"bnode":return new z5.BlankNode(e.value);default:throw new Ia(`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))}};Mo.ServiceExecutor=w1});var gE=_(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.GraphExecutor=jo.GraphExecutorError=void 0;var mE=ze(),zh=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};jo.GraphExecutorError=zh;var b1=class{static{o(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,r){let i=e.name;if(i.type==="iri")yield*this.executeWithGraph(e.pattern,i,t);else if(i.type==="variable")yield*this.executeWithGraphVariable(e,i,t,r);else throw new zh(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new mE.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 mE.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}}};jo.GraphExecutor=b1});var yE=_(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.SPARQLGenerator=Vo.SPARQLGeneratorError=void 0;var $o=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Vo.SPARQLGeneratorError=$o;var S1=class{static{o(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
312
312
|
${i}
|
|
313
313
|
}`}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)}
|
|
314
314
|
${r}FILTER(${this.generateExpression(e.expression)})`;case"join":return`${this.generateWhereClause(e.left,t)}
|
|
@@ -334,7 +334,7 @@ ${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.
|
|
|
334
334
|
`)}termToXML(e){return e instanceof Zh.IRI?`<uri>${this.escapeXML(e.value)}</uri>`:e instanceof ed.BlankNode?`<bnode>${this.escapeXML(e.id)}</bnode>`:e instanceof Jh.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(`
|
|
335
335
|
`)}termToCSV(e){return e instanceof Zh.IRI?e.value:e instanceof ed.BlankNode?`_:${e.id}`:e instanceof Jh.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(`
|
|
336
336
|
`).trimEnd()}termToTurtle(e){return e instanceof Zh.IRI?`<${e.value}>`:e instanceof ed.BlankNode?`_:${e.id}`:e instanceof Jh.Literal?e.toString():`"${String(e)}"`}escapeXML(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}escapeCSV(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
337
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}};td.ResultSerializer=O1});var CE=_(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.FileAlreadyExistsError=Wo.FileNotFoundError=void 0;var R1=class extends Error{static{o(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};Wo.FileNotFoundError=R1;var P1=class extends Error{static{o(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};Wo.FileAlreadyExistsError=P1});var IE=_(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.container=void 0;Ps.registerCoreServices=B9;Ps.createChildContainer=q9;Ps.getContainer=W9;Ps.resetContainer=G9;Vu();var _l=Ue();Object.defineProperty(Ps,"container",{enumerable:!0,get:o(function(){return _l.container},"get")});var yt=ht(),g9=Kg(),y9=Mf(),v9=j0(),_9=jf(),w9=R0(),b9=Jg(),S9=m0(),E9=d0(),T9=Kf(),x9=Xf(),A9=x0(),C9=C0(),I9=F0(),O9=E0(),R9=V0(),P9=W0(),F9=B0(),D9=_0(),N9=b0(),k9=L0(),L9=N0(),M9=by(),j9=y0(),$9=z0(),V9=Y0(),U9=sy();function B9(n){let e=n||_l.container;e.registerSingleton(yt.DI_TOKENS.TaskFrontmatterGenerator,y9.TaskFrontmatterGenerator),e.registerSingleton(yt.DI_TOKENS.DynamicFrontmatterGenerator,v9.DynamicFrontmatterGenerator),e.registerSingleton(yt.DI_TOKENS.AlgorithmExtractor,_9.AlgorithmExtractor),e.registerSingleton(yt.DI_TOKENS.EffortStatusWorkflow,T9.EffortStatusWorkflow),e.registerSingleton(yt.DI_TOKENS.StatusTimestampService,x9.StatusTimestampService),e.registerSingleton(yt.DI_TOKENS.TaskStatusService,E9.TaskStatusService),e.registerSingleton(yt.DI_TOKENS.TaskCreationService,g9.TaskCreationService),e.registerSingleton(yt.DI_TOKENS.ProjectCreationService,b9.ProjectCreationService),e.registerSingleton(yt.DI_TOKENS.AreaCreationService,S9.AreaCreationService),e.registerSingleton(yt.DI_TOKENS.ClassCreationService,D9.ClassCreationService),e.registerSingleton(yt.DI_TOKENS.ConceptCreationService,N9.ConceptCreationService),e.registerSingleton(yt.DI_TOKENS.FleetingNoteCreationService,k9.FleetingNoteCreationService),e.registerSingleton(yt.DI_TOKENS.SupervisionCreationService,L9.SupervisionCreationService),e.registerSingleton(yt.DI_TOKENS.GenericAssetCreationService,V9.GenericAssetCreationService),e.registerSingleton(yt.DI_TOKENS.PropertyCleanupService,w9.PropertyCleanupService),e.registerSingleton(yt.DI_TOKENS.FolderRepairService,A9.FolderRepairService),e.registerSingleton(yt.DI_TOKENS.LabelToAliasService,C9.LabelToAliasService),e.registerSingleton(yt.DI_TOKENS.RenameToUidService,I9.RenameToUidService),e.registerSingleton(yt.DI_TOKENS.PlanningService,R9.PlanningService),e.registerSingleton(yt.DI_TOKENS.EffortVotingService,O9.EffortVotingService),e.registerSingleton(yt.DI_TOKENS.SessionEventService,P9.SessionEventService),e.registerSingleton(yt.DI_TOKENS.AssetConversionService,F9.AssetConversionService),e.registerSingleton(yt.DI_TOKENS.NoteToRDFConverter,M9.NoteToRDFConverter),e.registerSingleton(yt.DI_TOKENS.AreaHierarchyBuilder,j9.AreaHierarchyBuilder),e.registerSingleton(yt.DI_TOKENS.URIConstructionService,$9.URIConstructionService),e.registerSingleton(yt.DI_TOKENS.CriticalityZoneService,U9.CriticalityZoneService)}o(B9,"registerCoreServices");function q9(){return _l.container.createChildContainer()}o(q9,"createChildContainer");function W9(){return _l.container}o(W9,"getContainer");function G9(){_l.container.reset()}o(G9,"resetContainer")});var F1=_(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.DEFAULT_COLORS=Go.NODE_FLAGS=void 0;Go.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};Go.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var N1=_(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.StringTable=void 0;var D1=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}}};rd.StringTable=D1});var OE=_(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.CompactGraphStore=void 0;var nd=N1(),tn=F1(),H9={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function k1(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(k1,"parseColor");var L1=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={...H9,...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 nd.StringTable,this.labelTable=new nd.StringTable,this.typeTable=new nd.StringTable,this.predicateTable=new nd.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]=k1(e.color,tn.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=tn.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=tn.NODE_FLAGS.PINNED),e.isArchived&&(s|=tn.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]=k1(t.color,tn.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|tn.NODE_FLAGS.PINNED:i&~tn.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|tn.NODE_FLAGS.ARCHIVED:i&~tn.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]=k1(e.color,tn.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,tn.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,tn.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~tn.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&tn.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}};id.CompactGraphStore=L1});var RE=_(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.MemoryPool=void 0;zo.getGlobalPool=Q9;zo.resetGlobalPool=Y9;var z9={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},sd=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={...z9,...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}};zo.MemoryPool=sd;var Ho=null;function Q9(){return Ho||(Ho=new sd),Ho}o(Q9,"getGlobalPool");function Y9(){Ho&&Ho.clear(),Ho=null}o(Y9,"resetGlobalPool")});var PE=_(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.StreamingLoader=void 0;wl.createStreamingSource=X9;var K9={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},M1=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={...K9,...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()}}};wl.StreamingLoader=M1;async function*X9(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(X9,"createStreamingSource")});var NE=_(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.createStreamingSource=Lt.StreamingLoader=Lt.resetGlobalPool=Lt.getGlobalPool=Lt.MemoryPool=Lt.CompactGraphStore=Lt.StringTable=Lt.DEFAULT_COLORS=Lt.NODE_FLAGS=void 0;var FE=F1();Object.defineProperty(Lt,"NODE_FLAGS",{enumerable:!0,get:o(function(){return FE.NODE_FLAGS},"get")});Object.defineProperty(Lt,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return FE.DEFAULT_COLORS},"get")});var J9=N1();Object.defineProperty(Lt,"StringTable",{enumerable:!0,get:o(function(){return J9.StringTable},"get")});var Z9=OE();Object.defineProperty(Lt,"CompactGraphStore",{enumerable:!0,get:o(function(){return Z9.CompactGraphStore},"get")});var j1=RE();Object.defineProperty(Lt,"MemoryPool",{enumerable:!0,get:o(function(){return j1.MemoryPool},"get")});Object.defineProperty(Lt,"getGlobalPool",{enumerable:!0,get:o(function(){return j1.getGlobalPool},"get")});Object.defineProperty(Lt,"resetGlobalPool",{enumerable:!0,get:o(function(){return j1.resetGlobalPool},"get")});var DE=PE();Object.defineProperty(Lt,"StreamingLoader",{enumerable:!0,get:o(function(){return DE.StreamingLoader},"get")});Object.defineProperty(Lt,"createStreamingSource",{enumerable:!0,get:o(function(){return DE.createStreamingSource},"get")})});var Ri=_(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.ErrorCode=void 0;var kE;(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"})(kE||(ad.ErrorCode=kE={}))});var Pi=_(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.ApplicationError=void 0;var $1=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+=`
|
|
337
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}};td.ResultSerializer=O1});var CE=_(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.FileAlreadyExistsError=Wo.FileNotFoundError=void 0;var R1=class extends Error{static{o(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};Wo.FileNotFoundError=R1;var P1=class extends Error{static{o(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};Wo.FileAlreadyExistsError=P1});var IE=_(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.container=void 0;Fs.registerCoreServices=B9;Fs.createChildContainer=q9;Fs.getContainer=W9;Fs.resetContainer=G9;Vu();var _l=Ue();Object.defineProperty(Fs,"container",{enumerable:!0,get:o(function(){return _l.container},"get")});var yt=ht(),g9=Kg(),y9=Mf(),v9=j0(),_9=jf(),w9=R0(),b9=Jg(),S9=m0(),E9=d0(),T9=Kf(),x9=Xf(),A9=x0(),C9=C0(),I9=F0(),O9=E0(),R9=V0(),P9=W0(),F9=B0(),D9=_0(),N9=b0(),k9=L0(),L9=N0(),M9=by(),j9=y0(),$9=z0(),V9=Y0(),U9=sy();function B9(n){let e=n||_l.container;e.registerSingleton(yt.DI_TOKENS.TaskFrontmatterGenerator,y9.TaskFrontmatterGenerator),e.registerSingleton(yt.DI_TOKENS.DynamicFrontmatterGenerator,v9.DynamicFrontmatterGenerator),e.registerSingleton(yt.DI_TOKENS.AlgorithmExtractor,_9.AlgorithmExtractor),e.registerSingleton(yt.DI_TOKENS.EffortStatusWorkflow,T9.EffortStatusWorkflow),e.registerSingleton(yt.DI_TOKENS.StatusTimestampService,x9.StatusTimestampService),e.registerSingleton(yt.DI_TOKENS.TaskStatusService,E9.TaskStatusService),e.registerSingleton(yt.DI_TOKENS.TaskCreationService,g9.TaskCreationService),e.registerSingleton(yt.DI_TOKENS.ProjectCreationService,b9.ProjectCreationService),e.registerSingleton(yt.DI_TOKENS.AreaCreationService,S9.AreaCreationService),e.registerSingleton(yt.DI_TOKENS.ClassCreationService,D9.ClassCreationService),e.registerSingleton(yt.DI_TOKENS.ConceptCreationService,N9.ConceptCreationService),e.registerSingleton(yt.DI_TOKENS.FleetingNoteCreationService,k9.FleetingNoteCreationService),e.registerSingleton(yt.DI_TOKENS.SupervisionCreationService,L9.SupervisionCreationService),e.registerSingleton(yt.DI_TOKENS.GenericAssetCreationService,V9.GenericAssetCreationService),e.registerSingleton(yt.DI_TOKENS.PropertyCleanupService,w9.PropertyCleanupService),e.registerSingleton(yt.DI_TOKENS.FolderRepairService,A9.FolderRepairService),e.registerSingleton(yt.DI_TOKENS.LabelToAliasService,C9.LabelToAliasService),e.registerSingleton(yt.DI_TOKENS.RenameToUidService,I9.RenameToUidService),e.registerSingleton(yt.DI_TOKENS.PlanningService,R9.PlanningService),e.registerSingleton(yt.DI_TOKENS.EffortVotingService,O9.EffortVotingService),e.registerSingleton(yt.DI_TOKENS.SessionEventService,P9.SessionEventService),e.registerSingleton(yt.DI_TOKENS.AssetConversionService,F9.AssetConversionService),e.registerSingleton(yt.DI_TOKENS.NoteToRDFConverter,M9.NoteToRDFConverter),e.registerSingleton(yt.DI_TOKENS.AreaHierarchyBuilder,j9.AreaHierarchyBuilder),e.registerSingleton(yt.DI_TOKENS.URIConstructionService,$9.URIConstructionService),e.registerSingleton(yt.DI_TOKENS.CriticalityZoneService,U9.CriticalityZoneService)}o(B9,"registerCoreServices");function q9(){return _l.container.createChildContainer()}o(q9,"createChildContainer");function W9(){return _l.container}o(W9,"getContainer");function G9(){_l.container.reset()}o(G9,"resetContainer")});var F1=_(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.DEFAULT_COLORS=Go.NODE_FLAGS=void 0;Go.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};Go.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var N1=_(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.StringTable=void 0;var D1=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}}};rd.StringTable=D1});var OE=_(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.CompactGraphStore=void 0;var nd=N1(),tn=F1(),H9={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function k1(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(k1,"parseColor");var L1=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={...H9,...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 nd.StringTable,this.labelTable=new nd.StringTable,this.typeTable=new nd.StringTable,this.predicateTable=new nd.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]=k1(e.color,tn.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=tn.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=tn.NODE_FLAGS.PINNED),e.isArchived&&(s|=tn.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]=k1(t.color,tn.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|tn.NODE_FLAGS.PINNED:i&~tn.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|tn.NODE_FLAGS.ARCHIVED:i&~tn.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]=k1(e.color,tn.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,tn.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,tn.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~tn.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&tn.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}};id.CompactGraphStore=L1});var RE=_(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.MemoryPool=void 0;zo.getGlobalPool=Q9;zo.resetGlobalPool=Y9;var z9={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},sd=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={...z9,...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}};zo.MemoryPool=sd;var Ho=null;function Q9(){return Ho||(Ho=new sd),Ho}o(Q9,"getGlobalPool");function Y9(){Ho&&Ho.clear(),Ho=null}o(Y9,"resetGlobalPool")});var PE=_(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.StreamingLoader=void 0;wl.createStreamingSource=X9;var K9={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},M1=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={...K9,...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()}}};wl.StreamingLoader=M1;async function*X9(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(X9,"createStreamingSource")});var NE=_(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.createStreamingSource=Lt.StreamingLoader=Lt.resetGlobalPool=Lt.getGlobalPool=Lt.MemoryPool=Lt.CompactGraphStore=Lt.StringTable=Lt.DEFAULT_COLORS=Lt.NODE_FLAGS=void 0;var FE=F1();Object.defineProperty(Lt,"NODE_FLAGS",{enumerable:!0,get:o(function(){return FE.NODE_FLAGS},"get")});Object.defineProperty(Lt,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return FE.DEFAULT_COLORS},"get")});var J9=N1();Object.defineProperty(Lt,"StringTable",{enumerable:!0,get:o(function(){return J9.StringTable},"get")});var Z9=OE();Object.defineProperty(Lt,"CompactGraphStore",{enumerable:!0,get:o(function(){return Z9.CompactGraphStore},"get")});var j1=RE();Object.defineProperty(Lt,"MemoryPool",{enumerable:!0,get:o(function(){return j1.MemoryPool},"get")});Object.defineProperty(Lt,"getGlobalPool",{enumerable:!0,get:o(function(){return j1.getGlobalPool},"get")});Object.defineProperty(Lt,"resetGlobalPool",{enumerable:!0,get:o(function(){return j1.resetGlobalPool},"get")});var DE=PE();Object.defineProperty(Lt,"StreamingLoader",{enumerable:!0,get:o(function(){return DE.StreamingLoader},"get")});Object.defineProperty(Lt,"createStreamingSource",{enumerable:!0,get:o(function(){return DE.createStreamingSource},"get")})});var Ri=_(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.ErrorCode=void 0;var kE;(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"})(kE||(ad.ErrorCode=kE={}))});var Pi=_(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.ApplicationError=void 0;var $1=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+=`
|
|
338
338
|
|
|
339
339
|
\u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
|
|
340
340
|
|
|
@@ -376,28 +376,28 @@ To resolve:
|
|
|
376
376
|
\u2022 Verify all required dependencies are available
|
|
377
377
|
\u2022 Review service logs for detailed error information
|
|
378
378
|
\u2022 Contact support if the issue persists`}};pd.ServiceError=H1});var qE=_(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.ServiceError=Mt.ResourceExhaustedError=Mt.NotFoundError=Mt.PermissionError=Mt.StateTransitionError=Mt.NetworkError=Mt.ValidationError=Mt.ApplicationError=Mt.ErrorCode=void 0;var pL=Ri();Object.defineProperty(Mt,"ErrorCode",{enumerable:!0,get:o(function(){return pL.ErrorCode},"get")});var mL=Pi();Object.defineProperty(Mt,"ApplicationError",{enumerable:!0,get:o(function(){return mL.ApplicationError},"get")});var gL=LE();Object.defineProperty(Mt,"ValidationError",{enumerable:!0,get:o(function(){return gL.ValidationError},"get")});var yL=ME();Object.defineProperty(Mt,"NetworkError",{enumerable:!0,get:o(function(){return yL.NetworkError},"get")});var vL=jE();Object.defineProperty(Mt,"StateTransitionError",{enumerable:!0,get:o(function(){return vL.StateTransitionError},"get")});var _L=$E();Object.defineProperty(Mt,"PermissionError",{enumerable:!0,get:o(function(){return _L.PermissionError},"get")});var wL=VE();Object.defineProperty(Mt,"NotFoundError",{enumerable:!0,get:o(function(){return wL.NotFoundError},"get")});var bL=UE();Object.defineProperty(Mt,"ResourceExhaustedError",{enumerable:!0,get:o(function(){return bL.ResourceExhaustedError},"get")});var SL=BE();Object.defineProperty(Mt,"ServiceError",{enumerable:!0,get:o(function(){return SL.ServiceError},"get")})});var WE=_(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.ApplicationErrorHandler=void 0;var z1=Pi(),EL=Ri(),Q1=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 z1.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends z1.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 z1.ApplicationError{static{o(this,"UnknownError")}constructor(s,a){super(s,{originalError:a.name,...t}),this.code=EL.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(`
|
|
379
|
-
`)}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){console.error("Error in telemetry hook:",i)}}};md.ApplicationErrorHandler=Q1});var GE=_(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.ApplicationErrorHandler=void 0;var TL=WE();Object.defineProperty(gd,"ApplicationErrorHandler",{enumerable:!0,get:o(function(){return TL.ApplicationErrorHandler},"get")})});var Ht=_(v=>{"use strict";var xL=v&&v.__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]})),An=v&&v.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&xL(e,n,t)};Object.defineProperty(v,"__esModule",{value:!0});v.AutocompleteService=v.TrendDetectionService=v.AnalyticsService=v.getTemplateByName=v.validateParameters=v.fillTemplate=v.findMatchingTemplates=v.findClassByTerm=v.KNOWN_CLASSES=v.KNOWN_PROTOTYPES=v.EFFORT_STATUSES=v.ASSET_CLASSES=v.PREDICATES=v.SPARQL_PREFIXES=v.SPARQL_TEMPLATES=v.DEFAULT_NL_TO_SPARQL_CONFIG=v.NLToSPARQLService=v.TypeRegistry=v.GraphQueryService=v.GenericAssetCreationService=v.URIConstructionService=v.SessionEventService=v.AssetConversionService=v.PlanningService=v.AlgorithmExtractor=v.DynamicFrontmatterGenerator=v.TaskFrontmatterGenerator=v.FleetingNoteCreationService=v.SupervisionCreationService=v.StatusTimestampService=v.RenameToUidService=v.PropertyCleanupService=v.LoggingService=v.LabelToAliasService=v.FolderRepairService=v.EffortVotingService=v.WorkflowEngine=v.EffortStatusWorkflow=v.ConceptCreationService=v.ClassCreationService=v.AreaHierarchyBuilder=v.AreaCreationService=v.TaskStatusService=v.ProjectCreationService=v.TaskCreationService=v.extractPropertyLabel=v.uriToPropertyName=v.propertyNameToUri=v.rangeToFieldType=v.PropertyFieldType=void 0;v.createSPARQLResultCache=v.SPARQLResultCache=v.QueryPlanCache=v.createDoubleLiteral=v.createDecimalLiteral=v.getNumericValue=v.createPercentileAggregate=v.modeAggregate=v.stddevAggregate=v.varianceAggregate=v.medianAggregate=v.EXO_AGGREGATE_NS=v.BUILT_IN_AGGREGATES=v.CustomAggregateError=v.CustomAggregateRegistry=v.AggregateFunctions=v.BuiltInFunctions=v.SolutionMapping=v.UpdateExecutorError=v.UpdateExecutor=v.QueryExecutor=v.DescribeExecutor=v.ConstructExecutor=v.UnionExecutor=v.OptionalExecutor=v.FilterExecutor=v.BGPExecutor=v.AlgebraSerializer=v.AlgebraOptimizer=v.AlgebraTranslator=v.DescribeOptionsTransformerError=v.DescribeOptionsTransformer=v.SPARQLParseError=v.SPARQLParser=v.NoteToRDFConverter=v.RDFSInferenceEngine=v.RDFVocabularyMapper=v.InMemoryTripleStore=v.RDFSerializer=v.FilenameValidator=v.EffortSortingHelpers=v.MetadataExtractor=v.MetadataHelpers=v.WikiLinkHelpers=v.DateFormatter=v.FrontmatterService=v.CriticalityZoneUUIDs=v.CriticalityZoneService=v.DailyReviewService=v.DEFAULT_AUTOCOMPLETE_CONFIG=void 0;v.createStreamingSource=v.StreamingLoader=v.resetGlobalPool=v.getGlobalPool=v.MemoryPool=v.CompactGraphStore=v.StringTable=v.DEFAULT_COLORS=v.NODE_FLAGS=v.container=v.resetContainer=v.getContainer=v.createChildContainer=v.registerCoreServices=v.DI_TOKENS=v.TransactionError=v.TripleNotFoundError=v.TripleAlreadyExistsError=v.FileAlreadyExistsError=v.FileNotFoundError=v.FilterContainsOptimizer=v.VaultPrefixTransformer=v.CaseWhenTransformerError=v.CaseWhenTransformer=v.ResultSerializer=v.createIncrementalIndexer=v.IncrementalIndexer=void 0;An(Gu(),v);An(zu(),v);An(z_(),v);An(Q_(),v);An(wm(),v);An(bm(),v);An(K_(),v);An(Z_(),v);An(rg(),v);An(Uw(),v);var HE=ag();Object.defineProperty(v,"PropertyFieldType",{enumerable:!0,get:o(function(){return HE.PropertyFieldType},"get")});Object.defineProperty(v,"rangeToFieldType",{enumerable:!0,get:o(function(){return HE.rangeToFieldType},"get")});var Y1=Ww();Object.defineProperty(v,"propertyNameToUri",{enumerable:!0,get:o(function(){return Y1.propertyNameToUri},"get")});Object.defineProperty(v,"uriToPropertyName",{enumerable:!0,get:o(function(){return Y1.uriToPropertyName},"get")});Object.defineProperty(v,"extractPropertyLabel",{enumerable:!0,get:o(function(){return Y1.extractPropertyLabel},"get")});var AL=Kg();Object.defineProperty(v,"TaskCreationService",{enumerable:!0,get:o(function(){return AL.TaskCreationService},"get")});var CL=Jg();Object.defineProperty(v,"ProjectCreationService",{enumerable:!0,get:o(function(){return CL.ProjectCreationService},"get")});var IL=d0();Object.defineProperty(v,"TaskStatusService",{enumerable:!0,get:o(function(){return IL.TaskStatusService},"get")});var OL=m0();Object.defineProperty(v,"AreaCreationService",{enumerable:!0,get:o(function(){return OL.AreaCreationService},"get")});var RL=y0();Object.defineProperty(v,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return RL.AreaHierarchyBuilder},"get")});var PL=_0();Object.defineProperty(v,"ClassCreationService",{enumerable:!0,get:o(function(){return PL.ClassCreationService},"get")});var FL=b0();Object.defineProperty(v,"ConceptCreationService",{enumerable:!0,get:o(function(){return FL.ConceptCreationService},"get")});var DL=Kf();Object.defineProperty(v,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return DL.EffortStatusWorkflow},"get")});var NL=e0();Object.defineProperty(v,"WorkflowEngine",{enumerable:!0,get:o(function(){return NL.WorkflowEngine},"get")});var kL=E0();Object.defineProperty(v,"EffortVotingService",{enumerable:!0,get:o(function(){return kL.EffortVotingService},"get")});var LL=x0();Object.defineProperty(v,"FolderRepairService",{enumerable:!0,get:o(function(){return LL.FolderRepairService},"get")});var ML=C0();Object.defineProperty(v,"LabelToAliasService",{enumerable:!0,get:o(function(){return ML.LabelToAliasService},"get")});var jL=Zf();Object.defineProperty(v,"LoggingService",{enumerable:!0,get:o(function(){return jL.LoggingService},"get")});var $L=R0();Object.defineProperty(v,"PropertyCleanupService",{enumerable:!0,get:o(function(){return $L.PropertyCleanupService},"get")});var VL=F0();Object.defineProperty(v,"RenameToUidService",{enumerable:!0,get:o(function(){return VL.RenameToUidService},"get")});var UL=Xf();Object.defineProperty(v,"StatusTimestampService",{enumerable:!0,get:o(function(){return UL.StatusTimestampService},"get")});var BL=N0();Object.defineProperty(v,"SupervisionCreationService",{enumerable:!0,get:o(function(){return BL.SupervisionCreationService},"get")});var qL=L0();Object.defineProperty(v,"FleetingNoteCreationService",{enumerable:!0,get:o(function(){return qL.FleetingNoteCreationService},"get")});var WL=Mf();Object.defineProperty(v,"TaskFrontmatterGenerator",{enumerable:!0,get:o(function(){return WL.TaskFrontmatterGenerator},"get")});var GL=j0();Object.defineProperty(v,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return GL.DynamicFrontmatterGenerator},"get")});var HL=jf();Object.defineProperty(v,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return HL.AlgorithmExtractor},"get")});var zL=V0();Object.defineProperty(v,"PlanningService",{enumerable:!0,get:o(function(){return zL.PlanningService},"get")});var QL=B0();Object.defineProperty(v,"AssetConversionService",{enumerable:!0,get:o(function(){return QL.AssetConversionService},"get")});var YL=W0();Object.defineProperty(v,"SessionEventService",{enumerable:!0,get:o(function(){return YL.SessionEventService},"get")});var KL=z0();Object.defineProperty(v,"URIConstructionService",{enumerable:!0,get:o(function(){return KL.URIConstructionService},"get")});var XL=Y0();Object.defineProperty(v,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return XL.GenericAssetCreationService},"get")});var JL=Kb();Object.defineProperty(v,"GraphQueryService",{enumerable:!0,get:o(function(){return JL.GraphQueryService},"get")});var ZL=Jb();Object.defineProperty(v,"TypeRegistry",{enumerable:!0,get:o(function(){return ZL.TypeRegistry},"get")});var zE=Zb();Object.defineProperty(v,"NLToSPARQLService",{enumerable:!0,get:o(function(){return zE.NLToSPARQLService},"get")});Object.defineProperty(v,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return zE.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var Cn=J0();Object.defineProperty(v,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return Cn.SPARQL_TEMPLATES},"get")});Object.defineProperty(v,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return Cn.SPARQL_PREFIXES},"get")});Object.defineProperty(v,"PREDICATES",{enumerable:!0,get:o(function(){return Cn.PREDICATES},"get")});Object.defineProperty(v,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return Cn.ASSET_CLASSES},"get")});Object.defineProperty(v,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return Cn.EFFORT_STATUSES},"get")});Object.defineProperty(v,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return Cn.KNOWN_PROTOTYPES},"get")});Object.defineProperty(v,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return Cn.KNOWN_CLASSES},"get")});Object.defineProperty(v,"findClassByTerm",{enumerable:!0,get:o(function(){return Cn.findClassByTerm},"get")});Object.defineProperty(v,"findMatchingTemplates",{enumerable:!0,get:o(function(){return Cn.findMatchingTemplates},"get")});Object.defineProperty(v,"fillTemplate",{enumerable:!0,get:o(function(){return Cn.fillTemplate},"get")});Object.defineProperty(v,"validateParameters",{enumerable:!0,get:o(function(){return Cn.validateParameters},"get")});Object.defineProperty(v,"getTemplateByName",{enumerable:!0,get:o(function(){return Cn.getTemplateByName},"get")});var e6=tS();Object.defineProperty(v,"AnalyticsService",{enumerable:!0,get:o(function(){return e6.AnalyticsService},"get")});var t6=rS();Object.defineProperty(v,"TrendDetectionService",{enumerable:!0,get:o(function(){return t6.TrendDetectionService},"get")});var QE=iS();Object.defineProperty(v,"AutocompleteService",{enumerable:!0,get:o(function(){return QE.AutocompleteService},"get")});Object.defineProperty(v,"DEFAULT_AUTOCOMPLETE_CONFIG",{enumerable:!0,get:o(function(){return QE.DEFAULT_AUTOCOMPLETE_CONFIG},"get")});var r6=aS();Object.defineProperty(v,"DailyReviewService",{enumerable:!0,get:o(function(){return r6.DailyReviewService},"get")});var YE=sy();Object.defineProperty(v,"CriticalityZoneService",{enumerable:!0,get:o(function(){return YE.CriticalityZoneService},"get")});Object.defineProperty(v,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return YE.CriticalityZoneUUIDs},"get")});var n6=Zi();Object.defineProperty(v,"FrontmatterService",{enumerable:!0,get:o(function(){return n6.FrontmatterService},"get")});var i6=or();Object.defineProperty(v,"DateFormatter",{enumerable:!0,get:o(function(){return i6.DateFormatter},"get")});var s6=aa();Object.defineProperty(v,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return s6.WikiLinkHelpers},"get")});var a6=bn();Object.defineProperty(v,"MetadataHelpers",{enumerable:!0,get:o(function(){return a6.MetadataHelpers},"get")});var o6=il();Object.defineProperty(v,"MetadataExtractor",{enumerable:!0,get:o(function(){return o6.MetadataExtractor},"get")});var c6=cS();Object.defineProperty(v,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return c6.EffortSortingHelpers},"get")});var l6=lS();Object.defineProperty(v,"FilenameValidator",{enumerable:!0,get:o(function(){return l6.FilenameValidator},"get")});var u6=gS();Object.defineProperty(v,"RDFSerializer",{enumerable:!0,get:o(function(){return u6.RDFSerializer},"get")});var f6=l0();Object.defineProperty(v,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return f6.InMemoryTripleStore},"get")});var h6=vy();Object.defineProperty(v,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return h6.RDFVocabularyMapper},"get")});var d6=vS();Object.defineProperty(v,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return d6.RDFSInferenceEngine},"get")});var p6=by();Object.defineProperty(v,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return p6.NoteToRDFConverter},"get")});var KE=VS();Object.defineProperty(v,"SPARQLParser",{enumerable:!0,get:o(function(){return KE.SPARQLParser},"get")});Object.defineProperty(v,"SPARQLParseError",{enumerable:!0,get:o(function(){return KE.SPARQLParseError},"get")});var XE=My();Object.defineProperty(v,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return XE.DescribeOptionsTransformer},"get")});Object.defineProperty(v,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return XE.DescribeOptionsTransformerError},"get")});var m6=BS();Object.defineProperty(v,"AlgebraTranslator",{enumerable:!0,get:o(function(){return m6.AlgebraTranslator},"get")});var g6=qS();Object.defineProperty(v,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return g6.AlgebraOptimizer},"get")});var y6=WS();Object.defineProperty(v,"AlgebraSerializer",{enumerable:!0,get:o(function(){return y6.AlgebraSerializer},"get")});var v6=r1();Object.defineProperty(v,"BGPExecutor",{enumerable:!0,get:o(function(){return v6.BGPExecutor},"get")});var _6=jh();Object.defineProperty(v,"FilterExecutor",{enumerable:!0,get:o(function(){return _6.FilterExecutor},"get")});var w6=a1();Object.defineProperty(v,"OptionalExecutor",{enumerable:!0,get:o(function(){return w6.OptionalExecutor},"get")});var b6=c1();Object.defineProperty(v,"UnionExecutor",{enumerable:!0,get:o(function(){return b6.UnionExecutor},"get")});var S6=h1();Object.defineProperty(v,"ConstructExecutor",{enumerable:!0,get:o(function(){return S6.ConstructExecutor},"get")});var E6=aE();Object.defineProperty(v,"DescribeExecutor",{enumerable:!0,get:o(function(){return E6.DescribeExecutor},"get")});var T6=vE();Object.defineProperty(v,"QueryExecutor",{enumerable:!0,get:o(function(){return T6.QueryExecutor},"get")});var JE=wE();Object.defineProperty(v,"UpdateExecutor",{enumerable:!0,get:o(function(){return JE.UpdateExecutor},"get")});Object.defineProperty(v,"UpdateExecutorError",{enumerable:!0,get:o(function(){return JE.UpdateExecutorError},"get")});var x6=as();Object.defineProperty(v,"SolutionMapping",{enumerable:!0,get:o(function(){return x6.SolutionMapping},"get")});var A6=Mh();Object.defineProperty(v,"BuiltInFunctions",{enumerable:!0,get:o(function(){return A6.BuiltInFunctions},"get")});var C6=SE();Object.defineProperty(v,"AggregateFunctions",{enumerable:!0,get:o(function(){return C6.AggregateFunctions},"get")});var ZE=g1();Object.defineProperty(v,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return ZE.CustomAggregateRegistry},"get")});Object.defineProperty(v,"CustomAggregateError",{enumerable:!0,get:o(function(){return ZE.CustomAggregateError},"get")});var Fi=y1();Object.defineProperty(v,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return Fi.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(v,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return Fi.EXO_AGGREGATE_NS},"get")});Object.defineProperty(v,"medianAggregate",{enumerable:!0,get:o(function(){return Fi.medianAggregate},"get")});Object.defineProperty(v,"varianceAggregate",{enumerable:!0,get:o(function(){return Fi.varianceAggregate},"get")});Object.defineProperty(v,"stddevAggregate",{enumerable:!0,get:o(function(){return Fi.stddevAggregate},"get")});Object.defineProperty(v,"modeAggregate",{enumerable:!0,get:o(function(){return Fi.modeAggregate},"get")});Object.defineProperty(v,"createPercentileAggregate",{enumerable:!0,get:o(function(){return Fi.createPercentileAggregate},"get")});Object.defineProperty(v,"getNumericValue",{enumerable:!0,get:o(function(){return Fi.getNumericValue},"get")});Object.defineProperty(v,"createDecimalLiteral",{enumerable:!0,get:o(function(){return Fi.createDecimalLiteral},"get")});Object.defineProperty(v,"createDoubleLiteral",{enumerable:!0,get:o(function(){return Fi.createDoubleLiteral},"get")});var I6=EE();Object.defineProperty(v,"QueryPlanCache",{enumerable:!0,get:o(function(){return I6.QueryPlanCache},"get")});var eT=TE();Object.defineProperty(v,"SPARQLResultCache",{enumerable:!0,get:o(function(){return eT.SPARQLResultCache},"get")});Object.defineProperty(v,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return eT.createSPARQLResultCache},"get")});var tT=xE();Object.defineProperty(v,"IncrementalIndexer",{enumerable:!0,get:o(function(){return tT.IncrementalIndexer},"get")});Object.defineProperty(v,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return tT.createIncrementalIndexer},"get")});var O6=AE();Object.defineProperty(v,"ResultSerializer",{enumerable:!0,get:o(function(){return O6.ResultSerializer},"get")});var rT=Ny();Object.defineProperty(v,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return rT.CaseWhenTransformer},"get")});Object.defineProperty(v,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return rT.CaseWhenTransformerError},"get")});var R6=Uy();Object.defineProperty(v,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return R6.VaultPrefixTransformer},"get")});var P6=Yy();Object.defineProperty(v,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return P6.FilterContainsOptimizer},"get")});var nT=CE();Object.defineProperty(v,"FileNotFoundError",{enumerable:!0,get:o(function(){return nT.FileNotFoundError},"get")});Object.defineProperty(v,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return nT.FileAlreadyExistsError},"get")});var K1=s0();Object.defineProperty(v,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return K1.TripleAlreadyExistsError},"get")});Object.defineProperty(v,"TripleNotFoundError",{enumerable:!0,get:o(function(){return K1.TripleNotFoundError},"get")});Object.defineProperty(v,"TransactionError",{enumerable:!0,get:o(function(){return K1.TransactionError},"get")});var F6=ht();Object.defineProperty(v,"DI_TOKENS",{enumerable:!0,get:o(function(){return F6.DI_TOKENS},"get")});var bl=IE();Object.defineProperty(v,"registerCoreServices",{enumerable:!0,get:o(function(){return bl.registerCoreServices},"get")});Object.defineProperty(v,"createChildContainer",{enumerable:!0,get:o(function(){return bl.createChildContainer},"get")});Object.defineProperty(v,"getContainer",{enumerable:!0,get:o(function(){return bl.getContainer},"get")});Object.defineProperty(v,"resetContainer",{enumerable:!0,get:o(function(){return bl.resetContainer},"get")});Object.defineProperty(v,"container",{enumerable:!0,get:o(function(){return bl.container},"get")});var os=NE();Object.defineProperty(v,"NODE_FLAGS",{enumerable:!0,get:o(function(){return os.NODE_FLAGS},"get")});Object.defineProperty(v,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return os.DEFAULT_COLORS},"get")});Object.defineProperty(v,"StringTable",{enumerable:!0,get:o(function(){return os.StringTable},"get")});Object.defineProperty(v,"CompactGraphStore",{enumerable:!0,get:o(function(){return os.CompactGraphStore},"get")});Object.defineProperty(v,"MemoryPool",{enumerable:!0,get:o(function(){return os.MemoryPool},"get")});Object.defineProperty(v,"getGlobalPool",{enumerable:!0,get:o(function(){return os.getGlobalPool},"get")});Object.defineProperty(v,"resetGlobalPool",{enumerable:!0,get:o(function(){return os.resetGlobalPool},"get")});Object.defineProperty(v,"StreamingLoader",{enumerable:!0,get:o(function(){return os.StreamingLoader},"get")});Object.defineProperty(v,"createStreamingSource",{enumerable:!0,get:o(function(){return os.createStreamingSource},"get")});An(qE(),v);An(GE(),v)});var zt=_(X1=>{"use strict";X1.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})};X1.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 sT=_((YK,iT)=>{var Fs=require("constants"),D6=process.cwd,yd=null,N6=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return yd||(yd=D6.call(process)),yd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(J1=process.chdir,process.chdir=function(n){yd=null,J1.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,J1));var J1;iT.exports=k6;function k6(n){Fs.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,h,d){d&&process.nextTick(d)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(f,h,d,p){p&&process.nextTick(p)},n.lchownSync=function(){}),N6==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function h(d,p,y){var w=Date.now(),T=0;f(d,p,o(function S(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-w<6e4){setTimeout(function(){n.stat(p,function(F,Q){F&&F.code==="ENOENT"?f(d,p,S):y(A)})},T),T<100&&(T+=10);return}y&&y(A)},"CB"))}return o(h,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h})(n.rename)),n.read=typeof n.read!="function"?n.read:(function(f){function h(d,p,y,w,T,S){var A;if(S&&typeof S=="function"){var F=0;A=o(function(Q,K,Te){if(Q&&Q.code==="EAGAIN"&&F<10)return F++,f.call(n,d,p,y,w,T,A);S.apply(this,arguments)},"callback")}return f.call(n,d,p,y,w,T,A)}return o(h,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h})(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:(function(f){return function(h,d,p,y,w){for(var T=0;;)try{return f.call(n,h,d,p,y,w)}catch(S){if(S.code==="EAGAIN"&&T<10){T++;continue}throw S}}})(n.readSync);function e(f){f.lchmod=function(h,d,p){f.open(h,Fs.O_WRONLY|Fs.O_SYMLINK,d,function(y,w){if(y){p&&p(y);return}f.fchmod(w,d,function(T){f.close(w,function(S){p&&p(T||S)})})})},f.lchmodSync=function(h,d){var p=f.openSync(h,Fs.O_WRONLY|Fs.O_SYMLINK,d),y=!0,w;try{w=f.fchmodSync(p,d),y=!1}finally{if(y)try{f.closeSync(p)}catch{}else f.closeSync(p)}return w}}o(e,"patchLchmod");function t(f){Fs.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(h,d,p,y){f.open(h,Fs.O_SYMLINK,function(w,T){if(w){y&&y(w);return}f.futimes(T,d,p,function(S){f.close(T,function(A){y&&y(S||A)})})})},f.lutimesSync=function(h,d,p){var y=f.openSync(h,Fs.O_SYMLINK),w,T=!0;try{w=f.futimesSync(y,d,p),T=!1}finally{if(T)try{f.closeSync(y)}catch{}else f.closeSync(y)}return w}):f.futimes&&(f.lutimes=function(h,d,p,y){y&&process.nextTick(y)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(h,d,p){return f.call(n,h,d,function(y){u(y)&&(y=null),p&&p.apply(this,arguments)})}}o(r,"chmodFix");function i(f){return f&&function(h,d){try{return f.call(n,h,d)}catch(p){if(!u(p))throw p}}}o(i,"chmodFixSync");function s(f){return f&&function(h,d,p,y){return f.call(n,h,d,p,function(w){u(w)&&(w=null),y&&y.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(h,d,p){try{return f.call(n,h,d,p)}catch(y){if(!u(y))throw y}}}o(a,"chownFixSync");function c(f){return f&&function(h,d,p){typeof d=="function"&&(p=d,d=null);function y(w,T){T&&(T.uid<0&&(T.uid+=4294967296),T.gid<0&&(T.gid+=4294967296)),p&&p.apply(this,arguments)}return o(y,"callback"),d?f.call(n,h,d,y):f.call(n,h,y)}}o(c,"statFix");function l(f){return f&&function(h,d){var p=d?f.call(n,h,d):f.call(n,h);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 h=!process.getuid||process.getuid()!==0;return!!(h&&(f.code==="EINVAL"||f.code==="EPERM"))}o(u,"chownErOk")}o(k6,"patch")});var cT=_((XK,oT)=>{var aT=require("stream").Stream;oT.exports=L6;function L6(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);aT.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,h){if(f){s.emit("error",f),s.readable=!1;return}s.fd=h,s.emit("open",h),s._read()})}function t(r,i){if(!(this instanceof t))return new t(r,i);aT.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(L6,"legacy")});var uT=_((ZK,lT)=>{"use strict";lT.exports=j6;var M6=Object.getPrototypeOf||function(n){return n.__proto__};function j6(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:M6(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(j6,"clone")});var Yo=_((tX,t2)=>{var Tt=require("fs"),$6=sT(),V6=cT(),U6=uT(),vd=require("util"),ur,wd;typeof Symbol=="function"&&typeof Symbol.for=="function"?(ur=Symbol.for("graceful-fs.queue"),wd=Symbol.for("graceful-fs.previous")):(ur="___graceful-fs.queue",wd="___graceful-fs.previous");function B6(){}o(B6,"noop");function dT(n,e){Object.defineProperty(n,ur,{get:o(function(){return e},"get")})}o(dT,"publishQueue");var Oa=B6;vd.debuglog?Oa=vd.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Oa=o(function(){var n=vd.format.apply(vd,arguments);n="GFS4: "+n.split(/\n/).join(`
|
|
380
|
-
GFS4: `),console.error(n)},"debug"));Tt[ur]||(fT=global[ur]||[],dT(Tt,fT),Tt.close=(function(n){function e(t,r){return n.call(Tt,t,function(i){i||hT(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,wd,{value:n}),e})(Tt.close),Tt.closeSync=(function(n){function e(t){n.apply(Tt,arguments),hT()}return o(e,"closeSync"),Object.defineProperty(e,wd,{value:n}),e})(Tt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Oa(Tt[ur]),require("assert").equal(Tt[ur].length,0)}));var fT;global[ur]||dT(global,Tt[ur]);t2.exports=Z1(U6(Tt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Tt.__patched&&(t2.exports=Z1(Tt),Tt.__patched=!0);function Z1(n){$6(n),n.gracefulify=Z1,n.createReadStream=K,n.createWriteStream=Te;var e=n.readFile;n.readFile=t;function t(L,$,Z){return typeof $=="function"&&(Z=$,$=null),qe(L,$,Z);function qe(et,wt,tt,nt){return e(et,wt,function(We){We&&(We.code==="EMFILE"||We.code==="ENFILE")?Qo([qe,[et,wt,tt],We,nt||Date.now(),Date.now()]):typeof tt=="function"&&tt.apply(this,arguments)})}o(qe,"go$readFile")}o(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(L,$,Z,qe){return typeof Z=="function"&&(qe=Z,Z=null),et(L,$,Z,qe);function et(wt,tt,nt,We,re){return r(wt,tt,nt,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Qo([et,[wt,tt,nt,We],U,re||Date.now(),Date.now()]):typeof We=="function"&&We.apply(this,arguments)})}o(et,"go$writeFile")}o(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=a);function a(L,$,Z,qe){return typeof Z=="function"&&(qe=Z,Z=null),et(L,$,Z,qe);function et(wt,tt,nt,We,re){return s(wt,tt,nt,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Qo([et,[wt,tt,nt,We],U,re||Date.now(),Date.now()]):typeof We=="function"&&We.apply(this,arguments)})}o(et,"go$appendFile")}o(a,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(L,$,Z,qe){return typeof Z=="function"&&(qe=Z,Z=0),et(L,$,Z,qe);function et(wt,tt,nt,We,re){return c(wt,tt,nt,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Qo([et,[wt,tt,nt,We],U,re||Date.now(),Date.now()]):typeof We=="function"&&We.apply(this,arguments)})}o(et,"go$copyFile")}o(l,"copyFile");var u=n.readdir;n.readdir=h;var f=/^v[0-5]\./;function h(L,$,Z){typeof $=="function"&&(Z=$,$=null);var qe=f.test(process.version)?o(function(tt,nt,We,re){return u(tt,et(tt,nt,We,re))},"go$readdir"):o(function(tt,nt,We,re){return u(tt,nt,et(tt,nt,We,re))},"go$readdir");return qe(L,$,Z);function et(wt,tt,nt,We){return function(re,U){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Qo([qe,[wt,tt,nt],re,We||Date.now(),Date.now()]):(U&&U.sort&&U.sort(),typeof nt=="function"&&nt.call(this,re,U))}}}if(o(h,"readdir"),process.version.substr(0,4)==="v0.8"){var d=V6(n);S=d.ReadStream,F=d.WriteStream}var p=n.ReadStream;p&&(S.prototype=Object.create(p.prototype),S.prototype.open=A);var y=n.WriteStream;y&&(F.prototype=Object.create(y.prototype),F.prototype.open=Q),Object.defineProperty(n,"ReadStream",{get:o(function(){return S},"get"),set:o(function(L){S=L},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return F},"get"),set:o(function(L){F=L},"set"),enumerable:!0,configurable:!0});var w=S;Object.defineProperty(n,"FileReadStream",{get:o(function(){return w},"get"),set:o(function(L){w=L},"set"),enumerable:!0,configurable:!0});var T=F;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return T},"get"),set:o(function(L){T=L},"set"),enumerable:!0,configurable:!0});function S(L,$){return this instanceof S?(p.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}o(S,"ReadStream");function A(){var L=this;J(L.path,L.flags,L.mode,function($,Z){$?(L.autoClose&&L.destroy(),L.emit("error",$)):(L.fd=Z,L.emit("open",Z),L.read())})}o(A,"ReadStream$open");function F(L,$){return this instanceof F?(y.apply(this,arguments),this):F.apply(Object.create(F.prototype),arguments)}o(F,"WriteStream");function Q(){var L=this;J(L.path,L.flags,L.mode,function($,Z){$?(L.destroy(),L.emit("error",$)):(L.fd=Z,L.emit("open",Z))})}o(Q,"WriteStream$open");function K(L,$){return new n.ReadStream(L,$)}o(K,"createReadStream");function Te(L,$){return new n.WriteStream(L,$)}o(Te,"createWriteStream");var H=n.open;n.open=J;function J(L,$,Z,qe){return typeof Z=="function"&&(qe=Z,Z=null),et(L,$,Z,qe);function et(wt,tt,nt,We,re){return H(wt,tt,nt,function(U,it){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Qo([et,[wt,tt,nt,We],U,re||Date.now(),Date.now()]):typeof We=="function"&&We.apply(this,arguments)})}o(et,"go$open")}return o(J,"open"),n}o(Z1,"patch");function Qo(n){Oa("ENQUEUE",n[0].name,n[1]),Tt[ur].push(n),e2()}o(Qo,"enqueue");var _d;function hT(){for(var n=Date.now(),e=0;e<Tt[ur].length;++e)Tt[ur][e].length>2&&(Tt[ur][e][3]=n,Tt[ur][e][4]=n);e2()}o(hT,"resetQueue");function e2(){if(clearTimeout(_d),_d=void 0,Tt[ur].length!==0){var n=Tt[ur].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Oa("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Oa("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?(Oa("RETRY",e.name,t),e.apply(null,t.concat([i]))):Tt[ur].push(n)}_d===void 0&&(_d=setTimeout(e2,0))}}o(e2,"retry")});var Wr=_(cs=>{"use strict";var pT=zt().fromCallback,qr=Yo(),q6=["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 qr[n]=="function");Object.assign(cs,qr);q6.forEach(n=>{cs[n]=pT(qr[n])});cs.exists=function(n,e){return typeof e=="function"?qr.exists(n,e):new Promise(t=>qr.exists(n,t))};cs.read=function(n,e,t,r,i,s){return typeof s=="function"?qr.read(n,e,t,r,i,s):new Promise((a,c)=>{qr.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};cs.write=function(n,e,...t){return typeof t[t.length-1]=="function"?qr.write(n,e,...t):new Promise((r,i)=>{qr.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};cs.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?qr.readv(n,e,...t):new Promise((r,i)=>{qr.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};cs.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?qr.writev(n,e,...t):new Promise((r,i)=>{qr.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof qr.realpath.native=="function"?cs.realpath.native=pT(qr.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var gT=_((iX,mT)=>{"use strict";var W6=require("path");mT.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(W6.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var wT=_((aX,r2)=>{"use strict";var yT=Wr(),{checkPath:vT}=gT(),_T=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");r2.exports.makeDir=async(n,e)=>(vT(n),yT.mkdir(n,{mode:_T(e),recursive:!0}));r2.exports.makeDirSync=(n,e)=>(vT(n),yT.mkdirSync(n,{mode:_T(e),recursive:!0}))});var si=_((cX,bT)=>{"use strict";var G6=zt().fromPromise,{makeDir:H6,makeDirSync:n2}=wT(),i2=G6(H6);bT.exports={mkdirs:i2,mkdirsSync:n2,mkdirp:i2,mkdirpSync:n2,ensureDir:i2,ensureDirSync:n2}});var Ds=_((lX,ET)=>{"use strict";var z6=zt().fromPromise,ST=Wr();function Q6(n){return ST.access(n).then(()=>!0).catch(()=>!1)}o(Q6,"pathExists");ET.exports={pathExists:z6(Q6),pathExistsSync:ST.existsSync}});var s2=_((fX,TT)=>{"use strict";var Ko=Wr(),Y6=zt().fromPromise;async function K6(n,e,t){let r=await Ko.open(n,"r+"),i=null;try{await Ko.futimes(r,e,t)}finally{try{await Ko.close(r)}catch(s){i=s}}if(i)throw i}o(K6,"utimesMillis");function X6(n,e,t){let r=Ko.openSync(n,"r+");return Ko.futimesSync(r,e,t),Ko.closeSync(r)}o(X6,"utimesMillisSync");TT.exports={utimesMillis:Y6(K6),utimesMillisSync:X6}});var Ra=_((dX,IT)=>{"use strict";var Xo=Wr(),Qt=require("path"),xT=zt().fromPromise;function J6(n,e,t){let r=t.dereference?i=>Xo.stat(i,{bigint:!0}):i=>Xo.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(J6,"getStats");function Z6(n,e,t){let r,i=t.dereference?a=>Xo.statSync(a,{bigint:!0}):a=>Xo.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(Z6,"getStatsSync");async function eM(n,e,t,r){let{srcStat:i,destStat:s}=await J6(n,e,r);if(s){if(Sl(i,s)){let a=Qt.basename(n),c=Qt.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()&&a2(n,e))throw new Error(bd(n,e,t));return{srcStat:i,destStat:s}}o(eM,"checkPaths");function tM(n,e,t,r){let{srcStat:i,destStat:s}=Z6(n,e,r);if(s){if(Sl(i,s)){let a=Qt.basename(n),c=Qt.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()&&a2(n,e))throw new Error(bd(n,e,t));return{srcStat:i,destStat:s}}o(tM,"checkPathsSync");async function AT(n,e,t,r){let i=Qt.resolve(Qt.dirname(n)),s=Qt.resolve(Qt.dirname(t));if(s===i||s===Qt.parse(s).root)return;let a;try{a=await Xo.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Sl(e,a))throw new Error(bd(n,t,r));return AT(n,e,s,r)}o(AT,"checkParentPaths");function CT(n,e,t,r){let i=Qt.resolve(Qt.dirname(n)),s=Qt.resolve(Qt.dirname(t));if(s===i||s===Qt.parse(s).root)return;let a;try{a=Xo.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Sl(e,a))throw new Error(bd(n,t,r));return CT(n,e,s,r)}o(CT,"checkParentPathsSync");function Sl(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(Sl,"areIdentical");function a2(n,e){let t=Qt.resolve(n).split(Qt.sep).filter(i=>i),r=Qt.resolve(e).split(Qt.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(a2,"isSrcSubdir");function bd(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(bd,"errMsg");IT.exports={checkPaths:xT(eM),checkPathsSync:tM,checkParentPaths:xT(AT),checkParentPathsSync:CT,isSrcSubdir:a2,areIdentical:Sl}});var RT=_((mX,OT)=>{"use strict";async function rM(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(rM,"asyncIteratorConcurrentProcess");OT.exports={asyncIteratorConcurrentProcess:rM}});var kT=_((yX,NT)=>{"use strict";var xr=Wr(),El=require("path"),{mkdirs:nM}=si(),{pathExists:iM}=Ds(),{utimesMillis:sM}=s2(),Tl=Ra(),{asyncIteratorConcurrentProcess:aM}=RT();async function oM(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;
|
|
379
|
+
`)}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){console.error("Error in telemetry hook:",i)}}};md.ApplicationErrorHandler=Q1});var GE=_(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.ApplicationErrorHandler=void 0;var TL=WE();Object.defineProperty(gd,"ApplicationErrorHandler",{enumerable:!0,get:o(function(){return TL.ApplicationErrorHandler},"get")})});var Ht=_(v=>{"use strict";var xL=v&&v.__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]})),An=v&&v.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&xL(e,n,t)};Object.defineProperty(v,"__esModule",{value:!0});v.AutocompleteService=v.TrendDetectionService=v.AnalyticsService=v.getTemplateByName=v.validateParameters=v.fillTemplate=v.findMatchingTemplates=v.findClassByTerm=v.KNOWN_CLASSES=v.KNOWN_PROTOTYPES=v.EFFORT_STATUSES=v.ASSET_CLASSES=v.PREDICATES=v.SPARQL_PREFIXES=v.SPARQL_TEMPLATES=v.DEFAULT_NL_TO_SPARQL_CONFIG=v.NLToSPARQLService=v.TypeRegistry=v.GraphQueryService=v.GenericAssetCreationService=v.URIConstructionService=v.SessionEventService=v.AssetConversionService=v.PlanningService=v.AlgorithmExtractor=v.DynamicFrontmatterGenerator=v.TaskFrontmatterGenerator=v.FleetingNoteCreationService=v.SupervisionCreationService=v.StatusTimestampService=v.RenameToUidService=v.PropertyCleanupService=v.LoggingService=v.LabelToAliasService=v.FolderRepairService=v.EffortVotingService=v.WorkflowEngine=v.EffortStatusWorkflow=v.ConceptCreationService=v.ClassCreationService=v.AreaHierarchyBuilder=v.AreaCreationService=v.TaskStatusService=v.ProjectCreationService=v.TaskCreationService=v.extractPropertyLabel=v.uriToPropertyName=v.propertyNameToUri=v.rangeToFieldType=v.PropertyFieldType=void 0;v.createSPARQLResultCache=v.SPARQLResultCache=v.QueryPlanCache=v.createDoubleLiteral=v.createDecimalLiteral=v.getNumericValue=v.createPercentileAggregate=v.modeAggregate=v.stddevAggregate=v.varianceAggregate=v.medianAggregate=v.EXO_AGGREGATE_NS=v.BUILT_IN_AGGREGATES=v.CustomAggregateError=v.CustomAggregateRegistry=v.AggregateFunctions=v.BuiltInFunctions=v.SolutionMapping=v.UpdateExecutorError=v.UpdateExecutor=v.QueryExecutor=v.DescribeExecutor=v.ConstructExecutor=v.UnionExecutor=v.OptionalExecutor=v.FilterExecutor=v.BGPExecutor=v.AlgebraSerializer=v.AlgebraOptimizer=v.AlgebraTranslator=v.DescribeOptionsTransformerError=v.DescribeOptionsTransformer=v.SPARQLParseError=v.SPARQLParser=v.NoteToRDFConverter=v.RDFSInferenceEngine=v.RDFVocabularyMapper=v.InMemoryTripleStore=v.RDFSerializer=v.FilenameValidator=v.EffortSortingHelpers=v.MetadataExtractor=v.MetadataHelpers=v.WikiLinkHelpers=v.DateFormatter=v.FrontmatterService=v.CriticalityZoneUUIDs=v.CriticalityZoneService=v.DailyReviewService=v.DEFAULT_AUTOCOMPLETE_CONFIG=void 0;v.createStreamingSource=v.StreamingLoader=v.resetGlobalPool=v.getGlobalPool=v.MemoryPool=v.CompactGraphStore=v.StringTable=v.DEFAULT_COLORS=v.NODE_FLAGS=v.container=v.resetContainer=v.getContainer=v.createChildContainer=v.registerCoreServices=v.DI_TOKENS=v.TransactionError=v.TripleNotFoundError=v.TripleAlreadyExistsError=v.FileAlreadyExistsError=v.FileNotFoundError=v.FilterContainsOptimizer=v.VaultPrefixTransformer=v.CaseWhenTransformerError=v.CaseWhenTransformer=v.ResultSerializer=v.createIncrementalIndexer=v.IncrementalIndexer=void 0;An(Gu(),v);An(zu(),v);An(z_(),v);An(Q_(),v);An(wm(),v);An(bm(),v);An(K_(),v);An(Z_(),v);An(rg(),v);An(Uw(),v);var HE=ag();Object.defineProperty(v,"PropertyFieldType",{enumerable:!0,get:o(function(){return HE.PropertyFieldType},"get")});Object.defineProperty(v,"rangeToFieldType",{enumerable:!0,get:o(function(){return HE.rangeToFieldType},"get")});var Y1=Ww();Object.defineProperty(v,"propertyNameToUri",{enumerable:!0,get:o(function(){return Y1.propertyNameToUri},"get")});Object.defineProperty(v,"uriToPropertyName",{enumerable:!0,get:o(function(){return Y1.uriToPropertyName},"get")});Object.defineProperty(v,"extractPropertyLabel",{enumerable:!0,get:o(function(){return Y1.extractPropertyLabel},"get")});var AL=Kg();Object.defineProperty(v,"TaskCreationService",{enumerable:!0,get:o(function(){return AL.TaskCreationService},"get")});var CL=Jg();Object.defineProperty(v,"ProjectCreationService",{enumerable:!0,get:o(function(){return CL.ProjectCreationService},"get")});var IL=d0();Object.defineProperty(v,"TaskStatusService",{enumerable:!0,get:o(function(){return IL.TaskStatusService},"get")});var OL=m0();Object.defineProperty(v,"AreaCreationService",{enumerable:!0,get:o(function(){return OL.AreaCreationService},"get")});var RL=y0();Object.defineProperty(v,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return RL.AreaHierarchyBuilder},"get")});var PL=_0();Object.defineProperty(v,"ClassCreationService",{enumerable:!0,get:o(function(){return PL.ClassCreationService},"get")});var FL=b0();Object.defineProperty(v,"ConceptCreationService",{enumerable:!0,get:o(function(){return FL.ConceptCreationService},"get")});var DL=Kf();Object.defineProperty(v,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return DL.EffortStatusWorkflow},"get")});var NL=e0();Object.defineProperty(v,"WorkflowEngine",{enumerable:!0,get:o(function(){return NL.WorkflowEngine},"get")});var kL=E0();Object.defineProperty(v,"EffortVotingService",{enumerable:!0,get:o(function(){return kL.EffortVotingService},"get")});var LL=x0();Object.defineProperty(v,"FolderRepairService",{enumerable:!0,get:o(function(){return LL.FolderRepairService},"get")});var ML=C0();Object.defineProperty(v,"LabelToAliasService",{enumerable:!0,get:o(function(){return ML.LabelToAliasService},"get")});var jL=Zf();Object.defineProperty(v,"LoggingService",{enumerable:!0,get:o(function(){return jL.LoggingService},"get")});var $L=R0();Object.defineProperty(v,"PropertyCleanupService",{enumerable:!0,get:o(function(){return $L.PropertyCleanupService},"get")});var VL=F0();Object.defineProperty(v,"RenameToUidService",{enumerable:!0,get:o(function(){return VL.RenameToUidService},"get")});var UL=Xf();Object.defineProperty(v,"StatusTimestampService",{enumerable:!0,get:o(function(){return UL.StatusTimestampService},"get")});var BL=N0();Object.defineProperty(v,"SupervisionCreationService",{enumerable:!0,get:o(function(){return BL.SupervisionCreationService},"get")});var qL=L0();Object.defineProperty(v,"FleetingNoteCreationService",{enumerable:!0,get:o(function(){return qL.FleetingNoteCreationService},"get")});var WL=Mf();Object.defineProperty(v,"TaskFrontmatterGenerator",{enumerable:!0,get:o(function(){return WL.TaskFrontmatterGenerator},"get")});var GL=j0();Object.defineProperty(v,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return GL.DynamicFrontmatterGenerator},"get")});var HL=jf();Object.defineProperty(v,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return HL.AlgorithmExtractor},"get")});var zL=V0();Object.defineProperty(v,"PlanningService",{enumerable:!0,get:o(function(){return zL.PlanningService},"get")});var QL=B0();Object.defineProperty(v,"AssetConversionService",{enumerable:!0,get:o(function(){return QL.AssetConversionService},"get")});var YL=W0();Object.defineProperty(v,"SessionEventService",{enumerable:!0,get:o(function(){return YL.SessionEventService},"get")});var KL=z0();Object.defineProperty(v,"URIConstructionService",{enumerable:!0,get:o(function(){return KL.URIConstructionService},"get")});var XL=Y0();Object.defineProperty(v,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return XL.GenericAssetCreationService},"get")});var JL=Kb();Object.defineProperty(v,"GraphQueryService",{enumerable:!0,get:o(function(){return JL.GraphQueryService},"get")});var ZL=Jb();Object.defineProperty(v,"TypeRegistry",{enumerable:!0,get:o(function(){return ZL.TypeRegistry},"get")});var zE=Zb();Object.defineProperty(v,"NLToSPARQLService",{enumerable:!0,get:o(function(){return zE.NLToSPARQLService},"get")});Object.defineProperty(v,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return zE.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var Cn=J0();Object.defineProperty(v,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return Cn.SPARQL_TEMPLATES},"get")});Object.defineProperty(v,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return Cn.SPARQL_PREFIXES},"get")});Object.defineProperty(v,"PREDICATES",{enumerable:!0,get:o(function(){return Cn.PREDICATES},"get")});Object.defineProperty(v,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return Cn.ASSET_CLASSES},"get")});Object.defineProperty(v,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return Cn.EFFORT_STATUSES},"get")});Object.defineProperty(v,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return Cn.KNOWN_PROTOTYPES},"get")});Object.defineProperty(v,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return Cn.KNOWN_CLASSES},"get")});Object.defineProperty(v,"findClassByTerm",{enumerable:!0,get:o(function(){return Cn.findClassByTerm},"get")});Object.defineProperty(v,"findMatchingTemplates",{enumerable:!0,get:o(function(){return Cn.findMatchingTemplates},"get")});Object.defineProperty(v,"fillTemplate",{enumerable:!0,get:o(function(){return Cn.fillTemplate},"get")});Object.defineProperty(v,"validateParameters",{enumerable:!0,get:o(function(){return Cn.validateParameters},"get")});Object.defineProperty(v,"getTemplateByName",{enumerable:!0,get:o(function(){return Cn.getTemplateByName},"get")});var e6=tS();Object.defineProperty(v,"AnalyticsService",{enumerable:!0,get:o(function(){return e6.AnalyticsService},"get")});var t6=rS();Object.defineProperty(v,"TrendDetectionService",{enumerable:!0,get:o(function(){return t6.TrendDetectionService},"get")});var QE=iS();Object.defineProperty(v,"AutocompleteService",{enumerable:!0,get:o(function(){return QE.AutocompleteService},"get")});Object.defineProperty(v,"DEFAULT_AUTOCOMPLETE_CONFIG",{enumerable:!0,get:o(function(){return QE.DEFAULT_AUTOCOMPLETE_CONFIG},"get")});var r6=aS();Object.defineProperty(v,"DailyReviewService",{enumerable:!0,get:o(function(){return r6.DailyReviewService},"get")});var YE=sy();Object.defineProperty(v,"CriticalityZoneService",{enumerable:!0,get:o(function(){return YE.CriticalityZoneService},"get")});Object.defineProperty(v,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return YE.CriticalityZoneUUIDs},"get")});var n6=Zi();Object.defineProperty(v,"FrontmatterService",{enumerable:!0,get:o(function(){return n6.FrontmatterService},"get")});var i6=or();Object.defineProperty(v,"DateFormatter",{enumerable:!0,get:o(function(){return i6.DateFormatter},"get")});var s6=aa();Object.defineProperty(v,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return s6.WikiLinkHelpers},"get")});var a6=bn();Object.defineProperty(v,"MetadataHelpers",{enumerable:!0,get:o(function(){return a6.MetadataHelpers},"get")});var o6=il();Object.defineProperty(v,"MetadataExtractor",{enumerable:!0,get:o(function(){return o6.MetadataExtractor},"get")});var c6=cS();Object.defineProperty(v,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return c6.EffortSortingHelpers},"get")});var l6=lS();Object.defineProperty(v,"FilenameValidator",{enumerable:!0,get:o(function(){return l6.FilenameValidator},"get")});var u6=gS();Object.defineProperty(v,"RDFSerializer",{enumerable:!0,get:o(function(){return u6.RDFSerializer},"get")});var f6=l0();Object.defineProperty(v,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return f6.InMemoryTripleStore},"get")});var h6=vy();Object.defineProperty(v,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return h6.RDFVocabularyMapper},"get")});var d6=vS();Object.defineProperty(v,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return d6.RDFSInferenceEngine},"get")});var p6=by();Object.defineProperty(v,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return p6.NoteToRDFConverter},"get")});var KE=VS();Object.defineProperty(v,"SPARQLParser",{enumerable:!0,get:o(function(){return KE.SPARQLParser},"get")});Object.defineProperty(v,"SPARQLParseError",{enumerable:!0,get:o(function(){return KE.SPARQLParseError},"get")});var XE=My();Object.defineProperty(v,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return XE.DescribeOptionsTransformer},"get")});Object.defineProperty(v,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return XE.DescribeOptionsTransformerError},"get")});var m6=BS();Object.defineProperty(v,"AlgebraTranslator",{enumerable:!0,get:o(function(){return m6.AlgebraTranslator},"get")});var g6=qS();Object.defineProperty(v,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return g6.AlgebraOptimizer},"get")});var y6=WS();Object.defineProperty(v,"AlgebraSerializer",{enumerable:!0,get:o(function(){return y6.AlgebraSerializer},"get")});var v6=r1();Object.defineProperty(v,"BGPExecutor",{enumerable:!0,get:o(function(){return v6.BGPExecutor},"get")});var _6=jh();Object.defineProperty(v,"FilterExecutor",{enumerable:!0,get:o(function(){return _6.FilterExecutor},"get")});var w6=a1();Object.defineProperty(v,"OptionalExecutor",{enumerable:!0,get:o(function(){return w6.OptionalExecutor},"get")});var b6=c1();Object.defineProperty(v,"UnionExecutor",{enumerable:!0,get:o(function(){return b6.UnionExecutor},"get")});var S6=h1();Object.defineProperty(v,"ConstructExecutor",{enumerable:!0,get:o(function(){return S6.ConstructExecutor},"get")});var E6=aE();Object.defineProperty(v,"DescribeExecutor",{enumerable:!0,get:o(function(){return E6.DescribeExecutor},"get")});var T6=vE();Object.defineProperty(v,"QueryExecutor",{enumerable:!0,get:o(function(){return T6.QueryExecutor},"get")});var JE=wE();Object.defineProperty(v,"UpdateExecutor",{enumerable:!0,get:o(function(){return JE.UpdateExecutor},"get")});Object.defineProperty(v,"UpdateExecutorError",{enumerable:!0,get:o(function(){return JE.UpdateExecutorError},"get")});var x6=as();Object.defineProperty(v,"SolutionMapping",{enumerable:!0,get:o(function(){return x6.SolutionMapping},"get")});var A6=Mh();Object.defineProperty(v,"BuiltInFunctions",{enumerable:!0,get:o(function(){return A6.BuiltInFunctions},"get")});var C6=SE();Object.defineProperty(v,"AggregateFunctions",{enumerable:!0,get:o(function(){return C6.AggregateFunctions},"get")});var ZE=g1();Object.defineProperty(v,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return ZE.CustomAggregateRegistry},"get")});Object.defineProperty(v,"CustomAggregateError",{enumerable:!0,get:o(function(){return ZE.CustomAggregateError},"get")});var Fi=y1();Object.defineProperty(v,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return Fi.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(v,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return Fi.EXO_AGGREGATE_NS},"get")});Object.defineProperty(v,"medianAggregate",{enumerable:!0,get:o(function(){return Fi.medianAggregate},"get")});Object.defineProperty(v,"varianceAggregate",{enumerable:!0,get:o(function(){return Fi.varianceAggregate},"get")});Object.defineProperty(v,"stddevAggregate",{enumerable:!0,get:o(function(){return Fi.stddevAggregate},"get")});Object.defineProperty(v,"modeAggregate",{enumerable:!0,get:o(function(){return Fi.modeAggregate},"get")});Object.defineProperty(v,"createPercentileAggregate",{enumerable:!0,get:o(function(){return Fi.createPercentileAggregate},"get")});Object.defineProperty(v,"getNumericValue",{enumerable:!0,get:o(function(){return Fi.getNumericValue},"get")});Object.defineProperty(v,"createDecimalLiteral",{enumerable:!0,get:o(function(){return Fi.createDecimalLiteral},"get")});Object.defineProperty(v,"createDoubleLiteral",{enumerable:!0,get:o(function(){return Fi.createDoubleLiteral},"get")});var I6=EE();Object.defineProperty(v,"QueryPlanCache",{enumerable:!0,get:o(function(){return I6.QueryPlanCache},"get")});var eT=TE();Object.defineProperty(v,"SPARQLResultCache",{enumerable:!0,get:o(function(){return eT.SPARQLResultCache},"get")});Object.defineProperty(v,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return eT.createSPARQLResultCache},"get")});var tT=xE();Object.defineProperty(v,"IncrementalIndexer",{enumerable:!0,get:o(function(){return tT.IncrementalIndexer},"get")});Object.defineProperty(v,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return tT.createIncrementalIndexer},"get")});var O6=AE();Object.defineProperty(v,"ResultSerializer",{enumerable:!0,get:o(function(){return O6.ResultSerializer},"get")});var rT=Ny();Object.defineProperty(v,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return rT.CaseWhenTransformer},"get")});Object.defineProperty(v,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return rT.CaseWhenTransformerError},"get")});var R6=Uy();Object.defineProperty(v,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return R6.VaultPrefixTransformer},"get")});var P6=Yy();Object.defineProperty(v,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return P6.FilterContainsOptimizer},"get")});var nT=CE();Object.defineProperty(v,"FileNotFoundError",{enumerable:!0,get:o(function(){return nT.FileNotFoundError},"get")});Object.defineProperty(v,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return nT.FileAlreadyExistsError},"get")});var K1=s0();Object.defineProperty(v,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return K1.TripleAlreadyExistsError},"get")});Object.defineProperty(v,"TripleNotFoundError",{enumerable:!0,get:o(function(){return K1.TripleNotFoundError},"get")});Object.defineProperty(v,"TransactionError",{enumerable:!0,get:o(function(){return K1.TransactionError},"get")});var F6=ht();Object.defineProperty(v,"DI_TOKENS",{enumerable:!0,get:o(function(){return F6.DI_TOKENS},"get")});var bl=IE();Object.defineProperty(v,"registerCoreServices",{enumerable:!0,get:o(function(){return bl.registerCoreServices},"get")});Object.defineProperty(v,"createChildContainer",{enumerable:!0,get:o(function(){return bl.createChildContainer},"get")});Object.defineProperty(v,"getContainer",{enumerable:!0,get:o(function(){return bl.getContainer},"get")});Object.defineProperty(v,"resetContainer",{enumerable:!0,get:o(function(){return bl.resetContainer},"get")});Object.defineProperty(v,"container",{enumerable:!0,get:o(function(){return bl.container},"get")});var os=NE();Object.defineProperty(v,"NODE_FLAGS",{enumerable:!0,get:o(function(){return os.NODE_FLAGS},"get")});Object.defineProperty(v,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return os.DEFAULT_COLORS},"get")});Object.defineProperty(v,"StringTable",{enumerable:!0,get:o(function(){return os.StringTable},"get")});Object.defineProperty(v,"CompactGraphStore",{enumerable:!0,get:o(function(){return os.CompactGraphStore},"get")});Object.defineProperty(v,"MemoryPool",{enumerable:!0,get:o(function(){return os.MemoryPool},"get")});Object.defineProperty(v,"getGlobalPool",{enumerable:!0,get:o(function(){return os.getGlobalPool},"get")});Object.defineProperty(v,"resetGlobalPool",{enumerable:!0,get:o(function(){return os.resetGlobalPool},"get")});Object.defineProperty(v,"StreamingLoader",{enumerable:!0,get:o(function(){return os.StreamingLoader},"get")});Object.defineProperty(v,"createStreamingSource",{enumerable:!0,get:o(function(){return os.createStreamingSource},"get")});An(qE(),v);An(GE(),v)});var zt=_(X1=>{"use strict";X1.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})};X1.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 sT=_((QK,iT)=>{var Ds=require("constants"),D6=process.cwd,yd=null,N6=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return yd||(yd=D6.call(process)),yd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(J1=process.chdir,process.chdir=function(n){yd=null,J1.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,J1));var J1;iT.exports=k6;function k6(n){Ds.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,h,d){d&&process.nextTick(d)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(f,h,d,p){p&&process.nextTick(p)},n.lchownSync=function(){}),N6==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function h(d,p,y){var w=Date.now(),T=0;f(d,p,o(function S(x){if(x&&(x.code==="EACCES"||x.code==="EPERM"||x.code==="EBUSY")&&Date.now()-w<6e4){setTimeout(function(){n.stat(p,function(F,Q){F&&F.code==="ENOENT"?f(d,p,S):y(x)})},T),T<100&&(T+=10);return}y&&y(x)},"CB"))}return o(h,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h})(n.rename)),n.read=typeof n.read!="function"?n.read:(function(f){function h(d,p,y,w,T,S){var x;if(S&&typeof S=="function"){var F=0;x=o(function(Q,K,Te){if(Q&&Q.code==="EAGAIN"&&F<10)return F++,f.call(n,d,p,y,w,T,x);S.apply(this,arguments)},"callback")}return f.call(n,d,p,y,w,T,x)}return o(h,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h})(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:(function(f){return function(h,d,p,y,w){for(var T=0;;)try{return f.call(n,h,d,p,y,w)}catch(S){if(S.code==="EAGAIN"&&T<10){T++;continue}throw S}}})(n.readSync);function e(f){f.lchmod=function(h,d,p){f.open(h,Ds.O_WRONLY|Ds.O_SYMLINK,d,function(y,w){if(y){p&&p(y);return}f.fchmod(w,d,function(T){f.close(w,function(S){p&&p(T||S)})})})},f.lchmodSync=function(h,d){var p=f.openSync(h,Ds.O_WRONLY|Ds.O_SYMLINK,d),y=!0,w;try{w=f.fchmodSync(p,d),y=!1}finally{if(y)try{f.closeSync(p)}catch{}else f.closeSync(p)}return w}}o(e,"patchLchmod");function t(f){Ds.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(h,d,p,y){f.open(h,Ds.O_SYMLINK,function(w,T){if(w){y&&y(w);return}f.futimes(T,d,p,function(S){f.close(T,function(x){y&&y(S||x)})})})},f.lutimesSync=function(h,d,p){var y=f.openSync(h,Ds.O_SYMLINK),w,T=!0;try{w=f.futimesSync(y,d,p),T=!1}finally{if(T)try{f.closeSync(y)}catch{}else f.closeSync(y)}return w}):f.futimes&&(f.lutimes=function(h,d,p,y){y&&process.nextTick(y)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(h,d,p){return f.call(n,h,d,function(y){u(y)&&(y=null),p&&p.apply(this,arguments)})}}o(r,"chmodFix");function i(f){return f&&function(h,d){try{return f.call(n,h,d)}catch(p){if(!u(p))throw p}}}o(i,"chmodFixSync");function s(f){return f&&function(h,d,p,y){return f.call(n,h,d,p,function(w){u(w)&&(w=null),y&&y.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(h,d,p){try{return f.call(n,h,d,p)}catch(y){if(!u(y))throw y}}}o(a,"chownFixSync");function c(f){return f&&function(h,d,p){typeof d=="function"&&(p=d,d=null);function y(w,T){T&&(T.uid<0&&(T.uid+=4294967296),T.gid<0&&(T.gid+=4294967296)),p&&p.apply(this,arguments)}return o(y,"callback"),d?f.call(n,h,d,y):f.call(n,h,y)}}o(c,"statFix");function l(f){return f&&function(h,d){var p=d?f.call(n,h,d):f.call(n,h);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 h=!process.getuid||process.getuid()!==0;return!!(h&&(f.code==="EINVAL"||f.code==="EPERM"))}o(u,"chownErOk")}o(k6,"patch")});var cT=_((KK,oT)=>{var aT=require("stream").Stream;oT.exports=L6;function L6(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);aT.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,h){if(f){s.emit("error",f),s.readable=!1;return}s.fd=h,s.emit("open",h),s._read()})}function t(r,i){if(!(this instanceof t))return new t(r,i);aT.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(L6,"legacy")});var uT=_((JK,lT)=>{"use strict";lT.exports=j6;var M6=Object.getPrototypeOf||function(n){return n.__proto__};function j6(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:M6(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(j6,"clone")});var Yo=_((eX,t2)=>{var Tt=require("fs"),$6=sT(),V6=cT(),U6=uT(),vd=require("util"),ur,wd;typeof Symbol=="function"&&typeof Symbol.for=="function"?(ur=Symbol.for("graceful-fs.queue"),wd=Symbol.for("graceful-fs.previous")):(ur="___graceful-fs.queue",wd="___graceful-fs.previous");function B6(){}o(B6,"noop");function dT(n,e){Object.defineProperty(n,ur,{get:o(function(){return e},"get")})}o(dT,"publishQueue");var Oa=B6;vd.debuglog?Oa=vd.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Oa=o(function(){var n=vd.format.apply(vd,arguments);n="GFS4: "+n.split(/\n/).join(`
|
|
380
|
+
GFS4: `),console.error(n)},"debug"));Tt[ur]||(fT=global[ur]||[],dT(Tt,fT),Tt.close=(function(n){function e(t,r){return n.call(Tt,t,function(i){i||hT(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,wd,{value:n}),e})(Tt.close),Tt.closeSync=(function(n){function e(t){n.apply(Tt,arguments),hT()}return o(e,"closeSync"),Object.defineProperty(e,wd,{value:n}),e})(Tt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Oa(Tt[ur]),require("assert").equal(Tt[ur].length,0)}));var fT;global[ur]||dT(global,Tt[ur]);t2.exports=Z1(U6(Tt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Tt.__patched&&(t2.exports=Z1(Tt),Tt.__patched=!0);function Z1(n){$6(n),n.gracefulify=Z1,n.createReadStream=K,n.createWriteStream=Te;var e=n.readFile;n.readFile=t;function t(L,$,Z){return typeof $=="function"&&(Z=$,$=null),qe(L,$,Z);function qe(et,wt,tt,nt){return e(et,wt,function(We){We&&(We.code==="EMFILE"||We.code==="ENFILE")?Qo([qe,[et,wt,tt],We,nt||Date.now(),Date.now()]):typeof tt=="function"&&tt.apply(this,arguments)})}o(qe,"go$readFile")}o(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(L,$,Z,qe){return typeof Z=="function"&&(qe=Z,Z=null),et(L,$,Z,qe);function et(wt,tt,nt,We,re){return r(wt,tt,nt,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Qo([et,[wt,tt,nt,We],U,re||Date.now(),Date.now()]):typeof We=="function"&&We.apply(this,arguments)})}o(et,"go$writeFile")}o(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=a);function a(L,$,Z,qe){return typeof Z=="function"&&(qe=Z,Z=null),et(L,$,Z,qe);function et(wt,tt,nt,We,re){return s(wt,tt,nt,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Qo([et,[wt,tt,nt,We],U,re||Date.now(),Date.now()]):typeof We=="function"&&We.apply(this,arguments)})}o(et,"go$appendFile")}o(a,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(L,$,Z,qe){return typeof Z=="function"&&(qe=Z,Z=0),et(L,$,Z,qe);function et(wt,tt,nt,We,re){return c(wt,tt,nt,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Qo([et,[wt,tt,nt,We],U,re||Date.now(),Date.now()]):typeof We=="function"&&We.apply(this,arguments)})}o(et,"go$copyFile")}o(l,"copyFile");var u=n.readdir;n.readdir=h;var f=/^v[0-5]\./;function h(L,$,Z){typeof $=="function"&&(Z=$,$=null);var qe=f.test(process.version)?o(function(tt,nt,We,re){return u(tt,et(tt,nt,We,re))},"go$readdir"):o(function(tt,nt,We,re){return u(tt,nt,et(tt,nt,We,re))},"go$readdir");return qe(L,$,Z);function et(wt,tt,nt,We){return function(re,U){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Qo([qe,[wt,tt,nt],re,We||Date.now(),Date.now()]):(U&&U.sort&&U.sort(),typeof nt=="function"&&nt.call(this,re,U))}}}if(o(h,"readdir"),process.version.substr(0,4)==="v0.8"){var d=V6(n);S=d.ReadStream,F=d.WriteStream}var p=n.ReadStream;p&&(S.prototype=Object.create(p.prototype),S.prototype.open=x);var y=n.WriteStream;y&&(F.prototype=Object.create(y.prototype),F.prototype.open=Q),Object.defineProperty(n,"ReadStream",{get:o(function(){return S},"get"),set:o(function(L){S=L},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return F},"get"),set:o(function(L){F=L},"set"),enumerable:!0,configurable:!0});var w=S;Object.defineProperty(n,"FileReadStream",{get:o(function(){return w},"get"),set:o(function(L){w=L},"set"),enumerable:!0,configurable:!0});var T=F;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return T},"get"),set:o(function(L){T=L},"set"),enumerable:!0,configurable:!0});function S(L,$){return this instanceof S?(p.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}o(S,"ReadStream");function x(){var L=this;J(L.path,L.flags,L.mode,function($,Z){$?(L.autoClose&&L.destroy(),L.emit("error",$)):(L.fd=Z,L.emit("open",Z),L.read())})}o(x,"ReadStream$open");function F(L,$){return this instanceof F?(y.apply(this,arguments),this):F.apply(Object.create(F.prototype),arguments)}o(F,"WriteStream");function Q(){var L=this;J(L.path,L.flags,L.mode,function($,Z){$?(L.destroy(),L.emit("error",$)):(L.fd=Z,L.emit("open",Z))})}o(Q,"WriteStream$open");function K(L,$){return new n.ReadStream(L,$)}o(K,"createReadStream");function Te(L,$){return new n.WriteStream(L,$)}o(Te,"createWriteStream");var H=n.open;n.open=J;function J(L,$,Z,qe){return typeof Z=="function"&&(qe=Z,Z=null),et(L,$,Z,qe);function et(wt,tt,nt,We,re){return H(wt,tt,nt,function(U,it){U&&(U.code==="EMFILE"||U.code==="ENFILE")?Qo([et,[wt,tt,nt,We],U,re||Date.now(),Date.now()]):typeof We=="function"&&We.apply(this,arguments)})}o(et,"go$open")}return o(J,"open"),n}o(Z1,"patch");function Qo(n){Oa("ENQUEUE",n[0].name,n[1]),Tt[ur].push(n),e2()}o(Qo,"enqueue");var _d;function hT(){for(var n=Date.now(),e=0;e<Tt[ur].length;++e)Tt[ur][e].length>2&&(Tt[ur][e][3]=n,Tt[ur][e][4]=n);e2()}o(hT,"resetQueue");function e2(){if(clearTimeout(_d),_d=void 0,Tt[ur].length!==0){var n=Tt[ur].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Oa("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Oa("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?(Oa("RETRY",e.name,t),e.apply(null,t.concat([i]))):Tt[ur].push(n)}_d===void 0&&(_d=setTimeout(e2,0))}}o(e2,"retry")});var Wr=_(cs=>{"use strict";var pT=zt().fromCallback,qr=Yo(),q6=["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 qr[n]=="function");Object.assign(cs,qr);q6.forEach(n=>{cs[n]=pT(qr[n])});cs.exists=function(n,e){return typeof e=="function"?qr.exists(n,e):new Promise(t=>qr.exists(n,t))};cs.read=function(n,e,t,r,i,s){return typeof s=="function"?qr.read(n,e,t,r,i,s):new Promise((a,c)=>{qr.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};cs.write=function(n,e,...t){return typeof t[t.length-1]=="function"?qr.write(n,e,...t):new Promise((r,i)=>{qr.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};cs.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?qr.readv(n,e,...t):new Promise((r,i)=>{qr.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};cs.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?qr.writev(n,e,...t):new Promise((r,i)=>{qr.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof qr.realpath.native=="function"?cs.realpath.native=pT(qr.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var gT=_((nX,mT)=>{"use strict";var W6=require("path");mT.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(W6.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var wT=_((sX,r2)=>{"use strict";var yT=Wr(),{checkPath:vT}=gT(),_T=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");r2.exports.makeDir=async(n,e)=>(vT(n),yT.mkdir(n,{mode:_T(e),recursive:!0}));r2.exports.makeDirSync=(n,e)=>(vT(n),yT.mkdirSync(n,{mode:_T(e),recursive:!0}))});var si=_((oX,bT)=>{"use strict";var G6=zt().fromPromise,{makeDir:H6,makeDirSync:n2}=wT(),i2=G6(H6);bT.exports={mkdirs:i2,mkdirsSync:n2,mkdirp:i2,mkdirpSync:n2,ensureDir:i2,ensureDirSync:n2}});var Ns=_((cX,ET)=>{"use strict";var z6=zt().fromPromise,ST=Wr();function Q6(n){return ST.access(n).then(()=>!0).catch(()=>!1)}o(Q6,"pathExists");ET.exports={pathExists:z6(Q6),pathExistsSync:ST.existsSync}});var s2=_((uX,TT)=>{"use strict";var Ko=Wr(),Y6=zt().fromPromise;async function K6(n,e,t){let r=await Ko.open(n,"r+"),i=null;try{await Ko.futimes(r,e,t)}finally{try{await Ko.close(r)}catch(s){i=s}}if(i)throw i}o(K6,"utimesMillis");function X6(n,e,t){let r=Ko.openSync(n,"r+");return Ko.futimesSync(r,e,t),Ko.closeSync(r)}o(X6,"utimesMillisSync");TT.exports={utimesMillis:Y6(K6),utimesMillisSync:X6}});var Ra=_((hX,IT)=>{"use strict";var Xo=Wr(),Qt=require("path"),xT=zt().fromPromise;function J6(n,e,t){let r=t.dereference?i=>Xo.stat(i,{bigint:!0}):i=>Xo.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(J6,"getStats");function Z6(n,e,t){let r,i=t.dereference?a=>Xo.statSync(a,{bigint:!0}):a=>Xo.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(Z6,"getStatsSync");async function eM(n,e,t,r){let{srcStat:i,destStat:s}=await J6(n,e,r);if(s){if(Sl(i,s)){let a=Qt.basename(n),c=Qt.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()&&a2(n,e))throw new Error(bd(n,e,t));return{srcStat:i,destStat:s}}o(eM,"checkPaths");function tM(n,e,t,r){let{srcStat:i,destStat:s}=Z6(n,e,r);if(s){if(Sl(i,s)){let a=Qt.basename(n),c=Qt.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()&&a2(n,e))throw new Error(bd(n,e,t));return{srcStat:i,destStat:s}}o(tM,"checkPathsSync");async function AT(n,e,t,r){let i=Qt.resolve(Qt.dirname(n)),s=Qt.resolve(Qt.dirname(t));if(s===i||s===Qt.parse(s).root)return;let a;try{a=await Xo.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Sl(e,a))throw new Error(bd(n,t,r));return AT(n,e,s,r)}o(AT,"checkParentPaths");function CT(n,e,t,r){let i=Qt.resolve(Qt.dirname(n)),s=Qt.resolve(Qt.dirname(t));if(s===i||s===Qt.parse(s).root)return;let a;try{a=Xo.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Sl(e,a))throw new Error(bd(n,t,r));return CT(n,e,s,r)}o(CT,"checkParentPathsSync");function Sl(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(Sl,"areIdentical");function a2(n,e){let t=Qt.resolve(n).split(Qt.sep).filter(i=>i),r=Qt.resolve(e).split(Qt.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(a2,"isSrcSubdir");function bd(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(bd,"errMsg");IT.exports={checkPaths:xT(eM),checkPathsSync:tM,checkParentPaths:xT(AT),checkParentPathsSync:CT,isSrcSubdir:a2,areIdentical:Sl}});var RT=_((pX,OT)=>{"use strict";async function rM(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(rM,"asyncIteratorConcurrentProcess");OT.exports={asyncIteratorConcurrentProcess:rM}});var kT=_((gX,NT)=>{"use strict";var xr=Wr(),El=require("path"),{mkdirs:nM}=si(),{pathExists:iM}=Ns(),{utimesMillis:sM}=s2(),Tl=Ra(),{asyncIteratorConcurrentProcess:aM}=RT();async function oM(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;
|
|
381
381
|
|
|
382
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await Tl.checkPaths(n,e,"copy",t);if(await Tl.checkParentPaths(n,r,e,"copy"),!await FT(n,e,t))return;let a=El.dirname(e);await iM(a)||await nM(a),await DT(i,n,e,t)}o(oM,"copy");async function FT(n,e,t){return t.filter?t.filter(n,e):!0}o(FT,"runFilter");async function DT(n,e,t,r){let s=await(r.dereference?xr.stat:xr.lstat)(e);if(s.isDirectory())return fM(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return cM(s,n,e,t,r);if(s.isSymbolicLink())return hM(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(DT,"getStatsAndPerformCopy");async function cM(n,e,t,r,i){if(!e)return PT(n,t,r,i);if(i.overwrite)return await xr.unlink(r),PT(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}o(cM,"onFile");async function PT(n,e,t,r){if(await xr.copyFile(e,t),r.preserveTimestamps){lM(n.mode)&&await uM(t,n.mode);let i=await xr.stat(e);await sM(t,i.atime,i.mtime)}return xr.chmod(t,n.mode)}o(PT,"copyFile");function lM(n){return(n&128)===0}o(lM,"fileIsNotWritable");function uM(n,e){return xr.chmod(n,e|128)}o(uM,"makeFileWritable");async function fM(n,e,t,r,i){e||await xr.mkdir(r),await aM(await xr.opendir(t),async s=>{let a=El.join(t,s.name),c=El.join(r,s.name);if(await FT(a,c,i)){let{destStat:u}=await Tl.checkPaths(a,c,"copy",i);await DT(u,a,c,i)}}),e||await xr.chmod(r,n.mode)}o(fM,"onDir");async function hM(n,e,t,r){let i=await xr.readlink(e);if(r.dereference&&(i=El.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=El.resolve(process.cwd(),s)),Tl.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Tl.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await xr.unlink(t),xr.symlink(i,t)}o(hM,"onLink");NT.exports=oM});var VT=_((
|
|
382
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await Tl.checkPaths(n,e,"copy",t);if(await Tl.checkParentPaths(n,r,e,"copy"),!await FT(n,e,t))return;let a=El.dirname(e);await iM(a)||await nM(a),await DT(i,n,e,t)}o(oM,"copy");async function FT(n,e,t){return t.filter?t.filter(n,e):!0}o(FT,"runFilter");async function DT(n,e,t,r){let s=await(r.dereference?xr.stat:xr.lstat)(e);if(s.isDirectory())return fM(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return cM(s,n,e,t,r);if(s.isSymbolicLink())return hM(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(DT,"getStatsAndPerformCopy");async function cM(n,e,t,r,i){if(!e)return PT(n,t,r,i);if(i.overwrite)return await xr.unlink(r),PT(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}o(cM,"onFile");async function PT(n,e,t,r){if(await xr.copyFile(e,t),r.preserveTimestamps){lM(n.mode)&&await uM(t,n.mode);let i=await xr.stat(e);await sM(t,i.atime,i.mtime)}return xr.chmod(t,n.mode)}o(PT,"copyFile");function lM(n){return(n&128)===0}o(lM,"fileIsNotWritable");function uM(n,e){return xr.chmod(n,e|128)}o(uM,"makeFileWritable");async function fM(n,e,t,r,i){e||await xr.mkdir(r),await aM(await xr.opendir(t),async s=>{let a=El.join(t,s.name),c=El.join(r,s.name);if(await FT(a,c,i)){let{destStat:u}=await Tl.checkPaths(a,c,"copy",i);await DT(u,a,c,i)}}),e||await xr.chmod(r,n.mode)}o(fM,"onDir");async function hM(n,e,t,r){let i=await xr.readlink(e);if(r.dereference&&(i=El.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=El.resolve(process.cwd(),s)),Tl.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Tl.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await xr.unlink(t),xr.symlink(i,t)}o(hM,"onLink");NT.exports=oM});var VT=_((vX,$T)=>{"use strict";var Gr=Yo(),xl=require("path"),dM=si().mkdirsSync,pM=s2().utimesMillisSync,Al=Ra();function mM(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;
|
|
383
383
|
|
|
384
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=Al.checkPathsSync(n,e,"copy",t);if(Al.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=xl.dirname(e);return Gr.existsSync(s)||dM(s),LT(i,n,e,t)}o(mM,"copySync");function LT(n,e,t,r){let s=(r.dereference?Gr.statSync:Gr.lstatSync)(e);if(s.isDirectory())return SM(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return gM(s,n,e,t,r);if(s.isSymbolicLink())return xM(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(LT,"getStats");function gM(n,e,t,r,i){return e?yM(n,t,r,i):MT(n,t,r,i)}o(gM,"onFile");function yM(n,e,t,r){if(r.overwrite)return Gr.unlinkSync(t),MT(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}o(yM,"mayCopyFile");function MT(n,e,t,r){return Gr.copyFileSync(e,t),r.preserveTimestamps&&vM(n.mode,e,t),o2(t,n.mode)}o(MT,"copyFile");function vM(n,e,t){return _M(n)&&wM(t,n),bM(e,t)}o(vM,"handleTimestamps");function _M(n){return(n&128)===0}o(_M,"fileIsNotWritable");function wM(n,e){return o2(n,e|128)}o(wM,"makeFileWritable");function o2(n,e){return Gr.chmodSync(n,e)}o(o2,"setDestMode");function bM(n,e){let t=Gr.statSync(n);return pM(e,t.atime,t.mtime)}o(bM,"setDestTimestamps");function SM(n,e,t,r,i){return e?jT(t,r,i):EM(n.mode,t,r,i)}o(SM,"onDir");function EM(n,e,t,r){return Gr.mkdirSync(t),jT(e,t,r),o2(t,n)}o(EM,"mkDirAndCopy");function jT(n,e,t){let r=Gr.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)TM(i.name,n,e,t)}finally{r.closeSync()}}o(jT,"copyDir");function TM(n,e,t,r){let i=xl.join(e,n),s=xl.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:a}=Al.checkPathsSync(i,s,"copy",r);return LT(a,i,s,r)}o(TM,"copyDirItem");function xM(n,e,t,r){let i=Gr.readlinkSync(e);if(r.dereference&&(i=xl.resolve(process.cwd(),i)),n){let s;try{s=Gr.readlinkSync(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Gr.symlinkSync(i,t);throw a}if(r.dereference&&(s=xl.resolve(process.cwd(),s)),Al.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Al.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return AM(i,t)}else return Gr.symlinkSync(i,t)}o(xM,"onLink");function AM(n,e){return Gr.unlinkSync(e),Gr.symlinkSync(n,e)}o(AM,"copyLink");$T.exports=mM});var Sd=_((
|
|
385
|
-
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(r7,"stringify");function n7(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(n7,"stripBom");T3.exports={stringify:r7,stripBom:n7}});var I3=_((
|
|
384
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=Al.checkPathsSync(n,e,"copy",t);if(Al.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=xl.dirname(e);return Gr.existsSync(s)||dM(s),LT(i,n,e,t)}o(mM,"copySync");function LT(n,e,t,r){let s=(r.dereference?Gr.statSync:Gr.lstatSync)(e);if(s.isDirectory())return SM(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return gM(s,n,e,t,r);if(s.isSymbolicLink())return xM(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(LT,"getStats");function gM(n,e,t,r,i){return e?yM(n,t,r,i):MT(n,t,r,i)}o(gM,"onFile");function yM(n,e,t,r){if(r.overwrite)return Gr.unlinkSync(t),MT(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}o(yM,"mayCopyFile");function MT(n,e,t,r){return Gr.copyFileSync(e,t),r.preserveTimestamps&&vM(n.mode,e,t),o2(t,n.mode)}o(MT,"copyFile");function vM(n,e,t){return _M(n)&&wM(t,n),bM(e,t)}o(vM,"handleTimestamps");function _M(n){return(n&128)===0}o(_M,"fileIsNotWritable");function wM(n,e){return o2(n,e|128)}o(wM,"makeFileWritable");function o2(n,e){return Gr.chmodSync(n,e)}o(o2,"setDestMode");function bM(n,e){let t=Gr.statSync(n);return pM(e,t.atime,t.mtime)}o(bM,"setDestTimestamps");function SM(n,e,t,r,i){return e?jT(t,r,i):EM(n.mode,t,r,i)}o(SM,"onDir");function EM(n,e,t,r){return Gr.mkdirSync(t),jT(e,t,r),o2(t,n)}o(EM,"mkDirAndCopy");function jT(n,e,t){let r=Gr.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)TM(i.name,n,e,t)}finally{r.closeSync()}}o(jT,"copyDir");function TM(n,e,t,r){let i=xl.join(e,n),s=xl.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:a}=Al.checkPathsSync(i,s,"copy",r);return LT(a,i,s,r)}o(TM,"copyDirItem");function xM(n,e,t,r){let i=Gr.readlinkSync(e);if(r.dereference&&(i=xl.resolve(process.cwd(),i)),n){let s;try{s=Gr.readlinkSync(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Gr.symlinkSync(i,t);throw a}if(r.dereference&&(s=xl.resolve(process.cwd(),s)),Al.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Al.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return AM(i,t)}else return Gr.symlinkSync(i,t)}o(xM,"onLink");function AM(n,e){return Gr.unlinkSync(e),Gr.symlinkSync(n,e)}o(AM,"copyLink");$T.exports=mM});var Sd=_((wX,UT)=>{"use strict";var CM=zt().fromPromise;UT.exports={copy:CM(kT()),copySync:VT()}});var Cl=_((bX,qT)=>{"use strict";var BT=Yo(),IM=zt().fromCallback;function OM(n,e){BT.rm(n,{recursive:!0,force:!0},e)}o(OM,"remove");function RM(n){BT.rmSync(n,{recursive:!0,force:!0})}o(RM,"removeSync");qT.exports={remove:IM(OM),removeSync:RM}});var XT=_((EX,KT)=>{"use strict";var PM=zt().fromPromise,HT=Wr(),zT=require("path"),QT=si(),YT=Cl(),WT=PM(o(async function(e){let t;try{t=await HT.readdir(e)}catch{return QT.mkdirs(e)}return Promise.all(t.map(r=>YT.remove(zT.join(e,r))))},"emptyDir"));function GT(n){let e;try{e=HT.readdirSync(n)}catch{return QT.mkdirsSync(n)}e.forEach(t=>{t=zT.join(n,t),YT.removeSync(t)})}o(GT,"emptyDirSync");KT.exports={emptyDirSync:GT,emptydirSync:GT,emptyDir:WT,emptydir:WT}});var t3=_((xX,e3)=>{"use strict";var FM=zt().fromPromise,JT=require("path"),ls=Wr(),ZT=si();async function DM(n){let e;try{e=await ls.stat(n)}catch{}if(e&&e.isFile())return;let t=JT.dirname(n),r=null;try{r=await ls.stat(t)}catch(i){if(i.code==="ENOENT"){await ZT.mkdirs(t),await ls.writeFile(n,"");return}else throw i}r.isDirectory()?await ls.writeFile(n,""):await ls.readdir(t)}o(DM,"createFile");function NM(n){let e;try{e=ls.statSync(n)}catch{}if(e&&e.isFile())return;let t=JT.dirname(n);try{ls.statSync(t).isDirectory()||ls.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")ZT.mkdirsSync(t);else throw r}ls.writeFileSync(n,"")}o(NM,"createFileSync");e3.exports={createFile:FM(DM),createFileSync:NM}});var a3=_((CX,s3)=>{"use strict";var kM=zt().fromPromise,r3=require("path"),ks=Wr(),n3=si(),{pathExists:LM}=Ns(),{areIdentical:i3}=Ra();async function MM(n,e){let t;try{t=await ks.lstat(e)}catch{}let r;try{r=await ks.lstat(n)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(t&&i3(r,t))return;let i=r3.dirname(e);await LM(i)||await n3.mkdirs(i),await ks.link(n,e)}o(MM,"createLink");function jM(n,e){let t;try{t=ks.lstatSync(e)}catch{}try{let s=ks.lstatSync(n);if(t&&i3(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=r3.dirname(e);return ks.existsSync(r)||n3.mkdirsSync(r),ks.linkSync(n,e)}o(jM,"createLinkSync");s3.exports={createLink:kM(MM),createLinkSync:jM}});var c3=_((OX,o3)=>{"use strict";var Ls=require("path"),Il=Wr(),{pathExists:$M}=Ns(),VM=zt().fromPromise;async function UM(n,e){if(Ls.isAbsolute(n)){try{await Il.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=Ls.dirname(e),r=Ls.join(t,n);if(await $M(r))return{toCwd:r,toDst:n};try{await Il.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:Ls.relative(t,n)}}o(UM,"symlinkPaths");function BM(n,e){if(Ls.isAbsolute(n)){if(!Il.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=Ls.dirname(e),r=Ls.join(t,n);if(Il.existsSync(r))return{toCwd:r,toDst:n};if(!Il.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:Ls.relative(t,n)}}o(BM,"symlinkPathsSync");o3.exports={symlinkPaths:VM(UM),symlinkPathsSync:BM}});var f3=_((PX,u3)=>{"use strict";var l3=Wr(),qM=zt().fromPromise;async function WM(n,e){if(e)return e;let t;try{t=await l3.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(WM,"symlinkType");function GM(n,e){if(e)return e;let t;try{t=l3.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(GM,"symlinkTypeSync");u3.exports={symlinkType:qM(WM),symlinkTypeSync:GM}});var m3=_((DX,p3)=>{"use strict";var HM=zt().fromPromise,h3=require("path"),Di=Wr(),{mkdirs:zM,mkdirsSync:QM}=si(),{symlinkPaths:YM,symlinkPathsSync:KM}=c3(),{symlinkType:XM,symlinkTypeSync:JM}=f3(),{pathExists:ZM}=Ns(),{areIdentical:d3}=Ra();async function e7(n,e,t){let r;try{r=await Di.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([Di.stat(n),Di.stat(e)]);if(d3(c,l))return}let i=await YM(n,e);n=i.toDst;let s=await XM(i.toCwd,t),a=h3.dirname(e);return await ZM(a)||await zM(a),Di.symlink(n,e,s)}o(e7,"createSymlink");function t7(n,e,t){let r;try{r=Di.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=Di.statSync(n),l=Di.statSync(e);if(d3(c,l))return}let i=KM(n,e);n=i.toDst,t=JM(i.toCwd,t);let s=h3.dirname(e);return Di.existsSync(s)||QM(s),Di.symlinkSync(n,e,t)}o(t7,"createSymlinkSync");p3.exports={createSymlink:HM(e7),createSymlinkSync:t7}});var E3=_((kX,S3)=>{"use strict";var{createFile:g3,createFileSync:y3}=t3(),{createLink:v3,createLinkSync:_3}=a3(),{createSymlink:w3,createSymlinkSync:b3}=m3();S3.exports={createFile:g3,createFileSync:y3,ensureFile:g3,ensureFileSync:y3,createLink:v3,createLinkSync:_3,ensureLink:v3,ensureLinkSync:_3,createSymlink:w3,createSymlinkSync:b3,ensureSymlink:w3,ensureSymlinkSync:b3}});var Ed=_((LX,T3)=>{function r7(n,{EOL:e=`
|
|
385
|
+
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(r7,"stringify");function n7(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(n7,"stripBom");T3.exports={stringify:r7,stripBom:n7}});var I3=_((jX,C3)=>{var Jo;try{Jo=Yo()}catch{Jo=require("fs")}var Td=zt(),{stringify:x3,stripBom:A3}=Ed();async function i7(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Jo,r="throws"in e?e.throws:!0,i=await Td.fromCallback(t.readFile)(n,e);i=A3(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(i7,"_readFile");var s7=Td.fromPromise(i7);function a7(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Jo,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=A3(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(a7,"readFileSync");async function o7(n,e,t={}){let r=t.fs||Jo,i=x3(e,t);await Td.fromCallback(r.writeFile)(n,i,t)}o(o7,"_writeFile");var c7=Td.fromPromise(o7);function l7(n,e,t={}){let r=t.fs||Jo,i=x3(e,t);return r.writeFileSync(n,i,t)}o(l7,"writeFileSync");C3.exports={readFile:s7,readFileSync:a7,writeFile:c7,writeFileSync:l7}});var R3=_((VX,O3)=>{"use strict";var xd=I3();O3.exports={readJson:xd.readFile,readJsonSync:xd.readFileSync,writeJson:xd.writeFile,writeJsonSync:xd.writeFileSync}});var Ad=_((UX,D3)=>{"use strict";var u7=zt().fromPromise,c2=Wr(),P3=require("path"),F3=si(),f7=Ns().pathExists;async function h7(n,e,t="utf-8"){let r=P3.dirname(n);return await f7(r)||await F3.mkdirs(r),c2.writeFile(n,e,t)}o(h7,"outputFile");function d7(n,...e){let t=P3.dirname(n);c2.existsSync(t)||F3.mkdirsSync(t),c2.writeFileSync(n,...e)}o(d7,"outputFileSync");D3.exports={outputFile:u7(h7),outputFileSync:d7}});var k3=_((qX,N3)=>{"use strict";var{stringify:p7}=Ed(),{outputFile:m7}=Ad();async function g7(n,e,t={}){let r=p7(e,t);await m7(n,r,t)}o(g7,"outputJson");N3.exports=g7});var M3=_((GX,L3)=>{"use strict";var{stringify:y7}=Ed(),{outputFileSync:v7}=Ad();function _7(n,e,t){let r=y7(e,t);v7(n,r,t)}o(_7,"outputJsonSync");L3.exports=_7});var $3=_((zX,j3)=>{"use strict";var w7=zt().fromPromise,Hr=R3();Hr.outputJson=w7(k3());Hr.outputJsonSync=M3();Hr.outputJSON=Hr.outputJson;Hr.outputJSONSync=Hr.outputJsonSync;Hr.writeJSON=Hr.writeJson;Hr.writeJSONSync=Hr.writeJsonSync;Hr.readJSON=Hr.readJson;Hr.readJSONSync=Hr.readJsonSync;j3.exports=Hr});var W3=_((QX,q3)=>{"use strict";var b7=Wr(),V3=require("path"),{copy:S7}=Sd(),{remove:B3}=Cl(),{mkdirp:E7}=si(),{pathExists:T7}=Ns(),U3=Ra();async function x7(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await U3.checkPaths(n,e,"move",t);await U3.checkParentPaths(n,i,e,"move");let a=V3.dirname(e);return V3.parse(a).root!==a&&await E7(a),A7(n,e,r,s)}o(x7,"move");async function A7(n,e,t,r){if(!r){if(t)await B3(e);else if(await T7(e))throw new Error("dest already exists.")}try{await b7.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await C7(n,e,t)}}o(A7,"doRename");async function C7(n,e,t){return await S7(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),B3(n)}o(C7,"moveAcrossDevice");q3.exports=x7});var Y3=_((KX,Q3)=>{"use strict";var H3=Yo(),u2=require("path"),I7=Sd().copySync,z3=Cl().removeSync,O7=si().mkdirpSync,G3=Ra();function R7(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=G3.checkPathsSync(n,e,"move",t);return G3.checkParentPathsSync(n,i,e,"move"),P7(e)||O7(u2.dirname(e)),F7(n,e,r,s)}o(R7,"moveSync");function P7(n){let e=u2.dirname(n);return u2.parse(e).root===e}o(P7,"isParentRoot");function F7(n,e,t,r){if(r)return l2(n,e,t);if(t)return z3(e),l2(n,e,t);if(H3.existsSync(e))throw new Error("dest already exists.");return l2(n,e,t)}o(F7,"doRename");function l2(n,e,t){try{H3.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return D7(n,e,t)}}o(l2,"rename");function D7(n,e,t){return I7(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),z3(n)}o(D7,"moveAcrossDevice");Q3.exports=R7});var X3=_((JX,K3)=>{"use strict";var N7=zt().fromPromise;K3.exports={move:N7(W3()),moveSync:Y3()}});var Ms=_((ZX,J3)=>{"use strict";J3.exports={...Wr(),...Sd(),...XT(),...E3(),...$3(),...si(),...X3(),...Ad(),...Ns(),...Cl()}});var WA=_((Fre,qA)=>{"use strict";qA.exports=UA;function UA(n,e,t){n instanceof RegExp&&(n=VA(n,t)),e instanceof RegExp&&(e=VA(e,t));var r=BA(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(UA,"balanced");function VA(n,e){var t=e.match(n);return t?t[0]:null}o(VA,"maybeMatch");UA.range=BA;function BA(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(BA,"range")});var JA=_((Nre,XA)=>{var GA=WA();XA.exports=mV;var HA="\0SLASH"+Math.random()+"\0",zA="\0OPEN"+Math.random()+"\0",rv="\0CLOSE"+Math.random()+"\0",QA="\0COMMA"+Math.random()+"\0",YA="\0PERIOD"+Math.random()+"\0";function tv(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(tv,"numeric");function dV(n){return n.split("\\\\").join(HA).split("\\{").join(zA).split("\\}").join(rv).split("\\,").join(QA).split("\\.").join(YA)}o(dV,"escapeBraces");function pV(n){return n.split(HA).join("\\").split(zA).join("{").split(rv).join("}").split(QA).join(",").split(YA).join(".")}o(pV,"unescapeBraces");function KA(n){if(!n)return[""];var e=[],t=GA("{","}",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=KA(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(KA,"parseCommaParts");function mV(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Ql(dV(n),!0).map(pV)):[]}o(mV,"expandTop");function gV(n){return"{"+n+"}"}o(gV,"embrace");function yV(n){return/^-?0\d/.test(n)}o(yV,"isPadded");function vV(n,e){return n<=e}o(vV,"lte");function _V(n,e){return n>=e}o(_V,"gte");function Ql(n,e){var t=[],r=GA("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?Ql(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,h=r.body.indexOf(",")>=0;if(!f&&!h)return r.post.match(/,(?!,).*\}/)?(n=r.pre+"{"+r.body+rv+r.post,Ql(n)):[n];var d;if(f)d=r.body.split(/\.\./);else if(d=KA(r.body),d.length===1&&(d=Ql(d[0],!1).map(gV),d.length===1))return s.map(function($){return r.pre+d[0]+$});var p;if(f){var y=tv(d[0]),w=tv(d[1]),T=Math.max(d[0].length,d[1].length),S=d.length==3?Math.abs(tv(d[2])):1,x=vV,F=w<y;F&&(S*=-1,x=_V);var Q=d.some(yV);p=[];for(var K=y;x(K,w);K+=S){var Te;if(u)Te=String.fromCharCode(K),Te==="\\"&&(Te="");else if(Te=String(K),Q){var H=T-Te.length;if(H>0){var J=new Array(H+1).join("0");K<0?Te="-"+J+Te.slice(1):Te=J+Te}}p.push(Te)}}else{p=[];for(var L=0;L<d.length;L++)p.push.apply(p,Ql(d[L],!1))}for(var L=0;L<p.length;L++)for(var a=0;a<s.length;a++){var c=i+p[L]+s[a];(!e||f||c)&&t.push(c)}}return t}o(Ql,"expand")});var Xoe=X(Vu());var W_=X(q_(),1),{program:wB,createCommand:bB,createArgument:SB,createOption:EB,CommanderError:TB,InvalidArgumentError:xB,InvalidOptionArgumentError:AB,Command:Ge,Argument:CB,Option:IB,Help:OB}=W_.default;var fc=require("fs"),zl=require("path"),Ct=X(Ht());var qt=X(Ms()),Yt=X(require("path"));function px(n){return typeof n>"u"||n===null}o(px,"isNothing");function k7(n){return typeof n=="object"&&n!==null}o(k7,"isObject");function L7(n){return Array.isArray(n)?n:px(n)?[]:[n]}o(L7,"toArray");function M7(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(M7,"extend");function j7(n,e){var t="",r;for(r=0;r<e;r+=1)t+=n;return t}o(j7,"repeat");function $7(n){return n===0&&Number.NEGATIVE_INFINITY===1/n}o($7,"isNegativeZero");var V7=px,U7=k7,B7=L7,q7=j7,W7=$7,G7=M7,Bt={isNothing:V7,isObject:U7,toArray:B7,repeat:q7,isNegativeZero:W7,extend:G7};function mx(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+=`
|
|
386
386
|
|
|
387
387
|
`+n.mark.snippet),r+" "+t):r}o(mx,"formatError");function Rl(n,e){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=e,this.message=mx(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}o(Rl,"YAMLException$1");Rl.prototype=Object.create(Error.prototype);Rl.prototype.constructor=Rl;Rl.prototype.toString=o(function(e){return this.name+": "+mx(this,e)},"toString");var zr=Rl;function f2(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(f2,"getLine");function h2(n,e){return Bt.repeat(" ",e-n.length)+n}o(h2,"padStart");function H7(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,h=e.maxLength-(e.indent+f+3);for(l=1;l<=e.linesBefore&&!(a-l<0);l++)u=f2(n.buffer,r[a-l],i[a-l],n.position-(r[a]-r[a-l]),h),c=Bt.repeat(" ",e.indent)+h2((n.line-l+1).toString(),f)+" | "+u.str+`
|
|
388
388
|
`+c;for(u=f2(n.buffer,r[a],i[a],n.position,h),c+=Bt.repeat(" ",e.indent)+h2((n.line+1).toString(),f)+" | "+u.str+`
|
|
389
389
|
`,c+=Bt.repeat("-",e.indent+f+3+u.pos)+`^
|
|
390
390
|
`,l=1;l<=e.linesAfter&&!(a+l>=i.length);l++)u=f2(n.buffer,r[a+l],i[a+l],n.position-(r[a]-r[a+l]),h),c+=Bt.repeat(" ",e.indent)+h2((n.line+l+1).toString(),f)+" | "+u.str+`
|
|
391
391
|
`;return c.replace(/\n$/,"")}o(H7,"makeSnippet");var z7=H7,Q7=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Y7=["scalar","sequence","mapping"];function K7(n){var e={};return n!==null&&Object.keys(n).forEach(function(t){n[t].forEach(function(r){e[String(r)]=t})}),e}o(K7,"compileStyleAliases");function X7(n,e){if(e=e||{},Object.keys(e).forEach(function(t){if(Q7.indexOf(t)===-1)throw new zr('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=K7(e.styleAliases||null),Y7.indexOf(this.kind)===-1)throw new zr('Unknown kind "'+this.kind+'" is specified for "'+n+'" YAML type.')}o(X7,"Type$1");var fr=X7;function Z3(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(Z3,"compileList");function J7(){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(J7,"compileMap");function p2(n){return this.extend(n)}o(p2,"Schema$1");p2.prototype.extend=o(function(e){var t=[],r=[];if(e instanceof fr)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 zr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(s){if(!(s instanceof fr))throw new zr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new zr("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 zr("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 fr))throw new zr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(p2.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=Z3(i,"implicit"),i.compiledExplicit=Z3(i,"explicit"),i.compiledTypeMap=J7(i.compiledImplicit,i.compiledExplicit),i},"extend");var gx=p2,yx=new fr("tag:yaml.org,2002:str",{kind:"scalar",construct:o(function(n){return n!==null?n:""},"construct")}),vx=new fr("tag:yaml.org,2002:seq",{kind:"sequence",construct:o(function(n){return n!==null?n:[]},"construct")}),_x=new fr("tag:yaml.org,2002:map",{kind:"mapping",construct:o(function(n){return n!==null?n:{}},"construct")}),wx=new gx({explicit:[yx,vx,_x]});function Z7(n){if(n===null)return!0;var e=n.length;return e===1&&n==="~"||e===4&&(n==="null"||n==="Null"||n==="NULL")}o(Z7,"resolveYamlNull");function ej(){return null}o(ej,"constructYamlNull");function tj(n){return n===null}o(tj,"isNull");var bx=new fr("tag:yaml.org,2002:null",{kind:"scalar",resolve:Z7,construct:ej,predicate:tj,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 rj(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(rj,"resolveYamlBoolean");function nj(n){return n==="true"||n==="True"||n==="TRUE"}o(nj,"constructYamlBoolean");function ij(n){return Object.prototype.toString.call(n)==="[object Boolean]"}o(ij,"isBoolean");var Sx=new fr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:rj,construct:nj,predicate:ij,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 sj(n){return 48<=n&&n<=57||65<=n&&n<=70||97<=n&&n<=102}o(sj,"isHexCode");function aj(n){return 48<=n&&n<=55}o(aj,"isOctCode");function oj(n){return 48<=n&&n<=57}o(oj,"isDecCode");function cj(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(!sj(n.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(!aj(n.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;t<e;t++)if(i=n[t],i!=="_"){if(!oj(n.charCodeAt(t)))return!1;r=!0}return!(!r||i==="_")}o(cj,"resolveYamlInteger");function lj(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(lj,"constructYamlInteger");function uj(n){return Object.prototype.toString.call(n)==="[object Number]"&&n%1===0&&!Bt.isNegativeZero(n)}o(uj,"isInteger");var Ex=new fr("tag:yaml.org,2002:int",{kind:"scalar",resolve:cj,construct:lj,predicate:uj,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"]}}),fj=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function hj(n){return!(n===null||!fj.test(n)||n[n.length-1]==="_")}o(hj,"resolveYamlFloat");function dj(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(dj,"constructYamlFloat");var pj=/^[-+]?[0-9]+e/;function mj(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(Bt.isNegativeZero(n))return"-0.0";return t=n.toString(10),pj.test(t)?t.replace("e",".e"):t}o(mj,"representYamlFloat");function gj(n){return Object.prototype.toString.call(n)==="[object Number]"&&(n%1!==0||Bt.isNegativeZero(n))}o(gj,"isFloat");var Tx=new fr("tag:yaml.org,2002:float",{kind:"scalar",resolve:hj,construct:dj,predicate:gj,represent:mj,defaultStyle:"lowercase"}),xx=wx.extend({implicit:[bx,Sx,Ex,Tx]}),Ax=xx,Cx=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Ix=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 yj(n){return n===null?!1:Cx.exec(n)!==null||Ix.exec(n)!==null}o(yj,"resolveYamlTimestamp");function vj(n){var e,t,r,i,s,a,c,l=0,u=null,f,h,d;if(e=Cx.exec(n),e===null&&(e=Ix.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],h=+(e[11]||0),u=(f*60+h)*6e4,e[9]==="-"&&(u=-u)),d=new Date(Date.UTC(t,r,i,s,a,c,l)),u&&d.setTime(d.getTime()-u),d}o(vj,"constructYamlTimestamp");function _j(n){return n.toISOString()}o(_j,"representYamlTimestamp");var Ox=new fr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:yj,construct:vj,instanceOf:Date,represent:_j});function wj(n){return n==="<<"||n===null}o(wj,"resolveYamlMerge");var Rx=new fr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:wj}),_2=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
392
|
-
\r`;function bj(n){if(n===null)return!1;var e,t,r=0,i=n.length,s=_2;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(bj,"resolveYamlBinary");function Sj(n){var e,t,r=n.replace(/[\r\n=]/g,""),i=r.length,s=_2,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(Sj,"constructYamlBinary");function Ej(n){var e="",t=0,r,i,s=n.length,a=_2;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(Ej,"representYamlBinary");function Tj(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}o(Tj,"isBinary");var Px=new fr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:bj,construct:Sj,predicate:Tj,represent:Ej}),xj=Object.prototype.hasOwnProperty,Aj=Object.prototype.toString;function Cj(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,Aj.call(i)!=="[object Object]")return!1;for(s in i)if(xj.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(Cj,"resolveYamlOmap");function Ij(n){return n!==null?n:[]}o(Ij,"constructYamlOmap");var Fx=new fr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Cj,construct:Ij}),Oj=Object.prototype.toString;function Rj(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],Oj.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[e]=[i[0],r[i[0]]]}return!0}o(Rj,"resolveYamlPairs");function Pj(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(Pj,"constructYamlPairs");var Dx=new fr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Rj,construct:Pj}),Fj=Object.prototype.hasOwnProperty;function Dj(n){if(n===null)return!0;var e,t=n;for(e in t)if(Fj.call(t,e)&&t[e]!==null)return!1;return!0}o(Dj,"resolveYamlSet");function Nj(n){return n!==null?n:{}}o(Nj,"constructYamlSet");var Nx=new fr("tag:yaml.org,2002:set",{kind:"mapping",resolve:Dj,construct:Nj}),w2=Ax.extend({implicit:[Ox,Rx],explicit:[Px,Fx,Dx,Nx]})
|
|
393
|
-
`: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(rx,"simpleEscapeSequence");function Bj(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}o(Bj,"charFromCodepoint");function $x(n,e,t){e==="__proto__"?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[e]=t}o($x,"setProperty");var Vx=new Array(256),Ux=new Array(256);for(Pa=0;Pa<256;Pa++)Vx[Pa]=rx(Pa)?1:0,Ux[Pa]=rx(Pa);var Pa;function qj(n,e){this.input=n,this.filename=e.filename||null,this.schema=e.schema||w2,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(qj,"State$1");function Bx(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=z7(t),new zr(e,t)}o(Bx,"generateError");function ne(n,e){throw Bx(n,e)}o(ne,"throwError");function Od(n,e){n.onWarning&&n.onWarning.call(null,Bx(n,e))}o(Od,"throwWarning");var nx={YAML:o(function(e,t,r){var i,s,a;e.version!==null&&ne(e,"duplication of %YAML directive"),r.length!==1&&ne(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&ne(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),a=parseInt(i[2],10),s!==1&&ne(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&Od(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:o(function(e,t,r){var i,s;r.length!==2&&ne(e,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],Mx.test(i)||ne(e,"ill-formed tag handle (first argument) of the TAG directive")
|
|
394
|
-
`,e-1))}o(S2,"writeFoldedLines");function Wj(n,e,t){var r,i,s,a,c,l,u,f,h=n.kind,d=n.result,p;if(p=n.input.charCodeAt(n.position),rn(p)||ec(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),rn(i)||t&&ec(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),rn(i)||t&&ec(i))break}else if(p===35){if(r=n.input.charCodeAt(n.position-1),rn(r))break}else{if(n.position===n.lineStart&&Fd(n)||t&&ec(p))break;if(Ni(p))if(l=n.line,u=n.lineStart,f=n.lineIndent,jt(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&&(
|
|
392
|
+
\r`;function bj(n){if(n===null)return!1;var e,t,r=0,i=n.length,s=_2;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(bj,"resolveYamlBinary");function Sj(n){var e,t,r=n.replace(/[\r\n=]/g,""),i=r.length,s=_2,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(Sj,"constructYamlBinary");function Ej(n){var e="",t=0,r,i,s=n.length,a=_2;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(Ej,"representYamlBinary");function Tj(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}o(Tj,"isBinary");var Px=new fr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:bj,construct:Sj,predicate:Tj,represent:Ej}),xj=Object.prototype.hasOwnProperty,Aj=Object.prototype.toString;function Cj(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,Aj.call(i)!=="[object Object]")return!1;for(s in i)if(xj.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(Cj,"resolveYamlOmap");function Ij(n){return n!==null?n:[]}o(Ij,"constructYamlOmap");var Fx=new fr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Cj,construct:Ij}),Oj=Object.prototype.toString;function Rj(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],Oj.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[e]=[i[0],r[i[0]]]}return!0}o(Rj,"resolveYamlPairs");function Pj(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(Pj,"constructYamlPairs");var Dx=new fr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Rj,construct:Pj}),Fj=Object.prototype.hasOwnProperty;function Dj(n){if(n===null)return!0;var e,t=n;for(e in t)if(Fj.call(t,e)&&t[e]!==null)return!1;return!0}o(Dj,"resolveYamlSet");function Nj(n){return n!==null?n:{}}o(Nj,"constructYamlSet");var Nx=new fr("tag:yaml.org,2002:set",{kind:"mapping",resolve:Dj,construct:Nj}),w2=Ax.extend({implicit:[Ox,Rx],explicit:[Px,Fx,Dx,Nx]}),$s=Object.prototype.hasOwnProperty,Cd=1,kx=2,Lx=3,Id=4,d2=1,kj=2,ex=3,Lj=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Mj=/[\x85\u2028\u2029]/,jj=/[,\[\]\{\}]/,Mx=/^(?:!|!!|![a-z\-]+!)$/i,jx=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function tx(n){return Object.prototype.toString.call(n)}o(tx,"_class");function Ni(n){return n===10||n===13}o(Ni,"is_EOL");function Fa(n){return n===9||n===32}o(Fa,"is_WHITE_SPACE");function rn(n){return n===9||n===32||n===10||n===13}o(rn,"is_WS_OR_EOL");function ec(n){return n===44||n===91||n===93||n===123||n===125}o(ec,"is_FLOW_INDICATOR");function $j(n){var e;return 48<=n&&n<=57?n-48:(e=n|32,97<=e&&e<=102?e-97+10:-1)}o($j,"fromHexCode");function Vj(n){return n===120?2:n===117?4:n===85?8:0}o(Vj,"escapedHexLen");function Uj(n){return 48<=n&&n<=57?n-48:-1}o(Uj,"fromDecimalCode");function rx(n){return n===48?"\0":n===97?"\x07":n===98?"\b":n===116||n===9?" ":n===110?`
|
|
393
|
+
`: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(rx,"simpleEscapeSequence");function Bj(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}o(Bj,"charFromCodepoint");function $x(n,e,t){e==="__proto__"?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[e]=t}o($x,"setProperty");var Vx=new Array(256),Ux=new Array(256);for(Pa=0;Pa<256;Pa++)Vx[Pa]=rx(Pa)?1:0,Ux[Pa]=rx(Pa);var Pa;function qj(n,e){this.input=n,this.filename=e.filename||null,this.schema=e.schema||w2,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(qj,"State$1");function Bx(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=z7(t),new zr(e,t)}o(Bx,"generateError");function ne(n,e){throw Bx(n,e)}o(ne,"throwError");function Od(n,e){n.onWarning&&n.onWarning.call(null,Bx(n,e))}o(Od,"throwWarning");var nx={YAML:o(function(e,t,r){var i,s,a;e.version!==null&&ne(e,"duplication of %YAML directive"),r.length!==1&&ne(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&ne(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),a=parseInt(i[2],10),s!==1&&ne(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&Od(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:o(function(e,t,r){var i,s;r.length!==2&&ne(e,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],Mx.test(i)||ne(e,"ill-formed tag handle (first argument) of the TAG directive"),$s.call(e.tagMap,i)&&ne(e,'there is a previously declared suffix for "'+i+'" tag handle'),jx.test(s)||ne(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{ne(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function js(n,e,t,r){var i,s,a,c;if(e<t){if(c=n.input.slice(e,t),r)for(i=0,s=c.length;i<s;i+=1)a=c.charCodeAt(i),a===9||32<=a&&a<=1114111||ne(n,"expected valid JSON character");else Lj.test(c)&&ne(n,"the stream contains non-printable characters");n.result+=c}}o(js,"captureSegment");function ix(n,e,t,r){var i,s,a,c;for(Bt.isObject(t)||ne(n,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),a=0,c=i.length;a<c;a+=1)s=i[a],$s.call(e,s)||($x(e,s,t[s]),r[s]=!0)}o(ix,"mergeMappings");function tc(n,e,t,r,i,s,a,c,l){var u,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),u=0,f=i.length;u<f;u+=1)Array.isArray(i[u])&&ne(n,"nested arrays are not supported inside keys"),typeof i=="object"&&tx(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&tx(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)ix(n,e,s[u],t);else ix(n,e,s,t);else!n.json&&!$s.call(t,i)&&$s.call(e,i)&&(n.line=a||n.line,n.lineStart=c||n.lineStart,n.position=l||n.position,ne(n,"duplicated mapping key")),$x(e,i,s),delete t[i];return e}o(tc,"storeMappingPair");function b2(n){var e;e=n.input.charCodeAt(n.position),e===10?n.position++:e===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):ne(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}o(b2,"readLineBreak");function jt(n,e,t){for(var r=0,i=n.input.charCodeAt(n.position);i!==0;){for(;Fa(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(Ni(i))for(b2(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&&Od(n,"deficient indentation"),r}o(jt,"skipSeparationSpace");function Fd(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||rn(t)))}o(Fd,"testDocumentSeparator");function S2(n,e){e===1?n.result+=" ":e>1&&(n.result+=Bt.repeat(`
|
|
394
|
+
`,e-1))}o(S2,"writeFoldedLines");function Wj(n,e,t){var r,i,s,a,c,l,u,f,h=n.kind,d=n.result,p;if(p=n.input.charCodeAt(n.position),rn(p)||ec(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),rn(i)||t&&ec(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),rn(i)||t&&ec(i))break}else if(p===35){if(r=n.input.charCodeAt(n.position-1),rn(r))break}else{if(n.position===n.lineStart&&Fd(n)||t&&ec(p))break;if(Ni(p))if(l=n.line,u=n.lineStart,f=n.lineIndent,jt(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&&(js(n,s,a,!1),S2(n,n.line-l),s=a=n.position,c=!1),Fa(p)||(a=n.position+1),p=n.input.charCodeAt(++n.position)}return js(n,s,a,!1),n.result?!0:(n.kind=h,n.result=d,!1)}o(Wj,"readPlainScalar");function Gj(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(js(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 Ni(t)?(js(n,r,i,!0),S2(n,jt(n,!1,e)),r=i=n.position):n.position===n.lineStart&&Fd(n)?ne(n,"unexpected end of the document within a single quoted scalar"):(n.position++,i=n.position);ne(n,"unexpected end of the stream within a single quoted scalar")}o(Gj,"readSingleQuotedScalar");function Hj(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 js(n,t,n.position,!0),n.position++,!0;if(c===92){if(js(n,t,n.position,!0),c=n.input.charCodeAt(++n.position),Ni(c))jt(n,!1,e);else if(c<256&&Vx[c])n.result+=Ux[c],n.position++;else if((a=Vj(c))>0){for(i=a,s=0;i>0;i--)c=n.input.charCodeAt(++n.position),(a=$j(c))>=0?s=(s<<4)+a:ne(n,"expected hexadecimal character");n.result+=Bj(s),n.position++}else ne(n,"unknown escape sequence");t=r=n.position}else Ni(c)?(js(n,t,r,!0),S2(n,jt(n,!1,e)),t=r=n.position):n.position===n.lineStart&&Fd(n)?ne(n,"unexpected end of the document within a double quoted scalar"):(n.position++,r=n.position)}ne(n,"unexpected end of the stream within a double quoted scalar")}o(Hj,"readDoubleQuotedScalar");function zj(n,e){var t=!0,r,i,s,a=n.tag,c,l=n.anchor,u,f,h,d,p,y=Object.create(null),w,T,S,x;if(x=n.input.charCodeAt(n.position),x===91)f=93,p=!1,c=[];else if(x===123)f=125,p=!0,c={};else return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=c),x=n.input.charCodeAt(++n.position);x!==0;){if(jt(n,!0,e),x=n.input.charCodeAt(n.position),x===f)return n.position++,n.tag=a,n.anchor=l,n.kind=p?"mapping":"sequence",n.result=c,!0;t?x===44&&ne(n,"expected the node content, but found ','"):ne(n,"missed comma between flow collection entries"),T=w=S=null,h=d=!1,x===63&&(u=n.input.charCodeAt(n.position+1),rn(u)&&(h=d=!0,n.position++,jt(n,!0,e))),r=n.line,i=n.lineStart,s=n.position,rc(n,e,Cd,!1,!0),T=n.tag,w=n.result,jt(n,!0,e),x=n.input.charCodeAt(n.position),(d||n.line===r)&&x===58&&(h=!0,x=n.input.charCodeAt(++n.position),jt(n,!0,e),rc(n,e,Cd,!1,!0),S=n.result),p?tc(n,c,y,T,w,S,r,i,s):h?c.push(tc(n,null,y,T,w,S,r,i,s)):c.push(w),jt(n,!0,e),x=n.input.charCodeAt(n.position),x===44?(t=!0,x=n.input.charCodeAt(++n.position)):t=!1}ne(n,"unexpected end of the stream within a flow collection")}o(zj,"readFlowCollection");function Qj(n,e){var t,r,i=d2,s=!1,a=!1,c=e,l=0,u=!1,f,h;if(h=n.input.charCodeAt(n.position),h===124)r=!1;else if(h===62)r=!0;else return!1;for(n.kind="scalar",n.result="";h!==0;)if(h=n.input.charCodeAt(++n.position),h===43||h===45)d2===i?i=h===43?ex:kj:ne(n,"repeat of a chomping mode identifier");else if((f=Uj(h))>=0)f===0?ne(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?ne(n,"repeat of an indentation width identifier"):(c=e+f-1,a=!0);else break;if(Fa(h)){do h=n.input.charCodeAt(++n.position);while(Fa(h));if(h===35)do h=n.input.charCodeAt(++n.position);while(!Ni(h)&&h!==0)}for(;h!==0;){for(b2(n),n.lineIndent=0,h=n.input.charCodeAt(n.position);(!a||n.lineIndent<c)&&h===32;)n.lineIndent++,h=n.input.charCodeAt(++n.position);if(!a&&n.lineIndent>c&&(c=n.lineIndent),Ni(h)){l++;continue}if(n.lineIndent<c){i===ex?n.result+=Bt.repeat(`
|
|
395
395
|
`,s?1+l:l):i===d2&&s&&(n.result+=`
|
|
396
396
|
`);break}for(r?Fa(h)?(u=!0,n.result+=Bt.repeat(`
|
|
397
397
|
`,s?1+l:l)):u?(u=!1,n.result+=Bt.repeat(`
|
|
398
398
|
`,l+1)):l===0?s&&(n.result+=" "):n.result+=Bt.repeat(`
|
|
399
399
|
`,l):n.result+=Bt.repeat(`
|
|
400
|
-
`,s?1+l:l),s=!0,a=!0,l=0,t=n.position;!Ni(h)&&h!==0;)h=n.input.charCodeAt(++n.position);
|
|
400
|
+
`,s?1+l:l),s=!0,a=!0,l=0,t=n.position;!Ni(h)&&h!==0;)h=n.input.charCodeAt(++n.position);js(n,t,n.position,!1)}return!0}o(Qj,"readBlockScalar");function sx(n,e){var t,r=n.tag,i=n.anchor,s=[],a,c=!1,l;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=s),l=n.input.charCodeAt(n.position);l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,ne(n,"tab characters must not be used in indentation")),!(l!==45||(a=n.input.charCodeAt(n.position+1),!rn(a))));){if(c=!0,n.position++,jt(n,!0,-1)&&n.lineIndent<=e){s.push(null),l=n.input.charCodeAt(n.position);continue}if(t=n.line,rc(n,e,Lx,!1,!0),s.push(n.result),jt(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===t||n.lineIndent>e)&&l!==0)ne(n,"bad indentation of a sequence entry");else if(n.lineIndent<e)break}return c?(n.tag=r,n.anchor=i,n.kind="sequence",n.result=s,!0):!1}o(sx,"readBlockSequence");function Yj(n,e,t){var r,i,s,a,c,l,u=n.tag,f=n.anchor,h={},d=Object.create(null),p=null,y=null,w=null,T=!1,S=!1,x;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=h),x=n.input.charCodeAt(n.position);x!==0;){if(!T&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,ne(n,"tab characters must not be used in indentation")),r=n.input.charCodeAt(n.position+1),s=n.line,(x===63||x===58)&&rn(r))x===63?(T&&(tc(n,h,d,p,y,null,a,c,l),p=y=w=null),S=!0,T=!0,i=!0):T?(T=!1,i=!0):ne(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,x=r;else{if(a=n.line,c=n.lineStart,l=n.position,!rc(n,t,kx,!1,!0))break;if(n.line===s){for(x=n.input.charCodeAt(n.position);Fa(x);)x=n.input.charCodeAt(++n.position);if(x===58)x=n.input.charCodeAt(++n.position),rn(x)||ne(n,"a whitespace character is expected after the key-value separator within a block mapping"),T&&(tc(n,h,d,p,y,null,a,c,l),p=y=w=null),S=!0,T=!1,i=!1,p=n.tag,y=n.result;else if(S)ne(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=u,n.anchor=f,!0}else if(S)ne(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=u,n.anchor=f,!0}if((n.line===s||n.lineIndent>e)&&(T&&(a=n.line,c=n.lineStart,l=n.position),rc(n,e,Id,!0,i)&&(T?y=n.result:w=n.result),T||(tc(n,h,d,p,y,w,a,c,l),p=y=w=null),jt(n,!0,-1),x=n.input.charCodeAt(n.position)),(n.line===s||n.lineIndent>e)&&x!==0)ne(n,"bad indentation of a mapping entry");else if(n.lineIndent<e)break}return T&&tc(n,h,d,p,y,null,a,c,l),S&&(n.tag=u,n.anchor=f,n.kind="mapping",n.result=h),S}o(Yj,"readBlockMapping");function Kj(n){var e,t=!1,r=!1,i,s,a;if(a=n.input.charCodeAt(n.position),a!==33)return!1;if(n.tag!==null&&ne(n,"duplication of a tag property"),a=n.input.charCodeAt(++n.position),a===60?(t=!0,a=n.input.charCodeAt(++n.position)):a===33?(r=!0,i="!!",a=n.input.charCodeAt(++n.position)):i="!",e=n.position,t){do a=n.input.charCodeAt(++n.position);while(a!==0&&a!==62);n.position<n.length?(s=n.input.slice(e,n.position),a=n.input.charCodeAt(++n.position)):ne(n,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!rn(a);)a===33&&(r?ne(n,"tag suffix cannot contain exclamation marks"):(i=n.input.slice(e-1,n.position+1),Mx.test(i)||ne(n,"named tag handle cannot contain such characters"),r=!0,e=n.position+1)),a=n.input.charCodeAt(++n.position);s=n.input.slice(e,n.position),jj.test(s)&&ne(n,"tag suffix cannot contain flow indicator characters")}s&&!jx.test(s)&&ne(n,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ne(n,"tag name is malformed: "+s)}return t?n.tag=s:$s.call(n.tagMap,i)?n.tag=n.tagMap[i]+s:i==="!"?n.tag="!"+s:i==="!!"?n.tag="tag:yaml.org,2002:"+s:ne(n,'undeclared tag handle "'+i+'"'),!0}o(Kj,"readTagProperty");function Xj(n){var e,t;if(t=n.input.charCodeAt(n.position),t!==38)return!1;for(n.anchor!==null&&ne(n,"duplication of an anchor property"),t=n.input.charCodeAt(++n.position),e=n.position;t!==0&&!rn(t)&&!ec(t);)t=n.input.charCodeAt(++n.position);return n.position===e&&ne(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(e,n.position),!0}o(Xj,"readAnchorProperty");function Jj(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&&!rn(r)&&!ec(r);)r=n.input.charCodeAt(++n.position);return n.position===e&&ne(n,"name of an alias node must contain at least one character"),t=n.input.slice(e,n.position),$s.call(n.anchorMap,t)||ne(n,'unidentified alias "'+t+'"'),n.result=n.anchorMap[t],jt(n,!0,-1),!0}o(Jj,"readAlias");function rc(n,e,t,r,i){var s,a,c,l=1,u=!1,f=!1,h,d,p,y,w,T;if(n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null,s=a=c=Id===t||Lx===t,r&&jt(n,!0,-1)&&(u=!0,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)),l===1)for(;Kj(n)||Xj(n);)jt(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||Id===t)&&(Cd===t||kx===t?w=e:w=e+1,T=n.position-n.lineStart,l===1?c&&(sx(n,T)||Yj(n,T,w))||zj(n,w)?f=!0:(a&&Qj(n,w)||Gj(n,w)||Hj(n,w)?f=!0:Jj(n)?(f=!0,(n.tag!==null||n.anchor!==null)&&ne(n,"alias node should not have any properties")):Wj(n,w,Cd===t)&&(f=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):l===0&&(f=c&&sx(n,T))),n.tag===null)n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);else if(n.tag==="?"){for(n.result!==null&&n.kind!=="scalar"&&ne(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"'),h=0,d=n.implicitTypes.length;h<d;h+=1)if(y=n.implicitTypes[h],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($s.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"],h=0,d=p.length;h<d;h+=1)if(n.tag.slice(0,p[h].tag.length)===p[h].tag){y=p[h];break}y||ne(n,"unknown tag !<"+n.tag+">"),n.result!==null&&y.kind!==n.kind&&ne(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+y.kind+'", not "'+n.kind+'"'),y.resolve(n.result,n.tag)?(n.result=y.construct(n.result,n.tag),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):ne(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.tag!==null||n.anchor!==null||f}o(rc,"composeNode");function Zj(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&&(jt(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&&!rn(a);)a=n.input.charCodeAt(++n.position);for(r=n.input.slice(t,n.position),i=[],r.length<1&&ne(n,"directive name must not be less than one character in length");a!==0;){for(;Fa(a);)a=n.input.charCodeAt(++n.position);if(a===35){do a=n.input.charCodeAt(++n.position);while(a!==0&&!Ni(a));break}if(Ni(a))break;for(t=n.position;a!==0&&!rn(a);)a=n.input.charCodeAt(++n.position);i.push(n.input.slice(t,n.position))}a!==0&&b2(n),$s.call(nx,r)?nx[r](n,r,i):Od(n,'unknown document directive "'+r+'"')}if(jt(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,jt(n,!0,-1)):s&&ne(n,"directives end mark is expected"),rc(n,n.lineIndent-1,Id,!1,!0),jt(n,!0,-1),n.checkLineBreaks&&Mj.test(n.input.slice(e,n.position))&&Od(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&Fd(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,jt(n,!0,-1));return}if(n.position<n.length-1)ne(n,"end of the stream or a document separator is expected");else return}o(Zj,"readDocument");function qx(n,e){n=String(n),e=e||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
|
|
401
401
|
`),n.charCodeAt(0)===65279&&(n=n.slice(1)));var t=new qj(n,e),r=n.indexOf("\0");for(r!==-1&&(t.position=r,ne(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)Zj(t);return t.documents}o(qx,"loadDocuments");function e8(n,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var r=qx(n,t);if(typeof e!="function")return r;for(var i=0,s=r.length;i<s;i+=1)e(r[i])}o(e8,"loadAll$1");function t8(n,e){var t=qx(n,e);if(t.length!==0){if(t.length===1)return t[0];throw new zr("expected a single document in the stream, but found more")}}o(t8,"load$1");var r8=e8,n8=t8,Wx={loadAll:r8,load:n8},Gx=Object.prototype.toString,Hx=Object.prototype.hasOwnProperty,E2=65279,i8=9,Pl=10,s8=13,a8=32,o8=33,c8=34,m2=35,l8=37,u8=38,f8=39,h8=42,zx=44,d8=45,Rd=58,p8=61,m8=62,g8=63,y8=64,Qx=91,Yx=93,v8=96,Kx=123,_8=124,Xx=125,Ar={};Ar[0]="\\0";Ar[7]="\\a";Ar[8]="\\b";Ar[9]="\\t";Ar[10]="\\n";Ar[11]="\\v";Ar[12]="\\f";Ar[13]="\\r";Ar[27]="\\e";Ar[34]='\\"';Ar[92]="\\\\";Ar[133]="\\N";Ar[160]="\\_";Ar[8232]="\\L";Ar[8233]="\\P";var w8=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],b8=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function S8(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&&Hx.call(l.styleAliases,c)&&(c=l.styleAliases[c]),t[a]=c;return t}o(S8,"compileStyleMap");function E8(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 zr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+Bt.repeat("0",r-e.length)+e}o(E8,"encodeHex");var T8=1,Fl=2;function x8(n){this.schema=n.schema||w2,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=Bt.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=S8(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==='"'?Fl:T8,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(x8,"State");function ax(n,e){for(var t=Bt.repeat(" ",e),r=0,i=-1,s="",a,c=n.length;r<c;)i=n.indexOf(`
|
|
402
402
|
`,r),i===-1?(a=n.slice(r),r=c):(a=n.slice(r,i+1),r=i+1),a.length&&a!==`
|
|
403
403
|
`&&(s+=t),s+=a;return s}o(ax,"indentString");function g2(n,e){return`
|
|
@@ -446,12 +446,12 @@ To fix this:
|
|
|
446
446
|
3. Simplify query: reduce WHERE clauses or add LIMIT
|
|
447
447
|
4. Use cache: --use-cache for faster vault loading${i!==void 0?`
|
|
448
448
|
|
|
449
|
-
Partial results: ${i} result(s) were collected before timeout.`:""}`}static{o(this,"QueryTimeoutError")}};var Ll=X(require("path")),Cr=X(Ls()),Xt=X(Ht());var ki=class{constructor(e){this.cliVersion="1.0.0";this.vaultPath=Ll.default.resolve(e),this.cachePath=Ll.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{o(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){try{if(!await Cr.default.pathExists(this.cachePath))return!1;let e=await Cr.default.readJson(this.cachePath);return!(!e.metadata||typeof e.metadata.vaultMtime!="number"||typeof e.metadata.tripleCount!="number"||(await Cr.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 Cr.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 nn(this.vaultPath),s=await new Xt.NoteToRDFConverter(r).convertVaultWithValidation({strict:e.strict??!1}),a=await Cr.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 Cr.default.ensureDir(Ll.default.dirname(this.cachePath)),await Cr.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 nn(this.vaultPath);return new Xt.NoteToRDFConverter(e).validateVault()}async invalidate(){await Cr.default.pathExists(this.cachePath)&&await Cr.default.remove(this.cachePath)}async getCacheStats(){try{if(!await Cr.default.pathExists(this.cachePath))return null;let e=await Cr.default.readJson(this.cachePath),t=await Cr.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 Cr.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 Cr.default.ensureDir(Ll.default.dirname(this.cachePath)),await Cr.default.writeJson(this.cachePath,i,{spaces:0})}serializeTriple(e){return{subject:x2(e.subject),predicate:x2(e.predicate),object:x2(e.object)}}deserializeTriple(e){return new Xt.Triple(A2(e.subject),A2(e.predicate),A2(e.object))}};function x2(n){if(n instanceof Xt.IRI)return{type:"IRI",value:n.value};if(n instanceof Xt.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 Xt.BlankNode?{type:"BlankNode",value:n.value}:{type:"IRI",value:String(n)}}o(x2,"serializeNode");function A2(n){switch(n.type){case"IRI":return new Xt.IRI(n.value);case"Literal":return n.datatype?new Xt.Literal(n.value,new Xt.IRI(n.datatype)):n.language?new Xt.Literal(n.value,void 0,n.language):new Xt.Literal(n.value);case"BlankNode":return new Xt.BlankNode(n.value);default:return new Xt.IRI(n.value)}}o(A2,"deserializeNode");var nA=X(require("crypto")),Ml=X(require("path")),iA=X(require("os")),dn=X(Ls());var ac=class{static{o(this,"QueryResultCache")}constructor(e={}){this.cacheDir=e.cacheDir??Ml.default.join(iA.default.homedir(),".exocortex","cache","query-results")}getCacheDir(){return this.cacheDir}getCacheKey(e){let t=e.trim().replace(/\s+/g," ");return nA.default.createHash("sha256").update(t).digest("hex")}async get(e,t){let r=this.getCacheKey(e),i=this.getCachePath(r);try{if(!await dn.default.pathExists(i))return null;let s=await dn.default.readJson(i),a=Date.now()-s.timestamp,c=t*1e3;return a>c?(await dn.default.remove(i),null):s.result}catch{return null}}async set(e,t,r){let i=this.getCacheKey(e),s=this.getCachePath(i);await dn.default.ensureDir(this.cacheDir);let a={timestamp:Date.now(),result:t};await dn.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 dn.default.remove(r)}catch{}}async clear(){try{if(await dn.default.pathExists(this.cacheDir)){let e=await dn.default.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>dn.default.remove(Ml.default.join(this.cacheDir,t))))}}catch{}}async getCacheStats(){try{if(!await dn.default.pathExists(this.cacheDir))return{entryCount:0,totalSizeBytes:0};let t=(await dn.default.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),r=0;for(let i of t){let s=await dn.default.stat(Ml.default.join(this.cacheDir,i));r+=s.size}return{entryCount:t.length,totalSizeBytes:r}}catch{return{entryCount:0,totalSizeBytes:0}}}getCachePath(e){return Ml.default.join(this.cacheDir,`${e}.json`)}};var Wl=X(require("node:process"),1);var sA=o((n=0)=>e=>`\x1B[${e+n}m`,"wrapAnsi16"),aA=o((n=0)=>e=>`\x1B[${38+n};5;${e}m`,"wrapAnsi256"),oA=o((n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,"wrapAnsi16m"),bt={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]}},NZ=Object.keys(bt.modifier),t$=Object.keys(bt.color),r$=Object.keys(bt.bgColor),kZ=[...t$,...r$];function n$(){let n=new Map;for(let[e,t]of Object.entries(bt)){for(let[r,i]of Object.entries(t))bt[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=bt[r],n.set(i[0],i[1]);Object.defineProperty(bt,e,{value:t,enumerable:!1})}return Object.defineProperty(bt,"codes",{value:n,enumerable:!1}),bt.color.close="\x1B[39m",bt.bgColor.close="\x1B[49m",bt.color.ansi=sA(),bt.color.ansi256=aA(),bt.color.ansi16m=oA(),bt.bgColor.ansi=sA(10),bt.bgColor.ansi256=aA(10),bt.bgColor.ansi16m=oA(10),Object.defineProperties(bt,{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=>bt.rgbToAnsi256(...bt.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)=>bt.ansi256ToAnsi(bt.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:o(e=>bt.ansi256ToAnsi(bt.hexToAnsi256(e)),"value"),enumerable:!1}}),bt}o(n$,"assembleStyles");var i$=n$(),ai=i$;var kd=X(require("node:process"),1),lA=X(require("node:os"),1),C2=X(require("node:tty"),1);function On(n,e=globalThis.Deno?globalThis.Deno.args:kd.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(On,"hasFlag");var{env:St}=kd.default,Nd;On("no-color")||On("no-colors")||On("color=false")||On("color=never")?Nd=0:(On("color")||On("colors")||On("color=true")||On("color=always"))&&(Nd=1);function s$(){if("FORCE_COLOR"in St)return St.FORCE_COLOR==="true"?1:St.FORCE_COLOR==="false"?0:St.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(St.FORCE_COLOR,10),3)}o(s$,"envForceColor");function a$(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}o(a$,"translateLevel");function o$(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=s$();r!==void 0&&(Nd=r);let i=t?Nd:r;if(i===0)return 0;if(t){if(On("color=16m")||On("color=full")||On("color=truecolor"))return 3;if(On("color=256"))return 2}if("TF_BUILD"in St&&"AGENT_NAME"in St)return 1;if(n&&!e&&i===void 0)return 0;let s=i||0;if(St.TERM==="dumb")return s;if(kd.default.platform==="win32"){let a=lA.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in St)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in St)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in St)||St.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in St)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(St.TEAMCITY_VERSION)?1:0;if(St.COLORTERM==="truecolor"||St.TERM==="xterm-kitty"||St.TERM==="xterm-ghostty"||St.TERM==="wezterm")return 3;if("TERM_PROGRAM"in St){let a=Number.parseInt((St.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(St.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(St.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(St.TERM)||"COLORTERM"in St?1:s}o(o$,"_supportsColor");function cA(n,e={}){let t=o$(n,{streamIsTTY:n&&n.isTTY,...e});return a$(t)}o(cA,"createSupportsColor");var c$={stdout:cA({isTTY:C2.default.isatty(1)}),stderr:cA({isTTY:C2.default.isatty(2)})},uA=c$;function fA(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(fA,"stringReplaceAll");function hA(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
|
|
449
|
+
Partial results: ${i} result(s) were collected before timeout.`:""}`}static{o(this,"QueryTimeoutError")}};var Ll=X(require("path")),Cr=X(Ms()),Xt=X(Ht());var ki=class{constructor(e){this.cliVersion="1.0.0";this.vaultPath=Ll.default.resolve(e),this.cachePath=Ll.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{o(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){try{if(!await Cr.default.pathExists(this.cachePath))return!1;let e=await Cr.default.readJson(this.cachePath);return!(!e.metadata||typeof e.metadata.vaultMtime!="number"||typeof e.metadata.tripleCount!="number"||(await Cr.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 Cr.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 nn(this.vaultPath),s=await new Xt.NoteToRDFConverter(r).convertVaultWithValidation({strict:e.strict??!1}),a=await Cr.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 Cr.default.ensureDir(Ll.default.dirname(this.cachePath)),await Cr.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 nn(this.vaultPath);return new Xt.NoteToRDFConverter(e).validateVault()}async invalidate(){await Cr.default.pathExists(this.cachePath)&&await Cr.default.remove(this.cachePath)}async getCacheStats(){try{if(!await Cr.default.pathExists(this.cachePath))return null;let e=await Cr.default.readJson(this.cachePath),t=await Cr.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 Cr.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 Cr.default.ensureDir(Ll.default.dirname(this.cachePath)),await Cr.default.writeJson(this.cachePath,i,{spaces:0})}serializeTriple(e){return{subject:x2(e.subject),predicate:x2(e.predicate),object:x2(e.object)}}deserializeTriple(e){return new Xt.Triple(A2(e.subject),A2(e.predicate),A2(e.object))}};function x2(n){if(n instanceof Xt.IRI)return{type:"IRI",value:n.value};if(n instanceof Xt.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 Xt.BlankNode?{type:"BlankNode",value:n.value}:{type:"IRI",value:String(n)}}o(x2,"serializeNode");function A2(n){switch(n.type){case"IRI":return new Xt.IRI(n.value);case"Literal":return n.datatype?new Xt.Literal(n.value,new Xt.IRI(n.datatype)):n.language?new Xt.Literal(n.value,void 0,n.language):new Xt.Literal(n.value);case"BlankNode":return new Xt.BlankNode(n.value);default:return new Xt.IRI(n.value)}}o(A2,"deserializeNode");var nA=X(require("crypto")),Ml=X(require("path")),iA=X(require("os")),dn=X(Ms());var ac=class{static{o(this,"QueryResultCache")}constructor(e={}){this.cacheDir=e.cacheDir??Ml.default.join(iA.default.homedir(),".exocortex","cache","query-results")}getCacheDir(){return this.cacheDir}getCacheKey(e){let t=e.trim().replace(/\s+/g," ");return nA.default.createHash("sha256").update(t).digest("hex")}async get(e,t){let r=this.getCacheKey(e),i=this.getCachePath(r);try{if(!await dn.default.pathExists(i))return null;let s=await dn.default.readJson(i),a=Date.now()-s.timestamp,c=t*1e3;return a>c?(await dn.default.remove(i),null):s.result}catch{return null}}async set(e,t,r){let i=this.getCacheKey(e),s=this.getCachePath(i);await dn.default.ensureDir(this.cacheDir);let a={timestamp:Date.now(),result:t};await dn.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 dn.default.remove(r)}catch{}}async clear(){try{if(await dn.default.pathExists(this.cacheDir)){let e=await dn.default.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>dn.default.remove(Ml.default.join(this.cacheDir,t))))}}catch{}}async getCacheStats(){try{if(!await dn.default.pathExists(this.cacheDir))return{entryCount:0,totalSizeBytes:0};let t=(await dn.default.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),r=0;for(let i of t){let s=await dn.default.stat(Ml.default.join(this.cacheDir,i));r+=s.size}return{entryCount:t.length,totalSizeBytes:r}}catch{return{entryCount:0,totalSizeBytes:0}}}getCachePath(e){return Ml.default.join(this.cacheDir,`${e}.json`)}};var Wl=X(require("node:process"),1);var sA=o((n=0)=>e=>`\x1B[${e+n}m`,"wrapAnsi16"),aA=o((n=0)=>e=>`\x1B[${38+n};5;${e}m`,"wrapAnsi256"),oA=o((n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,"wrapAnsi16m"),bt={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]}},DZ=Object.keys(bt.modifier),t$=Object.keys(bt.color),r$=Object.keys(bt.bgColor),NZ=[...t$,...r$];function n$(){let n=new Map;for(let[e,t]of Object.entries(bt)){for(let[r,i]of Object.entries(t))bt[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=bt[r],n.set(i[0],i[1]);Object.defineProperty(bt,e,{value:t,enumerable:!1})}return Object.defineProperty(bt,"codes",{value:n,enumerable:!1}),bt.color.close="\x1B[39m",bt.bgColor.close="\x1B[49m",bt.color.ansi=sA(),bt.color.ansi256=aA(),bt.color.ansi16m=oA(),bt.bgColor.ansi=sA(10),bt.bgColor.ansi256=aA(10),bt.bgColor.ansi16m=oA(10),Object.defineProperties(bt,{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=>bt.rgbToAnsi256(...bt.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)=>bt.ansi256ToAnsi(bt.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:o(e=>bt.ansi256ToAnsi(bt.hexToAnsi256(e)),"value"),enumerable:!1}}),bt}o(n$,"assembleStyles");var i$=n$(),ai=i$;var kd=X(require("node:process"),1),lA=X(require("node:os"),1),C2=X(require("node:tty"),1);function On(n,e=globalThis.Deno?globalThis.Deno.args:kd.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(On,"hasFlag");var{env:St}=kd.default,Nd;On("no-color")||On("no-colors")||On("color=false")||On("color=never")?Nd=0:(On("color")||On("colors")||On("color=true")||On("color=always"))&&(Nd=1);function s$(){if("FORCE_COLOR"in St)return St.FORCE_COLOR==="true"?1:St.FORCE_COLOR==="false"?0:St.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(St.FORCE_COLOR,10),3)}o(s$,"envForceColor");function a$(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}o(a$,"translateLevel");function o$(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=s$();r!==void 0&&(Nd=r);let i=t?Nd:r;if(i===0)return 0;if(t){if(On("color=16m")||On("color=full")||On("color=truecolor"))return 3;if(On("color=256"))return 2}if("TF_BUILD"in St&&"AGENT_NAME"in St)return 1;if(n&&!e&&i===void 0)return 0;let s=i||0;if(St.TERM==="dumb")return s;if(kd.default.platform==="win32"){let a=lA.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in St)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in St)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in St)||St.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in St)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(St.TEAMCITY_VERSION)?1:0;if(St.COLORTERM==="truecolor"||St.TERM==="xterm-kitty"||St.TERM==="xterm-ghostty"||St.TERM==="wezterm")return 3;if("TERM_PROGRAM"in St){let a=Number.parseInt((St.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(St.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(St.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(St.TERM)||"COLORTERM"in St?1:s}o(o$,"_supportsColor");function cA(n,e={}){let t=o$(n,{streamIsTTY:n&&n.isTTY,...e});return a$(t)}o(cA,"createSupportsColor");var c$={stdout:cA({isTTY:C2.default.isatty(1)}),stderr:cA({isTTY:C2.default.isatty(2)})},uA=c$;function fA(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(fA,"stringReplaceAll");function hA(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
|
|
450
450
|
`:`
|
|
451
451
|
`)+t,i=r+1,r=n.indexOf(`
|
|
452
452
|
`,i)}while(r!==-1);return s+=n.slice(i),s}o(hA,"stringEncaseCRLFWithFirstIndex");var{stdout:dA,stderr:pA}=uA,I2=Symbol("GENERATOR"),oc=Symbol("STYLER"),jl=Symbol("IS_EMPTY"),mA=["ansi","ansi","ansi256","ansi16m"],cc=Object.create(null),l$=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=dA?dA.level:0;n.level=e.level===void 0?t:e.level},"applyOptions");var u$=o(n=>{let e=o((...t)=>t.join(" "),"chalk");return l$(e,n),Object.setPrototypeOf(e,$l.prototype),e},"chalkFactory");function $l(n){return u$(n)}o($l,"createChalk");Object.setPrototypeOf($l.prototype,Function.prototype);for(let[n,e]of Object.entries(ai))cc[n]={get(){let t=Ld(this,R2(e.open,e.close,this[oc]),this[jl]);return Object.defineProperty(this,n,{value:t}),t}};cc.visible={get(){let n=Ld(this,this[oc],!0);return Object.defineProperty(this,"visible",{value:n}),n}};var O2=o((n,e,t,...r)=>n==="rgb"?e==="ansi16m"?ai[t].ansi16m(...r):e==="ansi256"?ai[t].ansi256(ai.rgbToAnsi256(...r)):ai[t].ansi(ai.rgbToAnsi(...r)):n==="hex"?O2("rgb",e,t,...ai.hexToRgb(...r)):ai[t][n](...r),"getModelAnsi"),f$=["rgb","hex","ansi256"];for(let n of f$){cc[n]={get(){let{level:t}=this;return function(...r){let i=R2(O2(n,mA[t],"color",...r),ai.color.close,this[oc]);return Ld(this,i,this[jl])}}};let e="bg"+n[0].toUpperCase()+n.slice(1);cc[e]={get(){let{level:t}=this;return function(...r){let i=R2(O2(n,mA[t],"bgColor",...r),ai.bgColor.close,this[oc]);return Ld(this,i,this[jl])}}}}var h$=Object.defineProperties(()=>{},{...cc,level:{enumerable:!0,get(){return this[I2].level},set(n){this[I2].level=n}}}),R2=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"),Ld=o((n,e,t)=>{let r=o((...i)=>d$(r,i.length===1?""+i[0]:i.join(" ")),"builder");return Object.setPrototypeOf(r,h$),r[I2]=n,r[oc]=e,r[jl]=t,r},"createBuilder"),d$=o((n,e)=>{if(n.level<=0||!e)return n[jl]?"":e;let t=n[oc];if(t===void 0)return e;let{openAll:r,closeAll:i}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=fA(e,t.close,t.open),t=t.parent;let s=e.indexOf(`
|
|
453
|
-
`);return s!==-1&&(e=hA(e,i,r,s)),r+e+i},"applyStyle");Object.defineProperties($l.prototype,cc);var p$=$l(),
|
|
454
|
-
${e}`,"wrappedToString"),_$=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),w$=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),b$=o((n,e,t)=>{let r=t===""?"":`with ${t.trim()}() `,i=v$.bind(null,r,e.toString());Object.defineProperty(i,"name",w$);let{writable:s,enumerable:a,configurable:c}=_$;Object.defineProperty(n,"toString",{value:i,writable:s,enumerable:a,configurable:c})},"changeToString");function P2(n,e,{ignoreNonConfigurable:t=!1}={}){let{name:r}=n;for(let i of Reflect.ownKeys(e))m$(n,e,i,t);return y$(n,e),b$(n,e,r),n}o(P2,"mimicFunction");var Md=new WeakMap,yA=o((n,e={})=>{if(typeof n!="function")throw new TypeError("Expected a function");let t,r=0,i=n.displayName||n.name||"<anonymous>",s=o(function(...a){if(Md.set(s,++r),r===1)t=n.apply(this,a),n=void 0;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return t},"onetime");return P2(s,n),Md.set(s,r),s},"onetime");yA.callCount=n=>{if(!Md.has(n))throw new Error(`The given function \`${n.name}\` is not wrapped by the \`onetime\` package`);return Md.get(n)};var vA=yA;var Da=[];Da.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Da.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Da.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var jd=o(n=>!!n&&typeof n=="object"&&typeof n.removeListener=="function"&&typeof n.emit=="function"&&typeof n.reallyExit=="function"&&typeof n.listeners=="function"&&typeof n.kill=="function"&&typeof n.pid=="number"&&typeof n.on=="function","processOk"),F2=Symbol.for("signal-exit emitter"),D2=globalThis,S$=Object.defineProperty.bind(Object),N2=class{static{o(this,"Emitter")}emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(D2[F2])return D2[F2];S$(D2,F2,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let r=this.listeners[e],i=r.indexOf(t);i!==-1&&(i===0&&r.length===1?r.length=0:r.splice(i,1))}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(t,r)===!0||i;return e==="exit"&&(i=this.emit("afterExit",t,r)||i),i}},$d=class{static{o(this,"SignalExitBase")}},E$=o(n=>({onExit(e,t){return n.onExit(e,t)},load(){return n.load()},unload(){return n.unload()}}),"signalExitWrap"),k2=class extends $d{static{o(this,"SignalExitFallback")}onExit(){return()=>{}}load(){}unload(){}},L2=class extends $d{static{o(this,"SignalExit")}#e=M2.platform==="win32"?"SIGINT":"SIGHUP";#n=new N2;#r;#t;#c;#v={};#i=!1;constructor(e){super(),this.#r=e,this.#v={};for(let t of Da)this.#v[t]=()=>{let r=this.#r.listeners(t),{count:i}=this.#n,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),r.length===i){this.unload();let a=this.#n.emit("exit",null,t),c=t==="SIGHUP"?this.#e:t;a||e.kill(e.pid,c)}};this.#c=e.reallyExit,this.#t=e.emit}onExit(e,t){if(!jd(this.#r))return()=>{};this.#i===!1&&this.load();let r=t?.alwaysLast?"afterExit":"exit";return this.#n.on(r,e),()=>{this.#n.removeListener(r,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#n.count+=1;for(let e of Da)try{let t=this.#v[e];t&&this.#r.on(e,t)}catch{}this.#r.emit=(e,...t)=>this.#s(e,...t),this.#r.reallyExit=e=>this.#u(e)}}unload(){this.#i&&(this.#i=!1,Da.forEach(e=>{let t=this.#v[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#r.removeListener(e,t)}catch{}}),this.#r.emit=this.#t,this.#r.reallyExit=this.#c,this.#n.count-=1)}#u(e){return jd(this.#r)?(this.#r.exitCode=e||0,this.#n.emit("exit",this.#r.exitCode,null),this.#c.call(this.#r,this.#r.exitCode)):0}#s(e,...t){let r=this.#t;if(e==="exit"&&jd(this.#r)){typeof t[0]=="number"&&(this.#r.exitCode=t[0]);let i=r.call(this.#r,e,...t);return this.#n.emit("exit",this.#r.exitCode,null),i}else return r.call(this.#r,e,...t)}},M2=globalThis.process,{onExit:_A,load:tee,unload:ree}=E$(jd(M2)?new L2(M2):new k2);var wA=Vl.default.stderr.isTTY?Vl.default.stderr:Vl.default.stdout.isTTY?Vl.default.stdout:void 0,T$=wA?vA(()=>{_A(()=>{wA.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},bA=T$;var Vd=!1,lc={};lc.show=(n=j2.default.stderr)=>{n.isTTY&&(Vd=!1,n.write("\x1B[?25h"))};lc.hide=(n=j2.default.stderr)=>{n.isTTY&&(bA(),Vd=!0,n.write("\x1B[?25l"))};lc.toggle=(n,e)=>{n!==void 0&&(Vd=n),Vd?lc.show(e):lc.hide(e)};var $2=lc;var V2={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots14:{interval:80,frames:["\u2809\u2809","\u2808\u2819","\u2800\u2839","\u2800\u28B8","\u2800\u28F0","\u2880\u28E0","\u28C0\u28C0","\u28C4\u2840","\u28C6\u2800","\u2847\u2800","\u280F\u2800","\u280B\u2801"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},dotsCircle:{interval:80,frames:["\u288E ","\u280E\u2801","\u280A\u2811","\u2808\u2831"," \u2871","\u2880\u2870","\u2884\u2860","\u2886\u2840"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},rollingLine:{interval:80,frames:["/ "," - "," \\ "," |"," |"," \\ "," - ","/ "]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u{1F497} "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}};var Ul=V2,hee=Object.keys(V2);var Na={};O_(Na,{error:()=>R$,info:()=>C$,success:()=>I$,warning:()=>O$});var SA=X(require("node:tty"),1);var A$=SA.default?.WriteStream?.prototype?.hasColors?.()??!1,Oe=o((n,e)=>{if(!A$)return i=>i;let t=`\x1B[${n}m`,r=`\x1B[${e}m`;return i=>{let s=i+"",a=s.indexOf(r);if(a===-1)return t+s+r;let c=t,l=0,f=(e===22?r:"")+t;for(;a!==-1;)c+=s.slice(l,a)+f,l=a+r.length,a=s.indexOf(r,l);return c+=s.slice(l)+r,c}},"format"),mee=Oe(0,0),gee=Oe(1,22),yee=Oe(2,22),vee=Oe(3,23),_ee=Oe(4,24),wee=Oe(53,55),bee=Oe(7,27),See=Oe(8,28),Eee=Oe(9,29),Tee=Oe(30,39),EA=Oe(31,39),TA=Oe(32,39),xA=Oe(33,39),AA=Oe(34,39),xee=Oe(35,39),Aee=Oe(36,39),Cee=Oe(37,39),Iee=Oe(90,39),Oee=Oe(40,49),Ree=Oe(41,49),Pee=Oe(42,49),Fee=Oe(43,49),Dee=Oe(44,49),Nee=Oe(45,49),kee=Oe(46,49),Lee=Oe(47,49),Mee=Oe(100,49),jee=Oe(91,39),$ee=Oe(92,39),Vee=Oe(93,39),Uee=Oe(94,39),Bee=Oe(95,39),qee=Oe(96,39),Wee=Oe(97,39),Gee=Oe(101,49),Hee=Oe(102,49),zee=Oe(103,49),Qee=Oe(104,49),Yee=Oe(105,49),Kee=Oe(106,49),Xee=Oe(107,49);var U2=X(require("node:process"),1);function Bl(){let{env:n}=U2.default,{TERM:e,TERM_PROGRAM:t}=n;return U2.default.platform!=="win32"?e!=="linux":!!n.WT_SESSION||!!n.TERMINUS_SUBLIME||n.ConEmuTask==="{cmd::Cmder}"||t==="Terminus-Sublime"||t==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||n.TERMINAL_EMULATOR==="JetBrains-JediTerm"}o(Bl,"isUnicodeSupported");var Ud=Bl(),C$=AA(Ud?"\u2139":"i"),I$=TA(Ud?"\u2714":"\u221A"),O$=xA(Ud?"\u26A0":"\u203C"),R$=EA(Ud?"\u2716":"\xD7");function B2({onlyFirst:n=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,n?void 0:"g")}o(B2,"ansiRegex");var P$=B2();function ql(n){if(typeof n!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof n}\``);return n.replace(P$,"")}o(ql,"stripAnsi");function CA(n){return n===161||n===164||n===167||n===168||n===170||n===173||n===174||n>=176&&n<=180||n>=182&&n<=186||n>=188&&n<=191||n===198||n===208||n===215||n===216||n>=222&&n<=225||n===230||n>=232&&n<=234||n===236||n===237||n===240||n===242||n===243||n>=247&&n<=250||n===252||n===254||n===257||n===273||n===275||n===283||n===294||n===295||n===299||n>=305&&n<=307||n===312||n>=319&&n<=322||n===324||n>=328&&n<=331||n===333||n===338||n===339||n===358||n===359||n===363||n===462||n===464||n===466||n===468||n===470||n===472||n===474||n===476||n===593||n===609||n===708||n===711||n>=713&&n<=715||n===717||n===720||n>=728&&n<=731||n===733||n===735||n>=768&&n<=879||n>=913&&n<=929||n>=931&&n<=937||n>=945&&n<=961||n>=963&&n<=969||n===1025||n>=1040&&n<=1103||n===1105||n===8208||n>=8211&&n<=8214||n===8216||n===8217||n===8220||n===8221||n>=8224&&n<=8226||n>=8228&&n<=8231||n===8240||n===8242||n===8243||n===8245||n===8251||n===8254||n===8308||n===8319||n>=8321&&n<=8324||n===8364||n===8451||n===8453||n===8457||n===8467||n===8470||n===8481||n===8482||n===8486||n===8491||n===8531||n===8532||n>=8539&&n<=8542||n>=8544&&n<=8555||n>=8560&&n<=8569||n===8585||n>=8592&&n<=8601||n===8632||n===8633||n===8658||n===8660||n===8679||n===8704||n===8706||n===8707||n===8711||n===8712||n===8715||n===8719||n===8721||n===8725||n===8730||n>=8733&&n<=8736||n===8739||n===8741||n>=8743&&n<=8748||n===8750||n>=8756&&n<=8759||n===8764||n===8765||n===8776||n===8780||n===8786||n===8800||n===8801||n>=8804&&n<=8807||n===8810||n===8811||n===8814||n===8815||n===8834||n===8835||n===8838||n===8839||n===8853||n===8857||n===8869||n===8895||n===8978||n>=9312&&n<=9449||n>=9451&&n<=9547||n>=9552&&n<=9587||n>=9600&&n<=9615||n>=9618&&n<=9621||n===9632||n===9633||n>=9635&&n<=9641||n===9650||n===9651||n===9654||n===9655||n===9660||n===9661||n===9664||n===9665||n>=9670&&n<=9672||n===9675||n>=9678&&n<=9681||n>=9698&&n<=9701||n===9711||n===9733||n===9734||n===9737||n===9742||n===9743||n===9756||n===9758||n===9792||n===9794||n===9824||n===9825||n>=9827&&n<=9829||n>=9831&&n<=9834||n===9836||n===9837||n===9839||n===9886||n===9887||n===9919||n>=9926&&n<=9933||n>=9935&&n<=9939||n>=9941&&n<=9953||n===9955||n===9960||n===9961||n>=9963&&n<=9969||n===9972||n>=9974&&n<=9977||n===9979||n===9980||n===9982||n===9983||n===10045||n>=10102&&n<=10111||n>=11094&&n<=11097||n>=12872&&n<=12879||n>=57344&&n<=63743||n>=65024&&n<=65039||n===65533||n>=127232&&n<=127242||n>=127248&&n<=127277||n>=127280&&n<=127337||n>=127344&&n<=127373||n===127375||n===127376||n>=127387&&n<=127404||n>=917760&&n<=917999||n>=983040&&n<=1048573||n>=1048576&&n<=1114109}o(CA,"isAmbiguous");function IA(n){return n===12288||n>=65281&&n<=65376||n>=65504&&n<=65510}o(IA,"isFullWidth");function OA(n){return n>=4352&&n<=4447||n===8986||n===8987||n===9001||n===9002||n>=9193&&n<=9196||n===9200||n===9203||n===9725||n===9726||n===9748||n===9749||n>=9776&&n<=9783||n>=9800&&n<=9811||n===9855||n>=9866&&n<=9871||n===9875||n===9889||n===9898||n===9899||n===9917||n===9918||n===9924||n===9925||n===9934||n===9940||n===9962||n===9970||n===9971||n===9973||n===9978||n===9981||n===9989||n===9994||n===9995||n===10024||n===10060||n===10062||n>=10067&&n<=10069||n===10071||n>=10133&&n<=10135||n===10160||n===10175||n===11035||n===11036||n===11088||n===11093||n>=11904&&n<=11929||n>=11931&&n<=12019||n>=12032&&n<=12245||n>=12272&&n<=12287||n>=12289&&n<=12350||n>=12353&&n<=12438||n>=12441&&n<=12543||n>=12549&&n<=12591||n>=12593&&n<=12686||n>=12688&&n<=12773||n>=12783&&n<=12830||n>=12832&&n<=12871||n>=12880&&n<=42124||n>=42128&&n<=42182||n>=43360&&n<=43388||n>=44032&&n<=55203||n>=63744&&n<=64255||n>=65040&&n<=65049||n>=65072&&n<=65106||n>=65108&&n<=65126||n>=65128&&n<=65131||n>=94176&&n<=94180||n>=94192&&n<=94198||n>=94208&&n<=101589||n>=101631&&n<=101662||n>=101760&&n<=101874||n>=110576&&n<=110579||n>=110581&&n<=110587||n===110589||n===110590||n>=110592&&n<=110882||n===110898||n>=110928&&n<=110930||n===110933||n>=110948&&n<=110951||n>=110960&&n<=111355||n>=119552&&n<=119638||n>=119648&&n<=119670||n===126980||n===127183||n===127374||n>=127377&&n<=127386||n>=127488&&n<=127490||n>=127504&&n<=127547||n>=127552&&n<=127560||n===127568||n===127569||n>=127584&&n<=127589||n>=127744&&n<=127776||n>=127789&&n<=127797||n>=127799&&n<=127868||n>=127870&&n<=127891||n>=127904&&n<=127946||n>=127951&&n<=127955||n>=127968&&n<=127984||n===127988||n>=127992&&n<=128062||n===128064||n>=128066&&n<=128252||n>=128255&&n<=128317||n>=128331&&n<=128334||n>=128336&&n<=128359||n===128378||n===128405||n===128406||n===128420||n>=128507&&n<=128591||n>=128640&&n<=128709||n===128716||n>=128720&&n<=128722||n>=128725&&n<=128728||n>=128732&&n<=128735||n===128747||n===128748||n>=128756&&n<=128764||n>=128992&&n<=129003||n===129008||n>=129292&&n<=129338||n>=129340&&n<=129349||n>=129351&&n<=129535||n>=129648&&n<=129660||n>=129664&&n<=129674||n>=129678&&n<=129734||n===129736||n>=129741&&n<=129756||n>=129759&&n<=129770||n>=129775&&n<=129784||n>=131072&&n<=196605||n>=196608&&n<=262141}o(OA,"isWide");function F$(n){if(!Number.isSafeInteger(n))throw new TypeError(`Expected a code point, got \`${typeof n}\`.`)}o(F$,"validate");function q2(n,{ambiguousAsWide:e=!1}={}){return F$(n),IA(n)||OA(n)||e&&CA(n)?2:1}o(q2,"eastAsianWidth");var D$=new Intl.Segmenter,N$=new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$","v"),k$=new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+","v"),L$=new RegExp("^\\p{RGI_Emoji}$","v");function M$(n){return n.replace(k$,"")}o(M$,"baseVisible");function j$(n){return N$.test(n)}o(j$,"isZeroWidthCluster");function $$(n,e){let t=0;if(n.length>1)for(let r of n.slice(1))r>="\uFF00"&&r<="\uFFEF"&&(t+=q2(r.codePointAt(0),e));return t}o($$,"trailingHalfwidthWidth");function W2(n,e={}){if(typeof n!="string"||n.length===0)return 0;let{ambiguousIsNarrow:t=!0,countAnsiEscapeCodes:r=!1}=e,i=n;if(r||(i=ql(i)),i.length===0)return 0;let s=0,a={ambiguousAsWide:!t};for(let{segment:c}of D$.segment(i)){if(j$(c))continue;if(L$.test(c)){s+=2;continue}let l=M$(c).codePointAt(0);s+=q2(l,a),s+=$$(c,a)}return s}o(W2,"stringWidth");function G2({stream:n=process.stdout}={}){return!!(n&&n.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}o(G2,"isInteractive");var oi=X(require("node:process"),1);var V$=3,H2=class{static{o(this,"StdinDiscarder")}#e=0;start(){this.#e++,this.#e===1&&this.#n()}stop(){if(this.#e<=0)throw new Error("`stop` called more times than `start`");this.#e--,this.#e===0&&this.#r()}#n(){oi.default.platform==="win32"||!oi.default.stdin.isTTY||(oi.default.stdin.setRawMode(!0),oi.default.stdin.on("data",this.#t),oi.default.stdin.resume())}#r(){oi.default.stdin.isTTY&&(oi.default.stdin.off("data",this.#t),oi.default.stdin.pause(),oi.default.stdin.setRawMode(!1))}#t(e){e[0]===V$&&oi.default.emit("SIGINT")}},U$=new H2,z2=U$;var Q2=class{static{o(this,"Ora")}#e=0;#n=!1;#r=0;#t=-1;#c=0;#v=0;#i;#u;#s;#l;#a;#p;#g;#h;#m;#y;#f;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#i={color:"cyan",stream:Wl.default.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#i.color,this.spinner=this.#i.spinner,this.#a=this.#i.interval,this.#s=this.#i.stream,this.#p=typeof this.#i.isEnabled=="boolean"?this.#i.isEnabled:G2({stream:this.#s}),this.#g=typeof this.#i.isSilent=="boolean"?this.#i.isSilent:!1,this.text=this.#i.text,this.prefixText=this.#i.prefixText,this.suffixText=this.#i.suffixText,this.indent=this.#i.indent,Wl.default.env.NODE_ENV==="test"&&(this._stream=this.#s,this._isEnabled=this.#p,Object.defineProperty(this,"_linesToClear",{get(){return this.#e},set(t){this.#e=t}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#t}}),Object.defineProperty(this,"_lineCount",{get(){return this.#r}}))}get indent(){return this.#h}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#h=e,this.#w()}get interval(){return this.#a??this.#u.interval??100}get spinner(){return this.#u}set spinner(e){if(this.#t=-1,this.#a=void 0,typeof e=="object"){if(!Array.isArray(e.frames)||e.frames.length===0||e.frames.some(t=>typeof t!="string"))throw new Error("The given spinner must have a non-empty `frames` array of strings");if(e.interval!==void 0&&!(Number.isInteger(e.interval)&&e.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided");this.#u=e}else if(!Bl())this.#u=Ul.line;else if(e===void 0)this.#u=Ul.dots;else if(e!=="default"&&Ul[e])this.#u=Ul[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#m}set text(e=""){this.#m=e,this.#w()}get prefixText(){return this.#y}set prefixText(e=""){this.#y=e,this.#w()}get suffixText(){return this.#f}set suffixText(e=""){this.#f=e,this.#w()}get isSpinning(){return this.#l!==void 0}#E(e,t,r=!1){let i=typeof e=="function"?e():e;return typeof i=="string"&&i!==""?r?t+i:i+t:""}#T(e=this.#y,t=" "){return this.#E(e,t,!1)}#_(e=this.#f,t=" "){return this.#E(e,t,!0)}#S(e,t){let r=0;for(let i of ql(e).split(`
|
|
453
|
+
`);return s!==-1&&(e=hA(e,i,r,s)),r+e+i},"applyStyle");Object.defineProperties($l.prototype,cc);var p$=$l(),WZ=$l({level:pA?pA.level:0});var gA=p$;var j2=X(require("node:process"),1);var Vl=X(require("node:process"),1);var m$=o((n,e,t,r)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;let i=Object.getOwnPropertyDescriptor(n,t),s=Object.getOwnPropertyDescriptor(e,t);!g$(i,s)&&r||Object.defineProperty(n,t,s)},"copyProperty"),g$=o(function(n,e){return n===void 0||n.configurable||n.writable===e.writable&&n.enumerable===e.enumerable&&n.configurable===e.configurable&&(n.writable||n.value===e.value)},"canCopyProperty"),y$=o((n,e)=>{let t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(n)&&Object.setPrototypeOf(n,t)},"changePrototype"),v$=o((n,e)=>`/* Wrapped ${n}*/
|
|
454
|
+
${e}`,"wrappedToString"),_$=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),w$=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),b$=o((n,e,t)=>{let r=t===""?"":`with ${t.trim()}() `,i=v$.bind(null,r,e.toString());Object.defineProperty(i,"name",w$);let{writable:s,enumerable:a,configurable:c}=_$;Object.defineProperty(n,"toString",{value:i,writable:s,enumerable:a,configurable:c})},"changeToString");function P2(n,e,{ignoreNonConfigurable:t=!1}={}){let{name:r}=n;for(let i of Reflect.ownKeys(e))m$(n,e,i,t);return y$(n,e),b$(n,e,r),n}o(P2,"mimicFunction");var Md=new WeakMap,yA=o((n,e={})=>{if(typeof n!="function")throw new TypeError("Expected a function");let t,r=0,i=n.displayName||n.name||"<anonymous>",s=o(function(...a){if(Md.set(s,++r),r===1)t=n.apply(this,a),n=void 0;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return t},"onetime");return P2(s,n),Md.set(s,r),s},"onetime");yA.callCount=n=>{if(!Md.has(n))throw new Error(`The given function \`${n.name}\` is not wrapped by the \`onetime\` package`);return Md.get(n)};var vA=yA;var Da=[];Da.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Da.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Da.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var jd=o(n=>!!n&&typeof n=="object"&&typeof n.removeListener=="function"&&typeof n.emit=="function"&&typeof n.reallyExit=="function"&&typeof n.listeners=="function"&&typeof n.kill=="function"&&typeof n.pid=="number"&&typeof n.on=="function","processOk"),F2=Symbol.for("signal-exit emitter"),D2=globalThis,S$=Object.defineProperty.bind(Object),N2=class{static{o(this,"Emitter")}emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(D2[F2])return D2[F2];S$(D2,F2,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let r=this.listeners[e],i=r.indexOf(t);i!==-1&&(i===0&&r.length===1?r.length=0:r.splice(i,1))}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(t,r)===!0||i;return e==="exit"&&(i=this.emit("afterExit",t,r)||i),i}},$d=class{static{o(this,"SignalExitBase")}},E$=o(n=>({onExit(e,t){return n.onExit(e,t)},load(){return n.load()},unload(){return n.unload()}}),"signalExitWrap"),k2=class extends $d{static{o(this,"SignalExitFallback")}onExit(){return()=>{}}load(){}unload(){}},L2=class extends $d{static{o(this,"SignalExit")}#e=M2.platform==="win32"?"SIGINT":"SIGHUP";#n=new N2;#r;#t;#c;#v={};#i=!1;constructor(e){super(),this.#r=e,this.#v={};for(let t of Da)this.#v[t]=()=>{let r=this.#r.listeners(t),{count:i}=this.#n,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),r.length===i){this.unload();let a=this.#n.emit("exit",null,t),c=t==="SIGHUP"?this.#e:t;a||e.kill(e.pid,c)}};this.#c=e.reallyExit,this.#t=e.emit}onExit(e,t){if(!jd(this.#r))return()=>{};this.#i===!1&&this.load();let r=t?.alwaysLast?"afterExit":"exit";return this.#n.on(r,e),()=>{this.#n.removeListener(r,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#n.count+=1;for(let e of Da)try{let t=this.#v[e];t&&this.#r.on(e,t)}catch{}this.#r.emit=(e,...t)=>this.#s(e,...t),this.#r.reallyExit=e=>this.#u(e)}}unload(){this.#i&&(this.#i=!1,Da.forEach(e=>{let t=this.#v[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#r.removeListener(e,t)}catch{}}),this.#r.emit=this.#t,this.#r.reallyExit=this.#c,this.#n.count-=1)}#u(e){return jd(this.#r)?(this.#r.exitCode=e||0,this.#n.emit("exit",this.#r.exitCode,null),this.#c.call(this.#r,this.#r.exitCode)):0}#s(e,...t){let r=this.#t;if(e==="exit"&&jd(this.#r)){typeof t[0]=="number"&&(this.#r.exitCode=t[0]);let i=r.call(this.#r,e,...t);return this.#n.emit("exit",this.#r.exitCode,null),i}else return r.call(this.#r,e,...t)}},M2=globalThis.process,{onExit:_A,load:eee,unload:tee}=E$(jd(M2)?new L2(M2):new k2);var wA=Vl.default.stderr.isTTY?Vl.default.stderr:Vl.default.stdout.isTTY?Vl.default.stdout:void 0,T$=wA?vA(()=>{_A(()=>{wA.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},bA=T$;var Vd=!1,lc={};lc.show=(n=j2.default.stderr)=>{n.isTTY&&(Vd=!1,n.write("\x1B[?25h"))};lc.hide=(n=j2.default.stderr)=>{n.isTTY&&(bA(),Vd=!0,n.write("\x1B[?25l"))};lc.toggle=(n,e)=>{n!==void 0&&(Vd=n),Vd?lc.show(e):lc.hide(e)};var $2=lc;var V2={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots14:{interval:80,frames:["\u2809\u2809","\u2808\u2819","\u2800\u2839","\u2800\u28B8","\u2800\u28F0","\u2880\u28E0","\u28C0\u28C0","\u28C4\u2840","\u28C6\u2800","\u2847\u2800","\u280F\u2800","\u280B\u2801"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},dotsCircle:{interval:80,frames:["\u288E ","\u280E\u2801","\u280A\u2811","\u2808\u2831"," \u2871","\u2880\u2870","\u2884\u2860","\u2886\u2840"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},rollingLine:{interval:80,frames:["/ "," - "," \\ "," |"," |"," \\ "," - ","/ "]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u{1F497} "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}};var Ul=V2,fee=Object.keys(V2);var Na={};O_(Na,{error:()=>R$,info:()=>C$,success:()=>I$,warning:()=>O$});var SA=X(require("node:tty"),1);var A$=SA.default?.WriteStream?.prototype?.hasColors?.()??!1,Oe=o((n,e)=>{if(!A$)return i=>i;let t=`\x1B[${n}m`,r=`\x1B[${e}m`;return i=>{let s=i+"",a=s.indexOf(r);if(a===-1)return t+s+r;let c=t,l=0,f=(e===22?r:"")+t;for(;a!==-1;)c+=s.slice(l,a)+f,l=a+r.length,a=s.indexOf(r,l);return c+=s.slice(l)+r,c}},"format"),pee=Oe(0,0),mee=Oe(1,22),gee=Oe(2,22),yee=Oe(3,23),vee=Oe(4,24),_ee=Oe(53,55),wee=Oe(7,27),bee=Oe(8,28),See=Oe(9,29),Eee=Oe(30,39),EA=Oe(31,39),TA=Oe(32,39),xA=Oe(33,39),AA=Oe(34,39),Tee=Oe(35,39),xee=Oe(36,39),Aee=Oe(37,39),Cee=Oe(90,39),Iee=Oe(40,49),Oee=Oe(41,49),Ree=Oe(42,49),Pee=Oe(43,49),Fee=Oe(44,49),Dee=Oe(45,49),Nee=Oe(46,49),kee=Oe(47,49),Lee=Oe(100,49),Mee=Oe(91,39),jee=Oe(92,39),$ee=Oe(93,39),Vee=Oe(94,39),Uee=Oe(95,39),Bee=Oe(96,39),qee=Oe(97,39),Wee=Oe(101,49),Gee=Oe(102,49),Hee=Oe(103,49),zee=Oe(104,49),Qee=Oe(105,49),Yee=Oe(106,49),Kee=Oe(107,49);var U2=X(require("node:process"),1);function Bl(){let{env:n}=U2.default,{TERM:e,TERM_PROGRAM:t}=n;return U2.default.platform!=="win32"?e!=="linux":!!n.WT_SESSION||!!n.TERMINUS_SUBLIME||n.ConEmuTask==="{cmd::Cmder}"||t==="Terminus-Sublime"||t==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||n.TERMINAL_EMULATOR==="JetBrains-JediTerm"}o(Bl,"isUnicodeSupported");var Ud=Bl(),C$=AA(Ud?"\u2139":"i"),I$=TA(Ud?"\u2714":"\u221A"),O$=xA(Ud?"\u26A0":"\u203C"),R$=EA(Ud?"\u2716":"\xD7");function B2({onlyFirst:n=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,n?void 0:"g")}o(B2,"ansiRegex");var P$=B2();function ql(n){if(typeof n!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof n}\``);return n.replace(P$,"")}o(ql,"stripAnsi");function CA(n){return n===161||n===164||n===167||n===168||n===170||n===173||n===174||n>=176&&n<=180||n>=182&&n<=186||n>=188&&n<=191||n===198||n===208||n===215||n===216||n>=222&&n<=225||n===230||n>=232&&n<=234||n===236||n===237||n===240||n===242||n===243||n>=247&&n<=250||n===252||n===254||n===257||n===273||n===275||n===283||n===294||n===295||n===299||n>=305&&n<=307||n===312||n>=319&&n<=322||n===324||n>=328&&n<=331||n===333||n===338||n===339||n===358||n===359||n===363||n===462||n===464||n===466||n===468||n===470||n===472||n===474||n===476||n===593||n===609||n===708||n===711||n>=713&&n<=715||n===717||n===720||n>=728&&n<=731||n===733||n===735||n>=768&&n<=879||n>=913&&n<=929||n>=931&&n<=937||n>=945&&n<=961||n>=963&&n<=969||n===1025||n>=1040&&n<=1103||n===1105||n===8208||n>=8211&&n<=8214||n===8216||n===8217||n===8220||n===8221||n>=8224&&n<=8226||n>=8228&&n<=8231||n===8240||n===8242||n===8243||n===8245||n===8251||n===8254||n===8308||n===8319||n>=8321&&n<=8324||n===8364||n===8451||n===8453||n===8457||n===8467||n===8470||n===8481||n===8482||n===8486||n===8491||n===8531||n===8532||n>=8539&&n<=8542||n>=8544&&n<=8555||n>=8560&&n<=8569||n===8585||n>=8592&&n<=8601||n===8632||n===8633||n===8658||n===8660||n===8679||n===8704||n===8706||n===8707||n===8711||n===8712||n===8715||n===8719||n===8721||n===8725||n===8730||n>=8733&&n<=8736||n===8739||n===8741||n>=8743&&n<=8748||n===8750||n>=8756&&n<=8759||n===8764||n===8765||n===8776||n===8780||n===8786||n===8800||n===8801||n>=8804&&n<=8807||n===8810||n===8811||n===8814||n===8815||n===8834||n===8835||n===8838||n===8839||n===8853||n===8857||n===8869||n===8895||n===8978||n>=9312&&n<=9449||n>=9451&&n<=9547||n>=9552&&n<=9587||n>=9600&&n<=9615||n>=9618&&n<=9621||n===9632||n===9633||n>=9635&&n<=9641||n===9650||n===9651||n===9654||n===9655||n===9660||n===9661||n===9664||n===9665||n>=9670&&n<=9672||n===9675||n>=9678&&n<=9681||n>=9698&&n<=9701||n===9711||n===9733||n===9734||n===9737||n===9742||n===9743||n===9756||n===9758||n===9792||n===9794||n===9824||n===9825||n>=9827&&n<=9829||n>=9831&&n<=9834||n===9836||n===9837||n===9839||n===9886||n===9887||n===9919||n>=9926&&n<=9933||n>=9935&&n<=9939||n>=9941&&n<=9953||n===9955||n===9960||n===9961||n>=9963&&n<=9969||n===9972||n>=9974&&n<=9977||n===9979||n===9980||n===9982||n===9983||n===10045||n>=10102&&n<=10111||n>=11094&&n<=11097||n>=12872&&n<=12879||n>=57344&&n<=63743||n>=65024&&n<=65039||n===65533||n>=127232&&n<=127242||n>=127248&&n<=127277||n>=127280&&n<=127337||n>=127344&&n<=127373||n===127375||n===127376||n>=127387&&n<=127404||n>=917760&&n<=917999||n>=983040&&n<=1048573||n>=1048576&&n<=1114109}o(CA,"isAmbiguous");function IA(n){return n===12288||n>=65281&&n<=65376||n>=65504&&n<=65510}o(IA,"isFullWidth");function OA(n){return n>=4352&&n<=4447||n===8986||n===8987||n===9001||n===9002||n>=9193&&n<=9196||n===9200||n===9203||n===9725||n===9726||n===9748||n===9749||n>=9776&&n<=9783||n>=9800&&n<=9811||n===9855||n>=9866&&n<=9871||n===9875||n===9889||n===9898||n===9899||n===9917||n===9918||n===9924||n===9925||n===9934||n===9940||n===9962||n===9970||n===9971||n===9973||n===9978||n===9981||n===9989||n===9994||n===9995||n===10024||n===10060||n===10062||n>=10067&&n<=10069||n===10071||n>=10133&&n<=10135||n===10160||n===10175||n===11035||n===11036||n===11088||n===11093||n>=11904&&n<=11929||n>=11931&&n<=12019||n>=12032&&n<=12245||n>=12272&&n<=12287||n>=12289&&n<=12350||n>=12353&&n<=12438||n>=12441&&n<=12543||n>=12549&&n<=12591||n>=12593&&n<=12686||n>=12688&&n<=12773||n>=12783&&n<=12830||n>=12832&&n<=12871||n>=12880&&n<=42124||n>=42128&&n<=42182||n>=43360&&n<=43388||n>=44032&&n<=55203||n>=63744&&n<=64255||n>=65040&&n<=65049||n>=65072&&n<=65106||n>=65108&&n<=65126||n>=65128&&n<=65131||n>=94176&&n<=94180||n>=94192&&n<=94198||n>=94208&&n<=101589||n>=101631&&n<=101662||n>=101760&&n<=101874||n>=110576&&n<=110579||n>=110581&&n<=110587||n===110589||n===110590||n>=110592&&n<=110882||n===110898||n>=110928&&n<=110930||n===110933||n>=110948&&n<=110951||n>=110960&&n<=111355||n>=119552&&n<=119638||n>=119648&&n<=119670||n===126980||n===127183||n===127374||n>=127377&&n<=127386||n>=127488&&n<=127490||n>=127504&&n<=127547||n>=127552&&n<=127560||n===127568||n===127569||n>=127584&&n<=127589||n>=127744&&n<=127776||n>=127789&&n<=127797||n>=127799&&n<=127868||n>=127870&&n<=127891||n>=127904&&n<=127946||n>=127951&&n<=127955||n>=127968&&n<=127984||n===127988||n>=127992&&n<=128062||n===128064||n>=128066&&n<=128252||n>=128255&&n<=128317||n>=128331&&n<=128334||n>=128336&&n<=128359||n===128378||n===128405||n===128406||n===128420||n>=128507&&n<=128591||n>=128640&&n<=128709||n===128716||n>=128720&&n<=128722||n>=128725&&n<=128728||n>=128732&&n<=128735||n===128747||n===128748||n>=128756&&n<=128764||n>=128992&&n<=129003||n===129008||n>=129292&&n<=129338||n>=129340&&n<=129349||n>=129351&&n<=129535||n>=129648&&n<=129660||n>=129664&&n<=129674||n>=129678&&n<=129734||n===129736||n>=129741&&n<=129756||n>=129759&&n<=129770||n>=129775&&n<=129784||n>=131072&&n<=196605||n>=196608&&n<=262141}o(OA,"isWide");function F$(n){if(!Number.isSafeInteger(n))throw new TypeError(`Expected a code point, got \`${typeof n}\`.`)}o(F$,"validate");function q2(n,{ambiguousAsWide:e=!1}={}){return F$(n),IA(n)||OA(n)||e&&CA(n)?2:1}o(q2,"eastAsianWidth");var D$=new Intl.Segmenter,N$=new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$","v"),k$=new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+","v"),L$=new RegExp("^\\p{RGI_Emoji}$","v");function M$(n){return n.replace(k$,"")}o(M$,"baseVisible");function j$(n){return N$.test(n)}o(j$,"isZeroWidthCluster");function $$(n,e){let t=0;if(n.length>1)for(let r of n.slice(1))r>="\uFF00"&&r<="\uFFEF"&&(t+=q2(r.codePointAt(0),e));return t}o($$,"trailingHalfwidthWidth");function W2(n,e={}){if(typeof n!="string"||n.length===0)return 0;let{ambiguousIsNarrow:t=!0,countAnsiEscapeCodes:r=!1}=e,i=n;if(r||(i=ql(i)),i.length===0)return 0;let s=0,a={ambiguousAsWide:!t};for(let{segment:c}of D$.segment(i)){if(j$(c))continue;if(L$.test(c)){s+=2;continue}let l=M$(c).codePointAt(0);s+=q2(l,a),s+=$$(c,a)}return s}o(W2,"stringWidth");function G2({stream:n=process.stdout}={}){return!!(n&&n.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}o(G2,"isInteractive");var oi=X(require("node:process"),1);var V$=3,H2=class{static{o(this,"StdinDiscarder")}#e=0;start(){this.#e++,this.#e===1&&this.#n()}stop(){if(this.#e<=0)throw new Error("`stop` called more times than `start`");this.#e--,this.#e===0&&this.#r()}#n(){oi.default.platform==="win32"||!oi.default.stdin.isTTY||(oi.default.stdin.setRawMode(!0),oi.default.stdin.on("data",this.#t),oi.default.stdin.resume())}#r(){oi.default.stdin.isTTY&&(oi.default.stdin.off("data",this.#t),oi.default.stdin.pause(),oi.default.stdin.setRawMode(!1))}#t(e){e[0]===V$&&oi.default.emit("SIGINT")}},U$=new H2,z2=U$;var Q2=class{static{o(this,"Ora")}#e=0;#n=!1;#r=0;#t=-1;#c=0;#v=0;#i;#u;#s;#l;#a;#p;#g;#h;#m;#y;#f;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#i={color:"cyan",stream:Wl.default.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#i.color,this.spinner=this.#i.spinner,this.#a=this.#i.interval,this.#s=this.#i.stream,this.#p=typeof this.#i.isEnabled=="boolean"?this.#i.isEnabled:G2({stream:this.#s}),this.#g=typeof this.#i.isSilent=="boolean"?this.#i.isSilent:!1,this.text=this.#i.text,this.prefixText=this.#i.prefixText,this.suffixText=this.#i.suffixText,this.indent=this.#i.indent,Wl.default.env.NODE_ENV==="test"&&(this._stream=this.#s,this._isEnabled=this.#p,Object.defineProperty(this,"_linesToClear",{get(){return this.#e},set(t){this.#e=t}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#t}}),Object.defineProperty(this,"_lineCount",{get(){return this.#r}}))}get indent(){return this.#h}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#h=e,this.#w()}get interval(){return this.#a??this.#u.interval??100}get spinner(){return this.#u}set spinner(e){if(this.#t=-1,this.#a=void 0,typeof e=="object"){if(!Array.isArray(e.frames)||e.frames.length===0||e.frames.some(t=>typeof t!="string"))throw new Error("The given spinner must have a non-empty `frames` array of strings");if(e.interval!==void 0&&!(Number.isInteger(e.interval)&&e.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided");this.#u=e}else if(!Bl())this.#u=Ul.line;else if(e===void 0)this.#u=Ul.dots;else if(e!=="default"&&Ul[e])this.#u=Ul[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#m}set text(e=""){this.#m=e,this.#w()}get prefixText(){return this.#y}set prefixText(e=""){this.#y=e,this.#w()}get suffixText(){return this.#f}set suffixText(e=""){this.#f=e,this.#w()}get isSpinning(){return this.#l!==void 0}#E(e,t,r=!1){let i=typeof e=="function"?e():e;return typeof i=="string"&&i!==""?r?t+i:i+t:""}#T(e=this.#y,t=" "){return this.#E(e,t,!1)}#_(e=this.#f,t=" "){return this.#E(e,t,!0)}#S(e,t){let r=0;for(let i of ql(e).split(`
|
|
455
455
|
`))r+=Math.max(1,Math.ceil(W2(i)/t));return r}#w(){let e=this.#s.columns??80,t=typeof this.#y=="function"?"":this.#y,r=typeof this.#f=="function"?"":this.#f,i=typeof t=="string"&&t!==""?t+" ":"",s=typeof r=="string"&&r!==""?" "+r:"",c=" ".repeat(this.#h)+i+"-"+(typeof this.#m=="string"?" "+this.#m:"")+s;this.#r=this.#S(c,e)}get isEnabled(){return this.#p&&!this.#g}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#p=e}get isSilent(){return this.#g}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#g=e}frame(){let e=Date.now();(this.#t===-1||e-this.#c>=this.interval)&&(this.#t=++this.#t%this.#u.frames.length,this.#c=e);let{frames:t}=this.#u,r=t[this.#t];this.color&&(r=gA[this.color](r));let i=this.#T(this.#y," "),s=typeof this.text=="string"?" "+this.text:"",a=this.#_(this.#f," ");return i+r+s+a}clear(){if(!this.#p||!this.#s.isTTY)return this;this.#s.cursorTo(0);for(let e=0;e<this.#e;e++)e>0&&this.#s.moveCursor(0,-1),this.#s.clearLine(1);return(this.#h||this.#v!==this.#h)&&this.#s.cursorTo(this.#h),this.#v=this.#h,this.#e=0,this}render(){if(!this.#p||this.#g)return this;this.clear();let e=this.frame(),t=this.#s.columns??80,r=this.#S(e,t),i=this.#s.rows;if(i&&i>1&&r>i){let s=e.split(`
|
|
456
456
|
`),a=i-1;e=[...s.slice(0,a),"... (content truncated to fit terminal)"].join(`
|
|
457
457
|
`)}return this.#s.write(e),this.#e=this.#S(e,t),this}start(e){if(e&&(this.text=e),this.#g)return this;if(!this.#p){let t=" ".repeat(this.#h)+this.#T(this.#y," ")+(this.text?`- ${this.text}`:"")+this.#_(this.#f," ");return t.trim()!==""&&this.#s.write(t+`
|
|
@@ -534,15 +534,15 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
534
534
|
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${y}ms${h?" (from cache)":""}`),console.log(` Query execution: ${J}ms`),console.log(` Total time: ${L}ms`),console.log(` Triples scanned: ${f.length}`),console.log(` Results returned: ${H.length}`),e.useCache&&console.log(` Triple cache: ${h?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}}catch(i){kA(i,r,t)}})}o(NA,"sparqlQueryCommand");function kA(n,e,t){let r=new Gd;if(r.classifyError(n)!=="unknown"){let s=r.enhanceError(n,e);if(t==="json"){let a=ce.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)}V.handle(n)}o(kA,"handleSparqlError");function iV(n){if(n.includes("SELECT")||n.includes("CONSTRUCT")||n.includes("INSERT")||n.includes("DELETE"))return n;let e=(0,zl.resolve)(n);return(0,fc.existsSync)(e)?(0,fc.readFileSync)(e,"utf-8"):n}o(iV,"loadQuery");async function sV(n,e,t){if(e.explain){let i=new qd,s=await i.analyze(n,{includeAlgebraPlan:!0,optimize:!e.noOptimize});if(t==="json"){let a=ce.success(s);console.log(JSON.stringify(a,null,2))}else s.valid?(console.log(`\u2705 Query syntax is valid
|
|
535
535
|
`),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new Ct.SPARQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new Ct.AlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new Ct.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new Ct.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=ce.success({valid:!0,queryType:DA(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: ${DA(i)}`)}catch(i){kA(i,n,t)}}o(sV,"executeDryRun");function DA(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}o(DA,"getQueryType");function aV(n,e){switch(e){case"json":let t=new ic;console.log(t.format(n));break;case"csv":let r=new Dd;console.log(r.format(n));break;case"table":default:let i=new nc;console.log(i.format(n));break}}o(aV,"formatSelectResults");function oV(n,e){let t=new sc;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(oV,"formatConstructResults");function cV(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(cV,"formatCachedSelectResults");function lV(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}> ${uV(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(lV,"formatCachedConstructResults");function uV(n){return Hd.formatObject(n)}o(uV,"formatNTriplesObject");function fV(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(fV,"formatUpdateResults");var LA=require("fs"),MA=require("path"),Yd=X(Ht());function jA(){return new Ge("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";V.setFormat(e);try{let t=(0,MA.resolve)(n.vault);if(!(0,LA.existsSync)(t))throw new Be(t);let r=new ki(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 Yd.InMemoryTripleStore;if(await f.addAll(u),c=await new Yd.RDFSInferenceEngine().materialize(f),c>0){let d=await f.match();await r.saveTriples(d),a.tripleCount+=c}e==="text"&&c>0&&console.log(`\u{1F9E0} Materialized ${c} inferred Instance_class triples`)}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 h=await r.getCacheStats();if(h){let d={tripleCount:h.tripleCount,createdAt:h.createdAt.toISOString(),isValid:h.isValid,sizeBytes:h.sizeBytes,cachePath:i},p=ce.success({cache:u,stats:d,validation:f},{durationMs:l});console.log(JSON.stringify(p,null,2))}}else{let h=ce.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(h,null,2))}}else{if(a.skippedFiles.length>0){console.log(`
|
|
536
536
|
\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(`
|
|
537
|
-
\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: ${hV(u.sizeBytes)}`))}}}catch(t){V.handle(t)}})}o(jA,"sparqlIndexCommand");function hV(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o(hV,"formatBytes");function $A(){return new Ge("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";V.setFormat(e);try{let t=new uc,r=t.listTemplates();if(e==="json"){let i=ce.success({templates:r,count:r.length});console.log(JSON.stringify(i,null,2))}else console.log(t.formatList("text"))}catch(t){V.handle(t)}})}o($A,"sparqlTemplatesCommand");var HC=require("path");var Wt=X(Ls()),qs=X(require("path"));var oC=X(JA(),1);var Yl=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var wV={"[: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]},Kl=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),bV=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),ZA=o(n=>n.join(""),"rangesToString"),eC=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,h="";e:for(;s<n.length;){let w=n.charAt(s);if((w==="!"||w==="^")&&s===t+1){u=!0,s++;continue}if(w==="]"&&a&&!l){f=s+1;break}if(a=!0,w==="\\"&&!l){l=!0,s++;continue}if(w==="["&&!l){for(let[T,[S,A,F]]of Object.entries(wV))if(n.startsWith(T,s)){if(h)return["$.",!1,n.length-t,!0];s+=T.length,F?i.push(S):r.push(S),c=c||A;continue e}}if(l=!1,h){w>h?r.push(Kl(h)+"-"+Kl(w)):w===h&&r.push(Kl(w)),h="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Kl(w+"-")),s+=2;continue}if(n.startsWith("-",s+1)){h=w,s+=2;continue}r.push(Kl(w)),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 w=r[0].length===2?r[0].slice(-1):r[0];return[bV(w),!1,f-t,!1]}let d="["+(u?"^":"")+ZA(r)+"]",p="["+(u?"":"^")+ZA(i)+"]";return[r.length&&i.length?"("+d+"|"+p+")":r.length?d:p,c,f-t,!0]},"parseClass");var ci=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var sn,SV=new Set(["!","?","+","*","@"]),nv=o(n=>SV.has(n),"isExtglobType"),tC=o(n=>nv(n.type),"isExtglobAST"),EV=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),TV=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),xV=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),rC=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),AV="(?!(?:^|/)\\.\\.?(?:$|/))",Kd="(?!\\.)",CV=new Set(["[","."]),IV=new Set(["..","."]),OV=new Set("().*{}+?[]^$\\!"),RV=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),iv="[^/]",nC=iv+"*?",iC=iv+"+?",La=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#v;#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.#v=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.#v+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 sn&&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.#v===0)return!0;let e=this.#c;for(let t=0;t<this.#v;t++){let r=e.#t[t];if(!(r instanceof sn&&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.#v===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new sn(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 w=r,T="";for(;w<e.length;){let S=e.charAt(w++);if(c||S==="\\"){c=!c,T+=S;continue}if(l){w===u+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(w===u+2&&f)&&(l=!1),T+=S;continue}else if(S==="["){l=!0,u=w,f=!1,T+=S;continue}if(!i.noext&&nv(S)&&e.charAt(w)==="("&&s<=a){t.push(T),T="";let F=new sn(S,t);w=sn.#g(e,F,w,i,s+1),t.push(F);continue}T+=S}return t.push(T),w}let h=r+1,d=new sn(null,t),p=[],y="";for(;h<e.length;){let w=e.charAt(h++);if(c||w==="\\"){c=!c,y+=w;continue}if(l){h===u+1?(w==="^"||w==="!")&&(f=!0):w==="]"&&!(h===u+2&&f)&&(l=!1),y+=w;continue}else if(w==="["){l=!0,u=h,f=!1,y+=w;continue}if(nv(w)&&e.charAt(h)==="("&&(s<=a||t&&t.#y(w))){let S=t&&t.#y(w)?0:1;d.push(y),y="";let A=new sn(w,d);d.push(A),h=sn.#g(e,A,h,i,s+S);continue}if(w==="|"){d.push(y),y="",p.push(d),d=new sn(null,t);continue}if(w===")")return y===""&&t.#t.length===0&&(t.#a=!0),d.push(y),y="",t.push(...p,d),h;y+=w}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],h}#h(e){return this.#m(e,TV)}#m(e,t=EV){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=xV){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new sn(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!!rC.get(this.type)?.has(e)}#_(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)}#S(e){let t=rC.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}#w(){if(tC(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.#w(),this.#m(i)?(t=!1,this.#E(i,r)):this.#h(i)?(t=!1,this.#f(i,r)):this.#_(i)&&(t=!1,this.#S(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#w();this.#l=void 0}static fromGlob(e,t={}){let r=new sn(null,void 0,t);return sn.#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.#w(),this.#p()),!tC(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,w,T,S]=typeof p=="string"?sn.#A(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||T,this.#r=this.#r||S,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&IV.has(this.#t[0]))){let y=CV,w=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),T=!t&&!e&&y.has(u.charAt(0));f=w?AV:T?Kd:""}let h="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(h="(?:$|\\/)"),[f+u+h,ci(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,ci(this.toString()),!1,!1]}let a=!r||e||t||!Kd?"":this.#b(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?Kd:"")+iC;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Kd:"")+nC+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,ci(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#A(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+=(OV.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,h,d,p]=eC(e,l);if(d){s+=f,a=a||h,l+=d-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?iC:nC,t=!0;continue}else c=!1;if(u==="?"){s+=iv,t=!0;continue}s+=RV(u)}return[s,ci(e),!!t,a]}};sn=La;var hc=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var pr=o((n,e,t={})=>(Yl(e),!t.nocomment&&e.charAt(0)==="#"?!1:new pn(e,t).match(n)),"minimatch"),PV=/^\*+([^+@!?\*\[\(]*)$/,FV=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),DV=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),NV=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),kV=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),LV=/^\*+\.\*+$/,MV=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),jV=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),$V=/^\.\*+$/,VV=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),UV=/^\*+$/,BV=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),qV=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),WV=/^\?+([^+@!?\*\[\(]*)?$/,GV=o(([n,e=""])=>{let t=cC([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),HV=o(([n,e=""])=>{let t=lC([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),zV=o(([n,e=""])=>{let t=lC([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),QV=o(([n,e=""])=>{let t=cC([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),cC=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),lC=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),uC=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",sC={win32:{sep:"\\"},posix:{sep:"/"}},YV=uC==="win32"?sC.win32.sep:sC.posix.sep;pr.sep=YV;var Rt=Symbol("globstar **");pr.GLOBSTAR=Rt;var KV="[^/]",XV=KV+"*?",JV="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ZV="(?:(?!(?:\\/|^)\\.).)*?",eU=o((n,e={})=>t=>pr(t,n,e),"filter");pr.filter=eU;var Rn=o((n,e={})=>Object.assign({},n,e),"ext"),tU=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return pr;let e=pr;return Object.assign(o((r,i,s={})=>e(r,i,Rn(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,Rn(n,s))}static defaults(i){return e.defaults(Rn(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,Rn(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Rn(n,s))}},unescape:o((r,i={})=>e.unescape(r,Rn(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,Rn(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,Rn(n,i)),"filter"),defaults:o(r=>e.defaults(Rn(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,Rn(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,Rn(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,Rn(n,s)),"match"),sep:e.sep,GLOBSTAR:Rt})},"defaults");pr.defaults=tU;var fC=o((n,e={})=>(Yl(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,oC.default)(n)),"braceExpand");pr.braceExpand=fC;var rU=o((n,e={})=>new pn(n,e).makeRe(),"makeRe");pr.makeRe=rU;var nU=o((n,e,t={})=>{let r=new pn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");pr.match=nU;var aC=/[?*]|[+@!]\(.*?\)|\[|\]/,iU=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),pn=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={}){Yl(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||uC,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]==="?"||!aC.test(s[2]))&&!aC.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]),h=l?3:c?0:void 0,d=f?3:u?0:void 0;if(typeof h=="number"&&typeof d=="number"){let[p,y]=[e[h],t[d]];p.toLowerCase()===y.toLowerCase()&&(t[d]=p,s=d,i=h)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Rt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Rt,s),c=t.lastIndexOf(Rt),[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 h=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))h=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(A--,!this.#r(e,f,r,A,0)))return!1;h=f.length+1}}if(!u.length){let A=!!h;for(let F=i;F<e.length-h;F++){let Q=String(e[F]);if(A=!0,Q==="."||Q===".."||!this.options.dot&&Q.startsWith("."))return!1}return r||A}let d=[[[],0]],p=d[0],y=0,w=[0];for(let A of u)A===Rt?(w.push(y),p=[[],0],d.push(p)):(p[0].push(A),y++);let T=d.length-1,S=e.length-h;for(let A of d)A[1]=S-(w[T--]+A[0].length);return!!this.#n(e,d,i,0,r,0,!!h)}#n(e,t,r,i,s,a,c){let l=t[i];if(!l){for(let h=r;h<e.length;h++){c=!0;let d=e[h];if(d==="."||d===".."||!this.options.dot&&d.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 d=e[r];if(d==="."||d===".."||!this.options.dot&&d.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],h=e[a];if(this.debug(t,f,h),f===!1||f===Rt)return!1;let d;if(typeof f=="string"?(d=h===f,this.debug("string match",f,h,d)):(d=f.test(h),this.debug("pattern match",f,h,d)),!d)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 fC(this.pattern,this.options)}parse(e){Yl(e);let t=this.options;if(e==="**")return Rt;if(e==="")return"";let r,i=null;(r=e.match(UV))?i=t.dot?qV:BV:(r=e.match(PV))?i=(t.nocase?t.dot?kV:NV:t.dot?DV:FV)(r[1]):(r=e.match(WV))?i=(t.nocase?t.dot?HV:GV:t.dot?zV:QV)(r):(r=e.match(LV))?i=t.dot?jV:MV:(r=e.match($V))&&(i=VV);let s=La.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?XV:t.dot?JV:ZV,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let h of f.flags.split(""))i.add(h);return typeof f=="string"?iU(f):f===Rt?Rt:f._src});return u.forEach((f,h)=>{let d=u[h+1],p=u[h-1];f!==Rt||p===Rt||(p===void 0?d!==void 0&&d!==Rt?u[h+1]="(?:\\/|"+r+"\\/)?"+d:u[h]=r:d===void 0?u[h-1]=p+"(?:\\/|"+r+")?":d!==Rt&&(u[h-1]=p+"(?:\\/|\\/"+r+"\\/)"+d,u[h+1]=Rt))}),u.filter(f=>f!==Rt).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 pr.defaults(e).Minimatch}};pr.AST=La;pr.Minimatch=pn;pr.escape=hc;pr.unescape=ci;var kC=require("node:url");var dc=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,dC=new Set,sv=typeof process=="object"&&process?process:{},pC=o((n,e,t,r)=>{typeof sv.emitWarning=="function"?sv.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Xd=globalThis.AbortController,hC=globalThis.AbortSignal;if(typeof Xd>"u"){hC=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Xd=class{static{o(this,"AbortController")}constructor(){e()}signal=new hC;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let n=sv.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,pC("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 sU=o(n=>!dC.has(n),"shouldWarn");var $s=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),mC=o(n=>$s(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?pc:null:null,"getUintArray"),pc=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},av=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=mC(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]}},Xl=class n{static{o(this,"LRUCache")}#e;#n;#r;#t;#c;#v;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#a;#p;#g;#h;#m;#y;#f;#E;#T;#_;#S;#w;#b;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#a,next:e.#p,prev:e.#g,get head(){return e.#h},get tail(){return e.#m},free:e.#y,isBackgroundFetch:o(t=>e.#d(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.#O(t),"rindexes"),isStale:o(t=>e.#x(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.#v}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:h,noUpdateTTL:d,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:w,fetchMethod:T,memoMethod:S,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:K,ignoreFetchAbort:Te}=e;if(t!==0&&!$s(t))throw new TypeError("max option must be a nonnegative integer");let H=t?mC(t):Array;if(!H)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=w,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(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#v=S,T!==void 0&&typeof T!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=T,this.#w=!!T,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new H(t),this.#g=new H(t),this.#h=0,this.#m=0,this.#y=av.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#S=!!this.#r,this.#b=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!Q,this.allowStaleOnFetchAbort=!!K,this.ignoreFetchAbort=!!Te,this.maxEntrySize!==0){if(this.#n!==0&&!$s(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!$s(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#R()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=$s(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!$s(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#A()}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 J="LRU_CACHE_UNBOUNDED";sU(J)&&(dC.add(J),pC("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",J,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#A(){let e=new pc(this.#e),t=new pc(this.#e);this.#_=e,this.#T=t,this.#F=(s,a,c=dc.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#x(s)&&this.#P(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#C=s=>{t[s]=e[s]!==0?dc.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=dc.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.#x=s=>{let a=t[s],c=e[s];return!!c&&!!a&&(r||i())-a>c}}#C=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#x=o(()=>!1,"#isStale");#R(){let e=new pc(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#k=(t,r,i,s)=>{if(this.#d(r))return 0;if(!$s(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!$s(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");#k=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.#L(t)||((e||!this.#x(t))&&(yield t),t===this.#h));)t=this.#g[t]}*#O({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#h;!(!this.#L(t)||((e||!this.#x(t))&&(yield t),t===this.#m));)t=this.#p[t]}#L(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.#d(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*rentries(){for(let e of this.#O())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#d(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.#d(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#O()){let t=this.#l[e];t!==void 0&&!this.#d(this.#a[e])&&(yield t)}}*values(){for(let e of this.#I())this.#a[e]!==void 0&&!this.#d(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#O())this.#a[e]!==void 0&&!this.#d(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.#d(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.#d(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#O()){let i=this.#a[r],s=this.#d(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#O({allowStale:!0}))this.#x(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#a[t],i=this.#d(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#_&&this.#T){let a=this.#_[t],c=this.#T[t];if(a&&c){let l=a-(dc.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.#d(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(this.#_&&this.#T){a.ttl=this.#_[t];let c=dc.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=dc.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.#k(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let h=this.#i===0?void 0:this.#s.get(e);if(h===void 0)h=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#M(!1):this.#i,this.#l[h]=e,this.#a[h]=t,this.#s.set(e,h),this.#p[this.#m]=h,this.#g[h]=this.#m,this.#m=h,this.#i++,this.#N(h,f,l),l&&(l.set="add"),u=!1;else{this.#V(h);let d=this.#a[h];if(t!==d){if(this.#w&&this.#d(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=d;p!==void 0&&!a&&(this.#S&&this.#r?.(p,e,"set"),this.#b&&this.#f?.push([p,e,"set"]))}else a||(this.#S&&this.#r?.(d,e,"set"),this.#b&&this.#f?.push([d,e,"set"]));if(this.#D(h),this.#N(h,f,l),this.#a[h]=t,l){l.set="replace";let p=d&&this.#d(d)?d.__staleWhileFetching:d;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#_&&this.#A(),this.#_&&(u||this.#F(h,i,s),l&&this.#o(l,h)),!a&&this.#b&&this.#f){let d=this.#f,p;for(;p=d?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#a[this.#h];if(this.#M(!0),this.#d(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.#h,r=this.#l[t],i=this.#a[t];return this.#w&&this.#d(i)?i.__abortController.abort(new Error("evicted")):(this.#S||this.#b)&&(this.#S&&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.#h=this.#m=0,this.#y.length=0):this.#h=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.#d(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#x(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.#x(i))return;let s=this.#a[i];return this.#d(s)?s.__staleWhileFetching:s}#j(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#d(s))return s;let a=new Xd,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((w,T=!1)=>{let{aborted:S}=a.signal,A=r.ignoreFetchAbort&&w!==void 0;if(r.status&&(S&&!T?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,A&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),S&&!A&&!T)return h(a.signal.reason);let F=p;return this.#a[t]===p&&(w===void 0?F.__staleWhileFetching?this.#a[t]=F.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,w,l.options))),w},"cb"),f=o(w=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=w),h(w)),"eb"),h=o(w=>{let{aborted:T}=a.signal,S=T&&r.allowStaleOnFetchAbort,A=S||r.allowStaleOnFetchRejection,F=A||r.noDeleteOnFetchRejection,Q=p;if(this.#a[t]===p&&(!F||Q.__staleWhileFetching===void 0?this.#P(e,"fetch"):S||(this.#a[t]=Q.__staleWhileFetching)),A)return r.status&&Q.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),Q.__staleWhileFetching;if(Q.__returned===Q)throw w},"fetchFail"),d=o((w,T)=>{let S=this.#c?.(e,s,l);S&&S instanceof Promise&&S.then(A=>w(A===void 0?void 0:A),T),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(w(void 0),r.allowStaleOnFetchAbort&&(w=o(A=>u(A,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(d).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}#d(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Xd}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:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:w,forceRefresh:T=!1,status:S,signal:A}=t;if(!this.#w)return S&&(S.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:S});let F={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:S,signal:A},Q=this.#s.get(e);if(Q===void 0){S&&(S.fetch="miss");let K=this.#j(e,Q,F,w);return K.__returned=K}else{let K=this.#a[Q];if(this.#d(K)){let $=r&&K.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",$&&(S.returnedStale=!0)),$?K.__staleWhileFetching:K.__returned=K}let Te=this.#x(Q);if(!T&&!Te)return S&&(S.fetch="hit"),this.#V(Q),i&&this.#C(Q),S&&this.#o(S,Q),K;let H=this.#j(e,Q,F,w),L=H.__staleWhileFetching!==void 0&&r;return S&&(S.fetch=Te?"stale":"refresh",L&&Te&&(S.returnedStale=!0)),L?H.__staleWhileFetching:H.__returned=H}}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.#v;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.#d(l);return a&&this.#o(a,c),this.#x(c)?(a&&(a.get="stale"),u?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#P(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#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.#h?this.#h=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#U(t);else{this.#D(i);let s=this.#a[i];if(this.#d(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#b)&&(this.#S&&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.#h)this.#h=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.#U("delete")}#U(e){for(let t of this.#O({allowStale:!0})){let r=this.#a[t];if(this.#d(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#S&&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.#_&&this.#T&&(this.#_.fill(0),this.#T.fill(0)),this.#E&&this.#E.fill(0),this.#h=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 yc=require("node:path"),xC=require("node:url"),$i=require("fs"),mU=X(require("node:fs"),1),Bs=require("node:fs/promises");var ip=require("node:events"),dv=X(require("node:stream"),1),wC=require("node:string_decoder");var gC=typeof process=="object"&&process?process:{stdout:null,stderr:null},aU=o(n=>!!n&&typeof n=="object"&&(n instanceof Us||n instanceof dv.default||oU(n)||cU(n)),"isStream"),oU=o(n=>!!n&&typeof n=="object"&&n instanceof ip.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==dv.default.Writable.prototype.pipe,"isReadable"),cU=o(n=>!!n&&typeof n=="object"&&n instanceof ip.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),fs=Symbol("EOF"),hs=Symbol("maybeEmitEnd"),Vs=Symbol("emittedEnd"),Jd=Symbol("emittingEnd"),Jl=Symbol("emittedError"),Zd=Symbol("closed"),yC=Symbol("read"),ep=Symbol("flush"),vC=Symbol("flushChunk"),li=Symbol("encoding"),mc=Symbol("decoder"),Jt=Symbol("flowing"),Zl=Symbol("paused"),gc=Symbol("resume"),Zt=Symbol("buffer"),Qr=Symbol("pipes"),er=Symbol("bufferLength"),ov=Symbol("bufferPush"),tp=Symbol("bufferShift"),Ir=Symbol("objectMode"),Pt=Symbol("destroyed"),cv=Symbol("error"),lv=Symbol("emitData"),_C=Symbol("emitEnd"),uv=Symbol("emitEnd2"),Mi=Symbol("async"),fv=Symbol("abort"),rp=Symbol("aborted"),eu=Symbol("signal"),Ma=Symbol("dataListeners"),mn=Symbol("discarded"),tu=o(n=>Promise.resolve().then(n),"defer"),lU=o(n=>n(),"nodefer"),uU=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),fU=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),hU=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),np=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[gc](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},hv=class extends np{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)}},dU=o(n=>!!n.objectMode,"isObjectModeOptions"),pU=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Us=class extends ip.EventEmitter{static{o(this,"Minipass")}[Jt]=!1;[Zl]=!1;[Qr]=[];[Zt]=[];[Ir];[li];[Mi];[mc];[fs]=!1;[Vs]=!1;[Jd]=!1;[Zd]=!1;[Jl]=null;[er]=0;[Pt]=!1;[eu];[rp]=!1;[Ma]=0;[mn]=!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");dU(t)?(this[Ir]=!0,this[li]=null):pU(t)?(this[li]=t.encoding,this[Ir]=!1):(this[Ir]=!1,this[li]=null),this[Mi]=!!t.async,this[mc]=this[li]?new wC.StringDecoder(this[li]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[Zt],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[Qr],"get")});let{signal:r}=t;r&&(this[eu]=r,r.aborted?this[fv]():r.addEventListener("abort",()=>this[fv]()))}get bufferLength(){return this[er]}get encoding(){return this[li]}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[Ir]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Mi]}set async(e){this[Mi]=this[Mi]||!!e}[fv](){this[rp]=!0,this.emit("abort",this[eu]?.reason),this.destroy(this[eu]?.reason)}get aborted(){return this[rp]}set aborted(e){}write(e,t,r){if(this[rp])return!1;if(this[fs])throw new Error("write after end");if(this[Pt])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[Mi]?tu:lU;if(!this[Ir]&&!Buffer.isBuffer(e)){if(hU(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(fU(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Ir]?(this[Jt]&&this[er]!==0&&this[ep](!0),this[Jt]?this.emit("data",e):this[ov](e),this[er]!==0&&this.emit("readable"),r&&i(r),this[Jt]):e.length?(typeof e=="string"&&!(t===this[li]&&!this[mc]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[li]&&(e=this[mc].write(e)),this[Jt]&&this[er]!==0&&this[ep](!0),this[Jt]?this.emit("data",e):this[ov](e),this[er]!==0&&this.emit("readable"),r&&i(r),this[Jt]):(this[er]!==0&&this.emit("readable"),r&&i(r),this[Jt])}read(e){if(this[Pt])return null;if(this[mn]=!1,this[er]===0||e===0||e&&e>this[er])return this[hs](),null;this[Ir]&&(e=null),this[Zt].length>1&&!this[Ir]&&(this[Zt]=[this[li]?this[Zt].join(""):Buffer.concat(this[Zt],this[er])]);let t=this[yC](e||null,this[Zt][0]);return this[hs](),t}[yC](e,t){if(this[Ir])this[tp]();else{let r=t;e===r.length||e===null?this[tp]():typeof r=="string"?(this[Zt][0]=r.slice(e),t=r.slice(0,e),this[er]-=e):(this[Zt][0]=r.subarray(e),t=r.subarray(0,e),this[er]-=e)}return this.emit("data",t),!this[Zt].length&&!this[fs]&&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[fs]=!0,this.writable=!1,(this[Jt]||!this[Zl])&&this[hs](),this}[gc](){this[Pt]||(!this[Ma]&&!this[Qr].length&&(this[mn]=!0),this[Zl]=!1,this[Jt]=!0,this.emit("resume"),this[Zt].length?this[ep]():this[fs]?this[hs]():this.emit("drain"))}resume(){return this[gc]()}pause(){this[Jt]=!1,this[Zl]=!0,this[mn]=!1}get destroyed(){return this[Pt]}get flowing(){return this[Jt]}get paused(){return this[Zl]}[ov](e){this[Ir]?this[er]+=1:this[er]+=e.length,this[Zt].push(e)}[tp](){return this[Ir]?this[er]-=1:this[er]-=this[Zt][0].length,this[Zt].shift()}[ep](e=!1){do;while(this[vC](this[tp]())&&this[Zt].length);!e&&!this[Zt].length&&!this[fs]&&this.emit("drain")}[vC](e){return this.emit("data",e),this[Jt]}pipe(e,t){if(this[Pt])return e;this[mn]=!1;let r=this[Vs];return t=t||{},e===gC.stdout||e===gC.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[Qr].push(t.proxyErrors?new hv(this,e,t):new np(this,e,t)),this[Mi]?tu(()=>this[gc]()):this[gc]()),e}unpipe(e){let t=this[Qr].find(r=>r.dest===e);t&&(this[Qr].length===1?(this[Jt]&&this[Ma]===0&&(this[Jt]=!1),this[Qr]=[]):this[Qr].splice(this[Qr].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[mn]=!1,this[Ma]++,!this[Qr].length&&!this[Jt]&&this[gc]();else if(e==="readable"&&this[er]!==0)super.emit("readable");else if(uU(e)&&this[Vs])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Jl]){let i=t;this[Mi]?tu(()=>i.call(this,this[Jl])):i.call(this,this[Jl])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Ma]=this.listeners("data").length,this[Ma]===0&&!this[mn]&&!this[Qr].length&&(this[Jt]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Ma]=0,!this[mn]&&!this[Qr].length&&(this[Jt]=!1)),t}get emittedEnd(){return this[Vs]}[hs](){!this[Jd]&&!this[Vs]&&!this[Pt]&&this[Zt].length===0&&this[fs]&&(this[Jd]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Zd]&&this.emit("close"),this[Jd]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Pt&&this[Pt])return!1;if(e==="data")return!this[Ir]&&!r?!1:this[Mi]?(tu(()=>this[lv](r)),!0):this[lv](r);if(e==="end")return this[_C]();if(e==="close"){if(this[Zd]=!0,!this[Vs]&&!this[Pt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Jl]=r,super.emit(cv,r);let s=!this[eu]||this.listeners("error").length?super.emit("error",r):!1;return this[hs](),s}else if(e==="resume"){let s=super.emit("resume");return this[hs](),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[hs](),i}[lv](e){for(let r of this[Qr])r.dest.write(e)===!1&&this.pause();let t=this[mn]?!1:super.emit("data",e);return this[hs](),t}[_C](){return this[Vs]?!1:(this[Vs]=!0,this.readable=!1,this[Mi]?(tu(()=>this[uv]()),!0):this[uv]())}[uv](){if(this[mc]){let t=this[mc].end();if(t){for(let r of this[Qr])r.dest.write(t);this[mn]||super.emit("data",t)}}for(let t of this[Qr])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Ir]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Ir]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Ir])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[li]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Pt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[mn]=!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[fs])return t();let s,a,c=o(h=>{this.off("data",l),this.off("end",u),this.off(Pt,f),t(),a(h)},"onerr"),l=o(h=>{this.off("error",c),this.off("end",u),this.off(Pt,f),this.pause(),s({value:h,done:!!this[fs]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Pt,f),t(),s({done:!0,value:void 0})},"onend"),f=o(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((h,d)=>{a=d,s=h,this.once(Pt,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[mn]=!1;let e=!1,t=o(()=>(this.pause(),this.off(cv,t),this.off(Pt,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(cv,t),this.once(Pt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Pt])return e?this.emit("error",e):this.emit(Pt),this;this[Pt]=!0,this[mn]=!0,this[Zt].length=0,this[er]=0;let t=this;return typeof t.close=="function"&&!this[Zd]&&t.close(),e?this.emit("error",e):this.emit(Pt),this}static get isStream(){return aU}};var gU=$i.realpathSync.native,nu={lstatSync:$i.lstatSync,readdir:$i.readdir,readdirSync:$i.readdirSync,readlinkSync:$i.readlinkSync,realpathSync:gU,promises:{lstat:Bs.lstat,readdir:Bs.readdir,readlink:Bs.readlink,realpath:Bs.realpath}},AC=o(n=>!n||n===nu||n===mU?nu:{...nu,...n,promises:{...nu.promises,...n.promises||{}}},"fsFromOption"),CC=/^\\\\\?\\([a-z]:)\\?$/i,yU=o(n=>n.replace(/\//g,"\\").replace(CC,"$1\\"),"uncToDrive"),vU=/[\\\/]/,Fn=0,IC=1,OC=2,ji=4,RC=6,PC=8,ja=10,FC=12,Pn=15,ru=~Pn,pv=16,bC=32,iu=64,ui=128,sp=256,op=512,SC=iu|ui|op,_U=1023,mv=o(n=>n.isFile()?PC:n.isDirectory()?ji:n.isSymbolicLink()?ja:n.isCharacterDevice()?OC:n.isBlockDevice()?RC:n.isSocket()?FC:n.isFIFO()?IC:Fn,"entToType"),EC=new Map,su=o(n=>{let e=EC.get(n);if(e)return e;let t=n.normalize("NFKD");return EC.set(n,t),t},"normalize"),TC=new Map,ap=o(n=>{let e=TC.get(n);if(e)return e;let t=su(n.toLowerCase());return TC.set(n,t),t},"normalizeNocase"),cp=class extends Xl{static{o(this,"ResolveCache")}constructor(){super({max:256})}},gv=class extends Xl{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},DC=Symbol("PathScurry setAsCwd"),Or=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}#v;get gid(){return this.#v}#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}#h;get ctimeMs(){return this.#h}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#_;#S;#w;#b;#A;#C;#o;#F;#x;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Fn,r,i,s,a,c){this.name=e,this.#_=s?ap(e):su(e),this.#o=t&_U,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#w=c.fullpath,this.#A=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=AC(c.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#o&=~pv,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?ap(e):su(e);for(let l of r)if(l.#_===i)return l;let s=this.parent?this.sep:"",a=this.#w?this.#w+s+e:void 0,c=this.newChild(e,Fn,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=ui),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,t=this.parent;if(!t)return this.#A=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.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#w=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&Pn)===Fn}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&Pn)===PC}isDirectory(){return(this.#o&Pn)===ji}isCharacterDevice(){return(this.#o&Pn)===OC}isBlockDevice(){return(this.#o&Pn)===RC}isFIFO(){return(this.#o&Pn)===IC}isSocket(){return(this.#o&Pn)===FC}isSymbolicLink(){return(this.#o&ja)===ja}lstatCached(){return this.#o&bC?this:void 0}readlinkCached(){return this.#x}realpathCached(){return this.#R}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#x)return!0;if(!this.parent)return!1;let e=this.#o&Pn;return!(e!==Fn&&e!==ja||this.#o&sp||this.#o&ui)}calledReaddir(){return!!(this.#o&pv)}isENOENT(){return!!(this.#o&ui)}isNamed(e){return this.nocase?this.#_===ap(e):this.#_===su(e)}async readlink(){let e=this.#x;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.#x=r}catch(t){this.#d(t.code);return}}readlinkSync(){let e=this.#x;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.#x=r}catch(t){this.#d(t.code);return}}#N(e){this.#o|=pv;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#k()}}#k(){this.#o&ui||(this.#o=(this.#o|ui)&ru,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#k()}#O(){this.#o|=op,this.#L()}#L(){if(this.#o&iu)return;let e=this.#o;(e&Pn)===ji&&(e&=ru),this.#o=e|iu,this.#I()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#k():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#k()}#d(e=""){let t=this.#o;t|=sp,e==="ENOENT"&&(t|=ui),(e==="EINVAL"||e==="UNKNOWN")&&(t&=ru),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#$(e,t){return this.#P(e,t)||this.#V(e,t)}#V(e,t){let r=mv(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&Pn;return s!==ji&&s!==ja&&s!==Fn&&(i.#o|=iu),t.unshift(i),t.provisional++,i}#P(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?ap(e.name):su(e.name))===i.#_)return this.#U(e,i,r,t)}}#U(e,t,r,i){let s=t.name;return t.#o=t.#o&ru|mv(e),s!==e.name&&(t.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&ui)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&ui)===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:h,ino:d,mode:p,mtime:y,mtimeMs:w,nlink:T,rdev:S,size:A,uid:F}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#h=u,this.#n=f,this.#v=h,this.#s=d,this.#r=p,this.#f=y,this.#g=w,this.#t=T,this.#i=S,this.#l=A,this.#c=F;let Q=mv(e);this.#o=this.#o&ru|Q|bC,Q!==Fn&&Q!==ji&&Q!==ja&&(this.#o|=iu)}#q=[];#W=!1;#H(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.#H(r.slice(0,r.provisional))})}#B;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.#B)await this.#B;else{let r=o(()=>{},"resolve");this.#B=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.#B=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&SC)return!1;let e=Pn&this.#o;return e===Fn||e===ji||e===ja}shouldWalk(e,t){return(this.#o&ji)===ji&&!(this.#o&SC)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#R)return this.#R;if(!((op|sp|ui)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#R=this.resolve(e)}catch{this.#O()}}realpathSync(){if(this.#R)return this.#R;if(!((op|sp|ui)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#R=this.resolve(e)}catch{this.#O()}}[DC](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.#A=r.join(this.sep),i.#C=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#A=void 0,i.#C=void 0,i=i.parent}},lp=class n extends Or{static{o(this,"PathWin32")}sep="\\";splitSep=vU;constructor(e,t=Fn,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=Fn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return yc.win32.parse(e).root}getRoot(e){if(e=yU(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 vc(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(CC,"$1\\"),e===t}},up=class n extends Or{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=Fn,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=Fn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},fp=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=nu}={}){this.#t=AC(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,xC.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new cp,this.#n=new cp,this.#r=new gv(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,h=t.sep,d=this.rootPath,p=!1;for(let y of l){let w=f--;u=u.child(y,{relative:new Array(w).fill("..").join(h),relativePosix:new Array(w).fill("..").join("/"),fullpath:d+=(p?"":h)+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 Or||(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 Or||(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 Or||(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 Or||(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 Or||(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 Or||(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 Or||(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((h,d)=>{l.add(h),h.readdirCB((p,y)=>{if(p)return d(p);let w=y.length;if(!w)return d();let T=o(()=>{--w===0&&d()},"next");for(let S of y)(!s||s(S))&&c.push(r?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(A=>A?.isUnknown()?A.lstat():A).then(A=>A?.shouldWalk(l,a)?u(A,T):T()):S.shouldWalk(l,a)?u(S,T):T()},!0)},"walk"),f=e;return new Promise((h,d)=>{u(f,p=>{if(p)return d(p);h(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Or||(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 h of f){(!s||s(h))&&c.push(r?h:h.fullpath());let d=h;if(h.isSymbolicLink()){if(!(i&&(d=h.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(l,a)&&l.add(d)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Or||(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 Or||(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 h=f;if(f.isSymbolicLink()){if(!(i&&(h=f.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(c,a)&&c.add(h)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Or||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Us({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,h=o(()=>{let d=!1;for(;!d;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=o((T,S,A=!1)=>{if(T)return c.emit("error",T);if(i&&!A){let F=[];for(let Q of S)Q.isSymbolicLink()&&F.push(Q.realpath().then(K=>K?.isUnknown()?K.lstat():K));if(F.length){Promise.all(F).then(()=>y(null,S,!0));return}}for(let F of S)F&&(!s||s(F))&&(c.write(r?F:F.fullpath())||(d=!0));f--;for(let F of S){let Q=F.realpathCached()||F;Q.shouldWalk(l,a)&&u.push(Q)}d&&!c.flowing?c.once("drain",h):w||h()},"onReaddir"),w=!0;p.readdirCB(y,!0),w=!1}},"process");return h(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Or||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Us({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,h=o(()=>{let d=!1;for(;!d;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let w of y)(!s||s(w))&&(c.write(r?w:w.fullpath())||(d=!0));f--;for(let w of y){let T=w;if(w.isSymbolicLink()){if(!(i&&(T=w.realpathSync())))continue;T.isUnknown()&&T.lstatSync()}T.shouldWalk(l,a)&&u.push(T)}}d&&!c.flowing&&c.once("drain",h)},"process");return h(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[DC](t)}},vc=class extends fp{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,yc.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return yc.win32.parse(e).root.toUpperCase()}newRoot(e){return new lp(this.rootPath,ji,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},_c=class extends fp{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,yc.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new up(this.rootPath,ji,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},au=class extends _c{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},pne=process.platform==="win32"?lp:up,NC=process.platform==="win32"?vc:process.platform==="darwin"?au:_c;var wU=o(n=>n.length>=1,"isPatternList"),bU=o(n=>n.length>=1,"isGlobList"),wc=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#v;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!wU(e))throw new TypeError("empty pattern list");if(!bU(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,h,d,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let w=[s,a,c,l,""].join("/"),T=[f,h,d,p,""].join("/");this.#e=[w,...u],this.#n=[T,...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]===Rt}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#v=this.#v||(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 SU=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",bc=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=SU}){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 pn(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 wc(i,s,0,this.platform),c=new pn(a.globString(),this.mmopts),l=s[s.length-1]==="**",u=a.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let a of this.relative)if(a.match(i)||a.match(s))return!0;for(let a of this.absolute)if(a.match(t)||a.match(r))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var yv=class n{static{o(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let r=e.fullpath(),i=this.store.get(r);i?i.add(t.globString()):this.store.set(r,new Set([t.globString()]))}},vv=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)])}},_v=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())}},ou=class n{static{o(this,"Processor")}hasWalkedCache;matches=new vv;subwalks=new _v;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new yv}processPatterns(e,t){this.patterns=t;let r=t.map(i=>[e,i]);for(let[i,s]of r){this.hasWalkedCache.storeWalked(i,s);let a=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(a){i=i.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let h=s.rest();if(h)s=h;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 h=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,h);continue}else if(l===Rt){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let h=u?.pattern(),d=u?.rest();if(!u||(h===""||h===".")&&!d)this.matches.add(i,c,h===""||h===".");else if(h===".."){let p=i.parent||i;d?this.hasWalkedCache.hasWalked(p,d)||this.subwalks.add(p,d):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===Rt?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 EU=o((n,e)=>typeof n=="string"?new bc([n],e):Array.isArray(n)?new bc(n,e):n,"makeIgnore"),hp=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=EU(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 ou(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 ou(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()}},cu=class extends hp{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}},lu=class extends hp{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Us({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 TU=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",fi=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,kC.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||TU,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"?vc:t.platform==="darwin"?au:t.platform?_c:NC;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 pn(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 wc(l,f,0,this.platform)})}async walk(){return[...await new cu(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 cu(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 lu(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 lu(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 wv=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new pn(t,e).hasMagic())return!0;return!1},"hasMagic");function pp(n,e={}){return new fi(n,e).streamSync()}o(pp,"globStreamSync");function MC(n,e={}){return new fi(n,e).stream()}o(MC,"globStream");function jC(n,e={}){return new fi(n,e).walkSync()}o(jC,"globSync");async function LC(n,e={}){return new fi(n,e).walk()}o(LC,"glob_");function mp(n,e={}){return new fi(n,e).iterateSync()}o(mp,"globIterateSync");function $C(n,e={}){return new fi(n,e).iterate()}o($C,"globIterate");var xU=pp,AU=Object.assign(MC,{sync:pp}),CU=mp,IU=Object.assign($C,{sync:mp}),OU=Object.assign(jC,{stream:pp,iterate:mp}),dp=Object.assign(LC,{glob:LC,globSync:jC,sync:OU,globStream:MC,stream:AU,globStreamSync:pp,streamSync:xU,globIterate:$C,iterate:IU,globIterateSync:mp,iterateSync:CU,Glob:fi,hasMagic:wv,escape:hc,unescape:ci});dp.glob=dp;var $a=X(Ht());var Ft=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await Wt.default.pathExists(t))throw new $a.FileNotFoundError(e);return Wt.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return Wt.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 Wt.default.pathExists(r))throw new $a.FileAlreadyExistsError(e);return await Wt.default.ensureDir(qs.default.dirname(r)),await Wt.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await Wt.default.pathExists(r))throw new $a.FileNotFoundError(e);await Wt.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await Wt.default.ensureDir(qs.default.dirname(r)),await Wt.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await Wt.default.pathExists(t))throw new $a.FileNotFoundError(e);await Wt.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await Wt.default.pathExists(r))throw new $a.FileNotFoundError(e);await Wt.default.ensureDir(qs.default.dirname(i)),await Wt.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await Wt.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await Wt.default.pathExists(t)?(await Wt.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=qs.default.join(t,"**/*.md");return(await dp(r,{nodir:!0})).map(a=>qs.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 qs.default.isAbsolute(e)?e:qs.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=hr.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 uu=X(require("path")),bv=X(Ls());var Sc=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!uu.default.isAbsolute(e))return uu.default.resolve(this.vaultRoot,e);let t=uu.default.resolve(e),r=uu.default.resolve(this.vaultRoot);if(!t.startsWith(r))throw new He(`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(!bv.default.existsSync(e))throw new Nl(e);if(!bv.default.statSync(e).isFile())throw new He(`Not a file: ${e}`,"Provide a path to a file, not a directory.",{filepath:e});if(!e.endsWith(".md"))throw new He(`Not a Markdown file: ${e}`,"Provide a path to a .md file.",{filepath:e})}getVaultRoot(){return this.vaultRoot}};var GC=X(Ht());var VC=X(Ht());var hi=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 VC.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(`
|
|
537
|
+
\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: ${hV(u.sizeBytes)}`))}}}catch(t){V.handle(t)}})}o(jA,"sparqlIndexCommand");function hV(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o(hV,"formatBytes");function $A(){return new Ge("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";V.setFormat(e);try{let t=new uc,r=t.listTemplates();if(e==="json"){let i=ce.success({templates:r,count:r.length});console.log(JSON.stringify(i,null,2))}else console.log(t.formatList("text"))}catch(t){V.handle(t)}})}o($A,"sparqlTemplatesCommand");var HC=require("path");var Wt=X(Ms()),Ws=X(require("path"));var oC=X(JA(),1);var Yl=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var wV={"[: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]},Kl=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),bV=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),ZA=o(n=>n.join(""),"rangesToString"),eC=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,h="";e:for(;s<n.length;){let w=n.charAt(s);if((w==="!"||w==="^")&&s===t+1){u=!0,s++;continue}if(w==="]"&&a&&!l){f=s+1;break}if(a=!0,w==="\\"&&!l){l=!0,s++;continue}if(w==="["&&!l){for(let[T,[S,x,F]]of Object.entries(wV))if(n.startsWith(T,s)){if(h)return["$.",!1,n.length-t,!0];s+=T.length,F?i.push(S):r.push(S),c=c||x;continue e}}if(l=!1,h){w>h?r.push(Kl(h)+"-"+Kl(w)):w===h&&r.push(Kl(w)),h="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Kl(w+"-")),s+=2;continue}if(n.startsWith("-",s+1)){h=w,s+=2;continue}r.push(Kl(w)),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 w=r[0].length===2?r[0].slice(-1):r[0];return[bV(w),!1,f-t,!1]}let d="["+(u?"^":"")+ZA(r)+"]",p="["+(u?"":"^")+ZA(i)+"]";return[r.length&&i.length?"("+d+"|"+p+")":r.length?d:p,c,f-t,!0]},"parseClass");var ci=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var sn,SV=new Set(["!","?","+","*","@"]),nv=o(n=>SV.has(n),"isExtglobType"),tC=o(n=>nv(n.type),"isExtglobAST"),EV=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),TV=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),xV=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),rC=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),AV="(?!(?:^|/)\\.\\.?(?:$|/))",Kd="(?!\\.)",CV=new Set(["[","."]),IV=new Set(["..","."]),OV=new Set("().*{}+?[]^$\\!"),RV=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),iv="[^/]",nC=iv+"*?",iC=iv+"+?",La=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#v;#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.#v=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.#v+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 sn&&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.#v===0)return!0;let e=this.#c;for(let t=0;t<this.#v;t++){let r=e.#t[t];if(!(r instanceof sn&&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.#v===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new sn(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 w=r,T="";for(;w<e.length;){let S=e.charAt(w++);if(c||S==="\\"){c=!c,T+=S;continue}if(l){w===u+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(w===u+2&&f)&&(l=!1),T+=S;continue}else if(S==="["){l=!0,u=w,f=!1,T+=S;continue}if(!i.noext&&nv(S)&&e.charAt(w)==="("&&s<=a){t.push(T),T="";let F=new sn(S,t);w=sn.#g(e,F,w,i,s+1),t.push(F);continue}T+=S}return t.push(T),w}let h=r+1,d=new sn(null,t),p=[],y="";for(;h<e.length;){let w=e.charAt(h++);if(c||w==="\\"){c=!c,y+=w;continue}if(l){h===u+1?(w==="^"||w==="!")&&(f=!0):w==="]"&&!(h===u+2&&f)&&(l=!1),y+=w;continue}else if(w==="["){l=!0,u=h,f=!1,y+=w;continue}if(nv(w)&&e.charAt(h)==="("&&(s<=a||t&&t.#y(w))){let S=t&&t.#y(w)?0:1;d.push(y),y="";let x=new sn(w,d);d.push(x),h=sn.#g(e,x,h,i,s+S);continue}if(w==="|"){d.push(y),y="",p.push(d),d=new sn(null,t);continue}if(w===")")return y===""&&t.#t.length===0&&(t.#a=!0),d.push(y),y="",t.push(...p,d),h;y+=w}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],h}#h(e){return this.#m(e,TV)}#m(e,t=EV){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=xV){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new sn(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!!rC.get(this.type)?.has(e)}#_(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)}#S(e){let t=rC.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}#w(){if(tC(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.#w(),this.#m(i)?(t=!1,this.#E(i,r)):this.#h(i)?(t=!1,this.#f(i,r)):this.#_(i)&&(t=!1,this.#S(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#w();this.#l=void 0}static fromGlob(e,t={}){let r=new sn(null,void 0,t);return sn.#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.#w(),this.#p()),!tC(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,w,T,S]=typeof p=="string"?sn.#A(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||T,this.#r=this.#r||S,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&IV.has(this.#t[0]))){let y=CV,w=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),T=!t&&!e&&y.has(u.charAt(0));f=w?AV:T?Kd:""}let h="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(h="(?:$|\\/)"),[f+u+h,ci(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,ci(this.toString()),!1,!1]}let a=!r||e||t||!Kd?"":this.#b(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?Kd:"")+iC;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Kd:"")+nC+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,ci(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#A(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+=(OV.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,h,d,p]=eC(e,l);if(d){s+=f,a=a||h,l+=d-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?iC:nC,t=!0;continue}else c=!1;if(u==="?"){s+=iv,t=!0;continue}s+=RV(u)}return[s,ci(e),!!t,a]}};sn=La;var hc=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var pr=o((n,e,t={})=>(Yl(e),!t.nocomment&&e.charAt(0)==="#"?!1:new pn(e,t).match(n)),"minimatch"),PV=/^\*+([^+@!?\*\[\(]*)$/,FV=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),DV=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),NV=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),kV=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),LV=/^\*+\.\*+$/,MV=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),jV=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),$V=/^\.\*+$/,VV=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),UV=/^\*+$/,BV=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),qV=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),WV=/^\?+([^+@!?\*\[\(]*)?$/,GV=o(([n,e=""])=>{let t=cC([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),HV=o(([n,e=""])=>{let t=lC([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),zV=o(([n,e=""])=>{let t=lC([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),QV=o(([n,e=""])=>{let t=cC([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),cC=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),lC=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),uC=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",sC={win32:{sep:"\\"},posix:{sep:"/"}},YV=uC==="win32"?sC.win32.sep:sC.posix.sep;pr.sep=YV;var Rt=Symbol("globstar **");pr.GLOBSTAR=Rt;var KV="[^/]",XV=KV+"*?",JV="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ZV="(?:(?!(?:\\/|^)\\.).)*?",eU=o((n,e={})=>t=>pr(t,n,e),"filter");pr.filter=eU;var Rn=o((n,e={})=>Object.assign({},n,e),"ext"),tU=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return pr;let e=pr;return Object.assign(o((r,i,s={})=>e(r,i,Rn(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,Rn(n,s))}static defaults(i){return e.defaults(Rn(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,Rn(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Rn(n,s))}},unescape:o((r,i={})=>e.unescape(r,Rn(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,Rn(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,Rn(n,i)),"filter"),defaults:o(r=>e.defaults(Rn(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,Rn(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,Rn(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,Rn(n,s)),"match"),sep:e.sep,GLOBSTAR:Rt})},"defaults");pr.defaults=tU;var fC=o((n,e={})=>(Yl(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,oC.default)(n)),"braceExpand");pr.braceExpand=fC;var rU=o((n,e={})=>new pn(n,e).makeRe(),"makeRe");pr.makeRe=rU;var nU=o((n,e,t={})=>{let r=new pn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");pr.match=nU;var aC=/[?*]|[+@!]\(.*?\)|\[|\]/,iU=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),pn=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={}){Yl(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||uC,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]==="?"||!aC.test(s[2]))&&!aC.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]),h=l?3:c?0:void 0,d=f?3:u?0:void 0;if(typeof h=="number"&&typeof d=="number"){let[p,y]=[e[h],t[d]];p.toLowerCase()===y.toLowerCase()&&(t[d]=p,s=d,i=h)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Rt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Rt,s),c=t.lastIndexOf(Rt),[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 x=e.slice(i,i+l.length);if(!this.#r(x,l,r,0,0))return!1;i+=l.length}let h=0;if(f.length){if(f.length+i>e.length)return!1;let x=e.length-f.length;if(this.#r(e,f,r,x,0))h=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(x--,!this.#r(e,f,r,x,0)))return!1;h=f.length+1}}if(!u.length){let x=!!h;for(let F=i;F<e.length-h;F++){let Q=String(e[F]);if(x=!0,Q==="."||Q===".."||!this.options.dot&&Q.startsWith("."))return!1}return r||x}let d=[[[],0]],p=d[0],y=0,w=[0];for(let x of u)x===Rt?(w.push(y),p=[[],0],d.push(p)):(p[0].push(x),y++);let T=d.length-1,S=e.length-h;for(let x of d)x[1]=S-(w[T--]+x[0].length);return!!this.#n(e,d,i,0,r,0,!!h)}#n(e,t,r,i,s,a,c){let l=t[i];if(!l){for(let h=r;h<e.length;h++){c=!0;let d=e[h];if(d==="."||d===".."||!this.options.dot&&d.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 d=e[r];if(d==="."||d===".."||!this.options.dot&&d.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],h=e[a];if(this.debug(t,f,h),f===!1||f===Rt)return!1;let d;if(typeof f=="string"?(d=h===f,this.debug("string match",f,h,d)):(d=f.test(h),this.debug("pattern match",f,h,d)),!d)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 fC(this.pattern,this.options)}parse(e){Yl(e);let t=this.options;if(e==="**")return Rt;if(e==="")return"";let r,i=null;(r=e.match(UV))?i=t.dot?qV:BV:(r=e.match(PV))?i=(t.nocase?t.dot?kV:NV:t.dot?DV:FV)(r[1]):(r=e.match(WV))?i=(t.nocase?t.dot?HV:GV:t.dot?zV:QV)(r):(r=e.match(LV))?i=t.dot?jV:MV:(r=e.match($V))&&(i=VV);let s=La.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?XV:t.dot?JV:ZV,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let h of f.flags.split(""))i.add(h);return typeof f=="string"?iU(f):f===Rt?Rt:f._src});return u.forEach((f,h)=>{let d=u[h+1],p=u[h-1];f!==Rt||p===Rt||(p===void 0?d!==void 0&&d!==Rt?u[h+1]="(?:\\/|"+r+"\\/)?"+d:u[h]=r:d===void 0?u[h-1]=p+"(?:\\/|"+r+")?":d!==Rt&&(u[h-1]=p+"(?:\\/|\\/"+r+"\\/)"+d,u[h+1]=Rt))}),u.filter(f=>f!==Rt).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 pr.defaults(e).Minimatch}};pr.AST=La;pr.Minimatch=pn;pr.escape=hc;pr.unescape=ci;var kC=require("node:url");var dc=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,dC=new Set,sv=typeof process=="object"&&process?process:{},pC=o((n,e,t,r)=>{typeof sv.emitWarning=="function"?sv.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Xd=globalThis.AbortController,hC=globalThis.AbortSignal;if(typeof Xd>"u"){hC=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Xd=class{static{o(this,"AbortController")}constructor(){e()}signal=new hC;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let n=sv.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,pC("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 sU=o(n=>!dC.has(n),"shouldWarn");var Vs=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),mC=o(n=>Vs(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?pc:null:null,"getUintArray"),pc=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},av=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=mC(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]}},Xl=class n{static{o(this,"LRUCache")}#e;#n;#r;#t;#c;#v;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#a;#p;#g;#h;#m;#y;#f;#E;#T;#_;#S;#w;#b;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#a,next:e.#p,prev:e.#g,get head(){return e.#h},get tail(){return e.#m},free:e.#y,isBackgroundFetch:o(t=>e.#d(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.#O(t),"rindexes"),isStale:o(t=>e.#x(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.#v}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:h,noUpdateTTL:d,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:w,fetchMethod:T,memoMethod:S,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:K,ignoreFetchAbort:Te}=e;if(t!==0&&!Vs(t))throw new TypeError("max option must be a nonnegative integer");let H=t?mC(t):Array;if(!H)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=w,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(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#v=S,T!==void 0&&typeof T!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=T,this.#w=!!T,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new H(t),this.#g=new H(t),this.#h=0,this.#m=0,this.#y=av.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#S=!!this.#r,this.#b=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!Q,this.allowStaleOnFetchAbort=!!K,this.ignoreFetchAbort=!!Te,this.maxEntrySize!==0){if(this.#n!==0&&!Vs(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Vs(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#R()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Vs(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Vs(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#A()}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 J="LRU_CACHE_UNBOUNDED";sU(J)&&(dC.add(J),pC("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",J,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#A(){let e=new pc(this.#e),t=new pc(this.#e);this.#_=e,this.#T=t,this.#F=(s,a,c=dc.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#x(s)&&this.#P(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#C=s=>{t[s]=e[s]!==0?dc.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=dc.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.#x=s=>{let a=t[s],c=e[s];return!!c&&!!a&&(r||i())-a>c}}#C=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#x=o(()=>!1,"#isStale");#R(){let e=new pc(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#k=(t,r,i,s)=>{if(this.#d(r))return 0;if(!Vs(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Vs(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");#k=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.#L(t)||((e||!this.#x(t))&&(yield t),t===this.#h));)t=this.#g[t]}*#O({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#h;!(!this.#L(t)||((e||!this.#x(t))&&(yield t),t===this.#m));)t=this.#p[t]}#L(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.#d(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*rentries(){for(let e of this.#O())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#d(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.#d(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#O()){let t=this.#l[e];t!==void 0&&!this.#d(this.#a[e])&&(yield t)}}*values(){for(let e of this.#I())this.#a[e]!==void 0&&!this.#d(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#O())this.#a[e]!==void 0&&!this.#d(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.#d(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.#d(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#O()){let i=this.#a[r],s=this.#d(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#O({allowStale:!0}))this.#x(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#a[t],i=this.#d(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#_&&this.#T){let a=this.#_[t],c=this.#T[t];if(a&&c){let l=a-(dc.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.#d(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(this.#_&&this.#T){a.ttl=this.#_[t];let c=dc.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=dc.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.#k(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let h=this.#i===0?void 0:this.#s.get(e);if(h===void 0)h=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#M(!1):this.#i,this.#l[h]=e,this.#a[h]=t,this.#s.set(e,h),this.#p[this.#m]=h,this.#g[h]=this.#m,this.#m=h,this.#i++,this.#N(h,f,l),l&&(l.set="add"),u=!1;else{this.#V(h);let d=this.#a[h];if(t!==d){if(this.#w&&this.#d(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=d;p!==void 0&&!a&&(this.#S&&this.#r?.(p,e,"set"),this.#b&&this.#f?.push([p,e,"set"]))}else a||(this.#S&&this.#r?.(d,e,"set"),this.#b&&this.#f?.push([d,e,"set"]));if(this.#D(h),this.#N(h,f,l),this.#a[h]=t,l){l.set="replace";let p=d&&this.#d(d)?d.__staleWhileFetching:d;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#_&&this.#A(),this.#_&&(u||this.#F(h,i,s),l&&this.#o(l,h)),!a&&this.#b&&this.#f){let d=this.#f,p;for(;p=d?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#a[this.#h];if(this.#M(!0),this.#d(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.#h,r=this.#l[t],i=this.#a[t];return this.#w&&this.#d(i)?i.__abortController.abort(new Error("evicted")):(this.#S||this.#b)&&(this.#S&&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.#h=this.#m=0,this.#y.length=0):this.#h=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.#d(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#x(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.#x(i))return;let s=this.#a[i];return this.#d(s)?s.__staleWhileFetching:s}#j(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#d(s))return s;let a=new Xd,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((w,T=!1)=>{let{aborted:S}=a.signal,x=r.ignoreFetchAbort&&w!==void 0;if(r.status&&(S&&!T?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,x&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),S&&!x&&!T)return h(a.signal.reason);let F=p;return this.#a[t]===p&&(w===void 0?F.__staleWhileFetching?this.#a[t]=F.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,w,l.options))),w},"cb"),f=o(w=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=w),h(w)),"eb"),h=o(w=>{let{aborted:T}=a.signal,S=T&&r.allowStaleOnFetchAbort,x=S||r.allowStaleOnFetchRejection,F=x||r.noDeleteOnFetchRejection,Q=p;if(this.#a[t]===p&&(!F||Q.__staleWhileFetching===void 0?this.#P(e,"fetch"):S||(this.#a[t]=Q.__staleWhileFetching)),x)return r.status&&Q.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),Q.__staleWhileFetching;if(Q.__returned===Q)throw w},"fetchFail"),d=o((w,T)=>{let S=this.#c?.(e,s,l);S&&S instanceof Promise&&S.then(x=>w(x===void 0?void 0:x),T),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(w(void 0),r.allowStaleOnFetchAbort&&(w=o(x=>u(x,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(d).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}#d(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Xd}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:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:w,forceRefresh:T=!1,status:S,signal:x}=t;if(!this.#w)return S&&(S.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:S});let F={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:S,signal:x},Q=this.#s.get(e);if(Q===void 0){S&&(S.fetch="miss");let K=this.#j(e,Q,F,w);return K.__returned=K}else{let K=this.#a[Q];if(this.#d(K)){let $=r&&K.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",$&&(S.returnedStale=!0)),$?K.__staleWhileFetching:K.__returned=K}let Te=this.#x(Q);if(!T&&!Te)return S&&(S.fetch="hit"),this.#V(Q),i&&this.#C(Q),S&&this.#o(S,Q),K;let H=this.#j(e,Q,F,w),L=H.__staleWhileFetching!==void 0&&r;return S&&(S.fetch=Te?"stale":"refresh",L&&Te&&(S.returnedStale=!0)),L?H.__staleWhileFetching:H.__returned=H}}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.#v;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.#d(l);return a&&this.#o(a,c),this.#x(c)?(a&&(a.get="stale"),u?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#P(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#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.#h?this.#h=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#U(t);else{this.#D(i);let s=this.#a[i];if(this.#d(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#b)&&(this.#S&&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.#h)this.#h=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.#U("delete")}#U(e){for(let t of this.#O({allowStale:!0})){let r=this.#a[t];if(this.#d(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#S&&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.#_&&this.#T&&(this.#_.fill(0),this.#T.fill(0)),this.#E&&this.#E.fill(0),this.#h=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 yc=require("node:path"),xC=require("node:url"),$i=require("fs"),mU=X(require("node:fs"),1),qs=require("node:fs/promises");var ip=require("node:events"),dv=X(require("node:stream"),1),wC=require("node:string_decoder");var gC=typeof process=="object"&&process?process:{stdout:null,stderr:null},aU=o(n=>!!n&&typeof n=="object"&&(n instanceof Bs||n instanceof dv.default||oU(n)||cU(n)),"isStream"),oU=o(n=>!!n&&typeof n=="object"&&n instanceof ip.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==dv.default.Writable.prototype.pipe,"isReadable"),cU=o(n=>!!n&&typeof n=="object"&&n instanceof ip.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),fs=Symbol("EOF"),hs=Symbol("maybeEmitEnd"),Us=Symbol("emittedEnd"),Jd=Symbol("emittingEnd"),Jl=Symbol("emittedError"),Zd=Symbol("closed"),yC=Symbol("read"),ep=Symbol("flush"),vC=Symbol("flushChunk"),li=Symbol("encoding"),mc=Symbol("decoder"),Jt=Symbol("flowing"),Zl=Symbol("paused"),gc=Symbol("resume"),Zt=Symbol("buffer"),Qr=Symbol("pipes"),er=Symbol("bufferLength"),ov=Symbol("bufferPush"),tp=Symbol("bufferShift"),Ir=Symbol("objectMode"),Pt=Symbol("destroyed"),cv=Symbol("error"),lv=Symbol("emitData"),_C=Symbol("emitEnd"),uv=Symbol("emitEnd2"),Mi=Symbol("async"),fv=Symbol("abort"),rp=Symbol("aborted"),eu=Symbol("signal"),Ma=Symbol("dataListeners"),mn=Symbol("discarded"),tu=o(n=>Promise.resolve().then(n),"defer"),lU=o(n=>n(),"nodefer"),uU=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),fU=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),hU=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),np=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[gc](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},hv=class extends np{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)}},dU=o(n=>!!n.objectMode,"isObjectModeOptions"),pU=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Bs=class extends ip.EventEmitter{static{o(this,"Minipass")}[Jt]=!1;[Zl]=!1;[Qr]=[];[Zt]=[];[Ir];[li];[Mi];[mc];[fs]=!1;[Us]=!1;[Jd]=!1;[Zd]=!1;[Jl]=null;[er]=0;[Pt]=!1;[eu];[rp]=!1;[Ma]=0;[mn]=!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");dU(t)?(this[Ir]=!0,this[li]=null):pU(t)?(this[li]=t.encoding,this[Ir]=!1):(this[Ir]=!1,this[li]=null),this[Mi]=!!t.async,this[mc]=this[li]?new wC.StringDecoder(this[li]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[Zt],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[Qr],"get")});let{signal:r}=t;r&&(this[eu]=r,r.aborted?this[fv]():r.addEventListener("abort",()=>this[fv]()))}get bufferLength(){return this[er]}get encoding(){return this[li]}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[Ir]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Mi]}set async(e){this[Mi]=this[Mi]||!!e}[fv](){this[rp]=!0,this.emit("abort",this[eu]?.reason),this.destroy(this[eu]?.reason)}get aborted(){return this[rp]}set aborted(e){}write(e,t,r){if(this[rp])return!1;if(this[fs])throw new Error("write after end");if(this[Pt])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[Mi]?tu:lU;if(!this[Ir]&&!Buffer.isBuffer(e)){if(hU(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(fU(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Ir]?(this[Jt]&&this[er]!==0&&this[ep](!0),this[Jt]?this.emit("data",e):this[ov](e),this[er]!==0&&this.emit("readable"),r&&i(r),this[Jt]):e.length?(typeof e=="string"&&!(t===this[li]&&!this[mc]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[li]&&(e=this[mc].write(e)),this[Jt]&&this[er]!==0&&this[ep](!0),this[Jt]?this.emit("data",e):this[ov](e),this[er]!==0&&this.emit("readable"),r&&i(r),this[Jt]):(this[er]!==0&&this.emit("readable"),r&&i(r),this[Jt])}read(e){if(this[Pt])return null;if(this[mn]=!1,this[er]===0||e===0||e&&e>this[er])return this[hs](),null;this[Ir]&&(e=null),this[Zt].length>1&&!this[Ir]&&(this[Zt]=[this[li]?this[Zt].join(""):Buffer.concat(this[Zt],this[er])]);let t=this[yC](e||null,this[Zt][0]);return this[hs](),t}[yC](e,t){if(this[Ir])this[tp]();else{let r=t;e===r.length||e===null?this[tp]():typeof r=="string"?(this[Zt][0]=r.slice(e),t=r.slice(0,e),this[er]-=e):(this[Zt][0]=r.subarray(e),t=r.subarray(0,e),this[er]-=e)}return this.emit("data",t),!this[Zt].length&&!this[fs]&&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[fs]=!0,this.writable=!1,(this[Jt]||!this[Zl])&&this[hs](),this}[gc](){this[Pt]||(!this[Ma]&&!this[Qr].length&&(this[mn]=!0),this[Zl]=!1,this[Jt]=!0,this.emit("resume"),this[Zt].length?this[ep]():this[fs]?this[hs]():this.emit("drain"))}resume(){return this[gc]()}pause(){this[Jt]=!1,this[Zl]=!0,this[mn]=!1}get destroyed(){return this[Pt]}get flowing(){return this[Jt]}get paused(){return this[Zl]}[ov](e){this[Ir]?this[er]+=1:this[er]+=e.length,this[Zt].push(e)}[tp](){return this[Ir]?this[er]-=1:this[er]-=this[Zt][0].length,this[Zt].shift()}[ep](e=!1){do;while(this[vC](this[tp]())&&this[Zt].length);!e&&!this[Zt].length&&!this[fs]&&this.emit("drain")}[vC](e){return this.emit("data",e),this[Jt]}pipe(e,t){if(this[Pt])return e;this[mn]=!1;let r=this[Us];return t=t||{},e===gC.stdout||e===gC.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[Qr].push(t.proxyErrors?new hv(this,e,t):new np(this,e,t)),this[Mi]?tu(()=>this[gc]()):this[gc]()),e}unpipe(e){let t=this[Qr].find(r=>r.dest===e);t&&(this[Qr].length===1?(this[Jt]&&this[Ma]===0&&(this[Jt]=!1),this[Qr]=[]):this[Qr].splice(this[Qr].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[mn]=!1,this[Ma]++,!this[Qr].length&&!this[Jt]&&this[gc]();else if(e==="readable"&&this[er]!==0)super.emit("readable");else if(uU(e)&&this[Us])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Jl]){let i=t;this[Mi]?tu(()=>i.call(this,this[Jl])):i.call(this,this[Jl])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Ma]=this.listeners("data").length,this[Ma]===0&&!this[mn]&&!this[Qr].length&&(this[Jt]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Ma]=0,!this[mn]&&!this[Qr].length&&(this[Jt]=!1)),t}get emittedEnd(){return this[Us]}[hs](){!this[Jd]&&!this[Us]&&!this[Pt]&&this[Zt].length===0&&this[fs]&&(this[Jd]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Zd]&&this.emit("close"),this[Jd]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Pt&&this[Pt])return!1;if(e==="data")return!this[Ir]&&!r?!1:this[Mi]?(tu(()=>this[lv](r)),!0):this[lv](r);if(e==="end")return this[_C]();if(e==="close"){if(this[Zd]=!0,!this[Us]&&!this[Pt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Jl]=r,super.emit(cv,r);let s=!this[eu]||this.listeners("error").length?super.emit("error",r):!1;return this[hs](),s}else if(e==="resume"){let s=super.emit("resume");return this[hs](),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[hs](),i}[lv](e){for(let r of this[Qr])r.dest.write(e)===!1&&this.pause();let t=this[mn]?!1:super.emit("data",e);return this[hs](),t}[_C](){return this[Us]?!1:(this[Us]=!0,this.readable=!1,this[Mi]?(tu(()=>this[uv]()),!0):this[uv]())}[uv](){if(this[mc]){let t=this[mc].end();if(t){for(let r of this[Qr])r.dest.write(t);this[mn]||super.emit("data",t)}}for(let t of this[Qr])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Ir]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Ir]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Ir])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[li]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Pt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[mn]=!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[fs])return t();let s,a,c=o(h=>{this.off("data",l),this.off("end",u),this.off(Pt,f),t(),a(h)},"onerr"),l=o(h=>{this.off("error",c),this.off("end",u),this.off(Pt,f),this.pause(),s({value:h,done:!!this[fs]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Pt,f),t(),s({done:!0,value:void 0})},"onend"),f=o(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((h,d)=>{a=d,s=h,this.once(Pt,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[mn]=!1;let e=!1,t=o(()=>(this.pause(),this.off(cv,t),this.off(Pt,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(cv,t),this.once(Pt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Pt])return e?this.emit("error",e):this.emit(Pt),this;this[Pt]=!0,this[mn]=!0,this[Zt].length=0,this[er]=0;let t=this;return typeof t.close=="function"&&!this[Zd]&&t.close(),e?this.emit("error",e):this.emit(Pt),this}static get isStream(){return aU}};var gU=$i.realpathSync.native,nu={lstatSync:$i.lstatSync,readdir:$i.readdir,readdirSync:$i.readdirSync,readlinkSync:$i.readlinkSync,realpathSync:gU,promises:{lstat:qs.lstat,readdir:qs.readdir,readlink:qs.readlink,realpath:qs.realpath}},AC=o(n=>!n||n===nu||n===mU?nu:{...nu,...n,promises:{...nu.promises,...n.promises||{}}},"fsFromOption"),CC=/^\\\\\?\\([a-z]:)\\?$/i,yU=o(n=>n.replace(/\//g,"\\").replace(CC,"$1\\"),"uncToDrive"),vU=/[\\\/]/,Fn=0,IC=1,OC=2,ji=4,RC=6,PC=8,ja=10,FC=12,Pn=15,ru=~Pn,pv=16,bC=32,iu=64,ui=128,sp=256,op=512,SC=iu|ui|op,_U=1023,mv=o(n=>n.isFile()?PC:n.isDirectory()?ji:n.isSymbolicLink()?ja:n.isCharacterDevice()?OC:n.isBlockDevice()?RC:n.isSocket()?FC:n.isFIFO()?IC:Fn,"entToType"),EC=new Map,su=o(n=>{let e=EC.get(n);if(e)return e;let t=n.normalize("NFKD");return EC.set(n,t),t},"normalize"),TC=new Map,ap=o(n=>{let e=TC.get(n);if(e)return e;let t=su(n.toLowerCase());return TC.set(n,t),t},"normalizeNocase"),cp=class extends Xl{static{o(this,"ResolveCache")}constructor(){super({max:256})}},gv=class extends Xl{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},DC=Symbol("PathScurry setAsCwd"),Or=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}#v;get gid(){return this.#v}#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}#h;get ctimeMs(){return this.#h}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#_;#S;#w;#b;#A;#C;#o;#F;#x;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Fn,r,i,s,a,c){this.name=e,this.#_=s?ap(e):su(e),this.#o=t&_U,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#w=c.fullpath,this.#A=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=AC(c.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#o&=~pv,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?ap(e):su(e);for(let l of r)if(l.#_===i)return l;let s=this.parent?this.sep:"",a=this.#w?this.#w+s+e:void 0,c=this.newChild(e,Fn,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=ui),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,t=this.parent;if(!t)return this.#A=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.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#w=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&Pn)===Fn}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&Pn)===PC}isDirectory(){return(this.#o&Pn)===ji}isCharacterDevice(){return(this.#o&Pn)===OC}isBlockDevice(){return(this.#o&Pn)===RC}isFIFO(){return(this.#o&Pn)===IC}isSocket(){return(this.#o&Pn)===FC}isSymbolicLink(){return(this.#o&ja)===ja}lstatCached(){return this.#o&bC?this:void 0}readlinkCached(){return this.#x}realpathCached(){return this.#R}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#x)return!0;if(!this.parent)return!1;let e=this.#o&Pn;return!(e!==Fn&&e!==ja||this.#o&sp||this.#o&ui)}calledReaddir(){return!!(this.#o&pv)}isENOENT(){return!!(this.#o&ui)}isNamed(e){return this.nocase?this.#_===ap(e):this.#_===su(e)}async readlink(){let e=this.#x;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.#x=r}catch(t){this.#d(t.code);return}}readlinkSync(){let e=this.#x;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.#x=r}catch(t){this.#d(t.code);return}}#N(e){this.#o|=pv;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#k()}}#k(){this.#o&ui||(this.#o=(this.#o|ui)&ru,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#k()}#O(){this.#o|=op,this.#L()}#L(){if(this.#o&iu)return;let e=this.#o;(e&Pn)===ji&&(e&=ru),this.#o=e|iu,this.#I()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#k():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#k()}#d(e=""){let t=this.#o;t|=sp,e==="ENOENT"&&(t|=ui),(e==="EINVAL"||e==="UNKNOWN")&&(t&=ru),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#$(e,t){return this.#P(e,t)||this.#V(e,t)}#V(e,t){let r=mv(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&Pn;return s!==ji&&s!==ja&&s!==Fn&&(i.#o|=iu),t.unshift(i),t.provisional++,i}#P(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?ap(e.name):su(e.name))===i.#_)return this.#U(e,i,r,t)}}#U(e,t,r,i){let s=t.name;return t.#o=t.#o&ru|mv(e),s!==e.name&&(t.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&ui)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&ui)===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:h,ino:d,mode:p,mtime:y,mtimeMs:w,nlink:T,rdev:S,size:x,uid:F}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#h=u,this.#n=f,this.#v=h,this.#s=d,this.#r=p,this.#f=y,this.#g=w,this.#t=T,this.#i=S,this.#l=x,this.#c=F;let Q=mv(e);this.#o=this.#o&ru|Q|bC,Q!==Fn&&Q!==ji&&Q!==ja&&(this.#o|=iu)}#q=[];#W=!1;#H(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.#H(r.slice(0,r.provisional))})}#B;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.#B)await this.#B;else{let r=o(()=>{},"resolve");this.#B=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.#B=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&SC)return!1;let e=Pn&this.#o;return e===Fn||e===ji||e===ja}shouldWalk(e,t){return(this.#o&ji)===ji&&!(this.#o&SC)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#R)return this.#R;if(!((op|sp|ui)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#R=this.resolve(e)}catch{this.#O()}}realpathSync(){if(this.#R)return this.#R;if(!((op|sp|ui)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#R=this.resolve(e)}catch{this.#O()}}[DC](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.#A=r.join(this.sep),i.#C=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#A=void 0,i.#C=void 0,i=i.parent}},lp=class n extends Or{static{o(this,"PathWin32")}sep="\\";splitSep=vU;constructor(e,t=Fn,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=Fn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return yc.win32.parse(e).root}getRoot(e){if(e=yU(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 vc(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(CC,"$1\\"),e===t}},up=class n extends Or{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=Fn,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=Fn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},fp=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=nu}={}){this.#t=AC(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,xC.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new cp,this.#n=new cp,this.#r=new gv(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,h=t.sep,d=this.rootPath,p=!1;for(let y of l){let w=f--;u=u.child(y,{relative:new Array(w).fill("..").join(h),relativePosix:new Array(w).fill("..").join("/"),fullpath:d+=(p?"":h)+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 Or||(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 Or||(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 Or||(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 Or||(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 Or||(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 Or||(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 Or||(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((h,d)=>{l.add(h),h.readdirCB((p,y)=>{if(p)return d(p);let w=y.length;if(!w)return d();let T=o(()=>{--w===0&&d()},"next");for(let S of y)(!s||s(S))&&c.push(r?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(x=>x?.isUnknown()?x.lstat():x).then(x=>x?.shouldWalk(l,a)?u(x,T):T()):S.shouldWalk(l,a)?u(S,T):T()},!0)},"walk"),f=e;return new Promise((h,d)=>{u(f,p=>{if(p)return d(p);h(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Or||(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 h of f){(!s||s(h))&&c.push(r?h:h.fullpath());let d=h;if(h.isSymbolicLink()){if(!(i&&(d=h.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(l,a)&&l.add(d)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Or||(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 Or||(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 h=f;if(f.isSymbolicLink()){if(!(i&&(h=f.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(c,a)&&c.add(h)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Or||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Bs({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,h=o(()=>{let d=!1;for(;!d;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=o((T,S,x=!1)=>{if(T)return c.emit("error",T);if(i&&!x){let F=[];for(let Q of S)Q.isSymbolicLink()&&F.push(Q.realpath().then(K=>K?.isUnknown()?K.lstat():K));if(F.length){Promise.all(F).then(()=>y(null,S,!0));return}}for(let F of S)F&&(!s||s(F))&&(c.write(r?F:F.fullpath())||(d=!0));f--;for(let F of S){let Q=F.realpathCached()||F;Q.shouldWalk(l,a)&&u.push(Q)}d&&!c.flowing?c.once("drain",h):w||h()},"onReaddir"),w=!0;p.readdirCB(y,!0),w=!1}},"process");return h(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Or||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Bs({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,h=o(()=>{let d=!1;for(;!d;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let w of y)(!s||s(w))&&(c.write(r?w:w.fullpath())||(d=!0));f--;for(let w of y){let T=w;if(w.isSymbolicLink()){if(!(i&&(T=w.realpathSync())))continue;T.isUnknown()&&T.lstatSync()}T.shouldWalk(l,a)&&u.push(T)}}d&&!c.flowing&&c.once("drain",h)},"process");return h(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[DC](t)}},vc=class extends fp{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,yc.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return yc.win32.parse(e).root.toUpperCase()}newRoot(e){return new lp(this.rootPath,ji,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},_c=class extends fp{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,yc.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new up(this.rootPath,ji,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},au=class extends _c{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},dne=process.platform==="win32"?lp:up,NC=process.platform==="win32"?vc:process.platform==="darwin"?au:_c;var wU=o(n=>n.length>=1,"isPatternList"),bU=o(n=>n.length>=1,"isGlobList"),wc=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#v;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!wU(e))throw new TypeError("empty pattern list");if(!bU(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,h,d,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let w=[s,a,c,l,""].join("/"),T=[f,h,d,p,""].join("/");this.#e=[w,...u],this.#n=[T,...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]===Rt}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#v=this.#v||(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 SU=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",bc=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=SU}){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 pn(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 wc(i,s,0,this.platform),c=new pn(a.globString(),this.mmopts),l=s[s.length-1]==="**",u=a.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let a of this.relative)if(a.match(i)||a.match(s))return!0;for(let a of this.absolute)if(a.match(t)||a.match(r))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var yv=class n{static{o(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let r=e.fullpath(),i=this.store.get(r);i?i.add(t.globString()):this.store.set(r,new Set([t.globString()]))}},vv=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)])}},_v=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())}},ou=class n{static{o(this,"Processor")}hasWalkedCache;matches=new vv;subwalks=new _v;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new yv}processPatterns(e,t){this.patterns=t;let r=t.map(i=>[e,i]);for(let[i,s]of r){this.hasWalkedCache.storeWalked(i,s);let a=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(a){i=i.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let h=s.rest();if(h)s=h;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 h=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,h);continue}else if(l===Rt){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let h=u?.pattern(),d=u?.rest();if(!u||(h===""||h===".")&&!d)this.matches.add(i,c,h===""||h===".");else if(h===".."){let p=i.parent||i;d?this.hasWalkedCache.hasWalked(p,d)||this.subwalks.add(p,d):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===Rt?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 EU=o((n,e)=>typeof n=="string"?new bc([n],e):Array.isArray(n)?new bc(n,e):n,"makeIgnore"),hp=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=EU(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 ou(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 ou(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()}},cu=class extends hp{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}},lu=class extends hp{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Bs({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 TU=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",fi=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,kC.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||TU,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"?vc:t.platform==="darwin"?au:t.platform?_c:NC;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 pn(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 wc(l,f,0,this.platform)})}async walk(){return[...await new cu(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 cu(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 lu(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 lu(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 wv=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new pn(t,e).hasMagic())return!0;return!1},"hasMagic");function pp(n,e={}){return new fi(n,e).streamSync()}o(pp,"globStreamSync");function MC(n,e={}){return new fi(n,e).stream()}o(MC,"globStream");function jC(n,e={}){return new fi(n,e).walkSync()}o(jC,"globSync");async function LC(n,e={}){return new fi(n,e).walk()}o(LC,"glob_");function mp(n,e={}){return new fi(n,e).iterateSync()}o(mp,"globIterateSync");function $C(n,e={}){return new fi(n,e).iterate()}o($C,"globIterate");var xU=pp,AU=Object.assign(MC,{sync:pp}),CU=mp,IU=Object.assign($C,{sync:mp}),OU=Object.assign(jC,{stream:pp,iterate:mp}),dp=Object.assign(LC,{glob:LC,globSync:jC,sync:OU,globStream:MC,stream:AU,globStreamSync:pp,streamSync:xU,globIterate:$C,iterate:IU,globIterateSync:mp,iterateSync:CU,Glob:fi,hasMagic:wv,escape:hc,unescape:ci});dp.glob=dp;var $a=X(Ht());var Ft=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await Wt.default.pathExists(t))throw new $a.FileNotFoundError(e);return Wt.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return Wt.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 Wt.default.pathExists(r))throw new $a.FileAlreadyExistsError(e);return await Wt.default.ensureDir(Ws.default.dirname(r)),await Wt.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await Wt.default.pathExists(r))throw new $a.FileNotFoundError(e);await Wt.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await Wt.default.ensureDir(Ws.default.dirname(r)),await Wt.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await Wt.default.pathExists(t))throw new $a.FileNotFoundError(e);await Wt.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await Wt.default.pathExists(r))throw new $a.FileNotFoundError(e);await Wt.default.ensureDir(Ws.default.dirname(i)),await Wt.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await Wt.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await Wt.default.pathExists(t)?(await Wt.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=Ws.default.join(t,"**/*.md");return(await dp(r,{nodir:!0})).map(a=>Ws.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 Ws.default.isAbsolute(e)?e:Ws.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=hr.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 uu=X(require("path")),bv=X(Ms());var Sc=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!uu.default.isAbsolute(e))return uu.default.resolve(this.vaultRoot,e);let t=uu.default.resolve(e),r=uu.default.resolve(this.vaultRoot);if(!t.startsWith(r))throw new He(`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(!bv.default.existsSync(e))throw new Nl(e);if(!bv.default.statSync(e).isFile())throw new He(`Not a file: ${e}`,"Provide a path to a file, not a directory.",{filepath:e});if(!e.endsWith(".md"))throw new He(`Not a Markdown file: ${e}`,"Provide a path to a .md file.",{filepath:e})}getVaultRoot(){return this.vaultRoot}};var GC=X(Ht());var VC=X(Ht());var hi=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 VC.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(`
|
|
538
538
|
`).filter(i=>i.trim()).map(i=>i.replace(/^\s*-\s*/,"").trim()):[]}};var fu=class extends hi{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){V.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){V.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){V.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){V.handle(t)}}async executeMoveToBacklog(e){try{await this.updateStatus(e,"ems__EffortStatusBacklog","Backlog"),process.exit(0)}catch(t){V.handle(t)}}async executeMoveToAnalysis(e){try{await this.updateStatus(e,"ems__EffortStatusAnalysis","Analysis"),process.exit(0)}catch(t){V.handle(t)}}async executeMoveToToDo(e){try{await this.updateStatus(e,"ems__EffortStatusToDo","ToDo"),process.exit(0)}catch(t){V.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 mr=[];for(let n=0;n<256;++n)mr.push((n+256).toString(16).slice(1));function UC(n,e=0){return(mr[n[e+0]]+mr[n[e+1]]+mr[n[e+2]]+mr[n[e+3]]+"-"+mr[n[e+4]]+mr[n[e+5]]+"-"+mr[n[e+6]]+mr[n[e+7]]+"-"+mr[n[e+8]]+mr[n[e+9]]+"-"+mr[n[e+10]]+mr[n[e+11]]+mr[n[e+12]]+mr[n[e+13]]+mr[n[e+14]]+mr[n[e+15]]).toLowerCase()}o(UC,"unsafeStringify");var BC=require("node:crypto");var yp=new Uint8Array(256),gp=yp.length;function Sv(){return gp>yp.length-16&&((0,BC.randomFillSync)(yp),gp=0),yp.slice(gp,gp+=16)}o(Sv,"rng");var qC=require("node:crypto"),Ev={randomUUID:qC.randomUUID};function PU(n,e,t){n=n||{};let r=n.random??n.rng?.()??Sv();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 UC(r)}o(PU,"_v4");function FU(n,e,t){return Ev.randomUUID&&!e&&!n?Ev.randomUUID():PU(n,e,t)}o(FU,"v4");var hu=FU;var Ec=X(Ht());var du=class extends hi{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){V.handle(i)}}async executeCreateMeeting(e,t,r={}){try{await this.createAsset(e,t,"ems__Meeting",r),process.exit(0)}catch(i){V.handle(i)}}async executeCreateProject(e,t,r={}){try{await this.createAsset(e,t,"ems__Project",r),process.exit(0)}catch(i){V.handle(i)}}async executeCreateArea(e,t,r={}){try{await this.createAsset(e,t,"ems__Area",r),process.exit(0)}catch(i){V.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 Ec.FileAlreadyExistsError(e);let l=hu(),u=this.buildAssetFrontmatter(r,l,s,i),f=Ec.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=Ec.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.ems__Effort_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 Tv=X(require("path"));var WC=X(Ht());var pu=class extends hi{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=Tv.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),h=u;f||(h=this.frontmatterService.updateProperty(u,"aliases",`
|
|
539
539
|
- ${i}`)),await this.fsAdapter.updateFile(t,h),console.log(` Updated label: "${i}"`)}let a=Tv.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){V.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",`
|
|
540
540
|
- ${r}`):a=this.frontmatterService.updateProperty(a,"aliases",`${l.map(u=>`
|
|
541
541
|
- ${u}`).join("")}
|
|
542
542
|
- ${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(`
|
|
543
|
-
\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){V.handle(r)}}async executeSchedule(e,t){try{await this.updatePlannedTimestamp(e,t,"ems__Effort_plannedStartTimestamp"),process.exit(0)}catch(r){V.handle(r)}}async executeSetDeadline(e,t){try{await this.updatePlannedTimestamp(e,t,"ems__Effort_plannedEndTimestamp"),process.exit(0)}catch(r){V.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=WC.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
|
|
544
|
-
\u{1F4A1} Run without --dry-run to apply changes`),process.exit(0),{moved:!1,oldPath:t,newPath:w,expectedFolder:l}}let h=
|
|
545
|
-
\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){V.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 gr(n,e,t,r,i){if(n==="json"){let s={command:e,filepath:t,action:r,...i&&{changes:i}},a=ce.success(s);console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 ${r}`)}o(gr,"outputResult");function Va(n,e,t,r){let i=new He(`--${e} option is required for ${t} command`,r,{command:t,missingOption:e});V.handle(i)}o(Va,"handleMissingOption");function zC(){return new Ge("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";V.setFormat(r);try{let i=(0,HC.resolve)(t.vault),s=new vp(i,t.dryRun);switch(n){case"rename-to-uid":await s.executeRenameToUid(e),gr(r,n,e,"Renamed file to UID-based name");break;case"update-label":t.label||Va(r,"label","update-label",'exocortex command update-label <filepath> --label "<value>"'),await s.executeUpdateLabel(e,t.label),gr(r,n,e,`Updated label to "${t.label}"`,{label:t.label});break;case"start":await s.executeStart(e),gr(r,n,e,"Started task");break;case"complete":await s.executeComplete(e),gr(r,n,e,"Completed task");break;case"trash":await s.executeTrash(e),gr(r,n,e,"Moved task to trash");break;case"archive":await s.executeArchive(e),gr(r,n,e,"Archived task");break;case"move-to-backlog":await s.executeMoveToBacklog(e),gr(r,n,e,"Moved task to backlog");break;case"move-to-analysis":await s.executeMoveToAnalysis(e),gr(r,n,e,"Moved task to analysis");break;case"move-to-todo":await s.executeMoveToToDo(e),gr(r,n,e,"Moved task to todo");break;case"create-task":t.label||Va(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}),gr(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||Va(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}),gr(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||Va(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}),gr(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||Va(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}),gr(r,n,e,`Created area "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"schedule":t.date||Va(r,"date","schedule",'exocortex command schedule <filepath> --date "YYYY-MM-DD"'),await s.executeSchedule(e,t.date),gr(r,n,e,`Scheduled task for ${t.date}`,{date:t.date});break;case"set-deadline":t.date||Va(r,"date","set-deadline",'exocortex command set-deadline <filepath> --date "YYYY-MM-DD"'),await s.executeSetDeadline(e,t.date),gr(r,n,e,`Set deadline to ${t.date}`,{date:t.date});break;case"repair-folder":{let a=await s.executeRepairFolder(e);gr(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),gr(r,n,e,`Executed ${n}`);break}}catch(i){V.handle(i)}})}o(zC,"commandCommand");var YC=require("path");var ds=X(require("fs")),xv=X(require("path")),QC=require("events");var DU={watch:ds.default.watch.bind(ds.default),existsSync:ds.default.existsSync.bind(ds.default),statSync:ds.default.statSync.bind(ds.default),readFileSync:ds.default.readFileSync.bind(ds.default)},_p=class extends QC.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=xv.default.resolve(t),this.fsAdapter=r.fsAdapter??DU,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=xv.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?pr(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 Av=X(require("fs"));function KC(){return new Ge("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=>{V.setFormat("json");try{let e=(0,YC.resolve)(n.vault);if(!Av.default.existsSync(e))throw new Be(e);if(!Av.default.statSync(e).isDirectory())throw new He(`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 He("--debounce must be a non-negative integer","Use a positive integer value for debounce",{debounce:n.debounce});let r=new _p(e,{pattern:n.pattern,assetType:n.assetType,debounceMs:t});r.on("change",s=>{console.log(JSON.stringify(s))}),r.on("error",s=>{let a=ce.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){V.handle(e)}})}o(KC,"watchCommand");var Iv=require("path"),Ov=X(Ls());var Ua=X(require("path"));var Tc=X(Ht());var di=X(Ls()),Cv=X(require("crypto"));var wp=class{constructor(){this.backups=new Map;this.fileHashes=new Map}static{o(this,"TransactionManager")}async begin(e){if(!di.default.existsSync(e))throw new Error(`Cannot backup non-existent file: ${e}`);let t=await di.default.readFile(e,"utf-8"),r=Cv.default.createHash("sha256").update(t).digest("hex");this.fileHashes.set(e,r);let i=`${e}.backup.${Date.now()}`;await di.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(!di.default.existsSync(e))return!1;let r=await di.default.readFile(e,"utf-8");return Cv.default.createHash("sha256").update(r).digest("hex")===t}async commit(){for(let e of this.backups.values())di.default.existsSync(e)&&await di.default.remove(e);this.backups.clear(),this.fileHashes.clear()}async rollback(){for(let[e,t]of this.backups.entries())di.default.existsSync(t)&&(await di.default.copy(t,e,{overwrite:!0}),await di.default.remove(t));this.backups.clear(),this.fileHashes.clear()}getTrackedFiles(){return Array.from(this.backups.keys())}};var Ba=class{static{o(this,"BatchExecutor")}constructor(e,t=!1){this.pathResolver=new Sc(e),this.fsAdapter=new Ft(e),this.frontmatterService=new Tc.FrontmatterService,this.transactionManager=new wp,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 h=f;h<e.length;h++)i.push({success:!1,command:e[h].command,filepath:e[h].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 He("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 He('Each operation must have a "command" string property','{"command":"start","filepath":"task.md"}');if(!r.filepath||typeof r.filepath!="string")throw new He('Each operation must have a "filepath" string property','{"command":"start","filepath":"task.md"}')}return t}catch(t){throw t instanceof He?t:new He(`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 Tc.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=Tc.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=Tc.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=Ua.default.dirname(a),l=c==="."?"":c,u=Ua.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 h=Ua.default.basename(e),d=l?`${l}/${h}`:h;return await this.fsAdapter.fileExists(d)?{success:!1,command:t.command,filepath:t.filepath,error:`Cannot move file: ${d} already exists`}:(await this.fsAdapter.renameFile(e,d),{success:!0,command:t.command,filepath:t.filepath,action:`Moved to ${l||"(root)"}`,changes:{moved:!0,oldPath:e,newPath:d,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=Ua.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 h=Ua.default.basename(f,".md"),d=Ua.default.basename(r,".md");return h===d})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};function NU(n,e){if(n==="json"){let t=ce.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
|
|
543
|
+
\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){V.handle(r)}}async executeSchedule(e,t){try{await this.updatePlannedTimestamp(e,t,"ems__Effort_plannedStartTimestamp"),process.exit(0)}catch(r){V.handle(r)}}async executeSetDeadline(e,t){try{await this.updatePlannedTimestamp(e,t,"ems__Effort_plannedEndTimestamp"),process.exit(0)}catch(r){V.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=WC.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 Gs=X(require("path"));var mu=class extends hi{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=Gs.default.dirname(a),l=c==="."?"":c,u=Gs.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=Gs.default.basename(t),w=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: ${w}`),console.log(`
|
|
544
|
+
\u{1F4A1} Run without --dry-run to apply changes`),process.exit(0),{moved:!1,oldPath:t,newPath:w,expectedFolder:l}}let h=Gs.default.basename(t),d=l?`${l}/${h}`:h;if(await this.fsAdapter.fileExists(d))throw new Error(`Cannot move file: ${d} already exists`);return l&&(await this.fsAdapter.directoryExists(l)||await this.fsAdapter.createDirectory(l)),await this.fsAdapter.renameFile(t,d),console.log("\u2705 Moved to correct folder"),console.log(` Old path: ${t}`),console.log(` New path: ${d}`),console.log(` Expected folder: ${l||"(root)"}`),process.exit(0),{moved:!0,oldPath:t,newPath:d,expectedFolder:l}}catch(t){V.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=Gs.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 h=Gs.default.basename(f,".md"),d=Gs.default.basename(r,".md");return h===d})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};var vp=class{static{o(this,"CommandExecutor")}constructor(e,t=!1){this.context={pathResolver:new Sc(e),fsAdapter:new Ft(e),frontmatterService:new GC.FrontmatterService,dryRun:t},this.statusExecutor=new fu(this.context),this.creationExecutor=new du(this.context),this.propertyExecutor=new pu(this.context),this.folderRepairExecutor=new mu(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(`
|
|
545
|
+
\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){V.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 gr(n,e,t,r,i){if(n==="json"){let s={command:e,filepath:t,action:r,...i&&{changes:i}},a=ce.success(s);console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 ${r}`)}o(gr,"outputResult");function Va(n,e,t,r){let i=new He(`--${e} option is required for ${t} command`,r,{command:t,missingOption:e});V.handle(i)}o(Va,"handleMissingOption");function zC(){return new Ge("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";V.setFormat(r);try{let i=(0,HC.resolve)(t.vault),s=new vp(i,t.dryRun);switch(n){case"rename-to-uid":await s.executeRenameToUid(e),gr(r,n,e,"Renamed file to UID-based name");break;case"update-label":t.label||Va(r,"label","update-label",'exocortex command update-label <filepath> --label "<value>"'),await s.executeUpdateLabel(e,t.label),gr(r,n,e,`Updated label to "${t.label}"`,{label:t.label});break;case"start":await s.executeStart(e),gr(r,n,e,"Started task");break;case"complete":await s.executeComplete(e),gr(r,n,e,"Completed task");break;case"trash":await s.executeTrash(e),gr(r,n,e,"Moved task to trash");break;case"archive":await s.executeArchive(e),gr(r,n,e,"Archived task");break;case"move-to-backlog":await s.executeMoveToBacklog(e),gr(r,n,e,"Moved task to backlog");break;case"move-to-analysis":await s.executeMoveToAnalysis(e),gr(r,n,e,"Moved task to analysis");break;case"move-to-todo":await s.executeMoveToToDo(e),gr(r,n,e,"Moved task to todo");break;case"create-task":t.label||Va(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}),gr(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||Va(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}),gr(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||Va(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}),gr(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||Va(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}),gr(r,n,e,`Created area "${t.label}"`,{label:t.label,prototype:t.prototype,area:t.area,parent:t.parent});break;case"schedule":t.date||Va(r,"date","schedule",'exocortex command schedule <filepath> --date "YYYY-MM-DD"'),await s.executeSchedule(e,t.date),gr(r,n,e,`Scheduled task for ${t.date}`,{date:t.date});break;case"set-deadline":t.date||Va(r,"date","set-deadline",'exocortex command set-deadline <filepath> --date "YYYY-MM-DD"'),await s.executeSetDeadline(e,t.date),gr(r,n,e,`Set deadline to ${t.date}`,{date:t.date});break;case"repair-folder":{let a=await s.executeRepairFolder(e);gr(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),gr(r,n,e,`Executed ${n}`);break}}catch(i){V.handle(i)}})}o(zC,"commandCommand");var YC=require("path");var ds=X(require("fs")),xv=X(require("path")),QC=require("events");var DU={watch:ds.default.watch.bind(ds.default),existsSync:ds.default.existsSync.bind(ds.default),statSync:ds.default.statSync.bind(ds.default),readFileSync:ds.default.readFileSync.bind(ds.default)},_p=class extends QC.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=xv.default.resolve(t),this.fsAdapter=r.fsAdapter??DU,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=xv.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?pr(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 Av=X(require("fs"));function KC(){return new Ge("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=>{V.setFormat("json");try{let e=(0,YC.resolve)(n.vault);if(!Av.default.existsSync(e))throw new Be(e);if(!Av.default.statSync(e).isDirectory())throw new He(`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 He("--debounce must be a non-negative integer","Use a positive integer value for debounce",{debounce:n.debounce});let r=new _p(e,{pattern:n.pattern,assetType:n.assetType,debounceMs:t});r.on("change",s=>{console.log(JSON.stringify(s))}),r.on("error",s=>{let a=ce.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){V.handle(e)}})}o(KC,"watchCommand");var Iv=require("path"),Ov=X(Ms());var Ua=X(require("path"));var Tc=X(Ht());var di=X(Ms()),Cv=X(require("crypto"));var wp=class{constructor(){this.backups=new Map;this.fileHashes=new Map}static{o(this,"TransactionManager")}async begin(e){if(!di.default.existsSync(e))throw new Error(`Cannot backup non-existent file: ${e}`);let t=await di.default.readFile(e,"utf-8"),r=Cv.default.createHash("sha256").update(t).digest("hex");this.fileHashes.set(e,r);let i=`${e}.backup.${Date.now()}`;await di.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(!di.default.existsSync(e))return!1;let r=await di.default.readFile(e,"utf-8");return Cv.default.createHash("sha256").update(r).digest("hex")===t}async commit(){for(let e of this.backups.values())di.default.existsSync(e)&&await di.default.remove(e);this.backups.clear(),this.fileHashes.clear()}async rollback(){for(let[e,t]of this.backups.entries())di.default.existsSync(t)&&(await di.default.copy(t,e,{overwrite:!0}),await di.default.remove(t));this.backups.clear(),this.fileHashes.clear()}getTrackedFiles(){return Array.from(this.backups.keys())}};var Ba=class{static{o(this,"BatchExecutor")}constructor(e,t=!1){this.pathResolver=new Sc(e),this.fsAdapter=new Ft(e),this.frontmatterService=new Tc.FrontmatterService,this.transactionManager=new wp,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 h=f;h<e.length;h++)i.push({success:!1,command:e[h].command,filepath:e[h].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 He("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 He('Each operation must have a "command" string property','{"command":"start","filepath":"task.md"}');if(!r.filepath||typeof r.filepath!="string")throw new He('Each operation must have a "filepath" string property','{"command":"start","filepath":"task.md"}')}return t}catch(t){throw t instanceof He?t:new He(`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 Tc.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=Tc.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=Tc.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=Ua.default.dirname(a),l=c==="."?"":c,u=Ua.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 h=Ua.default.basename(e),d=l?`${l}/${h}`:h;return await this.fsAdapter.fileExists(d)?{success:!1,command:t.command,filepath:t.filepath,error:`Cannot move file: ${d} already exists`}:(await this.fsAdapter.renameFile(e,d),{success:!0,command:t.command,filepath:t.filepath,action:`Moved to ${l||"(root)"}`,changes:{moved:!0,oldPath:e,newPath:d,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=Ua.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 h=Ua.default.basename(f,".md"),d=Ua.default.basename(r,".md");return h===d})||null}normalizePath(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}};function NU(n,e){if(n==="json"){let t=ce.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
|
|
546
546
|
\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(`
|
|
547
547
|
\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(`
|
|
548
548
|
\u{1F4CB} Successful Operations:`);for(let t of e.results.filter(r=>r.success))console.log(` \u2705 ${t.command} ${t.filepath}: ${t.action}`)}}}o(NU,"outputResult");function XC(){return new Ge("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";V.setFormat(e);try{let t=(0,Iv.resolve)(n.vault),r;if(n.input)r=n.input;else if(n.file){let c=(0,Iv.resolve)(n.file);if(!Ov.default.existsSync(c))throw new He(`Batch file not found: ${c}`,"exocortex batch --file operations.json");r=await Ov.default.readFile(c,"utf-8")}else throw new He("Either --input or --file option is required",`exocortex batch --input '[{"command":"start","filepath":"task.md"}]' or exocortex batch --file operations.json`);let i=Ba.parseInput(r);if(i.length===0)throw new He("Batch input contains no operations",`exocortex batch --input '[{"command":"start","filepath":"task.md"}]'`);let a=await new Ba(t,n.dryRun).executeBatch(i,n.atomic);NU(e,a),process.exit(a.success?0:5)}catch(t){V.handle(t)}})}o(XC,"batchCommand");var JC=require("path");function kU(n,e){if(n==="json"){let t=ce.success(e,{durationMs:e.durationMs,itemCount:e.total});console.log(JSON.stringify(t,null,2))}else{if(console.log(`
|
|
@@ -550,17 +550,17 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
550
550
|
\u{1F4CB} Failed Files:`);for(let t of e.results.filter(r=>!r.success))console.log(` \u274C ${t.filepath}: ${t.error}`)}if(e.movedCount>0&&n==="text"){console.log(`
|
|
551
551
|
\u{1F4CB} Moved Files:`);for(let t of e.results.filter(r=>r.success&&r.changes?.moved))console.log(` \u{1F4C1} ${t.filepath} \u2192 ${t.changes?.newPath}`)}}}o(kU,"outputResult");function ZC(){return new Ge("batch-repair").description("Batch repair folder locations for all markdown files in a directory").argument("<directory>","Directory to process (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--dry-run","Preview changes without modifying files").option("--format <type>","Output format: text|json (default: text)","text").option("--progress","Show progress during processing (default: true)",!0).option("--no-progress","Disable progress output").action(async(n,e)=>{let t=e.format||"text";V.setFormat(t);try{let r=(0,JC.resolve)(e.vault),i=new Ft(r),s=n;if(!await i.directoryExists(s))throw new He(`Directory not found: ${s}`,"exocortex batch-repair <existing-directory>");let c=await i.getMarkdownFiles(s);if(c.length===0){if(t==="json"){let S=ce.success({success:!0,total:0,movedCount:0,alreadyCorrectCount:0,errorCount:0,results:[],durationMs:0,atomic:!1});console.log(JSON.stringify(S,null,2))}else console.log(`
|
|
552
552
|
\u{1F4C2} No markdown files found in ${s}`);process.exit(0)}let l=c.map(S=>({command:"repair-folder",filepath:S})),u=e.progress!==!1&&t==="text",f=0;u&&console.log(`
|
|
553
|
-
\u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Ba(r,e.dryRun).executeBatch(l,!1),p=0,y=0,w=0;for(let S of d.results)if(S.success?S.changes?.moved?p++:y++:w++,u&&!e.dryRun){f++;let
|
|
553
|
+
\u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Ba(r,e.dryRun).executeBatch(l,!1),p=0,y=0,w=0;for(let S of d.results)if(S.success?S.changes?.moved?p++:y++:w++,u&&!e.dryRun){f++;let x=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${x}%)...`)}u&&process.stdout.write("\r"+" ".repeat(60)+"\r");let T={...d,movedCount:p,alreadyCorrectCount:y,errorCount:w};kU(t,T),process.exit(T.success?0:5)}catch(r){V.handle(r)}})}o(ZC,"batchRepairCommand");var bp=require("fs"),pi=require("path");function eI(){return new Ge("resolve").description("Resolve UUID to file path").argument("<uuid>","Full or partial UUID to resolve").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: uri|path|json (default: uri)","uri").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--partial","Match partial UUIDs (returns all matches)").action(async(n,e)=>{let t=e.output||"text";V.setFormat(t);try{let r=Date.now();if(!LU(n))throw new He(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,pi.resolve)(e.vault);if(!(0,bp.existsSync)(i))throw new Be(i);let s=MU(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=ce.error("VALIDATION_FILE_NOT_FOUND",`UUID not found: ${n}`,3,{context:{uuid:n}});console.log(JSON.stringify(c,null,2))}else console.error(`UUID not found: ${n}`);process.exit(1)}e.partial||s.length>1?$U(s,i,e.format,t,n,a):jU(s[0],i,e.format,t,n,a)}catch(r){V.handle(r)}})}o(eI,"resolveCommand");function LU(n){if(n.length<4)return!1;let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,t=/^[0-9a-f-]+$/i;return e.test(n)||t.test(n)}o(LU,"isValidUuidFormat");function MU(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,bp.readdirSync)(a,{withFileTypes:!0});for(let l of c){let u=(0,pi.join)(a,l.name);if(l.isDirectory())!l.name.startsWith(".")&&l.name!=="node_modules"&&s(u);else if(l.isFile()&&l.name.endsWith(".md")){let f=l.name.toLowerCase();t?f.includes(i)&&r.push(u):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&r.push(u)}}}return o(s,"walk"),s(n),r}o(MU,"findFilesWithUuid");function tI(n){return`obsidian://vault/${encodeURI(n)}`}o(tI,"pathToObsidianUri");function rI(n){let e=n.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);return e?e[1]:(0,pi.basename)(n,".md")}o(rI,"extractUuidFromFilename");function jU(n,e,t,r,i,s){let a=(0,pi.relative)(e,n),c=tI(a),l=rI((0,pi.basename)(n));if(r==="json"){let u={uuid:l,path:a,absolutePath:n,uri:c},f=ce.success(u,{durationMs:s,searchUuid:i});console.log(JSON.stringify(f,null,2))}else switch(t){case"path":console.log(n);break;case"json":console.log(JSON.stringify({uuid:l,path:a,absolutePath:n,uri:c},null,2));break;case"uri":default:console.log(c);break}}o(jU,"outputSingleResult");function $U(n,e,t,r,i,s){let a=n.map(c=>{let l=(0,pi.relative)(e,c),u=tI(l);return{uuid:rI((0,pi.basename)(c)),path:l,absolutePath:c,uri:u}});if(r==="json"){let c=ce.success({matches:a,count:a.length},{durationMs:s,searchUuid:i,itemCount:a.length});console.log(JSON.stringify(c,null,2))}else switch(t){case"path":for(let c of a)console.log(c.absolutePath);break;case"json":console.log(JSON.stringify(a,null,2));break;case"uri":default:for(let c of a)console.log(c.uri);break}}o($U,"outputMultipleResults");var nI=require("fs"),iI=require("path"),an=X(Ht());function sI(){return new Ge("ask").description("Ask a question in natural language about your vault").argument("<question>","Question in natural language (Russian or English)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--show-query","Show the generated SPARQL query").option("--explain","Show explanation of the query conversion").action(async(n,e)=>{let t=e.output||"text";V.setFormat(t);try{let r=Date.now(),i=(0,iI.resolve)(e.vault);if(!(0,nI.existsSync)(i))throw new Be(i);let s=new an.NLToSPARQLService;t==="text"&&console.log(`\u{1F9E0} Analyzing question: "${n}"
|
|
554
554
|
`);let a=s.convert(n);e.showQuery&&t==="text"&&(console.log("\u{1F4DD} Generated SPARQL Query:"),console.log("\u2500".repeat(50)),console.log(a.query),console.log("\u2500".repeat(50)),console.log()),e.explain&&t==="text"&&(console.log(`\u{1F4D6} Explanation: ${a.explanation}`),console.log(`\u{1F3AF} Confidence: ${(a.confidence*100).toFixed(0)}%`),a.templateName&&console.log(`\u{1F4CB} Template: ${a.templateName}`),a.isFallback&&console.log("\u26A0\uFE0F Using fallback generic search query"),console.log()),t==="text"&&console.log(`\u{1F4E6} Loading vault: ${i}...`);let c=Date.now(),l=new nn(i),f=await new an.NoteToRDFConverter(l).convertVault(),h=new an.InMemoryTripleStore;await h.addAll(f);let d=Date.now()-c;t==="text"&&console.log(`\u2705 Loaded ${f.length} triples in ${d}ms
|
|
555
|
-
`);let p=a.query;p=Qd(p),p=zd(p);let y=new an.SPARQLParser,w=Hl(Gl(i));w.size>0&&y.setVaultPrefixes(w);let T=y.parse(p),
|
|
555
|
+
`);let p=a.query;p=Qd(p),p=zd(p);let y=new an.SPARQLParser,w=Hl(Gl(i));w.size>0&&y.setVaultPrefixes(w);let T=y.parse(p),x=new an.AlgebraTranslator().translate(T);x=new an.AlgebraOptimizer().optimize(x);let Q=Date.now(),Te=await new an.QueryExecutor(h).executeAll(x),H=Date.now()-Q,J=Date.now()-r,L=s.getSuggestions(n);if(t==="json"){let $=Te.map(et=>et.toJSON()),Z={question:n,query:a.query,template:a.templateName,parameters:a.parameters,confidence:a.confidence,explanation:a.explanation,count:Te.length,bindings:$,suggestions:L.length>0?L:void 0},qe=ce.success(Z,{durationMs:J,itemCount:Te.length,loadDurationMs:d,execDurationMs:H,triplesScanned:f.length});console.log(JSON.stringify(qe,null,2))}else{if(console.log(`\u2705 Found ${Te.length} result(s) in ${H}ms
|
|
556
556
|
`),Te.length>0?VU(Te,e.format):console.log("No results found."),L.length>0){console.log(`
|
|
557
557
|
\u{1F4A1} Suggestions:`);for(let $ of L)console.log(` \u2022 ${$}`)}if(a.confidence<.6&&a.alternatives.length>0){console.log(`
|
|
558
558
|
\u{1F504} Alternative queries that might work better:`);for(let $=0;$<Math.min(2,a.alternatives.length);$++)console.log(` ${$+1}. ${a.alternatives[$].split(`
|
|
559
|
-
`).slice(-3)[0]?.trim()||"..."}`)}}}catch(r){V.handle(r)}})}o(sI,"askCommand");function VU(n,e){let t=n;switch(e){case"json":let r=new ic;console.log(r.format(t));break;case"table":default:let i=new nc;console.log(i.format(t));break}}o(VU,"formatResults");var Ac=require("path"),Cc=require("fs"),qa=X(Ue()),
|
|
559
|
+
`).slice(-3)[0]?.trim()||"..."}`)}}}catch(r){V.handle(r)}})}o(sI,"askCommand");function VU(n,e){let t=n;switch(e){case"json":let r=new ic;console.log(r.format(t));break;case"table":default:let i=new nc;console.log(i.format(t));break}}o(VU,"formatResults");var Ac=require("path"),Cc=require("fs"),qa=X(Ue()),Hs=X(Ht());var gae=X(Vu()),xc=X(Ue()),gu=X(Ht());var Sp=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 Ep=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 xp=X(require("fs/promises")),aI=X(require("path")),oI=X(require("os"));var Tp=class{constructor(e=".exocortexrc"){this.config={};this.configPath=aI.join(oI.homedir(),e)}static{o(this,"NodeConfiguration")}async load(){try{let e=await xp.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 xp.writeFile(this.configPath,JSON.stringify(this.config,null,2),"utf-8")}};var cI=X(require("readline"));var Ap=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=cI.createInterface({input:process.stdin,output:process.stdout});return new Promise(i=>{r.question(`${e}
|
|
560
560
|
${t}
|
|
561
|
-
Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes")})})}};var Cp=class{static{o(this,"CLIContainer")}static setup(){xc.container.register(gu.DI_TOKENS.ILogger,{useFactory:o(()=>new Sp("exocortex-cli"),"useFactory")}),xc.container.register(gu.DI_TOKENS.IEventBus,{useClass:Ep}),xc.container.register(gu.DI_TOKENS.IConfiguration,{useClass:Tp}),xc.container.register(gu.DI_TOKENS.INotificationService,{useClass:Ap})}static reset(){xc.container.clearInstances()}};function yu(n){Cp.setup(),qa.container.register(
|
|
561
|
+
Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes")})})}};var Cp=class{static{o(this,"CLIContainer")}static setup(){xc.container.register(gu.DI_TOKENS.ILogger,{useFactory:o(()=>new Sp("exocortex-cli"),"useFactory")}),xc.container.register(gu.DI_TOKENS.IEventBus,{useClass:Ep}),xc.container.register(gu.DI_TOKENS.IConfiguration,{useClass:Tp}),xc.container.register(gu.DI_TOKENS.INotificationService,{useClass:Ap})}static reset(){xc.container.clearInstances()}};function yu(n){Cp.setup(),qa.container.register(Hs.DI_TOKENS.IVaultAdapter,{useFactory:o(()=>new nn(n),"useFactory")})}o(yu,"setupContainer");function UU(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(`
|
|
562
562
|
`)}o(UU,"formatPractices");function BU(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(`
|
|
563
|
-
`)}o(BU,"formatSummary");function lI(){let n=new Ge("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";V.setFormat(t);try{let r=(0,Ac.resolve)(e.vault);if(!(0,Cc.existsSync)(r))throw new Be(r);yu(r);let s=await qa.container.resolve(
|
|
563
|
+
`)}o(BU,"formatSummary");function lI(){let n=new Ge("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";V.setFormat(t);try{let r=(0,Ac.resolve)(e.vault);if(!(0,Cc.existsSync)(r))throw new Be(r);yu(r);let s=await qa.container.resolve(Hs.DailyReviewService).getPractices();if(t==="json"){let a=ce.success({practices:s,count:s.length});console.log(JSON.stringify(a,null,2))}else console.log(UU(s))}catch(r){V.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";V.setFormat(t);try{let r=(0,Ac.resolve)(e.vault);if(!(0,Cc.existsSync)(r))throw new Be(r);yu(r);let i=qa.container.resolve(Hs.DailyReviewService),s;if(e.date&&(s=new Date(e.date),isNaN(s.getTime())))throw new He(`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=ce.success(a);console.log(JSON.stringify(c,null,2))}else console.log(BU(a))}catch(r){V.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";V.setFormat(r);try{let i=(0,Ac.resolve)(t.vault);if(!(0,Cc.existsSync)(i))throw new Be(i);yu(i);let s=qa.container.resolve(Hs.DailyReviewService),a=t.start!==!1,c=await s.quickCapture(e,a);if(r==="json"){let l=ce.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){V.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";V.setFormat(r);try{let i=(0,Ac.resolve)(t.vault);if(!(0,Cc.existsSync)(i))throw new Be(i);yu(i);let a=await qa.container.resolve(Hs.DailyReviewService).createFromPractice({prototypeUid:e,startImmediately:!0});if(r==="json"){let c=ce.success(a);console.log(JSON.stringify(c,null,2))}else console.log(`\u{1F504} Started: ${a.label}`),console.log(` Path: ${a.path}`)}catch(i){V.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";V.setFormat(r);try{let i=(0,Ac.resolve)(t.vault);if(!(0,Cc.existsSync)(i))throw new Be(i);if(yu(i),await qa.container.resolve(Hs.DailyReviewService).markPracticeDone(e),r==="json"){let a=ce.success({prototypeUid:e,status:"done"});console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 Marked as done: ${e}`)}catch(i){V.handle(i)}}),n}o(lI,"dailyReviewCommand");var uI=require("fs"),fI=require("path");function hI(){return new Ge("validate").description("Check vault files for IRI issues (Issue #2205)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";V.setFormat(e);try{let t=(0,fI.resolve)(n.vault);if(!(0,uI.existsSync)(t))throw new Be(t);let r=new ki(t);e==="text"&&console.log(`\u{1F50D} Validating vault: ${t}...`);let i=await r.validateVault();if(e==="json"){let s=ce.success({vaultPath:t,issueCount:i.length,issues:i,healthy:i.length===0});console.log(JSON.stringify(s,null,2))}else if(i.length===0)console.log("\u2705 Vault is healthy! No IRI issues found.");else{console.log(`
|
|
564
564
|
\u26A0\uFE0F Found ${i.length} file(s) with IRI issues:
|
|
565
565
|
`);for(let s of i)console.log(` \u274C ${s.path}`),console.log(` ${s.reason}`);console.log(`
|
|
566
566
|
\u{1F4DD} To fix these issues:`),console.log(" - Rename files to remove spaces and special characters"),console.log(" - Use dashes (-) or underscores (_) instead of spaces"),console.log(" - Avoid angle brackets (<>) and other special characters"),console.log(`
|
|
@@ -592,9 +592,9 @@ Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes
|
|
|
592
592
|
}
|
|
593
593
|
GROUP BY ?property
|
|
594
594
|
ORDER BY DESC(?usageCount)
|
|
595
|
-
`;a=s.parse(p),c=new tr.AlgebraTranslator,l=c.translate(a),u=new tr.AlgebraOptimizer,l=u.optimize(l);let w=(await f.executeAll(l)).map(S=>{let
|
|
595
|
+
`;a=s.parse(p),c=new tr.AlgebraTranslator,l=c.translate(a),u=new tr.AlgebraOptimizer,l=u.optimize(l);let w=(await f.executeAll(l)).map(S=>{let x=S.get("property"),F=S.get("usageCount");return{name:x?gI(x.toString()):"unknown",usageCount:F?parseInt(F.toString(),10):0}}),T={name:e,instanceCount:d,properties:w};if(r==="json"||t.format==="json"){let S=ce.success(T);console.log(JSON.stringify(S,null,2))}else{if(console.log(`\u{1F4CB} Class: ${e}
|
|
596
596
|
`),console.log(` Instances: ${d}`),console.log(` Properties: ${w.length}
|
|
597
|
-
`),w.length===0){console.log(" No properties found.");return}let S=Math.max(...w.map(
|
|
597
|
+
`),w.length===0){console.log(" No properties found.");return}let S=Math.max(...w.map(x=>x.name.length),10);console.log(" \u250C"+"\u2500".repeat(S+2)+"\u252C"+"\u2500".repeat(10)+"\u2510"),console.log(" \u2502 "+"Property".padEnd(S)+" \u2502 "+"Usage".padEnd(8)+" \u2502"),console.log(" \u251C"+"\u2500".repeat(S+2)+"\u253C"+"\u2500".repeat(10)+"\u2524");for(let x of w)console.log(" \u2502 "+x.name.padEnd(S)+" \u2502 "+x.usageCount.toString().padStart(8)+" \u2502");console.log(" \u2514"+"\u2500".repeat(S+2)+"\u2534"+"\u2500".repeat(10)+"\u2518")}}o(WU,"showClassDetails");function gI(n){let e=n.replace(/^<|>$/g,""),t=e.lastIndexOf("#");if(t!==-1)return e.substring(t+1);let r=e.lastIndexOf("/");return r!==-1?e.substring(r+1):e}o(gI,"extractLocalName");var vI=require("path"),Fv=require("fs"),_I=require("fs");var Rv=class extends Error{static{o(this,"ClassNotFoundError")}constructor(e,t){let r=`Class '${e}' not found in vault`;t&&t.length>0&&(r+=`
|
|
598
598
|
Available classes: ${t.join(", ")}`),super(r),this.name="ClassNotFoundError"}},Ic=class{constructor(e){this.fsAdapter=e;this.cache=new Map}static{o(this,"ClassResolverService")}async resolve(e,t){if(this.isUUID(t))return t;let r=await this.getOrBuildIndex(e),i=r.get(t);if(!i){let s=Array.from(r.keys()).filter(a=>!this.isUUID(a));throw new Rv(t,s)}return i}async listClasses(e){let t=await this.getOrBuildIndex(e);return Array.from(t.keys())}async getOrBuildIndex(e){if(this.cache.has(e))return this.cache.get(e);let t=await this.buildIndex(e);return this.cache.set(e,t),t}async buildIndex(e){let t=new Map,r=await this.fsAdapter.getMarkdownFiles();for(let i of r)try{let s=await this.fsAdapter.getFileMetadata(i);if(!this.isClassDefinition(s))continue;let a=this.getBasename(i),c=s.exo__Asset_uid;if(!c&&this.isUUID(a)&&(c=a),!c)continue;let l=String(c);a&&t.set(a,l);let u=s.exo__Asset_label;u&&typeof u=="string"&&u!==a&&t.set(u,l)}catch{continue}return t}isClassDefinition(e){let t=e.exo__Instance_class;return t?(Array.isArray(t)?t:[t]).some(i=>{let s=String(i);return s.includes("ims__Class")||s.includes("exo__Class")}):!1}getBasename(e){let t=e.split("/");return t[t.length-1].replace(/\.md$/,"")}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};var Pv=class extends Error{static{o(this,"WikilinkNotFoundError")}constructor(e,t){let r=t?`|${t}`:"";super(`Wikilink [[${e}${r}]] \u2014 file not found in vault`),this.name="WikilinkNotFoundError"}},Ip=class{constructor(e){this.fsAdapter=e}static{o(this,"WikilinkValidator")}static{this.WIKILINK_PATTERN=/\[\[([^\]|]+)(?:\|[^\]]*)?]]/g}async validatePropertyValues(e){for(let[,t]of Object.entries(e))await this.validateValue(t)}async validateValue(e){let t=this.extractWikilinks(e);for(let r of t)await this.validateWikilink(r.uuid,r.label)}extractWikilinks(e){let t=[],r=/\[\[([^\]|]+)(?:\|([^\]]*))?\]\]/g,i;for(;(i=r.exec(e))!==null;)t.push({uuid:i[1].trim(),label:i[2]?.trim()});return t}async validateWikilink(e,t){if(!this.looksLikeUUID(e))return;if(!await this.fsAdapter.fileExists(`${e}.md`)&&!await this.fsAdapter.findFileByUID(e))throw new Pv(e,t)}looksLikeUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};var yI=X(Ht());var GU="de20a3f1-7483-4714-ab28-b45f5cf02c76",HU="Asia/Almaty",Op=class{constructor(e,t,r){this.fsAdapter=e;this.classResolver=t;this.wikilinkValidator=r}static{o(this,"AssetCreationService")}async create(e){if(!e.label||e.label.trim().length===0)throw new Error("Label cannot be empty");let t=e.label.trim(),r=await this.classResolver.resolve(e.vault,e.classShortName);e.properties&&!e.skipWikilinkValidation&&await this.wikilinkValidator.validatePropertyValues(e.properties);let i=hu(),s=this.generateTimestamp(e.timezone),a=this.buildFrontmatter({assetUuid:i,classShortName:e.classShortName,classUuid:r,label:t,aliases:e.aliases,properties:e.properties,createdBy:e.createdBy||GU,timestamp:s}),c=yI.MetadataHelpers.buildFileContent(a,e.body),l=`01 Inbox/${i}.md`;return e.dryRun||await this.fsAdapter.createFile(l,c),{uuid:i,path:l,label:t,frontmatter:a}}buildFrontmatter(e){let t={};t.exo__Asset_uid=e.assetUuid,t.exo__Asset_label=e.label,t.exo__Asset_createdAt=e.timestamp,t.exo__Asset_createdBy=`"[[${e.createdBy}]]"`,t.exo__Instance_class=[`"[[${e.classUuid}|${e.classShortName}]]"`];let r=[e.label];if(e.aliases&&e.aliases.length>0)for(let i of e.aliases)r.includes(i)||r.push(i);if(t.aliases=r,e.properties)for(let[i,s]of Object.entries(e.properties))i==="exo__Asset_uid"||i==="exo__Asset_label"||i==="exo__Asset_createdAt"||i==="exo__Asset_createdBy"||i==="exo__Instance_class"||i==="aliases"||(t[i]=this.formatPropertyValue(s));return t}formatPropertyValue(e){return e.includes("[[")?[e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`]:e}generateTimestamp(e){let t=e||HU,r=new Date,s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(r),a=o(c=>s.find(l=>l.type===c)?.value||"00","get");return`${a("year")}-${a("month")}-${a("day")}T${a("hour")}:${a("minute")}:${a("second")}`}};function zU(n){if(!n||n.length===0)return{};let e={};for(let t of n){let r=t.indexOf("=");if(r===-1)throw new Error(`Invalid property format: "${t}". Expected "key=value" format.`);let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();if(!i)throw new Error(`Invalid property format: "${t}". Key cannot be empty.`);e[i]=s}return e}o(zU,"parseProperties");async function QU(n){if(n.bodyFile){if(!(0,Fv.existsSync)(n.bodyFile))throw new Error(`Body file not found: ${n.bodyFile}`);return(0,_I.readFileSync)(n.bodyFile,"utf-8")}if(n.body==="-")return YU(3e4);if(n.body)return n.body}o(QU,"resolveBody");function YU(n){return new Promise((e,t)=>{let r=[],i=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.destroy(),t(new Error(`Stdin read timed out after ${n}ms. Ensure you pipe content to stdin or close the pipe.`))},n);process.stdin.on("data",s=>{r.push(s)}),process.stdin.on("end",()=>{clearTimeout(i),e(Buffer.concat(r).toString("utf-8"))}),process.stdin.on("error",s=>{clearTimeout(i),t(s)}),process.stdin.isTTY&&(clearTimeout(i),e("")),process.stdin.resume()})}o(YU,"readStdin");function wI(){return new Ge("create").description("Create a new vault asset with auto-generated UUID, timestamp, and frontmatter").requiredOption("--class <name>","Class short name (e.g. ztlk__PermanentNote) or UUID").requiredOption("--label <text>","Human-readable label for the asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--aliases <names...>","Additional aliases for the asset").option("--property <key=value...>","Property key-value pairs (repeatable)",KU,[]).option("--body <text>","Markdown body content (use '-' to read from stdin)").option("--body-file <path>","Read body content from file").option("--dry-run","Preview frontmatter without writing file").option("--created-by <uuid>","Creator UUID (defaults to ExoAssistant)").option("--timezone <tz>","Timezone for timestamps (defaults to Asia/Almaty)").option("--skip-wikilink-validation","Skip wikilink existence validation").action(async n=>{try{let e=(0,vI.resolve)(n.vault);if(!(0,Fv.existsSync)(e))throw new Be(e);let t=zU(n.property),r=await QU(n);r&&(r=r.replace(/\\n/g,`
|
|
599
599
|
`));let i=new Ft(e),s=new Ic(i),a=new Ip(i),l=await new Op(i,s,a).create({classShortName:n.class,label:n.label,aliases:n.aliases,properties:Object.keys(t).length>0?t:void 0,body:r,vault:e,dryRun:n.dryRun,createdBy:n.createdBy,timezone:n.timezone,skipWikilinkValidation:n.skipWikilinkValidation});if(n.dryRun){let f=XU(l.frontmatter,r);process.stderr.write(f+`
|
|
600
600
|
`)}let u={uuid:l.uuid,path:l.path,label:l.label};process.stdout.write(JSON.stringify(u)+`
|
|
@@ -627,15 +627,15 @@ ${hr.dump(i,{lineWidth:-1})}---
|
|
|
627
627
|
`),c.isDefinedBy&&process.stderr.write(`isDefinedBy: ${c.isDefinedBy}
|
|
628
628
|
`),process.stderr.write(`--- END PREVIEW ---
|
|
629
629
|
`)),process.stdout.write(JSON.stringify(c)+`
|
|
630
|
-
`),process.exit(0)}catch(e){V.handle(e)}})}o(TI,"unarchiveCommand");var
|
|
630
|
+
`),process.exit(0)}catch(e){V.handle(e)}})}o(TI,"unarchiveCommand");var ms=require("fs"),Rc=require("path"),mi=X(Ht());function AI(){let n=new Ge("workflow").description("Manage custom workflow definitions");return n.command("list").description("List all workflow definitions in the vault").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async e=>{let t=e.output||"text";V.setFormat(t);try{let r=(0,Rc.resolve)(e.vault);if(!(0,ms.existsSync)(r))throw new Be(r);let i=II(r);if(t==="json"){let s=ce.success({workflows:i,totalWorkflows:i.length});console.log(JSON.stringify(s,null,2))}else{if(i.length===0){console.log("No workflows found in vault.");return}console.log(`
|
|
631
631
|
\u{1F4CB} Found ${i.length} workflow(s):
|
|
632
|
-
`);let s=Math.max(...i.map(c=>c.label.length),4),a=Math.max(...i.map(c=>c.targetClass.length),12);console.log("\u250C"+"\u2500".repeat(s+2)+"\u252C"+"\u2500".repeat(a+2)+"\u252C"+"\u2500".repeat(8)+"\u252C"+"\u2500".repeat(13)+"\u252C"+"\u2500".repeat(9)+"\u2510"),console.log("\u2502 "+"Name".padEnd(s)+" \u2502 "+"Target Class".padEnd(a)+" \u2502 "+"States".padEnd(6)+" \u2502 "+"Transitions".padEnd(11)+" \u2502 "+"Default".padEnd(7)+" \u2502"),console.log("\u251C"+"\u2500".repeat(s+2)+"\u253C"+"\u2500".repeat(a+2)+"\u253C"+"\u2500".repeat(8)+"\u253C"+"\u2500".repeat(13)+"\u253C"+"\u2500".repeat(9)+"\u2524");for(let c of i)console.log("\u2502 "+c.label.padEnd(s)+" \u2502 "+c.targetClass.padEnd(a)+" \u2502 "+c.stateCount.toString().padStart(6)+" \u2502 "+c.transitionCount.toString().padStart(11)+" \u2502 "+(c.isDefault?" yes ":" no ")+" \u2502");console.log("\u2514"+"\u2500".repeat(s+2)+"\u2534"+"\u2500".repeat(a+2)+"\u2534"+"\u2500".repeat(8)+"\u2534"+"\u2500".repeat(13)+"\u2534"+"\u2500".repeat(9)+"\u2518")}}catch(r){V.handle(r)}}),n.command("show").description("Show details of a workflow definition").argument("<uid>","UID of the workflow asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async(e,t)=>{let r=t.output||"text";V.setFormat(r);try{let i=(0,Rc.resolve)(t.vault);if(!(0,
|
|
632
|
+
`);let s=Math.max(...i.map(c=>c.label.length),4),a=Math.max(...i.map(c=>c.targetClass.length),12);console.log("\u250C"+"\u2500".repeat(s+2)+"\u252C"+"\u2500".repeat(a+2)+"\u252C"+"\u2500".repeat(8)+"\u252C"+"\u2500".repeat(13)+"\u252C"+"\u2500".repeat(9)+"\u2510"),console.log("\u2502 "+"Name".padEnd(s)+" \u2502 "+"Target Class".padEnd(a)+" \u2502 "+"States".padEnd(6)+" \u2502 "+"Transitions".padEnd(11)+" \u2502 "+"Default".padEnd(7)+" \u2502"),console.log("\u251C"+"\u2500".repeat(s+2)+"\u253C"+"\u2500".repeat(a+2)+"\u253C"+"\u2500".repeat(8)+"\u253C"+"\u2500".repeat(13)+"\u253C"+"\u2500".repeat(9)+"\u2524");for(let c of i)console.log("\u2502 "+c.label.padEnd(s)+" \u2502 "+c.targetClass.padEnd(a)+" \u2502 "+c.stateCount.toString().padStart(6)+" \u2502 "+c.transitionCount.toString().padStart(11)+" \u2502 "+(c.isDefault?" yes ":" no ")+" \u2502");console.log("\u2514"+"\u2500".repeat(s+2)+"\u2534"+"\u2500".repeat(a+2)+"\u2534"+"\u2500".repeat(8)+"\u2534"+"\u2500".repeat(13)+"\u2534"+"\u2500".repeat(9)+"\u2518")}}catch(r){V.handle(r)}}),n.command("show").description("Show details of a workflow definition").argument("<uid>","UID of the workflow asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async(e,t)=>{let r=t.output||"text";V.setFormat(r);try{let i=(0,Rc.resolve)(t.vault);if(!(0,ms.existsSync)(i))throw new Be(i);let s=xI(i,e);if(!s){if(r==="json"){let a=ce.success({error:`Workflow with UID "${e}" not found`});console.log(JSON.stringify(a,null,2))}else console.log(`\u274C Workflow with UID "${e}" not found.`);process.exitCode=1;return}if(r==="json"){let a=ce.success(s);console.log(JSON.stringify(a,null,2))}else{console.log(`
|
|
633
633
|
\u{1F4CB} Workflow: ${s.name}
|
|
634
634
|
`),console.log(` ID: ${s.id}`),console.log(` Target class: ${s.targetClass}`),console.log(` Initial state: ${s.initialState}`),console.log(` Terminal states: ${s.terminalStates.join(", ")}`),console.log(` Default: ${s.isDefault?"yes":"no"}`),console.log(`
|
|
635
635
|
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(`
|
|
636
|
-
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){V.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";V.setFormat(r);try{let i=(0,Rc.resolve)(t.vault);if(!(0,
|
|
637
|
-
`);for(let l of c.errors)console.log(` \u2022 ${l}`);process.exitCode=1}}catch(i){V.handle(i)}}),n}o(AI,"workflowCommand");var CI=new mi.FrontmatterService;function II(n){let e=[]
|
|
638
|
-
`),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(RI,"parseYamlFrontmatter");function
|
|
636
|
+
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){V.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";V.setFormat(r);try{let i=(0,Rc.resolve)(t.vault);if(!(0,ms.existsSync)(i))throw new Be(i);let s=xI(i,e);if(!s){if(r==="json"){let l=ce.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 mi.WorkflowEngine(s).validate();if(r==="json"){let l=ce.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):
|
|
637
|
+
`);for(let l of c.errors)console.log(` \u2022 ${l}`);process.exitCode=1}}catch(i){V.handle(i)}}),n}o(AI,"workflowCommand");var CI=new mi.FrontmatterService;function II(n){let e=[],t=[];OI(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??ZU(r),u=ps(i.ems__Workflow_targetClass??"ems__Task"),f=i.ems__Workflow_isDefault===!0||i.ems__Workflow_isDefault==="true",h=0,d=0;for(let{fm:p}of t){let y=p.exo__Instance_class;if(!ps(p.ems__WorkflowState_workflow??p.ems__WorkflowTransition_workflow??"").includes(c))continue;let S=Array.isArray(y)?y.some(F=>F.includes("ems__WorkflowState")):typeof y=="string"&&y.includes("ems__WorkflowState"),x=Array.isArray(y)?y.some(F=>F.includes("ems__WorkflowTransition")):typeof y=="string"&&y.includes("ems__WorkflowTransition");S&&h++,x&&d++}e.push({filePath:r,uid:c,label:l,targetClass:u,isDefault:f,stateCount:h,transitionCount:d})}return e}o(II,"scanWorkflows");function OI(n,e){let t;try{t=(0,ms.readdirSync)(n,{withFileTypes:!0})}catch{return}for(let r of t){let i=(0,Rc.join)(n,r.name);if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;OI(i,e)}else if(r.name.endsWith(".md"))try{let s=(0,ms.readFileSync)(i,"utf-8"),a=CI.parse(s);a.exists&&e.push({filePath:i,fm:RI(a.content)})}catch{}}}o(OI,"collectParsedFiles");function xI(n,e){let r=II(n).find(i=>i.uid===e);if(!r)return null;try{let i=(0,ms.readFileSync)(r.filePath,"utf-8"),s=CI.parse(i);if(!s.exists)return null;let a=RI(s.content),c=ps(a.ems__Workflow_targetClass??"ems__Task"),l=ps(a.ems__Workflow_initialState??"ems__EffortStatusDraft"),u=Oc(l)??mi.EffortStatus.DRAFT,h=(Array.isArray(a.ems__Workflow_terminalStates)?a.ems__Workflow_terminalStates.map(S=>ps(S)):[]).map(Oc).filter(S=>S!==null),d=a.ems__Workflow_isDefault===!0||a.ems__Workflow_isDefault==="true",y=(Array.isArray(a.ems__Workflow_states)?a.ems__Workflow_states:[]).map((S,x)=>typeof S=="string"?{status:Oc(ps(S))??mi.EffortStatus.DRAFT,order:x+1,optional:!1,timestampOnEnter:[]}:{status:Oc(ps(S.status??""))??mi.EffortStatus.DRAFT,order:S.order??x+1,optional:S.optional===!0||S.optional==="true",timestampOnEnter:Array.isArray(S.timestampOnEnter)?S.timestampOnEnter:[],badgeColor:S.badgeColor}),T=(Array.isArray(a.ems__Workflow_transitions)?a.ems__Workflow_transitions:[]).map(S=>{let x=Oc(ps(S.from??"")),F=Oc(ps(S.to??""));return!x||!F?null:{from:x,to:F,label:S.label??`${x} \u2192 ${F}`,icon:S.icon,isRollback:S.isRollback===!0||S.isRollback==="true"}}).filter(S=>S!==null);return{id:e,name:r.label,targetClass:c,states:y,transitions:T,initialState:u,terminalStates:h.length>0?h:[mi.EffortStatus.DONE,mi.EffortStatus.TRASHED],isDefault:d}}catch{return null}}o(xI,"loadWorkflowByUid");function RI(n){let e={},t=n.split(`
|
|
638
|
+
`),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(RI,"parseYamlFrontmatter");function ps(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(ps,"normalizeWikilink");function ZU(n){let e=n.split("/");return e[e.length-1].replace(/\.md$/,"")}o(ZU,"extractLabelFromFilename");function Oc(n){return Object.values(mi.EffortStatus).includes(n)?n:null}o(Oc,"resolveEffortStatus");var Rr=new Ge;Rr.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("15.45.2");var Vv=Rr.command("sparql").description("SPARQL query execution and cache management");Vv.addCommand(NA());Vv.addCommand(jA());Vv.addCommand($A());Rr.addCommand(zC());Rr.addCommand(KC());Rr.addCommand(XC());Rr.addCommand(ZC());Rr.addCommand(eI());Rr.addCommand(sI());Rr.addCommand(lI());Rr.addCommand(hI());Rr.addCommand(mI());Rr.addCommand(wI());Rr.addCommand(EI());Rr.addCommand(TI());Rr.addCommand(AI());Rr.parse();
|
|
639
639
|
/*! Bundled license information:
|
|
640
640
|
|
|
641
641
|
reflect-metadata/Reflect.js:
|