@kitelev/exocortex-cli 16.157.0 → 16.157.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +23 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v16.157.
|
|
2
|
+
// @kitelev/exocortex-cli v16.157.1
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
6
|
-
"use strict";var y9=Object.create;var df=Object.defineProperty;var b9=Object.getOwnPropertyDescriptor;var _9=Object.getOwnPropertyNames;var S9=Object.getPrototypeOf,w9=Object.prototype.hasOwnProperty;var a=(n,e)=>df(n,"name",{value:e,configurable:!0});var v9=(n,e)=>()=>(n&&(e=n(n=0)),e);var w=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Yb=(n,e)=>{for(var t in e)df(n,t,{get:e[t],enumerable:!0})},ox=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _9(e))!w9.call(n,i)&&i!==t&&df(n,i,{get:()=>e[i],enumerable:!(r=b9(e,i))||r.enumerable});return n};var se=(n,e,t)=>(t=n!=null?y9(S9(n)):{},ox(e||!n||!n.__esModule?df(t,"default",{value:n,enumerable:!0}):t,n)),zh=n=>ox(df({},"__esModule",{value:!0}),n);var Qb=w(()=>{var ax;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:c(),r=i(n);typeof t.Reflect<"u"&&(r=i(t.Reflect,r)),e(r,t),typeof t.Reflect>"u"&&(t.Reflect=n);function i(l,u){return function(f,d){Object.defineProperty(l,f,{configurable:!0,writable:!0,value:d}),u&&u(f,d)}}a(i,"makeExporter");function s(){try{return Function("return this;")()}catch{}}a(s,"functionThis");function o(){try{return(0,eval)("(function() { return this; })()")}catch{}}a(o,"indirectEvalThis");function c(){return s()||o()}a(c,"sloppyModeThis")})(function(e,t){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",o=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,f={create:c?function(){return Je(Object.create(null))}:l?function(){return Je({__proto__:null})}:function(){return Je({})},has:u?function(x,C){return r.call(x,C)}:function(x,C){return C in x},get:u?function(x,C){return r.call(x,C)?x[C]:void 0}:function(x,C){return x[C]}},d=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:ke(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:at(),g=typeof WeakMap=="function"?WeakMap:Ze(),y=i?Symbol.for("@reflect-metadata:registry"):void 0,b=De(),S=Le(b);function v(x,C,F,U){if(G(F)){if(!ve(x))throw new TypeError;if(!pe(C))throw new TypeError;return J(x,C)}else{if(!ve(x))throw new TypeError;if(!X(C))throw new TypeError;if(!X(U)&&!G(U)&&!te(U))throw new TypeError;return te(U)&&(U=void 0),F=me(F),re(x,C,F,U)}}a(v,"decorate"),e("decorate",v);function I(x,C){function F(U,he){if(!X(U))throw new TypeError;if(!G(he)&&!Re(he))throw new TypeError;q(x,C,U,he)}return a(F,"decorator"),F}a(I,"metadata"),e("metadata",I);function A(x,C,F,U){if(!X(F))throw new TypeError;return G(U)||(U=me(U)),q(x,C,F,U)}a(A,"defineMetadata"),e("defineMetadata",A);function T(x,C,F){if(!X(C))throw new TypeError;return G(F)||(F=me(F)),Y(x,C,F)}a(T,"hasMetadata"),e("hasMetadata",T);function R(x,C,F){if(!X(C))throw new TypeError;return G(F)||(F=me(F)),ye(x,C,F)}a(R,"hasOwnMetadata"),e("hasOwnMetadata",R);function V(x,C,F){if(!X(C))throw new TypeError;return G(F)||(F=me(F)),de(x,C,F)}a(V,"getMetadata"),e("getMetadata",V);function L(x,C,F){if(!X(C))throw new TypeError;return G(F)||(F=me(F)),le(x,C,F)}a(L,"getOwnMetadata"),e("getOwnMetadata",L);function P(x,C){if(!X(x))throw new TypeError;return G(C)||(C=me(C)),M(x,C)}a(P,"getMetadataKeys"),e("getMetadataKeys",P);function k(x,C){if(!X(x))throw new TypeError;return G(C)||(C=me(C)),je(x,C)}a(k,"getOwnMetadataKeys"),e("getOwnMetadataKeys",k);function O(x,C,F){if(!X(C))throw new TypeError;if(G(F)||(F=me(F)),!X(C))throw new TypeError;G(F)||(F=me(F));var U=xe(C,F,!1);return G(U)?!1:U.OrdinaryDeleteMetadata(x,C,F)}a(O,"deleteMetadata"),e("deleteMetadata",O);function J(x,C){for(var F=x.length-1;F>=0;--F){var U=x[F],he=U(C);if(!G(he)&&!te(he)){if(!pe(he))throw new TypeError;C=he}}return C}a(J,"DecorateConstructor");function re(x,C,F,U){for(var he=x.length-1;he>=0;--he){var At=x[he],Ot=At(C,F,U);if(!G(Ot)&&!te(Ot)){if(!X(Ot))throw new TypeError;U=Ot}}return U}a(re,"DecorateProperty");function Y(x,C,F){var U=ye(x,C,F);if(U)return!0;var he=Oe(C);return te(he)?!1:Y(x,he,F)}a(Y,"OrdinaryHasMetadata");function ye(x,C,F){var U=xe(C,F,!1);return G(U)?!1:$(U.OrdinaryHasOwnMetadata(x,C,F))}a(ye,"OrdinaryHasOwnMetadata");function de(x,C,F){var U=ye(x,C,F);if(U)return le(x,C,F);var he=Oe(C);if(!te(he))return de(x,he,F)}a(de,"OrdinaryGetMetadata");function le(x,C,F){var U=xe(C,F,!1);if(!G(U))return U.OrdinaryGetOwnMetadata(x,C,F)}a(le,"OrdinaryGetOwnMetadata");function q(x,C,F,U){var he=xe(F,U,!0);he.OrdinaryDefineOwnMetadata(x,C,F,U)}a(q,"OrdinaryDefineOwnMetadata");function M(x,C){var F=je(x,C),U=Oe(x);if(U===null)return F;var he=M(U,C);if(he.length<=0)return F;if(F.length<=0)return he;for(var At=new p,Ot=[],ze=0,ne=F;ze<ne.length;ze++){var ie=ne[ze],ae=At.has(ie);ae||(At.add(ie),Ot.push(ie))}for(var ue=0,We=he;ue<We.length;ue++){var ie=We[ue],ae=At.has(ie);ae||(At.add(ie),Ot.push(ie))}return Ot}a(M,"OrdinaryMetadataKeys");function je(x,C){var F=xe(x,C,!1);return F?F.OrdinaryOwnMetadataKeys(x,C):[]}a(je,"OrdinaryOwnMetadataKeys");function Q(x){if(x===null)return 1;switch(typeof x){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return x===null?1:6;default:return 6}}a(Q,"Type");function G(x){return x===void 0}a(G,"IsUndefined");function te(x){return x===null}a(te,"IsNull");function Se(x){return typeof x=="symbol"}a(Se,"IsSymbol");function X(x){return typeof x=="object"?x!==null:typeof x=="function"}a(X,"IsObject");function $e(x,C){switch(Q(x)){case 0:return x;case 1:return x;case 2:return x;case 3:return x;case 4:return x;case 5:return x}var F=C===3?"string":C===5?"number":"default",U=Z(x,s);if(U!==void 0){var he=U.call(x,F);if(X(he))throw new TypeError;return he}return Be(x,F==="default"?"number":F)}a($e,"ToPrimitive");function Be(x,C){if(C==="string"){var F=x.toString;if(be(F)){var U=F.call(x);if(!X(U))return U}var he=x.valueOf;if(be(he)){var U=he.call(x);if(!X(U))return U}}else{var he=x.valueOf;if(be(he)){var U=he.call(x);if(!X(U))return U}var At=x.toString;if(be(At)){var U=At.call(x);if(!X(U))return U}}throw new TypeError}a(Be,"OrdinaryToPrimitive");function $(x){return!!x}a($,"ToBoolean");function ee(x){return""+x}a(ee,"ToString");function me(x){var C=$e(x,3);return Se(C)?C:ee(C)}a(me,"ToPropertyKey");function ve(x){return Array.isArray?Array.isArray(x):x instanceof Object?x instanceof Array:Object.prototype.toString.call(x)==="[object Array]"}a(ve,"IsArray");function be(x){return typeof x=="function"}a(be,"IsCallable");function pe(x){return typeof x=="function"}a(pe,"IsConstructor");function Re(x){switch(Q(x)){case 3:return!0;case 4:return!0;default:return!1}}a(Re,"IsPropertyKey");function B(x,C){return x===C||x!==x&&C!==C}a(B,"SameValueZero");function Z(x,C){var F=x[C];if(F!=null){if(!be(F))throw new TypeError;return F}}a(Z,"GetMethod");function oe(x){var C=Z(x,o);if(!be(C))throw new TypeError;var F=C.call(x);if(!X(F))throw new TypeError;return F}a(oe,"GetIterator");function ge(x){return x.value}a(ge,"IteratorValue");function Ae(x){var C=x.next();return C.done?!1:C}a(Ae,"IteratorStep");function Ie(x){var C=x.return;C&&C.call(x)}a(Ie,"IteratorClose");function Oe(x){var C=Object.getPrototypeOf(x);if(typeof x!="function"||x===d||C!==d)return C;var F=x.prototype,U=F&&Object.getPrototypeOf(F);if(U==null||U===Object.prototype)return C;var he=U.constructor;return typeof he!="function"||he===x?C:he}a(Oe,"OrdinaryGetPrototypeOf");function Fe(){var x;!G(y)&&typeof t.Reflect<"u"&&!(y in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(x=Ne(t.Reflect));var C,F,U,he=new g,At={registerProvider:Ot,getProvider:ne,setProvider:ae};return At;function Ot(ue){if(!Object.isExtensible(At))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case x===ue:break;case G(C):C=ue;break;case C===ue:break;case G(F):F=ue;break;case F===ue:break;default:U===void 0&&(U=new p),U.add(ue);break}}function ze(ue,We){if(!G(C)){if(C.isProviderFor(ue,We))return C;if(!G(F)){if(F.isProviderFor(ue,We))return C;if(!G(U))for(var lt=oe(U);;){var ut=Ae(lt);if(!ut)return;var Mr=ge(ut);if(Mr.isProviderFor(ue,We))return Ie(lt),Mr}}}if(!G(x)&&x.isProviderFor(ue,We))return x}function ne(ue,We){var lt=he.get(ue),ut;return G(lt)||(ut=lt.get(We)),G(ut)&&(ut=ze(ue,We),G(ut)||(G(lt)&&(lt=new h,he.set(ue,lt)),lt.set(We,ut))),ut}function ie(ue){if(G(ue))throw new TypeError;return C===ue||F===ue||!G(U)&&U.has(ue)}function ae(ue,We,lt){if(!ie(lt))throw new Error("Metadata provider not registered.");var ut=ne(ue,We);if(ut!==lt){if(!G(ut))return!1;var Mr=he.get(ue);G(Mr)&&(Mr=new h,he.set(ue,Mr)),Mr.set(We,lt)}return!0}}a(Fe,"CreateMetadataRegistry");function De(){var x;return!G(y)&&X(t.Reflect)&&Object.isExtensible(t.Reflect)&&(x=t.Reflect[y]),G(x)&&(x=Fe()),!G(y)&&X(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:x}),x}a(De,"GetOrCreateMetadataRegistry");function Le(x){var C=new g,F={isProviderFor:a(function(ie,ae){var ue=C.get(ie);return G(ue)?!1:ue.has(ae)},"isProviderFor"),OrdinaryDefineOwnMetadata:Ot,OrdinaryHasOwnMetadata:he,OrdinaryGetOwnMetadata:At,OrdinaryOwnMetadataKeys:ze,OrdinaryDeleteMetadata:ne};return b.registerProvider(F),F;function U(ie,ae,ue){var We=C.get(ie),lt=!1;if(G(We)){if(!ue)return;We=new h,C.set(ie,We),lt=!0}var ut=We.get(ae);if(G(ut)){if(!ue)return;if(ut=new h,We.set(ae,ut),!x.setProvider(ie,ae,F))throw We.delete(ae),lt&&C.delete(ie),new Error("Wrong provider for target.")}return ut}a(U,"GetOrCreateMetadataMap");function he(ie,ae,ue){var We=U(ae,ue,!1);return G(We)?!1:$(We.has(ie))}a(he,"OrdinaryHasOwnMetadata");function At(ie,ae,ue){var We=U(ae,ue,!1);if(!G(We))return We.get(ie)}a(At,"OrdinaryGetOwnMetadata");function Ot(ie,ae,ue,We){var lt=U(ue,We,!0);lt.set(ie,ae)}a(Ot,"OrdinaryDefineOwnMetadata");function ze(ie,ae){var ue=[],We=U(ie,ae,!1);if(G(We))return ue;for(var lt=We.keys(),ut=oe(lt),Mr=0;;){var On=Ae(ut);if(!On)return ue.length=Mr,ue;var Qn=ge(On);try{ue[Mr]=Qn}catch(un){try{Ie(ut)}finally{throw un}}Mr++}}a(ze,"OrdinaryOwnMetadataKeys");function ne(ie,ae,ue){var We=U(ae,ue,!1);if(G(We)||!We.delete(ie))return!1;if(We.size===0){var lt=C.get(ae);G(lt)||(lt.delete(ue),lt.size===0&&C.delete(lt))}return!0}a(ne,"OrdinaryDeleteMetadata")}a(Le,"CreateMetadataProvider");function Ne(x){var C=x.defineMetadata,F=x.hasOwnMetadata,U=x.getOwnMetadata,he=x.getOwnMetadataKeys,At=x.deleteMetadata,Ot=new g,ze={isProviderFor:a(function(ne,ie){var ae=Ot.get(ne);return!G(ae)&&ae.has(ie)?!0:he(ne,ie).length?(G(ae)&&(ae=new p,Ot.set(ne,ae)),ae.add(ie),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:C,OrdinaryHasOwnMetadata:F,OrdinaryGetOwnMetadata:U,OrdinaryOwnMetadataKeys:he,OrdinaryDeleteMetadata:At};return ze}a(Ne,"CreateFallbackProvider");function xe(x,C,F){var U=b.getProvider(x,C);if(!G(U))return U;if(F){if(b.setProvider(x,C,S))return S;throw new Error("Illegal state.")}}a(xe,"GetMetadataProvider");function ke(){var x={},C=[],F=(function(){function ze(ne,ie,ae){this._index=0,this._keys=ne,this._values=ie,this._selector=ae}return a(ze,"MapIterator"),ze.prototype["@@iterator"]=function(){return this},ze.prototype[o]=function(){return this},ze.prototype.next=function(){var ne=this._index;if(ne>=0&&ne<this._keys.length){var ie=this._selector(this._keys[ne],this._values[ne]);return ne+1>=this._keys.length?(this._index=-1,this._keys=C,this._values=C):this._index++,{value:ie,done:!1}}return{value:void 0,done:!0}},ze.prototype.throw=function(ne){throw this._index>=0&&(this._index=-1,this._keys=C,this._values=C),ne},ze.prototype.return=function(ne){return this._index>=0&&(this._index=-1,this._keys=C,this._values=C),{value:ne,done:!0}},ze})(),U=(function(){function ze(){this._keys=[],this._values=[],this._cacheKey=x,this._cacheIndex=-2}return a(ze,"Map"),Object.defineProperty(ze.prototype,"size",{get:a(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),ze.prototype.has=function(ne){return this._find(ne,!1)>=0},ze.prototype.get=function(ne){var ie=this._find(ne,!1);return ie>=0?this._values[ie]:void 0},ze.prototype.set=function(ne,ie){var ae=this._find(ne,!0);return this._values[ae]=ie,this},ze.prototype.delete=function(ne){var ie=this._find(ne,!1);if(ie>=0){for(var ae=this._keys.length,ue=ie+1;ue<ae;ue++)this._keys[ue-1]=this._keys[ue],this._values[ue-1]=this._values[ue];return this._keys.length--,this._values.length--,B(ne,this._cacheKey)&&(this._cacheKey=x,this._cacheIndex=-2),!0}return!1},ze.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=x,this._cacheIndex=-2},ze.prototype.keys=function(){return new F(this._keys,this._values,he)},ze.prototype.values=function(){return new F(this._keys,this._values,At)},ze.prototype.entries=function(){return new F(this._keys,this._values,Ot)},ze.prototype["@@iterator"]=function(){return this.entries()},ze.prototype[o]=function(){return this.entries()},ze.prototype._find=function(ne,ie){if(!B(this._cacheKey,ne)){this._cacheIndex=-1;for(var ae=0;ae<this._keys.length;ae++)if(B(this._keys[ae],ne)){this._cacheIndex=ae;break}}return this._cacheIndex<0&&ie&&(this._cacheIndex=this._keys.length,this._keys.push(ne),this._values.push(void 0)),this._cacheIndex},ze})();return U;function he(ze,ne){return ze}function At(ze,ne){return ne}function Ot(ze,ne){return[ze,ne]}}a(ke,"CreateMapPolyfill");function at(){var x=(function(){function C(){this._map=new h}return a(C,"Set"),Object.defineProperty(C.prototype,"size",{get:a(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),C.prototype.has=function(F){return this._map.has(F)},C.prototype.add=function(F){return this._map.set(F,F),this},C.prototype.delete=function(F){return this._map.delete(F)},C.prototype.clear=function(){this._map.clear()},C.prototype.keys=function(){return this._map.keys()},C.prototype.values=function(){return this._map.keys()},C.prototype.entries=function(){return this._map.entries()},C.prototype["@@iterator"]=function(){return this.keys()},C.prototype[o]=function(){return this.keys()},C})();return x}a(at,"CreateSetPolyfill");function Ze(){var x=16,C=f.create(),F=U();return(function(){function ne(){this._key=U()}return a(ne,"WeakMap"),ne.prototype.has=function(ie){var ae=he(ie,!1);return ae!==void 0?f.has(ae,this._key):!1},ne.prototype.get=function(ie){var ae=he(ie,!1);return ae!==void 0?f.get(ae,this._key):void 0},ne.prototype.set=function(ie,ae){var ue=he(ie,!0);return ue[this._key]=ae,this},ne.prototype.delete=function(ie){var ae=he(ie,!1);return ae!==void 0?delete ae[this._key]:!1},ne.prototype.clear=function(){this._key=U()},ne})();function U(){var ne;do ne="@@WeakMap@@"+ze();while(f.has(C,ne));return C[ne]=!0,ne}function he(ne,ie){if(!r.call(ne,F)){if(!ie)return;Object.defineProperty(ne,F,{value:f.create()})}return ne[F]}function At(ne,ie){for(var ae=0;ae<ie;++ae)ne[ae]=Math.random()*255|0;return ne}function Ot(ne){if(typeof Uint8Array=="function"){var ie=new Uint8Array(ne);return typeof crypto<"u"?crypto.getRandomValues(ie):typeof msCrypto<"u"?msCrypto.getRandomValues(ie):At(ie,ne),ie}return At(new Array(ne),ne)}function ze(){var ne=Ot(x);ne[6]=ne[6]&79|64,ne[8]=ne[8]&191|128;for(var ie="",ae=0;ae<x;++ae){var ue=ne[ae];(ae===4||ae===6||ae===8)&&(ie+="-"),ue<16&&(ie+="0"),ie+=ue.toString(16).toLowerCase()}return ie}}a(Ze,"CreateWeakMapPolyfill");function Je(x){return x.__=void 0,delete x.__,x}a(Je,"MakeDictionary")})})(ax||(ax={}))});var hf=w(Jb=>{var Kh=class extends Error{static{a(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}},Xb=class extends Kh{static{a(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Jb.CommanderError=Kh;Jb.InvalidArgumentError=Xb});var Yh=w(e_=>{var{InvalidArgumentError:E9}=hf(),Zb=class{static{a(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 E9(`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 T9(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}a(T9,"humanReadableArgName");e_.Argument=Zb;e_.humanReadableArgName=T9});var n_=w(r_=>{var{humanReadableArgName:A9}=Yh(),t_=class{static{a(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=a(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=>A9(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 o=r(s);i.has(o)||i.set(o,[])}),t.forEach(s=>{let o=r(s);i.has(o)||i.set(o,[]),i.get(o).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(d,h){return t.formatItem(d,r,h,t)}a(s,"callFormatItem");let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],c=t.commandDescription(e);c.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(c),i),""]));let l=t.visibleArguments(e).map(d=>s(t.styleArgumentTerm(t.argumentTerm(d)),t.styleArgumentDescription(t.argumentDescription(d))));if(o=o.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,h)=>{let p=d.map(g=>s(t.styleOptionTerm(t.optionTerm(g)),t.styleOptionDescription(t.optionDescription(g))));o=o.concat(this.formatItemList(h,p,t))}),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(h=>s(t.styleOptionTerm(t.optionTerm(h)),t.styleOptionDescription(t.optionDescription(h))));o=o.concat(this.formatItemList("Global Options:",d,t))}return this.groupItems(e.commands,t.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,h)=>{let p=d.map(g=>s(t.styleSubcommandTerm(t.subcommandTerm(g)),t.styleSubcommandDescription(t.subcommandDescription(g))));o=o.concat(this.formatItemList(h,p,t))}),o.join(`
|
|
6
|
+
"use strict";var y9=Object.create;var df=Object.defineProperty;var b9=Object.getOwnPropertyDescriptor;var _9=Object.getOwnPropertyNames;var S9=Object.getPrototypeOf,w9=Object.prototype.hasOwnProperty;var a=(n,e)=>df(n,"name",{value:e,configurable:!0});var v9=(n,e)=>()=>(n&&(e=n(n=0)),e);var w=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Yb=(n,e)=>{for(var t in e)df(n,t,{get:e[t],enumerable:!0})},ox=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _9(e))!w9.call(n,i)&&i!==t&&df(n,i,{get:()=>e[i],enumerable:!(r=b9(e,i))||r.enumerable});return n};var se=(n,e,t)=>(t=n!=null?y9(S9(n)):{},ox(e||!n||!n.__esModule?df(t,"default",{value:n,enumerable:!0}):t,n)),zh=n=>ox(df({},"__esModule",{value:!0}),n);var Qb=w(()=>{var ax;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:c(),r=i(n);typeof t.Reflect<"u"&&(r=i(t.Reflect,r)),e(r,t),typeof t.Reflect>"u"&&(t.Reflect=n);function i(l,u){return function(f,d){Object.defineProperty(l,f,{configurable:!0,writable:!0,value:d}),u&&u(f,d)}}a(i,"makeExporter");function s(){try{return Function("return this;")()}catch{}}a(s,"functionThis");function o(){try{return(0,eval)("(function() { return this; })()")}catch{}}a(o,"indirectEvalThis");function c(){return s()||o()}a(c,"sloppyModeThis")})(function(e,t){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",o=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,f={create:c?function(){return Je(Object.create(null))}:l?function(){return Je({__proto__:null})}:function(){return Je({})},has:u?function(x,C){return r.call(x,C)}:function(x,C){return C in x},get:u?function(x,C){return r.call(x,C)?x[C]:void 0}:function(x,C){return x[C]}},d=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:ke(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:at(),g=typeof WeakMap=="function"?WeakMap:Ze(),y=i?Symbol.for("@reflect-metadata:registry"):void 0,b=De(),S=Le(b);function v(x,C,F,U){if(G(F)){if(!ve(x))throw new TypeError;if(!pe(C))throw new TypeError;return J(x,C)}else{if(!ve(x))throw new TypeError;if(!X(C))throw new TypeError;if(!X(U)&&!G(U)&&!te(U))throw new TypeError;return te(U)&&(U=void 0),F=me(F),re(x,C,F,U)}}a(v,"decorate"),e("decorate",v);function I(x,C){function F(U,he){if(!X(U))throw new TypeError;if(!G(he)&&!Re(he))throw new TypeError;q(x,C,U,he)}return a(F,"decorator"),F}a(I,"metadata"),e("metadata",I);function A(x,C,F,U){if(!X(F))throw new TypeError;return G(U)||(U=me(U)),q(x,C,F,U)}a(A,"defineMetadata"),e("defineMetadata",A);function T(x,C,F){if(!X(C))throw new TypeError;return G(F)||(F=me(F)),Y(x,C,F)}a(T,"hasMetadata"),e("hasMetadata",T);function R(x,C,F){if(!X(C))throw new TypeError;return G(F)||(F=me(F)),ye(x,C,F)}a(R,"hasOwnMetadata"),e("hasOwnMetadata",R);function V(x,C,F){if(!X(C))throw new TypeError;return G(F)||(F=me(F)),de(x,C,F)}a(V,"getMetadata"),e("getMetadata",V);function L(x,C,F){if(!X(C))throw new TypeError;return G(F)||(F=me(F)),le(x,C,F)}a(L,"getOwnMetadata"),e("getOwnMetadata",L);function P(x,C){if(!X(x))throw new TypeError;return G(C)||(C=me(C)),M(x,C)}a(P,"getMetadataKeys"),e("getMetadataKeys",P);function k(x,C){if(!X(x))throw new TypeError;return G(C)||(C=me(C)),je(x,C)}a(k,"getOwnMetadataKeys"),e("getOwnMetadataKeys",k);function O(x,C,F){if(!X(C))throw new TypeError;if(G(F)||(F=me(F)),!X(C))throw new TypeError;G(F)||(F=me(F));var U=xe(C,F,!1);return G(U)?!1:U.OrdinaryDeleteMetadata(x,C,F)}a(O,"deleteMetadata"),e("deleteMetadata",O);function J(x,C){for(var F=x.length-1;F>=0;--F){var U=x[F],he=U(C);if(!G(he)&&!te(he)){if(!pe(he))throw new TypeError;C=he}}return C}a(J,"DecorateConstructor");function re(x,C,F,U){for(var he=x.length-1;he>=0;--he){var At=x[he],Ot=At(C,F,U);if(!G(Ot)&&!te(Ot)){if(!X(Ot))throw new TypeError;U=Ot}}return U}a(re,"DecorateProperty");function Y(x,C,F){var U=ye(x,C,F);if(U)return!0;var he=Oe(C);return te(he)?!1:Y(x,he,F)}a(Y,"OrdinaryHasMetadata");function ye(x,C,F){var U=xe(C,F,!1);return G(U)?!1:$(U.OrdinaryHasOwnMetadata(x,C,F))}a(ye,"OrdinaryHasOwnMetadata");function de(x,C,F){var U=ye(x,C,F);if(U)return le(x,C,F);var he=Oe(C);if(!te(he))return de(x,he,F)}a(de,"OrdinaryGetMetadata");function le(x,C,F){var U=xe(C,F,!1);if(!G(U))return U.OrdinaryGetOwnMetadata(x,C,F)}a(le,"OrdinaryGetOwnMetadata");function q(x,C,F,U){var he=xe(F,U,!0);he.OrdinaryDefineOwnMetadata(x,C,F,U)}a(q,"OrdinaryDefineOwnMetadata");function M(x,C){var F=je(x,C),U=Oe(x);if(U===null)return F;var he=M(U,C);if(he.length<=0)return F;if(F.length<=0)return he;for(var At=new p,Ot=[],ze=0,ne=F;ze<ne.length;ze++){var ie=ne[ze],ae=At.has(ie);ae||(At.add(ie),Ot.push(ie))}for(var ue=0,We=he;ue<We.length;ue++){var ie=We[ue],ae=At.has(ie);ae||(At.add(ie),Ot.push(ie))}return Ot}a(M,"OrdinaryMetadataKeys");function je(x,C){var F=xe(x,C,!1);return F?F.OrdinaryOwnMetadataKeys(x,C):[]}a(je,"OrdinaryOwnMetadataKeys");function Q(x){if(x===null)return 1;switch(typeof x){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return x===null?1:6;default:return 6}}a(Q,"Type");function G(x){return x===void 0}a(G,"IsUndefined");function te(x){return x===null}a(te,"IsNull");function Se(x){return typeof x=="symbol"}a(Se,"IsSymbol");function X(x){return typeof x=="object"?x!==null:typeof x=="function"}a(X,"IsObject");function $e(x,C){switch(Q(x)){case 0:return x;case 1:return x;case 2:return x;case 3:return x;case 4:return x;case 5:return x}var F=C===3?"string":C===5?"number":"default",U=Z(x,s);if(U!==void 0){var he=U.call(x,F);if(X(he))throw new TypeError;return he}return Be(x,F==="default"?"number":F)}a($e,"ToPrimitive");function Be(x,C){if(C==="string"){var F=x.toString;if(be(F)){var U=F.call(x);if(!X(U))return U}var he=x.valueOf;if(be(he)){var U=he.call(x);if(!X(U))return U}}else{var he=x.valueOf;if(be(he)){var U=he.call(x);if(!X(U))return U}var At=x.toString;if(be(At)){var U=At.call(x);if(!X(U))return U}}throw new TypeError}a(Be,"OrdinaryToPrimitive");function $(x){return!!x}a($,"ToBoolean");function ee(x){return""+x}a(ee,"ToString");function me(x){var C=$e(x,3);return Se(C)?C:ee(C)}a(me,"ToPropertyKey");function ve(x){return Array.isArray?Array.isArray(x):x instanceof Object?x instanceof Array:Object.prototype.toString.call(x)==="[object Array]"}a(ve,"IsArray");function be(x){return typeof x=="function"}a(be,"IsCallable");function pe(x){return typeof x=="function"}a(pe,"IsConstructor");function Re(x){switch(Q(x)){case 3:return!0;case 4:return!0;default:return!1}}a(Re,"IsPropertyKey");function B(x,C){return x===C||x!==x&&C!==C}a(B,"SameValueZero");function Z(x,C){var F=x[C];if(F!=null){if(!be(F))throw new TypeError;return F}}a(Z,"GetMethod");function oe(x){var C=Z(x,o);if(!be(C))throw new TypeError;var F=C.call(x);if(!X(F))throw new TypeError;return F}a(oe,"GetIterator");function ge(x){return x.value}a(ge,"IteratorValue");function Ae(x){var C=x.next();return C.done?!1:C}a(Ae,"IteratorStep");function Ie(x){var C=x.return;C&&C.call(x)}a(Ie,"IteratorClose");function Oe(x){var C=Object.getPrototypeOf(x);if(typeof x!="function"||x===d||C!==d)return C;var F=x.prototype,U=F&&Object.getPrototypeOf(F);if(U==null||U===Object.prototype)return C;var he=U.constructor;return typeof he!="function"||he===x?C:he}a(Oe,"OrdinaryGetPrototypeOf");function Fe(){var x;!G(y)&&typeof t.Reflect<"u"&&!(y in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(x=Ne(t.Reflect));var C,F,U,he=new g,At={registerProvider:Ot,getProvider:ne,setProvider:ae};return At;function Ot(ue){if(!Object.isExtensible(At))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case x===ue:break;case G(C):C=ue;break;case C===ue:break;case G(F):F=ue;break;case F===ue:break;default:U===void 0&&(U=new p),U.add(ue);break}}function ze(ue,We){if(!G(C)){if(C.isProviderFor(ue,We))return C;if(!G(F)){if(F.isProviderFor(ue,We))return C;if(!G(U))for(var lt=oe(U);;){var ut=Ae(lt);if(!ut)return;var Mr=ge(ut);if(Mr.isProviderFor(ue,We))return Ie(lt),Mr}}}if(!G(x)&&x.isProviderFor(ue,We))return x}function ne(ue,We){var lt=he.get(ue),ut;return G(lt)||(ut=lt.get(We)),G(ut)&&(ut=ze(ue,We),G(ut)||(G(lt)&&(lt=new h,he.set(ue,lt)),lt.set(We,ut))),ut}function ie(ue){if(G(ue))throw new TypeError;return C===ue||F===ue||!G(U)&&U.has(ue)}function ae(ue,We,lt){if(!ie(lt))throw new Error("Metadata provider not registered.");var ut=ne(ue,We);if(ut!==lt){if(!G(ut))return!1;var Mr=he.get(ue);G(Mr)&&(Mr=new h,he.set(ue,Mr)),Mr.set(We,lt)}return!0}}a(Fe,"CreateMetadataRegistry");function De(){var x;return!G(y)&&X(t.Reflect)&&Object.isExtensible(t.Reflect)&&(x=t.Reflect[y]),G(x)&&(x=Fe()),!G(y)&&X(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:x}),x}a(De,"GetOrCreateMetadataRegistry");function Le(x){var C=new g,F={isProviderFor:a(function(ie,ae){var ue=C.get(ie);return G(ue)?!1:ue.has(ae)},"isProviderFor"),OrdinaryDefineOwnMetadata:Ot,OrdinaryHasOwnMetadata:he,OrdinaryGetOwnMetadata:At,OrdinaryOwnMetadataKeys:ze,OrdinaryDeleteMetadata:ne};return b.registerProvider(F),F;function U(ie,ae,ue){var We=C.get(ie),lt=!1;if(G(We)){if(!ue)return;We=new h,C.set(ie,We),lt=!0}var ut=We.get(ae);if(G(ut)){if(!ue)return;if(ut=new h,We.set(ae,ut),!x.setProvider(ie,ae,F))throw We.delete(ae),lt&&C.delete(ie),new Error("Wrong provider for target.")}return ut}a(U,"GetOrCreateMetadataMap");function he(ie,ae,ue){var We=U(ae,ue,!1);return G(We)?!1:$(We.has(ie))}a(he,"OrdinaryHasOwnMetadata");function At(ie,ae,ue){var We=U(ae,ue,!1);if(!G(We))return We.get(ie)}a(At,"OrdinaryGetOwnMetadata");function Ot(ie,ae,ue,We){var lt=U(ue,We,!0);lt.set(ie,ae)}a(Ot,"OrdinaryDefineOwnMetadata");function ze(ie,ae){var ue=[],We=U(ie,ae,!1);if(G(We))return ue;for(var lt=We.keys(),ut=oe(lt),Mr=0;;){var On=Ae(ut);if(!On)return ue.length=Mr,ue;var Qn=ge(On);try{ue[Mr]=Qn}catch(fn){try{Ie(ut)}finally{throw fn}}Mr++}}a(ze,"OrdinaryOwnMetadataKeys");function ne(ie,ae,ue){var We=U(ae,ue,!1);if(G(We)||!We.delete(ie))return!1;if(We.size===0){var lt=C.get(ae);G(lt)||(lt.delete(ue),lt.size===0&&C.delete(lt))}return!0}a(ne,"OrdinaryDeleteMetadata")}a(Le,"CreateMetadataProvider");function Ne(x){var C=x.defineMetadata,F=x.hasOwnMetadata,U=x.getOwnMetadata,he=x.getOwnMetadataKeys,At=x.deleteMetadata,Ot=new g,ze={isProviderFor:a(function(ne,ie){var ae=Ot.get(ne);return!G(ae)&&ae.has(ie)?!0:he(ne,ie).length?(G(ae)&&(ae=new p,Ot.set(ne,ae)),ae.add(ie),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:C,OrdinaryHasOwnMetadata:F,OrdinaryGetOwnMetadata:U,OrdinaryOwnMetadataKeys:he,OrdinaryDeleteMetadata:At};return ze}a(Ne,"CreateFallbackProvider");function xe(x,C,F){var U=b.getProvider(x,C);if(!G(U))return U;if(F){if(b.setProvider(x,C,S))return S;throw new Error("Illegal state.")}}a(xe,"GetMetadataProvider");function ke(){var x={},C=[],F=(function(){function ze(ne,ie,ae){this._index=0,this._keys=ne,this._values=ie,this._selector=ae}return a(ze,"MapIterator"),ze.prototype["@@iterator"]=function(){return this},ze.prototype[o]=function(){return this},ze.prototype.next=function(){var ne=this._index;if(ne>=0&&ne<this._keys.length){var ie=this._selector(this._keys[ne],this._values[ne]);return ne+1>=this._keys.length?(this._index=-1,this._keys=C,this._values=C):this._index++,{value:ie,done:!1}}return{value:void 0,done:!0}},ze.prototype.throw=function(ne){throw this._index>=0&&(this._index=-1,this._keys=C,this._values=C),ne},ze.prototype.return=function(ne){return this._index>=0&&(this._index=-1,this._keys=C,this._values=C),{value:ne,done:!0}},ze})(),U=(function(){function ze(){this._keys=[],this._values=[],this._cacheKey=x,this._cacheIndex=-2}return a(ze,"Map"),Object.defineProperty(ze.prototype,"size",{get:a(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),ze.prototype.has=function(ne){return this._find(ne,!1)>=0},ze.prototype.get=function(ne){var ie=this._find(ne,!1);return ie>=0?this._values[ie]:void 0},ze.prototype.set=function(ne,ie){var ae=this._find(ne,!0);return this._values[ae]=ie,this},ze.prototype.delete=function(ne){var ie=this._find(ne,!1);if(ie>=0){for(var ae=this._keys.length,ue=ie+1;ue<ae;ue++)this._keys[ue-1]=this._keys[ue],this._values[ue-1]=this._values[ue];return this._keys.length--,this._values.length--,B(ne,this._cacheKey)&&(this._cacheKey=x,this._cacheIndex=-2),!0}return!1},ze.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=x,this._cacheIndex=-2},ze.prototype.keys=function(){return new F(this._keys,this._values,he)},ze.prototype.values=function(){return new F(this._keys,this._values,At)},ze.prototype.entries=function(){return new F(this._keys,this._values,Ot)},ze.prototype["@@iterator"]=function(){return this.entries()},ze.prototype[o]=function(){return this.entries()},ze.prototype._find=function(ne,ie){if(!B(this._cacheKey,ne)){this._cacheIndex=-1;for(var ae=0;ae<this._keys.length;ae++)if(B(this._keys[ae],ne)){this._cacheIndex=ae;break}}return this._cacheIndex<0&&ie&&(this._cacheIndex=this._keys.length,this._keys.push(ne),this._values.push(void 0)),this._cacheIndex},ze})();return U;function he(ze,ne){return ze}function At(ze,ne){return ne}function Ot(ze,ne){return[ze,ne]}}a(ke,"CreateMapPolyfill");function at(){var x=(function(){function C(){this._map=new h}return a(C,"Set"),Object.defineProperty(C.prototype,"size",{get:a(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),C.prototype.has=function(F){return this._map.has(F)},C.prototype.add=function(F){return this._map.set(F,F),this},C.prototype.delete=function(F){return this._map.delete(F)},C.prototype.clear=function(){this._map.clear()},C.prototype.keys=function(){return this._map.keys()},C.prototype.values=function(){return this._map.keys()},C.prototype.entries=function(){return this._map.entries()},C.prototype["@@iterator"]=function(){return this.keys()},C.prototype[o]=function(){return this.keys()},C})();return x}a(at,"CreateSetPolyfill");function Ze(){var x=16,C=f.create(),F=U();return(function(){function ne(){this._key=U()}return a(ne,"WeakMap"),ne.prototype.has=function(ie){var ae=he(ie,!1);return ae!==void 0?f.has(ae,this._key):!1},ne.prototype.get=function(ie){var ae=he(ie,!1);return ae!==void 0?f.get(ae,this._key):void 0},ne.prototype.set=function(ie,ae){var ue=he(ie,!0);return ue[this._key]=ae,this},ne.prototype.delete=function(ie){var ae=he(ie,!1);return ae!==void 0?delete ae[this._key]:!1},ne.prototype.clear=function(){this._key=U()},ne})();function U(){var ne;do ne="@@WeakMap@@"+ze();while(f.has(C,ne));return C[ne]=!0,ne}function he(ne,ie){if(!r.call(ne,F)){if(!ie)return;Object.defineProperty(ne,F,{value:f.create()})}return ne[F]}function At(ne,ie){for(var ae=0;ae<ie;++ae)ne[ae]=Math.random()*255|0;return ne}function Ot(ne){if(typeof Uint8Array=="function"){var ie=new Uint8Array(ne);return typeof crypto<"u"?crypto.getRandomValues(ie):typeof msCrypto<"u"?msCrypto.getRandomValues(ie):At(ie,ne),ie}return At(new Array(ne),ne)}function ze(){var ne=Ot(x);ne[6]=ne[6]&79|64,ne[8]=ne[8]&191|128;for(var ie="",ae=0;ae<x;++ae){var ue=ne[ae];(ae===4||ae===6||ae===8)&&(ie+="-"),ue<16&&(ie+="0"),ie+=ue.toString(16).toLowerCase()}return ie}}a(Ze,"CreateWeakMapPolyfill");function Je(x){return x.__=void 0,delete x.__,x}a(Je,"MakeDictionary")})})(ax||(ax={}))});var hf=w(Jb=>{var Kh=class extends Error{static{a(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}},Xb=class extends Kh{static{a(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Jb.CommanderError=Kh;Jb.InvalidArgumentError=Xb});var Yh=w(e_=>{var{InvalidArgumentError:E9}=hf(),Zb=class{static{a(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 E9(`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 T9(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}a(T9,"humanReadableArgName");e_.Argument=Zb;e_.humanReadableArgName=T9});var n_=w(r_=>{var{humanReadableArgName:A9}=Yh(),t_=class{static{a(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=a(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=>A9(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 o=r(s);i.has(o)||i.set(o,[])}),t.forEach(s=>{let o=r(s);i.has(o)||i.set(o,[]),i.get(o).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(d,h){return t.formatItem(d,r,h,t)}a(s,"callFormatItem");let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],c=t.commandDescription(e);c.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(c),i),""]));let l=t.visibleArguments(e).map(d=>s(t.styleArgumentTerm(t.argumentTerm(d)),t.styleArgumentDescription(t.argumentDescription(d))));if(o=o.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,h)=>{let p=d.map(g=>s(t.styleOptionTerm(t.optionTerm(g)),t.styleOptionDescription(t.optionDescription(g))));o=o.concat(this.formatItemList(h,p,t))}),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(h=>s(t.styleOptionTerm(t.optionTerm(h)),t.styleOptionDescription(t.optionDescription(h))));o=o.concat(this.formatItemList("Global Options:",d,t))}return this.groupItems(e.commands,t.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,h)=>{let p=d.map(g=>s(t.styleSubcommandTerm(t.subcommandTerm(g)),t.styleSubcommandDescription(t.subcommandDescription(g))));o=o.concat(this.formatItemList(h,p,t))}),o.join(`
|
|
7
7
|
`)}displayWidth(e){return cx(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 o=" ".repeat(2);if(!r)return o+e;let c=e.padEnd(t+e.length-i.displayWidth(e)),l=2,f=(this.helpWidth??80)-t-l-2,d;return f<this.minWidthToWrap||i.preformatted(r)?d=r:d=i.boxWrap(r,f).replace(/\n/g,`
|
|
8
8
|
`+" ".repeat(t+l)),o+c+" ".repeat(l)+d.replace(/\n/g,`
|
|
9
9
|
${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let r=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,s=[];return r.forEach(o=>{let c=o.match(i);if(c===null){s.push("");return}let l=[c.shift()],u=this.displayWidth(l[0]);c.forEach(f=>{let d=this.displayWidth(f);if(u+d<=t){l.push(f),u+=d;return}s.push(l.join(""));let h=f.trimStart();l=[h],u=this.displayWidth(h)}),s.push(l.join(""))}),s.join(`
|
|
@@ -30,10 +30,10 @@ Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
30
30
|
Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,s=>{let o;typeof t=="function"?o=t({error:s.error,command:s.command}):o=t,o&&s.write(`${o}
|
|
31
31
|
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function px(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})}a(px,"incrementNodeInspectorPort");function f_(){if(dt.env.NO_COLOR||dt.env.FORCE_COLOR==="0"||dt.env.FORCE_COLOR==="false")return!1;if(dt.env.FORCE_COLOR||dt.env.CLICOLOR_FORCE!==void 0)return!0}a(f_,"useColor");d_.Command=u_;d_.useColor=f_});var _x=w(ui=>{var{Argument:gx}=Yh(),{Command:h_}=mx(),{CommanderError:k9,InvalidArgumentError:yx}=hf(),{Help:M9}=n_(),{Option:bx}=a_();ui.program=new h_;ui.createCommand=n=>new h_(n);ui.createOption=(n,e)=>new bx(n,e);ui.createArgument=(n,e)=>new gx(n,e);ui.Command=h_;ui.Option=bx;ui.Argument=gx;ui.Help=M9;ui.CommanderError=k9;ui.InvalidArgumentError=yx;ui.InvalidOptionArgumentError=yx});var rl=w(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.AssetClass=void 0;var wx;(function(n){n.AREA="ems__Area",n.TASK="ems__Task",n.PROJECT="ems__Project",n.MEETING="ems__Meeting",n.INITIATIVE="ems__Initiative",n.TASK_PROTOTYPE="ems__TaskPrototype",n.MEETING_PROTOTYPE="ems__MeetingPrototype",n.EVENT_PROTOTYPE="exo__EventPrototype",n.PROJECT_PROTOTYPE="ems__ProjectPrototype",n.EVENT="exo__Event",n.DAILY_NOTE="pn__DailyNote",n.CONCEPT="ims__Concept",n.SESSION_START_EVENT="ems__SessionStartEvent",n.SESSION_END_EVENT="ems__SessionEndEvent",n.PROTOTYPE="exo__Prototype",n.CLASS="exo__Class",n.FLEETING_NOTE="ztlk__FleetingNote",n.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition",n.COMMAND="exocmd__Command",n.PRECONDITION="exocmd__Precondition",n.GROUNDING="exocmd__Grounding",n.COMMAND_BINDING="exocmd__CommandBinding"})(wx||(Xh.AssetClass=wx={}))});var nl=w(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.EffortStatus=void 0;var vx;(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"})(vx||(Jh.EffortStatus=vx={}))});var p_=w(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.EFFORT_STATUS_OPTIONS=void 0;Zh.EFFORT_STATUS_OPTIONS=[{value:"[[ems__EffortStatusDraft]]",label:"Draft"},{value:"[[ems__EffortStatusBacklog]]",label:"Backlog"},{value:"[[ems__EffortStatusAnalysis]]",label:"Analysis"},{value:"[[ems__EffortStatusToDo]]",label:"To Do"},{value:"[[ems__EffortStatusDoing]]",label:"Doing"},{value:"[[ems__EffortStatusDone]]",label:"Done"},{value:"[[ems__EffortStatusTrashed]]",label:"Trashed"}]});var Yo=w(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});ep.GroundingType=void 0;var Ex;(function(n){n.SPARQL_UPDATE="sparql_update",n.PROPERTY_DELETE="property_delete",n.PROPERTY_SET="property_set",n.COMPOSITE="composite",n.SERVICE_CALL="service_call",n.CREATE_INSTANCE="create_instance",n.PROPERTY_APPEND="property_append",n.PROPERTY_INCREMENT="property_increment",n.PROPERTY_SHIFT="property_shift",n.WORKFLOW_TRANSITION="workflow_transition",n.BODY_TEMPLATE="body_template"})(Ex||(ep.GroundingType=Ex={}))});var pf=w(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.GROUNDING_TYPE_IRI_TO_ENUM=Fn.GROUNDING_TYPE_UID_TO_ENUM=Fn.GROUNDING_TYPE_UIDS=void 0;Fn.resolveGroundingTypeFromIRI=$9;Fn.resolveGroundingTypeFromWikilinkLiteral=U9;var Wt=Yo();Fn.GROUNDING_TYPE_UIDS={[Wt.GroundingType.PROPERTY_SET]:"cf3bb923-f1f1-40be-b728-782844402426",[Wt.GroundingType.PROPERTY_DELETE]:"4bdf1d0b-e9da-4d96-bafe-c5aaef8c2bd5",[Wt.GroundingType.COMPOSITE]:"8f9a57db-3865-4886-92fb-c5ab7f3c3fa3",[Wt.GroundingType.SERVICE_CALL]:"9bf9fc99-ac37-4e51-b9f5-bd920099947c",[Wt.GroundingType.CREATE_INSTANCE]:"4367e2d6-6c92-450a-becb-abce1fb07682",[Wt.GroundingType.PROPERTY_APPEND]:"572f7e69-a8a1-42f6-8113-5aa65cc4b552",[Wt.GroundingType.PROPERTY_INCREMENT]:"afc29f90-45eb-4f94-9fe2-2ce738759161",[Wt.GroundingType.PROPERTY_SHIFT]:"f4e5266f-f3cc-49fd-a5a5-ce1e8b7847a4",[Wt.GroundingType.SPARQL_UPDATE]:"79c3e709-8d1d-4694-bcc6-b9ff07d59b86",[Wt.GroundingType.WORKFLOW_TRANSITION]:"5c1a2552-d576-496d-8823-563573dd1e2f",[Wt.GroundingType.BODY_TEMPLATE]:"6093bfcb-cf9b-4565-86c3-ff74d8bc11c0"};Fn.GROUNDING_TYPE_UID_TO_ENUM=Object.freeze(Object.fromEntries(Object.entries(Fn.GROUNDING_TYPE_UIDS).map(([n,e])=>[e,n])));var Ai="https://exocortex.my/ontology/exocmd#";Fn.GROUNDING_TYPE_IRI_TO_ENUM=Object.freeze({[`${Ai}GroundingTypePropertySet`]:Wt.GroundingType.PROPERTY_SET,[`${Ai}GroundingTypePropertyDelete`]:Wt.GroundingType.PROPERTY_DELETE,[`${Ai}GroundingTypeComposite`]:Wt.GroundingType.COMPOSITE,[`${Ai}GroundingTypeServiceCall`]:Wt.GroundingType.SERVICE_CALL,[`${Ai}GroundingTypeCreateInstance`]:Wt.GroundingType.CREATE_INSTANCE,[`${Ai}GroundingTypePropertyAppend`]:Wt.GroundingType.PROPERTY_APPEND,[`${Ai}GroundingTypePropertyIncrement`]:Wt.GroundingType.PROPERTY_INCREMENT,[`${Ai}GroundingTypePropertyShift`]:Wt.GroundingType.PROPERTY_SHIFT,[`${Ai}GroundingTypeSparqlUpdate`]:Wt.GroundingType.SPARQL_UPDATE,[`${Ai}GroundingTypeWorkflowTransition`]:Wt.GroundingType.WORKFLOW_TRANSITION,[`${Ai}GroundingTypeBodyTemplate`]:Wt.GroundingType.BODY_TEMPLATE});var j9=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;function $9(n){let e=Fn.GROUNDING_TYPE_IRI_TO_ENUM[n];if(e!==void 0)return e;let t=n.match(j9);return t?Fn.GROUNDING_TYPE_UID_TO_ENUM[t[1].toLowerCase()]??null:null}a($9,"resolveGroundingTypeFromIRI");function U9(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?Fn.GROUNDING_TYPE_UID_TO_ENUM[e[1].toLowerCase()]??null:null}a(U9,"resolveGroundingTypeFromWikilinkLiteral")});var m_=w(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.CommandBindingStyleProperty=fi.CommandBindingProperty=fi.GroundingProperty=fi.PreconditionProperty=fi.CommandProperty=void 0;fi.CommandProperty={ICON:"exocmd__Command_icon",PRECONDITION:"exocmd__Command_precondition",GROUNDING:"exocmd__Command_grounding",CONFIRM_MESSAGE:"exocmd__Command_confirmMessage",SUCCESS_MESSAGE:"exocmd__Command_successMessage",CATEGORY:"exocmd__Command_category",OPEN_IN_SAME_TAB:"exocmd__Command_openInSameTab"};fi.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};fi.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",STEPS:"exocmd__Grounding_steps",IS_DEFINED_BY:"exocmd__Grounding_isDefinedBy",LABEL_TEMPLATE:"exocmd__Grounding_labelTemplate"};fi.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};fi.CommandBindingStyleProperty={VARIANT:"exocmd__CommandBindingStyle_variant",SHOW_ICON:"exocmd__CommandBindingStyle_showIcon",LABEL_CLASS:"exocmd__CommandBindingStyle_labelClass",ARIA_LABEL:"exocmd__CommandBindingStyle_ariaLabel",TOOLTIP:"exocmd__CommandBindingStyle_tooltip",KEYBOARD_SHORTCUT:"exocmd__CommandBindingStyle_keyboardShortcut",SOURCE:"exocmd__CommandBindingStyle_source"}});var g_=w(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.STYLE_SOURCE_VALUES=Dn.LABEL_CLASS_VALUES=Dn.COMMAND_VARIANT_VALUES=void 0;Dn.isCommandVariant=B9;Dn.isLabelClass=V9;Dn.isStyleSource=q9;Dn.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);Dn.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);Dn.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function B9(n){return typeof n=="string"&&Dn.COMMAND_VARIANT_VALUES.includes(n)}a(B9,"isCommandVariant");function V9(n){return typeof n=="string"&&Dn.LABEL_CLASS_VALUES.includes(n)}a(V9,"isLabelClass");function q9(n){return typeof n=="string"&&Dn.STYLE_SOURCE_VALUES.includes(n)}a(q9,"isStyleSource")});var Tx=w(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.isCommandFrontmatter=G9;il.isPreconditionFrontmatter=W9;il.isGroundingFrontmatter=H9;il.isCommandBindingFrontmatter=z9;function G9(n){return tp(n,"exocmd__Command")}a(G9,"isCommandFrontmatter");function W9(n){return tp(n,"exocmd__Precondition")}a(W9,"isPreconditionFrontmatter");function H9(n){return tp(n,"exocmd__Grounding")}a(H9,"isGroundingFrontmatter");function z9(n){return tp(n,"exocmd__CommandBinding")}a(z9,"isCommandBindingFrontmatter");function tp(n,e){let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}a(tp,"hasInstanceClass")});var Ax=w(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});b_.parseGroundingDefinitionFromFrontmatter=Y9;var K9=pf();function y_(n){if(typeof n!="string")return"";let e=n.replace(/["'[\]]/g,"").trim(),t=e.indexOf("|");return t>=0?e.slice(0,t).trim():e}a(y_,"normalizeGroundingRef");function Y9(n,e,t){let r=e.exocmd__Grounding_type,i=(()=>{if(typeof r!="string")return r;let p=(0,K9.resolveGroundingTypeFromWikilinkLiteral)(r);if(p!==null)return p;throw new Error(`[exocmd-grounding-type-literal-form] legacy literal-string '${r}' for exocmd__Grounding_type in fixture ${n}. Migrate to wikilink form per RFC 9d20c91f Phase 3.`)})(),s=i==="service_call"?e.exocmd__Grounding_serviceId??e.exocmd__Grounding_targetProperty:e.exocmd__Grounding_targetProperty,o;if(i==="composite"){let p=e.exocmd__Grounding_steps;Array.isArray(p)&&(o=p.map(g=>t(y_(g))))}let c=e.exocmd__Grounding_incrementBy,l;if(c!=null&&c!==""){let p=Number.parseInt(String(c),10);Number.isFinite(p)&&(l=p)}let u=e.exocmd__Grounding_targetValueRef,f=u?y_(u):void 0,d=e.exocmd__Grounding_templateRef,h=d?y_(d):void 0;return{id:n,label:e.exo__Asset_label??"",type:i,targetProperty:s,targetValueRef:f,targetValueLiteral:e.exocmd__Grounding_targetValueLiteral,targetValueSubstitution:e.exocmd__Grounding_targetValueSubstitution,serviceCallPayload:e.exocmd__Grounding_serviceCallPayload,appendExpression:e.exocmd__Grounding_appendExpression,targetClass:e.exocmd__Grounding_targetClass,targetPrototype:e.exocmd__Grounding_targetPrototype,targetFolder:e.exocmd__Grounding_targetFolder,shiftDelta:e.exocmd__Grounding_shiftDelta,incrementBy:l,linkBackProperty:e.exocmd__Grounding_linkBackProperty,bodyTemplate:e.exocmd__Grounding_bodyTemplate,templateRef:h,steps:o}}a(Y9,"parseGroundingDefinitionFromFrontmatter")});var Ix=w(rp=>{"use strict";Object.defineProperty(rp,"__esModule",{value:!0});rp.hasPosition=Q9;rp.isFixed=X9;function Q9(n){return typeof n.x=="number"&&typeof n.y=="number"}a(Q9,"hasPosition");function X9(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}a(X9,"isFixed")});var xx=w(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.createEmptyGraphData=J9;np.mergeGraphData=Z9;function J9(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}a(J9,"createEmptyGraphData");function Z9(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 o=`${s.source}->${s.target}:${s.type}`;r.has(o)||(r.add(o),i.push(s))}for(let s of e.edges){let o=`${s.source}->${s.target}:${s.type}`;r.has(o)||(r.add(o),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}a(Z9,"mergeGraphData")});var __=w(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.createEdgeId=e5;ip.edgesEqual=t5;function e5(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}a(e5,"createEdgeId");function t5(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}a(t5,"edgesEqual")});var S_=w(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.BUILT_IN_EDGE_STYLES=Ht.BUILT_IN_NODE_STYLES=Ht.DEFAULT_EDGE_STYLE=Ht.DEFAULT_NODE_STYLE=Ht.RDF_TYPE_PREDICATES=void 0;Ht.mergeNodeStyles=r5;Ht.mergeEdgeStyles=n5;Ht.extractLocalName=i5;Ht.isClassType=s5;Ht.isTypePredicate=o5;Ht.isSubClassPredicate=a5;Ht.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"};Ht.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Ht.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Ht.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"},person__Person:{color:"#06b6d4",shape:"circle"},ims__Person:{color:"#06b6d4",shape:"circle"}};Ht.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 r5(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}a(r5,"mergeNodeStyles");function n5(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}a(n5,"mergeEdgeStyles");function i5(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}a(i5,"extractLocalName");function s5(n){return n===Ht.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Ht.RDF_TYPE_PREDICATES.OWL_CLASS}a(s5,"isClassType");function o5(n){return n===Ht.RDF_TYPE_PREDICATES.RDF_TYPE}a(o5,"isTypePredicate");function a5(n){return n===Ht.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}a(a5,"isSubClassPredicate")});var Cx=w(Rx=>{"use strict";Object.defineProperty(Rx,"__esModule",{value:!0})});var Pe=w(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.IRI=void 0;var w_=class n{static{a(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)}}};sp.IRI=w_});var Ge=w(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});Ya.Literal=void 0;Ya.parseLanguageTag=Ox;Ya.createDirectionalLiteral=l5;Ya.createLiteralFromLanguageTag=u5;var c5="http://www.w3.org/2001/XMLSchema#string",mf=class{static{a(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===c5?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}};Ya.Literal=mf;function Ox(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()}}a(Ox,"parseLanguageTag");function l5(n,e,t){return new mf(n,void 0,e,t)}a(l5,"createDirectionalLiteral");function u5(n,e){let{language:t,direction:r}=Ox(e);return new mf(n,void 0,t,r)}a(u5,"createLiteralFromLanguageTag")});var jt=w(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.BlankNode=void 0;var op=class n{static{a(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())}};ap.BlankNode=op;op.counter=0});var zt=w(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});cp.Namespace=void 0;var Px=Pe(),Qe=class n{static{a(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new Px.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new Px.IRI(`${this._iri.value}${e}`)}expand(e){let t=e.split(":");if(t.length!==2)return null;let[r,i]=t;return r!==this._prefix?null:this.term(i)}static forPrefix(e){if(!/^[a-z][a-zA-Z0-9]*$/.test(e))return null;let t=n.KNOWN_NAMESPACES.find(r=>r.prefix===e);return t||new n(e,`${n.EXOCORTEX_ONTOLOGY_BASE}${e}#`)}static fromPropertyKey(e){let t=/^([a-z][a-zA-Z0-9]*)__(.+)$/.exec(e);if(!t)return null;let r=n.forPrefix(t[1]);return r?{namespace:r,localName:t[2]}:null}};cp.Namespace=Qe;Qe.RDF=new Qe("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");Qe.RDFS=new Qe("rdfs","http://www.w3.org/2000/01/rdf-schema#");Qe.OWL=new Qe("owl","http://www.w3.org/2002/07/owl#");Qe.XSD=new Qe("xsd","http://www.w3.org/2001/XMLSchema#");Qe.EXO=new Qe("exo","https://exocortex.my/ontology/exo#");Qe.EMS=new Qe("ems","https://exocortex.my/ontology/ems#");Qe.EXOCMD=new Qe("exocmd","https://exocortex.my/ontology/exocmd#");Qe.IMS=new Qe("ims","https://exocortex.my/ontology/ims#");Qe.ZTLK=new Qe("ztlk","https://exocortex.my/ontology/ztlk#");Qe.PTMS=new Qe("ptms","https://exocortex.my/ontology/ptms#");Qe.LIT=new Qe("lit","https://exocortex.my/ontology/lit#");Qe.INBOX=new Qe("inbox","https://exocortex.my/ontology/inbox#");Qe.PMBOK=new Qe("pmbok","https://exocortex.my/ontology/pmbok#");Qe.EXOCORTEX_ONTOLOGY_BASE="https://exocortex.my/ontology/";Qe.KNOWN_NAMESPACES=[Qe.EXO,Qe.EMS,Qe.EXOCMD,Qe.IMS,Qe.ZTLK,Qe.PTMS,Qe.LIT,Qe.INBOX,Qe.PMBOK]});var Xn=w(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.Triple=void 0;var v_=Pe(),E_=Ge(),T_=jt(),A_=class{static{a(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 v_.IRI&&t instanceof v_.IRI||e instanceof T_.BlankNode&&t instanceof T_.BlankNode||e instanceof E_.Literal&&t instanceof E_.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 v_.IRI?`<${e.value}>`:e instanceof T_.BlankNode||e instanceof E_.Literal||this.isQuotedTriple(e)?e.toString():""}};lp.Triple=A_});var gf=w(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});up.QuotedTriple=void 0;var I_=Pe(),x_=Ge(),R_=jt(),C_=class n{static{a(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 I_.IRI&&t instanceof I_.IRI||e instanceof R_.BlankNode&&t instanceof R_.BlankNode||e instanceof x_.Literal&&t instanceof x_.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 I_.IRI?`<${e.value}>`:e instanceof R_.BlankNode||e instanceof x_.Literal||e instanceof n?e.toString():""}};up.QuotedTriple=C_});var Fx=w(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.QuotedTriple=or.Triple=or.Namespace=or.BlankNode=or.createLiteralFromLanguageTag=or.createDirectionalLiteral=or.parseLanguageTag=or.Literal=or.IRI=void 0;var f5=Pe();Object.defineProperty(or,"IRI",{enumerable:!0,get:a(function(){return f5.IRI},"get")});var fp=Ge();Object.defineProperty(or,"Literal",{enumerable:!0,get:a(function(){return fp.Literal},"get")});Object.defineProperty(or,"parseLanguageTag",{enumerable:!0,get:a(function(){return fp.parseLanguageTag},"get")});Object.defineProperty(or,"createDirectionalLiteral",{enumerable:!0,get:a(function(){return fp.createDirectionalLiteral},"get")});Object.defineProperty(or,"createLiteralFromLanguageTag",{enumerable:!0,get:a(function(){return fp.createLiteralFromLanguageTag},"get")});var d5=jt();Object.defineProperty(or,"BlankNode",{enumerable:!0,get:a(function(){return d5.BlankNode},"get")});var h5=zt();Object.defineProperty(or,"Namespace",{enumerable:!0,get:a(function(){return h5.Namespace},"get")});var p5=Xn();Object.defineProperty(or,"Triple",{enumerable:!0,get:a(function(){return p5.Triple},"get")});var m5=gf();Object.defineProperty(or,"QuotedTriple",{enumerable:!0,get:a(function(){return m5.QuotedTriple},"get")})});var dp=w(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.UUID_URL_NAMESPACE=hi.DEFAULT_LANGUAGE_TAG=hi.REQUIRED_PROPERTIES=hi.ALLOWED_PROPERTIES=hi.Exo003MetadataType=void 0;var di;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(di||(hi.Exo003MetadataType=di={}));hi.ALLOWED_PROPERTIES={[di.Namespace]:["metadata","uri","aliases"],[di.Anchor]:["metadata","uri","aliases"],[di.BlankNode]:["metadata","uri","aliases"],[di.Statement]:["metadata","subject","predicate","object","aliases"],[di.Body]:["metadata","subject","predicate","aliases"]};hi.REQUIRED_PROPERTIES={[di.Namespace]:["metadata","uri"],[di.Anchor]:["metadata","uri"],[di.BlankNode]:["metadata","uri"],[di.Statement]:["metadata","subject","predicate","object"],[di.Body]:["metadata","subject","predicate"]};hi.DEFAULT_LANGUAGE_TAG="ru";hi.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var Dx=w(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});O_.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var Lx=w(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});P_.default="00000000-0000-0000-0000-000000000000"});var Nx=w(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});F_.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 yf=w(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});var g5=Nx();function y5(n){return typeof n=="string"&&g5.default.test(n)}a(y5,"validate");D_.default=y5});var bf=w(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});var b5=yf();function _5(n){if(!(0,b5.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)}a(_5,"parse");L_.default=_5});var ro=w(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.unsafeStringify=void 0;var S5=yf(),Ur=[];for(let n=0;n<256;++n)Ur.push((n+256).toString(16).slice(1));function kx(n,e=0){return(Ur[n[e+0]]+Ur[n[e+1]]+Ur[n[e+2]]+Ur[n[e+3]]+"-"+Ur[n[e+4]]+Ur[n[e+5]]+"-"+Ur[n[e+6]]+Ur[n[e+7]]+"-"+Ur[n[e+8]]+Ur[n[e+9]]+"-"+Ur[n[e+10]]+Ur[n[e+11]]+Ur[n[e+12]]+Ur[n[e+13]]+Ur[n[e+14]]+Ur[n[e+15]]).toLowerCase()}a(kx,"unsafeStringify");_f.unsafeStringify=kx;function w5(n,e=0){let t=kx(n,e);if(!(0,S5.default)(t))throw TypeError("Stringified UUID is invalid");return t}a(w5,"stringify");_f.default=w5});var mp=w(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});var v5=require("crypto"),pp=new Uint8Array(256),hp=pp.length;function E5(){return hp>pp.length-16&&((0,v5.randomFillSync)(pp),hp=0),pp.slice(hp,hp+=16)}a(E5,"rng");N_.default=E5});var k_=w(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.updateV1State=void 0;var Mx=mp(),T5=ro(),Sf={};function A5(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=jx(n.random??n.rng?.()??(0,Mx.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),o=(0,Mx.default)();$x(Sf,s,o),r=jx(o,Sf.msecs,Sf.nsecs,i?void 0:Sf.clockseq,i?void 0:Sf.node,e,t)}return e??(0,T5.unsafeStringify)(r)}a(A5,"v1");function $x(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}a($x,"updateV1State");wf.updateV1State=$x;function jx(n,e,t,r,i,s,o=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),o=0;else if(o<0||o+16>s.length)throw new RangeError(`UUID byte range ${o}:${o+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[o++]=c>>>24&255,s[o++]=c>>>16&255,s[o++]=c>>>8&255,s[o++]=c&255;let l=e/4294967296*1e4&268435455;s[o++]=l>>>8&255,s[o++]=l&255,s[o++]=l>>>24&15|16,s[o++]=l>>>16&255,s[o++]=r>>>8|128,s[o++]=r&255;for(let u=0;u<6;++u)s[o++]=i[u];return s}a(jx,"v1Bytes");wf.default=A5});var j_=w(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var I5=bf(),x5=ro();function R5(n){let e=typeof n=="string"?(0,I5.default)(n):n,t=C5(e);return typeof n=="string"?(0,x5.unsafeStringify)(t):t}a(R5,"v1ToV6");M_.default=R5;function C5(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])}a(C5,"_v1ToV6")});var Ux=w($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var O5=require("crypto");function P5(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,O5.createHash)("md5").update(n).digest()}a(P5,"md5");$_.default=P5});var vf=w(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.URL=no.DNS=no.stringToBytes=void 0;var Bx=bf(),F5=ro();function Vx(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}a(Vx,"stringToBytes");no.stringToBytes=Vx;no.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";no.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function D5(n,e,t,r,i,s){let o=typeof t=="string"?Vx(t):t,c=typeof r=="string"?(0,Bx.default)(r):r;if(typeof r=="string"&&(r=(0,Bx.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(c),l.set(o,c.length),l=e(l),l[6]=l[6]&15|n,l[8]=l[8]&63|128,i){if(s=s||0,s<0||s+16>i.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);for(let u=0;u<16;++u)i[s+u]=l[u];return i}return(0,F5.unsafeStringify)(l)}a(D5,"v35");no.default=D5});var Gx=w(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.URL=Qa.DNS=void 0;var L5=Ux(),U_=vf(),qx=vf();Object.defineProperty(Qa,"DNS",{enumerable:!0,get:a(function(){return qx.DNS},"get")});Object.defineProperty(Qa,"URL",{enumerable:!0,get:a(function(){return qx.URL},"get")});function B_(n,e,t,r){return(0,U_.default)(48,L5.default,n,e,t,r)}a(B_,"v3");B_.DNS=U_.DNS;B_.URL=U_.URL;Qa.default=B_});var Wx=w(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0});var N5=require("crypto");V_.default={randomUUID:N5.randomUUID}});var zx=w(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});var Hx=Wx(),k5=mp(),M5=ro();function j5(n,e,t){if(Hx.default.randomUUID&&!e&&!n)return Hx.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,k5.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,M5.unsafeStringify)(r)}a(j5,"v4");q_.default=j5});var Kx=w(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var $5=require("crypto");function U5(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,$5.createHash)("sha1").update(n).digest()}a(U5,"sha1");G_.default=U5});var Qx=w(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.URL=Xa.DNS=void 0;var B5=Kx(),W_=vf(),Yx=vf();Object.defineProperty(Xa,"DNS",{enumerable:!0,get:a(function(){return Yx.DNS},"get")});Object.defineProperty(Xa,"URL",{enumerable:!0,get:a(function(){return Yx.URL},"get")});function H_(n,e,t,r){return(0,W_.default)(80,B5.default,n,e,t,r)}a(H_,"v5");H_.DNS=W_.DNS;H_.URL=W_.URL;Xa.default=H_});var Xx=w(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var V5=ro(),q5=k_(),G5=j_();function W5(n,e,t){n??={},t??=0;let r=(0,q5.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,G5.default)(r),e){if(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,V5.unsafeStringify)(r)}a(W5,"v6");z_.default=W5});var Jx=w(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});var H5=bf(),z5=ro();function K5(n){let e=typeof n=="string"?(0,H5.default)(n):n,t=Y5(e);return typeof n=="string"?(0,z5.unsafeStringify)(t):t}a(K5,"v6ToV1");K_.default=K5;function Y5(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])}a(Y5,"_v6ToV1")});var rR=w(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.updateV7State=void 0;var Zx=mp(),Q5=ro(),Y_={};function X5(n,e,t){let r;if(n)r=eR(n.random??n.rng?.()??(0,Zx.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,Zx.default)();tR(Y_,i,s),r=eR(s,Y_.msecs,Y_.seq,e,t)}return e??(0,Q5.unsafeStringify)(r)}a(X5,"v7");function tR(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}a(tR,"updateV7State");Ef.updateV7State=tR;function eR(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}a(eR,"v7Bytes");Ef.default=X5});var nR=w(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});var J5=yf();function Z5(n){if(!(0,J5.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}a(Z5,"version");Q_.default=Z5});var Ii=w(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.version=ht.validate=ht.v7=ht.v6ToV1=ht.v6=ht.v5=ht.v4=ht.v3=ht.v1ToV6=ht.v1=ht.stringify=ht.parse=ht.NIL=ht.MAX=void 0;var e$=Dx();Object.defineProperty(ht,"MAX",{enumerable:!0,get:a(function(){return e$.default},"get")});var t$=Lx();Object.defineProperty(ht,"NIL",{enumerable:!0,get:a(function(){return t$.default},"get")});var r$=bf();Object.defineProperty(ht,"parse",{enumerable:!0,get:a(function(){return r$.default},"get")});var n$=ro();Object.defineProperty(ht,"stringify",{enumerable:!0,get:a(function(){return n$.default},"get")});var i$=k_();Object.defineProperty(ht,"v1",{enumerable:!0,get:a(function(){return i$.default},"get")});var s$=j_();Object.defineProperty(ht,"v1ToV6",{enumerable:!0,get:a(function(){return s$.default},"get")});var o$=Gx();Object.defineProperty(ht,"v3",{enumerable:!0,get:a(function(){return o$.default},"get")});var a$=zx();Object.defineProperty(ht,"v4",{enumerable:!0,get:a(function(){return a$.default},"get")});var c$=Qx();Object.defineProperty(ht,"v5",{enumerable:!0,get:a(function(){return c$.default},"get")});var l$=Xx();Object.defineProperty(ht,"v6",{enumerable:!0,get:a(function(){return l$.default},"get")});var u$=Jx();Object.defineProperty(ht,"v6ToV1",{enumerable:!0,get:a(function(){return u$.default},"get")});var f$=rR();Object.defineProperty(ht,"v7",{enumerable:!0,get:a(function(){return f$.default},"get")});var d$=yf();Object.defineProperty(ht,"validate",{enumerable:!0,get:a(function(){return d$.default},"get")});var h$=nR();Object.defineProperty(ht,"version",{enumerable:!0,get:a(function(){return h$.default},"get")})});var Z_=w(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.Exo003UUIDGenerator=void 0;var X_=Ii(),iR=dp(),J_=class{static{a(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,X_.v5)(e,iR.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,X_.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,X_.v5)(e,iR.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)}};gp.Exo003UUIDGenerator=J_});var oR=w(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.Exo003Parser=void 0;var St=dp(),Tf=Z_(),Qo=Pe(),yp=Ge(),sR=jt(),p$=Xn(),eS=class{static{a(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===St.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(St.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(St.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,o=St.ALLOWED_PROPERTIES[s],c=St.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))o.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case St.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case St.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case St.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case St.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case St.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 St.Exo003MetadataType.Namespace:return{...r,metadata:St.Exo003MetadataType.Namespace,uri:e.uri};case St.Exo003MetadataType.Anchor:return{...r,metadata:St.Exo003MetadataType.Anchor,uri:e.uri};case St.Exo003MetadataType.BlankNode:return{...r,metadata:St.Exo003MetadataType.BlankNode,uri:e.uri};case St.Exo003MetadataType.Statement:return{...r,metadata:St.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case St.Exo003MetadataType.Body:return{...r,metadata:St.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 Qo.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 Qo.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 Qo.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,o=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of o)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 Qo.IRI(i.value);else if(i.type==="blank")s=new sR.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let o=t(e.predicate);if(o.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new Qo.IRI(o.value),l=t(e.object),u;if(l.type==="iri")u=new Qo.IRI(l.value);else if(l.type==="blank")u=new sR.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new yp.Literal(f,new Qo.IRI(l.datatype));else{let d=l.language||St.DEFAULT_LANGUAGE_TAG;u=(0,yp.createDirectionalLiteral)(f,d,l.direction)}}return new p$.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new yp.Literal(t,new Qo.IRI(r.datatype));let i=r?.language||St.DEFAULT_LANGUAGE_TAG;return(0,yp.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(St.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case St.Exo003MetadataType.Namespace:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case St.Exo003MetadataType.Anchor:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case St.Exo003MetadataType.BlankNode:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case St.Exo003MetadataType.Statement:{let r=e;return Tf.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case St.Exo003MetadataType.Body:{let r=e;return Tf.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};bp.Exo003Parser=eS});var tS=w(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 Af=dp();Object.defineProperty(Yr,"Exo003MetadataType",{enumerable:!0,get:a(function(){return Af.Exo003MetadataType},"get")});Object.defineProperty(Yr,"ALLOWED_PROPERTIES",{enumerable:!0,get:a(function(){return Af.ALLOWED_PROPERTIES},"get")});Object.defineProperty(Yr,"REQUIRED_PROPERTIES",{enumerable:!0,get:a(function(){return Af.REQUIRED_PROPERTIES},"get")});Object.defineProperty(Yr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:a(function(){return Af.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(Yr,"UUID_URL_NAMESPACE",{enumerable:!0,get:a(function(){return Af.UUID_URL_NAMESPACE},"get")});var m$=Z_();Object.defineProperty(Yr,"Exo003UUIDGenerator",{enumerable:!0,get:a(function(){return m$.Exo003UUIDGenerator},"get")});var g$=oR();Object.defineProperty(Yr,"Exo003Parser",{enumerable:!0,get:a(function(){return g$.Exo003Parser},"get")})});var io=w(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.WikiLinkHelpers=void 0;var If=class{static{a(this,"WikiLinkHelpers")}static normalize(e){if(!e)return"";let t=e.replace(this.WIKI_LINK_PATTERN,"").trim();if(!t)return"";let r=t.indexOf("|");if(r===-1)return t;let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();return this.UUID_PATTERN.test(i)&&s||i}static normalizeArray(e){return e?(Array.isArray(e)?e:[e]).map(r=>this.normalize(r)).filter(r=>r.length>0):[]}static equals(e,t){return this.normalize(e)===this.normalize(t)}static includes(e,t){let r=this.normalizeArray(e),i=this.normalize(t);return r.includes(i)}static resolveSymbolic(e,t){let r=this.normalize(e);if(!r)return"";if(this.UUID_PATTERN.test(r)){let i=t(r);return i&&i.length>0?i:r}return r}static resolveSymbolicArray(e,t){return e?(Array.isArray(e)?e:[e]).map(i=>this.resolveSymbolic(i,t)).filter(i=>i.length>0):[]}};_p.WikiLinkHelpers=If;If.WIKI_LINK_PATTERN=/\[\[|\]\]/g;If.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var Xo=w(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.CommandBindingProperty=wt.GroundingProperty=wt.PreconditionProperty=wt.CommandProperty=wt.resolveGroundingTypeFromWikilinkLiteral=wt.resolveGroundingTypeFromIRI=wt.GROUNDING_TYPE_IRI_TO_ENUM=wt.GROUNDING_TYPE_UID_TO_ENUM=wt.GROUNDING_TYPE_UIDS=wt.GroundingType=wt.EFFORT_STATUS_OPTIONS=wt.EffortStatus=wt.AssetClass=void 0;var y$=rl();Object.defineProperty(wt,"AssetClass",{enumerable:!0,get:a(function(){return y$.AssetClass},"get")});var b$=nl();Object.defineProperty(wt,"EffortStatus",{enumerable:!0,get:a(function(){return b$.EffortStatus},"get")});var _$=p_();Object.defineProperty(wt,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return _$.EFFORT_STATUS_OPTIONS},"get")});var S$=Yo();Object.defineProperty(wt,"GroundingType",{enumerable:!0,get:a(function(){return S$.GroundingType},"get")});var xf=pf();Object.defineProperty(wt,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(wt,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(wt,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(wt,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return xf.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(wt,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return xf.resolveGroundingTypeFromWikilinkLiteral},"get")});var Sp=m_();Object.defineProperty(wt,"CommandProperty",{enumerable:!0,get:a(function(){return Sp.CommandProperty},"get")});Object.defineProperty(wt,"PreconditionProperty",{enumerable:!0,get:a(function(){return Sp.PreconditionProperty},"get")});Object.defineProperty(wt,"GroundingProperty",{enumerable:!0,get:a(function(){return Sp.GroundingProperty},"get")});Object.defineProperty(wt,"CommandBindingProperty",{enumerable:!0,get:a(function(){return Sp.CommandBindingProperty},"get")})});var uR=w(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.hasClass=Za;Qr.isAreaOrProject=w$;Qr.isEffort=v$;Qr.hasStatus=E$;Qr.isAssetArchived=T$;Qr.hasEmptyProperties=A$;Qr.needsFolderRepair=I$;Qr.getTodayDateString=rS;Qr.isPlannedForToday=x$;Qr.hasPlannedStartTimestamp=R$;Qr.extractDailyNoteDate=C$;Qr.isCurrentDateGteDay=O$;Qr.inheritsFromPrototype=lR;Qr.isPrototypeClass=F$;var cR=io(),Ja=Xo();function Za(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>cR.WikiLinkHelpers.normalize(r)===e):!1}a(Za,"hasClass");function w$(n){return Za(n,Ja.AssetClass.AREA)||Za(n,Ja.AssetClass.PROJECT)}a(w$,"isAreaOrProject");function v$(n){return Za(n,Ja.AssetClass.TASK)||Za(n,Ja.AssetClass.PROJECT)||Za(n,Ja.AssetClass.MEETING)}a(v$,"isEffort");function E$(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?cR.WikiLinkHelpers.normalize(t)===e:!1}a(E$,"hasStatus");function T$(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}a(T$,"isAssetArchived");function A$(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))}a(A$,"hasEmptyProperties");function I$(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}a(I$,"needsFolderRepair");function rS(){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}`}a(rS,"getTodayDateString");function x$(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=rS();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}a(x$,"isPlannedForToday");function R$(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}a(R$,"hasPlannedStartTimestamp");function C$(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}a(C$,"extractDailyNoteDate");function O$(n){return rS()>=n}a(O$,"isCurrentDateGteDay");function aR(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}a(aR,"normalizeWithQuotes");var P$=10;function lR(n,e=P$){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let o of s){let c=aR(o);c&&i.push({className:c,depth:0})}for(;i.length>0;){let o=i.shift();if(!o)continue;let{className:c,depth:l}=o;if(l>e)continue;if(c===Ja.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let d=Array.isArray(f)?f:[f];for(let h of d){let p=aR(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}a(lR,"inheritsFromPrototype");function F$(n,e){return Za(n,Ja.AssetClass.CLASS)?lR(e):!1}a(F$,"isPrototypeClass")});var fR=w(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.isPrototypeClass=pt.inheritsFromPrototype=pt.isCurrentDateGteDay=pt.extractDailyNoteDate=pt.hasPlannedStartTimestamp=pt.isPlannedForToday=pt.getTodayDateString=pt.needsFolderRepair=pt.hasEmptyProperties=pt.isAssetArchived=pt.hasStatus=pt.isEffort=pt.isAreaOrProject=pt.hasClass=void 0;var Ln=uR();Object.defineProperty(pt,"hasClass",{enumerable:!0,get:a(function(){return Ln.hasClass},"get")});Object.defineProperty(pt,"isAreaOrProject",{enumerable:!0,get:a(function(){return Ln.isAreaOrProject},"get")});Object.defineProperty(pt,"isEffort",{enumerable:!0,get:a(function(){return Ln.isEffort},"get")});Object.defineProperty(pt,"hasStatus",{enumerable:!0,get:a(function(){return Ln.hasStatus},"get")});Object.defineProperty(pt,"isAssetArchived",{enumerable:!0,get:a(function(){return Ln.isAssetArchived},"get")});Object.defineProperty(pt,"hasEmptyProperties",{enumerable:!0,get:a(function(){return Ln.hasEmptyProperties},"get")});Object.defineProperty(pt,"needsFolderRepair",{enumerable:!0,get:a(function(){return Ln.needsFolderRepair},"get")});Object.defineProperty(pt,"getTodayDateString",{enumerable:!0,get:a(function(){return Ln.getTodayDateString},"get")});Object.defineProperty(pt,"isPlannedForToday",{enumerable:!0,get:a(function(){return Ln.isPlannedForToday},"get")});Object.defineProperty(pt,"hasPlannedStartTimestamp",{enumerable:!0,get:a(function(){return Ln.hasPlannedStartTimestamp},"get")});Object.defineProperty(pt,"extractDailyNoteDate",{enumerable:!0,get:a(function(){return Ln.extractDailyNoteDate},"get")});Object.defineProperty(pt,"isCurrentDateGteDay",{enumerable:!0,get:a(function(){return Ln.isCurrentDateGteDay},"get")});Object.defineProperty(pt,"inheritsFromPrototype",{enumerable:!0,get:a(function(){return Ln.inheritsFromPrototype},"get")});Object.defineProperty(pt,"isPrototypeClass",{enumerable:!0,get:a(function(){return Ln.isPrototypeClass},"get")})});var dR=w(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.TsFloorViolationError=mt.CATALOG_KEEP_NAMESPACES=mt.PLUGIN_UI_FLOOR=mt.SDK_FLOOR=mt.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=mt.SDK_FLOOR_ASSETSPACE_UIDS=mt.TS_FLOOR_AS_UID_SHARED_IDENTITIES=mt.TS_FLOOR_AS_UID_EXOCMD=mt.TS_FLOOR_AS_UID_EXO=void 0;mt.assertTsFloor=D$;mt.assertTsFloorReconciled=L$;mt.isTsFloorAssetSpace=N$;mt.isTsFloorMountPath=k$;mt.TS_FLOOR_AS_UID_EXO="49fd2e56-4656-4ca7-a789-f472b16ea260";mt.TS_FLOOR_AS_UID_EXOCMD="c9c65b0f-1e01-47c1-a1f9-1bf70b11df6a";mt.TS_FLOOR_AS_UID_SHARED_IDENTITIES="0cde1557-6320-4bd0-a7c4-8b72afc38720";mt.SDK_FLOOR_ASSETSPACE_UIDS=new Set([mt.TS_FLOOR_AS_UID_EXO]);mt.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=new Set([mt.TS_FLOOR_AS_UID_EXO]);mt.SDK_FLOOR=[{uid:mt.TS_FLOOR_AS_UID_EXO,namespace:"exo"}];mt.PLUGIN_UI_FLOOR=mt.SDK_FLOOR;mt.CATALOG_KEEP_NAMESPACES=new Set(["registry","profiles"]);var Rf=class extends Error{static{a(this,"TsFloorViolationError")}constructor(e){super(e),this.name="TsFloorViolationError"}};mt.TsFloorViolationError=Rf;function D$(n,e){let t=[];for(let r of e)n.has(r)||t.push(r);if(t.length>0)throw new Rf(`Target profile's declared set excludes TS-floor AssetSpace UID(s): ${t.join(", ")}. Profile switch aborted to prevent runtime self-brick (R24).`)}a(D$,"assertTsFloor");function L$(n,e,t){let r=[];for(let i of t)n.has(i.uid)||e.has(i.namespace)||r.push(`${i.namespace} (${i.uid})`);if(r.length>0)throw new Rf(`Target profile's declared set excludes TS-floor AssetSpace(s): ${r.join(", ")}. Profile switch aborted to prevent runtime self-brick (R24).`)}a(L$,"assertTsFloorReconciled");function N$(n,e,t=mt.SDK_FLOOR){return t.some(r=>n.length>0&&r.uid===n||e.length>0&&r.namespace===e)}a(N$,"isTsFloorAssetSpace");function k$(n,e=mt.SDK_FLOOR){let t=n.replace(/\/+$/,""),r=t.slice(t.lastIndexOf("/")+1),i=r.startsWith("exoas-")?r.slice(6):r;return i.length===0?!1:e.some(s=>s.namespace===i)}a(k$,"isTsFloorMountPath")});var hR=w(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});nS.transitiveDependsOnClosure=M$;function M$(n,e){let t=new Set,r=[];for(let i of n)t.has(i)||(t.add(i),r.push(i));for(;r.length>0;){let i=r.shift();if(i===void 0)break;let s=e.get(i);if(s!==void 0)for(let o of s)t.has(o)||(t.add(o),r.push(o))}return t}a(M$,"transitiveDependsOnClosure")});var wp=w(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.PropertyFieldType=void 0;Cf.rangeToFieldType=U$;var Br;(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"})(Br||(Cf.PropertyFieldType=Br={}));var pR="http://www.w3.org/2001/XMLSchema#",j$="https://exocortex.my/ontology/exo#",$$="https://exocortex.my/ontology/ems#";function U$(n){if(!n)return Br.Unknown;let e=n.trim();if(!e)return Br.Unknown;if(e.startsWith(pR)){let t=e.substring(pR.length);return iS(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return iS(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return iS(r)}return e.startsWith($$)||e.startsWith("ems:")?B$(e):e.startsWith(j$)||e.startsWith("exo:")||V$(e)?Br.Reference:Br.Text}a(U$,"rangeToFieldType");function iS(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Br.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 Br.Number;case"date":return Br.Date;case"datetime":case"datetimestamp":return Br.DateTime;case"boolean":return Br.Boolean;case"time":return Br.Timestamp;default:return Br.Text}}a(iS,"xsdTypeToFieldType");function B$(n){let e=n.toLowerCase();return e.includes("effortstatus")?Br.StatusSelect:e.includes("tasksize")?Br.SizeSelect:Br.Reference}a(B$,"emsTypeToFieldType");function V$(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))}a(V$,"isClassReference")});var sS=w(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});Of.propertyNameToUri=q$;Of.uriToPropertyName=mR;Of.extractPropertyLabel=G$;function q$(n){return n.replace(/^([a-z]+)__/,"$1:")}a(q$,"propertyNameToUri");function mR(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__")}a(mR,"uriToPropertyName");function G$(n){let r=(n.includes(":")?mR(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())}a(G$,"extractPropertyLabel")});var vp={};Yb(vp,{__assign:()=>aS,__asyncDelegator:()=>n6,__asyncGenerator:()=>r6,__asyncValues:()=>i6,__await:()=>Pf,__awaiter:()=>Q$,__classPrivateFieldGet:()=>c6,__classPrivateFieldSet:()=>l6,__createBinding:()=>J$,__decorate:()=>z$,__exportStar:()=>Z$,__extends:()=>W$,__generator:()=>X$,__importDefault:()=>a6,__importStar:()=>o6,__makeTemplateObject:()=>s6,__metadata:()=>Y$,__param:()=>K$,__read:()=>gR,__rest:()=>H$,__spread:()=>e6,__spreadArrays:()=>t6,__values:()=>cS});function W$(n,e){oS(n,e);function t(){this.constructor=n}a(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function H$(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 z$(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function K$(n,e){return function(t,r){e(t,r,n)}}function Y$(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function Q$(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return a(i,"adopt"),new(t||(t=Promise))(function(s,o){function c(f){try{u(r.next(f))}catch(d){o(d)}}a(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(d){o(d)}}a(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}a(u,"step"),u((r=r.apply(n,e||[])).next())})}function X$(n,e){var t={label:0,sent:a(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;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 J$(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function Z$(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function cS(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:a(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 gR(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){o={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function e6(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(gR(arguments[e]));return n}function t6(){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],o=0,c=s.length;o<c;o++,i++)r[i]=s[o];return r}function Pf(n){return this instanceof Pf?(this.v=n,this):new Pf(n)}function r6(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(h){r[h]&&(i[h]=function(p){return new Promise(function(g,y){s.push([h,p,g,y])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(g){d(s[0][3],g)}}function l(h){h.value instanceof Pf?Promise.resolve(h.value.v).then(u,f):d(s[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function n6(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(o){return(t=!t)?{value:Pf(n[i](o)),done:i==="return"}:s?s(o):o}:s}}function i6(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 cS=="function"?cS(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(o){return new Promise(function(c,l){o=n[s](o),i(c,l,o.done,o.value)})}}function i(s,o,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},o)}}function s6(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function o6(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 a6(n){return n&&n.__esModule?n:{default:n}}function c6(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function l6(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 oS,aS,Ep=v9(()=>{oS=a(function(n,e){return oS=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])},oS(n,e)},"extendStatics");a(W$,"__extends");aS=a(function(){return aS=Object.assign||a(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"),aS.apply(this,arguments)},"__assign");a(H$,"__rest");a(z$,"__decorate");a(K$,"__param");a(Y$,"__metadata");a(Q$,"__awaiter");a(X$,"__generator");a(J$,"__createBinding");a(Z$,"__exportStar");a(cS,"__values");a(gR,"__read");a(e6,"__spread");a(t6,"__spreadArrays");a(Pf,"__await");a(r6,"__asyncGenerator");a(n6,"__asyncDelegator");a(i6,"__asyncValues");a(s6,"__makeTemplateObject");a(o6,"__importStar");a(a6,"__importDefault");a(c6,"__classPrivateFieldGet");a(l6,"__classPrivateFieldSet")});var fS=w(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});var lS;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(lS||(lS={}));uS.default=lS});var yR=w(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});var u6=fS();Object.defineProperty(dS,"Lifecycle",{enumerable:!0,get:a(function(){return u6.default},"get")})});var ec=w(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.defineInjectionTokenMetadata=xi.getParamInfo=xi.INJECTION_TOKEN_METADATA_KEY=void 0;xi.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function f6(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(xi.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}a(f6,"getParamInfo");xi.getParamInfo=f6;function d6(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(xi.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(xi.INJECTION_TOKEN_METADATA_KEY,s,t)}}a(d6,"defineInjectionTokenMetadata");xi.defineInjectionTokenMetadata=d6});var hS=w(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.isClassProvider=void 0;function h6(n){return!!n.useClass}a(h6,"isClassProvider");Tp.isClassProvider=h6});var pS=w(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.isFactoryProvider=void 0;function p6(n){return!!n.useFactory}a(p6,"isFactoryProvider");Ap.isFactoryProvider=p6});var xp=w(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.delay=sl.DelayedConstructor=void 0;var Ip=class{static{a(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=a(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=a(i=>{t[i]=(...s)=>{s[0]=e();let o=Reflect[i];return o(...s)}},"install");return this.reflectMethods.forEach(r),t}};sl.DelayedConstructor=Ip;function m6(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new Ip(n)}a(m6,"delay");sl.delay=m6});var Rp=w(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.isConstructorToken=ys.isTransformDescriptor=ys.isTokenDescriptor=ys.isNormalToken=void 0;var g6=xp();function y6(n){return typeof n=="string"||typeof n=="symbol"}a(y6,"isNormalToken");ys.isNormalToken=y6;function b6(n){return typeof n=="object"&&"token"in n&&"multiple"in n}a(b6,"isTokenDescriptor");ys.isTokenDescriptor=b6;function _6(n){return typeof n=="object"&&"token"in n&&"transform"in n}a(_6,"isTransformDescriptor");ys.isTransformDescriptor=_6;function S6(n){return typeof n=="function"||n instanceof g6.DelayedConstructor}a(S6,"isConstructorToken");ys.isConstructorToken=S6});var mS=w(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});Cp.isTokenProvider=void 0;function w6(n){return!!n.useToken}a(w6,"isTokenProvider");Cp.isTokenProvider=w6});var gS=w(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.isValueProvider=void 0;function v6(n){return n.useValue!=null}a(v6,"isValueProvider");Op.isValueProvider=v6});var yS=w(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});var E6=hS();Object.defineProperty(tc,"isClassProvider",{enumerable:!0,get:a(function(){return E6.isClassProvider},"get")});var T6=pS();Object.defineProperty(tc,"isFactoryProvider",{enumerable:!0,get:a(function(){return T6.isFactoryProvider},"get")});var A6=Rp();Object.defineProperty(tc,"isNormalToken",{enumerable:!0,get:a(function(){return A6.isNormalToken},"get")});var I6=mS();Object.defineProperty(tc,"isTokenProvider",{enumerable:!0,get:a(function(){return I6.isTokenProvider},"get")});var x6=gS();Object.defineProperty(tc,"isValueProvider",{enumerable:!0,get:a(function(){return x6.isValueProvider},"get")})});var bR=w(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.isProvider=void 0;var R6=hS(),C6=gS(),O6=mS(),P6=pS();function F6(n){return R6.isClassProvider(n)||C6.isValueProvider(n)||O6.isTokenProvider(n)||P6.isFactoryProvider(n)}a(F6,"isProvider");Pp.isProvider=F6});var SS=w(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var bS=class{static{a(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,[])}};_S.default=bS});var _R=w(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});var D6=SS(),wS=class extends D6.default{static{a(this,"Registry")}};vS.default=wS});var SR=w(TS=>{"use strict";Object.defineProperty(TS,"__esModule",{value:!0});var ES=class{static{a(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};TS.default=ES});var AS=w(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.formatErrorCtor=void 0;function L6(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}a(L6,"formatDependency");function N6(n,e,t=" "){return[n,...e.message.split(`
|
|
32
32
|
`).map(r=>t+r)].join(`
|
|
33
|
-
`)}a(N6,"composeErrorMessage");function k6(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=L6(r,e);return N6(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}a(k6,"formatErrorCtor");Fp.formatErrorCtor=k6});var wR=w(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.isDisposable=void 0;function M6(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}a(M6,"isDisposable");Dp.isDisposable=M6});var ER=w(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.PostResolutionInterceptors=rc.PreResolutionInterceptors=void 0;var vR=SS(),Lp=class extends vR.default{static{a(this,"PreResolutionInterceptors")}};rc.PreResolutionInterceptors=Lp;var Np=class extends vR.default{static{a(this,"PostResolutionInterceptors")}};rc.PostResolutionInterceptors=Np;var IS=class{static{a(this,"Interceptors")}constructor(){this.preResolution=new Lp,this.postResolution=new Np}};rc.default=IS});var Jo=w(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.instance=so.typeInfo=void 0;var j6=(Ep(),zh(vp)),pn=yS(),$6=bR(),kp=Rp(),U6=_R(),Nn=fS(),Mp=SR(),B6=AS(),V6=xp(),q6=wR(),G6=ER();so.typeInfo=new Map;var xS=class n{static{a(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new U6.default,this.interceptors=new G6.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:Nn.default.Transient}){this.ensureNotDisposed();let i;if($6.isProvider(t)?i=t:i={useClass:t},pn.isTokenProvider(i)){let s=[e],o=i;for(;o!=null;){let c=o.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&&pn.isTokenProvider(l.provider)?o=l.provider:o=null}}if((r.lifecycle===Nn.default.Singleton||r.lifecycle==Nn.default.ContainerScoped||r.lifecycle==Nn.default.ResolutionScoped)&&(pn.isValueProvider(i)||pn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${Nn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),pn.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(),pn.isNormalToken(e)){if(pn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:Nn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Nn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!pn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:Nn.default.Singleton})}resolve(e,t=new Mp.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&pn.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(kp.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===Nn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===Nn.default.Singleton,i=e.options.lifecycle===Nn.default.ContainerScoped,s=r||i,o;return pn.isValueProvider(e.provider)?o=e.provider.useValue:pn.isTokenProvider(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):pn.isClassProvider(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):pn.isFactoryProvider(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,t),e.options.lifecycle===Nn.default.ResolutionScoped&&t.scopedResolutions.set(e,o),o}resolveAll(e,t=new Mp.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&pn.isNormalToken(e)){if(r)return[];throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"All"),i){let o=i.map(c=>this.resolveRegistration(c,t));return this.executePostResolutionInterceptor(e,o,"All"),o}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=>!pn.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===Nn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===Nn.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 j6.__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 V6.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=so.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 q6.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return kp.isTokenDescriptor(r)?kp.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Mp.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 Mp.default,r.isOptional):this.resolve(r.token,e,r.isOptional):kp.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(B6.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};so.instance=new xS;so.default=so.instance});var TR=w(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});var W6=ec(),oo=Jo(),RS=Rp(),H6=AS();function z6(){return function(n){let e=W6.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return RS.isTokenDescriptor(r)?RS.isTransformDescriptor(r)?r.multiple?oo.instance.resolve(r.transform).transform(oo.instance.resolveAll(r.token),...r.transformArgs):oo.instance.resolve(r.transform).transform(oo.instance.resolve(r.token),...r.transformArgs):r.multiple?oo.instance.resolveAll(r.token):oo.instance.resolve(r.token):RS.isTransformDescriptor(r)?oo.instance.resolve(r.transform).transform(oo.instance.resolve(r.token),...r.transformArgs):oo.instance.resolve(r)}catch(s){let o=i+t.length;throw new Error(H6.formatErrorCtor(n,o,s))}})))}}}}a(z6,"autoInjectable");CS.default=z6});var AR=w(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});var K6=ec();function Y6(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return K6.defineInjectionTokenMetadata(t)}a(Y6,"inject");OS.default=Y6});var jp=w(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});var Q6=ec(),X6=Jo(),IR=Jo();function J6(n){return function(e){X6.typeInfo.set(e,Q6.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{IR.instance.register(t,e)}):IR.instance.register(n.token,e))}}a(J6,"injectable");PS.default=J6});var xR=w(FS=>{"use strict";Object.defineProperty(FS,"__esModule",{value:!0});var Z6=(Ep(),zh(vp)),e7=Jo();function t7(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=Z6.__rest(t,["token","options"]);return e7.instance.register(r,s,i)}),e}}a(t7,"registry");FS.default=t7});var RR=w(DS=>{"use strict";Object.defineProperty(DS,"__esModule",{value:!0});var r7=jp(),n7=Jo();function i7(){return function(n){r7.default()(n),n7.instance.registerSingleton(n)}}a(i7,"singleton");DS.default=i7});var CR=w(LS=>{"use strict";Object.defineProperty(LS,"__esModule",{value:!0});var s7=ec();function o7(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return s7.defineInjectionTokenMetadata(t)}a(o7,"injectAll");LS.default=o7});var OR=w(NS=>{"use strict";Object.defineProperty(NS,"__esModule",{value:!0});var a7=ec();function c7(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return a7.defineInjectionTokenMetadata(r)}a(c7,"injectAllWithTransform");NS.default=c7});var PR=w(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});var l7=ec();function u7(n,e,...t){return l7.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}a(u7,"injectWithTransform");kS.default=u7});var FR=w(MS=>{"use strict";Object.defineProperty(MS,"__esModule",{value:!0});var f7=jp(),d7=Jo();function h7(n,e){return function(t){f7.default()(t),d7.instance.register(e||t,t,{lifecycle:n})}}a(h7,"scoped");MS.default=h7});var DR=w(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var p7=TR();Object.defineProperty(Ri,"autoInjectable",{enumerable:!0,get:a(function(){return p7.default},"get")});var m7=AR();Object.defineProperty(Ri,"inject",{enumerable:!0,get:a(function(){return m7.default},"get")});var g7=jp();Object.defineProperty(Ri,"injectable",{enumerable:!0,get:a(function(){return g7.default},"get")});var y7=xR();Object.defineProperty(Ri,"registry",{enumerable:!0,get:a(function(){return y7.default},"get")});var b7=RR();Object.defineProperty(Ri,"singleton",{enumerable:!0,get:a(function(){return b7.default},"get")});var _7=CR();Object.defineProperty(Ri,"injectAll",{enumerable:!0,get:a(function(){return _7.default},"get")});var S7=OR();Object.defineProperty(Ri,"injectAllWithTransform",{enumerable:!0,get:a(function(){return S7.default},"get")});var w7=PR();Object.defineProperty(Ri,"injectWithTransform",{enumerable:!0,get:a(function(){return w7.default},"get")});var v7=FR();Object.defineProperty(Ri,"scoped",{enumerable:!0,get:a(function(){return v7.default},"get")})});var LR=w(jS=>{"use strict";Object.defineProperty(jS,"__esModule",{value:!0});function E7(n){let e;return t=>(e==null&&(e=n(t)),e)}a(E7,"instanceCachingFactory");jS.default=E7});var NR=w($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});function T7(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}a(T7,"instancePerContainerCachingFactory");$S.default=T7});var kR=w(US=>{"use strict";Object.defineProperty(US,"__esModule",{value:!0});function A7(n,e,t,r=!0){let i,s;return o=>{let c=n(o);return(!r||s!==c)&&((s=c)?i=o.resolve(e):i=o.resolve(t)),i}}a(A7,"predicateAwareClassFactory");US.default=A7});var MR=w(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});var I7=LR();Object.defineProperty(Ff,"instanceCachingFactory",{enumerable:!0,get:a(function(){return I7.default},"get")});var x7=NR();Object.defineProperty(Ff,"instancePerContainerCachingFactory",{enumerable:!0,get:a(function(){return x7.default},"get")});var R7=kR();Object.defineProperty(Ff,"predicateAwareClassFactory",{enumerable:!0,get:a(function(){return R7.default},"get")})});var Ve=w(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});var BS=(Ep(),zh(vp));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 C7=yR();Object.defineProperty(Zo,"Lifecycle",{enumerable:!0,get:a(function(){return C7.Lifecycle},"get")});BS.__exportStar(DR(),Zo);BS.__exportStar(MR(),Zo);BS.__exportStar(yS(),Zo);var O7=xp();Object.defineProperty(Zo,"delay",{enumerable:!0,get:a(function(){return O7.delay},"get")});var P7=Jo();Object.defineProperty(Zo,"container",{enumerable:!0,get:a(function(){return P7.instance},"get")})});var ol=w($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.NullLogger=void 0;$p.NullLogger={debug(){},info(){},warn(){},error(){}}});var cl=w(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.bytesToBase64=$R;al.base64ToBytes=UR;al.base64ToUtf8=F7;al.utf8ToBase64=D7;var jR=32768;function $R(n){let e="";for(let t=0;t<n.length;t+=jR)e+=String.fromCharCode(...n.subarray(t,t+jR));return btoa(e)}a($R,"bytesToBase64");function UR(n){let e=n.replace(/\s/g,""),t=e.length%4,r=t===2||t===3?e+"=".repeat(4-t):e,i=atob(r),s=new Uint8Array(i.length);for(let o=0;o<i.length;o++)s[o]=i.charCodeAt(o);return s}a(UR,"base64ToBytes");function F7(n){return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(UR(n))}a(F7,"base64ToUtf8");function D7(n){return $R(new TextEncoder().encode(n))}a(D7,"utf8ToBase64")});var Up=w(VS=>{"use strict";Object.defineProperty(VS,"__esModule",{value:!0});VS.iriToObsidianName=L7;function L7(n){let e=n.match(/^https:\/\/exocortex\.my\/ontology\/([a-z][a-zA-Z0-9]*)#([^#]+)$/);if(e){let[,r,i]=e;return`${r}__${i}`}let t=n.match(/\/([^/]+)\.md$/);return t?t[1]:null}a(L7,"iriToObsidianName")});var BR=w(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.registerUniversalDefaultLoader=N7;ea.clearUniversalDefaultLoader=k7;ea.clearUniversalDefault=M7;ea.loadUniversalDefault=j7;ea.mergePropertyDefaults=$7;ea.mergeInheritanceRules=U7;var Bp=null,ao,Df=!1;function N7(n){Bp=n,ao=void 0,Df=!1}a(N7,"registerUniversalDefaultLoader");function k7(){Bp=null,ao=void 0,Df=!1}a(k7,"clearUniversalDefaultLoader");function M7(){ao=void 0,Df=!1}a(M7,"clearUniversalDefault");async function j7(){if(ao!==void 0)return ao;if(!Bp)return ao=null,null;try{ao=await Bp()??null}catch(n){Df||(console.warn("[UniversalDefaultTemplateResolver] loader threw, falling back to legacy primitives:",n),Df=!0),ao=null}return ao}a(j7,"loadUniversalDefault");function $7(n,e){let t=new Map;for(let s of e)t.set(s.propertyName,s);let r=[],i=new Set;for(let s of n){let o=t.get(s.propertyName);o?(r.push(o),i.add(o.propertyName)):r.push(s)}for(let s of e)i.has(s.propertyName)||r.push(s);return r}a($7,"mergePropertyDefaults");function U7(n,e){let t=new Map;for(let s of e)t.set(s.targetPropertyName,s);let r=[],i=new Set;for(let s of n){let o=t.get(s.targetPropertyName);o?(r.push(o),i.add(o.targetPropertyName)):r.push(s)}for(let s of e)i.has(s.targetPropertyName)||r.push(s);return r}a(U7,"mergeInheritanceRules")});var qS=w((pfe,VR)=>{var ll=class{static{a(this,"Wildcard")}constructor(){return B7||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(ll.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(ll.prototype,"termType",{enumerable:!0,value:"Wildcard"});var B7=new ll;VR.exports.Wildcard=ll});var GR=w((gfe,qR)=>{var V7=(function(){var n=a(function(N,D,j,H){for(j=j||{},H=N.length;H--;j[N[H]]=D);return j},"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],o=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],g=[123,126],y=[1,67],b=[39,45,87],S=[13,16,45,197,224,308],v=[1,87],I=[2,281],A=[1,86],T=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],R=[6,28,29,53,63,70,73,81,83,85],V=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],L=[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],P=[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],k=[13,16,308],O=[112,132,327,334],J=[13,16,112,132,308],re=[1,111],Y=[1,117],ye=[112,132,327,328,334],de=[13,16,112,132,308,328],le=[28,29,45,53,87],q=[1,138],M=[1,151],je=[1,128],Q=[1,127],G=[1,129],te=[1,140],Se=[1,141],X=[1,142],$e=[1,143],Be=[1,144],$=[1,145],ee=[1,147],me=[1,148],ve=[2,457],be=[1,158],pe=[1,159],Re=[1,160],B=[1,152],Z=[1,153],oe=[1,156],ge=[1,171],Ae=[1,172],Ie=[1,173],Oe=[1,174],Fe=[1,175],De=[1,176],Le=[1,167],Ne=[1,168],xe=[1,169],ke=[1,170],at=[1,157],Ze=[1,166],Je=[1,161],x=[1,162],C=[1,163],F=[1,164],U=[1,165],he=[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],At=[1,195],Ot=[6,31,73,81,83,85],ze=[2,285],ne=[1,199],ie=[1,201],ae=[6,31,70,73,81,83,85],ue=[2,283],We=[1,207],lt=[1,218],ut=[1,223],Mr=[1,219],On=[1,225],Qn=[1,226],un=[1,224],bI=[6,63,70,73,81,83,85],_I=[1,236],SI=[2,334],wI=[1,243],vI=[1,241],jr=[6,193],Ah=[2,349],EI=[2,339],Ho=[28,128],TI=[47,48,193,272],Ih=[47,48,193,242,272],Wc=[47,48,193,242,246,272],Hc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Tr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],AI=[1,271],II=[1,270],ir=[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],xI=[1,281],RI=[1,280],fn=[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],tf=[45,89],xh=[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],Rh=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ch=[31,89],Oh=[48,87],$a=[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],fs=[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],CI=[1,313],zc=[6,85],Rb=[6,31,81,83,85],OI=[2,361],zs=[2,353],Ua=[1,343],rf=[31,112,335],Ks=[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],Cb=[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],PI=[6,109,193],Ba=[31,112],sr=[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],Ob=[1,390],Pb=[1,391],zo=[13,16,87,197,308,314],FI=[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],Ph=[1,417],Fh=[1,418],DI=[13,16,48,197,229,308],Ko=[6,31,85],LI=[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],Fb=[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],Va=[29,31,85,112,159,160,161,163,164],Dh=[1,443],Lh=[1,444],NI=[1,449],qa=[31,112,193,232,318,335],Nh=[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],kI=[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],Db=[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],nf=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],sf=[31,45],MI=[1,507],jI=[1,508],$I=[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],kh=[29,31,85,112,159,160,161,163,164,335],Ga=[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],UI=[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],BI=[2,352],Lb=[13,16,197,308,314],VI=[1,565],Kc=[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],qI=[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],Ys=[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],GI=[13,16,87,308],Qs=[2,364],Yc=[29,31,85,112,159,160,161,163,164,193,232,318,335],Mh=[31,112,193,232,272,318,335],Xs=[2,359],WI=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],jh=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],HI=[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],zI=[2,347],Nb={trace:a(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:a(function(D,j,H,we,He,_,hn){var E=_.length-1;switch(He){case 1:if(_[E-1]=_[E-1]||{},Ye.base&&(_[E-1].base=Ye.base),Ye.base="",_[E-1].prefixes=Ye.prefixes,Ye.prefixes=null,Ye.pathOnly){if(_[E-1].type==="path"||"termType"in _[E-1])return _[E-1];throw new Error("Received full SPARQL query in path only mode")}else if(_[E-1].type==="path"||"termType"in _[E-1])throw new Error("Received only path in full SPARQL mode");if(_[E-1].type==="update"){let It={};for(let Mt of _[E-1].updates)if(Mt.updateType==="insert"){let ft={};for(let bt of Mt.insert)if(bt.type==="bgp"||bt.type==="graph")for(let Pn of bt.triples)Pn.subject.termType==="BlankNode"&&(ft[Pn.subject.value]=!0),Pn.predicate.termType==="BlankNode"&&(ft[Pn.predicate.value]=!0),Pn.object.termType==="BlankNode"&&(ft[Pn.object.value]=!0);for(let bt of Object.keys(ft)){if(It[bt])throw new Error("Detected reuse blank node across different INSERT DATA clauses");It[bt]=!0}}}return _[E-1];case 2:this.$={..._[E-1],..._[E],type:"query"};break;case 4:Ye.base=of(_[E]);break;case 5:Ye.prefixes||(Ye.prefixes={}),_[E-1]=_[E-1].substr(0,_[E-1].length-1),_[E]=of(_[E]),Ye.prefixes[_[E-1]]=_[E];break;case 6:this.$={..._[E-3],...za(_[E-2]),..._[E-1],..._[E]};break;case 7:if(!Ye.skipValidation&&(qb(_[E-3].variables.map(Mt=>Vb(Mt.expression))).some(Mt=>Mt.aggregation==="count"&&!(Mt.expression instanceof $h))||_[E].group)){for(let Mt of _[E-3].variables)if(Mt.termType==="Variable"){if(!_[E].group||!_[E].group.map(ft=>Zc(ft)).includes(Zc(Mt)))throw Error("Projection of ungrouped variable (?"+Zc(Mt)+")")}else if(Vb(Mt.expression).length===0){let ft=p9(Mt.expression);for(let bt of ft)if(!_[E].group||!_[E].group.map||!_[E].group.map(Pn=>Zc(Pn)).includes(Zc(bt)))throw Error("Use of ungrouped variable in projection of operation (?"+Zc(bt)+")")}}let ms=_[E-1].where.filter(It=>It.type==="query");if(ms.length>0){let It=_[E-3].variables.filter(ft=>ft.variable&&ft.variable.value).map(ft=>ft.variable.value),Mt=qb(ms.map(ft=>ft.variables)).map(ft=>ft.value||ft.variable.value);for(let ft of It)if(Mt.indexOf(ft)>=0)throw Error("Target id of 'AS' (?"+ft+") already used in subquery")}this.$=Jt(_[E-3],za(_[E-2]),_[E-1],_[E]);break;case 8:this.$=Jt({queryType:"CONSTRUCT",template:_[E-3]},za(_[E-2]),_[E-1],_[E]);break;case 9:this.$=Jt({queryType:"CONSTRUCT",template:_[E-2]=_[E-2]?_[E-2].triples:[]},za(_[E-5]),{where:[{type:"bgp",triples:Ha([],_[E-2])}]},_[E]);break;case 10:this.$=Jt({queryType:"DESCRIBE",variables:_[E-3]==="*"?[new $h]:_[E-3]},za(_[E-2]),_[E-1],_[E]);break;case 11:this.$=Jt({queryType:"ASK"},za(_[E-2]),_[E-1],_[E]);break;case 12:this.$=Jt(_[E-1],{variables:[new $h]});break;case 13:let ff=_[E].map(It=>It.value||It.variable.value),el=m9(ff);if(el.length>0)throw Error("Two or more of the resulting columns have the same name (?"+el[0]+")");this.$=Jt(_[E-1],{variables:_[E]});break;case 14:this.$=Jt({queryType:"SELECT"},_[E]&&(_[E-1]=dn(_[E]),_[E]={},_[E][_[E-1]]=!0,_[E]));break;case 16:case 27:this.$=Qc(_[E-3],{variable:_[E-1]});break;case 17:case 18:this.$=Jt(_[E-3],_[E-2],_[E-1],_[E],{type:"query"});break;case 19:case 58:this.$={iri:_[E],named:!!_[E-1]};break;case 20:this.$={where:_[E].patterns};break;case 21:this.$=Jt(_[E-1],_[E]);break;case 22:this.$=Jt(_[E-2],_[E-1],_[E]);break;case 23:this.$={group:_[E]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=Qc(_[E]);break;case 26:this.$=Qc(_[E-1]);break;case 29:this.$={having:_[E]};break;case 30:this.$={order:_[E]};break;case 32:this.$=Qc(_[E],{descending:!0});break;case 35:this.$={limit:Jc(_[E])};break;case 36:this.$={offset:Jc(_[E])};break;case 37:this.$={limit:Jc(_[E-2]),offset:Jc(_[E])};break;case 38:this.$={limit:Jc(_[E]),offset:Jc(_[E-2])};break;case 39:case 43:this.$={type:"values",values:_[E]};break;case 40:case 84:this.$=_[E-1].map(It=>({[_[E-3]]:It}));break;case 41:case 85:this.$=_[E-1].map(()=>({}));break;case 42:case 86:var ps=_[E-4].length;_[E-4]=_[E-4].map(kb),this.$=_[E-1].map(function(It){if(It.length!==ps)throw Error("Inconsistent VALUES length");for(var Mt={},ft=0;ft<ps;ft++)Mt["?"+_[E-4][ft].value]=It[ft];return Mt});break;case 44:case 65:case 100:case 126:case 175:this.$=_[E-1];break;case 45:this.$={type:"update",updates:Js(_[E-2],_[E-1])};break;case 46:this.$=Jt({type:"load",silent:!!_[E-2],source:_[E-1]},_[E]&&{destination:_[E]});break;case 47:this.$={type:dn(_[E-2]),silent:!!_[E-1],graph:_[E]};break;case 48:this.$={type:dn(_[E-4]),silent:!!_[E-3],source:_[E-2],destination:_[E]};break;case 49:this.$={type:"create",silent:!!_[E-2],graph:{type:"graph",name:_[E]}};break;case 50:this.$={updateType:"insert",insert:ix(_[E])};break;case 51:this.$={updateType:"delete",delete:Hb(ix(_[E]))};break;case 52:this.$={updateType:"deletewhere",delete:Hb(_[E])};break;case 53:this.$={updateType:"insertdelete",..._[E-4],..._[E-3],...za(_[E-2],"using"),where:_[E].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=_[E];break;case 55:this.$={delete:Hb(_[E-1]),insert:_[E]||[]};break;case 56:this.$={delete:[],insert:_[E]};break;case 59:this.$={graph:_[E]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:_[E]};break;case 64:this.$={[dn(_[E])]:!0};break;case 66:this.$=_[E-1]?ds(_[E],[_[E-1]]):ds(_[E]);break;case 67:var lf=Jt(_[E-3]||{triples:[]},{type:"graph",name:_[E-5]});this.$=_[E]?[lf,_[E]]:[lf];break;case 68:case 73:this.$={type:"bgp",triples:ds(_[E-2],[_[E-1]])};break;case 69:this.$={type:"group",patterns:[_[E-1]]};break;case 70:for(let It of _[E-1].filter(Mt=>Mt.type==="bind")){let Mt=_[E-1].indexOf(It),ft=new Set;for(let bt of _[E-1].slice(0,Mt))(bt.type==="group"||bt.type==="bgp")&&rx(bt).forEach(Pn=>ft.add(Pn));if(ft.has(It.variable.value))throw Error("Variable used to bind is already bound (?"+It.variable.value+")")}this.$={type:"group",patterns:_[E-1]};break;case 71:this.$=_[E-1]?ds([_[E-1]],_[E]):ds(_[E]);break;case 72:this.$=_[E]?[_[E-2],_[E]]:_[E-2];break;case 75:this.$=Jt(_[E],{type:"optional"});break;case 76:this.$=Jt(_[E],{type:"minus"});break;case 77:this.$=Jt(_[E],{type:"graph",name:_[E-1]});break;case 78:this.$=Jt(_[E],{type:"service",name:_[E-1],silent:!!_[E-2]});break;case 79:this.$={type:"filter",expression:_[E]};break;case 80:this.$={type:"bind",variable:_[E-1],expression:_[E-3]};break;case 89:this.$=cf(_[E]);break;case 90:this.$=void 0;break;case 91:this.$=_[E-1].length?{type:"union",patterns:ds(_[E-1].map(jb),[jb(_[E])])}:_[E];break;case 95:this.$={..._[E],function:_[E-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Js(_[E-2],_[E-1]),distinct:!!_[E-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.$=Js(_[E-2],_[E-1]);break;case 101:this.$=ds(_[E-2],[_[E-1]]);break;case 102:case 112:this.$=Wb(_[E].map(It=>Jt(Zs(_[E-1]),It)));break;case 103:this.$=Wb(Ha(_[E].map(It=>Jt(Zs(_[E-1].entity),It)),_[E-1].triples));break;case 105:this.$=ds([_[E-1]],_[E]);break;case 106:this.$=ds(_[E]);break;case 107:this.$=Bb(_[E-1],_[E]);break;case 109:case 237:this.$=Ye.factory.namedNode(i9);break;case 110:case 118:this.$=Js(_[E-1],_[E]);break;case 111:this.$=_[E]?{annotation:_[E],object:_[E-1]}:_[E-1];break;case 113:this.$=_[E]?Wb(Ha(_[E].map(It=>Jt(Zs(_[E-1].entity),It)),_[E-1].triples)):_[E-1].triples;break;case 114:this.$=Bb(..._[E-1],_[E]);break;case 116:this.$=Bb(..._[E]);break;case 117:case 159:case 163:this.$=[_[E-1],_[E]];break;case 119:this.$=_[E]?{object:_[E-1],annotation:_[E]}:_[E-1];break;case 120:this.$=_[E-1].length?Xc("|",Js(_[E-1],_[E])):_[E];break;case 121:this.$=_[E-1].length?Xc("/",Js(_[E-1],_[E])):_[E];break;case 122:this.$=_[E]?Xc(_[E],[_[E-1]]):_[E-1];break;case 123:this.$=_[E-1]?Xc(_[E-1],[_[E]]):_[E];break;case 125:case 131:this.$=Xc(_[E-1],[_[E]]);break;case 129:this.$=Xc("|",Js(_[E-2],_[E-1]));break;case 132:case 134:this.$=d9(_[E-1]);break;case 133:case 135:this.$=h9(_[E-1]);break;case 140:this.$={entity:_[E],triples:[]};break;case 145:this.$=kb(_[E]);break;case 149:this.$=Ye.factory.namedNode(KI);break;case 151:case 153:case 158:case 162:this.$=Mb(_[E-1],_[E]);break;case 152:this.$=["||",_[E]];break;case 154:this.$=["&&",_[E]];break;case 156:this.$=$r(_[E-1],[_[E-2],_[E]]);break;case 157:this.$=$r(_[E-2]?"notin":"in",[_[E-3],_[E]]);break;case 160:this.$=["+",Mb(_[E-1],_[E])];break;case 161:var Vh=hs(_[E-1].value.replace("-",""),_[E-1].datatype);this.$=["-",Mb(Vh,_[E])];break;case 164:this.$=$r("UPLUS",[_[E]]);break;case 165:this.$=$r(_[E-1],[_[E]]);break;case 166:this.$=$r("UMINUS",[_[E]]);break;case 177:this.$=$r(dn(_[E-1]));break;case 178:this.$=$r(dn(_[E-3]),[_[E-1]]);break;case 179:this.$=cf($r(dn(_[E-3]),[_[E-1]]));break;case 180:this.$=$r(dn(_[E-5]),[_[E-3],_[E-1]]);break;case 181:this.$=$r(dn(_[E-7]),[_[E-5],_[E-3],_[E-1]]);break;case 182:this.$=cf($r(dn(_[E-7]),[_[E-5],_[E-3],_[E-1]]));break;case 183:this.$=$r(dn(_[E-1]),_[E]);break;case 184:this.$=$r("bound",[kb(_[E-1])]);break;case 185:this.$=$r(_[E-1],[]);break;case 186:this.$=$r(_[E-3],[_[E-1]]);break;case 187:this.$=$r(_[E-2]?"notexists":"exists",[jb(_[E])]);break;case 188:case 189:this.$=Qc(_[E-1],{type:"aggregate",aggregation:dn(_[E-4]),distinct:!!_[E-2]});break;case 190:this.$=Qc(_[E-2],{type:"aggregate",aggregation:dn(_[E-5]),distinct:!!_[E-3],separator:typeof _[E-1]=="string"?_[E-1]:" "});break;case 192:this.$=hs(_[E]);break;case 193:this.$=c9(_[E-1],dn(_[E].substr(1)));break;case 194:this.$=hs(_[E-2],_[E]);break;case 195:case 204:this.$=hs(_[E],YI);break;case 196:case 205:this.$=hs(_[E],QI);break;case 197:case 206:this.$=hs(dn(_[E]),XI);break;case 200:this.$=hs(_[E].toLowerCase(),a9);break;case 201:this.$=hs(_[E].substr(1),YI);break;case 202:this.$=hs(_[E].substr(1),QI);break;case 203:this.$=hs(_[E].substr(1).toLowerCase(),XI);break;case 207:case 208:this.$=tx(_[E],1);break;case 209:case 210:this.$=tx(_[E],3);break;case 211:this.$=Ye.factory.namedNode(of(_[E]));break;case 213:var qh=_[E].indexOf(":"),uf=_[E].substr(0,qh),Gh=Ye.prefixes[uf];if(!Gh)throw new Error("Unknown prefix: "+uf);var Gt=of(Gh+_[E].substr(qh+1));this.$=Ye.factory.namedNode(Gt);break;case 214:if(_[E]=_[E].substr(0,_[E].length-1),!(_[E]in Ye.prefixes))throw new Error("Unknown prefix: "+_[E]);var Gt=of(Ye.prefixes[_[E]]);this.$=Ye.factory.namedNode(Gt);break;case 215:this.$=af(_[E].replace(/^(_:)/,""));break;case 216:this.$=af();break;case 217:case 218:case 232:this.$=cf($b(_[E-3],_[E-2],_[E-1]));break;case 230:case 231:this.$=cf(_[E-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:_[E-1].push(_[E]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[_[E]];break;case 308:_[E-3].push(_[E-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:_[E-2].push(_[E-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:o},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(g,[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:y,87:h},n(b,[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:v,29:I,52:84,53:A,56:85},{19:88,28:v,29:I,52:89,53:A,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:A},n(T,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(R,[2,263],{34:96}),n(R,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(R,[2,262]),n(V,[2,259]),n(L,[2,143]),n(L,[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(P,[2,211]),n(P,[2,212]),n(P,[2,213]),n(P,[2,214]),{19:98,28:v,29:I,52:99,53:A,56:85},{6:[2,309],99:100,193:[1,101]},n(k,[2,311],{101:102,328:[1,103]}),n(O,[2,317],{104:104,328:[1,105]}),n(J,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:re,114:110},{29:re,114:112},{29:re,114:113},{118:114,123:[1,115],125:116,126:Y},n(ye,[2,315]),n(ye,[2,316]),n(de,[2,319]),n(de,[2,320]),n(de,[2,321]),n(g,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:y,87:h}),n(le,[2,269]),n(le,[2,15]),{13:f,16:d,44:136,45:q,46:120,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(b,[2,14]),n(b,[2,274]),n(b,[2,271]),n(b,[2,272]),n(e,[2,4]),{13:[1,177]},n(he,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:d,45:[1,193],55:194,197:At,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(S,[2,419]),n(Ot,ze,{20:196,59:197,69:198,70:ne}),n(l,[2,250]),{29:ie,57:200},n(k,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(ae,ue,{23:204,58:205,62:206,63:We}),n(l,[2,252]),{19:208,28:v,29:I,52:209,53:A,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:lt,55:220,82:M,87:h,89:ut,145:212,172:221,185:213,187:214,231:Mr,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},n(bI,[2,265],{56:85,35:227,52:228,19:229,28:v,29:I,53:A}),n(V,[2,260]),n(ae,ue,{58:205,62:206,23:230,63:We}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:p},n(k,[2,312]),{105:233,112:_I,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(O,[2,318]),n(k,SI,{108:240,133:242,112:wI,132:vI}),n(J,[2,323]),{112:[1,244]},{112:[2,325]},n(jr,[2,50]),n(T,Ah,{135:245,136:246,143:247,144:248,31:EI,112:EI}),n(jr,[2,51]),n(jr,[2,52]),n(Ho,[2,328],{119:249}),{29:re,114:250},n(Ho,[2,56]),{29:re,114:251},n(g,[2,59]),n(le,[2,270]),{47:[1,252]},n(TI,[2,150]),n(Ih,[2,428],{240:253}),n(Wc,[2,430],{244:254}),n(Wc,[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(Hc,[2,440],{252:264}),n(Tr,[2,448],{260:265}),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Tr,[2,167]),n(Tr,[2,168]),n(Tr,[2,169]),n(Tr,[2,170],{176:269,45:AI,89:II}),n(Tr,[2,171]),n(Tr,[2,172]),n(Tr,[2,173]),n(Tr,[2,174]),{13:f,16:d,44:136,45:q,46:272,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(ir,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:xI,89:RI,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(fn,[2,192],{292:[1,286],293:[1,287]}),n(fn,[2,195]),n(fn,[2,196]),n(fn,[2,197]),n(fn,[2,198]),n(fn,[2,199]),n(fn,[2,200]),{13:f,16:d,44:39,55:40,82:M,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(tf,[2,452]),n(tf,[2,453]),n(tf,[2,454]),n(tf,[2,455]),n(tf,[2,456]),{279:[2,458]},n(xh,[2,207]),n(xh,[2,208]),n(xh,[2,209]),n(xh,[2,210]),n(fn,[2,201]),n(fn,[2,202]),n(fn,[2,203]),n(fn,[2,204]),n(fn,[2,205]),n(fn,[2,206]),n(e,[2,5]),n(Rh,[2,297],{88:295}),n(Ch,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(Oh,[2,301]),n(he,[2,43]),n(he,[2,82]),n(he,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n($a,[2,123]),n($a,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(fs,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:At,223:312,225:308,226:309,229:CI,307:43,308:p},n(c,i,{215:10,214:314}),n(fs,[2,236]),n(fs,[2,237]),n(zc,[2,6]),n(Rb,[2,287],{60:315,72:316,73:[1,317]}),n(Ot,[2,286]),{13:f,16:d,45:q,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,307:43,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U},n([6,31,63,70,73,81,83,85],[2,20]),n(T,OI,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:zs,31:zs,85:zs,112:zs,159:zs,160:zs,161:zs,163:zs,164:zs,41:s}),{13:f,16:d,55:331,307:43,308:p},n(k,[2,280]),n(zc,[2,7]),n(Ot,ze,{59:197,69:198,20:332,70:ne}),n(ae,[2,284]),{64:[1,333]},n(ae,ue,{58:205,62:206,23:334,63:We}),n(l,[2,254]),n(T,Ah,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:h,139:342,186:339,190:340,195:341,197:Ua,307:43,308:p},n(rf,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:d,87:h,197:Ua,308:p}),n(Ks,[2,227]),n(Ks,[2,228]),n(Ks,[2,229]),{13:f,16:d,44:215,45:lt,55:220,82:M,87:h,89:ut,172:221,185:351,187:350,200:348,230:347,231:Mr,234:349,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:Ua,307:43,308:p},n(Ks,[2,146]),n(Ks,[2,147]),n(Ks,[2,148]),n(Ks,[2,149]),{13:f,16:d,44:354,55:355,82:M,87:h,172:357,237:356,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:358,312:un,313:353},n(Cb,[2,215]),n(Cb,[2,216]),n(ae,ue,{58:205,62:206,23:359,63:We}),n(R,[2,264]),n(bI,[2,266]),n(zc,[2,11]),n(r,[2,308],{6:[2,310]}),n(jr,[2,313],{102:360,120:361,121:[1,362]}),n(jr,[2,47]),n(jr,[2,63]),n(jr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(jr,[2,336]),n(jr,[2,337]),n(jr,[2,338]),{109:[1,364]},n(PI,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(k,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(Ba,[2,341],{137:368}),n(Ba,[2,340]),{13:f,16:d,44:215,45:lt,55:220,82:M,87:h,89:ut,145:369,172:221,185:213,187:214,231:Mr,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},{28:[1,370],127:371,128:[1,372]},n(Ho,[2,330],{124:373,125:374,126:Y}),n(Ho,[2,57]),{44:375,87:h},n(TI,[2,151],{241:376,242:[1,377]}),n(Ih,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,247:380,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{250:[1,381]},n(sr,[2,432]),n(sr,[2,433]),n(sr,[2,434]),n(sr,[2,435]),n(sr,[2,436]),n(sr,[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:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De}),n(Hc,[2,162],{261:388,262:389,39:Ob,338:Pb}),n(Tr,[2,164]),n(Tr,[2,165]),n(Tr,[2,166]),n(ir,[2,95]),n(ir,[2,96]),n(sr,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(ir,[2,177]),{13:f,16:d,44:136,45:q,46:395,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:396,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:397,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:398,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:399,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(ir,[2,183]),n(ir,[2,98]),n(sr,[2,381],{180:400}),{87:[1,401]},n(ir,[2,185]),{13:f,16:d,44:136,45:q,46:402,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{29:ie,57:403},n(fn,[2,193]),{13:f,16:d,55:404,307:43,308:p},{13:f,16:d,44:39,55:40,87:h,139:342,195:405,197:Ua,307:43,308:p},n(zo,[2,233]),n(zo,[2,234]),n(zo,[2,235]),n(FI,[2,459],{281:406,325:[1,407]}),n(sr,[2,463],{284:408,325:[1,409]}),n(sr,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:M,171:413,172:415,173:416,174:Ph,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:Fh},{31:[1,419],89:[1,420]},{29:[1,421]},n(Oh,[2,302]),n(Rh,[2,367],{167:422}),n(Ch,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(Oh,[2,371]),n($a,[2,122]),n($a,[2,417]),n($a,[2,413]),n($a,[2,414]),n($a,[2,415]),n(fs,[2,125]),n(fs,[2,127]),n(fs,[2,128]),n(DI,[2,420],{227:426}),n(fs,[2,130]),{13:f,16:d,55:194,197:At,223:427,307:43,308:p},{48:[1,428]},n(Ko,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(Rb,[2,288]),{64:[1,433]},n(Ot,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:d,45:q,268:te,269:Se,270:X,271:$e,273:Be,274:$,276:ee,277:me,279:ve,280:be,283:pe,285:Re,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U}),n(LI,[2,293]),n(Fb,[2,92]),n(Fb,[2,93]),n(Fb,[2,94]),{45:AI,89:II,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:v,29:I,56:85},{19:438,28:v,29:I,56:85},n(Va,[2,355],{149:439}),n(Va,[2,354]),{13:f,16:d,44:215,45:Dh,55:220,82:M,87:h,89:ut,156:440,172:221,185:441,203:442,231:Lh,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},n(R,[2,19]),n(Ko,[2,21]),{13:f,16:d,44:450,45:NI,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,307:43,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(zc,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(T,[2,386],{31:[2,388]}),n(rf,[2,102]),n(qa,[2,391],{191:452}),n(T,[2,395],{196:453,198:454}),n(T,[2,108]),n(T,[2,109]),n(rf,[2,103]),n(rf,[2,104]),n(rf,[2,390]),{13:f,16:d,44:215,45:lt,48:[1,455],55:220,82:M,87:h,89:ut,172:221,185:351,187:350,200:456,231:Mr,234:349,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},n(Nh,[2,424]),n(kI,[2,136]),n(kI,[2,137]),n(Db,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:Ua,307:43,308:p},n(zo,[2,219]),n(zo,[2,220]),n(zo,[2,221]),n(zo,[2,222]),n(zo,[2,223]),n(zc,[2,10]),n(jr,[2,46]),n(jr,[2,314]),{112:_I,122:459},n(jr,[2,62]),n(k,SI,{133:242,108:460,112:wI,132:vI}),n(PI,[2,61]),n(jr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Ba,[2,351],{146:463,335:[1,464]}),{29:ie,57:465},n(Ho,[2,329]),n(k,[2,332],{129:466,327:[1,467]}),n(Ho,[2,55]),n(Ho,[2,331]),{48:[1,468]},n(Ih,[2,429]),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Wc,[2,431]),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,243:470,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Wc,[2,156]),{45:xI,89:RI,179:471},n(Hc,[2,441]),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,251:472,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Tr,[2,444],{256:473}),n(Tr,[2,446],{258:474}),n(sr,[2,442]),n(sr,[2,443]),n(Tr,[2,449]),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,255:154,257:155,259:475,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(sr,[2,450]),n(sr,[2,451]),n(sr,[2,379],{178:476}),n(sr,[2,378]),n([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:f,16:d,44:136,45:q,46:482,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{48:[1,483]},{48:[1,484]},n(ir,[2,187]),n(fn,[2,194]),{13:f,16:d,44:39,55:40,82:M,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,320:485},{13:f,16:d,39:[1,487],44:136,45:q,46:488,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,282:486,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(FI,[2,460]),{13:f,16:d,44:136,45:q,46:489,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(sr,[2,464]),{13:f,16:d,44:136,45:q,46:490,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(sr,[2,466]),n(he,[2,40]),n(Rh,[2,298]),n(nf,[2,87]),n(nf,[2,88]),n(nf,[2,89]),n(nf,[2,90]),{13:f,16:d,55:492,82:M,172:493,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,311:494,312:un,315:491},n(he,[2,41]),n(Ch,[2,300]),n(sf,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:M,171:497,172:415,173:416,174:Ph,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:Fh},{31:[1,498],89:[1,499]},{29:[1,500]},n(Oh,[2,372]),{13:f,16:d,48:[2,422],55:194,197:At,223:312,226:502,228:501,229:CI,307:43,308:p},n(fs,[2,131]),n(fs,[2,126]),n(Ko,[2,22]),n(Ko,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:q,55:323,67:321,68:322,74:505,75:506,76:MI,77:320,78:jI,79:509,87:h,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,307:43,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(LI,[2,294]),n($I,[2,69]),n($I,[2,70]),n(Ot,ze,{59:197,69:198,20:511,70:ne}),n(ae,ue,{58:205,62:206,23:512,63:We}),{29:[2,375],31:[2,71],84:522,85:o,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(Va,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:h}),n(kh,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),{13:f,16:d,44:215,45:Dh,55:220,82:M,87:h,89:ut,172:221,185:351,203:536,212:534,231:Lh,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(ae,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:d,45:NI,87:h,268:te,269:Se,270:X,271:$e,273:Be,274:$,276:ee,277:me,279:ve,280:be,283:pe,285:Re,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U}),n(Ga,[2,291]),n(Ga,[2,24]),n(Ga,[2,25]),{13:f,16:d,44:136,45:q,46:539,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Ga,[2,28]),n(ae,ue,{58:205,62:206,23:540,63:We}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(qa,[2,107]),{13:f,16:d,44:215,45:lt,55:220,82:M,87:h,89:ut,172:221,185:351,187:350,199:543,200:544,231:Mr,234:349,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},n(UI,[2,132]),n(Nh,[2,425]),n(UI,[2,133]),{13:f,16:d,44:354,55:355,82:M,87:h,172:357,237:356,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:358,312:un,313:545},n(jr,[2,54]),n(jr,[2,48]),n(Ba,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(Ba,[2,68]),n(T,[2,350],{31:BI,112:BI}),n(jr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(k,[2,333]),n(le,[2,16]),n(Ih,[2,152]),n(Wc,[2,154]),n(Wc,[2,157]),n(Hc,[2,159]),n(Hc,[2,160],{262:389,261:548,39:Ob,338:Pb}),n(Hc,[2,161],{262:389,261:549,39:Ob,338:Pb}),n(Tr,[2,163]),{13:f,16:d,44:136,45:q,46:550,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(ir,[2,178]),n(ir,[2,179]),{13:f,16:d,44:136,45:q,46:551,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:552,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:553,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{48:[1,554],272:[1,555]},n(ir,[2,184]),n(ir,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:f,16:d,55:194,197:At,223:562,307:43,308:p},n(Lb,[2,224]),n(Lb,[2,225]),n(Lb,[2,226]),{31:[1,563],45:VI,94:564},n(he,[2,84]),n(Rh,[2,368]),n(he,[2,85]),n(Ch,[2,370]),n(sf,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(Ko,[2,35],{83:[1,569]}),n(Ko,[2,36],{81:[1,570]}),n(Rb,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:f,16:d,45:q,76:MI,78:jI,87:h,268:te,269:Se,270:X,271:$e,273:Be,274:$,276:ee,277:me,279:ve,280:be,283:pe,285:Re,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U}),n(Kc,[2,295]),{45:q,77:572},{45:q,77:573},n(Kc,[2,33]),n(Kc,[2,34]),{31:[2,275],50:574,84:575,85:o},{31:[2,277],51:576,84:577,85:o},n(Va,[2,356]),n(qI,[2,357],{152:578,335:[1,579]}),n(Ys,[2,74]),{29:ie,57:580},{29:ie,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(GI,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:q,55:323,67:321,68:322,77:320,79:585,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,307:43,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U},{45:[1,586]},n(Ys,[2,81]),{29:ie,57:587},n(Va,[2,73]),n(T,[2,362],{29:Qs,31:Qs,85:Qs,112:Qs,159:Qs,160:Qs,161:Qs,163:Qs,164:Qs}),n(kh,[2,112]),n(Yc,[2,401],{206:588}),n(T,[2,405],{209:589,210:590}),n(T,[2,403]),n(T,[2,404]),n(kh,[2,113]),n(kh,[2,400]),{13:f,16:d,44:215,45:Dh,48:[1,591],55:220,82:M,87:h,89:ut,172:221,185:351,203:536,212:592,231:Lh,234:535,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},n(Nh,[2,426]),n(Db,[2,138]),n(Db,[2,139]),{232:[1,593]},n(Ga,[2,292]),{47:[1,595],48:[1,594]},n(zc,[2,9]),n(qa,[2,392]),n(qa,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:Ua,308:p}),n(qa,[2,110],{272:[1,598]}),n(Mh,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(Ho,[2,58]),n(Tr,[2,445]),n(Tr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(ir,[2,99]),n(sr,[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(ir,[2,188]),n(ir,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:M,172:493,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,311:494,312:un,315:611},n(he,[2,42]),n(sf,[2,304]),{13:f,16:d,55:414,82:M,95:612,171:613,172:415,173:416,174:Ph,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:Fh},{31:[1,614],45:VI,94:615},n(fs,[2,129]),n(DI,[2,421]),{82:[1,616]},{82:[1,617]},n(Kc,[2,296]),n(Kc,[2,31]),n(Kc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(T,OI,{155:330,153:618,154:619,29:Xs,31:Xs,85:Xs,112:Xs,159:Xs,160:Xs,161:Xs,163:Xs,164:Xs}),n(qI,[2,358]),n(Ys,[2,75]),n(Ys,[2,76]),{29:ie,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(GI,[2,366]),n(Ys,[2,79]),{13:f,16:d,44:136,45:q,46:622,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Ys,[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(Yc,[2,117]),{13:f,16:d,44:215,45:Dh,55:220,82:M,87:h,89:ut,172:221,185:351,203:536,211:626,212:627,231:Lh,234:535,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:un},n(Ks,[2,134]),n(Nh,[2,427]),n(Ks,[2,135]),n(Ga,[2,26]),{44:628,87:h},n(qa,[2,106]),n(qa,[2,394]),n(T,[2,396]),n(Mh,[2,111]),n(Mh,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:Ua,307:43,308:p},n(Cb,[2,217]),n(T,Ah,{144:248,140:630,143:631,31:[2,343]}),n(ir,[2,97]),n(sr,[2,380]),n(ir,[2,180]),{13:f,16:d,44:136,45:q,46:632,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:633,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(ir,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:M,171:637,172:415,173:416,174:Ph,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:Fh},n(WI,[2,305]),n(he,[2,86]),n(sf,[2,374]),n(Ko,[2,37]),n(Ko,[2,38]),n(Va,[2,72]),n(Va,[2,360]),n(Ys,[2,77]),{29:ie,57:638},{47:[1,639]},{29:[2,376]},n(Yc,[2,402]),n(Yc,[2,115],{215:10,208:528,214:529,44:530,205:640,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),n(Yc,[2,118],{272:[1,641]}),n(jh,[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:Le,304:Ne,305:xe,306:ke},n(nf,[2,218]),n(sf,[2,44]),n(WI,[2,306]),n(Ys,[2,78]),{44:651,87:h},n(Yc,[2,116]),n(T,[2,406]),n(jh,[2,119]),n(jh,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(Ga,[2,27]),n(Mh,[2,230]),n(HI,[2,345],{141:653,335:[1,654]}),n(ir,[2,181]),n(ir,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(T,Ah,{144:248,142:657,143:658,31:zI,112:zI}),n(HI,[2,346]),n(Ys,[2,80]),n(jh,[2,231]),n(Ba,[2,67]),n(Ba,[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:a(function(D,j){if(j.recoverable)this.trace(D);else{var H=new Error(D);throw H.hash=j,H}},"parseError"),parse:a(function(D){var j=this,H=[0],we=[],He=[null],_=[],hn=this.table,E="",ps=0,lf=0,Vh=0,qh=2,uf=1,Gh=_.slice.call(arguments,1),Gt=Object.create(this.lexer),ms={yy:{}};for(var ff in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ff)&&(ms.yy[ff]=this.yy[ff]);Gt.setInput(D,ms.yy),ms.yy.lexer=Gt,ms.yy.parser=this,typeof Gt.yylloc>"u"&&(Gt.yylloc={});var el=Gt.yylloc;_.push(el);var It=Gt.options&&Gt.options.ranges;typeof ms.yy.parseError=="function"?this.parseError=ms.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Mt(gs){H.length=H.length-2*gs,He.length=He.length-gs,_.length=_.length-gs}a(Mt,"popStack");for(var ft=a(function(){var gs;return gs=Gt.lex()||uf,typeof gs!="number"&&(gs=j.symbols_[gs]||gs),gs},"lex"),bt,Pn,Ka,li,Oae,zb,tl={},Wh,eo,sx,Hh;;){if(Ka=H[H.length-1],this.defaultActions[Ka]?li=this.defaultActions[Ka]:((bt===null||typeof bt>"u")&&(bt=ft()),li=hn[Ka]&&hn[Ka][bt]),typeof li>"u"||!li.length||!li[0]){var Kb="";Hh=[];for(Wh in hn[Ka])this.terminals_[Wh]&&Wh>qh&&Hh.push("'"+this.terminals_[Wh]+"'");Gt.showPosition?Kb="Parse error on line "+(ps+1)+`:
|
|
33
|
+
`)}a(N6,"composeErrorMessage");function k6(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=L6(r,e);return N6(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}a(k6,"formatErrorCtor");Fp.formatErrorCtor=k6});var wR=w(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.isDisposable=void 0;function M6(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}a(M6,"isDisposable");Dp.isDisposable=M6});var ER=w(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.PostResolutionInterceptors=rc.PreResolutionInterceptors=void 0;var vR=SS(),Lp=class extends vR.default{static{a(this,"PreResolutionInterceptors")}};rc.PreResolutionInterceptors=Lp;var Np=class extends vR.default{static{a(this,"PostResolutionInterceptors")}};rc.PostResolutionInterceptors=Np;var IS=class{static{a(this,"Interceptors")}constructor(){this.preResolution=new Lp,this.postResolution=new Np}};rc.default=IS});var Jo=w(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.instance=so.typeInfo=void 0;var j6=(Ep(),zh(vp)),mn=yS(),$6=bR(),kp=Rp(),U6=_R(),Nn=fS(),Mp=SR(),B6=AS(),V6=xp(),q6=wR(),G6=ER();so.typeInfo=new Map;var xS=class n{static{a(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new U6.default,this.interceptors=new G6.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:Nn.default.Transient}){this.ensureNotDisposed();let i;if($6.isProvider(t)?i=t:i={useClass:t},mn.isTokenProvider(i)){let s=[e],o=i;for(;o!=null;){let c=o.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&&mn.isTokenProvider(l.provider)?o=l.provider:o=null}}if((r.lifecycle===Nn.default.Singleton||r.lifecycle==Nn.default.ContainerScoped||r.lifecycle==Nn.default.ResolutionScoped)&&(mn.isValueProvider(i)||mn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${Nn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),mn.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(),mn.isNormalToken(e)){if(mn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:Nn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Nn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!mn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:Nn.default.Singleton})}resolve(e,t=new Mp.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&mn.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(kp.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===Nn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===Nn.default.Singleton,i=e.options.lifecycle===Nn.default.ContainerScoped,s=r||i,o;return mn.isValueProvider(e.provider)?o=e.provider.useValue:mn.isTokenProvider(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):mn.isClassProvider(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):mn.isFactoryProvider(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,t),e.options.lifecycle===Nn.default.ResolutionScoped&&t.scopedResolutions.set(e,o),o}resolveAll(e,t=new Mp.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&mn.isNormalToken(e)){if(r)return[];throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"All"),i){let o=i.map(c=>this.resolveRegistration(c,t));return this.executePostResolutionInterceptor(e,o,"All"),o}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=>!mn.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===Nn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===Nn.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 j6.__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 V6.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=so.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 q6.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return kp.isTokenDescriptor(r)?kp.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Mp.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 Mp.default,r.isOptional):this.resolve(r.token,e,r.isOptional):kp.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(B6.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};so.instance=new xS;so.default=so.instance});var TR=w(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});var W6=ec(),oo=Jo(),RS=Rp(),H6=AS();function z6(){return function(n){let e=W6.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return RS.isTokenDescriptor(r)?RS.isTransformDescriptor(r)?r.multiple?oo.instance.resolve(r.transform).transform(oo.instance.resolveAll(r.token),...r.transformArgs):oo.instance.resolve(r.transform).transform(oo.instance.resolve(r.token),...r.transformArgs):r.multiple?oo.instance.resolveAll(r.token):oo.instance.resolve(r.token):RS.isTransformDescriptor(r)?oo.instance.resolve(r.transform).transform(oo.instance.resolve(r.token),...r.transformArgs):oo.instance.resolve(r)}catch(s){let o=i+t.length;throw new Error(H6.formatErrorCtor(n,o,s))}})))}}}}a(z6,"autoInjectable");CS.default=z6});var AR=w(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});var K6=ec();function Y6(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return K6.defineInjectionTokenMetadata(t)}a(Y6,"inject");OS.default=Y6});var jp=w(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});var Q6=ec(),X6=Jo(),IR=Jo();function J6(n){return function(e){X6.typeInfo.set(e,Q6.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{IR.instance.register(t,e)}):IR.instance.register(n.token,e))}}a(J6,"injectable");PS.default=J6});var xR=w(FS=>{"use strict";Object.defineProperty(FS,"__esModule",{value:!0});var Z6=(Ep(),zh(vp)),e7=Jo();function t7(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=Z6.__rest(t,["token","options"]);return e7.instance.register(r,s,i)}),e}}a(t7,"registry");FS.default=t7});var RR=w(DS=>{"use strict";Object.defineProperty(DS,"__esModule",{value:!0});var r7=jp(),n7=Jo();function i7(){return function(n){r7.default()(n),n7.instance.registerSingleton(n)}}a(i7,"singleton");DS.default=i7});var CR=w(LS=>{"use strict";Object.defineProperty(LS,"__esModule",{value:!0});var s7=ec();function o7(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return s7.defineInjectionTokenMetadata(t)}a(o7,"injectAll");LS.default=o7});var OR=w(NS=>{"use strict";Object.defineProperty(NS,"__esModule",{value:!0});var a7=ec();function c7(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return a7.defineInjectionTokenMetadata(r)}a(c7,"injectAllWithTransform");NS.default=c7});var PR=w(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});var l7=ec();function u7(n,e,...t){return l7.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}a(u7,"injectWithTransform");kS.default=u7});var FR=w(MS=>{"use strict";Object.defineProperty(MS,"__esModule",{value:!0});var f7=jp(),d7=Jo();function h7(n,e){return function(t){f7.default()(t),d7.instance.register(e||t,t,{lifecycle:n})}}a(h7,"scoped");MS.default=h7});var DR=w(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var p7=TR();Object.defineProperty(Ri,"autoInjectable",{enumerable:!0,get:a(function(){return p7.default},"get")});var m7=AR();Object.defineProperty(Ri,"inject",{enumerable:!0,get:a(function(){return m7.default},"get")});var g7=jp();Object.defineProperty(Ri,"injectable",{enumerable:!0,get:a(function(){return g7.default},"get")});var y7=xR();Object.defineProperty(Ri,"registry",{enumerable:!0,get:a(function(){return y7.default},"get")});var b7=RR();Object.defineProperty(Ri,"singleton",{enumerable:!0,get:a(function(){return b7.default},"get")});var _7=CR();Object.defineProperty(Ri,"injectAll",{enumerable:!0,get:a(function(){return _7.default},"get")});var S7=OR();Object.defineProperty(Ri,"injectAllWithTransform",{enumerable:!0,get:a(function(){return S7.default},"get")});var w7=PR();Object.defineProperty(Ri,"injectWithTransform",{enumerable:!0,get:a(function(){return w7.default},"get")});var v7=FR();Object.defineProperty(Ri,"scoped",{enumerable:!0,get:a(function(){return v7.default},"get")})});var LR=w(jS=>{"use strict";Object.defineProperty(jS,"__esModule",{value:!0});function E7(n){let e;return t=>(e==null&&(e=n(t)),e)}a(E7,"instanceCachingFactory");jS.default=E7});var NR=w($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});function T7(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}a(T7,"instancePerContainerCachingFactory");$S.default=T7});var kR=w(US=>{"use strict";Object.defineProperty(US,"__esModule",{value:!0});function A7(n,e,t,r=!0){let i,s;return o=>{let c=n(o);return(!r||s!==c)&&((s=c)?i=o.resolve(e):i=o.resolve(t)),i}}a(A7,"predicateAwareClassFactory");US.default=A7});var MR=w(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});var I7=LR();Object.defineProperty(Ff,"instanceCachingFactory",{enumerable:!0,get:a(function(){return I7.default},"get")});var x7=NR();Object.defineProperty(Ff,"instancePerContainerCachingFactory",{enumerable:!0,get:a(function(){return x7.default},"get")});var R7=kR();Object.defineProperty(Ff,"predicateAwareClassFactory",{enumerable:!0,get:a(function(){return R7.default},"get")})});var Ve=w(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});var BS=(Ep(),zh(vp));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 C7=yR();Object.defineProperty(Zo,"Lifecycle",{enumerable:!0,get:a(function(){return C7.Lifecycle},"get")});BS.__exportStar(DR(),Zo);BS.__exportStar(MR(),Zo);BS.__exportStar(yS(),Zo);var O7=xp();Object.defineProperty(Zo,"delay",{enumerable:!0,get:a(function(){return O7.delay},"get")});var P7=Jo();Object.defineProperty(Zo,"container",{enumerable:!0,get:a(function(){return P7.instance},"get")})});var ol=w($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.NullLogger=void 0;$p.NullLogger={debug(){},info(){},warn(){},error(){}}});var cl=w(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.bytesToBase64=$R;al.base64ToBytes=UR;al.base64ToUtf8=F7;al.utf8ToBase64=D7;var jR=32768;function $R(n){let e="";for(let t=0;t<n.length;t+=jR)e+=String.fromCharCode(...n.subarray(t,t+jR));return btoa(e)}a($R,"bytesToBase64");function UR(n){let e=n.replace(/\s/g,""),t=e.length%4,r=t===2||t===3?e+"=".repeat(4-t):e,i=atob(r),s=new Uint8Array(i.length);for(let o=0;o<i.length;o++)s[o]=i.charCodeAt(o);return s}a(UR,"base64ToBytes");function F7(n){return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(UR(n))}a(F7,"base64ToUtf8");function D7(n){return $R(new TextEncoder().encode(n))}a(D7,"utf8ToBase64")});var Up=w(VS=>{"use strict";Object.defineProperty(VS,"__esModule",{value:!0});VS.iriToObsidianName=L7;function L7(n){let e=n.match(/^https:\/\/exocortex\.my\/ontology\/([a-z][a-zA-Z0-9]*)#([^#]+)$/);if(e){let[,r,i]=e;return`${r}__${i}`}let t=n.match(/\/([^/]+)\.md$/);return t?t[1]:null}a(L7,"iriToObsidianName")});var BR=w(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.registerUniversalDefaultLoader=N7;ea.clearUniversalDefaultLoader=k7;ea.clearUniversalDefault=M7;ea.loadUniversalDefault=j7;ea.mergePropertyDefaults=$7;ea.mergeInheritanceRules=U7;var Bp=null,ao,Df=!1;function N7(n){Bp=n,ao=void 0,Df=!1}a(N7,"registerUniversalDefaultLoader");function k7(){Bp=null,ao=void 0,Df=!1}a(k7,"clearUniversalDefaultLoader");function M7(){ao=void 0,Df=!1}a(M7,"clearUniversalDefault");async function j7(){if(ao!==void 0)return ao;if(!Bp)return ao=null,null;try{ao=await Bp()??null}catch(n){Df||(console.warn("[UniversalDefaultTemplateResolver] loader threw, falling back to legacy primitives:",n),Df=!0),ao=null}return ao}a(j7,"loadUniversalDefault");function $7(n,e){let t=new Map;for(let s of e)t.set(s.propertyName,s);let r=[],i=new Set;for(let s of n){let o=t.get(s.propertyName);o?(r.push(o),i.add(o.propertyName)):r.push(s)}for(let s of e)i.has(s.propertyName)||r.push(s);return r}a($7,"mergePropertyDefaults");function U7(n,e){let t=new Map;for(let s of e)t.set(s.targetPropertyName,s);let r=[],i=new Set;for(let s of n){let o=t.get(s.targetPropertyName);o?(r.push(o),i.add(o.targetPropertyName)):r.push(s)}for(let s of e)i.has(s.targetPropertyName)||r.push(s);return r}a(U7,"mergeInheritanceRules")});var qS=w((pfe,VR)=>{var ll=class{static{a(this,"Wildcard")}constructor(){return B7||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(ll.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(ll.prototype,"termType",{enumerable:!0,value:"Wildcard"});var B7=new ll;VR.exports.Wildcard=ll});var GR=w((gfe,qR)=>{var V7=(function(){var n=a(function(N,D,j,H){for(j=j||{},H=N.length;H--;j[N[H]]=D);return j},"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],o=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],g=[123,126],y=[1,67],b=[39,45,87],S=[13,16,45,197,224,308],v=[1,87],I=[2,281],A=[1,86],T=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],R=[6,28,29,53,63,70,73,81,83,85],V=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],L=[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],P=[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],k=[13,16,308],O=[112,132,327,334],J=[13,16,112,132,308],re=[1,111],Y=[1,117],ye=[112,132,327,328,334],de=[13,16,112,132,308,328],le=[28,29,45,53,87],q=[1,138],M=[1,151],je=[1,128],Q=[1,127],G=[1,129],te=[1,140],Se=[1,141],X=[1,142],$e=[1,143],Be=[1,144],$=[1,145],ee=[1,147],me=[1,148],ve=[2,457],be=[1,158],pe=[1,159],Re=[1,160],B=[1,152],Z=[1,153],oe=[1,156],ge=[1,171],Ae=[1,172],Ie=[1,173],Oe=[1,174],Fe=[1,175],De=[1,176],Le=[1,167],Ne=[1,168],xe=[1,169],ke=[1,170],at=[1,157],Ze=[1,166],Je=[1,161],x=[1,162],C=[1,163],F=[1,164],U=[1,165],he=[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],At=[1,195],Ot=[6,31,73,81,83,85],ze=[2,285],ne=[1,199],ie=[1,201],ae=[6,31,70,73,81,83,85],ue=[2,283],We=[1,207],lt=[1,218],ut=[1,223],Mr=[1,219],On=[1,225],Qn=[1,226],fn=[1,224],bI=[6,63,70,73,81,83,85],_I=[1,236],SI=[2,334],wI=[1,243],vI=[1,241],jr=[6,193],Ah=[2,349],EI=[2,339],Ho=[28,128],TI=[47,48,193,272],Ih=[47,48,193,242,272],Wc=[47,48,193,242,246,272],Hc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Tr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],AI=[1,271],II=[1,270],ir=[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],xI=[1,281],RI=[1,280],dn=[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],tf=[45,89],xh=[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],Rh=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ch=[31,89],Oh=[48,87],$a=[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],fs=[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],CI=[1,313],zc=[6,85],Rb=[6,31,81,83,85],OI=[2,361],zs=[2,353],Ua=[1,343],rf=[31,112,335],Ks=[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],Cb=[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],PI=[6,109,193],Ba=[31,112],sr=[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],Ob=[1,390],Pb=[1,391],zo=[13,16,87,197,308,314],FI=[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],Ph=[1,417],Fh=[1,418],DI=[13,16,48,197,229,308],Ko=[6,31,85],LI=[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],Fb=[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],Va=[29,31,85,112,159,160,161,163,164],Dh=[1,443],Lh=[1,444],NI=[1,449],qa=[31,112,193,232,318,335],Nh=[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],kI=[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],Db=[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],nf=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],sf=[31,45],MI=[1,507],jI=[1,508],$I=[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],kh=[29,31,85,112,159,160,161,163,164,335],Ga=[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],UI=[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],BI=[2,352],Lb=[13,16,197,308,314],VI=[1,565],Kc=[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],qI=[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],Ys=[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],GI=[13,16,87,308],Qs=[2,364],Yc=[29,31,85,112,159,160,161,163,164,193,232,318,335],Mh=[31,112,193,232,272,318,335],Xs=[2,359],WI=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],jh=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],HI=[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],zI=[2,347],Nb={trace:a(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:a(function(D,j,H,we,He,_,pn){var E=_.length-1;switch(He){case 1:if(_[E-1]=_[E-1]||{},Ye.base&&(_[E-1].base=Ye.base),Ye.base="",_[E-1].prefixes=Ye.prefixes,Ye.prefixes=null,Ye.pathOnly){if(_[E-1].type==="path"||"termType"in _[E-1])return _[E-1];throw new Error("Received full SPARQL query in path only mode")}else if(_[E-1].type==="path"||"termType"in _[E-1])throw new Error("Received only path in full SPARQL mode");if(_[E-1].type==="update"){let It={};for(let Mt of _[E-1].updates)if(Mt.updateType==="insert"){let ft={};for(let bt of Mt.insert)if(bt.type==="bgp"||bt.type==="graph")for(let Pn of bt.triples)Pn.subject.termType==="BlankNode"&&(ft[Pn.subject.value]=!0),Pn.predicate.termType==="BlankNode"&&(ft[Pn.predicate.value]=!0),Pn.object.termType==="BlankNode"&&(ft[Pn.object.value]=!0);for(let bt of Object.keys(ft)){if(It[bt])throw new Error("Detected reuse blank node across different INSERT DATA clauses");It[bt]=!0}}}return _[E-1];case 2:this.$={..._[E-1],..._[E],type:"query"};break;case 4:Ye.base=of(_[E]);break;case 5:Ye.prefixes||(Ye.prefixes={}),_[E-1]=_[E-1].substr(0,_[E-1].length-1),_[E]=of(_[E]),Ye.prefixes[_[E-1]]=_[E];break;case 6:this.$={..._[E-3],...za(_[E-2]),..._[E-1],..._[E]};break;case 7:if(!Ye.skipValidation&&(qb(_[E-3].variables.map(Mt=>Vb(Mt.expression))).some(Mt=>Mt.aggregation==="count"&&!(Mt.expression instanceof $h))||_[E].group)){for(let Mt of _[E-3].variables)if(Mt.termType==="Variable"){if(!_[E].group||!_[E].group.map(ft=>Zc(ft)).includes(Zc(Mt)))throw Error("Projection of ungrouped variable (?"+Zc(Mt)+")")}else if(Vb(Mt.expression).length===0){let ft=p9(Mt.expression);for(let bt of ft)if(!_[E].group||!_[E].group.map||!_[E].group.map(Pn=>Zc(Pn)).includes(Zc(bt)))throw Error("Use of ungrouped variable in projection of operation (?"+Zc(bt)+")")}}let ms=_[E-1].where.filter(It=>It.type==="query");if(ms.length>0){let It=_[E-3].variables.filter(ft=>ft.variable&&ft.variable.value).map(ft=>ft.variable.value),Mt=qb(ms.map(ft=>ft.variables)).map(ft=>ft.value||ft.variable.value);for(let ft of It)if(Mt.indexOf(ft)>=0)throw Error("Target id of 'AS' (?"+ft+") already used in subquery")}this.$=Jt(_[E-3],za(_[E-2]),_[E-1],_[E]);break;case 8:this.$=Jt({queryType:"CONSTRUCT",template:_[E-3]},za(_[E-2]),_[E-1],_[E]);break;case 9:this.$=Jt({queryType:"CONSTRUCT",template:_[E-2]=_[E-2]?_[E-2].triples:[]},za(_[E-5]),{where:[{type:"bgp",triples:Ha([],_[E-2])}]},_[E]);break;case 10:this.$=Jt({queryType:"DESCRIBE",variables:_[E-3]==="*"?[new $h]:_[E-3]},za(_[E-2]),_[E-1],_[E]);break;case 11:this.$=Jt({queryType:"ASK"},za(_[E-2]),_[E-1],_[E]);break;case 12:this.$=Jt(_[E-1],{variables:[new $h]});break;case 13:let ff=_[E].map(It=>It.value||It.variable.value),el=m9(ff);if(el.length>0)throw Error("Two or more of the resulting columns have the same name (?"+el[0]+")");this.$=Jt(_[E-1],{variables:_[E]});break;case 14:this.$=Jt({queryType:"SELECT"},_[E]&&(_[E-1]=hn(_[E]),_[E]={},_[E][_[E-1]]=!0,_[E]));break;case 16:case 27:this.$=Qc(_[E-3],{variable:_[E-1]});break;case 17:case 18:this.$=Jt(_[E-3],_[E-2],_[E-1],_[E],{type:"query"});break;case 19:case 58:this.$={iri:_[E],named:!!_[E-1]};break;case 20:this.$={where:_[E].patterns};break;case 21:this.$=Jt(_[E-1],_[E]);break;case 22:this.$=Jt(_[E-2],_[E-1],_[E]);break;case 23:this.$={group:_[E]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=Qc(_[E]);break;case 26:this.$=Qc(_[E-1]);break;case 29:this.$={having:_[E]};break;case 30:this.$={order:_[E]};break;case 32:this.$=Qc(_[E],{descending:!0});break;case 35:this.$={limit:Jc(_[E])};break;case 36:this.$={offset:Jc(_[E])};break;case 37:this.$={limit:Jc(_[E-2]),offset:Jc(_[E])};break;case 38:this.$={limit:Jc(_[E]),offset:Jc(_[E-2])};break;case 39:case 43:this.$={type:"values",values:_[E]};break;case 40:case 84:this.$=_[E-1].map(It=>({[_[E-3]]:It}));break;case 41:case 85:this.$=_[E-1].map(()=>({}));break;case 42:case 86:var ps=_[E-4].length;_[E-4]=_[E-4].map(kb),this.$=_[E-1].map(function(It){if(It.length!==ps)throw Error("Inconsistent VALUES length");for(var Mt={},ft=0;ft<ps;ft++)Mt["?"+_[E-4][ft].value]=It[ft];return Mt});break;case 44:case 65:case 100:case 126:case 175:this.$=_[E-1];break;case 45:this.$={type:"update",updates:Js(_[E-2],_[E-1])};break;case 46:this.$=Jt({type:"load",silent:!!_[E-2],source:_[E-1]},_[E]&&{destination:_[E]});break;case 47:this.$={type:hn(_[E-2]),silent:!!_[E-1],graph:_[E]};break;case 48:this.$={type:hn(_[E-4]),silent:!!_[E-3],source:_[E-2],destination:_[E]};break;case 49:this.$={type:"create",silent:!!_[E-2],graph:{type:"graph",name:_[E]}};break;case 50:this.$={updateType:"insert",insert:ix(_[E])};break;case 51:this.$={updateType:"delete",delete:Hb(ix(_[E]))};break;case 52:this.$={updateType:"deletewhere",delete:Hb(_[E])};break;case 53:this.$={updateType:"insertdelete",..._[E-4],..._[E-3],...za(_[E-2],"using"),where:_[E].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=_[E];break;case 55:this.$={delete:Hb(_[E-1]),insert:_[E]||[]};break;case 56:this.$={delete:[],insert:_[E]};break;case 59:this.$={graph:_[E]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:_[E]};break;case 64:this.$={[hn(_[E])]:!0};break;case 66:this.$=_[E-1]?ds(_[E],[_[E-1]]):ds(_[E]);break;case 67:var lf=Jt(_[E-3]||{triples:[]},{type:"graph",name:_[E-5]});this.$=_[E]?[lf,_[E]]:[lf];break;case 68:case 73:this.$={type:"bgp",triples:ds(_[E-2],[_[E-1]])};break;case 69:this.$={type:"group",patterns:[_[E-1]]};break;case 70:for(let It of _[E-1].filter(Mt=>Mt.type==="bind")){let Mt=_[E-1].indexOf(It),ft=new Set;for(let bt of _[E-1].slice(0,Mt))(bt.type==="group"||bt.type==="bgp")&&rx(bt).forEach(Pn=>ft.add(Pn));if(ft.has(It.variable.value))throw Error("Variable used to bind is already bound (?"+It.variable.value+")")}this.$={type:"group",patterns:_[E-1]};break;case 71:this.$=_[E-1]?ds([_[E-1]],_[E]):ds(_[E]);break;case 72:this.$=_[E]?[_[E-2],_[E]]:_[E-2];break;case 75:this.$=Jt(_[E],{type:"optional"});break;case 76:this.$=Jt(_[E],{type:"minus"});break;case 77:this.$=Jt(_[E],{type:"graph",name:_[E-1]});break;case 78:this.$=Jt(_[E],{type:"service",name:_[E-1],silent:!!_[E-2]});break;case 79:this.$={type:"filter",expression:_[E]};break;case 80:this.$={type:"bind",variable:_[E-1],expression:_[E-3]};break;case 89:this.$=cf(_[E]);break;case 90:this.$=void 0;break;case 91:this.$=_[E-1].length?{type:"union",patterns:ds(_[E-1].map(jb),[jb(_[E])])}:_[E];break;case 95:this.$={..._[E],function:_[E-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Js(_[E-2],_[E-1]),distinct:!!_[E-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.$=Js(_[E-2],_[E-1]);break;case 101:this.$=ds(_[E-2],[_[E-1]]);break;case 102:case 112:this.$=Wb(_[E].map(It=>Jt(Zs(_[E-1]),It)));break;case 103:this.$=Wb(Ha(_[E].map(It=>Jt(Zs(_[E-1].entity),It)),_[E-1].triples));break;case 105:this.$=ds([_[E-1]],_[E]);break;case 106:this.$=ds(_[E]);break;case 107:this.$=Bb(_[E-1],_[E]);break;case 109:case 237:this.$=Ye.factory.namedNode(i9);break;case 110:case 118:this.$=Js(_[E-1],_[E]);break;case 111:this.$=_[E]?{annotation:_[E],object:_[E-1]}:_[E-1];break;case 113:this.$=_[E]?Wb(Ha(_[E].map(It=>Jt(Zs(_[E-1].entity),It)),_[E-1].triples)):_[E-1].triples;break;case 114:this.$=Bb(..._[E-1],_[E]);break;case 116:this.$=Bb(..._[E]);break;case 117:case 159:case 163:this.$=[_[E-1],_[E]];break;case 119:this.$=_[E]?{object:_[E-1],annotation:_[E]}:_[E-1];break;case 120:this.$=_[E-1].length?Xc("|",Js(_[E-1],_[E])):_[E];break;case 121:this.$=_[E-1].length?Xc("/",Js(_[E-1],_[E])):_[E];break;case 122:this.$=_[E]?Xc(_[E],[_[E-1]]):_[E-1];break;case 123:this.$=_[E-1]?Xc(_[E-1],[_[E]]):_[E];break;case 125:case 131:this.$=Xc(_[E-1],[_[E]]);break;case 129:this.$=Xc("|",Js(_[E-2],_[E-1]));break;case 132:case 134:this.$=d9(_[E-1]);break;case 133:case 135:this.$=h9(_[E-1]);break;case 140:this.$={entity:_[E],triples:[]};break;case 145:this.$=kb(_[E]);break;case 149:this.$=Ye.factory.namedNode(KI);break;case 151:case 153:case 158:case 162:this.$=Mb(_[E-1],_[E]);break;case 152:this.$=["||",_[E]];break;case 154:this.$=["&&",_[E]];break;case 156:this.$=$r(_[E-1],[_[E-2],_[E]]);break;case 157:this.$=$r(_[E-2]?"notin":"in",[_[E-3],_[E]]);break;case 160:this.$=["+",Mb(_[E-1],_[E])];break;case 161:var Vh=hs(_[E-1].value.replace("-",""),_[E-1].datatype);this.$=["-",Mb(Vh,_[E])];break;case 164:this.$=$r("UPLUS",[_[E]]);break;case 165:this.$=$r(_[E-1],[_[E]]);break;case 166:this.$=$r("UMINUS",[_[E]]);break;case 177:this.$=$r(hn(_[E-1]));break;case 178:this.$=$r(hn(_[E-3]),[_[E-1]]);break;case 179:this.$=cf($r(hn(_[E-3]),[_[E-1]]));break;case 180:this.$=$r(hn(_[E-5]),[_[E-3],_[E-1]]);break;case 181:this.$=$r(hn(_[E-7]),[_[E-5],_[E-3],_[E-1]]);break;case 182:this.$=cf($r(hn(_[E-7]),[_[E-5],_[E-3],_[E-1]]));break;case 183:this.$=$r(hn(_[E-1]),_[E]);break;case 184:this.$=$r("bound",[kb(_[E-1])]);break;case 185:this.$=$r(_[E-1],[]);break;case 186:this.$=$r(_[E-3],[_[E-1]]);break;case 187:this.$=$r(_[E-2]?"notexists":"exists",[jb(_[E])]);break;case 188:case 189:this.$=Qc(_[E-1],{type:"aggregate",aggregation:hn(_[E-4]),distinct:!!_[E-2]});break;case 190:this.$=Qc(_[E-2],{type:"aggregate",aggregation:hn(_[E-5]),distinct:!!_[E-3],separator:typeof _[E-1]=="string"?_[E-1]:" "});break;case 192:this.$=hs(_[E]);break;case 193:this.$=c9(_[E-1],hn(_[E].substr(1)));break;case 194:this.$=hs(_[E-2],_[E]);break;case 195:case 204:this.$=hs(_[E],YI);break;case 196:case 205:this.$=hs(_[E],QI);break;case 197:case 206:this.$=hs(hn(_[E]),XI);break;case 200:this.$=hs(_[E].toLowerCase(),a9);break;case 201:this.$=hs(_[E].substr(1),YI);break;case 202:this.$=hs(_[E].substr(1),QI);break;case 203:this.$=hs(_[E].substr(1).toLowerCase(),XI);break;case 207:case 208:this.$=tx(_[E],1);break;case 209:case 210:this.$=tx(_[E],3);break;case 211:this.$=Ye.factory.namedNode(of(_[E]));break;case 213:var qh=_[E].indexOf(":"),uf=_[E].substr(0,qh),Gh=Ye.prefixes[uf];if(!Gh)throw new Error("Unknown prefix: "+uf);var Gt=of(Gh+_[E].substr(qh+1));this.$=Ye.factory.namedNode(Gt);break;case 214:if(_[E]=_[E].substr(0,_[E].length-1),!(_[E]in Ye.prefixes))throw new Error("Unknown prefix: "+_[E]);var Gt=of(Ye.prefixes[_[E]]);this.$=Ye.factory.namedNode(Gt);break;case 215:this.$=af(_[E].replace(/^(_:)/,""));break;case 216:this.$=af();break;case 217:case 218:case 232:this.$=cf($b(_[E-3],_[E-2],_[E-1]));break;case 230:case 231:this.$=cf(_[E-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:_[E-1].push(_[E]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[_[E]];break;case 308:_[E-3].push(_[E-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:_[E-2].push(_[E-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:o},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(g,[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:y,87:h},n(b,[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:v,29:I,52:84,53:A,56:85},{19:88,28:v,29:I,52:89,53:A,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:A},n(T,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(R,[2,263],{34:96}),n(R,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(R,[2,262]),n(V,[2,259]),n(L,[2,143]),n(L,[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(P,[2,211]),n(P,[2,212]),n(P,[2,213]),n(P,[2,214]),{19:98,28:v,29:I,52:99,53:A,56:85},{6:[2,309],99:100,193:[1,101]},n(k,[2,311],{101:102,328:[1,103]}),n(O,[2,317],{104:104,328:[1,105]}),n(J,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:re,114:110},{29:re,114:112},{29:re,114:113},{118:114,123:[1,115],125:116,126:Y},n(ye,[2,315]),n(ye,[2,316]),n(de,[2,319]),n(de,[2,320]),n(de,[2,321]),n(g,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:y,87:h}),n(le,[2,269]),n(le,[2,15]),{13:f,16:d,44:136,45:q,46:120,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(b,[2,14]),n(b,[2,274]),n(b,[2,271]),n(b,[2,272]),n(e,[2,4]),{13:[1,177]},n(he,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:d,45:[1,193],55:194,197:At,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(S,[2,419]),n(Ot,ze,{20:196,59:197,69:198,70:ne}),n(l,[2,250]),{29:ie,57:200},n(k,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(ae,ue,{23:204,58:205,62:206,63:We}),n(l,[2,252]),{19:208,28:v,29:I,52:209,53:A,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:lt,55:220,82:M,87:h,89:ut,145:212,172:221,185:213,187:214,231:Mr,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},n(bI,[2,265],{56:85,35:227,52:228,19:229,28:v,29:I,53:A}),n(V,[2,260]),n(ae,ue,{58:205,62:206,23:230,63:We}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:p},n(k,[2,312]),{105:233,112:_I,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(O,[2,318]),n(k,SI,{108:240,133:242,112:wI,132:vI}),n(J,[2,323]),{112:[1,244]},{112:[2,325]},n(jr,[2,50]),n(T,Ah,{135:245,136:246,143:247,144:248,31:EI,112:EI}),n(jr,[2,51]),n(jr,[2,52]),n(Ho,[2,328],{119:249}),{29:re,114:250},n(Ho,[2,56]),{29:re,114:251},n(g,[2,59]),n(le,[2,270]),{47:[1,252]},n(TI,[2,150]),n(Ih,[2,428],{240:253}),n(Wc,[2,430],{244:254}),n(Wc,[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(Hc,[2,440],{252:264}),n(Tr,[2,448],{260:265}),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Tr,[2,167]),n(Tr,[2,168]),n(Tr,[2,169]),n(Tr,[2,170],{176:269,45:AI,89:II}),n(Tr,[2,171]),n(Tr,[2,172]),n(Tr,[2,173]),n(Tr,[2,174]),{13:f,16:d,44:136,45:q,46:272,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(ir,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:xI,89:RI,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(dn,[2,192],{292:[1,286],293:[1,287]}),n(dn,[2,195]),n(dn,[2,196]),n(dn,[2,197]),n(dn,[2,198]),n(dn,[2,199]),n(dn,[2,200]),{13:f,16:d,44:39,55:40,82:M,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(tf,[2,452]),n(tf,[2,453]),n(tf,[2,454]),n(tf,[2,455]),n(tf,[2,456]),{279:[2,458]},n(xh,[2,207]),n(xh,[2,208]),n(xh,[2,209]),n(xh,[2,210]),n(dn,[2,201]),n(dn,[2,202]),n(dn,[2,203]),n(dn,[2,204]),n(dn,[2,205]),n(dn,[2,206]),n(e,[2,5]),n(Rh,[2,297],{88:295}),n(Ch,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(Oh,[2,301]),n(he,[2,43]),n(he,[2,82]),n(he,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n($a,[2,123]),n($a,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(fs,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:At,223:312,225:308,226:309,229:CI,307:43,308:p},n(c,i,{215:10,214:314}),n(fs,[2,236]),n(fs,[2,237]),n(zc,[2,6]),n(Rb,[2,287],{60:315,72:316,73:[1,317]}),n(Ot,[2,286]),{13:f,16:d,45:q,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,307:43,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U},n([6,31,63,70,73,81,83,85],[2,20]),n(T,OI,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:zs,31:zs,85:zs,112:zs,159:zs,160:zs,161:zs,163:zs,164:zs,41:s}),{13:f,16:d,55:331,307:43,308:p},n(k,[2,280]),n(zc,[2,7]),n(Ot,ze,{59:197,69:198,20:332,70:ne}),n(ae,[2,284]),{64:[1,333]},n(ae,ue,{58:205,62:206,23:334,63:We}),n(l,[2,254]),n(T,Ah,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:h,139:342,186:339,190:340,195:341,197:Ua,307:43,308:p},n(rf,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:d,87:h,197:Ua,308:p}),n(Ks,[2,227]),n(Ks,[2,228]),n(Ks,[2,229]),{13:f,16:d,44:215,45:lt,55:220,82:M,87:h,89:ut,172:221,185:351,187:350,200:348,230:347,231:Mr,234:349,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:Ua,307:43,308:p},n(Ks,[2,146]),n(Ks,[2,147]),n(Ks,[2,148]),n(Ks,[2,149]),{13:f,16:d,44:354,55:355,82:M,87:h,172:357,237:356,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:358,312:fn,313:353},n(Cb,[2,215]),n(Cb,[2,216]),n(ae,ue,{58:205,62:206,23:359,63:We}),n(R,[2,264]),n(bI,[2,266]),n(zc,[2,11]),n(r,[2,308],{6:[2,310]}),n(jr,[2,313],{102:360,120:361,121:[1,362]}),n(jr,[2,47]),n(jr,[2,63]),n(jr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(jr,[2,336]),n(jr,[2,337]),n(jr,[2,338]),{109:[1,364]},n(PI,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(k,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(Ba,[2,341],{137:368}),n(Ba,[2,340]),{13:f,16:d,44:215,45:lt,55:220,82:M,87:h,89:ut,145:369,172:221,185:213,187:214,231:Mr,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},{28:[1,370],127:371,128:[1,372]},n(Ho,[2,330],{124:373,125:374,126:Y}),n(Ho,[2,57]),{44:375,87:h},n(TI,[2,151],{241:376,242:[1,377]}),n(Ih,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,247:380,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{250:[1,381]},n(sr,[2,432]),n(sr,[2,433]),n(sr,[2,434]),n(sr,[2,435]),n(sr,[2,436]),n(sr,[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:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De}),n(Hc,[2,162],{261:388,262:389,39:Ob,338:Pb}),n(Tr,[2,164]),n(Tr,[2,165]),n(Tr,[2,166]),n(ir,[2,95]),n(ir,[2,96]),n(sr,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(ir,[2,177]),{13:f,16:d,44:136,45:q,46:395,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:396,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:397,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:398,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:399,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(ir,[2,183]),n(ir,[2,98]),n(sr,[2,381],{180:400}),{87:[1,401]},n(ir,[2,185]),{13:f,16:d,44:136,45:q,46:402,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{29:ie,57:403},n(dn,[2,193]),{13:f,16:d,55:404,307:43,308:p},{13:f,16:d,44:39,55:40,87:h,139:342,195:405,197:Ua,307:43,308:p},n(zo,[2,233]),n(zo,[2,234]),n(zo,[2,235]),n(FI,[2,459],{281:406,325:[1,407]}),n(sr,[2,463],{284:408,325:[1,409]}),n(sr,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:M,171:413,172:415,173:416,174:Ph,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:Fh},{31:[1,419],89:[1,420]},{29:[1,421]},n(Oh,[2,302]),n(Rh,[2,367],{167:422}),n(Ch,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(Oh,[2,371]),n($a,[2,122]),n($a,[2,417]),n($a,[2,413]),n($a,[2,414]),n($a,[2,415]),n(fs,[2,125]),n(fs,[2,127]),n(fs,[2,128]),n(DI,[2,420],{227:426}),n(fs,[2,130]),{13:f,16:d,55:194,197:At,223:427,307:43,308:p},{48:[1,428]},n(Ko,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(Rb,[2,288]),{64:[1,433]},n(Ot,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:d,45:q,268:te,269:Se,270:X,271:$e,273:Be,274:$,276:ee,277:me,279:ve,280:be,283:pe,285:Re,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U}),n(LI,[2,293]),n(Fb,[2,92]),n(Fb,[2,93]),n(Fb,[2,94]),{45:AI,89:II,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:v,29:I,56:85},{19:438,28:v,29:I,56:85},n(Va,[2,355],{149:439}),n(Va,[2,354]),{13:f,16:d,44:215,45:Dh,55:220,82:M,87:h,89:ut,156:440,172:221,185:441,203:442,231:Lh,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},n(R,[2,19]),n(Ko,[2,21]),{13:f,16:d,44:450,45:NI,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,307:43,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(zc,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(T,[2,386],{31:[2,388]}),n(rf,[2,102]),n(qa,[2,391],{191:452}),n(T,[2,395],{196:453,198:454}),n(T,[2,108]),n(T,[2,109]),n(rf,[2,103]),n(rf,[2,104]),n(rf,[2,390]),{13:f,16:d,44:215,45:lt,48:[1,455],55:220,82:M,87:h,89:ut,172:221,185:351,187:350,200:456,231:Mr,234:349,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},n(Nh,[2,424]),n(kI,[2,136]),n(kI,[2,137]),n(Db,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:Ua,307:43,308:p},n(zo,[2,219]),n(zo,[2,220]),n(zo,[2,221]),n(zo,[2,222]),n(zo,[2,223]),n(zc,[2,10]),n(jr,[2,46]),n(jr,[2,314]),{112:_I,122:459},n(jr,[2,62]),n(k,SI,{133:242,108:460,112:wI,132:vI}),n(PI,[2,61]),n(jr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Ba,[2,351],{146:463,335:[1,464]}),{29:ie,57:465},n(Ho,[2,329]),n(k,[2,332],{129:466,327:[1,467]}),n(Ho,[2,55]),n(Ho,[2,331]),{48:[1,468]},n(Ih,[2,429]),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Wc,[2,431]),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,243:470,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Wc,[2,156]),{45:xI,89:RI,179:471},n(Hc,[2,441]),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,251:472,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Tr,[2,444],{256:473}),n(Tr,[2,446],{258:474}),n(sr,[2,442]),n(sr,[2,443]),n(Tr,[2,449]),{13:f,16:d,44:136,45:q,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,255:154,257:155,259:475,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(sr,[2,450]),n(sr,[2,451]),n(sr,[2,379],{178:476}),n(sr,[2,378]),n([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:f,16:d,44:136,45:q,46:482,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{48:[1,483]},{48:[1,484]},n(ir,[2,187]),n(dn,[2,194]),{13:f,16:d,44:39,55:40,82:M,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,320:485},{13:f,16:d,39:[1,487],44:136,45:q,46:488,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,282:486,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(FI,[2,460]),{13:f,16:d,44:136,45:q,46:489,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(sr,[2,464]),{13:f,16:d,44:136,45:q,46:490,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(sr,[2,466]),n(he,[2,40]),n(Rh,[2,298]),n(nf,[2,87]),n(nf,[2,88]),n(nf,[2,89]),n(nf,[2,90]),{13:f,16:d,55:492,82:M,172:493,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,311:494,312:fn,315:491},n(he,[2,41]),n(Ch,[2,300]),n(sf,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:M,171:497,172:415,173:416,174:Ph,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:Fh},{31:[1,498],89:[1,499]},{29:[1,500]},n(Oh,[2,372]),{13:f,16:d,48:[2,422],55:194,197:At,223:312,226:502,228:501,229:CI,307:43,308:p},n(fs,[2,131]),n(fs,[2,126]),n(Ko,[2,22]),n(Ko,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:q,55:323,67:321,68:322,74:505,75:506,76:MI,77:320,78:jI,79:509,87:h,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,307:43,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(LI,[2,294]),n($I,[2,69]),n($I,[2,70]),n(Ot,ze,{59:197,69:198,20:511,70:ne}),n(ae,ue,{58:205,62:206,23:512,63:We}),{29:[2,375],31:[2,71],84:522,85:o,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(Va,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:h}),n(kh,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),{13:f,16:d,44:215,45:Dh,55:220,82:M,87:h,89:ut,172:221,185:351,203:536,212:534,231:Lh,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(ae,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:d,45:NI,87:h,268:te,269:Se,270:X,271:$e,273:Be,274:$,276:ee,277:me,279:ve,280:be,283:pe,285:Re,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U}),n(Ga,[2,291]),n(Ga,[2,24]),n(Ga,[2,25]),{13:f,16:d,44:136,45:q,46:539,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Ga,[2,28]),n(ae,ue,{58:205,62:206,23:540,63:We}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(qa,[2,107]),{13:f,16:d,44:215,45:lt,55:220,82:M,87:h,89:ut,172:221,185:351,187:350,199:543,200:544,231:Mr,234:349,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},n(UI,[2,132]),n(Nh,[2,425]),n(UI,[2,133]),{13:f,16:d,44:354,55:355,82:M,87:h,172:357,237:356,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:358,312:fn,313:545},n(jr,[2,54]),n(jr,[2,48]),n(Ba,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(Ba,[2,68]),n(T,[2,350],{31:BI,112:BI}),n(jr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(k,[2,333]),n(le,[2,16]),n(Ih,[2,152]),n(Wc,[2,154]),n(Wc,[2,157]),n(Hc,[2,159]),n(Hc,[2,160],{262:389,261:548,39:Ob,338:Pb}),n(Hc,[2,161],{262:389,261:549,39:Ob,338:Pb}),n(Tr,[2,163]),{13:f,16:d,44:136,45:q,46:550,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(ir,[2,178]),n(ir,[2,179]),{13:f,16:d,44:136,45:q,46:551,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:552,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:553,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{48:[1,554],272:[1,555]},n(ir,[2,184]),n(ir,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:f,16:d,55:194,197:At,223:562,307:43,308:p},n(Lb,[2,224]),n(Lb,[2,225]),n(Lb,[2,226]),{31:[1,563],45:VI,94:564},n(he,[2,84]),n(Rh,[2,368]),n(he,[2,85]),n(Ch,[2,370]),n(sf,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(Ko,[2,35],{83:[1,569]}),n(Ko,[2,36],{81:[1,570]}),n(Rb,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:f,16:d,45:q,76:MI,78:jI,87:h,268:te,269:Se,270:X,271:$e,273:Be,274:$,276:ee,277:me,279:ve,280:be,283:pe,285:Re,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U}),n(Kc,[2,295]),{45:q,77:572},{45:q,77:573},n(Kc,[2,33]),n(Kc,[2,34]),{31:[2,275],50:574,84:575,85:o},{31:[2,277],51:576,84:577,85:o},n(Va,[2,356]),n(qI,[2,357],{152:578,335:[1,579]}),n(Ys,[2,74]),{29:ie,57:580},{29:ie,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(GI,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:q,55:323,67:321,68:322,77:320,79:585,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,307:43,308:p,346:Ze,347:Je,348:x,349:C,350:F,351:U},{45:[1,586]},n(Ys,[2,81]),{29:ie,57:587},n(Va,[2,73]),n(T,[2,362],{29:Qs,31:Qs,85:Qs,112:Qs,159:Qs,160:Qs,161:Qs,163:Qs,164:Qs}),n(kh,[2,112]),n(Yc,[2,401],{206:588}),n(T,[2,405],{209:589,210:590}),n(T,[2,403]),n(T,[2,404]),n(kh,[2,113]),n(kh,[2,400]),{13:f,16:d,44:215,45:Dh,48:[1,591],55:220,82:M,87:h,89:ut,172:221,185:351,203:536,212:592,231:Lh,234:535,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},n(Nh,[2,426]),n(Db,[2,138]),n(Db,[2,139]),{232:[1,593]},n(Ga,[2,292]),{47:[1,595],48:[1,594]},n(zc,[2,9]),n(qa,[2,392]),n(qa,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:Ua,308:p}),n(qa,[2,110],{272:[1,598]}),n(Mh,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(Ho,[2,58]),n(Tr,[2,445]),n(Tr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(ir,[2,99]),n(sr,[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(ir,[2,188]),n(ir,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:M,172:493,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,311:494,312:fn,315:611},n(he,[2,42]),n(sf,[2,304]),{13:f,16:d,55:414,82:M,95:612,171:613,172:415,173:416,174:Ph,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:Fh},{31:[1,614],45:VI,94:615},n(fs,[2,129]),n(DI,[2,421]),{82:[1,616]},{82:[1,617]},n(Kc,[2,296]),n(Kc,[2,31]),n(Kc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(T,OI,{155:330,153:618,154:619,29:Xs,31:Xs,85:Xs,112:Xs,159:Xs,160:Xs,161:Xs,163:Xs,164:Xs}),n(qI,[2,358]),n(Ys,[2,75]),n(Ys,[2,76]),{29:ie,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(GI,[2,366]),n(Ys,[2,79]),{13:f,16:d,44:136,45:q,46:622,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(Ys,[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(Yc,[2,117]),{13:f,16:d,44:215,45:Dh,55:220,82:M,87:h,89:ut,172:221,185:351,203:536,211:626,212:627,231:Lh,234:535,236:216,237:222,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,309:On,310:Qn,311:217,312:fn},n(Ks,[2,134]),n(Nh,[2,427]),n(Ks,[2,135]),n(Ga,[2,26]),{44:628,87:h},n(qa,[2,106]),n(qa,[2,394]),n(T,[2,396]),n(Mh,[2,111]),n(Mh,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:Ua,307:43,308:p},n(Cb,[2,217]),n(T,Ah,{144:248,140:630,143:631,31:[2,343]}),n(ir,[2,97]),n(sr,[2,380]),n(ir,[2,180]),{13:f,16:d,44:136,45:q,46:632,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},{13:f,16:d,44:136,45:q,46:633,55:133,67:132,68:134,77:131,82:M,87:h,172:135,224:je,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:Q,264:130,265:G,266:137,267:139,268:te,269:Se,270:X,271:$e,273:Be,274:$,275:146,276:ee,277:me,278:149,279:ve,280:be,283:pe,285:Re,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:at,346:Ze,347:Je,348:x,349:C,350:F,351:U},n(ir,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:M,171:637,172:415,173:416,174:Ph,255:154,257:155,291:150,294:B,295:Z,296:oe,297:ge,298:Ae,299:Ie,300:Oe,301:Fe,302:De,303:Le,304:Ne,305:xe,306:ke,307:43,308:p,312:Fh},n(WI,[2,305]),n(he,[2,86]),n(sf,[2,374]),n(Ko,[2,37]),n(Ko,[2,38]),n(Va,[2,72]),n(Va,[2,360]),n(Ys,[2,77]),{29:ie,57:638},{47:[1,639]},{29:[2,376]},n(Yc,[2,402]),n(Yc,[2,115],{215:10,208:528,214:529,44:530,205:640,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),n(Yc,[2,118],{272:[1,641]}),n(jh,[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:Le,304:Ne,305:xe,306:ke},n(nf,[2,218]),n(sf,[2,44]),n(WI,[2,306]),n(Ys,[2,78]),{44:651,87:h},n(Yc,[2,116]),n(T,[2,406]),n(jh,[2,119]),n(jh,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(Ga,[2,27]),n(Mh,[2,230]),n(HI,[2,345],{141:653,335:[1,654]}),n(ir,[2,181]),n(ir,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(T,Ah,{144:248,142:657,143:658,31:zI,112:zI}),n(HI,[2,346]),n(Ys,[2,80]),n(jh,[2,231]),n(Ba,[2,67]),n(Ba,[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:a(function(D,j){if(j.recoverable)this.trace(D);else{var H=new Error(D);throw H.hash=j,H}},"parseError"),parse:a(function(D){var j=this,H=[0],we=[],He=[null],_=[],pn=this.table,E="",ps=0,lf=0,Vh=0,qh=2,uf=1,Gh=_.slice.call(arguments,1),Gt=Object.create(this.lexer),ms={yy:{}};for(var ff in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ff)&&(ms.yy[ff]=this.yy[ff]);Gt.setInput(D,ms.yy),ms.yy.lexer=Gt,ms.yy.parser=this,typeof Gt.yylloc>"u"&&(Gt.yylloc={});var el=Gt.yylloc;_.push(el);var It=Gt.options&&Gt.options.ranges;typeof ms.yy.parseError=="function"?this.parseError=ms.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Mt(gs){H.length=H.length-2*gs,He.length=He.length-gs,_.length=_.length-gs}a(Mt,"popStack");for(var ft=a(function(){var gs;return gs=Gt.lex()||uf,typeof gs!="number"&&(gs=j.symbols_[gs]||gs),gs},"lex"),bt,Pn,Ka,li,Oae,zb,tl={},Wh,eo,sx,Hh;;){if(Ka=H[H.length-1],this.defaultActions[Ka]?li=this.defaultActions[Ka]:((bt===null||typeof bt>"u")&&(bt=ft()),li=pn[Ka]&&pn[Ka][bt]),typeof li>"u"||!li.length||!li[0]){var Kb="";Hh=[];for(Wh in pn[Ka])this.terminals_[Wh]&&Wh>qh&&Hh.push("'"+this.terminals_[Wh]+"'");Gt.showPosition?Kb="Parse error on line "+(ps+1)+`:
|
|
34
34
|
`+Gt.showPosition()+`
|
|
35
|
-
Expecting `+Hh.join(", ")+", got '"+(this.terminals_[bt]||bt)+"'":Kb="Parse error on line "+(ps+1)+": Unexpected "+(bt==uf?"end of input":"'"+(this.terminals_[bt]||bt)+"'"),this.parseError(Kb,{text:Gt.match,token:this.terminals_[bt]||bt,line:Gt.yylineno,loc:el,expected:Hh})}if(li[0]instanceof Array&&li.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Ka+", token: "+bt);switch(li[0]){case 1:H.push(bt),He.push(Gt.yytext),_.push(Gt.yylloc),H.push(li[1]),bt=null,Pn?(bt=Pn,Pn=null):(lf=Gt.yyleng,E=Gt.yytext,ps=Gt.yylineno,el=Gt.yylloc,Vh>0&&Vh--);break;case 2:if(eo=this.productions_[li[1]][1],tl.$=He[He.length-eo],tl._$={first_line:_[_.length-(eo||1)].first_line,last_line:_[_.length-1].last_line,first_column:_[_.length-(eo||1)].first_column,last_column:_[_.length-1].last_column},It&&(tl._$.range=[_[_.length-(eo||1)].range[0],_[_.length-1].range[1]]),zb=this.performAction.apply(tl,[E,lf,ps,ms.yy,li[1],He,_].concat(Gh)),typeof zb<"u")return zb;eo&&(H=H.slice(0,-1*eo*2),He=He.slice(0,-1*eo),_=_.slice(0,-1*eo)),H.push(this.productions_[li[1]][0]),He.push(tl.$),_.push(tl._$),sx=
|
|
36
|
-
`,r:"\r",f:"\f"},f9=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,Ub=String.fromCharCode;function tx(N,D){N=N.substring(D,N.length-D);try{N=N.replace(l9,function(j,H,we,He){var _;if(H){if(_=parseInt(H,16),isNaN(_))throw new Error;return Ub(_)}else if(we){if(_=parseInt(we,16),isNaN(_))throw new Error;return _<65535?Ub(_):Ub(55296+((_-=65536)>>10),56320+(_&1023))}else{var
|
|
35
|
+
Expecting `+Hh.join(", ")+", got '"+(this.terminals_[bt]||bt)+"'":Kb="Parse error on line "+(ps+1)+": Unexpected "+(bt==uf?"end of input":"'"+(this.terminals_[bt]||bt)+"'"),this.parseError(Kb,{text:Gt.match,token:this.terminals_[bt]||bt,line:Gt.yylineno,loc:el,expected:Hh})}if(li[0]instanceof Array&&li.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Ka+", token: "+bt);switch(li[0]){case 1:H.push(bt),He.push(Gt.yytext),_.push(Gt.yylloc),H.push(li[1]),bt=null,Pn?(bt=Pn,Pn=null):(lf=Gt.yyleng,E=Gt.yytext,ps=Gt.yylineno,el=Gt.yylloc,Vh>0&&Vh--);break;case 2:if(eo=this.productions_[li[1]][1],tl.$=He[He.length-eo],tl._$={first_line:_[_.length-(eo||1)].first_line,last_line:_[_.length-1].last_line,first_column:_[_.length-(eo||1)].first_column,last_column:_[_.length-1].last_column},It&&(tl._$.range=[_[_.length-(eo||1)].range[0],_[_.length-1].range[1]]),zb=this.performAction.apply(tl,[E,lf,ps,ms.yy,li[1],He,_].concat(Gh)),typeof zb<"u")return zb;eo&&(H=H.slice(0,-1*eo*2),He=He.slice(0,-1*eo),_=_.slice(0,-1*eo)),H.push(this.productions_[li[1]][0]),He.push(tl.$),_.push(tl._$),sx=pn[H[H.length-2]][H[H.length-1]],H.push(sx);break;case 3:return!0}}return!0},"parse")},$h=qS().Wildcard,Uh="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i9=Uh+"type",s9=Uh+"first",o9=Uh+"rest",KI=Uh+"nil",Bh="http://www.w3.org/2001/XMLSchema#",YI=Bh+"integer",QI=Bh+"decimal",XI=Bh+"double",a9=Bh+"boolean",Wa="",JI="",ZI="";function hn(N){return N.toLowerCase()}a(hn,"lowercase");function Js(N,D){return N.push(D),N}a(Js,"appendTo");function Ha(N,D){return N.push.apply(N,D),N}a(Ha,"appendAllTo");function Jt(N){N||(N={});for(var D=1,j=arguments.length,H;D<j&&(H=arguments[D]||{});D++)for(var we in H)N[we]=H[we];return N}a(Jt,"extend");function ds(){for(var N=[],D=0,j=arguments.length;D<j;D++)N=N.concat.apply(N,arguments[D]);return N}a(ds,"unionAll");function of(N){if(N[0]==="<"&&(N=N.substring(1,N.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(N))return N;if(!Ye.base)throw new Error("Cannot resolve relative IRI "+N+" because no base IRI was set.");switch(Wa!==Ye.base&&(Wa=Ye.base,JI=Wa.replace(/[^\/:]*$/,""),ZI=Wa.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),N[0]){case void 0:return Wa;case"#":return Wa+N;case"?":return Wa.replace(/(?:\?.*)?$/,N);case"/":return ZI+N;default:return JI+N}}a(of,"resolveIRI");function kb(N){if(N){var D=N[0];if(D==="?"||D==="$")return Ye.factory.variable(N.substr(1))}return N}a(kb,"toVar");function $r(N,D){return{type:"operation",operator:N,args:D||[]}}a($r,"operation");function Qc(N,D){var j={expression:N==="*"?new $h:N};if(D)for(var H in D)j[H]=D[H];return j}a(Qc,"expression");function Xc(N,D){return{type:"path",pathType:N,items:D}}a(Xc,"path");function Mb(N,D){for(var j=0,H=D.length,we;j<H&&(we=D[j]);j++)N=$r(we[0],[N,we[1]]);return N}a(Mb,"createOperationTree");function za(N,D){var j=[],H=[],we=N.length,He,_={};if(!we)return null;for(var pn=0;pn<we&&(He=N[pn]);pn++)(He.named?H:j).push(He.iri);return _[D||"from"]={default:j,named:H},_}a(za,"groupDatasets");function Jc(N){return parseInt(N,10)}a(Jc,"toInt");function jb(N){return N.type==="group"&&N.patterns.length===1?N.patterns[0]:N}a(jb,"degroupSingle");function hs(N,D){return D&&D.termType!=="NamedNode"&&(D=Ye.factory.namedNode(D)),Ye.factory.literal(N,D)}a(hs,"createTypedLiteral");function c9(N,D){return Ye.factory.literal(N,D)}a(c9,"createLangLiteral");function $b(N,D,j){if(!("termType"in D))throw new Error("Nested triples cannot contain paths");return Ye.factory.quad(N,D,j)}a($b,"nestedTriple");function Zs(N,D,j,H){var we={};return N!=null&&(we.subject=N),D!=null&&(we.predicate=D),j!=null&&(we.object=j),H!=null&&(we.annotations=H),we}a(Zs,"triple");function af(N){return typeof N=="string"?N.startsWith("e_")?Ye.factory.blankNode(N):Ye.factory.blankNode("e_"+N):Ye.factory.blankNode("g_"+ex++)}a(af,"blank");var ex=0;Ye._resetBlanks=function(){ex=0};var l9=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,u9={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
|
|
36
|
+
`,r:"\r",f:"\f"},f9=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,Ub=String.fromCharCode;function tx(N,D){N=N.substring(D,N.length-D);try{N=N.replace(l9,function(j,H,we,He){var _;if(H){if(_=parseInt(H,16),isNaN(_))throw new Error;return Ub(_)}else if(we){if(_=parseInt(we,16),isNaN(_))throw new Error;return _<65535?Ub(_):Ub(55296+((_-=65536)>>10),56320+(_&1023))}else{var pn=u9[He];if(!pn)throw new Error;return pn}})}catch{return""}if(f9.exec(N))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+N);return N}a(tx,"unescapeString");function d9(N){var D=af(),j=D,H=[],we,He=[];N.forEach(function(ps){H.push(ps.entity),Ha(He,ps.triples)});for(var _=0,pn=0,E=H.length,we=Array(E*2);_<E;)we[pn++]=Zs(j,Ye.factory.namedNode(s9),H[_]),we[pn++]=Zs(j,Ye.factory.namedNode(o9),j=++_<E?af():Ye.factory.namedNode(KI));return{entity:D,triples:Ha(we,He)}}a(d9,"createList");function h9(N){var D=af();return{entity:D,triples:N.map(function(j){return Jt(Zs(D),j)})}}a(h9,"createAnonymousObject");function Bb(N,D,j){var H=[],we=[];return D.forEach(function(He){let _=null;He.annotation&&(_=He.annotation,He=He.object),H.push(Zs(null,N,He.entity,_)),Ha(we,He.triples)}),ds(H,j||[],we)}a(Bb,"objectListToTriples");function Rae(N){for(var D=[],j,H=0,we;we=N[H];H++)switch(we.type){case"bgp":we.triples.length&&(j?Ha(j.triples,we.triples):Js(D,j=we));break;default:(!we.patterns||we.patterns.length>0)&&(Js(D,we),j=null)}return D}a(Rae,"mergeAdjacentBGPs");function Zc(N){return N.variable?N.variable.value:N.value||N.expression.value}a(Zc,"getExpressionId");function Vb(N){if(!N)return[];if(N.type==="aggregate")return[N];if(N.type==="operation"){let D=[];for(let j of N.args)D.push(...Vb(j));return D}return[]}a(Vb,"getAggregatesOfExpression");function p9(N){let D=new Set,j=a(function(H){H&&(H.termType==="Variable"?D.add(H):H.type==="operation"&&H.args.forEach(j))},"visitExpression");return j(N),D}a(p9,"getVariablesFromExpression");function qb(N,D=1,j=[]){for(let H of N)D>0&&H instanceof Array?qb(H,D-1,j):j.push(H);return j}a(qb,"flatten");function Gb(N){return N.termType==="Variable"}a(Gb,"isVariable");function rx(N){if(N.triples){let D=[];for(let j of N.triples)Gb(j.subject)&&D.push(j.subject.value),Gb(j.predicate)&&D.push(j.predicate.value),Gb(j.object)&&D.push(j.object.value);return D}else if(N.patterns){let D=[];for(let j of N.patterns)D.push(...rx(j));return D}return[]}a(rx,"getBoundVarsFromGroupGraphPattern");function m9(N){let D=N.slice().sort(),j=[];for(let H=0;H<D.length-1;H++)D[H+1]==D[H]&&j.push(D[H]);return j}a(m9,"getDuplicatesInArray");function cf(N){if(!Ye.sparqlStar)throw new Error("SPARQL-star support is not enabled");return N}a(cf,"ensureSparqlStar");function nx(N,D,j){for(let H of D){let we=Zs("subject"in H?H.subject:N,H.predicate,H.object);j.push(we),H.annotations&&nx($b(N,H.predicate,H.object),H.annotations,j)}}a(nx,"_applyAnnotations");function Wb(N){if(Ye.sparqlStar){let D=[];return N.forEach(j=>{let H=Zs(j.subject,j.predicate,j.object);D.push(H),j.annotations&&nx($b(j.subject,j.predicate,j.object),j.annotations,D)}),D}return N}a(Wb,"applyAnnotations");function Cae(N){if(!Ye.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return N}a(Cae,"ensureSparqlStarNestedQuads");function ix(N){for(let D of N){if(D.type==="graph"&&D.name.termType==="Variable")throw new Error("Detected illegal variable in GRAPH");if(D.type==="bgp"||D.type==="graph"){for(let j of D.triples)if(j.subject.termType==="Variable"||j.predicate.termType==="Variable"||j.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return N}a(ix,"ensureNoVariables");function Hb(N){for(let D of N)if(D.type==="bgp"){for(let j of D.triples)if(j.subject.termType==="BlankNode"||j.predicate.termType==="BlankNode"||j.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return N}a(Hb,"ensureNoBnodes");var g9=(function(){var N={EOF:1,parseError:a(function(j,H){if(this.yy.parser)this.yy.parser.parseError(j,H);else throw new Error(j)},"parseError"),setInput:a(function(D,j){return this.yy=j||this.yy||{},this._input=D,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:a(function(){var D=this._input[0];this.yytext+=D,this.yyleng++,this.offset++,this.match+=D,this.matched+=D;var j=D.match(/(?:\r\n?|\n).*/g);return j?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),D},"input"),unput:a(function(D){var j=D.length,H=D.split(/(?:\r\n?|\n)/g);this._input=D+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-j),this.offset-=j;var we=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),H.length-1&&(this.yylineno-=H.length-1);var He=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:H?(H.length===we.length?this.yylloc.first_column:0)+we[we.length-H.length].length-H[0].length:this.yylloc.first_column-j},this.options.ranges&&(this.yylloc.range=[He[0],He[0]+this.yyleng-j]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
37
37
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(D){this.unput(this.match.slice(D))},"less"),pastInput:a(function(){var D=this.matched.substr(0,this.matched.length-this.match.length);return(D.length>20?"...":"")+D.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var D=this.match;return D.length<20&&(D+=this._input.substr(0,20-D.length)),(D.substr(0,20)+(D.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var D=this.pastInput(),j=new Array(D.length+1).join("-");return D+this.upcomingInput()+`
|
|
38
38
|
`+j+"^"},"showPosition"),test_match:a(function(D,j){var H,we,He;if(this.options.backtrack_lexer&&(He={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&&(He.yylloc.range=this.yylloc.range.slice(0))),we=D[0].match(/(?:\r\n?|\n).*/g),we&&(this.yylineno+=we.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:we?we[we.length-1].length-we[we.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+D[0].length},this.yytext+=D[0],this.match+=D[0],this.matches=D,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(D[0].length),this.matched+=D[0],H=this.performAction.call(this,this.yy,this,j,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),H)return H;if(this._backtrack){for(var _ in He)this[_]=He[_];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var D,j,H,we;this._more||(this.yytext="",this.match="");for(var He=this._currentRules(),_=0;_<He.length;_++)if(H=this._input.match(this.rules[He[_]]),H&&(!j||H[0].length>j[0].length)){if(j=H,we=_,this.options.backtrack_lexer){if(D=this.test_match(H,He[_]),D!==!1)return D;if(this._backtrack){j=!1;continue}else return!1}else if(!this.options.flex)break}return j?(D=this.test_match(j,He[we]),D!==!1?D:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
39
39
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var j=this.next();return j||this.lex()},"lex"),begin:a(function(j){this.conditionStack.push(j)},"begin"),popState:a(function(){var j=this.conditionStack.length-1;return j>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(j){return j=this.conditionStack.length-1-Math.abs(j||0),j>=0?this.conditionStack[j]:"INITIAL"},"topState"),pushState:a(function(j){this.begin(j)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:a(function(j,H,we,He){var _=He;switch(we){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(H.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 N})();Nb.lexer=g9;function Ye(){this.yy={}}return a(Ye,"Parser"),Ye.prototype=Nb,Nb.Parser=Ye,new Ye})();qR.exports=V7});var KR=w((bfe,zR)=>{var q7="http://www.w3.org/2001/XMLSchema#integer",G7="http://www.w3.org/2001/XMLSchema#string";function Pt(n){this._options=n=n||{};var e=n.prefixes||{};this._prefixByIri={};var t=[];for(var r in e){var i=e[r];Lf(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=Lf(n.indent)?n.indent:" ",this._newline=Lf(n.newline)?n.newline:`
|
|
@@ -45,7 +45,7 @@ Expecting `+Hh.join(", ")+", got '"+(this.terminals_[bt]||bt)+"'":Kb="Parse erro
|
|
|
45
45
|
`)+`
|
|
46
46
|
`+s.trimStart()),s}findPrefixStarDeclarations(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(r.substring(i,i+6)==="PREFIX"){let s=i;for(i+=6;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]==="*"){for(i++;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]==="<"){i++;let o=i;for(;i<e.length&&e[i]!==">";)i++;if(e[i]===">"){let c=e.substring(o,i);i++;let l=this.findDeclarationEnd(e,i);t.push({uri:c,startPos:s,endPos:l}),i=l;continue}else throw new dl(`Unclosed IRI in PREFIX* declaration at position ${o}`)}else throw new dl(`Expected IRI after PREFIX* at position ${i}`)}else continue}i++}return t}findDeclarationEnd(e,t){let r=t;for(;r<e.length;){let i=e[r];if(i===`
|
|
47
47
|
`)return r+1;let s=e.substring(r).toUpperCase();if(s.startsWith("PREFIX")||s.startsWith("BASE")||s.startsWith("SELECT")||s.startsWith("CONSTRUCT")||s.startsWith("DESCRIBE")||s.startsWith("ASK"))return r;if(/\s/.test(i)){r++;continue}break}return r}extractPrefixFromUri(e){let t=e.replace(/^https?:\/\//,"");t=t.replace(/\/$/,"").replace(/#$/,"");let r=t.split(/[/.#]+/).filter(Boolean);if(r.length===0)return null;let i=r[r.length-1];return/^(ontology|vocab|schema|ns|core)$/i.test(i)&&r.length>1?r[r.length-2].toLowerCase():i.toLowerCase().replace(/[^a-z0-9]/g,"")}};na.PrefixStarTransformer=nw;var dl=class extends Error{static{a(this,"PrefixStarTransformerError")}constructor(e){super(`PREFIX* transformation error: ${e}`),this.name="PrefixStarTransformerError"}};na.PrefixStarTransformerError=dl});var iw=w(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.DescribeOptionsTransformer=pl.DescribeOptionsTransformerError=void 0;var Zp=class extends Error{static{a(this,"DescribeOptionsTransformerError")}constructor(e){super(e),this.name="DescribeOptionsTransformerError"}};pl.DescribeOptionsTransformerError=Zp;var hl=class n{static{a(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 o=parseInt(s[1],10);if(o<0)throw new Zp(`DESCRIBE DEPTH must be a non-negative integer, got: ${o}`);r.depth=o,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}};pl.DescribeOptionsTransformer=hl;hl.DEPTH_PATTERN=/\bDEPTH\s+(\d+)/gi;hl.SYMMETRIC_PATTERN=/\bSYMMETRIC\b/gi;hl.DESCRIBE_QUERY_PATTERN=/\bDESCRIBE\b/i});var rC=w(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.DirectionalLangTagTransformerError=ml.DirectionalLangTagTransformer=void 0;var em=class n{static{a(this,"DirectionalLangTagTransformer")}constructor(){this.directionMappings=new Map}transform(e){return this.directionMappings.clear(),e.replace(n.DIRECTIONAL_TAG_REGEX,(t,r,i,s,o)=>{let c=s.toLowerCase();return this.directionMappings.set(c,o),`${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()}};ml.DirectionalLangTagTransformer=em;em.DIRECTIONAL_TAG_REGEX=/(["'])((?:[^\\]|\\.)*?)\1@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)--(ltr|rtl)/g;var sw=class extends Error{static{a(this,"DirectionalLangTagTransformerError")}constructor(e){super(`Directional language tag transformation error: ${e}`),this.name="DirectionalLangTagTransformerError"}};ml.DirectionalLangTagTransformerError=sw});var nC=w(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.TripleTermTransformerError=yl.TripleTermTransformer=void 0;var ow=class{static{a(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 gl("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],o=this.extractTripleTerm(r,s);if(o){let c=this.convertToStandardSyntax(o.content);r=r.substring(0,s)+c+r.substring(s+o.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 o=e.substring(t,s+2);return{content:o,length:o.length}}r=s+2;continue}r++;continue}r++}if(i>0)throw new gl(`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 gl(`Invalid triple term syntax: ${e.substring(0,50)}...`);return`<< ${t[1]} >>`}};yl.TripleTermTransformer=ow;var gl=class extends Error{static{a(this,"TripleTermTransformerError")}constructor(e){super(`Triple term transformation error: ${e}`),this.name="TripleTermTransformerError"}};yl.TripleTermTransformerError=gl});var cw=w(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.VaultPrefixTransformer=void 0;var iU=/PREFIX\s+(\w+)\s*:/gi,sU=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"]),aw=class{static{a(this,"VaultPrefixTransformer")}constructor(){this.vaultPrefixes=new Map}setVaultPrefixes(e){this.vaultPrefixes=new Map(e)}getVaultPrefixes(){return new Map(this.vaultPrefixes)}transform(e){if(this.vaultPrefixes.size===0)return e;let t=this.findDeclaredPrefixes(e),r=[];for(let[o,c]of this.vaultPrefixes)!t.has(o.toLowerCase())&&!sU.has(o.toLowerCase())&&r.push({prefix:o,baseIRI:c});if(r.length===0)return e;let i="",s=0;for(;s<e.length;){let o=e[s];if(o==='"'||o==="'"){let l=this.skipLiteral(e,s);i+=e.substring(s,l),s=l;continue}if(o==="<"){let l=e.indexOf(">",s);l!==-1?(i+=e.substring(s,l+1),s=l+1):(i+=o,s++);continue}if(o==="#"){let l=e.indexOf(`
|
|
48
|
-
`,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,r);if(c){i+=c.iri,s=c.endIndex;continue}i+=o,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 o=t+i.length+1,c=o;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===o)continue;let l=e.substring(o,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,r=new RegExp(iU.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}};tm.VaultPrefixTransformer=aw});var bl=w(kn=>{"use strict";var oU=kn&&kn.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),aU=kn&&kn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),cU=kn&&kn.__importStar||(function(){var n=a(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"&&oU(t,e,r[i]);return aU(t,e),t}})();Object.defineProperty(kn,"__esModule",{value:!0});kn.SPARQLParser=kn.ExoQLParser=kn.SPARQLParseError=void 0;var iC=cU(eC()),lw=tw(),uw=rw(),sC=tC(),fw=iw(),lU=rC(),dw=nC(),uU=cw(),gr=class extends Error{static{a(this,"SPARQLParseError")}constructor(e,t,r,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=r}};kn.SPARQLParseError=gr;var rm=class{static{a(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new iC.Parser({sparqlStar:!0}),this.generator=new iC.Generator({sparqlStar:!0}),this.caseWhenTransformer=new lw.CaseWhenTransformer,this.lateralTransformer=new uw.LateralTransformer,this.prefixStarTransformer=new sC.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new fw.DescribeOptionsTransformer,this.directionalLangTagTransformer=new lU.DirectionalLangTagTransformer,this.tripleTermTransformer=new dw.TripleTermTransformer,this.vaultPrefixTransformer=new uU.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 fw.DescribeOptionsTransformerError)throw new gr(t.message);if(t instanceof uw.LateralTransformerError)throw new gr(t.message);if(t instanceof lw.CaseWhenTransformerError)throw new gr(t.message);if(t instanceof dw.TripleTermTransformerError)throw new gr(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 gr(`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 fw.DescribeOptionsTransformerError)throw new gr(t.message);if(t instanceof sC.PrefixStarTransformerError)throw new gr(t.message);if(t instanceof uw.LateralTransformerError)throw new gr(t.message);if(t instanceof lw.CaseWhenTransformerError)throw new gr(t.message);if(t instanceof dw.TripleTermTransformerError)throw new gr(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 gr(`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 gr(`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 gr("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 gr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new gr(`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 gr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};kn.ExoQLParser=rm;kn.SPARQLParser=rm});var sc=w(nm=>{"use strict";Object.defineProperty(nm,"__esModule",{value:!0});nm.AlgebraTranslatorError=void 0;var hw=class extends Error{static{a(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};nm.AlgebraTranslatorError=hw});var im=w(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.isVariableExpression=fU;bs.isVariableTerm=dU;bs.isNamedNode=hU;bs.isLiteral=pU;bs.isPropertyPath=mU;bs.isAggregateExpression=gU;bs.isOperationExpression=yU;bs.isFunctionCallExpression=bU;function fU(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}a(fU,"isVariableExpression");function dU(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}a(dU,"isVariableTerm");function hU(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}a(hU,"isNamedNode");function pU(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}a(pU,"isLiteral");function mU(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}a(mU,"isPropertyPath");function gU(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}a(gU,"isAggregateExpression");function yU(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}a(yU,"isOperationExpression");function bU(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}a(bU,"isFunctionCallExpression")});var oC=w(sm=>{"use strict";Object.defineProperty(sm,"__esModule",{value:!0});sm.TripleTranslator=void 0;var mn=sc(),pw=class{static{a(this,"TripleTranslator")}constructor(){this.directionMappings=new Map}setDirectionMappings(e){this.directionMappings=e}translateBGP(e){if(!("triples"in e)||!Array.isArray(e.triples))throw new mn.AlgebraTranslatorError("BGP pattern must have triples array");return{type:"bgp",triples:e.triples.map(t=>this.translateTriple(t))}}translateTriple(e){if(!e.subject||!e.predicate||!e.object)throw new mn.AlgebraTranslatorError("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translatePredicate(e){return"type"in e&&e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!("pathType"in e)||!e.pathType)throw new mn.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new mn.AlgebraTranslatorError("Property path must have items array");let t=e.items.map(r=>this.translatePathItem(r));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new mn.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new mn.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new mn.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new mn.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new mn.AlgebraTranslatorError(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if("type"in e&&e.type==="path")return this.translatePropertyPath(e);if("termType"in e&&e.termType==="NamedNode")return{type:"iri",value:e.value};let t="type"in e?e.type:"termType"in e?e.termType:"unknown";throw new mn.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new mn.AlgebraTranslatorError("Triple element must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};case"Literal":{let t={type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language};if(e.language){let r=this.directionMappings.get(e.language.toLowerCase());r&&(t.direction=r)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new mn.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new mn.AlgebraTranslatorError("Quoted triple must have subject, predicate, and object");return{type:"quoted",subject:this.translateTripleElement(e.subject),predicate:this.translateQuotedTriplePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateQuotedTriplePredicate(e){if(!e||!("termType"in e))throw new mn.AlgebraTranslatorError("Quoted triple predicate must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};default:throw new mn.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};sm.TripleTranslator=pw});var aC=w(om=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});om.ExpressionTranslator=void 0;var _l=sc(),mw=class{static{a(this,"ExpressionTranslator")}constructor(e){this.translateWhereFn=e.translateWhere,this.translateBGPFn=e.translateBGP,this.translatePatternFn=e.translatePattern}translateExpression(e){if(!e)throw new _l.AlgebraTranslatorError("Expression cannot be null or undefined");if("type"in e&&e.type==="operation")return this.translateOperationExpression(e);let t="type"in e?e.type:void 0;if(t==="functioncall"||t==="functionCall"){let r=e;return{type:"functionCall",function:r.function,args:r.args.map(i=>this.translateExpression(i))}}if("termType"in e)return this.translateTermExpression(e);throw new _l.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new _l.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateTermExpression(e){if(e.termType==="Variable")return{type:"variable",name:e.value};if(e.termType==="Literal"){let t=e.value;return e.datatype&&(e.datatype.value.includes("#integer")||e.datatype.value.includes("#decimal")?t=parseFloat(e.value):e.datatype.value.includes("#boolean")&&(t=e.value==="true")),{type:"literal",value:t,datatype:e.datatype?.value}}return{type:"literal",value:String(e.value||e)}}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"],s=e.args.filter(o=>!("patterns"in o)||"termType"in o);return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:s.map(o=>this.translateExpression(o))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:e.operator==="exists"||e.operator==="notexists"?this.translateExistsExpression(e):e.operator==="in"||e.operator==="notin"?this.translateInExpression(e):{type:"function",function:e.operator,args:s.map(o=>this.translateExpression(o))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new _l.AlgebraTranslatorError("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&"patterns"in t&&t.patterns?r=this.translateWhereFn(t.patterns):t.type==="bgp"?r=this.translateBGPFn(t):r=this.translatePatternFn(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new _l.AlgebraTranslatorError("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],r=e.args[1];if(!Array.isArray(r))throw new _l.AlgebraTranslatorError("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:r.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}};om.ExpressionTranslator=mw});var uC=w(am=>{"use strict";Object.defineProperty(am,"__esModule",{value:!0});am.PatternTranslator=void 0;var cC=rw(),Vr=sc(),lC=im(),gw=class{static{a(this,"PatternTranslator")}constructor(e){this.directionMappings=new Map,this.translateExpressionFn=e.translateExpression,this.translateSelectFn=e.translateSelect,this.translateBGPFn=e.translateBGP}setDirectionMappings(e){this.directionMappings=e}translateWhere(e){if(e.length===0)throw new Vr.AlgebraTranslatorError("Empty WHERE clause");let t=e.filter(o=>o.type==="filter"),r=e.filter(o=>o.type==="bind"),i=e.filter(o=>o.type!=="filter"&&o.type!=="bind"),s;if(i.length===0)s={type:"bgp",triples:[]};else if(i.length===1)if(i[0].type==="optional"){let o=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:o?this.translateExpressionFn(o):void 0}}else s=this.translatePattern(i[0]);else{if(i[0].type==="optional"){let o=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:o?this.translateExpressionFn(o):void 0}}else s=this.translatePattern(i[0]);for(let o=1;o<i.length;o++){let c=i[o];if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelectFn(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional"){let l=c.expression;s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:l?this.translateExpressionFn(l):void 0}}else{let l=this.translatePattern(c);s={type:"join",left:s,right:l}}}}for(let o of r)s=this.translateBind(o,s);for(let o of t)s={type:"filter",expression:this.translateExpressionFn(o.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new Vr.AlgebraTranslatorError("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGPFn(e);case"filter":return this.translateFilter(e);case"optional":return this.translateOptional(e);case"union":return this.translateUnion(e);case"minus":return this.translateMinus(e);case"values":return this.translateValues(e);case"group":return this.translateWhere(e.patterns);case"query":return this.translateSubquery(e);case"service":return this.translateService(e);case"graph":return this.translateGraph(e);default:throw new Vr.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Vr.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpressionFn(e.expression),input:t}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new Vr.AlgebraTranslatorError("OPTIONAL pattern must have patterns");let t=e.expression;return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:t?this.translateExpressionFn(t):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new Vr.AlgebraTranslatorError("UNION pattern must have at least 2 patterns");let t=a(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(i):"patterns"in i&&i.patterns&&Array.isArray(i.patterns)?this.translateWhere(i.patterns):this.translateWhere([i]),"translateBranch"),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 Vr.AlgebraTranslatorError("MINUS pattern must have patterns");return{type:"minus",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns)}}translateValues(e){if(!e.values||!Array.isArray(e.values))throw new Vr.AlgebraTranslatorError("VALUES pattern must have values array");let t=new Set;for(let i of e.values)for(let s of Object.keys(i)){let o=s.startsWith("?")?s.slice(1):s;t.add(o)}let 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,o=i;if(o)if(o.termType==="NamedNode")t[s]={type:"iri",value:o.value};else if(o.termType==="Literal"){let c=o,l={type:"literal",value:c.value,datatype:c.datatype?.value,language:c.language||void 0};if(c.language){let u=this.directionMappings.get(c.language.toLowerCase());u&&(l.direction=u)}t[s]=l}else throw new Vr.AlgebraTranslatorError(`Unsupported VALUES term type: ${o.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Vr.AlgebraTranslatorError("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpressionFn(e.expression),input:t}}translateSubquery(e){if(e.queryType!=="SELECT")throw new Vr.AlgebraTranslatorError(`Only SELECT subqueries are supported, got: ${String(e.queryType)}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelectFn(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new Vr.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Vr.AlgebraTranslatorError("SERVICE pattern must have patterns array");return{type:"service",endpoint:e.name.value,pattern:this.translateWhere(e.patterns),silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new Vr.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Vr.AlgebraTranslatorError("GRAPH pattern must have patterns array");let t;if(e.name.termType==="NamedNode")t={type:"iri",value:e.name.value};else if(e.name.termType==="Variable")t={type:"variable",value:e.name.value};else throw new Vr.AlgebraTranslatorError(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);return{type:"graph",name:t,pattern:this.translateWhere(e.patterns)}}isLateralPattern(e){if(e.type==="query"&&this.isLateralSubquery(e))return!0;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query"&&this.isLateralSubquery(t))return!0}return!1}extractLateralSubquery(e){if(e.type==="query")return e;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query")return t}throw new Vr.AlgebraTranslatorError("Invalid lateral pattern structure")}isLateralSubquery(e){return!("queryType"in e)||e.queryType!=="SELECT"||!("variables"in e)||!e.variables?!1:e.variables.some(i=>(0,lC.isVariableTerm)(i)&&i.value===cC.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){if(!("variables"in e)||!e.variables)return e;let t=e,r=t.variables;return{...t,variables:r.filter(i=>!((0,lC.isVariableTerm)(i)&&i.value===cC.LateralTransformer.LATERAL_MARKER))}}};am.PatternTranslator=gw});var dC=w(cm=>{"use strict";Object.defineProperty(cm,"__esModule",{value:!0});cm.AggregateTranslator=void 0;var fC=sc(),_U=im(),yw=class{static{a(this,"AggregateTranslator")}constructor(e){this.aggregateCounter=0,this.translateExpressionFn=e.translateExpression}resetCounter(){this.aggregateCounter=0}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)(0,_U.isVariableExpression)(i)&&("type"in i.expression&&i.expression.type==="aggregate"?(r.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,r,t));return r}extractGroupVariables(e){return e?e.filter(t=>t.expression&&"termType"in t.expression&&t.expression.termType==="Variable").map(t=>t.expression.value):[]}extractHavingExpressions(e,t,r){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,r);return e.map(i=>this.transformExpressionWithAggregateVars(i,r))}transformExpressionWithAggregateVars(e,t){let r=t.get(e);if(r!==void 0)return{type:"variable",name:r};if("type"in e&&e.type==="operation"&&"args"in e){let i=e,s=i.args.filter(u=>!Array.isArray(u)&&!("patterns"in u)).map(u=>this.transformExpressionWithAggregateVars(u,t)),o=["=","!=","<",">","<=",">="],c=["&&","||","!"],l=["+","-","*","/"];return o.includes(i.operator)?{type:"comparison",operator:i.operator,left:s[0],right:s[1]}:c.includes(i.operator)?{type:"logical",operator:i.operator,operands:s}:l.includes(i.operator)?{type:"arithmetic",operator:i.operator,left:s[0],right:s[1]}:{type:"function",function:i.operator,args:s}}return this.translateExpressionFn(e)}translateOrderComparator(e){return{expression:this.translateExpressionFn(e.expression),descending:e.descending||!1}}translateAggregateExpression(e){let t=e.aggregation,r=a(()=>{if(e.expression&&!("termType"in e.expression&&e.expression.termType==="Wildcard"))return this.translateExpressionFn(e.expression)},"translateInnerExpr");if(typeof t=="string"){let s=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(s)?{type:"aggregate",aggregation:s,expression:r(),distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:r(),distinct:e.distinct||!1,separator:e.separator}}let i=t;if(i&&typeof i=="object"){let s,o=i;if(o.termType==="NamedNode"&&typeof o.value=="string")s=o.value;else if("value"in o)s=String(o.value);else throw new fC.AlgebraTranslatorError(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(i)}`);return{type:"aggregate",aggregation:{type:"custom",iri:s},expression:r(),distinct:e.distinct||!1,separator:e.separator}}throw new fC.AlgebraTranslatorError(`Unknown aggregate format: ${JSON.stringify(t)}`)}collectNestedAggregates(e,t,r){if(e){if("type"in e&&e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if("type"in e&&e.type==="operation"&&"args"in e){let i=e;for(let s of i.args)!Array.isArray(s)&&"type"in s&&!("patterns"in s)?this.collectNestedAggregates(s,t,r):"termType"in s&&this.collectNestedAggregates(s,t,r)}}}};cm.AggregateTranslator=yw});var Sl=w(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.AlgebraTranslator=ia.ExoQLAlgebraTranslator=ia.AlgebraTranslatorError=void 0;var lm=sc(),um=im(),SU=oC(),wU=aC(),vU=uC(),EU=dC(),TU=sc();Object.defineProperty(ia,"AlgebraTranslatorError",{enumerable:!0,get:a(function(){return TU.AlgebraTranslatorError},"get")});var fm=class{static{a(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new SU.TripleTranslator,this.expressionTranslator=new wU.ExpressionTranslator({translateWhere:a(e=>this.patternTranslator.translateWhere(e),"translateWhere"),translateBGP:a(e=>this.tripleTranslator.translateBGP(e),"translateBGP"),translatePattern:a(e=>this.patternTranslator.translatePattern(e),"translatePattern")}),this.patternTranslator=new vU.PatternTranslator({translateExpression:a(e=>this.expressionTranslator.translateExpression(e),"translateExpression"),translateSelect:a(e=>this.translateSelect(e),"translateSelect"),translateBGP:a(e=>this.tripleTranslator.translateBGP(e),"translateBGP")}),this.aggregateTranslator=new EU.AggregateTranslator({translateExpression:a(e=>this.expressionTranslator.translateExpression(e),"translateExpression")})}setDirectionMappings(e){this.tripleTranslator.setDirectionMappings(e),this.patternTranslator.setDirectionMappings(e)}translate(e){if(e.type!=="query")throw new lm.AlgebraTranslatorError("Only query operations are supported (not updates)");if(e.queryType==="SELECT")return this.translateSelect(e);if(e.queryType==="CONSTRUCT")return this.translateConstruct(e);if(e.queryType==="ASK")return this.translateAsk(e);if(e.queryType==="DESCRIBE")return this.translateDescribe(e);throw new lm.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new lm.AlgebraTranslatorError("SELECT query must have WHERE clause");let t=this.patternTranslator.translateWhere(e.where);this.aggregateTranslator.resetCounter();let r=new Map,i=Array.isArray(e.variables)?e.variables.filter(l=>!("termType"in l&&l.termType==="Wildcard")):[],s=this.aggregateTranslator.extractAggregatesWithMapping(i,r),o=this.aggregateTranslator.extractGroupVariables(e.group),c=this.aggregateTranslator.extractHavingExpressions(e.having,s,r);if((s.length>0||o.length>0||c.length>0)&&(t={type:"group",variables:o,aggregates:s,having:c.length>0?c:void 0,input:t}),i.length>0){for(let l of i)if((0,um.isVariableExpression)(l)){if("type"in l.expression&&l.expression.type==="aggregate")continue;let u=this.aggregateTranslator.transformExpressionWithAggregateVars(l.expression,r);t={type:"extend",variable:l.variable.value,expression:u,input:t}}}if(e.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(l=>this.aggregateTranslator.translateOrderComparator(l)),input:t}),i.length>0){let l=i.filter(u=>(0,um.isVariableTerm)(u)||(0,um.isVariableExpression)(u)).map(u=>(0,um.isVariableTerm)(u)?u.value:u.variable.value);l.length>0&&(t={type:"project",variables:l,input:t})}return e.distinct&&(t={type:"distinct",input:t}),e.reduced&&(t={type:"reduced",input:t}),(e.limit!==void 0||e.offset!==void 0)&&(t={type:"slice",limit:e.limit,offset:e.offset,input:t}),t}translateConstruct(e){let t=this.tripleTranslator.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new lm.AlgebraTranslatorError("CONSTRUCT query must have WHERE clause");let r=this.patternTranslator.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(r={type:"slice",limit:i.limit,offset:i.offset,input:r}),{type:"construct",template:t,where:r}}translateAsk(e){return{type:"ask",where:e.where&&e.where.length>0?this.patternTranslator.translateWhere(e.where):{type:"bgp",triples:[]}}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables)){let s=e.variables;for(let o of s)o.termType==="Wildcard"||o.value==="*"||(o.termType==="Variable"?t.push({type:"variable",value:o.value}):o.termType==="NamedNode"&&t.push({type:"iri",value:o.value}))}let r;e.where&&e.where.length>0&&(r=this.patternTranslator.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};ia.ExoQLAlgebraTranslator=fm;ia.AlgebraTranslator=fm});var _s=w(dm=>{"use strict";Object.defineProperty(dm,"__esModule",{value:!0});dm.SolutionMapping=void 0;var hC=Ge(),pC=Pe(),mC=jt(),bw=class n{static{a(this,"SolutionMapping")}constructor(e){this.bindings=e?new Map(e):new Map}get(e){return this.bindings.get(e)}set(e,t){this.bindings.set(e,t)}has(e){return this.bindings.has(e)}variables(){return Array.from(this.bindings.keys())}getBindings(){return new Map(this.bindings)}isCompatibleWith(e){for(let[t,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 hC.Literal&&t instanceof hC.Literal?e.equals(t):e instanceof pC.IRI&&t instanceof pC.IRI?e.value===t.value:e instanceof mC.BlankNode&&t instanceof mC.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}};dm.SolutionMapping=bw});var yC=w(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.PropertyPathExecutor=vl.PropertyPathExecutorError=void 0;var AU=_s(),hm=Pe(),gC=jt(),IU=Ge(),wl=class extends Error{static{a(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};vl.PropertyPathExecutorError=wl;var _w=class n{static{a(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){if(this.isLiteralElement(e)||this.isLiteralElement(r)){let o=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:r,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l,f=this.describePath(t),d={position:o,value:u,path:f,hint:"Wikilink could not be resolved to IRI (likely label-form wikilink with no matching basename/alias). Check whether the target file exists in the queried vault, or add an alias. See issue #3282."};if(console.error(`[PropertyPathExecutor] literal-safety guard fired: literal in ${o} position \u2014 yielding 0 solutions. value="${u}" path=${f}`,d),n.isStrictModeEnabled())throw new wl(`Literal subject in property path: "${u}" (path=${f}). Set EXOCORTEX_SPARQL_STRICT=0 or omit --strict to fall back to warn-and-empty behaviour.`);return}let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let o of i){let c=await this.evaluatePath(o,t,s);for(let l of c){let u=new AU.SolutionMapping;this.isVariable(e)&&u.set(e.value,o),this.isVariable(r)&&u.set(r.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new wl("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 o=t.merge(s);o!==null&&(yield o)}}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 o=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,o,c?r:null);for(let d of f)l.add(d)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,r){let i=new Set;for(let s of t){let o=await this.evaluatePathItem(e,s,r);for(let c of o)i.add(c)}return i}async evaluateInversePath(e,t,r){if(t.type==="iri"){let i=new hm.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),o=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&o.add(c.subject);return o}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,o=[{node:e,depth:0}];for(;o.length>0;){let c=o.shift();if(!c)break;let{node:l,depth:u}=c;if(u>=this.MAX_DEPTH)continue;let f=await this.evaluatePathItem(l,t,null);for(let d of f){let h=this.nodeToKey(d);(r===null||this.nodeInSet(d,r))&&s.add(d),i.has(h)||(i.add(h),o.push({node:d,depth:u+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let o of s)i.add(o);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new hm.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),o=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&o.add(c.object);return o}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"|":return{type:"path",pathType:"|",items:e.items.map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"+":case"*":case"?":{let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new hm.IRI(e.value));break;case"blank":t.add(new gC.BlankNode(e.value));break;default:throw new wl(`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 hm.IRI)return{type:"iri",value:r.value};if(r instanceof gC.BlankNode)return{type:"blank",value:r.id};if(r instanceof IU.Literal)return{type:"literal",value:r.value,datatype:r.datatype?.value,language:r.language,direction:r.direction}}}return e}isVariable(e){return e.type==="variable"}isLiteralElement(e){return e.type==="literal"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}describePath(e){try{let t=e.items,r=a(s=>{if(s&&typeof s=="object"&&"type"in s){let o=s;if(o.type==="iri")return`<${String(o.value)}>`;if(o.type==="path")return this.describePath(o)}return"?"},"renderItem");if(!Array.isArray(t)||t.length===0)return"(?)";if(t.length===1){let s=r(t[0]);return e.pathType==="^"?`(^${s})`:e.pathType==="+"||e.pathType==="*"||e.pathType==="?"?`(${s}${e.pathType})`:`(${s})`}return`(${t.map(r).join(` ${e.pathType} `)})`}catch{return"<unprintable-path>"}}static isStrictModeEnabled(){let t=(typeof process<"u"?process.env:void 0)?.EXOCORTEX_SPARQL_STRICT;if(!t)return!1;let r=t.trim().toLowerCase();return r==="1"||r==="true"||r==="yes"}};vl.PropertyPathExecutor=_w});var vw=w(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.BGPExecutor=El.BGPExecutorError=void 0;var pm=_s(),sa=Pe(),Sw=Ge(),mm=jt(),gm=gf(),bC=yC(),qr=class extends Error{static{a(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};El.BGPExecutorError=qr;var ww=class{static{a(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new bC.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new pm.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 pm.SolutionMapping;return}let r=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)r=this.joinWithPatternInGraph(r,e.triples[i],t);for await(let i of r)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new qr("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:r);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),o=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new qr("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,o,t);for(let l of c){let u=new pm.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 o=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(o,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){if(this.isLiteral(e.subject)||this.isLiteral(e.object)){this.warnLiteralGuard("matchTriplePattern.propertyPath",this.isLiteral(e.subject)?"subject":"object",this.isLiteral(e.subject)?e.subject:e.object);return}yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:t);return}let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),o=await this.tripleStore.match(r,i,s);for(let c of o){let l=new pm.SolutionMapping;if(this.isVariable(e.subject))l.set(e.subject.value,c.subject);else if(this.isQuotedTriple(e.subject)){let u=this.matchQuotedTriplePattern(e.subject,c.subject);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}if(this.isVariable(t)&&l.set(t.value,c.predicate),this.isVariable(e.object))l.set(e.object.value,c.object);else if(this.isQuotedTriple(e.object)){let u=this.matchQuotedTriplePattern(e.object,c.object);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}yield l}}hasVariablesInQuotedTriple(e){return!!(this.isVariable(e.subject)||e.predicate.type==="variable"||this.isVariable(e.object)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object))}matchQuotedTriplePattern(e,t){if(!(t instanceof gm.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,o]of i)r.set(s,o)}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,o]of i)r.set(s,o)}else if(!this.elementsMatch(e.object,t.object))return null;return r}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof sa.IRI&&e.value===t.value;case"literal":return!(!(t instanceof Sw.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof mm.BlankNode&&e.value===t.id;case"quoted":return t instanceof gm.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 o of this.matchTriplePattern(s)){let c=i.merge(o);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 sa.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,r){let i="value"in r?String(r.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i,o={executor:"BGPExecutor",context:e,position:t,value:s,hint:"Wikilink could not be resolved to IRI (likely label-form wikilink with no matching basename/alias). Check whether the target file exists in the queried vault, or add an alias. See issue #3282."};if(console.error(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`,o),bC.PropertyPathExecutor.isStrictModeEnabled())throw new qr(`Literal in ${t} position (${e}): "${s}". Set EXOCORTEX_SPARQL_STRICT=0 or omit --strict to fall back to warn-and-empty behaviour.`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new sa.IRI(e.value);case"blank":return new mm.BlankNode(e.value);case"literal":throw new qr("Literals cannot appear in subject position");case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new qr(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new sa.IRI(e.predicate.value):(()=>{throw new qr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new gm.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new sa.IRI(e.value);case"literal":throw new qr("Literals cannot appear in predicate position");case"blank":throw new qr("Blank nodes cannot appear in predicate position");case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new qr(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new sa.IRI(e.value);case"literal":return new Sw.Literal(e.value,e.datatype?new sa.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new mm.BlankNode(e.value);case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new qr(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof sa.IRI)return{type:"iri",value:e.value};if(e instanceof Sw.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof mm.BlankNode)return{type:"blank",value:e.id};if(e instanceof gm.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new qr(`Unknown RDF term type: ${String(e)}`)}toAlgebraQuotedTriple(e){return{type:"quoted",subject:this.toAlgebraElement(e.subject),predicate:{type:"iri",value:e.predicate.value},object:this.toAlgebraElement(e.object)}}};El.BGPExecutor=ww});var _C=w(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});ym.StringFunctions=void 0;var Tl=Pe(),oa=Ge(),Ew=jt(),Mf=class n{static{a(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Tl.IRI||e instanceof oa.Literal?e.value:e instanceof Ew.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof oa.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof oa.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=n.parseDirectionalLangTag(e),[s,o]=n.parseDirectionalLangTag(t),c=r.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":o&&i!==o?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let r=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[r,i]}static regex(e,t,r){try{let i=r?r.includes("u")?r:r+"u":"u";return new RegExp(t,i).test(e)}catch(i){throw new Error(`REGEX: invalid pattern '${t}': ${i.message}`)}}static contains(e,t){return e.includes(t)}static strStarts(e,t){return e.startsWith(t)}static strEnds(e,t){return e.endsWith(t)}static strlen(e){return e.length}static ucase(e){return e.toUpperCase()}static lcase(e){return e.toLowerCase()}static substr(e,t,r){let i=t-1;if(i<0){if(r!==void 0){let s=r+i;return s<=0?"":e.substring(0,s)}return e}return r!==void 0?e.substring(i,i+r):e.substring(i)}static strBefore(e,t){if(t==="")return"";let r=e.indexOf(t);return r===-1?"":e.substring(0,r)}static strAfter(e,t){if(t==="")return e;let r=e.indexOf(t);return r===-1?"":e.substring(r+t.length)}static concat(...e){return e.join("")}static replace(e,t,r,i){try{let s=i||"g",o=s.includes("u")?s:s+"u",c=new RegExp(t,o);return e.replace(c,r)}catch(s){throw new Error(`REPLACE: invalid pattern '${t}': ${s.message}`)}}static encodeForUri(e){return encodeURIComponent(e)}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let r;if(e instanceof oa.Literal)r=e.value;else if(e instanceof Tl.IRI)r=e.value;else if(e instanceof Ew.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 oa.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Tl.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!n.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=r.normalize(i);return new oa.Literal(s,new Tl.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 oa.Literal)t=e.value;else if(e instanceof Tl.IRI)t=e.value;else if(e instanceof Ew.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let r=n.unicodeCaseFold(t);return new oa.Literal(r,new Tl.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=n.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}};ym.StringFunctions=Mf;Mf.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Mf.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 SC=w(bm=>{"use strict";Object.defineProperty(bm,"__esModule",{value:!0});bm.MathFunctions=void 0;var Tw=class{static{a(this,"MathFunctions")}static msToMinutes(e){return Math.round(e/(1e3*60))}static msToHours(e){return Math.round(e/(1e3*60*60)*100)/100}static msToSeconds(e){return Math.round(e/1e3)}static abs(e){return Math.abs(e)}static round(e){return Math.round(e)}static ceil(e){return Math.ceil(e)}static floor(e){return Math.floor(e)}static rand(){return Math.random()}};bm.MathFunctions=Tw});var jf=w(_m=>{"use strict";Object.defineProperty(_m,"__esModule",{value:!0});_m.DateTimeParsing=void 0;var xU=Pe(),RU=Ge(),Aw=class n{static{a(this,"DateTimeParsing")}static parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static parseDayTimeDuration(e){if(!e)throw new Error("parseDayTimeDuration: duration string is empty");let t=!1,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"),o="",c="";if(s===-1?o=r:(o=r.substring(0,s),c=r.substring(s+1)),o){let l=o.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(o!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${o}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let h=parseFloat(u[1]);i+=h*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let h=parseFloat(f[1]);i+=h*60*1e3,l=l.substring(f[0].length)}let d=l.match(/^(\d+(?:\.\d+)?)S$/);if(d){let h=parseFloat(d[1]);i+=h*1e3,l=l.substring(d[0].length)}if(l!=="")throw new Error(`parseDayTimeDuration: invalid time component: '${l}' in '${e}'`)}return t?-i:i}static formatDayTimeDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/(1440*60*1e3));r=r%(1440*60*1e3);let s=Math.floor(r/(3600*1e3));r=r%(3600*1e3);let o=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||o>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),o>0&&(l+=`${o}M`),(c>0||s===0&&o===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return n.parseDayTimeDuration(e),new RU.Literal(e,new xU.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,o=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,o));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,d=parseInt(u[2],10),h=parseInt(u[3],10),p=f*(d*60+h)*60*1e3;l=new Date(l.getTime()-p)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),o=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||o<0||o>59||i===24&&(s!==0||o!==0))return null;let u=0;if(c){let d=c.padEnd(3,"0").slice(0,3);u=parseInt(d,10)}let f=i*60*60*1e3+s*60*1e3+o*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let h=d[1]==="+"?1:-1,p=parseInt(d[2],10),g=parseInt(d[3],10),y=h*(p*60+g)*60*1e3;f-=y}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+o;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,o=t?"-P":"P";return i>0&&(o+=`${i}Y`),(s>0||i===0)&&(o+=`${s}M`),o}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:o,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,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,o=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.substring(l+1)),u){let d=u.match(/^(\d+(?:\.\d+)?)D$/);if(d)i=parseFloat(d[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let d=f,h=d.match(/^(\d+(?:\.\d+)?)H/);h&&(s=parseFloat(h[1]),d=d.substring(h[0].length));let p=d.match(/^(\d+(?:\.\d+)?)M/);p&&(o=parseFloat(p[1]),d=d.substring(p[0].length));let g=d.match(/^(\d+(?:\.\d+)?)S$/);if(g&&(c=parseFloat(g[1]),d=d.substring(g[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:o,seconds:c}}};_m.DateTimeParsing=Aw});var wC=w(Sm=>{"use strict";Object.defineProperty(Sm,"__esModule",{value:!0});Sm.DateTimeArithmetic=void 0;var gn=Pe(),Ue=Ge(),it=jf(),Iw=class{static{a(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r),o=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${r}'`);if(isNaN(o.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-o.getTime(),l=it.DateTimeParsing.formatDayTimeDuration(c);return new Ue.Literal(l,new gn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let o=it.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+o,l=new Date(c);return new Ue.Literal(l.toISOString(),new gn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let o=it.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-o,l=new Date(c);return new Ue.Literal(l.toISOString(),new gn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let o=it.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+o,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Ue.Literal(h,new gn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let o=it.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-o,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Ue.Literal(h,new gn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let o=it.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+o),s.getUTCDate()!==c&&s.setUTCDate(0),new Ue.Literal(s.toISOString(),new gn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let o=it.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-o),s.getUTCDate()!==c&&s.setUTCDate(0),new Ue.Literal(s.toISOString(),new gn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let o=it.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+o),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Ue.Literal(d,new gn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let o=it.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-o),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Ue.Literal(d,new gn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseDayTimeDuration(r),o=it.DateTimeParsing.parseDayTimeDuration(i),c=it.DateTimeParsing.formatDayTimeDuration(s+o);return new Ue.Literal(c,new gn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseDayTimeDuration(r),o=it.DateTimeParsing.parseDayTimeDuration(i),c=it.DateTimeParsing.formatDayTimeDuration(s-o);return new Ue.Literal(c,new gn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof Ue.Literal?e.value:e,i=it.DateTimeParsing.parseDayTimeDuration(r),s=it.DateTimeParsing.formatDayTimeDuration(i*t);return new Ue.Literal(s,new gn.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 Ue.Literal?e.value:e,i=it.DateTimeParsing.parseDayTimeDuration(r),s=it.DateTimeParsing.formatDayTimeDuration(i/t);return new Ue.Literal(s,new gn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseYearMonthDuration(r),o=it.DateTimeParsing.parseYearMonthDuration(i),c=it.DateTimeParsing.formatYearMonthDuration(s+o);return new Ue.Literal(c,new gn.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseYearMonthDuration(r),o=it.DateTimeParsing.parseYearMonthDuration(i),c=it.DateTimeParsing.formatYearMonthDuration(s-o);return new Ue.Literal(c,new gn.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Ue.Literal?e.value:e;return it.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Ue.Literal?e.value:e;return it.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Ue.Literal?e.value:e;return it.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Ue.Literal?e.value:e;return it.DateTimeParsing.parseDayTimeDuration(t)/1e3}};Sm.DateTimeArithmetic=Iw});var vC=w(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});wm.DateTimeAccessors=void 0;var $f=Pe(),$t=Ge(),Rt=jf(),xw=class{static{a(this,"DateTimeAccessors")}static year(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return t.getFullYear()}static month(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return t.getMonth()+1}static day(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return t.getDate()}static hours(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return t.getHours()}static minutes(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return t.getMinutes()}static seconds(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return t.getSeconds()+t.getMilliseconds()/1e3}static durationDays(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let r;if(e.endsWith("Z"))r="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),o=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);o===0?r=`${c}PT${l}H`:r=`${c}PT${l}H${o}M`}else{let s=-t.getTimezoneOffset(),o=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?r=`${l}PT${o}H`:r=`${l}PT${o}H${c}M`}}return new $t.Literal(r,new $f.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static tz(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TZ: invalid date string '${e}'`);if(e.endsWith("Z"))return"Z";let r=e.match(/([+-]\d{2}:\d{2})$/);if(r)return r[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static adjust(e,t){let r=e instanceof $t.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let R=i.getUTCFullYear(),V=String(i.getUTCMonth()+1).padStart(2,"0"),L=String(i.getUTCDate()).padStart(2,"0"),P=String(i.getUTCHours()).padStart(2,"0"),k=String(i.getUTCMinutes()).padStart(2,"0"),O=String(i.getUTCSeconds()).padStart(2,"0"),J=i.getUTCMilliseconds(),re=`${R}-${V}-${L}T${P}:${k}:${O}`;return J>0&&(re+=`.${String(J).padStart(3,"0")}`),new $t.Literal(re,new $f.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof $t.Literal?t.value:t,o=Rt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(o)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+o),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),h=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),g=String(u.getUTCMinutes()).padStart(2,"0"),y=String(u.getUTCSeconds()).padStart(2,"0"),b=u.getUTCMilliseconds(),S=o>=0?"+":"-",v=Math.floor(Math.abs(o)/(3600*1e3)),I=Math.floor(Math.abs(o)%(3600*1e3)/(60*1e3)),A=`${S}${String(v).padStart(2,"0")}:${String(I).padStart(2,"0")}`,T=`${f}-${d}-${h}T${p}:${g}:${y}`;return b>0&&(T+=`.${String(b).padStart(3,"0")}`),T+=A,new $t.Literal(T,new $f.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static now(){return new Date().toISOString()}static dateBefore(e,t){let r=Rt.DateTimeParsing.parseDate(e),i=Rt.DateTimeParsing.parseDate(t);return r<i}static dateAfter(e,t){let r=Rt.DateTimeParsing.parseDate(e),i=Rt.DateTimeParsing.parseDate(t);return r>i}static dateInRange(e,t,r){let i=Rt.DateTimeParsing.parseDate(e),s=Rt.DateTimeParsing.parseDate(t),o=Rt.DateTimeParsing.parseDate(r);return i>=s&&i<=o}static compareDurations(e,t,r){let i=e instanceof $t.Literal?e.value:e,s=t instanceof $t.Literal?t.value:t,o=Rt.DateTimeParsing.parseDayTimeDuration(i),c=Rt.DateTimeParsing.parseDayTimeDuration(s);switch(r){case"=":return o===c;case"!=":return o!==c;case"<":return o<c;case">":return o>c;case"<=":return o<=c;case">=":return o>=c;default:throw new Error(`compareDurations: unknown operator: ${r}`)}}static dateDiffMinutes(e,t){let r=Rt.DateTimeParsing.parseDate(e),i=Rt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=Rt.DateTimeParsing.parseDate(e),i=Rt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static timeDiff(e,t){let r=e instanceof $t.Literal?e.value:e,i=t instanceof $t.Literal?t.value:t,s=Rt.DateTimeParsing.parseXSDTime(r),o=Rt.DateTimeParsing.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${r}'`);if(o===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-o,l=Rt.DateTimeParsing.formatDayTimeDuration(c);return new $t.Literal(l,new $f.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof $t.Literal?e.value:e,i=t instanceof $t.Literal?t.value:t,s=Rt.DateTimeParsing.parseXSDDate(r),o=Rt.DateTimeParsing.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${r}'`);if(o===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-o.getTime(),l=Math.round(c/(1440*60*1e3)),u=Rt.DateTimeParsing.formatDateDuration(l);return new $t.Literal(u,new $f.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};wm.DateTimeAccessors=xw});var Em=w(vm=>{"use strict";Object.defineProperty(vm,"__esModule",{value:!0});vm.DateTimeFunctions=void 0;var Al=jf(),yr=wC(),vt=vC(),Rw=class{static{a(this,"DateTimeFunctions")}static parseDate(e){return Al.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Al.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Al.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Al.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Al.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Al.DateTimeParsing.formatYearMonthDuration(e)}static year(e){return vt.DateTimeAccessors.year(e)}static month(e){return vt.DateTimeAccessors.month(e)}static day(e){return vt.DateTimeAccessors.day(e)}static hours(e){return vt.DateTimeAccessors.hours(e)}static minutes(e){return vt.DateTimeAccessors.minutes(e)}static seconds(e){return vt.DateTimeAccessors.seconds(e)}static durationDays(e){return vt.DateTimeAccessors.durationDays(e)}static durationHours(e){return vt.DateTimeAccessors.durationHours(e)}static durationMinutes(e){return vt.DateTimeAccessors.durationMinutes(e)}static durationSeconds(e){return vt.DateTimeAccessors.durationSeconds(e)}static durationYears(e){return vt.DateTimeAccessors.durationYears(e)}static durationMonths(e){return vt.DateTimeAccessors.durationMonths(e)}static timezone(e){return vt.DateTimeAccessors.timezone(e)}static tz(e){return vt.DateTimeAccessors.tz(e)}static adjust(e,t){return vt.DateTimeAccessors.adjust(e,t)}static now(){return vt.DateTimeAccessors.now()}static dateBefore(e,t){return vt.DateTimeAccessors.dateBefore(e,t)}static dateAfter(e,t){return vt.DateTimeAccessors.dateAfter(e,t)}static dateInRange(e,t,r){return vt.DateTimeAccessors.dateInRange(e,t,r)}static compareDurations(e,t,r){return vt.DateTimeAccessors.compareDurations(e,t,r)}static dateDiffMinutes(e,t){return vt.DateTimeAccessors.dateDiffMinutes(e,t)}static dateDiffHours(e,t){return vt.DateTimeAccessors.dateDiffHours(e,t)}static timeDiff(e,t){return vt.DateTimeAccessors.timeDiff(e,t)}static dateDiff(e,t){return vt.DateTimeAccessors.dateDiff(e,t)}static isDayTimeDuration(e){return vt.DateTimeAccessors.isDayTimeDuration(e)}static isDate(e){return vt.DateTimeAccessors.isDate(e)}static isYearMonthDuration(e){return vt.DateTimeAccessors.isYearMonthDuration(e)}static isTime(e){return vt.DateTimeAccessors.isTime(e)}static dateTimeDiff(e,t){return yr.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return yr.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return yr.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return yr.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return yr.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return yr.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return yr.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return yr.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return yr.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return yr.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return yr.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return yr.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return yr.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return yr.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return yr.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return yr.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return yr.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return yr.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return yr.DateTimeArithmetic.durationToSeconds(e)}};vm.DateTimeFunctions=Rw});var EC=w(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});Am.LogicalFunctions=void 0;var CU=Pe(),Il=Ge(),OU=jt(),Tm=Em(),Cw=class n{static{a(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return Tm.DateTimeFunctions.compareDurations(e instanceof Il.Literal?e:String(e),t instanceof Il.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return Tm.DateTimeFunctions.compareDurations(e instanceof Il.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return Tm.DateTimeFunctions.compareDurations(e,t instanceof Il.Literal?t:String(t),r);let i=n.toComparableValue(e),s=n.toComparableValue(t);switch(r){case"=":return i===s;case"!=":return i!==s;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:throw new Error(`Unknown comparison operator: ${r}`)}}static isDayTimeDurationValue(e){return e instanceof Il.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 Il.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 Tm.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof CU.IRI?e.value:e instanceof OU.BlankNode?e.id:String(e)}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,r){return e?t:r}};Am.LogicalFunctions=Cw});var TC=w(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});Im.RDFTermFunctions=void 0;var Gr=Pe(),xt=Ge(),Ci=jt(),xl=gf(),Ow=Ii(),Pw=class n{static{a(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof xt.Literal)return e.datatype?e.datatype:e.language?new Gr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Gr.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 Gr.IRI}static isBlank(e){return e===void 0?!1:e instanceof Ci.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof xt.Literal}static isTriple(e){return e===void 0?!1:e instanceof xl.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof xt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof xt.Literal))return!1;let t=e.datatype?.value;return t?["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float","http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedShort","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#positiveInteger"].includes(t):!1}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new xt.Literal(t.toISOString(),new Gr.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 xt.Literal(String(t),new Gr.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 xt.Literal(String(t),new Gr.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static sameTerm(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0||e.constructor!==t.constructor)return!1;if(e instanceof Gr.IRI&&t instanceof Gr.IRI)return e.value===t.value;if(e instanceof Ci.BlankNode&&t instanceof Ci.BlankNode)return e.id===t.id;if(e instanceof xt.Literal&&t instanceof xt.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 Gr.IRI)return e;if(e instanceof xt.Literal)return new Gr.IRI(e.value);throw e instanceof Ci.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return n.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,Ow.v4)().replace(/-/g,"").substring(0,12)}`;return new Ci.BlankNode(t)}if(e instanceof xt.Literal)return new Ci.BlankNode(e.value);if(e instanceof Ci.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 xt.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 Gr.IRI)i=t;else if(t instanceof xt.Literal)i=new Gr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new xt.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 xt.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 xt.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 xt.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 xt.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 xt.Literal)s=t.value;else if(typeof t=="string")s=t;else throw new Error("STRLANGDIR: language tag must be a string literal");if(s==="")throw new Error("STRLANGDIR: language tag cannot be empty");let o;if(r instanceof xt.Literal)o=r.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(o!=="ltr"&&o!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${o}'. Must be 'ltr' or 'rtl'`);return new xt.Literal(i,void 0,s,o)}static uuid(){let e=(0,Ow.v4)();return new Gr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,Ow.v4)();return new xt.Literal(e)}static triple(e,t,r){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(r===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof xt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Gr.IRI)){let c=t instanceof xt.Literal?"Literal":t instanceof Ci.BlankNode?"BlankNode":t instanceof xl.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,o=r;return new xl.QuotedTriple(i,s,o)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof xl.QuotedTriple)){let t=e instanceof Gr.IRI?"IRI":e instanceof xt.Literal?"Literal":e instanceof Ci.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 xl.QuotedTriple)){let t=e instanceof Gr.IRI?"IRI":e instanceof xt.Literal?"Literal":e instanceof Ci.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 xl.QuotedTriple)){let t=e instanceof Gr.IRI?"IRI":e instanceof xt.Literal?"Literal":e instanceof Ci.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};Im.RDFTermFunctions=Pw});var AC=w(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});xm.HashFunctions=void 0;var Fw=class{static{a(this,"HashFunctions")}static md5(e){return require("crypto").createHash("md5").update(e).digest("hex")}static sha1(e){return require("crypto").createHash("sha1").update(e).digest("hex")}static sha256(e){return require("crypto").createHash("sha256").update(e).digest("hex")}static sha384(e){return require("crypto").createHash("sha384").update(e).digest("hex")}static sha512(e){return require("crypto").createHash("sha512").update(e).digest("hex")}};xm.HashFunctions=Fw});var Cm=w(Rm=>{"use strict";Object.defineProperty(Rm,"__esModule",{value:!0});Rm.BuiltInFunctions=void 0;var br=_C(),aa=SC(),Ce=Em(),Rl=EC(),Ft=TC(),Uf=AC(),Dw=class{static{a(this,"BuiltInFunctions")}static str(...e){return br.StringFunctions.str(...e)}static lang(...e){return br.StringFunctions.lang(...e)}static langdir(...e){return br.StringFunctions.langdir(...e)}static langMatches(...e){return br.StringFunctions.langMatches(...e)}static regex(...e){return br.StringFunctions.regex(...e)}static contains(...e){return br.StringFunctions.contains(...e)}static strStarts(...e){return br.StringFunctions.strStarts(...e)}static strEnds(...e){return br.StringFunctions.strEnds(...e)}static strlen(...e){return br.StringFunctions.strlen(...e)}static ucase(...e){return br.StringFunctions.ucase(...e)}static lcase(...e){return br.StringFunctions.lcase(...e)}static substr(...e){return br.StringFunctions.substr(...e)}static strBefore(...e){return br.StringFunctions.strBefore(...e)}static strAfter(...e){return br.StringFunctions.strAfter(...e)}static concat(...e){return br.StringFunctions.concat(...e)}static replace(...e){return br.StringFunctions.replace(...e)}static encodeForUri(...e){return br.StringFunctions.encodeForUri(...e)}static normalize(...e){return br.StringFunctions.normalize(...e)}static fold(...e){return br.StringFunctions.fold(...e)}static abs(...e){return aa.MathFunctions.abs(...e)}static round(...e){return aa.MathFunctions.round(...e)}static ceil(...e){return aa.MathFunctions.ceil(...e)}static floor(...e){return aa.MathFunctions.floor(...e)}static rand(){return aa.MathFunctions.rand()}static msToMinutes(...e){return aa.MathFunctions.msToMinutes(...e)}static msToHours(...e){return aa.MathFunctions.msToHours(...e)}static msToSeconds(...e){return aa.MathFunctions.msToSeconds(...e)}static parseDate(...e){return Ce.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return Ce.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return Ce.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return Ce.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return Ce.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return Ce.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return Ce.DateTimeFunctions.year(...e)}static month(...e){return Ce.DateTimeFunctions.month(...e)}static day(...e){return Ce.DateTimeFunctions.day(...e)}static hours(...e){return Ce.DateTimeFunctions.hours(...e)}static minutes(...e){return Ce.DateTimeFunctions.minutes(...e)}static seconds(...e){return Ce.DateTimeFunctions.seconds(...e)}static timezone(...e){return Ce.DateTimeFunctions.timezone(...e)}static tz(...e){return Ce.DateTimeFunctions.tz(...e)}static now(){return Ce.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return Ce.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return Ce.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return Ce.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return Ce.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return Ce.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return Ce.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return Ce.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return Ce.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return Ce.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return Ce.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return Ce.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return Ce.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return Ce.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return Ce.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return Ce.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return Ce.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return Ce.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return Ce.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return Ce.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return Ce.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return Ce.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return Ce.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return Ce.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return Ce.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return Ce.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return Ce.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return Ce.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return Ce.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return Ce.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return Ce.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return Ce.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return Ce.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return Ce.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return Ce.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return Ce.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return Ce.DateTimeFunctions.adjust(...e)}static isTime(...e){return Ce.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return Ce.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Rl.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Rl.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Rl.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Rl.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Rl.LogicalFunctions.coalesce(...e)}static if(...e){return Rl.LogicalFunctions.if(...e)}static datatype(...e){return Ft.RDFTermFunctions.datatype(...e)}static bound(...e){return Ft.RDFTermFunctions.bound(...e)}static isIRI(...e){return Ft.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return Ft.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return Ft.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return Ft.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return Ft.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return Ft.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return Ft.RDFTermFunctions.sameTerm(...e)}static iri(...e){return Ft.RDFTermFunctions.iri(...e)}static uri(...e){return Ft.RDFTermFunctions.uri(...e)}static bnode(...e){return Ft.RDFTermFunctions.bnode(...e)}static strdt(...e){return Ft.RDFTermFunctions.strdt(...e)}static strlang(...e){return Ft.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return Ft.RDFTermFunctions.strlangdir(...e)}static uuid(){return Ft.RDFTermFunctions.uuid()}static struuid(){return Ft.RDFTermFunctions.struuid()}static xsdDateTime(...e){return Ft.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return Ft.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return Ft.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return Ft.RDFTermFunctions.triple(...e)}static subject(...e){return Ft.RDFTermFunctions.subject(...e)}static predicate(...e){return Ft.RDFTermFunctions.predicate(...e)}static object(...e){return Ft.RDFTermFunctions.object(...e)}static md5(...e){return Uf.HashFunctions.md5(...e)}static sha1(...e){return Uf.HashFunctions.sha1(...e)}static sha256(...e){return Uf.HashFunctions.sha256(...e)}static sha384(...e){return Uf.HashFunctions.sha384(...e)}static sha512(...e){return Uf.HashFunctions.sha512(...e)}};Rm.BuiltInFunctions=Dw});var Bf=w(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.ExoQLBudgetExceededError=Ss.ExoQLCycleError=Ss.ExoQLEvalDisabledError=Ss.ExoQLForbiddenKeywordError=void 0;var Lw=class extends Error{static{a(this,"ExoQLForbiddenKeywordError")}constructor(e,t){super(t??`ExoQLForbiddenKeywordError: keyword "${e}" is not permitted by the exoql__Query AST allowlist`),this.name="ExoQLForbiddenKeywordError",this.keyword=e}};Ss.ExoQLForbiddenKeywordError=Lw;var Nw=class extends Error{static{a(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};Ss.ExoQLEvalDisabledError=Nw;var kw=class extends Error{static{a(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};Ss.ExoQLCycleError=kw;var Mw=class extends Error{static{a(this,"ExoQLBudgetExceededError")}constructor(e,t,r,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${r})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=r}};Ss.ExoQLBudgetExceededError=Mw});var LC=w(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.functionHandlers=void 0;var z=Cm();K.functionHandlers=new Map;K.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.str(t)});K.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.lang(t)});K.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 z.BuiltInFunctions.langMatches(t,r)});K.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 z.BuiltInFunctions.contains(t,r)});K.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 z.BuiltInFunctions.strStarts(t,r)});K.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 z.BuiltInFunctions.strEnds(t,r)});K.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.strlen(t)});K.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.ucase(t)});K.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.lcase(t)});K.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 z.BuiltInFunctions.substr(t,r,i)}return z.BuiltInFunctions.substr(t,r)});K.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 z.BuiltInFunctions.strBefore(t,r)});K.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 z.BuiltInFunctions.strAfter(t,r)});K.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return z.BuiltInFunctions.concat(...t)});K.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 z.BuiltInFunctions.replace(t,r,i,s)});K.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 z.BuiltInFunctions.regex(t,r,i)});K.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.encodeForUri(t)});K.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.datatype(t).value});K.functionHandlers.set("bound",(n,e)=>{let t=n[0];if(t.type==="variable"&&t.name){let r=e.solution.get(t.name);return z.BuiltInFunctions.bound(r)}return!0});var IC=a((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isIRI(t)},"isIriHandler");K.functionHandlers.set("isiri",IC);K.functionHandlers.set("isuri",IC);K.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isBlank(t)});K.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isLiteral(t)});K.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isNumeric(t)});K.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.hasLangdir(t)});K.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isTriple(t)});K.functionHandlers.set("sameterm",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution);return z.BuiltInFunctions.sameTerm(t,r)});K.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return z.BuiltInFunctions.abs(t)});K.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return z.BuiltInFunctions.round(t)});K.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return z.BuiltInFunctions.ceil(t)});K.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return z.BuiltInFunctions.floor(t)});K.functionHandlers.set("rand",()=>z.BuiltInFunctions.rand());K.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.parseDate(t)});K.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 z.BuiltInFunctions.dateBefore(t,r)});K.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 z.BuiltInFunctions.dateAfter(t,r)});K.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 z.BuiltInFunctions.dateInRange(t,r,i)});K.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 z.BuiltInFunctions.dateDiffMinutes(t,r)});K.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 z.BuiltInFunctions.dateDiffHours(t,r)});var Cl=a((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"),xC=Cl(z.BuiltInFunctions.year.bind(z.BuiltInFunctions),z.BuiltInFunctions.durationYears.bind(z.BuiltInFunctions),null);K.functionHandlers.set("year",xC);K.functionHandlers.set("years",xC);var RC=Cl(z.BuiltInFunctions.month.bind(z.BuiltInFunctions),z.BuiltInFunctions.durationMonths.bind(z.BuiltInFunctions),null);K.functionHandlers.set("month",RC);K.functionHandlers.set("months",RC);var CC=Cl(z.BuiltInFunctions.day.bind(z.BuiltInFunctions),null,z.BuiltInFunctions.durationDays.bind(z.BuiltInFunctions));K.functionHandlers.set("day",CC);K.functionHandlers.set("days",CC);K.functionHandlers.set("hours",Cl(z.BuiltInFunctions.hours.bind(z.BuiltInFunctions),null,z.BuiltInFunctions.durationHours.bind(z.BuiltInFunctions)));K.functionHandlers.set("minutes",Cl(z.BuiltInFunctions.minutes.bind(z.BuiltInFunctions),null,z.BuiltInFunctions.durationMinutes.bind(z.BuiltInFunctions)));K.functionHandlers.set("seconds",Cl(z.BuiltInFunctions.seconds.bind(z.BuiltInFunctions),null,z.BuiltInFunctions.durationSeconds.bind(z.BuiltInFunctions)));K.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.timezone(t)});K.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.tz(t)});K.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 z.BuiltInFunctions.adjust(t,r)});K.functionHandlers.set("now",()=>z.BuiltInFunctions.now());var OC=a((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");K.functionHandlers.set("datetime",OC);K.functionHandlers.set("xsd:datetime",OC);var PC=a((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");K.functionHandlers.set("integer",PC);K.functionHandlers.set("xsd:integer",PC);var FC=a((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");K.functionHandlers.set("decimal",FC);K.functionHandlers.set("xsd:decimal",FC);var DC=a((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");K.functionHandlers.set("daytimeduration",DC);K.functionHandlers.set("xsd:daytimeduration",DC);K.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationToDays(t)});K.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationToHours(t)});K.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationToMinutes(t)});K.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationToSeconds(t)});K.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationDays(t)});K.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationHours(t)});K.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationMinutes(t)});K.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationSeconds(t)});K.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationYears(t)});K.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationMonths(t)});K.functionHandlers.set("datetimediff",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return z.BuiltInFunctions.dateTimeDiff(t,r)});K.functionHandlers.set("datetimeadd",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return z.BuiltInFunctions.dateTimeAdd(t,r)});K.functionHandlers.set("datetimesubtract",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return z.BuiltInFunctions.dateTimeSubtract(t,r)});K.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.msToMinutes(t)});K.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.msToHours(t)});K.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.msToSeconds(t)});K.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.md5(t)});K.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.sha1(t)});K.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.sha256(t)});K.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.sha384(t)});K.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.sha512(t)});K.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.subject(t)});K.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.predicate(t)});K.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.object(t)});K.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 z.BuiltInFunctions.triple(t,r,i)});K.functionHandlers.set("days_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(1440*60*1e3))});K.functionHandlers.set("minutes_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(60*1e3))});K.functionHandlers.set("hours_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return(new Date(r).getTime()-i.getTime())/(3600*1e3)});K.functionHandlers.set("age_days",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t);return Math.floor((new Date().getTime()-r.getTime())/(1440*60*1e3))});K.functionHandlers.set("week_number",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t),i=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()));i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7));let s=new Date(Date.UTC(i.getUTCFullYear(),0,1));return Math.ceil(((i.getTime()-s.getTime())/(1440*60*1e3)+1)/7)});K.functionHandlers.set("format_date",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return r.replace("YYYY",String(i.getFullYear())).replace("MM",String(i.getMonth()+1).padStart(2,"0")).replace("DD",String(i.getDate()).padStart(2,"0")).replace("HH",String(i.getHours()).padStart(2,"0")).replace("mm",String(i.getMinutes()).padStart(2,"0")).replace("ss",String(i.getSeconds()).padStart(2,"0"))});K.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:n}=Bf();throw new n})});var Om=w(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.FilterExecutor=Ol.FilterExecutorError=void 0;var Et=Cm(),PU=LC(),jw=Pe(),ws=Ge(),Ar=class extends Error{static{a(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Ol.FilterExecutorError=Ar;var $w=class{static{a(this,"FilterExecutor")}constructor(){this.existsEvaluator=null,this.tripleStore=null,this.uuidCache=new Map}setExistsEvaluator(e){this.existsEvaluator=e}setTripleStore(e){this.tripleStore=e,this.uuidCache.clear()}async*execute(e,t){let r=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;r?s=await this.evaluateExpressionAsync(e.expression,i):s=this.evaluateExpression(e.expression,i),s===!0&&(yield i)}catch{continue}}expressionContainsExists(e){if(!e||typeof e!="object")return!1;if(e.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="arithmetic"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(r=>this.expressionContainsExists(r))}if(e.type==="function"||e.type==="functionCall"){let t=e;return Array.isArray(t.args)?t.args.some(r=>this.expressionContainsExists(r)):!1}return!1}async executeAll(e,t){let r=[];async function*i(){for(let s of t)yield s}a(i,"generator");for await(let s of this.execute(e,i()))r.push(s);return r}evaluateExpression(e,t){let r=e;if("termType"in e)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":{let i=r.value,s=r.datatype,o=typeof s=="string"?s:s?.value;return o&&i.length>0&&this.shouldPreserveDatatype(o)?new ws.Literal(i,new jw.IRI(o)):i}case"NamedNode":return r.value;default:throw new Ar(`Unsupported termType: ${String(r.termType)}`)}switch(e.type){case"comparison":return this.evaluateComparison(e,t);case"logical":return this.evaluateLogical(e,t);case"arithmetic":return this.evaluateArithmetic(e,t);case"function":case"functionCall":return this.evaluateFunction(e,t);case"variable":return t.get(e.name);case"literal":{let i=e;return i.datatype&&i.value.length>0&&this.shouldPreserveDatatype(i.datatype)?new ws.Literal(i.value,new jw.IRI(i.datatype)):i.value}case"in":return this.evaluateIn(e,t);case"exists":throw new Ar("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new Ar(`Unsupported expression type: ${e.type}`)}}async evaluateExpressionAsync(e,t){if(!this.expressionContainsExists(e))return this.evaluateExpression(e,t);if(e.type==="exists")return this.evaluateExists(e,t);if(e.type==="logical")return this.evaluateLogicalAsync(e,t);if(e.type==="comparison"){let r=e,i=await this.evaluateExpressionAsync(r.left,t),s=await this.evaluateExpressionAsync(r.right,t);return Et.BuiltInFunctions.compare(i,s,r.operator)}return e.type==="in"?this.evaluateInAsync(e,t):e.type==="function"||e.type==="functionCall"?this.evaluateFunctionAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new Ar("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 Et.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 Et.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return Et.BuiltInFunctions.logicalOr(r);throw new Ar(`Unknown logical operator: ${String(e.operator)}`)}async evaluateInAsync(e,t){let r=await this.evaluateExpressionAsync(e.expression,t),i=!1;for(let s of e.list){let o=await this.evaluateExpressionAsync(s,t);if(Et.BuiltInFunctions.compare(r,o,"=")){i=!0;break}}return e.negated?!i:i}async evaluateFunctionAsync(e,t){let r=e,i=this.extractFunctionName(r.function),s=r.args??[];if(i==="if"){if(s.length!==3)throw new Ar("IF requires exactly 3 arguments");let l=await this.evaluateExpressionAsync(s[0],t);return this.toBoolean(l)?this.evaluateExpressionAsync(s[1],t):this.evaluateExpressionAsync(s[2],t)}if(i==="coalesce"){for(let l of s)try{let u=await this.evaluateExpressionAsync(l,t);if(u!=null)return u}catch{continue}return}let o=[];for(let l of s){let u=await this.evaluateExpressionAsync(l,t);o.push(this.wrapAsLiteralExpression(u))}let c={...r,args:o};return this.evaluateFunction(c,t)}wrapAsLiteralExpression(e){return e==null?{type:"literal",value:""}:typeof e=="object"&&"termType"in e?e:e instanceof jw.IRI||e instanceof ws.Literal?{type:"literal",value:e.value}:typeof e=="number"||typeof e=="boolean"||typeof e=="string"?{type:"literal",value:e}:{type:"literal",value:String(e)}}evaluateComparison(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return Et.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return Et.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return Et.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return Et.BuiltInFunctions.logicalOr(r);throw new Ar(`Unknown logical operator: ${String(e.operator)}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let o=this.evaluateExpression(s,t);return Et.BuiltInFunctions.compare(r,o,"=")});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 Et.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return Et.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return Et.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return Et.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return Et.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new Ar("Division by zero");return Et.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),o=this.toNumericValue(i);switch(e.operator){case"+":return s+o;case"-":return s-o;case"*":return s*o;case"/":if(o===0)throw new Ar("Division by zero");return s/o;default:throw new Ar(`Unknown arithmetic operator: ${String(e.operator)}`)}}shouldPreserveDatatype(e){return e==="http://www.w3.org/2001/XMLSchema#dateTime"||e==="http://www.w3.org/2001/XMLSchema#date"||e==="http://www.w3.org/2001/XMLSchema#time"||e==="http://www.w3.org/2001/XMLSchema#dayTimeDuration"||e==="http://www.w3.org/2001/XMLSchema#yearMonthDuration"||e==="http://www.w3.org/2001/XMLSchema#duration"}isDayTimeDurationValue(e){return e instanceof ws.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof ws.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof ws.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 Ar(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof ws.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 ws.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof ws.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 o=PU.functionHandlers.get(i);if(!o)throw new Ar(`Unknown function: ${i}`);let c={evaluateExpression:a((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:a((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:a(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:a(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:a(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return o(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 Ar(`Unknown function format: ${String(e)}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let i of t)try{let s=this.evaluateExpression(i,r);if(s!=null)return{value:s}}catch{continue}return{value:void 0};case"if":{if(!t||t.length!==3)throw new Ar("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],r);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],r):this.evaluateExpression(t[2],r)}}case"byuuid":return{value:this.evaluateByUUID({type:"function",function:"byuuid",args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof ws.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 Ar("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 o=this.tripleStore.findSubjectsByUUIDSync(s);if(o.length===0){this.uuidCache.set(s,null);return}let c=o[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let r=e.toLowerCase();this.uuidCache.set(r,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Ol.FilterExecutor=$w});var Bw=w(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.OptionalExecutor=void 0;var Uw=class{static{a(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 o="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,o),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,o),f=c.get(u),d=!1;if(f)for(let h of f){let p=l.merge(h);p!==null&&(yield p,d=!0)}d||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let o=e.get(s);i.push(o!==void 0?o.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let o=r.merge(s);o!==null&&(yield o,i=!0)}i||(yield r)}}};Pm.OptionalExecutor=Uw});var qw=w(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.UnionExecutor=void 0;var Vw=class{static{a(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 o of e)yield o}a(i,"generateLeft");async function*s(){for(let o of t)yield o}a(s,"generateRight");for await(let o of this.execute(i(),s()))r.push(o);return r}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};Fm.UnionExecutor=Vw});var NC=w(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.MinusExecutor=void 0;var Gw=class{static{a(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 o=!1;for(let c of i)if(this.areCompatible(s,c)){o=!0;break}o||(yield s)}}async executeAll(e,t){let r=[];async function*i(){for(let o of e)yield o}a(i,"generateLeft");async function*s(){for(let o of t)yield o}a(s,"generateRight");for await(let o of this.execute(i(),s()))r.push(o);return r}areCompatible(e,t){let r=e.variables(),i=new Set(t.variables()),s=r.filter(o=>i.has(o));if(s.length===0)return!1;for(let o of s){let c=e.get(o),l=t.get(o);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};Dm.MinusExecutor=Gw});var MC=w(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.ValuesExecutor=Pl.ValuesExecutorError=void 0;var FU=_s(),kC=Pe(),DU=Ge(),Lm=class extends Error{static{a(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Pl.ValuesExecutorError=Lm;var Ww=class{static{a(this,"ValuesExecutor")}async*execute(e){if(e.bindings.length!==0)for(let t of e.bindings)yield this.createSolutionMapping(t)}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}createSolutionMapping(e){let t=new FU.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 kC.IRI(e.value);if(e.type==="literal")return new DU.Literal(e.value,e.datatype?new kC.IRI(e.datatype):void 0,e.language,e.direction);throw new Lm(`Unknown term type: ${e.type}`)}};Pl.ValuesExecutor=Ww});var Hw=w(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.CustomAggregateRegistry=Dl.CustomAggregateError=void 0;var Fl=class extends Error{static{a(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Dl.CustomAggregateError=Fl;var Nm=class n{static{a(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 Fl("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new Fl("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new Fl(`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}};Dl.CustomAggregateRegistry=Nm;Nm.instance=null});var zw=w(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.BUILT_IN_AGGREGATES=st.modeAggregate=st.stddevAggregate=st.varianceAggregate=st.medianAggregate=st.EXO_AGGREGATE_NS=void 0;st.getNumericValue=km;st.createDecimalLiteral=Oi;st.createDoubleLiteral=kU;st.createPercentileAggregate=oc;var ac=Ge(),Ll=Pe(),LU=new Ll.IRI("http://www.w3.org/2001/XMLSchema#decimal"),NU=new Ll.IRI("http://www.w3.org/2001/XMLSchema#double");st.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function km(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof ac.Literal?parseFloat(n.value):n instanceof Ll.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}a(km,"getNumericValue");function Oi(n){return new ac.Literal(String(n),LU)}a(Oi,"createDecimalLiteral");function kU(n){return new ac.Literal(String(n),NU)}a(kU,"createDoubleLiteral");st.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=km(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return Oi(0);let r=[...t].sort((o,c)=>o-c),i=Math.floor(r.length/2),s=r.length%2!==0?r[i]:(r[i-1]+r[i])/2;return Oi(s)}};st.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=km(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return Oi(0);let r=t.reduce((s,o)=>s+o,0)/t.length,i=t.reduce((s,o)=>s+Math.pow(o-r,2),0)/t.length;return Oi(i)}};st.stddevAggregate={init(){return{values:[]}},step(n,e){st.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return Oi(0);let r=t.reduce((s,o)=>s+o,0)/t.length,i=t.reduce((s,o)=>s+Math.pow(o-r,2),0)/t.length;return Oi(Math.sqrt(i))}};st.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof ac.Literal||e instanceof Ll.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 ac.Literal(" ",new Ll.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",r=0;for(let[o,c]of e.counts)c>r&&(r=c,t=o);let i=e.values.get(t);if(i instanceof ac.Literal)return i;let s=parseFloat(t);return isNaN(s)?new ac.Literal(t,new Ll.IRI("http://www.w3.org/2001/XMLSchema#string")):Oi(s)}};function oc(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=km(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return Oi(0);let s=[...i].sort((d,h)=>d-h),o=r.percentile*(s.length-1),c=Math.floor(o),l=Math.ceil(o);if(c===l)return Oi(s[c]);let u=o-c,f=s[c]*(1-u)+s[l]*u;return Oi(f)}}}a(oc,"createPercentileAggregate");st.BUILT_IN_AGGREGATES={[`${st.EXO_AGGREGATE_NS}median`]:st.medianAggregate,[`${st.EXO_AGGREGATE_NS}variance`]:st.varianceAggregate,[`${st.EXO_AGGREGATE_NS}stddev`]:st.stddevAggregate,[`${st.EXO_AGGREGATE_NS}mode`]:st.modeAggregate,[`${st.EXO_AGGREGATE_NS}percentile25`]:oc(25),[`${st.EXO_AGGREGATE_NS}percentile50`]:oc(50),[`${st.EXO_AGGREGATE_NS}percentile75`]:oc(75),[`${st.EXO_AGGREGATE_NS}percentile90`]:oc(90),[`${st.EXO_AGGREGATE_NS}percentile95`]:oc(95),[`${st.EXO_AGGREGATE_NS}percentile99`]:oc(99)}});var UC=w(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.AggregateExecutor=Nl.AggregateExecutorError=void 0;var _r=Ge(),Yw=Pe(),MU=Om(),jU=Hw(),$U=zw(),jC=new Yw.IRI("http://www.w3.org/2001/XMLSchema#integer"),cc=new Yw.IRI("http://www.w3.org/2001/XMLSchema#decimal"),vs=new Yw.IRI("http://www.w3.org/2001/XMLSchema#string");function $C(n){return typeof n=="object"&&n.type==="custom"}a($C,"isCustomAggregation");var Vf=class extends Error{static{a(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Nl.AggregateExecutorError=Vf;var Kw=class{static{a(this,"AggregateExecutor")}constructor(){this.filterExecutor=new MU.FilterExecutor}execute(e,t){let r=this.groupSolutions(t,e.variables),i=[];for(let[s,o]of r.entries()){let c=new Map;for(let f of e.variables)if(o.length>0){let d=o[0].get(f);d&&c.set(f,d)}for(let f of e.aggregates){let d=this.computeAggregate(f.expression,o);c.set(f.variable,d)}let{SolutionMapping:l}=_s(),u=new l;for(let[f,d]of c.entries())u.set(f,d);i.push(u)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let r=new Map;if(t.length===0)return r.set("",e),r;for(let i of e){let s=this.computeGroupKey(i,t),o=r.get(s);o?o.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($C(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 _r.Literal(String(s),jC)}case"sum":{let s=this.computeSum(r);return new _r.Literal(String(s),cc)}case"avg":{let s=this.computeAvg(r);return new _r.Literal(String(s),cc)}case"min":{let s=this.computeMin(r);return s===void 0?new _r.Literal("",vs):typeof s=="number"?new _r.Literal(String(s),cc):new _r.Literal(String(s),vs)}case"max":{let s=this.computeMax(r);return s===void 0?new _r.Literal("",vs):typeof s=="number"?new _r.Literal(String(s),cc):new _r.Literal(String(s),vs)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new _r.Literal(s||" ",vs)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new _r.Literal(" ",vs):typeof s=="number"?new _r.Literal(String(s),cc):new _r.Literal(String(s),vs)}default:{let s=i;throw new Vf(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,o=jU.CustomAggregateRegistry.getInstance().get(i);if(o||(o=$U.BUILT_IN_AGGREGATES[i]),!o)throw new Vf(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=o.init();for(let l of t){let u=null;if(e.expression){let f=this.evaluateExpression(e.expression,l);f!==void 0&&(u=f)}else u=1;o.step(c,u)}return o.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 o=s[0],c=parseFloat(o);return isNaN(c)?o: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}=_s(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if($C(s)){r.set(i.variable,new _r.Literal("0",cc));continue}switch(s){case"count":r.set(i.variable,new _r.Literal("0",jC));break;case"sum":case"avg":r.set(i.variable,new _r.Literal("0",cc));break;case"group_concat":r.set(i.variable,new _r.Literal(" ",vs));break;case"min":case"max":case"sample":r.set(i.variable,new _r.Literal("",vs));break;default:r.set(i.variable,new _r.Literal("",vs))}}return r}};Nl.AggregateExecutor=Kw});var Zw=w(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});Mm.ConstructExecutor=void 0;var UU=Xn(),lc=Pe(),Qw=Ge(),Xw=jt(),BU=gf(),Jw=class{static{a(this,"ConstructExecutor")}async execute(e,t){let r=[],i=new Set;for(let s of t)for(let o of e)try{let c=this.instantiateTriple(o,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),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 UU.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 lc.IRI(e.value);if(e.type==="literal")return new Qw.Literal(e.value,e.datatype?new lc.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new Xw.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 BU.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 Qw.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new lc.IRI(e.value);if(e.type==="blank")return new Xw.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 lc.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new lc.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 lc.IRI(e.value);if(e.type==="blank")return new Xw.BlankNode(e.value);if(e.type==="literal")return new Qw.Literal(e.value,e.datatype?new lc.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}`)}};Mm.ConstructExecutor=Jw});var VC=w(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.ServiceExecutor=kl.ServiceExecutorError=void 0;var VU=_s(),BC=Pe(),qU=Ge(),GU=jt(),uc=class extends Error{static{a(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};kl.ServiceExecutorError=uc;var e1=class{static{a(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,o=setTimeout(()=>s.abort(),this.timeout);try{let c=await this.httpClient(e,{method:"POST",headers:{"Content-Type":"application/sparql-query",Accept:"application/sparql-results+json"},body:t,signal:s.signal});if(!c.ok)throw new uc(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(o)}}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 uc(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new uc(`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 VU.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 BC.IRI(e.value);case"literal":{let t=e.datatype?new BC.IRI(e.datatype):void 0;return new qU.Literal(e.value,t,e["xml:lang"])}case"bnode":return new GU.BlankNode(e.value);default:throw new uc(`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))}};kl.ServiceExecutor=e1});var GC=w(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.GraphExecutor=Ml.GraphExecutorError=void 0;var qC=Pe(),jm=class extends Error{static{a(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};Ml.GraphExecutorError=jm;var t1=class{static{a(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 jm(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new qC.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*r(e,i))}async*executeWithGraphVariable(e,t,r,i){if(i){let o=i.get(t.value);if(o&&o instanceof qC.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:o.value},r);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let o of s)for await(let c of r(e.pattern,o)){let l=c.clone();l.set(t.value,o),yield l}}};Ml.GraphExecutor=t1});var WC=w($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.SPARQLGenerator=$l.SPARQLGeneratorError=void 0;var jl=class extends Error{static{a(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};$l.SPARQLGeneratorError=jl;var r1=class{static{a(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
48
|
+
`,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,r);if(c){i+=c.iri,s=c.endIndex;continue}i+=o,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 o=t+i.length+1,c=o;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===o)continue;let l=e.substring(o,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,r=new RegExp(iU.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}};tm.VaultPrefixTransformer=aw});var bl=w(kn=>{"use strict";var oU=kn&&kn.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),aU=kn&&kn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),cU=kn&&kn.__importStar||(function(){var n=a(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"&&oU(t,e,r[i]);return aU(t,e),t}})();Object.defineProperty(kn,"__esModule",{value:!0});kn.SPARQLParser=kn.ExoQLParser=kn.SPARQLParseError=void 0;var iC=cU(eC()),lw=tw(),uw=rw(),sC=tC(),fw=iw(),lU=rC(),dw=nC(),uU=cw(),gr=class extends Error{static{a(this,"SPARQLParseError")}constructor(e,t,r,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=r}};kn.SPARQLParseError=gr;var rm=class{static{a(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new iC.Parser({sparqlStar:!0}),this.generator=new iC.Generator({sparqlStar:!0}),this.caseWhenTransformer=new lw.CaseWhenTransformer,this.lateralTransformer=new uw.LateralTransformer,this.prefixStarTransformer=new sC.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new fw.DescribeOptionsTransformer,this.directionalLangTagTransformer=new lU.DirectionalLangTagTransformer,this.tripleTermTransformer=new dw.TripleTermTransformer,this.vaultPrefixTransformer=new uU.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 fw.DescribeOptionsTransformerError)throw new gr(t.message);if(t instanceof uw.LateralTransformerError)throw new gr(t.message);if(t instanceof lw.CaseWhenTransformerError)throw new gr(t.message);if(t instanceof dw.TripleTermTransformerError)throw new gr(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 gr(`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 fw.DescribeOptionsTransformerError)throw new gr(t.message);if(t instanceof sC.PrefixStarTransformerError)throw new gr(t.message);if(t instanceof uw.LateralTransformerError)throw new gr(t.message);if(t instanceof lw.CaseWhenTransformerError)throw new gr(t.message);if(t instanceof dw.TripleTermTransformerError)throw new gr(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 gr(`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 gr(`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 gr("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 gr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new gr(`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 gr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};kn.ExoQLParser=rm;kn.SPARQLParser=rm});var sc=w(nm=>{"use strict";Object.defineProperty(nm,"__esModule",{value:!0});nm.AlgebraTranslatorError=void 0;var hw=class extends Error{static{a(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};nm.AlgebraTranslatorError=hw});var im=w(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.isVariableExpression=fU;bs.isVariableTerm=dU;bs.isNamedNode=hU;bs.isLiteral=pU;bs.isPropertyPath=mU;bs.isAggregateExpression=gU;bs.isOperationExpression=yU;bs.isFunctionCallExpression=bU;function fU(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}a(fU,"isVariableExpression");function dU(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}a(dU,"isVariableTerm");function hU(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}a(hU,"isNamedNode");function pU(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}a(pU,"isLiteral");function mU(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}a(mU,"isPropertyPath");function gU(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}a(gU,"isAggregateExpression");function yU(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}a(yU,"isOperationExpression");function bU(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}a(bU,"isFunctionCallExpression")});var oC=w(sm=>{"use strict";Object.defineProperty(sm,"__esModule",{value:!0});sm.TripleTranslator=void 0;var gn=sc(),pw=class{static{a(this,"TripleTranslator")}constructor(){this.directionMappings=new Map}setDirectionMappings(e){this.directionMappings=e}translateBGP(e){if(!("triples"in e)||!Array.isArray(e.triples))throw new gn.AlgebraTranslatorError("BGP pattern must have triples array");return{type:"bgp",triples:e.triples.map(t=>this.translateTriple(t))}}translateTriple(e){if(!e.subject||!e.predicate||!e.object)throw new gn.AlgebraTranslatorError("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translatePredicate(e){return"type"in e&&e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!("pathType"in e)||!e.pathType)throw new gn.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new gn.AlgebraTranslatorError("Property path must have items array");let t=e.items.map(r=>this.translatePathItem(r));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new gn.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new gn.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new gn.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new gn.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new gn.AlgebraTranslatorError(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if("type"in e&&e.type==="path")return this.translatePropertyPath(e);if("termType"in e&&e.termType==="NamedNode")return{type:"iri",value:e.value};let t="type"in e?e.type:"termType"in e?e.termType:"unknown";throw new gn.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new gn.AlgebraTranslatorError("Triple element must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};case"Literal":{let t={type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language};if(e.language){let r=this.directionMappings.get(e.language.toLowerCase());r&&(t.direction=r)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new gn.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new gn.AlgebraTranslatorError("Quoted triple must have subject, predicate, and object");return{type:"quoted",subject:this.translateTripleElement(e.subject),predicate:this.translateQuotedTriplePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateQuotedTriplePredicate(e){if(!e||!("termType"in e))throw new gn.AlgebraTranslatorError("Quoted triple predicate must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};default:throw new gn.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};sm.TripleTranslator=pw});var aC=w(om=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});om.ExpressionTranslator=void 0;var _l=sc(),mw=class{static{a(this,"ExpressionTranslator")}constructor(e){this.translateWhereFn=e.translateWhere,this.translateBGPFn=e.translateBGP,this.translatePatternFn=e.translatePattern}translateExpression(e){if(!e)throw new _l.AlgebraTranslatorError("Expression cannot be null or undefined");if("type"in e&&e.type==="operation")return this.translateOperationExpression(e);let t="type"in e?e.type:void 0;if(t==="functioncall"||t==="functionCall"){let r=e;return{type:"functionCall",function:r.function,args:r.args.map(i=>this.translateExpression(i))}}if("termType"in e)return this.translateTermExpression(e);throw new _l.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new _l.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateTermExpression(e){if(e.termType==="Variable")return{type:"variable",name:e.value};if(e.termType==="Literal"){let t=e.value;return e.datatype&&(e.datatype.value.includes("#integer")||e.datatype.value.includes("#decimal")?t=parseFloat(e.value):e.datatype.value.includes("#boolean")&&(t=e.value==="true")),{type:"literal",value:t,datatype:e.datatype?.value}}return{type:"literal",value:String(e.value||e)}}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"],s=e.args.filter(o=>!("patterns"in o)||"termType"in o);return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:s.map(o=>this.translateExpression(o))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:e.operator==="exists"||e.operator==="notexists"?this.translateExistsExpression(e):e.operator==="in"||e.operator==="notin"?this.translateInExpression(e):{type:"function",function:e.operator,args:s.map(o=>this.translateExpression(o))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new _l.AlgebraTranslatorError("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&"patterns"in t&&t.patterns?r=this.translateWhereFn(t.patterns):t.type==="bgp"?r=this.translateBGPFn(t):r=this.translatePatternFn(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new _l.AlgebraTranslatorError("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],r=e.args[1];if(!Array.isArray(r))throw new _l.AlgebraTranslatorError("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:r.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}};om.ExpressionTranslator=mw});var uC=w(am=>{"use strict";Object.defineProperty(am,"__esModule",{value:!0});am.PatternTranslator=void 0;var cC=rw(),Vr=sc(),lC=im(),gw=class{static{a(this,"PatternTranslator")}constructor(e){this.directionMappings=new Map,this.translateExpressionFn=e.translateExpression,this.translateSelectFn=e.translateSelect,this.translateBGPFn=e.translateBGP}setDirectionMappings(e){this.directionMappings=e}translateWhere(e){if(e.length===0)throw new Vr.AlgebraTranslatorError("Empty WHERE clause");let t=e.filter(o=>o.type==="filter"),r=e.filter(o=>o.type==="bind"),i=e.filter(o=>o.type!=="filter"&&o.type!=="bind"),s;if(i.length===0)s={type:"bgp",triples:[]};else if(i.length===1)if(i[0].type==="optional"){let o=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:o?this.translateExpressionFn(o):void 0}}else s=this.translatePattern(i[0]);else{if(i[0].type==="optional"){let o=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:o?this.translateExpressionFn(o):void 0}}else s=this.translatePattern(i[0]);for(let o=1;o<i.length;o++){let c=i[o];if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelectFn(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional"){let l=c.expression;s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:l?this.translateExpressionFn(l):void 0}}else{let l=this.translatePattern(c);s={type:"join",left:s,right:l}}}}for(let o of r)s=this.translateBind(o,s);for(let o of t)s={type:"filter",expression:this.translateExpressionFn(o.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new Vr.AlgebraTranslatorError("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGPFn(e);case"filter":return this.translateFilter(e);case"optional":return this.translateOptional(e);case"union":return this.translateUnion(e);case"minus":return this.translateMinus(e);case"values":return this.translateValues(e);case"group":return this.translateWhere(e.patterns);case"query":return this.translateSubquery(e);case"service":return this.translateService(e);case"graph":return this.translateGraph(e);default:throw new Vr.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Vr.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpressionFn(e.expression),input:t}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new Vr.AlgebraTranslatorError("OPTIONAL pattern must have patterns");let t=e.expression;return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:t?this.translateExpressionFn(t):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new Vr.AlgebraTranslatorError("UNION pattern must have at least 2 patterns");let t=a(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(i):"patterns"in i&&i.patterns&&Array.isArray(i.patterns)?this.translateWhere(i.patterns):this.translateWhere([i]),"translateBranch"),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 Vr.AlgebraTranslatorError("MINUS pattern must have patterns");return{type:"minus",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns)}}translateValues(e){if(!e.values||!Array.isArray(e.values))throw new Vr.AlgebraTranslatorError("VALUES pattern must have values array");let t=new Set;for(let i of e.values)for(let s of Object.keys(i)){let o=s.startsWith("?")?s.slice(1):s;t.add(o)}let 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,o=i;if(o)if(o.termType==="NamedNode")t[s]={type:"iri",value:o.value};else if(o.termType==="Literal"){let c=o,l={type:"literal",value:c.value,datatype:c.datatype?.value,language:c.language||void 0};if(c.language){let u=this.directionMappings.get(c.language.toLowerCase());u&&(l.direction=u)}t[s]=l}else throw new Vr.AlgebraTranslatorError(`Unsupported VALUES term type: ${o.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Vr.AlgebraTranslatorError("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpressionFn(e.expression),input:t}}translateSubquery(e){if(e.queryType!=="SELECT")throw new Vr.AlgebraTranslatorError(`Only SELECT subqueries are supported, got: ${String(e.queryType)}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelectFn(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new Vr.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Vr.AlgebraTranslatorError("SERVICE pattern must have patterns array");return{type:"service",endpoint:e.name.value,pattern:this.translateWhere(e.patterns),silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new Vr.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Vr.AlgebraTranslatorError("GRAPH pattern must have patterns array");let t;if(e.name.termType==="NamedNode")t={type:"iri",value:e.name.value};else if(e.name.termType==="Variable")t={type:"variable",value:e.name.value};else throw new Vr.AlgebraTranslatorError(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);return{type:"graph",name:t,pattern:this.translateWhere(e.patterns)}}isLateralPattern(e){if(e.type==="query"&&this.isLateralSubquery(e))return!0;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query"&&this.isLateralSubquery(t))return!0}return!1}extractLateralSubquery(e){if(e.type==="query")return e;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query")return t}throw new Vr.AlgebraTranslatorError("Invalid lateral pattern structure")}isLateralSubquery(e){return!("queryType"in e)||e.queryType!=="SELECT"||!("variables"in e)||!e.variables?!1:e.variables.some(i=>(0,lC.isVariableTerm)(i)&&i.value===cC.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){if(!("variables"in e)||!e.variables)return e;let t=e,r=t.variables;return{...t,variables:r.filter(i=>!((0,lC.isVariableTerm)(i)&&i.value===cC.LateralTransformer.LATERAL_MARKER))}}};am.PatternTranslator=gw});var dC=w(cm=>{"use strict";Object.defineProperty(cm,"__esModule",{value:!0});cm.AggregateTranslator=void 0;var fC=sc(),_U=im(),yw=class{static{a(this,"AggregateTranslator")}constructor(e){this.aggregateCounter=0,this.translateExpressionFn=e.translateExpression}resetCounter(){this.aggregateCounter=0}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)(0,_U.isVariableExpression)(i)&&("type"in i.expression&&i.expression.type==="aggregate"?(r.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,r,t));return r}extractGroupVariables(e){return e?e.filter(t=>t.expression&&"termType"in t.expression&&t.expression.termType==="Variable").map(t=>t.expression.value):[]}extractHavingExpressions(e,t,r){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,r);return e.map(i=>this.transformExpressionWithAggregateVars(i,r))}transformExpressionWithAggregateVars(e,t){let r=t.get(e);if(r!==void 0)return{type:"variable",name:r};if("type"in e&&e.type==="operation"&&"args"in e){let i=e,s=i.args.filter(u=>!Array.isArray(u)&&!("patterns"in u)).map(u=>this.transformExpressionWithAggregateVars(u,t)),o=["=","!=","<",">","<=",">="],c=["&&","||","!"],l=["+","-","*","/"];return o.includes(i.operator)?{type:"comparison",operator:i.operator,left:s[0],right:s[1]}:c.includes(i.operator)?{type:"logical",operator:i.operator,operands:s}:l.includes(i.operator)?{type:"arithmetic",operator:i.operator,left:s[0],right:s[1]}:{type:"function",function:i.operator,args:s}}return this.translateExpressionFn(e)}translateOrderComparator(e){return{expression:this.translateExpressionFn(e.expression),descending:e.descending||!1}}translateAggregateExpression(e){let t=e.aggregation,r=a(()=>{if(e.expression&&!("termType"in e.expression&&e.expression.termType==="Wildcard"))return this.translateExpressionFn(e.expression)},"translateInnerExpr");if(typeof t=="string"){let s=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(s)?{type:"aggregate",aggregation:s,expression:r(),distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:r(),distinct:e.distinct||!1,separator:e.separator}}let i=t;if(i&&typeof i=="object"){let s,o=i;if(o.termType==="NamedNode"&&typeof o.value=="string")s=o.value;else if("value"in o)s=String(o.value);else throw new fC.AlgebraTranslatorError(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(i)}`);return{type:"aggregate",aggregation:{type:"custom",iri:s},expression:r(),distinct:e.distinct||!1,separator:e.separator}}throw new fC.AlgebraTranslatorError(`Unknown aggregate format: ${JSON.stringify(t)}`)}collectNestedAggregates(e,t,r){if(e){if("type"in e&&e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if("type"in e&&e.type==="operation"&&"args"in e){let i=e;for(let s of i.args)!Array.isArray(s)&&"type"in s&&!("patterns"in s)?this.collectNestedAggregates(s,t,r):"termType"in s&&this.collectNestedAggregates(s,t,r)}}}};cm.AggregateTranslator=yw});var Sl=w(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.AlgebraTranslator=ia.ExoQLAlgebraTranslator=ia.AlgebraTranslatorError=void 0;var lm=sc(),um=im(),SU=oC(),wU=aC(),vU=uC(),EU=dC(),TU=sc();Object.defineProperty(ia,"AlgebraTranslatorError",{enumerable:!0,get:a(function(){return TU.AlgebraTranslatorError},"get")});var fm=class{static{a(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new SU.TripleTranslator,this.expressionTranslator=new wU.ExpressionTranslator({translateWhere:a(e=>this.patternTranslator.translateWhere(e),"translateWhere"),translateBGP:a(e=>this.tripleTranslator.translateBGP(e),"translateBGP"),translatePattern:a(e=>this.patternTranslator.translatePattern(e),"translatePattern")}),this.patternTranslator=new vU.PatternTranslator({translateExpression:a(e=>this.expressionTranslator.translateExpression(e),"translateExpression"),translateSelect:a(e=>this.translateSelect(e),"translateSelect"),translateBGP:a(e=>this.tripleTranslator.translateBGP(e),"translateBGP")}),this.aggregateTranslator=new EU.AggregateTranslator({translateExpression:a(e=>this.expressionTranslator.translateExpression(e),"translateExpression")})}setDirectionMappings(e){this.tripleTranslator.setDirectionMappings(e),this.patternTranslator.setDirectionMappings(e)}translate(e){if(e.type!=="query")throw new lm.AlgebraTranslatorError("Only query operations are supported (not updates)");if(e.queryType==="SELECT")return this.translateSelect(e);if(e.queryType==="CONSTRUCT")return this.translateConstruct(e);if(e.queryType==="ASK")return this.translateAsk(e);if(e.queryType==="DESCRIBE")return this.translateDescribe(e);throw new lm.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new lm.AlgebraTranslatorError("SELECT query must have WHERE clause");let t=this.patternTranslator.translateWhere(e.where);this.aggregateTranslator.resetCounter();let r=new Map,i=Array.isArray(e.variables)?e.variables.filter(l=>!("termType"in l&&l.termType==="Wildcard")):[],s=this.aggregateTranslator.extractAggregatesWithMapping(i,r),o=this.aggregateTranslator.extractGroupVariables(e.group),c=this.aggregateTranslator.extractHavingExpressions(e.having,s,r);if((s.length>0||o.length>0||c.length>0)&&(t={type:"group",variables:o,aggregates:s,having:c.length>0?c:void 0,input:t}),i.length>0){for(let l of i)if((0,um.isVariableExpression)(l)){if("type"in l.expression&&l.expression.type==="aggregate")continue;let u=this.aggregateTranslator.transformExpressionWithAggregateVars(l.expression,r);t={type:"extend",variable:l.variable.value,expression:u,input:t}}}if(e.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(l=>this.aggregateTranslator.translateOrderComparator(l)),input:t}),i.length>0){let l=i.filter(u=>(0,um.isVariableTerm)(u)||(0,um.isVariableExpression)(u)).map(u=>(0,um.isVariableTerm)(u)?u.value:u.variable.value);l.length>0&&(t={type:"project",variables:l,input:t})}return e.distinct&&(t={type:"distinct",input:t}),e.reduced&&(t={type:"reduced",input:t}),(e.limit!==void 0||e.offset!==void 0)&&(t={type:"slice",limit:e.limit,offset:e.offset,input:t}),t}translateConstruct(e){let t=this.tripleTranslator.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new lm.AlgebraTranslatorError("CONSTRUCT query must have WHERE clause");let r=this.patternTranslator.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(r={type:"slice",limit:i.limit,offset:i.offset,input:r}),{type:"construct",template:t,where:r}}translateAsk(e){return{type:"ask",where:e.where&&e.where.length>0?this.patternTranslator.translateWhere(e.where):{type:"bgp",triples:[]}}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables)){let s=e.variables;for(let o of s)o.termType==="Wildcard"||o.value==="*"||(o.termType==="Variable"?t.push({type:"variable",value:o.value}):o.termType==="NamedNode"&&t.push({type:"iri",value:o.value}))}let r;e.where&&e.where.length>0&&(r=this.patternTranslator.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};ia.ExoQLAlgebraTranslator=fm;ia.AlgebraTranslator=fm});var _s=w(dm=>{"use strict";Object.defineProperty(dm,"__esModule",{value:!0});dm.SolutionMapping=void 0;var hC=Ge(),pC=Pe(),mC=jt(),bw=class n{static{a(this,"SolutionMapping")}constructor(e){this.bindings=e?new Map(e):new Map}get(e){return this.bindings.get(e)}set(e,t){this.bindings.set(e,t)}has(e){return this.bindings.has(e)}variables(){return Array.from(this.bindings.keys())}getBindings(){return new Map(this.bindings)}isCompatibleWith(e){for(let[t,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 hC.Literal&&t instanceof hC.Literal?e.equals(t):e instanceof pC.IRI&&t instanceof pC.IRI?e.value===t.value:e instanceof mC.BlankNode&&t instanceof mC.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}};dm.SolutionMapping=bw});var yC=w(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.PropertyPathExecutor=vl.PropertyPathExecutorError=void 0;var AU=_s(),hm=Pe(),gC=jt(),IU=Ge(),wl=class extends Error{static{a(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};vl.PropertyPathExecutorError=wl;var _w=class n{static{a(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){if(this.isLiteralElement(e)||this.isLiteralElement(r)){let o=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:r,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l,f=this.describePath(t),d={position:o,value:u,path:f,hint:"Wikilink could not be resolved to IRI (likely label-form wikilink with no matching basename/alias). Check whether the target file exists in the queried vault, or add an alias. See issue #3282."};if(console.error(`[PropertyPathExecutor] literal-safety guard fired: literal in ${o} position \u2014 yielding 0 solutions. value="${u}" path=${f}`,d),n.isStrictModeEnabled())throw new wl(`Literal subject in property path: "${u}" (path=${f}). Set EXOCORTEX_SPARQL_STRICT=0 or omit --strict to fall back to warn-and-empty behaviour.`);return}let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let o of i){let c=await this.evaluatePath(o,t,s);for(let l of c){let u=new AU.SolutionMapping;this.isVariable(e)&&u.set(e.value,o),this.isVariable(r)&&u.set(r.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new wl("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 o=t.merge(s);o!==null&&(yield o)}}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 o=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,o,c?r:null);for(let d of f)l.add(d)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,r){let i=new Set;for(let s of t){let o=await this.evaluatePathItem(e,s,r);for(let c of o)i.add(c)}return i}async evaluateInversePath(e,t,r){if(t.type==="iri"){let i=new hm.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),o=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&o.add(c.subject);return o}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,o=[{node:e,depth:0}];for(;o.length>0;){let c=o.shift();if(!c)break;let{node:l,depth:u}=c;if(u>=this.MAX_DEPTH)continue;let f=await this.evaluatePathItem(l,t,null);for(let d of f){let h=this.nodeToKey(d);(r===null||this.nodeInSet(d,r))&&s.add(d),i.has(h)||(i.add(h),o.push({node:d,depth:u+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let o of s)i.add(o);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new hm.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),o=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&o.add(c.object);return o}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"|":return{type:"path",pathType:"|",items:e.items.map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"+":case"*":case"?":{let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new hm.IRI(e.value));break;case"blank":t.add(new gC.BlankNode(e.value));break;default:throw new wl(`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 hm.IRI)return{type:"iri",value:r.value};if(r instanceof gC.BlankNode)return{type:"blank",value:r.id};if(r instanceof IU.Literal)return{type:"literal",value:r.value,datatype:r.datatype?.value,language:r.language,direction:r.direction}}}return e}isVariable(e){return e.type==="variable"}isLiteralElement(e){return e.type==="literal"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}describePath(e){try{let t=e.items,r=a(s=>{if(s&&typeof s=="object"&&"type"in s){let o=s;if(o.type==="iri")return`<${String(o.value)}>`;if(o.type==="path")return this.describePath(o)}return"?"},"renderItem");if(!Array.isArray(t)||t.length===0)return"(?)";if(t.length===1){let s=r(t[0]);return e.pathType==="^"?`(^${s})`:e.pathType==="+"||e.pathType==="*"||e.pathType==="?"?`(${s}${e.pathType})`:`(${s})`}return`(${t.map(r).join(` ${e.pathType} `)})`}catch{return"<unprintable-path>"}}static isStrictModeEnabled(){let t=(typeof process<"u"?process.env:void 0)?.EXOCORTEX_SPARQL_STRICT;if(!t)return!1;let r=t.trim().toLowerCase();return r==="1"||r==="true"||r==="yes"}};vl.PropertyPathExecutor=_w});var vw=w(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.BGPExecutor=El.BGPExecutorError=void 0;var pm=_s(),sa=Pe(),Sw=Ge(),mm=jt(),gm=gf(),bC=yC(),qr=class extends Error{static{a(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};El.BGPExecutorError=qr;var ww=class{static{a(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new bC.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new pm.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 pm.SolutionMapping;return}let r=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)r=this.joinWithPatternInGraph(r,e.triples[i],t);for await(let i of r)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new qr("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:r);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),o=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new qr("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,o,t);for(let l of c){let u=new pm.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 o=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(o,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){if(this.isLiteral(e.subject)||this.isLiteral(e.object)){this.warnLiteralGuard("matchTriplePattern.propertyPath",this.isLiteral(e.subject)?"subject":"object",this.isLiteral(e.subject)?e.subject:e.object);return}yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:t);return}let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),o=await this.tripleStore.match(r,i,s);for(let c of o){let l=new pm.SolutionMapping;if(this.isVariable(e.subject))l.set(e.subject.value,c.subject);else if(this.isQuotedTriple(e.subject)){let u=this.matchQuotedTriplePattern(e.subject,c.subject);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}if(this.isVariable(t)&&l.set(t.value,c.predicate),this.isVariable(e.object))l.set(e.object.value,c.object);else if(this.isQuotedTriple(e.object)){let u=this.matchQuotedTriplePattern(e.object,c.object);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}yield l}}hasVariablesInQuotedTriple(e){return!!(this.isVariable(e.subject)||e.predicate.type==="variable"||this.isVariable(e.object)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object))}matchQuotedTriplePattern(e,t){if(!(t instanceof gm.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,o]of i)r.set(s,o)}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,o]of i)r.set(s,o)}else if(!this.elementsMatch(e.object,t.object))return null;return r}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof sa.IRI&&e.value===t.value;case"literal":return!(!(t instanceof Sw.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof mm.BlankNode&&e.value===t.id;case"quoted":return t instanceof gm.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 o of this.matchTriplePattern(s)){let c=i.merge(o);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 sa.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,r){let i="value"in r?String(r.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i,o={executor:"BGPExecutor",context:e,position:t,value:s,hint:"Wikilink could not be resolved to IRI (likely label-form wikilink with no matching basename/alias). Check whether the target file exists in the queried vault, or add an alias. See issue #3282."};if(console.error(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`,o),bC.PropertyPathExecutor.isStrictModeEnabled())throw new qr(`Literal in ${t} position (${e}): "${s}". Set EXOCORTEX_SPARQL_STRICT=0 or omit --strict to fall back to warn-and-empty behaviour.`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new sa.IRI(e.value);case"blank":return new mm.BlankNode(e.value);case"literal":throw new qr("Literals cannot appear in subject position");case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new qr(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new sa.IRI(e.predicate.value):(()=>{throw new qr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new gm.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new sa.IRI(e.value);case"literal":throw new qr("Literals cannot appear in predicate position");case"blank":throw new qr("Blank nodes cannot appear in predicate position");case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new qr(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new sa.IRI(e.value);case"literal":return new Sw.Literal(e.value,e.datatype?new sa.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new mm.BlankNode(e.value);case"variable":throw new qr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new qr(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof sa.IRI)return{type:"iri",value:e.value};if(e instanceof Sw.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof mm.BlankNode)return{type:"blank",value:e.id};if(e instanceof gm.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new qr(`Unknown RDF term type: ${String(e)}`)}toAlgebraQuotedTriple(e){return{type:"quoted",subject:this.toAlgebraElement(e.subject),predicate:{type:"iri",value:e.predicate.value},object:this.toAlgebraElement(e.object)}}};El.BGPExecutor=ww});var _C=w(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});ym.StringFunctions=void 0;var Tl=Pe(),oa=Ge(),Ew=jt(),Mf=class n{static{a(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Tl.IRI||e instanceof oa.Literal?e.value:e instanceof Ew.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof oa.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof oa.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=n.parseDirectionalLangTag(e),[s,o]=n.parseDirectionalLangTag(t),c=r.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":o&&i!==o?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let r=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[r,i]}static regex(e,t,r){try{let i=r?r.includes("u")?r:r+"u":"u";return new RegExp(t,i).test(e)}catch(i){throw new Error(`REGEX: invalid pattern '${t}': ${i.message}`)}}static contains(e,t){return e.includes(t)}static strStarts(e,t){return e.startsWith(t)}static strEnds(e,t){return e.endsWith(t)}static strlen(e){return e.length}static ucase(e){return e.toUpperCase()}static lcase(e){return e.toLowerCase()}static substr(e,t,r){let i=t-1;if(i<0){if(r!==void 0){let s=r+i;return s<=0?"":e.substring(0,s)}return e}return r!==void 0?e.substring(i,i+r):e.substring(i)}static strBefore(e,t){if(t==="")return"";let r=e.indexOf(t);return r===-1?"":e.substring(0,r)}static strAfter(e,t){if(t==="")return e;let r=e.indexOf(t);return r===-1?"":e.substring(r+t.length)}static concat(...e){return e.join("")}static replace(e,t,r,i){try{let s=i||"g",o=s.includes("u")?s:s+"u",c=new RegExp(t,o);return e.replace(c,r)}catch(s){throw new Error(`REPLACE: invalid pattern '${t}': ${s.message}`)}}static encodeForUri(e){return encodeURIComponent(e)}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let r;if(e instanceof oa.Literal)r=e.value;else if(e instanceof Tl.IRI)r=e.value;else if(e instanceof Ew.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 oa.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Tl.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!n.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=r.normalize(i);return new oa.Literal(s,new Tl.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 oa.Literal)t=e.value;else if(e instanceof Tl.IRI)t=e.value;else if(e instanceof Ew.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let r=n.unicodeCaseFold(t);return new oa.Literal(r,new Tl.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=n.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}};ym.StringFunctions=Mf;Mf.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Mf.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 SC=w(bm=>{"use strict";Object.defineProperty(bm,"__esModule",{value:!0});bm.MathFunctions=void 0;var Tw=class{static{a(this,"MathFunctions")}static msToMinutes(e){return Math.round(e/(1e3*60))}static msToHours(e){return Math.round(e/(1e3*60*60)*100)/100}static msToSeconds(e){return Math.round(e/1e3)}static abs(e){return Math.abs(e)}static round(e){return Math.round(e)}static ceil(e){return Math.ceil(e)}static floor(e){return Math.floor(e)}static rand(){return Math.random()}};bm.MathFunctions=Tw});var jf=w(_m=>{"use strict";Object.defineProperty(_m,"__esModule",{value:!0});_m.DateTimeParsing=void 0;var xU=Pe(),RU=Ge(),Aw=class n{static{a(this,"DateTimeParsing")}static parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static parseDayTimeDuration(e){if(!e)throw new Error("parseDayTimeDuration: duration string is empty");let t=!1,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"),o="",c="";if(s===-1?o=r:(o=r.substring(0,s),c=r.substring(s+1)),o){let l=o.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(o!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${o}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let h=parseFloat(u[1]);i+=h*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let h=parseFloat(f[1]);i+=h*60*1e3,l=l.substring(f[0].length)}let d=l.match(/^(\d+(?:\.\d+)?)S$/);if(d){let h=parseFloat(d[1]);i+=h*1e3,l=l.substring(d[0].length)}if(l!=="")throw new Error(`parseDayTimeDuration: invalid time component: '${l}' in '${e}'`)}return t?-i:i}static formatDayTimeDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/(1440*60*1e3));r=r%(1440*60*1e3);let s=Math.floor(r/(3600*1e3));r=r%(3600*1e3);let o=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||o>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),o>0&&(l+=`${o}M`),(c>0||s===0&&o===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return n.parseDayTimeDuration(e),new RU.Literal(e,new xU.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,o=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,o));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,d=parseInt(u[2],10),h=parseInt(u[3],10),p=f*(d*60+h)*60*1e3;l=new Date(l.getTime()-p)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),o=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||o<0||o>59||i===24&&(s!==0||o!==0))return null;let u=0;if(c){let d=c.padEnd(3,"0").slice(0,3);u=parseInt(d,10)}let f=i*60*60*1e3+s*60*1e3+o*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let h=d[1]==="+"?1:-1,p=parseInt(d[2],10),g=parseInt(d[3],10),y=h*(p*60+g)*60*1e3;f-=y}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+o;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,o=t?"-P":"P";return i>0&&(o+=`${i}Y`),(s>0||i===0)&&(o+=`${s}M`),o}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:o,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,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,o=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.substring(l+1)),u){let d=u.match(/^(\d+(?:\.\d+)?)D$/);if(d)i=parseFloat(d[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let d=f,h=d.match(/^(\d+(?:\.\d+)?)H/);h&&(s=parseFloat(h[1]),d=d.substring(h[0].length));let p=d.match(/^(\d+(?:\.\d+)?)M/);p&&(o=parseFloat(p[1]),d=d.substring(p[0].length));let g=d.match(/^(\d+(?:\.\d+)?)S$/);if(g&&(c=parseFloat(g[1]),d=d.substring(g[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:o,seconds:c}}};_m.DateTimeParsing=Aw});var wC=w(Sm=>{"use strict";Object.defineProperty(Sm,"__esModule",{value:!0});Sm.DateTimeArithmetic=void 0;var yn=Pe(),Ue=Ge(),it=jf(),Iw=class{static{a(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r),o=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${r}'`);if(isNaN(o.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-o.getTime(),l=it.DateTimeParsing.formatDayTimeDuration(c);return new Ue.Literal(l,new yn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let o=it.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+o,l=new Date(c);return new Ue.Literal(l.toISOString(),new yn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let o=it.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-o,l=new Date(c);return new Ue.Literal(l.toISOString(),new yn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let o=it.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+o,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Ue.Literal(h,new yn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let o=it.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-o,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Ue.Literal(h,new yn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let o=it.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+o),s.getUTCDate()!==c&&s.setUTCDate(0),new Ue.Literal(s.toISOString(),new yn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let o=it.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-o),s.getUTCDate()!==c&&s.setUTCDate(0),new Ue.Literal(s.toISOString(),new yn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let o=it.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+o),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Ue.Literal(d,new yn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let o=it.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-o),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Ue.Literal(d,new yn.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseDayTimeDuration(r),o=it.DateTimeParsing.parseDayTimeDuration(i),c=it.DateTimeParsing.formatDayTimeDuration(s+o);return new Ue.Literal(c,new yn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseDayTimeDuration(r),o=it.DateTimeParsing.parseDayTimeDuration(i),c=it.DateTimeParsing.formatDayTimeDuration(s-o);return new Ue.Literal(c,new yn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof Ue.Literal?e.value:e,i=it.DateTimeParsing.parseDayTimeDuration(r),s=it.DateTimeParsing.formatDayTimeDuration(i*t);return new Ue.Literal(s,new yn.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 Ue.Literal?e.value:e,i=it.DateTimeParsing.parseDayTimeDuration(r),s=it.DateTimeParsing.formatDayTimeDuration(i/t);return new Ue.Literal(s,new yn.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseYearMonthDuration(r),o=it.DateTimeParsing.parseYearMonthDuration(i),c=it.DateTimeParsing.formatYearMonthDuration(s+o);return new Ue.Literal(c,new yn.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof Ue.Literal?e.value:e,i=t instanceof Ue.Literal?t.value:t,s=it.DateTimeParsing.parseYearMonthDuration(r),o=it.DateTimeParsing.parseYearMonthDuration(i),c=it.DateTimeParsing.formatYearMonthDuration(s-o);return new Ue.Literal(c,new yn.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Ue.Literal?e.value:e;return it.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Ue.Literal?e.value:e;return it.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Ue.Literal?e.value:e;return it.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Ue.Literal?e.value:e;return it.DateTimeParsing.parseDayTimeDuration(t)/1e3}};Sm.DateTimeArithmetic=Iw});var vC=w(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});wm.DateTimeAccessors=void 0;var $f=Pe(),$t=Ge(),Rt=jf(),xw=class{static{a(this,"DateTimeAccessors")}static year(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return t.getFullYear()}static month(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return t.getMonth()+1}static day(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return t.getDate()}static hours(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return t.getHours()}static minutes(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return t.getMinutes()}static seconds(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return t.getSeconds()+t.getMilliseconds()/1e3}static durationDays(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof $t.Literal?e.value:e,r=Rt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let r;if(e.endsWith("Z"))r="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),o=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);o===0?r=`${c}PT${l}H`:r=`${c}PT${l}H${o}M`}else{let s=-t.getTimezoneOffset(),o=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?r=`${l}PT${o}H`:r=`${l}PT${o}H${c}M`}}return new $t.Literal(r,new $f.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static tz(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TZ: invalid date string '${e}'`);if(e.endsWith("Z"))return"Z";let r=e.match(/([+-]\d{2}:\d{2})$/);if(r)return r[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static adjust(e,t){let r=e instanceof $t.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let R=i.getUTCFullYear(),V=String(i.getUTCMonth()+1).padStart(2,"0"),L=String(i.getUTCDate()).padStart(2,"0"),P=String(i.getUTCHours()).padStart(2,"0"),k=String(i.getUTCMinutes()).padStart(2,"0"),O=String(i.getUTCSeconds()).padStart(2,"0"),J=i.getUTCMilliseconds(),re=`${R}-${V}-${L}T${P}:${k}:${O}`;return J>0&&(re+=`.${String(J).padStart(3,"0")}`),new $t.Literal(re,new $f.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof $t.Literal?t.value:t,o=Rt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(o)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+o),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),h=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),g=String(u.getUTCMinutes()).padStart(2,"0"),y=String(u.getUTCSeconds()).padStart(2,"0"),b=u.getUTCMilliseconds(),S=o>=0?"+":"-",v=Math.floor(Math.abs(o)/(3600*1e3)),I=Math.floor(Math.abs(o)%(3600*1e3)/(60*1e3)),A=`${S}${String(v).padStart(2,"0")}:${String(I).padStart(2,"0")}`,T=`${f}-${d}-${h}T${p}:${g}:${y}`;return b>0&&(T+=`.${String(b).padStart(3,"0")}`),T+=A,new $t.Literal(T,new $f.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static now(){return new Date().toISOString()}static dateBefore(e,t){let r=Rt.DateTimeParsing.parseDate(e),i=Rt.DateTimeParsing.parseDate(t);return r<i}static dateAfter(e,t){let r=Rt.DateTimeParsing.parseDate(e),i=Rt.DateTimeParsing.parseDate(t);return r>i}static dateInRange(e,t,r){let i=Rt.DateTimeParsing.parseDate(e),s=Rt.DateTimeParsing.parseDate(t),o=Rt.DateTimeParsing.parseDate(r);return i>=s&&i<=o}static compareDurations(e,t,r){let i=e instanceof $t.Literal?e.value:e,s=t instanceof $t.Literal?t.value:t,o=Rt.DateTimeParsing.parseDayTimeDuration(i),c=Rt.DateTimeParsing.parseDayTimeDuration(s);switch(r){case"=":return o===c;case"!=":return o!==c;case"<":return o<c;case">":return o>c;case"<=":return o<=c;case">=":return o>=c;default:throw new Error(`compareDurations: unknown operator: ${r}`)}}static dateDiffMinutes(e,t){let r=Rt.DateTimeParsing.parseDate(e),i=Rt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=Rt.DateTimeParsing.parseDate(e),i=Rt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static timeDiff(e,t){let r=e instanceof $t.Literal?e.value:e,i=t instanceof $t.Literal?t.value:t,s=Rt.DateTimeParsing.parseXSDTime(r),o=Rt.DateTimeParsing.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${r}'`);if(o===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-o,l=Rt.DateTimeParsing.formatDayTimeDuration(c);return new $t.Literal(l,new $f.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof $t.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof $t.Literal?e.value:e,i=t instanceof $t.Literal?t.value:t,s=Rt.DateTimeParsing.parseXSDDate(r),o=Rt.DateTimeParsing.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${r}'`);if(o===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-o.getTime(),l=Math.round(c/(1440*60*1e3)),u=Rt.DateTimeParsing.formatDateDuration(l);return new $t.Literal(u,new $f.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};wm.DateTimeAccessors=xw});var Em=w(vm=>{"use strict";Object.defineProperty(vm,"__esModule",{value:!0});vm.DateTimeFunctions=void 0;var Al=jf(),yr=wC(),vt=vC(),Rw=class{static{a(this,"DateTimeFunctions")}static parseDate(e){return Al.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Al.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Al.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Al.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Al.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Al.DateTimeParsing.formatYearMonthDuration(e)}static year(e){return vt.DateTimeAccessors.year(e)}static month(e){return vt.DateTimeAccessors.month(e)}static day(e){return vt.DateTimeAccessors.day(e)}static hours(e){return vt.DateTimeAccessors.hours(e)}static minutes(e){return vt.DateTimeAccessors.minutes(e)}static seconds(e){return vt.DateTimeAccessors.seconds(e)}static durationDays(e){return vt.DateTimeAccessors.durationDays(e)}static durationHours(e){return vt.DateTimeAccessors.durationHours(e)}static durationMinutes(e){return vt.DateTimeAccessors.durationMinutes(e)}static durationSeconds(e){return vt.DateTimeAccessors.durationSeconds(e)}static durationYears(e){return vt.DateTimeAccessors.durationYears(e)}static durationMonths(e){return vt.DateTimeAccessors.durationMonths(e)}static timezone(e){return vt.DateTimeAccessors.timezone(e)}static tz(e){return vt.DateTimeAccessors.tz(e)}static adjust(e,t){return vt.DateTimeAccessors.adjust(e,t)}static now(){return vt.DateTimeAccessors.now()}static dateBefore(e,t){return vt.DateTimeAccessors.dateBefore(e,t)}static dateAfter(e,t){return vt.DateTimeAccessors.dateAfter(e,t)}static dateInRange(e,t,r){return vt.DateTimeAccessors.dateInRange(e,t,r)}static compareDurations(e,t,r){return vt.DateTimeAccessors.compareDurations(e,t,r)}static dateDiffMinutes(e,t){return vt.DateTimeAccessors.dateDiffMinutes(e,t)}static dateDiffHours(e,t){return vt.DateTimeAccessors.dateDiffHours(e,t)}static timeDiff(e,t){return vt.DateTimeAccessors.timeDiff(e,t)}static dateDiff(e,t){return vt.DateTimeAccessors.dateDiff(e,t)}static isDayTimeDuration(e){return vt.DateTimeAccessors.isDayTimeDuration(e)}static isDate(e){return vt.DateTimeAccessors.isDate(e)}static isYearMonthDuration(e){return vt.DateTimeAccessors.isYearMonthDuration(e)}static isTime(e){return vt.DateTimeAccessors.isTime(e)}static dateTimeDiff(e,t){return yr.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return yr.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return yr.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return yr.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return yr.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return yr.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return yr.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return yr.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return yr.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return yr.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return yr.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return yr.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return yr.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return yr.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return yr.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return yr.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return yr.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return yr.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return yr.DateTimeArithmetic.durationToSeconds(e)}};vm.DateTimeFunctions=Rw});var EC=w(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});Am.LogicalFunctions=void 0;var CU=Pe(),Il=Ge(),OU=jt(),Tm=Em(),Cw=class n{static{a(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return Tm.DateTimeFunctions.compareDurations(e instanceof Il.Literal?e:String(e),t instanceof Il.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return Tm.DateTimeFunctions.compareDurations(e instanceof Il.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return Tm.DateTimeFunctions.compareDurations(e,t instanceof Il.Literal?t:String(t),r);let i=n.toComparableValue(e),s=n.toComparableValue(t);switch(r){case"=":return i===s;case"!=":return i!==s;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:throw new Error(`Unknown comparison operator: ${r}`)}}static isDayTimeDurationValue(e){return e instanceof Il.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 Il.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 Tm.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof CU.IRI?e.value:e instanceof OU.BlankNode?e.id:String(e)}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,r){return e?t:r}};Am.LogicalFunctions=Cw});var TC=w(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});Im.RDFTermFunctions=void 0;var Gr=Pe(),xt=Ge(),Ci=jt(),xl=gf(),Ow=Ii(),Pw=class n{static{a(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof xt.Literal)return e.datatype?e.datatype:e.language?new Gr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Gr.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 Gr.IRI}static isBlank(e){return e===void 0?!1:e instanceof Ci.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof xt.Literal}static isTriple(e){return e===void 0?!1:e instanceof xl.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof xt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof xt.Literal))return!1;let t=e.datatype?.value;return t?["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float","http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedShort","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#positiveInteger"].includes(t):!1}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new xt.Literal(t.toISOString(),new Gr.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 xt.Literal(String(t),new Gr.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 xt.Literal(String(t),new Gr.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static sameTerm(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0||e.constructor!==t.constructor)return!1;if(e instanceof Gr.IRI&&t instanceof Gr.IRI)return e.value===t.value;if(e instanceof Ci.BlankNode&&t instanceof Ci.BlankNode)return e.id===t.id;if(e instanceof xt.Literal&&t instanceof xt.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 Gr.IRI)return e;if(e instanceof xt.Literal)return new Gr.IRI(e.value);throw e instanceof Ci.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return n.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,Ow.v4)().replace(/-/g,"").substring(0,12)}`;return new Ci.BlankNode(t)}if(e instanceof xt.Literal)return new Ci.BlankNode(e.value);if(e instanceof Ci.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 xt.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 Gr.IRI)i=t;else if(t instanceof xt.Literal)i=new Gr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new xt.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 xt.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 xt.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 xt.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 xt.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 xt.Literal)s=t.value;else if(typeof t=="string")s=t;else throw new Error("STRLANGDIR: language tag must be a string literal");if(s==="")throw new Error("STRLANGDIR: language tag cannot be empty");let o;if(r instanceof xt.Literal)o=r.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(o!=="ltr"&&o!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${o}'. Must be 'ltr' or 'rtl'`);return new xt.Literal(i,void 0,s,o)}static uuid(){let e=(0,Ow.v4)();return new Gr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,Ow.v4)();return new xt.Literal(e)}static triple(e,t,r){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(r===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof xt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Gr.IRI)){let c=t instanceof xt.Literal?"Literal":t instanceof Ci.BlankNode?"BlankNode":t instanceof xl.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,o=r;return new xl.QuotedTriple(i,s,o)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof xl.QuotedTriple)){let t=e instanceof Gr.IRI?"IRI":e instanceof xt.Literal?"Literal":e instanceof Ci.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 xl.QuotedTriple)){let t=e instanceof Gr.IRI?"IRI":e instanceof xt.Literal?"Literal":e instanceof Ci.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 xl.QuotedTriple)){let t=e instanceof Gr.IRI?"IRI":e instanceof xt.Literal?"Literal":e instanceof Ci.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};Im.RDFTermFunctions=Pw});var AC=w(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});xm.HashFunctions=void 0;var Fw=class{static{a(this,"HashFunctions")}static md5(e){return require("crypto").createHash("md5").update(e).digest("hex")}static sha1(e){return require("crypto").createHash("sha1").update(e).digest("hex")}static sha256(e){return require("crypto").createHash("sha256").update(e).digest("hex")}static sha384(e){return require("crypto").createHash("sha384").update(e).digest("hex")}static sha512(e){return require("crypto").createHash("sha512").update(e).digest("hex")}};xm.HashFunctions=Fw});var Cm=w(Rm=>{"use strict";Object.defineProperty(Rm,"__esModule",{value:!0});Rm.BuiltInFunctions=void 0;var br=_C(),aa=SC(),Ce=Em(),Rl=EC(),Ft=TC(),Uf=AC(),Dw=class{static{a(this,"BuiltInFunctions")}static str(...e){return br.StringFunctions.str(...e)}static lang(...e){return br.StringFunctions.lang(...e)}static langdir(...e){return br.StringFunctions.langdir(...e)}static langMatches(...e){return br.StringFunctions.langMatches(...e)}static regex(...e){return br.StringFunctions.regex(...e)}static contains(...e){return br.StringFunctions.contains(...e)}static strStarts(...e){return br.StringFunctions.strStarts(...e)}static strEnds(...e){return br.StringFunctions.strEnds(...e)}static strlen(...e){return br.StringFunctions.strlen(...e)}static ucase(...e){return br.StringFunctions.ucase(...e)}static lcase(...e){return br.StringFunctions.lcase(...e)}static substr(...e){return br.StringFunctions.substr(...e)}static strBefore(...e){return br.StringFunctions.strBefore(...e)}static strAfter(...e){return br.StringFunctions.strAfter(...e)}static concat(...e){return br.StringFunctions.concat(...e)}static replace(...e){return br.StringFunctions.replace(...e)}static encodeForUri(...e){return br.StringFunctions.encodeForUri(...e)}static normalize(...e){return br.StringFunctions.normalize(...e)}static fold(...e){return br.StringFunctions.fold(...e)}static abs(...e){return aa.MathFunctions.abs(...e)}static round(...e){return aa.MathFunctions.round(...e)}static ceil(...e){return aa.MathFunctions.ceil(...e)}static floor(...e){return aa.MathFunctions.floor(...e)}static rand(){return aa.MathFunctions.rand()}static msToMinutes(...e){return aa.MathFunctions.msToMinutes(...e)}static msToHours(...e){return aa.MathFunctions.msToHours(...e)}static msToSeconds(...e){return aa.MathFunctions.msToSeconds(...e)}static parseDate(...e){return Ce.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return Ce.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return Ce.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return Ce.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return Ce.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return Ce.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return Ce.DateTimeFunctions.year(...e)}static month(...e){return Ce.DateTimeFunctions.month(...e)}static day(...e){return Ce.DateTimeFunctions.day(...e)}static hours(...e){return Ce.DateTimeFunctions.hours(...e)}static minutes(...e){return Ce.DateTimeFunctions.minutes(...e)}static seconds(...e){return Ce.DateTimeFunctions.seconds(...e)}static timezone(...e){return Ce.DateTimeFunctions.timezone(...e)}static tz(...e){return Ce.DateTimeFunctions.tz(...e)}static now(){return Ce.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return Ce.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return Ce.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return Ce.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return Ce.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return Ce.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return Ce.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return Ce.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return Ce.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return Ce.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return Ce.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return Ce.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return Ce.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return Ce.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return Ce.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return Ce.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return Ce.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return Ce.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return Ce.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return Ce.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return Ce.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return Ce.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return Ce.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return Ce.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return Ce.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return Ce.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return Ce.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return Ce.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return Ce.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return Ce.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return Ce.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return Ce.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return Ce.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return Ce.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return Ce.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return Ce.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return Ce.DateTimeFunctions.adjust(...e)}static isTime(...e){return Ce.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return Ce.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Rl.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Rl.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Rl.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Rl.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Rl.LogicalFunctions.coalesce(...e)}static if(...e){return Rl.LogicalFunctions.if(...e)}static datatype(...e){return Ft.RDFTermFunctions.datatype(...e)}static bound(...e){return Ft.RDFTermFunctions.bound(...e)}static isIRI(...e){return Ft.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return Ft.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return Ft.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return Ft.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return Ft.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return Ft.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return Ft.RDFTermFunctions.sameTerm(...e)}static iri(...e){return Ft.RDFTermFunctions.iri(...e)}static uri(...e){return Ft.RDFTermFunctions.uri(...e)}static bnode(...e){return Ft.RDFTermFunctions.bnode(...e)}static strdt(...e){return Ft.RDFTermFunctions.strdt(...e)}static strlang(...e){return Ft.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return Ft.RDFTermFunctions.strlangdir(...e)}static uuid(){return Ft.RDFTermFunctions.uuid()}static struuid(){return Ft.RDFTermFunctions.struuid()}static xsdDateTime(...e){return Ft.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return Ft.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return Ft.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return Ft.RDFTermFunctions.triple(...e)}static subject(...e){return Ft.RDFTermFunctions.subject(...e)}static predicate(...e){return Ft.RDFTermFunctions.predicate(...e)}static object(...e){return Ft.RDFTermFunctions.object(...e)}static md5(...e){return Uf.HashFunctions.md5(...e)}static sha1(...e){return Uf.HashFunctions.sha1(...e)}static sha256(...e){return Uf.HashFunctions.sha256(...e)}static sha384(...e){return Uf.HashFunctions.sha384(...e)}static sha512(...e){return Uf.HashFunctions.sha512(...e)}};Rm.BuiltInFunctions=Dw});var Bf=w(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.ExoQLBudgetExceededError=Ss.ExoQLCycleError=Ss.ExoQLEvalDisabledError=Ss.ExoQLForbiddenKeywordError=void 0;var Lw=class extends Error{static{a(this,"ExoQLForbiddenKeywordError")}constructor(e,t){super(t??`ExoQLForbiddenKeywordError: keyword "${e}" is not permitted by the exoql__Query AST allowlist`),this.name="ExoQLForbiddenKeywordError",this.keyword=e}};Ss.ExoQLForbiddenKeywordError=Lw;var Nw=class extends Error{static{a(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};Ss.ExoQLEvalDisabledError=Nw;var kw=class extends Error{static{a(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};Ss.ExoQLCycleError=kw;var Mw=class extends Error{static{a(this,"ExoQLBudgetExceededError")}constructor(e,t,r,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${r})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=r}};Ss.ExoQLBudgetExceededError=Mw});var LC=w(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.functionHandlers=void 0;var z=Cm();K.functionHandlers=new Map;K.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.str(t)});K.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.lang(t)});K.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 z.BuiltInFunctions.langMatches(t,r)});K.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 z.BuiltInFunctions.contains(t,r)});K.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 z.BuiltInFunctions.strStarts(t,r)});K.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 z.BuiltInFunctions.strEnds(t,r)});K.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.strlen(t)});K.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.ucase(t)});K.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.lcase(t)});K.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 z.BuiltInFunctions.substr(t,r,i)}return z.BuiltInFunctions.substr(t,r)});K.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 z.BuiltInFunctions.strBefore(t,r)});K.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 z.BuiltInFunctions.strAfter(t,r)});K.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return z.BuiltInFunctions.concat(...t)});K.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 z.BuiltInFunctions.replace(t,r,i,s)});K.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 z.BuiltInFunctions.regex(t,r,i)});K.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.encodeForUri(t)});K.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.datatype(t).value});K.functionHandlers.set("bound",(n,e)=>{let t=n[0];if(t.type==="variable"&&t.name){let r=e.solution.get(t.name);return z.BuiltInFunctions.bound(r)}return!0});var IC=a((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isIRI(t)},"isIriHandler");K.functionHandlers.set("isiri",IC);K.functionHandlers.set("isuri",IC);K.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isBlank(t)});K.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isLiteral(t)});K.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isNumeric(t)});K.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.hasLangdir(t)});K.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.isTriple(t)});K.functionHandlers.set("sameterm",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution);return z.BuiltInFunctions.sameTerm(t,r)});K.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return z.BuiltInFunctions.abs(t)});K.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return z.BuiltInFunctions.round(t)});K.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return z.BuiltInFunctions.ceil(t)});K.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return z.BuiltInFunctions.floor(t)});K.functionHandlers.set("rand",()=>z.BuiltInFunctions.rand());K.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.parseDate(t)});K.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 z.BuiltInFunctions.dateBefore(t,r)});K.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 z.BuiltInFunctions.dateAfter(t,r)});K.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 z.BuiltInFunctions.dateInRange(t,r,i)});K.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 z.BuiltInFunctions.dateDiffMinutes(t,r)});K.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 z.BuiltInFunctions.dateDiffHours(t,r)});var Cl=a((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"),xC=Cl(z.BuiltInFunctions.year.bind(z.BuiltInFunctions),z.BuiltInFunctions.durationYears.bind(z.BuiltInFunctions),null);K.functionHandlers.set("year",xC);K.functionHandlers.set("years",xC);var RC=Cl(z.BuiltInFunctions.month.bind(z.BuiltInFunctions),z.BuiltInFunctions.durationMonths.bind(z.BuiltInFunctions),null);K.functionHandlers.set("month",RC);K.functionHandlers.set("months",RC);var CC=Cl(z.BuiltInFunctions.day.bind(z.BuiltInFunctions),null,z.BuiltInFunctions.durationDays.bind(z.BuiltInFunctions));K.functionHandlers.set("day",CC);K.functionHandlers.set("days",CC);K.functionHandlers.set("hours",Cl(z.BuiltInFunctions.hours.bind(z.BuiltInFunctions),null,z.BuiltInFunctions.durationHours.bind(z.BuiltInFunctions)));K.functionHandlers.set("minutes",Cl(z.BuiltInFunctions.minutes.bind(z.BuiltInFunctions),null,z.BuiltInFunctions.durationMinutes.bind(z.BuiltInFunctions)));K.functionHandlers.set("seconds",Cl(z.BuiltInFunctions.seconds.bind(z.BuiltInFunctions),null,z.BuiltInFunctions.durationSeconds.bind(z.BuiltInFunctions)));K.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.timezone(t)});K.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.tz(t)});K.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 z.BuiltInFunctions.adjust(t,r)});K.functionHandlers.set("now",()=>z.BuiltInFunctions.now());var OC=a((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");K.functionHandlers.set("datetime",OC);K.functionHandlers.set("xsd:datetime",OC);var PC=a((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");K.functionHandlers.set("integer",PC);K.functionHandlers.set("xsd:integer",PC);var FC=a((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");K.functionHandlers.set("decimal",FC);K.functionHandlers.set("xsd:decimal",FC);var DC=a((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");K.functionHandlers.set("daytimeduration",DC);K.functionHandlers.set("xsd:daytimeduration",DC);K.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationToDays(t)});K.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationToHours(t)});K.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationToMinutes(t)});K.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationToSeconds(t)});K.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationDays(t)});K.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationHours(t)});K.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationMinutes(t)});K.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationSeconds(t)});K.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationYears(t)});K.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return z.BuiltInFunctions.durationMonths(t)});K.functionHandlers.set("datetimediff",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return z.BuiltInFunctions.dateTimeDiff(t,r)});K.functionHandlers.set("datetimeadd",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return z.BuiltInFunctions.dateTimeAdd(t,r)});K.functionHandlers.set("datetimesubtract",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return z.BuiltInFunctions.dateTimeSubtract(t,r)});K.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.msToMinutes(t)});K.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.msToHours(t)});K.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.msToSeconds(t)});K.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.md5(t)});K.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.sha1(t)});K.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.sha256(t)});K.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.sha384(t)});K.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return z.BuiltInFunctions.sha512(t)});K.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.subject(t)});K.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.predicate(t)});K.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return z.BuiltInFunctions.object(t)});K.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 z.BuiltInFunctions.triple(t,r,i)});K.functionHandlers.set("days_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(1440*60*1e3))});K.functionHandlers.set("minutes_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(60*1e3))});K.functionHandlers.set("hours_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return(new Date(r).getTime()-i.getTime())/(3600*1e3)});K.functionHandlers.set("age_days",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t);return Math.floor((new Date().getTime()-r.getTime())/(1440*60*1e3))});K.functionHandlers.set("week_number",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t),i=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()));i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7));let s=new Date(Date.UTC(i.getUTCFullYear(),0,1));return Math.ceil(((i.getTime()-s.getTime())/(1440*60*1e3)+1)/7)});K.functionHandlers.set("format_date",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return r.replace("YYYY",String(i.getFullYear())).replace("MM",String(i.getMonth()+1).padStart(2,"0")).replace("DD",String(i.getDate()).padStart(2,"0")).replace("HH",String(i.getHours()).padStart(2,"0")).replace("mm",String(i.getMinutes()).padStart(2,"0")).replace("ss",String(i.getSeconds()).padStart(2,"0"))});K.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:n}=Bf();throw new n})});var Om=w(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.FilterExecutor=Ol.FilterExecutorError=void 0;var Et=Cm(),PU=LC(),jw=Pe(),ws=Ge(),Ar=class extends Error{static{a(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Ol.FilterExecutorError=Ar;var $w=class{static{a(this,"FilterExecutor")}constructor(){this.existsEvaluator=null,this.tripleStore=null,this.uuidCache=new Map}setExistsEvaluator(e){this.existsEvaluator=e}setTripleStore(e){this.tripleStore=e,this.uuidCache.clear()}async*execute(e,t){let r=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;r?s=await this.evaluateExpressionAsync(e.expression,i):s=this.evaluateExpression(e.expression,i),s===!0&&(yield i)}catch{continue}}expressionContainsExists(e){if(!e||typeof e!="object")return!1;if(e.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="arithmetic"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(r=>this.expressionContainsExists(r))}if(e.type==="function"||e.type==="functionCall"){let t=e;return Array.isArray(t.args)?t.args.some(r=>this.expressionContainsExists(r)):!1}return!1}async executeAll(e,t){let r=[];async function*i(){for(let s of t)yield s}a(i,"generator");for await(let s of this.execute(e,i()))r.push(s);return r}evaluateExpression(e,t){let r=e;if("termType"in e)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":{let i=r.value,s=r.datatype,o=typeof s=="string"?s:s?.value;return o&&i.length>0&&this.shouldPreserveDatatype(o)?new ws.Literal(i,new jw.IRI(o)):i}case"NamedNode":return r.value;default:throw new Ar(`Unsupported termType: ${String(r.termType)}`)}switch(e.type){case"comparison":return this.evaluateComparison(e,t);case"logical":return this.evaluateLogical(e,t);case"arithmetic":return this.evaluateArithmetic(e,t);case"function":case"functionCall":return this.evaluateFunction(e,t);case"variable":return t.get(e.name);case"literal":{let i=e;return i.datatype&&i.value.length>0&&this.shouldPreserveDatatype(i.datatype)?new ws.Literal(i.value,new jw.IRI(i.datatype)):i.value}case"in":return this.evaluateIn(e,t);case"exists":throw new Ar("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new Ar(`Unsupported expression type: ${e.type}`)}}async evaluateExpressionAsync(e,t){if(!this.expressionContainsExists(e))return this.evaluateExpression(e,t);if(e.type==="exists")return this.evaluateExists(e,t);if(e.type==="logical")return this.evaluateLogicalAsync(e,t);if(e.type==="comparison"){let r=e,i=await this.evaluateExpressionAsync(r.left,t),s=await this.evaluateExpressionAsync(r.right,t);return Et.BuiltInFunctions.compare(i,s,r.operator)}return e.type==="in"?this.evaluateInAsync(e,t):e.type==="function"||e.type==="functionCall"?this.evaluateFunctionAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new Ar("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 Et.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 Et.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return Et.BuiltInFunctions.logicalOr(r);throw new Ar(`Unknown logical operator: ${String(e.operator)}`)}async evaluateInAsync(e,t){let r=await this.evaluateExpressionAsync(e.expression,t),i=!1;for(let s of e.list){let o=await this.evaluateExpressionAsync(s,t);if(Et.BuiltInFunctions.compare(r,o,"=")){i=!0;break}}return e.negated?!i:i}async evaluateFunctionAsync(e,t){let r=e,i=this.extractFunctionName(r.function),s=r.args??[];if(i==="if"){if(s.length!==3)throw new Ar("IF requires exactly 3 arguments");let l=await this.evaluateExpressionAsync(s[0],t);return this.toBoolean(l)?this.evaluateExpressionAsync(s[1],t):this.evaluateExpressionAsync(s[2],t)}if(i==="coalesce"){for(let l of s)try{let u=await this.evaluateExpressionAsync(l,t);if(u!=null)return u}catch{continue}return}let o=[];for(let l of s){let u=await this.evaluateExpressionAsync(l,t);o.push(this.wrapAsLiteralExpression(u))}let c={...r,args:o};return this.evaluateFunction(c,t)}wrapAsLiteralExpression(e){return e==null?{type:"literal",value:""}:typeof e=="object"&&"termType"in e?e:e instanceof jw.IRI||e instanceof ws.Literal?{type:"literal",value:e.value}:typeof e=="number"||typeof e=="boolean"||typeof e=="string"?{type:"literal",value:e}:{type:"literal",value:String(e)}}evaluateComparison(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return Et.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return Et.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return Et.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return Et.BuiltInFunctions.logicalOr(r);throw new Ar(`Unknown logical operator: ${String(e.operator)}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let o=this.evaluateExpression(s,t);return Et.BuiltInFunctions.compare(r,o,"=")});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 Et.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return Et.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return Et.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return Et.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return Et.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return Et.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new Ar("Division by zero");return Et.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return Et.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),o=this.toNumericValue(i);switch(e.operator){case"+":return s+o;case"-":return s-o;case"*":return s*o;case"/":if(o===0)throw new Ar("Division by zero");return s/o;default:throw new Ar(`Unknown arithmetic operator: ${String(e.operator)}`)}}shouldPreserveDatatype(e){return e==="http://www.w3.org/2001/XMLSchema#dateTime"||e==="http://www.w3.org/2001/XMLSchema#date"||e==="http://www.w3.org/2001/XMLSchema#time"||e==="http://www.w3.org/2001/XMLSchema#dayTimeDuration"||e==="http://www.w3.org/2001/XMLSchema#yearMonthDuration"||e==="http://www.w3.org/2001/XMLSchema#duration"}isDayTimeDurationValue(e){return e instanceof ws.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof ws.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof ws.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 Ar(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof ws.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 ws.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof ws.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 o=PU.functionHandlers.get(i);if(!o)throw new Ar(`Unknown function: ${i}`);let c={evaluateExpression:a((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:a((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:a(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:a(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:a(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return o(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 Ar(`Unknown function format: ${String(e)}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let i of t)try{let s=this.evaluateExpression(i,r);if(s!=null)return{value:s}}catch{continue}return{value:void 0};case"if":{if(!t||t.length!==3)throw new Ar("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],r);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],r):this.evaluateExpression(t[2],r)}}case"byuuid":return{value:this.evaluateByUUID({type:"function",function:"byuuid",args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof ws.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 Ar("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 o=this.tripleStore.findSubjectsByUUIDSync(s);if(o.length===0){this.uuidCache.set(s,null);return}let c=o[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let r=e.toLowerCase();this.uuidCache.set(r,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Ol.FilterExecutor=$w});var Bw=w(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.OptionalExecutor=void 0;var Uw=class{static{a(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 o="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,o),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,o),f=c.get(u),d=!1;if(f)for(let h of f){let p=l.merge(h);p!==null&&(yield p,d=!0)}d||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let o=e.get(s);i.push(o!==void 0?o.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let o=r.merge(s);o!==null&&(yield o,i=!0)}i||(yield r)}}};Pm.OptionalExecutor=Uw});var qw=w(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.UnionExecutor=void 0;var Vw=class{static{a(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 o of e)yield o}a(i,"generateLeft");async function*s(){for(let o of t)yield o}a(s,"generateRight");for await(let o of this.execute(i(),s()))r.push(o);return r}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};Fm.UnionExecutor=Vw});var NC=w(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.MinusExecutor=void 0;var Gw=class{static{a(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 o=!1;for(let c of i)if(this.areCompatible(s,c)){o=!0;break}o||(yield s)}}async executeAll(e,t){let r=[];async function*i(){for(let o of e)yield o}a(i,"generateLeft");async function*s(){for(let o of t)yield o}a(s,"generateRight");for await(let o of this.execute(i(),s()))r.push(o);return r}areCompatible(e,t){let r=e.variables(),i=new Set(t.variables()),s=r.filter(o=>i.has(o));if(s.length===0)return!1;for(let o of s){let c=e.get(o),l=t.get(o);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};Dm.MinusExecutor=Gw});var MC=w(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.ValuesExecutor=Pl.ValuesExecutorError=void 0;var FU=_s(),kC=Pe(),DU=Ge(),Lm=class extends Error{static{a(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Pl.ValuesExecutorError=Lm;var Ww=class{static{a(this,"ValuesExecutor")}async*execute(e){if(e.bindings.length!==0)for(let t of e.bindings)yield this.createSolutionMapping(t)}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}createSolutionMapping(e){let t=new FU.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 kC.IRI(e.value);if(e.type==="literal")return new DU.Literal(e.value,e.datatype?new kC.IRI(e.datatype):void 0,e.language,e.direction);throw new Lm(`Unknown term type: ${e.type}`)}};Pl.ValuesExecutor=Ww});var Hw=w(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.CustomAggregateRegistry=Dl.CustomAggregateError=void 0;var Fl=class extends Error{static{a(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Dl.CustomAggregateError=Fl;var Nm=class n{static{a(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 Fl("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new Fl("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new Fl(`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}};Dl.CustomAggregateRegistry=Nm;Nm.instance=null});var zw=w(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.BUILT_IN_AGGREGATES=st.modeAggregate=st.stddevAggregate=st.varianceAggregate=st.medianAggregate=st.EXO_AGGREGATE_NS=void 0;st.getNumericValue=km;st.createDecimalLiteral=Oi;st.createDoubleLiteral=kU;st.createPercentileAggregate=oc;var ac=Ge(),Ll=Pe(),LU=new Ll.IRI("http://www.w3.org/2001/XMLSchema#decimal"),NU=new Ll.IRI("http://www.w3.org/2001/XMLSchema#double");st.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function km(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof ac.Literal?parseFloat(n.value):n instanceof Ll.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}a(km,"getNumericValue");function Oi(n){return new ac.Literal(String(n),LU)}a(Oi,"createDecimalLiteral");function kU(n){return new ac.Literal(String(n),NU)}a(kU,"createDoubleLiteral");st.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=km(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return Oi(0);let r=[...t].sort((o,c)=>o-c),i=Math.floor(r.length/2),s=r.length%2!==0?r[i]:(r[i-1]+r[i])/2;return Oi(s)}};st.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=km(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return Oi(0);let r=t.reduce((s,o)=>s+o,0)/t.length,i=t.reduce((s,o)=>s+Math.pow(o-r,2),0)/t.length;return Oi(i)}};st.stddevAggregate={init(){return{values:[]}},step(n,e){st.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return Oi(0);let r=t.reduce((s,o)=>s+o,0)/t.length,i=t.reduce((s,o)=>s+Math.pow(o-r,2),0)/t.length;return Oi(Math.sqrt(i))}};st.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof ac.Literal||e instanceof Ll.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 ac.Literal(" ",new Ll.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",r=0;for(let[o,c]of e.counts)c>r&&(r=c,t=o);let i=e.values.get(t);if(i instanceof ac.Literal)return i;let s=parseFloat(t);return isNaN(s)?new ac.Literal(t,new Ll.IRI("http://www.w3.org/2001/XMLSchema#string")):Oi(s)}};function oc(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=km(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return Oi(0);let s=[...i].sort((d,h)=>d-h),o=r.percentile*(s.length-1),c=Math.floor(o),l=Math.ceil(o);if(c===l)return Oi(s[c]);let u=o-c,f=s[c]*(1-u)+s[l]*u;return Oi(f)}}}a(oc,"createPercentileAggregate");st.BUILT_IN_AGGREGATES={[`${st.EXO_AGGREGATE_NS}median`]:st.medianAggregate,[`${st.EXO_AGGREGATE_NS}variance`]:st.varianceAggregate,[`${st.EXO_AGGREGATE_NS}stddev`]:st.stddevAggregate,[`${st.EXO_AGGREGATE_NS}mode`]:st.modeAggregate,[`${st.EXO_AGGREGATE_NS}percentile25`]:oc(25),[`${st.EXO_AGGREGATE_NS}percentile50`]:oc(50),[`${st.EXO_AGGREGATE_NS}percentile75`]:oc(75),[`${st.EXO_AGGREGATE_NS}percentile90`]:oc(90),[`${st.EXO_AGGREGATE_NS}percentile95`]:oc(95),[`${st.EXO_AGGREGATE_NS}percentile99`]:oc(99)}});var UC=w(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.AggregateExecutor=Nl.AggregateExecutorError=void 0;var _r=Ge(),Yw=Pe(),MU=Om(),jU=Hw(),$U=zw(),jC=new Yw.IRI("http://www.w3.org/2001/XMLSchema#integer"),cc=new Yw.IRI("http://www.w3.org/2001/XMLSchema#decimal"),vs=new Yw.IRI("http://www.w3.org/2001/XMLSchema#string");function $C(n){return typeof n=="object"&&n.type==="custom"}a($C,"isCustomAggregation");var Vf=class extends Error{static{a(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Nl.AggregateExecutorError=Vf;var Kw=class{static{a(this,"AggregateExecutor")}constructor(){this.filterExecutor=new MU.FilterExecutor}execute(e,t){let r=this.groupSolutions(t,e.variables),i=[];for(let[s,o]of r.entries()){let c=new Map;for(let f of e.variables)if(o.length>0){let d=o[0].get(f);d&&c.set(f,d)}for(let f of e.aggregates){let d=this.computeAggregate(f.expression,o);c.set(f.variable,d)}let{SolutionMapping:l}=_s(),u=new l;for(let[f,d]of c.entries())u.set(f,d);i.push(u)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let r=new Map;if(t.length===0)return r.set("",e),r;for(let i of e){let s=this.computeGroupKey(i,t),o=r.get(s);o?o.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($C(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 _r.Literal(String(s),jC)}case"sum":{let s=this.computeSum(r);return new _r.Literal(String(s),cc)}case"avg":{let s=this.computeAvg(r);return new _r.Literal(String(s),cc)}case"min":{let s=this.computeMin(r);return s===void 0?new _r.Literal("",vs):typeof s=="number"?new _r.Literal(String(s),cc):new _r.Literal(String(s),vs)}case"max":{let s=this.computeMax(r);return s===void 0?new _r.Literal("",vs):typeof s=="number"?new _r.Literal(String(s),cc):new _r.Literal(String(s),vs)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new _r.Literal(s||" ",vs)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new _r.Literal(" ",vs):typeof s=="number"?new _r.Literal(String(s),cc):new _r.Literal(String(s),vs)}default:{let s=i;throw new Vf(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,o=jU.CustomAggregateRegistry.getInstance().get(i);if(o||(o=$U.BUILT_IN_AGGREGATES[i]),!o)throw new Vf(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=o.init();for(let l of t){let u=null;if(e.expression){let f=this.evaluateExpression(e.expression,l);f!==void 0&&(u=f)}else u=1;o.step(c,u)}return o.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 o=s[0],c=parseFloat(o);return isNaN(c)?o: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}=_s(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if($C(s)){r.set(i.variable,new _r.Literal("0",cc));continue}switch(s){case"count":r.set(i.variable,new _r.Literal("0",jC));break;case"sum":case"avg":r.set(i.variable,new _r.Literal("0",cc));break;case"group_concat":r.set(i.variable,new _r.Literal(" ",vs));break;case"min":case"max":case"sample":r.set(i.variable,new _r.Literal("",vs));break;default:r.set(i.variable,new _r.Literal("",vs))}}return r}};Nl.AggregateExecutor=Kw});var Zw=w(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});Mm.ConstructExecutor=void 0;var UU=Xn(),lc=Pe(),Qw=Ge(),Xw=jt(),BU=gf(),Jw=class{static{a(this,"ConstructExecutor")}async execute(e,t){let r=[],i=new Set;for(let s of t)for(let o of e)try{let c=this.instantiateTriple(o,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),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 UU.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 lc.IRI(e.value);if(e.type==="literal")return new Qw.Literal(e.value,e.datatype?new lc.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new Xw.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 BU.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 Qw.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new lc.IRI(e.value);if(e.type==="blank")return new Xw.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 lc.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new lc.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 lc.IRI(e.value);if(e.type==="blank")return new Xw.BlankNode(e.value);if(e.type==="literal")return new Qw.Literal(e.value,e.datatype?new lc.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}`)}};Mm.ConstructExecutor=Jw});var VC=w(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.ServiceExecutor=kl.ServiceExecutorError=void 0;var VU=_s(),BC=Pe(),qU=Ge(),GU=jt(),uc=class extends Error{static{a(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};kl.ServiceExecutorError=uc;var e1=class{static{a(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,o=setTimeout(()=>s.abort(),this.timeout);try{let c=await this.httpClient(e,{method:"POST",headers:{"Content-Type":"application/sparql-query",Accept:"application/sparql-results+json"},body:t,signal:s.signal});if(!c.ok)throw new uc(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(o)}}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 uc(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new uc(`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 VU.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 BC.IRI(e.value);case"literal":{let t=e.datatype?new BC.IRI(e.datatype):void 0;return new qU.Literal(e.value,t,e["xml:lang"])}case"bnode":return new GU.BlankNode(e.value);default:throw new uc(`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))}};kl.ServiceExecutor=e1});var GC=w(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.GraphExecutor=Ml.GraphExecutorError=void 0;var qC=Pe(),jm=class extends Error{static{a(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};Ml.GraphExecutorError=jm;var t1=class{static{a(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 jm(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new qC.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*r(e,i))}async*executeWithGraphVariable(e,t,r,i){if(i){let o=i.get(t.value);if(o&&o instanceof qC.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:o.value},r);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let o of s)for await(let c of r(e.pattern,o)){let l=c.clone();l.set(t.value,o),yield l}}};Ml.GraphExecutor=t1});var WC=w($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.SPARQLGenerator=$l.SPARQLGeneratorError=void 0;var jl=class extends Error{static{a(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};$l.SPARQLGeneratorError=jl;var r1=class{static{a(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
49
49
|
${i}
|
|
50
50
|
}`}generateWhereClause(e,t=2){let r=" ".repeat(t);switch(e.type){case"bgp":return this.generateBGP(e,t);case"filter":return`${this.generateWhereClause(e.input,t)}
|
|
51
51
|
${r}FILTER(${this.generateExpression(e.expression)})`;case"join":return`${this.generateWhereClause(e.left,t)}
|
|
@@ -67,7 +67,7 @@ ${r}}`}default:throw new jl(`Unsupported operation type for SPARQL generation: $
|
|
|
67
67
|
`)}generateTriple(e){let t=this.generateElement(e.subject),r=this.generatePredicate(e.predicate),i=this.generateElement(e.object);return`${t} ${r} ${i}`}generatePredicate(e){return"pathType"in e?this.generatePropertyPath(e):this.generateElement(e)}generatePropertyPath(e){let t=e.items.map(r=>"pathType"in r?`(${this.generatePropertyPath(r)})`:`<${r.value}>`);switch(e.pathType){case"/":return t.join("/");case"|":return t.join("|");case"^":return`^${t[0]}`;case"+":return`${t[0]}+`;case"*":return`${t[0]}*`;case"?":return`${t[0]}?`}}generateElement(e){switch(e.type){case"variable":return`?${e.value}`;case"iri":return`<${e.value}>`;case"literal":{let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}case"blank":return`_:${e.value}`;default:throw new jl(`Unknown element type: ${e.type}`)}}generateValues(e,t){let r=" ".repeat(t);if(e.variables.length===0||e.bindings.length===0)return"";if(e.variables.length===1){let o=e.variables[0],c=e.bindings.map(l=>{let u=l[o];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ");return`${r}VALUES ?${o} { ${c} }`}let i=e.variables.map(o=>`?${o}`).join(" "),s=e.bindings.map(o=>`(${e.variables.map(l=>{let u=o[l];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ")})`);return`${r}VALUES (${i}) {
|
|
68
68
|
${s.map(o=>`${r} ${o}`).join(`
|
|
69
69
|
`)}
|
|
70
|
-
${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}generateExpression(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:typeof e.value=="boolean"?e.value?"true":"false":String(e.value);case"comparison":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"logical":return e.operator==="!"?`!(${this.generateExpression(e.operands[0])})`:`(${e.operands.map(t=>this.generateExpression(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"function":return`${e.function.toUpperCase()}(${e.args.map(t=>this.generateExpression(t)).join(", ")})`;case"functionCall":return`${(typeof e.function=="string"?e.function:e.function.value).toUpperCase()}(${e.args.map(r=>this.generateExpression(r)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),r=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${r})`:`${t} IN (${r})`}default:throw new jl(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let r of e.triples)this.collectVariablesFromTriple(r,t);break;case"filter":this.collectVariablesFromOperation(e.input,t),this.collectVariablesFromExpression(e.expression,t);break;case"join":case"leftjoin":case"union":case"minus":this.collectVariablesFromOperation(e.left,t),this.collectVariablesFromOperation(e.right,t);break;case"values":for(let r of e.variables)t.add(r);break;case"project":for(let r of e.variables)t.add(r);this.collectVariablesFromOperation(e.input,t);break;case"extend":t.add(e.variable),this.collectVariablesFromOperation(e.input,t);break;case"orderby":case"slice":case"distinct":case"reduced":this.collectVariablesFromOperation(e.input,t);break;case"group":for(let r of e.variables)t.add(r);for(let r of e.aggregates)t.add(r.variable);this.collectVariablesFromOperation(e.input,t);break;case"subquery":this.collectVariablesFromOperation(e.query,t);break}}collectVariablesFromTriple(e,t){e.subject.type==="variable"&&t.add(e.subject.value),"type"in e.predicate&&e.predicate.type==="variable"&&t.add(e.predicate.value),e.object.type==="variable"&&t.add(e.object.value)}collectVariablesFromExpression(e,t){switch(e.type){case"variable":t.add(e.name);break;case"comparison":case"arithmetic":this.collectVariablesFromExpression(e.left,t),this.collectVariablesFromExpression(e.right,t);break;case"logical":for(let r of e.operands)this.collectVariablesFromExpression(r,t);break;case"function":case"functionCall":for(let r of e.args)this.collectVariablesFromExpression(r,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let r of e.list)this.collectVariablesFromExpression(r,t);break}}};$l.SPARQLGenerator=r1});var Bl=w(Mn=>{"use strict";var WU=Mn&&Mn.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),HU=Mn&&Mn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),HC=Mn&&Mn.__importStar||(function(){var n=a(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"&&WU(t,e,r[i]);return HU(t,e),t}})();Object.defineProperty(Mn,"__esModule",{value:!0});Mn.QueryExecutor=Mn.ExoQLQueryExecutor=Mn.QueryExecutorError=void 0;var zU=vw(),KU=Om(),YU=Bw(),QU=qw(),XU=NC(),JU=MC(),ZU=UC(),e8=Zw(),t8=VC(),r8=GC(),n8=WC(),i8=Pe(),s8=Ge(),o8=Em(),Wr="http://www.w3.org/2001/XMLSchema#",a8=new Set([`${Wr}integer`,`${Wr}decimal`,`${Wr}float`,`${Wr}double`,`${Wr}nonPositiveInteger`,`${Wr}negativeInteger`,`${Wr}long`,`${Wr}int`,`${Wr}short`,`${Wr}byte`,`${Wr}nonNegativeInteger`,`${Wr}unsignedLong`,`${Wr}unsignedInt`,`${Wr}unsignedShort`,`${Wr}unsignedByte`,`${Wr}positiveInteger`]),Ul=class extends Error{static{a(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};Mn.QueryExecutorError=Ul;var $m=class{static{a(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new zU.BGPExecutor(e),this.filterExecutor=new KU.FilterExecutor,this.optionalExecutor=new YU.OptionalExecutor,this.unionExecutor=new QU.UnionExecutor,this.minusExecutor=new XU.MinusExecutor,this.valuesExecutor=new JU.ValuesExecutor,this.aggregateExecutor=new ZU.AggregateExecutor,this.constructExecutor=new e8.ConstructExecutor,this.serviceExecutor=new t8.ServiceExecutor(t.serviceConfig),this.graphExecutor=new r8.GraphExecutor(e),this.sparqlGenerator=new n8.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(r,i)=>this.evaluateExistsPattern(r,i)),this.filterExecutor.setTripleStore(e)}async evaluateExistsPattern(e,t){for await(let r of this.execute(e))if(t.merge(r)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*execute(e){switch(e.type){case"bgp":yield*this.executeBGP(e);break;case"filter":yield*this.executeFilter(e);break;case"join":yield*this.executeJoin(e);break;case"leftjoin":yield*this.executeLeftJoin(e);break;case"union":yield*this.executeUnion(e);break;case"minus":yield*this.executeMinus(e);break;case"values":yield*this.executeValues(e);break;case"project":yield*this.executeProject(e);break;case"orderby":yield*this.executeOrderBy(e);break;case"slice":yield*this.executeSlice(e);break;case"distinct":yield*this.executeDistinct(e);break;case"reduced":yield*this.executeReduced(e);break;case"group":yield*this.executeGroup(e);break;case"extend":yield*this.executeExtend(e);break;case"subquery":yield*this.executeSubquery(e);break;case"lateraljoin":yield*this.executeLateralJoin(e);break;case"service":yield*this.executeService(e);break;case"graph":yield*this.executeGraph(e);break;default:throw new Ul(`Unknown operation type: ${e.type}`)}}async*executeBGP(e){yield*this.bgpExecutor.execute(e)}async*executeFilter(e){let t=this.execute(e.input);yield*this.filterExecutor.execute(e,t)}async*executeJoin(e){let t=[];for await(let o of this.execute(e.left))t.push(o);if(t.length===0)return;let r=new Set;for(let o of t)for(let c of o.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(o=>i.has(o)))for(let o of t){let c=this.substituteVariables(e.right,o);for await(let l of this.execute(c)){let u=o.merge(l);u!==null&&(yield u)}}else{let o=[];for await(let c of this.execute(e.right))o.push(c);for(let c of t)for(let l of o){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){let{SolutionMapping:t}=await Promise.resolve().then(()=>HC(_s())),r=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let o of i.variables())if(r.has(o)){let c=i.get(o);c!==void 0&&s.set(o,c)}yield s}}async*executeOrderBy(e){let t=[];for await(let r of this.execute(e.input))t.push(r);t.sort((r,i)=>{for(let s of e.comparators){let o=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(o===void 0&&c===void 0?l=0:o===void 0?l=1:c===void 0?l=-1:typeof o=="number"&&typeof c=="number"?l=o-c:l=String(o).localeCompare(String(c)),s.descending&&(l=-l),l!==0)return l}return 0});for(let r of t)yield r}async*executeSlice(e){let t=0,r=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=r){if(i!==void 0&&t-r>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeReduced(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let r=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of r)e.having.every(o=>this.filterExecutor.evaluateExpression(o,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let r of this.execute(e.input)){let i=r.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,r):this.evaluateExtendExpression(e.expression,r);s!==void 0&&i.set(e.variable,s),yield i}}async*executeSubquery(e){yield*this.execute(e.query)}async*executeLateralJoin(e){let t=[];for await(let r of this.execute(e.left))t.push(r);for(let r of t){let i=this.substituteVariables(e.right,r);for await(let s of this.execute(i)){let o=r.merge(s);o!==null&&(yield o)}}}substituteVariables(e,t){let r=JSON.parse(JSON.stringify(e));return this.substituteInOperation(r,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let r=e;return e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(r.input&&(r.input=this.substituteInOperation(r.input,t)),r.left&&(r.left=this.substituteInOperation(r.left,t)),r.right&&(r.right=this.substituteInOperation(r.right,t)),r.pattern&&(r.pattern=this.substituteInOperation(r.pattern,t)),r.query&&(r.query=this.substituteInOperation(r.query,t)),r.where&&(r.where=this.substituteInOperation(r.where,t)),r.expression&&this.substituteInExpression(r.expression,t),e)}substituteInExpression(e,t){if(!(!e||typeof e!="object")){if(e.type==="exists"&&e.pattern&&(e.pattern=this.substituteInOperation(e.pattern,t)),e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let r of e.operands)this.substituteInExpression(r,t);if(e.args)for(let r of e.args)this.substituteInExpression(r,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let r of e.list)this.substituteInExpression(r,t)}}substituteInTriple(e,t){return{subject:this.substituteInTripleElement(e.subject,t),predicate:e.predicate,object:this.substituteInTripleElement(e.object,t)}}substituteInTripleElement(e,t){if(e&&e.type==="variable"){let r=t.get(e.value);if(r!=null){let i=r;if(r instanceof i8.IRI||i.termType==="NamedNode")return{type:"iri",value:r.value};if(i.termType==="Literal"||typeof i.value=="string")return{type:"literal",value:i.value,datatype:i.datatype?.value??i._datatype?.value,language:i.language??i._language}}}return e}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(r,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{r.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(r,i):yield*this.execute(r)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:r}=await Promise.resolve().then(()=>HC(_s()));yield new r;return}yield*this.bgpExecutor.executeInGraph(e,t)}evaluateExtendExpression(e,t){if(e.type!=="aggregate")try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}async evaluateExtendExpressionAsync(e,t){if(e.type!=="aggregate")try{return await this.filterExecutor.evaluateExpressionAsync(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);if(!r)return;if(r instanceof s8.Literal){let i=r.datatype?.value;if(i===`${Wr}dayTimeDuration`)try{return o8.DateTimeFunctions.parseDayTimeDuration(r.value)}catch{return r.value}if(i&&a8.has(i)){let s=parseFloat(r.value);if(!Number.isNaN(s))return s}return r.value}return r.value??r.id??String(r)}if(e.type==="literal")return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="bgp"&&r.triples)for(let i of r.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(r.type==="values"&&r.variables)for(let i of r.variables)t.add(i);r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.type==="extend"&&r.variable&&t.add(r.variable),r.input&&this.collectVarsFromOperation(r.input,t),r.left&&this.collectVarsFromOperation(r.left,t),r.right&&this.collectVarsFromOperation(r.right,t),r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.query&&this.collectVarsFromOperation(r.query,t),r.where&&this.collectVarsFromOperation(r.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let r=e;r.type==="variable"&&t.add(r.value),r.type==="quoted"&&(this.collectVarsFromElement(r.subject,t),this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="variable"&&r.name&&t.add(r.name),r.type==="exists"&&r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.left&&this.collectVarsFromExpressionTree(r.left,t),r.right&&this.collectVarsFromExpressionTree(r.right,t),r.operands)for(let i of r.operands)this.collectVarsFromExpressionTree(i,t);if(r.args)for(let i of r.args)this.collectVarsFromExpressionTree(i,t);if(r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.list)for(let i of r.list)this.collectVarsFromExpressionTree(i,t)}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}isConstructQuery(e){return e.type==="construct"}async executeConstruct(e){if(e.type!=="construct")throw new Ul("executeConstruct requires a CONSTRUCT operation");let t=await this.executeAll(e.where);return this.constructExecutor.execute(e.template,t)}isAskQuery(e){return e.type==="ask"}async executeAsk(e){if(e.type!=="ask")throw new Ul("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};Mn.ExoQLQueryExecutor=$m;Mn.QueryExecutor=$m});var eO=w(uo=>{"use strict";var c8=uo&&uo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},l8=uo&&uo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},n1;Object.defineProperty(uo,"__esModule",{value:!0});uo.CommandResolver=void 0;var u8=Ve(),f8=ol(),Zt=Pe(),Ut=Ge(),W=zt(),zC=Yo(),KC=pf(),d8=cl(),h8=Up(),Vl=g_(),Um=BR(),p8=bl(),m8=Sl(),g8=Bl(),qf=10,Bm="exo__Asset",y8=qf+1,YC="08cec529-90eb-4d43-88de-ceecccea12b0",b8=W.Namespace.EXOCMD.term("SubstitutionToken").value,QC=new Set(["today","todayStart","targetFolder","target","randomUUIDv4","nowTimestamp","nowDate","nowYear","nowMonth","userInputLabel","userInput","targetProperty","labelAsArray","groundingTargetClass","targetClassSelf"]);function _8(n,e){return`__SUBSTITUTE__${n}__${e}__`}a(_8,"buildSubstitutionMarker");function S8(n,e,t){let r=(0,d8.utf8ToBase64)(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`__SUBSTITUTE_P__${n}__${e}__${r}__`}a(S8,"buildParameterisedMarker");var XC="3f28af98-c031-4718-8ba2-44ad0b012c52",w8=W.Namespace.EXOCMD.term("TokenInvocation").value,JC="29e2c8f8-2d27-4e58-b467-2e85d46f8122",ZC="universal-default-template",v8=new Set(["today","todayStart","nowTimestamp","nowDate","nowYear","nowMonth"]),i1=n1=class{static{a(this,"CommandResolver")}clearUniversalCache(){this._universalCacheReady=!1,this._universalCacheValue=null,(0,Um.clearUniversalDefault)()}constructor(e,t=f8.NullLogger){this.tripleStore=e,this.logger=t,this.cache=new Map,this.multiCache=new Map,this._ancestorDepthCache=new Map,this._legacyPropertyDefaultsWarnedGroundings=new Set,this._universalCacheReady=!1,this._universalCacheValue=null}async resolveForAssetMulti(e,t,r){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${r??""}`,o=this.multiCache.get(s);if(o)return o;let c=await this.expandClassHierarchy(t),l=new Map;for(let[h,p]of c){let g=await this.resolveForAsset(e,h,r);for(let y of g){let b=this.getBindingPriority(y.binding)===2?p:0,S=l.get(y.binding.id);(!S||b<S.depth)&&l.set(y.binding.id,{rc:y,depth:b})}}let u=new Set;for(let{rc:h}of l.values())if(h.binding.overrides)for(let p of h.binding.overrides)u.add(p);let f=Array.from(l.entries()).filter(([h])=>!u.has(h)).map(([,h])=>h);f.sort((h,p)=>{let g=this.getBindingPriority(h.rc.binding),y=this.getBindingPriority(p.rc.binding);return g!==y?g-y:h.depth!==p.depth?h.depth-p.depth:(h.rc.binding.order??100)-(p.rc.binding.order??100)});let d=f.map(h=>h.rc);return this.multiCache.set(s,d),d}async expandClassHierarchy(e){let t=new Map;for(let c of e){if(c===Bm){t.set(c,new Set);continue}let l=[];try{l=await this.getClassAncestors(c)}catch{l=[]}t.set(c,new Set(l))}let r=a(c=>{for(let l of e)if(l!==c&&t.get(l)?.has(c)&&!t.get(c)?.has(l))return!0;return!1},"isAncestorOfSibling"),i=e.filter(c=>!r(c)),s=new Map,o=a((c,l)=>{let u=s.get(c);(u===void 0||l<u)&&s.set(c,l)},"setMin");for(let c of i){if(o(c,0),this.looksLikeUUID(c))try{let u=await this.resolveLabelByUID(c);u&&o(u,0)}catch{}if(c===Bm)continue;let l=[];try{l=await this.getClassAncestorsWithDepth(c)}catch{l=[]}for(let{ref:u,depth:f}of l)o(u,f)}return s.has(Bm)||s.set(Bm,y8),s}async resolveForAsset(e,t,r){let i=`${e}:${t}:${r??""}`,s=this.cache.get(i);if(s)return s;let o=await this.findBindings(t,r,e),c=[];for(let l of o){let u=await this.loadCommand(l.commandRef,{targetClass:l.targetClass});if(!u)continue;let f=l.precondition?{...u,precondition:l.precondition}:u;c.push({command:f,binding:l})}return c.sort((l,u)=>{let f=this.getBindingPriority(l.binding),d=this.getBindingPriority(u.binding);return f!==d?f-d:(l.binding.order??100)-(u.binding.order??100)}),this.cache.set(i,c),c}async loadCommand(e,t){let r=await this.findSubjectByUID(e);if(!r||(await this.tripleStore.match(r,W.Namespace.RDF.term("type"),W.Namespace.EXOCMD.term("Command"))).length===0)return null;let s=await this.getLiteralValue(r,W.Namespace.EXO.term("Asset_label"))??"Unknown Command",o=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_labelTemplate")),c=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_icon")),l=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_confirmMessage")),u=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_successMessage")),f=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_category")),d=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_openInSameTab")),h=d!==null&&String(d).trim().toLowerCase()==="true",p=await this.loadLinkedPrecondition(r),g=await this.loadLinkedGrounding(r,0,t);return g?{id:e,name:s,labelTemplate:o??void 0,icon:c??void 0,precondition:p??void 0,grounding:g,confirmMessage:l??void 0,successMessage:u??void 0,category:f??void 0,openInSameTab:h||void 0}:null}async findBindings(e,t,r){let i=await this.tripleStore.match(void 0,W.Namespace.RDF.term("type"),W.Namespace.EXOCMD.term("CommandBinding")),s=[];for(let o of i){let c=o.subject,l=await this.loadBindingDefinition(c);l&&this.bindingMatches(l,e,t,r)&&s.push(l)}return s}async findPaletteEnabledCommands(){let e=await this.tripleStore.match(void 0,W.Namespace.RDF.term("type"),W.Namespace.EXOCMD.term("Command")),t=[],r=new Set;for(let i of e){let s=i.subject;if((await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Command_paletteEnabled")))?.toLowerCase()!=="true")continue;let c=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_uid"));if(!c){this.logger.warn(`[CommandResolver] paletteEnabled command at ${s.value} has no exo__Asset_uid \u2014 skipped`);continue}let l=await this.loadCommand(c);if(!l){this.logger.warn(`[CommandResolver] paletteEnabled command ${c} could not be loaded (missing grounding?) \u2014 skipped`);continue}let u=await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Command_paletteId")),f=await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Command_cliName")),d=u??f??c;if(r.has(d)){this.logger.warn(`[CommandResolver] duplicate paletteId "${d}" \u2014 first registration wins, dropping ${c}`);continue}r.add(d),t.push({command:l,paletteId:d})}return t}invalidateCache(){this.cache.clear(),this.multiCache.clear(),this._ancestorDepthCache.clear()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let r=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:o}of i){let c=await this.evaluateSelectSnippet(o,t);r=r.replace(s,c)}return r}extractPlaceholders(e){let t=[],r=0;for(;r<e.length;)if(e[r]==="{"){let i=1,s=r+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let o=e.slice(r,s),c=e.slice(r+1,s-1);t.push({full:o,body:c})}r=s}else r++;return t}async evaluateSelectSnippet(e,t){try{let r=e.replace(/\$target/g,`<${t}>`),s=new p8.ExoQLParser().parse(r),c=new m8.ExoQLAlgebraTranslator().translate(s),u=await new g8.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let h=f.get(d[0]);return h?h instanceof Ut.Literal||h instanceof Zt.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,W.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,W.Namespace.EXOCMD.term("CommandBinding_targetClass")),o=await this.getLinkedValue(e,W.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,W.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!o&&!c)return null;let l=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,h=await this.loadLinkedPreconditionFromProperty(e,W.Namespace.EXOCMD.term("CommandBinding_precondition")),p=await this.loadLinkedStyle(e,t),g=await this.getLinkedUIDs(e,W.Namespace.EXOCMD.term("CommandBinding_overrides"));return{id:t,label:r,commandRef:i,targetClass:s??void 0,targetPrototype:o??void 0,targetAsset:c??void 0,position:l??void 0,order:u?parseInt(u,10):void 0,variant:d,precondition:h??void 0,style:p??void 0,overrides:g.length>0?g:void 0}}async loadLinkedStyle(e,t){let r=await this.tripleStore.match(e,W.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(r.length>0){let s=r[0].object,o=null;if(s instanceof Zt.IRI)o=s;else if(s instanceof Ut.Literal){let c=this.normalizeWikilink(s.value);o=await this.findSubjectByUID(c)}if(o){let c=await this.loadStyleAsset(o);if(c)return c}this.logger.warn(this.capWarning(`CommandBinding ${t}: style reference unresolved, falling back to inline variant`))}let i=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBinding_variant"));if(i!==null){let s=this.coerceVariant(i,t);if(s!==void 0)return{id:`inline:${t}`,label:"",variant:s,inline:!0}}return null}async loadStyleAsset(e){let t=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,o=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(o),l=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),h=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),p=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_source")),g=p!==null?this.coerceStyleSource(p,t):void 0;return{id:t,label:r,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:h??void 0,source:g,inline:!1}}coerceVariant(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Vl.COMMAND_VARIANT_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${r}" not in whitelist [${Vl.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Vl.LABEL_CLASS_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${r}" not in whitelist [${Vl.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Vl.STYLE_SOURCE_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle source "${r}" not in whitelist [${Vl.STYLE_SOURCE_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceBoolean(e){if(e===null)return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}capWarning(e){return e.length<=200?e:e.slice(0,197)+"..."}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let o=this.extractPathBasename(r);if(o&&o===i)return!0;let c=this.extractAlias(t);if(c&&r===c)return!0;let l=this.extractAlias(e);return!!(l&&l===i)}extractPathBasename(e){let t=e.match(/\/([^/]+)\.md$/);return t?t[1]:null}extractAlias(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(r+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,W.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Zt.IRI)s=i;else if(i instanceof Ut.Literal){let h=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(h)}if(!s)return null;let o=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Precondition_hostFunction")),f=await this.tripleStore.match(s,W.Namespace.EXOCMD.term("Precondition_query"),void 0),d;if(f.length>0){let h=f[0].object;if(h instanceof Zt.IRI){let p=await this.getLiteralValue(h,W.Namespace.EXO.term("Asset_uid"));p&&(d=p)}else h instanceof Ut.Literal&&(d=this.normalizeWikilink(h.value))}return!o||!l&&!u&&!d?null:{id:o,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u},...d&&{query:d}}}async loadLinkedGrounding(e,t,r){if(t>=qf)return null;let i=await this.tripleStore.match(e,W.Namespace.EXOCMD.term("Command_grounding"),void 0);if(i.length===0)return null;if(i.length===1||!r?.targetClass){let o=await this.resolveGroundingRef(i[0].object);return o?this.loadGroundingDefinition(o,t):null}for(let o of i){let c=await this.resolveGroundingRef(o.object);if(!c)continue;let l=await this.getObsidianName(c,W.Namespace.EXOCMD.term("Grounding_targetPrototype"));if(l&&this.matchesReference(l,r.targetClass))return this.loadGroundingDefinition(c,t)}this.logger.warn(`Command ${e.value}: ${i.length} groundings declared, none matched context.targetClass='${r.targetClass}' via Grounding_targetPrototype \u2014 falling back to first grounding by iteration order (legacy behaviour). Check that one grounding's Grounding_targetPrototype references this targetClass.`);let s=await this.resolveGroundingRef(i[0].object);return s?this.loadGroundingDefinition(s,t):null}async resolveGroundingRef(e){if(e instanceof Zt.IRI)return e;if(e instanceof Ut.Literal){let t=this.normalizeWikilink(e.value);return await this.findSubjectByUID(t)}return null}async loadGroundingByUid(e){let t=await this.findSubjectByUID(e);return t?this.loadGroundingDefinition(t,0):null}async loadGroundingDefinition(e,t){if(t>=qf)return null;let r=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_label"))??"",s=await this.resolveGroundingTypeReference(e);if(!s)return null;let o=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetProperty"));if(o&&this.looksLikeUUID(o)){let Q=await this.resolveLabelByUID(o);if(!Q)return this.logger.warn(`Grounding ${r}: targetProperty wikilink UID '${o}' is not resolvable to exo__Asset_label \u2014 grounding skipped (would otherwise write a UUID-named frontmatter key).`),null;o=Q}if(s===zC.GroundingType.SERVICE_CALL){let Q=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_serviceId"));Q&&(o=Q)}let c=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetValueRef")),l=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_targetValueLiteral")),u=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetValueSubstitution")),f=null;if(u&&this.looksLikeUUID(u)){let Q=await this.resolveLabelByUID(u);if(!Q)return this.logger.warn(`Grounding ${r}: targetValueSubstitution UID '${u}' is not resolvable to exo__Asset_label (SubstitutionToken instance missing or unlabelled) \u2014 grounding skipped.`),null;f=Q}else u&&(f=u);let d=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetValueQuery")),h=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_serviceCallPayload")),p=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_appendExpression")),g=await this.getObsidianWikilinkValue(e,W.Namespace.EXOCMD.term("Grounding_isDefinedBy")),y=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),b=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetClass"));if(b&&!this.looksLikeUUID(b)){let Q=await this.findUidByLabel(b);Q&&(b=Q)}let S=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetPrototype")),v=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_targetFolder")),I=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_linkBackProperty")),A=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_inputSchema")),T=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_incrementBy")),R=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_shiftDelta")),V;if(T!=null&&T!==""){let Q=Number.parseInt(String(T),10);Number.isFinite(Q)&&(V=Q)}let L=await this.resolvePropertyDefaults(e,r),P=await this.resolveInheritanceRules(e,r),k=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_propertyDefaults"));k!==null&&k!==""&&!this._legacyPropertyDefaultsWarnedGroundings.has(r)&&(this.logger.warn(`Grounding ${r}: deprecated exocmd__Grounding_propertyDefaults (plural) JSON predicate detected \u2014 the parser was removed in RFC v2 Phase 5 (#3167); value is ignored. Migrate to ref-form exocmd__Grounding_propertyDefault (singular) pointing to exocmd__PropertyDefault assets. See vault TBox c8f87363-d39c-45cb-9d4d-1be96d70f892 for the canonical replacement.`),this._legacyPropertyDefaultsWarnedGroundings.add(r));let O;s===zC.GroundingType.COMPOSITE&&(O=await this.loadCompositeSteps(e,t+1));let J;if(A)try{let Q=JSON.parse(A);Q?.properties&&(J=Object.entries(Q.properties).map(([G,te])=>{let Se=te.type,X=Se==="string"?"text":Se,$e=te.defaultValue!==void 0?te.defaultValue:te.default,Be={name:G,type:X,label:te.title??G,required:Array.isArray(Q.required)&&Q.required.includes(G)};return $e!=null&&(Be.defaultValue=String($e)),typeof te.targetClassUid=="string"&&(Be.targetClassUid=te.targetClassUid),Be}))}catch{}let re=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_prefillLabelWithDate")),Y=re!==null&&String(re).trim().toLowerCase()==="true",ye=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_labelTemplate")),de=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_direction")),le;if(de!=null){let Q=String(de).trim().toLowerCase();Q==="forward"||Q==="rollback"?le=Q:Q!==""&&this.logger.warn(`Grounding ${r}: exocmd__Grounding_direction value '${de}' is not 'forward' or 'rollback' \u2014 treating as undefined (will default to 'forward' at dispatch).`)}let q=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_bodyTemplate")),M=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_templateRef")),je={id:r,label:i,type:s,targetProperty:o??void 0,targetValueRef:c??void 0,targetValueLiteral:l??void 0,targetValueSubstitution:f??void 0,targetValueQuery:d??void 0,serviceCallPayload:h??void 0,appendExpression:p??void 0,sparqlUpdate:y??void 0,steps:O,targetClass:b??void 0,targetPrototype:S??void 0,targetFolder:v??void 0,linkBackProperty:I??void 0,incrementBy:V,shiftDelta:R??void 0,propertyDefault:L.length>0?L:void 0,inheritanceRule:P.length>0?P:void 0,isDefinedBy:g??void 0,prefillLabelWithDate:Y||void 0,labelTemplate:ye??void 0,direction:le,bodyTemplate:q??void 0,templateRef:M??void 0};return J&&(je.inputSchema=J),je}async loadCompositeSteps(e,t){if(t>=qf)return[];let r=await this.tripleStore.match(e,W.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let o=null;if(s.object instanceof Zt.IRI)o=s.object;else if(s.object instanceof Ut.Literal){let l=this.normalizeWikilink(s.object.value);o=await this.findSubjectByUID(l)}if(!o)continue;let c=await this.loadGroundingDefinition(o,t);c&&i.push(c)}return i}async resolvePropertyDefaults(e,t){let r=await this.resolvePropertyDefaultsForSubject(e,t,W.Namespace.EXOCMD.term("Grounding_propertyDefault")),i=await this.getUniversalCache();return i&&i.propertyDefaults.length>0?(0,Um.mergePropertyDefaults)(i.propertyDefaults,r):r}async resolvePropertyDefaultsForSubject(e,t,r){let i=await this.tripleStore.match(e,r,void 0),s=[];for(let o of i){let c=await this.resolveRefTripleObject(o.object);if(!c)continue;let l=await this.getObsidianName(c,W.Namespace.EXOCMD.term("PropertyDefault_property"));if(!l){this.logger.warn(`Grounding ${t}: PropertyDefault asset missing exocmd__PropertyDefault_property \u2014 entry skipped.`);continue}let u=this.looksLikeUUID(l)?await this.resolveLabelByUID(l):l;if(!u){this.logger.warn(`Grounding ${t}: PropertyDefault property UID '${l}' is not resolvable to exo__Asset_label \u2014 entry skipped.`);continue}let f=await this.getObsidianName(c,W.Namespace.EXOCMD.term("PropertyDefault_value"));if(!f){this.logger.warn(`Grounding ${t}: PropertyDefault '${u}' missing exocmd__PropertyDefault_value \u2014 entry skipped.`);continue}let d=await this.resolvePropertyDefaultValue(f,t,u);d!==null&&s.push({propertyName:u,value:d})}return s}async getUniversalCache(){if(this._universalCacheReady)return this._universalCacheValue;this._universalCacheReady=!0;let e=await(0,Um.loadUniversalDefault)();if(e)return this._universalCacheValue=e,e;let t=await this.findUniversalSingleton();if(!t)return this._universalCacheValue=null,null;let r=await this.resolvePropertyDefaultsForSubject(t,ZC,W.Namespace.EXOCMD.term("Template_propertyDefault")),i=await this.resolveInheritanceRulesForSubject(t,ZC,W.Namespace.EXOCMD.term("Template_inheritanceRule"));return this._universalCacheValue={propertyDefaults:r,inheritanceRules:i},this._universalCacheValue}async findUniversalSingleton(){let e=W.Namespace.EXOCMD.term("UniversalDefaultTemplate").value,t=await this.tripleStore.match(void 0,W.Namespace.EXO.term("Instance_class"),void 0),r=[];for(let i of t){let s=!1;if(i.object instanceof Zt.IRI)s=i.object.value===e||i.object.value.includes(JC);else if(i.object instanceof Ut.Literal){let o=this.unwrapWikilink(i.object.value);s=o==="exocmd__UniversalDefaultTemplate"||o===JC}s&&i.subject instanceof Zt.IRI&&r.push(i.subject)}return r.length===0?null:(r.length===1||(r.sort((i,s)=>i.value.localeCompare(s.value)),this.logger.warn(`Multiple UniversalDefaultTemplate singletons found (${r.length}); selecting deterministically by lexicographic UID order: ${r[0].value}`)),r[0])}async resolveInheritanceRules(e,t){let r=await this.resolveInheritanceRulesForSubject(e,t,W.Namespace.EXOCMD.term("Grounding_inheritanceRule")),i=await this.getUniversalCache();return i&&i.inheritanceRules.length>0?(0,Um.mergeInheritanceRules)(i.inheritanceRules,r):r}async resolveInheritanceRulesForSubject(e,t,r){let i=await this.tripleStore.match(e,r,void 0),s=[],o=t;for(let c of i){let l=await this.resolveRefTripleObject(c.object);if(!l)continue;let u=await this.resolveLabelRef(l,W.Namespace.EXOCMD.term("InheritanceRule_sourceProperty"));if(!u){this.logger.warn(`Grounding ${o}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_sourceProperty \u2014 entry skipped.`);continue}let f=await this.resolveLabelRef(l,W.Namespace.EXOCMD.term("InheritanceRule_targetProperty"));if(!f){this.logger.warn(`Grounding ${o}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_targetProperty \u2014 entry skipped.`);continue}let d=await this.tripleStore.match(l,W.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"),void 0),h,p;if(d.length>0){let A=await this.getObsidianName(l,W.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"));if(!A||!A.trim()){this.logger.warn(`Grounding ${o}: InheritanceRule has exocmd__InheritanceRule_targetClassCondition triple but ref is unresolvable \u2014 entire rule skipped (would otherwise apply unconditionally, broadening scope).`);continue}this.looksLikeUUID(A)?(p=A,h=await this.resolveLabelByUID(A)??void 0):h=A}let g=await this.tripleStore.match(l,W.Namespace.EXOCMD.term("InheritanceRule_targetClassExclusion"),void 0),y=[],b=[],S=!1;for(let A of g){let T=null;if(A.object instanceof Zt.IRI?T=this.iriToObsidianName(A.object.value)??A.object.value:A.object instanceof Ut.Literal&&(T=this.unwrapWikilink(A.object.value)),!T){S=!0;continue}if(this.looksLikeUUID(T)){b.push(T);let R=await this.resolveLabelByUID(T);R&&y.push(R)}else y.push(T)}if(S){this.logger.warn(`Grounding ${o}: InheritanceRule has unresolvable exocmd__InheritanceRule_targetClassExclusion entry \u2014 entire rule skipped (would otherwise expand scope by silently dropping the excluded class).`);continue}let v=await this.getLiteralValue(l,W.Namespace.EXOCMD.term("InheritanceRule_priority")),I=50;if(v!==null&&v!==""){let A=Number.parseInt(String(v),10);Number.isFinite(A)&&(I=A)}s.push({sourcePropertyName:u,targetPropertyName:f,targetClassCondition:h,targetClassConditionUid:p,targetClassExclusion:y,targetClassExclusionUids:b,priority:I})}return s}async resolveRefTripleObject(e){if(e instanceof Zt.IRI)return e;if(e instanceof Ut.Literal){let t=this.normalizeWikilink(e.value);return t?this.findSubjectByUID(t):null}return null}async resolveLabelRef(e,t){let r=await this.getObsidianName(e,t);return r?this.looksLikeUUID(r)?this.resolveLabelByUID(r):r:null}async resolvePropertyDefaultValue(e,t,r){if(!this.looksLikeUUID(e))return`"[[${e}]]"`;let i=await this.findSubjectByUID(e);return i?await this.assetIsTokenInvocation(i)?this.resolveTokenInvocation(i,e,t,r):await this.assetIsSubstitutionToken(i)?this.dispatchSubstitutionToken(i,e,t,r,void 0):`"[[${e}]]"`:`"[[${e}]]"`}async dispatchSubstitutionToken(e,t,r,i,s){let o=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("SubstitutionToken_resolver"));if(!o||!o.trim())return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' references SubstitutionToken '${t}' with no exocmd__SubstitutionToken_resolver \u2014 falling back to wikilink form.`),`"[[${t}]]"`;let c=o.trim();return QC.has(c)?s!==void 0?S8(c,t,s):v8.has(c)?n1.parseTimeResolve(c):_8(c,t):(this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' SubstitutionToken '${t}' declares unknown resolver-id '${c}' \u2014 falling back to wikilink form. Known ids: ${Array.from(QC).join(", ")}.`),`"[[${t}]]"`)}static parseTimeResolve(e){let t=new Date,r=a(i=>i<10?`0${i}`:String(i),"pad");switch(e){case"today":return t.toISOString().slice(0,10);case"todayStart":return new Date(new Date().setHours(0,0,0,0)).toISOString();case"nowTimestamp":return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`;case"nowDate":return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`;case"nowYear":return String(t.getFullYear());case"nowMonth":return r(t.getMonth()+1);default:return""}}async resolveTokenInvocation(e,t,r,i){let s=await this.getObsidianName(e,W.Namespace.EXOCMD.term("TokenInvocation_token"));if(!s)return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' missing exocmd__TokenInvocation_token \u2014 entry skipped.`),null;let o=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("TokenInvocation_parameter"))??"";if(!this.looksLikeUUID(s))return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' references non-UUID token '${s}' \u2014 entry skipped.`),null;let c=await this.findSubjectByUID(s);return c?this.dispatchSubstitutionToken(c,s,r,i,o):(this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' token ref '${s}' not found in store \u2014 entry skipped.`),null)}async assetIsTokenInvocation(e){let t=await this.tripleStore.match(e,W.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof Zt.IRI){if(r.object.value===w8||r.object.value.includes(XC))return!0}else if(r.object instanceof Ut.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__TokenInvocation"||i===XC)return!0}return!1}async assetIsSubstitutionToken(e){let t=await this.tripleStore.match(e,W.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof Zt.IRI){if(r.object.value===b8||r.object.value.includes(YC))return!0}else if(r.object instanceof Ut.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__SubstitutionToken"||i===YC)return!0}return!1}async resolveGroundingTypeReference(e){let t=await this.tripleStore.match(e,W.Namespace.EXOCMD.term("Grounding_type"),void 0);if(t.length===0)return null;let r=t[0].object;if(r instanceof Zt.IRI)return(0,KC.resolveGroundingTypeFromIRI)(r.value);if(r instanceof Ut.Literal){let i=r.value,s=i.match(/^\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]$/i);return s?(0,KC.resolveGroundingTypeFromIRI)(`obsidian://vault/${s[1].toLowerCase()}.md`):(this.logger.warn(`[exocmd-grounding-type-literal-form] legacy literal-string form '${i}' for exocmd__Grounding_type on <${e.value}>. Migrate to wikilink form per RFC 9d20c91f Phase 3.`),null)}return null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let r=await this.tripleStore.findSubjectsByUUID(e);if(r.length>0)return r[0]}let t=await this.tripleStore.match(void 0,W.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof Ut.Literal&&r.object.value===e)return r.subject;return null}async getLiteralValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Ut.Literal||i instanceof Zt.IRI?i.value:null}looksLikeUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}async resolveLabelByUID(e){let t=await this.findSubjectByUID(e);return t?this.getLiteralValue(t,W.Namespace.EXO.term("Asset_label")):null}async getClassAncestors(e){return(await this.getClassAncestorsWithDepth(e)).map(r=>r.ref)}async getClassAncestorsWithDepth(e){let t=this._ancestorDepthCache.get(e);if(t)return t;let r=new Map,i=new Set,s=await this.resolveClassFileIRI(e);if(!s)return[];let o=new Set([e]),c=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_uid"));c&&o.add(c);let l=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_label"));l&&o.add(l);let u=a((h,p)=>{if(o.has(h))return;let g=r.get(h);(g===void 0||p<g)&&r.set(h,p)},"setMin"),f=[{fileIRI:s,depth:0}];for(;f.length>0;){let h=f.shift();if(!h)break;let{fileIRI:p,depth:g}=h;if(g>=qf||i.has(p.value))continue;i.add(p.value);let y=await this.tripleStore.match(p,W.Namespace.EXO.term("Class_superClass"),void 0);for(let b of y){let S=b.object;if(!(S instanceof Zt.IRI))continue;let v=g+1,I=S.value.startsWith("obsidian://vault/"),A=this.iriToObsidianName(S.value);A&&u(A,v);let T=null;if(I?T=S:A&&(T=await this.resolveClassFileIRI(A)),!T)continue;let R=await this.getLiteralValue(T,W.Namespace.EXO.term("Asset_uid"));R&&u(R,v),i.has(T.value)||f.push({fileIRI:T,depth:v})}}let d=Array.from(r.entries()).map(([h,p])=>({ref:h,depth:p}));return this._ancestorDepthCache.set(e,d),d}async resolveClassFileIRI(e){if(this.looksLikeUUID(e))return this.findSubjectByUID(e);let t=await this.findUidByLabel(e);return t?this.findSubjectByUID(t):null}async findUidByLabel(e){let t=await this.tripleStore.match(void 0,W.Namespace.EXO.term("Asset_label"),void 0);for(let r of t)if(r.object instanceof Ut.Literal&&r.object.value===e&&r.subject instanceof Zt.IRI){let i=await this.tripleStore.match(r.subject,W.Namespace.EXO.term("Asset_uid"),void 0);if(i.length>0&&i[0].object instanceof Ut.Literal)return i[0].object.value}return null}async getLinkedUID(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Zt.IRI){let s=await this.tripleStore.match(i,W.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof Ut.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof Ut.Literal?this.normalizeWikilink(i.value):null}async getLinkedUIDs(e,t){let r=await this.tripleStore.match(e,t,void 0),i=[];for(let s of r){let o=s.object;if(o instanceof Zt.IRI){let c=await this.tripleStore.match(o,W.Namespace.EXO.term("Asset_uid"),void 0);if(c.length>0&&c[0].object instanceof Ut.Literal)i.push(c[0].object.value);else{let l=o.value.split("/").pop()?.replace(".md","");l&&i.push(l)}}else if(o instanceof Ut.Literal){let c=this.normalizeWikilink(o.value);c&&i.push(c)}}return i}async getLinkedValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Ut.Literal?this.normalizeWikilink(i.value):i instanceof Zt.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Ut.Literal?this.unwrapWikilink(i.value):i instanceof Zt.IRI?this.iriToObsidianName(i.value)??i.value:null}unwrapWikilink(e){if(!e)return e;let t=e.trim().replace(/^"|"$/g,"");if(t.startsWith("http://")||t.startsWith("https://"))return this.iriToObsidianName(t)??t;let r=t.match(/^\[\[([^\]|]+)\|([^\]]+)\]\]$/);if(r)return r[2].trim();let i=t.match(/^\[\[([^\]|]+)\]\]$/);if(i){let s=i[1].trim();return s.startsWith("http://")||s.startsWith("https://")?this.iriToObsidianName(s)??s:s}return t}async getObsidianWikilinkValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Ut.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof Zt.IRI){let s=this.iriToObsidianName(i.value);return s?`"[[${s}]]"`:i.value}return null}async resolveWikilinkAlias(e){let t=e.match(/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\]/);if(!t)return e;let r=t[1],i=await this.findSubjectByUID(r);if(!i)return e;let s=await this.getLiteralValue(i,W.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${r}]]`,`[[${r}|${s}]]`):e}iriToObsidianName(e){return(0,h8.iriToObsidianName)(e)}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(0,r):t}};uo.CommandResolver=i1;uo.CommandResolver=i1=n1=c8([(0,u8.injectable)(),l8("design:paramtypes",[Object,Object])],i1)});var o1=w(s1=>{"use strict";Object.defineProperty(s1,"__esModule",{value:!0});s1.validateExoQLAllowlist=E8;var Vm=Bf();function E8(n){if(!n||typeof n!="object")return;let e=n;if(e.type==="update"){let t=n.updates??[];for(let r of t)if(r?.type==="load")throw new Vm.ExoQLForbiddenKeywordError("LOAD");throw new Vm.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,r=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||r)throw new Vm.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)qm(t);if(Array.isArray(e.template))for(let t of e.template)qm(t)}}a(E8,"validateExoQLAllowlist");function qm(n){if(!n||typeof n!="object")return;if(n.type==="service")throw new Vm.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(n.patterns))for(let t of n.patterns)qm(t);let e=n.where;if(Array.isArray(e))for(let t of e)qm(t)}a(qm,"walkPatternForBannedKeywords")});var a1=w(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.DEFAULT_EVAL_CONFIG=void 0;Gm.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var Wm=w(c1=>{"use strict";Object.defineProperty(c1,"__esModule",{value:!0});c1.evaluateWithExoEval=O8;var T8=bl(),A8=Sl(),I8=Bl(),x8=o1(),R8=a1(),C8=Bf();async function O8(n,e={}){if(typeof n!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let r=new T8.ExoQLParser().parse(n);if((0,x8.validateExoQLAllowlist)(r),!{...R8.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new C8.ExoQLEvalDisabledError;let s="queryType"in r&&typeof r.queryType=="string"?r.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new A8.ExoQLAlgebraTranslator().translate(r),l=new I8.ExoQLQueryExecutor(e.store);return l.isAskQuery(c)?{kind:"ask",result:await l.executeAsk(c)}:l.isConstructQuery(c)?{kind:"construct",triples:await l.executeConstruct(c)}:{kind:"select",rows:await l.executeAll(c)}}a(O8,"evaluateWithExoEval")});var Gf=w(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.liveClock=P8;Hm.frozenClock=F8;function P8(){return{now:a(()=>new Date,"now")}}a(P8,"liveClock");function F8(n){let e=new Date(n);return{now:a(()=>new Date(e.getTime()),"now")}}a(F8,"frozenClock")});var rO=w(fo=>{"use strict";var D8=fo&&fo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},L8=fo&&fo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Wf;Object.defineProperty(fo,"__esModule",{value:!0});fo.PreconditionEvaluator=void 0;var N8=Ve(),k8=bl(),M8=Sl(),tO=Bl(),j8=Wm(),$8=Gf(),Hf=Wf=class{static{a(this,"PreconditionEvaluator")}constructor(e,t,r){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t,this.clock=r?.clock??(0,$8.liveClock)()}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.query?this.evaluateQueryRef(e.query,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return!1;let i=this.substituteVariables(r,t),s=await(0,j8.evaluateWithExoEval)(i,{store:this.tripleStore});return s.kind!=="ask"?!1:s.result}catch{return!1}}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}evaluateHostFunctionSync(e,t,r){return this.hostFunctions.has(e)?this.evaluateHostFunction(e,t,r):null}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Wf.SENTINEL_IRI),i=new k8.ExoQLParser().parse(t),o=new M8.ExoQLAlgebraTranslator().translate(i);return new tO.ExoQLQueryExecutor(this.tripleStore).isAskQuery(o)?o:null}evaluateHostFunction(e,t,r){let i=this.hostFunctions.get(e);if(!i)return!0;let s=r?{...r,targetIRI:t}:{targetIRI:t};try{return i(s)}catch{return!1}}async evaluateSparqlAsk(e,t){try{let r=this.askCache.get(e);if(r===void 0){let o=this.compileAsk(e);if(!o)return!1;r=o,this.askCache.set(e,r)}let i=JSON.parse(JSON.stringify(r).replaceAll(Wf.SENTINEL_IRI,t));return await new tO.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=this.clock.now(),i=r.toISOString(),s=i.slice(0,10),o=new Date(r.getTime()+Wf.ALMATY_OFFSET_MS),c=o.getUTCFullYear(),l=o.getUTCMonth(),u=o.getUTCDate(),f=o.getUTCDay(),h=new Date(Date.UTC(c,l,u-1)).toISOString().slice(0,10),p=(f+6)%7,g=new Date(Date.UTC(c,l,u-p)),y=g.toISOString().slice(0,10),S=new Date(g.getTime()-10080*60*1e3).toISOString().slice(0,10),v=`${c}-${String(l+1).padStart(2,"0")}-01`,I=l===0?11:l-1,T=`${l===0?c-1:c}-${String(I+1).padStart(2,"0")}-01`,R=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${i}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${y}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${S}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${v}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${T}"^^xsd:date`).replace(/\$thisYearStart/g,`"${R}"^^xsd:date`).replace(/\$today/g,`"${s}"^^xsd:date`)}};fo.PreconditionEvaluator=Hf;Hf.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";Hf.ALMATY_OFFSET_MS=300*60*1e3;fo.PreconditionEvaluator=Hf=Wf=D8([(0,N8.injectable)(),L8("design:paramtypes",[Object,Object,Object])],Hf)});var nO=w(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.hasUidFilename=ho.hasNonUidFilename=void 0;ho.registerDefaultHostFunctions=V8;var U8=a(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t!==e},"hasNonUidFilename");ho.hasNonUidFilename=U8;var B8=a(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t===e},"hasUidFilename");ho.hasUidFilename=B8;function V8(n){n.registerHostFunction("hasNonUidFilename",ho.hasNonUidFilename),n.registerHostFunction("hasUidFilename",ho.hasUidFilename)}a(V8,"registerDefaultHostFunctions")});var Km=w(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.liveUidGenerator=q8;zm.seededUidGenerator=W8;var l1=Ii();function q8(){return{next:a(()=>(0,l1.v4)(),"next")}}a(q8,"liveUidGenerator");var G8="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function W8(n){let e=0,t=(0,l1.v5)(n,G8);return{next:a(()=>{let r=`${n}#${e}`;return e+=1,(0,l1.v5)(r,t)},"next")}}a(W8,"seededUidGenerator")});var Xm=w(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.registerResolver=ar;ca.getResolver=H8;ca.isResolverModifierAware=z8;ca.getRegisteredResolverIds=K8;ca.clearResolvers=Y8;ca.installDefaultResolvers=sB;var Qm=new Map,u1=new Set;function ar(n,e,t=!1){Qm.set(n,e),t&&u1.add(n)}a(ar,"registerResolver");function H8(n){return Qm.get(n)}a(H8,"getResolver");function z8(n){return u1.has(n)}a(z8,"isResolverModifierAware");function K8(){return Array.from(Qm.keys())}a(K8,"getRegisteredResolverIds");function Y8(){Qm.clear(),u1.clear()}a(Y8,"clearResolvers");function yn(n){return n<10?`0${n}`:String(n)}a(yn,"pad2");var Q8=["January","February","March","April","May","June","July","August","September","October","November","December"],X8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],J8=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Z8=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function eB(n){let e=["th","st","nd","rd"],t=n%100;return`${n}${e[(t-20)%10]||e[t]||e[0]}`}a(eB,"ordinalDay");var tB=/YYYY|YY|MMMM|MMM|MM|M|Do|DD|D|dddd|ddd|HH|H|hh|h|mm|m|ss|s|A|a/g;function rB(n,e){let t=(n.getHours()+11)%12+1;return e.replace(tB,r=>{switch(r){case"YYYY":return String(n.getFullYear());case"YY":return yn(n.getFullYear()%100);case"MMMM":return Q8[n.getMonth()];case"MMM":return X8[n.getMonth()];case"MM":return yn(n.getMonth()+1);case"M":return String(n.getMonth()+1);case"Do":return eB(n.getDate());case"DD":return yn(n.getDate());case"D":return String(n.getDate());case"dddd":return J8[n.getDay()];case"ddd":return Z8[n.getDay()];case"HH":return yn(n.getHours());case"H":return String(n.getHours());case"hh":return yn(t);case"h":return String(t);case"mm":return yn(n.getMinutes());case"m":return String(n.getMinutes());case"ss":return yn(n.getSeconds());case"s":return String(n.getSeconds());case"A":return n.getHours()<12?"AM":"PM";case"a":return n.getHours()<12?"am":"pm";default:return r}})}a(rB,"formatDate");function iO(n,e,t){let r=n.getDate(),i=new Date(n.getTime());i.setDate(1),t==="M"?i.setMonth(i.getMonth()+e):i.setFullYear(i.getFullYear()+e);let s=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();return i.setDate(Math.min(r,s)),i}a(iO,"addMonthsClamped");function nB(n,e){if(!e)return n;let t=e.match(/^([+-])(\d+)([dwMy])?$/);if(!t)return n;let r=(t[1]==="-"?-1:1)*parseInt(t[2],10),i=t[3]??"d",s=new Date(n.getTime());switch(i){case"d":s.setDate(s.getDate()+r);break;case"w":s.setDate(s.getDate()+r*7);break;case"M":s=iO(s,r,"M");break;case"y":s=iO(s,r,"y");break}return isNaN(s.getTime())?n:s}a(nB,"applyDateOffset");function iB(n){if(!n)return{offset:null,format:null};let e=n.indexOf(":");if(e<0)return{offset:n,format:null};let t=n.slice(0,e),r=n.slice(e+1);return{offset:t||null,format:r||null}}a(iB,"parseDateModifier");function Ym(n,e){return(t,r)=>{let{offset:i,format:s}=iB(r),o=new Date;return n!==0&&o.setDate(o.getDate()+n),o=nB(o,i),rB(o,s??e)}}a(Ym,"makeDateResolver");function sB(){ar("today",()=>new Date().toISOString().slice(0,10)),ar("todayStart",()=>new Date(new Date().setHours(0,0,0,0)).toISOString()),ar("date",Ym(0,"YYYY-MM-DD"),!0),ar("now",Ym(0,"YYYY-MM-DDTHH:mm:ss"),!0),ar("tomorrow",Ym(1,"YYYY-MM-DD"),!0),ar("yesterday",Ym(-1,"YYYY-MM-DD"),!0),ar("target",n=>n.targetIRI?`"[[${n.targetIRI}]]"`:""),ar("targetFolder",n=>{if(!n.targetFilePath)return"";let e=n.targetFilePath.replace(/^\/+/,""),t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}),ar("randomUUIDv4",()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();throw new Error("randomUUIDv4 resolver requires crypto.randomUUID() \u2014 runtime is missing Node crypto / Web Crypto API.")}),ar("nowTimestamp",()=>{let n=new Date;return`${n.getFullYear()}-${yn(n.getMonth()+1)}-${yn(n.getDate())}T${yn(n.getHours())}:${yn(n.getMinutes())}:${yn(n.getSeconds())}`}),ar("nowDate",()=>{let n=new Date;return`${n.getFullYear()}-${yn(n.getMonth()+1)}-${yn(n.getDate())}`}),ar("nowYear",()=>String(new Date().getFullYear())),ar("nowMonth",()=>yn(new Date().getMonth()+1)),ar("userInputLabel",n=>{let e=n.userInput?.label;return typeof e=="string"?e:""}),ar("userInput",(n,e)=>{if(!e)return null;let t=n.userInput?.[e];return typeof t=="string"?t:t==null?null:String(t)}),ar("targetProperty",(n,e)=>{if(!e||!n.targetFm)return null;let t=n.targetFm[e];return t==null?null:Array.isArray(t)?t.map(String):String(t)}),ar("labelAsArray",n=>{let e=n.userInput?.label;return typeof e=="string"&&e.length>0?[e]:[]}),ar("groundingTargetClass",n=>n.groundingTargetClassUid?`"[[${n.groundingTargetClassUid}]]"`:null),ar("targetClassSelf",n=>{if(!n.targetFilePath)return null;let e=n.targetFilePath.replace(/^\/+/,""),r=e.slice(e.lastIndexOf("/")+1).replace(/\.md$/i,"");return r.length>0?`"[[${r}]]"`:null})}a(sB,"installDefaultResolvers")});var d1=w(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.resolveTemplateBody=aB;Jm.stripTemplateFrontmatter=cB;var f1=Xm();(0,f1.installDefaultResolvers)();var oB=/\$([A-Za-z][A-Za-z0-9_]*)((?:[+-]\d+[dwMy])?(?::[A-Za-z0-9:./-]+)?)/g;function aB(n,e={}){return n.replace(oB,(t,r,i)=>{let s=(0,f1.getResolver)(r);if(s===void 0)return t;let o=s(e,i.length>0?i:void 0);return typeof o!="string"||o.length===0?t:(0,f1.isResolverModifierAware)(r)?o:o+i})}a(aB,"resolveTemplateBody");function cB(n){let e=n.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);return e?n.slice(e[0].length):n}a(cB,"stripTemplateFrontmatter")});var zf=w(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.registerOrderSpecLoader=lB;ql.clearOrderSpecLoader=uB;ql.loadDefaultSpec=fB;ql.orderProperties=dB;var Zm=null,la,eg=!1;function lB(n){Zm=n,la=void 0,eg=!1}a(lB,"registerOrderSpecLoader");function uB(){Zm=null,la=void 0,eg=!1}a(uB,"clearOrderSpecLoader");function fB(){if(la!==void 0)return la;if(!Zm)return la=null,null;try{la=Zm()}catch(n){eg||(console.warn("[OrderSpecResolver] loader threw, falling back to insertion order:",n),eg=!0),la=null}return la}a(fB,"loadDefaultSpec");function dB(n,e){if(!e||e.head.length===0&&e.tail.length===0)return n;let t=Object.keys(n),r=new Set(e.head),i=new Set(e.tail),s=e.head.filter(u=>Object.prototype.hasOwnProperty.call(n,u)),o=e.tail.filter(u=>Object.prototype.hasOwnProperty.call(n,u)),c=t.filter(u=>!r.has(u)&&!i.has(u));e.middleStrategy==="alphabetical"&&c.sort((u,f)=>u.localeCompare(f));let l={};for(let u of s)l[u]=n[u];for(let u of c)l[u]=n[u];for(let u of o)l[u]=n[u];return l}a(dB,"orderProperties")});var h1=w(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.STRING_SCALAR_PROPERTIES=void 0;fc.needsYamlQuoting=sO;fc.quoteYamlString=oO;fc.serializeYamlScalar=vB;var hB=/^[-!&*?|>%@`"'#,[\]{}]/,pB=/[\u0000-\u001f\u007f]/,mB=/^(?:true|True|TRUE|false|False|FALSE)$/,gB=/^(?:null|Null|NULL|~)$/,yB=/^[-+]?(?:0b[01_]+|0o[0-7_]+|0x[0-9a-fA-F_]+|[0-9][0-9_]*)$/,bB=/^(?:[-+]?[0-9][0-9_]*(?:\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\.(?:inf|Inf|INF)|\.(?:nan|NaN|NAN))$/,_B=/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;fc.STRING_SCALAR_PROPERTIES=new Set(["exo__Asset_label","aliases"]);function SB(n){if(n.length<2||!n.startsWith('"')||!n.endsWith('"'))return!1;let e=n.slice(1,-1);for(let t=0;t<e.length;t++){if(e[t]==="\\"){if(t+1>=e.length)return!1;t++;continue}if(e[t]==='"')return!1}return!0}a(SB,"isCompleteDoubleQuotedScalar");function wB(n){return mB.test(n)||gB.test(n)||yB.test(n)||bB.test(n)||_B.test(n)}a(wB,"looksLikeNonStringScalar");function sO(n,e=!1){return n===""?!0:SB(n)?!1:!!(n!==n.trim()||/:(\s|$)/.test(n)||/\s#/.test(n)||hB.test(n)||pB.test(n)||e&&wB(n))}a(sO,"needsYamlQuoting");function oO(n){let e="";for(let t=0;t<n.length;t++){let r=n[t],i=n.charCodeAt(t);r==="\\"?e+="\\\\":r==='"'?e+='\\"':r===`
|
|
70
|
+
${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}generateExpression(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:typeof e.value=="boolean"?e.value?"true":"false":String(e.value);case"comparison":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"logical":return e.operator==="!"?`!(${this.generateExpression(e.operands[0])})`:`(${e.operands.map(t=>this.generateExpression(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"function":return`${e.function.toUpperCase()}(${e.args.map(t=>this.generateExpression(t)).join(", ")})`;case"functionCall":return`${(typeof e.function=="string"?e.function:e.function.value).toUpperCase()}(${e.args.map(r=>this.generateExpression(r)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),r=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${r})`:`${t} IN (${r})`}default:throw new jl(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let r of e.triples)this.collectVariablesFromTriple(r,t);break;case"filter":this.collectVariablesFromOperation(e.input,t),this.collectVariablesFromExpression(e.expression,t);break;case"join":case"leftjoin":case"union":case"minus":this.collectVariablesFromOperation(e.left,t),this.collectVariablesFromOperation(e.right,t);break;case"values":for(let r of e.variables)t.add(r);break;case"project":for(let r of e.variables)t.add(r);this.collectVariablesFromOperation(e.input,t);break;case"extend":t.add(e.variable),this.collectVariablesFromOperation(e.input,t);break;case"orderby":case"slice":case"distinct":case"reduced":this.collectVariablesFromOperation(e.input,t);break;case"group":for(let r of e.variables)t.add(r);for(let r of e.aggregates)t.add(r.variable);this.collectVariablesFromOperation(e.input,t);break;case"subquery":this.collectVariablesFromOperation(e.query,t);break}}collectVariablesFromTriple(e,t){e.subject.type==="variable"&&t.add(e.subject.value),"type"in e.predicate&&e.predicate.type==="variable"&&t.add(e.predicate.value),e.object.type==="variable"&&t.add(e.object.value)}collectVariablesFromExpression(e,t){switch(e.type){case"variable":t.add(e.name);break;case"comparison":case"arithmetic":this.collectVariablesFromExpression(e.left,t),this.collectVariablesFromExpression(e.right,t);break;case"logical":for(let r of e.operands)this.collectVariablesFromExpression(r,t);break;case"function":case"functionCall":for(let r of e.args)this.collectVariablesFromExpression(r,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let r of e.list)this.collectVariablesFromExpression(r,t);break}}};$l.SPARQLGenerator=r1});var Bl=w(Mn=>{"use strict";var WU=Mn&&Mn.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),HU=Mn&&Mn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),HC=Mn&&Mn.__importStar||(function(){var n=a(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"&&WU(t,e,r[i]);return HU(t,e),t}})();Object.defineProperty(Mn,"__esModule",{value:!0});Mn.QueryExecutor=Mn.ExoQLQueryExecutor=Mn.QueryExecutorError=void 0;var zU=vw(),KU=Om(),YU=Bw(),QU=qw(),XU=NC(),JU=MC(),ZU=UC(),e8=Zw(),t8=VC(),r8=GC(),n8=WC(),i8=Pe(),s8=Ge(),o8=Em(),Wr="http://www.w3.org/2001/XMLSchema#",a8=new Set([`${Wr}integer`,`${Wr}decimal`,`${Wr}float`,`${Wr}double`,`${Wr}nonPositiveInteger`,`${Wr}negativeInteger`,`${Wr}long`,`${Wr}int`,`${Wr}short`,`${Wr}byte`,`${Wr}nonNegativeInteger`,`${Wr}unsignedLong`,`${Wr}unsignedInt`,`${Wr}unsignedShort`,`${Wr}unsignedByte`,`${Wr}positiveInteger`]),Ul=class extends Error{static{a(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};Mn.QueryExecutorError=Ul;var $m=class{static{a(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new zU.BGPExecutor(e),this.filterExecutor=new KU.FilterExecutor,this.optionalExecutor=new YU.OptionalExecutor,this.unionExecutor=new QU.UnionExecutor,this.minusExecutor=new XU.MinusExecutor,this.valuesExecutor=new JU.ValuesExecutor,this.aggregateExecutor=new ZU.AggregateExecutor,this.constructExecutor=new e8.ConstructExecutor,this.serviceExecutor=new t8.ServiceExecutor(t.serviceConfig),this.graphExecutor=new r8.GraphExecutor(e),this.sparqlGenerator=new n8.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(r,i)=>this.evaluateExistsPattern(r,i)),this.filterExecutor.setTripleStore(e)}async evaluateExistsPattern(e,t){for await(let r of this.execute(e))if(t.merge(r)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*execute(e){switch(e.type){case"bgp":yield*this.executeBGP(e);break;case"filter":yield*this.executeFilter(e);break;case"join":yield*this.executeJoin(e);break;case"leftjoin":yield*this.executeLeftJoin(e);break;case"union":yield*this.executeUnion(e);break;case"minus":yield*this.executeMinus(e);break;case"values":yield*this.executeValues(e);break;case"project":yield*this.executeProject(e);break;case"orderby":yield*this.executeOrderBy(e);break;case"slice":yield*this.executeSlice(e);break;case"distinct":yield*this.executeDistinct(e);break;case"reduced":yield*this.executeReduced(e);break;case"group":yield*this.executeGroup(e);break;case"extend":yield*this.executeExtend(e);break;case"subquery":yield*this.executeSubquery(e);break;case"lateraljoin":yield*this.executeLateralJoin(e);break;case"service":yield*this.executeService(e);break;case"graph":yield*this.executeGraph(e);break;default:throw new Ul(`Unknown operation type: ${e.type}`)}}async*executeBGP(e){yield*this.bgpExecutor.execute(e)}async*executeFilter(e){let t=this.execute(e.input);yield*this.filterExecutor.execute(e,t)}async*executeJoin(e){let t=[];for await(let o of this.execute(e.left))t.push(o);if(t.length===0)return;let r=new Set;for(let o of t)for(let c of o.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(o=>i.has(o)))for(let o of t){let c=this.substituteVariables(e.right,o);for await(let l of this.execute(c)){let u=o.merge(l);u!==null&&(yield u)}}else{let o=[];for await(let c of this.execute(e.right))o.push(c);for(let c of t)for(let l of o){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){let{SolutionMapping:t}=await Promise.resolve().then(()=>HC(_s())),r=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let o of i.variables())if(r.has(o)){let c=i.get(o);c!==void 0&&s.set(o,c)}yield s}}async*executeOrderBy(e){let t=[];for await(let r of this.execute(e.input))t.push(r);t.sort((r,i)=>{for(let s of e.comparators){let o=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(o===void 0&&c===void 0?l=0:o===void 0?l=1:c===void 0?l=-1:typeof o=="number"&&typeof c=="number"?l=o-c:l=String(o).localeCompare(String(c)),s.descending&&(l=-l),l!==0)return l}return 0});for(let r of t)yield r}async*executeSlice(e){let t=0,r=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=r){if(i!==void 0&&t-r>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeReduced(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let r=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of r)e.having.every(o=>this.filterExecutor.evaluateExpression(o,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let r of this.execute(e.input)){let i=r.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,r):this.evaluateExtendExpression(e.expression,r);s!==void 0&&i.set(e.variable,s),yield i}}async*executeSubquery(e){yield*this.execute(e.query)}async*executeLateralJoin(e){let t=[];for await(let r of this.execute(e.left))t.push(r);for(let r of t){let i=this.substituteVariables(e.right,r);for await(let s of this.execute(i)){let o=r.merge(s);o!==null&&(yield o)}}}substituteVariables(e,t){let r=JSON.parse(JSON.stringify(e));return this.substituteInOperation(r,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let r=e;return e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(r.input&&(r.input=this.substituteInOperation(r.input,t)),r.left&&(r.left=this.substituteInOperation(r.left,t)),r.right&&(r.right=this.substituteInOperation(r.right,t)),r.pattern&&(r.pattern=this.substituteInOperation(r.pattern,t)),r.query&&(r.query=this.substituteInOperation(r.query,t)),r.where&&(r.where=this.substituteInOperation(r.where,t)),r.expression&&this.substituteInExpression(r.expression,t),e)}substituteInExpression(e,t){if(!(!e||typeof e!="object")){if(e.type==="exists"&&e.pattern&&(e.pattern=this.substituteInOperation(e.pattern,t)),e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let r of e.operands)this.substituteInExpression(r,t);if(e.args)for(let r of e.args)this.substituteInExpression(r,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let r of e.list)this.substituteInExpression(r,t)}}substituteInTriple(e,t){return{subject:this.substituteInTripleElement(e.subject,t),predicate:e.predicate,object:this.substituteInTripleElement(e.object,t)}}substituteInTripleElement(e,t){if(e&&e.type==="variable"){let r=t.get(e.value);if(r!=null){let i=r;if(r instanceof i8.IRI||i.termType==="NamedNode")return{type:"iri",value:r.value};if(i.termType==="Literal"||typeof i.value=="string")return{type:"literal",value:i.value,datatype:i.datatype?.value??i._datatype?.value,language:i.language??i._language}}}return e}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(r,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{r.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(r,i):yield*this.execute(r)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:r}=await Promise.resolve().then(()=>HC(_s()));yield new r;return}yield*this.bgpExecutor.executeInGraph(e,t)}evaluateExtendExpression(e,t){if(e.type!=="aggregate")try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}async evaluateExtendExpressionAsync(e,t){if(e.type!=="aggregate")try{return await this.filterExecutor.evaluateExpressionAsync(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);if(!r)return;if(r instanceof s8.Literal){let i=r.datatype?.value;if(i===`${Wr}dayTimeDuration`)try{return o8.DateTimeFunctions.parseDayTimeDuration(r.value)}catch{return r.value}if(i&&a8.has(i)){let s=parseFloat(r.value);if(!Number.isNaN(s))return s}return r.value}return r.value??r.id??String(r)}if(e.type==="literal")return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="bgp"&&r.triples)for(let i of r.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(r.type==="values"&&r.variables)for(let i of r.variables)t.add(i);r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.type==="extend"&&r.variable&&t.add(r.variable),r.input&&this.collectVarsFromOperation(r.input,t),r.left&&this.collectVarsFromOperation(r.left,t),r.right&&this.collectVarsFromOperation(r.right,t),r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.query&&this.collectVarsFromOperation(r.query,t),r.where&&this.collectVarsFromOperation(r.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let r=e;r.type==="variable"&&t.add(r.value),r.type==="quoted"&&(this.collectVarsFromElement(r.subject,t),this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="variable"&&r.name&&t.add(r.name),r.type==="exists"&&r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.left&&this.collectVarsFromExpressionTree(r.left,t),r.right&&this.collectVarsFromExpressionTree(r.right,t),r.operands)for(let i of r.operands)this.collectVarsFromExpressionTree(i,t);if(r.args)for(let i of r.args)this.collectVarsFromExpressionTree(i,t);if(r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.list)for(let i of r.list)this.collectVarsFromExpressionTree(i,t)}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}isConstructQuery(e){return e.type==="construct"}async executeConstruct(e){if(e.type!=="construct")throw new Ul("executeConstruct requires a CONSTRUCT operation");let t=await this.executeAll(e.where);return this.constructExecutor.execute(e.template,t)}isAskQuery(e){return e.type==="ask"}async executeAsk(e){if(e.type!=="ask")throw new Ul("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};Mn.ExoQLQueryExecutor=$m;Mn.QueryExecutor=$m});var eO=w(uo=>{"use strict";var c8=uo&&uo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},l8=uo&&uo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},n1;Object.defineProperty(uo,"__esModule",{value:!0});uo.CommandResolver=void 0;var u8=Ve(),f8=ol(),Zt=Pe(),Ut=Ge(),W=zt(),zC=Yo(),KC=pf(),d8=cl(),h8=Up(),Vl=g_(),Um=BR(),p8=bl(),m8=Sl(),g8=Bl(),qf=10,Bm="exo__Asset",y8=qf+1,YC="08cec529-90eb-4d43-88de-ceecccea12b0",b8=W.Namespace.EXOCMD.term("SubstitutionToken").value,QC=new Set(["today","todayStart","targetFolder","target","randomUUIDv4","nowTimestamp","nowDate","nowYear","nowMonth","userInputLabel","userInput","targetProperty","labelAsArray","groundingTargetClass","targetClassSelf"]);function _8(n,e){return`__SUBSTITUTE__${n}__${e}__`}a(_8,"buildSubstitutionMarker");function S8(n,e,t){let r=(0,d8.utf8ToBase64)(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`__SUBSTITUTE_P__${n}__${e}__${r}__`}a(S8,"buildParameterisedMarker");var XC="3f28af98-c031-4718-8ba2-44ad0b012c52",w8=W.Namespace.EXOCMD.term("TokenInvocation").value,JC="29e2c8f8-2d27-4e58-b467-2e85d46f8122",ZC="universal-default-template",v8=new Set(["today","todayStart","nowTimestamp","nowDate","nowYear","nowMonth"]),i1=n1=class{static{a(this,"CommandResolver")}clearUniversalCache(){this._universalCacheReady=!1,this._universalCacheValue=null,(0,Um.clearUniversalDefault)()}constructor(e,t=f8.NullLogger){this.tripleStore=e,this.logger=t,this.cache=new Map,this.multiCache=new Map,this._ancestorDepthCache=new Map,this._legacyPropertyDefaultsWarnedGroundings=new Set,this._universalCacheReady=!1,this._universalCacheValue=null}async resolveForAssetMulti(e,t,r){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${r??""}`,o=this.multiCache.get(s);if(o)return o;let c=await this.expandClassHierarchy(t),l=new Map;for(let[h,p]of c){let g=await this.resolveForAsset(e,h,r);for(let y of g){let b=this.getBindingPriority(y.binding)===2?p:0,S=l.get(y.binding.id);(!S||b<S.depth)&&l.set(y.binding.id,{rc:y,depth:b})}}let u=new Set;for(let{rc:h}of l.values())if(h.binding.overrides)for(let p of h.binding.overrides)u.add(p);let f=Array.from(l.entries()).filter(([h])=>!u.has(h)).map(([,h])=>h);f.sort((h,p)=>{let g=this.getBindingPriority(h.rc.binding),y=this.getBindingPriority(p.rc.binding);return g!==y?g-y:h.depth!==p.depth?h.depth-p.depth:(h.rc.binding.order??100)-(p.rc.binding.order??100)});let d=f.map(h=>h.rc);return this.multiCache.set(s,d),d}async expandClassHierarchy(e){let t=new Map;for(let c of e){if(c===Bm){t.set(c,new Set);continue}let l=[];try{l=await this.getClassAncestors(c)}catch{l=[]}t.set(c,new Set(l))}let r=a(c=>{for(let l of e)if(l!==c&&t.get(l)?.has(c)&&!t.get(c)?.has(l))return!0;return!1},"isAncestorOfSibling"),i=e.filter(c=>!r(c)),s=new Map,o=a((c,l)=>{let u=s.get(c);(u===void 0||l<u)&&s.set(c,l)},"setMin");for(let c of i){if(o(c,0),this.looksLikeUUID(c))try{let u=await this.resolveLabelByUID(c);u&&o(u,0)}catch{}if(c===Bm)continue;let l=[];try{l=await this.getClassAncestorsWithDepth(c)}catch{l=[]}for(let{ref:u,depth:f}of l)o(u,f)}return s.has(Bm)||s.set(Bm,y8),s}async resolveForAsset(e,t,r){let i=`${e}:${t}:${r??""}`,s=this.cache.get(i);if(s)return s;let o=await this.findBindings(t,r,e),c=[];for(let l of o){let u=await this.loadCommand(l.commandRef,{targetClass:l.targetClass});if(!u)continue;let f=l.precondition?{...u,precondition:l.precondition}:u;c.push({command:f,binding:l})}return c.sort((l,u)=>{let f=this.getBindingPriority(l.binding),d=this.getBindingPriority(u.binding);return f!==d?f-d:(l.binding.order??100)-(u.binding.order??100)}),this.cache.set(i,c),c}async loadCommand(e,t){let r=await this.findSubjectByUID(e);if(!r||(await this.tripleStore.match(r,W.Namespace.RDF.term("type"),W.Namespace.EXOCMD.term("Command"))).length===0)return null;let s=await this.getLiteralValue(r,W.Namespace.EXO.term("Asset_label"))??"Unknown Command",o=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_labelTemplate")),c=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_icon")),l=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_confirmMessage")),u=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_successMessage")),f=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_category")),d=await this.getLiteralValue(r,W.Namespace.EXOCMD.term("Command_openInSameTab")),h=d!==null&&String(d).trim().toLowerCase()==="true",p=await this.loadLinkedPrecondition(r),g=await this.loadLinkedGrounding(r,0,t);return g?{id:e,name:s,labelTemplate:o??void 0,icon:c??void 0,precondition:p??void 0,grounding:g,confirmMessage:l??void 0,successMessage:u??void 0,category:f??void 0,openInSameTab:h||void 0}:null}async findBindings(e,t,r){let i=await this.tripleStore.match(void 0,W.Namespace.RDF.term("type"),W.Namespace.EXOCMD.term("CommandBinding")),s=[];for(let o of i){let c=o.subject,l=await this.loadBindingDefinition(c);l&&this.bindingMatches(l,e,t,r)&&s.push(l)}return s}async findPaletteEnabledCommands(){let e=await this.tripleStore.match(void 0,W.Namespace.RDF.term("type"),W.Namespace.EXOCMD.term("Command")),t=[],r=new Set;for(let i of e){let s=i.subject;if((await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Command_paletteEnabled")))?.toLowerCase()!=="true")continue;let c=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_uid"));if(!c){this.logger.warn(`[CommandResolver] paletteEnabled command at ${s.value} has no exo__Asset_uid \u2014 skipped`);continue}let l=await this.loadCommand(c);if(!l){this.logger.warn(`[CommandResolver] paletteEnabled command ${c} could not be loaded (missing grounding?) \u2014 skipped`);continue}let u=await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Command_paletteId")),f=await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Command_cliName")),d=u??f??c;if(r.has(d)){this.logger.warn(`[CommandResolver] duplicate paletteId "${d}" \u2014 first registration wins, dropping ${c}`);continue}r.add(d),t.push({command:l,paletteId:d})}return t}invalidateCache(){this.cache.clear(),this.multiCache.clear(),this._ancestorDepthCache.clear()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let r=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:o}of i){let c=await this.evaluateSelectSnippet(o,t);r=r.replace(s,c)}return r}extractPlaceholders(e){let t=[],r=0;for(;r<e.length;)if(e[r]==="{"){let i=1,s=r+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let o=e.slice(r,s),c=e.slice(r+1,s-1);t.push({full:o,body:c})}r=s}else r++;return t}async evaluateSelectSnippet(e,t){try{let r=e.replace(/\$target/g,`<${t}>`),s=new p8.ExoQLParser().parse(r),c=new m8.ExoQLAlgebraTranslator().translate(s),u=await new g8.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let h=f.get(d[0]);return h?h instanceof Ut.Literal||h instanceof Zt.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,W.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,W.Namespace.EXOCMD.term("CommandBinding_targetClass")),o=await this.getLinkedValue(e,W.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,W.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!o&&!c)return null;let l=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,h=await this.loadLinkedPreconditionFromProperty(e,W.Namespace.EXOCMD.term("CommandBinding_precondition")),p=await this.loadLinkedStyle(e,t),g=await this.getLinkedUIDs(e,W.Namespace.EXOCMD.term("CommandBinding_overrides"));return{id:t,label:r,commandRef:i,targetClass:s??void 0,targetPrototype:o??void 0,targetAsset:c??void 0,position:l??void 0,order:u?parseInt(u,10):void 0,variant:d,precondition:h??void 0,style:p??void 0,overrides:g.length>0?g:void 0}}async loadLinkedStyle(e,t){let r=await this.tripleStore.match(e,W.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(r.length>0){let s=r[0].object,o=null;if(s instanceof Zt.IRI)o=s;else if(s instanceof Ut.Literal){let c=this.normalizeWikilink(s.value);o=await this.findSubjectByUID(c)}if(o){let c=await this.loadStyleAsset(o);if(c)return c}this.logger.warn(this.capWarning(`CommandBinding ${t}: style reference unresolved, falling back to inline variant`))}let i=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBinding_variant"));if(i!==null){let s=this.coerceVariant(i,t);if(s!==void 0)return{id:`inline:${t}`,label:"",variant:s,inline:!0}}return null}async loadStyleAsset(e){let t=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,o=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(o),l=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),h=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),p=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("CommandBindingStyle_source")),g=p!==null?this.coerceStyleSource(p,t):void 0;return{id:t,label:r,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:h??void 0,source:g,inline:!1}}coerceVariant(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Vl.COMMAND_VARIANT_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${r}" not in whitelist [${Vl.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Vl.LABEL_CLASS_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${r}" not in whitelist [${Vl.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Vl.STYLE_SOURCE_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle source "${r}" not in whitelist [${Vl.STYLE_SOURCE_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceBoolean(e){if(e===null)return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}capWarning(e){return e.length<=200?e:e.slice(0,197)+"..."}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let o=this.extractPathBasename(r);if(o&&o===i)return!0;let c=this.extractAlias(t);if(c&&r===c)return!0;let l=this.extractAlias(e);return!!(l&&l===i)}extractPathBasename(e){let t=e.match(/\/([^/]+)\.md$/);return t?t[1]:null}extractAlias(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(r+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,W.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Zt.IRI)s=i;else if(i instanceof Ut.Literal){let h=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(h)}if(!s)return null;let o=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,W.Namespace.EXOCMD.term("Precondition_hostFunction")),f=await this.tripleStore.match(s,W.Namespace.EXOCMD.term("Precondition_query"),void 0),d;if(f.length>0){let h=f[0].object;if(h instanceof Zt.IRI){let p=await this.getLiteralValue(h,W.Namespace.EXO.term("Asset_uid"));p&&(d=p)}else h instanceof Ut.Literal&&(d=this.normalizeWikilink(h.value))}return!o||!l&&!u&&!d?null:{id:o,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u},...d&&{query:d}}}async loadLinkedGrounding(e,t,r){if(t>=qf)return null;let i=await this.tripleStore.match(e,W.Namespace.EXOCMD.term("Command_grounding"),void 0);if(i.length===0)return null;if(i.length===1||!r?.targetClass){let o=await this.resolveGroundingRef(i[0].object);return o?this.loadGroundingDefinition(o,t):null}for(let o of i){let c=await this.resolveGroundingRef(o.object);if(!c)continue;let l=await this.getObsidianName(c,W.Namespace.EXOCMD.term("Grounding_targetPrototype"));if(l&&this.matchesReference(l,r.targetClass))return this.loadGroundingDefinition(c,t)}this.logger.warn(`Command ${e.value}: ${i.length} groundings declared, none matched context.targetClass='${r.targetClass}' via Grounding_targetPrototype \u2014 falling back to first grounding by iteration order (legacy behaviour). Check that one grounding's Grounding_targetPrototype references this targetClass.`);let s=await this.resolveGroundingRef(i[0].object);return s?this.loadGroundingDefinition(s,t):null}async resolveGroundingRef(e){if(e instanceof Zt.IRI)return e;if(e instanceof Ut.Literal){let t=this.normalizeWikilink(e.value);return await this.findSubjectByUID(t)}return null}async loadGroundingByUid(e){let t=await this.findSubjectByUID(e);return t?this.loadGroundingDefinition(t,0):null}async loadGroundingDefinition(e,t){if(t>=qf)return null;let r=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,W.Namespace.EXO.term("Asset_label"))??"",s=await this.resolveGroundingTypeReference(e);if(!s)return null;let o=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetProperty"));if(o&&this.looksLikeUUID(o)){let Q=await this.resolveLabelByUID(o);if(!Q)return this.logger.warn(`Grounding ${r}: targetProperty wikilink UID '${o}' is not resolvable to exo__Asset_label \u2014 grounding skipped (would otherwise write a UUID-named frontmatter key).`),null;o=Q}if(s===zC.GroundingType.SERVICE_CALL){let Q=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_serviceId"));Q&&(o=Q)}let c=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetValueRef")),l=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_targetValueLiteral")),u=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetValueSubstitution")),f=null;if(u&&this.looksLikeUUID(u)){let Q=await this.resolveLabelByUID(u);if(!Q)return this.logger.warn(`Grounding ${r}: targetValueSubstitution UID '${u}' is not resolvable to exo__Asset_label (SubstitutionToken instance missing or unlabelled) \u2014 grounding skipped.`),null;f=Q}else u&&(f=u);let d=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetValueQuery")),h=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_serviceCallPayload")),p=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_appendExpression")),g=await this.getObsidianWikilinkValue(e,W.Namespace.EXOCMD.term("Grounding_isDefinedBy")),y=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),b=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetClass"));if(b&&!this.looksLikeUUID(b)){let Q=await this.findUidByLabel(b);Q&&(b=Q)}let S=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_targetPrototype")),v=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_targetFolder")),I=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_linkBackProperty")),A=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_inputSchema")),T=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_incrementBy")),R=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_shiftDelta")),V;if(T!=null&&T!==""){let Q=Number.parseInt(String(T),10);Number.isFinite(Q)&&(V=Q)}let L=await this.resolvePropertyDefaults(e,r),P=await this.resolveInheritanceRules(e,r),k=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_propertyDefaults"));k!==null&&k!==""&&!this._legacyPropertyDefaultsWarnedGroundings.has(r)&&(this.logger.warn(`Grounding ${r}: deprecated exocmd__Grounding_propertyDefaults (plural) JSON predicate detected \u2014 the parser was removed in RFC v2 Phase 5 (#3167); value is ignored. Migrate to ref-form exocmd__Grounding_propertyDefault (singular) pointing to exocmd__PropertyDefault assets. See vault TBox c8f87363-d39c-45cb-9d4d-1be96d70f892 for the canonical replacement.`),this._legacyPropertyDefaultsWarnedGroundings.add(r));let O;s===zC.GroundingType.COMPOSITE&&(O=await this.loadCompositeSteps(e,t+1));let J;if(A)try{let Q=JSON.parse(A);Q?.properties&&(J=Object.entries(Q.properties).map(([G,te])=>{let Se=te.type,X=Se==="string"?"text":Se,$e=te.defaultValue!==void 0?te.defaultValue:te.default,Be={name:G,type:X,label:te.title??G,required:Array.isArray(Q.required)&&Q.required.includes(G)};return $e!=null&&(Be.defaultValue=String($e)),typeof te.targetClassUid=="string"&&(Be.targetClassUid=te.targetClassUid),Be}))}catch{}let re=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_prefillLabelWithDate")),Y=re!==null&&String(re).trim().toLowerCase()==="true",ye=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_labelTemplate")),de=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_direction")),le;if(de!=null){let Q=String(de).trim().toLowerCase();Q==="forward"||Q==="rollback"?le=Q:Q!==""&&this.logger.warn(`Grounding ${r}: exocmd__Grounding_direction value '${de}' is not 'forward' or 'rollback' \u2014 treating as undefined (will default to 'forward' at dispatch).`)}let q=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("Grounding_bodyTemplate")),M=await this.getObsidianName(e,W.Namespace.EXOCMD.term("Grounding_templateRef")),je={id:r,label:i,type:s,targetProperty:o??void 0,targetValueRef:c??void 0,targetValueLiteral:l??void 0,targetValueSubstitution:f??void 0,targetValueQuery:d??void 0,serviceCallPayload:h??void 0,appendExpression:p??void 0,sparqlUpdate:y??void 0,steps:O,targetClass:b??void 0,targetPrototype:S??void 0,targetFolder:v??void 0,linkBackProperty:I??void 0,incrementBy:V,shiftDelta:R??void 0,propertyDefault:L.length>0?L:void 0,inheritanceRule:P.length>0?P:void 0,isDefinedBy:g??void 0,prefillLabelWithDate:Y||void 0,labelTemplate:ye??void 0,direction:le,bodyTemplate:q??void 0,templateRef:M??void 0};return J&&(je.inputSchema=J),je}async loadCompositeSteps(e,t){if(t>=qf)return[];let r=await this.tripleStore.match(e,W.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let o=null;if(s.object instanceof Zt.IRI)o=s.object;else if(s.object instanceof Ut.Literal){let l=this.normalizeWikilink(s.object.value);o=await this.findSubjectByUID(l)}if(!o)continue;let c=await this.loadGroundingDefinition(o,t);c&&i.push(c)}return i}async resolvePropertyDefaults(e,t){let r=await this.resolvePropertyDefaultsForSubject(e,t,W.Namespace.EXOCMD.term("Grounding_propertyDefault")),i=await this.getUniversalCache();return i&&i.propertyDefaults.length>0?(0,Um.mergePropertyDefaults)(i.propertyDefaults,r):r}async resolvePropertyDefaultsForSubject(e,t,r){let i=await this.tripleStore.match(e,r,void 0),s=[];for(let o of i){let c=await this.resolveRefTripleObject(o.object);if(!c)continue;let l=await this.getObsidianName(c,W.Namespace.EXOCMD.term("PropertyDefault_property"));if(!l){this.logger.warn(`Grounding ${t}: PropertyDefault asset missing exocmd__PropertyDefault_property \u2014 entry skipped.`);continue}let u=this.looksLikeUUID(l)?await this.resolveLabelByUID(l):l;if(!u){this.logger.warn(`Grounding ${t}: PropertyDefault property UID '${l}' is not resolvable to exo__Asset_label \u2014 entry skipped.`);continue}let f=await this.getObsidianName(c,W.Namespace.EXOCMD.term("PropertyDefault_value"));if(!f){this.logger.warn(`Grounding ${t}: PropertyDefault '${u}' missing exocmd__PropertyDefault_value \u2014 entry skipped.`);continue}let d=await this.resolvePropertyDefaultValue(f,t,u);d!==null&&s.push({propertyName:u,value:d})}return s}async getUniversalCache(){if(this._universalCacheReady)return this._universalCacheValue;this._universalCacheReady=!0;let e=await(0,Um.loadUniversalDefault)();if(e)return this._universalCacheValue=e,e;let t=await this.findUniversalSingleton();if(!t)return this._universalCacheValue=null,null;let r=await this.resolvePropertyDefaultsForSubject(t,ZC,W.Namespace.EXOCMD.term("Template_propertyDefault")),i=await this.resolveInheritanceRulesForSubject(t,ZC,W.Namespace.EXOCMD.term("Template_inheritanceRule"));return this._universalCacheValue={propertyDefaults:r,inheritanceRules:i},this._universalCacheValue}async findUniversalSingleton(){let e=W.Namespace.EXOCMD.term("UniversalDefaultTemplate").value,t=await this.tripleStore.match(void 0,W.Namespace.EXO.term("Instance_class"),void 0),r=[];for(let i of t){let s=!1;if(i.object instanceof Zt.IRI)s=i.object.value===e||i.object.value.includes(JC);else if(i.object instanceof Ut.Literal){let o=this.unwrapWikilink(i.object.value);s=o==="exocmd__UniversalDefaultTemplate"||o===JC}s&&i.subject instanceof Zt.IRI&&r.push(i.subject)}return r.length===0?null:(r.length===1||(r.sort((i,s)=>i.value.localeCompare(s.value)),this.logger.warn(`Multiple UniversalDefaultTemplate singletons found (${r.length}); selecting deterministically by lexicographic UID order: ${r[0].value}`)),r[0])}async resolveInheritanceRules(e,t){let r=await this.resolveInheritanceRulesForSubject(e,t,W.Namespace.EXOCMD.term("Grounding_inheritanceRule")),i=await this.getUniversalCache();return i&&i.inheritanceRules.length>0?(0,Um.mergeInheritanceRules)(i.inheritanceRules,r):r}async resolveInheritanceRulesForSubject(e,t,r){let i=await this.tripleStore.match(e,r,void 0),s=[],o=t;for(let c of i){let l=await this.resolveRefTripleObject(c.object);if(!l)continue;let u=await this.resolveLabelRef(l,W.Namespace.EXOCMD.term("InheritanceRule_sourceProperty"));if(!u){this.logger.warn(`Grounding ${o}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_sourceProperty \u2014 entry skipped.`);continue}let f=await this.resolveLabelRef(l,W.Namespace.EXOCMD.term("InheritanceRule_targetProperty"));if(!f){this.logger.warn(`Grounding ${o}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_targetProperty \u2014 entry skipped.`);continue}let d=await this.tripleStore.match(l,W.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"),void 0),h,p;if(d.length>0){let A=await this.getObsidianName(l,W.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"));if(!A||!A.trim()){this.logger.warn(`Grounding ${o}: InheritanceRule has exocmd__InheritanceRule_targetClassCondition triple but ref is unresolvable \u2014 entire rule skipped (would otherwise apply unconditionally, broadening scope).`);continue}this.looksLikeUUID(A)?(p=A,h=await this.resolveLabelByUID(A)??void 0):h=A}let g=await this.tripleStore.match(l,W.Namespace.EXOCMD.term("InheritanceRule_targetClassExclusion"),void 0),y=[],b=[],S=!1;for(let A of g){let T=null;if(A.object instanceof Zt.IRI?T=this.iriToObsidianName(A.object.value)??A.object.value:A.object instanceof Ut.Literal&&(T=this.unwrapWikilink(A.object.value)),!T){S=!0;continue}if(this.looksLikeUUID(T)){b.push(T);let R=await this.resolveLabelByUID(T);R&&y.push(R)}else y.push(T)}if(S){this.logger.warn(`Grounding ${o}: InheritanceRule has unresolvable exocmd__InheritanceRule_targetClassExclusion entry \u2014 entire rule skipped (would otherwise expand scope by silently dropping the excluded class).`);continue}let v=await this.getLiteralValue(l,W.Namespace.EXOCMD.term("InheritanceRule_priority")),I=50;if(v!==null&&v!==""){let A=Number.parseInt(String(v),10);Number.isFinite(A)&&(I=A)}s.push({sourcePropertyName:u,targetPropertyName:f,targetClassCondition:h,targetClassConditionUid:p,targetClassExclusion:y,targetClassExclusionUids:b,priority:I})}return s}async resolveRefTripleObject(e){if(e instanceof Zt.IRI)return e;if(e instanceof Ut.Literal){let t=this.normalizeWikilink(e.value);return t?this.findSubjectByUID(t):null}return null}async resolveLabelRef(e,t){let r=await this.getObsidianName(e,t);return r?this.looksLikeUUID(r)?this.resolveLabelByUID(r):r:null}async resolvePropertyDefaultValue(e,t,r){if(!this.looksLikeUUID(e))return`"[[${e}]]"`;let i=await this.findSubjectByUID(e);return i?await this.assetIsTokenInvocation(i)?this.resolveTokenInvocation(i,e,t,r):await this.assetIsSubstitutionToken(i)?this.dispatchSubstitutionToken(i,e,t,r,void 0):`"[[${e}]]"`:`"[[${e}]]"`}async dispatchSubstitutionToken(e,t,r,i,s){let o=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("SubstitutionToken_resolver"));if(!o||!o.trim())return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' references SubstitutionToken '${t}' with no exocmd__SubstitutionToken_resolver \u2014 falling back to wikilink form.`),`"[[${t}]]"`;let c=o.trim();return QC.has(c)?s!==void 0?S8(c,t,s):v8.has(c)?n1.parseTimeResolve(c):_8(c,t):(this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' SubstitutionToken '${t}' declares unknown resolver-id '${c}' \u2014 falling back to wikilink form. Known ids: ${Array.from(QC).join(", ")}.`),`"[[${t}]]"`)}static parseTimeResolve(e){let t=new Date,r=a(i=>i<10?`0${i}`:String(i),"pad");switch(e){case"today":return t.toISOString().slice(0,10);case"todayStart":return new Date(new Date().setHours(0,0,0,0)).toISOString();case"nowTimestamp":return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`;case"nowDate":return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`;case"nowYear":return String(t.getFullYear());case"nowMonth":return r(t.getMonth()+1);default:return""}}async resolveTokenInvocation(e,t,r,i){let s=await this.getObsidianName(e,W.Namespace.EXOCMD.term("TokenInvocation_token"));if(!s)return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' missing exocmd__TokenInvocation_token \u2014 entry skipped.`),null;let o=await this.getLiteralValue(e,W.Namespace.EXOCMD.term("TokenInvocation_parameter"))??"";if(!this.looksLikeUUID(s))return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' references non-UUID token '${s}' \u2014 entry skipped.`),null;let c=await this.findSubjectByUID(s);return c?this.dispatchSubstitutionToken(c,s,r,i,o):(this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' token ref '${s}' not found in store \u2014 entry skipped.`),null)}async assetIsTokenInvocation(e){let t=await this.tripleStore.match(e,W.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof Zt.IRI){if(r.object.value===w8||r.object.value.includes(XC))return!0}else if(r.object instanceof Ut.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__TokenInvocation"||i===XC)return!0}return!1}async assetIsSubstitutionToken(e){let t=await this.tripleStore.match(e,W.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof Zt.IRI){if(r.object.value===b8||r.object.value.includes(YC))return!0}else if(r.object instanceof Ut.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__SubstitutionToken"||i===YC)return!0}return!1}async resolveGroundingTypeReference(e){let t=await this.tripleStore.match(e,W.Namespace.EXOCMD.term("Grounding_type"),void 0);if(t.length===0)return null;let r=t[0].object;if(r instanceof Zt.IRI)return(0,KC.resolveGroundingTypeFromIRI)(r.value);if(r instanceof Ut.Literal){let i=r.value,s=i.match(/^\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]$/i);return s?(0,KC.resolveGroundingTypeFromIRI)(`obsidian://vault/${s[1].toLowerCase()}.md`):(this.logger.warn(`[exocmd-grounding-type-literal-form] legacy literal-string form '${i}' for exocmd__Grounding_type on <${e.value}>. Migrate to wikilink form per RFC 9d20c91f Phase 3.`),null)}return null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let r=await this.tripleStore.findSubjectsByUUID(e);if(r.length>0)return r[0]}let t=await this.tripleStore.match(void 0,W.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof Ut.Literal&&r.object.value===e)return r.subject;return null}async getLiteralValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Ut.Literal||i instanceof Zt.IRI?i.value:null}looksLikeUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}async resolveLabelByUID(e){let t=await this.findSubjectByUID(e);return t?this.getLiteralValue(t,W.Namespace.EXO.term("Asset_label")):null}async getClassAncestors(e){return(await this.getClassAncestorsWithDepth(e)).map(r=>r.ref)}async getClassAncestorsWithDepth(e){let t=this._ancestorDepthCache.get(e);if(t)return t;let r=new Map,i=new Set,s=await this.resolveClassFileIRI(e);if(!s)return[];let o=new Set([e]),c=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_uid"));c&&o.add(c);let l=await this.getLiteralValue(s,W.Namespace.EXO.term("Asset_label"));l&&o.add(l);let u=a((h,p)=>{if(o.has(h))return;let g=r.get(h);(g===void 0||p<g)&&r.set(h,p)},"setMin"),f=[{fileIRI:s,depth:0}];for(;f.length>0;){let h=f.shift();if(!h)break;let{fileIRI:p,depth:g}=h;if(g>=qf||i.has(p.value))continue;i.add(p.value);let y=await this.tripleStore.match(p,W.Namespace.EXO.term("Class_superClass"),void 0);for(let b of y){let S=b.object;if(!(S instanceof Zt.IRI))continue;let v=g+1,I=S.value.startsWith("obsidian://vault/"),A=this.iriToObsidianName(S.value);A&&u(A,v);let T=null;if(I?T=S:A&&(T=await this.resolveClassFileIRI(A)),!T)continue;let R=await this.getLiteralValue(T,W.Namespace.EXO.term("Asset_uid"));R&&u(R,v),i.has(T.value)||f.push({fileIRI:T,depth:v})}}let d=Array.from(r.entries()).map(([h,p])=>({ref:h,depth:p}));return this._ancestorDepthCache.set(e,d),d}async resolveClassFileIRI(e){if(this.looksLikeUUID(e))return this.findSubjectByUID(e);let t=await this.findUidByLabel(e);return t?this.findSubjectByUID(t):null}async findUidByLabel(e){let t=await this.tripleStore.match(void 0,W.Namespace.EXO.term("Asset_label"),void 0);for(let r of t)if(r.object instanceof Ut.Literal&&r.object.value===e&&r.subject instanceof Zt.IRI){let i=await this.tripleStore.match(r.subject,W.Namespace.EXO.term("Asset_uid"),void 0);if(i.length>0&&i[0].object instanceof Ut.Literal)return i[0].object.value}return null}async getLinkedUID(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Zt.IRI){let s=await this.tripleStore.match(i,W.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof Ut.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof Ut.Literal?this.normalizeWikilink(i.value):null}async getLinkedUIDs(e,t){let r=await this.tripleStore.match(e,t,void 0),i=[];for(let s of r){let o=s.object;if(o instanceof Zt.IRI){let c=await this.tripleStore.match(o,W.Namespace.EXO.term("Asset_uid"),void 0);if(c.length>0&&c[0].object instanceof Ut.Literal)i.push(c[0].object.value);else{let l=o.value.split("/").pop()?.replace(".md","");l&&i.push(l)}}else if(o instanceof Ut.Literal){let c=this.normalizeWikilink(o.value);c&&i.push(c)}}return i}async getLinkedValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Ut.Literal?this.normalizeWikilink(i.value):i instanceof Zt.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Ut.Literal?this.unwrapWikilink(i.value):i instanceof Zt.IRI?this.iriToObsidianName(i.value)??i.value:null}unwrapWikilink(e){if(!e)return e;let t=e.trim().replace(/^"|"$/g,"");if(t.startsWith("http://")||t.startsWith("https://"))return this.iriToObsidianName(t)??t;let r=t.match(/^\[\[([^\]|]+)\|([^\]]+)\]\]$/);if(r)return r[2].trim();let i=t.match(/^\[\[([^\]|]+)\]\]$/);if(i){let s=i[1].trim();return s.startsWith("http://")||s.startsWith("https://")?this.iriToObsidianName(s)??s:s}return t}async getObsidianWikilinkValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Ut.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof Zt.IRI){let s=this.iriToObsidianName(i.value);return s?`"[[${s}]]"`:i.value}return null}async resolveWikilinkAlias(e){let t=e.match(/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\]/);if(!t)return e;let r=t[1],i=await this.findSubjectByUID(r);if(!i)return e;let s=await this.getLiteralValue(i,W.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${r}]]`,`[[${r}|${s}]]`):e}iriToObsidianName(e){return(0,h8.iriToObsidianName)(e)}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(0,r):t}};uo.CommandResolver=i1;uo.CommandResolver=i1=n1=c8([(0,u8.injectable)(),l8("design:paramtypes",[Object,Object])],i1)});var o1=w(s1=>{"use strict";Object.defineProperty(s1,"__esModule",{value:!0});s1.validateExoQLAllowlist=E8;var Vm=Bf();function E8(n){if(!n||typeof n!="object")return;let e=n;if(e.type==="update"){let t=n.updates??[];for(let r of t)if(r?.type==="load")throw new Vm.ExoQLForbiddenKeywordError("LOAD");throw new Vm.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,r=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||r)throw new Vm.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)qm(t);if(Array.isArray(e.template))for(let t of e.template)qm(t)}}a(E8,"validateExoQLAllowlist");function qm(n){if(!n||typeof n!="object")return;if(n.type==="service")throw new Vm.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(n.patterns))for(let t of n.patterns)qm(t);let e=n.where;if(Array.isArray(e))for(let t of e)qm(t)}a(qm,"walkPatternForBannedKeywords")});var a1=w(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.DEFAULT_EVAL_CONFIG=void 0;Gm.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var Wm=w(c1=>{"use strict";Object.defineProperty(c1,"__esModule",{value:!0});c1.evaluateWithExoEval=O8;var T8=bl(),A8=Sl(),I8=Bl(),x8=o1(),R8=a1(),C8=Bf();async function O8(n,e={}){if(typeof n!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let r=new T8.ExoQLParser().parse(n);if((0,x8.validateExoQLAllowlist)(r),!{...R8.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new C8.ExoQLEvalDisabledError;let s="queryType"in r&&typeof r.queryType=="string"?r.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new A8.ExoQLAlgebraTranslator().translate(r),l=new I8.ExoQLQueryExecutor(e.store);return l.isAskQuery(c)?{kind:"ask",result:await l.executeAsk(c)}:l.isConstructQuery(c)?{kind:"construct",triples:await l.executeConstruct(c)}:{kind:"select",rows:await l.executeAll(c)}}a(O8,"evaluateWithExoEval")});var Gf=w(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.liveClock=P8;Hm.frozenClock=F8;function P8(){return{now:a(()=>new Date,"now")}}a(P8,"liveClock");function F8(n){let e=new Date(n);return{now:a(()=>new Date(e.getTime()),"now")}}a(F8,"frozenClock")});var rO=w(fo=>{"use strict";var D8=fo&&fo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},L8=fo&&fo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Wf;Object.defineProperty(fo,"__esModule",{value:!0});fo.PreconditionEvaluator=void 0;var N8=Ve(),k8=bl(),M8=Sl(),tO=Bl(),j8=Wm(),$8=Gf(),Hf=Wf=class{static{a(this,"PreconditionEvaluator")}constructor(e,t,r){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t,this.clock=r?.clock??(0,$8.liveClock)()}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.query?this.evaluateQueryRef(e.query,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return!1;let i=this.substituteVariables(r,t),s=await(0,j8.evaluateWithExoEval)(i,{store:this.tripleStore});return s.kind!=="ask"?!1:s.result}catch{return!1}}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}evaluateHostFunctionSync(e,t,r){return this.hostFunctions.has(e)?this.evaluateHostFunction(e,t,r):null}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Wf.SENTINEL_IRI),i=new k8.ExoQLParser().parse(t),o=new M8.ExoQLAlgebraTranslator().translate(i);return new tO.ExoQLQueryExecutor(this.tripleStore).isAskQuery(o)?o:null}evaluateHostFunction(e,t,r){let i=this.hostFunctions.get(e);if(!i)return!0;let s=r?{...r,targetIRI:t}:{targetIRI:t};try{return i(s)}catch{return!1}}async evaluateSparqlAsk(e,t){try{let r=this.askCache.get(e);if(r===void 0){let o=this.compileAsk(e);if(!o)return!1;r=o,this.askCache.set(e,r)}let i=JSON.parse(JSON.stringify(r).replaceAll(Wf.SENTINEL_IRI,t));return await new tO.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=this.clock.now(),i=r.toISOString(),s=i.slice(0,10),o=new Date(r.getTime()+Wf.ALMATY_OFFSET_MS),c=o.getUTCFullYear(),l=o.getUTCMonth(),u=o.getUTCDate(),f=o.getUTCDay(),h=new Date(Date.UTC(c,l,u-1)).toISOString().slice(0,10),p=(f+6)%7,g=new Date(Date.UTC(c,l,u-p)),y=g.toISOString().slice(0,10),S=new Date(g.getTime()-10080*60*1e3).toISOString().slice(0,10),v=`${c}-${String(l+1).padStart(2,"0")}-01`,I=l===0?11:l-1,T=`${l===0?c-1:c}-${String(I+1).padStart(2,"0")}-01`,R=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${i}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${y}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${S}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${v}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${T}"^^xsd:date`).replace(/\$thisYearStart/g,`"${R}"^^xsd:date`).replace(/\$today/g,`"${s}"^^xsd:date`)}};fo.PreconditionEvaluator=Hf;Hf.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";Hf.ALMATY_OFFSET_MS=300*60*1e3;fo.PreconditionEvaluator=Hf=Wf=D8([(0,N8.injectable)(),L8("design:paramtypes",[Object,Object,Object])],Hf)});var nO=w(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.hasUidFilename=ho.hasNonUidFilename=void 0;ho.registerDefaultHostFunctions=V8;var U8=a(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t!==e},"hasNonUidFilename");ho.hasNonUidFilename=U8;var B8=a(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t===e},"hasUidFilename");ho.hasUidFilename=B8;function V8(n){n.registerHostFunction("hasNonUidFilename",ho.hasNonUidFilename),n.registerHostFunction("hasUidFilename",ho.hasUidFilename)}a(V8,"registerDefaultHostFunctions")});var Km=w(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.liveUidGenerator=q8;zm.seededUidGenerator=W8;var l1=Ii();function q8(){return{next:a(()=>(0,l1.v4)(),"next")}}a(q8,"liveUidGenerator");var G8="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function W8(n){let e=0,t=(0,l1.v5)(n,G8);return{next:a(()=>{let r=`${n}#${e}`;return e+=1,(0,l1.v5)(r,t)},"next")}}a(W8,"seededUidGenerator")});var Xm=w(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.registerResolver=ar;ca.getResolver=H8;ca.isResolverModifierAware=z8;ca.getRegisteredResolverIds=K8;ca.clearResolvers=Y8;ca.installDefaultResolvers=sB;var Qm=new Map,u1=new Set;function ar(n,e,t=!1){Qm.set(n,e),t&&u1.add(n)}a(ar,"registerResolver");function H8(n){return Qm.get(n)}a(H8,"getResolver");function z8(n){return u1.has(n)}a(z8,"isResolverModifierAware");function K8(){return Array.from(Qm.keys())}a(K8,"getRegisteredResolverIds");function Y8(){Qm.clear(),u1.clear()}a(Y8,"clearResolvers");function bn(n){return n<10?`0${n}`:String(n)}a(bn,"pad2");var Q8=["January","February","March","April","May","June","July","August","September","October","November","December"],X8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],J8=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Z8=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function eB(n){let e=["th","st","nd","rd"],t=n%100;return`${n}${e[(t-20)%10]||e[t]||e[0]}`}a(eB,"ordinalDay");var tB=/YYYY|YY|MMMM|MMM|MM|M|Do|DD|D|dddd|ddd|HH|H|hh|h|mm|m|ss|s|A|a/g;function rB(n,e){let t=(n.getHours()+11)%12+1;return e.replace(tB,r=>{switch(r){case"YYYY":return String(n.getFullYear());case"YY":return bn(n.getFullYear()%100);case"MMMM":return Q8[n.getMonth()];case"MMM":return X8[n.getMonth()];case"MM":return bn(n.getMonth()+1);case"M":return String(n.getMonth()+1);case"Do":return eB(n.getDate());case"DD":return bn(n.getDate());case"D":return String(n.getDate());case"dddd":return J8[n.getDay()];case"ddd":return Z8[n.getDay()];case"HH":return bn(n.getHours());case"H":return String(n.getHours());case"hh":return bn(t);case"h":return String(t);case"mm":return bn(n.getMinutes());case"m":return String(n.getMinutes());case"ss":return bn(n.getSeconds());case"s":return String(n.getSeconds());case"A":return n.getHours()<12?"AM":"PM";case"a":return n.getHours()<12?"am":"pm";default:return r}})}a(rB,"formatDate");function iO(n,e,t){let r=n.getDate(),i=new Date(n.getTime());i.setDate(1),t==="M"?i.setMonth(i.getMonth()+e):i.setFullYear(i.getFullYear()+e);let s=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();return i.setDate(Math.min(r,s)),i}a(iO,"addMonthsClamped");function nB(n,e){if(!e)return n;let t=e.match(/^([+-])(\d+)([dwMy])?$/);if(!t)return n;let r=(t[1]==="-"?-1:1)*parseInt(t[2],10),i=t[3]??"d",s=new Date(n.getTime());switch(i){case"d":s.setDate(s.getDate()+r);break;case"w":s.setDate(s.getDate()+r*7);break;case"M":s=iO(s,r,"M");break;case"y":s=iO(s,r,"y");break}return isNaN(s.getTime())?n:s}a(nB,"applyDateOffset");function iB(n){if(!n)return{offset:null,format:null};let e=n.indexOf(":");if(e<0)return{offset:n,format:null};let t=n.slice(0,e),r=n.slice(e+1);return{offset:t||null,format:r||null}}a(iB,"parseDateModifier");function Ym(n,e){return(t,r)=>{let{offset:i,format:s}=iB(r),o=new Date;return n!==0&&o.setDate(o.getDate()+n),o=nB(o,i),rB(o,s??e)}}a(Ym,"makeDateResolver");function sB(){ar("today",()=>new Date().toISOString().slice(0,10)),ar("todayStart",()=>new Date(new Date().setHours(0,0,0,0)).toISOString()),ar("date",Ym(0,"YYYY-MM-DD"),!0),ar("now",Ym(0,"YYYY-MM-DDTHH:mm:ss"),!0),ar("tomorrow",Ym(1,"YYYY-MM-DD"),!0),ar("yesterday",Ym(-1,"YYYY-MM-DD"),!0),ar("target",n=>n.targetIRI?`"[[${n.targetIRI}]]"`:""),ar("targetFolder",n=>{if(!n.targetFilePath)return"";let e=n.targetFilePath.replace(/^\/+/,""),t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}),ar("randomUUIDv4",()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();throw new Error("randomUUIDv4 resolver requires crypto.randomUUID() \u2014 runtime is missing Node crypto / Web Crypto API.")}),ar("nowTimestamp",()=>{let n=new Date;return`${n.getFullYear()}-${bn(n.getMonth()+1)}-${bn(n.getDate())}T${bn(n.getHours())}:${bn(n.getMinutes())}:${bn(n.getSeconds())}`}),ar("nowDate",()=>{let n=new Date;return`${n.getFullYear()}-${bn(n.getMonth()+1)}-${bn(n.getDate())}`}),ar("nowYear",()=>String(new Date().getFullYear())),ar("nowMonth",()=>bn(new Date().getMonth()+1)),ar("userInputLabel",n=>{let e=n.userInput?.label;return typeof e=="string"?e:""}),ar("userInput",(n,e)=>{if(!e)return null;let t=n.userInput?.[e];return typeof t=="string"?t:t==null?null:String(t)}),ar("targetProperty",(n,e)=>{if(!e||!n.targetFm)return null;let t=n.targetFm[e];return t==null?null:Array.isArray(t)?t.map(String):String(t)}),ar("labelAsArray",n=>{let e=n.userInput?.label;return typeof e=="string"&&e.length>0?[e]:[]}),ar("groundingTargetClass",n=>n.groundingTargetClassUid?`"[[${n.groundingTargetClassUid}]]"`:null),ar("targetClassSelf",n=>{if(!n.targetFilePath)return null;let e=n.targetFilePath.replace(/^\/+/,""),r=e.slice(e.lastIndexOf("/")+1).replace(/\.md$/i,"");return r.length>0?`"[[${r}]]"`:null})}a(sB,"installDefaultResolvers")});var d1=w(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.resolveTemplateBody=aB;Jm.stripTemplateFrontmatter=cB;var f1=Xm();(0,f1.installDefaultResolvers)();var oB=/\$([A-Za-z][A-Za-z0-9_]*)((?:[+-]\d+[dwMy])?(?::[A-Za-z0-9:./-]+)?)/g;function aB(n,e={}){return n.replace(oB,(t,r,i)=>{let s=(0,f1.getResolver)(r);if(s===void 0)return t;let o=s(e,i.length>0?i:void 0);return typeof o!="string"||o.length===0?t:(0,f1.isResolverModifierAware)(r)?o:o+i})}a(aB,"resolveTemplateBody");function cB(n){let e=n.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);return e?n.slice(e[0].length):n}a(cB,"stripTemplateFrontmatter")});var zf=w(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.registerOrderSpecLoader=lB;ql.clearOrderSpecLoader=uB;ql.loadDefaultSpec=fB;ql.orderProperties=dB;var Zm=null,la,eg=!1;function lB(n){Zm=n,la=void 0,eg=!1}a(lB,"registerOrderSpecLoader");function uB(){Zm=null,la=void 0,eg=!1}a(uB,"clearOrderSpecLoader");function fB(){if(la!==void 0)return la;if(!Zm)return la=null,null;try{la=Zm()}catch(n){eg||(console.warn("[OrderSpecResolver] loader threw, falling back to insertion order:",n),eg=!0),la=null}return la}a(fB,"loadDefaultSpec");function dB(n,e){if(!e||e.head.length===0&&e.tail.length===0)return n;let t=Object.keys(n),r=new Set(e.head),i=new Set(e.tail),s=e.head.filter(u=>Object.prototype.hasOwnProperty.call(n,u)),o=e.tail.filter(u=>Object.prototype.hasOwnProperty.call(n,u)),c=t.filter(u=>!r.has(u)&&!i.has(u));e.middleStrategy==="alphabetical"&&c.sort((u,f)=>u.localeCompare(f));let l={};for(let u of s)l[u]=n[u];for(let u of c)l[u]=n[u];for(let u of o)l[u]=n[u];return l}a(dB,"orderProperties")});var h1=w(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.STRING_SCALAR_PROPERTIES=void 0;fc.needsYamlQuoting=sO;fc.quoteYamlString=oO;fc.serializeYamlScalar=vB;var hB=/^[-!&*?|>%@`"'#,[\]{}]/,pB=/[\u0000-\u001f\u007f]/,mB=/^(?:true|True|TRUE|false|False|FALSE)$/,gB=/^(?:null|Null|NULL|~)$/,yB=/^[-+]?(?:0b[01_]+|0o[0-7_]+|0x[0-9a-fA-F_]+|[0-9][0-9_]*)$/,bB=/^(?:[-+]?[0-9][0-9_]*(?:\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\.(?:inf|Inf|INF)|\.(?:nan|NaN|NAN))$/,_B=/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;fc.STRING_SCALAR_PROPERTIES=new Set(["exo__Asset_label","aliases"]);function SB(n){if(n.length<2||!n.startsWith('"')||!n.endsWith('"'))return!1;let e=n.slice(1,-1);for(let t=0;t<e.length;t++){if(e[t]==="\\"){if(t+1>=e.length)return!1;t++;continue}if(e[t]==='"')return!1}return!0}a(SB,"isCompleteDoubleQuotedScalar");function wB(n){return mB.test(n)||gB.test(n)||yB.test(n)||bB.test(n)||_B.test(n)}a(wB,"looksLikeNonStringScalar");function sO(n,e=!1){return n===""?!0:SB(n)?!1:!!(n!==n.trim()||/:(\s|$)/.test(n)||/\s#/.test(n)||hB.test(n)||pB.test(n)||e&&wB(n))}a(sO,"needsYamlQuoting");function oO(n){let e="";for(let t=0;t<n.length;t++){let r=n[t],i=n.charCodeAt(t);r==="\\"?e+="\\\\":r==='"'?e+='\\"':r===`
|
|
71
71
|
`?e+="\\n":r==="\r"?e+="\\r":r===" "?e+="\\t":i<32||i===127?e+="\\x"+i.toString(16).toUpperCase().padStart(2,"0"):e+=r}return`"${e}"`}a(oO,"quoteYamlString");function vB(n,e=!1){return typeof n!="string"?String(n):sO(n,e)?oO(n):n}a(vB,"serializeYamlScalar")});var Es=w(tg=>{"use strict";Object.defineProperty(tg,"__esModule",{value:!0});tg.FrontmatterService=void 0;var aO=zf(),p1=h1(),Kf=class n{static{a(this,"FrontmatterService")}parse(e){let t=e.match(n.FRONTMATTER_REGEX);return t?{exists:!0,content:t[1],originalContent:e}:{exists:!1,content:"",originalContent:e}}parseObject(e){let t=this.parse(e);if(!t.exists)return null;let r={},i=t.content.split(/\r?\n/),s=null,o=null,c=a(()=>{s!==null&&o!==null&&(r[s]=o),s=null,o=null},"flushArray");for(let l of i){let u=/^ {2}- (.*)$/.exec(l);if(u){s!==null&&o!==null&&o.push(u[1].trim());continue}c();let f=/^([^:\s][^:]*):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(s=d,o=[]):r[d]=h}return c(),r}updateProperty(e,t,r){t=n.normalizeIRI(t),typeof r=="string"&&(r=n.normalizeIRIValue(r));let i=this.parse(e),s=this.serializeValue(t,r);if(!i.exists)return`---
|
|
72
72
|
${s}
|
|
73
73
|
---
|
|
@@ -221,7 +221,7 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>`});var Uv=w(Zr=>{"use strict";va
|
|
|
221
221
|
`,i=this.composePrefixes(t),s=this.serializePrefixes(i,r),o=this.nTriplesSerializer.serialize(e,{newline:r}).trimEnd();return s?o?`${s}${r}${r}${o}${r}`:`${s}${r}`:o?`${o}${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?{...tW,...e.prefixes??{}}:{...e.prefixes??{}}}serializeTriplesOnly(e,t){return this.nTriplesSerializer.serializeChunk(e,t).trimEnd()}};xg.TurtleSerializer=Gv});var w3=w(Rg=>{"use strict";Object.defineProperty(Rg,"__esModule",{value:!0});Rg.JSONLDSerializer=void 0;var _3=Pe(),S3=jt(),rW=Ge(),Ql=zt(),nW={rdf:Ql.Namespace.RDF.iri.value,rdfs:Ql.Namespace.RDFS.iri.value,owl:Ql.Namespace.OWL.iri.value,xsd:Ql.Namespace.XSD.iri.value,exo:Ql.Namespace.EXO.iri.value,ems:Ql.Namespace.EMS.iri.value},Wv=class{static{a(this,"JSONLDSerializer")}toDocument(e,t={}){let r={...nW,...t.context??{}},i=new Map;for(let s of e){let o=this.subjectToId(s.subject),c=this.compactIri(s.predicate.value,r),l=this.objectToJSONLD(s.object,r),u=i.get(o)??{"@id":o},f=u[c];f===void 0?u[c]=l:Array.isArray(f)?f.push(l):u[c]=[f,l],i.set(o,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 _3.IRI?e.value:e instanceof S3.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 _3.IRI)return{"@id":e.value};if(e instanceof S3.BlankNode)return{"@id":`_:${e.id}`};if(e instanceof rW.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}};Rg.JSONLDSerializer=Wv});var Kv=w(Cg=>{"use strict";Object.defineProperty(Cg,"__esModule",{value:!0});Cg.NTriplesParser=void 0;var iW=Xn(),v3=Pe(),Hv=Ge(),sW=jt(),Xl=zt(),oW={rdf:Xl.Namespace.RDF.iri.value,rdfs:Xl.Namespace.RDFS.iri.value,owl:Xl.Namespace.OWL.iri.value,xsd:Xl.Namespace.XSD.iri.value,exo:Xl.Namespace.EXO.iri.value,ems:Xl.Namespace.EMS.iri.value},zv=class{static{a(this,"NTriplesParser")}parse(e,t={}){let r={prefixes:{...oW,...t.prefixes??{}},strict:t.strict??!1},i=[];return e.split(/\r?\n/).forEach((o,c)=>{let l=o.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(),o=this.parseSubject(s,t,r);s=o.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 iW.Triple(o.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,o,c]=i,l=r.prefixes[s];if(!l)throw new Error(`Unknown prefix "${s}" at line ${t}`);return{node:new v3.IRI(`${l}${o}`),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),o=new v3.IRI(s),c=e.slice(i+1).trimStart();return{node:o,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 sW.BlankNode(i),rest:(s??"").trimStart()}}consumeLiteral(e,t,r){let{value:i,rest:s}=this.consumeQuotedString(e,t),o=s.trimStart();if(o.startsWith("^^")){o=o.slice(2).trimStart();let c=o.startsWith("<")?this.consumeIRI(o,t,r):this.consumePrefixedName(o,t,r);return{node:new Hv.Literal(i,c.node),rest:c.rest}}if(o.startsWith("@")){let c=o.match(/^@([a-zA-Z-]+)(?:\s+(.*))?$/);if(!c)throw new Error(`Invalid language tag at line ${t}`);let[,l,u]=c;return{node:new Hv.Literal(i,void 0,l),rest:(u??"").trimStart()}}return{node:new Hv.Literal(i),rest:o}}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 o=e[i+1];switch(o){case"t":r+=" ",i+=1;break;case"b":r+="\b",i+=1;break;case"n":r+=`
|
|
222
222
|
`,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 \\${o} at line ${t}`)}continue}if(s==='"'){let o=e.slice(i+1);return{value:r,rest:o}}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 o=e[s];if(o===t){i++;continue}if(o===r&&(i--,i===0))return s}return-1}};Cg.NTriplesParser=zv});var E3=w(Og=>{"use strict";Object.defineProperty(Og,"__esModule",{value:!0});Og.TurtleParser=void 0;var Jl=zt(),aW=Kv(),cW={rdf:Jl.Namespace.RDF.iri.value,rdfs:Jl.Namespace.RDFS.iri.value,owl:Jl.Namespace.OWL.iri.value,xsd:Jl.Namespace.XSD.iri.value,exo:Jl.Namespace.EXO.iri.value,ems:Jl.Namespace.EMS.iri.value},lW=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,Yv=class{static{a(this,"TurtleParser")}constructor(){this.nTriplesParser=new aW.NTriplesParser}parse(e,t={}){let r={...cW,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:o,lineNumber:c})=>{if(this.isPrefixStatement(o)){let u=o.match(lW);if(!u)throw new Error(`Invalid prefix declaration at line ${c}`);let[,f,d]=u;r[f]=d;return}if(o.includes(";")||o.includes(","))throw new Error(`Complex Turtle statements with ';' or ',' are not supported (line ${c})`);let l=this.normalizeShortcuts(o);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((o,c)=>{let l=o.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}};Og.TurtleParser=Yv});var T3=w(Pg=>{"use strict";Object.defineProperty(Pg,"__esModule",{value:!0});Pg.RDFSerializer=void 0;var Zl=Xn(),Sc=Pe(),wc=Ge(),Qv=jt(),Rs=zt(),uW=b3(),fW=qv(),dW=w3(),hW=E3(),pW=Kv(),mW=1024,gW=`
|
|
223
223
|
`,yW={rdf:Rs.Namespace.RDF.iri.value,rdfs:Rs.Namespace.RDFS.iri.value,owl:Rs.Namespace.OWL.iri.value,xsd:Rs.Namespace.XSD.iri.value,exo:Rs.Namespace.EXO.iri.value,ems:Rs.Namespace.EMS.iri.value},Xv=class{static{a(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new uW.TurtleSerializer,this.nTriplesSerializer=new fW.NTriplesSerializer,this.jsonldSerializer=new dW.JSONLDSerializer,this.turtleParser=new hW.TurtleParser,this.nTriplesParser=new pW.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??gW,i=t.batchSize??mW,s=t.includeDefaultPrefixes,o=t.prefixes,c=this,l=!1,u=[],f=[],d=0,h=a(async()=>{if(!l){if(f=await c.store.match(),e==="json-ld"){let g=c.jsonldSerializer.toDocument(f,{context:o,pretty:!1});u.push(...c.buildJsonLdChunks(g))}else if(e==="turtle"){let g=c.turtleSerializer.serializePrefixes(c.composePrefixes(o,s),r);g&&u.push(`${g}${r}${r}`)}l=!0}},"ensureInitialized");return{async next(){if(await h(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(d>=f.length)return{value:void 0,done:!0};let g=f.slice(d,d+i);d+=g.length;let y="";if(e==="turtle"){let b=c.turtleSerializer.serializeTriplesOnly(g,r);b&&(y=`${b}${r}`)}else e==="n-triples"&&(y=c.nTriplesSerializer.serializeChunk(g,r));return y?{value:y,done:!1}:this.next()},async return(){return u=[],f=[],d=0,{value:void 0,done:!0}},[Symbol.asyncIterator](){return this}}}async load(e,t,r={}){let i=this.parse(e,t,r);return r.mode!=="append"&&await this.store.clear(),await this.store.addAll(i),i.length}parse(e,t,r={}){switch(t){case"turtle":return this.turtleParser.parse(e,this.buildTurtleParseOptions(r));case"n-triples":return this.nTriplesParser.parse(e,this.buildNTriplesParseOptions(r));case"json-ld":return this.parseJsonLd(e,r);default:throw new Error(`Unsupported serialization format: ${t}`)}}buildTurtleParseOptions(e){return{prefixes:this.composePrefixes(e.prefixes,!0),strict:e.strict}}buildNTriplesParseOptions(e){return{prefixes:this.composePrefixes(e.prefixes,!0),strict:e.strict}}composePrefixes(e,t){return t??!0?{...yW,...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),o={...i,...s},c=this.extractGraph(r),l=[];return c.forEach((u,f)=>{if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`Invalid JSON-LD node at index ${f}`);let d=this.parseSubjectFromNode(u,o,f),h=Object.entries(u);for(let[p,g]of h){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(d,g,l,o);continue}let y=this.expandTerm(p,o),b=new Sc.IRI(y);this.collectTriplesForValue(d,b,g,l,o)}}),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 Qv.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new Sc.IRI(i);let s=this.expandTerm(i,t);return new Sc.IRI(s)}return new Qv.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=Rs.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 Zl.Triple(e,s,new Sc.IRI(l)))})}collectTriplesForValue(e,t,r,i,s){if(r!=null){if(Array.isArray(r)){r.forEach(o=>this.collectTriplesForValue(e,t,o,i,s));return}if(typeof r=="object"){let o=r;if(typeof o["@id"]=="string"){let c=this.parseIdNode(o["@id"],s);i.push(new Zl.Triple(e,t,c));return}if(o["@value"]!==void 0){let c=this.parseLiteralObject(o,s);i.push(new Zl.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new Zl.Triple(e,t,new wc.Literal(r)));return}if(typeof r=="number"){let o=Number.isInteger(r)?Rs.Namespace.XSD.term("integer"):Rs.Namespace.XSD.term("decimal");i.push(new Zl.Triple(e,t,new wc.Literal(r.toString(),o)));return}if(typeof r=="boolean"){let o=Rs.Namespace.XSD.term("boolean");i.push(new Zl.Triple(e,t,new wc.Literal(r.toString(),o)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new Qv.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new Sc.IRI(e);let r=this.expandTerm(e,t);return new Sc.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 wc.Literal(r,void 0,e["@language"],i):new wc.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new wc.Literal(r,new Sc.IRI(i))}return new wc.Literal(r)}expandTerm(e,t){if(this.isAbsoluteIri(e))return e;let r=e.indexOf(":");if(r>0){let s=e.slice(0,r),o=e.slice(r+1),c=t[s];if(!c)throw new Error(`Unknown prefix "${s}" in JSON-LD document`);return`${c}${o}`}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 o=JSON.stringify(i);s>0?t.push(`,${o}`):t.push(o)}),t.push(`]}
|
|
224
|
-
`),t}};Pg.RDFSerializer=Xv});var Jv=w(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.OBSIDIAN_VAULT_SCHEME=void 0;Co.vaultPathToIRI=bW;Co.iriToVaultPath=_W;Co.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function bW(n){let e=n.startsWith("./")?n.slice(2):n;return`${Co.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}a(bW,"vaultPathToIRI");function _W(n){if(!n.startsWith(Co.OBSIDIAN_VAULT_SCHEME))return null;let e=n.slice(Co.OBSIDIAN_VAULT_SCHEME.length);try{return decodeURI(e)}catch{return null}}a(_W,"iriToVaultPath")});var eE=w(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});Fg.RDFVocabularyMapper=void 0;var cr=Xn(),A3=Pe(),fe=zt(),Zv=class{static{a(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",fe.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",fe.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",fe.Namespace.RDFS.term("subClassOf")],["exo__Property_range",fe.Namespace.RDFS.term("range")],["exo__Property_domain",fe.Namespace.RDFS.term("domain")],["exo__Property_superProperty",fe.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new cr.Triple(fe.Namespace.EXO.term("Asset"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.RDFS.term("Resource"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Class"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.RDFS.term("Class"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Property"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.RDF.term("Property"))),e.push(new cr.Triple(fe.Namespace.EMS.term("Task"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("Project"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("Area"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("Workflow"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("WorkflowState"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("WorkflowTransition"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EXOCMD.term("Command"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EXOCMD.term("Precondition"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EXOCMD.term("Grounding"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EXOCMD.term("CommandBinding"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new cr.Triple(fe.Namespace.EXO.term("Instance_class"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDF.term("type"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Asset_isDefinedBy"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("isDefinedBy"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Class_superClass"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("subClassOf"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Property_range"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("range"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Property_domain"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("domain"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Property_superProperty"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof A3.IRI)s=r;else{let o=r.match(/^(ems|exo|exocmd)__(.+)$/);if(o){let[,c,l]=o;s=(c==="ems"?fe.Namespace.EMS:c==="exocmd"?fe.Namespace.EXOCMD:fe.Namespace.EXO).term(l)}else s=new A3.IRI(r)}return new cr.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Fg.RDFVocabularyMapper=Zv});var I3=w(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});Lg.RDFSInferenceEngine=void 0;var SW=Xn(),Dg=Pe(),tE=class{static{a(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(d=>d.value.includes("Class_superClass")),i=t.find(d=>d.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let o=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let d of l)if(d.object instanceof Dg.IRI){let h=o.get(d.object.value);if(h)for(let p of h)u.push(new SW.Triple(d.subject,i,new Dg.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 Dg.IRI&&s.object instanceof Dg.IRI){let o=s.subject.value,c=s.object.value;i.has(o)||i.set(o,new Set),i.get(o).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=[],o=t.get(e);if(o)for(let c of o)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}};Lg.RDFSInferenceEngine=tE});var iE=w(vc=>{"use strict";var wW=vc&&vc.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(vc,"__esModule",{value:!0});vc.NonInheritablePropertyRegistry=void 0;var vW=Ve(),x3=Pe(),R3=Ge(),rE=zt(),nE=class{static{a(this,"NonInheritablePropertyRegistry")}constructor(){this.nonInheritableIRIs=new Set,this.initialized=!1}async initialize(e){this.nonInheritableIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Instance_class"));if(!r){this.initialized=!0;return}let i=await this.findNonInheritableClassIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let o=t.find(c=>c.value.includes("Asset_label"));if(!o){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,o,void 0);for(let u of l)if(u.object instanceof R3.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.nonInheritableIRIs.add(d)}}}catch{}this.initialized=!0}isNonInheritable(e){return this.nonInheritableIRIs.has(e)}get size(){return this.nonInheritableIRIs.size}get isInitialized(){return this.initialized}async findNonInheritableClassIRI(e,t){let r=t.find(o=>o.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new R3.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof x3.IRI)return i[0].subject;let s=t.find(o=>o.value.includes("Instance_class"));if(s){let o=await e.match(void 0,s,void 0);for(let c of o)if(c.object instanceof x3.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?rE.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?rE.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?rE.Namespace.EXOCMD.term(e.substring(8)).value:null}};vc.NonInheritablePropertyRegistry=nE;vc.NonInheritablePropertyRegistry=nE=wW([(0,vW.injectable)()],nE)});var aE=w(Ec=>{"use strict";var EW=Ec&&Ec.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(Ec,"__esModule",{value:!0});Ec.PropertyCardinalityRegistry=void 0;var TW=Ve(),C3=Pe(),O3=Ge(),sE=zt(),oE=class{static{a(this,"PropertyCardinalityRegistry")}constructor(){this.multiValuedIRIs=new Set,this.initialized=!1}async initialize(e){this.multiValuedIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Property_cardinality"));if(!r){this.initialized=!0;return}let i=await this.findMultipleCardinalityIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let o=t.find(c=>c.value.includes("Asset_label"));if(!o){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,o,void 0);for(let u of l)if(u.object instanceof O3.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.multiValuedIRIs.add(d)}}}catch{}this.initialized=!0}isMultiValued(e){return this.multiValuedIRIs.has(e)}get size(){return this.multiValuedIRIs.size}get isInitialized(){return this.initialized}async findMultipleCardinalityIRI(e,t){let r=t.find(o=>o.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new O3.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof C3.IRI)return i[0].subject;let s=t.find(o=>o.value.includes("Instance_class"));if(s){let o=await e.match(void 0,s,void 0);for(let c of o)if(c.object instanceof C3.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?sE.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?sE.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?sE.Namespace.EXOCMD.term(e.substring(8)).value:null}};Ec.PropertyCardinalityRegistry=oE;Ec.PropertyCardinalityRegistry=oE=EW([(0,TW.injectable)()],oE)});var uE=w(xr=>{"use strict";var AW=xr&&xr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},IW=xr&&xr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(xr,"__esModule",{value:!0});xr.PrototypeChainMaterializer=xr.MAX_PROTOTYPE_DEPTH=xr.INFERRED_GRAPH=void 0;xr.inferredGraphForDepth=cE;var xW=Ve(),P3=Xn(),ha=Pe(),RW=iE(),CW=aE();xr.INFERRED_GRAPH=new ha.IRI("https://exocortex.my/ontology/exo#inferred");var OW="https://exocortex.my/ontology/exo#inferred/";function cE(n){return new ha.IRI(`${OW}${n}`)}a(cE,"inferredGraphForDepth");xr.MAX_PROTOTYPE_DEPTH=10;var lE=class{static{a(this,"PrototypeChainMaterializer")}constructor(e,t){this.registry=e,this.cardinalityRegistry=t??null}async materialize(e){let r=(await e.predicates()).find(c=>c.value.includes("Asset_prototype"));if(!r)return 0;let i=await e.match(void 0,r,void 0);if(i.length===0)return 0;let s=new Map;for(let c of i)if(c.subject instanceof ha.IRI&&c.object instanceof ha.IRI){let l=c.subject.value,u=c.object.value;l!==u&&s.set(l,c.object)}if(s.size===0)return 0;let o=0;for(let[c]of s){let l=new ha.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let g=p.object instanceof ha.IRI?p.object.value:String(p.object),y=h.get(p.predicate.value);y||(y=new Set,h.set(p.predicate.value,y)),y.add(g)}for(let p=0;p<u.length;p++){let g=u[p],y=p+1,b=new ha.IRI(g),S=await e.match(b,void 0,void 0),v=new Set;if(e.matchInGraph){let I=await e.matchInGraph(b,void 0,void 0,xr.INFERRED_GRAPH);for(let A of I)v.add(A.predicate.value)}for(let I of S){let A=I.predicate.value;if(this.registry.isNonInheritable(A)||v.has(A))continue;if(d.has(A)&&this.isMultiValued(A)){let R=I.object instanceof ha.IRI?I.object.value:String(I.object);if(h.get(A)?.has(R))continue;let L=h.get(A);L||(L=new Set,h.set(A,L)),L.add(R);let P=new P3.Triple(l,I.predicate,I.object);await e.add(P),e.addToGraph&&(await e.addToGraph(P,xr.INFERRED_GRAPH),await e.addToGraph(P,cE(y))),o++;continue}if(d.has(A))continue;let T=new P3.Triple(l,I.predicate,I.object);await e.add(T),e.addToGraph&&(await e.addToGraph(T,xr.INFERRED_GRAPH),await e.addToGraph(T,cE(y))),d.add(A),o++}}}return o}isMultiValued(e){return this.cardinalityRegistry?this.cardinalityRegistry.isMultiValued(e):!1}resolveChain(e,t){let r=[],i=new Set;i.add(e);let s=[],o=t.get(e);for(o&&s.push(o.value);s.length>0&&r.length<xr.MAX_PROTOTYPE_DEPTH;){let c=s.shift();if(c===void 0)break;if(i.has(c))continue;i.add(c),r.push(c);let l=t.get(c);l&&!i.has(l.value)&&s.push(l.value)}return r}};xr.PrototypeChainMaterializer=lE;xr.PrototypeChainMaterializer=lE=AW([(0,xW.injectable)(),IW("design:paramtypes",[RW.NonInheritablePropertyRegistry,CW.PropertyCardinalityRegistry])],lE)});var D3=w(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});kg.IRICanonicalizer=void 0;var F3=Pe(),PW=Ge(),FW=jt(),DW=Xn(),fE=/^obsidian:\/\/vault\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i,Ng=class n{static{a(this,"IRICanonicalizer")}static extractSynthAUid(e){let t=fE.exec(e);return t?t[1].toLowerCase():null}static canonicalize(e,t){if(t.size===0)return{triples:e,remapCount:0,uniqueRemapCount:0};let r=new Map,i=new Set,s=0;return{triples:e.map(c=>{let l=n.remapIfSynthA(c.subject,t,r,i),u=n.remapIfSynthA(c.object,t,r,i);return l===c.subject&&u===c.object?c:(s++,new DW.Triple(l,c.predicate,u))}),remapCount:s,uniqueRemapCount:i.size}}static remapIfSynthA(e,t,r,i){if(e instanceof PW.Literal||e instanceof FW.BlankNode||!(e instanceof F3.IRI))return e;let s=fE.exec(e.value);if(!s)return e;let o=s[1].toLowerCase(),c=t.get(o);if(!c||c===e.value)return e;i.add(o);let l=r.get(c);return l||(l=new F3.IRI(c),r.set(c,l)),l}};kg.IRICanonicalizer=Ng;Ng.SYNTH_A_IRI_PATTERN=fE});var jg=w(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.derivePath=L3;sd.deriveUrl=LW;sd.deriveLegacyFlatPath=NW;var dE="assetspaces",Mg=/^[A-Za-z0-9._-]+$/;function L3(n){if(typeof n!="string")return null;let e=n.trim();if(e.length===0||/^file:\/\//i.test(e))return null;e=e.replace(/\/+$/,""),e=e.replace(/\.git$/i,"");let t=null;if(!e.includes("://")){let o=/^[^/@\s]+@[^/:\s]+:(.+)$/.exec(e);o&&(t=o[1])}if(t===null){let o=e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"");o=o.replace(/^[^/@]+@/,"");let c=o.indexOf("/");if(c<0)return null;t=o.slice(c+1)}let r=t.split("/").filter(o=>o.length>0);if(r.length<2)return null;let i=r[0],s=r[1];return i==="."||i===".."||s==="."||s===".."||!Mg.test(i)||!Mg.test(s)?null:`${dE}/${i}/${s}`}a(L3,"derivePath");function LW(n){if(typeof n!="string")return null;let e=n.trim();if(e.length===0)return null;e=e.replace(/^\/+/,"").replace(/\/+$/,"");let t=`${dE}/`;if(!e.startsWith(t))return null;let r=e.slice(t.length).split("/").filter(o=>o.length>0);if(r.length<2)return null;let i=r[0],s=r[1];return i==="."||i===".."||s==="."||s===".."||!Mg.test(i)||!Mg.test(s)?null:`https://github.com/${i}/${s}`}a(LW,"deriveUrl");function NW(n){let e=L3(n);if(e===null)return null;let t=e.split("/")[2];if(t===void 0||t.length===0)return null;let r=t.startsWith("exoas-")?t.slice(6):t;return r.length===0?null:`${dE}/${r}`}a(NW,"deriveLegacyFlatPath")});var $g=w(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.FILE_SPACE_CLASS_UID=void 0;Yi.frontmatterDeclaresFileSpace=MW;Yi.discoverFileSpaceExclusions=$W;var kW=jg();Yi.FILE_SPACE_CLASS_UID="aad8913e-5e9f-4047-879d-93cc46befd52";var N3=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,hE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function M3(n){let e=Array.isArray(n)?n:[n],t=[];for(let r of e){if(typeof r!="string")continue;N3.lastIndex=0;let i;for(;(i=N3.exec(r))!==null;)t.push(i[1].trim())}return t}a(M3,"wikilinkTargets");function MW(n){return n?M3(n.exo__Instance_class).some(e=>hE.test(e)&&e.toLowerCase()===Yi.FILE_SPACE_CLASS_UID):!1}a(MW,"frontmatterDeclaresFileSpace");function k3(n,e){try{return n.getFrontmatter(e)}catch{return null}}a(k3,"readFrontmatterSafe");function jW(n){let e=n.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=n.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(jW,"readSource");function $W(n){let e=[],t=[],r=[],i=new Map,s=a((c,l)=>{if(hE.test(c))return c.toLowerCase()===Yi.FILE_SPACE_CLASS_UID;let u=n.getFirstLinkpathDest(c,l);if(u==null)return!1;let f=i.get(u.path);if(f!==void 0)return f;let h=k3(n,u)?.exo__Asset_uid,p=typeof h=="string"&&h.toLowerCase()===Yi.FILE_SPACE_CLASS_UID;return i.set(u.path,p),p},"isFileSpaceClassRef"),o=a(c=>c.some(l=>hE.test(l)&&l.toLowerCase()===Yi.FILE_SPACE_CLASS_UID),"hasUuidFormRef");for(let c of n.getAllFiles()){let l=k3(n,c);if(!l)continue;let u=M3(l.exo__Instance_class);if(!u.some(p=>s(p,c.path)))continue;t.push(c.path),o(u)||r.push(`FileSpace declaration ${c.path} references the class via a label-form link only \u2014 the sync layer will not pick it up; use the UUID-form wikilink [[${Yi.FILE_SPACE_CLASS_UID}]] (UID-canon)`);let f=jW(l);if(f===null){r.push(`FileSpace declaration ${c.path} has no exo__AssetSpace_source/_git \u2014 mount path underivable, content NOT excluded from the index`);continue}let d=(0,kW.derivePath)(f);if(d===null){r.push(`FileSpace declaration ${c.path}: cannot derive mount path from source "${f}" \u2014 content NOT excluded from the index`);continue}let h=`${d}/`;c.path.startsWith(h)&&r.push(`FileSpace declaration ${c.path} lies INSIDE its own mount ${h} \u2014 it will be excluded from the index together with the content; move the declaration outside the mount folder`),e.push(h)}return{prefixes:e,declarationPaths:t,warnings:r}}a($W,"discoverFileSpaceExclusions")});var j3=w(ei=>{"use strict";var UW=ei&&ei.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},BW=ei&&ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ei,"__esModule",{value:!0});ei.LazyAssetGraphLoader=ei.MAX_LAZY_DEPTH=void 0;var VW=Ve(),qW=Pe(),pE=zt();ei.MAX_LAZY_DEPTH=10;var mE=class{static{a(this,"LazyAssetGraphLoader")}constructor(e,t,r){this.converter=e,this.fileResolver=t,this.store=r,this.loadedIRIs=new Set,this.instanceClassPredicate=pE.Namespace.EXO.term("Instance_class"),this.superClassPredicate=pE.Namespace.EXO.term("Class_superClass"),this.prototypePredicate=pE.Namespace.EXO.term("Asset_prototype")}async ensureFileLoaded(e,t=0){if(t>=ei.MAX_LAZY_DEPTH)return;let r=this.converter.notePathToIRI(e.path).value;if(!this.loadedIRIs.has(r)){this.loadedIRIs.add(r);try{let i=await this.converter.convertNote(e);if(!this.loadedIRIs.has(r)||(await this.store.addAll(i),!this.loadedIRIs.has(r)))return;await this.walkClassAndPrototypeRelations(i,t+1)}catch(i){throw this.loadedIRIs.delete(r),i}}}async ensureLoadedByIRI(e,t=0){if(t>=ei.MAX_LAZY_DEPTH||this.loadedIRIs.has(e.value))return;let r=this.fileResolver.resolveByIRI(e);r!==null&&await this.ensureFileLoaded(r,t)}isLoaded(e){return this.loadedIRIs.has(e.value)}notePathToIRI(e){return this.converter.notePathToIRI(e)}forget(e){this.loadedIRIs.delete(e.value)}clearAll(){this.loadedIRIs.clear()}get loadedCount(){return this.loadedIRIs.size}clearForTests(){this.loadedIRIs.clear()}async walkClassAndPrototypeRelations(e,t){let r=[];for(let i of e){if(!(i.object instanceof qW.IRI))continue;let s=i.predicate.value;(s===this.instanceClassPredicate.value||s===this.superClassPredicate.value||s===this.prototypePredicate.value)&&r.push(i.object)}for(let i of r)await this.ensureLoadedByIRI(i,t)}};ei.LazyAssetGraphLoader=mE;ei.LazyAssetGraphLoader=mE=UW([(0,VW.injectable)(),BW("design:paramtypes",[Object,Object,Object])],mE)});var yE=w(Sr=>{"use strict";var GW=Sr&&Sr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},WW=Sr&&Sr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.SourceAnnotator=Sr.DEPTH_VARIABLE=Sr.SOURCE_VARIABLE=void 0;var HW=Ve(),eu=Ge(),zW=Pe(),Ug=uE();Sr.SOURCE_VARIABLE="_source";Sr.DEPTH_VARIABLE="_depth";var gE=class{static{a(this,"SourceAnnotator")}constructor(e){this.tripleStore=e}async annotate(e,t,r,i){if(!this.tripleStore.matchInGraph)return e.map(o=>{let c=o.clone();return c.set(Sr.SOURCE_VARIABLE,new eu.Literal("own")),c});let s=[];for(let o of e){let c=o.get(t),l=o.get(r),u=o.get(i),f=o.clone();if(!c||!l||!u)f.set(Sr.SOURCE_VARIABLE,new eu.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(Sr.SOURCE_VARIABLE,new eu.Literal(d))}s.push(f)}return s}async annotateSingle(e,t,r,i){return(await this.annotate([e],t,r,i))[0]}async determineSource(e,t,r){return this.tripleStore.matchInGraph&&(await this.tripleStore.matchInGraph(e,t,r,Ug.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=Ug.MAX_PROTOTYPE_DEPTH;i++){let s=(0,Ug.inferredGraphForDepth)(i);if((await this.tripleStore.matchInGraph(e,t,r,s)).length>0)return i}return 0}async annotateBySubject(e,t){if(!this.tripleStore.matchInGraph)return e.map(s=>{let o=s.clone();return o.set(Sr.SOURCE_VARIABLE,new eu.Literal("own")),o});let r=[],i=new Map;for(let s of e){let o=s.get(t),c=s.clone();if(!o||!(o instanceof zW.IRI))c.set(Sr.SOURCE_VARIABLE,new eu.Literal("own"));else{let l=o.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(o,void 0,void 0,Ug.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(Sr.SOURCE_VARIABLE,new eu.Literal(u))}r.push(c)}return r}};Sr.SourceAnnotator=gE;Sr.SourceAnnotator=gE=GW([(0,HW.injectable)(),WW("design:paramtypes",[Object])],gE)});var wE=w(ti=>{"use strict";var KW=ti&&ti.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},YW=ti&&ti.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},$3=ti&&ti.__param||function(n,e){return function(t,r){e(t,r,n)}},SE;Object.defineProperty(ti,"__esModule",{value:!0});ti.NoteToRDFConverter=void 0;ti.normaliseExcludedFolders=q3;ti.isPathExcluded=G3;var bE=Ve(),lr=Xn(),Qi=Pe(),bn=Ge(),U3=jt(),Kt=zt(),B3=Bt(),QW=eE(),XW=ol(),_E=Jv(),Bn=tS(),JW=$g(),V3=new Set(["archived","draft","pinned","aliases"]);function q3(n){return Array.isArray(n)?n.map(e=>String(e).replace(/\\/g,"/").trim()).filter(e=>e.length>0).map(e=>e.endsWith("/")?e:`${e}/`):[]}a(q3,"normaliseExcludedFolders");function G3(n,e){if(e.length===0)return!1;let t=n.replace(/\\/g,"/");for(let r of e)if(t.startsWith(r))return!0;return!1}a(G3,"isPathExcluded");function ZW(n){if(!n)return"";let e=n.replace(/\\/g,"/");for(;e.startsWith("/");)e=e.slice(1);for(;e.endsWith("/");)e=e.slice(0,-1);return e.length>0?`${e}/`:""}a(ZW,"normaliseSubjectIriPrefix");var Tc=SE=class{static{a(this,"NoteToRDFConverter")}constructor(e,t=XW.NullLogger,r={}){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.pendingExtraTriples=[],this.vocabularyMapper=new QW.RDFVocabularyMapper,this.subjectIriPrefix=ZW(r.subjectIriPrefix)}async convertNote(e){return this.convertNoteFromFrontmatter(e,this.vault.getFrontmatter(e))}async convertNoteFromFrontmatter(e,t){if(!t)return[];let r=this.notePathToIRI(e.path),i=Kt.Namespace.EXO.term("Asset_filename"),s=new lr.Triple(r,i,new bn.Literal(e.basename));if(Bn.Exo003Parser.isExo003Format(t)){let o=await this.convertExo003Note(e,t);return[s,...o]}return this.convertLegacyNote(e,t,s)}async convertLegacyNote(e,t,r){this.pendingExtraTriples=[];let i=[r],s=this.notePathToIRI(e.path),o,c,l,u=!1,f=Kt.Namespace.EXO.term("Statement").value;for(let[y,b]of Object.entries(t)){let S=V3.has(y)?`exo__Asset_${y}`:y;if(!this.isExocortexProperty(S))continue;let v=this.propertyKeyToIRI(S),I=Array.isArray(b)?b:[b];for(let A of I)if(!((y==="exo__Asset_label"||V3.has(y))&&(A==null||typeof A=="string"&&A.trim()==="")))if(y==="exo__Instance_class"){let T=this.valueToClassURI(A);i.push(new lr.Triple(s,v,T))}else{let T=await this.valueToRDFObject(A,e,v);if(S==="exo__Statement_subject"&&o===void 0){let R=T.find(V=>V instanceof Qi.IRI);R&&(o=R)}else if(S==="exo__Statement_predicate"&&c===void 0){let R=T.find(V=>V instanceof Qi.IRI);R&&(c=R)}else S==="exo__Statement_object"&&l===void 0&&(l=T[0]);for(let R of T)if(i.push(new lr.Triple(s,v,R)),this.vocabularyMapper.hasMappingFor(y)&&R instanceof Qi.IRI){let V=this.vocabularyMapper.generateMappedTriple(s,y,R);V&&i.push(V)}}if(y==="exo__Instance_class")for(let A of I){let T=this.valueToClassURI(A);if(T instanceof Qi.IRI){let R=Kt.Namespace.RDF.term("type");i.push(new lr.Triple(s,R,T)),T.value===f&&(u=!0)}}if(y==="exo__Asset_label"){let A=Kt.Namespace.RDFS.term("label");for(let T of I)typeof T=="string"&&T.length>0&&i.push(new lr.Triple(s,A,new bn.Literal(T)))}}let d="exo__Instance_class"in t||"exo__Asset_uid"in t,h=t.exo__Asset_label,p="exo__Asset_label"in t&&h!==null&&h!==void 0&&!(typeof h=="string"&&h.trim()==="")&&!(Array.isArray(h)&&h.length===0);if(d&&!p){let y=Kt.Namespace.RDFS.term("label"),b=Kt.Namespace.EXO.term("Asset_label"),S=new bn.Literal(e.basename);i.push(new lr.Triple(s,y,S)),i.push(new lr.Triple(s,b,S))}i.push(...this.pendingExtraTriples),this.pendingExtraTriples=[],u&&o&&c&&l&&i.push(new lr.Triple(o,c,l));let g=await this.convertBodyWikilinks(e,s);return i.push(...g),i}async convertExo003Note(e,t){let r=Bn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Bn.Exo003MetadataType.Namespace:break;case Bn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Bn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Bn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Bn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new Qi.IRI(t.uri);return[new lr.Triple(r,Kt.Namespace.OWL.term("sameAs"),i),new lr.Triple(i,Kt.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 lr.Triple(r,Kt.Namespace.OWL.term("sameAs"),new U3.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Bn.Exo003Parser.toTriple(t,i);r.push(s);let o=this.notePathToIRI(e.path);r.push(new lr.Triple(o,Kt.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),o=this.createExo003ReferenceResolver(e),c=o(t.subject),l=o(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 Qi.IRI(c.value):new U3.BlankNode(c.value),f=new Qi.IRI(l.value),d=Bn.Exo003Parser.toLiteral(t,s.trim());r.push(new lr.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new lr.Triple(h,Kt.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 o=this.vault.getFrontmatter(s);if(o&&Bn.Exo003Parser.isExo003Format(o)){let c=Bn.Exo003Parser.parse(o);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Bn.Exo003MetadataType.Anchor||l.metadata===Bn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Bn.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(e={}){return(await this.convertVaultWithValidation({strict:!1,excludedFolders:e.excludedFolders})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1,o=0,c=0,l=(0,JW.discoverFileSpaceExclusions)(this.vault);for(let y of l.warnings)this.logger.warn(`FileSpace discovery: ${y}`);let u=[...q3(e.excludedFolders),...l.prefixes],f=u.length===0?t:t.filter(y=>!G3(y.path,u)),d=e.onProgress,h=e.progressIntervalFiles&&e.progressIntervalFiles>0?e.progressIntervalFiles:SE.INDEX_PROGRESS_INTERVAL,p=f.length,g=0;for(let y of f){if(g++,d&&g%h===0&&g<p)try{d(g,p)}catch{}try{let b=this.vault.getFrontmatter(y),S=b?this.validateExocortexAsset(b,y.basename):null;if(S){if(s)throw new Error(`Invariant violation in "${y.path}": ${S.message}`);i.push({path:y.path,reason:`Invariant violation: ${S.message}`}),o++,this.logger.info(`Skipping file with invariant violation: ${y.path}`,{code:S.code,property:S.property,reason:S.message});continue}let v=await this.convertNote(y);r.push(...v)}catch(b){let S=b instanceof Error?b.message:String(b);if(s)throw new Error(`Invalid IRI for file "${y.path}": ${S}`);i.push({path:y.path,reason:`Invalid IRI: ${S}`}),c++,this.logger.info(`Skipping file with invalid IRI: ${y.path}`,{reason:S})}}return o>0&&this.logger.warn(`Skipped ${o} file${o===1?"":"s"} with invariant violations during indexing (paths in developer console)`,{count:o}),c>0&&this.logger.warn(`Skipped ${c} file${c===1?"":"s"} with invalid IRI during indexing (paths in developer console)`,{count:c}),{triples:r,skippedFiles:i,summary:{total:f.length,indexed:f.length-i.length,skipped:i.length},fileSpaces:l}}static inferLabelFromBasename(e){return Kt.Namespace.fromPropertyKey(e)!==null?e:null}validateExocortexAsset(e,t){let r=a(d=>d==null?!0:typeof d=="string"?d.trim()==="":Array.isArray(d)?d.length===0||d.every(r):!1,"isEmpty");if(!("exo__Instance_class"in e||"exo__Asset_uid"in e))return null;let s=["exo__Asset_uid","exo__Instance_class"];for(let d of s){if(!(d in e))return{code:"MISSING_PROPERTY",property:d,message:`Required property "${d}" is missing`};if(r(e[d]))return{code:"EMPTY_PROPERTY",property:d,message:`Required property "${d}" is empty`}}let o=["ems__Effort_status","ems__Effort_parent","ems__Effort_lockedBy","ems__Effort_lockExpires","exo__Asset_updatedAt","ems__Effort_startTimestamp"];for(let d of o)if(d in e&&r(e[d]))return{code:"EMPTY_OPTIONAL_PROPERTY",property:d,message:`Optional property "${d}" is present but empty`};let c=e.exo__Instance_class,l=Array.isArray(c)?c:[c],u=null,f=!1;for(let d of l){if(typeof d!="string")continue;let h=this.removeQuotes(d),g=(this.extractWikilink(h)??h).trim();/^[a-z][a-zA-Z0-9]*__/.test(g)&&/[\s()]/.test(g)?u||(u={candidate:d}):f=!0}return u&&!f?{code:"INVALID_INSTANCE_CLASS_IRI",property:"exo__Instance_class",message:`Invalid Instance_class IRI: "${u.candidate}"`}:null}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=(0,_E.vaultPathToIRI)(r.path);Qi.IRI.isValidIRI(i)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new Qi.IRI((0,_E.vaultPathToIRI)(`${this.subjectIriPrefix}${e}`))}synthesizeWikilinkTargetIRI(e){return new Qi.IRI((0,_E.vaultPathToIRI)(e))}isExocortexProperty(e){return Kt.Namespace.fromPropertyKey(e)!==null}propertyKeyToIRI(e){let t=Kt.Namespace.fromPropertyKey(e);if(!t)throw new Error(`Invalid property key: ${e}`);return t.namespace.term(t.localName)}emitTypeTripleForEnumInstance(e,t){let r=this.vault.getFrontmatter(t);if(!r)return;let i=r.exo__Instance_class,s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return;let o=this.valueToClassURI(s);o instanceof Qi.IRI&&(this.pendingExtraTriples.push(new lr.Triple(e,Kt.Namespace.RDF.term("type"),o)),this.pendingExtraTriples.push(new lr.Triple(e,Kt.Namespace.EXO.term("Instance_class"),o)))}async valueToRDFObject(e,t,r){if(typeof e=="string"){let i=this.removeQuotes(e),s=this.extractWikilink(i);if(s){let o=this.vault.getFirstLinkpathDest(s,t.path);if(o){let l=this.notePathToIRI(o.path),u=s.includes("|")?s.split("|")[0]:s;if(this.isUUID(u)){let d=new bn.Literal(u);if(r?.value.endsWith("#Grounding_targetValueRef")||r?.value.endsWith("#Grounding_targetValueSubstitution")||r?.value.endsWith("#Grounding_targetClass")||r?.value.endsWith("#Grounding_type")||r?.value.endsWith("#PropertyDefault_value"))return[l];let p=this.expandClassValue(o.basename);if(p)return this.emitTypeTripleForEnumInstance(p,o),[p];let g=this.vault.getFrontmatter(o);if(g){let I=g.exo__Asset_label;if(typeof I=="string"){let A=this.expandClassValue(I);if(A)return this.emitTypeTripleForEnumInstance(A,o),[A]}}let y=r?.value.endsWith("#Asset_prototype")||r?.value.endsWith("/Asset_prototype"),S=((typeof process<"u"?process.env:void 0)?.EXOCORTEX_DUAL_STORAGE_PREDICATES??"").split(",").map(I=>I.trim()).filter(Boolean),v=S.length>0&&S.some(I=>r?.value.endsWith(`#${I}`));return y||v?[l,d]:[l]}let f=this.expandClassValue(o.basename);return f?(this.emitTypeTripleForEnumInstance(f,o),[f]):[l]}if(this.isClassReference(s)){let l=this.expandClassValue(s);if(l)return[l]}let c=s.includes("|")?s.split("|")[0]:s;return this.isUUID(c)?[this.synthesizeWikilinkTargetIRI(`${c}.md`)]:[new bn.Literal(i)]}if(this.isClassReference(i)){let o=this.expandClassValue(i);if(o)return[o]}return this.isISO8601DateTime(i)?[new bn.Literal(i,Kt.Namespace.XSD.term("dateTime"))]:[new bn.Literal(i)]}return typeof e=="boolean"?[new bn.Literal(e.toString())]:typeof e=="number"?[new bn.Literal(e.toString(),Kt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new bn.Literal(e.toISOString(),Kt.Namespace.XSD.term("dateTime"))]:[new bn.Literal(String(e))]}isISO8601DateTime(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/.test(e)}removeQuotes(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.substring(1,t.length-1):e}extractWikilink(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1];return r.includes("|")?r.split("|")[0]:r}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1],i=r.indexOf("|");return i>=0?r.substring(i+1).trim():null}valueToClassURI(e){if(typeof e!="string")return new bn.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);if(s)return s;let o=this.extractWikilinkAlias(t);if(o){let c=this.expandClassValue(o);if(c)return c}if(this.isUUID(i)){let c=this.vault.getFirstLinkpathDest(i,"");if(c){let l=this.expandClassValue(c.basename);if(l)return l;let u=this.vault.getFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return d}}return this.notePathToIRI(c.path)}}return new bn.Literal(t)}isClassReference(e){return/\s/.test(e)?!1:Kt.Namespace.fromPropertyKey(e)!==null}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}expandClassValue(e){let t=this.removeQuotes(e),r=Kt.Namespace.fromPropertyKey(t);return!r||/[\s()]/.test(r.localName)?null:r.namespace.term(r.localName)}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,r,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(r=i.exec(e))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),o=this.extractBodyWikilinks(s),c=Kt.Namespace.EXO.term("Asset_bodyLink");for(let l of o){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new lr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new lr.Triple(t,c,f)):r.push(new lr.Triple(t,c,new bn.Literal(l)))}else r.push(new lr.Triple(t,c,new bn.Literal(l)))}}catch{}return r}};ti.NoteToRDFConverter=Tc;Tc.INDEX_PROGRESS_INTERVAL=200;Tc.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Tc.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Tc.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};ti.NoteToRDFConverter=Tc=SE=KW([(0,bE.injectable)(),$3(0,(0,bE.inject)(B3.DI_TOKENS.IVaultAdapter)),$3(1,(0,bE.inject)(B3.DI_TOKENS.ILogger)),YW("design:paramtypes",[Object,Object,Object])],Tc)});var EE=w(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});Bg.FilterContainsOptimizer=void 0;var eH=Pe(),tH=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,vE=class{static{a(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(tH);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 eH.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(o=>o.subject.type==="variable"&&o.subject.value===t?{...o,subject:{type:"iri",value:r}}:o);if(i.some((o,c)=>o.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(o=>({[t.variable]:{type:"iri",value:o}}))},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)}};Bg.FilterContainsOptimizer=vE});var W3=w(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});Vg.AlgebraOptimizer=void 0;var rH=EE(),TE=class{static{a(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new rH.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),o=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return o&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!o?{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)}};Vg.AlgebraOptimizer=TE});var H3=w(qg=>{"use strict";Object.defineProperty(qg,"__esModule",{value:!0});qg.AlgebraSerializer=void 0;var AE=class{static{a(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
224
|
+
`),t}};Pg.RDFSerializer=Xv});var Jv=w(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.OBSIDIAN_VAULT_SCHEME=void 0;Co.vaultPathToIRI=bW;Co.iriToVaultPath=_W;Co.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function bW(n){let e=n.startsWith("./")?n.slice(2):n;return`${Co.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}a(bW,"vaultPathToIRI");function _W(n){if(!n.startsWith(Co.OBSIDIAN_VAULT_SCHEME))return null;let e=n.slice(Co.OBSIDIAN_VAULT_SCHEME.length);try{return decodeURI(e)}catch{return null}}a(_W,"iriToVaultPath")});var eE=w(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});Fg.RDFVocabularyMapper=void 0;var cr=Xn(),A3=Pe(),fe=zt(),Zv=class{static{a(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",fe.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",fe.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",fe.Namespace.RDFS.term("subClassOf")],["exo__Property_range",fe.Namespace.RDFS.term("range")],["exo__Property_domain",fe.Namespace.RDFS.term("domain")],["exo__Property_superProperty",fe.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new cr.Triple(fe.Namespace.EXO.term("Asset"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.RDFS.term("Resource"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Class"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.RDFS.term("Class"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Property"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.RDF.term("Property"))),e.push(new cr.Triple(fe.Namespace.EMS.term("Task"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("Project"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("Area"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("Workflow"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("WorkflowState"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EMS.term("WorkflowTransition"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EXOCMD.term("Command"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EXOCMD.term("Precondition"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EXOCMD.term("Grounding"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e.push(new cr.Triple(fe.Namespace.EXOCMD.term("CommandBinding"),fe.Namespace.RDFS.term("subClassOf"),fe.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new cr.Triple(fe.Namespace.EXO.term("Instance_class"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDF.term("type"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Asset_isDefinedBy"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("isDefinedBy"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Class_superClass"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("subClassOf"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Property_range"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("range"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Property_domain"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("domain"))),e.push(new cr.Triple(fe.Namespace.EXO.term("Property_superProperty"),fe.Namespace.RDFS.term("subPropertyOf"),fe.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof A3.IRI)s=r;else{let o=r.match(/^(ems|exo|exocmd)__(.+)$/);if(o){let[,c,l]=o;s=(c==="ems"?fe.Namespace.EMS:c==="exocmd"?fe.Namespace.EXOCMD:fe.Namespace.EXO).term(l)}else s=new A3.IRI(r)}return new cr.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Fg.RDFVocabularyMapper=Zv});var I3=w(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});Lg.RDFSInferenceEngine=void 0;var SW=Xn(),Dg=Pe(),tE=class{static{a(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(d=>d.value.includes("Class_superClass")),i=t.find(d=>d.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let o=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let d of l)if(d.object instanceof Dg.IRI){let h=o.get(d.object.value);if(h)for(let p of h)u.push(new SW.Triple(d.subject,i,new Dg.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 Dg.IRI&&s.object instanceof Dg.IRI){let o=s.subject.value,c=s.object.value;i.has(o)||i.set(o,new Set),i.get(o).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=[],o=t.get(e);if(o)for(let c of o)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}};Lg.RDFSInferenceEngine=tE});var iE=w(vc=>{"use strict";var wW=vc&&vc.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(vc,"__esModule",{value:!0});vc.NonInheritablePropertyRegistry=void 0;var vW=Ve(),x3=Pe(),R3=Ge(),rE=zt(),nE=class{static{a(this,"NonInheritablePropertyRegistry")}constructor(){this.nonInheritableIRIs=new Set,this.initialized=!1}async initialize(e){this.nonInheritableIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Instance_class"));if(!r){this.initialized=!0;return}let i=await this.findNonInheritableClassIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let o=t.find(c=>c.value.includes("Asset_label"));if(!o){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,o,void 0);for(let u of l)if(u.object instanceof R3.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.nonInheritableIRIs.add(d)}}}catch{}this.initialized=!0}isNonInheritable(e){return this.nonInheritableIRIs.has(e)}get size(){return this.nonInheritableIRIs.size}get isInitialized(){return this.initialized}async findNonInheritableClassIRI(e,t){let r=t.find(o=>o.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new R3.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof x3.IRI)return i[0].subject;let s=t.find(o=>o.value.includes("Instance_class"));if(s){let o=await e.match(void 0,s,void 0);for(let c of o)if(c.object instanceof x3.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?rE.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?rE.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?rE.Namespace.EXOCMD.term(e.substring(8)).value:null}};vc.NonInheritablePropertyRegistry=nE;vc.NonInheritablePropertyRegistry=nE=wW([(0,vW.injectable)()],nE)});var aE=w(Ec=>{"use strict";var EW=Ec&&Ec.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(Ec,"__esModule",{value:!0});Ec.PropertyCardinalityRegistry=void 0;var TW=Ve(),C3=Pe(),O3=Ge(),sE=zt(),oE=class{static{a(this,"PropertyCardinalityRegistry")}constructor(){this.multiValuedIRIs=new Set,this.initialized=!1}async initialize(e){this.multiValuedIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Property_cardinality"));if(!r){this.initialized=!0;return}let i=await this.findMultipleCardinalityIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let o=t.find(c=>c.value.includes("Asset_label"));if(!o){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,o,void 0);for(let u of l)if(u.object instanceof O3.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.multiValuedIRIs.add(d)}}}catch{}this.initialized=!0}isMultiValued(e){return this.multiValuedIRIs.has(e)}get size(){return this.multiValuedIRIs.size}get isInitialized(){return this.initialized}async findMultipleCardinalityIRI(e,t){let r=t.find(o=>o.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new O3.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof C3.IRI)return i[0].subject;let s=t.find(o=>o.value.includes("Instance_class"));if(s){let o=await e.match(void 0,s,void 0);for(let c of o)if(c.object instanceof C3.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?sE.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?sE.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?sE.Namespace.EXOCMD.term(e.substring(8)).value:null}};Ec.PropertyCardinalityRegistry=oE;Ec.PropertyCardinalityRegistry=oE=EW([(0,TW.injectable)()],oE)});var uE=w(xr=>{"use strict";var AW=xr&&xr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},IW=xr&&xr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(xr,"__esModule",{value:!0});xr.PrototypeChainMaterializer=xr.MAX_PROTOTYPE_DEPTH=xr.INFERRED_GRAPH=void 0;xr.inferredGraphForDepth=cE;var xW=Ve(),P3=Xn(),ha=Pe(),RW=iE(),CW=aE();xr.INFERRED_GRAPH=new ha.IRI("https://exocortex.my/ontology/exo#inferred");var OW="https://exocortex.my/ontology/exo#inferred/";function cE(n){return new ha.IRI(`${OW}${n}`)}a(cE,"inferredGraphForDepth");xr.MAX_PROTOTYPE_DEPTH=10;var lE=class{static{a(this,"PrototypeChainMaterializer")}constructor(e,t){this.registry=e,this.cardinalityRegistry=t??null}async materialize(e){let r=(await e.predicates()).find(c=>c.value.includes("Asset_prototype"));if(!r)return 0;let i=await e.match(void 0,r,void 0);if(i.length===0)return 0;let s=new Map;for(let c of i)if(c.subject instanceof ha.IRI&&c.object instanceof ha.IRI){let l=c.subject.value,u=c.object.value;l!==u&&s.set(l,c.object)}if(s.size===0)return 0;let o=0;for(let[c]of s){let l=new ha.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let g=p.object instanceof ha.IRI?p.object.value:String(p.object),y=h.get(p.predicate.value);y||(y=new Set,h.set(p.predicate.value,y)),y.add(g)}for(let p=0;p<u.length;p++){let g=u[p],y=p+1,b=new ha.IRI(g),S=await e.match(b,void 0,void 0),v=new Set;if(e.matchInGraph){let I=await e.matchInGraph(b,void 0,void 0,xr.INFERRED_GRAPH);for(let A of I)v.add(A.predicate.value)}for(let I of S){let A=I.predicate.value;if(this.registry.isNonInheritable(A)||v.has(A))continue;if(d.has(A)&&this.isMultiValued(A)){let R=I.object instanceof ha.IRI?I.object.value:String(I.object);if(h.get(A)?.has(R))continue;let L=h.get(A);L||(L=new Set,h.set(A,L)),L.add(R);let P=new P3.Triple(l,I.predicate,I.object);await e.add(P),e.addToGraph&&(await e.addToGraph(P,xr.INFERRED_GRAPH),await e.addToGraph(P,cE(y))),o++;continue}if(d.has(A))continue;let T=new P3.Triple(l,I.predicate,I.object);await e.add(T),e.addToGraph&&(await e.addToGraph(T,xr.INFERRED_GRAPH),await e.addToGraph(T,cE(y))),d.add(A),o++}}}return o}isMultiValued(e){return this.cardinalityRegistry?this.cardinalityRegistry.isMultiValued(e):!1}resolveChain(e,t){let r=[],i=new Set;i.add(e);let s=[],o=t.get(e);for(o&&s.push(o.value);s.length>0&&r.length<xr.MAX_PROTOTYPE_DEPTH;){let c=s.shift();if(c===void 0)break;if(i.has(c))continue;i.add(c),r.push(c);let l=t.get(c);l&&!i.has(l.value)&&s.push(l.value)}return r}};xr.PrototypeChainMaterializer=lE;xr.PrototypeChainMaterializer=lE=AW([(0,xW.injectable)(),IW("design:paramtypes",[RW.NonInheritablePropertyRegistry,CW.PropertyCardinalityRegistry])],lE)});var D3=w(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});kg.IRICanonicalizer=void 0;var F3=Pe(),PW=Ge(),FW=jt(),DW=Xn(),fE=/^obsidian:\/\/vault\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i,Ng=class n{static{a(this,"IRICanonicalizer")}static extractSynthAUid(e){let t=fE.exec(e);return t?t[1].toLowerCase():null}static canonicalize(e,t){if(t.size===0)return{triples:e,remapCount:0,uniqueRemapCount:0};let r=new Map,i=new Set,s=0;return{triples:e.map(c=>{let l=n.remapIfSynthA(c.subject,t,r,i),u=n.remapIfSynthA(c.object,t,r,i);return l===c.subject&&u===c.object?c:(s++,new DW.Triple(l,c.predicate,u))}),remapCount:s,uniqueRemapCount:i.size}}static remapIfSynthA(e,t,r,i){if(e instanceof PW.Literal||e instanceof FW.BlankNode||!(e instanceof F3.IRI))return e;let s=fE.exec(e.value);if(!s)return e;let o=s[1].toLowerCase(),c=t.get(o);if(!c||c===e.value)return e;i.add(o);let l=r.get(c);return l||(l=new F3.IRI(c),r.set(c,l)),l}};kg.IRICanonicalizer=Ng;Ng.SYNTH_A_IRI_PATTERN=fE});var jg=w(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.derivePath=L3;sd.deriveUrl=LW;sd.deriveLegacyFlatPath=NW;var dE="assetspaces",Mg=/^[A-Za-z0-9._-]+$/;function L3(n){if(typeof n!="string")return null;let e=n.trim();if(e.length===0||/^file:\/\//i.test(e))return null;e=e.replace(/\/+$/,""),e=e.replace(/\.git$/i,"");let t=null;if(!e.includes("://")){let o=/^[^/@\s]+@[^/:\s]+:(.+)$/.exec(e);o&&(t=o[1])}if(t===null){let o=e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"");o=o.replace(/^[^/@]+@/,"");let c=o.indexOf("/");if(c<0)return null;t=o.slice(c+1)}let r=t.split("/").filter(o=>o.length>0);if(r.length<2)return null;let i=r[0],s=r[1];return i==="."||i===".."||s==="."||s===".."||!Mg.test(i)||!Mg.test(s)?null:`${dE}/${i}/${s}`}a(L3,"derivePath");function LW(n){if(typeof n!="string")return null;let e=n.trim();if(e.length===0)return null;e=e.replace(/^\/+/,"").replace(/\/+$/,"");let t=`${dE}/`;if(!e.startsWith(t))return null;let r=e.slice(t.length).split("/").filter(o=>o.length>0);if(r.length<2)return null;let i=r[0],s=r[1];return i==="."||i===".."||s==="."||s===".."||!Mg.test(i)||!Mg.test(s)?null:`https://github.com/${i}/${s}`}a(LW,"deriveUrl");function NW(n){let e=L3(n);if(e===null)return null;let t=e.split("/")[2];if(t===void 0||t.length===0)return null;let r=t.startsWith("exoas-")?t.slice(6):t;return r.length===0?null:`${dE}/${r}`}a(NW,"deriveLegacyFlatPath")});var $g=w(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.FILE_SPACE_CLASS_UID=void 0;Yi.frontmatterDeclaresFileSpace=MW;Yi.discoverFileSpaceExclusions=$W;var kW=jg();Yi.FILE_SPACE_CLASS_UID="aad8913e-5e9f-4047-879d-93cc46befd52";var N3=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,hE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function M3(n){let e=Array.isArray(n)?n:[n],t=[];for(let r of e){if(typeof r!="string")continue;N3.lastIndex=0;let i;for(;(i=N3.exec(r))!==null;)t.push(i[1].trim())}return t}a(M3,"wikilinkTargets");function MW(n){return n?M3(n.exo__Instance_class).some(e=>hE.test(e)&&e.toLowerCase()===Yi.FILE_SPACE_CLASS_UID):!1}a(MW,"frontmatterDeclaresFileSpace");function k3(n,e){try{return n.getFrontmatter(e)}catch{return null}}a(k3,"readFrontmatterSafe");function jW(n){let e=n.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=n.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(jW,"readSource");function $W(n){let e=[],t=[],r=[],i=new Map,s=a((c,l)=>{if(hE.test(c))return c.toLowerCase()===Yi.FILE_SPACE_CLASS_UID;let u=n.getFirstLinkpathDest(c,l);if(u==null)return!1;let f=i.get(u.path);if(f!==void 0)return f;let h=k3(n,u)?.exo__Asset_uid,p=typeof h=="string"&&h.toLowerCase()===Yi.FILE_SPACE_CLASS_UID;return i.set(u.path,p),p},"isFileSpaceClassRef"),o=a(c=>c.some(l=>hE.test(l)&&l.toLowerCase()===Yi.FILE_SPACE_CLASS_UID),"hasUuidFormRef");for(let c of n.getAllFiles()){let l=k3(n,c);if(!l)continue;let u=M3(l.exo__Instance_class);if(!u.some(p=>s(p,c.path)))continue;t.push(c.path),o(u)||r.push(`FileSpace declaration ${c.path} references the class via a label-form link only \u2014 the sync layer will not pick it up; use the UUID-form wikilink [[${Yi.FILE_SPACE_CLASS_UID}]] (UID-canon)`);let f=jW(l);if(f===null){r.push(`FileSpace declaration ${c.path} has no exo__AssetSpace_source/_git \u2014 mount path underivable, content NOT excluded from the index`);continue}let d=(0,kW.derivePath)(f);if(d===null){r.push(`FileSpace declaration ${c.path}: cannot derive mount path from source "${f}" \u2014 content NOT excluded from the index`);continue}let h=`${d}/`;c.path.startsWith(h)&&r.push(`FileSpace declaration ${c.path} lies INSIDE its own mount ${h} \u2014 it will be excluded from the index together with the content; move the declaration outside the mount folder`),e.push(h)}return{prefixes:e,declarationPaths:t,warnings:r}}a($W,"discoverFileSpaceExclusions")});var j3=w(ei=>{"use strict";var UW=ei&&ei.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},BW=ei&&ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ei,"__esModule",{value:!0});ei.LazyAssetGraphLoader=ei.MAX_LAZY_DEPTH=void 0;var VW=Ve(),qW=Pe(),pE=zt();ei.MAX_LAZY_DEPTH=10;var mE=class{static{a(this,"LazyAssetGraphLoader")}constructor(e,t,r){this.converter=e,this.fileResolver=t,this.store=r,this.loadedIRIs=new Set,this.instanceClassPredicate=pE.Namespace.EXO.term("Instance_class"),this.superClassPredicate=pE.Namespace.EXO.term("Class_superClass"),this.prototypePredicate=pE.Namespace.EXO.term("Asset_prototype")}async ensureFileLoaded(e,t=0){if(t>=ei.MAX_LAZY_DEPTH)return;let r=this.converter.notePathToIRI(e.path).value;if(!this.loadedIRIs.has(r)){this.loadedIRIs.add(r);try{let i=await this.converter.convertNote(e);if(!this.loadedIRIs.has(r)||(await this.store.addAll(i),!this.loadedIRIs.has(r)))return;await this.walkClassAndPrototypeRelations(i,t+1)}catch(i){throw this.loadedIRIs.delete(r),i}}}async ensureLoadedByIRI(e,t=0){if(t>=ei.MAX_LAZY_DEPTH||this.loadedIRIs.has(e.value))return;let r=this.fileResolver.resolveByIRI(e);r!==null&&await this.ensureFileLoaded(r,t)}isLoaded(e){return this.loadedIRIs.has(e.value)}notePathToIRI(e){return this.converter.notePathToIRI(e)}forget(e){this.loadedIRIs.delete(e.value)}clearAll(){this.loadedIRIs.clear()}get loadedCount(){return this.loadedIRIs.size}clearForTests(){this.loadedIRIs.clear()}async walkClassAndPrototypeRelations(e,t){let r=[];for(let i of e){if(!(i.object instanceof qW.IRI))continue;let s=i.predicate.value;(s===this.instanceClassPredicate.value||s===this.superClassPredicate.value||s===this.prototypePredicate.value)&&r.push(i.object)}for(let i of r)await this.ensureLoadedByIRI(i,t)}};ei.LazyAssetGraphLoader=mE;ei.LazyAssetGraphLoader=mE=UW([(0,VW.injectable)(),BW("design:paramtypes",[Object,Object,Object])],mE)});var yE=w(Sr=>{"use strict";var GW=Sr&&Sr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},WW=Sr&&Sr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.SourceAnnotator=Sr.DEPTH_VARIABLE=Sr.SOURCE_VARIABLE=void 0;var HW=Ve(),eu=Ge(),zW=Pe(),Ug=uE();Sr.SOURCE_VARIABLE="_source";Sr.DEPTH_VARIABLE="_depth";var gE=class{static{a(this,"SourceAnnotator")}constructor(e){this.tripleStore=e}async annotate(e,t,r,i){if(!this.tripleStore.matchInGraph)return e.map(o=>{let c=o.clone();return c.set(Sr.SOURCE_VARIABLE,new eu.Literal("own")),c});let s=[];for(let o of e){let c=o.get(t),l=o.get(r),u=o.get(i),f=o.clone();if(!c||!l||!u)f.set(Sr.SOURCE_VARIABLE,new eu.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(Sr.SOURCE_VARIABLE,new eu.Literal(d))}s.push(f)}return s}async annotateSingle(e,t,r,i){return(await this.annotate([e],t,r,i))[0]}async determineSource(e,t,r){return this.tripleStore.matchInGraph&&(await this.tripleStore.matchInGraph(e,t,r,Ug.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=Ug.MAX_PROTOTYPE_DEPTH;i++){let s=(0,Ug.inferredGraphForDepth)(i);if((await this.tripleStore.matchInGraph(e,t,r,s)).length>0)return i}return 0}async annotateBySubject(e,t){if(!this.tripleStore.matchInGraph)return e.map(s=>{let o=s.clone();return o.set(Sr.SOURCE_VARIABLE,new eu.Literal("own")),o});let r=[],i=new Map;for(let s of e){let o=s.get(t),c=s.clone();if(!o||!(o instanceof zW.IRI))c.set(Sr.SOURCE_VARIABLE,new eu.Literal("own"));else{let l=o.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(o,void 0,void 0,Ug.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(Sr.SOURCE_VARIABLE,new eu.Literal(u))}r.push(c)}return r}};Sr.SourceAnnotator=gE;Sr.SourceAnnotator=gE=GW([(0,HW.injectable)(),WW("design:paramtypes",[Object])],gE)});var wE=w(ti=>{"use strict";var KW=ti&&ti.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},YW=ti&&ti.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},$3=ti&&ti.__param||function(n,e){return function(t,r){e(t,r,n)}},SE;Object.defineProperty(ti,"__esModule",{value:!0});ti.NoteToRDFConverter=void 0;ti.normaliseExcludedFolders=q3;ti.isPathExcluded=G3;var bE=Ve(),lr=Xn(),Qi=Pe(),en=Ge(),U3=jt(),Kt=zt(),B3=Bt(),QW=eE(),XW=ol(),_E=Jv(),Bn=tS(),JW=$g(),V3=new Set(["archived","draft","pinned","aliases"]);function q3(n){return Array.isArray(n)?n.map(e=>String(e).replace(/\\/g,"/").trim()).filter(e=>e.length>0).map(e=>e.endsWith("/")?e:`${e}/`):[]}a(q3,"normaliseExcludedFolders");function G3(n,e){if(e.length===0)return!1;let t=n.replace(/\\/g,"/");for(let r of e)if(t.startsWith(r))return!0;return!1}a(G3,"isPathExcluded");function ZW(n){if(!n)return"";let e=n.replace(/\\/g,"/");for(;e.startsWith("/");)e=e.slice(1);for(;e.endsWith("/");)e=e.slice(0,-1);return e.length>0?`${e}/`:""}a(ZW,"normaliseSubjectIriPrefix");var Tc=SE=class{static{a(this,"NoteToRDFConverter")}constructor(e,t=XW.NullLogger,r={}){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.pendingExtraTriples=[],this.vocabularyMapper=new QW.RDFVocabularyMapper,this.subjectIriPrefix=ZW(r.subjectIriPrefix)}async convertNote(e){return this.convertNoteFromFrontmatter(e,this.vault.getFrontmatter(e))}async convertNoteFromFrontmatter(e,t){if(!t)return[];let r=this.notePathToIRI(e.path),i=Kt.Namespace.EXO.term("Asset_filename"),s=new lr.Triple(r,i,new en.Literal(e.basename));if(Bn.Exo003Parser.isExo003Format(t)){let o=await this.convertExo003Note(e,t);return[s,...o]}return this.convertLegacyNote(e,t,s)}async convertLegacyNote(e,t,r){this.pendingExtraTriples=[];let i=[r],s=this.notePathToIRI(e.path),o,c,l,u=!1,f=Kt.Namespace.EXO.term("Statement").value;for(let[y,b]of Object.entries(t)){let S=V3.has(y)?`exo__Asset_${y}`:y;if(!this.isExocortexProperty(S))continue;let v=this.propertyKeyToIRI(S),I=Array.isArray(b)?b:[b];for(let A of I)if(!((y==="exo__Asset_label"||V3.has(y))&&(A==null||typeof A=="string"&&A.trim()==="")))if(y==="exo__Instance_class"){let T=this.valueToClassURI(A);i.push(new lr.Triple(s,v,T))}else{let T=await this.valueToRDFObject(A,e,v);if(S==="exo__Statement_subject"&&o===void 0){let R=T.find(V=>V instanceof Qi.IRI);R&&(o=R)}else if(S==="exo__Statement_predicate"&&c===void 0){let R=T.find(V=>V instanceof Qi.IRI);R&&(c=R)}else S==="exo__Statement_object"&&l===void 0&&(l=T[0]);for(let R of T)if(i.push(new lr.Triple(s,v,R)),this.vocabularyMapper.hasMappingFor(y)&&R instanceof Qi.IRI){let V=this.vocabularyMapper.generateMappedTriple(s,y,R);V&&i.push(V)}}if(y==="exo__Instance_class")for(let A of I){let T=this.valueToClassURI(A);if(T instanceof Qi.IRI){let R=Kt.Namespace.RDF.term("type");i.push(new lr.Triple(s,R,T)),T.value===f&&(u=!0)}}if(y==="exo__Asset_label"){let A=Kt.Namespace.RDFS.term("label");for(let T of I)typeof T=="string"&&T.length>0&&i.push(new lr.Triple(s,A,new en.Literal(T)))}}let d="exo__Instance_class"in t||"exo__Asset_uid"in t,h=t.exo__Asset_label,p="exo__Asset_label"in t&&h!==null&&h!==void 0&&!(typeof h=="string"&&h.trim()==="")&&!(Array.isArray(h)&&h.length===0);if(d&&!p){let y=Kt.Namespace.RDFS.term("label"),b=Kt.Namespace.EXO.term("Asset_label"),S=new en.Literal(e.basename);i.push(new lr.Triple(s,y,S)),i.push(new lr.Triple(s,b,S))}i.push(...this.pendingExtraTriples),this.pendingExtraTriples=[],u&&o&&c&&l&&i.push(new lr.Triple(o,c,l));let g=await this.convertBodyWikilinks(e,s);return i.push(...g),i}async convertExo003Note(e,t){let r=Bn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Bn.Exo003MetadataType.Namespace:break;case Bn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Bn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Bn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Bn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new Qi.IRI(t.uri);return[new lr.Triple(r,Kt.Namespace.OWL.term("sameAs"),i),new lr.Triple(i,Kt.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 lr.Triple(r,Kt.Namespace.OWL.term("sameAs"),new U3.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Bn.Exo003Parser.toTriple(t,i);r.push(s);let o=this.notePathToIRI(e.path);r.push(new lr.Triple(o,Kt.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),o=this.createExo003ReferenceResolver(e),c=o(t.subject),l=o(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 Qi.IRI(c.value):new U3.BlankNode(c.value),f=new Qi.IRI(l.value),d=Bn.Exo003Parser.toLiteral(t,s.trim());r.push(new lr.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new lr.Triple(h,Kt.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 o=this.vault.getFrontmatter(s);if(o&&Bn.Exo003Parser.isExo003Format(o)){let c=Bn.Exo003Parser.parse(o);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Bn.Exo003MetadataType.Anchor||l.metadata===Bn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Bn.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(e={}){return(await this.convertVaultWithValidation({strict:!1,excludedFolders:e.excludedFolders})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1,o=0,c=0,l=(0,JW.discoverFileSpaceExclusions)(this.vault);for(let y of l.warnings)this.logger.warn(`FileSpace discovery: ${y}`);let u=[...q3(e.excludedFolders),...l.prefixes],f=u.length===0?t:t.filter(y=>!G3(y.path,u)),d=e.onProgress,h=e.progressIntervalFiles&&e.progressIntervalFiles>0?e.progressIntervalFiles:SE.INDEX_PROGRESS_INTERVAL,p=f.length,g=0;for(let y of f){if(g++,d&&g%h===0&&g<p)try{d(g,p)}catch{}try{let b=this.vault.getFrontmatter(y),S=b?this.validateExocortexAsset(b,y.basename):null;if(S){if(s)throw new Error(`Invariant violation in "${y.path}": ${S.message}`);i.push({path:y.path,reason:`Invariant violation: ${S.message}`}),o++,this.logger.info(`Skipping file with invariant violation: ${y.path}`,{code:S.code,property:S.property,reason:S.message});continue}let v=await this.convertNote(y);r.push(...v)}catch(b){let S=b instanceof Error?b.message:String(b);if(s)throw new Error(`Invalid IRI for file "${y.path}": ${S}`);i.push({path:y.path,reason:`Invalid IRI: ${S}`}),c++,this.logger.info(`Skipping file with invalid IRI: ${y.path}`,{reason:S})}}return o>0&&this.logger.warn(`Skipped ${o} file${o===1?"":"s"} with invariant violations during indexing (paths in developer console)`,{count:o}),c>0&&this.logger.warn(`Skipped ${c} file${c===1?"":"s"} with invalid IRI during indexing (paths in developer console)`,{count:c}),{triples:r,skippedFiles:i,summary:{total:f.length,indexed:f.length-i.length,skipped:i.length},fileSpaces:l}}static inferLabelFromBasename(e){return Kt.Namespace.fromPropertyKey(e)!==null?e:null}validateExocortexAsset(e,t){let r=a(d=>d==null?!0:typeof d=="string"?d.trim()==="":Array.isArray(d)?d.length===0||d.every(r):!1,"isEmpty");if(!("exo__Instance_class"in e||"exo__Asset_uid"in e))return null;let s=["exo__Asset_uid","exo__Instance_class"];for(let d of s){if(!(d in e))return{code:"MISSING_PROPERTY",property:d,message:`Required property "${d}" is missing`};if(r(e[d]))return{code:"EMPTY_PROPERTY",property:d,message:`Required property "${d}" is empty`}}let o=["ems__Effort_status","ems__Effort_parent","ems__Effort_lockedBy","ems__Effort_lockExpires","exo__Asset_updatedAt","ems__Effort_startTimestamp"];for(let d of o)if(d in e&&r(e[d]))return{code:"EMPTY_OPTIONAL_PROPERTY",property:d,message:`Optional property "${d}" is present but empty`};let c=e.exo__Instance_class,l=Array.isArray(c)?c:[c],u=null,f=!1;for(let d of l){if(typeof d!="string")continue;let h=this.removeQuotes(d),g=(this.extractWikilink(h)??h).trim();/^[a-z][a-zA-Z0-9]*__/.test(g)&&/[\s()]/.test(g)?u||(u={candidate:d}):f=!0}return u&&!f?{code:"INVALID_INSTANCE_CLASS_IRI",property:"exo__Instance_class",message:`Invalid Instance_class IRI: "${u.candidate}"`}:null}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=(0,_E.vaultPathToIRI)(r.path);Qi.IRI.isValidIRI(i)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new Qi.IRI((0,_E.vaultPathToIRI)(`${this.subjectIriPrefix}${e}`))}synthesizeWikilinkTargetIRI(e){return new Qi.IRI((0,_E.vaultPathToIRI)(e))}isExocortexProperty(e){return Kt.Namespace.fromPropertyKey(e)!==null}propertyKeyToIRI(e){let t=Kt.Namespace.fromPropertyKey(e);if(!t)throw new Error(`Invalid property key: ${e}`);return t.namespace.term(t.localName)}emitTypeTripleForEnumInstance(e,t){let r=this.vault.getFrontmatter(t);if(!r)return;let i=r.exo__Instance_class,s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return;let o=this.valueToClassURI(s);o instanceof Qi.IRI&&(this.pendingExtraTriples.push(new lr.Triple(e,Kt.Namespace.RDF.term("type"),o)),this.pendingExtraTriples.push(new lr.Triple(e,Kt.Namespace.EXO.term("Instance_class"),o)))}async valueToRDFObject(e,t,r){if(typeof e=="string"){let i=this.removeQuotes(e);if(r?.value.endsWith("#TokenInvocation_parameter"))return[new en.Literal(i)];let s=this.extractWikilink(i);if(s){let o=this.vault.getFirstLinkpathDest(s,t.path);if(o){let l=this.notePathToIRI(o.path),u=s.includes("|")?s.split("|")[0]:s;if(this.isUUID(u)){let d=new en.Literal(u);if(r?.value.endsWith("#Grounding_targetValueRef")||r?.value.endsWith("#Grounding_targetValueSubstitution")||r?.value.endsWith("#Grounding_targetClass")||r?.value.endsWith("#Grounding_type")||r?.value.endsWith("#PropertyDefault_value"))return[l];let p=this.expandClassValue(o.basename);if(p)return this.emitTypeTripleForEnumInstance(p,o),[p];let g=this.vault.getFrontmatter(o);if(g){let I=g.exo__Asset_label;if(typeof I=="string"){let A=this.expandClassValue(I);if(A)return this.emitTypeTripleForEnumInstance(A,o),[A]}}let y=r?.value.endsWith("#Asset_prototype")||r?.value.endsWith("/Asset_prototype"),S=((typeof process<"u"?process.env:void 0)?.EXOCORTEX_DUAL_STORAGE_PREDICATES??"").split(",").map(I=>I.trim()).filter(Boolean),v=S.length>0&&S.some(I=>r?.value.endsWith(`#${I}`));return y||v?[l,d]:[l]}let f=this.expandClassValue(o.basename);return f?(this.emitTypeTripleForEnumInstance(f,o),[f]):[l]}if(this.isClassReference(s)){let l=this.expandClassValue(s);if(l)return[l]}let c=s.includes("|")?s.split("|")[0]:s;return this.isUUID(c)?[this.synthesizeWikilinkTargetIRI(`${c}.md`)]:[new en.Literal(i)]}if(this.isClassReference(i)){let o=this.expandClassValue(i);if(o)return[o]}return this.isISO8601DateTime(i)?[new en.Literal(i,Kt.Namespace.XSD.term("dateTime"))]:[new en.Literal(i)]}return typeof e=="boolean"?[new en.Literal(e.toString())]:typeof e=="number"?[new en.Literal(e.toString(),Kt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new en.Literal(e.toISOString(),Kt.Namespace.XSD.term("dateTime"))]:[new en.Literal(String(e))]}isISO8601DateTime(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/.test(e)}removeQuotes(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.substring(1,t.length-1):e}extractWikilink(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1];return r.includes("|")?r.split("|")[0]:r}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1],i=r.indexOf("|");return i>=0?r.substring(i+1).trim():null}valueToClassURI(e){if(typeof e!="string")return new en.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);if(s)return s;let o=this.extractWikilinkAlias(t);if(o){let c=this.expandClassValue(o);if(c)return c}if(this.isUUID(i)){let c=this.vault.getFirstLinkpathDest(i,"");if(c){let l=this.expandClassValue(c.basename);if(l)return l;let u=this.vault.getFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return d}}return this.notePathToIRI(c.path)}}return new en.Literal(t)}isClassReference(e){return/\s/.test(e)?!1:Kt.Namespace.fromPropertyKey(e)!==null}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}expandClassValue(e){let t=this.removeQuotes(e),r=Kt.Namespace.fromPropertyKey(t);return!r||/[\s()]/.test(r.localName)?null:r.namespace.term(r.localName)}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,r,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(r=i.exec(e))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),o=this.extractBodyWikilinks(s),c=Kt.Namespace.EXO.term("Asset_bodyLink");for(let l of o){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new lr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new lr.Triple(t,c,f)):r.push(new lr.Triple(t,c,new en.Literal(l)))}else r.push(new lr.Triple(t,c,new en.Literal(l)))}}catch{}return r}};ti.NoteToRDFConverter=Tc;Tc.INDEX_PROGRESS_INTERVAL=200;Tc.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Tc.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Tc.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};ti.NoteToRDFConverter=Tc=SE=KW([(0,bE.injectable)(),$3(0,(0,bE.inject)(B3.DI_TOKENS.IVaultAdapter)),$3(1,(0,bE.inject)(B3.DI_TOKENS.ILogger)),YW("design:paramtypes",[Object,Object,Object])],Tc)});var EE=w(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});Bg.FilterContainsOptimizer=void 0;var eH=Pe(),tH=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,vE=class{static{a(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(tH);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 eH.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(o=>o.subject.type==="variable"&&o.subject.value===t?{...o,subject:{type:"iri",value:r}}:o);if(i.some((o,c)=>o.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(o=>({[t.variable]:{type:"iri",value:o}}))},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)}};Bg.FilterContainsOptimizer=vE});var W3=w(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});Vg.AlgebraOptimizer=void 0;var rH=EE(),TE=class{static{a(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new rH.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),o=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return o&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!o?{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)}};Vg.AlgebraOptimizer=TE});var H3=w(qg=>{"use strict";Object.defineProperty(qg,"__esModule",{value:!0});qg.AlgebraSerializer=void 0;var AE=class{static{a(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
225
225
|
${e.triples.map(u=>`${r} ${this.tripleToString(u)}`).join(`
|
|
226
226
|
`)}
|
|
227
227
|
${r}]`;case"filter":return`${r}Filter(
|
|
@@ -253,7 +253,7 @@ ${r})`;case"extend":return`${r}Extend (?${e.variable} = ${this.expressionToStrin
|
|
|
253
253
|
${this.toString(e.input,t+1)}
|
|
254
254
|
${r})`;case"subquery":return`${r}Subquery(
|
|
255
255
|
${this.toString(e.query,t+1)}
|
|
256
|
-
${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)}};qg.AlgebraSerializer=AE});var K3=w(Gg=>{"use strict";Object.defineProperty(Gg,"__esModule",{value:!0});Gg.DescribeExecutor=void 0;var z3=Pe(),IE=class{static{a(this,"DescribeExecutor")}constructor(e){this.tripleStore=e}async execute(e,t){let r=[],i=new Set,s=new Set,o=t?.depth;for(let c of e)await this.describeResourceWithDepth(c,o,1,t?.symmetric??!0,r,i,s);return r}async describeResourceWithDepth(e,t,r,i,s,o,c){let l=e.toString();if(c.has(l)||(c.add(l),t!==void 0&&r>t))return;let u=[],f=await this.tripleStore.match(e,void 0,void 0);if(u.push(...f),i){let h=await this.tripleStore.match(void 0,void 0,e);u.push(...h)}let d=[];for(let h of u){let p=`${h.subject.toString()}|${h.predicate.toString()}|${h.object.toString()}`;o.has(p)||(o.add(p),s.push(h),(t===void 0||r<t)&&(this.isIRI(h.subject)&&h.subject.toString()!==l&&d.push(h.subject),this.isIRI(h.object)&&h.object.toString()!==l&&d.push(h.object)))}for(let h of d)await this.describeResourceWithDepth(h,t,r+1,i,s,o,c)}isIRI(e){if(!e||typeof e!="object")return!1;let t=e;return e instanceof z3.IRI||t.termType==="NamedNode"||typeof t.value=="string"&&t.value.startsWith("http")}async describeByIRI(e,t){let r=new z3.IRI(e);return this.execute([r],t)}};Gg.DescribeExecutor=IE});var Q3=w(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.UpdateExecutor=ru.UpdateExecutorError=void 0;var nH=Xn(),tu=Pe(),xE=Ge(),Y3=jt(),en=class extends Error{static{a(this,"UpdateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="UpdateExecutorError"}};ru.UpdateExecutorError=en;var RE=class{static{a(this,"UpdateExecutor")}constructor(e){this.tripleStore=e}async execute(e){if(e.type!=="update")throw new en("Expected UPDATE request");let t=[];for(let r of e.updates){let i=await this.executeOperation(r);t.push(i)}return t}async executeOperation(e){if("updateType"in e)switch(e.updateType){case"insert":return this.executeInsertData(e);case"delete":return this.executeDeleteData(e);case"insertdelete":throw new en("INSERT/DELETE with WHERE clause not yet implemented");case"deletewhere":throw new en("DELETE WHERE not yet implemented");default:throw new en(`Unknown update type: ${e.updateType}`)}if("type"in e)switch(e.type){case"clear":case"drop":case"load":case"create":case"copy":case"move":case"add":throw new en(`${e.type.toUpperCase()} operation not yet implemented`);default:throw new en(`Unknown operation type: ${e.type}`)}throw new en("Unknown update operation structure")}async executeInsertData(e){if(e.updateType!=="insert")throw new en("Expected INSERT DATA operation");let t=e,r=0;for(let i of t.insert)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.insertTriples(i.triples,s)}else if(i.type==="graph"){let s=i,o=this.parseGraphName(s.name);r+=await this.insertTriples(s.triples,o)}return{type:"insert",inserted:r,success:!0}}async executeDeleteData(e){if(e.updateType!=="delete")throw new en("Expected DELETE DATA operation");let t=e,r=0;for(let i of t.delete)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.deleteTriples(i.triples,s)}else if(i.type==="graph"){let s=i,o=this.parseGraphName(s.name);r+=await this.deleteTriples(s.triples,o)}return{type:"delete",deleted:r,success:!0}}async insertTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i);t&&this.tripleStore.addToGraph?await this.tripleStore.addToGraph(s,t):await this.tripleStore.add(s),r++}return r}async deleteTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i),o;t&&this.tripleStore.removeFromGraph?o=await this.tripleStore.removeFromGraph(s,t):o=await this.tripleStore.remove(s),o&&r++}return r}convertTriple(e){return new nH.Triple(this.convertSubject(e.subject),this.convertPredicate(e.predicate),this.convertObject(e.object))}convertSubject(e){if(e.termType==="NamedNode")return new tu.IRI(e.value);if(e.termType==="BlankNode")return new Y3.BlankNode(e.value);throw new en(`Invalid subject term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}convertPredicate(e){if("termType"in e&&e.termType==="NamedNode")return new tu.IRI(e.value);throw new en("Invalid predicate term type. Only IRIs are allowed in INSERT DATA.")}convertObject(e){if(e.termType==="NamedNode")return new tu.IRI(e.value);if(e.termType==="BlankNode")return new Y3.BlankNode(e.value);if(e.termType==="Literal"){let t=e;return t.language?new xE.Literal(t.value,void 0,t.language):t.datatype?new xE.Literal(t.value,new tu.IRI(t.datatype.value)):new xE.Literal(t.value)}throw new en(`Invalid object term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}resolveGraphName(e){if(e&&!e.default&&e.name)return new tu.IRI(e.name.value)}parseGraphName(e){if(e.termType==="Variable")throw new en("Variables are not allowed as graph names in INSERT DATA / DELETE DATA.");return new tu.IRI(e.value)}};ru.UpdateExecutor=RE});var J3=w(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});Wg.AggregateFunctions=void 0;var CE=Ge(),X3=Pe(),OE=class{static{a(this,"AggregateFunctions")}static count(e,t){if(!t)return e.length;let r=0;for(let i of e)i.has(t)&&r++;return r}static countDistinct(e,t){let r=new Set;for(let i of e){let s=i.get(t);s&&r.add(s.toString())}return r.size}static sum(e,t){let r=0;for(let i of e){let s=i.get(t);if(s instanceof CE.Literal){let o=this.toNumber(s);isNaN(o)||(r+=o)}}return r}static avg(e,t){let r=this.sum(e,t),i=this.count(e,t);return i>0?r/i:0}static min(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let o=this.toComparable(s);(r===null||o<r)&&(r=o)}return r}static max(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let o=this.toComparable(s);(r===null||o>r)&&(r=o)}return r}static groupConcat(e,t,r=" "){let i=[];for(let s of e){let o=s.get(t);o&&(o instanceof CE.Literal||o instanceof X3.IRI?i.push(o.value):i.push(o.toString()))}return i.join(r)}static sample(e,t){for(let r of e){let i=r.get(t);if(i)return this.toComparable(i)}return null}static sampleDistinct(e,t){return this.sample(e,t)}static toNumber(e){let t=e.datatype?.value;return t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double"),parseFloat(e.value)}static toComparable(e){if(e instanceof CE.Literal){let t=this.toNumber(e);return isNaN(t)?e.value:t}return e instanceof X3.IRI?e.value:String(e)}};Wg.AggregateFunctions=OE});var Z3=w(Hg=>{"use strict";Object.defineProperty(Hg,"__esModule",{value:!0});Hg.QueryPlanCache=void 0;var iH=dg(),PE=class{static{a(this,"QueryPlanCache")}constructor(e=100){this.hits=0,this.misses=0,this.cache=new iH.LRUCache(e)}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r!==void 0?this.hits++:this.misses++,r}set(e,t){let r=this.normalizeQuery(e);this.cache.set(r,t)}has(e){let t=this.normalizeQuery(e);return this.cache.get(t)!==void 0}clear(){this.cache.clear()}getStats(){let e=this.hits+this.misses;return{hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0,size:this.cache.size()}}resetStats(){this.hits=0,this.misses=0}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}};Hg.QueryPlanCache=PE});var eP=w(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.SPARQLResultCache=void 0;od.createSPARQLResultCache=aH;var sH=dg(),oH={maxSize:500,ttlMs:300*1e3,enableFileInvalidation:!0,maxResultSizeBytes:10*1024*1024},zg=class{static{a(this,"SPARQLResultCache")}constructor(e={}){this.fileToQueries=new Map,this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0},this.avgQueryTimeMs=100,this.options={...oH,...e},this.cache=new sH.LRUCache(this.options.maxSize)}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}hashResult(e){return this.isTripleArray(e)?`T:${e.length}`:`S:${e.length}`}isTripleArray(e){return e.length>0&&"subject"in e[0]}estimateResultSize(e){return this.isTripleArray(e)?e.length*300:e.length*200}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);if(r===void 0){this.stats.misses++;return}if(Date.now()-r.timestamp>this.options.ttlMs){this.cache.set(t,void 0),this.stats.ttlInvalidations++,this.stats.misses++;return}return this.stats.hits++,this.stats.totalTimeSavedMs+=this.avgQueryTimeMs,r.result}set(e,t,r,i){if(this.estimateResultSize(t)>this.options.maxResultSizeBytes)return;i!==void 0&&(this.avgQueryTimeMs=(this.avgQueryTimeMs+i)/2);let o=this.normalizeQuery(e),c=r??new Set,l={result:t,timestamp:Date.now(),affectedFiles:c,resultHash:this.hashResult(t)};if(this.cache.size()>=this.options.maxSize&&this.stats.evictions++,this.cache.set(o,l),this.options.enableFileInvalidation)for(let f of c){let d=this.fileToQueries.get(f);d||(d=new Set,this.fileToQueries.set(f,d)),d.add(o)}}has(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r===void 0?!1:Date.now()-r.timestamp<=this.options.ttlMs}invalidateByFile(e){if(!this.options.enableFileInvalidation)return 0;let t=this.fileToQueries.get(e);if(!t)return 0;let r=0;for(let i of t)this.cache.set(i,void 0),r++,this.stats.fileInvalidations++;return this.fileToQueries.delete(e),r}clear(){this.cache.clear(),this.fileToQueries.clear()}getStats(){let e=this.stats.hits+this.stats.misses,t=e>0?this.stats.hits/e:0;return{hits:this.stats.hits,misses:this.stats.misses,hitRate:t,size:this.cache.size(),maxSize:this.options.maxSize,evictions:this.stats.evictions,ttlInvalidations:this.stats.ttlInvalidations,fileInvalidations:this.stats.fileInvalidations,avgTimeSavedMs:this.stats.hits>0?this.stats.totalTimeSavedMs/this.stats.hits:0}}resetStats(){this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0}}size(){return this.cache.size()}pruneExpired(){return 0}};od.SPARQLResultCache=zg;function aH(n){return new zg(n)}a(aH,"createSPARQLResultCache")});var tP=w(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.IncrementalIndexer=void 0;ad.createIncrementalIndexer=uH;var cH=dc(),lH={throttleMs:500,maxBatchSize:100,useContentHashing:!1},Kg=class{static{a(this,"IncrementalIndexer")}constructor(e={}){this.fileMetadata=new Map,this.pendingChanges=[],this.throttleTimer=null,this.invalidateCallbacks=[],this.lastIndexTime=0,this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]},this.options={...lH,...e}}recordChange(e){this.pendingChanges.push(e),this.stats.totalChanges++,this.throttleTimer===null&&(this.throttleTimer=setTimeout(()=>{this.processPendingChanges(),this.throttleTimer=null},this.options.throttleMs))}processPendingChanges(){if(this.pendingChanges.length===0)return;let e=performance.now(),t=new Map;for(let o of this.pendingChanges)t.set(o.path,o);let r=Array.from(t.values()),i=[];for(let o of r)switch(o.type){case"deleted":this.fileMetadata.delete(o.path),i.push(o);break;case"renamed":o.oldPath&&this.fileMetadata.delete(o.oldPath),i.push(o);break;case"created":case"modified":i.push(o);break}if(i.length>0){this.stats.invalidations+=i.length;for(let o of this.invalidateCallbacks)try{o(i)}catch(c){cH.LoggingService.error("IncrementalIndexer: Error in invalidation callback",c instanceof Error?c:new Error(String(c)))}}let s=performance.now()-e;this.stats.indexDurations.push(s),this.stats.indexDurations.length>100&&this.stats.indexDurations.shift(),this.lastIndexTime=Date.now(),this.pendingChanges=[]}flush(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.processPendingChanges()}updateMetadata(e,t,r,i){this.fileMetadata.set(e,{mtime:t,size:r,contentHash:i})}hasChanged(e,t,r){let i=this.fileMetadata.get(e);return i===void 0||i.mtime!==t||r!==void 0&&i.size!==r}getChangedFiles(e){let t=[];for(let[r,i]of this.fileMetadata.entries())i.mtime>e&&t.push(r);return t}onInvalidate(e){return this.invalidateCallbacks.push(e),()=>{let t=this.invalidateCallbacks.indexOf(e);t!==-1&&this.invalidateCallbacks.splice(t,1)}}getStats(){let e=this.stats.indexDurations,t=e.length>0?e.reduce((i,s)=>i+s,0)/e.length:0,r=e.length>0?e[e.length-1]:0;return{trackedFiles:this.fileMetadata.size,totalChanges:this.stats.totalChanges,invalidations:this.stats.invalidations,noOpChanges:this.stats.noOpChanges,lastIndexDurationMs:r,avgIndexDurationMs:t,lastIndexTime:this.lastIndexTime}}resetStats(){this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]}}clear(){this.fileMetadata.clear(),this.pendingChanges=[],this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null)}size(){return this.fileMetadata.size}isTracked(e){return this.fileMetadata.has(e)}getMetadata(e){return this.fileMetadata.get(e)}dispose(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.invalidateCallbacks=[],this.pendingChanges=[],this.fileMetadata.clear()}};ad.IncrementalIndexer=Kg;function uH(n){return new Kg(n)}a(uH,"createIncrementalIndexer")});var rP=w(Jg=>{"use strict";Object.defineProperty(Jg,"__esModule",{value:!0});Jg.ResultSerializer=void 0;var Yg=Ge(),Qg=Pe(),Xg=jt(),FE=class{static{a(this,"ResultSerializer")}serialize(e,t,r={}){switch(t){case"json":return this.serializeJSON(e,r);case"xml":return this.serializeXML(e,r);case"csv":return this.serializeCSV(e,r);case"turtle":return this.serializeTurtle(e,r);default:throw new Error(`Unsupported result format: ${t}`)}}serializeJSON(e,t={}){let r=this.toJSONResultSet(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}toJSONResultSet(e,t={}){let r=new Set;for(let o of e)for(let c of o.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=e.map(o=>{let c={};for(let l of i){let u=o.get(l);u!==void 0&&(c[l]=this.termToJSONBinding(u))}return c});return{head:{vars:i},results:{bindings:s}}}termToJSONBinding(e){return e instanceof Qg.IRI?{type:"uri",value:e.value}:e instanceof Xg.BlankNode?{type:"bnode",value:e.id}:e instanceof Yg.Literal?this.literalToJSONBinding(e):{type:"literal",value:String(e)}}literalToJSONBinding(e){let t={type:"literal",value:e.value};return e.datatype?t.datatype=e.datatype.value:e.language&&(t["xml:lang"]=e.language,e.hasDirection()&&e.direction&&(t.direction=e.direction)),t}serializeXML(e,t={}){let r=new Set;for(let o of e)for(let c of o.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=['<?xml version="1.0"?>','<sparql xmlns="http://www.w3.org/2005/sparql-results#">'," <head>"];for(let o of i)s.push(` <variable name="${this.escapeXML(o)}"/>`);s.push(" </head>"),s.push(" <results>");for(let o of e){s.push(" <result>");for(let c of i){let l=o.get(c);l!==void 0&&(s.push(` <binding name="${this.escapeXML(c)}">`),s.push(" "+this.termToXML(l)),s.push(" </binding>"))}s.push(" </result>")}return s.push(" </results>"),s.push("</sparql>"),s.join(`
|
|
256
|
+
${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)}};qg.AlgebraSerializer=AE});var K3=w(Gg=>{"use strict";Object.defineProperty(Gg,"__esModule",{value:!0});Gg.DescribeExecutor=void 0;var z3=Pe(),IE=class{static{a(this,"DescribeExecutor")}constructor(e){this.tripleStore=e}async execute(e,t){let r=[],i=new Set,s=new Set,o=t?.depth;for(let c of e)await this.describeResourceWithDepth(c,o,1,t?.symmetric??!0,r,i,s);return r}async describeResourceWithDepth(e,t,r,i,s,o,c){let l=e.toString();if(c.has(l)||(c.add(l),t!==void 0&&r>t))return;let u=[],f=await this.tripleStore.match(e,void 0,void 0);if(u.push(...f),i){let h=await this.tripleStore.match(void 0,void 0,e);u.push(...h)}let d=[];for(let h of u){let p=`${h.subject.toString()}|${h.predicate.toString()}|${h.object.toString()}`;o.has(p)||(o.add(p),s.push(h),(t===void 0||r<t)&&(this.isIRI(h.subject)&&h.subject.toString()!==l&&d.push(h.subject),this.isIRI(h.object)&&h.object.toString()!==l&&d.push(h.object)))}for(let h of d)await this.describeResourceWithDepth(h,t,r+1,i,s,o,c)}isIRI(e){if(!e||typeof e!="object")return!1;let t=e;return e instanceof z3.IRI||t.termType==="NamedNode"||typeof t.value=="string"&&t.value.startsWith("http")}async describeByIRI(e,t){let r=new z3.IRI(e);return this.execute([r],t)}};Gg.DescribeExecutor=IE});var Q3=w(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.UpdateExecutor=ru.UpdateExecutorError=void 0;var nH=Xn(),tu=Pe(),xE=Ge(),Y3=jt(),tn=class extends Error{static{a(this,"UpdateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="UpdateExecutorError"}};ru.UpdateExecutorError=tn;var RE=class{static{a(this,"UpdateExecutor")}constructor(e){this.tripleStore=e}async execute(e){if(e.type!=="update")throw new tn("Expected UPDATE request");let t=[];for(let r of e.updates){let i=await this.executeOperation(r);t.push(i)}return t}async executeOperation(e){if("updateType"in e)switch(e.updateType){case"insert":return this.executeInsertData(e);case"delete":return this.executeDeleteData(e);case"insertdelete":throw new tn("INSERT/DELETE with WHERE clause not yet implemented");case"deletewhere":throw new tn("DELETE WHERE not yet implemented");default:throw new tn(`Unknown update type: ${e.updateType}`)}if("type"in e)switch(e.type){case"clear":case"drop":case"load":case"create":case"copy":case"move":case"add":throw new tn(`${e.type.toUpperCase()} operation not yet implemented`);default:throw new tn(`Unknown operation type: ${e.type}`)}throw new tn("Unknown update operation structure")}async executeInsertData(e){if(e.updateType!=="insert")throw new tn("Expected INSERT DATA operation");let t=e,r=0;for(let i of t.insert)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.insertTriples(i.triples,s)}else if(i.type==="graph"){let s=i,o=this.parseGraphName(s.name);r+=await this.insertTriples(s.triples,o)}return{type:"insert",inserted:r,success:!0}}async executeDeleteData(e){if(e.updateType!=="delete")throw new tn("Expected DELETE DATA operation");let t=e,r=0;for(let i of t.delete)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.deleteTriples(i.triples,s)}else if(i.type==="graph"){let s=i,o=this.parseGraphName(s.name);r+=await this.deleteTriples(s.triples,o)}return{type:"delete",deleted:r,success:!0}}async insertTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i);t&&this.tripleStore.addToGraph?await this.tripleStore.addToGraph(s,t):await this.tripleStore.add(s),r++}return r}async deleteTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i),o;t&&this.tripleStore.removeFromGraph?o=await this.tripleStore.removeFromGraph(s,t):o=await this.tripleStore.remove(s),o&&r++}return r}convertTriple(e){return new nH.Triple(this.convertSubject(e.subject),this.convertPredicate(e.predicate),this.convertObject(e.object))}convertSubject(e){if(e.termType==="NamedNode")return new tu.IRI(e.value);if(e.termType==="BlankNode")return new Y3.BlankNode(e.value);throw new tn(`Invalid subject term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}convertPredicate(e){if("termType"in e&&e.termType==="NamedNode")return new tu.IRI(e.value);throw new tn("Invalid predicate term type. Only IRIs are allowed in INSERT DATA.")}convertObject(e){if(e.termType==="NamedNode")return new tu.IRI(e.value);if(e.termType==="BlankNode")return new Y3.BlankNode(e.value);if(e.termType==="Literal"){let t=e;return t.language?new xE.Literal(t.value,void 0,t.language):t.datatype?new xE.Literal(t.value,new tu.IRI(t.datatype.value)):new xE.Literal(t.value)}throw new tn(`Invalid object term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}resolveGraphName(e){if(e&&!e.default&&e.name)return new tu.IRI(e.name.value)}parseGraphName(e){if(e.termType==="Variable")throw new tn("Variables are not allowed as graph names in INSERT DATA / DELETE DATA.");return new tu.IRI(e.value)}};ru.UpdateExecutor=RE});var J3=w(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});Wg.AggregateFunctions=void 0;var CE=Ge(),X3=Pe(),OE=class{static{a(this,"AggregateFunctions")}static count(e,t){if(!t)return e.length;let r=0;for(let i of e)i.has(t)&&r++;return r}static countDistinct(e,t){let r=new Set;for(let i of e){let s=i.get(t);s&&r.add(s.toString())}return r.size}static sum(e,t){let r=0;for(let i of e){let s=i.get(t);if(s instanceof CE.Literal){let o=this.toNumber(s);isNaN(o)||(r+=o)}}return r}static avg(e,t){let r=this.sum(e,t),i=this.count(e,t);return i>0?r/i:0}static min(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let o=this.toComparable(s);(r===null||o<r)&&(r=o)}return r}static max(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let o=this.toComparable(s);(r===null||o>r)&&(r=o)}return r}static groupConcat(e,t,r=" "){let i=[];for(let s of e){let o=s.get(t);o&&(o instanceof CE.Literal||o instanceof X3.IRI?i.push(o.value):i.push(o.toString()))}return i.join(r)}static sample(e,t){for(let r of e){let i=r.get(t);if(i)return this.toComparable(i)}return null}static sampleDistinct(e,t){return this.sample(e,t)}static toNumber(e){let t=e.datatype?.value;return t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double"),parseFloat(e.value)}static toComparable(e){if(e instanceof CE.Literal){let t=this.toNumber(e);return isNaN(t)?e.value:t}return e instanceof X3.IRI?e.value:String(e)}};Wg.AggregateFunctions=OE});var Z3=w(Hg=>{"use strict";Object.defineProperty(Hg,"__esModule",{value:!0});Hg.QueryPlanCache=void 0;var iH=dg(),PE=class{static{a(this,"QueryPlanCache")}constructor(e=100){this.hits=0,this.misses=0,this.cache=new iH.LRUCache(e)}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r!==void 0?this.hits++:this.misses++,r}set(e,t){let r=this.normalizeQuery(e);this.cache.set(r,t)}has(e){let t=this.normalizeQuery(e);return this.cache.get(t)!==void 0}clear(){this.cache.clear()}getStats(){let e=this.hits+this.misses;return{hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0,size:this.cache.size()}}resetStats(){this.hits=0,this.misses=0}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}};Hg.QueryPlanCache=PE});var eP=w(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.SPARQLResultCache=void 0;od.createSPARQLResultCache=aH;var sH=dg(),oH={maxSize:500,ttlMs:300*1e3,enableFileInvalidation:!0,maxResultSizeBytes:10*1024*1024},zg=class{static{a(this,"SPARQLResultCache")}constructor(e={}){this.fileToQueries=new Map,this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0},this.avgQueryTimeMs=100,this.options={...oH,...e},this.cache=new sH.LRUCache(this.options.maxSize)}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}hashResult(e){return this.isTripleArray(e)?`T:${e.length}`:`S:${e.length}`}isTripleArray(e){return e.length>0&&"subject"in e[0]}estimateResultSize(e){return this.isTripleArray(e)?e.length*300:e.length*200}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);if(r===void 0){this.stats.misses++;return}if(Date.now()-r.timestamp>this.options.ttlMs){this.cache.set(t,void 0),this.stats.ttlInvalidations++,this.stats.misses++;return}return this.stats.hits++,this.stats.totalTimeSavedMs+=this.avgQueryTimeMs,r.result}set(e,t,r,i){if(this.estimateResultSize(t)>this.options.maxResultSizeBytes)return;i!==void 0&&(this.avgQueryTimeMs=(this.avgQueryTimeMs+i)/2);let o=this.normalizeQuery(e),c=r??new Set,l={result:t,timestamp:Date.now(),affectedFiles:c,resultHash:this.hashResult(t)};if(this.cache.size()>=this.options.maxSize&&this.stats.evictions++,this.cache.set(o,l),this.options.enableFileInvalidation)for(let f of c){let d=this.fileToQueries.get(f);d||(d=new Set,this.fileToQueries.set(f,d)),d.add(o)}}has(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r===void 0?!1:Date.now()-r.timestamp<=this.options.ttlMs}invalidateByFile(e){if(!this.options.enableFileInvalidation)return 0;let t=this.fileToQueries.get(e);if(!t)return 0;let r=0;for(let i of t)this.cache.set(i,void 0),r++,this.stats.fileInvalidations++;return this.fileToQueries.delete(e),r}clear(){this.cache.clear(),this.fileToQueries.clear()}getStats(){let e=this.stats.hits+this.stats.misses,t=e>0?this.stats.hits/e:0;return{hits:this.stats.hits,misses:this.stats.misses,hitRate:t,size:this.cache.size(),maxSize:this.options.maxSize,evictions:this.stats.evictions,ttlInvalidations:this.stats.ttlInvalidations,fileInvalidations:this.stats.fileInvalidations,avgTimeSavedMs:this.stats.hits>0?this.stats.totalTimeSavedMs/this.stats.hits:0}}resetStats(){this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0}}size(){return this.cache.size()}pruneExpired(){return 0}};od.SPARQLResultCache=zg;function aH(n){return new zg(n)}a(aH,"createSPARQLResultCache")});var tP=w(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.IncrementalIndexer=void 0;ad.createIncrementalIndexer=uH;var cH=dc(),lH={throttleMs:500,maxBatchSize:100,useContentHashing:!1},Kg=class{static{a(this,"IncrementalIndexer")}constructor(e={}){this.fileMetadata=new Map,this.pendingChanges=[],this.throttleTimer=null,this.invalidateCallbacks=[],this.lastIndexTime=0,this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]},this.options={...lH,...e}}recordChange(e){this.pendingChanges.push(e),this.stats.totalChanges++,this.throttleTimer===null&&(this.throttleTimer=setTimeout(()=>{this.processPendingChanges(),this.throttleTimer=null},this.options.throttleMs))}processPendingChanges(){if(this.pendingChanges.length===0)return;let e=performance.now(),t=new Map;for(let o of this.pendingChanges)t.set(o.path,o);let r=Array.from(t.values()),i=[];for(let o of r)switch(o.type){case"deleted":this.fileMetadata.delete(o.path),i.push(o);break;case"renamed":o.oldPath&&this.fileMetadata.delete(o.oldPath),i.push(o);break;case"created":case"modified":i.push(o);break}if(i.length>0){this.stats.invalidations+=i.length;for(let o of this.invalidateCallbacks)try{o(i)}catch(c){cH.LoggingService.error("IncrementalIndexer: Error in invalidation callback",c instanceof Error?c:new Error(String(c)))}}let s=performance.now()-e;this.stats.indexDurations.push(s),this.stats.indexDurations.length>100&&this.stats.indexDurations.shift(),this.lastIndexTime=Date.now(),this.pendingChanges=[]}flush(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.processPendingChanges()}updateMetadata(e,t,r,i){this.fileMetadata.set(e,{mtime:t,size:r,contentHash:i})}hasChanged(e,t,r){let i=this.fileMetadata.get(e);return i===void 0||i.mtime!==t||r!==void 0&&i.size!==r}getChangedFiles(e){let t=[];for(let[r,i]of this.fileMetadata.entries())i.mtime>e&&t.push(r);return t}onInvalidate(e){return this.invalidateCallbacks.push(e),()=>{let t=this.invalidateCallbacks.indexOf(e);t!==-1&&this.invalidateCallbacks.splice(t,1)}}getStats(){let e=this.stats.indexDurations,t=e.length>0?e.reduce((i,s)=>i+s,0)/e.length:0,r=e.length>0?e[e.length-1]:0;return{trackedFiles:this.fileMetadata.size,totalChanges:this.stats.totalChanges,invalidations:this.stats.invalidations,noOpChanges:this.stats.noOpChanges,lastIndexDurationMs:r,avgIndexDurationMs:t,lastIndexTime:this.lastIndexTime}}resetStats(){this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]}}clear(){this.fileMetadata.clear(),this.pendingChanges=[],this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null)}size(){return this.fileMetadata.size}isTracked(e){return this.fileMetadata.has(e)}getMetadata(e){return this.fileMetadata.get(e)}dispose(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.invalidateCallbacks=[],this.pendingChanges=[],this.fileMetadata.clear()}};ad.IncrementalIndexer=Kg;function uH(n){return new Kg(n)}a(uH,"createIncrementalIndexer")});var rP=w(Jg=>{"use strict";Object.defineProperty(Jg,"__esModule",{value:!0});Jg.ResultSerializer=void 0;var Yg=Ge(),Qg=Pe(),Xg=jt(),FE=class{static{a(this,"ResultSerializer")}serialize(e,t,r={}){switch(t){case"json":return this.serializeJSON(e,r);case"xml":return this.serializeXML(e,r);case"csv":return this.serializeCSV(e,r);case"turtle":return this.serializeTurtle(e,r);default:throw new Error(`Unsupported result format: ${t}`)}}serializeJSON(e,t={}){let r=this.toJSONResultSet(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}toJSONResultSet(e,t={}){let r=new Set;for(let o of e)for(let c of o.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=e.map(o=>{let c={};for(let l of i){let u=o.get(l);u!==void 0&&(c[l]=this.termToJSONBinding(u))}return c});return{head:{vars:i},results:{bindings:s}}}termToJSONBinding(e){return e instanceof Qg.IRI?{type:"uri",value:e.value}:e instanceof Xg.BlankNode?{type:"bnode",value:e.id}:e instanceof Yg.Literal?this.literalToJSONBinding(e):{type:"literal",value:String(e)}}literalToJSONBinding(e){let t={type:"literal",value:e.value};return e.datatype?t.datatype=e.datatype.value:e.language&&(t["xml:lang"]=e.language,e.hasDirection()&&e.direction&&(t.direction=e.direction)),t}serializeXML(e,t={}){let r=new Set;for(let o of e)for(let c of o.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=['<?xml version="1.0"?>','<sparql xmlns="http://www.w3.org/2005/sparql-results#">'," <head>"];for(let o of i)s.push(` <variable name="${this.escapeXML(o)}"/>`);s.push(" </head>"),s.push(" <results>");for(let o of e){s.push(" <result>");for(let c of i){let l=o.get(c);l!==void 0&&(s.push(` <binding name="${this.escapeXML(c)}">`),s.push(" "+this.termToXML(l)),s.push(" </binding>"))}s.push(" </result>")}return s.push(" </results>"),s.push("</sparql>"),s.join(`
|
|
257
257
|
`)}termToXML(e){return e instanceof Qg.IRI?`<uri>${this.escapeXML(e.value)}</uri>`:e instanceof Xg.BlankNode?`<bnode>${this.escapeXML(e.id)}</bnode>`:e instanceof Yg.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 o of e)for(let c of o.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=[];s.push(i.map(o=>this.escapeCSV(o)).join(","));for(let o of e){let c=i.map(l=>{let u=o.get(l);return u===void 0?"":this.escapeCSV(this.termToCSV(u))});s.push(c.join(","))}return s.join(`
|
|
258
258
|
`)}termToCSV(e){return e instanceof Qg.IRI?e.value:e instanceof Xg.BlankNode?`_:${e.id}`:e instanceof Yg.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 o of e)for(let c of o.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 o=0;o<e.length;o++){let c=e[o];s.push(`# Solution ${o+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(`
|
|
259
259
|
`).trimEnd()}termToTurtle(e){return e instanceof Qg.IRI?`<${e.value}>`:e instanceof Xg.BlankNode?`_:${e.id}`:e instanceof Yg.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(`
|
|
@@ -319,13 +319,13 @@ To resolve:
|
|
|
319
319
|
`)||(b+=`
|
|
320
320
|
`),{status:"merged",content:`---
|
|
321
321
|
${b}---
|
|
322
|
-
${g.body}`,warnings:y}}splitDoc(e){let t=eY.exec(e);if(!t)return{frontmatter:{},body:e};let r=e.slice(t[0].length);try{let i=this.codec.parse(t[1]);return i==null?{frontmatter:{},body:r}:typeof i!="object"||Array.isArray(i)?null:{frontmatter:i,body:r}}catch{return null}}};vd.StructuredMerger=UT});var oF=w(ky=>{"use strict";Object.defineProperty(ky,"__esModule",{value:!0});ky.MergeShaclGate=void 0;var BT=uT(),aY="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function cY(n,e){let t=new Set;for(let r of n){if(r.subject.type!=="iri"||!("type"in r.predicate)||r.predicate.type!=="iri"||r.object.type!=="iri"||r.predicate.value!==e&&r.predicate.value!==aY)continue;t.add(r.subject.value);let i=(0,BT.extractUidFromIRI)(r.subject.value);i&&t.add(`uid:${i}`)}return t}a(cY,"typedSubjects");var VT=class{static{a(this,"MergeShaclGate")}constructor(e){this.deps=e}async checkMergedAsset(e,t){let r=await this.deps.triplesFor(e,t),i=this.deps.contextTriples??[],s=[...r,...i],o=(0,BT.validate)(s,this.deps.registry,this.deps.hierarchy),c=new Set;for(let h of r)h.subject.type==="iri"&&c.add(h.subject.value);let l=cY(s,this.deps.registry.typePredicateIRI),u=this.deps.isMountedRef??(h=>{if(l.has(h))return!0;let p=(0,BT.extractUidFromIRI)(h);return p!==null&&l.has(`uid:${p}`)}),f=[],d=0;for(let h of o.violations)if(c.has(h.focusNode)){if(h.constraint==="class"){if(h.actualValue!==void 0&&!u(h.actualValue)){d++;continue}f.push(h);continue}h.severity==="sh:Violation"&&f.push(h)}return{ok:f.length===0,violations:f,skippedOpenWorld:d}}};ky.MergeShaclGate=VT});var aF=w(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:!0});My.GatedStructuredMerger=void 0;var qT=class{static{a(this,"GatedStructuredMerger")}constructor(e,t){this.merger=e,this.gate=t}async resolve(e){let t=this.merger.mergeAsset(e);if(t.status==="conflict")return{action:"quarantine",reason:t.reason};if(this.gate!==void 0){let r=await this.gate.checkMergedAsset(e.path,t.content);if(!r.ok)return{action:"quarantine",reason:`merged result is SHACL-invalid: ${r.violations.slice(0,3).map(s=>s.message).join("; ")}`}}return{action:"use-merged",content:t.content,warnings:t.warnings}}};My.GatedStructuredMerger=qT});var cF=w(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.FileWatermarkStore=du.WATERMARK_STORE_FILENAME=void 0;du.WATERMARK_STORE_FILENAME="exosync-watermarks.local.json";function lY(n){if(n===null||typeof n!="object")return!1;let e=n;return typeof e.lastSyncedSha=="string"&&typeof e.rootTreeSha=="string"&&Array.isArray(e.files)}a(lY,"isWatermarkRecord");var GT=class{static{a(this,"FileWatermarkStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let r=(await this.readRepos())[e];return lY(r)?r:null}async set(e,t){let r=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=r.catch(()=>{}),r}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let r=t.repos;return r===null||typeof r!="object"?{}:{...r}}catch{return{}}}};du.FileWatermarkStore=GT});var lF=w(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.FileMountBaseStore=hu.MOUNT_BASE_STORE_FILENAME=void 0;hu.MOUNT_BASE_STORE_FILENAME="exosync-mountbase.local.json";var WT=class{static{a(this,"FileMountBaseStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let r=(await this.readRepos())[e];return typeof r=="string"&&r.length>0?r:null}async set(e,t){let r=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=r.catch(()=>{}),r}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let r=t.repos;if(r===null||typeof r!="object")return{};let i={};for(let[s,o]of Object.entries(r))typeof o=="string"&&(i[s]=o);return i}catch{return{}}}};hu.FileMountBaseStore=WT});var uF=w(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.LocalConflictCacheStore=pu.CONFLICT_CACHE_STORE_FILENAME=void 0;var uY=cl();pu.CONFLICT_CACHE_STORE_FILENAME="exosync-conflicts.local.json";function HT(n,e){return`${n}\0${e}`}a(HT,"cacheKey");function zT(n){if(n===null||typeof n!="object")return!1;let e=n;return typeof e.repoKey=="string"&&typeof e.path=="string"&&typeof e.reason=="string"&&typeof e.quarantinedAt=="string"}a(zT,"isRecord");var KT=class{static{a(this,"LocalConflictCacheStore")}constructor(e){this.writeChain=Promise.resolve(),this.io=e.io,this.now=e.now??(()=>new Date().toISOString())}async quarantine(e){await this.quarantineAll([e])}async quarantineAll(e){e.length!==0&&await this.mutate(t=>{for(let r of e){let i=HT(r.repoKey,r.path),s=t.entries[i],o=s!==void 0&&zT(s)?s.quarantinedAt:this.now();t.entries[i]={version:1,repoKey:r.repoKey,path:r.path,...r.uid!==void 0?{uid:r.uid}:{},reason:r.reason,quarantinedAt:o,...r.baseContent!==void 0?{baseContent:r.baseContent}:{},...r.localContent!==void 0?{localContent:r.localContent}:{},...r.remoteContent!==void 0?{remoteContent:r.remoteContent}:{},...r.localContentBytes!==void 0?{localContentBytesBase64:(0,uY.bytesToBase64)(r.localContentBytes)}:{}}}})}async markResolved(e,t){let r=HT(e,t);await this.mutate(i=>{delete i.entries[r]})}async list(){let e=await this.read();return Object.values(e.entries).filter(zT)}async get(e,t){let i=(await this.read()).entries[HT(e,t)];return i!==void 0&&zT(i)?i:null}async mutate(e){let t=this.writeChain.then(async()=>{let r=await this.read();e(r),await this.io.writeAtomic(JSON.stringify(r,null,2))});return this.writeChain=t.catch(()=>{}),t}async read(){try{let e=await this.io.read();if(e===null)return{version:1,entries:{}};let t=JSON.parse(e);if(t===null||typeof t!="object")return{version:1,entries:{}};let r=t.entries;return r===null||typeof r!="object"?{version:1,entries:{}}:{version:1,entries:{...r}}}catch{return{version:1,entries:{}}}}};pu.LocalConflictCacheStore=KT});var yF=w(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.SpaceSpecAccumulator=tn.SYNC_BRANCH=tn.ASSET_SPACE_CLASS_UID=void 0;tn.isAssetSpaceFrontmatter=hF;tn.isFileSpaceFrontmatter=pF;tn.readSpaceSource=mF;tn.parseStrictGitHubRepoURL=gF;tn.classifySpaceDeclaration=pY;var fY=$g(),dY=jg();tn.ASSET_SPACE_CLASS_UID="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb";tn.SYNC_BRANCH="main";var fF=/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]/gi;function dF(n,e){let t=n.exo__Instance_class,r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;fF.lastIndex=0;let s;for(;(s=fF.exec(i))!==null;)if(s[1].toLowerCase()===e)return!0}return!1}a(dF,"instanceClassHasUid");function hF(n){return dF(n,tn.ASSET_SPACE_CLASS_UID)}a(hF,"isAssetSpaceFrontmatter");function pF(n){return dF(n,fY.FILE_SPACE_CLASS_UID)}a(pF,"isFileSpaceFrontmatter");function mF(n){let e=n.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=n.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(mF,"readSpaceSource");var hY=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/;function gF(n){if(typeof n!="string"||n.length===0||n.length>256||!hY.test(n))return null;let e=n.slice(19),[t,r,...i]=e.split("/");if(i.length>0||t===".."||r===".."||r.startsWith("."))return null;let s=r.replace(/\.git$/,"");return s.length===0?null:{owner:t,repo:s}}a(gF,"parseStrictGitHubRepoURL");function pY(n,e){let t=hF(n),r=pF(n);if(!t&&!r)return{kind:"not-space"};let i;t&&r&&(i=`declaration at ${e} carries BOTH exo__AssetSpace and exo__FileSpace classes (disjoint) \u2014 treating as AssetSpace (conservative)`);let s=t?"asset":"file",o=mF(n);if(o===null)return s==="file"?{kind:"skip",warning:`skipped FileSpace at ${e}: no exo__AssetSpace_source/_git \u2014 mount path underivable`}:{kind:"skip"};let c=o.replace(/\.git$/i,""),l=gF(c);if(l===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: source is not a plain https://github.com/<owner>/<repo> URL`};let u=(0,dY.derivePath)(c);if(u===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: cannot derive mount path from source`};let f=`${l.owner}/${l.repo}#${tn.SYNC_BRANCH}`,d=n.exo__Asset_uid,h=typeof d=="string"&&d.trim().length>0?d.trim():void 0;return{kind:"candidate",candidate:{spec:{owner:l.owner,repo:l.repo,branch:tn.SYNC_BRANCH,repoKey:f,localPath:u,...s==="file"?{spaceKind:s}:{}},spaceKind:s,...h!==void 0?{asUid:h}:{}},...i!==void 0?{warning:i}:{}}}a(pY,"classifySpaceDeclaration");var YT=class{static{a(this,"SpaceSpecAccumulator")}constructor(){this.specs=[],this.warnings=[],this.asUidByRepoKey=new Map,this.seen=new Set,this.kindByRepoKey=new Map}offer(e){let{spec:t,spaceKind:r}=e;if(this.seen.has(t.repoKey)){let i=this.kindByRepoKey.get(t.repoKey);if(i!==void 0&&i!==r&&(this.warnings.push(`repo ${t.repoKey} is declared as BOTH AssetSpace and FileSpace by different assets \u2014 treating as AssetSpace (deterministic, conservative); fix the vault (disjoint subtypes)`),i==="file")){this.kindByRepoKey.set(t.repoKey,"asset");let s=this.specs.find(o=>o.repoKey===t.repoKey);s!==void 0&&delete s.spaceKind}return null}return this.seen.add(t.repoKey),this.kindByRepoKey.set(t.repoKey,r),t}commit(e){this.specs.push(e.spec),e.asUid!==void 0&&this.asUidByRepoKey.set(e.spec.repoKey,e.asUid)}};tn.SpaceSpecAccumulator=YT});var QT=w($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.isFormatOnlyDrift=mY;$y.compareAssetSemantics=yY;function mY(n){return n.frontmatterEqual&&n.bodyEqual}a(mY,"isFormatOnlyDrift");var gY=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/;function bF(n){let e=gY.exec(n);return e?{fm:e[1],body:n.slice(e[0].length)}:{fm:null,body:n}}a(bF,"splitDoc");function jy(n){if(Array.isArray(n))return`[${n.map(jy).sort().join(",")}]`;if(n!==null&&typeof n=="object"){let e=n;return`{${Object.keys(e).sort().map(r=>`${JSON.stringify(r)}:${jy(e[r])}`).join(",")}}`}return JSON.stringify(n)??"undefined"}a(jy,"canonicalise");function _F(n){return n.replace(/\r\n/g,`
|
|
322
|
+
${g.body}`,warnings:y}}splitDoc(e){let t=eY.exec(e);if(!t)return{frontmatter:{},body:e};let r=e.slice(t[0].length);try{let i=this.codec.parse(t[1]);return i==null?{frontmatter:{},body:r}:typeof i!="object"||Array.isArray(i)?null:{frontmatter:i,body:r}}catch{return null}}};vd.StructuredMerger=UT});var oF=w(ky=>{"use strict";Object.defineProperty(ky,"__esModule",{value:!0});ky.MergeShaclGate=void 0;var BT=uT(),aY="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function cY(n,e){let t=new Set;for(let r of n){if(r.subject.type!=="iri"||!("type"in r.predicate)||r.predicate.type!=="iri"||r.object.type!=="iri"||r.predicate.value!==e&&r.predicate.value!==aY)continue;t.add(r.subject.value);let i=(0,BT.extractUidFromIRI)(r.subject.value);i&&t.add(`uid:${i}`)}return t}a(cY,"typedSubjects");var VT=class{static{a(this,"MergeShaclGate")}constructor(e){this.deps=e}async checkMergedAsset(e,t){let r=await this.deps.triplesFor(e,t),i=this.deps.contextTriples??[],s=[...r,...i],o=(0,BT.validate)(s,this.deps.registry,this.deps.hierarchy),c=new Set;for(let h of r)h.subject.type==="iri"&&c.add(h.subject.value);let l=cY(s,this.deps.registry.typePredicateIRI),u=this.deps.isMountedRef??(h=>{if(l.has(h))return!0;let p=(0,BT.extractUidFromIRI)(h);return p!==null&&l.has(`uid:${p}`)}),f=[],d=0;for(let h of o.violations)if(c.has(h.focusNode)){if(h.constraint==="class"){if(h.actualValue!==void 0&&!u(h.actualValue)){d++;continue}f.push(h);continue}h.severity==="sh:Violation"&&f.push(h)}return{ok:f.length===0,violations:f,skippedOpenWorld:d}}};ky.MergeShaclGate=VT});var aF=w(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:!0});My.GatedStructuredMerger=void 0;var qT=class{static{a(this,"GatedStructuredMerger")}constructor(e,t){this.merger=e,this.gate=t}async resolve(e){let t=this.merger.mergeAsset(e);if(t.status==="conflict")return{action:"quarantine",reason:t.reason};if(this.gate!==void 0){let r=await this.gate.checkMergedAsset(e.path,t.content);if(!r.ok)return{action:"quarantine",reason:`merged result is SHACL-invalid: ${r.violations.slice(0,3).map(s=>s.message).join("; ")}`}}return{action:"use-merged",content:t.content,warnings:t.warnings}}};My.GatedStructuredMerger=qT});var cF=w(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.FileWatermarkStore=du.WATERMARK_STORE_FILENAME=void 0;du.WATERMARK_STORE_FILENAME="exosync-watermarks.local.json";function lY(n){if(n===null||typeof n!="object")return!1;let e=n;return typeof e.lastSyncedSha=="string"&&typeof e.rootTreeSha=="string"&&Array.isArray(e.files)}a(lY,"isWatermarkRecord");var GT=class{static{a(this,"FileWatermarkStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let r=(await this.readRepos())[e];return lY(r)?r:null}async set(e,t){let r=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=r.catch(()=>{}),r}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let r=t.repos;return r===null||typeof r!="object"?{}:{...r}}catch{return{}}}};du.FileWatermarkStore=GT});var lF=w(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.FileMountBaseStore=hu.MOUNT_BASE_STORE_FILENAME=void 0;hu.MOUNT_BASE_STORE_FILENAME="exosync-mountbase.local.json";var WT=class{static{a(this,"FileMountBaseStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let r=(await this.readRepos())[e];return typeof r=="string"&&r.length>0?r:null}async set(e,t){let r=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=r.catch(()=>{}),r}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let r=t.repos;if(r===null||typeof r!="object")return{};let i={};for(let[s,o]of Object.entries(r))typeof o=="string"&&(i[s]=o);return i}catch{return{}}}};hu.FileMountBaseStore=WT});var uF=w(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.LocalConflictCacheStore=pu.CONFLICT_CACHE_STORE_FILENAME=void 0;var uY=cl();pu.CONFLICT_CACHE_STORE_FILENAME="exosync-conflicts.local.json";function HT(n,e){return`${n}\0${e}`}a(HT,"cacheKey");function zT(n){if(n===null||typeof n!="object")return!1;let e=n;return typeof e.repoKey=="string"&&typeof e.path=="string"&&typeof e.reason=="string"&&typeof e.quarantinedAt=="string"}a(zT,"isRecord");var KT=class{static{a(this,"LocalConflictCacheStore")}constructor(e){this.writeChain=Promise.resolve(),this.io=e.io,this.now=e.now??(()=>new Date().toISOString())}async quarantine(e){await this.quarantineAll([e])}async quarantineAll(e){e.length!==0&&await this.mutate(t=>{for(let r of e){let i=HT(r.repoKey,r.path),s=t.entries[i],o=s!==void 0&&zT(s)?s.quarantinedAt:this.now();t.entries[i]={version:1,repoKey:r.repoKey,path:r.path,...r.uid!==void 0?{uid:r.uid}:{},reason:r.reason,quarantinedAt:o,...r.baseContent!==void 0?{baseContent:r.baseContent}:{},...r.localContent!==void 0?{localContent:r.localContent}:{},...r.remoteContent!==void 0?{remoteContent:r.remoteContent}:{},...r.localContentBytes!==void 0?{localContentBytesBase64:(0,uY.bytesToBase64)(r.localContentBytes)}:{}}}})}async markResolved(e,t){let r=HT(e,t);await this.mutate(i=>{delete i.entries[r]})}async list(){let e=await this.read();return Object.values(e.entries).filter(zT)}async get(e,t){let i=(await this.read()).entries[HT(e,t)];return i!==void 0&&zT(i)?i:null}async mutate(e){let t=this.writeChain.then(async()=>{let r=await this.read();e(r),await this.io.writeAtomic(JSON.stringify(r,null,2))});return this.writeChain=t.catch(()=>{}),t}async read(){try{let e=await this.io.read();if(e===null)return{version:1,entries:{}};let t=JSON.parse(e);if(t===null||typeof t!="object")return{version:1,entries:{}};let r=t.entries;return r===null||typeof r!="object"?{version:1,entries:{}}:{version:1,entries:{...r}}}catch{return{version:1,entries:{}}}}};pu.LocalConflictCacheStore=KT});var yF=w(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.SpaceSpecAccumulator=rn.SYNC_BRANCH=rn.ASSET_SPACE_CLASS_UID=void 0;rn.isAssetSpaceFrontmatter=hF;rn.isFileSpaceFrontmatter=pF;rn.readSpaceSource=mF;rn.parseStrictGitHubRepoURL=gF;rn.classifySpaceDeclaration=pY;var fY=$g(),dY=jg();rn.ASSET_SPACE_CLASS_UID="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb";rn.SYNC_BRANCH="main";var fF=/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]/gi;function dF(n,e){let t=n.exo__Instance_class,r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;fF.lastIndex=0;let s;for(;(s=fF.exec(i))!==null;)if(s[1].toLowerCase()===e)return!0}return!1}a(dF,"instanceClassHasUid");function hF(n){return dF(n,rn.ASSET_SPACE_CLASS_UID)}a(hF,"isAssetSpaceFrontmatter");function pF(n){return dF(n,fY.FILE_SPACE_CLASS_UID)}a(pF,"isFileSpaceFrontmatter");function mF(n){let e=n.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=n.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(mF,"readSpaceSource");var hY=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/;function gF(n){if(typeof n!="string"||n.length===0||n.length>256||!hY.test(n))return null;let e=n.slice(19),[t,r,...i]=e.split("/");if(i.length>0||t===".."||r===".."||r.startsWith("."))return null;let s=r.replace(/\.git$/,"");return s.length===0?null:{owner:t,repo:s}}a(gF,"parseStrictGitHubRepoURL");function pY(n,e){let t=hF(n),r=pF(n);if(!t&&!r)return{kind:"not-space"};let i;t&&r&&(i=`declaration at ${e} carries BOTH exo__AssetSpace and exo__FileSpace classes (disjoint) \u2014 treating as AssetSpace (conservative)`);let s=t?"asset":"file",o=mF(n);if(o===null)return s==="file"?{kind:"skip",warning:`skipped FileSpace at ${e}: no exo__AssetSpace_source/_git \u2014 mount path underivable`}:{kind:"skip"};let c=o.replace(/\.git$/i,""),l=gF(c);if(l===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: source is not a plain https://github.com/<owner>/<repo> URL`};let u=(0,dY.derivePath)(c);if(u===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: cannot derive mount path from source`};let f=`${l.owner}/${l.repo}#${rn.SYNC_BRANCH}`,d=n.exo__Asset_uid,h=typeof d=="string"&&d.trim().length>0?d.trim():void 0;return{kind:"candidate",candidate:{spec:{owner:l.owner,repo:l.repo,branch:rn.SYNC_BRANCH,repoKey:f,localPath:u,...s==="file"?{spaceKind:s}:{}},spaceKind:s,...h!==void 0?{asUid:h}:{}},...i!==void 0?{warning:i}:{}}}a(pY,"classifySpaceDeclaration");var YT=class{static{a(this,"SpaceSpecAccumulator")}constructor(){this.specs=[],this.warnings=[],this.asUidByRepoKey=new Map,this.seen=new Set,this.kindByRepoKey=new Map}offer(e){let{spec:t,spaceKind:r}=e;if(this.seen.has(t.repoKey)){let i=this.kindByRepoKey.get(t.repoKey);if(i!==void 0&&i!==r&&(this.warnings.push(`repo ${t.repoKey} is declared as BOTH AssetSpace and FileSpace by different assets \u2014 treating as AssetSpace (deterministic, conservative); fix the vault (disjoint subtypes)`),i==="file")){this.kindByRepoKey.set(t.repoKey,"asset");let s=this.specs.find(o=>o.repoKey===t.repoKey);s!==void 0&&delete s.spaceKind}return null}return this.seen.add(t.repoKey),this.kindByRepoKey.set(t.repoKey,r),t}commit(e){this.specs.push(e.spec),e.asUid!==void 0&&this.asUidByRepoKey.set(e.spec.repoKey,e.asUid)}};rn.SpaceSpecAccumulator=YT});var QT=w($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.isFormatOnlyDrift=mY;$y.compareAssetSemantics=yY;function mY(n){return n.frontmatterEqual&&n.bodyEqual}a(mY,"isFormatOnlyDrift");var gY=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/;function bF(n){let e=gY.exec(n);return e?{fm:e[1],body:n.slice(e[0].length)}:{fm:null,body:n}}a(bF,"splitDoc");function jy(n){if(Array.isArray(n))return`[${n.map(jy).sort().join(",")}]`;if(n!==null&&typeof n=="object"){let e=n;return`{${Object.keys(e).sort().map(r=>`${JSON.stringify(r)}:${jy(e[r])}`).join(",")}}`}return JSON.stringify(n)??"undefined"}a(jy,"canonicalise");function _F(n){return n.replace(/\r\n/g,`
|
|
323
323
|
`).replace(/\s+$/,"")}a(_F,"normaliseBody");function yY(n,e,t){let r=bF(n),i=bF(e),s;if(r.fm===null&&i.fm===null)s=!0;else if(r.fm===null||i.fm===null)s=!1;else try{s=jy(t.parse(r.fm))===jy(t.parse(i.fm))}catch{s=!1}return{frontmatterEqual:s,bodyEqual:_F(r.body)===_F(i.body)}}a(yY,"compareAssetSemantics")});var EF=w(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.ParityValidator=void 0;Td.summarizeParityRound=TY;var Ed=md(),SF=uu(),bY=Ry(),_Y=Py(),mu=Fy(),wF=QT(),SY=50,wY=200,vF=new Set(["pending-local-edit","pending-remote-add","pending-remote-edit","pending-remote-delete","deferred-local-delete","pending-conflict","unverified-divergence"]),vY=new Set(["quarantine-pinned","format-only-drift"]);function Sa(n){return n instanceof Error?n.message:String(n)}a(Sa,"errMsg");function EY(n){return/HTTP 404/.test(Sa(n))}a(EY,"isNotFoundError");var XT=class{static{a(this,"ParityValidator")}constructor(e){this.deps=e,this.transport=(0,_Y.withRateLimitBackoff)(e.transport,e.backoff)}async captureSnapshot(e){let t=new Map,r=[],i=this.deps.redact??(s=>s);for(let s of e)try{let o=await this.deps.watermarks.get(s.repoKey);if(o===null)continue;let c=new Map(o.files.map(f=>[f.path,f.blobSha])),l=await this.readLocalSnapshot(s,s.spaceKind==="file"),u=new Map;for(let[f,d]of l.shas)c.get(f)!==d&&u.set(f,d);u.size>0&&t.set(s.repoKey,u)}catch(o){r.push(`${s.repoKey}: conservation snapshot failed (${i(Sa(o))}) \u2014 no coverage this round`)}return{dirtyByRepo:t,warnings:r}}async runRound(e,t){let r=this.deps.now??(()=>new Date().toISOString()),i=this.deps.maxSemanticFetchesPerRun??wY,s=[];for(let u of e){let f=await this.checkRepo(u,t,{take:a(d=>i<d?!1:(i-=d,!0),"take")});s.push(f)}t.previousRound!=null&&t.trigger==="post-sync"&&this.escalatePersistentDivergence(s,t.previousRound,t.syncResults);let o=s.filter(u=>u.status==="checked").length,c=s.reduce((u,f)=>u+f.m1Violations.length,0),l=s.reduce((u,f)=>u+(f.status==="checked"?f.m2SemanticDiffs:0),0);return{version:1,ts:r(),trigger:t.trigger,repos:s,checkedRepos:o,m1Total:c,m2Total:l,ok:c===0&&l===0&&o>0,vacuous:o===0}}async checkRepo(e,t,r){let i=[],s=this.deps.redact??(l=>l),o=a((l,u={})=>({repoKey:e.repoKey,status:l,filesChecked:0,inParity:0,discrepancies:[],m2SemanticDiffs:0,accountedCount:0,m1Violations:[],warnings:i,...u}),"report"),c=t.syncResults?.find(l=>l.repoKey===e.repoKey);if(c?.warnings.some(l=>l.startsWith("race-window")))return o("inconclusive",{detail:"sync hit its race window (watermark not advanced) \u2014 parity deferred to the next round"});if(c?.status==="skipped-not-materialized")return o("inconclusive",{detail:"repo not fully materialized (D19) \u2014 local absence is not divergence; parity deferred to the next round"});try{let l=e.spaceKind==="file",u=await(0,Ed.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=await(0,Ed.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL),d=await(0,Ed.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL),h=this.deps.maxFileBytes??mu.DEFAULT_MAX_FILE_BYTES,p=l?mu.isFileSpaceSyncablePath:mu.isSyncablePath,g=new Map;for(let O of d)if(p(O.path)){if(O.size!==void 0&&O.size>h){i.push(`remote ${O.path} exceeds the ${h}-byte cap \u2014 excluded symmetrically`);continue}g.set(O.path,O)}let y=await this.readLocalSnapshot(e,l);i.push(...y.warnings);let b=await this.deps.watermarks.get(e.repoKey);if(b===null){let O=0;for(let[re,Y]of y.shas)g.get(re)?.blobSha===Y&&O++;let J=new Set([...y.shas.keys(),...g.keys()]);return o("no-watermark",{filesChecked:J.size,inParity:O,headSha:u,detail:`repo has no sync watermark on this device (${J.size-O} raw diff(s)) \u2014 run a sync first; not counted toward M1/M2`})}let S=new Map(b.files.map(O=>[O.path,O.blobSha])),v=new Set(b.pinnedPaths??[]),{discrepancies:I,inParity:A,filesChecked:T}=await this.classifyAll(e,y,g,S,v,l,{warnings:i,runBudget:r}),R=await(0,Ed.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL);if(R!==u)return o("inconclusive",{headSha:u,detail:`remote head moved during the check (${u.slice(0,7)} \u2192 ${R.slice(0,7)}) \u2014 parity deferred to the next round`});let V=this.checkConservation(e,t,y,g,v,c),L=I.filter(O=>!vY.has(O.cls)).length,P=I.length-L,k;if(l){let O=[...y.shas.values()].sort().join(`
|
|
324
324
|
`),J=[...g.values()].map(re=>re.blobSha).sort().join(`
|
|
325
325
|
`);k=O===J}return o("checked",{filesChecked:T,inParity:A,discrepancies:I,m2SemanticDiffs:L,accountedCount:P,m1Violations:V,headSha:u,...k!==void 0?{attachmentHashSetIdentical:k}:{}})}catch(l){return(0,bY.isAuthError)(l)?o("auth-required",{detail:s(`authentication failed: ${Sa(l)} \u2014 the PAT is expired, revoked or under-scoped; update it (R8)`)}):EY(l)?(i.push("repo unreachable (HTTP 404): dead AssetSpace pointer, or the fine-grained PAT does not allowlist this repo \u2014 skipped"),o("error",{detail:s(Sa(l))})):(i.push(`parity check failed: ${s(Sa(l))}`),o("error",{detail:s(Sa(l))}))}}async readLocalSnapshot(e,t){let r=this.deps.localFilesFor(e),i=t?mu.isFileSpaceSyncablePath:mu.isSyncablePath,s=this.deps.maxFileBytes??mu.DEFAULT_MAX_FILE_BYTES,o=new Map,c=new Map,l=[];if(t&&r.readBinary===void 0)throw new Error("file-mode repo requires a LocalFilesPort with readBinary \u2014 refusing to hash through the text-only port (binary would corrupt)");let u=new TextEncoder;for(let f of await r.list())if(i(f))try{if(t){let d=await r.readBinary(f);if(d.byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}o.set(f,await(0,SF.gitBlobSha)(d,this.deps.sha1))}else{let d=await r.read(f);if(u.encode(d).byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}c.set(f,d),o.set(f,await(0,SF.gitBlobSha)(d,this.deps.sha1))}}catch(d){let h=this.deps.redact??(p=>p);l.push(`local ${f} unreadable (${h(Sa(d))}) \u2014 skipped`)}return{shas:o,texts:c,warnings:l}}async classifyAll(e,t,r,i,s,o,c){let l=[],u=0,f=this.deps.maxSemanticFetchesPerRepo??SY,d=new Set([...t.shas.keys(),...r.keys()]);for(let h of[...d].sort()){let p=t.shas.get(h),y=r.get(h)?.blobSha,b=i.get(h);if(p!==void 0&&y!==void 0){if(p===y){u++;continue}l.push(await this.classifyContentDiff(e,h,p,y,b,s,o,t,{...c,takeRepoFetch:a(()=>f-- >0,"takeRepoFetch")}));continue}if(p!==void 0){let S;s.has(h)?S={path:h,presence:"local-only",cls:"quarantine-pinned",localSha:p}:b===void 0?S={path:h,presence:"local-only",cls:"pending-local-add",localSha:p}:b===p?S={path:h,presence:"local-only",cls:"pending-remote-delete",localSha:p,detail:"remote deleted it; the local copy is unchanged"}:S={path:h,presence:"local-only",cls:"pending-conflict",localSha:p,detail:"remote deleted it AND the local copy was edited"},l.push(S);continue}if(y!==void 0){let S;s.has(h)?S={path:h,presence:"remote-only",cls:"quarantine-pinned",remoteSha:y}:b===void 0?S={path:h,presence:"remote-only",cls:"pending-remote-add",remoteSha:y}:b===y?S={path:h,presence:"remote-only",cls:"deferred-local-delete",remoteSha:y,detail:"locally deleted; the delete propagates on the next sync (#3476) \u2014 escalates if it survives a converged round"}:S={path:h,presence:"remote-only",cls:"pending-conflict",remoteSha:y,detail:"locally deleted AND the remote copy was edited"},l.push(S)}}return{discrepancies:l,inParity:u,filesChecked:d.size}}async classifyContentDiff(e,t,r,i,s,o,c,l,u){let f={localSha:r,remoteSha:i};if(o.has(t))return{path:t,presence:"both",cls:"quarantine-pinned",...f};if(s!==void 0&&s===r)return{path:t,presence:"both",cls:"pending-remote-edit",...f};if(s!==void 0&&s===i)return{path:t,presence:"both",cls:"pending-local-edit",...f};if(c)return{path:t,presence:"both",cls:"pending-conflict",...f,detail:"binary content differs on both sides"};if(!u.takeRepoFetch()||!u.runBudget.take(1))return u.warnings.push(`semantic-fetch cap reached \u2014 ${t} left unverified (counted into M2)`),{path:t,presence:"both",cls:"unverified-divergence",...f};let d=l.texts.get(t),h;try{h=await(0,Ed.getBlobText)(this.transport,e.owner,e.repo,i,this.deps.baseURL)}catch(g){let y=this.deps.redact??(b=>b);return u.warnings.push(`blob fetch for ${t} failed (${y(Sa(g))}) \u2014 left unverified`),{path:t,presence:"both",cls:"unverified-divergence",...f}}let p=(0,wF.compareAssetSemantics)(d??"",h,this.deps.yaml);return(0,wF.isFormatOnlyDrift)(p)?{path:t,presence:"both",cls:"format-only-drift",...f,frontmatterEqual:!0,bodyEqual:!0}:{path:t,presence:"both",cls:"pending-conflict",...f,frontmatterEqual:p.frontmatterEqual,bodyEqual:p.bodyEqual,detail:`semantic divergence (frontmatter ${p.frontmatterEqual?"equal":"differs"}, body ${p.bodyEqual?"equal":"differs"})`}}checkConservation(e,t,r,i,s,o){let c=t.snapshot?.dirtyByRepo.get(e.repoKey);if(c===void 0||c.size===0)return[];let l=new Set(o?.mergedPaths??[]),u=new Set(o?.quarantinedPaths??[]),f=[];for(let[d,h]of c)r.shas.get(d)!==h&&i.get(d)?.blobSha!==h&&(l.has(d)||u.has(d)||s.has(d)||f.push({repoKey:e.repoKey,path:d,kind:"conservation",detail:`pre-sync dirty content ${h.slice(0,7)} survived NOWHERE: disk now ${r.shas.get(d)?.slice(0,7)??"absent"}, not in head tree, not merged/quarantined/pinned \u2014 possible lost edit`}));return f}escalatePersistentDivergence(e,t,r){for(let i of e){if(i.status!=="checked")continue;let s=r?.find(u=>u.repoKey===i.repoKey);if(s!==void 0&&s.status!=="synced")continue;let o=new Set(s?.deferredDeletes??[]),c=t.repos.find(u=>u.repoKey===i.repoKey&&u.status==="checked");if(c===void 0)continue;let l=new Map(c.discrepancies.filter(u=>vF.has(u.cls)).map(u=>[u.path,u]));for(let u of i.discrepancies){if(!vF.has(u.cls)||u.cls==="deferred-local-delete"&&o.has(u.path))continue;let f=l.get(u.path);f!==void 0&&f.localSha===u.localSha&&f.remoteSha===u.remoteSha&&i.m1Violations.push({repoKey:i.repoKey,path:u.path,kind:"persistent-divergence",detail:`identical divergence (local ${u.localSha?.slice(0,7)??"absent"}, remote ${u.remoteSha?.slice(0,7)??"absent"}) survived a sync round unchanged (${f.cls} \u2192 ${u.cls}) \u2014 the engine failed to converge it`})}}}};Td.ParityValidator=XT;function TY(n){if(n.vacuous)return`ExoSync parity: VACUOUS \u2014 0 of ${n.repos.length} repo(s) checked (errors / never synced)`;let e=n.repos.length-n.checkedRepos,t=e>0?`, ${e} skipped`:"";return n.ok?`ExoSync parity: M1=0, M2=\u2205 (${n.checkedRepos} repo(s) checked${t})`:`ExoSync parity: M1=${n.m1Total}, M2=${n.m2Total} diff(s) (${n.checkedRepos} repo(s) checked${t}) \u2014 see log`}a(TY,"summarizeParityRound")});var AF=w(TF=>{"use strict";Object.defineProperty(TF,"__esModule",{value:!0})});var Ad=w(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.UID_UNIQUENESS_WHITELIST_CLASS_UIDS=Or.KNOWN_CHECK_IDS=Or.CHECK_ID_DAG_ONTOLOGY_IMPORTS=Or.CHECK_ID_UID_UNIQUENESS=Or.CHECK_ID_CO_LOCATION=Or.CHECK_ID_SHACL=void 0;Or.CHECK_ID_SHACL="f83ffedd-1f05-4ab5-839d-58873c69c4ba";Or.CHECK_ID_CO_LOCATION="61f95c82-f6fc-4b20-b06d-19f3dc1b1f12";Or.CHECK_ID_UID_UNIQUENESS="ac10db25-231c-4677-8cac-647d3cf15c64";Or.CHECK_ID_DAG_ONTOLOGY_IMPORTS="a57f4a6b-a462-4c8d-b958-0dbee4674727";Or.KNOWN_CHECK_IDS=new Set([Or.CHECK_ID_SHACL,Or.CHECK_ID_CO_LOCATION,Or.CHECK_ID_UID_UNIQUENESS,Or.CHECK_ID_DAG_ONTOLOGY_IMPORTS]);Or.UID_UNIQUENESS_WHITELIST_CLASS_UIDS=new Set(["b04e7a3e-6b49-4984-9f8d-b74e9f36818b","2b754a16-cccf-49ee-af69-a18c6d1e3b63"])});var Uy=w(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.readUid=AY;Id.readIsDefinedByRef=IY;Id.readInstanceClassRefs=xY;var IF=td();function AY(n){let e=n.exo__Asset_uid;if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}a(AY,"readUid");function IY(n){return(0,IF.extractAssetReference)(n.exo__Asset_isDefinedBy)}a(IY,"readIsDefinedByRef");function xY(n){let e=n.exo__Instance_class,t=Array.isArray(e)?e:e==null?[]:[e],r=[];for(let i of t){let s=(0,IF.extractAssetReference)(i);s&&r.push(s)}return r}a(xY,"readInstanceClassRefs")});var ZT=w(JT=>{"use strict";Object.defineProperty(JT,"__esModule",{value:!0});JT.uidUniquenessCheck=CY;var xF=Uy(),RY=Ad();function CY(n){let e=new Map;for(let r of n.assets){let i=(0,xF.readUid)(r.frontmatter);if(!i||(0,xF.readInstanceClassRefs)(r.frontmatter).some(c=>RY.UID_UNIQUENESS_WHITELIST_CLASS_UIDS.has(c)))continue;let o=e.get(i);o?o.push(r.path):e.set(i,[r.path])}let t=[];for(let[r,i]of e){if(i.length<2)continue;let s=[...i].sort();for(let o of s)t.push({path:o,message:`duplicate exo__Asset_uid "${r}" \u2014 also at ${s.filter(c=>c!==o).join(", ")}`})}return t}a(CY,"uidUniquenessCheck")});var t2=w(e2=>{"use strict";Object.defineProperty(e2,"__esModule",{value:!0});e2.coLocationCheck=DY;var RF=Uy(),OY=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function CF(n){let e=n.lastIndexOf("/");return e<0?"":n.slice(0,e)}a(CF,"dirOf");function PY(n){let e=n.slice(n.lastIndexOf("/")+1);return e.endsWith(".md")?e.slice(0,-3):e}a(PY,"baseNameNoExt");function FY(n){return n.split("/").some(e=>e.toLowerCase()==="templates")}a(FY,"isTemplatesPath");function DY(n){let e=new Map,t=new Map;for(let s of n.assets){let o=(0,RF.readUid)(s.frontmatter);o&&!e.has(o)&&e.set(o,s.path);let c=PY(s.path);t.has(c)||t.set(c,s.path)}let r=a(s=>OY.test(s)?e.get(s)??t.get(s):t.get(s)??e.get(s),"resolve"),i=[];for(let s of n.assets){if(s.path.split("/").includes("node_modules")||FY(s.path))continue;let o=(0,RF.readIsDefinedByRef)(s.frontmatter);if(!o||o.startsWith("!"))continue;let c=r(o);if(!c)continue;let l=CF(c),u=CF(s.path);l!==u&&i.push({path:s.path,message:`co-location: isDefinedBy=${o} expects folder "${l}/" but asset is in "${u}/"`})}return i}a(DY,"coLocationCheck")});var n2=w(r2=>{"use strict";Object.defineProperty(r2,"__esModule",{value:!0});r2.shaclCheck=LY;async function LY(n){if(!n.runShacl)throw new Error("SHACL check is enabled but this context provides no triple-store (runShacl). Wire a warm getTripleStore()/runShapesValidation reader, or disable the check.");return(await n.runShacl()).map(t=>({path:t.focusNode??t.path,message:`SHACL: ${t.message}${t.path?` (path ${t.path})`:""}`}))}a(LY,"shaclCheck")});var s2=w(i2=>{"use strict";Object.defineProperty(i2,"__esModule",{value:!0});i2.dagOntologyImportsCheck=NY;async function NY(n){if(!n.runDag)throw new Error("DAG ontology-imports check is enabled but this context provides no graph derivation (runDag). Wire a reader that supplies it, or disable the check.");return[...await n.runDag()]}a(NY,"dagOntologyImportsCheck")});var o2=w(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.CheckRegistry=void 0;xd.createDefaultCheckRegistry=UY;var By=Ad(),kY=ZT(),MY=t2(),jY=n2(),$Y=s2(),Vy=class{static{a(this,"CheckRegistry")}constructor(){this.entries=new Map}register(e){return this.entries.set(e.id,e),this}get(e){return this.entries.get(e)}has(e){return this.entries.has(e)}ids(){return[...this.entries.keys()]}};xd.CheckRegistry=Vy;function UY(){return new Vy().register({id:By.CHECK_ID_UID_UNIQUENESS,label:"uid-uniqueness",run:kY.uidUniquenessCheck}).register({id:By.CHECK_ID_CO_LOCATION,label:"co-location",run:MY.coLocationCheck}).register({id:By.CHECK_ID_SHACL,label:"shacl",run:jY.shaclCheck}).register({id:By.CHECK_ID_DAG_ONTOLOGY_IMPORTS,label:"dag-ontology-imports",run:$Y.dagOntologyImportsCheck})}a(UY,"createDefaultCheckRegistry")});var OF=w(qy=>{"use strict";Object.defineProperty(qy,"__esModule",{value:!0});qy.VaultCheckRunner=void 0;var BY=o2(),a2=class{static{a(this,"VaultCheckRunner")}constructor(e=new BY.CheckRegistry){this.registry=e}async run(e,t){let r=await e.read();return this.runWithContext(r,t)}async runWithContext(e,t){let r=[];for(let i of t){let s=this.registry.get(i);if(!s){r.push({checkId:i,label:i,status:"error",findings:[],errorMessage:`fail-loud: enabled check-id "${i}" has no registered runner`});continue}try{let o=await s.run(e);r.push({checkId:i,label:s.label,status:o.length>0?"fail":"pass",findings:o})}catch(o){r.push({checkId:i,label:s.label,status:"error",findings:[],errorMessage:`fail-loud: check "${s.label}" threw \u2014 ${o instanceof Error?o.message:String(o)}`})}}return{totalAssets:e.assets.length,results:r,ok:r.every(i=>i.status==="pass")}}};qy.VaultCheckRunner=a2});var PF=w(c2=>{"use strict";Object.defineProperty(c2,"__esModule",{value:!0});c2.readEnabledCheckIds=GY;var VY=Ad(),qY=td();function GY(n){let e=new Set;for(let t of n){let r=(0,qY.extractAssetReference)(t.frontmatter.setting__Setting_key);if(!r||!VY.KNOWN_CHECK_IDS.has(r))continue;let i=t.frontmatter.setting__Setting_value;(i===!0||i==="true")&&e.add(r)}return[...e]}a(GY,"readEnabledCheckIds")});var LF=w(yt=>{"use strict";var WY=yt&&yt.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),FF=yt&&yt.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&WY(e,n,t)};Object.defineProperty(yt,"__esModule",{value:!0});yt.readInstanceClassRefs=yt.readIsDefinedByRef=yt.readUid=yt.dagOntologyImportsCheck=yt.shaclCheck=yt.coLocationCheck=yt.uidUniquenessCheck=yt.readEnabledCheckIds=yt.VaultCheckRunner=yt.createDefaultCheckRegistry=yt.CheckRegistry=void 0;FF(AF(),yt);FF(Ad(),yt);var DF=o2();Object.defineProperty(yt,"CheckRegistry",{enumerable:!0,get:a(function(){return DF.CheckRegistry},"get")});Object.defineProperty(yt,"createDefaultCheckRegistry",{enumerable:!0,get:a(function(){return DF.createDefaultCheckRegistry},"get")});var HY=OF();Object.defineProperty(yt,"VaultCheckRunner",{enumerable:!0,get:a(function(){return HY.VaultCheckRunner},"get")});var zY=PF();Object.defineProperty(yt,"readEnabledCheckIds",{enumerable:!0,get:a(function(){return zY.readEnabledCheckIds},"get")});var KY=ZT();Object.defineProperty(yt,"uidUniquenessCheck",{enumerable:!0,get:a(function(){return KY.uidUniquenessCheck},"get")});var YY=t2();Object.defineProperty(yt,"coLocationCheck",{enumerable:!0,get:a(function(){return YY.coLocationCheck},"get")});var QY=n2();Object.defineProperty(yt,"shaclCheck",{enumerable:!0,get:a(function(){return QY.shaclCheck},"get")});var XY=s2();Object.defineProperty(yt,"dagOntologyImportsCheck",{enumerable:!0,get:a(function(){return XY.dagOntologyImportsCheck},"get")});var l2=Uy();Object.defineProperty(yt,"readUid",{enumerable:!0,get:a(function(){return l2.readUid},"get")});Object.defineProperty(yt,"readIsDefinedByRef",{enumerable:!0,get:a(function(){return l2.readIsDefinedByRef},"get")});Object.defineProperty(yt,"readInstanceClassRefs",{enumerable:!0,get:a(function(){return l2.readInstanceClassRefs},"get")})});var et=w(m=>{"use strict";var JY=m&&m.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),ni=m&&m.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&JY(e,n,t)};Object.defineProperty(m,"__esModule",{value:!0});m.createVaultFrontmatterClassLabelResolver=m.ServiceRegistry=m.GroundingExecutor=m.registerDefaultHostFunctions=m.hasUidFilename=m.hasNonUidFilename=m.PreconditionEvaluator=m.CommandResolver=m.extractPropertyLabel=m.uriToPropertyName=m.propertyNameToUri=m.rangeToFieldType=m.PropertyFieldType=m.transitiveDependsOnClosure=m.isTsFloorMountPath=m.isTsFloorAssetSpace=m.assertTsFloorReconciled=m.assertTsFloor=m.TsFloorViolationError=m.CATALOG_KEEP_NAMESPACES=m.PLUGIN_UI_FLOOR=m.SDK_FLOOR=m.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=m.SDK_FLOOR_ASSETSPACE_UIDS=m.TS_FLOOR_AS_UID_SHARED_IDENTITIES=m.TS_FLOOR_AS_UID_EXOCMD=m.TS_FLOOR_AS_UID_EXO=m.parseGroundingDefinitionFromFrontmatter=m.isCommandBindingFrontmatter=m.isGroundingFrontmatter=m.isPreconditionFrontmatter=m.isCommandFrontmatter=m.isStyleSource=m.isLabelClass=m.isCommandVariant=m.STYLE_SOURCE_VALUES=m.LABEL_CLASS_VALUES=m.COMMAND_VARIANT_VALUES=m.CommandBindingStyleProperty=m.CommandBindingProperty=m.GroundingProperty=m.PreconditionProperty=m.CommandProperty=m.resolveGroundingTypeFromWikilinkLiteral=m.resolveGroundingTypeFromIRI=m.GROUNDING_TYPE_IRI_TO_ENUM=m.GROUNDING_TYPE_UID_TO_ENUM=m.GROUNDING_TYPE_UIDS=m.GroundingType=m.EFFORT_STATUS_OPTIONS=void 0;m.GraphQueryService=m.FixMissingLabelService=m.ArchiveAssetService=m.GenericAssetCreationService=m.URIConstructionService=m.SessionEventService=m.AssetConversionService=m.EnumValueResolver=m.ClassHierarchyResolver=m.PropertySchemaResolver=m.PlanningService=m.AlgorithmExtractor=m.orderProperties=m.loadDefaultSpec=m.clearOrderSpecLoader=m.registerOrderSpecLoader=m.DynamicFrontmatterGenerator=m.SupervisionCreationService=m.StatusTimestampService=m.RenameToUidService=m.PropertyCleanupService=m.LoggingService=m.extractAssetReference=m.FolderRepairService=m.EffortVotingService=m.WorkflowCommandAdapter=m.VisibilityGenerator=m.InstantiationRuleResolver=m.stripTemplateFrontmatter=m.resolveTemplateBody=m.getRegisteredResolverIds=m.clearResolvers=m.registerResolver=m.getResolver=m.installDefaultResolvers=m.WorkflowResolver=m.WorkflowEngine=m.EffortStatusWorkflow=m.ConceptCreationService=m.ClassCreationService=m.AreaHierarchyBuilder=m.AreaCreationService=m.TaskStatusService=m.createTripleStoreRequiredPropertyResolver=m.CommandExecutionFlow=m.stripFrontmatter=m.extractSparqlBlock=m.iriToObsidianName=m.NamedQueryRunner=m.createVaultFrontmatterRefToFolderResolver=void 0;m.AlgebraSerializer=m.AlgebraOptimizer=m.AlgebraTranslator=m.ExoQLAlgebraTranslator=m.DescribeOptionsTransformerError=m.DescribeOptionsTransformer=m.SPARQLParseError=m.SPARQLParser=m.ExoQLParser=m.isPathExcluded=m.normaliseExcludedFolders=m.NoteToRDFConverter=m.SOURCE_VARIABLE=m.SourceAnnotator=m.MAX_LAZY_DEPTH=m.LazyAssetGraphLoader=m.FILE_SPACE_CLASS_UID=m.frontmatterDeclaresFileSpace=m.discoverFileSpaceExclusions=m.deriveLegacyFlatPath=m.deriveUrl=m.derivePath=m.IRICanonicalizer=m.INFERRED_GRAPH=m.PrototypeChainMaterializer=m.PropertyCardinalityRegistry=m.NonInheritablePropertyRegistry=m.RDFSInferenceEngine=m.RDFVocabularyMapper=m.DomainTriple=m.DomainBlankNode=m.DomainLiteral=m.DomainIRI=m.InMemoryTripleStore=m.OBSIDIAN_VAULT_SCHEME=m.iriToVaultPath=m.vaultPathToIRI=m.NullLogger=m.RDFSerializer=m.FilenameValidator=m.EffortSortingHelpers=m.MetadataExtractor=m.MetadataHelpers=m.WikiLinkHelpers=m.DateFormatter=m.FrontmatterService=m.CriticalityZoneUUIDs=m.CriticalityZoneService=m.SPARQL_PREFIXES=m.TypeRegistry=void 0;m.registerCoreServices=m.DI_TOKENS=m.DEFAULT_FLEETING_NOTE_CLASS_UID=m.DEFAULT_INBOX_FOLDER=m.DEFAULT_OWNER_IDENTITY=m.VaultSettings=m.seededUidGenerator=m.liveUidGenerator=m.frozenClock=m.liveClock=m.TransactionError=m.TripleNotFoundError=m.TripleAlreadyExistsError=m.FileAlreadyExistsError=m.FileNotFoundError=m.FilterContainsOptimizer=m.VaultPrefixTransformer=m.CaseWhenTransformerError=m.CaseWhenTransformer=m.ResultSerializer=m.createIncrementalIndexer=m.IncrementalIndexer=m.createSPARQLResultCache=m.SPARQLResultCache=m.QueryPlanCache=m.createDoubleLiteral=m.createDecimalLiteral=m.getNumericValue=m.createPercentileAggregate=m.modeAggregate=m.stddevAggregate=m.varianceAggregate=m.medianAggregate=m.EXO_AGGREGATE_NS=m.BUILT_IN_AGGREGATES=m.CustomAggregateError=m.CustomAggregateRegistry=m.AggregateFunctions=m.BuiltInFunctions=m.SolutionMapping=m.UpdateExecutorError=m.UpdateExecutor=m.QueryExecutor=m.ExoQLQueryExecutor=m.DescribeExecutor=m.ConstructExecutor=m.UnionExecutor=m.OptionalExecutor=m.FilterExecutor=m.BGPExecutor=void 0;m.extractAssetUid=m.detectChanges=m.MATERIALIZE_PROGRESS_MIN_FILES=m.MATERIALIZE_PROGRESS_INTERVAL=m.escapeGitmodulesRegex=m.stripGitmodulesEntry=m.appendGitmodulesEntry=m.extractAssetSpaceSha=m.discoverAssetSpaceWrapperDir=m.mountAssetSpaceFiles=m.isBinaryPayload=m.restCreateCommit=m.parseTarballGzip=m.parseTarball=m.TripleClassHierarchy=m.ShaclShapeRegistry=m.shaclValidate=m.Namespace=m.ShapeRegistry=m.ShapeLoader=m.selectByPriority=m.LayoutSelector=m.isPropertiesBlock=m.isLayoutBlockFrontmatter=m.isBacklinksTableBlock=m.createLayoutBlockFromFrontmatter=m.PROPERTIES_BLOCK_CLASS_UID=m.PROPERTIES_BLOCK_CLASS_IRI=m.BACKLINKS_TABLE_BLOCK_CLASS_UID=m.BACKLINKS_TABLE_BLOCK_CLASS_IRI=m.isLayoutFrontmatter=m.isLayout=m.createLayoutFromFrontmatter=m.LAYOUT_CLASS_UID=m.LAYOUT_CLASS_IRI=m.ExoQLError=m.ExoQL=m.createStreamingSource=m.StreamingLoader=m.resetGlobalPool=m.getGlobalPool=m.MemoryPool=m.CompactGraphStore=m.StringTable=m.DEFAULT_COLORS=m.NODE_FLAGS=m.container=m.resetContainer=m.getContainer=m.createChildContainer=void 0;m.OUTBOX_REMOTE_ABSENT=m.OUTBOX_STORE_FILENAME=m.LocalOutboxStore=m.CONFLICT_CACHE_STORE_FILENAME=m.LocalConflictCacheStore=m.scanForSecrets=m.redactSecrets=m.withRateLimitBackoff=m.isRateLimitError=m.isAuthError=m.MOUNT_BASE_STORE_FILENAME=m.FileMountBaseStore=m.WATERMARK_STORE_FILENAME=m.FileWatermarkStore=m.GatedStructuredMerger=m.MergeShaclGate=m.splitSections=m.StructuredMerger=m.diff3=m.LOCAL_MANIFEST_STORE_FILENAME=m.FileLocalManifestStore=m.isSyncablePath=m.isFileSpaceSyncablePath=m.contentEquals=m.InMemoryQuarantineStore=m.DEFAULT_MAX_FILE_BYTES=m.backupPathFor=m.QuarantineResolver=m.formatRepoTimings=m.formatTimingsLine=m.fmtMs=m.dominantPhase=m.totalMs=m.aggregateTimings=m.addTimings=m.emptyTimings=m.classifyRestPhase=m.SYNC_PHASES=m.SyncPhaseTimer=m.orderChildrenFirst=m.isNonFastForwardError=m.SyncEngine=m.DEFAULT_LOCAL_MANIFEST_REHASH_MS=m.DEFAULT_MAX_PUSH_RETRIES=m.getTree=m.getHeadSha=m.getCommitInfo=m.getBlobText=m.getBlobBytes=m.gitBlobSha=void 0;m.isFormatOnlyDrift=m.compareAssetSemantics=m.summarizeParityRound=m.ParityValidator=m.readSpaceSource=m.parseStrictGitHubRepoURL=m.isFileSpaceFrontmatter=m.isAssetSpaceFrontmatter=m.classifySpaceDeclaration=m.SpaceSpecAccumulator=m.SYNC_BRANCH=m.ASSET_SPACE_CLASS_UID=void 0;ni(rl(),m);ni(nl(),m);var ZY=p_();Object.defineProperty(m,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return ZY.EFFORT_STATUS_OPTIONS},"get")});var eQ=Yo();Object.defineProperty(m,"GroundingType",{enumerable:!0,get:a(function(){return eQ.GroundingType},"get")});var Rd=pf();Object.defineProperty(m,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return Rd.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(m,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return Rd.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(m,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return Rd.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(m,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return Rd.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(m,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return Rd.resolveGroundingTypeFromWikilinkLiteral},"get")});var Cd=m_();Object.defineProperty(m,"CommandProperty",{enumerable:!0,get:a(function(){return Cd.CommandProperty},"get")});Object.defineProperty(m,"PreconditionProperty",{enumerable:!0,get:a(function(){return Cd.PreconditionProperty},"get")});Object.defineProperty(m,"GroundingProperty",{enumerable:!0,get:a(function(){return Cd.GroundingProperty},"get")});Object.defineProperty(m,"CommandBindingProperty",{enumerable:!0,get:a(function(){return Cd.CommandBindingProperty},"get")});Object.defineProperty(m,"CommandBindingStyleProperty",{enumerable:!0,get:a(function(){return Cd.CommandBindingStyleProperty},"get")});var gu=g_();Object.defineProperty(m,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:a(function(){return gu.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(m,"LABEL_CLASS_VALUES",{enumerable:!0,get:a(function(){return gu.LABEL_CLASS_VALUES},"get")});Object.defineProperty(m,"STYLE_SOURCE_VALUES",{enumerable:!0,get:a(function(){return gu.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(m,"isCommandVariant",{enumerable:!0,get:a(function(){return gu.isCommandVariant},"get")});Object.defineProperty(m,"isLabelClass",{enumerable:!0,get:a(function(){return gu.isLabelClass},"get")});Object.defineProperty(m,"isStyleSource",{enumerable:!0,get:a(function(){return gu.isStyleSource},"get")});var Gy=Tx();Object.defineProperty(m,"isCommandFrontmatter",{enumerable:!0,get:a(function(){return Gy.isCommandFrontmatter},"get")});Object.defineProperty(m,"isPreconditionFrontmatter",{enumerable:!0,get:a(function(){return Gy.isPreconditionFrontmatter},"get")});Object.defineProperty(m,"isGroundingFrontmatter",{enumerable:!0,get:a(function(){return Gy.isGroundingFrontmatter},"get")});Object.defineProperty(m,"isCommandBindingFrontmatter",{enumerable:!0,get:a(function(){return Gy.isCommandBindingFrontmatter},"get")});var tQ=Ax();Object.defineProperty(m,"parseGroundingDefinitionFromFrontmatter",{enumerable:!0,get:a(function(){return tQ.parseGroundingDefinitionFromFrontmatter},"get")});ni(Ix(),m);ni(xx(),m);ni(__(),m);ni(S_(),m);ni(Cx(),m);ni(Fx(),m);ni(tS(),m);ni(fR(),m);var ii=dR();Object.defineProperty(m,"TS_FLOOR_AS_UID_EXO",{enumerable:!0,get:a(function(){return ii.TS_FLOOR_AS_UID_EXO},"get")});Object.defineProperty(m,"TS_FLOOR_AS_UID_EXOCMD",{enumerable:!0,get:a(function(){return ii.TS_FLOOR_AS_UID_EXOCMD},"get")});Object.defineProperty(m,"TS_FLOOR_AS_UID_SHARED_IDENTITIES",{enumerable:!0,get:a(function(){return ii.TS_FLOOR_AS_UID_SHARED_IDENTITIES},"get")});Object.defineProperty(m,"SDK_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return ii.SDK_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(m,"PLUGIN_UI_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return ii.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(m,"SDK_FLOOR",{enumerable:!0,get:a(function(){return ii.SDK_FLOOR},"get")});Object.defineProperty(m,"PLUGIN_UI_FLOOR",{enumerable:!0,get:a(function(){return ii.PLUGIN_UI_FLOOR},"get")});Object.defineProperty(m,"CATALOG_KEEP_NAMESPACES",{enumerable:!0,get:a(function(){return ii.CATALOG_KEEP_NAMESPACES},"get")});Object.defineProperty(m,"TsFloorViolationError",{enumerable:!0,get:a(function(){return ii.TsFloorViolationError},"get")});Object.defineProperty(m,"assertTsFloor",{enumerable:!0,get:a(function(){return ii.assertTsFloor},"get")});Object.defineProperty(m,"assertTsFloorReconciled",{enumerable:!0,get:a(function(){return ii.assertTsFloorReconciled},"get")});Object.defineProperty(m,"isTsFloorAssetSpace",{enumerable:!0,get:a(function(){return ii.isTsFloorAssetSpace},"get")});Object.defineProperty(m,"isTsFloorMountPath",{enumerable:!0,get:a(function(){return ii.isTsFloorMountPath},"get")});var rQ=hR();Object.defineProperty(m,"transitiveDependsOnClosure",{enumerable:!0,get:a(function(){return rQ.transitiveDependsOnClosure},"get")});var NF=wp();Object.defineProperty(m,"PropertyFieldType",{enumerable:!0,get:a(function(){return NF.PropertyFieldType},"get")});Object.defineProperty(m,"rangeToFieldType",{enumerable:!0,get:a(function(){return NF.rangeToFieldType},"get")});var u2=sS();Object.defineProperty(m,"propertyNameToUri",{enumerable:!0,get:a(function(){return u2.propertyNameToUri},"get")});Object.defineProperty(m,"uriToPropertyName",{enumerable:!0,get:a(function(){return u2.uriToPropertyName},"get")});Object.defineProperty(m,"extractPropertyLabel",{enumerable:!0,get:a(function(){return u2.extractPropertyLabel},"get")});var nQ=eO();Object.defineProperty(m,"CommandResolver",{enumerable:!0,get:a(function(){return nQ.CommandResolver},"get")});var iQ=rO();Object.defineProperty(m,"PreconditionEvaluator",{enumerable:!0,get:a(function(){return iQ.PreconditionEvaluator},"get")});var f2=nO();Object.defineProperty(m,"hasNonUidFilename",{enumerable:!0,get:a(function(){return f2.hasNonUidFilename},"get")});Object.defineProperty(m,"hasUidFilename",{enumerable:!0,get:a(function(){return f2.hasUidFilename},"get")});Object.defineProperty(m,"registerDefaultHostFunctions",{enumerable:!0,get:a(function(){return f2.registerDefaultHostFunctions},"get")});var kF=fO();Object.defineProperty(m,"GroundingExecutor",{enumerable:!0,get:a(function(){return kF.GroundingExecutor},"get")});Object.defineProperty(m,"ServiceRegistry",{enumerable:!0,get:a(function(){return kF.ServiceRegistry},"get")});var sQ=dO();Object.defineProperty(m,"createVaultFrontmatterClassLabelResolver",{enumerable:!0,get:a(function(){return sQ.createVaultFrontmatterClassLabelResolver},"get")});var oQ=hO();Object.defineProperty(m,"createVaultFrontmatterRefToFolderResolver",{enumerable:!0,get:a(function(){return oQ.createVaultFrontmatterRefToFolderResolver},"get")});var aQ=mO();Object.defineProperty(m,"NamedQueryRunner",{enumerable:!0,get:a(function(){return aQ.NamedQueryRunner},"get")});var cQ=Up();Object.defineProperty(m,"iriToObsidianName",{enumerable:!0,get:a(function(){return cQ.iriToObsidianName},"get")});var MF=gO();Object.defineProperty(m,"extractSparqlBlock",{enumerable:!0,get:a(function(){return MF.extractSparqlBlock},"get")});Object.defineProperty(m,"stripFrontmatter",{enumerable:!0,get:a(function(){return MF.stripFrontmatter},"get")});var lQ=bO();Object.defineProperty(m,"CommandExecutionFlow",{enumerable:!0,get:a(function(){return lQ.CommandExecutionFlow},"get")});var uQ=wO();Object.defineProperty(m,"createTripleStoreRequiredPropertyResolver",{enumerable:!0,get:a(function(){return uQ.createTripleStoreRequiredPropertyResolver},"get")});var fQ=U1();Object.defineProperty(m,"TaskStatusService",{enumerable:!0,get:a(function(){return fQ.TaskStatusService},"get")});var dQ=G1();Object.defineProperty(m,"AreaCreationService",{enumerable:!0,get:a(function(){return dQ.AreaCreationService},"get")});var hQ=H1();Object.defineProperty(m,"AreaHierarchyBuilder",{enumerable:!0,get:a(function(){return hQ.AreaHierarchyBuilder},"get")});var pQ=J1();Object.defineProperty(m,"ClassCreationService",{enumerable:!0,get:a(function(){return pQ.ClassCreationService},"get")});var mQ=ev();Object.defineProperty(m,"ConceptCreationService",{enumerable:!0,get:a(function(){return mQ.ConceptCreationService},"get")});var gQ=gg();Object.defineProperty(m,"EffortStatusWorkflow",{enumerable:!0,get:a(function(){return gQ.EffortStatusWorkflow},"get")});var yQ=Zf();Object.defineProperty(m,"WorkflowEngine",{enumerable:!0,get:a(function(){return yQ.WorkflowEngine},"get")});var bQ=R1();Object.defineProperty(m,"WorkflowResolver",{enumerable:!0,get:a(function(){return bQ.WorkflowResolver},"get")});var Od=Xm();Object.defineProperty(m,"installDefaultResolvers",{enumerable:!0,get:a(function(){return Od.installDefaultResolvers},"get")});Object.defineProperty(m,"getResolver",{enumerable:!0,get:a(function(){return Od.getResolver},"get")});Object.defineProperty(m,"registerResolver",{enumerable:!0,get:a(function(){return Od.registerResolver},"get")});Object.defineProperty(m,"clearResolvers",{enumerable:!0,get:a(function(){return Od.clearResolvers},"get")});Object.defineProperty(m,"getRegisteredResolverIds",{enumerable:!0,get:a(function(){return Od.getRegisteredResolverIds},"get")});var jF=d1();Object.defineProperty(m,"resolveTemplateBody",{enumerable:!0,get:a(function(){return jF.resolveTemplateBody},"get")});Object.defineProperty(m,"stripTemplateFrontmatter",{enumerable:!0,get:a(function(){return jF.stripTemplateFrontmatter},"get")});var _Q=jO();Object.defineProperty(m,"InstantiationRuleResolver",{enumerable:!0,get:a(function(){return _Q.InstantiationRuleResolver},"get")});var SQ=$O();Object.defineProperty(m,"VisibilityGenerator",{enumerable:!0,get:a(function(){return SQ.VisibilityGenerator},"get")});var wQ=UO();Object.defineProperty(m,"WorkflowCommandAdapter",{enumerable:!0,get:a(function(){return wQ.WorkflowCommandAdapter},"get")});var vQ=av();Object.defineProperty(m,"EffortVotingService",{enumerable:!0,get:a(function(){return vQ.EffortVotingService},"get")});var EQ=wg();Object.defineProperty(m,"FolderRepairService",{enumerable:!0,get:a(function(){return EQ.FolderRepairService},"get")});var TQ=td();Object.defineProperty(m,"extractAssetReference",{enumerable:!0,get:a(function(){return TQ.extractAssetReference},"get")});var AQ=dc();Object.defineProperty(m,"LoggingService",{enumerable:!0,get:a(function(){return AQ.LoggingService},"get")});var IQ=uv();Object.defineProperty(m,"PropertyCleanupService",{enumerable:!0,get:a(function(){return IQ.PropertyCleanupService},"get")});var xQ=dv();Object.defineProperty(m,"RenameToUidService",{enumerable:!0,get:a(function(){return xQ.RenameToUidService},"get")});var RQ=bg();Object.defineProperty(m,"StatusTimestampService",{enumerable:!0,get:a(function(){return RQ.StatusTimestampService},"get")});var CQ=mv();Object.defineProperty(m,"SupervisionCreationService",{enumerable:!0,get:a(function(){return CQ.SupervisionCreationService},"get")});var OQ=yv();Object.defineProperty(m,"DynamicFrontmatterGenerator",{enumerable:!0,get:a(function(){return OQ.DynamicFrontmatterGenerator},"get")});var Wy=zf();Object.defineProperty(m,"registerOrderSpecLoader",{enumerable:!0,get:a(function(){return Wy.registerOrderSpecLoader},"get")});Object.defineProperty(m,"clearOrderSpecLoader",{enumerable:!0,get:a(function(){return Wy.clearOrderSpecLoader},"get")});Object.defineProperty(m,"loadDefaultSpec",{enumerable:!0,get:a(function(){return Wy.loadDefaultSpec},"get")});Object.defineProperty(m,"orderProperties",{enumerable:!0,get:a(function(){return Wy.orderProperties},"get")});var PQ=_v();Object.defineProperty(m,"AlgorithmExtractor",{enumerable:!0,get:a(function(){return PQ.AlgorithmExtractor},"get")});var FQ=wv();Object.defineProperty(m,"PlanningService",{enumerable:!0,get:a(function(){return FQ.PlanningService},"get")});var DQ=QO();Object.defineProperty(m,"PropertySchemaResolver",{enumerable:!0,get:a(function(){return DQ.PropertySchemaResolver},"get")});var LQ=XO();Object.defineProperty(m,"ClassHierarchyResolver",{enumerable:!0,get:a(function(){return LQ.ClassHierarchyResolver},"get")});var NQ=JO();Object.defineProperty(m,"EnumValueResolver",{enumerable:!0,get:a(function(){return NQ.EnumValueResolver},"get")});var kQ=Iv();Object.defineProperty(m,"AssetConversionService",{enumerable:!0,get:a(function(){return kQ.AssetConversionService},"get")});var MQ=Cv();Object.defineProperty(m,"SessionEventService",{enumerable:!0,get:a(function(){return MQ.SessionEventService},"get")});var jQ=Fv();Object.defineProperty(m,"URIConstructionService",{enumerable:!0,get:a(function(){return jQ.URIConstructionService},"get")});var $Q=Lv();Object.defineProperty(m,"GenericAssetCreationService",{enumerable:!0,get:a(function(){return $Q.GenericAssetCreationService},"get")});var UQ=c3();Object.defineProperty(m,"ArchiveAssetService",{enumerable:!0,get:a(function(){return UQ.ArchiveAssetService},"get")});var BQ=u3();Object.defineProperty(m,"FixMissingLabelService",{enumerable:!0,get:a(function(){return BQ.FixMissingLabelService},"get")});var VQ=f3();Object.defineProperty(m,"GraphQueryService",{enumerable:!0,get:a(function(){return VQ.GraphQueryService},"get")});var qQ=h3();Object.defineProperty(m,"TypeRegistry",{enumerable:!0,get:a(function(){return qQ.TypeRegistry},"get")});var GQ=p3();Object.defineProperty(m,"SPARQL_PREFIXES",{enumerable:!0,get:a(function(){return GQ.SPARQL_PREFIXES},"get")});var $F=Uv();Object.defineProperty(m,"CriticalityZoneService",{enumerable:!0,get:a(function(){return $F.CriticalityZoneService},"get")});Object.defineProperty(m,"CriticalityZoneUUIDs",{enumerable:!0,get:a(function(){return $F.CriticalityZoneUUIDs},"get")});var WQ=Es();Object.defineProperty(m,"FrontmatterService",{enumerable:!0,get:a(function(){return WQ.FrontmatterService},"get")});var HQ=jn();Object.defineProperty(m,"DateFormatter",{enumerable:!0,get:a(function(){return HQ.DateFormatter},"get")});var zQ=io();Object.defineProperty(m,"WikiLinkHelpers",{enumerable:!0,get:a(function(){return zQ.WikiLinkHelpers},"get")});var KQ=yo();Object.defineProperty(m,"MetadataHelpers",{enumerable:!0,get:a(function(){return KQ.MetadataHelpers},"get")});var YQ=V1();Object.defineProperty(m,"MetadataExtractor",{enumerable:!0,get:a(function(){return YQ.MetadataExtractor},"get")});var QQ=g3();Object.defineProperty(m,"EffortSortingHelpers",{enumerable:!0,get:a(function(){return QQ.EffortSortingHelpers},"get")});var XQ=y3();Object.defineProperty(m,"FilenameValidator",{enumerable:!0,get:a(function(){return XQ.FilenameValidator},"get")});var JQ=T3();Object.defineProperty(m,"RDFSerializer",{enumerable:!0,get:a(function(){return JQ.RDFSerializer},"get")});var ZQ=ol();Object.defineProperty(m,"NullLogger",{enumerable:!0,get:a(function(){return ZQ.NullLogger},"get")});var d2=Jv();Object.defineProperty(m,"vaultPathToIRI",{enumerable:!0,get:a(function(){return d2.vaultPathToIRI},"get")});Object.defineProperty(m,"iriToVaultPath",{enumerable:!0,get:a(function(){return d2.iriToVaultPath},"get")});Object.defineProperty(m,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:a(function(){return d2.OBSIDIAN_VAULT_SCHEME},"get")});var eX=k1();Object.defineProperty(m,"InMemoryTripleStore",{enumerable:!0,get:a(function(){return eX.InMemoryTripleStore},"get")});var tX=Pe();Object.defineProperty(m,"DomainIRI",{enumerable:!0,get:a(function(){return tX.IRI},"get")});var rX=Ge();Object.defineProperty(m,"DomainLiteral",{enumerable:!0,get:a(function(){return rX.Literal},"get")});var nX=jt();Object.defineProperty(m,"DomainBlankNode",{enumerable:!0,get:a(function(){return nX.BlankNode},"get")});var iX=Xn();Object.defineProperty(m,"DomainTriple",{enumerable:!0,get:a(function(){return iX.Triple},"get")});var sX=eE();Object.defineProperty(m,"RDFVocabularyMapper",{enumerable:!0,get:a(function(){return sX.RDFVocabularyMapper},"get")});var oX=I3();Object.defineProperty(m,"RDFSInferenceEngine",{enumerable:!0,get:a(function(){return oX.RDFSInferenceEngine},"get")});var aX=iE();Object.defineProperty(m,"NonInheritablePropertyRegistry",{enumerable:!0,get:a(function(){return aX.NonInheritablePropertyRegistry},"get")});var cX=aE();Object.defineProperty(m,"PropertyCardinalityRegistry",{enumerable:!0,get:a(function(){return cX.PropertyCardinalityRegistry},"get")});var UF=uE();Object.defineProperty(m,"PrototypeChainMaterializer",{enumerable:!0,get:a(function(){return UF.PrototypeChainMaterializer},"get")});Object.defineProperty(m,"INFERRED_GRAPH",{enumerable:!0,get:a(function(){return UF.INFERRED_GRAPH},"get")});var lX=D3();Object.defineProperty(m,"IRICanonicalizer",{enumerable:!0,get:a(function(){return lX.IRICanonicalizer},"get")});var h2=jg();Object.defineProperty(m,"derivePath",{enumerable:!0,get:a(function(){return h2.derivePath},"get")});Object.defineProperty(m,"deriveUrl",{enumerable:!0,get:a(function(){return h2.deriveUrl},"get")});Object.defineProperty(m,"deriveLegacyFlatPath",{enumerable:!0,get:a(function(){return h2.deriveLegacyFlatPath},"get")});var p2=$g();Object.defineProperty(m,"discoverFileSpaceExclusions",{enumerable:!0,get:a(function(){return p2.discoverFileSpaceExclusions},"get")});Object.defineProperty(m,"frontmatterDeclaresFileSpace",{enumerable:!0,get:a(function(){return p2.frontmatterDeclaresFileSpace},"get")});Object.defineProperty(m,"FILE_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return p2.FILE_SPACE_CLASS_UID},"get")});var BF=j3();Object.defineProperty(m,"LazyAssetGraphLoader",{enumerable:!0,get:a(function(){return BF.LazyAssetGraphLoader},"get")});Object.defineProperty(m,"MAX_LAZY_DEPTH",{enumerable:!0,get:a(function(){return BF.MAX_LAZY_DEPTH},"get")});var VF=yE();Object.defineProperty(m,"SourceAnnotator",{enumerable:!0,get:a(function(){return VF.SourceAnnotator},"get")});Object.defineProperty(m,"SOURCE_VARIABLE",{enumerable:!0,get:a(function(){return VF.SOURCE_VARIABLE},"get")});var m2=wE();Object.defineProperty(m,"NoteToRDFConverter",{enumerable:!0,get:a(function(){return m2.NoteToRDFConverter},"get")});Object.defineProperty(m,"normaliseExcludedFolders",{enumerable:!0,get:a(function(){return m2.normaliseExcludedFolders},"get")});Object.defineProperty(m,"isPathExcluded",{enumerable:!0,get:a(function(){return m2.isPathExcluded},"get")});var g2=bl();Object.defineProperty(m,"ExoQLParser",{enumerable:!0,get:a(function(){return g2.ExoQLParser},"get")});Object.defineProperty(m,"SPARQLParser",{enumerable:!0,get:a(function(){return g2.SPARQLParser},"get")});Object.defineProperty(m,"SPARQLParseError",{enumerable:!0,get:a(function(){return g2.SPARQLParseError},"get")});var qF=iw();Object.defineProperty(m,"DescribeOptionsTransformer",{enumerable:!0,get:a(function(){return qF.DescribeOptionsTransformer},"get")});Object.defineProperty(m,"DescribeOptionsTransformerError",{enumerable:!0,get:a(function(){return qF.DescribeOptionsTransformerError},"get")});var GF=Sl();Object.defineProperty(m,"ExoQLAlgebraTranslator",{enumerable:!0,get:a(function(){return GF.ExoQLAlgebraTranslator},"get")});Object.defineProperty(m,"AlgebraTranslator",{enumerable:!0,get:a(function(){return GF.AlgebraTranslator},"get")});var uX=W3();Object.defineProperty(m,"AlgebraOptimizer",{enumerable:!0,get:a(function(){return uX.AlgebraOptimizer},"get")});var fX=H3();Object.defineProperty(m,"AlgebraSerializer",{enumerable:!0,get:a(function(){return fX.AlgebraSerializer},"get")});var dX=vw();Object.defineProperty(m,"BGPExecutor",{enumerable:!0,get:a(function(){return dX.BGPExecutor},"get")});var hX=Om();Object.defineProperty(m,"FilterExecutor",{enumerable:!0,get:a(function(){return hX.FilterExecutor},"get")});var pX=Bw();Object.defineProperty(m,"OptionalExecutor",{enumerable:!0,get:a(function(){return pX.OptionalExecutor},"get")});var mX=qw();Object.defineProperty(m,"UnionExecutor",{enumerable:!0,get:a(function(){return mX.UnionExecutor},"get")});var gX=Zw();Object.defineProperty(m,"ConstructExecutor",{enumerable:!0,get:a(function(){return gX.ConstructExecutor},"get")});var yX=K3();Object.defineProperty(m,"DescribeExecutor",{enumerable:!0,get:a(function(){return yX.DescribeExecutor},"get")});var WF=Bl();Object.defineProperty(m,"ExoQLQueryExecutor",{enumerable:!0,get:a(function(){return WF.ExoQLQueryExecutor},"get")});Object.defineProperty(m,"QueryExecutor",{enumerable:!0,get:a(function(){return WF.QueryExecutor},"get")});var HF=Q3();Object.defineProperty(m,"UpdateExecutor",{enumerable:!0,get:a(function(){return HF.UpdateExecutor},"get")});Object.defineProperty(m,"UpdateExecutorError",{enumerable:!0,get:a(function(){return HF.UpdateExecutorError},"get")});var bX=_s();Object.defineProperty(m,"SolutionMapping",{enumerable:!0,get:a(function(){return bX.SolutionMapping},"get")});var _X=Cm();Object.defineProperty(m,"BuiltInFunctions",{enumerable:!0,get:a(function(){return _X.BuiltInFunctions},"get")});var SX=J3();Object.defineProperty(m,"AggregateFunctions",{enumerable:!0,get:a(function(){return SX.AggregateFunctions},"get")});var zF=Hw();Object.defineProperty(m,"CustomAggregateRegistry",{enumerable:!0,get:a(function(){return zF.CustomAggregateRegistry},"get")});Object.defineProperty(m,"CustomAggregateError",{enumerable:!0,get:a(function(){return zF.CustomAggregateError},"get")});var Ns=zw();Object.defineProperty(m,"BUILT_IN_AGGREGATES",{enumerable:!0,get:a(function(){return Ns.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(m,"EXO_AGGREGATE_NS",{enumerable:!0,get:a(function(){return Ns.EXO_AGGREGATE_NS},"get")});Object.defineProperty(m,"medianAggregate",{enumerable:!0,get:a(function(){return Ns.medianAggregate},"get")});Object.defineProperty(m,"varianceAggregate",{enumerable:!0,get:a(function(){return Ns.varianceAggregate},"get")});Object.defineProperty(m,"stddevAggregate",{enumerable:!0,get:a(function(){return Ns.stddevAggregate},"get")});Object.defineProperty(m,"modeAggregate",{enumerable:!0,get:a(function(){return Ns.modeAggregate},"get")});Object.defineProperty(m,"createPercentileAggregate",{enumerable:!0,get:a(function(){return Ns.createPercentileAggregate},"get")});Object.defineProperty(m,"getNumericValue",{enumerable:!0,get:a(function(){return Ns.getNumericValue},"get")});Object.defineProperty(m,"createDecimalLiteral",{enumerable:!0,get:a(function(){return Ns.createDecimalLiteral},"get")});Object.defineProperty(m,"createDoubleLiteral",{enumerable:!0,get:a(function(){return Ns.createDoubleLiteral},"get")});var wX=Z3();Object.defineProperty(m,"QueryPlanCache",{enumerable:!0,get:a(function(){return wX.QueryPlanCache},"get")});var KF=eP();Object.defineProperty(m,"SPARQLResultCache",{enumerable:!0,get:a(function(){return KF.SPARQLResultCache},"get")});Object.defineProperty(m,"createSPARQLResultCache",{enumerable:!0,get:a(function(){return KF.createSPARQLResultCache},"get")});var YF=tP();Object.defineProperty(m,"IncrementalIndexer",{enumerable:!0,get:a(function(){return YF.IncrementalIndexer},"get")});Object.defineProperty(m,"createIncrementalIndexer",{enumerable:!0,get:a(function(){return YF.createIncrementalIndexer},"get")});var vX=rP();Object.defineProperty(m,"ResultSerializer",{enumerable:!0,get:a(function(){return vX.ResultSerializer},"get")});var QF=tw();Object.defineProperty(m,"CaseWhenTransformer",{enumerable:!0,get:a(function(){return QF.CaseWhenTransformer},"get")});Object.defineProperty(m,"CaseWhenTransformerError",{enumerable:!0,get:a(function(){return QF.CaseWhenTransformerError},"get")});var EX=cw();Object.defineProperty(m,"VaultPrefixTransformer",{enumerable:!0,get:a(function(){return EX.VaultPrefixTransformer},"get")});var TX=EE();Object.defineProperty(m,"FilterContainsOptimizer",{enumerable:!0,get:a(function(){return TX.FilterContainsOptimizer},"get")});var XF=nP();Object.defineProperty(m,"FileNotFoundError",{enumerable:!0,get:a(function(){return XF.FileNotFoundError},"get")});Object.defineProperty(m,"FileAlreadyExistsError",{enumerable:!0,get:a(function(){return XF.FileAlreadyExistsError},"get")});var y2=F1();Object.defineProperty(m,"TripleAlreadyExistsError",{enumerable:!0,get:a(function(){return y2.TripleAlreadyExistsError},"get")});Object.defineProperty(m,"TripleNotFoundError",{enumerable:!0,get:a(function(){return y2.TripleNotFoundError},"get")});Object.defineProperty(m,"TransactionError",{enumerable:!0,get:a(function(){return y2.TransactionError},"get")});var JF=Gf();Object.defineProperty(m,"liveClock",{enumerable:!0,get:a(function(){return JF.liveClock},"get")});Object.defineProperty(m,"frozenClock",{enumerable:!0,get:a(function(){return JF.frozenClock},"get")});var ZF=Km();Object.defineProperty(m,"liveUidGenerator",{enumerable:!0,get:a(function(){return ZF.liveUidGenerator},"get")});Object.defineProperty(m,"seededUidGenerator",{enumerable:!0,get:a(function(){return ZF.seededUidGenerator},"get")});var Hy=kE();Object.defineProperty(m,"VaultSettings",{enumerable:!0,get:a(function(){return Hy.VaultSettings},"get")});Object.defineProperty(m,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:a(function(){return Hy.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(m,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:a(function(){return Hy.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(m,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:a(function(){return Hy.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var AX=Bt();Object.defineProperty(m,"DI_TOKENS",{enumerable:!0,get:a(function(){return AX.DI_TOKENS},"get")});var Pd=iP();Object.defineProperty(m,"registerCoreServices",{enumerable:!0,get:a(function(){return Pd.registerCoreServices},"get")});Object.defineProperty(m,"createChildContainer",{enumerable:!0,get:a(function(){return Pd.createChildContainer},"get")});Object.defineProperty(m,"getContainer",{enumerable:!0,get:a(function(){return Pd.getContainer},"get")});Object.defineProperty(m,"resetContainer",{enumerable:!0,get:a(function(){return Pd.resetContainer},"get")});Object.defineProperty(m,"container",{enumerable:!0,get:a(function(){return Pd.container},"get")});var Fo=uP();Object.defineProperty(m,"NODE_FLAGS",{enumerable:!0,get:a(function(){return Fo.NODE_FLAGS},"get")});Object.defineProperty(m,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return Fo.DEFAULT_COLORS},"get")});Object.defineProperty(m,"StringTable",{enumerable:!0,get:a(function(){return Fo.StringTable},"get")});Object.defineProperty(m,"CompactGraphStore",{enumerable:!0,get:a(function(){return Fo.CompactGraphStore},"get")});Object.defineProperty(m,"MemoryPool",{enumerable:!0,get:a(function(){return Fo.MemoryPool},"get")});Object.defineProperty(m,"getGlobalPool",{enumerable:!0,get:a(function(){return Fo.getGlobalPool},"get")});Object.defineProperty(m,"resetGlobalPool",{enumerable:!0,get:a(function(){return Fo.resetGlobalPool},"get")});Object.defineProperty(m,"StreamingLoader",{enumerable:!0,get:a(function(){return Fo.StreamingLoader},"get")});Object.defineProperty(m,"createStreamingSource",{enumerable:!0,get:a(function(){return Fo.createStreamingSource},"get")});var eD=fP();Object.defineProperty(m,"ExoQL",{enumerable:!0,get:a(function(){return eD.ExoQL},"get")});Object.defineProperty(m,"ExoQLError",{enumerable:!0,get:a(function(){return eD.ExoQLError},"get")});var Fd=KE();Object.defineProperty(m,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return Fd.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(m,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return Fd.LAYOUT_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return Fd.createLayoutFromFrontmatter},"get")});Object.defineProperty(m,"isLayout",{enumerable:!0,get:a(function(){return Fd.isLayout},"get")});Object.defineProperty(m,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return Fd.isLayoutFrontmatter},"get")});var wa=KE();Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return wa.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return wa.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return wa.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return wa.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return wa.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(m,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return wa.isBacklinksTableBlock},"get")});Object.defineProperty(m,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return wa.isLayoutBlockFrontmatter},"get")});Object.defineProperty(m,"isPropertiesBlock",{enumerable:!0,get:a(function(){return wa.isPropertiesBlock},"get")});var tD=bP();Object.defineProperty(m,"LayoutSelector",{enumerable:!0,get:a(function(){return tD.LayoutSelector},"get")});Object.defineProperty(m,"selectByPriority",{enumerable:!0,get:a(function(){return tD.selectByPriority},"get")});ni(xP(),m);var IX=RP();Object.defineProperty(m,"ShapeLoader",{enumerable:!0,get:a(function(){return IX.ShapeLoader},"get")});var xX=sT();Object.defineProperty(m,"ShapeRegistry",{enumerable:!0,get:a(function(){return xX.ShapeRegistry},"get")});var RX=zt();Object.defineProperty(m,"Namespace",{enumerable:!0,get:a(function(){return RX.Namespace},"get")});var rD=uT();Object.defineProperty(m,"shaclValidate",{enumerable:!0,get:a(function(){return rD.validate},"get")});Object.defineProperty(m,"ShaclShapeRegistry",{enumerable:!0,get:a(function(){return rD.ShapeRegistry},"get")});ni(OP(),m);var CX=PP();Object.defineProperty(m,"TripleClassHierarchy",{enumerable:!0,get:a(function(){return CX.ClassHierarchy},"get")});var nD=pT();Object.defineProperty(m,"parseTarball",{enumerable:!0,get:a(function(){return nD.parseTarball},"get")});Object.defineProperty(m,"parseTarballGzip",{enumerable:!0,get:a(function(){return nD.parseTarballGzip},"get")});var iD=vy();Object.defineProperty(m,"restCreateCommit",{enumerable:!0,get:a(function(){return iD.restCreateCommit},"get")});Object.defineProperty(m,"isBinaryPayload",{enumerable:!0,get:a(function(){return iD.isBinaryPayload},"get")});var va=jP();Object.defineProperty(m,"mountAssetSpaceFiles",{enumerable:!0,get:a(function(){return va.mountAssetSpaceFiles},"get")});Object.defineProperty(m,"discoverAssetSpaceWrapperDir",{enumerable:!0,get:a(function(){return va.discoverWrapperDir},"get")});Object.defineProperty(m,"extractAssetSpaceSha",{enumerable:!0,get:a(function(){return va.extractShaFromWrapper},"get")});Object.defineProperty(m,"appendGitmodulesEntry",{enumerable:!0,get:a(function(){return va.appendGitmodulesEntry},"get")});Object.defineProperty(m,"stripGitmodulesEntry",{enumerable:!0,get:a(function(){return va.stripGitmodulesEntry},"get")});Object.defineProperty(m,"escapeGitmodulesRegex",{enumerable:!0,get:a(function(){return va.escapeGitmodulesRegex},"get")});Object.defineProperty(m,"MATERIALIZE_PROGRESS_INTERVAL",{enumerable:!0,get:a(function(){return va.MATERIALIZE_PROGRESS_INTERVAL},"get")});Object.defineProperty(m,"MATERIALIZE_PROGRESS_MIN_FILES",{enumerable:!0,get:a(function(){return va.MATERIALIZE_PROGRESS_MIN_FILES},"get")});var sD=Ay();Object.defineProperty(m,"detectChanges",{enumerable:!0,get:a(function(){return sD.detectChanges},"get")});Object.defineProperty(m,"extractAssetUid",{enumerable:!0,get:a(function(){return sD.extractAssetUid},"get")});var OX=uu();Object.defineProperty(m,"gitBlobSha",{enumerable:!0,get:a(function(){return OX.gitBlobSha},"get")});var Dd=md();Object.defineProperty(m,"getBlobBytes",{enumerable:!0,get:a(function(){return Dd.getBlobBytes},"get")});Object.defineProperty(m,"getBlobText",{enumerable:!0,get:a(function(){return Dd.getBlobText},"get")});Object.defineProperty(m,"getCommitInfo",{enumerable:!0,get:a(function(){return Dd.getCommitInfo},"get")});Object.defineProperty(m,"getHeadSha",{enumerable:!0,get:a(function(){return Dd.getHeadSha},"get")});Object.defineProperty(m,"getTree",{enumerable:!0,get:a(function(){return Dd.getTree},"get")});var Ld=ZP();Object.defineProperty(m,"DEFAULT_MAX_PUSH_RETRIES",{enumerable:!0,get:a(function(){return Ld.DEFAULT_MAX_PUSH_RETRIES},"get")});Object.defineProperty(m,"DEFAULT_LOCAL_MANIFEST_REHASH_MS",{enumerable:!0,get:a(function(){return Ld.DEFAULT_LOCAL_MANIFEST_REHASH_MS},"get")});Object.defineProperty(m,"SyncEngine",{enumerable:!0,get:a(function(){return Ld.SyncEngine},"get")});Object.defineProperty(m,"isNonFastForwardError",{enumerable:!0,get:a(function(){return Ld.isNonFastForwardError},"get")});Object.defineProperty(m,"orderChildrenFirst",{enumerable:!0,get:a(function(){return Ld.orderChildrenFirst},"get")});var Ji=vT();Object.defineProperty(m,"SyncPhaseTimer",{enumerable:!0,get:a(function(){return Ji.SyncPhaseTimer},"get")});Object.defineProperty(m,"SYNC_PHASES",{enumerable:!0,get:a(function(){return Ji.SYNC_PHASES},"get")});Object.defineProperty(m,"classifyRestPhase",{enumerable:!0,get:a(function(){return Ji.classifyRestPhase},"get")});Object.defineProperty(m,"emptyTimings",{enumerable:!0,get:a(function(){return Ji.emptyTimings},"get")});Object.defineProperty(m,"addTimings",{enumerable:!0,get:a(function(){return Ji.addTimings},"get")});Object.defineProperty(m,"aggregateTimings",{enumerable:!0,get:a(function(){return Ji.aggregateTimings},"get")});Object.defineProperty(m,"totalMs",{enumerable:!0,get:a(function(){return Ji.totalMs},"get")});Object.defineProperty(m,"dominantPhase",{enumerable:!0,get:a(function(){return Ji.dominantPhase},"get")});Object.defineProperty(m,"fmtMs",{enumerable:!0,get:a(function(){return Ji.fmtMs},"get")});Object.defineProperty(m,"formatTimingsLine",{enumerable:!0,get:a(function(){return Ji.formatTimingsLine},"get")});Object.defineProperty(m,"formatRepoTimings",{enumerable:!0,get:a(function(){return Ji.formatRepoTimings},"get")});var oD=tF();Object.defineProperty(m,"QuarantineResolver",{enumerable:!0,get:a(function(){return oD.QuarantineResolver},"get")});Object.defineProperty(m,"backupPathFor",{enumerable:!0,get:a(function(){return oD.backupPathFor},"get")});var Nd=Fy();Object.defineProperty(m,"DEFAULT_MAX_FILE_BYTES",{enumerable:!0,get:a(function(){return Nd.DEFAULT_MAX_FILE_BYTES},"get")});Object.defineProperty(m,"InMemoryQuarantineStore",{enumerable:!0,get:a(function(){return Nd.InMemoryQuarantineStore},"get")});Object.defineProperty(m,"contentEquals",{enumerable:!0,get:a(function(){return Nd.contentEquals},"get")});Object.defineProperty(m,"isFileSpaceSyncablePath",{enumerable:!0,get:a(function(){return Nd.isFileSpaceSyncablePath},"get")});Object.defineProperty(m,"isSyncablePath",{enumerable:!0,get:a(function(){return Nd.isSyncablePath},"get")});var aD=rF();Object.defineProperty(m,"FileLocalManifestStore",{enumerable:!0,get:a(function(){return aD.FileLocalManifestStore},"get")});Object.defineProperty(m,"LOCAL_MANIFEST_STORE_FILENAME",{enumerable:!0,get:a(function(){return aD.LOCAL_MANIFEST_STORE_FILENAME},"get")});var PX=kT();Object.defineProperty(m,"diff3",{enumerable:!0,get:a(function(){return PX.diff3},"get")});var cD=sF();Object.defineProperty(m,"StructuredMerger",{enumerable:!0,get:a(function(){return cD.StructuredMerger},"get")});Object.defineProperty(m,"splitSections",{enumerable:!0,get:a(function(){return cD.splitSections},"get")});var FX=oF();Object.defineProperty(m,"MergeShaclGate",{enumerable:!0,get:a(function(){return FX.MergeShaclGate},"get")});var DX=aF();Object.defineProperty(m,"GatedStructuredMerger",{enumerable:!0,get:a(function(){return DX.GatedStructuredMerger},"get")});var lD=cF();Object.defineProperty(m,"FileWatermarkStore",{enumerable:!0,get:a(function(){return lD.FileWatermarkStore},"get")});Object.defineProperty(m,"WATERMARK_STORE_FILENAME",{enumerable:!0,get:a(function(){return lD.WATERMARK_STORE_FILENAME},"get")});var uD=lF();Object.defineProperty(m,"FileMountBaseStore",{enumerable:!0,get:a(function(){return uD.FileMountBaseStore},"get")});Object.defineProperty(m,"MOUNT_BASE_STORE_FILENAME",{enumerable:!0,get:a(function(){return uD.MOUNT_BASE_STORE_FILENAME},"get")});var LX=Ry();Object.defineProperty(m,"isAuthError",{enumerable:!0,get:a(function(){return LX.isAuthError},"get")});var fD=Py();Object.defineProperty(m,"isRateLimitError",{enumerable:!0,get:a(function(){return fD.isRateLimitError},"get")});Object.defineProperty(m,"withRateLimitBackoff",{enumerable:!0,get:a(function(){return fD.withRateLimitBackoff},"get")});var dD=IT();Object.defineProperty(m,"redactSecrets",{enumerable:!0,get:a(function(){return dD.redactSecrets},"get")});Object.defineProperty(m,"scanForSecrets",{enumerable:!0,get:a(function(){return dD.scanForSecrets},"get")});var hD=uF();Object.defineProperty(m,"LocalConflictCacheStore",{enumerable:!0,get:a(function(){return hD.LocalConflictCacheStore},"get")});Object.defineProperty(m,"CONFLICT_CACHE_STORE_FILENAME",{enumerable:!0,get:a(function(){return hD.CONFLICT_CACHE_STORE_FILENAME},"get")});var b2=xy();Object.defineProperty(m,"LocalOutboxStore",{enumerable:!0,get:a(function(){return b2.LocalOutboxStore},"get")});Object.defineProperty(m,"OUTBOX_STORE_FILENAME",{enumerable:!0,get:a(function(){return b2.OUTBOX_STORE_FILENAME},"get")});Object.defineProperty(m,"OUTBOX_REMOTE_ABSENT",{enumerable:!0,get:a(function(){return b2.OUTBOX_REMOTE_ABSENT},"get")});var Ea=yF();Object.defineProperty(m,"ASSET_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return Ea.ASSET_SPACE_CLASS_UID},"get")});Object.defineProperty(m,"SYNC_BRANCH",{enumerable:!0,get:a(function(){return Ea.SYNC_BRANCH},"get")});Object.defineProperty(m,"SpaceSpecAccumulator",{enumerable:!0,get:a(function(){return Ea.SpaceSpecAccumulator},"get")});Object.defineProperty(m,"classifySpaceDeclaration",{enumerable:!0,get:a(function(){return Ea.classifySpaceDeclaration},"get")});Object.defineProperty(m,"isAssetSpaceFrontmatter",{enumerable:!0,get:a(function(){return Ea.isAssetSpaceFrontmatter},"get")});Object.defineProperty(m,"isFileSpaceFrontmatter",{enumerable:!0,get:a(function(){return Ea.isFileSpaceFrontmatter},"get")});Object.defineProperty(m,"parseStrictGitHubRepoURL",{enumerable:!0,get:a(function(){return Ea.parseStrictGitHubRepoURL},"get")});Object.defineProperty(m,"readSpaceSource",{enumerable:!0,get:a(function(){return Ea.readSpaceSource},"get")});var pD=EF();Object.defineProperty(m,"ParityValidator",{enumerable:!0,get:a(function(){return pD.ParityValidator},"get")});Object.defineProperty(m,"summarizeParityRound",{enumerable:!0,get:a(function(){return pD.summarizeParityRound},"get")});var mD=QT();Object.defineProperty(m,"compareAssetSemantics",{enumerable:!0,get:a(function(){return mD.compareAssetSemantics},"get")});Object.defineProperty(m,"isFormatOnlyDrift",{enumerable:!0,get:a(function(){return mD.isFormatOnlyDrift},"get")});ni(LF(),m)});var Pr=w(_2=>{"use strict";_2.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})};_2.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 yD=w((s_e,gD)=>{var Ta=require("constants"),NX=process.cwd,zy=null,kX=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return zy||(zy=NX.call(process)),zy};try{process.cwd()}catch{}typeof process.chdir=="function"&&(S2=process.chdir,process.chdir=function(n){zy=null,S2.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,S2));var S2;gD.exports=MX;function MX(n){Ta.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=o(n.chownSync),n.fchownSync=o(n.fchownSync),n.lchownSync=o(n.lchownSync),n.chmodSync=i(n.chmodSync),n.fchmodSync=i(n.fchmodSync),n.lchmodSync=i(n.lchmodSync),n.stat=c(n.stat),n.fstat=c(n.fstat),n.lstat=c(n.lstat),n.statSync=l(n.statSync),n.fstatSync=l(n.fstatSync),n.lstatSync=l(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(f,d,h){h&&process.nextTick(h)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(f,d,h,p){p&&process.nextTick(p)},n.lchownSync=function(){}),kX==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function d(h,p,g){var y=Date.now(),b=0;f(h,p,a(function S(v){if(v&&(v.code==="EACCES"||v.code==="EPERM"||v.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){n.stat(p,function(I,A){I&&I.code==="ENOENT"?f(h,p,S):g(v)})},b),b<100&&(b+=10);return}g&&g(v)},"CB"))}return a(d,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(n.rename)),n.read=typeof n.read!="function"?n.read:(function(f){function d(h,p,g,y,b,S){var v;if(S&&typeof S=="function"){var I=0;v=a(function(A,T,R){if(A&&A.code==="EAGAIN"&&I<10)return I++,f.call(n,h,p,g,y,b,v);S.apply(this,arguments)},"callback")}return f.call(n,h,p,g,y,b,v)}return a(d,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:(function(f){return function(d,h,p,g,y){for(var b=0;;)try{return f.call(n,d,h,p,g,y)}catch(S){if(S.code==="EAGAIN"&&b<10){b++;continue}throw S}}})(n.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,Ta.O_WRONLY|Ta.O_SYMLINK,h,function(g,y){if(g){p&&p(g);return}f.fchmod(y,h,function(b){f.close(y,function(S){p&&p(b||S)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,Ta.O_WRONLY|Ta.O_SYMLINK,h),g=!0,y;try{y=f.fchmodSync(p,h),g=!1}finally{if(g)try{f.closeSync(p)}catch{}else f.closeSync(p)}return y}}a(e,"patchLchmod");function t(f){Ta.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,g){f.open(d,Ta.O_SYMLINK,function(y,b){if(y){g&&g(y);return}f.futimes(b,h,p,function(S){f.close(b,function(v){g&&g(S||v)})})})},f.lutimesSync=function(d,h,p){var g=f.openSync(d,Ta.O_SYMLINK),y,b=!0;try{y=f.futimesSync(g,h,p),b=!1}finally{if(b)try{f.closeSync(g)}catch{}else f.closeSync(g)}return y}):f.futimes&&(f.lutimes=function(d,h,p,g){g&&process.nextTick(g)},f.lutimesSync=function(){})}a(t,"patchLutimes");function r(f){return f&&function(d,h,p){return f.call(n,d,h,function(g){u(g)&&(g=null),p&&p.apply(this,arguments)})}}a(r,"chmodFix");function i(f){return f&&function(d,h){try{return f.call(n,d,h)}catch(p){if(!u(p))throw p}}}a(i,"chmodFixSync");function s(f){return f&&function(d,h,p,g){return f.call(n,d,h,p,function(y){u(y)&&(y=null),g&&g.apply(this,arguments)})}}a(s,"chownFix");function o(f){return f&&function(d,h,p){try{return f.call(n,d,h,p)}catch(g){if(!u(g))throw g}}}a(o,"chownFixSync");function c(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function g(y,b){b&&(b.uid<0&&(b.uid+=4294967296),b.gid<0&&(b.gid+=4294967296)),p&&p.apply(this,arguments)}return a(g,"callback"),h?f.call(n,d,h,g):f.call(n,d,g)}}a(c,"statFix");function l(f){return f&&function(d,h){var p=h?f.call(n,d,h):f.call(n,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}a(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}a(u,"chownErOk")}a(MX,"patch")});var SD=w((a_e,_D)=>{var bD=require("stream").Stream;_D.exports=jX;function jX(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);bD.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 o=Object.keys(i),c=0,l=o.length;c<l;c++){var u=o[c];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}n.open(this.path,this.flags,this.mode,function(f,d){if(f){s.emit("error",f),s.readable=!1;return}s.fd=d,s.emit("open",d),s._read()})}function t(r,i){if(!(this instanceof t))return new t(r,i);bD.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),o=0,c=s.length;o<c;o++){var l=s[o];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}a(jX,"legacy")});var vD=w((l_e,wD)=>{"use strict";wD.exports=UX;var $X=Object.getPrototypeOf||function(n){return n.__proto__};function UX(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:$X(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}a(UX,"clone")});var bu=w((f_e,E2)=>{var qt=require("fs"),BX=yD(),VX=SD(),qX=vD(),Ky=require("util"),Hr,Qy;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Hr=Symbol.for("graceful-fs.queue"),Qy=Symbol.for("graceful-fs.previous")):(Hr="___graceful-fs.queue",Qy="___graceful-fs.previous");function GX(){}a(GX,"noop");function AD(n,e){Object.defineProperty(n,Hr,{get:a(function(){return e},"get")})}a(AD,"publishQueue");var Cc=GX;Ky.debuglog?Cc=Ky.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Cc=a(function(){var n=Ky.format.apply(Ky,arguments);n="GFS4: "+n.split(/\n/).join(`
|
|
326
|
-
GFS4: `),console.error(n)},"debug"));qt[Hr]||(ED=global[Hr]||[],AD(qt,ED),qt.close=(function(n){function e(t,r){return n.call(qt,t,function(i){i||TD(),typeof r=="function"&&r.apply(this,arguments)})}return a(e,"close"),Object.defineProperty(e,Qy,{value:n}),e})(qt.close),qt.closeSync=(function(n){function e(t){n.apply(qt,arguments),TD()}return a(e,"closeSync"),Object.defineProperty(e,Qy,{value:n}),e})(qt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Cc(qt[Hr]),require("assert").equal(qt[Hr].length,0)}));var ED;global[Hr]||AD(global,qt[Hr]);E2.exports=w2(qX(qt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!qt.__patched&&(E2.exports=w2(qt),qt.__patched=!0);function w2(n){BX(n),n.gracefulify=w2,n.createReadStream=T,n.createWriteStream=R;var e=n.readFile;n.readFile=t;function t(P,k,O){return typeof k=="function"&&(O=k,k=null),J(P,k,O);function J(re,Y,ye,de){return e(re,Y,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?yu([J,[re,Y,ye],le,de||Date.now(),Date.now()]):typeof ye=="function"&&ye.apply(this,arguments)})}a(J,"go$readFile")}a(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(P,k,O,J){return typeof O=="function"&&(J=O,O=null),re(P,k,O,J);function re(Y,ye,de,le,q){return r(Y,ye,de,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?yu([re,[Y,ye,de,le],M,q||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}a(re,"go$writeFile")}a(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=o);function o(P,k,O,J){return typeof O=="function"&&(J=O,O=null),re(P,k,O,J);function re(Y,ye,de,le,q){return s(Y,ye,de,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?yu([re,[Y,ye,de,le],M,q||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}a(re,"go$appendFile")}a(o,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(P,k,O,J){return typeof O=="function"&&(J=O,O=0),re(P,k,O,J);function re(Y,ye,de,le,q){return c(Y,ye,de,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?yu([re,[Y,ye,de,le],M,q||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}a(re,"go$copyFile")}a(l,"copyFile");var u=n.readdir;n.readdir=d;var f=/^v[0-5]\./;function d(P,k,O){typeof k=="function"&&(O=k,k=null);var J=f.test(process.version)?a(function(ye,de,le,q){return u(ye,re(ye,de,le,q))},"go$readdir"):a(function(ye,de,le,q){return u(ye,de,re(ye,de,le,q))},"go$readdir");return J(P,k,O);function re(Y,ye,de,le){return function(q,M){q&&(q.code==="EMFILE"||q.code==="ENFILE")?yu([J,[Y,ye,de],q,le||Date.now(),Date.now()]):(M&&M.sort&&M.sort(),typeof de=="function"&&de.call(this,q,M))}}}if(a(d,"readdir"),process.version.substr(0,4)==="v0.8"){var h=VX(n);S=h.ReadStream,I=h.WriteStream}var p=n.ReadStream;p&&(S.prototype=Object.create(p.prototype),S.prototype.open=v);var g=n.WriteStream;g&&(I.prototype=Object.create(g.prototype),I.prototype.open=A),Object.defineProperty(n,"ReadStream",{get:a(function(){return S},"get"),set:a(function(P){S=P},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:a(function(){return I},"get"),set:a(function(P){I=P},"set"),enumerable:!0,configurable:!0});var y=S;Object.defineProperty(n,"FileReadStream",{get:a(function(){return y},"get"),set:a(function(P){y=P},"set"),enumerable:!0,configurable:!0});var b=I;Object.defineProperty(n,"FileWriteStream",{get:a(function(){return b},"get"),set:a(function(P){b=P},"set"),enumerable:!0,configurable:!0});function S(P,k){return this instanceof S?(p.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}a(S,"ReadStream");function v(){var P=this;L(P.path,P.flags,P.mode,function(k,O){k?(P.autoClose&&P.destroy(),P.emit("error",k)):(P.fd=O,P.emit("open",O),P.read())})}a(v,"ReadStream$open");function I(P,k){return this instanceof I?(g.apply(this,arguments),this):I.apply(Object.create(I.prototype),arguments)}a(I,"WriteStream");function A(){var P=this;L(P.path,P.flags,P.mode,function(k,O){k?(P.destroy(),P.emit("error",k)):(P.fd=O,P.emit("open",O))})}a(A,"WriteStream$open");function T(P,k){return new n.ReadStream(P,k)}a(T,"createReadStream");function R(P,k){return new n.WriteStream(P,k)}a(R,"createWriteStream");var V=n.open;n.open=L;function L(P,k,O,J){return typeof O=="function"&&(J=O,O=null),re(P,k,O,J);function re(Y,ye,de,le,q){return V(Y,ye,de,function(M,je){M&&(M.code==="EMFILE"||M.code==="ENFILE")?yu([re,[Y,ye,de,le],M,q||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}a(re,"go$open")}return a(L,"open"),n}a(w2,"patch");function yu(n){Cc("ENQUEUE",n[0].name,n[1]),qt[Hr].push(n),v2()}a(yu,"enqueue");var Yy;function TD(){for(var n=Date.now(),e=0;e<qt[Hr].length;++e)qt[Hr][e].length>2&&(qt[Hr][e][3]=n,qt[Hr][e][4]=n);v2()}a(TD,"resetQueue");function v2(){if(clearTimeout(Yy),Yy=void 0,qt[Hr].length!==0){var n=qt[Hr].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Cc("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Cc("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,r)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Cc("RETRY",e.name,t),e.apply(null,t.concat([i]))):qt[Hr].push(n)}Yy===void 0&&(Yy=setTimeout(v2,0))}}a(v2,"retry")});var Sn=w(Do=>{"use strict";var ID=Pr().fromCallback,_n=bu(),WX=["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 _n[n]=="function");Object.assign(Do,_n);WX.forEach(n=>{Do[n]=ID(_n[n])});Do.exists=function(n,e){return typeof e=="function"?_n.exists(n,e):new Promise(t=>_n.exists(n,t))};Do.read=function(n,e,t,r,i,s){return typeof s=="function"?_n.read(n,e,t,r,i,s):new Promise((o,c)=>{_n.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);o({bytesRead:u,buffer:f})})})};Do.write=function(n,e,...t){return typeof t[t.length-1]=="function"?_n.write(n,e,...t):new Promise((r,i)=>{_n.write(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesWritten:o,buffer:c})})})};Do.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?_n.readv(n,e,...t):new Promise((r,i)=>{_n.readv(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesRead:o,buffers:c})})})};Do.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?_n.writev(n,e,...t):new Promise((r,i)=>{_n.writev(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesWritten:o,buffers:c})})})};typeof _n.realpath.native=="function"?Do.realpath.native=ID(_n.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var RD=w((p_e,xD)=>{"use strict";var HX=require("path");xD.exports.checkPath=a(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(HX.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var FD=w((g_e,T2)=>{"use strict";var CD=Sn(),{checkPath:OD}=RD(),PD=a(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");T2.exports.makeDir=async(n,e)=>(OD(n),CD.mkdir(n,{mode:PD(e),recursive:!0}));T2.exports.makeDirSync=(n,e)=>(OD(n),CD.mkdirSync(n,{mode:PD(e),recursive:!0}))});var Zi=w((b_e,DD)=>{"use strict";var zX=Pr().fromPromise,{makeDir:KX,makeDirSync:A2}=FD(),I2=zX(KX);DD.exports={mkdirs:I2,mkdirsSync:A2,mkdirp:I2,mkdirpSync:A2,ensureDir:I2,ensureDirSync:A2}});var Aa=w((__e,ND)=>{"use strict";var YX=Pr().fromPromise,LD=Sn();function QX(n){return LD.access(n).then(()=>!0).catch(()=>!1)}a(QX,"pathExists");ND.exports={pathExists:YX(QX),pathExistsSync:LD.existsSync}});var x2=w((w_e,kD)=>{"use strict";var _u=Sn(),XX=Pr().fromPromise;async function JX(n,e,t){let r=await _u.open(n,"r+"),i=null;try{await _u.futimes(r,e,t)}finally{try{await _u.close(r)}catch(s){i=s}}if(i)throw i}a(JX,"utimesMillis");function ZX(n,e,t){let r=_u.openSync(n,"r+");return _u.futimesSync(r,e,t),_u.closeSync(r)}a(ZX,"utimesMillisSync");kD.exports={utimesMillis:XX(JX),utimesMillisSync:ZX}});var Oc=w((E_e,UD)=>{"use strict";var Su=Sn(),Fr=require("path"),MD=Pr().fromPromise;function eJ(n,e,t){let r=t.dereference?i=>Su.stat(i,{bigint:!0}):i=>Su.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}))}a(eJ,"getStats");function tJ(n,e,t){let r,i=t.dereference?o=>Su.statSync(o,{bigint:!0}):o=>Su.lstatSync(o,{bigint:!0}),s=i(n);try{r=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:r}}a(tJ,"getStatsSync");async function rJ(n,e,t,r){let{srcStat:i,destStat:s}=await eJ(n,e,r);if(s){if(kd(i,s)){let o=Fr.basename(n),c=Fr.basename(e);if(t==="move"&&o!==c&&o.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()&&R2(n,e))throw new Error(Xy(n,e,t));return{srcStat:i,destStat:s}}a(rJ,"checkPaths");function nJ(n,e,t,r){let{srcStat:i,destStat:s}=tJ(n,e,r);if(s){if(kd(i,s)){let o=Fr.basename(n),c=Fr.basename(e);if(t==="move"&&o!==c&&o.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()&&R2(n,e))throw new Error(Xy(n,e,t));return{srcStat:i,destStat:s}}a(nJ,"checkPathsSync");async function jD(n,e,t,r){let i=Fr.resolve(Fr.dirname(n)),s=Fr.resolve(Fr.dirname(t));if(s===i||s===Fr.parse(s).root)return;let o;try{o=await Su.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(kd(e,o))throw new Error(Xy(n,t,r));return jD(n,e,s,r)}a(jD,"checkParentPaths");function $D(n,e,t,r){let i=Fr.resolve(Fr.dirname(n)),s=Fr.resolve(Fr.dirname(t));if(s===i||s===Fr.parse(s).root)return;let o;try{o=Su.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(kd(e,o))throw new Error(Xy(n,t,r));return $D(n,e,s,r)}a($D,"checkParentPathsSync");function kd(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}a(kd,"areIdentical");function R2(n,e){let t=Fr.resolve(n).split(Fr.sep).filter(i=>i),r=Fr.resolve(e).split(Fr.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}a(R2,"isSrcSubdir");function Xy(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}a(Xy,"errMsg");UD.exports={checkPaths:MD(rJ),checkPathsSync:nJ,checkParentPaths:MD(jD),checkParentPathsSync:$D,isSrcSubdir:R2,areIdentical:kd}});var VD=w((A_e,BD)=>{"use strict";async function iJ(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})))}a(iJ,"asyncIteratorConcurrentProcess");BD.exports={asyncIteratorConcurrentProcess:iJ}});var zD=w((x_e,HD)=>{"use strict";var rn=Sn(),Md=require("path"),{mkdirs:sJ}=Zi(),{pathExists:oJ}=Aa(),{utimesMillis:aJ}=x2(),jd=Oc(),{asyncIteratorConcurrentProcess:cJ}=VD();async function lJ(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;
|
|
326
|
+
GFS4: `),console.error(n)},"debug"));qt[Hr]||(ED=global[Hr]||[],AD(qt,ED),qt.close=(function(n){function e(t,r){return n.call(qt,t,function(i){i||TD(),typeof r=="function"&&r.apply(this,arguments)})}return a(e,"close"),Object.defineProperty(e,Qy,{value:n}),e})(qt.close),qt.closeSync=(function(n){function e(t){n.apply(qt,arguments),TD()}return a(e,"closeSync"),Object.defineProperty(e,Qy,{value:n}),e})(qt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Cc(qt[Hr]),require("assert").equal(qt[Hr].length,0)}));var ED;global[Hr]||AD(global,qt[Hr]);E2.exports=w2(qX(qt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!qt.__patched&&(E2.exports=w2(qt),qt.__patched=!0);function w2(n){BX(n),n.gracefulify=w2,n.createReadStream=T,n.createWriteStream=R;var e=n.readFile;n.readFile=t;function t(P,k,O){return typeof k=="function"&&(O=k,k=null),J(P,k,O);function J(re,Y,ye,de){return e(re,Y,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?yu([J,[re,Y,ye],le,de||Date.now(),Date.now()]):typeof ye=="function"&&ye.apply(this,arguments)})}a(J,"go$readFile")}a(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(P,k,O,J){return typeof O=="function"&&(J=O,O=null),re(P,k,O,J);function re(Y,ye,de,le,q){return r(Y,ye,de,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?yu([re,[Y,ye,de,le],M,q||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}a(re,"go$writeFile")}a(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=o);function o(P,k,O,J){return typeof O=="function"&&(J=O,O=null),re(P,k,O,J);function re(Y,ye,de,le,q){return s(Y,ye,de,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?yu([re,[Y,ye,de,le],M,q||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}a(re,"go$appendFile")}a(o,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(P,k,O,J){return typeof O=="function"&&(J=O,O=0),re(P,k,O,J);function re(Y,ye,de,le,q){return c(Y,ye,de,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?yu([re,[Y,ye,de,le],M,q||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}a(re,"go$copyFile")}a(l,"copyFile");var u=n.readdir;n.readdir=d;var f=/^v[0-5]\./;function d(P,k,O){typeof k=="function"&&(O=k,k=null);var J=f.test(process.version)?a(function(ye,de,le,q){return u(ye,re(ye,de,le,q))},"go$readdir"):a(function(ye,de,le,q){return u(ye,de,re(ye,de,le,q))},"go$readdir");return J(P,k,O);function re(Y,ye,de,le){return function(q,M){q&&(q.code==="EMFILE"||q.code==="ENFILE")?yu([J,[Y,ye,de],q,le||Date.now(),Date.now()]):(M&&M.sort&&M.sort(),typeof de=="function"&&de.call(this,q,M))}}}if(a(d,"readdir"),process.version.substr(0,4)==="v0.8"){var h=VX(n);S=h.ReadStream,I=h.WriteStream}var p=n.ReadStream;p&&(S.prototype=Object.create(p.prototype),S.prototype.open=v);var g=n.WriteStream;g&&(I.prototype=Object.create(g.prototype),I.prototype.open=A),Object.defineProperty(n,"ReadStream",{get:a(function(){return S},"get"),set:a(function(P){S=P},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:a(function(){return I},"get"),set:a(function(P){I=P},"set"),enumerable:!0,configurable:!0});var y=S;Object.defineProperty(n,"FileReadStream",{get:a(function(){return y},"get"),set:a(function(P){y=P},"set"),enumerable:!0,configurable:!0});var b=I;Object.defineProperty(n,"FileWriteStream",{get:a(function(){return b},"get"),set:a(function(P){b=P},"set"),enumerable:!0,configurable:!0});function S(P,k){return this instanceof S?(p.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}a(S,"ReadStream");function v(){var P=this;L(P.path,P.flags,P.mode,function(k,O){k?(P.autoClose&&P.destroy(),P.emit("error",k)):(P.fd=O,P.emit("open",O),P.read())})}a(v,"ReadStream$open");function I(P,k){return this instanceof I?(g.apply(this,arguments),this):I.apply(Object.create(I.prototype),arguments)}a(I,"WriteStream");function A(){var P=this;L(P.path,P.flags,P.mode,function(k,O){k?(P.destroy(),P.emit("error",k)):(P.fd=O,P.emit("open",O))})}a(A,"WriteStream$open");function T(P,k){return new n.ReadStream(P,k)}a(T,"createReadStream");function R(P,k){return new n.WriteStream(P,k)}a(R,"createWriteStream");var V=n.open;n.open=L;function L(P,k,O,J){return typeof O=="function"&&(J=O,O=null),re(P,k,O,J);function re(Y,ye,de,le,q){return V(Y,ye,de,function(M,je){M&&(M.code==="EMFILE"||M.code==="ENFILE")?yu([re,[Y,ye,de,le],M,q||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}a(re,"go$open")}return a(L,"open"),n}a(w2,"patch");function yu(n){Cc("ENQUEUE",n[0].name,n[1]),qt[Hr].push(n),v2()}a(yu,"enqueue");var Yy;function TD(){for(var n=Date.now(),e=0;e<qt[Hr].length;++e)qt[Hr][e].length>2&&(qt[Hr][e][3]=n,qt[Hr][e][4]=n);v2()}a(TD,"resetQueue");function v2(){if(clearTimeout(Yy),Yy=void 0,qt[Hr].length!==0){var n=qt[Hr].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Cc("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Cc("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,r)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Cc("RETRY",e.name,t),e.apply(null,t.concat([i]))):qt[Hr].push(n)}Yy===void 0&&(Yy=setTimeout(v2,0))}}a(v2,"retry")});var Sn=w(Do=>{"use strict";var ID=Pr().fromCallback,_n=bu(),WX=["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 _n[n]=="function");Object.assign(Do,_n);WX.forEach(n=>{Do[n]=ID(_n[n])});Do.exists=function(n,e){return typeof e=="function"?_n.exists(n,e):new Promise(t=>_n.exists(n,t))};Do.read=function(n,e,t,r,i,s){return typeof s=="function"?_n.read(n,e,t,r,i,s):new Promise((o,c)=>{_n.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);o({bytesRead:u,buffer:f})})})};Do.write=function(n,e,...t){return typeof t[t.length-1]=="function"?_n.write(n,e,...t):new Promise((r,i)=>{_n.write(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesWritten:o,buffer:c})})})};Do.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?_n.readv(n,e,...t):new Promise((r,i)=>{_n.readv(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesRead:o,buffers:c})})})};Do.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?_n.writev(n,e,...t):new Promise((r,i)=>{_n.writev(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesWritten:o,buffers:c})})})};typeof _n.realpath.native=="function"?Do.realpath.native=ID(_n.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var RD=w((p_e,xD)=>{"use strict";var HX=require("path");xD.exports.checkPath=a(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(HX.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var FD=w((g_e,T2)=>{"use strict";var CD=Sn(),{checkPath:OD}=RD(),PD=a(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");T2.exports.makeDir=async(n,e)=>(OD(n),CD.mkdir(n,{mode:PD(e),recursive:!0}));T2.exports.makeDirSync=(n,e)=>(OD(n),CD.mkdirSync(n,{mode:PD(e),recursive:!0}))});var Zi=w((b_e,DD)=>{"use strict";var zX=Pr().fromPromise,{makeDir:KX,makeDirSync:A2}=FD(),I2=zX(KX);DD.exports={mkdirs:I2,mkdirsSync:A2,mkdirp:I2,mkdirpSync:A2,ensureDir:I2,ensureDirSync:A2}});var Aa=w((__e,ND)=>{"use strict";var YX=Pr().fromPromise,LD=Sn();function QX(n){return LD.access(n).then(()=>!0).catch(()=>!1)}a(QX,"pathExists");ND.exports={pathExists:YX(QX),pathExistsSync:LD.existsSync}});var x2=w((w_e,kD)=>{"use strict";var _u=Sn(),XX=Pr().fromPromise;async function JX(n,e,t){let r=await _u.open(n,"r+"),i=null;try{await _u.futimes(r,e,t)}finally{try{await _u.close(r)}catch(s){i=s}}if(i)throw i}a(JX,"utimesMillis");function ZX(n,e,t){let r=_u.openSync(n,"r+");return _u.futimesSync(r,e,t),_u.closeSync(r)}a(ZX,"utimesMillisSync");kD.exports={utimesMillis:XX(JX),utimesMillisSync:ZX}});var Oc=w((E_e,UD)=>{"use strict";var Su=Sn(),Fr=require("path"),MD=Pr().fromPromise;function eJ(n,e,t){let r=t.dereference?i=>Su.stat(i,{bigint:!0}):i=>Su.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}))}a(eJ,"getStats");function tJ(n,e,t){let r,i=t.dereference?o=>Su.statSync(o,{bigint:!0}):o=>Su.lstatSync(o,{bigint:!0}),s=i(n);try{r=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:r}}a(tJ,"getStatsSync");async function rJ(n,e,t,r){let{srcStat:i,destStat:s}=await eJ(n,e,r);if(s){if(kd(i,s)){let o=Fr.basename(n),c=Fr.basename(e);if(t==="move"&&o!==c&&o.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()&&R2(n,e))throw new Error(Xy(n,e,t));return{srcStat:i,destStat:s}}a(rJ,"checkPaths");function nJ(n,e,t,r){let{srcStat:i,destStat:s}=tJ(n,e,r);if(s){if(kd(i,s)){let o=Fr.basename(n),c=Fr.basename(e);if(t==="move"&&o!==c&&o.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()&&R2(n,e))throw new Error(Xy(n,e,t));return{srcStat:i,destStat:s}}a(nJ,"checkPathsSync");async function jD(n,e,t,r){let i=Fr.resolve(Fr.dirname(n)),s=Fr.resolve(Fr.dirname(t));if(s===i||s===Fr.parse(s).root)return;let o;try{o=await Su.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(kd(e,o))throw new Error(Xy(n,t,r));return jD(n,e,s,r)}a(jD,"checkParentPaths");function $D(n,e,t,r){let i=Fr.resolve(Fr.dirname(n)),s=Fr.resolve(Fr.dirname(t));if(s===i||s===Fr.parse(s).root)return;let o;try{o=Su.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(kd(e,o))throw new Error(Xy(n,t,r));return $D(n,e,s,r)}a($D,"checkParentPathsSync");function kd(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}a(kd,"areIdentical");function R2(n,e){let t=Fr.resolve(n).split(Fr.sep).filter(i=>i),r=Fr.resolve(e).split(Fr.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}a(R2,"isSrcSubdir");function Xy(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}a(Xy,"errMsg");UD.exports={checkPaths:MD(rJ),checkPathsSync:nJ,checkParentPaths:MD(jD),checkParentPathsSync:$D,isSrcSubdir:R2,areIdentical:kd}});var VD=w((A_e,BD)=>{"use strict";async function iJ(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})))}a(iJ,"asyncIteratorConcurrentProcess");BD.exports={asyncIteratorConcurrentProcess:iJ}});var zD=w((x_e,HD)=>{"use strict";var nn=Sn(),Md=require("path"),{mkdirs:sJ}=Zi(),{pathExists:oJ}=Aa(),{utimesMillis:aJ}=x2(),jd=Oc(),{asyncIteratorConcurrentProcess:cJ}=VD();async function lJ(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;
|
|
327
327
|
|
|
328
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await jd.checkPaths(n,e,"copy",t);if(await jd.checkParentPaths(n,r,e,"copy"),!await GD(n,e,t))return;let o=Md.dirname(e);await oJ(o)||await sJ(o),await WD(i,n,e,t)}a(lJ,"copy");async function GD(n,e,t){return t.filter?t.filter(n,e):!0}a(GD,"runFilter");async function WD(n,e,t,r){let s=await(r.dereference?
|
|
328
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await jd.checkPaths(n,e,"copy",t);if(await jd.checkParentPaths(n,r,e,"copy"),!await GD(n,e,t))return;let o=Md.dirname(e);await oJ(o)||await sJ(o),await WD(i,n,e,t)}a(lJ,"copy");async function GD(n,e,t){return t.filter?t.filter(n,e):!0}a(GD,"runFilter");async function WD(n,e,t,r){let s=await(r.dereference?nn.stat:nn.lstat)(e);if(s.isDirectory())return hJ(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return uJ(s,n,e,t,r);if(s.isSymbolicLink())return pJ(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}`)}a(WD,"getStatsAndPerformCopy");async function uJ(n,e,t,r,i){if(!e)return qD(n,t,r,i);if(i.overwrite)return await nn.unlink(r),qD(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}a(uJ,"onFile");async function qD(n,e,t,r){if(await nn.copyFile(e,t),r.preserveTimestamps){fJ(n.mode)&&await dJ(t,n.mode);let i=await nn.stat(e);await aJ(t,i.atime,i.mtime)}return nn.chmod(t,n.mode)}a(qD,"copyFile");function fJ(n){return(n&128)===0}a(fJ,"fileIsNotWritable");function dJ(n,e){return nn.chmod(n,e|128)}a(dJ,"makeFileWritable");async function hJ(n,e,t,r,i){e||await nn.mkdir(r),await cJ(await nn.opendir(t),async s=>{let o=Md.join(t,s.name),c=Md.join(r,s.name);if(await GD(o,c,i)){let{destStat:u}=await jd.checkPaths(o,c,"copy",i);await WD(u,o,c,i)}}),e||await nn.chmod(r,n.mode)}a(hJ,"onDir");async function pJ(n,e,t,r){let i=await nn.readlink(e);if(r.dereference&&(i=Md.resolve(process.cwd(),i)),!n)return nn.symlink(i,t);let s=null;try{s=await nn.readlink(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return nn.symlink(i,t);throw o}if(r.dereference&&(s=Md.resolve(process.cwd(),s)),jd.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(jd.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await nn.unlink(t),nn.symlink(i,t)}a(pJ,"onLink");HD.exports=lJ});var JD=w((C_e,XD)=>{"use strict";var wn=bu(),$d=require("path"),mJ=Zi().mkdirsSync,gJ=x2().utimesMillisSync,Ud=Oc();function yJ(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;
|
|
329
329
|
|
|
330
330
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=Ud.checkPathsSync(n,e,"copy",t);if(Ud.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=$d.dirname(e);return wn.existsSync(s)||mJ(s),KD(i,n,e,t)}a(yJ,"copySync");function KD(n,e,t,r){let s=(r.dereference?wn.statSync:wn.lstatSync)(e);if(s.isDirectory())return TJ(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return bJ(s,n,e,t,r);if(s.isSymbolicLink())return xJ(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}`)}a(KD,"getStats");function bJ(n,e,t,r,i){return e?_J(n,t,r,i):YD(n,t,r,i)}a(bJ,"onFile");function _J(n,e,t,r){if(r.overwrite)return wn.unlinkSync(t),YD(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}a(_J,"mayCopyFile");function YD(n,e,t,r){return wn.copyFileSync(e,t),r.preserveTimestamps&&SJ(n.mode,e,t),C2(t,n.mode)}a(YD,"copyFile");function SJ(n,e,t){return wJ(n)&&vJ(t,n),EJ(e,t)}a(SJ,"handleTimestamps");function wJ(n){return(n&128)===0}a(wJ,"fileIsNotWritable");function vJ(n,e){return C2(n,e|128)}a(vJ,"makeFileWritable");function C2(n,e){return wn.chmodSync(n,e)}a(C2,"setDestMode");function EJ(n,e){let t=wn.statSync(n);return gJ(e,t.atime,t.mtime)}a(EJ,"setDestTimestamps");function TJ(n,e,t,r,i){return e?QD(t,r,i):AJ(n.mode,t,r,i)}a(TJ,"onDir");function AJ(n,e,t,r){return wn.mkdirSync(t),QD(e,t,r),C2(t,n)}a(AJ,"mkDirAndCopy");function QD(n,e,t){let r=wn.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)IJ(i.name,n,e,t)}finally{r.closeSync()}}a(QD,"copyDir");function IJ(n,e,t,r){let i=$d.join(e,n),s=$d.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:o}=Ud.checkPathsSync(i,s,"copy",r);return KD(o,i,s,r)}a(IJ,"copyDirItem");function xJ(n,e,t,r){let i=wn.readlinkSync(e);if(r.dereference&&(i=$d.resolve(process.cwd(),i)),n){let s;try{s=wn.readlinkSync(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return wn.symlinkSync(i,t);throw o}if(r.dereference&&(s=$d.resolve(process.cwd(),s)),Ud.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Ud.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return RJ(i,t)}else return wn.symlinkSync(i,t)}a(xJ,"onLink");function RJ(n,e){return wn.unlinkSync(e),wn.symlinkSync(n,e)}a(RJ,"copyLink");XD.exports=yJ});var Jy=w((P_e,ZD)=>{"use strict";var CJ=Pr().fromPromise;ZD.exports={copy:CJ(zD()),copySync:JD()}});var Bd=w((F_e,tL)=>{"use strict";var eL=bu(),OJ=Pr().fromCallback;function PJ(n,e){eL.rm(n,{recursive:!0,force:!0},e)}a(PJ,"remove");function FJ(n){eL.rmSync(n,{recursive:!0,force:!0})}a(FJ,"removeSync");tL.exports={remove:OJ(PJ),removeSync:FJ}});var lL=w((L_e,cL)=>{"use strict";var DJ=Pr().fromPromise,iL=Sn(),sL=require("path"),oL=Zi(),aL=Bd(),rL=DJ(a(async function(e){let t;try{t=await iL.readdir(e)}catch{return oL.mkdirs(e)}return Promise.all(t.map(r=>aL.remove(sL.join(e,r))))},"emptyDir"));function nL(n){let e;try{e=iL.readdirSync(n)}catch{return oL.mkdirsSync(n)}e.forEach(t=>{t=sL.join(n,t),aL.removeSync(t)})}a(nL,"emptyDirSync");cL.exports={emptyDirSync:nL,emptydirSync:nL,emptyDir:rL,emptydir:rL}});var hL=w((k_e,dL)=>{"use strict";var LJ=Pr().fromPromise,uL=require("path"),Lo=Sn(),fL=Zi();async function NJ(n){let e;try{e=await Lo.stat(n)}catch{}if(e&&e.isFile())return;let t=uL.dirname(n),r=null;try{r=await Lo.stat(t)}catch(i){if(i.code==="ENOENT"){await fL.mkdirs(t),await Lo.writeFile(n,"");return}else throw i}r.isDirectory()?await Lo.writeFile(n,""):await Lo.readdir(t)}a(NJ,"createFile");function kJ(n){let e;try{e=Lo.statSync(n)}catch{}if(e&&e.isFile())return;let t=uL.dirname(n);try{Lo.statSync(t).isDirectory()||Lo.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")fL.mkdirsSync(t);else throw r}Lo.writeFileSync(n,"")}a(kJ,"createFileSync");dL.exports={createFile:LJ(NJ),createFileSync:kJ}});var bL=w((j_e,yL)=>{"use strict";var MJ=Pr().fromPromise,pL=require("path"),Ia=Sn(),mL=Zi(),{pathExists:jJ}=Aa(),{areIdentical:gL}=Oc();async function $J(n,e){let t;try{t=await Ia.lstat(e)}catch{}let r;try{r=await Ia.lstat(n)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(t&&gL(r,t))return;let i=pL.dirname(e);await jJ(i)||await mL.mkdirs(i),await Ia.link(n,e)}a($J,"createLink");function UJ(n,e){let t;try{t=Ia.lstatSync(e)}catch{}try{let s=Ia.lstatSync(n);if(t&&gL(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=pL.dirname(e);return Ia.existsSync(r)||mL.mkdirsSync(r),Ia.linkSync(n,e)}a(UJ,"createLinkSync");yL.exports={createLink:MJ($J),createLinkSync:UJ}});var SL=w((U_e,_L)=>{"use strict";var xa=require("path"),Vd=Sn(),{pathExists:BJ}=Aa(),VJ=Pr().fromPromise;async function qJ(n,e){if(xa.isAbsolute(n)){try{await Vd.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=xa.dirname(e),r=xa.join(t,n);if(await BJ(r))return{toCwd:r,toDst:n};try{await Vd.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:xa.relative(t,n)}}a(qJ,"symlinkPaths");function GJ(n,e){if(xa.isAbsolute(n)){if(!Vd.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=xa.dirname(e),r=xa.join(t,n);if(Vd.existsSync(r))return{toCwd:r,toDst:n};if(!Vd.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:xa.relative(t,n)}}a(GJ,"symlinkPathsSync");_L.exports={symlinkPaths:VJ(qJ),symlinkPathsSync:GJ}});var EL=w((V_e,vL)=>{"use strict";var wL=Sn(),WJ=Pr().fromPromise;async function HJ(n,e){if(e)return e;let t;try{t=await wL.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(HJ,"symlinkType");function zJ(n,e){if(e)return e;let t;try{t=wL.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(zJ,"symlinkTypeSync");vL.exports={symlinkType:WJ(HJ),symlinkTypeSync:zJ}});var xL=w((G_e,IL)=>{"use strict";var KJ=Pr().fromPromise,TL=require("path"),ks=Sn(),{mkdirs:YJ,mkdirsSync:QJ}=Zi(),{symlinkPaths:XJ,symlinkPathsSync:JJ}=SL(),{symlinkType:ZJ,symlinkTypeSync:eZ}=EL(),{pathExists:tZ}=Aa(),{areIdentical:AL}=Oc();async function rZ(n,e,t){let r;try{r=await ks.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([ks.stat(n),ks.stat(e)]);if(AL(c,l))return}let i=await XJ(n,e);n=i.toDst;let s=await ZJ(i.toCwd,t),o=TL.dirname(e);return await tZ(o)||await YJ(o),ks.symlink(n,e,s)}a(rZ,"createSymlink");function nZ(n,e,t){let r;try{r=ks.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=ks.statSync(n),l=ks.statSync(e);if(AL(c,l))return}let i=JJ(n,e);n=i.toDst,t=eZ(i.toCwd,t);let s=TL.dirname(e);return ks.existsSync(s)||QJ(s),ks.symlinkSync(n,e,t)}a(nZ,"createSymlinkSync");IL.exports={createSymlink:KJ(rZ),createSymlinkSync:nZ}});var NL=w((H_e,LL)=>{"use strict";var{createFile:RL,createFileSync:CL}=hL(),{createLink:OL,createLinkSync:PL}=bL(),{createSymlink:FL,createSymlinkSync:DL}=xL();LL.exports={createFile:RL,createFileSync:CL,ensureFile:RL,ensureFileSync:CL,createLink:OL,createLinkSync:PL,ensureLink:OL,ensureLinkSync:PL,createSymlink:FL,createSymlinkSync:DL,ensureSymlink:FL,ensureSymlinkSync:DL}});var Zy=w((z_e,kL)=>{function iZ(n,{EOL:e=`
|
|
331
331
|
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}a(iZ,"stringify");function sZ(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}a(sZ,"stripBom");kL.exports={stringify:iZ,stripBom:sZ}});var UL=w((Y_e,$L)=>{var wu;try{wu=bu()}catch{wu=require("fs")}var e0=Pr(),{stringify:ML,stripBom:jL}=Zy();async function oZ(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||wu,r="throws"in e?e.throws:!0,i=await e0.fromCallback(t.readFile)(n,e);i=jL(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(r)throw o.message=`${n}: ${o.message}`,o;return null}return s}a(oZ,"_readFile");var aZ=e0.fromPromise(oZ);function cZ(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||wu,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=jL(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}a(cZ,"readFileSync");async function lZ(n,e,t={}){let r=t.fs||wu,i=ML(e,t);await e0.fromCallback(r.writeFile)(n,i,t)}a(lZ,"_writeFile");var uZ=e0.fromPromise(lZ);function fZ(n,e,t={}){let r=t.fs||wu,i=ML(e,t);return r.writeFileSync(n,i,t)}a(fZ,"writeFileSync");$L.exports={readFile:aZ,readFileSync:cZ,writeFile:uZ,writeFileSync:fZ}});var VL=w((X_e,BL)=>{"use strict";var t0=UL();BL.exports={readJson:t0.readFile,readJsonSync:t0.readFileSync,writeJson:t0.writeFile,writeJsonSync:t0.writeFileSync}});var r0=w((J_e,WL)=>{"use strict";var dZ=Pr().fromPromise,O2=Sn(),qL=require("path"),GL=Zi(),hZ=Aa().pathExists;async function pZ(n,e,t="utf-8"){let r=qL.dirname(n);return await hZ(r)||await GL.mkdirs(r),O2.writeFile(n,e,t)}a(pZ,"outputFile");function mZ(n,...e){let t=qL.dirname(n);O2.existsSync(t)||GL.mkdirsSync(t),O2.writeFileSync(n,...e)}a(mZ,"outputFileSync");WL.exports={outputFile:dZ(pZ),outputFileSync:mZ}});var zL=w((eSe,HL)=>{"use strict";var{stringify:gZ}=Zy(),{outputFile:yZ}=r0();async function bZ(n,e,t={}){let r=gZ(e,t);await yZ(n,r,t)}a(bZ,"outputJson");HL.exports=bZ});var YL=w((rSe,KL)=>{"use strict";var{stringify:_Z}=Zy(),{outputFileSync:SZ}=r0();function wZ(n,e,t){let r=_Z(e,t);SZ(n,r,t)}a(wZ,"outputJsonSync");KL.exports=wZ});var XL=w((iSe,QL)=>{"use strict";var vZ=Pr().fromPromise,vn=VL();vn.outputJson=vZ(zL());vn.outputJsonSync=YL();vn.outputJSON=vn.outputJson;vn.outputJSONSync=vn.outputJsonSync;vn.writeJSON=vn.writeJson;vn.writeJSONSync=vn.writeJsonSync;vn.readJSON=vn.readJson;vn.readJSONSync=vn.readJsonSync;QL.exports=vn});var rN=w((sSe,tN)=>{"use strict";var EZ=Sn(),JL=require("path"),{copy:TZ}=Jy(),{remove:eN}=Bd(),{mkdirp:AZ}=Zi(),{pathExists:IZ}=Aa(),ZL=Oc();async function xZ(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await ZL.checkPaths(n,e,"move",t);await ZL.checkParentPaths(n,i,e,"move");let o=JL.dirname(e);return JL.parse(o).root!==o&&await AZ(o),RZ(n,e,r,s)}a(xZ,"move");async function RZ(n,e,t,r){if(!r){if(t)await eN(e);else if(await IZ(e))throw new Error("dest already exists.")}try{await EZ.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await CZ(n,e,t)}}a(RZ,"doRename");async function CZ(n,e,t){return await TZ(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),eN(n)}a(CZ,"moveAcrossDevice");tN.exports=xZ});var aN=w((aSe,oN)=>{"use strict";var iN=bu(),F2=require("path"),OZ=Jy().copySync,sN=Bd().removeSync,PZ=Zi().mkdirpSync,nN=Oc();function FZ(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=nN.checkPathsSync(n,e,"move",t);return nN.checkParentPathsSync(n,i,e,"move"),DZ(e)||PZ(F2.dirname(e)),LZ(n,e,r,s)}a(FZ,"moveSync");function DZ(n){let e=F2.dirname(n);return F2.parse(e).root===e}a(DZ,"isParentRoot");function LZ(n,e,t,r){if(r)return P2(n,e,t);if(t)return sN(e),P2(n,e,t);if(iN.existsSync(e))throw new Error("dest already exists.");return P2(n,e,t)}a(LZ,"doRename");function P2(n,e,t){try{iN.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return NZ(n,e,t)}}a(P2,"rename");function NZ(n,e,t){return OZ(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),sN(n)}a(NZ,"moveAcrossDevice");oN.exports=FZ});var lN=w((lSe,cN)=>{"use strict";var kZ=Pr().fromPromise;cN.exports={move:kZ(rN()),moveSync:aN()}});var No=w((uSe,uN)=>{"use strict";uN.exports={...Sn(),...Jy(),...lL(),...NL(),...XL(),...Zi(),...lN(),...r0(),...Aa(),...Bd()}});var bk=w((hSe,yk)=>{"use strict";yk.exports=mk;function mk(n,e,t){n instanceof RegExp&&(n=pk(n,t)),e instanceof RegExp&&(e=pk(e,t));var r=gk(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)}}a(mk,"balanced");function pk(n,e){var t=e.match(n);return t?t[0]:null}a(pk,"maybeMatch");mk.range=gk;function gk(n,e,t){var r,i,s,o,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,o=u),u=t.indexOf(e,f+1)),f=l<u&&l>=0?l:u;r.length&&(c=[s,o])}return c}a(gk,"range")});var Ik=w((mSe,Ak)=>{var _k=bk();Ak.exports=ire;var Sk="\0SLASH"+Math.random()+"\0",wk="\0OPEN"+Math.random()+"\0",K2="\0CLOSE"+Math.random()+"\0",vk="\0COMMA"+Math.random()+"\0",Ek="\0PERIOD"+Math.random()+"\0";function z2(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}a(z2,"numeric");function rre(n){return n.split("\\\\").join(Sk).split("\\{").join(wk).split("\\}").join(K2).split("\\,").join(vk).split("\\.").join(Ek)}a(rre,"escapeBraces");function nre(n){return n.split(Sk).join("\\").split(wk).join("{").split(K2).join("}").split(vk).join(",").split(Ek).join(".")}a(nre,"unescapeBraces");function Tk(n){if(!n)return[""];var e=[],t=_k("{","}",n);if(!t)return n.split(",");var r=t.pre,i=t.body,s=t.post,o=r.split(",");o[o.length-1]+="{"+i+"}";var c=Tk(s);return s.length&&(o[o.length-1]+=c.shift(),o.push.apply(o,c)),e.push.apply(e,o),e}a(Tk,"parseCommaParts");function ire(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Kd(rre(n),!0).map(nre)):[]}a(ire,"expandTop");function sre(n){return"{"+n+"}"}a(sre,"embrace");function ore(n){return/^-?0\d/.test(n)}a(ore,"isPadded");function are(n,e){return n<=e}a(are,"lte");function cre(n,e){return n>=e}a(cre,"gte");function Kd(n,e){var t=[],r=_k("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?Kd(r.post,!1):[""];if(/\$$/.test(r.pre))for(var o=0;o<s.length;o++){var c=i+"{"+r.body+"}"+s[o];t.push(c)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),f=l||u,d=r.body.indexOf(",")>=0;if(!f&&!d)return r.post.match(/,(?!,).*\}/)?(n=r.pre+"{"+r.body+K2+r.post,Kd(n)):[n];var h;if(f)h=r.body.split(/\.\./);else if(h=Tk(r.body),h.length===1&&(h=Kd(h[0],!1).map(sre),h.length===1))return s.map(function(k){return r.pre+h[0]+k});var p;if(f){var g=z2(h[0]),y=z2(h[1]),b=Math.max(h[0].length,h[1].length),S=h.length==3?Math.max(Math.abs(z2(h[2])),1):1,v=are,I=y<g;I&&(S*=-1,v=cre);var A=h.some(ore);p=[];for(var T=g;v(T,y);T+=S){var R;if(u)R=String.fromCharCode(T),R==="\\"&&(R="");else if(R=String(T),A){var V=b-R.length;if(V>0){var L=new Array(V+1).join("0");T<0?R="-"+L+R.slice(1):R=L+R}}p.push(R)}}else{p=[];for(var P=0;P<h.length;P++)p.push.apply(p,Kd(h[P],!1))}for(var P=0;P<p.length;P++)for(var o=0;o<s.length;o++){var c=i+p[P]+s[o];(!e||f||c)&&t.push(c)}}return t}a(Kd,"expand")});var ej=w(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.createPathBasedTargetResolver=ls;Kr.createCreateRelatedTaskService=Mse;Kr.createCreateRelatedProjectService=jse;Kr.createCreateAssetService=$se;Kr.createArchiveAssetService=Use;Kr.createCleanPropertiesService=Bse;Kr.createFixMissingLabelService=Vse;Kr.createRenameToUidService=qse;Kr.createRepairFolderService=Gse;Kr.createPlanForEveningService=Wse;Kr.createUpdatePropertyService=Hse;Kr.createRemovePropertyService=zse;Kr.createSetStatusService=Kse;Kr.createDuplicateAssetService=Yse;Kr.rewriteFrontmatterScalars=Z4;var ob=et();function ls(n){return{resolveFile(e){let t=(0,ob.iriToVaultPath)(e)??e,r=t.endsWith(".md")?t:`${t}.md`,i=n.getAbstractFileByPath(r);if(!i||!("basename"in i))throw new Error(`Cannot resolve target file for IRI: ${e}`);return i}}}a(ls,"createPathBasedTargetResolver");var JA=a(()=>null,"NULL_CLASS_RESOLVER");function sb(n){return n.startsWith('"[[')&&n.endsWith(']]"')?n:n.startsWith("[[")&&n.endsWith("]]")?`"${n}"`:`"[[${n}]]"`}a(sb,"toQuotedWikilink");function Mse(n,e,t=ls(n),r,i=JA){return{async execute(s,o){let c=o?.label;if(!c)throw new Error("createRelatedTask requires userInput.label");let l=t.resolveFile(s),u=n.getFrontmatter(l)??{},f=l.parent?.path||"",d={ems__Effort_status:'"[[c42245d0-01de-4c35-bfcf-d910445ea28e]]"'},h=o?.parentProperty;h&&l.basename&&(d[h]=`"[[${l.basename}]]"`);let p=await e.createAsset({className:"ems__Task",label:c,folderPath:f,propertyValues:d,parentFile:l,parentMetadata:u,classResolver:i});r&&await r(p)}}}a(Mse,"createCreateRelatedTaskService");function jse(n,e,t=ls(n),r,i=JA){return{async execute(s,o){let c=o?.label;if(!c)throw new Error("createRelatedProject requires userInput.label");let l=t.resolveFile(s),u=n.getFrontmatter(l)??{},f=l.parent?.path||"",d={ems__Effort_status:'"[[c42245d0-01de-4c35-bfcf-d910445ea28e]]"'},h=o?.parentProperty;h&&l.basename&&(d[h]=`"[[${l.basename}]]"`);let p=await e.createAsset({className:"ems__Project",label:c,folderPath:f,propertyValues:d,parentFile:l,parentMetadata:u,classResolver:i});r&&await r(p)}}}a(jse,"createCreateRelatedProjectService");function $se(n,e,t=JA,r=ls(n)){return{async execute(i,s){let o=s?.prototypeUID??s?.prototype,c=s?.label,l=s?.folder,u=s?.ownerIdentity,f=s?.isDefinedBy;if(!o)throw new Error("createAsset requires userInput.prototypeUID");if(!c)throw new Error("createAsset requires userInput.label");let d,h;if(i)try{let T=r.resolveFile(i);d=T.path,h=n.getFrontmatter(T)??void 0}catch{}if(!l&&d){let T=d.lastIndexOf("/");l=T>=0?d.substring(0,T):""}if(l===void 0)throw new Error("createAsset requires userInput.folder");let p=o.endsWith("Prototype")?o.slice(0,-9):o,g=crypto.randomUUID(),y=ob.DateFormatter.toISOTimestamp(new Date),b=`${g}.md`,S=l?`${l}/${b}`:b,v=["---",`exo__Asset_uid: ${g}`,`exo__Asset_createdAt: ${y}`,`exo__Asset_label: ${c}`,`exo__Asset_prototype: "[[${o}]]"`,"exo__Instance_class:",` - "[[${p}]]"`],I=!1;if(f&&(v.push(`exo__Asset_isDefinedBy: ${sb(f)}`),I=!0),h){let T=h.exo__Instance_class,V=(Array.isArray(T)?T:T!=null?[T]:[]).some(P=>ob.WikiLinkHelpers.resolveSymbolic(String(P),t).includes("Area")),L=d?d.substring(d.lastIndexOf("/")+1).replace(/\.md$/,""):void 0;if(L){let P=V?"ems__Effort_area":"ems__Effort_parent";v.push(`${P}: "[[${L}]]"`)}!V&&h.ems__Effort_area&&v.push(`ems__Effort_area: ${sb(String(h.ems__Effort_area))}`),v.push('ems__Effort_status: "[[753a44d5-846c-4b82-9196-4fd9a4d48777]]"'),!I&&h.exo__Asset_isDefinedBy&&(v.push(`exo__Asset_isDefinedBy: ${sb(String(h.exo__Asset_isDefinedBy))}`),I=!0)}!I&&u&&v.push(`exo__Asset_isDefinedBy: ${sb(u)}`),v.push("---","");let A=v.join(`
|
|
@@ -350,7 +350,7 @@ GFS4: `),console.error(n)},"debug"));qt[Hr]||(ED=global[Hr]||[],AD(qt,ED),qt.clo
|
|
|
350
350
|
`,l+1)):l===0?s&&(n.result+=" "):n.result+=wr.repeat(`
|
|
351
351
|
`,l):n.result+=wr.repeat(`
|
|
352
352
|
`,s?1+l:l),s=!0,o=!0,l=0,t=n.position;!Ms(d)&&d!==0;)d=n.input.charCodeAt(++n.position);Ra(n,t,n.position,!1)}return!0}a(Qee,"readBlockScalar");function yN(n,e){var t,r=n.tag,i=n.anchor,s=[],o,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,Ee(n,"tab characters must not be used in indentation")),!(l!==45||(o=n.input.charCodeAt(n.position+1),!Gn(o))));){if(c=!0,n.position++,hr(n,!0,-1)&&n.lineIndent<=e){s.push(null),l=n.input.charCodeAt(n.position);continue}if(t=n.line,Au(n,e,KN,!1,!0),s.push(n.result),hr(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===t||n.lineIndent>e)&&l!==0)Ee(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}a(yN,"readBlockSequence");function Xee(n,e,t){var r,i,s,o,c,l,u=n.tag,f=n.anchor,d={},h=Object.create(null),p=null,g=null,y=null,b=!1,S=!1,v;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=d),v=n.input.charCodeAt(n.position);v!==0;){if(!b&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,Ee(n,"tab characters must not be used in indentation")),r=n.input.charCodeAt(n.position+1),s=n.line,(v===63||v===58)&&Gn(r))v===63?(b&&(Tu(n,d,h,p,g,null,o,c,l),p=g=y=null),S=!0,b=!0,i=!0):b?(b=!1,i=!0):Ee(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,v=r;else{if(o=n.line,c=n.lineStart,l=n.position,!Au(n,t,zN,!1,!0))break;if(n.line===s){for(v=n.input.charCodeAt(n.position);Fc(v);)v=n.input.charCodeAt(++n.position);if(v===58)v=n.input.charCodeAt(++n.position),Gn(v)||Ee(n,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(Tu(n,d,h,p,g,null,o,c,l),p=g=y=null),S=!0,b=!1,i=!1,p=n.tag,g=n.result;else if(S)Ee(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=u,n.anchor=f,!0}else if(S)Ee(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)&&(b&&(o=n.line,c=n.lineStart,l=n.position),Au(n,e,i0,!0,i)&&(b?g=n.result:y=n.result),b||(Tu(n,d,h,p,g,y,o,c,l),p=g=y=null),hr(n,!0,-1),v=n.input.charCodeAt(n.position)),(n.line===s||n.lineIndent>e)&&v!==0)Ee(n,"bad indentation of a mapping entry");else if(n.lineIndent<e)break}return b&&Tu(n,d,h,p,g,null,o,c,l),S&&(n.tag=u,n.anchor=f,n.kind="mapping",n.result=d),S}a(Xee,"readBlockMapping");function Jee(n){var e,t=!1,r=!1,i,s,o;if(o=n.input.charCodeAt(n.position),o!==33)return!1;if(n.tag!==null&&Ee(n,"duplication of a tag property"),o=n.input.charCodeAt(++n.position),o===60?(t=!0,o=n.input.charCodeAt(++n.position)):o===33?(r=!0,i="!!",o=n.input.charCodeAt(++n.position)):i="!",e=n.position,t){do o=n.input.charCodeAt(++n.position);while(o!==0&&o!==62);n.position<n.length?(s=n.input.slice(e,n.position),o=n.input.charCodeAt(++n.position)):Ee(n,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!Gn(o);)o===33&&(r?Ee(n,"tag suffix cannot contain exclamation marks"):(i=n.input.slice(e-1,n.position+1),YN.test(i)||Ee(n,"named tag handle cannot contain such characters"),r=!0,e=n.position+1)),o=n.input.charCodeAt(++n.position);s=n.input.slice(e,n.position),Uee.test(s)&&Ee(n,"tag suffix cannot contain flow indicator characters")}s&&!QN.test(s)&&Ee(n,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Ee(n,"tag name is malformed: "+s)}return t?n.tag=s:Ca.call(n.tagMap,i)?n.tag=n.tagMap[i]+s:i==="!"?n.tag="!"+s:i==="!!"?n.tag="tag:yaml.org,2002:"+s:Ee(n,'undeclared tag handle "'+i+'"'),!0}a(Jee,"readTagProperty");function Zee(n){var e,t;if(t=n.input.charCodeAt(n.position),t!==38)return!1;for(n.anchor!==null&&Ee(n,"duplication of an anchor property"),t=n.input.charCodeAt(++n.position),e=n.position;t!==0&&!Gn(t)&&!Eu(t);)t=n.input.charCodeAt(++n.position);return n.position===e&&Ee(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(e,n.position),!0}a(Zee,"readAnchorProperty");function ete(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&&!Gn(r)&&!Eu(r);)r=n.input.charCodeAt(++n.position);return n.position===e&&Ee(n,"name of an alias node must contain at least one character"),t=n.input.slice(e,n.position),Ca.call(n.anchorMap,t)||Ee(n,'unidentified alias "'+t+'"'),n.result=n.anchorMap[t],hr(n,!0,-1),!0}a(ete,"readAlias");function Au(n,e,t,r,i){var s,o,c,l=1,u=!1,f=!1,d,h,p,g,y,b;if(n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null,s=o=c=i0===t||KN===t,r&&hr(n,!0,-1)&&(u=!0,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)),l===1)for(;Jee(n)||Zee(n);)hr(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||i0===t)&&(n0===t||zN===t?y=e:y=e+1,b=n.position-n.lineStart,l===1?c&&(yN(n,b)||Xee(n,b,y))||Yee(n,y)?f=!0:(o&&Qee(n,y)||zee(n,y)||Kee(n,y)?f=!0:ete(n)?(f=!0,(n.tag!==null||n.anchor!==null)&&Ee(n,"alias node should not have any properties")):Hee(n,y,n0===t)&&(f=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):l===0&&(f=c&&yN(n,b))),n.tag===null)n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);else if(n.tag==="?"){for(n.result!==null&&n.kind!=="scalar"&&Ee(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"'),d=0,h=n.implicitTypes.length;d<h;d+=1)if(g=n.implicitTypes[d],g.resolve(n.result)){n.result=g.construct(n.result),n.tag=g.tag,n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);break}}else if(n.tag!=="!"){if(Ca.call(n.typeMap[n.kind||"fallback"],n.tag))g=n.typeMap[n.kind||"fallback"][n.tag];else for(g=null,p=n.typeMap.multi[n.kind||"fallback"],d=0,h=p.length;d<h;d+=1)if(n.tag.slice(0,p[d].tag.length)===p[d].tag){g=p[d];break}g||Ee(n,"unknown tag !<"+n.tag+">"),n.result!==null&&g.kind!==n.kind&&Ee(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+g.kind+'", not "'+n.kind+'"'),g.resolve(n.result,n.tag)?(n.result=g.construct(n.result,n.tag),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):Ee(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}a(Au,"composeNode");function tte(n){var e=n.position,t,r,i,s=!1,o;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(o=n.input.charCodeAt(n.position))!==0&&(hr(n,!0,-1),o=n.input.charCodeAt(n.position),!(n.lineIndent>0||o!==37));){for(s=!0,o=n.input.charCodeAt(++n.position),t=n.position;o!==0&&!Gn(o);)o=n.input.charCodeAt(++n.position);for(r=n.input.slice(t,n.position),i=[],r.length<1&&Ee(n,"directive name must not be less than one character in length");o!==0;){for(;Fc(o);)o=n.input.charCodeAt(++n.position);if(o===35){do o=n.input.charCodeAt(++n.position);while(o!==0&&!Ms(o));break}if(Ms(o))break;for(t=n.position;o!==0&&!Gn(o);)o=n.input.charCodeAt(++n.position);i.push(n.input.slice(t,n.position))}o!==0&&q2(n),Ca.call(mN,r)?mN[r](n,r,i):s0(n,'unknown document directive "'+r+'"')}if(hr(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,hr(n,!0,-1)):s&&Ee(n,"directives end mark is expected"),Au(n,n.lineIndent-1,i0,!1,!0),hr(n,!0,-1),n.checkLineBreaks&&$ee.test(n.input.slice(e,n.position))&&s0(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&c0(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,hr(n,!0,-1));return}if(n.position<n.length-1)Ee(n,"end of the stream or a document separator is expected");else return}a(tte,"readDocument");function tk(n,e){n=String(n),e=e||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
|
|
353
|
-
`),n.charCodeAt(0)===65279&&(n=n.slice(1)));var t=new Wee(n,e),r=n.indexOf("\0");for(r!==-1&&(t.position=r,Ee(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;)tte(t);return t.documents}a(tk,"loadDocuments");function rte(n,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var r=tk(n,t);if(typeof e!="function")return r;for(var i=0,s=r.length;i<s;i+=1)e(r[i])}a(rte,"loadAll$1");function nte(n,e){var t=tk(n,e);if(t.length!==0){if(t.length===1)return t[0];throw new En("expected a single document in the stream, but found more")}}a(nte,"load$1");var ite=rte,ste=nte,rk={loadAll:ite,load:ste},nk=Object.prototype.toString,ik=Object.prototype.hasOwnProperty,W2=65279,ote=9,Wd=10,ate=13,cte=32,lte=33,ute=34,M2=35,fte=37,dte=38,hte=39,pte=42,sk=44,mte=45,o0=58,gte=61,yte=62,bte=63,_te=64,ok=91,ak=93,Ste=96,ck=123,wte=124,lk=125,
|
|
353
|
+
`),n.charCodeAt(0)===65279&&(n=n.slice(1)));var t=new Wee(n,e),r=n.indexOf("\0");for(r!==-1&&(t.position=r,Ee(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;)tte(t);return t.documents}a(tk,"loadDocuments");function rte(n,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var r=tk(n,t);if(typeof e!="function")return r;for(var i=0,s=r.length;i<s;i+=1)e(r[i])}a(rte,"loadAll$1");function nte(n,e){var t=tk(n,e);if(t.length!==0){if(t.length===1)return t[0];throw new En("expected a single document in the stream, but found more")}}a(nte,"load$1");var ite=rte,ste=nte,rk={loadAll:ite,load:ste},nk=Object.prototype.toString,ik=Object.prototype.hasOwnProperty,W2=65279,ote=9,Wd=10,ate=13,cte=32,lte=33,ute=34,M2=35,fte=37,dte=38,hte=39,pte=42,sk=44,mte=45,o0=58,gte=61,yte=62,bte=63,_te=64,ok=91,ak=93,Ste=96,ck=123,wte=124,lk=125,sn={};sn[0]="\\0";sn[7]="\\a";sn[8]="\\b";sn[9]="\\t";sn[10]="\\n";sn[11]="\\v";sn[12]="\\f";sn[13]="\\r";sn[27]="\\e";sn[34]='\\"';sn[92]="\\\\";sn[133]="\\N";sn[160]="\\_";sn[8232]="\\L";sn[8233]="\\P";var vte=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Ete=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Tte(n,e){var t,r,i,s,o,c,l;if(e===null)return{};for(t={},r=Object.keys(e),i=0,s=r.length;i<s;i+=1)o=r[i],c=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=n.compiledTypeMap.fallback[o],l&&ik.call(l.styleAliases,c)&&(c=l.styleAliases[c]),t[o]=c;return t}a(Tte,"compileStyleMap");function Ate(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 En("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+wr.repeat("0",r-e.length)+e}a(Ate,"encodeHex");var Ite=1,Hd=2;function xte(n){this.schema=n.schema||V2,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=wr.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=Tte(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==='"'?Hd:Ite,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}a(xte,"State");function bN(n,e){for(var t=wr.repeat(" ",e),r=0,i=-1,s="",o,c=n.length;r<c;)i=n.indexOf(`
|
|
354
354
|
`,r),i===-1?(o=n.slice(r),r=c):(o=n.slice(r,i+1),r=i+1),o.length&&o!==`
|
|
355
355
|
`&&(s+=t),s+=o;return s}a(bN,"indentString");function j2(n,e){return`
|
|
356
356
|
`+wr.repeat(" ",n.indent*e)}a(j2,"generateNextLine");function Rte(n,e){var t,r,i;for(t=0,r=n.implicitTypes.length;t<r;t+=1)if(i=n.implicitTypes[t],i.resolve(e))return!0;return!1}a(Rte,"testImplicitResolving");function a0(n){return n===cte||n===ote}a(a0,"isWhitespace");function zd(n){return 32<=n&&n<=126||161<=n&&n<=55295&&n!==8232&&n!==8233||57344<=n&&n<=65533&&n!==W2||65536<=n&&n<=1114111}a(zd,"isPrintable");function _N(n){return zd(n)&&n!==W2&&n!==ate&&n!==Wd}a(_N,"isNsCharOrWhitespace");function SN(n,e,t){var r=_N(n),i=r&&!a0(n);return(t?r:r&&n!==sk&&n!==ok&&n!==ak&&n!==ck&&n!==lk)&&n!==M2&&!(e===o0&&!i)||_N(e)&&!a0(e)&&n===M2||e===o0&&i}a(SN,"isPlainSafe");function Cte(n){return zd(n)&&n!==W2&&!a0(n)&&n!==mte&&n!==bte&&n!==o0&&n!==sk&&n!==ok&&n!==ak&&n!==ck&&n!==lk&&n!==M2&&n!==dte&&n!==pte&&n!==lte&&n!==wte&&n!==gte&&n!==yte&&n!==hte&&n!==ute&&n!==fte&&n!==_te&&n!==Ste}a(Cte,"isPlainSafeFirst");function Ote(n){return!a0(n)&&n!==o0}a(Ote,"isPlainSafeLast");function qd(n,e){var t=n.charCodeAt(e),r;return t>=55296&&t<=56319&&e+1<n.length&&(r=n.charCodeAt(e+1),r>=56320&&r<=57343)?(t-55296)*1024+r-56320+65536:t}a(qd,"codePointAt");function uk(n){var e=/^\n* /;return e.test(n)}a(uk,"needIndentIndicator");var fk=1,$2=2,dk=3,hk=4,vu=5;function Pte(n,e,t,r,i,s,o,c){var l,u=0,f=null,d=!1,h=!1,p=r!==-1,g=-1,y=Cte(qd(n,0))&&Ote(qd(n,n.length-1));if(e||o)for(l=0;l<n.length;u>=65536?l+=2:l++){if(u=qd(n,l),!zd(u))return vu;y=y&&SN(u,f,c),f=u}else{for(l=0;l<n.length;u>=65536?l+=2:l++){if(u=qd(n,l),u===Wd)d=!0,p&&(h=h||l-g-1>r&&n[g+1]!==" ",g=l);else if(!zd(u))return vu;y=y&&SN(u,f,c),f=u}h=h||p&&l-g-1>r&&n[g+1]!==" "}return!d&&!h?y&&!o&&!i(n)?fk:s===Hd?vu:$2:t>9&&uk(n)?vu:o?s===Hd?vu:$2:h?hk:dk}a(Pte,"chooseScalarStyle");function Fte(n,e,t,r,i){n.dump=(function(){if(e.length===0)return n.quotingType===Hd?'""':"''";if(!n.noCompatMode&&(vte.indexOf(e)!==-1||Ete.test(e)))return n.quotingType===Hd?'"'+e+'"':"'"+e+"'";var s=n.indent*Math.max(1,t),o=n.lineWidth===-1?-1:Math.max(Math.min(n.lineWidth,40),n.lineWidth-s),c=r||n.flowLevel>-1&&t>=n.flowLevel;function l(u){return Rte(n,u)}switch(a(l,"testAmbiguity"),Pte(e,c,n.indent,o,l,n.quotingType,n.forceQuotes&&!r,i)){case fk:return e;case $2:return"'"+e.replace(/'/g,"''")+"'";case dk:return"|"+wN(e,n.indent)+vN(bN(e,s));case hk:return">"+wN(e,n.indent)+vN(bN(Dte(e,o),s));case vu:return'"'+Lte(e)+'"';default:throw new En("impossible error: invalid scalar style")}})()}a(Fte,"writeScalar");function wN(n,e){var t=uk(n)?String(e):"",r=n[n.length-1]===`
|
|
@@ -364,8 +364,8 @@ GFS4: `),console.error(n)},"debug"));qt[Hr]||(ED=global[Hr]||[],AD(qt,ED),qt.clo
|
|
|
364
364
|
`:"")+EN(l,e),i=s}return r}a(Dte,"foldString");function EN(n,e){if(n===""||n[0]===" ")return n;for(var t=/ [^ ]/g,r,i=0,s,o=0,c=0,l="";r=t.exec(n);)c=r.index,c-i>e&&(s=o>i?o:c,l+=`
|
|
365
365
|
`+n.slice(i,s),i=s+1),o=c;return l+=`
|
|
366
366
|
`,n.length-i>e&&o>i?l+=n.slice(i,o)+`
|
|
367
|
-
`+n.slice(o+1):l+=n.slice(i),l.slice(1)}a(EN,"foldLine");function Lte(n){for(var e="",t=0,r,i=0;i<n.length;t>=65536?i+=2:i++)t=qd(n,i),r=
|
|
368
|
-
`:""}a($te,"dump$1");var Ute=$te,Bte={dump:Ute};function H2(n,e){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}a(H2,"renamed");var Vte=zr,qte=RN,Gte=FN,Wte=MN,Hte=jN,zte=V2,Kte=rk.load,Yte=rk.loadAll,Qte=Bte.dump,Xte=En,Jte={binary:qN,float:kN,map:PN,null:DN,pairs:WN,set:HN,timestamp:BN,bool:LN,int:NN,merge:VN,omap:GN,seq:ON,str:CN},Zte=H2("safeLoad","load"),ere=H2("safeLoadAll","loadAll"),tre=H2("safeDump","dump"),Dt={Type:Vte,Schema:qte,FAILSAFE_SCHEMA:Gte,JSON_SCHEMA:Wte,CORE_SCHEMA:Hte,DEFAULT_SCHEMA:zte,load:Kte,loadAll:Yte,dump:Qte,YAMLException:Xte,types:Jte,safeLoad:Zte,safeLoadAll:ere,safeDump:tre};var pA=se(No()),kc=se(require("path"));var Nk=se(Ik(),1);var Yd=a(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var lre={"[: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]},Qd=a(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),ure=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),xk=a(n=>n.join(""),"rangesToString"),Rk=a((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,o=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<n.length;){let y=n.charAt(s);if((y==="!"||y==="^")&&s===t+1){u=!0,s++;continue}if(y==="]"&&o&&!l){f=s+1;break}if(o=!0,y==="\\"&&!l){l=!0,s++;continue}if(y==="["&&!l){for(let[b,[S,v,I]]of Object.entries(lre))if(n.startsWith(b,s)){if(d)return["$.",!1,n.length-t,!0];s+=b.length,I?i.push(S):r.push(S),c=c||v;continue e}}if(l=!1,d){y>d?r.push(Qd(d)+"-"+Qd(y)):y===d&&r.push(Qd(y)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Qd(y+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=y,s+=2;continue}r.push(Qd(y)),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 y=r[0].length===2?r[0].slice(-1):r[0];return[ure(y),!1,f-t,!1]}let h="["+(u?"^":"")+xk(r)+"]",p="["+(u?"":"^")+xk(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var es=a((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Wn,fre=new Set(["!","?","+","*","@"]),Y2=a(n=>fre.has(n),"isExtglobType"),Ck=a(n=>Y2(n.type),"isExtglobAST"),dre=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),hre=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),pre=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Ok=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),mre="(?!(?:^|/)\\.\\.?(?:$|/))",l0="(?!\\.)",gre=new Set(["[","."]),yre=new Set(["..","."]),bre=new Set("().*{}+?[]^$\\!"),_re=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Q2="[^/]",Pk=Q2+"*?",Fk=Q2+"+?",Dc=class{static{a(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#b;#i;#u=!1;#s;#l;#o=!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.#b=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.#b+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 Wn&&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.#b===0)return!0;let e=this.#c;for(let t=0;t<this.#b;t++){let r=e.#t[t];if(!(r instanceof Wn&&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.#b===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Wn(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let o=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let y=r,b="";for(;y<e.length;){let S=e.charAt(y++);if(c||S==="\\"){c=!c,b+=S;continue}if(l){y===u+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(y===u+2&&f)&&(l=!1),b+=S;continue}else if(S==="["){l=!0,u=y,f=!1,b+=S;continue}if(!i.noext&&Y2(S)&&e.charAt(y)==="("&&s<=o){t.push(b),b="";let I=new Wn(S,t);y=Wn.#g(e,I,y,i,s+1),t.push(I);continue}b+=S}return t.push(b),y}let d=r+1,h=new Wn(null,t),p=[],g="";for(;d<e.length;){let y=e.charAt(d++);if(c||y==="\\"){c=!c,g+=y;continue}if(l){d===u+1?(y==="^"||y==="!")&&(f=!0):y==="]"&&!(d===u+2&&f)&&(l=!1),g+=y;continue}else if(y==="["){l=!0,u=d,f=!1,g+=y;continue}if(Y2(y)&&e.charAt(d)==="("&&(s<=o||t&&t.#y(y))){let S=t&&t.#y(y)?0:1;h.push(g),g="";let v=new Wn(y,h);h.push(v),d=Wn.#g(e,v,d,i,s+S);continue}if(y==="|"){h.push(g),g="",p.push(h),h=new Wn(null,t);continue}if(y===")")return g===""&&t.#t.length===0&&(t.#o=!0),h.push(g),g="",t.push(...p,h),d;g+=y}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,hre)}#m(e,t=dre){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=pre){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Wn(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!!Ok.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)}#v(e){let t=Ok.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.#o=!1}#S(){if(Ck(this)){let e=0,t=!1;do{t=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#S(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#_(i)&&(t=!1,this.#v(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#S();this.#l=void 0}static fromGlob(e,t={}){let r=new Wn(null,void 0,t);return Wn.#g(e,r,0,t,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let c=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#e===this&&(this.#S(),this.#p()),!Ck(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[g,y,b,S]=typeof p=="string"?Wn.#I(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||b,this.#r=this.#r||S,g}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&yre.has(this.#t[0]))){let g=gre,y=t&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),b=!t&&!e&&g.has(u.charAt(0));f=y?mre:b?l0:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,es(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#w(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#n=void 0,[l,es(this.toString()),!1,!1]}let o=!r||e||t||!l0?"":this.#w(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let c="";if(this.type==="!"&&this.#o)c=(this.isStart()&&!t?l0:"")+Fk;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?l0:"")+Pk+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+s+l}return[c,es(s),this.#n=!!this.#n,this.#r]}#w(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=t.toRegExpSource(e);return this.#r=this.#r||o,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#I(e,t,r=!1){let i=!1,s="",o=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(bre.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=Rk(e,l);if(h){s+=f,o=o||d,l+=h-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?Fk:Pk,t=!0;continue}else c=!1;if(u==="?"){s+=Q2,t=!0;continue}s+=_re(u)}return[s,es(e),!!t,o]}};Wn=Dc;var Iu=a((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Tn=a((n,e,t={})=>(Yd(e),!t.nocomment&&e.charAt(0)==="#"?!1:new si(e,t).match(n)),"minimatch"),Sre=/^\*+([^+@!?\*\[\(]*)$/,wre=a(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),vre=a(n=>e=>e.endsWith(n),"starDotExtTestDot"),Ere=a(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),Tre=a(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),Are=/^\*+\.\*+$/,Ire=a(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),xre=a(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),Rre=/^\.\*+$/,Cre=a(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),Ore=/^\*+$/,Pre=a(n=>n.length!==0&&!n.startsWith("."),"starTest"),Fre=a(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),Dre=/^\?+([^+@!?\*\[\(]*)?$/,Lre=a(([n,e=""])=>{let t=kk([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),Nre=a(([n,e=""])=>{let t=Mk([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),kre=a(([n,e=""])=>{let t=Mk([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),Mre=a(([n,e=""])=>{let t=kk([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),kk=a(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),Mk=a(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),jk=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Dk={win32:{sep:"\\"},posix:{sep:"/"}},jre=jk==="win32"?Dk.win32.sep:Dk.posix.sep;Tn.sep=jre;var er=Symbol("globstar **");Tn.GLOBSTAR=er;var $re="[^/]",Ure=$re+"*?",Bre="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Vre="(?:(?!(?:\\/|^)\\.).)*?",qre=a((n,e={})=>t=>Tn(t,n,e),"filter");Tn.filter=qre;var mi=a((n,e={})=>Object.assign({},n,e),"ext"),Gre=a(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Tn;let e=Tn;return Object.assign(a((r,i,s={})=>e(r,i,mi(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,mi(n,s))}static defaults(i){return e.defaults(mi(n,i)).Minimatch}},AST:class extends e.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,mi(n,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,mi(n,s))}},unescape:a((r,i={})=>e.unescape(r,mi(n,i)),"unescape"),escape:a((r,i={})=>e.escape(r,mi(n,i)),"escape"),filter:a((r,i={})=>e.filter(r,mi(n,i)),"filter"),defaults:a(r=>e.defaults(mi(n,r)),"defaults"),makeRe:a((r,i={})=>e.makeRe(r,mi(n,i)),"makeRe"),braceExpand:a((r,i={})=>e.braceExpand(r,mi(n,i)),"braceExpand"),match:a((r,i,s={})=>e.match(r,i,mi(n,s)),"match"),sep:e.sep,GLOBSTAR:er})},"defaults");Tn.defaults=Gre;var $k=a((n,e={})=>(Yd(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,Nk.default)(n)),"braceExpand");Tn.braceExpand=$k;var Wre=a((n,e={})=>new si(n,e).makeRe(),"makeRe");Tn.makeRe=Wre;var Hre=a((n,e,t={})=>{let r=new si(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Tn.match=Hre;var Lk=/[?*]|[+@!]\(.*?\)|\[|\]/,zre=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),si=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){Yd(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||jk,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,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!Lk.test(s[2]))&&!Lk.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let 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 o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-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 o=1;o<r.length-1;o++){let c=r[o];o===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){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,o=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])o.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",o.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),d=l?3:c?0:void 0,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,g]=[e[d],t[h]];p.toLowerCase()===g.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(er)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let o=t.indexOf(er,s),c=t.lastIndexOf(er),[l,u,f]=r?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,c),t.slice(c+1)];if(l.length){let v=e.slice(i,i+l.length);if(!this.#r(v,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let v=e.length-f.length;if(this.#r(e,f,r,v,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(v--,!this.#r(e,f,r,v,0)))return!1;d=f.length+1}}if(!u.length){let v=!!d;for(let I=i;I<e.length-d;I++){let A=String(e[I]);if(v=!0,A==="."||A===".."||!this.options.dot&&A.startsWith("."))return!1}return r||v}let h=[[[],0]],p=h[0],g=0,y=[0];for(let v of u)v===er?(y.push(g),p=[[],0],h.push(p)):(p[0].push(v),g++);let b=h.length-1,S=e.length-d;for(let v of h)v[1]=S-(y[b--]+v[0].length);return!!this.#n(e,h,i,0,r,0,!!d)}#n(e,t,r,i,s,o,c){let l=t[i];if(!l){for(let d=r;d<e.length;d++){c=!0;let h=e[d];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return c}let[u,f]=l;for(;r<=f;){if(this.#r(e.slice(0,r+u.length),u,s,r,0)&&o<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,o+1,c);if(p!==!1)return p}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let o,c,l,u;for(o=i,c=s,u=e.length,l=t.length;o<u&&c<l;o++,c++){this.debug("matchOne loop");let f=t[c],d=e[o];if(this.debug(t,f,d),f===!1||f===er)return!1;let h;if(typeof f=="string"?(h=d===f,this.debug("string match",f,d,h)):(h=f.test(d),this.debug("pattern match",f,d,h)),!h)return!1}if(o===u&&c===l)return!0;if(o===u)return r;if(c===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return $k(this.pattern,this.options)}parse(e){Yd(e);let t=this.options;if(e==="**")return er;if(e==="")return"";let r,i=null;(r=e.match(Ore))?i=t.dot?Fre:Pre:(r=e.match(Sre))?i=(t.nocase?t.dot?Tre:Ere:t.dot?vre:wre)(r[1]):(r=e.match(Dre))?i=(t.nocase?t.dot?Nre:Lre:t.dot?kre:Mre)(r):(r=e.match(Are))?i=t.dot?xre:Ire:(r=e.match(Rre))&&(i=Cre);let s=Dc.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?Ure:t.dot?Bre:Vre,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?zre(f):f===er?er:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==er||p===er||(p===void 0?h!==void 0&&h!==er?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==er&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=er))}),u.filter(f=>f!==er).join("/")}).join("|"),[o,c]=e.length>1?["(?:",")"]:["",""];s="^"+o+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 o=i[i.length-1];if(!o)for(let c=i.length-2;!o&&c>=0;c--)o=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[o]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Tn.defaults(e).Minimatch}};Tn.AST=Dc;Tn.Minimatch=si;Tn.escape=Iu;Tn.unescape=es;var lM=require("node:url");var xu=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Bk=new Set,X2=typeof process=="object"&&process?process:{},Vk=a((n,e,t,r)=>{typeof X2.emitWarning=="function"?X2.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),u0=globalThis.AbortController,Uk=globalThis.AbortSignal;if(typeof u0>"u"){Uk=class{static{a(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},u0=class{static{a(this,"AbortController")}constructor(){e()}signal=new Uk;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=X2.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=a(()=>{n&&(n=!1,Vk("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 Kre=a(n=>!Bk.has(n),"shouldWarn");var Oa=a(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),qk=a(n=>Oa(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ru:null:null,"getUintArray"),Ru=class extends Array{static{a(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},J2=class n{static{a(this,"Stack")}heap;length;static#e=!1;static create(e){let t=qk(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]}},Xd=class n{static{a(this,"LRUCache")}#e;#n;#r;#t;#c;#b;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#o;#p;#g;#d;#m;#y;#f;#E;#T;#_;#v;#S;#w;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#o,next:e.#p,prev:e.#g,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:a(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:a((t,r,i,s)=>e.#j(t,r,i,s),"backgroundFetch"),moveToTail:a(t=>e.#U(t),"moveToTail"),indexes:a(t=>e.#R(t),"indexes"),rindexes:a(t=>e.#C(t),"rindexes"),isStale:a(t=>e.#A(t),"isStale")}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#i}get fetchMethod(){return this.#c}get memoMethod(){return this.#b}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:h,maxSize:p=0,maxEntrySize:g=0,sizeCalculation:y,fetchMethod:b,memoMethod:S,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:T,ignoreFetchAbort:R}=e;if(t!==0&&!Oa(t))throw new TypeError("max option must be a nonnegative integer");let V=t?qk(t):Array;if(!V)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=g||this.#n,this.sizeCalculation=y,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.#b=S,b!==void 0&&typeof b!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=b,this.#S=!!b,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#o=new Array(t).fill(void 0),this.#p=new V(t),this.#g=new V(t),this.#d=0,this.#m=0,this.#y=J2.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#v=!!this.#r,this.#w=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!R,this.maxEntrySize!==0){if(this.#n!==0&&!Oa(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Oa(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=Oa(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Oa(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}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 L="LRU_CACHE_UNBOUNDED";Kre(L)&&(Bk.add(L),Vk("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",L,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#I(){let e=new Ru(this.#e),t=new Ru(this.#e);this.#_=e,this.#T=t,this.#F=(s,o,c=xu.now())=>{if(t[s]=o!==0?c:0,e[s]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#P(this.#l[s],"expire")},o+1);l.unref&&l.unref()}},this.#x=s=>{t[s]=e[s]!==0?xu.now():0},this.#a=(s,o)=>{if(e[o]){let c=e[o],l=t[o];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=a(()=>{let s=xu.now();if(this.ttlResolution>0){r=s;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref()}return s},"getNow");this.getRemainingTTL=s=>{let o=this.#s.get(s);if(o===void 0)return 0;let c=e[o],l=t[o];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#A=s=>{let o=t[s],c=e[s];return!!c&&!!o&&(r||i())-o>c}}#x=a(()=>{},"#updateItemAge");#a=a(()=>{},"#statusTTL");#F=a(()=>{},"#setItemTTL");#A=a(()=>!1,"#isStale");#O(){let e=new Ru(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#N=(t,r,i,s)=>{if(this.#h(r))return 0;if(!Oa(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Oa(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.#L=(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=a(e=>{},"#removeItemSize");#L=a((e,t,r)=>{},"#addItemSize");#N=a((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#R({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#C({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#m));)t=this.#p[t]}#k(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#R())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*rentries(){for(let e of this.#C())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*keys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*rkeys(){for(let e of this.#C()){let t=this.#l[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*values(){for(let e of this.#R())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#C())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#R()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[r],this))return this.get(this.#l[r],t)}}forEach(e,t=this){for(let r of this.#R()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#C()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#C({allowStale:!0}))this.#A(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#o[t],i=this.#h(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#_&&this.#T){let o=this.#_[t],c=this.#T[t];if(o&&c){let l=o-(xu.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.#R({allowStale:!0})){let r=this.#l[t],i=this.#o[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let o={value:s};if(this.#_&&this.#T){o.ttl=this.#_[t];let c=xu.now()-this.#T[t];o.start=Math.floor(Date.now()-c)}this.#E&&(o.size=this.#E[t]),e.unshift([r,o])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=xu.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:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#N(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let d=this.#i===0?void 0:this.#s.get(e);if(d===void 0)d=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#M(!1):this.#i,this.#l[d]=e,this.#o[d]=t,this.#s.set(e,d),this.#p[this.#m]=d,this.#g[d]=this.#m,this.#m=d,this.#i++,this.#L(d,f,l),l&&(l.set="add"),u=!1;else{this.#U(d);let h=this.#o[d];if(t!==h){if(this.#S&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!o&&(this.#v&&this.#r?.(p,e,"set"),this.#w&&this.#f?.push([p,e,"set"]))}else o||(this.#v&&this.#r?.(h,e,"set"),this.#w&&this.#f?.push([h,e,"set"]));if(this.#D(d),this.#L(d,f,l),this.#o[d]=t,l){l.set="replace";let p=h&&this.#h(h)?h.__staleWhileFetching:h;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#_&&this.#I(),this.#_&&(u||this.#F(d,i,s),l&&this.#a(l,d)),!o&&this.#w&&this.#f){let h=this.#f,p;for(;p=h?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#o[this.#d];if(this.#M(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#d,r=this.#l[t],i=this.#o[t];return this.#S&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(i,r,"evict"),this.#w&&this.#f?.push([i,r,"evict"])),this.#D(t),e&&(this.#l[t]=void 0,this.#o[t]=void 0,this.#y.push(t)),this.#i===1?(this.#d=this.#m=0,this.#y.length=0):this.#d=this.#p[t],this.#s.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=this.#s.get(e);if(s!==void 0){let o=this.#o[s];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#a(i,s));else return r&&this.#x(s),i&&(i.has="hit",this.#a(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=this.#s.get(e);if(i===void 0||!r&&this.#A(i))return;let s=this.#o[i];return this.#h(s)?s.__staleWhileFetching:s}#j(e,t,r,i){let s=t===void 0?void 0:this.#o[t];if(this.#h(s))return s;let o=new u0,{signal:c}=r;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let l={signal:o.signal,options:r,context:i},u=a((y,b=!1)=>{let{aborted:S}=o.signal,v=r.ignoreFetchAbort&&y!==void 0;if(r.status&&(S&&!b?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,v&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),S&&!v&&!b)return d(o.signal.reason);let I=p;return this.#o[t]===p&&(y===void 0?I.__staleWhileFetching?this.#o[t]=I.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,y,l.options))),y},"cb"),f=a(y=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=y),d(y)),"eb"),d=a(y=>{let{aborted:b}=o.signal,S=b&&r.allowStaleOnFetchAbort,v=S||r.allowStaleOnFetchRejection,I=v||r.noDeleteOnFetchRejection,A=p;if(this.#o[t]===p&&(!I||A.__staleWhileFetching===void 0?this.#P(e,"fetch"):S||(this.#o[t]=A.__staleWhileFetching)),v)return r.status&&A.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),A.__staleWhileFetching;if(A.__returned===A)throw y},"fetchFail"),h=a((y,b)=>{let S=this.#c?.(e,s,l);S&&S instanceof Promise&&S.then(v=>y(v===void 0?void 0:v),b),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(void 0),r.allowStaleOnFetchAbort&&(y=a(v=>u(v,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),g=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,g,{...l.options,status:void 0}),t=this.#s.get(e)):this.#o[t]=g,g}#h(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof u0}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:y,forceRefresh:b=!1,status:S,signal:v}=t;if(!this.#S)return S&&(S.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:S});let I={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:g,ignoreFetchAbort:p,status:S,signal:v},A=this.#s.get(e);if(A===void 0){S&&(S.fetch="miss");let T=this.#j(e,A,I,y);return T.__returned=T}else{let T=this.#o[A];if(this.#h(T)){let k=r&&T.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",k&&(S.returnedStale=!0)),k?T.__staleWhileFetching:T.__returned=T}let R=this.#A(A);if(!b&&!R)return S&&(S.fetch="hit"),this.#U(A),i&&this.#x(A),S&&this.#a(S,A),T;let V=this.#j(e,A,I,y),P=V.__staleWhileFetching!==void 0&&r;return S&&(S.fetch=R?"stale":"refresh",P&&R&&(S.returnedStale=!0)),P?V.__staleWhileFetching:V.__returned=V}}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.#b;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=t,c=this.get(e,o);if(!s&&c!==void 0)return c;let l=r(e,c,{options:o,context:i});return this.set(e,l,o),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#o[c],u=this.#h(l);return o&&this.#a(o,c),this.#A(c)?(o&&(o.get="stale"),u?(o&&r&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#P(e,"expire"),o&&r&&(o.returnedStale=!0),r?l:void 0)):(o&&(o.get="hit"),u?l.__staleWhileFetching:(this.#U(c),i&&this.#x(c),l))}else o&&(o.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#U(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#B(t);else{this.#D(i);let s=this.#o[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(s,e,t),this.#w&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#o[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#d)this.#d=this.#p[i];else{let o=this.#g[i];this.#p[o]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#w&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#C({allowStale:!0})){let r=this.#o[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#v&&this.#r?.(r,i,e),this.#w&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#o.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.#d=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#w&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var Pu=require("node:path"),Zk=require("node:url"),Us=require("fs"),ine=se(require("node:fs"),1),Da=require("node:fs/promises");var y0=require("node:events"),sA=se(require("node:stream"),1),Kk=require("node:string_decoder");var Gk=typeof process=="object"&&process?process:{stdout:null,stderr:null},Yre=a(n=>!!n&&typeof n=="object"&&(n instanceof Fa||n instanceof sA.default||Qre(n)||Xre(n)),"isStream"),Qre=a(n=>!!n&&typeof n=="object"&&n instanceof y0.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==sA.default.Writable.prototype.pipe,"isReadable"),Xre=a(n=>!!n&&typeof n=="object"&&n instanceof y0.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),Mo=Symbol("EOF"),jo=Symbol("maybeEmitEnd"),Pa=Symbol("emittedEnd"),f0=Symbol("emittingEnd"),Jd=Symbol("emittedError"),d0=Symbol("closed"),Wk=Symbol("read"),h0=Symbol("flush"),Hk=Symbol("flushChunk"),ts=Symbol("encoding"),Cu=Symbol("decoder"),Dr=Symbol("flowing"),Zd=Symbol("paused"),Ou=Symbol("resume"),Lr=Symbol("buffer"),An=Symbol("pipes"),Nr=Symbol("bufferLength"),Z2=Symbol("bufferPush"),p0=Symbol("bufferShift"),sn=Symbol("objectMode"),tr=Symbol("destroyed"),eA=Symbol("error"),tA=Symbol("emitData"),zk=Symbol("emitEnd"),rA=Symbol("emitEnd2"),js=Symbol("async"),nA=Symbol("abort"),m0=Symbol("aborted"),eh=Symbol("signal"),Lc=Symbol("dataListeners"),oi=Symbol("discarded"),th=a(n=>Promise.resolve().then(n),"defer"),Jre=a(n=>n(),"nodefer"),Zre=a(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),ene=a(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),tne=a(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),g0=class{static{a(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Ou](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},iA=class extends g0{static{a(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)}},rne=a(n=>!!n.objectMode,"isObjectModeOptions"),nne=a(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Fa=class extends y0.EventEmitter{static{a(this,"Minipass")}[Dr]=!1;[Zd]=!1;[An]=[];[Lr]=[];[sn];[ts];[js];[Cu];[Mo]=!1;[Pa]=!1;[f0]=!1;[d0]=!1;[Jd]=null;[Nr]=0;[tr]=!1;[eh];[m0]=!1;[Lc]=0;[oi]=!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");rne(t)?(this[sn]=!0,this[ts]=null):nne(t)?(this[ts]=t.encoding,this[sn]=!1):(this[sn]=!1,this[ts]=null),this[js]=!!t.async,this[Cu]=this[ts]?new Kk.StringDecoder(this[ts]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:a(()=>this[Lr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:a(()=>this[An],"get")});let{signal:r}=t;r&&(this[eh]=r,r.aborted?this[nA]():r.addEventListener("abort",()=>this[nA]()))}get bufferLength(){return this[Nr]}get encoding(){return this[ts]}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[sn]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[js]}set async(e){this[js]=this[js]||!!e}[nA](){this[m0]=!0,this.emit("abort",this[eh]?.reason),this.destroy(this[eh]?.reason)}get aborted(){return this[m0]}set aborted(e){}write(e,t,r){if(this[m0])return!1;if(this[Mo])throw new Error("write after end");if(this[tr])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[js]?th:Jre;if(!this[sn]&&!Buffer.isBuffer(e)){if(tne(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(ene(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[sn]?(this[Dr]&&this[Nr]!==0&&this[h0](!0),this[Dr]?this.emit("data",e):this[Z2](e),this[Nr]!==0&&this.emit("readable"),r&&i(r),this[Dr]):e.length?(typeof e=="string"&&!(t===this[ts]&&!this[Cu]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ts]&&(e=this[Cu].write(e)),this[Dr]&&this[Nr]!==0&&this[h0](!0),this[Dr]?this.emit("data",e):this[Z2](e),this[Nr]!==0&&this.emit("readable"),r&&i(r),this[Dr]):(this[Nr]!==0&&this.emit("readable"),r&&i(r),this[Dr])}read(e){if(this[tr])return null;if(this[oi]=!1,this[Nr]===0||e===0||e&&e>this[Nr])return this[jo](),null;this[sn]&&(e=null),this[Lr].length>1&&!this[sn]&&(this[Lr]=[this[ts]?this[Lr].join(""):Buffer.concat(this[Lr],this[Nr])]);let t=this[Wk](e||null,this[Lr][0]);return this[jo](),t}[Wk](e,t){if(this[sn])this[p0]();else{let r=t;e===r.length||e===null?this[p0]():typeof r=="string"?(this[Lr][0]=r.slice(e),t=r.slice(0,e),this[Nr]-=e):(this[Lr][0]=r.subarray(e),t=r.subarray(0,e),this[Nr]-=e)}return this.emit("data",t),!this[Lr].length&&!this[Mo]&&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[Mo]=!0,this.writable=!1,(this[Dr]||!this[Zd])&&this[jo](),this}[Ou](){this[tr]||(!this[Lc]&&!this[An].length&&(this[oi]=!0),this[Zd]=!1,this[Dr]=!0,this.emit("resume"),this[Lr].length?this[h0]():this[Mo]?this[jo]():this.emit("drain"))}resume(){return this[Ou]()}pause(){this[Dr]=!1,this[Zd]=!0,this[oi]=!1}get destroyed(){return this[tr]}get flowing(){return this[Dr]}get paused(){return this[Zd]}[Z2](e){this[sn]?this[Nr]+=1:this[Nr]+=e.length,this[Lr].push(e)}[p0](){return this[sn]?this[Nr]-=1:this[Nr]-=this[Lr][0].length,this[Lr].shift()}[h0](e=!1){do;while(this[Hk](this[p0]())&&this[Lr].length);!e&&!this[Lr].length&&!this[Mo]&&this.emit("drain")}[Hk](e){return this.emit("data",e),this[Dr]}pipe(e,t){if(this[tr])return e;this[oi]=!1;let r=this[Pa];return t=t||{},e===Gk.stdout||e===Gk.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[An].push(t.proxyErrors?new iA(this,e,t):new g0(this,e,t)),this[js]?th(()=>this[Ou]()):this[Ou]()),e}unpipe(e){let t=this[An].find(r=>r.dest===e);t&&(this[An].length===1?(this[Dr]&&this[Lc]===0&&(this[Dr]=!1),this[An]=[]):this[An].splice(this[An].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[oi]=!1,this[Lc]++,!this[An].length&&!this[Dr]&&this[Ou]();else if(e==="readable"&&this[Nr]!==0)super.emit("readable");else if(Zre(e)&&this[Pa])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Jd]){let i=t;this[js]?th(()=>i.call(this,this[Jd])):i.call(this,this[Jd])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Lc]=this.listeners("data").length,this[Lc]===0&&!this[oi]&&!this[An].length&&(this[Dr]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Lc]=0,!this[oi]&&!this[An].length&&(this[Dr]=!1)),t}get emittedEnd(){return this[Pa]}[jo](){!this[f0]&&!this[Pa]&&!this[tr]&&this[Lr].length===0&&this[Mo]&&(this[f0]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[d0]&&this.emit("close"),this[f0]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==tr&&this[tr])return!1;if(e==="data")return!this[sn]&&!r?!1:this[js]?(th(()=>this[tA](r)),!0):this[tA](r);if(e==="end")return this[zk]();if(e==="close"){if(this[d0]=!0,!this[Pa]&&!this[tr])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Jd]=r,super.emit(eA,r);let s=!this[eh]||this.listeners("error").length?super.emit("error",r):!1;return this[jo](),s}else if(e==="resume"){let s=super.emit("resume");return this[jo](),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[jo](),i}[tA](e){for(let r of this[An])r.dest.write(e)===!1&&this.pause();let t=this[oi]?!1:super.emit("data",e);return this[jo](),t}[zk](){return this[Pa]?!1:(this[Pa]=!0,this.readable=!1,this[js]?(th(()=>this[rA]()),!0):this[rA]())}[rA](){if(this[Cu]){let t=this[Cu].end();if(t){for(let r of this[An])r.dest.write(t);this[oi]||super.emit("data",t)}}for(let t of this[An])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[sn]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[sn]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[sn])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ts]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(tr,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[oi]=!1;let e=!1,t=a(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:a(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Mo])return t();let s,o,c=a(d=>{this.off("data",l),this.off("end",u),this.off(tr,f),t(),o(d)},"onerr"),l=a(d=>{this.off("error",c),this.off("end",u),this.off(tr,f),this.pause(),s({value:d,done:!!this[Mo]})},"ondata"),u=a(()=>{this.off("error",c),this.off("data",l),this.off(tr,f),t(),s({done:!0,value:void 0})},"onend"),f=a(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,h)=>{o=h,s=d,this.once(tr,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[oi]=!1;let e=!1,t=a(()=>(this.pause(),this.off(eA,t),this.off(tr,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=a(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(eA,t),this.once(tr,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[tr])return e?this.emit("error",e):this.emit(tr),this;this[tr]=!0,this[oi]=!0,this[Lr].length=0,this[Nr]=0;let t=this;return typeof t.close=="function"&&!this[d0]&&t.close(),e?this.emit("error",e):this.emit(tr),this}static get isStream(){return Yre}};var sne=Us.realpathSync.native,nh={lstatSync:Us.lstatSync,readdir:Us.readdir,readdirSync:Us.readdirSync,readlinkSync:Us.readlinkSync,realpathSync:sne,promises:{lstat:Da.lstat,readdir:Da.readdir,readlink:Da.readlink,realpath:Da.realpath}},eM=a(n=>!n||n===nh||n===ine?nh:{...nh,...n,promises:{...nh.promises,...n.promises||{}}},"fsFromOption"),tM=/^\\\\\?\\([a-z]:)\\?$/i,one=a(n=>n.replace(/\//g,"\\").replace(tM,"$1\\"),"uncToDrive"),ane=/[\\\/]/,yi=0,rM=1,nM=2,$s=4,iM=6,sM=8,Nc=10,oM=12,gi=15,rh=~gi,oA=16,Yk=32,ih=64,rs=128,b0=256,S0=512,Qk=ih|rs|S0,cne=1023,aA=a(n=>n.isFile()?sM:n.isDirectory()?$s:n.isSymbolicLink()?Nc:n.isCharacterDevice()?nM:n.isBlockDevice()?iM:n.isSocket()?oM:n.isFIFO()?rM:yi,"entToType"),Xk=new Map,sh=a(n=>{let e=Xk.get(n);if(e)return e;let t=n.normalize("NFKD");return Xk.set(n,t),t},"normalize"),Jk=new Map,_0=a(n=>{let e=Jk.get(n);if(e)return e;let t=sh(n.toLowerCase());return Jk.set(n,t),t},"normalizeNocase"),w0=class extends Xd{static{a(this,"ResolveCache")}constructor(){super({max:256})}},cA=class extends Xd{static{a(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:a(t=>t.length+1,"sizeCalculation")})}},aM=Symbol("PathScurry setAsCwd"),on=class{static{a(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}#b;get gid(){return this.#b}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#o;get blocks(){return this.#o}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#d;get ctimeMs(){return this.#d}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#_;#v;#S;#w;#I;#x;#a;#F;#A;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=yi,r,i,s,o,c){this.name=e,this.#_=s?_0(e):sh(e),this.#a=t&cne,this.nocase=s,this.roots=i,this.root=r||this,this.#F=o,this.#S=c.fullpath,this.#I=c.relative,this.#x=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=eM(c.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#a&=~oA,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?_0(e):sh(e);for(let l of r)if(l.#_===i)return l;let s=this.parent?this.sep:"",o=this.#S?this.#S+s+e:void 0,c=this.newChild(e,yi,{...t,parent:this,fullpath:o});return this.canReaddir()||(c.#a|=rs),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let e=this.name,t=this.parent;if(!t)return this.#I=this.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.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#S=i}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#a&gi)===yi}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.#a&gi)===sM}isDirectory(){return(this.#a&gi)===$s}isCharacterDevice(){return(this.#a&gi)===nM}isBlockDevice(){return(this.#a&gi)===iM}isFIFO(){return(this.#a&gi)===rM}isSocket(){return(this.#a&gi)===oM}isSymbolicLink(){return(this.#a&Nc)===Nc}lstatCached(){return this.#a&Yk?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#A)return!0;if(!this.parent)return!1;let e=this.#a&gi;return!(e!==yi&&e!==Nc||this.#a&b0||this.#a&rs)}calledReaddir(){return!!(this.#a&oA)}isENOENT(){return!!(this.#a&rs)}isNamed(e){return this.nocase?this.#_===_0(e):this.#_===sh(e)}async readlink(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}#L(e){this.#a|=oA;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#N()}}#N(){this.#a&rs||(this.#a=(this.#a|rs)&rh,this.#R())}#R(){let e=this.children();e.provisional=0;for(let t of e)t.#N()}#C(){this.#a|=S0,this.#k()}#k(){if(this.#a&ih)return;let e=this.#a;(e&gi)===$s&&(e&=rh),this.#a=e|ih,this.#R()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#N():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#N()}#h(e=""){let t=this.#a;t|=b0,e==="ENOENT"&&(t|=rs),(e==="EINVAL"||e==="UNKNOWN")&&(t&=rh),this.#a=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#P(e,t)||this.#U(e,t)}#U(e,t){let r=aA(e),i=this.newChild(e.name,r,{parent:this}),s=i.#a&gi;return s!==$s&&s!==Nc&&s!==yi&&(i.#a|=ih),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?_0(e.name):sh(e.name))===i.#_)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#a=t.#a&rh|aA(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.#a&rs)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#a&rs)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#j(e.code)}}#W(e){let{atime:t,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:o,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:h,mode:p,mtime:g,mtimeMs:y,nlink:b,rdev:S,size:v,uid:I}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=o,this.#o=c,this.#E=l,this.#d=u,this.#n=f,this.#b=d,this.#s=h,this.#r=p,this.#f=g,this.#g=y,this.#t=b,this.#i=S,this.#l=v,this.#c=I;let A=aA(e);this.#a=this.#a&rh|A|Yk,A!==yi&&A!==$s&&A!==Nc&&(this.#a|=ih)}#q=[];#G=!1;#H(e){this.#G=!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.#G)return;this.#G=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#M(s.code),r.provisional=0;else{for(let c of o)this.#$(c,r);this.#L(r)}this.#H(r.slice(0,r.provisional))})}#V;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#V)await this.#V;else{let r=a(()=>{},"resolve");this.#V=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#L(e)}catch(i){this.#M(i.code),e.provisional=0}this.#V=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.#L(e)}catch(r){this.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#a&Qk)return!1;let e=gi&this.#a;return e===yi||e===$s||e===Nc}shouldWalk(e,t){return(this.#a&$s)===$s&&!(this.#a&Qk)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((S0|b0|rs)&this.#a))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#C()}}realpathSync(){if(this.#O)return this.#O;if(!((S0|b0|rs)&this.#a))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#C()}}[aM](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.#I=r.join(this.sep),i.#x=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#I=void 0,i.#x=void 0,i=i.parent}},v0=class n extends on{static{a(this,"PathWin32")}sep="\\";splitSep=ane;constructor(e,t=yi,r,i,s,o,c){super(e,t,r,i,s,o,c)}newChild(e,t=yi,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return Pu.win32.parse(e).root}getRoot(e){if(e=one(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 Fu(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(tM,"$1\\"),e===t}},E0=class n extends on{static{a(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=yi,r,i,s,o,c){super(e,t,r,i,s,o,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=yi,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},T0=class{static{a(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:o=nh}={}){this.#t=eM(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,Zk.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new w0,this.#n=new w0,this.#r=new cA(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,h=this.rootPath,p=!1;for(let g of l){let y=f--;u=u.child(g,{relative:new Array(y).fill("..").join(d),relativePosix:new Array(y).fill("..").join("/"),fullpath:h+=(p?"":d)+g}),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 o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))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 o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))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 on||(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 on||(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 on||(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 on||(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 on||(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 on||(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 on||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=a((d,h)=>{l.add(d),d.readdirCB((p,g)=>{if(p)return h(p);let y=g.length;if(!y)return h();let b=a(()=>{--y===0&&h()},"next");for(let S of g)(!s||s(S))&&c.push(r?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(l,o)?u(v,b):b()):S.shouldWalk(l,o)?u(S,b):b()},!0)},"walk"),f=e;return new Promise((d,h)=>{u(f,p=>{if(p)return h(p);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof on||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let d of f){(!s||s(d))&&c.push(r?d:d.fullpath());let h=d;if(d.isSymbolicLink()){if(!(i&&(h=d.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(l,o)&&l.add(h)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof on||(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 on||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t;(!s||s(e))&&(yield r?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let f of u){(!s||s(f))&&(yield r?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,o)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof on||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Fa({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=a(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let g=a((b,S,v=!1)=>{if(b)return c.emit("error",b);if(i&&!v){let I=[];for(let A of S)A.isSymbolicLink()&&I.push(A.realpath().then(T=>T?.isUnknown()?T.lstat():T));if(I.length){Promise.all(I).then(()=>g(null,S,!0));return}}for(let I of S)I&&(!s||s(I))&&(c.write(r?I:I.fullpath())||(h=!0));f--;for(let I of S){let A=I.realpathCached()||I;A.shouldWalk(l,o)&&u.push(A)}h&&!c.flowing?c.once("drain",d):y||d()},"onReaddir"),y=!0;p.readdirCB(g,!0),y=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof on||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Fa({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=a(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let g=p.readdirSync();for(let y of g)(!s||s(y))&&(c.write(r?y:y.fullpath())||(h=!0));f--;for(let y of g){let b=y;if(y.isSymbolicLink()){if(!(i&&(b=y.realpathSync())))continue;b.isUnknown()&&b.lstatSync()}b.shouldWalk(l,o)&&u.push(b)}}h&&!c.flowing&&c.once("drain",d)},"process");return d(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[aM](t)}},Fu=class extends T0{static{a(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,Pu.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Pu.win32.parse(e).root.toUpperCase()}newRoot(e){return new v0(this.rootPath,$s,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Du=class extends T0{static{a(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,Pu.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new E0(this.rootPath,$s,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},oh=class extends Du{static{a(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},KSe=process.platform==="win32"?v0:E0,cM=process.platform==="win32"?Fu:process.platform==="darwin"?oh:Du;var lne=a(n=>n.length>=1,"isPatternList"),une=a(n=>n.length>=1,"isGlobList"),Lu=class n{static{a(this,"Pattern")}#e;#n;#r;length;#t;#c;#b;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!lne(e))throw new TypeError("empty pattern list");if(!une(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,o,c,l,...u]=this.#e,[f,d,h,p,...g]=this.#n;u[0]===""&&(u.shift(),g.shift());let y=[s,o,c,l,""].join("/"),b=[f,d,h,p,""].join("/");this.#e=[y,...u],this.#n=[b,...g],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[c,...l]=this.#n;o[0]===""&&(o.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...o],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]===er}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#b=this.#b||(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 fne=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Nu=class{static{a(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:o=fne}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new si(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 o=new Lu(i,s,0,this.platform),c=new si(o.globString(),this.mmopts),l=s[s.length-1]==="**",u=o.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(t)||o.match(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 lA=class n{static{a(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()]))}},uA=class{static{a(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)])}},fA=class{static{a(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())}},ah=class n{static{a(this,"Processor")}hasWalkedCache;matches=new uA;subwalks=new fA;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new lA}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 o=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)i=i.resolve(l),s=u,f=!0;if(l=s.pattern(),u=s.rest(),f){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof l=="string"){let d=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,d);continue}else if(l===er){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),h=u?.rest();if(!u||(d===""||d===".")&&!h)this.matches.add(i,c,d===""||d===".");else if(d===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):this.matches.add(p,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let r=this.subwalks.get(e),i=this.child();for(let s of t)for(let o of r){let c=o.isAbsolute(),l=o.pattern(),u=o.rest();l===er?i.testGlobstar(s,o,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,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 o=e.parent||e;this.subwalks.add(o,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 dne=a((n,e)=>typeof n=="string"?new Nu([n],e):Array.isArray(n)?new Nu(n,e):n,"makeIgnore"),A0=class{static{a(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=dne(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 o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(s,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#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 o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.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(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?o+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 ah(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,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>o()));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,o):c.readdirCB((u,f)=>this.walkCB3(c,f,r,o),!0)}o()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>o()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),o);o()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new ah(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,o=a(()=>{--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,o)}o()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,o=a(()=>{--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(),o);o()}},ch=class extends A0{static{a(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}},lh=class extends A0{static{a(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Fa({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 hne=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ns=class{static{a(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,lM.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||hne,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"?Fu:t.platform==="darwin"?oh:t.platform?Du:cM;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 si(l,i)),[o,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Lu(l,f,0,this.platform)})}async walk(){return[...await new ch(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 ch(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 lh(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 lh(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 dA=a((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new si(t,e).hasMagic())return!0;return!1},"hasMagic");function I0(n,e={}){return new ns(n,e).streamSync()}a(I0,"globStreamSync");function fM(n,e={}){return new ns(n,e).stream()}a(fM,"globStream");function dM(n,e={}){return new ns(n,e).walkSync()}a(dM,"globSync");async function uM(n,e={}){return new ns(n,e).walk()}a(uM,"glob_");function x0(n,e={}){return new ns(n,e).iterateSync()}a(x0,"globIterateSync");function hM(n,e={}){return new ns(n,e).iterate()}a(hM,"globIterate");var pne=I0,mne=Object.assign(fM,{sync:I0}),gne=x0,yne=Object.assign(hM,{sync:x0}),bne=Object.assign(dM,{stream:I0,iterate:x0}),La=Object.assign(uM,{glob:uM,globSync:dM,sync:bne,globStream:fM,stream:mne,globStreamSync:I0,streamSync:pne,globIterate:hM,iterate:yne,globIterateSync:x0,iterateSync:gne,Glob:ns,hasMagic:dA,escape:Iu,unescape:es});La.glob=La;async function pM(n,e,t,r={}){let{dryRun:i=!1,excludeRelPath:s}=r,o=kc.default.join(n,"**/*.md"),c=await La(o,{nodir:!0,ignore:[kc.default.join(n,".obsidian/**"),kc.default.join(n,".trash/**"),kc.default.join(n,"**/.obsidian/**"),kc.default.join(n,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=kc.default.relative(n,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await pA.default.readFile(u,"utf-8")}catch{continue}let{updated:h,replacements:p}=_ne(d,e,t);p>0&&(l.filesModified+=1,l.replacements+=p,l.modifiedFiles.push(f),i||await pA.default.writeFile(u,h,"utf-8"))}return l}a(pM,"rewriteInboundWikilinks");function _ne(n,e,t){let r=n.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let o=r[s],c=Sne(o,e,t);i+=c.replacements,r[s]=c.updated}return{updated:r.join(""),replacements:i}}a(_ne,"rewriteContent");function Sne(n,e,t){let r=n.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let o=wne(r[s],e,t);i+=o.replacements,r[s]=o.updated}return{updated:r.join(""),replacements:i}}a(Sne,"rewriteProseSegment");function wne(n,e,t){let r=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:n.replace(r,(o,c,l)=>c.trim()!==e?o:(i+=1,`[[${t}${l}]]`)),replacements:i}}a(wne,"replaceWikilinks");var vne=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Xt=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{a(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await pr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return pr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await pr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await pr.default.ensureDir(rr.default.dirname(r)),await pr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await pr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await pr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await pr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await pr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return pr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=pr.default.statSync(t);if(r.isFile())return this.createFileObject(e);if(r.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let r=rr.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=pr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let r=await this.read(e),i=this.extractFrontmatter(r)||{},s=t(i),o=this.replaceFrontmatter(r,s);await this.modify(e,o)}async rename(e,t){let r=this.resolvePath(e.path),i=this.resolvePath(t);if(!await pr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await pr.default.ensureDir(rr.default.dirname(i)),await pr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await pr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(vne.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=rr.default.dirname(this.resolvePath(t)),s;if(rr.default.isAbsolute(r)?s=this.resolvePath(r):s=rr.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),pr.default.existsSync(s)){let u=rr.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let o=r.toLowerCase(),c=this.basenameIndex.get(o);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(o);return l?this.createFileObject(l):null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=rr.default.relative(this.rootPath,e),r=rr.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=pr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let o=s.aliases,c=Array.isArray(o)?o:typeof o=="string"?[o]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let r=rr.default.basename(e,".md").match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(r){let i=r[1].toLowerCase(),s=rr.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let r=await this.read(e),i=t(r);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,r){let i=rr.default.basename(t,".md");await pM(this.rootPath,r,i,{excludeRelPath:e})}resolvePath(e){return rr.default.isAbsolute(e)?e:rr.default.join(this.rootPath,e)}createFileObject(e){let t=rr.default.basename(e),r=rr.default.basename(e,rr.default.extname(e)),i=rr.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:rr.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=Dt.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=Dt.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
|
|
367
|
+
`+n.slice(o+1):l+=n.slice(i),l.slice(1)}a(EN,"foldLine");function Lte(n){for(var e="",t=0,r,i=0;i<n.length;t>=65536?i+=2:i++)t=qd(n,i),r=sn[t],!r&&zd(t)?(e+=n[i],t>=65536&&(e+=n[i+1])):e+=r||Ate(t);return e}a(Lte,"escapeString");function Nte(n,e,t){var r="",i=n.tag,s,o,c;for(s=0,o=t.length;s<o;s+=1)c=t[s],n.replacer&&(c=n.replacer.call(t,String(s),c)),(ko(n,e,c,!1,!1)||typeof c>"u"&&ko(n,e,null,!1,!1))&&(r!==""&&(r+=","+(n.condenseFlow?"":" ")),r+=n.dump);n.tag=i,n.dump="["+r+"]"}a(Nte,"writeFlowSequence");function TN(n,e,t,r){var i="",s=n.tag,o,c,l;for(o=0,c=t.length;o<c;o+=1)l=t[o],n.replacer&&(l=n.replacer.call(t,String(o),l)),(ko(n,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&ko(n,e+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=j2(n,e)),n.dump&&Wd===n.dump.charCodeAt(0)?i+="-":i+="- ",i+=n.dump);n.tag=s,n.dump=i||"[]"}a(TN,"writeBlockSequence");function kte(n,e,t){var r="",i=n.tag,s=Object.keys(t),o,c,l,u,f;for(o=0,c=s.length;o<c;o+=1)f="",r!==""&&(f+=", "),n.condenseFlow&&(f+='"'),l=s[o],u=t[l],n.replacer&&(u=n.replacer.call(t,l,u)),ko(n,e,l,!1,!1)&&(n.dump.length>1024&&(f+="? "),f+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),ko(n,e,u,!1,!1)&&(f+=n.dump,r+=f));n.tag=i,n.dump="{"+r+"}"}a(kte,"writeFlowMapping");function Mte(n,e,t,r){var i="",s=n.tag,o=Object.keys(t),c,l,u,f,d,h;if(n.sortKeys===!0)o.sort();else if(typeof n.sortKeys=="function")o.sort(n.sortKeys);else if(n.sortKeys)throw new En("sortKeys must be a boolean or a function");for(c=0,l=o.length;c<l;c+=1)h="",(!r||i!=="")&&(h+=j2(n,e)),u=o[c],f=t[u],n.replacer&&(f=n.replacer.call(t,u,f)),ko(n,e+1,u,!0,!0,!0)&&(d=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024,d&&(n.dump&&Wd===n.dump.charCodeAt(0)?h+="?":h+="? "),h+=n.dump,d&&(h+=j2(n,e)),ko(n,e+1,f,!0,d)&&(n.dump&&Wd===n.dump.charCodeAt(0)?h+=":":h+=": ",h+=n.dump,i+=h));n.tag=s,n.dump=i||"{}"}a(Mte,"writeBlockMapping");function AN(n,e,t){var r,i,s,o,c,l;for(i=t?n.explicitTypes:n.implicitTypes,s=0,o=i.length;s<o;s+=1)if(c=i[s],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof e=="object"&&e instanceof c.instanceOf)&&(!c.predicate||c.predicate(e))){if(t?c.multi&&c.representName?n.tag=c.representName(e):n.tag=c.tag:n.tag="?",c.represent){if(l=n.styleMap[c.tag]||c.defaultStyle,nk.call(c.represent)==="[object Function]")r=c.represent(e,l);else if(ik.call(c.represent,l))r=c.represent[l](e,l);else throw new En("!<"+c.tag+'> tag resolver accepts not "'+l+'" style');n.dump=r}return!0}return!1}a(AN,"detectType");function ko(n,e,t,r,i,s,o){n.tag=null,n.dump=t,AN(n,t,!1)||AN(n,t,!0);var c=nk.call(n.dump),l=r,u;r&&(r=n.flowLevel<0||n.flowLevel>e);var f=c==="[object Object]"||c==="[object Array]",d,h;if(f&&(d=n.duplicates.indexOf(t),h=d!==-1),(n.tag!==null&&n.tag!=="?"||h||n.indent!==2&&e>0)&&(i=!1),h&&n.usedDuplicates[d])n.dump="*ref_"+d;else{if(f&&h&&!n.usedDuplicates[d]&&(n.usedDuplicates[d]=!0),c==="[object Object]")r&&Object.keys(n.dump).length!==0?(Mte(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(kte(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object Array]")r&&n.dump.length!==0?(n.noArrayIndent&&!o&&e>0?TN(n,e-1,n.dump,i):TN(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(Nte(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object String]")n.tag!=="?"&&Fte(n,n.dump,e,s,l);else{if(c==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new En("unacceptable kind of an object to dump "+c)}n.tag!==null&&n.tag!=="?"&&(u=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21"),n.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",n.dump=u+" "+n.dump)}return!0}a(ko,"writeNode");function jte(n,e){var t=[],r=[],i,s;for(U2(n,t,r),i=0,s=r.length;i<s;i+=1)e.duplicates.push(t[r[i]]);e.usedDuplicates=new Array(s)}a(jte,"getDuplicateReferences");function U2(n,e,t){var r,i,s;if(n!==null&&typeof n=="object")if(i=e.indexOf(n),i!==-1)t.indexOf(i)===-1&&t.push(i);else if(e.push(n),Array.isArray(n))for(i=0,s=n.length;i<s;i+=1)U2(n[i],e,t);else for(r=Object.keys(n),i=0,s=r.length;i<s;i+=1)U2(n[r[i]],e,t)}a(U2,"inspectNode");function $te(n,e){e=e||{};var t=new xte(e);t.noRefs||jte(n,t);var r=n;return t.replacer&&(r=t.replacer.call({"":r},"",r)),ko(t,0,r,!0,!0)?t.dump+`
|
|
368
|
+
`:""}a($te,"dump$1");var Ute=$te,Bte={dump:Ute};function H2(n,e){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}a(H2,"renamed");var Vte=zr,qte=RN,Gte=FN,Wte=MN,Hte=jN,zte=V2,Kte=rk.load,Yte=rk.loadAll,Qte=Bte.dump,Xte=En,Jte={binary:qN,float:kN,map:PN,null:DN,pairs:WN,set:HN,timestamp:BN,bool:LN,int:NN,merge:VN,omap:GN,seq:ON,str:CN},Zte=H2("safeLoad","load"),ere=H2("safeLoadAll","loadAll"),tre=H2("safeDump","dump"),Dt={Type:Vte,Schema:qte,FAILSAFE_SCHEMA:Gte,JSON_SCHEMA:Wte,CORE_SCHEMA:Hte,DEFAULT_SCHEMA:zte,load:Kte,loadAll:Yte,dump:Qte,YAMLException:Xte,types:Jte,safeLoad:Zte,safeLoadAll:ere,safeDump:tre};var pA=se(No()),kc=se(require("path"));var Nk=se(Ik(),1);var Yd=a(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var lre={"[: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]},Qd=a(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),ure=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),xk=a(n=>n.join(""),"rangesToString"),Rk=a((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,o=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<n.length;){let y=n.charAt(s);if((y==="!"||y==="^")&&s===t+1){u=!0,s++;continue}if(y==="]"&&o&&!l){f=s+1;break}if(o=!0,y==="\\"&&!l){l=!0,s++;continue}if(y==="["&&!l){for(let[b,[S,v,I]]of Object.entries(lre))if(n.startsWith(b,s)){if(d)return["$.",!1,n.length-t,!0];s+=b.length,I?i.push(S):r.push(S),c=c||v;continue e}}if(l=!1,d){y>d?r.push(Qd(d)+"-"+Qd(y)):y===d&&r.push(Qd(y)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Qd(y+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=y,s+=2;continue}r.push(Qd(y)),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 y=r[0].length===2?r[0].slice(-1):r[0];return[ure(y),!1,f-t,!1]}let h="["+(u?"^":"")+xk(r)+"]",p="["+(u?"":"^")+xk(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var es=a((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Wn,fre=new Set(["!","?","+","*","@"]),Y2=a(n=>fre.has(n),"isExtglobType"),Ck=a(n=>Y2(n.type),"isExtglobAST"),dre=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),hre=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),pre=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Ok=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),mre="(?!(?:^|/)\\.\\.?(?:$|/))",l0="(?!\\.)",gre=new Set(["[","."]),yre=new Set(["..","."]),bre=new Set("().*{}+?[]^$\\!"),_re=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Q2="[^/]",Pk=Q2+"*?",Fk=Q2+"+?",Dc=class{static{a(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#b;#i;#u=!1;#s;#l;#o=!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.#b=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.#b+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 Wn&&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.#b===0)return!0;let e=this.#c;for(let t=0;t<this.#b;t++){let r=e.#t[t];if(!(r instanceof Wn&&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.#b===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Wn(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let o=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let y=r,b="";for(;y<e.length;){let S=e.charAt(y++);if(c||S==="\\"){c=!c,b+=S;continue}if(l){y===u+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(y===u+2&&f)&&(l=!1),b+=S;continue}else if(S==="["){l=!0,u=y,f=!1,b+=S;continue}if(!i.noext&&Y2(S)&&e.charAt(y)==="("&&s<=o){t.push(b),b="";let I=new Wn(S,t);y=Wn.#g(e,I,y,i,s+1),t.push(I);continue}b+=S}return t.push(b),y}let d=r+1,h=new Wn(null,t),p=[],g="";for(;d<e.length;){let y=e.charAt(d++);if(c||y==="\\"){c=!c,g+=y;continue}if(l){d===u+1?(y==="^"||y==="!")&&(f=!0):y==="]"&&!(d===u+2&&f)&&(l=!1),g+=y;continue}else if(y==="["){l=!0,u=d,f=!1,g+=y;continue}if(Y2(y)&&e.charAt(d)==="("&&(s<=o||t&&t.#y(y))){let S=t&&t.#y(y)?0:1;h.push(g),g="";let v=new Wn(y,h);h.push(v),d=Wn.#g(e,v,d,i,s+S);continue}if(y==="|"){h.push(g),g="",p.push(h),h=new Wn(null,t);continue}if(y===")")return g===""&&t.#t.length===0&&(t.#o=!0),h.push(g),g="",t.push(...p,h),d;g+=y}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,hre)}#m(e,t=dre){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=pre){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Wn(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!!Ok.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)}#v(e){let t=Ok.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.#o=!1}#S(){if(Ck(this)){let e=0,t=!1;do{t=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#S(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#_(i)&&(t=!1,this.#v(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#S();this.#l=void 0}static fromGlob(e,t={}){let r=new Wn(null,void 0,t);return Wn.#g(e,r,0,t,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let c=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#e===this&&(this.#S(),this.#p()),!Ck(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[g,y,b,S]=typeof p=="string"?Wn.#I(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||b,this.#r=this.#r||S,g}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&yre.has(this.#t[0]))){let g=gre,y=t&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),b=!t&&!e&&g.has(u.charAt(0));f=y?mre:b?l0:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,es(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#w(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#n=void 0,[l,es(this.toString()),!1,!1]}let o=!r||e||t||!l0?"":this.#w(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let c="";if(this.type==="!"&&this.#o)c=(this.isStart()&&!t?l0:"")+Fk;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?l0:"")+Pk+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+s+l}return[c,es(s),this.#n=!!this.#n,this.#r]}#w(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=t.toRegExpSource(e);return this.#r=this.#r||o,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#I(e,t,r=!1){let i=!1,s="",o=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(bre.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=Rk(e,l);if(h){s+=f,o=o||d,l+=h-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?Fk:Pk,t=!0;continue}else c=!1;if(u==="?"){s+=Q2,t=!0;continue}s+=_re(u)}return[s,es(e),!!t,o]}};Wn=Dc;var Iu=a((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Tn=a((n,e,t={})=>(Yd(e),!t.nocomment&&e.charAt(0)==="#"?!1:new si(e,t).match(n)),"minimatch"),Sre=/^\*+([^+@!?\*\[\(]*)$/,wre=a(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),vre=a(n=>e=>e.endsWith(n),"starDotExtTestDot"),Ere=a(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),Tre=a(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),Are=/^\*+\.\*+$/,Ire=a(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),xre=a(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),Rre=/^\.\*+$/,Cre=a(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),Ore=/^\*+$/,Pre=a(n=>n.length!==0&&!n.startsWith("."),"starTest"),Fre=a(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),Dre=/^\?+([^+@!?\*\[\(]*)?$/,Lre=a(([n,e=""])=>{let t=kk([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),Nre=a(([n,e=""])=>{let t=Mk([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),kre=a(([n,e=""])=>{let t=Mk([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),Mre=a(([n,e=""])=>{let t=kk([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),kk=a(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),Mk=a(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),jk=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Dk={win32:{sep:"\\"},posix:{sep:"/"}},jre=jk==="win32"?Dk.win32.sep:Dk.posix.sep;Tn.sep=jre;var er=Symbol("globstar **");Tn.GLOBSTAR=er;var $re="[^/]",Ure=$re+"*?",Bre="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Vre="(?:(?!(?:\\/|^)\\.).)*?",qre=a((n,e={})=>t=>Tn(t,n,e),"filter");Tn.filter=qre;var mi=a((n,e={})=>Object.assign({},n,e),"ext"),Gre=a(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Tn;let e=Tn;return Object.assign(a((r,i,s={})=>e(r,i,mi(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,mi(n,s))}static defaults(i){return e.defaults(mi(n,i)).Minimatch}},AST:class extends e.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,mi(n,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,mi(n,s))}},unescape:a((r,i={})=>e.unescape(r,mi(n,i)),"unescape"),escape:a((r,i={})=>e.escape(r,mi(n,i)),"escape"),filter:a((r,i={})=>e.filter(r,mi(n,i)),"filter"),defaults:a(r=>e.defaults(mi(n,r)),"defaults"),makeRe:a((r,i={})=>e.makeRe(r,mi(n,i)),"makeRe"),braceExpand:a((r,i={})=>e.braceExpand(r,mi(n,i)),"braceExpand"),match:a((r,i,s={})=>e.match(r,i,mi(n,s)),"match"),sep:e.sep,GLOBSTAR:er})},"defaults");Tn.defaults=Gre;var $k=a((n,e={})=>(Yd(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,Nk.default)(n)),"braceExpand");Tn.braceExpand=$k;var Wre=a((n,e={})=>new si(n,e).makeRe(),"makeRe");Tn.makeRe=Wre;var Hre=a((n,e,t={})=>{let r=new si(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Tn.match=Hre;var Lk=/[?*]|[+@!]\(.*?\)|\[|\]/,zre=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),si=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){Yd(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||jk,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,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!Lk.test(s[2]))&&!Lk.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let 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 o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-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 o=1;o<r.length-1;o++){let c=r[o];o===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){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,o=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])o.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",o.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),d=l?3:c?0:void 0,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,g]=[e[d],t[h]];p.toLowerCase()===g.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(er)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let o=t.indexOf(er,s),c=t.lastIndexOf(er),[l,u,f]=r?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,c),t.slice(c+1)];if(l.length){let v=e.slice(i,i+l.length);if(!this.#r(v,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let v=e.length-f.length;if(this.#r(e,f,r,v,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(v--,!this.#r(e,f,r,v,0)))return!1;d=f.length+1}}if(!u.length){let v=!!d;for(let I=i;I<e.length-d;I++){let A=String(e[I]);if(v=!0,A==="."||A===".."||!this.options.dot&&A.startsWith("."))return!1}return r||v}let h=[[[],0]],p=h[0],g=0,y=[0];for(let v of u)v===er?(y.push(g),p=[[],0],h.push(p)):(p[0].push(v),g++);let b=h.length-1,S=e.length-d;for(let v of h)v[1]=S-(y[b--]+v[0].length);return!!this.#n(e,h,i,0,r,0,!!d)}#n(e,t,r,i,s,o,c){let l=t[i];if(!l){for(let d=r;d<e.length;d++){c=!0;let h=e[d];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return c}let[u,f]=l;for(;r<=f;){if(this.#r(e.slice(0,r+u.length),u,s,r,0)&&o<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,o+1,c);if(p!==!1)return p}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let o,c,l,u;for(o=i,c=s,u=e.length,l=t.length;o<u&&c<l;o++,c++){this.debug("matchOne loop");let f=t[c],d=e[o];if(this.debug(t,f,d),f===!1||f===er)return!1;let h;if(typeof f=="string"?(h=d===f,this.debug("string match",f,d,h)):(h=f.test(d),this.debug("pattern match",f,d,h)),!h)return!1}if(o===u&&c===l)return!0;if(o===u)return r;if(c===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return $k(this.pattern,this.options)}parse(e){Yd(e);let t=this.options;if(e==="**")return er;if(e==="")return"";let r,i=null;(r=e.match(Ore))?i=t.dot?Fre:Pre:(r=e.match(Sre))?i=(t.nocase?t.dot?Tre:Ere:t.dot?vre:wre)(r[1]):(r=e.match(Dre))?i=(t.nocase?t.dot?Nre:Lre:t.dot?kre:Mre)(r):(r=e.match(Are))?i=t.dot?xre:Ire:(r=e.match(Rre))&&(i=Cre);let s=Dc.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?Ure:t.dot?Bre:Vre,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?zre(f):f===er?er:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==er||p===er||(p===void 0?h!==void 0&&h!==er?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==er&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=er))}),u.filter(f=>f!==er).join("/")}).join("|"),[o,c]=e.length>1?["(?:",")"]:["",""];s="^"+o+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 o=i[i.length-1];if(!o)for(let c=i.length-2;!o&&c>=0;c--)o=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[o]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Tn.defaults(e).Minimatch}};Tn.AST=Dc;Tn.Minimatch=si;Tn.escape=Iu;Tn.unescape=es;var lM=require("node:url");var xu=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Bk=new Set,X2=typeof process=="object"&&process?process:{},Vk=a((n,e,t,r)=>{typeof X2.emitWarning=="function"?X2.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),u0=globalThis.AbortController,Uk=globalThis.AbortSignal;if(typeof u0>"u"){Uk=class{static{a(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},u0=class{static{a(this,"AbortController")}constructor(){e()}signal=new Uk;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=X2.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=a(()=>{n&&(n=!1,Vk("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 Kre=a(n=>!Bk.has(n),"shouldWarn");var Oa=a(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),qk=a(n=>Oa(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ru:null:null,"getUintArray"),Ru=class extends Array{static{a(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},J2=class n{static{a(this,"Stack")}heap;length;static#e=!1;static create(e){let t=qk(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]}},Xd=class n{static{a(this,"LRUCache")}#e;#n;#r;#t;#c;#b;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#o;#p;#g;#d;#m;#y;#f;#E;#T;#_;#v;#S;#w;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#o,next:e.#p,prev:e.#g,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:a(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:a((t,r,i,s)=>e.#j(t,r,i,s),"backgroundFetch"),moveToTail:a(t=>e.#U(t),"moveToTail"),indexes:a(t=>e.#R(t),"indexes"),rindexes:a(t=>e.#C(t),"rindexes"),isStale:a(t=>e.#A(t),"isStale")}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#i}get fetchMethod(){return this.#c}get memoMethod(){return this.#b}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:h,maxSize:p=0,maxEntrySize:g=0,sizeCalculation:y,fetchMethod:b,memoMethod:S,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:T,ignoreFetchAbort:R}=e;if(t!==0&&!Oa(t))throw new TypeError("max option must be a nonnegative integer");let V=t?qk(t):Array;if(!V)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=g||this.#n,this.sizeCalculation=y,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.#b=S,b!==void 0&&typeof b!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=b,this.#S=!!b,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#o=new Array(t).fill(void 0),this.#p=new V(t),this.#g=new V(t),this.#d=0,this.#m=0,this.#y=J2.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#v=!!this.#r,this.#w=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!R,this.maxEntrySize!==0){if(this.#n!==0&&!Oa(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Oa(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=Oa(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Oa(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}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 L="LRU_CACHE_UNBOUNDED";Kre(L)&&(Bk.add(L),Vk("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",L,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#I(){let e=new Ru(this.#e),t=new Ru(this.#e);this.#_=e,this.#T=t,this.#F=(s,o,c=xu.now())=>{if(t[s]=o!==0?c:0,e[s]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#P(this.#l[s],"expire")},o+1);l.unref&&l.unref()}},this.#x=s=>{t[s]=e[s]!==0?xu.now():0},this.#a=(s,o)=>{if(e[o]){let c=e[o],l=t[o];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=a(()=>{let s=xu.now();if(this.ttlResolution>0){r=s;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref()}return s},"getNow");this.getRemainingTTL=s=>{let o=this.#s.get(s);if(o===void 0)return 0;let c=e[o],l=t[o];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#A=s=>{let o=t[s],c=e[s];return!!c&&!!o&&(r||i())-o>c}}#x=a(()=>{},"#updateItemAge");#a=a(()=>{},"#statusTTL");#F=a(()=>{},"#setItemTTL");#A=a(()=>!1,"#isStale");#O(){let e=new Ru(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#N=(t,r,i,s)=>{if(this.#h(r))return 0;if(!Oa(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Oa(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.#L=(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=a(e=>{},"#removeItemSize");#L=a((e,t,r)=>{},"#addItemSize");#N=a((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#R({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#C({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#m));)t=this.#p[t]}#k(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#R())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*rentries(){for(let e of this.#C())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*keys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*rkeys(){for(let e of this.#C()){let t=this.#l[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*values(){for(let e of this.#R())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#C())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#R()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[r],this))return this.get(this.#l[r],t)}}forEach(e,t=this){for(let r of this.#R()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#C()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#C({allowStale:!0}))this.#A(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#o[t],i=this.#h(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#_&&this.#T){let o=this.#_[t],c=this.#T[t];if(o&&c){let l=o-(xu.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.#R({allowStale:!0})){let r=this.#l[t],i=this.#o[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let o={value:s};if(this.#_&&this.#T){o.ttl=this.#_[t];let c=xu.now()-this.#T[t];o.start=Math.floor(Date.now()-c)}this.#E&&(o.size=this.#E[t]),e.unshift([r,o])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=xu.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:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#N(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let d=this.#i===0?void 0:this.#s.get(e);if(d===void 0)d=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#M(!1):this.#i,this.#l[d]=e,this.#o[d]=t,this.#s.set(e,d),this.#p[this.#m]=d,this.#g[d]=this.#m,this.#m=d,this.#i++,this.#L(d,f,l),l&&(l.set="add"),u=!1;else{this.#U(d);let h=this.#o[d];if(t!==h){if(this.#S&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!o&&(this.#v&&this.#r?.(p,e,"set"),this.#w&&this.#f?.push([p,e,"set"]))}else o||(this.#v&&this.#r?.(h,e,"set"),this.#w&&this.#f?.push([h,e,"set"]));if(this.#D(d),this.#L(d,f,l),this.#o[d]=t,l){l.set="replace";let p=h&&this.#h(h)?h.__staleWhileFetching:h;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#_&&this.#I(),this.#_&&(u||this.#F(d,i,s),l&&this.#a(l,d)),!o&&this.#w&&this.#f){let h=this.#f,p;for(;p=h?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#o[this.#d];if(this.#M(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#d,r=this.#l[t],i=this.#o[t];return this.#S&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(i,r,"evict"),this.#w&&this.#f?.push([i,r,"evict"])),this.#D(t),e&&(this.#l[t]=void 0,this.#o[t]=void 0,this.#y.push(t)),this.#i===1?(this.#d=this.#m=0,this.#y.length=0):this.#d=this.#p[t],this.#s.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=this.#s.get(e);if(s!==void 0){let o=this.#o[s];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#a(i,s));else return r&&this.#x(s),i&&(i.has="hit",this.#a(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=this.#s.get(e);if(i===void 0||!r&&this.#A(i))return;let s=this.#o[i];return this.#h(s)?s.__staleWhileFetching:s}#j(e,t,r,i){let s=t===void 0?void 0:this.#o[t];if(this.#h(s))return s;let o=new u0,{signal:c}=r;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let l={signal:o.signal,options:r,context:i},u=a((y,b=!1)=>{let{aborted:S}=o.signal,v=r.ignoreFetchAbort&&y!==void 0;if(r.status&&(S&&!b?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,v&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),S&&!v&&!b)return d(o.signal.reason);let I=p;return this.#o[t]===p&&(y===void 0?I.__staleWhileFetching?this.#o[t]=I.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,y,l.options))),y},"cb"),f=a(y=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=y),d(y)),"eb"),d=a(y=>{let{aborted:b}=o.signal,S=b&&r.allowStaleOnFetchAbort,v=S||r.allowStaleOnFetchRejection,I=v||r.noDeleteOnFetchRejection,A=p;if(this.#o[t]===p&&(!I||A.__staleWhileFetching===void 0?this.#P(e,"fetch"):S||(this.#o[t]=A.__staleWhileFetching)),v)return r.status&&A.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),A.__staleWhileFetching;if(A.__returned===A)throw y},"fetchFail"),h=a((y,b)=>{let S=this.#c?.(e,s,l);S&&S instanceof Promise&&S.then(v=>y(v===void 0?void 0:v),b),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(void 0),r.allowStaleOnFetchAbort&&(y=a(v=>u(v,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),g=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,g,{...l.options,status:void 0}),t=this.#s.get(e)):this.#o[t]=g,g}#h(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof u0}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:y,forceRefresh:b=!1,status:S,signal:v}=t;if(!this.#S)return S&&(S.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:S});let I={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:g,ignoreFetchAbort:p,status:S,signal:v},A=this.#s.get(e);if(A===void 0){S&&(S.fetch="miss");let T=this.#j(e,A,I,y);return T.__returned=T}else{let T=this.#o[A];if(this.#h(T)){let k=r&&T.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",k&&(S.returnedStale=!0)),k?T.__staleWhileFetching:T.__returned=T}let R=this.#A(A);if(!b&&!R)return S&&(S.fetch="hit"),this.#U(A),i&&this.#x(A),S&&this.#a(S,A),T;let V=this.#j(e,A,I,y),P=V.__staleWhileFetching!==void 0&&r;return S&&(S.fetch=R?"stale":"refresh",P&&R&&(S.returnedStale=!0)),P?V.__staleWhileFetching:V.__returned=V}}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.#b;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=t,c=this.get(e,o);if(!s&&c!==void 0)return c;let l=r(e,c,{options:o,context:i});return this.set(e,l,o),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#o[c],u=this.#h(l);return o&&this.#a(o,c),this.#A(c)?(o&&(o.get="stale"),u?(o&&r&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#P(e,"expire"),o&&r&&(o.returnedStale=!0),r?l:void 0)):(o&&(o.get="hit"),u?l.__staleWhileFetching:(this.#U(c),i&&this.#x(c),l))}else o&&(o.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#U(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#B(t);else{this.#D(i);let s=this.#o[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(s,e,t),this.#w&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#o[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#d)this.#d=this.#p[i];else{let o=this.#g[i];this.#p[o]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#w&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#C({allowStale:!0})){let r=this.#o[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#v&&this.#r?.(r,i,e),this.#w&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#o.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.#d=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#w&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var Pu=require("node:path"),Zk=require("node:url"),Us=require("fs"),ine=se(require("node:fs"),1),Da=require("node:fs/promises");var y0=require("node:events"),sA=se(require("node:stream"),1),Kk=require("node:string_decoder");var Gk=typeof process=="object"&&process?process:{stdout:null,stderr:null},Yre=a(n=>!!n&&typeof n=="object"&&(n instanceof Fa||n instanceof sA.default||Qre(n)||Xre(n)),"isStream"),Qre=a(n=>!!n&&typeof n=="object"&&n instanceof y0.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==sA.default.Writable.prototype.pipe,"isReadable"),Xre=a(n=>!!n&&typeof n=="object"&&n instanceof y0.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),Mo=Symbol("EOF"),jo=Symbol("maybeEmitEnd"),Pa=Symbol("emittedEnd"),f0=Symbol("emittingEnd"),Jd=Symbol("emittedError"),d0=Symbol("closed"),Wk=Symbol("read"),h0=Symbol("flush"),Hk=Symbol("flushChunk"),ts=Symbol("encoding"),Cu=Symbol("decoder"),Dr=Symbol("flowing"),Zd=Symbol("paused"),Ou=Symbol("resume"),Lr=Symbol("buffer"),An=Symbol("pipes"),Nr=Symbol("bufferLength"),Z2=Symbol("bufferPush"),p0=Symbol("bufferShift"),on=Symbol("objectMode"),tr=Symbol("destroyed"),eA=Symbol("error"),tA=Symbol("emitData"),zk=Symbol("emitEnd"),rA=Symbol("emitEnd2"),js=Symbol("async"),nA=Symbol("abort"),m0=Symbol("aborted"),eh=Symbol("signal"),Lc=Symbol("dataListeners"),oi=Symbol("discarded"),th=a(n=>Promise.resolve().then(n),"defer"),Jre=a(n=>n(),"nodefer"),Zre=a(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),ene=a(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),tne=a(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),g0=class{static{a(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Ou](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},iA=class extends g0{static{a(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)}},rne=a(n=>!!n.objectMode,"isObjectModeOptions"),nne=a(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Fa=class extends y0.EventEmitter{static{a(this,"Minipass")}[Dr]=!1;[Zd]=!1;[An]=[];[Lr]=[];[on];[ts];[js];[Cu];[Mo]=!1;[Pa]=!1;[f0]=!1;[d0]=!1;[Jd]=null;[Nr]=0;[tr]=!1;[eh];[m0]=!1;[Lc]=0;[oi]=!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");rne(t)?(this[on]=!0,this[ts]=null):nne(t)?(this[ts]=t.encoding,this[on]=!1):(this[on]=!1,this[ts]=null),this[js]=!!t.async,this[Cu]=this[ts]?new Kk.StringDecoder(this[ts]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:a(()=>this[Lr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:a(()=>this[An],"get")});let{signal:r}=t;r&&(this[eh]=r,r.aborted?this[nA]():r.addEventListener("abort",()=>this[nA]()))}get bufferLength(){return this[Nr]}get encoding(){return this[ts]}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[on]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[js]}set async(e){this[js]=this[js]||!!e}[nA](){this[m0]=!0,this.emit("abort",this[eh]?.reason),this.destroy(this[eh]?.reason)}get aborted(){return this[m0]}set aborted(e){}write(e,t,r){if(this[m0])return!1;if(this[Mo])throw new Error("write after end");if(this[tr])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[js]?th:Jre;if(!this[on]&&!Buffer.isBuffer(e)){if(tne(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(ene(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[on]?(this[Dr]&&this[Nr]!==0&&this[h0](!0),this[Dr]?this.emit("data",e):this[Z2](e),this[Nr]!==0&&this.emit("readable"),r&&i(r),this[Dr]):e.length?(typeof e=="string"&&!(t===this[ts]&&!this[Cu]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ts]&&(e=this[Cu].write(e)),this[Dr]&&this[Nr]!==0&&this[h0](!0),this[Dr]?this.emit("data",e):this[Z2](e),this[Nr]!==0&&this.emit("readable"),r&&i(r),this[Dr]):(this[Nr]!==0&&this.emit("readable"),r&&i(r),this[Dr])}read(e){if(this[tr])return null;if(this[oi]=!1,this[Nr]===0||e===0||e&&e>this[Nr])return this[jo](),null;this[on]&&(e=null),this[Lr].length>1&&!this[on]&&(this[Lr]=[this[ts]?this[Lr].join(""):Buffer.concat(this[Lr],this[Nr])]);let t=this[Wk](e||null,this[Lr][0]);return this[jo](),t}[Wk](e,t){if(this[on])this[p0]();else{let r=t;e===r.length||e===null?this[p0]():typeof r=="string"?(this[Lr][0]=r.slice(e),t=r.slice(0,e),this[Nr]-=e):(this[Lr][0]=r.subarray(e),t=r.subarray(0,e),this[Nr]-=e)}return this.emit("data",t),!this[Lr].length&&!this[Mo]&&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[Mo]=!0,this.writable=!1,(this[Dr]||!this[Zd])&&this[jo](),this}[Ou](){this[tr]||(!this[Lc]&&!this[An].length&&(this[oi]=!0),this[Zd]=!1,this[Dr]=!0,this.emit("resume"),this[Lr].length?this[h0]():this[Mo]?this[jo]():this.emit("drain"))}resume(){return this[Ou]()}pause(){this[Dr]=!1,this[Zd]=!0,this[oi]=!1}get destroyed(){return this[tr]}get flowing(){return this[Dr]}get paused(){return this[Zd]}[Z2](e){this[on]?this[Nr]+=1:this[Nr]+=e.length,this[Lr].push(e)}[p0](){return this[on]?this[Nr]-=1:this[Nr]-=this[Lr][0].length,this[Lr].shift()}[h0](e=!1){do;while(this[Hk](this[p0]())&&this[Lr].length);!e&&!this[Lr].length&&!this[Mo]&&this.emit("drain")}[Hk](e){return this.emit("data",e),this[Dr]}pipe(e,t){if(this[tr])return e;this[oi]=!1;let r=this[Pa];return t=t||{},e===Gk.stdout||e===Gk.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[An].push(t.proxyErrors?new iA(this,e,t):new g0(this,e,t)),this[js]?th(()=>this[Ou]()):this[Ou]()),e}unpipe(e){let t=this[An].find(r=>r.dest===e);t&&(this[An].length===1?(this[Dr]&&this[Lc]===0&&(this[Dr]=!1),this[An]=[]):this[An].splice(this[An].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[oi]=!1,this[Lc]++,!this[An].length&&!this[Dr]&&this[Ou]();else if(e==="readable"&&this[Nr]!==0)super.emit("readable");else if(Zre(e)&&this[Pa])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Jd]){let i=t;this[js]?th(()=>i.call(this,this[Jd])):i.call(this,this[Jd])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Lc]=this.listeners("data").length,this[Lc]===0&&!this[oi]&&!this[An].length&&(this[Dr]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Lc]=0,!this[oi]&&!this[An].length&&(this[Dr]=!1)),t}get emittedEnd(){return this[Pa]}[jo](){!this[f0]&&!this[Pa]&&!this[tr]&&this[Lr].length===0&&this[Mo]&&(this[f0]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[d0]&&this.emit("close"),this[f0]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==tr&&this[tr])return!1;if(e==="data")return!this[on]&&!r?!1:this[js]?(th(()=>this[tA](r)),!0):this[tA](r);if(e==="end")return this[zk]();if(e==="close"){if(this[d0]=!0,!this[Pa]&&!this[tr])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Jd]=r,super.emit(eA,r);let s=!this[eh]||this.listeners("error").length?super.emit("error",r):!1;return this[jo](),s}else if(e==="resume"){let s=super.emit("resume");return this[jo](),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[jo](),i}[tA](e){for(let r of this[An])r.dest.write(e)===!1&&this.pause();let t=this[oi]?!1:super.emit("data",e);return this[jo](),t}[zk](){return this[Pa]?!1:(this[Pa]=!0,this.readable=!1,this[js]?(th(()=>this[rA]()),!0):this[rA]())}[rA](){if(this[Cu]){let t=this[Cu].end();if(t){for(let r of this[An])r.dest.write(t);this[oi]||super.emit("data",t)}}for(let t of this[An])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[on]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[on]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[on])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ts]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(tr,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[oi]=!1;let e=!1,t=a(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:a(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Mo])return t();let s,o,c=a(d=>{this.off("data",l),this.off("end",u),this.off(tr,f),t(),o(d)},"onerr"),l=a(d=>{this.off("error",c),this.off("end",u),this.off(tr,f),this.pause(),s({value:d,done:!!this[Mo]})},"ondata"),u=a(()=>{this.off("error",c),this.off("data",l),this.off(tr,f),t(),s({done:!0,value:void 0})},"onend"),f=a(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,h)=>{o=h,s=d,this.once(tr,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[oi]=!1;let e=!1,t=a(()=>(this.pause(),this.off(eA,t),this.off(tr,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=a(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(eA,t),this.once(tr,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[tr])return e?this.emit("error",e):this.emit(tr),this;this[tr]=!0,this[oi]=!0,this[Lr].length=0,this[Nr]=0;let t=this;return typeof t.close=="function"&&!this[d0]&&t.close(),e?this.emit("error",e):this.emit(tr),this}static get isStream(){return Yre}};var sne=Us.realpathSync.native,nh={lstatSync:Us.lstatSync,readdir:Us.readdir,readdirSync:Us.readdirSync,readlinkSync:Us.readlinkSync,realpathSync:sne,promises:{lstat:Da.lstat,readdir:Da.readdir,readlink:Da.readlink,realpath:Da.realpath}},eM=a(n=>!n||n===nh||n===ine?nh:{...nh,...n,promises:{...nh.promises,...n.promises||{}}},"fsFromOption"),tM=/^\\\\\?\\([a-z]:)\\?$/i,one=a(n=>n.replace(/\//g,"\\").replace(tM,"$1\\"),"uncToDrive"),ane=/[\\\/]/,yi=0,rM=1,nM=2,$s=4,iM=6,sM=8,Nc=10,oM=12,gi=15,rh=~gi,oA=16,Yk=32,ih=64,rs=128,b0=256,S0=512,Qk=ih|rs|S0,cne=1023,aA=a(n=>n.isFile()?sM:n.isDirectory()?$s:n.isSymbolicLink()?Nc:n.isCharacterDevice()?nM:n.isBlockDevice()?iM:n.isSocket()?oM:n.isFIFO()?rM:yi,"entToType"),Xk=new Map,sh=a(n=>{let e=Xk.get(n);if(e)return e;let t=n.normalize("NFKD");return Xk.set(n,t),t},"normalize"),Jk=new Map,_0=a(n=>{let e=Jk.get(n);if(e)return e;let t=sh(n.toLowerCase());return Jk.set(n,t),t},"normalizeNocase"),w0=class extends Xd{static{a(this,"ResolveCache")}constructor(){super({max:256})}},cA=class extends Xd{static{a(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:a(t=>t.length+1,"sizeCalculation")})}},aM=Symbol("PathScurry setAsCwd"),an=class{static{a(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}#b;get gid(){return this.#b}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#o;get blocks(){return this.#o}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#d;get ctimeMs(){return this.#d}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#_;#v;#S;#w;#I;#x;#a;#F;#A;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=yi,r,i,s,o,c){this.name=e,this.#_=s?_0(e):sh(e),this.#a=t&cne,this.nocase=s,this.roots=i,this.root=r||this,this.#F=o,this.#S=c.fullpath,this.#I=c.relative,this.#x=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=eM(c.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#a&=~oA,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?_0(e):sh(e);for(let l of r)if(l.#_===i)return l;let s=this.parent?this.sep:"",o=this.#S?this.#S+s+e:void 0,c=this.newChild(e,yi,{...t,parent:this,fullpath:o});return this.canReaddir()||(c.#a|=rs),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let e=this.name,t=this.parent;if(!t)return this.#I=this.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.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#S=i}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#a&gi)===yi}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.#a&gi)===sM}isDirectory(){return(this.#a&gi)===$s}isCharacterDevice(){return(this.#a&gi)===nM}isBlockDevice(){return(this.#a&gi)===iM}isFIFO(){return(this.#a&gi)===rM}isSocket(){return(this.#a&gi)===oM}isSymbolicLink(){return(this.#a&Nc)===Nc}lstatCached(){return this.#a&Yk?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#A)return!0;if(!this.parent)return!1;let e=this.#a&gi;return!(e!==yi&&e!==Nc||this.#a&b0||this.#a&rs)}calledReaddir(){return!!(this.#a&oA)}isENOENT(){return!!(this.#a&rs)}isNamed(e){return this.nocase?this.#_===_0(e):this.#_===sh(e)}async readlink(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}#L(e){this.#a|=oA;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#N()}}#N(){this.#a&rs||(this.#a=(this.#a|rs)&rh,this.#R())}#R(){let e=this.children();e.provisional=0;for(let t of e)t.#N()}#C(){this.#a|=S0,this.#k()}#k(){if(this.#a&ih)return;let e=this.#a;(e&gi)===$s&&(e&=rh),this.#a=e|ih,this.#R()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#N():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#N()}#h(e=""){let t=this.#a;t|=b0,e==="ENOENT"&&(t|=rs),(e==="EINVAL"||e==="UNKNOWN")&&(t&=rh),this.#a=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#P(e,t)||this.#U(e,t)}#U(e,t){let r=aA(e),i=this.newChild(e.name,r,{parent:this}),s=i.#a&gi;return s!==$s&&s!==Nc&&s!==yi&&(i.#a|=ih),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?_0(e.name):sh(e.name))===i.#_)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#a=t.#a&rh|aA(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.#a&rs)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#a&rs)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#j(e.code)}}#W(e){let{atime:t,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:o,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:h,mode:p,mtime:g,mtimeMs:y,nlink:b,rdev:S,size:v,uid:I}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=o,this.#o=c,this.#E=l,this.#d=u,this.#n=f,this.#b=d,this.#s=h,this.#r=p,this.#f=g,this.#g=y,this.#t=b,this.#i=S,this.#l=v,this.#c=I;let A=aA(e);this.#a=this.#a&rh|A|Yk,A!==yi&&A!==$s&&A!==Nc&&(this.#a|=ih)}#q=[];#G=!1;#H(e){this.#G=!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.#G)return;this.#G=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#M(s.code),r.provisional=0;else{for(let c of o)this.#$(c,r);this.#L(r)}this.#H(r.slice(0,r.provisional))})}#V;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#V)await this.#V;else{let r=a(()=>{},"resolve");this.#V=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#L(e)}catch(i){this.#M(i.code),e.provisional=0}this.#V=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.#L(e)}catch(r){this.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#a&Qk)return!1;let e=gi&this.#a;return e===yi||e===$s||e===Nc}shouldWalk(e,t){return(this.#a&$s)===$s&&!(this.#a&Qk)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((S0|b0|rs)&this.#a))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#C()}}realpathSync(){if(this.#O)return this.#O;if(!((S0|b0|rs)&this.#a))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#C()}}[aM](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.#I=r.join(this.sep),i.#x=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#I=void 0,i.#x=void 0,i=i.parent}},v0=class n extends an{static{a(this,"PathWin32")}sep="\\";splitSep=ane;constructor(e,t=yi,r,i,s,o,c){super(e,t,r,i,s,o,c)}newChild(e,t=yi,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return Pu.win32.parse(e).root}getRoot(e){if(e=one(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 Fu(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(tM,"$1\\"),e===t}},E0=class n extends an{static{a(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=yi,r,i,s,o,c){super(e,t,r,i,s,o,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=yi,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},T0=class{static{a(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:o=nh}={}){this.#t=eM(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,Zk.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new w0,this.#n=new w0,this.#r=new cA(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,h=this.rootPath,p=!1;for(let g of l){let y=f--;u=u.child(g,{relative:new Array(y).fill("..").join(d),relativePosix:new Array(y).fill("..").join("/"),fullpath:h+=(p?"":d)+g}),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 o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))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 o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))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 an||(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 an||(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 an||(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 an||(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 an||(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 an||(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 an||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=a((d,h)=>{l.add(d),d.readdirCB((p,g)=>{if(p)return h(p);let y=g.length;if(!y)return h();let b=a(()=>{--y===0&&h()},"next");for(let S of g)(!s||s(S))&&c.push(r?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(l,o)?u(v,b):b()):S.shouldWalk(l,o)?u(S,b):b()},!0)},"walk"),f=e;return new Promise((d,h)=>{u(f,p=>{if(p)return h(p);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof an||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let d of f){(!s||s(d))&&c.push(r?d:d.fullpath());let h=d;if(d.isSymbolicLink()){if(!(i&&(h=d.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(l,o)&&l.add(h)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof an||(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 an||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t;(!s||s(e))&&(yield r?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let f of u){(!s||s(f))&&(yield r?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,o)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof an||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Fa({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=a(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let g=a((b,S,v=!1)=>{if(b)return c.emit("error",b);if(i&&!v){let I=[];for(let A of S)A.isSymbolicLink()&&I.push(A.realpath().then(T=>T?.isUnknown()?T.lstat():T));if(I.length){Promise.all(I).then(()=>g(null,S,!0));return}}for(let I of S)I&&(!s||s(I))&&(c.write(r?I:I.fullpath())||(h=!0));f--;for(let I of S){let A=I.realpathCached()||I;A.shouldWalk(l,o)&&u.push(A)}h&&!c.flowing?c.once("drain",d):y||d()},"onReaddir"),y=!0;p.readdirCB(g,!0),y=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof an||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Fa({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=a(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let g=p.readdirSync();for(let y of g)(!s||s(y))&&(c.write(r?y:y.fullpath())||(h=!0));f--;for(let y of g){let b=y;if(y.isSymbolicLink()){if(!(i&&(b=y.realpathSync())))continue;b.isUnknown()&&b.lstatSync()}b.shouldWalk(l,o)&&u.push(b)}}h&&!c.flowing&&c.once("drain",d)},"process");return d(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[aM](t)}},Fu=class extends T0{static{a(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,Pu.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Pu.win32.parse(e).root.toUpperCase()}newRoot(e){return new v0(this.rootPath,$s,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Du=class extends T0{static{a(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,Pu.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new E0(this.rootPath,$s,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},oh=class extends Du{static{a(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},KSe=process.platform==="win32"?v0:E0,cM=process.platform==="win32"?Fu:process.platform==="darwin"?oh:Du;var lne=a(n=>n.length>=1,"isPatternList"),une=a(n=>n.length>=1,"isGlobList"),Lu=class n{static{a(this,"Pattern")}#e;#n;#r;length;#t;#c;#b;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!lne(e))throw new TypeError("empty pattern list");if(!une(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,o,c,l,...u]=this.#e,[f,d,h,p,...g]=this.#n;u[0]===""&&(u.shift(),g.shift());let y=[s,o,c,l,""].join("/"),b=[f,d,h,p,""].join("/");this.#e=[y,...u],this.#n=[b,...g],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[c,...l]=this.#n;o[0]===""&&(o.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...o],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]===er}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#b=this.#b||(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 fne=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Nu=class{static{a(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:o=fne}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new si(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 o=new Lu(i,s,0,this.platform),c=new si(o.globString(),this.mmopts),l=s[s.length-1]==="**",u=o.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(t)||o.match(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 lA=class n{static{a(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()]))}},uA=class{static{a(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)])}},fA=class{static{a(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())}},ah=class n{static{a(this,"Processor")}hasWalkedCache;matches=new uA;subwalks=new fA;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new lA}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 o=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)i=i.resolve(l),s=u,f=!0;if(l=s.pattern(),u=s.rest(),f){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof l=="string"){let d=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,d);continue}else if(l===er){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),h=u?.rest();if(!u||(d===""||d===".")&&!h)this.matches.add(i,c,d===""||d===".");else if(d===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):this.matches.add(p,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let r=this.subwalks.get(e),i=this.child();for(let s of t)for(let o of r){let c=o.isAbsolute(),l=o.pattern(),u=o.rest();l===er?i.testGlobstar(s,o,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,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 o=e.parent||e;this.subwalks.add(o,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 dne=a((n,e)=>typeof n=="string"?new Nu([n],e):Array.isArray(n)?new Nu(n,e):n,"makeIgnore"),A0=class{static{a(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=dne(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 o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(s,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#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 o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.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(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?o+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 ah(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,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>o()));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,o):c.readdirCB((u,f)=>this.walkCB3(c,f,r,o),!0)}o()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>o()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),o);o()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new ah(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,o=a(()=>{--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,o)}o()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,o=a(()=>{--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(),o);o()}},ch=class extends A0{static{a(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}},lh=class extends A0{static{a(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Fa({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 hne=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ns=class{static{a(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,lM.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||hne,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"?Fu:t.platform==="darwin"?oh:t.platform?Du:cM;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 si(l,i)),[o,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Lu(l,f,0,this.platform)})}async walk(){return[...await new ch(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 ch(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 lh(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 lh(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 dA=a((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new si(t,e).hasMagic())return!0;return!1},"hasMagic");function I0(n,e={}){return new ns(n,e).streamSync()}a(I0,"globStreamSync");function fM(n,e={}){return new ns(n,e).stream()}a(fM,"globStream");function dM(n,e={}){return new ns(n,e).walkSync()}a(dM,"globSync");async function uM(n,e={}){return new ns(n,e).walk()}a(uM,"glob_");function x0(n,e={}){return new ns(n,e).iterateSync()}a(x0,"globIterateSync");function hM(n,e={}){return new ns(n,e).iterate()}a(hM,"globIterate");var pne=I0,mne=Object.assign(fM,{sync:I0}),gne=x0,yne=Object.assign(hM,{sync:x0}),bne=Object.assign(dM,{stream:I0,iterate:x0}),La=Object.assign(uM,{glob:uM,globSync:dM,sync:bne,globStream:fM,stream:mne,globStreamSync:I0,streamSync:pne,globIterate:hM,iterate:yne,globIterateSync:x0,iterateSync:gne,Glob:ns,hasMagic:dA,escape:Iu,unescape:es});La.glob=La;async function pM(n,e,t,r={}){let{dryRun:i=!1,excludeRelPath:s}=r,o=kc.default.join(n,"**/*.md"),c=await La(o,{nodir:!0,ignore:[kc.default.join(n,".obsidian/**"),kc.default.join(n,".trash/**"),kc.default.join(n,"**/.obsidian/**"),kc.default.join(n,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=kc.default.relative(n,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await pA.default.readFile(u,"utf-8")}catch{continue}let{updated:h,replacements:p}=_ne(d,e,t);p>0&&(l.filesModified+=1,l.replacements+=p,l.modifiedFiles.push(f),i||await pA.default.writeFile(u,h,"utf-8"))}return l}a(pM,"rewriteInboundWikilinks");function _ne(n,e,t){let r=n.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let o=r[s],c=Sne(o,e,t);i+=c.replacements,r[s]=c.updated}return{updated:r.join(""),replacements:i}}a(_ne,"rewriteContent");function Sne(n,e,t){let r=n.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let o=wne(r[s],e,t);i+=o.replacements,r[s]=o.updated}return{updated:r.join(""),replacements:i}}a(Sne,"rewriteProseSegment");function wne(n,e,t){let r=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:n.replace(r,(o,c,l)=>c.trim()!==e?o:(i+=1,`[[${t}${l}]]`)),replacements:i}}a(wne,"replaceWikilinks");var vne=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Xt=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{a(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await pr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return pr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await pr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await pr.default.ensureDir(rr.default.dirname(r)),await pr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await pr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await pr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await pr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await pr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return pr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=pr.default.statSync(t);if(r.isFile())return this.createFileObject(e);if(r.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let r=rr.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=pr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let r=await this.read(e),i=this.extractFrontmatter(r)||{},s=t(i),o=this.replaceFrontmatter(r,s);await this.modify(e,o)}async rename(e,t){let r=this.resolvePath(e.path),i=this.resolvePath(t);if(!await pr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await pr.default.ensureDir(rr.default.dirname(i)),await pr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await pr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(vne.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=rr.default.dirname(this.resolvePath(t)),s;if(rr.default.isAbsolute(r)?s=this.resolvePath(r):s=rr.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),pr.default.existsSync(s)){let u=rr.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let o=r.toLowerCase(),c=this.basenameIndex.get(o);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(o);return l?this.createFileObject(l):null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=rr.default.relative(this.rootPath,e),r=rr.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=pr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let o=s.aliases,c=Array.isArray(o)?o:typeof o=="string"?[o]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let r=rr.default.basename(e,".md").match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(r){let i=r[1].toLowerCase(),s=rr.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let r=await this.read(e),i=t(r);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,r){let i=rr.default.basename(t,".md");await pM(this.rootPath,r,i,{excludeRelPath:e})}resolvePath(e){return rr.default.isAbsolute(e)?e:rr.default.join(this.rootPath,e)}createFileObject(e){let t=rr.default.basename(e),r=rr.default.basename(e,rr.default.extname(e)),i=rr.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:rr.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=Dt.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=Dt.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
|
|
369
369
|
${r.trim()}
|
|
370
370
|
---`):`---
|
|
371
371
|
${r.trim()}
|
|
@@ -375,18 +375,18 @@ ${e}`}shouldSkipDirectory(e){return e.startsWith(".")}walkDirectory(e,t){let r;t
|
|
|
375
375
|
`)}getAllVariables(e){let t=new Set;for(let r of e)for(let i of r.variables())t.add(i);return Array.from(t).sort()}escapeValue(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
376
376
|
`)||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e}};var ku=class{static{a(this,"TriplesFormatter")}formatNTriples(e){return e.map(t=>t.toString()).join(`
|
|
377
377
|
`)}formatTable(e){if(e.length===0)return"No triples generated.";let t=[];t.push("Subject | Predicate | Object"),t.push("------- | --------- | ------");for(let r of e){let i=this.formatNode(r.subject),s=this.formatNode(r.predicate),o=this.formatNode(r.object);t.push(`${i} | ${s} | ${o}`)}return t.join(`
|
|
378
|
-
`)}formatJson(e){let t=e.map(r=>({subject:this.nodeToJson(r.subject),predicate:this.nodeToJson(r.predicate),object:this.nodeToJson(r.object)}));return JSON.stringify(t,null,2)}formatNode(e){return e.value!==void 0?String(e.value):String(e)}nodeToJson(e){return"datatype"in e||"language"in e?{type:"literal",value:String(e.value),...e.datatype&&{datatype:e.datatype.value||String(e.datatype)},...e.language&&{language:e.language}}:"id"in e&&String(e.id).startsWith("_:")?{type:"bnode",value:String(e.id)}:{type:"uri",value:String(e.value)}}};function mM(n){return n.startsWith("VALIDATION_")?"validation":n.startsWith("PERMISSION_")?"permission":n.startsWith("STATE_")?"state":"internal"}a(mM,"getErrorCategory");var Xe=class{static{a(this,"ResponseBuilder")}static success(e,t){return{success:!0,data:e,...t&&{meta:t}}}static error(e,t,r,i){return{success:!1,error:{code:e,category:mM(e),message:t,exitCode:r,...i?.recovery&&{recovery:i.recovery},...i?.context&&{context:i.context},...i?.stack&&{stack:i.stack}}}}};var
|
|
378
|
+
`)}formatJson(e){let t=e.map(r=>({subject:this.nodeToJson(r.subject),predicate:this.nodeToJson(r.predicate),object:this.nodeToJson(r.object)}));return JSON.stringify(t,null,2)}formatNode(e){return e.value!==void 0?String(e.value):String(e)}nodeToJson(e){return"datatype"in e||"language"in e?{type:"literal",value:String(e.value),...e.datatype&&{datatype:e.datatype.value||String(e.datatype)},...e.language&&{language:e.language}}:"id"in e&&String(e.id).startsWith("_:")?{type:"bnode",value:String(e.id)}:{type:"uri",value:String(e.value)}}};function mM(n){return n.startsWith("VALIDATION_")?"validation":n.startsWith("PERMISSION_")?"permission":n.startsWith("STATE_")?"state":"internal"}a(mM,"getErrorCategory");var Xe=class{static{a(this,"ResponseBuilder")}static success(e,t){return{success:!0,data:e,...t&&{meta:t}}}static error(e,t,r,i){return{success:!1,error:{code:e,category:mM(e),message:t,exitCode:r,...i?.recovery&&{recovery:i.recovery},...i?.context&&{context:i.context},...i?.stack&&{stack:i.stack}}}}};var cn=class extends Error{static{a(this,"CLIError")}constructor(e,t,r){super(e),this.name=this.constructor.name,this.context=t,this.recoveryHint=r,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
|
|
379
379
|
|
|
380
380
|
\u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
|
|
381
381
|
|
|
382
382
|
\u{1F4CB} Context:`;for(let[t,r]of Object.entries(this.context))e+=`
|
|
383
|
-
${t}: ${JSON.stringify(r)}`}return e}toStructuredResponse(e=!1){return Xe.error(this.errorCode,this.message,this.exitCode,{recovery:this.recoveryHint||{message:this.guidance},context:this.context,stack:e?this.stack:void 0})}formatJson(e=!1){return JSON.stringify(this.toStructuredResponse(e),null,2)}};var ce=class n{static{a(this,"ErrorHandler")}static{this.outputFormat="text"}static setFormat(e){n.outputFormat=e}static getFormat(){return n.outputFormat}static isDebugMode(){return!!process.env.DEBUG}static handle(e){if(e instanceof
|
|
384
|
-
\u{1F4CD} Stack trace:`),console.error(e.stack));process.exit(e.exitCode)}let{exitCode:t,errorCode:r}=n.classifyError(e);if(n.outputFormat==="json"){let i=n.buildErrorResponse(r,e.message,t,n.isDebugMode()?e.stack:void 0);console.log(JSON.stringify(i,null,2))}else console.error(`\u274C Error: ${e.message}`),n.isDebugMode()&&console.error(e.stack);process.exit(t)}static handleWithMessage(e,t=1,r="INTERNAL_UNKNOWN"){if(n.outputFormat==="json"){let i=n.buildErrorResponse(r,e,t);console.log(JSON.stringify(i,null,2))}else console.error(`\u274C Error: ${e}`);process.exit(t)}static classifyError(e){let t=e.message.toLowerCase();return t.includes("transition")?{exitCode:6,errorCode:"STATE_INVALID_TRANSITION"}:t.includes("transaction")?{exitCode:7,errorCode:"INTERNAL_TRANSACTION_FAILED"}:t.includes("concurrent")||t.includes("modified")?{exitCode:8,errorCode:"STATE_CONCURRENT_MODIFICATION"}:e.message.includes("not found")||e.message.includes("ENOENT")?{exitCode:3,errorCode:"VALIDATION_FILE_NOT_FOUND"}:e.message.includes("EACCES")||e.message.includes("permission denied")?{exitCode:4,errorCode:"PERMISSION_DENIED"}:e.message.includes("Invalid")||e.message.includes("outside vault")||e.message.includes("Not a")?{exitCode:2,errorCode:"VALIDATION_INVALID_ARGUMENTS"}:{exitCode:1,errorCode:"INTERNAL_UNKNOWN"}}static buildErrorResponse(e,t,r,i){return Xe.error(e,t,r,{recovery:n.getRecoveryHint(e),stack:i})}static getRecoveryHint(e){switch(e){case"VALIDATION_FILE_NOT_FOUND":return{message:"Verify the file path is correct and the file exists",suggestion:"Check file path spelling and ensure the file is in the vault"};case"VALIDATION_VAULT_NOT_FOUND":return{message:"Verify the vault path is correct",suggestion:"Check --vault option or current directory"};case"VALIDATION_INVALID_ARGUMENTS":return{message:"Check command syntax and argument format",suggestion:"Use --help for usage information"};case"STATE_INVALID_TRANSITION":return{message:"The requested state transition is not allowed",suggestion:"Check the current asset state and valid transitions"};case"STATE_CONCURRENT_MODIFICATION":return{message:"File was modified by another process",suggestion:"Wait and retry the command"};case"PERMISSION_DENIED":return{message:"Check file permissions",suggestion:"Ensure you have write access to the vault"};case"INTERNAL_TRANSACTION_FAILED":return{message:"Transaction could not complete",suggestion:"Check for locked files and retry"};default:return{message:"An unexpected error occurred",suggestion:"Check the error details and retry"}}}};var tt=class extends
|
|
385
|
-
Use: exocortex command --help for usage information.`;super(t,i,{message:r||"Check command syntax and argument format",suggestion:"exocortex command --help"});this.exitCode=2;this.errorCode="VALIDATION_INVALID_ARGUMENTS";this.guidance=r||s}static{a(this,"InvalidArgumentsError")}};var qe=class extends
|
|
383
|
+
${t}: ${JSON.stringify(r)}`}return e}toStructuredResponse(e=!1){return Xe.error(this.errorCode,this.message,this.exitCode,{recovery:this.recoveryHint||{message:this.guidance},context:this.context,stack:e?this.stack:void 0})}formatJson(e=!1){return JSON.stringify(this.toStructuredResponse(e),null,2)}};var ce=class n{static{a(this,"ErrorHandler")}static{this.outputFormat="text"}static setFormat(e){n.outputFormat=e}static getFormat(){return n.outputFormat}static isDebugMode(){return!!process.env.DEBUG}static handle(e){if(e instanceof cn){if(n.outputFormat==="json"){let i=e.toStructuredResponse(n.isDebugMode());console.log(JSON.stringify(i,null,2))}else console.error(e.format()),n.isDebugMode()&&(console.error(`
|
|
384
|
+
\u{1F4CD} Stack trace:`),console.error(e.stack));process.exit(e.exitCode)}let{exitCode:t,errorCode:r}=n.classifyError(e);if(n.outputFormat==="json"){let i=n.buildErrorResponse(r,e.message,t,n.isDebugMode()?e.stack:void 0);console.log(JSON.stringify(i,null,2))}else console.error(`\u274C Error: ${e.message}`),n.isDebugMode()&&console.error(e.stack);process.exit(t)}static handleWithMessage(e,t=1,r="INTERNAL_UNKNOWN"){if(n.outputFormat==="json"){let i=n.buildErrorResponse(r,e,t);console.log(JSON.stringify(i,null,2))}else console.error(`\u274C Error: ${e}`);process.exit(t)}static classifyError(e){let t=e.message.toLowerCase();return t.includes("transition")?{exitCode:6,errorCode:"STATE_INVALID_TRANSITION"}:t.includes("transaction")?{exitCode:7,errorCode:"INTERNAL_TRANSACTION_FAILED"}:t.includes("concurrent")||t.includes("modified")?{exitCode:8,errorCode:"STATE_CONCURRENT_MODIFICATION"}:e.message.includes("not found")||e.message.includes("ENOENT")?{exitCode:3,errorCode:"VALIDATION_FILE_NOT_FOUND"}:e.message.includes("EACCES")||e.message.includes("permission denied")?{exitCode:4,errorCode:"PERMISSION_DENIED"}:e.message.includes("Invalid")||e.message.includes("outside vault")||e.message.includes("Not a")?{exitCode:2,errorCode:"VALIDATION_INVALID_ARGUMENTS"}:{exitCode:1,errorCode:"INTERNAL_UNKNOWN"}}static buildErrorResponse(e,t,r,i){return Xe.error(e,t,r,{recovery:n.getRecoveryHint(e),stack:i})}static getRecoveryHint(e){switch(e){case"VALIDATION_FILE_NOT_FOUND":return{message:"Verify the file path is correct and the file exists",suggestion:"Check file path spelling and ensure the file is in the vault"};case"VALIDATION_VAULT_NOT_FOUND":return{message:"Verify the vault path is correct",suggestion:"Check --vault option or current directory"};case"VALIDATION_INVALID_ARGUMENTS":return{message:"Check command syntax and argument format",suggestion:"Use --help for usage information"};case"STATE_INVALID_TRANSITION":return{message:"The requested state transition is not allowed",suggestion:"Check the current asset state and valid transitions"};case"STATE_CONCURRENT_MODIFICATION":return{message:"File was modified by another process",suggestion:"Wait and retry the command"};case"PERMISSION_DENIED":return{message:"Check file permissions",suggestion:"Ensure you have write access to the vault"};case"INTERNAL_TRANSACTION_FAILED":return{message:"Transaction could not complete",suggestion:"Check for locked files and retry"};default:return{message:"An unexpected error occurred",suggestion:"Check the error details and retry"}}}};var tt=class extends cn{constructor(t,r,i){let s=`Check command syntax and argument format.
|
|
385
|
+
Use: exocortex command --help for usage information.`;super(t,i,{message:r||"Check command syntax and argument format",suggestion:"exocortex command --help"});this.exitCode=2;this.errorCode="VALIDATION_INVALID_ARGUMENTS";this.guidance=r||s}static{a(this,"InvalidArgumentsError")}};var qe=class extends cn{constructor(t,r){super(`Vault not found: ${t}`,{vaultPath:t,...r},{message:"Verify the vault path is correct and the directory exists",suggestion:`ls -la "${t}" or check --vault option`});this.exitCode=3;this.errorCode="VALIDATION_VAULT_NOT_FOUND";this.guidance=`The specified vault directory does not exist.
|
|
386
386
|
Check:
|
|
387
387
|
\u2022 Path spelling and case sensitivity
|
|
388
388
|
\u2022 Directory exists and is accessible
|
|
389
|
-
\u2022 You have read permissions for the directory`}static{a(this,"VaultNotFoundError")}};var uh=class extends
|
|
389
|
+
\u2022 You have read permissions for the directory`}static{a(this,"VaultNotFoundError")}};var uh=class extends cn{constructor(t,r,i){let s=Math.round(t/1e3),c=`Query timeout after ${r!==void 0?Math.round(r/1e3):s}s (limit: ${s}s)`;super(c,{timeoutMs:t,elapsedMs:r??t,partialResultsCount:i},{message:"Increase timeout with --timeout <duration> (e.g., --timeout 60s)",suggestion:`exocortex query --timeout ${s*2}s "..."`});this.exitCode=5;this.errorCode="INTERNAL_QUERY_TIMEOUT";this.guidance=`Query exceeded the ${s}s timeout limit.
|
|
390
390
|
|
|
391
391
|
To fix this:
|
|
392
392
|
1. Increase timeout: --timeout ${s*2}s
|
|
@@ -394,7 +394,7 @@ To fix this:
|
|
|
394
394
|
3. Simplify query: reduce WHERE clauses or add LIMIT
|
|
395
395
|
4. Use cache: --use-cache for faster vault loading${i!==void 0?`
|
|
396
396
|
|
|
397
|
-
Partial results: ${i} result(s) were collected before timeout.`:""}`}static{a(this,"QueryTimeoutError")}};var fh=se(require("path")),cn=se(No()),dh=se(et());var ai=se(et());function P0(n){if(n instanceof ai.IRI)return{type:"IRI",value:n.value};if(n instanceof ai.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 ai.BlankNode?{type:"BlankNode",value:n.value}:{type:"IRI",value:String(n)}}a(P0,"serializeNode");function F0(n){switch(n.type){case"IRI":return new ai.IRI(n.value);case"Literal":return n.datatype?new ai.Literal(n.value,new ai.IRI(n.datatype)):n.language?new ai.Literal(n.value,void 0,n.language):new ai.Literal(n.value);case"BlankNode":return new ai.BlankNode(n.value);default:return new ai.IRI(n.value)}}a(F0,"deserializeNode");var bi=class{constructor(e){this.cliVersion="1.0.0";this.vaultPath=fh.default.resolve(e),this.cachePath=fh.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{a(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){try{if(!await cn.default.pathExists(this.cachePath))return!1;let e=await cn.default.readJson(this.cachePath);return!(!e.metadata||typeof e.metadata.vaultMtime!="number"||typeof e.metadata.tripleCount!="number"||(await cn.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 cn.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 Xt(this.vaultPath),s=await new dh.NoteToRDFConverter(r).convertVaultWithValidation({strict:e.strict??!1}),o=await cn.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:o.mtimeMs},triples:c};return await cn.default.ensureDir(fh.default.dirname(this.cachePath)),await cn.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 Xt(this.vaultPath);return new dh.NoteToRDFConverter(e).validateVault()}async invalidate(){await cn.default.pathExists(this.cachePath)&&await cn.default.remove(this.cachePath)}async getCacheStats(){try{if(!await cn.default.pathExists(this.cachePath))return null;let e=await cn.default.readJson(this.cachePath),t=await cn.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 cn.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 cn.default.ensureDir(fh.default.dirname(this.cachePath)),await cn.default.writeJson(this.cachePath,i,{spaces:0})}serializeTriple(e){return{subject:P0(e.subject),predicate:P0(e.predicate),object:P0(e.object)}}deserializeTriple(e){return new dh.Triple(F0(e.subject),F0(e.predicate),F0(e.object))}};var gM=se(require("crypto")),hh=se(require("path")),yM=se(require("os")),ci=se(No());var Mu=class{static{a(this,"QueryResultCache")}constructor(e={}){this.cacheDir=e.cacheDir??hh.default.join(yM.default.homedir(),".exocortex","cache","query-results")}getCacheDir(){return this.cacheDir}getCacheKey(e){let t=e.trim().replace(/\s+/g," ");return gM.default.createHash("sha256").update(t).digest("hex")}async get(e,t){let r=this.getCacheKey(e),i=this.getCachePath(r);try{if(!await ci.default.pathExists(i))return null;let s=await ci.default.readJson(i),o=Date.now()-s.timestamp,c=t*1e3;return o>c?(await ci.default.remove(i),null):s.result}catch{return null}}async set(e,t,r){let i=this.getCacheKey(e),s=this.getCachePath(i);await ci.default.ensureDir(this.cacheDir);let o={timestamp:Date.now(),result:t};await ci.default.writeJson(s,o,{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 ci.default.remove(r)}catch{}}async clear(){try{if(await ci.default.pathExists(this.cacheDir)){let e=await ci.default.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>ci.default.remove(hh.default.join(this.cacheDir,t))))}}catch{}}async getCacheStats(){try{if(!await ci.default.pathExists(this.cacheDir))return{entryCount:0,totalSizeBytes:0};let t=(await ci.default.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),r=0;for(let i of t){let s=await ci.default.stat(hh.default.join(this.cacheDir,i));r+=s.size}return{entryCount:t.length,totalSizeBytes:r}}catch{return{entryCount:0,totalSizeBytes:0}}}getCachePath(e){return hh.default.join(this.cacheDir,`${e}.json`)}};var Sh=se(require("node:process"),1);var bM=a((n=0)=>e=>`\x1B[${e+n}m`,"wrapAnsi16"),_M=a((n=0)=>e=>`\x1B[${38+n};5;${e}m`,"wrapAnsi256"),SM=a((n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,"wrapAnsi16m"),Lt={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},mve=Object.keys(Lt.modifier),Ene=Object.keys(Lt.color),Tne=Object.keys(Lt.bgColor),gve=[...Ene,...Tne];function Ane(){let n=new Map;for(let[e,t]of Object.entries(Lt)){for(let[r,i]of Object.entries(t))Lt[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=Lt[r],n.set(i[0],i[1]);Object.defineProperty(Lt,e,{value:t,enumerable:!1})}return Object.defineProperty(Lt,"codes",{value:n,enumerable:!1}),Lt.color.close="\x1B[39m",Lt.bgColor.close="\x1B[49m",Lt.color.ansi=bM(),Lt.color.ansi256=_M(),Lt.color.ansi16m=SM(),Lt.bgColor.ansi=bM(10),Lt.bgColor.ansi256=_M(10),Lt.bgColor.ansi16m=SM(10),Object.defineProperties(Lt,{rgbToAnsi256:{value(e,t,r){return e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;r.length===3&&(r=[...r].map(s=>s+s).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:a(e=>Lt.rgbToAnsi256(...Lt.hexToRgb(e)),"value"),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,r,i;if(e>=232)t=((e-232)*10+8)/255,r=t,i=t;else{e-=16;let c=e%36;t=Math.floor(e/36)/5,r=Math.floor(c/6)/5,i=c%6/5}let s=Math.max(t,r,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(t));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:a((e,t,r)=>Lt.ansi256ToAnsi(Lt.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:a(e=>Lt.ansi256ToAnsi(Lt.hexToAnsi256(e)),"value"),enumerable:!1}}),Lt}a(Ane,"assembleStyles");var Ine=Ane(),ss=Ine;var L0=se(require("node:process"),1),vM=se(require("node:os"),1),mA=se(require("node:tty"),1);function _i(n,e=globalThis.Deno?globalThis.Deno.args:L0.default.argv){let t=n.startsWith("-")?"":n.length===1?"-":"--",r=e.indexOf(t+n),i=e.indexOf("--");return r!==-1&&(i===-1||r<i)}a(_i,"hasFlag");var{env:Nt}=L0.default,D0;_i("no-color")||_i("no-colors")||_i("color=false")||_i("color=never")?D0=0:(_i("color")||_i("colors")||_i("color=true")||_i("color=always"))&&(D0=1);function xne(){if("FORCE_COLOR"in Nt)return Nt.FORCE_COLOR==="true"?1:Nt.FORCE_COLOR==="false"?0:Nt.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Nt.FORCE_COLOR,10),3)}a(xne,"envForceColor");function Rne(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}a(Rne,"translateLevel");function Cne(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=xne();r!==void 0&&(D0=r);let i=t?D0:r;if(i===0)return 0;if(t){if(_i("color=16m")||_i("color=full")||_i("color=truecolor"))return 3;if(_i("color=256"))return 2}if("TF_BUILD"in Nt&&"AGENT_NAME"in Nt)return 1;if(n&&!e&&i===void 0)return 0;let s=i||0;if(Nt.TERM==="dumb")return s;if(L0.default.platform==="win32"){let o=vM.default.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in Nt)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in Nt)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in Nt)||Nt.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in Nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Nt.TEAMCITY_VERSION)?1:0;if(Nt.COLORTERM==="truecolor"||Nt.TERM==="xterm-kitty"||Nt.TERM==="xterm-ghostty"||Nt.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Nt){let o=Number.parseInt((Nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Nt.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Nt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Nt.TERM)||"COLORTERM"in Nt?1:s}a(Cne,"_supportsColor");function wM(n,e={}){let t=Cne(n,{streamIsTTY:n&&n.isTTY,...e});return Rne(t)}a(wM,"createSupportsColor");var One={stdout:wM({isTTY:mA.default.isatty(1)}),stderr:wM({isTTY:mA.default.isatty(2)})},EM=One;function TM(n,e,t){let r=n.indexOf(e);if(r===-1)return n;let i=e.length,s=0,o="";do o+=n.slice(s,r)+e+t,s=r+i,r=n.indexOf(e,s);while(r!==-1);return o+=n.slice(s),o}a(TM,"stringReplaceAll");function AM(n,e,t,r){let i=0,s="";do{let o=n[r-1]==="\r";s+=n.slice(i,o?r-1:r)+e+(o?`\r
|
|
397
|
+
Partial results: ${i} result(s) were collected before timeout.`:""}`}static{a(this,"QueryTimeoutError")}};var fh=se(require("path")),ln=se(No()),dh=se(et());var ai=se(et());function P0(n){if(n instanceof ai.IRI)return{type:"IRI",value:n.value};if(n instanceof ai.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 ai.BlankNode?{type:"BlankNode",value:n.value}:{type:"IRI",value:String(n)}}a(P0,"serializeNode");function F0(n){switch(n.type){case"IRI":return new ai.IRI(n.value);case"Literal":return n.datatype?new ai.Literal(n.value,new ai.IRI(n.datatype)):n.language?new ai.Literal(n.value,void 0,n.language):new ai.Literal(n.value);case"BlankNode":return new ai.BlankNode(n.value);default:return new ai.IRI(n.value)}}a(F0,"deserializeNode");var bi=class{constructor(e){this.cliVersion="1.0.0";this.vaultPath=fh.default.resolve(e),this.cachePath=fh.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{a(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){try{if(!await ln.default.pathExists(this.cachePath))return!1;let e=await ln.default.readJson(this.cachePath);return!(!e.metadata||typeof e.metadata.vaultMtime!="number"||typeof e.metadata.tripleCount!="number"||(await ln.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 ln.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 Xt(this.vaultPath),s=await new dh.NoteToRDFConverter(r).convertVaultWithValidation({strict:e.strict??!1}),o=await ln.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:o.mtimeMs},triples:c};return await ln.default.ensureDir(fh.default.dirname(this.cachePath)),await ln.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 Xt(this.vaultPath);return new dh.NoteToRDFConverter(e).validateVault()}async invalidate(){await ln.default.pathExists(this.cachePath)&&await ln.default.remove(this.cachePath)}async getCacheStats(){try{if(!await ln.default.pathExists(this.cachePath))return null;let e=await ln.default.readJson(this.cachePath),t=await ln.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 ln.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 ln.default.ensureDir(fh.default.dirname(this.cachePath)),await ln.default.writeJson(this.cachePath,i,{spaces:0})}serializeTriple(e){return{subject:P0(e.subject),predicate:P0(e.predicate),object:P0(e.object)}}deserializeTriple(e){return new dh.Triple(F0(e.subject),F0(e.predicate),F0(e.object))}};var gM=se(require("crypto")),hh=se(require("path")),yM=se(require("os")),ci=se(No());var Mu=class{static{a(this,"QueryResultCache")}constructor(e={}){this.cacheDir=e.cacheDir??hh.default.join(yM.default.homedir(),".exocortex","cache","query-results")}getCacheDir(){return this.cacheDir}getCacheKey(e){let t=e.trim().replace(/\s+/g," ");return gM.default.createHash("sha256").update(t).digest("hex")}async get(e,t){let r=this.getCacheKey(e),i=this.getCachePath(r);try{if(!await ci.default.pathExists(i))return null;let s=await ci.default.readJson(i),o=Date.now()-s.timestamp,c=t*1e3;return o>c?(await ci.default.remove(i),null):s.result}catch{return null}}async set(e,t,r){let i=this.getCacheKey(e),s=this.getCachePath(i);await ci.default.ensureDir(this.cacheDir);let o={timestamp:Date.now(),result:t};await ci.default.writeJson(s,o,{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 ci.default.remove(r)}catch{}}async clear(){try{if(await ci.default.pathExists(this.cacheDir)){let e=await ci.default.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>ci.default.remove(hh.default.join(this.cacheDir,t))))}}catch{}}async getCacheStats(){try{if(!await ci.default.pathExists(this.cacheDir))return{entryCount:0,totalSizeBytes:0};let t=(await ci.default.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),r=0;for(let i of t){let s=await ci.default.stat(hh.default.join(this.cacheDir,i));r+=s.size}return{entryCount:t.length,totalSizeBytes:r}}catch{return{entryCount:0,totalSizeBytes:0}}}getCachePath(e){return hh.default.join(this.cacheDir,`${e}.json`)}};var Sh=se(require("node:process"),1);var bM=a((n=0)=>e=>`\x1B[${e+n}m`,"wrapAnsi16"),_M=a((n=0)=>e=>`\x1B[${38+n};5;${e}m`,"wrapAnsi256"),SM=a((n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,"wrapAnsi16m"),Lt={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},mve=Object.keys(Lt.modifier),Ene=Object.keys(Lt.color),Tne=Object.keys(Lt.bgColor),gve=[...Ene,...Tne];function Ane(){let n=new Map;for(let[e,t]of Object.entries(Lt)){for(let[r,i]of Object.entries(t))Lt[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=Lt[r],n.set(i[0],i[1]);Object.defineProperty(Lt,e,{value:t,enumerable:!1})}return Object.defineProperty(Lt,"codes",{value:n,enumerable:!1}),Lt.color.close="\x1B[39m",Lt.bgColor.close="\x1B[49m",Lt.color.ansi=bM(),Lt.color.ansi256=_M(),Lt.color.ansi16m=SM(),Lt.bgColor.ansi=bM(10),Lt.bgColor.ansi256=_M(10),Lt.bgColor.ansi16m=SM(10),Object.defineProperties(Lt,{rgbToAnsi256:{value(e,t,r){return e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;r.length===3&&(r=[...r].map(s=>s+s).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:a(e=>Lt.rgbToAnsi256(...Lt.hexToRgb(e)),"value"),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,r,i;if(e>=232)t=((e-232)*10+8)/255,r=t,i=t;else{e-=16;let c=e%36;t=Math.floor(e/36)/5,r=Math.floor(c/6)/5,i=c%6/5}let s=Math.max(t,r,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(t));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:a((e,t,r)=>Lt.ansi256ToAnsi(Lt.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:a(e=>Lt.ansi256ToAnsi(Lt.hexToAnsi256(e)),"value"),enumerable:!1}}),Lt}a(Ane,"assembleStyles");var Ine=Ane(),ss=Ine;var L0=se(require("node:process"),1),vM=se(require("node:os"),1),mA=se(require("node:tty"),1);function _i(n,e=globalThis.Deno?globalThis.Deno.args:L0.default.argv){let t=n.startsWith("-")?"":n.length===1?"-":"--",r=e.indexOf(t+n),i=e.indexOf("--");return r!==-1&&(i===-1||r<i)}a(_i,"hasFlag");var{env:Nt}=L0.default,D0;_i("no-color")||_i("no-colors")||_i("color=false")||_i("color=never")?D0=0:(_i("color")||_i("colors")||_i("color=true")||_i("color=always"))&&(D0=1);function xne(){if("FORCE_COLOR"in Nt)return Nt.FORCE_COLOR==="true"?1:Nt.FORCE_COLOR==="false"?0:Nt.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Nt.FORCE_COLOR,10),3)}a(xne,"envForceColor");function Rne(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}a(Rne,"translateLevel");function Cne(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=xne();r!==void 0&&(D0=r);let i=t?D0:r;if(i===0)return 0;if(t){if(_i("color=16m")||_i("color=full")||_i("color=truecolor"))return 3;if(_i("color=256"))return 2}if("TF_BUILD"in Nt&&"AGENT_NAME"in Nt)return 1;if(n&&!e&&i===void 0)return 0;let s=i||0;if(Nt.TERM==="dumb")return s;if(L0.default.platform==="win32"){let o=vM.default.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in Nt)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in Nt)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in Nt)||Nt.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in Nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Nt.TEAMCITY_VERSION)?1:0;if(Nt.COLORTERM==="truecolor"||Nt.TERM==="xterm-kitty"||Nt.TERM==="xterm-ghostty"||Nt.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Nt){let o=Number.parseInt((Nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Nt.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Nt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Nt.TERM)||"COLORTERM"in Nt?1:s}a(Cne,"_supportsColor");function wM(n,e={}){let t=Cne(n,{streamIsTTY:n&&n.isTTY,...e});return Rne(t)}a(wM,"createSupportsColor");var One={stdout:wM({isTTY:mA.default.isatty(1)}),stderr:wM({isTTY:mA.default.isatty(2)})},EM=One;function TM(n,e,t){let r=n.indexOf(e);if(r===-1)return n;let i=e.length,s=0,o="";do o+=n.slice(s,r)+e+t,s=r+i,r=n.indexOf(e,s);while(r!==-1);return o+=n.slice(s),o}a(TM,"stringReplaceAll");function AM(n,e,t,r){let i=0,s="";do{let o=n[r-1]==="\r";s+=n.slice(i,o?r-1:r)+e+(o?`\r
|
|
398
398
|
`:`
|
|
399
399
|
`)+t,i=r+1,r=n.indexOf(`
|
|
400
400
|
`,i)}while(r!==-1);return s+=n.slice(i),s}a(AM,"stringEncaseCRLFWithFirstIndex");var{stdout:IM,stderr:xM}=EM,gA=Symbol("GENERATOR"),ju=Symbol("STYLER"),ph=Symbol("IS_EMPTY"),RM=["ansi","ansi","ansi256","ansi16m"],$u=Object.create(null),Pne=a((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=IM?IM.level:0;n.level=e.level===void 0?t:e.level},"applyOptions");var Fne=a(n=>{let e=a((...t)=>t.join(" "),"chalk");return Pne(e,n),Object.setPrototypeOf(e,mh.prototype),e},"chalkFactory");function mh(n){return Fne(n)}a(mh,"createChalk");Object.setPrototypeOf(mh.prototype,Function.prototype);for(let[n,e]of Object.entries(ss))$u[n]={get(){let t=N0(this,bA(e.open,e.close,this[ju]),this[ph]);return Object.defineProperty(this,n,{value:t}),t}};$u.visible={get(){let n=N0(this,this[ju],!0);return Object.defineProperty(this,"visible",{value:n}),n}};var yA=a((n,e,t,...r)=>n==="rgb"?e==="ansi16m"?ss[t].ansi16m(...r):e==="ansi256"?ss[t].ansi256(ss.rgbToAnsi256(...r)):ss[t].ansi(ss.rgbToAnsi(...r)):n==="hex"?yA("rgb",e,t,...ss.hexToRgb(...r)):ss[t][n](...r),"getModelAnsi"),Dne=["rgb","hex","ansi256"];for(let n of Dne){$u[n]={get(){let{level:t}=this;return function(...r){let i=bA(yA(n,RM[t],"color",...r),ss.color.close,this[ju]);return N0(this,i,this[ph])}}};let e="bg"+n[0].toUpperCase()+n.slice(1);$u[e]={get(){let{level:t}=this;return function(...r){let i=bA(yA(n,RM[t],"bgColor",...r),ss.bgColor.close,this[ju]);return N0(this,i,this[ph])}}}}var Lne=Object.defineProperties(()=>{},{...$u,level:{enumerable:!0,get(){return this[gA].level},set(n){this[gA].level=n}}}),bA=a((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"),N0=a((n,e,t)=>{let r=a((...i)=>Nne(r,i.length===1?""+i[0]:i.join(" ")),"builder");return Object.setPrototypeOf(r,Lne),r[gA]=n,r[ju]=e,r[ph]=t,r},"createBuilder"),Nne=a((n,e)=>{if(n.level<=0||!e)return n[ph]?"":e;let t=n[ju];if(t===void 0)return e;let{openAll:r,closeAll:i}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=TM(e,t.close,t.open),t=t.parent;let s=e.indexOf(`
|
|
@@ -594,7 +594,7 @@ setting__Setting_value: ${i}
|
|
|
594
594
|
|
|
595
595
|
Homoiconic validation-check setting (RFC f402002b, M1.5). \`Exocortex: Validate vault\` reads this instance's \`setting__Setting_value\` to decide whether to run the **${r}** check (key \`[[${t}]]\`). Scaffolded default \u2014 edit \`setting__Setting_value\` to toggle.
|
|
596
596
|
`}a(Toe,"settingAsset");function Aj(){return new _e("scaffold").description("Scaffold homoiconic configuration assets").addCommand(Aoe())}a(Aj,"scaffoldCommand");function Aoe(){return new _e("validation-settings").description("Scaffold the 4 validation-check setting__Setting instances (uid-uniqueness=true, rest=false) co-located in the chosen ontology").requiredOption("--vault <path>","Vault root directory").requiredOption("--ontology <uid>","UID of the ontology whose folder the check settings are co-located in").option("--output <type>","Response format: text|json","text").action(async n=>{let e=n.output??"text";ce.setFormat(e);try{let t=(0,Bc.resolve)(n.vault);if(!(0,hb.existsSync)(t)||!(0,hb.statSync)(t).isDirectory())throw new qe(t);let s=(await new Si(t).indexedAssets()).find(u=>(0,Ws.readUid)(u.metadata)===n.ontology);if(!s)throw new Error(`Ontology UID "${n.ontology}" not found in vault ${t} (its folder is where the check settings co-locate).`);let o=(0,Bc.join)(t,(0,Bc.dirname)(s.path)),c=new Date().toISOString().slice(0,19),l=[];for(let u of Eoe){let f=(0,Tj.randomUUID)(),d=(0,Bc.join)(o,`${f}.md`);await(0,Ej.writeFile)(d,Toe(f,n.ontology,u.checkId,u.label,u.value,c),"utf-8"),l.push(d)}if(e==="json")console.log(JSON.stringify({vaultPath:t,ontology:n.ontology,targetDir:o,created:l},null,2));else{console.log(`OK: scaffolded ${l.length} validation-check setting(s) in ${o}`);for(let u of l)console.log(` ${u}`);console.log(`
|
|
597
|
-
Defaults: uid-uniqueness=true, co-location/shacl/dag=false. Run 'exocortex validate vault --vault <path>'.`)}}catch(t){ce.handle(t)}})}a(Aoe,"scaffoldValidationCommand");var Uj=require("fs"),Bj=require("path");var pb=se(No()),mb=se(require("path"));var Yu=se(et()),yb=se(et());var Ioe=Yu.SDK_FLOOR_ASSETSPACE_UIDS,Th="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb",aI="3de846cd-1f0e-4f98-8613-b8587aa15174",xoe=5,gb=class{static{a(this,"CliProfileResolver")}constructor(e){this.vaultPaths=[mb.default.resolve(e.vaultPath)],this.maxExtendsDepth=e.maxExtendsDepth??xoe,this.warn=e.warn??(()=>{})}async resolveFilter(e){if(e==null||e==="")return{outcome:"no-profile"};let t;try{t=await this.scanAllVaults()}catch(f){let d=`[CliProfileResolver] vault scan threw \u2014 ${String(f)}`;return this.warn(d),{outcome:"error",reason:d}}if(t.profiles.get(e)===void 0)return this.warn(`[CliProfileResolver] profileUid=${e} not found in any scanned vault \u2014 falling back to no-filter (full vault).`),{outcome:"missing-profile",profileUid:e};let i=new Set;try{this.walkProfileChain(e,t.profiles,i,new Set,0)}catch(f){let d=`[CliProfileResolver] profile chain walk threw \u2014 ${String(f)}`;return this.warn(d),{outcome:"error",reason:d}}let s=(0,Yu.transitiveDependsOnClosure)(i,t.dependsOn),o=new Set(t.folderMap.values()),c=new Set,l=[];for(let f of s){if(o.has(f)){c.add(f);continue}l.push(f)}for(let f of Ioe)c.add(f);if(!Array.from(c).some(f=>o.has(f))){let f=`[CliProfileResolver] profileUid=${e} produced effective set with zero AssetSpace folder overlap (${c.size} AS UIDs incl. floor; ${t.folderMap.size} folders known). Likely cause: profile declares AssetSpace UIDs not present as descriptors, or vault has no scanned AssetSpaces. Falling back to no-filter (full vault indexed).`;return this.warn(f),{outcome:"degraded",reason:f}}return{outcome:"engaged",result:{effective:c,folderMap:t.folderMap,declaredOntologies:s,untranslated:l}}}walkProfileChain(e,t,r,i,s){if(s>this.maxExtendsDepth)throw new Error(`Profile chain exceeds max depth ${this.maxExtendsDepth} at ${e} \u2014 possible cycle`);if(i.has(e))return;i.add(e);let o=t.get(e);if(o!==void 0){for(let c of o.includes)r.add(c);typeof o.extends=="string"&&o.extends.length>0&&this.walkProfileChain(o.extends,t,r,i,s+1)}}async scanAllVaults(){let e=new Map,t=new Map,r=new Map;for(let i of this.vaultPaths){if(!await pb.default.pathExists(i)){this.warn(`[CliProfileResolver] vault path does not exist: ${i} \u2014 skipping.`);continue}let s=await this.walkVault(i);for(let o of s){let c=Vo(o.frontmatter.exo__Instance_class);if(c.some(l=>l===Th)){let l=Coe(o.filePath,o.vaultRoot);l.length>0&&!e.has(l)&&e.set(l,o.uid);let u=typeof o.frontmatter.exo__AssetSpace_source=="string"?o.frontmatter.exo__AssetSpace_source:typeof o.frontmatter.exo__AssetSpace_git=="string"?o.frontmatter.exo__AssetSpace_git:"";if(u.length>0){let d=(0,Yu.derivePath)(u);d!==null&&e.set(d,o.uid)}let f=Vo(o.frontmatter.exo__AssetSpace_dependsOn);f.length>0&&r.set(o.uid,f)}if(c.some(l=>l===aI)){let l={uid:o.uid,label:typeof o.frontmatter.exo__Asset_label=="string"?o.frontmatter.exo__Asset_label:void 0,includes:Vo(o.frontmatter.exo__Profile_includes),extends:Vo(o.frontmatter.exo__Profile_imports)[0]??null};t.set(o.uid,l)}}}return{folderMap:e,profiles:t,dependsOn:r}}async walkVault(e){let t=[],r=[e];for(;r.length>0;){let i=r.pop(),s;try{s=await pb.default.readdir(i,{withFileTypes:!0})}catch{continue}for(let o of s){let c=mb.default.join(i,o.name);if(o.isDirectory()){if(o.name.startsWith(".")||o.name==="node_modules"||o.name===".obsidian"||o.name===".exocortex")continue;r.push(c);continue}if(!o.isFile()||!o.name.endsWith(".md"))continue;let l=await this.tryReadFrontmatter(c);if(l===null)continue;let u=l.exo__Asset_uid;typeof u!="string"||u.length===0||t.push({uid:u,filePath:c,vaultRoot:e,frontmatter:l})}}return t}async tryReadFrontmatter(e){let t;try{t=await pb.default.readFile(e,"utf-8")}catch{return null}if(!t.startsWith("---"))return null;let r=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(r===null)return null;try{let i=Dt.load(r[1]);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch{return null}}};function Vo(n){if(n==null)return[];let e=Array.isArray(n)?n:[n],t=[];for(let r of e){if(typeof r!="string")continue;let i=Roe(r);i!==null&&t.push(i)}return t}a(Vo,"parseWikilinkArray");function Roe(n){let e=n.trim().replace(/^\[\[/,"").replace(/\]\]$/,"").split("|")[0].trim();return e.length===0?null:e}a(Roe,"extractUidFromWikilink");function Coe(n,e){let t=mb.default.relative(e,n).replace(/\\/g,"/");if(!t.startsWith("assetspaces/"))return"";let r=t.slice(12),i=r.indexOf("/");return i<0?"":`assetspaces/${r.slice(0,i)}`}a(Coe,"parentFolderRelative");var Vc=require("node:fs"),Qu=require("node:path");var Kn=se(et());var Ct=require("node:fs"),xj=require("node:fs/promises"),Rj=require("node:os"),ln=require("node:path"),qo=se(et());var Ooe=/^https:\/\/github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(?:\.git)?$/,Ij=50*1024*1024,zn=class n{static{a(this,"BootstrapAssetSpaceService")}static{this.PAT_REGEX=/(?:gh[pousr]_[A-Za-z0-9_]{36,}|github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,})/g}constructor(e={}){this.fetchImpl=e.fetchImpl??globalThis.fetch,this.token=e.token??"",this.mountBaseStore=e.mountBaseStore}redact(e){return(typeof e=="string"?e:String(e)).replace(n.PAT_REGEX,"***REDACTED***")}static parseGitHubURL(e){let t=e.match(Ooe);if(t===null)throw new Error(`parseGitHubURL: invalid URL shape \u2014 expected https://github.com/<owner>/<repo>, got: ${e}`);return{owner:t[1],repo:t[2]}}static deriveFolderName(e){let{repo:t}=n.parseGitHubURL(e);return t.startsWith("exoas-")?t.slice(6):t}async pullAssetSpace(e,t,r){let{owner:i,repo:s}=n.parseGitHubURL(e);if((0,Ct.existsSync)(r)&&(0,Ct.readdirSync)(r).length>0)throw new Error(`pullAssetSpace: target ${r} exists \u0438 not empty \u2014 refusing \u043A overwrite`);let o=await(0,qo.mountAssetSpaceFiles)({http:this.httpPort(),fs:this.fsPort(),owner:i,repo:s,ref:t,targetPath:r});if(this.mountBaseStore!==void 0)try{await this.mountBaseStore.set(`${i}/${s}#${qo.SYNC_BRANCH}`,o.sha)}catch{}return o}httpPort(){let e=this.fetchImpl,t=this.token,r=a(i=>this.redact(i),"redact");return{async fetchTarball(i,s,o){let c=`https://api.github.com/repos/${i}/${s}/tarball/${o}`,l={signal:AbortSignal.timeout(6e4)};t.length>0&&(l.headers={Authorization:`Bearer ${t}`,"User-Agent":"exocortex-cli","X-GitHub-Api-Version":"2022-11-28"});let u;try{u=await e(c,l)}catch(d){throw new Error(r(`pullAssetSpace: fetch error for ${c}: ${d instanceof Error?d.message:String(d)}`))}if(!u.ok){if(u.status===403){let d=u.headers?.get?.("x-ratelimit-remaining"),h=u.headers?.get?.("x-ratelimit-reset");if(d==="0"||h!=null){let p=h!=null?new Date(Number(h)*1e3).toISOString():"unknown";throw new Error(`pullAssetSpace: GitHub anonymous API rate-limit exceeded (60 req/hour). Reset at ${p}. Wait or use authenticated CLI.`)}}if(u.status===404){let d=t.length>0?"repo not found, or the provided token lacks access to it":"if this is a private repo, pass --token <pat> (or set GITHUB_TOKEN / GH_TOKEN)";throw new Error(r(`pullAssetSpace: fetch failed (404 Not Found) for ${c} \u2014 ${d}`))}throw new Error(r(`pullAssetSpace: fetch failed (${u.status} ${u.statusText}) for ${c}`))}let f=await u.arrayBuffer();if(f.byteLength>Ij)throw new Error(`pullAssetSpace: tarball too large (${f.byteLength} bytes > ${Ij})`);return new Uint8Array(f)}}}fsPort(){return{async exists(e){return(0,Ct.existsSync)(e)},async read(e){return(0,Ct.readFileSync)(e,"utf8")},async write(e,t){(0,Ct.writeFileSync)(e,t,{encoding:"utf8"})},async removeDir(e){(0,Ct.rmSync)(e,{recursive:!0,force:!0})},async materialize(e,t,r){let i=await(0,xj.mkdtemp)((0,ln.join)((0,Rj.tmpdir)(),`exo-bootstrap-${(0,ln.basename)(e)}-`)),s=0;try{for(let o of t){let c=o.relPath;if(c.split("/").some(u=>u===".."))throw new Error(`pullAssetSpace: path traversal detected for entry "${c}"`);let l=(0,ln.resolve)(i,c);if(l!==i&&!l.startsWith(i+ln.sep))throw new Error(`pullAssetSpace: zip-slip detected for entry "${c}"`);(0,Ct.mkdirSync)((0,ln.dirname)(l),{recursive:!0}),(0,Ct.writeFileSync)(l,o.content),s++,r?.(s)}(0,Ct.mkdirSync)((0,ln.dirname)(e),{recursive:!0});try{(0,Ct.renameSync)(i,e)}catch(o){if(o.code==="EXDEV"){let{cpSync:c}=await import("node:fs");c(i,e,{recursive:!0}),(0,Ct.rmSync)(i,{recursive:!0,force:!0})}else throw o}}catch(o){throw(0,Ct.rmSync)(i,{recursive:!0,force:!0}),o}return s}}}ensureGitmodulesEntry(e,t,r){let i=(0,ln.join)(e,".gitmodules"),s="";try{s=(0,Ct.readFileSync)(i,"utf8")}catch(l){if(l.code!=="ENOENT")throw l}let{content:o,added:c}=(0,qo.appendGitmodulesEntry)(s,t,r);return c?((0,Ct.appendFileSync)(i,o.slice(s.length),{encoding:"utf8"}),{added:!0}):{added:!1}}removeGitmodulesEntry(e,t){let r=(0,ln.join)(e,".gitmodules"),i;try{i=(0,Ct.readFileSync)(r,"utf8")}catch(o){if(o.code==="ENOENT")return{removed:!1};throw o}let s=(0,qo.stripGitmodulesEntry)(i,t);return s===i?{removed:!1}:((0,Ct.writeFileSync)(r,s,{encoding:"utf8"}),{removed:!0})}static stripGitmodulesEntry(e,t){return(0,qo.stripGitmodulesEntry)(e,t)}unmountAssetSpace(e,t){let r=t.split("/");if(t.length===0||!t.startsWith("assetspaces/")||r.some(o=>o.length===0||o==="."||o===".."))throw new Error(`unmountAssetSpace: refusing unsafe submodulePath "${t}"`);let i=(0,ln.resolve)(e),s=(0,ln.resolve)(i,t);if(s===i||!s.startsWith(i+ln.sep))throw new Error(`unmountAssetSpace: target "${s}" escapes vault root "${i}"`);this.removeGitmodulesEntry(e,t),(0,Ct.existsSync)(s)&&(0,Ct.rmSync)(s,{recursive:!0,force:!0})}};function Poe(n){let e=(0,Kn.derivePath)(n);return e===null?n:(0,Kn.deriveUrl)(e)??n}a(Poe,"toHttpsGitHubUrl");var Foe=new Set(["node_modules",".obsidian",".exocortex",".git"]),Xu=class{static{a(this,"CliApplyProfileService")}constructor(e){this.vaultPath=e.vaultPath,this.mount=e.mount??new zn,this.ref=e.ref??"main"}scanVault(){let e=[],t=new Map,r=new Set,i=[this.vaultPath];for(;i.length>0;){let s=i.pop(),o;try{o=(0,Vc.readdirSync)(s,{withFileTypes:!0})}catch{continue}for(let c of o){let l=(0,Qu.join)(s,c.name);if(c.isDirectory()){if(c.name.startsWith(".")||Foe.has(c.name))continue;i.push(l);continue}if(!c.isFile()||!c.name.endsWith(".md"))continue;let u=this.readFrontmatter(l);if(u===null)continue;let f=u.exo__Asset_uid;if(typeof f!="string"||f.length===0)continue;let d=Vo(u.exo__Instance_class);if(d.includes(Th)){if(r.has(f))continue;let p=(typeof u.exo__AssetSpace_source=="string"?u.exo__AssetSpace_source:"")||(typeof u.exo__AssetSpace_git=="string"?u.exo__AssetSpace_git:"");if(p.length===0)continue;let g=(0,Kn.derivePath)(p);if(g===null)continue;let y=typeof u.exo__AssetSpace_namespace=="string"?u.exo__AssetSpace_namespace:"",b=y||Loe(g)||f.slice(0,8);r.add(f),e.push({uid:f,git:p,folderName:g,label:b,namespace:y})}if(d.includes(aI)){let h=u.exo__Asset_label;typeof h=="string"&&h.length>0&&t.set(f,h)}}}return{infos:e,profileLabels:t}}assertTsFloor(e,t){(0,Kn.assertTsFloorReconciled)(e,t,Kn.SDK_FLOOR)}buildDiff(e){let{targetProfileUid:t,targetProfileLabel:r,sourceProfileUid:i,sourceProfileLabel:s,result:o,infos:c}=e,l=new Map;for(let v of c)l.set(v.uid,v);let u=new Set(l.keys()),f=new Set,d=new Set;for(let v of o.declaredOntologies)if(u.has(v)){f.add(v);let I=l.get(v)?.namespace;I!==void 0&&I.length>0&&d.add(I)}this.assertTsFloor(f,d);let h=new Set([...o.effective,...f]),p=new Set;for(let v of c)(0,Vc.existsSync)((0,Qu.join)(this.vaultPath,v.folderName))&&p.add(v.uid);for(let v of c)Kn.CATALOG_KEEP_NAMESPACES.has(v.namespace)&&p.has(v.uid)&&h.add(v.uid);let g=[];for(let v of c)p.has(v.uid)&&(h.has(v.uid)||g.push({asUid:v.uid,folderName:v.folderName,label:v.label,files:this.enumerateFilesUnder(v.folderName)}));let y=[];for(let v of h){if(p.has(v))continue;let I=l.get(v);I!==void 0&&y.push({asUid:I.uid,folderName:I.folderName,httpsUrl:Poe(I.git),label:I.label})}let b=new Map;for(let v of g)b.set(v.asUid,v.files);let S={targetProfileUid:t,targetProfileLabel:r,sourceProfileUid:i,sourceProfileLabel:s,filesToDestroy:b,assetSpacesBeingTornDown:g.map(v=>({asUid:v.asUid,asLabel:v.label,fileCount:v.files.length})),assetSpacesBeingMaterialized:y.map(v=>({asUid:v.asUid,asLabel:v.label}))};return{toDestroy:g,toMaterialize:y,plan:S}}async execute(e){let t=[],r=[];for(let i of e.toDestroy)this.mount.unmountAssetSpace(this.vaultPath,i.folderName),t.push(i.asUid);for(let i of e.toMaterialize){let s=(0,Qu.join)(this.vaultPath,i.folderName);await this.mount.pullAssetSpace(i.httpsUrl,this.ref,s),this.mount.ensureGitmodulesEntry(this.vaultPath,i.folderName,i.httpsUrl),r.push(i.asUid)}return{destroyed:t,materialized:r}}enumerateFilesUnder(e){let t=[],i=[(0,Qu.join)(this.vaultPath,e)];for(;i.length>0;){let s=i.pop(),o;try{o=(0,Vc.readdirSync)(s,{withFileTypes:!0})}catch{continue}for(let c of o){let l=(0,Qu.join)(s,c.name);if(c.isDirectory()){if(c.name.startsWith("."))continue;i.push(l);continue}c.isFile()&&t.push(Doe(l,this.vaultPath))}}return t}readFrontmatter(e){let t;try{t=(0,Vc.readFileSync)(e,"utf-8")}catch{return null}if(!t.startsWith("---"))return null;let r=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(r===null)return null;try{let i=Dt.load(r[1]);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch{return null}}};function Doe(n,e){let t=e.endsWith("/")?e:e+"/";return(n.startsWith(t)?n.slice(t.length):n).split("\\").join("/")}a(Doe,"relativeVaultPath");function Loe(n){let e=n.split("/").filter(t=>t.length>0);return e.length>0?e[e.length-1]:""}a(Loe,"lastSegment");var vr=require("node:fs"),kj=require("node:crypto"),Mj=require("node:child_process"),jj=require("node:util"),Er=se(require("node:path"));var nt=se(et());var Go=require("node:fs"),Pj=require("node:crypto"),Ei=se(require("node:path"));var Ti=se(et());var Cj=require("node:child_process"),Oj=se(et());var Noe=6e4,Hs=class n{static{a(this,"RestPushService")}static{this.PAT_REGEX=/(?:gh[pousr]_[A-Za-z0-9_]{36,}|github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,})/g}constructor(e={}){this.fetchImpl=e.fetchImpl??globalThis.fetch,this.token=e.token??"",this.apiBase=(e.apiBase??"https://api.github.com").replace(/\/$/,"")}static resolveGhToken(e){let t=e??(()=>(0,Cj.execFileSync)("gh",["auth","token"],{encoding:"utf8",timeout:15e3})),r;try{r=t()}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`RestPushService: \`gh auth token\` failed \u2014 is GitHub CLI installed and authenticated? (run \`gh auth login\`). Underlying: ${o}`.replace(n.PAT_REGEX,"***REDACTED***"))}let i=r.trim();if(i.length===0)throw new Error("RestPushService: `gh auth token` returned empty output \u2014 not authenticated. Run `gh auth login`.");return i}redact(e){return(typeof e=="string"?e:String(e)).replace(n.PAT_REGEX,"***REDACTED***")}async push(e,t,r,i,s){return(0,Oj.restCreateCommit)(this.buildTransport(),{owner:e,repo:t,branch:r,files:i,message:s,baseURL:this.apiBase,redact:a(o=>this.redact(o),"redact")})}transport(){return this.buildTransport()}buildTransport(){let e=this.token,t=this.fetchImpl,r=a(i=>this.redact(i),"redact");return async i=>{let s={Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":"exocortex-cli"};e.length>0&&(s.Authorization=`Bearer ${e}`),i.contentType&&(s["Content-Type"]=i.contentType);let o;try{o=await t(i.url,{method:i.method,headers:s,body:i.body,signal:AbortSignal.timeout(Noe)})}catch(u){throw new Error(r(`GitHub request failed: ${koe(u)}`))}let c=await o.text().catch(()=>"");if(o.status<200||o.status>=300)throw new Error(Moe(r(`GitHub request ${i.method} ${i.url} \u2192 HTTP ${o.status}: ${c}`),512));let l;try{l=c.length>0?JSON.parse(c):void 0}catch{l=void 0}return{status:o.status,json:l,text:c}}}};function koe(n){if(n instanceof Error)return n.message;if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}}a(koe,"errMsg");function Moe(n,e){return n.length>e?n.slice(0,e)+"...":n}a(Moe,"truncate");var joe=a(async n=>{let e=await Pj.webcrypto.subtle.digest("SHA-1",n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")},"nodeSha1"),$oe={parse:a(n=>Dt.load(n,{schema:Dt.CORE_SCHEMA}),"parse"),stringify:a(n=>Dt.dump(n,{schema:Dt.CORE_SCHEMA,lineWidth:-1}),"stringify")};function Uoe(n,e){if(n.tokenFromGh===!0)return Hs.resolveGhToken(e.ghTokenRunner);let t=e.env??process.env,r=n.token||t.GITHUB_TOKEN||t.GH_TOKEN||"";if(r.length===0)throw new Error("A GitHub token is required (private sync units read as 404 without one). Use --token-from-gh, --token <pat>, or set GITHUB_TOKEN / GH_TOKEN.");return r}a(Uoe,"resolveToken");function Boe(n){let e=a(r=>Ei.join(n,r),"abs"),t=a(async(r,i)=>{let s;try{s=await Go.promises.readdir(r,{withFileTypes:!0})}catch{return}for(let o of s){let c=Ei.join(r,o.name);if(o.isDirectory()){if(o.name===".git")continue;await t(c,i)}else o.isFile()&&i.push(Ei.relative(n,c).split(Ei.sep).join("/"))}},"walk");return{async list(){let r=[];return(0,Go.existsSync)(n)&&await t(n,r),r},read:a(r=>Go.promises.readFile(e(r),"utf-8"),"read"),async readBinary(r){return new Uint8Array(await Go.promises.readFile(e(r)))},async write(){throw new Error("exosync-parity is read-only \u2014 write refused")},async delete(){throw new Error("exosync-parity is read-only \u2014 delete refused")}}}a(Boe,"nodeLocalFilesPort");function Ju(n){let e=new Xt(n),t=new Ti.SpaceSpecAccumulator;for(let r of e.getAllFiles()){let i=e.getFrontmatter(r);if(!i)continue;let s=(0,Ti.classifySpaceDeclaration)(i,r.path);if(s.kind==="not-space"||(s.warning!==void 0&&t.warnings.push(s.warning),s.kind==="skip"))continue;let o=t.offer(s.candidate);o!==null&&(0,Go.existsSync)(Ei.join(n,o.localPath))&&t.commit(s.candidate)}return{specs:t.specs,warnings:t.warnings}}a(Ju,"collectVaultSpecs");function Voe(n,e){for(let t of n.repos){let r=t.headSha!==void 0?` @${t.headSha.slice(0,7)}`:"";e(`${t.repoKey}${r}: ${t.status} \u2014 ${t.inParity}/${t.filesChecked} in parity, M2 diffs ${t.m2SemanticDiffs}, accounted ${t.accountedCount}, M1 violations ${t.m1Violations.length}${t.attachmentHashSetIdentical!==void 0?`, attachment hash-set ${t.attachmentHashSetIdentical?"identical":"DIFFERS"}`:""}`),t.detail!==void 0&&e(` ${t.detail}`);for(let i of t.warnings)e(` warn: ${i}`);for(let i of t.discrepancies)e(` ${i.cls}: ${i.path}${i.detail!==void 0?` (${i.detail})`:""}`);for(let i of t.m1Violations)e(` M1 VIOLATION: ${i.path} \u2014 ${i.detail}`)}e((0,Ti.summarizeParityRound)(n))}a(Voe,"printHumanReport");async function qoe(n,e={}){let t=e.out??(g=>console.log(g)),r=Ei.resolve(n.vault);if(!(0,Go.existsSync)(r))throw new Error(`Vault path does not exist: ${r}`);let i=Uoe(n,e),s=new Hs({token:i,...n.apiBase!==void 0?{apiBase:n.apiBase}:{}}),o=e.transportFactory?.(i,n.apiBase)??s.transport(),{specs:c,warnings:l}=Ju(r);for(let g of l)t(`warn: ${g}`);if(c.length===0)return t("Nothing to check \u2014 no materialized AssetSpaces with a GitHub source found in this vault."),2;let u=n.configDir??".obsidian",f=Ei.join(r,u,"plugins","exocortex",Ti.WATERMARK_STORE_FILENAME),d=new Ti.FileWatermarkStore({read:a(async()=>{try{return await Go.promises.readFile(f,"utf-8")}catch{return null}},"read"),writeAtomic:a(async()=>{throw new Error("exosync-parity: watermark access is read-only by contract")},"writeAtomic")}),h=new Ti.ParityValidator({transport:o,sha1:joe,localFilesFor:a(g=>Boe(Ei.join(r,g.localPath)),"localFilesFor"),watermarks:{get:a(g=>d.get(g),"get")},yaml:$oe,redact:a(g=>s.redact(g),"redact"),...n.apiBase!==void 0?{baseURL:n.apiBase}:{}});t(`ExoSync parity check: ${c.length} repo(s), vault ${r}`);let p=await h.runRound(c,{trigger:"standalone"});return n.json===!0?t(JSON.stringify(p,null,2)):Voe(p,t),p.vacuous?2:p.ok?0:1}a(qoe,"runExosyncParity");function Fj(){return new _e("exosync-parity").description("ExoSync M1/M2 parity report: compare materialized sync units against their remote heads (read-only; RFC 4e4dc453 Phase E)").requiredOption("--vault <path>","Vault root path").option("--config-dir <name>","Obsidian config dir name (watermark location)",".obsidian").option("--json","Print the full round record as JSON").option("--token <pat>","GitHub PAT (or env GITHUB_TOKEN / GH_TOKEN). Prefer --token-from-gh.").option("--token-from-gh","Resolve the PAT via `gh auth token`").option("--api-base <url>","GitHub API base (testing)").action(async n=>{try{process.exitCode=await qoe(n)}catch(e){ce.handle(e,{command:"exosync-parity"}),process.exitCode=1}})}a(Fj,"exosyncParityCommand");var Yn=require("node:fs"),lI=require("node:crypto"),Rn=se(require("node:path")),Cn=se(et());var Goe="exosync-watermarks.local.json";function Lj(n,e,t){let r=dI(e,t),i=new Hs({token:r,...e.apiBase!==void 0?{apiBase:e.apiBase}:{}}),s=t.transportFactory?.(r,e.apiBase)??i.transport(),{specs:o,warnings:c}=Ju(n),l=e.configDir??".obsidian",u=Rn.join(n,l,"plugins","exocortex",Goe),f=Rn.join(n,l,"plugins","exocortex",Cn.CONFLICT_CACHE_STORE_FILENAME),d=new Cn.LocalConflictCacheStore({io:Wo(f)}),h=Rn.join(n,l,"plugins","exocortex",Cn.OUTBOX_STORE_FILENAME),p=new Cn.LocalOutboxStore({io:Wo(h)});return{resolver:new Cn.QuarantineResolver({transport:s,watermarkStore:new Cn.FileWatermarkStore(Wo(u)),localFilesFor:a(y=>bb(Rn.join(n,y.localPath)),"localFilesFor"),sha1:fI,...e.apiBase!==void 0?{baseURL:e.apiBase}:{},redact:a(y=>i.redact(y),"redact"),conflictCache:d,outbox:p}),specs:o,warnings:c}}a(Lj,"buildResolver");async function Woe(n,e={}){let t=e.out??(l=>console.log(l)),r=Rn.resolve(n.vault);if(!(0,Yn.existsSync)(r))throw new Error(`Vault path does not exist: ${r}`);let{resolver:i,specs:s,warnings:o}=Lj(r,n,e);for(let l of o)t(`warn: ${l}`);if(s.length===0)return t("No materialized AssetSpaces with a GitHub source found in this vault."),0;let c=await i.listOpenConflicts(s);if(n.json===!0)return t(JSON.stringify(c,null,2)),0;if(c.length===0)return t("No open conflicts \u2014 nothing to resolve. \u2705"),0;t(`${c.length} open conflict(s):`);for(let l of c){let u=`${l.hasLocal?"local":"(no local)"} vs ${l.hasRemote?"remote":"(no remote)"}`;t(` ${l.repoKey} ${l.path} [${u}]${l.uid?` uid=${l.uid}`:""}`)}return t(""),t("Resolve with: exosync quarantine resolve <path> --take local|remote|file <path> --vault <vault>"),0}a(Woe,"runQuarantineList");async function Hoe(n,e,t={}){let r=t.out??(b=>console.log(b)),i=Rn.resolve(e.vault);if(!(0,Yn.existsSync)(i))throw new Error(`Vault path does not exist: ${i}`);let s=(e.take??"").trim();if(s!=="local"&&s!=="remote"&&s!=="file")throw new Error("resolve requires --take local | remote | file (with --file <path> for the merged content)");let o;if(s==="file"){if(e.file===void 0||e.file.length===0)throw new Error("--take file requires --file <path> to the merged content");o={take:"merged",content:await Yn.promises.readFile(Rn.resolve(e.file),"utf-8")}}else o={take:s};let{resolver:c,specs:l,warnings:u}=Lj(i,e,t);for(let b of u)r(`warn: ${b}`);let d=(await c.listOpenConflicts(l)).filter(b=>b.path===n&&(e.repo===void 0||b.repoKey===e.repo));if(d.length===0)return r(`No open conflict for "${n}"${e.repo?` in ${e.repo}`:""} \u2014 run \`exosync quarantine list\` to see the current set.`),1;if(d.length>1){r(`"${n}" conflicts in ${d.length} repos \u2014 disambiguate with --repo <repoKey>:`);for(let b of d)r(` --repo ${b.repoKey}`);return 1}let h=d[0],p=l.find(b=>b.repoKey===h.repoKey),g=await c.resolve(p,h.path,o),y=g.awaitingPush===!0?" \u2014 awaiting push (run `exosync sync` to push it)":g.pushedSha!==void 0?` \u2014 pushed @${g.pushedSha.slice(0,7)}`:" \u2014 remote already matched";return r(`Resolved ${h.path} (${g.resolvedTo}) in ${h.repoKey}${y}.`),g.discardedLocalBackupPath!==void 0&&r(` \u21B3 your discarded local version is preserved at ${p.localPath}/${g.discardedLocalBackupPath}`),0}a(Hoe,"runQuarantineResolve");function Dj(n,e){let t=/^(---\r?\n)([\s\S]*?)(\r?\n---(?=\r?\n|$))/.exec(n);if(t===null)return n;let r=t[2].replace(/^(exo__Asset_uid:[ \t]*["']?)[^\s"']+(["']?[ \t]*)$/m,`$1${e}$2`);return r===t[2]?n:n.slice(0,t.index)+t[1]+r+t[3]+n.slice(t.index+t[0].length)}a(Dj,"rewriteUid");function uI(n){return n.replace(/\r\n?/g,`
|
|
597
|
+
Defaults: uid-uniqueness=true, co-location/shacl/dag=false. Run 'exocortex validate vault --vault <path>'.`)}}catch(t){ce.handle(t)}})}a(Aoe,"scaffoldValidationCommand");var Uj=require("fs"),Bj=require("path");var pb=se(No()),mb=se(require("path"));var Yu=se(et()),yb=se(et());var Ioe=Yu.SDK_FLOOR_ASSETSPACE_UIDS,Th="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb",aI="3de846cd-1f0e-4f98-8613-b8587aa15174",xoe=5,gb=class{static{a(this,"CliProfileResolver")}constructor(e){this.vaultPaths=[mb.default.resolve(e.vaultPath)],this.maxExtendsDepth=e.maxExtendsDepth??xoe,this.warn=e.warn??(()=>{})}async resolveFilter(e){if(e==null||e==="")return{outcome:"no-profile"};let t;try{t=await this.scanAllVaults()}catch(f){let d=`[CliProfileResolver] vault scan threw \u2014 ${String(f)}`;return this.warn(d),{outcome:"error",reason:d}}if(t.profiles.get(e)===void 0)return this.warn(`[CliProfileResolver] profileUid=${e} not found in any scanned vault \u2014 falling back to no-filter (full vault).`),{outcome:"missing-profile",profileUid:e};let i=new Set;try{this.walkProfileChain(e,t.profiles,i,new Set,0)}catch(f){let d=`[CliProfileResolver] profile chain walk threw \u2014 ${String(f)}`;return this.warn(d),{outcome:"error",reason:d}}let s=(0,Yu.transitiveDependsOnClosure)(i,t.dependsOn),o=new Set(t.folderMap.values()),c=new Set,l=[];for(let f of s){if(o.has(f)){c.add(f);continue}l.push(f)}for(let f of Ioe)c.add(f);if(!Array.from(c).some(f=>o.has(f))){let f=`[CliProfileResolver] profileUid=${e} produced effective set with zero AssetSpace folder overlap (${c.size} AS UIDs incl. floor; ${t.folderMap.size} folders known). Likely cause: profile declares AssetSpace UIDs not present as descriptors, or vault has no scanned AssetSpaces. Falling back to no-filter (full vault indexed).`;return this.warn(f),{outcome:"degraded",reason:f}}return{outcome:"engaged",result:{effective:c,folderMap:t.folderMap,declaredOntologies:s,untranslated:l}}}walkProfileChain(e,t,r,i,s){if(s>this.maxExtendsDepth)throw new Error(`Profile chain exceeds max depth ${this.maxExtendsDepth} at ${e} \u2014 possible cycle`);if(i.has(e))return;i.add(e);let o=t.get(e);if(o!==void 0){for(let c of o.includes)r.add(c);typeof o.extends=="string"&&o.extends.length>0&&this.walkProfileChain(o.extends,t,r,i,s+1)}}async scanAllVaults(){let e=new Map,t=new Map,r=new Map;for(let i of this.vaultPaths){if(!await pb.default.pathExists(i)){this.warn(`[CliProfileResolver] vault path does not exist: ${i} \u2014 skipping.`);continue}let s=await this.walkVault(i);for(let o of s){let c=Vo(o.frontmatter.exo__Instance_class);if(c.some(l=>l===Th)){let l=Coe(o.filePath,o.vaultRoot);l.length>0&&!e.has(l)&&e.set(l,o.uid);let u=typeof o.frontmatter.exo__AssetSpace_source=="string"?o.frontmatter.exo__AssetSpace_source:typeof o.frontmatter.exo__AssetSpace_git=="string"?o.frontmatter.exo__AssetSpace_git:"";if(u.length>0){let d=(0,Yu.derivePath)(u);d!==null&&e.set(d,o.uid)}let f=Vo(o.frontmatter.exo__AssetSpace_dependsOn);f.length>0&&r.set(o.uid,f)}if(c.some(l=>l===aI)){let l={uid:o.uid,label:typeof o.frontmatter.exo__Asset_label=="string"?o.frontmatter.exo__Asset_label:void 0,includes:Vo(o.frontmatter.exo__Profile_includes),extends:Vo(o.frontmatter.exo__Profile_imports)[0]??null};t.set(o.uid,l)}}}return{folderMap:e,profiles:t,dependsOn:r}}async walkVault(e){let t=[],r=[e];for(;r.length>0;){let i=r.pop(),s;try{s=await pb.default.readdir(i,{withFileTypes:!0})}catch{continue}for(let o of s){let c=mb.default.join(i,o.name);if(o.isDirectory()){if(o.name.startsWith(".")||o.name==="node_modules"||o.name===".obsidian"||o.name===".exocortex")continue;r.push(c);continue}if(!o.isFile()||!o.name.endsWith(".md"))continue;let l=await this.tryReadFrontmatter(c);if(l===null)continue;let u=l.exo__Asset_uid;typeof u!="string"||u.length===0||t.push({uid:u,filePath:c,vaultRoot:e,frontmatter:l})}}return t}async tryReadFrontmatter(e){let t;try{t=await pb.default.readFile(e,"utf-8")}catch{return null}if(!t.startsWith("---"))return null;let r=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(r===null)return null;try{let i=Dt.load(r[1]);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch{return null}}};function Vo(n){if(n==null)return[];let e=Array.isArray(n)?n:[n],t=[];for(let r of e){if(typeof r!="string")continue;let i=Roe(r);i!==null&&t.push(i)}return t}a(Vo,"parseWikilinkArray");function Roe(n){let e=n.trim().replace(/^\[\[/,"").replace(/\]\]$/,"").split("|")[0].trim();return e.length===0?null:e}a(Roe,"extractUidFromWikilink");function Coe(n,e){let t=mb.default.relative(e,n).replace(/\\/g,"/");if(!t.startsWith("assetspaces/"))return"";let r=t.slice(12),i=r.indexOf("/");return i<0?"":`assetspaces/${r.slice(0,i)}`}a(Coe,"parentFolderRelative");var Vc=require("node:fs"),Qu=require("node:path");var Kn=se(et());var Ct=require("node:fs"),xj=require("node:fs/promises"),Rj=require("node:os"),un=require("node:path"),qo=se(et());var Ooe=/^https:\/\/github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(?:\.git)?$/,Ij=50*1024*1024,zn=class n{static{a(this,"BootstrapAssetSpaceService")}static{this.PAT_REGEX=/(?:gh[pousr]_[A-Za-z0-9_]{36,}|github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,})/g}constructor(e={}){this.fetchImpl=e.fetchImpl??globalThis.fetch,this.token=e.token??"",this.mountBaseStore=e.mountBaseStore}redact(e){return(typeof e=="string"?e:String(e)).replace(n.PAT_REGEX,"***REDACTED***")}static parseGitHubURL(e){let t=e.match(Ooe);if(t===null)throw new Error(`parseGitHubURL: invalid URL shape \u2014 expected https://github.com/<owner>/<repo>, got: ${e}`);return{owner:t[1],repo:t[2]}}static deriveFolderName(e){let{repo:t}=n.parseGitHubURL(e);return t.startsWith("exoas-")?t.slice(6):t}async pullAssetSpace(e,t,r){let{owner:i,repo:s}=n.parseGitHubURL(e);if((0,Ct.existsSync)(r)&&(0,Ct.readdirSync)(r).length>0)throw new Error(`pullAssetSpace: target ${r} exists \u0438 not empty \u2014 refusing \u043A overwrite`);let o=await(0,qo.mountAssetSpaceFiles)({http:this.httpPort(),fs:this.fsPort(),owner:i,repo:s,ref:t,targetPath:r});if(this.mountBaseStore!==void 0)try{await this.mountBaseStore.set(`${i}/${s}#${qo.SYNC_BRANCH}`,o.sha)}catch{}return o}httpPort(){let e=this.fetchImpl,t=this.token,r=a(i=>this.redact(i),"redact");return{async fetchTarball(i,s,o){let c=`https://api.github.com/repos/${i}/${s}/tarball/${o}`,l={signal:AbortSignal.timeout(6e4)};t.length>0&&(l.headers={Authorization:`Bearer ${t}`,"User-Agent":"exocortex-cli","X-GitHub-Api-Version":"2022-11-28"});let u;try{u=await e(c,l)}catch(d){throw new Error(r(`pullAssetSpace: fetch error for ${c}: ${d instanceof Error?d.message:String(d)}`))}if(!u.ok){if(u.status===403){let d=u.headers?.get?.("x-ratelimit-remaining"),h=u.headers?.get?.("x-ratelimit-reset");if(d==="0"||h!=null){let p=h!=null?new Date(Number(h)*1e3).toISOString():"unknown";throw new Error(`pullAssetSpace: GitHub anonymous API rate-limit exceeded (60 req/hour). Reset at ${p}. Wait or use authenticated CLI.`)}}if(u.status===404){let d=t.length>0?"repo not found, or the provided token lacks access to it":"if this is a private repo, pass --token <pat> (or set GITHUB_TOKEN / GH_TOKEN)";throw new Error(r(`pullAssetSpace: fetch failed (404 Not Found) for ${c} \u2014 ${d}`))}throw new Error(r(`pullAssetSpace: fetch failed (${u.status} ${u.statusText}) for ${c}`))}let f=await u.arrayBuffer();if(f.byteLength>Ij)throw new Error(`pullAssetSpace: tarball too large (${f.byteLength} bytes > ${Ij})`);return new Uint8Array(f)}}}fsPort(){return{async exists(e){return(0,Ct.existsSync)(e)},async read(e){return(0,Ct.readFileSync)(e,"utf8")},async write(e,t){(0,Ct.writeFileSync)(e,t,{encoding:"utf8"})},async removeDir(e){(0,Ct.rmSync)(e,{recursive:!0,force:!0})},async materialize(e,t,r){let i=await(0,xj.mkdtemp)((0,un.join)((0,Rj.tmpdir)(),`exo-bootstrap-${(0,un.basename)(e)}-`)),s=0;try{for(let o of t){let c=o.relPath;if(c.split("/").some(u=>u===".."))throw new Error(`pullAssetSpace: path traversal detected for entry "${c}"`);let l=(0,un.resolve)(i,c);if(l!==i&&!l.startsWith(i+un.sep))throw new Error(`pullAssetSpace: zip-slip detected for entry "${c}"`);(0,Ct.mkdirSync)((0,un.dirname)(l),{recursive:!0}),(0,Ct.writeFileSync)(l,o.content),s++,r?.(s)}(0,Ct.mkdirSync)((0,un.dirname)(e),{recursive:!0});try{(0,Ct.renameSync)(i,e)}catch(o){if(o.code==="EXDEV"){let{cpSync:c}=await import("node:fs");c(i,e,{recursive:!0}),(0,Ct.rmSync)(i,{recursive:!0,force:!0})}else throw o}}catch(o){throw(0,Ct.rmSync)(i,{recursive:!0,force:!0}),o}return s}}}ensureGitmodulesEntry(e,t,r){let i=(0,un.join)(e,".gitmodules"),s="";try{s=(0,Ct.readFileSync)(i,"utf8")}catch(l){if(l.code!=="ENOENT")throw l}let{content:o,added:c}=(0,qo.appendGitmodulesEntry)(s,t,r);return c?((0,Ct.appendFileSync)(i,o.slice(s.length),{encoding:"utf8"}),{added:!0}):{added:!1}}removeGitmodulesEntry(e,t){let r=(0,un.join)(e,".gitmodules"),i;try{i=(0,Ct.readFileSync)(r,"utf8")}catch(o){if(o.code==="ENOENT")return{removed:!1};throw o}let s=(0,qo.stripGitmodulesEntry)(i,t);return s===i?{removed:!1}:((0,Ct.writeFileSync)(r,s,{encoding:"utf8"}),{removed:!0})}static stripGitmodulesEntry(e,t){return(0,qo.stripGitmodulesEntry)(e,t)}unmountAssetSpace(e,t){let r=t.split("/");if(t.length===0||!t.startsWith("assetspaces/")||r.some(o=>o.length===0||o==="."||o===".."))throw new Error(`unmountAssetSpace: refusing unsafe submodulePath "${t}"`);let i=(0,un.resolve)(e),s=(0,un.resolve)(i,t);if(s===i||!s.startsWith(i+un.sep))throw new Error(`unmountAssetSpace: target "${s}" escapes vault root "${i}"`);this.removeGitmodulesEntry(e,t),(0,Ct.existsSync)(s)&&(0,Ct.rmSync)(s,{recursive:!0,force:!0})}};function Poe(n){let e=(0,Kn.derivePath)(n);return e===null?n:(0,Kn.deriveUrl)(e)??n}a(Poe,"toHttpsGitHubUrl");var Foe=new Set(["node_modules",".obsidian",".exocortex",".git"]),Xu=class{static{a(this,"CliApplyProfileService")}constructor(e){this.vaultPath=e.vaultPath,this.mount=e.mount??new zn,this.ref=e.ref??"main"}scanVault(){let e=[],t=new Map,r=new Set,i=[this.vaultPath];for(;i.length>0;){let s=i.pop(),o;try{o=(0,Vc.readdirSync)(s,{withFileTypes:!0})}catch{continue}for(let c of o){let l=(0,Qu.join)(s,c.name);if(c.isDirectory()){if(c.name.startsWith(".")||Foe.has(c.name))continue;i.push(l);continue}if(!c.isFile()||!c.name.endsWith(".md"))continue;let u=this.readFrontmatter(l);if(u===null)continue;let f=u.exo__Asset_uid;if(typeof f!="string"||f.length===0)continue;let d=Vo(u.exo__Instance_class);if(d.includes(Th)){if(r.has(f))continue;let p=(typeof u.exo__AssetSpace_source=="string"?u.exo__AssetSpace_source:"")||(typeof u.exo__AssetSpace_git=="string"?u.exo__AssetSpace_git:"");if(p.length===0)continue;let g=(0,Kn.derivePath)(p);if(g===null)continue;let y=typeof u.exo__AssetSpace_namespace=="string"?u.exo__AssetSpace_namespace:"",b=y||Loe(g)||f.slice(0,8);r.add(f),e.push({uid:f,git:p,folderName:g,label:b,namespace:y})}if(d.includes(aI)){let h=u.exo__Asset_label;typeof h=="string"&&h.length>0&&t.set(f,h)}}}return{infos:e,profileLabels:t}}assertTsFloor(e,t){(0,Kn.assertTsFloorReconciled)(e,t,Kn.SDK_FLOOR)}buildDiff(e){let{targetProfileUid:t,targetProfileLabel:r,sourceProfileUid:i,sourceProfileLabel:s,result:o,infos:c}=e,l=new Map;for(let v of c)l.set(v.uid,v);let u=new Set(l.keys()),f=new Set,d=new Set;for(let v of o.declaredOntologies)if(u.has(v)){f.add(v);let I=l.get(v)?.namespace;I!==void 0&&I.length>0&&d.add(I)}this.assertTsFloor(f,d);let h=new Set([...o.effective,...f]),p=new Set;for(let v of c)(0,Vc.existsSync)((0,Qu.join)(this.vaultPath,v.folderName))&&p.add(v.uid);for(let v of c)Kn.CATALOG_KEEP_NAMESPACES.has(v.namespace)&&p.has(v.uid)&&h.add(v.uid);let g=[];for(let v of c)p.has(v.uid)&&(h.has(v.uid)||g.push({asUid:v.uid,folderName:v.folderName,label:v.label,files:this.enumerateFilesUnder(v.folderName)}));let y=[];for(let v of h){if(p.has(v))continue;let I=l.get(v);I!==void 0&&y.push({asUid:I.uid,folderName:I.folderName,httpsUrl:Poe(I.git),label:I.label})}let b=new Map;for(let v of g)b.set(v.asUid,v.files);let S={targetProfileUid:t,targetProfileLabel:r,sourceProfileUid:i,sourceProfileLabel:s,filesToDestroy:b,assetSpacesBeingTornDown:g.map(v=>({asUid:v.asUid,asLabel:v.label,fileCount:v.files.length})),assetSpacesBeingMaterialized:y.map(v=>({asUid:v.asUid,asLabel:v.label}))};return{toDestroy:g,toMaterialize:y,plan:S}}async execute(e){let t=[],r=[];for(let i of e.toDestroy)this.mount.unmountAssetSpace(this.vaultPath,i.folderName),t.push(i.asUid);for(let i of e.toMaterialize){let s=(0,Qu.join)(this.vaultPath,i.folderName);await this.mount.pullAssetSpace(i.httpsUrl,this.ref,s),this.mount.ensureGitmodulesEntry(this.vaultPath,i.folderName,i.httpsUrl),r.push(i.asUid)}return{destroyed:t,materialized:r}}enumerateFilesUnder(e){let t=[],i=[(0,Qu.join)(this.vaultPath,e)];for(;i.length>0;){let s=i.pop(),o;try{o=(0,Vc.readdirSync)(s,{withFileTypes:!0})}catch{continue}for(let c of o){let l=(0,Qu.join)(s,c.name);if(c.isDirectory()){if(c.name.startsWith("."))continue;i.push(l);continue}c.isFile()&&t.push(Doe(l,this.vaultPath))}}return t}readFrontmatter(e){let t;try{t=(0,Vc.readFileSync)(e,"utf-8")}catch{return null}if(!t.startsWith("---"))return null;let r=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(r===null)return null;try{let i=Dt.load(r[1]);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch{return null}}};function Doe(n,e){let t=e.endsWith("/")?e:e+"/";return(n.startsWith(t)?n.slice(t.length):n).split("\\").join("/")}a(Doe,"relativeVaultPath");function Loe(n){let e=n.split("/").filter(t=>t.length>0);return e.length>0?e[e.length-1]:""}a(Loe,"lastSegment");var vr=require("node:fs"),kj=require("node:crypto"),Mj=require("node:child_process"),jj=require("node:util"),Er=se(require("node:path"));var nt=se(et());var Go=require("node:fs"),Pj=require("node:crypto"),Ei=se(require("node:path"));var Ti=se(et());var Cj=require("node:child_process"),Oj=se(et());var Noe=6e4,Hs=class n{static{a(this,"RestPushService")}static{this.PAT_REGEX=/(?:gh[pousr]_[A-Za-z0-9_]{36,}|github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,})/g}constructor(e={}){this.fetchImpl=e.fetchImpl??globalThis.fetch,this.token=e.token??"",this.apiBase=(e.apiBase??"https://api.github.com").replace(/\/$/,"")}static resolveGhToken(e){let t=e??(()=>(0,Cj.execFileSync)("gh",["auth","token"],{encoding:"utf8",timeout:15e3})),r;try{r=t()}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`RestPushService: \`gh auth token\` failed \u2014 is GitHub CLI installed and authenticated? (run \`gh auth login\`). Underlying: ${o}`.replace(n.PAT_REGEX,"***REDACTED***"))}let i=r.trim();if(i.length===0)throw new Error("RestPushService: `gh auth token` returned empty output \u2014 not authenticated. Run `gh auth login`.");return i}redact(e){return(typeof e=="string"?e:String(e)).replace(n.PAT_REGEX,"***REDACTED***")}async push(e,t,r,i,s){return(0,Oj.restCreateCommit)(this.buildTransport(),{owner:e,repo:t,branch:r,files:i,message:s,baseURL:this.apiBase,redact:a(o=>this.redact(o),"redact")})}transport(){return this.buildTransport()}buildTransport(){let e=this.token,t=this.fetchImpl,r=a(i=>this.redact(i),"redact");return async i=>{let s={Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":"exocortex-cli"};e.length>0&&(s.Authorization=`Bearer ${e}`),i.contentType&&(s["Content-Type"]=i.contentType);let o;try{o=await t(i.url,{method:i.method,headers:s,body:i.body,signal:AbortSignal.timeout(Noe)})}catch(u){throw new Error(r(`GitHub request failed: ${koe(u)}`))}let c=await o.text().catch(()=>"");if(o.status<200||o.status>=300)throw new Error(Moe(r(`GitHub request ${i.method} ${i.url} \u2192 HTTP ${o.status}: ${c}`),512));let l;try{l=c.length>0?JSON.parse(c):void 0}catch{l=void 0}return{status:o.status,json:l,text:c}}}};function koe(n){if(n instanceof Error)return n.message;if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}}a(koe,"errMsg");function Moe(n,e){return n.length>e?n.slice(0,e)+"...":n}a(Moe,"truncate");var joe=a(async n=>{let e=await Pj.webcrypto.subtle.digest("SHA-1",n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")},"nodeSha1"),$oe={parse:a(n=>Dt.load(n,{schema:Dt.CORE_SCHEMA}),"parse"),stringify:a(n=>Dt.dump(n,{schema:Dt.CORE_SCHEMA,lineWidth:-1}),"stringify")};function Uoe(n,e){if(n.tokenFromGh===!0)return Hs.resolveGhToken(e.ghTokenRunner);let t=e.env??process.env,r=n.token||t.GITHUB_TOKEN||t.GH_TOKEN||"";if(r.length===0)throw new Error("A GitHub token is required (private sync units read as 404 without one). Use --token-from-gh, --token <pat>, or set GITHUB_TOKEN / GH_TOKEN.");return r}a(Uoe,"resolveToken");function Boe(n){let e=a(r=>Ei.join(n,r),"abs"),t=a(async(r,i)=>{let s;try{s=await Go.promises.readdir(r,{withFileTypes:!0})}catch{return}for(let o of s){let c=Ei.join(r,o.name);if(o.isDirectory()){if(o.name===".git")continue;await t(c,i)}else o.isFile()&&i.push(Ei.relative(n,c).split(Ei.sep).join("/"))}},"walk");return{async list(){let r=[];return(0,Go.existsSync)(n)&&await t(n,r),r},read:a(r=>Go.promises.readFile(e(r),"utf-8"),"read"),async readBinary(r){return new Uint8Array(await Go.promises.readFile(e(r)))},async write(){throw new Error("exosync-parity is read-only \u2014 write refused")},async delete(){throw new Error("exosync-parity is read-only \u2014 delete refused")}}}a(Boe,"nodeLocalFilesPort");function Ju(n){let e=new Xt(n),t=new Ti.SpaceSpecAccumulator;for(let r of e.getAllFiles()){let i=e.getFrontmatter(r);if(!i)continue;let s=(0,Ti.classifySpaceDeclaration)(i,r.path);if(s.kind==="not-space"||(s.warning!==void 0&&t.warnings.push(s.warning),s.kind==="skip"))continue;let o=t.offer(s.candidate);o!==null&&(0,Go.existsSync)(Ei.join(n,o.localPath))&&t.commit(s.candidate)}return{specs:t.specs,warnings:t.warnings}}a(Ju,"collectVaultSpecs");function Voe(n,e){for(let t of n.repos){let r=t.headSha!==void 0?` @${t.headSha.slice(0,7)}`:"";e(`${t.repoKey}${r}: ${t.status} \u2014 ${t.inParity}/${t.filesChecked} in parity, M2 diffs ${t.m2SemanticDiffs}, accounted ${t.accountedCount}, M1 violations ${t.m1Violations.length}${t.attachmentHashSetIdentical!==void 0?`, attachment hash-set ${t.attachmentHashSetIdentical?"identical":"DIFFERS"}`:""}`),t.detail!==void 0&&e(` ${t.detail}`);for(let i of t.warnings)e(` warn: ${i}`);for(let i of t.discrepancies)e(` ${i.cls}: ${i.path}${i.detail!==void 0?` (${i.detail})`:""}`);for(let i of t.m1Violations)e(` M1 VIOLATION: ${i.path} \u2014 ${i.detail}`)}e((0,Ti.summarizeParityRound)(n))}a(Voe,"printHumanReport");async function qoe(n,e={}){let t=e.out??(g=>console.log(g)),r=Ei.resolve(n.vault);if(!(0,Go.existsSync)(r))throw new Error(`Vault path does not exist: ${r}`);let i=Uoe(n,e),s=new Hs({token:i,...n.apiBase!==void 0?{apiBase:n.apiBase}:{}}),o=e.transportFactory?.(i,n.apiBase)??s.transport(),{specs:c,warnings:l}=Ju(r);for(let g of l)t(`warn: ${g}`);if(c.length===0)return t("Nothing to check \u2014 no materialized AssetSpaces with a GitHub source found in this vault."),2;let u=n.configDir??".obsidian",f=Ei.join(r,u,"plugins","exocortex",Ti.WATERMARK_STORE_FILENAME),d=new Ti.FileWatermarkStore({read:a(async()=>{try{return await Go.promises.readFile(f,"utf-8")}catch{return null}},"read"),writeAtomic:a(async()=>{throw new Error("exosync-parity: watermark access is read-only by contract")},"writeAtomic")}),h=new Ti.ParityValidator({transport:o,sha1:joe,localFilesFor:a(g=>Boe(Ei.join(r,g.localPath)),"localFilesFor"),watermarks:{get:a(g=>d.get(g),"get")},yaml:$oe,redact:a(g=>s.redact(g),"redact"),...n.apiBase!==void 0?{baseURL:n.apiBase}:{}});t(`ExoSync parity check: ${c.length} repo(s), vault ${r}`);let p=await h.runRound(c,{trigger:"standalone"});return n.json===!0?t(JSON.stringify(p,null,2)):Voe(p,t),p.vacuous?2:p.ok?0:1}a(qoe,"runExosyncParity");function Fj(){return new _e("exosync-parity").description("ExoSync M1/M2 parity report: compare materialized sync units against their remote heads (read-only; RFC 4e4dc453 Phase E)").requiredOption("--vault <path>","Vault root path").option("--config-dir <name>","Obsidian config dir name (watermark location)",".obsidian").option("--json","Print the full round record as JSON").option("--token <pat>","GitHub PAT (or env GITHUB_TOKEN / GH_TOKEN). Prefer --token-from-gh.").option("--token-from-gh","Resolve the PAT via `gh auth token`").option("--api-base <url>","GitHub API base (testing)").action(async n=>{try{process.exitCode=await qoe(n)}catch(e){ce.handle(e,{command:"exosync-parity"}),process.exitCode=1}})}a(Fj,"exosyncParityCommand");var Yn=require("node:fs"),lI=require("node:crypto"),Rn=se(require("node:path")),Cn=se(et());var Goe="exosync-watermarks.local.json";function Lj(n,e,t){let r=dI(e,t),i=new Hs({token:r,...e.apiBase!==void 0?{apiBase:e.apiBase}:{}}),s=t.transportFactory?.(r,e.apiBase)??i.transport(),{specs:o,warnings:c}=Ju(n),l=e.configDir??".obsidian",u=Rn.join(n,l,"plugins","exocortex",Goe),f=Rn.join(n,l,"plugins","exocortex",Cn.CONFLICT_CACHE_STORE_FILENAME),d=new Cn.LocalConflictCacheStore({io:Wo(f)}),h=Rn.join(n,l,"plugins","exocortex",Cn.OUTBOX_STORE_FILENAME),p=new Cn.LocalOutboxStore({io:Wo(h)});return{resolver:new Cn.QuarantineResolver({transport:s,watermarkStore:new Cn.FileWatermarkStore(Wo(u)),localFilesFor:a(y=>bb(Rn.join(n,y.localPath)),"localFilesFor"),sha1:fI,...e.apiBase!==void 0?{baseURL:e.apiBase}:{},redact:a(y=>i.redact(y),"redact"),conflictCache:d,outbox:p}),specs:o,warnings:c}}a(Lj,"buildResolver");async function Woe(n,e={}){let t=e.out??(l=>console.log(l)),r=Rn.resolve(n.vault);if(!(0,Yn.existsSync)(r))throw new Error(`Vault path does not exist: ${r}`);let{resolver:i,specs:s,warnings:o}=Lj(r,n,e);for(let l of o)t(`warn: ${l}`);if(s.length===0)return t("No materialized AssetSpaces with a GitHub source found in this vault."),0;let c=await i.listOpenConflicts(s);if(n.json===!0)return t(JSON.stringify(c,null,2)),0;if(c.length===0)return t("No open conflicts \u2014 nothing to resolve. \u2705"),0;t(`${c.length} open conflict(s):`);for(let l of c){let u=`${l.hasLocal?"local":"(no local)"} vs ${l.hasRemote?"remote":"(no remote)"}`;t(` ${l.repoKey} ${l.path} [${u}]${l.uid?` uid=${l.uid}`:""}`)}return t(""),t("Resolve with: exosync quarantine resolve <path> --take local|remote|file <path> --vault <vault>"),0}a(Woe,"runQuarantineList");async function Hoe(n,e,t={}){let r=t.out??(b=>console.log(b)),i=Rn.resolve(e.vault);if(!(0,Yn.existsSync)(i))throw new Error(`Vault path does not exist: ${i}`);let s=(e.take??"").trim();if(s!=="local"&&s!=="remote"&&s!=="file")throw new Error("resolve requires --take local | remote | file (with --file <path> for the merged content)");let o;if(s==="file"){if(e.file===void 0||e.file.length===0)throw new Error("--take file requires --file <path> to the merged content");o={take:"merged",content:await Yn.promises.readFile(Rn.resolve(e.file),"utf-8")}}else o={take:s};let{resolver:c,specs:l,warnings:u}=Lj(i,e,t);for(let b of u)r(`warn: ${b}`);let d=(await c.listOpenConflicts(l)).filter(b=>b.path===n&&(e.repo===void 0||b.repoKey===e.repo));if(d.length===0)return r(`No open conflict for "${n}"${e.repo?` in ${e.repo}`:""} \u2014 run \`exosync quarantine list\` to see the current set.`),1;if(d.length>1){r(`"${n}" conflicts in ${d.length} repos \u2014 disambiguate with --repo <repoKey>:`);for(let b of d)r(` --repo ${b.repoKey}`);return 1}let h=d[0],p=l.find(b=>b.repoKey===h.repoKey),g=await c.resolve(p,h.path,o),y=g.awaitingPush===!0?" \u2014 awaiting push (run `exosync sync` to push it)":g.pushedSha!==void 0?` \u2014 pushed @${g.pushedSha.slice(0,7)}`:" \u2014 remote already matched";return r(`Resolved ${h.path} (${g.resolvedTo}) in ${h.repoKey}${y}.`),g.discardedLocalBackupPath!==void 0&&r(` \u21B3 your discarded local version is preserved at ${p.localPath}/${g.discardedLocalBackupPath}`),0}a(Hoe,"runQuarantineResolve");function Dj(n,e){let t=/^(---\r?\n)([\s\S]*?)(\r?\n---(?=\r?\n|$))/.exec(n);if(t===null)return n;let r=t[2].replace(/^(exo__Asset_uid:[ \t]*["']?)[^\s"']+(["']?[ \t]*)$/m,`$1${e}$2`);return r===t[2]?n:n.slice(0,t.index)+t[1]+r+t[3]+n.slice(t.index+t[0].length)}a(Dj,"rewriteUid");function uI(n){return n.replace(/\r\n?/g,`
|
|
598
598
|
`).replace(/\n+$/,"")}a(uI,"normalizeForCompare");function zoe(n,e,t){let r=[...e].sort((o,c)=>o.path.localeCompare(c.path)),i=[],s=[];for(let o of r){let c=uI(o.content),l=i.find(u=>u.norm===c);if(l!==void 0){s.push({action:"delete",path:o.path,identicalTo:l.path});continue}i.push({path:o.path,norm:c}),i.length===1?s.push({action:"keep",path:o.path,uid:n}):s.push({action:"reuuid",path:o.path,fromUid:n,toUid:t()})}return s}a(zoe,"planDedupGroup");async function Koe(n,e={}){let t=e.out??(f=>console.log(f)),r=Rn.resolve(n.vault);if(!(0,Yn.existsSync)(r))throw new Error(`Vault path does not exist: ${r}`);let{specs:i,warnings:s}=Ju(r);for(let f of s)t(`warn: ${f}`);let o=new Map;for(let f of i){let d=Rn.join(r,f.localPath);if(!(0,Yn.existsSync)(d))continue;let h=bb(d);for(let p of await h.list()){if(!p.endsWith(".md"))continue;let g;try{g=await h.read(p)}catch{continue}let y=(0,Cn.extractAssetUid)(g);if(y===void 0)continue;let b=Rn.join(d,p),S=o.get(y)??[];S.push(b),o.set(y,S)}}let c=[...o.entries()].filter(([,f])=>f.length>1).sort(([f],[d])=>f.localeCompare(d));if(c.length===0)return t("No duplicate uids on disk. \u2705"),0;let l=a(f=>Rn.relative(r,f),"rel");if(n.auto===!0){let f=[];for(let[b,S]of c){let v=[],I=new Map;for(let A of S){let T=await Yn.promises.readFile(A,"utf-8");v.push({path:A,content:T}),I.set(A,T)}f.push({uid:b,decisions:zoe(b,v,lI.randomUUID),snap:I})}let d=0,h=0;t(`${c.length} duplicate uid(s) on disk \u2014 zero-loss plan:`);for(let{uid:b,decisions:S}of f){t(` ${b}:`);for(let v of S)v.action==="keep"?t(` KEEP ${l(v.path)} (keeps uid ${b})`):v.action==="reuuid"?(h++,t(` RE-UUID ${l(v.path)} (content differs \u2192 fresh uid; both survive, zero-loss)`)):(d++,t(` DELETE ${l(v.path)} (identical content \u2192 ${l(v.identicalTo)}; zero-loss)`))}if(n.apply!==!0)return t(""),t(`Plan: delete ${d} identical copy(ies), re-uuid ${h} differing variant(s).`),t("DRY-RUN \u2014 nothing changed. Re-run with `--auto --apply` to execute (a deleted copy's content always survives in the kept file; if previously synced it is also recoverable from the git remote)."),1;let p=0,g=0,y=0;for(let{decisions:b,snap:S}of f){for(let v of b){if(v.action!=="delete")continue;let I;try{I=await Yn.promises.readFile(v.path,"utf-8")}catch{continue}if(uI(I)!==uI(S.get(v.path)??"")){t(` ! skipped delete ${l(v.path)} (changed since scan \u2014 re-run dedup-uids)`),y++;continue}await Yn.promises.rm(v.path,{force:!0}),t(` deleted ${l(v.path)} (identical to ${l(v.identicalTo)})`),p++}for(let v of b){if(v.action!=="reuuid")continue;let I;try{I=await Yn.promises.readFile(v.path,"utf-8")}catch{continue}if((0,Cn.extractAssetUid)(I)!==v.fromUid){t(` ! skipped re-uuid ${l(v.path)} (uid changed since scan \u2014 re-run dedup-uids)`),y++;continue}let A=Dj(I,v.toUid);A!==I&&(await Yn.promises.writeFile(v.path,A,"utf-8"),t(` re-uuid ${l(v.path)} \u2192 uid=${v.toUid} (content differs from kept copy)`),g++)}}return t(`Resolved: deleted ${p} identical copy(ies), re-uuid ${g} differing variant(s).${y>0?` ${y} skipped (re-run).`:""} Run \`exosync sync\` to propagate.`),y>0?1:0}n.apply===!0&&t("Note: --apply only applies with --auto; running in report mode."),t(`${c.length} duplicate uid(s) on disk:`);for(let[f,d]of c){t(` ${f} \u2014 ${d.length} files:`);for(let h of d)t(` ${l(h)}`)}if(n.fix!==!0)return t(""),t("Re-run with --fix to assign a fresh uuid to every duplicate but the first (frontmatter rewrite only \u2014 never renames the file)."),1;let u=0;for(let[,f]of c){let d=[...f].sort((h,p)=>h.localeCompare(p));for(let h of d.slice(1)){let p=await Yn.promises.readFile(h,"utf-8"),g=(0,lI.randomUUID)(),y=Dj(p,g);y!==p&&(await Yn.promises.writeFile(h,y,"utf-8"),t(` fixed ${Rn.relative(r,h)} \u2192 uid=${g}`),u++)}}return t(`Reassigned ${u} uid(s). Run \`exosync sync\` to propagate.`),0}a(Koe,"runDedupUids");function cI(n){return n.requiredOption("--vault <path>","Vault root path").option("--config-dir <name>","Obsidian config dir name (watermark location)",".obsidian").option("--token <pat>","GitHub PAT (or env GITHUB_TOKEN / GH_TOKEN). Prefer --token-from-gh.").option("--token-from-gh","Resolve the PAT via `gh auth token`").option("--json","Machine-readable output").option("--api-base <url>","GitHub API base (testing)")}a(cI,"withQuarantineOptions");function Nj(n){let e=new _e("quarantine").description("Inspect and resolve ExoSync conflicts (quarantine resolver; RFC 4e4dc453, finding a0a3d1d6)");cI(e.command("list").description("List open conflicts that need a manual choice")).action(async t=>{try{process.exitCode=await Woe(t)}catch(r){ce.handle(r,{command:"exosync quarantine list"}),process.exitCode=1}}),cI(e.command("resolve <path>").description("Resolve one conflict: --take local | remote | file <path> (merged)").option("--take <choice>","local | remote | file").option("--file <path>","Merged content file (with --take file)").option("--repo <repoKey>","Disambiguate a cross-repo path collision")).action(async(t,r)=>{try{process.exitCode=await Hoe(t,r)}catch(i){ce.handle(i,{command:"exosync quarantine resolve"}),process.exitCode=1}}),n.addCommand(e),cI(n.command("dedup-uids").description("Report duplicate exo__Asset_uid on disk (#3477); --fix re-uuids all but the first; --auto zero-loss auto-resolve (identical\u2192delete, differing\u2192re-uuid; dry-run unless --apply)").option("--fix","Assign a fresh uuid to every duplicate but the first").option("--auto","Zero-loss auto-resolve: delete identical copies, re-uuid distinct variants (DRY-RUN unless --apply). Supersedes --fix.").option("--apply","Execute the --auto plan (without it --auto is a dry-run; a deleted copy's content always survives in the kept file, and if previously synced is recoverable from the git remote)")).action(async t=>{try{process.exitCode=await Koe(t)}catch(r){ce.handle(r,{command:"exosync dedup-uids"}),process.exitCode=1}})}a(Nj,"registerQuarantineCommands");var fI=a(async n=>{let e=await kj.webcrypto.subtle.digest("SHA-1",n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")},"nodeSha1"),Yoe={parse:a(n=>Dt.load(n,{schema:Dt.CORE_SCHEMA}),"parse"),stringify:a(n=>Dt.dump(n,{schema:Dt.CORE_SCHEMA,lineWidth:-1}),"stringify")};function dI(n,e){if(n.tokenFromGh===!0)return Hs.resolveGhToken(e.ghTokenRunner);let t=e.env??process.env,r=n.token||t.GITHUB_TOKEN||t.GH_TOKEN||"";if(r.length===0)throw new Error("A GitHub token is required (private sync units read as 404 and push needs write scope). Use --token-from-gh, --token <pat>, or set GITHUB_TOKEN / GH_TOKEN.");return r}a(dI,"resolveToken");function bb(n){let e=a(i=>Er.join(n,i),"abs"),t=a(async(i,s)=>{let o;try{o=await vr.promises.readdir(i,{withFileTypes:!0})}catch{return}for(let c of o){let l=Er.join(i,c.name);if(c.isDirectory()){if(c.name===".git")continue;await t(l,s)}else c.isFile()&&s.push(Er.relative(n,l).split(Er.sep).join("/"))}},"walk"),r=a(async(i,s)=>{let o=Er.dirname(i);await vr.promises.mkdir(o,{recursive:!0});let c=`${i}.local.tmp`;await s(c),await vr.promises.rename(c,i)},"writeAtomic");return{async list(){let i=[];return(0,vr.existsSync)(n)&&await t(n,i),i},read:a(i=>vr.promises.readFile(e(i),"utf-8"),"read"),async write(i,s){await r(e(i),o=>vr.promises.writeFile(o,s,"utf-8"))},async delete(i){await vr.promises.rm(e(i),{force:!0})},async readBinary(i){return new Uint8Array(await vr.promises.readFile(e(i)))},async writeBinary(i,s){let o=s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength);await r(e(i),c=>vr.promises.writeFile(c,Buffer.from(o)))},async stat(i){try{let s=await vr.promises.stat(e(i));return{mtimeMs:s.mtimeMs,size:s.size}}catch{return null}}}}a(bb,"nodeLocalFilesPort");function Wo(n){return{async read(){try{return await vr.promises.readFile(n,"utf-8")}catch{return null}},async writeAtomic(e){await vr.promises.mkdir(Er.dirname(n),{recursive:!0});let t=`${n}.local.tmp`;await vr.promises.writeFile(t,e,"utf-8"),await vr.promises.rename(t,n)}}}a(Wo,"nodeWatermarkFileIO");function qc(n,e=".obsidian"){let t=Er.join(n,e,"plugins","exocortex",nt.MOUNT_BASE_STORE_FILENAME);return new nt.FileMountBaseStore(Wo(t))}a(qc,"nodeMountBaseStore");var Qoe=(0,jj.promisify)(Mj.execFile);function Xoe(n){return async e=>{if(e.localPath.length===0||e.localPath.startsWith("-"))return null;try{let{stdout:t}=await Qoe("git",["-C",n,"submodule","status",e.localPath],{timeout:3e4,maxBuffer:4194304}),r=t.match(/^[ +\-U]?([0-9a-f]{40})\b/m);return r?r[1]:null}catch{return null}}}a(Xoe,"nodeLocalBaseShaProvider");function Joe(n){return{async check(e){let t=Er.join(n,e.localPath);if(!(0,vr.existsSync)(t))return{fullyMaterialized:!1,reason:`mount folder ${e.localPath} does not exist`};let r=0;try{r=(await vr.promises.readdir(t)).length}catch{return{fullyMaterialized:!1,reason:`mount folder ${e.localPath} is not readable`}}return r===0&&e.spaceKind!=="file"?{fullyMaterialized:!1,reason:`mount folder ${e.localPath} is empty (mid-mount?)`}:{fullyMaterialized:!0}}}}a(Joe,"nodeMaterializationCheck");function Zoe(n,e){let t=n.pushedSha!==void 0?` \u2192@${n.pushedSha.slice(0,7)}`:"",r=(n.outboxPushedCount??0)>0?`, pushed ${n.outboxPushedCount} resolved`:"",i=(n.outboxReconflictedCount??0)>0?`, ${n.outboxReconflictedCount} re-conflicted (remote moved)`:"";e(`${n.repoKey}${t}: ${n.status} \u2014 pulled ${n.pulledCount}, pushed ${n.pushedCount}, merged ${n.mergedCount}, quarantined ${n.quarantinedCount}${(n.pushedDeletes?.length??0)>0?`, deleted ${n.pushedDeletes.length}`:""}${r}${i}`),n.detail!==void 0&&e(` ${n.detail}`);for(let s of n.warnings)e(` warn: ${s}`);(n.quarantinedPaths?.length??0)>0&&e(` quarantined (\u2192 exosync quarantine resolve): ${n.quarantinedPaths.join(", ")}`),(n.deferredPaths?.length??0)>0&&e(` deferred (\u2192 full sync): ${n.deferredPaths.join(", ")}`),(n.deferredDeletes?.length??0)>0&&e(` deferred deletes: ${n.deferredDeletes.join(", ")}`),n.timings!==void 0&&(0,nt.totalMs)(n.timings)>0&&e(` ${(0,nt.formatRepoTimings)(n.repoKey,n.timings)}`)}a(Zoe,"printRepoResult");function eae(n){return n==="conflict"||n==="full-conflict"||n==="retry-exhausted"||n==="busy"||n==="auth-required"||n==="error"}a(eae,"isFailureStatus");async function tae(n,e,t={}){let r=t.out??(T=>console.log(T)),i=Er.resolve(e.vault);if(!(0,vr.existsSync)(i))throw new Error(`Vault path does not exist: ${i}`);let s=dI(e,t),o=new Hs({token:s,...e.apiBase!==void 0?{apiBase:e.apiBase}:{}}),c=t.transportFactory?.(s,e.apiBase)??o.transport(),{specs:l,warnings:u}=Ju(i);for(let T of u)r(`warn: ${T}`);if(l.length===0)return r("Nothing to sync \u2014 no materialized AssetSpaces with a GitHub source found in this vault."),2;let f=e.configDir??".obsidian",d=Er.join(i,f,"plugins","exocortex",nt.WATERMARK_STORE_FILENAME),h=Er.join(i,f,"plugins","exocortex",nt.LOCAL_MANIFEST_STORE_FILENAME),p=Er.join(i,f,"plugins","exocortex",nt.CONFLICT_CACHE_STORE_FILENAME),g=new nt.LocalConflictCacheStore({io:Wo(p)}),y=Er.join(i,f,"plugins","exocortex",nt.OUTBOX_STORE_FILENAME),b=new nt.LocalOutboxStore({io:Wo(y)}),S=g,v=new nt.SyncEngine({transport:c,watermarkStore:new nt.FileWatermarkStore(Wo(d)),localManifestStore:new nt.FileLocalManifestStore(Wo(h)),mountBaseStore:qc(i,f),localBaseShaProvider:Xoe(i),materializationCheck:Joe(i),localFilesFor:a(T=>bb(Er.join(i,T.localPath)),"localFilesFor"),sha1:fI,redact:a(T=>o.redact(T),"redact"),commitMessage:a((T,R,V=0)=>`exosync: ${R} change(s)${V>0?`, ${V} deletion(s)`:""} (CLI)`,"commitMessage"),mergeLayer:new nt.GatedStructuredMerger(new nt.StructuredMerger(Yoe)),quarantine:S,outbox:b,...e.apiBase!==void 0?{baseURL:e.apiBase}:{}});r(`ExoSync ${n}: ${l.length} repo(s), vault ${i}`);let I=(0,nt.orderChildrenFirst)(l),A=await v.syncAll(I,n);if(e.json===!0)r(JSON.stringify(A,null,2));else{for(let V of A)Zoe(V,r);let T=A.reduce((V,L)=>({pulled:V.pulled+L.pulledCount,pushed:V.pushed+L.pushedCount,merged:V.merged+L.mergedCount,quarantined:V.quarantined+L.quarantinedCount}),{pulled:0,pushed:0,merged:0,quarantined:0});r(`Summary: ${A.length} repo(s) \u2014 pulled ${T.pulled}, pushed ${T.pushed}, merged ${T.merged}, quarantined ${T.quarantined}`);let R=(0,nt.aggregateTimings)(A);(0,nt.totalMs)(R)>0&&r((0,nt.formatTimingsLine)(R))}return A.some(T=>eae(T.status))?1:0}a(tae,"runExosyncSync");function hI(n){return n.requiredOption("--vault <path>","Vault root path").option("--config-dir <name>","Obsidian config dir name (watermark location)",".obsidian").option("--token <pat>","GitHub PAT (or env GITHUB_TOKEN / GH_TOKEN). Prefer --token-from-gh.").option("--token-from-gh","Resolve the PAT via `gh auth token`").option("--json","Print the full per-repo result array as JSON").option("--api-base <url>","GitHub API base (testing)")}a(hI,"withSyncOptions");function pI(n){return async e=>{try{process.exitCode=await tae(n,e)}catch(t){ce.handle(t,{command:`exosync ${n}`}),process.exitCode=1}}}a(pI,"makeDirectionAction");function $j(){let n=new _e("exosync").description("ExoSync over the GitHub REST API: sync/pull/push the materialized AssetSpace set (CLI parity with the plugin; RFC 4e4dc453 Phase B). Read-only divergence check: `exosync-parity`.");return hI(n.command("sync").description("Full pull\u2192merge\u2192push cycle for every materialized repo")).action(pI("sync")),hI(n.command("pull").description("Apply remote changes only (nothing leaves the device; local changes re-derive)")).action(pI("pull")),hI(n.command("push").description("Send the local delta only (remote changes are pinned to re-derive on the next pull/sync)")).action(pI("push")),Nj(n),n}a($j,"exosyncCommand");var rae=a(n=>{process.stderr.write(`${n}
|
|
599
599
|
`)},"DEFAULT_LOG"),_b=class{static{a(this,"HeadlessConfirmGate")}constructor(e){this.yes=e.yes,this.verbose=e.verbose??!1,this.log=e.log??rae}async confirmApply(e){if(this.verbose){let t=Array.from(e.filesToDestroy.values()).reduce((r,i)=>r+i.length,0);this.log(`[apply-profile] Target: ${e.targetProfileLabel} (${e.targetProfileUid})`),this.log(`[apply-profile] Source: ${e.sourceProfileLabel}`),this.log(`[apply-profile] ${t} files to remove, ${e.assetSpacesBeingTornDown.length} AS to tear down, ${e.assetSpacesBeingMaterialized.length} AS to materialize`)}return this.yes?!0:(this.log("[apply-profile] Refused: --yes flag required for headless mode (Decision #2 safety)."),!1)}};async function nae(n,e,t={}){let r=[],i=[],s=t.out??(R=>process.stdout.write(`${R}
|
|
600
600
|
`)),o=t.err??(R=>process.stderr.write(`${R}
|
|
@@ -636,7 +636,7 @@ Duplicate bindings (${n.duplicates.length}) \u2014 uid claimed by >1 test (warni
|
|
|
636
636
|
Skipped floor check for ${n.unknownPriority} requirement(s) with unparseable priority (fail-open).`),n.clean?e==="hard"&&!n.rampReady?console.error(`
|
|
637
637
|
FAIL (hard gate): ramp not ready \u2014 ${n.p0Orphans} P0 requirement(s) unbound`+(n.p0Total===0?" (no P0 requirements found)":"")+"."):console.log(`
|
|
638
638
|
OK: no hard findings (dangling tags + binding-class floor are clean).`):console.error(`
|
|
639
|
-
FAIL: ${n.dangling.length} dangling + ${n.floorViolations.length} floor violation(s) + ${n.activeViolations.length} active-requirement invariant violation(s) + ${n.danglingEvidence.length} dangling evidence link(s).`)}a(Aae,"renderText");function Iae(n,e,t){return!n.clean||t&&n.orphans.length>0||e==="hard"&&!n.rampReady}a(Iae,"isHardFail");function r9(){return new _e("audit").description("Audit requirement\u2194test traceability: orphans, dangling @req tags, duplicate bindings, binding-class floor, coverage, P0 ramp-readiness").requiredOption("--reqs <path>","Directory tree containing req__Requirement assets (a vault or a reqs assetspace clone)").option("--tests <path>","Test-corpus root scanned for @req:<uid> tags",".").option("--output <type>","Response format: text|json","text").option("--strict","Also exit 1 on orphan requirements",!1).option("--gate <mode>","Gate mode: soft (warn only on hard findings) | hard (also block when the P0 checklist is not ramp-ready)","soft").action(async n=>{let e=n.output??"text";ce.setFormat(e);let t=n.gate==="hard"?"hard":"soft";try{let r=(0,Ma.resolve)(n.reqs);if(!(0,ja.existsSync)(r)||!(0,ja.statSync)(r).isDirectory())throw new qe(r);let i=(0,Ma.resolve)(n.tests??".");if(!(0,ja.existsSync)(i)||!(0,ja.statSync)(i).isDirectory())throw new qe(i);let[s,o]=await Promise.all([Sae(r),vae(i)]),c=Eae(s,o);e==="json"?console.log(JSON.stringify({...c,gate:t},null,2)):Aae(c,t),Iae(c,t,n.strict===!0)&&(process.exitCode=1)}catch(r){ce.handle(r)}})}a(r9,"requirementsAuditCommand");function n9(){let n=new _e("requirements").description("Requirements-management tooling (RFC 0003): traceability checker");return n.addCommand(r9()),n}a(n9,"requirementsCommand");function xb(n){let e=new _e;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.157.
|
|
639
|
+
FAIL: ${n.dangling.length} dangling + ${n.floorViolations.length} floor violation(s) + ${n.activeViolations.length} active-requirement invariant violation(s) + ${n.danglingEvidence.length} dangling evidence link(s).`)}a(Aae,"renderText");function Iae(n,e,t){return!n.clean||t&&n.orphans.length>0||e==="hard"&&!n.rampReady}a(Iae,"isHardFail");function r9(){return new _e("audit").description("Audit requirement\u2194test traceability: orphans, dangling @req tags, duplicate bindings, binding-class floor, coverage, P0 ramp-readiness").requiredOption("--reqs <path>","Directory tree containing req__Requirement assets (a vault or a reqs assetspace clone)").option("--tests <path>","Test-corpus root scanned for @req:<uid> tags",".").option("--output <type>","Response format: text|json","text").option("--strict","Also exit 1 on orphan requirements",!1).option("--gate <mode>","Gate mode: soft (warn only on hard findings) | hard (also block when the P0 checklist is not ramp-ready)","soft").action(async n=>{let e=n.output??"text";ce.setFormat(e);let t=n.gate==="hard"?"hard":"soft";try{let r=(0,Ma.resolve)(n.reqs);if(!(0,ja.existsSync)(r)||!(0,ja.statSync)(r).isDirectory())throw new qe(r);let i=(0,Ma.resolve)(n.tests??".");if(!(0,ja.existsSync)(i)||!(0,ja.statSync)(i).isDirectory())throw new qe(i);let[s,o]=await Promise.all([Sae(r),vae(i)]),c=Eae(s,o);e==="json"?console.log(JSON.stringify({...c,gate:t},null,2)):Aae(c,t),Iae(c,t,n.strict===!0)&&(process.exitCode=1)}catch(r){ce.handle(r)}})}a(r9,"requirementsAuditCommand");function n9(){let n=new _e("requirements").description("Requirements-management tooling (RFC 0003): traceability checker");return n.addCommand(r9()),n}a(n9,"requirementsCommand");function xb(n){let e=new _e;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.157.1"),e.addCommand(Q4()),e.addCommand(oj()),e.addCommand(zM()),e.addCommand(XM()),e.addCommand(_4()),e.addCommand(JM()),e.addCommand(v4()),e.addCommand(P4()),e.addCommand(D4()),e.addCommand(z4()),e.addCommand(vj()),e.addCommand(Aj()),e.addCommand(Vj()),e.addCommand(Gj()),e.addCommand(zj()),e.addCommand(Kj()),e.addCommand(Jj()),e.addCommand(Fj()),e.addCommand($j()),e.addCommand(n9()),e}a(xb,"createProgram");xb().parse();0&&(module.exports={createProgram});
|
|
640
640
|
/*! Bundled license information:
|
|
641
641
|
|
|
642
642
|
reflect-metadata/Reflect.js:
|