@kitelev/exocortex-cli 16.255.9 → 16.255.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +24 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- // @kitelev/exocortex-cli v16.255.9
2
+ // @kitelev/exocortex-cli v16.255.11
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 xG=Object.create;var Dp=Object.defineProperty;var PG=Object.getOwnPropertyDescriptor;var OG=Object.getOwnPropertyNames;var FG=Object.getPrototypeOf,DG=Object.prototype.hasOwnProperty;var a=(r,e)=>Dp(r,"name",{value:e,configurable:!0});var Me=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var T=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},qu=(r,e)=>{for(var t in e)Dp(r,t,{get:e[t],enumerable:!0})},cD=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of OG(e))!DG.call(r,i)&&i!==t&&Dp(r,i,{get:()=>e[i],enumerable:!(n=PG(e,i))||n.enumerable});return r};var Q=(r,e,t)=>(t=r!=null?xG(FG(r)):{},cD(e||!r||!r.__esModule?Dp(t,"default",{value:r,enumerable:!0}):t,r)),Zg=r=>cD(Dp({},"__esModule",{value:!0}),r);var cv=T(()=>{var lD;(function(r){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:c(),n=i(r);typeof t.Reflect<"u"&&(n=i(t.Reflect,n)),e(n,t),typeof t.Reflect>"u"&&(t.Reflect=r);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 n=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 et(Object.create(null))}:l?function(){return et({__proto__:null})}:function(){return et({})},has:u?function(C,P){return n.call(C,P)}:function(C,P){return P in C},get:u?function(C,P){return n.call(C,P)?C[P]:void 0}:function(C,P){return C[P]}},d=Object.getPrototypeOf(Function),p=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Be(),h=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ze(),g=typeof WeakMap=="function"?WeakMap:nt(),m=i?Symbol.for("@reflect-metadata:registry"):void 0,b=Ne(),_=ke(b);function S(C,P,D,V){if(Z(D)){if(!Ae(C))throw new TypeError;if(!ve(P))throw new TypeError;return ae(C,P)}else{if(!Ae(C))throw new TypeError;if(!K(P))throw new TypeError;if(!K(V)&&!Z(V)&&!z(V))throw new TypeError;return z(V)&&(V=void 0),D=se(D),Y(C,P,D,V)}}a(S,"decorate"),e("decorate",S);function I(C,P){function D(V,Ee){if(!K(V))throw new TypeError;if(!Z(Ee)&&!Re(Ee))throw new TypeError;X(C,P,V,Ee)}return a(D,"decorator"),D}a(I,"metadata"),e("metadata",I);function E(C,P,D,V){if(!K(D))throw new TypeError;return Z(V)||(V=se(V)),X(C,P,D,V)}a(E,"defineMetadata"),e("defineMetadata",E);function w(C,P,D){if(!K(P))throw new TypeError;return Z(D)||(D=se(D)),M(C,P,D)}a(w,"hasMetadata"),e("hasMetadata",w);function R(C,P,D){if(!K(P))throw new TypeError;return Z(D)||(D=se(D)),ce(C,P,D)}a(R,"hasOwnMetadata"),e("hasOwnMetadata",R);function x(C,P,D){if(!K(P))throw new TypeError;return Z(D)||(D=se(D)),W(C,P,D)}a(x,"getMetadata"),e("getMetadata",x);function O(C,P,D){if(!K(P))throw new TypeError;return Z(D)||(D=se(D)),oe(C,P,D)}a(O,"getOwnMetadata"),e("getOwnMetadata",O);function N(C,P){if(!K(C))throw new TypeError;return Z(P)||(P=se(P)),J(C,P)}a(N,"getMetadataKeys"),e("getMetadataKeys",N);function G(C,P){if(!K(C))throw new TypeError;return Z(P)||(P=se(P)),ye(C,P)}a(G,"getOwnMetadataKeys"),e("getOwnMetadataKeys",G);function j(C,P,D){if(!K(P))throw new TypeError;if(Z(D)||(D=se(D)),!K(P))throw new TypeError;Z(D)||(D=se(D));var V=xe(P,D,!1);return Z(V)?!1:V.OrdinaryDeleteMetadata(C,P,D)}a(j,"deleteMetadata"),e("deleteMetadata",j);function ae(C,P){for(var D=C.length-1;D>=0;--D){var V=C[D],Ee=V(P);if(!Z(Ee)&&!z(Ee)){if(!ve(Ee))throw new TypeError;P=Ee}}return P}a(ae,"DecorateConstructor");function Y(C,P,D,V){for(var Ee=C.length-1;Ee>=0;--Ee){var Vt=C[Ee],Yt=Vt(P,D,V);if(!Z(Yt)&&!z(Yt)){if(!K(Yt))throw new TypeError;V=Yt}}return V}a(Y,"DecorateProperty");function M(C,P,D){var V=ce(C,P,D);if(V)return!0;var Ee=Ce(P);return z(Ee)?!1:M(C,Ee,D)}a(M,"OrdinaryHasMetadata");function ce(C,P,D){var V=xe(P,D,!1);return Z(V)?!1:$(V.OrdinaryHasOwnMetadata(C,P,D))}a(ce,"OrdinaryHasOwnMetadata");function W(C,P,D){var V=ce(C,P,D);if(V)return oe(C,P,D);var Ee=Ce(P);if(!z(Ee))return W(C,Ee,D)}a(W,"OrdinaryGetMetadata");function oe(C,P,D){var V=xe(P,D,!1);if(!Z(V))return V.OrdinaryGetOwnMetadata(C,P,D)}a(oe,"OrdinaryGetOwnMetadata");function X(C,P,D,V){var Ee=xe(D,V,!0);Ee.OrdinaryDefineOwnMetadata(C,P,D,V)}a(X,"OrdinaryDefineOwnMetadata");function J(C,P){var D=ye(C,P),V=Ce(C);if(V===null)return D;var Ee=J(V,P);if(Ee.length<=0)return D;if(D.length<=0)return Ee;for(var Vt=new h,Yt=[],tt=0,he=D;tt<he.length;tt++){var me=he[tt],be=Vt.has(me);be||(Vt.add(me),Yt.push(me))}for(var we=0,Qe=Ee;we<Qe.length;we++){var me=Qe[we],be=Vt.has(me);be||(Vt.add(me),Yt.push(me))}return Yt}a(J,"OrdinaryMetadataKeys");function ye(C,P){var D=xe(C,P,!1);return D?D.OrdinaryOwnMetadataKeys(C,P):[]}a(ye,"OrdinaryOwnMetadataKeys");function ze(C){if(C===null)return 1;switch(typeof C){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return C===null?1:6;default:return 6}}a(ze,"Type");function Z(C){return C===void 0}a(Z,"IsUndefined");function z(C){return C===null}a(z,"IsNull");function ee(C){return typeof C=="symbol"}a(ee,"IsSymbol");function K(C){return typeof C=="object"?C!==null:typeof C=="function"}a(K,"IsObject");function ie(C,P){switch(ze(C)){case 0:return C;case 1:return C;case 2:return C;case 3:return C;case 4:return C;case 5:return C}var D=P===3?"string":P===5?"number":"default",V=U(C,s);if(V!==void 0){var Ee=V.call(C,D);if(K(Ee))throw new TypeError;return Ee}return Pe(C,D==="default"?"number":D)}a(ie,"ToPrimitive");function Pe(C,P){if(P==="string"){var D=C.toString;if(ge(D)){var V=D.call(C);if(!K(V))return V}var Ee=C.valueOf;if(ge(Ee)){var V=Ee.call(C);if(!K(V))return V}}else{var Ee=C.valueOf;if(ge(Ee)){var V=Ee.call(C);if(!K(V))return V}var Vt=C.toString;if(ge(Vt)){var V=Vt.call(C);if(!K(V))return V}}throw new TypeError}a(Pe,"OrdinaryToPrimitive");function $(C){return!!C}a($,"ToBoolean");function fe(C){return""+C}a(fe,"ToString");function se(C){var P=ie(C,3);return ee(P)?P:fe(P)}a(se,"ToPropertyKey");function Ae(C){return Array.isArray?Array.isArray(C):C instanceof Object?C instanceof Array:Object.prototype.toString.call(C)==="[object Array]"}a(Ae,"IsArray");function ge(C){return typeof C=="function"}a(ge,"IsCallable");function ve(C){return typeof C=="function"}a(ve,"IsConstructor");function Re(C){switch(ze(C)){case 3:return!0;case 4:return!0;default:return!1}}a(Re,"IsPropertyKey");function de(C,P){return C===P||C!==C&&P!==P}a(de,"SameValueZero");function U(C,P){var D=C[P];if(D!=null){if(!ge(D))throw new TypeError;return D}}a(U,"GetMethod");function F(C){var P=U(C,o);if(!ge(P))throw new TypeError;var D=P.call(C);if(!K(D))throw new TypeError;return D}a(F,"GetIterator");function H(C){return C.value}a(H,"IteratorValue");function le(C){var P=C.next();return P.done?!1:P}a(le,"IteratorStep");function Se(C){var P=C.return;P&&P.call(C)}a(Se,"IteratorClose");function Ce(C){var P=Object.getPrototypeOf(C);if(typeof C!="function"||C===d||P!==d)return P;var D=C.prototype,V=D&&Object.getPrototypeOf(D);if(V==null||V===Object.prototype)return P;var Ee=V.constructor;return typeof Ee!="function"||Ee===C?P:Ee}a(Ce,"OrdinaryGetPrototypeOf");function Ge(){var C;!Z(m)&&typeof t.Reflect<"u"&&!(m in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(C=qe(t.Reflect));var P,D,V,Ee=new g,Vt={registerProvider:Yt,getProvider:he,setProvider:be};return Vt;function Yt(we){if(!Object.isExtensible(Vt))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case C===we:break;case Z(P):P=we;break;case P===we:break;case Z(D):D=we;break;case D===we:break;default:V===void 0&&(V=new h),V.add(we);break}}function tt(we,Qe){if(!Z(P)){if(P.isProviderFor(we,Qe))return P;if(!Z(D)){if(D.isProviderFor(we,Qe))return P;if(!Z(V))for(var Et=F(V);;){var vt=le(Et);if(!vt)return;var un=H(vt);if(un.isProviderFor(we,Qe))return Se(Et),un}}}if(!Z(C)&&C.isProviderFor(we,Qe))return C}function he(we,Qe){var Et=Ee.get(we),vt;return Z(Et)||(vt=Et.get(Qe)),Z(vt)&&(vt=tt(we,Qe),Z(vt)||(Z(Et)&&(Et=new p,Ee.set(we,Et)),Et.set(Qe,vt))),vt}function me(we){if(Z(we))throw new TypeError;return P===we||D===we||!Z(V)&&V.has(we)}function be(we,Qe,Et){if(!me(Et))throw new Error("Metadata provider not registered.");var vt=he(we,Qe);if(vt!==Et){if(!Z(vt))return!1;var un=Ee.get(we);Z(un)&&(un=new p,Ee.set(we,un)),un.set(Qe,Et)}return!0}}a(Ge,"CreateMetadataRegistry");function Ne(){var C;return!Z(m)&&K(t.Reflect)&&Object.isExtensible(t.Reflect)&&(C=t.Reflect[m]),Z(C)&&(C=Ge()),!Z(m)&&K(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:C}),C}a(Ne,"GetOrCreateMetadataRegistry");function ke(C){var P=new g,D={isProviderFor:a(function(me,be){var we=P.get(me);return Z(we)?!1:we.has(be)},"isProviderFor"),OrdinaryDefineOwnMetadata:Yt,OrdinaryHasOwnMetadata:Ee,OrdinaryGetOwnMetadata:Vt,OrdinaryOwnMetadataKeys:tt,OrdinaryDeleteMetadata:he};return b.registerProvider(D),D;function V(me,be,we){var Qe=P.get(me),Et=!1;if(Z(Qe)){if(!we)return;Qe=new p,P.set(me,Qe),Et=!0}var vt=Qe.get(be);if(Z(vt)){if(!we)return;if(vt=new p,Qe.set(be,vt),!C.setProvider(me,be,D))throw Qe.delete(be),Et&&P.delete(me),new Error("Wrong provider for target.")}return vt}a(V,"GetOrCreateMetadataMap");function Ee(me,be,we){var Qe=V(be,we,!1);return Z(Qe)?!1:$(Qe.has(me))}a(Ee,"OrdinaryHasOwnMetadata");function Vt(me,be,we){var Qe=V(be,we,!1);if(!Z(Qe))return Qe.get(me)}a(Vt,"OrdinaryGetOwnMetadata");function Yt(me,be,we,Qe){var Et=V(we,Qe,!0);Et.set(me,be)}a(Yt,"OrdinaryDefineOwnMetadata");function tt(me,be){var we=[],Qe=V(me,be,!1);if(Z(Qe))return we;for(var Et=Qe.keys(),vt=F(Et),un=0;;){var Si=le(vt);if(!Si)return we.length=un,we;var Bi=H(Si);try{we[un]=Bi}catch(Xn){try{Se(vt)}finally{throw Xn}}un++}}a(tt,"OrdinaryOwnMetadataKeys");function he(me,be,we){var Qe=V(be,we,!1);if(Z(Qe)||!Qe.delete(me))return!1;if(Qe.size===0){var Et=P.get(be);Z(Et)||(Et.delete(we),Et.size===0&&P.delete(Et))}return!0}a(he,"OrdinaryDeleteMetadata")}a(ke,"CreateMetadataProvider");function qe(C){var P=C.defineMetadata,D=C.hasOwnMetadata,V=C.getOwnMetadata,Ee=C.getOwnMetadataKeys,Vt=C.deleteMetadata,Yt=new g,tt={isProviderFor:a(function(he,me){var be=Yt.get(he);return!Z(be)&&be.has(me)?!0:Ee(he,me).length?(Z(be)&&(be=new h,Yt.set(he,be)),be.add(me),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:P,OrdinaryHasOwnMetadata:D,OrdinaryGetOwnMetadata:V,OrdinaryOwnMetadataKeys:Ee,OrdinaryDeleteMetadata:Vt};return tt}a(qe,"CreateFallbackProvider");function xe(C,P,D){var V=b.getProvider(C,P);if(!Z(V))return V;if(D){if(b.setProvider(C,P,_))return _;throw new Error("Illegal state.")}}a(xe,"GetMetadataProvider");function Be(){var C={},P=[],D=(function(){function tt(he,me,be){this._index=0,this._keys=he,this._values=me,this._selector=be}return a(tt,"MapIterator"),tt.prototype["@@iterator"]=function(){return this},tt.prototype[o]=function(){return this},tt.prototype.next=function(){var he=this._index;if(he>=0&&he<this._keys.length){var me=this._selector(this._keys[he],this._values[he]);return he+1>=this._keys.length?(this._index=-1,this._keys=P,this._values=P):this._index++,{value:me,done:!1}}return{value:void 0,done:!0}},tt.prototype.throw=function(he){throw this._index>=0&&(this._index=-1,this._keys=P,this._values=P),he},tt.prototype.return=function(he){return this._index>=0&&(this._index=-1,this._keys=P,this._values=P),{value:he,done:!0}},tt})(),V=(function(){function tt(){this._keys=[],this._values=[],this._cacheKey=C,this._cacheIndex=-2}return a(tt,"Map"),Object.defineProperty(tt.prototype,"size",{get:a(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),tt.prototype.has=function(he){return this._find(he,!1)>=0},tt.prototype.get=function(he){var me=this._find(he,!1);return me>=0?this._values[me]:void 0},tt.prototype.set=function(he,me){var be=this._find(he,!0);return this._values[be]=me,this},tt.prototype.delete=function(he){var me=this._find(he,!1);if(me>=0){for(var be=this._keys.length,we=me+1;we<be;we++)this._keys[we-1]=this._keys[we],this._values[we-1]=this._values[we];return this._keys.length--,this._values.length--,de(he,this._cacheKey)&&(this._cacheKey=C,this._cacheIndex=-2),!0}return!1},tt.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=C,this._cacheIndex=-2},tt.prototype.keys=function(){return new D(this._keys,this._values,Ee)},tt.prototype.values=function(){return new D(this._keys,this._values,Vt)},tt.prototype.entries=function(){return new D(this._keys,this._values,Yt)},tt.prototype["@@iterator"]=function(){return this.entries()},tt.prototype[o]=function(){return this.entries()},tt.prototype._find=function(he,me){if(!de(this._cacheKey,he)){this._cacheIndex=-1;for(var be=0;be<this._keys.length;be++)if(de(this._keys[be],he)){this._cacheIndex=be;break}}return this._cacheIndex<0&&me&&(this._cacheIndex=this._keys.length,this._keys.push(he),this._values.push(void 0)),this._cacheIndex},tt})();return V;function Ee(tt,he){return tt}function Vt(tt,he){return he}function Yt(tt,he){return[tt,he]}}a(Be,"CreateMapPolyfill");function Ze(){var C=(function(){function P(){this._map=new p}return a(P,"Set"),Object.defineProperty(P.prototype,"size",{get:a(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),P.prototype.has=function(D){return this._map.has(D)},P.prototype.add=function(D){return this._map.set(D,D),this},P.prototype.delete=function(D){return this._map.delete(D)},P.prototype.clear=function(){this._map.clear()},P.prototype.keys=function(){return this._map.keys()},P.prototype.values=function(){return this._map.keys()},P.prototype.entries=function(){return this._map.entries()},P.prototype["@@iterator"]=function(){return this.keys()},P.prototype[o]=function(){return this.keys()},P})();return C}a(Ze,"CreateSetPolyfill");function nt(){var C=16,P=f.create(),D=V();return(function(){function he(){this._key=V()}return a(he,"WeakMap"),he.prototype.has=function(me){var be=Ee(me,!1);return be!==void 0?f.has(be,this._key):!1},he.prototype.get=function(me){var be=Ee(me,!1);return be!==void 0?f.get(be,this._key):void 0},he.prototype.set=function(me,be){var we=Ee(me,!0);return we[this._key]=be,this},he.prototype.delete=function(me){var be=Ee(me,!1);return be!==void 0?delete be[this._key]:!1},he.prototype.clear=function(){this._key=V()},he})();function V(){var he;do he="@@WeakMap@@"+tt();while(f.has(P,he));return P[he]=!0,he}function Ee(he,me){if(!n.call(he,D)){if(!me)return;Object.defineProperty(he,D,{value:f.create()})}return he[D]}function Vt(he,me){for(var be=0;be<me;++be)he[be]=Math.random()*255|0;return he}function Yt(he){if(typeof Uint8Array=="function"){var me=new Uint8Array(he);return typeof crypto<"u"?crypto.getRandomValues(me):typeof msCrypto<"u"?msCrypto.getRandomValues(me):Vt(me,he),me}return Vt(new Array(he),he)}function tt(){var he=Yt(C);he[6]=he[6]&79|64,he[8]=he[8]&191|128;for(var me="",be=0;be<C;++be){var we=he[be];(be===4||be===6||be===8)&&(me+="-"),we<16&&(me+="0"),me+=we.toString(16).toLowerCase()}return me}}a(nt,"CreateWeakMapPolyfill");function et(C){return C.__=void 0,delete C.__,C}a(et,"MakeDictionary")})})(lD||(lD={}))});var ac,gl,Lp=Me(()=>{ac=class extends Error{static{a(this,"CommanderError")}constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},gl=class extends ac{static{a(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}});function ey(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}var Np,ty=Me(()=>{Lp();Np=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,n)=>{if(!this.argChoices.includes(t))throw new gl(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};a(ey,"humanReadableArgName")});var uD,kp,lv=Me(()=>{ty();uD=require("node:util"),kp=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),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let n=a(i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,""),"getSortKey");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),s=n.long&&e._findOption(n.long);!i&&!s?t.push(n):n.long&&!s?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.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(n=>ey(n)).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((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+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(n=>JSON.stringify(n)).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 n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){let i=new Map;return e.forEach(s=>{let o=n(s);i.has(o)||i.set(o,[])}),t.forEach(s=>{let o=n(s);i.has(o)||i.set(o,[]),i.get(o).push(s)}),i}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function s(d,p){return t.formatItem(d,n,p,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,p)=>{let h=d.map(g=>s(t.styleOptionTerm(t.optionTerm(g)),t.styleOptionDescription(t.optionDescription(g))));o=o.concat(this.formatItemList(p,h,t))}),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(p=>s(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));o=o.concat(this.formatItemList("Global Options:",d,t))}return this.groupItems(e.commands,t.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let h=d.map(g=>s(t.styleSubcommandTerm(t.subcommandTerm(g)),t.styleSubcommandDescription(t.subcommandDescription(g))));o=o.concat(this.formatItemList(p,h,t))}),o.join(`
6
+ "use strict";var xG=Object.create;var Dp=Object.defineProperty;var PG=Object.getOwnPropertyDescriptor;var OG=Object.getOwnPropertyNames;var FG=Object.getPrototypeOf,DG=Object.prototype.hasOwnProperty;var a=(r,e)=>Dp(r,"name",{value:e,configurable:!0});var Me=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var T=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},qu=(r,e)=>{for(var t in e)Dp(r,t,{get:e[t],enumerable:!0})},cD=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of OG(e))!DG.call(r,i)&&i!==t&&Dp(r,i,{get:()=>e[i],enumerable:!(n=PG(e,i))||n.enumerable});return r};var Q=(r,e,t)=>(t=r!=null?xG(FG(r)):{},cD(e||!r||!r.__esModule?Dp(t,"default",{value:r,enumerable:!0}):t,r)),Zg=r=>cD(Dp({},"__esModule",{value:!0}),r);var cv=T(()=>{var lD;(function(r){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:c(),n=i(r);typeof t.Reflect<"u"&&(n=i(t.Reflect,n)),e(n,t),typeof t.Reflect>"u"&&(t.Reflect=r);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 n=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 et(Object.create(null))}:l?function(){return et({__proto__:null})}:function(){return et({})},has:u?function(C,P){return n.call(C,P)}:function(C,P){return P in C},get:u?function(C,P){return n.call(C,P)?C[P]:void 0}:function(C,P){return C[P]}},d=Object.getPrototypeOf(Function),p=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Be(),h=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ze(),g=typeof WeakMap=="function"?WeakMap:nt(),m=i?Symbol.for("@reflect-metadata:registry"):void 0,b=Ne(),_=ke(b);function S(C,P,D,V){if(Z(D)){if(!Ae(C))throw new TypeError;if(!ve(P))throw new TypeError;return ae(C,P)}else{if(!Ae(C))throw new TypeError;if(!K(P))throw new TypeError;if(!K(V)&&!Z(V)&&!W(V))throw new TypeError;return W(V)&&(V=void 0),D=se(D),Y(C,P,D,V)}}a(S,"decorate"),e("decorate",S);function I(C,P){function D(V,Ee){if(!K(V))throw new TypeError;if(!Z(Ee)&&!Re(Ee))throw new TypeError;X(C,P,V,Ee)}return a(D,"decorator"),D}a(I,"metadata"),e("metadata",I);function E(C,P,D,V){if(!K(D))throw new TypeError;return Z(V)||(V=se(V)),X(C,P,D,V)}a(E,"defineMetadata"),e("defineMetadata",E);function w(C,P,D){if(!K(P))throw new TypeError;return Z(D)||(D=se(D)),M(C,P,D)}a(w,"hasMetadata"),e("hasMetadata",w);function R(C,P,D){if(!K(P))throw new TypeError;return Z(D)||(D=se(D)),ce(C,P,D)}a(R,"hasOwnMetadata"),e("hasOwnMetadata",R);function x(C,P,D){if(!K(P))throw new TypeError;return Z(D)||(D=se(D)),q(C,P,D)}a(x,"getMetadata"),e("getMetadata",x);function O(C,P,D){if(!K(P))throw new TypeError;return Z(D)||(D=se(D)),oe(C,P,D)}a(O,"getOwnMetadata"),e("getOwnMetadata",O);function N(C,P){if(!K(C))throw new TypeError;return Z(P)||(P=se(P)),J(C,P)}a(N,"getMetadataKeys"),e("getMetadataKeys",N);function G(C,P){if(!K(C))throw new TypeError;return Z(P)||(P=se(P)),ye(C,P)}a(G,"getOwnMetadataKeys"),e("getOwnMetadataKeys",G);function j(C,P,D){if(!K(P))throw new TypeError;if(Z(D)||(D=se(D)),!K(P))throw new TypeError;Z(D)||(D=se(D));var V=xe(P,D,!1);return Z(V)?!1:V.OrdinaryDeleteMetadata(C,P,D)}a(j,"deleteMetadata"),e("deleteMetadata",j);function ae(C,P){for(var D=C.length-1;D>=0;--D){var V=C[D],Ee=V(P);if(!Z(Ee)&&!W(Ee)){if(!ve(Ee))throw new TypeError;P=Ee}}return P}a(ae,"DecorateConstructor");function Y(C,P,D,V){for(var Ee=C.length-1;Ee>=0;--Ee){var Vt=C[Ee],Yt=Vt(P,D,V);if(!Z(Yt)&&!W(Yt)){if(!K(Yt))throw new TypeError;V=Yt}}return V}a(Y,"DecorateProperty");function M(C,P,D){var V=ce(C,P,D);if(V)return!0;var Ee=Ce(P);return W(Ee)?!1:M(C,Ee,D)}a(M,"OrdinaryHasMetadata");function ce(C,P,D){var V=xe(P,D,!1);return Z(V)?!1:$(V.OrdinaryHasOwnMetadata(C,P,D))}a(ce,"OrdinaryHasOwnMetadata");function q(C,P,D){var V=ce(C,P,D);if(V)return oe(C,P,D);var Ee=Ce(P);if(!W(Ee))return q(C,Ee,D)}a(q,"OrdinaryGetMetadata");function oe(C,P,D){var V=xe(P,D,!1);if(!Z(V))return V.OrdinaryGetOwnMetadata(C,P,D)}a(oe,"OrdinaryGetOwnMetadata");function X(C,P,D,V){var Ee=xe(D,V,!0);Ee.OrdinaryDefineOwnMetadata(C,P,D,V)}a(X,"OrdinaryDefineOwnMetadata");function J(C,P){var D=ye(C,P),V=Ce(C);if(V===null)return D;var Ee=J(V,P);if(Ee.length<=0)return D;if(D.length<=0)return Ee;for(var Vt=new h,Yt=[],tt=0,he=D;tt<he.length;tt++){var me=he[tt],be=Vt.has(me);be||(Vt.add(me),Yt.push(me))}for(var we=0,Qe=Ee;we<Qe.length;we++){var me=Qe[we],be=Vt.has(me);be||(Vt.add(me),Yt.push(me))}return Yt}a(J,"OrdinaryMetadataKeys");function ye(C,P){var D=xe(C,P,!1);return D?D.OrdinaryOwnMetadataKeys(C,P):[]}a(ye,"OrdinaryOwnMetadataKeys");function ze(C){if(C===null)return 1;switch(typeof C){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return C===null?1:6;default:return 6}}a(ze,"Type");function Z(C){return C===void 0}a(Z,"IsUndefined");function W(C){return C===null}a(W,"IsNull");function ee(C){return typeof C=="symbol"}a(ee,"IsSymbol");function K(C){return typeof C=="object"?C!==null:typeof C=="function"}a(K,"IsObject");function ie(C,P){switch(ze(C)){case 0:return C;case 1:return C;case 2:return C;case 3:return C;case 4:return C;case 5:return C}var D=P===3?"string":P===5?"number":"default",V=U(C,s);if(V!==void 0){var Ee=V.call(C,D);if(K(Ee))throw new TypeError;return Ee}return Pe(C,D==="default"?"number":D)}a(ie,"ToPrimitive");function Pe(C,P){if(P==="string"){var D=C.toString;if(ge(D)){var V=D.call(C);if(!K(V))return V}var Ee=C.valueOf;if(ge(Ee)){var V=Ee.call(C);if(!K(V))return V}}else{var Ee=C.valueOf;if(ge(Ee)){var V=Ee.call(C);if(!K(V))return V}var Vt=C.toString;if(ge(Vt)){var V=Vt.call(C);if(!K(V))return V}}throw new TypeError}a(Pe,"OrdinaryToPrimitive");function $(C){return!!C}a($,"ToBoolean");function fe(C){return""+C}a(fe,"ToString");function se(C){var P=ie(C,3);return ee(P)?P:fe(P)}a(se,"ToPropertyKey");function Ae(C){return Array.isArray?Array.isArray(C):C instanceof Object?C instanceof Array:Object.prototype.toString.call(C)==="[object Array]"}a(Ae,"IsArray");function ge(C){return typeof C=="function"}a(ge,"IsCallable");function ve(C){return typeof C=="function"}a(ve,"IsConstructor");function Re(C){switch(ze(C)){case 3:return!0;case 4:return!0;default:return!1}}a(Re,"IsPropertyKey");function de(C,P){return C===P||C!==C&&P!==P}a(de,"SameValueZero");function U(C,P){var D=C[P];if(D!=null){if(!ge(D))throw new TypeError;return D}}a(U,"GetMethod");function F(C){var P=U(C,o);if(!ge(P))throw new TypeError;var D=P.call(C);if(!K(D))throw new TypeError;return D}a(F,"GetIterator");function H(C){return C.value}a(H,"IteratorValue");function le(C){var P=C.next();return P.done?!1:P}a(le,"IteratorStep");function Se(C){var P=C.return;P&&P.call(C)}a(Se,"IteratorClose");function Ce(C){var P=Object.getPrototypeOf(C);if(typeof C!="function"||C===d||P!==d)return P;var D=C.prototype,V=D&&Object.getPrototypeOf(D);if(V==null||V===Object.prototype)return P;var Ee=V.constructor;return typeof Ee!="function"||Ee===C?P:Ee}a(Ce,"OrdinaryGetPrototypeOf");function Ge(){var C;!Z(m)&&typeof t.Reflect<"u"&&!(m in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(C=qe(t.Reflect));var P,D,V,Ee=new g,Vt={registerProvider:Yt,getProvider:he,setProvider:be};return Vt;function Yt(we){if(!Object.isExtensible(Vt))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case C===we:break;case Z(P):P=we;break;case P===we:break;case Z(D):D=we;break;case D===we:break;default:V===void 0&&(V=new h),V.add(we);break}}function tt(we,Qe){if(!Z(P)){if(P.isProviderFor(we,Qe))return P;if(!Z(D)){if(D.isProviderFor(we,Qe))return P;if(!Z(V))for(var Et=F(V);;){var vt=le(Et);if(!vt)return;var un=H(vt);if(un.isProviderFor(we,Qe))return Se(Et),un}}}if(!Z(C)&&C.isProviderFor(we,Qe))return C}function he(we,Qe){var Et=Ee.get(we),vt;return Z(Et)||(vt=Et.get(Qe)),Z(vt)&&(vt=tt(we,Qe),Z(vt)||(Z(Et)&&(Et=new p,Ee.set(we,Et)),Et.set(Qe,vt))),vt}function me(we){if(Z(we))throw new TypeError;return P===we||D===we||!Z(V)&&V.has(we)}function be(we,Qe,Et){if(!me(Et))throw new Error("Metadata provider not registered.");var vt=he(we,Qe);if(vt!==Et){if(!Z(vt))return!1;var un=Ee.get(we);Z(un)&&(un=new p,Ee.set(we,un)),un.set(Qe,Et)}return!0}}a(Ge,"CreateMetadataRegistry");function Ne(){var C;return!Z(m)&&K(t.Reflect)&&Object.isExtensible(t.Reflect)&&(C=t.Reflect[m]),Z(C)&&(C=Ge()),!Z(m)&&K(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:C}),C}a(Ne,"GetOrCreateMetadataRegistry");function ke(C){var P=new g,D={isProviderFor:a(function(me,be){var we=P.get(me);return Z(we)?!1:we.has(be)},"isProviderFor"),OrdinaryDefineOwnMetadata:Yt,OrdinaryHasOwnMetadata:Ee,OrdinaryGetOwnMetadata:Vt,OrdinaryOwnMetadataKeys:tt,OrdinaryDeleteMetadata:he};return b.registerProvider(D),D;function V(me,be,we){var Qe=P.get(me),Et=!1;if(Z(Qe)){if(!we)return;Qe=new p,P.set(me,Qe),Et=!0}var vt=Qe.get(be);if(Z(vt)){if(!we)return;if(vt=new p,Qe.set(be,vt),!C.setProvider(me,be,D))throw Qe.delete(be),Et&&P.delete(me),new Error("Wrong provider for target.")}return vt}a(V,"GetOrCreateMetadataMap");function Ee(me,be,we){var Qe=V(be,we,!1);return Z(Qe)?!1:$(Qe.has(me))}a(Ee,"OrdinaryHasOwnMetadata");function Vt(me,be,we){var Qe=V(be,we,!1);if(!Z(Qe))return Qe.get(me)}a(Vt,"OrdinaryGetOwnMetadata");function Yt(me,be,we,Qe){var Et=V(we,Qe,!0);Et.set(me,be)}a(Yt,"OrdinaryDefineOwnMetadata");function tt(me,be){var we=[],Qe=V(me,be,!1);if(Z(Qe))return we;for(var Et=Qe.keys(),vt=F(Et),un=0;;){var Si=le(vt);if(!Si)return we.length=un,we;var Bi=H(Si);try{we[un]=Bi}catch(Xn){try{Se(vt)}finally{throw Xn}}un++}}a(tt,"OrdinaryOwnMetadataKeys");function he(me,be,we){var Qe=V(be,we,!1);if(Z(Qe)||!Qe.delete(me))return!1;if(Qe.size===0){var Et=P.get(be);Z(Et)||(Et.delete(we),Et.size===0&&P.delete(Et))}return!0}a(he,"OrdinaryDeleteMetadata")}a(ke,"CreateMetadataProvider");function qe(C){var P=C.defineMetadata,D=C.hasOwnMetadata,V=C.getOwnMetadata,Ee=C.getOwnMetadataKeys,Vt=C.deleteMetadata,Yt=new g,tt={isProviderFor:a(function(he,me){var be=Yt.get(he);return!Z(be)&&be.has(me)?!0:Ee(he,me).length?(Z(be)&&(be=new h,Yt.set(he,be)),be.add(me),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:P,OrdinaryHasOwnMetadata:D,OrdinaryGetOwnMetadata:V,OrdinaryOwnMetadataKeys:Ee,OrdinaryDeleteMetadata:Vt};return tt}a(qe,"CreateFallbackProvider");function xe(C,P,D){var V=b.getProvider(C,P);if(!Z(V))return V;if(D){if(b.setProvider(C,P,_))return _;throw new Error("Illegal state.")}}a(xe,"GetMetadataProvider");function Be(){var C={},P=[],D=(function(){function tt(he,me,be){this._index=0,this._keys=he,this._values=me,this._selector=be}return a(tt,"MapIterator"),tt.prototype["@@iterator"]=function(){return this},tt.prototype[o]=function(){return this},tt.prototype.next=function(){var he=this._index;if(he>=0&&he<this._keys.length){var me=this._selector(this._keys[he],this._values[he]);return he+1>=this._keys.length?(this._index=-1,this._keys=P,this._values=P):this._index++,{value:me,done:!1}}return{value:void 0,done:!0}},tt.prototype.throw=function(he){throw this._index>=0&&(this._index=-1,this._keys=P,this._values=P),he},tt.prototype.return=function(he){return this._index>=0&&(this._index=-1,this._keys=P,this._values=P),{value:he,done:!0}},tt})(),V=(function(){function tt(){this._keys=[],this._values=[],this._cacheKey=C,this._cacheIndex=-2}return a(tt,"Map"),Object.defineProperty(tt.prototype,"size",{get:a(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),tt.prototype.has=function(he){return this._find(he,!1)>=0},tt.prototype.get=function(he){var me=this._find(he,!1);return me>=0?this._values[me]:void 0},tt.prototype.set=function(he,me){var be=this._find(he,!0);return this._values[be]=me,this},tt.prototype.delete=function(he){var me=this._find(he,!1);if(me>=0){for(var be=this._keys.length,we=me+1;we<be;we++)this._keys[we-1]=this._keys[we],this._values[we-1]=this._values[we];return this._keys.length--,this._values.length--,de(he,this._cacheKey)&&(this._cacheKey=C,this._cacheIndex=-2),!0}return!1},tt.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=C,this._cacheIndex=-2},tt.prototype.keys=function(){return new D(this._keys,this._values,Ee)},tt.prototype.values=function(){return new D(this._keys,this._values,Vt)},tt.prototype.entries=function(){return new D(this._keys,this._values,Yt)},tt.prototype["@@iterator"]=function(){return this.entries()},tt.prototype[o]=function(){return this.entries()},tt.prototype._find=function(he,me){if(!de(this._cacheKey,he)){this._cacheIndex=-1;for(var be=0;be<this._keys.length;be++)if(de(this._keys[be],he)){this._cacheIndex=be;break}}return this._cacheIndex<0&&me&&(this._cacheIndex=this._keys.length,this._keys.push(he),this._values.push(void 0)),this._cacheIndex},tt})();return V;function Ee(tt,he){return tt}function Vt(tt,he){return he}function Yt(tt,he){return[tt,he]}}a(Be,"CreateMapPolyfill");function Ze(){var C=(function(){function P(){this._map=new p}return a(P,"Set"),Object.defineProperty(P.prototype,"size",{get:a(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),P.prototype.has=function(D){return this._map.has(D)},P.prototype.add=function(D){return this._map.set(D,D),this},P.prototype.delete=function(D){return this._map.delete(D)},P.prototype.clear=function(){this._map.clear()},P.prototype.keys=function(){return this._map.keys()},P.prototype.values=function(){return this._map.keys()},P.prototype.entries=function(){return this._map.entries()},P.prototype["@@iterator"]=function(){return this.keys()},P.prototype[o]=function(){return this.keys()},P})();return C}a(Ze,"CreateSetPolyfill");function nt(){var C=16,P=f.create(),D=V();return(function(){function he(){this._key=V()}return a(he,"WeakMap"),he.prototype.has=function(me){var be=Ee(me,!1);return be!==void 0?f.has(be,this._key):!1},he.prototype.get=function(me){var be=Ee(me,!1);return be!==void 0?f.get(be,this._key):void 0},he.prototype.set=function(me,be){var we=Ee(me,!0);return we[this._key]=be,this},he.prototype.delete=function(me){var be=Ee(me,!1);return be!==void 0?delete be[this._key]:!1},he.prototype.clear=function(){this._key=V()},he})();function V(){var he;do he="@@WeakMap@@"+tt();while(f.has(P,he));return P[he]=!0,he}function Ee(he,me){if(!n.call(he,D)){if(!me)return;Object.defineProperty(he,D,{value:f.create()})}return he[D]}function Vt(he,me){for(var be=0;be<me;++be)he[be]=Math.random()*255|0;return he}function Yt(he){if(typeof Uint8Array=="function"){var me=new Uint8Array(he);return typeof crypto<"u"?crypto.getRandomValues(me):typeof msCrypto<"u"?msCrypto.getRandomValues(me):Vt(me,he),me}return Vt(new Array(he),he)}function tt(){var he=Yt(C);he[6]=he[6]&79|64,he[8]=he[8]&191|128;for(var me="",be=0;be<C;++be){var we=he[be];(be===4||be===6||be===8)&&(me+="-"),we<16&&(me+="0"),me+=we.toString(16).toLowerCase()}return me}}a(nt,"CreateWeakMapPolyfill");function et(C){return C.__=void 0,delete C.__,C}a(et,"MakeDictionary")})})(lD||(lD={}))});var ac,gl,Lp=Me(()=>{ac=class extends Error{static{a(this,"CommanderError")}constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},gl=class extends ac{static{a(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}});function ey(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}var Np,ty=Me(()=>{Lp();Np=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,n)=>{if(!this.argChoices.includes(t))throw new gl(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};a(ey,"humanReadableArgName")});var uD,kp,lv=Me(()=>{ty();uD=require("node:util"),kp=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),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let n=a(i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,""),"getSortKey");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),s=n.long&&e._findOption(n.long);!i&&!s?t.push(n):n.long&&!s?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.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(n=>ey(n)).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((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+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(n=>JSON.stringify(n)).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 n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){let i=new Map;return e.forEach(s=>{let o=n(s);i.has(o)||i.set(o,[])}),t.forEach(s=>{let o=n(s);i.has(o)||i.set(o,[]),i.get(o).push(s)}),i}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function s(d,p){return t.formatItem(d,n,p,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,p)=>{let h=d.map(g=>s(t.styleOptionTerm(t.optionTerm(g)),t.styleOptionDescription(t.optionDescription(g))));o=o.concat(this.formatItemList(p,h,t))}),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(p=>s(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));o=o.concat(this.formatItemList("Global Options:",d,t))}return this.groupItems(e.commands,t.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let h=d.map(g=>s(t.styleSubcommandTerm(t.subcommandTerm(g)),t.styleSubcommandDescription(t.subcommandDescription(g))));o=o.concat(this.formatItemList(p,h,t))}),o.join(`
7
7
  `)}displayWidth(e){return(0,uD.stripVTControlCharacters)(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,n,i){let o=" ".repeat(2);if(!n)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(n)?d=n:d=i.boxWrap(n,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 n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,s=[];return n.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 p=f.trimStart();l=[p],u=this.displayWidth(p)}),s.push(l.join(""))}),s.join(`
@@ -76,7 +76,7 @@ ${r.slice(o+1)}`:l+=r.slice(i),l.slice(1)}a(nL,"foldLine");function GY(r){let e=
76
76
  `}else n+=oa(t,0,o.contents,{block:!0,compact:!0})+`
77
77
  `;i=o.explicitEnd||o.contents!==null&&KY(o.contents),i&&(n+=`...
78
78
  `)}return n}a(JL,"present");var XY=jt(jt({},ST),{},{schema:IL,skipInvalid:!1,noRefs:!1,flowLevel:-1,transform:a(()=>{},"transform")});function QY(r,e={}){let t=jt(jt({},XY),e),n=GL(r,t.schema,{noRefs:t.noRefs,skipInvalid:t.skipInvalid});return t.flowLevel>=0&&WL(n,(i,s)=>{if(!(s.depth<t.flowLevel))return i.style.flow=!0,yT}),t.transform(n),JL(n,jt(jt({},Q1(t,Object.keys(ST))),{},{schema:t.schema}))}a(QY,"dump");var lh=-1;function JY(r){return"tagStart"in r&&r.tagStart!==lh?r.tagStart:"anchorStart"in r&&r.anchorStart!==lh?r.anchorStart:"valueStart"in r&&r.valueStart!==lh?r.valueStart:"start"in r?r.start:0}a(JY,"eventPosition");function ZL(r,e){return e.tagStart===lh?"":r.source.slice(e.tagStart,e.tagEnd)}a(ZL,"rawTag");function eN(r,e){return e.anchorStart===lh?void 0:r.source.slice(e.anchorStart,e.anchorEnd)}a(eN,"anchorName");function ZY(r,e){let t=hT(r.source,e),n=ZL(r,e),i=new dc;switch(e.style){case or.SINGLE_QUOTED:i.singleQuoted=!0;break;case or.DOUBLE_QUOTED:i.doubleQuoted=!0;break;case or.LITERAL_BLOCK:i.literal=!0;break;case or.FOLDED_BLOCK:i.folded=!0;break}let s;return n!==""?(i.tagged=!0,s=n):e.style===or.PLAIN?s=r.schema.resolveImplicitScalarTag(t).tag.tagName:s=r.schema.defaultScalarTag.tagName,{kind:"scalar",tag:s,style:i,anchor:eN(r,e),value:t}}a(ZY,"buildScalar");function sL(r,e,t){let n=ZL(r,e),i=new dc;e.style===mo.FLOW&&(i.flow=!0);let s;return n===""?s=t:(s=n,i.tagged=!0),{tag:s,style:i,anchor:eN(r,e)}}a(sL,"buildCollection");function X1(r,e){let t=r.frames[r.frames.length-1];t.kind==="document"?t.doc.contents=e:t.kind==="sequence"?t.node.items.push(e):t.key?(t.node.items.push({key:t.key,value:e}),t.key=null):t.key=e}a(X1,"addNode");function eX(r,e){let t={source:e.source,schema:e.schema,eventIndex:0,position:0,frames:[],documents:[]};for(;t.eventIndex<r.length;){let n=r[t.eventIndex++];switch(t.position=JY(n),n.type){case Dt.DOCUMENT:{let i={contents:null,explicitStart:n.explicitStart,explicitEnd:n.explicitEnd,directives:n.directives};t.frames.push({kind:"document",doc:i});break}case Dt.SCALAR:X1(t,ZY(t,n));break;case Dt.SEQUENCE:{let{tag:i,style:s,anchor:o}=sL(t,n,"tag:yaml.org,2002:seq"),c={kind:"sequence",tag:i,style:s,anchor:o,items:[]};t.frames.push({kind:"sequence",node:c});break}case Dt.MAPPING:{let{tag:i,style:s,anchor:o}=sL(t,n,"tag:yaml.org,2002:map"),c={kind:"mapping",tag:i,style:s,anchor:o,items:[]};t.frames.push({kind:"mapping",node:c,key:null});break}case Dt.ALIAS:{let i=t.source.slice(n.anchorStart,n.anchorEnd);X1(t,{kind:"alias",tag:"",style:new dc,anchor:i});break}case Dt.POP:{let i=t.frames.pop();if(i.kind==="mapping"&&i.key)throw new Error("incomplete mapping pair in event stream");i.kind==="document"?t.documents.push(i.doc):X1(t,i.node);break}}}return t.documents}a(eX,"eventsToAst");var tX=Dt.DOCUMENT,rX=Dt.SEQUENCE,nX=Dt.MAPPING,iX=Dt.SCALAR,sX=Dt.ALIAS,oX=Dt.POP,aX=or.PLAIN,cX=or.SINGLE_QUOTED,lX=or.DOUBLE_QUOTED,uX=or.LITERAL_BLOCK,fX=or.FOLDED_BLOCK,dX=mo.BLOCK,pX=mo.FLOW,hX=Ci.CLIP,mX=Ci.STRIP,gX=Ci.KEEP;_e.CHOMPING_CLIP=hX;_e.CHOMPING_KEEP=gX;_e.CHOMPING_MODE=Ci;_e.CHOMPING_STRIP=mX;_e.COLLECTION_STYLE=mo;_e.COLLECTION_STYLE_BLOCK=dX;_e.COLLECTION_STYLE_FLOW=pX;_e.CORE_SCHEMA=TL;_e.DUMP_SCHEMA=IL;_e.EVENT_ALIAS=sX;_e.EVENT_DOCUMENT=tX;_e.EVENT_ID=Dt;_e.EVENT_MAPPING=nX;_e.EVENT_POP=oX;_e.EVENT_SCALAR=iX;_e.EVENT_SEQUENCE=rX;_e.FAILSAFE_SCHEMA=i0;_e.JSON_SCHEMA=xK;_e.NOT_RESOLVED=ft;_e.SCALAR_STYLE=or;_e.SCALAR_STYLE_DOUBLE_QUOTED=lX;_e.SCALAR_STYLE_FOLDED_BLOCK=fX;_e.SCALAR_STYLE_LITERAL_BLOCK=uX;_e.SCALAR_STYLE_PLAIN=aX;_e.SCALAR_STYLE_SINGLE_QUOTED=cX;_e.Schema=gh;_e.Style=dc;_e.VISIT_BREAK=qL;_e.VISIT_SKIP=yT;_e.YAML11_SCHEMA=AL;_e.YAMLException=aa;_e.binaryTag=gL;_e.boolCoreTag=uL;_e.boolJsonTag=fL;_e.boolYaml11Tag=dL;_e.constructFromEvents=LL;_e.defineMappingTag=mh;_e.defineScalarTag=mn;_e.defineSequenceTag=r0;_e.dump=QY;_e.eventsToAst=eX;_e.floatCoreTag=dT;_e.floatJsonTag=hL;_e.floatYaml11Tag=Jy;_e.getScalarValue=hT;_e.intCoreTag=fT;_e.intJsonTag=pL;_e.intYaml11Tag=Qy;_e.jsToAst=GL;_e.legacyMapTag=OK;_e.load=yY;_e.loadAll=gY;_e.mapTag=wL;_e.mergeTag=mL;_e.nullCoreTag=aL;_e.nullJsonTag=cL;_e.nullYaml11Tag=lL;_e.omapTag=_L;_e.pairsTag=SL;_e.parseEvents=BL;_e.present=JL;_e.realMapTag=PK;_e.seqTag=bL;_e.setTag=EL;_e.strTag=oL;_e.timestampTag=yL;_e.visit=WL});var o0=T(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.XSD_NS=void 0;go.xsdDatatypeLocalName=rN;go.xsdDatatypeIRI=yX;go.xsdNumericFamily=bX;go.XSD_NS="http://www.w3.org/2001/XMLSchema#";var tN="xsd:";function rN(r){return r.startsWith(go.XSD_NS)?r.slice(go.XSD_NS.length):r.startsWith(tN)?r.slice(tN.length):null}a(rN,"xsdDatatypeLocalName");function yX(r){let e=rN(r);return e===null?null:go.XSD_NS+e}a(yX,"xsdDatatypeIRI");function bX(r){return _X.has(r)?"integer":SX.has(r)?"decimal":null}a(bX,"xsdNumericFamily");var _X=new Set(["integer","long","int","short","byte","nonNegativeInteger","unsignedLong","unsignedInt","unsignedShort","unsignedByte","positiveInteger","nonPositiveInteger","negativeInteger"]),SX=new Set(["decimal","float","double"])});var Ll=T(Nn=>{"use strict";var wX=Nn&&Nn.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),EX=Nn&&Nn.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),vX=Nn&&Nn.__importStar||(function(){var r=a(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&wX(t,e,n[i]);return EX(t,e),t}})();Object.defineProperty(Nn,"__esModule",{value:!0});Nn.STRING_SCALAR_PROPERTIES=void 0;Nn.scalarTypingForRange=sN;Nn.isCompleteDoubleQuotedScalar=TT;Nn.needsYamlQuoting=oN;Nn.quoteYamlString=aN;Nn.decodeYamlQuotedScalar=jX;Nn.serializeYamlScalar=$X;var vT=vX(s0()),nN=o0(),TX=/^[-!&*?|>%@`"'#,[\]{}]/,AX=/[\u0000-\u001f\u007f-\u009f]/,IX=/[\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,RX=/^(?:true|True|TRUE|false|False|FALSE)$/,CX=/^(?:null|Null|NULL|~)$/,xX=/^[-+]?(?:0b[01_]+|0o[0-7_]+|0x[0-9a-fA-F_]+|[0-9][0-9_]*)$/,PX=/^(?:[-+]?[0-9][0-9_]*(?:\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\.(?:inf|Inf|INF)|\.(?:nan|NaN|NAN))$/,OX=/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/,FX=/^(?:true|false)$/;Nn.STRING_SCALAR_PROPERTIES=new Set(["exo__Asset_label","aliases"]);var DX=/^[+-]?(?:0|[1-9][0-9]*)$/,LX=/^[+-]?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$/,NX=/^(?:true|false)$/;function sN(r){if(r===void 0||r.length!==1)return;let e=(0,nN.xsdDatatypeLocalName)(r[0].trim());if(e===null)return;let t=(0,nN.xsdNumericFamily)(e);if(t!==null)return t;if(e==="boolean")return"boolean";if(e==="string")return"string"}a(sN,"scalarTypingForRange");function TT(r){if(r.length<2||!r.startsWith('"')||!r.endsWith('"'))return!1;let e=r.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(TT,"isCompleteDoubleQuotedScalar");function kX(r){let e;try{e=vT.load(`v: ${r}`,{schema:vT.YAML11_SCHEMA})}catch{return!0}return typeof e!="object"||e===null?!0:typeof e.v!="string"}a(kX,"yaml11ReaderCoercesToNonString");function iN(r){return kX(r)||RX.test(r)||CX.test(r)||xX.test(r)||PX.test(r)||OX.test(r)}a(iN,"looksLikeNonStringScalar");function oN(r,e=!1,t){if(r==="")return!0;if(TT(r))return!1;let n=sN(t);return n==="integer"&&DX.test(r)&&Number.isSafeInteger(Number(r))||n==="decimal"&&LX.test(r)||n==="boolean"&&NX.test(r)?!1:!!(r!==r.trim()||/:(\s|$)/.test(r)||/\s#/.test(r)||TX.test(r)||AX.test(r)||IX.test(r)||e&&iN(r)||n==="string"&&iN(r)&&!FX.test(r))}a(oN,"needsYamlQuoting");function aN(r){let e="";for(let t=0;t<r.length;t++){let n=r[t],i=r.charCodeAt(t);n==="\\"?e+="\\\\":n==='"'?e+='\\"':n===`
79
- `?e+="\\n":n==="\r"?e+="\\r":n===" "?e+="\\t":i<32||i>=127&&i<=159?e+="\\x"+i.toString(16).toUpperCase().padStart(2,"0"):i===65534||i===65535?e+="\\u"+i.toString(16).toUpperCase():i>=55296&&i<=56319&&t+1<r.length&&r.charCodeAt(t+1)>=56320&&r.charCodeAt(t+1)<=57343?(e+=n+r[t+1],t++):i>=55296&&i<=57343?e+="\\u"+i.toString(16).toUpperCase():e+=n}return`"${e}"`}a(aN,"quoteYamlString");function MX(r){if(r.length<2||!r.startsWith("'")||!r.endsWith("'"))return!1;let e=r.slice(1,-1);for(let t=0;t<e.length;t++)if(e[t]==="'"){if(e[t+1]!=="'")return!1;t++}return!0}a(MX,"isCompleteSingleQuotedScalar");function jX(r){if(!TT(r)&&!MX(r))return r;try{let e=vT.load(r);return typeof e=="string"?e:r}catch{return r}}a(jX,"decodeYamlQuotedScalar");function $X(r,e=!1,t){return typeof r!="string"?String(r):oN(r,e,t)?aN(r):r}a($X,"serializeYamlScalar")});var sf=T(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.bytesToBase64=lN;nf.base64ToBytes=uN;nf.base64ToUtf8=UX;nf.utf8ToBase64=BX;var cN=32768;function lN(r){let e="";for(let t=0;t<r.length;t+=cN)e+=String.fromCharCode(...r.subarray(t,t+cN));return btoa(e)}a(lN,"bytesToBase64");function uN(r){let e=r.replace(/\s/g,""),t=e.length%4,n=t===2||t===3?e+"=".repeat(4-t):e,i=atob(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o++)s[o]=i.charCodeAt(o);return s}a(uN,"base64ToBytes");function UX(r){return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(uN(r))}a(UX,"base64ToUtf8");function BX(r){return lN(new TextEncoder().encode(r))}a(BX,"utf8ToBase64")});var ca=T(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0});AT.iriToObsidianName=GX;var VX=qt();function GX(r){let e=VX.Namespace.fromTermIRI(r);if(e)return`${e.namespace.prefix}__${e.localName}`;let t=r.match(/\/([^/]+)\.md$/);return t?t[1]:null}a(GX,"iriToObsidianName")});var CT=T(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.findUidByAssetLabel=qX;var fN=De(),pN=He(),IT=qt();async function qX(r,e){let t=IT.Namespace.EXO.term("Asset_label"),n=WX(e);if(n)for(let i of await r.match(void 0,t,n)){if(!(i.subject instanceof fN.IRI))continue;let s=await dN(r,i.subject);if(s)return s}for(let i of await r.match(void 0,t,void 0))if(i.object instanceof pN.Literal&&i.object.value===e&&i.subject instanceof fN.IRI){let s=await dN(r,i.subject);if(s)return s}return null}a(qX,"findUidByAssetLabel");function WX(r){if(/\s/.test(r))return null;let e=IT.Namespace.fromPropertyKey(r);if(!e||/[\s()]/.test(e.localName))return null;try{return e.namespace.term(e.localName)}catch{return null}}a(WX,"labelTermIRI");async function dN(r,e){let t=await r.match(e,IT.Namespace.EXO.term("Asset_uid"),void 0);return t.length>0&&t[0].object instanceof pN.Literal?t[0].object.value:null}a(dN,"uidOf")});var hN=T(a0=>{"use strict";Object.defineProperty(a0,"__esModule",{value:!0});a0.mergePropertyDefaults=zX;a0.mergeInheritanceRules=HX;function zX(r,e){let t=new Map;for(let s of e)t.set(s.propertyName,s);let n=[],i=new Set;for(let s of r){let o=t.get(s.propertyName);o?(n.push(o),i.add(o.propertyName)):n.push(s)}for(let s of e)i.has(s.propertyName)||n.push(s);return n}a(zX,"mergePropertyDefaults");function HX(r,e){let t=new Map;for(let s of e){let o=t.get(s.targetPropertyName);o?o.push(s):t.set(s.targetPropertyName,[s])}let n=[],i=new Set;for(let s of r){let o=t.get(s.targetPropertyName);o?i.has(s.targetPropertyName)||(n.push(...o),i.add(s.targetPropertyName)):n.push(s)}for(let s of e)i.has(s.targetPropertyName)||n.push(s);return n}a(HX,"mergeInheritanceRules")});var xT=T((ATe,mN)=>{var of=class{static{a(this,"Wildcard")}constructor(){return KX||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(of.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(of.prototype,"termType",{enumerable:!0,value:"Wildcard"});var KX=new of;mN.exports.Wildcard=of});var yN=T((RTe,gN)=>{var YX=(function(){var r=a(function(k,L,B,te){for(B=B||{},te=k.length;te--;B[k[te]]=L);return B},"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],n=[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],p=[1,41],h=[1,44],g=[123,126],m=[1,67],b=[39,45,87],_=[13,16,45,197,224,308],S=[1,87],I=[2,281],E=[1,86],w=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],R=[6,28,29,53,63,70,73,81,83,85],x=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],O=[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],N=[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],G=[13,16,308],j=[112,132,327,334],ae=[13,16,112,132,308],Y=[1,111],M=[1,117],ce=[112,132,327,328,334],W=[13,16,112,132,308,328],oe=[28,29,45,53,87],X=[1,138],J=[1,151],ye=[1,128],ze=[1,127],Z=[1,129],z=[1,140],ee=[1,141],K=[1,142],ie=[1,143],Pe=[1,144],$=[1,145],fe=[1,147],se=[1,148],Ae=[2,457],ge=[1,158],ve=[1,159],Re=[1,160],de=[1,152],U=[1,153],F=[1,156],H=[1,171],le=[1,172],Se=[1,173],Ce=[1,174],Ge=[1,175],Ne=[1,176],ke=[1,167],qe=[1,168],xe=[1,169],Be=[1,170],Ze=[1,157],nt=[1,166],et=[1,161],C=[1,162],P=[1,163],D=[1,164],V=[1,165],Ee=[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],Vt=[1,195],Yt=[6,31,73,81,83,85],tt=[2,285],he=[1,199],me=[1,201],be=[6,31,70,73,81,83,85],we=[2,283],Qe=[1,207],Et=[1,218],vt=[1,223],un=[1,219],Si=[1,225],Bi=[1,226],Xn=[1,224],SF=[6,63,70,73,81,83,85],wF=[1,236],EF=[2,334],vF=[1,243],TF=[1,241],fn=[6,193],Og=[2,349],AF=[2,339],ic=[28,128],IF=[47,48,193,272],Fg=[47,48,193,242,272],Du=[47,48,193,242,246,272],Lu=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Kr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],RF=[1,271],CF=[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],xF=[1,281],PF=[1,280],Qn=[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],vp=[45,89],Dg=[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],Lg=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ng=[31,89],kg=[48,87],ol=[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],so=[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],OF=[1,313],Nu=[6,85],BE=[6,31,81,83,85],FF=[2,361],zo=[2,353],al=[1,343],Tp=[31,112,335],Ho=[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],VE=[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],DF=[6,109,193],cl=[31,112],Rr=[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],GE=[1,390],qE=[1,391],sc=[13,16,87,197,308,314],LF=[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],Mg=[1,417],jg=[1,418],NF=[13,16,48,197,229,308],oc=[6,31,85],kF=[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],WE=[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],ll=[29,31,85,112,159,160,161,163,164],$g=[1,443],Ug=[1,444],MF=[1,449],ul=[31,112,193,232,318,335],Bg=[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],jF=[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],zE=[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],Ap=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ip=[31,45],$F=[1,507],UF=[1,508],BF=[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],Vg=[29,31,85,112,159,160,161,163,164,335],fl=[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],VF=[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],GF=[2,352],HE=[13,16,197,308,314],qF=[1,565],ku=[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],WF=[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],Ko=[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],zF=[13,16,87,308],Yo=[2,364],Mu=[29,31,85,112,159,160,161,163,164,193,232,318,335],Gg=[31,112,193,232,272,318,335],Xo=[2,359],HF=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],qg=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],KF=[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],YF=[2,347],KE={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(L,B,te,Oe,Je,v,Zn){var A=v.length-1;switch(Je){case 1:if(v[A-1]=v[A-1]||{},it.base&&(v[A-1].base=it.base),it.base="",v[A-1].prefixes=it.prefixes,it.prefixes=null,it.pathOnly){if(v[A-1].type==="path"||"termType"in v[A-1])return v[A-1];throw new Error("Received full SPARQL query in path only mode")}else if(v[A-1].type==="path"||"termType"in v[A-1])throw new Error("Received only path in full SPARQL mode");if(v[A-1].type==="update"){let Gt={};for(let ir of v[A-1].updates)if(ir.updateType==="insert"){let Tt={};for(let Ft of ir.insert)if(Ft.type==="bgp"||Ft.type==="graph")for(let wi of Ft.triples)wi.subject.termType==="BlankNode"&&(Tt[wi.subject.value]=!0),wi.predicate.termType==="BlankNode"&&(Tt[wi.predicate.value]=!0),wi.object.termType==="BlankNode"&&(Tt[wi.object.value]=!0);for(let Ft of Object.keys(Tt)){if(Gt[Ft])throw new Error("Detected reuse blank node across different INSERT DATA clauses");Gt[Ft]=!0}}}return v[A-1];case 2:this.$={...v[A-1],...v[A],type:"query"};break;case 4:it.base=Rp(v[A]);break;case 5:it.prefixes||(it.prefixes={}),v[A-1]=v[A-1].substr(0,v[A-1].length-1),v[A]=Rp(v[A]),it.prefixes[v[A-1]]=v[A];break;case 6:this.$={...v[A-3],...hl(v[A-2]),...v[A-1],...v[A]};break;case 7:if(!it.skipValidation&&(rv(v[A-3].variables.map(ir=>tv(ir.expression))).some(ir=>ir.aggregation==="count"&&!(ir.expression instanceof Wg))||v[A].group)){for(let ir of v[A-3].variables)if(ir.termType==="Variable"){if(!v[A].group||!v[A].group.map(Tt=>Bu(Tt)).includes(Bu(ir)))throw Error("Projection of ungrouped variable (?"+Bu(ir)+")")}else if(tv(ir.expression).length===0){let Tt=IG(ir.expression);for(let Ft of Tt)if(!v[A].group||!v[A].group.map||!v[A].group.map(wi=>Bu(wi)).includes(Bu(Ft)))throw Error("Use of ungrouped variable in projection of operation (?"+Bu(Ft)+")")}}let lo=v[A-1].where.filter(Gt=>Gt.type==="query");if(lo.length>0){let Gt=v[A-3].variables.filter(Tt=>Tt.variable&&Tt.variable.value).map(Tt=>Tt.variable.value),ir=rv(lo.map(Tt=>Tt.variables)).map(Tt=>Tt.value||Tt.variable.value);for(let Tt of Gt)if(ir.indexOf(Tt)>=0)throw Error("Target id of 'AS' (?"+Tt+") already used in subquery")}this.$=_r(v[A-3],hl(v[A-2]),v[A-1],v[A]);break;case 8:this.$=_r({queryType:"CONSTRUCT",template:v[A-3]},hl(v[A-2]),v[A-1],v[A]);break;case 9:this.$=_r({queryType:"CONSTRUCT",template:v[A-2]=v[A-2]?v[A-2].triples:[]},hl(v[A-5]),{where:[{type:"bgp",triples:pl([],v[A-2])}]},v[A]);break;case 10:this.$=_r({queryType:"DESCRIBE",variables:v[A-3]==="*"?[new Wg]:v[A-3]},hl(v[A-2]),v[A-1],v[A]);break;case 11:this.$=_r({queryType:"ASK"},hl(v[A-2]),v[A-1],v[A]);break;case 12:this.$=_r(v[A-1],{variables:[new Wg]});break;case 13:let Fp=v[A].map(Gt=>Gt.value||Gt.variable.value),Vu=RG(Fp);if(Vu.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Vu[0]+")");this.$=_r(v[A-1],{variables:v[A]});break;case 14:this.$=_r({queryType:"SELECT"},v[A]&&(v[A-1]=Jn(v[A]),v[A]={},v[A][v[A-1]]=!0,v[A]));break;case 16:case 27:this.$=ju(v[A-3],{variable:v[A-1]});break;case 17:case 18:this.$=_r(v[A-3],v[A-2],v[A-1],v[A],{type:"query"});break;case 19:case 58:this.$={iri:v[A],named:!!v[A-1]};break;case 20:this.$={where:v[A].patterns};break;case 21:this.$=_r(v[A-1],v[A]);break;case 22:this.$=_r(v[A-2],v[A-1],v[A]);break;case 23:this.$={group:v[A]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=ju(v[A]);break;case 26:this.$=ju(v[A-1]);break;case 29:this.$={having:v[A]};break;case 30:this.$={order:v[A]};break;case 32:this.$=ju(v[A],{descending:!0});break;case 35:this.$={limit:Uu(v[A])};break;case 36:this.$={offset:Uu(v[A])};break;case 37:this.$={limit:Uu(v[A-2]),offset:Uu(v[A])};break;case 38:this.$={limit:Uu(v[A]),offset:Uu(v[A-2])};break;case 39:case 43:this.$={type:"values",values:v[A]};break;case 40:case 84:this.$=v[A-1].map(Gt=>({[v[A-3]]:Gt}));break;case 41:case 85:this.$=v[A-1].map(()=>({}));break;case 42:case 86:var co=v[A-4].length;v[A-4]=v[A-4].map(YE),this.$=v[A-1].map(function(Gt){if(Gt.length!==co)throw Error("Inconsistent VALUES length");for(var ir={},Tt=0;Tt<co;Tt++)ir["?"+v[A-4][Tt].value]=Gt[Tt];return ir});break;case 44:case 65:case 100:case 126:case 175:this.$=v[A-1];break;case 45:this.$={type:"update",updates:Qo(v[A-2],v[A-1])};break;case 46:this.$=_r({type:"load",silent:!!v[A-2],source:v[A-1]},v[A]&&{destination:v[A]});break;case 47:this.$={type:Jn(v[A-2]),silent:!!v[A-1],graph:v[A]};break;case 48:this.$={type:Jn(v[A-4]),silent:!!v[A-3],source:v[A-2],destination:v[A]};break;case 49:this.$={type:"create",silent:!!v[A-2],graph:{type:"graph",name:v[A]}};break;case 50:this.$={updateType:"insert",insert:oD(v[A])};break;case 51:this.$={updateType:"delete",delete:sv(oD(v[A]))};break;case 52:this.$={updateType:"deletewhere",delete:sv(v[A])};break;case 53:this.$={updateType:"insertdelete",...v[A-4],...v[A-3],...hl(v[A-2],"using"),where:v[A].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=v[A];break;case 55:this.$={delete:sv(v[A-1]),insert:v[A]||[]};break;case 56:this.$={delete:[],insert:v[A]};break;case 59:this.$={graph:v[A]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:v[A]};break;case 64:this.$={[Jn(v[A])]:!0};break;case 66:this.$=v[A-1]?oo(v[A],[v[A-1]]):oo(v[A]);break;case 67:var Pp=_r(v[A-3]||{triples:[]},{type:"graph",name:v[A-5]});this.$=v[A]?[Pp,v[A]]:[Pp];break;case 68:case 73:this.$={type:"bgp",triples:oo(v[A-2],[v[A-1]])};break;case 69:this.$={type:"group",patterns:[v[A-1]]};break;case 70:for(let Gt of v[A-1].filter(ir=>ir.type==="bind")){let ir=v[A-1].indexOf(Gt),Tt=new Set;for(let Ft of v[A-1].slice(0,ir))(Ft.type==="group"||Ft.type==="bgp")&&iD(Ft).forEach(wi=>Tt.add(wi));if(Tt.has(Gt.variable.value))throw Error("Variable used to bind is already bound (?"+Gt.variable.value+")")}this.$={type:"group",patterns:v[A-1]};break;case 71:this.$=v[A-1]?oo([v[A-1]],v[A]):oo(v[A]);break;case 72:this.$=v[A]?[v[A-2],v[A]]:v[A-2];break;case 75:this.$=_r(v[A],{type:"optional"});break;case 76:this.$=_r(v[A],{type:"minus"});break;case 77:this.$=_r(v[A],{type:"graph",name:v[A-1]});break;case 78:this.$=_r(v[A],{type:"service",name:v[A-1],silent:!!v[A-2]});break;case 79:this.$={type:"filter",expression:v[A]};break;case 80:this.$={type:"bind",variable:v[A-1],expression:v[A-3]};break;case 89:this.$=xp(v[A]);break;case 90:this.$=void 0;break;case 91:this.$=v[A-1].length?{type:"union",patterns:oo(v[A-1].map(QE),[QE(v[A])])}:v[A];break;case 95:this.$={...v[A],function:v[A-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Qo(v[A-2],v[A-1]),distinct:!!v[A-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.$=Qo(v[A-2],v[A-1]);break;case 101:this.$=oo(v[A-2],[v[A-1]]);break;case 102:case 112:this.$=iv(v[A].map(Gt=>_r(Jo(v[A-1]),Gt)));break;case 103:this.$=iv(pl(v[A].map(Gt=>_r(Jo(v[A-1].entity),Gt)),v[A-1].triples));break;case 105:this.$=oo([v[A-1]],v[A]);break;case 106:this.$=oo(v[A]);break;case 107:this.$=ev(v[A-1],v[A]);break;case 109:case 237:this.$=it.factory.namedNode(gG);break;case 110:case 118:this.$=Qo(v[A-1],v[A]);break;case 111:this.$=v[A]?{annotation:v[A],object:v[A-1]}:v[A-1];break;case 113:this.$=v[A]?iv(pl(v[A].map(Gt=>_r(Jo(v[A-1].entity),Gt)),v[A-1].triples)):v[A-1].triples;break;case 114:this.$=ev(...v[A-1],v[A]);break;case 116:this.$=ev(...v[A]);break;case 117:case 159:case 163:this.$=[v[A-1],v[A]];break;case 119:this.$=v[A]?{object:v[A-1],annotation:v[A]}:v[A-1];break;case 120:this.$=v[A-1].length?$u("|",Qo(v[A-1],v[A])):v[A];break;case 121:this.$=v[A-1].length?$u("/",Qo(v[A-1],v[A])):v[A];break;case 122:this.$=v[A]?$u(v[A],[v[A-1]]):v[A-1];break;case 123:this.$=v[A-1]?$u(v[A-1],[v[A]]):v[A];break;case 125:case 131:this.$=$u(v[A-1],[v[A]]);break;case 129:this.$=$u("|",Qo(v[A-2],v[A-1]));break;case 132:case 134:this.$=TG(v[A-1]);break;case 133:case 135:this.$=AG(v[A-1]);break;case 140:this.$={entity:v[A],triples:[]};break;case 145:this.$=YE(v[A]);break;case 149:this.$=it.factory.namedNode(XF);break;case 151:case 153:case 158:case 162:this.$=XE(v[A-1],v[A]);break;case 152:this.$=["||",v[A]];break;case 154:this.$=["&&",v[A]];break;case 156:this.$=dn(v[A-1],[v[A-2],v[A]]);break;case 157:this.$=dn(v[A-2]?"notin":"in",[v[A-3],v[A]]);break;case 160:this.$=["+",XE(v[A-1],v[A])];break;case 161:var Kg=ao(v[A-1].value.replace("-",""),v[A-1].datatype);this.$=["-",XE(Kg,v[A])];break;case 164:this.$=dn("UPLUS",[v[A]]);break;case 165:this.$=dn(v[A-1],[v[A]]);break;case 166:this.$=dn("UMINUS",[v[A]]);break;case 177:this.$=dn(Jn(v[A-1]));break;case 178:this.$=dn(Jn(v[A-3]),[v[A-1]]);break;case 179:this.$=xp(dn(Jn(v[A-3]),[v[A-1]]));break;case 180:this.$=dn(Jn(v[A-5]),[v[A-3],v[A-1]]);break;case 181:this.$=dn(Jn(v[A-7]),[v[A-5],v[A-3],v[A-1]]);break;case 182:this.$=xp(dn(Jn(v[A-7]),[v[A-5],v[A-3],v[A-1]]));break;case 183:this.$=dn(Jn(v[A-1]),v[A]);break;case 184:this.$=dn("bound",[YE(v[A-1])]);break;case 185:this.$=dn(v[A-1],[]);break;case 186:this.$=dn(v[A-3],[v[A-1]]);break;case 187:this.$=dn(v[A-2]?"notexists":"exists",[QE(v[A])]);break;case 188:case 189:this.$=ju(v[A-1],{type:"aggregate",aggregation:Jn(v[A-4]),distinct:!!v[A-2]});break;case 190:this.$=ju(v[A-2],{type:"aggregate",aggregation:Jn(v[A-5]),distinct:!!v[A-3],separator:typeof v[A-1]=="string"?v[A-1]:" "});break;case 192:this.$=ao(v[A]);break;case 193:this.$=SG(v[A-1],Jn(v[A].substr(1)));break;case 194:this.$=ao(v[A-2],v[A]);break;case 195:case 204:this.$=ao(v[A],QF);break;case 196:case 205:this.$=ao(v[A],JF);break;case 197:case 206:this.$=ao(Jn(v[A]),ZF);break;case 200:this.$=ao(v[A].toLowerCase(),_G);break;case 201:this.$=ao(v[A].substr(1),QF);break;case 202:this.$=ao(v[A].substr(1),JF);break;case 203:this.$=ao(v[A].substr(1).toLowerCase(),ZF);break;case 207:case 208:this.$=nD(v[A],1);break;case 209:case 210:this.$=nD(v[A],3);break;case 211:this.$=it.factory.namedNode(Rp(v[A]));break;case 213:var Yg=v[A].indexOf(":"),Op=v[A].substr(0,Yg),Xg=it.prefixes[Op];if(!Xg)throw new Error("Unknown prefix: "+Op);var fr=Rp(Xg+v[A].substr(Yg+1));this.$=it.factory.namedNode(fr);break;case 214:if(v[A]=v[A].substr(0,v[A].length-1),!(v[A]in it.prefixes))throw new Error("Unknown prefix: "+v[A]);var fr=Rp(it.prefixes[v[A]]);this.$=it.factory.namedNode(fr);break;case 215:this.$=Cp(v[A].replace(/^(_:)/,""));break;case 216:this.$=Cp();break;case 217:case 218:case 232:this.$=xp(JE(v[A-3],v[A-2],v[A-1]));break;case 230:case 231:this.$=xp(v[A-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:v[A-1].push(v[A]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[v[A]];break;case 308:v[A-3].push(v[A-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:v[A-2].push(v[A-1]);break}},"anonymous"),table:[r(e,t,{3:1,4:2,10:3}),{1:[3]},r(n,[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}),r([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]},r(c,[2,411],{216:28,217:29}),r(l,[2,249],{18:30}),r(l,[2,251],{22:31}),r(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:p,139:38,307:43,308:h,323:36},r(l,[2,267],{37:46}),r(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:m,87:p},r(b,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),r(e,[2,248]),r(e,[2,245]),r(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]},r([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]}),r(_,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:S,29:I,52:84,53:E,56:85},{19:88,28:S,29:I,52:89,53:E,56:85},r(l,[2,253],{26:90}),{28:[1,91],52:92,53:E},r(w,[2,385],{181:93,182:94,183:95,31:[2,383]}),r(R,[2,263],{34:96}),r(R,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:p,308:h}),r(R,[2,262]),r(x,[2,259]),r(O,[2,143]),r(O,[2,144]),r([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]),r(N,[2,211]),r(N,[2,212]),r(N,[2,213]),r(N,[2,214]),{19:98,28:S,29:I,52:99,53:E,56:85},{6:[2,309],99:100,193:[1,101]},r(G,[2,311],{101:102,328:[1,103]}),r(j,[2,317],{104:104,328:[1,105]}),r(ae,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:Y,114:110},{29:Y,114:112},{29:Y,114:113},{118:114,123:[1,115],125:116,126:M},r(ce,[2,315]),r(ce,[2,316]),r(W,[2,319]),r(W,[2,320]),r(W,[2,321]),r(g,[2,327]),{13:f,16:d,55:118,307:43,308:h},r(l,[2,12]),r(l,[2,13],{44:66,43:119,45:m,87:p}),r(oe,[2,269]),r(oe,[2,15]),{13:f,16:d,44:136,45:X,46:120,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(b,[2,14]),r(b,[2,274]),r(b,[2,271]),r(b,[2,272]),r(e,[2,4]),{13:[1,177]},r(Ee,[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},r(c,[2,410]),r([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:Vt,219:189,220:190,223:191,224:[1,192],307:43,308:h},r(_,[2,419]),r(Yt,tt,{20:196,59:197,69:198,70:he}),r(l,[2,250]),{29:me,57:200},r(G,[2,279],{54:202,327:[1,203]}),{29:[2,282]},r(be,we,{23:204,58:205,62:206,63:Qe}),r(l,[2,252]),{19:208,28:S,29:I,52:209,53:E,56:85},{29:[1,210]},r(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:Et,55:220,82:J,87:p,89:vt,145:212,172:221,185:213,187:214,231:un,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(SF,[2,265],{56:85,35:227,52:228,19:229,28:S,29:I,53:E}),r(x,[2,260]),r(be,we,{58:205,62:206,23:230,63:Qe}),r(l,[2,268]),{6:[2,45]},r(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:h},r(G,[2,312]),{105:233,112:wF,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},r(j,[2,318]),r(G,EF,{108:240,133:242,112:vF,132:TF}),r(ae,[2,323]),{112:[1,244]},{112:[2,325]},r(fn,[2,50]),r(w,Og,{135:245,136:246,143:247,144:248,31:AF,112:AF}),r(fn,[2,51]),r(fn,[2,52]),r(ic,[2,328],{119:249}),{29:Y,114:250},r(ic,[2,56]),{29:Y,114:251},r(g,[2,59]),r(oe,[2,270]),{47:[1,252]},r(IF,[2,150]),r(Fg,[2,428],{240:253}),r(Du,[2,430],{244:254}),r(Du,[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]}),r(Lu,[2,440],{252:264}),r(Kr,[2,448],{260:265}),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,255:154,257:155,264:266,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,255:154,257:155,264:267,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,255:154,257:155,264:268,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Kr,[2,167]),r(Kr,[2,168]),r(Kr,[2,169]),r(Kr,[2,170],{176:269,45:RF,89:CF}),r(Kr,[2,171]),r(Kr,[2,172]),r(Kr,[2,173]),r(Kr,[2,174]),{13:f,16:d,44:136,45:X,46:272,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ir,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:xF,89:PF,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},r(Qn,[2,192],{292:[1,286],293:[1,287]}),r(Qn,[2,195]),r(Qn,[2,196]),r(Qn,[2,197]),r(Qn,[2,198]),r(Qn,[2,199]),r(Qn,[2,200]),{13:f,16:d,44:39,55:40,82:J,87:p,139:289,172:291,255:154,257:155,266:290,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},r(vp,[2,452]),r(vp,[2,453]),r(vp,[2,454]),r(vp,[2,455]),r(vp,[2,456]),{279:[2,458]},r(Dg,[2,207]),r(Dg,[2,208]),r(Dg,[2,209]),r(Dg,[2,210]),r(Qn,[2,201]),r(Qn,[2,202]),r(Qn,[2,203]),r(Qn,[2,204]),r(Qn,[2,205]),r(Qn,[2,206]),r(e,[2,5]),r(Lg,[2,297],{88:295}),r(Ng,[2,299],{90:296}),{48:[1,297],87:[1,298]},r(kg,[2,301]),r(Ee,[2,43]),r(Ee,[2,82]),r(Ee,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},r(c,[2,412]),r(ol,[2,123]),r(ol,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),r(so,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:Vt,223:312,225:308,226:309,229:OF,307:43,308:h},r(c,i,{215:10,214:314}),r(so,[2,236]),r(so,[2,237]),r(Nu,[2,6]),r(BE,[2,287],{60:315,72:316,73:[1,317]}),r(Yt,[2,286]),{13:f,16:d,45:X,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,307:43,308:h,346:nt,347:et,348:C,349:P,350:D,351:V},r([6,31,63,70,73,81,83,85],[2,20]),r(w,FF,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:zo,31:zo,85:zo,112:zo,159:zo,160:zo,161:zo,163:zo,164:zo,41:s}),{13:f,16:d,55:331,307:43,308:h},r(G,[2,280]),r(Nu,[2,7]),r(Yt,tt,{59:197,69:198,20:332,70:he}),r(be,[2,284]),{64:[1,333]},r(be,we,{58:205,62:206,23:334,63:Qe}),r(l,[2,254]),r(w,Og,{144:248,30:335,143:336,31:[2,257]}),r(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:p,139:342,186:339,190:340,195:341,197:al,307:43,308:h},r(Tp,[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:p,197:al,308:h}),r(Ho,[2,227]),r(Ho,[2,228]),r(Ho,[2,229]),{13:f,16:d,44:215,45:Et,55:220,82:J,87:p,89:vt,172:221,185:351,187:350,200:348,230:347,231:un,234:349,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},{13:f,16:d,44:39,55:40,87:p,139:342,186:352,190:340,195:341,197:al,307:43,308:h},r(Ho,[2,146]),r(Ho,[2,147]),r(Ho,[2,148]),r(Ho,[2,149]),{13:f,16:d,44:354,55:355,82:J,87:p,172:357,237:356,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:358,312:Xn,313:353},r(VE,[2,215]),r(VE,[2,216]),r(be,we,{58:205,62:206,23:359,63:Qe}),r(R,[2,264]),r(SF,[2,266]),r(Nu,[2,11]),r(n,[2,308],{6:[2,310]}),r(fn,[2,313],{102:360,120:361,121:[1,362]}),r(fn,[2,47]),r(fn,[2,63]),r(fn,[2,64]),{13:f,16:d,55:363,307:43,308:h},r(fn,[2,336]),r(fn,[2,337]),r(fn,[2,338]),{109:[1,364]},r(DF,[2,60]),{13:f,16:d,55:365,307:43,308:h},r(G,[2,335]),{13:f,16:d,55:366,307:43,308:h},{31:[1,367]},r(cl,[2,341],{137:368}),r(cl,[2,340]),{13:f,16:d,44:215,45:Et,55:220,82:J,87:p,89:vt,145:369,172:221,185:213,187:214,231:un,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},{28:[1,370],127:371,128:[1,372]},r(ic,[2,330],{124:373,125:374,126:M}),r(ic,[2,57]),{44:375,87:p},r(IF,[2,151],{241:376,242:[1,377]}),r(Fg,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,247:380,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{250:[1,381]},r(Rr,[2,432]),r(Rr,[2,433]),r(Rr,[2,434]),r(Rr,[2,435]),r(Rr,[2,436]),r(Rr,[2,437]),{250:[2,439]},r([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:H,298:le,299:Se,300:Ce,301:Ge,302:Ne}),r(Lu,[2,162],{261:388,262:389,39:GE,338:qE}),r(Kr,[2,164]),r(Kr,[2,165]),r(Kr,[2,166]),r(Ir,[2,95]),r(Ir,[2,96]),r(Rr,[2,377],{177:392,325:[1,393]}),{48:[1,394]},r(Ir,[2,177]),{13:f,16:d,44:136,45:X,46:395,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:396,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:397,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:398,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:399,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ir,[2,183]),r(Ir,[2,98]),r(Rr,[2,381],{180:400}),{87:[1,401]},r(Ir,[2,185]),{13:f,16:d,44:136,45:X,46:402,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{29:me,57:403},r(Qn,[2,193]),{13:f,16:d,55:404,307:43,308:h},{13:f,16:d,44:39,55:40,87:p,139:342,195:405,197:al,307:43,308:h},r(sc,[2,233]),r(sc,[2,234]),r(sc,[2,235]),r(LF,[2,459],{281:406,325:[1,407]}),r(Rr,[2,463],{284:408,325:[1,409]}),r(Rr,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:J,171:413,172:415,173:416,174:Mg,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:jg},{31:[1,419],89:[1,420]},{29:[1,421]},r(kg,[2,302]),r(Lg,[2,367],{167:422}),r(Ng,[2,369],{168:423}),{48:[1,424],87:[1,425]},r(kg,[2,371]),r(ol,[2,122]),r(ol,[2,417]),r(ol,[2,413]),r(ol,[2,414]),r(ol,[2,415]),r(so,[2,125]),r(so,[2,127]),r(so,[2,128]),r(NF,[2,420],{227:426}),r(so,[2,130]),{13:f,16:d,55:194,197:Vt,223:427,307:43,308:h},{48:[1,428]},r(oc,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),r(BE,[2,288]),{64:[1,433]},r(Yt,[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:X,268:z,269:ee,270:K,271:ie,273:Pe,274:$,276:fe,277:se,279:Ae,280:ge,283:ve,285:Re,308:h,346:nt,347:et,348:C,349:P,350:D,351:V}),r(kF,[2,293]),r(WE,[2,92]),r(WE,[2,93]),r(WE,[2,94]),{45:RF,89:CF,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:S,29:I,56:85},{19:438,28:S,29:I,56:85},r(ll,[2,355],{149:439}),r(ll,[2,354]),{13:f,16:d,44:215,45:$g,55:220,82:J,87:p,89:vt,156:440,172:221,185:441,203:442,231:Ug,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(R,[2,19]),r(oc,[2,21]),{13:f,16:d,44:450,45:MF,55:323,65:445,66:446,67:447,68:448,87:p,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,307:43,308:h,346:nt,347:et,348:C,349:P,350:D,351:V},r(Nu,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},r(w,[2,386],{31:[2,388]}),r(Tp,[2,102]),r(ul,[2,391],{191:452}),r(w,[2,395],{196:453,198:454}),r(w,[2,108]),r(w,[2,109]),r(Tp,[2,103]),r(Tp,[2,104]),r(Tp,[2,390]),{13:f,16:d,44:215,45:Et,48:[1,455],55:220,82:J,87:p,89:vt,172:221,185:351,187:350,200:456,231:un,234:349,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(Bg,[2,424]),r(jF,[2,136]),r(jF,[2,137]),r(zE,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:p,139:342,195:458,197:al,307:43,308:h},r(sc,[2,219]),r(sc,[2,220]),r(sc,[2,221]),r(sc,[2,222]),r(sc,[2,223]),r(Nu,[2,10]),r(fn,[2,46]),r(fn,[2,314]),{112:wF,122:459},r(fn,[2,62]),r(G,EF,{133:242,108:460,112:vF,132:TF}),r(DF,[2,61]),r(fn,[2,49]),r([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},r(cl,[2,351],{146:463,335:[1,464]}),{29:me,57:465},r(ic,[2,329]),r(G,[2,332],{129:466,327:[1,467]}),r(ic,[2,55]),r(ic,[2,331]),{48:[1,468]},r(Fg,[2,429]),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Du,[2,431]),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,243:470,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Du,[2,156]),{45:xF,89:PF,179:471},r(Lu,[2,441]),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,251:472,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Kr,[2,444],{256:473}),r(Kr,[2,446],{258:474}),r(Rr,[2,442]),r(Rr,[2,443]),r(Kr,[2,449]),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,255:154,257:155,259:475,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Rr,[2,450]),r(Rr,[2,451]),r(Rr,[2,379],{178:476}),r(Rr,[2,378]),r([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:X,46:482,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{48:[1,483]},{48:[1,484]},r(Ir,[2,187]),r(Qn,[2,194]),{13:f,16:d,44:39,55:40,82:J,87:p,139:289,172:291,255:154,257:155,266:290,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,320:485},{13:f,16:d,39:[1,487],44:136,45:X,46:488,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,282:486,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(LF,[2,460]),{13:f,16:d,44:136,45:X,46:489,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Rr,[2,464]),{13:f,16:d,44:136,45:X,46:490,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Rr,[2,466]),r(Ee,[2,40]),r(Lg,[2,298]),r(Ap,[2,87]),r(Ap,[2,88]),r(Ap,[2,89]),r(Ap,[2,90]),{13:f,16:d,55:492,82:J,172:493,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,311:494,312:Xn,315:491},r(Ee,[2,41]),r(Ng,[2,300]),r(Ip,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:J,171:497,172:415,173:416,174:Mg,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:jg},{31:[1,498],89:[1,499]},{29:[1,500]},r(kg,[2,372]),{13:f,16:d,48:[2,422],55:194,197:Vt,223:312,226:502,228:501,229:OF,307:43,308:h},r(so,[2,131]),r(so,[2,126]),r(oc,[2,22]),r(oc,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:X,55:323,67:321,68:322,74:505,75:506,76:$F,77:320,78:UF,79:509,87:p,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,307:43,308:h,346:nt,347:et,348:C,349:P,350:D,351:V},r(kF,[2,294]),r(BF,[2,69]),r(BF,[2,70]),r(Yt,tt,{59:197,69:198,20:511,70:he}),r(be,we,{58:205,62:206,23:512,63:Qe}),{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},r(ll,[2,363],{157:524,335:[1,525]}),r(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:p}),r(Vg,[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:p}),{13:f,16:d,44:215,45:$g,55:220,82:J,87:p,89:vt,172:221,185:351,203:536,212:534,231:Ug,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:p}),r(be,[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:MF,87:p,268:z,269:ee,270:K,271:ie,273:Pe,274:$,276:fe,277:se,279:Ae,280:ge,283:ve,285:Re,308:h,346:nt,347:et,348:C,349:P,350:D,351:V}),r(fl,[2,291]),r(fl,[2,24]),r(fl,[2,25]),{13:f,16:d,44:136,45:X,46:539,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(fl,[2,28]),r(be,we,{58:205,62:206,23:540,63:Qe}),r([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),r(ul,[2,107]),{13:f,16:d,44:215,45:Et,55:220,82:J,87:p,89:vt,172:221,185:351,187:350,199:543,200:544,231:un,234:349,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(VF,[2,132]),r(Bg,[2,425]),r(VF,[2,133]),{13:f,16:d,44:354,55:355,82:J,87:p,172:357,237:356,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:358,312:Xn,313:545},r(fn,[2,54]),r(fn,[2,48]),r(cl,[2,342]),{13:f,16:d,44:39,55:40,87:p,139:546,307:43,308:h},r(cl,[2,68]),r(w,[2,350],{31:GF,112:GF}),r(fn,[2,53]),{13:f,16:d,55:547,307:43,308:h},r(G,[2,333]),r(oe,[2,16]),r(Fg,[2,152]),r(Du,[2,154]),r(Du,[2,157]),r(Lu,[2,159]),r(Lu,[2,160],{262:389,261:548,39:GE,338:qE}),r(Lu,[2,161],{262:389,261:549,39:GE,338:qE}),r(Kr,[2,163]),{13:f,16:d,44:136,45:X,46:550,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ir,[2,178]),r(Ir,[2,179]),{13:f,16:d,44:136,45:X,46:551,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:552,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:553,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{48:[1,554],272:[1,555]},r(Ir,[2,184]),r(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:Vt,223:562,307:43,308:h},r(HE,[2,224]),r(HE,[2,225]),r(HE,[2,226]),{31:[1,563],45:qF,94:564},r(Ee,[2,84]),r(Lg,[2,368]),r(Ee,[2,85]),r(Ng,[2,370]),r(Ip,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},r(oc,[2,35],{83:[1,569]}),r(oc,[2,36],{81:[1,570]}),r(BE,[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:X,76:$F,78:UF,87:p,268:z,269:ee,270:K,271:ie,273:Pe,274:$,276:fe,277:se,279:Ae,280:ge,283:ve,285:Re,308:h,346:nt,347:et,348:C,349:P,350:D,351:V}),r(ku,[2,295]),{45:X,77:572},{45:X,77:573},r(ku,[2,33]),r(ku,[2,34]),{31:[2,275],50:574,84:575,85:o},{31:[2,277],51:576,84:577,85:o},r(ll,[2,356]),r(WF,[2,357],{152:578,335:[1,579]}),r(Ko,[2,74]),{29:me,57:580},{29:me,57:581},{13:f,16:d,44:39,55:40,87:p,139:582,307:43,308:h},r(zF,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:X,55:323,67:321,68:322,77:320,79:585,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,307:43,308:h,346:nt,347:et,348:C,349:P,350:D,351:V},{45:[1,586]},r(Ko,[2,81]),{29:me,57:587},r(ll,[2,73]),r(w,[2,362],{29:Yo,31:Yo,85:Yo,112:Yo,159:Yo,160:Yo,161:Yo,163:Yo,164:Yo}),r(Vg,[2,112]),r(Mu,[2,401],{206:588}),r(w,[2,405],{209:589,210:590}),r(w,[2,403]),r(w,[2,404]),r(Vg,[2,113]),r(Vg,[2,400]),{13:f,16:d,44:215,45:$g,48:[1,591],55:220,82:J,87:p,89:vt,172:221,185:351,203:536,212:592,231:Ug,234:535,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(Bg,[2,426]),r(zE,[2,138]),r(zE,[2,139]),{232:[1,593]},r(fl,[2,292]),{47:[1,595],48:[1,594]},r(Nu,[2,9]),r(ul,[2,392]),r(ul,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:p,197:al,308:h}),r(ul,[2,110],{272:[1,598]}),r(Gg,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},r(ic,[2,58]),r(Kr,[2,445]),r(Kr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},r(Ir,[2,99]),r(Rr,[2,382]),r([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]),r(Ir,[2,188]),r(Ir,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:J,172:493,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,311:494,312:Xn,315:611},r(Ee,[2,42]),r(Ip,[2,304]),{13:f,16:d,55:414,82:J,95:612,171:613,172:415,173:416,174:Mg,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:jg},{31:[1,614],45:qF,94:615},r(so,[2,129]),r(NF,[2,421]),{82:[1,616]},{82:[1,617]},r(ku,[2,296]),r(ku,[2,31]),r(ku,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},r(w,FF,{155:330,153:618,154:619,29:Xo,31:Xo,85:Xo,112:Xo,159:Xo,160:Xo,161:Xo,163:Xo,164:Xo}),r(WF,[2,358]),r(Ko,[2,75]),r(Ko,[2,76]),{29:me,57:620},{13:f,16:d,44:39,55:40,87:p,139:621,307:43,308:h},r(zF,[2,366]),r(Ko,[2,79]),{13:f,16:d,44:136,45:X,46:622,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ko,[2,91],{336:[1,623]}),r([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),r(Mu,[2,117]),{13:f,16:d,44:215,45:$g,55:220,82:J,87:p,89:vt,172:221,185:351,203:536,211:626,212:627,231:Ug,234:535,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(Ho,[2,134]),r(Bg,[2,427]),r(Ho,[2,135]),r(fl,[2,26]),{44:628,87:p},r(ul,[2,106]),r(ul,[2,394]),r(w,[2,396]),r(Gg,[2,111]),r(Gg,[2,398]),{13:f,16:d,44:39,55:40,87:p,139:342,186:629,190:340,195:341,197:al,307:43,308:h},r(VE,[2,217]),r(w,Og,{144:248,140:630,143:631,31:[2,343]}),r(Ir,[2,97]),r(Rr,[2,380]),r(Ir,[2,180]),{13:f,16:d,44:136,45:X,46:632,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:633,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:z,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ir,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:J,171:637,172:415,173:416,174:Mg,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:jg},r(HF,[2,305]),r(Ee,[2,86]),r(Ip,[2,374]),r(oc,[2,37]),r(oc,[2,38]),r(ll,[2,72]),r(ll,[2,360]),r(Ko,[2,77]),{29:me,57:638},{47:[1,639]},{29:[2,376]},r(Mu,[2,402]),r(Mu,[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:p}),r(Mu,[2,118],{272:[1,641]}),r(qg,[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:ke,304:qe,305:xe,306:Be},r(Ap,[2,218]),r(Ip,[2,44]),r(HF,[2,306]),r(Ko,[2,78]),{44:651,87:p},r(Mu,[2,116]),r(w,[2,406]),r(qg,[2,119]),r(qg,[2,408]),r(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:p}),r(fl,[2,27]),r(Gg,[2,230]),r(KF,[2,345],{141:653,335:[1,654]}),r(Ir,[2,181]),r(Ir,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},r(w,Og,{144:248,142:657,143:658,31:YF,112:YF}),r(KF,[2,346]),r(Ko,[2,80]),r(qg,[2,231]),r(cl,[2,67]),r(cl,[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(L,B){if(B.recoverable)this.trace(L);else{var te=new Error(L);throw te.hash=B,te}},"parseError"),parse:a(function(L){var B=this,te=[0],Oe=[],Je=[null],v=[],Zn=this.table,A="",co=0,Pp=0,Kg=0,Yg=2,Op=1,Xg=v.slice.call(arguments,1),fr=Object.create(this.lexer),lo={yy:{}};for(var Fp in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Fp)&&(lo.yy[Fp]=this.yy[Fp]);fr.setInput(L,lo.yy),lo.yy.lexer=fr,lo.yy.parser=this,typeof fr.yylloc>"u"&&(fr.yylloc={});var Vu=fr.yylloc;v.push(Vu);var Gt=fr.options&&fr.options.ranges;typeof lo.yy.parseError=="function"?this.parseError=lo.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ir(uo){te.length=te.length-2*uo,Je.length=Je.length-uo,v.length=v.length-uo}a(ir,"popStack");for(var Tt=a(function(){var uo;return uo=fr.lex()||Op,typeof uo!="number"&&(uo=B.symbols_[uo]||uo),uo},"lex"),Ft,wi,ml,rs,Ewe,ov,Gu={},Qg,Zo,aD,Jg;;){if(ml=te[te.length-1],this.defaultActions[ml]?rs=this.defaultActions[ml]:((Ft===null||typeof Ft>"u")&&(Ft=Tt()),rs=Zn[ml]&&Zn[ml][Ft]),typeof rs>"u"||!rs.length||!rs[0]){var av="";Jg=[];for(Qg in Zn[ml])this.terminals_[Qg]&&Qg>Yg&&Jg.push("'"+this.terminals_[Qg]+"'");fr.showPosition?av="Parse error on line "+(co+1)+`:
79
+ `?e+="\\n":n==="\r"?e+="\\r":n===" "?e+="\\t":i<32||i>=127&&i<=159?e+="\\x"+i.toString(16).toUpperCase().padStart(2,"0"):i===65534||i===65535?e+="\\u"+i.toString(16).toUpperCase():i>=55296&&i<=56319&&t+1<r.length&&r.charCodeAt(t+1)>=56320&&r.charCodeAt(t+1)<=57343?(e+=n+r[t+1],t++):i>=55296&&i<=57343?e+="\\u"+i.toString(16).toUpperCase():e+=n}return`"${e}"`}a(aN,"quoteYamlString");function MX(r){if(r.length<2||!r.startsWith("'")||!r.endsWith("'"))return!1;let e=r.slice(1,-1);for(let t=0;t<e.length;t++)if(e[t]==="'"){if(e[t+1]!=="'")return!1;t++}return!0}a(MX,"isCompleteSingleQuotedScalar");function jX(r){if(!TT(r)&&!MX(r))return r;try{let e=vT.load(r);return typeof e=="string"?e:r}catch{return r}}a(jX,"decodeYamlQuotedScalar");function $X(r,e=!1,t){return typeof r!="string"?String(r):oN(r,e,t)?aN(r):r}a($X,"serializeYamlScalar")});var sf=T(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.bytesToBase64=lN;nf.base64ToBytes=uN;nf.base64ToUtf8=UX;nf.utf8ToBase64=BX;var cN=32768;function lN(r){let e="";for(let t=0;t<r.length;t+=cN)e+=String.fromCharCode(...r.subarray(t,t+cN));return btoa(e)}a(lN,"bytesToBase64");function uN(r){let e=r.replace(/\s/g,""),t=e.length%4,n=t===2||t===3?e+"=".repeat(4-t):e,i=atob(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o++)s[o]=i.charCodeAt(o);return s}a(uN,"base64ToBytes");function UX(r){return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(uN(r))}a(UX,"base64ToUtf8");function BX(r){return lN(new TextEncoder().encode(r))}a(BX,"utf8ToBase64")});var ca=T(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0});AT.iriToObsidianName=GX;var VX=qt();function GX(r){let e=VX.Namespace.fromTermIRI(r);if(e)return`${e.namespace.prefix}__${e.localName}`;let t=r.match(/\/([^/]+)\.md$/);return t?t[1]:null}a(GX,"iriToObsidianName")});var CT=T(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.findUidByAssetLabel=qX;var fN=De(),pN=He(),IT=qt();async function qX(r,e){let t=IT.Namespace.EXO.term("Asset_label"),n=WX(e);if(n)for(let i of await r.match(void 0,t,n)){if(!(i.subject instanceof fN.IRI))continue;let s=await dN(r,i.subject);if(s)return s}for(let i of await r.match(void 0,t,void 0))if(i.object instanceof pN.Literal&&i.object.value===e&&i.subject instanceof fN.IRI){let s=await dN(r,i.subject);if(s)return s}return null}a(qX,"findUidByAssetLabel");function WX(r){if(/\s/.test(r))return null;let e=IT.Namespace.fromPropertyKey(r);if(!e||/[\s()]/.test(e.localName))return null;try{return e.namespace.term(e.localName)}catch{return null}}a(WX,"labelTermIRI");async function dN(r,e){let t=await r.match(e,IT.Namespace.EXO.term("Asset_uid"),void 0);return t.length>0&&t[0].object instanceof pN.Literal?t[0].object.value:null}a(dN,"uidOf")});var hN=T(a0=>{"use strict";Object.defineProperty(a0,"__esModule",{value:!0});a0.mergePropertyDefaults=zX;a0.mergeInheritanceRules=HX;function zX(r,e){let t=new Map;for(let s of e)t.set(s.propertyName,s);let n=[],i=new Set;for(let s of r){let o=t.get(s.propertyName);o?(n.push(o),i.add(o.propertyName)):n.push(s)}for(let s of e)i.has(s.propertyName)||n.push(s);return n}a(zX,"mergePropertyDefaults");function HX(r,e){let t=new Map;for(let s of e){let o=t.get(s.targetPropertyName);o?o.push(s):t.set(s.targetPropertyName,[s])}let n=[],i=new Set;for(let s of r){let o=t.get(s.targetPropertyName);o?i.has(s.targetPropertyName)||(n.push(...o),i.add(s.targetPropertyName)):n.push(s)}for(let s of e)i.has(s.targetPropertyName)||n.push(s);return n}a(HX,"mergeInheritanceRules")});var xT=T((ATe,mN)=>{var of=class{static{a(this,"Wildcard")}constructor(){return KX||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(of.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(of.prototype,"termType",{enumerable:!0,value:"Wildcard"});var KX=new of;mN.exports.Wildcard=of});var yN=T((RTe,gN)=>{var YX=(function(){var r=a(function(k,L,B,te){for(B=B||{},te=k.length;te--;B[k[te]]=L);return B},"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],n=[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],p=[1,41],h=[1,44],g=[123,126],m=[1,67],b=[39,45,87],_=[13,16,45,197,224,308],S=[1,87],I=[2,281],E=[1,86],w=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],R=[6,28,29,53,63,70,73,81,83,85],x=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],O=[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],N=[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],G=[13,16,308],j=[112,132,327,334],ae=[13,16,112,132,308],Y=[1,111],M=[1,117],ce=[112,132,327,328,334],q=[13,16,112,132,308,328],oe=[28,29,45,53,87],X=[1,138],J=[1,151],ye=[1,128],ze=[1,127],Z=[1,129],W=[1,140],ee=[1,141],K=[1,142],ie=[1,143],Pe=[1,144],$=[1,145],fe=[1,147],se=[1,148],Ae=[2,457],ge=[1,158],ve=[1,159],Re=[1,160],de=[1,152],U=[1,153],F=[1,156],H=[1,171],le=[1,172],Se=[1,173],Ce=[1,174],Ge=[1,175],Ne=[1,176],ke=[1,167],qe=[1,168],xe=[1,169],Be=[1,170],Ze=[1,157],nt=[1,166],et=[1,161],C=[1,162],P=[1,163],D=[1,164],V=[1,165],Ee=[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],Vt=[1,195],Yt=[6,31,73,81,83,85],tt=[2,285],he=[1,199],me=[1,201],be=[6,31,70,73,81,83,85],we=[2,283],Qe=[1,207],Et=[1,218],vt=[1,223],un=[1,219],Si=[1,225],Bi=[1,226],Xn=[1,224],SF=[6,63,70,73,81,83,85],wF=[1,236],EF=[2,334],vF=[1,243],TF=[1,241],fn=[6,193],Og=[2,349],AF=[2,339],ic=[28,128],IF=[47,48,193,272],Fg=[47,48,193,242,272],Du=[47,48,193,242,246,272],Lu=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Kr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],RF=[1,271],CF=[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],xF=[1,281],PF=[1,280],Qn=[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],vp=[45,89],Dg=[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],Lg=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ng=[31,89],kg=[48,87],ol=[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],so=[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],OF=[1,313],Nu=[6,85],BE=[6,31,81,83,85],FF=[2,361],zo=[2,353],al=[1,343],Tp=[31,112,335],Ho=[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],VE=[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],DF=[6,109,193],cl=[31,112],Rr=[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],GE=[1,390],qE=[1,391],sc=[13,16,87,197,308,314],LF=[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],Mg=[1,417],jg=[1,418],NF=[13,16,48,197,229,308],oc=[6,31,85],kF=[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],WE=[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],ll=[29,31,85,112,159,160,161,163,164],$g=[1,443],Ug=[1,444],MF=[1,449],ul=[31,112,193,232,318,335],Bg=[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],jF=[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],zE=[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],Ap=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ip=[31,45],$F=[1,507],UF=[1,508],BF=[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],Vg=[29,31,85,112,159,160,161,163,164,335],fl=[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],VF=[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],GF=[2,352],HE=[13,16,197,308,314],qF=[1,565],ku=[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],WF=[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],Ko=[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],zF=[13,16,87,308],Yo=[2,364],Mu=[29,31,85,112,159,160,161,163,164,193,232,318,335],Gg=[31,112,193,232,272,318,335],Xo=[2,359],HF=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],qg=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],KF=[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],YF=[2,347],KE={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(L,B,te,Oe,Je,v,Zn){var A=v.length-1;switch(Je){case 1:if(v[A-1]=v[A-1]||{},it.base&&(v[A-1].base=it.base),it.base="",v[A-1].prefixes=it.prefixes,it.prefixes=null,it.pathOnly){if(v[A-1].type==="path"||"termType"in v[A-1])return v[A-1];throw new Error("Received full SPARQL query in path only mode")}else if(v[A-1].type==="path"||"termType"in v[A-1])throw new Error("Received only path in full SPARQL mode");if(v[A-1].type==="update"){let Gt={};for(let ir of v[A-1].updates)if(ir.updateType==="insert"){let Tt={};for(let Ft of ir.insert)if(Ft.type==="bgp"||Ft.type==="graph")for(let wi of Ft.triples)wi.subject.termType==="BlankNode"&&(Tt[wi.subject.value]=!0),wi.predicate.termType==="BlankNode"&&(Tt[wi.predicate.value]=!0),wi.object.termType==="BlankNode"&&(Tt[wi.object.value]=!0);for(let Ft of Object.keys(Tt)){if(Gt[Ft])throw new Error("Detected reuse blank node across different INSERT DATA clauses");Gt[Ft]=!0}}}return v[A-1];case 2:this.$={...v[A-1],...v[A],type:"query"};break;case 4:it.base=Rp(v[A]);break;case 5:it.prefixes||(it.prefixes={}),v[A-1]=v[A-1].substr(0,v[A-1].length-1),v[A]=Rp(v[A]),it.prefixes[v[A-1]]=v[A];break;case 6:this.$={...v[A-3],...hl(v[A-2]),...v[A-1],...v[A]};break;case 7:if(!it.skipValidation&&(rv(v[A-3].variables.map(ir=>tv(ir.expression))).some(ir=>ir.aggregation==="count"&&!(ir.expression instanceof Wg))||v[A].group)){for(let ir of v[A-3].variables)if(ir.termType==="Variable"){if(!v[A].group||!v[A].group.map(Tt=>Bu(Tt)).includes(Bu(ir)))throw Error("Projection of ungrouped variable (?"+Bu(ir)+")")}else if(tv(ir.expression).length===0){let Tt=IG(ir.expression);for(let Ft of Tt)if(!v[A].group||!v[A].group.map||!v[A].group.map(wi=>Bu(wi)).includes(Bu(Ft)))throw Error("Use of ungrouped variable in projection of operation (?"+Bu(Ft)+")")}}let lo=v[A-1].where.filter(Gt=>Gt.type==="query");if(lo.length>0){let Gt=v[A-3].variables.filter(Tt=>Tt.variable&&Tt.variable.value).map(Tt=>Tt.variable.value),ir=rv(lo.map(Tt=>Tt.variables)).map(Tt=>Tt.value||Tt.variable.value);for(let Tt of Gt)if(ir.indexOf(Tt)>=0)throw Error("Target id of 'AS' (?"+Tt+") already used in subquery")}this.$=_r(v[A-3],hl(v[A-2]),v[A-1],v[A]);break;case 8:this.$=_r({queryType:"CONSTRUCT",template:v[A-3]},hl(v[A-2]),v[A-1],v[A]);break;case 9:this.$=_r({queryType:"CONSTRUCT",template:v[A-2]=v[A-2]?v[A-2].triples:[]},hl(v[A-5]),{where:[{type:"bgp",triples:pl([],v[A-2])}]},v[A]);break;case 10:this.$=_r({queryType:"DESCRIBE",variables:v[A-3]==="*"?[new Wg]:v[A-3]},hl(v[A-2]),v[A-1],v[A]);break;case 11:this.$=_r({queryType:"ASK"},hl(v[A-2]),v[A-1],v[A]);break;case 12:this.$=_r(v[A-1],{variables:[new Wg]});break;case 13:let Fp=v[A].map(Gt=>Gt.value||Gt.variable.value),Vu=RG(Fp);if(Vu.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Vu[0]+")");this.$=_r(v[A-1],{variables:v[A]});break;case 14:this.$=_r({queryType:"SELECT"},v[A]&&(v[A-1]=Jn(v[A]),v[A]={},v[A][v[A-1]]=!0,v[A]));break;case 16:case 27:this.$=ju(v[A-3],{variable:v[A-1]});break;case 17:case 18:this.$=_r(v[A-3],v[A-2],v[A-1],v[A],{type:"query"});break;case 19:case 58:this.$={iri:v[A],named:!!v[A-1]};break;case 20:this.$={where:v[A].patterns};break;case 21:this.$=_r(v[A-1],v[A]);break;case 22:this.$=_r(v[A-2],v[A-1],v[A]);break;case 23:this.$={group:v[A]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=ju(v[A]);break;case 26:this.$=ju(v[A-1]);break;case 29:this.$={having:v[A]};break;case 30:this.$={order:v[A]};break;case 32:this.$=ju(v[A],{descending:!0});break;case 35:this.$={limit:Uu(v[A])};break;case 36:this.$={offset:Uu(v[A])};break;case 37:this.$={limit:Uu(v[A-2]),offset:Uu(v[A])};break;case 38:this.$={limit:Uu(v[A]),offset:Uu(v[A-2])};break;case 39:case 43:this.$={type:"values",values:v[A]};break;case 40:case 84:this.$=v[A-1].map(Gt=>({[v[A-3]]:Gt}));break;case 41:case 85:this.$=v[A-1].map(()=>({}));break;case 42:case 86:var co=v[A-4].length;v[A-4]=v[A-4].map(YE),this.$=v[A-1].map(function(Gt){if(Gt.length!==co)throw Error("Inconsistent VALUES length");for(var ir={},Tt=0;Tt<co;Tt++)ir["?"+v[A-4][Tt].value]=Gt[Tt];return ir});break;case 44:case 65:case 100:case 126:case 175:this.$=v[A-1];break;case 45:this.$={type:"update",updates:Qo(v[A-2],v[A-1])};break;case 46:this.$=_r({type:"load",silent:!!v[A-2],source:v[A-1]},v[A]&&{destination:v[A]});break;case 47:this.$={type:Jn(v[A-2]),silent:!!v[A-1],graph:v[A]};break;case 48:this.$={type:Jn(v[A-4]),silent:!!v[A-3],source:v[A-2],destination:v[A]};break;case 49:this.$={type:"create",silent:!!v[A-2],graph:{type:"graph",name:v[A]}};break;case 50:this.$={updateType:"insert",insert:oD(v[A])};break;case 51:this.$={updateType:"delete",delete:sv(oD(v[A]))};break;case 52:this.$={updateType:"deletewhere",delete:sv(v[A])};break;case 53:this.$={updateType:"insertdelete",...v[A-4],...v[A-3],...hl(v[A-2],"using"),where:v[A].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=v[A];break;case 55:this.$={delete:sv(v[A-1]),insert:v[A]||[]};break;case 56:this.$={delete:[],insert:v[A]};break;case 59:this.$={graph:v[A]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:v[A]};break;case 64:this.$={[Jn(v[A])]:!0};break;case 66:this.$=v[A-1]?oo(v[A],[v[A-1]]):oo(v[A]);break;case 67:var Pp=_r(v[A-3]||{triples:[]},{type:"graph",name:v[A-5]});this.$=v[A]?[Pp,v[A]]:[Pp];break;case 68:case 73:this.$={type:"bgp",triples:oo(v[A-2],[v[A-1]])};break;case 69:this.$={type:"group",patterns:[v[A-1]]};break;case 70:for(let Gt of v[A-1].filter(ir=>ir.type==="bind")){let ir=v[A-1].indexOf(Gt),Tt=new Set;for(let Ft of v[A-1].slice(0,ir))(Ft.type==="group"||Ft.type==="bgp")&&iD(Ft).forEach(wi=>Tt.add(wi));if(Tt.has(Gt.variable.value))throw Error("Variable used to bind is already bound (?"+Gt.variable.value+")")}this.$={type:"group",patterns:v[A-1]};break;case 71:this.$=v[A-1]?oo([v[A-1]],v[A]):oo(v[A]);break;case 72:this.$=v[A]?[v[A-2],v[A]]:v[A-2];break;case 75:this.$=_r(v[A],{type:"optional"});break;case 76:this.$=_r(v[A],{type:"minus"});break;case 77:this.$=_r(v[A],{type:"graph",name:v[A-1]});break;case 78:this.$=_r(v[A],{type:"service",name:v[A-1],silent:!!v[A-2]});break;case 79:this.$={type:"filter",expression:v[A]};break;case 80:this.$={type:"bind",variable:v[A-1],expression:v[A-3]};break;case 89:this.$=xp(v[A]);break;case 90:this.$=void 0;break;case 91:this.$=v[A-1].length?{type:"union",patterns:oo(v[A-1].map(QE),[QE(v[A])])}:v[A];break;case 95:this.$={...v[A],function:v[A-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Qo(v[A-2],v[A-1]),distinct:!!v[A-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.$=Qo(v[A-2],v[A-1]);break;case 101:this.$=oo(v[A-2],[v[A-1]]);break;case 102:case 112:this.$=iv(v[A].map(Gt=>_r(Jo(v[A-1]),Gt)));break;case 103:this.$=iv(pl(v[A].map(Gt=>_r(Jo(v[A-1].entity),Gt)),v[A-1].triples));break;case 105:this.$=oo([v[A-1]],v[A]);break;case 106:this.$=oo(v[A]);break;case 107:this.$=ev(v[A-1],v[A]);break;case 109:case 237:this.$=it.factory.namedNode(gG);break;case 110:case 118:this.$=Qo(v[A-1],v[A]);break;case 111:this.$=v[A]?{annotation:v[A],object:v[A-1]}:v[A-1];break;case 113:this.$=v[A]?iv(pl(v[A].map(Gt=>_r(Jo(v[A-1].entity),Gt)),v[A-1].triples)):v[A-1].triples;break;case 114:this.$=ev(...v[A-1],v[A]);break;case 116:this.$=ev(...v[A]);break;case 117:case 159:case 163:this.$=[v[A-1],v[A]];break;case 119:this.$=v[A]?{object:v[A-1],annotation:v[A]}:v[A-1];break;case 120:this.$=v[A-1].length?$u("|",Qo(v[A-1],v[A])):v[A];break;case 121:this.$=v[A-1].length?$u("/",Qo(v[A-1],v[A])):v[A];break;case 122:this.$=v[A]?$u(v[A],[v[A-1]]):v[A-1];break;case 123:this.$=v[A-1]?$u(v[A-1],[v[A]]):v[A];break;case 125:case 131:this.$=$u(v[A-1],[v[A]]);break;case 129:this.$=$u("|",Qo(v[A-2],v[A-1]));break;case 132:case 134:this.$=TG(v[A-1]);break;case 133:case 135:this.$=AG(v[A-1]);break;case 140:this.$={entity:v[A],triples:[]};break;case 145:this.$=YE(v[A]);break;case 149:this.$=it.factory.namedNode(XF);break;case 151:case 153:case 158:case 162:this.$=XE(v[A-1],v[A]);break;case 152:this.$=["||",v[A]];break;case 154:this.$=["&&",v[A]];break;case 156:this.$=dn(v[A-1],[v[A-2],v[A]]);break;case 157:this.$=dn(v[A-2]?"notin":"in",[v[A-3],v[A]]);break;case 160:this.$=["+",XE(v[A-1],v[A])];break;case 161:var Kg=ao(v[A-1].value.replace("-",""),v[A-1].datatype);this.$=["-",XE(Kg,v[A])];break;case 164:this.$=dn("UPLUS",[v[A]]);break;case 165:this.$=dn(v[A-1],[v[A]]);break;case 166:this.$=dn("UMINUS",[v[A]]);break;case 177:this.$=dn(Jn(v[A-1]));break;case 178:this.$=dn(Jn(v[A-3]),[v[A-1]]);break;case 179:this.$=xp(dn(Jn(v[A-3]),[v[A-1]]));break;case 180:this.$=dn(Jn(v[A-5]),[v[A-3],v[A-1]]);break;case 181:this.$=dn(Jn(v[A-7]),[v[A-5],v[A-3],v[A-1]]);break;case 182:this.$=xp(dn(Jn(v[A-7]),[v[A-5],v[A-3],v[A-1]]));break;case 183:this.$=dn(Jn(v[A-1]),v[A]);break;case 184:this.$=dn("bound",[YE(v[A-1])]);break;case 185:this.$=dn(v[A-1],[]);break;case 186:this.$=dn(v[A-3],[v[A-1]]);break;case 187:this.$=dn(v[A-2]?"notexists":"exists",[QE(v[A])]);break;case 188:case 189:this.$=ju(v[A-1],{type:"aggregate",aggregation:Jn(v[A-4]),distinct:!!v[A-2]});break;case 190:this.$=ju(v[A-2],{type:"aggregate",aggregation:Jn(v[A-5]),distinct:!!v[A-3],separator:typeof v[A-1]=="string"?v[A-1]:" "});break;case 192:this.$=ao(v[A]);break;case 193:this.$=SG(v[A-1],Jn(v[A].substr(1)));break;case 194:this.$=ao(v[A-2],v[A]);break;case 195:case 204:this.$=ao(v[A],QF);break;case 196:case 205:this.$=ao(v[A],JF);break;case 197:case 206:this.$=ao(Jn(v[A]),ZF);break;case 200:this.$=ao(v[A].toLowerCase(),_G);break;case 201:this.$=ao(v[A].substr(1),QF);break;case 202:this.$=ao(v[A].substr(1),JF);break;case 203:this.$=ao(v[A].substr(1).toLowerCase(),ZF);break;case 207:case 208:this.$=nD(v[A],1);break;case 209:case 210:this.$=nD(v[A],3);break;case 211:this.$=it.factory.namedNode(Rp(v[A]));break;case 213:var Yg=v[A].indexOf(":"),Op=v[A].substr(0,Yg),Xg=it.prefixes[Op];if(!Xg)throw new Error("Unknown prefix: "+Op);var fr=Rp(Xg+v[A].substr(Yg+1));this.$=it.factory.namedNode(fr);break;case 214:if(v[A]=v[A].substr(0,v[A].length-1),!(v[A]in it.prefixes))throw new Error("Unknown prefix: "+v[A]);var fr=Rp(it.prefixes[v[A]]);this.$=it.factory.namedNode(fr);break;case 215:this.$=Cp(v[A].replace(/^(_:)/,""));break;case 216:this.$=Cp();break;case 217:case 218:case 232:this.$=xp(JE(v[A-3],v[A-2],v[A-1]));break;case 230:case 231:this.$=xp(v[A-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:v[A-1].push(v[A]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[v[A]];break;case 308:v[A-3].push(v[A-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:v[A-2].push(v[A-1]);break}},"anonymous"),table:[r(e,t,{3:1,4:2,10:3}),{1:[3]},r(n,[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}),r([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]},r(c,[2,411],{216:28,217:29}),r(l,[2,249],{18:30}),r(l,[2,251],{22:31}),r(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:p,139:38,307:43,308:h,323:36},r(l,[2,267],{37:46}),r(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:m,87:p},r(b,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),r(e,[2,248]),r(e,[2,245]),r(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]},r([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]}),r(_,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:S,29:I,52:84,53:E,56:85},{19:88,28:S,29:I,52:89,53:E,56:85},r(l,[2,253],{26:90}),{28:[1,91],52:92,53:E},r(w,[2,385],{181:93,182:94,183:95,31:[2,383]}),r(R,[2,263],{34:96}),r(R,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:p,308:h}),r(R,[2,262]),r(x,[2,259]),r(O,[2,143]),r(O,[2,144]),r([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]),r(N,[2,211]),r(N,[2,212]),r(N,[2,213]),r(N,[2,214]),{19:98,28:S,29:I,52:99,53:E,56:85},{6:[2,309],99:100,193:[1,101]},r(G,[2,311],{101:102,328:[1,103]}),r(j,[2,317],{104:104,328:[1,105]}),r(ae,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:Y,114:110},{29:Y,114:112},{29:Y,114:113},{118:114,123:[1,115],125:116,126:M},r(ce,[2,315]),r(ce,[2,316]),r(q,[2,319]),r(q,[2,320]),r(q,[2,321]),r(g,[2,327]),{13:f,16:d,55:118,307:43,308:h},r(l,[2,12]),r(l,[2,13],{44:66,43:119,45:m,87:p}),r(oe,[2,269]),r(oe,[2,15]),{13:f,16:d,44:136,45:X,46:120,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(b,[2,14]),r(b,[2,274]),r(b,[2,271]),r(b,[2,272]),r(e,[2,4]),{13:[1,177]},r(Ee,[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},r(c,[2,410]),r([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:Vt,219:189,220:190,223:191,224:[1,192],307:43,308:h},r(_,[2,419]),r(Yt,tt,{20:196,59:197,69:198,70:he}),r(l,[2,250]),{29:me,57:200},r(G,[2,279],{54:202,327:[1,203]}),{29:[2,282]},r(be,we,{23:204,58:205,62:206,63:Qe}),r(l,[2,252]),{19:208,28:S,29:I,52:209,53:E,56:85},{29:[1,210]},r(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:Et,55:220,82:J,87:p,89:vt,145:212,172:221,185:213,187:214,231:un,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(SF,[2,265],{56:85,35:227,52:228,19:229,28:S,29:I,53:E}),r(x,[2,260]),r(be,we,{58:205,62:206,23:230,63:Qe}),r(l,[2,268]),{6:[2,45]},r(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:h},r(G,[2,312]),{105:233,112:wF,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},r(j,[2,318]),r(G,EF,{108:240,133:242,112:vF,132:TF}),r(ae,[2,323]),{112:[1,244]},{112:[2,325]},r(fn,[2,50]),r(w,Og,{135:245,136:246,143:247,144:248,31:AF,112:AF}),r(fn,[2,51]),r(fn,[2,52]),r(ic,[2,328],{119:249}),{29:Y,114:250},r(ic,[2,56]),{29:Y,114:251},r(g,[2,59]),r(oe,[2,270]),{47:[1,252]},r(IF,[2,150]),r(Fg,[2,428],{240:253}),r(Du,[2,430],{244:254}),r(Du,[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]}),r(Lu,[2,440],{252:264}),r(Kr,[2,448],{260:265}),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,255:154,257:155,264:266,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,255:154,257:155,264:267,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,255:154,257:155,264:268,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Kr,[2,167]),r(Kr,[2,168]),r(Kr,[2,169]),r(Kr,[2,170],{176:269,45:RF,89:CF}),r(Kr,[2,171]),r(Kr,[2,172]),r(Kr,[2,173]),r(Kr,[2,174]),{13:f,16:d,44:136,45:X,46:272,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ir,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:xF,89:PF,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},r(Qn,[2,192],{292:[1,286],293:[1,287]}),r(Qn,[2,195]),r(Qn,[2,196]),r(Qn,[2,197]),r(Qn,[2,198]),r(Qn,[2,199]),r(Qn,[2,200]),{13:f,16:d,44:39,55:40,82:J,87:p,139:289,172:291,255:154,257:155,266:290,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},r(vp,[2,452]),r(vp,[2,453]),r(vp,[2,454]),r(vp,[2,455]),r(vp,[2,456]),{279:[2,458]},r(Dg,[2,207]),r(Dg,[2,208]),r(Dg,[2,209]),r(Dg,[2,210]),r(Qn,[2,201]),r(Qn,[2,202]),r(Qn,[2,203]),r(Qn,[2,204]),r(Qn,[2,205]),r(Qn,[2,206]),r(e,[2,5]),r(Lg,[2,297],{88:295}),r(Ng,[2,299],{90:296}),{48:[1,297],87:[1,298]},r(kg,[2,301]),r(Ee,[2,43]),r(Ee,[2,82]),r(Ee,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},r(c,[2,412]),r(ol,[2,123]),r(ol,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),r(so,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:Vt,223:312,225:308,226:309,229:OF,307:43,308:h},r(c,i,{215:10,214:314}),r(so,[2,236]),r(so,[2,237]),r(Nu,[2,6]),r(BE,[2,287],{60:315,72:316,73:[1,317]}),r(Yt,[2,286]),{13:f,16:d,45:X,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,307:43,308:h,346:nt,347:et,348:C,349:P,350:D,351:V},r([6,31,63,70,73,81,83,85],[2,20]),r(w,FF,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:zo,31:zo,85:zo,112:zo,159:zo,160:zo,161:zo,163:zo,164:zo,41:s}),{13:f,16:d,55:331,307:43,308:h},r(G,[2,280]),r(Nu,[2,7]),r(Yt,tt,{59:197,69:198,20:332,70:he}),r(be,[2,284]),{64:[1,333]},r(be,we,{58:205,62:206,23:334,63:Qe}),r(l,[2,254]),r(w,Og,{144:248,30:335,143:336,31:[2,257]}),r(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:p,139:342,186:339,190:340,195:341,197:al,307:43,308:h},r(Tp,[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:p,197:al,308:h}),r(Ho,[2,227]),r(Ho,[2,228]),r(Ho,[2,229]),{13:f,16:d,44:215,45:Et,55:220,82:J,87:p,89:vt,172:221,185:351,187:350,200:348,230:347,231:un,234:349,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},{13:f,16:d,44:39,55:40,87:p,139:342,186:352,190:340,195:341,197:al,307:43,308:h},r(Ho,[2,146]),r(Ho,[2,147]),r(Ho,[2,148]),r(Ho,[2,149]),{13:f,16:d,44:354,55:355,82:J,87:p,172:357,237:356,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:358,312:Xn,313:353},r(VE,[2,215]),r(VE,[2,216]),r(be,we,{58:205,62:206,23:359,63:Qe}),r(R,[2,264]),r(SF,[2,266]),r(Nu,[2,11]),r(n,[2,308],{6:[2,310]}),r(fn,[2,313],{102:360,120:361,121:[1,362]}),r(fn,[2,47]),r(fn,[2,63]),r(fn,[2,64]),{13:f,16:d,55:363,307:43,308:h},r(fn,[2,336]),r(fn,[2,337]),r(fn,[2,338]),{109:[1,364]},r(DF,[2,60]),{13:f,16:d,55:365,307:43,308:h},r(G,[2,335]),{13:f,16:d,55:366,307:43,308:h},{31:[1,367]},r(cl,[2,341],{137:368}),r(cl,[2,340]),{13:f,16:d,44:215,45:Et,55:220,82:J,87:p,89:vt,145:369,172:221,185:213,187:214,231:un,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},{28:[1,370],127:371,128:[1,372]},r(ic,[2,330],{124:373,125:374,126:M}),r(ic,[2,57]),{44:375,87:p},r(IF,[2,151],{241:376,242:[1,377]}),r(Fg,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,247:380,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{250:[1,381]},r(Rr,[2,432]),r(Rr,[2,433]),r(Rr,[2,434]),r(Rr,[2,435]),r(Rr,[2,436]),r(Rr,[2,437]),{250:[2,439]},r([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:H,298:le,299:Se,300:Ce,301:Ge,302:Ne}),r(Lu,[2,162],{261:388,262:389,39:GE,338:qE}),r(Kr,[2,164]),r(Kr,[2,165]),r(Kr,[2,166]),r(Ir,[2,95]),r(Ir,[2,96]),r(Rr,[2,377],{177:392,325:[1,393]}),{48:[1,394]},r(Ir,[2,177]),{13:f,16:d,44:136,45:X,46:395,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:396,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:397,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:398,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:399,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ir,[2,183]),r(Ir,[2,98]),r(Rr,[2,381],{180:400}),{87:[1,401]},r(Ir,[2,185]),{13:f,16:d,44:136,45:X,46:402,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{29:me,57:403},r(Qn,[2,193]),{13:f,16:d,55:404,307:43,308:h},{13:f,16:d,44:39,55:40,87:p,139:342,195:405,197:al,307:43,308:h},r(sc,[2,233]),r(sc,[2,234]),r(sc,[2,235]),r(LF,[2,459],{281:406,325:[1,407]}),r(Rr,[2,463],{284:408,325:[1,409]}),r(Rr,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:J,171:413,172:415,173:416,174:Mg,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:jg},{31:[1,419],89:[1,420]},{29:[1,421]},r(kg,[2,302]),r(Lg,[2,367],{167:422}),r(Ng,[2,369],{168:423}),{48:[1,424],87:[1,425]},r(kg,[2,371]),r(ol,[2,122]),r(ol,[2,417]),r(ol,[2,413]),r(ol,[2,414]),r(ol,[2,415]),r(so,[2,125]),r(so,[2,127]),r(so,[2,128]),r(NF,[2,420],{227:426}),r(so,[2,130]),{13:f,16:d,55:194,197:Vt,223:427,307:43,308:h},{48:[1,428]},r(oc,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),r(BE,[2,288]),{64:[1,433]},r(Yt,[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:X,268:W,269:ee,270:K,271:ie,273:Pe,274:$,276:fe,277:se,279:Ae,280:ge,283:ve,285:Re,308:h,346:nt,347:et,348:C,349:P,350:D,351:V}),r(kF,[2,293]),r(WE,[2,92]),r(WE,[2,93]),r(WE,[2,94]),{45:RF,89:CF,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:S,29:I,56:85},{19:438,28:S,29:I,56:85},r(ll,[2,355],{149:439}),r(ll,[2,354]),{13:f,16:d,44:215,45:$g,55:220,82:J,87:p,89:vt,156:440,172:221,185:441,203:442,231:Ug,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(R,[2,19]),r(oc,[2,21]),{13:f,16:d,44:450,45:MF,55:323,65:445,66:446,67:447,68:448,87:p,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,307:43,308:h,346:nt,347:et,348:C,349:P,350:D,351:V},r(Nu,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},r(w,[2,386],{31:[2,388]}),r(Tp,[2,102]),r(ul,[2,391],{191:452}),r(w,[2,395],{196:453,198:454}),r(w,[2,108]),r(w,[2,109]),r(Tp,[2,103]),r(Tp,[2,104]),r(Tp,[2,390]),{13:f,16:d,44:215,45:Et,48:[1,455],55:220,82:J,87:p,89:vt,172:221,185:351,187:350,200:456,231:un,234:349,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(Bg,[2,424]),r(jF,[2,136]),r(jF,[2,137]),r(zE,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:p,139:342,195:458,197:al,307:43,308:h},r(sc,[2,219]),r(sc,[2,220]),r(sc,[2,221]),r(sc,[2,222]),r(sc,[2,223]),r(Nu,[2,10]),r(fn,[2,46]),r(fn,[2,314]),{112:wF,122:459},r(fn,[2,62]),r(G,EF,{133:242,108:460,112:vF,132:TF}),r(DF,[2,61]),r(fn,[2,49]),r([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},r(cl,[2,351],{146:463,335:[1,464]}),{29:me,57:465},r(ic,[2,329]),r(G,[2,332],{129:466,327:[1,467]}),r(ic,[2,55]),r(ic,[2,331]),{48:[1,468]},r(Fg,[2,429]),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Du,[2,431]),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,243:470,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Du,[2,156]),{45:xF,89:PF,179:471},r(Lu,[2,441]),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,251:472,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Kr,[2,444],{256:473}),r(Kr,[2,446],{258:474}),r(Rr,[2,442]),r(Rr,[2,443]),r(Kr,[2,449]),{13:f,16:d,44:136,45:X,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,255:154,257:155,259:475,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Rr,[2,450]),r(Rr,[2,451]),r(Rr,[2,379],{178:476}),r(Rr,[2,378]),r([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:X,46:482,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{48:[1,483]},{48:[1,484]},r(Ir,[2,187]),r(Qn,[2,194]),{13:f,16:d,44:39,55:40,82:J,87:p,139:289,172:291,255:154,257:155,266:290,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,320:485},{13:f,16:d,39:[1,487],44:136,45:X,46:488,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,282:486,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(LF,[2,460]),{13:f,16:d,44:136,45:X,46:489,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Rr,[2,464]),{13:f,16:d,44:136,45:X,46:490,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Rr,[2,466]),r(Ee,[2,40]),r(Lg,[2,298]),r(Ap,[2,87]),r(Ap,[2,88]),r(Ap,[2,89]),r(Ap,[2,90]),{13:f,16:d,55:492,82:J,172:493,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,311:494,312:Xn,315:491},r(Ee,[2,41]),r(Ng,[2,300]),r(Ip,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:J,171:497,172:415,173:416,174:Mg,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:jg},{31:[1,498],89:[1,499]},{29:[1,500]},r(kg,[2,372]),{13:f,16:d,48:[2,422],55:194,197:Vt,223:312,226:502,228:501,229:OF,307:43,308:h},r(so,[2,131]),r(so,[2,126]),r(oc,[2,22]),r(oc,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:X,55:323,67:321,68:322,74:505,75:506,76:$F,77:320,78:UF,79:509,87:p,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,307:43,308:h,346:nt,347:et,348:C,349:P,350:D,351:V},r(kF,[2,294]),r(BF,[2,69]),r(BF,[2,70]),r(Yt,tt,{59:197,69:198,20:511,70:he}),r(be,we,{58:205,62:206,23:512,63:Qe}),{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},r(ll,[2,363],{157:524,335:[1,525]}),r(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:p}),r(Vg,[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:p}),{13:f,16:d,44:215,45:$g,55:220,82:J,87:p,89:vt,172:221,185:351,203:536,212:534,231:Ug,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:p}),r(be,[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:MF,87:p,268:W,269:ee,270:K,271:ie,273:Pe,274:$,276:fe,277:se,279:Ae,280:ge,283:ve,285:Re,308:h,346:nt,347:et,348:C,349:P,350:D,351:V}),r(fl,[2,291]),r(fl,[2,24]),r(fl,[2,25]),{13:f,16:d,44:136,45:X,46:539,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(fl,[2,28]),r(be,we,{58:205,62:206,23:540,63:Qe}),r([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),r(ul,[2,107]),{13:f,16:d,44:215,45:Et,55:220,82:J,87:p,89:vt,172:221,185:351,187:350,199:543,200:544,231:un,234:349,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(VF,[2,132]),r(Bg,[2,425]),r(VF,[2,133]),{13:f,16:d,44:354,55:355,82:J,87:p,172:357,237:356,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:358,312:Xn,313:545},r(fn,[2,54]),r(fn,[2,48]),r(cl,[2,342]),{13:f,16:d,44:39,55:40,87:p,139:546,307:43,308:h},r(cl,[2,68]),r(w,[2,350],{31:GF,112:GF}),r(fn,[2,53]),{13:f,16:d,55:547,307:43,308:h},r(G,[2,333]),r(oe,[2,16]),r(Fg,[2,152]),r(Du,[2,154]),r(Du,[2,157]),r(Lu,[2,159]),r(Lu,[2,160],{262:389,261:548,39:GE,338:qE}),r(Lu,[2,161],{262:389,261:549,39:GE,338:qE}),r(Kr,[2,163]),{13:f,16:d,44:136,45:X,46:550,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ir,[2,178]),r(Ir,[2,179]),{13:f,16:d,44:136,45:X,46:551,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:552,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:553,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{48:[1,554],272:[1,555]},r(Ir,[2,184]),r(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:Vt,223:562,307:43,308:h},r(HE,[2,224]),r(HE,[2,225]),r(HE,[2,226]),{31:[1,563],45:qF,94:564},r(Ee,[2,84]),r(Lg,[2,368]),r(Ee,[2,85]),r(Ng,[2,370]),r(Ip,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},r(oc,[2,35],{83:[1,569]}),r(oc,[2,36],{81:[1,570]}),r(BE,[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:X,76:$F,78:UF,87:p,268:W,269:ee,270:K,271:ie,273:Pe,274:$,276:fe,277:se,279:Ae,280:ge,283:ve,285:Re,308:h,346:nt,347:et,348:C,349:P,350:D,351:V}),r(ku,[2,295]),{45:X,77:572},{45:X,77:573},r(ku,[2,33]),r(ku,[2,34]),{31:[2,275],50:574,84:575,85:o},{31:[2,277],51:576,84:577,85:o},r(ll,[2,356]),r(WF,[2,357],{152:578,335:[1,579]}),r(Ko,[2,74]),{29:me,57:580},{29:me,57:581},{13:f,16:d,44:39,55:40,87:p,139:582,307:43,308:h},r(zF,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:X,55:323,67:321,68:322,77:320,79:585,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,307:43,308:h,346:nt,347:et,348:C,349:P,350:D,351:V},{45:[1,586]},r(Ko,[2,81]),{29:me,57:587},r(ll,[2,73]),r(w,[2,362],{29:Yo,31:Yo,85:Yo,112:Yo,159:Yo,160:Yo,161:Yo,163:Yo,164:Yo}),r(Vg,[2,112]),r(Mu,[2,401],{206:588}),r(w,[2,405],{209:589,210:590}),r(w,[2,403]),r(w,[2,404]),r(Vg,[2,113]),r(Vg,[2,400]),{13:f,16:d,44:215,45:$g,48:[1,591],55:220,82:J,87:p,89:vt,172:221,185:351,203:536,212:592,231:Ug,234:535,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(Bg,[2,426]),r(zE,[2,138]),r(zE,[2,139]),{232:[1,593]},r(fl,[2,292]),{47:[1,595],48:[1,594]},r(Nu,[2,9]),r(ul,[2,392]),r(ul,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:p,197:al,308:h}),r(ul,[2,110],{272:[1,598]}),r(Gg,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},r(ic,[2,58]),r(Kr,[2,445]),r(Kr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},r(Ir,[2,99]),r(Rr,[2,382]),r([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]),r(Ir,[2,188]),r(Ir,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:J,172:493,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,311:494,312:Xn,315:611},r(Ee,[2,42]),r(Ip,[2,304]),{13:f,16:d,55:414,82:J,95:612,171:613,172:415,173:416,174:Mg,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:jg},{31:[1,614],45:qF,94:615},r(so,[2,129]),r(NF,[2,421]),{82:[1,616]},{82:[1,617]},r(ku,[2,296]),r(ku,[2,31]),r(ku,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},r(w,FF,{155:330,153:618,154:619,29:Xo,31:Xo,85:Xo,112:Xo,159:Xo,160:Xo,161:Xo,163:Xo,164:Xo}),r(WF,[2,358]),r(Ko,[2,75]),r(Ko,[2,76]),{29:me,57:620},{13:f,16:d,44:39,55:40,87:p,139:621,307:43,308:h},r(zF,[2,366]),r(Ko,[2,79]),{13:f,16:d,44:136,45:X,46:622,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ko,[2,91],{336:[1,623]}),r([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),r(Mu,[2,117]),{13:f,16:d,44:215,45:$g,55:220,82:J,87:p,89:vt,172:221,185:351,203:536,211:626,212:627,231:Ug,234:535,236:216,237:222,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,309:Si,310:Bi,311:217,312:Xn},r(Ho,[2,134]),r(Bg,[2,427]),r(Ho,[2,135]),r(fl,[2,26]),{44:628,87:p},r(ul,[2,106]),r(ul,[2,394]),r(w,[2,396]),r(Gg,[2,111]),r(Gg,[2,398]),{13:f,16:d,44:39,55:40,87:p,139:342,186:629,190:340,195:341,197:al,307:43,308:h},r(VE,[2,217]),r(w,Og,{144:248,140:630,143:631,31:[2,343]}),r(Ir,[2,97]),r(Rr,[2,380]),r(Ir,[2,180]),{13:f,16:d,44:136,45:X,46:632,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},{13:f,16:d,44:136,45:X,46:633,55:133,67:132,68:134,77:131,82:J,87:p,172:135,224:ye,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:ze,264:130,265:Z,266:137,267:139,268:W,269:ee,270:K,271:ie,273:Pe,274:$,275:146,276:fe,277:se,278:149,279:Ae,280:ge,283:ve,285:Re,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:Ze,346:nt,347:et,348:C,349:P,350:D,351:V},r(Ir,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:J,171:637,172:415,173:416,174:Mg,255:154,257:155,291:150,294:de,295:U,296:F,297:H,298:le,299:Se,300:Ce,301:Ge,302:Ne,303:ke,304:qe,305:xe,306:Be,307:43,308:h,312:jg},r(HF,[2,305]),r(Ee,[2,86]),r(Ip,[2,374]),r(oc,[2,37]),r(oc,[2,38]),r(ll,[2,72]),r(ll,[2,360]),r(Ko,[2,77]),{29:me,57:638},{47:[1,639]},{29:[2,376]},r(Mu,[2,402]),r(Mu,[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:p}),r(Mu,[2,118],{272:[1,641]}),r(qg,[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:ke,304:qe,305:xe,306:Be},r(Ap,[2,218]),r(Ip,[2,44]),r(HF,[2,306]),r(Ko,[2,78]),{44:651,87:p},r(Mu,[2,116]),r(w,[2,406]),r(qg,[2,119]),r(qg,[2,408]),r(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:p}),r(fl,[2,27]),r(Gg,[2,230]),r(KF,[2,345],{141:653,335:[1,654]}),r(Ir,[2,181]),r(Ir,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},r(w,Og,{144:248,142:657,143:658,31:YF,112:YF}),r(KF,[2,346]),r(Ko,[2,80]),r(qg,[2,231]),r(cl,[2,67]),r(cl,[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(L,B){if(B.recoverable)this.trace(L);else{var te=new Error(L);throw te.hash=B,te}},"parseError"),parse:a(function(L){var B=this,te=[0],Oe=[],Je=[null],v=[],Zn=this.table,A="",co=0,Pp=0,Kg=0,Yg=2,Op=1,Xg=v.slice.call(arguments,1),fr=Object.create(this.lexer),lo={yy:{}};for(var Fp in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Fp)&&(lo.yy[Fp]=this.yy[Fp]);fr.setInput(L,lo.yy),lo.yy.lexer=fr,lo.yy.parser=this,typeof fr.yylloc>"u"&&(fr.yylloc={});var Vu=fr.yylloc;v.push(Vu);var Gt=fr.options&&fr.options.ranges;typeof lo.yy.parseError=="function"?this.parseError=lo.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ir(uo){te.length=te.length-2*uo,Je.length=Je.length-uo,v.length=v.length-uo}a(ir,"popStack");for(var Tt=a(function(){var uo;return uo=fr.lex()||Op,typeof uo!="number"&&(uo=B.symbols_[uo]||uo),uo},"lex"),Ft,wi,ml,rs,Ewe,ov,Gu={},Qg,Zo,aD,Jg;;){if(ml=te[te.length-1],this.defaultActions[ml]?rs=this.defaultActions[ml]:((Ft===null||typeof Ft>"u")&&(Ft=Tt()),rs=Zn[ml]&&Zn[ml][Ft]),typeof rs>"u"||!rs.length||!rs[0]){var av="";Jg=[];for(Qg in Zn[ml])this.terminals_[Qg]&&Qg>Yg&&Jg.push("'"+this.terminals_[Qg]+"'");fr.showPosition?av="Parse error on line "+(co+1)+`:
80
80
  `+fr.showPosition()+`
81
81
  Expecting `+Jg.join(", ")+", got '"+(this.terminals_[Ft]||Ft)+"'":av="Parse error on line "+(co+1)+": Unexpected "+(Ft==Op?"end of input":"'"+(this.terminals_[Ft]||Ft)+"'"),this.parseError(av,{text:fr.match,token:this.terminals_[Ft]||Ft,line:fr.yylineno,loc:Vu,expected:Jg})}if(rs[0]instanceof Array&&rs.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ml+", token: "+Ft);switch(rs[0]){case 1:te.push(Ft),Je.push(fr.yytext),v.push(fr.yylloc),te.push(rs[1]),Ft=null,wi?(Ft=wi,wi=null):(Pp=fr.yyleng,A=fr.yytext,co=fr.yylineno,Vu=fr.yylloc,Kg>0&&Kg--);break;case 2:if(Zo=this.productions_[rs[1]][1],Gu.$=Je[Je.length-Zo],Gu._$={first_line:v[v.length-(Zo||1)].first_line,last_line:v[v.length-1].last_line,first_column:v[v.length-(Zo||1)].first_column,last_column:v[v.length-1].last_column},Gt&&(Gu._$.range=[v[v.length-(Zo||1)].range[0],v[v.length-1].range[1]]),ov=this.performAction.apply(Gu,[A,Pp,co,lo.yy,rs[1],Je,v].concat(Xg)),typeof ov<"u")return ov;Zo&&(te=te.slice(0,-1*Zo*2),Je=Je.slice(0,-1*Zo),v=v.slice(0,-1*Zo)),te.push(this.productions_[rs[1]][0]),Je.push(Gu.$),v.push(Gu._$),aD=Zn[te[te.length-2]][te[te.length-1]],te.push(aD);break;case 3:return!0}}return!0},"parse")},Wg=xT().Wildcard,zg="http://www.w3.org/1999/02/22-rdf-syntax-ns#",gG=zg+"type",yG=zg+"first",bG=zg+"rest",XF=zg+"nil",Hg="http://www.w3.org/2001/XMLSchema#",QF=Hg+"integer",JF=Hg+"decimal",ZF=Hg+"double",_G=Hg+"boolean",dl="",eD="",tD="";function Jn(k){return k.toLowerCase()}a(Jn,"lowercase");function Qo(k,L){return k.push(L),k}a(Qo,"appendTo");function pl(k,L){return k.push.apply(k,L),k}a(pl,"appendAllTo");function _r(k){k||(k={});for(var L=1,B=arguments.length,te;L<B&&(te=arguments[L]||{});L++)for(var Oe in te)k[Oe]=te[Oe];return k}a(_r,"extend");function oo(){for(var k=[],L=0,B=arguments.length;L<B;L++)k=k.concat.apply(k,arguments[L]);return k}a(oo,"unionAll");function Rp(k){if(k[0]==="<"&&(k=k.substring(1,k.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(k))return k;if(!it.base)throw new Error("Cannot resolve relative IRI "+k+" because no base IRI was set.");switch(dl!==it.base&&(dl=it.base,eD=dl.replace(/[^\/:]*$/,""),tD=dl.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),k[0]){case void 0:return dl;case"#":return dl+k;case"?":return dl.replace(/(?:\?.*)?$/,k);case"/":return tD+k;default:return eD+k}}a(Rp,"resolveIRI");function YE(k){if(k){var L=k[0];if(L==="?"||L==="$")return it.factory.variable(k.substr(1))}return k}a(YE,"toVar");function dn(k,L){return{type:"operation",operator:k,args:L||[]}}a(dn,"operation");function ju(k,L){var B={expression:k==="*"?new Wg:k};if(L)for(var te in L)B[te]=L[te];return B}a(ju,"expression");function $u(k,L){return{type:"path",pathType:k,items:L}}a($u,"path");function XE(k,L){for(var B=0,te=L.length,Oe;B<te&&(Oe=L[B]);B++)k=dn(Oe[0],[k,Oe[1]]);return k}a(XE,"createOperationTree");function hl(k,L){var B=[],te=[],Oe=k.length,Je,v={};if(!Oe)return null;for(var Zn=0;Zn<Oe&&(Je=k[Zn]);Zn++)(Je.named?te:B).push(Je.iri);return v[L||"from"]={default:B,named:te},v}a(hl,"groupDatasets");function Uu(k){return parseInt(k,10)}a(Uu,"toInt");function QE(k){return k.type==="group"&&k.patterns.length===1?k.patterns[0]:k}a(QE,"degroupSingle");function ao(k,L){return L&&L.termType!=="NamedNode"&&(L=it.factory.namedNode(L)),it.factory.literal(k,L)}a(ao,"createTypedLiteral");function SG(k,L){return it.factory.literal(k,L)}a(SG,"createLangLiteral");function JE(k,L,B){if(!("termType"in L))throw new Error("Nested triples cannot contain paths");return it.factory.quad(k,L,B)}a(JE,"nestedTriple");function Jo(k,L,B,te){var Oe={};return k!=null&&(Oe.subject=k),L!=null&&(Oe.predicate=L),B!=null&&(Oe.object=B),te!=null&&(Oe.annotations=te),Oe}a(Jo,"triple");function Cp(k){return typeof k=="string"?k.startsWith("e_")?it.factory.blankNode(k):it.factory.blankNode("e_"+k):it.factory.blankNode("g_"+rD++)}a(Cp,"blank");var rD=0;it._resetBlanks=function(){rD=0};var wG=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,EG={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
82
82
  `,r:"\r",f:"\f"},vG=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,ZE=String.fromCharCode;function nD(k,L){k=k.substring(L,k.length-L);try{k=k.replace(wG,function(B,te,Oe,Je){var v;if(te){if(v=parseInt(te,16),isNaN(v))throw new Error;return ZE(v)}else if(Oe){if(v=parseInt(Oe,16),isNaN(v))throw new Error;return v<65535?ZE(v):ZE(55296+((v-=65536)>>10),56320+(v&1023))}else{var Zn=EG[Je];if(!Zn)throw new Error;return Zn}})}catch{return""}if(vG.exec(k))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+k);return k}a(nD,"unescapeString");function TG(k){var L=Cp(),B=L,te=[],Oe,Je=[];k.forEach(function(co){te.push(co.entity),pl(Je,co.triples)});for(var v=0,Zn=0,A=te.length,Oe=Array(A*2);v<A;)Oe[Zn++]=Jo(B,it.factory.namedNode(yG),te[v]),Oe[Zn++]=Jo(B,it.factory.namedNode(bG),B=++v<A?Cp():it.factory.namedNode(XF));return{entity:L,triples:pl(Oe,Je)}}a(TG,"createList");function AG(k){var L=Cp();return{entity:L,triples:k.map(function(B){return _r(Jo(L),B)})}}a(AG,"createAnonymousObject");function ev(k,L,B){var te=[],Oe=[];return L.forEach(function(Je){let v=null;Je.annotation&&(v=Je.annotation,Je=Je.object),te.push(Jo(null,k,Je.entity,v)),pl(Oe,Je.triples)}),oo(te,B||[],Oe)}a(ev,"objectListToTriples");function Swe(k){for(var L=[],B,te=0,Oe;Oe=k[te];te++)Oe.type==="bgp"?Oe.triples.length&&(B?pl(B.triples,Oe.triples):Qo(L,B=Oe)):(!Oe.patterns||Oe.patterns.length>0)&&(Qo(L,Oe),B=null);return L}a(Swe,"mergeAdjacentBGPs");function Bu(k){return k.variable?k.variable.value:k.value||k.expression.value}a(Bu,"getExpressionId");function tv(k){if(!k)return[];if(k.type==="aggregate")return[k];if(k.type==="operation"){let L=[];for(let B of k.args)L.push(...tv(B));return L}return[]}a(tv,"getAggregatesOfExpression");function IG(k){let L=new Set,B=a(function(te){te&&(te.termType==="Variable"?L.add(te):te.type==="operation"&&te.args.forEach(B))},"visitExpression");return B(k),L}a(IG,"getVariablesFromExpression");function rv(k,L=1,B=[]){for(let te of k)L>0&&te instanceof Array?rv(te,L-1,B):B.push(te);return B}a(rv,"flatten");function nv(k){return k.termType==="Variable"}a(nv,"isVariable");function iD(k){if(k.triples){let L=[];for(let B of k.triples)nv(B.subject)&&L.push(B.subject.value),nv(B.predicate)&&L.push(B.predicate.value),nv(B.object)&&L.push(B.object.value);return L}else if(k.patterns){let L=[];for(let B of k.patterns)L.push(...iD(B));return L}return[]}a(iD,"getBoundVarsFromGroupGraphPattern");function RG(k){let L=k.slice().sort(),B=[];for(let te=0;te<L.length-1;te++)L[te+1]==L[te]&&B.push(L[te]);return B}a(RG,"getDuplicatesInArray");function xp(k){if(!it.sparqlStar)throw new Error("SPARQL-star support is not enabled");return k}a(xp,"ensureSparqlStar");function sD(k,L,B){for(let te of L){let Oe=Jo("subject"in te?te.subject:k,te.predicate,te.object);B.push(Oe),te.annotations&&sD(JE(k,te.predicate,te.object),te.annotations,B)}}a(sD,"_applyAnnotations");function iv(k){if(it.sparqlStar){let L=[];return k.forEach(B=>{let te=Jo(B.subject,B.predicate,B.object);L.push(te),B.annotations&&sD(JE(B.subject,B.predicate,B.object),B.annotations,L)}),L}return k}a(iv,"applyAnnotations");function wwe(k){if(!it.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return k}a(wwe,"ensureSparqlStarNestedQuads");function oD(k){for(let L of k){if(L.type==="graph"&&L.name.termType==="Variable")throw new Error("Detected illegal variable in GRAPH");if(L.type==="bgp"||L.type==="graph"){for(let B of L.triples)if(B.subject.termType==="Variable"||B.predicate.termType==="Variable"||B.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return k}a(oD,"ensureNoVariables");function sv(k){for(let L of k)if(L.type==="bgp"){for(let B of L.triples)if(B.subject.termType==="BlankNode"||B.predicate.termType==="BlankNode"||B.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return k}a(sv,"ensureNoBnodes");var CG=(function(){var k={EOF:1,parseError:a(function(B,te){if(this.yy.parser)this.yy.parser.parseError(B,te);else throw new Error(B)},"parseError"),setInput:a(function(L,B){return this.yy=B||this.yy||{},this._input=L,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 L=this._input[0];this.yytext+=L,this.yyleng++,this.offset++,this.match+=L,this.matched+=L;var B=L.match(/(?:\r\n?|\n).*/g);return B?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),L},"input"),unput:a(function(L){var B=L.length,te=L.split(/(?:\r\n?|\n)/g);this._input=L+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-B),this.offset-=B;var Oe=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),te.length-1&&(this.yylineno-=te.length-1);var Je=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:te?(te.length===Oe.length?this.yylloc.first_column:0)+Oe[Oe.length-te.length].length-te[0].length:this.yylloc.first_column-B},this.options.ranges&&(this.yylloc.range=[Je[0],Je[0]+this.yyleng-B]),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).
@@ -113,7 +113,7 @@ ${n}}`}default:throw new Mf(`Unsupported operation type for SPARQL generation: $
113
113
  `)}generateTriple(e){let t=this.generateElement(e.subject),n=this.generatePredicate(e.predicate),i=this.generateElement(e.object);return`${t} ${n} ${i}`}generatePredicate(e){return"pathType"in e?this.generatePropertyPath(e):this.generateElement(e)}generatePropertyPath(e){let t=e.items.map(n=>"pathType"in n?`(${this.generatePropertyPath(n)})`:`<${n.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 n=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`;return e.language?n+=`@${e.language}`:e.datatype&&(n+=`^^<${e.datatype}>`),n}case"blank":return`_:${e.value}`;default:throw new Mf(`Unknown element type: ${e.type}`)}}generateValues(e,t){let n=" ".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`${n}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`${n}VALUES (${i}) {
114
114
  ${s.map(o=>`${n} ${o}`).join(`
115
115
  `)}
116
- ${n}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let n=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?n+=`@${e.language}`:e.datatype&&(n+=`^^<${e.datatype}>`),n}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(n=>this.generateExpression(n)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),n=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${n})`:`${t} IN (${n})`}default:throw new Mf(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let n of e.triples)this.collectVariablesFromTriple(n,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 n of e.variables)t.add(n);break;case"project":for(let n of e.variables)t.add(n);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 n of e.variables)t.add(n);for(let n of e.aggregates)t.add(n.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 n of e.operands)this.collectVariablesFromExpression(n,t);break;case"function":case"functionCall":for(let n of e.args)this.collectVariablesFromExpression(n,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let n of e.list)this.collectVariablesFromExpression(n,t);break}}};jf.SPARQLGenerator=GA});var Uf=T(Pi=>{"use strict";var YQ=Pi&&Pi.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),XQ=Pi&&Pi.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Tk=Pi&&Pi.__importStar||(function(){var r=a(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&YQ(t,e,n[i]);return XQ(t,e),t}})();Object.defineProperty(Pi,"__esModule",{value:!0});Pi.QueryExecutor=Pi.ExoQLQueryExecutor=Pi.QueryExecutorError=void 0;var QQ=fA(),JQ=eb(),ZQ=PA(),eJ=FA(),tJ=lk(),rJ=fk(),nJ=mk(),iJ=UA(),sJ=yk(),oJ=_k(),aJ=Ek(),cJ=vk(),lJ=De(),uJ=He(),fJ=H0(),Sn="http://www.w3.org/2001/XMLSchema#",dJ=new Set([`${Sn}integer`,`${Sn}decimal`,`${Sn}float`,`${Sn}double`,`${Sn}nonPositiveInteger`,`${Sn}negativeInteger`,`${Sn}long`,`${Sn}int`,`${Sn}short`,`${Sn}byte`,`${Sn}nonNegativeInteger`,`${Sn}unsignedLong`,`${Sn}unsignedInt`,`${Sn}unsignedShort`,`${Sn}unsignedByte`,`${Sn}positiveInteger`]),$f=class extends Error{static{a(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};Pi.QueryExecutorError=$f;var cb=class{static{a(this,"ExoQLQueryExecutor")}constructor(e,t={}){let n=t.resolveClassHierarchy===!1?e:new aJ.ClassHierarchyResolvingStore(e);this.tripleStore=n,this.bgpExecutor=new QQ.BGPExecutor(n),this.filterExecutor=new JQ.FilterExecutor,this.optionalExecutor=new ZQ.OptionalExecutor,this.unionExecutor=new eJ.UnionExecutor,this.minusExecutor=new tJ.MinusExecutor,this.valuesExecutor=new rJ.ValuesExecutor,this.aggregateExecutor=new nJ.AggregateExecutor,this.constructExecutor=new iJ.ConstructExecutor,this.serviceExecutor=new sJ.ServiceExecutor(t.serviceConfig),this.graphExecutor=new oJ.GraphExecutor(n),this.sparqlGenerator=new cJ.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(i,s)=>this.evaluateExistsPattern(i,s)),this.filterExecutor.setTripleStore(n)}async evaluateExistsPattern(e,t){let n=this.substituteVariables(e,t);for await(let i of this.execute(n))if(t.merge(i)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let n of this.execute(e))t.push(n);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 $f(`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 n=new Set;for(let o of t)for(let c of o.variables())n.add(c);let i=this.collectOperationVariables(e.right);if([...n].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 n=[];for await(let o of this.execute(e.right))n.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of n)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 n=[];for await(let o of this.execute(e.right))n.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of n)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 n=[];for await(let o of this.execute(e.right))n.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of n)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(()=>Tk(da())),n=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let o of i.variables())if(n.has(o)){let c=i.get(o);c!==void 0&&s.set(o,c)}yield s}}async*executeOrderBy(e){let t=[];for await(let n of this.execute(e.input))t.push(n);t.sort((n,i)=>{for(let s of e.comparators){let o=this.getExpressionValue(s.expression,n),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 n of t)yield n}async*executeSlice(e){let t=0,n=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=n){if(i!==void 0&&t-n>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let n of this.execute(e.input)){let i=this.getSolutionKey(n);t.has(i)||(t.add(i),yield n)}}async*executeReduced(e){let t=new Set;for await(let n of this.execute(e.input)){let i=this.getSolutionKey(n);t.has(i)||(t.add(i),yield n)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let n=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of n)e.having.every(o=>this.filterExecutor.evaluateExpression(o,i)===!0)&&(yield i);else for(let i of n)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let n of this.execute(e.input)){let i=n.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,n):this.evaluateExtendExpression(e.expression,n);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 n of this.execute(e.left))t.push(n);for(let n of t){let i=this.substituteVariables(e.right,n);for await(let s of this.execute(i)){let o=n.merge(s);o!==null&&(yield o)}}}substituteVariables(e,t){let n=JSON.parse(JSON.stringify(e));return this.substituteInOperation(n,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let n=e;return e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(n.input&&(n.input=this.substituteInOperation(n.input,t)),n.left&&(n.left=this.substituteInOperation(n.left,t)),n.right&&(n.right=this.substituteInOperation(n.right,t)),n.pattern&&(n.pattern=this.substituteInOperation(n.pattern,t)),n.query&&(n.query=this.substituteInOperation(n.query,t)),n.where&&(n.where=this.substituteInOperation(n.where,t)),n.expression&&this.substituteInExpression(n.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.type==="variable"&&typeof e.name=="string"){let n=this.termToAlgebraNode(t.get(e.name));if(n!==null){delete e.name;for(let[i,s]of Object.entries(n))e[i]=s}}if(e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let n of e.operands)this.substituteInExpression(n,t);if(e.args)for(let n of e.args)this.substituteInExpression(n,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let n of e.list)this.substituteInExpression(n,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 n=this.termToAlgebraNode(t.get(e.value));if(n!==null)return n}return e}termToAlgebraNode(e){if(e==null)return null;let t=e;return e instanceof lJ.IRI||t.termType==="NamedNode"?{type:"iri",value:e.value}:t.termType==="Literal"||typeof t.value=="string"?{type:"literal",value:t.value,datatype:t.datatype?.value??t._datatype?.value,language:t.language??t._language}:null}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(n,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{n.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(n,i):yield*this.execute(n)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:n}=await Promise.resolve().then(()=>Tk(da()));yield new n;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 n=t.get(e.name);if(!n)return;if(n instanceof uJ.Literal){let i=n.datatype?.value;if(i===`${Sn}dayTimeDuration`)try{return fJ.DateTimeFunctions.parseDayTimeDuration(n.value)}catch{return n.value}if(i&&dJ.has(i)){let s=parseFloat(n.value);if(!Number.isNaN(s))return s}return n.value}return n.value??n.id??String(n)}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 n=e;if(n.type==="bgp"&&n.triples)for(let i of n.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(n.type==="values"&&n.variables)for(let i of n.variables)t.add(i);n.expression&&this.collectVarsFromExpressionTree(n.expression,t),n.type==="extend"&&n.variable&&t.add(n.variable),n.input&&this.collectVarsFromOperation(n.input,t),n.left&&this.collectVarsFromOperation(n.left,t),n.right&&this.collectVarsFromOperation(n.right,t),n.pattern&&this.collectVarsFromOperation(n.pattern,t),n.query&&this.collectVarsFromOperation(n.query,t),n.where&&this.collectVarsFromOperation(n.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let n=e;n.type==="variable"&&t.add(n.value),n.type==="quoted"&&(this.collectVarsFromElement(n.subject,t),this.collectVarsFromElement(n.predicate,t),this.collectVarsFromElement(n.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let n=e;if(n.type==="variable"&&n.name&&t.add(n.name),n.type==="exists"&&n.pattern&&this.collectVarsFromOperation(n.pattern,t),n.left&&this.collectVarsFromExpressionTree(n.left,t),n.right&&this.collectVarsFromExpressionTree(n.right,t),n.operands)for(let i of n.operands)this.collectVarsFromExpressionTree(i,t);if(n.args)for(let i of n.args)this.collectVarsFromExpressionTree(i,t);if(n.expression&&this.collectVarsFromExpressionTree(n.expression,t),n.list)for(let i of n.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 $f("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 $f("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};Pi.ExoQLQueryExecutor=cb;Pi.QueryExecutor=cb});var Lk=T(pa=>{"use strict";var pJ=pa&&pa.__decorate||function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[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},hJ=pa&&pa.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)};Object.defineProperty(pa,"__esModule",{value:!0});pa.CommandResolver=void 0;var mJ=lt(),gJ=ih(),yJ=Ll(),hr=De(),cr=He(),q=qt(),Ak=cc(),Ik=jp(),bJ=sf(),Rk=ca(),_J=CT(),Bf=mv(),Ck=hN(),SJ=mf(),wJ=wf(),EJ=Uf(),Wl=10,lb="exo__Asset",vJ=Wl+1,xk="08cec529-90eb-4d43-88de-ceecccea12b0",TJ=q.Namespace.EXOCMD.term("SubstitutionToken").value,Pk=new Set(["today","tomorrow","todayStart","targetFolder","target","randomUUIDv4","nowTimestamp","nowDate","nowYear","nowMonth","userInputLabel","userInput","targetProperty","targetRefProperty","labelAsArray","groundingTargetClass","createdInstance","targetClassSelf"]);function AJ(r,e){return`__SUBSTITUTE__${r}__${e}__`}a(AJ,"buildSubstitutionMarker");function IJ(r,e,t){let n=(0,bJ.utf8ToBase64)(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`__SUBSTITUTE_P__${r}__${e}__${n}__`}a(IJ,"buildParameterisedMarker");var Ok="3f28af98-c031-4718-8ba2-44ad0b012c52",RJ=q.Namespace.EXOCMD.term("TokenInvocation").value,Fk="29e2c8f8-2d27-4e58-b467-2e85d46f8122",Dk="universal-default-template",qA=class{static{a(this,"CommandResolver")}clearUniversalCache(){this._universalCacheReady=!1,this._universalCacheValue=null}constructor(e,t=gJ.NullLogger){this.tripleStore=e,this.logger=t,this.cache=new Map,this.multiCache=new Map,this._ancestorDepthCache=new Map,this._legacyPropertyDefaultsWarnedGroundings=new Set,this._fallbackWarnedKeys=new Set,this._universalCacheReady=!1,this._universalCacheValue=null}async resolveForAssetMulti(e,t,n){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${n??""}`,o=this.multiCache.get(s);if(o)return o;let c=n?await this.expandPrototypeChain(n):void 0,l=await this.expandClassHierarchy(t),u=new Map;for(let[h,g]of l){let m=await this.resolveForAsset(e,h,c);for(let b of m){let _=this.getBindingPriority(b.binding)===2?g:0,S=u.get(b.binding.id);(!S||_<S.depth)&&u.set(b.binding.id,{rc:b,depth:_})}}let f=new Set;for(let{rc:h}of u.values())if(h.binding.overrides)for(let g of h.binding.overrides)f.add(g);let d=Array.from(u.entries()).filter(([h])=>!f.has(h)).map(([,h])=>h);d.sort((h,g)=>{let m=this.getBindingPriority(h.rc.binding),b=this.getBindingPriority(g.rc.binding);return m!==b?m-b:h.depth!==g.depth?h.depth-g.depth:(h.rc.binding.order??100)-(g.rc.binding.order??100)});let p=d.map(h=>h.rc);return this.multiCache.set(s,p),p}async expandClassHierarchy(e){let t=new Map;for(let c of e){if(c===lb){t.set(c,new Set);continue}let l=[];try{l=await this.getClassAncestors(c)}catch{l=[]}t.set(c,new Set(l))}let n=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=>!n(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===lb)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(lb)||s.set(lb,vJ),s}async resolveForAsset(e,t,n){let i=typeof n=="string"?`s:${n}`:n?`c:${n.join("\0")}`:"",s=`${e}:${t}:${i}`,o=this.cache.get(s);if(o)return o;let c=typeof n=="string"?await this.expandPrototypeChain(n):n,l=await this.findBindings(t,c,e),u=[];for(let f of l){let d=await this.loadCommand(f.commandRef,{targetClass:f.targetClass});if(!d)continue;let p=f.precondition?{...d,precondition:f.precondition}:d;u.push({command:p,binding:f})}return u.sort((f,d)=>{let p=this.getBindingPriority(f.binding),h=this.getBindingPriority(d.binding);return p!==h?p-h:(f.binding.order??100)-(d.binding.order??100)}),this.cache.set(s,u),u}async loadCommand(e,t){let n=await this.findSubjectByUID(e);if(!n||(await this.tripleStore.match(n,q.Namespace.RDF.term("type"),q.Namespace.EXOCMD.term("Command"))).length===0)return null;let s=await this.getLiteralValue(n,q.Namespace.EXO.term("Asset_label"))??"Unknown Command",o=await this.getLiteralValue(n,q.Namespace.EXOCMD.term("Command_labelTemplate")),c=await this.getLiteralValue(n,q.Namespace.EXOCMD.term("Command_icon")),l=await this.getLiteralValue(n,q.Namespace.EXOCMD.term("Command_confirmMessage")),u=await this.getLiteralValue(n,q.Namespace.EXOCMD.term("Command_successMessage")),f=await this.getLiteralValue(n,q.Namespace.EXOCMD.term("Command_category")),d=await this.getLiteralValue(n,q.Namespace.EXOCMD.term("Command_openInSameTab")),p=d!==null&&String(d).trim().toLowerCase()==="true",h=await this.loadLinkedPrecondition(n),g=await this.loadLinkedGrounding(n,0,t);return g?{id:e,name:s,labelTemplate:o??void 0,icon:c??void 0,precondition:h??void 0,grounding:g,confirmMessage:l??void 0,successMessage:u??void 0,category:f??void 0,openInSameTab:p||void 0}:null}async findBindings(e,t,n){let i=typeof t=="string"?await this.expandPrototypeChain(t):t,s=await this.tripleStore.match(void 0,q.Namespace.RDF.term("type"),q.Namespace.EXOCMD.term("CommandBinding")),o=[];for(let c of s){let l=c.subject,u=await this.loadBindingDefinition(l);u&&this.bindingMatches(u,e,i,n)&&o.push(u)}return o}async findPaletteEnabledCommands(){let e=await this.tripleStore.match(void 0,q.Namespace.RDF.term("type"),q.Namespace.EXOCMD.term("Command")),t=[],n=new Set;for(let i of e){let s=i.subject;if((await this.getLiteralValue(s,q.Namespace.EXOCMD.term("Command_paletteEnabled")))?.toLowerCase()!=="true")continue;let c=await this.getLiteralValue(s,q.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,q.Namespace.EXOCMD.term("Command_paletteId")),f=await this.getLiteralValue(s,q.Namespace.EXOCMD.term("Command_cliName")),d=u??f??c;if(n.has(d)){this.logger.warn(`[CommandResolver] duplicate paletteId "${d}" \u2014 first registration wins, dropping ${c}`);continue}n.add(d),t.push({command:l,paletteId:d})}return t}invalidateCache(){this.cache.clear(),this.multiCache.clear(),this._ancestorDepthCache.clear(),this.clearUniversalCache()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let n=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:o}of i){let c=await this.evaluateSelectSnippet(o,t);n=n.replace(s,c)}return n}extractPlaceholders(e){let t=[],n=0;for(;n<e.length;)if(e[n]==="{"){let i=1,s=n+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let o=e.slice(n,s),c=e.slice(n+1,s-1);t.push({full:o,body:c})}n=s}else n++;return t}async evaluateSelectSnippet(e,t){try{let n=e.replace(/\$target/g,`<${t}>`),s=new SJ.ExoQLParser().parse(n),c=new wJ.ExoQLAlgebraTranslator().translate(s),u=await new EJ.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let p=f.get(d[0]);return p?p instanceof cr.Literal||p instanceof hr.IRI?p.value:String(p):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,q.Namespace.EXO.term("Asset_uid"));if(!t)return null;let n=await this.getLiteralValue(e,q.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,q.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,q.Namespace.EXOCMD.term("CommandBinding_targetClass")),o=await this.getLinkedValue(e,q.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,q.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!o&&!c)return null;let l=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,p=await this.loadLinkedPreconditionFromProperty(e,q.Namespace.EXOCMD.term("CommandBinding_precondition")),h=await this.loadLinkedStyle(e,t),g=await this.getLinkedUIDs(e,q.Namespace.EXOCMD.term("CommandBinding_overrides"));return{id:t,label:n,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:p??void 0,style:h??void 0,overrides:g.length>0?g:void 0}}async loadLinkedStyle(e,t){let n=await this.tripleStore.match(e,q.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(n.length>0){let s=n[0].object,o=null;if(s instanceof hr.IRI)o=s;else if(s instanceof cr.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,q.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,q.Namespace.EXO.term("Asset_uid"));if(!t)return null;let n=await this.getLiteralValue(e,q.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,o=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(o),l=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),p=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),h=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("CommandBindingStyle_source")),g=h!==null?this.coerceStyleSource(h,t):void 0;return{id:t,label:n,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:p??void 0,source:g,inline:!1}}coerceVariant(e,t){if(e==null)return;let n=String(e).trim().toLowerCase();if(n!==""){if(Bf.COMMAND_VARIANT_VALUES.includes(n))return n;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${n}" not in whitelist [${Bf.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let n=String(e).trim().toLowerCase();if(n!==""){if(Bf.LABEL_CLASS_VALUES.includes(n))return n;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${n}" not in whitelist [${Bf.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let n=String(e).trim().toLowerCase();if(n!==""){if(Bf.STYLE_SOURCE_VALUES.includes(n))return n;this.logger.warn(this.capWarning(`CommandBindingStyle source "${n}" not in whitelist [${Bf.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,n,i){if(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i))return!0;if(e.targetPrototype&&n){for(let s of n)if(this.matchesReference(e.targetPrototype,s))return!0}return!!(e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let n=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(n===i)return!0;let s=this.extractPathBasename(i);if(s&&s===n)return!0;let o=this.extractPathBasename(n);if(o&&o===i)return!0;let c=this.extractAlias(t);if(c&&n===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(),n=t.indexOf("|");return n>=0?t.substring(n+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,q.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=await this.resolvePreconditionRef(n[0].object);return i?this.loadPreconditionSubject(i,new Set,0):null}async resolvePreconditionRef(e){if(e instanceof hr.IRI)return e;if(e instanceof cr.Literal){let t=this.normalizeWikilink(e.value);return await this.findSubjectByUID(t)}return null}async loadPreconditionSubject(e,t,n){let i=await this.getLiteralValue(e,q.Namespace.EXO.term("Asset_uid")),s=await this.getLiteralValue(e,q.Namespace.EXO.term("Asset_label"))??"";if(i&&t.has(i))return this.brokenPreconditionNode(i,s);if(n>=Wl)return this.brokenPreconditionNode(i??"",s);let o=await this.tripleStore.match(e,q.Namespace.EXOCMD.term("AllPrecondition_preconditions"),void 0),c=await this.tripleStore.match(e,q.Namespace.EXOCMD.term("AnyPrecondition_preconditions"),void 0),l=await this.tripleStore.match(e,q.Namespace.EXOCMD.term("NotPrecondition_precondition"),void 0);if(o.length>0||c.length>0||l.length>0){let p=new Set(t);if(i&&p.add(i),o.length>0||c.length>0){let g=o.length>0?"all":"any",m=o.length>0?o:c,b=[];for(let _ of m)b.push(await this.loadChildPrecondition(_.object,p,n+1));return{id:i??"",label:s,composite:{op:g,children:b}}}let h=await this.loadChildPrecondition(l[0].object,p,n+1);return{id:i??"",label:s,not:h}}let u=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Precondition_sparqlAsk")),f=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Precondition_hostFunction")),d=await this.loadPreconditionQueryRef(e);return!i||!u&&!f&&!d?null:{id:i,label:s,...u&&{sparqlAsk:u},...f&&{hostFunction:f},...d&&{query:d}}}async loadChildPrecondition(e,t,n){let i=await this.resolvePreconditionRef(e);if(!i){let c=e instanceof cr.Literal?this.normalizeWikilink(e.value):"";return this.brokenPreconditionNode(c,"")}let s=await this.loadPreconditionSubject(i,t,n);if(s)return s;let o=await this.getLiteralValue(i,q.Namespace.EXO.term("Asset_uid"));return this.brokenPreconditionNode(o??"","")}async loadPreconditionQueryRef(e){let t=await this.tripleStore.match(e,q.Namespace.EXOCMD.term("Precondition_query"),void 0);if(t.length===0)return;let n=t[0].object;if(n instanceof hr.IRI)return await this.getLiteralValue(n,q.Namespace.EXO.term("Asset_uid"))??void 0;if(n instanceof cr.Literal)return this.normalizeWikilink(n.value)}brokenPreconditionNode(e,t){return{id:e,label:t,broken:!0}}async loadLinkedGrounding(e,t,n){if(t>=Wl)return null;let i=await this.tripleStore.match(e,q.Namespace.EXOCMD.term("Command_grounding"),void 0);if(i.length===0)return null;if(i.length===1||!n?.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,q.Namespace.EXOCMD.term("Grounding_targetPrototype"));if(l&&this.matchesReference(l,n.targetClass))return this.loadGroundingDefinition(c,t)}this.logger.warn(`Command ${e.value}: ${i.length} groundings declared, none matched context.targetClass='${n.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 hr.IRI)return e;if(e instanceof cr.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>=Wl)return null;let n=await this.getLiteralValue(e,q.Namespace.EXO.term("Asset_uid"));if(!n)return null;let i=await this.getLiteralValue(e,q.Namespace.EXO.term("Asset_label"))??"",s=await this.resolveGroundingTypeReference(e);if(!s)return null;let o=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_targetProperty"));if(o&&this.looksLikeUUID(o)){let se=await this.resolveLabelByUID(o);if(!se)return this.logger.warn(`Grounding ${n}: targetProperty wikilink UID '${o}' is not resolvable to exo__Asset_label \u2014 grounding skipped (would otherwise write a UUID-named frontmatter key).`),null;o=se}if(s===Ak.GroundingType.SERVICE_CALL){let se=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_serviceId"));se&&(o=se)}let c=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_targetValueRef")),l=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_targetValueLiteral")),u=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_targetValueSubstitution")),f=null;if(u&&this.looksLikeUUID(u)){let se=await this.resolveLabelByUID(u);if(!se)return this.logger.warn(`Grounding ${n}: targetValueSubstitution UID '${u}' is not resolvable to exo__Asset_label (SubstitutionToken instance missing or unlabelled) \u2014 grounding skipped.`),null;f=se}else u&&(f=u);let d=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_targetValueQuery")),p=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_targetQuery")),h=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_serviceCallPayload")),g=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_appendExpression")),m=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_replaceFromExpression")),b=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_replaceToExpression")),_=await this.getObsidianWikilinkValue(e,q.Namespace.EXOCMD.term("Grounding_isDefinedBy")),S=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),I=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_targetClass"));if(I&&!this.looksLikeUUID(I)){let se=await this.findUidByLabel(I);se&&(I=se)}let E=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_targetPrototype")),w=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_targetFolder")),R=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_linkBackProperty")),x=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_inputSchema")),O=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_incrementBy")),N=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_shiftDelta")),G;if(O!=null&&O!==""){let se=Number.parseInt(String(O),10);Number.isFinite(se)&&(G=se)}let j=await this.resolvePropertyDefaults(e,n),ae=await this.resolveInheritanceRules(e,n),Y=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_propertyDefaults"));Y!==null&&Y!==""&&!this._legacyPropertyDefaultsWarnedGroundings.has(n)&&(this.logger.warn(`Grounding ${n}: 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(n));let M;s===Ak.GroundingType.COMPOSITE&&(M=await this.loadCompositeSteps(e,t+1));let ce;if(x)try{let se=JSON.parse(x);se?.properties&&(ce=Object.entries(se.properties).map(([Ae,ge])=>{let ve=ge.type,Re=ve==="string"?ge.format==="asset-reference"?"assetRef":"text":ve,de=ge.defaultValue!==void 0?ge.defaultValue:ge.default,U={name:Ae,type:Re,label:ge.title??Ae,required:Array.isArray(se.required)&&se.required.includes(Ae)};return de!=null&&(U.defaultValue=String(de)),typeof ge.targetClassUid=="string"&&(U.targetClassUid=ge.targetClassUid),U}))}catch{}let W=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_prefillLabelWithDate")),oe=W!==null&&String(W).trim().toLowerCase()==="true",X=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_labelTemplate")),J=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_direction")),ye;if(J!=null){let se=String(J).trim().toLowerCase();se==="forward"||se==="rollback"?ye=se:se!==""&&this.logger.warn(`Grounding ${n}: exocmd__Grounding_direction value '${J}' is not 'forward' or 'rollback' \u2014 treating as undefined (will default to 'forward' at dispatch).`)}let ze=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_bodyTemplate")),Z=await this.getObsidianName(e,q.Namespace.EXOCMD.term("Grounding_templateRef")),z=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_cloneTargetBody")),ee=z!==null&&String(z).trim().toLowerCase()==="true",K=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_targetsCreatedInstance")),ie=K!==null&&String(K).trim().toLowerCase()==="true",Pe=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("Grounding_omitLabel")),$=Pe!==null&&String(Pe).trim().toLowerCase()==="true",fe={id:n,label:i,type:s,targetProperty:o??void 0,targetValueRef:c??void 0,targetValueLiteral:l??void 0,targetValueSubstitution:f??void 0,targetValueQuery:d??void 0,targetQuery:p??void 0,serviceCallPayload:h??void 0,appendExpression:g??void 0,replaceFromExpression:m??void 0,replaceToExpression:b??void 0,sparqlUpdate:S??void 0,steps:M,targetClass:I??void 0,targetPrototype:E??void 0,targetFolder:w??void 0,linkBackProperty:R??void 0,incrementBy:G,shiftDelta:N??void 0,propertyDefault:j.length>0?j:void 0,inheritanceRule:ae.length>0?ae:void 0,isDefinedBy:_??void 0,prefillLabelWithDate:oe||void 0,labelTemplate:X??void 0,direction:ye,bodyTemplate:ze??void 0,templateRef:Z??void 0,cloneTargetBody:ee||void 0,targetsCreatedInstance:ie||void 0,omitLabel:$||void 0};return ce&&(fe.inputSchema=ce),fe}async loadCompositeSteps(e,t){if(t>=Wl)return[];let n=await this.tripleStore.match(e,q.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of n){let o=null;if(s.object instanceof hr.IRI)o=s.object;else if(s.object instanceof cr.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 n=await this.resolvePropertyDefaultsForSubject(e,t,q.Namespace.EXOCMD.term("Grounding_propertyDefault")),i=await this.getUniversalCache();return i&&i.propertyDefaults.length>0?(0,Ck.mergePropertyDefaults)(i.propertyDefaults,n):n}async resolvePropertyDefaultsForSubject(e,t,n){let i=await this.tripleStore.match(e,n,void 0),s=[];for(let o of i){let c=await this.resolveRefTripleObject(o.object);if(!c)continue;let l=await this.getObsidianName(c,q.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,q.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 this.findUniversalSingleton();if(!e)return this.logger.debug("[CommandResolver] No exocmd__UniversalDefaultTemplate instance found in the store; universal property-defaults and inheritance-rules will not be applied. This verdict is cached until invalidateCache() is called \u2014 if the store was still warming up, the next invalidation re-resolves it."),this._universalCacheValue=null,null;let t=await this.resolvePropertyDefaultsForSubject(e,Dk,q.Namespace.EXOCMD.term("Template_propertyDefault")),n=await this.resolveInheritanceRulesForSubject(e,Dk,q.Namespace.EXOCMD.term("Template_inheritanceRule"));return this._universalCacheValue={propertyDefaults:t,inheritanceRules:n},this._universalCacheValue}async findUniversalSingleton(){let e=q.Namespace.EXOCMD.term("UniversalDefaultTemplate"),t=e.value,i=(await this.tripleStore.match(void 0,q.Namespace.EXO.term("Instance_class"),e)).map(c=>c.subject).filter(c=>c instanceof hr.IRI);if(i.length>0)return this.pickUniversalSingleton(i);let s=await this.tripleStore.match(void 0,q.Namespace.EXO.term("Instance_class"),void 0),o=[];for(let c of s){let l=!1;if(c.object instanceof hr.IRI)l=c.object.value===t||c.object.value.includes(Fk);else if(c.object instanceof cr.Literal){let u=this.unwrapWikilink(c.object.value);l=u==="exocmd__UniversalDefaultTemplate"||u===Fk}l&&c.subject instanceof hr.IRI&&o.push(c.subject)}return this.pickUniversalSingleton(o)}pickUniversalSingleton(e){if(e.length===0)return null;if(e.length===1)return e[0];let t=[...e].sort((n,i)=>n.value.localeCompare(i.value));return this.logger.warn(`Multiple UniversalDefaultTemplate singletons found (${t.length}); selecting deterministically by lexicographic UID order: ${t[0].value}`),t[0]}async resolveInheritanceRules(e,t){let n=await this.resolveInheritanceRulesForSubject(e,t,q.Namespace.EXOCMD.term("Grounding_inheritanceRule")),i=await this.getUniversalCache();return i&&i.inheritanceRules.length>0?(0,Ck.mergeInheritanceRules)(i.inheritanceRules,n):n}async resolveInheritanceRulesForSubject(e,t,n){let i=await this.tripleStore.match(e,n,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,q.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,q.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,q.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"),void 0),p,h;if(d.length>0){let E=await this.getObsidianName(l,q.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"));if(!E||!E.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(E)?(h=E,p=await this.resolveLabelByUID(E)??void 0):p=E}let g=await this.tripleStore.match(l,q.Namespace.EXOCMD.term("InheritanceRule_targetClassExclusion"),void 0),m=[],b=[],_=!1;for(let E of g){let w=null;if(E.object instanceof hr.IRI?w=this.iriToObsidianName(E.object.value)??E.object.value:E.object instanceof cr.Literal&&(w=this.unwrapWikilink(E.object.value)),!w){_=!0;continue}if(this.looksLikeUUID(w)){b.push(w);let R=await this.resolveLabelByUID(w);R&&m.push(R)}else m.push(w)}if(_){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 S=await this.getLiteralValue(l,q.Namespace.EXOCMD.term("InheritanceRule_priority")),I=50;if(S!==null&&S!==""){let E=Number.parseInt(String(S),10);Number.isFinite(E)&&(I=E)}s.push({sourcePropertyName:u,targetPropertyName:f,targetClassCondition:p,targetClassConditionUid:h,targetClassExclusion:m,targetClassExclusionUids:b,priority:I})}return s}async resolveRefTripleObject(e){if(e instanceof hr.IRI)return e;if(e instanceof cr.Literal){let t=this.normalizeWikilink(e.value);return t?this.findSubjectByUID(t):null}return null}async resolveLabelRef(e,t){let n=await this.getObsidianName(e,t);return n?this.looksLikeUUID(n)?this.resolveLabelByUID(n):n:null}async resolvePropertyDefaultValue(e,t,n){if(!this.looksLikeUUID(e))return`"[[${e}]]"`;let i=await this.findSubjectByUID(e);if(!i){let c=`${t}|${e}`;return this._fallbackWarnedKeys.has(c)||(this._fallbackWarnedKeys.add(c),this.logger.warn(this.capWarning(`Grounding ${t}: PropertyDefault '${n}' \u2192 value asset ${e} not in store; SKIPPING the property (the executor's own default applies). Previously this emitted a wikilink, i.e. a link written where a value belongs.`))),yJ.STRING_SCALAR_PROPERTIES.has(n)?null:`"[[${e}]]"`}return await this.assetIsTokenInvocation(i)?this.resolveTokenInvocation(i,e,t,n):await this.assetIsSubstitutionToken(i)?this.dispatchSubstitutionToken(i,e,t,n,void 0):(this.logger.debug(`Grounding ${t}: PropertyDefault '${n}' value '${e}' is not a SubstitutionToken \u2014 emitting wikilink form.`),`"[[${e}]]"`)}async dispatchSubstitutionToken(e,t,n,i,s){let o=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("SubstitutionToken_resolver"));if(!o||!o.trim())return this.logger.warn(`Grounding ${n}: PropertyDefault '${i}' references SubstitutionToken '${t}' with no exocmd__SubstitutionToken_resolver \u2014 falling back to wikilink form.`),`"[[${t}]]"`;let c=o.trim();return Pk.has(c)?s!==void 0?IJ(c,t,s):AJ(c,t):(this.logger.warn(`Grounding ${n}: PropertyDefault '${i}' SubstitutionToken '${t}' declares unknown resolver-id '${c}' \u2014 falling back to wikilink form. Known ids: ${Array.from(Pk).join(", ")}.`),`"[[${t}]]"`)}async resolveTokenInvocation(e,t,n,i){let s=await this.getObsidianName(e,q.Namespace.EXOCMD.term("TokenInvocation_token"));if(!s)return this.logger.warn(`Grounding ${n}: PropertyDefault '${i}' TokenInvocation '${t}' missing exocmd__TokenInvocation_token \u2014 entry skipped.`),null;let o=await this.getLiteralValue(e,q.Namespace.EXOCMD.term("TokenInvocation_parameter"))??"";if(!this.looksLikeUUID(s))return this.logger.warn(`Grounding ${n}: 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,n,i,o):(this.logger.warn(`Grounding ${n}: 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,q.Namespace.EXO.term("Instance_class"),void 0);for(let i of t)if(i.object instanceof hr.IRI){if(i.object.value===RJ||i.object.value.includes(Ok))return!0}else if(i.object instanceof cr.Literal){let s=this.unwrapWikilink(i.object.value);if(s==="exocmd__TokenInvocation"||s===Ok)return!0}return(await this.tripleStore.match(e,q.Namespace.EXOCMD.term("TokenInvocation_token"),void 0)).length>0?(this.logger.debug(`Asset ${e.value} classified as TokenInvocation via its exocmd__TokenInvocation_token property; exo__Instance_class was absent or unresolved.`),!0):!1}async assetIsSubstitutionToken(e){let t=await this.tripleStore.match(e,q.Namespace.EXO.term("Instance_class"),void 0);for(let i of t)if(i.object instanceof hr.IRI){if(i.object.value===TJ||i.object.value.includes(xk))return!0}else if(i.object instanceof cr.Literal){let s=this.unwrapWikilink(i.object.value);if(s==="exocmd__SubstitutionToken"||s===xk)return!0}return(await this.tripleStore.match(e,q.Namespace.EXOCMD.term("SubstitutionToken_resolver"),void 0)).length>0?(this.logger.debug(`Asset ${e.value} classified as SubstitutionToken via its resolver property; exo__Instance_class was absent or unresolved.`),!0):!1}async resolveGroundingTypeReference(e){let t=await this.tripleStore.match(e,q.Namespace.EXOCMD.term("Grounding_type"),void 0);if(t.length===0)return null;let n=t[0].object;if(n instanceof hr.IRI)return(0,Ik.resolveGroundingTypeFromIRI)(n.value);if(n instanceof cr.Literal){let i=n.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,Ik.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 expandPrototypeChain(e){if(!e||!this.normalizeWikilink(e))return[];let t=[e],n=new Set([this.normalizeWikilink(e).toLowerCase()]),i=e;for(let s=0;s<Wl;s++){let o=this.extractUuidFromRef(i);if(!o)break;let c=null;try{let u=await this.findSubjectByUID(o);if(!u)break;c=await this.getLinkedValue(u,q.Namespace.EXO.term("Asset_prototype"))}catch(u){this.logger.debug(this.capWarning(`[expandPrototypeChain] store lookup failed at hop ${s} for '${i}': ${String(u)}`));break}if(!c)break;let l=this.normalizeWikilink(c).toLowerCase();if(n.has(l))break;n.add(l),t.push(c),i=c}return t}extractUuidFromRef(e){let t=this.normalizeWikilink(e);if(this.looksLikeUUID(t))return t;let n=this.extractPathBasename(t);return n&&this.looksLikeUUID(n)?n:null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let n=await this.tripleStore.findSubjectsByUUID(e);if(n.length>0)return n[0]}let t=await this.tripleStore.match(void 0,q.Namespace.EXO.term("Asset_uid"),void 0);for(let n of t)if(n.object instanceof cr.Literal&&n.object.value===e)return n.subject;return null}async getLiteralValue(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;return i instanceof cr.Literal||i instanceof hr.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.readAssetLabel(t):null}async readAssetLabel(e){let t=(await this.tripleStore.match(e,q.Namespace.EXO.term("Asset_label"),void 0))[0]?.object;return t instanceof hr.IRI?(0,Rk.iriToObsidianName)(t.value)??t.value:t instanceof cr.Literal?t.value:null}async getClassAncestors(e){return(await this.getClassAncestorsWithDepth(e)).map(n=>n.ref)}async getClassAncestorsWithDepth(e){let t=this._ancestorDepthCache.get(e);if(t)return t;let n=new Map,i=new Set,s=await this.resolveClassFileIRI(e);if(!s)return[];let o=new Set([e]),c=await this.getLiteralValue(s,q.Namespace.EXO.term("Asset_uid"));c&&o.add(c);let l=await this.readAssetLabel(s);l&&o.add(l);let u=a((p,h)=>{if(o.has(p))return;let g=n.get(p);(g===void 0||h<g)&&n.set(p,h)},"setMin"),f=[{fileIRI:s,depth:0}];for(;f.length>0;){let p=f.shift();if(!p)break;let{fileIRI:h,depth:g}=p;if(g>=Wl||i.has(h.value))continue;i.add(h.value);let m=await this.tripleStore.match(h,q.Namespace.EXO.term("Class_superClass"),void 0);for(let b of m){let _=b.object;if(!(_ instanceof hr.IRI))continue;let S=g+1,I=_.value.startsWith("obsidian://vault/"),E=this.iriToObsidianName(_.value);E&&u(E,S);let w=null;if(I?w=_:E&&(w=await this.resolveClassFileIRI(E)),!w)continue;let R=await this.getLiteralValue(w,q.Namespace.EXO.term("Asset_uid"));R&&u(R,S),i.has(w.value)||f.push({fileIRI:w,depth:S})}}let d=Array.from(n.entries()).map(([p,h])=>({ref:p,depth:h}));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){return(0,_J.findUidByAssetLabel)(this.tripleStore,e)}async getLinkedUID(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;if(i instanceof hr.IRI){let s=await this.tripleStore.match(i,q.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof cr.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof cr.Literal?this.normalizeWikilink(i.value):null}async getLinkedUIDs(e,t){let n=await this.tripleStore.match(e,t,void 0),i=[];for(let s of n){let o=s.object;if(o instanceof hr.IRI){let c=await this.tripleStore.match(o,q.Namespace.EXO.term("Asset_uid"),void 0);if(c.length>0&&c[0].object instanceof cr.Literal)i.push(c[0].object.value);else{let l=o.value.split("/").pop()?.replace(".md","");l&&i.push(l)}}else if(o instanceof cr.Literal){let c=this.normalizeWikilink(o.value);c&&i.push(c)}}return i}async getLinkedValue(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;return i instanceof cr.Literal?this.normalizeWikilink(i.value):i instanceof hr.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;return i instanceof cr.Literal?this.unwrapWikilink(i.value):i instanceof hr.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 n=t.match(/^\[\[([^\]|]+)\|([^\]]+)\]\]$/);if(n)return n[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 n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;if(i instanceof cr.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof hr.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 n=t[1],i=await this.findSubjectByUID(n);if(!i)return e;let s=await this.getLiteralValue(i,q.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${n}]]`,`[[${n}|${s}]]`):e}iriToObsidianName(e){return(0,Rk.iriToObsidianName)(e)}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),n=t.indexOf("|");return n>=0?t.substring(0,n):t}};pa.CommandResolver=qA;pa.CommandResolver=qA=pJ([(0,mJ.injectable)(),hJ("design:paramtypes",[Object,Object])],qA)});var zA=T(WA=>{"use strict";Object.defineProperty(WA,"__esModule",{value:!0});WA.validateExoQLAllowlist=CJ;var ub=Th();function CJ(r){if(!r||typeof r!="object")return;let e=r;if(e.type==="update"){let t=r.updates??[];for(let n of t)if(n?.type==="load")throw new ub.ExoQLForbiddenKeywordError("LOAD");throw new ub.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,n=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||n)throw new ub.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)fb(t);if(Array.isArray(e.template))for(let t of e.template)fb(t)}}a(CJ,"validateExoQLAllowlist");function fb(r){if(!r||typeof r!="object")return;if(r.type==="service")throw new ub.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(r.patterns))for(let t of r.patterns)fb(t);let e=r.where;if(Array.isArray(e))for(let t of e)fb(t)}a(fb,"walkPatternForBannedKeywords")});var HA=T(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});db.DEFAULT_EVAL_CONFIG=void 0;db.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var pb=T(KA=>{"use strict";Object.defineProperty(KA,"__esModule",{value:!0});KA.evaluateWithExoEval=NJ;var xJ=mf(),PJ=wf(),OJ=Uf(),FJ=zA(),DJ=HA(),LJ=Th();async function NJ(r,e={}){if(typeof r!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let n=new xJ.ExoQLParser().parse(r);if((0,FJ.validateExoQLAllowlist)(n),!{...DJ.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new LJ.ExoQLEvalDisabledError;let s="queryType"in n&&typeof n.queryType=="string"?n.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new PJ.ExoQLAlgebraTranslator().translate(n),l=new OJ.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(NJ,"evaluateWithExoEval")});var vs=T(hb=>{"use strict";Object.defineProperty(hb,"__esModule",{value:!0});hb.DateFormatter=void 0;var YA=class r{static{a(this,"DateFormatter")}static toISOTimestamp(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}static toLocalTimestamp(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0");return`${t}-${n}-${i}T${s}:${o}:${c}`}static toDateWikilink(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`"[[${t}-${n}-${i}]]"`}static getTodayWikilink(){return r.toDateWikilink(new Date)}static toDateString(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${i}`}static parseWikilink(e){let n=e.replace(/^["']|["']$/g,"").match(/\[\[(\d{4}-\d{2}-\d{2})\]\]/);return n?n[1]:null}static addDays(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}static isSameDay(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}static getTodayStartTimestamp(){let e=new Date;return e.setHours(0,0,0,0),r.toLocalTimestamp(e)}static toTimestampAtStartOfDay(e){let t=e.split("-").map(Number);if(t.length!==3||t.some(isNaN))throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD`);let[n,i,s]=t,o=new Date(n,i-1,s,0,0,0,0);if(isNaN(o.getTime()))throw new Error(`Invalid date values: ${e}`);return r.toLocalTimestamp(o)}static normalizeTimestamp(e){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e;let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid timestamp format: ${e}`);return r.toISOTimestamp(t)}static isISOTimestamp(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e)}};hb.DateFormatter=YA});var Ih=T(mb=>{"use strict";Object.defineProperty(mb,"__esModule",{value:!0});mb.liveClock=kJ;mb.frozenClock=MJ;function kJ(){return{now:a(()=>new Date,"now")}}a(kJ,"liveClock");function MJ(r){let e=new Date(r);return{now:a(()=>new Date(e.getTime()),"now")}}a(MJ,"frozenClock")});var kk=T(ha=>{"use strict";var jJ=ha&&ha.__decorate||function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[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},$J=ha&&ha.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ch;Object.defineProperty(ha,"__esModule",{value:!0});ha.PreconditionEvaluator=void 0;var UJ=lt(),BJ=mf(),VJ=wf(),Nk=Uf(),GJ=pb(),Rh=vs(),qJ=Ih(),xh=Ch=class{static{a(this,"PreconditionEvaluator")}constructor(e,t,n){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t,this.clock=n?.clock??(0,qJ.liveClock)()}async evaluate(e,t,n){if(!e)return!0;let i=new Map;return await this.evaluateNode(e,t,n,i)==="yes"}async evaluateNode(e,t,n,i){if(e.broken)return"unknown";if(e.composite){let{op:s,children:o}=e.composite;if(o.length===0)return"unknown";let c=await Promise.all(o.map(l=>this.evaluateNode(l,t,n,i)));return s==="all"?c.includes("no")?"no":c.includes("unknown")?"unknown":"yes":c.includes("yes")?"yes":c.includes("unknown")?"unknown":"no"}if(e.not){let s=await this.evaluateNode(e.not,t,n,i);return s==="unknown"?"unknown":s==="yes"?"no":"yes"}return e.sparqlAsk?await this.evaluateSparqlAskMemoized(e.sparqlAsk,t,i)?"yes":"no":e.query?await this.evaluateQueryRef(e.query,t)?"yes":"no":e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,n)?"yes":"no":"yes"}evaluateSparqlAskMemoized(e,t,n){let i=n.get(e);if(i!==void 0)return i;let s=this.evaluateSparqlAsk(e,t);return n.set(e,s),s}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let n=await this.queryBodyResolver.resolveSparql(e);if(!n)return!1;let i=this.substituteVariables(n,t),s=await(0,GJ.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,n){return this.hostFunctions.has(e)?this.evaluateHostFunction(e,t,n):null}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Ch.SENTINEL_IRI),i=new BJ.ExoQLParser().parse(t),o=new VJ.ExoQLAlgebraTranslator().translate(i);return new Nk.ExoQLQueryExecutor(this.tripleStore).isAskQuery(o)?o:null}evaluateHostFunction(e,t,n){let i=this.hostFunctions.get(e);if(!i)return!0;let s=n?{...n,targetIRI:t}:{targetIRI:t};try{return i(s)}catch{return!1}}async evaluateSparqlAsk(e,t){try{let n=Ch.TEMPORAL_TOKEN.test(e),i=n?Rh.DateFormatter.toDateString(this.clock.now()):null,s=this.askCache.get(e);if(s===void 0||n&&s.day!==i){let l=this.compileAsk(e);if(!l)return!1;s={day:i,compiled:l},this.askCache.set(e,s)}let o=JSON.parse(JSON.stringify(s.compiled).replaceAll(Ch.SENTINEL_IRI,t));return await new Nk.ExoQLQueryExecutor(this.tripleStore).executeAsk(o)}catch{return!1}}substituteVariables(e,t){let n=this.clock.now(),i=n.toISOString(),s=n.getFullYear(),o=n.getMonth(),c=n.getDate(),l=n.getDay(),u=Rh.DateFormatter.toDateString(n),f=Rh.DateFormatter.toDateString(new Date(s,o,c-1)),d=(l+6)%7,p=Rh.DateFormatter.toDateString(new Date(s,o,c-d)),h=Rh.DateFormatter.toDateString(new Date(s,o,c-d-7)),g=`${s}-${String(o+1).padStart(2,"0")}-01`,m=o===0?11:o-1,_=`${o===0?s-1:s}-${String(m+1).padStart(2,"0")}-01`,S=`${s}-01-01`;return e.replace(/\$target\b/g,`<${t}>`).replace(/\$now\b/g,`"${i}"^^xsd:dateTime`).replace(/\$yesterday\b/g,`"${f}"^^xsd:date`).replace(/\$thisWeekStart\b/g,`"${p}"^^xsd:date`).replace(/\$lastWeekStart\b/g,`"${h}"^^xsd:date`).replace(/\$thisMonthStart\b/g,`"${g}"^^xsd:date`).replace(/\$lastMonthStart\b/g,`"${_}"^^xsd:date`).replace(/\$thisYearStart\b/g,`"${S}"^^xsd:date`).replace(/\$today\b/g,`"${u}"^^xsd:date`)}};ha.PreconditionEvaluator=xh;xh.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";xh.TEMPORAL_TOKEN=/\$(?:now|today|yesterday|thisWeekStart|lastWeekStart|thisMonthStart|lastMonthStart|thisYearStart)\b/;ha.PreconditionEvaluator=xh=Ch=jJ([(0,UJ.injectable)(),$J("design:paramtypes",[Object,Object,Object])],xh)});var Mk=T(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.hasUidFilename=ma.hasNonUidFilename=void 0;ma.registerDefaultHostFunctions=HJ;var WJ=a(r=>{let e=r.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=r.fileBasename;return typeof t!="string"?!1:t!==e},"hasNonUidFilename");ma.hasNonUidFilename=WJ;var zJ=a(r=>{let e=r.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=r.fileBasename;return typeof t!="string"?!1:t===e},"hasUidFilename");ma.hasUidFilename=zJ;function HJ(r){r.registerHostFunction("hasNonUidFilename",ma.hasNonUidFilename),r.registerHostFunction("hasUidFilename",ma.hasUidFilename)}a(HJ,"registerDefaultHostFunctions")});var yb=T(gb=>{"use strict";Object.defineProperty(gb,"__esModule",{value:!0});gb.liveUidGenerator=KJ;gb.seededUidGenerator=XJ;var XA=El();function KJ(){return{next:a(()=>(0,XA.v4)(),"next")}}a(KJ,"liveUidGenerator");var YJ="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function XJ(r){let e=0,t=(0,XA.v5)(r,YJ);return{next:a(()=>{let n=`${r}#${e}`;return e+=1,(0,XA.v5)(n,t)},"next")}}a(XJ,"seededUidGenerator")});var Sb=T(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});wc.registerResolver=mr;wc.getResolver=ZJ;wc.isResolverModifierAware=eZ;wc.getRegisteredResolverIds=tZ;wc.clearResolvers=rZ;wc.installDefaultResolvers=dZ;var QJ=vs(),_b=new Map,QA=new Set,JJ=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function mr(r,e,t=!1){_b.set(r,e),t&&QA.add(r)}a(mr,"registerResolver");function ZJ(r){return _b.get(r)}a(ZJ,"getResolver");function eZ(r){return QA.has(r)}a(eZ,"isResolverModifierAware");function tZ(){return Array.from(_b.keys())}a(tZ,"getRegisteredResolverIds");function rZ(){_b.clear(),QA.clear()}a(rZ,"clearResolvers");function wn(r){return r<10?`0${r}`:String(r)}a(wn,"pad2");var nZ=["January","February","March","April","May","June","July","August","September","October","November","December"],iZ=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sZ=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],oZ=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function aZ(r){let e=["th","st","nd","rd"],t=r%100;return`${r}${e[(t-20)%10]||e[t]||e[0]}`}a(aZ,"ordinalDay");var cZ=/YYYY|YY|MMMM|MMM|MM|M|Do|DD|D|dddd|ddd|HH|H|hh|h|mm|m|ss|s|A|a/g;function lZ(r,e){let t=(r.getHours()+11)%12+1;return e.replace(cZ,n=>{switch(n){case"YYYY":return String(r.getFullYear());case"YY":return wn(r.getFullYear()%100);case"MMMM":return nZ[r.getMonth()];case"MMM":return iZ[r.getMonth()];case"MM":return wn(r.getMonth()+1);case"M":return String(r.getMonth()+1);case"Do":return aZ(r.getDate());case"DD":return wn(r.getDate());case"D":return String(r.getDate());case"dddd":return sZ[r.getDay()];case"ddd":return oZ[r.getDay()];case"HH":return wn(r.getHours());case"H":return String(r.getHours());case"hh":return wn(t);case"h":return String(t);case"mm":return wn(r.getMinutes());case"m":return String(r.getMinutes());case"ss":return wn(r.getSeconds());case"s":return String(r.getSeconds());case"A":return r.getHours()<12?"AM":"PM";case"a":return r.getHours()<12?"am":"pm";default:return n}})}a(lZ,"formatDate");function jk(r,e,t){let n=r.getDate(),i=new Date(r.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(n,s)),i}a(jk,"addMonthsClamped");function uZ(r,e){if(!e)return r;let t=e.match(/^([+-])(\d+)([dwMy])?$/);if(!t)return r;let n=(t[1]==="-"?-1:1)*parseInt(t[2],10),i=t[3]??"d",s=new Date(r.getTime());switch(i){case"d":s.setDate(s.getDate()+n);break;case"w":s.setDate(s.getDate()+n*7);break;case"M":s=jk(s,n,"M");break;case"y":s=jk(s,n,"y");break}return isNaN(s.getTime())?r:s}a(uZ,"applyDateOffset");function fZ(r){if(!r)return{offset:null,format:null};let e=r.indexOf(":");if(e<0)return{offset:r,format:null};let t=r.slice(0,e),n=r.slice(e+1);return{offset:t||null,format:n||null}}a(fZ,"parseDateModifier");function bb(r,e){return(t,n)=>{let{offset:i,format:s}=fZ(n),o=new Date;return r!==0&&o.setDate(o.getDate()+r),o=uZ(o,i),lZ(o,s??e)}}a(bb,"makeDateResolver");function dZ(){mr("today",()=>{let r=new Date;return`${r.getFullYear()}-${wn(r.getMonth()+1)}-${wn(r.getDate())}`}),mr("todayStart",()=>QJ.DateFormatter.getTodayStartTimestamp()),mr("date",bb(0,"YYYY-MM-DD"),!0),mr("now",bb(0,"YYYY-MM-DDTHH:mm:ss"),!0),mr("tomorrow",bb(1,"YYYY-MM-DD"),!0),mr("yesterday",bb(-1,"YYYY-MM-DD"),!0),mr("target",r=>r.targetIRI?`"[[${r.targetIRI}]]"`:""),mr("targetFolder",r=>{if(!r.targetFilePath)return"";let e=r.targetFilePath.replace(/^\/+/,""),t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}),mr("createdInstance",r=>{let e=r.createdInstancePath;if(!e)return null;let t=e.replace(/\.md$/i,"").replace(/^\/+/,""),n=t.split("/").pop()??t;return`"[[${JJ.test(n)?n:t}]]"`}),mr("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.")}),mr("nowTimestamp",()=>{let r=new Date;return`${r.getFullYear()}-${wn(r.getMonth()+1)}-${wn(r.getDate())}T${wn(r.getHours())}:${wn(r.getMinutes())}:${wn(r.getSeconds())}`}),mr("nowDate",()=>{let r=new Date;return`${r.getFullYear()}-${wn(r.getMonth()+1)}-${wn(r.getDate())}`}),mr("nowYear",()=>String(new Date().getFullYear())),mr("nowMonth",()=>wn(new Date().getMonth()+1)),mr("userInputLabel",r=>{let e=r.userInput?.label;return typeof e=="string"?e:""}),mr("userInput",(r,e)=>{if(!e)return null;let t=r.userInput?.[e];return typeof t=="string"?t:t==null?null:String(t)}),mr("targetProperty",(r,e)=>{if(!e||!r.targetFm)return null;let t=r.targetFm[e];return t==null?null:Array.isArray(t)?t.map(String):String(t)}),mr("targetRefProperty",(r,e)=>{if(!e)return null;let t=e.indexOf("|");if(t<0)return null;let n=e.slice(0,t),i=e.slice(t+1);if(!n||!i)return null;let s=r.targetRefFm?.[n];if(!s)return null;let o=s[i];return o==null?null:Array.isArray(o)?o.length>0?String(o[0]):null:String(o)}),mr("labelAsArray",r=>{let e=r.userInput?.label;return typeof e=="string"&&e.length>0?[e]:[]}),mr("groundingTargetClass",r=>r.groundingTargetClassUid?`"[[${r.groundingTargetClassUid}]]"`:null),mr("targetClassSelf",r=>{if(!r.targetFilePath)return null;let e=r.targetFilePath.replace(/^\/+/,""),n=e.slice(e.lastIndexOf("/")+1).replace(/\.md$/i,"");return n.length>0?`"[[${n}]]"`:null})}a(dZ,"installDefaultResolvers")});var ZA=T(wb=>{"use strict";Object.defineProperty(wb,"__esModule",{value:!0});wb.resolveTemplateBody=hZ;wb.stripTemplateFrontmatter=mZ;var JA=Sb();(0,JA.installDefaultResolvers)();var pZ=/\$([A-Za-z][A-Za-z0-9_]*)((?:[+-]\d+[dwMy])?(?::[A-Za-z0-9:./-]+)?)/g;function hZ(r,e={}){return r.replace(pZ,(t,n,i)=>{let s=(0,JA.getResolver)(n);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,JA.isResolverModifierAware)(n)?o:o+i})}a(hZ,"resolveTemplateBody");function mZ(r){let e=r.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);return e?r.slice(e[0].length):r}a(mZ,"stripTemplateFrontmatter")});var Tb=T(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.registerOrderSpecLoader=gZ;Vf.clearOrderSpecLoader=yZ;Vf.loadDefaultSpec=bZ;Vf.orderProperties=_Z;var Eb=null,Ec,vb=!1;function gZ(r){Eb=r,Ec=void 0,vb=!1}a(gZ,"registerOrderSpecLoader");function yZ(){Eb=null,Ec=void 0,vb=!1}a(yZ,"clearOrderSpecLoader");function bZ(){if(Ec!==void 0)return Ec;if(!Eb)return Ec=null,null;try{Ec=Eb()}catch(r){vb||(console.warn("[OrderSpecResolver] loader threw, falling back to insertion order:",r),vb=!0),Ec=null}return Ec}a(bZ,"loadDefaultSpec");function _Z(r,e){if(!e||e.head.length===0&&e.tail.length===0)return r;let t=Object.keys(r),n=new Set(e.head),i=new Set(e.tail),s=e.head.filter(u=>Object.prototype.hasOwnProperty.call(r,u)),o=e.tail.filter(u=>Object.prototype.hasOwnProperty.call(r,u)),c=t.filter(u=>!n.has(u)&&!i.has(u));e.middleStrategy==="alphabetical"&&c.sort((u,f)=>u.localeCompare(f));let l={};for(let u of s)l[u]=r[u];for(let u of c)l[u]=r[u];for(let u of o)l[u]=r[u];return l}a(_Z,"orderProperties")});var si=T(Ab=>{"use strict";Object.defineProperty(Ab,"__esModule",{value:!0});Ab.DI_TOKENS=void 0;Ab.DI_TOKENS={IFileSystemAdapter:Symbol.for("IFileSystemAdapter"),IVaultAdapter:Symbol.for("IVaultAdapter"),IVaultContext:Symbol.for("IVaultContext"),IMultiVaultManager:Symbol.for("IMultiVaultManager"),ILogger:Symbol.for("ILogger"),IEventBus:Symbol.for("IEventBus"),IConfiguration:Symbol.for("IConfiguration"),INotificationService:Symbol.for("INotificationService"),ClassCreationService:Symbol.for("ClassCreationService"),ConceptCreationService:Symbol.for("ConceptCreationService"),GenericAssetCreationService:Symbol.for("GenericAssetCreationService"),TaskStatusService:Symbol.for("TaskStatusService"),EffortStatusWorkflow:Symbol.for("EffortStatusWorkflow"),StatusTimestampService:Symbol.for("StatusTimestampService"),PropertyCleanupService:Symbol.for("PropertyCleanupService"),FolderRepairService:Symbol.for("FolderRepairService"),RenameToUidService:Symbol.for("RenameToUidService"),NoteToRDFConverter:Symbol.for("NoteToRDFConverter"),IVaultSettings:Symbol.for("IVaultSettings"),AreaHierarchyBuilder:Symbol.for("AreaHierarchyBuilder"),ClassHierarchyResolver:Symbol.for("ClassHierarchyResolver")}});var tI=T(Ib=>{"use strict";Object.defineProperty(Ib,"__esModule",{value:!0});Ib.RDFVocabularyMapper=void 0;var xr=Ti(),$k=De(),Te=qt(),eI=class{static{a(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",Te.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",Te.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",Te.Namespace.RDFS.term("subClassOf")],["exo__Property_range",Te.Namespace.RDFS.term("range")],["exo__Property_domain",Te.Namespace.RDFS.term("domain")],["exo__Property_superProperty",Te.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new xr.Triple(Te.Namespace.EXO.term("Asset"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.RDFS.term("Resource"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Class"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.RDFS.term("Class"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Property"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.RDF.term("Property"))),e.push(new xr.Triple(Te.Namespace.EMS.term("Task"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("Project"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("Area"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("Workflow"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("WorkflowState"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("WorkflowTransition"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EXOCMD.term("Command"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EXOCMD.term("Precondition"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EXOCMD.term("Grounding"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EXOCMD.term("CommandBinding"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new xr.Triple(Te.Namespace.EXO.term("Instance_class"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDF.term("type"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Asset_isDefinedBy"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("isDefinedBy"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Class_superClass"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("subClassOf"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Property_range"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("range"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Property_domain"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("domain"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Property_superProperty"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,n){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(n instanceof $k.IRI)s=n;else{let o=Te.Namespace.fromPropertyKey(n);s=o?o.namespace.term(o.localName):new $k.IRI(n)}return new xr.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Ib.RDFVocabularyMapper=eI});var Rb=T(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.OBSIDIAN_VAULT_SCHEME=void 0;ga.vaultPathToIRI=SZ;ga.iriToVaultPath=wZ;ga.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function SZ(r){let e=r.startsWith("./")?r.slice(2):r;return`${ga.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}a(SZ,"vaultPathToIRI");function wZ(r){if(!r.startsWith(ga.OBSIDIAN_VAULT_SCHEME))return null;let e=r.slice(ga.OBSIDIAN_VAULT_SCHEME.length);try{return decodeURI(e)}catch{return null}}a(wZ,"iriToVaultPath")});var xb=T(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.derivePath=Uk;Ph.deriveUrl=EZ;Ph.deriveLegacyFlatPath=vZ;var rI="assetspaces",Cb=/^[A-Za-z0-9._-]+$/;function Uk(r){if(typeof r!="string")return null;let e=r.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 n=t.split("/").filter(o=>o.length>0);if(n.length<2)return null;let i=n[0],s=n[1];return i==="."||i===".."||s==="."||s===".."||!Cb.test(i)||!Cb.test(s)?null:`${rI}/${i}/${s}`}a(Uk,"derivePath");function EZ(r){if(typeof r!="string")return null;let e=r.trim();if(e.length===0)return null;e=e.replace(/^\/+/,"").replace(/\/+$/,"");let t=`${rI}/`;if(!e.startsWith(t))return null;let n=e.slice(t.length).split("/").filter(o=>o.length>0);if(n.length<2)return null;let i=n[0],s=n[1];return i==="."||i===".."||s==="."||s===".."||!Cb.test(i)||!Cb.test(s)?null:`https://github.com/${i}/${s}`}a(EZ,"deriveUrl");function vZ(r){let e=Uk(r);if(e===null)return null;let t=e.split("/")[2];if(t===void 0||t.length===0)return null;let n=t.startsWith("exoas-")?t.slice(6):t;return n.length===0?null:`${rI}/${n}`}a(vZ,"deriveLegacyFlatPath")});var Pb=T(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.FILE_SPACE_CLASS_UID=void 0;Ts.frontmatterDeclaresFileSpace=AZ;Ts.discoverFileSpaceExclusions=RZ;var TZ=xb();Ts.FILE_SPACE_CLASS_UID="aad8913e-5e9f-4047-879d-93cc46befd52";var Bk=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,nI=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Gk(r){let e=Array.isArray(r)?r:[r],t=[];for(let n of e){if(typeof n!="string")continue;Bk.lastIndex=0;let i;for(;(i=Bk.exec(n))!==null;)t.push(i[1].trim())}return t}a(Gk,"wikilinkTargets");function AZ(r){return r?Gk(r.exo__Instance_class).some(e=>nI.test(e)&&e.toLowerCase()===Ts.FILE_SPACE_CLASS_UID):!1}a(AZ,"frontmatterDeclaresFileSpace");function Vk(r,e){try{return r.getFrontmatter(e)}catch{return null}}a(Vk,"readFrontmatterSafe");function IZ(r){let e=r.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=r.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(IZ,"readSource");function RZ(r){let e=[],t=[],n=[],i=new Map,s=a((c,l)=>{if(nI.test(c))return c.toLowerCase()===Ts.FILE_SPACE_CLASS_UID;let u=r.getFirstLinkpathDest(c,l);if(u==null)return!1;let f=i.get(u.path);if(f!==void 0)return f;let p=Vk(r,u)?.exo__Asset_uid,h=typeof p=="string"&&p.toLowerCase()===Ts.FILE_SPACE_CLASS_UID;return i.set(u.path,h),h},"isFileSpaceClassRef"),o=a(c=>c.some(l=>nI.test(l)&&l.toLowerCase()===Ts.FILE_SPACE_CLASS_UID),"hasUuidFormRef");for(let c of r.getAllFiles()){let l=Vk(r,c);if(!l)continue;let u=Gk(l.exo__Instance_class);if(!u.some(h=>s(h,c.path)))continue;t.push(c.path),o(u)||n.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 [[${Ts.FILE_SPACE_CLASS_UID}]] (UID-canon)`);let f=IZ(l);if(f===null){n.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,TZ.derivePath)(f);if(d===null){n.push(`FileSpace declaration ${c.path}: cannot derive mount path from source "${f}" \u2014 content NOT excluded from the index`);continue}let p=`${d}/`;c.path.startsWith(p)&&n.push(`FileSpace declaration ${c.path} lies INSIDE its own mount ${p} \u2014 it will be excluded from the index together with the content; move the declaration outside the mount folder`),e.push(p)}return{prefixes:e,declarationPaths:t,warnings:n}}a(RZ,"discoverFileSpaceExclusions")});var Hl=T(Lt=>{"use strict";var CZ=Lt&&Lt.__decorate||function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[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},xZ=Lt&&Lt.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qk=Lt&&Lt.__param||function(r,e){return function(t,n){e(t,n,r)}},oI;Object.defineProperty(Lt,"__esModule",{value:!0});Lt.NoteToRDFConverter=Lt.LEGACY_YAML_KEYS=Lt.LEGACY_UNPREFIXED_ASSET_FIELDS=Lt.UNPREFIXED_ASSET_FIELDS=void 0;Lt.canonicalYamlKey=LZ;Lt.isPosixBracketExpression=Hk;Lt.normaliseExcludedFolders=Kk;Lt.isPathExcluded=Yk;var iI=lt(),Pr=Ti(),As=De(),Mn=He(),Wk=sr(),Zt=qt(),zk=si(),PZ=tI(),OZ=ih(),sI=Rb(),Oi=Zv(),FZ=Pb();Lt.UNPREFIXED_ASSET_FIELDS=new Set(["draft","pinned","aliases"]);Lt.LEGACY_UNPREFIXED_ASSET_FIELDS=new Set(["archived"]);Lt.LEGACY_YAML_KEYS=new Map([...Lt.LEGACY_UNPREFIXED_ASSET_FIELDS].map(r=>[`exo__Asset_${r}`,[r]]));var DZ=/^exo__Asset_(.+)$/;function LZ(r){let e=DZ.exec(r);return e&&Lt.UNPREFIXED_ASSET_FIELDS.has(e[1])?e[1]:Lt.LEGACY_UNPREFIXED_ASSET_FIELDS.has(r)?`exo__Asset_${r}`:r}a(LZ,"canonicalYamlKey");function Hk(r){return/^:[^\s[\]|]+:$/.test(r)}a(Hk,"isPosixBracketExpression");function Kk(r){return Array.isArray(r)?r.map(e=>String(e).replace(/\\/g,"/").trim()).filter(e=>e.length>0).map(e=>e.endsWith("/")?e:`${e}/`):[]}a(Kk,"normaliseExcludedFolders");function Yk(r,e){if(e.length===0)return!1;let t=r.replace(/\\/g,"/");for(let n of e)if(t.startsWith(n))return!0;return!1}a(Yk,"isPathExcluded");function NZ(r){if(!r)return"";let e=r.replace(/\\/g,"/");for(;e.startsWith("/");)e=e.slice(1);for(;e.endsWith("/");)e=e.slice(0,-1);return e.length>0?`${e}/`:""}a(NZ,"normaliseSubjectIriPrefix");var zl=oI=class{static{a(this,"NoteToRDFConverter")}constructor(e,t=OZ.NullLogger,n={}){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.pendingExtraTriples=[],this.preResolvedTargetFm=new Map,this.vocabularyMapper=new PZ.RDFVocabularyMapper,this.subjectIriPrefix=NZ(n.subjectIriPrefix),this.emitInstanceClassAsUid=n.emitInstanceClassAsUid??!1}async convertNote(e){let t=this.vault.getFrontmatterWithFallback?await this.vault.getFrontmatterWithFallback(e):this.vault.getFrontmatter(e);return this.convertNoteFromFrontmatter(e,t)}async convertNoteFromFrontmatter(e,t){if(!t)return[];await this.preResolveWikilinkTargets(t);let n=this.notePathToIRI(e.path),i=Zt.Namespace.EXO.term("Asset_filename"),s=new Pr.Triple(n,i,new Mn.Literal(e.basename));if(Oi.Exo003Parser.isExo003Format(t)){let o=await this.convertExo003Note(e,t);return[s,...o]}return this.convertLegacyNote(e,t,s)}async convertLegacyNote(e,t,n){this.pendingExtraTriples=[];let i=[n],s=this.notePathToIRI(e.path),o,c,l,u=!1,f=Zt.Namespace.EXO.term("Statement").value;for(let[m,b]of Object.entries(t)){if(Lt.LEGACY_UNPREFIXED_ASSET_FIELDS.has(m)&&Object.prototype.hasOwnProperty.call(t,`exo__Asset_${m}`))continue;let _=Lt.UNPREFIXED_ASSET_FIELDS.has(m)||Lt.LEGACY_UNPREFIXED_ASSET_FIELDS.has(m)?`exo__Asset_${m}`:m;if(!this.isExocortexProperty(_))continue;let S=this.propertyKeyToIRI(_),I=Array.isArray(b)?b:[b];for(let E of I)if(!((m==="exo__Asset_label"||Lt.UNPREFIXED_ASSET_FIELDS.has(m)||Lt.LEGACY_UNPREFIXED_ASSET_FIELDS.has(m))&&(E==null||typeof E=="string"&&E.trim()==="")))if(m==="exo__Instance_class"){let w=this.valueToClassURI(E);i.push(new Pr.Triple(s,S,w))}else{let w=await this.valueToRDFObject(E,e,S);if(_==="exo__Statement_subject"&&o===void 0){let R=w.find(x=>x instanceof As.IRI);R&&(o=R)}else if(_==="exo__Statement_predicate"&&c===void 0){let R=w.find(x=>x instanceof As.IRI);R&&(c=R)}else _==="exo__Statement_object"&&l===void 0&&(l=w[0]);for(let R of w)if(i.push(new Pr.Triple(s,S,R)),this.vocabularyMapper.hasMappingFor(m)&&R instanceof As.IRI){let x=this.vocabularyMapper.generateMappedTriple(s,m,R);x&&i.push(x)}}if(m==="exo__Instance_class")for(let E of I){let w=this.valueToClassURI(E);if(w instanceof As.IRI){let R=Zt.Namespace.RDF.term("type");i.push(new Pr.Triple(s,R,w)),w.value===f&&(u=!0)}}if(m==="exo__Asset_label"){let E=Zt.Namespace.RDFS.term("label");for(let w of I)typeof w=="string"&&w.length>0&&i.push(new Pr.Triple(s,E,new Mn.Literal(w)))}}let d="exo__Instance_class"in t||"exo__Asset_uid"in t,p=t.exo__Asset_label,h="exo__Asset_label"in t&&p!==null&&p!==void 0&&!(typeof p=="string"&&p.trim()==="")&&!(Array.isArray(p)&&p.length===0);if(d&&!h){let m=Zt.Namespace.RDFS.term("label"),b=Zt.Namespace.EXO.term("Asset_label"),_=new Mn.Literal(e.basename);i.push(new Pr.Triple(s,m,_)),i.push(new Pr.Triple(s,b,_))}i.push(...this.pendingExtraTriples),this.pendingExtraTriples=[],u&&o&&c&&l&&i.push(new Pr.Triple(o,c,l));let g=await this.convertBodyWikilinks(e,s);return i.push(...g),i}async convertExo003Note(e,t){let n=Oi.Exo003Parser.parse(t);if(!n.success||!n.metadata)return[];let i=n.metadata,s=[];switch(i.metadata){case Oi.Exo003MetadataType.Namespace:break;case Oi.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Oi.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Oi.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Oi.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let n=this.notePathToIRI(e.path),i=new As.IRI(t.uri);return[new Pr.Triple(n,Zt.Namespace.OWL.term("sameAs"),i),new Pr.Triple(i,Zt.Namespace.OWL.term("sameAs"),n)]}convertExo003BlankNode(e,t){let n=this.notePathToIRI(e.path),i=t.uri.replace(/[^a-zA-Z0-9_-]/g,"_");return[new Pr.Triple(n,Zt.Namespace.OWL.term("sameAs"),new Wk.BlankNode(i))]}convertExo003Statement(e,t){let n=[];try{let i=this.createExo003ReferenceResolver(e),s=Oi.Exo003Parser.toTriple(t,i);n.push(s);let o=this.notePathToIRI(e.path);n.push(new Pr.Triple(o,Zt.Namespace.RDF.term("value"),s.subject))}catch{}return n}async convertExo003Body(e,t){let n=[];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 As.IRI(c.value):new Wk.BlankNode(c.value),f=new As.IRI(l.value),d=Oi.Exo003Parser.toLiteral(t,s.trim());n.push(new Pr.Triple(u,f,d));let p=this.notePathToIRI(e.path);n.push(new Pr.Triple(p,Zt.Namespace.RDF.term("value"),u))}catch{}return n}createExo003ReferenceResolver(e){return t=>{let n=this.extractWikilink(t),i=n||t,s=this.vault.getFirstLinkpathDest(i,e.path);if(s){let o=this.targetFrontmatter(s);if(o&&Oi.Exo003Parser.isExo003Format(o)){let c=Oi.Exo003Parser.parse(o);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Oi.Exo003MetadataType.Anchor||l.metadata===Oi.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Oi.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!n&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(e={}){return(await this.convertVaultWithValidation({strict:!1,excludedFolders:e.excludedFolders,onFileTriples:e.onFileTriples})).triples}async convertVaultWithValidation(e={}){let t=e.files??this.vault.getAllFiles(),n=[],i=[],s=e.strict??!1,o=0,c=0,l=e.fileSpacePrefixes?{prefixes:e.fileSpacePrefixes,declarationPaths:[],warnings:[]}:(0,FZ.discoverFileSpaceExclusions)(this.vault);for(let m of l.warnings)this.logger.warn(`FileSpace discovery: ${m}`);let u=[...Kk(e.excludedFolders),...l.prefixes],f=u.length===0?t:t.filter(m=>!Yk(m.path,u)),d=e.onProgress,p=e.progressIntervalFiles&&e.progressIntervalFiles>0?e.progressIntervalFiles:oI.INDEX_PROGRESS_INTERVAL,h=f.length,g=0;for(let m of f){if(g++,d&&g%p===0&&g<h)try{d(g,h)}catch{}try{let b=this.vault.getFrontmatter(m),_=b?this.validateExocortexAsset(b,m.basename):null;if(_){if(s)throw new Error(`Invariant violation in "${m.path}": ${_.message}`);i.push({path:m.path,reason:`Invariant violation: ${_.message}`}),o++,this.logger.info(`Skipping file with invariant violation: ${m.path}`,{code:_.code,property:_.property,reason:_.message});continue}let S=await this.convertNote(m);if(n.push(...S),e.onFileTriples)try{e.onFileTriples(m,S)}catch{}}catch(b){let _=b instanceof Error?b.message:String(b);if(s)throw new Error(`Invalid IRI for file "${m.path}": ${_}`);i.push({path:m.path,reason:`Invalid IRI: ${_}`}),c++,this.logger.info(`Skipping file with invalid IRI: ${m.path}`,{reason:_})}}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:n,skippedFiles:i,summary:{total:f.length,indexed:f.length-i.length,skipped:i.length},fileSpaces:l}}static inferLabelFromBasename(e){return Zt.Namespace.fromPropertyKey(e)!==null?e:null}validateExocortexAsset(e,t){let n=a(d=>d==null?!0:typeof d=="string"?d.trim()==="":Array.isArray(d)?d.length===0||d.every(n):!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(n(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&&n(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 p=this.removeQuotes(d),g=(this.extractWikilink(p)??p).trim(),m=g.indexOf("__");m>0&&Zt.Namespace.isValidPrefix(g.slice(0,m))&&/[\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 n of e){let i=(0,sI.vaultPathToIRI)(n.path);As.IRI.isValidIRI(i)||t.push({path:n.path,reason:`Path "${n.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new As.IRI((0,sI.vaultPathToIRI)(`${this.subjectIriPrefix}${e}`))}synthesizeWikilinkTargetIRI(e){return new As.IRI((0,sI.vaultPathToIRI)(e))}isExocortexProperty(e){return Zt.Namespace.fromPropertyKey(e)!==null}propertyKeyToIRI(e){let t=Zt.Namespace.fromPropertyKey(e);if(!t)throw new Error(`Invalid property key: ${e}`);return t.namespace.term(t.localName)}emitTypeTripleForEnumInstance(e,t){let n=this.targetFrontmatter(t);if(!n)return;let i=n.exo__Instance_class,s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return;let o=this.valueToClassURI(s);o instanceof As.IRI&&(this.pendingExtraTriples.push(new Pr.Triple(e,Zt.Namespace.RDF.term("type"),o)),this.pendingExtraTriples.push(new Pr.Triple(e,Zt.Namespace.EXO.term("Instance_class"),o)))}async valueToRDFObject(e,t,n){if(typeof e=="string"){let i=this.removeQuotes(e);if(n?.value.endsWith("#TokenInvocation_parameter"))return[new Mn.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 Mn.Literal(u);if(n?.value.endsWith("#Grounding_targetValueRef")||n?.value.endsWith("#Grounding_targetValueSubstitution")||n?.value.endsWith("#Grounding_targetClass")||n?.value.endsWith("#Grounding_type")||n?.value.endsWith("#PropertyDefault_value"))return[l];let h=this.expandClassValue(o.basename);if(h)return this.emitTypeTripleForEnumInstance(h,o),[h];let g=this.targetFrontmatter(o);if(g){let I=g.exo__Asset_label;if(typeof I=="string"){let E=this.expandClassValue(I);if(E)return this.emitTypeTripleForEnumInstance(E,o),[E]}}let m=n?.value.endsWith("#Asset_prototype")||n?.value.endsWith("/Asset_prototype"),_=((typeof process<"u"?process.env:void 0)?.EXOCORTEX_DUAL_STORAGE_PREDICATES??"").split(",").map(I=>I.trim()).filter(Boolean),S=_.length>0&&_.some(I=>n?.value.endsWith(`#${I}`));return m||S?[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 Mn.Literal(i)]}if(this.isClassReference(i)){let o=this.expandClassValue(i);if(o)return[o]}return this.isISO8601DateTime(i)?[new Mn.Literal(i,Zt.Namespace.XSD.term("dateTime"))]:[new Mn.Literal(i)]}return typeof e=="boolean"?[new Mn.Literal(e.toString())]:typeof e=="number"?[new Mn.Literal(e.toString(),Number.isInteger(e)?Zt.Namespace.XSD.term("integer"):Zt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new Mn.Literal(e.toISOString(),Zt.Namespace.XSD.term("dateTime"))]:[new Mn.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 n=t[1];return n.includes("|")?n.split("|")[0]:n}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let n=t[1],i=n.indexOf("|");return i>=0?n.substring(i+1).trim():null}targetFrontmatter(e){return this.vault.getFrontmatter(e)??this.preResolvedTargetFm.get(e.path)??null}async preResolveWikilinkTargets(e){let t=this.vault.getFrontmatterWithFallback?.bind(this.vault);if(t)for(let n of Object.values(e)){let i=Array.isArray(n)?n:n==null?[]:[n];for(let s of i){if(typeof s!="string")continue;let o=this.removeQuotes(s),c=this.extractWikilink(o);if(!c||!this.isUUID(c))continue;let l=this.vault.getFirstLinkpathDest(c,"");!l||this.preResolvedTargetFm.has(l.path)||this.vault.getFrontmatter(l)||this.preResolvedTargetFm.set(l.path,await t(l))}}}valueToClassURI(e){if(typeof e!="string")return new Mn.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 this.emitInstanceClassAsUid?this.notePathToIRI(c.path):l;let u=this.targetFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return this.emitInstanceClassAsUid?this.notePathToIRI(c.path):d}}return this.notePathToIRI(c.path)}}return new Mn.Literal(t)}isClassReference(e){return/\s/.test(e)?!1:Zt.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),n=Zt.Namespace.fromPropertyKey(t);return!n||/[\s()]/.test(n.localName)?null:n.namespace.term(n.localName)}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,n,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(n=i.exec(e))!==null;)n[1]&&!Hk(n[1].trim())&&t.add(n[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let n=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),o=this.extractBodyWikilinks(s),c=Zt.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);n.push(new Pr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?n.push(new Pr.Triple(t,c,f)):n.push(new Pr.Triple(t,c,new Mn.Literal(l)))}else n.push(new Pr.Triple(t,c,new Mn.Literal(l)))}}catch{}return n}};Lt.NoteToRDFConverter=zl;zl.INDEX_PROGRESS_INTERVAL=200;zl.SkippedFileInfo=class{constructor(r,e){this.path=r,this.reason=e}};zl.VaultValidationResult=class{constructor(r,e,t){this.triples=r,this.skippedFiles=e,this.summary=t}};zl.VaultValidationOptions=class{constructor(r=!1){this.strict=r}};Lt.NoteToRDFConverter=zl=oI=CZ([(0,iI.injectable)(),qk(0,(0,iI.inject)(zk.DI_TOKENS.IVaultAdapter)),qk(1,(0,iI.inject)(zk.DI_TOKENS.ILogger)),xZ("design:paramtypes",[Object,Object,Object])],zl)});var Kl=T(Fb=>{"use strict";Object.defineProperty(Fb,"__esModule",{value:!0});Fb.FrontmatterService=void 0;var Xk=Tb(),aI=Ll(),Gf=Hl(),kZ=ca(),Ob=class r{static{a(this,"FrontmatterService")}parse(e){let t=e.match(r.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 n={},i=t.content.split(/\r?\n/),s=null,o=null,c=a(()=>{s!==null&&o!==null&&(n[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(),p=f[2].trim();p===""?(s=d,o=[]):n[d]=p}return c(),n}updateProperty(e,t,n){t=(0,Gf.canonicalYamlKey)(r.normalizeIRI(t)),typeof n=="string"&&(n=r.normalizeIRIValue(n));let i=this.parse(e),s=this.serializeValue(t,n);if(!i.exists)return`---
116
+ ${n}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let n=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?n+=`@${e.language}`:e.datatype&&(n+=`^^<${e.datatype}>`),n}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(n=>this.generateExpression(n)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),n=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${n})`:`${t} IN (${n})`}default:throw new Mf(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let n of e.triples)this.collectVariablesFromTriple(n,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 n of e.variables)t.add(n);break;case"project":for(let n of e.variables)t.add(n);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 n of e.variables)t.add(n);for(let n of e.aggregates)t.add(n.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 n of e.operands)this.collectVariablesFromExpression(n,t);break;case"function":case"functionCall":for(let n of e.args)this.collectVariablesFromExpression(n,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let n of e.list)this.collectVariablesFromExpression(n,t);break}}};jf.SPARQLGenerator=GA});var Uf=T(Pi=>{"use strict";var YQ=Pi&&Pi.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),XQ=Pi&&Pi.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Tk=Pi&&Pi.__importStar||(function(){var r=a(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&YQ(t,e,n[i]);return XQ(t,e),t}})();Object.defineProperty(Pi,"__esModule",{value:!0});Pi.QueryExecutor=Pi.ExoQLQueryExecutor=Pi.QueryExecutorError=void 0;var QQ=fA(),JQ=eb(),ZQ=PA(),eJ=FA(),tJ=lk(),rJ=fk(),nJ=mk(),iJ=UA(),sJ=yk(),oJ=_k(),aJ=Ek(),cJ=vk(),lJ=De(),uJ=He(),fJ=H0(),Sn="http://www.w3.org/2001/XMLSchema#",dJ=new Set([`${Sn}integer`,`${Sn}decimal`,`${Sn}float`,`${Sn}double`,`${Sn}nonPositiveInteger`,`${Sn}negativeInteger`,`${Sn}long`,`${Sn}int`,`${Sn}short`,`${Sn}byte`,`${Sn}nonNegativeInteger`,`${Sn}unsignedLong`,`${Sn}unsignedInt`,`${Sn}unsignedShort`,`${Sn}unsignedByte`,`${Sn}positiveInteger`]),$f=class extends Error{static{a(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};Pi.QueryExecutorError=$f;var cb=class{static{a(this,"ExoQLQueryExecutor")}constructor(e,t={}){let n=t.resolveClassHierarchy===!1?e:new aJ.ClassHierarchyResolvingStore(e);this.tripleStore=n,this.bgpExecutor=new QQ.BGPExecutor(n),this.filterExecutor=new JQ.FilterExecutor,this.optionalExecutor=new ZQ.OptionalExecutor,this.unionExecutor=new eJ.UnionExecutor,this.minusExecutor=new tJ.MinusExecutor,this.valuesExecutor=new rJ.ValuesExecutor,this.aggregateExecutor=new nJ.AggregateExecutor,this.constructExecutor=new iJ.ConstructExecutor,this.serviceExecutor=new sJ.ServiceExecutor(t.serviceConfig),this.graphExecutor=new oJ.GraphExecutor(n),this.sparqlGenerator=new cJ.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(i,s)=>this.evaluateExistsPattern(i,s)),this.filterExecutor.setTripleStore(n)}async evaluateExistsPattern(e,t){let n=this.substituteVariables(e,t);for await(let i of this.execute(n))if(t.merge(i)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let n of this.execute(e))t.push(n);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 $f(`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 n=new Set;for(let o of t)for(let c of o.variables())n.add(c);let i=this.collectOperationVariables(e.right);if([...n].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 n=[];for await(let o of this.execute(e.right))n.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of n)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 n=[];for await(let o of this.execute(e.right))n.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of n)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 n=[];for await(let o of this.execute(e.right))n.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of n)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(()=>Tk(da())),n=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let o of i.variables())if(n.has(o)){let c=i.get(o);c!==void 0&&s.set(o,c)}yield s}}async*executeOrderBy(e){let t=[];for await(let n of this.execute(e.input))t.push(n);t.sort((n,i)=>{for(let s of e.comparators){let o=this.getExpressionValue(s.expression,n),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 n of t)yield n}async*executeSlice(e){let t=0,n=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=n){if(i!==void 0&&t-n>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let n of this.execute(e.input)){let i=this.getSolutionKey(n);t.has(i)||(t.add(i),yield n)}}async*executeReduced(e){let t=new Set;for await(let n of this.execute(e.input)){let i=this.getSolutionKey(n);t.has(i)||(t.add(i),yield n)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let n=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of n)e.having.every(o=>this.filterExecutor.evaluateExpression(o,i)===!0)&&(yield i);else for(let i of n)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let n of this.execute(e.input)){let i=n.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,n):this.evaluateExtendExpression(e.expression,n);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 n of this.execute(e.left))t.push(n);for(let n of t){let i=this.substituteVariables(e.right,n);for await(let s of this.execute(i)){let o=n.merge(s);o!==null&&(yield o)}}}substituteVariables(e,t){let n=JSON.parse(JSON.stringify(e));return this.substituteInOperation(n,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let n=e;return e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(n.input&&(n.input=this.substituteInOperation(n.input,t)),n.left&&(n.left=this.substituteInOperation(n.left,t)),n.right&&(n.right=this.substituteInOperation(n.right,t)),n.pattern&&(n.pattern=this.substituteInOperation(n.pattern,t)),n.query&&(n.query=this.substituteInOperation(n.query,t)),n.where&&(n.where=this.substituteInOperation(n.where,t)),n.expression&&this.substituteInExpression(n.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.type==="variable"&&typeof e.name=="string"){let n=this.termToAlgebraNode(t.get(e.name));if(n!==null){delete e.name;for(let[i,s]of Object.entries(n))e[i]=s}}if(e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let n of e.operands)this.substituteInExpression(n,t);if(e.args)for(let n of e.args)this.substituteInExpression(n,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let n of e.list)this.substituteInExpression(n,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 n=this.termToAlgebraNode(t.get(e.value));if(n!==null)return n}return e}termToAlgebraNode(e){if(e==null)return null;let t=e;return e instanceof lJ.IRI||t.termType==="NamedNode"?{type:"iri",value:e.value}:t.termType==="Literal"||typeof t.value=="string"?{type:"literal",value:t.value,datatype:t.datatype?.value??t._datatype?.value,language:t.language??t._language}:null}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(n,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{n.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(n,i):yield*this.execute(n)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:n}=await Promise.resolve().then(()=>Tk(da()));yield new n;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 n=t.get(e.name);if(!n)return;if(n instanceof uJ.Literal){let i=n.datatype?.value;if(i===`${Sn}dayTimeDuration`)try{return fJ.DateTimeFunctions.parseDayTimeDuration(n.value)}catch{return n.value}if(i&&dJ.has(i)){let s=parseFloat(n.value);if(!Number.isNaN(s))return s}return n.value}return n.value??n.id??String(n)}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 n=e;if(n.type==="bgp"&&n.triples)for(let i of n.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(n.type==="values"&&n.variables)for(let i of n.variables)t.add(i);n.expression&&this.collectVarsFromExpressionTree(n.expression,t),n.type==="extend"&&n.variable&&t.add(n.variable),n.input&&this.collectVarsFromOperation(n.input,t),n.left&&this.collectVarsFromOperation(n.left,t),n.right&&this.collectVarsFromOperation(n.right,t),n.pattern&&this.collectVarsFromOperation(n.pattern,t),n.query&&this.collectVarsFromOperation(n.query,t),n.where&&this.collectVarsFromOperation(n.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let n=e;n.type==="variable"&&t.add(n.value),n.type==="quoted"&&(this.collectVarsFromElement(n.subject,t),this.collectVarsFromElement(n.predicate,t),this.collectVarsFromElement(n.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let n=e;if(n.type==="variable"&&n.name&&t.add(n.name),n.type==="exists"&&n.pattern&&this.collectVarsFromOperation(n.pattern,t),n.left&&this.collectVarsFromExpressionTree(n.left,t),n.right&&this.collectVarsFromExpressionTree(n.right,t),n.operands)for(let i of n.operands)this.collectVarsFromExpressionTree(i,t);if(n.args)for(let i of n.args)this.collectVarsFromExpressionTree(i,t);if(n.expression&&this.collectVarsFromExpressionTree(n.expression,t),n.list)for(let i of n.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 $f("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 $f("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};Pi.ExoQLQueryExecutor=cb;Pi.QueryExecutor=cb});var Lk=T(pa=>{"use strict";var pJ=pa&&pa.__decorate||function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[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},hJ=pa&&pa.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)};Object.defineProperty(pa,"__esModule",{value:!0});pa.CommandResolver=void 0;var mJ=lt(),gJ=ih(),yJ=Ll(),hr=De(),cr=He(),z=qt(),Ak=cc(),Ik=jp(),bJ=sf(),Rk=ca(),_J=CT(),Bf=mv(),Ck=hN(),SJ=mf(),wJ=wf(),EJ=Uf(),Wl=10,lb="exo__Asset",vJ=Wl+1,xk="08cec529-90eb-4d43-88de-ceecccea12b0",TJ=z.Namespace.EXOCMD.term("SubstitutionToken").value,Pk=new Set(["today","tomorrow","todayStart","targetFolder","target","randomUUIDv4","nowTimestamp","nowDate","nowYear","nowMonth","userInputLabel","userInput","targetProperty","targetRefProperty","labelAsArray","groundingTargetClass","createdInstance","targetClassSelf"]);function AJ(r,e){return`__SUBSTITUTE__${r}__${e}__`}a(AJ,"buildSubstitutionMarker");function IJ(r,e,t){let n=(0,bJ.utf8ToBase64)(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`__SUBSTITUTE_P__${r}__${e}__${n}__`}a(IJ,"buildParameterisedMarker");var Ok="3f28af98-c031-4718-8ba2-44ad0b012c52",RJ=z.Namespace.EXOCMD.term("TokenInvocation").value,Fk="29e2c8f8-2d27-4e58-b467-2e85d46f8122",Dk="universal-default-template",qA=class{static{a(this,"CommandResolver")}clearUniversalCache(){this._universalCacheReady=!1,this._universalCacheValue=null}constructor(e,t=gJ.NullLogger){this.tripleStore=e,this.logger=t,this.cache=new Map,this.multiCache=new Map,this._ancestorDepthCache=new Map,this._legacyPropertyDefaultsWarnedGroundings=new Set,this._fallbackWarnedKeys=new Set,this._universalCacheReady=!1,this._universalCacheValue=null}async resolveForAssetMulti(e,t,n){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${n??""}`,o=this.multiCache.get(s);if(o)return o;let c=n?await this.expandPrototypeChain(n):void 0,l=await this.expandClassHierarchy(t),u=new Map;for(let[h,g]of l){let m=await this.resolveForAsset(e,h,c);for(let b of m){let _=this.getBindingPriority(b.binding)===2?g:0,S=u.get(b.binding.id);(!S||_<S.depth)&&u.set(b.binding.id,{rc:b,depth:_})}}let f=new Set;for(let{rc:h}of u.values())if(h.binding.overrides)for(let g of h.binding.overrides)f.add(g);let d=Array.from(u.entries()).filter(([h])=>!f.has(h)).map(([,h])=>h);d.sort((h,g)=>{let m=this.getBindingPriority(h.rc.binding),b=this.getBindingPriority(g.rc.binding);return m!==b?m-b:h.depth!==g.depth?h.depth-g.depth:(h.rc.binding.order??100)-(g.rc.binding.order??100)});let p=d.map(h=>h.rc);return this.multiCache.set(s,p),p}async expandClassHierarchy(e){let t=new Map;for(let c of e){if(c===lb){t.set(c,new Set);continue}let l=[];try{l=await this.getClassAncestors(c)}catch{l=[]}t.set(c,new Set(l))}let n=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=>!n(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===lb)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(lb)||s.set(lb,vJ),s}async resolveForAsset(e,t,n){let i=typeof n=="string"?`s:${n}`:n?`c:${n.join("\0")}`:"",s=`${e}:${t}:${i}`,o=this.cache.get(s);if(o)return o;let c=typeof n=="string"?await this.expandPrototypeChain(n):n,l=await this.findBindings(t,c,e),u=[];for(let f of l){let d=await this.loadCommand(f.commandRef,{targetClass:f.targetClass});if(!d)continue;let p=f.precondition?{...d,precondition:f.precondition}:d;u.push({command:p,binding:f})}return u.sort((f,d)=>{let p=this.getBindingPriority(f.binding),h=this.getBindingPriority(d.binding);return p!==h?p-h:(f.binding.order??100)-(d.binding.order??100)}),this.cache.set(s,u),u}async loadCommand(e,t){let n=await this.findSubjectByUID(e);if(!n||(await this.tripleStore.match(n,z.Namespace.RDF.term("type"),z.Namespace.EXOCMD.term("Command"))).length===0)return null;let s=await this.readAssetLabel(n)??"Unknown Command",o=await this.getLiteralValue(n,z.Namespace.EXOCMD.term("Command_labelTemplate")),c=await this.getLiteralValue(n,z.Namespace.EXOCMD.term("Command_icon")),l=await this.getLiteralValue(n,z.Namespace.EXOCMD.term("Command_confirmMessage")),u=await this.getLiteralValue(n,z.Namespace.EXOCMD.term("Command_successMessage")),f=await this.getLiteralValue(n,z.Namespace.EXOCMD.term("Command_category")),d=await this.getLiteralValue(n,z.Namespace.EXOCMD.term("Command_openInSameTab")),p=d!==null&&String(d).trim().toLowerCase()==="true",h=await this.loadLinkedPrecondition(n),g=await this.loadLinkedGrounding(n,0,t);return g?{id:e,name:s,labelTemplate:o??void 0,icon:c??void 0,precondition:h??void 0,grounding:g,confirmMessage:l??void 0,successMessage:u??void 0,category:f??void 0,openInSameTab:p||void 0}:null}async findBindings(e,t,n){let i=typeof t=="string"?await this.expandPrototypeChain(t):t,s=await this.tripleStore.match(void 0,z.Namespace.RDF.term("type"),z.Namespace.EXOCMD.term("CommandBinding")),o=[];for(let c of s){let l=c.subject,u=await this.loadBindingDefinition(l);u&&this.bindingMatches(u,e,i,n)&&o.push(u)}return o}async findPaletteEnabledCommands(){let e=await this.tripleStore.match(void 0,z.Namespace.RDF.term("type"),z.Namespace.EXOCMD.term("Command")),t=[],n=new Set;for(let i of e){let s=i.subject;if((await this.getLiteralValue(s,z.Namespace.EXOCMD.term("Command_paletteEnabled")))?.toLowerCase()!=="true")continue;let c=await this.getLiteralValue(s,z.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,z.Namespace.EXOCMD.term("Command_paletteId")),f=await this.getLiteralValue(s,z.Namespace.EXOCMD.term("Command_cliName")),d=u??f??c;if(n.has(d)){this.logger.warn(`[CommandResolver] duplicate paletteId "${d}" \u2014 first registration wins, dropping ${c}`);continue}n.add(d),t.push({command:l,paletteId:d})}return t}invalidateCache(){this.cache.clear(),this.multiCache.clear(),this._ancestorDepthCache.clear(),this.clearUniversalCache()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let n=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:o}of i){let c=await this.evaluateSelectSnippet(o,t);n=n.replace(s,c)}return n}extractPlaceholders(e){let t=[],n=0;for(;n<e.length;)if(e[n]==="{"){let i=1,s=n+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let o=e.slice(n,s),c=e.slice(n+1,s-1);t.push({full:o,body:c})}n=s}else n++;return t}async evaluateSelectSnippet(e,t){try{let n=e.replace(/\$target/g,`<${t}>`),s=new SJ.ExoQLParser().parse(n),c=new wJ.ExoQLAlgebraTranslator().translate(s),u=await new EJ.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let p=f.get(d[0]);return p?p instanceof cr.Literal||p instanceof hr.IRI?p.value:String(p):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,z.Namespace.EXO.term("Asset_uid"));if(!t)return null;let n=await this.readAssetLabel(e)??"",i=await this.getLinkedUID(e,z.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,z.Namespace.EXOCMD.term("CommandBinding_targetClass")),o=await this.getLinkedValue(e,z.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,z.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!o&&!c)return null;let l=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,p=await this.loadLinkedPreconditionFromProperty(e,z.Namespace.EXOCMD.term("CommandBinding_precondition")),h=await this.loadLinkedStyle(e,t),g=await this.getLinkedUIDs(e,z.Namespace.EXOCMD.term("CommandBinding_overrides"));return{id:t,label:n,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:p??void 0,style:h??void 0,overrides:g.length>0?g:void 0}}async loadLinkedStyle(e,t){let n=await this.tripleStore.match(e,z.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(n.length>0){let s=n[0].object,o=null;if(s instanceof hr.IRI)o=s;else if(s instanceof cr.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,z.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,z.Namespace.EXO.term("Asset_uid"));if(!t)return null;let n=await this.readAssetLabel(e)??"",i=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,o=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(o),l=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),p=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),h=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("CommandBindingStyle_source")),g=h!==null?this.coerceStyleSource(h,t):void 0;return{id:t,label:n,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:p??void 0,source:g,inline:!1}}coerceVariant(e,t){if(e==null)return;let n=String(e).trim().toLowerCase();if(n!==""){if(Bf.COMMAND_VARIANT_VALUES.includes(n))return n;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${n}" not in whitelist [${Bf.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let n=String(e).trim().toLowerCase();if(n!==""){if(Bf.LABEL_CLASS_VALUES.includes(n))return n;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${n}" not in whitelist [${Bf.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let n=String(e).trim().toLowerCase();if(n!==""){if(Bf.STYLE_SOURCE_VALUES.includes(n))return n;this.logger.warn(this.capWarning(`CommandBindingStyle source "${n}" not in whitelist [${Bf.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,n,i){if(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i))return!0;if(e.targetPrototype&&n){for(let s of n)if(this.matchesReference(e.targetPrototype,s))return!0}return!!(e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let n=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(n===i)return!0;let s=this.extractPathBasename(i);if(s&&s===n)return!0;let o=this.extractPathBasename(n);if(o&&o===i)return!0;let c=this.extractAlias(t);if(c&&n===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(),n=t.indexOf("|");return n>=0?t.substring(n+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,z.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=await this.resolvePreconditionRef(n[0].object);return i?this.loadPreconditionSubject(i,new Set,0):null}async resolvePreconditionRef(e){if(e instanceof hr.IRI)return e;if(e instanceof cr.Literal){let t=this.normalizeWikilink(e.value);return await this.findSubjectByUID(t)}return null}async loadPreconditionSubject(e,t,n){let i=await this.getLiteralValue(e,z.Namespace.EXO.term("Asset_uid")),s=await this.readAssetLabel(e)??"";if(i&&t.has(i))return this.brokenPreconditionNode(i,s);if(n>=Wl)return this.brokenPreconditionNode(i??"",s);let o=await this.tripleStore.match(e,z.Namespace.EXOCMD.term("AllPrecondition_preconditions"),void 0),c=await this.tripleStore.match(e,z.Namespace.EXOCMD.term("AnyPrecondition_preconditions"),void 0),l=await this.tripleStore.match(e,z.Namespace.EXOCMD.term("NotPrecondition_precondition"),void 0);if(o.length>0||c.length>0||l.length>0){let p=new Set(t);if(i&&p.add(i),o.length>0||c.length>0){let g=o.length>0?"all":"any",m=o.length>0?o:c,b=[];for(let _ of m)b.push(await this.loadChildPrecondition(_.object,p,n+1));return{id:i??"",label:s,composite:{op:g,children:b}}}let h=await this.loadChildPrecondition(l[0].object,p,n+1);return{id:i??"",label:s,not:h}}let u=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Precondition_sparqlAsk")),f=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Precondition_hostFunction")),d=await this.loadPreconditionQueryRef(e);return!i||!u&&!f&&!d?null:{id:i,label:s,...u&&{sparqlAsk:u},...f&&{hostFunction:f},...d&&{query:d}}}async loadChildPrecondition(e,t,n){let i=await this.resolvePreconditionRef(e);if(!i){let c=e instanceof cr.Literal?this.normalizeWikilink(e.value):"";return this.brokenPreconditionNode(c,"")}let s=await this.loadPreconditionSubject(i,t,n);if(s)return s;let o=await this.getLiteralValue(i,z.Namespace.EXO.term("Asset_uid"));return this.brokenPreconditionNode(o??"","")}async loadPreconditionQueryRef(e){let t=await this.tripleStore.match(e,z.Namespace.EXOCMD.term("Precondition_query"),void 0);if(t.length===0)return;let n=t[0].object;if(n instanceof hr.IRI)return await this.getLiteralValue(n,z.Namespace.EXO.term("Asset_uid"))??void 0;if(n instanceof cr.Literal)return this.normalizeWikilink(n.value)}brokenPreconditionNode(e,t){return{id:e,label:t,broken:!0}}async loadLinkedGrounding(e,t,n){if(t>=Wl)return null;let i=await this.tripleStore.match(e,z.Namespace.EXOCMD.term("Command_grounding"),void 0);if(i.length===0)return null;if(i.length===1||!n?.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,z.Namespace.EXOCMD.term("Grounding_targetPrototype"));if(l&&this.matchesReference(l,n.targetClass))return this.loadGroundingDefinition(c,t)}this.logger.warn(`Command ${e.value}: ${i.length} groundings declared, none matched context.targetClass='${n.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 hr.IRI)return e;if(e instanceof cr.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>=Wl)return null;let n=await this.getLiteralValue(e,z.Namespace.EXO.term("Asset_uid"));if(!n)return null;let i=await this.readAssetLabel(e)??"",s=await this.resolveGroundingTypeReference(e);if(!s)return null;let o=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_targetProperty"));if(o&&this.looksLikeUUID(o)){let se=await this.resolveLabelByUID(o);if(!se)return this.logger.warn(`Grounding ${n}: targetProperty wikilink UID '${o}' is not resolvable to exo__Asset_label \u2014 grounding skipped (would otherwise write a UUID-named frontmatter key).`),null;o=se}if(s===Ak.GroundingType.SERVICE_CALL){let se=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_serviceId"));se&&(o=se)}let c=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_targetValueRef")),l=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_targetValueLiteral")),u=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_targetValueSubstitution")),f=null;if(u&&this.looksLikeUUID(u)){let se=await this.resolveLabelByUID(u);if(!se)return this.logger.warn(`Grounding ${n}: targetValueSubstitution UID '${u}' is not resolvable to exo__Asset_label (SubstitutionToken instance missing or unlabelled) \u2014 grounding skipped.`),null;f=se}else u&&(f=u);let d=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_targetValueQuery")),p=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_targetQuery")),h=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_serviceCallPayload")),g=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_appendExpression")),m=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_replaceFromExpression")),b=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_replaceToExpression")),_=await this.getObsidianWikilinkValue(e,z.Namespace.EXOCMD.term("Grounding_isDefinedBy")),S=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),I=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_targetClass"));if(I&&!this.looksLikeUUID(I)){let se=await this.findUidByLabel(I);se&&(I=se)}let E=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_targetPrototype")),w=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_targetFolder")),R=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_linkBackProperty")),x=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_inputSchema")),O=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_incrementBy")),N=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_shiftDelta")),G;if(O!=null&&O!==""){let se=Number.parseInt(String(O),10);Number.isFinite(se)&&(G=se)}let j=await this.resolvePropertyDefaults(e,n),ae=await this.resolveInheritanceRules(e,n),Y=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_propertyDefaults"));Y!==null&&Y!==""&&!this._legacyPropertyDefaultsWarnedGroundings.has(n)&&(this.logger.warn(`Grounding ${n}: 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(n));let M;s===Ak.GroundingType.COMPOSITE&&(M=await this.loadCompositeSteps(e,t+1));let ce;if(x)try{let se=JSON.parse(x);se?.properties&&(ce=Object.entries(se.properties).map(([Ae,ge])=>{let ve=ge.type,Re=ve==="string"?ge.format==="asset-reference"?"assetRef":"text":ve,de=ge.defaultValue!==void 0?ge.defaultValue:ge.default,U={name:Ae,type:Re,label:ge.title??Ae,required:Array.isArray(se.required)&&se.required.includes(Ae)};return de!=null&&(U.defaultValue=String(de)),typeof ge.targetClassUid=="string"&&(U.targetClassUid=ge.targetClassUid),U}))}catch{}let q=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_prefillLabelWithDate")),oe=q!==null&&String(q).trim().toLowerCase()==="true",X=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_labelTemplate")),J=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_direction")),ye;if(J!=null){let se=String(J).trim().toLowerCase();se==="forward"||se==="rollback"?ye=se:se!==""&&this.logger.warn(`Grounding ${n}: exocmd__Grounding_direction value '${J}' is not 'forward' or 'rollback' \u2014 treating as undefined (will default to 'forward' at dispatch).`)}let ze=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_bodyTemplate")),Z=await this.getObsidianName(e,z.Namespace.EXOCMD.term("Grounding_templateRef")),W=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_cloneTargetBody")),ee=W!==null&&String(W).trim().toLowerCase()==="true",K=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_targetsCreatedInstance")),ie=K!==null&&String(K).trim().toLowerCase()==="true",Pe=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("Grounding_omitLabel")),$=Pe!==null&&String(Pe).trim().toLowerCase()==="true",fe={id:n,label:i,type:s,targetProperty:o??void 0,targetValueRef:c??void 0,targetValueLiteral:l??void 0,targetValueSubstitution:f??void 0,targetValueQuery:d??void 0,targetQuery:p??void 0,serviceCallPayload:h??void 0,appendExpression:g??void 0,replaceFromExpression:m??void 0,replaceToExpression:b??void 0,sparqlUpdate:S??void 0,steps:M,targetClass:I??void 0,targetPrototype:E??void 0,targetFolder:w??void 0,linkBackProperty:R??void 0,incrementBy:G,shiftDelta:N??void 0,propertyDefault:j.length>0?j:void 0,inheritanceRule:ae.length>0?ae:void 0,isDefinedBy:_??void 0,prefillLabelWithDate:oe||void 0,labelTemplate:X??void 0,direction:ye,bodyTemplate:ze??void 0,templateRef:Z??void 0,cloneTargetBody:ee||void 0,targetsCreatedInstance:ie||void 0,omitLabel:$||void 0};return ce&&(fe.inputSchema=ce),fe}async loadCompositeSteps(e,t){if(t>=Wl)return[];let n=await this.tripleStore.match(e,z.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of n){let o=null;if(s.object instanceof hr.IRI)o=s.object;else if(s.object instanceof cr.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 n=await this.resolvePropertyDefaultsForSubject(e,t,z.Namespace.EXOCMD.term("Grounding_propertyDefault")),i=await this.getUniversalCache();return i&&i.propertyDefaults.length>0?(0,Ck.mergePropertyDefaults)(i.propertyDefaults,n):n}async resolvePropertyDefaultsForSubject(e,t,n){let i=await this.tripleStore.match(e,n,void 0),s=[];for(let o of i){let c=await this.resolveRefTripleObject(o.object);if(!c)continue;let l=await this.getObsidianName(c,z.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,z.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 this.findUniversalSingleton();if(!e)return this.logger.debug("[CommandResolver] No exocmd__UniversalDefaultTemplate instance found in the store; universal property-defaults and inheritance-rules will not be applied. This verdict is cached until invalidateCache() is called \u2014 if the store was still warming up, the next invalidation re-resolves it."),this._universalCacheValue=null,null;let t=await this.resolvePropertyDefaultsForSubject(e,Dk,z.Namespace.EXOCMD.term("Template_propertyDefault")),n=await this.resolveInheritanceRulesForSubject(e,Dk,z.Namespace.EXOCMD.term("Template_inheritanceRule"));return this._universalCacheValue={propertyDefaults:t,inheritanceRules:n},this._universalCacheValue}async findUniversalSingleton(){let e=z.Namespace.EXOCMD.term("UniversalDefaultTemplate"),t=e.value,i=(await this.tripleStore.match(void 0,z.Namespace.EXO.term("Instance_class"),e)).map(c=>c.subject).filter(c=>c instanceof hr.IRI);if(i.length>0)return this.pickUniversalSingleton(i);let s=await this.tripleStore.match(void 0,z.Namespace.EXO.term("Instance_class"),void 0),o=[];for(let c of s){let l=!1;if(c.object instanceof hr.IRI)l=c.object.value===t||c.object.value.includes(Fk);else if(c.object instanceof cr.Literal){let u=this.unwrapWikilink(c.object.value);l=u==="exocmd__UniversalDefaultTemplate"||u===Fk}l&&c.subject instanceof hr.IRI&&o.push(c.subject)}return this.pickUniversalSingleton(o)}pickUniversalSingleton(e){if(e.length===0)return null;if(e.length===1)return e[0];let t=[...e].sort((n,i)=>n.value.localeCompare(i.value));return this.logger.warn(`Multiple UniversalDefaultTemplate singletons found (${t.length}); selecting deterministically by lexicographic UID order: ${t[0].value}`),t[0]}async resolveInheritanceRules(e,t){let n=await this.resolveInheritanceRulesForSubject(e,t,z.Namespace.EXOCMD.term("Grounding_inheritanceRule")),i=await this.getUniversalCache();return i&&i.inheritanceRules.length>0?(0,Ck.mergeInheritanceRules)(i.inheritanceRules,n):n}async resolveInheritanceRulesForSubject(e,t,n){let i=await this.tripleStore.match(e,n,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,z.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,z.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,z.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"),void 0),p,h;if(d.length>0){let E=await this.getObsidianName(l,z.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"));if(!E||!E.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(E)?(h=E,p=await this.resolveLabelByUID(E)??void 0):p=E}let g=await this.tripleStore.match(l,z.Namespace.EXOCMD.term("InheritanceRule_targetClassExclusion"),void 0),m=[],b=[],_=!1;for(let E of g){let w=null;if(E.object instanceof hr.IRI?w=this.iriToObsidianName(E.object.value)??E.object.value:E.object instanceof cr.Literal&&(w=this.unwrapWikilink(E.object.value)),!w){_=!0;continue}if(this.looksLikeUUID(w)){b.push(w);let R=await this.resolveLabelByUID(w);R&&m.push(R)}else m.push(w)}if(_){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 S=await this.getLiteralValue(l,z.Namespace.EXOCMD.term("InheritanceRule_priority")),I=50;if(S!==null&&S!==""){let E=Number.parseInt(String(S),10);Number.isFinite(E)&&(I=E)}s.push({sourcePropertyName:u,targetPropertyName:f,targetClassCondition:p,targetClassConditionUid:h,targetClassExclusion:m,targetClassExclusionUids:b,priority:I})}return s}async resolveRefTripleObject(e){if(e instanceof hr.IRI)return e;if(e instanceof cr.Literal){let t=this.normalizeWikilink(e.value);return t?this.findSubjectByUID(t):null}return null}async resolveLabelRef(e,t){let n=await this.getObsidianName(e,t);return n?this.looksLikeUUID(n)?this.resolveLabelByUID(n):n:null}async resolvePropertyDefaultValue(e,t,n){if(!this.looksLikeUUID(e))return`"[[${e}]]"`;let i=await this.findSubjectByUID(e);if(!i){let c=`${t}|${e}`;return this._fallbackWarnedKeys.has(c)||(this._fallbackWarnedKeys.add(c),this.logger.warn(this.capWarning(`Grounding ${t}: PropertyDefault '${n}' \u2192 value asset ${e} not in store; SKIPPING the property (the executor's own default applies). Previously this emitted a wikilink, i.e. a link written where a value belongs.`))),yJ.STRING_SCALAR_PROPERTIES.has(n)?null:`"[[${e}]]"`}return await this.assetIsTokenInvocation(i)?this.resolveTokenInvocation(i,e,t,n):await this.assetIsSubstitutionToken(i)?this.dispatchSubstitutionToken(i,e,t,n,void 0):(this.logger.debug(`Grounding ${t}: PropertyDefault '${n}' value '${e}' is not a SubstitutionToken \u2014 emitting wikilink form.`),`"[[${e}]]"`)}async dispatchSubstitutionToken(e,t,n,i,s){let o=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("SubstitutionToken_resolver"));if(!o||!o.trim())return this.logger.warn(`Grounding ${n}: PropertyDefault '${i}' references SubstitutionToken '${t}' with no exocmd__SubstitutionToken_resolver \u2014 falling back to wikilink form.`),`"[[${t}]]"`;let c=o.trim();return Pk.has(c)?s!==void 0?IJ(c,t,s):AJ(c,t):(this.logger.warn(`Grounding ${n}: PropertyDefault '${i}' SubstitutionToken '${t}' declares unknown resolver-id '${c}' \u2014 falling back to wikilink form. Known ids: ${Array.from(Pk).join(", ")}.`),`"[[${t}]]"`)}async resolveTokenInvocation(e,t,n,i){let s=await this.getObsidianName(e,z.Namespace.EXOCMD.term("TokenInvocation_token"));if(!s)return this.logger.warn(`Grounding ${n}: PropertyDefault '${i}' TokenInvocation '${t}' missing exocmd__TokenInvocation_token \u2014 entry skipped.`),null;let o=await this.getLiteralValue(e,z.Namespace.EXOCMD.term("TokenInvocation_parameter"))??"";if(!this.looksLikeUUID(s))return this.logger.warn(`Grounding ${n}: 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,n,i,o):(this.logger.warn(`Grounding ${n}: 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,z.Namespace.EXO.term("Instance_class"),void 0);for(let i of t)if(i.object instanceof hr.IRI){if(i.object.value===RJ||i.object.value.includes(Ok))return!0}else if(i.object instanceof cr.Literal){let s=this.unwrapWikilink(i.object.value);if(s==="exocmd__TokenInvocation"||s===Ok)return!0}return(await this.tripleStore.match(e,z.Namespace.EXOCMD.term("TokenInvocation_token"),void 0)).length>0?(this.logger.debug(`Asset ${e.value} classified as TokenInvocation via its exocmd__TokenInvocation_token property; exo__Instance_class was absent or unresolved.`),!0):!1}async assetIsSubstitutionToken(e){let t=await this.tripleStore.match(e,z.Namespace.EXO.term("Instance_class"),void 0);for(let i of t)if(i.object instanceof hr.IRI){if(i.object.value===TJ||i.object.value.includes(xk))return!0}else if(i.object instanceof cr.Literal){let s=this.unwrapWikilink(i.object.value);if(s==="exocmd__SubstitutionToken"||s===xk)return!0}return(await this.tripleStore.match(e,z.Namespace.EXOCMD.term("SubstitutionToken_resolver"),void 0)).length>0?(this.logger.debug(`Asset ${e.value} classified as SubstitutionToken via its resolver property; exo__Instance_class was absent or unresolved.`),!0):!1}async resolveGroundingTypeReference(e){let t=await this.tripleStore.match(e,z.Namespace.EXOCMD.term("Grounding_type"),void 0);if(t.length===0)return null;let n=t[0].object;if(n instanceof hr.IRI)return(0,Ik.resolveGroundingTypeFromIRI)(n.value);if(n instanceof cr.Literal){let i=n.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,Ik.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 expandPrototypeChain(e){if(!e||!this.normalizeWikilink(e))return[];let t=[e],n=new Set([this.normalizeWikilink(e).toLowerCase()]),i=e;for(let s=0;s<Wl;s++){let o=this.extractUuidFromRef(i);if(!o)break;let c=null;try{let u=await this.findSubjectByUID(o);if(!u)break;c=await this.getLinkedValue(u,z.Namespace.EXO.term("Asset_prototype"))}catch(u){this.logger.debug(this.capWarning(`[expandPrototypeChain] store lookup failed at hop ${s} for '${i}': ${String(u)}`));break}if(!c)break;let l=this.normalizeWikilink(c).toLowerCase();if(n.has(l))break;n.add(l),t.push(c),i=c}return t}extractUuidFromRef(e){let t=this.normalizeWikilink(e);if(this.looksLikeUUID(t))return t;let n=this.extractPathBasename(t);return n&&this.looksLikeUUID(n)?n:null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let n=await this.tripleStore.findSubjectsByUUID(e);if(n.length>0)return n[0]}let t=await this.tripleStore.match(void 0,z.Namespace.EXO.term("Asset_uid"),void 0);for(let n of t)if(n.object instanceof cr.Literal&&n.object.value===e)return n.subject;return null}async getLiteralValue(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;return i instanceof cr.Literal||i instanceof hr.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.readAssetLabel(t):null}async readAssetLabel(e){let t=(await this.tripleStore.match(e,z.Namespace.EXO.term("Asset_label"),void 0))[0]?.object;return t instanceof hr.IRI?(0,Rk.iriToObsidianName)(t.value)??t.value:t instanceof cr.Literal?t.value:null}async getClassAncestors(e){return(await this.getClassAncestorsWithDepth(e)).map(n=>n.ref)}async getClassAncestorsWithDepth(e){let t=this._ancestorDepthCache.get(e);if(t)return t;let n=new Map,i=new Set,s=await this.resolveClassFileIRI(e);if(!s)return[];let o=new Set([e]),c=await this.getLiteralValue(s,z.Namespace.EXO.term("Asset_uid"));c&&o.add(c);let l=await this.readAssetLabel(s);l&&o.add(l);let u=a((p,h)=>{if(o.has(p))return;let g=n.get(p);(g===void 0||h<g)&&n.set(p,h)},"setMin"),f=[{fileIRI:s,depth:0}];for(;f.length>0;){let p=f.shift();if(!p)break;let{fileIRI:h,depth:g}=p;if(g>=Wl||i.has(h.value))continue;i.add(h.value);let m=await this.tripleStore.match(h,z.Namespace.EXO.term("Class_superClass"),void 0);for(let b of m){let _=b.object;if(!(_ instanceof hr.IRI))continue;let S=g+1,I=_.value.startsWith("obsidian://vault/"),E=this.iriToObsidianName(_.value);E&&u(E,S);let w=null;if(I?w=_:E&&(w=await this.resolveClassFileIRI(E)),!w)continue;let R=await this.getLiteralValue(w,z.Namespace.EXO.term("Asset_uid"));R&&u(R,S),i.has(w.value)||f.push({fileIRI:w,depth:S})}}let d=Array.from(n.entries()).map(([p,h])=>({ref:p,depth:h}));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){return(0,_J.findUidByAssetLabel)(this.tripleStore,e)}async getLinkedUID(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;if(i instanceof hr.IRI){let s=await this.tripleStore.match(i,z.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof cr.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof cr.Literal?this.normalizeWikilink(i.value):null}async getLinkedUIDs(e,t){let n=await this.tripleStore.match(e,t,void 0),i=[];for(let s of n){let o=s.object;if(o instanceof hr.IRI){let c=await this.tripleStore.match(o,z.Namespace.EXO.term("Asset_uid"),void 0);if(c.length>0&&c[0].object instanceof cr.Literal)i.push(c[0].object.value);else{let l=o.value.split("/").pop()?.replace(".md","");l&&i.push(l)}}else if(o instanceof cr.Literal){let c=this.normalizeWikilink(o.value);c&&i.push(c)}}return i}async getLinkedValue(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;return i instanceof cr.Literal?this.normalizeWikilink(i.value):i instanceof hr.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;return i instanceof cr.Literal?this.unwrapWikilink(i.value):i instanceof hr.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 n=t.match(/^\[\[([^\]|]+)\|([^\]]+)\]\]$/);if(n)return n[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 n=await this.tripleStore.match(e,t,void 0);if(n.length===0)return null;let i=n[0].object;if(i instanceof cr.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof hr.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 n=t[1],i=await this.findSubjectByUID(n);if(!i)return e;let s=await this.readAssetLabel(i);return s?e.replace(`[[${n}]]`,`[[${n}|${s}]]`):e}iriToObsidianName(e){return(0,Rk.iriToObsidianName)(e)}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),n=t.indexOf("|");return n>=0?t.substring(0,n):t}};pa.CommandResolver=qA;pa.CommandResolver=qA=pJ([(0,mJ.injectable)(),hJ("design:paramtypes",[Object,Object])],qA)});var zA=T(WA=>{"use strict";Object.defineProperty(WA,"__esModule",{value:!0});WA.validateExoQLAllowlist=CJ;var ub=Th();function CJ(r){if(!r||typeof r!="object")return;let e=r;if(e.type==="update"){let t=r.updates??[];for(let n of t)if(n?.type==="load")throw new ub.ExoQLForbiddenKeywordError("LOAD");throw new ub.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,n=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||n)throw new ub.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)fb(t);if(Array.isArray(e.template))for(let t of e.template)fb(t)}}a(CJ,"validateExoQLAllowlist");function fb(r){if(!r||typeof r!="object")return;if(r.type==="service")throw new ub.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(r.patterns))for(let t of r.patterns)fb(t);let e=r.where;if(Array.isArray(e))for(let t of e)fb(t)}a(fb,"walkPatternForBannedKeywords")});var HA=T(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});db.DEFAULT_EVAL_CONFIG=void 0;db.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var pb=T(KA=>{"use strict";Object.defineProperty(KA,"__esModule",{value:!0});KA.evaluateWithExoEval=NJ;var xJ=mf(),PJ=wf(),OJ=Uf(),FJ=zA(),DJ=HA(),LJ=Th();async function NJ(r,e={}){if(typeof r!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let n=new xJ.ExoQLParser().parse(r);if((0,FJ.validateExoQLAllowlist)(n),!{...DJ.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new LJ.ExoQLEvalDisabledError;let s="queryType"in n&&typeof n.queryType=="string"?n.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new PJ.ExoQLAlgebraTranslator().translate(n),l=new OJ.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(NJ,"evaluateWithExoEval")});var vs=T(hb=>{"use strict";Object.defineProperty(hb,"__esModule",{value:!0});hb.DateFormatter=void 0;var YA=class r{static{a(this,"DateFormatter")}static toISOTimestamp(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}static toLocalTimestamp(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0");return`${t}-${n}-${i}T${s}:${o}:${c}`}static toDateWikilink(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`"[[${t}-${n}-${i}]]"`}static getTodayWikilink(){return r.toDateWikilink(new Date)}static toDateString(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${i}`}static parseWikilink(e){let n=e.replace(/^["']|["']$/g,"").match(/\[\[(\d{4}-\d{2}-\d{2})\]\]/);return n?n[1]:null}static addDays(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}static isSameDay(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}static getTodayStartTimestamp(){let e=new Date;return e.setHours(0,0,0,0),r.toLocalTimestamp(e)}static toTimestampAtStartOfDay(e){let t=e.split("-").map(Number);if(t.length!==3||t.some(isNaN))throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD`);let[n,i,s]=t,o=new Date(n,i-1,s,0,0,0,0);if(isNaN(o.getTime()))throw new Error(`Invalid date values: ${e}`);return r.toLocalTimestamp(o)}static normalizeTimestamp(e){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e;let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid timestamp format: ${e}`);return r.toISOTimestamp(t)}static isISOTimestamp(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e)}};hb.DateFormatter=YA});var Ih=T(mb=>{"use strict";Object.defineProperty(mb,"__esModule",{value:!0});mb.liveClock=kJ;mb.frozenClock=MJ;function kJ(){return{now:a(()=>new Date,"now")}}a(kJ,"liveClock");function MJ(r){let e=new Date(r);return{now:a(()=>new Date(e.getTime()),"now")}}a(MJ,"frozenClock")});var kk=T(ha=>{"use strict";var jJ=ha&&ha.__decorate||function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[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},$J=ha&&ha.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ch;Object.defineProperty(ha,"__esModule",{value:!0});ha.PreconditionEvaluator=void 0;var UJ=lt(),BJ=mf(),VJ=wf(),Nk=Uf(),GJ=pb(),Rh=vs(),qJ=Ih(),xh=Ch=class{static{a(this,"PreconditionEvaluator")}constructor(e,t,n){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t,this.clock=n?.clock??(0,qJ.liveClock)()}async evaluate(e,t,n){if(!e)return!0;let i=new Map;return await this.evaluateNode(e,t,n,i)==="yes"}async evaluateNode(e,t,n,i){if(e.broken)return"unknown";if(e.composite){let{op:s,children:o}=e.composite;if(o.length===0)return"unknown";let c=await Promise.all(o.map(l=>this.evaluateNode(l,t,n,i)));return s==="all"?c.includes("no")?"no":c.includes("unknown")?"unknown":"yes":c.includes("yes")?"yes":c.includes("unknown")?"unknown":"no"}if(e.not){let s=await this.evaluateNode(e.not,t,n,i);return s==="unknown"?"unknown":s==="yes"?"no":"yes"}return e.sparqlAsk?await this.evaluateSparqlAskMemoized(e.sparqlAsk,t,i)?"yes":"no":e.query?await this.evaluateQueryRef(e.query,t)?"yes":"no":e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,n)?"yes":"no":"yes"}evaluateSparqlAskMemoized(e,t,n){let i=n.get(e);if(i!==void 0)return i;let s=this.evaluateSparqlAsk(e,t);return n.set(e,s),s}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let n=await this.queryBodyResolver.resolveSparql(e);if(!n)return!1;let i=this.substituteVariables(n,t),s=await(0,GJ.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,n){return this.hostFunctions.has(e)?this.evaluateHostFunction(e,t,n):null}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Ch.SENTINEL_IRI),i=new BJ.ExoQLParser().parse(t),o=new VJ.ExoQLAlgebraTranslator().translate(i);return new Nk.ExoQLQueryExecutor(this.tripleStore).isAskQuery(o)?o:null}evaluateHostFunction(e,t,n){let i=this.hostFunctions.get(e);if(!i)return!0;let s=n?{...n,targetIRI:t}:{targetIRI:t};try{return i(s)}catch{return!1}}async evaluateSparqlAsk(e,t){try{let n=Ch.TEMPORAL_TOKEN.test(e),i=n?Rh.DateFormatter.toDateString(this.clock.now()):null,s=this.askCache.get(e);if(s===void 0||n&&s.day!==i){let l=this.compileAsk(e);if(!l)return!1;s={day:i,compiled:l},this.askCache.set(e,s)}let o=JSON.parse(JSON.stringify(s.compiled).replaceAll(Ch.SENTINEL_IRI,t));return await new Nk.ExoQLQueryExecutor(this.tripleStore).executeAsk(o)}catch{return!1}}substituteVariables(e,t){let n=this.clock.now(),i=n.toISOString(),s=n.getFullYear(),o=n.getMonth(),c=n.getDate(),l=n.getDay(),u=Rh.DateFormatter.toDateString(n),f=Rh.DateFormatter.toDateString(new Date(s,o,c-1)),d=(l+6)%7,p=Rh.DateFormatter.toDateString(new Date(s,o,c-d)),h=Rh.DateFormatter.toDateString(new Date(s,o,c-d-7)),g=`${s}-${String(o+1).padStart(2,"0")}-01`,m=o===0?11:o-1,_=`${o===0?s-1:s}-${String(m+1).padStart(2,"0")}-01`,S=`${s}-01-01`;return e.replace(/\$target\b/g,`<${t}>`).replace(/\$now\b/g,`"${i}"^^xsd:dateTime`).replace(/\$yesterday\b/g,`"${f}"^^xsd:date`).replace(/\$thisWeekStart\b/g,`"${p}"^^xsd:date`).replace(/\$lastWeekStart\b/g,`"${h}"^^xsd:date`).replace(/\$thisMonthStart\b/g,`"${g}"^^xsd:date`).replace(/\$lastMonthStart\b/g,`"${_}"^^xsd:date`).replace(/\$thisYearStart\b/g,`"${S}"^^xsd:date`).replace(/\$today\b/g,`"${u}"^^xsd:date`)}};ha.PreconditionEvaluator=xh;xh.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";xh.TEMPORAL_TOKEN=/\$(?:now|today|yesterday|thisWeekStart|lastWeekStart|thisMonthStart|lastMonthStart|thisYearStart)\b/;ha.PreconditionEvaluator=xh=Ch=jJ([(0,UJ.injectable)(),$J("design:paramtypes",[Object,Object,Object])],xh)});var Mk=T(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.hasUidFilename=ma.hasNonUidFilename=void 0;ma.registerDefaultHostFunctions=HJ;var WJ=a(r=>{let e=r.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=r.fileBasename;return typeof t!="string"?!1:t!==e},"hasNonUidFilename");ma.hasNonUidFilename=WJ;var zJ=a(r=>{let e=r.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=r.fileBasename;return typeof t!="string"?!1:t===e},"hasUidFilename");ma.hasUidFilename=zJ;function HJ(r){r.registerHostFunction("hasNonUidFilename",ma.hasNonUidFilename),r.registerHostFunction("hasUidFilename",ma.hasUidFilename)}a(HJ,"registerDefaultHostFunctions")});var yb=T(gb=>{"use strict";Object.defineProperty(gb,"__esModule",{value:!0});gb.liveUidGenerator=KJ;gb.seededUidGenerator=XJ;var XA=El();function KJ(){return{next:a(()=>(0,XA.v4)(),"next")}}a(KJ,"liveUidGenerator");var YJ="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function XJ(r){let e=0,t=(0,XA.v5)(r,YJ);return{next:a(()=>{let n=`${r}#${e}`;return e+=1,(0,XA.v5)(n,t)},"next")}}a(XJ,"seededUidGenerator")});var Sb=T(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});wc.registerResolver=mr;wc.getResolver=ZJ;wc.isResolverModifierAware=eZ;wc.getRegisteredResolverIds=tZ;wc.clearResolvers=rZ;wc.installDefaultResolvers=dZ;var QJ=vs(),_b=new Map,QA=new Set,JJ=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function mr(r,e,t=!1){_b.set(r,e),t&&QA.add(r)}a(mr,"registerResolver");function ZJ(r){return _b.get(r)}a(ZJ,"getResolver");function eZ(r){return QA.has(r)}a(eZ,"isResolverModifierAware");function tZ(){return Array.from(_b.keys())}a(tZ,"getRegisteredResolverIds");function rZ(){_b.clear(),QA.clear()}a(rZ,"clearResolvers");function wn(r){return r<10?`0${r}`:String(r)}a(wn,"pad2");var nZ=["January","February","March","April","May","June","July","August","September","October","November","December"],iZ=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sZ=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],oZ=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function aZ(r){let e=["th","st","nd","rd"],t=r%100;return`${r}${e[(t-20)%10]||e[t]||e[0]}`}a(aZ,"ordinalDay");var cZ=/YYYY|YY|MMMM|MMM|MM|M|Do|DD|D|dddd|ddd|HH|H|hh|h|mm|m|ss|s|A|a/g;function lZ(r,e){let t=(r.getHours()+11)%12+1;return e.replace(cZ,n=>{switch(n){case"YYYY":return String(r.getFullYear());case"YY":return wn(r.getFullYear()%100);case"MMMM":return nZ[r.getMonth()];case"MMM":return iZ[r.getMonth()];case"MM":return wn(r.getMonth()+1);case"M":return String(r.getMonth()+1);case"Do":return aZ(r.getDate());case"DD":return wn(r.getDate());case"D":return String(r.getDate());case"dddd":return sZ[r.getDay()];case"ddd":return oZ[r.getDay()];case"HH":return wn(r.getHours());case"H":return String(r.getHours());case"hh":return wn(t);case"h":return String(t);case"mm":return wn(r.getMinutes());case"m":return String(r.getMinutes());case"ss":return wn(r.getSeconds());case"s":return String(r.getSeconds());case"A":return r.getHours()<12?"AM":"PM";case"a":return r.getHours()<12?"am":"pm";default:return n}})}a(lZ,"formatDate");function jk(r,e,t){let n=r.getDate(),i=new Date(r.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(n,s)),i}a(jk,"addMonthsClamped");function uZ(r,e){if(!e)return r;let t=e.match(/^([+-])(\d+)([dwMy])?$/);if(!t)return r;let n=(t[1]==="-"?-1:1)*parseInt(t[2],10),i=t[3]??"d",s=new Date(r.getTime());switch(i){case"d":s.setDate(s.getDate()+n);break;case"w":s.setDate(s.getDate()+n*7);break;case"M":s=jk(s,n,"M");break;case"y":s=jk(s,n,"y");break}return isNaN(s.getTime())?r:s}a(uZ,"applyDateOffset");function fZ(r){if(!r)return{offset:null,format:null};let e=r.indexOf(":");if(e<0)return{offset:r,format:null};let t=r.slice(0,e),n=r.slice(e+1);return{offset:t||null,format:n||null}}a(fZ,"parseDateModifier");function bb(r,e){return(t,n)=>{let{offset:i,format:s}=fZ(n),o=new Date;return r!==0&&o.setDate(o.getDate()+r),o=uZ(o,i),lZ(o,s??e)}}a(bb,"makeDateResolver");function dZ(){mr("today",()=>{let r=new Date;return`${r.getFullYear()}-${wn(r.getMonth()+1)}-${wn(r.getDate())}`}),mr("todayStart",()=>QJ.DateFormatter.getTodayStartTimestamp()),mr("date",bb(0,"YYYY-MM-DD"),!0),mr("now",bb(0,"YYYY-MM-DDTHH:mm:ss"),!0),mr("tomorrow",bb(1,"YYYY-MM-DD"),!0),mr("yesterday",bb(-1,"YYYY-MM-DD"),!0),mr("target",r=>r.targetIRI?`"[[${r.targetIRI}]]"`:""),mr("targetFolder",r=>{if(!r.targetFilePath)return"";let e=r.targetFilePath.replace(/^\/+/,""),t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}),mr("createdInstance",r=>{let e=r.createdInstancePath;if(!e)return null;let t=e.replace(/\.md$/i,"").replace(/^\/+/,""),n=t.split("/").pop()??t;return`"[[${JJ.test(n)?n:t}]]"`}),mr("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.")}),mr("nowTimestamp",()=>{let r=new Date;return`${r.getFullYear()}-${wn(r.getMonth()+1)}-${wn(r.getDate())}T${wn(r.getHours())}:${wn(r.getMinutes())}:${wn(r.getSeconds())}`}),mr("nowDate",()=>{let r=new Date;return`${r.getFullYear()}-${wn(r.getMonth()+1)}-${wn(r.getDate())}`}),mr("nowYear",()=>String(new Date().getFullYear())),mr("nowMonth",()=>wn(new Date().getMonth()+1)),mr("userInputLabel",r=>{let e=r.userInput?.label;return typeof e=="string"?e:""}),mr("userInput",(r,e)=>{if(!e)return null;let t=r.userInput?.[e];return typeof t=="string"?t:t==null?null:String(t)}),mr("targetProperty",(r,e)=>{if(!e||!r.targetFm)return null;let t=r.targetFm[e];return t==null?null:Array.isArray(t)?t.map(String):String(t)}),mr("targetRefProperty",(r,e)=>{if(!e)return null;let t=e.indexOf("|");if(t<0)return null;let n=e.slice(0,t),i=e.slice(t+1);if(!n||!i)return null;let s=r.targetRefFm?.[n];if(!s)return null;let o=s[i];return o==null?null:Array.isArray(o)?o.length>0?String(o[0]):null:String(o)}),mr("labelAsArray",r=>{let e=r.userInput?.label;return typeof e=="string"&&e.length>0?[e]:[]}),mr("groundingTargetClass",r=>r.groundingTargetClassUid?`"[[${r.groundingTargetClassUid}]]"`:null),mr("targetClassSelf",r=>{if(!r.targetFilePath)return null;let e=r.targetFilePath.replace(/^\/+/,""),n=e.slice(e.lastIndexOf("/")+1).replace(/\.md$/i,"");return n.length>0?`"[[${n}]]"`:null})}a(dZ,"installDefaultResolvers")});var ZA=T(wb=>{"use strict";Object.defineProperty(wb,"__esModule",{value:!0});wb.resolveTemplateBody=hZ;wb.stripTemplateFrontmatter=mZ;var JA=Sb();(0,JA.installDefaultResolvers)();var pZ=/\$([A-Za-z][A-Za-z0-9_]*)((?:[+-]\d+[dwMy])?(?::[A-Za-z0-9:./-]+)?)/g;function hZ(r,e={}){return r.replace(pZ,(t,n,i)=>{let s=(0,JA.getResolver)(n);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,JA.isResolverModifierAware)(n)?o:o+i})}a(hZ,"resolveTemplateBody");function mZ(r){let e=r.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);return e?r.slice(e[0].length):r}a(mZ,"stripTemplateFrontmatter")});var Tb=T(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.registerOrderSpecLoader=gZ;Vf.clearOrderSpecLoader=yZ;Vf.loadDefaultSpec=bZ;Vf.orderProperties=_Z;var Eb=null,Ec,vb=!1;function gZ(r){Eb=r,Ec=void 0,vb=!1}a(gZ,"registerOrderSpecLoader");function yZ(){Eb=null,Ec=void 0,vb=!1}a(yZ,"clearOrderSpecLoader");function bZ(){if(Ec!==void 0)return Ec;if(!Eb)return Ec=null,null;try{Ec=Eb()}catch(r){vb||(console.warn("[OrderSpecResolver] loader threw, falling back to insertion order:",r),vb=!0),Ec=null}return Ec}a(bZ,"loadDefaultSpec");function _Z(r,e){if(!e||e.head.length===0&&e.tail.length===0)return r;let t=Object.keys(r),n=new Set(e.head),i=new Set(e.tail),s=e.head.filter(u=>Object.prototype.hasOwnProperty.call(r,u)),o=e.tail.filter(u=>Object.prototype.hasOwnProperty.call(r,u)),c=t.filter(u=>!n.has(u)&&!i.has(u));e.middleStrategy==="alphabetical"&&c.sort((u,f)=>u.localeCompare(f));let l={};for(let u of s)l[u]=r[u];for(let u of c)l[u]=r[u];for(let u of o)l[u]=r[u];return l}a(_Z,"orderProperties")});var si=T(Ab=>{"use strict";Object.defineProperty(Ab,"__esModule",{value:!0});Ab.DI_TOKENS=void 0;Ab.DI_TOKENS={IFileSystemAdapter:Symbol.for("IFileSystemAdapter"),IVaultAdapter:Symbol.for("IVaultAdapter"),IVaultContext:Symbol.for("IVaultContext"),IMultiVaultManager:Symbol.for("IMultiVaultManager"),ILogger:Symbol.for("ILogger"),IEventBus:Symbol.for("IEventBus"),IConfiguration:Symbol.for("IConfiguration"),INotificationService:Symbol.for("INotificationService"),ClassCreationService:Symbol.for("ClassCreationService"),ConceptCreationService:Symbol.for("ConceptCreationService"),GenericAssetCreationService:Symbol.for("GenericAssetCreationService"),TaskStatusService:Symbol.for("TaskStatusService"),EffortStatusWorkflow:Symbol.for("EffortStatusWorkflow"),StatusTimestampService:Symbol.for("StatusTimestampService"),PropertyCleanupService:Symbol.for("PropertyCleanupService"),FolderRepairService:Symbol.for("FolderRepairService"),RenameToUidService:Symbol.for("RenameToUidService"),NoteToRDFConverter:Symbol.for("NoteToRDFConverter"),IVaultSettings:Symbol.for("IVaultSettings"),AreaHierarchyBuilder:Symbol.for("AreaHierarchyBuilder"),ClassHierarchyResolver:Symbol.for("ClassHierarchyResolver")}});var tI=T(Ib=>{"use strict";Object.defineProperty(Ib,"__esModule",{value:!0});Ib.RDFVocabularyMapper=void 0;var xr=Ti(),$k=De(),Te=qt(),eI=class{static{a(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",Te.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",Te.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",Te.Namespace.RDFS.term("subClassOf")],["exo__Property_range",Te.Namespace.RDFS.term("range")],["exo__Property_domain",Te.Namespace.RDFS.term("domain")],["exo__Property_superProperty",Te.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new xr.Triple(Te.Namespace.EXO.term("Asset"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.RDFS.term("Resource"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Class"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.RDFS.term("Class"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Property"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.RDF.term("Property"))),e.push(new xr.Triple(Te.Namespace.EMS.term("Task"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("Project"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("Area"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("Workflow"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("WorkflowState"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EMS.term("WorkflowTransition"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EXOCMD.term("Command"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EXOCMD.term("Precondition"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EXOCMD.term("Grounding"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e.push(new xr.Triple(Te.Namespace.EXOCMD.term("CommandBinding"),Te.Namespace.RDFS.term("subClassOf"),Te.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new xr.Triple(Te.Namespace.EXO.term("Instance_class"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDF.term("type"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Asset_isDefinedBy"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("isDefinedBy"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Class_superClass"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("subClassOf"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Property_range"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("range"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Property_domain"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("domain"))),e.push(new xr.Triple(Te.Namespace.EXO.term("Property_superProperty"),Te.Namespace.RDFS.term("subPropertyOf"),Te.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,n){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(n instanceof $k.IRI)s=n;else{let o=Te.Namespace.fromPropertyKey(n);s=o?o.namespace.term(o.localName):new $k.IRI(n)}return new xr.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Ib.RDFVocabularyMapper=eI});var Rb=T(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.OBSIDIAN_VAULT_SCHEME=void 0;ga.vaultPathToIRI=SZ;ga.iriToVaultPath=wZ;ga.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function SZ(r){let e=r.startsWith("./")?r.slice(2):r;return`${ga.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}a(SZ,"vaultPathToIRI");function wZ(r){if(!r.startsWith(ga.OBSIDIAN_VAULT_SCHEME))return null;let e=r.slice(ga.OBSIDIAN_VAULT_SCHEME.length);try{return decodeURI(e)}catch{return null}}a(wZ,"iriToVaultPath")});var xb=T(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.derivePath=Uk;Ph.deriveUrl=EZ;Ph.deriveLegacyFlatPath=vZ;var rI="assetspaces",Cb=/^[A-Za-z0-9._-]+$/;function Uk(r){if(typeof r!="string")return null;let e=r.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 n=t.split("/").filter(o=>o.length>0);if(n.length<2)return null;let i=n[0],s=n[1];return i==="."||i===".."||s==="."||s===".."||!Cb.test(i)||!Cb.test(s)?null:`${rI}/${i}/${s}`}a(Uk,"derivePath");function EZ(r){if(typeof r!="string")return null;let e=r.trim();if(e.length===0)return null;e=e.replace(/^\/+/,"").replace(/\/+$/,"");let t=`${rI}/`;if(!e.startsWith(t))return null;let n=e.slice(t.length).split("/").filter(o=>o.length>0);if(n.length<2)return null;let i=n[0],s=n[1];return i==="."||i===".."||s==="."||s===".."||!Cb.test(i)||!Cb.test(s)?null:`https://github.com/${i}/${s}`}a(EZ,"deriveUrl");function vZ(r){let e=Uk(r);if(e===null)return null;let t=e.split("/")[2];if(t===void 0||t.length===0)return null;let n=t.startsWith("exoas-")?t.slice(6):t;return n.length===0?null:`${rI}/${n}`}a(vZ,"deriveLegacyFlatPath")});var Pb=T(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.FILE_SPACE_CLASS_UID=void 0;Ts.frontmatterDeclaresFileSpace=AZ;Ts.discoverFileSpaceExclusions=RZ;var TZ=xb();Ts.FILE_SPACE_CLASS_UID="aad8913e-5e9f-4047-879d-93cc46befd52";var Bk=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,nI=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Gk(r){let e=Array.isArray(r)?r:[r],t=[];for(let n of e){if(typeof n!="string")continue;Bk.lastIndex=0;let i;for(;(i=Bk.exec(n))!==null;)t.push(i[1].trim())}return t}a(Gk,"wikilinkTargets");function AZ(r){return r?Gk(r.exo__Instance_class).some(e=>nI.test(e)&&e.toLowerCase()===Ts.FILE_SPACE_CLASS_UID):!1}a(AZ,"frontmatterDeclaresFileSpace");function Vk(r,e){try{return r.getFrontmatter(e)}catch{return null}}a(Vk,"readFrontmatterSafe");function IZ(r){let e=r.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=r.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(IZ,"readSource");function RZ(r){let e=[],t=[],n=[],i=new Map,s=a((c,l)=>{if(nI.test(c))return c.toLowerCase()===Ts.FILE_SPACE_CLASS_UID;let u=r.getFirstLinkpathDest(c,l);if(u==null)return!1;let f=i.get(u.path);if(f!==void 0)return f;let p=Vk(r,u)?.exo__Asset_uid,h=typeof p=="string"&&p.toLowerCase()===Ts.FILE_SPACE_CLASS_UID;return i.set(u.path,h),h},"isFileSpaceClassRef"),o=a(c=>c.some(l=>nI.test(l)&&l.toLowerCase()===Ts.FILE_SPACE_CLASS_UID),"hasUuidFormRef");for(let c of r.getAllFiles()){let l=Vk(r,c);if(!l)continue;let u=Gk(l.exo__Instance_class);if(!u.some(h=>s(h,c.path)))continue;t.push(c.path),o(u)||n.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 [[${Ts.FILE_SPACE_CLASS_UID}]] (UID-canon)`);let f=IZ(l);if(f===null){n.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,TZ.derivePath)(f);if(d===null){n.push(`FileSpace declaration ${c.path}: cannot derive mount path from source "${f}" \u2014 content NOT excluded from the index`);continue}let p=`${d}/`;c.path.startsWith(p)&&n.push(`FileSpace declaration ${c.path} lies INSIDE its own mount ${p} \u2014 it will be excluded from the index together with the content; move the declaration outside the mount folder`),e.push(p)}return{prefixes:e,declarationPaths:t,warnings:n}}a(RZ,"discoverFileSpaceExclusions")});var Hl=T(Lt=>{"use strict";var CZ=Lt&&Lt.__decorate||function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[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},xZ=Lt&&Lt.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qk=Lt&&Lt.__param||function(r,e){return function(t,n){e(t,n,r)}},oI;Object.defineProperty(Lt,"__esModule",{value:!0});Lt.NoteToRDFConverter=Lt.LEGACY_YAML_KEYS=Lt.LEGACY_UNPREFIXED_ASSET_FIELDS=Lt.UNPREFIXED_ASSET_FIELDS=void 0;Lt.canonicalYamlKey=LZ;Lt.isPosixBracketExpression=Hk;Lt.normaliseExcludedFolders=Kk;Lt.isPathExcluded=Yk;var iI=lt(),Pr=Ti(),As=De(),Mn=He(),Wk=sr(),Zt=qt(),zk=si(),PZ=tI(),OZ=ih(),sI=Rb(),Oi=Zv(),FZ=Pb();Lt.UNPREFIXED_ASSET_FIELDS=new Set(["draft","pinned","aliases"]);Lt.LEGACY_UNPREFIXED_ASSET_FIELDS=new Set(["archived"]);Lt.LEGACY_YAML_KEYS=new Map([...Lt.LEGACY_UNPREFIXED_ASSET_FIELDS].map(r=>[`exo__Asset_${r}`,[r]]));var DZ=/^exo__Asset_(.+)$/;function LZ(r){let e=DZ.exec(r);return e&&Lt.UNPREFIXED_ASSET_FIELDS.has(e[1])?e[1]:Lt.LEGACY_UNPREFIXED_ASSET_FIELDS.has(r)?`exo__Asset_${r}`:r}a(LZ,"canonicalYamlKey");function Hk(r){return/^:[^\s[\]|]+:$/.test(r)}a(Hk,"isPosixBracketExpression");function Kk(r){return Array.isArray(r)?r.map(e=>String(e).replace(/\\/g,"/").trim()).filter(e=>e.length>0).map(e=>e.endsWith("/")?e:`${e}/`):[]}a(Kk,"normaliseExcludedFolders");function Yk(r,e){if(e.length===0)return!1;let t=r.replace(/\\/g,"/");for(let n of e)if(t.startsWith(n))return!0;return!1}a(Yk,"isPathExcluded");function NZ(r){if(!r)return"";let e=r.replace(/\\/g,"/");for(;e.startsWith("/");)e=e.slice(1);for(;e.endsWith("/");)e=e.slice(0,-1);return e.length>0?`${e}/`:""}a(NZ,"normaliseSubjectIriPrefix");var zl=oI=class{static{a(this,"NoteToRDFConverter")}constructor(e,t=OZ.NullLogger,n={}){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.pendingExtraTriples=[],this.preResolvedTargetFm=new Map,this.vocabularyMapper=new PZ.RDFVocabularyMapper,this.subjectIriPrefix=NZ(n.subjectIriPrefix),this.emitInstanceClassAsUid=n.emitInstanceClassAsUid??!1}async convertNote(e){let t=this.vault.getFrontmatterWithFallback?await this.vault.getFrontmatterWithFallback(e):this.vault.getFrontmatter(e);return this.convertNoteFromFrontmatter(e,t)}async convertNoteFromFrontmatter(e,t){if(!t)return[];await this.preResolveWikilinkTargets(t);let n=this.notePathToIRI(e.path),i=Zt.Namespace.EXO.term("Asset_filename"),s=new Pr.Triple(n,i,new Mn.Literal(e.basename));if(Oi.Exo003Parser.isExo003Format(t)){let o=await this.convertExo003Note(e,t);return[s,...o]}return this.convertLegacyNote(e,t,s)}async convertLegacyNote(e,t,n){this.pendingExtraTriples=[];let i=[n],s=this.notePathToIRI(e.path),o,c,l,u=!1,f=Zt.Namespace.EXO.term("Statement").value;for(let[m,b]of Object.entries(t)){if(Lt.LEGACY_UNPREFIXED_ASSET_FIELDS.has(m)&&Object.prototype.hasOwnProperty.call(t,`exo__Asset_${m}`))continue;let _=Lt.UNPREFIXED_ASSET_FIELDS.has(m)||Lt.LEGACY_UNPREFIXED_ASSET_FIELDS.has(m)?`exo__Asset_${m}`:m;if(!this.isExocortexProperty(_))continue;let S=this.propertyKeyToIRI(_),I=Array.isArray(b)?b:[b];for(let E of I)if(!((m==="exo__Asset_label"||Lt.UNPREFIXED_ASSET_FIELDS.has(m)||Lt.LEGACY_UNPREFIXED_ASSET_FIELDS.has(m))&&(E==null||typeof E=="string"&&E.trim()==="")))if(m==="exo__Instance_class"){let w=this.valueToClassURI(E);i.push(new Pr.Triple(s,S,w))}else{let w=await this.valueToRDFObject(E,e,S);if(_==="exo__Statement_subject"&&o===void 0){let R=w.find(x=>x instanceof As.IRI);R&&(o=R)}else if(_==="exo__Statement_predicate"&&c===void 0){let R=w.find(x=>x instanceof As.IRI);R&&(c=R)}else _==="exo__Statement_object"&&l===void 0&&(l=w[0]);for(let R of w)if(i.push(new Pr.Triple(s,S,R)),this.vocabularyMapper.hasMappingFor(m)&&R instanceof As.IRI){let x=this.vocabularyMapper.generateMappedTriple(s,m,R);x&&i.push(x)}}if(m==="exo__Instance_class")for(let E of I){let w=this.valueToClassURI(E);if(w instanceof As.IRI){let R=Zt.Namespace.RDF.term("type");i.push(new Pr.Triple(s,R,w)),w.value===f&&(u=!0)}}if(m==="exo__Asset_label"){let E=Zt.Namespace.RDFS.term("label");for(let w of I)typeof w=="string"&&w.length>0&&i.push(new Pr.Triple(s,E,new Mn.Literal(w)))}}let d="exo__Instance_class"in t||"exo__Asset_uid"in t,p=t.exo__Asset_label,h="exo__Asset_label"in t&&p!==null&&p!==void 0&&!(typeof p=="string"&&p.trim()==="")&&!(Array.isArray(p)&&p.length===0);if(d&&!h){let m=Zt.Namespace.RDFS.term("label"),b=Zt.Namespace.EXO.term("Asset_label"),_=new Mn.Literal(e.basename);i.push(new Pr.Triple(s,m,_)),i.push(new Pr.Triple(s,b,_))}i.push(...this.pendingExtraTriples),this.pendingExtraTriples=[],u&&o&&c&&l&&i.push(new Pr.Triple(o,c,l));let g=await this.convertBodyWikilinks(e,s);return i.push(...g),i}async convertExo003Note(e,t){let n=Oi.Exo003Parser.parse(t);if(!n.success||!n.metadata)return[];let i=n.metadata,s=[];switch(i.metadata){case Oi.Exo003MetadataType.Namespace:break;case Oi.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Oi.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Oi.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Oi.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let n=this.notePathToIRI(e.path),i=new As.IRI(t.uri);return[new Pr.Triple(n,Zt.Namespace.OWL.term("sameAs"),i),new Pr.Triple(i,Zt.Namespace.OWL.term("sameAs"),n)]}convertExo003BlankNode(e,t){let n=this.notePathToIRI(e.path),i=t.uri.replace(/[^a-zA-Z0-9_-]/g,"_");return[new Pr.Triple(n,Zt.Namespace.OWL.term("sameAs"),new Wk.BlankNode(i))]}convertExo003Statement(e,t){let n=[];try{let i=this.createExo003ReferenceResolver(e),s=Oi.Exo003Parser.toTriple(t,i);n.push(s);let o=this.notePathToIRI(e.path);n.push(new Pr.Triple(o,Zt.Namespace.RDF.term("value"),s.subject))}catch{}return n}async convertExo003Body(e,t){let n=[];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 As.IRI(c.value):new Wk.BlankNode(c.value),f=new As.IRI(l.value),d=Oi.Exo003Parser.toLiteral(t,s.trim());n.push(new Pr.Triple(u,f,d));let p=this.notePathToIRI(e.path);n.push(new Pr.Triple(p,Zt.Namespace.RDF.term("value"),u))}catch{}return n}createExo003ReferenceResolver(e){return t=>{let n=this.extractWikilink(t),i=n||t,s=this.vault.getFirstLinkpathDest(i,e.path);if(s){let o=this.targetFrontmatter(s);if(o&&Oi.Exo003Parser.isExo003Format(o)){let c=Oi.Exo003Parser.parse(o);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Oi.Exo003MetadataType.Anchor||l.metadata===Oi.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Oi.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!n&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(e={}){return(await this.convertVaultWithValidation({strict:!1,excludedFolders:e.excludedFolders,onFileTriples:e.onFileTriples})).triples}async convertVaultWithValidation(e={}){let t=e.files??this.vault.getAllFiles(),n=[],i=[],s=e.strict??!1,o=0,c=0,l=e.fileSpacePrefixes?{prefixes:e.fileSpacePrefixes,declarationPaths:[],warnings:[]}:(0,FZ.discoverFileSpaceExclusions)(this.vault);for(let m of l.warnings)this.logger.warn(`FileSpace discovery: ${m}`);let u=[...Kk(e.excludedFolders),...l.prefixes],f=u.length===0?t:t.filter(m=>!Yk(m.path,u)),d=e.onProgress,p=e.progressIntervalFiles&&e.progressIntervalFiles>0?e.progressIntervalFiles:oI.INDEX_PROGRESS_INTERVAL,h=f.length,g=0;for(let m of f){if(g++,d&&g%p===0&&g<h)try{d(g,h)}catch{}try{let b=this.vault.getFrontmatter(m),_=b?this.validateExocortexAsset(b,m.basename):null;if(_){if(s)throw new Error(`Invariant violation in "${m.path}": ${_.message}`);i.push({path:m.path,reason:`Invariant violation: ${_.message}`}),o++,this.logger.info(`Skipping file with invariant violation: ${m.path}`,{code:_.code,property:_.property,reason:_.message});continue}let S=await this.convertNote(m);if(n.push(...S),e.onFileTriples)try{e.onFileTriples(m,S)}catch{}}catch(b){let _=b instanceof Error?b.message:String(b);if(s)throw new Error(`Invalid IRI for file "${m.path}": ${_}`);i.push({path:m.path,reason:`Invalid IRI: ${_}`}),c++,this.logger.info(`Skipping file with invalid IRI: ${m.path}`,{reason:_})}}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:n,skippedFiles:i,summary:{total:f.length,indexed:f.length-i.length,skipped:i.length},fileSpaces:l}}static inferLabelFromBasename(e){return Zt.Namespace.fromPropertyKey(e)!==null?e:null}validateExocortexAsset(e,t){let n=a(d=>d==null?!0:typeof d=="string"?d.trim()==="":Array.isArray(d)?d.length===0||d.every(n):!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(n(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&&n(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 p=this.removeQuotes(d),g=(this.extractWikilink(p)??p).trim(),m=g.indexOf("__");m>0&&Zt.Namespace.isValidPrefix(g.slice(0,m))&&/[\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 n of e){let i=(0,sI.vaultPathToIRI)(n.path);As.IRI.isValidIRI(i)||t.push({path:n.path,reason:`Path "${n.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new As.IRI((0,sI.vaultPathToIRI)(`${this.subjectIriPrefix}${e}`))}synthesizeWikilinkTargetIRI(e){return new As.IRI((0,sI.vaultPathToIRI)(e))}isExocortexProperty(e){return Zt.Namespace.fromPropertyKey(e)!==null}propertyKeyToIRI(e){let t=Zt.Namespace.fromPropertyKey(e);if(!t)throw new Error(`Invalid property key: ${e}`);return t.namespace.term(t.localName)}emitTypeTripleForEnumInstance(e,t){let n=this.targetFrontmatter(t);if(!n)return;let i=n.exo__Instance_class,s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return;let o=this.valueToClassURI(s);o instanceof As.IRI&&(this.pendingExtraTriples.push(new Pr.Triple(e,Zt.Namespace.RDF.term("type"),o)),this.pendingExtraTriples.push(new Pr.Triple(e,Zt.Namespace.EXO.term("Instance_class"),o)))}async valueToRDFObject(e,t,n){if(typeof e=="string"){let i=this.removeQuotes(e);if(n?.value.endsWith("#TokenInvocation_parameter"))return[new Mn.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 Mn.Literal(u);if(n?.value.endsWith("#Grounding_targetValueRef")||n?.value.endsWith("#Grounding_targetValueSubstitution")||n?.value.endsWith("#Grounding_targetClass")||n?.value.endsWith("#Grounding_type")||n?.value.endsWith("#PropertyDefault_value"))return[l];let h=this.expandClassValue(o.basename);if(h)return this.emitTypeTripleForEnumInstance(h,o),[h];let g=this.targetFrontmatter(o);if(g){let I=g.exo__Asset_label;if(typeof I=="string"){let E=this.expandClassValue(I);if(E)return this.emitTypeTripleForEnumInstance(E,o),[E]}}let m=n?.value.endsWith("#Asset_prototype")||n?.value.endsWith("/Asset_prototype"),_=((typeof process<"u"?process.env:void 0)?.EXOCORTEX_DUAL_STORAGE_PREDICATES??"").split(",").map(I=>I.trim()).filter(Boolean),S=_.length>0&&_.some(I=>n?.value.endsWith(`#${I}`));return m||S?[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 Mn.Literal(i)]}if(this.isClassReference(i)){let o=this.expandClassValue(i);if(o)return[o]}return this.isISO8601DateTime(i)?[new Mn.Literal(i,Zt.Namespace.XSD.term("dateTime"))]:[new Mn.Literal(i)]}return typeof e=="boolean"?[new Mn.Literal(e.toString())]:typeof e=="number"?[new Mn.Literal(e.toString(),Number.isInteger(e)?Zt.Namespace.XSD.term("integer"):Zt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new Mn.Literal(e.toISOString(),Zt.Namespace.XSD.term("dateTime"))]:[new Mn.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 n=t[1];return n.includes("|")?n.split("|")[0]:n}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let n=t[1],i=n.indexOf("|");return i>=0?n.substring(i+1).trim():null}targetFrontmatter(e){return this.vault.getFrontmatter(e)??this.preResolvedTargetFm.get(e.path)??null}async preResolveWikilinkTargets(e){let t=this.vault.getFrontmatterWithFallback?.bind(this.vault);if(t)for(let n of Object.values(e)){let i=Array.isArray(n)?n:n==null?[]:[n];for(let s of i){if(typeof s!="string")continue;let o=this.removeQuotes(s),c=this.extractWikilink(o);if(!c||!this.isUUID(c))continue;let l=this.vault.getFirstLinkpathDest(c,"");!l||this.preResolvedTargetFm.has(l.path)||this.vault.getFrontmatter(l)||this.preResolvedTargetFm.set(l.path,await t(l))}}}valueToClassURI(e){if(typeof e!="string")return new Mn.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 this.emitInstanceClassAsUid?this.notePathToIRI(c.path):l;let u=this.targetFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return this.emitInstanceClassAsUid?this.notePathToIRI(c.path):d}}return this.notePathToIRI(c.path)}}return new Mn.Literal(t)}isClassReference(e){return/\s/.test(e)?!1:Zt.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),n=Zt.Namespace.fromPropertyKey(t);return!n||/[\s()]/.test(n.localName)?null:n.namespace.term(n.localName)}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,n,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(n=i.exec(e))!==null;)n[1]&&!Hk(n[1].trim())&&t.add(n[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let n=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),o=this.extractBodyWikilinks(s),c=Zt.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);n.push(new Pr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?n.push(new Pr.Triple(t,c,f)):n.push(new Pr.Triple(t,c,new Mn.Literal(l)))}else n.push(new Pr.Triple(t,c,new Mn.Literal(l)))}}catch{}return n}};Lt.NoteToRDFConverter=zl;zl.INDEX_PROGRESS_INTERVAL=200;zl.SkippedFileInfo=class{constructor(r,e){this.path=r,this.reason=e}};zl.VaultValidationResult=class{constructor(r,e,t){this.triples=r,this.skippedFiles=e,this.summary=t}};zl.VaultValidationOptions=class{constructor(r=!1){this.strict=r}};Lt.NoteToRDFConverter=zl=oI=CZ([(0,iI.injectable)(),qk(0,(0,iI.inject)(zk.DI_TOKENS.IVaultAdapter)),qk(1,(0,iI.inject)(zk.DI_TOKENS.ILogger)),xZ("design:paramtypes",[Object,Object,Object])],zl)});var Kl=T(Fb=>{"use strict";Object.defineProperty(Fb,"__esModule",{value:!0});Fb.FrontmatterService=void 0;var Xk=Tb(),aI=Ll(),Gf=Hl(),kZ=ca(),Ob=class r{static{a(this,"FrontmatterService")}parse(e){let t=e.match(r.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 n={},i=t.content.split(/\r?\n/),s=null,o=null,c=a(()=>{s!==null&&o!==null&&(n[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(),p=f[2].trim();p===""?(s=d,o=[]):n[d]=p}return c(),n}updateProperty(e,t,n){t=(0,Gf.canonicalYamlKey)(r.normalizeIRI(t)),typeof n=="string"&&(n=r.normalizeIRIValue(n));let i=this.parse(e),s=this.serializeValue(t,n);if(!i.exists)return`---
117
117
  ${s}
118
118
  ---
119
119
  ${e}`;let o=i.content,c=o.split(`
@@ -325,7 +325,7 @@ To resolve:
325
325
  \u2022 Check service initialization parameters
326
326
  \u2022 Verify all required dependencies are available
327
327
  \u2022 Review service logs for detailed error information
328
- \u2022 Contact support if the issue persists`}};q_.ServiceError=ER});var d$=T(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.ServiceError=Dr.ResourceExhaustedError=Dr.NotFoundError=Dr.PermissionError=Dr.StateTransitionError=Dr.NetworkError=Dr.ValidationError=Dr.ApplicationError=Dr.ErrorCode=void 0;var Ese=Ro();Object.defineProperty(Dr,"ErrorCode",{enumerable:!0,get:a(function(){return Ese.ErrorCode},"get")});var vse=Co();Object.defineProperty(Dr,"ApplicationError",{enumerable:!0,get:a(function(){return vse.ApplicationError},"get")});var Tse=s$();Object.defineProperty(Dr,"ValidationError",{enumerable:!0,get:a(function(){return Tse.ValidationError},"get")});var Ase=o$();Object.defineProperty(Dr,"NetworkError",{enumerable:!0,get:a(function(){return Ase.NetworkError},"get")});var Ise=a$();Object.defineProperty(Dr,"StateTransitionError",{enumerable:!0,get:a(function(){return Ise.StateTransitionError},"get")});var Rse=c$();Object.defineProperty(Dr,"PermissionError",{enumerable:!0,get:a(function(){return Rse.PermissionError},"get")});var Cse=l$();Object.defineProperty(Dr,"NotFoundError",{enumerable:!0,get:a(function(){return Cse.NotFoundError},"get")});var xse=u$();Object.defineProperty(Dr,"ResourceExhaustedError",{enumerable:!0,get:a(function(){return xse.ResourceExhaustedError},"get")});var Pse=f$();Object.defineProperty(Dr,"ServiceError",{enumerable:!0,get:a(function(){return Pse.ServiceError},"get")})});var TR=T(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});W_.ShapeRegistry=void 0;var vR=class{static{a(this,"ShapeRegistry")}constructor(){this.shapes=new Map}get(e){return this.shapes.get(e)}register(e){this.shapes.set(e.propertyIRI,e)}getAll(){return Array.from(this.shapes.values())}get size(){return this.shapes.size}};W_.ShapeRegistry=vR});var h$=T(xo=>{"use strict";var Ose=xo&&xo.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Fse=xo&&xo.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),AR=xo&&xo.__importStar||(function(){var r=a(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ose(t,e,n[i]);return Fse(t,e),t}})();Object.defineProperty(xo,"__esModule",{value:!0});xo.ShapeLoader=void 0;var IR=TR(),Bs=De(),Yh=He(),wr=qt(),Dse=o0(),p$=_I(),z_="http://www.w3.org/ns/shacl#",vPe=[["exo__",wr.Namespace.EXO],["ems__",wr.Namespace.EMS],["exocmd__",wr.Namespace.EXOCMD],["ims__",wr.Namespace.IMS],["ztlk__",wr.Namespace.ZTLK],["ptms__",wr.Namespace.PTMS],["lit__",wr.Namespace.LIT],["inbox__",wr.Namespace.INBOX],["pmbok__",wr.Namespace.PMBOK]],La=class r{static{a(this,"ShapeLoader")}static async loadFromVaultFS(e,t){let{readdir:n,readFile:i}=await Promise.resolve().then(()=>AR(require("fs/promises"))),s=await Promise.resolve().then(()=>AR(require("path"))),o=new IR.ShapeRegistry,c={classEdges:[],candidates:[],uidToLabel:new Map};await r.scanDir(e,c,{readdir:n,readFile:t?.readFile??i,path:s});let l=r.propertyClassKeysFromEdges(c.classEdges);for(let u of c.candidates)try{r.registerCandidate(u,o,l,s,c.uidToLabel)}catch{}return o}static async loadFromRDFGraph(e){let t=new IR.ShapeRegistry,n=wr.Namespace.EXO,i=wr.Namespace.RDFS,s=wr.Namespace.RDF,o=await r.buildUidClassIndex(e),c=await r.collectPropertyClassIRIs(e,o),l=await Promise.all([...c].map(async f=>{try{return await e.match(void 0,s.term("type"),new Bs.IRI(f))}catch{return[]}})),u=new Set;for(let f of l.flat())f.subject instanceof Bs.IRI&&u.add(f.subject.value);for(let f of u){let d;try{d=new Bs.IRI(f)}catch{continue}let[p,h,g,m,b,_,S,I,E]=await Promise.all([e.match(d,i.term("domain"),void 0),e.match(d,n.term("Property_domain"),void 0),e.match(d,i.term("range"),void 0),e.match(d,n.term("Property_range"),void 0),e.match(d,n.term("Property_cardinality"),void 0),e.match(d,n.term("Property_severity"),void 0),e.match(d,n.term("Asset_label"),void 0),e.match(d,i.term("label"),void 0),e.match(d,n.term("Property_minCount"),void 0)]),w=[...S,...I],R=[...p,...h],x=[...g,...m];if(R.length===0)continue;let O=null;for(let W of w)if(W.object instanceof Yh.Literal&&(O=r.labelToIRI(W.object.value),O))break;if(!O)continue;let N=await Promise.all(R.map(async W=>W.object instanceof Bs.IRI?await r.resolveClassIRI(W.object.value,e,o):null)),G=Array.from(new Set(N.filter(W=>W!==null))),j=await Promise.all(x.map(async W=>W.object instanceof Bs.IRI?await r.resolveClassIRI(W.object.value,e,o):W.object instanceof Yh.Literal?r.datatypeRangeToIRI(W.object.value):null)),ae=Array.from(new Set(j.filter(W=>W!==null))),Y=r.cardinalityFromIRI(b[0]?.object instanceof Bs.IRI?b[0].object.value:void 0),M=r.severityFromValue(_[0]?.object instanceof Yh.Literal||_[0]?.object instanceof Bs.IRI?_[0].object.value:void 0),ce=(0,p$.parseMinCount)(E.map(W=>W.object));t.register({propertyIRI:O,domain:G,range:ae.length>0?ae:void 0,cardinality:Y,severity:M,minCount:ce})}return t}static async loadFromShapeJSON(e){let{readFile:t}=await Promise.resolve().then(()=>AR(require("fs/promises"))),n=await t(e,"utf-8"),i=JSON.parse(n),s=new IR.ShapeRegistry;for(let o of Object.values(i.shapes))s.register(o);return s}static extractUidFromFileIRI(e){let t=r.FILE_IRI_UID_RE.exec(e);return t?t[1].toLowerCase():null}static async buildUidClassIndex(e){let t=wr.Namespace.RDFS,n=wr.Namespace.EXO,[i,s]=await Promise.all([e.match(void 0,t.term("label"),void 0),e.match(void 0,n.term("Asset_label"),void 0)]),o=new Map;for(let c of[...i,...s]){if(!(c.subject instanceof Bs.IRI)||!(c.object instanceof Yh.Literal))continue;let l=r.extractUidFromFileIRI(c.subject.value);if(!l||o.has(l))continue;let u=c.object.value.trim();if(/\s/.test(u))continue;let f=r.labelToIRI(u);f&&o.set(l,f)}return o}static async collectPropertyClassIRIs(e,t){let n=wr.Namespace.EXO,i=wr.Namespace.RDFS,[s,o]=await Promise.all([e.match(void 0,n.term("Class_superClass"),void 0),e.match(void 0,i.term("subClassOf"),void 0)]),c=new Map,l=a(async p=>{let h=c.get(p);return h===void 0&&(h=await r.resolveClassIRI(p,e,t),c.set(p,h)),h},"canon"),u=new Map;for(let p of[...s,...o]){if(!(p.subject instanceof Bs.IRI)||!(p.object instanceof Bs.IRI))continue;let[h,g]=await Promise.all([l(p.subject.value),l(p.object.value)]);if(!h||!g||h===g)continue;let m=u.get(g)??new Set;m.add(h),u.set(g,m)}let f=new Set([n.term("Property").value,n.term("ObjectProperty").value]),d=[...f];for(;d.length>0;){let p=d.shift();for(let h of u.get(p)??[])f.has(h)||(f.add(h),d.push(h))}return f}static async resolveClassIRI(e,t,n){if(e.startsWith("https://exocortex.my/ontology/")||e.startsWith("http://www.w3.org/"))return e;let i;try{i=new Bs.IRI(e)}catch{return null}let s=wr.Namespace.RDFS,o=wr.Namespace.EXO,[c,l]=await Promise.all([t.match(i,s.term("label"),void 0),t.match(i,o.term("Asset_label"),void 0)]);for(let u of[...c,...l])if(u.object instanceof Yh.Literal){let f=r.labelToIRI(u.object.value);if(f)return f}if(n){let u=r.extractUidFromFileIRI(e);if(u){let f=n.get(u);if(f)return f}}return e}static propertyClassKeysFromEdges(e){let t=["exo__Property",r.EXO_PROPERTY_UID,"exo__ObjectProperty",r.EXO_OBJECT_PROPERTY_UID],n=new Set(t),i=[...t];for(;i.length>0;){let s=i.shift();for(let o of e)if(o.parentKeys.includes(s)&&!o.childKeys.some(c=>n.has(c)))for(let c of o.childKeys)n.add(c),i.push(c)}return n}static wikilinkClassKeys(e){let t=r.extractWikilinkRef(e);if(!t)return[];let n=[t.trim()];for(let i of t.split("|")){let s=i.trim();s.length>0&&n.push(s)}return n}static async scanDir(e,t,n){let i;try{i=await n.readdir(e,{withFileTypes:!0})}catch{return}i.sort((s,o)=>s.name<o.name?-1:s.name>o.name?1:0);for(let s of i){let o=n.path.join(e,s.name);if(s.isDirectory())await r.scanDir(o,t,n);else if(s.isFile()&&s.name.endsWith(".md"))try{await r.collectFile(o,t,n.readFile,n.path)}catch{}}}static async collectFile(e,t,n,i){let s;try{s=await n(e,"utf-8")}catch{return}let o=r.parseFrontmatter(s);if(!o)return;r.indexUidLabel(e,o,t.uidToLabel,i);let c=r.asArray(o.exo__Class_superClass);if(c.length>0){let l=[i.basename(e,".md")],u=o.exo__Asset_uid;typeof u=="string"&&u.trim().length>0&&l.push(u.trim().replace(/^["']|["']$/g,""));let f=o.exo__Asset_label;typeof f=="string"&&f.trim().length>0&&l.push(f.trim().replace(/^["']|["']$/g,"")),t.classEdges.push({childKeys:l,parentKeys:c.flatMap(d=>r.wikilinkClassKeys(d))})}r.asArray(o.exo__Property_domain).length>0&&t.candidates.push({filePath:e,fm:o})}static indexUidLabel(e,t,n,i){let s=t.exo__Asset_label;if(typeof s!="string")return;let o=s.trim().replace(/^["']|["']$/g,"");if(o.length===0||/\s/.test(o)||!wr.Namespace.fromPropertyKey(o))return;let c=t.exo__Asset_uid,l=[typeof c=="string"?c.trim().replace(/^["']|["']$/g,""):"",i.basename(e,".md")];for(let u of l){if(!r.BARE_UID_RE.test(u))continue;let f=u.toLowerCase();n.has(f)||n.set(f,o)}}static registerCandidate(e,t,n,i,s){let{filePath:o,fm:c}=e;if(!r.asArray(c.exo__Instance_class).some(x=>r.wikilinkClassKeys(x).some(O=>n.has(O))))return;let f=null,d=c.exo__Asset_label;if(typeof d=="string"&&d.trim().length>0)f=d.trim().replace(/^["']|["']$/g,"");else{let x=i.basename(o,".md");wr.Namespace.fromPropertyKey(x)&&(f=x)}if(!f)return;let p=r.labelToIRI(f);if(!p)return;let h=c.exo__Property_domain,g=c.exo__Property_range,m=c.exo__Property_cardinality,b=c.exo__Property_severity,_=c.exo__Property_minCount,S=r.asArray(h).map(x=>r.wikilinkToIRI(x,s)).filter(x=>x!==null);if(S.length===0)return;let I=r.asArray(g).map(x=>r.wikilinkToIRI(x,s)).filter(x=>x!==null),E=r.cardinalityFromLabel(typeof m=="string"?m:void 0),w=r.severityFromValue(typeof b=="string"?b:void 0),R=(0,p$.parseMinCount)(_);t.register({propertyIRI:p,domain:S,range:I.length>0?I:void 0,cardinality:E,severity:w,minCount:R})}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let n=t[1],i={},s=n.split(/\r?\n/),o=null,c=null;for(let l of s){let u=/^ {2}- (.*)$/.exec(l);if(u){o&&c&&c.push(u[1].trim());continue}o&&c&&(i[o]=c,o=null,c=null);let f=/^([^:]+):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),p=f[2].trim();p===""?(o=d,c=[]):i[d]=p}return o&&c&&(i[o]=c),i}static labelToIRI(e){let t=wr.Namespace.fromPropertyKey(e);if(!t)return null;try{return t.namespace.term(t.localName).value}catch{return null}}static extractWikilinkRef(e){let t=e.replace(/^["']|["']$/g,""),n=/\[\[([^\]]+)\]\]/.exec(t);return n?n[1]:t}static wikilinkToIRI(e,t){let n=r.extractWikilinkRef(e);if(!n)return null;let i=n.split("|"),s=i.length>1?[i[1],i[0]]:[i[0]];for(let c of s){let l=r.labelToIRI(c.trim());if(l)return l}let o=r.datatypeRangeToIRI(n);if(o)return o;if(n.startsWith("sh:"))return z_+n.substring(3);if(t)for(let c of s){let l=t.get(c.trim().toLowerCase());if(l===void 0)continue;let u=r.labelToIRI(l);if(u)return u}return null}static datatypeRangeToIRI(e){return e.startsWith("http://")||e.startsWith("https://")?e:(0,Dse.xsdDatatypeIRI)(e)}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static cardinalityFromIRI(e){if(e){if(e.endsWith("PropertyCardinalitySingle"))return"Single";if(e.endsWith("PropertyCardinalityMultiple"))return"Multiple";if(e.includes(r.CARDINALITY_SINGLE_UID))return"Single";if(e.includes(r.CARDINALITY_MULTIPLE_UID))return"Multiple"}}static cardinalityFromLabel(e){if(!e)return;let t=r.extractWikilinkRef(e)??e,n=t.split("|").pop()??t;if(n.includes("Single"))return"Single";if(n.includes("Multiple"))return"Multiple";if(t.includes(r.CARDINALITY_SINGLE_UID))return"Single";if(t.includes(r.CARDINALITY_MULTIPLE_UID))return"Multiple"}static severityFromValue(e){return!e||e.includes("Violation")||e===z_+"Violation"?"sh:Violation":e.includes("Warning")||e===z_+"Warning"?"sh:Warning":e.includes("Info")||e===z_+"Info"?"sh:Info":"sh:Violation"}};xo.ShapeLoader=La;La.FILE_IRI_UID_RE=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;La.BARE_UID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;La.EXO_PROPERTY_UID="38277bfa-d7f9-4a75-b856-b23276ab0db3";La.EXO_OBJECT_PROPERTY_UID="9a1cf31c-9d41-4ef3-9023-584a8d087d16";La.CARDINALITY_SINGLE_UID="c93c4b2f-b43d-4cc9-8dd0-31514d608da2";La.CARDINALITY_MULTIPLE_UID="59a37aa7-ffbe-4e0d-ba60-06ae370d880f"});var xR=T(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.ShapeRegistry=void 0;dd.extractUidFromIRI=CR;dd.validate=zse;var Lse=De(),RR=class{static{a(this,"ShapeRegistry")}constructor(e=[],t="https://exocortex.my/ontology/exo#Instance_class"){this.shapeMap=new Map(e.map(n=>[n.propertyIRI,n])),this.typePredicateIRI=t}getShape(e){return this.shapeMap.get(e)}getAllShapes(){return Array.from(this.shapeMap.values())}hasShape(e){return this.shapeMap.has(e)}};dd.ShapeRegistry=RR;var Nse="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",kse=["http://www.w3.org/2001/XMLSchema#","http://www.w3.org/1999/02/22-rdf-syntax-ns#","http://www.w3.org/2000/01/rdf-schema#","http://www.w3.org/2002/07/owl#","http://www.w3.org/ns/shacl#","http://www.w3.org/2004/02/skos/core#","http://purl.org/dc/elements/1.1/","http://purl.org/dc/terms/","http://xmlns.com/foaf/0.1/","https://schema.org/","https://exocortex.my/ontology/xsd#","https://exocortex.my/ontology/rdf#","https://exocortex.my/ontology/rdfs#","https://exocortex.my/ontology/owl#","https://exocortex.my/ontology/skos#"];function Mse(r){return kse.some(e=>r.startsWith(e))}a(Mse,"isExternalOntologyIRI");var b$=["http://www.w3.org/2001/XMLSchema#","https://exocortex.my/ontology/xsd#"];function m$(r){return b$.some(e=>r.startsWith(e))}a(m$,"isXSDDatatypeIRI");function jse(r){for(let e of b$)if(r.startsWith(e))return r.substring(e.length);return null}a(jse,"xsdLocalName");var $se="http://www.w3.org/2001/XMLSchema#decimal",Use="http://www.w3.org/2001/XMLSchema#integer",g$="http://www.w3.org/2001/XMLSchema#string",Xh=/^[+-]?\d+$/,Qh=/^\+?\d+$/,Bse=/^[+-]?(\d+(\.\d*)?|\.\d+)$/,y$=/^([+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?|[+-]?INF|NaN)$/,Vse={integer:Xh,long:Xh,int:Xh,short:Xh,byte:Xh,nonNegativeInteger:Qh,unsignedLong:Qh,unsignedInt:Qh,unsignedShort:Qh,unsignedByte:Qh,positiveInteger:/^\+?0*[1-9]\d*$/,nonPositiveInteger:/^(-\d+|\+?0+)$/,negativeInteger:/^-0*[1-9]\d*$/,decimal:Bse,float:y$,double:y$,gYear:/^-?\d{4,}(Z|[+-]\d{2}:\d{2})?$/},Gse=/^(true|false)$/;function qse(r,e,t){if(e===t)return!0;let n=jse(t);if(n===null)return!1;if(e===$se||e===Use){let i=Vse[n];return i!==void 0&&i.test(r)}return e===g$&&n==="boolean"?Gse.test(r):e===g$&&n==="anyURI"?Lse.IRI.isValidIRI(r):!1}a(qse,"literalConformsToDatatype");var Wse=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function CR(r){let e=Wse.exec(r);return e?e[1].toLowerCase():null}a(CR,"extractUidFromIRI");function zse(r,e,t,n){let i=new Map,s=new Map;for(let l of r){let{subject:u,predicate:f,object:d}=l;if(u.type!=="iri"||f.type!=="iri"||d.type!=="iri"&&d.type!=="literal")continue;let p=u.value,h=f.value,g=d;if(h===e.typePredicateIRI||h===Nse){if(g.type==="iri"){let b=i.get(p)??[];b.push(g.value),i.set(p,b);let _=CR(p);if(_){let S=`uid:${_}`,I=i.get(S)??[];I.push(g.value),i.set(S,I)}}}else{let b=s.get(p);b||(b=new Map,s.set(p,b));let _=b.get(h)??[];_.push(g),b.set(h,_)}}let o=[],c=new Set([...i.keys(),...s.keys()]);for(let l of c){if(l.startsWith("uid:"))continue;let u=i.get(l)??[],f=s.get(l)??new Map;for(let d of e.getAllShapes()){if(!(d.domain.length===0||d.domain.some(g=>u.some(m=>m===g||t.isSubClassOf(m,g)))))continue;let h=f.get(d.propertyIRI)??[];if(d.minCount!==void 0&&d.minCount>0&&h.length<d.minCount){o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"minCount",message:d.message??`sh:minCount violation: expected at least ${d.minCount} value(s) for <${d.propertyIRI}>`});continue}if(h.length!==0){if(d.cardinality==="Single"&&h.length>1){o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"maxCount",message:d.message??`sh:maxCount violation: expected at most 1 value for <${d.propertyIRI}>, got ${h.length}`});continue}if(d.range&&d.range.length>0){for(let g of h)if(g.type==="iri"){if(Mse(g.value))continue;let m=d.range.filter(S=>!m$(S));if(m.length===0)continue;let b=i.get(g.value)??[];if(b.length===0){let S=CR(g.value);S&&(b=i.get(`uid:${S}`)??[])}if(!m.some(S=>b.some(I=>I===S||t.isSubClassOf(I,S)))){let S=b.length===0;o.push({focusNode:l,propertyPath:d.propertyIRI,severity:S?"sh:Warning":d.severity,constraint:"class",message:S?`sh:class unresolvable-ref: <${g.value}> has no resolvable type in this vault (cross-vault, symbolic, or external reference); not validated against ${m.join(" | ")}`:d.message??`sh:class violation: <${g.value}> does not conform to expected class ${m.join(" | ")}`,actualValue:g.value,expectedRange:m.join(" | ")})}}else if(g.type==="literal"){let m=d.range.filter(S=>m$(S));if(m.length===0)continue;let b=g.datatype??"http://www.w3.org/2001/XMLSchema#string";m.some(S=>qse(g.value,b,S))||o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"datatype",message:d.message??`sh:datatype violation: literal "${g.value}" has datatype <${b}>, expected ${m.join(" | ")}`,actualValue:g.value,expectedRange:m.join(" | ")})}}}}}if(n?.closedWorldMode)for(let l of c){let u=s.get(l)??new Map;for(let f of u.keys())e.hasShape(f)||o.push({focusNode:l,propertyPath:f,severity:"sh:Warning",constraint:"unknown-property",message:`Unknown property: <${f}> has no registered shape`})}return o.sort((l,u)=>{let f=l.focusNode.localeCompare(u.focusNode);return f!==0?f:l.propertyPath.localeCompare(u.propertyPath)}),{conforms:!o.some(l=>l.severity==="sh:Violation"),violations:o}}a(zse,"validate")});var _$=T(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});H_.ApplicationErrorHandler=void 0;var PR=Co(),Hse=Ro(),Kse=Xl(),OR=class{static{a(this,"ApplicationErrorHandler")}constructor(e={},t,n){this.logger=t,this.notifier=n,this.telemetryHooks=new Set,this.retryConfig={maxRetries:e.maxRetries??3,initialDelayMs:e.initialDelayMs??1e3,backoffMultiplier:e.backoffMultiplier??2,maxDelayMs:e.maxDelayMs??1e4}}handle(e,t){let n=this.ensureApplicationError(e,t);return this.notifier&&this.notifier.error(n.message),this.callTelemetryHooks("onError",n,t),this.formatError(n)}async executeWithRetry(e,t){let n,i=0;for(;i<=this.retryConfig.maxRetries;)try{return await e()}catch(s){if(n=this.ensureApplicationError(s,t),!n.retriable||i>=this.retryConfig.maxRetries)throw this.callTelemetryHooks("onError",n,t),i>=this.retryConfig.maxRetries&&n.retriable&&this.callTelemetryHooks("onRetryExhausted",n,i+1),n;let o=this.calculateDelay(i);this.callTelemetryHooks("onRetry",n,i+1,o),this.logger?.debug(`Retrying after ${o}ms (attempt ${i+1}/${this.retryConfig.maxRetries})`),await this.sleep(o),i++}throw n}registerTelemetryHook(e){this.telemetryHooks.add(e)}unregisterTelemetryHook(e){this.telemetryHooks.delete(e)}ensureApplicationError(e,t){if(e instanceof PR.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends PR.ApplicationError{constructor(){super(...arguments),this.code=i.code,this.retriable=i.retriable,this.guidance=i.guidance}}(e.message,s)}return e}return new class extends PR.ApplicationError{static{a(this,"UnknownError")}constructor(s,o){super(s,{originalError:o.name,...t}),this.code=Hse.ErrorCode.UNKNOWN_ERROR,this.retriable=!1,this.guidance="An unexpected error occurred"}}(e.message,e)}formatError(e){let t=[];return t.push(`\u274C ${e.name}: ${e.message}`),e.guidance&&t.push(`\u{1F4A1} ${e.guidance}`),e.context&&Object.keys(e.context).length>0&&t.push(`Context: ${JSON.stringify(e.context,null,2)}`),t.join(`
328
+ \u2022 Contact support if the issue persists`}};q_.ServiceError=ER});var d$=T(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.ServiceError=Dr.ResourceExhaustedError=Dr.NotFoundError=Dr.PermissionError=Dr.StateTransitionError=Dr.NetworkError=Dr.ValidationError=Dr.ApplicationError=Dr.ErrorCode=void 0;var Ese=Ro();Object.defineProperty(Dr,"ErrorCode",{enumerable:!0,get:a(function(){return Ese.ErrorCode},"get")});var vse=Co();Object.defineProperty(Dr,"ApplicationError",{enumerable:!0,get:a(function(){return vse.ApplicationError},"get")});var Tse=s$();Object.defineProperty(Dr,"ValidationError",{enumerable:!0,get:a(function(){return Tse.ValidationError},"get")});var Ase=o$();Object.defineProperty(Dr,"NetworkError",{enumerable:!0,get:a(function(){return Ase.NetworkError},"get")});var Ise=a$();Object.defineProperty(Dr,"StateTransitionError",{enumerable:!0,get:a(function(){return Ise.StateTransitionError},"get")});var Rse=c$();Object.defineProperty(Dr,"PermissionError",{enumerable:!0,get:a(function(){return Rse.PermissionError},"get")});var Cse=l$();Object.defineProperty(Dr,"NotFoundError",{enumerable:!0,get:a(function(){return Cse.NotFoundError},"get")});var xse=u$();Object.defineProperty(Dr,"ResourceExhaustedError",{enumerable:!0,get:a(function(){return xse.ResourceExhaustedError},"get")});var Pse=f$();Object.defineProperty(Dr,"ServiceError",{enumerable:!0,get:a(function(){return Pse.ServiceError},"get")})});var TR=T(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});W_.ShapeRegistry=void 0;var vR=class{static{a(this,"ShapeRegistry")}constructor(){this.shapes=new Map}get(e){return this.shapes.get(e)}register(e){this.shapes.set(e.propertyIRI,e)}getAll(){return Array.from(this.shapes.values())}get size(){return this.shapes.size}};W_.ShapeRegistry=vR});var h$=T(xo=>{"use strict";var Ose=xo&&xo.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Fse=xo&&xo.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),AR=xo&&xo.__importStar||(function(){var r=a(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ose(t,e,n[i]);return Fse(t,e),t}})();Object.defineProperty(xo,"__esModule",{value:!0});xo.ShapeLoader=void 0;var IR=TR(),Bs=De(),Yh=He(),wr=qt(),Dse=o0(),p$=_I(),z_="http://www.w3.org/ns/shacl#",vPe=[["exo__",wr.Namespace.EXO],["ems__",wr.Namespace.EMS],["exocmd__",wr.Namespace.EXOCMD],["ims__",wr.Namespace.IMS],["ztlk__",wr.Namespace.ZTLK],["ptms__",wr.Namespace.PTMS],["lit__",wr.Namespace.LIT],["inbox__",wr.Namespace.INBOX],["pmbok__",wr.Namespace.PMBOK]],La=class r{static{a(this,"ShapeLoader")}static async loadFromVaultFS(e,t){let{readdir:n,readFile:i}=await Promise.resolve().then(()=>AR(require("fs/promises"))),s=await Promise.resolve().then(()=>AR(require("path"))),o=new IR.ShapeRegistry,c={classEdges:[],candidates:[],uidToLabel:new Map};await r.scanDir(e,c,{readdir:n,readFile:t?.readFile??i,path:s});let l=r.propertyClassKeysFromEdges(c.classEdges);for(let u of c.candidates)try{r.registerCandidate(u,o,l,s,c.uidToLabel)}catch{}return o}static async loadFromRDFGraph(e){let t=new IR.ShapeRegistry,n=wr.Namespace.EXO,i=wr.Namespace.RDFS,s=wr.Namespace.RDF,o=await r.buildUidClassIndex(e),c=await r.collectPropertyClassIRIs(e,o),l=await Promise.all([...c].map(async f=>{try{return await e.match(void 0,s.term("type"),new Bs.IRI(f))}catch{return[]}})),u=new Set;for(let f of l.flat())f.subject instanceof Bs.IRI&&u.add(f.subject.value);for(let f of u){let d;try{d=new Bs.IRI(f)}catch{continue}let[p,h,g,m,b,_,S,I,E]=await Promise.all([e.match(d,i.term("domain"),void 0),e.match(d,n.term("Property_domain"),void 0),e.match(d,i.term("range"),void 0),e.match(d,n.term("Property_range"),void 0),e.match(d,n.term("Property_cardinality"),void 0),e.match(d,n.term("Property_severity"),void 0),e.match(d,n.term("Asset_label"),void 0),e.match(d,i.term("label"),void 0),e.match(d,n.term("Property_minCount"),void 0)]),w=[...S,...I],R=[...p,...h],x=[...g,...m];if(R.length===0)continue;let O=null;for(let q of w)if(q.object instanceof Yh.Literal&&(O=r.labelToIRI(q.object.value),O))break;if(!O)continue;let N=await Promise.all(R.map(async q=>q.object instanceof Bs.IRI?await r.resolveClassIRI(q.object.value,e,o):null)),G=Array.from(new Set(N.filter(q=>q!==null))),j=await Promise.all(x.map(async q=>q.object instanceof Bs.IRI?await r.resolveClassIRI(q.object.value,e,o):q.object instanceof Yh.Literal?r.datatypeRangeToIRI(q.object.value):null)),ae=Array.from(new Set(j.filter(q=>q!==null))),Y=r.cardinalityFromIRI(b[0]?.object instanceof Bs.IRI?b[0].object.value:void 0),M=r.severityFromValue(_[0]?.object instanceof Yh.Literal||_[0]?.object instanceof Bs.IRI?_[0].object.value:void 0),ce=(0,p$.parseMinCount)(E.map(q=>q.object));t.register({propertyIRI:O,domain:G,range:ae.length>0?ae:void 0,cardinality:Y,severity:M,minCount:ce})}return t}static async loadFromShapeJSON(e){let{readFile:t}=await Promise.resolve().then(()=>AR(require("fs/promises"))),n=await t(e,"utf-8"),i=JSON.parse(n),s=new IR.ShapeRegistry;for(let o of Object.values(i.shapes))s.register(o);return s}static extractUidFromFileIRI(e){let t=r.FILE_IRI_UID_RE.exec(e);return t?t[1].toLowerCase():null}static async buildUidClassIndex(e){let t=wr.Namespace.RDFS,n=wr.Namespace.EXO,[i,s]=await Promise.all([e.match(void 0,t.term("label"),void 0),e.match(void 0,n.term("Asset_label"),void 0)]),o=new Map;for(let c of[...i,...s]){if(!(c.subject instanceof Bs.IRI)||!(c.object instanceof Yh.Literal))continue;let l=r.extractUidFromFileIRI(c.subject.value);if(!l||o.has(l))continue;let u=c.object.value.trim();if(/\s/.test(u))continue;let f=r.labelToIRI(u);f&&o.set(l,f)}return o}static async collectPropertyClassIRIs(e,t){let n=wr.Namespace.EXO,i=wr.Namespace.RDFS,[s,o]=await Promise.all([e.match(void 0,n.term("Class_superClass"),void 0),e.match(void 0,i.term("subClassOf"),void 0)]),c=new Map,l=a(async p=>{let h=c.get(p);return h===void 0&&(h=await r.resolveClassIRI(p,e,t),c.set(p,h)),h},"canon"),u=new Map;for(let p of[...s,...o]){if(!(p.subject instanceof Bs.IRI)||!(p.object instanceof Bs.IRI))continue;let[h,g]=await Promise.all([l(p.subject.value),l(p.object.value)]);if(!h||!g||h===g)continue;let m=u.get(g)??new Set;m.add(h),u.set(g,m)}let f=new Set([n.term("Property").value,n.term("ObjectProperty").value]),d=[...f];for(;d.length>0;){let p=d.shift();for(let h of u.get(p)??[])f.has(h)||(f.add(h),d.push(h))}return f}static async resolveClassIRI(e,t,n){if(e.startsWith("https://exocortex.my/ontology/")||e.startsWith("http://www.w3.org/"))return e;let i;try{i=new Bs.IRI(e)}catch{return null}let s=wr.Namespace.RDFS,o=wr.Namespace.EXO,[c,l]=await Promise.all([t.match(i,s.term("label"),void 0),t.match(i,o.term("Asset_label"),void 0)]);for(let u of[...c,...l])if(u.object instanceof Yh.Literal){let f=r.labelToIRI(u.object.value);if(f)return f}if(n){let u=r.extractUidFromFileIRI(e);if(u){let f=n.get(u);if(f)return f}}return e}static propertyClassKeysFromEdges(e){let t=["exo__Property",r.EXO_PROPERTY_UID,"exo__ObjectProperty",r.EXO_OBJECT_PROPERTY_UID],n=new Set(t),i=[...t];for(;i.length>0;){let s=i.shift();for(let o of e)if(o.parentKeys.includes(s)&&!o.childKeys.some(c=>n.has(c)))for(let c of o.childKeys)n.add(c),i.push(c)}return n}static wikilinkClassKeys(e){let t=r.extractWikilinkRef(e);if(!t)return[];let n=[t.trim()];for(let i of t.split("|")){let s=i.trim();s.length>0&&n.push(s)}return n}static async scanDir(e,t,n){let i;try{i=await n.readdir(e,{withFileTypes:!0})}catch{return}i.sort((s,o)=>s.name<o.name?-1:s.name>o.name?1:0);for(let s of i){let o=n.path.join(e,s.name);if(s.isDirectory())await r.scanDir(o,t,n);else if(s.isFile()&&s.name.endsWith(".md"))try{await r.collectFile(o,t,n.readFile,n.path)}catch{}}}static async collectFile(e,t,n,i){let s;try{s=await n(e,"utf-8")}catch{return}let o=r.parseFrontmatter(s);if(!o)return;r.indexUidLabel(e,o,t.uidToLabel,i);let c=r.asArray(o.exo__Class_superClass);if(c.length>0){let l=[i.basename(e,".md")],u=o.exo__Asset_uid;typeof u=="string"&&u.trim().length>0&&l.push(u.trim().replace(/^["']|["']$/g,""));let f=o.exo__Asset_label;typeof f=="string"&&f.trim().length>0&&l.push(f.trim().replace(/^["']|["']$/g,"")),t.classEdges.push({childKeys:l,parentKeys:c.flatMap(d=>r.wikilinkClassKeys(d))})}r.asArray(o.exo__Property_domain).length>0&&t.candidates.push({filePath:e,fm:o})}static indexUidLabel(e,t,n,i){let s=t.exo__Asset_label;if(typeof s!="string")return;let o=s.trim().replace(/^["']|["']$/g,"");if(o.length===0||/\s/.test(o)||!wr.Namespace.fromPropertyKey(o))return;let c=t.exo__Asset_uid,l=[typeof c=="string"?c.trim().replace(/^["']|["']$/g,""):"",i.basename(e,".md")];for(let u of l){if(!r.BARE_UID_RE.test(u))continue;let f=u.toLowerCase();n.has(f)||n.set(f,o)}}static registerCandidate(e,t,n,i,s){let{filePath:o,fm:c}=e;if(!r.asArray(c.exo__Instance_class).some(x=>r.wikilinkClassKeys(x).some(O=>n.has(O))))return;let f=null,d=c.exo__Asset_label;if(typeof d=="string"&&d.trim().length>0)f=d.trim().replace(/^["']|["']$/g,"");else{let x=i.basename(o,".md");wr.Namespace.fromPropertyKey(x)&&(f=x)}if(!f)return;let p=r.labelToIRI(f);if(!p)return;let h=c.exo__Property_domain,g=c.exo__Property_range,m=c.exo__Property_cardinality,b=c.exo__Property_severity,_=c.exo__Property_minCount,S=r.asArray(h).map(x=>r.wikilinkToIRI(x,s)).filter(x=>x!==null);if(S.length===0)return;let I=r.asArray(g).map(x=>r.wikilinkToIRI(x,s)).filter(x=>x!==null),E=r.cardinalityFromLabel(typeof m=="string"?m:void 0),w=r.severityFromValue(typeof b=="string"?b:void 0),R=(0,p$.parseMinCount)(_);t.register({propertyIRI:p,domain:S,range:I.length>0?I:void 0,cardinality:E,severity:w,minCount:R})}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let n=t[1],i={},s=n.split(/\r?\n/),o=null,c=null;for(let l of s){let u=/^ {2}- (.*)$/.exec(l);if(u){o&&c&&c.push(u[1].trim());continue}o&&c&&(i[o]=c,o=null,c=null);let f=/^([^:]+):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),p=f[2].trim();p===""?(o=d,c=[]):i[d]=p}return o&&c&&(i[o]=c),i}static labelToIRI(e){let t=wr.Namespace.fromPropertyKey(e);if(!t)return null;try{return t.namespace.term(t.localName).value}catch{return null}}static extractWikilinkRef(e){let t=e.replace(/^["']|["']$/g,""),n=/\[\[([^\]]+)\]\]/.exec(t);return n?n[1]:t}static wikilinkToIRI(e,t){let n=r.extractWikilinkRef(e);if(!n)return null;let i=n.split("|"),s=i.length>1?[i[1],i[0]]:[i[0]];for(let c of s){let l=r.labelToIRI(c.trim());if(l)return l}let o=r.datatypeRangeToIRI(n);if(o)return o;if(n.startsWith("sh:"))return z_+n.substring(3);if(t)for(let c of s){let l=t.get(c.trim().toLowerCase());if(l===void 0)continue;let u=r.labelToIRI(l);if(u)return u}return null}static datatypeRangeToIRI(e){return e.startsWith("http://")||e.startsWith("https://")?e:(0,Dse.xsdDatatypeIRI)(e)}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static cardinalityFromIRI(e){if(e){if(e.endsWith("PropertyCardinalitySingle"))return"Single";if(e.endsWith("PropertyCardinalityMultiple"))return"Multiple";if(e.includes(r.CARDINALITY_SINGLE_UID))return"Single";if(e.includes(r.CARDINALITY_MULTIPLE_UID))return"Multiple"}}static cardinalityFromLabel(e){if(!e)return;let t=r.extractWikilinkRef(e)??e,n=t.split("|").pop()??t;if(n.includes("Single"))return"Single";if(n.includes("Multiple"))return"Multiple";if(t.includes(r.CARDINALITY_SINGLE_UID))return"Single";if(t.includes(r.CARDINALITY_MULTIPLE_UID))return"Multiple"}static severityFromValue(e){return!e||e.includes("Violation")||e===z_+"Violation"?"sh:Violation":e.includes("Warning")||e===z_+"Warning"?"sh:Warning":e.includes("Info")||e===z_+"Info"?"sh:Info":"sh:Violation"}};xo.ShapeLoader=La;La.FILE_IRI_UID_RE=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;La.BARE_UID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;La.EXO_PROPERTY_UID="38277bfa-d7f9-4a75-b856-b23276ab0db3";La.EXO_OBJECT_PROPERTY_UID="9a1cf31c-9d41-4ef3-9023-584a8d087d16";La.CARDINALITY_SINGLE_UID="c93c4b2f-b43d-4cc9-8dd0-31514d608da2";La.CARDINALITY_MULTIPLE_UID="59a37aa7-ffbe-4e0d-ba60-06ae370d880f"});var xR=T(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.ShapeRegistry=void 0;dd.extractUidFromIRI=CR;dd.validate=zse;var Lse=De(),RR=class{static{a(this,"ShapeRegistry")}constructor(e=[],t="https://exocortex.my/ontology/exo#Instance_class"){this.shapeMap=new Map(e.map(n=>[n.propertyIRI,n])),this.typePredicateIRI=t}getShape(e){return this.shapeMap.get(e)}getAllShapes(){return Array.from(this.shapeMap.values())}hasShape(e){return this.shapeMap.has(e)}};dd.ShapeRegistry=RR;var Nse="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",kse=["http://www.w3.org/2001/XMLSchema#","http://www.w3.org/1999/02/22-rdf-syntax-ns#","http://www.w3.org/2000/01/rdf-schema#","http://www.w3.org/2002/07/owl#","http://www.w3.org/ns/shacl#","http://www.w3.org/2004/02/skos/core#","http://purl.org/dc/elements/1.1/","http://purl.org/dc/terms/","http://xmlns.com/foaf/0.1/","https://schema.org/","https://exocortex.my/ontology/xsd#","https://exocortex.my/ontology/rdf#","https://exocortex.my/ontology/rdfs#","https://exocortex.my/ontology/owl#","https://exocortex.my/ontology/skos#"];function Mse(r){return kse.some(e=>r.startsWith(e))}a(Mse,"isExternalOntologyIRI");var b$=["http://www.w3.org/2001/XMLSchema#","https://exocortex.my/ontology/xsd#"];function m$(r){return b$.some(e=>r.startsWith(e))}a(m$,"isXSDDatatypeIRI");function jse(r){for(let e of b$)if(r.startsWith(e))return r.substring(e.length);return null}a(jse,"xsdLocalName");var $se="http://www.w3.org/2001/XMLSchema#decimal",Use="http://www.w3.org/2001/XMLSchema#integer",g$="http://www.w3.org/2001/XMLSchema#string",Xh=/^[+-]?\d+$/,Qh=/^\+?\d+$/,Bse=/^[+-]?(\d+(\.\d*)?|\.\d+)$/,y$=/^([+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?|[+-]?INF|NaN)$/,Vse={integer:Xh,long:Xh,int:Xh,short:Xh,byte:Xh,nonNegativeInteger:Qh,unsignedLong:Qh,unsignedInt:Qh,unsignedShort:Qh,unsignedByte:Qh,positiveInteger:/^\+?0*[1-9]\d*$/,nonPositiveInteger:/^(-\d+|\+?0+)$/,negativeInteger:/^-0*[1-9]\d*$/,decimal:Bse,float:y$,double:y$,gYear:/^-?\d{4,}(Z|[+-]\d{2}:\d{2})?$/},Gse=/^(true|false)$/;function qse(r,e,t){if(e===t)return!0;let n=jse(t);if(n===null)return!1;if(e===$se||e===Use){let i=Vse[n];return i!==void 0&&i.test(r)}return e===g$&&n==="boolean"?Gse.test(r):e===g$&&n==="anyURI"?Lse.IRI.isValidIRI(r):!1}a(qse,"literalConformsToDatatype");var Wse=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function CR(r){let e=Wse.exec(r);return e?e[1].toLowerCase():null}a(CR,"extractUidFromIRI");function zse(r,e,t,n){let i=new Map,s=new Map;for(let l of r){let{subject:u,predicate:f,object:d}=l;if(u.type!=="iri"||f.type!=="iri"||d.type!=="iri"&&d.type!=="literal")continue;let p=u.value,h=f.value,g=d;if(h===e.typePredicateIRI||h===Nse){if(g.type==="iri"){let b=i.get(p)??[];b.push(g.value),i.set(p,b);let _=CR(p);if(_){let S=`uid:${_}`,I=i.get(S)??[];I.push(g.value),i.set(S,I)}}}else{let b=s.get(p);b||(b=new Map,s.set(p,b));let _=b.get(h)??[];_.push(g),b.set(h,_)}}let o=[],c=new Set([...i.keys(),...s.keys()]);for(let l of c){if(l.startsWith("uid:"))continue;let u=i.get(l)??[],f=s.get(l)??new Map;for(let d of e.getAllShapes()){if(!(d.domain.length===0||d.domain.some(g=>u.some(m=>m===g||t.isSubClassOf(m,g)))))continue;let h=f.get(d.propertyIRI)??[];if(d.minCount!==void 0&&d.minCount>0&&h.length<d.minCount){o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"minCount",message:d.message??`sh:minCount violation: expected at least ${d.minCount} value(s) for <${d.propertyIRI}>`});continue}if(h.length!==0){if(d.cardinality==="Single"&&h.length>1){o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"maxCount",message:d.message??`sh:maxCount violation: expected at most 1 value for <${d.propertyIRI}>, got ${h.length}`});continue}if(d.range&&d.range.length>0){for(let g of h)if(g.type==="iri"){if(Mse(g.value))continue;let m=d.range.filter(S=>!m$(S));if(m.length===0)continue;let b=i.get(g.value)??[];if(b.length===0){let S=CR(g.value);S&&(b=i.get(`uid:${S}`)??[])}if(!m.some(S=>b.some(I=>I===S||t.isSubClassOf(I,S)))){let S=b.length===0;o.push({focusNode:l,propertyPath:d.propertyIRI,severity:S?"sh:Warning":d.severity,constraint:"class",message:S?`sh:class unresolvable-ref: <${g.value}> has no resolvable type in this vault (cross-vault, symbolic, or external reference); not validated against ${m.join(" | ")}`:d.message??`sh:class violation: <${g.value}> does not conform to expected class ${m.join(" | ")}`,actualValue:g.value,expectedRange:m.join(" | ")})}}else if(g.type==="literal"){let m=d.range.filter(S=>m$(S));if(m.length===0)continue;let b=g.datatype??"http://www.w3.org/2001/XMLSchema#string";m.some(S=>qse(g.value,b,S))||o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"datatype",message:d.message??`sh:datatype violation: literal "${g.value}" has datatype <${b}>, expected ${m.join(" | ")}`,actualValue:g.value,expectedRange:m.join(" | ")})}}}}}if(n?.closedWorldMode)for(let l of c){let u=s.get(l)??new Map;for(let f of u.keys())e.hasShape(f)||o.push({focusNode:l,propertyPath:f,severity:"sh:Warning",constraint:"unknown-property",message:`Unknown property: <${f}> has no registered shape`})}return o.sort((l,u)=>{let f=l.focusNode.localeCompare(u.focusNode);return f!==0?f:l.propertyPath.localeCompare(u.propertyPath)}),{conforms:!o.some(l=>l.severity==="sh:Violation"),violations:o}}a(zse,"validate")});var _$=T(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});H_.ApplicationErrorHandler=void 0;var PR=Co(),Hse=Ro(),Kse=Xl(),OR=class{static{a(this,"ApplicationErrorHandler")}constructor(e={},t,n){this.logger=t,this.notifier=n,this.telemetryHooks=new Set,this.retryConfig={maxRetries:e.maxRetries??3,initialDelayMs:e.initialDelayMs??1e3,backoffMultiplier:e.backoffMultiplier??2,maxDelayMs:e.maxDelayMs??1e4}}handle(e,t){let n=this.ensureApplicationError(e,t);return this.notifier&&this.notifier.error(n.message),this.callTelemetryHooks("onError",n,t),this.formatError(n)}async executeWithRetry(e,t){let n,i=0;for(;i<=this.retryConfig.maxRetries;)try{return await e()}catch(s){if(n=this.ensureApplicationError(s,t),!n.retriable||i>=this.retryConfig.maxRetries)throw this.callTelemetryHooks("onError",n,t),i>=this.retryConfig.maxRetries&&n.retriable&&this.callTelemetryHooks("onRetryExhausted",n,i+1),n;let o=this.calculateDelay(i);this.callTelemetryHooks("onRetry",n,i+1,o),this.logger?.debug(`Retrying after ${o}ms (attempt ${i+1}/${this.retryConfig.maxRetries})`),await this.sleep(o),i++}throw n}registerTelemetryHook(e){this.telemetryHooks.add(e)}unregisterTelemetryHook(e){this.telemetryHooks.delete(e)}ensureApplicationError(e,t){if(e instanceof PR.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends PR.ApplicationError{constructor(){super(...arguments),this.code=i.code,this.retriable=i.retriable,this.guidance=i.guidance}}(e.message,s)}return e}return new class extends PR.ApplicationError{static{a(this,"UnknownError")}constructor(s,o){super(s,{originalError:o.name,...t}),this.code=Hse.ErrorCode.UNKNOWN_ERROR,this.retriable=!1,this.guidance="An unexpected error occurred"}}(e.message,e)}formatError(e){let t=[];return t.push(`\u274C ${e.name}: ${e.message}`),e.guidance&&t.push(`\u{1F4A1} ${e.guidance}`),e.context&&Object.keys(e.context).length>0&&t.push(`Context: ${JSON.stringify(e.context,null,2)}`),t.join(`
329
329
  `)}calculateDelay(e){let t=this.retryConfig.initialDelayMs*Math.pow(this.retryConfig.backoffMultiplier,e);return Math.min(t,this.retryConfig.maxDelayMs)}sleep(e){return new Promise(t=>setTimeout(t,e))}callTelemetryHooks(e,...t){for(let n of this.telemetryHooks)try{let i=n[e];i&&i.apply(n,t)}catch(i){Kse.LoggingService.error("Error in telemetry hook",i instanceof Error?i:new Error(String(i)))}}};H_.ApplicationErrorHandler=OR});var S$=T(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});K_.ApplicationErrorHandler=void 0;var Yse=_$();Object.defineProperty(K_,"ApplicationErrorHandler",{enumerable:!0,get:a(function(){return Yse.ApplicationErrorHandler},"get")})});var w$=T(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});Y_.ClassHierarchy=void 0;var Xse="http://www.w3.org/2000/01/rdf-schema#subClassOf",FR=class{static{a(this,"ClassHierarchy")}constructor(e){this.adjacency=new Map;for(let t of e){if(t.predicate.type!=="iri"||t.predicate.value!==Xse||t.subject.type!=="iri"||t.object.type!=="iri")continue;let n=t.subject.value,i=t.object.value,s=this.adjacency.get(n);s||(s=new Set,this.adjacency.set(n,s)),s.add(i)}}isSubClassOf(e,t){if(e===t)return!0;let n=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(n.has(s))continue;n.add(s);let o=this.adjacency.get(s);if(o)for(let c of o){if(c===t)return!0;n.has(c)||i.push(c)}}return!1}getAncestors(e){let t=new Set,n=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(n.has(s))continue;n.add(s);let o=this.adjacency.get(s);if(o)for(let c of o)t.add(c),n.has(c)||i.push(c)}return t}};Y_.ClassHierarchy=FR});var DR=T(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});X_.parseTarball=T$;X_.parseTarballGzip=roe;var Qse={0:"file",1:"hardLink",2:"symbolicLink",3:"characterDevice",4:"blockDevice",5:"directory",6:"fifo",7:"contiguousFile",g:"globalExtendedHeader",x:"extendedHeader",D:"gnuDirectory",I:"gnuInodeMetadata",K:"gnuLongLinkName",L:"gnuLongFileName",N:"gnuOldLongFileName",M:"gnuMultiVolume",S:"gnuSparseFile",E:"gnuExtendedSparse"},Jse=new Set(["extendedHeader","globalExtendedHeader","gnuLongFileName","gnuOldLongFileName","gnuLongLinkName"]),E$;function v$(){return E$??(E$=new TextDecoder)}a(v$,"getDecoder");function Jh(r,e,t){let n=r.subarray(e,e+t),i=n.indexOf(0);return v$().decode(i===-1?n:n.subarray(0,i))}a(Jh,"readString");function Zse(r,e,t){let n="";for(let s=0;s<t;s++)n+=String.fromCodePoint(r[e+s]);let i=Number.parseInt(n,8);return Number.isNaN(i)?0:i}a(Zse,"readNumber");function eoe(r){let e=v$().decode(r),t={};for(let n of e.split(`
330
330
  `)){let i=n.indexOf("=");if(i===-1)continue;let s=n.slice(n.indexOf(" ")+1,i),o=n.slice(i+1);s&&(t[s]=o)}return t}a(eoe,"parseExtendedHeaders");function toe(r){let e=r.replace(/\\/g,"/");e=e.replace(/^[a-zA-Z]:\//,""),e=e.replace(/^\/+/,"");let t=e.startsWith("./"),n=e.split("/"),i=[];for(let o of n)o===".."?i.pop():o!=="."&&o!==""&&i.push(o);let s=i.join("/");return t&&!s.startsWith("./")&&(s="./"+s),r.endsWith("/")&&!s.endsWith("/")&&(s+="/"),s}a(toe,"sanitizePath");function T$(r){let e=r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r:r.slice(),t=[],n=0,i,s;for(;n+512<=e.byteLength;){let o=Jh(e,n,100);if(o.length===0)break;let c=!1;if(i){let h=i.path??i.linkpath;h&&(o=h,c=!0)}let l=Zse(e,n+124,12),u=512+512*Math.trunc(l/512)+(l%512?512:0),f=Jh(e,n+156,1)||"0",d=Qse[f]??f;if(d==="extendedHeader"||d==="globalExtendedHeader"){let h=eoe(e.subarray(n+512,n+512+l));d==="extendedHeader"?i=h:(i=void 0,s={...s,...h}),n+=u;continue}if(Jse.has(d)){i={path:Jh(e,n+512,l)},n+=u;continue}if(!c&&Jh(e,n+257,6).startsWith("ustar")){let g=Jh(e,n+345,155);g.length>0&&(o=`${g}/${o}`)}o=toe(o);let p=l===0?void 0:e.subarray(n+512,n+512+l);t.push({name:o,type:d,size:l,data:p}),i=void 0,n+=u}return t}a(T$,"parseTarball");async function roe(r){let e=new Uint8Array(r instanceof Uint8Array?r:new Uint8Array(r)),t=new DecompressionStream("gzip"),n=t.writable.getWriter(),[,i]=await Promise.all([n.write(e).then(()=>n.close()),new Response(t.readable).arrayBuffer()]);return T$(new Uint8Array(i))}a(roe,"parseTarballGzip")});var J_=T(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});Q_.isBinaryPayload=NR;Q_.restCreateCommit=ioe;function NR(r){return typeof r!="string"}a(NR,"isBinaryPayload");var noe="https://api.github.com";function A$(r){if(r!==null&&typeof r=="object"&&"object"in r){let e=r.object;if(e!==null&&typeof e=="object"&&"sha"in e){let t=e.sha;return typeof t=="string"?t:void 0}}}a(A$,"readObjectSha");function LR(r){if(r!==null&&typeof r=="object"&&"sha"in r){let e=r.sha;return typeof e=="string"?e:void 0}}a(LR,"readSha");async function ioe(r,e){let{owner:t,repo:n,branch:i,files:s,message:o}=e,c=e.deletions??[],l=(e.baseURL??noe).replace(/\/$/,""),u=e.redact??(O=>O);if(typeof t!="string"||t.length===0)throw new Error("restCreateCommit: owner is required");if(typeof n!="string"||n.length===0)throw new Error("restCreateCommit: repo is required");if(typeof i!="string"||i.length===0)throw new Error("GitHub createCommit: branch is required");if(!(s instanceof Map)||s.size===0&&c.length===0)throw new Error("GitHub createCommit: files map must be non-empty (unless deletions are provided)");let f=new Set;for(let O of c){if(typeof O!="string"||O.length===0)throw new Error("GitHub createCommit: deletion path must be a non-empty string");if(s.has(O))throw new Error(u(`GitHub createCommit: path ${O} is both written and deleted \u2014 ambiguous`));f.add(O)}if(typeof o!="string"||o.length===0)throw new Error("GitHub createCommit: message is required");let d=encodeURIComponent(t),p=encodeURIComponent(n),h=encodeURIComponent(i),g=await r({method:"GET",url:`${l}/repos/${d}/${p}/git/refs/heads/${h}`}),m=A$(g?.json);if(typeof m!="string"||m.length===0)throw new Error(u(`GitHub createCommit: missing object.sha for ref heads/${i}`));if(e.expectedHeadSha!==void 0&&m!==e.expectedHeadSha)throw new Error(u(`GitHub createCommit: head heads/${i} moved since the caller's check (expected ${e.expectedHeadSha}, found ${m}) \u2014 refusing to avoid overwriting a concurrent change`));let b=new Map;for(let[O,N]of s){if(!NR(N))continue;let G=await r({method:"POST",url:`${l}/repos/${d}/${p}/git/blobs`,contentType:"application/json",body:JSON.stringify({content:N.base64,encoding:"base64"})}),j=LR(G?.json);if(typeof j!="string"||j.length===0)throw new Error(u(`GitHub createCommit: blob create returned no sha for ${O}`));b.set(O,j)}let _=Array.from(s.entries()).map(([O,N])=>NR(N)?{path:O,mode:"100644",type:"blob",sha:b.get(O)}:{path:O,mode:"100644",type:"blob",content:N});for(let O of f)_.push({path:O,mode:"100644",type:"blob",sha:null});let S=await r({method:"POST",url:`${l}/repos/${d}/${p}/git/trees`,contentType:"application/json",body:JSON.stringify({base_tree:m,tree:_})}),I=LR(S?.json);if(typeof I!="string"||I.length===0)throw new Error(u("GitHub createCommit: tree create returned no sha"));let E=await r({method:"POST",url:`${l}/repos/${d}/${p}/git/commits`,contentType:"application/json",body:JSON.stringify({message:o,tree:I,parents:[m]})}),w=LR(E?.json);if(typeof w!="string"||w.length===0)throw new Error(u("GitHub createCommit: commit create returned no sha"));let R=await r({method:"PATCH",url:`${l}/repos/${d}/${p}/git/refs/heads/${h}`,contentType:"application/json",body:JSON.stringify({sha:w,force:!1})}),x=A$(R?.json);if(x!==w)throw new Error(u(`GitHub createCommit: ref update mismatch (expected ${w}, got ${x})`));return w}a(ioe,"restCreateCommit")});var C$=T(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.MATERIALIZE_PROGRESS_MIN_FILES=Li.MATERIALIZE_PROGRESS_INTERVAL=void 0;Li.discoverWrapperDir=I$;Li.extractShaFromWrapper=R$;Li.mountAssetSpaceFiles=aoe;Li.escapeGitmodulesRegex=MR;Li.appendGitmodulesEntry=coe;Li.stripGitmodulesEntry=loe;var soe=DR(),kR=new Set(["globalExtendedHeader","extendedHeader"]);function Z_(r){let e=r.replace(/\\/g,"/").replace(/\/+/g,"/");for(;e.startsWith("./");)e=e.slice(2);return e}a(Z_,"normalizeEntryPath");function I$(r){let e=r.find(s=>!kR.has(s.type)&&Z_(s.name).includes("/"));if(e===void 0)throw new Error("discoverWrapperDir: no wrapper-bearing entry in tarball");let t=Z_(e.name),n=t.slice(0,t.indexOf("/"));if(n.length===0)throw new Error(`discoverWrapperDir: empty wrapper segment in entry "${e.name}"`);let i=n+"/";for(let s of r){if(kR.has(s.type))continue;let o=Z_(s.name);if(!(o===n||o===i)&&!o.startsWith(i))throw new Error(`discoverWrapperDir: entry "${s.name}" not under wrapper "${n}"`)}return n}a(I$,"discoverWrapperDir");function R$(r){let e=r.match(/-([0-9a-fA-F]{7,40})$/);if(e===null)throw new Error(`extractShaFromWrapper: wrapper "${r}" does not match expected GitHub pattern <owner>-<repo>-<sha>`);return e[1].toLowerCase()}a(R$,"extractShaFromWrapper");function ooe(r,e){let t=e+"/",n=[];for(let i of r){if(i.type==="symbolicLink"||i.type==="hardLink")throw new Error(`${i.type} entry "${i.name}" rejected for security`);if(kR.has(i.type)||i.type==="directory")continue;let s=Z_(i.name);if(s===e||s===t)continue;if(!s.startsWith(t))throw new Error(`entry "${i.name}" not under wrapper "${e}"`);let o=s.slice(t.length);if(o.length!==0){if(o.split("/").some(c=>c===".."))throw new Error(`path traversal detected for entry "${i.name}"`);i.data!==void 0&&n.push({relPath:o,content:i.data})}}return n}a(ooe,"buildMountFiles");Li.MATERIALIZE_PROGRESS_INTERVAL=200;Li.MATERIALIZE_PROGRESS_MIN_FILES=500;async function aoe(r){let{http:e,fs:t,owner:n,repo:i,ref:s,targetPath:o}=r,c=a((b,_)=>{if(r.onProgress!==void 0)try{r.onProgress(b,_)}catch{}},"emit");c("fetch");let l=await e.fetchTarball(n,i,s);c("extract");let u=await(0,soe.parseTarballGzip)(l);if(u.length===0)throw new Error(`tarball empty for ${n}/${i}@${s}`);let f=I$(u),d=R$(f),p=ooe(u,f);c("materialize");let h=p.length,g=r.onProgress!==void 0&&h>Li.MATERIALIZE_PROGRESS_MIN_FILES,m=await t.materialize(o,p,g?b=>{b%Li.MATERIALIZE_PROGRESS_INTERVAL===0&&b<h&&c("materialize",{processed:b,total:h})}:void 0);return{sha:d,fileCount:m}}a(aoe,"mountAssetSpaceFiles");function MR(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}a(MR,"escapeGitmodulesRegex");function coe(r,e,t){let n=new RegExp(`^\\s*\\[submodule\\s+"${MR(e)}"\\]`,"m");if(r.length>0&&n.test(r))return{content:r,added:!1};let i=r.length===0||r.endsWith(`
331
331
  `)?"":`
@@ -333,15 +333,15 @@ To resolve:
333
333
  path = ${e}
334
334
  url = ${t}
335
335
  `;return{content:r+i+s,added:!0}}a(coe,"appendGitmodulesEntry");function loe(r,e){let t=r.split(/\r?\n/),n=[],i=!1,s=new RegExp(`^\\[submodule\\s+"${MR(e)}"\\]\\s*$`);for(let l of t){if(i){if(/^\[.+\]\s*$/.test(l)){i=!1,n.push(l);continue}continue}if(s.test(l)){i=!0;continue}n.push(l)}let o=[],c=!1;for(let l of n){let u=l.trim().length===0;u&&c||(o.push(l),c=u)}return o.join(`
336
- `)}a(loe,"stripGitmodulesEntry")});var pd=T(jR=>{"use strict";Object.defineProperty(jR,"__esModule",{value:!0});jR.gitBlobSha=uoe;async function uoe(r,e){let t=new TextEncoder,n=typeof r=="string"?t.encode(r):r,i=t.encode(`blob ${n.byteLength}\0`),s=new Uint8Array(i.byteLength+n.byteLength);return s.set(i,0),s.set(n,i.byteLength),e(s)}a(uoe,"gitBlobSha")});var Zh=T(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});eS.extractAssetUid=x$;eS.detectChanges=doe;var foe=pd();function x$(r){let e=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/.exec(r);if(!e)return;let t=/^exo__Asset_uid:[ \t]*["']?([^\s"']+)["']?[ \t]*$/m.exec(e[1]);return t?t[1]:void 0}a(x$,"extractAssetUid");async function doe(r){let{localFiles:e,cachedEntries:t,watermark:n,actualBaseTreeSha:i,sha1:s}=r;if(n===null)return{kind:"full-conflict",reason:"first-sync"};if(i===null)return{kind:"full-conflict",reason:"base-mismatch",detail:`watermark commit ${n.lastSyncedSha} not resolvable on remote`};if(i!==n.rootTreeSha)return{kind:"full-conflict",reason:"base-mismatch",detail:`stored root tree ${n.rootTreeSha} != actual ${i} at ${n.lastSyncedSha}`};let o=[],c=new Map;for(let[E,w]of e){let R=await(0,foe.gitBlobSha)(w,s);c.set(E,R),o.push({path:E,blobSha:R,uid:typeof w=="string"?x$(w):void 0})}if(t!==void 0)for(let[E,w]of t)c.set(E,w.blobSha),o.push({path:E,blobSha:w.blobSha,uid:w.uid});let l=[],u=[],f=[],d=[],p=new Map;for(let E of o){if(E.uid===void 0)continue;let w=p.get(E.uid)??[];w.push(E.path),p.set(E.uid,w)}let h=new Map;for(let E of n.files){if(E.uid===void 0)continue;let w=h.get(E.uid)??[];w.push(E.path),h.set(E.uid,w)}let g=new Set;for(let[E,w]of p)w.length>1&&g.add(E);for(let[E,w]of h)w.length>1&&g.add(E);for(let E of[...g].sort()){let w=p.get(E)??[],R=w.length>1?`on disk (${w.join(", ")})`:`in the sync base (${(h.get(E)??[]).join(", ")})`;d.push(`duplicate uid ${E} ${R} \u2014 uid identity suppressed for the group; every path matched by path identity (#3477)`)}let m=new Map,b=[];for(let E of n.files)E.uid!==void 0&&!g.has(E.uid)?m.set(E.uid,E):b.push(E);let _=[],S=new Set;for(let E of o){let w=E.uid!==void 0&&!g.has(E.uid)?m.get(E.uid):void 0;E.uid!==void 0&&w!==void 0?(S.add(E.uid),(w.blobSha!==E.blobSha||w.path!==E.path)&&u.push({path:E.path,uid:E.uid,blobSha:E.blobSha,...w.path!==E.path?{basePath:w.path}:{}})):_.push(E)}let I=new Map;for(let E of b)I.set(E.path,E);for(let[E,w]of m)S.has(E)||I.set(w.path,w);for(let E of _){let w=I.get(E.path);w!==void 0?(I.delete(E.path),w.blobSha!==E.blobSha&&u.push({path:E.path,uid:E.uid,blobSha:E.blobSha})):l.push({path:E.path,uid:E.uid,blobSha:E.blobSha})}for(let E of I.values())f.push({path:E.path,uid:E.uid,blobSha:E.blobSha});return{kind:"changes",added:l,modified:u,deleted:f,warnings:d,diskBlobShas:c,duplicateUids:g}}a(doe,"detectChanges")});var F$=T(em=>{"use strict";Object.defineProperty(em,"__esModule",{value:!0});em.rewriteAssetUid=P$;em.findDuplicateUidGroups=O$;em.planDuplicateUidFix=hoe;var poe=Zh();function P$(r,e){let t=/^(---\r?\n)([\s\S]*?)(\r?\n---(?=\r?\n|$))/.exec(r);if(t===null)return r;let n=t[2].replace(/^(exo__Asset_uid:[ \t]*["']?)[^\s"']+(["']?[ \t]*)$/m,`$1${e}$2`);return n===t[2]?r:r.slice(0,t.index)+t[1]+n+t[3]+r.slice(t.index+t[0].length)}a(P$,"rewriteAssetUid");function O$(r){let e=new Map;for(let t of r){let n=(0,poe.extractAssetUid)(t.content);if(n===void 0)continue;let i=e.get(n)??[];i.push(t.path),e.set(n,i)}return[...e.entries()].filter(([,t])=>t.length>1).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>({uid:t,paths:n}))}a(O$,"findDuplicateUidGroups");function hoe(r,e){let t=new Map(r.map(i=>[i.path,i.content])),n=[];for(let i of O$(r)){let s=[...i.paths].sort((o,c)=>o.localeCompare(c));for(let o of s.slice(1)){let c=t.get(o);if(c===void 0)continue;let l=e(),u=P$(c,l);u!==c&&n.push({path:o,fromUid:i.uid,toUid:l,content:u})}}return n}a(hoe,"planDuplicateUidFix")});var hd=T(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.EMPTY_TREE_SHA=void 0;Oo.getHeadSha=goe;Oo.getCommitInfo=yoe;Oo.getTree=boe;Oo.getBlobText=_oe;Oo.getBlobBytes=Soe;var D$=sf(),moe="https://api.github.com";function tm(r){return(r??moe).replace(/\/$/,"")}a(tm,"api");function nu(r){return r!==null&&typeof r=="object"?r:void 0}a(nu,"asRecord");function Po(r,e){let n=nu(r)?.[e];return typeof n=="string"?n:void 0}a(Po,"readString");async function goe(r,e,t,n,i){let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/refs/heads/${encodeURIComponent(n)}`}),o=Po(nu(s?.json)?.object,"sha");if(typeof o!="string"||o.length===0)throw new Error(`ExoSync: missing object.sha for ref heads/${n}`);return o}a(goe,"getHeadSha");async function yoe(r,e,t,n,i){let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/commits/${encodeURIComponent(n)}`}),o=nu(s?.json),c=Po(o,"sha"),l=Po(o?.tree,"sha");if(!c||!l)throw new Error(`ExoSync: malformed commit response for ${n}`);let u=o?.parents,f=Array.isArray(u)?u.map(d=>Po(d,"sha")).filter(d=>typeof d=="string"):[];return{sha:c,treeSha:l,parents:f}}a(yoe,"getCommitInfo");Oo.EMPTY_TREE_SHA="4b825dc642cb6eb9a060e54bf8d69288fbee4904";async function boe(r,e,t,n,i){if(n===Oo.EMPTY_TREE_SHA)return[];let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/trees/${encodeURIComponent(n)}?recursive=1`}),o=nu(s?.json);if(o?.truncated===!0)throw new Error(`ExoSync: tree ${n} is truncated by GitHub (repo too large for recursive listing) \u2014 refusing to diff`);let c=o?.tree;if(!Array.isArray(c))throw new Error(`ExoSync: malformed tree response for ${n}`);let l=[];for(let u of c){let f=nu(u);if(f?.type!=="blob")continue;let d=Po(f,"path"),p=Po(f,"sha"),h=typeof f.size=="number"?f.size:void 0;d&&p&&l.push({path:d,blobSha:p,...h!==void 0?{size:h}:{}})}return l}a(boe,"getTree");async function _oe(r,e,t,n,i){let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(n)}`}),o=nu(s?.json),c=Po(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${n}`);return Po(o,"encoding")==="utf-8"?c:(0,D$.base64ToUtf8)(c)}a(_oe,"getBlobText");async function Soe(r,e,t,n,i){let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(n)}`}),o=nu(s?.json),c=Po(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${n}`);return Po(o,"encoding")==="utf-8"?new TextEncoder().encode(c):(0,D$.base64ToBytes)(c)}a(Soe,"getBlobBytes")});var N$=T($R=>{"use strict";Object.defineProperty($R,"__esModule",{value:!0});$R.checkParkedStaleness=Eoe;var woe=hd();async function Eoe(r,e){let t={repoKey:r.repoKey,localPath:r.localPath},n=e.redact??(o=>o),i=null;try{let c=(await e.watermarks.get(r.repoKey))?.lastSyncedSha??"";c.length>0&&(i=c)}catch(o){return{...t,freshness:"unknown",lastSyncedSha:null,remoteHeadSha:null,reason:`watermark unreadable: ${n(L$(o))}`}}if(i===null)return{...t,freshness:"unknown",lastSyncedSha:null,remoteHeadSha:null,reason:"never synced on this device (no watermark)"};let s;try{s=await(0,woe.getHeadSha)(e.transport,r.owner,r.repo,r.branch,e.baseURL)}catch(o){return{...t,freshness:"unknown",lastSyncedSha:i,remoteHeadSha:null,reason:`remote unreachable: ${n(L$(o))}`}}return{...t,freshness:s===i?"current":"behind",lastSyncedSha:i,remoteHeadSha:s}}a(Eoe,"checkParkedStaleness");function L$(r){return r instanceof Error?r.message:String(r)}a(L$,"errorText")});var VR=T(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.SyncPhaseTimer=gr.SYNC_PHASES=void 0;gr.classifyRestPhase=voe;gr.emptyTimings=M$;gr.totalMs=tS;gr.addTimings=j$;gr.aggregateTimings=Toe;gr.dominantPhase=Aoe;gr.fmtMs=rm;gr.formatTimingsLine=Ioe;gr.formatRepoTimings=Roe;gr.SYNC_PHASES=["localList","localRead","localWrite","hash","restHead","restCommit","restTree","restBlob","restPush"];function BR(){let r={};for(let e of gr.SYNC_PHASES)r[e]=0;return r}a(BR,"zeroDurations");function k$(){return{filesRead:0,filesHashed:0,filesWritten:0,restCalls:0}}a(k$,"zeroCounts");function voe(r){if(r.method!=="GET")return"restPush";let e=r.url;return e.includes("/git/blobs/")?"restBlob":e.includes("/git/trees/")?"restTree":e.includes("/git/commits/")?"restCommit":e.includes("/git/refs/")?"restHead":"restCommit"}a(voe,"classifyRestPhase");var UR=class{static{a(this,"SyncPhaseTimer")}constructor(e){this.now=e,this.durations=BR(),this.counts=k$()}async time(e,t){let n=this.now();try{return await t()}finally{this.durations[e]+=this.now()-n}}bumpRead(){this.counts.filesRead++}bumpHashed(){this.counts.filesHashed++}bumpWritten(){this.counts.filesWritten++}bumpRest(){this.counts.restCalls++}snapshot(){return{durations:{...this.durations},counts:{...this.counts}}}};gr.SyncPhaseTimer=UR;function M$(){return{durations:BR(),counts:k$()}}a(M$,"emptyTimings");function tS(r){let e=0;for(let t of gr.SYNC_PHASES)e+=r.durations[t];return e}a(tS,"totalMs");function j$(r,e){let t=BR();for(let n of gr.SYNC_PHASES)t[n]=r.durations[n]+e.durations[n];return{durations:t,counts:{filesRead:r.counts.filesRead+e.counts.filesRead,filesHashed:r.counts.filesHashed+e.counts.filesHashed,filesWritten:r.counts.filesWritten+e.counts.filesWritten,restCalls:r.counts.restCalls+e.counts.restCalls}}}a(j$,"addTimings");function Toe(r){let e=M$();for(let t of r)t.timings!==void 0&&(e=j$(e,t.timings));return e}a(Toe,"aggregateTimings");function Aoe(r){let e=tS(r);if(e<=0)return null;let t=gr.SYNC_PHASES[0],n=-1;for(let i of gr.SYNC_PHASES)r.durations[i]>n&&(n=r.durations[i],t=i);return{phase:t,ms:n,pct:n/e*100}}a(Aoe,"dominantPhase");function rm(r){return r>=1e3?`${(r/1e3).toFixed(1)}s`:`${Math.round(r)}ms`}a(rm,"fmtMs");function Ioe(r){let e=tS(r);if(e<=0)return"";let t=gr.SYNC_PHASES.filter(n=>r.durations[n]>0).sort((n,i)=>r.durations[i]-r.durations[n]).map(n=>`${n} ${rm(r.durations[n])} ${Math.round(r.durations[n]/e*100)}%`);return`\u23F1 ExoSync ${rm(e)} \u2014 ${t.join(" \xB7 ")} (${r.counts.filesHashed} hashed, ${r.counts.filesRead} read, ${r.counts.restCalls} REST)`}a(Ioe,"formatTimingsLine");function Roe(r,e){let t=gr.SYNC_PHASES.map(n=>`${n}=${rm(e.durations[n])}`);return`[ExoSync timings] ${r}: total ${rm(tS(e))} \u2014 ${t.join(" ")} | hashed ${e.counts.filesHashed} read ${e.counts.filesRead} written ${e.counts.filesWritten} REST ${e.counts.restCalls}`}a(Roe,"formatRepoTimings")});var rS=T(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.LocalOutboxStore=Cc.OUTBOX_REMOTE_ABSENT=Cc.OUTBOX_STORE_FILENAME=void 0;Cc.OUTBOX_STORE_FILENAME="exosync-outbox.local.json";Cc.OUTBOX_REMOTE_ABSENT=" absent";function GR(r,e){return`${r}\0${e}`}a(GR,"outboxKey");function $$(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.repoKey=="string"&&typeof e.path=="string"&&typeof e.chosenContent=="string"&&typeof e.baseRemoteSha=="string"}a($$,"isEntry");var qR=class{static{a(this,"LocalOutboxStore")}constructor(e){this.writeChain=Promise.resolve(),this.io=e.io,this.now=e.now??(()=>new Date().toISOString())}async enqueue(e){await this.mutate(t=>{t.entries[GR(e.repoKey,e.path)]={version:1,...e,resolvedAt:e.resolvedAt.length>0?e.resolvedAt:this.now()}})}async remove(e,t){await this.mutate(n=>{delete n.entries[GR(e,t)]})}async list(){let e=await this.read();return Object.values(e.entries).filter($$)}async listForRepo(e){return(await this.list()).filter(t=>t.repoKey===e)}async has(e,t){let i=(await this.read()).entries[GR(e,t)];return i!==void 0&&$$(i)}async mutate(e){let t=this.writeChain.then(async()=>{let n=await this.read();e(n),await this.io.writeAtomic(JSON.stringify(n,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 n=t.entries;return n===null||typeof n!="object"?{version:1,entries:{}}:{version:1,entries:{...n}}}catch{return{version:1,entries:{}}}}};Cc.LocalOutboxStore=qR});var nS=T(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.SpaceSpecAccumulator=Bn.SYNC_BRANCH=Bn.ASSET_SPACE_CLASS_UID=void 0;Bn.isAssetSpaceFrontmatter=V$;Bn.isFileSpaceFrontmatter=G$;Bn.readSpaceSource=q$;Bn.parseStrictGitHubRepoURL=W$;Bn.classifySpaceDeclaration=Ooe;var Coe=Pb(),xoe=xb();Bn.ASSET_SPACE_CLASS_UID="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb";Bn.SYNC_BRANCH="main";var U$=/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]/gi;function B$(r,e){let t=r.exo__Instance_class,n=Array.isArray(t)?t:[t];for(let i of n){if(typeof i!="string")continue;U$.lastIndex=0;let s;for(;(s=U$.exec(i))!==null;)if(s[1].toLowerCase()===e)return!0}return!1}a(B$,"instanceClassHasUid");function V$(r){return B$(r,Bn.ASSET_SPACE_CLASS_UID)}a(V$,"isAssetSpaceFrontmatter");function G$(r){return B$(r,Coe.FILE_SPACE_CLASS_UID)}a(G$,"isFileSpaceFrontmatter");function q$(r){let e=r.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=r.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(q$,"readSpaceSource");var Poe=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/;function W$(r){if(typeof r!="string"||r.length===0||r.length>256||!Poe.test(r))return null;let e=r.slice(19),[t,n,...i]=e.split("/");if(i.length>0||t===".."||n===".."||n.startsWith("."))return null;let s=n.replace(/\.git$/,"");return s.length===0?null:{owner:t,repo:s}}a(W$,"parseStrictGitHubRepoURL");function Ooe(r,e){let t=V$(r),n=G$(r);if(!t&&!n)return{kind:"not-space"};let i;t&&n&&(i=`declaration at ${e} carries BOTH exo__AssetSpace and exo__FileSpace classes (disjoint) \u2014 treating as AssetSpace (conservative)`);let s=t?"asset":"file",o=q$(r);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=W$(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,xoe.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}#${Bn.SYNC_BRANCH}`,d=r.exo__Asset_uid,p=typeof d=="string"&&d.trim().length>0?d.trim():void 0;return{kind:"candidate",candidate:{spec:{owner:l.owner,repo:l.repo,branch:Bn.SYNC_BRANCH,repoKey:f,localPath:u,...s==="file"?{spaceKind:s}:{}},spaceKind:s,...p!==void 0?{asUid:p}:{}},...i!==void 0?{warning:i}:{}}}a(Ooe,"classifySpaceDeclaration");var WR=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:n}=e;if(this.seen.has(t.repoKey)){let i=this.kindByRepoKey.get(t.repoKey);if(i!==void 0&&i!==n&&(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,n),t}commit(e){this.specs.push(e.spec),e.asUid!==void 0&&this.asUidByRepoKey.set(e.spec.repoKey,e.asUid)}};Bn.SpaceSpecAccumulator=WR});var iS=T(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.REF_NOT_FOUND_HINT=void 0;md.isAuthError=Foe;md.isRefNotFoundError=Doe;var z$=nS();function Foe(r){let e=r instanceof Error?r.message:String(r);return/HTTP 401/.test(e)?!0:/HTTP 403/.test(e)&&!/rate limit/i.test(e)&&!/abuse detection/i.test(e)}a(Foe,"isAuthError");function Doe(r){let e=r instanceof Error?r.message:String(r);return/\/git\/refs\/heads\/\S* → HTTP 404\b/.test(e)}a(Doe,"isRefNotFoundError");md.REF_NOT_FOUND_HINT=`GitHub answers 404 for a private repo outside a fine-grained PAT's repository allowlist (existence-hiding), for a deleted/renamed repo, and for a visible repo that has no \`${z$.SYNC_BRANCH}\` branch (ExoSync syncs \`${z$.SYNC_BRANCH}\` only) \u2014 check the token's repository allowlist first (R8)`});var zR=T(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});sS.scanForSecrets=Loe;sS.redactSecrets=Noe;var H$=[{kind:"github-token",re:/gh[pousr]_[A-Za-z0-9_]{36,}/},{kind:"github-fine-grained-token",re:/github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,}/},{kind:"private-key",re:/-----BEGIN [A-Z ]*PRIVATE KEY-----/}];function Loe(r){let e=[];for(let[t,n]of r)for(let{kind:i,re:s}of H$)s.test(n)&&e.push({path:t,kind:i});return e}a(Loe,"scanForSecrets");function Noe(r){let e=r;for(let{kind:t,re:n}of H$)e=e.replace(new RegExp(n.source,"g"),`[REDACTED:${t}]`);return e}a(Noe,"redactSecrets")});var YR=T(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.caseInsensitiveHeaderGetter=koe;xc.parseRetryAfterMs=K$;xc.extractRateLimitFields=Y$;xc.getRateLimitFields=Moe;xc.attachRateLimitFields=X$;xc.enrichRateLimitError=joe;function koe(r){let e=new Map;if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))typeof n=="string"&&e.set(t.toLowerCase(),n);return t=>e.get(t.toLowerCase())}a(koe,"caseInsensitiveHeaderGetter");function KR(r){if(r==null)return;let e=r.trim();if(!/^-?\d+$/.test(e))return;let t=Number(e);return Number.isFinite(t)?t:void 0}a(KR,"parseIntHeader");function K$(r,e=Date.now){if(r==null)return;let t=r.trim();if(t.length===0)return;let n=KR(t);if(n!==void 0)return Math.max(0,n*1e3);let i=Date.parse(t);if(!Number.isNaN(i))return Math.max(0,i-e())}a(K$,"parseRetryAfterMs");function Y$(r,e=Date.now){let t={},n=K$(r("retry-after"),e);n!==void 0&&(t.retryAfterMs=n);let i=KR(r("x-ratelimit-reset"));i!==void 0&&(t.rateLimitReset=i);let s=KR(r("x-ratelimit-remaining"));return s!==void 0&&(t.rateLimitRemaining=s),t}a(Y$,"extractRateLimitFields");function Moe(r){if(r===null||typeof r!="object")return{};let e=r,t={};return typeof e.retryAfterMs=="number"&&(t.retryAfterMs=e.retryAfterMs),typeof e.rateLimitReset=="number"&&(t.rateLimitReset=e.rateLimitReset),typeof e.rateLimitRemaining=="number"&&(t.rateLimitRemaining=e.rateLimitRemaining),t}a(Moe,"getRateLimitFields");function HR(r,e,t){Object.defineProperty(r,e,{value:t,enumerable:!1,writable:!0,configurable:!0})}a(HR,"defineHidden");function X$(r,e){return e.retryAfterMs!==void 0&&HR(r,"retryAfterMs",e.retryAfterMs),e.rateLimitReset!==void 0&&HR(r,"rateLimitReset",e.rateLimitReset),e.rateLimitRemaining!==void 0&&HR(r,"rateLimitRemaining",e.rateLimitRemaining),r}a(X$,"attachRateLimitFields");function joe(r,e,t=Date.now){return X$(r,Y$(e,t))}a(joe,"enrichRateLimitError")});var oS=T(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.DEFAULT_MAX_RETRIES=as.MIN_RATE_LIMIT_WAIT_MS=void 0;as.isRateLimitError=Q$;as.createRateLimitBudget=Uoe;as.withRateLimitBackoff=Goe;var $oe=YR();function Q$(r){let e=r instanceof Error?r.message:String(r);return/HTTP 429/.test(e)?!0:/HTTP 403/.test(e)&&(/rate limit/i.test(e)||/abuse detection/i.test(e))}a(Q$,"isRateLimitError");as.MIN_RATE_LIMIT_WAIT_MS=6e4;as.DEFAULT_MAX_RETRIES=6;function Uoe(r){let e=!(r>0),t=e?Number.POSITIVE_INFINITY:r;return{reset(){t=e?Number.POSITIVE_INFINITY:r},tryReserve(n){return n<=0?!0:n<=t?(t-=n,!0):!1}}}a(Uoe,"createRateLimitBudget");var Boe=a(r=>new Promise(e=>setTimeout(e,r)),"defaultSleep");function Voe(r,e,t,n,i,s){let o=(0,$oe.getRateLimitFields)(r);if(typeof o.retryAfterMs=="number"&&o.retryAfterMs>=0)return o.retryAfterMs;if(o.rateLimitRemaining===0&&typeof o.rateLimitReset=="number"){let l=o.rateLimitReset*1e3-s();if(l>0)return l}let c=t*2**e*(1+i());return Math.max(n,c)}a(Voe,"computeRateLimitDelay");function Goe(r,e={}){let t=e.maxRetries??as.DEFAULT_MAX_RETRIES,n=e.baseDelayMs??1e3,i=Math.max(as.MIN_RATE_LIMIT_WAIT_MS,e.minRateLimitWaitMs??as.MIN_RATE_LIMIT_WAIT_MS),s=e.budget,o=e.sleep??Boe,c=e.random??Math.random,l=e.now??(()=>Date.now());return async u=>{let f=0;for(;;)try{return await r(u)}catch(d){if(!Q$(d)||f>=t)throw d;let p=Voe(d,f,n,i,c,l);if(s!==void 0&&!s.tryReserve(p))throw d;f++,await o(p)}}}a(Goe,"withRateLimitBackoff")});var aS=T(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.DEFAULT_MAX_FILE_BYTES=Na.InMemoryQuarantineStore=void 0;Na.contentEquals=qoe;Na.isSyncablePath=Woe;Na.isFileSpaceSyncablePath=zoe;function qoe(r,e){if(r===void 0||e===void 0||typeof r=="string"&&typeof e=="string")return r===e;if(typeof r=="string"||typeof e=="string"||r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}a(qoe,"contentEquals");var XR=class{static{a(this,"InMemoryQuarantineStore")}constructor(){this.entries=[]}async quarantine(e){this.entries.push(e)}};Na.InMemoryQuarantineStore=XR;function Woe(r){return r.endsWith(".md")&&!r.includes(".local.")&&!r.includes(".conflict.")}a(Woe,"isSyncablePath");function zoe(r){return!r.includes(".local.")&&!r.includes(".conflict.")}a(zoe,"isFileSpaceSyncablePath");Na.DEFAULT_MAX_FILE_BYTES=30*1024*1024});var a4=T(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.SyncEngine=Tn.DEFAULT_LOCAL_MANIFEST_REHASH_MS=Tn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS=Tn.DEFAULT_MAX_PUSH_RETRIES=void 0;Tn.syncProgressPhaseText=Koe;Tn.isNonFastForwardError=o4;Tn.orderChildrenFirst=rae;var J$=J_(),Z$=VR(),dt=hd(),Fo=Zh(),Hoe=sf(),iu=pd(),QR=rS(),JR=iS(),e4=zR(),t4=oS(),Do=aS();Tn.DEFAULT_MAX_PUSH_RETRIES=3;Tn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS=3e5;Tn.DEFAULT_LOCAL_MANIFEST_REHASH_MS=720*60*1e3;function Koe(r){switch(r.phase){case"reading-local":return r.detail!==void 0?`reading local files ${r.detail.done}\u2026`:"reading local files\u2026";case"detecting":return"detecting changes\u2026";case"pulling-remote":return"pulling remote tree\u2026";case"fetching-blobs":return r.detail!==void 0?`fetching remote files ${r.detail.done}/${r.detail.total}\u2026`:"fetching remote files\u2026";case"writing-files":return r.detail!==void 0?`writing files ${r.detail.done}\u2026`:"writing files\u2026";case"merging":return"merge layer firing\u2026";default:return r.phase}}a(Koe,"syncProgressPhaseText");var r4=25,Yoe=10,Xoe=6,Qoe=500,Joe=25;function Zoe(r){try{return new TextDecoder("utf-8",{fatal:!0}).decode(r)}catch{return null}}a(Zoe,"decodeUtf8Strict");function eae(r){return typeof r=="string"?r:{base64:(0,Hoe.bytesToBase64)(r)}}a(eae,"toCommitContent");async function n4(r,e){if(r.readBinary===void 0)throw new Error("LocalFilesPort.readBinary is required for file-mode sync (Phase C)");return r.readBinary(e)}a(n4,"readBinaryStrict");async function tae(r,e,t){if(r.writeBinary===void 0)throw new Error("LocalFilesPort.writeBinary is required for file-mode sync (Phase C)");return r.writeBinary(e,t)}a(tae,"writeBinaryStrict");function i4(r){return r.length===0||r.startsWith("/")||r.includes("\\")?!1:r.split("/").every(e=>e.length>0&&e!=="."&&e!=="..")}a(i4,"isSafeRepoRelativePath");function o4(r){let e=r instanceof Error?r.message:String(r);return/HTTP 422/.test(e)&&/git\/refs/.test(e)||/ref update mismatch/.test(e)||/HTTP 422/.test(e)&&/git\/trees/.test(e)&&/BadObjectState/.test(e)}a(o4,"isNonFastForwardError");function rae(r){let e=a(t=>t.split("/").filter(n=>n.length>0).length,"depth");return[...r].sort((t,n)=>e(n.localPath)-e(t.localPath))}a(rae,"orderChildrenFirst");function s4(r,e){let t=new Map(r.map(o=>[o.path,o])),n=new Set,i=[];for(let o of e){n.add(o.path);let c=t.get(o.path);(c===void 0||c.blobSha!==o.blobSha)&&i.push(o)}let s=r.filter(o=>!n.has(o.path));return{changed:i,deleted:s}}a(s4,"diffTrees");function nae(r){let e=r instanceof Error?r.message:String(r);return/→ HTTP (?:404|422)\b/.test(e)}a(nae,"isCommitUnknownError");function ka(r){return r instanceof Error?r.message:String(r)}a(ka,"errMsg");function iae(r,e,t){if(t.size===0)return r;let n=new Map(e.files.map(o=>[o.path,o])),i=new Set(r.map(o=>o.path)),s=[];for(let o of r){if(!t.has(o.path)){s.push(o);continue}let c=n.get(o.path);c!==void 0&&s.push(c)}for(let o of t){if(i.has(o))continue;let c=n.get(o);c!==void 0&&s.push(c)}return s}a(iae,"applyWatermarkPins");var ZR={mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:[],mergedCount:0,mergedPaths:[],warnings:[]};function eC(r){return new Map(r.map(e=>[e.path,e.blobSha]))}a(eC,"treeByPath");function cS(r){return[...r.quarantineEntries.map(e=>e.path),...r.resolvedQuarantineEntries.map(e=>e.path)]}a(cS,"quarantinedPathsOf");var tC=class{static{a(this,"SyncEngine")}constructor(e){this.activeTimer=null,this.activeLocalIoProgress=null,this.opInProgress=!1,this.deps=e,this.now=e.now??(()=>Date.now()),this.rateLimitBudget=(0,t4.createRateLimitBudget)(e.backoff?.maxTotalRateLimitWaitMs??Tn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS),this.transport=this.instrumentTransport((0,t4.withRateLimitBackoff)(e.transport,{...e.backoff,budget:this.rateLimitBudget,now:this.now})),this.sha1=this.instrumentSha1(e.sha1)}instrumentTransport(e){return async t=>{let n=this.activeTimer;return n===null?e(t):(n.bumpRest(),n.time((0,Z$.classifyRestPhase)(t),()=>e(t)))}}instrumentSha1(e){return t=>{let n=this.activeTimer;return n===null?e(t):(n.bumpHashed(),n.time("hash",()=>e(t)))}}instrumentLocalFiles(e){let t=a((c,l)=>{let u=this.activeTimer;return u===null?l():u.time(c,l)},"timed"),n={list:a(()=>t("localList",()=>e.list()),"list"),read:a(c=>(this.activeTimer?.bumpRead(),this.bumpReadProgress(),t("localRead",()=>e.read(c))),"read"),write:a((c,l)=>t("localWrite",()=>(this.activeTimer?.bumpWritten(),this.bumpWriteProgress(),e.write(c,l))),"write"),delete:a(c=>e.delete(c),"delete")},i=e.readBinary?.bind(e);i!==void 0&&(n.readBinary=c=>(this.activeTimer?.bumpRead(),this.bumpReadProgress(),t("localRead",()=>i(c))));let s=e.writeBinary?.bind(e);s!==void 0&&(n.writeBinary=(c,l)=>t("localWrite",()=>(this.activeTimer?.bumpWritten(),this.bumpWriteProgress(),s(c,l))));let o=e.stat?.bind(e);return o!==void 0&&(n.stat=c=>t("localList",()=>o(c))),n}busyResult(e){return{repoKey:e.repoKey,status:"busy",pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:[],deferredDeletes:[],detail:"another sync operation is in progress (D11 guard) \u2014 retry after it finishes"}}modeOps(e){let t=e.spaceKind==="file",n=t?Do.isFileSpaceSyncablePath:Do.isSyncablePath,i=this.deps.maxFileBytes??Do.DEFAULT_MAX_FILE_BYTES;return{fileMode:t,syncable:n,treeFilter:a(s=>n(s.path)&&(!t||s.size===void 0||s.size<=i),"treeFilter")}}async buildFileModeFirstSyncBase(e,t,n,i){let s=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),c=(await(0,dt.getTree)(this.transport,e.owner,e.repo,o.treeSha,this.deps.baseURL)).filter(n.treeFilter),l=[];for(let u of c){let f=t.get(u.path);f!==void 0&&await(0,iu.gitBlobSha)(f,this.sha1)===u.blobSha&&l.push({path:u.path,blobSha:u.blobSha})}return i.push(`first-sync (file mode): synthetic base from ${l.length} already-identical file(s) at head ${s} \u2014 divergence resolves through the remote-wins layer (D22)`),{lastSyncedSha:s,rootTreeSha:o.treeSha,files:l,spaceKind:"file"}}async syncAll(e,t="sync",n){if(this.opInProgress)return e.map(i=>this.busyResult(i));this.opInProgress=!0,this.rateLimitBudget.reset();try{let i=[];for(let s of e)i.push(await this.syncLocked(s,t,n));return i}finally{this.opInProgress=!1}}async sync(e,t="sync",n){if(this.opInProgress)return this.busyResult(e);this.opInProgress=!0,this.rateLimitBudget.reset();try{return await this.syncLocked(e,t,n)}finally{this.opInProgress=!1}}emitProgress(e,t,n,i){if(e!==void 0)try{e(i===void 0?{repoKey:t,phase:n}:{repoKey:t,phase:n,detail:i})}catch{}}bumpReadProgress(){let e=this.activeLocalIoProgress;e!==null&&(e.reads+=1,e.reads%Qoe===0&&this.emitProgress(e.emit,e.repoKey,"reading-local",{done:e.reads}))}bumpWriteProgress(){let e=this.activeLocalIoProgress;e!==null&&(e.writes+=1,e.writes%Joe===0&&this.emitProgress(e.emit,e.repoKey,"writing-files",{done:e.writes}))}async syncLocked(e,t="sync",n){let i=new Z$.SyncPhaseTimer(this.now),s=this.activeTimer;this.activeTimer=i;let o=this.activeLocalIoProgress;this.activeLocalIoProgress=n!==void 0?{emit:n,repoKey:e.repoKey,reads:0,writes:0}:null;let c=[],l=[],u=0,f=0,d=[],p=a((h,g={})=>({repoKey:e.repoKey,status:h,pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:c,deferredDeletes:l,...u>0?{outboxPushedCount:u}:{},...f>0?{outboxReconflictedCount:f}:{},timings:i.snapshot(),...g}),"result");try{let h=await this.deps.materializationCheck.check(e);if(!h.fullyMaterialized)return c.push(`skipped: repo not fully materialized${h.reason?` (${h.reason})`:""} \u2014 deletes NOT inferred (D19)`),p("skipped-not-materialized");let g=this.modeOps(e),m=this.instrumentLocalFiles(this.deps.localFilesFor(e));if(g.fileMode&&(m.readBinary===void 0||m.writeBinary===void 0))return p("error",{detail:"file-mode repo requires a LocalFilesPort with readBinary/writeBinary \u2014 refusing to sync through the text-only port (binary would corrupt)"});if(g.fileMode&&this.deps.quarantine===void 0)return p("error",{detail:"file-mode repo requires a quarantine sink (D18 remote-wins preserves losing local bytes there) \u2014 configure the quarantine repo before syncing FileSpaces"});let b=this.deps.maxFileBytes??Do.DEFAULT_MAX_FILE_BYTES;if(t!=="pull"&&this.deps.outbox!==void 0){let U=await this.flushOutbox(e,c);u=U.pushed,f=U.reconflicted}let _=await this.deps.watermarkStore.get(e.repoKey);if(_?.spaceKind==="file"&&!g.fileMode)return p("error",{detail:"watermark was written by a FILE-mode sync but the spec now resolves to asset mode \u2014 refusing (fix the conflicting Space declarations, or clear the watermark to restart)"});_!==null&&g.fileMode&&_.spaceKind!=="file"&&(c.push("watermark was written by an ASSET-mode sync \u2014 rebuilding the base through the file-mode first-sync layer (kind flip)"),_=null);let S=this.deps.localManifestStore!==void 0?m.stat?.bind(m):void 0,I=S!==void 0&&_!==null&&!g.fileMode,E=I&&this.deps.localManifestStore!==void 0?await this.deps.localManifestStore.get(e.repoKey):null,w=this.deps.localManifestFullRehashMs??Tn.DEFAULT_LOCAL_MANIFEST_REHASH_MS,R=I&&(E===null||this.now()-E.lastFullRehashMs>=w),x=new Map,O=new Set,N=new Map,G=new Map,j=new Map,ae=!1,Y=new Map;if(I&&_!==null)for(let U of _.files)Y.set(U.path,U.blobSha);for(let U of(await m.list()).filter(g.syncable)){if(g.fileMode){let le=await n4(m,U);if(le.byteLength>b){O.add(U),c.push(`skipped oversized file ${U} (${le.byteLength} bytes > ${b} cap) \u2014 excluded from sync symmetrically (Phase C size cap)`);continue}x.set(U,le);continue}if(!I||S===void 0){x.set(U,await m.read(U));continue}let F=await S(U),H=!R&&F!==null?E?.files[U]:void 0;if(F!==null&&H!==void 0&&H.mtimeMs===F.mtimeMs&&H.size===F.size&&H.blobSha===Y.get(U)){N.set(U,{blobSha:H.blobSha,...H.uid!==void 0?{uid:H.uid}:{}}),G.set(U,H.blobSha),j.set(U,F);continue}ae=!0,x.set(U,await m.read(U)),F!==null&&j.set(U,F)}let M=!1;if(_===null)if(g.fileMode)M=!0,_=await this.buildFileModeFirstSyncBase(e,x,g,c);else{let U=await this.bootstrapWatermark(e,x,c,p);if(U.kind==="settled")return U.outcome;M=!0,_=U.base}let ce=_;g.fileMode&&O.size>0&&(_={..._,files:_.files.filter(U=>!O.has(U.path))});let W,oe;I&&!R?(W=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),oe=W===_.lastSyncedSha?_.rootTreeSha:await this.resolveBaseTreeSha(e,_,{headReachable:!0})):oe=await this.resolveBaseTreeSha(e,_),this.emitProgress(n,e.repoKey,"detecting");let X=await(0,Fo.detectChanges)({localFiles:x,...I?{cachedEntries:N}:{},watermark:_,actualBaseTreeSha:oe,sha1:this.sha1});if(X.kind==="full-conflict")return p("full-conflict",{detail:`${X.reason}${X.detail?`: ${X.detail}`:""} \u2014 divergence must go through merge/quarantine (A2/A3), not overwrite`});if(c.push(...X.warnings),I&&this.deps.localManifestStore!==void 0){let U={};for(let[F,H]of x){let le=j.get(F),Se=X.diskBlobShas.get(F);if(le===void 0||Se===void 0)continue;let Ce=typeof H=="string"?(0,Fo.extractAssetUid)(H):void 0;U[F]={mtimeMs:le.mtimeMs,size:le.size,blobSha:Se,...Ce!==void 0?{uid:Ce}:{}}}for(let[F,H]of N){let le=j.get(F);le!==void 0&&(U[F]={mtimeMs:le.mtimeMs,size:le.size,blobSha:H.blobSha,...H.uid!==void 0?{uid:H.uid}:{}})}if(E!==null&&Object.keys(E.files).some(F=>!(F in U))&&(ae=!0),ae||R||E===null){let F={version:1,files:U,lastFullRehashMs:R||E===null?this.now():E.lastFullRehashMs};await this.deps.localManifestStore.set(e.repoKey,F)}}let J=this.pinLocalChanges(X,x,c,l,t);d=[...J.pushDeletionsAll.keys()];let ye=await this.runPushLoop(e,_,J,x,c,g,M,O,t,n,W);if(d=[],ye.kind!=="done"&&J.pushDeletionsAll.size>0&&l.push(...J.pushDeletionsAll.keys()),ye.kind==="conflict")return p("conflict",{detail:ye.detail});if(ye.kind==="retry-exhausted"){c.push(...ye.merge.warnings);let U=await this.buildTerminalQuarantineEntries(e,_,ye.pushFiles,ye.merge.quarantineEntries,x),F=[...ye.merge.quarantineEntries,...ye.merge.resolvedQuarantineEntries,...U];return await this.flushQuarantine(F,c),p("retry-exhausted",{detail:ye.detail,quarantinedCount:F.length,...F.length>0?{quarantinedPaths:F.map(H=>H.path)}:{}})}let{examinedHead:ze,pushedSha:Z,applyWrites:z,applyDeletes:ee,pushFiles:K}=ye,ie=ye.merge;c.push(...ie.warnings),c.push(...ye.deferredWarnings),l.push(...ye.withheldDeletions);let Pe=ye.deferredPaths.size>0?{deferredPaths:[...ye.deferredPaths]}:{},$=ye.pushedDeletions.length>0?{pushedDeletes:ye.pushedDeletions}:{},fe=await this.flushQuarantine([...ie.quarantineEntries,...ie.resolvedQuarantineEntries],c);ye.secretQuarantineEntries.length>0&&await this.flushQuarantine(ye.secretQuarantineEntries,c);let se=new Set;if(!fe&&ie.resolvedQuarantineEntries.length>0){for(let U of ie.resolvedQuarantineEntries)se.add(U.path);c.push(`quarantine flush failed \u2014 remote-wins apply withheld for ${se.size} path(s); local files untouched, conflict re-derives next sync (D18 durability gate)`)}if(Z===void 0&&ze===_.lastSyncedSha&&z.length===0&&ee.length===0&&ie.mergedWrites.length===0&&ie.quarantineEntries.length===0&&ie.resolvedQuarantineEntries.length===0&&(_.pinnedPaths?.length??0)===0&&ye.alreadyInHead.length===0&&ye.deferredPaths.size===0&&!M)return p("synced");let Ae=Z??ze,ge=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,Ae,this.deps.baseURL);if(Z!==void 0&&ge.parents[0]!==ze)return await this.checkRaceWindow(e,_,ze,ge.parents[0],K,new Set(ye.pushedDeletions),c,g),c.push(`race-window: watermark NOT advanced (pushed commit's parent ${ge.parents[0]} != examined head ${ze}) \u2014 next sync reconciles the concurrent change`),p("synced",{pushedSha:Z,pushedCount:K.size,mergedCount:ie.mergedCount,quarantinedCount:ie.quarantineEntries.length+ie.resolvedQuarantineEntries.length,...ie.mergedPaths.length>0?{mergedPaths:ie.mergedPaths}:{},...cS(ie).length>0?{quarantinedPaths:cS(ie)}:{},...Pe,...$});let{pulledCount:ve,pinnedPaths:Re,pulledPaths:de}=await this.applyRemoteChanges(m,x,[...z,...ie.mergedWrites].filter(U=>!se.has(U.path)),ee.filter(U=>!se.has(U.path)),c,G);for(let U of ie.quarantineEntries)Re.add(U.path);for(let U of ye.deferredPaths)Re.add(U);for(let U of se)Re.add(U);if(g.fileMode){for(let U of O)Re.add(U);for(let U of ye.remoteOversized)Re.add(U)}return await this.advanceWatermark(e,Ae,ge.treeSha,x,[...z,...ie.mergedWrites,...ye.deferredRemoteChanges],ce,Re,X.diskBlobShas,g,O),await this.resolveClearedPins(e,ce,Re,c,new Set(ie.resolvedQuarantineEntries.map(U=>U.path))),p("synced",{pushedSha:Z,pulledCount:ve,pushedCount:K.size,mergedCount:ie.mergedCount,quarantinedCount:ie.quarantineEntries.length+ie.resolvedQuarantineEntries.length,...ie.mergedPaths.length>0?{mergedPaths:ie.mergedPaths}:{},...de.length>0?{pulledPaths:de}:{},...cS(ie).length>0?{quarantinedPaths:cS(ie)}:{},...Pe,...$})}catch(h){let g=this.deps.redact??(m=>m);if(d.length>0&&l.push(...d),(0,JR.isAuthError)(h))return p("auth-required",{detail:g(`authentication failed: ${ka(h)} \u2014 the PAT is expired, revoked or under-scoped; update it in the per-device secure storage (R8). Never treated as success.`)});if((0,JR.isRefNotFoundError)(h)){let m=g(`${e.owner}/${e.repo}@${e.branch} is not reachable: ${ka(h)} \u2014 ${JR.REF_NOT_FOUND_HINT}`);return c.push(`sync failed: ${m}`),p("error",{detail:m})}return c.push(`sync failed: ${g(ka(h))}`),p("error",{detail:g(ka(h))})}finally{this.activeTimer=s,this.activeLocalIoProgress=o}}async flushQuarantine(e,t){if(e.length===0)return!0;let n=this.deps.redact??(s=>s);for(let s of e)t.push(n(`quarantined ${s.path}: ${s.reason}`));let i=this.deps.quarantine;if(i===void 0)return!1;try{if(i.quarantineAll!==void 0)await i.quarantineAll(e);else for(let s of e)await i.quarantine(s);return!0}catch(s){let o=this.deps.redact??(c=>c);return t.push(`quarantine sink failed: ${o(ka(s))} \u2014 files untouched on disk; the conflict re-derives next sync (D17 degradation)`),!1}}async flushOutbox(e,t){let n=this.deps.outbox;if(n===void 0)return{pushed:0,reconflicted:0};let i=await n.listForRepo(e.repoKey);if(i.length===0)return{pushed:0,reconflicted:0};let s=this.deps.redact??(g=>g),o,c;try{({head:o,shaByPath:c}=await this.outboxHeadTreeShas(e))}catch(g){return t.push(`outbox flush deferred (${i.length} resolution(s) awaiting push): ${s(ka(g))}`),{pushed:0,reconflicted:0}}let l=0,u=[];for(let g of i){let m=c.get(g.path)??QR.OUTBOX_REMOTE_ABSENT,b=m===QR.OUTBOX_REMOTE_ABSENT&&g.baseRemoteSha!==QR.OUTBOX_REMOTE_ABSENT?[...c].filter(([_,S])=>_!==g.path&&S===g.baseRemoteSha).map(([_])=>_):[];if(m!==g.baseRemoteSha&&b.length===0){await n.remove(g.repoKey,g.path),l++,t.push(s(`outbox: remote moved for ${g.path} since you resolved it \u2014 NOT pushed; resolve again (your choice is preserved on disk)`));continue}u.push({entry:g,stalePaths:b})}if(u.length===0)return{pushed:0,reconflicted:l};let f=new Map;for(let{entry:g}of u)f.set(g.path,g.chosenContent);let d=new Set;for(let{stalePaths:g}of u)for(let m of g)f.has(m)||d.add(m);let p=[...d];try{await(0,J$.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:f,...p.length>0?{deletions:p}:{},message:p.length>0?`chore(exosync): resolve ${u.length} keep-local conflict(s) (consolidate ${p.length} stale remote path(s))`:`chore(exosync): push ${u.length} resolved conflict(s)`,expectedHeadSha:o,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}})}catch(g){return t.push(`outbox: batch push deferred for ${u.length} resolution(s), will retry next sync: ${s(ka(g))}`),{pushed:0,reconflicted:l}}let h=0;for(let{entry:g,stalePaths:m}of u){let b=m.filter(_=>!f.has(_));await this.snapOutboxWatermark(e,g.path,g.chosenContent,b),await this.deps.quarantine?.markResolved?.(g.repoKey,g.path);for(let _ of b)await this.deps.quarantine?.markResolved?.(g.repoKey,_);await n.remove(g.repoKey,g.path),h++,b.length>0&&t.push(`consolidated cross-path conflict for ${g.path} \u2014 removed ${b.length} stale remote copy/copies (recoverable in git history)`)}return h>0&&t.push(`pushed ${h} resolved conflict(s)`),{pushed:h,reconflicted:l}}async outboxHeadTreeShas(e){let t=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),n=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t,this.deps.baseURL),i=await(0,dt.getTree)(this.transport,e.owner,e.repo,n.treeSha,this.deps.baseURL),s=new Map;for(let o of i)s.set(o.path,o.blobSha);return{head:t,shaByPath:s}}async snapOutboxWatermark(e,t,n,i=[]){let s=await this.deps.watermarkStore.get(e.repoKey);if(s===null)return;let o=new Set([t,...i]),c=(s.pinnedPaths??[]).filter(m=>!o.has(m)),l=await(0,iu.gitBlobSha)(n,this.sha1),u=(0,Fo.extractAssetUid)(n),f={path:t,blobSha:l,...u!==void 0?{uid:u}:{}},d=new Set(i),p=s.files.filter(m=>!d.has(m.path)),h=p.findIndex(m=>m.path===t),g=h>=0?p.map((m,b)=>b===h?f:m):[...p,f];await this.deps.watermarkStore.set(e.repoKey,{...s,files:g,...c.length>0?{pinnedPaths:c}:{pinnedPaths:void 0}})}async buildTerminalQuarantineEntries(e,t,n,i,s){let o=new Set(i.map(u=>u.path)),c=new Map;try{let u=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=(await(0,dt.getTree)(this.transport,e.owner,e.repo,(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(d=>n.has(d.path));for(let d of f)c.set(d.path,await(0,dt.getBlobText)(this.transport,e.owner,e.repo,d.blobSha,this.deps.baseURL))}catch{}let l=[];for(let[u,f]of n){if(o.has(u))continue;let d=s.get(u),p=d??f,h=d!==void 0&&!(0,Do.contentEquals)(d,f),g=typeof p=="string"?(0,Fo.extractAssetUid)(p):void 0,m=c.get(u);l.push({repoKey:e.repoKey,path:u,...g!==void 0?{uid:g}:{},reason:`non-fast-forward push failed after ${this.deps.maxPushRetries??Tn.DEFAULT_MAX_PUSH_RETRIES} retries (D16) \u2014 a concurrent writer keeps moving ${e.branch}; base recoverable from git history at ${t.lastSyncedSha}${h?"; the contended push payload was a merged proposal (never applied to disk) \u2014 the merge re-derives next sync":""}`,...typeof p=="string"?{localContent:p}:{localContentBytes:p},...m!==void 0?{remoteContent:m}:{}})}return l}async resolveClearedPins(e,t,n,i,s=new Set){let o=this.deps.quarantine;if(o===void 0||o.markResolved===void 0)return;let c=(t.pinnedPaths??[]).filter(l=>!n.has(l)&&!s.has(l));for(let l of c)try{await o.markResolved?.(e.repoKey,l)}catch(u){let f=this.deps.redact??(d=>d);i.push(`quarantine markResolved failed for ${l}: ${f(ka(u))} \u2014 unresolved-count may overcount until the resolver UI reconciles (CQ4)`)}}async resolveBaseTreeSha(e,t,n={}){try{return(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t.lastSyncedSha,this.deps.baseURL)).treeSha}catch(i){if(!nae(i))throw i;return n.headReachable===!0||await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),null}}pinLocalChanges(e,t,n,i,s){let o=e.modified.filter(p=>p.basePath!==void 0),c=[...e.added,...e.modified.filter(p=>p.basePath===void 0)],l=new Map;if(s==="pull"){for(let p of o)p.basePath!==void 0&&i.push(p.basePath),n.push(`pull-only: rename (uid ${p.uid??"?"}) ${p.basePath} \u2192 ${p.path} not pushed \u2014 propagates on the next push/Sync (#3473)`);for(let p of e.deleted)i.push(p.path),n.push(`pull-only: delete of ${p.path} not pushed \u2014 propagates on the next push/Sync (#3473)`)}else{for(let p of o)p.basePath!==void 0&&l.set(p.basePath,p.path);for(let p of e.deleted)l.set(p.path,p.path)}let u=[...c,...o,...e.deleted.map(p=>({...p}))],f=new Set(e.deleted.map(p=>p.path)),d=new Map;for(let p of[...c,...s==="pull"?[]:o]){let h=t.get(p.path);h!==void 0&&d.set(p.path,h)}return{localChanges:u,localDeletedPaths:f,pushFilesAll:d,pushDeletionsAll:l,dupUids:e.duplicateUids}}async runPushLoop(e,t,n,i,s,o,c=!1,l=new Set,u="sync",f,d){let{localChanges:p,localDeletedPaths:h,pushFilesAll:g,pushDeletionsAll:m,dupUids:b}=n,_=this.deps.maxPushRetries??Tn.DEFAULT_MAX_PUSH_RETRIES,S=0,I="",E,w=[],R=[],x=new Map,O=new Set,N=[],G=ZR,j=[],ae=new Set,Y=[],M=[],ce=new Set,W=[],oe=new Set;for(;;){I=S===0&&d!==void 0&&g.size===0&&m.size===0?d:await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),w=[],R=[],G=ZR,j=[],ae=new Set,Y=[],M=[];let X,J=new Set,ye=(t.pinnedPaths?.length??0)>0;if(I!==t.lastSyncedSha||ye||c){this.emitProgress(f,e.repoKey,"pulling-remote");let z=await this.collectRemoteChanges(e,t,I,o,l,s,ce,f);X=z.headTreeByPath;let ee=this.matchLocalVsRemote(p,h,i,z.changes,J,b,z.headTreeByPath);if(ee.conflicts.length>0){if(u==="sync"&&this.emitProgress(f,e.repoKey,"merging"),u!=="sync"){for(let K of ee.conflicts){ae.add(K.local.path),K.local.basePath!==void 0&&ae.add(K.local.basePath);for(let ie of K.remotes)ae.add(ie.path),ie.kind==="change"&&Y.push(ie)}M.push(`${u}-only: ${ee.conflicts.length} conflict(s) deferred to a full Sync (${ee.conflicts.map(K=>K.desc).join("; ")}) \u2014 paths pinned, nothing merged`)}else if(o.fileMode)G=this.resolveFileModeConflicts(e,ee.conflicts,i,ee.applyWrites,ee.applyDeletes);else{if(this.deps.mergeLayer===void 0)return{kind:"conflict",detail:`overlapping change on ${ee.conflicts[0].desc} \u2014 merge layer (A2/A3) required; nothing pushed, nothing written`};G=await this.resolveMergeConflicts(e,t,ee.conflicts,i)}if(u==="sync")for(let K of ee.conflicts)for(let ie of K.remotes)ie.path!==K.local.path&&(ae.add(ie.path),ie.kind==="change"&&Y.push(ie),M.push(`conflict group ${K.desc}: remote change at ${ie.path} NOT applied \u2014 pinned to re-derive on the next sync (#3477)`))}if(w=ee.applyWrites,R=ee.applyDeletes,u==="push"&&(w.length>0||R.length>0)){for(let K of w)ae.add(K.path),Y.push(K);for(let K of R)ae.add(K.path);M.push(`push-only: ${w.length+R.length} remote change(s) NOT applied \u2014 pinned to re-derive on the next pull/Sync`),w=[],R=[]}}x=u==="pull"?new Map:new Map([...[...g].filter(([z])=>!J.has(z)),...G.mergedFiles]),O=new Set,N=[];for(let[z,ee]of m){if(J.has(ee)){N.push(z);continue}x.has(z)||O.add(z)}if((x.size>0||O.size>0)&&X===void 0&&(X=eC(await(0,dt.getTree)(this.transport,e.owner,e.repo,t.rootTreeSha,this.deps.baseURL))),x.size>0&&X!==void 0){for(let[z,ee]of x){let K=X.get(z);K!==void 0&&K===await(0,iu.gitBlobSha)(ee,this.sha1)&&(x.delete(z),j.push(z))}j.length>0&&s.push(`phantom push skipped: ${j.length} file(s) already identical in remote HEAD (${j.join(", ")}) \u2014 excluded from the commit (#3475)`)}if(O.size>0&&X!==void 0){for(let z of[...O])X.has(z)||O.delete(z);x.size===0&&O.size>=X.size&&(N.push(...O),M.push(`deletion of ALL ${O.size} remaining file(s) deferred \u2014 GitHub cannot create an empty tree; the deletes re-derive and propagate once the repo has at least one surviving file`),O.clear())}if(x.size===0&&O.size===0)break;let ze=new Map;for(let[z,ee]of x)if(typeof ee=="string")ze.set(z,ee);else{let K=Zoe(ee);K!==null&&ze.set(z,K)}let Z=(0,e4.scanForSecrets)(ze);if(Z.length>0){let z=new Map;for(let ee of Z){let K=z.get(ee.path);K===void 0?z.set(ee.path,[ee.kind]):K.includes(ee.kind)||K.push(ee.kind)}for(let[ee,K]of z){if(!oe.has(ee)){oe.add(ee);let ie=ze.get(ee),Pe=ie!==void 0?(0,e4.redactSecrets)(ie):void 0,$=Pe!==void 0?(0,Fo.extractAssetUid)(Pe):void 0;W.push({repoKey:e.repoKey,path:ee,...$!==void 0?{uid:$}:{},reason:`secret-scan (R5): detected ${K.join(", ")} \u2014 skipped from the push (the secret is NEVER shipped); a redacted copy is quarantined. REVOKE the credential, then re-sync once it is removed.`,...Pe!==void 0?{localContent:Pe}:{}})}x.delete(ee)}s.push(`secret-scan (R5): skipped ${z.size} file(s) with a detected secret from the push \u2014 the rest of the changeset shipped; REVOKE the credential(s): ${[...z].map(([ee,K])=>`${ee} (${K.join(", ")})`).join(", ")}`);for(let[ee,K]of m)oe.has(K)&&O.has(ee)&&(O.delete(ee),N.push(ee));if(x.size===0&&O.size===0)break}try{E=await(0,J$.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([...x].map(([z,ee])=>[z,eae(ee)])),deletions:[...O],message:this.deps.commitMessage?.(e,x.size,O.size)??`chore(exosync): sync ${x.size} file(s)${O.size>0?`, ${O.size} deletion(s)`:""}`,baseURL:this.deps.baseURL,redact:this.deps.redact});break}catch(z){if(!o4(z))throw z;if(S++,S>_)return{kind:"retry-exhausted",detail:`non-fast-forward push failed after ${_} retries (D16 cap) \u2014 contended files routed to quarantine (D17)`,pushFiles:x,merge:G};s.push(`non-fast-forward push (attempt ${S}/${_}) \u2014 re-pulling and retrying (D16)`)}}return{kind:"done",examinedHead:I,pushedSha:E,applyWrites:w,applyDeletes:R,pushFiles:x,pushedDeletions:E!==void 0?[...O]:[],withheldDeletions:N,merge:G,remoteOversized:ce,alreadyInHead:j,deferredPaths:ae,deferredRemoteChanges:Y,deferredWarnings:M,secretQuarantineEntries:W}}async resolveMergeConflicts(e,t,n,i){let s=this.deps.mergeLayer;if(s===void 0)return ZR;let o=new Map(t.files.map(m=>[m.path,m])),c=new Map,l=[],u=[],f=[],d=[],p=0,h=a(m=>typeof m=="string"?m:void 0,"asText"),g=a((m,b,_)=>{let S=h(i.get(m.local.path)),I=h(m.remotes[0]?.content);return{repoKey:e.repoKey,path:m.local.path,...m.local.uid!==void 0?{uid:m.local.uid}:{},reason:b,..._!==void 0?{baseContent:_}:{},...S!==void 0?{localContent:S}:{},...I!==void 0?{remoteContent:I}:{}}},"entry");for(let m of n){let b=o.get(m.local.basePath??m.local.path)??o.get(m.remotes[0]?.path??""),_;if(b!==void 0&&(_=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,b.blobSha,this.deps.baseURL)),m.remotes.length>1){u.push(g(m,`ambiguous conflict: local change overlaps ${m.remotes.length} remote changes (${m.remotes.map(R=>R.path).join(", ")})`,_));continue}let S=m.remotes[0],I=h(i.get(m.local.path)),E=await s.resolve({path:m.local.path,...m.local.uid!==void 0?{uid:m.local.uid}:{},..._!==void 0?{base:_}:{},...I!==void 0?{local:I}:{},...S.kind==="change"&&typeof S.content=="string"?{remote:S.content}:{}});if(E.action==="quarantine"){u.push(g(m,E.reason,_));continue}p++,d.push(m.local.path);for(let R of E.warnings??[])f.push(`merge(${m.local.path}): ${R}`);let w=S.kind==="change"?S.content:void 0;if(E.content!==w&&c.set(m.local.path,E.content),E.content!==i.get(m.local.path)){let R=(0,Fo.extractAssetUid)(E.content)??m.local.uid;l.push({path:m.local.path,kind:"change",content:E.content,blobSha:await(0,iu.gitBlobSha)(E.content,this.sha1),...R!==void 0?{uid:R}:{}})}}return{mergedFiles:c,mergedWrites:l,quarantineEntries:u,resolvedQuarantineEntries:[],mergedCount:p,mergedPaths:d,warnings:f}}resolveFileModeConflicts(e,t,n,i,s){let o=[],c=[];for(let l of t){l.remotes.length>1&&c.push(`file-mode conflict on ${l.local.path} unexpectedly overlaps ${l.remotes.length} remote changes \u2014 resolving against the first`);let u=l.remotes[0],f=n.get(l.local.path);u.kind==="change"?i.push(u):s.push(u),!(l.localIsDelete||f===void 0)&&o.push({repoKey:e.repoKey,path:l.local.path,reason:`file-mode remote-wins (D18): remote ${u.kind==="change"?`version ${u.blobSha}`:"delete"} wins; this is the losing LOCAL version, preserved byte-exact`,...typeof f=="string"?{localContent:f}:{localContentBytes:f}})}return{mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:o,mergedCount:0,mergedPaths:[],warnings:c}}async applyRemoteChanges(e,t,n,i,s,o=new Map){let c=0,l=new Set,u=[],f=a(async(h,g)=>{try{return g?await n4(e,h):await e.read(h)}catch{return}},"tryRead"),d=a(async(h,g)=>{typeof g=="string"?await e.write(h,g):await tae(e,h,g)},"writeContent"),p=a(async h=>{let g=await f(h,!1);return g===void 0?!0:await(0,iu.gitBlobSha)(g,this.sha1)===o.get(h)},"cacheHitUnchanged");for(let h of n){if(h.content===void 0)continue;if(!i4(h.path)){s.push(`unsafe remote path skipped on pull-apply: ${h.path}`),l.add(h.path);continue}let g=t.get(h.path);if(g===void 0&&o.has(h.path)){if(!await p(h.path)){s.push(`pull-apply skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),l.add(h.path);continue}await d(h.path,h.content),c++,u.push(h.path);continue}let m=await f(h.path,typeof(g??h.content)!="string");if(!(0,Do.contentEquals)(m,g)){s.push(`pull-apply skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),l.add(h.path);continue}await d(h.path,h.content),c++,u.push(h.path)}for(let h of i){if(!i4(h.path)){s.push(`unsafe remote path skipped on pull-delete: ${h.path}`),l.add(h.path);continue}let g=t.get(h.path);if(g===void 0&&o.has(h.path)){if(!await p(h.path)){s.push(`pull-delete skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),l.add(h.path);continue}await e.delete(h.path),c++,u.push(h.path);continue}if(g!==void 0){let m=await f(h.path,typeof g!="string");if(m!==void 0&&!(0,Do.contentEquals)(m,g)){s.push(`pull-delete skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),l.add(h.path);continue}await e.delete(h.path),c++,u.push(h.path)}}return{pulledCount:c,pinnedPaths:l,pulledPaths:u}}async advanceWatermark(e,t,n,i,s,o,c,l,u,f=new Set){let d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,n,this.deps.baseURL)).filter(h=>u.treeFilter(h)&&!f.has(h.path)),p=iae(await this.buildWatermarkFiles(e,d,i,s,o,l,u),o,c);await this.deps.watermarkStore.set(e.repoKey,{lastSyncedSha:t,rootTreeSha:n,files:p,...c.size>0?{pinnedPaths:[...c]}:{},...u.fileMode?{spaceKind:"file"}:{}})}async tryMountBaseBootstrap(e,t,n,i,s){let o=this.deps.mountBaseStore,c=null;if(o!==void 0)try{c=await o.get(e.repoKey)}catch{return null}let l=!1;if(c===null&&this.deps.localBaseShaProvider!==void 0)try{let b=await this.deps.localBaseShaProvider(e);typeof b=="string"&&b.length>0&&(c=b,l=!0)}catch{}if(c===null||t.startsWith(c))return null;let u=300,f=null;try{let b=t;for(let _=0;_<u;_++){let S=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,b,this.deps.baseURL);if(S.sha===c||S.sha.startsWith(c)){f=S;break}if(S.parents.length===0)break;b=S.parents[0]}}catch{return null}if(f===null)return null;let d;try{d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL)).filter(b=>(0,Do.isSyncablePath)(b.path))}catch{return null}let p;try{let b=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t,this.deps.baseURL);p=eC((await(0,dt.getTree)(this.transport,e.owner,e.repo,b.treeSha,this.deps.baseURL)).filter(_=>(0,Do.isSyncablePath)(_.path)))}catch{return null}let h=d.filter(b=>!n.has(b.path)&&p.get(b.path)===b.blobSha);if(h.length>0){let b=h.slice(0,3).map(_=>_.path).join(", ")+(h.length>3?", \u2026":"");return i.push(`first-sync (asset mode): base-tree\u2286working-tree sanity guard fired \u2014 ${h.length} base file(s) absent from the working tree but UNCHANGED on remote head (${b}); the verified-ancestor base may not match the working tree's derivation commit (out-of-band submodule manipulation) \u2192 routing to merge/quarantine instead of inferring a silent deletion (#3610)`),{kind:"settled",outcome:s("full-conflict",{detail:`first-sync: base-tree\u2286working-tree sanity guard \u2014 ${h.length} base file(s) absent from the working tree are unchanged on remote head (${b}); refusing to infer a silent deletion from a base that may not match the derivation commit \u2014 divergence must go through merge/quarantine (A2/A3), never a silent delete (#3610)`})}}let g=d.map(b=>({path:b.path,blobSha:b.blobSha})),m={lastSyncedSha:f.sha,rootTreeSha:f.treeSha,files:g};if(l&&o!==void 0)try{await o.set(e.repoKey,f.sha)}catch{}return i.push(l?`first-sync (asset mode): BACKFILLED the 3-way base from the locally checked-out commit ${f.sha} (no recorded mount base) \u2014 remote head ${t} advanced since; local edits 3-way merge against it instead of false-conflicting (#3590)`:`first-sync (asset mode): reconciling against the recorded mount base ${f.sha} \u2014 remote head ${t} advanced since mount; local edits 3-way merge against it instead of false-conflicting (#3590)`),{kind:"additive-base",base:m}}async bootstrapWatermark(e,t,n,i){let s=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await this.tryMountBaseBootstrap(e,s,t,n,i);if(o!==null)return o;let c=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),l=(await(0,dt.getTree)(this.transport,e.owner,e.repo,c.treeSha,this.deps.baseURL)).filter(p=>(0,Do.isSyncablePath)(p.path)),u=[],f;for(let p of l){let h=t.get(p.path);if(h===void 0||await(0,iu.gitBlobSha)(h,this.sha1)!==p.blobSha){f===void 0&&(f=p.path);continue}let g=typeof h=="string"?(0,Fo.extractAssetUid)(h):void 0;u.push({path:p.path,blobSha:p.blobSha,...g?{uid:g}:{}})}let d={lastSyncedSha:s,rootTreeSha:c.treeSha,files:u};return f!==void 0?this.deps.mergeLayer===void 0?{kind:"settled",outcome:i("full-conflict",{detail:`first-sync: no watermark and local content diverges from remote head at ${f} \u2014 A2/A3 scope`})}:(n.push(`first-sync (asset mode): no 3-way merge base and local diverges from remote head (first at ${f}) \u2014 reconciling ZERO-LOSS against ${u.length} byte-identical file(s) as a synthetic base: remote-only files pull, local-only files push, overlapping divergences route to the merge/quarantine layer (both versions preserved), never a silent overwrite or delete`),{kind:"additive-base",base:d}):t.size===l.length?(await this.deps.watermarkStore.set(e.repoKey,d),n.push(`watermark bootstrapped from head ${s} (local tree identical to remote)`),{kind:"settled",outcome:i("synced")}):(n.push(`first-sync (asset mode): local tree (${t.size} files) is a pure superset of remote head ${s} (${l.length} files) \u2014 ${t.size-l.length} local-only addition(s) derive as pushable adds (#3565)`),{kind:"additive-base",base:d})}async collectRemoteChanges(e,t,n,i,s=new Set,o=[],c=new Set,l){let u=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,n,this.deps.baseURL),f=await(0,dt.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL);if(i.fileMode)for(let O of f)i.syncable(O.path)&&!i.treeFilter(O)&&!c.has(O.path)&&(c.add(O.path),o.push(`skipped oversized REMOTE file ${O.path} (${O.size??"?"} bytes over cap) \u2014 excluded from sync symmetrically (Phase C size cap)`));let d=f.filter(O=>i.treeFilter(O)&&!s.has(O.path)),p=t.files.filter(O=>!c.has(O.path)&&!s.has(O.path)),{changed:h,deleted:g}=s4(p,d),m=h.length;m>=r4&&this.emitProgress(l,e.repoKey,"fetching-blobs",{done:0,total:m});let b=new Array(h.length),_=0,S=0,I,E=a(async O=>{if(i.fileMode){let G=await(0,dt.getBlobBytes)(this.transport,e.owner,e.repo,O.blobSha,this.deps.baseURL);return{path:O.path,kind:"change",blobSha:O.blobSha,content:G}}let N=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,O.blobSha,this.deps.baseURL);return{path:O.path,kind:"change",blobSha:O.blobSha,content:N,uid:(0,Fo.extractAssetUid)(N)}},"fetchOne"),w=a(async()=>{for(;;){if(I!==void 0)return;let O=_++;if(O>=h.length)return;try{b[O]=await E(h[O])}catch(N){I===void 0&&(I=N);return}S+=1,m>=r4&&S%Yoe===0&&S<m&&this.emitProgress(l,e.repoKey,"fetching-blobs",{done:S,total:m})}},"worker"),R=Math.min(Xoe,h.length);if(await Promise.all(Array.from({length:R},()=>w())),I!==void 0)throw I instanceof Error?I:new Error(String(I));let x=b;for(let O of g)x.push({path:O.path,kind:"delete",uid:O.uid});return{changes:x,headTreeByPath:eC(f)}}matchLocalVsRemote(e,t,n,i,s,o=new Set,c){let l=new Set,u=[],f=new Map;for(let m of i)m.kind==="change"&&m.uid!==void 0&&f.set(m.uid,(f.get(m.uid)??0)+1);let d=new Set(o);for(let[m,b]of f)b>1&&d.add(m);let p=new Map,h=new Map;for(let m of i){if(m.uid!==void 0&&!d.has(m.uid)){let b=p.get(m.uid)??[];b.push(m),p.set(m.uid,b)}h.set(m.path,m)}for(let m of e){let b=new Set;if(m.uid!==void 0&&!d.has(m.uid))for(let E of p.get(m.uid)??[])E.kind==="change"&&E.path!==m.path&&(c?.has(m.path)===!0||m.basePath!==void 0&&c?.has(m.basePath)===!0)||b.add(E);let _=h.get(m.path);if(_!==void 0&&b.add(_),m.basePath!==void 0){let E=h.get(m.basePath);E!==void 0&&b.add(E)}let S=[],I=!1;for(let E of b){if(I=t.has(m.path)&&!n.has(m.path),I&&E.kind==="delete"){l.add(E);continue}if(!I&&E.kind==="change"&&E.path===m.path&&E.blobSha===m.blobSha){l.add(E),s.add(m.path);continue}if(E.kind==="delete"&&m.basePath!==void 0&&E.path===m.basePath){let w=h.get(m.path);if(w!==void 0&&w.kind==="change"&&(w.blobSha===m.blobSha||w.uid!==void 0&&w.uid===m.uid)){l.add(E);continue}}if(E.kind==="delete"&&E.path!==m.path&&E.path!==m.basePath&&!n.has(E.path)&&c?.has(E.path)!==!0){l.add(E);continue}S.push(E),l.add(E)}S.length>0&&(u.push({local:m,localIsDelete:I,remotes:S,desc:`${m.uid!==void 0&&!d.has(m.uid)?m.uid:m.path} (local ${I?"delete":"change"} vs remote ${S[0].kind} at ${S[0].path})`}),s.add(m.path))}let g=i.filter(m=>!l.has(m));return{conflicts:u,applyWrites:g.filter(m=>m.kind==="change"),applyDeletes:g.filter(m=>m.kind==="delete")}}async checkRaceWindow(e,t,n,i,s,o,c,l){try{let u=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,i,this.deps.baseURL),f=(await(0,dt.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL)).filter(l.treeFilter),d=n===t.lastSyncedSha?t.files:(await(0,dt.getTree)(this.transport,e.owner,e.repo,(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,n,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(l.treeFilter),{changed:p,deleted:h}=s4(d,f);for(let g of p)s.has(g.path)&&c.push(`race-window: concurrent commit ${i} changed ${g.path} between conflict check (head ${n}) and push \u2014 local version won; previous version recoverable from git history`),o.has(g.path)&&c.push(`race-window: concurrent commit ${i} changed ${g.path} which this push DELETED \u2014 the delete won; the concurrent version is recoverable from git history`);for(let g of h)s.has(g.path)&&c.push(`race-window: concurrent commit ${i} deleted ${g.path}; push re-created it`)}catch(u){let f=this.deps.redact??(d=>d);c.push(`race-window check failed: ${f(ka(u))}`)}}async buildWatermarkFiles(e,t,n,i,s,o,c){if(c.fileMode)return t.map(f=>({path:f.path,blobSha:f.blobSha}));let l=new Map;for(let f of i)f.kind==="change"&&f.blobSha!==void 0&&l.set(f.blobSha,f.uid);for(let[f,d]of n){let p=o?.get(f)??await(0,iu.gitBlobSha)(d,this.sha1);l.set(p,typeof d=="string"?(0,Fo.extractAssetUid)(d):void 0)}for(let f of s.files)l.has(f.blobSha)||l.set(f.blobSha,f.uid);let u=[];for(let f of t){let d;if(l.has(f.blobSha))d=l.get(f.blobSha);else{let p=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,f.blobSha,this.deps.baseURL);d=(0,Fo.extractAssetUid)(p)}u.push({path:f.path,blobSha:f.blobSha,...d?{uid:d}:{}})}return u}};Tn.SyncEngine=tC});var l4=T(sm=>{"use strict";Object.defineProperty(sm,"__esModule",{value:!0});sm.QuarantineResolver=void 0;sm.backupPathFor=c4;var sae=J_(),lS=hd(),nm=pd(),im=Zh(),oae=rS(),Lo="\0absent",rC=class{static{a(this,"QuarantineResolver")}constructor(e){this.deps=e}async listOpenConflicts(e){let t=[];for(let n of e)t.push(...await this.listRepoConflicts(n));return t}async listRepoConflicts(e){if(e.spaceKind==="file")return[];let t=await this.deps.watermarkStore.get(e.repoKey),n=t?.pinnedPaths??[];if(n.length===0)return[];if(this.deps.outbox!==void 0){let h=await this.deps.outbox.listForRepo(e.repoKey);if(h.length>0){let g=new Set(h.map(m=>m.path));if(n=n.filter(m=>!g.has(m)),n.length===0)return[]}}let i=new Map;for(let h of t?.files??[])i.set(h.path,h.blobSha);let s=this.deps.conflictCache!==void 0,o=await this.cachedRecordsFor(e,n),c=n.some(h=>!o.has(h)),l=new Map,u=!0;if(c)if(s)try{l=await this.remoteTreeShas(e)}catch{u=!1}else l=await this.remoteTreeShas(e);let f=this.deps.localFilesFor(e),d=new Set(await f.list()),p=[];for(let h of n){let g=o.get(h),m,b;if(g!==void 0)b=g.remoteContent!==void 0?await(0,nm.gitBlobSha)(g.remoteContent,this.deps.sha1):Lo,m=g.baseContent!==void 0?await(0,nm.gitBlobSha)(g.baseContent,this.deps.sha1):i.get(h)??Lo;else{if(!u)continue;b=l.get(h)??Lo,m=i.get(h)??Lo}let _=Lo,S;if(d.has(h)&&(S=await f.read(h),_=await(0,nm.gitBlobSha)(S,this.deps.sha1)),!(_!==b&&_!==m&&b!==m))continue;let E=(S!==void 0?(0,im.extractAssetUid)(S):void 0)??g?.uid;p.push({repoKey:e.repoKey,path:h,...E!==void 0?{uid:E}:{},hasLocal:_!==Lo,hasRemote:b!==Lo})}return p}async cachedRecordsFor(e,t){let n=new Map,i=this.deps.conflictCache;if(i===void 0)return n;for(let s of t){let o=await i.get(e.repoKey,s);o!==null&&n.set(s,o)}return n}async detectDuplicateUids(e){let t=new Map;for(let i of e){let s=this.deps.localFilesFor(i);for(let o of await s.list()){if(!o.endsWith(".md"))continue;let c;try{c=await s.read(o)}catch{continue}let l=(0,im.extractAssetUid)(c);l!==void 0&&t.set(l,(t.get(l)??0)+1)}}let n=0;for(let i of t.values())i>1&&n++;return n}async loadConflict(e,t){let n=this.deps.localFilesFor(e),s=new Set(await n.list()).has(t)?await n.read(t):void 0,o=await this.deps.conflictCache?.get(e.repoKey,t)??null,c,l;if(o!==null)c=o.remoteContent,l=o.baseContent;else{let d=(await this.remoteTreeShas(e)).get(t);c=d!==void 0?await this.blobText(e,d):void 0;let h=((await this.deps.watermarkStore.get(e.repoKey))?.files??[]).find(g=>g.path===t)?.blobSha;if(h!==void 0)try{l=await this.blobText(e,h)}catch{l=void 0}}let u=(s!==void 0?(0,im.extractAssetUid)(s):void 0)??(c!==void 0?(0,im.extractAssetUid)(c):void 0)??o?.uid;return{repoKey:e.repoKey,path:t,...u!==void 0?{uid:u}:{},hasLocal:s!==void 0,hasRemote:c!==void 0,...l!==void 0?{base:l}:{},...s!==void 0?{local:s}:{},...c!==void 0?{remote:c}:{}}}async resolve(e,t,n){let i=this.deps.localFilesFor(e),o=new Set(await i.list()).has(t)?await i.read(t):void 0,c=this.deps.outbox!==void 0,{remote:l,remoteSha:u}=c?await this.remoteForResolve(e,t):await this.liveRemoteForResolve(e,t),f=this.chosenContent(n,o,l),d;n.take!=="local"&&o!==void 0&&o!==f&&(d=c4(t),await i.write(d,o)),f===void 0?await i.delete(t):await i.write(t,f);let h=f===void 0&&l===void 0||f===l;if(c&&this.deps.outbox!==void 0&&!h&&f!==void 0)return await this.deps.outbox.enqueue({repoKey:e.repoKey,path:t,chosenContent:f,resolvedTo:n.take==="merged"?"merged":"local",baseRemoteSha:u===Lo?oae.OUTBOX_REMOTE_ABSENT:u,resolvedAt:""}),{repoKey:e.repoKey,path:t,resolvedTo:n.take,awaitingPush:!0,...d!==void 0?{discardedLocalBackupPath:d}:{}};let g;return h||(g=await this.commitChoice(e,t,f)),await this.snapWatermark(e,t,f),this.deps.quarantine?.markResolved!==void 0&&await this.deps.quarantine.markResolved(e.repoKey,t),{repoKey:e.repoKey,path:t,resolvedTo:n.take,...g!==void 0?{pushedSha:g}:{},...d!==void 0?{discardedLocalBackupPath:d}:{}}}async remoteForResolve(e,t){let n=await this.deps.conflictCache?.get(e.repoKey,t)??null;if(n!==null){let i=n.remoteContent,s=i!==void 0?await(0,nm.gitBlobSha)(i,this.deps.sha1):Lo;return{remote:i,remoteSha:s}}return this.liveRemoteForResolve(e,t)}async liveRemoteForResolve(e,t){let i=(await this.remoteTreeShas(e)).get(t);return{remote:i!==void 0?await this.blobText(e,i):void 0,remoteSha:i??Lo}}chosenContent(e,t,n){switch(e.take){case"local":if(t===void 0)throw new Error("resolve: cannot keep local \u2014 no local version exists on disk");return t;case"remote":return n;case"merged":return e.content}}async commitChoice(e,t,n){let i=this.deps.commitMessage?.(e,t)??`chore(exosync): resolve conflict for ${t}`;if(n===void 0)throw new Error(`resolve: cannot push an empty resolution for ${t}`);return(0,sae.restCreateCommit)(this.deps.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([[t,n]]),message:i,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}})}async snapWatermark(e,t,n){let i=await this.deps.watermarkStore.get(e.repoKey);if(i===null)return;let s=(i.pinnedPaths??[]).filter(c=>c!==t),o=i.files;if(n===void 0)o=o.filter(c=>c.path!==t);else{let c=await(0,nm.gitBlobSha)(n,this.deps.sha1),l=(0,im.extractAssetUid)(n),u={path:t,blobSha:c,...l!==void 0?{uid:l}:{}},f=o.findIndex(d=>d.path===t);o=f>=0?o.map((d,p)=>p===f?u:d):[...o,u]}await this.deps.watermarkStore.set(e.repoKey,{...i,files:o,...s.length>0?{pinnedPaths:s}:{pinnedPaths:void 0}})}async remoteTreeShas(e){let t=await(0,lS.getHeadSha)(this.deps.transport,e.owner,e.repo,e.branch,this.deps.baseURL),n=await(0,lS.getCommitInfo)(this.deps.transport,e.owner,e.repo,t,this.deps.baseURL),i=await(0,lS.getTree)(this.deps.transport,e.owner,e.repo,n.treeSha,this.deps.baseURL),s=new Map;for(let o of i)s.set(o.path,o.blobSha);return s}async blobText(e,t){return(0,lS.getBlobText)(this.deps.transport,e.owner,e.repo,t,this.deps.baseURL)}};sm.QuarantineResolver=rC;function c4(r){return`${r}.conflict.local.txt`}a(c4,"backupPathFor")});var u4=T(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.FileLocalManifestStore=gd.LOCAL_MANIFEST_STORE_FILENAME=void 0;gd.LOCAL_MANIFEST_STORE_FILENAME="exosync-localmanifest.local.json";function aae(r){if(r===null||typeof r!="object")return!1;let e=r;return e.version===1&&typeof e.lastFullRehashMs=="number"&&e.files!==null&&typeof e.files=="object"}a(aae,"isLocalManifestRecord");var nC=class{static{a(this,"FileLocalManifestStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let n=(await this.readRepos())[e];return aae(n)?n:null}async set(e,t){let n=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))});return this.writeChain=n.catch(()=>{}),n}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 n=t.repos;return n===null||typeof n!="object"?{}:{...n}}catch{return{}}}};gd.FileLocalManifestStore=nC});var oC=T(sC=>{"use strict";Object.defineProperty(sC,"__esModule",{value:!0});sC.diff3=cae;function f4(r,e){let t=r.length,n=e.length,i=Array.from({length:t+1},()=>new Int32Array(n+1));for(let l=t-1;l>=0;l--)for(let u=n-1;u>=0;u--)i[l][u]=r[l]===e[u]?i[l+1][u+1]+1:Math.max(i[l+1][u],i[l][u+1]);let s=new Map,o=0,c=0;for(;o<t&&c<n;)r[o]===e[c]?(s.set(o,c),o++,c++):i[o+1][c]>=i[o][c+1]?o++:c++;return s}a(f4,"lcsMatch");function iC(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}a(iC,"sliceEq");function cae(r,e,t){let n=f4(r,e),i=f4(r,t),s=[],o=0,c=0,l=0;for(;;){let u=o;for(;u<r.length&&!(n.has(u)&&i.has(u));)u++;let f=u<r.length?n.get(u):e.length,d=u<r.length?i.get(u):t.length,p=r.slice(o,u),h=e.slice(c,f),g=t.slice(l,d),m=!iC(h,p),b=!iC(g,p);if(!m&&!b)s.push(...p);else if(!m)s.push(...g);else if(!b)s.push(...h);else if(iC(h,g))s.push(...h);else return{ok:!1,conflict:{base:p,local:h,remote:g}};if(u>=r.length)break;s.push(r[u]),o=u+1,c=f+1,l=d+1}return{ok:!0,merged:s}}a(cae,"diff3")});var p4=T(cm=>{"use strict";Object.defineProperty(cm,"__esModule",{value:!0});cm.StructuredMerger=void 0;cm.splitSections=uS;var d4=oC(),lae=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,om="exo__Instance_class";function am(r){if(r===null||typeof r!="object")return!0;if(Array.isArray(r))return r.every(am);let e=Object.getPrototypeOf(r);return e!==Object.prototype&&e!==null?!1:Object.values(r).every(am)}a(am,"isPlainValue");function Pc(r,e){if(r===e)return!0;if(r===null||e===null||r===void 0||e===void 0||typeof r!="object"||typeof e!="object"||Array.isArray(r)!==Array.isArray(e))return!1;if(Array.isArray(r)&&Array.isArray(e))return r.length!==e.length?!1:r.every((s,o)=>Pc(s,e[o]));let t=r,n=e,i=Object.keys(t);return i.length!==Object.keys(n).length?!1:i.every(s=>Pc(t[s],n[s]))}a(Pc,"deepEqual");function su(r){return typeof r=="string"?`s:${r}`:`j:${JSON.stringify(r)}`}a(su,"setKey");function cs(r){return r==null?[]:Array.isArray(r)?r:[r]}a(cs,"toElements");function uae(r,e,t){let n=new Set(cs(r).map(su)),i=cs(e),s=cs(t),o=new Set(i.map(su)),c=new Set(s.map(su)),l=a(d=>o.has(d)&&c.has(d)||o.has(d)&&!n.has(d)||c.has(d)&&!n.has(d),"keep"),u=[],f=new Set;for(let d of[...i,...s]){let p=su(d);f.has(p)||!l(p)||(f.add(p),u.push(d))}return u}a(uae,"mergeSet");function fae(r,e,t){let n=[],i=[],s=new Set;for(let c of[...Object.keys(r),...Object.keys(e),...Object.keys(t)])s.has(c)||(s.add(c),i.push(c));let o={};for(let c of i){let l=r[c],u=e[c],f=t[c];if(!am(l)||!am(u)||!am(f))return{ok:!1,reason:`frontmatter key "${c}" contains a non-plain value (Date?) \u2014 the codec must round-trip scalars as strings (CORE_SCHEMA contract)`};if(Array.isArray(l)||Array.isArray(u)||Array.isArray(f)){if(!(c in e)&&!(c in t))continue;let d=uae(l,u,f),p=new Set(cs(l).map(su)),h=cs(u).some(m=>!p.has(su(m))),g=cs(f).some(m=>!p.has(su(m)));h&&g&&!Pc(cs(u),cs(f))&&n.push(`both sides added values to multi-valued key "${c}" \u2014 union kept (D20)`),d.length>0&&(o[c]=d);continue}if(Pc(u,f)){u!==void 0&&(o[c]=u);continue}if(Pc(u,l)){f!==void 0&&(o[c]=f);continue}if(Pc(f,l)){u!==void 0&&(o[c]=u);continue}return{ok:!1,reason:`frontmatter key "${c}" changed differently on both sides`}}return{ok:!0,value:o,warnings:n}}a(fae,"mergeFrontmatter");var dae=/^(```|~~~)/,pae=/^#{1,6}\s/;function uS(r){let e=r.split(`
336
+ `)}a(loe,"stripGitmodulesEntry")});var pd=T(jR=>{"use strict";Object.defineProperty(jR,"__esModule",{value:!0});jR.gitBlobSha=uoe;async function uoe(r,e){let t=new TextEncoder,n=typeof r=="string"?t.encode(r):r,i=t.encode(`blob ${n.byteLength}\0`),s=new Uint8Array(i.byteLength+n.byteLength);return s.set(i,0),s.set(n,i.byteLength),e(s)}a(uoe,"gitBlobSha")});var Zh=T(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});eS.extractAssetUid=x$;eS.detectChanges=doe;var foe=pd();function x$(r){let e=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/.exec(r);if(!e)return;let t=/^exo__Asset_uid:[ \t]*["']?([^\s"']+)["']?[ \t]*$/m.exec(e[1]);return t?t[1]:void 0}a(x$,"extractAssetUid");async function doe(r){let{localFiles:e,cachedEntries:t,watermark:n,actualBaseTreeSha:i,sha1:s}=r;if(n===null)return{kind:"full-conflict",reason:"first-sync"};if(i===null)return{kind:"full-conflict",reason:"base-mismatch",detail:`watermark commit ${n.lastSyncedSha} not resolvable on remote`};if(i!==n.rootTreeSha)return{kind:"full-conflict",reason:"base-mismatch",detail:`stored root tree ${n.rootTreeSha} != actual ${i} at ${n.lastSyncedSha}`};let o=[],c=new Map;for(let[E,w]of e){let R=await(0,foe.gitBlobSha)(w,s);c.set(E,R),o.push({path:E,blobSha:R,uid:typeof w=="string"?x$(w):void 0})}if(t!==void 0)for(let[E,w]of t)c.set(E,w.blobSha),o.push({path:E,blobSha:w.blobSha,uid:w.uid});let l=[],u=[],f=[],d=[],p=new Map;for(let E of o){if(E.uid===void 0)continue;let w=p.get(E.uid)??[];w.push(E.path),p.set(E.uid,w)}let h=new Map;for(let E of n.files){if(E.uid===void 0)continue;let w=h.get(E.uid)??[];w.push(E.path),h.set(E.uid,w)}let g=new Set;for(let[E,w]of p)w.length>1&&g.add(E);for(let[E,w]of h)w.length>1&&g.add(E);for(let E of[...g].sort()){let w=p.get(E)??[],R=w.length>1?`on disk (${w.join(", ")})`:`in the sync base (${(h.get(E)??[]).join(", ")})`;d.push(`duplicate uid ${E} ${R} \u2014 uid identity suppressed for the group; every path matched by path identity (#3477)`)}let m=new Map,b=[];for(let E of n.files)E.uid!==void 0&&!g.has(E.uid)?m.set(E.uid,E):b.push(E);let _=[],S=new Set;for(let E of o){let w=E.uid!==void 0&&!g.has(E.uid)?m.get(E.uid):void 0;E.uid!==void 0&&w!==void 0?(S.add(E.uid),(w.blobSha!==E.blobSha||w.path!==E.path)&&u.push({path:E.path,uid:E.uid,blobSha:E.blobSha,...w.path!==E.path?{basePath:w.path}:{}})):_.push(E)}let I=new Map;for(let E of b)I.set(E.path,E);for(let[E,w]of m)S.has(E)||I.set(w.path,w);for(let E of _){let w=I.get(E.path);w!==void 0?(I.delete(E.path),w.blobSha!==E.blobSha&&u.push({path:E.path,uid:E.uid,blobSha:E.blobSha})):l.push({path:E.path,uid:E.uid,blobSha:E.blobSha})}for(let E of I.values())f.push({path:E.path,uid:E.uid,blobSha:E.blobSha});return{kind:"changes",added:l,modified:u,deleted:f,warnings:d,diskBlobShas:c,duplicateUids:g}}a(doe,"detectChanges")});var F$=T(em=>{"use strict";Object.defineProperty(em,"__esModule",{value:!0});em.rewriteAssetUid=P$;em.findDuplicateUidGroups=O$;em.planDuplicateUidFix=hoe;var poe=Zh();function P$(r,e){let t=/^(---\r?\n)([\s\S]*?)(\r?\n---(?=\r?\n|$))/.exec(r);if(t===null)return r;let n=t[2].replace(/^(exo__Asset_uid:[ \t]*["']?)[^\s"']+(["']?[ \t]*)$/m,`$1${e}$2`);return n===t[2]?r:r.slice(0,t.index)+t[1]+n+t[3]+r.slice(t.index+t[0].length)}a(P$,"rewriteAssetUid");function O$(r){let e=new Map;for(let t of r){let n=(0,poe.extractAssetUid)(t.content);if(n===void 0)continue;let i=e.get(n)??[];i.push(t.path),e.set(n,i)}return[...e.entries()].filter(([,t])=>t.length>1).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>({uid:t,paths:n}))}a(O$,"findDuplicateUidGroups");function hoe(r,e){let t=new Map(r.map(i=>[i.path,i.content])),n=[];for(let i of O$(r)){let s=[...i.paths].sort((o,c)=>o.localeCompare(c));for(let o of s.slice(1)){let c=t.get(o);if(c===void 0)continue;let l=e(),u=P$(c,l);u!==c&&n.push({path:o,fromUid:i.uid,toUid:l,content:u})}}return n}a(hoe,"planDuplicateUidFix")});var hd=T(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.EMPTY_TREE_SHA=void 0;Oo.getHeadSha=goe;Oo.getCommitInfo=yoe;Oo.getTree=boe;Oo.getBlobText=_oe;Oo.getBlobBytes=Soe;var D$=sf(),moe="https://api.github.com";function tm(r){return(r??moe).replace(/\/$/,"")}a(tm,"api");function nu(r){return r!==null&&typeof r=="object"?r:void 0}a(nu,"asRecord");function Po(r,e){let n=nu(r)?.[e];return typeof n=="string"?n:void 0}a(Po,"readString");async function goe(r,e,t,n,i){let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/refs/heads/${encodeURIComponent(n)}`}),o=Po(nu(s?.json)?.object,"sha");if(typeof o!="string"||o.length===0)throw new Error(`ExoSync: missing object.sha for ref heads/${n}`);return o}a(goe,"getHeadSha");async function yoe(r,e,t,n,i){let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/commits/${encodeURIComponent(n)}`}),o=nu(s?.json),c=Po(o,"sha"),l=Po(o?.tree,"sha");if(!c||!l)throw new Error(`ExoSync: malformed commit response for ${n}`);let u=o?.parents,f=Array.isArray(u)?u.map(d=>Po(d,"sha")).filter(d=>typeof d=="string"):[];return{sha:c,treeSha:l,parents:f}}a(yoe,"getCommitInfo");Oo.EMPTY_TREE_SHA="4b825dc642cb6eb9a060e54bf8d69288fbee4904";async function boe(r,e,t,n,i){if(n===Oo.EMPTY_TREE_SHA)return[];let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/trees/${encodeURIComponent(n)}?recursive=1`}),o=nu(s?.json);if(o?.truncated===!0)throw new Error(`ExoSync: tree ${n} is truncated by GitHub (repo too large for recursive listing) \u2014 refusing to diff`);let c=o?.tree;if(!Array.isArray(c))throw new Error(`ExoSync: malformed tree response for ${n}`);let l=[];for(let u of c){let f=nu(u);if(f?.type!=="blob")continue;let d=Po(f,"path"),p=Po(f,"sha"),h=typeof f.size=="number"?f.size:void 0;d&&p&&l.push({path:d,blobSha:p,...h!==void 0?{size:h}:{}})}return l}a(boe,"getTree");async function _oe(r,e,t,n,i){let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(n)}`}),o=nu(s?.json),c=Po(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${n}`);return Po(o,"encoding")==="utf-8"?c:(0,D$.base64ToUtf8)(c)}a(_oe,"getBlobText");async function Soe(r,e,t,n,i){let s=await r({method:"GET",url:`${tm(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(n)}`}),o=nu(s?.json),c=Po(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${n}`);return Po(o,"encoding")==="utf-8"?new TextEncoder().encode(c):(0,D$.base64ToBytes)(c)}a(Soe,"getBlobBytes")});var N$=T($R=>{"use strict";Object.defineProperty($R,"__esModule",{value:!0});$R.checkParkedStaleness=Eoe;var woe=hd();async function Eoe(r,e){let t={repoKey:r.repoKey,localPath:r.localPath},n=e.redact??(o=>o),i=null;try{let c=(await e.watermarks.get(r.repoKey))?.lastSyncedSha??"";c.length>0&&(i=c)}catch(o){return{...t,freshness:"unknown",lastSyncedSha:null,remoteHeadSha:null,reason:`watermark unreadable: ${n(L$(o))}`}}if(i===null)return{...t,freshness:"unknown",lastSyncedSha:null,remoteHeadSha:null,reason:"never synced on this device (no watermark)"};let s;try{s=await(0,woe.getHeadSha)(e.transport,r.owner,r.repo,r.branch,e.baseURL)}catch(o){return{...t,freshness:"unknown",lastSyncedSha:i,remoteHeadSha:null,reason:`remote unreachable: ${n(L$(o))}`}}return{...t,freshness:s===i?"current":"behind",lastSyncedSha:i,remoteHeadSha:s}}a(Eoe,"checkParkedStaleness");function L$(r){return r instanceof Error?r.message:String(r)}a(L$,"errorText")});var VR=T(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.SyncPhaseTimer=gr.SYNC_PHASES=void 0;gr.classifyRestPhase=voe;gr.emptyTimings=M$;gr.totalMs=tS;gr.addTimings=j$;gr.aggregateTimings=Toe;gr.dominantPhase=Aoe;gr.fmtMs=rm;gr.formatTimingsLine=Ioe;gr.formatRepoTimings=Roe;gr.SYNC_PHASES=["localList","localRead","localWrite","hash","restHead","restCommit","restTree","restBlob","restPush"];function BR(){let r={};for(let e of gr.SYNC_PHASES)r[e]=0;return r}a(BR,"zeroDurations");function k$(){return{filesRead:0,filesHashed:0,filesWritten:0,restCalls:0}}a(k$,"zeroCounts");function voe(r){if(r.method!=="GET")return"restPush";let e=r.url;return e.includes("/git/blobs/")?"restBlob":e.includes("/git/trees/")?"restTree":e.includes("/git/commits/")?"restCommit":e.includes("/git/refs/")?"restHead":"restCommit"}a(voe,"classifyRestPhase");var UR=class{static{a(this,"SyncPhaseTimer")}constructor(e){this.now=e,this.durations=BR(),this.counts=k$()}async time(e,t){let n=this.now();try{return await t()}finally{this.durations[e]+=this.now()-n}}bumpRead(){this.counts.filesRead++}bumpHashed(){this.counts.filesHashed++}bumpWritten(){this.counts.filesWritten++}bumpRest(){this.counts.restCalls++}snapshot(){return{durations:{...this.durations},counts:{...this.counts}}}};gr.SyncPhaseTimer=UR;function M$(){return{durations:BR(),counts:k$()}}a(M$,"emptyTimings");function tS(r){let e=0;for(let t of gr.SYNC_PHASES)e+=r.durations[t];return e}a(tS,"totalMs");function j$(r,e){let t=BR();for(let n of gr.SYNC_PHASES)t[n]=r.durations[n]+e.durations[n];return{durations:t,counts:{filesRead:r.counts.filesRead+e.counts.filesRead,filesHashed:r.counts.filesHashed+e.counts.filesHashed,filesWritten:r.counts.filesWritten+e.counts.filesWritten,restCalls:r.counts.restCalls+e.counts.restCalls}}}a(j$,"addTimings");function Toe(r){let e=M$();for(let t of r)t.timings!==void 0&&(e=j$(e,t.timings));return e}a(Toe,"aggregateTimings");function Aoe(r){let e=tS(r);if(e<=0)return null;let t=gr.SYNC_PHASES[0],n=-1;for(let i of gr.SYNC_PHASES)r.durations[i]>n&&(n=r.durations[i],t=i);return{phase:t,ms:n,pct:n/e*100}}a(Aoe,"dominantPhase");function rm(r){return r>=1e3?`${(r/1e3).toFixed(1)}s`:`${Math.round(r)}ms`}a(rm,"fmtMs");function Ioe(r){let e=tS(r);if(e<=0)return"";let t=gr.SYNC_PHASES.filter(n=>r.durations[n]>0).sort((n,i)=>r.durations[i]-r.durations[n]).map(n=>`${n} ${rm(r.durations[n])} ${Math.round(r.durations[n]/e*100)}%`);return`\u23F1 ExoSync ${rm(e)} \u2014 ${t.join(" \xB7 ")} (${r.counts.filesHashed} hashed, ${r.counts.filesRead} read, ${r.counts.restCalls} REST)`}a(Ioe,"formatTimingsLine");function Roe(r,e){let t=gr.SYNC_PHASES.map(n=>`${n}=${rm(e.durations[n])}`);return`[ExoSync timings] ${r}: total ${rm(tS(e))} \u2014 ${t.join(" ")} | hashed ${e.counts.filesHashed} read ${e.counts.filesRead} written ${e.counts.filesWritten} REST ${e.counts.restCalls}`}a(Roe,"formatRepoTimings")});var rS=T(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.LocalOutboxStore=Cc.OUTBOX_REMOTE_ABSENT=Cc.OUTBOX_STORE_FILENAME=void 0;Cc.OUTBOX_STORE_FILENAME="exosync-outbox.local.json";Cc.OUTBOX_REMOTE_ABSENT=" absent";function GR(r,e){return`${r}\0${e}`}a(GR,"outboxKey");function $$(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.repoKey=="string"&&typeof e.path=="string"&&typeof e.chosenContent=="string"&&typeof e.baseRemoteSha=="string"}a($$,"isEntry");var qR=class{static{a(this,"LocalOutboxStore")}constructor(e){this.writeChain=Promise.resolve(),this.io=e.io,this.now=e.now??(()=>new Date().toISOString())}async enqueue(e){await this.mutate(t=>{t.entries[GR(e.repoKey,e.path)]={version:1,...e,resolvedAt:e.resolvedAt.length>0?e.resolvedAt:this.now()}})}async remove(e,t){await this.mutate(n=>{delete n.entries[GR(e,t)]})}async list(){let e=await this.read();return Object.values(e.entries).filter($$)}async listForRepo(e){return(await this.list()).filter(t=>t.repoKey===e)}async has(e,t){let i=(await this.read()).entries[GR(e,t)];return i!==void 0&&$$(i)}async mutate(e){let t=this.writeChain.then(async()=>{let n=await this.read();e(n),await this.io.writeAtomic(JSON.stringify(n,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 n=t.entries;return n===null||typeof n!="object"?{version:1,entries:{}}:{version:1,entries:{...n}}}catch{return{version:1,entries:{}}}}};Cc.LocalOutboxStore=qR});var nS=T(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.SpaceSpecAccumulator=Bn.SYNC_BRANCH=Bn.ASSET_SPACE_CLASS_UID=void 0;Bn.isAssetSpaceFrontmatter=V$;Bn.isFileSpaceFrontmatter=G$;Bn.readSpaceSource=q$;Bn.parseStrictGitHubRepoURL=W$;Bn.classifySpaceDeclaration=Ooe;var Coe=Pb(),xoe=xb();Bn.ASSET_SPACE_CLASS_UID="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb";Bn.SYNC_BRANCH="main";var U$=/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]/gi;function B$(r,e){let t=r.exo__Instance_class,n=Array.isArray(t)?t:[t];for(let i of n){if(typeof i!="string")continue;U$.lastIndex=0;let s;for(;(s=U$.exec(i))!==null;)if(s[1].toLowerCase()===e)return!0}return!1}a(B$,"instanceClassHasUid");function V$(r){return B$(r,Bn.ASSET_SPACE_CLASS_UID)}a(V$,"isAssetSpaceFrontmatter");function G$(r){return B$(r,Coe.FILE_SPACE_CLASS_UID)}a(G$,"isFileSpaceFrontmatter");function q$(r){let e=r.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=r.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(q$,"readSpaceSource");var Poe=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/;function W$(r){if(typeof r!="string"||r.length===0||r.length>256||!Poe.test(r))return null;let e=r.slice(19),[t,n,...i]=e.split("/");if(i.length>0||t===".."||n===".."||n.startsWith("."))return null;let s=n.replace(/\.git$/,"");return s.length===0?null:{owner:t,repo:s}}a(W$,"parseStrictGitHubRepoURL");function Ooe(r,e){let t=V$(r),n=G$(r);if(!t&&!n)return{kind:"not-space"};let i;t&&n&&(i=`declaration at ${e} carries BOTH exo__AssetSpace and exo__FileSpace classes (disjoint) \u2014 treating as AssetSpace (conservative)`);let s=t?"asset":"file",o=q$(r);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=W$(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,xoe.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}#${Bn.SYNC_BRANCH}`,d=r.exo__Asset_uid,p=typeof d=="string"&&d.trim().length>0?d.trim():void 0;return{kind:"candidate",candidate:{spec:{owner:l.owner,repo:l.repo,branch:Bn.SYNC_BRANCH,repoKey:f,localPath:u,...s==="file"?{spaceKind:s}:{}},spaceKind:s,...p!==void 0?{asUid:p}:{}},...i!==void 0?{warning:i}:{}}}a(Ooe,"classifySpaceDeclaration");var WR=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:n}=e;if(this.seen.has(t.repoKey)){let i=this.kindByRepoKey.get(t.repoKey);if(i!==void 0&&i!==n&&(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,n),t}commit(e){this.specs.push(e.spec),e.asUid!==void 0&&this.asUidByRepoKey.set(e.spec.repoKey,e.asUid)}};Bn.SpaceSpecAccumulator=WR});var iS=T(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.REF_NOT_FOUND_HINT=void 0;md.isAuthError=Foe;md.isRefNotFoundError=Doe;var z$=nS();function Foe(r){let e=r instanceof Error?r.message:String(r);return/HTTP 401/.test(e)?!0:/HTTP 403/.test(e)&&!/rate limit/i.test(e)&&!/abuse detection/i.test(e)}a(Foe,"isAuthError");function Doe(r){let e=r instanceof Error?r.message:String(r);return/\/git\/refs\/heads\/\S* → HTTP 404\b/.test(e)}a(Doe,"isRefNotFoundError");md.REF_NOT_FOUND_HINT=`GitHub answers 404 for a private repo outside a fine-grained PAT's repository allowlist (existence-hiding), for a deleted/renamed repo, and for a visible repo that has no \`${z$.SYNC_BRANCH}\` branch (ExoSync syncs \`${z$.SYNC_BRANCH}\` only) \u2014 check the token's repository allowlist first (R8)`});var zR=T(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});sS.scanForSecrets=Loe;sS.redactSecrets=Noe;var H$=[{kind:"github-token",re:/gh[pousr]_[A-Za-z0-9_]{36,}/},{kind:"github-fine-grained-token",re:/github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,}/},{kind:"private-key",re:/-----BEGIN [A-Z ]*PRIVATE KEY-----/}];function Loe(r){let e=[];for(let[t,n]of r)for(let{kind:i,re:s}of H$)s.test(n)&&e.push({path:t,kind:i});return e}a(Loe,"scanForSecrets");function Noe(r){let e=r;for(let{kind:t,re:n}of H$)e=e.replace(new RegExp(n.source,"g"),`[REDACTED:${t}]`);return e}a(Noe,"redactSecrets")});var YR=T(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.caseInsensitiveHeaderGetter=koe;xc.parseRetryAfterMs=K$;xc.extractRateLimitFields=Y$;xc.getRateLimitFields=Moe;xc.attachRateLimitFields=X$;xc.enrichRateLimitError=joe;function koe(r){let e=new Map;if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))typeof n=="string"&&e.set(t.toLowerCase(),n);return t=>e.get(t.toLowerCase())}a(koe,"caseInsensitiveHeaderGetter");function KR(r){if(r==null)return;let e=r.trim();if(!/^-?\d+$/.test(e))return;let t=Number(e);return Number.isFinite(t)?t:void 0}a(KR,"parseIntHeader");function K$(r,e=Date.now){if(r==null)return;let t=r.trim();if(t.length===0)return;let n=KR(t);if(n!==void 0)return Math.max(0,n*1e3);let i=Date.parse(t);if(!Number.isNaN(i))return Math.max(0,i-e())}a(K$,"parseRetryAfterMs");function Y$(r,e=Date.now){let t={},n=K$(r("retry-after"),e);n!==void 0&&(t.retryAfterMs=n);let i=KR(r("x-ratelimit-reset"));i!==void 0&&(t.rateLimitReset=i);let s=KR(r("x-ratelimit-remaining"));return s!==void 0&&(t.rateLimitRemaining=s),t}a(Y$,"extractRateLimitFields");function Moe(r){if(r===null||typeof r!="object")return{};let e=r,t={};return typeof e.retryAfterMs=="number"&&(t.retryAfterMs=e.retryAfterMs),typeof e.rateLimitReset=="number"&&(t.rateLimitReset=e.rateLimitReset),typeof e.rateLimitRemaining=="number"&&(t.rateLimitRemaining=e.rateLimitRemaining),t}a(Moe,"getRateLimitFields");function HR(r,e,t){Object.defineProperty(r,e,{value:t,enumerable:!1,writable:!0,configurable:!0})}a(HR,"defineHidden");function X$(r,e){return e.retryAfterMs!==void 0&&HR(r,"retryAfterMs",e.retryAfterMs),e.rateLimitReset!==void 0&&HR(r,"rateLimitReset",e.rateLimitReset),e.rateLimitRemaining!==void 0&&HR(r,"rateLimitRemaining",e.rateLimitRemaining),r}a(X$,"attachRateLimitFields");function joe(r,e,t=Date.now){return X$(r,Y$(e,t))}a(joe,"enrichRateLimitError")});var oS=T(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.DEFAULT_MAX_RETRIES=as.MIN_RATE_LIMIT_WAIT_MS=void 0;as.isRateLimitError=Q$;as.createRateLimitBudget=Uoe;as.withRateLimitBackoff=Goe;var $oe=YR();function Q$(r){let e=r instanceof Error?r.message:String(r);return/HTTP 429/.test(e)?!0:/HTTP 403/.test(e)&&(/rate limit/i.test(e)||/abuse detection/i.test(e))}a(Q$,"isRateLimitError");as.MIN_RATE_LIMIT_WAIT_MS=6e4;as.DEFAULT_MAX_RETRIES=6;function Uoe(r){let e=!(r>0),t=e?Number.POSITIVE_INFINITY:r;return{reset(){t=e?Number.POSITIVE_INFINITY:r},tryReserve(n){return n<=0?!0:n<=t?(t-=n,!0):!1}}}a(Uoe,"createRateLimitBudget");var Boe=a(r=>new Promise(e=>setTimeout(e,r)),"defaultSleep");function Voe(r,e,t,n,i,s){let o=(0,$oe.getRateLimitFields)(r);if(typeof o.retryAfterMs=="number"&&o.retryAfterMs>=0)return o.retryAfterMs;if(o.rateLimitRemaining===0&&typeof o.rateLimitReset=="number"){let l=o.rateLimitReset*1e3-s();if(l>0)return l}let c=t*2**e*(1+i());return Math.max(n,c)}a(Voe,"computeRateLimitDelay");function Goe(r,e={}){let t=e.maxRetries??as.DEFAULT_MAX_RETRIES,n=e.baseDelayMs??1e3,i=Math.max(as.MIN_RATE_LIMIT_WAIT_MS,e.minRateLimitWaitMs??as.MIN_RATE_LIMIT_WAIT_MS),s=e.budget,o=e.sleep??Boe,c=e.random??Math.random,l=e.now??(()=>Date.now());return async u=>{let f=0;for(;;)try{return await r(u)}catch(d){if(!Q$(d)||f>=t)throw d;let p=Voe(d,f,n,i,c,l);if(s!==void 0&&!s.tryReserve(p))throw d;f++,await o(p)}}}a(Goe,"withRateLimitBackoff")});var aS=T(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.DEFAULT_MAX_FILE_BYTES=Na.InMemoryQuarantineStore=void 0;Na.contentEquals=qoe;Na.isSyncablePath=Woe;Na.isFileSpaceSyncablePath=zoe;function qoe(r,e){if(r===void 0||e===void 0||typeof r=="string"&&typeof e=="string")return r===e;if(typeof r=="string"||typeof e=="string"||r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}a(qoe,"contentEquals");var XR=class{static{a(this,"InMemoryQuarantineStore")}constructor(){this.entries=[]}async quarantine(e){this.entries.push(e)}};Na.InMemoryQuarantineStore=XR;function Woe(r){return r.endsWith(".md")&&!r.includes(".local.")&&!r.includes(".conflict.")}a(Woe,"isSyncablePath");function zoe(r){return!r.includes(".local.")&&!r.includes(".conflict.")}a(zoe,"isFileSpaceSyncablePath");Na.DEFAULT_MAX_FILE_BYTES=30*1024*1024});var a4=T(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.SyncEngine=Tn.DEFAULT_LOCAL_MANIFEST_REHASH_MS=Tn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS=Tn.DEFAULT_MAX_PUSH_RETRIES=void 0;Tn.syncProgressPhaseText=Koe;Tn.isNonFastForwardError=o4;Tn.orderChildrenFirst=rae;var J$=J_(),Z$=VR(),dt=hd(),Fo=Zh(),Hoe=sf(),iu=pd(),QR=rS(),JR=iS(),e4=zR(),t4=oS(),Do=aS();Tn.DEFAULT_MAX_PUSH_RETRIES=3;Tn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS=3e5;Tn.DEFAULT_LOCAL_MANIFEST_REHASH_MS=720*60*1e3;function Koe(r){switch(r.phase){case"reading-local":return r.detail!==void 0?`reading local files ${r.detail.done}\u2026`:"reading local files\u2026";case"detecting":return"detecting changes\u2026";case"pulling-remote":return"pulling remote tree\u2026";case"fetching-blobs":return r.detail!==void 0?`fetching remote files ${r.detail.done}/${r.detail.total}\u2026`:"fetching remote files\u2026";case"writing-files":return r.detail!==void 0?`writing files ${r.detail.done}\u2026`:"writing files\u2026";case"merging":return"merge layer firing\u2026";default:return r.phase}}a(Koe,"syncProgressPhaseText");var r4=25,Yoe=10,Xoe=6,Qoe=500,Joe=25;function Zoe(r){try{return new TextDecoder("utf-8",{fatal:!0}).decode(r)}catch{return null}}a(Zoe,"decodeUtf8Strict");function eae(r){return typeof r=="string"?r:{base64:(0,Hoe.bytesToBase64)(r)}}a(eae,"toCommitContent");async function n4(r,e){if(r.readBinary===void 0)throw new Error("LocalFilesPort.readBinary is required for file-mode sync (Phase C)");return r.readBinary(e)}a(n4,"readBinaryStrict");async function tae(r,e,t){if(r.writeBinary===void 0)throw new Error("LocalFilesPort.writeBinary is required for file-mode sync (Phase C)");return r.writeBinary(e,t)}a(tae,"writeBinaryStrict");function i4(r){return r.length===0||r.startsWith("/")||r.includes("\\")?!1:r.split("/").every(e=>e.length>0&&e!=="."&&e!=="..")}a(i4,"isSafeRepoRelativePath");function o4(r){let e=r instanceof Error?r.message:String(r);return/HTTP 422/.test(e)&&/git\/refs/.test(e)||/ref update mismatch/.test(e)||/HTTP 422/.test(e)&&/git\/trees/.test(e)&&/BadObjectState/.test(e)}a(o4,"isNonFastForwardError");function rae(r){let e=a(t=>t.split("/").filter(n=>n.length>0).length,"depth");return[...r].sort((t,n)=>e(n.localPath)-e(t.localPath))}a(rae,"orderChildrenFirst");function s4(r,e){let t=new Map(r.map(o=>[o.path,o])),n=new Set,i=[];for(let o of e){n.add(o.path);let c=t.get(o.path);(c===void 0||c.blobSha!==o.blobSha)&&i.push(o)}let s=r.filter(o=>!n.has(o.path));return{changed:i,deleted:s}}a(s4,"diffTrees");function nae(r){let e=r instanceof Error?r.message:String(r);return/→ HTTP (?:404|422)\b/.test(e)}a(nae,"isCommitUnknownError");function ka(r){return r instanceof Error?r.message:String(r)}a(ka,"errMsg");function iae(r,e,t){if(t.size===0)return r;let n=new Map(e.files.map(o=>[o.path,o])),i=new Set(r.map(o=>o.path)),s=[];for(let o of r){if(!t.has(o.path)){s.push(o);continue}let c=n.get(o.path);c!==void 0&&s.push(c)}for(let o of t){if(i.has(o))continue;let c=n.get(o);c!==void 0&&s.push(c)}return s}a(iae,"applyWatermarkPins");var ZR={mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:[],mergedCount:0,mergedPaths:[],warnings:[]};function eC(r){return new Map(r.map(e=>[e.path,e.blobSha]))}a(eC,"treeByPath");function cS(r){return[...r.quarantineEntries.map(e=>e.path),...r.resolvedQuarantineEntries.map(e=>e.path)]}a(cS,"quarantinedPathsOf");var tC=class{static{a(this,"SyncEngine")}constructor(e){this.activeTimer=null,this.activeLocalIoProgress=null,this.opInProgress=!1,this.deps=e,this.now=e.now??(()=>Date.now()),this.rateLimitBudget=(0,t4.createRateLimitBudget)(e.backoff?.maxTotalRateLimitWaitMs??Tn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS),this.transport=this.instrumentTransport((0,t4.withRateLimitBackoff)(e.transport,{...e.backoff,budget:this.rateLimitBudget,now:this.now})),this.sha1=this.instrumentSha1(e.sha1)}instrumentTransport(e){return async t=>{let n=this.activeTimer;return n===null?e(t):(n.bumpRest(),n.time((0,Z$.classifyRestPhase)(t),()=>e(t)))}}instrumentSha1(e){return t=>{let n=this.activeTimer;return n===null?e(t):(n.bumpHashed(),n.time("hash",()=>e(t)))}}instrumentLocalFiles(e){let t=a((c,l)=>{let u=this.activeTimer;return u===null?l():u.time(c,l)},"timed"),n={list:a(()=>t("localList",()=>e.list()),"list"),read:a(c=>(this.activeTimer?.bumpRead(),this.bumpReadProgress(),t("localRead",()=>e.read(c))),"read"),write:a((c,l)=>t("localWrite",()=>(this.activeTimer?.bumpWritten(),this.bumpWriteProgress(),e.write(c,l))),"write"),delete:a(c=>e.delete(c),"delete")},i=e.readBinary?.bind(e);i!==void 0&&(n.readBinary=c=>(this.activeTimer?.bumpRead(),this.bumpReadProgress(),t("localRead",()=>i(c))));let s=e.writeBinary?.bind(e);s!==void 0&&(n.writeBinary=(c,l)=>t("localWrite",()=>(this.activeTimer?.bumpWritten(),this.bumpWriteProgress(),s(c,l))));let o=e.stat?.bind(e);return o!==void 0&&(n.stat=c=>t("localList",()=>o(c))),n}busyResult(e){return{repoKey:e.repoKey,status:"busy",pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:[],deferredDeletes:[],detail:"another sync operation is in progress (D11 guard) \u2014 retry after it finishes"}}modeOps(e){let t=e.spaceKind==="file",n=t?Do.isFileSpaceSyncablePath:Do.isSyncablePath,i=this.deps.maxFileBytes??Do.DEFAULT_MAX_FILE_BYTES;return{fileMode:t,syncable:n,treeFilter:a(s=>n(s.path)&&(!t||s.size===void 0||s.size<=i),"treeFilter")}}async buildFileModeFirstSyncBase(e,t,n,i){let s=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),c=(await(0,dt.getTree)(this.transport,e.owner,e.repo,o.treeSha,this.deps.baseURL)).filter(n.treeFilter),l=[];for(let u of c){let f=t.get(u.path);f!==void 0&&await(0,iu.gitBlobSha)(f,this.sha1)===u.blobSha&&l.push({path:u.path,blobSha:u.blobSha})}return i.push(`first-sync (file mode): synthetic base from ${l.length} already-identical file(s) at head ${s} \u2014 divergence resolves through the remote-wins layer (D22)`),{lastSyncedSha:s,rootTreeSha:o.treeSha,files:l,spaceKind:"file"}}async syncAll(e,t="sync",n){if(this.opInProgress)return e.map(i=>this.busyResult(i));this.opInProgress=!0,this.rateLimitBudget.reset();try{let i=[];for(let s of e)i.push(await this.syncLocked(s,t,n));return i}finally{this.opInProgress=!1}}async sync(e,t="sync",n){if(this.opInProgress)return this.busyResult(e);this.opInProgress=!0,this.rateLimitBudget.reset();try{return await this.syncLocked(e,t,n)}finally{this.opInProgress=!1}}emitProgress(e,t,n,i){if(e!==void 0)try{e(i===void 0?{repoKey:t,phase:n}:{repoKey:t,phase:n,detail:i})}catch{}}bumpReadProgress(){let e=this.activeLocalIoProgress;e!==null&&(e.reads+=1,e.reads%Qoe===0&&this.emitProgress(e.emit,e.repoKey,"reading-local",{done:e.reads}))}bumpWriteProgress(){let e=this.activeLocalIoProgress;e!==null&&(e.writes+=1,e.writes%Joe===0&&this.emitProgress(e.emit,e.repoKey,"writing-files",{done:e.writes}))}async syncLocked(e,t="sync",n){let i=new Z$.SyncPhaseTimer(this.now),s=this.activeTimer;this.activeTimer=i;let o=this.activeLocalIoProgress;this.activeLocalIoProgress=n!==void 0?{emit:n,repoKey:e.repoKey,reads:0,writes:0}:null;let c=[],l=[],u=0,f=0,d=[],p=a((h,g={})=>({repoKey:e.repoKey,status:h,pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:c,deferredDeletes:l,...u>0?{outboxPushedCount:u}:{},...f>0?{outboxReconflictedCount:f}:{},timings:i.snapshot(),...g}),"result");try{let h=await this.deps.materializationCheck.check(e);if(!h.fullyMaterialized)return c.push(`skipped: repo not fully materialized${h.reason?` (${h.reason})`:""} \u2014 deletes NOT inferred (D19)`),p("skipped-not-materialized");let g=this.modeOps(e),m=this.instrumentLocalFiles(this.deps.localFilesFor(e));if(g.fileMode&&(m.readBinary===void 0||m.writeBinary===void 0))return p("error",{detail:"file-mode repo requires a LocalFilesPort with readBinary/writeBinary \u2014 refusing to sync through the text-only port (binary would corrupt)"});if(g.fileMode&&this.deps.quarantine===void 0)return p("error",{detail:"file-mode repo requires a quarantine sink (D18 remote-wins preserves losing local bytes there) \u2014 configure the quarantine repo before syncing FileSpaces"});let b=this.deps.maxFileBytes??Do.DEFAULT_MAX_FILE_BYTES;if(t!=="pull"&&this.deps.outbox!==void 0){let U=await this.flushOutbox(e,c);u=U.pushed,f=U.reconflicted}let _=await this.deps.watermarkStore.get(e.repoKey);if(_?.spaceKind==="file"&&!g.fileMode)return p("error",{detail:"watermark was written by a FILE-mode sync but the spec now resolves to asset mode \u2014 refusing (fix the conflicting Space declarations, or clear the watermark to restart)"});_!==null&&g.fileMode&&_.spaceKind!=="file"&&(c.push("watermark was written by an ASSET-mode sync \u2014 rebuilding the base through the file-mode first-sync layer (kind flip)"),_=null);let S=this.deps.localManifestStore!==void 0?m.stat?.bind(m):void 0,I=S!==void 0&&_!==null&&!g.fileMode,E=I&&this.deps.localManifestStore!==void 0?await this.deps.localManifestStore.get(e.repoKey):null,w=this.deps.localManifestFullRehashMs??Tn.DEFAULT_LOCAL_MANIFEST_REHASH_MS,R=I&&(E===null||this.now()-E.lastFullRehashMs>=w),x=new Map,O=new Set,N=new Map,G=new Map,j=new Map,ae=!1,Y=new Map;if(I&&_!==null)for(let U of _.files)Y.set(U.path,U.blobSha);for(let U of(await m.list()).filter(g.syncable)){if(g.fileMode){let le=await n4(m,U);if(le.byteLength>b){O.add(U),c.push(`skipped oversized file ${U} (${le.byteLength} bytes > ${b} cap) \u2014 excluded from sync symmetrically (Phase C size cap)`);continue}x.set(U,le);continue}if(!I||S===void 0){x.set(U,await m.read(U));continue}let F=await S(U),H=!R&&F!==null?E?.files[U]:void 0;if(F!==null&&H!==void 0&&H.mtimeMs===F.mtimeMs&&H.size===F.size&&H.blobSha===Y.get(U)){N.set(U,{blobSha:H.blobSha,...H.uid!==void 0?{uid:H.uid}:{}}),G.set(U,H.blobSha),j.set(U,F);continue}ae=!0,x.set(U,await m.read(U)),F!==null&&j.set(U,F)}let M=!1;if(_===null)if(g.fileMode)M=!0,_=await this.buildFileModeFirstSyncBase(e,x,g,c);else{let U=await this.bootstrapWatermark(e,x,c,p);if(U.kind==="settled")return U.outcome;M=!0,_=U.base}let ce=_;g.fileMode&&O.size>0&&(_={..._,files:_.files.filter(U=>!O.has(U.path))});let q,oe;I&&!R?(q=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),oe=q===_.lastSyncedSha?_.rootTreeSha:await this.resolveBaseTreeSha(e,_,{headReachable:!0})):oe=await this.resolveBaseTreeSha(e,_),this.emitProgress(n,e.repoKey,"detecting");let X=await(0,Fo.detectChanges)({localFiles:x,...I?{cachedEntries:N}:{},watermark:_,actualBaseTreeSha:oe,sha1:this.sha1});if(X.kind==="full-conflict")return p("full-conflict",{detail:`${X.reason}${X.detail?`: ${X.detail}`:""} \u2014 divergence must go through merge/quarantine (A2/A3), not overwrite`});if(c.push(...X.warnings),I&&this.deps.localManifestStore!==void 0){let U={};for(let[F,H]of x){let le=j.get(F),Se=X.diskBlobShas.get(F);if(le===void 0||Se===void 0)continue;let Ce=typeof H=="string"?(0,Fo.extractAssetUid)(H):void 0;U[F]={mtimeMs:le.mtimeMs,size:le.size,blobSha:Se,...Ce!==void 0?{uid:Ce}:{}}}for(let[F,H]of N){let le=j.get(F);le!==void 0&&(U[F]={mtimeMs:le.mtimeMs,size:le.size,blobSha:H.blobSha,...H.uid!==void 0?{uid:H.uid}:{}})}if(E!==null&&Object.keys(E.files).some(F=>!(F in U))&&(ae=!0),ae||R||E===null){let F={version:1,files:U,lastFullRehashMs:R||E===null?this.now():E.lastFullRehashMs};await this.deps.localManifestStore.set(e.repoKey,F)}}let J=this.pinLocalChanges(X,x,c,l,t);d=[...J.pushDeletionsAll.keys()];let ye=await this.runPushLoop(e,_,J,x,c,g,M,O,t,n,q);if(d=[],ye.kind!=="done"&&J.pushDeletionsAll.size>0&&l.push(...J.pushDeletionsAll.keys()),ye.kind==="conflict")return p("conflict",{detail:ye.detail});if(ye.kind==="retry-exhausted"){c.push(...ye.merge.warnings);let U=await this.buildTerminalQuarantineEntries(e,_,ye.pushFiles,ye.merge.quarantineEntries,x),F=[...ye.merge.quarantineEntries,...ye.merge.resolvedQuarantineEntries,...U];return await this.flushQuarantine(F,c),p("retry-exhausted",{detail:ye.detail,quarantinedCount:F.length,...F.length>0?{quarantinedPaths:F.map(H=>H.path)}:{}})}let{examinedHead:ze,pushedSha:Z,applyWrites:W,applyDeletes:ee,pushFiles:K}=ye,ie=ye.merge;c.push(...ie.warnings),c.push(...ye.deferredWarnings),l.push(...ye.withheldDeletions);let Pe=ye.deferredPaths.size>0?{deferredPaths:[...ye.deferredPaths]}:{},$=ye.pushedDeletions.length>0?{pushedDeletes:ye.pushedDeletions}:{},fe=await this.flushQuarantine([...ie.quarantineEntries,...ie.resolvedQuarantineEntries],c);ye.secretQuarantineEntries.length>0&&await this.flushQuarantine(ye.secretQuarantineEntries,c);let se=new Set;if(!fe&&ie.resolvedQuarantineEntries.length>0){for(let U of ie.resolvedQuarantineEntries)se.add(U.path);c.push(`quarantine flush failed \u2014 remote-wins apply withheld for ${se.size} path(s); local files untouched, conflict re-derives next sync (D18 durability gate)`)}if(Z===void 0&&ze===_.lastSyncedSha&&W.length===0&&ee.length===0&&ie.mergedWrites.length===0&&ie.quarantineEntries.length===0&&ie.resolvedQuarantineEntries.length===0&&(_.pinnedPaths?.length??0)===0&&ye.alreadyInHead.length===0&&ye.deferredPaths.size===0&&!M)return p("synced");let Ae=Z??ze,ge=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,Ae,this.deps.baseURL);if(Z!==void 0&&ge.parents[0]!==ze)return await this.checkRaceWindow(e,_,ze,ge.parents[0],K,new Set(ye.pushedDeletions),c,g),c.push(`race-window: watermark NOT advanced (pushed commit's parent ${ge.parents[0]} != examined head ${ze}) \u2014 next sync reconciles the concurrent change`),p("synced",{pushedSha:Z,pushedCount:K.size,mergedCount:ie.mergedCount,quarantinedCount:ie.quarantineEntries.length+ie.resolvedQuarantineEntries.length,...ie.mergedPaths.length>0?{mergedPaths:ie.mergedPaths}:{},...cS(ie).length>0?{quarantinedPaths:cS(ie)}:{},...Pe,...$});let{pulledCount:ve,pinnedPaths:Re,pulledPaths:de}=await this.applyRemoteChanges(m,x,[...W,...ie.mergedWrites].filter(U=>!se.has(U.path)),ee.filter(U=>!se.has(U.path)),c,G);for(let U of ie.quarantineEntries)Re.add(U.path);for(let U of ye.deferredPaths)Re.add(U);for(let U of se)Re.add(U);if(g.fileMode){for(let U of O)Re.add(U);for(let U of ye.remoteOversized)Re.add(U)}return await this.advanceWatermark(e,Ae,ge.treeSha,x,[...W,...ie.mergedWrites,...ye.deferredRemoteChanges],ce,Re,X.diskBlobShas,g,O),await this.resolveClearedPins(e,ce,Re,c,new Set(ie.resolvedQuarantineEntries.map(U=>U.path))),p("synced",{pushedSha:Z,pulledCount:ve,pushedCount:K.size,mergedCount:ie.mergedCount,quarantinedCount:ie.quarantineEntries.length+ie.resolvedQuarantineEntries.length,...ie.mergedPaths.length>0?{mergedPaths:ie.mergedPaths}:{},...de.length>0?{pulledPaths:de}:{},...cS(ie).length>0?{quarantinedPaths:cS(ie)}:{},...Pe,...$})}catch(h){let g=this.deps.redact??(m=>m);if(d.length>0&&l.push(...d),(0,JR.isAuthError)(h))return p("auth-required",{detail:g(`authentication failed: ${ka(h)} \u2014 the PAT is expired, revoked or under-scoped; update it in the per-device secure storage (R8). Never treated as success.`)});if((0,JR.isRefNotFoundError)(h)){let m=g(`${e.owner}/${e.repo}@${e.branch} is not reachable: ${ka(h)} \u2014 ${JR.REF_NOT_FOUND_HINT}`);return c.push(`sync failed: ${m}`),p("error",{detail:m})}return c.push(`sync failed: ${g(ka(h))}`),p("error",{detail:g(ka(h))})}finally{this.activeTimer=s,this.activeLocalIoProgress=o}}async flushQuarantine(e,t){if(e.length===0)return!0;let n=this.deps.redact??(s=>s);for(let s of e)t.push(n(`quarantined ${s.path}: ${s.reason}`));let i=this.deps.quarantine;if(i===void 0)return!1;try{if(i.quarantineAll!==void 0)await i.quarantineAll(e);else for(let s of e)await i.quarantine(s);return!0}catch(s){let o=this.deps.redact??(c=>c);return t.push(`quarantine sink failed: ${o(ka(s))} \u2014 files untouched on disk; the conflict re-derives next sync (D17 degradation)`),!1}}async flushOutbox(e,t){let n=this.deps.outbox;if(n===void 0)return{pushed:0,reconflicted:0};let i=await n.listForRepo(e.repoKey);if(i.length===0)return{pushed:0,reconflicted:0};let s=this.deps.redact??(g=>g),o,c;try{({head:o,shaByPath:c}=await this.outboxHeadTreeShas(e))}catch(g){return t.push(`outbox flush deferred (${i.length} resolution(s) awaiting push): ${s(ka(g))}`),{pushed:0,reconflicted:0}}let l=0,u=[];for(let g of i){let m=c.get(g.path)??QR.OUTBOX_REMOTE_ABSENT,b=m===QR.OUTBOX_REMOTE_ABSENT&&g.baseRemoteSha!==QR.OUTBOX_REMOTE_ABSENT?[...c].filter(([_,S])=>_!==g.path&&S===g.baseRemoteSha).map(([_])=>_):[];if(m!==g.baseRemoteSha&&b.length===0){await n.remove(g.repoKey,g.path),l++,t.push(s(`outbox: remote moved for ${g.path} since you resolved it \u2014 NOT pushed; resolve again (your choice is preserved on disk)`));continue}u.push({entry:g,stalePaths:b})}if(u.length===0)return{pushed:0,reconflicted:l};let f=new Map;for(let{entry:g}of u)f.set(g.path,g.chosenContent);let d=new Set;for(let{stalePaths:g}of u)for(let m of g)f.has(m)||d.add(m);let p=[...d];try{await(0,J$.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:f,...p.length>0?{deletions:p}:{},message:p.length>0?`chore(exosync): resolve ${u.length} keep-local conflict(s) (consolidate ${p.length} stale remote path(s))`:`chore(exosync): push ${u.length} resolved conflict(s)`,expectedHeadSha:o,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}})}catch(g){return t.push(`outbox: batch push deferred for ${u.length} resolution(s), will retry next sync: ${s(ka(g))}`),{pushed:0,reconflicted:l}}let h=0;for(let{entry:g,stalePaths:m}of u){let b=m.filter(_=>!f.has(_));await this.snapOutboxWatermark(e,g.path,g.chosenContent,b),await this.deps.quarantine?.markResolved?.(g.repoKey,g.path);for(let _ of b)await this.deps.quarantine?.markResolved?.(g.repoKey,_);await n.remove(g.repoKey,g.path),h++,b.length>0&&t.push(`consolidated cross-path conflict for ${g.path} \u2014 removed ${b.length} stale remote copy/copies (recoverable in git history)`)}return h>0&&t.push(`pushed ${h} resolved conflict(s)`),{pushed:h,reconflicted:l}}async outboxHeadTreeShas(e){let t=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),n=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t,this.deps.baseURL),i=await(0,dt.getTree)(this.transport,e.owner,e.repo,n.treeSha,this.deps.baseURL),s=new Map;for(let o of i)s.set(o.path,o.blobSha);return{head:t,shaByPath:s}}async snapOutboxWatermark(e,t,n,i=[]){let s=await this.deps.watermarkStore.get(e.repoKey);if(s===null)return;let o=new Set([t,...i]),c=(s.pinnedPaths??[]).filter(m=>!o.has(m)),l=await(0,iu.gitBlobSha)(n,this.sha1),u=(0,Fo.extractAssetUid)(n),f={path:t,blobSha:l,...u!==void 0?{uid:u}:{}},d=new Set(i),p=s.files.filter(m=>!d.has(m.path)),h=p.findIndex(m=>m.path===t),g=h>=0?p.map((m,b)=>b===h?f:m):[...p,f];await this.deps.watermarkStore.set(e.repoKey,{...s,files:g,...c.length>0?{pinnedPaths:c}:{pinnedPaths:void 0}})}async buildTerminalQuarantineEntries(e,t,n,i,s){let o=new Set(i.map(u=>u.path)),c=new Map;try{let u=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=(await(0,dt.getTree)(this.transport,e.owner,e.repo,(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(d=>n.has(d.path));for(let d of f)c.set(d.path,await(0,dt.getBlobText)(this.transport,e.owner,e.repo,d.blobSha,this.deps.baseURL))}catch{}let l=[];for(let[u,f]of n){if(o.has(u))continue;let d=s.get(u),p=d??f,h=d!==void 0&&!(0,Do.contentEquals)(d,f),g=typeof p=="string"?(0,Fo.extractAssetUid)(p):void 0,m=c.get(u);l.push({repoKey:e.repoKey,path:u,...g!==void 0?{uid:g}:{},reason:`non-fast-forward push failed after ${this.deps.maxPushRetries??Tn.DEFAULT_MAX_PUSH_RETRIES} retries (D16) \u2014 a concurrent writer keeps moving ${e.branch}; base recoverable from git history at ${t.lastSyncedSha}${h?"; the contended push payload was a merged proposal (never applied to disk) \u2014 the merge re-derives next sync":""}`,...typeof p=="string"?{localContent:p}:{localContentBytes:p},...m!==void 0?{remoteContent:m}:{}})}return l}async resolveClearedPins(e,t,n,i,s=new Set){let o=this.deps.quarantine;if(o===void 0||o.markResolved===void 0)return;let c=(t.pinnedPaths??[]).filter(l=>!n.has(l)&&!s.has(l));for(let l of c)try{await o.markResolved?.(e.repoKey,l)}catch(u){let f=this.deps.redact??(d=>d);i.push(`quarantine markResolved failed for ${l}: ${f(ka(u))} \u2014 unresolved-count may overcount until the resolver UI reconciles (CQ4)`)}}async resolveBaseTreeSha(e,t,n={}){try{return(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t.lastSyncedSha,this.deps.baseURL)).treeSha}catch(i){if(!nae(i))throw i;return n.headReachable===!0||await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),null}}pinLocalChanges(e,t,n,i,s){let o=e.modified.filter(p=>p.basePath!==void 0),c=[...e.added,...e.modified.filter(p=>p.basePath===void 0)],l=new Map;if(s==="pull"){for(let p of o)p.basePath!==void 0&&i.push(p.basePath),n.push(`pull-only: rename (uid ${p.uid??"?"}) ${p.basePath} \u2192 ${p.path} not pushed \u2014 propagates on the next push/Sync (#3473)`);for(let p of e.deleted)i.push(p.path),n.push(`pull-only: delete of ${p.path} not pushed \u2014 propagates on the next push/Sync (#3473)`)}else{for(let p of o)p.basePath!==void 0&&l.set(p.basePath,p.path);for(let p of e.deleted)l.set(p.path,p.path)}let u=[...c,...o,...e.deleted.map(p=>({...p}))],f=new Set(e.deleted.map(p=>p.path)),d=new Map;for(let p of[...c,...s==="pull"?[]:o]){let h=t.get(p.path);h!==void 0&&d.set(p.path,h)}return{localChanges:u,localDeletedPaths:f,pushFilesAll:d,pushDeletionsAll:l,dupUids:e.duplicateUids}}async runPushLoop(e,t,n,i,s,o,c=!1,l=new Set,u="sync",f,d){let{localChanges:p,localDeletedPaths:h,pushFilesAll:g,pushDeletionsAll:m,dupUids:b}=n,_=this.deps.maxPushRetries??Tn.DEFAULT_MAX_PUSH_RETRIES,S=0,I="",E,w=[],R=[],x=new Map,O=new Set,N=[],G=ZR,j=[],ae=new Set,Y=[],M=[],ce=new Set,q=[],oe=new Set;for(;;){I=S===0&&d!==void 0&&g.size===0&&m.size===0?d:await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),w=[],R=[],G=ZR,j=[],ae=new Set,Y=[],M=[];let X,J=new Set,ye=(t.pinnedPaths?.length??0)>0;if(I!==t.lastSyncedSha||ye||c){this.emitProgress(f,e.repoKey,"pulling-remote");let W=await this.collectRemoteChanges(e,t,I,o,l,s,ce,f);X=W.headTreeByPath;let ee=this.matchLocalVsRemote(p,h,i,W.changes,J,b,W.headTreeByPath);if(ee.conflicts.length>0){if(u==="sync"&&this.emitProgress(f,e.repoKey,"merging"),u!=="sync"){for(let K of ee.conflicts){ae.add(K.local.path),K.local.basePath!==void 0&&ae.add(K.local.basePath);for(let ie of K.remotes)ae.add(ie.path),ie.kind==="change"&&Y.push(ie)}M.push(`${u}-only: ${ee.conflicts.length} conflict(s) deferred to a full Sync (${ee.conflicts.map(K=>K.desc).join("; ")}) \u2014 paths pinned, nothing merged`)}else if(o.fileMode)G=this.resolveFileModeConflicts(e,ee.conflicts,i,ee.applyWrites,ee.applyDeletes);else{if(this.deps.mergeLayer===void 0)return{kind:"conflict",detail:`overlapping change on ${ee.conflicts[0].desc} \u2014 merge layer (A2/A3) required; nothing pushed, nothing written`};G=await this.resolveMergeConflicts(e,t,ee.conflicts,i)}if(u==="sync")for(let K of ee.conflicts)for(let ie of K.remotes)ie.path!==K.local.path&&(ae.add(ie.path),ie.kind==="change"&&Y.push(ie),M.push(`conflict group ${K.desc}: remote change at ${ie.path} NOT applied \u2014 pinned to re-derive on the next sync (#3477)`))}if(w=ee.applyWrites,R=ee.applyDeletes,u==="push"&&(w.length>0||R.length>0)){for(let K of w)ae.add(K.path),Y.push(K);for(let K of R)ae.add(K.path);M.push(`push-only: ${w.length+R.length} remote change(s) NOT applied \u2014 pinned to re-derive on the next pull/Sync`),w=[],R=[]}}x=u==="pull"?new Map:new Map([...[...g].filter(([W])=>!J.has(W)),...G.mergedFiles]),O=new Set,N=[];for(let[W,ee]of m){if(J.has(ee)){N.push(W);continue}x.has(W)||O.add(W)}if((x.size>0||O.size>0)&&X===void 0&&(X=eC(await(0,dt.getTree)(this.transport,e.owner,e.repo,t.rootTreeSha,this.deps.baseURL))),x.size>0&&X!==void 0){for(let[W,ee]of x){let K=X.get(W);K!==void 0&&K===await(0,iu.gitBlobSha)(ee,this.sha1)&&(x.delete(W),j.push(W))}j.length>0&&s.push(`phantom push skipped: ${j.length} file(s) already identical in remote HEAD (${j.join(", ")}) \u2014 excluded from the commit (#3475)`)}if(O.size>0&&X!==void 0){for(let W of[...O])X.has(W)||O.delete(W);x.size===0&&O.size>=X.size&&(N.push(...O),M.push(`deletion of ALL ${O.size} remaining file(s) deferred \u2014 GitHub cannot create an empty tree; the deletes re-derive and propagate once the repo has at least one surviving file`),O.clear())}if(x.size===0&&O.size===0)break;let ze=new Map;for(let[W,ee]of x)if(typeof ee=="string")ze.set(W,ee);else{let K=Zoe(ee);K!==null&&ze.set(W,K)}let Z=(0,e4.scanForSecrets)(ze);if(Z.length>0){let W=new Map;for(let ee of Z){let K=W.get(ee.path);K===void 0?W.set(ee.path,[ee.kind]):K.includes(ee.kind)||K.push(ee.kind)}for(let[ee,K]of W){if(!oe.has(ee)){oe.add(ee);let ie=ze.get(ee),Pe=ie!==void 0?(0,e4.redactSecrets)(ie):void 0,$=Pe!==void 0?(0,Fo.extractAssetUid)(Pe):void 0;q.push({repoKey:e.repoKey,path:ee,...$!==void 0?{uid:$}:{},reason:`secret-scan (R5): detected ${K.join(", ")} \u2014 skipped from the push (the secret is NEVER shipped); a redacted copy is quarantined. REVOKE the credential, then re-sync once it is removed.`,...Pe!==void 0?{localContent:Pe}:{}})}x.delete(ee)}s.push(`secret-scan (R5): skipped ${W.size} file(s) with a detected secret from the push \u2014 the rest of the changeset shipped; REVOKE the credential(s): ${[...W].map(([ee,K])=>`${ee} (${K.join(", ")})`).join(", ")}`);for(let[ee,K]of m)oe.has(K)&&O.has(ee)&&(O.delete(ee),N.push(ee));if(x.size===0&&O.size===0)break}try{E=await(0,J$.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([...x].map(([W,ee])=>[W,eae(ee)])),deletions:[...O],message:this.deps.commitMessage?.(e,x.size,O.size)??`chore(exosync): sync ${x.size} file(s)${O.size>0?`, ${O.size} deletion(s)`:""}`,baseURL:this.deps.baseURL,redact:this.deps.redact});break}catch(W){if(!o4(W))throw W;if(S++,S>_)return{kind:"retry-exhausted",detail:`non-fast-forward push failed after ${_} retries (D16 cap) \u2014 contended files routed to quarantine (D17)`,pushFiles:x,merge:G};s.push(`non-fast-forward push (attempt ${S}/${_}) \u2014 re-pulling and retrying (D16)`)}}return{kind:"done",examinedHead:I,pushedSha:E,applyWrites:w,applyDeletes:R,pushFiles:x,pushedDeletions:E!==void 0?[...O]:[],withheldDeletions:N,merge:G,remoteOversized:ce,alreadyInHead:j,deferredPaths:ae,deferredRemoteChanges:Y,deferredWarnings:M,secretQuarantineEntries:q}}async resolveMergeConflicts(e,t,n,i){let s=this.deps.mergeLayer;if(s===void 0)return ZR;let o=new Map(t.files.map(m=>[m.path,m])),c=new Map,l=[],u=[],f=[],d=[],p=0,h=a(m=>typeof m=="string"?m:void 0,"asText"),g=a((m,b,_)=>{let S=h(i.get(m.local.path)),I=h(m.remotes[0]?.content);return{repoKey:e.repoKey,path:m.local.path,...m.local.uid!==void 0?{uid:m.local.uid}:{},reason:b,..._!==void 0?{baseContent:_}:{},...S!==void 0?{localContent:S}:{},...I!==void 0?{remoteContent:I}:{}}},"entry");for(let m of n){let b=o.get(m.local.basePath??m.local.path)??o.get(m.remotes[0]?.path??""),_;if(b!==void 0&&(_=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,b.blobSha,this.deps.baseURL)),m.remotes.length>1){u.push(g(m,`ambiguous conflict: local change overlaps ${m.remotes.length} remote changes (${m.remotes.map(R=>R.path).join(", ")})`,_));continue}let S=m.remotes[0],I=h(i.get(m.local.path)),E=await s.resolve({path:m.local.path,...m.local.uid!==void 0?{uid:m.local.uid}:{},..._!==void 0?{base:_}:{},...I!==void 0?{local:I}:{},...S.kind==="change"&&typeof S.content=="string"?{remote:S.content}:{}});if(E.action==="quarantine"){u.push(g(m,E.reason,_));continue}p++,d.push(m.local.path);for(let R of E.warnings??[])f.push(`merge(${m.local.path}): ${R}`);let w=S.kind==="change"?S.content:void 0;if(E.content!==w&&c.set(m.local.path,E.content),E.content!==i.get(m.local.path)){let R=(0,Fo.extractAssetUid)(E.content)??m.local.uid;l.push({path:m.local.path,kind:"change",content:E.content,blobSha:await(0,iu.gitBlobSha)(E.content,this.sha1),...R!==void 0?{uid:R}:{}})}}return{mergedFiles:c,mergedWrites:l,quarantineEntries:u,resolvedQuarantineEntries:[],mergedCount:p,mergedPaths:d,warnings:f}}resolveFileModeConflicts(e,t,n,i,s){let o=[],c=[];for(let l of t){l.remotes.length>1&&c.push(`file-mode conflict on ${l.local.path} unexpectedly overlaps ${l.remotes.length} remote changes \u2014 resolving against the first`);let u=l.remotes[0],f=n.get(l.local.path);u.kind==="change"?i.push(u):s.push(u),!(l.localIsDelete||f===void 0)&&o.push({repoKey:e.repoKey,path:l.local.path,reason:`file-mode remote-wins (D18): remote ${u.kind==="change"?`version ${u.blobSha}`:"delete"} wins; this is the losing LOCAL version, preserved byte-exact`,...typeof f=="string"?{localContent:f}:{localContentBytes:f}})}return{mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:o,mergedCount:0,mergedPaths:[],warnings:c}}async applyRemoteChanges(e,t,n,i,s,o=new Map){let c=0,l=new Set,u=[],f=a(async(h,g)=>{try{return g?await n4(e,h):await e.read(h)}catch{return}},"tryRead"),d=a(async(h,g)=>{typeof g=="string"?await e.write(h,g):await tae(e,h,g)},"writeContent"),p=a(async h=>{let g=await f(h,!1);return g===void 0?!0:await(0,iu.gitBlobSha)(g,this.sha1)===o.get(h)},"cacheHitUnchanged");for(let h of n){if(h.content===void 0)continue;if(!i4(h.path)){s.push(`unsafe remote path skipped on pull-apply: ${h.path}`),l.add(h.path);continue}let g=t.get(h.path);if(g===void 0&&o.has(h.path)){if(!await p(h.path)){s.push(`pull-apply skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),l.add(h.path);continue}await d(h.path,h.content),c++,u.push(h.path);continue}let m=await f(h.path,typeof(g??h.content)!="string");if(!(0,Do.contentEquals)(m,g)){s.push(`pull-apply skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),l.add(h.path);continue}await d(h.path,h.content),c++,u.push(h.path)}for(let h of i){if(!i4(h.path)){s.push(`unsafe remote path skipped on pull-delete: ${h.path}`),l.add(h.path);continue}let g=t.get(h.path);if(g===void 0&&o.has(h.path)){if(!await p(h.path)){s.push(`pull-delete skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),l.add(h.path);continue}await e.delete(h.path),c++,u.push(h.path);continue}if(g!==void 0){let m=await f(h.path,typeof g!="string");if(m!==void 0&&!(0,Do.contentEquals)(m,g)){s.push(`pull-delete skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),l.add(h.path);continue}await e.delete(h.path),c++,u.push(h.path)}}return{pulledCount:c,pinnedPaths:l,pulledPaths:u}}async advanceWatermark(e,t,n,i,s,o,c,l,u,f=new Set){let d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,n,this.deps.baseURL)).filter(h=>u.treeFilter(h)&&!f.has(h.path)),p=iae(await this.buildWatermarkFiles(e,d,i,s,o,l,u),o,c);await this.deps.watermarkStore.set(e.repoKey,{lastSyncedSha:t,rootTreeSha:n,files:p,...c.size>0?{pinnedPaths:[...c]}:{},...u.fileMode?{spaceKind:"file"}:{}})}async tryMountBaseBootstrap(e,t,n,i,s){let o=this.deps.mountBaseStore,c=null;if(o!==void 0)try{c=await o.get(e.repoKey)}catch{return null}let l=!1;if(c===null&&this.deps.localBaseShaProvider!==void 0)try{let b=await this.deps.localBaseShaProvider(e);typeof b=="string"&&b.length>0&&(c=b,l=!0)}catch{}if(c===null||t.startsWith(c))return null;let u=300,f=null;try{let b=t;for(let _=0;_<u;_++){let S=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,b,this.deps.baseURL);if(S.sha===c||S.sha.startsWith(c)){f=S;break}if(S.parents.length===0)break;b=S.parents[0]}}catch{return null}if(f===null)return null;let d;try{d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL)).filter(b=>(0,Do.isSyncablePath)(b.path))}catch{return null}let p;try{let b=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t,this.deps.baseURL);p=eC((await(0,dt.getTree)(this.transport,e.owner,e.repo,b.treeSha,this.deps.baseURL)).filter(_=>(0,Do.isSyncablePath)(_.path)))}catch{return null}let h=d.filter(b=>!n.has(b.path)&&p.get(b.path)===b.blobSha);if(h.length>0){let b=h.slice(0,3).map(_=>_.path).join(", ")+(h.length>3?", \u2026":"");return i.push(`first-sync (asset mode): base-tree\u2286working-tree sanity guard fired \u2014 ${h.length} base file(s) absent from the working tree but UNCHANGED on remote head (${b}); the verified-ancestor base may not match the working tree's derivation commit (out-of-band submodule manipulation) \u2192 routing to merge/quarantine instead of inferring a silent deletion (#3610)`),{kind:"settled",outcome:s("full-conflict",{detail:`first-sync: base-tree\u2286working-tree sanity guard \u2014 ${h.length} base file(s) absent from the working tree are unchanged on remote head (${b}); refusing to infer a silent deletion from a base that may not match the derivation commit \u2014 divergence must go through merge/quarantine (A2/A3), never a silent delete (#3610)`})}}let g=d.map(b=>({path:b.path,blobSha:b.blobSha})),m={lastSyncedSha:f.sha,rootTreeSha:f.treeSha,files:g};if(l&&o!==void 0)try{await o.set(e.repoKey,f.sha)}catch{}return i.push(l?`first-sync (asset mode): BACKFILLED the 3-way base from the locally checked-out commit ${f.sha} (no recorded mount base) \u2014 remote head ${t} advanced since; local edits 3-way merge against it instead of false-conflicting (#3590)`:`first-sync (asset mode): reconciling against the recorded mount base ${f.sha} \u2014 remote head ${t} advanced since mount; local edits 3-way merge against it instead of false-conflicting (#3590)`),{kind:"additive-base",base:m}}async bootstrapWatermark(e,t,n,i){let s=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await this.tryMountBaseBootstrap(e,s,t,n,i);if(o!==null)return o;let c=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),l=(await(0,dt.getTree)(this.transport,e.owner,e.repo,c.treeSha,this.deps.baseURL)).filter(p=>(0,Do.isSyncablePath)(p.path)),u=[],f;for(let p of l){let h=t.get(p.path);if(h===void 0||await(0,iu.gitBlobSha)(h,this.sha1)!==p.blobSha){f===void 0&&(f=p.path);continue}let g=typeof h=="string"?(0,Fo.extractAssetUid)(h):void 0;u.push({path:p.path,blobSha:p.blobSha,...g?{uid:g}:{}})}let d={lastSyncedSha:s,rootTreeSha:c.treeSha,files:u};return f!==void 0?this.deps.mergeLayer===void 0?{kind:"settled",outcome:i("full-conflict",{detail:`first-sync: no watermark and local content diverges from remote head at ${f} \u2014 A2/A3 scope`})}:(n.push(`first-sync (asset mode): no 3-way merge base and local diverges from remote head (first at ${f}) \u2014 reconciling ZERO-LOSS against ${u.length} byte-identical file(s) as a synthetic base: remote-only files pull, local-only files push, overlapping divergences route to the merge/quarantine layer (both versions preserved), never a silent overwrite or delete`),{kind:"additive-base",base:d}):t.size===l.length?(await this.deps.watermarkStore.set(e.repoKey,d),n.push(`watermark bootstrapped from head ${s} (local tree identical to remote)`),{kind:"settled",outcome:i("synced")}):(n.push(`first-sync (asset mode): local tree (${t.size} files) is a pure superset of remote head ${s} (${l.length} files) \u2014 ${t.size-l.length} local-only addition(s) derive as pushable adds (#3565)`),{kind:"additive-base",base:d})}async collectRemoteChanges(e,t,n,i,s=new Set,o=[],c=new Set,l){let u=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,n,this.deps.baseURL),f=await(0,dt.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL);if(i.fileMode)for(let O of f)i.syncable(O.path)&&!i.treeFilter(O)&&!c.has(O.path)&&(c.add(O.path),o.push(`skipped oversized REMOTE file ${O.path} (${O.size??"?"} bytes over cap) \u2014 excluded from sync symmetrically (Phase C size cap)`));let d=f.filter(O=>i.treeFilter(O)&&!s.has(O.path)),p=t.files.filter(O=>!c.has(O.path)&&!s.has(O.path)),{changed:h,deleted:g}=s4(p,d),m=h.length;m>=r4&&this.emitProgress(l,e.repoKey,"fetching-blobs",{done:0,total:m});let b=new Array(h.length),_=0,S=0,I,E=a(async O=>{if(i.fileMode){let G=await(0,dt.getBlobBytes)(this.transport,e.owner,e.repo,O.blobSha,this.deps.baseURL);return{path:O.path,kind:"change",blobSha:O.blobSha,content:G}}let N=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,O.blobSha,this.deps.baseURL);return{path:O.path,kind:"change",blobSha:O.blobSha,content:N,uid:(0,Fo.extractAssetUid)(N)}},"fetchOne"),w=a(async()=>{for(;;){if(I!==void 0)return;let O=_++;if(O>=h.length)return;try{b[O]=await E(h[O])}catch(N){I===void 0&&(I=N);return}S+=1,m>=r4&&S%Yoe===0&&S<m&&this.emitProgress(l,e.repoKey,"fetching-blobs",{done:S,total:m})}},"worker"),R=Math.min(Xoe,h.length);if(await Promise.all(Array.from({length:R},()=>w())),I!==void 0)throw I instanceof Error?I:new Error(String(I));let x=b;for(let O of g)x.push({path:O.path,kind:"delete",uid:O.uid});return{changes:x,headTreeByPath:eC(f)}}matchLocalVsRemote(e,t,n,i,s,o=new Set,c){let l=new Set,u=[],f=new Map;for(let m of i)m.kind==="change"&&m.uid!==void 0&&f.set(m.uid,(f.get(m.uid)??0)+1);let d=new Set(o);for(let[m,b]of f)b>1&&d.add(m);let p=new Map,h=new Map;for(let m of i){if(m.uid!==void 0&&!d.has(m.uid)){let b=p.get(m.uid)??[];b.push(m),p.set(m.uid,b)}h.set(m.path,m)}for(let m of e){let b=new Set;if(m.uid!==void 0&&!d.has(m.uid))for(let E of p.get(m.uid)??[])E.kind==="change"&&E.path!==m.path&&(c?.has(m.path)===!0||m.basePath!==void 0&&c?.has(m.basePath)===!0)||b.add(E);let _=h.get(m.path);if(_!==void 0&&b.add(_),m.basePath!==void 0){let E=h.get(m.basePath);E!==void 0&&b.add(E)}let S=[],I=!1;for(let E of b){if(I=t.has(m.path)&&!n.has(m.path),I&&E.kind==="delete"){l.add(E);continue}if(!I&&E.kind==="change"&&E.path===m.path&&E.blobSha===m.blobSha){l.add(E),s.add(m.path);continue}if(E.kind==="delete"&&m.basePath!==void 0&&E.path===m.basePath){let w=h.get(m.path);if(w!==void 0&&w.kind==="change"&&(w.blobSha===m.blobSha||w.uid!==void 0&&w.uid===m.uid)){l.add(E);continue}}if(E.kind==="delete"&&E.path!==m.path&&E.path!==m.basePath&&!n.has(E.path)&&c?.has(E.path)!==!0){l.add(E);continue}S.push(E),l.add(E)}S.length>0&&(u.push({local:m,localIsDelete:I,remotes:S,desc:`${m.uid!==void 0&&!d.has(m.uid)?m.uid:m.path} (local ${I?"delete":"change"} vs remote ${S[0].kind} at ${S[0].path})`}),s.add(m.path))}let g=i.filter(m=>!l.has(m));return{conflicts:u,applyWrites:g.filter(m=>m.kind==="change"),applyDeletes:g.filter(m=>m.kind==="delete")}}async checkRaceWindow(e,t,n,i,s,o,c,l){try{let u=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,i,this.deps.baseURL),f=(await(0,dt.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL)).filter(l.treeFilter),d=n===t.lastSyncedSha?t.files:(await(0,dt.getTree)(this.transport,e.owner,e.repo,(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,n,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(l.treeFilter),{changed:p,deleted:h}=s4(d,f);for(let g of p)s.has(g.path)&&c.push(`race-window: concurrent commit ${i} changed ${g.path} between conflict check (head ${n}) and push \u2014 local version won; previous version recoverable from git history`),o.has(g.path)&&c.push(`race-window: concurrent commit ${i} changed ${g.path} which this push DELETED \u2014 the delete won; the concurrent version is recoverable from git history`);for(let g of h)s.has(g.path)&&c.push(`race-window: concurrent commit ${i} deleted ${g.path}; push re-created it`)}catch(u){let f=this.deps.redact??(d=>d);c.push(`race-window check failed: ${f(ka(u))}`)}}async buildWatermarkFiles(e,t,n,i,s,o,c){if(c.fileMode)return t.map(f=>({path:f.path,blobSha:f.blobSha}));let l=new Map;for(let f of i)f.kind==="change"&&f.blobSha!==void 0&&l.set(f.blobSha,f.uid);for(let[f,d]of n){let p=o?.get(f)??await(0,iu.gitBlobSha)(d,this.sha1);l.set(p,typeof d=="string"?(0,Fo.extractAssetUid)(d):void 0)}for(let f of s.files)l.has(f.blobSha)||l.set(f.blobSha,f.uid);let u=[];for(let f of t){let d;if(l.has(f.blobSha))d=l.get(f.blobSha);else{let p=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,f.blobSha,this.deps.baseURL);d=(0,Fo.extractAssetUid)(p)}u.push({path:f.path,blobSha:f.blobSha,...d?{uid:d}:{}})}return u}};Tn.SyncEngine=tC});var l4=T(sm=>{"use strict";Object.defineProperty(sm,"__esModule",{value:!0});sm.QuarantineResolver=void 0;sm.backupPathFor=c4;var sae=J_(),lS=hd(),nm=pd(),im=Zh(),oae=rS(),Lo="\0absent",rC=class{static{a(this,"QuarantineResolver")}constructor(e){this.deps=e}async listOpenConflicts(e){let t=[];for(let n of e)t.push(...await this.listRepoConflicts(n));return t}async listRepoConflicts(e){if(e.spaceKind==="file")return[];let t=await this.deps.watermarkStore.get(e.repoKey),n=t?.pinnedPaths??[];if(n.length===0)return[];if(this.deps.outbox!==void 0){let h=await this.deps.outbox.listForRepo(e.repoKey);if(h.length>0){let g=new Set(h.map(m=>m.path));if(n=n.filter(m=>!g.has(m)),n.length===0)return[]}}let i=new Map;for(let h of t?.files??[])i.set(h.path,h.blobSha);let s=this.deps.conflictCache!==void 0,o=await this.cachedRecordsFor(e,n),c=n.some(h=>!o.has(h)),l=new Map,u=!0;if(c)if(s)try{l=await this.remoteTreeShas(e)}catch{u=!1}else l=await this.remoteTreeShas(e);let f=this.deps.localFilesFor(e),d=new Set(await f.list()),p=[];for(let h of n){let g=o.get(h),m,b;if(g!==void 0)b=g.remoteContent!==void 0?await(0,nm.gitBlobSha)(g.remoteContent,this.deps.sha1):Lo,m=g.baseContent!==void 0?await(0,nm.gitBlobSha)(g.baseContent,this.deps.sha1):i.get(h)??Lo;else{if(!u)continue;b=l.get(h)??Lo,m=i.get(h)??Lo}let _=Lo,S;if(d.has(h)&&(S=await f.read(h),_=await(0,nm.gitBlobSha)(S,this.deps.sha1)),!(_!==b&&_!==m&&b!==m))continue;let E=(S!==void 0?(0,im.extractAssetUid)(S):void 0)??g?.uid;p.push({repoKey:e.repoKey,path:h,...E!==void 0?{uid:E}:{},hasLocal:_!==Lo,hasRemote:b!==Lo})}return p}async cachedRecordsFor(e,t){let n=new Map,i=this.deps.conflictCache;if(i===void 0)return n;for(let s of t){let o=await i.get(e.repoKey,s);o!==null&&n.set(s,o)}return n}async detectDuplicateUids(e){let t=new Map;for(let i of e){let s=this.deps.localFilesFor(i);for(let o of await s.list()){if(!o.endsWith(".md"))continue;let c;try{c=await s.read(o)}catch{continue}let l=(0,im.extractAssetUid)(c);l!==void 0&&t.set(l,(t.get(l)??0)+1)}}let n=0;for(let i of t.values())i>1&&n++;return n}async loadConflict(e,t){let n=this.deps.localFilesFor(e),s=new Set(await n.list()).has(t)?await n.read(t):void 0,o=await this.deps.conflictCache?.get(e.repoKey,t)??null,c,l;if(o!==null)c=o.remoteContent,l=o.baseContent;else{let d=(await this.remoteTreeShas(e)).get(t);c=d!==void 0?await this.blobText(e,d):void 0;let h=((await this.deps.watermarkStore.get(e.repoKey))?.files??[]).find(g=>g.path===t)?.blobSha;if(h!==void 0)try{l=await this.blobText(e,h)}catch{l=void 0}}let u=(s!==void 0?(0,im.extractAssetUid)(s):void 0)??(c!==void 0?(0,im.extractAssetUid)(c):void 0)??o?.uid;return{repoKey:e.repoKey,path:t,...u!==void 0?{uid:u}:{},hasLocal:s!==void 0,hasRemote:c!==void 0,...l!==void 0?{base:l}:{},...s!==void 0?{local:s}:{},...c!==void 0?{remote:c}:{}}}async resolve(e,t,n){let i=this.deps.localFilesFor(e),o=new Set(await i.list()).has(t)?await i.read(t):void 0,c=this.deps.outbox!==void 0,{remote:l,remoteSha:u}=c?await this.remoteForResolve(e,t):await this.liveRemoteForResolve(e,t),f=this.chosenContent(n,o,l),d;n.take!=="local"&&o!==void 0&&o!==f&&(d=c4(t),await i.write(d,o)),f===void 0?await i.delete(t):await i.write(t,f);let h=f===void 0&&l===void 0||f===l;if(c&&this.deps.outbox!==void 0&&!h&&f!==void 0)return await this.deps.outbox.enqueue({repoKey:e.repoKey,path:t,chosenContent:f,resolvedTo:n.take==="merged"?"merged":"local",baseRemoteSha:u===Lo?oae.OUTBOX_REMOTE_ABSENT:u,resolvedAt:""}),{repoKey:e.repoKey,path:t,resolvedTo:n.take,awaitingPush:!0,...d!==void 0?{discardedLocalBackupPath:d}:{}};let g;return h||(g=await this.commitChoice(e,t,f)),await this.snapWatermark(e,t,f),this.deps.quarantine?.markResolved!==void 0&&await this.deps.quarantine.markResolved(e.repoKey,t),{repoKey:e.repoKey,path:t,resolvedTo:n.take,...g!==void 0?{pushedSha:g}:{},...d!==void 0?{discardedLocalBackupPath:d}:{}}}async remoteForResolve(e,t){let n=await this.deps.conflictCache?.get(e.repoKey,t)??null;if(n!==null){let i=n.remoteContent,s=i!==void 0?await(0,nm.gitBlobSha)(i,this.deps.sha1):Lo;return{remote:i,remoteSha:s}}return this.liveRemoteForResolve(e,t)}async liveRemoteForResolve(e,t){let i=(await this.remoteTreeShas(e)).get(t);return{remote:i!==void 0?await this.blobText(e,i):void 0,remoteSha:i??Lo}}chosenContent(e,t,n){switch(e.take){case"local":if(t===void 0)throw new Error("resolve: cannot keep local \u2014 no local version exists on disk");return t;case"remote":return n;case"merged":return e.content}}async commitChoice(e,t,n){let i=this.deps.commitMessage?.(e,t)??`chore(exosync): resolve conflict for ${t}`;if(n===void 0)throw new Error(`resolve: cannot push an empty resolution for ${t}`);return(0,sae.restCreateCommit)(this.deps.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([[t,n]]),message:i,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}})}async snapWatermark(e,t,n){let i=await this.deps.watermarkStore.get(e.repoKey);if(i===null)return;let s=(i.pinnedPaths??[]).filter(c=>c!==t),o=i.files;if(n===void 0)o=o.filter(c=>c.path!==t);else{let c=await(0,nm.gitBlobSha)(n,this.deps.sha1),l=(0,im.extractAssetUid)(n),u={path:t,blobSha:c,...l!==void 0?{uid:l}:{}},f=o.findIndex(d=>d.path===t);o=f>=0?o.map((d,p)=>p===f?u:d):[...o,u]}await this.deps.watermarkStore.set(e.repoKey,{...i,files:o,...s.length>0?{pinnedPaths:s}:{pinnedPaths:void 0}})}async remoteTreeShas(e){let t=await(0,lS.getHeadSha)(this.deps.transport,e.owner,e.repo,e.branch,this.deps.baseURL),n=await(0,lS.getCommitInfo)(this.deps.transport,e.owner,e.repo,t,this.deps.baseURL),i=await(0,lS.getTree)(this.deps.transport,e.owner,e.repo,n.treeSha,this.deps.baseURL),s=new Map;for(let o of i)s.set(o.path,o.blobSha);return s}async blobText(e,t){return(0,lS.getBlobText)(this.deps.transport,e.owner,e.repo,t,this.deps.baseURL)}};sm.QuarantineResolver=rC;function c4(r){return`${r}.conflict.local.txt`}a(c4,"backupPathFor")});var u4=T(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.FileLocalManifestStore=gd.LOCAL_MANIFEST_STORE_FILENAME=void 0;gd.LOCAL_MANIFEST_STORE_FILENAME="exosync-localmanifest.local.json";function aae(r){if(r===null||typeof r!="object")return!1;let e=r;return e.version===1&&typeof e.lastFullRehashMs=="number"&&e.files!==null&&typeof e.files=="object"}a(aae,"isLocalManifestRecord");var nC=class{static{a(this,"FileLocalManifestStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let n=(await this.readRepos())[e];return aae(n)?n:null}async set(e,t){let n=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))});return this.writeChain=n.catch(()=>{}),n}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 n=t.repos;return n===null||typeof n!="object"?{}:{...n}}catch{return{}}}};gd.FileLocalManifestStore=nC});var oC=T(sC=>{"use strict";Object.defineProperty(sC,"__esModule",{value:!0});sC.diff3=cae;function f4(r,e){let t=r.length,n=e.length,i=Array.from({length:t+1},()=>new Int32Array(n+1));for(let l=t-1;l>=0;l--)for(let u=n-1;u>=0;u--)i[l][u]=r[l]===e[u]?i[l+1][u+1]+1:Math.max(i[l+1][u],i[l][u+1]);let s=new Map,o=0,c=0;for(;o<t&&c<n;)r[o]===e[c]?(s.set(o,c),o++,c++):i[o+1][c]>=i[o][c+1]?o++:c++;return s}a(f4,"lcsMatch");function iC(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}a(iC,"sliceEq");function cae(r,e,t){let n=f4(r,e),i=f4(r,t),s=[],o=0,c=0,l=0;for(;;){let u=o;for(;u<r.length&&!(n.has(u)&&i.has(u));)u++;let f=u<r.length?n.get(u):e.length,d=u<r.length?i.get(u):t.length,p=r.slice(o,u),h=e.slice(c,f),g=t.slice(l,d),m=!iC(h,p),b=!iC(g,p);if(!m&&!b)s.push(...p);else if(!m)s.push(...g);else if(!b)s.push(...h);else if(iC(h,g))s.push(...h);else return{ok:!1,conflict:{base:p,local:h,remote:g}};if(u>=r.length)break;s.push(r[u]),o=u+1,c=f+1,l=d+1}return{ok:!0,merged:s}}a(cae,"diff3")});var p4=T(cm=>{"use strict";Object.defineProperty(cm,"__esModule",{value:!0});cm.StructuredMerger=void 0;cm.splitSections=uS;var d4=oC(),lae=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,om="exo__Instance_class";function am(r){if(r===null||typeof r!="object")return!0;if(Array.isArray(r))return r.every(am);let e=Object.getPrototypeOf(r);return e!==Object.prototype&&e!==null?!1:Object.values(r).every(am)}a(am,"isPlainValue");function Pc(r,e){if(r===e)return!0;if(r===null||e===null||r===void 0||e===void 0||typeof r!="object"||typeof e!="object"||Array.isArray(r)!==Array.isArray(e))return!1;if(Array.isArray(r)&&Array.isArray(e))return r.length!==e.length?!1:r.every((s,o)=>Pc(s,e[o]));let t=r,n=e,i=Object.keys(t);return i.length!==Object.keys(n).length?!1:i.every(s=>Pc(t[s],n[s]))}a(Pc,"deepEqual");function su(r){return typeof r=="string"?`s:${r}`:`j:${JSON.stringify(r)}`}a(su,"setKey");function cs(r){return r==null?[]:Array.isArray(r)?r:[r]}a(cs,"toElements");function uae(r,e,t){let n=new Set(cs(r).map(su)),i=cs(e),s=cs(t),o=new Set(i.map(su)),c=new Set(s.map(su)),l=a(d=>o.has(d)&&c.has(d)||o.has(d)&&!n.has(d)||c.has(d)&&!n.has(d),"keep"),u=[],f=new Set;for(let d of[...i,...s]){let p=su(d);f.has(p)||!l(p)||(f.add(p),u.push(d))}return u}a(uae,"mergeSet");function fae(r,e,t){let n=[],i=[],s=new Set;for(let c of[...Object.keys(r),...Object.keys(e),...Object.keys(t)])s.has(c)||(s.add(c),i.push(c));let o={};for(let c of i){let l=r[c],u=e[c],f=t[c];if(!am(l)||!am(u)||!am(f))return{ok:!1,reason:`frontmatter key "${c}" contains a non-plain value (Date?) \u2014 the codec must round-trip scalars as strings (CORE_SCHEMA contract)`};if(Array.isArray(l)||Array.isArray(u)||Array.isArray(f)){if(!(c in e)&&!(c in t))continue;let d=uae(l,u,f),p=new Set(cs(l).map(su)),h=cs(u).some(m=>!p.has(su(m))),g=cs(f).some(m=>!p.has(su(m)));h&&g&&!Pc(cs(u),cs(f))&&n.push(`both sides added values to multi-valued key "${c}" \u2014 union kept (D20)`),d.length>0&&(o[c]=d);continue}if(Pc(u,f)){u!==void 0&&(o[c]=u);continue}if(Pc(u,l)){f!==void 0&&(o[c]=f);continue}if(Pc(f,l)){u!==void 0&&(o[c]=u);continue}return{ok:!1,reason:`frontmatter key "${c}" changed differently on both sides`}}return{ok:!0,value:o,warnings:n}}a(fae,"mergeFrontmatter");var dae=/^(```|~~~)/,pae=/^#{1,6}\s/;function uS(r){let e=r.split(`
337
337
  `),t=[],n=null,i="",s=!1,o=a(()=>{n!==null&&t.push({heading:i,text:n.join(`
338
338
  `)})},"flush");for(let c of e){if(dae.test(c.trimStart())&&(s=!s),!s&&pae.test(c)){o(),n=[c],i=c.trim();continue}n===null&&(n=[],i=""),n.push(c)}return o(),t}a(uS,"splitSections");function aC(r){return r.split(/\n{2,}/)}a(aC,"splitParagraphs");function hae(r){return r.join(`
339
339
 
340
- `)}a(hae,"joinParagraphs");function cC(r){let e=new Map,t=new Map,n=[];for(let i of r){let s=e.get(i.heading)??0;e.set(i.heading,s+1);let o=`${i.heading}\0${s}`;t.set(o,i),n.push(o)}return{keyed:t,order:n}}a(cC,"keySections");function lC(r){let e=new Map;for(let t of r)e.set(t.heading,(e.get(t.heading)??0)+1);return e}a(lC,"headingCounts");function mae(r,e,t){if(e===t)return{ok:!0,body:e,warnings:[]};if(e===r)return{ok:!0,body:t,warnings:[]};if(t===r)return{ok:!0,body:e,warnings:[]};let n=[],i=uS(r),s=uS(e),o=uS(t),c=lC(i),l=lC(s),u=lC(o),f=new Set([...c.keys(),...l.keys(),...u.keys()]);for(let M of f){let ce=[c.get(M)??0,l.get(M)??0,u.get(M)??0];if(Math.max(...ce)>1&&new Set(ce).size>1)return{ok:!1,reason:`duplicate heading "${M||"(preamble)"}" count differs across versions \u2014 occurrence pairing unstable`}}let d=cC(i),p=cC(s),h=cC(o),g=new Map,m=[],b=new Set;for(let M of[...d.order,...p.order,...h.order])b.has(M)||(b.add(M),m.push(M));for(let M of m){let ce=M.slice(0,M.lastIndexOf("\0")),W=d.keyed.get(M)?.text,oe=p.keyed.get(M)?.text,X=h.keyed.get(M)?.text;if(oe===X){oe!==void 0&&g.set(M,oe);continue}if(oe===W){X!==void 0&&g.set(M,X);continue}if(X===W){oe!==void 0&&g.set(M,oe);continue}if(oe===void 0||X===void 0)return{ok:!1,reason:`section "${ce||"(preamble)"}": deleted on one side, modified on the other`};if(W===void 0)return{ok:!1,reason:`section "${ce||"(preamble)"}": added differently on both sides`};let J=(0,d4.diff3)(aC(W),aC(oe),aC(X));if(J.ok){g.set(M,hae(J.merged));continue}let ye=(0,d4.diff3)(W.split(`
340
+ `)}a(hae,"joinParagraphs");function cC(r){let e=new Map,t=new Map,n=[];for(let i of r){let s=e.get(i.heading)??0;e.set(i.heading,s+1);let o=`${i.heading}\0${s}`;t.set(o,i),n.push(o)}return{keyed:t,order:n}}a(cC,"keySections");function lC(r){let e=new Map;for(let t of r)e.set(t.heading,(e.get(t.heading)??0)+1);return e}a(lC,"headingCounts");function mae(r,e,t){if(e===t)return{ok:!0,body:e,warnings:[]};if(e===r)return{ok:!0,body:t,warnings:[]};if(t===r)return{ok:!0,body:e,warnings:[]};let n=[],i=uS(r),s=uS(e),o=uS(t),c=lC(i),l=lC(s),u=lC(o),f=new Set([...c.keys(),...l.keys(),...u.keys()]);for(let M of f){let ce=[c.get(M)??0,l.get(M)??0,u.get(M)??0];if(Math.max(...ce)>1&&new Set(ce).size>1)return{ok:!1,reason:`duplicate heading "${M||"(preamble)"}" count differs across versions \u2014 occurrence pairing unstable`}}let d=cC(i),p=cC(s),h=cC(o),g=new Map,m=[],b=new Set;for(let M of[...d.order,...p.order,...h.order])b.has(M)||(b.add(M),m.push(M));for(let M of m){let ce=M.slice(0,M.lastIndexOf("\0")),q=d.keyed.get(M)?.text,oe=p.keyed.get(M)?.text,X=h.keyed.get(M)?.text;if(oe===X){oe!==void 0&&g.set(M,oe);continue}if(oe===q){X!==void 0&&g.set(M,X);continue}if(X===q){oe!==void 0&&g.set(M,oe);continue}if(oe===void 0||X===void 0)return{ok:!1,reason:`section "${ce||"(preamble)"}": deleted on one side, modified on the other`};if(q===void 0)return{ok:!1,reason:`section "${ce||"(preamble)"}": added differently on both sides`};let J=(0,d4.diff3)(aC(q),aC(oe),aC(X));if(J.ok){g.set(M,hae(J.merged));continue}let ye=(0,d4.diff3)(q.split(`
341
341
  `),oe.split(`
342
342
  `),X.split(`
343
343
  `));if(!ye.ok)return{ok:!1,reason:`section "${ce||"(preamble)"}": overlapping paragraph edits`};g.set(M,ye.merged.join(`
344
- `))}let _=a(M=>M.filter(ce=>g.has(ce)),"surviving"),S=_(d.order),I=_(p.order),E=_(h.order),w=a((M,ce)=>M.length===ce.length&&M.every((W,oe)=>W===ce[oe]),"sameSeq"),R=I.filter(M=>S.includes(M)),x=E.filter(M=>S.includes(M)),O=S.filter(M=>I.includes(M)),N=S.filter(M=>E.includes(M)),G;w(R,O)?G=E:w(x,N)?G=I:(G=I,n.push("section order diverged on both sides \u2014 local order kept, remote additions appended"));let j=[],ae=new Set;for(let M of G)g.has(M)&&!ae.has(M)&&(ae.add(M),j.push(M));for(let M of[...I,...E])g.has(M)&&!ae.has(M)&&(ae.add(M),j.push(M));return{ok:!0,body:j.map(M=>g.get(M)).join(`
344
+ `))}let _=a(M=>M.filter(ce=>g.has(ce)),"surviving"),S=_(d.order),I=_(p.order),E=_(h.order),w=a((M,ce)=>M.length===ce.length&&M.every((q,oe)=>q===ce[oe]),"sameSeq"),R=I.filter(M=>S.includes(M)),x=E.filter(M=>S.includes(M)),O=S.filter(M=>I.includes(M)),N=S.filter(M=>E.includes(M)),G;w(R,O)?G=E:w(x,N)?G=I:(G=I,n.push("section order diverged on both sides \u2014 local order kept, remote additions appended"));let j=[],ae=new Set;for(let M of G)g.has(M)&&!ae.has(M)&&(ae.add(M),j.push(M));for(let M of[...I,...E])g.has(M)&&!ae.has(M)&&(ae.add(M),j.push(M));return{ok:!0,body:j.map(M=>g.get(M)).join(`
345
345
  `),warnings:n}}a(mae,"mergeBody");var uC=class{static{a(this,"StructuredMerger")}constructor(e){this.codec=e}mergeAsset(e){let{path:t,base:n,local:i,remote:s}=e;if(i===void 0&&s===void 0)return{status:"conflict",reason:`${t}: gone on both sides \u2014 nothing to merge`};if(i===void 0||s===void 0)return{status:"conflict",reason:`${t}: ${i===void 0?"deleted locally, modified remotely":"modified locally, deleted remotely"} (delete-vs-modify)`};if(i===s)return{status:"merged",content:i,warnings:[]};if(n!==void 0&&i===n)return{status:"merged",content:s,warnings:[]};if(n!==void 0&&s===n)return{status:"merged",content:i,warnings:[]};let o=this.splitDoc(n??""),c=this.splitDoc(i),l=this.splitDoc(s);if(o===null||c===null||l===null)return{status:"conflict",reason:`${t}: unparseable frontmatter on ${o===null?"base":c===null?"local":"remote"} side`};let u=fae(o.frontmatter,c.frontmatter,l.frontmatter);if(!u.ok)return{status:"conflict",reason:`${t}: ${u.reason}`};let f=cs(o.frontmatter[om]),d=cs(c.frontmatter[om]),p=cs(l.frontmatter[om]),h=cs(u.value[om]);if(f.length>0&&d.length>0&&p.length>0&&h.length===0)return{status:"conflict",reason:`${t}: cross-tombstones removed all ${om} values \u2014 typeless merge refused`};let g=mae(o.body,c.body,l.body);if(!g.ok)return{status:"conflict",reason:`${t}: ${g.reason}`};let m=[...u.warnings,...g.warnings];if(Pc(u.value,c.frontmatter)&&g.body===c.body)return{status:"merged",content:i,warnings:m};if(Pc(u.value,l.frontmatter)&&g.body===l.body)return{status:"merged",content:s,warnings:m};let b;try{b=this.codec.stringify(u.value)}catch(S){return{status:"conflict",reason:`${t}: merged frontmatter failed to serialize (${S instanceof Error?S.message:String(S)})`}}return b.endsWith(`
346
346
  `)||(b+=`
347
347
  `),{status:"merged",content:`---
@@ -350,7 +350,7 @@ ${g.body}`,warnings:m}}splitDoc(e){let t=lae.exec(e);if(!t)return{frontmatter:{}
350
350
  `).replace(/\s+$/,"")}a(E4,"normaliseBody");function vae(r,e,t){let n=w4(r),i=w4(e),s;if(n.fm===null&&i.fm===null)s=!0;else if(n.fm===null||i.fm===null)s=!1;else try{s=hS(t.parse(n.fm))===hS(t.parse(i.fm))}catch{s=!1}return{frontmatterEqual:s,bodyEqual:E4(n.body)===E4(i.body)}}a(vae,"compareAssetSemantics")});var I4=T(um=>{"use strict";Object.defineProperty(um,"__esModule",{value:!0});um.ParityValidator=void 0;um.summarizeParityRound=Cae;var lm=hd(),v4=pd(),wC=iS(),Tae=oS(),Sd=aS(),T4=SC(),Aae=50,Iae=200,A4=new Set(["pending-local-edit","pending-remote-add","pending-remote-edit","pending-remote-delete","deferred-local-delete","pending-conflict","unverified-divergence"]),Rae=new Set(["quarantine-pinned","format-only-drift"]);function ou(r){return r instanceof Error?r.message:String(r)}a(ou,"errMsg");var EC=class{static{a(this,"ParityValidator")}constructor(e){this.deps=e,this.transport=(0,Tae.withRateLimitBackoff)(e.transport,e.backoff)}async captureSnapshot(e){let t=new Map,n=[],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){n.push(`${s.repoKey}: conservation snapshot failed (${i(ou(o))}) \u2014 no coverage this round`)}return{dirtyByRepo:t,warnings:n}}async runRound(e,t){let n=this.deps.now??(()=>new Date().toISOString()),i=this.deps.maxSemanticFetchesPerRun??Iae,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:n(),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,n){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,lm.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=await(0,lm.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL),d=await(0,lm.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL),p=this.deps.maxFileBytes??Sd.DEFAULT_MAX_FILE_BYTES,h=l?Sd.isFileSpaceSyncablePath:Sd.isSyncablePath,g=new Map;for(let j of d)if(h(j.path)){if(j.size!==void 0&&j.size>p){i.push(`remote ${j.path} exceeds the ${p}-byte cap \u2014 excluded symmetrically`);continue}g.set(j.path,j)}let m=await this.readLocalSnapshot(e,l);i.push(...m.warnings);let b=await this.deps.watermarks.get(e.repoKey);if(b===null){let j=0;for(let[Y,M]of m.shas)g.get(Y)?.blobSha===M&&j++;let ae=new Set([...m.shas.keys(),...g.keys()]);return o("no-watermark",{filesChecked:ae.size,inParity:j,headSha:u,detail:`repo has no sync watermark on this device (${ae.size-j} raw diff(s)) \u2014 run a sync first; not counted toward M1/M2`})}let _=new Map(b.files.map(j=>[j.path,j.blobSha])),S=new Set(b.pinnedPaths??[]),{discrepancies:I,inParity:E,filesChecked:w}=await this.classifyAll(e,m,g,_,S,l,{warnings:i,runBudget:n}),R=await(0,lm.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 x=this.checkConservation(e,t,m,g,S,c),O=I.filter(j=>!Rae.has(j.cls)).length,N=I.length-O,G;if(l){let j=[...m.shas.values()].sort().join(`
351
351
  `),ae=[...g.values()].map(Y=>Y.blobSha).sort().join(`
352
352
  `);G=j===ae}return o("checked",{filesChecked:w,inParity:E,discrepancies:I,m2SemanticDiffs:O,accountedCount:N,m1Violations:x,headSha:u,...G!==void 0?{attachmentHashSetIdentical:G}:{}})}catch(l){if((0,wC.isAuthError)(l))return o("auth-required",{detail:s(`authentication failed: ${ou(l)} \u2014 the PAT is expired, revoked or under-scoped; update it (R8)`)});if((0,wC.isRefNotFoundError)(l)){let u=s(`${e.owner}/${e.repo}@${e.branch} is not reachable: ${ou(l)} \u2014 ${wC.REF_NOT_FOUND_HINT}`);return i.push("repo unreachable (HTTP 404) \u2014 skipped"),o("error",{detail:u})}return i.push(`parity check failed: ${s(ou(l))}`),o("error",{detail:s(ou(l))})}}async readLocalSnapshot(e,t){let n=this.deps.localFilesFor(e),i=t?Sd.isFileSpaceSyncablePath:Sd.isSyncablePath,s=this.deps.maxFileBytes??Sd.DEFAULT_MAX_FILE_BYTES,o=new Map,c=new Map,l=[];if(t&&n.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 n.list())if(i(f))try{if(t){let d=await n.readBinary(f);if(d.byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}o.set(f,await(0,v4.gitBlobSha)(d,this.deps.sha1))}else{let d=await n.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,v4.gitBlobSha)(d,this.deps.sha1))}}catch(d){let p=this.deps.redact??(h=>h);l.push(`local ${f} unreadable (${p(ou(d))}) \u2014 skipped`)}return{shas:o,texts:c,warnings:l}}async classifyAll(e,t,n,i,s,o,c){let l=[],u=0,f=this.deps.maxSemanticFetchesPerRepo??Aae,d=new Set([...t.shas.keys(),...n.keys()]);for(let p of[...d].sort()){let h=t.shas.get(p),m=n.get(p)?.blobSha,b=i.get(p);if(h!==void 0&&m!==void 0){if(h===m){u++;continue}l.push(await this.classifyContentDiff(e,p,h,m,b,s,o,t,{...c,takeRepoFetch:a(()=>f-- >0,"takeRepoFetch")}));continue}if(h!==void 0){let _;s.has(p)?_={path:p,presence:"local-only",cls:"quarantine-pinned",localSha:h}:b===void 0?_={path:p,presence:"local-only",cls:"pending-local-add",localSha:h}:b===h?_={path:p,presence:"local-only",cls:"pending-remote-delete",localSha:h,detail:"remote deleted it; the local copy is unchanged"}:_={path:p,presence:"local-only",cls:"pending-conflict",localSha:h,detail:"remote deleted it AND the local copy was edited"},l.push(_);continue}if(m!==void 0){let _;s.has(p)?_={path:p,presence:"remote-only",cls:"quarantine-pinned",remoteSha:m}:b===void 0?_={path:p,presence:"remote-only",cls:"pending-remote-add",remoteSha:m}:b===m?_={path:p,presence:"remote-only",cls:"deferred-local-delete",remoteSha:m,detail:"locally deleted; the delete propagates on the next sync (#3476) \u2014 escalates if it survives a converged round"}:_={path:p,presence:"remote-only",cls:"pending-conflict",remoteSha:m,detail:"locally deleted AND the remote copy was edited"},l.push(_)}}return{discrepancies:l,inParity:u,filesChecked:d.size}}async classifyContentDiff(e,t,n,i,s,o,c,l,u){let f={localSha:n,remoteSha:i};if(o.has(t))return{path:t,presence:"both",cls:"quarantine-pinned",...f};if(s!==void 0&&s===n)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),p;try{p=await(0,lm.getBlobText)(this.transport,e.owner,e.repo,i,this.deps.baseURL)}catch(g){let m=this.deps.redact??(b=>b);return u.warnings.push(`blob fetch for ${t} failed (${m(ou(g))}) \u2014 left unverified`),{path:t,presence:"both",cls:"unverified-divergence",...f}}let h=(0,T4.compareAssetSemantics)(d??"",p,this.deps.yaml);return(0,T4.isFormatOnlyDrift)(h)?{path:t,presence:"both",cls:"format-only-drift",...f,frontmatterEqual:!0,bodyEqual:!0}:{path:t,presence:"both",cls:"pending-conflict",...f,frontmatterEqual:h.frontmatterEqual,bodyEqual:h.bodyEqual,detail:`semantic divergence (frontmatter ${h.frontmatterEqual?"equal":"differs"}, body ${h.bodyEqual?"equal":"differs"})`}}checkConservation(e,t,n,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,p]of c)n.shas.get(d)!==p&&i.get(d)?.blobSha!==p&&(l.has(d)||u.has(d)||s.has(d)||f.push({repoKey:e.repoKey,path:d,kind:"conservation",detail:`pre-sync dirty content ${p.slice(0,7)} survived NOWHERE: disk now ${n.shas.get(d)?.slice(0,7)??"absent"}, not in head tree, not merged/quarantined/pinned \u2014 possible lost edit`}));return f}escalatePersistentDivergence(e,t,n){for(let i of e){if(i.status!=="checked")continue;let s=n?.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=>A4.has(u.cls)).map(u=>[u.path,u]));for(let u of i.discrepancies){if(!A4.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`})}}}};um.ParityValidator=EC;function Cae(r){if(r.vacuous)return`ExoSync parity: VACUOUS \u2014 0 of ${r.repos.length} repo(s) checked (errors / never synced)`;let e=r.repos.length-r.checkedRepos,t=e>0?`, ${e} skipped`:"";return r.ok?`ExoSync parity: M1=0, M2=\u2205 (${r.checkedRepos} repo(s) checked${t})`:`ExoSync parity: M1=${r.m1Total}, M2=${r.m2Total} diff(s) (${r.checkedRepos} repo(s) checked${t}) \u2014 see log`}a(Cae,"summarizeParityRound")});var C4=T(R4=>{"use strict";Object.defineProperty(R4,"__esModule",{value:!0})});var fm=T(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.UID_UNIQUENESS_WHITELIST_CLASS_UIDS=Zr.KNOWN_CHECK_IDS=Zr.CHECK_ID_DAG_ONTOLOGY_IMPORTS=Zr.CHECK_ID_UID_UNIQUENESS=Zr.CHECK_ID_CO_LOCATION=Zr.CHECK_ID_SHACL=void 0;Zr.CHECK_ID_SHACL="f83ffedd-1f05-4ab5-839d-58873c69c4ba";Zr.CHECK_ID_CO_LOCATION="61f95c82-f6fc-4b20-b06d-19f3dc1b1f12";Zr.CHECK_ID_UID_UNIQUENESS="ac10db25-231c-4677-8cac-647d3cf15c64";Zr.CHECK_ID_DAG_ONTOLOGY_IMPORTS="a57f4a6b-a462-4c8d-b958-0dbee4674727";Zr.KNOWN_CHECK_IDS=new Set([Zr.CHECK_ID_SHACL,Zr.CHECK_ID_CO_LOCATION,Zr.CHECK_ID_UID_UNIQUENESS,Zr.CHECK_ID_DAG_ONTOLOGY_IMPORTS]);Zr.UID_UNIQUENESS_WHITELIST_CLASS_UIDS=new Set(["b04e7a3e-6b49-4984-9f8d-b74e9f36818b","2b754a16-cccf-49ee-af69-a18c6d1e3b63"])});var gS=T(dm=>{"use strict";Object.defineProperty(dm,"__esModule",{value:!0});dm.readUid=xae;dm.readIsDefinedByRef=Pae;dm.readInstanceClassRefs=Oae;var x4=Yl();function xae(r){let e=r.exo__Asset_uid;if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}a(xae,"readUid");function Pae(r){return(0,x4.extractAssetReference)(r.exo__Asset_isDefinedBy)}a(Pae,"readIsDefinedByRef");function Oae(r){let e=r.exo__Instance_class,t=Array.isArray(e)?e:e==null?[]:[e],n=[];for(let i of t){let s=(0,x4.extractAssetReference)(i);s&&n.push(s)}return n}a(Oae,"readInstanceClassRefs")});var TC=T(vC=>{"use strict";Object.defineProperty(vC,"__esModule",{value:!0});vC.uidUniquenessCheck=Dae;var P4=gS(),Fae=fm();function Dae(r){let e=new Map;for(let n of r.assets){let i=(0,P4.readUid)(n.frontmatter);if(!i||(0,P4.readInstanceClassRefs)(n.frontmatter).some(c=>Fae.UID_UNIQUENESS_WHITELIST_CLASS_UIDS.has(c)))continue;let o=e.get(i);o?o.push(n.path):e.set(i,[n.path])}let t=[];for(let[n,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 "${n}" \u2014 also at ${s.filter(c=>c!==o).join(", ")}`})}return t}a(Dae,"uidUniquenessCheck")});var IC=T(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.coLocationCheck=Mae;var O4=gS(),Lae=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function F4(r){let e=r.lastIndexOf("/");return e<0?"":r.slice(0,e)}a(F4,"dirOf");function Nae(r){let e=r.slice(r.lastIndexOf("/")+1);return e.endsWith(".md")?e.slice(0,-3):e}a(Nae,"baseNameNoExt");function kae(r){return r.split("/").some(e=>e.toLowerCase()==="templates")}a(kae,"isTemplatesPath");function Mae(r){let e=new Map,t=new Map;for(let s of r.assets){let o=(0,O4.readUid)(s.frontmatter);o&&!e.has(o)&&e.set(o,s.path);let c=Nae(s.path);t.has(c)||t.set(c,s.path)}let n=a(s=>Lae.test(s)?e.get(s)??t.get(s):t.get(s)??e.get(s),"resolve"),i=[];for(let s of r.assets){if(s.path.split("/").includes("node_modules")||kae(s.path))continue;let o=(0,O4.readIsDefinedByRef)(s.frontmatter);if(!o||o.startsWith("!"))continue;let c=n(o);if(!c)continue;let l=F4(c),u=F4(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(Mae,"coLocationCheck")});var CC=T(RC=>{"use strict";Object.defineProperty(RC,"__esModule",{value:!0});RC.shaclCheck=jae;async function jae(r){if(!r.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 r.runShacl()).map(t=>({path:t.focusNode??t.path,message:`SHACL: ${t.message}${t.path?` (path ${t.path})`:""}`}))}a(jae,"shaclCheck")});var PC=T(xC=>{"use strict";Object.defineProperty(xC,"__esModule",{value:!0});xC.dagOntologyImportsCheck=$ae;async function $ae(r){if(!r.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 r.runDag()]}a($ae,"dagOntologyImportsCheck")});var OC=T(pm=>{"use strict";Object.defineProperty(pm,"__esModule",{value:!0});pm.CheckRegistry=void 0;pm.createDefaultCheckRegistry=qae;var yS=fm(),Uae=TC(),Bae=IC(),Vae=CC(),Gae=PC(),bS=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()]}};pm.CheckRegistry=bS;function qae(){return new bS().register({id:yS.CHECK_ID_UID_UNIQUENESS,label:"uid-uniqueness",run:Uae.uidUniquenessCheck}).register({id:yS.CHECK_ID_CO_LOCATION,label:"co-location",run:Bae.coLocationCheck}).register({id:yS.CHECK_ID_SHACL,label:"shacl",run:Vae.shaclCheck}).register({id:yS.CHECK_ID_DAG_ONTOLOGY_IMPORTS,label:"dag-ontology-imports",run:Gae.dagOntologyImportsCheck})}a(qae,"createDefaultCheckRegistry")});var D4=T(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});_S.VaultCheckRunner=void 0;var Wae=OC(),FC=class{static{a(this,"VaultCheckRunner")}constructor(e=new Wae.CheckRegistry){this.registry=e}async run(e,t){let n=await e.read();return this.runWithContext(n,t)}async runWithContext(e,t){let n=[];for(let i of t){let s=this.registry.get(i);if(!s){n.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);n.push({checkId:i,label:s.label,status:o.length>0?"fail":"pass",findings:o})}catch(o){n.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:n,ok:n.every(i=>i.status==="pass")}}};_S.VaultCheckRunner=FC});var L4=T(DC=>{"use strict";Object.defineProperty(DC,"__esModule",{value:!0});DC.readEnabledCheckIds=Kae;var zae=fm(),Hae=Yl();function Kae(r){let e=new Set;for(let t of r){let n=(0,Hae.extractAssetReference)(t.frontmatter.setting__Setting_key);if(!n||!zae.KNOWN_CHECK_IDS.has(n))continue;let i=t.frontmatter.setting__Setting_value;(i===!0||i==="true")&&e.add(n)}return[...e]}a(Kae,"readEnabledCheckIds")});var M4=T(Ot=>{"use strict";var Yae=Ot&&Ot.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),N4=Ot&&Ot.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Yae(e,r,t)};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.readInstanceClassRefs=Ot.readIsDefinedByRef=Ot.readUid=Ot.dagOntologyImportsCheck=Ot.shaclCheck=Ot.coLocationCheck=Ot.uidUniquenessCheck=Ot.readEnabledCheckIds=Ot.VaultCheckRunner=Ot.createDefaultCheckRegistry=Ot.CheckRegistry=void 0;N4(C4(),Ot);N4(fm(),Ot);var k4=OC();Object.defineProperty(Ot,"CheckRegistry",{enumerable:!0,get:a(function(){return k4.CheckRegistry},"get")});Object.defineProperty(Ot,"createDefaultCheckRegistry",{enumerable:!0,get:a(function(){return k4.createDefaultCheckRegistry},"get")});var Xae=D4();Object.defineProperty(Ot,"VaultCheckRunner",{enumerable:!0,get:a(function(){return Xae.VaultCheckRunner},"get")});var Qae=L4();Object.defineProperty(Ot,"readEnabledCheckIds",{enumerable:!0,get:a(function(){return Qae.readEnabledCheckIds},"get")});var Jae=TC();Object.defineProperty(Ot,"uidUniquenessCheck",{enumerable:!0,get:a(function(){return Jae.uidUniquenessCheck},"get")});var Zae=IC();Object.defineProperty(Ot,"coLocationCheck",{enumerable:!0,get:a(function(){return Zae.coLocationCheck},"get")});var ece=CC();Object.defineProperty(Ot,"shaclCheck",{enumerable:!0,get:a(function(){return ece.shaclCheck},"get")});var tce=PC();Object.defineProperty(Ot,"dagOntologyImportsCheck",{enumerable:!0,get:a(function(){return tce.dagOntologyImportsCheck},"get")});var LC=gS();Object.defineProperty(Ot,"readUid",{enumerable:!0,get:a(function(){return LC.readUid},"get")});Object.defineProperty(Ot,"readIsDefinedByRef",{enumerable:!0,get:a(function(){return LC.readIsDefinedByRef},"get")});Object.defineProperty(Ot,"readInstanceClassRefs",{enumerable:!0,get:a(function(){return LC.readInstanceClassRefs},"get")})});var $4=T(j4=>{"use strict";Object.defineProperty(j4,"__esModule",{value:!0})});var SS=T(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.LEGACY_SETTING_VALUE_PROPS=er.LEGACY_SETTING_KEY_PROPS=er.SETTING_VALUE_PROP=er.SETTING_KEY_PROP=void 0;er.coerceSettingValue=rce;er.extractKeyRef=nce;er.readSettingValueRaw=ice;er.renderSettingAssetMarkdown=oce;var U4=Yl();er.SETTING_KEY_PROP="setting__Setting_key";er.SETTING_VALUE_PROP="setting__Setting_value";er.LEGACY_SETTING_KEY_PROPS=["exo__Setting_key"];er.LEGACY_SETTING_VALUE_PROPS=["exo__Setting_value"];function rce(r,e){switch(r){case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return}case"string":return typeof e=="string"?e:typeof e=="number"?String(e):void 0;case"stringList":{if(Array.isArray(e)){let t=e.filter(n=>typeof n=="string");return t.length===e.length?t:void 0}return typeof e=="string"?[e]:void 0}}}a(rce,"coerceSettingValue");function B4(r){let e=r.indexOf("#");return e===-1?r:r.slice(0,e).trim()}a(B4,"stripAnchor");function nce(r){let e=(0,U4.extractAssetReference)(r[er.SETTING_KEY_PROP]);if(e)return B4(e);for(let t of er.LEGACY_SETTING_KEY_PROPS){let n=(0,U4.extractAssetReference)(r[t]);if(n)return B4(n)}return null}a(nce,"extractKeyRef");function ice(r){if(er.SETTING_VALUE_PROP in r)return r[er.SETTING_VALUE_PROP];for(let e of er.LEGACY_SETTING_VALUE_PROPS)if(e in r)return r[e]}a(ice,"readSettingValueRaw");function sce(r,e){switch(r){case"boolean":return[`${er.SETTING_VALUE_PROP}: ${e===!0?"true":"false"}`];case"string":return[`${er.SETTING_VALUE_PROP}: ${JSON.stringify(String(e??""))}`];case"stringList":{let t=Array.isArray(e)?e:[];return t.length===0?[`${er.SETTING_VALUE_PROP}: []`]:[`${er.SETTING_VALUE_PROP}:`,...t.map(n=>` - ${JSON.stringify(n)}`)]}}}a(sce,"renderValueYaml");function oce(r,e,t,n,i){return["---",`exo__Asset_uid: ${r.settingUid}`,`exo__Asset_isDefinedBy: "[[${n}]]"`,`exo__Asset_createdAt: ${i}`,"exo__Instance_class:",` - "[[${t}]]"`,`exo__Asset_label: "Setting: ${r.field}"`,`${er.SETTING_KEY_PROP}: "[[${r.keyUid}]]"`,...sce(r.datatype,e),"---","",`Distributable Exocortex setting \`${r.field}\` (${r.datatype}), exported by the Settings Distribution engine (RFC f402002b, M2). Edit \`setting__Setting_value\` here or re-export to overwrite.`,""].join(`
353
- `)}a(oce,"renderSettingAssetMarkdown")});var V4=T(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});ES.exportSettings=ace;ES.importSettings=cce;var wS=SS();function ace(r,e){return r.declaredKeys().map(t=>({field:t.field,fileName:`${t.settingUid}.md`,content:(0,wS.renderSettingAssetMarkdown)(t,r.readLiveValue(t),r.settingClassUid,e.ontologyUid,e.nowIso)}))}a(ace,"exportSettings");async function cce(r,e){let t=new Map;for(let s of r.declaredKeys())t.set(s.keyUid,s),t.set(s.keyLabel,s);let n=[],i=[];for(let s of e){let o=(0,wS.extractKeyRef)(s.frontmatter),c=o!==null?t.get(o):void 0;if(c===void 0){i.push({path:s.path,reason:"unknown-key",detail:o??"<no setting key>"});continue}let l=(0,wS.coerceSettingValue)(c.datatype,(0,wS.readSettingValueRaw)(s.frontmatter));if(l===void 0){i.push({path:s.path,reason:"uncoercible",detail:`expected ${c.datatype}`});continue}await r.writeLiveValue(c,l),n.push(c.field)}return{applied:n,skipped:i}}a(cce,"importSettings")});var G4=T(hm=>{"use strict";Object.defineProperty(hm,"__esModule",{value:!0});hm.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID=void 0;hm.resolveDistributionOntology=lce;var NC=SS();hm.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID="ea44f996-64e5-46ce-8953-b13d21ee750d";function lce(r,e){for(let t of r){if((0,NC.extractKeyRef)(t.frontmatter)!==e)continue;let n=(0,NC.coerceSettingValue)("string",(0,NC.readSettingValueRaw)(t.frontmatter));if(typeof n=="string"){let i=n.trim();if(i.length>0)return i}}return null}a(lce,"resolveDistributionOntology")});var z4=T(Rt=>{"use strict";var uce=Rt&&Rt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),fce=Rt&&Rt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&uce(e,r,t)};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.resolveDistributionOntology=Rt.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID=Rt.importSettings=Rt.exportSettings=Rt.renderSettingAssetMarkdown=Rt.readSettingValueRaw=Rt.extractKeyRef=Rt.coerceSettingValue=Rt.LEGACY_SETTING_VALUE_PROPS=Rt.LEGACY_SETTING_KEY_PROPS=Rt.SETTING_VALUE_PROP=Rt.SETTING_KEY_PROP=void 0;fce($4(),Rt);var Oc=SS();Object.defineProperty(Rt,"SETTING_KEY_PROP",{enumerable:!0,get:a(function(){return Oc.SETTING_KEY_PROP},"get")});Object.defineProperty(Rt,"SETTING_VALUE_PROP",{enumerable:!0,get:a(function(){return Oc.SETTING_VALUE_PROP},"get")});Object.defineProperty(Rt,"LEGACY_SETTING_KEY_PROPS",{enumerable:!0,get:a(function(){return Oc.LEGACY_SETTING_KEY_PROPS},"get")});Object.defineProperty(Rt,"LEGACY_SETTING_VALUE_PROPS",{enumerable:!0,get:a(function(){return Oc.LEGACY_SETTING_VALUE_PROPS},"get")});Object.defineProperty(Rt,"coerceSettingValue",{enumerable:!0,get:a(function(){return Oc.coerceSettingValue},"get")});Object.defineProperty(Rt,"extractKeyRef",{enumerable:!0,get:a(function(){return Oc.extractKeyRef},"get")});Object.defineProperty(Rt,"readSettingValueRaw",{enumerable:!0,get:a(function(){return Oc.readSettingValueRaw},"get")});Object.defineProperty(Rt,"renderSettingAssetMarkdown",{enumerable:!0,get:a(function(){return Oc.renderSettingAssetMarkdown},"get")});var q4=V4();Object.defineProperty(Rt,"exportSettings",{enumerable:!0,get:a(function(){return q4.exportSettings},"get")});Object.defineProperty(Rt,"importSettings",{enumerable:!0,get:a(function(){return q4.importSettings},"get")});var W4=G4();Object.defineProperty(Rt,"EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID",{enumerable:!0,get:a(function(){return W4.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID},"get")});Object.defineProperty(Rt,"resolveDistributionOntology",{enumerable:!0,get:a(function(){return W4.resolveDistributionOntology},"get")})});var MC=T(kC=>{"use strict";Object.defineProperty(kC,"__esModule",{value:!0});kC.resolvePreferenceList=dce;function dce(r,e){if(Array.isArray(r)&&r.length>1){let t=r.map(n=>e(n)).filter(n=>n!==null&&n.length>0);return t.length>0?t.join("|"):null}return Array.isArray(r)?r.length===0?null:e(r[0]):e(r)}a(dce,"resolvePreferenceList")});var vS=T(jC=>{"use strict";Object.defineProperty(jC,"__esModule",{value:!0});jC.unwrapLinkTarget=pce;function pce(r){let e=r.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return e.includes("|")?e.split("|")[0]?.trim()??"":e}a(pce,"unwrapLinkTarget")});var $C=T(TS=>{"use strict";Object.defineProperty(TS,"__esModule",{value:!0});TS.DEFAULT_DISPLAY_NAME_SETTINGS=void 0;TS.DEFAULT_DISPLAY_NAME_SETTINGS={defaultTemplate:"{{exo__Asset_label}}",classTemplates:{},projectTBoxNames:!0}});var gm=T(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});mm.isWikilink=UC;mm.ownProperty=AS;mm.resolveKeyPath=hce;function UC(r){return r.startsWith("[[")&&r.endsWith("]]")}a(UC,"isWikilink");function AS(r,e){if(!(r===null||typeof r!="object"))return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0}a(AS,"ownProperty");function hce(r,e,t){let n=e.split("."),i=r;for(let s of n){if(i==null)return;if(Array.isArray(i)){let o=i[0];if(typeof o=="string"&&t&&UC(o)){let c=t(o);if(c){i=AS(c,s);continue}return}}if(typeof i!="object"){if(typeof i=="string"&&t&&UC(i)){let o=t(i);if(o){i=AS(o,s);continue}}return}i=AS(i,s)}return i}a(hce,"resolveKeyPath")});var IS=T(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.DEFAULT_DISPLAY_NAME_TEMPLATE=ls.DISPLAY_NAME_PRESETS=ls.DisplayNameTemplateEngine=ls.COMPOSED_SOURCE_MARKER=void 0;var mce=gm();ls.COMPOSED_SOURCE_MARKER="displayName";var BC=`!${ls.COMPOSED_SOURCE_MARKER}`,wd=class r{static{a(this,"DisplayNameTemplateEngine")}constructor(e,t={}){this.template=e,this.options=t}render(e,t,n,i){if(!this.template||this.template.trim()==="")return null;let s=this.options.separator;if(s)return this.renderWithSeparator(s,e,t,n,i);let o=0,c=0,l=this.renderSegment(this.template,e,t,n,i,()=>{o+=1},()=>{c+=1});if(o>0&&c===0&&r.hasReadableFallback(e,t))return null;let u=this.cleanupResult(l);return u===""?null:u}static hasReadableFallback(e,t){let n=e.exo__Asset_label;if(typeof n=="string"&&n.trim()!=="")return!0;let i=t.trim();return i===""?!1:!r.UUID_PATTERN.test(i)}renderSegment(e,t,n,i,s,o,c){return e.replace(r.PLACEHOLDER_PATTERN,(l,u)=>{let f=u.trim();o?.();let d=this.resolveValue(f,t,n,i,s);return d.trim()!==""&&c?.(),d})}renderWithSeparator(e,t,n,i,s){let o=this.template.indexOf("{{"),c=this.template.lastIndexOf("}}");if(o===-1||c===-1||c<o){let m=this.cleanupResult(this.renderSegment(this.template,t,n,i,s));return m===""?null:m}let l=this.template.slice(0,o),u=this.template.slice(o,c+2),f=this.template.slice(c+2),d=[];for(let m of r.splitOutsidePlaceholders(u,e)){let b=this.cleanupResult(this.renderSegment(m,t,n,i,s));b!==""&&d.push(b)}if(d.length===0)return null;let p=this.renderSegment(l,t,n,i,s),h=this.renderSegment(f,t,n,i,s),g=`${p}${d.join(e)}${h}`.trim();return g===""?null:g}static splitOutsidePlaceholders(e,t){if(t.length===0)return[e];let n=[],i="",s=0;for(;s<e.length;){if(e.startsWith("{{",s)){let o=e.indexOf("}}",s+2);if(o!==-1){i+=e.slice(s,o+2),s=o+2;continue}}if(e.startsWith(t,s)){n.push(i),i="",s+=t.length;continue}i+=e[s],s+=1}return n.push(i),n}cleanupResult(e){let t=e;return t=t.replace(/\s+\(\s*\)$/g,""),t=t.replace(/^\(\s*\)\s+/g,""),t==="()"&&(t=""),t=t.replace(/\s+\[\s*\]$/g,""),t=t.replace(/^\[\s*\]\s+/g,""),t==="[]"&&(t=""),t=t.replace(/\s+/g," "),t.trim()}resolveValue(e,t,n,i,s){if(e==="_basename")return n;if(e==="_created")return i?this.formatDate(i):"";let{path:o,format:c,preferComposed:l}=r.splitKeyAndFormat(e),u=o.includes("|")?o.split("|").map(d=>d.trim()).filter(d=>d.length>0):[o],f="";for(let d of u){let p=this.getNestedValue(t,d,s),h;if(c){let g=r.applyValueFormat(p,c);h=g!==null?g:this.formatValue(p,s,l)}else h=this.formatValue(p,s,l);if(h!=="")return h;f=h}return f}static splitKeyAndFormat(e){let t=e,n=!1,i=t.trimEnd();i.length>BC.length&&i.endsWith(BC)&&(n=!0,t=i.slice(0,-BC.length).trim());let s=t.indexOf("::");if(s<=0)return n?{path:t,preferComposed:n}:{path:t};let o=t.slice(0,s).trim(),c=t.slice(s+2).trim();return!o||!c?n?{path:t,preferComposed:n}:{path:t}:n?{path:o,format:c,preferComposed:n}:{path:o,format:c}}static applyValueFormat(e,t){let n=e;if(Array.isArray(n)){if(n.length===0)return null;n=n[0]}let i,s,o,c,l,u;if(n instanceof Date){if(Number.isNaN(n.getTime()))return null;let p=a(h=>String(h).padStart(2,"0"),"pad");i=String(n.getUTCFullYear()).padStart(4,"0"),s=p(n.getUTCMonth()+1),o=p(n.getUTCDate()),c=p(n.getUTCHours()),l=p(n.getUTCMinutes()),u=p(n.getUTCSeconds())}else if(typeof n=="string"){let p=/^\s*(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?/.exec(n);if(!p)return null;i=p[1],s=p[2],o=p[3],c=p[4],l=p[5],u=p[6]}else return null;let f=!1,d=t.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,p=>{switch(p){case"YYYY":return i;case"YY":return i.slice(-2);case"MM":return s;case"DD":return o;case"HH":return c===void 0&&(f=!0),c??"";case"mm":return l===void 0&&(f=!0),l??"";case"ss":return u===void 0&&(f=!0),u??"";default:return p}});return f?null:d}getNestedValue(e,t,n){return(0,mce.resolveKeyPath)(e,t,n)}formatWikilinkValue(e,t,n=!1){let i=e.match(/^\[\[([^\]|]+?)(?:\|([^\]]+))?\]\]$/);if(!i)return e.replace(r.WIKILINK_PATTERN,"").trim();let s=i[1].trim(),o=i[2]?.trim();if(o)return o;let c=t?t(e):void 0,l=c?.exo__Asset_label,u=typeof l=="string"&&l.trim()?l.trim():null,f=a(()=>{let d=this.options.nestedDisplayName?.(e,c);return d!=null&&d.trim()!==""?d.trim():null},"composed");if(n){let d=f();if(d!==null)return d}if(u!==null)return u;if(!n){let d=f();if(d!==null)return d}return s}formatValue(e,t,n=!1){if(e==null)return"";if(typeof e=="string")return this.formatWikilinkValue(e,t,n);if(Array.isArray(e)){if(e.length===0)return"";if(this.options.joinArrayValues){let i=[];for(let s of e){let o=this.formatValue(s,t,n);o&&!r.UUID_PATTERN.test(o)&&i.push(o)}return i.join(" ")}return this.formatValue(e[0],t,n)}return typeof e=="object"?JSON.stringify(e):String(e)}formatDate(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${i}`}getTemplate(){return this.template}isValid(){return!this.template||this.template.trim()===""?!1:/\{\{[^}]+\}\}/.test(this.template)}getPlaceholders(){let e=[],t=/\{\{([^}]+)\}\}/g,n;for(;(n=t.exec(this.template))!==null;)e.push(n[1].trim());return e}};ls.DisplayNameTemplateEngine=wd;wd.PLACEHOLDER_PATTERN=/\{\{([^}]+)\}\}/g;wd.WIKILINK_PATTERN=/^\[\[|\]\]$/g;wd.UUID_PATTERN=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;ls.DISPLAY_NAME_PRESETS={default:{name:"Label only (default)",template:"{{exo__Asset_label}}"},labelWithStatus:{name:"Label with status",template:"{{exo__Asset_label}}: {{ems__Effort_status}}"},classPrefix:{name:"Class prefix",template:"[{{exo__Instance_class}}] {{exo__Asset_label}}"},classSuffix:{name:"Class suffix",template:"{{exo__Asset_label}} ({{exo__Instance_class}})"},basenameWithLabel:{name:"Filename with label",template:"{{_basename}} - {{exo__Asset_label}}"},datePrefix:{name:"Date prefix",template:"{{_created}} - {{exo__Asset_label}}"}};ls.DEFAULT_DISPLAY_NAME_TEMPLATE=ls.DISPLAY_NAME_PRESETS.classSuffix.template});var Y4=T(RS=>{"use strict";Object.defineProperty(RS,"__esModule",{value:!0});RS.PrintNameRuleService=void 0;var gce=MC(),H4=vS(),K4=gm(),yce=IS(),bce="exo__DisplayNameSpec",_ce="07eab746-0874-4676-9d98-dbaad1bc6fb8",Sce=new Set(["8bc662e3-2984-4845-9593-d37e0db9b7e3","exo__PrintedPropertyValueSourceDisplayName"]),wce="exo__PrintedProperty",Ece="7d58de40-d941-4a66-88e2-13afc4fdc41d",vce="exo__PrintedLiteral",Tce="4d5437c9-788e-4a6d-9be0-4af3a84554f4",Ace=1e3,Ice=300,VC=class r{static{a(this,"PrintNameRuleService")}constructor(e,t={},n=void 0){this.vault=e,this.hostFunctions=t,this.host=n,this.rules=new Map,this.classHierarchy=new Map,this.initialized=!1,this.scanDebounceTimer=null}initialize(){this.scanVault(),this.initialized=!0}getTemplateForClass(e,t){if(!this.initialized)return null;let n=this.selectRule(this.rules.get(e),t);if(n)return{template:n.template,priority:n.priority};let i=this.getAncestorClasses(e);for(let s of i){let o=this.selectRule(this.rules.get(s),t);if(o)return{template:o.template,priority:o.priority}}return null}getParticipatingRules(e,t){if(!this.initialized)return[];let n=this.participatingOf(this.rules.get(e),t);if(n.length>0)return n;for(let i of this.getAncestorClasses(e)){let s=this.participatingOf(this.rules.get(i),t);if(s.length>0)return s}return[]}selectRule(e,t){if(!e||e.length===0)return null;for(let n of e)if(this.ruleParticipates(n,t))return n;return null}participatingOf(e,t){if(!e||e.length===0)return[];let n=[];for(let i of e)this.ruleParticipates(i,t)&&n.push({template:i.template,priority:i.priority,sourceFile:i.sourceFile,...i.separator?{separator:i.separator}:{}});return n}ruleParticipates(e,t){return e.matcher?t?this.matcherSatisfied(e.matcher,t):!1:!0}matcherSatisfied(e,t){if(e.kind==="hostFunction"){if(!Object.prototype.hasOwnProperty.call(this.hostFunctions,e.hostFunction))return!1;let s=this.hostFunctions[e.hostFunction];return typeof s!="function"?!1:s(this.host,t)}let n=e.matchKey.includes(".")?(0,K4.resolveKeyPath)(t,e.matchKey,this.createMetadataResolver()):(0,K4.ownProperty)(t,e.matchKey),i=this.extractClassKeys(n);return i.length===0?!1:i.some(s=>e.matchValues.includes(s))}resolveIdentityForms(e){let t=this.extractClassKeys(e);if(t.length===0)return[];let n=new Set(t);for(let i of t){let s=this.vault.resolveLinkpathFrontmatter(i);if(!s)continue;let o=s.exo__Asset_uid,c=s.exo__Asset_label;typeof o=="string"&&o.trim()&&n.add(o.trim()),typeof c=="string"&&c.trim()&&n.add(c.trim())}return[...n]}resolveMatchValues(e){return this.resolveIdentityForms(e)}resolveHostFunctionName(e){let t=e;if(Array.isArray(t)){if(t.length===0)return null;t=t[0]}return typeof t!="string"?null:t.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim()||null}static declaresComposedSource(e){let t=e;if(Array.isArray(t)){if(t.length===0)return!1;t=t[0]}if(typeof t!="string")return!1;let n=(0,H4.unwrapLinkTarget)(t).replace(/\.md$/,"");return!!Sce.has(n)}createMetadataResolver(){return e=>{let t=(0,H4.unwrapLinkTarget)(e);if(!t)return null;let n=this.vault.resolveLinkpathFrontmatter(t);return n?{...n}:null}}refresh(){this.scanVault()}scheduleRefresh(){this.scanDebounceTimer!==null&&window.clearTimeout(this.scanDebounceTimer),this.scanDebounceTimer=window.setTimeout(()=>{this.scanDebounceTimer=null,this.scanVault()},Ice)}scanVault(){this.rules.clear(),this.classHierarchy.clear();let e=new Map,t=[];for(let n of this.vault.listFrontmatter()){let i=this.cleanClassValue(n.exo__Instance_class);i===bce||i===_ce?this.collectDisplayNameSpec(n,e):(i===wce||i===Ece||i===vce||i===Tce)&&this.collectDisplayNamePart(n,t);let s=this.cleanClassValue(n.exo__Class_superClass);if(s&&i){let o=this.cleanClassValue(n.exo__Asset_label)||i,c=this.classHierarchy.get(o);c?c.push(s):this.classHierarchy.set(o,[s])}}this.compileDisplayNameSpecs(e,t)}collectDisplayNameSpec(e,t){let n=typeof e.exo__Asset_uid=="string"?e.exo__Asset_uid.trim():"";if(!n)return;let i=this.resolveIdentityForms(e.exo__DisplayNameSpec_appliesToClass);if(i.length===0)return;let s=e.exo__DisplayNameSpec_priority,o=typeof s=="number"?s:typeof s=="string"&&s.trim()!==""?Number(s):0,c=this.resolvePropertyKey(e.exo__DisplayNameSpec_matchPath),l=this.resolveMatchValues(e.exo__DisplayNameSpec_matchValue),u=c!==null&&l.length>0,f=this.resolveHostFunctionName(e.exo__DisplayNameSpec_matchHostFunction),d=e.exo__DisplayNameSpec_separator,p=typeof d=="string"&&d!==""?d:void 0;t.set(n,{uid:n,classKeys:i,priority:Number.isFinite(o)?o:0,...u?{matchKey:c??void 0,matchValues:l}:{},...f?{hostFunction:f}:{},...p?{separator:p}:{}})}collectDisplayNamePart(e,t){let n=this.cleanClassValue(e.exo__DisplayNamePart_of);if(!n)return;let i=e.exo__DisplayNamePart_order,s=typeof i=="number"?i:typeof i=="string"&&i.trim()!==""?Number(i):NaN;if(!Number.isFinite(s))return;let o=this.resolvePropertyKeyList(e.exo__PrintedProperty_property),c=e.exo__PrintedLiteral_literal,l=typeof c=="string"?c:void 0,u=e.exo__PrintedProperty_format,f=typeof u=="string"&&u.trim()!==""?u.trim():void 0,d=r.declaresComposedSource(e.exo__PrintedProperty_valueSource);o?t.push({specUid:n,order:s,propertyKey:o,...f?{format:f}:{},...d?{preferComposed:d}:{}}):l!==void 0&&t.push({specUid:n,order:s,literal:l})}compileDisplayNameSpecs(e,t){let n=new Map;for(let i of t){let s=n.get(i.specUid);s?s.push(i):n.set(i.specUid,[i])}for(let i of e.values()){let s=(n.get(i.uid)??[]).slice().sort((u,f)=>u.order-f.order);if(s.length===0)continue;let o=s.map(u=>{if(!u.propertyKey)return u.literal??"";let f=u.preferComposed?`!${yce.COMPOSED_SOURCE_MARKER}`:"";return u.format?`{{${u.propertyKey}::${u.format}${f}}}`:`{{${u.propertyKey}${f}}}`}).join(i.separator??"");if(!o.trim())continue;let c=Ace+i.priority,l;i.matchKey&&i.matchValues&&i.matchValues.length>0?l={kind:"value",matchKey:i.matchKey,matchValues:i.matchValues}:i.hostFunction&&(l={kind:"hostFunction",hostFunction:i.hostFunction});for(let u of i.classKeys){if(!u)continue;let f={className:u,template:o,priority:c,sourceFile:i.uid,...l?{matcher:l}:{},...i.separator?{separator:i.separator}:{}},d=this.rules.get(u);d?(d.push(f),d.sort((p,h)=>h.priority-p.priority)):this.rules.set(u,[f])}}}resolvePropertyKey(e){return Array.isArray(e)?e.length===0?null:this.resolveSinglePropertyKey(e[0]):this.resolveSinglePropertyKey(e)}resolvePropertyKeyList(e){return(0,gce.resolvePreferenceList)(e,t=>this.resolveSinglePropertyKey(t))}resolveSinglePropertyKey(e){if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();if(!t)return null;if(t.includes("|"))return t.split("|").pop()?.trim()||null;let n=t.replace(/\.md$/,"").trim();if(!n)return null;let i=this.vault.resolveLinkpathFrontmatter(n);if(i){let s=i.exo__Asset_label;if(typeof s=="string"&&s.trim())return s.trim()}return n}extractClassKeys(e){let t=e;if(Array.isArray(t)){if(t.length===0)return[];t=t[0]}if(typeof t!="string")return[];let n=t.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();if(!n)return[];if(n.includes("|")){let[i,s]=n.split("|");return[i.trim().replace(/\.md$/,""),s.trim()].filter(o=>!!o)}return[n.replace(/\.md$/,"")]}getAncestorClasses(e){let t=[],n=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(!s||n.has(s))continue;n.add(s);let o=this.classHierarchy.get(s);if(o)for(let c of o)n.has(c)||(t.push(c),i.push(c))}return t}cleanClassValue(e){if(!e)return null;if(Array.isArray(e))return e.length===0?null:this.cleanClassValue(e[0]);if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return t.includes("|")&&(t=(t.split("|").pop()??t).trim()),t||null}getRulesCount(){let e=0;for(let t of this.rules.values())e+=t.length;return e}};RS.PrintNameRuleService=VC});var X4=T(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});ym.DisplayNameResolver=void 0;ym.createDefaultResolver=Dce;var Rce=IS(),Cce=gm(),xce=vS(),Pce=$C(),Oce=3,Fce=new Set(["8619c4fc-64f1-4869-b17e-e34186cacca9","exo__Class","38277bfa-d7f9-4a75-b856-b23276ab0db3","exo__Property","9a1cf31c-9d41-4ef3-9023-584a8d087d16","exo__ObjectProperty","ae56ca4c-b610-42a4-a25d-058c23673296","exo__DatatypeProperty","84756998-3b4e-4989-91cc-a5d5c23664d4","exo__URLProperty"]),CS=class{static{a(this,"DisplayNameResolver")}constructor(e,t,n){this.settings=e,this.ruleService=t,this.metadataResolver=n,this.nestedDepth=0,this.nestedTargets=new Set}resolve(e){return this.resolveWithProvenance(e).displayName}resolveWithProvenance(e){let{metadata:t,basename:n,createdDate:i}=e,s=this.extractAssetClasses(t),o=this.computeTBoxNamingProjection(s,t);if(o!==null)return{displayName:o,provenance:"tboxProjection"};let{template:c,separator:l,provenance:u}=this.resolveRenderSpec(s,t);return{displayName:new Rce.DisplayNameTemplateEngine(c,{...l?{separator:l}:{},nestedDisplayName:a((d,p)=>this.resolveNestedDisplayName(d,p),"nestedDisplayName")}).render(t,n,i,this.metadataResolver??void 0),provenance:u}}resolveNestedDisplayName(e,t){if(!this.metadataResolver)return null;let n=(0,xce.unwrapLinkTarget)(e).replace(/\.md$/,"");if(this.nestedDepth>=Oce||this.nestedTargets.has(n))return null;let i=t!==void 0?t:this.metadataResolver(e);if(!i)return null;this.nestedDepth+=1,this.nestedTargets.add(n);try{let s=this.resolveWithProvenance({metadata:i,basename:n});return s.provenance!=="spec"&&s.provenance!=="tboxProjection"?null:s.displayName}catch{return null}finally{this.nestedTargets.delete(n),this.nestedDepth-=1}}getTemplateForClasses(e,t){return this.resolveRenderSpec(e,t).template}resolveRenderSpec(e,t){if(this.ruleService&&e.length>0){let s=[],o=new Set;for(let c of e)for(let l of this.ruleService.getParticipatingRules(c,t))o.has(l.sourceFile)||(o.add(l.sourceFile),s.push(l));if(s.length>0)return s.sort((c,l)=>l.priority-c.priority||c.sourceFile.localeCompare(l.sourceFile)),s.length===1?{template:s[0].template,...s[0].separator?{separator:s[0].separator}:{},provenance:"spec"}:{...this.composeTemplates(s),provenance:"spec"}}let n=e[0],i=n?(0,Cce.ownProperty)(this.settings.classTemplates,n):void 0;return typeof i=="string"&&i?{template:i,provenance:"classTemplate"}:{template:this.settings.defaultTemplate,provenance:"default"}}composeTemplates(e){let t=new Set,n=new Set,i=[],s=[],o=null,c,l=a((p,h,g)=>{for(let m of p.trim().split(/\s+/))!m||h.has(m)||(h.add(m),g.push(m))},"collect");for(let p of e){let{prefix:h,core:g,suffix:m}=this.splitTemplate(p.template);o===null&&g!==""&&(o=g,c=p.separator),l(h,t,i),l(m,n,s)}let u=o??"",f=i.map(p=>`${p} `).join(""),d=s.length?` ${s.join(" ")}`:"";return{template:`${f}${u}${d}`,...c?{separator:c}:{}}}splitTemplate(e){let t=e.indexOf("{{"),n=e.lastIndexOf("}}");return t===-1||n===-1||n<t?{prefix:e,core:"",suffix:""}:{prefix:e.slice(0,t),core:e.slice(t,n+2),suffix:e.slice(n+2)}}getTemplateForClass(e,t){return this.getTemplateForClasses(e?[e]:[],t)}extractAssetClasses(e){let t=e.exo__Instance_class;if(!t)return[];let n=Array.isArray(t)?t:[t],i=[],s=new Set;for(let o of n){let c=this.cleanClassValue(o);c&&!s.has(c)&&(s.add(c),i.push(c))}return i}cleanClassValue(e){if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return t.includes("|")&&(t=(t.split("|").pop()??t).trim()),t||null}computeTBoxNamingProjection(e,t){if(this.settings.projectTBoxNames===!1||!this.isTBoxNamingEntity(e))return null;if(this.ruleService){for(let u of e)if(this.ruleService.getParticipatingRules(u,t).length>0)return null}let n=typeof t.exo__Asset_label=="string"?t.exo__Asset_label.trim():"",[i,s]=this.splitPrefixedLabel(n),c=(typeof t.exo__Slugable_slug=="string"?t.exo__Slugable_slug.trim():"")||s;if(!c)return null;let l=this.resolveOntologyShortName(t)??i;return l?`${l}#${c}`:c}isTBoxNamingEntity(e){return e.some(t=>Fce.has(t))}resolveOntologyShortName(e){if(!this.metadataResolver)return null;let t=this.firstString(e.exo__Asset_isDefinedBy);if(!t)return null;let i=this.metadataResolver(t)?.exo__Ontology_shortName;return typeof i=="string"&&i.trim()?i.trim():null}splitPrefixedLabel(e){let t=e.indexOf("__");if(t<=0)return[null,null];let n=e.slice(0,t),i=e.slice(t+2);return i?[n,i]:[null,null]}firstString(e){let t=e;if(Array.isArray(t)){if(t.length===0)return null;t=t[0]}return typeof t!="string"?null:t.trim()||null}configuredClassEntries(){return Object.entries(this.settings.classTemplates).filter(e=>typeof e[1]=="string"&&e[1].length>0)}getConfiguredClasses(){return this.configuredClassEntries().map(([e])=>e)}hasClassTemplates(){return this.configuredClassEntries().length>0}};ym.DisplayNameResolver=CS;async function Dce(){return new CS(Pce.DEFAULT_DISPLAY_NAME_SETTINGS)}a(Dce,"createDefaultResolver")});var n9=T(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.isEffortBlocked=Z4;Ed.localToday=t9;Ed.isEpisodeOngoing=r9;Ed.createDisplayMatcherHostFunctions=jce;var Q4=bl(),Lce=Hu(),Nce=10,kce=/^\d{4}-\d{2}-\d{2}$/;function Z4(r,e){let t=e.ems__Effort_blocker;if(!t)return!1;let n=e9(String(t)).split("|")[0].trim();if(!n)return!1;let i=r.resolveLinkpathFrontmatter(n);if(!i)return!1;let s=Mce(r,i.ems__Effort_status);return s!==Q4.EffortStatus.DONE&&s!==Q4.EffortStatus.TRASHED}a(Z4,"isEffortBlocked");function e9(r){return r.trim().replace(/^["']/,"").replace(/["']$/,"").replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/\.md$/,"").trim()}a(e9,"unwrapWikilink");function Mce(r,e){let t=(0,Lce.normalizeEffortStatus)(e);if(t!==null)return t;let n=e;if(n==null)return"";if(Array.isArray(n)){if(n.length!==1)return"";n=n[0]}let i=e9(String(n));if(i==="")return"";let s=i.indexOf("|"),o=s===-1?i:i.slice(0,s).trim(),l=r.resolveLinkpathFrontmatter(o)?.exo__Asset_label;return Array.isArray(l)&&(l=l[0]),typeof l=="string"&&l.trim()?l.trim():o}a(Mce,"resolveStatusLabel");function t9(r=new Date){let e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}a(t9,"localToday");function J4(r){let e=r;if(Array.isArray(e)){if(e.length===0)return null;e=e[0]}if(e instanceof Date){if(Number.isNaN(e.getTime()))return null;let l=a(u=>String(u).padStart(2,"0"),"pad");return`${String(e.getUTCFullYear()).padStart(4,"0")}-${l(e.getUTCMonth()+1)}-${l(e.getUTCDate())}`}if(typeof e!="string")return null;let n=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim().slice(0,Nce);if(!kce.test(n))return null;let[i,s,o]=n.split("-").map(Number),c=new Date(Date.UTC(i,s-1,o));return c.getUTCFullYear()!==i||c.getUTCMonth()!==s-1||c.getUTCDate()!==o?null:n}a(J4,"toDayKey");function r9(r,e=new Date){let t=J4(r.life__Episode_start);if(t===null)return!1;let n=t9(e);if(t>n)return!1;let i=r.life__Episode_end;if(i==null||Array.isArray(i)&&i.length===0||String(i).trim()==="")return!0;let o=J4(i);return o===null?!1:o>=n}a(r9,"isEpisodeOngoing");function jce(r){return{isEffortBlocked:a((e,t)=>Z4(r,t),"isEffortBlocked"),isEpisodeOngoing:a((e,t)=>r9(t),"isEpisodeOngoing")}}a(jce,"createDisplayMatcherHostFunctions")});var Fe=T(y=>{"use strict";var $ce=y&&y.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ni=y&&y.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&$ce(e,r,t)};Object.defineProperty(y,"__esModule",{value:!0});y.CommandResolver=y.extractPropertyLabel=y.uriToPropertyName=y.propertyNameToUri=y.rangeToFieldType=y.PropertyFieldType=y.ParkedAssetIndex=y.resolveDependencyKind=y.parkedPathFor=y.classifyMountTransition=y.PARKED_ROOT=y.DEPENDENCY_KIND_REFERENCE_UID=y.DEPENDENCY_KIND_TBOX_UID=y.transitiveDependsOnClosure=y.isTsFloorMountPath=y.isTsFloorAssetSpace=y.assertTsFloorReconciled=y.assertTsFloor=y.TsFloorViolationError=y.CATALOG_KEEP_NAMESPACES=y.PLUGIN_UI_FLOOR=y.SDK_FLOOR=y.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=y.SDK_FLOOR_ASSETSPACE_UIDS=y.TS_FLOOR_AS_UID_SHARED_IDENTITIES=y.TS_FLOOR_AS_UID_EXOCMD=y.TS_FLOOR_AS_UID_EXO=y.parseGroundingDefinitionFromFrontmatter=y.isCommandBindingFrontmatter=y.isGroundingFrontmatter=y.isPreconditionFrontmatter=y.isCommandFrontmatter=y.isStyleSource=y.isLabelClass=y.isCommandVariant=y.STYLE_SOURCE_VALUES=y.LABEL_CLASS_VALUES=y.COMMAND_VARIANT_VALUES=y.CommandBindingStyleProperty=y.CommandBindingProperty=y.GroundingProperty=y.PreconditionProperty=y.CommandProperty=y.resolveGroundingTypeFromWikilinkLiteral=y.resolveGroundingTypeFromIRI=y.GROUNDING_TYPE_IRI_TO_ENUM=y.GROUNDING_TYPE_UID_TO_ENUM=y.GROUNDING_TYPE_UIDS=y.GroundingType=y.EFFORT_STATUS_OPTIONS=void 0;y.ClassHierarchyResolver=y.PropertySchemaResolver=y.orderProperties=y.loadDefaultSpec=y.clearOrderSpecLoader=y.registerOrderSpecLoader=y.StatusTimestampService=y.RenameToUidService=y.PropertyCleanupService=y.LoggingService=y.extractAssetReference=y.FolderRepairService=y.WorkflowCommandAdapter=y.VisibilityGenerator=y.InstantiationRuleResolver=y.stripTemplateFrontmatter=y.resolveTemplateBody=y.getRegisteredResolverIds=y.clearResolvers=y.registerResolver=y.getResolver=y.installDefaultResolvers=y.WorkflowResolver=y.WorkflowEngine=y.EffortStatusWorkflow=y.ConceptCreationService=y.ClassCreationService=y.AreaHierarchyBuilder=y.TaskStatusService=y.createTripleStoreDeclaredRanges=y.createTripleStoreClassPropertyResolver=y.createTripleStoreRequiredPropertyResolver=y.CommandExecutionFlow=y.stripFrontmatter=y.extractSparqlBlock=y.iriToObsidianName=y.NamedQueryRunner=y.createVaultFrontmatterRefToFrontmatterResolver=y.createVaultFrontmatterRefToFolderResolver=y.createVaultFrontmatterClassLabelResolver=y.missingRequiredInputError=y.findInputSchemaViolation=y.findMissingInput=y.missingInputError=y.ServiceRegistry=y.GroundingExecutor=y.registerDefaultHostFunctions=y.hasUidFilename=y.hasNonUidFilename=y.PreconditionEvaluator=void 0;y.NoteToRDFConverter=y.SOURCE_VARIABLE=y.SourceAnnotator=y.MAX_LAZY_DEPTH=y.LazyAssetGraphLoader=y.FILE_SPACE_CLASS_UID=y.frontmatterDeclaresFileSpace=y.discoverFileSpaceExclusions=y.deriveLegacyFlatPath=y.deriveUrl=y.derivePath=y.IRICanonicalizer=y.INFERRED_GRAPH=y.PrototypeChainMaterializer=y.PropertyCardinalityRegistry=y.NonInheritablePropertyRegistry=y.RDFSInferenceEngine=y.RDFVocabularyMapper=y.DomainTriple=y.DomainBlankNode=y.DomainLiteral=y.DomainIRI=y.InMemoryTripleStore=y.OBSIDIAN_VAULT_SCHEME=y.iriToVaultPath=y.vaultPathToIRI=y.NullLogger=y.RDFSerializer=y.FilenameValidator=y.EffortSortingHelpers=y.MetadataExtractor=y.MetadataHelpers=y.extractClassRefTarget=y.instanceClassMatches=y.resolveSubsumedClassKeys=y.WikiLinkHelpers=y.DateFormatter=y.parseYamlFrontmatterTolerant=y.STRING_SCALAR_PROPERTIES=y.scalarTypingForRange=y.serializeYamlScalar=y.quoteYamlString=y.FrontmatterService=y.SPARQL_PREFIXES=y.TypeRegistry=y.GraphQueryService=y.FixMissingLabelService=y.ArchiveAssetService=y.GenericAssetCreationService=y.EnumValueResolver=void 0;y.VaultPrefixTransformer=y.CaseWhenTransformerError=y.CaseWhenTransformer=y.ResultSerializer=y.createIncrementalIndexer=y.IncrementalIndexer=y.createSPARQLResultCache=y.SPARQLResultCache=y.QueryPlanCache=y.createDoubleLiteral=y.createDecimalLiteral=y.getNumericValue=y.createPercentileAggregate=y.modeAggregate=y.stddevAggregate=y.varianceAggregate=y.medianAggregate=y.EXO_AGGREGATE_NS=y.BUILT_IN_AGGREGATES=y.CustomAggregateError=y.CustomAggregateRegistry=y.AggregateFunctions=y.BuiltInFunctions=y.SolutionMapping=y.UpdateExecutorError=y.UpdateExecutor=y.QueryExecutor=y.ExoQLQueryExecutor=y.DescribeExecutor=y.ConstructExecutor=y.UnionExecutor=y.OptionalExecutor=y.FilterExecutor=y.BGPExecutor=y.AlgebraSerializer=y.AlgebraOptimizer=y.AlgebraTranslator=y.ExoQLAlgebraTranslator=y.DescribeOptionsTransformerError=y.DescribeOptionsTransformer=y.SPARQLParseError=y.SPARQLParser=y.ExoQLParser=y.isPosixBracketExpression=y.canonicalYamlKey=y.LEGACY_YAML_KEYS=y.LEGACY_UNPREFIXED_ASSET_FIELDS=y.UNPREFIXED_ASSET_FIELDS=y.isPathExcluded=y.normaliseExcludedFolders=void 0;y.coerceVisibilityOverride=y.DAILY_EFFORTS_OVERRIDE_KEYS=y.BUILTIN_DAILY_EFFORTS_VISIBILITY=y.isPropertiesBlock=y.isLayoutBlockFrontmatter=y.isDailyEffortsByClassBlock=y.isBacklinksTableBlock=y.createLayoutBlockFromFrontmatter=y.PROPERTIES_BLOCK_CLASS_UID=y.PROPERTIES_BLOCK_CLASS_IRI=y.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID=y.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI=y.BACKLINKS_TABLE_BLOCK_CLASS_UID=y.BACKLINKS_TABLE_BLOCK_CLASS_IRI=y.isLayoutFrontmatter=y.isLayout=y.createLayoutFromFrontmatter=y.LAYOUT_CLASS_UID=y.LAYOUT_CLASS_IRI=y.ExoQLError=y.ExoQL=y.createStreamingSource=y.StreamingLoader=y.resetGlobalPool=y.getGlobalPool=y.MemoryPool=y.CompactGraphStore=y.StringTable=y.DEFAULT_COLORS=y.NODE_FLAGS=y.container=y.resetContainer=y.getContainer=y.createChildContainer=y.registerCoreServices=y.DI_TOKENS=y.DEFAULT_FLEETING_NOTE_CLASS_UID=y.DEFAULT_INBOX_FOLDER=y.DEFAULT_OWNER_IDENTITY=y.VaultSettings=y.seededUidGenerator=y.liveUidGenerator=y.frozenClock=y.liveClock=y.TransactionError=y.TripleNotFoundError=y.TripleAlreadyExistsError=y.FileAlreadyExistsError=y.FileNotFoundError=y.FilterContainsOptimizer=void 0;y.aggregateTimings=y.addTimings=y.emptyTimings=y.classifyRestPhase=y.SYNC_PHASES=y.SyncPhaseTimer=y.syncProgressPhaseText=y.orderChildrenFirst=y.isNonFastForwardError=y.SyncEngine=y.DEFAULT_LOCAL_MANIFEST_REHASH_MS=y.DEFAULT_MAX_PUSH_RETRIES=y.checkParkedStaleness=y.getTree=y.getHeadSha=y.getCommitInfo=y.getBlobText=y.getBlobBytes=y.planDuplicateUidFix=y.findDuplicateUidGroups=y.rewriteAssetUid=y.gitBlobSha=y.extractAssetUid=y.detectChanges=y.MATERIALIZE_PROGRESS_MIN_FILES=y.MATERIALIZE_PROGRESS_INTERVAL=y.escapeGitmodulesRegex=y.stripGitmodulesEntry=y.appendGitmodulesEntry=y.extractAssetSpaceSha=y.discoverAssetSpaceWrapperDir=y.mountAssetSpaceFiles=y.isBinaryPayload=y.restCreateCommit=y.parseTarballGzip=y.parseTarball=y.TripleClassHierarchy=y.ShaclShapeRegistry=y.shaclValidate=y.Namespace=y.ShapeRegistry=y.ShapeLoader=y.selectByPriority=y.LayoutSelector=y.partitionDailyEffortsByClass=y.EMS_PROJECT_CLASS_UID=y.classListMatches=y.EMS_ACTION_CLASS_UID=y.resolveDailyEffortVisibility=y.resolveBlockVisibility=void 0;y.readSpaceSource=y.parseStrictGitHubRepoURL=y.isFileSpaceFrontmatter=y.isAssetSpaceFrontmatter=y.classifySpaceDeclaration=y.SpaceSpecAccumulator=y.SYNC_BRANCH=y.ASSET_SPACE_CLASS_UID=y.OUTBOX_REMOTE_ABSENT=y.OUTBOX_STORE_FILENAME=y.LocalOutboxStore=y.CONFLICT_CACHE_STORE_FILENAME=y.LocalConflictCacheStore=y.scanForSecrets=y.redactSecrets=y.enrichRateLimitError=y.attachRateLimitFields=y.getRateLimitFields=y.extractRateLimitFields=y.parseRetryAfterMs=y.caseInsensitiveHeaderGetter=y.DEFAULT_MAX_RETRIES=y.MIN_RATE_LIMIT_WAIT_MS=y.createRateLimitBudget=y.withRateLimitBackoff=y.isRateLimitError=y.isAuthError=y.MOUNT_BASE_STORE_FILENAME=y.FileMountBaseStore=y.WATERMARK_STORE_FILENAME=y.FileWatermarkStore=y.GatedStructuredMerger=y.MergeShaclGate=y.splitSections=y.StructuredMerger=y.diff3=y.LOCAL_MANIFEST_STORE_FILENAME=y.FileLocalManifestStore=y.isSyncablePath=y.isFileSpaceSyncablePath=y.contentEquals=y.InMemoryQuarantineStore=y.DEFAULT_MAX_FILE_BYTES=y.backupPathFor=y.QuarantineResolver=y.formatRepoTimings=y.formatTimingsLine=y.fmtMs=y.dominantPhase=y.totalMs=void 0;y.createDisplayMatcherHostFunctions=y.localToday=y.isEpisodeOngoing=y.isEffortBlocked=y.isWikilink=y.resolveKeyPath=y.DEFAULT_DISPLAY_NAME_TEMPLATE=y.DISPLAY_NAME_PRESETS=y.DisplayNameTemplateEngine=y.createDefaultResolver=y.DisplayNameResolver=y.PrintNameRuleService=y.DEFAULT_DISPLAY_NAME_SETTINGS=y.normalizeEffortStatus=y.EFFORT_STATUS_BY_UID=y.EFFORT_STATUS_UID=y.unwrapLinkTarget=y.resolvePreferenceList=y.isFormatOnlyDrift=y.compareAssetSemantics=y.summarizeParityRound=y.ParityValidator=y.deriveAssetSpaceNamespace=y.buildAssetSpaceDescriptor=void 0;Ni(yl(),y);Ni(bl(),y);var Uce=pv();Object.defineProperty(y,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return Uce.EFFORT_STATUS_OPTIONS},"get")});var Bce=cc();Object.defineProperty(y,"GroundingType",{enumerable:!0,get:a(function(){return Bce.GroundingType},"get")});var bm=jp();Object.defineProperty(y,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return bm.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(y,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return bm.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(y,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return bm.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(y,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return bm.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(y,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return bm.resolveGroundingTypeFromWikilinkLiteral},"get")});var _m=hv();Object.defineProperty(y,"CommandProperty",{enumerable:!0,get:a(function(){return _m.CommandProperty},"get")});Object.defineProperty(y,"PreconditionProperty",{enumerable:!0,get:a(function(){return _m.PreconditionProperty},"get")});Object.defineProperty(y,"GroundingProperty",{enumerable:!0,get:a(function(){return _m.GroundingProperty},"get")});Object.defineProperty(y,"CommandBindingProperty",{enumerable:!0,get:a(function(){return _m.CommandBindingProperty},"get")});Object.defineProperty(y,"CommandBindingStyleProperty",{enumerable:!0,get:a(function(){return _m.CommandBindingStyleProperty},"get")});var vd=mv();Object.defineProperty(y,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:a(function(){return vd.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(y,"LABEL_CLASS_VALUES",{enumerable:!0,get:a(function(){return vd.LABEL_CLASS_VALUES},"get")});Object.defineProperty(y,"STYLE_SOURCE_VALUES",{enumerable:!0,get:a(function(){return vd.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(y,"isCommandVariant",{enumerable:!0,get:a(function(){return vd.isCommandVariant},"get")});Object.defineProperty(y,"isLabelClass",{enumerable:!0,get:a(function(){return vd.isLabelClass},"get")});Object.defineProperty(y,"isStyleSource",{enumerable:!0,get:a(function(){return vd.isStyleSource},"get")});var xS=wD();Object.defineProperty(y,"isCommandFrontmatter",{enumerable:!0,get:a(function(){return xS.isCommandFrontmatter},"get")});Object.defineProperty(y,"isPreconditionFrontmatter",{enumerable:!0,get:a(function(){return xS.isPreconditionFrontmatter},"get")});Object.defineProperty(y,"isGroundingFrontmatter",{enumerable:!0,get:a(function(){return xS.isGroundingFrontmatter},"get")});Object.defineProperty(y,"isCommandBindingFrontmatter",{enumerable:!0,get:a(function(){return xS.isCommandBindingFrontmatter},"get")});var Vce=ED();Object.defineProperty(y,"parseGroundingDefinitionFromFrontmatter",{enumerable:!0,get:a(function(){return Vce.parseGroundingDefinitionFromFrontmatter},"get")});Ni(vD(),y);Ni(TD(),y);Ni(yv(),y);Ni(bv(),y);Ni(ID(),y);Ni(xD(),y);Ni(Zv(),y);Ni(c3(),y);var zi=l3();Object.defineProperty(y,"TS_FLOOR_AS_UID_EXO",{enumerable:!0,get:a(function(){return zi.TS_FLOOR_AS_UID_EXO},"get")});Object.defineProperty(y,"TS_FLOOR_AS_UID_EXOCMD",{enumerable:!0,get:a(function(){return zi.TS_FLOOR_AS_UID_EXOCMD},"get")});Object.defineProperty(y,"TS_FLOOR_AS_UID_SHARED_IDENTITIES",{enumerable:!0,get:a(function(){return zi.TS_FLOOR_AS_UID_SHARED_IDENTITIES},"get")});Object.defineProperty(y,"SDK_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return zi.SDK_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(y,"PLUGIN_UI_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return zi.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(y,"SDK_FLOOR",{enumerable:!0,get:a(function(){return zi.SDK_FLOOR},"get")});Object.defineProperty(y,"PLUGIN_UI_FLOOR",{enumerable:!0,get:a(function(){return zi.PLUGIN_UI_FLOOR},"get")});Object.defineProperty(y,"CATALOG_KEEP_NAMESPACES",{enumerable:!0,get:a(function(){return zi.CATALOG_KEEP_NAMESPACES},"get")});Object.defineProperty(y,"TsFloorViolationError",{enumerable:!0,get:a(function(){return zi.TsFloorViolationError},"get")});Object.defineProperty(y,"assertTsFloor",{enumerable:!0,get:a(function(){return zi.assertTsFloor},"get")});Object.defineProperty(y,"assertTsFloorReconciled",{enumerable:!0,get:a(function(){return zi.assertTsFloorReconciled},"get")});Object.defineProperty(y,"isTsFloorAssetSpace",{enumerable:!0,get:a(function(){return zi.isTsFloorAssetSpace},"get")});Object.defineProperty(y,"isTsFloorMountPath",{enumerable:!0,get:a(function(){return zi.isTsFloorMountPath},"get")});var Gce=u3();Object.defineProperty(y,"transitiveDependsOnClosure",{enumerable:!0,get:a(function(){return Gce.transitiveDependsOnClosure},"get")});var Td=n1();Object.defineProperty(y,"DEPENDENCY_KIND_TBOX_UID",{enumerable:!0,get:a(function(){return Td.DEPENDENCY_KIND_TBOX_UID},"get")});Object.defineProperty(y,"DEPENDENCY_KIND_REFERENCE_UID",{enumerable:!0,get:a(function(){return Td.DEPENDENCY_KIND_REFERENCE_UID},"get")});Object.defineProperty(y,"PARKED_ROOT",{enumerable:!0,get:a(function(){return Td.PARKED_ROOT},"get")});Object.defineProperty(y,"classifyMountTransition",{enumerable:!0,get:a(function(){return Td.classifyMountTransition},"get")});Object.defineProperty(y,"parkedPathFor",{enumerable:!0,get:a(function(){return Td.parkedPathFor},"get")});Object.defineProperty(y,"resolveDependencyKind",{enumerable:!0,get:a(function(){return Td.resolveDependencyKind},"get")});var qce=m3();Object.defineProperty(y,"ParkedAssetIndex",{enumerable:!0,get:a(function(){return qce.ParkedAssetIndex},"get")});var i9=Py();Object.defineProperty(y,"PropertyFieldType",{enumerable:!0,get:a(function(){return i9.PropertyFieldType},"get")});Object.defineProperty(y,"rangeToFieldType",{enumerable:!0,get:a(function(){return i9.rangeToFieldType},"get")});var GC=a1();Object.defineProperty(y,"propertyNameToUri",{enumerable:!0,get:a(function(){return GC.propertyNameToUri},"get")});Object.defineProperty(y,"uriToPropertyName",{enumerable:!0,get:a(function(){return GC.uriToPropertyName},"get")});Object.defineProperty(y,"extractPropertyLabel",{enumerable:!0,get:a(function(){return GC.extractPropertyLabel},"get")});var Wce=Lk();Object.defineProperty(y,"CommandResolver",{enumerable:!0,get:a(function(){return Wce.CommandResolver},"get")});var zce=kk();Object.defineProperty(y,"PreconditionEvaluator",{enumerable:!0,get:a(function(){return zce.PreconditionEvaluator},"get")});var qC=Mk();Object.defineProperty(y,"hasNonUidFilename",{enumerable:!0,get:a(function(){return qC.hasNonUidFilename},"get")});Object.defineProperty(y,"hasUidFilename",{enumerable:!0,get:a(function(){return qC.hasUidFilename},"get")});Object.defineProperty(y,"registerDefaultHostFunctions",{enumerable:!0,get:a(function(){return qC.registerDefaultHostFunctions},"get")});var Ad=sM();Object.defineProperty(y,"GroundingExecutor",{enumerable:!0,get:a(function(){return Ad.GroundingExecutor},"get")});Object.defineProperty(y,"ServiceRegistry",{enumerable:!0,get:a(function(){return Ad.ServiceRegistry},"get")});Object.defineProperty(y,"missingInputError",{enumerable:!0,get:a(function(){return Ad.missingInputError},"get")});Object.defineProperty(y,"findMissingInput",{enumerable:!0,get:a(function(){return Ad.findMissingInput},"get")});Object.defineProperty(y,"findInputSchemaViolation",{enumerable:!0,get:a(function(){return Ad.findInputSchemaViolation},"get")});Object.defineProperty(y,"missingRequiredInputError",{enumerable:!0,get:a(function(){return Ad.missingRequiredInputError},"get")});var Hce=oM();Object.defineProperty(y,"createVaultFrontmatterClassLabelResolver",{enumerable:!0,get:a(function(){return Hce.createVaultFrontmatterClassLabelResolver},"get")});var Kce=aM();Object.defineProperty(y,"createVaultFrontmatterRefToFolderResolver",{enumerable:!0,get:a(function(){return Kce.createVaultFrontmatterRefToFolderResolver},"get")});var Yce=cM();Object.defineProperty(y,"createVaultFrontmatterRefToFrontmatterResolver",{enumerable:!0,get:a(function(){return Yce.createVaultFrontmatterRefToFrontmatterResolver},"get")});var Xce=uM();Object.defineProperty(y,"NamedQueryRunner",{enumerable:!0,get:a(function(){return Xce.NamedQueryRunner},"get")});var Qce=ca();Object.defineProperty(y,"iriToObsidianName",{enumerable:!0,get:a(function(){return Qce.iriToObsidianName},"get")});var s9=fM();Object.defineProperty(y,"extractSparqlBlock",{enumerable:!0,get:a(function(){return s9.extractSparqlBlock},"get")});Object.defineProperty(y,"stripFrontmatter",{enumerable:!0,get:a(function(){return s9.stripFrontmatter},"get")});var Jce=pM();Object.defineProperty(y,"CommandExecutionFlow",{enumerable:!0,get:a(function(){return Jce.CommandExecutionFlow},"get")});var o9=_M();Object.defineProperty(y,"createTripleStoreRequiredPropertyResolver",{enumerable:!0,get:a(function(){return o9.createTripleStoreRequiredPropertyResolver},"get")});Object.defineProperty(y,"createTripleStoreClassPropertyResolver",{enumerable:!0,get:a(function(){return o9.createTripleStoreClassPropertyResolver},"get")});var Zce=EM();Object.defineProperty(y,"createTripleStoreDeclaredRanges",{enumerable:!0,get:a(function(){return Zce.createTripleStoreDeclaredRanges},"get")});var ele=jI();Object.defineProperty(y,"TaskStatusService",{enumerable:!0,get:a(function(){return ele.TaskStatusService},"get")});var tle=UI();Object.defineProperty(y,"AreaHierarchyBuilder",{enumerable:!0,get:a(function(){return tle.AreaHierarchyBuilder},"get")});var rle=WI();Object.defineProperty(y,"ClassCreationService",{enumerable:!0,get:a(function(){return rle.ClassCreationService},"get")});var nle=KI();Object.defineProperty(y,"ConceptCreationService",{enumerable:!0,get:a(function(){return nle.ConceptCreationService},"get")});var ile=Xb();Object.defineProperty(y,"EffortStatusWorkflow",{enumerable:!0,get:a(function(){return ile.EffortStatusWorkflow},"get")});var sle=Nh();Object.defineProperty(y,"WorkflowEngine",{enumerable:!0,get:a(function(){return sle.WorkflowEngine},"get")});var ole=II();Object.defineProperty(y,"WorkflowResolver",{enumerable:!0,get:a(function(){return ole.WorkflowResolver},"get")});var Sm=Sb();Object.defineProperty(y,"installDefaultResolvers",{enumerable:!0,get:a(function(){return Sm.installDefaultResolvers},"get")});Object.defineProperty(y,"getResolver",{enumerable:!0,get:a(function(){return Sm.getResolver},"get")});Object.defineProperty(y,"registerResolver",{enumerable:!0,get:a(function(){return Sm.registerResolver},"get")});Object.defineProperty(y,"clearResolvers",{enumerable:!0,get:a(function(){return Sm.clearResolvers},"get")});Object.defineProperty(y,"getRegisteredResolverIds",{enumerable:!0,get:a(function(){return Sm.getRegisteredResolverIds},"get")});var a9=ZA();Object.defineProperty(y,"resolveTemplateBody",{enumerable:!0,get:a(function(){return a9.resolveTemplateBody},"get")});Object.defineProperty(y,"stripTemplateFrontmatter",{enumerable:!0,get:a(function(){return a9.stripTemplateFrontmatter},"get")});var ale=kM();Object.defineProperty(y,"InstantiationRuleResolver",{enumerable:!0,get:a(function(){return ale.InstantiationRuleResolver},"get")});var cle=MM();Object.defineProperty(y,"VisibilityGenerator",{enumerable:!0,get:a(function(){return cle.VisibilityGenerator},"get")});var lle=jM();Object.defineProperty(y,"WorkflowCommandAdapter",{enumerable:!0,get:a(function(){return lle.WorkflowCommandAdapter},"get")});var ule=Zb();Object.defineProperty(y,"FolderRepairService",{enumerable:!0,get:a(function(){return ule.FolderRepairService},"get")});var fle=Yl();Object.defineProperty(y,"extractAssetReference",{enumerable:!0,get:a(function(){return fle.extractAssetReference},"get")});var dle=Xl();Object.defineProperty(y,"LoggingService",{enumerable:!0,get:a(function(){return dle.LoggingService},"get")});var ple=r2();Object.defineProperty(y,"PropertyCleanupService",{enumerable:!0,get:a(function(){return ple.PropertyCleanupService},"get")});var hle=i2();Object.defineProperty(y,"RenameToUidService",{enumerable:!0,get:a(function(){return hle.RenameToUidService},"get")});var mle=Qb();Object.defineProperty(y,"StatusTimestampService",{enumerable:!0,get:a(function(){return mle.StatusTimestampService},"get")});var PS=Tb();Object.defineProperty(y,"registerOrderSpecLoader",{enumerable:!0,get:a(function(){return PS.registerOrderSpecLoader},"get")});Object.defineProperty(y,"clearOrderSpecLoader",{enumerable:!0,get:a(function(){return PS.clearOrderSpecLoader},"get")});Object.defineProperty(y,"loadDefaultSpec",{enumerable:!0,get:a(function(){return PS.loadDefaultSpec},"get")});Object.defineProperty(y,"orderProperties",{enumerable:!0,get:a(function(){return PS.orderProperties},"get")});var gle=WM();Object.defineProperty(y,"PropertySchemaResolver",{enumerable:!0,get:a(function(){return gle.PropertySchemaResolver},"get")});var yle=zM();Object.defineProperty(y,"ClassHierarchyResolver",{enumerable:!0,get:a(function(){return yle.ClassHierarchyResolver},"get")});var ble=HM();Object.defineProperty(y,"EnumValueResolver",{enumerable:!0,get:a(function(){return ble.EnumValueResolver},"get")});var _le=l2();Object.defineProperty(y,"GenericAssetCreationService",{enumerable:!0,get:a(function(){return _le.GenericAssetCreationService},"get")});var Sle=QM();Object.defineProperty(y,"ArchiveAssetService",{enumerable:!0,get:a(function(){return Sle.ArchiveAssetService},"get")});var wle=ZM();Object.defineProperty(y,"FixMissingLabelService",{enumerable:!0,get:a(function(){return wle.FixMissingLabelService},"get")});var Ele=ej();Object.defineProperty(y,"GraphQueryService",{enumerable:!0,get:a(function(){return Ele.GraphQueryService},"get")});var vle=rj();Object.defineProperty(y,"TypeRegistry",{enumerable:!0,get:a(function(){return vle.TypeRegistry},"get")});var Tle=nj();Object.defineProperty(y,"SPARQL_PREFIXES",{enumerable:!0,get:a(function(){return Tle.SPARQL_PREFIXES},"get")});var Ale=Kl();Object.defineProperty(y,"FrontmatterService",{enumerable:!0,get:a(function(){return Ale.FrontmatterService},"get")});var OS=Ll();Object.defineProperty(y,"quoteYamlString",{enumerable:!0,get:a(function(){return OS.quoteYamlString},"get")});Object.defineProperty(y,"serializeYamlScalar",{enumerable:!0,get:a(function(){return OS.serializeYamlScalar},"get")});Object.defineProperty(y,"scalarTypingForRange",{enumerable:!0,get:a(function(){return OS.scalarTypingForRange},"get")});Object.defineProperty(y,"STRING_SCALAR_PROPERTIES",{enumerable:!0,get:a(function(){return OS.STRING_SCALAR_PROPERTIES},"get")});var Ile=ij();Object.defineProperty(y,"parseYamlFrontmatterTolerant",{enumerable:!0,get:a(function(){return Ile.parseYamlFrontmatterTolerant},"get")});var Rle=vs();Object.defineProperty(y,"DateFormatter",{enumerable:!0,get:a(function(){return Rle.DateFormatter},"get")});var Cle=po();Object.defineProperty(y,"WikiLinkHelpers",{enumerable:!0,get:a(function(){return Cle.WikiLinkHelpers},"get")});var WC=sj();Object.defineProperty(y,"resolveSubsumedClassKeys",{enumerable:!0,get:a(function(){return WC.resolveSubsumedClassKeys},"get")});Object.defineProperty(y,"instanceClassMatches",{enumerable:!0,get:a(function(){return WC.instanceClassMatches},"get")});Object.defineProperty(y,"extractClassRefTarget",{enumerable:!0,get:a(function(){return WC.extractClassRefTarget},"get")});var xle=Sa();Object.defineProperty(y,"MetadataHelpers",{enumerable:!0,get:a(function(){return xle.MetadataHelpers},"get")});var Ple=oj();Object.defineProperty(y,"MetadataExtractor",{enumerable:!0,get:a(function(){return Ple.MetadataExtractor},"get")});var Ole=aj();Object.defineProperty(y,"EffortSortingHelpers",{enumerable:!0,get:a(function(){return Ole.EffortSortingHelpers},"get")});var Fle=cj();Object.defineProperty(y,"FilenameValidator",{enumerable:!0,get:a(function(){return Fle.FilenameValidator},"get")});var Dle=mj();Object.defineProperty(y,"RDFSerializer",{enumerable:!0,get:a(function(){return Dle.RDFSerializer},"get")});var Lle=ih();Object.defineProperty(y,"NullLogger",{enumerable:!0,get:a(function(){return Lle.NullLogger},"get")});var zC=Rb();Object.defineProperty(y,"vaultPathToIRI",{enumerable:!0,get:a(function(){return zC.vaultPathToIRI},"get")});Object.defineProperty(y,"iriToVaultPath",{enumerable:!0,get:a(function(){return zC.iriToVaultPath},"get")});Object.defineProperty(y,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:a(function(){return zC.OBSIDIAN_VAULT_SCHEME},"get")});var Nle=LI();Object.defineProperty(y,"InMemoryTripleStore",{enumerable:!0,get:a(function(){return Nle.InMemoryTripleStore},"get")});var kle=De();Object.defineProperty(y,"DomainIRI",{enumerable:!0,get:a(function(){return kle.IRI},"get")});var Mle=He();Object.defineProperty(y,"DomainLiteral",{enumerable:!0,get:a(function(){return Mle.Literal},"get")});var jle=sr();Object.defineProperty(y,"DomainBlankNode",{enumerable:!0,get:a(function(){return jle.BlankNode},"get")});var $le=Ti();Object.defineProperty(y,"DomainTriple",{enumerable:!0,get:a(function(){return $le.Triple},"get")});var Ule=tI();Object.defineProperty(y,"RDFVocabularyMapper",{enumerable:!0,get:a(function(){return Ule.RDFVocabularyMapper},"get")});var Ble=gj();Object.defineProperty(y,"RDFSInferenceEngine",{enumerable:!0,get:a(function(){return Ble.RDFSInferenceEngine},"get")});var Vle=P2();Object.defineProperty(y,"NonInheritablePropertyRegistry",{enumerable:!0,get:a(function(){return Vle.NonInheritablePropertyRegistry},"get")});var Gle=D2();Object.defineProperty(y,"PropertyCardinalityRegistry",{enumerable:!0,get:a(function(){return Gle.PropertyCardinalityRegistry},"get")});var c9=k2();Object.defineProperty(y,"PrototypeChainMaterializer",{enumerable:!0,get:a(function(){return c9.PrototypeChainMaterializer},"get")});Object.defineProperty(y,"INFERRED_GRAPH",{enumerable:!0,get:a(function(){return c9.INFERRED_GRAPH},"get")});var qle=vj();Object.defineProperty(y,"IRICanonicalizer",{enumerable:!0,get:a(function(){return qle.IRICanonicalizer},"get")});var HC=xb();Object.defineProperty(y,"derivePath",{enumerable:!0,get:a(function(){return HC.derivePath},"get")});Object.defineProperty(y,"deriveUrl",{enumerable:!0,get:a(function(){return HC.deriveUrl},"get")});Object.defineProperty(y,"deriveLegacyFlatPath",{enumerable:!0,get:a(function(){return HC.deriveLegacyFlatPath},"get")});var KC=Pb();Object.defineProperty(y,"discoverFileSpaceExclusions",{enumerable:!0,get:a(function(){return KC.discoverFileSpaceExclusions},"get")});Object.defineProperty(y,"frontmatterDeclaresFileSpace",{enumerable:!0,get:a(function(){return KC.frontmatterDeclaresFileSpace},"get")});Object.defineProperty(y,"FILE_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return KC.FILE_SPACE_CLASS_UID},"get")});var l9=Tj();Object.defineProperty(y,"LazyAssetGraphLoader",{enumerable:!0,get:a(function(){return l9.LazyAssetGraphLoader},"get")});Object.defineProperty(y,"MAX_LAZY_DEPTH",{enumerable:!0,get:a(function(){return l9.MAX_LAZY_DEPTH},"get")});var u9=U2();Object.defineProperty(y,"SourceAnnotator",{enumerable:!0,get:a(function(){return u9.SourceAnnotator},"get")});Object.defineProperty(y,"SOURCE_VARIABLE",{enumerable:!0,get:a(function(){return u9.SOURCE_VARIABLE},"get")});var Fc=Hl();Object.defineProperty(y,"NoteToRDFConverter",{enumerable:!0,get:a(function(){return Fc.NoteToRDFConverter},"get")});Object.defineProperty(y,"normaliseExcludedFolders",{enumerable:!0,get:a(function(){return Fc.normaliseExcludedFolders},"get")});Object.defineProperty(y,"isPathExcluded",{enumerable:!0,get:a(function(){return Fc.isPathExcluded},"get")});Object.defineProperty(y,"UNPREFIXED_ASSET_FIELDS",{enumerable:!0,get:a(function(){return Fc.UNPREFIXED_ASSET_FIELDS},"get")});Object.defineProperty(y,"LEGACY_UNPREFIXED_ASSET_FIELDS",{enumerable:!0,get:a(function(){return Fc.LEGACY_UNPREFIXED_ASSET_FIELDS},"get")});Object.defineProperty(y,"LEGACY_YAML_KEYS",{enumerable:!0,get:a(function(){return Fc.LEGACY_YAML_KEYS},"get")});Object.defineProperty(y,"canonicalYamlKey",{enumerable:!0,get:a(function(){return Fc.canonicalYamlKey},"get")});Object.defineProperty(y,"isPosixBracketExpression",{enumerable:!0,get:a(function(){return Fc.isPosixBracketExpression},"get")});var YC=mf();Object.defineProperty(y,"ExoQLParser",{enumerable:!0,get:a(function(){return YC.ExoQLParser},"get")});Object.defineProperty(y,"SPARQLParser",{enumerable:!0,get:a(function(){return YC.SPARQLParser},"get")});Object.defineProperty(y,"SPARQLParseError",{enumerable:!0,get:a(function(){return YC.SPARQLParseError},"get")});var f9=qT();Object.defineProperty(y,"DescribeOptionsTransformer",{enumerable:!0,get:a(function(){return f9.DescribeOptionsTransformer},"get")});Object.defineProperty(y,"DescribeOptionsTransformerError",{enumerable:!0,get:a(function(){return f9.DescribeOptionsTransformerError},"get")});var d9=wf();Object.defineProperty(y,"ExoQLAlgebraTranslator",{enumerable:!0,get:a(function(){return d9.ExoQLAlgebraTranslator},"get")});Object.defineProperty(y,"AlgebraTranslator",{enumerable:!0,get:a(function(){return d9.AlgebraTranslator},"get")});var Wle=Aj();Object.defineProperty(y,"AlgebraOptimizer",{enumerable:!0,get:a(function(){return Wle.AlgebraOptimizer},"get")});var zle=Ij();Object.defineProperty(y,"AlgebraSerializer",{enumerable:!0,get:a(function(){return zle.AlgebraSerializer},"get")});var Hle=fA();Object.defineProperty(y,"BGPExecutor",{enumerable:!0,get:a(function(){return Hle.BGPExecutor},"get")});var Kle=eb();Object.defineProperty(y,"FilterExecutor",{enumerable:!0,get:a(function(){return Kle.FilterExecutor},"get")});var Yle=PA();Object.defineProperty(y,"OptionalExecutor",{enumerable:!0,get:a(function(){return Yle.OptionalExecutor},"get")});var Xle=FA();Object.defineProperty(y,"UnionExecutor",{enumerable:!0,get:a(function(){return Xle.UnionExecutor},"get")});var Qle=UA();Object.defineProperty(y,"ConstructExecutor",{enumerable:!0,get:a(function(){return Qle.ConstructExecutor},"get")});var Jle=Cj();Object.defineProperty(y,"DescribeExecutor",{enumerable:!0,get:a(function(){return Jle.DescribeExecutor},"get")});var p9=Uf();Object.defineProperty(y,"ExoQLQueryExecutor",{enumerable:!0,get:a(function(){return p9.ExoQLQueryExecutor},"get")});Object.defineProperty(y,"QueryExecutor",{enumerable:!0,get:a(function(){return p9.QueryExecutor},"get")});var h9=Pj();Object.defineProperty(y,"UpdateExecutor",{enumerable:!0,get:a(function(){return h9.UpdateExecutor},"get")});Object.defineProperty(y,"UpdateExecutorError",{enumerable:!0,get:a(function(){return h9.UpdateExecutorError},"get")});var Zle=da();Object.defineProperty(y,"SolutionMapping",{enumerable:!0,get:a(function(){return Zle.SolutionMapping},"get")});var eue=Z0();Object.defineProperty(y,"BuiltInFunctions",{enumerable:!0,get:a(function(){return eue.BuiltInFunctions},"get")});var tue=Fj();Object.defineProperty(y,"AggregateFunctions",{enumerable:!0,get:a(function(){return tue.AggregateFunctions},"get")});var m9=x0();Object.defineProperty(y,"CustomAggregateRegistry",{enumerable:!0,get:a(function(){return m9.CustomAggregateRegistry},"get")});Object.defineProperty(y,"CustomAggregateError",{enumerable:!0,get:a(function(){return m9.CustomAggregateError},"get")});var No=O0();Object.defineProperty(y,"BUILT_IN_AGGREGATES",{enumerable:!0,get:a(function(){return No.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(y,"EXO_AGGREGATE_NS",{enumerable:!0,get:a(function(){return No.EXO_AGGREGATE_NS},"get")});Object.defineProperty(y,"medianAggregate",{enumerable:!0,get:a(function(){return No.medianAggregate},"get")});Object.defineProperty(y,"varianceAggregate",{enumerable:!0,get:a(function(){return No.varianceAggregate},"get")});Object.defineProperty(y,"stddevAggregate",{enumerable:!0,get:a(function(){return No.stddevAggregate},"get")});Object.defineProperty(y,"modeAggregate",{enumerable:!0,get:a(function(){return No.modeAggregate},"get")});Object.defineProperty(y,"createPercentileAggregate",{enumerable:!0,get:a(function(){return No.createPercentileAggregate},"get")});Object.defineProperty(y,"getNumericValue",{enumerable:!0,get:a(function(){return No.getNumericValue},"get")});Object.defineProperty(y,"createDecimalLiteral",{enumerable:!0,get:a(function(){return No.createDecimalLiteral},"get")});Object.defineProperty(y,"createDoubleLiteral",{enumerable:!0,get:a(function(){return No.createDoubleLiteral},"get")});var rue=Dj();Object.defineProperty(y,"QueryPlanCache",{enumerable:!0,get:a(function(){return rue.QueryPlanCache},"get")});var g9=Lj();Object.defineProperty(y,"SPARQLResultCache",{enumerable:!0,get:a(function(){return g9.SPARQLResultCache},"get")});Object.defineProperty(y,"createSPARQLResultCache",{enumerable:!0,get:a(function(){return g9.createSPARQLResultCache},"get")});var y9=Nj();Object.defineProperty(y,"IncrementalIndexer",{enumerable:!0,get:a(function(){return y9.IncrementalIndexer},"get")});Object.defineProperty(y,"createIncrementalIndexer",{enumerable:!0,get:a(function(){return y9.createIncrementalIndexer},"get")});var nue=kj();Object.defineProperty(y,"ResultSerializer",{enumerable:!0,get:a(function(){return nue.ResultSerializer},"get")});var b9=BT();Object.defineProperty(y,"CaseWhenTransformer",{enumerable:!0,get:a(function(){return b9.CaseWhenTransformer},"get")});Object.defineProperty(y,"CaseWhenTransformerError",{enumerable:!0,get:a(function(){return b9.CaseWhenTransformerError},"get")});var iue=KT();Object.defineProperty(y,"VaultPrefixTransformer",{enumerable:!0,get:a(function(){return iue.VaultPrefixTransformer},"get")});var sue=V2();Object.defineProperty(y,"FilterContainsOptimizer",{enumerable:!0,get:a(function(){return sue.FilterContainsOptimizer},"get")});var _9=Mj();Object.defineProperty(y,"FileNotFoundError",{enumerable:!0,get:a(function(){return _9.FileNotFoundError},"get")});Object.defineProperty(y,"FileAlreadyExistsError",{enumerable:!0,get:a(function(){return _9.FileAlreadyExistsError},"get")});var XC=PI();Object.defineProperty(y,"TripleAlreadyExistsError",{enumerable:!0,get:a(function(){return XC.TripleAlreadyExistsError},"get")});Object.defineProperty(y,"TripleNotFoundError",{enumerable:!0,get:a(function(){return XC.TripleNotFoundError},"get")});Object.defineProperty(y,"TransactionError",{enumerable:!0,get:a(function(){return XC.TransactionError},"get")});var S9=Ih();Object.defineProperty(y,"liveClock",{enumerable:!0,get:a(function(){return S9.liveClock},"get")});Object.defineProperty(y,"frozenClock",{enumerable:!0,get:a(function(){return S9.frozenClock},"get")});var w9=yb();Object.defineProperty(y,"liveUidGenerator",{enumerable:!0,get:a(function(){return w9.liveUidGenerator},"get")});Object.defineProperty(y,"seededUidGenerator",{enumerable:!0,get:a(function(){return w9.seededUidGenerator},"get")});var FS=tR();Object.defineProperty(y,"VaultSettings",{enumerable:!0,get:a(function(){return FS.VaultSettings},"get")});Object.defineProperty(y,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:a(function(){return FS.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(y,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:a(function(){return FS.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(y,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:a(function(){return FS.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var oue=si();Object.defineProperty(y,"DI_TOKENS",{enumerable:!0,get:a(function(){return oue.DI_TOKENS},"get")});var wm=jj();Object.defineProperty(y,"registerCoreServices",{enumerable:!0,get:a(function(){return wm.registerCoreServices},"get")});Object.defineProperty(y,"createChildContainer",{enumerable:!0,get:a(function(){return wm.createChildContainer},"get")});Object.defineProperty(y,"getContainer",{enumerable:!0,get:a(function(){return wm.getContainer},"get")});Object.defineProperty(y,"resetContainer",{enumerable:!0,get:a(function(){return wm.resetContainer},"get")});Object.defineProperty(y,"container",{enumerable:!0,get:a(function(){return wm.container},"get")});var Ma=qj();Object.defineProperty(y,"NODE_FLAGS",{enumerable:!0,get:a(function(){return Ma.NODE_FLAGS},"get")});Object.defineProperty(y,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return Ma.DEFAULT_COLORS},"get")});Object.defineProperty(y,"StringTable",{enumerable:!0,get:a(function(){return Ma.StringTable},"get")});Object.defineProperty(y,"CompactGraphStore",{enumerable:!0,get:a(function(){return Ma.CompactGraphStore},"get")});Object.defineProperty(y,"MemoryPool",{enumerable:!0,get:a(function(){return Ma.MemoryPool},"get")});Object.defineProperty(y,"getGlobalPool",{enumerable:!0,get:a(function(){return Ma.getGlobalPool},"get")});Object.defineProperty(y,"resetGlobalPool",{enumerable:!0,get:a(function(){return Ma.resetGlobalPool},"get")});Object.defineProperty(y,"StreamingLoader",{enumerable:!0,get:a(function(){return Ma.StreamingLoader},"get")});Object.defineProperty(y,"createStreamingSource",{enumerable:!0,get:a(function(){return Ma.createStreamingSource},"get")});var E9=Wj();Object.defineProperty(y,"ExoQL",{enumerable:!0,get:a(function(){return E9.ExoQL},"get")});Object.defineProperty(y,"ExoQLError",{enumerable:!0,get:a(function(){return E9.ExoQLError},"get")});var Em=N_();Object.defineProperty(y,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return Em.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(y,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return Em.LAYOUT_CLASS_UID},"get")});Object.defineProperty(y,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return Em.createLayoutFromFrontmatter},"get")});Object.defineProperty(y,"isLayout",{enumerable:!0,get:a(function(){return Em.isLayout},"get")});Object.defineProperty(y,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return Em.isLayoutFrontmatter},"get")});var Vs=N_();Object.defineProperty(y,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Vs.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Vs.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Vs.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Vs.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Vs.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Vs.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return Vs.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(y,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return Vs.isBacklinksTableBlock},"get")});Object.defineProperty(y,"isDailyEffortsByClassBlock",{enumerable:!0,get:a(function(){return Vs.isDailyEffortsByClassBlock},"get")});Object.defineProperty(y,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return Vs.isLayoutBlockFrontmatter},"get")});Object.defineProperty(y,"isPropertiesBlock",{enumerable:!0,get:a(function(){return Vs.isPropertiesBlock},"get")});var ja=N_();Object.defineProperty(y,"BUILTIN_DAILY_EFFORTS_VISIBILITY",{enumerable:!0,get:a(function(){return ja.BUILTIN_DAILY_EFFORTS_VISIBILITY},"get")});Object.defineProperty(y,"DAILY_EFFORTS_OVERRIDE_KEYS",{enumerable:!0,get:a(function(){return ja.DAILY_EFFORTS_OVERRIDE_KEYS},"get")});Object.defineProperty(y,"coerceVisibilityOverride",{enumerable:!0,get:a(function(){return ja.coerceVisibilityOverride},"get")});Object.defineProperty(y,"resolveBlockVisibility",{enumerable:!0,get:a(function(){return ja.resolveBlockVisibility},"get")});Object.defineProperty(y,"resolveDailyEffortVisibility",{enumerable:!0,get:a(function(){return ja.resolveDailyEffortVisibility},"get")});Object.defineProperty(y,"EMS_ACTION_CLASS_UID",{enumerable:!0,get:a(function(){return ja.EMS_ACTION_CLASS_UID},"get")});Object.defineProperty(y,"classListMatches",{enumerable:!0,get:a(function(){return ja.classListMatches},"get")});Object.defineProperty(y,"EMS_PROJECT_CLASS_UID",{enumerable:!0,get:a(function(){return ja.EMS_PROJECT_CLASS_UID},"get")});Object.defineProperty(y,"partitionDailyEffortsByClass",{enumerable:!0,get:a(function(){return ja.partitionDailyEffortsByClass},"get")});var v9=n$();Object.defineProperty(y,"LayoutSelector",{enumerable:!0,get:a(function(){return v9.LayoutSelector},"get")});Object.defineProperty(y,"selectByPriority",{enumerable:!0,get:a(function(){return v9.selectByPriority},"get")});Ni(d$(),y);var aue=h$();Object.defineProperty(y,"ShapeLoader",{enumerable:!0,get:a(function(){return aue.ShapeLoader},"get")});var cue=TR();Object.defineProperty(y,"ShapeRegistry",{enumerable:!0,get:a(function(){return cue.ShapeRegistry},"get")});var lue=qt();Object.defineProperty(y,"Namespace",{enumerable:!0,get:a(function(){return lue.Namespace},"get")});var T9=xR();Object.defineProperty(y,"shaclValidate",{enumerable:!0,get:a(function(){return T9.validate},"get")});Object.defineProperty(y,"ShaclShapeRegistry",{enumerable:!0,get:a(function(){return T9.ShapeRegistry},"get")});Ni(S$(),y);var uue=w$();Object.defineProperty(y,"TripleClassHierarchy",{enumerable:!0,get:a(function(){return uue.ClassHierarchy},"get")});var A9=DR();Object.defineProperty(y,"parseTarball",{enumerable:!0,get:a(function(){return A9.parseTarball},"get")});Object.defineProperty(y,"parseTarballGzip",{enumerable:!0,get:a(function(){return A9.parseTarballGzip},"get")});var I9=J_();Object.defineProperty(y,"restCreateCommit",{enumerable:!0,get:a(function(){return I9.restCreateCommit},"get")});Object.defineProperty(y,"isBinaryPayload",{enumerable:!0,get:a(function(){return I9.isBinaryPayload},"get")});var Dc=C$();Object.defineProperty(y,"mountAssetSpaceFiles",{enumerable:!0,get:a(function(){return Dc.mountAssetSpaceFiles},"get")});Object.defineProperty(y,"discoverAssetSpaceWrapperDir",{enumerable:!0,get:a(function(){return Dc.discoverWrapperDir},"get")});Object.defineProperty(y,"extractAssetSpaceSha",{enumerable:!0,get:a(function(){return Dc.extractShaFromWrapper},"get")});Object.defineProperty(y,"appendGitmodulesEntry",{enumerable:!0,get:a(function(){return Dc.appendGitmodulesEntry},"get")});Object.defineProperty(y,"stripGitmodulesEntry",{enumerable:!0,get:a(function(){return Dc.stripGitmodulesEntry},"get")});Object.defineProperty(y,"escapeGitmodulesRegex",{enumerable:!0,get:a(function(){return Dc.escapeGitmodulesRegex},"get")});Object.defineProperty(y,"MATERIALIZE_PROGRESS_INTERVAL",{enumerable:!0,get:a(function(){return Dc.MATERIALIZE_PROGRESS_INTERVAL},"get")});Object.defineProperty(y,"MATERIALIZE_PROGRESS_MIN_FILES",{enumerable:!0,get:a(function(){return Dc.MATERIALIZE_PROGRESS_MIN_FILES},"get")});var R9=Zh();Object.defineProperty(y,"detectChanges",{enumerable:!0,get:a(function(){return R9.detectChanges},"get")});Object.defineProperty(y,"extractAssetUid",{enumerable:!0,get:a(function(){return R9.extractAssetUid},"get")});var fue=pd();Object.defineProperty(y,"gitBlobSha",{enumerable:!0,get:a(function(){return fue.gitBlobSha},"get")});var QC=F$();Object.defineProperty(y,"rewriteAssetUid",{enumerable:!0,get:a(function(){return QC.rewriteAssetUid},"get")});Object.defineProperty(y,"findDuplicateUidGroups",{enumerable:!0,get:a(function(){return QC.findDuplicateUidGroups},"get")});Object.defineProperty(y,"planDuplicateUidFix",{enumerable:!0,get:a(function(){return QC.planDuplicateUidFix},"get")});var vm=hd();Object.defineProperty(y,"getBlobBytes",{enumerable:!0,get:a(function(){return vm.getBlobBytes},"get")});Object.defineProperty(y,"getBlobText",{enumerable:!0,get:a(function(){return vm.getBlobText},"get")});Object.defineProperty(y,"getCommitInfo",{enumerable:!0,get:a(function(){return vm.getCommitInfo},"get")});Object.defineProperty(y,"getHeadSha",{enumerable:!0,get:a(function(){return vm.getHeadSha},"get")});Object.defineProperty(y,"getTree",{enumerable:!0,get:a(function(){return vm.getTree},"get")});var due=N$();Object.defineProperty(y,"checkParkedStaleness",{enumerable:!0,get:a(function(){return due.checkParkedStaleness},"get")});var Id=a4();Object.defineProperty(y,"DEFAULT_MAX_PUSH_RETRIES",{enumerable:!0,get:a(function(){return Id.DEFAULT_MAX_PUSH_RETRIES},"get")});Object.defineProperty(y,"DEFAULT_LOCAL_MANIFEST_REHASH_MS",{enumerable:!0,get:a(function(){return Id.DEFAULT_LOCAL_MANIFEST_REHASH_MS},"get")});Object.defineProperty(y,"SyncEngine",{enumerable:!0,get:a(function(){return Id.SyncEngine},"get")});Object.defineProperty(y,"isNonFastForwardError",{enumerable:!0,get:a(function(){return Id.isNonFastForwardError},"get")});Object.defineProperty(y,"orderChildrenFirst",{enumerable:!0,get:a(function(){return Id.orderChildrenFirst},"get")});Object.defineProperty(y,"syncProgressPhaseText",{enumerable:!0,get:a(function(){return Id.syncProgressPhaseText},"get")});var Gs=VR();Object.defineProperty(y,"SyncPhaseTimer",{enumerable:!0,get:a(function(){return Gs.SyncPhaseTimer},"get")});Object.defineProperty(y,"SYNC_PHASES",{enumerable:!0,get:a(function(){return Gs.SYNC_PHASES},"get")});Object.defineProperty(y,"classifyRestPhase",{enumerable:!0,get:a(function(){return Gs.classifyRestPhase},"get")});Object.defineProperty(y,"emptyTimings",{enumerable:!0,get:a(function(){return Gs.emptyTimings},"get")});Object.defineProperty(y,"addTimings",{enumerable:!0,get:a(function(){return Gs.addTimings},"get")});Object.defineProperty(y,"aggregateTimings",{enumerable:!0,get:a(function(){return Gs.aggregateTimings},"get")});Object.defineProperty(y,"totalMs",{enumerable:!0,get:a(function(){return Gs.totalMs},"get")});Object.defineProperty(y,"dominantPhase",{enumerable:!0,get:a(function(){return Gs.dominantPhase},"get")});Object.defineProperty(y,"fmtMs",{enumerable:!0,get:a(function(){return Gs.fmtMs},"get")});Object.defineProperty(y,"formatTimingsLine",{enumerable:!0,get:a(function(){return Gs.formatTimingsLine},"get")});Object.defineProperty(y,"formatRepoTimings",{enumerable:!0,get:a(function(){return Gs.formatRepoTimings},"get")});var C9=l4();Object.defineProperty(y,"QuarantineResolver",{enumerable:!0,get:a(function(){return C9.QuarantineResolver},"get")});Object.defineProperty(y,"backupPathFor",{enumerable:!0,get:a(function(){return C9.backupPathFor},"get")});var Tm=aS();Object.defineProperty(y,"DEFAULT_MAX_FILE_BYTES",{enumerable:!0,get:a(function(){return Tm.DEFAULT_MAX_FILE_BYTES},"get")});Object.defineProperty(y,"InMemoryQuarantineStore",{enumerable:!0,get:a(function(){return Tm.InMemoryQuarantineStore},"get")});Object.defineProperty(y,"contentEquals",{enumerable:!0,get:a(function(){return Tm.contentEquals},"get")});Object.defineProperty(y,"isFileSpaceSyncablePath",{enumerable:!0,get:a(function(){return Tm.isFileSpaceSyncablePath},"get")});Object.defineProperty(y,"isSyncablePath",{enumerable:!0,get:a(function(){return Tm.isSyncablePath},"get")});var x9=u4();Object.defineProperty(y,"FileLocalManifestStore",{enumerable:!0,get:a(function(){return x9.FileLocalManifestStore},"get")});Object.defineProperty(y,"LOCAL_MANIFEST_STORE_FILENAME",{enumerable:!0,get:a(function(){return x9.LOCAL_MANIFEST_STORE_FILENAME},"get")});var pue=oC();Object.defineProperty(y,"diff3",{enumerable:!0,get:a(function(){return pue.diff3},"get")});var P9=p4();Object.defineProperty(y,"StructuredMerger",{enumerable:!0,get:a(function(){return P9.StructuredMerger},"get")});Object.defineProperty(y,"splitSections",{enumerable:!0,get:a(function(){return P9.splitSections},"get")});var hue=h4();Object.defineProperty(y,"MergeShaclGate",{enumerable:!0,get:a(function(){return hue.MergeShaclGate},"get")});var mue=m4();Object.defineProperty(y,"GatedStructuredMerger",{enumerable:!0,get:a(function(){return mue.GatedStructuredMerger},"get")});var O9=g4();Object.defineProperty(y,"FileWatermarkStore",{enumerable:!0,get:a(function(){return O9.FileWatermarkStore},"get")});Object.defineProperty(y,"WATERMARK_STORE_FILENAME",{enumerable:!0,get:a(function(){return O9.WATERMARK_STORE_FILENAME},"get")});var F9=y4();Object.defineProperty(y,"FileMountBaseStore",{enumerable:!0,get:a(function(){return F9.FileMountBaseStore},"get")});Object.defineProperty(y,"MOUNT_BASE_STORE_FILENAME",{enumerable:!0,get:a(function(){return F9.MOUNT_BASE_STORE_FILENAME},"get")});var gue=iS();Object.defineProperty(y,"isAuthError",{enumerable:!0,get:a(function(){return gue.isAuthError},"get")});var Am=oS();Object.defineProperty(y,"isRateLimitError",{enumerable:!0,get:a(function(){return Am.isRateLimitError},"get")});Object.defineProperty(y,"withRateLimitBackoff",{enumerable:!0,get:a(function(){return Am.withRateLimitBackoff},"get")});Object.defineProperty(y,"createRateLimitBudget",{enumerable:!0,get:a(function(){return Am.createRateLimitBudget},"get")});Object.defineProperty(y,"MIN_RATE_LIMIT_WAIT_MS",{enumerable:!0,get:a(function(){return Am.MIN_RATE_LIMIT_WAIT_MS},"get")});Object.defineProperty(y,"DEFAULT_MAX_RETRIES",{enumerable:!0,get:a(function(){return Am.DEFAULT_MAX_RETRIES},"get")});var Rd=YR();Object.defineProperty(y,"caseInsensitiveHeaderGetter",{enumerable:!0,get:a(function(){return Rd.caseInsensitiveHeaderGetter},"get")});Object.defineProperty(y,"parseRetryAfterMs",{enumerable:!0,get:a(function(){return Rd.parseRetryAfterMs},"get")});Object.defineProperty(y,"extractRateLimitFields",{enumerable:!0,get:a(function(){return Rd.extractRateLimitFields},"get")});Object.defineProperty(y,"getRateLimitFields",{enumerable:!0,get:a(function(){return Rd.getRateLimitFields},"get")});Object.defineProperty(y,"attachRateLimitFields",{enumerable:!0,get:a(function(){return Rd.attachRateLimitFields},"get")});Object.defineProperty(y,"enrichRateLimitError",{enumerable:!0,get:a(function(){return Rd.enrichRateLimitError},"get")});var D9=zR();Object.defineProperty(y,"redactSecrets",{enumerable:!0,get:a(function(){return D9.redactSecrets},"get")});Object.defineProperty(y,"scanForSecrets",{enumerable:!0,get:a(function(){return D9.scanForSecrets},"get")});var L9=b4();Object.defineProperty(y,"LocalConflictCacheStore",{enumerable:!0,get:a(function(){return L9.LocalConflictCacheStore},"get")});Object.defineProperty(y,"CONFLICT_CACHE_STORE_FILENAME",{enumerable:!0,get:a(function(){return L9.CONFLICT_CACHE_STORE_FILENAME},"get")});var JC=rS();Object.defineProperty(y,"LocalOutboxStore",{enumerable:!0,get:a(function(){return JC.LocalOutboxStore},"get")});Object.defineProperty(y,"OUTBOX_STORE_FILENAME",{enumerable:!0,get:a(function(){return JC.OUTBOX_STORE_FILENAME},"get")});Object.defineProperty(y,"OUTBOX_REMOTE_ABSENT",{enumerable:!0,get:a(function(){return JC.OUTBOX_REMOTE_ABSENT},"get")});var Lc=nS();Object.defineProperty(y,"ASSET_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return Lc.ASSET_SPACE_CLASS_UID},"get")});Object.defineProperty(y,"SYNC_BRANCH",{enumerable:!0,get:a(function(){return Lc.SYNC_BRANCH},"get")});Object.defineProperty(y,"SpaceSpecAccumulator",{enumerable:!0,get:a(function(){return Lc.SpaceSpecAccumulator},"get")});Object.defineProperty(y,"classifySpaceDeclaration",{enumerable:!0,get:a(function(){return Lc.classifySpaceDeclaration},"get")});Object.defineProperty(y,"isAssetSpaceFrontmatter",{enumerable:!0,get:a(function(){return Lc.isAssetSpaceFrontmatter},"get")});Object.defineProperty(y,"isFileSpaceFrontmatter",{enumerable:!0,get:a(function(){return Lc.isFileSpaceFrontmatter},"get")});Object.defineProperty(y,"parseStrictGitHubRepoURL",{enumerable:!0,get:a(function(){return Lc.parseStrictGitHubRepoURL},"get")});Object.defineProperty(y,"readSpaceSource",{enumerable:!0,get:a(function(){return Lc.readSpaceSource},"get")});var N9=S4();Object.defineProperty(y,"buildAssetSpaceDescriptor",{enumerable:!0,get:a(function(){return N9.buildAssetSpaceDescriptor},"get")});Object.defineProperty(y,"deriveAssetSpaceNamespace",{enumerable:!0,get:a(function(){return N9.deriveAssetSpaceNamespace},"get")});var k9=I4();Object.defineProperty(y,"ParityValidator",{enumerable:!0,get:a(function(){return k9.ParityValidator},"get")});Object.defineProperty(y,"summarizeParityRound",{enumerable:!0,get:a(function(){return k9.summarizeParityRound},"get")});var M9=SC();Object.defineProperty(y,"compareAssetSemantics",{enumerable:!0,get:a(function(){return M9.compareAssetSemantics},"get")});Object.defineProperty(y,"isFormatOnlyDrift",{enumerable:!0,get:a(function(){return M9.isFormatOnlyDrift},"get")});Ni(M4(),y);Ni(z4(),y);var yue=MC();Object.defineProperty(y,"resolvePreferenceList",{enumerable:!0,get:a(function(){return yue.resolvePreferenceList},"get")});var bue=vS();Object.defineProperty(y,"unwrapLinkTarget",{enumerable:!0,get:a(function(){return bue.unwrapLinkTarget},"get")});var ZC=Hu();Object.defineProperty(y,"EFFORT_STATUS_UID",{enumerable:!0,get:a(function(){return ZC.EFFORT_STATUS_UID},"get")});Object.defineProperty(y,"EFFORT_STATUS_BY_UID",{enumerable:!0,get:a(function(){return ZC.EFFORT_STATUS_BY_UID},"get")});Object.defineProperty(y,"normalizeEffortStatus",{enumerable:!0,get:a(function(){return ZC.normalizeEffortStatus},"get")});var _ue=$C();Object.defineProperty(y,"DEFAULT_DISPLAY_NAME_SETTINGS",{enumerable:!0,get:a(function(){return _ue.DEFAULT_DISPLAY_NAME_SETTINGS},"get")});var Sue=Y4();Object.defineProperty(y,"PrintNameRuleService",{enumerable:!0,get:a(function(){return Sue.PrintNameRuleService},"get")});var j9=X4();Object.defineProperty(y,"DisplayNameResolver",{enumerable:!0,get:a(function(){return j9.DisplayNameResolver},"get")});Object.defineProperty(y,"createDefaultResolver",{enumerable:!0,get:a(function(){return j9.createDefaultResolver},"get")});var ex=IS();Object.defineProperty(y,"DisplayNameTemplateEngine",{enumerable:!0,get:a(function(){return ex.DisplayNameTemplateEngine},"get")});Object.defineProperty(y,"DISPLAY_NAME_PRESETS",{enumerable:!0,get:a(function(){return ex.DISPLAY_NAME_PRESETS},"get")});Object.defineProperty(y,"DEFAULT_DISPLAY_NAME_TEMPLATE",{enumerable:!0,get:a(function(){return ex.DEFAULT_DISPLAY_NAME_TEMPLATE},"get")});var $9=gm();Object.defineProperty(y,"resolveKeyPath",{enumerable:!0,get:a(function(){return $9.resolveKeyPath},"get")});Object.defineProperty(y,"isWikilink",{enumerable:!0,get:a(function(){return $9.isWikilink},"get")});var DS=n9();Object.defineProperty(y,"isEffortBlocked",{enumerable:!0,get:a(function(){return DS.isEffortBlocked},"get")});Object.defineProperty(y,"isEpisodeOngoing",{enumerable:!0,get:a(function(){return DS.isEpisodeOngoing},"get")});Object.defineProperty(y,"localToday",{enumerable:!0,get:a(function(){return DS.localToday},"get")});Object.defineProperty(y,"createDisplayMatcherHostFunctions",{enumerable:!0,get:a(function(){return DS.createDisplayMatcherHostFunctions},"get")})});var tr=Me(()=>{"use strict"});function U9(r){return r.startsWith("VALIDATION_")?"validation":r.startsWith("PERMISSION_")?"permission":r.startsWith("STATE_")?"state":"internal"}var pt,B9=Me(()=>{"use strict";a(U9,"getErrorCategory");pt=class{static{a(this,"ResponseBuilder")}static success(e,t){return{success:!0,data:e,...t&&{meta:t}}}static error(e,t,n,i){return{success:!1,error:{code:e,category:U9(e),message:t,exitCode:n,...i?.recovery&&{recovery:i.recovery},...i?.context&&{context:i.context},...i?.stack&&{stack:i.stack}}}}}});var Er=Me(()=>{"use strict";B9()});var Lr,Hi=Me(()=>{"use strict";Er();Lr=class extends Error{static{a(this,"CLIError")}constructor(e,t,n){super(e),this.name=this.constructor.name,this.context=t,this.recoveryHint=n,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
353
+ `)}a(oce,"renderSettingAssetMarkdown")});var V4=T(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});ES.exportSettings=ace;ES.importSettings=cce;var wS=SS();function ace(r,e){return r.declaredKeys().map(t=>({field:t.field,fileName:`${t.settingUid}.md`,content:(0,wS.renderSettingAssetMarkdown)(t,r.readLiveValue(t),r.settingClassUid,e.ontologyUid,e.nowIso)}))}a(ace,"exportSettings");async function cce(r,e){let t=new Map;for(let s of r.declaredKeys())t.set(s.keyUid,s),t.set(s.keyLabel,s);let n=[],i=[];for(let s of e){let o=(0,wS.extractKeyRef)(s.frontmatter),c=o!==null?t.get(o):void 0;if(c===void 0){i.push({path:s.path,reason:"unknown-key",detail:o??"<no setting key>"});continue}let l=(0,wS.coerceSettingValue)(c.datatype,(0,wS.readSettingValueRaw)(s.frontmatter));if(l===void 0){i.push({path:s.path,reason:"uncoercible",detail:`expected ${c.datatype}`});continue}await r.writeLiveValue(c,l),n.push(c.field)}return{applied:n,skipped:i}}a(cce,"importSettings")});var G4=T(hm=>{"use strict";Object.defineProperty(hm,"__esModule",{value:!0});hm.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID=void 0;hm.resolveDistributionOntology=lce;var NC=SS();hm.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID="ea44f996-64e5-46ce-8953-b13d21ee750d";function lce(r,e){for(let t of r){if((0,NC.extractKeyRef)(t.frontmatter)!==e)continue;let n=(0,NC.coerceSettingValue)("string",(0,NC.readSettingValueRaw)(t.frontmatter));if(typeof n=="string"){let i=n.trim();if(i.length>0)return i}}return null}a(lce,"resolveDistributionOntology")});var z4=T(Rt=>{"use strict";var uce=Rt&&Rt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),fce=Rt&&Rt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&uce(e,r,t)};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.resolveDistributionOntology=Rt.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID=Rt.importSettings=Rt.exportSettings=Rt.renderSettingAssetMarkdown=Rt.readSettingValueRaw=Rt.extractKeyRef=Rt.coerceSettingValue=Rt.LEGACY_SETTING_VALUE_PROPS=Rt.LEGACY_SETTING_KEY_PROPS=Rt.SETTING_VALUE_PROP=Rt.SETTING_KEY_PROP=void 0;fce($4(),Rt);var Oc=SS();Object.defineProperty(Rt,"SETTING_KEY_PROP",{enumerable:!0,get:a(function(){return Oc.SETTING_KEY_PROP},"get")});Object.defineProperty(Rt,"SETTING_VALUE_PROP",{enumerable:!0,get:a(function(){return Oc.SETTING_VALUE_PROP},"get")});Object.defineProperty(Rt,"LEGACY_SETTING_KEY_PROPS",{enumerable:!0,get:a(function(){return Oc.LEGACY_SETTING_KEY_PROPS},"get")});Object.defineProperty(Rt,"LEGACY_SETTING_VALUE_PROPS",{enumerable:!0,get:a(function(){return Oc.LEGACY_SETTING_VALUE_PROPS},"get")});Object.defineProperty(Rt,"coerceSettingValue",{enumerable:!0,get:a(function(){return Oc.coerceSettingValue},"get")});Object.defineProperty(Rt,"extractKeyRef",{enumerable:!0,get:a(function(){return Oc.extractKeyRef},"get")});Object.defineProperty(Rt,"readSettingValueRaw",{enumerable:!0,get:a(function(){return Oc.readSettingValueRaw},"get")});Object.defineProperty(Rt,"renderSettingAssetMarkdown",{enumerable:!0,get:a(function(){return Oc.renderSettingAssetMarkdown},"get")});var q4=V4();Object.defineProperty(Rt,"exportSettings",{enumerable:!0,get:a(function(){return q4.exportSettings},"get")});Object.defineProperty(Rt,"importSettings",{enumerable:!0,get:a(function(){return q4.importSettings},"get")});var W4=G4();Object.defineProperty(Rt,"EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID",{enumerable:!0,get:a(function(){return W4.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID},"get")});Object.defineProperty(Rt,"resolveDistributionOntology",{enumerable:!0,get:a(function(){return W4.resolveDistributionOntology},"get")})});var MC=T(kC=>{"use strict";Object.defineProperty(kC,"__esModule",{value:!0});kC.resolvePreferenceList=dce;function dce(r,e){if(Array.isArray(r)&&r.length>1){let t=r.map(n=>e(n)).filter(n=>n!==null&&n.length>0);return t.length>0?t.join("|"):null}return Array.isArray(r)?r.length===0?null:e(r[0]):e(r)}a(dce,"resolvePreferenceList")});var vS=T(jC=>{"use strict";Object.defineProperty(jC,"__esModule",{value:!0});jC.unwrapLinkTarget=pce;function pce(r){let e=r.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return e.includes("|")?e.split("|")[0]?.trim()??"":e}a(pce,"unwrapLinkTarget")});var $C=T(TS=>{"use strict";Object.defineProperty(TS,"__esModule",{value:!0});TS.DEFAULT_DISPLAY_NAME_SETTINGS=void 0;TS.DEFAULT_DISPLAY_NAME_SETTINGS={defaultTemplate:"{{exo__Asset_label}}",classTemplates:{},projectTBoxNames:!0}});var gm=T(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});mm.isWikilink=UC;mm.ownProperty=AS;mm.resolveKeyPath=hce;function UC(r){return r.startsWith("[[")&&r.endsWith("]]")}a(UC,"isWikilink");function AS(r,e){if(!(r===null||typeof r!="object"))return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0}a(AS,"ownProperty");function hce(r,e,t){let n=e.split("."),i=r;for(let s of n){if(i==null)return;if(Array.isArray(i)){let o=i[0];if(typeof o=="string"&&t&&UC(o)){let c=t(o);if(c){i=AS(c,s);continue}return}}if(typeof i!="object"){if(typeof i=="string"&&t&&UC(i)){let o=t(i);if(o){i=AS(o,s);continue}}return}i=AS(i,s)}return i}a(hce,"resolveKeyPath")});var IS=T(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.DEFAULT_DISPLAY_NAME_TEMPLATE=ls.DISPLAY_NAME_PRESETS=ls.DisplayNameTemplateEngine=ls.COMPOSED_SOURCE_MARKER=void 0;var mce=gm();ls.COMPOSED_SOURCE_MARKER="displayName";var BC=`!${ls.COMPOSED_SOURCE_MARKER}`,wd=class r{static{a(this,"DisplayNameTemplateEngine")}constructor(e,t={}){this.template=e,this.options=t}render(e,t,n,i,s){if(!this.template||this.template.trim()==="")return null;let o=this.options.separator;if(o)return this.renderWithSeparator(o,e,t,n,i);let c=0,l=0,u=this.renderSegment(this.template,e,t,n,i,()=>{c+=1},()=>{l+=1});if(s?.({placeholders:c,nonEmpty:l}),c>0&&l===0&&r.hasReadableFallback(e,t))return null;let f=this.cleanupResult(u);return f===""?null:f}static hasReadableFallback(e,t){let n=e.exo__Asset_label;if(typeof n=="string"&&n.trim()!=="")return!0;let i=t.trim();return i===""?!1:!r.UUID_PATTERN.test(i)}renderSegment(e,t,n,i,s,o,c){return e.replace(r.PLACEHOLDER_PATTERN,(l,u)=>{let f=u.trim();o?.();let d=this.resolveValue(f,t,n,i,s);return d.trim()!==""&&c?.(),d})}renderWithSeparator(e,t,n,i,s){let o=this.template.indexOf("{{"),c=this.template.lastIndexOf("}}");if(o===-1||c===-1||c<o){let m=this.cleanupResult(this.renderSegment(this.template,t,n,i,s));return m===""?null:m}let l=this.template.slice(0,o),u=this.template.slice(o,c+2),f=this.template.slice(c+2),d=[];for(let m of r.splitOutsidePlaceholders(u,e)){let b=this.cleanupResult(this.renderSegment(m,t,n,i,s));b!==""&&d.push(b)}if(d.length===0)return null;let p=this.renderSegment(l,t,n,i,s),h=this.renderSegment(f,t,n,i,s),g=`${p}${d.join(e)}${h}`.trim();return g===""?null:g}static splitOutsidePlaceholders(e,t){if(t.length===0)return[e];let n=[],i="",s=0;for(;s<e.length;){if(e.startsWith("{{",s)){let o=e.indexOf("}}",s+2);if(o!==-1){i+=e.slice(s,o+2),s=o+2;continue}}if(e.startsWith(t,s)){n.push(i),i="",s+=t.length;continue}i+=e[s],s+=1}return n.push(i),n}cleanupResult(e){let t=e;return t=t.replace(/\s+\(\s*\)$/g,""),t=t.replace(/^\(\s*\)\s+/g,""),t==="()"&&(t=""),t=t.replace(/\s+\[\s*\]$/g,""),t=t.replace(/^\[\s*\]\s+/g,""),t==="[]"&&(t=""),t=t.replace(/\s+/g," "),t.trim()}resolveValue(e,t,n,i,s){if(e==="_basename")return n;if(e==="_created")return i?this.formatDate(i):"";let{path:o,format:c,preferComposed:l}=r.splitKeyAndFormat(e),u=o.includes("|")?o.split("|").map(d=>d.trim()).filter(d=>d.length>0):[o],f="";for(let d of u){let p=this.getNestedValue(t,d,s),h;if(c){let g=r.applyValueFormat(p,c);h=g!==null?g:this.formatValue(p,s,l)}else h=this.formatValue(p,s,l);if(h!=="")return h;f=h}return f}static splitKeyAndFormat(e){let t=e,n=!1,i=t.trimEnd();i.length>BC.length&&i.endsWith(BC)&&(n=!0,t=i.slice(0,-BC.length).trim());let s=t.indexOf("::");if(s<=0)return n?{path:t,preferComposed:n}:{path:t};let o=t.slice(0,s).trim(),c=t.slice(s+2).trim();return!o||!c?n?{path:t,preferComposed:n}:{path:t}:n?{path:o,format:c,preferComposed:n}:{path:o,format:c}}static applyValueFormat(e,t){let n=e;if(Array.isArray(n)){if(n.length===0)return null;n=n[0]}let i,s,o,c,l,u;if(n instanceof Date){if(Number.isNaN(n.getTime()))return null;let p=a(h=>String(h).padStart(2,"0"),"pad");i=String(n.getUTCFullYear()).padStart(4,"0"),s=p(n.getUTCMonth()+1),o=p(n.getUTCDate()),c=p(n.getUTCHours()),l=p(n.getUTCMinutes()),u=p(n.getUTCSeconds())}else if(typeof n=="string"){let p=/^\s*(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?/.exec(n);if(!p)return null;i=p[1],s=p[2],o=p[3],c=p[4],l=p[5],u=p[6]}else return null;let f=!1,d=t.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,p=>{switch(p){case"YYYY":return i;case"YY":return i.slice(-2);case"MM":return s;case"DD":return o;case"HH":return c===void 0&&(f=!0),c??"";case"mm":return l===void 0&&(f=!0),l??"";case"ss":return u===void 0&&(f=!0),u??"";default:return p}});return f?null:d}getNestedValue(e,t,n){return(0,mce.resolveKeyPath)(e,t,n)}formatWikilinkValue(e,t,n=!1){let i=e.match(/^\[\[([^\]|]+?)(?:\|([^\]]+))?\]\]$/);if(!i)return e.replace(r.WIKILINK_PATTERN,"").trim();let s=i[1].trim(),o=i[2]?.trim();if(o)return o;let c=t?t(e):void 0,l=c?.exo__Asset_label,u=typeof l=="string"&&l.trim()?l.trim():null,f=a(()=>{let d=this.options.nestedDisplayName?.(e,c);return d!=null&&d.trim()!==""?d.trim():null},"composed");if(n){let d=f();if(d!==null)return d}if(u!==null)return u;if(!n){let d=f();if(d!==null)return d}return s}formatValue(e,t,n=!1){if(e==null)return"";if(typeof e=="string")return this.formatWikilinkValue(e,t,n);if(Array.isArray(e)){if(e.length===0)return"";if(this.options.joinArrayValues){let i=[];for(let s of e){let o=this.formatValue(s,t,n);o&&!r.UUID_PATTERN.test(o)&&i.push(o)}return i.join(" ")}return this.formatValue(e[0],t,n)}return typeof e=="object"?JSON.stringify(e):String(e)}formatDate(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${i}`}getTemplate(){return this.template}isValid(){return!this.template||this.template.trim()===""?!1:/\{\{[^}]+\}\}/.test(this.template)}getPlaceholders(){let e=[],t=/\{\{([^}]+)\}\}/g,n;for(;(n=t.exec(this.template))!==null;)e.push(n[1].trim());return e}};ls.DisplayNameTemplateEngine=wd;wd.PLACEHOLDER_PATTERN=/\{\{([^}]+)\}\}/g;wd.WIKILINK_PATTERN=/^\[\[|\]\]$/g;wd.UUID_PATTERN=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;ls.DISPLAY_NAME_PRESETS={default:{name:"Label only (default)",template:"{{exo__Asset_label}}"},labelWithStatus:{name:"Label with status",template:"{{exo__Asset_label}}: {{ems__Effort_status}}"},classPrefix:{name:"Class prefix",template:"[{{exo__Instance_class}}] {{exo__Asset_label}}"},classSuffix:{name:"Class suffix",template:"{{exo__Asset_label}} ({{exo__Instance_class}})"},basenameWithLabel:{name:"Filename with label",template:"{{_basename}} - {{exo__Asset_label}}"},datePrefix:{name:"Date prefix",template:"{{_created}} - {{exo__Asset_label}}"}};ls.DEFAULT_DISPLAY_NAME_TEMPLATE=ls.DISPLAY_NAME_PRESETS.classSuffix.template});var Y4=T(RS=>{"use strict";Object.defineProperty(RS,"__esModule",{value:!0});RS.PrintNameRuleService=void 0;var gce=MC(),H4=vS(),K4=gm(),yce=IS(),bce="exo__DisplayNameSpec",_ce="07eab746-0874-4676-9d98-dbaad1bc6fb8",Sce=new Set(["8bc662e3-2984-4845-9593-d37e0db9b7e3","exo__PrintedPropertyValueSourceDisplayName"]),wce="exo__PrintedProperty",Ece="7d58de40-d941-4a66-88e2-13afc4fdc41d",vce="exo__PrintedLiteral",Tce="4d5437c9-788e-4a6d-9be0-4af3a84554f4",Ace=1e3,Ice=300,VC=class r{static{a(this,"PrintNameRuleService")}constructor(e,t={},n=void 0){this.vault=e,this.hostFunctions=t,this.host=n,this.rules=new Map,this.classHierarchy=new Map,this.initialized=!1,this.scanDebounceTimer=null}initialize(){this.scanVault(),this.initialized=!0}getTemplateForClass(e,t){if(!this.initialized)return null;let n=this.selectRule(this.rules.get(e),t);if(n)return{template:n.template,priority:n.priority};let i=this.getAncestorClasses(e);for(let s of i){let o=this.selectRule(this.rules.get(s),t);if(o)return{template:o.template,priority:o.priority}}return null}getParticipatingRules(e,t){if(!this.initialized)return[];let n=this.participatingOf(this.rules.get(e),t);if(n.length>0)return n;for(let i of this.getAncestorClasses(e)){let s=this.participatingOf(this.rules.get(i),t);if(s.length>0)return s}return[]}selectRule(e,t){if(!e||e.length===0)return null;for(let n of e)if(this.ruleParticipates(n,t))return n;return null}participatingOf(e,t){if(!e||e.length===0)return[];let n=[];for(let i of e)this.ruleParticipates(i,t)&&n.push({template:i.template,priority:i.priority,sourceFile:i.sourceFile,...i.separator?{separator:i.separator}:{}});return n}ruleParticipates(e,t){return e.matcher?t?this.matcherSatisfied(e.matcher,t):!1:!0}matcherSatisfied(e,t){if(e.kind==="hostFunction"){if(!Object.prototype.hasOwnProperty.call(this.hostFunctions,e.hostFunction))return!1;let s=this.hostFunctions[e.hostFunction];return typeof s!="function"?!1:s(this.host,t)}let n=e.matchKey.includes(".")?(0,K4.resolveKeyPath)(t,e.matchKey,this.createMetadataResolver()):(0,K4.ownProperty)(t,e.matchKey),i=this.extractClassKeys(n);return i.length===0?!1:i.some(s=>e.matchValues.includes(s))}resolveIdentityForms(e){let t=this.extractClassKeys(e);if(t.length===0)return[];let n=new Set(t);for(let i of t){let s=this.vault.resolveLinkpathFrontmatter(i);if(!s)continue;let o=s.exo__Asset_uid,c=s.exo__Asset_label;typeof o=="string"&&o.trim()&&n.add(o.trim()),typeof c=="string"&&c.trim()&&n.add(c.trim())}return[...n]}resolveMatchValues(e){return this.resolveIdentityForms(e)}resolveHostFunctionName(e){let t=e;if(Array.isArray(t)){if(t.length===0)return null;t=t[0]}return typeof t!="string"?null:t.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim()||null}static declaresComposedSource(e){let t=e;if(Array.isArray(t)){if(t.length===0)return!1;t=t[0]}if(typeof t!="string")return!1;let n=(0,H4.unwrapLinkTarget)(t).replace(/\.md$/,"");return!!Sce.has(n)}createMetadataResolver(){return e=>{let t=(0,H4.unwrapLinkTarget)(e);if(!t)return null;let n=this.vault.resolveLinkpathFrontmatter(t);return n?{...n}:null}}refresh(){this.scanVault()}scheduleRefresh(){this.scanDebounceTimer!==null&&window.clearTimeout(this.scanDebounceTimer),this.scanDebounceTimer=window.setTimeout(()=>{this.scanDebounceTimer=null,this.scanVault()},Ice)}scanVault(){this.rules.clear(),this.classHierarchy.clear();let e=new Map,t=[];for(let n of this.vault.listFrontmatter()){let i=this.cleanClassValue(n.exo__Instance_class);i===bce||i===_ce?this.collectDisplayNameSpec(n,e):(i===wce||i===Ece||i===vce||i===Tce)&&this.collectDisplayNamePart(n,t);let s=this.cleanClassValue(n.exo__Class_superClass);if(s&&i){let o=this.cleanClassValue(n.exo__Asset_label)||i,c=this.classHierarchy.get(o);c?c.push(s):this.classHierarchy.set(o,[s])}}this.compileDisplayNameSpecs(e,t)}collectDisplayNameSpec(e,t){let n=typeof e.exo__Asset_uid=="string"?e.exo__Asset_uid.trim():"";if(!n)return;let i=this.resolveIdentityForms(e.exo__DisplayNameSpec_appliesToClass);if(i.length===0)return;let s=e.exo__DisplayNameSpec_priority,o=typeof s=="number"?s:typeof s=="string"&&s.trim()!==""?Number(s):0,c=this.resolvePropertyKey(e.exo__DisplayNameSpec_matchPath),l=this.resolveMatchValues(e.exo__DisplayNameSpec_matchValue),u=c!==null&&l.length>0,f=this.resolveHostFunctionName(e.exo__DisplayNameSpec_matchHostFunction),d=e.exo__DisplayNameSpec_separator,p=typeof d=="string"&&d!==""?d:void 0;t.set(n,{uid:n,classKeys:i,priority:Number.isFinite(o)?o:0,...u?{matchKey:c??void 0,matchValues:l}:{},...f?{hostFunction:f}:{},...p?{separator:p}:{}})}collectDisplayNamePart(e,t){let n=this.cleanClassValue(e.exo__DisplayNamePart_of);if(!n)return;let i=e.exo__DisplayNamePart_order,s=typeof i=="number"?i:typeof i=="string"&&i.trim()!==""?Number(i):NaN;if(!Number.isFinite(s))return;let o=this.resolvePropertyKeyList(e.exo__PrintedProperty_property),c=e.exo__PrintedLiteral_literal,l=typeof c=="string"?c:void 0,u=e.exo__PrintedProperty_format,f=typeof u=="string"&&u.trim()!==""?u.trim():void 0,d=r.declaresComposedSource(e.exo__PrintedProperty_valueSource);o?t.push({specUid:n,order:s,propertyKey:o,...f?{format:f}:{},...d?{preferComposed:d}:{}}):l!==void 0&&t.push({specUid:n,order:s,literal:l})}compileDisplayNameSpecs(e,t){let n=new Map;for(let i of t){let s=n.get(i.specUid);s?s.push(i):n.set(i.specUid,[i])}for(let i of e.values()){let s=(n.get(i.uid)??[]).slice().sort((u,f)=>u.order-f.order);if(s.length===0)continue;let o=s.map(u=>{if(!u.propertyKey)return u.literal??"";let f=u.preferComposed?`!${yce.COMPOSED_SOURCE_MARKER}`:"";return u.format?`{{${u.propertyKey}::${u.format}${f}}}`:`{{${u.propertyKey}${f}}}`}).join(i.separator??"");if(!o.trim())continue;let c=Ace+i.priority,l;i.matchKey&&i.matchValues&&i.matchValues.length>0?l={kind:"value",matchKey:i.matchKey,matchValues:i.matchValues}:i.hostFunction&&(l={kind:"hostFunction",hostFunction:i.hostFunction});for(let u of i.classKeys){if(!u)continue;let f={className:u,template:o,priority:c,sourceFile:i.uid,...l?{matcher:l}:{},...i.separator?{separator:i.separator}:{}},d=this.rules.get(u);d?(d.push(f),d.sort((p,h)=>h.priority-p.priority)):this.rules.set(u,[f])}}}resolvePropertyKey(e){return Array.isArray(e)?e.length===0?null:this.resolveSinglePropertyKey(e[0]):this.resolveSinglePropertyKey(e)}resolvePropertyKeyList(e){return(0,gce.resolvePreferenceList)(e,t=>this.resolveSinglePropertyKey(t))}resolveSinglePropertyKey(e){if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();if(!t)return null;if(t.includes("|"))return t.split("|").pop()?.trim()||null;let n=t.replace(/\.md$/,"").trim();if(!n)return null;let i=this.vault.resolveLinkpathFrontmatter(n);if(i){let s=i.exo__Asset_label;if(typeof s=="string"&&s.trim())return s.trim()}return n}extractClassKeys(e){let t=e;if(Array.isArray(t)){if(t.length===0)return[];t=t[0]}if(typeof t!="string")return[];let n=t.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();if(!n)return[];if(n.includes("|")){let[i,s]=n.split("|");return[i.trim().replace(/\.md$/,""),s.trim()].filter(o=>!!o)}return[n.replace(/\.md$/,"")]}getAncestorClasses(e){let t=[],n=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(!s||n.has(s))continue;n.add(s);let o=this.classHierarchy.get(s);if(o)for(let c of o)n.has(c)||(t.push(c),i.push(c))}return t}cleanClassValue(e){if(!e)return null;if(Array.isArray(e))return e.length===0?null:this.cleanClassValue(e[0]);if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return t.includes("|")&&(t=(t.split("|").pop()??t).trim()),t||null}getRulesCount(){let e=0;for(let t of this.rules.values())e+=t.length;return e}};RS.PrintNameRuleService=VC});var X4=T(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});ym.DisplayNameResolver=void 0;ym.createDefaultResolver=Dce;var Rce=IS(),Cce=gm(),xce=vS(),Pce=$C(),Oce=3,Fce=new Set(["8619c4fc-64f1-4869-b17e-e34186cacca9","exo__Class","38277bfa-d7f9-4a75-b856-b23276ab0db3","exo__Property","9a1cf31c-9d41-4ef3-9023-584a8d087d16","exo__ObjectProperty","ae56ca4c-b610-42a4-a25d-058c23673296","exo__DatatypeProperty","84756998-3b4e-4989-91cc-a5d5c23664d4","exo__URLProperty"]),CS=class{static{a(this,"DisplayNameResolver")}constructor(e,t,n){this.settings=e,this.ruleService=t,this.metadataResolver=n,this.nestedDepth=0,this.nestedTargets=new Set}resolve(e){return this.resolveWithProvenance(e).displayName}resolveWithProvenance(e){let{metadata:t,basename:n,createdDate:i}=e,s=this.extractAssetClasses(t),o=this.computeTBoxNamingProjection(s,t);if(o!==null)return{displayName:o,provenance:"tboxProjection"};let{template:c,separator:l,provenance:u}=this.resolveRenderSpec(s,t);return{displayName:new Rce.DisplayNameTemplateEngine(c,{...l?{separator:l}:{},nestedDisplayName:a((d,p)=>this.resolveNestedDisplayName(d,p),"nestedDisplayName")}).render(t,n,i,this.metadataResolver??void 0),provenance:u}}resolveNestedDisplayName(e,t){if(!this.metadataResolver)return null;let n=(0,xce.unwrapLinkTarget)(e).replace(/\.md$/,"");if(this.nestedDepth>=Oce||this.nestedTargets.has(n))return null;let i=t!==void 0?t:this.metadataResolver(e);if(!i)return null;this.nestedDepth+=1,this.nestedTargets.add(n);try{let s=this.resolveWithProvenance({metadata:i,basename:n});return s.provenance!=="spec"&&s.provenance!=="tboxProjection"?null:s.displayName}catch{return null}finally{this.nestedTargets.delete(n),this.nestedDepth-=1}}getTemplateForClasses(e,t){return this.resolveRenderSpec(e,t).template}resolveRenderSpec(e,t){if(this.ruleService&&e.length>0){let s=[],o=new Set;for(let c of e)for(let l of this.ruleService.getParticipatingRules(c,t))o.has(l.sourceFile)||(o.add(l.sourceFile),s.push(l));if(s.length>0)return s.sort((c,l)=>l.priority-c.priority||c.sourceFile.localeCompare(l.sourceFile)),s.length===1?{template:s[0].template,...s[0].separator?{separator:s[0].separator}:{},provenance:"spec"}:{...this.composeTemplates(s),provenance:"spec"}}let n=e[0],i=n?(0,Cce.ownProperty)(this.settings.classTemplates,n):void 0;return typeof i=="string"&&i?{template:i,provenance:"classTemplate"}:{template:this.settings.defaultTemplate,provenance:"default"}}composeTemplates(e){let t=new Set,n=new Set,i=[],s=[],o=null,c,l=a((p,h,g)=>{for(let m of p.trim().split(/\s+/))!m||h.has(m)||(h.add(m),g.push(m))},"collect");for(let p of e){let{prefix:h,core:g,suffix:m}=this.splitTemplate(p.template);o===null&&g!==""&&(o=g,c=p.separator),l(h,t,i),l(m,n,s)}let u=o??"",f=i.map(p=>`${p} `).join(""),d=s.length?` ${s.join(" ")}`:"";return{template:`${f}${u}${d}`,...c?{separator:c}:{}}}splitTemplate(e){let t=e.indexOf("{{"),n=e.lastIndexOf("}}");return t===-1||n===-1||n<t?{prefix:e,core:"",suffix:""}:{prefix:e.slice(0,t),core:e.slice(t,n+2),suffix:e.slice(n+2)}}getTemplateForClass(e,t){return this.getTemplateForClasses(e?[e]:[],t)}extractAssetClasses(e){let t=e.exo__Instance_class;if(!t)return[];let n=Array.isArray(t)?t:[t],i=[],s=new Set;for(let o of n){let c=this.cleanClassValue(o);c&&!s.has(c)&&(s.add(c),i.push(c))}return i}cleanClassValue(e){if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return t.includes("|")&&(t=(t.split("|").pop()??t).trim()),t||null}computeTBoxNamingProjection(e,t){if(this.settings.projectTBoxNames===!1||!this.isTBoxNamingEntity(e))return null;if(this.ruleService){for(let u of e)if(this.ruleService.getParticipatingRules(u,t).length>0)return null}let n=typeof t.exo__Asset_label=="string"?t.exo__Asset_label.trim():"",[i,s]=this.splitPrefixedLabel(n),c=(typeof t.exo__Slugable_slug=="string"?t.exo__Slugable_slug.trim():"")||s;if(!c)return null;let l=this.resolveOntologyShortName(t)??i;return l?`${l}#${c}`:c}isTBoxNamingEntity(e){return e.some(t=>Fce.has(t))}resolveOntologyShortName(e){if(!this.metadataResolver)return null;let t=this.firstString(e.exo__Asset_isDefinedBy);if(!t)return null;let i=this.metadataResolver(t)?.exo__Ontology_shortName;return typeof i=="string"&&i.trim()?i.trim():null}splitPrefixedLabel(e){let t=e.indexOf("__");if(t<=0)return[null,null];let n=e.slice(0,t),i=e.slice(t+2);return i?[n,i]:[null,null]}firstString(e){let t=e;if(Array.isArray(t)){if(t.length===0)return null;t=t[0]}return typeof t!="string"?null:t.trim()||null}configuredClassEntries(){return Object.entries(this.settings.classTemplates).filter(e=>typeof e[1]=="string"&&e[1].length>0)}getConfiguredClasses(){return this.configuredClassEntries().map(([e])=>e)}hasClassTemplates(){return this.configuredClassEntries().length>0}};ym.DisplayNameResolver=CS;async function Dce(){return new CS(Pce.DEFAULT_DISPLAY_NAME_SETTINGS)}a(Dce,"createDefaultResolver")});var n9=T(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.isEffortBlocked=Z4;Ed.localToday=t9;Ed.isEpisodeOngoing=r9;Ed.createDisplayMatcherHostFunctions=jce;var Q4=bl(),Lce=Hu(),Nce=10,kce=/^\d{4}-\d{2}-\d{2}$/;function Z4(r,e){let t=e.ems__Effort_blocker;if(!t)return!1;let n=e9(String(t)).split("|")[0].trim();if(!n)return!1;let i=r.resolveLinkpathFrontmatter(n);if(!i)return!1;let s=Mce(r,i.ems__Effort_status);return s!==Q4.EffortStatus.DONE&&s!==Q4.EffortStatus.TRASHED}a(Z4,"isEffortBlocked");function e9(r){return r.trim().replace(/^["']/,"").replace(/["']$/,"").replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/\.md$/,"").trim()}a(e9,"unwrapWikilink");function Mce(r,e){let t=(0,Lce.normalizeEffortStatus)(e);if(t!==null)return t;let n=e;if(n==null)return"";if(Array.isArray(n)){if(n.length!==1)return"";n=n[0]}let i=e9(String(n));if(i==="")return"";let s=i.indexOf("|"),o=s===-1?i:i.slice(0,s).trim(),l=r.resolveLinkpathFrontmatter(o)?.exo__Asset_label;return Array.isArray(l)&&(l=l[0]),typeof l=="string"&&l.trim()?l.trim():o}a(Mce,"resolveStatusLabel");function t9(r=new Date){let e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}a(t9,"localToday");function J4(r){let e=r;if(Array.isArray(e)){if(e.length===0)return null;e=e[0]}if(e instanceof Date){if(Number.isNaN(e.getTime()))return null;let l=a(u=>String(u).padStart(2,"0"),"pad");return`${String(e.getUTCFullYear()).padStart(4,"0")}-${l(e.getUTCMonth()+1)}-${l(e.getUTCDate())}`}if(typeof e!="string")return null;let n=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim().slice(0,Nce);if(!kce.test(n))return null;let[i,s,o]=n.split("-").map(Number),c=new Date(Date.UTC(i,s-1,o));return c.getUTCFullYear()!==i||c.getUTCMonth()!==s-1||c.getUTCDate()!==o?null:n}a(J4,"toDayKey");function r9(r,e=new Date){let t=J4(r.life__Episode_start);if(t===null)return!1;let n=t9(e);if(t>n)return!1;let i=r.life__Episode_end;if(i==null||Array.isArray(i)&&i.length===0||String(i).trim()==="")return!0;let o=J4(i);return o===null?!1:o>=n}a(r9,"isEpisodeOngoing");function jce(r){return{isEffortBlocked:a((e,t)=>Z4(r,t),"isEffortBlocked"),isEpisodeOngoing:a((e,t)=>r9(t),"isEpisodeOngoing")}}a(jce,"createDisplayMatcherHostFunctions")});var Fe=T(y=>{"use strict";var $ce=y&&y.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=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(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ni=y&&y.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&$ce(e,r,t)};Object.defineProperty(y,"__esModule",{value:!0});y.CommandResolver=y.extractPropertyLabel=y.uriToPropertyName=y.propertyNameToUri=y.rangeToFieldType=y.PropertyFieldType=y.ParkedAssetIndex=y.resolveDependencyKind=y.parkedPathFor=y.classifyMountTransition=y.PARKED_ROOT=y.DEPENDENCY_KIND_REFERENCE_UID=y.DEPENDENCY_KIND_TBOX_UID=y.transitiveDependsOnClosure=y.isTsFloorMountPath=y.isTsFloorAssetSpace=y.assertTsFloorReconciled=y.assertTsFloor=y.TsFloorViolationError=y.CATALOG_KEEP_NAMESPACES=y.PLUGIN_UI_FLOOR=y.SDK_FLOOR=y.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=y.SDK_FLOOR_ASSETSPACE_UIDS=y.TS_FLOOR_AS_UID_SHARED_IDENTITIES=y.TS_FLOOR_AS_UID_EXOCMD=y.TS_FLOOR_AS_UID_EXO=y.parseGroundingDefinitionFromFrontmatter=y.isCommandBindingFrontmatter=y.isGroundingFrontmatter=y.isPreconditionFrontmatter=y.isCommandFrontmatter=y.isStyleSource=y.isLabelClass=y.isCommandVariant=y.STYLE_SOURCE_VALUES=y.LABEL_CLASS_VALUES=y.COMMAND_VARIANT_VALUES=y.CommandBindingStyleProperty=y.CommandBindingProperty=y.GroundingProperty=y.PreconditionProperty=y.CommandProperty=y.resolveGroundingTypeFromWikilinkLiteral=y.resolveGroundingTypeFromIRI=y.GROUNDING_TYPE_IRI_TO_ENUM=y.GROUNDING_TYPE_UID_TO_ENUM=y.GROUNDING_TYPE_UIDS=y.GroundingType=y.EFFORT_STATUS_OPTIONS=void 0;y.ClassHierarchyResolver=y.PropertySchemaResolver=y.orderProperties=y.loadDefaultSpec=y.clearOrderSpecLoader=y.registerOrderSpecLoader=y.StatusTimestampService=y.RenameToUidService=y.PropertyCleanupService=y.LoggingService=y.extractAssetReference=y.FolderRepairService=y.WorkflowCommandAdapter=y.VisibilityGenerator=y.InstantiationRuleResolver=y.stripTemplateFrontmatter=y.resolveTemplateBody=y.getRegisteredResolverIds=y.clearResolvers=y.registerResolver=y.getResolver=y.installDefaultResolvers=y.WorkflowResolver=y.WorkflowEngine=y.EffortStatusWorkflow=y.ConceptCreationService=y.ClassCreationService=y.AreaHierarchyBuilder=y.TaskStatusService=y.createTripleStoreDeclaredRanges=y.createTripleStoreClassPropertyResolver=y.createTripleStoreRequiredPropertyResolver=y.CommandExecutionFlow=y.stripFrontmatter=y.extractSparqlBlock=y.iriToObsidianName=y.NamedQueryRunner=y.createVaultFrontmatterRefToFrontmatterResolver=y.createVaultFrontmatterRefToFolderResolver=y.createVaultFrontmatterClassLabelResolver=y.missingRequiredInputError=y.findInputSchemaViolation=y.findMissingInput=y.missingInputError=y.ServiceRegistry=y.GroundingExecutor=y.registerDefaultHostFunctions=y.hasUidFilename=y.hasNonUidFilename=y.PreconditionEvaluator=void 0;y.NoteToRDFConverter=y.SOURCE_VARIABLE=y.SourceAnnotator=y.MAX_LAZY_DEPTH=y.LazyAssetGraphLoader=y.FILE_SPACE_CLASS_UID=y.frontmatterDeclaresFileSpace=y.discoverFileSpaceExclusions=y.deriveLegacyFlatPath=y.deriveUrl=y.derivePath=y.IRICanonicalizer=y.INFERRED_GRAPH=y.PrototypeChainMaterializer=y.PropertyCardinalityRegistry=y.NonInheritablePropertyRegistry=y.RDFSInferenceEngine=y.RDFVocabularyMapper=y.DomainTriple=y.DomainBlankNode=y.DomainLiteral=y.DomainIRI=y.InMemoryTripleStore=y.OBSIDIAN_VAULT_SCHEME=y.iriToVaultPath=y.vaultPathToIRI=y.NullLogger=y.RDFSerializer=y.FilenameValidator=y.EffortSortingHelpers=y.MetadataExtractor=y.MetadataHelpers=y.extractClassRefTarget=y.instanceClassMatches=y.resolveSubsumedClassKeys=y.WikiLinkHelpers=y.DateFormatter=y.parseYamlFrontmatterTolerant=y.STRING_SCALAR_PROPERTIES=y.scalarTypingForRange=y.serializeYamlScalar=y.quoteYamlString=y.FrontmatterService=y.SPARQL_PREFIXES=y.TypeRegistry=y.GraphQueryService=y.FixMissingLabelService=y.ArchiveAssetService=y.GenericAssetCreationService=y.EnumValueResolver=void 0;y.VaultPrefixTransformer=y.CaseWhenTransformerError=y.CaseWhenTransformer=y.ResultSerializer=y.createIncrementalIndexer=y.IncrementalIndexer=y.createSPARQLResultCache=y.SPARQLResultCache=y.QueryPlanCache=y.createDoubleLiteral=y.createDecimalLiteral=y.getNumericValue=y.createPercentileAggregate=y.modeAggregate=y.stddevAggregate=y.varianceAggregate=y.medianAggregate=y.EXO_AGGREGATE_NS=y.BUILT_IN_AGGREGATES=y.CustomAggregateError=y.CustomAggregateRegistry=y.AggregateFunctions=y.BuiltInFunctions=y.SolutionMapping=y.UpdateExecutorError=y.UpdateExecutor=y.QueryExecutor=y.ExoQLQueryExecutor=y.DescribeExecutor=y.ConstructExecutor=y.UnionExecutor=y.OptionalExecutor=y.FilterExecutor=y.BGPExecutor=y.AlgebraSerializer=y.AlgebraOptimizer=y.AlgebraTranslator=y.ExoQLAlgebraTranslator=y.DescribeOptionsTransformerError=y.DescribeOptionsTransformer=y.SPARQLParseError=y.SPARQLParser=y.ExoQLParser=y.isPosixBracketExpression=y.canonicalYamlKey=y.LEGACY_YAML_KEYS=y.LEGACY_UNPREFIXED_ASSET_FIELDS=y.UNPREFIXED_ASSET_FIELDS=y.isPathExcluded=y.normaliseExcludedFolders=void 0;y.coerceVisibilityOverride=y.DAILY_EFFORTS_OVERRIDE_KEYS=y.BUILTIN_DAILY_EFFORTS_VISIBILITY=y.isPropertiesBlock=y.isLayoutBlockFrontmatter=y.isDailyEffortsByClassBlock=y.isBacklinksTableBlock=y.createLayoutBlockFromFrontmatter=y.PROPERTIES_BLOCK_CLASS_UID=y.PROPERTIES_BLOCK_CLASS_IRI=y.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID=y.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI=y.BACKLINKS_TABLE_BLOCK_CLASS_UID=y.BACKLINKS_TABLE_BLOCK_CLASS_IRI=y.isLayoutFrontmatter=y.isLayout=y.createLayoutFromFrontmatter=y.LAYOUT_CLASS_UID=y.LAYOUT_CLASS_IRI=y.ExoQLError=y.ExoQL=y.createStreamingSource=y.StreamingLoader=y.resetGlobalPool=y.getGlobalPool=y.MemoryPool=y.CompactGraphStore=y.StringTable=y.DEFAULT_COLORS=y.NODE_FLAGS=y.container=y.resetContainer=y.getContainer=y.createChildContainer=y.registerCoreServices=y.DI_TOKENS=y.DEFAULT_FLEETING_NOTE_CLASS_UID=y.DEFAULT_INBOX_FOLDER=y.DEFAULT_OWNER_IDENTITY=y.VaultSettings=y.seededUidGenerator=y.liveUidGenerator=y.frozenClock=y.liveClock=y.TransactionError=y.TripleNotFoundError=y.TripleAlreadyExistsError=y.FileAlreadyExistsError=y.FileNotFoundError=y.FilterContainsOptimizer=void 0;y.aggregateTimings=y.addTimings=y.emptyTimings=y.classifyRestPhase=y.SYNC_PHASES=y.SyncPhaseTimer=y.syncProgressPhaseText=y.orderChildrenFirst=y.isNonFastForwardError=y.SyncEngine=y.DEFAULT_LOCAL_MANIFEST_REHASH_MS=y.DEFAULT_MAX_PUSH_RETRIES=y.checkParkedStaleness=y.getTree=y.getHeadSha=y.getCommitInfo=y.getBlobText=y.getBlobBytes=y.planDuplicateUidFix=y.findDuplicateUidGroups=y.rewriteAssetUid=y.gitBlobSha=y.extractAssetUid=y.detectChanges=y.MATERIALIZE_PROGRESS_MIN_FILES=y.MATERIALIZE_PROGRESS_INTERVAL=y.escapeGitmodulesRegex=y.stripGitmodulesEntry=y.appendGitmodulesEntry=y.extractAssetSpaceSha=y.discoverAssetSpaceWrapperDir=y.mountAssetSpaceFiles=y.isBinaryPayload=y.restCreateCommit=y.parseTarballGzip=y.parseTarball=y.TripleClassHierarchy=y.ShaclShapeRegistry=y.shaclValidate=y.Namespace=y.ShapeRegistry=y.ShapeLoader=y.selectByPriority=y.LayoutSelector=y.partitionDailyEffortsByClass=y.EMS_PROJECT_CLASS_UID=y.classListMatches=y.EMS_ACTION_CLASS_UID=y.resolveDailyEffortVisibility=y.resolveBlockVisibility=void 0;y.readSpaceSource=y.parseStrictGitHubRepoURL=y.isFileSpaceFrontmatter=y.isAssetSpaceFrontmatter=y.classifySpaceDeclaration=y.SpaceSpecAccumulator=y.SYNC_BRANCH=y.ASSET_SPACE_CLASS_UID=y.OUTBOX_REMOTE_ABSENT=y.OUTBOX_STORE_FILENAME=y.LocalOutboxStore=y.CONFLICT_CACHE_STORE_FILENAME=y.LocalConflictCacheStore=y.scanForSecrets=y.redactSecrets=y.enrichRateLimitError=y.attachRateLimitFields=y.getRateLimitFields=y.extractRateLimitFields=y.parseRetryAfterMs=y.caseInsensitiveHeaderGetter=y.DEFAULT_MAX_RETRIES=y.MIN_RATE_LIMIT_WAIT_MS=y.createRateLimitBudget=y.withRateLimitBackoff=y.isRateLimitError=y.isAuthError=y.MOUNT_BASE_STORE_FILENAME=y.FileMountBaseStore=y.WATERMARK_STORE_FILENAME=y.FileWatermarkStore=y.GatedStructuredMerger=y.MergeShaclGate=y.splitSections=y.StructuredMerger=y.diff3=y.LOCAL_MANIFEST_STORE_FILENAME=y.FileLocalManifestStore=y.isSyncablePath=y.isFileSpaceSyncablePath=y.contentEquals=y.InMemoryQuarantineStore=y.DEFAULT_MAX_FILE_BYTES=y.backupPathFor=y.QuarantineResolver=y.formatRepoTimings=y.formatTimingsLine=y.fmtMs=y.dominantPhase=y.totalMs=void 0;y.createDisplayMatcherHostFunctions=y.localToday=y.isEpisodeOngoing=y.isEffortBlocked=y.isWikilink=y.resolveKeyPath=y.DEFAULT_DISPLAY_NAME_TEMPLATE=y.DISPLAY_NAME_PRESETS=y.DisplayNameTemplateEngine=y.createDefaultResolver=y.DisplayNameResolver=y.PrintNameRuleService=y.DEFAULT_DISPLAY_NAME_SETTINGS=y.normalizeEffortStatus=y.EFFORT_STATUS_BY_UID=y.EFFORT_STATUS_UID=y.unwrapLinkTarget=y.resolvePreferenceList=y.isFormatOnlyDrift=y.compareAssetSemantics=y.summarizeParityRound=y.ParityValidator=y.deriveAssetSpaceNamespace=y.buildAssetSpaceDescriptor=void 0;Ni(yl(),y);Ni(bl(),y);var Uce=pv();Object.defineProperty(y,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return Uce.EFFORT_STATUS_OPTIONS},"get")});var Bce=cc();Object.defineProperty(y,"GroundingType",{enumerable:!0,get:a(function(){return Bce.GroundingType},"get")});var bm=jp();Object.defineProperty(y,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return bm.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(y,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return bm.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(y,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return bm.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(y,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return bm.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(y,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return bm.resolveGroundingTypeFromWikilinkLiteral},"get")});var _m=hv();Object.defineProperty(y,"CommandProperty",{enumerable:!0,get:a(function(){return _m.CommandProperty},"get")});Object.defineProperty(y,"PreconditionProperty",{enumerable:!0,get:a(function(){return _m.PreconditionProperty},"get")});Object.defineProperty(y,"GroundingProperty",{enumerable:!0,get:a(function(){return _m.GroundingProperty},"get")});Object.defineProperty(y,"CommandBindingProperty",{enumerable:!0,get:a(function(){return _m.CommandBindingProperty},"get")});Object.defineProperty(y,"CommandBindingStyleProperty",{enumerable:!0,get:a(function(){return _m.CommandBindingStyleProperty},"get")});var vd=mv();Object.defineProperty(y,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:a(function(){return vd.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(y,"LABEL_CLASS_VALUES",{enumerable:!0,get:a(function(){return vd.LABEL_CLASS_VALUES},"get")});Object.defineProperty(y,"STYLE_SOURCE_VALUES",{enumerable:!0,get:a(function(){return vd.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(y,"isCommandVariant",{enumerable:!0,get:a(function(){return vd.isCommandVariant},"get")});Object.defineProperty(y,"isLabelClass",{enumerable:!0,get:a(function(){return vd.isLabelClass},"get")});Object.defineProperty(y,"isStyleSource",{enumerable:!0,get:a(function(){return vd.isStyleSource},"get")});var xS=wD();Object.defineProperty(y,"isCommandFrontmatter",{enumerable:!0,get:a(function(){return xS.isCommandFrontmatter},"get")});Object.defineProperty(y,"isPreconditionFrontmatter",{enumerable:!0,get:a(function(){return xS.isPreconditionFrontmatter},"get")});Object.defineProperty(y,"isGroundingFrontmatter",{enumerable:!0,get:a(function(){return xS.isGroundingFrontmatter},"get")});Object.defineProperty(y,"isCommandBindingFrontmatter",{enumerable:!0,get:a(function(){return xS.isCommandBindingFrontmatter},"get")});var Vce=ED();Object.defineProperty(y,"parseGroundingDefinitionFromFrontmatter",{enumerable:!0,get:a(function(){return Vce.parseGroundingDefinitionFromFrontmatter},"get")});Ni(vD(),y);Ni(TD(),y);Ni(yv(),y);Ni(bv(),y);Ni(ID(),y);Ni(xD(),y);Ni(Zv(),y);Ni(c3(),y);var zi=l3();Object.defineProperty(y,"TS_FLOOR_AS_UID_EXO",{enumerable:!0,get:a(function(){return zi.TS_FLOOR_AS_UID_EXO},"get")});Object.defineProperty(y,"TS_FLOOR_AS_UID_EXOCMD",{enumerable:!0,get:a(function(){return zi.TS_FLOOR_AS_UID_EXOCMD},"get")});Object.defineProperty(y,"TS_FLOOR_AS_UID_SHARED_IDENTITIES",{enumerable:!0,get:a(function(){return zi.TS_FLOOR_AS_UID_SHARED_IDENTITIES},"get")});Object.defineProperty(y,"SDK_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return zi.SDK_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(y,"PLUGIN_UI_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return zi.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(y,"SDK_FLOOR",{enumerable:!0,get:a(function(){return zi.SDK_FLOOR},"get")});Object.defineProperty(y,"PLUGIN_UI_FLOOR",{enumerable:!0,get:a(function(){return zi.PLUGIN_UI_FLOOR},"get")});Object.defineProperty(y,"CATALOG_KEEP_NAMESPACES",{enumerable:!0,get:a(function(){return zi.CATALOG_KEEP_NAMESPACES},"get")});Object.defineProperty(y,"TsFloorViolationError",{enumerable:!0,get:a(function(){return zi.TsFloorViolationError},"get")});Object.defineProperty(y,"assertTsFloor",{enumerable:!0,get:a(function(){return zi.assertTsFloor},"get")});Object.defineProperty(y,"assertTsFloorReconciled",{enumerable:!0,get:a(function(){return zi.assertTsFloorReconciled},"get")});Object.defineProperty(y,"isTsFloorAssetSpace",{enumerable:!0,get:a(function(){return zi.isTsFloorAssetSpace},"get")});Object.defineProperty(y,"isTsFloorMountPath",{enumerable:!0,get:a(function(){return zi.isTsFloorMountPath},"get")});var Gce=u3();Object.defineProperty(y,"transitiveDependsOnClosure",{enumerable:!0,get:a(function(){return Gce.transitiveDependsOnClosure},"get")});var Td=n1();Object.defineProperty(y,"DEPENDENCY_KIND_TBOX_UID",{enumerable:!0,get:a(function(){return Td.DEPENDENCY_KIND_TBOX_UID},"get")});Object.defineProperty(y,"DEPENDENCY_KIND_REFERENCE_UID",{enumerable:!0,get:a(function(){return Td.DEPENDENCY_KIND_REFERENCE_UID},"get")});Object.defineProperty(y,"PARKED_ROOT",{enumerable:!0,get:a(function(){return Td.PARKED_ROOT},"get")});Object.defineProperty(y,"classifyMountTransition",{enumerable:!0,get:a(function(){return Td.classifyMountTransition},"get")});Object.defineProperty(y,"parkedPathFor",{enumerable:!0,get:a(function(){return Td.parkedPathFor},"get")});Object.defineProperty(y,"resolveDependencyKind",{enumerable:!0,get:a(function(){return Td.resolveDependencyKind},"get")});var qce=m3();Object.defineProperty(y,"ParkedAssetIndex",{enumerable:!0,get:a(function(){return qce.ParkedAssetIndex},"get")});var i9=Py();Object.defineProperty(y,"PropertyFieldType",{enumerable:!0,get:a(function(){return i9.PropertyFieldType},"get")});Object.defineProperty(y,"rangeToFieldType",{enumerable:!0,get:a(function(){return i9.rangeToFieldType},"get")});var GC=a1();Object.defineProperty(y,"propertyNameToUri",{enumerable:!0,get:a(function(){return GC.propertyNameToUri},"get")});Object.defineProperty(y,"uriToPropertyName",{enumerable:!0,get:a(function(){return GC.uriToPropertyName},"get")});Object.defineProperty(y,"extractPropertyLabel",{enumerable:!0,get:a(function(){return GC.extractPropertyLabel},"get")});var Wce=Lk();Object.defineProperty(y,"CommandResolver",{enumerable:!0,get:a(function(){return Wce.CommandResolver},"get")});var zce=kk();Object.defineProperty(y,"PreconditionEvaluator",{enumerable:!0,get:a(function(){return zce.PreconditionEvaluator},"get")});var qC=Mk();Object.defineProperty(y,"hasNonUidFilename",{enumerable:!0,get:a(function(){return qC.hasNonUidFilename},"get")});Object.defineProperty(y,"hasUidFilename",{enumerable:!0,get:a(function(){return qC.hasUidFilename},"get")});Object.defineProperty(y,"registerDefaultHostFunctions",{enumerable:!0,get:a(function(){return qC.registerDefaultHostFunctions},"get")});var Ad=sM();Object.defineProperty(y,"GroundingExecutor",{enumerable:!0,get:a(function(){return Ad.GroundingExecutor},"get")});Object.defineProperty(y,"ServiceRegistry",{enumerable:!0,get:a(function(){return Ad.ServiceRegistry},"get")});Object.defineProperty(y,"missingInputError",{enumerable:!0,get:a(function(){return Ad.missingInputError},"get")});Object.defineProperty(y,"findMissingInput",{enumerable:!0,get:a(function(){return Ad.findMissingInput},"get")});Object.defineProperty(y,"findInputSchemaViolation",{enumerable:!0,get:a(function(){return Ad.findInputSchemaViolation},"get")});Object.defineProperty(y,"missingRequiredInputError",{enumerable:!0,get:a(function(){return Ad.missingRequiredInputError},"get")});var Hce=oM();Object.defineProperty(y,"createVaultFrontmatterClassLabelResolver",{enumerable:!0,get:a(function(){return Hce.createVaultFrontmatterClassLabelResolver},"get")});var Kce=aM();Object.defineProperty(y,"createVaultFrontmatterRefToFolderResolver",{enumerable:!0,get:a(function(){return Kce.createVaultFrontmatterRefToFolderResolver},"get")});var Yce=cM();Object.defineProperty(y,"createVaultFrontmatterRefToFrontmatterResolver",{enumerable:!0,get:a(function(){return Yce.createVaultFrontmatterRefToFrontmatterResolver},"get")});var Xce=uM();Object.defineProperty(y,"NamedQueryRunner",{enumerable:!0,get:a(function(){return Xce.NamedQueryRunner},"get")});var Qce=ca();Object.defineProperty(y,"iriToObsidianName",{enumerable:!0,get:a(function(){return Qce.iriToObsidianName},"get")});var s9=fM();Object.defineProperty(y,"extractSparqlBlock",{enumerable:!0,get:a(function(){return s9.extractSparqlBlock},"get")});Object.defineProperty(y,"stripFrontmatter",{enumerable:!0,get:a(function(){return s9.stripFrontmatter},"get")});var Jce=pM();Object.defineProperty(y,"CommandExecutionFlow",{enumerable:!0,get:a(function(){return Jce.CommandExecutionFlow},"get")});var o9=_M();Object.defineProperty(y,"createTripleStoreRequiredPropertyResolver",{enumerable:!0,get:a(function(){return o9.createTripleStoreRequiredPropertyResolver},"get")});Object.defineProperty(y,"createTripleStoreClassPropertyResolver",{enumerable:!0,get:a(function(){return o9.createTripleStoreClassPropertyResolver},"get")});var Zce=EM();Object.defineProperty(y,"createTripleStoreDeclaredRanges",{enumerable:!0,get:a(function(){return Zce.createTripleStoreDeclaredRanges},"get")});var ele=jI();Object.defineProperty(y,"TaskStatusService",{enumerable:!0,get:a(function(){return ele.TaskStatusService},"get")});var tle=UI();Object.defineProperty(y,"AreaHierarchyBuilder",{enumerable:!0,get:a(function(){return tle.AreaHierarchyBuilder},"get")});var rle=WI();Object.defineProperty(y,"ClassCreationService",{enumerable:!0,get:a(function(){return rle.ClassCreationService},"get")});var nle=KI();Object.defineProperty(y,"ConceptCreationService",{enumerable:!0,get:a(function(){return nle.ConceptCreationService},"get")});var ile=Xb();Object.defineProperty(y,"EffortStatusWorkflow",{enumerable:!0,get:a(function(){return ile.EffortStatusWorkflow},"get")});var sle=Nh();Object.defineProperty(y,"WorkflowEngine",{enumerable:!0,get:a(function(){return sle.WorkflowEngine},"get")});var ole=II();Object.defineProperty(y,"WorkflowResolver",{enumerable:!0,get:a(function(){return ole.WorkflowResolver},"get")});var Sm=Sb();Object.defineProperty(y,"installDefaultResolvers",{enumerable:!0,get:a(function(){return Sm.installDefaultResolvers},"get")});Object.defineProperty(y,"getResolver",{enumerable:!0,get:a(function(){return Sm.getResolver},"get")});Object.defineProperty(y,"registerResolver",{enumerable:!0,get:a(function(){return Sm.registerResolver},"get")});Object.defineProperty(y,"clearResolvers",{enumerable:!0,get:a(function(){return Sm.clearResolvers},"get")});Object.defineProperty(y,"getRegisteredResolverIds",{enumerable:!0,get:a(function(){return Sm.getRegisteredResolverIds},"get")});var a9=ZA();Object.defineProperty(y,"resolveTemplateBody",{enumerable:!0,get:a(function(){return a9.resolveTemplateBody},"get")});Object.defineProperty(y,"stripTemplateFrontmatter",{enumerable:!0,get:a(function(){return a9.stripTemplateFrontmatter},"get")});var ale=kM();Object.defineProperty(y,"InstantiationRuleResolver",{enumerable:!0,get:a(function(){return ale.InstantiationRuleResolver},"get")});var cle=MM();Object.defineProperty(y,"VisibilityGenerator",{enumerable:!0,get:a(function(){return cle.VisibilityGenerator},"get")});var lle=jM();Object.defineProperty(y,"WorkflowCommandAdapter",{enumerable:!0,get:a(function(){return lle.WorkflowCommandAdapter},"get")});var ule=Zb();Object.defineProperty(y,"FolderRepairService",{enumerable:!0,get:a(function(){return ule.FolderRepairService},"get")});var fle=Yl();Object.defineProperty(y,"extractAssetReference",{enumerable:!0,get:a(function(){return fle.extractAssetReference},"get")});var dle=Xl();Object.defineProperty(y,"LoggingService",{enumerable:!0,get:a(function(){return dle.LoggingService},"get")});var ple=r2();Object.defineProperty(y,"PropertyCleanupService",{enumerable:!0,get:a(function(){return ple.PropertyCleanupService},"get")});var hle=i2();Object.defineProperty(y,"RenameToUidService",{enumerable:!0,get:a(function(){return hle.RenameToUidService},"get")});var mle=Qb();Object.defineProperty(y,"StatusTimestampService",{enumerable:!0,get:a(function(){return mle.StatusTimestampService},"get")});var PS=Tb();Object.defineProperty(y,"registerOrderSpecLoader",{enumerable:!0,get:a(function(){return PS.registerOrderSpecLoader},"get")});Object.defineProperty(y,"clearOrderSpecLoader",{enumerable:!0,get:a(function(){return PS.clearOrderSpecLoader},"get")});Object.defineProperty(y,"loadDefaultSpec",{enumerable:!0,get:a(function(){return PS.loadDefaultSpec},"get")});Object.defineProperty(y,"orderProperties",{enumerable:!0,get:a(function(){return PS.orderProperties},"get")});var gle=WM();Object.defineProperty(y,"PropertySchemaResolver",{enumerable:!0,get:a(function(){return gle.PropertySchemaResolver},"get")});var yle=zM();Object.defineProperty(y,"ClassHierarchyResolver",{enumerable:!0,get:a(function(){return yle.ClassHierarchyResolver},"get")});var ble=HM();Object.defineProperty(y,"EnumValueResolver",{enumerable:!0,get:a(function(){return ble.EnumValueResolver},"get")});var _le=l2();Object.defineProperty(y,"GenericAssetCreationService",{enumerable:!0,get:a(function(){return _le.GenericAssetCreationService},"get")});var Sle=QM();Object.defineProperty(y,"ArchiveAssetService",{enumerable:!0,get:a(function(){return Sle.ArchiveAssetService},"get")});var wle=ZM();Object.defineProperty(y,"FixMissingLabelService",{enumerable:!0,get:a(function(){return wle.FixMissingLabelService},"get")});var Ele=ej();Object.defineProperty(y,"GraphQueryService",{enumerable:!0,get:a(function(){return Ele.GraphQueryService},"get")});var vle=rj();Object.defineProperty(y,"TypeRegistry",{enumerable:!0,get:a(function(){return vle.TypeRegistry},"get")});var Tle=nj();Object.defineProperty(y,"SPARQL_PREFIXES",{enumerable:!0,get:a(function(){return Tle.SPARQL_PREFIXES},"get")});var Ale=Kl();Object.defineProperty(y,"FrontmatterService",{enumerable:!0,get:a(function(){return Ale.FrontmatterService},"get")});var OS=Ll();Object.defineProperty(y,"quoteYamlString",{enumerable:!0,get:a(function(){return OS.quoteYamlString},"get")});Object.defineProperty(y,"serializeYamlScalar",{enumerable:!0,get:a(function(){return OS.serializeYamlScalar},"get")});Object.defineProperty(y,"scalarTypingForRange",{enumerable:!0,get:a(function(){return OS.scalarTypingForRange},"get")});Object.defineProperty(y,"STRING_SCALAR_PROPERTIES",{enumerable:!0,get:a(function(){return OS.STRING_SCALAR_PROPERTIES},"get")});var Ile=ij();Object.defineProperty(y,"parseYamlFrontmatterTolerant",{enumerable:!0,get:a(function(){return Ile.parseYamlFrontmatterTolerant},"get")});var Rle=vs();Object.defineProperty(y,"DateFormatter",{enumerable:!0,get:a(function(){return Rle.DateFormatter},"get")});var Cle=po();Object.defineProperty(y,"WikiLinkHelpers",{enumerable:!0,get:a(function(){return Cle.WikiLinkHelpers},"get")});var WC=sj();Object.defineProperty(y,"resolveSubsumedClassKeys",{enumerable:!0,get:a(function(){return WC.resolveSubsumedClassKeys},"get")});Object.defineProperty(y,"instanceClassMatches",{enumerable:!0,get:a(function(){return WC.instanceClassMatches},"get")});Object.defineProperty(y,"extractClassRefTarget",{enumerable:!0,get:a(function(){return WC.extractClassRefTarget},"get")});var xle=Sa();Object.defineProperty(y,"MetadataHelpers",{enumerable:!0,get:a(function(){return xle.MetadataHelpers},"get")});var Ple=oj();Object.defineProperty(y,"MetadataExtractor",{enumerable:!0,get:a(function(){return Ple.MetadataExtractor},"get")});var Ole=aj();Object.defineProperty(y,"EffortSortingHelpers",{enumerable:!0,get:a(function(){return Ole.EffortSortingHelpers},"get")});var Fle=cj();Object.defineProperty(y,"FilenameValidator",{enumerable:!0,get:a(function(){return Fle.FilenameValidator},"get")});var Dle=mj();Object.defineProperty(y,"RDFSerializer",{enumerable:!0,get:a(function(){return Dle.RDFSerializer},"get")});var Lle=ih();Object.defineProperty(y,"NullLogger",{enumerable:!0,get:a(function(){return Lle.NullLogger},"get")});var zC=Rb();Object.defineProperty(y,"vaultPathToIRI",{enumerable:!0,get:a(function(){return zC.vaultPathToIRI},"get")});Object.defineProperty(y,"iriToVaultPath",{enumerable:!0,get:a(function(){return zC.iriToVaultPath},"get")});Object.defineProperty(y,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:a(function(){return zC.OBSIDIAN_VAULT_SCHEME},"get")});var Nle=LI();Object.defineProperty(y,"InMemoryTripleStore",{enumerable:!0,get:a(function(){return Nle.InMemoryTripleStore},"get")});var kle=De();Object.defineProperty(y,"DomainIRI",{enumerable:!0,get:a(function(){return kle.IRI},"get")});var Mle=He();Object.defineProperty(y,"DomainLiteral",{enumerable:!0,get:a(function(){return Mle.Literal},"get")});var jle=sr();Object.defineProperty(y,"DomainBlankNode",{enumerable:!0,get:a(function(){return jle.BlankNode},"get")});var $le=Ti();Object.defineProperty(y,"DomainTriple",{enumerable:!0,get:a(function(){return $le.Triple},"get")});var Ule=tI();Object.defineProperty(y,"RDFVocabularyMapper",{enumerable:!0,get:a(function(){return Ule.RDFVocabularyMapper},"get")});var Ble=gj();Object.defineProperty(y,"RDFSInferenceEngine",{enumerable:!0,get:a(function(){return Ble.RDFSInferenceEngine},"get")});var Vle=P2();Object.defineProperty(y,"NonInheritablePropertyRegistry",{enumerable:!0,get:a(function(){return Vle.NonInheritablePropertyRegistry},"get")});var Gle=D2();Object.defineProperty(y,"PropertyCardinalityRegistry",{enumerable:!0,get:a(function(){return Gle.PropertyCardinalityRegistry},"get")});var c9=k2();Object.defineProperty(y,"PrototypeChainMaterializer",{enumerable:!0,get:a(function(){return c9.PrototypeChainMaterializer},"get")});Object.defineProperty(y,"INFERRED_GRAPH",{enumerable:!0,get:a(function(){return c9.INFERRED_GRAPH},"get")});var qle=vj();Object.defineProperty(y,"IRICanonicalizer",{enumerable:!0,get:a(function(){return qle.IRICanonicalizer},"get")});var HC=xb();Object.defineProperty(y,"derivePath",{enumerable:!0,get:a(function(){return HC.derivePath},"get")});Object.defineProperty(y,"deriveUrl",{enumerable:!0,get:a(function(){return HC.deriveUrl},"get")});Object.defineProperty(y,"deriveLegacyFlatPath",{enumerable:!0,get:a(function(){return HC.deriveLegacyFlatPath},"get")});var KC=Pb();Object.defineProperty(y,"discoverFileSpaceExclusions",{enumerable:!0,get:a(function(){return KC.discoverFileSpaceExclusions},"get")});Object.defineProperty(y,"frontmatterDeclaresFileSpace",{enumerable:!0,get:a(function(){return KC.frontmatterDeclaresFileSpace},"get")});Object.defineProperty(y,"FILE_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return KC.FILE_SPACE_CLASS_UID},"get")});var l9=Tj();Object.defineProperty(y,"LazyAssetGraphLoader",{enumerable:!0,get:a(function(){return l9.LazyAssetGraphLoader},"get")});Object.defineProperty(y,"MAX_LAZY_DEPTH",{enumerable:!0,get:a(function(){return l9.MAX_LAZY_DEPTH},"get")});var u9=U2();Object.defineProperty(y,"SourceAnnotator",{enumerable:!0,get:a(function(){return u9.SourceAnnotator},"get")});Object.defineProperty(y,"SOURCE_VARIABLE",{enumerable:!0,get:a(function(){return u9.SOURCE_VARIABLE},"get")});var Fc=Hl();Object.defineProperty(y,"NoteToRDFConverter",{enumerable:!0,get:a(function(){return Fc.NoteToRDFConverter},"get")});Object.defineProperty(y,"normaliseExcludedFolders",{enumerable:!0,get:a(function(){return Fc.normaliseExcludedFolders},"get")});Object.defineProperty(y,"isPathExcluded",{enumerable:!0,get:a(function(){return Fc.isPathExcluded},"get")});Object.defineProperty(y,"UNPREFIXED_ASSET_FIELDS",{enumerable:!0,get:a(function(){return Fc.UNPREFIXED_ASSET_FIELDS},"get")});Object.defineProperty(y,"LEGACY_UNPREFIXED_ASSET_FIELDS",{enumerable:!0,get:a(function(){return Fc.LEGACY_UNPREFIXED_ASSET_FIELDS},"get")});Object.defineProperty(y,"LEGACY_YAML_KEYS",{enumerable:!0,get:a(function(){return Fc.LEGACY_YAML_KEYS},"get")});Object.defineProperty(y,"canonicalYamlKey",{enumerable:!0,get:a(function(){return Fc.canonicalYamlKey},"get")});Object.defineProperty(y,"isPosixBracketExpression",{enumerable:!0,get:a(function(){return Fc.isPosixBracketExpression},"get")});var YC=mf();Object.defineProperty(y,"ExoQLParser",{enumerable:!0,get:a(function(){return YC.ExoQLParser},"get")});Object.defineProperty(y,"SPARQLParser",{enumerable:!0,get:a(function(){return YC.SPARQLParser},"get")});Object.defineProperty(y,"SPARQLParseError",{enumerable:!0,get:a(function(){return YC.SPARQLParseError},"get")});var f9=qT();Object.defineProperty(y,"DescribeOptionsTransformer",{enumerable:!0,get:a(function(){return f9.DescribeOptionsTransformer},"get")});Object.defineProperty(y,"DescribeOptionsTransformerError",{enumerable:!0,get:a(function(){return f9.DescribeOptionsTransformerError},"get")});var d9=wf();Object.defineProperty(y,"ExoQLAlgebraTranslator",{enumerable:!0,get:a(function(){return d9.ExoQLAlgebraTranslator},"get")});Object.defineProperty(y,"AlgebraTranslator",{enumerable:!0,get:a(function(){return d9.AlgebraTranslator},"get")});var Wle=Aj();Object.defineProperty(y,"AlgebraOptimizer",{enumerable:!0,get:a(function(){return Wle.AlgebraOptimizer},"get")});var zle=Ij();Object.defineProperty(y,"AlgebraSerializer",{enumerable:!0,get:a(function(){return zle.AlgebraSerializer},"get")});var Hle=fA();Object.defineProperty(y,"BGPExecutor",{enumerable:!0,get:a(function(){return Hle.BGPExecutor},"get")});var Kle=eb();Object.defineProperty(y,"FilterExecutor",{enumerable:!0,get:a(function(){return Kle.FilterExecutor},"get")});var Yle=PA();Object.defineProperty(y,"OptionalExecutor",{enumerable:!0,get:a(function(){return Yle.OptionalExecutor},"get")});var Xle=FA();Object.defineProperty(y,"UnionExecutor",{enumerable:!0,get:a(function(){return Xle.UnionExecutor},"get")});var Qle=UA();Object.defineProperty(y,"ConstructExecutor",{enumerable:!0,get:a(function(){return Qle.ConstructExecutor},"get")});var Jle=Cj();Object.defineProperty(y,"DescribeExecutor",{enumerable:!0,get:a(function(){return Jle.DescribeExecutor},"get")});var p9=Uf();Object.defineProperty(y,"ExoQLQueryExecutor",{enumerable:!0,get:a(function(){return p9.ExoQLQueryExecutor},"get")});Object.defineProperty(y,"QueryExecutor",{enumerable:!0,get:a(function(){return p9.QueryExecutor},"get")});var h9=Pj();Object.defineProperty(y,"UpdateExecutor",{enumerable:!0,get:a(function(){return h9.UpdateExecutor},"get")});Object.defineProperty(y,"UpdateExecutorError",{enumerable:!0,get:a(function(){return h9.UpdateExecutorError},"get")});var Zle=da();Object.defineProperty(y,"SolutionMapping",{enumerable:!0,get:a(function(){return Zle.SolutionMapping},"get")});var eue=Z0();Object.defineProperty(y,"BuiltInFunctions",{enumerable:!0,get:a(function(){return eue.BuiltInFunctions},"get")});var tue=Fj();Object.defineProperty(y,"AggregateFunctions",{enumerable:!0,get:a(function(){return tue.AggregateFunctions},"get")});var m9=x0();Object.defineProperty(y,"CustomAggregateRegistry",{enumerable:!0,get:a(function(){return m9.CustomAggregateRegistry},"get")});Object.defineProperty(y,"CustomAggregateError",{enumerable:!0,get:a(function(){return m9.CustomAggregateError},"get")});var No=O0();Object.defineProperty(y,"BUILT_IN_AGGREGATES",{enumerable:!0,get:a(function(){return No.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(y,"EXO_AGGREGATE_NS",{enumerable:!0,get:a(function(){return No.EXO_AGGREGATE_NS},"get")});Object.defineProperty(y,"medianAggregate",{enumerable:!0,get:a(function(){return No.medianAggregate},"get")});Object.defineProperty(y,"varianceAggregate",{enumerable:!0,get:a(function(){return No.varianceAggregate},"get")});Object.defineProperty(y,"stddevAggregate",{enumerable:!0,get:a(function(){return No.stddevAggregate},"get")});Object.defineProperty(y,"modeAggregate",{enumerable:!0,get:a(function(){return No.modeAggregate},"get")});Object.defineProperty(y,"createPercentileAggregate",{enumerable:!0,get:a(function(){return No.createPercentileAggregate},"get")});Object.defineProperty(y,"getNumericValue",{enumerable:!0,get:a(function(){return No.getNumericValue},"get")});Object.defineProperty(y,"createDecimalLiteral",{enumerable:!0,get:a(function(){return No.createDecimalLiteral},"get")});Object.defineProperty(y,"createDoubleLiteral",{enumerable:!0,get:a(function(){return No.createDoubleLiteral},"get")});var rue=Dj();Object.defineProperty(y,"QueryPlanCache",{enumerable:!0,get:a(function(){return rue.QueryPlanCache},"get")});var g9=Lj();Object.defineProperty(y,"SPARQLResultCache",{enumerable:!0,get:a(function(){return g9.SPARQLResultCache},"get")});Object.defineProperty(y,"createSPARQLResultCache",{enumerable:!0,get:a(function(){return g9.createSPARQLResultCache},"get")});var y9=Nj();Object.defineProperty(y,"IncrementalIndexer",{enumerable:!0,get:a(function(){return y9.IncrementalIndexer},"get")});Object.defineProperty(y,"createIncrementalIndexer",{enumerable:!0,get:a(function(){return y9.createIncrementalIndexer},"get")});var nue=kj();Object.defineProperty(y,"ResultSerializer",{enumerable:!0,get:a(function(){return nue.ResultSerializer},"get")});var b9=BT();Object.defineProperty(y,"CaseWhenTransformer",{enumerable:!0,get:a(function(){return b9.CaseWhenTransformer},"get")});Object.defineProperty(y,"CaseWhenTransformerError",{enumerable:!0,get:a(function(){return b9.CaseWhenTransformerError},"get")});var iue=KT();Object.defineProperty(y,"VaultPrefixTransformer",{enumerable:!0,get:a(function(){return iue.VaultPrefixTransformer},"get")});var sue=V2();Object.defineProperty(y,"FilterContainsOptimizer",{enumerable:!0,get:a(function(){return sue.FilterContainsOptimizer},"get")});var _9=Mj();Object.defineProperty(y,"FileNotFoundError",{enumerable:!0,get:a(function(){return _9.FileNotFoundError},"get")});Object.defineProperty(y,"FileAlreadyExistsError",{enumerable:!0,get:a(function(){return _9.FileAlreadyExistsError},"get")});var XC=PI();Object.defineProperty(y,"TripleAlreadyExistsError",{enumerable:!0,get:a(function(){return XC.TripleAlreadyExistsError},"get")});Object.defineProperty(y,"TripleNotFoundError",{enumerable:!0,get:a(function(){return XC.TripleNotFoundError},"get")});Object.defineProperty(y,"TransactionError",{enumerable:!0,get:a(function(){return XC.TransactionError},"get")});var S9=Ih();Object.defineProperty(y,"liveClock",{enumerable:!0,get:a(function(){return S9.liveClock},"get")});Object.defineProperty(y,"frozenClock",{enumerable:!0,get:a(function(){return S9.frozenClock},"get")});var w9=yb();Object.defineProperty(y,"liveUidGenerator",{enumerable:!0,get:a(function(){return w9.liveUidGenerator},"get")});Object.defineProperty(y,"seededUidGenerator",{enumerable:!0,get:a(function(){return w9.seededUidGenerator},"get")});var FS=tR();Object.defineProperty(y,"VaultSettings",{enumerable:!0,get:a(function(){return FS.VaultSettings},"get")});Object.defineProperty(y,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:a(function(){return FS.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(y,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:a(function(){return FS.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(y,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:a(function(){return FS.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var oue=si();Object.defineProperty(y,"DI_TOKENS",{enumerable:!0,get:a(function(){return oue.DI_TOKENS},"get")});var wm=jj();Object.defineProperty(y,"registerCoreServices",{enumerable:!0,get:a(function(){return wm.registerCoreServices},"get")});Object.defineProperty(y,"createChildContainer",{enumerable:!0,get:a(function(){return wm.createChildContainer},"get")});Object.defineProperty(y,"getContainer",{enumerable:!0,get:a(function(){return wm.getContainer},"get")});Object.defineProperty(y,"resetContainer",{enumerable:!0,get:a(function(){return wm.resetContainer},"get")});Object.defineProperty(y,"container",{enumerable:!0,get:a(function(){return wm.container},"get")});var Ma=qj();Object.defineProperty(y,"NODE_FLAGS",{enumerable:!0,get:a(function(){return Ma.NODE_FLAGS},"get")});Object.defineProperty(y,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return Ma.DEFAULT_COLORS},"get")});Object.defineProperty(y,"StringTable",{enumerable:!0,get:a(function(){return Ma.StringTable},"get")});Object.defineProperty(y,"CompactGraphStore",{enumerable:!0,get:a(function(){return Ma.CompactGraphStore},"get")});Object.defineProperty(y,"MemoryPool",{enumerable:!0,get:a(function(){return Ma.MemoryPool},"get")});Object.defineProperty(y,"getGlobalPool",{enumerable:!0,get:a(function(){return Ma.getGlobalPool},"get")});Object.defineProperty(y,"resetGlobalPool",{enumerable:!0,get:a(function(){return Ma.resetGlobalPool},"get")});Object.defineProperty(y,"StreamingLoader",{enumerable:!0,get:a(function(){return Ma.StreamingLoader},"get")});Object.defineProperty(y,"createStreamingSource",{enumerable:!0,get:a(function(){return Ma.createStreamingSource},"get")});var E9=Wj();Object.defineProperty(y,"ExoQL",{enumerable:!0,get:a(function(){return E9.ExoQL},"get")});Object.defineProperty(y,"ExoQLError",{enumerable:!0,get:a(function(){return E9.ExoQLError},"get")});var Em=N_();Object.defineProperty(y,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return Em.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(y,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return Em.LAYOUT_CLASS_UID},"get")});Object.defineProperty(y,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return Em.createLayoutFromFrontmatter},"get")});Object.defineProperty(y,"isLayout",{enumerable:!0,get:a(function(){return Em.isLayout},"get")});Object.defineProperty(y,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return Em.isLayoutFrontmatter},"get")});var Vs=N_();Object.defineProperty(y,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Vs.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Vs.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Vs.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Vs.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Vs.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Vs.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return Vs.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(y,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return Vs.isBacklinksTableBlock},"get")});Object.defineProperty(y,"isDailyEffortsByClassBlock",{enumerable:!0,get:a(function(){return Vs.isDailyEffortsByClassBlock},"get")});Object.defineProperty(y,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return Vs.isLayoutBlockFrontmatter},"get")});Object.defineProperty(y,"isPropertiesBlock",{enumerable:!0,get:a(function(){return Vs.isPropertiesBlock},"get")});var ja=N_();Object.defineProperty(y,"BUILTIN_DAILY_EFFORTS_VISIBILITY",{enumerable:!0,get:a(function(){return ja.BUILTIN_DAILY_EFFORTS_VISIBILITY},"get")});Object.defineProperty(y,"DAILY_EFFORTS_OVERRIDE_KEYS",{enumerable:!0,get:a(function(){return ja.DAILY_EFFORTS_OVERRIDE_KEYS},"get")});Object.defineProperty(y,"coerceVisibilityOverride",{enumerable:!0,get:a(function(){return ja.coerceVisibilityOverride},"get")});Object.defineProperty(y,"resolveBlockVisibility",{enumerable:!0,get:a(function(){return ja.resolveBlockVisibility},"get")});Object.defineProperty(y,"resolveDailyEffortVisibility",{enumerable:!0,get:a(function(){return ja.resolveDailyEffortVisibility},"get")});Object.defineProperty(y,"EMS_ACTION_CLASS_UID",{enumerable:!0,get:a(function(){return ja.EMS_ACTION_CLASS_UID},"get")});Object.defineProperty(y,"classListMatches",{enumerable:!0,get:a(function(){return ja.classListMatches},"get")});Object.defineProperty(y,"EMS_PROJECT_CLASS_UID",{enumerable:!0,get:a(function(){return ja.EMS_PROJECT_CLASS_UID},"get")});Object.defineProperty(y,"partitionDailyEffortsByClass",{enumerable:!0,get:a(function(){return ja.partitionDailyEffortsByClass},"get")});var v9=n$();Object.defineProperty(y,"LayoutSelector",{enumerable:!0,get:a(function(){return v9.LayoutSelector},"get")});Object.defineProperty(y,"selectByPriority",{enumerable:!0,get:a(function(){return v9.selectByPriority},"get")});Ni(d$(),y);var aue=h$();Object.defineProperty(y,"ShapeLoader",{enumerable:!0,get:a(function(){return aue.ShapeLoader},"get")});var cue=TR();Object.defineProperty(y,"ShapeRegistry",{enumerable:!0,get:a(function(){return cue.ShapeRegistry},"get")});var lue=qt();Object.defineProperty(y,"Namespace",{enumerable:!0,get:a(function(){return lue.Namespace},"get")});var T9=xR();Object.defineProperty(y,"shaclValidate",{enumerable:!0,get:a(function(){return T9.validate},"get")});Object.defineProperty(y,"ShaclShapeRegistry",{enumerable:!0,get:a(function(){return T9.ShapeRegistry},"get")});Ni(S$(),y);var uue=w$();Object.defineProperty(y,"TripleClassHierarchy",{enumerable:!0,get:a(function(){return uue.ClassHierarchy},"get")});var A9=DR();Object.defineProperty(y,"parseTarball",{enumerable:!0,get:a(function(){return A9.parseTarball},"get")});Object.defineProperty(y,"parseTarballGzip",{enumerable:!0,get:a(function(){return A9.parseTarballGzip},"get")});var I9=J_();Object.defineProperty(y,"restCreateCommit",{enumerable:!0,get:a(function(){return I9.restCreateCommit},"get")});Object.defineProperty(y,"isBinaryPayload",{enumerable:!0,get:a(function(){return I9.isBinaryPayload},"get")});var Dc=C$();Object.defineProperty(y,"mountAssetSpaceFiles",{enumerable:!0,get:a(function(){return Dc.mountAssetSpaceFiles},"get")});Object.defineProperty(y,"discoverAssetSpaceWrapperDir",{enumerable:!0,get:a(function(){return Dc.discoverWrapperDir},"get")});Object.defineProperty(y,"extractAssetSpaceSha",{enumerable:!0,get:a(function(){return Dc.extractShaFromWrapper},"get")});Object.defineProperty(y,"appendGitmodulesEntry",{enumerable:!0,get:a(function(){return Dc.appendGitmodulesEntry},"get")});Object.defineProperty(y,"stripGitmodulesEntry",{enumerable:!0,get:a(function(){return Dc.stripGitmodulesEntry},"get")});Object.defineProperty(y,"escapeGitmodulesRegex",{enumerable:!0,get:a(function(){return Dc.escapeGitmodulesRegex},"get")});Object.defineProperty(y,"MATERIALIZE_PROGRESS_INTERVAL",{enumerable:!0,get:a(function(){return Dc.MATERIALIZE_PROGRESS_INTERVAL},"get")});Object.defineProperty(y,"MATERIALIZE_PROGRESS_MIN_FILES",{enumerable:!0,get:a(function(){return Dc.MATERIALIZE_PROGRESS_MIN_FILES},"get")});var R9=Zh();Object.defineProperty(y,"detectChanges",{enumerable:!0,get:a(function(){return R9.detectChanges},"get")});Object.defineProperty(y,"extractAssetUid",{enumerable:!0,get:a(function(){return R9.extractAssetUid},"get")});var fue=pd();Object.defineProperty(y,"gitBlobSha",{enumerable:!0,get:a(function(){return fue.gitBlobSha},"get")});var QC=F$();Object.defineProperty(y,"rewriteAssetUid",{enumerable:!0,get:a(function(){return QC.rewriteAssetUid},"get")});Object.defineProperty(y,"findDuplicateUidGroups",{enumerable:!0,get:a(function(){return QC.findDuplicateUidGroups},"get")});Object.defineProperty(y,"planDuplicateUidFix",{enumerable:!0,get:a(function(){return QC.planDuplicateUidFix},"get")});var vm=hd();Object.defineProperty(y,"getBlobBytes",{enumerable:!0,get:a(function(){return vm.getBlobBytes},"get")});Object.defineProperty(y,"getBlobText",{enumerable:!0,get:a(function(){return vm.getBlobText},"get")});Object.defineProperty(y,"getCommitInfo",{enumerable:!0,get:a(function(){return vm.getCommitInfo},"get")});Object.defineProperty(y,"getHeadSha",{enumerable:!0,get:a(function(){return vm.getHeadSha},"get")});Object.defineProperty(y,"getTree",{enumerable:!0,get:a(function(){return vm.getTree},"get")});var due=N$();Object.defineProperty(y,"checkParkedStaleness",{enumerable:!0,get:a(function(){return due.checkParkedStaleness},"get")});var Id=a4();Object.defineProperty(y,"DEFAULT_MAX_PUSH_RETRIES",{enumerable:!0,get:a(function(){return Id.DEFAULT_MAX_PUSH_RETRIES},"get")});Object.defineProperty(y,"DEFAULT_LOCAL_MANIFEST_REHASH_MS",{enumerable:!0,get:a(function(){return Id.DEFAULT_LOCAL_MANIFEST_REHASH_MS},"get")});Object.defineProperty(y,"SyncEngine",{enumerable:!0,get:a(function(){return Id.SyncEngine},"get")});Object.defineProperty(y,"isNonFastForwardError",{enumerable:!0,get:a(function(){return Id.isNonFastForwardError},"get")});Object.defineProperty(y,"orderChildrenFirst",{enumerable:!0,get:a(function(){return Id.orderChildrenFirst},"get")});Object.defineProperty(y,"syncProgressPhaseText",{enumerable:!0,get:a(function(){return Id.syncProgressPhaseText},"get")});var Gs=VR();Object.defineProperty(y,"SyncPhaseTimer",{enumerable:!0,get:a(function(){return Gs.SyncPhaseTimer},"get")});Object.defineProperty(y,"SYNC_PHASES",{enumerable:!0,get:a(function(){return Gs.SYNC_PHASES},"get")});Object.defineProperty(y,"classifyRestPhase",{enumerable:!0,get:a(function(){return Gs.classifyRestPhase},"get")});Object.defineProperty(y,"emptyTimings",{enumerable:!0,get:a(function(){return Gs.emptyTimings},"get")});Object.defineProperty(y,"addTimings",{enumerable:!0,get:a(function(){return Gs.addTimings},"get")});Object.defineProperty(y,"aggregateTimings",{enumerable:!0,get:a(function(){return Gs.aggregateTimings},"get")});Object.defineProperty(y,"totalMs",{enumerable:!0,get:a(function(){return Gs.totalMs},"get")});Object.defineProperty(y,"dominantPhase",{enumerable:!0,get:a(function(){return Gs.dominantPhase},"get")});Object.defineProperty(y,"fmtMs",{enumerable:!0,get:a(function(){return Gs.fmtMs},"get")});Object.defineProperty(y,"formatTimingsLine",{enumerable:!0,get:a(function(){return Gs.formatTimingsLine},"get")});Object.defineProperty(y,"formatRepoTimings",{enumerable:!0,get:a(function(){return Gs.formatRepoTimings},"get")});var C9=l4();Object.defineProperty(y,"QuarantineResolver",{enumerable:!0,get:a(function(){return C9.QuarantineResolver},"get")});Object.defineProperty(y,"backupPathFor",{enumerable:!0,get:a(function(){return C9.backupPathFor},"get")});var Tm=aS();Object.defineProperty(y,"DEFAULT_MAX_FILE_BYTES",{enumerable:!0,get:a(function(){return Tm.DEFAULT_MAX_FILE_BYTES},"get")});Object.defineProperty(y,"InMemoryQuarantineStore",{enumerable:!0,get:a(function(){return Tm.InMemoryQuarantineStore},"get")});Object.defineProperty(y,"contentEquals",{enumerable:!0,get:a(function(){return Tm.contentEquals},"get")});Object.defineProperty(y,"isFileSpaceSyncablePath",{enumerable:!0,get:a(function(){return Tm.isFileSpaceSyncablePath},"get")});Object.defineProperty(y,"isSyncablePath",{enumerable:!0,get:a(function(){return Tm.isSyncablePath},"get")});var x9=u4();Object.defineProperty(y,"FileLocalManifestStore",{enumerable:!0,get:a(function(){return x9.FileLocalManifestStore},"get")});Object.defineProperty(y,"LOCAL_MANIFEST_STORE_FILENAME",{enumerable:!0,get:a(function(){return x9.LOCAL_MANIFEST_STORE_FILENAME},"get")});var pue=oC();Object.defineProperty(y,"diff3",{enumerable:!0,get:a(function(){return pue.diff3},"get")});var P9=p4();Object.defineProperty(y,"StructuredMerger",{enumerable:!0,get:a(function(){return P9.StructuredMerger},"get")});Object.defineProperty(y,"splitSections",{enumerable:!0,get:a(function(){return P9.splitSections},"get")});var hue=h4();Object.defineProperty(y,"MergeShaclGate",{enumerable:!0,get:a(function(){return hue.MergeShaclGate},"get")});var mue=m4();Object.defineProperty(y,"GatedStructuredMerger",{enumerable:!0,get:a(function(){return mue.GatedStructuredMerger},"get")});var O9=g4();Object.defineProperty(y,"FileWatermarkStore",{enumerable:!0,get:a(function(){return O9.FileWatermarkStore},"get")});Object.defineProperty(y,"WATERMARK_STORE_FILENAME",{enumerable:!0,get:a(function(){return O9.WATERMARK_STORE_FILENAME},"get")});var F9=y4();Object.defineProperty(y,"FileMountBaseStore",{enumerable:!0,get:a(function(){return F9.FileMountBaseStore},"get")});Object.defineProperty(y,"MOUNT_BASE_STORE_FILENAME",{enumerable:!0,get:a(function(){return F9.MOUNT_BASE_STORE_FILENAME},"get")});var gue=iS();Object.defineProperty(y,"isAuthError",{enumerable:!0,get:a(function(){return gue.isAuthError},"get")});var Am=oS();Object.defineProperty(y,"isRateLimitError",{enumerable:!0,get:a(function(){return Am.isRateLimitError},"get")});Object.defineProperty(y,"withRateLimitBackoff",{enumerable:!0,get:a(function(){return Am.withRateLimitBackoff},"get")});Object.defineProperty(y,"createRateLimitBudget",{enumerable:!0,get:a(function(){return Am.createRateLimitBudget},"get")});Object.defineProperty(y,"MIN_RATE_LIMIT_WAIT_MS",{enumerable:!0,get:a(function(){return Am.MIN_RATE_LIMIT_WAIT_MS},"get")});Object.defineProperty(y,"DEFAULT_MAX_RETRIES",{enumerable:!0,get:a(function(){return Am.DEFAULT_MAX_RETRIES},"get")});var Rd=YR();Object.defineProperty(y,"caseInsensitiveHeaderGetter",{enumerable:!0,get:a(function(){return Rd.caseInsensitiveHeaderGetter},"get")});Object.defineProperty(y,"parseRetryAfterMs",{enumerable:!0,get:a(function(){return Rd.parseRetryAfterMs},"get")});Object.defineProperty(y,"extractRateLimitFields",{enumerable:!0,get:a(function(){return Rd.extractRateLimitFields},"get")});Object.defineProperty(y,"getRateLimitFields",{enumerable:!0,get:a(function(){return Rd.getRateLimitFields},"get")});Object.defineProperty(y,"attachRateLimitFields",{enumerable:!0,get:a(function(){return Rd.attachRateLimitFields},"get")});Object.defineProperty(y,"enrichRateLimitError",{enumerable:!0,get:a(function(){return Rd.enrichRateLimitError},"get")});var D9=zR();Object.defineProperty(y,"redactSecrets",{enumerable:!0,get:a(function(){return D9.redactSecrets},"get")});Object.defineProperty(y,"scanForSecrets",{enumerable:!0,get:a(function(){return D9.scanForSecrets},"get")});var L9=b4();Object.defineProperty(y,"LocalConflictCacheStore",{enumerable:!0,get:a(function(){return L9.LocalConflictCacheStore},"get")});Object.defineProperty(y,"CONFLICT_CACHE_STORE_FILENAME",{enumerable:!0,get:a(function(){return L9.CONFLICT_CACHE_STORE_FILENAME},"get")});var JC=rS();Object.defineProperty(y,"LocalOutboxStore",{enumerable:!0,get:a(function(){return JC.LocalOutboxStore},"get")});Object.defineProperty(y,"OUTBOX_STORE_FILENAME",{enumerable:!0,get:a(function(){return JC.OUTBOX_STORE_FILENAME},"get")});Object.defineProperty(y,"OUTBOX_REMOTE_ABSENT",{enumerable:!0,get:a(function(){return JC.OUTBOX_REMOTE_ABSENT},"get")});var Lc=nS();Object.defineProperty(y,"ASSET_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return Lc.ASSET_SPACE_CLASS_UID},"get")});Object.defineProperty(y,"SYNC_BRANCH",{enumerable:!0,get:a(function(){return Lc.SYNC_BRANCH},"get")});Object.defineProperty(y,"SpaceSpecAccumulator",{enumerable:!0,get:a(function(){return Lc.SpaceSpecAccumulator},"get")});Object.defineProperty(y,"classifySpaceDeclaration",{enumerable:!0,get:a(function(){return Lc.classifySpaceDeclaration},"get")});Object.defineProperty(y,"isAssetSpaceFrontmatter",{enumerable:!0,get:a(function(){return Lc.isAssetSpaceFrontmatter},"get")});Object.defineProperty(y,"isFileSpaceFrontmatter",{enumerable:!0,get:a(function(){return Lc.isFileSpaceFrontmatter},"get")});Object.defineProperty(y,"parseStrictGitHubRepoURL",{enumerable:!0,get:a(function(){return Lc.parseStrictGitHubRepoURL},"get")});Object.defineProperty(y,"readSpaceSource",{enumerable:!0,get:a(function(){return Lc.readSpaceSource},"get")});var N9=S4();Object.defineProperty(y,"buildAssetSpaceDescriptor",{enumerable:!0,get:a(function(){return N9.buildAssetSpaceDescriptor},"get")});Object.defineProperty(y,"deriveAssetSpaceNamespace",{enumerable:!0,get:a(function(){return N9.deriveAssetSpaceNamespace},"get")});var k9=I4();Object.defineProperty(y,"ParityValidator",{enumerable:!0,get:a(function(){return k9.ParityValidator},"get")});Object.defineProperty(y,"summarizeParityRound",{enumerable:!0,get:a(function(){return k9.summarizeParityRound},"get")});var M9=SC();Object.defineProperty(y,"compareAssetSemantics",{enumerable:!0,get:a(function(){return M9.compareAssetSemantics},"get")});Object.defineProperty(y,"isFormatOnlyDrift",{enumerable:!0,get:a(function(){return M9.isFormatOnlyDrift},"get")});Ni(M4(),y);Ni(z4(),y);var yue=MC();Object.defineProperty(y,"resolvePreferenceList",{enumerable:!0,get:a(function(){return yue.resolvePreferenceList},"get")});var bue=vS();Object.defineProperty(y,"unwrapLinkTarget",{enumerable:!0,get:a(function(){return bue.unwrapLinkTarget},"get")});var ZC=Hu();Object.defineProperty(y,"EFFORT_STATUS_UID",{enumerable:!0,get:a(function(){return ZC.EFFORT_STATUS_UID},"get")});Object.defineProperty(y,"EFFORT_STATUS_BY_UID",{enumerable:!0,get:a(function(){return ZC.EFFORT_STATUS_BY_UID},"get")});Object.defineProperty(y,"normalizeEffortStatus",{enumerable:!0,get:a(function(){return ZC.normalizeEffortStatus},"get")});var _ue=$C();Object.defineProperty(y,"DEFAULT_DISPLAY_NAME_SETTINGS",{enumerable:!0,get:a(function(){return _ue.DEFAULT_DISPLAY_NAME_SETTINGS},"get")});var Sue=Y4();Object.defineProperty(y,"PrintNameRuleService",{enumerable:!0,get:a(function(){return Sue.PrintNameRuleService},"get")});var j9=X4();Object.defineProperty(y,"DisplayNameResolver",{enumerable:!0,get:a(function(){return j9.DisplayNameResolver},"get")});Object.defineProperty(y,"createDefaultResolver",{enumerable:!0,get:a(function(){return j9.createDefaultResolver},"get")});var ex=IS();Object.defineProperty(y,"DisplayNameTemplateEngine",{enumerable:!0,get:a(function(){return ex.DisplayNameTemplateEngine},"get")});Object.defineProperty(y,"DISPLAY_NAME_PRESETS",{enumerable:!0,get:a(function(){return ex.DISPLAY_NAME_PRESETS},"get")});Object.defineProperty(y,"DEFAULT_DISPLAY_NAME_TEMPLATE",{enumerable:!0,get:a(function(){return ex.DEFAULT_DISPLAY_NAME_TEMPLATE},"get")});var $9=gm();Object.defineProperty(y,"resolveKeyPath",{enumerable:!0,get:a(function(){return $9.resolveKeyPath},"get")});Object.defineProperty(y,"isWikilink",{enumerable:!0,get:a(function(){return $9.isWikilink},"get")});var DS=n9();Object.defineProperty(y,"isEffortBlocked",{enumerable:!0,get:a(function(){return DS.isEffortBlocked},"get")});Object.defineProperty(y,"isEpisodeOngoing",{enumerable:!0,get:a(function(){return DS.isEpisodeOngoing},"get")});Object.defineProperty(y,"localToday",{enumerable:!0,get:a(function(){return DS.localToday},"get")});Object.defineProperty(y,"createDisplayMatcherHostFunctions",{enumerable:!0,get:a(function(){return DS.createDisplayMatcherHostFunctions},"get")})});var tr=Me(()=>{"use strict"});function U9(r){return r.startsWith("VALIDATION_")?"validation":r.startsWith("PERMISSION_")?"permission":r.startsWith("STATE_")?"state":"internal"}var pt,B9=Me(()=>{"use strict";a(U9,"getErrorCategory");pt=class{static{a(this,"ResponseBuilder")}static success(e,t){return{success:!0,data:e,...t&&{meta:t}}}static error(e,t,n,i){return{success:!1,error:{code:e,category:U9(e),message:t,exitCode:n,...i?.recovery&&{recovery:i.recovery},...i?.context&&{context:i.context},...i?.stack&&{stack:i.stack}}}}}});var Er=Me(()=>{"use strict";B9()});var Lr,Hi=Me(()=>{"use strict";Er();Lr=class extends Error{static{a(this,"CLIError")}constructor(e,t,n){super(e),this.name=this.constructor.name,this.context=t,this.recoveryHint=n,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
354
354
 
355
355
  \u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
356
356
 
@@ -373,7 +373,7 @@ Partial results: ${i} result(s) were collected before timeout.`:""}`}static{a(th
373
373
  `),s=`SHACL-lite validation failed for the new asset \u2014 nothing was written.
374
374
  ${n.length} violation(s) in ${t}:
375
375
  ${i}`;super(s,{path:t,violations:n},{message:"Fix the frontmatter so the asset satisfies its class shapes, then re-run create.",suggestion:"Run `validate schema --shapes-mode` on the vault to see the same shapes the gate applied."});this.exitCode=2;this.errorCode="VALIDATION_INVALID_FORMAT";this.assetPath=t,this.violations=n,this.guidance="The asset does not conform to the SHACL-lite shapes declared for its class. Add the missing required properties (or correct the offending value's class/datatype) and re-run `create --validate`. Omitting `--validate` skips the gate entirely."}static{a(this,"ShaclConformanceError")}}});var kt=Me(()=>{"use strict";Hi();V9();G9();q9();W9();z9();H9();K9();Y9();tx();X9()});var en=T(rx=>{"use strict";rx.fromCallback=function(r){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")r.apply(this,e);else return new Promise((t,n)=>{e.push((i,s)=>i!=null?n(i):t(s)),r.apply(this,e)})},"name",{value:r.name})};rx.fromPromise=function(r){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return r.apply(this,e);e.pop(),r.apply(this,e).then(n=>t(null,n),t)},"name",{value:r.name})}});var J9=T((m3e,Q9)=>{var Nc=require("constants"),Eue=process.cwd,kS=null,vue=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return kS||(kS=Eue.call(process)),kS};try{process.cwd()}catch{}typeof process.chdir=="function"&&(nx=process.chdir,process.chdir=function(r){kS=null,nx.call(process,r)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,nx));var nx;Q9.exports=Tue;function Tue(r){Nc.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(r),r.lutimes||t(r),r.chown=s(r.chown),r.fchown=s(r.fchown),r.lchown=s(r.lchown),r.chmod=n(r.chmod),r.fchmod=n(r.fchmod),r.lchmod=n(r.lchmod),r.chownSync=o(r.chownSync),r.fchownSync=o(r.fchownSync),r.lchownSync=o(r.lchownSync),r.chmodSync=i(r.chmodSync),r.fchmodSync=i(r.fchmodSync),r.lchmodSync=i(r.lchmodSync),r.stat=c(r.stat),r.fstat=c(r.fstat),r.lstat=c(r.lstat),r.statSync=l(r.statSync),r.fstatSync=l(r.fstatSync),r.lstatSync=l(r.lstatSync),r.chmod&&!r.lchmod&&(r.lchmod=function(f,d,p){p&&process.nextTick(p)},r.lchmodSync=function(){}),r.chown&&!r.lchown&&(r.lchown=function(f,d,p,h){h&&process.nextTick(h)},r.lchownSync=function(){}),vue==="win32"&&(r.rename=typeof r.rename!="function"?r.rename:(function(f){function d(p,h,g){var m=Date.now(),b=0;f(p,h,a(function _(S){if(S&&(S.code==="EACCES"||S.code==="EPERM"||S.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){r.stat(h,function(I,E){I&&I.code==="ENOENT"?f(p,h,_):g(S)})},b),b<100&&(b+=10);return}g&&g(S)},"CB"))}return a(d,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(r.rename)),r.read=typeof r.read!="function"?r.read:(function(f){function d(p,h,g,m,b,_){var S;if(_&&typeof _=="function"){var I=0;S=a(function(E,w,R){if(E&&E.code==="EAGAIN"&&I<10)return I++,f.call(r,p,h,g,m,b,S);_.apply(this,arguments)},"callback")}return f.call(r,p,h,g,m,b,S)}return a(d,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(r.read),r.readSync=typeof r.readSync!="function"?r.readSync:(function(f){return function(d,p,h,g,m){for(var b=0;;)try{return f.call(r,d,p,h,g,m)}catch(_){if(_.code==="EAGAIN"&&b<10){b++;continue}throw _}}})(r.readSync);function e(f){f.lchmod=function(d,p,h){f.open(d,Nc.O_WRONLY|Nc.O_SYMLINK,p,function(g,m){if(g){h&&h(g);return}f.fchmod(m,p,function(b){f.close(m,function(_){h&&h(b||_)})})})},f.lchmodSync=function(d,p){var h=f.openSync(d,Nc.O_WRONLY|Nc.O_SYMLINK,p),g=!0,m;try{m=f.fchmodSync(h,p),g=!1}finally{if(g)try{f.closeSync(h)}catch{}else f.closeSync(h)}return m}}a(e,"patchLchmod");function t(f){Nc.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,p,h,g){f.open(d,Nc.O_SYMLINK,function(m,b){if(m){g&&g(m);return}f.futimes(b,p,h,function(_){f.close(b,function(S){g&&g(_||S)})})})},f.lutimesSync=function(d,p,h){var g=f.openSync(d,Nc.O_SYMLINK),m,b=!0;try{m=f.futimesSync(g,p,h),b=!1}finally{if(b)try{f.closeSync(g)}catch{}else f.closeSync(g)}return m}):f.futimes&&(f.lutimes=function(d,p,h,g){g&&process.nextTick(g)},f.lutimesSync=function(){})}a(t,"patchLutimes");function n(f){return f&&function(d,p,h){return f.call(r,d,p,function(g){u(g)&&(g=null),h&&h.apply(this,arguments)})}}a(n,"chmodFix");function i(f){return f&&function(d,p){try{return f.call(r,d,p)}catch(h){if(!u(h))throw h}}}a(i,"chmodFixSync");function s(f){return f&&function(d,p,h,g){return f.call(r,d,p,h,function(m){u(m)&&(m=null),g&&g.apply(this,arguments)})}}a(s,"chownFix");function o(f){return f&&function(d,p,h){try{return f.call(r,d,p,h)}catch(g){if(!u(g))throw g}}}a(o,"chownFixSync");function c(f){return f&&function(d,p,h){typeof p=="function"&&(h=p,p=null);function g(m,b){b&&(b.uid<0&&(b.uid+=4294967296),b.gid<0&&(b.gid+=4294967296)),h&&h.apply(this,arguments)}return a(g,"callback"),p?f.call(r,d,p,g):f.call(r,d,g)}}a(c,"statFix");function l(f){return f&&function(d,p){var h=p?f.call(r,d,p):f.call(r,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}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(Tue,"patch")});var tU=T((y3e,eU)=>{var Z9=require("stream").Stream;eU.exports=Aue;function Aue(r){return{ReadStream:e,WriteStream:t};function e(n,i){if(!(this instanceof e))return new e(n,i);Z9.call(this);var s=this;this.path=n,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}r.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(n,i){if(!(this instanceof t))return new t(n,i);Z9.call(this),this.path=n,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=r.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}a(Aue,"legacy")});var nU=T((_3e,rU)=>{"use strict";rU.exports=Rue;var Iue=Object.getPrototypeOf||function(r){return r.__proto__};function Rue(r){if(r===null||typeof r!="object")return r;if(r instanceof Object)var e={__proto__:Iue(r)};else var e=Object.create(null);return Object.getOwnPropertyNames(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}a(Rue,"clone")});var Od=T((w3e,ox)=>{var lr=require("fs"),Cue=J9(),xue=tU(),Pue=nU(),MS=require("util"),An,$S;typeof Symbol=="function"&&typeof Symbol.for=="function"?(An=Symbol.for("graceful-fs.queue"),$S=Symbol.for("graceful-fs.previous")):(An="___graceful-fs.queue",$S="___graceful-fs.previous");function Oue(){}a(Oue,"noop");function oU(r,e){Object.defineProperty(r,An,{get:a(function(){return e},"get")})}a(oU,"publishQueue");var au=Oue;MS.debuglog?au=MS.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(au=a(function(){var r=MS.format.apply(MS,arguments);r="GFS4: "+r.split(/\n/).join(`
376
- GFS4: `),console.error(r)},"debug"));lr[An]||(iU=global[An]||[],oU(lr,iU),lr.close=(function(r){function e(t,n){return r.call(lr,t,function(i){i||sU(),typeof n=="function"&&n.apply(this,arguments)})}return a(e,"close"),Object.defineProperty(e,$S,{value:r}),e})(lr.close),lr.closeSync=(function(r){function e(t){r.apply(lr,arguments),sU()}return a(e,"closeSync"),Object.defineProperty(e,$S,{value:r}),e})(lr.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){au(lr[An]),require("assert").equal(lr[An].length,0)}));var iU;global[An]||oU(global,lr[An]);ox.exports=ix(Pue(lr));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!lr.__patched&&(ox.exports=ix(lr),lr.__patched=!0);function ix(r){Cue(r),r.gracefulify=ix,r.createReadStream=w,r.createWriteStream=R;var e=r.readFile;r.readFile=t;function t(N,G,j){return typeof G=="function"&&(j=G,G=null),ae(N,G,j);function ae(Y,M,ce,W){return e(Y,M,function(oe){oe&&(oe.code==="EMFILE"||oe.code==="ENFILE")?Pd([ae,[Y,M,ce],oe,W||Date.now(),Date.now()]):typeof ce=="function"&&ce.apply(this,arguments)})}a(ae,"go$readFile")}a(t,"readFile");var n=r.writeFile;r.writeFile=i;function i(N,G,j,ae){return typeof j=="function"&&(ae=j,j=null),Y(N,G,j,ae);function Y(M,ce,W,oe,X){return n(M,ce,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Pd([Y,[M,ce,W,oe],J,X||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}a(Y,"go$writeFile")}a(i,"writeFile");var s=r.appendFile;s&&(r.appendFile=o);function o(N,G,j,ae){return typeof j=="function"&&(ae=j,j=null),Y(N,G,j,ae);function Y(M,ce,W,oe,X){return s(M,ce,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Pd([Y,[M,ce,W,oe],J,X||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}a(Y,"go$appendFile")}a(o,"appendFile");var c=r.copyFile;c&&(r.copyFile=l);function l(N,G,j,ae){return typeof j=="function"&&(ae=j,j=0),Y(N,G,j,ae);function Y(M,ce,W,oe,X){return c(M,ce,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Pd([Y,[M,ce,W,oe],J,X||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}a(Y,"go$copyFile")}a(l,"copyFile");var u=r.readdir;r.readdir=d;var f=/^v[0-5]\./;function d(N,G,j){typeof G=="function"&&(j=G,G=null);var ae=f.test(process.version)?a(function(ce,W,oe,X){return u(ce,Y(ce,W,oe,X))},"go$readdir"):a(function(ce,W,oe,X){return u(ce,W,Y(ce,W,oe,X))},"go$readdir");return ae(N,G,j);function Y(M,ce,W,oe){return function(X,J){X&&(X.code==="EMFILE"||X.code==="ENFILE")?Pd([ae,[M,ce,W],X,oe||Date.now(),Date.now()]):(J&&J.sort&&J.sort(),typeof W=="function"&&W.call(this,X,J))}}}if(a(d,"readdir"),process.version.substr(0,4)==="v0.8"){var p=xue(r);_=p.ReadStream,I=p.WriteStream}var h=r.ReadStream;h&&(_.prototype=Object.create(h.prototype),_.prototype.open=S);var g=r.WriteStream;g&&(I.prototype=Object.create(g.prototype),I.prototype.open=E),Object.defineProperty(r,"ReadStream",{get:a(function(){return _},"get"),set:a(function(N){_=N},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(r,"WriteStream",{get:a(function(){return I},"get"),set:a(function(N){I=N},"set"),enumerable:!0,configurable:!0});var m=_;Object.defineProperty(r,"FileReadStream",{get:a(function(){return m},"get"),set:a(function(N){m=N},"set"),enumerable:!0,configurable:!0});var b=I;Object.defineProperty(r,"FileWriteStream",{get:a(function(){return b},"get"),set:a(function(N){b=N},"set"),enumerable:!0,configurable:!0});function _(N,G){return this instanceof _?(h.apply(this,arguments),this):_.apply(Object.create(_.prototype),arguments)}a(_,"ReadStream");function S(){var N=this;O(N.path,N.flags,N.mode,function(G,j){G?(N.autoClose&&N.destroy(),N.emit("error",G)):(N.fd=j,N.emit("open",j),N.read())})}a(S,"ReadStream$open");function I(N,G){return this instanceof I?(g.apply(this,arguments),this):I.apply(Object.create(I.prototype),arguments)}a(I,"WriteStream");function E(){var N=this;O(N.path,N.flags,N.mode,function(G,j){G?(N.destroy(),N.emit("error",G)):(N.fd=j,N.emit("open",j))})}a(E,"WriteStream$open");function w(N,G){return new r.ReadStream(N,G)}a(w,"createReadStream");function R(N,G){return new r.WriteStream(N,G)}a(R,"createWriteStream");var x=r.open;r.open=O;function O(N,G,j,ae){return typeof j=="function"&&(ae=j,j=null),Y(N,G,j,ae);function Y(M,ce,W,oe,X){return x(M,ce,W,function(J,ye){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Pd([Y,[M,ce,W,oe],J,X||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}a(Y,"go$open")}return a(O,"open"),r}a(ix,"patch");function Pd(r){au("ENQUEUE",r[0].name,r[1]),lr[An].push(r),sx()}a(Pd,"enqueue");var jS;function sU(){for(var r=Date.now(),e=0;e<lr[An].length;++e)lr[An][e].length>2&&(lr[An][e][3]=r,lr[An][e][4]=r);sx()}a(sU,"resetQueue");function sx(){if(clearTimeout(jS),jS=void 0,lr[An].length!==0){var r=lr[An].shift(),e=r[0],t=r[1],n=r[2],i=r[3],s=r[4];if(i===void 0)au("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){au("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,n)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(au("RETRY",e.name,t),e.apply(null,t.concat([i]))):lr[An].push(r)}jS===void 0&&(jS=setTimeout(sx,0))}}a(sx,"retry")});var li=T($a=>{"use strict";var aU=en().fromCallback,ci=Od(),Fue=["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(r=>typeof ci[r]=="function");Object.assign($a,ci);Fue.forEach(r=>{$a[r]=aU(ci[r])});$a.exists=function(r,e){return typeof e=="function"?ci.exists(r,e):new Promise(t=>ci.exists(r,t))};$a.read=function(r,e,t,n,i,s){return typeof s=="function"?ci.read(r,e,t,n,i,s):new Promise((o,c)=>{ci.read(r,e,t,n,i,(l,u,f)=>{if(l)return c(l);o({bytesRead:u,buffer:f})})})};$a.write=function(r,e,...t){return typeof t[t.length-1]=="function"?ci.write(r,e,...t):new Promise((n,i)=>{ci.write(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesWritten:o,buffer:c})})})};$a.readv=function(r,e,...t){return typeof t[t.length-1]=="function"?ci.readv(r,e,...t):new Promise((n,i)=>{ci.readv(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesRead:o,buffers:c})})})};$a.writev=function(r,e,...t){return typeof t[t.length-1]=="function"?ci.writev(r,e,...t):new Promise((n,i)=>{ci.writev(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesWritten:o,buffers:c})})})};typeof ci.realpath.native=="function"?$a.realpath.native=aU(ci.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var lU=T((T3e,cU)=>{"use strict";var Due=require("path");cU.exports.checkPath=a(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(Due.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}},"checkPath")});var pU=T((I3e,ax)=>{"use strict";var uU=li(),{checkPath:fU}=lU(),dU=a(r=>{let e={mode:511};return typeof r=="number"?r:{...e,...r}.mode},"getMode");ax.exports.makeDir=async(r,e)=>(fU(r),uU.mkdir(r,{mode:dU(e),recursive:!0}));ax.exports.makeDirSync=(r,e)=>(fU(r),uU.mkdirSync(r,{mode:dU(e),recursive:!0}))});var qs=T((C3e,hU)=>{"use strict";var Lue=en().fromPromise,{makeDir:Nue,makeDirSync:cx}=pU(),lx=Lue(Nue);hU.exports={mkdirs:lx,mkdirsSync:cx,mkdirp:lx,mkdirpSync:cx,ensureDir:lx,ensureDirSync:cx}});var kc=T((x3e,gU)=>{"use strict";var kue=en().fromPromise,mU=li();function Mue(r){return mU.access(r).then(()=>!0).catch(()=>!1)}a(Mue,"pathExists");gU.exports={pathExists:kue(Mue),pathExistsSync:mU.existsSync}});var ux=T((O3e,yU)=>{"use strict";var Fd=li(),jue=en().fromPromise;async function $ue(r,e,t){let n=await Fd.open(r,"r+"),i=null;try{await Fd.futimes(n,e,t)}catch(s){i=s}finally{try{await Fd.close(n)}catch(s){i||(i=s)}}if(i)throw i}a($ue,"utimesMillis");function Uue(r,e,t){let n=Fd.openSync(r,"r+"),i=null;try{Fd.futimesSync(n,e,t)}catch(s){i=s}finally{try{Fd.closeSync(n)}catch(s){i||(i=s)}}if(i)throw i}a(Uue,"utimesMillisSync");yU.exports={utimesMillis:jue($ue),utimesMillisSync:Uue}});var cu=T((D3e,_U)=>{"use strict";var Dd=li(),tn=require("path"),bU=en().fromPromise;function Bue(r,e,t){let n=t.dereference?i=>Dd.stat(i,{bigint:!0}):i=>Dd.lstat(i,{bigint:!0});return Promise.all([n(r),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}a(Bue,"getStats");function Vue(r,e,t){let n,i=t.dereference?o=>Dd.statSync(o,{bigint:!0}):o=>Dd.lstatSync(o,{bigint:!0}),s=i(r);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}a(Vue,"getStatsSync");async function Gue(r,e,t,n){let{srcStat:i,destStat:s}=await Bue(r,e,n);if(s){if(xm(i,s)){let o=tn.basename(r),c=tn.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 '${r}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${r}'.`)}if(i.isDirectory()&&px(r,e))throw new Error(US(r,e,t));return{srcStat:i,destStat:s}}a(Gue,"checkPaths");function que(r,e,t,n){let{srcStat:i,destStat:s}=Vue(r,e,n);if(s){if(xm(i,s)){let o=tn.basename(r),c=tn.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 '${r}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${r}'.`)}if(i.isDirectory()&&px(r,e))throw new Error(US(r,e,t));return{srcStat:i,destStat:s}}a(que,"checkPathsSync");async function fx(r,e,t,n){let i=tn.resolve(tn.dirname(r)),s=tn.resolve(tn.dirname(t));if(s===i||s===tn.parse(s).root)return;let o;try{o=await Dd.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return fx(r,e,s,n);throw c}if(xm(e,o))throw new Error(US(r,t,n));return fx(r,e,s,n)}a(fx,"checkParentPaths");function dx(r,e,t,n){let i=tn.resolve(tn.dirname(r)),s=tn.resolve(tn.dirname(t));if(s===i||s===tn.parse(s).root)return;let o;try{o=Dd.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return dx(r,e,s,n);throw c}if(xm(e,o))throw new Error(US(r,t,n));return dx(r,e,s,n)}a(dx,"checkParentPathsSync");function xm(r,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===r.ino&&e.dev===r.dev}a(xm,"areIdentical");function px(r,e){let t=tn.resolve(r).split(tn.sep).filter(i=>i),n=tn.resolve(e).split(tn.sep).filter(i=>i);return t.every((i,s)=>n[s]===i)}a(px,"isSrcSubdir");function US(r,e,t){return`Cannot ${t} '${r}' to a subdirectory of itself, '${e}'.`}a(US,"errMsg");_U.exports={checkPaths:bU(Gue),checkPathsSync:que,checkParentPaths:bU(fx),checkParentPathsSync:dx,isSrcSubdir:px,areIdentical:xm}});var wU=T((N3e,SU)=>{"use strict";async function Wue(r,e){let t=[];for await(let n of r)t.push(e(n).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(t.map(n=>n.then(i=>{if(i!==null)throw i})))}a(Wue,"asyncIteratorConcurrentProcess");SU.exports={asyncIteratorConcurrentProcess:Wue}});var IU=T((M3e,AU)=>{"use strict";var Vn=li(),Pm=require("path"),{mkdirs:zue}=qs(),{pathExists:Hue}=kc(),{utimesMillis:Kue}=ux(),Om=cu(),{asyncIteratorConcurrentProcess:Yue}=wU();async function Xue(r,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;
376
+ GFS4: `),console.error(r)},"debug"));lr[An]||(iU=global[An]||[],oU(lr,iU),lr.close=(function(r){function e(t,n){return r.call(lr,t,function(i){i||sU(),typeof n=="function"&&n.apply(this,arguments)})}return a(e,"close"),Object.defineProperty(e,$S,{value:r}),e})(lr.close),lr.closeSync=(function(r){function e(t){r.apply(lr,arguments),sU()}return a(e,"closeSync"),Object.defineProperty(e,$S,{value:r}),e})(lr.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){au(lr[An]),require("assert").equal(lr[An].length,0)}));var iU;global[An]||oU(global,lr[An]);ox.exports=ix(Pue(lr));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!lr.__patched&&(ox.exports=ix(lr),lr.__patched=!0);function ix(r){Cue(r),r.gracefulify=ix,r.createReadStream=w,r.createWriteStream=R;var e=r.readFile;r.readFile=t;function t(N,G,j){return typeof G=="function"&&(j=G,G=null),ae(N,G,j);function ae(Y,M,ce,q){return e(Y,M,function(oe){oe&&(oe.code==="EMFILE"||oe.code==="ENFILE")?Pd([ae,[Y,M,ce],oe,q||Date.now(),Date.now()]):typeof ce=="function"&&ce.apply(this,arguments)})}a(ae,"go$readFile")}a(t,"readFile");var n=r.writeFile;r.writeFile=i;function i(N,G,j,ae){return typeof j=="function"&&(ae=j,j=null),Y(N,G,j,ae);function Y(M,ce,q,oe,X){return n(M,ce,q,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Pd([Y,[M,ce,q,oe],J,X||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}a(Y,"go$writeFile")}a(i,"writeFile");var s=r.appendFile;s&&(r.appendFile=o);function o(N,G,j,ae){return typeof j=="function"&&(ae=j,j=null),Y(N,G,j,ae);function Y(M,ce,q,oe,X){return s(M,ce,q,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Pd([Y,[M,ce,q,oe],J,X||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}a(Y,"go$appendFile")}a(o,"appendFile");var c=r.copyFile;c&&(r.copyFile=l);function l(N,G,j,ae){return typeof j=="function"&&(ae=j,j=0),Y(N,G,j,ae);function Y(M,ce,q,oe,X){return c(M,ce,q,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Pd([Y,[M,ce,q,oe],J,X||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}a(Y,"go$copyFile")}a(l,"copyFile");var u=r.readdir;r.readdir=d;var f=/^v[0-5]\./;function d(N,G,j){typeof G=="function"&&(j=G,G=null);var ae=f.test(process.version)?a(function(ce,q,oe,X){return u(ce,Y(ce,q,oe,X))},"go$readdir"):a(function(ce,q,oe,X){return u(ce,q,Y(ce,q,oe,X))},"go$readdir");return ae(N,G,j);function Y(M,ce,q,oe){return function(X,J){X&&(X.code==="EMFILE"||X.code==="ENFILE")?Pd([ae,[M,ce,q],X,oe||Date.now(),Date.now()]):(J&&J.sort&&J.sort(),typeof q=="function"&&q.call(this,X,J))}}}if(a(d,"readdir"),process.version.substr(0,4)==="v0.8"){var p=xue(r);_=p.ReadStream,I=p.WriteStream}var h=r.ReadStream;h&&(_.prototype=Object.create(h.prototype),_.prototype.open=S);var g=r.WriteStream;g&&(I.prototype=Object.create(g.prototype),I.prototype.open=E),Object.defineProperty(r,"ReadStream",{get:a(function(){return _},"get"),set:a(function(N){_=N},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(r,"WriteStream",{get:a(function(){return I},"get"),set:a(function(N){I=N},"set"),enumerable:!0,configurable:!0});var m=_;Object.defineProperty(r,"FileReadStream",{get:a(function(){return m},"get"),set:a(function(N){m=N},"set"),enumerable:!0,configurable:!0});var b=I;Object.defineProperty(r,"FileWriteStream",{get:a(function(){return b},"get"),set:a(function(N){b=N},"set"),enumerable:!0,configurable:!0});function _(N,G){return this instanceof _?(h.apply(this,arguments),this):_.apply(Object.create(_.prototype),arguments)}a(_,"ReadStream");function S(){var N=this;O(N.path,N.flags,N.mode,function(G,j){G?(N.autoClose&&N.destroy(),N.emit("error",G)):(N.fd=j,N.emit("open",j),N.read())})}a(S,"ReadStream$open");function I(N,G){return this instanceof I?(g.apply(this,arguments),this):I.apply(Object.create(I.prototype),arguments)}a(I,"WriteStream");function E(){var N=this;O(N.path,N.flags,N.mode,function(G,j){G?(N.destroy(),N.emit("error",G)):(N.fd=j,N.emit("open",j))})}a(E,"WriteStream$open");function w(N,G){return new r.ReadStream(N,G)}a(w,"createReadStream");function R(N,G){return new r.WriteStream(N,G)}a(R,"createWriteStream");var x=r.open;r.open=O;function O(N,G,j,ae){return typeof j=="function"&&(ae=j,j=null),Y(N,G,j,ae);function Y(M,ce,q,oe,X){return x(M,ce,q,function(J,ye){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Pd([Y,[M,ce,q,oe],J,X||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}a(Y,"go$open")}return a(O,"open"),r}a(ix,"patch");function Pd(r){au("ENQUEUE",r[0].name,r[1]),lr[An].push(r),sx()}a(Pd,"enqueue");var jS;function sU(){for(var r=Date.now(),e=0;e<lr[An].length;++e)lr[An][e].length>2&&(lr[An][e][3]=r,lr[An][e][4]=r);sx()}a(sU,"resetQueue");function sx(){if(clearTimeout(jS),jS=void 0,lr[An].length!==0){var r=lr[An].shift(),e=r[0],t=r[1],n=r[2],i=r[3],s=r[4];if(i===void 0)au("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){au("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,n)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(au("RETRY",e.name,t),e.apply(null,t.concat([i]))):lr[An].push(r)}jS===void 0&&(jS=setTimeout(sx,0))}}a(sx,"retry")});var li=T($a=>{"use strict";var aU=en().fromCallback,ci=Od(),Fue=["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(r=>typeof ci[r]=="function");Object.assign($a,ci);Fue.forEach(r=>{$a[r]=aU(ci[r])});$a.exists=function(r,e){return typeof e=="function"?ci.exists(r,e):new Promise(t=>ci.exists(r,t))};$a.read=function(r,e,t,n,i,s){return typeof s=="function"?ci.read(r,e,t,n,i,s):new Promise((o,c)=>{ci.read(r,e,t,n,i,(l,u,f)=>{if(l)return c(l);o({bytesRead:u,buffer:f})})})};$a.write=function(r,e,...t){return typeof t[t.length-1]=="function"?ci.write(r,e,...t):new Promise((n,i)=>{ci.write(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesWritten:o,buffer:c})})})};$a.readv=function(r,e,...t){return typeof t[t.length-1]=="function"?ci.readv(r,e,...t):new Promise((n,i)=>{ci.readv(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesRead:o,buffers:c})})})};$a.writev=function(r,e,...t){return typeof t[t.length-1]=="function"?ci.writev(r,e,...t):new Promise((n,i)=>{ci.writev(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesWritten:o,buffers:c})})})};typeof ci.realpath.native=="function"?$a.realpath.native=aU(ci.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var lU=T((T3e,cU)=>{"use strict";var Due=require("path");cU.exports.checkPath=a(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(Due.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}},"checkPath")});var pU=T((I3e,ax)=>{"use strict";var uU=li(),{checkPath:fU}=lU(),dU=a(r=>{let e={mode:511};return typeof r=="number"?r:{...e,...r}.mode},"getMode");ax.exports.makeDir=async(r,e)=>(fU(r),uU.mkdir(r,{mode:dU(e),recursive:!0}));ax.exports.makeDirSync=(r,e)=>(fU(r),uU.mkdirSync(r,{mode:dU(e),recursive:!0}))});var qs=T((C3e,hU)=>{"use strict";var Lue=en().fromPromise,{makeDir:Nue,makeDirSync:cx}=pU(),lx=Lue(Nue);hU.exports={mkdirs:lx,mkdirsSync:cx,mkdirp:lx,mkdirpSync:cx,ensureDir:lx,ensureDirSync:cx}});var kc=T((x3e,gU)=>{"use strict";var kue=en().fromPromise,mU=li();function Mue(r){return mU.access(r).then(()=>!0).catch(()=>!1)}a(Mue,"pathExists");gU.exports={pathExists:kue(Mue),pathExistsSync:mU.existsSync}});var ux=T((O3e,yU)=>{"use strict";var Fd=li(),jue=en().fromPromise;async function $ue(r,e,t){let n=await Fd.open(r,"r+"),i=null;try{await Fd.futimes(n,e,t)}catch(s){i=s}finally{try{await Fd.close(n)}catch(s){i||(i=s)}}if(i)throw i}a($ue,"utimesMillis");function Uue(r,e,t){let n=Fd.openSync(r,"r+"),i=null;try{Fd.futimesSync(n,e,t)}catch(s){i=s}finally{try{Fd.closeSync(n)}catch(s){i||(i=s)}}if(i)throw i}a(Uue,"utimesMillisSync");yU.exports={utimesMillis:jue($ue),utimesMillisSync:Uue}});var cu=T((D3e,_U)=>{"use strict";var Dd=li(),tn=require("path"),bU=en().fromPromise;function Bue(r,e,t){let n=t.dereference?i=>Dd.stat(i,{bigint:!0}):i=>Dd.lstat(i,{bigint:!0});return Promise.all([n(r),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}a(Bue,"getStats");function Vue(r,e,t){let n,i=t.dereference?o=>Dd.statSync(o,{bigint:!0}):o=>Dd.lstatSync(o,{bigint:!0}),s=i(r);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}a(Vue,"getStatsSync");async function Gue(r,e,t,n){let{srcStat:i,destStat:s}=await Bue(r,e,n);if(s){if(xm(i,s)){let o=tn.basename(r),c=tn.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 '${r}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${r}'.`)}if(i.isDirectory()&&px(r,e))throw new Error(US(r,e,t));return{srcStat:i,destStat:s}}a(Gue,"checkPaths");function que(r,e,t,n){let{srcStat:i,destStat:s}=Vue(r,e,n);if(s){if(xm(i,s)){let o=tn.basename(r),c=tn.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 '${r}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${r}'.`)}if(i.isDirectory()&&px(r,e))throw new Error(US(r,e,t));return{srcStat:i,destStat:s}}a(que,"checkPathsSync");async function fx(r,e,t,n){let i=tn.resolve(tn.dirname(r)),s=tn.resolve(tn.dirname(t));if(s===i||s===tn.parse(s).root)return;let o;try{o=await Dd.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return fx(r,e,s,n);throw c}if(xm(e,o))throw new Error(US(r,t,n));return fx(r,e,s,n)}a(fx,"checkParentPaths");function dx(r,e,t,n){let i=tn.resolve(tn.dirname(r)),s=tn.resolve(tn.dirname(t));if(s===i||s===tn.parse(s).root)return;let o;try{o=Dd.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return dx(r,e,s,n);throw c}if(xm(e,o))throw new Error(US(r,t,n));return dx(r,e,s,n)}a(dx,"checkParentPathsSync");function xm(r,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===r.ino&&e.dev===r.dev}a(xm,"areIdentical");function px(r,e){let t=tn.resolve(r).split(tn.sep).filter(i=>i),n=tn.resolve(e).split(tn.sep).filter(i=>i);return t.every((i,s)=>n[s]===i)}a(px,"isSrcSubdir");function US(r,e,t){return`Cannot ${t} '${r}' to a subdirectory of itself, '${e}'.`}a(US,"errMsg");_U.exports={checkPaths:bU(Gue),checkPathsSync:que,checkParentPaths:bU(fx),checkParentPathsSync:dx,isSrcSubdir:px,areIdentical:xm}});var wU=T((N3e,SU)=>{"use strict";async function Wue(r,e){let t=[];for await(let n of r)t.push(e(n).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(t.map(n=>n.then(i=>{if(i!==null)throw i})))}a(Wue,"asyncIteratorConcurrentProcess");SU.exports={asyncIteratorConcurrentProcess:Wue}});var IU=T((M3e,AU)=>{"use strict";var Vn=li(),Pm=require("path"),{mkdirs:zue}=qs(),{pathExists:Hue}=kc(),{utimesMillis:Kue}=ux(),Om=cu(),{asyncIteratorConcurrentProcess:Yue}=wU();async function Xue(r,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;
377
377
 
378
378
  see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await Om.checkPaths(r,e,"copy",t);if(await Om.checkParentPaths(r,n,e,"copy"),!await vU(r,e,t))return;let o=Pm.dirname(e);await Hue(o)||await zue(o),await TU(i,r,e,t)}a(Xue,"copy");async function vU(r,e,t){return t.filter?t.filter(r,e):!0}a(vU,"runFilter");async function TU(r,e,t,n){let s=await(n.dereference?Vn.stat:Vn.lstat)(e);if(s.isDirectory())return efe(s,r,e,t,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Que(s,r,e,t,n);if(s.isSymbolicLink())return tfe(r,e,t,n);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(TU,"getStatsAndPerformCopy");async function Que(r,e,t,n,i){if(!e)return EU(r,t,n,i);if(i.overwrite)return await Vn.unlink(n),EU(r,t,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}a(Que,"onFile");async function EU(r,e,t,n){if(await Vn.copyFile(e,t),n.preserveTimestamps){Jue(r.mode)&&await Zue(t,r.mode);let i=await Vn.stat(e);await Kue(t,i.atime,i.mtime)}return Vn.chmod(t,r.mode)}a(EU,"copyFile");function Jue(r){return(r&128)===0}a(Jue,"fileIsNotWritable");function Zue(r,e){return Vn.chmod(r,e|128)}a(Zue,"makeFileWritable");async function efe(r,e,t,n,i){e||await Vn.mkdir(n),await Yue(await Vn.opendir(t),async s=>{let o=Pm.join(t,s.name),c=Pm.join(n,s.name);if(await vU(o,c,i)){let{destStat:u}=await Om.checkPaths(o,c,"copy",i);await TU(u,o,c,i)}}),e||await Vn.chmod(n,r.mode)}a(efe,"onDir");async function tfe(r,e,t,n){let i=await Vn.readlink(e);if(n.dereference&&(i=Pm.resolve(process.cwd(),i)),!r)return Vn.symlink(i,t);let s=null;try{s=await Vn.readlink(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Vn.symlink(i,t);throw o}if(n.dereference&&(s=Pm.resolve(process.cwd(),s)),i!==s){if(Om.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Om.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`)}return await Vn.unlink(t),Vn.symlink(i,t)}a(tfe,"onLink");AU.exports=Xue});var OU=T(($3e,PU)=>{"use strict";var ui=Od(),Fm=require("path"),rfe=qs().mkdirsSync,nfe=ux().utimesMillisSync,Dm=cu();function ife(r,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;
379
379
 
@@ -461,7 +461,7 @@ ${e}`}shouldSkipDirectory(e){return e.startsWith(".")}walkDirectory(e,t){let n;t
461
461
  `)?`\r
462
462
  `:`
463
463
  `;return`---${c}${o}${c}---`+r.slice(t[0].length)}a(X7,"rewriteFrontmatterScalars")});var J7=T(JO=>{"use strict";Object.defineProperty(JO,"__esModule",{value:!0});JO.createInstantiatePrototypeSubtreeService=x_e;var ec=Fe(),T_e="753a44d5-846c-4b82-9196-4fd9a4d48777",A_e="ems__EffortPrototype_parentEffortPrototype",I_e="8619c4fc-64f1-4869-b17e-e34186cacca9";function R_e(r){if(typeof r!="string")return;let e=r.match(/\[\[[^\]|]+\|([^\]]+)\]\]/);return e?e[1].trim():void 0}a(R_e,"extractAlias");function _E(r){let e=String(tc(r)??""),t=e.match(/^"(.*)"$|^'(.*)'$/);return t?t[1]??t[2]??"":e}a(_E,"plainScalar");function tc(r){return Array.isArray(r)?r[0]:r}a(tc,"firstValue");function C_e(r){let e=r.replace(/\.md$/,""),t=e.substring(e.lastIndexOf("/")+1);return decodeURIComponent(t)}a(C_e,"uidFromIRI");function x_e(r,e){return{async execute(t,n){let i=new Map;for(let E of r.getAllFiles()){let w=r.getFrontmatter(E);if(!w)continue;let R=w.exo__Asset_uid??E.basename;i.set(R,{file:E,fm:w,uid:R})}let s=a(E=>{let w=R_e(tc(E));if(w)return w;let R=(0,ec.extractAssetReference)(tc(E));if(!R)return;let x=i.get(R);return x?_E(x.fm.exo__Asset_label):R},"classLabel"),o=a(E=>{for(let[w,R]of i){if(_E(R.fm.exo__Asset_label)!==E)continue;if((0,ec.extractAssetReference)(tc(R.fm.exo__Instance_class))===I_e)return w}},"classUidByLabel"),c=C_e(t);if(!i.get(c))throw new Error(`instantiatePrototypeSubtree: root prototype not found for target "${t}" (uid ${c})`);let u=new Set([c]),f=!0;for(;f;){f=!1;for(let[E,w]of i){if(u.has(E))continue;let R=(0,ec.extractAssetReference)(tc(w.fm[A_e]));R&&u.has(R)&&(u.add(E),f=!0)}}let d=new Map;for(let E of u)d.set(E,crypto.randomUUID());let p={},h=[],g;for(let[E,w]of Object.entries(n??{})){if(w==null||E==="label"||E==="body")continue;let R=(0,ec.extractAssetReference)(tc(w)),x=R?i.get(R):void 0;if(x){let O=x.fm.exo__Asset_label?_E(x.fm.exo__Asset_label):void 0;p[E]=O??String(w),(s(x.fm.exo__Instance_class)??"").includes("Project")?g||(g=R??void 0):h.push(R)}else p[E]=String(w)}let m=a(E=>{let w=String(E??"");for(let[R,x]of Object.entries(p))w=w.split(`{{${R}}}`).join(x);return w},"substitute"),b=new Set(h);for(let E of i.values()){if((0,ec.extractAssetReference)(tc(E.fm.exo__Asset_prototype))!==c)continue;let R=E.fm.exo__Asset_relates,x=new Set((Array.isArray(R)?R:R!=null?[R]:[]).map(O=>(0,ec.extractAssetReference)(O)).filter(O=>O!=null));if(x.size===b.size&&[...b].every(O=>x.has(O)))throw new Error(`instantiatePrototypeSubtree: already deployed \u2014 an instance of prototype ${c} with the same ref-params [${[...b].join(", ")}] already exists (${E.file.path}). Refusing to duplicate the subgraph.`)}let _=new Map;for(let E of u){let w=i.get(E);if(!w)continue;let R=s(w.fm.exo__Instance_class),x=R&&R.endsWith("Prototype")?R.slice(0,-9):R;if(!x)throw new Error(`instantiatePrototypeSubtree: cannot resolve instance class for subtree node ${E} (${w.file.path}) \u2014 its exo__Instance_class is missing or unresolvable. Aborting so no asset is written with a dangling [[undefined]] class.`);let O=o(x);if(!O)throw new Error(`instantiatePrototypeSubtree: cannot resolve class UID for instance class \xAB${x}\xBB (subtree node ${E}, ${w.file.path}) \u2014 no class-definition asset with that label is loaded. Aborting so no asset is written with a dangling [[${x}]] class wikilink.`);_.set(E,`[[${O}|${x}]]`)}let S=ec.DateFormatter.toISOTimestamp(new Date),I=[c,...[...u].filter(E=>E!==c)];for(let E of I){let w=i.get(E);if(!w)continue;let{file:R,fm:x}=w,O=d.get(E),N=_.get(E),G=m(_E(x.exo__Asset_label)),j=["---",`exo__Asset_uid: ${O}`];x.exo__Asset_isDefinedBy&&j.push(`exo__Asset_isDefinedBy: "[[${(0,ec.extractAssetReference)(tc(x.exo__Asset_isDefinedBy))}]]"`),j.push(`exo__Asset_createdAt: ${S}`,`exo__Asset_updatedAt: ${S}`,"exo__Instance_class:",` - "${N}"`,`exo__Asset_label: ${JSON.stringify(G)}`,"aliases:",` - ${JSON.stringify(G)}`,`exo__Asset_prototype: "[[${E}]]"`,`ems__Effort_status: "[[${T_e}]]"`);let ae=(0,ec.extractAssetReference)(tc(x.ems__Effort_blocker));if(ae){let oe=d.get(ae)??ae;j.push(`ems__Effort_blocker: "[[${oe}]]"`)}if(E===c){if(h.length>0){j.push("exo__Asset_relates:");for(let oe of h)j.push(` - "[[${oe}]]"`)}g&&j.push(`ems__Effort_parent: "[[${g}]]"`)}else j.push(`ems__Effort_parent: "[[${d.get(c)}]]"`);j.push("---","");let Y=j.join(`
464
- `),M=R.path.lastIndexOf("/"),ce=M>=0?R.path.substring(0,M):"",W=ce?`${ce}/${O}.md`:`${O}.md`;await e.createFile(W,Y)}}}}a(x_e,"createInstantiatePrototypeSubtreeService")});var Z7=T(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.createInstantiatePrototypeSubtreeService=ht.createPathBasedTargetResolver=ht.rewriteFrontmatterScalars=ht.createDuplicateAssetService=ht.createSetStatusService=ht.createRemovePropertyService=ht.createUpdatePropertyService=ht.createPlanForEveningService=ht.createRepairFolderService=ht.createRenameToUidService=ht.createFixMissingLabelService=ht.createCleanPropertiesService=ht.createArchiveAssetService=ht.createCreateRelatedProjectService=ht.createCreateRelatedTaskService=ht.createCreateAssetService=void 0;var _i=Q7();Object.defineProperty(ht,"createCreateAssetService",{enumerable:!0,get:a(function(){return _i.createCreateAssetService},"get")});Object.defineProperty(ht,"createCreateRelatedTaskService",{enumerable:!0,get:a(function(){return _i.createCreateRelatedTaskService},"get")});Object.defineProperty(ht,"createCreateRelatedProjectService",{enumerable:!0,get:a(function(){return _i.createCreateRelatedProjectService},"get")});Object.defineProperty(ht,"createArchiveAssetService",{enumerable:!0,get:a(function(){return _i.createArchiveAssetService},"get")});Object.defineProperty(ht,"createCleanPropertiesService",{enumerable:!0,get:a(function(){return _i.createCleanPropertiesService},"get")});Object.defineProperty(ht,"createFixMissingLabelService",{enumerable:!0,get:a(function(){return _i.createFixMissingLabelService},"get")});Object.defineProperty(ht,"createRenameToUidService",{enumerable:!0,get:a(function(){return _i.createRenameToUidService},"get")});Object.defineProperty(ht,"createRepairFolderService",{enumerable:!0,get:a(function(){return _i.createRepairFolderService},"get")});Object.defineProperty(ht,"createPlanForEveningService",{enumerable:!0,get:a(function(){return _i.createPlanForEveningService},"get")});Object.defineProperty(ht,"createUpdatePropertyService",{enumerable:!0,get:a(function(){return _i.createUpdatePropertyService},"get")});Object.defineProperty(ht,"createRemovePropertyService",{enumerable:!0,get:a(function(){return _i.createRemovePropertyService},"get")});Object.defineProperty(ht,"createSetStatusService",{enumerable:!0,get:a(function(){return _i.createSetStatusService},"get")});Object.defineProperty(ht,"createDuplicateAssetService",{enumerable:!0,get:a(function(){return _i.createDuplicateAssetService},"get")});Object.defineProperty(ht,"rewriteFrontmatterScalars",{enumerable:!0,get:a(function(){return _i.rewriteFrontmatterScalars},"get")});Object.defineProperty(ht,"createPathBasedTargetResolver",{enumerable:!0,get:a(function(){return _i.createPathBasedTargetResolver},"get")});var P_e=J7();Object.defineProperty(ht,"createInstantiatePrototypeSubtreeService",{enumerable:!0,get:a(function(){return P_e.createInstantiatePrototypeSubtreeService},"get")})});var _we={};qu(_we,{createProgram:()=>UE});module.exports=Zg(_we);var j8e=Q(cv());ct();ct();var bg=require("fs"),SO=require("path"),qr=Q(Fe());var Cd=class{static{a(this,"TableFormatter")}format(e){if(e.length===0)return"No results";let t=this.getAllVariables(e),n=e.map(i=>this.solutionToRow(i,t));return this.renderTable(t,n)}getAllVariables(e){let t=new Set;for(let n of e)for(let i of n.variables())t.add(i);return Array.from(t).sort()}solutionToRow(e,t){return t.map(n=>{let i=e.get(n);return i?this.formatValue(i.toString()):""})}formatValue(e){return e.length>50?e.substring(0,47)+"...":e}renderTable(e,t){let n=e.map((s,o)=>{let c=s.length+1,l=Math.max(...t.map(u=>u[o]?.length||0));return Math.max(c,l,10)}),i=[];i.push(this.renderSeparator(n,"top")),i.push(this.renderRow(e.map(s=>`?${s}`),n)),i.push(this.renderSeparator(n,"mid"));for(let s of t)i.push(this.renderRow(s,n));return i.push(this.renderSeparator(n,"bottom")),i.join(`
464
+ `),M=R.path.lastIndexOf("/"),ce=M>=0?R.path.substring(0,M):"",q=ce?`${ce}/${O}.md`:`${O}.md`;await e.createFile(q,Y)}}}}a(x_e,"createInstantiatePrototypeSubtreeService")});var Z7=T(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.createInstantiatePrototypeSubtreeService=ht.createPathBasedTargetResolver=ht.rewriteFrontmatterScalars=ht.createDuplicateAssetService=ht.createSetStatusService=ht.createRemovePropertyService=ht.createUpdatePropertyService=ht.createPlanForEveningService=ht.createRepairFolderService=ht.createRenameToUidService=ht.createFixMissingLabelService=ht.createCleanPropertiesService=ht.createArchiveAssetService=ht.createCreateRelatedProjectService=ht.createCreateRelatedTaskService=ht.createCreateAssetService=void 0;var _i=Q7();Object.defineProperty(ht,"createCreateAssetService",{enumerable:!0,get:a(function(){return _i.createCreateAssetService},"get")});Object.defineProperty(ht,"createCreateRelatedTaskService",{enumerable:!0,get:a(function(){return _i.createCreateRelatedTaskService},"get")});Object.defineProperty(ht,"createCreateRelatedProjectService",{enumerable:!0,get:a(function(){return _i.createCreateRelatedProjectService},"get")});Object.defineProperty(ht,"createArchiveAssetService",{enumerable:!0,get:a(function(){return _i.createArchiveAssetService},"get")});Object.defineProperty(ht,"createCleanPropertiesService",{enumerable:!0,get:a(function(){return _i.createCleanPropertiesService},"get")});Object.defineProperty(ht,"createFixMissingLabelService",{enumerable:!0,get:a(function(){return _i.createFixMissingLabelService},"get")});Object.defineProperty(ht,"createRenameToUidService",{enumerable:!0,get:a(function(){return _i.createRenameToUidService},"get")});Object.defineProperty(ht,"createRepairFolderService",{enumerable:!0,get:a(function(){return _i.createRepairFolderService},"get")});Object.defineProperty(ht,"createPlanForEveningService",{enumerable:!0,get:a(function(){return _i.createPlanForEveningService},"get")});Object.defineProperty(ht,"createUpdatePropertyService",{enumerable:!0,get:a(function(){return _i.createUpdatePropertyService},"get")});Object.defineProperty(ht,"createRemovePropertyService",{enumerable:!0,get:a(function(){return _i.createRemovePropertyService},"get")});Object.defineProperty(ht,"createSetStatusService",{enumerable:!0,get:a(function(){return _i.createSetStatusService},"get")});Object.defineProperty(ht,"createDuplicateAssetService",{enumerable:!0,get:a(function(){return _i.createDuplicateAssetService},"get")});Object.defineProperty(ht,"rewriteFrontmatterScalars",{enumerable:!0,get:a(function(){return _i.rewriteFrontmatterScalars},"get")});Object.defineProperty(ht,"createPathBasedTargetResolver",{enumerable:!0,get:a(function(){return _i.createPathBasedTargetResolver},"get")});var P_e=J7();Object.defineProperty(ht,"createInstantiatePrototypeSubtreeService",{enumerable:!0,get:a(function(){return P_e.createInstantiatePrototypeSubtreeService},"get")})});var _we={};qu(_we,{createProgram:()=>UE});module.exports=Zg(_we);var j8e=Q(cv());ct();ct();var bg=require("fs"),SO=require("path"),qr=Q(Fe());var Cd=class{static{a(this,"TableFormatter")}format(e){if(e.length===0)return"No results";let t=this.getAllVariables(e),n=e.map(i=>this.solutionToRow(i,t));return this.renderTable(t,n)}getAllVariables(e){let t=new Set;for(let n of e)for(let i of n.variables())t.add(i);return Array.from(t).sort()}solutionToRow(e,t){return t.map(n=>{let i=e.get(n);return i?this.formatValue(i.toString()):""})}formatValue(e){return e.length>50?e.substring(0,47)+"...":e}renderTable(e,t){let n=e.map((s,o)=>{let c=s.length+1,l=Math.max(...t.map(u=>u[o]?.length||0));return Math.max(c,l,10)}),i=[];i.push(this.renderSeparator(n,"top")),i.push(this.renderRow(e.map(s=>`?${s}`),n)),i.push(this.renderSeparator(n,"mid"));for(let s of t)i.push(this.renderRow(s,n));return i.push(this.renderSeparator(n,"bottom")),i.join(`
465
465
  `)}renderRow(e,t){return`\u2502 ${e.map((i,s)=>i.padEnd(t[s])).join(" \u2502 ")} \u2502`}renderSeparator(e,t){let n=t==="top"?"\u250C":t==="mid"?"\u251C":"\u2514",i=t==="top"?"\u2510":t==="mid"?"\u2524":"\u2518",o=t==="mid"?"\u2500\u253C\u2500":"\u2500"+(t==="mid"?"\u253C":"\u2500")+"\u2500",c=e.map(l=>"\u2500".repeat(l+2));return`${n}${c.join(o)}${i}`}};var LS=class{static{a(this,"JsonFormatter")}format(e){let t=e.map(n=>n.toJSON());return JSON.stringify(t,null,2)}};var NS=class{static{a(this,"CsvFormatter")}format(e){if(e.length===0)return"";let t=this.getAllVariables(e),n=[];n.push(t.join(","));for(let i of e){let s=t.map(o=>{let c=i.get(o);return c?this.escapeValue(c.toString()):""});n.push(s.join(","))}return n.join(`
466
466
  `)}getAllVariables(e){let t=new Set;for(let n of e)for(let i of n.variables())t.add(i);return Array.from(t).sort()}escapeValue(e){return e.includes(",")||e.includes('"')||e.includes(`
467
467
  `)||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e}};var xd=class{static{a(this,"TriplesFormatter")}formatNTriples(e){return e.map(t=>t.toString()).join(`
@@ -541,20 +541,20 @@ LIMIT 30`,parameters:[],examples:{}}],$w=class{static{a(this,"TemplateRegistry")
541
541
  `),s=i.length,o=Math.max(1,e-t),c=Math.min(s,e+t),l=[];for(let u=o;u<=c;u++)l.push({number:u,content:i[u-1],isError:u===e});return{startLine:o,endLine:c,errorLine:e,errorColumn:n,lines:l}}a(Vye,"getQueryContext");function Gye(r){let e=/PREFIX\s+(\w+):\s*</gi,t=[],n;for(;(n=e.exec(r))!==null;)t.push(n[1]);return t}a(Gye,"extractDeclaredPrefixes");function qye(r){let e=[/unknown prefix[:\s]+['"]?(\w+)['"]?/i,/prefix\s+['"]?(\w+)['"]?\s+not\s+defined/i,/undefined\s+prefix[:\s]+['"]?(\w+)['"]?/i];for(let t of e){let n=r.match(t);if(n)return n[1]}return null}a(qye,"extractUnknownPrefix");function Wye(r){let e=[/line\s+(\d+),?\s*column\s+(\d+)/i,/line\s+(\d+):(\d+)/i,/at\s+(\d+):(\d+)/i,/\((\d+),\s*(\d+)\)/];for(let n of e){let i=r.match(n);if(i)return{line:parseInt(i[1],10),column:parseInt(i[2],10)}}let t=r.match(/line\s+(\d+)/i);return t?{line:parseInt(t[1],10)}:{}}a(Wye,"extractPosition");function zye(r){let e=[/timeout[^\d]*(\d+)\s*ms/i,/timeout[^\d]*(\d+)\s*milliseconds/i,/(\d+)\s*ms\s*timeout/i,/exceeded[^\d]*(\d+)\s*ms/i];for(let t of e){let n=r.match(t);if(n)return parseInt(n[1],10)}return null}a(zye,"extractTimeoutDuration");var Uw=class{constructor(){this.wellKnownPrefixes={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",xsd:"http://www.w3.org/2001/XMLSchema#",owl:"http://www.w3.org/2002/07/owl#",ems:"http://exocortex.local/ems#",exo:"http://exocortex.local/exo#",ims:"http://exocortex.local/ims#"}}static{a(this,"SPARQLErrorEnhancer")}classifyError(e){let t=e.message.toLowerCase();return t.includes("unknown prefix")||t.includes("prefix")&&(t.includes("not defined")||t.includes("undefined"))?"unknown_prefix":t.includes("parse error")||t.includes("syntax error")||t.includes("unexpected")||t.includes("expected")?"syntax":t.includes("timeout")||t.includes("timed out")||t.includes("exceeded")?"timeout":t.includes("econnrefused")||t.includes("connection refused")||t.includes("network")||t.includes("connect")?"connection":"unknown"}enhanceError(e,t){switch(this.classifyError(e)){case"unknown_prefix":return this.enhanceUnknownPrefixError(e,t);case"syntax":return this.enhanceSyntaxError(e,t);case"timeout":return this.enhanceTimeoutError(e,t);case"connection":return this.enhanceConnectionError(e,t);default:return this.enhanceUnknownError(e,t)}}enhanceUnknownPrefixError(e,t){let n=qye(e.message),i=Gye(t),s=[...new Set([...i,...Object.keys(this.wellKnownPrefixes)])],o,c=[];if(n){let l=Bye(n,s);l.length>0?(o=`Unknown prefix '${n}'. Did you mean: ${l.join(", ")}?`,c.push(`Replace '${n}:' with '${l[0]}:'`)):o=`Unknown prefix '${n}'.`;let u=i.length>0?i.join(", "):Object.keys(this.wellKnownPrefixes).join(", ");o+=`
542
542
 
543
543
  Available prefixes: ${u}`,this.wellKnownPrefixes[n]&&c.push(`Add: PREFIX ${n}: <${this.wellKnownPrefixes[n]}>`)}else o=e.message;return{type:"unknown_prefix",message:o,originalMessage:e.message,originalStack:e.stack,suggestions:c.length>0?c:void 0}}enhanceSyntaxError(e,t){let n=e,i=n.line!==void 0?{line:n.line,column:n.column}:Wye(e.message),s,o;i.line?(s=`Syntax error at line ${i.line}`,i.column&&(s+=`, column ${i.column}`),s+=`: ${e.message.replace(/.*line\s+\d+.*?:\s*/i,"")}`,o=Vye(t,i.line,2,i.column)):s=`Syntax error: ${e.message}`;let c=this.generateSyntaxSuggestions(e.message);return{type:"syntax",message:s,originalMessage:e.message,originalStack:e.stack,suggestions:c.length>0?c:void 0,context:o,line:i.line,column:i.column}}generateSyntaxSuggestions(e){let t=[],n=e.toLowerCase();return(n.includes("where")||n.includes("expected"))&&t.push("Ensure your query has a WHERE clause: SELECT ?s WHERE { ... }"),(n.includes("{")||n.includes("}")||n.includes("brace")||n.includes("bracket"))&&t.push("Check that all braces { } are properly balanced"),(n.includes("variable")||n.includes("?"))&&t.push("Variables must start with '?' (e.g., ?subject, ?predicate, ?object)"),(n.includes("end of input")||n.includes("eof"))&&t.push("Query may be incomplete - check for missing closing braces or statements"),n.includes("prefix")&&t.push("Add PREFIX declarations at the start of your query"),t.length===0&&t.push("Check SPARQL syntax reference: https://www.w3.org/TR/sparql11-query/"),t}enhanceTimeoutError(e,t){let n=zye(e.message),i=n?Math.round(n/1e3):null,s;i?s=`Query timed out after ${i} second${i!==1?"s":""}`:s="Query timed out";let o=["Try limiting results with LIMIT (e.g., LIMIT 100)","Add more specific FILTER conditions to reduce result set","Use more selective triple patterns","Consider using OPTIONAL sparingly (it can be expensive)"];return/\bLIMIT\b/i.test(t)||o.unshift("Add LIMIT clause to restrict result count"),/SELECT\s+\*/i.test(t)&&o.push("Replace SELECT * with specific variables to reduce data transfer"),{type:"timeout",message:s,originalMessage:e.message,originalStack:e.stack,suggestions:o}}enhanceConnectionError(e,t){let n="Connection failed to SPARQL endpoint",i=["Check that the SPARQL endpoint is running","Verify network connectivity","Check firewall settings"];return{type:"connection",message:n,originalMessage:e.message,originalStack:e.stack,suggestions:i}}enhanceUnknownError(e,t){return{type:"unknown",message:e.message,originalMessage:e.message,originalStack:e.stack,suggestions:["Check query syntax and try again"]}}formatForText(e){let t=[];if(t.push(`\u274C ${e.message}`),e.context){t.push(""),t.push("Context:");for(let n of e.context.lines){let i=n.isError?">>> ":" ";if(t.push(`${i}${n.number.toString().padStart(3)}: ${n.content}`),n.isError&&e.context.errorColumn){let s=" ".repeat(8+n.number.toString().length+e.context.errorColumn-1)+"^";t.push(s)}}}if(e.suggestions&&e.suggestions.length>0){t.push(""),t.push("Suggestions:");for(let n of e.suggestions)t.push(` \u2022 ${n}`)}return t.join(`
544
- `)}formatForJSON(e){return{type:e.type,message:e.message,originalMessage:e.originalMessage,suggestions:e.suggestions,line:e.line,column:e.column,context:e.context?{startLine:e.context.startLine,endLine:e.context.endLine,errorLine:e.context.errorLine,errorColumn:e.context.errorColumn,lines:e.context.lines.map(t=>({number:t.number,content:t.content,isError:t.isError}))}:void 0}}};var Bw=class r{static{a(this,"NTriplesFormatter")}static escapeString(e){let t=e.replace(/\\/g,"\\\\");return t=t.replace(/"/g,'\\"'),t=t.replace(/\n/g,"\\n"),t=t.replace(/\r/g,"\\r"),t=t.replace(/\t/g,"\\t"),t}static formatObject(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("urn:")?`<${e}>`:`"${r.escapeString(e)}"`}};var Iu=require("fs"),bO=require("path");function Vw(r){let e=new Map,t="obsidian://vault/",n;try{n=(0,Iu.readdirSync)(r)}catch{return e}for(let i of n){let s=(0,bO.join)(r,i);if(i.startsWith("."))continue;let o;try{o=(0,Iu.statSync)(s)}catch{continue}if(!o.isDirectory())continue;let c;try{c=(0,Iu.readdirSync)(s)}catch{continue}for(let l of c){let u=(0,bO.join)(s,l);if(l.startsWith("."))continue;let f;try{f=(0,Iu.statSync)(u)}catch{continue}if(!f.isDirectory())continue;let d=!1;try{d=(0,Iu.readdirSync)(u).some(h=>h.endsWith(".md"))}catch{continue}if(d){let p=`${i}/${l}`,h=encodeURI(p),g=`${t}${h}/`;/^[a-zA-Z][a-zA-Z0-9_]*$/.test(l)&&e.set(l,g)}}}return e}a(Vw,"scanVaultNamespaces");Ww();var Xye=300,C8=3e4,Qye="EXOCORTEX_SPARQL_TIMEOUT";function Jye(){let r=process.env[Qye];if(!r)return C8;try{let e=Zye(r);if(e!==null&&e>0)return e}catch{}return C8}a(Jye,"getDefaultTimeout");function Zye(r){let e=r.trim().toLowerCase();if(!e)return null;if(e.endsWith("ms")){let n=parseInt(e.slice(0,-2),10);return isNaN(n)||n<=0?null:n}if(e.endsWith("s")){let n=parseInt(e.slice(0,-1),10);return isNaN(n)||n<=0?null:n*1e3}let t=parseInt(e,10);return isNaN(t)||t<=0?null:t*1e3}a(Zye,"parseTimeoutSafe");function e0e(r){if(!r)return Xye;let e=parseInt(r.trim(),10);if(isNaN(e)||e<=0)throw new Ye(`Invalid cache TTL: "${r}". Must be a positive number (seconds).`,'exocortex query --cache-ttl 600 "SELECT * WHERE { ?s ?p ?o }"');return e}a(e0e,"parseCacheTtl");function t0e(r){let e=r.trim().toLowerCase();if(e.endsWith("ms")){let n=parseInt(e.slice(0,-2),10);if(isNaN(n)||n<=0)throw new Ye(`Invalid timeout format: "${r}". Value must be a positive number.`,'exocortex query --timeout "30s" or --timeout "5000ms"');return n}if(e.endsWith("s")){let n=parseInt(e.slice(0,-1),10);if(isNaN(n)||n<=0)throw new Ye(`Invalid timeout format: "${r}". Value must be a positive number.`,'exocortex query --timeout "30s" or --timeout "5000ms"');return n*1e3}let t=parseInt(e,10);if(isNaN(t)||t<=0)throw new Ye(`Invalid timeout format: "${r}". Use formats like "30s", "5000ms", or just a number (seconds).`,'exocortex query --timeout "30s" or --timeout "5000ms"');return t*1e3}a(t0e,"parseTimeout");async function _O(r,e,t=Date.now()){let n,i=new Promise((s,o)=>{n=setTimeout(()=>{let c=Date.now()-t;o(new Im(e,c))},e),n&&typeof n=="object"&&"unref"in n&&n.unref()});return Promise.race([r,i])}a(_O,"executeWithTimeout");function P8(){return new pe("query").description("Execute SPARQL query against Obsidian vault").argument("[query]","SPARQL query string or path to .sparql file (optional if --template is used)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json|csv|ntriples","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--timeout <duration>","Query timeout (e.g., 30s, 5000ms)","30s").option("--dry-run","Validate query syntax without executing (no vault loading)").option("--explain","Show optimized query plan").option("--stats","Show execution statistics").option("--no-optimize","Disable query optimization").option("--use-cache","Use persistent triple cache (faster vault loading)").option("--cache-ttl <seconds>","Query result cache TTL in seconds (default: 300)").option("--no-cache","Bypass query result cache").option("--template <name>","Use a predefined query template").option("--param <params>","Template parameters (format: key=value,key2=value2)").option("--strict","Fail on unresolved label-form wikilinks in property paths (sets EXOCORTEX_SPARQL_STRICT=1, Issue #3282)").action(async(r,e)=>{let t=e.output||"text";ue.setFormat(t);let n=process.env.EXOCORTEX_SPARQL_STRICT;e.strict&&(process.env.EXOCORTEX_SPARQL_STRICT="1");let i="";try{let s=Date.now(),o=e.timeout?t0e(e.timeout):Jye(),c=e0e(e.cacheTtl),l=e.cache!==!1;if(e.template){let Y=new $w,M=e.param?Y.parseParamString(e.param):{};if(i=Y.applyTemplate(e.template,M),t==="text"){let ce=Y.getTemplate(e.template);console.log(`\u{1F4CB} Using template: ${e.template}`),Object.keys(M).length>0&&console.log(` Parameters: ${Object.entries(M).map(([W,oe])=>`${W}=${oe}`).join(", ")}`),console.log()}}else if(r)i=r0e(r);else throw new Ye("Either a query argument or --template flag is required.",'exocortex query "SELECT * WHERE { ?s ?p ?o }" or exocortex query --template tasks-by-date --param date=2024-01-15');let u=i;if(e.dryRun){await n0e(i,e,t);return}let f=(0,SO.resolve)(e.vault),d=l?await Z6(f):null;if(l){let M=await new Ha().get(u,c,d);if(M!==null){let ce=Date.now()-s;if(t==="json"){let W=pt.success(M,{durationMs:ce,itemCount:M.count||0,queryResultCacheHit:!0});console.log(JSON.stringify(W,null,2))}else{console.log(`\u{1F4E6} (cached) Query result loaded from cache in ${ce}ms
545
- `);let W=M;W.type==="select"&&W.bindings?(console.log(`\u2705 Found ${W.bindings.length} result(s)
546
- `),o0e(W.bindings,e.format)):W.type==="construct"&&W.triples&&(console.log(`\u2705 Generated ${W.triples.length} triple(s)
547
- `),a0e(W.triples,e.format))}return}}if(!(0,bg.existsSync)(f))throw new Le(f);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${f}...`);let p=Date.now(),h=e.useCache??!1,g=[],m=!1,b=await yi(f,{useCache:h});g=b.triples,m=b.cacheHit;let _=UP(b);_!==null&&console.error(_);let S=b.skippedFiles&&b.skippedFiles.length>0?{skippedCount:b.skippedFiles.length,skippedFiles:b.skippedFiles}:{};t==="text"&&m&&console.log(b.mode==="delta"?`\u267B\uFE0F Cache refreshed incrementally (${b.reparsedFiles} file(s) re-parsed)...`:"\u{1F680} Cache hit! Loading from persistent cache...");let I=new qr.InMemoryTripleStore;await I.addAll(g);let E=Date.now()-p;if(t==="text"){let Y=m?" (from cache)":"";console.log(`\u2705 Loaded ${g.length} triples in ${E}ms${Y}
548
- `),console.log("\u{1F50D} Parsing SPARQL query...")}let w=new qr.ExoQLParser;i=Gw(i),i=ip(i);let R=qw(Vw(f));R.size>0&&w.setVaultPrefixes(R);let x=w.parse(i);if(x.type==="update"){t==="text"&&console.log("\u{1F504} Executing SPARQL UPDATE...");let Y=Date.now(),M=new qr.UpdateExecutor(I),ce=await _O(M.execute(x),o,Y),W=Date.now()-Y,oe=Date.now()-s;if(t==="json"){let X=pt.success({query:i,type:"update",results:ce},{durationMs:oe,itemCount:ce.length,loadDurationMs:E,execDurationMs:W,triplesScanned:g.length,cacheHit:m,...S});console.log(JSON.stringify(X,null,2))}else l0e(ce,e.format),console.log(),console.log("\u26A0\uFE0F Changes applied to in-memory store only (not persisted to vault files)"),e.stats&&(console.log(`
549
- \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${E}ms${m?" (from cache)":""}`),console.log(` Query execution: ${W}ms`),console.log(` Total time: ${oe}ms`),console.log(` Triples scanned: ${g.length}`));return}t==="text"&&console.log("\u{1F504} Translating to algebra...");let N=new qr.ExoQLAlgebraTranslator().translate(x);if(!e.noOptimize&&N.type!=="construct")N=new qr.AlgebraOptimizer().optimize(N);else if(!e.noOptimize&&N.type==="construct"){let Y=new qr.AlgebraOptimizer,M=N;N={...M,where:Y.optimize(M.where)}}if(e.explain&&t==="text"){console.log("\u{1F4CA} Query Plan:");let Y=new qr.AlgebraSerializer;if(N.type==="construct"){let M=N;console.log("CONSTRUCT Template:"),console.log(" (template patterns)"),console.log("WHERE:"),console.log(Y.toString(M.where))}else console.log(Y.toString(N));console.log()}let G=Date.now(),j=new qr.ExoQLQueryExecutor(I),ae=t==="text"?new kw("Executing query",{delayMs:2e3}):null;if(j.isConstructQuery(N)){ae?.start();let Y=await _O(j.executeConstruct(N),o,G),M=Date.now()-G;ae?.stop();let ce=Date.now()-s;if(l){let W=new xd,oe={type:"construct",count:Y.length,triples:JSON.parse(W.formatJson(Y))};await new Ha().set(u,oe,c,d)}if(t==="json"){let W=new xd,oe={query:i,count:Y.length,triples:JSON.parse(W.formatJson(Y))},X=pt.success(oe,{durationMs:ce,itemCount:Y.length,loadDurationMs:E,execDurationMs:M,triplesScanned:g.length,cacheHit:m,queryResultCacheHit:!1,...S});console.log(JSON.stringify(X,null,2))}else console.log(`\u2705 Generated ${Y.length} triple(s) in ${M}ms
544
+ `)}formatForJSON(e){return{type:e.type,message:e.message,originalMessage:e.originalMessage,suggestions:e.suggestions,line:e.line,column:e.column,context:e.context?{startLine:e.context.startLine,endLine:e.context.endLine,errorLine:e.context.errorLine,errorColumn:e.context.errorColumn,lines:e.context.lines.map(t=>({number:t.number,content:t.content,isError:t.isError}))}:void 0}}};var Bw=class r{static{a(this,"NTriplesFormatter")}static escapeString(e){let t=e.replace(/\\/g,"\\\\");return t=t.replace(/"/g,'\\"'),t=t.replace(/\n/g,"\\n"),t=t.replace(/\r/g,"\\r"),t=t.replace(/\t/g,"\\t"),t}static formatObject(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("urn:")?`<${e}>`:`"${r.escapeString(e)}"`}};var Iu=require("fs"),bO=require("path");function Vw(r){let e=new Map,t="obsidian://vault/",n;try{n=(0,Iu.readdirSync)(r)}catch{return e}for(let i of n){let s=(0,bO.join)(r,i);if(i.startsWith("."))continue;let o;try{o=(0,Iu.statSync)(s)}catch{continue}if(!o.isDirectory())continue;let c;try{c=(0,Iu.readdirSync)(s)}catch{continue}for(let l of c){let u=(0,bO.join)(s,l);if(l.startsWith("."))continue;let f;try{f=(0,Iu.statSync)(u)}catch{continue}if(!f.isDirectory())continue;let d=!1;try{d=(0,Iu.readdirSync)(u).some(h=>h.endsWith(".md"))}catch{continue}if(d){let p=`${i}/${l}`,h=encodeURI(p),g=`${t}${h}/`;/^[a-zA-Z][a-zA-Z0-9_]*$/.test(l)&&e.set(l,g)}}}return e}a(Vw,"scanVaultNamespaces");Ww();var Xye=300,C8=3e4,Qye="EXOCORTEX_SPARQL_TIMEOUT";function Jye(){let r=process.env[Qye];if(!r)return C8;try{let e=Zye(r);if(e!==null&&e>0)return e}catch{}return C8}a(Jye,"getDefaultTimeout");function Zye(r){let e=r.trim().toLowerCase();if(!e)return null;if(e.endsWith("ms")){let n=parseInt(e.slice(0,-2),10);return isNaN(n)||n<=0?null:n}if(e.endsWith("s")){let n=parseInt(e.slice(0,-1),10);return isNaN(n)||n<=0?null:n*1e3}let t=parseInt(e,10);return isNaN(t)||t<=0?null:t*1e3}a(Zye,"parseTimeoutSafe");function e0e(r){if(!r)return Xye;let e=parseInt(r.trim(),10);if(isNaN(e)||e<=0)throw new Ye(`Invalid cache TTL: "${r}". Must be a positive number (seconds).`,'exocortex query --cache-ttl 600 "SELECT * WHERE { ?s ?p ?o }"');return e}a(e0e,"parseCacheTtl");function t0e(r){let e=r.trim().toLowerCase();if(e.endsWith("ms")){let n=parseInt(e.slice(0,-2),10);if(isNaN(n)||n<=0)throw new Ye(`Invalid timeout format: "${r}". Value must be a positive number.`,'exocortex query --timeout "30s" or --timeout "5000ms"');return n}if(e.endsWith("s")){let n=parseInt(e.slice(0,-1),10);if(isNaN(n)||n<=0)throw new Ye(`Invalid timeout format: "${r}". Value must be a positive number.`,'exocortex query --timeout "30s" or --timeout "5000ms"');return n*1e3}let t=parseInt(e,10);if(isNaN(t)||t<=0)throw new Ye(`Invalid timeout format: "${r}". Use formats like "30s", "5000ms", or just a number (seconds).`,'exocortex query --timeout "30s" or --timeout "5000ms"');return t*1e3}a(t0e,"parseTimeout");async function _O(r,e,t=Date.now()){let n,i=new Promise((s,o)=>{n=setTimeout(()=>{let c=Date.now()-t;o(new Im(e,c))},e),n&&typeof n=="object"&&"unref"in n&&n.unref()});return Promise.race([r,i])}a(_O,"executeWithTimeout");function P8(){return new pe("query").description("Execute SPARQL query against Obsidian vault").argument("[query]","SPARQL query string or path to .sparql file (optional if --template is used)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json|csv|ntriples","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--timeout <duration>","Query timeout (e.g., 30s, 5000ms)","30s").option("--dry-run","Validate query syntax without executing (no vault loading)").option("--explain","Show optimized query plan").option("--stats","Show execution statistics").option("--no-optimize","Disable query optimization").option("--use-cache","Use persistent triple cache (faster vault loading)").option("--cache-ttl <seconds>","Query result cache TTL in seconds (default: 300)").option("--no-cache","Bypass query result cache").option("--template <name>","Use a predefined query template").option("--param <params>","Template parameters (format: key=value,key2=value2)").option("--strict","Fail on unresolved label-form wikilinks in property paths (sets EXOCORTEX_SPARQL_STRICT=1, Issue #3282)").action(async(r,e)=>{let t=e.output||"text";ue.setFormat(t);let n=process.env.EXOCORTEX_SPARQL_STRICT;e.strict&&(process.env.EXOCORTEX_SPARQL_STRICT="1");let i="";try{let s=Date.now(),o=e.timeout?t0e(e.timeout):Jye(),c=e0e(e.cacheTtl),l=e.cache!==!1;if(e.template){let Y=new $w,M=e.param?Y.parseParamString(e.param):{};if(i=Y.applyTemplate(e.template,M),t==="text"){let ce=Y.getTemplate(e.template);console.log(`\u{1F4CB} Using template: ${e.template}`),Object.keys(M).length>0&&console.log(` Parameters: ${Object.entries(M).map(([q,oe])=>`${q}=${oe}`).join(", ")}`),console.log()}}else if(r)i=r0e(r);else throw new Ye("Either a query argument or --template flag is required.",'exocortex query "SELECT * WHERE { ?s ?p ?o }" or exocortex query --template tasks-by-date --param date=2024-01-15');let u=i;if(e.dryRun){await n0e(i,e,t);return}let f=(0,SO.resolve)(e.vault),d=l?await Z6(f):null;if(l){let M=await new Ha().get(u,c,d);if(M!==null){let ce=Date.now()-s;if(t==="json"){let q=pt.success(M,{durationMs:ce,itemCount:M.count||0,queryResultCacheHit:!0});console.log(JSON.stringify(q,null,2))}else{console.log(`\u{1F4E6} (cached) Query result loaded from cache in ${ce}ms
545
+ `);let q=M;q.type==="select"&&q.bindings?(console.log(`\u2705 Found ${q.bindings.length} result(s)
546
+ `),o0e(q.bindings,e.format)):q.type==="construct"&&q.triples&&(console.log(`\u2705 Generated ${q.triples.length} triple(s)
547
+ `),a0e(q.triples,e.format))}return}}if(!(0,bg.existsSync)(f))throw new Le(f);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${f}...`);let p=Date.now(),h=e.useCache??!1,g=[],m=!1,b=await yi(f,{useCache:h});g=b.triples,m=b.cacheHit;let _=UP(b);_!==null&&console.error(_);let S=b.skippedFiles&&b.skippedFiles.length>0?{skippedCount:b.skippedFiles.length,skippedFiles:b.skippedFiles}:{};t==="text"&&m&&console.log(b.mode==="delta"?`\u267B\uFE0F Cache refreshed incrementally (${b.reparsedFiles} file(s) re-parsed)...`:"\u{1F680} Cache hit! Loading from persistent cache...");let I=new qr.InMemoryTripleStore;await I.addAll(g);let E=Date.now()-p;if(t==="text"){let Y=m?" (from cache)":"";console.log(`\u2705 Loaded ${g.length} triples in ${E}ms${Y}
548
+ `),console.log("\u{1F50D} Parsing SPARQL query...")}let w=new qr.ExoQLParser;i=Gw(i),i=ip(i);let R=qw(Vw(f));R.size>0&&w.setVaultPrefixes(R);let x=w.parse(i);if(x.type==="update"){t==="text"&&console.log("\u{1F504} Executing SPARQL UPDATE...");let Y=Date.now(),M=new qr.UpdateExecutor(I),ce=await _O(M.execute(x),o,Y),q=Date.now()-Y,oe=Date.now()-s;if(t==="json"){let X=pt.success({query:i,type:"update",results:ce},{durationMs:oe,itemCount:ce.length,loadDurationMs:E,execDurationMs:q,triplesScanned:g.length,cacheHit:m,...S});console.log(JSON.stringify(X,null,2))}else l0e(ce,e.format),console.log(),console.log("\u26A0\uFE0F Changes applied to in-memory store only (not persisted to vault files)"),e.stats&&(console.log(`
549
+ \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${E}ms${m?" (from cache)":""}`),console.log(` Query execution: ${q}ms`),console.log(` Total time: ${oe}ms`),console.log(` Triples scanned: ${g.length}`));return}t==="text"&&console.log("\u{1F504} Translating to algebra...");let N=new qr.ExoQLAlgebraTranslator().translate(x);if(!e.noOptimize&&N.type!=="construct")N=new qr.AlgebraOptimizer().optimize(N);else if(!e.noOptimize&&N.type==="construct"){let Y=new qr.AlgebraOptimizer,M=N;N={...M,where:Y.optimize(M.where)}}if(e.explain&&t==="text"){console.log("\u{1F4CA} Query Plan:");let Y=new qr.AlgebraSerializer;if(N.type==="construct"){let M=N;console.log("CONSTRUCT Template:"),console.log(" (template patterns)"),console.log("WHERE:"),console.log(Y.toString(M.where))}else console.log(Y.toString(N));console.log()}let G=Date.now(),j=new qr.ExoQLQueryExecutor(I),ae=t==="text"?new kw("Executing query",{delayMs:2e3}):null;if(j.isConstructQuery(N)){ae?.start();let Y=await _O(j.executeConstruct(N),o,G),M=Date.now()-G;ae?.stop();let ce=Date.now()-s;if(l){let q=new xd,oe={type:"construct",count:Y.length,triples:JSON.parse(q.formatJson(Y))};await new Ha().set(u,oe,c,d)}if(t==="json"){let q=new xd,oe={query:i,count:Y.length,triples:JSON.parse(q.formatJson(Y))},X=pt.success(oe,{durationMs:ce,itemCount:Y.length,loadDurationMs:E,execDurationMs:M,triplesScanned:g.length,cacheHit:m,queryResultCacheHit:!1,...S});console.log(JSON.stringify(X,null,2))}else console.log(`\u2705 Generated ${Y.length} triple(s) in ${M}ms
550
550
  `),Y.length>0?s0e(Y,e.format):console.log("No triples generated."),e.stats&&(console.log(`
551
- \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${E}ms${m?" (from cache)":""}`),console.log(` Query execution: ${M}ms`),console.log(` Total time: ${ce}ms`),console.log(` Triples scanned: ${g.length}`),console.log(` Triples generated: ${Y.length}`),e.useCache&&console.log(` Triple cache: ${m?"HIT":"MISS (rebuilt)"}`),l&&console.log(" Query result cache: MISS (cached for next run)"))}else{ae?.start();let Y=await _O(j.executeAll(N),o,G),M=Date.now()-G;ae?.stop();let ce=Date.now()-s,W=Y.map(oe=>oe.toJSON());if(l){let oe={type:"select",count:Y.length,bindings:W};await new Ha().set(u,oe,c,d)}if(t==="json"){let oe={query:i,count:Y.length,bindings:W},X=pt.success(oe,{durationMs:ce,itemCount:Y.length,loadDurationMs:E,execDurationMs:M,triplesScanned:g.length,cacheHit:m,queryResultCacheHit:!1,...S});console.log(JSON.stringify(X,null,2))}else console.log(`\u2705 Found ${Y.length} result(s) in ${M}ms
551
+ \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${E}ms${m?" (from cache)":""}`),console.log(` Query execution: ${M}ms`),console.log(` Total time: ${ce}ms`),console.log(` Triples scanned: ${g.length}`),console.log(` Triples generated: ${Y.length}`),e.useCache&&console.log(` Triple cache: ${m?"HIT":"MISS (rebuilt)"}`),l&&console.log(" Query result cache: MISS (cached for next run)"))}else{ae?.start();let Y=await _O(j.executeAll(N),o,G),M=Date.now()-G;ae?.stop();let ce=Date.now()-s,q=Y.map(oe=>oe.toJSON());if(l){let oe={type:"select",count:Y.length,bindings:q};await new Ha().set(u,oe,c,d)}if(t==="json"){let oe={query:i,count:Y.length,bindings:q},X=pt.success(oe,{durationMs:ce,itemCount:Y.length,loadDurationMs:E,execDurationMs:M,triplesScanned:g.length,cacheHit:m,queryResultCacheHit:!1,...S});console.log(JSON.stringify(X,null,2))}else console.log(`\u2705 Found ${Y.length} result(s) in ${M}ms
552
552
  `),Y.length>0?i0e(Y,e.format):console.log("No results found."),e.stats&&(console.log(`
553
553
  \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${E}ms${m?" (from cache)":""}`),console.log(` Query execution: ${M}ms`),console.log(` Total time: ${ce}ms`),console.log(` Triples scanned: ${g.length}`),console.log(` Results returned: ${Y.length}`),e.useCache&&console.log(` Triple cache: ${m?"HIT":"MISS (rebuilt)"}`),l&&console.log(" Query result cache: MISS (cached for next run)"))}}catch(s){O8(s,i,t)}finally{e.strict&&(n===void 0?delete process.env.EXOCORTEX_SPARQL_STRICT:process.env.EXOCORTEX_SPARQL_STRICT=n)}})}a(P8,"sparqlQueryCommand");function O8(r,e,t){let n=new Uw;if(n.classifyError(r)!=="unknown"){let s=n.enhanceError(r,e);if(t==="json"){let o=pt.error("VALIDATION_INVALID_FORMAT",s.message,2,{context:{errorType:s.type,suggestions:s.suggestions,line:s.line,column:s.column,queryContext:s.context?{startLine:s.context.startLine,endLine:s.context.endLine,errorLine:s.context.errorLine}:void 0},recovery:{message:s.suggestions?.[0]||"Check query syntax"}});console.log(JSON.stringify(o,null,2)),process.exit(2)}else console.error(n.formatForText(s)),process.exit(2)}ue.handle(r)}a(O8,"handleSparqlError");function r0e(r){if(r.includes("SELECT")||r.includes("CONSTRUCT")||r.includes("INSERT")||r.includes("DELETE"))return r;let e=(0,SO.resolve)(r);return(0,bg.existsSync)(e)?(0,bg.readFileSync)(e,"utf-8"):r}a(r0e,"loadQuery");async function n0e(r,e,t){if(e.explain){let i=new Mw,s=await i.analyze(r,{includeAlgebraPlan:!0,optimize:!e.noOptimize});if(t==="json"){let o=pt.success(s);console.log(JSON.stringify(o,null,2))}else s.valid?(console.log(`\u2705 Query syntax is valid
554
554
  `),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let n=new qr.ExoQLParser;try{let i=n.parse(r);if(i.type!=="update"){let o=new qr.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&o.type!=="construct")o=new qr.AlgebraOptimizer().optimize(o);else if(!e.noOptimize&&o.type==="construct"){let c=new qr.AlgebraOptimizer,l=o;o={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=pt.success({valid:!0,queryType:x8(i),message:"Query syntax is valid"});console.log(JSON.stringify(s,null,2))}else console.log("\u2705 Query syntax is valid"),console.log(` Query type: ${x8(i)}`)}catch(i){O8(i,r,t)}}a(n0e,"executeDryRun");function x8(r){return r.type==="update"?"UPDATE":"queryType"in r?r.queryType:"UNKNOWN"}a(x8,"getQueryType");function i0e(r,e){switch(e){case"json":let t=new LS;console.log(t.format(r));break;case"csv":let n=new NS;console.log(n.format(r));break;default:let i=new Cd;console.log(i.format(r));break}}a(i0e,"formatSelectResults");function s0e(r,e){let t=new xd;switch(e){case"json":console.log(t.formatJson(r));break;case"ntriples":console.log(t.formatNTriples(r));break;default:console.log(t.formatTable(r));break}}a(s0e,"formatConstructResults");function o0e(r,e){switch(e){case"json":console.log(JSON.stringify(r,null,2));break;case"csv":if(r.length===0){console.log("");return}let t=Object.keys(r[0]);console.log(t.join(","));for(let i of r){let s=t.map(o=>{let c=i[o];return c==null?"":String(c).includes(",")?`"${c}"`:String(c)});console.log(s.join(","))}break;default:if(r.length===0){console.log("No results.");return}let n=Object.keys(r[0]);console.log(n.join(" ")),console.log(n.map(()=>"---").join(" "));for(let i of r){let s=n.map(o=>String(i[o]??""));console.log(s.join(" "))}break}}a(o0e,"formatCachedSelectResults");function a0e(r,e){switch(e){case"json":console.log(JSON.stringify(r,null,2));break;case"ntriples":for(let t of r)console.log(`<${t.subject}> <${t.predicate}> ${c0e(t.object)} .`);break;default:console.log("Subject Predicate Object"),console.log("--- --- ---");for(let t of r)console.log(`${t.subject} ${t.predicate} ${t.object}`);break}}a(a0e,"formatCachedConstructResults");function c0e(r){return Bw.formatObject(r)}a(c0e,"formatNTriplesObject");function l0e(r,e){for(let t of r){let n=[`${t.type.toUpperCase()}`];switch(t.inserted!==void 0&&n.push(`inserted: ${t.inserted}`),t.deleted!==void 0&&n.push(`deleted: ${t.deleted}`),n.push(t.success?"OK":"FAILED"),e){case"json":console.log(JSON.stringify(t,null,2));break;case"csv":r.indexOf(t)===0&&console.log("type,inserted,deleted,success"),console.log(`${t.type},${t.inserted??""},${t.deleted??""},${t.success}`);break;default:console.log(`\u2705 ${n.join(" | ")}`);break}}}a(l0e,"formatUpdateResults");ct();var F8=require("fs"),D8=require("path");Iw();CP();St();kt();Er();function L8(){return new pe("index").description("Build or refresh the triple cache for faster SPARQL queries").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--stats","Show cache statistics after building").option("--force","Force rebuild even if cache is valid").option("--strict","Fail on first invalid IRI instead of skipping").option("--no-inference","Disable RDFS subClassOf inference materialization").action(async r=>{let e=r.output||"text";ue.setFormat(e);try{let t=(0,D8.resolve)(r.vault);if(!(0,F8.existsSync)(t))throw new Le(t);let n=new wu(t),i=n.getCachePath();r.force&&(e==="text"&&console.log("\u{1F5D1}\uFE0F Invalidating existing cache..."),await n.invalidate()),e==="text"&&console.log(`\u{1F4E6} Building triple cache for: ${t}...`);let s=Date.now(),o=await n.buildCacheWithValidation({strict:r.strict??!1}),c=0;if(r.inference!==!1){let{triples:u}=await n.loadOrBuild(),f=await ug(u);c=f.inferredCount,await n.saveInferredTriples(f.inferred),o.tripleCount+=c,e==="text"&&c>0&&console.log(`\u{1F9E0} Materialized ${c} inferred triples (RDFS + prototype chain)`)}let l=Date.now()-s;if(e==="json"){let u={action:"build",cachePath:i,tripleCount:o.tripleCount,durationMs:o.durationMs},f={summary:o.summary,skippedFiles:o.skippedFiles};if(r.stats){let d=await n.getCacheStats();if(d){let p={tripleCount:d.tripleCount,createdAt:d.createdAt.toISOString(),isValid:d.isValid,sizeBytes:d.sizeBytes,cachePath:i},h=pt.success({cache:u,stats:p,validation:f},{durationMs:l});console.log(JSON.stringify(h,null,2))}}else{let d=pt.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(d,null,2))}}else{if(o.skippedFiles.length>0){console.log(`
555
555
  \u26A0\uFE0F Files skipped due to IRI issues:`);for(let u of o.skippedFiles)console.log(` - ${u.path}`),console.log(` ${u.reason}`);console.log("")}if(console.log(`\u2705 Indexed ${o.summary.indexed} files, skipped ${o.summary.skipped} (total: ${o.summary.total})`),console.log(`\u{1F4CA} Created cache with ${o.tripleCount.toLocaleString()} triples at ${i}`),console.log(`\u23F1\uFE0F Build time: ${o.durationMs}ms`),r.stats){let u=await n.getCacheStats();u&&(console.log(`
556
556
  \u{1F4CA} Cache Statistics:`),console.log(` Triples: ${u.tripleCount.toLocaleString()}`),console.log(` Created: ${u.createdAt.toISOString()}`),console.log(` Valid: ${u.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${u0e(u.sizeBytes)}`))}}}catch(t){ue.handle(t)}})}a(L8,"sparqlIndexCommand");function u0e(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}a(u0e,"formatBytes");ct();var zw=require("fs"),Js=require("path");St();kt();Er();tr();function N8(){return new pe("resolve").description("Resolve UUID to file path").argument("<uuid>","Full or partial UUID to resolve").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: uri|path|json (default: uri)","uri").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--partial","Match partial UUIDs (returns all matches)").action(async(r,e)=>{let t=e.output||"text";ue.setFormat(t);try{let n=Date.now();if(!f0e(r))throw new Ye(`Invalid UUID format: ${r}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:r});let i=(0,Js.resolve)(e.vault);if(!(0,zw.existsSync)(i))throw new Le(i);let s=d0e(i,r,e.partial??!1),o=Date.now()-n;if(s.length===0){if(t==="json"){let c=pt.error("VALIDATION_FILE_NOT_FOUND",`UUID not found: ${r}`,3,{context:{uuid:r}});console.log(JSON.stringify(c,null,2))}else console.error(`UUID not found: ${r}`);process.exit(1)}e.partial||s.length>1?h0e(s,i,e.format,t,r,o):p0e(s[0],i,e.format,t,r,o)}catch(n){ue.handle(n)}})}a(N8,"resolveCommand");function f0e(r){if(r.length<4)return!1;let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,t=/^[0-9a-f-]+$/i;return e.test(r)||t.test(r)}a(f0e,"isValidUuidFormat");function d0e(r,e,t){let n=[],i=e.toLowerCase();function s(o){let c=(0,zw.readdirSync)(o,{withFileTypes:!0});for(let l of c){let u=(0,Js.join)(o,l.name);if(l.isDirectory())!l.name.startsWith(".")&&l.name!=="node_modules"&&s(u);else if(l.isFile()&&l.name.endsWith(".md")){let f=l.name.toLowerCase();t?f.includes(i)&&n.push(u):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&n.push(u)}}}return a(s,"walk"),s(r),n}a(d0e,"findFilesWithUuid");function k8(r){return`obsidian://vault/${encodeURI(r)}`}a(k8,"pathToObsidianUri");function M8(r){let e=r.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);return e?e[1]:(0,Js.basename)(r,".md")}a(M8,"extractUuidFromFilename");function p0e(r,e,t,n,i,s){let o=(0,Js.relative)(e,r),c=k8(o),l=M8((0,Js.basename)(r));if(n==="json"){let u={uuid:l,path:o,absolutePath:r,uri:c},f=pt.success(u,{durationMs:s,searchUuid:i});console.log(JSON.stringify(f,null,2))}else switch(t){case"path":console.log(r);break;case"json":console.log(JSON.stringify({uuid:l,path:o,absolutePath:r,uri:c},null,2));break;default:console.log(c);break}}a(p0e,"outputSingleResult");function h0e(r,e,t,n,i,s){let o=r.map(c=>{let l=(0,Js.relative)(e,c),u=k8(l);return{uuid:M8((0,Js.basename)(c)),path:l,absolutePath:c,uri:u}});if(n==="json"){let c=pt.success({matches:o,count:o.length},{durationMs:s,searchUuid:i,itemCount:o.length});console.log(JSON.stringify(c,null,2))}else switch(t){case"path":for(let c of o)console.log(c.absolutePath);break;case"json":console.log(JSON.stringify(o,null,2));break;default:for(let c of o)console.log(c.uri);break}}a(h0e,"outputMultipleResults");ct();var wO=require("fs"),Zs=require("path"),Wr=Q(Fe());St();kt();tr();Xs();var j8=Q(Fe());function Hw(r,e){return t=>{let n=typeof t.filePath=="string"&&t.filePath.length>0?t.filePath:null;if(n===null||n.split("/").includes("09 Templates"))return!1;let i=r.getAbstractFileByPath(n);if(i===null||!("basename"in i))return!1;let s=i,o=r.getFrontmatter(s)??{},c=e.getExpectedFolderSync(s,o),l=typeof t.currentFolder=="string"?t.currentFolder:s.parent?.path??"";return(0,j8.needsFolderRepair)(l,c)}}a(Hw,"createIsInWrongFolderHostFunction");var $8=Q(Fe());function Kw(r){return e=>{let t=typeof e.filePath=="string"&&e.filePath.length>0?e.filePath:null;if(t===null||t.split("/").includes("09 Templates"))return!1;let n=r.getAbstractFileByPath(t);if(n===null||!("basename"in n))return!1;let i=n,s=r.getFrontmatter(i)??{};return(0,$8.hasEmptyProperties)(s)}}a(Kw,"createHasEmptyPropertiesHostFunction");var Xw={debug(r,e){process.env.EXOCORTEX_DEBUG&&Yw("debug",r,e)},info(r,e){Yw("info",r,e)},warn(r,e){Yw("warn",r,e)},error(r,e,t){Yw("error",e?`${r} \u2014 ${e.message}`:r,t)}};function Yw(r,e,t){let n=t&&Object.keys(t).length>0?` ${m0e(t)}`:"";process.stderr.write(`[${r}] ${e}${n}
557
- `)}a(Yw,"write");function m0e(r){try{return JSON.stringify(r)}catch{return"[uninspectable context]"}}a(m0e,"safeJson");za();var g0e=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function Qw(r){let e=Array.isArray(r)?r[0]:r;if(typeof e!="string")return null;let t=e.replace(/["'[\]]/g,"").trim(),n=t.indexOf("|");return n!==-1&&(t=t.slice(0,n).trim()),t.length>0?t:null}a(Qw,"cleanRef");function EO(r){if(!r)return[];let e=r.exo__Instance_class,t=[],n=a(i=>{let s=Qw(i);s&&!t.includes(s)&&t.push(s)},"collect");if(typeof e=="string")n(e);else if(Array.isArray(e))for(let i of e)n(i);return t}a(EO,"extractClasses");function y0e(r){let e=r.match(/\/ontology\/([^#/]+)#(.+)$/);return e?`${e[1]}__${e[2]}`:null}a(y0e,"ontologyIriToSymbolic");async function vO(r,e){let t=await r.match(new Wr.IRI(e),Wr.Namespace.EXO.term("Instance_class"),void 0),n=[];for(let i of t){let s=typeof i.object.value=="string"?i.object.value:String(i.object),o=y0e(s);o&&!n.includes(o)&&n.push(o)}return n}a(vO,"deriveStoreSymbolicClasses");async function b0e(r){let e=new Wr.IRI("https://exocortex.my/ontology/exocmd#Command_cliName"),t=await r.match(void 0,e,void 0),n=new Map;for(let i of t){let s=typeof i.subject.value=="string"?i.subject.value:String(i.subject),o=typeof i.object.value=="string"?i.object.value:String(i.object),c=s.match(g0e);c&&o.length>0&&n.set(c[1],o)}return n}a(b0e,"buildCliNameMap");async function _0e(r,e,t=(0,Wr.liveClock)(),n={}){let i=(0,Zs.resolve)(r);if(!(0,wO.existsSync)(i))throw new Le(i);let s=(0,Zs.resolve)(i,e);if(!(0,wO.existsSync)(s))throw new Error(`Target file not found: ${e}`);let o=(0,Zs.relative)(i,s);if(o===".."||o.startsWith(`..${Zs.sep}`)||(0,Zs.isAbsolute)(o))throw new Error(`Target is outside the vault: ${e} (vault: ${i})`);let c=new Ht(i),l=n.useCache??!1,u=await yi(i,{useCache:l,vaultAdapter:c});l&&n.log?.(Eu(u));let f=new Wr.InMemoryTripleStore;await f.addAll(u.triples);let d=(0,Wr.vaultPathToIRI)(o),p=c.getAbstractFileByPath(o),h=p!==null&&"basename"in p?p:null,g=h?c.getFrontmatter(h):null,m=EO(g),b=await vO(f,d),_=[...new Set([...m,...b])],S=Qw(g?.exo__Asset_prototype),I=g?.exo__Asset_uid,E=typeof I=="string"?I:void 0,R=await new Wr.CommandResolver(f,Xw).resolveForAssetMulti(d,_,S??void 0),x=new Wr.FolderRepairService(c),O=new Wr.PreconditionEvaluator(f,void 0,{clock:t});(0,Wr.registerDefaultHostFunctions)(O),O.registerHostFunction("isInWrongFolder",Hw(c,x)),O.registerHostFunction("hasObsoleteProperties",Kw(c));let N=(0,Zs.dirname)(o),G={targetIRI:d,filePath:o,fileBasename:h?.basename,currentFolder:N==="."?"":N,assetUid:E},j=await b0e(f),ae=await Promise.all(R.map(async W=>{let oe;try{oe=await O.evaluate(W.command.precondition,d,G)}catch{oe=!1}return{rc:W,available:oe}})),Y=a(W=>({id:W.command.id,label:W.command.name,cliName:j.get(W.command.id)??null,category:W.command.category??null}),"toEntry"),M=ae.filter(W=>W.available).map(W=>Y(W.rc)),ce=ae.filter(W=>!W.available).map(W=>({...Y(W.rc),reason:"precondition-false"}));return{target:o,classes:_,prototype:S,visible:M,hidden:ce}}a(_0e,"resolveButtons");function S0e(r,e){let t=a(n=>`${n.label}${n.cliName?` (${n.cliName})`:""}`,"fmt");if(console.log(`Command buttons on "${r.target}" (${r.visible.length} visible):`),r.visible.length===0)console.log(" (none)");else for(let n of r.visible)console.log(` \u2713 ${t(n)}`);if(e)if(console.log(`
557
+ `)}a(Yw,"write");function m0e(r){try{return JSON.stringify(r)}catch{return"[uninspectable context]"}}a(m0e,"safeJson");za();var g0e=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function Qw(r){let e=Array.isArray(r)?r[0]:r;if(typeof e!="string")return null;let t=e.replace(/["'[\]]/g,"").trim(),n=t.indexOf("|");return n!==-1&&(t=t.slice(0,n).trim()),t.length>0?t:null}a(Qw,"cleanRef");function EO(r){if(!r)return[];let e=r.exo__Instance_class,t=[],n=a(i=>{let s=Qw(i);s&&!t.includes(s)&&t.push(s)},"collect");if(typeof e=="string")n(e);else if(Array.isArray(e))for(let i of e)n(i);return t}a(EO,"extractClasses");function y0e(r){let e=r.match(/\/ontology\/([^#/]+)#(.+)$/);return e?`${e[1]}__${e[2]}`:null}a(y0e,"ontologyIriToSymbolic");async function vO(r,e){let t=await r.match(new Wr.IRI(e),Wr.Namespace.EXO.term("Instance_class"),void 0),n=[];for(let i of t){let s=typeof i.object.value=="string"?i.object.value:String(i.object),o=y0e(s);o&&!n.includes(o)&&n.push(o)}return n}a(vO,"deriveStoreSymbolicClasses");async function b0e(r){let e=new Wr.IRI("https://exocortex.my/ontology/exocmd#Command_cliName"),t=await r.match(void 0,e,void 0),n=new Map;for(let i of t){let s=typeof i.subject.value=="string"?i.subject.value:String(i.subject),o=typeof i.object.value=="string"?i.object.value:String(i.object),c=s.match(g0e);c&&o.length>0&&n.set(c[1],o)}return n}a(b0e,"buildCliNameMap");async function _0e(r,e,t=(0,Wr.liveClock)(),n={}){let i=(0,Zs.resolve)(r);if(!(0,wO.existsSync)(i))throw new Le(i);let s=(0,Zs.resolve)(i,e);if(!(0,wO.existsSync)(s))throw new Error(`Target file not found: ${e}`);let o=(0,Zs.relative)(i,s);if(o===".."||o.startsWith(`..${Zs.sep}`)||(0,Zs.isAbsolute)(o))throw new Error(`Target is outside the vault: ${e} (vault: ${i})`);let c=new Ht(i),l=n.useCache??!1,u=await yi(i,{useCache:l,vaultAdapter:c});l&&n.log?.(Eu(u));let f=new Wr.InMemoryTripleStore;await f.addAll(u.triples);let d=(0,Wr.vaultPathToIRI)(o),p=c.getAbstractFileByPath(o),h=p!==null&&"basename"in p?p:null,g=h?c.getFrontmatter(h):null,m=EO(g),b=await vO(f,d),_=[...new Set([...m,...b])],S=Qw(g?.exo__Asset_prototype),I=g?.exo__Asset_uid,E=typeof I=="string"?I:void 0,R=await new Wr.CommandResolver(f,Xw).resolveForAssetMulti(d,_,S??void 0),x=new Wr.FolderRepairService(c),O=new Wr.PreconditionEvaluator(f,void 0,{clock:t});(0,Wr.registerDefaultHostFunctions)(O),O.registerHostFunction("isInWrongFolder",Hw(c,x)),O.registerHostFunction("hasObsoleteProperties",Kw(c));let N=(0,Zs.dirname)(o),G={targetIRI:d,filePath:o,fileBasename:h?.basename,currentFolder:N==="."?"":N,assetUid:E},j=await b0e(f),ae=await Promise.all(R.map(async q=>{let oe;try{oe=await O.evaluate(q.command.precondition,d,G)}catch{oe=!1}return{rc:q,available:oe}})),Y=a(q=>({id:q.command.id,label:q.command.name,cliName:j.get(q.command.id)??null,category:q.command.category??null}),"toEntry"),M=ae.filter(q=>q.available).map(q=>Y(q.rc)),ce=ae.filter(q=>!q.available).map(q=>({...Y(q.rc),reason:"precondition-false"}));return{target:o,classes:_,prototype:S,visible:M,hidden:ce}}a(_0e,"resolveButtons");function S0e(r,e){let t=a(n=>`${n.label}${n.cliName?` (${n.cliName})`:""}`,"fmt");if(console.log(`Command buttons on "${r.target}" (${r.visible.length} visible):`),r.visible.length===0)console.log(" (none)");else for(let n of r.visible)console.log(` \u2713 ${t(n)}`);if(e)if(console.log(`
558
558
  Hidden by precondition (${r.hidden.length}):`),r.hidden.length===0)console.log(" (none)");else for(let n of r.hidden)console.log(` \u2717 ${t(n)} \u2014 precondition not satisfied`)}a(S0e,"printHuman");function U8(){return new pe("resolve-inline-buttons").alias("resolve-buttons").description("Print the actual command button-set for an asset \u2014 binding-match \u2229 precondition-eval (Issue #3833). The authoritative button-visibility oracle; strictly more complete than `apply --dry-run` (precondition-only).").argument("<target>","Vault-relative path to the target asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--json","Emit structured JSON instead of human-readable text").option("--show-hidden","Also list commands that bind but are hidden by their precondition").option("--use-cache","Use the persistent triple cache (faster vault loading; read-only, nothing is written through)").action(async(r,e)=>{ue.setFormat(e.json?"json":"text");try{let t=await _0e(e.vault,r,void 0,{useCache:e.useCache??!1,log:a(n=>process.stderr.write(`${n}
559
559
  `),"log")});if(e.json){let n=e.showHidden?t:{...t,hidden:[]};console.log(JSON.stringify(n,null,2))}else S0e(t,e.showHidden??!1)}catch(t){ue.handle(t),process.exit(5)}})}a(U8,"resolveButtonsCommand");ct();var TO=require("fs"),eo=require("path"),Kc=Q(Fe());St();kt();tr();Xs();var Jw=class{constructor(e){this.vault=e}static{a(this,"FsVaultMetadataAdapter")}*listFrontmatter(){for(let e of this.vault.getAllFiles()){let t=this.vault.getFrontmatter(e);t&&(yield t)}}resolveLinkpathFrontmatter(e){let t={allowAliasFallback:!1},n=this.vault.getFirstLinkpathDest(e,"",t);return!n&&!e.endsWith(".md")&&(n=this.vault.getFirstLinkpathDest(`${e}.md`,"",t)),n?this.vault.getFrontmatter(n)??{}:null}};async function w0e(r,e){let t=(0,eo.resolve)(r);if(!(0,TO.existsSync)(t))throw new Le(t);let n=(0,eo.resolve)(t,e);if(!(0,TO.existsSync)(n))throw new Error(`Target file not found: ${e}`);let i=(0,eo.relative)(t,n);if(i===".."||i.startsWith(`..${eo.sep}`)||(0,eo.isAbsolute)(i))throw new Error(`Target is outside the vault: ${e} (vault: ${t})`);let s=new Ht(t),o=new Jw(s),c=new Kc.PrintNameRuleService(o,(0,Kc.createDisplayMatcherHostFunctions)(o));c.initialize();let l=new Kc.DisplayNameResolver(Kc.DEFAULT_DISPLAY_NAME_SETTINGS,c,c.createMetadataResolver()),u=s.getAbstractFileByPath(i),f=u!==null&&"basename"in u?u:null,d=(f?s.getFrontmatter(f):null)??{},p=(0,eo.basename)(i).replace(/\.md$/,""),h=l.resolveWithProvenance({metadata:d,basename:p}),g=d.exo__Asset_label,m=typeof g=="string"&&g.trim().length>0,b=m?g.trim():null,_=h.displayName??b??p,S=h.displayName===null||h.provenance==="default"?m?"label":"basename":h.provenance,I=d.exo__Asset_uid;return{target:i,uid:typeof I=="string"&&I.trim()?I.trim():null,basename:p,displayName:_,source:S}}a(w0e,"resolveDisplayName");function B8(){return new pe("resolve-display-name").description("Print the composed display name an asset renders as \u2014 the same engine the plugin runs, over the same vault exo__DisplayNameSpec assets (req f17f7c57). The authoritative naming oracle outside Obsidian; --json adds `source`, which distinguishes a spec-composed name from a raw exo__Asset_label.").argument("<target>","Vault-relative path to the target asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--json","Emit structured JSON instead of the bare name").action(async(r,e)=>{ue.setFormat(e.json?"json":"text");try{let t=await w0e(e.vault,r);e.json?console.log(JSON.stringify(t,null,2)):console.log(t.displayName)}catch(t){ue.handle(t),process.exit(5)}})}a(B8,"resolveDisplayNameCommand");ct();PO();ct();var Zw=require("fs"),Z8=require("path"),Yc=Q(Fe());var Ar=Q(ko()),ji=Q(require("path"));AP();var Ya=Q(Fe());var Kn=class{constructor(e){this.rootPath=e}static{a(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await Ar.default.pathExists(t))throw new Ya.FileNotFoundError(e);return Ar.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return Ar.default.pathExists(t)}async getFileMetadata(e){let t=await this.readFile(e);return this.extractFrontmatter(t)}async createFile(e,t){let n=this.resolvePath(e);if(await Ar.default.pathExists(n))throw new Ya.FileAlreadyExistsError(e);return await Ar.default.ensureDir(ji.default.dirname(n)),await Ar.default.writeFile(n,t,"utf-8"),e}async updateFile(e,t){let n=this.resolvePath(e);if(!await Ar.default.pathExists(n))throw new Ya.FileNotFoundError(e);await Ar.default.writeFile(n,t,"utf-8")}async writeFile(e,t){let n=this.resolvePath(e);await Ar.default.ensureDir(ji.default.dirname(n)),await Ar.default.writeFile(n,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await Ar.default.pathExists(t))throw new Ya.FileNotFoundError(e);await Ar.default.remove(t)}async renameFile(e,t){let n=this.resolvePath(e),i=this.resolvePath(t);if(!await Ar.default.pathExists(n))throw new Ya.FileNotFoundError(e);await Ar.default.ensureDir(ji.default.dirname(i)),await Ar.default.move(n,i)}async createDirectory(e){let t=this.resolvePath(e);await Ar.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await Ar.default.pathExists(t)?(await Ar.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,n=ji.default.join(t,"**/*.md");return(await Jd(n,{nodir:!0})).map(o=>ji.default.relative(this.rootPath,o)).sort()}async findFilesByMetadata(e){let t=await this.getMarkdownFiles(),n=[];for(let i of t)try{let s=await this.getFileMetadata(i);this.matchesQuery(s,e)&&n.push(i)}catch{continue}return n}async findFileByUID(e){let t=await this.findFilesByMetadata({exo__Asset_uid:e});return t.length>0?t[0]:null}async findFileByLinkpath(e){let t=e.trim();if(t.length===0)return null;let n=await this.findFileByBasename(`${t}.md`);if(n)return n;let i=await this.getMarkdownFiles();for(let s of i){let o;try{o=await this.getFileMetadata(s)}catch{continue}if(o.exo__Asset_label===t)return s;let c=o.aliases;if(Array.isArray(c)&&c.some(l=>l===t)||typeof c=="string"&&c===t)return s}return null}async findFileByBasename(e){let t=a(async n=>{let i;try{i=await Ar.default.readdir(n,{withFileTypes:!0})}catch{return null}for(let s of i){let o=ji.default.join(n,s.name);if(s.isDirectory()){if(s.name.startsWith(".")||s.name==="node_modules")continue;let c=await t(o);if(c)return c}else if(s.isFile()&&s.name===e)return ji.default.relative(this.rootPath,o)}return null},"walk");return t(this.rootPath)}async findFileByUidFilename(e){let t=e.toLowerCase(),n=a(async i=>{let s;try{s=await Ar.default.readdir(i,{withFileTypes:!0})}catch{return null}for(let o of s){let c=ji.default.join(i,o.name);if(o.isDirectory()){if(o.name.startsWith(".")||o.name==="node_modules")continue;let l=await n(c);if(l)return l}else if(o.isFile()&&o.name.endsWith(".md")){let l=o.name.toLowerCase();if(l.startsWith(t+".md")||l.startsWith(t+" ")||l.startsWith(t+"-"))return ji.default.relative(this.rootPath,c)}}return null},"walk");return n(this.rootPath)}resolvePath(e){if(ji.default.isAbsolute(e))return e;let t=this.rootPath.replace(/[/\\]+$/,""),n=ji.default.sep+e;return n===t||n.startsWith(t+ji.default.sep)?n:ji.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,n=e.match(t);return n?(0,Ya.parseYamlFrontmatterTolerant)(n[1])??{}:{}}matchesQuery(e,t){for(let[n,i]of Object.entries(t)){let s=e[n];if(Array.isArray(s)){if(!s.some(o=>this.normalizeValue(o)===this.normalizeValue(i)))return!1}else if(this.normalizeValue(s)!==this.normalizeValue(i))return!1}return!0}normalizeValue(e){return e==null?"":String(e).replace(/["'[\]]/g,"").trim()}};var Cn=class r extends Kn{constructor(t,n){super(t);this.indexed=!1;this.uidToPath=new Map;this.basenameToPaths=new Map;this.allPaths=[];this.pathSet=new Set;this.assets=[];this.cacheContent=n?.cacheContent??!1}static{a(this,"CachingNodeFsAdapter")}async buildIndex(){if(this.indexed)return;let t=await super.getMarkdownFiles();for(let n of t){this.allPaths.push(n),this.pathSet.add(n);let i={},s;try{this.cacheContent?(s=await super.readFile(n),i=this.extractFrontmatter(s)):i=await super.getFileMetadata(n)}catch{i={}}let o=i?.exo__Asset_uid,c=Array.isArray(o)?o:[o];for(let f of c){let d=r.normalizeUid(f);d.length>0&&!this.uidToPath.has(d)&&this.uidToPath.set(d,n)}let l=r.basenameOf(n),u=this.basenameToPaths.get(l);u?u.push(n):this.basenameToPaths.set(l,[n]),this.assets.push(this.cacheContent?{path:n,metadata:i,content:s}:{path:n,metadata:i})}this.indexed=!0}async findPathsByBasename(t){return await this.buildIndex(),this.basenameToPaths.get(t)??[]}async hasIndexedPath(t){await this.buildIndex();let n=t.replace(/\\/g,"/").replace(/^\.\//,"");return this.pathSet.has(n)}static basenameOf(t){let n=t.lastIndexOf("/"),i=n===-1?t:t.slice(n+1);return i.endsWith(".md")?i.slice(0,-3):i}async indexedAssets(){return await this.buildIndex(),this.assets}async getMarkdownFiles(t){return t?super.getMarkdownFiles(t):(await this.buildIndex(),this.allPaths)}async findFileByUID(t){return await this.buildIndex(),this.uidToPath.get(r.normalizeUid(t))??null}static normalizeUid(t){return t==null?"":String(t).replace(/["'[\]]/g,"").trim()}async fileExists(t){await this.buildIndex();let n=t.replace(/\\/g,"/").replace(/^\.\//,"");return this.pathSet.has(n)?!0:super.fileExists(t)}};St();kt();var OO=class{constructor(e){this.vaultPath=e}static{a(this,"CliFsCheckReader")}async read(){return{assets:(await new Cn(this.vaultPath).indexedAssets()).map(i=>({path:i.path,frontmatter:i.metadata}))}}};function e7(){return new pe("vault").description("Run the homoiconic vault-integrity check-runner (enabled-set from validation-check setting__Setting instances; --all runs every check)").requiredOption("--vault <path>","Vault root directory").option("--all","Run ALL known checks, ignoring the vault enabled-set").option("--output <type>","Response format: text|json","text").action(async r=>{let e=r.output??"text";ue.setFormat(e);try{let t=(0,Z8.resolve)(r.vault);if(!(0,Zw.existsSync)(t)||!(0,Zw.statSync)(t).isDirectory())throw new Le(t);let i=await new OO(t).read(),s=r.all?[...Yc.KNOWN_CHECK_IDS]:(0,Yc.readEnabledCheckIds)(i.assets),o=await new Yc.VaultCheckRunner((0,Yc.createDefaultCheckRegistry)()).runWithContext(i,s);if(e==="json")console.log(JSON.stringify({vaultPath:t,...o},null,2));else{s.length===0&&console.log(`OK ${t}: no validation checks enabled (scaffold validation-settings to enable some, or pass --all)`);for(let c of o.results){let l=`${c.status==="pass"?"OK":c.status==="fail"?"FAIL":"ERROR"} ${c.label}`;if(c.status==="pass")console.log(`${l} (${i.assets.length} assets)`);else if(c.status==="error")console.error(`${l}: ${c.errorMessage}`);else{console.error(`${l}: ${c.findings.length} violation(s)`);for(let u of c.findings.slice(0,50))console.error(` ${u.path?u.path+" \u2014 ":""}${u.message}`);c.findings.length>50&&console.error(` \u2026and ${c.findings.length-50} more`)}}console.error(o.ok?`
560
560
  \u2705 ${t}: all ${s.length} enabled check(s) passed`:`
@@ -571,7 +571,7 @@ Available classes: ${t.join(", ")}`),super(n),this.name="ClassNotFoundError"}},r
571
571
  Skipped (fail-open, NOT verified): ${i} \u2014 no-isDefinedBy=${n.skips["no-isDefinedBy"]}, ontology-unresolvable=${n.skips["ontology-unresolvable"]}, ontology-no-admits=${n.skips["ontology-no-admits"]}, no-instance-class=${n.skips["no-instance-class"]}, unresolvable-class=${n.skips["unresolvable-class"]}`)}n.violations.length>0&&(process.exitCode=1)}catch(t){ue.handle(t)}})}a(I7,"auditOntologyMembershipCommand");var Sbe=16;function R7(r){let e=[],t=a(n=>{if(Array.isArray(n)){n.forEach(t);return}let i=(0,VO.extractAssetReference)(n);typeof i=="string"&&i.length>0&&e.push(i)},"visit");return t(r),e}a(R7,"asRefList");async function wbe(r,e){let t=new Set,n=[e];for(let i=0;i<Sbe&&n.length;i++){let s=[];for(let o of n){let c=o.toLowerCase();if(t.has(c))continue;if(t.add(c),c===cE.toLowerCase())return!0;let l=await to(r,o,"");if(!l)continue;let u;try{u=await r.getFileMetadata(l)}catch{continue}let f=u.exo__Asset_uid;if(typeof f=="string"&&f.trim().toLowerCase()===cE.toLowerCase())return!0;s.push(...R7(u.exo__Class_superClass))}n=s}return!1}a(wbe,"subsumesOntology");async function Ebe(r,e,t,n){let i=(0,VO.extractAssetReference)(r);if(!i||i.startsWith("!"))return null;let s=await to(e,i,t);if(!s)return null;let o;try{o=await e.getFileMetadata(s)}catch{return null}let c=R7(o.exo__Instance_class);if(c.length===0)return s;for(let d of c)if(await wbe(e,d))return s;let l=c.join(", "),u=o.exo__Asset_label,f=typeof u=="string"&&u?` ("${u}")`:"";throw new Error(`exo__Asset_isDefinedBy must reference an exo__Ontology, but ${i}${f} is an instance of: ${l}. ${n} resolved it to ${s}. The property's declared range is exo__Ontology \u2014 pointing it at a prototype, a class or an ordinary asset writes an sh:class violation that only a later SHACL run would find (ticket d8c3c86b: one such asset held a vault's baseline red for 15 days). Pass the ontology anchor of the assetspace this asset belongs to.`)}a(Ebe,"checkOneValue");async function lE(r,e,t,n){let i=Array.isArray(r)?r:[r],s=[];for(let o of i)s.push(await Ebe(o,e,t,n));return{targetPaths:s}}a(lE,"assertIsDefinedByIsOntology");var fE="01 Inbox",Rbe="Asia/Almaty",Cbe="4ef3962d-b8a7-42b5-bd28-88ec846f1d13",P7="Backlog",wg="ems__Effort_status",xbe={aliases:"--aliases <a> <b>"};function Pbe(r){if(!r||r.length===0)return;let e=r.filter(s=>/,(?! )/.test(s));if(e.length===0)return;let t=e.map(s=>JSON.stringify(s)).join(", "),n=e[0].split(/,(?! )/).map(s=>s.trim()).filter(s=>s.length>0),i=n.length>0?` Pass each alias as its own argument: --aliases ${n.map(s=>/\s/.test(s)?JSON.stringify(s):s).join(" ")}.`:"";throw new Error(`--aliases looks like a comma-joined list: ${t}. The flag is variadic.${i} (A comma FOLLOWED BY A SPACE is treated as part of one alias and is accepted.)`)}a(Pbe,"assertAliasesAreNotAList");function Obe(r){if(!r||r.length===0)return{};let e={};for(let t of r){let n=t.indexOf("=");if(n===-1)throw new Error(`Invalid property format: "${t}". Expected "key=value" format.`);let i=t.substring(0,n).trim(),s=t.substring(n+1);if(!i)throw new Error(`Invalid property format: "${t}". Key cannot be empty.`);let o=xbe[(0,ms.canonicalYamlKey)(i)];if(o!==void 0)throw new Error(`Refusing to set "${i}" via --property \u2014 create manages this field itself. Use: ${o}`);let c=e[i];c===void 0?e[i]=s:Array.isArray(c)?c.push(s):e[i]=[c,s]}return e}a(Obe,"parseProperties");async function Fbe(r){if(r.bodyFile){if(!(0,qO.existsSync)(r.bodyFile))throw new Error(`Body file not found: ${r.bodyFile}`);return{text:(0,F7.readFileSync)(r.bodyFile,"utf-8"),source:"file"}}if(r.body==="-")return{text:await Dbe(3e4),source:"stdin"};if(r.body)return{text:r.body,source:"inline"}}a(Fbe,"resolveBody");function Dbe(r){return new Promise((e,t)=>{let n=[],i=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.destroy(),t(new Error(`Stdin read timed out after ${r}ms. Ensure you pipe content to stdin or close the pipe.`))},r);process.stdin.on("data",s=>{n.push(s)}),process.stdin.on("end",()=>{clearTimeout(i),e(Buffer.concat(n).toString("utf-8"))}),process.stdin.on("error",s=>{clearTimeout(i),t(s)}),process.stdin.isTTY&&(clearTimeout(i),e("")),process.stdin.resume()})}a(Dbe,"readStdin");var Eg=class{constructor(e,t={}){this.neighbourScans=new Map;this.vaultPath=e,this.options=t,this.warn=t.warn??(n=>{process.stderr.write(n)})}static{a(this,"CreateContext")}get fsAdapter(){return this.fsAdapterInstance??=this.options.fsAdapter??new Ru(this.vaultPath),this.fsAdapterInstance}get classResolver(){return this.classResolverInstance??=new rE(this.fsAdapter),this.classResolverInstance}get wikilinkValidator(){return this.wikilinkValidatorInstance??=new Xc(this.fsAdapter,{pendingUids:this.options.pendingUids}),this.wikilinkValidatorInstance}get sharedReader(){let e=this.fsAdapter;return e instanceof Ru?t=>e.readFileAbsolute(t):void 0}get propertyNameValidator(){return this.propertyNameValidatorInstance??=new Qc(this.vaultPath,{warn:a(e=>this.warn(`\u26A0 ${e}
572
572
  `),"warn"),readFile:this.sharedReader}),this.propertyNameValidatorInstance}get statusResolver(){return this.statusResolverInstance??=new iE(this.fsAdapter),this.statusResolverInstance}shapeRegistry(){return this.shapeRegistryLoad??=ms.ShapeLoader.loadFromVaultFS(this.vaultPath,{readFile:this.sharedReader}).catch(()=>new ms.ShapeRegistry),this.shapeRegistryLoad}scanClassNeighbours(e,t,n){let i=JSON.stringify([e,t,n??null]),s=this.neighbourScans.get(i);return s||(s=E7(this.fsAdapter,e,t,n),this.neighbourScans.set(i,s)),s}};async function WO(r,e,t){let n=e.vaultPath;if(!r.label||r.label.trim().length===0)throw new Error("Label cannot be empty");let i=r.label.trim();Pbe(r.aliases);let s=Obe(r.property),o=e.propertyNameValidator,c=Object.keys(s);await o.validate(c);let l=t??await Fbe(r),u=l?.text;u!==void 0&&l?.source==="inline"&&(u=u.replace(/\\n/g,`
573
573
  `)),u!==void 0&&sE(u,"create");let f=e.fsAdapter,d=e.classResolver,p=e.wikilinkValidator,h=await d.resolve(n,r.class),g=e.statusResolver,m=r.status===!1,b=typeof r.status=="string"?r.status:void 0,_=wg in s;if(m&&_)throw new Error(`Cannot pass both --no-status and --property ${wg}=... (ambiguous \u2014 cannot both suppress and set the status). Use one.`);if(b&&_)throw new Error(`Cannot pass both --status and --property ${wg}=... (ambiguous). Use one.`);if(!_&&!m){let j=await g.isStatusBearing(h);if(b){if(!j)throw new Error(`--status only applies to status-bearing classes (ems__Effort subclasses); '${r.class}' is not one.`);let ae=await g.resolveStatusUid(b);if(!ae)throw new Error(`Unknown status '${b}' \u2014 no matching ems__EffortStatus<Name> enum asset found in the vault.`);s[wg]=`[[${ae}]]`}else if(j){let ae=await g.resolveStatusUid(P7);ae?s[wg]=`[[${ae}]]`:e.warn(`\u26A0 status-bearing class but no ${P7} status enum found in the vault \u2014 created without ems__Effort_status.
574
- `)}}let S=Object.keys(s).length>0?s:void 0,I=Object.keys(s),E=await o.declaredRanges(I);S&&!r.skipWikilinkValidation&&await p.validatePropertyValues(S);let w=fE,R=S?.exo__Asset_isDefinedBy,x=Array.isArray(R)?R[0]:R,O=await lE(R,f,"","create");if(x){let j=$O(O.targetPaths[0]??null);j&&(w=j)}if(w===fE){let j=await e.scanClassNeighbours(h,r.class,x),ae=v7(j.sameAnchor);if(ae)w=ae;else{let Y=Array.from(j.anyAnchor.entries()).filter(([M])=>M!==""&&M!==fE).sort((M,ce)=>ce[1]-M[1]||(M[0]<ce[0]?-1:1));if(Y.length>0){let M=Y.slice(0,3).map(([oe,X])=>`${oe} (${X})`).join(", "),ce=Y.length>3?`, +${Y.length-3} more`:"",W=x==null?"exo__Asset_isDefinedBy is absent":String(x).length===0?"exo__Asset_isDefinedBy is empty":`exo__Asset_isDefinedBy=${String(x)} resolved no folder and no sibling shares that anchor`;e.warn(`\u26A0 co-location fail-open: this asset would land in \`${fE}/\` \u2014 ${W}.
574
+ `)}}let S=Object.keys(s).length>0?s:void 0,I=Object.keys(s),E=await o.declaredRanges(I);S&&!r.skipWikilinkValidation&&await p.validatePropertyValues(S);let w=fE,R=S?.exo__Asset_isDefinedBy,x=Array.isArray(R)?R[0]:R,O=await lE(R,f,"","create");if(x){let j=$O(O.targetPaths[0]??null);j&&(w=j)}if(w===fE){let j=await e.scanClassNeighbours(h,r.class,x),ae=v7(j.sameAnchor);if(ae)w=ae;else{let Y=Array.from(j.anyAnchor.entries()).filter(([M])=>M!==""&&M!==fE).sort((M,ce)=>ce[1]-M[1]||(M[0]<ce[0]?-1:1));if(Y.length>0){let M=Y.slice(0,3).map(([oe,X])=>`${oe} (${X})`).join(", "),ce=Y.length>3?`, +${Y.length-3} more`:"",q=x==null?"exo__Asset_isDefinedBy is absent":String(x).length===0?"exo__Asset_isDefinedBy is empty":`exo__Asset_isDefinedBy=${String(x)} resolved no folder and no sibling shares that anchor`;e.warn(`\u26A0 co-location fail-open: this asset would land in \`${fE}/\` \u2014 ${q}.
575
575
  Existing homes of class ${r.class}: ${M}${ce}.
576
576
  Set exo__Asset_isDefinedBy to the anchor used by the intended home (a \`!\`-prefixed anchor needs --skip-wikilink-validation).
577
577
  `)}}}let N=await e.shapeRegistry();return{config:{className:r.class,classRefForm:"uuid",classUid:h,label:i,aliases:r.aliases,folderPath:w,createdBy:r.createdBy||Cbe,timezone:r.timezone||Rbe,body:u,propertyValues:S,shapeRegistry:N,declaredRanges:E},label:i}}a(WO,"planCreate");function D7(){return new pe("create").description("Create a new vault asset with auto-generated UUID, timestamp, and frontmatter").requiredOption("--class <name>","Class short name (e.g. ztlk__PermanentNote) or UUID").requiredOption("--label <text>","Human-readable label for the asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--aliases <names...>","Additional aliases for the asset").option("--property <key=value...>","Property key-value pairs (repeatable; the SAME key passed more than once accumulates into a YAML array)",Lbe,[]).option("--body <text>","Markdown body content (use '-' to read from stdin)").option("--body-file <path>","Read body content from file").option("--dry-run","Preview frontmatter without writing file").option("--created-by <uuid>","Creator UUID (defaults to ExoAssistant)").option("--status <name>","ems__Effort_status for status-bearing classes (default: Backlog; e.g. Draft, Doing, Done). Errors for non-status-bearing classes.").option("--no-status","For a status-bearing class, do NOT inject the default ems__Effort_status \u2014 create a status-less prototype/template (issue #3928). No-op for a non-status-bearing class. Mutually exclusive with --status / --property ems__Effort_status.").option("--yes","Accepted for symmetry with the apply subcommands (create is non-interactive; no-op)").option("--timezone <tz>","Timezone for timestamps (defaults to Asia/Almaty)").option("--skip-wikilink-validation","Skip wikilink existence validation").option("--validate","Run SHACL-lite conformance validation on the new asset BEFORE writing it; a non-conformant asset is refused and no file is created (same shapes as `validate schema --shapes-mode`). Opt-in: omit the flag and create behaves exactly as before.").option("--use-cache","Use the persistent triple cache for the vault load of --validate (shape loading is unaffected); the created asset is picked up by the NEXT --use-cache process as a delta unless --write-through is also given").option("--write-through","With --use-cache: fold the created asset into an existing persistent cache in this process, so the next --use-cache process is a plain hit. Refused without --use-cache").action(async r=>{if(r.writeThrough&&!r.useCache){process.stderr.write(`\u274C --write-through requires --use-cache (there is no cache to write through to without it); nothing was created
@@ -622,12 +622,12 @@ ${g}
622
622
  `);return}e.dryRun||(0,pp.writeFileSync)(n,c,"utf-8"),process.stdout.write(JSON.stringify({path:i,changed:!0,dryRun:!!e.dryRun,removed:o.removed,...e.canonicalizeKeys?{canonicalized:l}:{},...u?{updatedAt:u}:{},...e.dryRun?{diff:n_e(s,c)}:{}})+`
623
623
  `)}catch(t){ue.handle(t)}})}a(z7,"repairFrontmatterCommand");ct();var H7=require("fs"),K7=require("path"),gs=Q(Fe());Xs();St();kt();tr();Ww();fg();var i_e="https://exocortex.my/ontology/find#Alias_sparql",s_e="https://exocortex.my/ontology/exo#Asset_label";function hp(r){if(r&&typeof r=="object"&&"value"in r){let e=r.value;return typeof e=="string"?e:String(e)}return String(r)}a(hp,"nodeValue");async function o_e(r,e){let t=await r.match(void 0,void 0,void 0),n=[];for(let s of t)hp(s.predicate)!==s_e||hp(s.object)!==e||n.push(hp(s.subject));if(n.length===0)return null;let i=[];for(let s of n)for(let o of t)hp(o.predicate)===i_e&&hp(o.subject)===s&&i.push(hp(o.object));if(i.length===0)return null;if(i.length>1)throw new Ye(`Ambiguous find__Alias "${e}" \u2014 ${i.length} instances define a sparql fragment`,`Ensure exactly one find__Alias asset has exo:Asset_label "${e}"`);return i[0]}a(o_e,"resolveAliasFragment");var a_e=new RegExp(`^(${Su})__([A-Za-z0-9_]+)$`),c_e="https://exocortex.my/ontology/";function l_e(r,e){let t=a_e.exec(e);if(t){let i=`<${c_e}${t[1]}#${t[2]}>`;return r.replace(/\?value\b/g,i)}let n=e.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return r.replace(/\?value\b/g,`"${n}"`)}a(l_e,"bindValueLiteral");function Y7(){return new pe("find").description("Find vault assets via SPARQL \u2014 outputs file paths one per line (RFC 8e83442b T1.1)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--sparql <query>","SPARQL SELECT query (must bind ?path)").option("--class <value>","Filter by class label via find__Alias 'class' (e.g. ems__Task)").action(async r=>{ue.setFormat("text");try{if(r.sparql&&r.class)throw new Ye("--sparql and --class are mutually exclusive","Pass either a raw --sparql query or a find__Alias-backed flag like --class");if(!r.sparql&&!r.class)throw new Ye("one of --sparql <query> or --class <value> is required",'exocortex find --class ems__Task OR exocortex find --sparql "SELECT ?path WHERE { ... }"');let e=(0,K7.resolve)(r.vault);if(!(0,H7.existsSync)(e))throw new Le(e);let t=new Ht(e),i=await new gs.NoteToRDFConverter(t).convertVault(),s=new gs.InMemoryTripleStore;await s.addAll(i);let o;if(r.class){let b=await o_e(s,"class");if(b===null)throw new Ye('No find__Alias with exo:Asset_label "class" was found in the vault',"Seed a find__Alias asset (label=class) or fall back to exocortex find --sparql");o=`SELECT ?path WHERE { ${l_e(b,r.class)} }`}else o=r.sparql;let c=Gw(o);c=ip(c);let l=new gs.ExoQLParser,u=qw(Vw(e));u.size>0&&l.setVaultPrefixes(u);let f=l.parse(c),p=new gs.ExoQLAlgebraTranslator().translate(f);p.type!=="construct"&&(p=new gs.AlgebraOptimizer().optimize(p));let g=await new gs.ExoQLQueryExecutor(s).executeAll(p),m="obsidian://vault/";for(let b of g){let S=b.toJSON().path;if(typeof S!="string"||!S.startsWith(m))continue;let I=S.slice(m.length),E;try{E=decodeURIComponent(I)}catch{E=I}process.stdout.write(E+`
624
624
  `)}}catch(e){ue.handle(e),process.exit(5)}})}a(Y7,"findCommand");ct();var iV=Q(Fe()),eF=require("fs"),rc=require("path"),Ie=Q(Fe());St();kt();tr();Xs();var xn=Q(Fe());var gE=new Map([["exo__Asset_uid",xn.Namespace.EXO.term("Asset_uid").value],["exo__Asset_label",xn.Namespace.EXO.term("Asset_label").value],["aliases",xn.Namespace.EXO.term("Asset_aliases").value]]),yE=class r extends Kn{constructor(t,n){super(t);this.source=n;this.indexPromise=null;this.pathKeys=new Map;this.stats={indexedLookups:0,scanFallbacks:0,candidateReads:0,zeroTripleReads:0}}static{a(this,"TripleStoreIndexedFsAdapter")}async findFilesByMetadata(t){let n=Object.entries(t);if(!(n.length>0&&n.every(([u,f])=>gE.has(u)&&this.normalizeValue(f).length>0)))return this.stats.scanFallbacks++,super.findFilesByMetadata(t);let s=await this.ensureIndex();this.stats.indexedLookups++;let o=null;for(let[u,f]of n){let d=s.get(u)?.get(this.normalizeValue(f))??[];if(o=o===null?[...d]:o.filter(p=>d.includes(p)),o.length===0)return[]}let c=[...o??[]].filter(u=>!r.hasDotSegment(u)).sort(),l=[];for(let u of c){this.stats.candidateReads++;try{let f=await this.getFileMetadata(u);this.matchesQuery(f,t)&&l.push(u)}catch{continue}}return l}async createFile(t,n){let i=await super.createFile(t,n);return await this.reindexOwnWrite(t,n),i}async updateFile(t,n){await super.updateFile(t,n),await this.reindexOwnWrite(t,n)}async writeFile(t,n){await super.writeFile(t,n),await this.reindexOwnWrite(t,n)}async deleteFile(t){await super.deleteFile(t),this.forget(await this.ensureIndex(),r.rel(t))}async renameFile(t,n){await super.renameFile(t,n);let i=await this.ensureIndex(),s=r.rel(t),o=[...this.pathKeys.get(s)??[]];this.forget(i,s);let c=r.rel(n);for(let[l,u]of o)this.addKey(i,l,u,c)}async reindexOwnWrite(t,n){let i=await this.ensureIndex(),s=r.rel(t);this.forget(i,s);let o;try{o=this.extractFrontmatter(n)}catch{return}this.indexFrontmatter(i,s,o)}static rel(t){return t.replace(/\\/g,"/").replace(/^\.\//,"")}static hasDotSegment(t){return t.split("/").some(n=>n.startsWith("."))}async ensureIndex(){return this.indexPromise===null&&(this.indexPromise=this.buildIndex()),this.indexPromise}async buildIndex(){let t=new Map;for(let u of gE.keys())t.set(u,new Map);let n=new Map;for(let[u,f]of gE)n.set(f,u);let i=new Map,s=new Map,o=new Map,c=[];for(let u of this.source.explicitTriples){let f=n.get(u.predicate.value);if(f===void 0)continue;let d=r.subjectToPath(u);if(d===null)continue;c.push([f,d,u.object]);let p=u.object;if(f==="exo__Asset_uid"){p instanceof xn.Literal&&!i.has(d)&&i.set(d,p.value);continue}if(p instanceof xn.Literal)r.push(s,d,p.value);else if(p instanceof xn.IRI){let h=xn.Namespace.fromTermIRI(p.value);h&&(r.push(s,d,`${h.namespace.prefix}__${h.localName}`),f==="exo__Asset_label"&&r.push(o,p.value,d))}}let l=new Map;for(let[u,f]of o)l.set(u,f.map(d=>i.get(d)).filter(d=>d!==void 0));for(let[u,f,d]of c){let p=r.keysForObject(d,l,s);for(let h of p)this.addKey(t,u,this.normalizeValue(h),f)}for(let u of this.source.zeroTriplePaths){this.stats.zeroTripleReads++;try{this.indexFrontmatter(t,u,await this.getFileMetadata(u))}catch{continue}}return t}indexFrontmatter(t,n,i){for(let s of gE.keys()){let o=i[s],c=Array.isArray(o)?o:[o];for(let l of c)this.addKey(t,s,this.normalizeValue(l),n)}}addKey(t,n,i,s){if(i.length===0)return;let o=t.get(n);if(o===void 0)return;let c=o.get(i);c===void 0?o.set(i,[s]):c.includes(s)||c.push(s),r.push(this.pathKeys,s,[n,i])}forget(t,n){let i=this.pathKeys.get(n);if(i){for(let[s,o]of i){let c=t.get(s)?.get(o);if(!c)continue;let l=c.indexOf(n);l>=0&&c.splice(l,1)}this.pathKeys.delete(n)}}static push(t,n,i){let s=t.get(n);s===void 0?t.set(n,[i]):s.push(i)}static subjectToPath(t){let n=t.subject;if(!(n instanceof xn.IRI))return null;let i=(0,xn.iriToVaultPath)(n.value);return i===null||i.startsWith("/")||i.startsWith("..")||i.includes("/../")?null:i}static keysForObject(t,n,i){if(t instanceof xn.Literal)return[t.value];if(!(t instanceof xn.IRI))return[];let s=xn.Namespace.fromTermIRI(t.value);if(s)return[`${s.namespace.prefix}__${s.localName}`,...n.get(t.value)??[]];let o=(0,xn.iriToVaultPath)(t.value);if(o!==null){let c=o.lastIndexOf("/"),l=c===-1?o:o.slice(c+1);return[l.endsWith(".md")?l.slice(0,-3):l,...i.get(o)??[]]}return[t.value]}};var rV=Q(Fe()),Kt=Q(Z7());var eV="obsidian://vault/";function O_e(r){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return{async resolveTargetPath(t){if(!t)throw new Error("Cannot resolve empty targetIRI to a vault path");let n=t;if(n.startsWith(eV))n=decodeURI(n.slice(eV.length));else if(e.test(n)){let i=await r.findFileByUID(n);if(!i)throw new Error(`No vault file found for UID: ${n}`);n=i}if(n.endsWith(".md")||(n=`${n}.md`),!await r.fileExists(n))throw new Error(`Cannot resolve target file for IRI "${t}" (tried "${n}")`);return n}}}a(O_e,"createCliPathResolver");var F_e=["openFile","sparqlSelect","getActiveFileIRI","getActiveFilePath","trashFile","duplicateFile"],ZO=class extends Error{constructor(t){super(`Service "${t}" is not implemented in the CLI (no-op stub). dyncommand exec on this service_call grounding cannot change vault state. See CLI parity issues #2865-#2868 for port status.`);this.serviceId=t;this.name="CliServiceNotImplementedError"}static{a(this,"CliServiceNotImplementedError")}};function tV(r){return{async execute(){throw new ZO(r)}}}a(tV,"notImplementedService");function D_e(r){return e=>{let t=r.getFirstLinkpathDest(e,"");if(!t||!("basename"in t))return null;let i=r.getFrontmatter(t)?.exo__Asset_label;return typeof i=="string"&&i.length>0?i:null}}a(D_e,"createCliClassResolver");function nV(r,e){for(let t of F_e)r.register(t,tV(t));for(let t of["updateProperty","removeProperty","setStatus","createAsset"])r.register(t,tV(t));if(e){if(e.fsAdapter){let t=new rV.FrontmatterService,n=O_e(e.fsAdapter);r.register("updateProperty",(0,Kt.createUpdatePropertyService)(e.fsAdapter,t,n)),r.register("removeProperty",(0,Kt.createRemovePropertyService)(e.fsAdapter,t,n)),r.register("setStatus",(0,Kt.createSetStatusService)(e.fsAdapter,t,n)),r.register("createAsset",(0,Kt.createCreateAssetService)(e.vaultAdapter,e.fsAdapter,D_e(e.vaultAdapter))),r.register("instantiatePrototypeSubtree",(0,Kt.createInstantiatePrototypeSubtreeService)(e.vaultAdapter,e.fsAdapter))}r.register("createRelatedTask",(0,Kt.createCreateRelatedTaskService)(e.vaultAdapter,e.genericAssetCreationService)),r.register("createRelatedProject",(0,Kt.createCreateRelatedProjectService)(e.vaultAdapter,e.genericAssetCreationService)),r.register("archiveAsset",(0,Kt.createArchiveAssetService)(e.vaultAdapter,e.archiveAssetService)),r.register("planForEvening",(0,Kt.createPlanForEveningService)(e.vaultAdapter,e.taskStatusService)),r.register("cleanProperties",(0,Kt.createCleanPropertiesService)(e.vaultAdapter,e.propertyCleanupService)),r.register("renameToUid",(0,Kt.createRenameToUidService)(e.vaultAdapter,e.renameToUidService)),r.register("repairFolder",(0,Kt.createRepairFolderService)(e.vaultAdapter,e.folderRepairService)),r.register("fixMissingLabel",(0,Kt.createFixMissingLabelService)(e.vaultAdapter,e.fixMissingLabelService))}}a(nV,"populateCliServiceRegistry");za();function L_e(r,e){let t=r.getAbstractFileByPath(e),n=t!==null&&"basename"in t?t:null,i=n?r.getFrontmatter(n):null,s=i&&typeof i=="object"?i.exo__Asset_label:void 0;return{uuid:n?.basename??e.replace(/^.*\//,"").replace(/\.md$/,""),path:e,label:typeof s=="string"?s:""}}a(L_e,"buildCreatedAsset");var N_e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function k_e(){if(process.stdin.isTTY)return[];let r=[];for await(let t of process.stdin)r.push(t);return Buffer.concat(r).toString("utf-8").split(`
625
- `).map(t=>t.trim()).filter(t=>t.length>0)}a(k_e,"readStdinLines");function SE(r){if(r&&typeof r=="object"&&"value"in r){let e=r.value;return typeof e=="string"?e:String(e)}return String(r)}a(SE,"nodeValue");async function M_e(r,e){let t=new Ie.IRI("https://exocortex.my/ontology/exocmd#Command_cliName"),n=await r.match(void 0,t,void 0),i=[];for(let s of n)if(SE(s.object)===e){let l=SE(s.subject).match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i);l&&i.push(l[1])}if(i.length===0)return null;if(i.length>1)throw new Ye(`Ambiguous cliName "${e}" \u2014 resolves to ${i.length} commands: ${i.join(", ")}`,"Use the UUID directly: exocortex apply <uuid> <path>");return i[0]}a(M_e,"resolveSlugToUuid");async function j_e(r,e){let t=new Ie.IRI("https://exocortex.my/ontology/exocmd#Command_destructive"),n=await r.match(void 0,t,void 0);for(let i of n)if(SE(i.subject).includes(e)){let o=SE(i.object);if(o==="true"||o==="True")return!0}return!1}a(j_e,"isDestructive");async function $_e(r,e,t,n,i,s,o,c,l){let u={ok:!1,created:[],executed:!1},f=(0,rc.resolve)(r,s);if(!(0,eF.existsSync)(f))return console.error(`\u274C Target file not found: ${s}`),u;let d=(0,rc.relative)(r,f);if(d===".."||d.startsWith(`..${rc.sep}`)||(0,rc.isAbsolute)(d))return console.error(`\u274C Target is outside the vault: ${s} (vault: ${r})`),u;let p=new Ie.CommandResolver(e,Xw),h=await p.loadCommand(i);if(!h)return console.error(`\u274C Command with UID "${i}" not found.`),u;if(await j_e(e,i)&&!o.dryRun&&!o.yes)return console.error(`\u274C Command "${h.name}" is marked destructive. Add --dry-run to preview, or --yes to apply.`),u;let m=(0,Ie.vaultPathToIRI)(d),b=new Ht(r),_=new Ie.FolderRepairService(b),S=new Ie.PreconditionEvaluator(e,void 0,{clock:c});(0,Ie.registerDefaultHostFunctions)(S),S.registerHostFunction("isInWrongFolder",Hw(b,_)),S.registerHostFunction("hasObsoleteProperties",Kw(b));let I=b.getAbstractFileByPath(d),E=I!==null&&"basename"in I?I:null,w=E?b.getFrontmatter(E):null,R=w&&typeof w=="object"?w.exo__Asset_uid:void 0;if((await e.match(void 0,iV.Namespace.EXOCMD.term("CommandBinding_command"),void 0)).some(z=>String(z.object).includes(i))){let z=EO(w),ee=await vO(e,m),K=[...new Set([...z,...ee])];if(K.length>0){let ie=Qw(w?.exo__Asset_prototype);if(!(await p.resolveForAssetMulti(m,K,ie??void 0)).some($=>$.command.id===i))return console.error(`\u274C "${h.name}" is not bound to the target's class on "${d}".`),console.error(` Declared classes: ${K.join(", ")}.`),u}}let N={targetIRI:m,filePath:d,fileBasename:E?.basename,assetUid:typeof R=="string"?R:void 0};if(!await S.evaluate(h.precondition,m,N))return console.error(`\u274C Precondition not satisfied for "${h.name}" on "${d}".`),u;let j;if(o.input)try{let z=JSON.parse(o.input);if(typeof z!="object"||z===null||Array.isArray(z))throw new Error("must be a JSON object");j=z}catch(z){let ee=z instanceof Error?z.message:String(z);return console.error(`\u274C --input: invalid JSON object (${ee})`),u}let ae=(0,Ie.findInputSchemaViolation)(h.grounding,j);if(ae!==null)return console.error(`\u274C "${h.name}" cannot run on "${d}": ${ae}`),u;if(o.dryRun){let z=(0,Ie.findMissingInput)(h.grounding,j);return z!==null?(console.error(`\u274C "${h.name}" cannot run on "${d}": ${(0,Ie.missingInputError)(z)}`),u):(o.json||console.log(`\u{1F50D} Dry-run: would apply "${h.name}" to "${d}" (precondition passed).`),{ok:!0,created:[],executed:!1})}let Y=new Ie.ServiceRegistry,M=new Ie.GenericAssetCreationService(b).withDeterminism({clock:c,uidGenerator:l}),ce=new Ie.ArchiveAssetService(b),W=new Ie.PropertyCleanupService(b),oe=new Ie.FixMissingLabelService(b),X=new Ie.RenameToUidService(b),J=new Ie.TaskStatusService(b,new Ie.EffortStatusWorkflow,new Ie.StatusTimestampService(b));nV(Y,{vaultAdapter:b,fsAdapter:n,genericAssetCreationService:M,archiveAssetService:ce,taskStatusService:J,propertyCleanupService:W,fixMissingLabelService:oe,renameToUidService:X,folderRepairService:_});let ye=new Ie.NamedQueryRunner(new op(e,n),e),Z=await new Ie.GroundingExecutor(n,n,Y,(0,Ie.createVaultFrontmatterClassLabelResolver)(n),{clock:c,uidGenerator:l,workflowResolver:t,groundingLoader:a(z=>p.loadGroundingByUid(z),"groundingLoader"),templateLoader:a(async z=>{let ee=await n.findFileByUID(z);return ee?(0,Ie.stripTemplateFrontmatter)(await n.readFile(ee)):null},"templateLoader"),namedQueryRunner:ye,refToFolder:(0,Ie.createVaultFrontmatterRefToFolderResolver)(n),refToFrontmatter:(0,Ie.createVaultFrontmatterRefToFrontmatterResolver)(n),declaredRanges:(0,Ie.createTripleStoreDeclaredRanges)(e)}).execute(h.grounding,m,d,j);if(Z.success){let z=[];Z.openPath&&z.push(Z.openPath),Z.createdPaths&&z.push(...Z.createdPaths);let ee=[],K=new Set;for(let ie of z)K.has(ie)||(K.add(ie),ee.push(L_e(b,ie)));if(!o.json){let ie=h.successMessage??`Applied "${h.name}" to "${d}".`,Pe=Z.openPath??Z.createdPaths?.[0],$=Pe?` \u2192 ${Pe}`:"";console.log(`\u2705 ${ie}${$}`)}return{ok:!0,created:ee,executed:!0}}else return console.error(`\u274C "${h.name}" failed on "${d}": ${Z.error}`),{ok:!1,created:[],executed:!0}}a($_e,"executeOnTarget");function sV(){return new pe("apply").description("Apply an exocmd__Command to one or more vault assets (RFC 8e83442b T1.2). Pass a path arg or pipe paths via stdin.").argument("<cmd>","Command UUID or cliName slug").argument("[path]","Vault-relative path to target asset (omit to read paths from stdin)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--dry-run","Preview without writing").option("--yes","Skip destructive-command confirmation").option("--input <json>",`JSON userInput for a grounding. Value-setting commands need a value key, e.g. set-planned-start / set-scheduled-date: --input '{"value":"<ISO>"}'. A command whose grounding declares its own input key uses THAT key: set-label: --input '{"label":"New label"}'. Asset-reference inputs (set-parent: --input '{"parent":"<uid>"}'; set-blocker: --input '{"blocker":"<uid>"}') take a BARE uid; a copied [[uid]] or [[uid|alias]] is accepted and unwrapped, anything else that still looks like a link is refused. The required key is named in the error if omitted.`).option("--seed <uuid>","Deterministic UID seed for test/replay (uses seededUidGenerator)").option("--frozen-clock <iso>","Freeze clock to ISO timestamp for test/replay (uses frozenClock)").option("--json","Emit a machine-readable JSON result ({command,target,created:[{uuid,path,label}]}) instead of human-readable output").option("--use-cache","Use the persistent triple cache (hit / delta / rebuild) instead of a full vault parse; a mutation is picked up by the NEXT --use-cache process as a delta unless --write-through is also given").option("--write-through","With --use-cache: after a grounding executed, fold the mutation into the persistent cache in this process, so the next --use-cache process is a plain hit (the delta is paid by this writer instead of the next reader). Refused without --use-cache").action(async(r,e,t)=>{if(ue.setFormat("text"),t.writeThrough&&!t.useCache){process.stderr.write(`\u274C --write-through requires --use-cache (there is no cache to write through to without it); nothing was applied
625
+ `).map(t=>t.trim()).filter(t=>t.length>0)}a(k_e,"readStdinLines");function SE(r){if(r&&typeof r=="object"&&"value"in r){let e=r.value;return typeof e=="string"?e:String(e)}return String(r)}a(SE,"nodeValue");async function M_e(r,e){let t=new Ie.IRI("https://exocortex.my/ontology/exocmd#Command_cliName"),n=await r.match(void 0,t,void 0),i=[];for(let s of n)if(SE(s.object)===e){let l=SE(s.subject).match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i);l&&i.push(l[1])}if(i.length===0)return null;if(i.length>1)throw new Ye(`Ambiguous cliName "${e}" \u2014 resolves to ${i.length} commands: ${i.join(", ")}`,"Use the UUID directly: exocortex apply <uuid> <path>");return i[0]}a(M_e,"resolveSlugToUuid");async function j_e(r,e){let t=new Ie.IRI("https://exocortex.my/ontology/exocmd#Command_destructive"),n=await r.match(void 0,t,void 0);for(let i of n)if(SE(i.subject).includes(e)){let o=SE(i.object);if(o==="true"||o==="True")return!0}return!1}a(j_e,"isDestructive");async function $_e(r,e,t,n,i,s,o,c,l){let u={ok:!1,created:[],executed:!1},f=(0,rc.resolve)(r,s);if(!(0,eF.existsSync)(f))return console.error(`\u274C Target file not found: ${s}`),u;let d=(0,rc.relative)(r,f);if(d===".."||d.startsWith(`..${rc.sep}`)||(0,rc.isAbsolute)(d))return console.error(`\u274C Target is outside the vault: ${s} (vault: ${r})`),u;let p=new Ie.CommandResolver(e,Xw),h=await p.loadCommand(i);if(!h)return console.error(`\u274C Command with UID "${i}" not found.`),u;if(await j_e(e,i)&&!o.dryRun&&!o.yes)return console.error(`\u274C Command "${h.name}" is marked destructive. Add --dry-run to preview, or --yes to apply.`),u;let m=(0,Ie.vaultPathToIRI)(d),b=new Ht(r),_=new Ie.FolderRepairService(b),S=new Ie.PreconditionEvaluator(e,void 0,{clock:c});(0,Ie.registerDefaultHostFunctions)(S),S.registerHostFunction("isInWrongFolder",Hw(b,_)),S.registerHostFunction("hasObsoleteProperties",Kw(b));let I=b.getAbstractFileByPath(d),E=I!==null&&"basename"in I?I:null,w=E?b.getFrontmatter(E):null,R=w&&typeof w=="object"?w.exo__Asset_uid:void 0;if((await e.match(void 0,iV.Namespace.EXOCMD.term("CommandBinding_command"),void 0)).some(W=>String(W.object).includes(i))){let W=EO(w),ee=await vO(e,m),K=[...new Set([...W,...ee])];if(K.length>0){let ie=Qw(w?.exo__Asset_prototype);if(!(await p.resolveForAssetMulti(m,K,ie??void 0)).some($=>$.command.id===i))return console.error(`\u274C "${h.name}" is not bound to the target's class on "${d}".`),console.error(` Declared classes: ${K.join(", ")}.`),u}}let N={targetIRI:m,filePath:d,fileBasename:E?.basename,assetUid:typeof R=="string"?R:void 0};if(!await S.evaluate(h.precondition,m,N))return console.error(`\u274C Precondition not satisfied for "${h.name}" on "${d}".`),u;let j;if(o.input)try{let W=JSON.parse(o.input);if(typeof W!="object"||W===null||Array.isArray(W))throw new Error("must be a JSON object");j=W}catch(W){let ee=W instanceof Error?W.message:String(W);return console.error(`\u274C --input: invalid JSON object (${ee})`),u}let ae=(0,Ie.findInputSchemaViolation)(h.grounding,j);if(ae!==null)return console.error(`\u274C "${h.name}" cannot run on "${d}": ${ae}`),u;if(o.dryRun){let W=(0,Ie.findMissingInput)(h.grounding,j);return W!==null?(console.error(`\u274C "${h.name}" cannot run on "${d}": ${(0,Ie.missingInputError)(W)}`),u):(o.json||console.log(`\u{1F50D} Dry-run: would apply "${h.name}" to "${d}" (precondition passed).`),{ok:!0,created:[],executed:!1})}let Y=new Ie.ServiceRegistry,M=new Ie.GenericAssetCreationService(b).withDeterminism({clock:c,uidGenerator:l}),ce=new Ie.ArchiveAssetService(b),q=new Ie.PropertyCleanupService(b),oe=new Ie.FixMissingLabelService(b),X=new Ie.RenameToUidService(b),J=new Ie.TaskStatusService(b,new Ie.EffortStatusWorkflow,new Ie.StatusTimestampService(b));nV(Y,{vaultAdapter:b,fsAdapter:n,genericAssetCreationService:M,archiveAssetService:ce,taskStatusService:J,propertyCleanupService:q,fixMissingLabelService:oe,renameToUidService:X,folderRepairService:_});let ye=new Ie.NamedQueryRunner(new op(e,n),e),Z=await new Ie.GroundingExecutor(n,n,Y,(0,Ie.createVaultFrontmatterClassLabelResolver)(n),{clock:c,uidGenerator:l,workflowResolver:t,groundingLoader:a(W=>p.loadGroundingByUid(W),"groundingLoader"),templateLoader:a(async W=>{let ee=await n.findFileByUID(W);return ee?(0,Ie.stripTemplateFrontmatter)(await n.readFile(ee)):null},"templateLoader"),namedQueryRunner:ye,refToFolder:(0,Ie.createVaultFrontmatterRefToFolderResolver)(n),refToFrontmatter:(0,Ie.createVaultFrontmatterRefToFrontmatterResolver)(n),declaredRanges:(0,Ie.createTripleStoreDeclaredRanges)(e)}).execute(h.grounding,m,d,j);if(Z.success){let W=[];Z.openPath&&W.push(Z.openPath),Z.createdPaths&&W.push(...Z.createdPaths);let ee=[],K=new Set;for(let ie of W)K.has(ie)||(K.add(ie),ee.push(L_e(b,ie)));if(!o.json){let ie=h.successMessage??`Applied "${h.name}" to "${d}".`,Pe=Z.openPath??Z.createdPaths?.[0],$=Pe?` \u2192 ${Pe}`:"";console.log(`\u2705 ${ie}${$}`)}return{ok:!0,created:ee,executed:!0}}else return console.error(`\u274C "${h.name}" failed on "${d}": ${Z.error}`),{ok:!1,created:[],executed:!0}}a($_e,"executeOnTarget");function sV(){return new pe("apply").description("Apply an exocmd__Command to one or more vault assets (RFC 8e83442b T1.2). Pass a path arg or pipe paths via stdin.").argument("<cmd>","Command UUID or cliName slug").argument("[path]","Vault-relative path to target asset (omit to read paths from stdin)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--dry-run","Preview without writing").option("--yes","Skip destructive-command confirmation").option("--input <json>",`JSON userInput for a grounding. Value-setting commands need a value key, e.g. set-planned-start / set-scheduled-date: --input '{"value":"<ISO>"}'. A command whose grounding declares its own input key uses THAT key: set-label: --input '{"label":"New label"}'. Asset-reference inputs (set-parent: --input '{"parent":"<uid>"}'; set-blocker: --input '{"blocker":"<uid>"}') take a BARE uid; a copied [[uid]] or [[uid|alias]] is accepted and unwrapped, anything else that still looks like a link is refused. The required key is named in the error if omitted.`).option("--seed <uuid>","Deterministic UID seed for test/replay (uses seededUidGenerator)").option("--frozen-clock <iso>","Freeze clock to ISO timestamp for test/replay (uses frozenClock)").option("--json","Emit a machine-readable JSON result ({command,target,created:[{uuid,path,label}]}) instead of human-readable output").option("--use-cache","Use the persistent triple cache (hit / delta / rebuild) instead of a full vault parse; a mutation is picked up by the NEXT --use-cache process as a delta unless --write-through is also given").option("--write-through","With --use-cache: after a grounding executed, fold the mutation into the persistent cache in this process, so the next --use-cache process is a plain hit (the delta is paid by this writer instead of the next reader). Refused without --use-cache").action(async(r,e,t)=>{if(ue.setFormat("text"),t.writeThrough&&!t.useCache){process.stderr.write(`\u274C --write-through requires --use-cache (there is no cache to write through to without it); nothing was applied
626
626
  `),process.exit(2);return}try{let n=(0,rc.resolve)(t.vault);if(!(0,eF.existsSync)(n))throw new Le(n);cp(n);let i=t.frozenClock?(0,Ie.frozenClock)(t.frozenClock):(0,Ie.liveClock)(),s=t.seed?(0,Ie.seededUidGenerator)(t.seed):(0,Ie.liveUidGenerator)(),o=t.useCache??!1,c=await yi(n,{useCache:o});o&&process.stderr.write(`${Eu(c)}
627
627
  `);let l=new Ie.InMemoryTripleStore;await l.addAll(c.triples);let u=new yE(n,{explicitTriples:c.triples.slice(0,c.explicitCount),zeroTriplePaths:c.zeroTriplePaths}),f=new Ie.WorkflowResolver(l),d;if(N_e.test(r))d=r;else{let _=await M_e(l,r);_||(console.error(`\u274C No command found with UUID or cliName "${r}".`),process.exit(3)),d=_}let p;if(e)p=[e];else if(p=await k_e(),p.length===0)throw new Ye("No target path provided and stdin is empty.","exocortex apply <uuid> <path> OR exocortex find ... | exocortex apply <uuid>");let h=0,g=0,m=!1,b=[];for(let _ of p){let S=await $_e(n,l,f,u,d,_,t,i,s);S.ok?h++:g++,S.executed&&(m=!0),b.push(...S.created)}if(o&&t.writeThrough&&m&&c.cacheManager){let _=await BP(c.cacheManager);process.stderr.write(`${VP(_)}
628
628
  `)}if(p.length>1&&!t.json&&console.log(`
629
629
  \u{1F4CA} Applied to ${h}/${p.length} target(s) (${g} failed).`),t.json){let _={command:r,created:b};e?_.target=e:_.targets=p,process.stdout.write(JSON.stringify(_)+`
630
- `)}g>0&&process.exit(5)}catch(n){ue.handle(n),process.exit(5)}})}a(sV,"applyCommand");ct();ct();var yp=require("fs"),oF=require("path"),CE=Q(Fe());var wE=Q(ko()),EE=Q(require("path")),il=Q(Fe()),TE=Q(Fe());var U_e=il.SDK_FLOOR_ASSETSPACE_UIDS,Cu="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb",tF="3de846cd-1f0e-4f98-8613-b8587aa15174",B_e=5,vE=class{static{a(this,"CliProfileResolver")}constructor(e){this.vaultPaths=[EE.default.resolve(e.vaultPath)],this.maxExtendsDepth=e.maxExtendsDepth??B_e,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,il.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 U_e)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,n,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)n.add(c);typeof o.extends=="string"&&o.extends.length>0&&this.walkProfileChain(o.extends,t,n,i,s+1)}}async scanAllVaults(){let e=new Map,t=new Map,n=new Map;for(let i of this.vaultPaths){if(!await wE.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=Zi(o.frontmatter.exo__Instance_class);if(c.some(l=>l===Cu)){let l=G_e(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,il.derivePath)(u);d!==null&&e.set(d,o.uid)}let f=Zi(o.frontmatter.exo__AssetSpace_dependsOn);f.length>0&&n.set(o.uid,f)}if(c.some(l=>l===tF)){let l={uid:o.uid,label:typeof o.frontmatter.exo__Asset_label=="string"?o.frontmatter.exo__Asset_label:void 0,includes:Zi(o.frontmatter.exo__Profile_includes),extends:Zi(o.frontmatter.exo__Profile_imports)[0]??null};t.set(o.uid,l)}}}return{folderMap:e,profiles:t,dependsOn:n}}async walkVault(e){let t=[],n=[e];for(;n.length>0;){let i=n.pop(),s;try{s=await wE.default.readdir(i,{withFileTypes:!0})}catch{continue}for(let o of s){let c=EE.default.join(i,o.name);if(o.isDirectory()){if(o.name.startsWith(".")||o.name==="node_modules"||o.name===".obsidian"||o.name===".exocortex")continue;n.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 wE.default.readFile(e,"utf-8")}catch{return null}if(!t.startsWith("---"))return null;let n=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(n===null)return null;try{let i=(0,il.parseYamlFrontmatterTolerant)(n[1],e);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch{return null}}};function Zi(r){if(r==null)return[];let e=Array.isArray(r)?r:[r],t=[];for(let n of e){if(typeof n!="string")continue;let i=V_e(n);i!==null&&t.push(i)}return t}a(Zi,"parseWikilinkArray");function V_e(r){let e=r.trim().replace(/^\[\[/,"").replace(/\]\]$/,"").split("|")[0].trim();return e.length===0?null:e}a(V_e,"extractUidFromWikilink");function G_e(r,e){let t=EE.default.relative(e,r).replace(/\\/g,"/");if(!t.startsWith("assetspaces/"))return"";let n=t.slice(12),i=n.indexOf("/");return i<0?"":`assetspaces/${n.slice(0,i)}`}a(G_e,"parentFolderRelative");var AE=Q(ko()),rF=Q(require("path")),gp=Q(Fe());var IE=class{static{a(this,"RegistryDependencyResolver")}constructor(e={}){this.warn=e.warn??(()=>{})}async resolve(e,t){let n=await this.scanRegistry(e),i=this.matchSelf(n,t);if(i===null)return{outcome:"self-not-found",selfIdentifier:t,descriptorCount:n.size};let s=new Map;for(let m of n.values())m.dependsOn.length>0&&s.set(m.uid,m.dependsOn);let o=(0,gp.transitiveDependsOnClosure)([i.uid],s);o.delete(i.uid);let c=[],l=new Set,u=new Set([i.uid]),f=[...i.dependsOn];for(;f.length>0;){let m=f.shift();if(m===void 0||u.has(m))continue;u.add(m),o.has(m)&&!l.has(m)&&(c.push(m),l.add(m));let b=n.get(m);if(b!==void 0)for(let _ of b.dependsOn)u.has(_)||f.push(_)}for(let m of o)l.has(m)||(c.push(m),l.add(m));let d=[],p=[];for(let m of c){let b=n.get(m);b===void 0?p.push(m):d.push(b)}let h=d.filter(m=>m.source===null||m.source.length===0),g=d.filter(m=>m.source!==null&&m.source.length>0&&!q_e(m.source));return{outcome:"resolved",self:i,dependencies:d,missingDescriptors:p,sourceless:h,unsafeSources:g}}matchSelf(e,t){let n=mp(t);if(n!==null)for(let i of e.values()){if(i.source===null)continue;let s=mp(i.source);if(s!==null&&s===n)return i}for(let i of e.values())if(i.namespace!==null&&i.namespace===t)return i;return null}async scanRegistry(e){let t=new Map,n=rF.default.resolve(e);if(!await AE.default.pathExists(n))return this.warn(`[RegistryDependencyResolver] registry path does not exist: ${n}`),t;let i=[n];for(;i.length>0;){let s=i.pop(),o;try{o=await AE.default.readdir(s,{withFileTypes:!0})}catch{continue}for(let c of o){let l=rF.default.join(s,c.name);if(c.isDirectory()){if(c.name.startsWith(".")||c.name==="node_modules"||c.name===".obsidian"||c.name===".exocortex")continue;i.push(l);continue}if(!c.isFile()||!c.name.endsWith(".md"))continue;let u=await this.tryReadFrontmatter(l);if(u===null||!Zi(u.exo__Instance_class).some(m=>m===Cu))continue;let d=u.exo__Asset_uid;if(typeof d!="string"||d.length===0)continue;let p=typeof u.exo__AssetSpace_source=="string"?u.exo__AssetSpace_source:typeof u.exo__AssetSpace_git=="string"?u.exo__AssetSpace_git:null,h=typeof u.exo__AssetSpace_namespace=="string"?u.exo__AssetSpace_namespace:null,g=Zi(u.exo__AssetSpace_dependsOn);t.has(d)&&this.warn(`[RegistryDependencyResolver] duplicate AssetSpace descriptor for uid=${d} \u2014 last wins (${l})`),t.set(d,{uid:d,namespace:h,source:p,dependsOn:g})}}return t}async tryReadFrontmatter(e){let t;try{t=await AE.default.readFile(e,"utf-8")}catch{return null}if(!t.startsWith("---"))return null;let n=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(n===null)return null;try{let i=(0,gp.parseYamlFrontmatterTolerant)(n[1],e);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch{return null}}};function mp(r){let e=r.trim();if(e.length===0)return null;let t=(0,gp.derivePath)(e);if(t!==null)return t.replace(/^assetspaces\//,"").toLowerCase();if(!e.includes("://")&&!e.includes("@")){let i=e.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").filter(s=>s.length>0);if(i.length===2)return`${i[0]}/${i[1]}`.toLowerCase()}return null}a(mp,"ownerRepoSlug");function q_e(r){return typeof r!="string"||r.length===0||/[\s\x00-\x1f]/.test(r)||r.startsWith("-")||/^(ext|file|fd|ftp|ftps)::/i.test(r)?!1:!!(/^https?:\/\/[^\s]+$/i.test(r)||/^ssh:\/\/[^\s]+$/i.test(r)||/^git:\/\/[^\s]+$/i.test(r)||/^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+:[^\s]+$/.test(r))}a(q_e,"isSafeCloneUrl");St();kt();var cV=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,W_e=/^[A-Za-z][A-Za-z0-9-]*__[A-Za-z0-9_-]+$/,z_e=/^assetspaces\/([^/]+)\/([^/]+)\//,lV=["exo__Ontology_imports","exo__Ontology_admits","exo__Property_range","exo__Property_domain","exo__Class_superClass","exo__Property_superProperty","exo__Property_cardinality","exo__Property_minCount"],H_e="e1d7fb5c-d334-448d-935b-953b7b033e78",K_e="fe529085-5370-4ac0-bbe4-1c7351242dee",Y_e=5,nF=200;function RE(r){let e=z_e.exec(r.replace(/\\/g,"/"));return e?`${e[1]}/${e[2]}`.toLowerCase():null}a(RE,"assetspaceOfPath");var sF=class{constructor(){this.assets=[];this.uidToPath=new Map;this.pathSet=new Set;this.labelToPaths=new Map;this.basenameToPaths=new Map}static{a(this,"VaultIndex")}add(e){let t=e.path.replace(/\\/g,"/");this.assets.push({...e,path:t}),this.pathSet.add(t);let n=e.metadata.exo__Asset_uid;for(let c of Array.isArray(n)?n:[n])if(typeof c=="string"){let l=c.trim().toLowerCase();l.length>0&&!this.uidToPath.has(l)&&this.uidToPath.set(l,t)}let i=t.slice(t.lastIndexOf("/")+1).replace(/\.md$/,"");iF(this.basenameToPaths,i,t);let s=e.metadata.exo__Asset_label;typeof s=="string"&&s.trim().length>0&&iF(this.labelToPaths,s.trim(),t);let o=e.metadata.aliases;for(let c of Array.isArray(o)?o:[o])typeof c=="string"&&c.trim().length>0&&iF(this.labelToPaths,c.trim(),t)}resolve(e){let t=this.candidates(e);return t.length===0?null:t.length===1?t[0]:"ambiguous"}candidates(e){let t=e;if(cV.test(t)){let i=this.uidToPath.get(t.toLowerCase());return i===void 0?[]:[i]}if(t.includes("/")){let i=t.replace(/^\//,""),s=i.endsWith(".md")?i:`${i}.md`;if(this.pathSet.has(s))return[s];t=i.slice(i.lastIndexOf("/")+1)}t.endsWith(".md")&&(t=t.slice(0,-3));let n=this.distinctByUid(this.labelToPaths.get(t));return n.length>0?n:this.distinctByUid(this.basenameToPaths.get(t))}distinctByUid(e){if(!e||e.size===0)return[];let t=new Set,n=[];for(let i of e){let s=this.assets.find(l=>l.path===i),o=s?s.metadata.exo__Asset_uid:void 0,c=typeof o=="string"?o.trim().toLowerCase():`path:${i}`;t.has(c)||(t.add(c),n.push(i))}return n}};function iF(r,e,t){let n=r.get(e);n?n.add(t):r.set(e,new Set([t]))}a(iF,"addTo");function xg(r){if(Array.isArray(r)){let e=r.find(t=>typeof t=="string");return typeof e=="string"?e:null}return typeof r=="string"?r:null}a(xg,"firstString");function X_e(r){let e=Zi(r);if(e.length===0)return"unkinded";let t=e[0].toLowerCase();return t===H_e?"TBox":t===K_e?"Reference":"unknown"}a(X_e,"kindOf");function Q_e(r){return r==null?0:(Array.isArray(r)?r:[r]).filter(t=>typeof t=="object"&&t!==null).length}a(Q_e,"countStructuredItems");function J_e(r){let e=Array.isArray(r)?r:r==null?[]:[r],t=[];for(let n of e){if(typeof n!="string")continue;let i=n.trim().replace(/^["']|["']$/g,""),s=i.startsWith("[[")&&i.endsWith("]]"),o=(0,CE.extractAssetReference)(i);if(!o)continue;let c=o.split("#")[0].trim();c.length!==0&&(s||cV.test(c)||W_e.test(c))&&t.push(c)}return t}a(J_e,"referencesOf");function oV(r){let e=new Map;for(let t of r){if(Ji(t.path)||bi(t.path)||!Zi(t.metadata.exo__Instance_class).some(c=>c.toLowerCase()===Cu))continue;let i=xg(t.metadata.exo__Asset_uid);if(!i)continue;let s=i.trim().toLowerCase();if(e.has(s))continue;let o=xg(t.metadata.exo__AssetSpace_source)??xg(t.metadata.exo__AssetSpace_git);e.set(s,{uid:s,slug:o?mp(o):null,label:xg(t.metadata.exo__Asset_label)??t.path,path:t.path,dependsOn:Zi(t.metadata.exo__AssetSpace_dependsOn).map(c=>c.toLowerCase()),kind:X_e(t.metadata.exo__AssetSpace_dependsOnKind)})}return e}a(oV,"collectDescriptors");async function Z_e(r){let e=new sF,t=new Set,n=new Cn(r.vault,{cacheContent:!1});for(let F of await n.indexedAssets()){if(Ji(F.path)||bi(F.path))continue;let H=xg(F.metadata.exo__Asset_uid),le=H?H.trim().toLowerCase():`path:${F.path}`;t.has(le)||(t.add(le),e.add(F))}let i,s;if(r.registry){let F=new Cn(r.registry,{cacheContent:!1});s=oV(await F.indexedAssets()),i=r.registry}else s=oV(e.assets),i="vault";let o=new Map,c=[],l=new Map;for(let F of s.values()){if(F.slug===null){c.push(F.label);continue}o.set(F.uid,F.slug);let H=l.get(F.slug);H?H.push(F.uid):l.set(F.slug,[F.uid])}let u=[...l.entries()].filter(([,F])=>F.length>1).map(([F,H])=>({slug:F,uids:H})),f=new Map;for(let F of s.values())F.slug&&f.set(F.slug,F.kind);let d=new Map,p=[],h=0,g=new Set;for(let F of s.values())if(F.slug!==null)for(let H of F.dependsOn){let le=o.get(H);if(le===void 0){p.push({source:F.slug,ref:H});continue}if(le===F.slug)continue;let Se=d.get(F.slug);Se||(Se=[],d.set(F.slug,Se)),Se.includes(le)||(Se.push(le),h++,g.add(le))}let m=null;r.self!==void 0&&(m=mp(r.self),m===null&&(m=r.self.trim().toLowerCase()));let b=new Map,_=a(F=>{let H=b.get(F);if(H!==void 0)return H;let le=(0,CE.transitiveDependsOnClosure)([F],d);return b.set(F,le),le},"closureOf"),S=r.missingDeps??[];if(S.length>0&&m===null)throw new Ye("--missing-dep / --missing-deps-file require --self: in vault mode unresolved refs are already fail-open, so the inputs would be a silent no-op","Pass --self <owner/repo> (the per-repo CI mode) together with the missing deps");let I=[...new Set(S.map(F=>mp(F)??F.trim().toLowerCase()).filter(F=>F.length>0&&F!==m))].sort(),E=m!==null?_(m):new Set,w=new Set;for(let F of e.assets){let H=RE(F.path);H!==null&&w.add(H)}let R=I.filter(F=>w.has(F)),x=I.filter(F=>E.has(F)&&!w.has(F)),O=I.filter(F=>!E.has(F)&&!w.has(F)),N=r.strictUnresolved===!0,G=m!==null&&!N&&x.length>0,j=new Map,ae=[],Y=0,M=[],ce=0,W=0,oe=0,X=[],J=0,ye=0,ze=0,Z=0;for(let F of e.assets){let H=RE(F.path);if(H!==null&&!(m!==null&&H!==m)){ze++;for(let le of lV){let Se=F.metadata[le],Ce=Q_e(Se);Ce>0&&(J+=Ce,X.length<nF&&X.push({sourcePath:F.path,predicate:le}));let Ge=J_e(Se);for(let Ne of Ge){let ke=e.candidates(Ne);if(ke.length===0){Y++,ae.length<nF&&ae.push({source:H,sourcePath:F.path,predicate:le,ref:Ne,reason:"not-found"});continue}if(ke.length>1){let nt=[...new Set(ke.map(P=>RE(P)??"<outside assetspaces/>"))].sort(),et=_(H),C=nt.every(P=>P===H||et.has(P));ce++,C?W++:oe++,M.length<nF&&M.push({source:H,sourcePath:F.path,predicate:le,ref:Ne,candidates:nt,coveredByClosure:C});continue}let qe=ke[0],xe=RE(qe);if(xe===null){ye++;continue}if(xe===H)continue;Z++;let Be=`${H} ${xe}`,Ze=j.get(Be);Ze||(Ze={source:H,target:xe,occurrences:0,predicates:{},examples:[],coveredDirect:d.get(H)?.includes(xe)??!1,coveredByClosure:_(H).has(xe)},j.set(Be,Ze)),Ze.occurrences++,Ze.predicates[le]=(Ze.predicates[le]??0)+1,Ze.examples.length<Y_e&&Ze.examples.push(`${F.path} --${le}--> ${Ne}`)}}}}let z=[...j.values()].sort((F,H)=>Number(F.coveredByClosure)-Number(H.coveredByClosure)||Number(F.coveredDirect)-Number(H.coveredDirect)||F.source.localeCompare(H.source)||F.target.localeCompare(H.target)),ee=z.filter(F=>F.coveredByClosure).length,K=z.filter(F=>!F.coveredDirect).length,ie=m!==null,Pe=m!==null&&!G,$=G?Y:0,fe=z.filter(F=>!F.coveredByClosure).length+(ie?oe:0)+(Pe?Y:0),se=new Set(z.map(F=>`${F.source} ${F.target}`)),Ae=[],ge={TBox:0,unkinded:0,unknown:0},ve=0;for(let[F,H]of d)if(!(m!==null&&F!==m))for(let le of H){let Se=f.get(le)??"unknown";if(Se==="Reference"){ve++;continue}let Ce=se.has(`${F} ${le}`);Ce||(Ae.push({source:F,target:le,targetKind:Se,hasFact:Ce}),ge[Se]++)}Ae.sort((F,H)=>F.source.localeCompare(H.source)||F.target.localeCompare(H.target));let Re=[...g].filter(F=>(f.get(F)??"unknown")==="unkinded").sort(),de,U=null;return s.size===0?(de="BROKEN",U=`no exo__AssetSpace descriptor found (registry: ${i}) \u2014 nothing to judge against`):m!==null&&!l.has(m)?(de="BROKEN",U=`--self '${r.self}' (${m}) is not a registered AssetSpace (${s.size} descriptor(s) scanned)`):m!==null&&ze===0?(de="BROKEN",U=`--self '${m}': no asset under assetspaces/${m}/ in the vault \u2014 the self content was not merged`):m===null&&z.length===0?(de="BROKEN",U="zero definition-tier cross-AssetSpace fact edges \u2014 an empty population cannot be declared covered"):de=fe===0?"OK":"FAIL",{vaultPath:r.vault,registrySource:i,self:m,verdict:de,brokenReason:U,descriptors:{count:s.size,sourceless:c,duplicateSlugs:u,declaredEdgeCount:h,carriers:d.size,targets:g.size,danglingDeclarations:p},facts:{edgeCount:z.length,occurrences:Z,sources:new Set(z.map(F=>F.source)).size,targets:new Set(z.map(F=>F.target)).size,coveredByClosure:ee,uncoveredDirect:K,uncoveredByClosure:fe,edges:z},unresolved:{count:Y,countedAsUncovered:Pe,excusedWhileDepsMissing:$,refs:ae},degraded:{active:G,strict:N,missingDeps:I,missingDepsInClosure:x,missingDepsOutsideClosure:O,missingDepsPresentInVault:R,unresolvedExcused:$},ambiguous:{count:ce,coveredByClosure:W,uncovered:oe,countedAsUncovered:ie,refs:M},nonStringValues:{count:J,sites:X},targetsOutsideAssetspaces:ye,scannedSources:ze,declaredWithoutFact:{total:Ae.length,byKind:ge,edges:Ae},packaging:ve,targetsWithoutKind:Re,clean:de==="OK"}}a(Z_e,"scanAssetSpaceDepends");function eSe(r){return Object.entries(r).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>`${e.replace(/^exo__/,"")}\xD7${t}`).join(", ")}a(eSe,"formatPredicates");function tSe(r){let e=r.verdict==="OK"?console.log:console.error,n=`[${r.vaultPath.replace(/\/+$/,"").split("/").pop()??r.vaultPath}${r.self?`, self=${r.self}`:""}, tier=definitions]`,i=r.degraded.active?` (DEGRADED: declared deps absent from merged vault: ${r.degraded.missingDepsInClosure.join(", ")})`:"";e(`${r.verdict}${i} ${r.vaultPath}: assetspace-depends audit ${n} \u2014 uncovered by CLOSURE: ${r.facts.uncoveredByClosure} (verdict), uncovered DIRECTLY: ${r.facts.uncoveredDirect} (informational, not a criterion), ambiguous refs: ${r.ambiguous.count} (covered ${r.ambiguous.coveredByClosure} / uncovered ${r.ambiguous.uncovered}${r.ambiguous.countedAsUncovered?", counted in the verdict":", listed only"}), non-string values under definition-tier predicates: ${r.nonStringValues.count} (skipped, not judged)`),r.brokenReason&&e(`\u26D4 BROKEN: ${r.brokenReason}`),e(`Registry (${r.registrySource}): ${r.descriptors.count} descriptor(s), declared dependsOn edges: ${r.descriptors.declaredEdgeCount} (carriers ${r.descriptors.carriers} \u2192 targets ${r.descriptors.targets}), dangling: ${r.descriptors.danglingDeclarations.length}, sourceless: ${r.descriptors.sourceless.length}, duplicate owner/repo: ${r.descriptors.duplicateSlugs.length}`),e(`Facts (definition tier, ${lV.length} predicates): ${r.facts.edgeCount} cross-AssetSpace edge(s) / ${r.facts.occurrences} occurrence(s) (sources ${r.facts.sources} \u2192 targets ${r.facts.targets}, scanned ${r.scannedSources} source asset(s)); canary covered-by-closure = ${r.facts.coveredByClosure}`);let s=r.degraded.active?`(--self, DEGRADED: NOT counted \u2014 declared deps absent from the merged vault: ${r.degraded.missingDepsInClosure.join(", ")})`:r.unresolved.countedAsUncovered?r.degraded.strict&&r.degraded.missingDeps.length>0?`(--self --strict-unresolved: counted as uncovered despite declared missing deps ${r.degraded.missingDeps.join(", ")})`:"(--self: counted as uncovered \u2014 target absent from the merged vault)":"(fail-open, listed, NOT counted \u2014 validate-wikilinks territory)";e(`Unresolved definition-tier refs: ${r.unresolved.count} ${s}; targets outside assetspaces/: ${r.targetsOutsideAssetspaces}`),r.degraded.active&&e(`\u26A0 unresolved refs excused: ${r.degraded.unresolvedExcused} \u2014 may include refs into undeclared absent AssetSpaces; coverage NOT proven for them (DEGRADED \u2260 proven coverage)`),r.degraded.missingDepsOutsideClosure.length>0&&e(`\u26A0 --missing-dep outside closure(self) \u2014 excuses nothing: ${r.degraded.missingDepsOutsideClosure.join(", ")}`),r.degraded.missingDepsPresentInVault.length>0&&e(`\u26A0 --missing-dep named but PRESENT in the vault (assets found under its assetspaces/ folder) \u2014 ignored, excuses nothing: ${r.degraded.missingDepsPresentInVault.join(", ")}`),e(`Declared without a definition-tier fact (one-sided, never a violation; Reference-kind targets excluded): ${r.declaredWithoutFact.total} \u2014 TBox: ${r.declaredWithoutFact.byKind.TBox}, unkinded: ${r.declaredWithoutFact.byKind.unkinded}, unknown-kind: ${r.declaredWithoutFact.byKind.unknown}; packaging declarations (Reference-kind targets, frame p.4): ${r.packaging}`),e(`Declared targets without exo__AssetSpace_dependsOnKind: ${r.targetsWithoutKind.length}`+(r.targetsWithoutKind.length>0?` \u2014 ${r.targetsWithoutKind.join(", ")}`:"")),e("Declared-graph cycles are NOT judged by this verb (dependsOn = packaging, RFC 306dcb5c frame p.1); facts-graph acyclicity is the scheduled detector's job.");let o=r.facts.edges.filter(l=>!l.coveredByClosure);if(o.length>0){console.error(`
630
+ `)}g>0&&process.exit(5)}catch(n){ue.handle(n),process.exit(5)}})}a(sV,"applyCommand");ct();ct();var yp=require("fs"),oF=require("path"),CE=Q(Fe());var wE=Q(ko()),EE=Q(require("path")),il=Q(Fe()),TE=Q(Fe());var U_e=il.SDK_FLOOR_ASSETSPACE_UIDS,Cu="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb",tF="3de846cd-1f0e-4f98-8613-b8587aa15174",B_e=5,vE=class{static{a(this,"CliProfileResolver")}constructor(e){this.vaultPaths=[EE.default.resolve(e.vaultPath)],this.maxExtendsDepth=e.maxExtendsDepth??B_e,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,il.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 U_e)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,n,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)n.add(c);typeof o.extends=="string"&&o.extends.length>0&&this.walkProfileChain(o.extends,t,n,i,s+1)}}async scanAllVaults(){let e=new Map,t=new Map,n=new Map;for(let i of this.vaultPaths){if(!await wE.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=Zi(o.frontmatter.exo__Instance_class);if(c.some(l=>l===Cu)){let l=G_e(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,il.derivePath)(u);d!==null&&e.set(d,o.uid)}let f=Zi(o.frontmatter.exo__AssetSpace_dependsOn);f.length>0&&n.set(o.uid,f)}if(c.some(l=>l===tF)){let l={uid:o.uid,label:typeof o.frontmatter.exo__Asset_label=="string"?o.frontmatter.exo__Asset_label:void 0,includes:Zi(o.frontmatter.exo__Profile_includes),extends:Zi(o.frontmatter.exo__Profile_imports)[0]??null};t.set(o.uid,l)}}}return{folderMap:e,profiles:t,dependsOn:n}}async walkVault(e){let t=[],n=[e];for(;n.length>0;){let i=n.pop(),s;try{s=await wE.default.readdir(i,{withFileTypes:!0})}catch{continue}for(let o of s){let c=EE.default.join(i,o.name);if(o.isDirectory()){if(o.name.startsWith(".")||o.name==="node_modules"||o.name===".obsidian"||o.name===".exocortex")continue;n.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 wE.default.readFile(e,"utf-8")}catch{return null}if(!t.startsWith("---"))return null;let n=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(n===null)return null;try{let i=(0,il.parseYamlFrontmatterTolerant)(n[1],e);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch{return null}}};function Zi(r){if(r==null)return[];let e=Array.isArray(r)?r:[r],t=[];for(let n of e){if(typeof n!="string")continue;let i=V_e(n);i!==null&&t.push(i)}return t}a(Zi,"parseWikilinkArray");function V_e(r){let e=r.trim().replace(/^\[\[/,"").replace(/\]\]$/,"").split("|")[0].trim();return e.length===0?null:e}a(V_e,"extractUidFromWikilink");function G_e(r,e){let t=EE.default.relative(e,r).replace(/\\/g,"/");if(!t.startsWith("assetspaces/"))return"";let n=t.slice(12),i=n.indexOf("/");return i<0?"":`assetspaces/${n.slice(0,i)}`}a(G_e,"parentFolderRelative");var AE=Q(ko()),rF=Q(require("path")),gp=Q(Fe());var IE=class{static{a(this,"RegistryDependencyResolver")}constructor(e={}){this.warn=e.warn??(()=>{})}async resolve(e,t){let n=await this.scanRegistry(e),i=this.matchSelf(n,t);if(i===null)return{outcome:"self-not-found",selfIdentifier:t,descriptorCount:n.size};let s=new Map;for(let m of n.values())m.dependsOn.length>0&&s.set(m.uid,m.dependsOn);let o=(0,gp.transitiveDependsOnClosure)([i.uid],s);o.delete(i.uid);let c=[],l=new Set,u=new Set([i.uid]),f=[...i.dependsOn];for(;f.length>0;){let m=f.shift();if(m===void 0||u.has(m))continue;u.add(m),o.has(m)&&!l.has(m)&&(c.push(m),l.add(m));let b=n.get(m);if(b!==void 0)for(let _ of b.dependsOn)u.has(_)||f.push(_)}for(let m of o)l.has(m)||(c.push(m),l.add(m));let d=[],p=[];for(let m of c){let b=n.get(m);b===void 0?p.push(m):d.push(b)}let h=d.filter(m=>m.source===null||m.source.length===0),g=d.filter(m=>m.source!==null&&m.source.length>0&&!q_e(m.source));return{outcome:"resolved",self:i,dependencies:d,missingDescriptors:p,sourceless:h,unsafeSources:g}}matchSelf(e,t){let n=mp(t);if(n!==null)for(let i of e.values()){if(i.source===null)continue;let s=mp(i.source);if(s!==null&&s===n)return i}for(let i of e.values())if(i.namespace!==null&&i.namespace===t)return i;return null}async scanRegistry(e){let t=new Map,n=rF.default.resolve(e);if(!await AE.default.pathExists(n))return this.warn(`[RegistryDependencyResolver] registry path does not exist: ${n}`),t;let i=[n];for(;i.length>0;){let s=i.pop(),o;try{o=await AE.default.readdir(s,{withFileTypes:!0})}catch{continue}for(let c of o){let l=rF.default.join(s,c.name);if(c.isDirectory()){if(c.name.startsWith(".")||c.name==="node_modules"||c.name===".obsidian"||c.name===".exocortex")continue;i.push(l);continue}if(!c.isFile()||!c.name.endsWith(".md"))continue;let u=await this.tryReadFrontmatter(l);if(u===null||!Zi(u.exo__Instance_class).some(m=>m===Cu))continue;let d=u.exo__Asset_uid;if(typeof d!="string"||d.length===0)continue;let p=typeof u.exo__AssetSpace_source=="string"?u.exo__AssetSpace_source:typeof u.exo__AssetSpace_git=="string"?u.exo__AssetSpace_git:null,h=typeof u.exo__AssetSpace_namespace=="string"?u.exo__AssetSpace_namespace:null,g=Zi(u.exo__AssetSpace_dependsOn);t.has(d)&&this.warn(`[RegistryDependencyResolver] duplicate AssetSpace descriptor for uid=${d} \u2014 last wins (${l})`),t.set(d,{uid:d,namespace:h,source:p,dependsOn:g})}}return t}async tryReadFrontmatter(e){let t;try{t=await AE.default.readFile(e,"utf-8")}catch{return null}if(!t.startsWith("---"))return null;let n=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(n===null)return null;try{let i=(0,gp.parseYamlFrontmatterTolerant)(n[1],e);return i&&typeof i=="object"&&!Array.isArray(i)?i:null}catch{return null}}};function mp(r){let e=r.trim();if(e.length===0)return null;let t=(0,gp.derivePath)(e);if(t!==null)return t.replace(/^assetspaces\//,"").toLowerCase();if(!e.includes("://")&&!e.includes("@")){let i=e.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").filter(s=>s.length>0);if(i.length===2)return`${i[0]}/${i[1]}`.toLowerCase()}return null}a(mp,"ownerRepoSlug");function q_e(r){return typeof r!="string"||r.length===0||/[\s\x00-\x1f]/.test(r)||r.startsWith("-")||/^(ext|file|fd|ftp|ftps)::/i.test(r)?!1:!!(/^https?:\/\/[^\s]+$/i.test(r)||/^ssh:\/\/[^\s]+$/i.test(r)||/^git:\/\/[^\s]+$/i.test(r)||/^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+:[^\s]+$/.test(r))}a(q_e,"isSafeCloneUrl");St();kt();var cV=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,W_e=/^[A-Za-z][A-Za-z0-9-]*__[A-Za-z0-9_-]+$/,z_e=/^assetspaces\/([^/]+)\/([^/]+)\//,lV=["exo__Ontology_imports","exo__Ontology_admits","exo__Property_range","exo__Property_domain","exo__Class_superClass","exo__Property_superProperty","exo__Property_cardinality","exo__Property_minCount"],H_e="e1d7fb5c-d334-448d-935b-953b7b033e78",K_e="fe529085-5370-4ac0-bbe4-1c7351242dee",Y_e=5,nF=200;function RE(r){let e=z_e.exec(r.replace(/\\/g,"/"));return e?`${e[1]}/${e[2]}`.toLowerCase():null}a(RE,"assetspaceOfPath");var sF=class{constructor(){this.assets=[];this.uidToPath=new Map;this.pathSet=new Set;this.labelToPaths=new Map;this.basenameToPaths=new Map}static{a(this,"VaultIndex")}add(e){let t=e.path.replace(/\\/g,"/");this.assets.push({...e,path:t}),this.pathSet.add(t);let n=e.metadata.exo__Asset_uid;for(let c of Array.isArray(n)?n:[n])if(typeof c=="string"){let l=c.trim().toLowerCase();l.length>0&&!this.uidToPath.has(l)&&this.uidToPath.set(l,t)}let i=t.slice(t.lastIndexOf("/")+1).replace(/\.md$/,"");iF(this.basenameToPaths,i,t);let s=e.metadata.exo__Asset_label;typeof s=="string"&&s.trim().length>0&&iF(this.labelToPaths,s.trim(),t);let o=e.metadata.aliases;for(let c of Array.isArray(o)?o:[o])typeof c=="string"&&c.trim().length>0&&iF(this.labelToPaths,c.trim(),t)}resolve(e){let t=this.candidates(e);return t.length===0?null:t.length===1?t[0]:"ambiguous"}candidates(e){let t=e;if(cV.test(t)){let i=this.uidToPath.get(t.toLowerCase());return i===void 0?[]:[i]}if(t.includes("/")){let i=t.replace(/^\//,""),s=i.endsWith(".md")?i:`${i}.md`;if(this.pathSet.has(s))return[s];t=i.slice(i.lastIndexOf("/")+1)}t.endsWith(".md")&&(t=t.slice(0,-3));let n=this.distinctByUid(this.labelToPaths.get(t));return n.length>0?n:this.distinctByUid(this.basenameToPaths.get(t))}distinctByUid(e){if(!e||e.size===0)return[];let t=new Set,n=[];for(let i of e){let s=this.assets.find(l=>l.path===i),o=s?s.metadata.exo__Asset_uid:void 0,c=typeof o=="string"?o.trim().toLowerCase():`path:${i}`;t.has(c)||(t.add(c),n.push(i))}return n}};function iF(r,e,t){let n=r.get(e);n?n.add(t):r.set(e,new Set([t]))}a(iF,"addTo");function xg(r){if(Array.isArray(r)){let e=r.find(t=>typeof t=="string");return typeof e=="string"?e:null}return typeof r=="string"?r:null}a(xg,"firstString");function X_e(r){let e=Zi(r);if(e.length===0)return"unkinded";let t=e[0].toLowerCase();return t===H_e?"TBox":t===K_e?"Reference":"unknown"}a(X_e,"kindOf");function Q_e(r){return r==null?0:(Array.isArray(r)?r:[r]).filter(t=>typeof t=="object"&&t!==null).length}a(Q_e,"countStructuredItems");function J_e(r){let e=Array.isArray(r)?r:r==null?[]:[r],t=[];for(let n of e){if(typeof n!="string")continue;let i=n.trim().replace(/^["']|["']$/g,""),s=i.startsWith("[[")&&i.endsWith("]]"),o=(0,CE.extractAssetReference)(i);if(!o)continue;let c=o.split("#")[0].trim();c.length!==0&&(s||cV.test(c)||W_e.test(c))&&t.push(c)}return t}a(J_e,"referencesOf");function oV(r){let e=new Map;for(let t of r){if(Ji(t.path)||bi(t.path)||!Zi(t.metadata.exo__Instance_class).some(c=>c.toLowerCase()===Cu))continue;let i=xg(t.metadata.exo__Asset_uid);if(!i)continue;let s=i.trim().toLowerCase();if(e.has(s))continue;let o=xg(t.metadata.exo__AssetSpace_source)??xg(t.metadata.exo__AssetSpace_git);e.set(s,{uid:s,slug:o?mp(o):null,label:xg(t.metadata.exo__Asset_label)??t.path,path:t.path,dependsOn:Zi(t.metadata.exo__AssetSpace_dependsOn).map(c=>c.toLowerCase()),kind:X_e(t.metadata.exo__AssetSpace_dependsOnKind)})}return e}a(oV,"collectDescriptors");async function Z_e(r){let e=new sF,t=new Set,n=new Cn(r.vault,{cacheContent:!1});for(let F of await n.indexedAssets()){if(Ji(F.path)||bi(F.path))continue;let H=xg(F.metadata.exo__Asset_uid),le=H?H.trim().toLowerCase():`path:${F.path}`;t.has(le)||(t.add(le),e.add(F))}let i,s;if(r.registry){let F=new Cn(r.registry,{cacheContent:!1});s=oV(await F.indexedAssets()),i=r.registry}else s=oV(e.assets),i="vault";let o=new Map,c=[],l=new Map;for(let F of s.values()){if(F.slug===null){c.push(F.label);continue}o.set(F.uid,F.slug);let H=l.get(F.slug);H?H.push(F.uid):l.set(F.slug,[F.uid])}let u=[...l.entries()].filter(([,F])=>F.length>1).map(([F,H])=>({slug:F,uids:H})),f=new Map;for(let F of s.values())F.slug&&f.set(F.slug,F.kind);let d=new Map,p=[],h=0,g=new Set;for(let F of s.values())if(F.slug!==null)for(let H of F.dependsOn){let le=o.get(H);if(le===void 0){p.push({source:F.slug,ref:H});continue}if(le===F.slug)continue;let Se=d.get(F.slug);Se||(Se=[],d.set(F.slug,Se)),Se.includes(le)||(Se.push(le),h++,g.add(le))}let m=null;r.self!==void 0&&(m=mp(r.self),m===null&&(m=r.self.trim().toLowerCase()));let b=new Map,_=a(F=>{let H=b.get(F);if(H!==void 0)return H;let le=(0,CE.transitiveDependsOnClosure)([F],d);return b.set(F,le),le},"closureOf"),S=r.missingDeps??[];if(S.length>0&&m===null)throw new Ye("--missing-dep / --missing-deps-file require --self: in vault mode unresolved refs are already fail-open, so the inputs would be a silent no-op","Pass --self <owner/repo> (the per-repo CI mode) together with the missing deps");let I=[...new Set(S.map(F=>mp(F)??F.trim().toLowerCase()).filter(F=>F.length>0&&F!==m))].sort(),E=m!==null?_(m):new Set,w=new Set;for(let F of e.assets){let H=RE(F.path);H!==null&&w.add(H)}let R=I.filter(F=>w.has(F)),x=I.filter(F=>E.has(F)&&!w.has(F)),O=I.filter(F=>!E.has(F)&&!w.has(F)),N=r.strictUnresolved===!0,G=m!==null&&!N&&x.length>0,j=new Map,ae=[],Y=0,M=[],ce=0,q=0,oe=0,X=[],J=0,ye=0,ze=0,Z=0;for(let F of e.assets){let H=RE(F.path);if(H!==null&&!(m!==null&&H!==m)){ze++;for(let le of lV){let Se=F.metadata[le],Ce=Q_e(Se);Ce>0&&(J+=Ce,X.length<nF&&X.push({sourcePath:F.path,predicate:le}));let Ge=J_e(Se);for(let Ne of Ge){let ke=e.candidates(Ne);if(ke.length===0){Y++,ae.length<nF&&ae.push({source:H,sourcePath:F.path,predicate:le,ref:Ne,reason:"not-found"});continue}if(ke.length>1){let nt=[...new Set(ke.map(P=>RE(P)??"<outside assetspaces/>"))].sort(),et=_(H),C=nt.every(P=>P===H||et.has(P));ce++,C?q++:oe++,M.length<nF&&M.push({source:H,sourcePath:F.path,predicate:le,ref:Ne,candidates:nt,coveredByClosure:C});continue}let qe=ke[0],xe=RE(qe);if(xe===null){ye++;continue}if(xe===H)continue;Z++;let Be=`${H} ${xe}`,Ze=j.get(Be);Ze||(Ze={source:H,target:xe,occurrences:0,predicates:{},examples:[],coveredDirect:d.get(H)?.includes(xe)??!1,coveredByClosure:_(H).has(xe)},j.set(Be,Ze)),Ze.occurrences++,Ze.predicates[le]=(Ze.predicates[le]??0)+1,Ze.examples.length<Y_e&&Ze.examples.push(`${F.path} --${le}--> ${Ne}`)}}}}let W=[...j.values()].sort((F,H)=>Number(F.coveredByClosure)-Number(H.coveredByClosure)||Number(F.coveredDirect)-Number(H.coveredDirect)||F.source.localeCompare(H.source)||F.target.localeCompare(H.target)),ee=W.filter(F=>F.coveredByClosure).length,K=W.filter(F=>!F.coveredDirect).length,ie=m!==null,Pe=m!==null&&!G,$=G?Y:0,fe=W.filter(F=>!F.coveredByClosure).length+(ie?oe:0)+(Pe?Y:0),se=new Set(W.map(F=>`${F.source} ${F.target}`)),Ae=[],ge={TBox:0,unkinded:0,unknown:0},ve=0;for(let[F,H]of d)if(!(m!==null&&F!==m))for(let le of H){let Se=f.get(le)??"unknown";if(Se==="Reference"){ve++;continue}let Ce=se.has(`${F} ${le}`);Ce||(Ae.push({source:F,target:le,targetKind:Se,hasFact:Ce}),ge[Se]++)}Ae.sort((F,H)=>F.source.localeCompare(H.source)||F.target.localeCompare(H.target));let Re=[...g].filter(F=>(f.get(F)??"unknown")==="unkinded").sort(),de,U=null;return s.size===0?(de="BROKEN",U=`no exo__AssetSpace descriptor found (registry: ${i}) \u2014 nothing to judge against`):m!==null&&!l.has(m)?(de="BROKEN",U=`--self '${r.self}' (${m}) is not a registered AssetSpace (${s.size} descriptor(s) scanned)`):m!==null&&ze===0?(de="BROKEN",U=`--self '${m}': no asset under assetspaces/${m}/ in the vault \u2014 the self content was not merged`):m===null&&W.length===0?(de="BROKEN",U="zero definition-tier cross-AssetSpace fact edges \u2014 an empty population cannot be declared covered"):de=fe===0?"OK":"FAIL",{vaultPath:r.vault,registrySource:i,self:m,verdict:de,brokenReason:U,descriptors:{count:s.size,sourceless:c,duplicateSlugs:u,declaredEdgeCount:h,carriers:d.size,targets:g.size,danglingDeclarations:p},facts:{edgeCount:W.length,occurrences:Z,sources:new Set(W.map(F=>F.source)).size,targets:new Set(W.map(F=>F.target)).size,coveredByClosure:ee,uncoveredDirect:K,uncoveredByClosure:fe,edges:W},unresolved:{count:Y,countedAsUncovered:Pe,excusedWhileDepsMissing:$,refs:ae},degraded:{active:G,strict:N,missingDeps:I,missingDepsInClosure:x,missingDepsOutsideClosure:O,missingDepsPresentInVault:R,unresolvedExcused:$},ambiguous:{count:ce,coveredByClosure:q,uncovered:oe,countedAsUncovered:ie,refs:M},nonStringValues:{count:J,sites:X},targetsOutsideAssetspaces:ye,scannedSources:ze,declaredWithoutFact:{total:Ae.length,byKind:ge,edges:Ae},packaging:ve,targetsWithoutKind:Re,clean:de==="OK"}}a(Z_e,"scanAssetSpaceDepends");function eSe(r){return Object.entries(r).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>`${e.replace(/^exo__/,"")}\xD7${t}`).join(", ")}a(eSe,"formatPredicates");function tSe(r){let e=r.verdict==="OK"?console.log:console.error,n=`[${r.vaultPath.replace(/\/+$/,"").split("/").pop()??r.vaultPath}${r.self?`, self=${r.self}`:""}, tier=definitions]`,i=r.degraded.active?` (DEGRADED: declared deps absent from merged vault: ${r.degraded.missingDepsInClosure.join(", ")})`:"";e(`${r.verdict}${i} ${r.vaultPath}: assetspace-depends audit ${n} \u2014 uncovered by CLOSURE: ${r.facts.uncoveredByClosure} (verdict), uncovered DIRECTLY: ${r.facts.uncoveredDirect} (informational, not a criterion), ambiguous refs: ${r.ambiguous.count} (covered ${r.ambiguous.coveredByClosure} / uncovered ${r.ambiguous.uncovered}${r.ambiguous.countedAsUncovered?", counted in the verdict":", listed only"}), non-string values under definition-tier predicates: ${r.nonStringValues.count} (skipped, not judged)`),r.brokenReason&&e(`\u26D4 BROKEN: ${r.brokenReason}`),e(`Registry (${r.registrySource}): ${r.descriptors.count} descriptor(s), declared dependsOn edges: ${r.descriptors.declaredEdgeCount} (carriers ${r.descriptors.carriers} \u2192 targets ${r.descriptors.targets}), dangling: ${r.descriptors.danglingDeclarations.length}, sourceless: ${r.descriptors.sourceless.length}, duplicate owner/repo: ${r.descriptors.duplicateSlugs.length}`),e(`Facts (definition tier, ${lV.length} predicates): ${r.facts.edgeCount} cross-AssetSpace edge(s) / ${r.facts.occurrences} occurrence(s) (sources ${r.facts.sources} \u2192 targets ${r.facts.targets}, scanned ${r.scannedSources} source asset(s)); canary covered-by-closure = ${r.facts.coveredByClosure}`);let s=r.degraded.active?`(--self, DEGRADED: NOT counted \u2014 declared deps absent from the merged vault: ${r.degraded.missingDepsInClosure.join(", ")})`:r.unresolved.countedAsUncovered?r.degraded.strict&&r.degraded.missingDeps.length>0?`(--self --strict-unresolved: counted as uncovered despite declared missing deps ${r.degraded.missingDeps.join(", ")})`:"(--self: counted as uncovered \u2014 target absent from the merged vault)":"(fail-open, listed, NOT counted \u2014 validate-wikilinks territory)";e(`Unresolved definition-tier refs: ${r.unresolved.count} ${s}; targets outside assetspaces/: ${r.targetsOutsideAssetspaces}`),r.degraded.active&&e(`\u26A0 unresolved refs excused: ${r.degraded.unresolvedExcused} \u2014 may include refs into undeclared absent AssetSpaces; coverage NOT proven for them (DEGRADED \u2260 proven coverage)`),r.degraded.missingDepsOutsideClosure.length>0&&e(`\u26A0 --missing-dep outside closure(self) \u2014 excuses nothing: ${r.degraded.missingDepsOutsideClosure.join(", ")}`),r.degraded.missingDepsPresentInVault.length>0&&e(`\u26A0 --missing-dep named but PRESENT in the vault (assets found under its assetspaces/ folder) \u2014 ignored, excuses nothing: ${r.degraded.missingDepsPresentInVault.join(", ")}`),e(`Declared without a definition-tier fact (one-sided, never a violation; Reference-kind targets excluded): ${r.declaredWithoutFact.total} \u2014 TBox: ${r.declaredWithoutFact.byKind.TBox}, unkinded: ${r.declaredWithoutFact.byKind.unkinded}, unknown-kind: ${r.declaredWithoutFact.byKind.unknown}; packaging declarations (Reference-kind targets, frame p.4): ${r.packaging}`),e(`Declared targets without exo__AssetSpace_dependsOnKind: ${r.targetsWithoutKind.length}`+(r.targetsWithoutKind.length>0?` \u2014 ${r.targetsWithoutKind.join(", ")}`:"")),e("Declared-graph cycles are NOT judged by this verb (dependsOn = packaging, RFC 306dcb5c frame p.1); facts-graph acyclicity is the scheduled detector's job.");let o=r.facts.edges.filter(l=>!l.coveredByClosure);if(o.length>0){console.error(`
631
631
  UNCOVERED by closure (src \u2192 tgt, occurrences, predicates):`);for(let l of o){console.error(` ${l.source} \u2192 ${l.target}: ${l.occurrences} [${eSe(l.predicates)}]`);for(let u of l.examples)console.error(` ${u}`)}}if(r.unresolved.refs.length>0){let l=r.unresolved.countedAsUncovered?console.error:e;l(`
632
632
  Unresolved definition-tier references (${r.unresolved.count}${r.degraded.active?"; excused \u2014 DEGRADED, coverage NOT proven":""}):`);for(let u of r.unresolved.refs.slice(0,50))l(` ${u.source}: ${u.sourcePath} --${u.predicate}--> ${u.ref} (${u.reason})`);r.unresolved.count>50&&l(` \u2026 ${r.unresolved.count-50} more`)}if(r.ambiguous.refs.length>0){let l=r.ambiguous.countedAsUncovered?console.error:e;l(`
633
633
  Ambiguous definition-tier references (${r.ambiguous.count}; \u22652 distinct UIDs under one label \u2014 covered only when EVERY candidate's AssetSpace is in the source's closure):`);for(let u of r.ambiguous.refs.slice(0,50))l(` ${u.coveredByClosure?"covered ":"UNCOVERED"} ${u.source}: ${u.sourcePath} --${u.predicate}--> ${u.ref} \u2192 {${u.candidates.join(", ")}}`);r.ambiguous.count>50&&l(` \u2026 ${r.ambiguous.count-50} more`)}if(r.nonStringValues.sites.length>0){e(`
@@ -638,7 +638,7 @@ Dangling dependsOn declarations (no descriptor for the target UID):`);for(let l
638
638
  isDefinedBy=${s.isDefinedBy} expected=${s.expectedFolder}/ actual=${s.actualFolder}/`)}console.error(`
639
639
  Skipped (fail-open, NOT verified): ${i} \u2014 empty-isDefinedBy=${n.skips["empty-isDefinedBy"]}, bang-prefix=${n.skips["bang-prefix"]}, unresolvable(cross-vault/missing)=${n.skips.unresolvable}`)}n.violations.length>0&&(process.exitCode=1)}catch(t){ue.handle(t)}})}a(pV,"auditCoLocationCommand");ct();var OE=require("fs"),TV=require("path"),fF=Q(Fe());function hV(r,e){let t=new Map,n=new Map,i=new Set,s=[],o=[],c=0;for(let l of r){if(t.has(l))continue;let u=[],f=a(d=>{t.set(d,c),n.set(d,c),c++,s.push(d),i.add(d),u.push([d,(e.get(d)??new Set).values()])},"pushNode");for(f(l);u.length>0;){let[d,p]=u[u.length-1],h=p.next();if(h.done){if(u.pop(),u.length>0){let g=u[u.length-1][0];n.set(g,Math.min(n.get(g),n.get(d)))}if(n.get(d)===t.get(d)){let g=[],m;do m=s.pop(),i.delete(m),g.push(m);while(m!==d);o.push(g)}}else{let g=h.value;t.has(g)?i.has(g)&&n.set(d,Math.min(n.get(d),t.get(g))):f(g)}}}return o}a(hV,"stronglyConnectedComponents");function mV(r,e){return hV(r,e).filter(t=>t.length>=2)}a(mV,"tarjanSCC");function PE(r,e){let t=new Map;for(let n of r){let i=new Set,s=[...e.get(n)??[]];for(;s.length>0;){let o=s.shift();if(!i.has(o)){i.add(o);for(let c of e.get(o)??[])i.has(c)||s.push(c)}}t.set(n,i)}return t}a(PE,"transitiveClosure");function gV(r,e){let t=hV(r,e),n=new Map;t.forEach((s,o)=>{for(let c of s)n.set(c,o)});let i=new Map;for(let[s,o]of e){let c=n.get(s);if(c!==void 0)for(let l of o){let u=n.get(l);if(u===void 0||c===u)continue;let f=i.get(c);f||(f=new Set,i.set(c,f)),f.add(u)}}return{components:t,componentOf:n,condensedEdges:i}}a(gV,"condense");function yV(r,e){let t=PE(r,e),n=new Map;for(let[i,s]of e)for(let o of s){let c=!1;for(let l of s)if(l!==o&&t.get(l)?.has(o)){c=!0;break}if(!c){let l=n.get(i);l||(l=new Set,n.set(i,l)),l.add(o)}}return n}a(yV,"transitiveReduction");function bV(r,e){let t=new Map,n=new Map;for(let p of r)t.set(p,new Map),n.set(p,new Map);for(let p of e){if(p.source===p.target)continue;let h=t.get(p.source),g=n.get(p.target);!h||!g||(h.set(p.target,(h.get(p.target)??0)+p.weight),g.set(p.source,(g.get(p.source)??0)+p.weight))}let i=new Set(r),s=[],o=[],c=a(p=>{i.delete(p);for(let h of t.get(p).keys())n.get(h)?.delete(p);for(let h of n.get(p).keys())t.get(h)?.delete(p);t.get(p).clear(),n.get(p).clear()},"removeNode"),l=a(p=>{let h=0;for(let g of p.values())h+=g;return h},"sumWeights"),u=a(()=>[...i].sort(),"sortedRemaining");for(;i.size>0;){let p=!0;for(;p;){p=!1;for(let h of u())i.has(h)&&t.get(h).size===0&&(o.unshift(h),c(h),p=!0);for(let h of u())i.has(h)&&n.get(h).size===0&&(s.push(h),c(h),p=!0)}if(i.size>0){let h=null,g=-1/0;for(let m of u()){let b=l(t.get(m))-l(n.get(m));b>g&&(g=b,h=m)}h!==null&&(s.push(h),c(h))}}let f=[...s,...o],d=new Map(f.map((p,h)=>[p,h]));return e.filter(p=>{if(p.source===p.target)return!1;let h=d.get(p.source),g=d.get(p.target);return h===void 0||g===void 0?!1:h>g})}a(bV,"greedyFeedbackArcSet");var _V=/\[\[([^\]]+)\]\]/g;function sSe(r){let e=r.split(`
640
640
  `),t=[],n=null;for(let i of e){let s=i.match(/^[ \t]*(`{3,}|~{3,})/),o=s&&(s[1][0]==="~"||!i.slice(i.indexOf(s[1])+s[1].length).includes("`"));n===null?o?n=s[1]:t.push(i):s&&s[1][0]===n[0]&&s[1].length>=n.length&&/^[ \t]*(?:`{3,}|~{3,})[ \t]*$/.test(i)&&(n=null)}return t.join(`
641
- `)}a(sSe,"stripFencedCodeBlocks");function SV(r){let e=[],t;for(_V.lastIndex=0;(t=_V.exec(r))!==null;){let n=t[1],i=n.indexOf("|");i!==-1&&(n=n.slice(0,i));let s=n.indexOf("#");s!==-1&&(n=n.slice(0,s));let o=n.trim();o.length>0&&e.push(o)}return e}a(SV,"extractWikilinkTargets");function lF(r){return typeof r=="string"?[r]:Array.isArray(r)?r.flatMap(lF):r!==null&&typeof r=="object"?Object.values(r).flatMap(lF):[]}a(lF,"collectFrontmatterStrings");function oSe(r){let e=r.match(/^---\n[\s\S]*?\n---/);return e?r.slice(e[0].length):r}a(oSe,"bodyOf");function wV(r,e,t){let n=[];for(let[s,o]of Object.entries(r))if(!t?.has(s))for(let c of lF(o))for(let l of SV(c))n.push(l);let i=SV(sSe(oSe(e)));return[...n,...i]}a(wV,"extractFileWikilinkTargets");var aSe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function EV(r,e){if(e.includes("/")){let n=e.replace(/^\//,""),i=n.endsWith(".md")?n:`${n}.md`;if(await r.hasIndexedPath(i))return i;e=n.slice(n.lastIndexOf("/")+1)}if(e.endsWith(".md")&&(e=e.slice(0,-3)),aSe.test(e)){let n=await r.findFileByUID(e);if(n)return n}let t=await r.findPathsByBasename(e);return t.length===1?t[0]:t.length>1?new Set(t).size===1?t[0]:"ambiguous":null}a(EV,"resolveTargetPath");St();kt();var cSe="\0",lSe="829b9b3b-6fc3-4276-be6a-27d3398c012e",uSe=["exo__Asset_relates","concept__Concept_related","concept__Concept_broader","concept__Concept_synonym","exo__Asset_createdBy"],fSe=5,dSe=10,pSe=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif","pdf","mp3","wav","m4a","ogg","flac","mp4","mov","webm","avi","mkv","zip","gz","tar","canvas","base","json","css","js","ts","html"]);function hSe(r){let e=r.lastIndexOf(".");if(e===-1||e===r.length-1)return!1;let t=r.slice(e+1).toLowerCase();return pSe.has(t)}a(hSe,"nonMarkdownExtension");function uF(r){if(Array.isArray(r)){let e=r.filter(t=>typeof t=="string");return{value:e[0]??null,multiple:e.length>1}}return{value:typeof r=="string"?r:null,multiple:!1}}a(uF,"firstString");function vV(r){let e=Array.isArray(r)?r:r==null?[]:[r],t=[];for(let n of e){let i=(0,fF.extractAssetReference)(n);i&&t.push(i)}return t}a(vV,"asRefList");function Pg(r,e,t=fSe){r.length<t&&r.push(e)}a(Pg,"pushExample");async function mSe(r,e={}){let t=new Cn(r,{cacheContent:!0}),n=await t.indexedAssets(),i=new Set(e.excludePredicates??[]),s=new Map,o=new Map,c=new Map,l=[];for(let $ of n){if(Ji($.path)||bi($.path)||!vV($.metadata.exo__Instance_class).includes(lSe))continue;let{value:se}=uF($.metadata.exo__Asset_uid);if(!se){l.push($.path);continue}let{value:Ae}=uF($.metadata.exo__Asset_label),ge=Ae??$.path,ve=c.get(se);ve?ve.push($.path):c.set(se,[$.path]),s.set($.path,se),o.has(se)||o.set(se,{uid:se,label:ge,path:$.path,metadata:$.metadata})}let u=[...c.entries()].filter(([,$])=>$.length>1).map(([$,fe])=>({uid:$,paths:fe})),f=new Map,d={"empty-isDefinedBy":0,"bang-prefix":0,unresolvable:0,"not-an-ontology":0},p=[],h=0,g=0,m=new Map,b=0,_=a(($,fe)=>{f.set($,null),d[fe]++,h++,Pg(p,`${$} (${fe})`,dSe)},"markNoOntology");for(let $ of n){if(Ji($.path)||bi($.path))continue;b++;let fe=$.metadata.exo__Asset_isDefinedBy,{value:se,multiple:Ae}=uF(fe);Ae&&g++;let ge=(0,fF.extractAssetReference)(se);if(!ge){_($.path,"empty-isDefinedBy");continue}if(ge.startsWith("!")){_($.path,"bang-prefix");continue}let ve=await to(t,ge,$.path);if(!ve){_($.path,"unresolvable");continue}let Re=s.get(ve);if(!Re){_($.path,"not-an-ontology");continue}f.set($.path,Re),m.set(Re,(m.get(Re)??0)+1)}let S=[...o.keys()],I=new Map,E=[],w=new Map,R=new Map,x=0;for(let $ of S){let fe=o.get($),se=vV(fe.metadata.exo__Ontology_imports),Ae=[],ge=[],ve=!1;for(let Re of se){let de=null;if(o.has(Re))de=Re;else{let U=await to(t,Re,fe.path);de=U?s.get(U)??null:null}if(de===null)ge.push(Re);else if(de===$)ve=!0;else{Ae.push(de);let U=I.get($);U||(U=new Set,I.set($,U)),U.has(de)||(U.add(de),x++)}}w.set($,Ae),R.set($,ge),ve&&E.push($)}let O=mV(S,I),N=PE(S,I),G={total:0,internal:0,crossOntologyValid:0,crossOntologyViolation:0,crossVault:0,noOntology:0},j={broken:0,"dup-basename":0,"non-markdown":0},ae={broken:[],"dup-basename":[],"non-markdown":[]},Y=new Map,M=new Map,ce=new Map,W=new Map,oe=new Map,X=new Map,J=a($=>{let fe=o.get($);return fe?{uid:fe.uid,label:fe.label,path:fe.path}:{uid:$,label:$,path:""}},"toRef");for(let $ of n){if(Ji($.path)||bi($.path))continue;let fe=f.get($.path)??null,se=wV($.metadata,$.content??"",i);for(let Ae of se){if(G.total++,hSe(Ae)){j["non-markdown"]++,Pg(ae["non-markdown"],`${$.path} \u2192 ${Ae}`);continue}let ge=await EV(t,Ae);if(ge==="ambiguous"){j["dup-basename"]++,Pg(ae["dup-basename"],`${$.path} \u2192 ${Ae}`);continue}if(ge===null){j.broken++,Pg(ae.broken,`${$.path} \u2192 ${Ae}`);continue}let ve=f.get(ge)??s.get(ge)??null;if(fe===null||ve===null){G.noOntology++;continue}if(fe===ve){G.internal++,ce.set(fe,(ce.get(fe)??0)+1);continue}let Re=N.get(fe)?.has(ve)??!1,de=`${fe}${cSe}${ve}`,U=Y.get(de);if(U?U.occurrences++:Y.set(de,{source:fe,target:ve,occurrences:1,valid:Re}),W.set(fe,(W.get(fe)??0)+1),oe.set(ve,(oe.get(ve)??0)+1),Re)G.crossOntologyValid++;else{G.crossOntologyViolation++,X.set(fe,(X.get(fe)??0)+1);let F=M.get(de);F?(F.occurrences++,Pg(F.examples,$.path)):M.set(de,{source:fe,target:ve,occurrences:1,examples:[$.path]})}}}let ye=[...Y.values()].sort(($,fe)=>fe.occurrences-$.occurrences),ze=new Map,Z=new Map;for(let $ of ye)Z.set($.source,(Z.get($.source)??0)+1),ze.set($.target,(ze.get($.target)??0)+1);let z=S.map($=>({...J($),declaredImports:w.get($)??[],unresolvedImports:R.get($)??[],selfImport:E.includes($),assetCount:m.get($)??0,inDegree:ze.get($)??0,outDegree:Z.get($)??0,internalLinks:ce.get($)??0,externalLinksOut:W.get($)??0,externalLinksIn:oe.get($)??0,violatingOut:X.get($)??0})).sort(($,fe)=>$.label.localeCompare(fe.label)),ee=[...M.values()].map($=>({source:J($.source),target:J($.target),occurrences:$.occurrences,examples:$.examples})).sort(($,fe)=>fe.occurrences-$.occurrences),K=[],ie=O.length===0,Pe=ee.length===0&&G.crossVault===0&&ie&&u.length===0;return{vaultPath:r,totalFiles:n.length,scannedFiles:b,ontologies:z,duplicateOntologyUids:u,declared:{edgeCount:x,sccs:O,acyclic:ie},derivedEdges:ye,violations:ee,crossVault:K,linkCounts:G,skips:j,skipExamples:ae,noOntologyAssets:{count:h,byReason:d,examples:p},warnings:{selfImports:E,multipleIsDefinedBy:g,ontologiesWithoutUid:l},clean:Pe,...i.size>0?{excludedPredicates:[...i]}:{}}}a(mSe,"scanVaultForOntologyImports");function gSe(r){let e=r.ontologies.map(w=>w.uid),t=new Map;for(let w of r.ontologies)t.set(w.uid,{uid:w.uid,label:w.label,path:w.path});let n=a(w=>t.get(w)??{uid:w,label:w,path:""},"refOf"),i=new Map;for(let w of r.ontologies)w.declaredImports.length>0&&i.set(w.uid,new Set(w.declaredImports));let s=new Map,o=new Map;for(let w of r.derivedEdges){let R=s.get(w.source);R||(R=new Set,s.set(w.source,R)),R.add(w.target),o.set(`${w.source} ${w.target}`,w.occurrences)}let{components:c,componentOf:l}=gV(e,s),u=[],f=new Map,d=0;for(let w of r.derivedEdges){let R=l.get(w.source),x=l.get(w.target);if(R!==void 0&&x!==void 0&&R===x){let N=f.get(R);N||(N=[],f.set(R,N)),N.push({source:w.source,target:w.target,weight:w.occurrences})}else u.push({source:w.source,target:w.target,occurrences:w.occurrences}),w.valid&&d++}let p=a((w,R,x)=>{if(w===R)return!0;let O=[...x.get(w)??[]],N=new Set;for(;O.length>0;){let G=O.shift();if(G===R)return!0;if(!N.has(G)){N.add(G);for(let j of x.get(G)??[])O.push(j)}}return!1},"reaches"),h=new Map;for(let[w,R]of i)h.set(w,new Set(R));let g=[],m=[...u].sort((w,R)=>w.source===R.source?w.target.localeCompare(R.target):w.source.localeCompare(R.source));for(let w of m)if(p(w.target,w.source,h))g.push({source:n(w.source),target:n(w.target),occurrences:w.occurrences});else{let R=h.get(w.source);R||(R=new Set,h.set(w.source,R)),R.add(w.target)}let b=yV(e,h),_=[];for(let[w,R]of b)for(let x of R)i.get(w)?.has(x)||_.push({source:n(w),target:n(x),occurrences:o.get(`${w} ${x}`)??0});_.sort((w,R)=>R.occurrences-w.occurrences||w.source.uid.localeCompare(R.source.uid)||w.target.uid.localeCompare(R.target.uid));let S=[];for(let[w,R]of f){let x=c[w],N=bV(x,R).map(G=>({source:n(G.source),target:n(G.target),occurrences:G.weight})).sort((G,j)=>G.occurrences-j.occurrences||G.source.uid.localeCompare(j.source.uid)||G.target.uid.localeCompare(j.target.uid));S.push({ontologies:x.map(n).sort((G,j)=>G.label.localeCompare(j.label)),edgeCount:R.length,occurrenceCount:R.reduce((G,j)=>G+j.weight,0),suggestedCuts:N})}S.sort((w,R)=>R.ontologies.length-w.ontologies.length||R.occurrenceCount-w.occurrenceCount);let I=PE(e,i),E=[];for(let[w,R]of i)for(let x of R){let O=!1;for(let N of R)if(N!==x&&I.get(N)?.has(x)){O=!0;break}O&&E.push({source:n(w),target:n(x),occurrences:o.get(`${w} ${x}`)??0})}return{additions:_,acyclicEdgeCount:u.length,alreadyCovered:d,conflicts:g,intraScc:S,redundantDeclared:E}}a(gSe,"computeImportProposal");function io(r){return`${r.uid}|${r.label}|${r.path}`}a(io,"formatRef");function ySe(r){let e=r.ontologies.filter(i=>i.declaredImports.length>0||i.unresolvedImports.length>0).length,t=r.clean?console.log:console.error;if(t(`${r.clean?"OK":"FAIL"} ${r.vaultPath}: ontology-imports audit \u2014 ${r.linkCounts.crossOntologyViolation} violating occurrence(s) in ${r.violations.length} pair(s)`),t(`Ontologies: ${r.ontologies.length} (${e} with imports declared), declared graph: ${r.declared.edgeCount} edge(s), `+(r.declared.acyclic?"acyclic":`NOT ACYCLIC \u2014 ${r.declared.sccs.length} SCC(s)`)),r.excludedPredicates&&r.excludedPredicates.length>0&&t(`Structural-only mode (VL#30): excluded ${r.excludedPredicates.length} associative predicate(s) from edge extraction \u2014 ${r.excludedPredicates.join(", ")}`),r.duplicateOntologyUids.length>0){console.error(`
641
+ `)}a(sSe,"stripFencedCodeBlocks");function SV(r){let e=[],t;for(_V.lastIndex=0;(t=_V.exec(r))!==null;){let n=t[1],i=n.indexOf("|");i!==-1&&(n=n.slice(0,i));let s=n.indexOf("#");s!==-1&&(n=n.slice(0,s));let o=n.trim();o.length>0&&e.push(o)}return e}a(SV,"extractWikilinkTargets");function lF(r){return typeof r=="string"?[r]:Array.isArray(r)?r.flatMap(lF):r!==null&&typeof r=="object"?Object.values(r).flatMap(lF):[]}a(lF,"collectFrontmatterStrings");function oSe(r){let e=r.match(/^---\n[\s\S]*?\n---/);return e?r.slice(e[0].length):r}a(oSe,"bodyOf");function wV(r,e,t){let n=[];for(let[s,o]of Object.entries(r))if(!t?.has(s))for(let c of lF(o))for(let l of SV(c))n.push(l);let i=SV(sSe(oSe(e)));return[...n,...i]}a(wV,"extractFileWikilinkTargets");var aSe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function EV(r,e){if(e.includes("/")){let n=e.replace(/^\//,""),i=n.endsWith(".md")?n:`${n}.md`;if(await r.hasIndexedPath(i))return i;e=n.slice(n.lastIndexOf("/")+1)}if(e.endsWith(".md")&&(e=e.slice(0,-3)),aSe.test(e)){let n=await r.findFileByUID(e);if(n)return n}let t=await r.findPathsByBasename(e);return t.length===1?t[0]:t.length>1?new Set(t).size===1?t[0]:"ambiguous":null}a(EV,"resolveTargetPath");St();kt();var cSe="\0",lSe="829b9b3b-6fc3-4276-be6a-27d3398c012e",uSe=["exo__Asset_relates","concept__Concept_related","concept__Concept_broader","concept__Concept_synonym","exo__Asset_createdBy"],fSe=5,dSe=10,pSe=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif","pdf","mp3","wav","m4a","ogg","flac","mp4","mov","webm","avi","mkv","zip","gz","tar","canvas","base","json","css","js","ts","html"]);function hSe(r){let e=r.lastIndexOf(".");if(e===-1||e===r.length-1)return!1;let t=r.slice(e+1).toLowerCase();return pSe.has(t)}a(hSe,"nonMarkdownExtension");function uF(r){if(Array.isArray(r)){let e=r.filter(t=>typeof t=="string");return{value:e[0]??null,multiple:e.length>1}}return{value:typeof r=="string"?r:null,multiple:!1}}a(uF,"firstString");function vV(r){let e=Array.isArray(r)?r:r==null?[]:[r],t=[];for(let n of e){let i=(0,fF.extractAssetReference)(n);i&&t.push(i)}return t}a(vV,"asRefList");function Pg(r,e,t=fSe){r.length<t&&r.push(e)}a(Pg,"pushExample");async function mSe(r,e={}){let t=new Cn(r,{cacheContent:!0}),n=await t.indexedAssets(),i=new Set(e.excludePredicates??[]),s=new Map,o=new Map,c=new Map,l=[];for(let $ of n){if(Ji($.path)||bi($.path)||!vV($.metadata.exo__Instance_class).includes(lSe))continue;let{value:se}=uF($.metadata.exo__Asset_uid);if(!se){l.push($.path);continue}let{value:Ae}=uF($.metadata.exo__Asset_label),ge=Ae??$.path,ve=c.get(se);ve?ve.push($.path):c.set(se,[$.path]),s.set($.path,se),o.has(se)||o.set(se,{uid:se,label:ge,path:$.path,metadata:$.metadata})}let u=[...c.entries()].filter(([,$])=>$.length>1).map(([$,fe])=>({uid:$,paths:fe})),f=new Map,d={"empty-isDefinedBy":0,"bang-prefix":0,unresolvable:0,"not-an-ontology":0},p=[],h=0,g=0,m=new Map,b=0,_=a(($,fe)=>{f.set($,null),d[fe]++,h++,Pg(p,`${$} (${fe})`,dSe)},"markNoOntology");for(let $ of n){if(Ji($.path)||bi($.path))continue;b++;let fe=$.metadata.exo__Asset_isDefinedBy,{value:se,multiple:Ae}=uF(fe);Ae&&g++;let ge=(0,fF.extractAssetReference)(se);if(!ge){_($.path,"empty-isDefinedBy");continue}if(ge.startsWith("!")){_($.path,"bang-prefix");continue}let ve=await to(t,ge,$.path);if(!ve){_($.path,"unresolvable");continue}let Re=s.get(ve);if(!Re){_($.path,"not-an-ontology");continue}f.set($.path,Re),m.set(Re,(m.get(Re)??0)+1)}let S=[...o.keys()],I=new Map,E=[],w=new Map,R=new Map,x=0;for(let $ of S){let fe=o.get($),se=vV(fe.metadata.exo__Ontology_imports),Ae=[],ge=[],ve=!1;for(let Re of se){let de=null;if(o.has(Re))de=Re;else{let U=await to(t,Re,fe.path);de=U?s.get(U)??null:null}if(de===null)ge.push(Re);else if(de===$)ve=!0;else{Ae.push(de);let U=I.get($);U||(U=new Set,I.set($,U)),U.has(de)||(U.add(de),x++)}}w.set($,Ae),R.set($,ge),ve&&E.push($)}let O=mV(S,I),N=PE(S,I),G={total:0,internal:0,crossOntologyValid:0,crossOntologyViolation:0,crossVault:0,noOntology:0},j={broken:0,"dup-basename":0,"non-markdown":0},ae={broken:[],"dup-basename":[],"non-markdown":[]},Y=new Map,M=new Map,ce=new Map,q=new Map,oe=new Map,X=new Map,J=a($=>{let fe=o.get($);return fe?{uid:fe.uid,label:fe.label,path:fe.path}:{uid:$,label:$,path:""}},"toRef");for(let $ of n){if(Ji($.path)||bi($.path))continue;let fe=f.get($.path)??null,se=wV($.metadata,$.content??"",i);for(let Ae of se){if(G.total++,hSe(Ae)){j["non-markdown"]++,Pg(ae["non-markdown"],`${$.path} \u2192 ${Ae}`);continue}let ge=await EV(t,Ae);if(ge==="ambiguous"){j["dup-basename"]++,Pg(ae["dup-basename"],`${$.path} \u2192 ${Ae}`);continue}if(ge===null){j.broken++,Pg(ae.broken,`${$.path} \u2192 ${Ae}`);continue}let ve=f.get(ge)??s.get(ge)??null;if(fe===null||ve===null){G.noOntology++;continue}if(fe===ve){G.internal++,ce.set(fe,(ce.get(fe)??0)+1);continue}let Re=N.get(fe)?.has(ve)??!1,de=`${fe}${cSe}${ve}`,U=Y.get(de);if(U?U.occurrences++:Y.set(de,{source:fe,target:ve,occurrences:1,valid:Re}),q.set(fe,(q.get(fe)??0)+1),oe.set(ve,(oe.get(ve)??0)+1),Re)G.crossOntologyValid++;else{G.crossOntologyViolation++,X.set(fe,(X.get(fe)??0)+1);let F=M.get(de);F?(F.occurrences++,Pg(F.examples,$.path)):M.set(de,{source:fe,target:ve,occurrences:1,examples:[$.path]})}}}let ye=[...Y.values()].sort(($,fe)=>fe.occurrences-$.occurrences),ze=new Map,Z=new Map;for(let $ of ye)Z.set($.source,(Z.get($.source)??0)+1),ze.set($.target,(ze.get($.target)??0)+1);let W=S.map($=>({...J($),declaredImports:w.get($)??[],unresolvedImports:R.get($)??[],selfImport:E.includes($),assetCount:m.get($)??0,inDegree:ze.get($)??0,outDegree:Z.get($)??0,internalLinks:ce.get($)??0,externalLinksOut:q.get($)??0,externalLinksIn:oe.get($)??0,violatingOut:X.get($)??0})).sort(($,fe)=>$.label.localeCompare(fe.label)),ee=[...M.values()].map($=>({source:J($.source),target:J($.target),occurrences:$.occurrences,examples:$.examples})).sort(($,fe)=>fe.occurrences-$.occurrences),K=[],ie=O.length===0,Pe=ee.length===0&&G.crossVault===0&&ie&&u.length===0;return{vaultPath:r,totalFiles:n.length,scannedFiles:b,ontologies:W,duplicateOntologyUids:u,declared:{edgeCount:x,sccs:O,acyclic:ie},derivedEdges:ye,violations:ee,crossVault:K,linkCounts:G,skips:j,skipExamples:ae,noOntologyAssets:{count:h,byReason:d,examples:p},warnings:{selfImports:E,multipleIsDefinedBy:g,ontologiesWithoutUid:l},clean:Pe,...i.size>0?{excludedPredicates:[...i]}:{}}}a(mSe,"scanVaultForOntologyImports");function gSe(r){let e=r.ontologies.map(w=>w.uid),t=new Map;for(let w of r.ontologies)t.set(w.uid,{uid:w.uid,label:w.label,path:w.path});let n=a(w=>t.get(w)??{uid:w,label:w,path:""},"refOf"),i=new Map;for(let w of r.ontologies)w.declaredImports.length>0&&i.set(w.uid,new Set(w.declaredImports));let s=new Map,o=new Map;for(let w of r.derivedEdges){let R=s.get(w.source);R||(R=new Set,s.set(w.source,R)),R.add(w.target),o.set(`${w.source} ${w.target}`,w.occurrences)}let{components:c,componentOf:l}=gV(e,s),u=[],f=new Map,d=0;for(let w of r.derivedEdges){let R=l.get(w.source),x=l.get(w.target);if(R!==void 0&&x!==void 0&&R===x){let N=f.get(R);N||(N=[],f.set(R,N)),N.push({source:w.source,target:w.target,weight:w.occurrences})}else u.push({source:w.source,target:w.target,occurrences:w.occurrences}),w.valid&&d++}let p=a((w,R,x)=>{if(w===R)return!0;let O=[...x.get(w)??[]],N=new Set;for(;O.length>0;){let G=O.shift();if(G===R)return!0;if(!N.has(G)){N.add(G);for(let j of x.get(G)??[])O.push(j)}}return!1},"reaches"),h=new Map;for(let[w,R]of i)h.set(w,new Set(R));let g=[],m=[...u].sort((w,R)=>w.source===R.source?w.target.localeCompare(R.target):w.source.localeCompare(R.source));for(let w of m)if(p(w.target,w.source,h))g.push({source:n(w.source),target:n(w.target),occurrences:w.occurrences});else{let R=h.get(w.source);R||(R=new Set,h.set(w.source,R)),R.add(w.target)}let b=yV(e,h),_=[];for(let[w,R]of b)for(let x of R)i.get(w)?.has(x)||_.push({source:n(w),target:n(x),occurrences:o.get(`${w} ${x}`)??0});_.sort((w,R)=>R.occurrences-w.occurrences||w.source.uid.localeCompare(R.source.uid)||w.target.uid.localeCompare(R.target.uid));let S=[];for(let[w,R]of f){let x=c[w],N=bV(x,R).map(G=>({source:n(G.source),target:n(G.target),occurrences:G.weight})).sort((G,j)=>G.occurrences-j.occurrences||G.source.uid.localeCompare(j.source.uid)||G.target.uid.localeCompare(j.target.uid));S.push({ontologies:x.map(n).sort((G,j)=>G.label.localeCompare(j.label)),edgeCount:R.length,occurrenceCount:R.reduce((G,j)=>G+j.weight,0),suggestedCuts:N})}S.sort((w,R)=>R.ontologies.length-w.ontologies.length||R.occurrenceCount-w.occurrenceCount);let I=PE(e,i),E=[];for(let[w,R]of i)for(let x of R){let O=!1;for(let N of R)if(N!==x&&I.get(N)?.has(x)){O=!0;break}O&&E.push({source:n(w),target:n(x),occurrences:o.get(`${w} ${x}`)??0})}return{additions:_,acyclicEdgeCount:u.length,alreadyCovered:d,conflicts:g,intraScc:S,redundantDeclared:E}}a(gSe,"computeImportProposal");function io(r){return`${r.uid}|${r.label}|${r.path}`}a(io,"formatRef");function ySe(r){let e=r.ontologies.filter(i=>i.declaredImports.length>0||i.unresolvedImports.length>0).length,t=r.clean?console.log:console.error;if(t(`${r.clean?"OK":"FAIL"} ${r.vaultPath}: ontology-imports audit \u2014 ${r.linkCounts.crossOntologyViolation} violating occurrence(s) in ${r.violations.length} pair(s)`),t(`Ontologies: ${r.ontologies.length} (${e} with imports declared), declared graph: ${r.declared.edgeCount} edge(s), `+(r.declared.acyclic?"acyclic":`NOT ACYCLIC \u2014 ${r.declared.sccs.length} SCC(s)`)),r.excludedPredicates&&r.excludedPredicates.length>0&&t(`Structural-only mode (VL#30): excluded ${r.excludedPredicates.length} associative predicate(s) from edge extraction \u2014 ${r.excludedPredicates.join(", ")}`),r.duplicateOntologyUids.length>0){console.error(`
642
642
  HARD ERRORS \u2014 duplicate ontology UIDs (R7):`);for(let i of r.duplicateOntologyUids)console.error(` ${i.uid}: ${i.paths.join(", ")}`)}if(!r.declared.acyclic){console.error(`
643
643
  Declared-graph cycles (must be a DAG):`);for(let i of r.declared.sccs)console.error(` SCC[${i.length}]: ${i.map(s=>io(bSe(r,s))).join(" \u21C4 ")}`)}if(r.violations.length>0){console.error(`
644
644
  Violating pairs (src \u2192 tgt, occurrences desc):`);for(let i of r.violations)console.error(` ${io(i.source)} \u2192 ${io(i.target)}: ${i.occurrences}`)}let n=r.ontologies.reduce((i,s)=>i+s.unresolvedImports.length,0);t(`
@@ -699,7 +699,7 @@ Next steps:
699
699
  `).map(n=>n.trim()).filter(n=>n.length>0),t=e[e.length-1];if(t!==void 0)try{return JSON.parse(t)}catch{return}}a(gwe,"parseLastJsonLine");function lG(r,e){return e.filter(t=>{let n=r[t];return typeof n!="string"||n.trim().length===0})}a(lG,"missingStringFields");var $E=class{constructor(e){this.deps=e}static{a(this,"McpServer")}async handle(e){if(typeof e!="object"||e===null||Array.isArray(e))return{jsonrpc:"2.0",id:null,error:{code:cG,message:"Invalid request: expected a JSON-RPC object"}};let t=e.id,n=t===void 0;if(typeof e.method!="string")return n?null:{jsonrpc:"2.0",id:t??null,error:{code:cG,message:"Invalid request: missing method"}};if(n)return null;let i=t??null;switch(e.method){case"initialize":return{jsonrpc:"2.0",id:i,result:{protocolVersion:hwe,capabilities:{tools:{}},serverInfo:{name:"exocortex",version:this.deps.version}}};case"ping":return{jsonrpc:"2.0",id:i,result:{}};case"tools/list":return{jsonrpc:"2.0",id:i,result:{tools:aG}};case"tools/call":return{jsonrpc:"2.0",id:i,result:await this.callTool(e.params??{})};default:return{jsonrpc:"2.0",id:i,error:{code:mwe,message:`Method not found: ${e.method}`}}}}async callTool(e){let t=e.name,n=e.arguments??{},i;if(t==="create_asset"){let c=lG(n,["vault","class","label"]);if(c.length>0)return Ep(`create_asset: missing required argument(s): ${c.join(", ")}`,!0);let l=iG(n);if(l!==null)return Ep(`create_asset: ${l}`,!0);i=sG(n)}else if(t==="create_effort"){let c=lG(n,["vault","command","target"]);if(c.length>0)return Ep(`create_effort: missing required argument(s): ${c.join(", ")}`,!0);i=oG(n)}else return Ep(`Unknown tool: ${String(t)}`,!0);let s=await this.deps.runCli(i);if(s.exitCode!==0){let c=s.stderr.trim()||s.stdout.trim()||"(no diagnostic output)";return Ep(`exocortex-cli exited ${s.exitCode}
700
700
  ${c}`,!0)}let o=gwe(s.stdout);return Ep(o===void 0?s.stdout.trim():JSON.stringify(o))}};var dG=require("child_process");var ywe=32*1024*1024;function pG(r){return e=>new Promise(t=>{(0,dG.execFile)(process.execPath,[r,...e],{maxBuffer:ywe},(n,i,s)=>{let o=0;if(n){let c=n.code;o=typeof c=="number"?c:1}t({stdout:i,stderr:s,exitCode:o})})})}a(pG,"createSelfCliRunner");async function bwe(r,e,t){let n=(0,hG.createInterface)({input:e,crlfDelay:1/0});for await(let i of n){let s=i.trim();if(s.length===0)continue;let o;try{o=JSON.parse(s)}catch{t(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:uG,message:"Parse error: invalid JSON"}})+`
701
701
  `);continue}let c;try{c=await r.handle(o)}catch(l){c={jsonrpc:"2.0",id:typeof o?.id=="string"||typeof o?.id=="number"?o.id:null,error:{code:fG,message:`Internal error: ${l instanceof Error?l.message:String(l)}`}}}c!==null&&t(JSON.stringify(c)+`
702
- `)}}a(bwe,"runStdioServer");function mG(r){return new pe("mcp").description("Run an MCP (Model Context Protocol) stdio server exposing create_asset / create_effort tools backed by this CLI").option("--entry <path>","Path to the CLI entry script the tools invoke (defaults to this process's script)").action(async e=>{let t=e.entry??process.argv[1],n=new $E({runCli:pG(t),version:r??"unknown"});await bwe(n,process.stdin,i=>process.stdout.write(i))})}a(mG,"mcpCommand");function UE(r){let e=new pe;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(r??"16.255.9"),e.addCommand(Y7()),e.addCommand(sV()),e.addCommand(P8()),e.addCommand(L8()),e.addCommand(t7()),e.addCommand(N8()),e.addCommand(U8()),e.addCommand(B8()),e.addCommand(l7()),e.addCommand(h7()),e.addCommand(D7()),e.addCommand(j7()),e.addCommand(V7()),e.addCommand(G7()),e.addCommand(W7()),e.addCommand(z7()),e.addCommand(CV()),e.addCommand(OV()),e.addCommand(zV()),e.addCommand(KV()),e.addCommand(QV()),e.addCommand(JV()),e.addCommand(tG()),e.addCommand(MV()),e.addCommand(GV()),e.addCommand(rG()),e.addCommand(mG(r??"16.255.9")),e}a(UE,"createProgram");UE().parse();0&&(module.exports={createProgram});
702
+ `)}}a(bwe,"runStdioServer");function mG(r){return new pe("mcp").description("Run an MCP (Model Context Protocol) stdio server exposing create_asset / create_effort tools backed by this CLI").option("--entry <path>","Path to the CLI entry script the tools invoke (defaults to this process's script)").action(async e=>{let t=e.entry??process.argv[1],n=new $E({runCli:pG(t),version:r??"unknown"});await bwe(n,process.stdin,i=>process.stdout.write(i))})}a(mG,"mcpCommand");function UE(r){let e=new pe;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(r??"16.255.11"),e.addCommand(Y7()),e.addCommand(sV()),e.addCommand(P8()),e.addCommand(L8()),e.addCommand(t7()),e.addCommand(N8()),e.addCommand(U8()),e.addCommand(B8()),e.addCommand(l7()),e.addCommand(h7()),e.addCommand(D7()),e.addCommand(j7()),e.addCommand(V7()),e.addCommand(G7()),e.addCommand(W7()),e.addCommand(z7()),e.addCommand(CV()),e.addCommand(OV()),e.addCommand(zV()),e.addCommand(KV()),e.addCommand(QV()),e.addCommand(JV()),e.addCommand(tG()),e.addCommand(MV()),e.addCommand(GV()),e.addCommand(rG()),e.addCommand(mG(r??"16.255.11")),e}a(UE,"createProgram");UE().parse();0&&(module.exports={createProgram});
703
703
  /*! Bundled license information:
704
704
 
705
705
  reflect-metadata/Reflect.js: