@kitelev/exocortex-cli 15.125.0 → 15.125.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v15.125.
|
|
2
|
+
// @kitelev/exocortex-cli v15.125.1
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -67,7 +67,7 @@ ${r}}`}default:throw new Wc(`Unsupported operation type for SPARQL generation: $
|
|
|
67
67
|
`)}generateTriple(e){let t=this.generateElement(e.subject),r=this.generatePredicate(e.predicate),i=this.generateElement(e.object);return`${t} ${r} ${i}`}generatePredicate(e){return"pathType"in e?this.generatePropertyPath(e):this.generateElement(e)}generatePropertyPath(e){let t=e.items.map(r=>"pathType"in r?`(${this.generatePropertyPath(r)})`:`<${r.value}>`);switch(e.pathType){case"/":return t.join("/");case"|":return t.join("|");case"^":return`^${t[0]}`;case"+":return`${t[0]}+`;case"*":return`${t[0]}*`;case"?":return`${t[0]}?`}}generateElement(e){switch(e.type){case"variable":return`?${e.value}`;case"iri":return`<${e.value}>`;case"literal":{let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}case"blank":return`_:${e.value}`;default:throw new Wc(`Unknown element type: ${e.type}`)}}generateValues(e,t){let r=" ".repeat(t);if(e.variables.length===0||e.bindings.length===0)return"";if(e.variables.length===1){let a=e.variables[0],c=e.bindings.map(l=>{let u=l[a];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ");return`${r}VALUES ?${a} { ${c} }`}let i=e.variables.map(a=>`?${a}`).join(" "),s=e.bindings.map(a=>`(${e.variables.map(l=>{let u=a[l];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ")})`);return`${r}VALUES (${i}) {
|
|
68
68
|
${s.map(a=>`${r} ${a}`).join(`
|
|
69
69
|
`)}
|
|
70
|
-
${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}generateExpression(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:typeof e.value=="boolean"?e.value?"true":"false":String(e.value);case"comparison":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"logical":return e.operator==="!"?`!(${this.generateExpression(e.operands[0])})`:`(${e.operands.map(t=>this.generateExpression(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"function":return`${e.function.toUpperCase()}(${e.args.map(t=>this.generateExpression(t)).join(", ")})`;case"functionCall":return`${(typeof e.function=="string"?e.function:e.function.value).toUpperCase()}(${e.args.map(r=>this.generateExpression(r)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),r=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${r})`:`${t} IN (${r})`}default:throw new Wc(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let r of e.triples)this.collectVariablesFromTriple(r,t);break;case"filter":this.collectVariablesFromOperation(e.input,t),this.collectVariablesFromExpression(e.expression,t);break;case"join":case"leftjoin":case"union":case"minus":this.collectVariablesFromOperation(e.left,t),this.collectVariablesFromOperation(e.right,t);break;case"values":for(let r of e.variables)t.add(r);break;case"project":for(let r of e.variables)t.add(r);this.collectVariablesFromOperation(e.input,t);break;case"extend":t.add(e.variable),this.collectVariablesFromOperation(e.input,t);break;case"orderby":case"slice":case"distinct":case"reduced":this.collectVariablesFromOperation(e.input,t);break;case"group":for(let r of e.variables)t.add(r);for(let r of e.aggregates)t.add(r.variable);this.collectVariablesFromOperation(e.input,t);break;case"subquery":this.collectVariablesFromOperation(e.query,t);break}}collectVariablesFromTriple(e,t){e.subject.type==="variable"&&t.add(e.subject.value),"type"in e.predicate&&e.predicate.type==="variable"&&t.add(e.predicate.value),e.object.type==="variable"&&t.add(e.object.value)}collectVariablesFromExpression(e,t){switch(e.type){case"variable":t.add(e.name);break;case"comparison":case"arithmetic":this.collectVariablesFromExpression(e.left,t),this.collectVariablesFromExpression(e.right,t);break;case"logical":for(let r of e.operands)this.collectVariablesFromExpression(r,t);break;case"function":case"functionCall":for(let r of e.args)this.collectVariablesFromExpression(r,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let r of e.list)this.collectVariablesFromExpression(r,t);break}}};Gc.SPARQLGenerator=y1});var $u=S(wn=>{"use strict";var mj=wn&&wn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),gj=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),N3=wn&&wn.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&mj(t,e,r[i]);return gj(t,e),t}})();Object.defineProperty(wn,"__esModule",{value:!0});wn.QueryExecutor=wn.ExoQLQueryExecutor=wn.QueryExecutorError=void 0;var yj=V_(),_j=pp(),Sj=r1(),bj=i1(),vj=E3(),wj=A3(),Ej=I3(),Tj=p1(),Aj=O3(),xj=F3(),Cj=D3(),Ij=xe(),zc=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};wn.QueryExecutorError=zc;var Ep=class{static{o(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new yj.BGPExecutor(e),this.filterExecutor=new _j.FilterExecutor,this.optionalExecutor=new Sj.OptionalExecutor,this.unionExecutor=new bj.UnionExecutor,this.minusExecutor=new vj.MinusExecutor,this.valuesExecutor=new wj.ValuesExecutor,this.aggregateExecutor=new Ej.AggregateExecutor,this.constructExecutor=new Tj.ConstructExecutor,this.serviceExecutor=new Aj.ServiceExecutor(t.serviceConfig),this.graphExecutor=new xj.GraphExecutor(e),this.sparqlGenerator=new Cj.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(r,i)=>this.evaluateExistsPattern(r,i)),this.filterExecutor.setTripleStore(e)}async evaluateExistsPattern(e,t){for await(let r of this.execute(e))if(t.merge(r)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*execute(e){switch(e.type){case"bgp":yield*this.executeBGP(e);break;case"filter":yield*this.executeFilter(e);break;case"join":yield*this.executeJoin(e);break;case"leftjoin":yield*this.executeLeftJoin(e);break;case"union":yield*this.executeUnion(e);break;case"minus":yield*this.executeMinus(e);break;case"values":yield*this.executeValues(e);break;case"project":yield*this.executeProject(e);break;case"orderby":yield*this.executeOrderBy(e);break;case"slice":yield*this.executeSlice(e);break;case"distinct":yield*this.executeDistinct(e);break;case"reduced":yield*this.executeReduced(e);break;case"group":yield*this.executeGroup(e);break;case"extend":yield*this.executeExtend(e);break;case"subquery":yield*this.executeSubquery(e);break;case"lateraljoin":yield*this.executeLateralJoin(e);break;case"service":yield*this.executeService(e);break;case"graph":yield*this.executeGraph(e);break;default:throw new zc(`Unknown operation type: ${e.type}`)}}async*executeBGP(e){yield*this.bgpExecutor.execute(e)}async*executeFilter(e){let t=this.execute(e.input);yield*this.filterExecutor.execute(e,t)}async*executeJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);if(t.length===0)return;let r=new Set;for(let a of t)for(let c of a.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(a=>i.has(a)))for(let a of t){let c=this.substituteVariables(e.right,a);for await(let l of this.execute(c)){let u=a.merge(l);u!==null&&(yield u)}}else{let a=[];for await(let c of this.execute(e.right))a.push(c);for(let c of t)for(let l of a){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){let{SolutionMapping:t}=await Promise.resolve().then(()=>N3(es())),r=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let a of i.variables())if(r.has(a)){let c=i.get(a);c!==void 0&&s.set(a,c)}yield s}}async*executeOrderBy(e){let t=[];for await(let r of this.execute(e.input))t.push(r);t.sort((r,i)=>{for(let s of e.comparators){let a=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(a===void 0&&c===void 0?l=0:a===void 0?l=1:c===void 0?l=-1:typeof a=="number"&&typeof c=="number"?l=a-c:l=String(a).localeCompare(String(c)),s.descending&&(l=-l),l!==0)return l}return 0});for(let r of t)yield r}async*executeSlice(e){let t=0,r=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=r){if(i!==void 0&&t-r>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeReduced(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let r=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of r)e.having.every(a=>this.filterExecutor.evaluateExpression(a,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let r of this.execute(e.input)){let i=r.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,r):this.evaluateExtendExpression(e.expression,r);s!==void 0&&i.set(e.variable,s),yield i}}async*executeSubquery(e){yield*this.execute(e.query)}async*executeLateralJoin(e){let t=[];for await(let r of this.execute(e.left))t.push(r);for(let r of t){let i=this.substituteVariables(e.right,r);for await(let s of this.execute(i)){let a=r.merge(s);a!==null&&(yield a)}}}substituteVariables(e,t){let r=JSON.parse(JSON.stringify(e));return this.substituteInOperation(r,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let r=e;return e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(r.input&&(r.input=this.substituteInOperation(r.input,t)),r.left&&(r.left=this.substituteInOperation(r.left,t)),r.right&&(r.right=this.substituteInOperation(r.right,t)),r.pattern&&(r.pattern=this.substituteInOperation(r.pattern,t)),r.query&&(r.query=this.substituteInOperation(r.query,t)),r.where&&(r.where=this.substituteInOperation(r.where,t)),r.expression&&this.substituteInExpression(r.expression,t),e)}substituteInExpression(e,t){if(!(!e||typeof e!="object")){if(e.type==="exists"&&e.pattern&&(e.pattern=this.substituteInOperation(e.pattern,t)),e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let r of e.operands)this.substituteInExpression(r,t);if(e.args)for(let r of e.args)this.substituteInExpression(r,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let r of e.list)this.substituteInExpression(r,t)}}substituteInTriple(e,t){return{subject:this.substituteInTripleElement(e.subject,t),predicate:e.predicate,object:this.substituteInTripleElement(e.object,t)}}substituteInTripleElement(e,t){if(e&&e.type==="variable"){let r=t.get(e.value);if(r!=null){let i=r;if(r instanceof Ij.IRI||i.termType==="NamedNode")return{type:"iri",value:r.value};if(i.termType==="Literal"||typeof i.value=="string")return{type:"literal",value:i.value,datatype:i.datatype?.value??i._datatype?.value,language:i.language??i._language}}}return e}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(r,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{r.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(r,i):yield*this.execute(r)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:r}=await Promise.resolve().then(()=>N3(es()));yield new r;return}yield*this.bgpExecutor.executeInGraph(e,t)}evaluateExtendExpression(e,t){if(e.type!=="aggregate")try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}async evaluateExtendExpressionAsync(e,t){if(e.type!=="aggregate")try{return await this.filterExecutor.evaluateExpressionAsync(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);return r?r.value??r.id??String(r):void 0}if(e.type==="literal")return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="bgp"&&r.triples)for(let i of r.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(r.type==="values"&&r.variables)for(let i of r.variables)t.add(i);r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.type==="extend"&&r.variable&&t.add(r.variable),r.input&&this.collectVarsFromOperation(r.input,t),r.left&&this.collectVarsFromOperation(r.left,t),r.right&&this.collectVarsFromOperation(r.right,t),r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.query&&this.collectVarsFromOperation(r.query,t),r.where&&this.collectVarsFromOperation(r.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let r=e;r.type==="variable"&&t.add(r.value),r.type==="quoted"&&(this.collectVarsFromElement(r.subject,t),this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="variable"&&r.name&&t.add(r.name),r.type==="exists"&&r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.left&&this.collectVarsFromExpressionTree(r.left,t),r.right&&this.collectVarsFromExpressionTree(r.right,t),r.operands)for(let i of r.operands)this.collectVarsFromExpressionTree(i,t);if(r.args)for(let i of r.args)this.collectVarsFromExpressionTree(i,t);if(r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.list)for(let i of r.list)this.collectVarsFromExpressionTree(i,t)}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}isConstructQuery(e){return e.type==="construct"}async executeConstruct(e){if(e.type!=="construct")throw new zc("executeConstruct requires a CONSTRUCT operation");let t=await this.executeAll(e.where);return this.constructExecutor.execute(e.template,t)}isAskQuery(e){return e.type==="ask"}async executeAsk(e){if(e.type!=="ask")throw new zc("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};wn.ExoQLQueryExecutor=Ep;wn.QueryExecutor=Ep});var L3=S(js=>{"use strict";var Rj=js&&js.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Oj=js&&js.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(js,"__esModule",{value:!0});js.CommandResolver=void 0;var Pj=ce(),Ms=xe(),oi=He(),we=Cr(),_1=dc(),Fj=Fu(),Dj=Du(),Nj=$u(),S1=10,b1=class{static{o(this,"CommandResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async resolveForAsset(e,t,r){let i=`${e}:${t}:${r??""}`,s=this.cache.get(i);if(s)return s;let a=await this.findBindings(t,r,e),c=[];for(let l of a){let u=await this.loadCommand(l.commandRef);if(!u)continue;let f=l.precondition?{...u,precondition:l.precondition}:u;c.push({command:f,binding:l})}return c.sort((l,u)=>{let f=this.getBindingPriority(l.binding),d=this.getBindingPriority(u.binding);return f!==d?f-d:(l.binding.order??100)-(u.binding.order??100)}),this.cache.set(i,c),c}async loadCommand(e){let t=await this.findSubjectByUID(e);if(!t||(await this.tripleStore.match(t,we.Namespace.RDF.term("type"),we.Namespace.EXOCMD.term("Command"))).length===0)return null;let i=await this.getLiteralValue(t,we.Namespace.EXO.term("Asset_label"))??"Unknown Command",s=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_labelTemplate")),a=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_icon")),c=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_confirmMessage")),l=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_successMessage")),u=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_category")),f=await this.loadLinkedPrecondition(t),d=await this.loadLinkedGrounding(t,0);return d?{id:e,name:i,labelTemplate:s??void 0,icon:a??void 0,precondition:f??void 0,grounding:d,confirmMessage:c??void 0,successMessage:l??void 0,category:u??void 0}:null}async findBindings(e,t,r){let i=await this.tripleStore.match(void 0,we.Namespace.RDF.term("type"),we.Namespace.EXOCMD.term("CommandBinding")),s=[];for(let a of i){let c=a.subject,l=await this.loadBindingDefinition(c);l&&this.bindingMatches(l,e,t,r)&&s.push(l)}return s}invalidateCache(){this.cache.clear()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let r=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:a}of i){let c=await this.evaluateSelectSnippet(a,t);r=r.replace(s,c)}return r}extractPlaceholders(e){let t=[],r=0;for(;r<e.length;)if(e[r]==="{"){let i=1,s=r+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let a=e.slice(r,s),c=e.slice(r+1,s-1);t.push({full:a,body:c})}r=s}else r++;return t}async evaluateSelectSnippet(e,t){try{let r=e.replace(/\$target/g,`<${t}>`),s=new Fj.ExoQLParser().parse(r),c=new Dj.ExoQLAlgebraTranslator().translate(s),u=await new Nj.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let h=f.get(d[0]);return h?h instanceof oi.Literal||h instanceof Ms.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,we.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetClass")),a=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!a&&!c)return null;let l=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_group")),d=await this.loadLinkedPreconditionFromProperty(e,we.Namespace.EXOCMD.term("CommandBinding_precondition"));return{id:t,label:r,commandRef:i,targetClass:s??void 0,targetPrototype:a??void 0,targetAsset:c??void 0,position:l??void 0,order:u?parseInt(u,10):void 0,group:f??void 0,precondition:d??void 0}}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let a=this.extractPathBasename(r);if(a&&a===i)return!0;let c=this.extractAlias(t);if(c&&r===c)return!0;let l=this.extractAlias(e);return!!(l&&l===i)}extractPathBasename(e){let t=e.match(/\/([^/]+)\.md$/);return t?t[1]:null}extractAlias(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(r+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,we.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Ms.IRI)s=i;else if(i instanceof oi.Literal){let f=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(f)}if(!s)return null;let a=await this.getLiteralValue(s,we.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,we.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,we.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,we.Namespace.EXOCMD.term("Precondition_hostFunction"));return!a||!l&&!u?null:{id:a,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u}}}async loadLinkedGrounding(e,t){if(t>=S1)return null;let r=await this.tripleStore.match(e,we.Namespace.EXOCMD.term("Command_grounding"),void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Ms.IRI)s=i;else if(i instanceof oi.Literal){let a=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(a)}return s?this.loadGroundingDefinition(s,t):null}async loadGroundingDefinition(e,t){if(t>=S1)return null;let r=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_label"))??"",s=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_type"));if(!s)return null;let a=this.resolveGroundingType(s);if(!a)return null;let c=await this.getObsidianName(e,we.Namespace.EXOCMD.term("Grounding_targetProperty"));if(a===_1.GroundingType.SERVICE_CALL){let v=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_serviceId"));v&&(c=v)}let l=await this.getObsidianWikilinkValue(e,we.Namespace.EXOCMD.term("Grounding_targetValue")),u=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),f=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetClass")),d=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetPrototype")),h=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetFolder")),p=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_inputSchema")),_;a===_1.GroundingType.COMPOSITE&&(_=await this.loadCompositeSteps(e,t+1));let b;if(p)try{let v=JSON.parse(p);v?.properties&&(b=Object.entries(v.properties).map(([A,R])=>({name:A,type:R.type==="string"?"text":R.type,label:R.title??A,required:Array.isArray(v.required)&&v.required.includes(A)})))}catch{}let E={id:r,label:i,type:a,targetProperty:c??void 0,targetValue:l??void 0,sparqlUpdate:u??void 0,steps:_,targetClass:f??void 0,targetPrototype:d??void 0,targetFolder:h??void 0};return b&&(E.inputSchema=b),E}async loadCompositeSteps(e,t){if(t>=S1)return[];let r=await this.tripleStore.match(e,we.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let a=null;if(s.object instanceof Ms.IRI)a=s.object;else if(s.object instanceof oi.Literal){let l=this.normalizeWikilink(s.object.value);a=await this.findSubjectByUID(l)}if(!a)continue;let c=await this.loadGroundingDefinition(a,t);c&&i.push(c)}return i}resolveGroundingType(e){let t=e.toLowerCase().trim();return Object.values(_1.GroundingType).includes(t)?t:null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let r=await this.tripleStore.findSubjectsByUUID(e);if(r.length>0)return r[0]}let t=await this.tripleStore.match(void 0,we.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof oi.Literal&&r.object.value===e)return r.subject;return null}async getLiteralValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof oi.Literal||i instanceof Ms.IRI?i.value:null}async getLinkedUID(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Ms.IRI){let s=await this.tripleStore.match(i,we.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof oi.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof oi.Literal?this.normalizeWikilink(i.value):null}async getLinkedValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof oi.Literal?this.normalizeWikilink(i.value):i instanceof Ms.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof oi.Literal?i.value:i instanceof Ms.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianWikilinkValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof oi.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof Ms.IRI){let s=this.iriToObsidianName(i.value);return s?`"[[${s}]]"`:i.value}return null}async resolveWikilinkAlias(e){let t=e.match(/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\]/);if(!t)return e;let r=t[1],i=await this.findSubjectByUID(r);if(!i)return e;let s=await this.getLiteralValue(i,we.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${r}]]`,`[[${r}|${s}]]`):e}iriToObsidianName(e){let t=e.lastIndexOf("#");if(t>=0){let i=e.substring(0,t+1),s=e.substring(t+1);if(i===we.Namespace.EMS.iri.value)return`ems__${s}`;if(i===we.Namespace.EXO.iri.value)return`exo__${s}`;if(i===we.Namespace.EXOCMD.iri.value)return`exocmd__${s}`;if(i===we.Namespace.IMS.iri.value)return`ims__${s}`;if(i===we.Namespace.ZTLK.iri.value)return`ztlk__${s}`;if(i===we.Namespace.PTMS.iri.value)return`ptms__${s}`;if(i===we.Namespace.LIT.iri.value)return`lit__${s}`;if(i===we.Namespace.INBOX.iri.value)return`inbox__${s}`}let r=e.match(/\/([^/]+)\.md$/);return r?r[1]:null}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(0,r):t}};js.CommandResolver=b1;js.CommandResolver=b1=Rj([(0,Pj.injectable)(),Oj("design:paramtypes",[Object])],b1)});var M3=S($s=>{"use strict";var Lj=$s&&$s.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},kj=$s&&$s.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Bu;Object.defineProperty($s,"__esModule",{value:!0});$s.PreconditionEvaluator=void 0;var Mj=ce(),jj=Fu(),$j=Du(),k3=$u(),Vu=Bu=class{static{o(this,"PreconditionEvaluator")}constructor(e){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Bu.SENTINEL_IRI),i=new jj.ExoQLParser().parse(t),a=new $j.ExoQLAlgebraTranslator().translate(i);return new k3.ExoQLQueryExecutor(this.tripleStore).isAskQuery(a)?a:null}evaluateHostFunction(e,t,r){let i=this.hostFunctions.get(e);if(!i)return!0;let s=r?{...r,targetIRI:t}:{targetIRI:t};return i(s)}async evaluateSparqlAsk(e,t){try{let r=this.askCache.get(e);if(r===void 0){let a=this.compileAsk(e);if(!a)return!1;r=a,this.askCache.set(e,r)}let i=JSON.parse(JSON.stringify(r).replaceAll(Bu.SENTINEL_IRI,t));return await new k3.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=new Date().toISOString(),i=r.slice(0,10),s=new Date,a=new Date(s.getTime()+Bu.ALMATY_OFFSET_MS),c=a.getUTCFullYear(),l=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCDay(),h=new Date(Date.UTC(c,l,u-1)).toISOString().slice(0,10),p=(f+6)%7,_=new Date(Date.UTC(c,l,u-p)),b=_.toISOString().slice(0,10),v=new Date(_.getTime()-10080*60*1e3).toISOString().slice(0,10),A=`${c}-${String(l+1).padStart(2,"0")}-01`,R=l===0?11:l-1,W=`${l===0?c-1:c}-${String(R+1).padStart(2,"0")}-01`,ve=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${r}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${b}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${v}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${A}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${W}"^^xsd:date`).replace(/\$thisYearStart/g,`"${ve}"^^xsd:date`).replace(/\$today/g,`"${i}"^^xsd:date`)}};$s.PreconditionEvaluator=Vu;Vu.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";Vu.ALMATY_OFFSET_MS=300*60*1e3;$s.PreconditionEvaluator=Vu=Bu=Lj([(0,Mj.injectable)(),kj("design:paramtypes",[Object])],Vu)});var qn=S(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.FrontmatterService=void 0;var Uu=class n{static{o(this,"FrontmatterService")}parse(e){let t=e.match(n.FRONTMATTER_REGEX);return t?{exists:!0,content:t[1],originalContent:e}:{exists:!1,content:"",originalContent:e}}updateProperty(e,t,r){t=n.normalizeIRI(t),typeof r=="string"&&(r=n.normalizeIRIValue(r));let i=this.parse(e),s=this.serializeValue(t,r);if(!i.exists)return`---
|
|
70
|
+
${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}generateExpression(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:typeof e.value=="boolean"?e.value?"true":"false":String(e.value);case"comparison":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"logical":return e.operator==="!"?`!(${this.generateExpression(e.operands[0])})`:`(${e.operands.map(t=>this.generateExpression(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"function":return`${e.function.toUpperCase()}(${e.args.map(t=>this.generateExpression(t)).join(", ")})`;case"functionCall":return`${(typeof e.function=="string"?e.function:e.function.value).toUpperCase()}(${e.args.map(r=>this.generateExpression(r)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),r=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${r})`:`${t} IN (${r})`}default:throw new Wc(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let r of e.triples)this.collectVariablesFromTriple(r,t);break;case"filter":this.collectVariablesFromOperation(e.input,t),this.collectVariablesFromExpression(e.expression,t);break;case"join":case"leftjoin":case"union":case"minus":this.collectVariablesFromOperation(e.left,t),this.collectVariablesFromOperation(e.right,t);break;case"values":for(let r of e.variables)t.add(r);break;case"project":for(let r of e.variables)t.add(r);this.collectVariablesFromOperation(e.input,t);break;case"extend":t.add(e.variable),this.collectVariablesFromOperation(e.input,t);break;case"orderby":case"slice":case"distinct":case"reduced":this.collectVariablesFromOperation(e.input,t);break;case"group":for(let r of e.variables)t.add(r);for(let r of e.aggregates)t.add(r.variable);this.collectVariablesFromOperation(e.input,t);break;case"subquery":this.collectVariablesFromOperation(e.query,t);break}}collectVariablesFromTriple(e,t){e.subject.type==="variable"&&t.add(e.subject.value),"type"in e.predicate&&e.predicate.type==="variable"&&t.add(e.predicate.value),e.object.type==="variable"&&t.add(e.object.value)}collectVariablesFromExpression(e,t){switch(e.type){case"variable":t.add(e.name);break;case"comparison":case"arithmetic":this.collectVariablesFromExpression(e.left,t),this.collectVariablesFromExpression(e.right,t);break;case"logical":for(let r of e.operands)this.collectVariablesFromExpression(r,t);break;case"function":case"functionCall":for(let r of e.args)this.collectVariablesFromExpression(r,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let r of e.list)this.collectVariablesFromExpression(r,t);break}}};Gc.SPARQLGenerator=y1});var $u=S(wn=>{"use strict";var mj=wn&&wn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),gj=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),N3=wn&&wn.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&mj(t,e,r[i]);return gj(t,e),t}})();Object.defineProperty(wn,"__esModule",{value:!0});wn.QueryExecutor=wn.ExoQLQueryExecutor=wn.QueryExecutorError=void 0;var yj=V_(),_j=pp(),Sj=r1(),bj=i1(),vj=E3(),wj=A3(),Ej=I3(),Tj=p1(),Aj=O3(),xj=F3(),Cj=D3(),Ij=xe(),zc=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};wn.QueryExecutorError=zc;var Ep=class{static{o(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new yj.BGPExecutor(e),this.filterExecutor=new _j.FilterExecutor,this.optionalExecutor=new Sj.OptionalExecutor,this.unionExecutor=new bj.UnionExecutor,this.minusExecutor=new vj.MinusExecutor,this.valuesExecutor=new wj.ValuesExecutor,this.aggregateExecutor=new Ej.AggregateExecutor,this.constructExecutor=new Tj.ConstructExecutor,this.serviceExecutor=new Aj.ServiceExecutor(t.serviceConfig),this.graphExecutor=new xj.GraphExecutor(e),this.sparqlGenerator=new Cj.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(r,i)=>this.evaluateExistsPattern(r,i)),this.filterExecutor.setTripleStore(e)}async evaluateExistsPattern(e,t){for await(let r of this.execute(e))if(t.merge(r)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*execute(e){switch(e.type){case"bgp":yield*this.executeBGP(e);break;case"filter":yield*this.executeFilter(e);break;case"join":yield*this.executeJoin(e);break;case"leftjoin":yield*this.executeLeftJoin(e);break;case"union":yield*this.executeUnion(e);break;case"minus":yield*this.executeMinus(e);break;case"values":yield*this.executeValues(e);break;case"project":yield*this.executeProject(e);break;case"orderby":yield*this.executeOrderBy(e);break;case"slice":yield*this.executeSlice(e);break;case"distinct":yield*this.executeDistinct(e);break;case"reduced":yield*this.executeReduced(e);break;case"group":yield*this.executeGroup(e);break;case"extend":yield*this.executeExtend(e);break;case"subquery":yield*this.executeSubquery(e);break;case"lateraljoin":yield*this.executeLateralJoin(e);break;case"service":yield*this.executeService(e);break;case"graph":yield*this.executeGraph(e);break;default:throw new zc(`Unknown operation type: ${e.type}`)}}async*executeBGP(e){yield*this.bgpExecutor.execute(e)}async*executeFilter(e){let t=this.execute(e.input);yield*this.filterExecutor.execute(e,t)}async*executeJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);if(t.length===0)return;let r=new Set;for(let a of t)for(let c of a.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(a=>i.has(a)))for(let a of t){let c=this.substituteVariables(e.right,a);for await(let l of this.execute(c)){let u=a.merge(l);u!==null&&(yield u)}}else{let a=[];for await(let c of this.execute(e.right))a.push(c);for(let c of t)for(let l of a){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){let{SolutionMapping:t}=await Promise.resolve().then(()=>N3(es())),r=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let a of i.variables())if(r.has(a)){let c=i.get(a);c!==void 0&&s.set(a,c)}yield s}}async*executeOrderBy(e){let t=[];for await(let r of this.execute(e.input))t.push(r);t.sort((r,i)=>{for(let s of e.comparators){let a=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(a===void 0&&c===void 0?l=0:a===void 0?l=1:c===void 0?l=-1:typeof a=="number"&&typeof c=="number"?l=a-c:l=String(a).localeCompare(String(c)),s.descending&&(l=-l),l!==0)return l}return 0});for(let r of t)yield r}async*executeSlice(e){let t=0,r=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=r){if(i!==void 0&&t-r>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeReduced(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let r=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of r)e.having.every(a=>this.filterExecutor.evaluateExpression(a,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let r of this.execute(e.input)){let i=r.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,r):this.evaluateExtendExpression(e.expression,r);s!==void 0&&i.set(e.variable,s),yield i}}async*executeSubquery(e){yield*this.execute(e.query)}async*executeLateralJoin(e){let t=[];for await(let r of this.execute(e.left))t.push(r);for(let r of t){let i=this.substituteVariables(e.right,r);for await(let s of this.execute(i)){let a=r.merge(s);a!==null&&(yield a)}}}substituteVariables(e,t){let r=JSON.parse(JSON.stringify(e));return this.substituteInOperation(r,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let r=e;return e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(r.input&&(r.input=this.substituteInOperation(r.input,t)),r.left&&(r.left=this.substituteInOperation(r.left,t)),r.right&&(r.right=this.substituteInOperation(r.right,t)),r.pattern&&(r.pattern=this.substituteInOperation(r.pattern,t)),r.query&&(r.query=this.substituteInOperation(r.query,t)),r.where&&(r.where=this.substituteInOperation(r.where,t)),r.expression&&this.substituteInExpression(r.expression,t),e)}substituteInExpression(e,t){if(!(!e||typeof e!="object")){if(e.type==="exists"&&e.pattern&&(e.pattern=this.substituteInOperation(e.pattern,t)),e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let r of e.operands)this.substituteInExpression(r,t);if(e.args)for(let r of e.args)this.substituteInExpression(r,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let r of e.list)this.substituteInExpression(r,t)}}substituteInTriple(e,t){return{subject:this.substituteInTripleElement(e.subject,t),predicate:e.predicate,object:this.substituteInTripleElement(e.object,t)}}substituteInTripleElement(e,t){if(e&&e.type==="variable"){let r=t.get(e.value);if(r!=null){let i=r;if(r instanceof Ij.IRI||i.termType==="NamedNode")return{type:"iri",value:r.value};if(i.termType==="Literal"||typeof i.value=="string")return{type:"literal",value:i.value,datatype:i.datatype?.value??i._datatype?.value,language:i.language??i._language}}}return e}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(r,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{r.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(r,i):yield*this.execute(r)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:r}=await Promise.resolve().then(()=>N3(es()));yield new r;return}yield*this.bgpExecutor.executeInGraph(e,t)}evaluateExtendExpression(e,t){if(e.type!=="aggregate")try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}async evaluateExtendExpressionAsync(e,t){if(e.type!=="aggregate")try{return await this.filterExecutor.evaluateExpressionAsync(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);return r?r.value??r.id??String(r):void 0}if(e.type==="literal")return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="bgp"&&r.triples)for(let i of r.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(r.type==="values"&&r.variables)for(let i of r.variables)t.add(i);r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.type==="extend"&&r.variable&&t.add(r.variable),r.input&&this.collectVarsFromOperation(r.input,t),r.left&&this.collectVarsFromOperation(r.left,t),r.right&&this.collectVarsFromOperation(r.right,t),r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.query&&this.collectVarsFromOperation(r.query,t),r.where&&this.collectVarsFromOperation(r.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let r=e;r.type==="variable"&&t.add(r.value),r.type==="quoted"&&(this.collectVarsFromElement(r.subject,t),this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="variable"&&r.name&&t.add(r.name),r.type==="exists"&&r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.left&&this.collectVarsFromExpressionTree(r.left,t),r.right&&this.collectVarsFromExpressionTree(r.right,t),r.operands)for(let i of r.operands)this.collectVarsFromExpressionTree(i,t);if(r.args)for(let i of r.args)this.collectVarsFromExpressionTree(i,t);if(r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.list)for(let i of r.list)this.collectVarsFromExpressionTree(i,t)}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}isConstructQuery(e){return e.type==="construct"}async executeConstruct(e){if(e.type!=="construct")throw new zc("executeConstruct requires a CONSTRUCT operation");let t=await this.executeAll(e.where);return this.constructExecutor.execute(e.template,t)}isAskQuery(e){return e.type==="ask"}async executeAsk(e){if(e.type!=="ask")throw new zc("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};wn.ExoQLQueryExecutor=Ep;wn.QueryExecutor=Ep});var L3=S(js=>{"use strict";var Rj=js&&js.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Oj=js&&js.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(js,"__esModule",{value:!0});js.CommandResolver=void 0;var Pj=ce(),Ms=xe(),oi=He(),we=Cr(),_1=dc(),Fj=Fu(),Dj=Du(),Nj=$u(),S1=10,b1=class{static{o(this,"CommandResolver")}constructor(e){this.tripleStore=e,this.cache=new Map,this.multiCache=new Map}async resolveForAssetMulti(e,t,r){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${r??""}`,a=this.multiCache.get(s);if(a)return a;let c=new Set,l=[];for(let u of t){let f=await this.resolveForAsset(e,u,r);for(let d of f)c.has(d.binding.id)||(c.add(d.binding.id),l.push(d))}return l.sort((u,f)=>{let d=this.getBindingPriority(u.binding),h=this.getBindingPriority(f.binding);return d!==h?d-h:(u.binding.order??100)-(f.binding.order??100)}),this.multiCache.set(s,l),l}async resolveForAsset(e,t,r){let i=`${e}:${t}:${r??""}`,s=this.cache.get(i);if(s)return s;let a=await this.findBindings(t,r,e),c=[];for(let l of a){let u=await this.loadCommand(l.commandRef);if(!u)continue;let f=l.precondition?{...u,precondition:l.precondition}:u;c.push({command:f,binding:l})}return c.sort((l,u)=>{let f=this.getBindingPriority(l.binding),d=this.getBindingPriority(u.binding);return f!==d?f-d:(l.binding.order??100)-(u.binding.order??100)}),this.cache.set(i,c),c}async loadCommand(e){let t=await this.findSubjectByUID(e);if(!t||(await this.tripleStore.match(t,we.Namespace.RDF.term("type"),we.Namespace.EXOCMD.term("Command"))).length===0)return null;let i=await this.getLiteralValue(t,we.Namespace.EXO.term("Asset_label"))??"Unknown Command",s=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_labelTemplate")),a=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_icon")),c=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_confirmMessage")),l=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_successMessage")),u=await this.getLiteralValue(t,we.Namespace.EXOCMD.term("Command_category")),f=await this.loadLinkedPrecondition(t),d=await this.loadLinkedGrounding(t,0);return d?{id:e,name:i,labelTemplate:s??void 0,icon:a??void 0,precondition:f??void 0,grounding:d,confirmMessage:c??void 0,successMessage:l??void 0,category:u??void 0}:null}async findBindings(e,t,r){let i=await this.tripleStore.match(void 0,we.Namespace.RDF.term("type"),we.Namespace.EXOCMD.term("CommandBinding")),s=[];for(let a of i){let c=a.subject,l=await this.loadBindingDefinition(c);l&&this.bindingMatches(l,e,t,r)&&s.push(l)}return s}invalidateCache(){this.cache.clear(),this.multiCache.clear()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let r=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:a}of i){let c=await this.evaluateSelectSnippet(a,t);r=r.replace(s,c)}return r}extractPlaceholders(e){let t=[],r=0;for(;r<e.length;)if(e[r]==="{"){let i=1,s=r+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let a=e.slice(r,s),c=e.slice(r+1,s-1);t.push({full:a,body:c})}r=s}else r++;return t}async evaluateSelectSnippet(e,t){try{let r=e.replace(/\$target/g,`<${t}>`),s=new Fj.ExoQLParser().parse(r),c=new Dj.ExoQLAlgebraTranslator().translate(s),u=await new Nj.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let h=f.get(d[0]);return h?h instanceof oi.Literal||h instanceof Ms.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,we.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetClass")),a=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,we.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!a&&!c)return null;let l=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("CommandBinding_group")),d=await this.loadLinkedPreconditionFromProperty(e,we.Namespace.EXOCMD.term("CommandBinding_precondition"));return{id:t,label:r,commandRef:i,targetClass:s??void 0,targetPrototype:a??void 0,targetAsset:c??void 0,position:l??void 0,order:u?parseInt(u,10):void 0,group:f??void 0,precondition:d??void 0}}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let a=this.extractPathBasename(r);if(a&&a===i)return!0;let c=this.extractAlias(t);if(c&&r===c)return!0;let l=this.extractAlias(e);return!!(l&&l===i)}extractPathBasename(e){let t=e.match(/\/([^/]+)\.md$/);return t?t[1]:null}extractAlias(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(r+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,we.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Ms.IRI)s=i;else if(i instanceof oi.Literal){let f=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(f)}if(!s)return null;let a=await this.getLiteralValue(s,we.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,we.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,we.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,we.Namespace.EXOCMD.term("Precondition_hostFunction"));return!a||!l&&!u?null:{id:a,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u}}}async loadLinkedGrounding(e,t){if(t>=S1)return null;let r=await this.tripleStore.match(e,we.Namespace.EXOCMD.term("Command_grounding"),void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Ms.IRI)s=i;else if(i instanceof oi.Literal){let a=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(a)}return s?this.loadGroundingDefinition(s,t):null}async loadGroundingDefinition(e,t){if(t>=S1)return null;let r=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,we.Namespace.EXO.term("Asset_label"))??"",s=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_type"));if(!s)return null;let a=this.resolveGroundingType(s);if(!a)return null;let c=await this.getObsidianName(e,we.Namespace.EXOCMD.term("Grounding_targetProperty"));if(a===_1.GroundingType.SERVICE_CALL){let v=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_serviceId"));v&&(c=v)}let l=await this.getObsidianWikilinkValue(e,we.Namespace.EXOCMD.term("Grounding_targetValue")),u=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),f=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetClass")),d=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetPrototype")),h=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_targetFolder")),p=await this.getLiteralValue(e,we.Namespace.EXOCMD.term("Grounding_inputSchema")),_;a===_1.GroundingType.COMPOSITE&&(_=await this.loadCompositeSteps(e,t+1));let b;if(p)try{let v=JSON.parse(p);v?.properties&&(b=Object.entries(v.properties).map(([A,R])=>({name:A,type:R.type==="string"?"text":R.type,label:R.title??A,required:Array.isArray(v.required)&&v.required.includes(A)})))}catch{}let E={id:r,label:i,type:a,targetProperty:c??void 0,targetValue:l??void 0,sparqlUpdate:u??void 0,steps:_,targetClass:f??void 0,targetPrototype:d??void 0,targetFolder:h??void 0};return b&&(E.inputSchema=b),E}async loadCompositeSteps(e,t){if(t>=S1)return[];let r=await this.tripleStore.match(e,we.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let a=null;if(s.object instanceof Ms.IRI)a=s.object;else if(s.object instanceof oi.Literal){let l=this.normalizeWikilink(s.object.value);a=await this.findSubjectByUID(l)}if(!a)continue;let c=await this.loadGroundingDefinition(a,t);c&&i.push(c)}return i}resolveGroundingType(e){let t=e.toLowerCase().trim();return Object.values(_1.GroundingType).includes(t)?t:null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let r=await this.tripleStore.findSubjectsByUUID(e);if(r.length>0)return r[0]}let t=await this.tripleStore.match(void 0,we.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof oi.Literal&&r.object.value===e)return r.subject;return null}async getLiteralValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof oi.Literal||i instanceof Ms.IRI?i.value:null}async getLinkedUID(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Ms.IRI){let s=await this.tripleStore.match(i,we.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof oi.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof oi.Literal?this.normalizeWikilink(i.value):null}async getLinkedValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof oi.Literal?this.normalizeWikilink(i.value):i instanceof Ms.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof oi.Literal?i.value:i instanceof Ms.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianWikilinkValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof oi.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof Ms.IRI){let s=this.iriToObsidianName(i.value);return s?`"[[${s}]]"`:i.value}return null}async resolveWikilinkAlias(e){let t=e.match(/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\]/);if(!t)return e;let r=t[1],i=await this.findSubjectByUID(r);if(!i)return e;let s=await this.getLiteralValue(i,we.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${r}]]`,`[[${r}|${s}]]`):e}iriToObsidianName(e){let t=e.lastIndexOf("#");if(t>=0){let i=e.substring(0,t+1),s=e.substring(t+1);if(i===we.Namespace.EMS.iri.value)return`ems__${s}`;if(i===we.Namespace.EXO.iri.value)return`exo__${s}`;if(i===we.Namespace.EXOCMD.iri.value)return`exocmd__${s}`;if(i===we.Namespace.IMS.iri.value)return`ims__${s}`;if(i===we.Namespace.ZTLK.iri.value)return`ztlk__${s}`;if(i===we.Namespace.PTMS.iri.value)return`ptms__${s}`;if(i===we.Namespace.LIT.iri.value)return`lit__${s}`;if(i===we.Namespace.INBOX.iri.value)return`inbox__${s}`}let r=e.match(/\/([^/]+)\.md$/);return r?r[1]:null}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(0,r):t}};js.CommandResolver=b1;js.CommandResolver=b1=Rj([(0,Pj.injectable)(),Oj("design:paramtypes",[Object])],b1)});var M3=S($s=>{"use strict";var Lj=$s&&$s.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},kj=$s&&$s.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Bu;Object.defineProperty($s,"__esModule",{value:!0});$s.PreconditionEvaluator=void 0;var Mj=ce(),jj=Fu(),$j=Du(),k3=$u(),Vu=Bu=class{static{o(this,"PreconditionEvaluator")}constructor(e){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Bu.SENTINEL_IRI),i=new jj.ExoQLParser().parse(t),a=new $j.ExoQLAlgebraTranslator().translate(i);return new k3.ExoQLQueryExecutor(this.tripleStore).isAskQuery(a)?a:null}evaluateHostFunction(e,t,r){let i=this.hostFunctions.get(e);if(!i)return!0;let s=r?{...r,targetIRI:t}:{targetIRI:t};return i(s)}async evaluateSparqlAsk(e,t){try{let r=this.askCache.get(e);if(r===void 0){let a=this.compileAsk(e);if(!a)return!1;r=a,this.askCache.set(e,r)}let i=JSON.parse(JSON.stringify(r).replaceAll(Bu.SENTINEL_IRI,t));return await new k3.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=new Date().toISOString(),i=r.slice(0,10),s=new Date,a=new Date(s.getTime()+Bu.ALMATY_OFFSET_MS),c=a.getUTCFullYear(),l=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCDay(),h=new Date(Date.UTC(c,l,u-1)).toISOString().slice(0,10),p=(f+6)%7,_=new Date(Date.UTC(c,l,u-p)),b=_.toISOString().slice(0,10),v=new Date(_.getTime()-10080*60*1e3).toISOString().slice(0,10),A=`${c}-${String(l+1).padStart(2,"0")}-01`,R=l===0?11:l-1,W=`${l===0?c-1:c}-${String(R+1).padStart(2,"0")}-01`,ve=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${r}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${b}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${v}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${A}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${W}"^^xsd:date`).replace(/\$thisYearStart/g,`"${ve}"^^xsd:date`).replace(/\$today/g,`"${i}"^^xsd:date`)}};$s.PreconditionEvaluator=Vu;Vu.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";Vu.ALMATY_OFFSET_MS=300*60*1e3;$s.PreconditionEvaluator=Vu=Bu=Lj([(0,Mj.injectable)(),kj("design:paramtypes",[Object])],Vu)});var qn=S(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.FrontmatterService=void 0;var Uu=class n{static{o(this,"FrontmatterService")}parse(e){let t=e.match(n.FRONTMATTER_REGEX);return t?{exists:!0,content:t[1],originalContent:e}:{exists:!1,content:"",originalContent:e}}updateProperty(e,t,r){t=n.normalizeIRI(t),typeof r=="string"&&(r=n.normalizeIRIValue(r));let i=this.parse(e),s=this.serializeValue(t,r);if(!i.exists)return`---
|
|
71
71
|
${s}
|
|
72
72
|
---
|
|
73
73
|
${e}`;let a=i.content;if(this.hasProperty(a,t)){let c=new RegExp(`${this.escapeRegex(t)}:.*(?:
|
|
@@ -374,7 +374,7 @@ LIMIT ${this.config.defaultLimit}`,s="\u041D\u0435 \u0443\u0434\u0430\u043B\u043
|
|
|
374
374
|
`,i=this.composePrefixes(t),s=this.serializePrefixes(i,r),a=this.nTriplesSerializer.serialize(e,{newline:r}).trimEnd();return s?a?`${s}${r}${r}${a}${r}`:`${s}${r}`:a?`${a}${r}`:""}serializePrefixes(e,t){let r=Object.entries(e);return r.length===0?"":r.map(([i,s])=>`@prefix ${i}: <${s}> .`).join(t)}composePrefixes(e){return e.includeDefaultPrefixes??!0?{...v7,...e.prefixes??{}}:{...e.prefixes??{}}}serializeTriplesOnly(e,t){return this.nTriplesSerializer.serializeChunk(e,t).trimEnd()}};zp.TurtleSerializer=JS});var zA=S(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});Hp.JSONLDSerializer=void 0;var WA=xe(),GA=qt(),w7=He(),Jc=Cr(),E7={rdf:Jc.Namespace.RDF.iri.value,rdfs:Jc.Namespace.RDFS.iri.value,owl:Jc.Namespace.OWL.iri.value,xsd:Jc.Namespace.XSD.iri.value,exo:Jc.Namespace.EXO.iri.value,ems:Jc.Namespace.EMS.iri.value},ZS=class{static{o(this,"JSONLDSerializer")}toDocument(e,t={}){let r={...E7,...t.context??{}},i=new Map;for(let s of e){let a=this.subjectToId(s.subject),c=this.compactIri(s.predicate.value,r),l=this.objectToJSONLD(s.object,r),u=i.get(a)??{"@id":a},f=u[c];f===void 0?u[c]=l:Array.isArray(f)?f.push(l):u[c]=[f,l],i.set(a,u)}return{"@context":r,"@graph":Array.from(i.values())}}serialize(e,t={}){let r=this.toDocument(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}subjectToId(e){return e instanceof WA.IRI?e.value:e instanceof GA.BlankNode?`_:${e.id}`:String(e)}compactIri(e,t){for(let[r,i]of Object.entries(t))if(e.startsWith(i)){let s=e.slice(i.length);if(s.length>0)return`${r}:${s}`}return e}objectToJSONLD(e,t){if(e instanceof WA.IRI)return{"@id":e.value};if(e instanceof GA.BlankNode)return{"@id":`_:${e.id}`};if(e instanceof w7.Literal){let r={"@value":e.value};return e.datatype?r["@type"]=this.compactIri(e.datatype.value,t):e.language&&(r["@language"]=e.language,e.hasDirection()&&e.direction&&(r["@direction"]=e.direction)),r}return e}};Hp.JSONLDSerializer=ZS});var rb=S(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});Qp.NTriplesParser=void 0;var T7=ri(),HA=xe(),eb=He(),A7=qt(),Zc=Cr(),x7={rdf:Zc.Namespace.RDF.iri.value,rdfs:Zc.Namespace.RDFS.iri.value,owl:Zc.Namespace.OWL.iri.value,xsd:Zc.Namespace.XSD.iri.value,exo:Zc.Namespace.EXO.iri.value,ems:Zc.Namespace.EMS.iri.value},tb=class{static{o(this,"NTriplesParser")}parse(e,t={}){let r={prefixes:{...x7,...t.prefixes??{}},strict:t.strict??!1},i=[];return e.split(/\r?\n/).forEach((a,c)=>{let l=a.trim();!l||l.startsWith("#")||i.push(this.parseLine(l,c+1,r))}),i}parseLine(e,t,r){if(!e.endsWith("."))throw new Error(`Invalid RDF statement at line ${t}: missing '.' terminator`);let s=e.slice(0,-1).trim(),a=this.parseSubject(s,t,r);s=a.rest.trim();let c=this.parsePredicate(s,t,r);s=c.rest.trim();let l=this.parseObject(s,t,r);if(s=l.rest.trim(),s.length>0)throw new Error(`Unexpected tokens after object at line ${t}`);return new T7.Triple(a.node,c.node,l.node)}parseSubject(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):e.startsWith("_:")?this.consumeBlankNode(e,t):this.consumePrefixedName(e,t,r)}parsePredicate(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):this.consumePrefixedName(e,t,r)}parseObject(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):e.startsWith("_:")?this.consumeBlankNode(e,t):e.startsWith('"')?this.consumeLiteral(e,t,r):this.consumePrefixedName(e,t,r)}consumePrefixedName(e,t,r){let i=e.match(/^([a-zA-Z_][\w-]*):([^\s]+)(?:\s+(.*))?$/);if(!i)throw new Error(`Invalid token at line ${t}: ${e}`);let[,s,a,c]=i,l=r.prefixes[s];if(!l)throw new Error(`Unknown prefix "${s}" at line ${t}`);return{node:new HA.IRI(`${l}${a}`),rest:(c??"").trimStart()}}consumeIRI(e,t,r){let i=this.findClosingBracket(e,"<",">");if(i===-1)throw new Error(`Invalid IRI at line ${t}`);let s=e.slice(1,i),a=new HA.IRI(s),c=e.slice(i+1).trimStart();return{node:a,rest:c}}consumeBlankNode(e,t){let r=e.match(/^_:(\w+)(?:\s+(.*))?$/);if(!r)throw new Error(`Invalid blank node identifier at line ${t}`);let[,i,s]=r;return{node:new A7.BlankNode(i),rest:(s??"").trimStart()}}consumeLiteral(e,t,r){let{value:i,rest:s}=this.consumeQuotedString(e,t),a=s.trimStart();if(a.startsWith("^^")){a=a.slice(2).trimStart();let c=a.startsWith("<")?this.consumeIRI(a,t,r):this.consumePrefixedName(a,t,r);return{node:new eb.Literal(i,c.node),rest:c.rest}}if(a.startsWith("@")){let c=a.match(/^@([a-zA-Z-]+)(?:\s+(.*))?$/);if(!c)throw new Error(`Invalid language tag at line ${t}`);let[,l,u]=c;return{node:new eb.Literal(i,void 0,l),rest:(u??"").trimStart()}}return{node:new eb.Literal(i),rest:a}}consumeQuotedString(e,t){if(!e.startsWith('"'))throw new Error(`Expected quoted string at line ${t}`);let r="";for(let i=1;i<e.length;i++){let s=e[i];if(s==="\\"){if(i+1>=e.length)throw new Error(`Invalid escape sequence at line ${t}`);let a=e[i+1];switch(a){case"t":r+=" ",i+=1;break;case"b":r+="\b",i+=1;break;case"n":r+=`
|
|
375
375
|
`,i+=1;break;case"r":r+="\r",i+=1;break;case"f":r+="\f",i+=1;break;case'"':r+='"',i+=1;break;case"\\":r+="\\",i+=1;break;case"u":{let c=e.slice(i+2,i+6);if(c.length!==4||!/^[0-9a-fA-F]{4}$/.test(c))throw new Error(`Invalid \\u escape at line ${t}`);r+=String.fromCharCode(parseInt(c,16)),i+=5;break}case"U":{let c=e.slice(i+2,i+10);if(c.length!==8||!/^[0-9a-fA-F]{8}$/.test(c))throw new Error(`Invalid \\U escape at line ${t}`);r+=String.fromCodePoint(parseInt(c,16)),i+=9;break}default:throw new Error(`Unknown escape sequence \\${a} at line ${t}`)}continue}if(s==='"'){let a=e.slice(i+1);return{value:r,rest:a}}r+=s}throw new Error(`Unterminated string literal at line ${t}`)}findClosingBracket(e,t,r){let i=0;for(let s=0;s<e.length;s++){let a=e[s];if(a===t){i++;continue}if(a===r&&(i--,i===0))return s}return-1}};Qp.NTriplesParser=tb});var QA=S(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});Yp.TurtleParser=void 0;var el=Cr(),C7=rb(),I7={rdf:el.Namespace.RDF.iri.value,rdfs:el.Namespace.RDFS.iri.value,owl:el.Namespace.OWL.iri.value,xsd:el.Namespace.XSD.iri.value,exo:el.Namespace.EXO.iri.value,ems:el.Namespace.EMS.iri.value},R7=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,nb=class{static{o(this,"TurtleParser")}constructor(){this.nTriplesParser=new C7.NTriplesParser}parse(e,t={}){let r={...I7,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:a,lineNumber:c})=>{if(this.isPrefixStatement(a)){let u=a.match(R7);if(!u)throw new Error(`Invalid prefix declaration at line ${c}`);let[,f,d]=u;r[f]=d;return}if(a.includes(";")||a.includes(","))throw new Error(`Complex Turtle statements with ';' or ',' are not supported (line ${c})`);let l=this.normalizeShortcuts(a);s.push(this.nTriplesParser.parseLine(l,c,{prefixes:r,strict:!1}))}),s}collectStatements(e){let t=e.split(/\r?\n/),r=[],i="",s=0;if(t.forEach((a,c)=>{let l=a.trim();!l||l.startsWith("#")||(i||(s=c+1),i=i?`${i} ${l}`:l,l.endsWith(".")&&(r.push({statement:i,lineNumber:s}),i=""))}),i)throw new Error(`Unterminated Turtle statement near line ${s}`);return r}isPrefixStatement(e){return e.startsWith("@prefix")}normalizeShortcuts(e){return e.includes(" a ")?e.replace(/\sa\s/g," rdf:type "):e}};Yp.TurtleParser=nb});var YA=S(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.RDFSerializer=void 0;var tl=ri(),Fo=xe(),Do=He(),ib=qt(),os=Cr(),O7=qA(),P7=XS(),F7=zA(),D7=QA(),N7=rb(),L7=1024,k7=`
|
|
376
376
|
`,M7={rdf:os.Namespace.RDF.iri.value,rdfs:os.Namespace.RDFS.iri.value,owl:os.Namespace.OWL.iri.value,xsd:os.Namespace.XSD.iri.value,exo:os.Namespace.EXO.iri.value,ems:os.Namespace.EMS.iri.value},sb=class{static{o(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new O7.TurtleSerializer,this.nTriplesSerializer=new P7.NTriplesSerializer,this.jsonldSerializer=new F7.JSONLDSerializer,this.turtleParser=new D7.TurtleParser,this.nTriplesParser=new N7.NTriplesParser}async serialize(e,t={}){let r=await this.store.match();return this.serializeTriples(r,e,t)}serializeTriples(e,t,r={}){switch(t){case"turtle":return this.turtleSerializer.serialize(e,{prefixes:r.prefixes,includeDefaultPrefixes:r.includeDefaultPrefixes,newline:r.newline});case"n-triples":return this.nTriplesSerializer.serialize(e,{newline:r.newline});case"json-ld":return this.jsonldSerializer.serialize(e,{context:r.prefixes,pretty:r.pretty,indent:r.indent});default:throw new Error(`Unsupported serialization format: ${t}`)}}stream(e,t={}){let r=t.newline??k7,i=t.batchSize??L7,s=t.includeDefaultPrefixes,a=t.prefixes,c=this,l=!1,u=[],f=[],d=0,h=o(async()=>{if(!l){if(f=await c.store.match(),e==="json-ld"){let _=c.jsonldSerializer.toDocument(f,{context:a,pretty:!1});u.push(...c.buildJsonLdChunks(_))}else if(e==="turtle"){let _=c.turtleSerializer.serializePrefixes(c.composePrefixes(a,s),r);_&&u.push(`${_}${r}${r}`)}l=!0}},"ensureInitialized");return{async next(){if(await h(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(d>=f.length)return{value:void 0,done:!0};let _=f.slice(d,d+i);d+=_.length;let b="";if(e==="turtle"){let E=c.turtleSerializer.serializeTriplesOnly(_,r);E&&(b=`${E}${r}`)}else e==="n-triples"&&(b=c.nTriplesSerializer.serializeChunk(_,r));return b?{value:b,done:!1}:this.next()},async return(){return u=[],f=[],d=0,{value:void 0,done:!0}},[Symbol.asyncIterator](){return this}}}async load(e,t,r={}){let i=this.parse(e,t,r);return r.mode!=="append"&&await this.store.clear(),await this.store.addAll(i),i.length}parse(e,t,r={}){switch(t){case"turtle":return this.turtleParser.parse(e,this.buildTurtleParseOptions(r));case"n-triples":return this.nTriplesParser.parse(e,this.buildNTriplesParseOptions(r));case"json-ld":return this.parseJsonLd(e,r);default:throw new Error(`Unsupported serialization format: ${t}`)}}buildTurtleParseOptions(e){return{prefixes:this.composePrefixes(e.prefixes,!0),strict:e.strict}}buildNTriplesParseOptions(e){return{prefixes:this.composePrefixes(e.prefixes,!0),strict:e.strict}}composePrefixes(e,t){return t??!0?{...M7,...e??{}}:{...e??{}}}parseJsonLd(e,t){let r;try{r=JSON.parse(e)}catch(u){throw new Error(`Invalid JSON-LD document: ${u.message}`)}let i=this.composePrefixes(t.prefixes,!0),s=this.extractContext(r),a={...i,...s},c=this.extractGraph(r),l=[];return c.forEach((u,f)=>{if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`Invalid JSON-LD node at index ${f}`);let d=this.parseSubjectFromNode(u,a,f),h=Object.entries(u);for(let[p,_]of h){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(d,_,l,a);continue}let b=this.expandTerm(p,a),E=new Fo.IRI(b);this.collectTriplesForValue(d,E,_,l,a)}}),l}extractContext(e){if(!e||typeof e!="object"||Array.isArray(e))return{};let t=e["@context"];if(!t||typeof t!="object"||Array.isArray(t))return{};let r={};return Object.entries(t).forEach(([i,s])=>{typeof s=="string"&&(r[i]=s)}),r}extractGraph(e){if(Array.isArray(e))return e;if(!e||typeof e!="object")return[];let t=e["@graph"];return Array.isArray(t)?t:[e]}parseSubjectFromNode(e,t,r){let i=e["@id"];if(typeof i=="string"){if(i.startsWith("_:"))return new ib.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new Fo.IRI(i);let s=this.expandTerm(i,t);return new Fo.IRI(s)}return new ib.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=os.Namespace.RDF.term("type");(Array.isArray(t)?t:[t]).forEach(c=>{if(typeof c!="string")throw new Error("Invalid @type value in JSON-LD node");let l=this.expandTerm(c,i);r.push(new tl.Triple(e,s,new Fo.IRI(l)))})}collectTriplesForValue(e,t,r,i,s){if(r!=null){if(Array.isArray(r)){r.forEach(a=>this.collectTriplesForValue(e,t,a,i,s));return}if(typeof r=="object"){let a=r;if(typeof a["@id"]=="string"){let c=this.parseIdNode(a["@id"],s);i.push(new tl.Triple(e,t,c));return}if(a["@value"]!==void 0){let c=this.parseLiteralObject(a,s);i.push(new tl.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new tl.Triple(e,t,new Do.Literal(r)));return}if(typeof r=="number"){let a=Number.isInteger(r)?os.Namespace.XSD.term("integer"):os.Namespace.XSD.term("decimal");i.push(new tl.Triple(e,t,new Do.Literal(r.toString(),a)));return}if(typeof r=="boolean"){let a=os.Namespace.XSD.term("boolean");i.push(new tl.Triple(e,t,new Do.Literal(r.toString(),a)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new ib.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new Fo.IRI(e);let r=this.expandTerm(e,t);return new Fo.IRI(r)}parseLiteralObject(e,t){let r=e["@value"];if(typeof r!="string")throw new Error("JSON-LD literal values must be strings");if(typeof e["@language"]=="string"){let i=e["@direction"];return i==="ltr"||i==="rtl"?new Do.Literal(r,void 0,e["@language"],i):new Do.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new Do.Literal(r,new Fo.IRI(i))}return new Do.Literal(r)}expandTerm(e,t){if(this.isAbsoluteIri(e))return e;let r=e.indexOf(":");if(r>0){let s=e.slice(0,r),a=e.slice(r+1),c=t[s];if(!c)throw new Error(`Unknown prefix "${s}" in JSON-LD document`);return`${c}${a}`}let i=t["@vocab"];if(i)return`${i}${e}`;throw new Error(`Unable to expand JSON-LD term "${e}"`)}isAbsoluteIri(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)}buildJsonLdChunks(e){let t=[],r=JSON.stringify(e["@context"]);return t.push(`{"@context":${r},"@graph":[`),e["@graph"].forEach((i,s)=>{let a=JSON.stringify(i);s>0?t.push(`,${a}`):t.push(a)}),t.push(`]}
|
|
377
|
-
`),t}};Kp.RDFSerializer=sb});var ob=S(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});Xp.RDFVocabularyMapper=void 0;var Xt=ri(),KA=xe(),X=Cr(),ab=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",X.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",X.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",X.Namespace.RDFS.term("subClassOf")],["exo__Property_range",X.Namespace.RDFS.term("range")],["exo__Property_domain",X.Namespace.RDFS.term("domain")],["exo__Property_superProperty",X.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new Xt.Triple(X.Namespace.EXO.term("Asset"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDFS.term("Resource"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Class"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDFS.term("Class"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDF.term("Property"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Task"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Project"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Area"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Workflow"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("WorkflowState"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("WorkflowTransition"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Command"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Precondition"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Grounding"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("CommandBinding"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new Xt.Triple(X.Namespace.EXO.term("Instance_class"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDF.term("type"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Asset_isDefinedBy"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("isDefinedBy"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Class_superClass"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("subClassOf"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_range"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("range"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_domain"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("domain"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_superProperty"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof KA.IRI)s=r;else{let a=r.match(/^(ems|exo|exocmd)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?X.Namespace.EMS:c==="exocmd"?X.Namespace.EXOCMD:X.Namespace.EXO).term(l)}else s=new KA.IRI(r)}return new Xt.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Xp.RDFVocabularyMapper=ab});var XA=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.RDFSInferenceEngine=void 0;var j7=ri(),Jp=xe(),cb=class{static{o(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(d=>d.value.includes("Class_superClass")),i=t.find(d=>d.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let a=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let d of l)if(d.object instanceof Jp.IRI){let h=a.get(d.object.value);if(h)for(let p of h)u.push(new j7.Triple(d.subject,i,new Jp.IRI(p)))}return u.length>0&&await e.addAll(u),await e.count()-c}async buildDirectParentMap(e,t){let r=await e.match(void 0,t),i=new Map;for(let s of r)if(s.subject instanceof Jp.IRI&&s.object instanceof Jp.IRI){let a=s.subject.value,c=s.object.value;i.has(a)||i.set(a,new Set),i.get(a).add(c)}return i}computeAllAncestors(e){let t=new Map;for(let r of e.keys())t.has(r)||t.set(r,this.computeAncestorsBFS(r,e));return t}computeAncestorsBFS(e,t){let r=new Set,i=new Set,s=[],a=t.get(e);if(a)for(let c of a)s.push(c);for(;s.length>0;){let c=s.shift();if(i.has(c))continue;i.add(c),r.add(c);let l=t.get(c);if(l)for(let u of l)i.has(u)||s.push(u)}return r}};Zp.RDFSInferenceEngine=cb});var fb=S(No=>{"use strict";var $7=No&&No.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(No,"__esModule",{value:!0});No.NonInheritablePropertyRegistry=void 0;var B7=ce(),JA=xe(),ZA=He(),lb=Cr(),ub=class{static{o(this,"NonInheritablePropertyRegistry")}constructor(){this.nonInheritableIRIs=new Set,this.initialized=!1}async initialize(e){this.nonInheritableIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Instance_class"));if(!r){this.initialized=!0;return}let i=await this.findNonInheritableClassIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let a=t.find(c=>c.value.includes("Asset_label"));if(!a){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,a,void 0);for(let u of l)if(u.object instanceof ZA.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.nonInheritableIRIs.add(d)}}}catch{}this.initialized=!0}isNonInheritable(e){return this.nonInheritableIRIs.has(e)}get size(){return this.nonInheritableIRIs.size}get isInitialized(){return this.initialized}async findNonInheritableClassIRI(e,t){let r=t.find(a=>a.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new ZA.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof JA.IRI)return i[0].subject;let s=t.find(a=>a.value.includes("Instance_class"));if(s){let a=await e.match(void 0,s,void 0);for(let c of a)if(c.object instanceof JA.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?lb.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?lb.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?lb.Namespace.EXOCMD.term(e.substring(8)).value:null}};No.NonInheritablePropertyRegistry=ub;No.NonInheritablePropertyRegistry=ub=$7([(0,B7.injectable)()],ub)});var pb=S(Lo=>{"use strict";var V7=Lo&&Lo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(Lo,"__esModule",{value:!0});Lo.PropertyCardinalityRegistry=void 0;var U7=ce(),ex=xe(),tx=He(),db=Cr(),hb=class{static{o(this,"PropertyCardinalityRegistry")}constructor(){this.multiValuedIRIs=new Set,this.initialized=!1}async initialize(e){this.multiValuedIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Property_cardinality"));if(!r){this.initialized=!0;return}let i=await this.findMultipleCardinalityIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let a=t.find(c=>c.value.includes("Asset_label"));if(!a){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,a,void 0);for(let u of l)if(u.object instanceof tx.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.multiValuedIRIs.add(d)}}}catch{}this.initialized=!0}isMultiValued(e){return this.multiValuedIRIs.has(e)}get size(){return this.multiValuedIRIs.size}get isInitialized(){return this.initialized}async findMultipleCardinalityIRI(e,t){let r=t.find(a=>a.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new tx.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof ex.IRI)return i[0].subject;let s=t.find(a=>a.value.includes("Instance_class"));if(s){let a=await e.match(void 0,s,void 0);for(let c of a)if(c.object instanceof ex.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?db.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?db.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?db.Namespace.EXOCMD.term(e.substring(8)).value:null}};Lo.PropertyCardinalityRegistry=hb;Lo.PropertyCardinalityRegistry=hb=V7([(0,U7.injectable)()],hb)});var yb=S(hr=>{"use strict";var q7=hr&&hr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},W7=hr&&hr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(hr,"__esModule",{value:!0});hr.PrototypeChainMaterializer=hr.MAX_PROTOTYPE_DEPTH=hr.INFERRED_GRAPH=void 0;hr.inferredGraphForDepth=mb;var G7=ce(),rx=ri(),Ia=xe(),z7=fb(),H7=pb();hr.INFERRED_GRAPH=new Ia.IRI("https://exocortex.my/ontology/exo#inferred");var Q7="https://exocortex.my/ontology/exo#inferred/";function mb(n){return new Ia.IRI(`${Q7}${n}`)}o(mb,"inferredGraphForDepth");hr.MAX_PROTOTYPE_DEPTH=10;var gb=class{static{o(this,"PrototypeChainMaterializer")}constructor(e,t){this.registry=e,this.cardinalityRegistry=t??null}async materialize(e){let r=(await e.predicates()).find(c=>c.value.includes("Asset_prototype"));if(!r)return 0;let i=await e.match(void 0,r,void 0);if(i.length===0)return 0;let s=new Map;for(let c of i)if(c.subject instanceof Ia.IRI&&c.object instanceof Ia.IRI){let l=c.subject.value,u=c.object.value;l!==u&&s.set(l,c.object)}if(s.size===0)return 0;let a=0;for(let[c]of s){let l=new Ia.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let _=p.object instanceof Ia.IRI?p.object.value:String(p.object),b=h.get(p.predicate.value);b||(b=new Set,h.set(p.predicate.value,b)),b.add(_)}for(let p=0;p<u.length;p++){let _=u[p],b=p+1,E=new Ia.IRI(_),v=await e.match(E,void 0,void 0),A=new Set;if(e.matchInGraph){let R=await e.matchInGraph(E,void 0,void 0,hr.INFERRED_GRAPH);for(let B of R)A.add(B.predicate.value)}for(let R of v){let B=R.predicate.value;if(this.registry.isNonInheritable(B)||A.has(B))continue;if(d.has(B)&&this.isMultiValued(B)){let ve=R.object instanceof Ia.IRI?R.object.value:String(R.object);if(h.get(B)?.has(ve))continue;let G=h.get(B);G||(G=new Set,h.set(B,G)),G.add(ve);let F=new rx.Triple(l,R.predicate,R.object);await e.add(F),e.addToGraph&&(await e.addToGraph(F,hr.INFERRED_GRAPH),await e.addToGraph(F,mb(b))),a++;continue}if(d.has(B))continue;let W=new rx.Triple(l,R.predicate,R.object);await e.add(W),e.addToGraph&&(await e.addToGraph(W,hr.INFERRED_GRAPH),await e.addToGraph(W,mb(b))),d.add(B),a++}}}return a}isMultiValued(e){return this.cardinalityRegistry?this.cardinalityRegistry.isMultiValued(e):!1}resolveChain(e,t){let r=[],i=new Set;i.add(e);let s=[],a=t.get(e);for(a&&s.push(a.value);s.length>0&&r.length<hr.MAX_PROTOTYPE_DEPTH;){let c=s.shift();if(c===void 0)break;if(i.has(c))continue;i.add(c),r.push(c);let l=t.get(c);l&&!i.has(l.value)&&s.push(l.value)}return r}};hr.PrototypeChainMaterializer=gb;hr.PrototypeChainMaterializer=gb=q7([(0,G7.injectable)(),W7("design:paramtypes",[z7.NonInheritablePropertyRegistry,H7.PropertyCardinalityRegistry])],gb)});var Sb=S(ar=>{"use strict";var Y7=ar&&ar.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},K7=ar&&ar.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ar,"__esModule",{value:!0});ar.SourceAnnotator=ar.DEPTH_VARIABLE=ar.SOURCE_VARIABLE=void 0;var X7=ce(),rl=He(),J7=xe(),em=yb();ar.SOURCE_VARIABLE="_source";ar.DEPTH_VARIABLE="_depth";var _b=class{static{o(this,"SourceAnnotator")}constructor(e){this.tripleStore=e}async annotate(e,t,r,i){if(!this.tripleStore.matchInGraph)return e.map(a=>{let c=a.clone();return c.set(ar.SOURCE_VARIABLE,new rl.Literal("own")),c});let s=[];for(let a of e){let c=a.get(t),l=a.get(r),u=a.get(i),f=a.clone();if(!c||!l||!u)f.set(ar.SOURCE_VARIABLE,new rl.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(ar.SOURCE_VARIABLE,new rl.Literal(d))}s.push(f)}return s}async annotateSingle(e,t,r,i){return(await this.annotate([e],t,r,i))[0]}async determineSource(e,t,r){return this.tripleStore.matchInGraph&&(await this.tripleStore.matchInGraph(e,t,r,em.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=em.MAX_PROTOTYPE_DEPTH;i++){let s=(0,em.inferredGraphForDepth)(i);if((await this.tripleStore.matchInGraph(e,t,r,s)).length>0)return i}return 0}async annotateBySubject(e,t){if(!this.tripleStore.matchInGraph)return e.map(s=>{let a=s.clone();return a.set(ar.SOURCE_VARIABLE,new rl.Literal("own")),a});let r=[],i=new Map;for(let s of e){let a=s.get(t),c=s.clone();if(!a||!(a instanceof J7.IRI))c.set(ar.SOURCE_VARIABLE,new rl.Literal("own"));else{let l=a.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(a,void 0,void 0,em.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(ar.SOURCE_VARIABLE,new rl.Literal(u))}r.push(c)}return r}};ar.SourceAnnotator=_b;ar.SourceAnnotator=_b=Y7([(0,X7.injectable)(),K7("design:paramtypes",[Object])],_b)});var vb=S(Pi=>{"use strict";var Z7=Pi&&Pi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},e8=Pi&&Pi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},nx=Pi&&Pi.__param||function(n,e){return function(t,r){e(t,r,n)}},nl;Object.defineProperty(Pi,"__esModule",{value:!0});Pi.NoteToRDFConverter=void 0;var bb=ce(),cn=ri(),ko=xe(),En=He(),ix=qt(),Jt=Cr(),sx=wt(),t8=ob(),r8=Hu(),Tn=v0(),Mo=nl=class{static{o(this,"NoteToRDFConverter")}constructor(e,t=r8.NullLogger){this.vault=e,this.logger=t,this.OBSIDIAN_VAULT_SCHEME="obsidian://vault/",this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new t8.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?Tn.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Jt.Namespace.EXO.term("Asset_fileName");r.push(new cn.Triple(i,s,new En.Literal(e.basename)));for(let[c,l]of Object.entries(t)){if(!this.isExocortexProperty(c))continue;let u=this.propertyKeyToIRI(c),f=Array.isArray(l)?l:[l];for(let d of f)if(c==="exo__Instance_class"){let h=this.valueToClassURI(d);r.push(new cn.Triple(i,u,h))}else{let h=await this.valueToRDFObject(d,e);for(let p of h)if(r.push(new cn.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof ko.IRI){let _=this.vocabularyMapper.generateMappedTriple(i,c,p);_&&r.push(_)}}if(c==="exo__Instance_class")for(let d of f){let h=this.valueToClassURI(d);if(h instanceof ko.IRI){let p=Jt.Namespace.RDF.term("type");r.push(new cn.Triple(i,p,h))}}if(c==="exo__Asset_label"){let d=Jt.Namespace.RDFS.term("label");for(let h of f)typeof h=="string"&&h.length>0&&r.push(new cn.Triple(i,d,new En.Literal(h)))}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=Tn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Tn.Exo003MetadataType.Namespace:break;case Tn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Tn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Tn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Tn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new ko.IRI(t.uri);return[new cn.Triple(r,Jt.Namespace.OWL.term("sameAs"),i),new cn.Triple(i,Jt.Namespace.OWL.term("sameAs"),r)]}convertExo003BlankNode(e,t){let r=this.notePathToIRI(e.path),i=t.uri.replace(/[^a-zA-Z0-9_-]/g,"_");return[new cn.Triple(r,Jt.Namespace.OWL.term("sameAs"),new ix.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Tn.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new cn.Triple(a,Jt.Namespace.RDF.term("value"),s.subject))}catch{}return r}async convertExo003Body(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.createExo003ReferenceResolver(e),c=a(t.subject),l=a(t.predicate);if(c.type==="literal")throw new Error("Body subject cannot be a literal");if(l.type!=="iri")throw new Error("Body predicate must be an IRI");let u=c.type==="iri"?new ko.IRI(c.value):new ix.BlankNode(c.value),f=new ko.IRI(l.value),d=Tn.Exo003Parser.toLiteral(t,s.trim());r.push(new cn.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new cn.Triple(h,Jt.Namespace.RDF.term("value"),u))}catch{}return r}createExo003ReferenceResolver(e){return t=>{let r=this.extractWikilink(t),i=r||t,s=this.vault.getFirstLinkpathDest(i,e.path);if(s){let a=this.vault.getFrontmatter(s);if(a&&Tn.Exo003Parser.isExo003Format(a)){let c=Tn.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Tn.Exo003MetadataType.Anchor||l.metadata===Tn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Tn.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=await this.convertNote(a);r.push(...c)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),this.logger.warn(`Skipping file with invalid IRI: ${a.path}`,{reason:l})}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=encodeURI(r.path),s=`${this.OBSIDIAN_VAULT_SCHEME}${i}`;ko.IRI.isValidIRI(s)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){let t=encodeURI(e);return new ko.IRI(`${this.OBSIDIAN_VAULT_SCHEME}${t}`)}isExocortexProperty(e){return nl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))}propertyKeyToIRI(e){for(let[t,r]of nl.NAMESPACE_MAP)if(e.startsWith(t))return r.term(e.substring(t.length));throw new Error(`Invalid property key: ${e}`)}async valueToRDFObject(e,t){if(typeof e=="string"){let r=this.removeQuotes(e),i=this.extractWikilink(r);if(i){let s=this.vault.getFirstLinkpathDest(i,t.path);if(s){let a=this.notePathToIRI(s.path),c=i.includes("|")?i.split("|")[0]:i;if(this.isUUID(c)){let l=new En.Literal(c),u=this.expandClassValue(s.basename);if(u)return[u];let f=this.vault.getFrontmatter(s);if(f){let d=f.exo__Asset_label;if(typeof d=="string"){let h=this.expandClassValue(d);if(h)return[h]}}return[a,l]}return[a]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return[new En.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new En.Literal(r,Jt.Namespace.XSD.term("dateTime"))]:[new En.Literal(r)]}return typeof e=="boolean"?[new En.Literal(e.toString())]:typeof e=="number"?[new En.Literal(e.toString(),Jt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new En.Literal(e.toISOString(),Jt.Namespace.XSD.term("dateTime"))]:[new En.Literal(String(e))]}isISO8601DateTime(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/.test(e)}removeQuotes(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.substring(1,t.length-1):e}extractWikilink(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1];return r.includes("|")?r.split("|")[0]:r}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1],i=r.indexOf("|");return i>=0?r.substring(i+1).trim():null}valueToClassURI(e){if(typeof e!="string")return new En.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);if(s)return s;let a=this.extractWikilinkAlias(t);if(a){let c=this.expandClassValue(a);if(c)return c}if(this.isUUID(i)){let c=this.vault.getFirstLinkpathDest(i,"");if(c){let l=this.expandClassValue(c.basename);if(l)return l;let u=this.vault.getFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return d}}}}return new En.Literal(t)}isClassReference(e){return nl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))&&!/\s/.test(e)}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}expandClassValue(e){let t=this.removeQuotes(e);for(let[r,i]of nl.NAMESPACE_MAP)if(t.startsWith(r))return i.term(t.substring(r.length));return null}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,r,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(r=i.exec(e))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.extractBodyWikilinks(s),c=Jt.Namespace.EXO.term("Asset_bodyLink");for(let l of a){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new cn.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new cn.Triple(t,c,f)):r.push(new cn.Triple(t,c,new En.Literal(l)))}else r.push(new cn.Triple(t,c,new En.Literal(l)))}}catch{}return r}};Pi.NoteToRDFConverter=Mo;Mo.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Mo.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Mo.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};Mo.NAMESPACE_MAP=[["exo__",Jt.Namespace.EXO],["ems__",Jt.Namespace.EMS],["exocmd__",Jt.Namespace.EXOCMD],["ims__",Jt.Namespace.IMS],["ztlk__",Jt.Namespace.ZTLK],["ptms__",Jt.Namespace.PTMS],["lit__",Jt.Namespace.LIT],["inbox__",Jt.Namespace.INBOX]];Pi.NoteToRDFConverter=Mo=nl=Z7([(0,bb.injectable)(),nx(0,(0,bb.inject)(sx.DI_TOKENS.IVaultAdapter)),nx(1,(0,bb.inject)(sx.DI_TOKENS.ILogger)),e8("design:paramtypes",[Object,Object])],Mo)});var Eb=S(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.FilterContainsOptimizer=void 0;var n8=xe(),i8=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,wb=class{static{o(this,"FilterContainsOptimizer")}constructor(){this.tripleStore=null,this.lastOptimizationHints=[]}setTripleStore(e){this.tripleStore=e}getLastOptimizationHints(){return this.lastOptimizationHints}clearHints(){this.lastOptimizationHints=[]}async optimize(e){return this.clearHints(),this.optimizeRecursive(e)}optimizeSync(e,t){return this.clearHints(),this.optimizeSyncRecursive(e,t)}async optimizeRecursive(e){return e.type==="filter"?this.optimizeFilter(e):e.type==="join"?{type:"join",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="leftjoin"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="union"?{type:"union",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="minus"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="project"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="orderby"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="slice"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="distinct"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="reduced"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="group"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="extend"?{...e,input:await this.optimizeRecursive(e.input)}:e}optimizeSyncRecursive(e,t){return e.type==="filter"?this.optimizeFilterSync(e,t):e.type==="join"?{type:"join",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="leftjoin"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="union"?{type:"union",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="minus"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="project"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="orderby"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="slice"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="distinct"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="reduced"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="group"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="extend"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e}async optimizeFilter(e){let t=this.detectContainsUUIDPattern(e.expression);if(!t)return{type:"filter",expression:e.expression,input:await this.optimizeRecursive(e.input)};let r=[];return this.tripleStore&&(r=await this.findSubjectsContainingUUID(t.uuid)),this.rewriteFilter(e,t,r)}optimizeFilterSync(e,t){let r=this.detectContainsUUIDPattern(e.expression);if(!r)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input,t)};let i=t?t.filter(s=>s.includes(r.uuid)):[];return this.rewriteFilter(e,r,i)}rewriteFilter(e,t,r){if(this.lastOptimizationHints.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${t.variable}), "${t.uuid}"))`,suggestedRewrite:r.length===1?`VALUES ?${t.variable} { <${r[0]}> }`:r.length>1?`VALUES ?${t.variable} { ${r.map(i=>`<${i}>`).join(" ")} }`:"No matching URIs found for UUID",estimatedSpeedup:r.length>0?"O(n) \u2192 O(1)":"N/A",matchedUri:r.length===1?r[0]:void 0}),r.length===0)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input)};if(r.length===1){let i=this.injectSubjectConstraint(e.input,t.variable,r[0]);if(i!==e.input)return i}return this.createValuesJoin(e,t,r)}detectContainsUUIDPattern(e){if(e.type==="function"||e.type==="functionCall"){let t=e;if((typeof t.function=="string"?t.function.toLowerCase():t.function?.value?.toLowerCase()??"")==="contains"&&t.args.length===2)return this.analyzeContainsArgs(t.args[0],t.args[1],e)}if(e.type==="logical"&&e.operator==="&&")for(let t of e.operands){let r=this.detectContainsUUIDPattern(t);if(r)return r}return null}analyzeContainsArgs(e,t,r){let i=null;if(e.type==="function"||e.type==="functionCall"){let s=e;if((typeof s.function=="string"?s.function.toLowerCase():s.function?.value?.toLowerCase()??"")==="str"&&s.args.length===1){let c=s.args[0];c.type==="variable"&&(i=c.name)}}if(!i&&e.type==="variable"&&(i=e.name),!i)return null;if(t.type==="literal"){let c=String(t.value).match(i8);if(c)return{variable:i,uuid:c[0].toLowerCase(),originalExpression:r}}return null}async findSubjectsContainingUUID(e){if(!this.tripleStore)return[];if(this.tripleStore.findSubjectsByUUID)return(await this.tripleStore.findSubjectsByUUID(e)).map(s=>s.value);let t=await this.tripleStore.subjects(),r=[];for(let i of t)i instanceof n8.IRI&&i.value.toLowerCase().includes(e.toLowerCase())&&r.push(i.value);return r}injectSubjectConstraint(e,t,r){if(e.type==="bgp"){let i=e.triples.map(a=>a.subject.type==="variable"&&a.subject.value===t?{...a,subject:{type:"iri",value:r}}:a);if(i.some((a,c)=>a.subject!==e.triples[c].subject))return{type:"bgp",triples:i}}if(e.type==="join"){let i=this.injectSubjectConstraint(e.left,t,r),s=this.injectSubjectConstraint(e.right,t,r);if(i!==e.left||s!==e.right)return{type:"join",left:i,right:s}}if(e.type==="filter"){let i=this.injectSubjectConstraint(e.input,t,r);if(i!==e.input)return{...e,input:i}}return e}createValuesJoin(e,t,r){return{type:"join",left:{type:"values",variables:[t.variable],bindings:r.map(a=>({[t.variable]:{type:"iri",value:a}}))},right:this.optimizeSyncRecursive(e.input)}}analyzeQuery(e){let t=[];return this.analyzeRecursive(e,t),t}analyzeRecursive(e,t){if(e.type==="filter"){let r=this.detectContainsUUIDPattern(e.expression);r&&t.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${r.variable}), "${r.uuid}"))`,suggestedRewrite:`Use --optimize flag or rewrite as VALUES ?${r.variable} { <uri-containing-uuid> }`,estimatedSpeedup:"O(n) \u2192 O(1) with UUID index lookup"}),this.analyzeRecursive(e.input,t);return}e.type==="join"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="leftjoin"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="union"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="minus"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="project"?this.analyzeRecursive(e.input,t):e.type==="orderby"?this.analyzeRecursive(e.input,t):e.type==="slice"?this.analyzeRecursive(e.input,t):e.type==="distinct"?this.analyzeRecursive(e.input,t):e.type==="reduced"?this.analyzeRecursive(e.input,t):e.type==="group"?this.analyzeRecursive(e.input,t):e.type==="extend"&&this.analyzeRecursive(e.input,t)}};tm.FilterContainsOptimizer=wb});var ax=S(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.AlgebraOptimizer=void 0;var s8=Eb(),Tb=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new s8.FilterContainsOptimizer}setTripleStore(e){this.tripleStore=e,this.filterContainsOptimizer.setTripleStore(e)}getOptimizationHints(){return this.filterContainsOptimizer.getLastOptimizationHints()}analyzeQuery(e){return this.filterContainsOptimizer.analyzeQuery(e)}optimize(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),t=this.filterPushDown(t),t=this.joinReordering(t),t}async optimizeAsync(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),this.tripleStore&&(t=await this.filterContainsOptimizer.optimize(t)),t=this.filterPushDown(t),t=this.joinReordering(t),t}optimizeWithSubjects(e,t){let r=e;return r=this.eliminateEmptyBGPInFilterJoin(r),r=this.filterContainsOptimizer.optimizeSync(r,t),r=this.filterPushDown(r),r=this.joinReordering(r),r}eliminateEmptyBGPInFilterJoin(e){if(e.type==="join"){if(e.left.type==="filter"){let t=e.left;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.right)}}if(e.right.type==="filter"){let t=e.right;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.left)}}return{type:"join",left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}}return e.type==="filter"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="leftjoin"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="union"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="minus"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="project"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="orderby"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="slice"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="distinct"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e}filterPushDown(e){return e.type==="filter"?this.pushDownFilter(e):e.type==="join"?{type:"join",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="leftjoin"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="union"?{type:"union",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="minus"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="project"?{...e,input:this.filterPushDown(e.input)}:e.type==="orderby"?{...e,input:this.filterPushDown(e.input)}:e.type==="slice"?{...e,input:this.filterPushDown(e.input)}:e.type==="distinct"?{...e,input:this.filterPushDown(e.input)}:e}pushDownFilter(e){let t=e.input;if(t.type==="join"){let r=this.getFilterVariables(e.expression),i=this.getOperationVariables(t.left),s=this.getOperationVariables(t.right),a=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return a&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!a?{type:"join",left:this.filterPushDown(t.left),right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:{type:"join",left:this.filterPushDown(t.left),right:this.filterPushDown(t.right)}}}return t.type==="union"?{type:"union",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:this.filterPushDown(t)}}getFilterVariables(e){let t=[];if(e.type==="variable")t.push(e.name);else if(e.type==="comparison")t.push(...this.getFilterVariables(e.left)),t.push(...this.getFilterVariables(e.right));else if(e.type==="logical")for(let r of e.operands)t.push(...this.getFilterVariables(r));else if(e.type==="function")for(let r of e.args)t.push(...this.getFilterVariables(r));return Array.from(new Set(t))}getOperationVariables(e){let t=new Set;if(e.type==="bgp")for(let r of e.triples)r.subject.type==="variable"&&t.add(r.subject.value),r.predicate.type==="variable"&&t.add(r.predicate.value),r.object.type==="variable"&&t.add(r.object.value);else if(e.type==="join"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="filter")return this.getOperationVariables(e.input);if(e.type==="leftjoin"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else if(e.type==="union"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="minus")return this.getOperationVariables(e.left);if(e.type==="project")return new Set(e.variables)}}return t}joinReordering(e){return e.type==="join"?this.reorderJoin(e):e.type==="filter"?{...e,input:this.joinReordering(e.input)}:e.type==="leftjoin"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="union"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="minus"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="project"?{...e,input:this.joinReordering(e.input)}:e.type==="orderby"?{...e,input:this.joinReordering(e.input)}:e.type==="slice"?{...e,input:this.joinReordering(e.input)}:e.type==="distinct"?{...e,input:this.joinReordering(e.input)}:e}reorderJoin(e){let t=this.isConstrained(e.left),r=this.isConstrained(e.right);if(r&&!t)return{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)};if(t&&!r)return{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)};let i=this.estimateCost(e.left);return this.estimateCost(e.right)<i?{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)}:{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)}}isConstrained(e){return e.type==="values"?!0:e.type==="bgp"?e.triples.some(t=>t.object.type!=="variable"||t.subject.type!=="variable"):e.type==="filter"?this.isConstrained(e.input):e.type==="join"?this.isConstrained(e.left)||this.isConstrained(e.right):e.type==="union"?this.isConstrained(e.left)&&this.isConstrained(e.right):!1}estimateCost(e){if(e.type==="bgp"){let t=0;for(let r of e.triples){let i=10;r.subject.type==="variable"&&(i*=10),r.predicate.type==="variable"&&(i*=20),r.object.type==="variable"&&(i*=5),t+=i}return t}if(e.type==="filter")return this.estimateCost(e.input)*.3;if(e.type==="join"){let t=this.estimateCost(e.left),r=this.estimateCost(e.right);return e.left.type==="values"||e.right.type==="values"?Math.min(t,r)*2:t*r}if(e.type==="leftjoin")return this.estimateCost(e.left)+this.estimateCost(e.right)*.5;if(e.type==="union")return this.estimateCost(e.left)+this.estimateCost(e.right);if(e.type==="values"){let t=e.bindings;return Array.isArray(t)?t.length*5:10}return e.type==="minus"?this.estimateCost(e.left)+this.estimateCost(e.right)*.3:100}setStatistics(e,t){this.stats.set(e,t)}getStatistics(e){return this.stats.get(e)}};rm.AlgebraOptimizer=Tb});var ox=S(nm=>{"use strict";Object.defineProperty(nm,"__esModule",{value:!0});nm.AlgebraSerializer=void 0;var Ab=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
377
|
+
`),t}};Kp.RDFSerializer=sb});var ob=S(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});Xp.RDFVocabularyMapper=void 0;var Xt=ri(),KA=xe(),X=Cr(),ab=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",X.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",X.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",X.Namespace.RDFS.term("subClassOf")],["exo__Property_range",X.Namespace.RDFS.term("range")],["exo__Property_domain",X.Namespace.RDFS.term("domain")],["exo__Property_superProperty",X.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new Xt.Triple(X.Namespace.EXO.term("Asset"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDFS.term("Resource"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Class"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDFS.term("Class"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.RDF.term("Property"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Task"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Project"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Area"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("Workflow"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("WorkflowState"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EMS.term("WorkflowTransition"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Command"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Precondition"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("Grounding"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e.push(new Xt.Triple(X.Namespace.EXOCMD.term("CommandBinding"),X.Namespace.RDFS.term("subClassOf"),X.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new Xt.Triple(X.Namespace.EXO.term("Instance_class"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDF.term("type"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Asset_isDefinedBy"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("isDefinedBy"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Class_superClass"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("subClassOf"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_range"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("range"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_domain"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("domain"))),e.push(new Xt.Triple(X.Namespace.EXO.term("Property_superProperty"),X.Namespace.RDFS.term("subPropertyOf"),X.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof KA.IRI)s=r;else{let a=r.match(/^(ems|exo|exocmd)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?X.Namespace.EMS:c==="exocmd"?X.Namespace.EXOCMD:X.Namespace.EXO).term(l)}else s=new KA.IRI(r)}return new Xt.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Xp.RDFVocabularyMapper=ab});var XA=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.RDFSInferenceEngine=void 0;var j7=ri(),Jp=xe(),cb=class{static{o(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(d=>d.value.includes("Class_superClass")),i=t.find(d=>d.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let a=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let d of l)if(d.object instanceof Jp.IRI){let h=a.get(d.object.value);if(h)for(let p of h)u.push(new j7.Triple(d.subject,i,new Jp.IRI(p)))}return u.length>0&&await e.addAll(u),await e.count()-c}async buildDirectParentMap(e,t){let r=await e.match(void 0,t),i=new Map;for(let s of r)if(s.subject instanceof Jp.IRI&&s.object instanceof Jp.IRI){let a=s.subject.value,c=s.object.value;i.has(a)||i.set(a,new Set),i.get(a).add(c)}return i}computeAllAncestors(e){let t=new Map;for(let r of e.keys())t.has(r)||t.set(r,this.computeAncestorsBFS(r,e));return t}computeAncestorsBFS(e,t){let r=new Set,i=new Set,s=[],a=t.get(e);if(a)for(let c of a)s.push(c);for(;s.length>0;){let c=s.shift();if(i.has(c))continue;i.add(c),r.add(c);let l=t.get(c);if(l)for(let u of l)i.has(u)||s.push(u)}return r}};Zp.RDFSInferenceEngine=cb});var fb=S(No=>{"use strict";var $7=No&&No.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(No,"__esModule",{value:!0});No.NonInheritablePropertyRegistry=void 0;var B7=ce(),JA=xe(),ZA=He(),lb=Cr(),ub=class{static{o(this,"NonInheritablePropertyRegistry")}constructor(){this.nonInheritableIRIs=new Set,this.initialized=!1}async initialize(e){this.nonInheritableIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Instance_class"));if(!r){this.initialized=!0;return}let i=await this.findNonInheritableClassIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let a=t.find(c=>c.value.includes("Asset_label"));if(!a){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,a,void 0);for(let u of l)if(u.object instanceof ZA.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.nonInheritableIRIs.add(d)}}}catch{}this.initialized=!0}isNonInheritable(e){return this.nonInheritableIRIs.has(e)}get size(){return this.nonInheritableIRIs.size}get isInitialized(){return this.initialized}async findNonInheritableClassIRI(e,t){let r=t.find(a=>a.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new ZA.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof JA.IRI)return i[0].subject;let s=t.find(a=>a.value.includes("Instance_class"));if(s){let a=await e.match(void 0,s,void 0);for(let c of a)if(c.object instanceof JA.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?lb.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?lb.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?lb.Namespace.EXOCMD.term(e.substring(8)).value:null}};No.NonInheritablePropertyRegistry=ub;No.NonInheritablePropertyRegistry=ub=$7([(0,B7.injectable)()],ub)});var pb=S(Lo=>{"use strict";var V7=Lo&&Lo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(Lo,"__esModule",{value:!0});Lo.PropertyCardinalityRegistry=void 0;var U7=ce(),ex=xe(),tx=He(),db=Cr(),hb=class{static{o(this,"PropertyCardinalityRegistry")}constructor(){this.multiValuedIRIs=new Set,this.initialized=!1}async initialize(e){this.multiValuedIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Property_cardinality"));if(!r){this.initialized=!0;return}let i=await this.findMultipleCardinalityIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let a=t.find(c=>c.value.includes("Asset_label"));if(!a){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,a,void 0);for(let u of l)if(u.object instanceof tx.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.multiValuedIRIs.add(d)}}}catch{}this.initialized=!0}isMultiValued(e){return this.multiValuedIRIs.has(e)}get size(){return this.multiValuedIRIs.size}get isInitialized(){return this.initialized}async findMultipleCardinalityIRI(e,t){let r=t.find(a=>a.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new tx.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof ex.IRI)return i[0].subject;let s=t.find(a=>a.value.includes("Instance_class"));if(s){let a=await e.match(void 0,s,void 0);for(let c of a)if(c.object instanceof ex.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?db.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?db.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?db.Namespace.EXOCMD.term(e.substring(8)).value:null}};Lo.PropertyCardinalityRegistry=hb;Lo.PropertyCardinalityRegistry=hb=V7([(0,U7.injectable)()],hb)});var yb=S(hr=>{"use strict";var q7=hr&&hr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},W7=hr&&hr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(hr,"__esModule",{value:!0});hr.PrototypeChainMaterializer=hr.MAX_PROTOTYPE_DEPTH=hr.INFERRED_GRAPH=void 0;hr.inferredGraphForDepth=mb;var G7=ce(),rx=ri(),Ia=xe(),z7=fb(),H7=pb();hr.INFERRED_GRAPH=new Ia.IRI("https://exocortex.my/ontology/exo#inferred");var Q7="https://exocortex.my/ontology/exo#inferred/";function mb(n){return new Ia.IRI(`${Q7}${n}`)}o(mb,"inferredGraphForDepth");hr.MAX_PROTOTYPE_DEPTH=10;var gb=class{static{o(this,"PrototypeChainMaterializer")}constructor(e,t){this.registry=e,this.cardinalityRegistry=t??null}async materialize(e){let r=(await e.predicates()).find(c=>c.value.includes("Asset_prototype"));if(!r)return 0;let i=await e.match(void 0,r,void 0);if(i.length===0)return 0;let s=new Map;for(let c of i)if(c.subject instanceof Ia.IRI&&c.object instanceof Ia.IRI){let l=c.subject.value,u=c.object.value;l!==u&&s.set(l,c.object)}if(s.size===0)return 0;let a=0;for(let[c]of s){let l=new Ia.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let _=p.object instanceof Ia.IRI?p.object.value:String(p.object),b=h.get(p.predicate.value);b||(b=new Set,h.set(p.predicate.value,b)),b.add(_)}for(let p=0;p<u.length;p++){let _=u[p],b=p+1,E=new Ia.IRI(_),v=await e.match(E,void 0,void 0),A=new Set;if(e.matchInGraph){let R=await e.matchInGraph(E,void 0,void 0,hr.INFERRED_GRAPH);for(let B of R)A.add(B.predicate.value)}for(let R of v){let B=R.predicate.value;if(this.registry.isNonInheritable(B)||A.has(B))continue;if(d.has(B)&&this.isMultiValued(B)){let ve=R.object instanceof Ia.IRI?R.object.value:String(R.object);if(h.get(B)?.has(ve))continue;let G=h.get(B);G||(G=new Set,h.set(B,G)),G.add(ve);let F=new rx.Triple(l,R.predicate,R.object);await e.add(F),e.addToGraph&&(await e.addToGraph(F,hr.INFERRED_GRAPH),await e.addToGraph(F,mb(b))),a++;continue}if(d.has(B))continue;let W=new rx.Triple(l,R.predicate,R.object);await e.add(W),e.addToGraph&&(await e.addToGraph(W,hr.INFERRED_GRAPH),await e.addToGraph(W,mb(b))),d.add(B),a++}}}return a}isMultiValued(e){return this.cardinalityRegistry?this.cardinalityRegistry.isMultiValued(e):!1}resolveChain(e,t){let r=[],i=new Set;i.add(e);let s=[],a=t.get(e);for(a&&s.push(a.value);s.length>0&&r.length<hr.MAX_PROTOTYPE_DEPTH;){let c=s.shift();if(c===void 0)break;if(i.has(c))continue;i.add(c),r.push(c);let l=t.get(c);l&&!i.has(l.value)&&s.push(l.value)}return r}};hr.PrototypeChainMaterializer=gb;hr.PrototypeChainMaterializer=gb=q7([(0,G7.injectable)(),W7("design:paramtypes",[z7.NonInheritablePropertyRegistry,H7.PropertyCardinalityRegistry])],gb)});var Sb=S(ar=>{"use strict";var Y7=ar&&ar.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},K7=ar&&ar.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ar,"__esModule",{value:!0});ar.SourceAnnotator=ar.DEPTH_VARIABLE=ar.SOURCE_VARIABLE=void 0;var X7=ce(),rl=He(),J7=xe(),em=yb();ar.SOURCE_VARIABLE="_source";ar.DEPTH_VARIABLE="_depth";var _b=class{static{o(this,"SourceAnnotator")}constructor(e){this.tripleStore=e}async annotate(e,t,r,i){if(!this.tripleStore.matchInGraph)return e.map(a=>{let c=a.clone();return c.set(ar.SOURCE_VARIABLE,new rl.Literal("own")),c});let s=[];for(let a of e){let c=a.get(t),l=a.get(r),u=a.get(i),f=a.clone();if(!c||!l||!u)f.set(ar.SOURCE_VARIABLE,new rl.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(ar.SOURCE_VARIABLE,new rl.Literal(d))}s.push(f)}return s}async annotateSingle(e,t,r,i){return(await this.annotate([e],t,r,i))[0]}async determineSource(e,t,r){return this.tripleStore.matchInGraph&&(await this.tripleStore.matchInGraph(e,t,r,em.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=em.MAX_PROTOTYPE_DEPTH;i++){let s=(0,em.inferredGraphForDepth)(i);if((await this.tripleStore.matchInGraph(e,t,r,s)).length>0)return i}return 0}async annotateBySubject(e,t){if(!this.tripleStore.matchInGraph)return e.map(s=>{let a=s.clone();return a.set(ar.SOURCE_VARIABLE,new rl.Literal("own")),a});let r=[],i=new Map;for(let s of e){let a=s.get(t),c=s.clone();if(!a||!(a instanceof J7.IRI))c.set(ar.SOURCE_VARIABLE,new rl.Literal("own"));else{let l=a.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(a,void 0,void 0,em.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(ar.SOURCE_VARIABLE,new rl.Literal(u))}r.push(c)}return r}};ar.SourceAnnotator=_b;ar.SourceAnnotator=_b=Y7([(0,X7.injectable)(),K7("design:paramtypes",[Object])],_b)});var vb=S(Pi=>{"use strict";var Z7=Pi&&Pi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},e8=Pi&&Pi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},nx=Pi&&Pi.__param||function(n,e){return function(t,r){e(t,r,n)}},nl;Object.defineProperty(Pi,"__esModule",{value:!0});Pi.NoteToRDFConverter=void 0;var bb=ce(),cn=ri(),ko=xe(),En=He(),ix=qt(),Jt=Cr(),sx=wt(),t8=ob(),r8=Hu(),Tn=v0(),Mo=nl=class{static{o(this,"NoteToRDFConverter")}constructor(e,t=r8.NullLogger){this.vault=e,this.logger=t,this.OBSIDIAN_VAULT_SCHEME="obsidian://vault/",this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new t8.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?Tn.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Jt.Namespace.EXO.term("Asset_fileName");r.push(new cn.Triple(i,s,new En.Literal(e.basename)));for(let[c,l]of Object.entries(t)){if(!this.isExocortexProperty(c))continue;let u=this.propertyKeyToIRI(c),f=Array.isArray(l)?l:[l];for(let d of f)if(c==="exo__Instance_class"){let h=this.valueToClassURI(d);r.push(new cn.Triple(i,u,h))}else{let h=await this.valueToRDFObject(d,e);for(let p of h)if(r.push(new cn.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof ko.IRI){let _=this.vocabularyMapper.generateMappedTriple(i,c,p);_&&r.push(_)}}if(c==="exo__Instance_class")for(let d of f){let h=this.valueToClassURI(d);if(h instanceof ko.IRI){let p=Jt.Namespace.RDF.term("type");r.push(new cn.Triple(i,p,h))}}if(c==="exo__Asset_label"){let d=Jt.Namespace.RDFS.term("label");for(let h of f)typeof h=="string"&&h.length>0&&r.push(new cn.Triple(i,d,new En.Literal(h)))}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=Tn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Tn.Exo003MetadataType.Namespace:break;case Tn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Tn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Tn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Tn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new ko.IRI(t.uri);return[new cn.Triple(r,Jt.Namespace.OWL.term("sameAs"),i),new cn.Triple(i,Jt.Namespace.OWL.term("sameAs"),r)]}convertExo003BlankNode(e,t){let r=this.notePathToIRI(e.path),i=t.uri.replace(/[^a-zA-Z0-9_-]/g,"_");return[new cn.Triple(r,Jt.Namespace.OWL.term("sameAs"),new ix.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Tn.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new cn.Triple(a,Jt.Namespace.RDF.term("value"),s.subject))}catch{}return r}async convertExo003Body(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.createExo003ReferenceResolver(e),c=a(t.subject),l=a(t.predicate);if(c.type==="literal")throw new Error("Body subject cannot be a literal");if(l.type!=="iri")throw new Error("Body predicate must be an IRI");let u=c.type==="iri"?new ko.IRI(c.value):new ix.BlankNode(c.value),f=new ko.IRI(l.value),d=Tn.Exo003Parser.toLiteral(t,s.trim());r.push(new cn.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new cn.Triple(h,Jt.Namespace.RDF.term("value"),u))}catch{}return r}createExo003ReferenceResolver(e){return t=>{let r=this.extractWikilink(t),i=r||t,s=this.vault.getFirstLinkpathDest(i,e.path);if(s){let a=this.vault.getFrontmatter(s);if(a&&Tn.Exo003Parser.isExo003Format(a)){let c=Tn.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Tn.Exo003MetadataType.Anchor||l.metadata===Tn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Tn.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=await this.convertNote(a);r.push(...c)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),this.logger.warn(`Skipping file with invalid IRI: ${a.path}`,{reason:l})}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=encodeURI(r.path),s=`${this.OBSIDIAN_VAULT_SCHEME}${i}`;ko.IRI.isValidIRI(s)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){let t=encodeURI(e);return new ko.IRI(`${this.OBSIDIAN_VAULT_SCHEME}${t}`)}isExocortexProperty(e){return nl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))}propertyKeyToIRI(e){for(let[t,r]of nl.NAMESPACE_MAP)if(e.startsWith(t))return r.term(e.substring(t.length));throw new Error(`Invalid property key: ${e}`)}async valueToRDFObject(e,t){if(typeof e=="string"){let r=this.removeQuotes(e),i=this.extractWikilink(r);if(i){let s=this.vault.getFirstLinkpathDest(i,t.path);if(s){let a=this.notePathToIRI(s.path),c=i.includes("|")?i.split("|")[0]:i;if(this.isUUID(c)){let u=new En.Literal(c),f=this.expandClassValue(s.basename);if(f)return[f];let d=this.vault.getFrontmatter(s);if(d){let h=d.exo__Asset_label;if(typeof h=="string"){let p=this.expandClassValue(h);if(p)return[p]}}return[a,u]}let l=this.expandClassValue(s.basename);return l?[l]:[a]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return[new En.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new En.Literal(r,Jt.Namespace.XSD.term("dateTime"))]:[new En.Literal(r)]}return typeof e=="boolean"?[new En.Literal(e.toString())]:typeof e=="number"?[new En.Literal(e.toString(),Jt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new En.Literal(e.toISOString(),Jt.Namespace.XSD.term("dateTime"))]:[new En.Literal(String(e))]}isISO8601DateTime(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/.test(e)}removeQuotes(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.substring(1,t.length-1):e}extractWikilink(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1];return r.includes("|")?r.split("|")[0]:r}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1],i=r.indexOf("|");return i>=0?r.substring(i+1).trim():null}valueToClassURI(e){if(typeof e!="string")return new En.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);if(s)return s;let a=this.extractWikilinkAlias(t);if(a){let c=this.expandClassValue(a);if(c)return c}if(this.isUUID(i)){let c=this.vault.getFirstLinkpathDest(i,"");if(c){let l=this.expandClassValue(c.basename);if(l)return l;let u=this.vault.getFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return d}}}}return new En.Literal(t)}isClassReference(e){return nl.NAMESPACE_MAP.some(([t])=>e.startsWith(t))&&!/\s/.test(e)}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}expandClassValue(e){let t=this.removeQuotes(e);for(let[r,i]of nl.NAMESPACE_MAP)if(t.startsWith(r))return i.term(t.substring(r.length));return null}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,r,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(r=i.exec(e))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.extractBodyWikilinks(s),c=Jt.Namespace.EXO.term("Asset_bodyLink");for(let l of a){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new cn.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new cn.Triple(t,c,f)):r.push(new cn.Triple(t,c,new En.Literal(l)))}else r.push(new cn.Triple(t,c,new En.Literal(l)))}}catch{}return r}};Pi.NoteToRDFConverter=Mo;Mo.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Mo.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Mo.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};Mo.NAMESPACE_MAP=[["exo__",Jt.Namespace.EXO],["ems__",Jt.Namespace.EMS],["exocmd__",Jt.Namespace.EXOCMD],["ims__",Jt.Namespace.IMS],["ztlk__",Jt.Namespace.ZTLK],["ptms__",Jt.Namespace.PTMS],["lit__",Jt.Namespace.LIT],["inbox__",Jt.Namespace.INBOX]];Pi.NoteToRDFConverter=Mo=nl=Z7([(0,bb.injectable)(),nx(0,(0,bb.inject)(sx.DI_TOKENS.IVaultAdapter)),nx(1,(0,bb.inject)(sx.DI_TOKENS.ILogger)),e8("design:paramtypes",[Object,Object])],Mo)});var Eb=S(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.FilterContainsOptimizer=void 0;var n8=xe(),i8=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,wb=class{static{o(this,"FilterContainsOptimizer")}constructor(){this.tripleStore=null,this.lastOptimizationHints=[]}setTripleStore(e){this.tripleStore=e}getLastOptimizationHints(){return this.lastOptimizationHints}clearHints(){this.lastOptimizationHints=[]}async optimize(e){return this.clearHints(),this.optimizeRecursive(e)}optimizeSync(e,t){return this.clearHints(),this.optimizeSyncRecursive(e,t)}async optimizeRecursive(e){return e.type==="filter"?this.optimizeFilter(e):e.type==="join"?{type:"join",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="leftjoin"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="union"?{type:"union",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="minus"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="project"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="orderby"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="slice"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="distinct"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="reduced"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="group"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="extend"?{...e,input:await this.optimizeRecursive(e.input)}:e}optimizeSyncRecursive(e,t){return e.type==="filter"?this.optimizeFilterSync(e,t):e.type==="join"?{type:"join",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="leftjoin"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="union"?{type:"union",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="minus"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="project"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="orderby"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="slice"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="distinct"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="reduced"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="group"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="extend"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e}async optimizeFilter(e){let t=this.detectContainsUUIDPattern(e.expression);if(!t)return{type:"filter",expression:e.expression,input:await this.optimizeRecursive(e.input)};let r=[];return this.tripleStore&&(r=await this.findSubjectsContainingUUID(t.uuid)),this.rewriteFilter(e,t,r)}optimizeFilterSync(e,t){let r=this.detectContainsUUIDPattern(e.expression);if(!r)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input,t)};let i=t?t.filter(s=>s.includes(r.uuid)):[];return this.rewriteFilter(e,r,i)}rewriteFilter(e,t,r){if(this.lastOptimizationHints.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${t.variable}), "${t.uuid}"))`,suggestedRewrite:r.length===1?`VALUES ?${t.variable} { <${r[0]}> }`:r.length>1?`VALUES ?${t.variable} { ${r.map(i=>`<${i}>`).join(" ")} }`:"No matching URIs found for UUID",estimatedSpeedup:r.length>0?"O(n) \u2192 O(1)":"N/A",matchedUri:r.length===1?r[0]:void 0}),r.length===0)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input)};if(r.length===1){let i=this.injectSubjectConstraint(e.input,t.variable,r[0]);if(i!==e.input)return i}return this.createValuesJoin(e,t,r)}detectContainsUUIDPattern(e){if(e.type==="function"||e.type==="functionCall"){let t=e;if((typeof t.function=="string"?t.function.toLowerCase():t.function?.value?.toLowerCase()??"")==="contains"&&t.args.length===2)return this.analyzeContainsArgs(t.args[0],t.args[1],e)}if(e.type==="logical"&&e.operator==="&&")for(let t of e.operands){let r=this.detectContainsUUIDPattern(t);if(r)return r}return null}analyzeContainsArgs(e,t,r){let i=null;if(e.type==="function"||e.type==="functionCall"){let s=e;if((typeof s.function=="string"?s.function.toLowerCase():s.function?.value?.toLowerCase()??"")==="str"&&s.args.length===1){let c=s.args[0];c.type==="variable"&&(i=c.name)}}if(!i&&e.type==="variable"&&(i=e.name),!i)return null;if(t.type==="literal"){let c=String(t.value).match(i8);if(c)return{variable:i,uuid:c[0].toLowerCase(),originalExpression:r}}return null}async findSubjectsContainingUUID(e){if(!this.tripleStore)return[];if(this.tripleStore.findSubjectsByUUID)return(await this.tripleStore.findSubjectsByUUID(e)).map(s=>s.value);let t=await this.tripleStore.subjects(),r=[];for(let i of t)i instanceof n8.IRI&&i.value.toLowerCase().includes(e.toLowerCase())&&r.push(i.value);return r}injectSubjectConstraint(e,t,r){if(e.type==="bgp"){let i=e.triples.map(a=>a.subject.type==="variable"&&a.subject.value===t?{...a,subject:{type:"iri",value:r}}:a);if(i.some((a,c)=>a.subject!==e.triples[c].subject))return{type:"bgp",triples:i}}if(e.type==="join"){let i=this.injectSubjectConstraint(e.left,t,r),s=this.injectSubjectConstraint(e.right,t,r);if(i!==e.left||s!==e.right)return{type:"join",left:i,right:s}}if(e.type==="filter"){let i=this.injectSubjectConstraint(e.input,t,r);if(i!==e.input)return{...e,input:i}}return e}createValuesJoin(e,t,r){return{type:"join",left:{type:"values",variables:[t.variable],bindings:r.map(a=>({[t.variable]:{type:"iri",value:a}}))},right:this.optimizeSyncRecursive(e.input)}}analyzeQuery(e){let t=[];return this.analyzeRecursive(e,t),t}analyzeRecursive(e,t){if(e.type==="filter"){let r=this.detectContainsUUIDPattern(e.expression);r&&t.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${r.variable}), "${r.uuid}"))`,suggestedRewrite:`Use --optimize flag or rewrite as VALUES ?${r.variable} { <uri-containing-uuid> }`,estimatedSpeedup:"O(n) \u2192 O(1) with UUID index lookup"}),this.analyzeRecursive(e.input,t);return}e.type==="join"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="leftjoin"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="union"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="minus"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="project"?this.analyzeRecursive(e.input,t):e.type==="orderby"?this.analyzeRecursive(e.input,t):e.type==="slice"?this.analyzeRecursive(e.input,t):e.type==="distinct"?this.analyzeRecursive(e.input,t):e.type==="reduced"?this.analyzeRecursive(e.input,t):e.type==="group"?this.analyzeRecursive(e.input,t):e.type==="extend"&&this.analyzeRecursive(e.input,t)}};tm.FilterContainsOptimizer=wb});var ax=S(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.AlgebraOptimizer=void 0;var s8=Eb(),Tb=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new s8.FilterContainsOptimizer}setTripleStore(e){this.tripleStore=e,this.filterContainsOptimizer.setTripleStore(e)}getOptimizationHints(){return this.filterContainsOptimizer.getLastOptimizationHints()}analyzeQuery(e){return this.filterContainsOptimizer.analyzeQuery(e)}optimize(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),t=this.filterPushDown(t),t=this.joinReordering(t),t}async optimizeAsync(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),this.tripleStore&&(t=await this.filterContainsOptimizer.optimize(t)),t=this.filterPushDown(t),t=this.joinReordering(t),t}optimizeWithSubjects(e,t){let r=e;return r=this.eliminateEmptyBGPInFilterJoin(r),r=this.filterContainsOptimizer.optimizeSync(r,t),r=this.filterPushDown(r),r=this.joinReordering(r),r}eliminateEmptyBGPInFilterJoin(e){if(e.type==="join"){if(e.left.type==="filter"){let t=e.left;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.right)}}if(e.right.type==="filter"){let t=e.right;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.left)}}return{type:"join",left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}}return e.type==="filter"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="leftjoin"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="union"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="minus"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="project"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="orderby"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="slice"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="distinct"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e}filterPushDown(e){return e.type==="filter"?this.pushDownFilter(e):e.type==="join"?{type:"join",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="leftjoin"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="union"?{type:"union",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="minus"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="project"?{...e,input:this.filterPushDown(e.input)}:e.type==="orderby"?{...e,input:this.filterPushDown(e.input)}:e.type==="slice"?{...e,input:this.filterPushDown(e.input)}:e.type==="distinct"?{...e,input:this.filterPushDown(e.input)}:e}pushDownFilter(e){let t=e.input;if(t.type==="join"){let r=this.getFilterVariables(e.expression),i=this.getOperationVariables(t.left),s=this.getOperationVariables(t.right),a=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return a&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!a?{type:"join",left:this.filterPushDown(t.left),right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:{type:"join",left:this.filterPushDown(t.left),right:this.filterPushDown(t.right)}}}return t.type==="union"?{type:"union",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:this.filterPushDown(t)}}getFilterVariables(e){let t=[];if(e.type==="variable")t.push(e.name);else if(e.type==="comparison")t.push(...this.getFilterVariables(e.left)),t.push(...this.getFilterVariables(e.right));else if(e.type==="logical")for(let r of e.operands)t.push(...this.getFilterVariables(r));else if(e.type==="function")for(let r of e.args)t.push(...this.getFilterVariables(r));return Array.from(new Set(t))}getOperationVariables(e){let t=new Set;if(e.type==="bgp")for(let r of e.triples)r.subject.type==="variable"&&t.add(r.subject.value),r.predicate.type==="variable"&&t.add(r.predicate.value),r.object.type==="variable"&&t.add(r.object.value);else if(e.type==="join"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="filter")return this.getOperationVariables(e.input);if(e.type==="leftjoin"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else if(e.type==="union"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="minus")return this.getOperationVariables(e.left);if(e.type==="project")return new Set(e.variables)}}return t}joinReordering(e){return e.type==="join"?this.reorderJoin(e):e.type==="filter"?{...e,input:this.joinReordering(e.input)}:e.type==="leftjoin"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="union"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="minus"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="project"?{...e,input:this.joinReordering(e.input)}:e.type==="orderby"?{...e,input:this.joinReordering(e.input)}:e.type==="slice"?{...e,input:this.joinReordering(e.input)}:e.type==="distinct"?{...e,input:this.joinReordering(e.input)}:e}reorderJoin(e){let t=this.isConstrained(e.left),r=this.isConstrained(e.right);if(r&&!t)return{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)};if(t&&!r)return{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)};let i=this.estimateCost(e.left);return this.estimateCost(e.right)<i?{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)}:{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)}}isConstrained(e){return e.type==="values"?!0:e.type==="bgp"?e.triples.some(t=>t.object.type!=="variable"||t.subject.type!=="variable"):e.type==="filter"?this.isConstrained(e.input):e.type==="join"?this.isConstrained(e.left)||this.isConstrained(e.right):e.type==="union"?this.isConstrained(e.left)&&this.isConstrained(e.right):!1}estimateCost(e){if(e.type==="bgp"){let t=0;for(let r of e.triples){let i=10;r.subject.type==="variable"&&(i*=10),r.predicate.type==="variable"&&(i*=20),r.object.type==="variable"&&(i*=5),t+=i}return t}if(e.type==="filter")return this.estimateCost(e.input)*.3;if(e.type==="join"){let t=this.estimateCost(e.left),r=this.estimateCost(e.right);return e.left.type==="values"||e.right.type==="values"?Math.min(t,r)*2:t*r}if(e.type==="leftjoin")return this.estimateCost(e.left)+this.estimateCost(e.right)*.5;if(e.type==="union")return this.estimateCost(e.left)+this.estimateCost(e.right);if(e.type==="values"){let t=e.bindings;return Array.isArray(t)?t.length*5:10}return e.type==="minus"?this.estimateCost(e.left)+this.estimateCost(e.right)*.3:100}setStatistics(e,t){this.stats.set(e,t)}getStatistics(e){return this.stats.get(e)}};rm.AlgebraOptimizer=Tb});var ox=S(nm=>{"use strict";Object.defineProperty(nm,"__esModule",{value:!0});nm.AlgebraSerializer=void 0;var Ab=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
378
378
|
${e.triples.map(u=>`${r} ${this.tripleToString(u)}`).join(`
|
|
379
379
|
`)}
|
|
380
380
|
${r}]`;case"filter":return`${r}Filter(
|
|
@@ -790,7 +790,7 @@ exo__BacklinksTableBlock_columns:${f==="[]"?" []":f}
|
|
|
790
790
|
--- END PREVIEW ---
|
|
791
791
|
`)}o(SY,"printDryRunReport");function bY(n,e){let r=[`--- MIGRATION ${e.apply?"APPLY":"DRY RUN"} ---`,`Migrated pairs: ${n.pairs.length}`,`Skipped configs: ${n.skipped.length}`];e.apply&&(r.push(`Files written to: ${e.outDir}/ (relative to vault root)`),r.push(`Total files written: ${n.pairs.length*2} (${n.pairs.length} Layout + ${n.pairs.length} Block)`));for(let i of n.skipped)r.push(` SKIPPED: ${i.sourcePath} \u2014 ${i.reason}`);return r.push(`--- END SUMMARY ---
|
|
792
792
|
`),r.join(`
|
|
793
|
-
`)}o(bY,"formatSummary");function vY(n,e){return{mode:e.apply?"apply":"dry-run",outDir:e.outDir,pairsCount:n.pairs.length,skippedCount:n.skipped.length,pairs:n.pairs.map(t=>({sourceUid:t.sourceUid,sourcePath:t.sourcePath,layoutUid:t.layout.uid,blockUid:t.block.uid,warnings:t.warnings})),skipped:n.skipped}}o(vY,"summariseResult");function iD(n){n.addCommand(qO()),n.addCommand(HO()),n.addCommand(QO())}o(iD,"addQuerySubcommands");function sD(n){let e=new Ie;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.125.
|
|
793
|
+
`)}o(bY,"formatSummary");function vY(n,e){return{mode:e.apply?"apply":"dry-run",outDir:e.outDir,pairsCount:n.pairs.length,skippedCount:n.skipped.length,pairs:n.pairs.map(t=>({sourceUid:t.sourceUid,sourcePath:t.sourcePath,layoutUid:t.layout.uid,blockUid:t.block.uid,warnings:t.warnings})),skipped:n.skipped}}o(vY,"summariseResult");function iD(n){n.addCommand(qO()),n.addCommand(HO()),n.addCommand(QO())}o(iD,"addQuerySubcommands");function sD(n){let e=new Ie;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.125.1");let t=e.command("exoql").description("ExoQL query execution and cache management");iD(t);let r=e.command("sparql").description("(deprecated) Use 'exoql' instead");return iD(r),r.hook("preAction",()=>{console.error('\u26A0\uFE0F "sparql" is deprecated. Use "exoql" instead.')}),e.addCommand(rF()),e.addCommand(sF()),e.addCommand(aF()),e.addCommand(cF()),e.addCommand(lF()),e.addCommand(pF()),e.addCommand(_F()),e.addCommand(xF()),e.addCommand(RF()),e.addCommand(NF()),e.addCommand(MF()),e.addCommand(jF()),e.addCommand(BF()),e.addCommand(zF()),e.addCommand(KF()),e.addCommand(nD()),e}o(sD,"createProgram");sD().parse();0&&(module.exports={createProgram});
|
|
794
794
|
/*! Bundled license information:
|
|
795
795
|
|
|
796
796
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED