@kanonak-protocol/sdk 5.31.0 → 5.33.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/browser.d.ts CHANGED
@@ -39,6 +39,8 @@ export type { AuthenticatedFetchFn, CredentialProvider, RequestCredential, AuthC
39
39
  export { kanonakFetch, setKanonakUserAgent, getKanonakUserAgent, KANONAK_USER_AGENT, } from './http/kanonakFetch.js';
40
40
  export { parseLockFile, serializeLockFile, computeIntegrityAsync, INTEGRITY_PREFIX, } from './lock/LockFile.js';
41
41
  export type { LockFile, LockEntry } from './lock/LockFile.js';
42
+ export { PackageBuilder, ImportBook, contentAddressedName, sanitizeName, ProducerRepository, EntitlementProducer, EntitlementDeniedError, allowAllPolicy, noopMeter, } from './producer/index.js';
43
+ export type { BuiltPackage, ImportEntry, IPackageProducer, ProduceResult, VersionRange, IEntitlementPolicy, IMeter, ProduceContext, PackageAddress, EntitlementDecision, RequestPrincipal, } from './producer/index.js';
42
44
  export type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
43
45
  export type { IKanonakParser } from '@kanonak-protocol/types/document/parsing';
44
46
  export type { KanonakDocument, KanonakMetadata, Namespace, Import, Version, DocumentReference, ParseResult, ParseError } from '@kanonak-protocol/types/document/models/types';
package/dist/browser.js CHANGED
@@ -1 +1 @@
1
- import{a as Y,b as X,c as J,d as je,e as De,f as Ve,g as Ae,i as ve,j as Ne,k as He,l as Te}from"./chunk-J4ZD6IF6.js";import{a as Le}from"./chunk-L2J7WD7E.js";import{a as m,b as c,c as u,e as d,h as R,i as y,j as f,k,l as x,m as P,n as S}from"./chunk-BZ3YTI3C.js";import{a as Q,b as Z,c as $}from"./chunk-BS7RRG7D.js";import{a as ee}from"./chunk-XK24CN3C.js";import"./chunk-SC5M74NM.js";import{A as he,B as Ie,C as Ee,M as Oe,a as oe,b as te,c as re,d as ne,g as ae,h as ie,i as se,j as pe,l as le,m as me,n as ce,o as ue,p as de,q as Re,r as ye,s as fe,t as ke,u as xe,v as Pe,w as Se,x as Ce,y as ge,z as Ke}from"./chunk-AXQ4DBJD.js";import"./chunk-KIBR3HAT.js";import{k as be}from"./chunk-Z5Y4MCW5.js";import{a as p}from"./chunk-6VIUXP4N.js";import{a as h,c as H,i as w,j as z,m as W}from"./chunk-PVUBHIU2.js";import{a as l}from"./chunk-HF5FJBS2.js";import"./chunk-PEJALHXK.js";import{a as T,b as L,da as B,fa as q,j as _,k as F,l as M,m as U,n as G}from"./chunk-7UYXTYXC.js";import{a as C,b as g,c as K,d as E,e as b,f as O,g as j,h as D,i as V,j as A,k as v,l as N}from"./chunk-CJMVIOZX.js";import{a as I}from"./chunk-FUUTGGJS.js";import"./chunk-F67UH4FD.js";import{c as e,d as o,e as t,f as r,g as n,h as a,i,k as s}from"./chunk-QILEJIFU.js";export{Pe as AmbiguousReferenceRule,V as BooleanStatement,Ve as CANONICAL_FORM_VERSION,w as Carrier,Ie as ClassDefinitionRule,ue as ClassHierarchyCycleRule,g as DefinedKanonak,X as EdgeType,h as EmbeddedKanonak,le as EmbeddedKanonakTypeRule,v as EmbeddedStatement,J as GraphBuilder,S as HttpKanonakDocumentRepository,y as INTEGRITY_PREFIX,me as ImportExistenceRule,p as InMemoryKanonakDocumentRepository,m as KANONAK_USER_AGENT,C as Kanonak,Z as KanonakDocumentPositions,W as KanonakObjectParser,Oe as KanonakObjectValidator,l as KanonakParser,I as KanonakUri,ee as KanonakUriBuilder,B as KanonakVocabulary,N as ListStatement,Ee as MarkdownLinkRule,H as MarkdownStatement,ke as NamespaceImportCycleRule,ae as NamespacePrefixRule,Y as NodeType,D as NumberStatement,ve as OAuthDiscovery,Ce as ObjectPropertyValueValidationRule,re as OntologyValidationError,oe as OntologyValidationResult,ge as PropertyDomainRule,de as PropertyHierarchyCycleRule,Ke as PropertyKindRangeConsistencyRule,Q as PropertyMetadata,Se as PropertyRangeReferenceRule,Re as PropertyRangeRequiredRule,se as PropertyTypeSpecificityRule,R as PublisherConfigResolver,P as PublisherIndex,E as ReferenceKanonak,A as ReferenceStatement,he as ReservedNameShadowRule,ie as ResourceNamingRule,T as ResourceResolver,q as ResourceTypeClassifier,F as SHACL_PACKAGE,_ as SHACL_PUBLISHER,U as SH_NODE_SHAPE,G as SH_PROPERTY_SHAPE,M as SH_SHAPE,O as ScalarStatement,b as Statement,j as StringStatement,ye as SubClassOfReferenceRule,fe as SubPropertyOfReferenceRule,K as SubjectKanonak,pe as SubjectKanonakTypeRequiredRule,Te as TokenCredentialProvider,L as TypeResolver,xe as UnresolvedPredicateRule,ce as UnresolvedReferenceRule,ne as ValidationContext,te as ValidationSeverity,be as buildOntologyModel,je as canonicalForm,De as canonicalHash,z as carrierOf,e as compareVersions,x as computeIntegrityAsync,He as createCredentialedFetch,r as createVersion,Le as findDerivation,t as formatVersion,u as getKanonakUserAgent,a as isCompatibleVersion,i as isMajorCompatible,d as kanonakFetch,Ae as normalizeHost,Ne as parseAuthChallenge,f as parseLockFile,n as parseVersionString,$ as parseWithPositions,s as pickHighestDocument,k as serializeLockFile,c as setKanonakUserAgent,o as versionsEqual};
1
+ import{a as Y,b as X,c as J,d as Te,f as Le,g as Me,h as _e,i as Fe}from"./chunk-PXS6XZ3V.js";import{a as Ue}from"./chunk-L2J7WD7E.js";import{a as De,b as Oe,c as je,d as Ve,e as Ne,f as ve,g as He,h as Be,i as Ge,j as qe,k as we,l as ze}from"./chunk-PRXC2HZ3.js";import{a as c,b as m,c as u,e as d,h as R,i as y,j as f,k,l as x,m as P,n as g}from"./chunk-BZ3YTI3C.js";import{a as Q,b as Z,c as $}from"./chunk-BS7RRG7D.js";import{a as ee}from"./chunk-XK24CN3C.js";import"./chunk-SC5M74NM.js";import{A as Ie,B as Ke,C as he,M as Ae,a as oe,b as te,c as re,d as ne,g as ae,h as ie,i as se,j as pe,l as le,m as ce,n as me,o as ue,p as de,q as Re,r as ye,s as fe,t as ke,u as xe,v as Pe,w as ge,x as Se,y as Ce,z as Ee}from"./chunk-C63WFML4.js";import"./chunk-KIBR3HAT.js";import{k as be}from"./chunk-HENE47QG.js";import"./chunk-QHABFCRC.js";import{a as p}from"./chunk-6VIUXP4N.js";import{a as I,c as H,i as w,j as z,m as W}from"./chunk-PVUBHIU2.js";import{a as l}from"./chunk-HF5FJBS2.js";import"./chunk-PEJALHXK.js";import{a as T,b as L,da as G,fa as q,j as M,k as _,l as F,m as U,n as B}from"./chunk-7UYXTYXC.js";import{a as S,b as C,c as E,d as h,e as b,f as A,g as D,h as O,i as j,j as V,k as N,l as v}from"./chunk-CJMVIOZX.js";import{a as K}from"./chunk-FUUTGGJS.js";import"./chunk-F67UH4FD.js";import{c as e,d as o,e as t,f as r,g as n,h as a,i,k as s}from"./chunk-QILEJIFU.js";export{Pe as AmbiguousReferenceRule,j as BooleanStatement,je as CANONICAL_FORM_VERSION,w as Carrier,Ke as ClassDefinitionRule,ue as ClassHierarchyCycleRule,C as DefinedKanonak,X as EdgeType,I as EmbeddedKanonak,le as EmbeddedKanonakTypeRule,N as EmbeddedStatement,we as EntitlementDeniedError,ze as EntitlementProducer,J as GraphBuilder,g as HttpKanonakDocumentRepository,y as INTEGRITY_PREFIX,ve as ImportBook,ce as ImportExistenceRule,p as InMemoryKanonakDocumentRepository,c as KANONAK_USER_AGENT,S as Kanonak,Z as KanonakDocumentPositions,W as KanonakObjectParser,Ae as KanonakObjectValidator,l as KanonakParser,K as KanonakUri,ee as KanonakUriBuilder,G as KanonakVocabulary,v as ListStatement,he as MarkdownLinkRule,H as MarkdownStatement,ke as NamespaceImportCycleRule,ae as NamespacePrefixRule,Y as NodeType,O as NumberStatement,Le as OAuthDiscovery,Se as ObjectPropertyValueValidationRule,re as OntologyValidationError,oe as OntologyValidationResult,Ve as PackageBuilder,Be as ProducerRepository,Ce as PropertyDomainRule,de as PropertyHierarchyCycleRule,Ee as PropertyKindRangeConsistencyRule,Q as PropertyMetadata,ge as PropertyRangeReferenceRule,Re as PropertyRangeRequiredRule,se as PropertyTypeSpecificityRule,R as PublisherConfigResolver,P as PublisherIndex,h as ReferenceKanonak,V as ReferenceStatement,Ie as ReservedNameShadowRule,ie as ResourceNamingRule,T as ResourceResolver,q as ResourceTypeClassifier,_ as SHACL_PACKAGE,M as SHACL_PUBLISHER,U as SH_NODE_SHAPE,B as SH_PROPERTY_SHAPE,F as SH_SHAPE,A as ScalarStatement,b as Statement,D as StringStatement,ye as SubClassOfReferenceRule,fe as SubPropertyOfReferenceRule,E as SubjectKanonak,pe as SubjectKanonakTypeRequiredRule,Fe as TokenCredentialProvider,L as TypeResolver,xe as UnresolvedPredicateRule,me as UnresolvedReferenceRule,ne as ValidationContext,te as ValidationSeverity,Ge as allowAllPolicy,be as buildOntologyModel,De as canonicalForm,Oe as canonicalHash,z as carrierOf,e as compareVersions,x as computeIntegrityAsync,Ne as contentAddressedName,_e as createCredentialedFetch,r as createVersion,Ue as findDerivation,t as formatVersion,u as getKanonakUserAgent,a as isCompatibleVersion,i as isMajorCompatible,d as kanonakFetch,qe as noopMeter,Te as normalizeHost,Me as parseAuthChallenge,f as parseLockFile,n as parseVersionString,$ as parseWithPositions,s as pickHighestDocument,He as sanitizeName,k as serializeLockFile,m as setKanonakUserAgent,o as versionsEqual};
@@ -1,4 +1,4 @@
1
- import{a as Do}from"./chunk-KIBR3HAT.js";import{c as So,e as Io,f as oo,g as to,h as $o,i as jo,j as Oo,q as no,r as wo,s as Co}from"./chunk-Z5Y4MCW5.js";import{a as S,b as go,c as Ge,d as L,h as F,k as vo,m as j}from"./chunk-PVUBHIU2.js";import{a as fo}from"./chunk-HF5FJBS2.js";import{aa as ze,b as ko,ba as Ko,fa as $,ga as T,ha as H,ia as B,ja as Y,ma as Eo,na as W,oa as Vo}from"./chunk-7UYXTYXC.js";import{A as P,B as v,C as _,c as g,d as O,j as ee,k as G,l as M,m as b,n as q,p as ho,q as Ro,r as A,t as V,u as bo,w as oe,x as Z,y as z,z as h}from"./chunk-CJMVIOZX.js";import{a as yo}from"./chunk-FUUTGGJS.js";import{b as Q,c as uo}from"./chunk-F67UH4FD.js";import{e as C}from"./chunk-QILEJIFU.js";var te=class{isValid=!1;errors=[];warnings=[];infos=[];get totalIssues(){return this.errors.length+this.warnings.length+this.infos.length}get allDiagnostics(){return[...this.errors,...this.warnings,...this.infos]}};var R=(t=>(t.Info="Info",t.Warning="Warning",t.Error="Error",t))(R||{});var u=class{ruleType="";severity="Error";lineNumber;column;entityName;propertyName;propertyPath;message="";suggestion;actualValue;expectedValue;toString(){let e="";return this.lineNumber!==void 0&&(e+=`Line ${this.lineNumber}: `),this.entityName&&(e+=`[${this.entityName}] `),e+=this.message,e}};var ro=class p{resolvedDocuments=[];currentEntityPath;withPath(e){let o=new p;return o.resolvedDocuments=this.resolvedDocuments,o.currentEntityPath=e,o}};var ne=class{constructor(e){this.underlying=e;this.repository=new ao(e)}underlying;repository;parsePromise=null;getKanonaks(){return this.parseOnce().then(e=>e.merged)}getAuthoredKanonaks(){return this.parseOnce().then(e=>e.authored)}parseOnce(){return this.parsePromise||(this.parsePromise=(async()=>{let e=await this.underlying.getAllDocumentsAsync();await Do(e,this.repository);let o={};return{merged:await new j().parseKanonaks(this.underlying,o),authored:o.authored??[]}})()),this.parsePromise}},ao=class{constructor(e){this.inner=e}inner;highestVersionCache=new Map;byNamespaceCache=new Map;getAllDocumentsAsync(){return this.inner.getAllDocumentsAsync()}getDocumentAsync(e){return this.inner.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,o){let t=`${e}/${o}`,n=this.byNamespaceCache.get(t);return n||(n=this.inner.getDocumentsByNamespaceAsync(e,o),this.byNamespaceCache.set(t,n),n)}getHighestCompatibleVersionAsync(e,o){let t=o.version,n=t?`${t.major}.${t.minor}.${t.patch}`:"",r=`${e}/${o.packageName}@${o.versionOperator}:${n}`,a=this.highestVersionCache.get(r);return a||(a=this.inner.getHighestCompatibleVersionAsync(e,o),this.highestVersionCache.set(r,a),a)}saveDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}deleteDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}clearNamespaceAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}getAllDocumentReferencesAsync(){return this.inner.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.inner.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.inner.getDocumentUriAsync(e)}};async function I(p,e,o){return o?o.getKanonaks():new j().parseKanonaks(new re(p,e))}async function w(p,e,o){let t=await I(p,e,o),n=Ze(p);return n?t.filter(r=>r instanceof g&&r.namespace===n):[]}async function ae(p,e,o){let t=Ze(p);if(!t)return[];let n;if(o)n=await o.getAuthoredKanonaks();else{let r={};await new j().parseKanonaks(new re(p,e),r),n=r.authored??[]}return n.filter(r=>r instanceof g&&r.sourceDoc===t)}function Ze(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var re=class{constructor(e,o){this.document=e;this.broader=o}document;broader;async getAllDocumentsAsync(){let e=this.document.metadata.namespace_?.toString(),o=(await this.broader.getAllDocumentsAsync()).filter(t=>t.metadata.namespace_?.toString()!==e);return[this.document,...o]}getDocumentAsync(e){return this.broader.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,o){return this.broader.getDocumentsByNamespaceAsync(e,o)}getHighestCompatibleVersionAsync(e,o){return this.broader.getHighestCompatibleVersionAsync(e,o)}getAllDocumentReferencesAsync(){return this.broader.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.broader.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.broader.getDocumentUriAsync(e)}saveDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}deleteDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}clearNamespaceAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}};var ie=class{constructor(e={}){this.options=e}options;ruleName="LinkTarget";async validateAsync(e,o,t){let n=[],r=new Map;for(let[s,l]of Object.entries(e.metadata?.imports??{}))for(let m of l)Q(m)&&r.set(`${s}/${m.packageName}`,{publisher:s,import_:m});if(r.size===0)return n;let a=new Map,i=(s,l,m)=>{let d=`${s.publisher}/${s.package_}`;if(!r.has(d))return;let f=a.get(d)??[];f.push({uri:s,where:l,predicate:m}),a.set(d,f)},c=await w(e,o,t);L(c,({kanonak:s,path:l})=>{for(let m of s.statement){let d=m.predicate?.subject?.name??"(unknown)";if(m instanceof ee)i(m.object.subject,l,d);else if(m instanceof M)for(let f of m.object)f instanceof O&&i(f.subject,l,d);else if(m instanceof Ge)for(let f of m.links)f.target&&i(f.target.subject,l,d)}});for(let[s,l]of a){let{publisher:m,import_:d}=r.get(s),f=null,y;try{f=await o.getHighestCompatibleVersionAsync(m,d)}catch(k){y=k instanceof Error?k.message:String(k)}if(!f){let k=l[0],K=`${l.length} reference${l.length===1?"":"s"}, first at '${k.where}.${k.predicate}'`;this.options.offline?n.push(this.finding("Warning",k.where,k.predicate,s,`Link target package '${s}' could not be resolved offline (${K}); the link is UNVERIFIED, not known to be broken.`,"Run without --offline to verify the link over HTTP, or add the package to the workspace or cache.")):n.push(this.finding("Error",k.where,k.predicate,s,`Link target package '${s}' could not be resolved${y?` (${y})`:""} \u2014 ${K}.`,"Check the publisher and package name of the link import; a link must dereference even though it is not a dependency. Use --offline to validate without the network (the link is then reported as unverified)."));continue}for(let{uri:k,where:K,predicate:E}of l)Object.prototype.hasOwnProperty.call(f.body,k.name)||n.push(this.finding("Error",K,E,`${s}/${k.name}`,`Link to '${k.name}' in '${E}' at '${K}' does not dereference: package '${s}' (resolved to ${f.metadata.namespace_?.toString()??s}) defines no resource named '${k.name}'.`,`Check for a typo, or a resource renamed or removed in '${s}'; a link addresses a resource by name in its package's current version unless the import is pinned with '='.`))}return n}finding(e,o,t,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=e,i.entityName=o,i.propertyName=t,i.actualValue=n,i.expectedValue="A link that dereferences to a resource its target package defines",i.message=r,i.suggestion=a,i}};var se=class p{static NAMESPACE_PREFIX_PATTERN=/^(rdfs|xsd|owl|rdf|dc|foaf|skos|dct|dcterms|geo|time|prov|schema|og|dbo):[A-Za-z_][A-Za-z0-9_.-]*$/i;ruleName="NamespacePrefix";validate(e){let o=[];for(let[t,n]of Object.entries(e.body))n&&typeof n=="object"&&!Array.isArray(n)&&this.validateEntity(t,n,o);return o}validateEntity(e,o,t){for(let[n,r]of Object.entries(o)){let a=r?.toString()??"";if(a&&p.NAMESPACE_PREFIX_PATTERN.test(a)){let i=this.getSuggestionForPrefixedValue(a),c=e.split(".")[0],s=new u;s.ruleType=this.ruleName,s.severity="Error",s.entityName=c,s.propertyName=e,s.actualValue=n,s.expectedValue=i,s.message=`Invalid namespace prefix '${a}'. Use '${i}' without prefix.`,s.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",t.push(s)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validateEntity(`${e}.${n}`,r,t)}}getSuggestionForPrefixedValue(e){let o=e.toLowerCase();if(o==="rdfs:class"||o==="owl:class")return"Class";if(o==="rdfs:property"||o==="rdf:property")return"DatatypeProperty or ObjectProperty";if(o.startsWith("xsd:"))return e.substring(4);let t=e.indexOf(":");return t>=0?e.substring(t+1):e}};var ce=class p{static RESERVED_WORDS=new Set(["imports","namespace","type","label","comment","subclassof","domain","range","required","functional"]);static VALID_PROPERTIES=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","required","functional","inverseOf","transitive","symmetric","inverseFunctional"]);static VALID_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_AUGMENTATION_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*\.[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_PROPERTY_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_.]*$/;ruleName="ResourceNaming";validate(e){let o=[],t=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[n,r]of Object.entries(e.body)){let a=p.VALID_AUGMENTATION_PATTERN.test(n);if(!a&&!t&&p.RESERVED_WORDS.has(n.toLowerCase())){let i=new u;i.ruleType=this.ruleName,i.severity="Error",i.entityName=n,i.message=`Entity name '${n}' is a reserved word and cannot be used.`,i.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",o.push(i);continue}if(!a&&!p.VALID_NAME_PATTERN.test(n)){let i;/^\d/.test(n)?i="Entity names must start with a letter, not a number.":n.includes(" ")?i="Entity names cannot contain spaces. Use camelCase or underscores instead.":i="Entity names must start with a letter and contain only letters, numbers, and underscores.";let c=new u;c.ruleType=this.ruleName,c.severity="Error",c.entityName=n,c.message=`Invalid entity name '${n}'. ${i}`,c.suggestion=i,o.push(c)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validatePropertyNames(n,r,o)}return o}validatePropertyNames(e,o,t){for(let n of Object.keys(o))if(!p.VALID_PROPERTIES.has(n)&&!p.VALID_PROPERTY_NAME_PATTERN.test(n)){let r=new u;r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e,r.propertyName=n,r.message=`Property name '${n}' in entity '${e}' doesn't follow naming conventions.`,r.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",t.push(r)}}};var pe=class p{static XSD_TYPES=new Set(["string","integer","int","long","short","byte","decimal","float","double","boolean","bool","datetime","date","time","duration","anyuri","anysimpletype","nonnegativeinteger","positiveinteger","negativeinteger","nonpositiveinteger","unsignedint","unsignedlong","unsignedshort","unsignedbyte","base64binary","hexbinary"]);ruleName="PropertyTypeSpecificity";validate(e){let o=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return o;let t=this.isPropertyDefinedAsClass(e);for(let[n,r]of Object.entries(e.body))if(r&&typeof r=="object"&&!Array.isArray(r)){let a=r,i=a.type;if(i){let c=[];if(Array.isArray(i))for(let s of i){let l=s?.toString();l&&l==="Property"&&!t&&c.push(l)}else{let s=i?.toString();s&&s==="Property"&&!t&&c.push(s)}for(let s of c){let l=this.getPropertyValue(a,"range"),m=this.determinePropertyType(l),d=new u;d.ruleType=this.ruleName,d.severity="Error",d.entityName=n,d.propertyName="type",d.actualValue=s,d.expectedValue=m,d.message=`Invalid property type '${s}'. Use '${m}' instead.`,d.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",o.push(d)}}}return o}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":p.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,o){let t=e[o];return t?t.toString():null}isPropertyDefinedAsClass(e){let o=e.body.Property;if(o&&typeof o=="object"&&!Array.isArray(o)){let n=o.type;if(n){let r=n.toString();return r==="Class"||r.endsWith(".Class")}}return!1}};var le=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(e){let o=[];for(let[t,n]of Object.entries(e.body)){if(typeof n!="object"||n===null||Array.isArray(n)||t.includes("."))continue;let r=n,a="type"in r,i=r.type?.toString().trim();if(!a||!i){let c=new u;c.ruleType=this.ruleName,c.severity="Error",c.entityName=t,c.propertyName="type",c.message=`Subject Kanonak '${t}' must have a 'type' property.`,c.suggestion=`Add a type statement like:
1
+ import{a as Do}from"./chunk-KIBR3HAT.js";import{c as So,e as Io,f as oo,g as to,h as $o,i as jo,j as Oo,q as no,r as wo,s as Co}from"./chunk-HENE47QG.js";import{a as S,b as go,c as Ge,d as L,h as W,k as vo,m as j}from"./chunk-PVUBHIU2.js";import{a as fo}from"./chunk-HF5FJBS2.js";import{aa as ze,b as ko,ba as Ko,fa as $,ga as T,ha as H,ia as B,ja as Y,ma as Eo,na as F,oa as Vo}from"./chunk-7UYXTYXC.js";import{A as P,B as v,C as _,c as g,d as O,j as ee,k as G,l as M,m as b,n as q,p as ho,q as Ro,r as A,t as V,u as bo,w as oe,x as Z,y as z,z as h}from"./chunk-CJMVIOZX.js";import{a as yo}from"./chunk-FUUTGGJS.js";import{b as Q,c as uo}from"./chunk-F67UH4FD.js";import{e as C}from"./chunk-QILEJIFU.js";var te=class{isValid=!1;errors=[];warnings=[];infos=[];get totalIssues(){return this.errors.length+this.warnings.length+this.infos.length}get allDiagnostics(){return[...this.errors,...this.warnings,...this.infos]}};var R=(t=>(t.Info="Info",t.Warning="Warning",t.Error="Error",t))(R||{});var u=class{ruleType="";severity="Error";lineNumber;column;entityName;propertyName;propertyPath;message="";suggestion;actualValue;expectedValue;toString(){let e="";return this.lineNumber!==void 0&&(e+=`Line ${this.lineNumber}: `),this.entityName&&(e+=`[${this.entityName}] `),e+=this.message,e}};var ro=class p{resolvedDocuments=[];currentEntityPath;withPath(e){let o=new p;return o.resolvedDocuments=this.resolvedDocuments,o.currentEntityPath=e,o}};var ne=class{constructor(e){this.underlying=e;this.repository=new ao(e)}underlying;repository;parsePromise=null;getKanonaks(){return this.parseOnce().then(e=>e.merged)}getAuthoredKanonaks(){return this.parseOnce().then(e=>e.authored)}parseOnce(){return this.parsePromise||(this.parsePromise=(async()=>{let e=await this.underlying.getAllDocumentsAsync();await Do(e,this.repository);let o={};return{merged:await new j().parseKanonaks(this.underlying,o),authored:o.authored??[]}})()),this.parsePromise}},ao=class{constructor(e){this.inner=e}inner;highestVersionCache=new Map;byNamespaceCache=new Map;getAllDocumentsAsync(){return this.inner.getAllDocumentsAsync()}getDocumentAsync(e){return this.inner.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,o){let t=`${e}/${o}`,n=this.byNamespaceCache.get(t);return n||(n=this.inner.getDocumentsByNamespaceAsync(e,o),this.byNamespaceCache.set(t,n),n)}getHighestCompatibleVersionAsync(e,o){let t=o.version,n=t?`${t.major}.${t.minor}.${t.patch}`:"",r=`${e}/${o.packageName}@${o.versionOperator}:${n}`,a=this.highestVersionCache.get(r);return a||(a=this.inner.getHighestCompatibleVersionAsync(e,o),this.highestVersionCache.set(r,a),a)}saveDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}deleteDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}clearNamespaceAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}getAllDocumentReferencesAsync(){return this.inner.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.inner.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.inner.getDocumentUriAsync(e)}};async function I(p,e,o){return o?o.getKanonaks():new j().parseKanonaks(new re(p,e))}async function w(p,e,o){let t=await I(p,e,o),n=Ze(p);return n?t.filter(r=>r instanceof g&&r.namespace===n):[]}async function ae(p,e,o){let t=Ze(p);if(!t)return[];let n;if(o)n=await o.getAuthoredKanonaks();else{let r={};await new j().parseKanonaks(new re(p,e),r),n=r.authored??[]}return n.filter(r=>r instanceof g&&r.sourceDoc===t)}function Ze(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var re=class{constructor(e,o){this.document=e;this.broader=o}document;broader;async getAllDocumentsAsync(){let e=this.document.metadata.namespace_?.toString(),o=(await this.broader.getAllDocumentsAsync()).filter(t=>t.metadata.namespace_?.toString()!==e);return[this.document,...o]}getDocumentAsync(e){return this.broader.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,o){return this.broader.getDocumentsByNamespaceAsync(e,o)}getHighestCompatibleVersionAsync(e,o){return this.broader.getHighestCompatibleVersionAsync(e,o)}getAllDocumentReferencesAsync(){return this.broader.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.broader.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.broader.getDocumentUriAsync(e)}saveDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}deleteDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}clearNamespaceAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}};var ie=class{constructor(e={}){this.options=e}options;ruleName="LinkTarget";async validateAsync(e,o,t){let n=[],r=new Map;for(let[s,l]of Object.entries(e.metadata?.imports??{}))for(let m of l)Q(m)&&r.set(`${s}/${m.packageName}`,{publisher:s,import_:m});if(r.size===0)return n;let a=new Map,i=(s,l,m)=>{let d=`${s.publisher}/${s.package_}`;if(!r.has(d))return;let f=a.get(d)??[];f.push({uri:s,where:l,predicate:m}),a.set(d,f)},c=await w(e,o,t);L(c,({kanonak:s,path:l})=>{for(let m of s.statement){let d=m.predicate?.subject?.name??"(unknown)";if(m instanceof ee)i(m.object.subject,l,d);else if(m instanceof M)for(let f of m.object)f instanceof O&&i(f.subject,l,d);else if(m instanceof Ge)for(let f of m.links)f.target&&i(f.target.subject,l,d)}});for(let[s,l]of a){let{publisher:m,import_:d}=r.get(s),f=null,y;try{f=await o.getHighestCompatibleVersionAsync(m,d)}catch(k){y=k instanceof Error?k.message:String(k)}if(!f){let k=l[0],K=`${l.length} reference${l.length===1?"":"s"}, first at '${k.where}.${k.predicate}'`;this.options.offline?n.push(this.finding("Warning",k.where,k.predicate,s,`Link target package '${s}' could not be resolved offline (${K}); the link is UNVERIFIED, not known to be broken.`,"Run without --offline to verify the link over HTTP, or add the package to the workspace or cache.")):n.push(this.finding("Error",k.where,k.predicate,s,`Link target package '${s}' could not be resolved${y?` (${y})`:""} \u2014 ${K}.`,"Check the publisher and package name of the link import; a link must dereference even though it is not a dependency. Use --offline to validate without the network (the link is then reported as unverified)."));continue}for(let{uri:k,where:K,predicate:E}of l)Object.prototype.hasOwnProperty.call(f.body,k.name)||n.push(this.finding("Error",K,E,`${s}/${k.name}`,`Link to '${k.name}' in '${E}' at '${K}' does not dereference: package '${s}' (resolved to ${f.metadata.namespace_?.toString()??s}) defines no resource named '${k.name}'.`,`Check for a typo, or a resource renamed or removed in '${s}'; a link addresses a resource by name in its package's current version unless the import is pinned with '='.`))}return n}finding(e,o,t,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=e,i.entityName=o,i.propertyName=t,i.actualValue=n,i.expectedValue="A link that dereferences to a resource its target package defines",i.message=r,i.suggestion=a,i}};var se=class p{static NAMESPACE_PREFIX_PATTERN=/^(rdfs|xsd|owl|rdf|dc|foaf|skos|dct|dcterms|geo|time|prov|schema|og|dbo):[A-Za-z_][A-Za-z0-9_.-]*$/i;ruleName="NamespacePrefix";validate(e){let o=[];for(let[t,n]of Object.entries(e.body))n&&typeof n=="object"&&!Array.isArray(n)&&this.validateEntity(t,n,o);return o}validateEntity(e,o,t){for(let[n,r]of Object.entries(o)){let a=r?.toString()??"";if(a&&p.NAMESPACE_PREFIX_PATTERN.test(a)){let i=this.getSuggestionForPrefixedValue(a),c=e.split(".")[0],s=new u;s.ruleType=this.ruleName,s.severity="Error",s.entityName=c,s.propertyName=e,s.actualValue=n,s.expectedValue=i,s.message=`Invalid namespace prefix '${a}'. Use '${i}' without prefix.`,s.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",t.push(s)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validateEntity(`${e}.${n}`,r,t)}}getSuggestionForPrefixedValue(e){let o=e.toLowerCase();if(o==="rdfs:class"||o==="owl:class")return"Class";if(o==="rdfs:property"||o==="rdf:property")return"DatatypeProperty or ObjectProperty";if(o.startsWith("xsd:"))return e.substring(4);let t=e.indexOf(":");return t>=0?e.substring(t+1):e}};var ce=class p{static RESERVED_WORDS=new Set(["imports","namespace","type","label","comment","subclassof","domain","range","required","functional"]);static VALID_PROPERTIES=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","required","functional","inverseOf","transitive","symmetric","inverseFunctional"]);static VALID_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_AUGMENTATION_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*\.[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_PROPERTY_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_.]*$/;ruleName="ResourceNaming";validate(e){let o=[],t=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[n,r]of Object.entries(e.body)){let a=p.VALID_AUGMENTATION_PATTERN.test(n);if(!a&&!t&&p.RESERVED_WORDS.has(n.toLowerCase())){let i=new u;i.ruleType=this.ruleName,i.severity="Error",i.entityName=n,i.message=`Entity name '${n}' is a reserved word and cannot be used.`,i.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",o.push(i);continue}if(!a&&!p.VALID_NAME_PATTERN.test(n)){let i;/^\d/.test(n)?i="Entity names must start with a letter, not a number.":n.includes(" ")?i="Entity names cannot contain spaces. Use camelCase or underscores instead.":i="Entity names must start with a letter and contain only letters, numbers, and underscores.";let c=new u;c.ruleType=this.ruleName,c.severity="Error",c.entityName=n,c.message=`Invalid entity name '${n}'. ${i}`,c.suggestion=i,o.push(c)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validatePropertyNames(n,r,o)}return o}validatePropertyNames(e,o,t){for(let n of Object.keys(o))if(!p.VALID_PROPERTIES.has(n)&&!p.VALID_PROPERTY_NAME_PATTERN.test(n)){let r=new u;r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e,r.propertyName=n,r.message=`Property name '${n}' in entity '${e}' doesn't follow naming conventions.`,r.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",t.push(r)}}};var pe=class p{static XSD_TYPES=new Set(["string","integer","int","long","short","byte","decimal","float","double","boolean","bool","datetime","date","time","duration","anyuri","anysimpletype","nonnegativeinteger","positiveinteger","negativeinteger","nonpositiveinteger","unsignedint","unsignedlong","unsignedshort","unsignedbyte","base64binary","hexbinary"]);ruleName="PropertyTypeSpecificity";validate(e){let o=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return o;let t=this.isPropertyDefinedAsClass(e);for(let[n,r]of Object.entries(e.body))if(r&&typeof r=="object"&&!Array.isArray(r)){let a=r,i=a.type;if(i){let c=[];if(Array.isArray(i))for(let s of i){let l=s?.toString();l&&l==="Property"&&!t&&c.push(l)}else{let s=i?.toString();s&&s==="Property"&&!t&&c.push(s)}for(let s of c){let l=this.getPropertyValue(a,"range"),m=this.determinePropertyType(l),d=new u;d.ruleType=this.ruleName,d.severity="Error",d.entityName=n,d.propertyName="type",d.actualValue=s,d.expectedValue=m,d.message=`Invalid property type '${s}'. Use '${m}' instead.`,d.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",o.push(d)}}}return o}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":p.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,o){let t=e[o];return t?t.toString():null}isPropertyDefinedAsClass(e){let o=e.body.Property;if(o&&typeof o=="object"&&!Array.isArray(o)){let n=o.type;if(n){let r=n.toString();return r==="Class"||r.endsWith(".Class")}}return!1}};var le=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(e){let o=[];for(let[t,n]of Object.entries(e.body)){if(typeof n!="object"||n===null||Array.isArray(n)||t.includes("."))continue;let r=n,a="type"in r,i=r.type?.toString().trim();if(!a||!i){let c=new u;c.ruleType=this.ruleName,c.severity="Error",c.entityName=t,c.propertyName="type",c.message=`Subject Kanonak '${t}' must have a 'type' property.`,c.suggestion=`Add a type statement like:
2
2
  type: Scene
3
3
 
4
4
  Only embedded objects can infer type from their parent property's range. Subject Kanonaks (top-level entities) must explicitly declare their type.`,c.expectedValue="A valid class name (Scene, Character, Story, etc.)",o.push(c)}}return o}};var ot=new Set(["EphemeralPackage"]),me=class{get ruleName(){return"PackageHeader"}validate(e){let o=e.metadata;if(!o.type_)return[];let t=[],n=this.packageKey(e,o.type_);return o.namespace_?(!ot.has(o.type_)&&!o.namespace_.version&&t.push(this.error(n,"version",`Package resource '${n}' requires a 'version' property \u2014 packages are addressed by name@version.`,`Add a version, e.g.:
@@ -31,27 +31,27 @@ long reference across two lines in a block scalar, e.g.:
31
31
  ... read for [[persistent-energy-
32
32
  shock]] held ...
33
33
  which is parsed as literal text, not a link. Keep each [[reference]] on one
34
- line (let the line run long), or check for an unterminated [[.`,n}};var Wo="kanonak.org",Fo="look",Ot={publisher:Wo,package_:Fo,name:"displayLabel"},wt={publisher:Wo,package_:Fo,name:"displaySummary"},we=class{ruleName="DisplayLensScope";async validateAsync(e,o,t){let n=[],r;t?r=await t.getKanonaks():r=await new j().parseKanonaks(new _(e,o));let a=Ct(e);if(!a)return n;for(let i of r)i instanceof g&&i.namespace===a&&(this.checkLens(r,i,Ot,"displayLabel",n),this.checkLens(r,i,wt,"displaySummary",n));return n}checkLens(e,o,t,n,r){let a=h(o,t);if(!a)return;let i=[],c=T(o);if(c&&i.push(c),i.push(...Vo(o)),i.length===0)return;i.some(l=>W(e,l,a).ok)||r.push(this.scopeError(o.name,n,a.name))}scopeError(e,o,t){let n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName=o,n.actualValue=t,n.message=`${o} points at '${t}', which is not a property in scope for '${e}'`,n.expectedValue="A property whose domain is this resource's class, an ancestor, or rdfs.Resource",n.suggestion=`'${t}' resolves, but its domain does not cover '${e}', so the lens would silently fall back to the resource's name at render time.
34
+ line (let the line run long), or check for an unterminated [[.`,n}};var Fo="kanonak.org",Wo="look",Ot={publisher:Fo,package_:Wo,name:"displayLabel"},wt={publisher:Fo,package_:Wo,name:"displaySummary"},we=class{ruleName="DisplayLensScope";async validateAsync(e,o,t){let n=[],r;t?r=await t.getKanonaks():r=await new j().parseKanonaks(new _(e,o));let a=Ct(e);if(!a)return n;for(let i of r)i instanceof g&&i.namespace===a&&(this.checkLens(r,i,Ot,"displayLabel",n),this.checkLens(r,i,wt,"displaySummary",n));return n}checkLens(e,o,t,n,r){let a=h(o,t);if(!a)return;let i=[],c=T(o);if(c&&i.push(c),i.push(...Vo(o)),i.length===0)return;i.some(l=>F(e,l,a).ok)||r.push(this.scopeError(o.name,n,a.name))}scopeError(e,o,t){let n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName=o,n.actualValue=t,n.message=`${o} points at '${t}', which is not a property in scope for '${e}'`,n.expectedValue="A property whose domain is this resource's class, an ancestor, or rdfs.Resource",n.suggestion=`'${t}' resolves, but its domain does not cover '${e}', so the lens would silently fall back to the resource's name at render time.
35
35
 
36
36
  Possible solutions:
37
37
  \u2022 Point ${o} at a property declared on this class (or an ancestor / rdfs.Resource)
38
38
  \u2022 Set the property's domain to this class if it should apply here
39
- \u2022 Use rdfs.label / rdfs.comment for the universal default`,n}};function Ct(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}function X(p,e,o){let t=[];return We(p,o,{input:e},t),t}function We(p,e,o,t){if(A(e,F.VarRef)){let a=z(e,F.varName);return a?o[a]:void 0}if(A(e,F.PropertyRead)){let a=P(e,F.readSource),i=a?We(p,a,o,t):void 0,c=h(e,F.readProp);if(!i||!c)return;let s=W(p,i,c);if(!s.ok){t.push({contextClass:i,propertyUri:c,via:"PropertyRead"});return}return s.descriptor?.range}if(A(e,F.Traverse)){let a=P(e,F.traverseSource),i=a?We(p,a,o,t):void 0,c=h(e,F.through),s;if(i&&c){let m=W(p,i,c);m.ok?s=m.descriptor?.range:t.push({contextClass:i,propertyUri:c,via:"Traverse"})}let l=P(e,F.step);return l?We(p,l,{...o,input:s},t):void 0}let n=z(e,F.loopVar),r=n?{...o,[n]:void 0}:o;for(let a of Pt(e))We(p,a,r,t)}function Pt(p){let e=[];for(let o of p.statement){let t=o.object;if(t instanceof S)e.push(t);else if(Array.isArray(t))for(let n of t)n instanceof S&&e.push(n)}return e}var Fe="kanonak.org",qe="look",Ut={publisher:Fe,package_:qe,name:"semanticSvg"},At={publisher:Fe,package_:qe,name:"tierChip"},Nt={publisher:Fe,package_:qe,name:"tierIcon"},Tt={publisher:Fe,package_:qe,name:"tierCard"},xt={publisher:Fe,package_:qe,name:"tierFull"},_t=[At,Nt,Tt,xt],Ce=class{ruleName="LookSemanticSvgPath";async validateAsync(e,o,t){let n=[],r;t?r=await t.getKanonaks():r=await new j().parseKanonaks(new _(e,o));let a=Lt(e);if(!a)return n;for(let i of r)i instanceof g&&i.namespace===a&&this.checkSemanticSvg(r,i,n);return n}checkSemanticSvg(e,o,t){let n=P(o,Ut);if(!n)return;let r=T(o);if(r)for(let a of _t){let i=P(n,a);if(i)for(let c of X(e,r,i))t.push(this.toError(o.name,a.name,c))}}toError(e,o,t){let n=`${t.propertyUri.publisher}/${t.propertyUri.package_}/${t.propertyUri.name}`,r=t.contextClass.name,a=r===e?`'${e}' (the class this SemanticSvg is declared on)`:`'${r}', reached by traversal from '${e}' (the class this SemanticSvg is declared on)`,i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=`look.semanticSvg.${o}`,i.actualValue=n,i.message=`tx.${t.via} reads property '${t.propertyUri.name}' off the rendered instance, but its domain is not in scope for ${a}. The read would silently return undefined at render time.`,i.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,i.suggestion=`Property '${n}' is not in scope for '${r}'.
39
+ \u2022 Use rdfs.label / rdfs.comment for the universal default`,n}};function Ct(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}function X(p,e,o){let t=[];return Fe(p,o,{input:e},t),t}function Fe(p,e,o,t){if(A(e,W.VarRef)){let a=z(e,W.varName);return a?o[a]:void 0}if(A(e,W.PropertyRead)){let a=P(e,W.readSource),i=a?Fe(p,a,o,t):void 0,c=h(e,W.readProp);if(!i||!c)return;let s=F(p,i,c);if(!s.ok){t.push({contextClass:i,propertyUri:c,via:"PropertyRead"});return}return s.descriptor?.range}if(A(e,W.Traverse)){let a=P(e,W.traverseSource),i=a?Fe(p,a,o,t):void 0,c=h(e,W.through),s;if(i&&c){let m=F(p,i,c);m.ok?s=m.descriptor?.range:t.push({contextClass:i,propertyUri:c,via:"Traverse"})}let l=P(e,W.step);return l?Fe(p,l,{...o,input:s},t):void 0}let n=z(e,W.loopVar),r=n?{...o,[n]:void 0}:o;for(let a of Pt(e))Fe(p,a,r,t)}function Pt(p){let e=[];for(let o of p.statement){let t=o.object;if(t instanceof S)e.push(t);else if(Array.isArray(t))for(let n of t)n instanceof S&&e.push(n)}return e}var We="kanonak.org",qe="look",Ut={publisher:We,package_:qe,name:"semanticSvg"},At={publisher:We,package_:qe,name:"tierChip"},Nt={publisher:We,package_:qe,name:"tierIcon"},Tt={publisher:We,package_:qe,name:"tierCard"},xt={publisher:We,package_:qe,name:"tierFull"},_t=[At,Nt,Tt,xt],Ce=class{ruleName="LookSemanticSvgPath";async validateAsync(e,o,t){let n=[],r;t?r=await t.getKanonaks():r=await new j().parseKanonaks(new _(e,o));let a=Lt(e);if(!a)return n;for(let i of r)i instanceof g&&i.namespace===a&&this.checkSemanticSvg(r,i,n);return n}checkSemanticSvg(e,o,t){let n=P(o,Ut);if(!n)return;let r=T(o);if(r)for(let a of _t){let i=P(n,a);if(i)for(let c of X(e,r,i))t.push(this.toError(o.name,a.name,c))}}toError(e,o,t){let n=`${t.propertyUri.publisher}/${t.propertyUri.package_}/${t.propertyUri.name}`,r=t.contextClass.name,a=r===e?`'${e}' (the class this SemanticSvg is declared on)`:`'${r}', reached by traversal from '${e}' (the class this SemanticSvg is declared on)`,i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=`look.semanticSvg.${o}`,i.actualValue=n,i.message=`tx.${t.via} reads property '${t.propertyUri.name}' off the rendered instance, but its domain is not in scope for ${a}. The read would silently return undefined at render time.`,i.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,i.suggestion=`Property '${n}' is not in scope for '${r}'.
40
40
 
41
41
  Possible solutions:
42
42
  \u2022 Read a property declared on '${r}' (or an ancestor / rdfs.Resource)
43
43
  \u2022 If the property should apply to '${r}', adjust its domain
44
- \u2022 If the value comes from a pre-computed env binding, use tx.VarRef instead of PropertyRead`,i}};function Lt(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var qo={publisher:"kanonak.org",package_:"transformations",name:"Expression"},Mt=new Map([["look","the look renderer"],["view","the view materializer"],["transformations","the transformation runner"]]);function Bt(p){if(!(!p||p.publisher!=="kanonak.org"))return Mt.get(p.package_)}var Pe=class{ruleName="TxExpressionCompiles";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(new _(e,o)),a=Ft(e);if(!a)return n;let i=r.filter(y=>y instanceof g&&y.namespace===a);if(i.length===0)return n;let c=new Map,s=y=>{for(let k of ho(y)){let K=b(k),E=c.get(K);if(E===void 0&&(E=q(k,qo)||H(r,k).some(U=>q(U,qo)),c.set(K,E)),E)return!0}return!1},l=[],m=new Map,d=new Set;for(let y of i)L([y],({kanonak:k,path:K})=>{let E=k instanceof S&&s(k);E&&l.push({node:k,path:K,subject:y.name});for(let{child:U,predicate:N}of Wt(k))s(U)&&(N&&m.set(U,N),E&&d.add(U))});let f=new Set;for(let{node:y,path:k,subject:K}of l){if(d.has(y))continue;let E=Bt(m.get(y));if(E)try{So(y,k,{catalog:r,depth:0})}catch(U){let N=U instanceof Error?U.message:String(U),eo=`${K} ${k} ${N}`;if(f.has(eo))continue;f.add(eo),n.push(this.toError(K,k,N,E))}}return n}toError(e,o,t,n){let r=new u;r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName=o,r.actualValue=t;let a=/[.!?]$/.test(t)?t:`${t}.`;return r.message=`A tx.Expression at '${o}' is in a slot ${n} evaluates, but it cannot be compiled: ${a} The value would be silently absent wherever this slot is used.`,r.expectedValue=`A tx.Expression built from node classes ${n} implements`,r.suggestion=`This slot is evaluated by ${n}, which is part of this SDK, so its node classes are the ones available here. (An Expression subclass meant for a DIFFERENT runner is fine in that runner's own slots \u2014 this rule does not look at those.)
44
+ \u2022 If the value comes from a pre-computed env binding, use tx.VarRef instead of PropertyRead`,i}};function Lt(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var qo={publisher:"kanonak.org",package_:"transformations",name:"Expression"},Mt=new Map([["look","the look renderer"],["view","the view materializer"],["transformations","the transformation runner"]]);function Bt(p){if(!(!p||p.publisher!=="kanonak.org"))return Mt.get(p.package_)}var Pe=class{ruleName="TxExpressionCompiles";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(new _(e,o)),a=Wt(e);if(!a)return n;let i=r.filter(y=>y instanceof g&&y.namespace===a);if(i.length===0)return n;let c=new Map,s=y=>{for(let k of ho(y)){let K=b(k),E=c.get(K);if(E===void 0&&(E=q(k,qo)||H(r,k).some(U=>q(U,qo)),c.set(K,E)),E)return!0}return!1},l=[],m=new Map,d=new Set;for(let y of i)L([y],({kanonak:k,path:K})=>{let E=k instanceof S&&s(k);E&&l.push({node:k,path:K,subject:y.name});for(let{child:U,predicate:N}of Ft(k))s(U)&&(N&&m.set(U,N),E&&d.add(U))});let f=new Set;for(let{node:y,path:k,subject:K}of l){if(d.has(y))continue;let E=Bt(m.get(y));if(E)try{So(y,k,{catalog:r,depth:0})}catch(U){let N=U instanceof Error?U.message:String(U),eo=`${K} ${k} ${N}`;if(f.has(eo))continue;f.add(eo),n.push(this.toError(K,k,N,E))}}return n}toError(e,o,t,n){let r=new u;r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName=o,r.actualValue=t;let a=/[.!?]$/.test(t)?t:`${t}.`;return r.message=`A tx.Expression at '${o}' is in a slot ${n} evaluates, but it cannot be compiled: ${a} The value would be silently absent wherever this slot is used.`,r.expectedValue=`A tx.Expression built from node classes ${n} implements`,r.suggestion=`This slot is evaluated by ${n}, which is part of this SDK, so its node classes are the ones available here. (An Expression subclass meant for a DIFFERENT runner is fine in that runner's own slots \u2014 this rule does not look at those.)
45
45
 
46
46
  Possible solutions:
47
47
  \u2022 Rebuild the expression from tx primitives this SDK supports
48
48
  \u2022 For numeric presentation (rounding, percentages, fixed precision), use tx.NumberFormat \u2014 it scales internally, so no arithmetic is needed
49
- \u2022 If the node class should be supported, implement it in the runner first`,r}};function Wt(p){let e=[];for(let o of p.statement){let t=o.predicate?.subject;if(o instanceof G)e.push({child:o.object,predicate:t});else if(o instanceof M)for(let n of o.object)n instanceof S&&e.push({child:n,predicate:t})}return e}function Ft(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var qt="kanonak.org",He=(p,e)=>({publisher:qt,package_:p,name:e}),Ht=He("derivation","look"),Ho=He("look","bands"),Yo=He("look","Sequence"),Yt=He("core-rdf","range"),Gt=He("look","nodeTier"),Ue=class{ruleName="SequenceNarrative";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(new _(e,o)),a=zt(e);if(!a)return n;let i=r.filter(s=>s instanceof g&&s.namespace===a);if(i.length===0)return n;for(let s of i){let l=P(s,Ht);l&&v(l,Ho).forEach((m,d)=>{!(m instanceof S)||!A(m,Yo)||n.push(...this.checkBand(r,s,m,`${s.name}.look.bands[${d}]`))})}let c=new wo(r);for(let s of i){let l=c.findCascadedLook(s);if(l)for(let m of v(l.declaration,Ho))!(m instanceof S)||!A(m,Yo)||this.checkBand(r,s,m,"").length>0||n.push(...this.checkInstance(r,s,m,$o(r,s,m)))}return n}checkBand(e,o,t,n){let r=[],a=(l,m,d)=>r.push(this.toError("Error",o.name,n,l,m,d)),i=oo(t);if(!i)a("A look.Sequence band declares no look.source. The order of a sequence comes from the [[references]] in a prose property, so without one nothing can be sequenced.","Set look.source to a property of this class whose rdfs.range is prose.Markdown (or prose.SubstitutableString), and render the same property with a look.Markdown band so the narrative and the diagram cannot drift.");else{let l=bo(e,i)[0],m=l?Ro(l,Yt):[];l&&!m.some(d=>ko.isSubstitutableDatatypeUri(d))&&a(`look.source names '${i.name}', whose rdfs.range is ${m.map(d=>b(d)).join(", ")||"undeclared"} \u2014 not prose.Markdown. A Sequence orders its participants by the [[references]] in prose, so a value of this property carries no order.`,"Point look.source at a prose.Markdown-ranged property, or give this property that range if its values are narrative.",b(i))}let c=to(e,t);c.length===0&&a("A look.Sequence band declares no look.connectors, so no property counts as a message and every narrative renders empty.","List the object properties that constitute messages: look.connectors: [{ look.relation: calls }, ...]. The domain ontology declares nothing about sequences; the look layer says which of its relations are interactions.");for(let l of c)(!l.subject||B(e,l.subject)===void 0)&&a(`look.connectors names '${l.relation.name}' as a relation, but it is not a property${l.subject?"":" in the closure"}. A message is a triple, so its relation must be an object property whose values are the participants.`,"Use an owl.ObjectProperty (or a subclass such as owl.SymmetricProperty) for look.relation.",b(l.relation)),l.invalidStyle!==void 0&&a(`look.lineStyle '${l.invalidStyle}' on connector '${l.relation.name}' is not a supported value. Supported: ${[...Io].join(", ")}.`,"Use one of the supported values, or omit look.lineStyle: a reply is derived from owl.inverseOf and an undirected edge from owl.SymmetricProperty, so the overlay is only needed for what the ontology cannot say.",l.invalidStyle);let s=z(t,Gt);return s!==void 0&&no[s]===void 0&&a(`look.nodeTier '${s}' is not a tier. Supported: ${Object.keys(no).join(", ")}.`,"Use one of the semantic-zoom tiers \u2014 chip (56), icon (120, the default), card (240), full (420) \u2014 or omit look.nodeTier to take the participants' class-level look.diagramTier.",s),r}checkInstance(e,o,t,n){let r=[],a=oo(t),i=`${o.name}.${a.name}`,c=to(e,t).map(s=>s.relation.name).join(", ");if(n.problem)return r.push(this.toError("Error",o.name,i,`The look.Sequence band cannot walk this instance: ${n.problem}.`,"Check the value authored for the source property.")),r;if(n.sourceAbsent)return r.push(this.toError("Warning",o.name,i,`'${o.name}' carries no value for '${a.name}', so its look.Sequence band renders nothing.`,`Author the narrative in '${a.name}' with [[references]] to the participants, or leave it if the band is meant to be empty here.`)),r;for(let s of n.strayPropertyRefs)r.push(this.toError("Error",o.name,i,`The narrative references property '${s.name}', which is not a declared connector of the look.Sequence band (declared: ${c}). A property reference between two participants selects the edge for that pair; one the band does not declare selects nothing, and the sentence draws no message.`,`Add { look.relation: ${s.name} } to look.connectors on the band, or reference one of the declared connectors instead.`,b(s)));if(n.mentions>=2&&n.messages.length===0)return r.push(this.toError("Error",o.name,i,`The narrative mentions ${n.mentions} participant references but joins nothing: no declared connector (${c}) holds between any consecutive pair, so the look.Sequence band renders no message.`,"Either the graph is missing the triples the prose describes (declare them on the participants), the band is missing the relation the prose relies on (add it to look.connectors), or the prose orders participants no relation joins (reorder it).")),r;for(let s of n.gaps){let l=s.selected?`'${s.selected.name}' does not hold`:`no declared connector (${c}) holds`;r.push(this.toError("Warning",o.name,i,`The narrative orders '${s.prev.name}' then '${s.next.name}', but ${l} between them in the graph, so no message is drawn for that pair.`,`If the prose is right, declare the relation on '${s.prev.name}' or '${s.next.name}' (or add it to look.connectors); if the graph is right, reorder the prose so consecutive references are joined. A mention that is meant to connect to nothing is fine \u2014 it simply gets no lifeline.`,`${s.prev.name} \u2192 ${s.next.name}`))}return r}toError(e,o,t,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=e,i.entityName=o,i.propertyName=t,i.message=n,i.suggestion=r,a!==void 0&&(i.actualValue=a),i}};function zt(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var Zt="kanonak.org",D=(p,e)=>({publisher:Zt,package_:p,name:e}),Xt=D("derivation","look"),Jt=D("look","bands"),Qt=D("look","Distribution"),en=D("look","StatRow"),on=D("look","VersionDelta"),tn=D("look","Timeline"),nn=D("look","VersionDiff"),rn=D("look","TimePlot"),an=D("look","ReferenceList"),sn=D("look","Diagram"),cn=D("look","alphaPath"),pn=D("look","betaPath"),po=D("look","metricPath"),Go=D("look","lowerPath"),zo=D("look","upperPath"),Zo=D("look","hueBy"),ln=D("look","statPath"),mn=D("look","laneBy"),Xo=D("look","labelPath"),un=D("look","badgePath"),dn=D("look","mapPath"),fn=D("look","nodeNote"),yn=D("look","edgeValue"),gn=D("look","stats"),kn=D("look","facets"),hn=D("look","channels"),Rn=D("look","track"),bn=D("look","source"),Kn=D("look","relation"),En=D("look","entries"),Ae=class{ruleName="LookBandPath";async validateAsync(e,o,t){let n=[],r;t?r=await t.getKanonaks():r=await new j().parseKanonaks(new _(e,o));let a=vn(e);if(!a)return n;for(let i of r)i instanceof g&&i.namespace===a&&this.checkDeclaration(r,i,n);return n}checkDeclaration(e,o,t){let n=P(o,Xt);if(!n)return;let r=T(o);if(!r)return;let a=v(n,Jt).filter(i=>i instanceof S);for(let i of a)for(let c of this.carriersOf(e,i,r))for(let s of X(e,c.context,c.expr))t.push(this.toError(o.name,c.slot,s))}carriersOf(e,o,t){let n=[],r=(a,i)=>{let c=P(o,a);c&&n.push({slot:`look.${a.name}`,context:i,expr:c})};if(A(o,Qt))for(let a of[cn,pn,po,Go,zo,Zo])r(a,t);if(A(o,on)&&r(po,t),A(o,en)){let a=v(o,gn).filter(i=>i instanceof S);for(let i of a){let c=P(i,ln);c&&n.push({slot:"look.stats[].statPath",context:t,expr:c})}}if(A(o,tn)||A(o,nn)){let a=this.rangeOf(e,t,h(o,Rn));if(a)for(let i of[po,Go,zo,Zo])r(i,a)}if(A(o,rn)){let a=this.rangeOf(e,t,h(o,bn));if(a)for(let i of[mn,Xo])r(i,a)}if(A(o,an))for(let a of v(o,En)){let i=a instanceof S?void 0:Vn(a),c=this.rangeOf(e,t,i);if(c)for(let s of[Xo,un])r(s,c)}if(A(o,sn)){let a=v(o,kn).filter(i=>i instanceof S);for(let i of a){let c=this.rangeOf(e,t,h(i,Kn));if(!c)continue;let s=P(i,fn);s&&n.push({slot:"look.facets[].nodeNote",context:c,expr:s});let l=P(i,yn);l&&n.push({slot:"look.facets[].edgeValue",context:c,expr:l});let m=v(i,hn).filter(d=>d instanceof S);for(let d of m){let f=P(d,dn);f&&n.push({slot:"look.facets[].channels[].mapPath",context:c,expr:f})}}}return n}rangeOf(e,o,t){if(!t)return;let n=W(e,o,t);return n.ok?n.descriptor?.range:void 0}toError(e,o,t){let n=`${t.propertyUri.publisher}/${t.propertyUri.package_}/${t.propertyUri.name}`,r=t.contextClass.name,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=o,a.actualValue=n,a.message=`tx.${t.via} reads property '${t.propertyUri.name}', but its domain is not in scope for '${r}' (the class this band carrier is evaluated against). The read would silently return undefined at render time and the band would render empty.`,a.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${n}' is not in scope for '${r}'.
49
+ \u2022 If the node class should be supported, implement it in the runner first`,r}};function Ft(p){let e=[];for(let o of p.statement){let t=o.predicate?.subject;if(o instanceof G)e.push({child:o.object,predicate:t});else if(o instanceof M)for(let n of o.object)n instanceof S&&e.push({child:n,predicate:t})}return e}function Wt(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var qt="kanonak.org",He=(p,e)=>({publisher:qt,package_:p,name:e}),Ht=He("derivation","look"),Ho=He("look","bands"),Yo=He("look","Sequence"),Yt=He("core-rdf","range"),Gt=He("look","nodeTier"),Ue=class{ruleName="SequenceNarrative";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(new _(e,o)),a=zt(e);if(!a)return n;let i=r.filter(s=>s instanceof g&&s.namespace===a);if(i.length===0)return n;for(let s of i){let l=P(s,Ht);l&&v(l,Ho).forEach((m,d)=>{!(m instanceof S)||!A(m,Yo)||n.push(...this.checkBand(r,s,m,`${s.name}.look.bands[${d}]`))})}let c=new wo(r);for(let s of i){let l=c.findCascadedLook(s);if(l)for(let m of v(l.declaration,Ho))!(m instanceof S)||!A(m,Yo)||this.checkBand(r,s,m,"").length>0||n.push(...this.checkInstance(r,s,m,$o(r,s,m)))}return n}checkBand(e,o,t,n){let r=[],a=(l,m,d)=>r.push(this.toError("Error",o.name,n,l,m,d)),i=oo(t);if(!i)a("A look.Sequence band declares no look.source. The order of a sequence comes from the [[references]] in a prose property, so without one nothing can be sequenced.","Set look.source to a property of this class whose rdfs.range is prose.Markdown (or prose.SubstitutableString), and render the same property with a look.Markdown band so the narrative and the diagram cannot drift.");else{let l=bo(e,i)[0],m=l?Ro(l,Yt):[];l&&!m.some(d=>ko.isSubstitutableDatatypeUri(d))&&a(`look.source names '${i.name}', whose rdfs.range is ${m.map(d=>b(d)).join(", ")||"undeclared"} \u2014 not prose.Markdown. A Sequence orders its participants by the [[references]] in prose, so a value of this property carries no order.`,"Point look.source at a prose.Markdown-ranged property, or give this property that range if its values are narrative.",b(i))}let c=to(e,t);c.length===0&&a("A look.Sequence band declares no look.connectors, so no property counts as a message and every narrative renders empty.","List the object properties that constitute messages: look.connectors: [{ look.relation: calls }, ...]. The domain ontology declares nothing about sequences; the look layer says which of its relations are interactions.");for(let l of c)(!l.subject||B(e,l.subject)===void 0)&&a(`look.connectors names '${l.relation.name}' as a relation, but it is not a property${l.subject?"":" in the closure"}. A message is a triple, so its relation must be an object property whose values are the participants.`,"Use an owl.ObjectProperty (or a subclass such as owl.SymmetricProperty) for look.relation.",b(l.relation)),l.invalidStyle!==void 0&&a(`look.lineStyle '${l.invalidStyle}' on connector '${l.relation.name}' is not a supported value. Supported: ${[...Io].join(", ")}.`,"Use one of the supported values, or omit look.lineStyle: a reply is derived from owl.inverseOf and an undirected edge from owl.SymmetricProperty, so the overlay is only needed for what the ontology cannot say.",l.invalidStyle);let s=z(t,Gt);return s!==void 0&&no[s]===void 0&&a(`look.nodeTier '${s}' is not a tier. Supported: ${Object.keys(no).join(", ")}.`,"Use one of the semantic-zoom tiers \u2014 chip (56), icon (120, the default), card (240), full (420) \u2014 or omit look.nodeTier to take the participants' class-level look.diagramTier.",s),r}checkInstance(e,o,t,n){let r=[],a=oo(t),i=`${o.name}.${a.name}`,c=to(e,t).map(s=>s.relation.name).join(", ");if(n.problem)return r.push(this.toError("Error",o.name,i,`The look.Sequence band cannot walk this instance: ${n.problem}.`,"Check the value authored for the source property.")),r;if(n.sourceAbsent)return r.push(this.toError("Warning",o.name,i,`'${o.name}' carries no value for '${a.name}', so its look.Sequence band renders nothing.`,`Author the narrative in '${a.name}' with [[references]] to the participants, or leave it if the band is meant to be empty here.`)),r;for(let s of n.strayPropertyRefs)r.push(this.toError("Error",o.name,i,`The narrative references property '${s.name}', which is not a declared connector of the look.Sequence band (declared: ${c}). A property reference between two participants selects the edge for that pair; one the band does not declare selects nothing, and the sentence draws no message.`,`Add { look.relation: ${s.name} } to look.connectors on the band, or reference one of the declared connectors instead.`,b(s)));if(n.mentions>=2&&n.messages.length===0)return r.push(this.toError("Error",o.name,i,`The narrative mentions ${n.mentions} participant references but joins nothing: no declared connector (${c}) holds between any consecutive pair, so the look.Sequence band renders no message.`,"Either the graph is missing the triples the prose describes (declare them on the participants), the band is missing the relation the prose relies on (add it to look.connectors), or the prose orders participants no relation joins (reorder it).")),r;for(let s of n.gaps){let l=s.selected?`'${s.selected.name}' does not hold`:`no declared connector (${c}) holds`;r.push(this.toError("Warning",o.name,i,`The narrative orders '${s.prev.name}' then '${s.next.name}', but ${l} between them in the graph, so no message is drawn for that pair.`,`If the prose is right, declare the relation on '${s.prev.name}' or '${s.next.name}' (or add it to look.connectors); if the graph is right, reorder the prose so consecutive references are joined. A mention that is meant to connect to nothing is fine \u2014 it simply gets no lifeline.`,`${s.prev.name} \u2192 ${s.next.name}`))}return r}toError(e,o,t,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=e,i.entityName=o,i.propertyName=t,i.message=n,i.suggestion=r,a!==void 0&&(i.actualValue=a),i}};function zt(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var Zt="kanonak.org",D=(p,e)=>({publisher:Zt,package_:p,name:e}),Xt=D("derivation","look"),Jt=D("look","bands"),Qt=D("look","Distribution"),en=D("look","StatRow"),on=D("look","VersionDelta"),tn=D("look","Timeline"),nn=D("look","VersionDiff"),rn=D("look","TimePlot"),an=D("look","ReferenceList"),sn=D("look","Diagram"),cn=D("look","alphaPath"),pn=D("look","betaPath"),po=D("look","metricPath"),Go=D("look","lowerPath"),zo=D("look","upperPath"),Zo=D("look","hueBy"),ln=D("look","statPath"),mn=D("look","laneBy"),Xo=D("look","labelPath"),un=D("look","badgePath"),dn=D("look","mapPath"),fn=D("look","nodeNote"),yn=D("look","edgeValue"),gn=D("look","stats"),kn=D("look","facets"),hn=D("look","channels"),Rn=D("look","track"),bn=D("look","source"),Kn=D("look","relation"),En=D("look","entries"),Ae=class{ruleName="LookBandPath";async validateAsync(e,o,t){let n=[],r;t?r=await t.getKanonaks():r=await new j().parseKanonaks(new _(e,o));let a=vn(e);if(!a)return n;for(let i of r)i instanceof g&&i.namespace===a&&this.checkDeclaration(r,i,n);return n}checkDeclaration(e,o,t){let n=P(o,Xt);if(!n)return;let r=T(o);if(!r)return;let a=v(n,Jt).filter(i=>i instanceof S);for(let i of a)for(let c of this.carriersOf(e,i,r))for(let s of X(e,c.context,c.expr))t.push(this.toError(o.name,c.slot,s))}carriersOf(e,o,t){let n=[],r=(a,i)=>{let c=P(o,a);c&&n.push({slot:`look.${a.name}`,context:i,expr:c})};if(A(o,Qt))for(let a of[cn,pn,po,Go,zo,Zo])r(a,t);if(A(o,on)&&r(po,t),A(o,en)){let a=v(o,gn).filter(i=>i instanceof S);for(let i of a){let c=P(i,ln);c&&n.push({slot:"look.stats[].statPath",context:t,expr:c})}}if(A(o,tn)||A(o,nn)){let a=this.rangeOf(e,t,h(o,Rn));if(a)for(let i of[po,Go,zo,Zo])r(i,a)}if(A(o,rn)){let a=this.rangeOf(e,t,h(o,bn));if(a)for(let i of[mn,Xo])r(i,a)}if(A(o,an))for(let a of v(o,En)){let i=a instanceof S?void 0:Vn(a),c=this.rangeOf(e,t,i);if(c)for(let s of[Xo,un])r(s,c)}if(A(o,sn)){let a=v(o,kn).filter(i=>i instanceof S);for(let i of a){let c=this.rangeOf(e,t,h(i,Kn));if(!c)continue;let s=P(i,fn);s&&n.push({slot:"look.facets[].nodeNote",context:c,expr:s});let l=P(i,yn);l&&n.push({slot:"look.facets[].edgeValue",context:c,expr:l});let m=v(i,hn).filter(d=>d instanceof S);for(let d of m){let f=P(d,dn);f&&n.push({slot:"look.facets[].channels[].mapPath",context:c,expr:f})}}}return n}rangeOf(e,o,t){if(!t)return;let n=F(e,o,t);return n.ok?n.descriptor?.range:void 0}toError(e,o,t){let n=`${t.propertyUri.publisher}/${t.propertyUri.package_}/${t.propertyUri.name}`,r=t.contextClass.name,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=o,a.actualValue=n,a.message=`tx.${t.via} reads property '${t.propertyUri.name}', but its domain is not in scope for '${r}' (the class this band carrier is evaluated against). The read would silently return undefined at render time and the band would render empty.`,a.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${n}' is not in scope for '${r}'.
50
50
 
51
51
  Possible solutions:
52
52
  \u2022 Read a property declared on '${r}' (or an ancestor / rdfs.Resource)
53
53
  \u2022 If the property should apply to '${r}', adjust its domain
54
- \u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,a}};function Vn(p){let e=p.subject;return e&&typeof e.name=="string"?e:void 0}function vn(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var Dn="kanonak.org",lo=(p,e)=>({publisher:Dn,package_:p,name:e}),Sn=lo("derivation","look"),In=lo("look","bands"),$n=lo("core-rdf","type"),Ye=class{ruleName="UnrenderableBand";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(new _(e,o)),a=jn(e);if(!a)return n;let i=Co();for(let c of r){if(!(c instanceof g)||c.namespace!==a)continue;let s=P(c,Sn);if(!s)continue;let l=v(s,In).filter(m=>m instanceof S);for(let m of l){let d=this.typeOf(m);if(!d)continue;let f=`${d.publisher}/${d.package_}/${d.name}`;if(i.has(f))continue;let y=new u;y.ruleType=this.ruleName,y.severity="Warning",y.entityName=c.name,y.propertyName="derivation.look",y.actualValue=f,y.message=`Band '${d.name}' has no renderer, so this region of the page will be empty. The declaration is valid against the look vocabulary, but the renderer emits only an HTML comment for it \u2014 which a browser does not display, so the loss is silent. Use a band the renderer implements, or remove it until it is supported.`,n.push(y)}}return n}typeOf(e){let o=h(e,$n);if(o)return{publisher:o.publisher,package_:o.package_,name:o.name}}};function jn(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var Te="kanonak.org",xe="view",On={publisher:Te,package_:xe,name:"bind"},wn={publisher:Te,package_:xe,name:"produces"},Cn={publisher:Te,package_:xe,name:"projections"},Pn={publisher:Te,package_:xe,name:"where"},Un={publisher:Te,package_:xe,name:"value"},An={publisher:Te,package_:xe,name:"as"},Ne=class{ruleName="TxExpressionPath";async validateAsync(e,o,t){let n=[],r;t?r=await t.getKanonaks():r=await new j().parseKanonaks(new _(e,o));let a=xn(e);if(!a)return n;for(let i of r)i instanceof g&&i.namespace===a&&this.checkView(r,i,n);return n}checkView(e,o,t){let n=h(o,On);if(!n)return;let r=h(o,wn),a=0;for(let c of Tn(e,v(o,Cn))){let s=P(c,Un);if(s)for(let m of X(e,n,s))t.push(this.toError(o.name,`view.projections[${a}].value`,n,m));let l=h(c,An);l&&r&&(W(e,r,l).ok||t.push(this.asError(o.name,a,r,l))),a+=1}let i=0;for(let c of Nn(o,Pn)){for(let s of X(e,n,c))t.push(this.toError(o.name,`view.where[${i}]`,n,s));i+=1}}asError(e,o,t,n){let r=`${n.publisher}/${n.package_}/${n.name}`,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=`view.projections[${o}].as`,a.actualValue=r,a.message=`Projection stores its value under property '${n.name}', but that property's domain is not in scope for the view's produces class '${t.name}'. The materialized result instance could not carry this value.`,a.expectedValue=`A property whose domain is '${t.name}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${r}' is not in scope for produces class '${t.name}'.
54
+ \u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,a}};function Vn(p){let e=p.subject;return e&&typeof e.name=="string"?e:void 0}function vn(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var Dn="kanonak.org",lo=(p,e)=>({publisher:Dn,package_:p,name:e}),Sn=lo("derivation","look"),In=lo("look","bands"),$n=lo("core-rdf","type"),Ye=class{ruleName="UnrenderableBand";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(new _(e,o)),a=jn(e);if(!a)return n;let i=Co();for(let c of r){if(!(c instanceof g)||c.namespace!==a)continue;let s=P(c,Sn);if(!s)continue;let l=v(s,In).filter(m=>m instanceof S);for(let m of l){let d=this.typeOf(m);if(!d)continue;let f=`${d.publisher}/${d.package_}/${d.name}`;if(i.has(f))continue;let y=new u;y.ruleType=this.ruleName,y.severity="Warning",y.entityName=c.name,y.propertyName="derivation.look",y.actualValue=f,y.message=`Band '${d.name}' has no renderer, so this region of the page will be empty. The declaration is valid against the look vocabulary, but the renderer emits only an HTML comment for it \u2014 which a browser does not display, so the loss is silent. Use a band the renderer implements, or remove it until it is supported.`,n.push(y)}}return n}typeOf(e){let o=h(e,$n);if(o)return{publisher:o.publisher,package_:o.package_,name:o.name}}};function jn(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var Te="kanonak.org",xe="view",On={publisher:Te,package_:xe,name:"bind"},wn={publisher:Te,package_:xe,name:"produces"},Cn={publisher:Te,package_:xe,name:"projections"},Pn={publisher:Te,package_:xe,name:"where"},Un={publisher:Te,package_:xe,name:"value"},An={publisher:Te,package_:xe,name:"as"},Ne=class{ruleName="TxExpressionPath";async validateAsync(e,o,t){let n=[],r;t?r=await t.getKanonaks():r=await new j().parseKanonaks(new _(e,o));let a=xn(e);if(!a)return n;for(let i of r)i instanceof g&&i.namespace===a&&this.checkView(r,i,n);return n}checkView(e,o,t){let n=h(o,On);if(!n)return;let r=h(o,wn),a=0;for(let c of Tn(e,v(o,Cn))){let s=P(c,Un);if(s)for(let m of X(e,n,s))t.push(this.toError(o.name,`view.projections[${a}].value`,n,m));let l=h(c,An);l&&r&&(F(e,r,l).ok||t.push(this.asError(o.name,a,r,l))),a+=1}let i=0;for(let c of Nn(o,Pn)){for(let s of X(e,n,c))t.push(this.toError(o.name,`view.where[${i}]`,n,s));i+=1}}asError(e,o,t,n){let r=`${n.publisher}/${n.package_}/${n.name}`,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=`view.projections[${o}].as`,a.actualValue=r,a.message=`Projection stores its value under property '${n.name}', but that property's domain is not in scope for the view's produces class '${t.name}'. The materialized result instance could not carry this value.`,a.expectedValue=`A property whose domain is '${t.name}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${r}' is not in scope for produces class '${t.name}'.
55
55
 
56
56
  Possible solutions:
57
57
  \u2022 Use an output property whose domain covers '${t.name}'
@@ -61,7 +61,7 @@ Possible solutions:
61
61
  Possible solutions:
62
62
  \u2022 Read a property declared on '${a}' (or an ancestor / rdfs.Resource)
63
63
  \u2022 If the property should apply to '${a}', adjust its domain
64
- \u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,c}};function Nn(p,e){let o=P(p,e);return o?[o]:v(p,e).filter(t=>t instanceof S)}function Tn(p,e){let o=[];for(let t of e)if(t instanceof S)o.push(t);else if(t instanceof O){let n=V(p,t.subject);n&&o.push(n)}return o}function xn(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var Qe="kanonak.org",_n="core-shacl",x=p=>({publisher:Qe,package_:_n,name:p}),Ln=x("NodeShape"),Mn=x("PropertyShape"),Bn=x("targetClass"),Wn=x("property"),Fn=x("path"),qn=x("minCount"),Hn=x("maxCount"),Yn=x("datatype"),Gn=x("class"),Jo=x("in"),zn=x("pattern"),Zn=x("flags"),Xn=x("minLength"),Jn=x("maxLength"),Qn=x("minInclusive"),er=x("maxInclusive"),or=new Set(["decimal","integer","int","long","short","byte","float","double","nonNegativeInteger","positiveInteger","negativeInteger","nonPositiveInteger","unsignedInt","unsignedLong","unsignedShort","unsignedByte"]),Qo=p=>p,Le=class{ruleName="ShaclShape";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(o),a=tr(e);if(!a)return n;let i=new Set;for(let c of r){if(!(c instanceof g)||c.namespace!==a||!A(c,Ln))continue;let s=h(c,Bn);s?this.resolvesToClass(r,s)||n.push(this.err(c.name,"targetClass","Error",`NodeShape '${c.name}' sh:targetClass '${s.name}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",J(s))):n.push(this.err(c.name,"targetClass","Error",`NodeShape '${c.name}' has no sh:targetClass; it constrains nothing.`,"Add sh:targetClass naming the class this shape applies to."));for(let l of v(c,Wn)){let m;if(l instanceof S)m=l;else if(l instanceof O){let d=V(r,l.subject);d&&(m=d,i.add(b(l.subject)))}m&&this.checkPropertyShape(r,c.name,m,s??void 0,n)}}for(let c of r){if(!(c instanceof g)||c.namespace!==a||!A(c,Mn))continue;let s=T(c);s&&i.has(b(s))||this.checkPropertyShape(r,c.name,c,void 0,n)}return n}checkPropertyShape(e,o,t,n,r){let a=h(t,Fn);if(!a){r.push(this.err(o,"property.path","Error",`A PropertyShape on '${o}' has no sh:path; a PropertyShape must name the property it constrains.`,"Add sh:path naming a property."));return}let i=V(e,a),c=i?Y(e,i):!1;c?n&&(W(e,n,a).ok||r.push(this.err(o,"property.path","Warning",`sh:path '${a.name}' is not in scope for sh:targetClass '${n.name}'; the constraint would never bind a value.`,`Constrain a property whose domain is '${n.name}', an ancestor, or rdfs.Resource.`,J(a)))):r.push(this.err(o,"property.path","Error",`sh:path '${a.name}' on '${o}' does not resolve to a property.`,"Reference a defined or imported property.",J(a)));let s=h(t,Yn),l=h(t,Gn);s&&l&&r.push(this.err(o,"property","Error",`A PropertyShape on '${o}' sets both sh:datatype and sh:class; a value is a literal or a node, not both.`,"Keep sh:datatype (literal values) or sh:class (node values), not both.")),s&&!this.resolvesToDatatype(e,s)&&r.push(this.err(o,"datatype","Error",`sh:datatype '${s.name}' on '${o}' does not resolve to a datatype.`,"Reference an xsd datatype or rdfs.Datatype.",J(s))),l&&!this.resolvesToClass(e,l)&&r.push(this.err(o,"class","Error",`sh:class '${l.name}' on '${o}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",J(l)));let m=_e(Z(t,qn)),d=_e(Z(t,Hn));this.checkOrder(o,"minCount",m,"maxCount",d,r);let f=_e(Z(t,Xn)),y=_e(Z(t,Jn));this.checkOrder(o,"minLength",f,"maxLength",y,r);let k=_e(Z(t,Qn)),K=_e(Z(t,er));this.checkOrder(o,"minInclusive",k,"maxInclusive",K,r);let E=z(t,zn);if(E!==void 0){let U=z(t,Zn);try{new RegExp(E,U)}catch{r.push(this.err(o,"pattern","Error",`sh:pattern on '${o}' is not a valid regular expression`+(U!==void 0?` (with flags '${U}')`:"")+`: ${E}`,"Provide a valid regular expression and flags.",E))}}if(oe(t,Jo)&&v(t,Jo).length===0&&r.push(this.err(o,"in","Error",`sh:in on '${o}' is empty; an enumeration must list at least one permitted value.`,"List the permitted literal values, or remove sh:in.")),c&&n){let N=W(e,n,a).descriptor;N&&((E!==void 0||f!==void 0||y!==void 0)&&N.kind==="object"&&r.push(this.err(o,"pattern/minLength/maxLength","Warning",`String facets on '${o}' apply to '${a.name}', which is an object property; string facets constrain literal values.`,"Apply string facets to a datatype property, or use sh:class for node values.",J(a))),(k!==void 0||K!==void 0)&&!this.isNumericDatatypeRange(N.range)&&r.push(this.err(o,"minInclusive/maxInclusive","Warning",`Numeric bounds on '${o}' apply to '${a.name}', whose range is not a numeric datatype.`,"Apply numeric bounds to a numeric datatype property.",J(a))))}}checkOrder(e,o,t,n,r,a){t!==void 0&&r!==void 0&&t>r&&a.push(this.err(e,`${o}/${n}`,"Error",`${o} (${t}) exceeds ${n} (${r}) on '${e}'.`,`Set ${o} <= ${n}.`))}resolvesToClass(e,o){let t=V(e,o);return t?$.isClassType(Qo(t)):!1}resolvesToDatatype(e,o){if(o.publisher===Qe&&o.package_==="core-rdf"&&o.name==="Literal")return!0;let t=V(e,o);return t?$.isDatatypeType(Qo(t)):!1}isNumericDatatypeRange(e){return!e||e.publisher===Qe&&e.package_==="core-rdf"&&e.name==="Literal"?!0:e.publisher===Qe&&e.package_==="core-xsd"&&or.has(e.name)}err(e,o,t,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=t,i.entityName=e,i.propertyName=o,i.message=n,i.suggestion=r,a!==void 0&&(i.actualValue=a),i}};function _e(p){return typeof p=="number"?p:void 0}function J(p){return`${p.publisher}/${p.package_}/${p.name}`}function tr(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var et={publisher:"kanonak.org",package_:"core-owl",name:"oneOf"},nr=p=>p,Me=class{ruleName="OwlOneOf";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(o),a=rr(e);if(!a)return n;for(let i of r){if(!(i instanceof g)||i.namespace!==a||!oe(i,et))continue;let c=v(i,et);if(c.length===0){n.push(this.err(i.name,"Warning",`owl:oneOf on '${i.name}' is empty; a closed enumeration must list at least one individual.`,"List the individuals that make up the enumeration, or remove owl:oneOf."));continue}for(let s of c)if(s instanceof go)n.push(this.err(i.name,"Error",`owl:oneOf member '${String(s.value)}' on '${i.name}' is not a named individual; a class enumeration is of individuals (a misspelled or unimported individual reads as a literal). For a closed set of literal VALUES, constrain a property with sh:in instead.`,"Reference a defined or imported individual, or move literal value sets to a property sh:in.",String(s.value)));else if(s instanceof O){let l=V(r,s.subject);l&&$.isSchemaDefinitionType(nr(l))&&n.push(this.err(i.name,"Error",`owl:oneOf member '${s.subject.name}' on '${i.name}' is a class/property/datatype, not an individual.`,"List named individuals (instances), not schema definitions.",`${s.subject.publisher}/${s.subject.package_}/${s.subject.name}`))}}return n}err(e,o,t,n,r){let a=new u;return a.ruleType=this.ruleName,a.severity=o,a.entityName=e,a.propertyName="oneOf",a.message=t,a.suggestion=n,r!==void 0&&(a.actualValue=r),a}};function rr(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var ar=p=>p,ir=new yo("kanonak.org","core-rdf","Resource"),Be=class{ruleName="DiamondNameClash";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(o),a=sr(e);if(!a)return n;let i=jo(r);for(let c of r){if(!(c instanceof g)||c.namespace!==a||!$.isClassType(ar(c)))continue;let s=T(c);if(!s)continue;let l=H(r,s),m=b(s),d=new Set(l.map(y=>b(y)));d.delete(m),d.delete(b(ir));let f=new Map;for(let y of Eo(r,s)){if(!y.domains.some(E=>d.has(b(E))))continue;let K=f.get(y.uri.name);K?K.push(y):f.set(y.uri.name,[y])}for(let[y,k]of f){if(k.length<2)continue;let K=N=>Oo(i,l,N.uri)?.cardinality,E=new Set(k.map(N=>N.range?b(N.range):void 0).filter(N=>N!==void 0)),U=new Set(k.map(K).filter(N=>N!==void 0));E.size<=1&&U.size<=1||n.push(this.toError(c.name,y,k,K))}}return n}toError(e,o,t,n){let r=c=>{let s=`${c.uri.publisher}/${c.uri.package_}/${c.uri.name}`,l=c.range?`${c.range.publisher}/${c.range.package_}/${c.range.name}`:"no range",m=n(c);return`${s} (range ${l}${m?`, ${m}`:""})`},a=t.map(r).join("; "),i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=o,i.actualValue=a,i.message=`Class '${e}' inherits ${t.length} distinct properties named '${o}' with incompatible range or cardinality: ${a}. The generated interface would multiply-inherit '${o}' with conflicting types and could not compile.`,i.suggestion=`Disambiguate the diamond name-clash on '${o}':
64
+ \u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,c}};function Nn(p,e){let o=P(p,e);return o?[o]:v(p,e).filter(t=>t instanceof S)}function Tn(p,e){let o=[];for(let t of e)if(t instanceof S)o.push(t);else if(t instanceof O){let n=V(p,t.subject);n&&o.push(n)}return o}function xn(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var Qe="kanonak.org",_n="core-shacl",x=p=>({publisher:Qe,package_:_n,name:p}),Ln=x("NodeShape"),Mn=x("PropertyShape"),Bn=x("targetClass"),Fn=x("property"),Wn=x("path"),qn=x("minCount"),Hn=x("maxCount"),Yn=x("datatype"),Gn=x("class"),Jo=x("in"),zn=x("pattern"),Zn=x("flags"),Xn=x("minLength"),Jn=x("maxLength"),Qn=x("minInclusive"),er=x("maxInclusive"),or=new Set(["decimal","integer","int","long","short","byte","float","double","nonNegativeInteger","positiveInteger","negativeInteger","nonPositiveInteger","unsignedInt","unsignedLong","unsignedShort","unsignedByte"]),Qo=p=>p,Le=class{ruleName="ShaclShape";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(o),a=tr(e);if(!a)return n;let i=new Set;for(let c of r){if(!(c instanceof g)||c.namespace!==a||!A(c,Ln))continue;let s=h(c,Bn);s?this.resolvesToClass(r,s)||n.push(this.err(c.name,"targetClass","Error",`NodeShape '${c.name}' sh:targetClass '${s.name}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",J(s))):n.push(this.err(c.name,"targetClass","Error",`NodeShape '${c.name}' has no sh:targetClass; it constrains nothing.`,"Add sh:targetClass naming the class this shape applies to."));for(let l of v(c,Fn)){let m;if(l instanceof S)m=l;else if(l instanceof O){let d=V(r,l.subject);d&&(m=d,i.add(b(l.subject)))}m&&this.checkPropertyShape(r,c.name,m,s??void 0,n)}}for(let c of r){if(!(c instanceof g)||c.namespace!==a||!A(c,Mn))continue;let s=T(c);s&&i.has(b(s))||this.checkPropertyShape(r,c.name,c,void 0,n)}return n}checkPropertyShape(e,o,t,n,r){let a=h(t,Wn);if(!a){r.push(this.err(o,"property.path","Error",`A PropertyShape on '${o}' has no sh:path; a PropertyShape must name the property it constrains.`,"Add sh:path naming a property."));return}let i=V(e,a),c=i?Y(e,i):!1;c?n&&(F(e,n,a).ok||r.push(this.err(o,"property.path","Warning",`sh:path '${a.name}' is not in scope for sh:targetClass '${n.name}'; the constraint would never bind a value.`,`Constrain a property whose domain is '${n.name}', an ancestor, or rdfs.Resource.`,J(a)))):r.push(this.err(o,"property.path","Error",`sh:path '${a.name}' on '${o}' does not resolve to a property.`,"Reference a defined or imported property.",J(a)));let s=h(t,Yn),l=h(t,Gn);s&&l&&r.push(this.err(o,"property","Error",`A PropertyShape on '${o}' sets both sh:datatype and sh:class; a value is a literal or a node, not both.`,"Keep sh:datatype (literal values) or sh:class (node values), not both.")),s&&!this.resolvesToDatatype(e,s)&&r.push(this.err(o,"datatype","Error",`sh:datatype '${s.name}' on '${o}' does not resolve to a datatype.`,"Reference an xsd datatype or rdfs.Datatype.",J(s))),l&&!this.resolvesToClass(e,l)&&r.push(this.err(o,"class","Error",`sh:class '${l.name}' on '${o}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",J(l)));let m=_e(Z(t,qn)),d=_e(Z(t,Hn));this.checkOrder(o,"minCount",m,"maxCount",d,r);let f=_e(Z(t,Xn)),y=_e(Z(t,Jn));this.checkOrder(o,"minLength",f,"maxLength",y,r);let k=_e(Z(t,Qn)),K=_e(Z(t,er));this.checkOrder(o,"minInclusive",k,"maxInclusive",K,r);let E=z(t,zn);if(E!==void 0){let U=z(t,Zn);try{new RegExp(E,U)}catch{r.push(this.err(o,"pattern","Error",`sh:pattern on '${o}' is not a valid regular expression`+(U!==void 0?` (with flags '${U}')`:"")+`: ${E}`,"Provide a valid regular expression and flags.",E))}}if(oe(t,Jo)&&v(t,Jo).length===0&&r.push(this.err(o,"in","Error",`sh:in on '${o}' is empty; an enumeration must list at least one permitted value.`,"List the permitted literal values, or remove sh:in.")),c&&n){let N=F(e,n,a).descriptor;N&&((E!==void 0||f!==void 0||y!==void 0)&&N.kind==="object"&&r.push(this.err(o,"pattern/minLength/maxLength","Warning",`String facets on '${o}' apply to '${a.name}', which is an object property; string facets constrain literal values.`,"Apply string facets to a datatype property, or use sh:class for node values.",J(a))),(k!==void 0||K!==void 0)&&!this.isNumericDatatypeRange(N.range)&&r.push(this.err(o,"minInclusive/maxInclusive","Warning",`Numeric bounds on '${o}' apply to '${a.name}', whose range is not a numeric datatype.`,"Apply numeric bounds to a numeric datatype property.",J(a))))}}checkOrder(e,o,t,n,r,a){t!==void 0&&r!==void 0&&t>r&&a.push(this.err(e,`${o}/${n}`,"Error",`${o} (${t}) exceeds ${n} (${r}) on '${e}'.`,`Set ${o} <= ${n}.`))}resolvesToClass(e,o){let t=V(e,o);return t?$.isClassType(Qo(t)):!1}resolvesToDatatype(e,o){if(o.publisher===Qe&&o.package_==="core-rdf"&&o.name==="Literal")return!0;let t=V(e,o);return t?$.isDatatypeType(Qo(t)):!1}isNumericDatatypeRange(e){return!e||e.publisher===Qe&&e.package_==="core-rdf"&&e.name==="Literal"?!0:e.publisher===Qe&&e.package_==="core-xsd"&&or.has(e.name)}err(e,o,t,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=t,i.entityName=e,i.propertyName=o,i.message=n,i.suggestion=r,a!==void 0&&(i.actualValue=a),i}};function _e(p){return typeof p=="number"?p:void 0}function J(p){return`${p.publisher}/${p.package_}/${p.name}`}function tr(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var et={publisher:"kanonak.org",package_:"core-owl",name:"oneOf"},nr=p=>p,Me=class{ruleName="OwlOneOf";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(o),a=rr(e);if(!a)return n;for(let i of r){if(!(i instanceof g)||i.namespace!==a||!oe(i,et))continue;let c=v(i,et);if(c.length===0){n.push(this.err(i.name,"Warning",`owl:oneOf on '${i.name}' is empty; a closed enumeration must list at least one individual.`,"List the individuals that make up the enumeration, or remove owl:oneOf."));continue}for(let s of c)if(s instanceof go)n.push(this.err(i.name,"Error",`owl:oneOf member '${String(s.value)}' on '${i.name}' is not a named individual; a class enumeration is of individuals (a misspelled or unimported individual reads as a literal). For a closed set of literal VALUES, constrain a property with sh:in instead.`,"Reference a defined or imported individual, or move literal value sets to a property sh:in.",String(s.value)));else if(s instanceof O){let l=V(r,s.subject);l&&$.isSchemaDefinitionType(nr(l))&&n.push(this.err(i.name,"Error",`owl:oneOf member '${s.subject.name}' on '${i.name}' is a class/property/datatype, not an individual.`,"List named individuals (instances), not schema definitions.",`${s.subject.publisher}/${s.subject.package_}/${s.subject.name}`))}}return n}err(e,o,t,n,r){let a=new u;return a.ruleType=this.ruleName,a.severity=o,a.entityName=e,a.propertyName="oneOf",a.message=t,a.suggestion=n,r!==void 0&&(a.actualValue=r),a}};function rr(p){let e=p.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${C(e.version)}`}var ar=p=>p,ir=new yo("kanonak.org","core-rdf","Resource"),Be=class{ruleName="DiamondNameClash";async validateAsync(e,o,t){let n=[],r=t?await t.getKanonaks():await new j().parseKanonaks(o),a=sr(e);if(!a)return n;let i=jo(r);for(let c of r){if(!(c instanceof g)||c.namespace!==a||!$.isClassType(ar(c)))continue;let s=T(c);if(!s)continue;let l=H(r,s),m=b(s),d=new Set(l.map(y=>b(y)));d.delete(m),d.delete(b(ir));let f=new Map;for(let y of Eo(r,s)){if(!y.domains.some(E=>d.has(b(E))))continue;let K=f.get(y.uri.name);K?K.push(y):f.set(y.uri.name,[y])}for(let[y,k]of f){if(k.length<2)continue;let K=N=>Oo(i,l,N.uri)?.cardinality,E=new Set(k.map(N=>N.range?b(N.range):void 0).filter(N=>N!==void 0)),U=new Set(k.map(K).filter(N=>N!==void 0));E.size<=1&&U.size<=1||n.push(this.toError(c.name,y,k,K))}}return n}toError(e,o,t,n){let r=c=>{let s=`${c.uri.publisher}/${c.uri.package_}/${c.uri.name}`,l=c.range?`${c.range.publisher}/${c.range.package_}/${c.range.name}`:"no range",m=n(c);return`${s} (range ${l}${m?`, ${m}`:""})`},a=t.map(r).join("; "),i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=o,i.actualValue=a,i.message=`Class '${e}' inherits ${t.length} distinct properties named '${o}' with incompatible range or cardinality: ${a}. The generated interface would multiply-inherit '${o}' with conflicting types and could not compile.`,i.suggestion=`Disambiguate the diamond name-clash on '${o}':
65
65
  \u2022 rename one of the properties, or
66
66
  \u2022 re-domain one so it is not inherited by '${e}', or
67
67
  \u2022 restructure the hierarchy so '${e}' inherits only one '${o}', or