@kitelev/exocortex-cli 15.144.0 → 15.145.0
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 +5 -5
- 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.
|
|
2
|
+
// @kitelev/exocortex-cli v15.145.0
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -28,7 +28,7 @@ Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
28
28
|
`),this.outputHelp({error:!0}));let r=t||{},i=r.exitCode||1,s=r.code||"commander.error";this._exit(i,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in it.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,it.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new iN(this.options),t=o(r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r)),"hasCustomOptionValue");this.options.filter(r=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,r.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=o(a=>{let c=a.attributeName(),l=this.getOptionValue(c),u=this.options.find(d=>d.negate&&c===d.attributeName()),f=this.options.find(d=>!d.negate&&c===d.attributeName());return u&&(u.presetArg===void 0&&l===!1||u.presetArg!==void 0&&l===u.presetArg)?u:f||a},"findBestOptionFromValue"),i=o(a=>{let c=r(a),l=c.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${c.envVar}'`:`option '${c.flags}'`},"getErrorMessage"),s=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(c=>c.long).map(c=>c.long);i=i.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);t=g2(e,i)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(s=>{i.push(s.name()),s.alias()&&i.push(s.alias())}),t=g2(e,i)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let i=this.createOption(t,r);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
29
29
|
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let i=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(r=>tN(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Ps.basename(e,Ps.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let i=t.formatHelp(this,t);return r.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,r,i,s;return t?(r=o(c=>this._outputConfiguration.writeErr(c),"baseWrite"),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(r=o(c=>this._outputConfiguration.writeOut(c),"baseWrite"),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o(c=>(i||(c=this._outputConfiguration.stripColor(c)),r(c)),"write"),hasColors:i,helpWidth:s}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let r=this._getOutputContext(e),i={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation({error:r.error});if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(it.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
30
30
|
Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,s=>{let a;typeof t=="function"?a=t({error:s.error,command:s.command}):a=t,a&&s.write(`${a}
|
|
31
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function y2(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?i=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],i=s[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}o(y2,"incrementNodeInspectorPort");function Vy(){if(it.env.NO_COLOR||it.env.FORCE_COLOR==="0"||it.env.FORCE_COLOR==="false")return!1;if(it.env.FORCE_COLOR||it.env.CLICOLOR_FORCE!==void 0)return!0}o(Vy,"useColor");Uy.Command=By;Uy.useColor=Vy});var w2=S(Bn=>{var{Argument:S2}=Md(),{Command:qy}=_2(),{CommanderError:sN,InvalidArgumentError:b2}=yu(),{Help:aN}=Dy(),{Option:v2}=My();Bn.program=new qy;Bn.createCommand=n=>new qy(n);Bn.createOption=(n,e)=>new v2(n,e);Bn.createArgument=(n,e)=>new S2(n,e);Bn.Command=qy;Bn.Option=v2;Bn.Argument=S2;Bn.Help=aN;Bn.CommanderError=sN;Bn.InvalidArgumentError=b2;Bn.InvalidOptionArgumentError=b2});var _u=S($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.AssetClass=void 0;var T2;(function(n){n.AREA="ems__Area",n.TASK="ems__Task",n.PROJECT="ems__Project",n.MEETING="ems__Meeting",n.INITIATIVE="ems__Initiative",n.TASK_PROTOTYPE="ems__TaskPrototype",n.MEETING_PROTOTYPE="ems__MeetingPrototype",n.EVENT_PROTOTYPE="exo__EventPrototype",n.PROJECT_PROTOTYPE="ems__ProjectPrototype",n.EVENT="exo__Event",n.DAILY_NOTE="pn__DailyNote",n.CONCEPT="ims__Concept",n.SESSION_START_EVENT="ems__SessionStartEvent",n.SESSION_END_EVENT="ems__SessionEndEvent",n.PROTOTYPE="exo__Prototype",n.CLASS="exo__Class",n.FLEETING_NOTE="ztlk__FleetingNote",n.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition",n.COMMAND="exocmd__Command",n.PRECONDITION="exocmd__Precondition",n.GROUNDING="exocmd__Grounding",n.COMMAND_BINDING="exocmd__CommandBinding"})(T2||($d.AssetClass=T2={}))});var hc=S(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.EffortStatus=void 0;var A2;(function(n){n.DRAFT="ems__EffortStatusDraft",n.BACKLOG="ems__EffortStatusBacklog",n.ANALYSIS="ems__EffortStatusAnalysis",n.TODO="ems__EffortStatusToDo",n.DOING="ems__EffortStatusDoing",n.DONE="ems__EffortStatusDone",n.TRASHED="ems__EffortStatusTrashed"})(A2||(Bd.EffortStatus=A2={}))});var Wy=S(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.EFFORT_STATUS_OPTIONS=Wt.STATUS_NAME_TO_WIKILINK=Wt.STATUS_NAME_TO_ENUM=Wt.EFFORT_STATUS_CONFIG=void 0;Wt.normalizeEffortStatus=oN;Wt.isDoneStatus=cN;Wt.isTrashedStatus=lN;Wt.getEffortStatusLabel=uN;var Ji=hc();Wt.EFFORT_STATUS_CONFIG=[{name:"Draft",status:Ji.EffortStatus.DRAFT,wikilink:"[[ems__EffortStatusDraft]]"},{name:"Backlog",status:Ji.EffortStatus.BACKLOG,wikilink:"[[ems__EffortStatusBacklog]]"},{name:"Analysis",status:Ji.EffortStatus.ANALYSIS,wikilink:"[[ems__EffortStatusAnalysis]]"},{name:"To Do",status:Ji.EffortStatus.TODO,wikilink:"[[ems__EffortStatusToDo]]"},{name:"Doing",status:Ji.EffortStatus.DOING,wikilink:"[[ems__EffortStatusDoing]]"},{name:"Done",status:Ji.EffortStatus.DONE,wikilink:"[[ems__EffortStatusDone]]"},{name:"Trashed",status:Ji.EffortStatus.TRASHED,wikilink:"[[ems__EffortStatusTrashed]]"}];Wt.STATUS_NAME_TO_ENUM=Object.fromEntries(Wt.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.status]));Wt.STATUS_NAME_TO_WIKILINK=Object.fromEntries(Wt.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.wikilink]));Wt.EFFORT_STATUS_OPTIONS=Wt.EFFORT_STATUS_CONFIG.map(n=>({value:n.wikilink,label:n.name}));function oN(n,e=Ji.EffortStatus.DRAFT){if(n.startsWith("ems__")){let r=Wt.EFFORT_STATUS_CONFIG.find(i=>i.status===n);return r?r.status:e}return Wt.STATUS_NAME_TO_ENUM[n]??e}o(oN,"normalizeEffortStatus");function cN(n){return n===Ji.EffortStatus.DONE}o(cN,"isDoneStatus");function lN(n){return n===Ji.EffortStatus.TRASHED}o(lN,"isTrashedStatus");function uN(n){if(!n)return"-";let e=String(n);if(e==="")return"-";for(let r of Wt.EFFORT_STATUS_CONFIG)if(r.wikilink===e||`[[${e}]]`===r.wikilink||r.status===e||r.name===e)return r.name;let t=e.toLowerCase();for(let r of Wt.EFFORT_STATUS_CONFIG)if(r.name.toLowerCase()===t)return r.name;return e}o(uN,"getEffortStatusLabel")});var pc=S(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.GroundingType=void 0;var x2;(function(n){n.SPARQL_UPDATE="sparql_update",n.PROPERTY_DELETE="property_delete",n.PROPERTY_SET="property_set",n.COMPOSITE="composite",n.SERVICE_CALL="service_call",n.CREATE_INSTANCE="create_instance"})(x2||(Vd.GroundingType=x2={}))});var Gy=S(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.CommandBindingStyleProperty=Vn.CommandBindingProperty=Vn.GroundingProperty=Vn.PreconditionProperty=Vn.CommandProperty=void 0;Vn.CommandProperty={ICON:"exocmd__Command_icon",PRECONDITION:"exocmd__Command_precondition",GROUNDING:"exocmd__Command_grounding",CONFIRM_MESSAGE:"exocmd__Command_confirmMessage",SUCCESS_MESSAGE:"exocmd__Command_successMessage",CATEGORY:"exocmd__Command_category"};Vn.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};Vn.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",TARGET_VALUE:"exocmd__Grounding_targetValue",STEPS:"exocmd__Grounding_steps"};Vn.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",GROUP:"exocmd__CommandBinding_group",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};Vn.CommandBindingStyleProperty={VARIANT:"exocmd__CommandBindingStyle_variant",SHOW_ICON:"exocmd__CommandBindingStyle_showIcon",LABEL_CLASS:"exocmd__CommandBindingStyle_labelClass",ARIA_LABEL:"exocmd__CommandBindingStyle_ariaLabel",TOOLTIP:"exocmd__CommandBindingStyle_tooltip",KEYBOARD_SHORTCUT:"exocmd__CommandBindingStyle_keyboardShortcut",SOURCE:"exocmd__CommandBindingStyle_source"}});var zy=S(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.STYLE_SOURCE_VALUES=_n.LABEL_CLASS_VALUES=_n.COMMAND_VARIANT_VALUES=void 0;_n.isCommandVariant=fN;_n.isLabelClass=dN;_n.isStyleSource=hN;_n.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);_n.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);_n.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function fN(n){return typeof n=="string"&&_n.COMMAND_VARIANT_VALUES.includes(n)}o(fN,"isCommandVariant");function dN(n){return typeof n=="string"&&_n.LABEL_CLASS_VALUES.includes(n)}o(dN,"isLabelClass");function hN(n){return typeof n=="string"&&_n.STYLE_SOURCE_VALUES.includes(n)}o(hN,"isStyleSource")});var C2=S(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.isCommandFrontmatter=pN;mc.isPreconditionFrontmatter=mN;mc.isGroundingFrontmatter=gN;mc.isCommandBindingFrontmatter=yN;function pN(n){return Ud(n,"exocmd__Command")}o(pN,"isCommandFrontmatter");function mN(n){return Ud(n,"exocmd__Precondition")}o(mN,"isPreconditionFrontmatter");function gN(n){return Ud(n,"exocmd__Grounding")}o(gN,"isGroundingFrontmatter");function yN(n){return Ud(n,"exocmd__CommandBinding")}o(yN,"isCommandBindingFrontmatter");function Ud(n,e){let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}o(Ud,"hasInstanceClass")});var I2=S(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.hasPosition=_N;qd.isFixed=SN;function _N(n){return typeof n.x=="number"&&typeof n.y=="number"}o(_N,"hasPosition");function SN(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(SN,"isFixed")});var R2=S(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.createEmptyGraphData=bN;Wd.mergeGraphData=vN;function bN(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(bN,"createEmptyGraphData");function vN(n,e){let t=new Map,r=new Set,i=[];for(let s of n.nodes)t.set(s.id,s);for(let s of e.nodes)t.set(s.id,s);for(let s of n.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}for(let s of e.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}o(vN,"mergeGraphData")});var Hy=S(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.createEdgeId=wN;Gd.edgesEqual=EN;function wN(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(wN,"createEdgeId");function EN(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(EN,"edgesEqual")});var Qy=S($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.BUILT_IN_EDGE_STYLES=$t.BUILT_IN_NODE_STYLES=$t.DEFAULT_EDGE_STYLE=$t.DEFAULT_NODE_STYLE=$t.RDF_TYPE_PREDICATES=void 0;$t.mergeNodeStyles=TN;$t.mergeEdgeStyles=AN;$t.extractLocalName=xN;$t.isClassType=CN;$t.isTypePredicate=IN;$t.isSubClassPredicate=RN;$t.RDF_TYPE_PREDICATES={RDF_TYPE:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",RDFS_CLASS:"http://www.w3.org/2000/01/rdf-schema#Class",OWL_CLASS:"http://www.w3.org/2002/07/owl#Class",RDFS_SUBCLASS_OF:"http://www.w3.org/2000/01/rdf-schema#subClassOf",OWL_EQUIVALENT_CLASS:"http://www.w3.org/2002/07/owl#equivalentClass",RDFS_LABEL:"http://www.w3.org/2000/01/rdf-schema#label",RDFS_COMMENT:"http://www.w3.org/2000/01/rdf-schema#comment"};$t.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};$t.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};$t.BUILT_IN_NODE_STYLES={"http://www.w3.org/2000/01/rdf-schema#Class":{color:"#f59e0b",shape:"diamond",size:40},"http://www.w3.org/2002/07/owl#Class":{color:"#f59e0b",shape:"diamond",size:40},ems__Task:{color:"#22c55e",shape:"circle"},ems__Project:{color:"#3b82f6",shape:"square"},ems__Area:{color:"#8b5cf6",shape:"hexagon",size:40},ems__Meeting:{color:"#ec4899",shape:"circle"},exo__Class:{color:"#f59e0b",shape:"diamond"},ims__Person:{color:"#06b6d4",shape:"circle"}};$t.BUILT_IN_EDGE_STYLES={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":{color:"#f59e0b",lineStyle:"dashed",arrow:"standard"},"http://www.w3.org/2000/01/rdf-schema#subClassOf":{color:"#8b5cf6",width:2,arrow:"triangle"},"https://exocortex.my/ontology/ems#Effort_parent":{color:"#6366f1",width:2,arrow:"standard"},"https://exocortex.my/ontology/exo#Asset_prototype":{color:"#f59e0b",lineStyle:"dashed",arrow:"circle"},"https://exocortex.my/ontology/exo#references":{color:"#22c55e",opacity:.4,arrow:"standard"}};function TN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(TN,"mergeNodeStyles");function AN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(AN,"mergeEdgeStyles");function xN(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(xN,"extractLocalName");function CN(n){return n===$t.RDF_TYPE_PREDICATES.RDFS_CLASS||n===$t.RDF_TYPE_PREDICATES.OWL_CLASS}o(CN,"isClassType");function IN(n){return n===$t.RDF_TYPE_PREDICATES.RDF_TYPE}o(IN,"isTypePredicate");function RN(n){return n===$t.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(RN,"isSubClassPredicate")});var P2=S(O2=>{"use strict";Object.defineProperty(O2,"__esModule",{value:!0})});var Ce=S(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.IRI=void 0;var Yy=class n{static{o(this,"IRI")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("IRI cannot be empty");if(!n.isValidIRI(t))throw new Error("Invalid IRI format");this._value=t}get value(){return this._value}equals(e){return this._value===e._value}toString(){return this._value}static isValidIRI(e){if(!e||e.trim().length===0||/\s/.test(e)||!/^[a-z][a-z0-9+.-]*:/i.test(e))return!1;let r=["http","https","ftp","ftps","file","mailto","tel","data","ws","wss","urn","obsidian"],i=e.match(/^([a-z][a-z0-9+.-]*?):/i);if(i){let s=i[1].toLowerCase();if(!r.includes(s))return!1}try{return new URL(e),!0}catch{return/^urn:[a-z0-9][a-z0-9-]{0,31}:[^\s]+$/i.test(e)}}};zd.IRI=Yy});var Ve=S(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.Literal=void 0;oo.parseLanguageTag=F2;oo.createDirectionalLiteral=PN;oo.createLiteralFromLanguageTag=FN;var ON="http://www.w3.org/2001/XMLSchema#string",Su=class{static{o(this,"Literal")}constructor(e,t,r,i){if(e.length===0)throw new Error("Literal value cannot be empty");if(t&&r)throw new Error("Literal cannot have both datatype and language tag");if(i&&!r)throw new Error("Literal cannot have direction without language tag");if(i&&i!=="ltr"&&i!=="rtl")throw new Error('Direction must be "ltr" or "rtl"');this._value=e,this._datatype=t,this._language=r?r.toLowerCase():void 0,this._direction=i}get value(){return this._value}get datatype(){return this._datatype}get language(){return this._language}get direction(){return this._direction}hasDirection(){return this._direction!==void 0}equals(e){if(this._value!==e._value||this._language!==e._language||this._direction!==e._direction)return!1;let t=this.normalizedDatatype(),r=e.normalizedDatatype();return t===r}normalizedDatatype(){return!this._datatype||this._datatype.value===ON?null:this._datatype.value}toString(){let e=`"${this._value}"`;return this._datatype?e+=`^^<${this._datatype.value}>`:this._language&&(e+=`@${this._language}`,this._direction&&(e+=`--${this._direction}`)),e}};oo.Literal=Su;function F2(n){let t=n.lastIndexOf("--");if(t===-1)return{language:n.toLowerCase()};let r=n.substring(t+2),i=n.substring(0,t);return r==="ltr"||r==="rtl"?{language:i.toLowerCase(),direction:r}:{language:n.toLowerCase()}}o(F2,"parseLanguageTag");function PN(n,e,t){return new Su(n,void 0,e,t)}o(PN,"createDirectionalLiteral");function FN(n,e){let{language:t,direction:r}=F2(e);return new Su(n,void 0,t,r)}o(FN,"createLiteralFromLanguageTag")});var Gt=S(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.BlankNode=void 0;var Hd=class n{static{o(this,"BlankNode")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("BlankNode id cannot be empty");this._id=t}get id(){return this._id}equals(e){return this._id===e._id}toString(){return`_:${this._id}`}static generateId(){return`b${++n.counter}`}static create(){return new n(n.generateId())}};Qd.BlankNode=Hd;Hd.counter=0});var Ir=S(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.Namespace=void 0;var D2=Ce(),ft=class{static{o(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new D2.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new D2.IRI(`${this._iri.value}${e}`)}expand(e){let t=e.split(":");if(t.length!==2)return null;let[r,i]=t;return r!==this._prefix?null:this.term(i)}};Yd.Namespace=ft;ft.RDF=new ft("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");ft.RDFS=new ft("rdfs","http://www.w3.org/2000/01/rdf-schema#");ft.OWL=new ft("owl","http://www.w3.org/2002/07/owl#");ft.XSD=new ft("xsd","http://www.w3.org/2001/XMLSchema#");ft.EXO=new ft("exo","https://exocortex.my/ontology/exo#");ft.EMS=new ft("ems","https://exocortex.my/ontology/ems#");ft.EXOCMD=new ft("exocmd","https://exocortex.my/ontology/exocmd#");ft.IMS=new ft("ims","https://exocortex.my/ontology/ims#");ft.ZTLK=new ft("ztlk","https://exocortex.my/ontology/ztlk#");ft.PTMS=new ft("ptms","https://exocortex.my/ontology/ptms#");ft.LIT=new ft("lit","https://exocortex.my/ontology/lit#");ft.INBOX=new ft("inbox","https://exocortex.my/ontology/inbox#");ft.PMBOK=new ft("pmbok","https://exocortex.my/ontology/pmbok#")});var ii=S(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.Triple=void 0;var Ky=Ce(),Xy=Ve(),Jy=Gt(),Zy=class{static{o(this,"Triple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof Ky.IRI&&t instanceof Ky.IRI||e instanceof Jy.BlankNode&&t instanceof Jy.BlankNode||e instanceof Xy.Literal&&t instanceof Xy.Literal||this.isQuotedTriple(e)&&this.isQuotedTriple(t)?e.equals(t):!1}isQuotedTriple(e){return typeof e=="object"&&e!==null&&"termType"in e&&e.termType==="QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`${e} ${t} ${r} .`}nodeToString(e){return e instanceof Ky.IRI?`<${e.value}>`:e instanceof Jy.BlankNode||e instanceof Xy.Literal||this.isQuotedTriple(e)?e.toString():""}};Kd.Triple=Zy});var bu=S(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.QuotedTriple=void 0;var e0=Ce(),t0=Ve(),r0=Gt(),n0=class n{static{o(this,"QuotedTriple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof e0.IRI&&t instanceof e0.IRI||e instanceof r0.BlankNode&&t instanceof r0.BlankNode||e instanceof t0.Literal&&t instanceof t0.Literal||e instanceof n&&t instanceof n?e.equals(t):!1}get termType(){return"QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`<< ${e} ${t} ${r} >>`}nodeToString(e){return e instanceof e0.IRI?`<${e.value}>`:e instanceof r0.BlankNode||e instanceof t0.Literal||e instanceof n?e.toString():""}};Xd.QuotedTriple=n0});var N2=S(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.QuotedTriple=Xt.Triple=Xt.Namespace=Xt.BlankNode=Xt.createLiteralFromLanguageTag=Xt.createDirectionalLiteral=Xt.parseLanguageTag=Xt.Literal=Xt.IRI=void 0;var DN=Ce();Object.defineProperty(Xt,"IRI",{enumerable:!0,get:o(function(){return DN.IRI},"get")});var Jd=Ve();Object.defineProperty(Xt,"Literal",{enumerable:!0,get:o(function(){return Jd.Literal},"get")});Object.defineProperty(Xt,"parseLanguageTag",{enumerable:!0,get:o(function(){return Jd.parseLanguageTag},"get")});Object.defineProperty(Xt,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return Jd.createDirectionalLiteral},"get")});Object.defineProperty(Xt,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return Jd.createLiteralFromLanguageTag},"get")});var NN=Gt();Object.defineProperty(Xt,"BlankNode",{enumerable:!0,get:o(function(){return NN.BlankNode},"get")});var LN=Ir();Object.defineProperty(Xt,"Namespace",{enumerable:!0,get:o(function(){return LN.Namespace},"get")});var kN=ii();Object.defineProperty(Xt,"Triple",{enumerable:!0,get:o(function(){return kN.Triple},"get")});var MN=bu();Object.defineProperty(Xt,"QuotedTriple",{enumerable:!0,get:o(function(){return MN.QuotedTriple},"get")})});var Zd=S(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.UUID_URL_NAMESPACE=qn.DEFAULT_LANGUAGE_TAG=qn.REQUIRED_PROPERTIES=qn.ALLOWED_PROPERTIES=qn.Exo003MetadataType=void 0;var Un;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(Un||(qn.Exo003MetadataType=Un={}));qn.ALLOWED_PROPERTIES={[Un.Namespace]:["metadata","uri","aliases"],[Un.Anchor]:["metadata","uri","aliases"],[Un.BlankNode]:["metadata","uri","aliases"],[Un.Statement]:["metadata","subject","predicate","object","aliases"],[Un.Body]:["metadata","subject","predicate","aliases"]};qn.REQUIRED_PROPERTIES={[Un.Namespace]:["metadata","uri"],[Un.Anchor]:["metadata","uri"],[Un.BlankNode]:["metadata","uri"],[Un.Statement]:["metadata","subject","predicate","object"],[Un.Body]:["metadata","subject","predicate"]};qn.DEFAULT_LANGUAGE_TAG="ru";qn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var L2=S(i0=>{"use strict";Object.defineProperty(i0,"__esModule",{value:!0});i0.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var k2=S(s0=>{"use strict";Object.defineProperty(s0,"__esModule",{value:!0});s0.default="00000000-0000-0000-0000-000000000000"});var M2=S(a0=>{"use strict";Object.defineProperty(a0,"__esModule",{value:!0});a0.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var vu=S(o0=>{"use strict";Object.defineProperty(o0,"__esModule",{value:!0});var jN=M2();function $N(n){return typeof n=="string"&&jN.default.test(n)}o($N,"validate");o0.default=$N});var wu=S(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0});var BN=vu();function VN(n){if(!(0,BN.default)(n))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(n.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(n.slice(9,13),16))>>>8,e&255,(e=parseInt(n.slice(14,18),16))>>>8,e&255,(e=parseInt(n.slice(19,23),16))>>>8,e&255,(e=parseInt(n.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}o(VN,"parse");c0.default=VN});var Fs=S(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.unsafeStringify=void 0;var UN=vu(),Rr=[];for(let n=0;n<256;++n)Rr.push((n+256).toString(16).slice(1));function j2(n,e=0){return(Rr[n[e+0]]+Rr[n[e+1]]+Rr[n[e+2]]+Rr[n[e+3]]+"-"+Rr[n[e+4]]+Rr[n[e+5]]+"-"+Rr[n[e+6]]+Rr[n[e+7]]+"-"+Rr[n[e+8]]+Rr[n[e+9]]+"-"+Rr[n[e+10]]+Rr[n[e+11]]+Rr[n[e+12]]+Rr[n[e+13]]+Rr[n[e+14]]+Rr[n[e+15]]).toLowerCase()}o(j2,"unsafeStringify");Eu.unsafeStringify=j2;function qN(n,e=0){let t=j2(n,e);if(!(0,UN.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(qN,"stringify");Eu.default=qN});var rh=S(l0=>{"use strict";Object.defineProperty(l0,"__esModule",{value:!0});var WN=require("crypto"),th=new Uint8Array(256),eh=th.length;function GN(){return eh>th.length-16&&((0,WN.randomFillSync)(th),eh=0),th.slice(eh,eh+=16)}o(GN,"rng");l0.default=GN});var u0=S(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.updateV1State=void 0;var $2=rh(),zN=Fs(),Tu={};function HN(n,e,t){let r,i=n?._v6??!1;if(n){let s=Object.keys(n);s.length===1&&s[0]==="_v6"&&(n=void 0)}if(n)r=B2(n.random??n.rng?.()??(0,$2.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,$2.default)();V2(Tu,s,a),r=B2(a,Tu.msecs,Tu.nsecs,i?void 0:Tu.clockseq,i?void 0:Tu.node,e,t)}return e??(0,zN.unsafeStringify)(r)}o(HN,"v1");function V2(n,e,t){return n.msecs??=-1/0,n.nsecs??=0,e===n.msecs?(n.nsecs++,n.nsecs>=1e4&&(n.node=void 0,n.nsecs=0)):e>n.msecs?n.nsecs=0:e<n.msecs&&(n.node=void 0),n.node||(n.node=t.slice(10,16),n.node[0]|=1,n.clockseq=(t[8]<<8|t[9])&16383),n.msecs=e,n}o(V2,"updateV1State");Au.updateV1State=V2;function B2(n,e,t,r,i,s,a=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),a=0;else if(a<0||a+16>s.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);e??=Date.now(),t??=0,r??=(n[8]<<8|n[9])&16383,i??=n.slice(10,16),e+=122192928e5;let c=((e&268435455)*1e4+t)%4294967296;s[a++]=c>>>24&255,s[a++]=c>>>16&255,s[a++]=c>>>8&255,s[a++]=c&255;let l=e/4294967296*1e4&268435455;s[a++]=l>>>8&255,s[a++]=l&255,s[a++]=l>>>24&15|16,s[a++]=l>>>16&255,s[a++]=r>>>8|128,s[a++]=r&255;for(let u=0;u<6;++u)s[a++]=i[u];return s}o(B2,"v1Bytes");Au.default=HN});var d0=S(f0=>{"use strict";Object.defineProperty(f0,"__esModule",{value:!0});var QN=wu(),YN=Fs();function KN(n){let e=typeof n=="string"?(0,QN.default)(n):n,t=XN(e);return typeof n=="string"?(0,YN.unsafeStringify)(t):t}o(KN,"v1ToV6");f0.default=KN;function XN(n){return Uint8Array.of((n[6]&15)<<4|n[7]>>4&15,(n[7]&15)<<4|(n[4]&240)>>4,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,(n[1]&15)<<4|(n[2]&240)>>4,96|n[2]&15,n[3],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(XN,"_v1ToV6")});var U2=S(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var JN=require("crypto");function ZN(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,JN.createHash)("md5").update(n).digest()}o(ZN,"md5");h0.default=ZN});var xu=S(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.URL=Ds.DNS=Ds.stringToBytes=void 0;var q2=wu(),eL=Fs();function W2(n){n=unescape(encodeURIComponent(n));let e=new Uint8Array(n.length);for(let t=0;t<n.length;++t)e[t]=n.charCodeAt(t);return e}o(W2,"stringToBytes");Ds.stringToBytes=W2;Ds.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ds.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function tL(n,e,t,r,i,s){let a=typeof t=="string"?W2(t):t,c=typeof r=="string"?(0,q2.default)(r):r;if(typeof r=="string"&&(r=(0,q2.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+a.length);if(l.set(c),l.set(a,c.length),l=e(l),l[6]=l[6]&15|n,l[8]=l[8]&63|128,i){s=s||0;for(let u=0;u<16;++u)i[s+u]=l[u];return i}return(0,eL.unsafeStringify)(l)}o(tL,"v35");Ds.default=tL});var z2=S(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.URL=co.DNS=void 0;var rL=U2(),p0=xu(),G2=xu();Object.defineProperty(co,"DNS",{enumerable:!0,get:o(function(){return G2.DNS},"get")});Object.defineProperty(co,"URL",{enumerable:!0,get:o(function(){return G2.URL},"get")});function m0(n,e,t,r){return(0,p0.default)(48,rL.default,n,e,t,r)}o(m0,"v3");m0.DNS=p0.DNS;m0.URL=p0.URL;co.default=m0});var H2=S(g0=>{"use strict";Object.defineProperty(g0,"__esModule",{value:!0});var nL=require("crypto");g0.default={randomUUID:nL.randomUUID}});var Y2=S(y0=>{"use strict";Object.defineProperty(y0,"__esModule",{value:!0});var Q2=H2(),iL=rh(),sL=Fs();function aL(n,e,t){if(Q2.default.randomUUID&&!e&&!n)return Q2.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,iL.default)();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return(0,sL.unsafeStringify)(r)}o(aL,"v4");y0.default=aL});var K2=S(_0=>{"use strict";Object.defineProperty(_0,"__esModule",{value:!0});var oL=require("crypto");function cL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,oL.createHash)("sha1").update(n).digest()}o(cL,"sha1");_0.default=cL});var J2=S(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.URL=lo.DNS=void 0;var lL=K2(),S0=xu(),X2=xu();Object.defineProperty(lo,"DNS",{enumerable:!0,get:o(function(){return X2.DNS},"get")});Object.defineProperty(lo,"URL",{enumerable:!0,get:o(function(){return X2.URL},"get")});function b0(n,e,t,r){return(0,S0.default)(80,lL.default,n,e,t,r)}o(b0,"v5");b0.DNS=S0.DNS;b0.URL=S0.URL;lo.default=b0});var Z2=S(v0=>{"use strict";Object.defineProperty(v0,"__esModule",{value:!0});var uL=Fs(),fL=u0(),dL=d0();function hL(n,e,t){n??={},t??=0;let r=(0,fL.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,dL.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,uL.unsafeStringify)(r)}o(hL,"v6");v0.default=hL});var eT=S(w0=>{"use strict";Object.defineProperty(w0,"__esModule",{value:!0});var pL=wu(),mL=Fs();function gL(n){let e=typeof n=="string"?(0,pL.default)(n):n,t=yL(e);return typeof n=="string"?(0,mL.unsafeStringify)(t):t}o(gL,"v6ToV1");w0.default=gL;function yL(n){return Uint8Array.of((n[3]&15)<<4|n[4]>>4&15,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|n[6]&15,n[7],(n[1]&15)<<4|(n[2]&240)>>4,(n[2]&15)<<4|(n[3]&240)>>4,16|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(yL,"_v6ToV1")});var iT=S(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.updateV7State=void 0;var tT=rh(),_L=Fs(),E0={};function SL(n,e,t){let r;if(n)r=rT(n.random??n.rng?.()??(0,tT.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,tT.default)();nT(E0,i,s),r=rT(s,E0.msecs,E0.seq,e,t)}return e??(0,_L.unsafeStringify)(r)}o(SL,"v7");function nT(n,e,t){return n.msecs??=-1/0,n.seq??=0,e>n.msecs?(n.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],n.msecs=e):(n.seq=n.seq+1|0,n.seq===0&&n.msecs++),n}o(nT,"updateV7State");Cu.updateV7State=nT;function rT(n,e,t,r,i=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return e??=Date.now(),t??=n[6]*127<<24|n[7]<<16|n[8]<<8|n[9],r[i++]=e/1099511627776&255,r[i++]=e/4294967296&255,r[i++]=e/16777216&255,r[i++]=e/65536&255,r[i++]=e/256&255,r[i++]=e&255,r[i++]=112|t>>>28&15,r[i++]=t>>>20&255,r[i++]=128|t>>>14&63,r[i++]=t>>>6&255,r[i++]=t<<2&255|n[10]&3,r[i++]=n[11],r[i++]=n[12],r[i++]=n[13],r[i++]=n[14],r[i++]=n[15],r}o(rT,"v7Bytes");Cu.default=SL});var sT=S(T0=>{"use strict";Object.defineProperty(T0,"__esModule",{value:!0});var bL=vu();function vL(n){if(!(0,bL.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(vL,"version");T0.default=vL});var Sn=S(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.version=ot.validate=ot.v7=ot.v6ToV1=ot.v6=ot.v5=ot.v4=ot.v3=ot.v1ToV6=ot.v1=ot.stringify=ot.parse=ot.NIL=ot.MAX=void 0;var wL=L2();Object.defineProperty(ot,"MAX",{enumerable:!0,get:o(function(){return wL.default},"get")});var EL=k2();Object.defineProperty(ot,"NIL",{enumerable:!0,get:o(function(){return EL.default},"get")});var TL=wu();Object.defineProperty(ot,"parse",{enumerable:!0,get:o(function(){return TL.default},"get")});var AL=Fs();Object.defineProperty(ot,"stringify",{enumerable:!0,get:o(function(){return AL.default},"get")});var xL=u0();Object.defineProperty(ot,"v1",{enumerable:!0,get:o(function(){return xL.default},"get")});var CL=d0();Object.defineProperty(ot,"v1ToV6",{enumerable:!0,get:o(function(){return CL.default},"get")});var IL=z2();Object.defineProperty(ot,"v3",{enumerable:!0,get:o(function(){return IL.default},"get")});var RL=Y2();Object.defineProperty(ot,"v4",{enumerable:!0,get:o(function(){return RL.default},"get")});var OL=J2();Object.defineProperty(ot,"v5",{enumerable:!0,get:o(function(){return OL.default},"get")});var PL=Z2();Object.defineProperty(ot,"v6",{enumerable:!0,get:o(function(){return PL.default},"get")});var FL=eT();Object.defineProperty(ot,"v6ToV1",{enumerable:!0,get:o(function(){return FL.default},"get")});var DL=iT();Object.defineProperty(ot,"v7",{enumerable:!0,get:o(function(){return DL.default},"get")});var NL=vu();Object.defineProperty(ot,"validate",{enumerable:!0,get:o(function(){return NL.default},"get")});var LL=sT();Object.defineProperty(ot,"version",{enumerable:!0,get:o(function(){return LL.default},"get")})});var C0=S(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.Exo003UUIDGenerator=void 0;var A0=Sn(),aT=Zd(),x0=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,A0.v5)(e,aT.UUID_URL_NAMESPACE)}static generateAssetUUID(e,t){if(!t||t.trim().length===0)throw new Error("Local identifier cannot be empty");let r=this.generateNamespaceUUID(e);return(0,A0.v5)(t,r)}static generateFromIRI(e){if(!e||e.trim().length===0)throw new Error("IRI cannot be empty");let{namespace:t,localName:r}=this.splitIRI(e);return r?this.generateAssetUUID(t,r):(0,A0.v5)(e,aT.UUID_URL_NAMESPACE)}static generateBlankNodeUUID(e,t){if(!e||e.trim().length===0)throw new Error("Blank node ID cannot be empty");let r="urn:exocortex:blank-node:",i=t?`${t}#${e}`:e;return this.generateAssetUUID(r,i)}static generateStatementUUID(e,t,r){if(!e||!t||!r)throw new Error("Subject, predicate, and object cannot be empty");let i="urn:exocortex:statement:",s=`${e} ${t} ${r}`;return this.generateAssetUUID(i,s)}static generateBodyUUID(e,t){let r="urn:exocortex:body:",i=e;return t?.datatype?i+=`^^${t.datatype}`:t?.language&&(i+=`@${t.language}`,t.direction&&(i+=`--${t.direction}`)),this.generateAssetUUID(r,i)}static splitIRI(e){let t=e.lastIndexOf("#");if(t!==-1&&t<e.length-1)return{namespace:e.substring(0,t+1),localName:e.substring(t+1)};let r=e.lastIndexOf("/"),i=e.indexOf("://");return r!==-1&&r>i+2&&r<e.length-1?{namespace:e.substring(0,r+1),localName:e.substring(r+1)}:{namespace:e,localName:""}}static isValidUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};nh.Exo003UUIDGenerator=x0});var cT=S(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.Exo003Parser=void 0;var mt=Zd(),Iu=C0(),da=Ce(),ih=Ve(),oT=Gt(),kL=ii(),I0=class{static{o(this,"Exo003Parser")}static parse(e,t){let r=this.validate(e);if(!r.valid)return{success:!1,errors:r.errors};let i=e.metadata;try{return{success:!0,metadata:this.parseByType(e,i),bodyContent:i===mt.Exo003MetadataType.Body?t:void 0}}catch(s){return{success:!1,errors:[s instanceof Error?s.message:String(s)]}}}static validate(e){let t=[],r=[];if(!e.metadata)return t.push("Missing required property: metadata"),{valid:!1,errors:t,warnings:r};let i=e.metadata;if(!Object.values(mt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(mt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=mt.ALLOWED_PROPERTIES[s],c=mt.REQUIRED_PROPERTIES[s];for(let l of c)(e[l]===void 0||e[l]===null)&&t.push(`Missing required property: ${l}`);for(let l of Object.keys(e))a.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case mt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case mt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case mt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case mt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case mt.Exo003MetadataType.Body:this.validateBodyMetadata(e,t,r);break}return{valid:t.length===0,errors:t,warnings:r}}static parseByType(e,t){let r={metadata:t,aliases:e.aliases};switch(t){case mt.Exo003MetadataType.Namespace:return{...r,metadata:mt.Exo003MetadataType.Namespace,uri:e.uri};case mt.Exo003MetadataType.Anchor:return{...r,metadata:mt.Exo003MetadataType.Anchor,uri:e.uri};case mt.Exo003MetadataType.BlankNode:return{...r,metadata:mt.Exo003MetadataType.BlankNode,uri:e.uri};case mt.Exo003MetadataType.Statement:return{...r,metadata:mt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case mt.Exo003MetadataType.Body:return{...r,metadata:mt.Exo003MetadataType.Body,subject:e.subject,predicate:e.predicate}}}static validateNamespaceMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new da.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateAnchorMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new da.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateBlankNodeMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r){let i=r;if(!i.startsWith("_:"))try{new da.IRI(i)}catch{t.push(`uri is not a valid IRI or blank node identifier: ${String(r)}`)}}}static validateStatementMetadata(e,t){let r=e.subject,i=e.predicate,s=e.object,a=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of a)l&&typeof l!="string"&&t.push(`${c} must be a string`)}static validateBodyMetadata(e,t,r){let i=e.subject,s=e.predicate;i&&typeof i!="string"&&t.push("subject must be a string"),s&&typeof s!="string"&&t.push("predicate must be a string")}static toTriple(e,t,r){let i=t(e.subject),s;if(i.type==="iri")s=new da.IRI(i.value);else if(i.type==="blank")s=new oT.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let a=t(e.predicate);if(a.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new da.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new da.IRI(l.value);else if(l.type==="blank")u=new oT.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new ih.Literal(f,new da.IRI(l.datatype));else{let d=l.language||mt.DEFAULT_LANGUAGE_TAG;u=(0,ih.createDirectionalLiteral)(f,d,l.direction)}}return new kL.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new ih.Literal(t,new da.IRI(r.datatype));let i=r?.language||mt.DEFAULT_LANGUAGE_TAG;return(0,ih.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(mt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case mt.Exo003MetadataType.Namespace:return Iu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Anchor:return Iu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.BlankNode:return Iu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Statement:{let r=e;return Iu.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case mt.Exo003MetadataType.Body:{let r=e;return Iu.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};sh.Exo003Parser=I0});var R0=S($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.Exo003Parser=$r.Exo003UUIDGenerator=$r.UUID_URL_NAMESPACE=$r.DEFAULT_LANGUAGE_TAG=$r.REQUIRED_PROPERTIES=$r.ALLOWED_PROPERTIES=$r.Exo003MetadataType=void 0;var Ru=Zd();Object.defineProperty($r,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Ru.Exo003MetadataType},"get")});Object.defineProperty($r,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Ru.ALLOWED_PROPERTIES},"get")});Object.defineProperty($r,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Ru.REQUIRED_PROPERTIES},"get")});Object.defineProperty($r,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Ru.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty($r,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Ru.UUID_URL_NAMESPACE},"get")});var ML=C0();Object.defineProperty($r,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return ML.Exo003UUIDGenerator},"get")});var jL=cT();Object.defineProperty($r,"Exo003Parser",{enumerable:!0,get:o(function(){return jL.Exo003Parser},"get")})});var Ns=S(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.WikiLinkHelpers=void 0;var Ou=class{static{o(this,"WikiLinkHelpers")}static normalize(e){if(!e)return"";let t=e.replace(this.WIKI_LINK_PATTERN,"").trim();if(!t)return"";let r=t.indexOf("|");if(r===-1)return t;let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();return this.UUID_PATTERN.test(i)&&s||i}static normalizeArray(e){return e?(Array.isArray(e)?e:[e]).map(r=>this.normalize(r)).filter(r=>r.length>0):[]}static equals(e,t){return this.normalize(e)===this.normalize(t)}static includes(e,t){let r=this.normalizeArray(e),i=this.normalize(t);return r.includes(i)}};ah.WikiLinkHelpers=Ou;Ou.WIKI_LINK_PATTERN=/\[\[|\]\]/g;Ou.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var Pn=S(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.CommandBindingProperty=et.GroundingProperty=et.PreconditionProperty=et.CommandProperty=et.GroundingType=et.getEffortStatusLabel=et.isTrashedStatus=et.isDoneStatus=et.normalizeEffortStatus=et.EFFORT_STATUS_OPTIONS=et.STATUS_NAME_TO_WIKILINK=et.STATUS_NAME_TO_ENUM=et.EFFORT_STATUS_CONFIG=et.EffortStatus=et.AssetClass=void 0;var $L=_u();Object.defineProperty(et,"AssetClass",{enumerable:!0,get:o(function(){return $L.AssetClass},"get")});var BL=hc();Object.defineProperty(et,"EffortStatus",{enumerable:!0,get:o(function(){return BL.EffortStatus},"get")});var ha=Wy();Object.defineProperty(et,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return ha.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(et,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return ha.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(et,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return ha.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(et,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return ha.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(et,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return ha.normalizeEffortStatus},"get")});Object.defineProperty(et,"isDoneStatus",{enumerable:!0,get:o(function(){return ha.isDoneStatus},"get")});Object.defineProperty(et,"isTrashedStatus",{enumerable:!0,get:o(function(){return ha.isTrashedStatus},"get")});Object.defineProperty(et,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return ha.getEffortStatusLabel},"get")});var VL=pc();Object.defineProperty(et,"GroundingType",{enumerable:!0,get:o(function(){return VL.GroundingType},"get")});var oh=Gy();Object.defineProperty(et,"CommandProperty",{enumerable:!0,get:o(function(){return oh.CommandProperty},"get")});Object.defineProperty(et,"PreconditionProperty",{enumerable:!0,get:o(function(){return oh.PreconditionProperty},"get")});Object.defineProperty(et,"GroundingProperty",{enumerable:!0,get:o(function(){return oh.GroundingProperty},"get")});Object.defineProperty(et,"CommandBindingProperty",{enumerable:!0,get:o(function(){return oh.CommandBindingProperty},"get")})});var ho=S(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.hasClass=fo;Br.isAreaOrProject=UL;Br.isEffort=qL;Br.hasStatus=WL;Br.isAssetArchived=GL;Br.hasEmptyProperties=zL;Br.needsFolderRepair=HL;Br.getTodayDateString=O0;Br.isPlannedForToday=QL;Br.hasPlannedStartTimestamp=YL;Br.extractDailyNoteDate=KL;Br.isCurrentDateGteDay=XL;Br.inheritsFromPrototype=fT;Br.isPrototypeClass=ZL;var uT=Ns(),uo=Pn();function fo(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>uT.WikiLinkHelpers.normalize(r)===e):!1}o(fo,"hasClass");function UL(n){return fo(n,uo.AssetClass.AREA)||fo(n,uo.AssetClass.PROJECT)}o(UL,"isAreaOrProject");function qL(n){return fo(n,uo.AssetClass.TASK)||fo(n,uo.AssetClass.PROJECT)||fo(n,uo.AssetClass.MEETING)}o(qL,"isEffort");function WL(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?uT.WikiLinkHelpers.normalize(t)===e:!1}o(WL,"hasStatus");function GL(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(GL,"isAssetArchived");function zL(n){return!n||Object.keys(n).length===0?!1:Object.values(n).some(e=>!!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0))}o(zL,"hasEmptyProperties");function HL(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(HL,"needsFolderRepair");function O0(){let n=new Date,e=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0");return`${e}-${t}-${r}`}o(O0,"getTodayDateString");function QL(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=O0();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(QL,"isPlannedForToday");function YL(n){let e=n.ems__Effort_plannedStartTimestamp;return e?typeof e=="string"?e.trim().length>0:Array.isArray(e)&&e.length>0?String(e[0]).trim().length>0:!1:!1}o(YL,"hasPlannedStartTimestamp");function KL(n){let e=n.pn__DailyNote_day;if(!e)return null;if(typeof e=="string"){let t=e.match(/\[\[([^\[\]]+)\]\]/);return t?t[1]:e}if(Array.isArray(e)&&e.length>0){let t=String(e[0]),r=t.match(/\[\[([^\[\]]+)\]\]/);return r?r[1]:t}return null}o(KL,"extractDailyNoteDate");function XL(n){return O0()>=n}o(XL,"isCurrentDateGteDay");function lT(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(lT,"normalizeWithQuotes");var JL=10;function fT(n,e=JL){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let a of s){let c=lT(a);c&&i.push({className:c,depth:0})}for(;i.length>0;){let a=i.shift();if(!a)continue;let{className:c,depth:l}=a;if(l>e)continue;if(c===uo.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let d=Array.isArray(f)?f:[f];for(let h of d){let p=lT(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(fT,"inheritsFromPrototype");function ZL(n,e){return fo(n,uo.AssetClass.CLASS)?fT(e):!1}o(ZL,"isPrototypeClass")});var dT=S(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.canCreateTask=ek;yc.canCreateRelatedTask=tk;yc.canConvertTaskToProject=rk;yc.canSetCriticalityZone=nk;var gc=ho(),P0=Pn();function ek(n){return(0,gc.isAreaOrProject)(n.instanceClass)}o(ek,"canCreateTask");function tk(n){return!(!(0,gc.hasClass)(n.instanceClass,P0.AssetClass.TASK)||(0,gc.isAssetArchived)(n.isArchived))}o(tk,"canCreateRelatedTask");function rk(n){return(0,gc.hasClass)(n.instanceClass,P0.AssetClass.TASK)}o(rk,"canConvertTaskToProject");function nk(n){return!(!(0,gc.hasClass)(n.instanceClass,P0.AssetClass.TASK)||(0,gc.isAssetArchived)(n.isArchived))}o(nk,"canSetCriticalityZone")});var hT=S(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.canCreateProject=ik;_c.canMoveToAnalysis=sk;_c.canMoveToToDo=ak;_c.canConvertProjectToTask=ok;var pa=ho(),ma=Pn();function ik(n){return(0,pa.hasClass)(n.instanceClass,ma.AssetClass.AREA)||(0,pa.hasClass)(n.instanceClass,ma.AssetClass.INITIATIVE)||(0,pa.hasClass)(n.instanceClass,ma.AssetClass.PROJECT)}o(ik,"canCreateProject");function sk(n){return(0,pa.hasClass)(n.instanceClass,ma.AssetClass.PROJECT)?(0,pa.hasStatus)(n.currentStatus,ma.EffortStatus.BACKLOG):!1}o(sk,"canMoveToAnalysis");function ak(n){return(0,pa.hasClass)(n.instanceClass,ma.AssetClass.PROJECT)?(0,pa.hasStatus)(n.currentStatus,ma.EffortStatus.ANALYSIS):!1}o(ak,"canMoveToToDo");function ok(n){return(0,pa.hasClass)(n.instanceClass,ma.AssetClass.PROJECT)}o(ok,"canConvertProjectToTask")});var gT=S(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.canCreateChildArea=ck;ch.canSetActiveFocus=lk;var pT=ho(),mT=Pn();function ck(n){return(0,pT.hasClass)(n.instanceClass,mT.AssetClass.AREA)}o(ck,"canCreateChildArea");function lk(n){return(0,pT.hasClass)(n.instanceClass,mT.AssetClass.AREA)}o(lk,"canSetActiveFocus")});var _T=S(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.canPlanOnToday=uk;nn.canPlanForEvening=fk;nn.canShiftDayBackward=dk;nn.canShiftDayForward=hk;nn.canSetDraftStatus=pk;nn.canMoveToBacklog=mk;nn.canStartEffort=gk;nn.canMarkDone=yk;nn.canTrashEffort=_k;nn.canVoteOnEffort=Sk;nn.canRollbackStatus=bk;nn.canArchiveTask=vk;nn.canMarkReviewed=wk;var yT=Ns(),dt=ho(),rn=Pn();function uk(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isPlannedForToday)(n.metadata))}o(uk,"canPlanOnToday");function fk(n){return!(0,dt.hasClass)(n.instanceClass,rn.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,rn.AssetClass.MEETING)?!1:(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.BACKLOG)}o(fk,"canPlanForEvening");function dk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(dk,"canShiftDayBackward");function hk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(hk,"canShiftDayForward");function pk(n){return(0,dt.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(pk,"canSetDraftStatus");function mk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.DRAFT):!1}o(mk,"canMoveToBacklog");function gk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasClass)(n.instanceClass,rn.AssetClass.TASK)||(0,dt.hasClass)(n.instanceClass,rn.AssetClass.MEETING)?(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.BACKLOG):(0,dt.hasClass)(n.instanceClass,rn.AssetClass.PROJECT)?(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.TODO):!1:!1}o(gk,"canStartEffort");function yk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.DOING):!1}o(yk,"canMarkDone");function _k(n){return(0,dt.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=yT.WikiLinkHelpers.normalize(r);return i===rn.EffortStatus.TRASHED||i===rn.EffortStatus.DONE}):!0:!1}o(_k,"canTrashEffort");function Sk(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isAssetArchived)(n.isArchived))}o(Sk,"canVoteOnEffort");function bk(n){if(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||yT.WikiLinkHelpers.normalize(e)===rn.EffortStatus.TRASHED)}o(bk,"canRollbackStatus");function vk(n){return!(0,dt.isAssetArchived)(n.isArchived)}o(vk,"canArchiveTask");function wk(n){return!(!(0,dt.hasClass)(n.instanceClass,rn.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,rn.AssetClass.PROJECT)||(0,dt.isAssetArchived)(n.isArchived))}o(wk,"canMarkReviewed")});var ST=S(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.canCreateEvent=Ak;Wn.canCreateInstance=xk;Wn.canCleanProperties=Ck;Wn.canRepairFolder=Ik;Wn.canRenameToUid=Rk;Wn.canCopyLabelToAliases=Ok;Wn.canCreateNarrowerConcept=Pk;Wn.canCreateSubclass=Fk;Wn.canCreateTaskForDailyNote=Dk;Wn.canCopyFleetingNoteLabel=Nk;var Vr=ho(),Ls=Pn(),Ek="75302770-279e-4a59-ba85-09df29725713",Tk="fca0a931-a01f-48e4-b72a-4af206c94bc7";function Ak(n){return(0,Vr.isAreaOrProject)(n.instanceClass)}o(Ak,"canCreateEvent");function xk(n){return(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.TASK_PROTOTYPE)||(0,Vr.hasClass)(n.instanceClass,Ek)||(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.MEETING_PROTOTYPE)||(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.EVENT_PROTOTYPE)||(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.PROJECT_PROTOTYPE)||(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,Vr.isPrototypeClass)(n.instanceClass,n.metadata)}o(xk,"canCreateInstance");function Ck(n){return(0,Vr.hasEmptyProperties)(n.metadata)}o(Ck,"canCleanProperties");function Ik(n){return(0,Vr.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(Ik,"canRepairFolder");function Rk(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(Rk,"canRenameToUid");function Ok(n){let e=n.metadata.exo__Asset_label;if(!e||typeof e!="string"||e.trim()==="")return!1;let t=e.trim(),r=n.metadata.aliases;return!r||!Array.isArray(r)||r.length===0?!0:!r.some(i=>typeof i!="string"?!1:i.trim()===t)}o(Ok,"canCopyLabelToAliases");function Pk(n){return(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.CONCEPT)}o(Pk,"canCreateNarrowerConcept");function Fk(n){return(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.CLASS)}o(Fk,"canCreateSubclass");function Dk(n){return!(!(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.DAILY_NOTE)||n.isArchived||!(0,Vr.extractDailyNoteDate)(n.metadata))}o(Dk,"canCreateTaskForDailyNote");function Nk(n){return(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.FLEETING_NOTE)||(0,Vr.hasClass)(n.instanceClass,Tk)}o(Nk,"canCopyFleetingNoteLabel")});var vT=S(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.canCopyFleetingNoteLabel=L.canCreateTaskForDailyNote=L.canCreateSubclass=L.canCreateNarrowerConcept=L.canCopyLabelToAliases=L.canRenameToUid=L.canRepairFolder=L.canCleanProperties=L.canCreateInstance=L.canCreateEvent=L.canMarkReviewed=L.canArchiveTask=L.canRollbackStatus=L.canVoteOnEffort=L.canTrashEffort=L.canMarkDone=L.canStartEffort=L.canMoveToBacklog=L.canSetDraftStatus=L.canShiftDayForward=L.canShiftDayBackward=L.canPlanForEvening=L.canPlanOnToday=L.canSetActiveFocus=L.canCreateChildArea=L.canConvertProjectToTask=L.canMoveToToDo=L.canMoveToAnalysis=L.canCreateProject=L.canSetCriticalityZone=L.canConvertTaskToProject=L.canCreateRelatedTask=L.canCreateTask=L.isPrototypeClass=L.inheritsFromPrototype=L.isCurrentDateGteDay=L.extractDailyNoteDate=L.hasPlannedStartTimestamp=L.isPlannedForToday=L.getTodayDateString=L.needsFolderRepair=L.hasEmptyProperties=L.isAssetArchived=L.hasStatus=L.isEffort=L.isAreaOrProject=L.hasClass=void 0;var bn=ho();Object.defineProperty(L,"hasClass",{enumerable:!0,get:o(function(){return bn.hasClass},"get")});Object.defineProperty(L,"isAreaOrProject",{enumerable:!0,get:o(function(){return bn.isAreaOrProject},"get")});Object.defineProperty(L,"isEffort",{enumerable:!0,get:o(function(){return bn.isEffort},"get")});Object.defineProperty(L,"hasStatus",{enumerable:!0,get:o(function(){return bn.hasStatus},"get")});Object.defineProperty(L,"isAssetArchived",{enumerable:!0,get:o(function(){return bn.isAssetArchived},"get")});Object.defineProperty(L,"hasEmptyProperties",{enumerable:!0,get:o(function(){return bn.hasEmptyProperties},"get")});Object.defineProperty(L,"needsFolderRepair",{enumerable:!0,get:o(function(){return bn.needsFolderRepair},"get")});Object.defineProperty(L,"getTodayDateString",{enumerable:!0,get:o(function(){return bn.getTodayDateString},"get")});Object.defineProperty(L,"isPlannedForToday",{enumerable:!0,get:o(function(){return bn.isPlannedForToday},"get")});Object.defineProperty(L,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return bn.hasPlannedStartTimestamp},"get")});Object.defineProperty(L,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return bn.extractDailyNoteDate},"get")});Object.defineProperty(L,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return bn.isCurrentDateGteDay},"get")});Object.defineProperty(L,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return bn.inheritsFromPrototype},"get")});Object.defineProperty(L,"isPrototypeClass",{enumerable:!0,get:o(function(){return bn.isPrototypeClass},"get")});var lh=dT();Object.defineProperty(L,"canCreateTask",{enumerable:!0,get:o(function(){return lh.canCreateTask},"get")});Object.defineProperty(L,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return lh.canCreateRelatedTask},"get")});Object.defineProperty(L,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return lh.canConvertTaskToProject},"get")});Object.defineProperty(L,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return lh.canSetCriticalityZone},"get")});var uh=hT();Object.defineProperty(L,"canCreateProject",{enumerable:!0,get:o(function(){return uh.canCreateProject},"get")});Object.defineProperty(L,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return uh.canMoveToAnalysis},"get")});Object.defineProperty(L,"canMoveToToDo",{enumerable:!0,get:o(function(){return uh.canMoveToToDo},"get")});Object.defineProperty(L,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return uh.canConvertProjectToTask},"get")});var bT=gT();Object.defineProperty(L,"canCreateChildArea",{enumerable:!0,get:o(function(){return bT.canCreateChildArea},"get")});Object.defineProperty(L,"canSetActiveFocus",{enumerable:!0,get:o(function(){return bT.canSetActiveFocus},"get")});var Fn=_T();Object.defineProperty(L,"canPlanOnToday",{enumerable:!0,get:o(function(){return Fn.canPlanOnToday},"get")});Object.defineProperty(L,"canPlanForEvening",{enumerable:!0,get:o(function(){return Fn.canPlanForEvening},"get")});Object.defineProperty(L,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Fn.canShiftDayBackward},"get")});Object.defineProperty(L,"canShiftDayForward",{enumerable:!0,get:o(function(){return Fn.canShiftDayForward},"get")});Object.defineProperty(L,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Fn.canSetDraftStatus},"get")});Object.defineProperty(L,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Fn.canMoveToBacklog},"get")});Object.defineProperty(L,"canStartEffort",{enumerable:!0,get:o(function(){return Fn.canStartEffort},"get")});Object.defineProperty(L,"canMarkDone",{enumerable:!0,get:o(function(){return Fn.canMarkDone},"get")});Object.defineProperty(L,"canTrashEffort",{enumerable:!0,get:o(function(){return Fn.canTrashEffort},"get")});Object.defineProperty(L,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Fn.canVoteOnEffort},"get")});Object.defineProperty(L,"canRollbackStatus",{enumerable:!0,get:o(function(){return Fn.canRollbackStatus},"get")});Object.defineProperty(L,"canArchiveTask",{enumerable:!0,get:o(function(){return Fn.canArchiveTask},"get")});Object.defineProperty(L,"canMarkReviewed",{enumerable:!0,get:o(function(){return Fn.canMarkReviewed},"get")});var Zi=ST();Object.defineProperty(L,"canCreateEvent",{enumerable:!0,get:o(function(){return Zi.canCreateEvent},"get")});Object.defineProperty(L,"canCreateInstance",{enumerable:!0,get:o(function(){return Zi.canCreateInstance},"get")});Object.defineProperty(L,"canCleanProperties",{enumerable:!0,get:o(function(){return Zi.canCleanProperties},"get")});Object.defineProperty(L,"canRepairFolder",{enumerable:!0,get:o(function(){return Zi.canRepairFolder},"get")});Object.defineProperty(L,"canRenameToUid",{enumerable:!0,get:o(function(){return Zi.canRenameToUid},"get")});Object.defineProperty(L,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return Zi.canCopyLabelToAliases},"get")});Object.defineProperty(L,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return Zi.canCreateNarrowerConcept},"get")});Object.defineProperty(L,"canCreateSubclass",{enumerable:!0,get:o(function(){return Zi.canCreateSubclass},"get")});Object.defineProperty(L,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return Zi.canCreateTaskForDailyNote},"get")});Object.defineProperty(L,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return Zi.canCopyFleetingNoteLabel},"get")})});var wT=S(po=>{"use strict";var Lk=po&&po.__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]})),kk=po&&po.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Lk(e,n,t)};Object.defineProperty(po,"__esModule",{value:!0});kk(vT(),po)});var fh=S(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.PropertyFieldType=void 0;Pu.rangeToFieldType=$k;var Or;(function(n){n.Text="text",n.Number="number",n.Date="date",n.DateTime="datetime",n.Boolean="boolean",n.Reference="reference",n.Enum="enum",n.StatusSelect="status-select",n.SizeSelect="size-select",n.Wikilink="wikilink",n.Timestamp="timestamp",n.Unknown="unknown"})(Or||(Pu.PropertyFieldType=Or={}));var ET="http://www.w3.org/2001/XMLSchema#",Mk="https://exocortex.my/ontology/exo#",jk="https://exocortex.my/ontology/ems#";function $k(n){if(!n)return Or.Unknown;let e=n.trim();if(!e)return Or.Unknown;if(e.startsWith(ET)){let t=e.substring(ET.length);return F0(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return F0(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return F0(r)}return e.startsWith(jk)||e.startsWith("ems:")?Bk(e):e.startsWith(Mk)||e.startsWith("exo:")||Vk(e)?Or.Reference:Or.Text}o($k,"rangeToFieldType");function F0(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Or.Text;case"integer":case"int":case"long":case"short":case"byte":case"nonnegativeinteger":case"positiveinteger":case"nonpositiveinteger":case"negativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"decimal":case"float":case"double":return Or.Number;case"date":return Or.Date;case"datetime":case"datetimestamp":return Or.DateTime;case"boolean":return Or.Boolean;case"time":return Or.Timestamp;default:return Or.Text}}o(F0,"xsdTypeToFieldType");function Bk(n){let e=n.toLowerCase();return e.includes("effortstatus")?Or.StatusSelect:e.includes("tasksize")?Or.SizeSelect:Or.Reference}o(Bk,"emsTypeToFieldType");function Vk(n){let e=n.toLowerCase();return e.includes("exocortex.my/ontology")?!0:["asset","task","project","area","effort","class","property","concept"].some(r=>e.includes(r))}o(Vk,"isClassReference")});var D0=S(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.propertyNameToUri=Uk;Fu.uriToPropertyName=TT;Fu.extractPropertyLabel=qk;function Uk(n){return n.replace(/^([a-z]+)__/,"$1:")}o(Uk,"propertyNameToUri");function TT(n){if(n.startsWith("http://")||n.startsWith("https://")){let e=n.match(/\/([a-z]+)#([A-Za-z0-9_]+)$/);if(e)return`${e[1]}__${e[2]}`;let t=n.lastIndexOf("#"),r=n.lastIndexOf("/"),i=Math.max(t,r);return i>=0?n.substring(i+1):n}return n.replace(/^([a-z]+):/,"$1__")}o(TT,"uriToPropertyName");function qk(n){let r=(n.includes(":")?TT(n):n).replace(/^[a-z]+__/,"").split("_");return(r.length>1?r.slice(1).join(" "):r[0]).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,s=>s.toUpperCase())}o(qk,"extractPropertyLabel")});var dh={};xy(dh,{__assign:()=>L0,__asyncDelegator:()=>r4,__asyncGenerator:()=>t4,__asyncValues:()=>n4,__await:()=>Du,__awaiter:()=>Yk,__classPrivateFieldGet:()=>o4,__classPrivateFieldSet:()=>c4,__createBinding:()=>Xk,__decorate:()=>zk,__exportStar:()=>Jk,__extends:()=>Wk,__generator:()=>Kk,__importDefault:()=>a4,__importStar:()=>s4,__makeTemplateObject:()=>i4,__metadata:()=>Qk,__param:()=>Hk,__read:()=>AT,__rest:()=>Gk,__spread:()=>Zk,__spreadArrays:()=>e4,__values:()=>k0});function Wk(n,e){N0(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Gk(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function zk(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function Hk(n,e){return function(t,r){e(t,r,n)}}function Qk(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function Yk(n,e,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return o(i,"adopt"),new(t||(t=Promise))(function(s,a){function c(f){try{u(r.next(f))}catch(d){a(d)}}o(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(d){a(d)}}o(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}o(u,"step"),u((r=r.apply(n,e||[])).next())})}function Kk(n,e){var t={label:0,sent:o(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(f){return l([u,f])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(f){u=[6,f],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Xk(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function Jk(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function k0(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:o(function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function AT(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s}function Zk(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(AT(arguments[e]));return n}function e4(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),i=0,e=0;e<t;e++)for(var s=arguments[e],a=0,c=s.length;a<c;a++,i++)r[i]=s[a];return r}function Du(n){return this instanceof Du?(this.v=n,this):new Du(n)}function t4(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){r[h]&&(i[h]=function(p){return new Promise(function(_,b){s.push([h,p,_,b])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(_){d(s[0][3],_)}}function l(h){h.value instanceof Du?Promise.resolve(h.value.v).then(u,f):d(s[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function r4(n){var e,t;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=n[i]?function(a){return(t=!t)?{value:Du(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function n4(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof k0=="function"?k0(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(a){return new Promise(function(c,l){a=n[s](a),i(c,l,a.done,a.value)})}}function i(s,a,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},a)}}function i4(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function s4(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function a4(n){return n&&n.__esModule?n:{default:n}}function o4(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function c4(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var N0,L0,hh=GD(()=>{N0=o(function(n,e){return N0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])},N0(n,e)},"extendStatics");o(Wk,"__extends");L0=o(function(){return L0=Object.assign||o(function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),L0.apply(this,arguments)},"__assign");o(Gk,"__rest");o(zk,"__decorate");o(Hk,"__param");o(Qk,"__metadata");o(Yk,"__awaiter");o(Kk,"__generator");o(Xk,"__createBinding");o(Jk,"__exportStar");o(k0,"__values");o(AT,"__read");o(Zk,"__spread");o(e4,"__spreadArrays");o(Du,"__await");o(t4,"__asyncGenerator");o(r4,"__asyncDelegator");o(n4,"__asyncValues");o(i4,"__makeTemplateObject");o(s4,"__importStar");o(a4,"__importDefault");o(o4,"__classPrivateFieldGet");o(c4,"__classPrivateFieldSet")});var $0=S(j0=>{"use strict";Object.defineProperty(j0,"__esModule",{value:!0});var M0;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(M0||(M0={}));j0.default=M0});var xT=S(B0=>{"use strict";Object.defineProperty(B0,"__esModule",{value:!0});var l4=$0();Object.defineProperty(B0,"Lifecycle",{enumerable:!0,get:o(function(){return l4.default},"get")})});var mo=S(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.defineInjectionTokenMetadata=si.getParamInfo=si.INJECTION_TOKEN_METADATA_KEY=void 0;si.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function u4(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(si.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(u4,"getParamInfo");si.getParamInfo=u4;function f4(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(si.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(si.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(f4,"defineInjectionTokenMetadata");si.defineInjectionTokenMetadata=f4});var V0=S(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.isClassProvider=void 0;function d4(n){return!!n.useClass}o(d4,"isClassProvider");ph.isClassProvider=d4});var U0=S(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.isFactoryProvider=void 0;function h4(n){return!!n.useFactory}o(h4,"isFactoryProvider");mh.isFactoryProvider=h4});var yh=S(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.delay=Sc.DelayedConstructor=void 0;var gh=class{static{o(this,"DelayedConstructor")}constructor(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}createProxy(e){let t={},r=!1,i,s=o(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=o(i=>{t[i]=(...s)=>{s[0]=e();let a=Reflect[i];return a(...s)}},"install");return this.reflectMethods.forEach(r),t}};Sc.DelayedConstructor=gh;function p4(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new gh(n)}o(p4,"delay");Sc.delay=p4});var _h=S(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.isConstructorToken=es.isTransformDescriptor=es.isTokenDescriptor=es.isNormalToken=void 0;var m4=yh();function g4(n){return typeof n=="string"||typeof n=="symbol"}o(g4,"isNormalToken");es.isNormalToken=g4;function y4(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(y4,"isTokenDescriptor");es.isTokenDescriptor=y4;function _4(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(_4,"isTransformDescriptor");es.isTransformDescriptor=_4;function S4(n){return typeof n=="function"||n instanceof m4.DelayedConstructor}o(S4,"isConstructorToken");es.isConstructorToken=S4});var q0=S(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.isTokenProvider=void 0;function b4(n){return!!n.useToken}o(b4,"isTokenProvider");Sh.isTokenProvider=b4});var W0=S(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.isValueProvider=void 0;function v4(n){return n.useValue!=null}o(v4,"isValueProvider");bh.isValueProvider=v4});var G0=S(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});var w4=V0();Object.defineProperty(go,"isClassProvider",{enumerable:!0,get:o(function(){return w4.isClassProvider},"get")});var E4=U0();Object.defineProperty(go,"isFactoryProvider",{enumerable:!0,get:o(function(){return E4.isFactoryProvider},"get")});var T4=_h();Object.defineProperty(go,"isNormalToken",{enumerable:!0,get:o(function(){return T4.isNormalToken},"get")});var A4=q0();Object.defineProperty(go,"isTokenProvider",{enumerable:!0,get:o(function(){return A4.isTokenProvider},"get")});var x4=W0();Object.defineProperty(go,"isValueProvider",{enumerable:!0,get:o(function(){return x4.isValueProvider},"get")})});var CT=S(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.isProvider=void 0;var C4=V0(),I4=W0(),R4=q0(),O4=U0();function P4(n){return C4.isClassProvider(n)||I4.isValueProvider(n)||R4.isTokenProvider(n)||O4.isFactoryProvider(n)}o(P4,"isProvider");vh.isProvider=P4});var Q0=S(H0=>{"use strict";Object.defineProperty(H0,"__esModule",{value:!0});var z0=class{static{o(this,"RegistryBase")}constructor(){this._registryMap=new Map}entries(){return this._registryMap.entries()}getAll(e){return this.ensure(e),this._registryMap.get(e)}get(e){this.ensure(e);let t=this._registryMap.get(e);return t[t.length-1]||null}set(e,t){this.ensure(e),this._registryMap.get(e).push(t)}setAll(e,t){this._registryMap.set(e,t)}has(e){return this.ensure(e),this._registryMap.get(e).length>0}clear(){this._registryMap.clear()}ensure(e){this._registryMap.has(e)||this._registryMap.set(e,[])}};H0.default=z0});var IT=S(K0=>{"use strict";Object.defineProperty(K0,"__esModule",{value:!0});var F4=Q0(),Y0=class extends F4.default{static{o(this,"Registry")}};K0.default=Y0});var RT=S(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});var X0=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};J0.default=X0});var Z0=S(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.formatErrorCtor=void 0;function D4(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(D4,"formatDependency");function N4(n,e,t=" "){return[n,...e.message.split(`
|
|
31
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function y2(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?i=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],i=s[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}o(y2,"incrementNodeInspectorPort");function Vy(){if(it.env.NO_COLOR||it.env.FORCE_COLOR==="0"||it.env.FORCE_COLOR==="false")return!1;if(it.env.FORCE_COLOR||it.env.CLICOLOR_FORCE!==void 0)return!0}o(Vy,"useColor");Uy.Command=By;Uy.useColor=Vy});var w2=S(Bn=>{var{Argument:S2}=Md(),{Command:qy}=_2(),{CommanderError:sN,InvalidArgumentError:b2}=yu(),{Help:aN}=Dy(),{Option:v2}=My();Bn.program=new qy;Bn.createCommand=n=>new qy(n);Bn.createOption=(n,e)=>new v2(n,e);Bn.createArgument=(n,e)=>new S2(n,e);Bn.Command=qy;Bn.Option=v2;Bn.Argument=S2;Bn.Help=aN;Bn.CommanderError=sN;Bn.InvalidArgumentError=b2;Bn.InvalidOptionArgumentError=b2});var _u=S($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.AssetClass=void 0;var T2;(function(n){n.AREA="ems__Area",n.TASK="ems__Task",n.PROJECT="ems__Project",n.MEETING="ems__Meeting",n.INITIATIVE="ems__Initiative",n.TASK_PROTOTYPE="ems__TaskPrototype",n.MEETING_PROTOTYPE="ems__MeetingPrototype",n.EVENT_PROTOTYPE="exo__EventPrototype",n.PROJECT_PROTOTYPE="ems__ProjectPrototype",n.EVENT="exo__Event",n.DAILY_NOTE="pn__DailyNote",n.CONCEPT="ims__Concept",n.SESSION_START_EVENT="ems__SessionStartEvent",n.SESSION_END_EVENT="ems__SessionEndEvent",n.PROTOTYPE="exo__Prototype",n.CLASS="exo__Class",n.FLEETING_NOTE="ztlk__FleetingNote",n.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition",n.COMMAND="exocmd__Command",n.PRECONDITION="exocmd__Precondition",n.GROUNDING="exocmd__Grounding",n.COMMAND_BINDING="exocmd__CommandBinding"})(T2||($d.AssetClass=T2={}))});var hc=S(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.EffortStatus=void 0;var A2;(function(n){n.DRAFT="ems__EffortStatusDraft",n.BACKLOG="ems__EffortStatusBacklog",n.ANALYSIS="ems__EffortStatusAnalysis",n.TODO="ems__EffortStatusToDo",n.DOING="ems__EffortStatusDoing",n.DONE="ems__EffortStatusDone",n.TRASHED="ems__EffortStatusTrashed"})(A2||(Bd.EffortStatus=A2={}))});var Wy=S(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.EFFORT_STATUS_OPTIONS=Wt.STATUS_NAME_TO_WIKILINK=Wt.STATUS_NAME_TO_ENUM=Wt.EFFORT_STATUS_CONFIG=void 0;Wt.normalizeEffortStatus=oN;Wt.isDoneStatus=cN;Wt.isTrashedStatus=lN;Wt.getEffortStatusLabel=uN;var Ji=hc();Wt.EFFORT_STATUS_CONFIG=[{name:"Draft",status:Ji.EffortStatus.DRAFT,wikilink:"[[ems__EffortStatusDraft]]"},{name:"Backlog",status:Ji.EffortStatus.BACKLOG,wikilink:"[[ems__EffortStatusBacklog]]"},{name:"Analysis",status:Ji.EffortStatus.ANALYSIS,wikilink:"[[ems__EffortStatusAnalysis]]"},{name:"To Do",status:Ji.EffortStatus.TODO,wikilink:"[[ems__EffortStatusToDo]]"},{name:"Doing",status:Ji.EffortStatus.DOING,wikilink:"[[ems__EffortStatusDoing]]"},{name:"Done",status:Ji.EffortStatus.DONE,wikilink:"[[ems__EffortStatusDone]]"},{name:"Trashed",status:Ji.EffortStatus.TRASHED,wikilink:"[[ems__EffortStatusTrashed]]"}];Wt.STATUS_NAME_TO_ENUM=Object.fromEntries(Wt.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.status]));Wt.STATUS_NAME_TO_WIKILINK=Object.fromEntries(Wt.EFFORT_STATUS_CONFIG.map(n=>[n.name,n.wikilink]));Wt.EFFORT_STATUS_OPTIONS=Wt.EFFORT_STATUS_CONFIG.map(n=>({value:n.wikilink,label:n.name}));function oN(n,e=Ji.EffortStatus.DRAFT){if(n.startsWith("ems__")){let r=Wt.EFFORT_STATUS_CONFIG.find(i=>i.status===n);return r?r.status:e}return Wt.STATUS_NAME_TO_ENUM[n]??e}o(oN,"normalizeEffortStatus");function cN(n){return n===Ji.EffortStatus.DONE}o(cN,"isDoneStatus");function lN(n){return n===Ji.EffortStatus.TRASHED}o(lN,"isTrashedStatus");function uN(n){if(!n)return"-";let e=String(n);if(e==="")return"-";for(let r of Wt.EFFORT_STATUS_CONFIG)if(r.wikilink===e||`[[${e}]]`===r.wikilink||r.status===e||r.name===e)return r.name;let t=e.toLowerCase();for(let r of Wt.EFFORT_STATUS_CONFIG)if(r.name.toLowerCase()===t)return r.name;return e}o(uN,"getEffortStatusLabel")});var pc=S(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.GroundingType=void 0;var x2;(function(n){n.SPARQL_UPDATE="sparql_update",n.PROPERTY_DELETE="property_delete",n.PROPERTY_SET="property_set",n.COMPOSITE="composite",n.SERVICE_CALL="service_call",n.CREATE_INSTANCE="create_instance"})(x2||(Vd.GroundingType=x2={}))});var Gy=S(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.CommandBindingStyleProperty=Vn.CommandBindingProperty=Vn.GroundingProperty=Vn.PreconditionProperty=Vn.CommandProperty=void 0;Vn.CommandProperty={ICON:"exocmd__Command_icon",PRECONDITION:"exocmd__Command_precondition",GROUNDING:"exocmd__Command_grounding",CONFIRM_MESSAGE:"exocmd__Command_confirmMessage",SUCCESS_MESSAGE:"exocmd__Command_successMessage",CATEGORY:"exocmd__Command_category"};Vn.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};Vn.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",TARGET_VALUE:"exocmd__Grounding_targetValue",STEPS:"exocmd__Grounding_steps"};Vn.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};Vn.CommandBindingStyleProperty={VARIANT:"exocmd__CommandBindingStyle_variant",SHOW_ICON:"exocmd__CommandBindingStyle_showIcon",LABEL_CLASS:"exocmd__CommandBindingStyle_labelClass",ARIA_LABEL:"exocmd__CommandBindingStyle_ariaLabel",TOOLTIP:"exocmd__CommandBindingStyle_tooltip",KEYBOARD_SHORTCUT:"exocmd__CommandBindingStyle_keyboardShortcut",SOURCE:"exocmd__CommandBindingStyle_source"}});var zy=S(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.STYLE_SOURCE_VALUES=_n.LABEL_CLASS_VALUES=_n.COMMAND_VARIANT_VALUES=void 0;_n.isCommandVariant=fN;_n.isLabelClass=dN;_n.isStyleSource=hN;_n.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);_n.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);_n.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function fN(n){return typeof n=="string"&&_n.COMMAND_VARIANT_VALUES.includes(n)}o(fN,"isCommandVariant");function dN(n){return typeof n=="string"&&_n.LABEL_CLASS_VALUES.includes(n)}o(dN,"isLabelClass");function hN(n){return typeof n=="string"&&_n.STYLE_SOURCE_VALUES.includes(n)}o(hN,"isStyleSource")});var C2=S(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.isCommandFrontmatter=pN;mc.isPreconditionFrontmatter=mN;mc.isGroundingFrontmatter=gN;mc.isCommandBindingFrontmatter=yN;function pN(n){return Ud(n,"exocmd__Command")}o(pN,"isCommandFrontmatter");function mN(n){return Ud(n,"exocmd__Precondition")}o(mN,"isPreconditionFrontmatter");function gN(n){return Ud(n,"exocmd__Grounding")}o(gN,"isGroundingFrontmatter");function yN(n){return Ud(n,"exocmd__CommandBinding")}o(yN,"isCommandBindingFrontmatter");function Ud(n,e){let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}o(Ud,"hasInstanceClass")});var I2=S(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.hasPosition=_N;qd.isFixed=SN;function _N(n){return typeof n.x=="number"&&typeof n.y=="number"}o(_N,"hasPosition");function SN(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(SN,"isFixed")});var R2=S(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.createEmptyGraphData=bN;Wd.mergeGraphData=vN;function bN(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(bN,"createEmptyGraphData");function vN(n,e){let t=new Map,r=new Set,i=[];for(let s of n.nodes)t.set(s.id,s);for(let s of e.nodes)t.set(s.id,s);for(let s of n.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}for(let s of e.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}o(vN,"mergeGraphData")});var Hy=S(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.createEdgeId=wN;Gd.edgesEqual=EN;function wN(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(wN,"createEdgeId");function EN(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(EN,"edgesEqual")});var Qy=S($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.BUILT_IN_EDGE_STYLES=$t.BUILT_IN_NODE_STYLES=$t.DEFAULT_EDGE_STYLE=$t.DEFAULT_NODE_STYLE=$t.RDF_TYPE_PREDICATES=void 0;$t.mergeNodeStyles=TN;$t.mergeEdgeStyles=AN;$t.extractLocalName=xN;$t.isClassType=CN;$t.isTypePredicate=IN;$t.isSubClassPredicate=RN;$t.RDF_TYPE_PREDICATES={RDF_TYPE:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",RDFS_CLASS:"http://www.w3.org/2000/01/rdf-schema#Class",OWL_CLASS:"http://www.w3.org/2002/07/owl#Class",RDFS_SUBCLASS_OF:"http://www.w3.org/2000/01/rdf-schema#subClassOf",OWL_EQUIVALENT_CLASS:"http://www.w3.org/2002/07/owl#equivalentClass",RDFS_LABEL:"http://www.w3.org/2000/01/rdf-schema#label",RDFS_COMMENT:"http://www.w3.org/2000/01/rdf-schema#comment"};$t.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};$t.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};$t.BUILT_IN_NODE_STYLES={"http://www.w3.org/2000/01/rdf-schema#Class":{color:"#f59e0b",shape:"diamond",size:40},"http://www.w3.org/2002/07/owl#Class":{color:"#f59e0b",shape:"diamond",size:40},ems__Task:{color:"#22c55e",shape:"circle"},ems__Project:{color:"#3b82f6",shape:"square"},ems__Area:{color:"#8b5cf6",shape:"hexagon",size:40},ems__Meeting:{color:"#ec4899",shape:"circle"},exo__Class:{color:"#f59e0b",shape:"diamond"},ims__Person:{color:"#06b6d4",shape:"circle"}};$t.BUILT_IN_EDGE_STYLES={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":{color:"#f59e0b",lineStyle:"dashed",arrow:"standard"},"http://www.w3.org/2000/01/rdf-schema#subClassOf":{color:"#8b5cf6",width:2,arrow:"triangle"},"https://exocortex.my/ontology/ems#Effort_parent":{color:"#6366f1",width:2,arrow:"standard"},"https://exocortex.my/ontology/exo#Asset_prototype":{color:"#f59e0b",lineStyle:"dashed",arrow:"circle"},"https://exocortex.my/ontology/exo#references":{color:"#22c55e",opacity:.4,arrow:"standard"}};function TN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(TN,"mergeNodeStyles");function AN(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(AN,"mergeEdgeStyles");function xN(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(xN,"extractLocalName");function CN(n){return n===$t.RDF_TYPE_PREDICATES.RDFS_CLASS||n===$t.RDF_TYPE_PREDICATES.OWL_CLASS}o(CN,"isClassType");function IN(n){return n===$t.RDF_TYPE_PREDICATES.RDF_TYPE}o(IN,"isTypePredicate");function RN(n){return n===$t.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(RN,"isSubClassPredicate")});var P2=S(O2=>{"use strict";Object.defineProperty(O2,"__esModule",{value:!0})});var Ce=S(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.IRI=void 0;var Yy=class n{static{o(this,"IRI")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("IRI cannot be empty");if(!n.isValidIRI(t))throw new Error("Invalid IRI format");this._value=t}get value(){return this._value}equals(e){return this._value===e._value}toString(){return this._value}static isValidIRI(e){if(!e||e.trim().length===0||/\s/.test(e)||!/^[a-z][a-z0-9+.-]*:/i.test(e))return!1;let r=["http","https","ftp","ftps","file","mailto","tel","data","ws","wss","urn","obsidian"],i=e.match(/^([a-z][a-z0-9+.-]*?):/i);if(i){let s=i[1].toLowerCase();if(!r.includes(s))return!1}try{return new URL(e),!0}catch{return/^urn:[a-z0-9][a-z0-9-]{0,31}:[^\s]+$/i.test(e)}}};zd.IRI=Yy});var Ve=S(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.Literal=void 0;oo.parseLanguageTag=F2;oo.createDirectionalLiteral=PN;oo.createLiteralFromLanguageTag=FN;var ON="http://www.w3.org/2001/XMLSchema#string",Su=class{static{o(this,"Literal")}constructor(e,t,r,i){if(e.length===0)throw new Error("Literal value cannot be empty");if(t&&r)throw new Error("Literal cannot have both datatype and language tag");if(i&&!r)throw new Error("Literal cannot have direction without language tag");if(i&&i!=="ltr"&&i!=="rtl")throw new Error('Direction must be "ltr" or "rtl"');this._value=e,this._datatype=t,this._language=r?r.toLowerCase():void 0,this._direction=i}get value(){return this._value}get datatype(){return this._datatype}get language(){return this._language}get direction(){return this._direction}hasDirection(){return this._direction!==void 0}equals(e){if(this._value!==e._value||this._language!==e._language||this._direction!==e._direction)return!1;let t=this.normalizedDatatype(),r=e.normalizedDatatype();return t===r}normalizedDatatype(){return!this._datatype||this._datatype.value===ON?null:this._datatype.value}toString(){let e=`"${this._value}"`;return this._datatype?e+=`^^<${this._datatype.value}>`:this._language&&(e+=`@${this._language}`,this._direction&&(e+=`--${this._direction}`)),e}};oo.Literal=Su;function F2(n){let t=n.lastIndexOf("--");if(t===-1)return{language:n.toLowerCase()};let r=n.substring(t+2),i=n.substring(0,t);return r==="ltr"||r==="rtl"?{language:i.toLowerCase(),direction:r}:{language:n.toLowerCase()}}o(F2,"parseLanguageTag");function PN(n,e,t){return new Su(n,void 0,e,t)}o(PN,"createDirectionalLiteral");function FN(n,e){let{language:t,direction:r}=F2(e);return new Su(n,void 0,t,r)}o(FN,"createLiteralFromLanguageTag")});var Gt=S(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.BlankNode=void 0;var Hd=class n{static{o(this,"BlankNode")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("BlankNode id cannot be empty");this._id=t}get id(){return this._id}equals(e){return this._id===e._id}toString(){return`_:${this._id}`}static generateId(){return`b${++n.counter}`}static create(){return new n(n.generateId())}};Qd.BlankNode=Hd;Hd.counter=0});var Ir=S(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.Namespace=void 0;var D2=Ce(),ft=class{static{o(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new D2.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new D2.IRI(`${this._iri.value}${e}`)}expand(e){let t=e.split(":");if(t.length!==2)return null;let[r,i]=t;return r!==this._prefix?null:this.term(i)}};Yd.Namespace=ft;ft.RDF=new ft("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");ft.RDFS=new ft("rdfs","http://www.w3.org/2000/01/rdf-schema#");ft.OWL=new ft("owl","http://www.w3.org/2002/07/owl#");ft.XSD=new ft("xsd","http://www.w3.org/2001/XMLSchema#");ft.EXO=new ft("exo","https://exocortex.my/ontology/exo#");ft.EMS=new ft("ems","https://exocortex.my/ontology/ems#");ft.EXOCMD=new ft("exocmd","https://exocortex.my/ontology/exocmd#");ft.IMS=new ft("ims","https://exocortex.my/ontology/ims#");ft.ZTLK=new ft("ztlk","https://exocortex.my/ontology/ztlk#");ft.PTMS=new ft("ptms","https://exocortex.my/ontology/ptms#");ft.LIT=new ft("lit","https://exocortex.my/ontology/lit#");ft.INBOX=new ft("inbox","https://exocortex.my/ontology/inbox#");ft.PMBOK=new ft("pmbok","https://exocortex.my/ontology/pmbok#")});var ii=S(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.Triple=void 0;var Ky=Ce(),Xy=Ve(),Jy=Gt(),Zy=class{static{o(this,"Triple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof Ky.IRI&&t instanceof Ky.IRI||e instanceof Jy.BlankNode&&t instanceof Jy.BlankNode||e instanceof Xy.Literal&&t instanceof Xy.Literal||this.isQuotedTriple(e)&&this.isQuotedTriple(t)?e.equals(t):!1}isQuotedTriple(e){return typeof e=="object"&&e!==null&&"termType"in e&&e.termType==="QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`${e} ${t} ${r} .`}nodeToString(e){return e instanceof Ky.IRI?`<${e.value}>`:e instanceof Jy.BlankNode||e instanceof Xy.Literal||this.isQuotedTriple(e)?e.toString():""}};Kd.Triple=Zy});var bu=S(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.QuotedTriple=void 0;var e0=Ce(),t0=Ve(),r0=Gt(),n0=class n{static{o(this,"QuotedTriple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof e0.IRI&&t instanceof e0.IRI||e instanceof r0.BlankNode&&t instanceof r0.BlankNode||e instanceof t0.Literal&&t instanceof t0.Literal||e instanceof n&&t instanceof n?e.equals(t):!1}get termType(){return"QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`<< ${e} ${t} ${r} >>`}nodeToString(e){return e instanceof e0.IRI?`<${e.value}>`:e instanceof r0.BlankNode||e instanceof t0.Literal||e instanceof n?e.toString():""}};Xd.QuotedTriple=n0});var N2=S(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.QuotedTriple=Xt.Triple=Xt.Namespace=Xt.BlankNode=Xt.createLiteralFromLanguageTag=Xt.createDirectionalLiteral=Xt.parseLanguageTag=Xt.Literal=Xt.IRI=void 0;var DN=Ce();Object.defineProperty(Xt,"IRI",{enumerable:!0,get:o(function(){return DN.IRI},"get")});var Jd=Ve();Object.defineProperty(Xt,"Literal",{enumerable:!0,get:o(function(){return Jd.Literal},"get")});Object.defineProperty(Xt,"parseLanguageTag",{enumerable:!0,get:o(function(){return Jd.parseLanguageTag},"get")});Object.defineProperty(Xt,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return Jd.createDirectionalLiteral},"get")});Object.defineProperty(Xt,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return Jd.createLiteralFromLanguageTag},"get")});var NN=Gt();Object.defineProperty(Xt,"BlankNode",{enumerable:!0,get:o(function(){return NN.BlankNode},"get")});var LN=Ir();Object.defineProperty(Xt,"Namespace",{enumerable:!0,get:o(function(){return LN.Namespace},"get")});var kN=ii();Object.defineProperty(Xt,"Triple",{enumerable:!0,get:o(function(){return kN.Triple},"get")});var MN=bu();Object.defineProperty(Xt,"QuotedTriple",{enumerable:!0,get:o(function(){return MN.QuotedTriple},"get")})});var Zd=S(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.UUID_URL_NAMESPACE=qn.DEFAULT_LANGUAGE_TAG=qn.REQUIRED_PROPERTIES=qn.ALLOWED_PROPERTIES=qn.Exo003MetadataType=void 0;var Un;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(Un||(qn.Exo003MetadataType=Un={}));qn.ALLOWED_PROPERTIES={[Un.Namespace]:["metadata","uri","aliases"],[Un.Anchor]:["metadata","uri","aliases"],[Un.BlankNode]:["metadata","uri","aliases"],[Un.Statement]:["metadata","subject","predicate","object","aliases"],[Un.Body]:["metadata","subject","predicate","aliases"]};qn.REQUIRED_PROPERTIES={[Un.Namespace]:["metadata","uri"],[Un.Anchor]:["metadata","uri"],[Un.BlankNode]:["metadata","uri"],[Un.Statement]:["metadata","subject","predicate","object"],[Un.Body]:["metadata","subject","predicate"]};qn.DEFAULT_LANGUAGE_TAG="ru";qn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var L2=S(i0=>{"use strict";Object.defineProperty(i0,"__esModule",{value:!0});i0.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var k2=S(s0=>{"use strict";Object.defineProperty(s0,"__esModule",{value:!0});s0.default="00000000-0000-0000-0000-000000000000"});var M2=S(a0=>{"use strict";Object.defineProperty(a0,"__esModule",{value:!0});a0.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var vu=S(o0=>{"use strict";Object.defineProperty(o0,"__esModule",{value:!0});var jN=M2();function $N(n){return typeof n=="string"&&jN.default.test(n)}o($N,"validate");o0.default=$N});var wu=S(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0});var BN=vu();function VN(n){if(!(0,BN.default)(n))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(n.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(n.slice(9,13),16))>>>8,e&255,(e=parseInt(n.slice(14,18),16))>>>8,e&255,(e=parseInt(n.slice(19,23),16))>>>8,e&255,(e=parseInt(n.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}o(VN,"parse");c0.default=VN});var Fs=S(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.unsafeStringify=void 0;var UN=vu(),Rr=[];for(let n=0;n<256;++n)Rr.push((n+256).toString(16).slice(1));function j2(n,e=0){return(Rr[n[e+0]]+Rr[n[e+1]]+Rr[n[e+2]]+Rr[n[e+3]]+"-"+Rr[n[e+4]]+Rr[n[e+5]]+"-"+Rr[n[e+6]]+Rr[n[e+7]]+"-"+Rr[n[e+8]]+Rr[n[e+9]]+"-"+Rr[n[e+10]]+Rr[n[e+11]]+Rr[n[e+12]]+Rr[n[e+13]]+Rr[n[e+14]]+Rr[n[e+15]]).toLowerCase()}o(j2,"unsafeStringify");Eu.unsafeStringify=j2;function qN(n,e=0){let t=j2(n,e);if(!(0,UN.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(qN,"stringify");Eu.default=qN});var rh=S(l0=>{"use strict";Object.defineProperty(l0,"__esModule",{value:!0});var WN=require("crypto"),th=new Uint8Array(256),eh=th.length;function GN(){return eh>th.length-16&&((0,WN.randomFillSync)(th),eh=0),th.slice(eh,eh+=16)}o(GN,"rng");l0.default=GN});var u0=S(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.updateV1State=void 0;var $2=rh(),zN=Fs(),Tu={};function HN(n,e,t){let r,i=n?._v6??!1;if(n){let s=Object.keys(n);s.length===1&&s[0]==="_v6"&&(n=void 0)}if(n)r=B2(n.random??n.rng?.()??(0,$2.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,$2.default)();V2(Tu,s,a),r=B2(a,Tu.msecs,Tu.nsecs,i?void 0:Tu.clockseq,i?void 0:Tu.node,e,t)}return e??(0,zN.unsafeStringify)(r)}o(HN,"v1");function V2(n,e,t){return n.msecs??=-1/0,n.nsecs??=0,e===n.msecs?(n.nsecs++,n.nsecs>=1e4&&(n.node=void 0,n.nsecs=0)):e>n.msecs?n.nsecs=0:e<n.msecs&&(n.node=void 0),n.node||(n.node=t.slice(10,16),n.node[0]|=1,n.clockseq=(t[8]<<8|t[9])&16383),n.msecs=e,n}o(V2,"updateV1State");Au.updateV1State=V2;function B2(n,e,t,r,i,s,a=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),a=0;else if(a<0||a+16>s.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);e??=Date.now(),t??=0,r??=(n[8]<<8|n[9])&16383,i??=n.slice(10,16),e+=122192928e5;let c=((e&268435455)*1e4+t)%4294967296;s[a++]=c>>>24&255,s[a++]=c>>>16&255,s[a++]=c>>>8&255,s[a++]=c&255;let l=e/4294967296*1e4&268435455;s[a++]=l>>>8&255,s[a++]=l&255,s[a++]=l>>>24&15|16,s[a++]=l>>>16&255,s[a++]=r>>>8|128,s[a++]=r&255;for(let u=0;u<6;++u)s[a++]=i[u];return s}o(B2,"v1Bytes");Au.default=HN});var d0=S(f0=>{"use strict";Object.defineProperty(f0,"__esModule",{value:!0});var QN=wu(),YN=Fs();function KN(n){let e=typeof n=="string"?(0,QN.default)(n):n,t=XN(e);return typeof n=="string"?(0,YN.unsafeStringify)(t):t}o(KN,"v1ToV6");f0.default=KN;function XN(n){return Uint8Array.of((n[6]&15)<<4|n[7]>>4&15,(n[7]&15)<<4|(n[4]&240)>>4,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,(n[1]&15)<<4|(n[2]&240)>>4,96|n[2]&15,n[3],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(XN,"_v1ToV6")});var U2=S(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var JN=require("crypto");function ZN(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,JN.createHash)("md5").update(n).digest()}o(ZN,"md5");h0.default=ZN});var xu=S(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.URL=Ds.DNS=Ds.stringToBytes=void 0;var q2=wu(),eL=Fs();function W2(n){n=unescape(encodeURIComponent(n));let e=new Uint8Array(n.length);for(let t=0;t<n.length;++t)e[t]=n.charCodeAt(t);return e}o(W2,"stringToBytes");Ds.stringToBytes=W2;Ds.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ds.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function tL(n,e,t,r,i,s){let a=typeof t=="string"?W2(t):t,c=typeof r=="string"?(0,q2.default)(r):r;if(typeof r=="string"&&(r=(0,q2.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+a.length);if(l.set(c),l.set(a,c.length),l=e(l),l[6]=l[6]&15|n,l[8]=l[8]&63|128,i){s=s||0;for(let u=0;u<16;++u)i[s+u]=l[u];return i}return(0,eL.unsafeStringify)(l)}o(tL,"v35");Ds.default=tL});var z2=S(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.URL=co.DNS=void 0;var rL=U2(),p0=xu(),G2=xu();Object.defineProperty(co,"DNS",{enumerable:!0,get:o(function(){return G2.DNS},"get")});Object.defineProperty(co,"URL",{enumerable:!0,get:o(function(){return G2.URL},"get")});function m0(n,e,t,r){return(0,p0.default)(48,rL.default,n,e,t,r)}o(m0,"v3");m0.DNS=p0.DNS;m0.URL=p0.URL;co.default=m0});var H2=S(g0=>{"use strict";Object.defineProperty(g0,"__esModule",{value:!0});var nL=require("crypto");g0.default={randomUUID:nL.randomUUID}});var Y2=S(y0=>{"use strict";Object.defineProperty(y0,"__esModule",{value:!0});var Q2=H2(),iL=rh(),sL=Fs();function aL(n,e,t){if(Q2.default.randomUUID&&!e&&!n)return Q2.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,iL.default)();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return(0,sL.unsafeStringify)(r)}o(aL,"v4");y0.default=aL});var K2=S(_0=>{"use strict";Object.defineProperty(_0,"__esModule",{value:!0});var oL=require("crypto");function cL(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,oL.createHash)("sha1").update(n).digest()}o(cL,"sha1");_0.default=cL});var J2=S(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.URL=lo.DNS=void 0;var lL=K2(),S0=xu(),X2=xu();Object.defineProperty(lo,"DNS",{enumerable:!0,get:o(function(){return X2.DNS},"get")});Object.defineProperty(lo,"URL",{enumerable:!0,get:o(function(){return X2.URL},"get")});function b0(n,e,t,r){return(0,S0.default)(80,lL.default,n,e,t,r)}o(b0,"v5");b0.DNS=S0.DNS;b0.URL=S0.URL;lo.default=b0});var Z2=S(v0=>{"use strict";Object.defineProperty(v0,"__esModule",{value:!0});var uL=Fs(),fL=u0(),dL=d0();function hL(n,e,t){n??={},t??=0;let r=(0,fL.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,dL.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,uL.unsafeStringify)(r)}o(hL,"v6");v0.default=hL});var eT=S(w0=>{"use strict";Object.defineProperty(w0,"__esModule",{value:!0});var pL=wu(),mL=Fs();function gL(n){let e=typeof n=="string"?(0,pL.default)(n):n,t=yL(e);return typeof n=="string"?(0,mL.unsafeStringify)(t):t}o(gL,"v6ToV1");w0.default=gL;function yL(n){return Uint8Array.of((n[3]&15)<<4|n[4]>>4&15,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|n[6]&15,n[7],(n[1]&15)<<4|(n[2]&240)>>4,(n[2]&15)<<4|(n[3]&240)>>4,16|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(yL,"_v6ToV1")});var iT=S(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.updateV7State=void 0;var tT=rh(),_L=Fs(),E0={};function SL(n,e,t){let r;if(n)r=rT(n.random??n.rng?.()??(0,tT.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,tT.default)();nT(E0,i,s),r=rT(s,E0.msecs,E0.seq,e,t)}return e??(0,_L.unsafeStringify)(r)}o(SL,"v7");function nT(n,e,t){return n.msecs??=-1/0,n.seq??=0,e>n.msecs?(n.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],n.msecs=e):(n.seq=n.seq+1|0,n.seq===0&&n.msecs++),n}o(nT,"updateV7State");Cu.updateV7State=nT;function rT(n,e,t,r,i=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return e??=Date.now(),t??=n[6]*127<<24|n[7]<<16|n[8]<<8|n[9],r[i++]=e/1099511627776&255,r[i++]=e/4294967296&255,r[i++]=e/16777216&255,r[i++]=e/65536&255,r[i++]=e/256&255,r[i++]=e&255,r[i++]=112|t>>>28&15,r[i++]=t>>>20&255,r[i++]=128|t>>>14&63,r[i++]=t>>>6&255,r[i++]=t<<2&255|n[10]&3,r[i++]=n[11],r[i++]=n[12],r[i++]=n[13],r[i++]=n[14],r[i++]=n[15],r}o(rT,"v7Bytes");Cu.default=SL});var sT=S(T0=>{"use strict";Object.defineProperty(T0,"__esModule",{value:!0});var bL=vu();function vL(n){if(!(0,bL.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(vL,"version");T0.default=vL});var Sn=S(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.version=ot.validate=ot.v7=ot.v6ToV1=ot.v6=ot.v5=ot.v4=ot.v3=ot.v1ToV6=ot.v1=ot.stringify=ot.parse=ot.NIL=ot.MAX=void 0;var wL=L2();Object.defineProperty(ot,"MAX",{enumerable:!0,get:o(function(){return wL.default},"get")});var EL=k2();Object.defineProperty(ot,"NIL",{enumerable:!0,get:o(function(){return EL.default},"get")});var TL=wu();Object.defineProperty(ot,"parse",{enumerable:!0,get:o(function(){return TL.default},"get")});var AL=Fs();Object.defineProperty(ot,"stringify",{enumerable:!0,get:o(function(){return AL.default},"get")});var xL=u0();Object.defineProperty(ot,"v1",{enumerable:!0,get:o(function(){return xL.default},"get")});var CL=d0();Object.defineProperty(ot,"v1ToV6",{enumerable:!0,get:o(function(){return CL.default},"get")});var IL=z2();Object.defineProperty(ot,"v3",{enumerable:!0,get:o(function(){return IL.default},"get")});var RL=Y2();Object.defineProperty(ot,"v4",{enumerable:!0,get:o(function(){return RL.default},"get")});var OL=J2();Object.defineProperty(ot,"v5",{enumerable:!0,get:o(function(){return OL.default},"get")});var PL=Z2();Object.defineProperty(ot,"v6",{enumerable:!0,get:o(function(){return PL.default},"get")});var FL=eT();Object.defineProperty(ot,"v6ToV1",{enumerable:!0,get:o(function(){return FL.default},"get")});var DL=iT();Object.defineProperty(ot,"v7",{enumerable:!0,get:o(function(){return DL.default},"get")});var NL=vu();Object.defineProperty(ot,"validate",{enumerable:!0,get:o(function(){return NL.default},"get")});var LL=sT();Object.defineProperty(ot,"version",{enumerable:!0,get:o(function(){return LL.default},"get")})});var C0=S(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.Exo003UUIDGenerator=void 0;var A0=Sn(),aT=Zd(),x0=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,A0.v5)(e,aT.UUID_URL_NAMESPACE)}static generateAssetUUID(e,t){if(!t||t.trim().length===0)throw new Error("Local identifier cannot be empty");let r=this.generateNamespaceUUID(e);return(0,A0.v5)(t,r)}static generateFromIRI(e){if(!e||e.trim().length===0)throw new Error("IRI cannot be empty");let{namespace:t,localName:r}=this.splitIRI(e);return r?this.generateAssetUUID(t,r):(0,A0.v5)(e,aT.UUID_URL_NAMESPACE)}static generateBlankNodeUUID(e,t){if(!e||e.trim().length===0)throw new Error("Blank node ID cannot be empty");let r="urn:exocortex:blank-node:",i=t?`${t}#${e}`:e;return this.generateAssetUUID(r,i)}static generateStatementUUID(e,t,r){if(!e||!t||!r)throw new Error("Subject, predicate, and object cannot be empty");let i="urn:exocortex:statement:",s=`${e} ${t} ${r}`;return this.generateAssetUUID(i,s)}static generateBodyUUID(e,t){let r="urn:exocortex:body:",i=e;return t?.datatype?i+=`^^${t.datatype}`:t?.language&&(i+=`@${t.language}`,t.direction&&(i+=`--${t.direction}`)),this.generateAssetUUID(r,i)}static splitIRI(e){let t=e.lastIndexOf("#");if(t!==-1&&t<e.length-1)return{namespace:e.substring(0,t+1),localName:e.substring(t+1)};let r=e.lastIndexOf("/"),i=e.indexOf("://");return r!==-1&&r>i+2&&r<e.length-1?{namespace:e.substring(0,r+1),localName:e.substring(r+1)}:{namespace:e,localName:""}}static isValidUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};nh.Exo003UUIDGenerator=x0});var cT=S(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.Exo003Parser=void 0;var mt=Zd(),Iu=C0(),da=Ce(),ih=Ve(),oT=Gt(),kL=ii(),I0=class{static{o(this,"Exo003Parser")}static parse(e,t){let r=this.validate(e);if(!r.valid)return{success:!1,errors:r.errors};let i=e.metadata;try{return{success:!0,metadata:this.parseByType(e,i),bodyContent:i===mt.Exo003MetadataType.Body?t:void 0}}catch(s){return{success:!1,errors:[s instanceof Error?s.message:String(s)]}}}static validate(e){let t=[],r=[];if(!e.metadata)return t.push("Missing required property: metadata"),{valid:!1,errors:t,warnings:r};let i=e.metadata;if(!Object.values(mt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(mt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=mt.ALLOWED_PROPERTIES[s],c=mt.REQUIRED_PROPERTIES[s];for(let l of c)(e[l]===void 0||e[l]===null)&&t.push(`Missing required property: ${l}`);for(let l of Object.keys(e))a.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case mt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case mt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case mt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case mt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case mt.Exo003MetadataType.Body:this.validateBodyMetadata(e,t,r);break}return{valid:t.length===0,errors:t,warnings:r}}static parseByType(e,t){let r={metadata:t,aliases:e.aliases};switch(t){case mt.Exo003MetadataType.Namespace:return{...r,metadata:mt.Exo003MetadataType.Namespace,uri:e.uri};case mt.Exo003MetadataType.Anchor:return{...r,metadata:mt.Exo003MetadataType.Anchor,uri:e.uri};case mt.Exo003MetadataType.BlankNode:return{...r,metadata:mt.Exo003MetadataType.BlankNode,uri:e.uri};case mt.Exo003MetadataType.Statement:return{...r,metadata:mt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case mt.Exo003MetadataType.Body:return{...r,metadata:mt.Exo003MetadataType.Body,subject:e.subject,predicate:e.predicate}}}static validateNamespaceMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new da.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateAnchorMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new da.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateBlankNodeMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r){let i=r;if(!i.startsWith("_:"))try{new da.IRI(i)}catch{t.push(`uri is not a valid IRI or blank node identifier: ${String(r)}`)}}}static validateStatementMetadata(e,t){let r=e.subject,i=e.predicate,s=e.object,a=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of a)l&&typeof l!="string"&&t.push(`${c} must be a string`)}static validateBodyMetadata(e,t,r){let i=e.subject,s=e.predicate;i&&typeof i!="string"&&t.push("subject must be a string"),s&&typeof s!="string"&&t.push("predicate must be a string")}static toTriple(e,t,r){let i=t(e.subject),s;if(i.type==="iri")s=new da.IRI(i.value);else if(i.type==="blank")s=new oT.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let a=t(e.predicate);if(a.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new da.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new da.IRI(l.value);else if(l.type==="blank")u=new oT.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new ih.Literal(f,new da.IRI(l.datatype));else{let d=l.language||mt.DEFAULT_LANGUAGE_TAG;u=(0,ih.createDirectionalLiteral)(f,d,l.direction)}}return new kL.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new ih.Literal(t,new da.IRI(r.datatype));let i=r?.language||mt.DEFAULT_LANGUAGE_TAG;return(0,ih.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(mt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case mt.Exo003MetadataType.Namespace:return Iu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Anchor:return Iu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.BlankNode:return Iu.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case mt.Exo003MetadataType.Statement:{let r=e;return Iu.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case mt.Exo003MetadataType.Body:{let r=e;return Iu.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};sh.Exo003Parser=I0});var R0=S($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.Exo003Parser=$r.Exo003UUIDGenerator=$r.UUID_URL_NAMESPACE=$r.DEFAULT_LANGUAGE_TAG=$r.REQUIRED_PROPERTIES=$r.ALLOWED_PROPERTIES=$r.Exo003MetadataType=void 0;var Ru=Zd();Object.defineProperty($r,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Ru.Exo003MetadataType},"get")});Object.defineProperty($r,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Ru.ALLOWED_PROPERTIES},"get")});Object.defineProperty($r,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Ru.REQUIRED_PROPERTIES},"get")});Object.defineProperty($r,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Ru.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty($r,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Ru.UUID_URL_NAMESPACE},"get")});var ML=C0();Object.defineProperty($r,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return ML.Exo003UUIDGenerator},"get")});var jL=cT();Object.defineProperty($r,"Exo003Parser",{enumerable:!0,get:o(function(){return jL.Exo003Parser},"get")})});var Ns=S(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.WikiLinkHelpers=void 0;var Ou=class{static{o(this,"WikiLinkHelpers")}static normalize(e){if(!e)return"";let t=e.replace(this.WIKI_LINK_PATTERN,"").trim();if(!t)return"";let r=t.indexOf("|");if(r===-1)return t;let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();return this.UUID_PATTERN.test(i)&&s||i}static normalizeArray(e){return e?(Array.isArray(e)?e:[e]).map(r=>this.normalize(r)).filter(r=>r.length>0):[]}static equals(e,t){return this.normalize(e)===this.normalize(t)}static includes(e,t){let r=this.normalizeArray(e),i=this.normalize(t);return r.includes(i)}};ah.WikiLinkHelpers=Ou;Ou.WIKI_LINK_PATTERN=/\[\[|\]\]/g;Ou.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var Pn=S(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.CommandBindingProperty=et.GroundingProperty=et.PreconditionProperty=et.CommandProperty=et.GroundingType=et.getEffortStatusLabel=et.isTrashedStatus=et.isDoneStatus=et.normalizeEffortStatus=et.EFFORT_STATUS_OPTIONS=et.STATUS_NAME_TO_WIKILINK=et.STATUS_NAME_TO_ENUM=et.EFFORT_STATUS_CONFIG=et.EffortStatus=et.AssetClass=void 0;var $L=_u();Object.defineProperty(et,"AssetClass",{enumerable:!0,get:o(function(){return $L.AssetClass},"get")});var BL=hc();Object.defineProperty(et,"EffortStatus",{enumerable:!0,get:o(function(){return BL.EffortStatus},"get")});var ha=Wy();Object.defineProperty(et,"EFFORT_STATUS_CONFIG",{enumerable:!0,get:o(function(){return ha.EFFORT_STATUS_CONFIG},"get")});Object.defineProperty(et,"STATUS_NAME_TO_ENUM",{enumerable:!0,get:o(function(){return ha.STATUS_NAME_TO_ENUM},"get")});Object.defineProperty(et,"STATUS_NAME_TO_WIKILINK",{enumerable:!0,get:o(function(){return ha.STATUS_NAME_TO_WIKILINK},"get")});Object.defineProperty(et,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:o(function(){return ha.EFFORT_STATUS_OPTIONS},"get")});Object.defineProperty(et,"normalizeEffortStatus",{enumerable:!0,get:o(function(){return ha.normalizeEffortStatus},"get")});Object.defineProperty(et,"isDoneStatus",{enumerable:!0,get:o(function(){return ha.isDoneStatus},"get")});Object.defineProperty(et,"isTrashedStatus",{enumerable:!0,get:o(function(){return ha.isTrashedStatus},"get")});Object.defineProperty(et,"getEffortStatusLabel",{enumerable:!0,get:o(function(){return ha.getEffortStatusLabel},"get")});var VL=pc();Object.defineProperty(et,"GroundingType",{enumerable:!0,get:o(function(){return VL.GroundingType},"get")});var oh=Gy();Object.defineProperty(et,"CommandProperty",{enumerable:!0,get:o(function(){return oh.CommandProperty},"get")});Object.defineProperty(et,"PreconditionProperty",{enumerable:!0,get:o(function(){return oh.PreconditionProperty},"get")});Object.defineProperty(et,"GroundingProperty",{enumerable:!0,get:o(function(){return oh.GroundingProperty},"get")});Object.defineProperty(et,"CommandBindingProperty",{enumerable:!0,get:o(function(){return oh.CommandBindingProperty},"get")})});var ho=S(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.hasClass=fo;Br.isAreaOrProject=UL;Br.isEffort=qL;Br.hasStatus=WL;Br.isAssetArchived=GL;Br.hasEmptyProperties=zL;Br.needsFolderRepair=HL;Br.getTodayDateString=O0;Br.isPlannedForToday=QL;Br.hasPlannedStartTimestamp=YL;Br.extractDailyNoteDate=KL;Br.isCurrentDateGteDay=XL;Br.inheritsFromPrototype=fT;Br.isPrototypeClass=ZL;var uT=Ns(),uo=Pn();function fo(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>uT.WikiLinkHelpers.normalize(r)===e):!1}o(fo,"hasClass");function UL(n){return fo(n,uo.AssetClass.AREA)||fo(n,uo.AssetClass.PROJECT)}o(UL,"isAreaOrProject");function qL(n){return fo(n,uo.AssetClass.TASK)||fo(n,uo.AssetClass.PROJECT)||fo(n,uo.AssetClass.MEETING)}o(qL,"isEffort");function WL(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?uT.WikiLinkHelpers.normalize(t)===e:!1}o(WL,"hasStatus");function GL(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(GL,"isAssetArchived");function zL(n){return!n||Object.keys(n).length===0?!1:Object.values(n).some(e=>!!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0))}o(zL,"hasEmptyProperties");function HL(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(HL,"needsFolderRepair");function O0(){let n=new Date,e=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0");return`${e}-${t}-${r}`}o(O0,"getTodayDateString");function QL(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=O0();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(QL,"isPlannedForToday");function YL(n){let e=n.ems__Effort_plannedStartTimestamp;return e?typeof e=="string"?e.trim().length>0:Array.isArray(e)&&e.length>0?String(e[0]).trim().length>0:!1:!1}o(YL,"hasPlannedStartTimestamp");function KL(n){let e=n.pn__DailyNote_day;if(!e)return null;if(typeof e=="string"){let t=e.match(/\[\[([^\[\]]+)\]\]/);return t?t[1]:e}if(Array.isArray(e)&&e.length>0){let t=String(e[0]),r=t.match(/\[\[([^\[\]]+)\]\]/);return r?r[1]:t}return null}o(KL,"extractDailyNoteDate");function XL(n){return O0()>=n}o(XL,"isCurrentDateGteDay");function lT(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(lT,"normalizeWithQuotes");var JL=10;function fT(n,e=JL){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let a of s){let c=lT(a);c&&i.push({className:c,depth:0})}for(;i.length>0;){let a=i.shift();if(!a)continue;let{className:c,depth:l}=a;if(l>e)continue;if(c===uo.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let d=Array.isArray(f)?f:[f];for(let h of d){let p=lT(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(fT,"inheritsFromPrototype");function ZL(n,e){return fo(n,uo.AssetClass.CLASS)?fT(e):!1}o(ZL,"isPrototypeClass")});var dT=S(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.canCreateTask=ek;yc.canCreateRelatedTask=tk;yc.canConvertTaskToProject=rk;yc.canSetCriticalityZone=nk;var gc=ho(),P0=Pn();function ek(n){return(0,gc.isAreaOrProject)(n.instanceClass)}o(ek,"canCreateTask");function tk(n){return!(!(0,gc.hasClass)(n.instanceClass,P0.AssetClass.TASK)||(0,gc.isAssetArchived)(n.isArchived))}o(tk,"canCreateRelatedTask");function rk(n){return(0,gc.hasClass)(n.instanceClass,P0.AssetClass.TASK)}o(rk,"canConvertTaskToProject");function nk(n){return!(!(0,gc.hasClass)(n.instanceClass,P0.AssetClass.TASK)||(0,gc.isAssetArchived)(n.isArchived))}o(nk,"canSetCriticalityZone")});var hT=S(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.canCreateProject=ik;_c.canMoveToAnalysis=sk;_c.canMoveToToDo=ak;_c.canConvertProjectToTask=ok;var pa=ho(),ma=Pn();function ik(n){return(0,pa.hasClass)(n.instanceClass,ma.AssetClass.AREA)||(0,pa.hasClass)(n.instanceClass,ma.AssetClass.INITIATIVE)||(0,pa.hasClass)(n.instanceClass,ma.AssetClass.PROJECT)}o(ik,"canCreateProject");function sk(n){return(0,pa.hasClass)(n.instanceClass,ma.AssetClass.PROJECT)?(0,pa.hasStatus)(n.currentStatus,ma.EffortStatus.BACKLOG):!1}o(sk,"canMoveToAnalysis");function ak(n){return(0,pa.hasClass)(n.instanceClass,ma.AssetClass.PROJECT)?(0,pa.hasStatus)(n.currentStatus,ma.EffortStatus.ANALYSIS):!1}o(ak,"canMoveToToDo");function ok(n){return(0,pa.hasClass)(n.instanceClass,ma.AssetClass.PROJECT)}o(ok,"canConvertProjectToTask")});var gT=S(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.canCreateChildArea=ck;ch.canSetActiveFocus=lk;var pT=ho(),mT=Pn();function ck(n){return(0,pT.hasClass)(n.instanceClass,mT.AssetClass.AREA)}o(ck,"canCreateChildArea");function lk(n){return(0,pT.hasClass)(n.instanceClass,mT.AssetClass.AREA)}o(lk,"canSetActiveFocus")});var _T=S(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.canPlanOnToday=uk;nn.canPlanForEvening=fk;nn.canShiftDayBackward=dk;nn.canShiftDayForward=hk;nn.canSetDraftStatus=pk;nn.canMoveToBacklog=mk;nn.canStartEffort=gk;nn.canMarkDone=yk;nn.canTrashEffort=_k;nn.canVoteOnEffort=Sk;nn.canRollbackStatus=bk;nn.canArchiveTask=vk;nn.canMarkReviewed=wk;var yT=Ns(),dt=ho(),rn=Pn();function uk(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isPlannedForToday)(n.metadata))}o(uk,"canPlanOnToday");function fk(n){return!(0,dt.hasClass)(n.instanceClass,rn.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,rn.AssetClass.MEETING)?!1:(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.BACKLOG)}o(fk,"canPlanForEvening");function dk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(dk,"canShiftDayBackward");function hk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasPlannedStartTimestamp)(n.metadata):!1}o(hk,"canShiftDayForward");function pk(n){return(0,dt.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(pk,"canSetDraftStatus");function mk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.DRAFT):!1}o(mk,"canMoveToBacklog");function gk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasClass)(n.instanceClass,rn.AssetClass.TASK)||(0,dt.hasClass)(n.instanceClass,rn.AssetClass.MEETING)?(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.BACKLOG):(0,dt.hasClass)(n.instanceClass,rn.AssetClass.PROJECT)?(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.TODO):!1:!1}o(gk,"canStartEffort");function yk(n){return(0,dt.isEffort)(n.instanceClass)?(0,dt.hasStatus)(n.currentStatus,rn.EffortStatus.DOING):!1}o(yk,"canMarkDone");function _k(n){return(0,dt.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=yT.WikiLinkHelpers.normalize(r);return i===rn.EffortStatus.TRASHED||i===rn.EffortStatus.DONE}):!0:!1}o(_k,"canTrashEffort");function Sk(n){return!(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isAssetArchived)(n.isArchived))}o(Sk,"canVoteOnEffort");function bk(n){if(!(0,dt.isEffort)(n.instanceClass)||(0,dt.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||yT.WikiLinkHelpers.normalize(e)===rn.EffortStatus.TRASHED)}o(bk,"canRollbackStatus");function vk(n){return!(0,dt.isAssetArchived)(n.isArchived)}o(vk,"canArchiveTask");function wk(n){return!(!(0,dt.hasClass)(n.instanceClass,rn.AssetClass.TASK)&&!(0,dt.hasClass)(n.instanceClass,rn.AssetClass.PROJECT)||(0,dt.isAssetArchived)(n.isArchived))}o(wk,"canMarkReviewed")});var ST=S(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.canCreateEvent=Ak;Wn.canCreateInstance=xk;Wn.canCleanProperties=Ck;Wn.canRepairFolder=Ik;Wn.canRenameToUid=Rk;Wn.canCopyLabelToAliases=Ok;Wn.canCreateNarrowerConcept=Pk;Wn.canCreateSubclass=Fk;Wn.canCreateTaskForDailyNote=Dk;Wn.canCopyFleetingNoteLabel=Nk;var Vr=ho(),Ls=Pn(),Ek="75302770-279e-4a59-ba85-09df29725713",Tk="fca0a931-a01f-48e4-b72a-4af206c94bc7";function Ak(n){return(0,Vr.isAreaOrProject)(n.instanceClass)}o(Ak,"canCreateEvent");function xk(n){return(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.TASK_PROTOTYPE)||(0,Vr.hasClass)(n.instanceClass,Ek)||(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.MEETING_PROTOTYPE)||(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.EVENT_PROTOTYPE)||(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.PROJECT_PROTOTYPE)||(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,Vr.isPrototypeClass)(n.instanceClass,n.metadata)}o(xk,"canCreateInstance");function Ck(n){return(0,Vr.hasEmptyProperties)(n.metadata)}o(Ck,"canCleanProperties");function Ik(n){return(0,Vr.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(Ik,"canRepairFolder");function Rk(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(Rk,"canRenameToUid");function Ok(n){let e=n.metadata.exo__Asset_label;if(!e||typeof e!="string"||e.trim()==="")return!1;let t=e.trim(),r=n.metadata.aliases;return!r||!Array.isArray(r)||r.length===0?!0:!r.some(i=>typeof i!="string"?!1:i.trim()===t)}o(Ok,"canCopyLabelToAliases");function Pk(n){return(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.CONCEPT)}o(Pk,"canCreateNarrowerConcept");function Fk(n){return(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.CLASS)}o(Fk,"canCreateSubclass");function Dk(n){return!(!(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.DAILY_NOTE)||n.isArchived||!(0,Vr.extractDailyNoteDate)(n.metadata))}o(Dk,"canCreateTaskForDailyNote");function Nk(n){return(0,Vr.hasClass)(n.instanceClass,Ls.AssetClass.FLEETING_NOTE)||(0,Vr.hasClass)(n.instanceClass,Tk)}o(Nk,"canCopyFleetingNoteLabel")});var vT=S(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.canCopyFleetingNoteLabel=L.canCreateTaskForDailyNote=L.canCreateSubclass=L.canCreateNarrowerConcept=L.canCopyLabelToAliases=L.canRenameToUid=L.canRepairFolder=L.canCleanProperties=L.canCreateInstance=L.canCreateEvent=L.canMarkReviewed=L.canArchiveTask=L.canRollbackStatus=L.canVoteOnEffort=L.canTrashEffort=L.canMarkDone=L.canStartEffort=L.canMoveToBacklog=L.canSetDraftStatus=L.canShiftDayForward=L.canShiftDayBackward=L.canPlanForEvening=L.canPlanOnToday=L.canSetActiveFocus=L.canCreateChildArea=L.canConvertProjectToTask=L.canMoveToToDo=L.canMoveToAnalysis=L.canCreateProject=L.canSetCriticalityZone=L.canConvertTaskToProject=L.canCreateRelatedTask=L.canCreateTask=L.isPrototypeClass=L.inheritsFromPrototype=L.isCurrentDateGteDay=L.extractDailyNoteDate=L.hasPlannedStartTimestamp=L.isPlannedForToday=L.getTodayDateString=L.needsFolderRepair=L.hasEmptyProperties=L.isAssetArchived=L.hasStatus=L.isEffort=L.isAreaOrProject=L.hasClass=void 0;var bn=ho();Object.defineProperty(L,"hasClass",{enumerable:!0,get:o(function(){return bn.hasClass},"get")});Object.defineProperty(L,"isAreaOrProject",{enumerable:!0,get:o(function(){return bn.isAreaOrProject},"get")});Object.defineProperty(L,"isEffort",{enumerable:!0,get:o(function(){return bn.isEffort},"get")});Object.defineProperty(L,"hasStatus",{enumerable:!0,get:o(function(){return bn.hasStatus},"get")});Object.defineProperty(L,"isAssetArchived",{enumerable:!0,get:o(function(){return bn.isAssetArchived},"get")});Object.defineProperty(L,"hasEmptyProperties",{enumerable:!0,get:o(function(){return bn.hasEmptyProperties},"get")});Object.defineProperty(L,"needsFolderRepair",{enumerable:!0,get:o(function(){return bn.needsFolderRepair},"get")});Object.defineProperty(L,"getTodayDateString",{enumerable:!0,get:o(function(){return bn.getTodayDateString},"get")});Object.defineProperty(L,"isPlannedForToday",{enumerable:!0,get:o(function(){return bn.isPlannedForToday},"get")});Object.defineProperty(L,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return bn.hasPlannedStartTimestamp},"get")});Object.defineProperty(L,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return bn.extractDailyNoteDate},"get")});Object.defineProperty(L,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return bn.isCurrentDateGteDay},"get")});Object.defineProperty(L,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return bn.inheritsFromPrototype},"get")});Object.defineProperty(L,"isPrototypeClass",{enumerable:!0,get:o(function(){return bn.isPrototypeClass},"get")});var lh=dT();Object.defineProperty(L,"canCreateTask",{enumerable:!0,get:o(function(){return lh.canCreateTask},"get")});Object.defineProperty(L,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return lh.canCreateRelatedTask},"get")});Object.defineProperty(L,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return lh.canConvertTaskToProject},"get")});Object.defineProperty(L,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return lh.canSetCriticalityZone},"get")});var uh=hT();Object.defineProperty(L,"canCreateProject",{enumerable:!0,get:o(function(){return uh.canCreateProject},"get")});Object.defineProperty(L,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return uh.canMoveToAnalysis},"get")});Object.defineProperty(L,"canMoveToToDo",{enumerable:!0,get:o(function(){return uh.canMoveToToDo},"get")});Object.defineProperty(L,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return uh.canConvertProjectToTask},"get")});var bT=gT();Object.defineProperty(L,"canCreateChildArea",{enumerable:!0,get:o(function(){return bT.canCreateChildArea},"get")});Object.defineProperty(L,"canSetActiveFocus",{enumerable:!0,get:o(function(){return bT.canSetActiveFocus},"get")});var Fn=_T();Object.defineProperty(L,"canPlanOnToday",{enumerable:!0,get:o(function(){return Fn.canPlanOnToday},"get")});Object.defineProperty(L,"canPlanForEvening",{enumerable:!0,get:o(function(){return Fn.canPlanForEvening},"get")});Object.defineProperty(L,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Fn.canShiftDayBackward},"get")});Object.defineProperty(L,"canShiftDayForward",{enumerable:!0,get:o(function(){return Fn.canShiftDayForward},"get")});Object.defineProperty(L,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Fn.canSetDraftStatus},"get")});Object.defineProperty(L,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Fn.canMoveToBacklog},"get")});Object.defineProperty(L,"canStartEffort",{enumerable:!0,get:o(function(){return Fn.canStartEffort},"get")});Object.defineProperty(L,"canMarkDone",{enumerable:!0,get:o(function(){return Fn.canMarkDone},"get")});Object.defineProperty(L,"canTrashEffort",{enumerable:!0,get:o(function(){return Fn.canTrashEffort},"get")});Object.defineProperty(L,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Fn.canVoteOnEffort},"get")});Object.defineProperty(L,"canRollbackStatus",{enumerable:!0,get:o(function(){return Fn.canRollbackStatus},"get")});Object.defineProperty(L,"canArchiveTask",{enumerable:!0,get:o(function(){return Fn.canArchiveTask},"get")});Object.defineProperty(L,"canMarkReviewed",{enumerable:!0,get:o(function(){return Fn.canMarkReviewed},"get")});var Zi=ST();Object.defineProperty(L,"canCreateEvent",{enumerable:!0,get:o(function(){return Zi.canCreateEvent},"get")});Object.defineProperty(L,"canCreateInstance",{enumerable:!0,get:o(function(){return Zi.canCreateInstance},"get")});Object.defineProperty(L,"canCleanProperties",{enumerable:!0,get:o(function(){return Zi.canCleanProperties},"get")});Object.defineProperty(L,"canRepairFolder",{enumerable:!0,get:o(function(){return Zi.canRepairFolder},"get")});Object.defineProperty(L,"canRenameToUid",{enumerable:!0,get:o(function(){return Zi.canRenameToUid},"get")});Object.defineProperty(L,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return Zi.canCopyLabelToAliases},"get")});Object.defineProperty(L,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return Zi.canCreateNarrowerConcept},"get")});Object.defineProperty(L,"canCreateSubclass",{enumerable:!0,get:o(function(){return Zi.canCreateSubclass},"get")});Object.defineProperty(L,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return Zi.canCreateTaskForDailyNote},"get")});Object.defineProperty(L,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return Zi.canCopyFleetingNoteLabel},"get")})});var wT=S(po=>{"use strict";var Lk=po&&po.__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]})),kk=po&&po.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Lk(e,n,t)};Object.defineProperty(po,"__esModule",{value:!0});kk(vT(),po)});var fh=S(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.PropertyFieldType=void 0;Pu.rangeToFieldType=$k;var Or;(function(n){n.Text="text",n.Number="number",n.Date="date",n.DateTime="datetime",n.Boolean="boolean",n.Reference="reference",n.Enum="enum",n.StatusSelect="status-select",n.SizeSelect="size-select",n.Wikilink="wikilink",n.Timestamp="timestamp",n.Unknown="unknown"})(Or||(Pu.PropertyFieldType=Or={}));var ET="http://www.w3.org/2001/XMLSchema#",Mk="https://exocortex.my/ontology/exo#",jk="https://exocortex.my/ontology/ems#";function $k(n){if(!n)return Or.Unknown;let e=n.trim();if(!e)return Or.Unknown;if(e.startsWith(ET)){let t=e.substring(ET.length);return F0(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return F0(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return F0(r)}return e.startsWith(jk)||e.startsWith("ems:")?Bk(e):e.startsWith(Mk)||e.startsWith("exo:")||Vk(e)?Or.Reference:Or.Text}o($k,"rangeToFieldType");function F0(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return Or.Text;case"integer":case"int":case"long":case"short":case"byte":case"nonnegativeinteger":case"positiveinteger":case"nonpositiveinteger":case"negativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"decimal":case"float":case"double":return Or.Number;case"date":return Or.Date;case"datetime":case"datetimestamp":return Or.DateTime;case"boolean":return Or.Boolean;case"time":return Or.Timestamp;default:return Or.Text}}o(F0,"xsdTypeToFieldType");function Bk(n){let e=n.toLowerCase();return e.includes("effortstatus")?Or.StatusSelect:e.includes("tasksize")?Or.SizeSelect:Or.Reference}o(Bk,"emsTypeToFieldType");function Vk(n){let e=n.toLowerCase();return e.includes("exocortex.my/ontology")?!0:["asset","task","project","area","effort","class","property","concept"].some(r=>e.includes(r))}o(Vk,"isClassReference")});var D0=S(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.propertyNameToUri=Uk;Fu.uriToPropertyName=TT;Fu.extractPropertyLabel=qk;function Uk(n){return n.replace(/^([a-z]+)__/,"$1:")}o(Uk,"propertyNameToUri");function TT(n){if(n.startsWith("http://")||n.startsWith("https://")){let e=n.match(/\/([a-z]+)#([A-Za-z0-9_]+)$/);if(e)return`${e[1]}__${e[2]}`;let t=n.lastIndexOf("#"),r=n.lastIndexOf("/"),i=Math.max(t,r);return i>=0?n.substring(i+1):n}return n.replace(/^([a-z]+):/,"$1__")}o(TT,"uriToPropertyName");function qk(n){let r=(n.includes(":")?TT(n):n).replace(/^[a-z]+__/,"").split("_");return(r.length>1?r.slice(1).join(" "):r[0]).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,s=>s.toUpperCase())}o(qk,"extractPropertyLabel")});var dh={};xy(dh,{__assign:()=>L0,__asyncDelegator:()=>r4,__asyncGenerator:()=>t4,__asyncValues:()=>n4,__await:()=>Du,__awaiter:()=>Yk,__classPrivateFieldGet:()=>o4,__classPrivateFieldSet:()=>c4,__createBinding:()=>Xk,__decorate:()=>zk,__exportStar:()=>Jk,__extends:()=>Wk,__generator:()=>Kk,__importDefault:()=>a4,__importStar:()=>s4,__makeTemplateObject:()=>i4,__metadata:()=>Qk,__param:()=>Hk,__read:()=>AT,__rest:()=>Gk,__spread:()=>Zk,__spreadArrays:()=>e4,__values:()=>k0});function Wk(n,e){N0(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Gk(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function zk(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function Hk(n,e){return function(t,r){e(t,r,n)}}function Qk(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function Yk(n,e,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return o(i,"adopt"),new(t||(t=Promise))(function(s,a){function c(f){try{u(r.next(f))}catch(d){a(d)}}o(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(d){a(d)}}o(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}o(u,"step"),u((r=r.apply(n,e||[])).next())})}function Kk(n,e){var t={label:0,sent:o(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(f){return l([u,f])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(f){u=[6,f],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Xk(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function Jk(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function k0(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:o(function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function AT(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s}function Zk(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(AT(arguments[e]));return n}function e4(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),i=0,e=0;e<t;e++)for(var s=arguments[e],a=0,c=s.length;a<c;a++,i++)r[i]=s[a];return r}function Du(n){return this instanceof Du?(this.v=n,this):new Du(n)}function t4(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){r[h]&&(i[h]=function(p){return new Promise(function(_,b){s.push([h,p,_,b])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(_){d(s[0][3],_)}}function l(h){h.value instanceof Du?Promise.resolve(h.value.v).then(u,f):d(s[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function r4(n){var e,t;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=n[i]?function(a){return(t=!t)?{value:Du(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function n4(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof k0=="function"?k0(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(a){return new Promise(function(c,l){a=n[s](a),i(c,l,a.done,a.value)})}}function i(s,a,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},a)}}function i4(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function s4(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function a4(n){return n&&n.__esModule?n:{default:n}}function o4(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function c4(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var N0,L0,hh=GD(()=>{N0=o(function(n,e){return N0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])},N0(n,e)},"extendStatics");o(Wk,"__extends");L0=o(function(){return L0=Object.assign||o(function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),L0.apply(this,arguments)},"__assign");o(Gk,"__rest");o(zk,"__decorate");o(Hk,"__param");o(Qk,"__metadata");o(Yk,"__awaiter");o(Kk,"__generator");o(Xk,"__createBinding");o(Jk,"__exportStar");o(k0,"__values");o(AT,"__read");o(Zk,"__spread");o(e4,"__spreadArrays");o(Du,"__await");o(t4,"__asyncGenerator");o(r4,"__asyncDelegator");o(n4,"__asyncValues");o(i4,"__makeTemplateObject");o(s4,"__importStar");o(a4,"__importDefault");o(o4,"__classPrivateFieldGet");o(c4,"__classPrivateFieldSet")});var $0=S(j0=>{"use strict";Object.defineProperty(j0,"__esModule",{value:!0});var M0;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(M0||(M0={}));j0.default=M0});var xT=S(B0=>{"use strict";Object.defineProperty(B0,"__esModule",{value:!0});var l4=$0();Object.defineProperty(B0,"Lifecycle",{enumerable:!0,get:o(function(){return l4.default},"get")})});var mo=S(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.defineInjectionTokenMetadata=si.getParamInfo=si.INJECTION_TOKEN_METADATA_KEY=void 0;si.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function u4(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(si.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(u4,"getParamInfo");si.getParamInfo=u4;function f4(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(si.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(si.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(f4,"defineInjectionTokenMetadata");si.defineInjectionTokenMetadata=f4});var V0=S(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.isClassProvider=void 0;function d4(n){return!!n.useClass}o(d4,"isClassProvider");ph.isClassProvider=d4});var U0=S(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.isFactoryProvider=void 0;function h4(n){return!!n.useFactory}o(h4,"isFactoryProvider");mh.isFactoryProvider=h4});var yh=S(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.delay=Sc.DelayedConstructor=void 0;var gh=class{static{o(this,"DelayedConstructor")}constructor(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}createProxy(e){let t={},r=!1,i,s=o(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=o(i=>{t[i]=(...s)=>{s[0]=e();let a=Reflect[i];return a(...s)}},"install");return this.reflectMethods.forEach(r),t}};Sc.DelayedConstructor=gh;function p4(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new gh(n)}o(p4,"delay");Sc.delay=p4});var _h=S(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.isConstructorToken=es.isTransformDescriptor=es.isTokenDescriptor=es.isNormalToken=void 0;var m4=yh();function g4(n){return typeof n=="string"||typeof n=="symbol"}o(g4,"isNormalToken");es.isNormalToken=g4;function y4(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(y4,"isTokenDescriptor");es.isTokenDescriptor=y4;function _4(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(_4,"isTransformDescriptor");es.isTransformDescriptor=_4;function S4(n){return typeof n=="function"||n instanceof m4.DelayedConstructor}o(S4,"isConstructorToken");es.isConstructorToken=S4});var q0=S(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.isTokenProvider=void 0;function b4(n){return!!n.useToken}o(b4,"isTokenProvider");Sh.isTokenProvider=b4});var W0=S(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.isValueProvider=void 0;function v4(n){return n.useValue!=null}o(v4,"isValueProvider");bh.isValueProvider=v4});var G0=S(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});var w4=V0();Object.defineProperty(go,"isClassProvider",{enumerable:!0,get:o(function(){return w4.isClassProvider},"get")});var E4=U0();Object.defineProperty(go,"isFactoryProvider",{enumerable:!0,get:o(function(){return E4.isFactoryProvider},"get")});var T4=_h();Object.defineProperty(go,"isNormalToken",{enumerable:!0,get:o(function(){return T4.isNormalToken},"get")});var A4=q0();Object.defineProperty(go,"isTokenProvider",{enumerable:!0,get:o(function(){return A4.isTokenProvider},"get")});var x4=W0();Object.defineProperty(go,"isValueProvider",{enumerable:!0,get:o(function(){return x4.isValueProvider},"get")})});var CT=S(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.isProvider=void 0;var C4=V0(),I4=W0(),R4=q0(),O4=U0();function P4(n){return C4.isClassProvider(n)||I4.isValueProvider(n)||R4.isTokenProvider(n)||O4.isFactoryProvider(n)}o(P4,"isProvider");vh.isProvider=P4});var Q0=S(H0=>{"use strict";Object.defineProperty(H0,"__esModule",{value:!0});var z0=class{static{o(this,"RegistryBase")}constructor(){this._registryMap=new Map}entries(){return this._registryMap.entries()}getAll(e){return this.ensure(e),this._registryMap.get(e)}get(e){this.ensure(e);let t=this._registryMap.get(e);return t[t.length-1]||null}set(e,t){this.ensure(e),this._registryMap.get(e).push(t)}setAll(e,t){this._registryMap.set(e,t)}has(e){return this.ensure(e),this._registryMap.get(e).length>0}clear(){this._registryMap.clear()}ensure(e){this._registryMap.has(e)||this._registryMap.set(e,[])}};H0.default=z0});var IT=S(K0=>{"use strict";Object.defineProperty(K0,"__esModule",{value:!0});var F4=Q0(),Y0=class extends F4.default{static{o(this,"Registry")}};K0.default=Y0});var RT=S(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});var X0=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};J0.default=X0});var Z0=S(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.formatErrorCtor=void 0;function D4(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(D4,"formatDependency");function N4(n,e,t=" "){return[n,...e.message.split(`
|
|
32
32
|
`).map(r=>t+r)].join(`
|
|
33
33
|
`)}o(N4,"composeErrorMessage");function L4(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=D4(r,e);return N4(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(L4,"formatErrorCtor");wh.formatErrorCtor=L4});var OT=S(Eh=>{"use strict";Object.defineProperty(Eh,"__esModule",{value:!0});Eh.isDisposable=void 0;function k4(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(k4,"isDisposable");Eh.isDisposable=k4});var FT=S(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.PostResolutionInterceptors=yo.PreResolutionInterceptors=void 0;var PT=Q0(),Th=class extends PT.default{static{o(this,"PreResolutionInterceptors")}};yo.PreResolutionInterceptors=Th;var Ah=class extends PT.default{static{o(this,"PostResolutionInterceptors")}};yo.PostResolutionInterceptors=Ah;var e_=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new Th,this.postResolution=new Ah}};yo.default=e_});var ga=S(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.instance=ks.typeInfo=void 0;var M4=(hh(),Nd(dh)),sn=G0(),j4=CT(),xh=_h(),$4=IT(),vn=$0(),Ch=RT(),B4=Z0(),V4=yh(),U4=OT(),q4=FT();ks.typeInfo=new Map;var t_=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new $4.default,this.interceptors=new q4.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:vn.default.Transient}){this.ensureNotDisposed();let i;if(j4.isProvider(t)?i=t:i={useClass:t},sn.isTokenProvider(i)){let s=[e],a=i;for(;a!=null;){let c=a.useToken;if(s.includes(c))throw new Error(`Token registration cycle detected! ${[...s,c].join(" -> ")}`);s.push(c);let l=this._registry.get(c);l&&sn.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===vn.default.Singleton||r.lifecycle==vn.default.ContainerScoped||r.lifecycle==vn.default.ResolutionScoped)&&(sn.isValueProvider(i)||sn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${vn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),sn.isNormalToken(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})}registerInstance(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})}registerSingleton(e,t){if(this.ensureNotDisposed(),sn.isNormalToken(e)){if(sn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:vn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:vn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!sn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:vn.default.Singleton})}resolve(e,t=new Ch.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&sn.isNormalToken(e)){if(r)return;throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"Single"),i){let s=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,s,"Single"),s}if(xh.isConstructorToken(e)){let s=this.construct(e,t);return this.executePostResolutionInterceptor(e,s,"Single"),s}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")}executePreResolutionInterceptor(e,t){if(this.interceptors.preResolution.has(e)){let r=[];for(let i of this.interceptors.preResolution.getAll(e))i.options.frequency!="Once"&&r.push(i),i.callback(e,t);this.interceptors.preResolution.setAll(e,r)}}executePostResolutionInterceptor(e,t,r){if(this.interceptors.postResolution.has(e)){let i=[];for(let s of this.interceptors.postResolution.getAll(e))s.options.frequency!="Once"&&i.push(s),s.callback(e,t,r);this.interceptors.postResolution.setAll(e,i)}}resolveRegistration(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===vn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===vn.default.Singleton,i=e.options.lifecycle===vn.default.ContainerScoped,s=r||i,a;return sn.isValueProvider(e.provider)?a=e.provider.useValue:sn.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):sn.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):sn.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===vn.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new Ch.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&sn.isNormalToken(e)){if(r)return[];throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"All"),i){let a=i.map(c=>this.resolveRegistration(c,t));return this.executePostResolutionInterceptor(e,a,"All"),a}let s=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,s,"All"),s}isRegistered(e,t=!1){return this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)}reset(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()}clearInstances(){this.ensureNotDisposed();for(let[e,t]of this._registry.entries())this._registry.setAll(e,t.filter(r=>!sn.isValueProvider(r.provider)).map(r=>(r.instance=void 0,r)))}createChildContainer(){this.ensureNotDisposed();let e=new n(this);for(let[t,r]of this._registry.entries())r.some(({options:i})=>i.lifecycle===vn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===vn.default.ContainerScoped?{provider:i.provider,options:i.options}:i));return e}beforeResolution(e,t,r={frequency:"Always"}){this.interceptors.preResolution.set(e,{callback:t,options:r})}afterResolution(e,t,r={frequency:"Always"}){this.interceptors.postResolution.set(e,{callback:t,options:r})}dispose(){return M4.__awaiter(this,void 0,void 0,function*(){this.disposed=!0;let e=[];this.disposables.forEach(t=>{let r=t.dispose();r&&e.push(r)}),yield Promise.all(e)})}getRegistration(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null}getAllRegistrations(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null}construct(e,t){if(e instanceof V4.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=ks.typeInfo.get(e);if(!i||i.length===0){if(e.length===0)return new e;throw new Error(`TypeInfo not known for "${e.name}"`)}let s=i.map(this.resolveParams(t,e));return new e(...s)})();return U4.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return xh.isTokenDescriptor(r)?xh.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Ch.default,r.isOptional),...r.transformArgs):this.resolve(r.transform).transform(this.resolve(r.token,e,r.isOptional),...r.transformArgs):r.multiple?this.resolveAll(r.token,new Ch.default,r.isOptional):this.resolve(r.token,e,r.isOptional):xh.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(B4.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};ks.instance=new t_;ks.default=ks.instance});var DT=S(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});var W4=mo(),Ms=ga(),r_=_h(),G4=Z0();function z4(){return function(n){let e=W4.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return r_.isTokenDescriptor(r)?r_.isTransformDescriptor(r)?r.multiple?Ms.instance.resolve(r.transform).transform(Ms.instance.resolveAll(r.token),...r.transformArgs):Ms.instance.resolve(r.transform).transform(Ms.instance.resolve(r.token),...r.transformArgs):r.multiple?Ms.instance.resolveAll(r.token):Ms.instance.resolve(r.token):r_.isTransformDescriptor(r)?Ms.instance.resolve(r.transform).transform(Ms.instance.resolve(r.token),...r.transformArgs):Ms.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(G4.formatErrorCtor(n,a,s))}})))}}}}o(z4,"autoInjectable");n_.default=z4});var NT=S(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var H4=mo();function Q4(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return H4.defineInjectionTokenMetadata(t)}o(Q4,"inject");i_.default=Q4});var Ih=S(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var Y4=mo(),K4=ga(),LT=ga();function X4(n){return function(e){K4.typeInfo.set(e,Y4.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{LT.instance.register(t,e)}):LT.instance.register(n.token,e))}}o(X4,"injectable");s_.default=X4});var kT=S(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var J4=(hh(),Nd(dh)),Z4=ga();function eM(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=J4.__rest(t,["token","options"]);return Z4.instance.register(r,s,i)}),e}}o(eM,"registry");a_.default=eM});var MT=S(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var tM=Ih(),rM=ga();function nM(){return function(n){tM.default()(n),rM.instance.registerSingleton(n)}}o(nM,"singleton");o_.default=nM});var jT=S(c_=>{"use strict";Object.defineProperty(c_,"__esModule",{value:!0});var iM=mo();function sM(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return iM.defineInjectionTokenMetadata(t)}o(sM,"injectAll");c_.default=sM});var $T=S(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var aM=mo();function oM(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return aM.defineInjectionTokenMetadata(r)}o(oM,"injectAllWithTransform");l_.default=oM});var BT=S(u_=>{"use strict";Object.defineProperty(u_,"__esModule",{value:!0});var cM=mo();function lM(n,e,...t){return cM.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(lM,"injectWithTransform");u_.default=lM});var VT=S(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});var uM=Ih(),fM=ga();function dM(n,e){return function(t){uM.default()(t),fM.instance.register(e||t,t,{lifecycle:n})}}o(dM,"scoped");f_.default=dM});var UT=S(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});var hM=DT();Object.defineProperty(ai,"autoInjectable",{enumerable:!0,get:o(function(){return hM.default},"get")});var pM=NT();Object.defineProperty(ai,"inject",{enumerable:!0,get:o(function(){return pM.default},"get")});var mM=Ih();Object.defineProperty(ai,"injectable",{enumerable:!0,get:o(function(){return mM.default},"get")});var gM=kT();Object.defineProperty(ai,"registry",{enumerable:!0,get:o(function(){return gM.default},"get")});var yM=MT();Object.defineProperty(ai,"singleton",{enumerable:!0,get:o(function(){return yM.default},"get")});var _M=jT();Object.defineProperty(ai,"injectAll",{enumerable:!0,get:o(function(){return _M.default},"get")});var SM=$T();Object.defineProperty(ai,"injectAllWithTransform",{enumerable:!0,get:o(function(){return SM.default},"get")});var bM=BT();Object.defineProperty(ai,"injectWithTransform",{enumerable:!0,get:o(function(){return bM.default},"get")});var vM=VT();Object.defineProperty(ai,"scoped",{enumerable:!0,get:o(function(){return vM.default},"get")})});var qT=S(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});function wM(n){let e;return t=>(e==null&&(e=n(t)),e)}o(wM,"instanceCachingFactory");d_.default=wM});var WT=S(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});function EM(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(EM,"instancePerContainerCachingFactory");h_.default=EM});var GT=S(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});function TM(n,e,t,r=!0){let i,s;return a=>{let c=n(a);return(!r||s!==c)&&((s=c)?i=a.resolve(e):i=a.resolve(t)),i}}o(TM,"predicateAwareClassFactory");p_.default=TM});var zT=S(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});var AM=qT();Object.defineProperty(Nu,"instanceCachingFactory",{enumerable:!0,get:o(function(){return AM.default},"get")});var xM=WT();Object.defineProperty(Nu,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return xM.default},"get")});var CM=GT();Object.defineProperty(Nu,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return CM.default},"get")})});var le=S(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var m_=(hh(),Nd(dh));if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var IM=xT();Object.defineProperty(ya,"Lifecycle",{enumerable:!0,get:o(function(){return IM.Lifecycle},"get")});m_.__exportStar(UT(),ya);m_.__exportStar(zT(),ya);m_.__exportStar(G0(),ya);var RM=yh();Object.defineProperty(ya,"delay",{enumerable:!0,get:o(function(){return RM.delay},"get")});var OM=ga();Object.defineProperty(ya,"container",{enumerable:!0,get:o(function(){return OM.instance},"get")})});var bc=S(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});Rh.NullLogger=void 0;Rh.NullLogger={debug(){},info(){},warn(){},error(){}}});var g_=S((zZ,HT)=>{var vc=class{static{o(this,"Wildcard")}constructor(){return PM||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(vc.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(vc.prototype,"termType",{enumerable:!0,value:"Wildcard"});var PM=new vc;HT.exports.Wildcard=vc});var YT=S((QZ,QT)=>{var FM=(function(){var n=o(function(I,C,O,N){for(O=O||{},N=I.length;N--;O[I[N]]=C);return O},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],_=[123,126],b=[1,67],E=[39,45,87],v=[13,16,45,197,224,308],A=[1,87],R=[2,281],B=[1,86],W=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],we=[6,28,29,53,63,70,73,81,83,85],z=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],G=[6,13,16,28,29,45,53,63,70,73,81,82,83,85,87,89,197,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314],F=[6,13,16,28,29,31,39,45,47,48,53,63,70,73,81,82,83,85,87,89,109,112,121,123,126,128,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,337,338,340,341,342,343,344,345,346],j=[13,16,308],te=[112,132,327,334],Ye=[13,16,112,132,308],st=[1,111],Rt=[1,117],at=[112,132,327,328,334],ct=[13,16,112,132,308,328],Ke=[28,29,45,53,87],ie=[1,138],V=[1,151],lt=[1,128],pt=[1,127],H=[1,129],Re=[1,140],Ue=[1,141],re=[1,142],qe=[1,143],We=[1,144],je=[1,145],Ge=[1,147],Ae=[1,148],$e=[2,457],Oe=[1,158],Be=[1,159],ze=[1,160],ue=[1,152],pe=[1,153],me=[1,156],fe=[1,171],de=[1,172],he=[1,173],ce=[1,174],ge=[1,175],ye=[1,176],_e=[1,167],Se=[1,168],ae=[1,169],be=[1,170],Ze=[1,157],He=[1,166],Me=[1,161],w=[1,162],T=[1,163],x=[1,164],P=[1,165],Z=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],_t=[1,195],At=[6,31,73,81,83,85],Fe=[2,285],U=[1,199],q=[1,201],Q=[6,31,70,73,81,83,85],Y=[2,283],Ie=[1,207],tt=[1,218],rt=[1,223],Ar=[1,219],gn=[1,225],On=[1,226],Jr=[1,224],vE=[6,63,70,73,81,83,85],wE=[1,236],EE=[2,334],TE=[1,243],AE=[1,241],xr=[6,193],dd=[2,349],xE=[2,339],la=[28,128],CE=[47,48,193,272],hd=[47,48,193,242,272],rc=[47,48,193,242,246,272],nc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],dr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],IE=[1,271],RE=[1,270],Yt=[6,13,16,29,31,39,45,47,48,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],OE=[1,281],PE=[1,280],Zr=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],au=[45,89],pd=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],md=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],gd=[31,89],yd=[48,87],Xa=[6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338],zi=[6,13,16,39,45,48,82,87,89,231,263,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338,340],FE=[1,313],ic=[6,85],sy=[6,31,81,83,85],DE=[2,361],Es=[2,353],Ja=[1,343],ou=[31,112,335],Ts=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],ay=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335],NE=[6,109,193],Za=[31,112],Kt=[13,16,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],oy=[1,390],cy=[1,391],ua=[13,16,87,197,308,314],LE=[13,16,39,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],_d=[1,417],Sd=[1,418],kE=[13,16,48,197,229,308],fa=[6,31,85],ME=[6,13,16,31,45,73,81,83,85,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],ly=[6,13,16,29,31,45,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,231,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,346,347,348,349,350,351],eo=[29,31,85,112,159,160,161,163,164],bd=[1,443],vd=[1,444],jE=[1,449],to=[31,112,193,232,318,335],wd=[13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$E=[13,16,31,45,48,82,87,89,112,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],uy=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],cu=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],lu=[31,45],BE=[1,507],VE=[1,508],UE=[6,13,16,29,31,39,45,47,48,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,336,338,341,342,343,344,345,346,347,348,349,350,351],Ed=[29,31,85,112,159,160,161,163,164,335],ro=[6,13,16,31,45,70,73,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],qE=[13,16,31,45,48,82,87,89,112,193,197,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],WE=[2,352],fy=[13,16,197,308,314],GE=[1,565],sc=[6,13,16,31,45,76,78,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],zE=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],As=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],HE=[13,16,87,308],xs=[2,364],ac=[29,31,85,112,159,160,161,163,164,193,232,318,335],Td=[31,112,193,232,272,318,335],Cs=[2,359],QE=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ad=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],YE=[13,16,31,45,82,87,89,112,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],KE=[2,347],dy={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Query:7,Qry:8,Query_option0:9,Prologue_repetition0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectClauseWildcard:17,Qry_repetition0:18,WhereClause:19,SolutionModifierNoGroup:20,SelectClauseVars:21,Qry_repetition1:22,SolutionModifier:23,CONSTRUCT:24,ConstructTemplate:25,Qry_repetition2:26,Qry_repetition3:27,WHERE:28,"{":29,Qry_option0:30,"}":31,DESCRIBE:32,Qry_group0:33,Qry_repetition4:34,Qry_option1:35,ASK:36,Qry_repetition5:37,SelectClauseBase:38,"*":39,SelectClauseVars_repetition_plus0:40,SELECT:41,SelectClauseBase_option0:42,SelectClauseItem:43,Var:44,"(":45,Expression:46,AS:47,")":48,SubSelect:49,SubSelect_option0:50,SubSelect_option1:51,DatasetClause:52,FROM:53,DatasetClause_option0:54,iri:55,WhereClause_option0:56,GroupGraphPattern:57,SolutionModifier_option0:58,SolutionModifierNoGroup_option0:59,SolutionModifierNoGroup_option1:60,SolutionModifierNoGroup_option2:61,GroupClause:62,GROUP:63,BY:64,GroupClause_repetition_plus0:65,GroupCondition:66,BuiltInCall:67,FunctionCall:68,HavingClause:69,HAVING:70,HavingClause_repetition_plus0:71,OrderClause:72,ORDER:73,OrderClause_repetition_plus0:74,OrderCondition:75,ASC:76,BrackettedExpression:77,DESC:78,Constraint:79,LimitOffsetClauses:80,LIMIT:81,INTEGER:82,OFFSET:83,ValuesClause:84,VALUES:85,InlineData:86,VAR:87,InlineData_repetition0:88,NIL:89,InlineData_repetition1:90,InlineData_repetition_plus2:91,InlineData_repetition3:92,DataBlock:93,DataBlockValueList:94,DataBlockValueList_repetition_plus0:95,Update:96,Update_repetition0:97,Update1:98,Update_option0:99,LOAD:100,Update1_option0:101,Update1_option1:102,Update1_group0:103,Update1_option2:104,GraphRefAll:105,Update1_group1:106,Update1_option3:107,GraphOrDefault:108,TO:109,CREATE:110,Update1_option4:111,GRAPH:112,INSERTDATA:113,QuadPattern:114,DELETEDATA:115,DELETEWHERE:116,Update1_option5:117,InsertDeleteClause:118,Update1_repetition0:119,IntoGraphClause:120,INTO:121,GraphRef:122,DELETE:123,InsertDeleteClause_option0:124,InsertClause:125,INSERT:126,UsingClause:127,USING:128,UsingClause_option0:129,WithClause:130,WITH:131,DEFAULT:132,GraphOrDefault_option0:133,GraphRefAll_group0:134,Quads:135,Quads_option0:136,Quads_repetition0:137,QuadsNotTriples:138,VarOrIri:139,QuadsNotTriples_option0:140,QuadsNotTriples_option1:141,QuadsNotTriples_option2:142,TriplesTemplate:143,TriplesTemplate_repetition0:144,TriplesSameSubject:145,TriplesTemplate_option0:146,GroupGraphPatternSub:147,GroupGraphPatternSub_option0:148,GroupGraphPatternSub_repetition0:149,GroupGraphPatternSubTail:150,GraphPatternNotTriples:151,GroupGraphPatternSubTail_option0:152,GroupGraphPatternSubTail_option1:153,TriplesBlock:154,TriplesBlock_repetition0:155,TriplesSameSubjectPath:156,TriplesBlock_option0:157,GroupOrUnionGraphPattern:158,OPTIONAL:159,MINUS:160,SERVICE:161,GraphPatternNotTriples_option0:162,FILTER:163,BIND:164,InlineDataOneVar:165,InlineDataFull:166,InlineDataOneVar_repetition0:167,InlineDataFull_repetition0:168,InlineDataFull_repetition_plus1:169,InlineDataFull_repetition2:170,DataBlockValue:171,Literal:172,QuotedTriple:173,UNDEF:174,GroupOrUnionGraphPattern_repetition0:175,ArgList:176,ArgList_option0:177,ArgList_repetition0:178,ExpressionList:179,ExpressionList_repetition0:180,ConstructTemplate_option0:181,ConstructTriples:182,ConstructTriples_repetition0:183,ConstructTriples_option0:184,VarOrTermOrQuotedTP:185,PropertyListNotEmpty:186,TriplesNode:187,PropertyList:188,PropertyList_option0:189,VerbObjectList:190,PropertyListNotEmpty_repetition0:191,SemiOptionalVerbObjectList:192,";":193,SemiOptionalVerbObjectList_option0:194,Verb:195,ObjectList:196,a:197,ObjectList_repetition0:198,Object:199,GraphNode:200,Object_option0:201,PropertyListPathNotEmpty:202,TriplesNodePath:203,TriplesSameSubjectPath_option0:204,O:205,PropertyListPathNotEmpty_repetition0:206,PropertyListPathNotEmptyTail:207,O_group0:208,ObjectListPath:209,ObjectListPath_repetition0:210,ObjectPath:211,GraphNodePath:212,ObjectPath_option0:213,Path:214,Path_repetition0:215,PathSequence:216,PathSequence_repetition0:217,PathEltOrInverse:218,PathElt:219,PathPrimary:220,PathElt_option0:221,PathEltOrInverse_option0:222,IriOrA:223,"!":224,PathNegatedPropertySet:225,PathOneInPropertySet:226,PathNegatedPropertySet_repetition0:227,PathNegatedPropertySet_option0:228,"^":229,TriplesNode_repetition_plus0:230,"[":231,"]":232,TriplesNodePath_repetition_plus0:233,VarOrTermOrQuotedTPExpr:234,VarOrTerm:235,GraphTerm:236,BlankNode:237,ConditionalOrExpression:238,ConditionalAndExpression:239,ConditionalOrExpression_repetition0:240,ConditionalOrExpressionTail:241,"||":242,RelationalExpression:243,ConditionalAndExpression_repetition0:244,ConditionalAndExpressionTail:245,"&&":246,NumericExpression:247,RelationalExpression_group0:248,RelationalExpression_option0:249,IN:250,MultiplicativeExpression:251,NumericExpression_repetition0:252,AdditiveExpressionTail:253,AdditiveExpressionTail_group0:254,NumericLiteralPositive:255,AdditiveExpressionTail_repetition0:256,NumericLiteralNegative:257,AdditiveExpressionTail_repetition1:258,UnaryExpression:259,MultiplicativeExpression_repetition0:260,MultiplicativeExpressionTail:261,MultiplicativeExpressionTail_group0:262,"+":263,PrimaryExpression:264,"-":265,ExprQuotedTP:266,Aggregate:267,FUNC_ARITY0:268,FUNC_ARITY1:269,FUNC_ARITY1_SPARQL_STAR:270,FUNC_ARITY2:271,",":272,FUNC_ARITY3:273,FUNC_ARITY3_SPARQL_STAR:274,BuiltInCall_group0:275,BOUND:276,BNODE:277,BuiltInCall_option0:278,EXISTS:279,COUNT:280,Aggregate_option0:281,Aggregate_group0:282,FUNC_AGGREGATE:283,Aggregate_option1:284,GROUP_CONCAT:285,Aggregate_option2:286,Aggregate_option3:287,GroupConcatSeparator:288,SEPARATOR:289,"=":290,String:291,LANGTAG:292,"^^":293,DECIMAL:294,DOUBLE:295,BOOLEAN:296,INTEGER_POSITIVE:297,DECIMAL_POSITIVE:298,DOUBLE_POSITIVE:299,INTEGER_NEGATIVE:300,DECIMAL_NEGATIVE:301,DOUBLE_NEGATIVE:302,STRING_LITERAL1:303,STRING_LITERAL2:304,STRING_LITERAL_LONG1:305,STRING_LITERAL_LONG2:306,PrefixedName:307,PNAME_LN:308,BLANK_NODE_LABEL:309,ANON:310,QuotedTP:311,"<<":312,qtSubjectOrObject:313,">>":314,DataValueTerm:315,AnnotationPattern:316,"{|":317,"|}":318,AnnotationPatternPath:319,ExprVarOrTerm:320,QueryOrUpdate_group0_option0:321,Prologue_repetition0_group0:322,Qry_group0_repetition_plus0:323,SelectClauseBase_option0_group0:324,DISTINCT:325,REDUCED:326,NAMED:327,SILENT:328,CLEAR:329,DROP:330,ADD:331,MOVE:332,COPY:333,ALL:334,".":335,UNION:336,"|":337,"/":338,PathElt_option0_group0:339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,NOT:346,CONCAT:347,COALESCE:348,SUBSTR:349,REGEX:350,REPLACE:351,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"},productions_:[0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]],performAction:o(function(C,O,N,ne,Pe,g,tn){var y=g.length-1;switch(Pe){case 1:if(g[y-1]=g[y-1]||{},Ne.base&&(g[y-1].base=Ne.base),Ne.base="",g[y-1].prefixes=Ne.prefixes,Ne.prefixes=null,Ne.pathOnly){if(g[y-1].type==="path"||"termType"in g[y-1])return g[y-1];throw new Error("Received full SPARQL query in path only mode")}else if(g[y-1].type==="path"||"termType"in g[y-1])throw new Error("Received only path in full SPARQL mode");if(g[y-1].type==="update"){let St={};for(let Nt of g[y-1].updates)if(Nt.updateType==="insert"){let nt={};for(let ut of Nt.insert)if(ut.type==="bgp"||ut.type==="graph")for(let yn of ut.triples)yn.subject.termType==="BlankNode"&&(nt[yn.subject.value]=!0),yn.predicate.termType==="BlankNode"&&(nt[yn.predicate.value]=!0),yn.object.termType==="BlankNode"&&(nt[yn.object.value]=!0);for(let ut of Object.keys(nt)){if(St[ut])throw new Error("Detected reuse blank node across different INSERT DATA clauses");St[ut]=!0}}}return g[y-1];case 2:this.$={...g[y-1],...g[y],type:"query"};break;case 4:Ne.base=uu(g[y]);break;case 5:Ne.prefixes||(Ne.prefixes={}),g[y-1]=g[y-1].substr(0,g[y-1].length-1),g[y]=uu(g[y]),Ne.prefixes[g[y-1]]=g[y];break;case 6:this.$={...g[y-3],...so(g[y-2]),...g[y-1],...g[y]};break;case 7:if(!Ne.skipValidation&&(by(g[y-3].variables.map(Nt=>Sy(Nt.expression))).some(Nt=>Nt.aggregation==="count"&&!(Nt.expression instanceof xd))||g[y].group)){for(let Nt of g[y-3].variables)if(Nt.termType==="Variable"){if(!g[y].group||!g[y].group.map(nt=>uc(nt)).includes(uc(Nt)))throw Error("Projection of ungrouped variable (?"+uc(Nt)+")")}else if(Sy(Nt.expression).length===0){let nt=MD(Nt.expression);for(let ut of nt)if(!g[y].group||!g[y].group.map||!g[y].group.map(yn=>uc(yn)).includes(uc(ut)))throw Error("Use of ungrouped variable in projection of operation (?"+uc(ut)+")")}}let Ki=g[y-1].where.filter(St=>St.type==="query");if(Ki.length>0){let St=g[y-3].variables.filter(nt=>nt.variable&&nt.variable.value).map(nt=>nt.variable.value),Nt=by(Ki.map(nt=>nt.variables)).map(nt=>nt.value||nt.variable.value);for(let nt of St)if(Nt.indexOf(nt)>=0)throw Error("Target id of 'AS' (?"+nt+") already used in subquery")}this.$=qt(g[y-3],so(g[y-2]),g[y-1],g[y]);break;case 8:this.$=qt({queryType:"CONSTRUCT",template:g[y-3]},so(g[y-2]),g[y-1],g[y]);break;case 9:this.$=qt({queryType:"CONSTRUCT",template:g[y-2]=g[y-2]?g[y-2].triples:[]},so(g[y-5]),{where:[{type:"bgp",triples:io([],g[y-2])}]},g[y]);break;case 10:this.$=qt({queryType:"DESCRIBE",variables:g[y-3]==="*"?[new xd]:g[y-3]},so(g[y-2]),g[y-1],g[y]);break;case 11:this.$=qt({queryType:"ASK"},so(g[y-2]),g[y-1],g[y]);break;case 12:this.$=qt(g[y-1],{variables:[new xd]});break;case 13:let mu=g[y].map(St=>St.value||St.variable.value),fc=jD(mu);if(fc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+fc[0]+")");this.$=qt(g[y-1],{variables:g[y]});break;case 14:this.$=qt({queryType:"SELECT"},g[y]&&(g[y-1]=en(g[y]),g[y]={},g[y][g[y-1]]=!0,g[y]));break;case 16:case 27:this.$=oc(g[y-3],{variable:g[y-1]});break;case 17:case 18:this.$=qt(g[y-3],g[y-2],g[y-1],g[y],{type:"query"});break;case 19:case 58:this.$={iri:g[y],named:!!g[y-1]};break;case 20:this.$={where:g[y].patterns};break;case 21:this.$=qt(g[y-1],g[y]);break;case 22:this.$=qt(g[y-2],g[y-1],g[y]);break;case 23:this.$={group:g[y]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=oc(g[y]);break;case 26:this.$=oc(g[y-1]);break;case 29:this.$={having:g[y]};break;case 30:this.$={order:g[y]};break;case 32:this.$=oc(g[y],{descending:!0});break;case 35:this.$={limit:lc(g[y])};break;case 36:this.$={offset:lc(g[y])};break;case 37:this.$={limit:lc(g[y-2]),offset:lc(g[y])};break;case 38:this.$={limit:lc(g[y]),offset:lc(g[y-2])};break;case 39:case 43:this.$={type:"values",values:g[y]};break;case 40:case 84:this.$=g[y-1].map(St=>({[g[y-3]]:St}));break;case 41:case 85:this.$=g[y-1].map(()=>({}));break;case 42:case 86:var Yi=g[y-4].length;g[y-4]=g[y-4].map(hy),this.$=g[y-1].map(function(St){if(St.length!==Yi)throw Error("Inconsistent VALUES length");for(var Nt={},nt=0;nt<Yi;nt++)Nt["?"+g[y-4][nt].value]=St[nt];return Nt});break;case 44:case 65:case 100:case 126:case 175:this.$=g[y-1];break;case 45:this.$={type:"update",updates:Is(g[y-2],g[y-1])};break;case 46:this.$=qt({type:"load",silent:!!g[y-2],source:g[y-1]},g[y]&&{destination:g[y]});break;case 47:this.$={type:en(g[y-2]),silent:!!g[y-1],graph:g[y]};break;case 48:this.$={type:en(g[y-4]),silent:!!g[y-3],source:g[y-2],destination:g[y]};break;case 49:this.$={type:"create",silent:!!g[y-2],graph:{type:"graph",name:g[y]}};break;case 50:this.$={updateType:"insert",insert:o2(g[y])};break;case 51:this.$={updateType:"delete",delete:Ey(o2(g[y]))};break;case 52:this.$={updateType:"deletewhere",delete:Ey(g[y])};break;case 53:this.$={updateType:"insertdelete",...g[y-4],...g[y-3],...so(g[y-2],"using"),where:g[y].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=g[y];break;case 55:this.$={delete:Ey(g[y-1]),insert:g[y]||[]};break;case 56:this.$={delete:[],insert:g[y]};break;case 59:this.$={graph:g[y]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:g[y]};break;case 64:this.$={[en(g[y])]:!0};break;case 66:this.$=g[y-1]?Hi(g[y],[g[y-1]]):Hi(g[y]);break;case 67:var hu=qt(g[y-3]||{triples:[]},{type:"graph",name:g[y-5]});this.$=g[y]?[hu,g[y]]:[hu];break;case 68:case 73:this.$={type:"bgp",triples:Hi(g[y-2],[g[y-1]])};break;case 69:this.$={type:"group",patterns:[g[y-1]]};break;case 70:for(let St of g[y-1].filter(Nt=>Nt.type==="bind")){let Nt=g[y-1].indexOf(St),nt=new Set;for(let ut of g[y-1].slice(0,Nt))(ut.type==="group"||ut.type==="bgp")&&s2(ut).forEach(yn=>nt.add(yn));if(nt.has(St.variable.value))throw Error("Variable used to bind is already bound (?"+St.variable.value+")")}this.$={type:"group",patterns:g[y-1]};break;case 71:this.$=g[y-1]?Hi([g[y-1]],g[y]):Hi(g[y]);break;case 72:this.$=g[y]?[g[y-2],g[y]]:g[y-2];break;case 75:this.$=qt(g[y],{type:"optional"});break;case 76:this.$=qt(g[y],{type:"minus"});break;case 77:this.$=qt(g[y],{type:"graph",name:g[y-1]});break;case 78:this.$=qt(g[y],{type:"service",name:g[y-1],silent:!!g[y-2]});break;case 79:this.$={type:"filter",expression:g[y]};break;case 80:this.$={type:"bind",variable:g[y-1],expression:g[y-3]};break;case 89:this.$=du(g[y]);break;case 90:this.$=void 0;break;case 91:this.$=g[y-1].length?{type:"union",patterns:Hi(g[y-1].map(my),[my(g[y])])}:g[y];break;case 95:this.$={...g[y],function:g[y-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Is(g[y-2],g[y-1]),distinct:!!g[y-3]};break;case 98:case 115:case 128:case 247:case 249:case 251:case 253:case 255:case 263:case 267:case 297:case 299:case 303:case 307:case 328:case 341:case 349:case 355:case 361:case 367:case 369:case 373:case 375:case 379:case 381:case 385:case 391:case 395:case 401:case 405:case 409:case 411:case 420:case 428:case 430:case 440:case 444:case 446:case 448:this.$=[];break;case 99:this.$=Is(g[y-2],g[y-1]);break;case 101:this.$=Hi(g[y-2],[g[y-1]]);break;case 102:case 112:this.$=wy(g[y].map(St=>qt(Rs(g[y-1]),St)));break;case 103:this.$=wy(io(g[y].map(St=>qt(Rs(g[y-1].entity),St)),g[y-1].triples));break;case 105:this.$=Hi([g[y-1]],g[y]);break;case 106:this.$=Hi(g[y]);break;case 107:this.$=_y(g[y-1],g[y]);break;case 109:case 237:this.$=Ne.factory.namedNode(CD);break;case 110:case 118:this.$=Is(g[y-1],g[y]);break;case 111:this.$=g[y]?{annotation:g[y],object:g[y-1]}:g[y-1];break;case 113:this.$=g[y]?wy(io(g[y].map(St=>qt(Rs(g[y-1].entity),St)),g[y-1].triples)):g[y-1].triples;break;case 114:this.$=_y(...g[y-1],g[y]);break;case 116:this.$=_y(...g[y]);break;case 117:case 159:case 163:this.$=[g[y-1],g[y]];break;case 119:this.$=g[y]?{object:g[y-1],annotation:g[y]}:g[y-1];break;case 120:this.$=g[y-1].length?cc("|",Is(g[y-1],g[y])):g[y];break;case 121:this.$=g[y-1].length?cc("/",Is(g[y-1],g[y])):g[y];break;case 122:this.$=g[y]?cc(g[y],[g[y-1]]):g[y-1];break;case 123:this.$=g[y-1]?cc(g[y-1],[g[y]]):g[y];break;case 125:case 131:this.$=cc(g[y-1],[g[y]]);break;case 129:this.$=cc("|",Is(g[y-2],g[y-1]));break;case 132:case 134:this.$=LD(g[y-1]);break;case 133:case 135:this.$=kD(g[y-1]);break;case 140:this.$={entity:g[y],triples:[]};break;case 145:this.$=hy(g[y]);break;case 149:this.$=Ne.factory.namedNode(XE);break;case 151:case 153:case 158:case 162:this.$=py(g[y-1],g[y]);break;case 152:this.$=["||",g[y]];break;case 154:this.$=["&&",g[y]];break;case 156:this.$=Cr(g[y-1],[g[y-2],g[y]]);break;case 157:this.$=Cr(g[y-2]?"notin":"in",[g[y-3],g[y]]);break;case 160:this.$=["+",py(g[y-1],g[y])];break;case 161:var Rd=Qi(g[y-1].value.replace("-",""),g[y-1].datatype);this.$=["-",py(Rd,g[y])];break;case 164:this.$=Cr("UPLUS",[g[y]]);break;case 165:this.$=Cr(g[y-1],[g[y]]);break;case 166:this.$=Cr("UMINUS",[g[y]]);break;case 177:this.$=Cr(en(g[y-1]));break;case 178:this.$=Cr(en(g[y-3]),[g[y-1]]);break;case 179:this.$=du(Cr(en(g[y-3]),[g[y-1]]));break;case 180:this.$=Cr(en(g[y-5]),[g[y-3],g[y-1]]);break;case 181:this.$=Cr(en(g[y-7]),[g[y-5],g[y-3],g[y-1]]);break;case 182:this.$=du(Cr(en(g[y-7]),[g[y-5],g[y-3],g[y-1]]));break;case 183:this.$=Cr(en(g[y-1]),g[y]);break;case 184:this.$=Cr("bound",[hy(g[y-1])]);break;case 185:this.$=Cr(g[y-1],[]);break;case 186:this.$=Cr(g[y-3],[g[y-1]]);break;case 187:this.$=Cr(g[y-2]?"notexists":"exists",[my(g[y])]);break;case 188:case 189:this.$=oc(g[y-1],{type:"aggregate",aggregation:en(g[y-4]),distinct:!!g[y-2]});break;case 190:this.$=oc(g[y-2],{type:"aggregate",aggregation:en(g[y-5]),distinct:!!g[y-3],separator:typeof g[y-1]=="string"?g[y-1]:" "});break;case 192:this.$=Qi(g[y]);break;case 193:this.$=PD(g[y-1],en(g[y].substr(1)));break;case 194:this.$=Qi(g[y-2],g[y]);break;case 195:case 204:this.$=Qi(g[y],JE);break;case 196:case 205:this.$=Qi(g[y],ZE);break;case 197:case 206:this.$=Qi(en(g[y]),e2);break;case 200:this.$=Qi(g[y].toLowerCase(),OD);break;case 201:this.$=Qi(g[y].substr(1),JE);break;case 202:this.$=Qi(g[y].substr(1),ZE);break;case 203:this.$=Qi(g[y].substr(1).toLowerCase(),e2);break;case 207:case 208:this.$=i2(g[y],1);break;case 209:case 210:this.$=i2(g[y],3);break;case 211:this.$=Ne.factory.namedNode(uu(g[y]));break;case 213:var Od=g[y].indexOf(":"),pu=g[y].substr(0,Od),Pd=Ne.prefixes[pu];if(!Pd)throw new Error("Unknown prefix: "+pu);var jt=uu(Pd+g[y].substr(Od+1));this.$=Ne.factory.namedNode(jt);break;case 214:if(g[y]=g[y].substr(0,g[y].length-1),!(g[y]in Ne.prefixes))throw new Error("Unknown prefix: "+g[y]);var jt=uu(Ne.prefixes[g[y]]);this.$=Ne.factory.namedNode(jt);break;case 215:this.$=fu(g[y].replace(/^(_:)/,""));break;case 216:this.$=fu();break;case 217:case 218:case 232:this.$=du(gy(g[y-3],g[y-2],g[y-1]));break;case 230:case 231:this.$=du(g[y-1]);break;case 248:case 250:case 252:case 254:case 256:case 260:case 264:case 268:case 270:case 292:case 294:case 296:case 298:case 300:case 302:case 304:case 306:case 329:case 342:case 356:case 368:case 370:case 372:case 374:case 392:case 402:case 425:case 427:case 429:case 431:case 441:case 445:case 447:case 449:g[y-1].push(g[y]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[g[y]];break;case 308:g[y-3].push(g[y-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:g[y-2].push(g[y-1]);break}},"anonymous"),table:[n(e,t,{3:1,4:2,10:3}),{1:[3]},n(r,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:i,16:i,45:i,197:i,224:i,229:i,308:i,24:[1,13],32:[1,14],36:[1,15],41:s}),n([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:a},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(_,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:b,87:h},n(E,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),n(e,[2,248]),n(e,[2,245]),n(e,[2,246]),{13:[1,72]},{16:[1,73]},{1:[2,1]},{6:[2,2]},{6:[2,244]},{45:[1,77],85:[1,78],86:74,87:[1,75],89:[1,76]},n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],[2,120],{337:[1,79]}),n(v,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:A,29:R,52:84,53:B,56:85},{19:88,28:A,29:R,52:89,53:B,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:B},n(W,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(we,[2,263],{34:96}),n(we,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(we,[2,262]),n(z,[2,259]),n(G,[2,143]),n(G,[2,144]),n([6,13,16,28,29,31,39,45,47,48,53,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,145]),n(F,[2,211]),n(F,[2,212]),n(F,[2,213]),n(F,[2,214]),{19:98,28:A,29:R,52:99,53:B,56:85},{6:[2,309],99:100,193:[1,101]},n(j,[2,311],{101:102,328:[1,103]}),n(te,[2,317],{104:104,328:[1,105]}),n(Ye,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:st,114:110},{29:st,114:112},{29:st,114:113},{118:114,123:[1,115],125:116,126:Rt},n(at,[2,315]),n(at,[2,316]),n(ct,[2,319]),n(ct,[2,320]),n(ct,[2,321]),n(_,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:b,87:h}),n(Ke,[2,269]),n(Ke,[2,15]),{13:f,16:d,44:136,45:ie,46:120,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(E,[2,14]),n(E,[2,274]),n(E,[2,271]),n(E,[2,272]),n(e,[2,4]),{13:[1,177]},n(Z,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:d,45:[1,193],55:194,197:_t,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(v,[2,419]),n(At,Fe,{20:196,59:197,69:198,70:U}),n(l,[2,250]),{29:q,57:200},n(j,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(Q,Y,{23:204,58:205,62:206,63:Ie}),n(l,[2,252]),{19:208,28:A,29:R,52:209,53:B,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,145:212,172:221,185:213,187:214,231:Ar,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},n(vE,[2,265],{56:85,35:227,52:228,19:229,28:A,29:R,53:B}),n(z,[2,260]),n(Q,Y,{58:205,62:206,23:230,63:Ie}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:p},n(j,[2,312]),{105:233,112:wE,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(te,[2,318]),n(j,EE,{108:240,133:242,112:TE,132:AE}),n(Ye,[2,323]),{112:[1,244]},{112:[2,325]},n(xr,[2,50]),n(W,dd,{135:245,136:246,143:247,144:248,31:xE,112:xE}),n(xr,[2,51]),n(xr,[2,52]),n(la,[2,328],{119:249}),{29:st,114:250},n(la,[2,56]),{29:st,114:251},n(_,[2,59]),n(Ke,[2,270]),{47:[1,252]},n(CE,[2,150]),n(hd,[2,428],{240:253}),n(rc,[2,430],{244:254}),n(rc,[2,155],{248:255,249:256,250:[2,438],290:[1,257],341:[1,258],342:[1,259],343:[1,260],344:[1,261],345:[1,262],346:[1,263]}),n(nc,[2,440],{252:264}),n(dr,[2,448],{260:265}),{13:f,16:d,44:136,45:ie,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,55:133,67:132,68:134,77:131,82:V,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(dr,[2,167]),n(dr,[2,168]),n(dr,[2,169]),n(dr,[2,170],{176:269,45:IE,89:RE}),n(dr,[2,171]),n(dr,[2,172]),n(dr,[2,173]),n(dr,[2,174]),{13:f,16:d,44:136,45:ie,46:272,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:OE,89:PE,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(Zr,[2,192],{292:[1,286],293:[1,287]}),n(Zr,[2,195]),n(Zr,[2,196]),n(Zr,[2,197]),n(Zr,[2,198]),n(Zr,[2,199]),n(Zr,[2,200]),{13:f,16:d,44:39,55:40,82:V,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(au,[2,452]),n(au,[2,453]),n(au,[2,454]),n(au,[2,455]),n(au,[2,456]),{279:[2,458]},n(pd,[2,207]),n(pd,[2,208]),n(pd,[2,209]),n(pd,[2,210]),n(Zr,[2,201]),n(Zr,[2,202]),n(Zr,[2,203]),n(Zr,[2,204]),n(Zr,[2,205]),n(Zr,[2,206]),n(e,[2,5]),n(md,[2,297],{88:295}),n(gd,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(yd,[2,301]),n(Z,[2,43]),n(Z,[2,82]),n(Z,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(Xa,[2,123]),n(Xa,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(zi,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:_t,223:312,225:308,226:309,229:FE,307:43,308:p},n(c,i,{215:10,214:314}),n(zi,[2,236]),n(zi,[2,237]),n(ic,[2,6]),n(sy,[2,287],{60:315,72:316,73:[1,317]}),n(At,[2,286]),{13:f,16:d,45:ie,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,307:43,308:p,346:He,347:Me,348:w,349:T,350:x,351:P},n([6,31,63,70,73,81,83,85],[2,20]),n(W,DE,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Es,31:Es,85:Es,112:Es,159:Es,160:Es,161:Es,163:Es,164:Es,41:s}),{13:f,16:d,55:331,307:43,308:p},n(j,[2,280]),n(ic,[2,7]),n(At,Fe,{59:197,69:198,20:332,70:U}),n(Q,[2,284]),{64:[1,333]},n(Q,Y,{58:205,62:206,23:334,63:Ie}),n(l,[2,254]),n(W,dd,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:h,139:342,186:339,190:340,195:341,197:Ja,307:43,308:p},n(ou,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:d,87:h,197:Ja,308:p}),n(Ts,[2,227]),n(Ts,[2,228]),n(Ts,[2,229]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,172:221,185:351,187:350,200:348,230:347,231:Ar,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:Ja,307:43,308:p},n(Ts,[2,146]),n(Ts,[2,147]),n(Ts,[2,148]),n(Ts,[2,149]),{13:f,16:d,44:354,55:355,82:V,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:358,312:Jr,313:353},n(ay,[2,215]),n(ay,[2,216]),n(Q,Y,{58:205,62:206,23:359,63:Ie}),n(we,[2,264]),n(vE,[2,266]),n(ic,[2,11]),n(r,[2,308],{6:[2,310]}),n(xr,[2,313],{102:360,120:361,121:[1,362]}),n(xr,[2,47]),n(xr,[2,63]),n(xr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(xr,[2,336]),n(xr,[2,337]),n(xr,[2,338]),{109:[1,364]},n(NE,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(j,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n(Za,[2,341],{137:368}),n(Za,[2,340]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,145:369,172:221,185:213,187:214,231:Ar,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},{28:[1,370],127:371,128:[1,372]},n(la,[2,330],{124:373,125:374,126:Rt}),n(la,[2,57]),{44:375,87:h},n(CE,[2,151],{241:376,242:[1,377]}),n(hd,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:ie,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,247:380,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{250:[1,381]},n(Kt,[2,432]),n(Kt,[2,433]),n(Kt,[2,434]),n(Kt,[2,435]),n(Kt,[2,436]),n(Kt,[2,437]),{250:[2,439]},n([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:fe,298:de,299:he,300:ce,301:ge,302:ye}),n(nc,[2,162],{261:388,262:389,39:oy,338:cy}),n(dr,[2,164]),n(dr,[2,165]),n(dr,[2,166]),n(Yt,[2,95]),n(Yt,[2,96]),n(Kt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Yt,[2,177]),{13:f,16:d,44:136,45:ie,46:395,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,46:396,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,46:397,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,46:398,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,46:399,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,183]),n(Yt,[2,98]),n(Kt,[2,381],{180:400}),{87:[1,401]},n(Yt,[2,185]),{13:f,16:d,44:136,45:ie,46:402,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{29:q,57:403},n(Zr,[2,193]),{13:f,16:d,55:404,307:43,308:p},{13:f,16:d,44:39,55:40,87:h,139:342,195:405,197:Ja,307:43,308:p},n(ua,[2,233]),n(ua,[2,234]),n(ua,[2,235]),n(LE,[2,459],{281:406,325:[1,407]}),n(Kt,[2,463],{284:408,325:[1,409]}),n(Kt,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:V,171:413,172:415,173:416,174:_d,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Sd},{31:[1,419],89:[1,420]},{29:[1,421]},n(yd,[2,302]),n(md,[2,367],{167:422}),n(gd,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(yd,[2,371]),n(Xa,[2,122]),n(Xa,[2,417]),n(Xa,[2,413]),n(Xa,[2,414]),n(Xa,[2,415]),n(zi,[2,125]),n(zi,[2,127]),n(zi,[2,128]),n(kE,[2,420],{227:426}),n(zi,[2,130]),{13:f,16:d,55:194,197:_t,223:427,307:43,308:p},{48:[1,428]},n(fa,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(sy,[2,288]),{64:[1,433]},n(At,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:d,45:ie,268:Re,269:Ue,270:re,271:qe,273:We,274:je,276:Ge,277:Ae,279:$e,280:Oe,283:Be,285:ze,308:p,346:He,347:Me,348:w,349:T,350:x,351:P}),n(ME,[2,293]),n(ly,[2,92]),n(ly,[2,93]),n(ly,[2,94]),{45:IE,89:RE,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:A,29:R,56:85},{19:438,28:A,29:R,56:85},n(eo,[2,355],{149:439}),n(eo,[2,354]),{13:f,16:d,44:215,45:bd,55:220,82:V,87:h,89:rt,156:440,172:221,185:441,203:442,231:vd,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},n(we,[2,19]),n(fa,[2,21]),{13:f,16:d,44:450,45:jE,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,307:43,308:p,346:He,347:Me,348:w,349:T,350:x,351:P},n(ic,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(W,[2,386],{31:[2,388]}),n(ou,[2,102]),n(to,[2,391],{191:452}),n(W,[2,395],{196:453,198:454}),n(W,[2,108]),n(W,[2,109]),n(ou,[2,103]),n(ou,[2,104]),n(ou,[2,390]),{13:f,16:d,44:215,45:tt,48:[1,455],55:220,82:V,87:h,89:rt,172:221,185:351,187:350,200:456,231:Ar,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},n(wd,[2,424]),n($E,[2,136]),n($E,[2,137]),n(uy,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:Ja,307:43,308:p},n(ua,[2,219]),n(ua,[2,220]),n(ua,[2,221]),n(ua,[2,222]),n(ua,[2,223]),n(ic,[2,10]),n(xr,[2,46]),n(xr,[2,314]),{112:wE,122:459},n(xr,[2,62]),n(j,EE,{133:242,108:460,112:TE,132:AE}),n(NE,[2,61]),n(xr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Za,[2,351],{146:463,335:[1,464]}),{29:q,57:465},n(la,[2,329]),n(j,[2,332],{129:466,327:[1,467]}),n(la,[2,55]),n(la,[2,331]),{48:[1,468]},n(hd,[2,429]),{13:f,16:d,44:136,45:ie,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(rc,[2,431]),{13:f,16:d,44:136,45:ie,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,243:470,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(rc,[2,156]),{45:OE,89:PE,179:471},n(nc,[2,441]),{13:f,16:d,44:136,45:ie,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,251:472,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(dr,[2,444],{256:473}),n(dr,[2,446],{258:474}),n(Kt,[2,442]),n(Kt,[2,443]),n(dr,[2,449]),{13:f,16:d,44:136,45:ie,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,255:154,257:155,259:475,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(Kt,[2,450]),n(Kt,[2,451]),n(Kt,[2,379],{178:476}),n(Kt,[2,378]),n([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:f,16:d,44:136,45:ie,46:482,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{48:[1,483]},{48:[1,484]},n(Yt,[2,187]),n(Zr,[2,194]),{13:f,16:d,44:39,55:40,82:V,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,320:485},{13:f,16:d,39:[1,487],44:136,45:ie,46:488,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,282:486,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(LE,[2,460]),{13:f,16:d,44:136,45:ie,46:489,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(Kt,[2,464]),{13:f,16:d,44:136,45:ie,46:490,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(Kt,[2,466]),n(Z,[2,40]),n(md,[2,298]),n(cu,[2,87]),n(cu,[2,88]),n(cu,[2,89]),n(cu,[2,90]),{13:f,16:d,55:492,82:V,172:493,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,311:494,312:Jr,315:491},n(Z,[2,41]),n(gd,[2,300]),n(lu,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:V,171:497,172:415,173:416,174:_d,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Sd},{31:[1,498],89:[1,499]},{29:[1,500]},n(yd,[2,372]),{13:f,16:d,48:[2,422],55:194,197:_t,223:312,226:502,228:501,229:FE,307:43,308:p},n(zi,[2,131]),n(zi,[2,126]),n(fa,[2,22]),n(fa,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:ie,55:323,67:321,68:322,74:505,75:506,76:BE,77:320,78:VE,79:509,87:h,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,307:43,308:p,346:He,347:Me,348:w,349:T,350:x,351:P},n(ME,[2,294]),n(UE,[2,69]),n(UE,[2,70]),n(At,Fe,{59:197,69:198,20:511,70:U}),n(Q,Y,{58:205,62:206,23:512,63:Ie}),{29:[2,375],31:[2,71],84:522,85:a,112:[1,518],150:513,151:514,158:515,159:[1,516],160:[1,517],161:[1,519],163:[1,520],164:[1,521],175:523},n(eo,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:h}),n(Ed,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),{13:f,16:d,44:215,45:bd,55:220,82:V,87:h,89:rt,172:221,185:351,203:536,212:534,231:vd,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(Q,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:d,45:jE,87:h,268:Re,269:Ue,270:re,271:qe,273:We,274:je,276:Ge,277:Ae,279:$e,280:Oe,283:Be,285:ze,308:p,346:He,347:Me,348:w,349:T,350:x,351:P}),n(ro,[2,291]),n(ro,[2,24]),n(ro,[2,25]),{13:f,16:d,44:136,45:ie,46:539,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(ro,[2,28]),n(Q,Y,{58:205,62:206,23:540,63:Ie}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(to,[2,107]),{13:f,16:d,44:215,45:tt,55:220,82:V,87:h,89:rt,172:221,185:351,187:350,199:543,200:544,231:Ar,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},n(qE,[2,132]),n(wd,[2,425]),n(qE,[2,133]),{13:f,16:d,44:354,55:355,82:V,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:358,312:Jr,313:545},n(xr,[2,54]),n(xr,[2,48]),n(Za,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n(Za,[2,68]),n(W,[2,350],{31:WE,112:WE}),n(xr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(j,[2,333]),n(Ke,[2,16]),n(hd,[2,152]),n(rc,[2,154]),n(rc,[2,157]),n(nc,[2,159]),n(nc,[2,160],{262:389,261:548,39:oy,338:cy}),n(nc,[2,161],{262:389,261:549,39:oy,338:cy}),n(dr,[2,163]),{13:f,16:d,44:136,45:ie,46:550,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,178]),n(Yt,[2,179]),{13:f,16:d,44:136,45:ie,46:551,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,46:552,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,46:553,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{48:[1,554],272:[1,555]},n(Yt,[2,184]),n(Yt,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:f,16:d,55:194,197:_t,223:562,307:43,308:p},n(fy,[2,224]),n(fy,[2,225]),n(fy,[2,226]),{31:[1,563],45:GE,94:564},n(Z,[2,84]),n(md,[2,368]),n(Z,[2,85]),n(gd,[2,370]),n(lu,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(fa,[2,35],{83:[1,569]}),n(fa,[2,36],{81:[1,570]}),n(sy,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:f,16:d,45:ie,76:BE,78:VE,87:h,268:Re,269:Ue,270:re,271:qe,273:We,274:je,276:Ge,277:Ae,279:$e,280:Oe,283:Be,285:ze,308:p,346:He,347:Me,348:w,349:T,350:x,351:P}),n(sc,[2,295]),{45:ie,77:572},{45:ie,77:573},n(sc,[2,33]),n(sc,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(eo,[2,356]),n(zE,[2,357],{152:578,335:[1,579]}),n(As,[2,74]),{29:q,57:580},{29:q,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(HE,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:ie,55:323,67:321,68:322,77:320,79:585,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,307:43,308:p,346:He,347:Me,348:w,349:T,350:x,351:P},{45:[1,586]},n(As,[2,81]),{29:q,57:587},n(eo,[2,73]),n(W,[2,362],{29:xs,31:xs,85:xs,112:xs,159:xs,160:xs,161:xs,163:xs,164:xs}),n(Ed,[2,112]),n(ac,[2,401],{206:588}),n(W,[2,405],{209:589,210:590}),n(W,[2,403]),n(W,[2,404]),n(Ed,[2,113]),n(Ed,[2,400]),{13:f,16:d,44:215,45:bd,48:[1,591],55:220,82:V,87:h,89:rt,172:221,185:351,203:536,212:592,231:vd,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},n(wd,[2,426]),n(uy,[2,138]),n(uy,[2,139]),{232:[1,593]},n(ro,[2,292]),{47:[1,595],48:[1,594]},n(ic,[2,9]),n(to,[2,392]),n(to,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:Ja,308:p}),n(to,[2,110],{272:[1,598]}),n(Td,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(la,[2,58]),n(dr,[2,445]),n(dr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Yt,[2,99]),n(Kt,[2,382]),n([13,16,39,47,48,87,193,197,242,246,250,263,265,272,290,297,298,299,300,301,302,308,314,338,341,342,343,344,345,346],[2,232]),n(Yt,[2,188]),n(Yt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:V,172:493,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,311:494,312:Jr,315:611},n(Z,[2,42]),n(lu,[2,304]),{13:f,16:d,55:414,82:V,95:612,171:613,172:415,173:416,174:_d,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Sd},{31:[1,614],45:GE,94:615},n(zi,[2,129]),n(kE,[2,421]),{82:[1,616]},{82:[1,617]},n(sc,[2,296]),n(sc,[2,31]),n(sc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(W,DE,{155:330,153:618,154:619,29:Cs,31:Cs,85:Cs,112:Cs,159:Cs,160:Cs,161:Cs,163:Cs,164:Cs}),n(zE,[2,358]),n(As,[2,75]),n(As,[2,76]),{29:q,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(HE,[2,366]),n(As,[2,79]),{13:f,16:d,44:136,45:ie,46:622,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(As,[2,91],{336:[1,623]}),n([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),n(ac,[2,117]),{13:f,16:d,44:215,45:bd,55:220,82:V,87:h,89:rt,172:221,185:351,203:536,211:626,212:627,231:vd,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,309:gn,310:On,311:217,312:Jr},n(Ts,[2,134]),n(wd,[2,427]),n(Ts,[2,135]),n(ro,[2,26]),{44:628,87:h},n(to,[2,106]),n(to,[2,394]),n(W,[2,396]),n(Td,[2,111]),n(Td,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:Ja,307:43,308:p},n(ay,[2,217]),n(W,dd,{144:248,140:630,143:631,31:[2,343]}),n(Yt,[2,97]),n(Kt,[2,380]),n(Yt,[2,180]),{13:f,16:d,44:136,45:ie,46:632,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},{13:f,16:d,44:136,45:ie,46:633,55:133,67:132,68:134,77:131,82:V,87:h,172:135,224:lt,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:pt,264:130,265:H,266:137,267:139,268:Re,269:Ue,270:re,271:qe,273:We,274:je,275:146,276:Ge,277:Ae,278:149,279:$e,280:Oe,283:Be,285:ze,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Ze,346:He,347:Me,348:w,349:T,350:x,351:P},n(Yt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:V,171:637,172:415,173:416,174:_d,255:154,257:155,291:150,294:ue,295:pe,296:me,297:fe,298:de,299:he,300:ce,301:ge,302:ye,303:_e,304:Se,305:ae,306:be,307:43,308:p,312:Sd},n(QE,[2,305]),n(Z,[2,86]),n(lu,[2,374]),n(fa,[2,37]),n(fa,[2,38]),n(eo,[2,72]),n(eo,[2,360]),n(As,[2,77]),{29:q,57:638},{47:[1,639]},{29:[2,376]},n(ac,[2,402]),n(ac,[2,115],{215:10,208:528,214:529,44:530,205:640,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:h}),n(ac,[2,118],{272:[1,641]}),n(Ad,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:_e,304:Se,305:ae,306:be},n(cu,[2,218]),n(lu,[2,44]),n(QE,[2,306]),n(As,[2,78]),{44:651,87:h},n(ac,[2,116]),n(W,[2,406]),n(Ad,[2,119]),n(Ad,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(ro,[2,27]),n(Td,[2,230]),n(YE,[2,345],{141:653,335:[1,654]}),n(Yt,[2,181]),n(Yt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(W,dd,{144:248,142:657,143:658,31:KE,112:KE}),n(YE,[2,346]),n(As,[2,80]),n(Ad,[2,231]),n(Za,[2,67]),n(Za,[2,348])],defaultActions:{5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]},parseError:o(function(C,O){if(O.recoverable)this.trace(C);else{var N=new Error(C);throw N.hash=O,N}},"parseError"),parse:o(function(C){var O=this,N=[0],ne=[],Pe=[null],g=[],tn=this.table,y="",Yi=0,hu=0,Rd=0,Od=2,pu=1,Pd=g.slice.call(arguments,1),jt=Object.create(this.lexer),Ki={yy:{}};for(var mu in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mu)&&(Ki.yy[mu]=this.yy[mu]);jt.setInput(C,Ki.yy),Ki.yy.lexer=jt,Ki.yy.parser=this,typeof jt.yylloc>"u"&&(jt.yylloc={});var fc=jt.yylloc;g.push(fc);var St=jt.options&&jt.options.ranges;typeof Ki.yy.parseError=="function"?this.parseError=Ki.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Nt(Xi){N.length=N.length-2*Xi,Pe.length=Pe.length-Xi,g.length=g.length-Xi}o(Nt,"popStack");for(var nt=o(function(){var Xi;return Xi=jt.lex()||pu,typeof Xi!="number"&&(Xi=O.symbols_[Xi]||Xi),Xi},"lex"),ut,yn,ao,$n,lK,Ty,dc={},Fd,Os,c2,Dd;;){if(ao=N[N.length-1],this.defaultActions[ao]?$n=this.defaultActions[ao]:((ut===null||typeof ut>"u")&&(ut=nt()),$n=tn[ao]&&tn[ao][ut]),typeof $n>"u"||!$n.length||!$n[0]){var Ay="";Dd=[];for(Fd in tn[ao])this.terminals_[Fd]&&Fd>Od&&Dd.push("'"+this.terminals_[Fd]+"'");jt.showPosition?Ay="Parse error on line "+(Yi+1)+`:
|
|
34
34
|
`+jt.showPosition()+`
|
|
@@ -45,7 +45,7 @@ Expecting `+Dd.join(", ")+", got '"+(this.terminals_[ut]||ut)+"'":Ay="Parse erro
|
|
|
45
45
|
`)+`
|
|
46
46
|
`+s.trimStart()),s}findPrefixStarDeclarations(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(r.substring(i,i+6)==="PREFIX"){let s=i;for(i+=6;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]==="*"){for(i++;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]==="<"){i++;let a=i;for(;i<e.length&&e[i]!==">";)i++;if(e[i]===">"){let c=e.substring(a,i);i++;let l=this.findDeclarationEnd(e,i);t.push({uri:c,startPos:s,endPos:l}),i=l;continue}else throw new Tc(`Unclosed IRI in PREFIX* declaration at position ${a}`)}else throw new Tc(`Expected IRI after PREFIX* at position ${i}`)}else continue}i++}return t}findDeclarationEnd(e,t){let r=t;for(;r<e.length;){let i=e[r];if(i===`
|
|
47
47
|
`)return r+1;let s=e.substring(r).toUpperCase();if(s.startsWith("PREFIX")||s.startsWith("BASE")||s.startsWith("SELECT")||s.startsWith("CONSTRUCT")||s.startsWith("DESCRIBE")||s.startsWith("ASK"))return r;if(/\s/.test(i)){r++;continue}break}return r}extractPrefixFromUri(e){let t=e.replace(/^https?:\/\//,"");t=t.replace(/\/$/,"").replace(/#$/,"");let r=t.split(/[/.#]+/).filter(Boolean);if(r.length===0)return null;let i=r[r.length-1];return/^(ontology|vocab|schema|ns|core)$/i.test(i)&&r.length>1?r[r.length-2].toLowerCase():i.toLowerCase().replace(/[^a-z0-9]/g,"")}};ba.PrefixStarTransformer=O_;var Tc=class extends Error{static{o(this,"PrefixStarTransformerError")}constructor(e){super(`PREFIX* transformation error: ${e}`),this.name="PrefixStarTransformerError"}};ba.PrefixStarTransformerError=Tc});var P_=S(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.DescribeOptionsTransformer=xc.DescribeOptionsTransformerError=void 0;var Vh=class extends Error{static{o(this,"DescribeOptionsTransformerError")}constructor(e){super(e),this.name="DescribeOptionsTransformerError"}};xc.DescribeOptionsTransformerError=Vh;var Ac=class n{static{o(this,"DescribeOptionsTransformer")}transform(e){if(!n.DESCRIBE_QUERY_PATTERN.test(e))return{query:e};let t=e,r={},i=!1,s=n.DEPTH_PATTERN.exec(e);if(s){let a=parseInt(s[1],10);if(a<0)throw new Vh(`DESCRIBE DEPTH must be a non-negative integer, got: ${a}`);r.depth=a,i=!0,n.DEPTH_PATTERN.lastIndex=0,t=t.replace(n.DEPTH_PATTERN,"")}return n.DEPTH_PATTERN.lastIndex=0,n.SYMMETRIC_PATTERN.test(e)&&(r.symmetric=!0,i=!0,n.SYMMETRIC_PATTERN.lastIndex=0,t=t.replace(n.SYMMETRIC_PATTERN,"")),n.SYMMETRIC_PATTERN.lastIndex=0,t=t.replace(/\s{2,}/g," ").trim(),{query:t,options:i?r:void 0}}hasDescribeOptions(e){let t=n.DEPTH_PATTERN.test(e);n.DEPTH_PATTERN.lastIndex=0;let r=n.SYMMETRIC_PATTERN.test(e);return n.SYMMETRIC_PATTERN.lastIndex=0,t||r}};xc.DescribeOptionsTransformer=Ac;Ac.DEPTH_PATTERN=/\bDEPTH\s+(\d+)/gi;Ac.SYMMETRIC_PATTERN=/\bSYMMETRIC\b/gi;Ac.DESCRIBE_QUERY_PATTERN=/\bDESCRIBE\b/i});var oA=S(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.DirectionalLangTagTransformerError=Cc.DirectionalLangTagTransformer=void 0;var Uh=class n{static{o(this,"DirectionalLangTagTransformer")}constructor(){this.directionMappings=new Map}transform(e){return this.directionMappings.clear(),e.replace(n.DIRECTIONAL_TAG_REGEX,(t,r,i,s,a)=>{let c=s.toLowerCase();return this.directionMappings.set(c,a),`${r}${i}${r}@${s}`})}getDirection(e){return this.directionMappings.get(e.toLowerCase())}getAllMappings(){return new Map(this.directionMappings)}hasDirectionalTags(e){return n.DIRECTIONAL_TAG_REGEX.lastIndex=0,n.DIRECTIONAL_TAG_REGEX.test(e)}clearMappings(){this.directionMappings.clear()}};Cc.DirectionalLangTagTransformer=Uh;Uh.DIRECTIONAL_TAG_REGEX=/(["'])((?:[^\\]|\\.)*?)\1@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)--(ltr|rtl)/g;var F_=class extends Error{static{o(this,"DirectionalLangTagTransformerError")}constructor(e){super(`Directional language tag transformation error: ${e}`),this.name="DirectionalLangTagTransformerError"}};Cc.DirectionalLangTagTransformerError=F_});var cA=S(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.TripleTermTransformerError=Rc.TripleTermTransformer=void 0;var D_=class{static{o(this,"TripleTermTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Ic("Too many nested triple terms (max 100 iterations)");while(t!==r);return t}hasTripleTermSyntax(e){return this.findTripleTermPositions(e).length>0}transformSinglePass(e){let t=this.findTripleTermPositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractTripleTerm(r,s);if(a){let c=this.convertToStandardSyntax(a.content);r=r.substring(0,s)+c+r.substring(s+a.length)}}return r}findTripleTermPositions(e){let t=[],r=0;for(;r<e.length;){if(e[r]==="'"){r=this.skipStringLiteral(e,r,"'");continue}if(e[r]==='"'){r=this.skipStringLiteral(e,r,'"');continue}if(e.substring(r,r+2)==="<<"&&this.isParenthesizedTripleTerm(e,r)){t.push(r),r+=2;continue}r++}return t}skipStringLiteral(e,t,r){let i=r.repeat(3);if(e.substring(t,t+3)===i){for(t+=3;t<e.length;){if(e.substring(t,t+3)===i)return t+3;e[t]==="\\"&&t++,t++}return t}for(t++;t<e.length&&e[t]!==r;)e[t]==="\\"&&t++,t++;return t+1}isParenthesizedTripleTerm(e,t){let r=t+2;for(;r<e.length&&/\s/.test(e[r]);)r++;return e[r]==="("}extractTripleTerm(e,t){let r=t+2;for(;r<e.length&&/\s/.test(e[r]);)r++;if(e[r]!=="(")return null;r++;let i=1;for(;r<e.length&&i>0;){if(e[r]==="'"||e[r]==='"'){r=this.skipStringLiteral(e,r,e[r]);continue}if(e.substring(r,r+2)==="<<"&&this.isParenthesizedTripleTerm(e,r)){for(r+=2;r<e.length&&/\s/.test(e[r]);)r++;e[r]==="("&&(i++,r++);continue}if(e.substring(r,r+2)==="<<"){r+=2;let s=1;for(;r<e.length&&s>0;){if(e[r]==="'"||e[r]==='"'){r=this.skipStringLiteral(e,r,e[r]);continue}if(e.substring(r,r+2)==="<<"){s++,r+=2;continue}if(e.substring(r,r+2)===">>"){s--,r+=2;continue}r++}continue}if(e[r]==="("){i++,r++;continue}if(e[r]===")"){let s=r+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(e.substring(s,s+2)===">>"){if(i--,i===0){let a=e.substring(t,s+2);return{content:a,length:a.length}}r=s+2;continue}r++;continue}r++}if(i>0)throw new Ic(`Unclosed triple term at position ${t}: missing )>>`);return null}convertToStandardSyntax(e){let t=e.match(/^<<\s*\(\s*([\s\S]*?)\s*\)\s*>>$/);if(!t)throw new Ic(`Invalid triple term syntax: ${e.substring(0,50)}...`);return`<< ${t[1]} >>`}};Rc.TripleTermTransformer=D_;var Ic=class extends Error{static{o(this,"TripleTermTransformerError")}constructor(e){super(`Triple term transformation error: ${e}`),this.name="TripleTermTransformerError"}};Rc.TripleTermTransformerError=Ic});var L_=S(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.VaultPrefixTransformer=void 0;var QM=/PREFIX\s+(\w+)\s*:/gi,YM=new Set(["mailto","http","https","urn","ftp","prefix","base","select","construct","describe","ask","where","filter","optional","union","graph","order","group","having","limit","offset","values","bind","minus","service","insert","delete","load","clear","drop","create","move","copy","add"]),N_=class{static{o(this,"VaultPrefixTransformer")}constructor(){this.vaultPrefixes=new Map}setVaultPrefixes(e){this.vaultPrefixes=new Map(e)}getVaultPrefixes(){return new Map(this.vaultPrefixes)}transform(e){if(this.vaultPrefixes.size===0)return e;let t=this.findDeclaredPrefixes(e),r=[];for(let[a,c]of this.vaultPrefixes)!t.has(a.toLowerCase())&&!YM.has(a.toLowerCase())&&r.push({prefix:a,baseIRI:c});if(r.length===0)return e;let i="",s=0;for(;s<e.length;){let a=e[s];if(a==='"'||a==="'"){let l=this.skipLiteral(e,s);i+=e.substring(s,l),s=l;continue}if(a==="<"){let l=e.indexOf(">",s);l!==-1?(i+=e.substring(s,l+1),s=l+1):(i+=a,s++);continue}if(a==="#"){let l=e.indexOf(`
|
|
48
|
-
`,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,r);if(c){i+=c.iri,s=c.endIndex;continue}i+=a,s++}return i}tryReplacePrefixedName(e,t,r){if(t>0&&/[a-zA-Z0-9_]/.test(e[t-1]))return null;for(let{prefix:i,baseIRI:s}of r){if(e.substring(t,t+i.length+1)!==i+":")continue;let a=t+i.length+1,c=a;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===a)continue;let l=e.substring(a,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,r=new RegExp(QM.source,"gi"),i;for(;(i=r.exec(e))!==null;)t.add(i[1].toLowerCase());return t}skipLiteral(e,t){let r=e[t];if(t+2<e.length&&e.substring(t,t+3)===r+r+r){let s=e.indexOf(r+r+r,t+3);return s!==-1?s+3:e.length}let i=t+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;return i<e.length?i+1:e.length}};qh.VaultPrefixTransformer=N_});var Oc=S(wn=>{"use strict";var KM=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]})),XM=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),JM=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"&&KM(t,e,r[i]);return XM(t,e),t}})();Object.defineProperty(wn,"__esModule",{value:!0});wn.SPARQLParser=wn.ExoQLParser=wn.SPARQLParseError=void 0;var lA=JM(sA()),k_=I_(),M_=R_(),uA=aA(),j_=P_(),ZM=oA(),$_=cA(),ej=L_(),nr=class extends Error{static{o(this,"SPARQLParseError")}constructor(e,t,r,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=r}};wn.SPARQLParseError=nr;var Wh=class{static{o(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new lA.Parser({sparqlStar:!0}),this.generator=new lA.Generator({sparqlStar:!0}),this.caseWhenTransformer=new k_.CaseWhenTransformer,this.lateralTransformer=new M_.LateralTransformer,this.prefixStarTransformer=new uA.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new j_.DescribeOptionsTransformer,this.directionalLangTagTransformer=new ZM.DirectionalLangTagTransformer,this.tripleTermTransformer=new $_.TripleTermTransformer,this.vaultPrefixTransformer=new ej.VaultPrefixTransformer}setVaultPrefixes(e){this.vaultPrefixTransformer.setVaultPrefixes(e)}parse(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof j_.DescribeOptionsTransformerError)throw new nr(t.message);if(t instanceof M_.LateralTransformerError)throw new nr(t.message);if(t instanceof k_.CaseWhenTransformerError)throw new nr(t.message);if(t instanceof $_.TripleTermTransformerError)throw new nr(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new nr(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}parseWithOptions(e){return{query:this.parse(e),describeOptions:this.lastDescribeOptions}}getLastDescribeOptions(){return this.lastDescribeOptions}async parseAsync(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=await this.prefixStarTransformer.transform(i),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof j_.DescribeOptionsTransformerError)throw new nr(t.message);if(t instanceof uA.PrefixStarTransformerError)throw new nr(t.message);if(t instanceof M_.LateralTransformerError)throw new nr(t.message);if(t instanceof k_.CaseWhenTransformerError)throw new nr(t.message);if(t instanceof $_.TripleTermTransformerError)throw new nr(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new nr(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}async parseAsyncWithOptions(e){return{query:await this.parseAsync(e),describeOptions:this.lastDescribeOptions}}hasPrefixStar(e){return/PREFIX\s*\*/i.test(e)}hasLateral(e){return this.lateralTransformer.hasLateral(e)}hasDescribeOptions(e){return this.describeOptionsTransformer.hasDescribeOptions(e)}hasDirectionalLangTags(e){return this.directionalLangTagTransformer.hasDirectionalTags(e)}hasTripleTermSyntax(e){return this.tripleTermTransformer.hasTripleTermSyntax(e)}getLastDirectionMappings(){return new Map(this.lastDirectionMappings)}getDirectionForLanguage(e){return this.lastDirectionMappings.get(e.toLowerCase())}toString(e){try{return this.generator.stringify(e)}catch(t){throw t instanceof Error?new nr(`Failed to serialize SPARQL query: ${t.message}`,void 0,void 0,t):t}}getQueryType(e){if("queryType"in e&&e.type==="query")return e.queryType;throw new nr("Query does not have a valid queryType property")}isSelectQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="SELECT"}isConstructQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="CONSTRUCT"}isAskQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="ASK"}isDescribeQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="DESCRIBE"}isUpdateQuery(e){return e.type==="update"}isInsertDataOperation(e){return"updateType"in e&&e.updateType==="insert"}isDeleteDataOperation(e){return"updateType"in e&&e.updateType==="delete"}validateQuery(e){if(!e||typeof e!="object")throw new nr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new nr(`Invalid type: expected "query" or "update", got "${e.type}"`);if(e.type==="query"){let t=["SELECT","CONSTRUCT","ASK","DESCRIBE"];if(!t.includes(e.queryType))throw new nr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};wn.ExoQLParser=Wh;wn.SPARQLParser=Wh});var bo=S(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.AlgebraTranslatorError=void 0;var B_=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};Gh.AlgebraTranslatorError=B_});var zh=S(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.isVariableExpression=tj;ts.isVariableTerm=rj;ts.isNamedNode=nj;ts.isLiteral=ij;ts.isPropertyPath=sj;ts.isAggregateExpression=aj;ts.isOperationExpression=oj;ts.isFunctionCallExpression=cj;function tj(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}o(tj,"isVariableExpression");function rj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}o(rj,"isVariableTerm");function nj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}o(nj,"isNamedNode");function ij(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}o(ij,"isLiteral");function sj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}o(sj,"isPropertyPath");function aj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}o(aj,"isAggregateExpression");function oj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}o(oj,"isOperationExpression");function cj(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}o(cj,"isFunctionCallExpression")});var fA=S(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.TripleTranslator=void 0;var an=bo(),V_=class{static{o(this,"TripleTranslator")}constructor(){this.directionMappings=new Map}setDirectionMappings(e){this.directionMappings=e}translateBGP(e){if(!("triples"in e)||!Array.isArray(e.triples))throw new an.AlgebraTranslatorError("BGP pattern must have triples array");return{type:"bgp",triples:e.triples.map(t=>this.translateTriple(t))}}translateTriple(e){if(!e.subject||!e.predicate||!e.object)throw new an.AlgebraTranslatorError("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translatePredicate(e){return"type"in e&&e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!("pathType"in e)||!e.pathType)throw new an.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new an.AlgebraTranslatorError("Property path must have items array");let t=e.items.map(r=>this.translatePathItem(r));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new an.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new an.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new an.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new an.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new an.AlgebraTranslatorError(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if("type"in e&&e.type==="path")return this.translatePropertyPath(e);if("termType"in e&&e.termType==="NamedNode")return{type:"iri",value:e.value};let t="type"in e?e.type:"termType"in e?e.termType:"unknown";throw new an.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new an.AlgebraTranslatorError("Triple element must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};case"Literal":{let t={type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language};if(e.language){let r=this.directionMappings.get(e.language.toLowerCase());r&&(t.direction=r)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new an.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new an.AlgebraTranslatorError("Quoted triple must have subject, predicate, and object");return{type:"quoted",subject:this.translateTripleElement(e.subject),predicate:this.translateQuotedTriplePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateQuotedTriplePredicate(e){if(!e||!("termType"in e))throw new an.AlgebraTranslatorError("Quoted triple predicate must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};default:throw new an.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};Hh.TripleTranslator=V_});var dA=S(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.ExpressionTranslator=void 0;var Pc=bo(),U_=class{static{o(this,"ExpressionTranslator")}constructor(e){this.translateWhereFn=e.translateWhere,this.translateBGPFn=e.translateBGP,this.translatePatternFn=e.translatePattern}translateExpression(e){if(!e)throw new Pc.AlgebraTranslatorError("Expression cannot be null or undefined");if("type"in e&&e.type==="operation")return this.translateOperationExpression(e);let t="type"in e?e.type:void 0;if(t==="functioncall"||t==="functionCall"){let r=e;return{type:"functionCall",function:r.function,args:r.args.map(i=>this.translateExpression(i))}}if("termType"in e)return this.translateTermExpression(e);throw new Pc.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new Pc.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateTermExpression(e){if(e.termType==="Variable")return{type:"variable",name:e.value};if(e.termType==="Literal"){let t=e.value;return e.datatype&&(e.datatype.value.includes("#integer")||e.datatype.value.includes("#decimal")?t=parseFloat(e.value):e.datatype.value.includes("#boolean")&&(t=e.value==="true")),{type:"literal",value:t,datatype:e.datatype?.value}}return{type:"literal",value:String(e.value||e)}}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"],s=e.args.filter(a=>!("patterns"in a)||"termType"in a);return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:s.map(a=>this.translateExpression(a))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:e.operator==="exists"||e.operator==="notexists"?this.translateExistsExpression(e):e.operator==="in"||e.operator==="notin"?this.translateInExpression(e):{type:"function",function:e.operator,args:s.map(a=>this.translateExpression(a))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new Pc.AlgebraTranslatorError("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&"patterns"in t&&t.patterns?r=this.translateWhereFn(t.patterns):t.type==="bgp"?r=this.translateBGPFn(t):r=this.translatePatternFn(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new Pc.AlgebraTranslatorError("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],r=e.args[1];if(!Array.isArray(r))throw new Pc.AlgebraTranslatorError("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:r.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}};Qh.ExpressionTranslator=U_});var mA=S(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.PatternTranslator=void 0;var hA=R_(),Pr=bo(),pA=zh(),q_=class{static{o(this,"PatternTranslator")}constructor(e){this.directionMappings=new Map,this.translateExpressionFn=e.translateExpression,this.translateSelectFn=e.translateSelect,this.translateBGPFn=e.translateBGP}setDirectionMappings(e){this.directionMappings=e}translateWhere(e){if(e.length===0)throw new Pr.AlgebraTranslatorError("Empty WHERE clause");let t=e.filter(a=>a.type==="filter"),r=e.filter(a=>a.type==="bind"),i=e.filter(a=>a.type!=="filter"&&a.type!=="bind"),s;if(i.length===0)s={type:"bgp",triples:[]};else if(i.length===1)if(i[0].type==="optional"){let a=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:a?this.translateExpressionFn(a):void 0}}else s=this.translatePattern(i[0]);else{if(i[0].type==="optional"){let a=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:a?this.translateExpressionFn(a):void 0}}else s=this.translatePattern(i[0]);for(let a=1;a<i.length;a++){let c=i[a];if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelectFn(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional"){let l=c.expression;s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:l?this.translateExpressionFn(l):void 0}}else{let l=this.translatePattern(c);s={type:"join",left:s,right:l}}}}for(let a of r)s=this.translateBind(a,s);for(let a of t)s={type:"filter",expression:this.translateExpressionFn(a.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new Pr.AlgebraTranslatorError("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGPFn(e);case"filter":return this.translateFilter(e);case"optional":return this.translateOptional(e);case"union":return this.translateUnion(e);case"minus":return this.translateMinus(e);case"values":return this.translateValues(e);case"group":return this.translateWhere(e.patterns);case"query":return this.translateSubquery(e);case"service":return this.translateService(e);case"graph":return this.translateGraph(e);default:throw new Pr.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Pr.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpressionFn(e.expression),input:t}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new Pr.AlgebraTranslatorError("OPTIONAL pattern must have patterns");let t=e.expression;return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:t?this.translateExpressionFn(t):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new Pr.AlgebraTranslatorError("UNION pattern must have at least 2 patterns");let t=o(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(i):"patterns"in i&&i.patterns&&Array.isArray(i.patterns)?this.translateWhere(i.patterns):this.translateWhere([i]),"translateBranch"),r={type:"union",left:t(e.patterns[0]),right:t(e.patterns[1])};for(let i=2;i<e.patterns.length;i++)r={type:"union",left:r,right:t(e.patterns[i])};return r}translateMinus(e){if(!e.patterns||e.patterns.length===0)throw new Pr.AlgebraTranslatorError("MINUS pattern must have patterns");return{type:"minus",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns)}}translateValues(e){if(!e.values||!Array.isArray(e.values))throw new Pr.AlgebraTranslatorError("VALUES pattern must have values array");let t=new Set;for(let i of e.values)for(let s of Object.keys(i)){let a=s.startsWith("?")?s.slice(1):s;t.add(a)}let r=e.values.map(i=>this.translateValuesBinding(i));return{type:"values",variables:Array.from(t),bindings:r}}translateValuesBinding(e){let t={};for(let[r,i]of Object.entries(e)){let s=r.startsWith("?")?r.slice(1):r,a=i;if(a)if(a.termType==="NamedNode")t[s]={type:"iri",value:a.value};else if(a.termType==="Literal"){let c=a,l={type:"literal",value:c.value,datatype:c.datatype?.value,language:c.language||void 0};if(c.language){let u=this.directionMappings.get(c.language.toLowerCase());u&&(l.direction=u)}t[s]=l}else throw new Pr.AlgebraTranslatorError(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Pr.AlgebraTranslatorError("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpressionFn(e.expression),input:t}}translateSubquery(e){if(e.queryType!=="SELECT")throw new Pr.AlgebraTranslatorError(`Only SELECT subqueries are supported, got: ${String(e.queryType)}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelectFn(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new Pr.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Pr.AlgebraTranslatorError("SERVICE pattern must have patterns array");return{type:"service",endpoint:e.name.value,pattern:this.translateWhere(e.patterns),silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new Pr.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Pr.AlgebraTranslatorError("GRAPH pattern must have patterns array");let t;if(e.name.termType==="NamedNode")t={type:"iri",value:e.name.value};else if(e.name.termType==="Variable")t={type:"variable",value:e.name.value};else throw new Pr.AlgebraTranslatorError(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);return{type:"graph",name:t,pattern:this.translateWhere(e.patterns)}}isLateralPattern(e){if(e.type==="query"&&this.isLateralSubquery(e))return!0;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query"&&this.isLateralSubquery(t))return!0}return!1}extractLateralSubquery(e){if(e.type==="query")return e;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query")return t}throw new Pr.AlgebraTranslatorError("Invalid lateral pattern structure")}isLateralSubquery(e){return!("queryType"in e)||e.queryType!=="SELECT"||!("variables"in e)||!e.variables?!1:e.variables.some(i=>(0,pA.isVariableTerm)(i)&&i.value===hA.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){if(!("variables"in e)||!e.variables)return e;let t=e,r=t.variables;return{...t,variables:r.filter(i=>!((0,pA.isVariableTerm)(i)&&i.value===hA.LateralTransformer.LATERAL_MARKER))}}};Yh.PatternTranslator=q_});var yA=S(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.AggregateTranslator=void 0;var gA=bo(),lj=zh(),W_=class{static{o(this,"AggregateTranslator")}constructor(e){this.aggregateCounter=0,this.translateExpressionFn=e.translateExpression}resetCounter(){this.aggregateCounter=0}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)(0,lj.isVariableExpression)(i)&&("type"in i.expression&&i.expression.type==="aggregate"?(r.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,r,t));return r}extractGroupVariables(e){return e?e.filter(t=>t.expression&&"termType"in t.expression&&t.expression.termType==="Variable").map(t=>t.expression.value):[]}extractHavingExpressions(e,t,r){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,r);return e.map(i=>this.transformExpressionWithAggregateVars(i,r))}transformExpressionWithAggregateVars(e,t){let r=t.get(e);if(r!==void 0)return{type:"variable",name:r};if("type"in e&&e.type==="operation"&&"args"in e){let i=e,s=i.args.filter(u=>!Array.isArray(u)&&!("patterns"in u)).map(u=>this.transformExpressionWithAggregateVars(u,t)),a=["=","!=","<",">","<=",">="],c=["&&","||","!"],l=["+","-","*","/"];return a.includes(i.operator)?{type:"comparison",operator:i.operator,left:s[0],right:s[1]}:c.includes(i.operator)?{type:"logical",operator:i.operator,operands:s}:l.includes(i.operator)?{type:"arithmetic",operator:i.operator,left:s[0],right:s[1]}:{type:"function",function:i.operator,args:s}}return this.translateExpressionFn(e)}translateOrderComparator(e){return{expression:this.translateExpressionFn(e.expression),descending:e.descending||!1}}translateAggregateExpression(e){let t=e.aggregation,r=o(()=>{if(e.expression&&!("termType"in e.expression&&e.expression.termType==="Wildcard"))return this.translateExpressionFn(e.expression)},"translateInnerExpr");if(typeof t=="string"){let s=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(s)?{type:"aggregate",aggregation:s,expression:r(),distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:r(),distinct:e.distinct||!1,separator:e.separator}}let i=t;if(i&&typeof i=="object"){let s,a=i;if(a.termType==="NamedNode"&&typeof a.value=="string")s=a.value;else if("value"in a)s=String(a.value);else throw new gA.AlgebraTranslatorError(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(i)}`);return{type:"aggregate",aggregation:{type:"custom",iri:s},expression:r(),distinct:e.distinct||!1,separator:e.separator}}throw new gA.AlgebraTranslatorError(`Unknown aggregate format: ${JSON.stringify(t)}`)}collectNestedAggregates(e,t,r){if(e){if("type"in e&&e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if("type"in e&&e.type==="operation"&&"args"in e){let i=e;for(let s of i.args)!Array.isArray(s)&&"type"in s&&!("patterns"in s)?this.collectNestedAggregates(s,t,r):"termType"in s&&this.collectNestedAggregates(s,t,r)}}}};Kh.AggregateTranslator=W_});var Fc=S(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.AlgebraTranslator=va.ExoQLAlgebraTranslator=va.AlgebraTranslatorError=void 0;var Xh=bo(),Jh=zh(),uj=fA(),fj=dA(),dj=mA(),hj=yA(),pj=bo();Object.defineProperty(va,"AlgebraTranslatorError",{enumerable:!0,get:o(function(){return pj.AlgebraTranslatorError},"get")});var Zh=class{static{o(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new uj.TripleTranslator,this.expressionTranslator=new fj.ExpressionTranslator({translateWhere:o(e=>this.patternTranslator.translateWhere(e),"translateWhere"),translateBGP:o(e=>this.tripleTranslator.translateBGP(e),"translateBGP"),translatePattern:o(e=>this.patternTranslator.translatePattern(e),"translatePattern")}),this.patternTranslator=new dj.PatternTranslator({translateExpression:o(e=>this.expressionTranslator.translateExpression(e),"translateExpression"),translateSelect:o(e=>this.translateSelect(e),"translateSelect"),translateBGP:o(e=>this.tripleTranslator.translateBGP(e),"translateBGP")}),this.aggregateTranslator=new hj.AggregateTranslator({translateExpression:o(e=>this.expressionTranslator.translateExpression(e),"translateExpression")})}setDirectionMappings(e){this.tripleTranslator.setDirectionMappings(e),this.patternTranslator.setDirectionMappings(e)}translate(e){if(e.type!=="query")throw new Xh.AlgebraTranslatorError("Only query operations are supported (not updates)");if(e.queryType==="SELECT")return this.translateSelect(e);if(e.queryType==="CONSTRUCT")return this.translateConstruct(e);if(e.queryType==="ASK")return this.translateAsk(e);if(e.queryType==="DESCRIBE")return this.translateDescribe(e);throw new Xh.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new Xh.AlgebraTranslatorError("SELECT query must have WHERE clause");let t=this.patternTranslator.translateWhere(e.where);this.aggregateTranslator.resetCounter();let r=new Map,i=Array.isArray(e.variables)?e.variables.filter(l=>!("termType"in l&&l.termType==="Wildcard")):[],s=this.aggregateTranslator.extractAggregatesWithMapping(i,r),a=this.aggregateTranslator.extractGroupVariables(e.group),c=this.aggregateTranslator.extractHavingExpressions(e.having,s,r);if((s.length>0||a.length>0||c.length>0)&&(t={type:"group",variables:a,aggregates:s,having:c.length>0?c:void 0,input:t}),i.length>0){for(let u of i)if((0,Jh.isVariableExpression)(u)){if("type"in u.expression&&u.expression.type==="aggregate")continue;let f=this.aggregateTranslator.transformExpressionWithAggregateVars(u.expression,r);t={type:"extend",variable:u.variable.value,expression:f,input:t}}let l=i.filter(u=>(0,Jh.isVariableTerm)(u)||(0,Jh.isVariableExpression)(u)).map(u=>(0,Jh.isVariableTerm)(u)?u.value:u.variable.value);l.length>0&&(t={type:"project",variables:l,input:t})}return e.distinct&&(t={type:"distinct",input:t}),e.reduced&&(t={type:"reduced",input:t}),e.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(l=>this.aggregateTranslator.translateOrderComparator(l)),input:t}),(e.limit!==void 0||e.offset!==void 0)&&(t={type:"slice",limit:e.limit,offset:e.offset,input:t}),t}translateConstruct(e){let t=this.tripleTranslator.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new Xh.AlgebraTranslatorError("CONSTRUCT query must have WHERE clause");let r=this.patternTranslator.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(r={type:"slice",limit:i.limit,offset:i.offset,input:r}),{type:"construct",template:t,where:r}}translateAsk(e){return{type:"ask",where:e.where&&e.where.length>0?this.patternTranslator.translateWhere(e.where):{type:"bgp",triples:[]}}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables)){let s=e.variables;for(let a of s)a.termType==="Wildcard"||a.value==="*"||(a.termType==="Variable"?t.push({type:"variable",value:a.value}):a.termType==="NamedNode"&&t.push({type:"iri",value:a.value}))}let r;e.where&&e.where.length>0&&(r=this.patternTranslator.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};va.ExoQLAlgebraTranslator=Zh;va.AlgebraTranslator=Zh});var rs=S(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});ep.SolutionMapping=void 0;var _A=Ve(),SA=Ce(),bA=Gt(),G_=class n{static{o(this,"SolutionMapping")}constructor(e){this.bindings=e?new Map(e):new Map}get(e){return this.bindings.get(e)}set(e,t){this.bindings.set(e,t)}has(e){return this.bindings.has(e)}variables(){return Array.from(this.bindings.keys())}getBindings(){return new Map(this.bindings)}isCompatibleWith(e){for(let[t,r]of this.bindings.entries()){let i=e.get(t);if(i!==void 0&&!this.areEqual(r,i))return!1}return!0}merge(e){if(!this.isCompatibleWith(e))return null;let t=new n(this.bindings);for(let[r,i]of e.getBindings().entries())t.set(r,i);return t}clone(){return new n(this.bindings)}areEqual(e,t){return e instanceof _A.Literal&&t instanceof _A.Literal?e.equals(t):e instanceof SA.IRI&&t instanceof SA.IRI?e.value===t.value:e instanceof bA.BlankNode&&t instanceof bA.BlankNode?e.id===t.id:!1}toJSON(){let e={};for(let[t,r]of this.bindings.entries())e[t]=r.toString();return e}size(){return this.bindings.size}};ep.SolutionMapping=G_});var wA=S(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.PropertyPathExecutor=Dc.PropertyPathExecutorError=void 0;var mj=rs(),tp=Ce(),vA=Gt(),gj=Ve(),ju=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Dc.PropertyPathExecutorError=ju;var z_=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){if(this.isLiteralElement(e)||this.isLiteralElement(r)){let a=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:r,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l;console.warn(`[PropertyPathExecutor] literal-safety guard fired: literal in ${a} position \u2014 yielding 0 solutions. value="${u}"`);return}let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new mj.SolutionMapping;this.isVariable(e)&&u.set(e.value,a),this.isVariable(r)&&u.set(r.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new ju("Predicate is not a property path");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.object,t);for await(let s of this.execute(r,e.predicate,i)){let a=t.merge(s);a!==null&&(yield a)}}async evaluatePath(e,t,r){switch(t.pathType){case"/":return this.evaluateSequencePath(e,t.items,r);case"|":return this.evaluateAlternativePath(e,t.items,r);case"^":return this.evaluateInversePath(e,t.items[0],r);case"+":return this.evaluateOneOrMorePath(e,t.items[0],r);case"*":return this.evaluateZeroOrMorePath(e,t.items[0],r);case"?":return this.evaluateZeroOrOnePath(e,t.items[0],r)}}async evaluateSequencePath(e,t,r){let i=new Set([e]);for(let s=0;s<t.length;s++){let a=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,a,c?r:null);for(let d of f)l.add(d)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,r){let i=new Set;for(let s of t){let a=await this.evaluatePathItem(e,s,r);for(let c of a)i.add(c)}return i}async evaluateInversePath(e,t,r){if(t.type==="iri"){let i=new tp.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let c=a.shift();if(!c)break;let{node:l,depth:u}=c;if(u>=this.MAX_DEPTH)continue;let f=await this.evaluatePathItem(l,t,null);for(let d of f){let h=this.nodeToKey(d);(r===null||this.nodeInSet(d,r))&&s.add(d),i.has(h)||(i.add(h),a.push({node:d,depth:u+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new tp.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"|":return{type:"path",pathType:"|",items:e.items.map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"+":case"*":case"?":{let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new tp.IRI(e.value));break;case"blank":t.add(new vA.BlankNode(e.value));break;default:throw new ju(`Unsupported element type in subject/object position: ${e.type}`)}return t}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r){if(r instanceof tp.IRI)return{type:"iri",value:r.value};if(r instanceof vA.BlankNode)return{type:"blank",value:r.id};if(r instanceof gj.Literal)return{type:"literal",value:r.value,datatype:r.datatype?.value,language:r.language,direction:r.direction}}}return e}isVariable(e){return e.type==="variable"}isLiteralElement(e){return e.type==="literal"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};Dc.PropertyPathExecutor=z_});var Y_=S(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.BGPExecutor=Nc.BGPExecutorError=void 0;var rp=rs(),wa=Ce(),H_=Ve(),np=Gt(),ip=bu(),yj=wA(),Ur=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Nc.BGPExecutorError=Ur;var Q_=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new yj.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new rp.SolutionMapping;return}let t=this.matchTriplePattern(e.triples[0]);for(let r=1;r<e.triples.length;r++)t=this.joinWithPattern(t,e.triples[r]);for await(let r of t)yield r}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*executeInGraph(e,t){if(e.triples.length===0){yield new rp.SolutionMapping;return}let r=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)r=this.joinWithPatternInGraph(r,e.triples[i],t);for await(let i of r)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new Ur("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:r);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new Ur("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,a,t);for(let l of c){let u=new rp.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){if(this.isLiteral(e.subject)||this.isLiteral(e.object)){this.warnLiteralGuard("matchTriplePattern.propertyPath",this.isLiteral(e.subject)?"subject":"object",this.isLiteral(e.subject)?e.subject:e.object);return}yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:t);return}let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new rp.SolutionMapping;if(this.isVariable(e.subject))l.set(e.subject.value,c.subject);else if(this.isQuotedTriple(e.subject)){let u=this.matchQuotedTriplePattern(e.subject,c.subject);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}if(this.isVariable(t)&&l.set(t.value,c.predicate),this.isVariable(e.object))l.set(e.object.value,c.object);else if(this.isQuotedTriple(e.object)){let u=this.matchQuotedTriplePattern(e.object,c.object);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}yield l}}hasVariablesInQuotedTriple(e){return!!(this.isVariable(e.subject)||e.predicate.type==="variable"||this.isVariable(e.object)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object))}matchQuotedTriplePattern(e,t){if(!(t instanceof ip.QuotedTriple))return null;let r=new Map;if(this.isVariable(e.subject))r.set(e.subject.value,t.subject);else if(this.isQuotedTriple(e.subject)){let i=this.matchQuotedTriplePattern(e.subject,t.subject);if(i===null)return null;for(let[s,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.subject,t.subject))return null;if(e.predicate.type==="variable")r.set(e.predicate.value,t.predicate);else if(e.predicate.value!==t.predicate.value)return null;if(this.isVariable(e.object))r.set(e.object.value,t.object);else if(this.isQuotedTriple(e.object)){let i=this.matchQuotedTriplePattern(e.object,t.object);if(i===null)return null;for(let[s,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.object,t.object))return null;return r}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof wa.IRI&&e.value===t.value;case"literal":return!(!(t instanceof H_.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof np.BlankNode&&e.value===t.id;case"quoted":return t instanceof ip.QuotedTriple?this.toRDFQuotedTriple(e).equals(t):!1;default:return!1}}isPropertyPath(e){return e.type==="path"}async*joinWithPattern(e,t){let r=[];for await(let i of e)r.push(i);for(let i of r){let s=this.instantiatePattern(t,i);for await(let a of this.matchTriplePattern(s)){let c=i.merge(a);c!==null&&(yield c)}}}instantiatePattern(e,t){let r=this.isPropertyPath(e.predicate)?e.predicate:this.instantiateElement(e.predicate,t);return{subject:this.instantiateElement(e.subject,t),predicate:r,object:this.instantiateElement(e.object,t)}}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r)return this.toAlgebraElement(r)}return this.isQuotedTriple(e)?this.instantiateQuotedTriple(e,t):e}instantiateQuotedTriple(e,t){let r=this.instantiateElement(e.subject,t),i=e.predicate.type==="variable"?this.instantiatePredicateVariable(e.predicate,t):e.predicate,s=this.instantiateElement(e.object,t);return{type:"quoted",subject:r,predicate:i,object:s}}instantiatePredicateVariable(e,t){let r=t.get(e.value);return r&&r instanceof wa.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,r){let i="value"in r?String(r.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i;console.warn(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new wa.IRI(e.value);case"blank":return new np.BlankNode(e.value);case"literal":throw new Ur("Literals cannot appear in subject position");case"variable":throw new Ur(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Ur(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new wa.IRI(e.predicate.value):(()=>{throw new Ur("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new ip.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new wa.IRI(e.value);case"literal":throw new Ur("Literals cannot appear in predicate position");case"blank":throw new Ur("Blank nodes cannot appear in predicate position");case"variable":throw new Ur(`Cannot convert variable to RDF term: ${e.value}`);default:throw new Ur(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new wa.IRI(e.value);case"literal":return new H_.Literal(e.value,e.datatype?new wa.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new np.BlankNode(e.value);case"variable":throw new Ur(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Ur(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof wa.IRI)return{type:"iri",value:e.value};if(e instanceof H_.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof np.BlankNode)return{type:"blank",value:e.id};if(e instanceof ip.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new Ur(`Unknown RDF term type: ${String(e)}`)}toAlgebraQuotedTriple(e){return{type:"quoted",subject:this.toAlgebraElement(e.subject),predicate:{type:"iri",value:e.predicate.value},object:this.toAlgebraElement(e.object)}}};Nc.BGPExecutor=Q_});var EA=S(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.StringFunctions=void 0;var Lc=Ce(),Ea=Ve(),K_=Gt(),$u=class n{static{o(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Lc.IRI||e instanceof Ea.Literal?e.value:e instanceof K_.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof Ea.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof Ea.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=n.parseDirectionalLangTag(e),[s,a]=n.parseDirectionalLangTag(t),c=r.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":a&&i!==a?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let r=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[r,i]}static regex(e,t,r){try{let i=r?r.includes("u")?r:r+"u":"u";return new RegExp(t,i).test(e)}catch(i){throw new Error(`REGEX: invalid pattern '${t}': ${i.message}`)}}static contains(e,t){return e.includes(t)}static strStarts(e,t){return e.startsWith(t)}static strEnds(e,t){return e.endsWith(t)}static strlen(e){return e.length}static ucase(e){return e.toUpperCase()}static lcase(e){return e.toLowerCase()}static substr(e,t,r){let i=t-1;if(i<0){if(r!==void 0){let s=r+i;return s<=0?"":e.substring(0,s)}return e}return r!==void 0?e.substring(i,i+r):e.substring(i)}static strBefore(e,t){if(t==="")return"";let r=e.indexOf(t);return r===-1?"":e.substring(0,r)}static strAfter(e,t){if(t==="")return e;let r=e.indexOf(t);return r===-1?"":e.substring(r+t.length)}static concat(...e){return e.join("")}static replace(e,t,r,i){try{let s=i||"g",a=s.includes("u")?s:s+"u",c=new RegExp(t,a);return e.replace(c,r)}catch(s){throw new Error(`REPLACE: invalid pattern '${t}': ${s.message}`)}}static encodeForUri(e){return encodeURIComponent(e)}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let r;if(e instanceof Ea.Literal)r=e.value;else if(e instanceof Lc.IRI)r=e.value;else if(e instanceof K_.BlankNode)r=e.id;else if(typeof e=="string")r=e;else throw new Error("NORMALIZE: first argument must be a string or literal");let i="NFC";if(t!==void 0)if(t instanceof Ea.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Lc.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!n.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=r.normalize(i);return new Ea.Literal(s,new Lc.IRI("http://www.w3.org/2001/XMLSchema#string"))}static fold(e){if(e===void 0)throw new Error("FOLD: string argument is undefined");let t;if(e instanceof Ea.Literal)t=e.value;else if(e instanceof Lc.IRI)t=e.value;else if(e instanceof K_.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let r=n.unicodeCaseFold(t);return new Ea.Literal(r,new Lc.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=n.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}};sp.StringFunctions=$u;$u.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];$u.CASE_FOLDING_MAP=new Map([["\xDF","ss"],["\u1E9E","ss"],["\u03A3","\u03C3"],["\u03C2","\u03C3"],["\u0130","i\u0307"],["I","i"],["\u0587","\u0565\u0582"],["\uFB00","ff"],["\uFB01","fi"],["\uFB02","fl"],["\uFB03","ffi"],["\uFB04","ffl"],["\uFB05","st"],["\uFB06","st"],["\u0390","\u03B9\u0308\u0301"],["\u03B0","\u03C5\u0308\u0301"],["\u017F","s"],["\u1E9B","\u1E61"],["\u212A","k"],["\u212B","\xE5"]])});var TA=S(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.MathFunctions=void 0;var X_=class{static{o(this,"MathFunctions")}static msToMinutes(e){return Math.round(e/(1e3*60))}static msToHours(e){return Math.round(e/(1e3*60*60)*100)/100}static msToSeconds(e){return Math.round(e/1e3)}static abs(e){return Math.abs(e)}static round(e){return Math.round(e)}static ceil(e){return Math.ceil(e)}static floor(e){return Math.floor(e)}static rand(){return Math.random()}};ap.MathFunctions=X_});var cp=S(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.DateTimeParsing=void 0;var _j=Ce(),Sj=Ve(),J_=class n{static{o(this,"DateTimeParsing")}static parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static parseDayTimeDuration(e){if(!e)throw new Error("parseDayTimeDuration: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDayTimeDuration: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=r.indexOf("T"),a="",c="";if(s===-1?a=r:(a=r.substring(0,s),c=r.substring(s+1)),a){let l=a.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(a!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${a}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let h=parseFloat(u[1]);i+=h*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let h=parseFloat(f[1]);i+=h*60*1e3,l=l.substring(f[0].length)}let d=l.match(/^(\d+(?:\.\d+)?)S$/);if(d){let h=parseFloat(d[1]);i+=h*1e3,l=l.substring(d[0].length)}if(l!=="")throw new Error(`parseDayTimeDuration: invalid time component: '${l}' in '${e}'`)}return t?-i:i}static formatDayTimeDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/(1440*60*1e3));r=r%(1440*60*1e3);let s=Math.floor(r/(3600*1e3));r=r%(3600*1e3);let a=Math.floor(r/(60*1e3));r=r%(60*1e3);let c=r/1e3,l=t?"-P":"P";return i>0&&(l+=`${i}D`),(s>0||a>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),a>0&&(l+=`${a}M`),(c>0||s===0&&a===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return n.parseDayTimeDuration(e),new Sj.Literal(e,new _j.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(r[1],10),s=parseInt(r[2],10)-1,a=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,a));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,d=parseInt(u[2],10),h=parseInt(u[3],10),p=f*(d*60+h)*60*1e3;l=new Date(l.getTime()-p)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),a=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||a<0||a>59||i===24&&(s!==0||a!==0))return null;let u=0;if(c){let d=c.padEnd(3,"0").slice(0,3);u=parseInt(d,10)}let f=i*60*60*1e3+s*60*1e3+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let h=d[1]==="+"?1:-1,p=parseInt(d[2],10),_=parseInt(d[3],10),b=h*(p*60+_)*60*1e3;f-=b}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+a;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,a=t?"-P":"P";return i>0&&(a+=`${i}Y`),(s>0||i===0)&&(a+=`${s}M`),a}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:a,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=0,a=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.substring(l+1)),u){let d=u.match(/^(\d+(?:\.\d+)?)D$/);if(d)i=parseFloat(d[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let d=f,h=d.match(/^(\d+(?:\.\d+)?)H/);h&&(s=parseFloat(h[1]),d=d.substring(h[0].length));let p=d.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),d=d.substring(p[0].length));let _=d.match(/^(\d+(?:\.\d+)?)S$/);if(_&&(c=parseFloat(_[1]),d=d.substring(_[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}};op.DateTimeParsing=J_});var AA=S(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.DateTimeArithmetic=void 0;var on=Ce(),Te=Ve(),Xe=cp(),Z_=class{static{o(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r),a=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${r}'`);if(isNaN(a.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-a.getTime(),l=Xe.DateTimeParsing.formatDayTimeDuration(c);return new Te.Literal(l,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new Te.Literal(l.toISOString(),new on.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new Te.Literal(l.toISOString(),new on.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Te.Literal(h,new on.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Te.Literal(h,new on.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new Te.Literal(s.toISOString(),new on.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new Te.Literal(s.toISOString(),new on.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Te.Literal(d,new on.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Te.Literal(d,new on.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s+a);return new Te.Literal(c,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s-a);return new Te.Literal(c,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof Te.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i*t);return new Te.Literal(s,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationDivide(e,t){if(t===0)throw new Error("durationDivide: division by zero");let r=e instanceof Te.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i/t);return new Te.Literal(s,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s+a);return new Te.Literal(c,new on.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s-a);return new Te.Literal(c,new on.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Te.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Te.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Te.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Te.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/1e3}};lp.DateTimeArithmetic=Z_});var xA=S(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});up.DateTimeAccessors=void 0;var Bu=Ce(),Lt=Ve(),Tt=cp(),e1=class{static{o(this,"DateTimeAccessors")}static year(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return t.getFullYear()}static month(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return t.getMonth()+1}static day(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return t.getDate()}static hours(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return t.getHours()}static minutes(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return t.getMinutes()}static seconds(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return t.getSeconds()+t.getMilliseconds()/1e3}static durationDays(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let r;if(e.endsWith("Z"))r="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),a=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);a===0?r=`${c}PT${l}H`:r=`${c}PT${l}H${a}M`}else{let s=-t.getTimezoneOffset(),a=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?r=`${l}PT${a}H`:r=`${l}PT${a}H${c}M`}}return new Lt.Literal(r,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static tz(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TZ: invalid date string '${e}'`);if(e.endsWith("Z"))return"Z";let r=e.match(/([+-]\d{2}:\d{2})$/);if(r)return r[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static adjust(e,t){let r=e instanceof Lt.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let we=i.getUTCFullYear(),z=String(i.getUTCMonth()+1).padStart(2,"0"),G=String(i.getUTCDate()).padStart(2,"0"),F=String(i.getUTCHours()).padStart(2,"0"),j=String(i.getUTCMinutes()).padStart(2,"0"),te=String(i.getUTCSeconds()).padStart(2,"0"),Ye=i.getUTCMilliseconds(),st=`${we}-${z}-${G}T${F}:${j}:${te}`;return Ye>0&&(st+=`.${String(Ye).padStart(3,"0")}`),new Lt.Literal(st,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof Lt.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(a)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+a),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),h=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),_=String(u.getUTCMinutes()).padStart(2,"0"),b=String(u.getUTCSeconds()).padStart(2,"0"),E=u.getUTCMilliseconds(),v=a>=0?"+":"-",A=Math.floor(Math.abs(a)/(3600*1e3)),R=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),B=`${v}${String(A).padStart(2,"0")}:${String(R).padStart(2,"0")}`,W=`${f}-${d}-${h}T${p}:${_}:${b}`;return E>0&&(W+=`.${String(E).padStart(3,"0")}`),W+=B,new Lt.Literal(W,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static now(){return new Date().toISOString()}static dateBefore(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t);return r<i}static dateAfter(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t);return r>i}static dateInRange(e,t,r){let i=Tt.DateTimeParsing.parseDate(e),s=Tt.DateTimeParsing.parseDate(t),a=Tt.DateTimeParsing.parseDate(r);return i>=s&&i<=a}static compareDurations(e,t,r){let i=e instanceof Lt.Literal?e.value:e,s=t instanceof Lt.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(i),c=Tt.DateTimeParsing.parseDayTimeDuration(s);switch(r){case"=":return a===c;case"!=":return a!==c;case"<":return a<c;case">":return a>c;case"<=":return a<=c;case">=":return a>=c;default:throw new Error(`compareDurations: unknown operator: ${r}`)}}static dateDiffMinutes(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static timeDiff(e,t){let r=e instanceof Lt.Literal?e.value:e,i=t instanceof Lt.Literal?t.value:t,s=Tt.DateTimeParsing.parseXSDTime(r),a=Tt.DateTimeParsing.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${r}'`);if(a===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-a,l=Tt.DateTimeParsing.formatDayTimeDuration(c);return new Lt.Literal(l,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof Lt.Literal?e.value:e,i=t instanceof Lt.Literal?t.value:t,s=Tt.DateTimeParsing.parseXSDDate(r),a=Tt.DateTimeParsing.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${r}'`);if(a===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-a.getTime(),l=Math.round(c/(1440*60*1e3)),u=Tt.DateTimeParsing.formatDateDuration(l);return new Lt.Literal(u,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};up.DateTimeAccessors=e1});var r1=S(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});fp.DateTimeFunctions=void 0;var kc=cp(),ir=AA(),gt=xA(),t1=class{static{o(this,"DateTimeFunctions")}static parseDate(e){return kc.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return kc.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return kc.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return kc.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return kc.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return kc.DateTimeParsing.formatYearMonthDuration(e)}static year(e){return gt.DateTimeAccessors.year(e)}static month(e){return gt.DateTimeAccessors.month(e)}static day(e){return gt.DateTimeAccessors.day(e)}static hours(e){return gt.DateTimeAccessors.hours(e)}static minutes(e){return gt.DateTimeAccessors.minutes(e)}static seconds(e){return gt.DateTimeAccessors.seconds(e)}static durationDays(e){return gt.DateTimeAccessors.durationDays(e)}static durationHours(e){return gt.DateTimeAccessors.durationHours(e)}static durationMinutes(e){return gt.DateTimeAccessors.durationMinutes(e)}static durationSeconds(e){return gt.DateTimeAccessors.durationSeconds(e)}static durationYears(e){return gt.DateTimeAccessors.durationYears(e)}static durationMonths(e){return gt.DateTimeAccessors.durationMonths(e)}static timezone(e){return gt.DateTimeAccessors.timezone(e)}static tz(e){return gt.DateTimeAccessors.tz(e)}static adjust(e,t){return gt.DateTimeAccessors.adjust(e,t)}static now(){return gt.DateTimeAccessors.now()}static dateBefore(e,t){return gt.DateTimeAccessors.dateBefore(e,t)}static dateAfter(e,t){return gt.DateTimeAccessors.dateAfter(e,t)}static dateInRange(e,t,r){return gt.DateTimeAccessors.dateInRange(e,t,r)}static compareDurations(e,t,r){return gt.DateTimeAccessors.compareDurations(e,t,r)}static dateDiffMinutes(e,t){return gt.DateTimeAccessors.dateDiffMinutes(e,t)}static dateDiffHours(e,t){return gt.DateTimeAccessors.dateDiffHours(e,t)}static timeDiff(e,t){return gt.DateTimeAccessors.timeDiff(e,t)}static dateDiff(e,t){return gt.DateTimeAccessors.dateDiff(e,t)}static isDayTimeDuration(e){return gt.DateTimeAccessors.isDayTimeDuration(e)}static isDate(e){return gt.DateTimeAccessors.isDate(e)}static isYearMonthDuration(e){return gt.DateTimeAccessors.isYearMonthDuration(e)}static isTime(e){return gt.DateTimeAccessors.isTime(e)}static dateTimeDiff(e,t){return ir.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return ir.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return ir.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return ir.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return ir.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return ir.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return ir.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return ir.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return ir.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return ir.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return ir.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return ir.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return ir.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return ir.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return ir.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return ir.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return ir.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return ir.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return ir.DateTimeArithmetic.durationToSeconds(e)}};fp.DateTimeFunctions=t1});var CA=S(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});hp.LogicalFunctions=void 0;var bj=Ce(),Mc=Ve(),vj=Gt(),dp=r1(),n1=class n{static{o(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return dp.DateTimeFunctions.compareDurations(e instanceof Mc.Literal?e:String(e),t instanceof Mc.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return dp.DateTimeFunctions.compareDurations(e instanceof Mc.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return dp.DateTimeFunctions.compareDurations(e,t instanceof Mc.Literal?t:String(t),r);let i=n.toComparableValue(e),s=n.toComparableValue(t);switch(r){case"=":return i===s;case"!=":return i!==s;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:throw new Error(`Unknown comparison operator: ${r}`)}}static isDayTimeDurationValue(e){return e instanceof Mc.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static toComparableValue(e){if(typeof e=="string"||typeof e=="number")return e;if(e instanceof Mc.Literal){let t=e.datatype?.value;if(t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double")){let r=parseFloat(e.value);if(!isNaN(r))return r}if(t==="http://www.w3.org/2001/XMLSchema#dayTimeDuration")try{return dp.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof bj.IRI?e.value:e instanceof vj.BlankNode?e.id:String(e)}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,r){return e?t:r}};hp.LogicalFunctions=n1});var IA=S(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});pp.RDFTermFunctions=void 0;var Fr=Ce(),bt=Ve(),oi=Gt(),jc=bu(),i1=Sn(),s1=class n{static{o(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof bt.Literal)return e.datatype?e.datatype:e.language?new Fr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Fr.IRI("http://www.w3.org/2001/XMLSchema#string");throw new Error("DATATYPE: argument must be a literal")}static bound(e){return e!==void 0}static isIRI(e){return e===void 0?!1:e instanceof Fr.IRI}static isBlank(e){return e===void 0?!1:e instanceof oi.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof bt.Literal}static isTriple(e){return e===void 0?!1:e instanceof jc.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof bt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof bt.Literal))return!1;let t=e.datatype?.value;return t?["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float","http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedShort","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#positiveInteger"].includes(t):!1}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new bt.Literal(t.toISOString(),new Fr.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static xsdInteger(e){let t=parseInt(e,10);if(isNaN(t))throw new Error(`xsd:integer: cannot convert '${e}' to integer`);return new bt.Literal(String(t),new Fr.IRI("http://www.w3.org/2001/XMLSchema#integer"))}static xsdDecimal(e){let t=parseFloat(e);if(isNaN(t))throw new Error(`xsd:decimal: cannot convert '${e}' to decimal`);return new bt.Literal(String(t),new Fr.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static sameTerm(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0||e.constructor!==t.constructor)return!1;if(e instanceof Fr.IRI&&t instanceof Fr.IRI)return e.value===t.value;if(e instanceof oi.BlankNode&&t instanceof oi.BlankNode)return e.id===t.id;if(e instanceof bt.Literal&&t instanceof bt.Literal){if(e.value!==t.value||e.language!==t.language)return!1;let r=e.datatype?.value,i=t.datatype?.value;return r===i}return!1}static iri(e){if(e===void 0)throw new Error("IRI: argument is undefined");if(e instanceof Fr.IRI)return e;if(e instanceof bt.Literal)return new Fr.IRI(e.value);throw e instanceof oi.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return n.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,i1.v4)().replace(/-/g,"").substring(0,12)}`;return new oi.BlankNode(t)}if(e instanceof bt.Literal)return new oi.BlankNode(e.value);if(e instanceof oi.BlankNode)return e;throw new Error("BNODE: argument must be a string literal or omitted")}static strdt(e,t){if(e===void 0)throw new Error("STRDT: lexical form is undefined");if(t===void 0)throw new Error("STRDT: datatype IRI is undefined");let r;if(e instanceof bt.Literal){if(e.language)throw new Error("STRDT: lexical form must not have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRDT: lexical form must be a string literal");let i;if(t instanceof Fr.IRI)i=t;else if(t instanceof bt.Literal)i=new Fr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new bt.Literal(r,i)}static strlang(e,t){if(e===void 0)throw new Error("STRLANG: lexical form is undefined");if(t===void 0)throw new Error("STRLANG: language tag is undefined");let r;if(e instanceof bt.Literal){if(e.language)throw new Error("STRLANG: lexical form must not already have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRLANG: lexical form must be a string literal");let i;if(t instanceof bt.Literal)i=t.value;else if(typeof t=="string")i=t;else throw new Error("STRLANG: language tag must be a string literal");if(i==="")throw new Error("STRLANG: language tag cannot be empty");return new bt.Literal(r,void 0,i)}static strlangdir(e,t,r){if(e===void 0)throw new Error("STRLANGDIR: lexical form is undefined");if(t===void 0)throw new Error("STRLANGDIR: language tag is undefined");if(r===void 0)throw new Error("STRLANGDIR: direction is undefined");let i;if(e instanceof bt.Literal){if(e.language)throw new Error("STRLANGDIR: lexical form must not already have a language tag");i=e.value}else if(typeof e=="string")i=e;else throw new Error("STRLANGDIR: lexical form must be a string literal");let s;if(t instanceof bt.Literal)s=t.value;else if(typeof t=="string")s=t;else throw new Error("STRLANGDIR: language tag must be a string literal");if(s==="")throw new Error("STRLANGDIR: language tag cannot be empty");let a;if(r instanceof bt.Literal)a=r.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(a!=="ltr"&&a!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${a}'. Must be 'ltr' or 'rtl'`);return new bt.Literal(i,void 0,s,a)}static uuid(){let e=(0,i1.v4)();return new Fr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,i1.v4)();return new bt.Literal(e)}static triple(e,t,r){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(r===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof bt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Fr.IRI)){let c=t instanceof bt.Literal?"Literal":t instanceof oi.BlankNode?"BlankNode":t instanceof jc.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new jc.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof jc.QuotedTriple)){let t=e instanceof Fr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof oi.BlankNode?"BlankNode":typeof e;throw new Error(`SUBJECT: argument must be QuotedTriple, got ${t}`)}return e.subject}static predicate(e){if(e===void 0)throw new Error("PREDICATE: argument is undefined");if(!(e instanceof jc.QuotedTriple)){let t=e instanceof Fr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof oi.BlankNode?"BlankNode":typeof e;throw new Error(`PREDICATE: argument must be QuotedTriple, got ${t}`)}return e.predicate}static object(e){if(e===void 0)throw new Error("OBJECT: argument is undefined");if(!(e instanceof jc.QuotedTriple)){let t=e instanceof Fr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof oi.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};pp.RDFTermFunctions=s1});var RA=S(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});mp.HashFunctions=void 0;var a1=class{static{o(this,"HashFunctions")}static md5(e){return require("crypto").createHash("md5").update(e).digest("hex")}static sha1(e){return require("crypto").createHash("sha1").update(e).digest("hex")}static sha256(e){return require("crypto").createHash("sha256").update(e).digest("hex")}static sha384(e){return require("crypto").createHash("sha384").update(e).digest("hex")}static sha512(e){return require("crypto").createHash("sha512").update(e).digest("hex")}};mp.HashFunctions=a1});var yp=S(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.BuiltInFunctions=void 0;var sr=EA(),Ta=TA(),oe=r1(),$c=CA(),Ot=IA(),Vu=RA(),o1=class{static{o(this,"BuiltInFunctions")}static str(...e){return sr.StringFunctions.str(...e)}static lang(...e){return sr.StringFunctions.lang(...e)}static langdir(...e){return sr.StringFunctions.langdir(...e)}static langMatches(...e){return sr.StringFunctions.langMatches(...e)}static regex(...e){return sr.StringFunctions.regex(...e)}static contains(...e){return sr.StringFunctions.contains(...e)}static strStarts(...e){return sr.StringFunctions.strStarts(...e)}static strEnds(...e){return sr.StringFunctions.strEnds(...e)}static strlen(...e){return sr.StringFunctions.strlen(...e)}static ucase(...e){return sr.StringFunctions.ucase(...e)}static lcase(...e){return sr.StringFunctions.lcase(...e)}static substr(...e){return sr.StringFunctions.substr(...e)}static strBefore(...e){return sr.StringFunctions.strBefore(...e)}static strAfter(...e){return sr.StringFunctions.strAfter(...e)}static concat(...e){return sr.StringFunctions.concat(...e)}static replace(...e){return sr.StringFunctions.replace(...e)}static encodeForUri(...e){return sr.StringFunctions.encodeForUri(...e)}static normalize(...e){return sr.StringFunctions.normalize(...e)}static fold(...e){return sr.StringFunctions.fold(...e)}static abs(...e){return Ta.MathFunctions.abs(...e)}static round(...e){return Ta.MathFunctions.round(...e)}static ceil(...e){return Ta.MathFunctions.ceil(...e)}static floor(...e){return Ta.MathFunctions.floor(...e)}static rand(){return Ta.MathFunctions.rand()}static msToMinutes(...e){return Ta.MathFunctions.msToMinutes(...e)}static msToHours(...e){return Ta.MathFunctions.msToHours(...e)}static msToSeconds(...e){return Ta.MathFunctions.msToSeconds(...e)}static parseDate(...e){return oe.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return oe.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return oe.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return oe.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return oe.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return oe.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return oe.DateTimeFunctions.year(...e)}static month(...e){return oe.DateTimeFunctions.month(...e)}static day(...e){return oe.DateTimeFunctions.day(...e)}static hours(...e){return oe.DateTimeFunctions.hours(...e)}static minutes(...e){return oe.DateTimeFunctions.minutes(...e)}static seconds(...e){return oe.DateTimeFunctions.seconds(...e)}static timezone(...e){return oe.DateTimeFunctions.timezone(...e)}static tz(...e){return oe.DateTimeFunctions.tz(...e)}static now(){return oe.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return oe.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return oe.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return oe.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return oe.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return oe.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return oe.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return oe.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return oe.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return oe.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return oe.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return oe.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return oe.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return oe.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return oe.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return oe.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return oe.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return oe.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return oe.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return oe.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return oe.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return oe.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return oe.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return oe.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return oe.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return oe.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return oe.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return oe.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return oe.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return oe.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return oe.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return oe.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return oe.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return oe.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return oe.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return oe.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return oe.DateTimeFunctions.adjust(...e)}static isTime(...e){return oe.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return oe.DateTimeFunctions.timeDiff(...e)}static compare(...e){return $c.LogicalFunctions.compare(...e)}static logicalAnd(...e){return $c.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return $c.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return $c.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return $c.LogicalFunctions.coalesce(...e)}static if(...e){return $c.LogicalFunctions.if(...e)}static datatype(...e){return Ot.RDFTermFunctions.datatype(...e)}static bound(...e){return Ot.RDFTermFunctions.bound(...e)}static isIRI(...e){return Ot.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return Ot.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return Ot.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return Ot.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return Ot.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return Ot.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return Ot.RDFTermFunctions.sameTerm(...e)}static iri(...e){return Ot.RDFTermFunctions.iri(...e)}static uri(...e){return Ot.RDFTermFunctions.uri(...e)}static bnode(...e){return Ot.RDFTermFunctions.bnode(...e)}static strdt(...e){return Ot.RDFTermFunctions.strdt(...e)}static strlang(...e){return Ot.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return Ot.RDFTermFunctions.strlangdir(...e)}static uuid(){return Ot.RDFTermFunctions.uuid()}static struuid(){return Ot.RDFTermFunctions.struuid()}static xsdDateTime(...e){return Ot.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return Ot.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return Ot.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return Ot.RDFTermFunctions.triple(...e)}static subject(...e){return Ot.RDFTermFunctions.subject(...e)}static predicate(...e){return Ot.RDFTermFunctions.predicate(...e)}static object(...e){return Ot.RDFTermFunctions.object(...e)}static md5(...e){return Vu.HashFunctions.md5(...e)}static sha1(...e){return Vu.HashFunctions.sha1(...e)}static sha256(...e){return Vu.HashFunctions.sha256(...e)}static sha384(...e){return Vu.HashFunctions.sha384(...e)}static sha512(...e){return Vu.HashFunctions.sha512(...e)}};gp.BuiltInFunctions=o1});var Uu=S(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.ExoQLBudgetExceededError=ns.ExoQLCycleError=ns.ExoQLEvalDisabledError=ns.ExoQLForbiddenKeywordError=void 0;var c1=class extends Error{static{o(this,"ExoQLForbiddenKeywordError")}constructor(e,t){super(t??`ExoQLForbiddenKeywordError: keyword "${e}" is not permitted by the exoql__Query AST allowlist`),this.name="ExoQLForbiddenKeywordError",this.keyword=e}};ns.ExoQLForbiddenKeywordError=c1;var l1=class extends Error{static{o(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};ns.ExoQLEvalDisabledError=l1;var u1=class extends Error{static{o(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};ns.ExoQLCycleError=u1;var f1=class extends Error{static{o(this,"ExoQLBudgetExceededError")}constructor(e,t,r,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${r})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=r}};ns.ExoQLBudgetExceededError=f1});var jA=S(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var k=yp();M.functionHandlers=new Map;M.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.str(t)});M.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.lang(t)});M.functionHandlers.set("langmatches",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.langMatches(t,r)});M.functionHandlers.set("contains",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.contains(t,r)});M.functionHandlers.set("strstarts",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.strStarts(t,r)});M.functionHandlers.set("strends",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.strEnds(t,r)});M.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.strlen(t)});M.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.ucase(t)});M.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.lcase(t)});M.functionHandlers.set("substr",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=Number(e.evaluateExpression(n[1],e.solution));if(n[2]){let i=Number(e.evaluateExpression(n[2],e.solution));return k.BuiltInFunctions.substr(t,r,i)}return k.BuiltInFunctions.substr(t,r)});M.functionHandlers.set("strbefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.strBefore(t,r)});M.functionHandlers.set("strafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.strAfter(t,r)});M.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return k.BuiltInFunctions.concat(...t)});M.functionHandlers.set("replace",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution)),s=n[3]?e.getStringValue(e.evaluateExpression(n[3],e.solution)):void 0;return k.BuiltInFunctions.replace(t,r,i,s)});M.functionHandlers.set("regex",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=n[2]?e.getStringValue(e.evaluateExpression(n[2],e.solution)):void 0;return k.BuiltInFunctions.regex(t,r,i)});M.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.encodeForUri(t)});M.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.datatype(t).value});M.functionHandlers.set("bound",(n,e)=>{let t=n[0];if(t.type==="variable"&&t.name){let r=e.solution.get(t.name);return k.BuiltInFunctions.bound(r)}return!0});var OA=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",OA);M.functionHandlers.set("isuri",OA);M.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isBlank(t)});M.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isLiteral(t)});M.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isNumeric(t)});M.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.hasLangdir(t)});M.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isTriple(t)});M.functionHandlers.set("sameterm",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution);return k.BuiltInFunctions.sameTerm(t,r)});M.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.abs(t)});M.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.round(t)});M.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.ceil(t)});M.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.floor(t)});M.functionHandlers.set("rand",()=>k.BuiltInFunctions.rand());M.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.parseDate(t)});M.functionHandlers.set("datebefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.dateBefore(t,r)});M.functionHandlers.set("dateafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.dateAfter(t,r)});M.functionHandlers.set("dateinrange",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution));return k.BuiltInFunctions.dateInRange(t,r,i)});M.functionHandlers.set("datediffminutes",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.dateDiffMinutes(t,r)});M.functionHandlers.set("datediffhours",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.dateDiffHours(t,r)});var Bc=o((n,e,t)=>(r,i)=>{let s=i.evaluateExpression(r[0],i.solution);return e&&i.isYearMonthDurationValue(s)?e(s):t&&i.isDayTimeDurationValue(s)?t(s):n(i.getStringValue(s))},"createDateTimeAccessor"),PA=Bc(k.BuiltInFunctions.year.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationYears.bind(k.BuiltInFunctions),null);M.functionHandlers.set("year",PA);M.functionHandlers.set("years",PA);var FA=Bc(k.BuiltInFunctions.month.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationMonths.bind(k.BuiltInFunctions),null);M.functionHandlers.set("month",FA);M.functionHandlers.set("months",FA);var DA=Bc(k.BuiltInFunctions.day.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationDays.bind(k.BuiltInFunctions));M.functionHandlers.set("day",DA);M.functionHandlers.set("days",DA);M.functionHandlers.set("hours",Bc(k.BuiltInFunctions.hours.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationHours.bind(k.BuiltInFunctions)));M.functionHandlers.set("minutes",Bc(k.BuiltInFunctions.minutes.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationMinutes.bind(k.BuiltInFunctions)));M.functionHandlers.set("seconds",Bc(k.BuiltInFunctions.seconds.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationSeconds.bind(k.BuiltInFunctions)));M.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.timezone(t)});M.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.tz(t)});M.functionHandlers.set("adjust",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=n.length>1?e.evaluateExpression(n[1],e.solution):void 0;return k.BuiltInFunctions.adjust(t,r)});M.functionHandlers.set("now",()=>k.BuiltInFunctions.now());var NA=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",NA);M.functionHandlers.set("xsd:datetime",NA);var LA=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",LA);M.functionHandlers.set("xsd:integer",LA);var kA=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",kA);M.functionHandlers.set("xsd:decimal",kA);var MA=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",MA);M.functionHandlers.set("xsd:daytimeduration",MA);M.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToDays(t)});M.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToHours(t)});M.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToMinutes(t)});M.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToSeconds(t)});M.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationDays(t)});M.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationHours(t)});M.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationMinutes(t)});M.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationSeconds(t)});M.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationYears(t)});M.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationMonths(t)});M.functionHandlers.set("datetimediff",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return k.BuiltInFunctions.dateTimeDiff(t,r)});M.functionHandlers.set("datetimeadd",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return k.BuiltInFunctions.dateTimeAdd(t,r)});M.functionHandlers.set("datetimesubtract",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return k.BuiltInFunctions.dateTimeSubtract(t,r)});M.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToMinutes(t)});M.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToHours(t)});M.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToSeconds(t)});M.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.md5(t)});M.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha1(t)});M.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha256(t)});M.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha384(t)});M.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha512(t)});M.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.subject(t)});M.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.predicate(t)});M.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.object(t)});M.functionHandlers.set("triple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution),i=e.getTermFromExpression(n[2],e.solution);return k.BuiltInFunctions.triple(t,r,i)});M.functionHandlers.set("days_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(1440*60*1e3))});M.functionHandlers.set("minutes_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(60*1e3))});M.functionHandlers.set("hours_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return(new Date(r).getTime()-i.getTime())/(3600*1e3)});M.functionHandlers.set("age_days",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t);return Math.floor((new Date().getTime()-r.getTime())/(1440*60*1e3))});M.functionHandlers.set("week_number",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t),i=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()));i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7));let s=new Date(Date.UTC(i.getUTCFullYear(),0,1));return Math.ceil(((i.getTime()-s.getTime())/(1440*60*1e3)+1)/7)});M.functionHandlers.set("format_date",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return r.replace("YYYY",String(i.getFullYear())).replace("MM",String(i.getMonth()+1).padStart(2,"0")).replace("DD",String(i.getDate()).padStart(2,"0")).replace("HH",String(i.getHours()).padStart(2,"0")).replace("mm",String(i.getMinutes()).padStart(2,"0")).replace("ss",String(i.getSeconds()).padStart(2,"0"))});M.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:n}=Uu();throw new n})});var _p=S(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.FilterExecutor=Vc.FilterExecutorError=void 0;var yt=yp(),wj=jA(),Ej=Ce(),Aa=Ve(),hr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Vc.FilterExecutorError=hr;var d1=class{static{o(this,"FilterExecutor")}constructor(){this.existsEvaluator=null,this.tripleStore=null,this.uuidCache=new Map}setExistsEvaluator(e){this.existsEvaluator=e}setTripleStore(e){this.tripleStore=e,this.uuidCache.clear()}async*execute(e,t){let r=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;r?s=await this.evaluateExpressionAsync(e.expression,i):s=this.evaluateExpression(e.expression,i),s===!0&&(yield i)}catch{continue}}expressionContainsExists(e){if(!e||typeof e!="object")return!1;if(e.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="arithmetic"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(r=>this.expressionContainsExists(r))}if(e.type==="function"||e.type==="functionCall"){let t=e;return Array.isArray(t.args)?t.args.some(r=>this.expressionContainsExists(r)):!1}return!1}async executeAll(e,t){let r=[];async function*i(){for(let s of t)yield s}o(i,"generator");for await(let s of this.execute(e,i()))r.push(s);return r}evaluateExpression(e,t){let r=e;if("termType"in e)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":return r.value;case"NamedNode":return r.value;default:throw new hr(`Unsupported termType: ${String(r.termType)}`)}switch(e.type){case"comparison":return this.evaluateComparison(e,t);case"logical":return this.evaluateLogical(e,t);case"arithmetic":return this.evaluateArithmetic(e,t);case"function":case"functionCall":return this.evaluateFunction(e,t);case"variable":return t.get(e.name);case"literal":return e.value;case"in":return this.evaluateIn(e,t);case"exists":throw new hr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new hr(`Unsupported expression type: ${e.type}`)}}async evaluateExpressionAsync(e,t){if(!this.expressionContainsExists(e))return this.evaluateExpression(e,t);if(e.type==="exists")return this.evaluateExists(e,t);if(e.type==="logical")return this.evaluateLogicalAsync(e,t);if(e.type==="comparison"){let r=e,i=await this.evaluateExpressionAsync(r.left,t),s=await this.evaluateExpressionAsync(r.right,t);return yt.BuiltInFunctions.compare(i,s,r.operator)}return e.type==="in"?this.evaluateInAsync(e,t):e.type==="function"||e.type==="functionCall"?this.evaluateFunctionAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new hr("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let r=await this.existsEvaluator(e.pattern,t);return e.negated?!r:r}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let i=await this.evaluateExpressionAsync(e.operands[0],t);return yt.BuiltInFunctions.logicalNot(i)}let r=[];for(let i of e.operands){let s=await this.evaluateExpressionAsync(i,t);r.push(s)}if(e.operator==="&&")return yt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return yt.BuiltInFunctions.logicalOr(r);throw new hr(`Unknown logical operator: ${String(e.operator)}`)}async evaluateInAsync(e,t){let r=await this.evaluateExpressionAsync(e.expression,t),i=!1;for(let s of e.list){let a=await this.evaluateExpressionAsync(s,t);if(yt.BuiltInFunctions.compare(r,a,"=")){i=!0;break}}return e.negated?!i:i}async evaluateFunctionAsync(e,t){let r=e,i=this.extractFunctionName(r.function),s=r.args??[];if(i==="if"){if(s.length!==3)throw new hr("IF requires exactly 3 arguments");let l=await this.evaluateExpressionAsync(s[0],t);return this.toBoolean(l)?this.evaluateExpressionAsync(s[1],t):this.evaluateExpressionAsync(s[2],t)}if(i==="coalesce"){for(let l of s)try{let u=await this.evaluateExpressionAsync(l,t);if(u!=null)return u}catch{continue}return}let a=[];for(let l of s){let u=await this.evaluateExpressionAsync(l,t);a.push(this.wrapAsLiteralExpression(u))}let c={...r,args:a};return this.evaluateFunction(c,t)}wrapAsLiteralExpression(e){return e==null?{type:"literal",value:""}:typeof e=="object"&&e!==null&&"termType"in e?e:e instanceof Ej.IRI||e instanceof Aa.Literal?{type:"literal",value:e.value}:typeof e=="number"||typeof e=="boolean"||typeof e=="string"?{type:"literal",value:e}:{type:"literal",value:String(e)}}evaluateComparison(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return yt.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return yt.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return yt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return yt.BuiltInFunctions.logicalOr(r);throw new hr(`Unknown logical operator: ${String(e.operator)}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let a=this.evaluateExpression(s,t);return yt.BuiltInFunctions.compare(r,a,"=")});return e.negated?!i:i}evaluateArithmetic(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(r)&&this.isDateValue(i))return yt.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return yt.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return yt.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return yt.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return yt.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new hr("Division by zero");return yt.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),a=this.toNumericValue(i);switch(e.operator){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":if(a===0)throw new hr("Division by zero");return s/a;default:throw new hr(`Unknown arithmetic operator: ${String(e.operator)}`)}}isDayTimeDurationValue(e){return e instanceof Aa.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof Aa.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof Aa.Literal){let t=e.datatype?.value||"";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let i=parseFloat(e.value);if(!isNaN(i))return i}let r=parseFloat(e.value);if(!isNaN(r))return r}if(typeof e=="string"){let t=parseFloat(e);if(!isNaN(t))return t}if(e&&typeof e=="object"&&"value"in e){let t=parseFloat(String(e.value));if(!isNaN(t))return t}throw new hr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof Aa.Literal){let t=e.datatype?.value||"";return t.includes("#dateTime")||t.includes("#date")?!0:/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e.value)}return typeof e=="string"?/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e):!1}isDateValue(e){return e instanceof Aa.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof Aa.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let r=e,i=this.extractFunctionName(r.function),s=this.evaluateSpecialFunction(i,r.args,t);if(s!==void 0)return s.value;let a=wj.functionHandlers.get(i);if(!a)throw new hr(`Unknown function: ${i}`);let c={evaluateExpression:o((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:o((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:o(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:o(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:o(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return a(r.args,c)}extractFunctionName(e){if(typeof e=="string")return e.toLowerCase();if(e&&typeof e=="object"&&"value"in e){let t=e.value;return((t.includes("#")?t.split("#").pop():t.split("/").pop())||t).toLowerCase()}throw new hr(`Unknown function format: ${String(e)}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let i of t)try{let s=this.evaluateExpression(i,r);if(s!=null)return{value:s}}catch{continue}return{value:void 0};case"if":{if(!t||t.length!==3)throw new hr("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],r);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],r):this.evaluateExpression(t[2],r)}}case"byuuid":return{value:this.evaluateByUUID({type:"function",function:"byuuid",args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof Aa.Literal){let t=e.datatype?.value||"";if(t.includes("#boolean"))return e.value==="true"||e.value==="1";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let r=parseFloat(e.value);return!isNaN(r)&&r!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new hr("exo:byUUID requires exactly 1 argument (UUID string)");let r=this.evaluateExpression(e.args[0],t),i=this.getStringValue(r);if(!i)return;let s=i.toLowerCase();if(this.uuidCache.has(s))return this.uuidCache.get(s)??void 0;if(!this.tripleStore){this.uuidCache.set(s,null);return}if(this.tripleStore.findSubjectsByUUIDSync){let a=this.tripleStore.findSubjectsByUUIDSync(s);if(a.length===0){this.uuidCache.set(s,null);return}let c=a[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let r=e.toLowerCase();this.uuidCache.set(r,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Vc.FilterExecutor=d1});var p1=S(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.OptionalExecutor=void 0;var h1=class{static{o(this,"OptionalExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(r,i)}async executeAll(e,t){let r=[];for(let i of this.hashJoin(e,t))r.push(i);return r}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let r=new Set;for(let l of e)for(let u of l.variables())r.add(u);let i=new Set;for(let l of t)for(let u of l.variables())i.add(u);let s=[];for(let l of r)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let a="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,a),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,a),f=c.get(u),d=!1;if(f)for(let h of f){let p=l.merge(h);p!==null&&(yield p,d=!0)}d||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let a=e.get(s);i.push(a!==void 0?a.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let a=r.merge(s);a!==null&&(yield a,i=!0)}i||(yield r)}}};Sp.OptionalExecutor=h1});var g1=S(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.UnionExecutor=void 0;var m1=class{static{o(this,"UnionExecutor")}async*execute(e,t){let r=new Set;for await(let i of e){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}for await(let i of t){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};bp.UnionExecutor=m1});var $A=S(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});vp.MinusExecutor=void 0;var y1=class{static{o(this,"MinusExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);for(let s of r){let a=!1;for(let c of i)if(this.areCompatible(s,c)){a=!0;break}a||(yield s)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}areCompatible(e,t){let r=e.variables(),i=new Set(t.variables()),s=r.filter(a=>i.has(a));if(s.length===0)return!1;for(let a of s){let c=e.get(a),l=t.get(a);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};vp.MinusExecutor=y1});var VA=S(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.ValuesExecutor=Uc.ValuesExecutorError=void 0;var Tj=rs(),BA=Ce(),Aj=Ve(),wp=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Uc.ValuesExecutorError=wp;var _1=class{static{o(this,"ValuesExecutor")}async*execute(e){if(e.bindings.length!==0)for(let t of e.bindings)yield this.createSolutionMapping(t)}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}createSolutionMapping(e){let t=new Tj.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.toRDFTerm(i);t.set(r,s)}return t}toRDFTerm(e){if(e.type==="iri")return new BA.IRI(e.value);if(e.type==="literal")return new Aj.Literal(e.value,e.datatype?new BA.IRI(e.datatype):void 0,e.language,e.direction);throw new wp(`Unknown term type: ${e.type}`)}};Uc.ValuesExecutor=_1});var S1=S(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.CustomAggregateRegistry=Wc.CustomAggregateError=void 0;var qc=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Wc.CustomAggregateError=qc;var Ep=class n{static{o(this,"CustomAggregateRegistry")}constructor(){this.aggregates=new Map}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance&&n.instance.clear(),n.instance=null}register(e,t){if(!e||typeof e!="string")throw new qc("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new qc("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new qc(`Aggregate with IRI "${e}" is already registered`,e);this.aggregates.set(e,t)}unregister(e){return this.aggregates.delete(e)}get(e){return this.aggregates.get(e)}has(e){return this.aggregates.has(e)}getRegisteredIris(){return Array.from(this.aggregates.keys())}clear(){this.aggregates.clear()}get size(){return this.aggregates.size}};Wc.CustomAggregateRegistry=Ep;Ep.instance=null});var b1=S(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.BUILT_IN_AGGREGATES=Je.modeAggregate=Je.stddevAggregate=Je.varianceAggregate=Je.medianAggregate=Je.EXO_AGGREGATE_NS=void 0;Je.getNumericValue=Tp;Je.createDecimalLiteral=ci;Je.createDoubleLiteral=Ij;Je.createPercentileAggregate=vo;var wo=Ve(),Gc=Ce(),xj=new Gc.IRI("http://www.w3.org/2001/XMLSchema#decimal"),Cj=new Gc.IRI("http://www.w3.org/2001/XMLSchema#double");Je.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Tp(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof wo.Literal?parseFloat(n.value):n instanceof Gc.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(Tp,"getNumericValue");function ci(n){return new wo.Literal(String(n),xj)}o(ci,"createDecimalLiteral");function Ij(n){return new wo.Literal(String(n),Cj)}o(Ij,"createDoubleLiteral");Je.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Tp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ci(0);let r=[...t].sort((a,c)=>a-c),i=Math.floor(r.length/2),s=r.length%2!==0?r[i]:(r[i-1]+r[i])/2;return ci(s)}};Je.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Tp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ci(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return ci(i)}};Je.stddevAggregate={init(){return{values:[]}},step(n,e){Je.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ci(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return ci(Math.sqrt(i))}};Je.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof wo.Literal||e instanceof Gc.IRI?e.value:e),i=t.counts.get(r)||0;t.counts.set(r,i+1),t.values.set(r,e)},finalize(n){let e=n;if(e.counts.size===0)return new wo.Literal(" ",new Gc.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",r=0;for(let[a,c]of e.counts)c>r&&(r=c,t=a);let i=e.values.get(t);if(i instanceof wo.Literal)return i;let s=parseFloat(t);return isNaN(s)?new wo.Literal(t,new Gc.IRI("http://www.w3.org/2001/XMLSchema#string")):ci(s)}};function vo(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=Tp(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return ci(0);let s=[...i].sort((d,h)=>d-h),a=r.percentile*(s.length-1),c=Math.floor(a),l=Math.ceil(a);if(c===l)return ci(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return ci(f)}}}o(vo,"createPercentileAggregate");Je.BUILT_IN_AGGREGATES={[`${Je.EXO_AGGREGATE_NS}median`]:Je.medianAggregate,[`${Je.EXO_AGGREGATE_NS}variance`]:Je.varianceAggregate,[`${Je.EXO_AGGREGATE_NS}stddev`]:Je.stddevAggregate,[`${Je.EXO_AGGREGATE_NS}mode`]:Je.modeAggregate,[`${Je.EXO_AGGREGATE_NS}percentile25`]:vo(25),[`${Je.EXO_AGGREGATE_NS}percentile50`]:vo(50),[`${Je.EXO_AGGREGATE_NS}percentile75`]:vo(75),[`${Je.EXO_AGGREGATE_NS}percentile90`]:vo(90),[`${Je.EXO_AGGREGATE_NS}percentile95`]:vo(95),[`${Je.EXO_AGGREGATE_NS}percentile99`]:vo(99)}});var WA=S(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.AggregateExecutor=zc.AggregateExecutorError=void 0;var ar=Ve(),w1=Ce(),Rj=_p(),Oj=S1(),Pj=b1(),UA=new w1.IRI("http://www.w3.org/2001/XMLSchema#integer"),Eo=new w1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),is=new w1.IRI("http://www.w3.org/2001/XMLSchema#string");function qA(n){return typeof n=="object"&&n.type==="custom"}o(qA,"isCustomAggregation");var qu=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};zc.AggregateExecutorError=qu;var v1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new Rj.FilterExecutor}execute(e,t){let r=this.groupSolutions(t,e.variables),i=[];for(let[s,a]of r.entries()){let c=new Map;for(let f of e.variables)if(a.length>0){let d=a[0].get(f);d&&c.set(f,d)}for(let f of e.aggregates){let d=this.computeAggregate(f.expression,a);c.set(f.variable,d)}let{SolutionMapping:l}=rs(),u=new l;for(let[f,d]of c.entries())u.set(f,d);i.push(u)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let r=new Map;if(t.length===0)return r.set("",e),r;for(let i of e){let s=this.computeGroupKey(i,t),a=r.get(s);a?a.push(i):r.set(s,[i])}return r}computeGroupKey(e,t){return t.map(r=>{let i=e.get(r);return i?this.termToString(i):""}).join("|")}termToString(e){if(e&&typeof e=="object"){if("value"in e)return String(e.value);if("id"in e)return String(e.id)}return String(e)}computeAggregate(e,t){if(qA(e.aggregation))return this.computeCustomAggregate(e,t);let r=this.extractValues(e,t),i=e.aggregation;switch(i){case"count":{let s=this.computeCount(r,e.distinct);return new ar.Literal(String(s),UA)}case"sum":{let s=this.computeSum(r);return new ar.Literal(String(s),Eo)}case"avg":{let s=this.computeAvg(r);return new ar.Literal(String(s),Eo)}case"min":{let s=this.computeMin(r);return s===void 0?new ar.Literal("",is):typeof s=="number"?new ar.Literal(String(s),Eo):new ar.Literal(String(s),is)}case"max":{let s=this.computeMax(r);return s===void 0?new ar.Literal("",is):typeof s=="number"?new ar.Literal(String(s),Eo):new ar.Literal(String(s),is)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new ar.Literal(s||" ",is)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new ar.Literal(" ",is):typeof s=="number"?new ar.Literal(String(s),Eo):new ar.Literal(String(s),is)}default:{let s=i;throw new qu(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=Oj.CustomAggregateRegistry.getInstance().get(i);if(a||(a=Pj.BUILT_IN_AGGREGATES[i]),!a)throw new qu(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=a.init();for(let l of t){let u=null;if(e.expression){let f=this.evaluateExpression(e.expression,l);f!==void 0&&(u=f)}else u=1;a.step(c,u)}return a.finalize(c)}extractValues(e,t){if(!e.expression)return t.map(()=>1);let r=[];for(let i of t){let s=this.evaluateExpression(e.expression,i);s!=null&&r.push(s)}return r}evaluateExpression(e,t){if(e.type==="variable"){let r=t.get(e.name);return r==null?void 0:typeof r=="number"||typeof r=="string"||typeof r=="boolean"?r:typeof r=="object"&&"value"in r?r.value:r}if(e.type==="literal")return e.value;try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}computeCount(e,t){return t?new Set(e.map(r=>String(r))).size:e.length}computeSum(e){return e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r)).reduce((r,i)=>r+i,0)}computeAvg(e){let t=e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r));return t.length===0?0:t.reduce((r,i)=>r+i,0)/t.length}computeMin(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.min(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s<i?s:i,r[0])}computeMax(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.max(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s>i?s:i,r[0])}computeGroupConcat(e,t,r){let i=e.map(s=>String(s));return r&&(i=[...new Set(i)]),i.join(t)}computeSample(e,t){if(e.length===0)return;if(t){let s=[...new Set(e.map(l=>String(l)))];if(s.length===0)return;let a=s[0],c=parseFloat(a);return isNaN(c)?a:c}let r=e[0];if(typeof r=="number")return r;let i=parseFloat(String(r));return isNaN(i)?String(r):i}createEmptyAggregateResult(e){let{SolutionMapping:t}=rs(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(qA(s)){r.set(i.variable,new ar.Literal("0",Eo));continue}switch(s){case"count":r.set(i.variable,new ar.Literal("0",UA));break;case"sum":case"avg":r.set(i.variable,new ar.Literal("0",Eo));break;case"group_concat":r.set(i.variable,new ar.Literal(" ",is));break;case"min":case"max":case"sample":r.set(i.variable,new ar.Literal("",is));break;default:r.set(i.variable,new ar.Literal("",is))}}return r}};zc.AggregateExecutor=v1});var x1=S(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.ConstructExecutor=void 0;var Fj=ii(),To=Ce(),E1=Ve(),T1=Gt(),Dj=bu(),A1=class{static{o(this,"ConstructExecutor")}async execute(e,t){let r=[],i=new Set;for(let s of t)for(let a of e)try{let c=this.instantiateTriple(a,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),r.push(c))}catch{continue}return r}instantiateTriple(e,t){if(this.isPropertyPath(e.predicate))throw new Error("Property paths are not supported in CONSTRUCT templates");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.predicate,t),s=this.instantiateElement(e.object,t);return new Fj.Triple(r,i,s)}isPropertyPath(e){return e.type==="path"}instantiateElement(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable: ${e.value}`);return r}if(e.type==="iri")return new To.IRI(e.value);if(e.type==="literal")return new E1.Literal(e.value,e.datatype?new To.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new T1.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Unknown element type: ${e.type}`)}instantiateQuotedTriple(e,t){let r=this.instantiateQuotedSubject(e.subject,t),i=this.instantiateQuotedPredicate(e.predicate,t),s=this.instantiateQuotedObject(e.object,t);return new Dj.QuotedTriple(r,i,s)}instantiateQuotedSubject(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple subject: ${e.value}`);if(r instanceof E1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new To.IRI(e.value);if(e.type==="blank")return new T1.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Invalid element type for quoted triple subject: ${e.type}`)}instantiateQuotedPredicate(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple predicate: ${e.value}`);if(!(r instanceof To.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new To.IRI(e.value)}instantiateQuotedObject(e,t){if(e.type==="variable"){let i=t.get(e.value);if(!i)throw new Error(`Unbound variable in quoted triple object: ${e.value}`);return i}if(e.type==="iri")return new To.IRI(e.value);if(e.type==="blank")return new T1.BlankNode(e.value);if(e.type==="literal")return new E1.Literal(e.value,e.datatype?new To.IRI(e.datatype):void 0,e.language);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);let r=e;throw new Error(`Invalid element type for quoted triple object: ${r.type}`)}};Ap.ConstructExecutor=A1});var zA=S(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.ServiceExecutor=Hc.ServiceExecutorError=void 0;var Nj=rs(),GA=Ce(),Lj=Ve(),kj=Gt(),Ao=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Hc.ServiceExecutorError=Ao;var C1=class{static{o(this,"ServiceExecutor")}constructor(e={}){this.timeout=e.timeout??3e4,this.httpClient=e.httpClient??((t,r)=>fetch(t,r)),this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3}async*execute(e,t){try{let r=t(e.pattern),i=await this.executeRemoteQuery(e.endpoint,r);for(let s of i)yield s}catch(r){if(e.silent)return;throw r}}async executeRemoteQuery(e,t){let r;for(let i=0;i<=this.maxRetries;i++)try{let s=new AbortController,a=setTimeout(()=>s.abort(),this.timeout);try{let c=await this.httpClient(e,{method:"POST",headers:{"Content-Type":"application/sparql-query",Accept:"application/sparql-results+json"},body:t,signal:s.signal});if(!c.ok)throw new Ao(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(a)}}catch(s){if(r=s instanceof Error?s:new Error(String(s)),this.isRetryableError(r)&&i<this.maxRetries){await this.delay(this.retryDelay);continue}throw new Ao(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Ao(`Failed to query remote SPARQL endpoint ${e} after ${this.maxRetries+1} attempts`,r)}parseJsonResults(e){return!e.results||!Array.isArray(e.results.bindings)?[]:e.results.bindings.map(t=>this.parseBinding(t))}parseBinding(e){let t=new Nj.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.parseRDFTerm(i);t.set(r,s)}return t}parseRDFTerm(e){switch(e.type){case"uri":return new GA.IRI(e.value);case"literal":{let t=e.datatype?new GA.IRI(e.datatype):void 0;return new Lj.Literal(e.value,t,e["xml:lang"])}case"bnode":return new kj.BlankNode(e.value);default:throw new Ao(`Unknown RDF term type: ${e.type}`)}}isRetryableError(e){let t=e.message.toLowerCase();return!!(e.name==="AbortError"||t.includes("network")||t.includes("econnreset")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("returned 5"))}delay(e){return new Promise(t=>setTimeout(t,e))}};Hc.ServiceExecutor=C1});var QA=S(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.GraphExecutor=Qc.GraphExecutorError=void 0;var HA=Ce(),xp=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};Qc.GraphExecutorError=xp;var I1=class{static{o(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,r){let i=e.name;if(i.type==="iri")yield*this.executeWithGraph(e.pattern,i,t);else if(i.type==="variable")yield*this.executeWithGraphVariable(e,i,t,r);else throw new xp(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new HA.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*r(e,i))}async*executeWithGraphVariable(e,t,r,i){if(i){let a=i.get(t.value);if(a&&a instanceof HA.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:a.value},r);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let a of s)for await(let c of r(e.pattern,a)){let l=c.clone();l.set(t.value,a),yield l}}};Qc.GraphExecutor=I1});var YA=S(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.SPARQLGenerator=Kc.SPARQLGeneratorError=void 0;var Yc=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Kc.SPARQLGeneratorError=Yc;var R1=class{static{o(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
48
|
+
`,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,r);if(c){i+=c.iri,s=c.endIndex;continue}i+=a,s++}return i}tryReplacePrefixedName(e,t,r){if(t>0&&/[a-zA-Z0-9_]/.test(e[t-1]))return null;for(let{prefix:i,baseIRI:s}of r){if(e.substring(t,t+i.length+1)!==i+":")continue;let a=t+i.length+1,c=a;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===a)continue;let l=e.substring(a,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,r=new RegExp(QM.source,"gi"),i;for(;(i=r.exec(e))!==null;)t.add(i[1].toLowerCase());return t}skipLiteral(e,t){let r=e[t];if(t+2<e.length&&e.substring(t,t+3)===r+r+r){let s=e.indexOf(r+r+r,t+3);return s!==-1?s+3:e.length}let i=t+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;return i<e.length?i+1:e.length}};qh.VaultPrefixTransformer=N_});var Oc=S(wn=>{"use strict";var KM=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]})),XM=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),JM=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"&&KM(t,e,r[i]);return XM(t,e),t}})();Object.defineProperty(wn,"__esModule",{value:!0});wn.SPARQLParser=wn.ExoQLParser=wn.SPARQLParseError=void 0;var lA=JM(sA()),k_=I_(),M_=R_(),uA=aA(),j_=P_(),ZM=oA(),$_=cA(),ej=L_(),nr=class extends Error{static{o(this,"SPARQLParseError")}constructor(e,t,r,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=r}};wn.SPARQLParseError=nr;var Wh=class{static{o(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new lA.Parser({sparqlStar:!0}),this.generator=new lA.Generator({sparqlStar:!0}),this.caseWhenTransformer=new k_.CaseWhenTransformer,this.lateralTransformer=new M_.LateralTransformer,this.prefixStarTransformer=new uA.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new j_.DescribeOptionsTransformer,this.directionalLangTagTransformer=new ZM.DirectionalLangTagTransformer,this.tripleTermTransformer=new $_.TripleTermTransformer,this.vaultPrefixTransformer=new ej.VaultPrefixTransformer}setVaultPrefixes(e){this.vaultPrefixTransformer.setVaultPrefixes(e)}parse(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof j_.DescribeOptionsTransformerError)throw new nr(t.message);if(t instanceof M_.LateralTransformerError)throw new nr(t.message);if(t instanceof k_.CaseWhenTransformerError)throw new nr(t.message);if(t instanceof $_.TripleTermTransformerError)throw new nr(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new nr(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}parseWithOptions(e){return{query:this.parse(e),describeOptions:this.lastDescribeOptions}}getLastDescribeOptions(){return this.lastDescribeOptions}async parseAsync(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=await this.prefixStarTransformer.transform(i),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof j_.DescribeOptionsTransformerError)throw new nr(t.message);if(t instanceof uA.PrefixStarTransformerError)throw new nr(t.message);if(t instanceof M_.LateralTransformerError)throw new nr(t.message);if(t instanceof k_.CaseWhenTransformerError)throw new nr(t.message);if(t instanceof $_.TripleTermTransformerError)throw new nr(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new nr(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}async parseAsyncWithOptions(e){return{query:await this.parseAsync(e),describeOptions:this.lastDescribeOptions}}hasPrefixStar(e){return/PREFIX\s*\*/i.test(e)}hasLateral(e){return this.lateralTransformer.hasLateral(e)}hasDescribeOptions(e){return this.describeOptionsTransformer.hasDescribeOptions(e)}hasDirectionalLangTags(e){return this.directionalLangTagTransformer.hasDirectionalTags(e)}hasTripleTermSyntax(e){return this.tripleTermTransformer.hasTripleTermSyntax(e)}getLastDirectionMappings(){return new Map(this.lastDirectionMappings)}getDirectionForLanguage(e){return this.lastDirectionMappings.get(e.toLowerCase())}toString(e){try{return this.generator.stringify(e)}catch(t){throw t instanceof Error?new nr(`Failed to serialize SPARQL query: ${t.message}`,void 0,void 0,t):t}}getQueryType(e){if("queryType"in e&&e.type==="query")return e.queryType;throw new nr("Query does not have a valid queryType property")}isSelectQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="SELECT"}isConstructQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="CONSTRUCT"}isAskQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="ASK"}isDescribeQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="DESCRIBE"}isUpdateQuery(e){return e.type==="update"}isInsertDataOperation(e){return"updateType"in e&&e.updateType==="insert"}isDeleteDataOperation(e){return"updateType"in e&&e.updateType==="delete"}validateQuery(e){if(!e||typeof e!="object")throw new nr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new nr(`Invalid type: expected "query" or "update", got "${e.type}"`);if(e.type==="query"){let t=["SELECT","CONSTRUCT","ASK","DESCRIBE"];if(!t.includes(e.queryType))throw new nr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};wn.ExoQLParser=Wh;wn.SPARQLParser=Wh});var bo=S(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.AlgebraTranslatorError=void 0;var B_=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};Gh.AlgebraTranslatorError=B_});var zh=S(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.isVariableExpression=tj;ts.isVariableTerm=rj;ts.isNamedNode=nj;ts.isLiteral=ij;ts.isPropertyPath=sj;ts.isAggregateExpression=aj;ts.isOperationExpression=oj;ts.isFunctionCallExpression=cj;function tj(n){return typeof n=="object"&&n!==null&&"expression"in n&&"variable"in n}o(tj,"isVariableExpression");function rj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Variable"}o(rj,"isVariableTerm");function nj(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="NamedNode"}o(nj,"isNamedNode");function ij(n){return typeof n=="object"&&n!==null&&"termType"in n&&n.termType==="Literal"}o(ij,"isLiteral");function sj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="path"}o(sj,"isPropertyPath");function aj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="aggregate"}o(aj,"isAggregateExpression");function oj(n){return typeof n=="object"&&n!==null&&"type"in n&&n.type==="operation"}o(oj,"isOperationExpression");function cj(n){return typeof n=="object"&&n!==null&&"type"in n&&(n.type==="functionCall"||n.type==="functioncall")}o(cj,"isFunctionCallExpression")});var fA=S(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.TripleTranslator=void 0;var an=bo(),V_=class{static{o(this,"TripleTranslator")}constructor(){this.directionMappings=new Map}setDirectionMappings(e){this.directionMappings=e}translateBGP(e){if(!("triples"in e)||!Array.isArray(e.triples))throw new an.AlgebraTranslatorError("BGP pattern must have triples array");return{type:"bgp",triples:e.triples.map(t=>this.translateTriple(t))}}translateTriple(e){if(!e.subject||!e.predicate||!e.object)throw new an.AlgebraTranslatorError("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translatePredicate(e){return"type"in e&&e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!("pathType"in e)||!e.pathType)throw new an.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new an.AlgebraTranslatorError("Property path must have items array");let t=e.items.map(r=>this.translatePathItem(r));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new an.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new an.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new an.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new an.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new an.AlgebraTranslatorError(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if("type"in e&&e.type==="path")return this.translatePropertyPath(e);if("termType"in e&&e.termType==="NamedNode")return{type:"iri",value:e.value};let t="type"in e?e.type:"termType"in e?e.termType:"unknown";throw new an.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new an.AlgebraTranslatorError("Triple element must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};case"Literal":{let t={type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language};if(e.language){let r=this.directionMappings.get(e.language.toLowerCase());r&&(t.direction=r)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new an.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new an.AlgebraTranslatorError("Quoted triple must have subject, predicate, and object");return{type:"quoted",subject:this.translateTripleElement(e.subject),predicate:this.translateQuotedTriplePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateQuotedTriplePredicate(e){if(!e||!("termType"in e))throw new an.AlgebraTranslatorError("Quoted triple predicate must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};default:throw new an.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};Hh.TripleTranslator=V_});var dA=S(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.ExpressionTranslator=void 0;var Pc=bo(),U_=class{static{o(this,"ExpressionTranslator")}constructor(e){this.translateWhereFn=e.translateWhere,this.translateBGPFn=e.translateBGP,this.translatePatternFn=e.translatePattern}translateExpression(e){if(!e)throw new Pc.AlgebraTranslatorError("Expression cannot be null or undefined");if("type"in e&&e.type==="operation")return this.translateOperationExpression(e);let t="type"in e?e.type:void 0;if(t==="functioncall"||t==="functionCall"){let r=e;return{type:"functionCall",function:r.function,args:r.args.map(i=>this.translateExpression(i))}}if("termType"in e)return this.translateTermExpression(e);throw new Pc.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new Pc.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateTermExpression(e){if(e.termType==="Variable")return{type:"variable",name:e.value};if(e.termType==="Literal"){let t=e.value;return e.datatype&&(e.datatype.value.includes("#integer")||e.datatype.value.includes("#decimal")?t=parseFloat(e.value):e.datatype.value.includes("#boolean")&&(t=e.value==="true")),{type:"literal",value:t,datatype:e.datatype?.value}}return{type:"literal",value:String(e.value||e)}}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"],s=e.args.filter(a=>!("patterns"in a)||"termType"in a);return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:s.map(a=>this.translateExpression(a))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:e.operator==="exists"||e.operator==="notexists"?this.translateExistsExpression(e):e.operator==="in"||e.operator==="notin"?this.translateInExpression(e):{type:"function",function:e.operator,args:s.map(a=>this.translateExpression(a))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new Pc.AlgebraTranslatorError("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&"patterns"in t&&t.patterns?r=this.translateWhereFn(t.patterns):t.type==="bgp"?r=this.translateBGPFn(t):r=this.translatePatternFn(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new Pc.AlgebraTranslatorError("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],r=e.args[1];if(!Array.isArray(r))throw new Pc.AlgebraTranslatorError("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:r.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}};Qh.ExpressionTranslator=U_});var mA=S(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.PatternTranslator=void 0;var hA=R_(),Pr=bo(),pA=zh(),q_=class{static{o(this,"PatternTranslator")}constructor(e){this.directionMappings=new Map,this.translateExpressionFn=e.translateExpression,this.translateSelectFn=e.translateSelect,this.translateBGPFn=e.translateBGP}setDirectionMappings(e){this.directionMappings=e}translateWhere(e){if(e.length===0)throw new Pr.AlgebraTranslatorError("Empty WHERE clause");let t=e.filter(a=>a.type==="filter"),r=e.filter(a=>a.type==="bind"),i=e.filter(a=>a.type!=="filter"&&a.type!=="bind"),s;if(i.length===0)s={type:"bgp",triples:[]};else if(i.length===1)if(i[0].type==="optional"){let a=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:a?this.translateExpressionFn(a):void 0}}else s=this.translatePattern(i[0]);else{if(i[0].type==="optional"){let a=i[0].expression;s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:a?this.translateExpressionFn(a):void 0}}else s=this.translatePattern(i[0]);for(let a=1;a<i.length;a++){let c=i[a];if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelectFn(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional"){let l=c.expression;s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:l?this.translateExpressionFn(l):void 0}}else{let l=this.translatePattern(c);s={type:"join",left:s,right:l}}}}for(let a of r)s=this.translateBind(a,s);for(let a of t)s={type:"filter",expression:this.translateExpressionFn(a.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new Pr.AlgebraTranslatorError("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGPFn(e);case"filter":return this.translateFilter(e);case"optional":return this.translateOptional(e);case"union":return this.translateUnion(e);case"minus":return this.translateMinus(e);case"values":return this.translateValues(e);case"group":return this.translateWhere(e.patterns);case"query":return this.translateSubquery(e);case"service":return this.translateService(e);case"graph":return this.translateGraph(e);default:throw new Pr.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new Pr.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpressionFn(e.expression),input:t}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new Pr.AlgebraTranslatorError("OPTIONAL pattern must have patterns");let t=e.expression;return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:t?this.translateExpressionFn(t):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new Pr.AlgebraTranslatorError("UNION pattern must have at least 2 patterns");let t=o(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(i):"patterns"in i&&i.patterns&&Array.isArray(i.patterns)?this.translateWhere(i.patterns):this.translateWhere([i]),"translateBranch"),r={type:"union",left:t(e.patterns[0]),right:t(e.patterns[1])};for(let i=2;i<e.patterns.length;i++)r={type:"union",left:r,right:t(e.patterns[i])};return r}translateMinus(e){if(!e.patterns||e.patterns.length===0)throw new Pr.AlgebraTranslatorError("MINUS pattern must have patterns");return{type:"minus",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns)}}translateValues(e){if(!e.values||!Array.isArray(e.values))throw new Pr.AlgebraTranslatorError("VALUES pattern must have values array");let t=new Set;for(let i of e.values)for(let s of Object.keys(i)){let a=s.startsWith("?")?s.slice(1):s;t.add(a)}let r=e.values.map(i=>this.translateValuesBinding(i));return{type:"values",variables:Array.from(t),bindings:r}}translateValuesBinding(e){let t={};for(let[r,i]of Object.entries(e)){let s=r.startsWith("?")?r.slice(1):r,a=i;if(a)if(a.termType==="NamedNode")t[s]={type:"iri",value:a.value};else if(a.termType==="Literal"){let c=a,l={type:"literal",value:c.value,datatype:c.datatype?.value,language:c.language||void 0};if(c.language){let u=this.directionMappings.get(c.language.toLowerCase());u&&(l.direction=u)}t[s]=l}else throw new Pr.AlgebraTranslatorError(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new Pr.AlgebraTranslatorError("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpressionFn(e.expression),input:t}}translateSubquery(e){if(e.queryType!=="SELECT")throw new Pr.AlgebraTranslatorError(`Only SELECT subqueries are supported, got: ${String(e.queryType)}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelectFn(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new Pr.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new Pr.AlgebraTranslatorError("SERVICE pattern must have patterns array");return{type:"service",endpoint:e.name.value,pattern:this.translateWhere(e.patterns),silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new Pr.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new Pr.AlgebraTranslatorError("GRAPH pattern must have patterns array");let t;if(e.name.termType==="NamedNode")t={type:"iri",value:e.name.value};else if(e.name.termType==="Variable")t={type:"variable",value:e.name.value};else throw new Pr.AlgebraTranslatorError(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);return{type:"graph",name:t,pattern:this.translateWhere(e.patterns)}}isLateralPattern(e){if(e.type==="query"&&this.isLateralSubquery(e))return!0;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query"&&this.isLateralSubquery(t))return!0}return!1}extractLateralSubquery(e){if(e.type==="query")return e;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query")return t}throw new Pr.AlgebraTranslatorError("Invalid lateral pattern structure")}isLateralSubquery(e){return!("queryType"in e)||e.queryType!=="SELECT"||!("variables"in e)||!e.variables?!1:e.variables.some(i=>(0,pA.isVariableTerm)(i)&&i.value===hA.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){if(!("variables"in e)||!e.variables)return e;let t=e,r=t.variables;return{...t,variables:r.filter(i=>!((0,pA.isVariableTerm)(i)&&i.value===hA.LateralTransformer.LATERAL_MARKER))}}};Yh.PatternTranslator=q_});var yA=S(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.AggregateTranslator=void 0;var gA=bo(),lj=zh(),W_=class{static{o(this,"AggregateTranslator")}constructor(e){this.aggregateCounter=0,this.translateExpressionFn=e.translateExpression}resetCounter(){this.aggregateCounter=0}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)(0,lj.isVariableExpression)(i)&&("type"in i.expression&&i.expression.type==="aggregate"?(r.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,r,t));return r}extractGroupVariables(e){return e?e.filter(t=>t.expression&&"termType"in t.expression&&t.expression.termType==="Variable").map(t=>t.expression.value):[]}extractHavingExpressions(e,t,r){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,r);return e.map(i=>this.transformExpressionWithAggregateVars(i,r))}transformExpressionWithAggregateVars(e,t){let r=t.get(e);if(r!==void 0)return{type:"variable",name:r};if("type"in e&&e.type==="operation"&&"args"in e){let i=e,s=i.args.filter(u=>!Array.isArray(u)&&!("patterns"in u)).map(u=>this.transformExpressionWithAggregateVars(u,t)),a=["=","!=","<",">","<=",">="],c=["&&","||","!"],l=["+","-","*","/"];return a.includes(i.operator)?{type:"comparison",operator:i.operator,left:s[0],right:s[1]}:c.includes(i.operator)?{type:"logical",operator:i.operator,operands:s}:l.includes(i.operator)?{type:"arithmetic",operator:i.operator,left:s[0],right:s[1]}:{type:"function",function:i.operator,args:s}}return this.translateExpressionFn(e)}translateOrderComparator(e){return{expression:this.translateExpressionFn(e.expression),descending:e.descending||!1}}translateAggregateExpression(e){let t=e.aggregation,r=o(()=>{if(e.expression&&!("termType"in e.expression&&e.expression.termType==="Wildcard"))return this.translateExpressionFn(e.expression)},"translateInnerExpr");if(typeof t=="string"){let s=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(s)?{type:"aggregate",aggregation:s,expression:r(),distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:r(),distinct:e.distinct||!1,separator:e.separator}}let i=t;if(i&&typeof i=="object"){let s,a=i;if(a.termType==="NamedNode"&&typeof a.value=="string")s=a.value;else if("value"in a)s=String(a.value);else throw new gA.AlgebraTranslatorError(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(i)}`);return{type:"aggregate",aggregation:{type:"custom",iri:s},expression:r(),distinct:e.distinct||!1,separator:e.separator}}throw new gA.AlgebraTranslatorError(`Unknown aggregate format: ${JSON.stringify(t)}`)}collectNestedAggregates(e,t,r){if(e){if("type"in e&&e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if("type"in e&&e.type==="operation"&&"args"in e){let i=e;for(let s of i.args)!Array.isArray(s)&&"type"in s&&!("patterns"in s)?this.collectNestedAggregates(s,t,r):"termType"in s&&this.collectNestedAggregates(s,t,r)}}}};Kh.AggregateTranslator=W_});var Fc=S(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.AlgebraTranslator=va.ExoQLAlgebraTranslator=va.AlgebraTranslatorError=void 0;var Xh=bo(),Jh=zh(),uj=fA(),fj=dA(),dj=mA(),hj=yA(),pj=bo();Object.defineProperty(va,"AlgebraTranslatorError",{enumerable:!0,get:o(function(){return pj.AlgebraTranslatorError},"get")});var Zh=class{static{o(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new uj.TripleTranslator,this.expressionTranslator=new fj.ExpressionTranslator({translateWhere:o(e=>this.patternTranslator.translateWhere(e),"translateWhere"),translateBGP:o(e=>this.tripleTranslator.translateBGP(e),"translateBGP"),translatePattern:o(e=>this.patternTranslator.translatePattern(e),"translatePattern")}),this.patternTranslator=new dj.PatternTranslator({translateExpression:o(e=>this.expressionTranslator.translateExpression(e),"translateExpression"),translateSelect:o(e=>this.translateSelect(e),"translateSelect"),translateBGP:o(e=>this.tripleTranslator.translateBGP(e),"translateBGP")}),this.aggregateTranslator=new hj.AggregateTranslator({translateExpression:o(e=>this.expressionTranslator.translateExpression(e),"translateExpression")})}setDirectionMappings(e){this.tripleTranslator.setDirectionMappings(e),this.patternTranslator.setDirectionMappings(e)}translate(e){if(e.type!=="query")throw new Xh.AlgebraTranslatorError("Only query operations are supported (not updates)");if(e.queryType==="SELECT")return this.translateSelect(e);if(e.queryType==="CONSTRUCT")return this.translateConstruct(e);if(e.queryType==="ASK")return this.translateAsk(e);if(e.queryType==="DESCRIBE")return this.translateDescribe(e);throw new Xh.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new Xh.AlgebraTranslatorError("SELECT query must have WHERE clause");let t=this.patternTranslator.translateWhere(e.where);this.aggregateTranslator.resetCounter();let r=new Map,i=Array.isArray(e.variables)?e.variables.filter(l=>!("termType"in l&&l.termType==="Wildcard")):[],s=this.aggregateTranslator.extractAggregatesWithMapping(i,r),a=this.aggregateTranslator.extractGroupVariables(e.group),c=this.aggregateTranslator.extractHavingExpressions(e.having,s,r);if((s.length>0||a.length>0||c.length>0)&&(t={type:"group",variables:a,aggregates:s,having:c.length>0?c:void 0,input:t}),i.length>0){for(let u of i)if((0,Jh.isVariableExpression)(u)){if("type"in u.expression&&u.expression.type==="aggregate")continue;let f=this.aggregateTranslator.transformExpressionWithAggregateVars(u.expression,r);t={type:"extend",variable:u.variable.value,expression:f,input:t}}let l=i.filter(u=>(0,Jh.isVariableTerm)(u)||(0,Jh.isVariableExpression)(u)).map(u=>(0,Jh.isVariableTerm)(u)?u.value:u.variable.value);l.length>0&&(t={type:"project",variables:l,input:t})}return e.distinct&&(t={type:"distinct",input:t}),e.reduced&&(t={type:"reduced",input:t}),e.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(l=>this.aggregateTranslator.translateOrderComparator(l)),input:t}),(e.limit!==void 0||e.offset!==void 0)&&(t={type:"slice",limit:e.limit,offset:e.offset,input:t}),t}translateConstruct(e){let t=this.tripleTranslator.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new Xh.AlgebraTranslatorError("CONSTRUCT query must have WHERE clause");let r=this.patternTranslator.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(r={type:"slice",limit:i.limit,offset:i.offset,input:r}),{type:"construct",template:t,where:r}}translateAsk(e){return{type:"ask",where:e.where&&e.where.length>0?this.patternTranslator.translateWhere(e.where):{type:"bgp",triples:[]}}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables)){let s=e.variables;for(let a of s)a.termType==="Wildcard"||a.value==="*"||(a.termType==="Variable"?t.push({type:"variable",value:a.value}):a.termType==="NamedNode"&&t.push({type:"iri",value:a.value}))}let r;e.where&&e.where.length>0&&(r=this.patternTranslator.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};va.ExoQLAlgebraTranslator=Zh;va.AlgebraTranslator=Zh});var rs=S(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});ep.SolutionMapping=void 0;var _A=Ve(),SA=Ce(),bA=Gt(),G_=class n{static{o(this,"SolutionMapping")}constructor(e){this.bindings=e?new Map(e):new Map}get(e){return this.bindings.get(e)}set(e,t){this.bindings.set(e,t)}has(e){return this.bindings.has(e)}variables(){return Array.from(this.bindings.keys())}getBindings(){return new Map(this.bindings)}isCompatibleWith(e){for(let[t,r]of this.bindings.entries()){let i=e.get(t);if(i!==void 0&&!this.areEqual(r,i))return!1}return!0}merge(e){if(!this.isCompatibleWith(e))return null;let t=new n(this.bindings);for(let[r,i]of e.getBindings().entries())t.set(r,i);return t}clone(){return new n(this.bindings)}areEqual(e,t){return e instanceof _A.Literal&&t instanceof _A.Literal?e.equals(t):e instanceof SA.IRI&&t instanceof SA.IRI?e.value===t.value:e instanceof bA.BlankNode&&t instanceof bA.BlankNode?e.id===t.id:!1}toJSON(){let e={};for(let[t,r]of this.bindings.entries())e[t]=r.toString();return e}size(){return this.bindings.size}};ep.SolutionMapping=G_});var wA=S(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.PropertyPathExecutor=Dc.PropertyPathExecutorError=void 0;var mj=rs(),tp=Ce(),vA=Gt(),gj=Ve(),ju=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Dc.PropertyPathExecutorError=ju;var z_=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){if(this.isLiteralElement(e)||this.isLiteralElement(r)){let a=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:r,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l;console.warn(`[PropertyPathExecutor] literal-safety guard fired: literal in ${a} position \u2014 yielding 0 solutions. value="${u}"`);return}let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new mj.SolutionMapping;this.isVariable(e)&&u.set(e.value,a),this.isVariable(r)&&u.set(r.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new ju("Predicate is not a property path");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.object,t);for await(let s of this.execute(r,e.predicate,i)){let a=t.merge(s);a!==null&&(yield a)}}async evaluatePath(e,t,r){switch(t.pathType){case"/":return this.evaluateSequencePath(e,t.items,r);case"|":return this.evaluateAlternativePath(e,t.items,r);case"^":return this.evaluateInversePath(e,t.items[0],r);case"+":return this.evaluateOneOrMorePath(e,t.items[0],r);case"*":return this.evaluateZeroOrMorePath(e,t.items[0],r);case"?":return this.evaluateZeroOrOnePath(e,t.items[0],r)}}async evaluateSequencePath(e,t,r){let i=new Set([e]);for(let s=0;s<t.length;s++){let a=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,a,c?r:null);for(let d of f)l.add(d)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,r){let i=new Set;for(let s of t){let a=await this.evaluatePathItem(e,s,r);for(let c of a)i.add(c)}return i}async evaluateInversePath(e,t,r){if(t.type==="iri"){let i=new tp.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let c=a.shift();if(!c)break;let{node:l,depth:u}=c;if(u>=this.MAX_DEPTH)continue;let f=await this.evaluatePathItem(l,t,null);for(let d of f){let h=this.nodeToKey(d);(r===null||this.nodeInSet(d,r))&&s.add(d),i.has(h)||(i.add(h),a.push({node:d,depth:u+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new tp.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"|":return{type:"path",pathType:"|",items:e.items.map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"+":case"*":case"?":{let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new tp.IRI(e.value));break;case"blank":t.add(new vA.BlankNode(e.value));break;default:throw new ju(`Unsupported element type in subject/object position: ${e.type}`)}return t}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r){if(r instanceof tp.IRI)return{type:"iri",value:r.value};if(r instanceof vA.BlankNode)return{type:"blank",value:r.id};if(r instanceof gj.Literal)return{type:"literal",value:r.value,datatype:r.datatype?.value,language:r.language,direction:r.direction}}}return e}isVariable(e){return e.type==="variable"}isLiteralElement(e){return e.type==="literal"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};Dc.PropertyPathExecutor=z_});var Y_=S(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.BGPExecutor=Nc.BGPExecutorError=void 0;var rp=rs(),wa=Ce(),H_=Ve(),np=Gt(),ip=bu(),yj=wA(),Ur=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Nc.BGPExecutorError=Ur;var Q_=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new yj.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new rp.SolutionMapping;return}let t=this.matchTriplePattern(e.triples[0]);for(let r=1;r<e.triples.length;r++)t=this.joinWithPattern(t,e.triples[r]);for await(let r of t)yield r}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*executeInGraph(e,t){if(e.triples.length===0){yield new rp.SolutionMapping;return}let r=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)r=this.joinWithPatternInGraph(r,e.triples[i],t);for await(let i of r)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new Ur("Property paths within named graphs are not yet supported");let r=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(r)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:r);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new Ur("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,a,t);for(let l of c){let u=new rp.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){if(this.isLiteral(e.subject)||this.isLiteral(e.object)){this.warnLiteralGuard("matchTriplePattern.propertyPath",this.isLiteral(e.subject)?"subject":"object",this.isLiteral(e.subject)?e.subject:e.object);return}yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(t)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:t);return}let r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new rp.SolutionMapping;if(this.isVariable(e.subject))l.set(e.subject.value,c.subject);else if(this.isQuotedTriple(e.subject)){let u=this.matchQuotedTriplePattern(e.subject,c.subject);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}if(this.isVariable(t)&&l.set(t.value,c.predicate),this.isVariable(e.object))l.set(e.object.value,c.object);else if(this.isQuotedTriple(e.object)){let u=this.matchQuotedTriplePattern(e.object,c.object);if(u===null)continue;for(let[f,d]of u.entries())l.set(f,d)}yield l}}hasVariablesInQuotedTriple(e){return!!(this.isVariable(e.subject)||e.predicate.type==="variable"||this.isVariable(e.object)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object))}matchQuotedTriplePattern(e,t){if(!(t instanceof ip.QuotedTriple))return null;let r=new Map;if(this.isVariable(e.subject))r.set(e.subject.value,t.subject);else if(this.isQuotedTriple(e.subject)){let i=this.matchQuotedTriplePattern(e.subject,t.subject);if(i===null)return null;for(let[s,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.subject,t.subject))return null;if(e.predicate.type==="variable")r.set(e.predicate.value,t.predicate);else if(e.predicate.value!==t.predicate.value)return null;if(this.isVariable(e.object))r.set(e.object.value,t.object);else if(this.isQuotedTriple(e.object)){let i=this.matchQuotedTriplePattern(e.object,t.object);if(i===null)return null;for(let[s,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.object,t.object))return null;return r}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof wa.IRI&&e.value===t.value;case"literal":return!(!(t instanceof H_.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof np.BlankNode&&e.value===t.id;case"quoted":return t instanceof ip.QuotedTriple?this.toRDFQuotedTriple(e).equals(t):!1;default:return!1}}isPropertyPath(e){return e.type==="path"}async*joinWithPattern(e,t){let r=[];for await(let i of e)r.push(i);for(let i of r){let s=this.instantiatePattern(t,i);for await(let a of this.matchTriplePattern(s)){let c=i.merge(a);c!==null&&(yield c)}}}instantiatePattern(e,t){let r=this.isPropertyPath(e.predicate)?e.predicate:this.instantiateElement(e.predicate,t);return{subject:this.instantiateElement(e.subject,t),predicate:r,object:this.instantiateElement(e.object,t)}}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r)return this.toAlgebraElement(r)}return this.isQuotedTriple(e)?this.instantiateQuotedTriple(e,t):e}instantiateQuotedTriple(e,t){let r=this.instantiateElement(e.subject,t),i=e.predicate.type==="variable"?this.instantiatePredicateVariable(e.predicate,t):e.predicate,s=this.instantiateElement(e.object,t);return{type:"quoted",subject:r,predicate:i,object:s}}instantiatePredicateVariable(e,t){let r=t.get(e.value);return r&&r instanceof wa.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,r){let i="value"in r?String(r.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i;console.warn(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new wa.IRI(e.value);case"blank":return new np.BlankNode(e.value);case"literal":throw new Ur("Literals cannot appear in subject position");case"variable":throw new Ur(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Ur(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new wa.IRI(e.predicate.value):(()=>{throw new Ur("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new ip.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new wa.IRI(e.value);case"literal":throw new Ur("Literals cannot appear in predicate position");case"blank":throw new Ur("Blank nodes cannot appear in predicate position");case"variable":throw new Ur(`Cannot convert variable to RDF term: ${e.value}`);default:throw new Ur(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new wa.IRI(e.value);case"literal":return new H_.Literal(e.value,e.datatype?new wa.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new np.BlankNode(e.value);case"variable":throw new Ur(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new Ur(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof wa.IRI)return{type:"iri",value:e.value};if(e instanceof H_.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof np.BlankNode)return{type:"blank",value:e.id};if(e instanceof ip.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new Ur(`Unknown RDF term type: ${String(e)}`)}toAlgebraQuotedTriple(e){return{type:"quoted",subject:this.toAlgebraElement(e.subject),predicate:{type:"iri",value:e.predicate.value},object:this.toAlgebraElement(e.object)}}};Nc.BGPExecutor=Q_});var EA=S(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.StringFunctions=void 0;var Lc=Ce(),Ea=Ve(),K_=Gt(),$u=class n{static{o(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof Lc.IRI||e instanceof Ea.Literal?e.value:e instanceof K_.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof Ea.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof Ea.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=n.parseDirectionalLangTag(e),[s,a]=n.parseDirectionalLangTag(t),c=r.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":a&&i!==a?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let r=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[r,i]}static regex(e,t,r){try{let i=r?r.includes("u")?r:r+"u":"u";return new RegExp(t,i).test(e)}catch(i){throw new Error(`REGEX: invalid pattern '${t}': ${i.message}`)}}static contains(e,t){return e.includes(t)}static strStarts(e,t){return e.startsWith(t)}static strEnds(e,t){return e.endsWith(t)}static strlen(e){return e.length}static ucase(e){return e.toUpperCase()}static lcase(e){return e.toLowerCase()}static substr(e,t,r){let i=t-1;if(i<0){if(r!==void 0){let s=r+i;return s<=0?"":e.substring(0,s)}return e}return r!==void 0?e.substring(i,i+r):e.substring(i)}static strBefore(e,t){if(t==="")return"";let r=e.indexOf(t);return r===-1?"":e.substring(0,r)}static strAfter(e,t){if(t==="")return e;let r=e.indexOf(t);return r===-1?"":e.substring(r+t.length)}static concat(...e){return e.join("")}static replace(e,t,r,i){try{let s=i||"g",a=s.includes("u")?s:s+"u",c=new RegExp(t,a);return e.replace(c,r)}catch(s){throw new Error(`REPLACE: invalid pattern '${t}': ${s.message}`)}}static encodeForUri(e){return encodeURIComponent(e)}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let r;if(e instanceof Ea.Literal)r=e.value;else if(e instanceof Lc.IRI)r=e.value;else if(e instanceof K_.BlankNode)r=e.id;else if(typeof e=="string")r=e;else throw new Error("NORMALIZE: first argument must be a string or literal");let i="NFC";if(t!==void 0)if(t instanceof Ea.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof Lc.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!n.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=r.normalize(i);return new Ea.Literal(s,new Lc.IRI("http://www.w3.org/2001/XMLSchema#string"))}static fold(e){if(e===void 0)throw new Error("FOLD: string argument is undefined");let t;if(e instanceof Ea.Literal)t=e.value;else if(e instanceof Lc.IRI)t=e.value;else if(e instanceof K_.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let r=n.unicodeCaseFold(t);return new Ea.Literal(r,new Lc.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=n.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}};sp.StringFunctions=$u;$u.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];$u.CASE_FOLDING_MAP=new Map([["\xDF","ss"],["\u1E9E","ss"],["\u03A3","\u03C3"],["\u03C2","\u03C3"],["\u0130","i\u0307"],["I","i"],["\u0587","\u0565\u0582"],["\uFB00","ff"],["\uFB01","fi"],["\uFB02","fl"],["\uFB03","ffi"],["\uFB04","ffl"],["\uFB05","st"],["\uFB06","st"],["\u0390","\u03B9\u0308\u0301"],["\u03B0","\u03C5\u0308\u0301"],["\u017F","s"],["\u1E9B","\u1E61"],["\u212A","k"],["\u212B","\xE5"]])});var TA=S(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.MathFunctions=void 0;var X_=class{static{o(this,"MathFunctions")}static msToMinutes(e){return Math.round(e/(1e3*60))}static msToHours(e){return Math.round(e/(1e3*60*60)*100)/100}static msToSeconds(e){return Math.round(e/1e3)}static abs(e){return Math.abs(e)}static round(e){return Math.round(e)}static ceil(e){return Math.ceil(e)}static floor(e){return Math.floor(e)}static rand(){return Math.random()}};ap.MathFunctions=X_});var cp=S(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.DateTimeParsing=void 0;var _j=Ce(),Sj=Ve(),J_=class n{static{o(this,"DateTimeParsing")}static parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static parseDayTimeDuration(e){if(!e)throw new Error("parseDayTimeDuration: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDayTimeDuration: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=r.indexOf("T"),a="",c="";if(s===-1?a=r:(a=r.substring(0,s),c=r.substring(s+1)),a){let l=a.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(a!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${a}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let h=parseFloat(u[1]);i+=h*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let h=parseFloat(f[1]);i+=h*60*1e3,l=l.substring(f[0].length)}let d=l.match(/^(\d+(?:\.\d+)?)S$/);if(d){let h=parseFloat(d[1]);i+=h*1e3,l=l.substring(d[0].length)}if(l!=="")throw new Error(`parseDayTimeDuration: invalid time component: '${l}' in '${e}'`)}return t?-i:i}static formatDayTimeDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/(1440*60*1e3));r=r%(1440*60*1e3);let s=Math.floor(r/(3600*1e3));r=r%(3600*1e3);let a=Math.floor(r/(60*1e3));r=r%(60*1e3);let c=r/1e3,l=t?"-P":"P";return i>0&&(l+=`${i}D`),(s>0||a>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),a>0&&(l+=`${a}M`),(c>0||s===0&&a===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return n.parseDayTimeDuration(e),new Sj.Literal(e,new _j.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(r[1],10),s=parseInt(r[2],10)-1,a=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,a));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,d=parseInt(u[2],10),h=parseInt(u[3],10),p=f*(d*60+h)*60*1e3;l=new Date(l.getTime()-p)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),a=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||a<0||a>59||i===24&&(s!==0||a!==0))return null;let u=0;if(c){let d=c.padEnd(3,"0").slice(0,3);u=parseInt(d,10)}let f=i*60*60*1e3+s*60*1e3+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let h=d[1]==="+"?1:-1,p=parseInt(d[2],10),_=parseInt(d[3],10),b=h*(p*60+_)*60*1e3;f-=b}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+a;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,a=t?"-P":"P";return i>0&&(a+=`${i}Y`),(s>0||i===0)&&(a+=`${s}M`),a}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:a,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=0,a=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.substring(l+1)),u){let d=u.match(/^(\d+(?:\.\d+)?)D$/);if(d)i=parseFloat(d[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let d=f,h=d.match(/^(\d+(?:\.\d+)?)H/);h&&(s=parseFloat(h[1]),d=d.substring(h[0].length));let p=d.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),d=d.substring(p[0].length));let _=d.match(/^(\d+(?:\.\d+)?)S$/);if(_&&(c=parseFloat(_[1]),d=d.substring(_[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}};op.DateTimeParsing=J_});var AA=S(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.DateTimeArithmetic=void 0;var on=Ce(),Te=Ve(),Xe=cp(),Z_=class{static{o(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r),a=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${r}'`);if(isNaN(a.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-a.getTime(),l=Xe.DateTimeParsing.formatDayTimeDuration(c);return new Te.Literal(l,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new Te.Literal(l.toISOString(),new on.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new Te.Literal(l.toISOString(),new on.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Te.Literal(h,new on.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),h=`${u}-${f}-${d}`;return new Te.Literal(h,new on.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new Te.Literal(s.toISOString(),new on.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new Te.Literal(s.toISOString(),new on.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Te.Literal(d,new on.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Te.Literal(d,new on.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s+a);return new Te.Literal(c,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseDayTimeDuration(r),a=Xe.DateTimeParsing.parseDayTimeDuration(i),c=Xe.DateTimeParsing.formatDayTimeDuration(s-a);return new Te.Literal(c,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof Te.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i*t);return new Te.Literal(s,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationDivide(e,t){if(t===0)throw new Error("durationDivide: division by zero");let r=e instanceof Te.Literal?e.value:e,i=Xe.DateTimeParsing.parseDayTimeDuration(r),s=Xe.DateTimeParsing.formatDayTimeDuration(i/t);return new Te.Literal(s,new on.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s+a);return new Te.Literal(c,new on.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof Te.Literal?e.value:e,i=t instanceof Te.Literal?t.value:t,s=Xe.DateTimeParsing.parseYearMonthDuration(r),a=Xe.DateTimeParsing.parseYearMonthDuration(i),c=Xe.DateTimeParsing.formatYearMonthDuration(s-a);return new Te.Literal(c,new on.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Te.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Te.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Te.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Te.Literal?e.value:e;return Xe.DateTimeParsing.parseDayTimeDuration(t)/1e3}};lp.DateTimeArithmetic=Z_});var xA=S(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});up.DateTimeAccessors=void 0;var Bu=Ce(),Lt=Ve(),Tt=cp(),e1=class{static{o(this,"DateTimeAccessors")}static year(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return t.getFullYear()}static month(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return t.getMonth()+1}static day(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return t.getDate()}static hours(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return t.getHours()}static minutes(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return t.getMinutes()}static seconds(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return t.getSeconds()+t.getMilliseconds()/1e3}static durationDays(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static durationYears(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof Lt.Literal?e.value:e,r=Tt.DateTimeParsing.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let r;if(e.endsWith("Z"))r="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),a=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);a===0?r=`${c}PT${l}H`:r=`${c}PT${l}H${a}M`}else{let s=-t.getTimezoneOffset(),a=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?r=`${l}PT${a}H`:r=`${l}PT${a}H${c}M`}}return new Lt.Literal(r,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static tz(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TZ: invalid date string '${e}'`);if(e.endsWith("Z"))return"Z";let r=e.match(/([+-]\d{2}:\d{2})$/);if(r)return r[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static adjust(e,t){let r=e instanceof Lt.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let we=i.getUTCFullYear(),z=String(i.getUTCMonth()+1).padStart(2,"0"),G=String(i.getUTCDate()).padStart(2,"0"),F=String(i.getUTCHours()).padStart(2,"0"),j=String(i.getUTCMinutes()).padStart(2,"0"),te=String(i.getUTCSeconds()).padStart(2,"0"),Ye=i.getUTCMilliseconds(),st=`${we}-${z}-${G}T${F}:${j}:${te}`;return Ye>0&&(st+=`.${String(Ye).padStart(3,"0")}`),new Lt.Literal(st,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof Lt.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(a)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+a),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),h=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),_=String(u.getUTCMinutes()).padStart(2,"0"),b=String(u.getUTCSeconds()).padStart(2,"0"),E=u.getUTCMilliseconds(),v=a>=0?"+":"-",A=Math.floor(Math.abs(a)/(3600*1e3)),R=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),B=`${v}${String(A).padStart(2,"0")}:${String(R).padStart(2,"0")}`,W=`${f}-${d}-${h}T${p}:${_}:${b}`;return E>0&&(W+=`.${String(E).padStart(3,"0")}`),W+=B,new Lt.Literal(W,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static now(){return new Date().toISOString()}static dateBefore(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t);return r<i}static dateAfter(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t);return r>i}static dateInRange(e,t,r){let i=Tt.DateTimeParsing.parseDate(e),s=Tt.DateTimeParsing.parseDate(t),a=Tt.DateTimeParsing.parseDate(r);return i>=s&&i<=a}static compareDurations(e,t,r){let i=e instanceof Lt.Literal?e.value:e,s=t instanceof Lt.Literal?t.value:t,a=Tt.DateTimeParsing.parseDayTimeDuration(i),c=Tt.DateTimeParsing.parseDayTimeDuration(s);switch(r){case"=":return a===c;case"!=":return a!==c;case"<":return a<c;case">":return a>c;case"<=":return a<=c;case">=":return a>=c;default:throw new Error(`compareDurations: unknown operator: ${r}`)}}static dateDiffMinutes(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=Tt.DateTimeParsing.parseDate(e),i=Tt.DateTimeParsing.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static timeDiff(e,t){let r=e instanceof Lt.Literal?e.value:e,i=t instanceof Lt.Literal?t.value:t,s=Tt.DateTimeParsing.parseXSDTime(r),a=Tt.DateTimeParsing.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${r}'`);if(a===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-a,l=Tt.DateTimeParsing.formatDayTimeDuration(c);return new Lt.Literal(l,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof Lt.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let r=e instanceof Lt.Literal?e.value:e,i=t instanceof Lt.Literal?t.value:t,s=Tt.DateTimeParsing.parseXSDDate(r),a=Tt.DateTimeParsing.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${r}'`);if(a===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-a.getTime(),l=Math.round(c/(1440*60*1e3)),u=Tt.DateTimeParsing.formatDateDuration(l);return new Lt.Literal(u,new Bu.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};up.DateTimeAccessors=e1});var r1=S(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});fp.DateTimeFunctions=void 0;var kc=cp(),ir=AA(),gt=xA(),t1=class{static{o(this,"DateTimeFunctions")}static parseDate(e){return kc.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return kc.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return kc.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return kc.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return kc.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return kc.DateTimeParsing.formatYearMonthDuration(e)}static year(e){return gt.DateTimeAccessors.year(e)}static month(e){return gt.DateTimeAccessors.month(e)}static day(e){return gt.DateTimeAccessors.day(e)}static hours(e){return gt.DateTimeAccessors.hours(e)}static minutes(e){return gt.DateTimeAccessors.minutes(e)}static seconds(e){return gt.DateTimeAccessors.seconds(e)}static durationDays(e){return gt.DateTimeAccessors.durationDays(e)}static durationHours(e){return gt.DateTimeAccessors.durationHours(e)}static durationMinutes(e){return gt.DateTimeAccessors.durationMinutes(e)}static durationSeconds(e){return gt.DateTimeAccessors.durationSeconds(e)}static durationYears(e){return gt.DateTimeAccessors.durationYears(e)}static durationMonths(e){return gt.DateTimeAccessors.durationMonths(e)}static timezone(e){return gt.DateTimeAccessors.timezone(e)}static tz(e){return gt.DateTimeAccessors.tz(e)}static adjust(e,t){return gt.DateTimeAccessors.adjust(e,t)}static now(){return gt.DateTimeAccessors.now()}static dateBefore(e,t){return gt.DateTimeAccessors.dateBefore(e,t)}static dateAfter(e,t){return gt.DateTimeAccessors.dateAfter(e,t)}static dateInRange(e,t,r){return gt.DateTimeAccessors.dateInRange(e,t,r)}static compareDurations(e,t,r){return gt.DateTimeAccessors.compareDurations(e,t,r)}static dateDiffMinutes(e,t){return gt.DateTimeAccessors.dateDiffMinutes(e,t)}static dateDiffHours(e,t){return gt.DateTimeAccessors.dateDiffHours(e,t)}static timeDiff(e,t){return gt.DateTimeAccessors.timeDiff(e,t)}static dateDiff(e,t){return gt.DateTimeAccessors.dateDiff(e,t)}static isDayTimeDuration(e){return gt.DateTimeAccessors.isDayTimeDuration(e)}static isDate(e){return gt.DateTimeAccessors.isDate(e)}static isYearMonthDuration(e){return gt.DateTimeAccessors.isYearMonthDuration(e)}static isTime(e){return gt.DateTimeAccessors.isTime(e)}static dateTimeDiff(e,t){return ir.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return ir.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return ir.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return ir.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return ir.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return ir.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return ir.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return ir.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return ir.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return ir.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return ir.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return ir.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return ir.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return ir.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return ir.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return ir.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return ir.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return ir.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return ir.DateTimeArithmetic.durationToSeconds(e)}};fp.DateTimeFunctions=t1});var CA=S(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});hp.LogicalFunctions=void 0;var bj=Ce(),Mc=Ve(),vj=Gt(),dp=r1(),n1=class n{static{o(this,"LogicalFunctions")}static compare(e,t,r){if(n.isDayTimeDurationValue(e)&&n.isDayTimeDurationValue(t))return dp.DateTimeFunctions.compareDurations(e instanceof Mc.Literal?e:String(e),t instanceof Mc.Literal?t:String(t),r);if(n.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return dp.DateTimeFunctions.compareDurations(e instanceof Mc.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&n.isDayTimeDurationValue(t))return dp.DateTimeFunctions.compareDurations(e,t instanceof Mc.Literal?t:String(t),r);let i=n.toComparableValue(e),s=n.toComparableValue(t);switch(r){case"=":return i===s;case"!=":return i!==s;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:throw new Error(`Unknown comparison operator: ${r}`)}}static isDayTimeDurationValue(e){return e instanceof Mc.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static toComparableValue(e){if(typeof e=="string"||typeof e=="number")return e;if(e instanceof Mc.Literal){let t=e.datatype?.value;if(t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double")){let r=parseFloat(e.value);if(!isNaN(r))return r}if(t==="http://www.w3.org/2001/XMLSchema#dayTimeDuration")try{return dp.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof bj.IRI?e.value:e instanceof vj.BlankNode?e.id:String(e)}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,r){return e?t:r}};hp.LogicalFunctions=n1});var IA=S(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});pp.RDFTermFunctions=void 0;var Fr=Ce(),bt=Ve(),oi=Gt(),jc=bu(),i1=Sn(),s1=class n{static{o(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof bt.Literal)return e.datatype?e.datatype:e.language?new Fr.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Fr.IRI("http://www.w3.org/2001/XMLSchema#string");throw new Error("DATATYPE: argument must be a literal")}static bound(e){return e!==void 0}static isIRI(e){return e===void 0?!1:e instanceof Fr.IRI}static isBlank(e){return e===void 0?!1:e instanceof oi.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof bt.Literal}static isTriple(e){return e===void 0?!1:e instanceof jc.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof bt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof bt.Literal))return!1;let t=e.datatype?.value;return t?["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float","http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedShort","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#positiveInteger"].includes(t):!1}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new bt.Literal(t.toISOString(),new Fr.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static xsdInteger(e){let t=parseInt(e,10);if(isNaN(t))throw new Error(`xsd:integer: cannot convert '${e}' to integer`);return new bt.Literal(String(t),new Fr.IRI("http://www.w3.org/2001/XMLSchema#integer"))}static xsdDecimal(e){let t=parseFloat(e);if(isNaN(t))throw new Error(`xsd:decimal: cannot convert '${e}' to decimal`);return new bt.Literal(String(t),new Fr.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static sameTerm(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0||e.constructor!==t.constructor)return!1;if(e instanceof Fr.IRI&&t instanceof Fr.IRI)return e.value===t.value;if(e instanceof oi.BlankNode&&t instanceof oi.BlankNode)return e.id===t.id;if(e instanceof bt.Literal&&t instanceof bt.Literal){if(e.value!==t.value||e.language!==t.language)return!1;let r=e.datatype?.value,i=t.datatype?.value;return r===i}return!1}static iri(e){if(e===void 0)throw new Error("IRI: argument is undefined");if(e instanceof Fr.IRI)return e;if(e instanceof bt.Literal)return new Fr.IRI(e.value);throw e instanceof oi.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return n.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,i1.v4)().replace(/-/g,"").substring(0,12)}`;return new oi.BlankNode(t)}if(e instanceof bt.Literal)return new oi.BlankNode(e.value);if(e instanceof oi.BlankNode)return e;throw new Error("BNODE: argument must be a string literal or omitted")}static strdt(e,t){if(e===void 0)throw new Error("STRDT: lexical form is undefined");if(t===void 0)throw new Error("STRDT: datatype IRI is undefined");let r;if(e instanceof bt.Literal){if(e.language)throw new Error("STRDT: lexical form must not have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRDT: lexical form must be a string literal");let i;if(t instanceof Fr.IRI)i=t;else if(t instanceof bt.Literal)i=new Fr.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new bt.Literal(r,i)}static strlang(e,t){if(e===void 0)throw new Error("STRLANG: lexical form is undefined");if(t===void 0)throw new Error("STRLANG: language tag is undefined");let r;if(e instanceof bt.Literal){if(e.language)throw new Error("STRLANG: lexical form must not already have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRLANG: lexical form must be a string literal");let i;if(t instanceof bt.Literal)i=t.value;else if(typeof t=="string")i=t;else throw new Error("STRLANG: language tag must be a string literal");if(i==="")throw new Error("STRLANG: language tag cannot be empty");return new bt.Literal(r,void 0,i)}static strlangdir(e,t,r){if(e===void 0)throw new Error("STRLANGDIR: lexical form is undefined");if(t===void 0)throw new Error("STRLANGDIR: language tag is undefined");if(r===void 0)throw new Error("STRLANGDIR: direction is undefined");let i;if(e instanceof bt.Literal){if(e.language)throw new Error("STRLANGDIR: lexical form must not already have a language tag");i=e.value}else if(typeof e=="string")i=e;else throw new Error("STRLANGDIR: lexical form must be a string literal");let s;if(t instanceof bt.Literal)s=t.value;else if(typeof t=="string")s=t;else throw new Error("STRLANGDIR: language tag must be a string literal");if(s==="")throw new Error("STRLANGDIR: language tag cannot be empty");let a;if(r instanceof bt.Literal)a=r.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(a!=="ltr"&&a!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${a}'. Must be 'ltr' or 'rtl'`);return new bt.Literal(i,void 0,s,a)}static uuid(){let e=(0,i1.v4)();return new Fr.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,i1.v4)();return new bt.Literal(e)}static triple(e,t,r){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(r===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof bt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Fr.IRI)){let c=t instanceof bt.Literal?"Literal":t instanceof oi.BlankNode?"BlankNode":t instanceof jc.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new jc.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof jc.QuotedTriple)){let t=e instanceof Fr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof oi.BlankNode?"BlankNode":typeof e;throw new Error(`SUBJECT: argument must be QuotedTriple, got ${t}`)}return e.subject}static predicate(e){if(e===void 0)throw new Error("PREDICATE: argument is undefined");if(!(e instanceof jc.QuotedTriple)){let t=e instanceof Fr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof oi.BlankNode?"BlankNode":typeof e;throw new Error(`PREDICATE: argument must be QuotedTriple, got ${t}`)}return e.predicate}static object(e){if(e===void 0)throw new Error("OBJECT: argument is undefined");if(!(e instanceof jc.QuotedTriple)){let t=e instanceof Fr.IRI?"IRI":e instanceof bt.Literal?"Literal":e instanceof oi.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};pp.RDFTermFunctions=s1});var RA=S(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});mp.HashFunctions=void 0;var a1=class{static{o(this,"HashFunctions")}static md5(e){return require("crypto").createHash("md5").update(e).digest("hex")}static sha1(e){return require("crypto").createHash("sha1").update(e).digest("hex")}static sha256(e){return require("crypto").createHash("sha256").update(e).digest("hex")}static sha384(e){return require("crypto").createHash("sha384").update(e).digest("hex")}static sha512(e){return require("crypto").createHash("sha512").update(e).digest("hex")}};mp.HashFunctions=a1});var yp=S(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.BuiltInFunctions=void 0;var sr=EA(),Ta=TA(),oe=r1(),$c=CA(),Ot=IA(),Vu=RA(),o1=class{static{o(this,"BuiltInFunctions")}static str(...e){return sr.StringFunctions.str(...e)}static lang(...e){return sr.StringFunctions.lang(...e)}static langdir(...e){return sr.StringFunctions.langdir(...e)}static langMatches(...e){return sr.StringFunctions.langMatches(...e)}static regex(...e){return sr.StringFunctions.regex(...e)}static contains(...e){return sr.StringFunctions.contains(...e)}static strStarts(...e){return sr.StringFunctions.strStarts(...e)}static strEnds(...e){return sr.StringFunctions.strEnds(...e)}static strlen(...e){return sr.StringFunctions.strlen(...e)}static ucase(...e){return sr.StringFunctions.ucase(...e)}static lcase(...e){return sr.StringFunctions.lcase(...e)}static substr(...e){return sr.StringFunctions.substr(...e)}static strBefore(...e){return sr.StringFunctions.strBefore(...e)}static strAfter(...e){return sr.StringFunctions.strAfter(...e)}static concat(...e){return sr.StringFunctions.concat(...e)}static replace(...e){return sr.StringFunctions.replace(...e)}static encodeForUri(...e){return sr.StringFunctions.encodeForUri(...e)}static normalize(...e){return sr.StringFunctions.normalize(...e)}static fold(...e){return sr.StringFunctions.fold(...e)}static abs(...e){return Ta.MathFunctions.abs(...e)}static round(...e){return Ta.MathFunctions.round(...e)}static ceil(...e){return Ta.MathFunctions.ceil(...e)}static floor(...e){return Ta.MathFunctions.floor(...e)}static rand(){return Ta.MathFunctions.rand()}static msToMinutes(...e){return Ta.MathFunctions.msToMinutes(...e)}static msToHours(...e){return Ta.MathFunctions.msToHours(...e)}static msToSeconds(...e){return Ta.MathFunctions.msToSeconds(...e)}static parseDate(...e){return oe.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return oe.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return oe.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return oe.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return oe.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return oe.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return oe.DateTimeFunctions.year(...e)}static month(...e){return oe.DateTimeFunctions.month(...e)}static day(...e){return oe.DateTimeFunctions.day(...e)}static hours(...e){return oe.DateTimeFunctions.hours(...e)}static minutes(...e){return oe.DateTimeFunctions.minutes(...e)}static seconds(...e){return oe.DateTimeFunctions.seconds(...e)}static timezone(...e){return oe.DateTimeFunctions.timezone(...e)}static tz(...e){return oe.DateTimeFunctions.tz(...e)}static now(){return oe.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return oe.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return oe.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return oe.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return oe.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return oe.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return oe.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return oe.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return oe.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return oe.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return oe.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return oe.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return oe.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return oe.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return oe.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return oe.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return oe.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return oe.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return oe.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return oe.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return oe.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return oe.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return oe.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return oe.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return oe.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return oe.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return oe.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return oe.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return oe.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return oe.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return oe.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return oe.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return oe.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return oe.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return oe.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return oe.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return oe.DateTimeFunctions.adjust(...e)}static isTime(...e){return oe.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return oe.DateTimeFunctions.timeDiff(...e)}static compare(...e){return $c.LogicalFunctions.compare(...e)}static logicalAnd(...e){return $c.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return $c.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return $c.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return $c.LogicalFunctions.coalesce(...e)}static if(...e){return $c.LogicalFunctions.if(...e)}static datatype(...e){return Ot.RDFTermFunctions.datatype(...e)}static bound(...e){return Ot.RDFTermFunctions.bound(...e)}static isIRI(...e){return Ot.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return Ot.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return Ot.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return Ot.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return Ot.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return Ot.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return Ot.RDFTermFunctions.sameTerm(...e)}static iri(...e){return Ot.RDFTermFunctions.iri(...e)}static uri(...e){return Ot.RDFTermFunctions.uri(...e)}static bnode(...e){return Ot.RDFTermFunctions.bnode(...e)}static strdt(...e){return Ot.RDFTermFunctions.strdt(...e)}static strlang(...e){return Ot.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return Ot.RDFTermFunctions.strlangdir(...e)}static uuid(){return Ot.RDFTermFunctions.uuid()}static struuid(){return Ot.RDFTermFunctions.struuid()}static xsdDateTime(...e){return Ot.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return Ot.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return Ot.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return Ot.RDFTermFunctions.triple(...e)}static subject(...e){return Ot.RDFTermFunctions.subject(...e)}static predicate(...e){return Ot.RDFTermFunctions.predicate(...e)}static object(...e){return Ot.RDFTermFunctions.object(...e)}static md5(...e){return Vu.HashFunctions.md5(...e)}static sha1(...e){return Vu.HashFunctions.sha1(...e)}static sha256(...e){return Vu.HashFunctions.sha256(...e)}static sha384(...e){return Vu.HashFunctions.sha384(...e)}static sha512(...e){return Vu.HashFunctions.sha512(...e)}};gp.BuiltInFunctions=o1});var Uu=S(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.ExoQLBudgetExceededError=ns.ExoQLCycleError=ns.ExoQLEvalDisabledError=ns.ExoQLForbiddenKeywordError=void 0;var c1=class extends Error{static{o(this,"ExoQLForbiddenKeywordError")}constructor(e,t){super(t??`ExoQLForbiddenKeywordError: keyword "${e}" is not permitted by the exoql__Query AST allowlist`),this.name="ExoQLForbiddenKeywordError",this.keyword=e}};ns.ExoQLForbiddenKeywordError=c1;var l1=class extends Error{static{o(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};ns.ExoQLEvalDisabledError=l1;var u1=class extends Error{static{o(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};ns.ExoQLCycleError=u1;var f1=class extends Error{static{o(this,"ExoQLBudgetExceededError")}constructor(e,t,r,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${r})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=r}};ns.ExoQLBudgetExceededError=f1});var jA=S(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.functionHandlers=void 0;var k=yp();M.functionHandlers=new Map;M.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.str(t)});M.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.lang(t)});M.functionHandlers.set("langmatches",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.langMatches(t,r)});M.functionHandlers.set("contains",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.contains(t,r)});M.functionHandlers.set("strstarts",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.strStarts(t,r)});M.functionHandlers.set("strends",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.strEnds(t,r)});M.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.strlen(t)});M.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.ucase(t)});M.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.lcase(t)});M.functionHandlers.set("substr",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=Number(e.evaluateExpression(n[1],e.solution));if(n[2]){let i=Number(e.evaluateExpression(n[2],e.solution));return k.BuiltInFunctions.substr(t,r,i)}return k.BuiltInFunctions.substr(t,r)});M.functionHandlers.set("strbefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.strBefore(t,r)});M.functionHandlers.set("strafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.strAfter(t,r)});M.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return k.BuiltInFunctions.concat(...t)});M.functionHandlers.set("replace",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution)),s=n[3]?e.getStringValue(e.evaluateExpression(n[3],e.solution)):void 0;return k.BuiltInFunctions.replace(t,r,i,s)});M.functionHandlers.set("regex",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=n[2]?e.getStringValue(e.evaluateExpression(n[2],e.solution)):void 0;return k.BuiltInFunctions.regex(t,r,i)});M.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.encodeForUri(t)});M.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.datatype(t).value});M.functionHandlers.set("bound",(n,e)=>{let t=n[0];if(t.type==="variable"&&t.name){let r=e.solution.get(t.name);return k.BuiltInFunctions.bound(r)}return!0});var OA=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isIRI(t)},"isIriHandler");M.functionHandlers.set("isiri",OA);M.functionHandlers.set("isuri",OA);M.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isBlank(t)});M.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isLiteral(t)});M.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isNumeric(t)});M.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.hasLangdir(t)});M.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.isTriple(t)});M.functionHandlers.set("sameterm",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution);return k.BuiltInFunctions.sameTerm(t,r)});M.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.abs(t)});M.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.round(t)});M.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.ceil(t)});M.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return k.BuiltInFunctions.floor(t)});M.functionHandlers.set("rand",()=>k.BuiltInFunctions.rand());M.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.parseDate(t)});M.functionHandlers.set("datebefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.dateBefore(t,r)});M.functionHandlers.set("dateafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.dateAfter(t,r)});M.functionHandlers.set("dateinrange",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution));return k.BuiltInFunctions.dateInRange(t,r,i)});M.functionHandlers.set("datediffminutes",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.dateDiffMinutes(t,r)});M.functionHandlers.set("datediffhours",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return k.BuiltInFunctions.dateDiffHours(t,r)});var Bc=o((n,e,t)=>(r,i)=>{let s=i.evaluateExpression(r[0],i.solution);return e&&i.isYearMonthDurationValue(s)?e(s):t&&i.isDayTimeDurationValue(s)?t(s):n(i.getStringValue(s))},"createDateTimeAccessor"),PA=Bc(k.BuiltInFunctions.year.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationYears.bind(k.BuiltInFunctions),null);M.functionHandlers.set("year",PA);M.functionHandlers.set("years",PA);var FA=Bc(k.BuiltInFunctions.month.bind(k.BuiltInFunctions),k.BuiltInFunctions.durationMonths.bind(k.BuiltInFunctions),null);M.functionHandlers.set("month",FA);M.functionHandlers.set("months",FA);var DA=Bc(k.BuiltInFunctions.day.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationDays.bind(k.BuiltInFunctions));M.functionHandlers.set("day",DA);M.functionHandlers.set("days",DA);M.functionHandlers.set("hours",Bc(k.BuiltInFunctions.hours.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationHours.bind(k.BuiltInFunctions)));M.functionHandlers.set("minutes",Bc(k.BuiltInFunctions.minutes.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationMinutes.bind(k.BuiltInFunctions)));M.functionHandlers.set("seconds",Bc(k.BuiltInFunctions.seconds.bind(k.BuiltInFunctions),null,k.BuiltInFunctions.durationSeconds.bind(k.BuiltInFunctions)));M.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.timezone(t)});M.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.tz(t)});M.functionHandlers.set("adjust",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=n.length>1?e.evaluateExpression(n[1],e.solution):void 0;return k.BuiltInFunctions.adjust(t,r)});M.functionHandlers.set("now",()=>k.BuiltInFunctions.now());var NA=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");M.functionHandlers.set("datetime",NA);M.functionHandlers.set("xsd:datetime",NA);var LA=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");M.functionHandlers.set("integer",LA);M.functionHandlers.set("xsd:integer",LA);var kA=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");M.functionHandlers.set("decimal",kA);M.functionHandlers.set("xsd:decimal",kA);var MA=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");M.functionHandlers.set("daytimeduration",MA);M.functionHandlers.set("xsd:daytimeduration",MA);M.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToDays(t)});M.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToHours(t)});M.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToMinutes(t)});M.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationToSeconds(t)});M.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationDays(t)});M.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationHours(t)});M.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationMinutes(t)});M.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationSeconds(t)});M.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationYears(t)});M.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return k.BuiltInFunctions.durationMonths(t)});M.functionHandlers.set("datetimediff",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return k.BuiltInFunctions.dateTimeDiff(t,r)});M.functionHandlers.set("datetimeadd",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return k.BuiltInFunctions.dateTimeAdd(t,r)});M.functionHandlers.set("datetimesubtract",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return k.BuiltInFunctions.dateTimeSubtract(t,r)});M.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToMinutes(t)});M.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToHours(t)});M.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.msToSeconds(t)});M.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.md5(t)});M.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha1(t)});M.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha256(t)});M.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha384(t)});M.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return k.BuiltInFunctions.sha512(t)});M.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.subject(t)});M.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.predicate(t)});M.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return k.BuiltInFunctions.object(t)});M.functionHandlers.set("triple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution),i=e.getTermFromExpression(n[2],e.solution);return k.BuiltInFunctions.triple(t,r,i)});M.functionHandlers.set("days_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(1440*60*1e3))});M.functionHandlers.set("minutes_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t),s=new Date(r);return Math.floor((s.getTime()-i.getTime())/(60*1e3))});M.functionHandlers.set("hours_between",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return(new Date(r).getTime()-i.getTime())/(3600*1e3)});M.functionHandlers.set("age_days",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t);return Math.floor((new Date().getTime()-r.getTime())/(1440*60*1e3))});M.functionHandlers.set("week_number",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=new Date(t),i=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()));i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7));let s=new Date(Date.UTC(i.getUTCFullYear(),0,1));return Math.ceil(((i.getTime()-s.getTime())/(1440*60*1e3)+1)/7)});M.functionHandlers.set("format_date",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=new Date(t);return r.replace("YYYY",String(i.getFullYear())).replace("MM",String(i.getMonth()+1).padStart(2,"0")).replace("DD",String(i.getDate()).padStart(2,"0")).replace("HH",String(i.getHours()).padStart(2,"0")).replace("mm",String(i.getMinutes()).padStart(2,"0")).replace("ss",String(i.getSeconds()).padStart(2,"0"))});M.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:n}=Uu();throw new n})});var _p=S(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.FilterExecutor=Vc.FilterExecutorError=void 0;var yt=yp(),wj=jA(),Ej=Ce(),Aa=Ve(),hr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Vc.FilterExecutorError=hr;var d1=class{static{o(this,"FilterExecutor")}constructor(){this.existsEvaluator=null,this.tripleStore=null,this.uuidCache=new Map}setExistsEvaluator(e){this.existsEvaluator=e}setTripleStore(e){this.tripleStore=e,this.uuidCache.clear()}async*execute(e,t){let r=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;r?s=await this.evaluateExpressionAsync(e.expression,i):s=this.evaluateExpression(e.expression,i),s===!0&&(yield i)}catch{continue}}expressionContainsExists(e){if(!e||typeof e!="object")return!1;if(e.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="arithmetic"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(r=>this.expressionContainsExists(r))}if(e.type==="function"||e.type==="functionCall"){let t=e;return Array.isArray(t.args)?t.args.some(r=>this.expressionContainsExists(r)):!1}return!1}async executeAll(e,t){let r=[];async function*i(){for(let s of t)yield s}o(i,"generator");for await(let s of this.execute(e,i()))r.push(s);return r}evaluateExpression(e,t){let r=e;if("termType"in e)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":return r.value;case"NamedNode":return r.value;default:throw new hr(`Unsupported termType: ${String(r.termType)}`)}switch(e.type){case"comparison":return this.evaluateComparison(e,t);case"logical":return this.evaluateLogical(e,t);case"arithmetic":return this.evaluateArithmetic(e,t);case"function":case"functionCall":return this.evaluateFunction(e,t);case"variable":return t.get(e.name);case"literal":return e.value;case"in":return this.evaluateIn(e,t);case"exists":throw new hr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new hr(`Unsupported expression type: ${e.type}`)}}async evaluateExpressionAsync(e,t){if(!this.expressionContainsExists(e))return this.evaluateExpression(e,t);if(e.type==="exists")return this.evaluateExists(e,t);if(e.type==="logical")return this.evaluateLogicalAsync(e,t);if(e.type==="comparison"){let r=e,i=await this.evaluateExpressionAsync(r.left,t),s=await this.evaluateExpressionAsync(r.right,t);return yt.BuiltInFunctions.compare(i,s,r.operator)}return e.type==="in"?this.evaluateInAsync(e,t):e.type==="function"||e.type==="functionCall"?this.evaluateFunctionAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new hr("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let r=await this.existsEvaluator(e.pattern,t);return e.negated?!r:r}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let i=await this.evaluateExpressionAsync(e.operands[0],t);return yt.BuiltInFunctions.logicalNot(i)}let r=[];for(let i of e.operands){let s=await this.evaluateExpressionAsync(i,t);r.push(s)}if(e.operator==="&&")return yt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return yt.BuiltInFunctions.logicalOr(r);throw new hr(`Unknown logical operator: ${String(e.operator)}`)}async evaluateInAsync(e,t){let r=await this.evaluateExpressionAsync(e.expression,t),i=!1;for(let s of e.list){let a=await this.evaluateExpressionAsync(s,t);if(yt.BuiltInFunctions.compare(r,a,"=")){i=!0;break}}return e.negated?!i:i}async evaluateFunctionAsync(e,t){let r=e,i=this.extractFunctionName(r.function),s=r.args??[];if(i==="if"){if(s.length!==3)throw new hr("IF requires exactly 3 arguments");let l=await this.evaluateExpressionAsync(s[0],t);return this.toBoolean(l)?this.evaluateExpressionAsync(s[1],t):this.evaluateExpressionAsync(s[2],t)}if(i==="coalesce"){for(let l of s)try{let u=await this.evaluateExpressionAsync(l,t);if(u!=null)return u}catch{continue}return}let a=[];for(let l of s){let u=await this.evaluateExpressionAsync(l,t);a.push(this.wrapAsLiteralExpression(u))}let c={...r,args:a};return this.evaluateFunction(c,t)}wrapAsLiteralExpression(e){return e==null?{type:"literal",value:""}:e!==null&&typeof e=="object"&&"termType"in e?e:e instanceof Ej.IRI||e instanceof Aa.Literal?{type:"literal",value:e.value}:typeof e=="number"||typeof e=="boolean"||typeof e=="string"?{type:"literal",value:e}:{type:"literal",value:String(e)}}evaluateComparison(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return yt.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return yt.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return yt.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return yt.BuiltInFunctions.logicalOr(r);throw new hr(`Unknown logical operator: ${String(e.operator)}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let a=this.evaluateExpression(s,t);return yt.BuiltInFunctions.compare(r,a,"=")});return e.negated?!i:i}evaluateArithmetic(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(r)&&this.isDateValue(i))return yt.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return yt.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return yt.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return yt.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return yt.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return yt.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new hr("Division by zero");return yt.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return yt.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),a=this.toNumericValue(i);switch(e.operator){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":if(a===0)throw new hr("Division by zero");return s/a;default:throw new hr(`Unknown arithmetic operator: ${String(e.operator)}`)}}isDayTimeDurationValue(e){return e instanceof Aa.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof Aa.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof Aa.Literal){let t=e.datatype?.value||"";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let i=parseFloat(e.value);if(!isNaN(i))return i}let r=parseFloat(e.value);if(!isNaN(r))return r}if(typeof e=="string"){let t=parseFloat(e);if(!isNaN(t))return t}if(e&&typeof e=="object"&&"value"in e){let t=parseFloat(String(e.value));if(!isNaN(t))return t}throw new hr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof Aa.Literal){let t=e.datatype?.value||"";return t.includes("#dateTime")||t.includes("#date")?!0:/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e.value)}return typeof e=="string"?/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e):!1}isDateValue(e){return e instanceof Aa.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof Aa.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let r=e,i=this.extractFunctionName(r.function),s=this.evaluateSpecialFunction(i,r.args,t);if(s!==void 0)return s.value;let a=wj.functionHandlers.get(i);if(!a)throw new hr(`Unknown function: ${i}`);let c={evaluateExpression:o((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:o((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:o(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:o(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:o(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return a(r.args,c)}extractFunctionName(e){if(typeof e=="string")return e.toLowerCase();if(e&&typeof e=="object"&&"value"in e){let t=e.value;return((t.includes("#")?t.split("#").pop():t.split("/").pop())||t).toLowerCase()}throw new hr(`Unknown function format: ${String(e)}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let i of t)try{let s=this.evaluateExpression(i,r);if(s!=null)return{value:s}}catch{continue}return{value:void 0};case"if":{if(!t||t.length!==3)throw new hr("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],r);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],r):this.evaluateExpression(t[2],r)}}case"byuuid":return{value:this.evaluateByUUID({type:"function",function:"byuuid",args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof Aa.Literal){let t=e.datatype?.value||"";if(t.includes("#boolean"))return e.value==="true"||e.value==="1";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let r=parseFloat(e.value);return!isNaN(r)&&r!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new hr("exo:byUUID requires exactly 1 argument (UUID string)");let r=this.evaluateExpression(e.args[0],t),i=this.getStringValue(r);if(!i)return;let s=i.toLowerCase();if(this.uuidCache.has(s))return this.uuidCache.get(s)??void 0;if(!this.tripleStore){this.uuidCache.set(s,null);return}if(this.tripleStore.findSubjectsByUUIDSync){let a=this.tripleStore.findSubjectsByUUIDSync(s);if(a.length===0){this.uuidCache.set(s,null);return}let c=a[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let r=e.toLowerCase();this.uuidCache.set(r,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Vc.FilterExecutor=d1});var p1=S(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.OptionalExecutor=void 0;var h1=class{static{o(this,"OptionalExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(r,i)}async executeAll(e,t){let r=[];for(let i of this.hashJoin(e,t))r.push(i);return r}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let r=new Set;for(let l of e)for(let u of l.variables())r.add(u);let i=new Set;for(let l of t)for(let u of l.variables())i.add(u);let s=[];for(let l of r)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let a="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,a),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,a),f=c.get(u),d=!1;if(f)for(let h of f){let p=l.merge(h);p!==null&&(yield p,d=!0)}d||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let a=e.get(s);i.push(a!==void 0?a.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let a=r.merge(s);a!==null&&(yield a,i=!0)}i||(yield r)}}};Sp.OptionalExecutor=h1});var g1=S(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.UnionExecutor=void 0;var m1=class{static{o(this,"UnionExecutor")}async*execute(e,t){let r=new Set;for await(let i of e){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}for await(let i of t){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};bp.UnionExecutor=m1});var $A=S(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});vp.MinusExecutor=void 0;var y1=class{static{o(this,"MinusExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);for(let s of r){let a=!1;for(let c of i)if(this.areCompatible(s,c)){a=!0;break}a||(yield s)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}areCompatible(e,t){let r=e.variables(),i=new Set(t.variables()),s=r.filter(a=>i.has(a));if(s.length===0)return!1;for(let a of s){let c=e.get(a),l=t.get(a);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};vp.MinusExecutor=y1});var VA=S(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.ValuesExecutor=Uc.ValuesExecutorError=void 0;var Tj=rs(),BA=Ce(),Aj=Ve(),wp=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Uc.ValuesExecutorError=wp;var _1=class{static{o(this,"ValuesExecutor")}async*execute(e){if(e.bindings.length!==0)for(let t of e.bindings)yield this.createSolutionMapping(t)}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}createSolutionMapping(e){let t=new Tj.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.toRDFTerm(i);t.set(r,s)}return t}toRDFTerm(e){if(e.type==="iri")return new BA.IRI(e.value);if(e.type==="literal")return new Aj.Literal(e.value,e.datatype?new BA.IRI(e.datatype):void 0,e.language,e.direction);throw new wp(`Unknown term type: ${e.type}`)}};Uc.ValuesExecutor=_1});var S1=S(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.CustomAggregateRegistry=Wc.CustomAggregateError=void 0;var qc=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Wc.CustomAggregateError=qc;var Ep=class n{static{o(this,"CustomAggregateRegistry")}constructor(){this.aggregates=new Map}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance&&n.instance.clear(),n.instance=null}register(e,t){if(!e||typeof e!="string")throw new qc("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new qc("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new qc(`Aggregate with IRI "${e}" is already registered`,e);this.aggregates.set(e,t)}unregister(e){return this.aggregates.delete(e)}get(e){return this.aggregates.get(e)}has(e){return this.aggregates.has(e)}getRegisteredIris(){return Array.from(this.aggregates.keys())}clear(){this.aggregates.clear()}get size(){return this.aggregates.size}};Wc.CustomAggregateRegistry=Ep;Ep.instance=null});var b1=S(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.BUILT_IN_AGGREGATES=Je.modeAggregate=Je.stddevAggregate=Je.varianceAggregate=Je.medianAggregate=Je.EXO_AGGREGATE_NS=void 0;Je.getNumericValue=Tp;Je.createDecimalLiteral=ci;Je.createDoubleLiteral=Ij;Je.createPercentileAggregate=vo;var wo=Ve(),Gc=Ce(),xj=new Gc.IRI("http://www.w3.org/2001/XMLSchema#decimal"),Cj=new Gc.IRI("http://www.w3.org/2001/XMLSchema#double");Je.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Tp(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof wo.Literal?parseFloat(n.value):n instanceof Gc.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(Tp,"getNumericValue");function ci(n){return new wo.Literal(String(n),xj)}o(ci,"createDecimalLiteral");function Ij(n){return new wo.Literal(String(n),Cj)}o(Ij,"createDoubleLiteral");Je.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Tp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ci(0);let r=[...t].sort((a,c)=>a-c),i=Math.floor(r.length/2),s=r.length%2!==0?r[i]:(r[i-1]+r[i])/2;return ci(s)}};Je.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Tp(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ci(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return ci(i)}};Je.stddevAggregate={init(){return{values:[]}},step(n,e){Je.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ci(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return ci(Math.sqrt(i))}};Je.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof wo.Literal||e instanceof Gc.IRI?e.value:e),i=t.counts.get(r)||0;t.counts.set(r,i+1),t.values.set(r,e)},finalize(n){let e=n;if(e.counts.size===0)return new wo.Literal(" ",new Gc.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",r=0;for(let[a,c]of e.counts)c>r&&(r=c,t=a);let i=e.values.get(t);if(i instanceof wo.Literal)return i;let s=parseFloat(t);return isNaN(s)?new wo.Literal(t,new Gc.IRI("http://www.w3.org/2001/XMLSchema#string")):ci(s)}};function vo(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=Tp(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return ci(0);let s=[...i].sort((d,h)=>d-h),a=r.percentile*(s.length-1),c=Math.floor(a),l=Math.ceil(a);if(c===l)return ci(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return ci(f)}}}o(vo,"createPercentileAggregate");Je.BUILT_IN_AGGREGATES={[`${Je.EXO_AGGREGATE_NS}median`]:Je.medianAggregate,[`${Je.EXO_AGGREGATE_NS}variance`]:Je.varianceAggregate,[`${Je.EXO_AGGREGATE_NS}stddev`]:Je.stddevAggregate,[`${Je.EXO_AGGREGATE_NS}mode`]:Je.modeAggregate,[`${Je.EXO_AGGREGATE_NS}percentile25`]:vo(25),[`${Je.EXO_AGGREGATE_NS}percentile50`]:vo(50),[`${Je.EXO_AGGREGATE_NS}percentile75`]:vo(75),[`${Je.EXO_AGGREGATE_NS}percentile90`]:vo(90),[`${Je.EXO_AGGREGATE_NS}percentile95`]:vo(95),[`${Je.EXO_AGGREGATE_NS}percentile99`]:vo(99)}});var WA=S(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.AggregateExecutor=zc.AggregateExecutorError=void 0;var ar=Ve(),w1=Ce(),Rj=_p(),Oj=S1(),Pj=b1(),UA=new w1.IRI("http://www.w3.org/2001/XMLSchema#integer"),Eo=new w1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),is=new w1.IRI("http://www.w3.org/2001/XMLSchema#string");function qA(n){return typeof n=="object"&&n.type==="custom"}o(qA,"isCustomAggregation");var qu=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};zc.AggregateExecutorError=qu;var v1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new Rj.FilterExecutor}execute(e,t){let r=this.groupSolutions(t,e.variables),i=[];for(let[s,a]of r.entries()){let c=new Map;for(let f of e.variables)if(a.length>0){let d=a[0].get(f);d&&c.set(f,d)}for(let f of e.aggregates){let d=this.computeAggregate(f.expression,a);c.set(f.variable,d)}let{SolutionMapping:l}=rs(),u=new l;for(let[f,d]of c.entries())u.set(f,d);i.push(u)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let r=new Map;if(t.length===0)return r.set("",e),r;for(let i of e){let s=this.computeGroupKey(i,t),a=r.get(s);a?a.push(i):r.set(s,[i])}return r}computeGroupKey(e,t){return t.map(r=>{let i=e.get(r);return i?this.termToString(i):""}).join("|")}termToString(e){if(e&&typeof e=="object"){if("value"in e)return String(e.value);if("id"in e)return String(e.id)}return String(e)}computeAggregate(e,t){if(qA(e.aggregation))return this.computeCustomAggregate(e,t);let r=this.extractValues(e,t),i=e.aggregation;switch(i){case"count":{let s=this.computeCount(r,e.distinct);return new ar.Literal(String(s),UA)}case"sum":{let s=this.computeSum(r);return new ar.Literal(String(s),Eo)}case"avg":{let s=this.computeAvg(r);return new ar.Literal(String(s),Eo)}case"min":{let s=this.computeMin(r);return s===void 0?new ar.Literal("",is):typeof s=="number"?new ar.Literal(String(s),Eo):new ar.Literal(String(s),is)}case"max":{let s=this.computeMax(r);return s===void 0?new ar.Literal("",is):typeof s=="number"?new ar.Literal(String(s),Eo):new ar.Literal(String(s),is)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new ar.Literal(s||" ",is)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new ar.Literal(" ",is):typeof s=="number"?new ar.Literal(String(s),Eo):new ar.Literal(String(s),is)}default:{let s=i;throw new qu(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=Oj.CustomAggregateRegistry.getInstance().get(i);if(a||(a=Pj.BUILT_IN_AGGREGATES[i]),!a)throw new qu(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=a.init();for(let l of t){let u=null;if(e.expression){let f=this.evaluateExpression(e.expression,l);f!==void 0&&(u=f)}else u=1;a.step(c,u)}return a.finalize(c)}extractValues(e,t){if(!e.expression)return t.map(()=>1);let r=[];for(let i of t){let s=this.evaluateExpression(e.expression,i);s!=null&&r.push(s)}return r}evaluateExpression(e,t){if(e.type==="variable"){let r=t.get(e.name);return r==null?void 0:typeof r=="number"||typeof r=="string"||typeof r=="boolean"?r:typeof r=="object"&&"value"in r?r.value:r}if(e.type==="literal")return e.value;try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}computeCount(e,t){return t?new Set(e.map(r=>String(r))).size:e.length}computeSum(e){return e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r)).reduce((r,i)=>r+i,0)}computeAvg(e){let t=e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r));return t.length===0?0:t.reduce((r,i)=>r+i,0)/t.length}computeMin(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.min(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s<i?s:i,r[0])}computeMax(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.max(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s>i?s:i,r[0])}computeGroupConcat(e,t,r){let i=e.map(s=>String(s));return r&&(i=[...new Set(i)]),i.join(t)}computeSample(e,t){if(e.length===0)return;if(t){let s=[...new Set(e.map(l=>String(l)))];if(s.length===0)return;let a=s[0],c=parseFloat(a);return isNaN(c)?a:c}let r=e[0];if(typeof r=="number")return r;let i=parseFloat(String(r));return isNaN(i)?String(r):i}createEmptyAggregateResult(e){let{SolutionMapping:t}=rs(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(qA(s)){r.set(i.variable,new ar.Literal("0",Eo));continue}switch(s){case"count":r.set(i.variable,new ar.Literal("0",UA));break;case"sum":case"avg":r.set(i.variable,new ar.Literal("0",Eo));break;case"group_concat":r.set(i.variable,new ar.Literal(" ",is));break;case"min":case"max":case"sample":r.set(i.variable,new ar.Literal("",is));break;default:r.set(i.variable,new ar.Literal("",is))}}return r}};zc.AggregateExecutor=v1});var x1=S(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.ConstructExecutor=void 0;var Fj=ii(),To=Ce(),E1=Ve(),T1=Gt(),Dj=bu(),A1=class{static{o(this,"ConstructExecutor")}async execute(e,t){let r=[],i=new Set;for(let s of t)for(let a of e)try{let c=this.instantiateTriple(a,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),r.push(c))}catch{continue}return r}instantiateTriple(e,t){if(this.isPropertyPath(e.predicate))throw new Error("Property paths are not supported in CONSTRUCT templates");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.predicate,t),s=this.instantiateElement(e.object,t);return new Fj.Triple(r,i,s)}isPropertyPath(e){return e.type==="path"}instantiateElement(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable: ${e.value}`);return r}if(e.type==="iri")return new To.IRI(e.value);if(e.type==="literal")return new E1.Literal(e.value,e.datatype?new To.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new T1.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Unknown element type: ${e.type}`)}instantiateQuotedTriple(e,t){let r=this.instantiateQuotedSubject(e.subject,t),i=this.instantiateQuotedPredicate(e.predicate,t),s=this.instantiateQuotedObject(e.object,t);return new Dj.QuotedTriple(r,i,s)}instantiateQuotedSubject(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple subject: ${e.value}`);if(r instanceof E1.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new To.IRI(e.value);if(e.type==="blank")return new T1.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Invalid element type for quoted triple subject: ${e.type}`)}instantiateQuotedPredicate(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple predicate: ${e.value}`);if(!(r instanceof To.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new To.IRI(e.value)}instantiateQuotedObject(e,t){if(e.type==="variable"){let i=t.get(e.value);if(!i)throw new Error(`Unbound variable in quoted triple object: ${e.value}`);return i}if(e.type==="iri")return new To.IRI(e.value);if(e.type==="blank")return new T1.BlankNode(e.value);if(e.type==="literal")return new E1.Literal(e.value,e.datatype?new To.IRI(e.datatype):void 0,e.language);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);let r=e;throw new Error(`Invalid element type for quoted triple object: ${r.type}`)}};Ap.ConstructExecutor=A1});var zA=S(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.ServiceExecutor=Hc.ServiceExecutorError=void 0;var Nj=rs(),GA=Ce(),Lj=Ve(),kj=Gt(),Ao=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Hc.ServiceExecutorError=Ao;var C1=class{static{o(this,"ServiceExecutor")}constructor(e={}){this.timeout=e.timeout??3e4,this.httpClient=e.httpClient??((t,r)=>fetch(t,r)),this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3}async*execute(e,t){try{let r=t(e.pattern),i=await this.executeRemoteQuery(e.endpoint,r);for(let s of i)yield s}catch(r){if(e.silent)return;throw r}}async executeRemoteQuery(e,t){let r;for(let i=0;i<=this.maxRetries;i++)try{let s=new AbortController,a=setTimeout(()=>s.abort(),this.timeout);try{let c=await this.httpClient(e,{method:"POST",headers:{"Content-Type":"application/sparql-query",Accept:"application/sparql-results+json"},body:t,signal:s.signal});if(!c.ok)throw new Ao(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(a)}}catch(s){if(r=s instanceof Error?s:new Error(String(s)),this.isRetryableError(r)&&i<this.maxRetries){await this.delay(this.retryDelay);continue}throw new Ao(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Ao(`Failed to query remote SPARQL endpoint ${e} after ${this.maxRetries+1} attempts`,r)}parseJsonResults(e){return!e.results||!Array.isArray(e.results.bindings)?[]:e.results.bindings.map(t=>this.parseBinding(t))}parseBinding(e){let t=new Nj.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.parseRDFTerm(i);t.set(r,s)}return t}parseRDFTerm(e){switch(e.type){case"uri":return new GA.IRI(e.value);case"literal":{let t=e.datatype?new GA.IRI(e.datatype):void 0;return new Lj.Literal(e.value,t,e["xml:lang"])}case"bnode":return new kj.BlankNode(e.value);default:throw new Ao(`Unknown RDF term type: ${e.type}`)}}isRetryableError(e){let t=e.message.toLowerCase();return!!(e.name==="AbortError"||t.includes("network")||t.includes("econnreset")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("returned 5"))}delay(e){return new Promise(t=>setTimeout(t,e))}};Hc.ServiceExecutor=C1});var QA=S(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.GraphExecutor=Qc.GraphExecutorError=void 0;var HA=Ce(),xp=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};Qc.GraphExecutorError=xp;var I1=class{static{o(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,r){let i=e.name;if(i.type==="iri")yield*this.executeWithGraph(e.pattern,i,t);else if(i.type==="variable")yield*this.executeWithGraphVariable(e,i,t,r);else throw new xp(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new HA.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*r(e,i))}async*executeWithGraphVariable(e,t,r,i){if(i){let a=i.get(t.value);if(a&&a instanceof HA.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:a.value},r);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let a of s)for await(let c of r(e.pattern,a)){let l=c.clone();l.set(t.value,a),yield l}}};Qc.GraphExecutor=I1});var YA=S(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.SPARQLGenerator=Kc.SPARQLGeneratorError=void 0;var Yc=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Kc.SPARQLGeneratorError=Yc;var R1=class{static{o(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
49
49
|
${i}
|
|
50
50
|
}`}generateWhereClause(e,t=2){let r=" ".repeat(t);switch(e.type){case"bgp":return this.generateBGP(e,t);case"filter":return`${this.generateWhereClause(e.input,t)}
|
|
51
51
|
${r}FILTER(${this.generateExpression(e.expression)})`;case"join":return`${this.generateWhereClause(e.left,t)}
|
|
@@ -67,7 +67,7 @@ ${r}}`}default:throw new Yc(`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 Yc(`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 Yc(`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}}};Kc.SPARQLGenerator=R1});var Jc=S(En=>{"use strict";var Mj=En&&En.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),jj=En&&En.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),KA=En&&En.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&Mj(t,e,r[i]);return jj(t,e),t}})();Object.defineProperty(En,"__esModule",{value:!0});En.QueryExecutor=En.ExoQLQueryExecutor=En.QueryExecutorError=void 0;var $j=Y_(),Bj=_p(),Vj=p1(),Uj=g1(),qj=$A(),Wj=VA(),Gj=WA(),zj=x1(),Hj=zA(),Qj=QA(),Yj=YA(),Kj=Ce(),Xc=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};En.QueryExecutorError=Xc;var Cp=class{static{o(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new $j.BGPExecutor(e),this.filterExecutor=new Bj.FilterExecutor,this.optionalExecutor=new Vj.OptionalExecutor,this.unionExecutor=new Uj.UnionExecutor,this.minusExecutor=new qj.MinusExecutor,this.valuesExecutor=new Wj.ValuesExecutor,this.aggregateExecutor=new Gj.AggregateExecutor,this.constructExecutor=new zj.ConstructExecutor,this.serviceExecutor=new Hj.ServiceExecutor(t.serviceConfig),this.graphExecutor=new Qj.GraphExecutor(e),this.sparqlGenerator=new Yj.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 Xc(`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(()=>KA(rs())),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 Kj.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(()=>KA(rs()));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 Xc("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 Xc("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};En.ExoQLQueryExecutor=Cp;En.QueryExecutor=Cp});var XA=S(Bs=>{"use strict";var Xj=Bs&&Bs.__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},Jj=Bs&&Bs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.CommandResolver=void 0;var Zj=le(),e5=bc(),li=Ce(),Ln=Ve(),ee=Ir(),O1=pc(),Zc=zy(),t5=Oc(),r5=Fc(),n5=Jc(),P1=10,F1=class{static{o(this,"CommandResolver")}constructor(e,t=e5.NullLogger){this.tripleStore=e,this.logger=t,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,ee.Namespace.RDF.term("type"),ee.Namespace.EXOCMD.term("Command"))).length===0)return null;let i=await this.getLiteralValue(t,ee.Namespace.EXO.term("Asset_label"))??"Unknown Command",s=await this.getLiteralValue(t,ee.Namespace.EXOCMD.term("Command_labelTemplate")),a=await this.getLiteralValue(t,ee.Namespace.EXOCMD.term("Command_icon")),c=await this.getLiteralValue(t,ee.Namespace.EXOCMD.term("Command_confirmMessage")),l=await this.getLiteralValue(t,ee.Namespace.EXOCMD.term("Command_successMessage")),u=await this.getLiteralValue(t,ee.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,ee.Namespace.RDF.term("type"),ee.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 t5.ExoQLParser().parse(r),c=new r5.ExoQLAlgebraTranslator().translate(s),u=await new n5.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 Ln.Literal||h instanceof li.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,ee.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,ee.Namespace.EXOCMD.term("CommandBinding_targetClass")),a=await this.getLinkedValue(e,ee.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,ee.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!a&&!c)return null;let l=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_group")),d=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_variant")),h=d!==null?this.coerceVariant(d,t):void 0;f!==null&&d!==null&&this.logger.warn(this.capWarning(`CommandBinding ${t}: both _group and _variant present; preferring _variant (${String(d)})`));let p=await this.loadLinkedPreconditionFromProperty(e,ee.Namespace.EXOCMD.term("CommandBinding_precondition")),_=await this.loadLinkedStyle(e,t);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,variant:h,precondition:p??void 0,style:_??void 0}}async loadLinkedStyle(e,t){let r=await this.tripleStore.match(e,ee.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(r.length>0){let s=r[0].object,a=null;if(s instanceof li.IRI)a=s;else if(s instanceof Ln.Literal){let c=this.normalizeWikilink(s.value);a=await this.findSubjectByUID(c)}if(a){let c=await this.loadStyleAsset(a);if(c)return c}this.logger.warn(this.capWarning(`CommandBinding ${t}: style reference unresolved, falling back to inline variant`))}let i=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_variant"));if(i!==null){let s=this.coerceVariant(i,t);if(s!==void 0)return{id:`inline:${t}`,label:"",variant:s,inline:!0}}return null}async loadStyleAsset(e){let t=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,a=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(a),l=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),h=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),p=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_source")),_=p!==null?this.coerceStyleSource(p,t):void 0;return{id:t,label:r,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:h??void 0,source:_,inline:!1}}coerceVariant(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Zc.COMMAND_VARIANT_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${r}" not in whitelist [${Zc.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Zc.LABEL_CLASS_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${r}" not in whitelist [${Zc.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Zc.STYLE_SOURCE_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle source "${r}" not in whitelist [${Zc.STYLE_SOURCE_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceBoolean(e){if(e===null)return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}capWarning(e){return e.length<=200?e:e.slice(0,197)+"..."}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let 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,ee.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 li.IRI)s=i;else if(i instanceof Ln.Literal){let h=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(h)}if(!s)return null;let a=await this.getLiteralValue(s,ee.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,ee.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,ee.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,ee.Namespace.EXOCMD.term("Precondition_hostFunction")),f=await this.tripleStore.match(s,ee.Namespace.EXOCMD.term("Precondition_query"),void 0),d;if(f.length>0){let h=f[0].object;if(h instanceof li.IRI){let p=await this.getLiteralValue(h,ee.Namespace.EXO.term("Asset_uid"));p&&(d=p)}else h instanceof Ln.Literal&&(d=this.normalizeWikilink(h.value))}return!a||!l&&!u&&!d?null:{id:a,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u},...d&&{query:d}}}async loadLinkedGrounding(e,t){if(t>=P1)return null;let r=await this.tripleStore.match(e,ee.Namespace.EXOCMD.term("Command_grounding"),void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof li.IRI)s=i;else if(i instanceof Ln.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>=P1)return null;let r=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_label"))??"",s=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_type"));if(!s)return null;let a=this.resolveGroundingType(s);if(!a)return null;let c=await this.getObsidianName(e,ee.Namespace.EXOCMD.term("Grounding_targetProperty"));if(a===O1.GroundingType.SERVICE_CALL){let v=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_serviceId"));v&&(c=v)}let l=await this.getObsidianWikilinkValue(e,ee.Namespace.EXOCMD.term("Grounding_targetValue")),u=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),f=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_targetClass")),d=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_targetPrototype")),h=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_targetFolder")),p=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_inputSchema")),_;a===O1.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>=P1)return[];let r=await this.tripleStore.match(e,ee.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let a=null;if(s.object instanceof li.IRI)a=s.object;else if(s.object instanceof Ln.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(O1.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,ee.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof Ln.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 Ln.Literal||i instanceof li.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 li.IRI){let s=await this.tripleStore.match(i,ee.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof Ln.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof Ln.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 Ln.Literal?this.normalizeWikilink(i.value):i instanceof li.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 Ln.Literal?i.value:i instanceof li.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 Ln.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof li.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,ee.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===ee.Namespace.EMS.iri.value)return`ems__${s}`;if(i===ee.Namespace.EXO.iri.value)return`exo__${s}`;if(i===ee.Namespace.EXOCMD.iri.value)return`exocmd__${s}`;if(i===ee.Namespace.IMS.iri.value)return`ims__${s}`;if(i===ee.Namespace.ZTLK.iri.value)return`ztlk__${s}`;if(i===ee.Namespace.PTMS.iri.value)return`ptms__${s}`;if(i===ee.Namespace.LIT.iri.value)return`lit__${s}`;if(i===ee.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}};Bs.CommandResolver=F1;Bs.CommandResolver=F1=Xj([(0,Zj.injectable)(),Jj("design:paramtypes",[Object,Object])],F1)});var N1=S(D1=>{"use strict";Object.defineProperty(D1,"__esModule",{value:!0});D1.validateExoQLAllowlist=i5;var Ip=Uu();function i5(n){if(!n||typeof n!="object")return;let e=n;if(e.type==="update"){let t=n.updates??[];for(let r of t)if(r?.type==="load")throw new Ip.ExoQLForbiddenKeywordError("LOAD");throw new Ip.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,r=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||r)throw new Ip.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)Rp(t);if(Array.isArray(e.template))for(let t of e.template)Rp(t)}}o(i5,"validateExoQLAllowlist");function Rp(n){if(!n||typeof n!="object")return;if(n.type==="service")throw new Ip.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(n.patterns))for(let t of n.patterns)Rp(t);let e=n.where;if(Array.isArray(e))for(let t of e)Rp(t)}o(Rp,"walkPatternForBannedKeywords")});var L1=S(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.DEFAULT_EVAL_CONFIG=void 0;Op.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var M1=S(k1=>{"use strict";Object.defineProperty(k1,"__esModule",{value:!0});k1.evaluateWithExoEval=f5;var s5=Oc(),a5=Fc(),o5=Jc(),c5=N1(),l5=L1(),u5=Uu();async function f5(n,e={}){if(typeof n!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let r=new s5.ExoQLParser().parse(n);if((0,c5.validateExoQLAllowlist)(r),!{...l5.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new u5.ExoQLEvalDisabledError;let s="queryType"in r&&typeof r.queryType=="string"?r.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new a5.ExoQLAlgebraTranslator().translate(r),l=new o5.ExoQLQueryExecutor(e.store);return l.isAskQuery(c)?{kind:"ask",result:await l.executeAsk(c)}:l.isConstructQuery(c)?{kind:"construct",triples:await l.executeConstruct(c)}:{kind:"select",rows:await l.executeAll(c)}}o(f5,"evaluateWithExoEval")});var ZA=S(Vs=>{"use strict";var d5=Vs&&Vs.__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},h5=Vs&&Vs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Wu;Object.defineProperty(Vs,"__esModule",{value:!0});Vs.PreconditionEvaluator=void 0;var p5=le(),m5=Oc(),g5=Fc(),JA=Jc(),y5=M1(),Gu=Wu=class{static{o(this,"PreconditionEvaluator")}constructor(e,t){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.query?this.evaluateQueryRef(e.query,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return!1;let i=this.substituteVariables(r,t),s=await(0,y5.evaluateWithExoEval)(i,{store:this.tripleStore});return s.kind!=="ask"?!1:s.result}catch{return!1}}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Wu.SENTINEL_IRI),i=new m5.ExoQLParser().parse(t),a=new g5.ExoQLAlgebraTranslator().translate(i);return new JA.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(Wu.SENTINEL_IRI,t));return await new JA.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()+Wu.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`,we=`${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,`"${we}"^^xsd:date`).replace(/\$today/g,`"${i}"^^xsd:date`)}};Vs.PreconditionEvaluator=Gu;Gu.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";Gu.ALMATY_OFFSET_MS=300*60*1e3;Vs.PreconditionEvaluator=Gu=Wu=d5([(0,p5.injectable)(),h5("design:paramtypes",[Object,Object])],Gu)});var Gn=S(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.FrontmatterService=void 0;var zu=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 Yc(`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}}};Kc.SPARQLGenerator=R1});var Jc=S(En=>{"use strict";var Mj=En&&En.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),jj=En&&En.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),KA=En&&En.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&Mj(t,e,r[i]);return jj(t,e),t}})();Object.defineProperty(En,"__esModule",{value:!0});En.QueryExecutor=En.ExoQLQueryExecutor=En.QueryExecutorError=void 0;var $j=Y_(),Bj=_p(),Vj=p1(),Uj=g1(),qj=$A(),Wj=VA(),Gj=WA(),zj=x1(),Hj=zA(),Qj=QA(),Yj=YA(),Kj=Ce(),Xc=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};En.QueryExecutorError=Xc;var Cp=class{static{o(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new $j.BGPExecutor(e),this.filterExecutor=new Bj.FilterExecutor,this.optionalExecutor=new Vj.OptionalExecutor,this.unionExecutor=new Uj.UnionExecutor,this.minusExecutor=new qj.MinusExecutor,this.valuesExecutor=new Wj.ValuesExecutor,this.aggregateExecutor=new Gj.AggregateExecutor,this.constructExecutor=new zj.ConstructExecutor,this.serviceExecutor=new Hj.ServiceExecutor(t.serviceConfig),this.graphExecutor=new Qj.GraphExecutor(e),this.sparqlGenerator=new Yj.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 Xc(`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(()=>KA(rs())),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 Kj.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(()=>KA(rs()));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 Xc("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 Xc("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};En.ExoQLQueryExecutor=Cp;En.QueryExecutor=Cp});var XA=S(Bs=>{"use strict";var Xj=Bs&&Bs.__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},Jj=Bs&&Bs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.CommandResolver=void 0;var Zj=le(),e5=bc(),li=Ce(),Ln=Ve(),ee=Ir(),O1=pc(),Zc=zy(),t5=Oc(),r5=Fc(),n5=Jc(),P1=10,F1=class{static{o(this,"CommandResolver")}constructor(e,t=e5.NullLogger){this.tripleStore=e,this.logger=t,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,ee.Namespace.RDF.term("type"),ee.Namespace.EXOCMD.term("Command"))).length===0)return null;let i=await this.getLiteralValue(t,ee.Namespace.EXO.term("Asset_label"))??"Unknown Command",s=await this.getLiteralValue(t,ee.Namespace.EXOCMD.term("Command_labelTemplate")),a=await this.getLiteralValue(t,ee.Namespace.EXOCMD.term("Command_icon")),c=await this.getLiteralValue(t,ee.Namespace.EXOCMD.term("Command_confirmMessage")),l=await this.getLiteralValue(t,ee.Namespace.EXOCMD.term("Command_successMessage")),u=await this.getLiteralValue(t,ee.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,ee.Namespace.RDF.term("type"),ee.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 t5.ExoQLParser().parse(r),c=new r5.ExoQLAlgebraTranslator().translate(s),u=await new n5.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 Ln.Literal||h instanceof li.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,ee.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,ee.Namespace.EXOCMD.term("CommandBinding_targetClass")),a=await this.getLinkedValue(e,ee.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,ee.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!a&&!c)return null;let l=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,h=await this.loadLinkedPreconditionFromProperty(e,ee.Namespace.EXOCMD.term("CommandBinding_precondition")),p=await this.loadLinkedStyle(e,t);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,variant:d,precondition:h??void 0,style:p??void 0}}async loadLinkedStyle(e,t){let r=await this.tripleStore.match(e,ee.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(r.length>0){let s=r[0].object,a=null;if(s instanceof li.IRI)a=s;else if(s instanceof Ln.Literal){let c=this.normalizeWikilink(s.value);a=await this.findSubjectByUID(c)}if(a){let c=await this.loadStyleAsset(a);if(c)return c}this.logger.warn(this.capWarning(`CommandBinding ${t}: style reference unresolved, falling back to inline variant`))}let i=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBinding_variant"));if(i!==null){let s=this.coerceVariant(i,t);if(s!==void 0)return{id:`inline:${t}`,label:"",variant:s,inline:!0}}return null}async loadStyleAsset(e){let t=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,a=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(a),l=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),h=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),p=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("CommandBindingStyle_source")),_=p!==null?this.coerceStyleSource(p,t):void 0;return{id:t,label:r,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:h??void 0,source:_,inline:!1}}coerceVariant(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Zc.COMMAND_VARIANT_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${r}" not in whitelist [${Zc.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Zc.LABEL_CLASS_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${r}" not in whitelist [${Zc.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(Zc.STYLE_SOURCE_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle source "${r}" not in whitelist [${Zc.STYLE_SOURCE_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceBoolean(e){if(e===null)return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}capWarning(e){return e.length<=200?e:e.slice(0,197)+"..."}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let 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,ee.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 li.IRI)s=i;else if(i instanceof Ln.Literal){let h=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(h)}if(!s)return null;let a=await this.getLiteralValue(s,ee.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,ee.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,ee.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,ee.Namespace.EXOCMD.term("Precondition_hostFunction")),f=await this.tripleStore.match(s,ee.Namespace.EXOCMD.term("Precondition_query"),void 0),d;if(f.length>0){let h=f[0].object;if(h instanceof li.IRI){let p=await this.getLiteralValue(h,ee.Namespace.EXO.term("Asset_uid"));p&&(d=p)}else h instanceof Ln.Literal&&(d=this.normalizeWikilink(h.value))}return!a||!l&&!u&&!d?null:{id:a,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u},...d&&{query:d}}}async loadLinkedGrounding(e,t){if(t>=P1)return null;let r=await this.tripleStore.match(e,ee.Namespace.EXOCMD.term("Command_grounding"),void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof li.IRI)s=i;else if(i instanceof Ln.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>=P1)return null;let r=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,ee.Namespace.EXO.term("Asset_label"))??"",s=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_type"));if(!s)return null;let a=this.resolveGroundingType(s);if(!a)return null;let c=await this.getObsidianName(e,ee.Namespace.EXOCMD.term("Grounding_targetProperty"));if(a===O1.GroundingType.SERVICE_CALL){let v=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_serviceId"));v&&(c=v)}let l=await this.getObsidianWikilinkValue(e,ee.Namespace.EXOCMD.term("Grounding_targetValue")),u=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),f=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_targetClass")),d=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_targetPrototype")),h=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_targetFolder")),p=await this.getLiteralValue(e,ee.Namespace.EXOCMD.term("Grounding_inputSchema")),_;a===O1.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>=P1)return[];let r=await this.tripleStore.match(e,ee.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let a=null;if(s.object instanceof li.IRI)a=s.object;else if(s.object instanceof Ln.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(O1.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,ee.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof Ln.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 Ln.Literal||i instanceof li.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 li.IRI){let s=await this.tripleStore.match(i,ee.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof Ln.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof Ln.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 Ln.Literal?this.normalizeWikilink(i.value):i instanceof li.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 Ln.Literal?i.value:i instanceof li.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 Ln.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof li.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,ee.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===ee.Namespace.EMS.iri.value)return`ems__${s}`;if(i===ee.Namespace.EXO.iri.value)return`exo__${s}`;if(i===ee.Namespace.EXOCMD.iri.value)return`exocmd__${s}`;if(i===ee.Namespace.IMS.iri.value)return`ims__${s}`;if(i===ee.Namespace.ZTLK.iri.value)return`ztlk__${s}`;if(i===ee.Namespace.PTMS.iri.value)return`ptms__${s}`;if(i===ee.Namespace.LIT.iri.value)return`lit__${s}`;if(i===ee.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}};Bs.CommandResolver=F1;Bs.CommandResolver=F1=Xj([(0,Zj.injectable)(),Jj("design:paramtypes",[Object,Object])],F1)});var N1=S(D1=>{"use strict";Object.defineProperty(D1,"__esModule",{value:!0});D1.validateExoQLAllowlist=i5;var Ip=Uu();function i5(n){if(!n||typeof n!="object")return;let e=n;if(e.type==="update"){let t=n.updates??[];for(let r of t)if(r?.type==="load")throw new Ip.ExoQLForbiddenKeywordError("LOAD");throw new Ip.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,r=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||r)throw new Ip.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)Rp(t);if(Array.isArray(e.template))for(let t of e.template)Rp(t)}}o(i5,"validateExoQLAllowlist");function Rp(n){if(!n||typeof n!="object")return;if(n.type==="service")throw new Ip.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(n.patterns))for(let t of n.patterns)Rp(t);let e=n.where;if(Array.isArray(e))for(let t of e)Rp(t)}o(Rp,"walkPatternForBannedKeywords")});var L1=S(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.DEFAULT_EVAL_CONFIG=void 0;Op.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var M1=S(k1=>{"use strict";Object.defineProperty(k1,"__esModule",{value:!0});k1.evaluateWithExoEval=f5;var s5=Oc(),a5=Fc(),o5=Jc(),c5=N1(),l5=L1(),u5=Uu();async function f5(n,e={}){if(typeof n!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let r=new s5.ExoQLParser().parse(n);if((0,c5.validateExoQLAllowlist)(r),!{...l5.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new u5.ExoQLEvalDisabledError;let s="queryType"in r&&typeof r.queryType=="string"?r.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new a5.ExoQLAlgebraTranslator().translate(r),l=new o5.ExoQLQueryExecutor(e.store);return l.isAskQuery(c)?{kind:"ask",result:await l.executeAsk(c)}:l.isConstructQuery(c)?{kind:"construct",triples:await l.executeConstruct(c)}:{kind:"select",rows:await l.executeAll(c)}}o(f5,"evaluateWithExoEval")});var ZA=S(Vs=>{"use strict";var d5=Vs&&Vs.__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},h5=Vs&&Vs.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Wu;Object.defineProperty(Vs,"__esModule",{value:!0});Vs.PreconditionEvaluator=void 0;var p5=le(),m5=Oc(),g5=Fc(),JA=Jc(),y5=M1(),Gu=Wu=class{static{o(this,"PreconditionEvaluator")}constructor(e,t){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.query?this.evaluateQueryRef(e.query,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return!1;let i=this.substituteVariables(r,t),s=await(0,y5.evaluateWithExoEval)(i,{store:this.tripleStore});return s.kind!=="ask"?!1:s.result}catch{return!1}}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Wu.SENTINEL_IRI),i=new m5.ExoQLParser().parse(t),a=new g5.ExoQLAlgebraTranslator().translate(i);return new JA.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(Wu.SENTINEL_IRI,t));return await new JA.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()+Wu.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`,we=`${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,`"${we}"^^xsd:date`).replace(/\$today/g,`"${i}"^^xsd:date`)}};Vs.PreconditionEvaluator=Gu;Gu.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";Gu.ALMATY_OFFSET_MS=300*60*1e3;Vs.PreconditionEvaluator=Gu=Wu=d5([(0,p5.injectable)(),h5("design:paramtypes",[Object,Object])],Gu)});var Gn=S(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.FrontmatterService=void 0;var zu=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)}:.*(?:
|
|
@@ -793,7 +793,7 @@ exo__BacklinksTableBlock_columns:${f==="[]"?" []":f}
|
|
|
793
793
|
--- END PREVIEW ---
|
|
794
794
|
`)}o(nK,"printDryRunReport");function iK(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 ---
|
|
795
795
|
`),r.join(`
|
|
796
|
-
`)}o(iK,"formatSummary");function sK(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(sK,"summariseResult");function AD(n){n.addCommand(sP()),n.addCommand(lP()),n.addCommand(uP())}o(AD,"addQuerySubcommands");function xD(n){let e=new xe;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.
|
|
796
|
+
`)}o(iK,"formatSummary");function sK(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(sK,"summariseResult");function AD(n){n.addCommand(sP()),n.addCommand(lP()),n.addCommand(uP())}o(AD,"addQuerySubcommands");function xD(n){let e=new xe;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.145.0");let t=e.command("exoql").description("ExoQL query execution and cache management");AD(t);let r=e.command("sparql").description("(deprecated) Use 'exoql' instead");return AD(r),r.hook("preAction",()=>{console.error('\u26A0\uFE0F "sparql" is deprecated. Use "exoql" instead.')}),e.addCommand(_F()),e.addCommand(vF()),e.addCommand(wF()),e.addCommand(TF()),e.addCommand(AF()),e.addCommand(OF()),e.addCommand(NF()),e.addCommand(HF()),e.addCommand(KF()),e.addCommand(tD()),e.addCommand(iD()),e.addCommand(sD()),e.addCommand(oD()),e.addCommand(hD()),e.addCommand(yD()),e.addCommand(TD()),e}o(xD,"createProgram");xD().parse();0&&(module.exports={createProgram});
|
|
797
797
|
/*! Bundled license information:
|
|
798
798
|
|
|
799
799
|
reflect-metadata/Reflect.js:
|