@ulb-darmstadt/shacl-form 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,7 +73,7 @@ a, a:visited { color: inherit; }
73
73
  .ref-link { cursor: pointer; }
74
74
  .ref-link:hover { text-decoration: underline; }
75
75
  .node-id-display { color: #999; font-size: 11px; }`;class Gd{constructor(e){let t=Vd;e&&(t+=`
76
- `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,n){const i=document.createElement("div"),s=document.createElement("label");s.innerHTML=e+":",n.description&&s.setAttribute("title",n.description.value),i.appendChild(s);let a=t.value,o=null;if(t instanceof ni){const l=n.config.store.getQuads(a,null,null,null);if(l.length){const c=Sn(l,n.config.languages);c&&(a=c)}}else t instanceof ct&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Ut}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Ut}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let u;return sa(t.value)?(u=document.createElement("a"),u.setAttribute("href",t.value)):u=document.createElement("div"),u.classList.add("d-flex"),u.innerText=a,o&&u.appendChild(o),i.appendChild(u),i}}function Wd(r,e,t){if(t){const n=r.minCount!==void 0&&r.minCount>0;if(r.class)return r.config.theme.createListEditor(r.label,e,n,Sa(r.class,r),r);if(r.shaclIn){const i=r.config.lists[r.shaclIn];if(i?.length){const s=cc(i,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,e,n,s,r)}else console.error("list not found:",r.shaclIn,"existing lists:",r.config.lists)}if(r.datatype?.value===`${_a}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Ut,"")){case"integer":case"float":case"double":case"decimal":return r.config.theme.createNumberEditor(r.label,e,n,r);case"date":case"dateTime":return r.config.theme.createDateEditor(r.label,e,n,r);case"boolean":return r.config.theme.createBooleanEditor(r.label,e,n,r);case"base64Binary":return r.config.theme.createFileEditor(r.label,e,n,r)}return r.config.theme.createTextEditor(r.label,e,n,r)}else{if(e)return r.config.theme.createViewer(r.label,e,r);const n=document.createElement("div");return n.innerHTML="No value",n}}function zd(r,e,t){if(e==="application/ld+json")return Xd(r);{const n=new ga({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function Xd(r){const e=[];for(const t of r){const n={"@id":t.subject.id};if(t.predicate===tt)n["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof ct?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Ut}#string`&&(i={"@type":t.object.datatype.value,"@value":t.object.value}):i={"@id":t.object.id},n[t.predicate.value]=i}e.push(n)}return JSON.stringify(e)}function Qd(r){let e=r.shaclDatatype,t=r.value;if(t){if(r.dataset.class||r.dataset.nodeKind===xe+"IRI")return Re.namedNode(t);if(r.dataset.link)return JSON.parse(r.dataset.link);if(r.dataset.lang?e=r.dataset.lang:r.type==="number"?t=parseFloat(t):r.type==="file"&&r.binaryData?t=r.binaryData:r.type==="datetime-local"&&(t=new Date(t).toISOString().slice(0,19)),!e&&typeof t=="string"){const n=t.split("^^");n.length===2&&(n[0].startsWith('"')&&n[0].endsWith('"')||n[0].startsWith("'")&&n[0].endsWith("'"))&&n[1].split(":").length===2&&(t=n[0].substring(1,n[0].length-1),e=Re.namedNode(n[1]))}return Re.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Re.literal(r.checked?"true":"false",e)}const gn={};function Jd(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):gn[`${r.predicate}^${r.datatype}`]=r}function Kd(){return Object.entries(gn).map(r=>r[1])}function Yd(r,e){let t=gn[`${r}^${e}`];return t||(t=gn[`${r}^undefined`],t)?t:gn[`undefined^${e}`]}class hy{constructor(e,t){this.predicate=e.predicate,this.datatype=e.datatype,t&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t))}createViewer(e,t){return e.config.theme.createViewer(e.label,t,e)}}/**
76
+ `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,n){const i=document.createElement("div"),s=document.createElement("label");s.innerHTML=e+":",n.description&&s.setAttribute("title",n.description.value),i.appendChild(s);let a=t.value,o=null;if(t instanceof ni){const l=n.config.store.getQuads(a,null,null,null);if(l.length){const c=Sn(l,n.config.languages);c&&(a=c)}}else t instanceof ct&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Ut}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Ut}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let u;return sa(t.value)?(u=document.createElement("a"),u.setAttribute("href",t.value)):u=document.createElement("div"),u.classList.add("d-flex"),u.innerText=a,o&&u.appendChild(o),i.appendChild(u),i}}function Wd(r,e,t){if(t){const n=r.minCount!==void 0&&r.minCount>0;if(r.class)return r.config.theme.createListEditor(r.label,e,n,Sa(r.class,r),r);if(r.shaclIn){const i=r.config.lists[r.shaclIn];if(i?.length){const s=cc(i,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,e,n,s,r)}else console.error("list not found:",r.shaclIn,"existing lists:",r.config.lists)}if(r.datatype?.value===`${_a}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Ut,"")){case"integer":case"float":case"double":case"decimal":return r.config.theme.createNumberEditor(r.label,e,n,r);case"date":case"dateTime":return r.config.theme.createDateEditor(r.label,e,n,r);case"boolean":return r.config.theme.createBooleanEditor(r.label,e,n,r);case"base64Binary":return r.config.theme.createFileEditor(r.label,e,n,r)}return r.config.theme.createTextEditor(r.label,e,n,r)}else{if(e)return r.config.theme.createViewer(r.label,e,r);const n=document.createElement("div");return n.innerHTML="No value",n}}function zd(r,e,t){if(e==="application/ld+json")return Xd(r);{const n=new ga({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function Xd(r){const e=[];for(const t of r){const n={"@id":t.subject.id};if(t.predicate===tt)n["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof ct?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Ut}#string`&&(i={"@type":t.object.datatype.value,"@value":t.object.value}):i={"@id":t.object.id},n[t.predicate.value]=i}e.push(n)}return JSON.stringify(e)}function Qd(r){let e=r.shaclDatatype,t=r.value;if(t){if(r.dataset.class||r.dataset.nodeKind===xe+"IRI")return Re.namedNode(t);if(r.dataset.link)return JSON.parse(r.dataset.link);if(r.dataset.lang?e=r.dataset.lang:r.type==="number"?t=parseFloat(t):r.type==="file"&&r.binaryData?t=r.binaryData:r.type==="datetime-local"&&(t=new Date(t).toISOString().slice(0,19)),!e&&typeof t=="string"){const n=t.split("^^");n.length===2&&(n[0].startsWith('"')&&n[0].endsWith('"')||n[0].startsWith("'")&&n[0].endsWith("'"))&&n[1].split(":").length===2&&(t=n[0].substring(1,n[0].length-1),e=Re.namedNode(n[1]))}return Re.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Re.literal(r.checked?"true":"false",e)}const gn={};function Jd(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):gn[`${r.predicate}^${r.datatype}`]=r}function Kd(){return Object.entries(gn).map(r=>r[1])}function Yd(r,e){let t=gn[`${r}^${e}`];return t||(t=gn[`${r}^undefined`],t)?t:gn[`undefined^${e}`]}class dy{constructor(e,t){this.predicate=e.predicate,this.datatype=e.datatype,t&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t))}createViewer(e,t){return e.config.theme.createViewer(e.label,t,e)}}/**
77
77
  * @license
78
78
  * Copyright 2019 Google LLC
79
79
  * SPDX-License-Identifier: BSD-3-Clause
@@ -364,17 +364,17 @@ if("@preserve"in h)return h["@preserve"][0];if(e.isValue(h))return h;if(e.isList
364
364
  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
365
365
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
366
366
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
367
- */var js,su;function Mf(){if(su)return js;su=1;const r=ka(),e=Nf(),t=dt(),n=Af(),i=t.IdentifierIssuer,s=ft(),a=Hc(),o=Df(),{expand:u}=Of(),{flatten:l}=Lf(),{fromRDF:c}=Cf(),{toRDF:d}=$f(),{frameMergedOrDefault:m,cleanupNull:b}=Ff(),{isArray:_,isObject:x,isString:E}=ut(),{isSubjectReference:v}=$t(),{expandIri:S,getInitialContext:y,process:h,processingMode:g}=ar(),{compact:I,compactIri:C}=kf(),{createNodeMap:A,createMergedNodeMap:B,mergeNodeMaps:R}=fi(),{logEventHandler:F,logWarningEventHandler:q,safeEventHandler:D,setDefaultEventHandler:O,setupEventHandler:te,strictEventHandler:T,unhandledEventHandler:Z}=Nn(),k=function(w){const H={},X=new a({max:100});w.compact=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(V===null)return null;z=ue(z,{base:E(V)?V:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:X})}),z.link&&(z.skipExpansion=!0),z.compactToRelative||delete z.base;let U;z.skipExpansion?U=V:U=await w.expand(V,z);const ee=await w.processContext(y(z),G,z);let re=await I({activeCtx:ee,element:U,options:z});z.compactArrays&&!z.graph&&_(re)?re.length===1?re=re[0]:re.length===0&&(re={}):z.graph&&x(re)&&(re=[re]),x(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),_(G)||(G=[G]);const fe=G;G=[];for(let j=0;j<fe.length;++j)(!x(fe[j])||Object.keys(fe[j]).length>0)&&G.push(fe[j]);const ge=G.length>0;if(G.length===1&&(G=G[0]),_(re)){const j=C({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),W=re;re={},ge&&(re["@context"]=G),re[j]=W}else if(x(re)&&ge){const j=re;re={"@context":G};for(const W in j)re[W]=j[W]}return re},w.expand=async function(V,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=ue(G,{keepFreeFloatingNodes:!1,contextResolver:new n({sharedCache:X})});const z={},U=[];if("expandContext"in G){const ge=t.clone(G.expandContext);x(ge)&&"@context"in ge?z.expandContext=ge:z.expandContext={"@context":ge},U.push(z.expandContext)}let ee;if(!E(V))z.input=t.clone(V);else{const ge=await w.get(V,G);ee=ge.documentUrl,z.input=ge.document,ge.contextUrl&&(z.remoteContext={"@context":ge.contextUrl},U.push(z.remoteContext))}"base"in G||(G.base=ee||"");let re=y(G);for(const ge of U)re=await h({activeCtx:re,localCtx:ge,options:G});let fe=await u({activeCtx:re,element:z.input,options:G});return x(fe)&&"@graph"in fe&&Object.keys(fe).length===1?fe=fe["@graph"]:fe===null&&(fe=[]),_(fe)||(fe=[fe]),fe},w.flatten=async function(V,G,z){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,z=ue(z,{base:E(V)?V:"",contextResolver:new n({sharedCache:X})});const U=await w.expand(V,z),ee=l(U);return G===null?ee:(z.graph=!0,z.skipExpansion=!0,await w.compact(ee,G,z))},w.frame=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(z=ue(z,{base:E(V)?V:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:X})}),E(G)){const he=await w.get(G,z);if(G=he.document,he.contextUrl){let pe=G["@context"];pe?_(pe)?pe.push(he.contextUrl):pe=[pe,he.contextUrl]:pe=he.contextUrl,G["@context"]=pe}}const U=G?G["@context"]||{}:{},ee=await w.processContext(y(z),U,z);z.hasOwnProperty("omitGraph")||(z.omitGraph=g(ee,1.1)),z.hasOwnProperty("pruneBlankNodeIdentifiers")||(z.pruneBlankNodeIdentifiers=g(ee,1.1));const re=await w.expand(V,z),fe={...z};fe.isFrame=!0,fe.keepFreeFloatingNodes=!0;const ge=await w.expand(G,fe),j=Object.keys(G).map(he=>S(ee,he,{vocab:!0}));fe.merged=!j.includes("@graph"),fe.is11=g(ee,1.1);const W=m(re,ge,fe);fe.graph=!z.omitGraph,fe.skipExpansion=!0,fe.link={},fe.framing=!0;let se=await w.compact(W,U,fe);return fe.link={},se=b(se,fe),se},w.link=async function(V,G,z){const U={};return G&&(U["@context"]=G),U["@embed"]="@link",w.frame(V,U,z)},w.normalize=w.canonize=async function(V,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=ue(G,{base:E(V)?V:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:X})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=o.parse(V);return r.canonize(ee,G)}const z={...G};delete z.format,z.produceGeneralizedRdf=!1;const U=await w.toRDF(V,z);return r.canonize(U,G)},w.fromRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=ue(G,{format:E(V)?"application/n-quads":void 0});const{format:z}=G;let{rdfParser:U}=G;if(z){if(U=U||H[z],!U)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:z})}else U=()=>V;const ee=await U(V);return c(ee,G)},w.toRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=ue(G,{base:E(V)?V:"",skipExpansion:!1,contextResolver:new n({sharedCache:X})});let z;G.skipExpansion?z=V:z=await w.expand(V,G);const U=d(z,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return o.serialize(U);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return U},w.createNodeMap=async function(V,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=ue(G,{base:E(V)?V:"",contextResolver:new n({sharedCache:X})});const z=await w.expand(V,G);return B(z,G)},w.merge=async function(V,G,z){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!_(V))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,z=ue(z,{contextResolver:new n({sharedCache:X})});const U=await Promise.all(V.map(he=>{const pe={...z};return w.expand(he,pe)}));let ee=!0;"mergeNodes"in z&&(ee=z.mergeNodes);const re=z.issuer||new i("_:b"),fe={"@default":{}};for(let he=0;he<U.length;++he){const pe=t.relabelBlankNodes(U[he],{issuer:new i("_:b"+he+"-")}),me=ee||he===0?fe:{"@default":{}};if(A(pe,me,"@default",re),me!==fe)for(const J in me){const ce=me[J];if(!(J in fe)){fe[J]=ce;continue}const ye=fe[J];for(const le in ce)le in ye||(ye[le]=ce[le])}}const ge=R(fe),j=[],W=Object.keys(ge).sort();for(let he=0;he<W.length;++he){const pe=ge[W[he]];v(pe)||j.push(pe)}return G===null?j:(z.graph=!0,z.skipExpansion=!0,await w.compact(j,G,z))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:V=>w._documentLoader=V}),w.documentLoader=async V=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:V})},w.get=async function(V,G){let z;typeof G.documentLoader=="function"?z=G.documentLoader:z=w.documentLoader;const U=await z(V);try{if(!U.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");E(U.document)&&(U.document=JSON.parse(U.document))}catch(ee){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:U})}return U},w.processContext=async function(V,G,z){return z=ue(z,{base:"",contextResolver:new n({sharedCache:X})}),G===null?y(z):(G=t.clone(G),x(G)&&"@context"in G||(G={"@context":G}),h({activeCtx:V,localCtx:G,options:z}))},w.getContextValue=ar().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(V){if(!(V in w.documentLoaders))throw new s('Unknown document loader type: "'+V+'"',"jsonld.UnknownDocumentLoader",{type:V});w.documentLoader=w.documentLoaders[V].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(V,G){H[V]=G},w.unregisterRDFParser=function(V){delete H[V]},w.registerRDFParser("application/n-quads",o.parse),w.registerRDFParser("application/nquads",o.parse),w.url=Gt(),w.logEventHandler=F,w.logWarningEventHandler=q,w.safeEventHandler=D,w.setDefaultEventHandler=O,w.strictEventHandler=T,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=Uc(),w.JsonLdProcessor=Pf()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function ue(V,{documentLoader:G=w.documentLoader,...z}){if(V&&"compactionMap"in V)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(V&&"expansionMap"in V)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},z,V,{eventHandler:te({options:V})})}return w},Y=function(){return k(function(){return Y()})};return k(Y),js=Y,js}var Bf=Mf();const $s={},Fs={},qf=new Ku;let ca;class Uf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=ca;this.config.prefixes={};const t=[];if(e||(e=new et,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?qn(this.config.attributes.shapesUrl):"",e,Jn))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?qn(this.config.attributes.valuesUrl):"",e,vt)),await Promise.all(t),!ca&&e?.size==0&&this.config.attributes.valuesSubject){const n=[...e.getObjects(this.config.attributes.valuesSubject,tt,vt),...e.getObjects(this.config.attributes.valuesSubject,na,vt)],i=[];for(const s of n){const a=this.toURL(s.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),i.push(this.importRDF(qn(a),e,Jn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=e}async importRDF(e,t,n){const i=async s=>{const a=[];await new Promise((o,u)=>{const l=d=>{if(t.add(new ii(d.subject,d.predicate,d.object,n)),this.config.attributes.ignoreOwlImports===null&&xa.equals(d.predicate)){const m=this.toURL(d.object.value);m&&this.loadedExternalUrls.indexOf(m)<0&&(this.loadedExternalUrls.push(m),a.push(this.importRDF(qn(m),t,Re.namedNode(m))))}if(this.config.classInstanceProvider&&Ea.equals(d.predicate)){const m=d.object.value;if(this.loadedClasses.indexOf(m)<0){let b;m in Fs?b=Fs[m]:(b=this.config.classInstanceProvider(m),Fs[m]=b),this.loadedClasses.push(m),a.push(this.importRDF(b,t,n))}}};if(au(s)==="xml"){const d=new mf.RdfXmlParser;d.on("data",m=>{l(m)}).on("error",m=>{console.warn("failed parsing graph",n,m.message),u(m)}).on("prefix",(m,b)=>{m&&(this.config.prefixes[m]=b)}).on("end",()=>{o(null)}),d.write(s),d.end()}else qf.parse(s,(d,m,b)=>{if(d)return console.warn("failed parsing graph",n,d.message),u(d);if(m){l(m);return}b&&this.config.registerPrefixes(b),o(null)})});try{await Promise.allSettled(a)}catch(o){console.warn(o)}};if(e instanceof Promise&&(e=await e),e){if(au(e)==="json")try{e=await Bf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await i(e)}}toURL(e){if(sa(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const n=this.config.prefixes[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),sa(e)))return e}}return null}}async function qn(r){if(r in $s)return $s[r];const e=fetch(r,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(t=>t.text());return $s[r]=e,e}function au(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}function Hf(r){ca=r}class ks{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class ou{constructor(e,t){this.attributes=new ks,this.loader=new Uf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new et,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}updateAttributes(e){const t=new ks;if(Object.keys(t).forEach(n=>{const i=e.dataset[n];i!==void 0&&(t[n]=i)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const n=this.languages.indexOf(t.language);n>-1&&this.languages.splice(n,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Re.namedNode(t.valuesGraph))}static dataAttributes(){const e=new ks;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=e.extractLists(),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${xe}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}function Vf(r){return"_:"+r.value}function Gf(r,e){return[...r].map(t=>e(t)).join(`
367
+ */var js,su;function Mf(){if(su)return js;su=1;const r=ka(),e=Nf(),t=dt(),n=Af(),i=t.IdentifierIssuer,s=ft(),a=Hc(),o=Df(),{expand:u}=Of(),{flatten:l}=Lf(),{fromRDF:c}=Cf(),{toRDF:d}=$f(),{frameMergedOrDefault:m,cleanupNull:b}=Ff(),{isArray:_,isObject:x,isString:E}=ut(),{isSubjectReference:v}=$t(),{expandIri:S,getInitialContext:y,process:h,processingMode:g}=ar(),{compact:I,compactIri:C}=kf(),{createNodeMap:A,createMergedNodeMap:B,mergeNodeMaps:R}=fi(),{logEventHandler:F,logWarningEventHandler:q,safeEventHandler:D,setDefaultEventHandler:O,setupEventHandler:te,strictEventHandler:T,unhandledEventHandler:Z}=Nn(),k=function(w){const H={},X=new a({max:100});w.compact=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(V===null)return null;z=ue(z,{base:E(V)?V:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:X})}),z.link&&(z.skipExpansion=!0),z.compactToRelative||delete z.base;let U;z.skipExpansion?U=V:U=await w.expand(V,z);const ee=await w.processContext(y(z),G,z);let re=await I({activeCtx:ee,element:U,options:z});z.compactArrays&&!z.graph&&_(re)?re.length===1?re=re[0]:re.length===0&&(re={}):z.graph&&x(re)&&(re=[re]),x(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),_(G)||(G=[G]);const fe=G;G=[];for(let j=0;j<fe.length;++j)(!x(fe[j])||Object.keys(fe[j]).length>0)&&G.push(fe[j]);const ge=G.length>0;if(G.length===1&&(G=G[0]),_(re)){const j=C({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),W=re;re={},ge&&(re["@context"]=G),re[j]=W}else if(x(re)&&ge){const j=re;re={"@context":G};for(const W in j)re[W]=j[W]}return re},w.expand=async function(V,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=ue(G,{keepFreeFloatingNodes:!1,contextResolver:new n({sharedCache:X})});const z={},U=[];if("expandContext"in G){const ge=t.clone(G.expandContext);x(ge)&&"@context"in ge?z.expandContext=ge:z.expandContext={"@context":ge},U.push(z.expandContext)}let ee;if(!E(V))z.input=t.clone(V);else{const ge=await w.get(V,G);ee=ge.documentUrl,z.input=ge.document,ge.contextUrl&&(z.remoteContext={"@context":ge.contextUrl},U.push(z.remoteContext))}"base"in G||(G.base=ee||"");let re=y(G);for(const ge of U)re=await h({activeCtx:re,localCtx:ge,options:G});let fe=await u({activeCtx:re,element:z.input,options:G});return x(fe)&&"@graph"in fe&&Object.keys(fe).length===1?fe=fe["@graph"]:fe===null&&(fe=[]),_(fe)||(fe=[fe]),fe},w.flatten=async function(V,G,z){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,z=ue(z,{base:E(V)?V:"",contextResolver:new n({sharedCache:X})});const U=await w.expand(V,z),ee=l(U);return G===null?ee:(z.graph=!0,z.skipExpansion=!0,await w.compact(ee,G,z))},w.frame=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(z=ue(z,{base:E(V)?V:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:X})}),E(G)){const he=await w.get(G,z);if(G=he.document,he.contextUrl){let pe=G["@context"];pe?_(pe)?pe.push(he.contextUrl):pe=[pe,he.contextUrl]:pe=he.contextUrl,G["@context"]=pe}}const U=G?G["@context"]||{}:{},ee=await w.processContext(y(z),U,z);z.hasOwnProperty("omitGraph")||(z.omitGraph=g(ee,1.1)),z.hasOwnProperty("pruneBlankNodeIdentifiers")||(z.pruneBlankNodeIdentifiers=g(ee,1.1));const re=await w.expand(V,z),fe={...z};fe.isFrame=!0,fe.keepFreeFloatingNodes=!0;const ge=await w.expand(G,fe),j=Object.keys(G).map(he=>S(ee,he,{vocab:!0}));fe.merged=!j.includes("@graph"),fe.is11=g(ee,1.1);const W=m(re,ge,fe);fe.graph=!z.omitGraph,fe.skipExpansion=!0,fe.link={},fe.framing=!0;let se=await w.compact(W,U,fe);return fe.link={},se=b(se,fe),se},w.link=async function(V,G,z){const U={};return G&&(U["@context"]=G),U["@embed"]="@link",w.frame(V,U,z)},w.normalize=w.canonize=async function(V,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=ue(G,{base:E(V)?V:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:X})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=o.parse(V);return r.canonize(ee,G)}const z={...G};delete z.format,z.produceGeneralizedRdf=!1;const U=await w.toRDF(V,z);return r.canonize(U,G)},w.fromRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=ue(G,{format:E(V)?"application/n-quads":void 0});const{format:z}=G;let{rdfParser:U}=G;if(z){if(U=U||H[z],!U)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:z})}else U=()=>V;const ee=await U(V);return c(ee,G)},w.toRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=ue(G,{base:E(V)?V:"",skipExpansion:!1,contextResolver:new n({sharedCache:X})});let z;G.skipExpansion?z=V:z=await w.expand(V,G);const U=d(z,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return o.serialize(U);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return U},w.createNodeMap=async function(V,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=ue(G,{base:E(V)?V:"",contextResolver:new n({sharedCache:X})});const z=await w.expand(V,G);return B(z,G)},w.merge=async function(V,G,z){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!_(V))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,z=ue(z,{contextResolver:new n({sharedCache:X})});const U=await Promise.all(V.map(he=>{const pe={...z};return w.expand(he,pe)}));let ee=!0;"mergeNodes"in z&&(ee=z.mergeNodes);const re=z.issuer||new i("_:b"),fe={"@default":{}};for(let he=0;he<U.length;++he){const pe=t.relabelBlankNodes(U[he],{issuer:new i("_:b"+he+"-")}),me=ee||he===0?fe:{"@default":{}};if(A(pe,me,"@default",re),me!==fe)for(const J in me){const ce=me[J];if(!(J in fe)){fe[J]=ce;continue}const ye=fe[J];for(const le in ce)le in ye||(ye[le]=ce[le])}}const ge=R(fe),j=[],W=Object.keys(ge).sort();for(let he=0;he<W.length;++he){const pe=ge[W[he]];v(pe)||j.push(pe)}return G===null?j:(z.graph=!0,z.skipExpansion=!0,await w.compact(j,G,z))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:V=>w._documentLoader=V}),w.documentLoader=async V=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:V})},w.get=async function(V,G){let z;typeof G.documentLoader=="function"?z=G.documentLoader:z=w.documentLoader;const U=await z(V);try{if(!U.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");E(U.document)&&(U.document=JSON.parse(U.document))}catch(ee){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:U})}return U},w.processContext=async function(V,G,z){return z=ue(z,{base:"",contextResolver:new n({sharedCache:X})}),G===null?y(z):(G=t.clone(G),x(G)&&"@context"in G||(G={"@context":G}),h({activeCtx:V,localCtx:G,options:z}))},w.getContextValue=ar().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(V){if(!(V in w.documentLoaders))throw new s('Unknown document loader type: "'+V+'"',"jsonld.UnknownDocumentLoader",{type:V});w.documentLoader=w.documentLoaders[V].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(V,G){H[V]=G},w.unregisterRDFParser=function(V){delete H[V]},w.registerRDFParser("application/n-quads",o.parse),w.registerRDFParser("application/nquads",o.parse),w.url=Gt(),w.logEventHandler=F,w.logWarningEventHandler=q,w.safeEventHandler=D,w.setDefaultEventHandler=O,w.strictEventHandler=T,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=Uc(),w.JsonLdProcessor=Pf()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function ue(V,{documentLoader:G=w.documentLoader,...z}){if(V&&"compactionMap"in V)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(V&&"expansionMap"in V)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},z,V,{eventHandler:te({options:V})})}return w},Y=function(){return k(function(){return Y()})};return k(Y),js=Y,js}var Bf=Mf();const $s={},Fs={};let ca;class qf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=ca;this.config.prefixes={};const t=[];if(e||(e=new et,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?qn(this.config.attributes.shapesUrl):"",e,Jn))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?qn(this.config.attributes.valuesUrl):"",e,vt)),await Promise.all(t),!ca&&e?.size==0&&this.config.attributes.valuesSubject){const n=[...e.getObjects(this.config.attributes.valuesSubject,tt,vt),...e.getObjects(this.config.attributes.valuesSubject,na,vt)],i=[];for(const s of n){const a=this.toURL(s.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),i.push(this.importRDF(qn(a),e,Jn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=e}async importRDF(e,t,n){const i=async s=>{const a=[];await new Promise((o,u)=>{const l=d=>{if(t.add(new ii(d.subject,d.predicate,d.object,n)),this.config.attributes.ignoreOwlImports===null&&xa.equals(d.predicate)){const m=this.toURL(d.object.value);m&&this.loadedExternalUrls.indexOf(m)<0&&(this.loadedExternalUrls.push(m),a.push(this.importRDF(qn(m),t,Re.namedNode(m))))}if(this.config.classInstanceProvider&&Ea.equals(d.predicate)){const m=d.object.value;if(this.loadedClasses.indexOf(m)<0){let b;m in Fs?b=Fs[m]:(b=this.config.classInstanceProvider(m),Fs[m]=b),this.loadedClasses.push(m),a.push(this.importRDF(b,t,n))}}};if(au(s)==="xml"){const d=new mf.RdfXmlParser;d.on("data",m=>{l(m)}).on("error",m=>{console.warn("failed parsing graph",n,m.message),u(m)}).on("prefix",(m,b)=>{m&&(this.config.prefixes[m]=b)}).on("end",()=>{o(null)}),d.write(s),d.end()}else try{console.log("--- parsing",s,n),new Ku().parse(s,(d,m,b)=>{if(d)return console.warn("failed parsing graph",n,d.message),u(d);if(m){l(m);return}b&&this.config.registerPrefixes(b),o(null)})}catch(d){u(d)}});try{await Promise.allSettled(a)}catch(o){console.warn(o)}};if(e instanceof Promise&&(e=await e),e){if(au(e)==="json")try{e=await Bf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await i(e)}}toURL(e){if(sa(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const n=this.config.prefixes[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),sa(e)))return e}}return null}}async function qn(r){if(r in $s)return $s[r];const e=fetch(r,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(t=>t.text());return $s[r]=e,e}function au(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}function Uf(r){ca=r}class ks{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class ou{constructor(e,t){this.attributes=new ks,this.loader=new qf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new et,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}updateAttributes(e){const t=new ks;if(Object.keys(t).forEach(n=>{const i=e.dataset[n];i!==void 0&&(t[n]=i)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const n=this.languages.indexOf(t.language);n>-1&&this.languages.splice(n,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Re.namedNode(t.valuesGraph))}static dataAttributes(){const e=new ks;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=e.extractLists(),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${xe}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}function Hf(r){return"_:"+r.value}function Vf(r,e){return[...r].map(t=>e(t)).join(`
368
368
  `)+`
369
- `}function Wf(){return""}function Vc(r){return"<"+r.value+">"}const zf=/["\\\\\n\r]/,Xf=/["\\\\\n\r]/g,Qf={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Jf(r){return Qf[r]}function Kf(r){return zf.test(r)?r.replace(Xf,Jf):r}function Yf(r){const e=Kf(r.value);return r.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':r.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+r.language:'"'+e+'"^^'+Vc(r.datatype)}function Zf(r,e){const t=e(r.subject),n=e(r.predicate),i=e(r.object),s=e(r.graph);return`${t} ${n} ${i} ${s?s+" ":""}.`}function ep(r){return"?"+r.value}function at(r){if(!r)return null;if(r.termType==="BlankNode")return Vf(r);if(r.termType==="DefaultGraph")return Wf();if(r.termType==="Literal")return Yf(r);if(r.termType==="NamedNode")return Vc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return Zf(r,at);if(r.termType==="Variable")return ep(r);if(r[Symbol.iterator])return Gf(r,at);throw new Error(`unknown termType ${r.termType}`)}class Cr{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(at(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(at(e));return t&&t.value}has(e){return this.index.has(at(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=at(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class lu{constructor({dataset:e,end:t,quad:n,start:i}){this.dataset=e,this.end=t,this.quad=n,this.start=i}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function uu(r){try{return at(r)}catch{return null}}class ht{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=at(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(uu(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(uu(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Gc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Gc.prototype.termType="BlankNode";class Ma{equals(e){return!!e&&e.termType===this.termType}}Ma.prototype.termType="DefaultGraph";Ma.prototype.value="";function cu(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),n=r.fromTerm(e.predicate),i=r.fromTerm(e.object),s=r.fromTerm(e.graph);return r.quad(t,n,i,s)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Xn{constructor(e,t,n,i=""){this.value=e,this.language=t,this.datatype=n,this.direction=i}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)&&(e.direction||"")===this.direction}}Xn.prototype.termType="Literal";class In{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}In.prototype.termType="NamedNode";class Ba{constructor(e,t,n,i){this.subject=e,this.predicate=t,this.object=n,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}Ba.prototype.termType="Quad";Ba.prototype.value="";class Wc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Wc.prototype.termType="Variable";const tp=new In("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),du=new In("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),rp=new In("http://www.w3.org/2001/XMLSchema#string");class zc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Ma}}namedNode(e){return new In(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Gc(e)}literal(e,t){return typeof t=="string"?new Xn(e,t,du):typeof t?.language=="string"?new Xn(e,t.language,t.direction?tp:du,t.direction):new Xn(e,"",t||rp)}variable(e){return new Wc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new Ba(e,t,n,i)}fromTerm(e){return cu(this,e)}fromQuad(e){return cu(this,e)}}zc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const qa=new zc,np={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function pt(r,{factory:e=qa}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,np)}pt("http://www.w3.org/2001/XMLSchema#");const _t=pt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");pt("http://www.w3.org/2000/01/rdf-schema#");class Fe{static add({ptr:e,start:t,end:n,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:u}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};u&&(l=c=>{u(new lu({dataset:e.dataset,start:t,end:n,quad:c}))});for(const c of i)for(const d of s)for(const m of a)for(const b of o){const _={subject:c,predicate:d,object:m,graph:b};_[t]=e.term;const x=e.factory.quad(_.subject,_.predicate,_.object,_.graph);e.dataset.add(x),l(x)}return e}static addList({ptr:e,predicates:t,items:n,graphs:i}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const a of i){const o=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,o[0]||_t.nil,a));for(let u=0;u<o.length;u++)e.dataset.add(e.factory.quad(o[u],_t.first,n[u],a)),e.dataset.add(e.factory.quad(o[u],_t.rest,o[u+1]||_t.nil,a))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:i=[null],objects:s=[null]}){for(const a of n)for(const o of i)for(const u of s){const l={subject:a,predicate:o,object:u};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const d of c)e.dataset.delete(d)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const i of t)for(const s of e.dataset.match(e.term,i)){let a=s.object;for(n.push(s);!_t.nil.equals(a);){a=n[n.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const u of o)n.push(u)}}for(const i of n)e.dataset.delete(i);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,items:c,callback:d}={}){if(t==="add")return Fe.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,callback:d});if(t==="addList")return Fe.addList({ptr:e,predicates:o,items:c,graphs:l});if(t==="delete")return Fe.delete({ptr:e,start:i,subjects:a,predicates:o,objects:u});if(t==="deleteList")return Fe.deleteList({ptr:e,predicates:o});if(t==="isList")return Fe.isList({ptr:e});if(t==="list")return Fe.list({ptr:e});if(t==="traverse")return Fe.traverse({ptr:e,quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(_t.nil.equals(e.term)||Fe.traverse({ptr:e,predicates:[_t.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(_t.nil);){const t=e.out([_t.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([_t.rest]);if(n.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:i="object",subjects:s=[null],predicates:a=[null],objects:o=[null],graphs:u=[null],callback:l}){if(t==="one")return Fe.traverseOne({ptr:e,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="oneOrMore"){const c=Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});return Fe.traverseMore({ptrs:c,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})}if(t==="zeroOrMore")return Fe.traverseMore({ptrs:[e],end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="zeroOrOne")return[e,...Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u}={}){let l=[...e],c,d;do{c=[];for(const m of e)c=[...c,...Fe.traverseOne({ptr:m,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u})];d&&(c=c.filter(m=>!d.has(m.term))),e=c,l=[...l,...c],d=new ht(l.map(m=>m.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u=(l,c)=>c.extend(l)}={}){const l=[];for(const c of i)for(const d of s)for(const m of a)for(const b of o){const _={subject:c,predicate:d,object:m,graph:b};_[t]=e.term;for(const x of e.dataset.match(_.subject,_.predicate,_.object,_.graph))l.push(u(new lu({dataset:e.dataset,end:n,quad:x,start:t}),e))}return l}}function hu(r,e){return e?t=>e(r.extend(t)):()=>{}}class fu{constructor({dataset:e,edges:t=[],factory:n,graph:i,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=i,t.length===0&&(this._term=s)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,n){return Fe.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:hu(this,n)})}addList(e,t){return Fe.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Fe.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:hu(this,n)})}deleteIn(e,t){return Fe.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Fe.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Fe.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c}){return Fe.execute({ptr:this,operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Fe.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Fe.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Fe.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Fe.isList({ptr:this})}list(){return Fe.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return Fe.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function pu(r,e){return r?r.equals(e):r===e}function ip(r,e){return!(r.dataset!==e.dataset||!pu(r.graph,e.graph)||!pu(r.term,e.term))}function gu(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class ti{constructor({dataset:e,factory:t,ptrs:n,terms:i,graphs:s}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(const a of i||[null])for(const o of s||[null])this.ptrs.push(new fu({dataset:e,factory:t,graph:o,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new ht(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,n){const i=gu(this,n);for(const s of this.ptrs)s.addIn(e,t,i);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){const i=gu(this,n);for(const s of this.ptrs)s.addOut(e,t,i);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const n of this.ptrs)n.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,n)=>(t.some(i=>ip(i,n))||t.push(n.trim()),t),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(const n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const n of e)yield t.clone({ptrs:[n]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,n=[...e].map(i=>new fu({dataset:t,factory:this.factory,term:i}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}pt("http://www.w3.org/2002/07/owl#");const or=pt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),sp=pt("http://www.w3.org/2000/01/rdf-schema#"),ae=pt("http://www.w3.org/ns/shacl#"),da=pt("https://schemas.link/shacl-next#"),Ua=pt("http://www.w3.org/2001/XMLSchema#");function ap(r){return r?`{${[...r.quads()].map(e=>at(e)).join(" ")}}`:"{}"}function op(r){return r?`{${r.map(e=>ap(e)).join(" ")}}`:"{}"}var Ps,mu;function lp(){if(mu)return Ps;mu=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Ps=e,Ps}var Ms,yu;function up(){if(yu)return Ms;yu=1;var r=lp(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Ms=t,Ms}var Bs,bu;function cp(){if(bu)return Bs;bu=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Bs=r,Bs}var qs,_u;function dp(){if(_u)return qs;_u=1;var r=typeof xr=="object"&&xr&&xr.Object===Object&&xr;return qs=r,qs}var Us,wu;function hp(){if(wu)return Us;wu=1;var r=dp(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Us=t,Us}var Hs,vu;function Xc(){if(vu)return Hs;vu=1;var r=hp(),e=r.Symbol;return Hs=e,Hs}var Vs,xu;function fp(){if(xu)return Vs;xu=1;var r=Xc(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function s(a){var o=t.call(a,i),u=a[i];try{a[i]=void 0;var l=!0}catch{}var c=n.call(a);return l&&(o?a[i]=u:delete a[i]),c}return Vs=s,Vs}var Gs,Eu;function pp(){if(Eu)return Gs;Eu=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Gs=t,Gs}var Ws,Su;function gp(){if(Su)return Ws;Su=1;var r=Xc(),e=fp(),t=pp(),n="[object Null]",i="[object Undefined]",s=r?r.toStringTag:void 0;function a(o){return o==null?o===void 0?i:n:s&&s in Object(o)?e(o):t(o)}return Ws=a,Ws}var zs,Nu;function mp(){if(Nu)return zs;Nu=1;function r(e){return e!=null&&typeof e=="object"}return zs=r,zs}var Xs,Iu;function yp(){if(Iu)return Xs;Iu=1;var r=gp(),e=mp(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return Xs=n,Xs}var Qs,Ru;function bp(){if(Ru)return Qs;Ru=1;var r=up(),e=cp(),t=yp(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var d=s.test(l);return d||a.test(l)?o(l.slice(2),d?2:8):i.test(l)?n:+l}return Qs=u,Qs}var Js,Tu;function _p(){if(Tu)return Js;Tu=1;var r=bp(),e=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===e||i===-e){var s=i<0?-1:1;return s*t}return i===i?i:0}return Js=n,Js}var Ks,Au;function wp(){if(Au)return Ks;Au=1;var r=_p();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return Ks=e,Ks}var Ys,Du;function vp(){if(Du)return Ys;Du=1;var r=wp(),e="Expected a function";function t(n,i){var s;if(typeof i!="function")throw new TypeError(e);return n=r(n),function(){return--n>0&&(s=i.apply(this,arguments)),n<=1&&(i=void 0),s}}return Ys=t,Ys}var Zs,Ou;function xp(){if(Ou)return Zs;Ou=1;var r=vp();function e(t){return r(2,t)}return Zs=e,Zs}var Ep=xp();const yt=rd(Ep);let Lu=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=yt(()=>!this.results.some(s=>s.severity.equals(ae.Info)||s.severity.equals(ae.Violation)||s.severity.equals(ae.Warning))),this._ptr=yt(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new ti({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([or.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ua.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Sp(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=at(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Np=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:u,shape:l,source:c=[],value:d,valuePaths:m=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=i,this.path=a||l.path,this.results=o,this.severity=u,this.shape=l,this.source=c,this.value=d,this.valuePaths=m,this._message=yt(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),s.map(b=>n.literal(Sp(b.value,e),b.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([or.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const n=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],n(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(i=>n(i).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const i of this.results)e.addOut([ae.detail],[this.factory.blankNode()],s=>{i.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Ha{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new Lu({factory:e,options:n}),results:a=new Map,shape:o,value:u,valueOrNode:l,valuePaths:c,values:d}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=u,this.valuePaths=c,this.valueOrNode=l,this.values=d}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:i=this.value,valueOrNode:s=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new Ha({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Lu({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:i,valueOrNode:s,valuePaths:a,values:o})}id({shape:e=this.shape}={}){return`${at(e.ptr.term)} - ${at(this.focusNode.term)} - ${op(this.valuePaths)}`}result(e){const t=new Np({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),n=this.id();this.results.has(n)?this.results.get(n).add(t):this.results.set(n,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:da.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:da.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ae.Violation,...t})}}function Ip(){return{generic:Rp()}}function Rp(){return r=>{r.trace(da.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Tp{constructor(e){this.validations=new Cr(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const i=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(s.term);a&&(i.add(a),s.term.equals(ae.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&i.add(Ip),[...i].map(s=>s(e)).filter(Boolean)}}var Zt={},er={},rn={},nn={},Cu;function Ar(){if(Cu)return nn;Cu=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.Translator=void 0;let r=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,n,i){for(const s of n)this.supportedRdfDatatypes.push(s),this.fromRdfHandlers[s.value]=t;for(const s of i){let a=this.toRdfHandlers[s];a||(this.toRdfHandlers[s]=a=[]),a.push(t)}}fromRdf(t,n){const i=this.fromRdfHandlers[t.datatype.value];return i?i.fromRdf(t,n):t.value}toRdf(t,n){const i=this.toRdfHandlers[typeof t];if(i)for(const s of i){const a=s.toRdf(t,n);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return nn.Translator=r,nn}var ju;function Ap(){if(ju)return rn;ju=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.TypeHandlerBoolean=void 0;const r=Ar();let e=class Qc{fromRdf(n,i){switch(n.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return i&&r.Translator.incorrectRdfDataType(n),!1}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(n?"true":"false",i||s.namedNode(Qc.TYPE))}};return rn.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",rn}var sn={},$u;function Dp(){if($u)return sn;$u=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.TypeHandlerDate=void 0;const r=Ar();let e=class ha{fromRdf(n,i){switch(i&&!n.value.match(ha.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&r.Translator.incorrectRdfDataType(n),n.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(n.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const s=n.value.split("-");return new Date(0,parseInt(s[0],10)-1,parseInt(s[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(n.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(n.value+"-01");default:return new Date(n.value)}}toRdf(n,{datatype:i,dataFactory:s}){if(i=i||s.namedNode(ha.TYPES[0]),!(n instanceof Date))return null;const a=n;let o;switch(i.value){case"http://www.w3.org/2001/XMLSchema#gDay":o=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":o=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":o=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":o=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":o=a.toISOString().replace(/T.*$/,"");break;default:o=a.toISOString()}return s.literal(o,i)}};return sn.TypeHandlerDate=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#dateTime","http://www.w3.org/2001/XMLSchema#date","http://www.w3.org/2001/XMLSchema#gDay","http://www.w3.org/2001/XMLSchema#gMonthDay","http://www.w3.org/2001/XMLSchema#gYear","http://www.w3.org/2001/XMLSchema#gYearMonth"],e.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/},sn}var an={},Fu;function Op(){if(Fu)return an;Fu=1,Object.defineProperty(an,"__esModule",{value:!0}),an.TypeHandlerNumberDouble=void 0;const r=Ar();let e=class Jc{fromRdf(n,i){const s=parseFloat(n.value);return i&&isNaN(s)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return i=i||s.namedNode(Jc.TYPES[0]),isNaN(n)?s.literal("NaN",i):isFinite(n)?n%1===0?null:s.literal(n.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i):s.literal(n>0?"INF":"-INF",i)}};return an.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],an}var on={},ku;function Lp(){if(ku)return on;ku=1,Object.defineProperty(on,"__esModule",{value:!0}),on.TypeHandlerNumberInteger=void 0;const r=Ar();let e=class hn{fromRdf(n,i){const s=parseInt(n.value,10);return i&&(isNaN(s)||n.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(String(n),i||(n<=hn.MAX_INT&&n>=hn.MIN_INT?s.namedNode(hn.TYPES[0]):s.namedNode(hn.TYPES[1])))}};return on.TypeHandlerNumberInteger=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#positiveInteger","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedShort"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,on}var ln={},Pu;function Cp(){if(Pu)return ln;Pu=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return ln.TypeHandlerString=r,r.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],ln}var Mu;function Bu(){return Mu||(Mu=1,function(r){var e=er&&er.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=er&&er.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Ap(),r),t(Dp(),r),t(Op(),r),t(Lp(),r),t(Cp(),r)}(er)),er}var ea={},qu;function jp(){return qu||(qu=1,Object.defineProperty(ea,"__esModule",{value:!0})),ea}var Uu;function $p(){return Uu||(Uu=1,function(r){var e=Zt&&Zt.__createBinding||(Object.create?function(b,_,x,E){E===void 0&&(E=x);var v=Object.getOwnPropertyDescriptor(_,x);(!v||("get"in v?!_.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return _[x]}}),Object.defineProperty(b,E,v)}:function(b,_,x,E){E===void 0&&(E=x),b[E]=_[x]}),t=Zt&&Zt.__exportStar||function(b,_){for(var x in b)x!=="default"&&!Object.prototype.hasOwnProperty.call(_,x)&&e(_,b,x)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=u,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=d,r.getSupportedJavaScriptPrimitives=m;const n=kc(),i=Bu(),s=Ar();t(Bu(),r),t(jp(),r),t(Ar(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(b=>a.namedNode(b)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(b=>a.namedNode(b)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(b=>a.namedNode(b)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(b=>a.namedNode(b)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(b=>a.namedNode(b)),["object"]);function u(b,_){return o.fromRdf(b,_)}function l(b,_){return _&&"namedNode"in _&&(_={dataFactory:_}),_=_||{},_&&!_.dataFactory&&(_.dataFactory=a),o.toRdf(b,_)}function c(b,_){return b.termType==="Literal"?u(b,_):b.value}function d(){return o.getSupportedRdfDatatypes()}function m(){return o.getSupportedJavaScriptPrimitives()}}(Zt)),Zt}var xn=$p();function Hu(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const n=r.out([ae.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=r.out([ae.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=r.out([ae.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function Fp(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Hu(e)):[Hu(r)]}class kp{constructor(e){this.shape=e,this._compiled=yt(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const n of this.compiled)n.node&&await n.node(t),n.generic&&await n.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const n=t.node(new ht(t.terms)),i=[...t].reduce((a,o)=>{const u=o.term,l=t.node([u]);return a.has(u)||a.set(u,{value:l,valuePaths:[]}),a.get(u).valuePaths.push(o),a},new Cr).values(),s=e.create({shape:this.shape,values:n});for(const a of this.compiled)a.property&&await a.property(s);for(const{value:a,valuePaths:o}of i){const u=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const l of this.compiled)l.generic&&await l.generic(u)}}}function fa(r){const e=new ht,n=new ti({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[sp.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class Pp{constructor(e){this.targetClass=new ht([...fa(e.hasOut([or.type],[ae.NodeShape])),...fa(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([or.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],i=e.focusNode.clone({ptrs:n});return i.node([...new ht(i.terms)])}}class Mp{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=yt(()=>{const n=this.ptr.out([ae.deactivated]).term;return n&&xn.fromRdf(n)}),this._message=yt(()=>this.ptr.out([ae.message]).terms),this._path=yt(()=>Fp(this.ptr.out([ae.path]))),this._severity=yt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=yt(()=>new kp(this)),this._sparql=yt(()=>this.ptr.out([ae.sparql])),this._targetResolver=yt(()=>new Pp(this.ptr))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!this.path}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Bp(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:qp(e)}}function qp(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Up(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Hp(e)}}function Hp(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Vp(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Gp(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function pi(r,e){return Promise.all(r.map(e))}async function Wp(r,e){for(const t of r)if(await e(t))return!0;return!1}function zp(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Xp(e)}}function Xp(r){return async e=>{const t=await pi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.every(i=>i.conforms);e.test(n,ae.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function Qp(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Jp(e)}}function Jp(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!t.conforms;e.test(n,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function Kp(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Yp(e)}}function Yp(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await pi(r,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=i.flatMap(s=>s.results),n=i.some(s=>s.conforms)}else n=await Wp(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(n,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function Zp(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:eg(e)}}function eg(r){return async e=>{const t=await pi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.filter(i=>i.conforms).length===1;e.test(n,ae.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function tg(r){if(!xn.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(s=>r.validator.shape(s)),n=new ht(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new ht([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(s=>s.term));return{node:rg(n,i)}}function rg(r,e){return t=>{const n=t.focusNode.execute({start:"subject",end:"predicate"}).filter(i=>e.has(i.term)?!1:!r.has(i.term));if(n.ptrs.length>0)for(const i of n)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[i.term]}],value:t.focusNode.node([[...i.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function ng(r){const e=r.ptr.out([ae.hasValue]).term;return{node:ig(e),property:sg(e)}}function ig(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function sg(r){return e=>{const t=[...e.values].some(n=>r.equals(n.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function ag(r){const e=new ht([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:og(e)}}function og(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function jr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Vu(r)!==Vu(e))return null;const t=xn.fromRdf(r),n=xn.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function Vu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ua.dateTime.equals(r.datatype)&&e.test(r.value)}function lg(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:ug(e)}}function ug(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function cg(r){const e=r.ptr.out([ae.equals]).term;return{node:dg(e),property:hg(e)}}function dg(r){return e=>{const t=e.focusNode.out([r]),n=t.filter(s=>!s.term.equals(e.focusNode.term)),i=t.terms.length!==0&&n.terms.length===0;e.test(i,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:n.terms[0]&&e.focusNode.node([n.terms[0]])||e.focusNode})}}function hg(r){return e=>{const t=new ht(e.focusNode.out([r]).terms),n=new ht(e.values.terms),i=[...n].filter(o=>!t.has(o)),s=[...t].filter(o=>!n.has(o)),a=[...i,...s];for(const o of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function fg(r){const e=r.ptr.out([ae.lessThan]).term;return{property:pg(e)}}function pg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=jr(n.term,i);s===null||s>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}}}function gg(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:mg(e)}}function mg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=jr(n.term,i);s===null||s>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}}}function yg(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:bg(e)}}function bg(r){return e=>{const t=jr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function _g(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:wg(e)}}function wg(r){return e=>{const t=jr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function vg(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:xg(e)}}function xg(r){return e=>{const t=jr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Eg(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Sg(e)}}function Sg(r){return e=>{const t=jr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Ng(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Ig(e)}}function Ig(r){return async e=>{for(const t of r){const n=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(n.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:n.report.results,value:e.valueOrNode})}}}function Rg(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Tg(e)}}function Tg(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Ag(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,n=t?xn.fromRdf(t):!1,i=r.ptr.out([ae.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:Dg(e,n,s,o)}}function Dg(r,e,t,n){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(u=>!u.term.equals(r.ptr.term)).map(u=>i.shape.validator.shape(u))));const o=(await Gp(i.values,async u=>{const l=(await r.validate(i.create({child:!0,focusNode:u}))).report;if(s.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const c=await pi([...a],async d=>(await d.validate(i.create({child:!0,focusNode:u}))).report);return s.push(c.flatMap(d=>d.results)),!c.every(d=>d.conforms)}else return!await Vp([...a],async c=>(await c.validate(i.create({child:!0,focusNode:u}))).report.conforms)})).length;t!==null&&i.test(o<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),n!==null&&i.test(o>=n,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:n,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function Og(r,e){return e?e.slice(0,r.length)===r:!1}function Lg(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:Cg(e)}}function Cg(r){return e=>{const t=r.some(n=>Og(n,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function jg(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:$g(e)}}function $g(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Fg(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:kg(e)}}function kg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function Pg(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,n=new RegExp(e,t);return{generic:Mg(e,t,n)}}function Mg(r,e,t){return n=>{n.test(t.test(n.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function Bg(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ua.boolean.equals(e.datatype)?{property:qg()}:null}function qg(){return r=>{const t=Object.entries(r.values.terms.reduce((n,i)=>(i.language&&(n[i.language]=(n[i.language]||0)+1),n),{})).filter(([,n])=>n>1);for(const[n]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:n},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const Qn=pt("http://www.w3.org/ns/shacl#"),Kc=pt("https://schemas.link/shacl-next#");class Dr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Qn.Info)||e.severity.equals(Qn.Violation)||e.severity.equals(Qn.Warning))}}function Ug(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=at(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class ri{constructor({args:e={},factory:t,message:n=[],severity:i=Qn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(Ug(s.value,e),s.language||null))}}class Va{constructor({factory:e=qa}={}){this.factory=e}clone({factory:e}={}){return new Va({factory:e||this.factory})}validate(){return new Dr}validateSimple(){return!0}}class $r extends Va{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const n of Array.isArray(e)?e:[e])n&&this.datatypes.push(this.factory.fromTerm(n))}clone({factory:e}={}){return new $r({datatypes:this.datatypes,factory:e||this.factory})}}class Hg{constructor({factory:e=qa,validations:t}={}){if(this.factory=e,this.validations=new Cr,t)for(const n of Object.values(t)){const i=n.clone({factory:this.factory});for(const s of i.datatypes)this.validations.set(s,i)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Dr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends $r{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(n=>{let i;n.test(e.value)&&(i=Kc.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new ri({args:s,factory:this.factory,message:this.message,severity:i})});return new Dr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Vg=/^([-+]?[0-9]+)$/;class it extends Pe{constructor(e=null,t=null,n,{factory:i}={}){super(Vg,n,{factory:i}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new it(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Kc.Debug.equals(t[0].severity))return new Dr({results:t});const n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){const i=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ri({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&n>this.maxInclusive){const i=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ri({factory:this.factory,message:s}))}return new Dr({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Ga extends $r{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Ga(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(n)];t.push(new ri({factory:this.factory,message:i}))}return new Dr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Te={xsd:pt("http://www.w3.org/2001/XMLSchema#")},Gg=new $r({datatypes:Te.xsd.anySimpleType}),Wg=new $r({datatypes:Te.xsd.anyAtomicType}),gi=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,zg=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Yc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Wa=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,Zc=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Xg=/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Qg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Jg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Kg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Yg=/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Zg=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,em=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(([0-9a-fA-F]{2})*)$/,rm=/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,nm=new Pe(gi,Te.xsd.string),im=new Ga(["1","true","0","false"],Te.xsd.boolean),sm=new Pe(zg,Te.xsd.decimal),am=new Pe(Yc,Te.xsd.float),om=new Pe(Yc,Te.xsd.double),lm=new Pe(Wa,Te.xsd.duration),um=new Pe(Zc,Te.xsd.dateTime),cm=new Pe(Xg,Te.xsd.time),dm=new Pe(Qg,Te.xsd.date),hm=new Pe(Jg,Te.xsd.gYearMonth),fm=new Pe(Kg,Te.xsd.gYear),pm=new Pe(Yg,Te.xsd.gMonthDay),gm=new Pe(Zg,Te.xsd.gDay),mm=new Pe(em,Te.xsd.gMonth),ym=new Pe(tm,Te.xsd.hexBinary),bm=new Pe(rm,Te.xsd.base64Binary),_m=new Pe(gi,Te.xsd.anyURI),ed=/^([^\u000d\u000a\u0009]*)$/,wm=/^([^ ]+( [^ ]+)*)*$/,vm=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,xm=/^([^DT]*)$/,Em=/^([^YM]*[DT].*)$/,Sm=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Nm=new Pe([gi,ed],Te.xsd.normalizedString),Im=new Pe([gi,ed,wm],Te.xsd.token),Rm=new Pe(vm,Te.xsd.language),Tm=new it(null,null,Te.xsd.integer),Am=new it(null,"0",Te.xsd.nonPositiveInteger),Dm=new it(null,"-1",Te.xsd.negativeInteger),Om=new it("-9223372036854775808","9223372036854775807",Te.xsd.long),Lm=new it("-2147483648","2147483647",Te.xsd.int),Cm=new it("-32768","32767",Te.xsd.short),jm=new it("-128","127",Te.xsd.byte),$m=new it("0",null,Te.xsd.nonNegativeInteger),Fm=new it("0","18446744073709551615",Te.xsd.unsignedLong),km=new it("0","4294967295",Te.xsd.unsignedInt),Pm=new it("0","65535",Te.xsd.unsignedShort),Mm=new it("0","255",Te.xsd.unsignedByte),Bm=new it("1",null,Te.xsd.positiveInteger),qm=new Pe([Wa,xm],Te.xsd.yearMonthDuration),Um=new Pe([Wa,Em],Te.xsd.dayTimeDuration),Hm=new Pe([Zc,Sm],Te.xsd.dateTimeStamp),Vm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Wg,anySimpleType:Gg,anyURI:_m,base64Binary:bm,boolean:im,byte:jm,date:dm,dateTime:um,dateTimeStamp:Hm,dayTimeDuration:Um,decimal:sm,double:om,duration:lm,float:am,gDay:gm,gMonth:mm,gMonthDay:pm,gYear:fm,gYearMonth:hm,hexBinary:ym,int:Lm,integer:Tm,language:Rm,long:Om,negativeInteger:Dm,nonNegativeInteger:$m,nonPositiveInteger:Am,normalizedString:Nm,positiveInteger:Bm,short:Cm,string:nm,time:cm,token:Im,unsignedByte:Mm,unsignedInt:km,unsignedLong:Fm,unsignedShort:Pm,yearMonthDuration:qm},Symbol.toStringTag,{value:"Module"}));class Gm extends Hg{constructor({factory:e}={}){super({factory:e,validations:{...Vm}})}}const Wm=new Cr([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function zm(r){const e=r.ptr.out([ae.class]).map(t=>fa(t));return{generic:Xm(e)}}function Xm(r){return e=>{const t=new ht(e.valueOrNode.out([or.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Qm(r){const e=r.ptr.out([ae.datatype]).term,t=new Gm;return{generic:Jm(e,t)}}function Jm(r,e){return t=>{const n=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(n,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function Km(r){const e=r.ptr.out([ae.nodeKind]).term,t=Wm.get(e);return{generic:Ym(e,t)}}function Ym(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const Zm=new Cr([[ae.maxCount,Bp],[ae.minCount,Up],[ae.and,zp],[ae.not,Qp],[ae.or,Kp],[ae.xone,Zp],[ae.closed,tg],[ae.hasValue,ng],[ae.in,ag],[ae.disjoint,lg],[ae.equals,cg],[ae.lessThan,fg],[ae.lessThanOrEquals,gg],[ae.maxExclusive,yg],[ae.maxInclusive,_g],[ae.minExclusive,vg],[ae.minInclusive,Eg],[ae.node,Ng],[ae.property,Rg],[ae.qualifiedValueShape,Ag],[ae.languageIn,Lg],[ae.maxLength,jg],[ae.minLength,Fg],[ae.pattern,Pg],[ae.uniqueLang,Bg],[ae.class,zm],[ae.datatype,Qm],[ae.nodeKind,Km]]);class ey{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Tp(Zm),this.shapesPtr=new ti({dataset:e,factory:t}),this.shapes=new Cr,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[s,a]of this.options.validations)this.registry.validations.set(s,a);const i=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([or.type],[ae.NodeShape]),...this.shapesPtr.hasOut([or.type],[ae.PropertyShape])];for(const s of i)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Mp(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new ti({...e,factory:this.factory}),i=new Ha({factory:this.factory,focusNode:n,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const a=i.create({shape:s});let o;n.isAny()?o=s.resolveTargets(a):o=n;for(const u of o)await s.validate(a.create({focusNode:u}))}return i.report}}let ty=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new ou(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(n=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:n.conforms,report:n}}))}).catch(n=>{console.warn(n)})})}static get observedAttributes(){return ou.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(n=>{this.form.classList.remove(n)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const n of Kd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Ht(e,this.config,this.config.attributes.valuesSubject?Re.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const n=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);n.addEventListener("click",i=>{i.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(n)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Re.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,Jn)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}},200)}serialize(e="text/turtle",t=this.toRDF()){const n=t.getQuads(null,null,null,null);return zd(n,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){Jd(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Hf(e),this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape?.toRDF(this.config.store),this.shape&&this.config.store.add(new ii(this.shape.shaclSubject,Re.namedNode(xe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,n=await new ey(t,{details:!0,factory:Re}).validate({dataset:t});for(const i of n.results)if(i.focusNode?.ptrs?.length)for(const s of i.focusNode.ptrs){const a=s._term;if(i.path?.length){const o=i.path[0].predicates[0];let u=this.form.querySelectorAll(`
369
+ `}function Gf(){return""}function Vc(r){return"<"+r.value+">"}const Wf=/["\\\\\n\r]/,zf=/["\\\\\n\r]/g,Xf={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Qf(r){return Xf[r]}function Jf(r){return Wf.test(r)?r.replace(zf,Qf):r}function Kf(r){const e=Jf(r.value);return r.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':r.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+r.language:'"'+e+'"^^'+Vc(r.datatype)}function Yf(r,e){const t=e(r.subject),n=e(r.predicate),i=e(r.object),s=e(r.graph);return`${t} ${n} ${i} ${s?s+" ":""}.`}function Zf(r){return"?"+r.value}function at(r){if(!r)return null;if(r.termType==="BlankNode")return Hf(r);if(r.termType==="DefaultGraph")return Gf();if(r.termType==="Literal")return Kf(r);if(r.termType==="NamedNode")return Vc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return Yf(r,at);if(r.termType==="Variable")return Zf(r);if(r[Symbol.iterator])return Vf(r,at);throw new Error(`unknown termType ${r.termType}`)}class Cr{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(at(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(at(e));return t&&t.value}has(e){return this.index.has(at(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=at(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class lu{constructor({dataset:e,end:t,quad:n,start:i}){this.dataset=e,this.end=t,this.quad=n,this.start=i}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function uu(r){try{return at(r)}catch{return null}}class ht{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=at(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(uu(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(uu(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Gc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Gc.prototype.termType="BlankNode";class Ma{equals(e){return!!e&&e.termType===this.termType}}Ma.prototype.termType="DefaultGraph";Ma.prototype.value="";function cu(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),n=r.fromTerm(e.predicate),i=r.fromTerm(e.object),s=r.fromTerm(e.graph);return r.quad(t,n,i,s)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Xn{constructor(e,t,n,i=""){this.value=e,this.language=t,this.datatype=n,this.direction=i}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)&&(e.direction||"")===this.direction}}Xn.prototype.termType="Literal";class In{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}In.prototype.termType="NamedNode";class Ba{constructor(e,t,n,i){this.subject=e,this.predicate=t,this.object=n,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}Ba.prototype.termType="Quad";Ba.prototype.value="";class Wc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Wc.prototype.termType="Variable";const ep=new In("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),du=new In("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),tp=new In("http://www.w3.org/2001/XMLSchema#string");class zc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Ma}}namedNode(e){return new In(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Gc(e)}literal(e,t){return typeof t=="string"?new Xn(e,t,du):typeof t?.language=="string"?new Xn(e,t.language,t.direction?ep:du,t.direction):new Xn(e,"",t||tp)}variable(e){return new Wc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new Ba(e,t,n,i)}fromTerm(e){return cu(this,e)}fromQuad(e){return cu(this,e)}}zc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const qa=new zc,rp={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function pt(r,{factory:e=qa}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,rp)}pt("http://www.w3.org/2001/XMLSchema#");const _t=pt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");pt("http://www.w3.org/2000/01/rdf-schema#");class Fe{static add({ptr:e,start:t,end:n,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:u}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};u&&(l=c=>{u(new lu({dataset:e.dataset,start:t,end:n,quad:c}))});for(const c of i)for(const d of s)for(const m of a)for(const b of o){const _={subject:c,predicate:d,object:m,graph:b};_[t]=e.term;const x=e.factory.quad(_.subject,_.predicate,_.object,_.graph);e.dataset.add(x),l(x)}return e}static addList({ptr:e,predicates:t,items:n,graphs:i}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const a of i){const o=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,o[0]||_t.nil,a));for(let u=0;u<o.length;u++)e.dataset.add(e.factory.quad(o[u],_t.first,n[u],a)),e.dataset.add(e.factory.quad(o[u],_t.rest,o[u+1]||_t.nil,a))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:i=[null],objects:s=[null]}){for(const a of n)for(const o of i)for(const u of s){const l={subject:a,predicate:o,object:u};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const d of c)e.dataset.delete(d)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const i of t)for(const s of e.dataset.match(e.term,i)){let a=s.object;for(n.push(s);!_t.nil.equals(a);){a=n[n.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const u of o)n.push(u)}}for(const i of n)e.dataset.delete(i);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,items:c,callback:d}={}){if(t==="add")return Fe.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,callback:d});if(t==="addList")return Fe.addList({ptr:e,predicates:o,items:c,graphs:l});if(t==="delete")return Fe.delete({ptr:e,start:i,subjects:a,predicates:o,objects:u});if(t==="deleteList")return Fe.deleteList({ptr:e,predicates:o});if(t==="isList")return Fe.isList({ptr:e});if(t==="list")return Fe.list({ptr:e});if(t==="traverse")return Fe.traverse({ptr:e,quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(_t.nil.equals(e.term)||Fe.traverse({ptr:e,predicates:[_t.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(_t.nil);){const t=e.out([_t.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([_t.rest]);if(n.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:i="object",subjects:s=[null],predicates:a=[null],objects:o=[null],graphs:u=[null],callback:l}){if(t==="one")return Fe.traverseOne({ptr:e,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="oneOrMore"){const c=Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});return Fe.traverseMore({ptrs:c,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})}if(t==="zeroOrMore")return Fe.traverseMore({ptrs:[e],end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="zeroOrOne")return[e,...Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u}={}){let l=[...e],c,d;do{c=[];for(const m of e)c=[...c,...Fe.traverseOne({ptr:m,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u})];d&&(c=c.filter(m=>!d.has(m.term))),e=c,l=[...l,...c],d=new ht(l.map(m=>m.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u=(l,c)=>c.extend(l)}={}){const l=[];for(const c of i)for(const d of s)for(const m of a)for(const b of o){const _={subject:c,predicate:d,object:m,graph:b};_[t]=e.term;for(const x of e.dataset.match(_.subject,_.predicate,_.object,_.graph))l.push(u(new lu({dataset:e.dataset,end:n,quad:x,start:t}),e))}return l}}function hu(r,e){return e?t=>e(r.extend(t)):()=>{}}class fu{constructor({dataset:e,edges:t=[],factory:n,graph:i,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=i,t.length===0&&(this._term=s)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,n){return Fe.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:hu(this,n)})}addList(e,t){return Fe.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Fe.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:hu(this,n)})}deleteIn(e,t){return Fe.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Fe.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Fe.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c}){return Fe.execute({ptr:this,operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Fe.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Fe.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Fe.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Fe.isList({ptr:this})}list(){return Fe.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return Fe.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function pu(r,e){return r?r.equals(e):r===e}function np(r,e){return!(r.dataset!==e.dataset||!pu(r.graph,e.graph)||!pu(r.term,e.term))}function gu(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class ti{constructor({dataset:e,factory:t,ptrs:n,terms:i,graphs:s}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(const a of i||[null])for(const o of s||[null])this.ptrs.push(new fu({dataset:e,factory:t,graph:o,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new ht(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,n){const i=gu(this,n);for(const s of this.ptrs)s.addIn(e,t,i);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){const i=gu(this,n);for(const s of this.ptrs)s.addOut(e,t,i);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const n of this.ptrs)n.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,n)=>(t.some(i=>np(i,n))||t.push(n.trim()),t),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(const n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const n of e)yield t.clone({ptrs:[n]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,n=[...e].map(i=>new fu({dataset:t,factory:this.factory,term:i}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}pt("http://www.w3.org/2002/07/owl#");const or=pt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),ip=pt("http://www.w3.org/2000/01/rdf-schema#"),ae=pt("http://www.w3.org/ns/shacl#"),da=pt("https://schemas.link/shacl-next#"),Ua=pt("http://www.w3.org/2001/XMLSchema#");function sp(r){return r?`{${[...r.quads()].map(e=>at(e)).join(" ")}}`:"{}"}function ap(r){return r?`{${r.map(e=>sp(e)).join(" ")}}`:"{}"}var Ps,mu;function op(){if(mu)return Ps;mu=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Ps=e,Ps}var Ms,yu;function lp(){if(yu)return Ms;yu=1;var r=op(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Ms=t,Ms}var Bs,bu;function up(){if(bu)return Bs;bu=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Bs=r,Bs}var qs,_u;function cp(){if(_u)return qs;_u=1;var r=typeof xr=="object"&&xr&&xr.Object===Object&&xr;return qs=r,qs}var Us,wu;function dp(){if(wu)return Us;wu=1;var r=cp(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Us=t,Us}var Hs,vu;function Xc(){if(vu)return Hs;vu=1;var r=dp(),e=r.Symbol;return Hs=e,Hs}var Vs,xu;function hp(){if(xu)return Vs;xu=1;var r=Xc(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function s(a){var o=t.call(a,i),u=a[i];try{a[i]=void 0;var l=!0}catch{}var c=n.call(a);return l&&(o?a[i]=u:delete a[i]),c}return Vs=s,Vs}var Gs,Eu;function fp(){if(Eu)return Gs;Eu=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Gs=t,Gs}var Ws,Su;function pp(){if(Su)return Ws;Su=1;var r=Xc(),e=hp(),t=fp(),n="[object Null]",i="[object Undefined]",s=r?r.toStringTag:void 0;function a(o){return o==null?o===void 0?i:n:s&&s in Object(o)?e(o):t(o)}return Ws=a,Ws}var zs,Nu;function gp(){if(Nu)return zs;Nu=1;function r(e){return e!=null&&typeof e=="object"}return zs=r,zs}var Xs,Iu;function mp(){if(Iu)return Xs;Iu=1;var r=pp(),e=gp(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return Xs=n,Xs}var Qs,Ru;function yp(){if(Ru)return Qs;Ru=1;var r=lp(),e=up(),t=mp(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var d=s.test(l);return d||a.test(l)?o(l.slice(2),d?2:8):i.test(l)?n:+l}return Qs=u,Qs}var Js,Tu;function bp(){if(Tu)return Js;Tu=1;var r=yp(),e=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===e||i===-e){var s=i<0?-1:1;return s*t}return i===i?i:0}return Js=n,Js}var Ks,Au;function _p(){if(Au)return Ks;Au=1;var r=bp();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return Ks=e,Ks}var Ys,Du;function wp(){if(Du)return Ys;Du=1;var r=_p(),e="Expected a function";function t(n,i){var s;if(typeof i!="function")throw new TypeError(e);return n=r(n),function(){return--n>0&&(s=i.apply(this,arguments)),n<=1&&(i=void 0),s}}return Ys=t,Ys}var Zs,Ou;function vp(){if(Ou)return Zs;Ou=1;var r=wp();function e(t){return r(2,t)}return Zs=e,Zs}var xp=vp();const yt=rd(xp);let Lu=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=yt(()=>!this.results.some(s=>s.severity.equals(ae.Info)||s.severity.equals(ae.Violation)||s.severity.equals(ae.Warning))),this._ptr=yt(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new ti({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([or.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ua.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Ep(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=at(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Sp=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:u,shape:l,source:c=[],value:d,valuePaths:m=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=i,this.path=a||l.path,this.results=o,this.severity=u,this.shape=l,this.source=c,this.value=d,this.valuePaths=m,this._message=yt(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),s.map(b=>n.literal(Ep(b.value,e),b.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([or.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const n=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],n(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(i=>n(i).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const i of this.results)e.addOut([ae.detail],[this.factory.blankNode()],s=>{i.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Ha{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new Lu({factory:e,options:n}),results:a=new Map,shape:o,value:u,valueOrNode:l,valuePaths:c,values:d}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=u,this.valuePaths=c,this.valueOrNode=l,this.values=d}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:i=this.value,valueOrNode:s=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new Ha({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Lu({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:i,valueOrNode:s,valuePaths:a,values:o})}id({shape:e=this.shape}={}){return`${at(e.ptr.term)} - ${at(this.focusNode.term)} - ${ap(this.valuePaths)}`}result(e){const t=new Sp({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),n=this.id();this.results.has(n)?this.results.get(n).add(t):this.results.set(n,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:da.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:da.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ae.Violation,...t})}}function Np(){return{generic:Ip()}}function Ip(){return r=>{r.trace(da.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Rp{constructor(e){this.validations=new Cr(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const i=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(s.term);a&&(i.add(a),s.term.equals(ae.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&i.add(Np),[...i].map(s=>s(e)).filter(Boolean)}}var Zt={},er={},rn={},nn={},Cu;function Ar(){if(Cu)return nn;Cu=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.Translator=void 0;let r=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,n,i){for(const s of n)this.supportedRdfDatatypes.push(s),this.fromRdfHandlers[s.value]=t;for(const s of i){let a=this.toRdfHandlers[s];a||(this.toRdfHandlers[s]=a=[]),a.push(t)}}fromRdf(t,n){const i=this.fromRdfHandlers[t.datatype.value];return i?i.fromRdf(t,n):t.value}toRdf(t,n){const i=this.toRdfHandlers[typeof t];if(i)for(const s of i){const a=s.toRdf(t,n);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return nn.Translator=r,nn}var ju;function Tp(){if(ju)return rn;ju=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.TypeHandlerBoolean=void 0;const r=Ar();let e=class Qc{fromRdf(n,i){switch(n.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return i&&r.Translator.incorrectRdfDataType(n),!1}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(n?"true":"false",i||s.namedNode(Qc.TYPE))}};return rn.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",rn}var sn={},$u;function Ap(){if($u)return sn;$u=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.TypeHandlerDate=void 0;const r=Ar();let e=class ha{fromRdf(n,i){switch(i&&!n.value.match(ha.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&r.Translator.incorrectRdfDataType(n),n.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(n.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const s=n.value.split("-");return new Date(0,parseInt(s[0],10)-1,parseInt(s[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(n.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(n.value+"-01");default:return new Date(n.value)}}toRdf(n,{datatype:i,dataFactory:s}){if(i=i||s.namedNode(ha.TYPES[0]),!(n instanceof Date))return null;const a=n;let o;switch(i.value){case"http://www.w3.org/2001/XMLSchema#gDay":o=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":o=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":o=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":o=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":o=a.toISOString().replace(/T.*$/,"");break;default:o=a.toISOString()}return s.literal(o,i)}};return sn.TypeHandlerDate=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#dateTime","http://www.w3.org/2001/XMLSchema#date","http://www.w3.org/2001/XMLSchema#gDay","http://www.w3.org/2001/XMLSchema#gMonthDay","http://www.w3.org/2001/XMLSchema#gYear","http://www.w3.org/2001/XMLSchema#gYearMonth"],e.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/},sn}var an={},Fu;function Dp(){if(Fu)return an;Fu=1,Object.defineProperty(an,"__esModule",{value:!0}),an.TypeHandlerNumberDouble=void 0;const r=Ar();let e=class Jc{fromRdf(n,i){const s=parseFloat(n.value);return i&&isNaN(s)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return i=i||s.namedNode(Jc.TYPES[0]),isNaN(n)?s.literal("NaN",i):isFinite(n)?n%1===0?null:s.literal(n.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i):s.literal(n>0?"INF":"-INF",i)}};return an.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],an}var on={},ku;function Op(){if(ku)return on;ku=1,Object.defineProperty(on,"__esModule",{value:!0}),on.TypeHandlerNumberInteger=void 0;const r=Ar();let e=class hn{fromRdf(n,i){const s=parseInt(n.value,10);return i&&(isNaN(s)||n.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(String(n),i||(n<=hn.MAX_INT&&n>=hn.MIN_INT?s.namedNode(hn.TYPES[0]):s.namedNode(hn.TYPES[1])))}};return on.TypeHandlerNumberInteger=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#positiveInteger","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedShort"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,on}var ln={},Pu;function Lp(){if(Pu)return ln;Pu=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return ln.TypeHandlerString=r,r.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],ln}var Mu;function Bu(){return Mu||(Mu=1,function(r){var e=er&&er.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=er&&er.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Tp(),r),t(Ap(),r),t(Dp(),r),t(Op(),r),t(Lp(),r)}(er)),er}var ea={},qu;function Cp(){return qu||(qu=1,Object.defineProperty(ea,"__esModule",{value:!0})),ea}var Uu;function jp(){return Uu||(Uu=1,function(r){var e=Zt&&Zt.__createBinding||(Object.create?function(b,_,x,E){E===void 0&&(E=x);var v=Object.getOwnPropertyDescriptor(_,x);(!v||("get"in v?!_.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return _[x]}}),Object.defineProperty(b,E,v)}:function(b,_,x,E){E===void 0&&(E=x),b[E]=_[x]}),t=Zt&&Zt.__exportStar||function(b,_){for(var x in b)x!=="default"&&!Object.prototype.hasOwnProperty.call(_,x)&&e(_,b,x)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=u,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=d,r.getSupportedJavaScriptPrimitives=m;const n=kc(),i=Bu(),s=Ar();t(Bu(),r),t(Cp(),r),t(Ar(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(b=>a.namedNode(b)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(b=>a.namedNode(b)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(b=>a.namedNode(b)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(b=>a.namedNode(b)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(b=>a.namedNode(b)),["object"]);function u(b,_){return o.fromRdf(b,_)}function l(b,_){return _&&"namedNode"in _&&(_={dataFactory:_}),_=_||{},_&&!_.dataFactory&&(_.dataFactory=a),o.toRdf(b,_)}function c(b,_){return b.termType==="Literal"?u(b,_):b.value}function d(){return o.getSupportedRdfDatatypes()}function m(){return o.getSupportedJavaScriptPrimitives()}}(Zt)),Zt}var xn=jp();function Hu(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const n=r.out([ae.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=r.out([ae.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=r.out([ae.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function $p(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Hu(e)):[Hu(r)]}class Fp{constructor(e){this.shape=e,this._compiled=yt(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const n of this.compiled)n.node&&await n.node(t),n.generic&&await n.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const n=t.node(new ht(t.terms)),i=[...t].reduce((a,o)=>{const u=o.term,l=t.node([u]);return a.has(u)||a.set(u,{value:l,valuePaths:[]}),a.get(u).valuePaths.push(o),a},new Cr).values(),s=e.create({shape:this.shape,values:n});for(const a of this.compiled)a.property&&await a.property(s);for(const{value:a,valuePaths:o}of i){const u=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const l of this.compiled)l.generic&&await l.generic(u)}}}function fa(r){const e=new ht,n=new ti({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[ip.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class kp{constructor(e){this.targetClass=new ht([...fa(e.hasOut([or.type],[ae.NodeShape])),...fa(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([or.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],i=e.focusNode.clone({ptrs:n});return i.node([...new ht(i.terms)])}}class Pp{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=yt(()=>{const n=this.ptr.out([ae.deactivated]).term;return n&&xn.fromRdf(n)}),this._message=yt(()=>this.ptr.out([ae.message]).terms),this._path=yt(()=>$p(this.ptr.out([ae.path]))),this._severity=yt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=yt(()=>new Fp(this)),this._sparql=yt(()=>this.ptr.out([ae.sparql])),this._targetResolver=yt(()=>new kp(this.ptr))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!this.path}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Mp(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Bp(e)}}function Bp(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function qp(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Up(e)}}function Up(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Hp(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Vp(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function pi(r,e){return Promise.all(r.map(e))}async function Gp(r,e){for(const t of r)if(await e(t))return!0;return!1}function Wp(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:zp(e)}}function zp(r){return async e=>{const t=await pi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.every(i=>i.conforms);e.test(n,ae.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function Xp(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Qp(e)}}function Qp(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!t.conforms;e.test(n,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function Jp(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Kp(e)}}function Kp(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await pi(r,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=i.flatMap(s=>s.results),n=i.some(s=>s.conforms)}else n=await Gp(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(n,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function Yp(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Zp(e)}}function Zp(r){return async e=>{const t=await pi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.filter(i=>i.conforms).length===1;e.test(n,ae.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function eg(r){if(!xn.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(s=>r.validator.shape(s)),n=new ht(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new ht([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(s=>s.term));return{node:tg(n,i)}}function tg(r,e){return t=>{const n=t.focusNode.execute({start:"subject",end:"predicate"}).filter(i=>e.has(i.term)?!1:!r.has(i.term));if(n.ptrs.length>0)for(const i of n)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[i.term]}],value:t.focusNode.node([[...i.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function rg(r){const e=r.ptr.out([ae.hasValue]).term;return{node:ng(e),property:ig(e)}}function ng(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function ig(r){return e=>{const t=[...e.values].some(n=>r.equals(n.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function sg(r){const e=new ht([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:ag(e)}}function ag(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function jr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Vu(r)!==Vu(e))return null;const t=xn.fromRdf(r),n=xn.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function Vu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ua.dateTime.equals(r.datatype)&&e.test(r.value)}function og(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:lg(e)}}function lg(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function ug(r){const e=r.ptr.out([ae.equals]).term;return{node:cg(e),property:dg(e)}}function cg(r){return e=>{const t=e.focusNode.out([r]),n=t.filter(s=>!s.term.equals(e.focusNode.term)),i=t.terms.length!==0&&n.terms.length===0;e.test(i,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:n.terms[0]&&e.focusNode.node([n.terms[0]])||e.focusNode})}}function dg(r){return e=>{const t=new ht(e.focusNode.out([r]).terms),n=new ht(e.values.terms),i=[...n].filter(o=>!t.has(o)),s=[...t].filter(o=>!n.has(o)),a=[...i,...s];for(const o of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function hg(r){const e=r.ptr.out([ae.lessThan]).term;return{property:fg(e)}}function fg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=jr(n.term,i);s===null||s>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}}}function pg(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:gg(e)}}function gg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=jr(n.term,i);s===null||s>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}}}function mg(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:yg(e)}}function yg(r){return e=>{const t=jr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function bg(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:_g(e)}}function _g(r){return e=>{const t=jr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function wg(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:vg(e)}}function vg(r){return e=>{const t=jr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function xg(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Eg(e)}}function Eg(r){return e=>{const t=jr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Sg(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Ng(e)}}function Ng(r){return async e=>{for(const t of r){const n=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(n.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:n.report.results,value:e.valueOrNode})}}}function Ig(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Rg(e)}}function Rg(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Tg(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,n=t?xn.fromRdf(t):!1,i=r.ptr.out([ae.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:Ag(e,n,s,o)}}function Ag(r,e,t,n){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(u=>!u.term.equals(r.ptr.term)).map(u=>i.shape.validator.shape(u))));const o=(await Vp(i.values,async u=>{const l=(await r.validate(i.create({child:!0,focusNode:u}))).report;if(s.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const c=await pi([...a],async d=>(await d.validate(i.create({child:!0,focusNode:u}))).report);return s.push(c.flatMap(d=>d.results)),!c.every(d=>d.conforms)}else return!await Hp([...a],async c=>(await c.validate(i.create({child:!0,focusNode:u}))).report.conforms)})).length;t!==null&&i.test(o<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),n!==null&&i.test(o>=n,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:n,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function Dg(r,e){return e?e.slice(0,r.length)===r:!1}function Og(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:Lg(e)}}function Lg(r){return e=>{const t=r.some(n=>Dg(n,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Cg(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:jg(e)}}function jg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function $g(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Fg(e)}}function Fg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function kg(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,n=new RegExp(e,t);return{generic:Pg(e,t,n)}}function Pg(r,e,t){return n=>{n.test(t.test(n.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function Mg(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ua.boolean.equals(e.datatype)?{property:Bg()}:null}function Bg(){return r=>{const t=Object.entries(r.values.terms.reduce((n,i)=>(i.language&&(n[i.language]=(n[i.language]||0)+1),n),{})).filter(([,n])=>n>1);for(const[n]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:n},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const Qn=pt("http://www.w3.org/ns/shacl#"),Kc=pt("https://schemas.link/shacl-next#");class Dr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Qn.Info)||e.severity.equals(Qn.Violation)||e.severity.equals(Qn.Warning))}}function qg(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=at(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class ri{constructor({args:e={},factory:t,message:n=[],severity:i=Qn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(qg(s.value,e),s.language||null))}}class Va{constructor({factory:e=qa}={}){this.factory=e}clone({factory:e}={}){return new Va({factory:e||this.factory})}validate(){return new Dr}validateSimple(){return!0}}class $r extends Va{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const n of Array.isArray(e)?e:[e])n&&this.datatypes.push(this.factory.fromTerm(n))}clone({factory:e}={}){return new $r({datatypes:this.datatypes,factory:e||this.factory})}}class Ug{constructor({factory:e=qa,validations:t}={}){if(this.factory=e,this.validations=new Cr,t)for(const n of Object.values(t)){const i=n.clone({factory:this.factory});for(const s of i.datatypes)this.validations.set(s,i)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Dr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends $r{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(n=>{let i;n.test(e.value)&&(i=Kc.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new ri({args:s,factory:this.factory,message:this.message,severity:i})});return new Dr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Hg=/^([-+]?[0-9]+)$/;class it extends Pe{constructor(e=null,t=null,n,{factory:i}={}){super(Hg,n,{factory:i}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new it(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Kc.Debug.equals(t[0].severity))return new Dr({results:t});const n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){const i=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ri({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&n>this.maxInclusive){const i=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ri({factory:this.factory,message:s}))}return new Dr({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Ga extends $r{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Ga(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(n)];t.push(new ri({factory:this.factory,message:i}))}return new Dr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Te={xsd:pt("http://www.w3.org/2001/XMLSchema#")},Vg=new $r({datatypes:Te.xsd.anySimpleType}),Gg=new $r({datatypes:Te.xsd.anyAtomicType}),gi=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Wg=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Yc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Wa=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,Zc=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,zg=/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Xg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Qg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Jg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Kg=/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Yg=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Zg=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,em=/^(([0-9a-fA-F]{2})*)$/,tm=/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,rm=new Pe(gi,Te.xsd.string),nm=new Ga(["1","true","0","false"],Te.xsd.boolean),im=new Pe(Wg,Te.xsd.decimal),sm=new Pe(Yc,Te.xsd.float),am=new Pe(Yc,Te.xsd.double),om=new Pe(Wa,Te.xsd.duration),lm=new Pe(Zc,Te.xsd.dateTime),um=new Pe(zg,Te.xsd.time),cm=new Pe(Xg,Te.xsd.date),dm=new Pe(Qg,Te.xsd.gYearMonth),hm=new Pe(Jg,Te.xsd.gYear),fm=new Pe(Kg,Te.xsd.gMonthDay),pm=new Pe(Yg,Te.xsd.gDay),gm=new Pe(Zg,Te.xsd.gMonth),mm=new Pe(em,Te.xsd.hexBinary),ym=new Pe(tm,Te.xsd.base64Binary),bm=new Pe(gi,Te.xsd.anyURI),ed=/^([^\u000d\u000a\u0009]*)$/,_m=/^([^ ]+( [^ ]+)*)*$/,wm=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,vm=/^([^DT]*)$/,xm=/^([^YM]*[DT].*)$/,Em=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Sm=new Pe([gi,ed],Te.xsd.normalizedString),Nm=new Pe([gi,ed,_m],Te.xsd.token),Im=new Pe(wm,Te.xsd.language),Rm=new it(null,null,Te.xsd.integer),Tm=new it(null,"0",Te.xsd.nonPositiveInteger),Am=new it(null,"-1",Te.xsd.negativeInteger),Dm=new it("-9223372036854775808","9223372036854775807",Te.xsd.long),Om=new it("-2147483648","2147483647",Te.xsd.int),Lm=new it("-32768","32767",Te.xsd.short),Cm=new it("-128","127",Te.xsd.byte),jm=new it("0",null,Te.xsd.nonNegativeInteger),$m=new it("0","18446744073709551615",Te.xsd.unsignedLong),Fm=new it("0","4294967295",Te.xsd.unsignedInt),km=new it("0","65535",Te.xsd.unsignedShort),Pm=new it("0","255",Te.xsd.unsignedByte),Mm=new it("1",null,Te.xsd.positiveInteger),Bm=new Pe([Wa,vm],Te.xsd.yearMonthDuration),qm=new Pe([Wa,xm],Te.xsd.dayTimeDuration),Um=new Pe([Zc,Em],Te.xsd.dateTimeStamp),Hm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Gg,anySimpleType:Vg,anyURI:bm,base64Binary:ym,boolean:nm,byte:Cm,date:cm,dateTime:lm,dateTimeStamp:Um,dayTimeDuration:qm,decimal:im,double:am,duration:om,float:sm,gDay:pm,gMonth:gm,gMonthDay:fm,gYear:hm,gYearMonth:dm,hexBinary:mm,int:Om,integer:Rm,language:Im,long:Dm,negativeInteger:Am,nonNegativeInteger:jm,nonPositiveInteger:Tm,normalizedString:Sm,positiveInteger:Mm,short:Lm,string:rm,time:um,token:Nm,unsignedByte:Pm,unsignedInt:Fm,unsignedLong:$m,unsignedShort:km,yearMonthDuration:Bm},Symbol.toStringTag,{value:"Module"}));class Vm extends Ug{constructor({factory:e}={}){super({factory:e,validations:{...Hm}})}}const Gm=new Cr([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function Wm(r){const e=r.ptr.out([ae.class]).map(t=>fa(t));return{generic:zm(e)}}function zm(r){return e=>{const t=new ht(e.valueOrNode.out([or.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Xm(r){const e=r.ptr.out([ae.datatype]).term,t=new Vm;return{generic:Qm(e,t)}}function Qm(r,e){return t=>{const n=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(n,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function Jm(r){const e=r.ptr.out([ae.nodeKind]).term,t=Gm.get(e);return{generic:Km(e,t)}}function Km(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const Ym=new Cr([[ae.maxCount,Mp],[ae.minCount,qp],[ae.and,Wp],[ae.not,Xp],[ae.or,Jp],[ae.xone,Yp],[ae.closed,eg],[ae.hasValue,rg],[ae.in,sg],[ae.disjoint,og],[ae.equals,ug],[ae.lessThan,hg],[ae.lessThanOrEquals,pg],[ae.maxExclusive,mg],[ae.maxInclusive,bg],[ae.minExclusive,wg],[ae.minInclusive,xg],[ae.node,Sg],[ae.property,Ig],[ae.qualifiedValueShape,Tg],[ae.languageIn,Og],[ae.maxLength,Cg],[ae.minLength,$g],[ae.pattern,kg],[ae.uniqueLang,Mg],[ae.class,Wm],[ae.datatype,Xm],[ae.nodeKind,Jm]]);class Zm{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Rp(Ym),this.shapesPtr=new ti({dataset:e,factory:t}),this.shapes=new Cr,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[s,a]of this.options.validations)this.registry.validations.set(s,a);const i=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([or.type],[ae.NodeShape]),...this.shapesPtr.hasOut([or.type],[ae.PropertyShape])];for(const s of i)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Pp(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new ti({...e,factory:this.factory}),i=new Ha({factory:this.factory,focusNode:n,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const a=i.create({shape:s});let o;n.isAny()?o=s.resolveTargets(a):o=n;for(const u of o)await s.validate(a.create({focusNode:u}))}return i.report}}let ey=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new ou(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(n=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:n.conforms,report:n}}))}).catch(n=>{console.warn(n)})})}static get observedAttributes(){return ou.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(n=>{this.form.classList.remove(n)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const n of Kd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Ht(e,this.config,this.config.attributes.valuesSubject?Re.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const n=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);n.addEventListener("click",i=>{i.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(n)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Re.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,Jn)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}},200)}serialize(e="text/turtle",t=this.toRDF()){const n=t.getQuads(null,null,null,null);return zd(n,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){Jd(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Uf(e),this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape?.toRDF(this.config.store),this.shape&&this.config.store.add(new ii(this.shape.shaclSubject,Re.namedNode(xe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,n=await new Zm(t,{details:!0,factory:Re}).validate({dataset:t});for(const i of n.results)if(i.focusNode?.ptrs?.length)for(const s of i.focusNode.ptrs){const a=s._term;if(i.path?.length){const o=i.path[0].predicates[0];let u=this.form.querySelectorAll(`
370
370
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
371
371
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor,
372
372
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
373
373
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor`);u.length===0&&(u=this.form.querySelectorAll(`
374
374
  :scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'],
375
375
  :scope [data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}']`));for(const l of u)if(l.classList.contains("editor")){if(!e||l.value){let c=l.parentElement;c.classList.add("invalid"),c.classList.remove("valid"),c.appendChild(this.createValidationErrorDisplay(i));do c instanceof ot&&(c.open=!0),c=c.parentElement;while(c)}}else e||(l.classList.add("invalid"),l.classList.remove("valid"),l.appendChild(this.createValidationErrorDisplay(i,"node")))}else e||this.form.querySelector(`:scope [data-node-id='${a.id}']`)?.prepend(this.createValidationErrorDisplay(i,"node"))}return n}catch(t){return console.error(t),!1}}createValidationErrorDisplay(e,t){const n=document.createElement("span");if(n.classList.add("validation-error"),t&&n.classList.add(t),e)if(e.message?.length>0)for(const i of e.message)n.title+=i.value+`
376
- `;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Re.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,Pn,null).length===0){console.warn(`shapes graph does not contain requested root shape ${this.config.attributes.shapeSubject}`);return}}else if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,vt)>0){const t=Re.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,tt,null,vt),...this.config.store.getQuads(t,na,null,vt)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${na.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,tt,Pn,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,_n,n[0].object,null);if(i.length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);return}if(i.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${i[0].subject})`),this.config.store.getQuads(i[0].subject,tt,Pn,null).length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${i[0].subject})`);return}e=i[0].subject}}else{const t=this.config.store.getQuads(null,tt,Pn,null);if(t.length==0){console.warn("shapes graph does not contain any root shapes");return}t.length>1&&(console.warn("shapes graph contains",t.length,"root shapes. choosing first found which is",t[0].subject.value),console.info('hint: set the shape to use with attribute "data-shape-subject"')),e=t[0].subject}return e}removeFromDataGraph(e){this.config.attributes.valuesSubject;for(const t of this.config.store.getQuads(e,null,null,vt))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const ry=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
376
+ `;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Re.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,Pn,null).length===0){console.warn(`shapes graph does not contain requested root shape ${this.config.attributes.shapeSubject}`);return}}else if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,vt)>0){const t=Re.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,tt,null,vt),...this.config.store.getQuads(t,na,null,vt)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${na.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,tt,Pn,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,_n,n[0].object,null);if(i.length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);return}if(i.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${i[0].subject})`),this.config.store.getQuads(i[0].subject,tt,Pn,null).length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${i[0].subject})`);return}e=i[0].subject}}else{const t=this.config.store.getQuads(null,tt,Pn,null);if(t.length==0){console.warn("shapes graph does not contain any root shapes");return}t.length>1&&(console.warn("shapes graph contains",t.length,"root shapes. choosing first found which is",t[0].subject.value),console.info('hint: set the shape to use with attribute "data-shape-subject"')),e=t[0].subject}return e}removeFromDataGraph(e){this.config.attributes.valuesSubject;for(const t of this.config.store.getQuads(e,null,null,vt))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const ty=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
377
377
  .property-instance label { display: inline-flex; word-break: break-word; line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }
378
378
  .property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
379
379
  .mode-edit .property-instance label { width: var(--label-width); }
380
- `;class ny extends Gd{constructor(e){super(e||ry),this.idCtr=0}createDefaultTemplate(e,t,n,i,s){i.id=`e${this.idCtr++}`,i.classList.add("editor"),s?.datatype?i.shaclDatatype=s.datatype:t instanceof ct&&(i.shaclDatatype=t.datatype),s?.minCount!==void 0&&(i.dataset.minCount=String(s.minCount)),s?.class&&(i.dataset.class=s.class.value),s?.nodeKind?i.dataset.nodeKind=s.nodeKind.value:t instanceof ni&&(i.dataset.nodeKind=xe+"IRI"),(s?.hasValue||s?.readonly)&&(i.disabled=!0),i.value=t?.value||s?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=i.id,a.innerText=e,s?.description&&a.setAttribute("title",s.description.value);const o=s?.description?s.description.value:s?.pattern?s.pattern:null;o&&i.setAttribute("placeholder",o),n&&(i.setAttribute("required","true"),a.classList.add("required"));const u=document.createElement("div");return u.appendChild(a),u.appendChild(i),u}createDateEditor(e,t,n,i){const s=new Ue;i.datatype?.value===Ut+"dateTime"?(s.type="datetime-local",s.setAttribute("step","1")):s.type="date",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=this.createDefaultTemplate(e,null,n,s,i);if(t)try{let o=new Date(t.value).toISOString();i.datatype?.value===Ut+"dateTime"?o=o.slice(0,19):o=o.slice(0,10),s.value=o}catch(o){console.error(o,t)}return a}createTextEditor(e,t,n,i){let s;return i.singleLine===!1?(s=new sr,s.resize="auto"):s=new Ue,s.dense=!0,i.pattern&&(s.pattern=i.pattern),i.minLength&&(s.minLength=i.minLength),i.maxLength&&(s.maxLength=i.maxLength),this.createDefaultTemplate(e,t,n,s,i)}createLangStringEditor(e,t,n,i){const s=this.createTextEditor(e,t,n,i),a=s.querySelector(":scope .editor");let o;if(i.languageIn?.length){o=document.createElement("select");for(const u of i.languageIn){const l=document.createElement("option");l.innerText=u.value,o.appendChild(l)}}else o=document.createElement("input"),o.maxLength=5,o.size=5,o.placeholder="lang?";return o.title="Language of the text",o.classList.add("lang-chooser"),o.slot="suffix",o.addEventListener("change",u=>{u.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof ct&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),s}createBooleanEditor(e,t,n,i){const s=document.createElement("input");s.type="checkbox",s.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,n,s,i);return s.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof ct&&(s.checked=t.value==="true"),a}createFileEditor(e,t,n,i){const s=document.createElement("input");return s.type="file",s.addEventListener("change",a=>{if(s.files?.length){a.stopPropagation();const o=new FileReader;o.readAsDataURL(s.files[0]),o.onload=()=>{s.binaryData=btoa(o.result),s.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else s.binaryData=void 0}),this.createDefaultTemplate(e,t,n,s,i)}createNumberEditor(e,t,n,i){const s=new Ue;s.type="number",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=i.minInclusive!==void 0?i.minInclusive:i.minExclusive!==void 0?i.minExclusive+1:void 0,o=i.maxInclusive!==void 0?i.maxInclusive:i.maxExclusive!==void 0?i.maxExclusive-1:void 0;return a!==void 0&&(s.min=String(a)),o!==void 0&&(s.max=String(o)),i.datatype?.value!==Ut+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new We;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),u=document.createElement("ul");let l=!0;const c=(d,m)=>{const b=document.createElement("li");if(typeof d.value=="string"?(b.dataset.value=d.value,b.innerText=d.label?d.label:d.value):(d.value instanceof ct&&d.value.datatype.equals(kd)?b.dataset.value=d.value.value:b.dataset.value=d.value.id,b.innerText=d.label?d.label:d.value.value),m.appendChild(b),d.children?.length){l=!1;const _=document.createElement("ul");b.appendChild(_);for(const x of d.children)c(x,_)}};for(const d of i)c(d,u);return l||(a.collapse=!0),a.appendChild(u),t&&(a.value=t.value),o}createButton(e,t){const n=document.createElement("button");return n.type="button",n.innerHTML=e,n}}class iy extends ty{constructor(){super(new ny)}}window.customElements.define("shacl-form",iy);export{ou as Config,Uf as Loader,hy as Plugin,iy as ShaclForm,Hd as ShaclPropertyTemplate,Gd as Theme,Sn as findLabel,Jd as registerPlugin,Hf as setSharedShapesGraph};
380
+ `;class ry extends Gd{constructor(e){super(e||ty),this.idCtr=0}createDefaultTemplate(e,t,n,i,s){i.id=`e${this.idCtr++}`,i.classList.add("editor"),s?.datatype?i.shaclDatatype=s.datatype:t instanceof ct&&(i.shaclDatatype=t.datatype),s?.minCount!==void 0&&(i.dataset.minCount=String(s.minCount)),s?.class&&(i.dataset.class=s.class.value),s?.nodeKind?i.dataset.nodeKind=s.nodeKind.value:t instanceof ni&&(i.dataset.nodeKind=xe+"IRI"),(s?.hasValue||s?.readonly)&&(i.disabled=!0),i.value=t?.value||s?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=i.id,a.innerText=e,s?.description&&a.setAttribute("title",s.description.value);const o=s?.description?s.description.value:s?.pattern?s.pattern:null;o&&i.setAttribute("placeholder",o),n&&(i.setAttribute("required","true"),a.classList.add("required"));const u=document.createElement("div");return u.appendChild(a),u.appendChild(i),u}createDateEditor(e,t,n,i){const s=new Ue;i.datatype?.value===Ut+"dateTime"?(s.type="datetime-local",s.setAttribute("step","1")):s.type="date",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=this.createDefaultTemplate(e,null,n,s,i);if(t)try{let o=new Date(t.value).toISOString();i.datatype?.value===Ut+"dateTime"?o=o.slice(0,19):o=o.slice(0,10),s.value=o}catch(o){console.error(o,t)}return a}createTextEditor(e,t,n,i){let s;return i.singleLine===!1?(s=new sr,s.resize="auto"):s=new Ue,s.dense=!0,i.pattern&&(s.pattern=i.pattern),i.minLength&&(s.minLength=i.minLength),i.maxLength&&(s.maxLength=i.maxLength),this.createDefaultTemplate(e,t,n,s,i)}createLangStringEditor(e,t,n,i){const s=this.createTextEditor(e,t,n,i),a=s.querySelector(":scope .editor");let o;if(i.languageIn?.length){o=document.createElement("select");for(const u of i.languageIn){const l=document.createElement("option");l.innerText=u.value,o.appendChild(l)}}else o=document.createElement("input"),o.maxLength=5,o.size=5,o.placeholder="lang?";return o.title="Language of the text",o.classList.add("lang-chooser"),o.slot="suffix",o.addEventListener("change",u=>{u.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof ct&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),s}createBooleanEditor(e,t,n,i){const s=document.createElement("input");s.type="checkbox",s.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,n,s,i);return s.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof ct&&(s.checked=t.value==="true"),a}createFileEditor(e,t,n,i){const s=document.createElement("input");return s.type="file",s.addEventListener("change",a=>{if(s.files?.length){a.stopPropagation();const o=new FileReader;o.readAsDataURL(s.files[0]),o.onload=()=>{s.binaryData=btoa(o.result),s.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else s.binaryData=void 0}),this.createDefaultTemplate(e,t,n,s,i)}createNumberEditor(e,t,n,i){const s=new Ue;s.type="number",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=i.minInclusive!==void 0?i.minInclusive:i.minExclusive!==void 0?i.minExclusive+1:void 0,o=i.maxInclusive!==void 0?i.maxInclusive:i.maxExclusive!==void 0?i.maxExclusive-1:void 0;return a!==void 0&&(s.min=String(a)),o!==void 0&&(s.max=String(o)),i.datatype?.value!==Ut+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new We;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),u=document.createElement("ul");let l=!0;const c=(d,m)=>{const b=document.createElement("li");if(typeof d.value=="string"?(b.dataset.value=d.value,b.innerText=d.label?d.label:d.value):(d.value instanceof ct&&d.value.datatype.equals(kd)?b.dataset.value=d.value.value:b.dataset.value=d.value.id,b.innerText=d.label?d.label:d.value.value),m.appendChild(b),d.children?.length){l=!1;const _=document.createElement("ul");b.appendChild(_);for(const x of d.children)c(x,_)}};for(const d of i)c(d,u);return l||(a.collapse=!0),a.appendChild(u),t&&(a.value=t.value),o}createButton(e,t){const n=document.createElement("button");return n.type="button",n.innerHTML=e,n}}class ny extends ey{constructor(){super(new ry)}}window.customElements.define("shacl-form",ny);export{ou as Config,qf as Loader,dy as Plugin,ny as ShaclForm,Hd as ShaclPropertyTemplate,Gd as Theme,Sn as findLabel,Jd as registerPlugin,Uf as setSharedShapesGraph};