@ulb-darmstadt/shacl-form 3.4.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/mode-BCJW0E9O.js +13 -0
- package/dist/assets/mode-DZ8YP6FS.js +13 -0
- package/dist/assets/query-By3xRVyt.js +91 -0
- package/dist/assets/{query-Y4qLEXu3.js → query-DQqNKY7M.js} +2 -2
- package/dist/bundle.js +5 -5
- package/dist/index.js +3 -3
- package/dist/node-template.d.ts +1 -0
- package/dist/plugins/assets/{property-template-DgV0sNnv.js → property-template-D3YimlX8.js} +1 -1
- package/dist/plugins/file-upload.js +1 -1
- package/dist/plugins/leaflet.js +3 -3
- package/dist/property-template.d.ts +2 -0
- package/dist/query/index.d.ts +1 -0
- package/dist/sparql.js +1 -1
- package/package.json +1 -1
- package/dist/assets/mode-Bjl1P7KJ.js +0 -13
- package/dist/assets/mode-C_BqcQqf.js +0 -13
- package/dist/assets/query-DOX-ExQB.js +0 -91
package/dist/bundle.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{A as e,B as t,C as n,D as r,E as i,G as a,H as o,J as s,L as c,M as l,O as u,P as d,Q as f,R as p,S as m,T as ee,V as h,W as g,X as te,Y as ne,Z as re,_ as ie,_t as ae,at as oe,c as se,ct as _,d as v,dt as ce,et as le,f as ue,ft as y,g as de,gt as b,h as fe,ht as x,i as S,it as C,j as w,l as T,lt as E,m as D,mt as pe,n as me,ot as he,pt as ge,q as _e,r as ve,rt as ye,s as be,st as xe,t as Se,u as Ce,ut as we,w as Te,x as Ee,y as De,z as Oe}from"./assets/query-
|
|
1
|
+
import{A as e,B as t,C as n,D as r,E as i,G as a,H as o,J as s,L as c,M as l,O as u,P as d,Q as f,R as p,S as m,T as ee,V as h,W as g,X as te,Y as ne,Z as re,_ as ie,_t as ae,at as oe,c as se,ct as _,d as v,dt as ce,et as le,f as ue,ft as y,g as de,gt as b,h as fe,ht as x,i as S,it as C,j as w,l as T,lt as E,m as D,mt as pe,n as me,ot as he,pt as ge,q as _e,r as ve,rt as ye,s as be,st as xe,t as Se,u as Ce,ut as we,w as Te,x as Ee,y as De,z as Oe}from"./assets/query-DQqNKY7M.js";var ke=`
|
|
2
2
|
.editor:not([type='checkbox']) { border: 1px solid var(--shacl-border-color, #DDD); }
|
|
3
3
|
.property-instance label { display: inline-flex; align-self: center; word-break: break-word; line-height: 1em; padding-right: 1em; flex-shrink: 0; position: relative; }
|
|
4
4
|
.property-instance:has(> .editor:is(textarea, rokit-textarea)) > label { align-self: flex-start; padding-top: 0.45em; }
|
|
5
5
|
.property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
|
|
6
6
|
.mode-edit .property-instance label { width: var(--label-width); }
|
|
7
|
-
`,Ae=class extends r{constructor(e){super(e||ke),this.idCtr=0}createDefaultTemplate(e,t,n,r,i){let a=t??i?.defaultValue??null;if(r.id=`e${this.idCtr++}`,r.classList.add(`editor`),r.setAttribute(`part`,`editor`),i?.datatype?r.shaclDatatype=i.datatype:t instanceof ge&&(r.shaclDatatype=t.datatype),i&&l(i)>0&&(r.dataset.minCount=String(l(i))),i?.class&&(r.dataset.class=i.class.value),i?.nodeKind)r.dataset.nodeKind=i.nodeKind.value;else if(t&&(t instanceof pe||i?.nodeKind?.equals(C))&&(r.dataset.nodeKind=le+`IRI`,i)){let e=_e(i.config.store.getQuads(t,null,null,null),i.config.languages);e&&(t=y.literal(e))}(i?.hasValue&&t||i?.readonly)&&(r.disabled=!0);let o=t?.value||i?.defaultValue?.value||``;t instanceof ce?o=t.id:t instanceof pe&&i?.nodeKind?.value===`http://www.w3.org/ns/shacl#IRIOrLiteral`&&(o=`<${t.value}>`),i?.datatype?.equals(E)?r.checked=t?.value===`true`||i?.defaultValue?.value===`true`:r.type===`file`?r.binaryData=o||void 0:r.value=o,Te(r,a);let s=document.createElement(`label`);s.htmlFor=r.id,s.innerText=e,s.setAttribute(`part`,`label`),i?.description&&s.setAttribute(`title`,i.description.value);let c=i?.description?i.description.value:i?.pattern?i.pattern:null;c&&r.setAttribute(`placeholder`,c),n&&(r.setAttribute(`required`,`true`),s.classList.add(`required`));let u=document.createElement(`div`);return u.setAttribute(`part`,`field`),u.appendChild(s),u.appendChild(r),u}createDateEditor(e,t,n,r){let i=new fe;r.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?(i.type=`datetime-local`,i.setAttribute(`step`,`1`)):i.type=`date`,i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let a=this.createDefaultTemplate(e,null,n,i,r);if(t){let e=r.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?s(t.value):ne(t.value);e?(i.value=e.value,e.suffix&&(i.dataset.xsdTemporalSuffix=e.suffix)):console.error(`unable to parse xsd date literal`,t),Te(i,t)}return a}createTextEditor(e,t,n,r){let i;return r.singleLine===!1?(i=new ue,i.resize=`auto`):i=new fe,i.dense=this.dense,r.pattern&&(i.pattern=r.pattern),r.minLength&&(i.minLength=r.minLength),r.maxLength&&(i.maxLength=r.maxLength),this.createDefaultTemplate(e,t,n,i,r)}createLangStringEditor(e,t,n,r){let i=this.createTextEditor(e,t,n,r),a=i.querySelector(`:scope .editor`),o;if(r.languageIn?.length){o=document.createElement(`select`);for(let e of r.languageIn){let t=document.createElement(`option`);t.innerText=e.value,o.appendChild(t)}}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.setAttribute(`part`,`lang-chooser`),o.slot=`suffix`,a.addEventListener(`change`,()=>{o.required=a.value!==``}),o.addEventListener(`change`,e=>{e.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event(`change`,{bubbles:!0})))}),t instanceof ge&&(o.value=t.language),a.dataset.lang=o.value,Te(a,t??r.defaultValue),a.appendChild(o),i}createBooleanEditor(e,t,n,r){let i=document.createElement(`input`);i.type=`checkbox`,i.classList.add(`ml-0`);let a=this.createDefaultTemplate(e,null,n,i,r);return i.removeAttribute(`required`),a.querySelector(`:scope label`)?.classList.remove(`required`),t instanceof ge&&(i.checked=t.value===`true`,Te(i,t)),a}createFileEditor(e,t,n,r){let i=document.createElement(`input`);return i.type=`file`,i.addEventListener(`change`,e=>{if(i.files?.length){e.stopPropagation();let t=new FileReader;t.readAsDataURL(i.files[0]),t.onload=()=>{i.binaryData=btoa(t.result),i.parentElement?.dispatchEvent(new Event(`change`,{bubbles:!0}))}}else i.binaryData=void 0}),this.createDefaultTemplate(e,t,n,i,r)}createNumberEditor(e,t,n,r){let i=new fe,a=f.has(r.datatype?.value??``);i.type=a?`text`:`number`,a&&(i.pattern=r.datatype?.value===`http://www.w3.org/2001/XMLSchema#decimal`?`[+\\-]?(?:[0-9]+(?:[.,][0-9]*)?|[.,][0-9]+)`:`[+\\-]?(?:[0-9]+(?:[.,][0-9]*)?|[.,][0-9]+)(?:[eE][+\\-]?[0-9]+)?`,i.updateComplete.then(()=>{i.inputElement.inputMode=`decimal`})),i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let o=r.minInclusive===void 0?r.minExclusive===void 0?void 0:r.minExclusive+1:r.minInclusive,s=r.maxInclusive===void 0?r.maxExclusive===void 0?void 0:r.maxExclusive-1:r.maxInclusive;return o!==void 0&&(i.min=String(o)),s!==void 0&&(i.max=String(s)),!a&&r.datatype?.value!==`http://www.w3.org/2001/XMLSchema#integer`&&(i.step=`any`),this.createDefaultTemplate(e,t,n,i,r)}createListEditor(e,t,n,r,a){let o=new D;o.clearable=!0,o.dense=this.dense;let s=this.createDefaultTemplate(e,null,n,o,a),c=document.createElement(`ul`),l=[],u=!0,d=(e,t)=>{let n=document.createElement(`li`);if(typeof e.value==`string`?(n.dataset.value=e.value,n.innerText=e.label?e.label:e.value):(n.dataset.value=i(e.value),l.push(e.value),n.innerText=e.label?e.label:e.value.value),t.appendChild(n),e.children?.length){u=!1;let t=document.createElement(`ul`);n.appendChild(t);for(let n of e.children)d(n,t)}};for(let e of r)d(e,c);return u||(o.collapse=!0),o.appendChild(c),ee(o,l),t=t??a?.defaultValue??null,t&&(o.value=i(t),Te(o,t)),s}createButton(e,t){let n=new ie;return n.dense=this.dense,n.
|
|
7
|
+
`,Ae=class extends r{constructor(e){super(e||ke),this.idCtr=0}createDefaultTemplate(e,t,n,r,i){let a=t??i?.defaultValue??null;if(r.id=`e${this.idCtr++}`,r.classList.add(`editor`),r.setAttribute(`part`,`editor`),i?.datatype?r.shaclDatatype=i.datatype:t instanceof ge&&(r.shaclDatatype=t.datatype),i&&l(i)>0&&(r.dataset.minCount=String(l(i))),i?.class&&(r.dataset.class=i.class.value),i?.nodeKind)r.dataset.nodeKind=i.nodeKind.value;else if(t&&(t instanceof pe||i?.nodeKind?.equals(C))&&(r.dataset.nodeKind=le+`IRI`,i)){let e=_e(i.config.store.getQuads(t,null,null,null),i.config.languages);e&&(t=y.literal(e))}(i?.hasValue&&t||i?.readonly)&&(r.disabled=!0);let o=t?.value||i?.defaultValue?.value||``;t instanceof ce?o=t.id:t instanceof pe&&i?.nodeKind?.value===`http://www.w3.org/ns/shacl#IRIOrLiteral`&&(o=`<${t.value}>`),i?.datatype?.equals(E)?r.checked=t?.value===`true`||i?.defaultValue?.value===`true`:r.type===`file`?r.binaryData=o||void 0:r.value=o,Te(r,a);let s=document.createElement(`label`);s.htmlFor=r.id,s.innerText=e,s.setAttribute(`part`,`label`),i?.description&&s.setAttribute(`title`,i.description.value);let c=i?.description?i.description.value:i?.pattern?i.pattern:null;c&&r.setAttribute(`placeholder`,c),n&&(r.setAttribute(`required`,`true`),s.classList.add(`required`));let u=document.createElement(`div`);return u.setAttribute(`part`,`field`),u.appendChild(s),u.appendChild(r),u}createDateEditor(e,t,n,r){let i=new fe;r.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?(i.type=`datetime-local`,i.setAttribute(`step`,`1`)):i.type=`date`,i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let a=this.createDefaultTemplate(e,null,n,i,r);if(t){let e=r.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?s(t.value):ne(t.value);e?(i.value=e.value,e.suffix&&(i.dataset.xsdTemporalSuffix=e.suffix)):console.error(`unable to parse xsd date literal`,t),Te(i,t)}return a}createTextEditor(e,t,n,r){let i;return r.singleLine===!1?(i=new ue,i.resize=`auto`):i=new fe,i.dense=this.dense,r.pattern&&(i.pattern=r.pattern),r.minLength&&(i.minLength=r.minLength),r.maxLength&&(i.maxLength=r.maxLength),this.createDefaultTemplate(e,t,n,i,r)}createLangStringEditor(e,t,n,r){let i=this.createTextEditor(e,t,n,r),a=i.querySelector(`:scope .editor`),o;if(r.languageIn?.length){o=document.createElement(`select`);for(let e of r.languageIn){let t=document.createElement(`option`);t.innerText=e.value,o.appendChild(t)}}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.setAttribute(`part`,`lang-chooser`),o.slot=`suffix`,a.addEventListener(`change`,()=>{o.required=a.value!==``}),o.addEventListener(`change`,e=>{e.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event(`change`,{bubbles:!0})))}),t instanceof ge&&(o.value=t.language),a.dataset.lang=o.value,Te(a,t??r.defaultValue),a.appendChild(o),i}createBooleanEditor(e,t,n,r){let i=document.createElement(`input`);i.type=`checkbox`,i.classList.add(`ml-0`);let a=this.createDefaultTemplate(e,null,n,i,r);return i.removeAttribute(`required`),a.querySelector(`:scope label`)?.classList.remove(`required`),t instanceof ge&&(i.checked=t.value===`true`,Te(i,t)),a}createFileEditor(e,t,n,r){let i=document.createElement(`input`);return i.type=`file`,i.addEventListener(`change`,e=>{if(i.files?.length){e.stopPropagation();let t=new FileReader;t.readAsDataURL(i.files[0]),t.onload=()=>{i.binaryData=btoa(t.result),i.parentElement?.dispatchEvent(new Event(`change`,{bubbles:!0}))}}else i.binaryData=void 0}),this.createDefaultTemplate(e,t,n,i,r)}createNumberEditor(e,t,n,r){let i=new fe,a=f.has(r.datatype?.value??``);i.type=a?`text`:`number`,a&&(i.pattern=r.datatype?.value===`http://www.w3.org/2001/XMLSchema#decimal`?`[+\\-]?(?:[0-9]+(?:[.,][0-9]*)?|[.,][0-9]+)`:`[+\\-]?(?:[0-9]+(?:[.,][0-9]*)?|[.,][0-9]+)(?:[eE][+\\-]?[0-9]+)?`,i.updateComplete.then(()=>{i.inputElement.inputMode=`decimal`})),i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let o=r.minInclusive===void 0?r.minExclusive===void 0?void 0:r.minExclusive+1:r.minInclusive,s=r.maxInclusive===void 0?r.maxExclusive===void 0?void 0:r.maxExclusive-1:r.maxInclusive;return o!==void 0&&(i.min=String(o)),s!==void 0&&(i.max=String(s)),!a&&r.datatype?.value!==`http://www.w3.org/2001/XMLSchema#integer`&&(i.step=`any`),this.createDefaultTemplate(e,t,n,i,r)}createListEditor(e,t,n,r,a){let o=new D;o.clearable=!0,o.dense=this.dense;let s=this.createDefaultTemplate(e,null,n,o,a),c=document.createElement(`ul`),l=[],u=!0,d=(e,t)=>{let n=document.createElement(`li`);if(typeof e.value==`string`?(n.dataset.value=e.value,n.innerText=e.label?e.label:e.value):(n.dataset.value=i(e.value),l.push(e.value),n.innerText=e.label?e.label:e.value.value),t.appendChild(n),e.children?.length){u=!1;let t=document.createElement(`ul`);n.appendChild(t);for(let n of e.children)d(n,t)}};for(let e of r)d(e,c);return u||(o.collapse=!0),o.appendChild(c),ee(o,l),t=t??a?.defaultValue??null,t&&(o.value=i(t),Te(o,t)),s}createButton(e,t){let n=new ie;return n.dense=this.dense,n.textContent=e,t?(n.setAttribute(`primary`,``),n.setAttribute(`part`,`button primary`)):n.setAttribute(`part`,`button`),n}};function je(e){return`_:`+e.value}function Me(e,t){return[...e].map(e=>t(e)).join(`
|
|
8
8
|
`)+`
|
|
9
9
|
`}function Ne(){return``}function Pe(e){return`<`+e.value+`>`}var Fe=/["\\\\\n\r]/,Ie=/["\\\\\n\r]/g,Le={'"':`\\"`,"\\":`\\\\`,"\n":`\\n`,"\r":`\\r`};function Re(e){return Le[e]}function ze(e){return Fe.test(e)?e.replace(Ie,Re):e}function Be(e){let t=ze(e.value);return e.datatype.value===`http://www.w3.org/2001/XMLSchema#string`?`"`+t+`"`:e.datatype.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`?`"`+t+`"@`+e.language:`"`+t+`"^^`+Pe(e.datatype)}function Ve(e,t){let n=t(e.subject),r=t(e.predicate),i=t(e.object),a=t(e.graph);return`${n} ${r} ${i} ${a?a+` `:``}.`}function He(e){return`?`+e.value}function O(e){if(!e)return null;if(e.termType===`BlankNode`)return je(e);if(e.termType===`DefaultGraph`)return Ne();if(e.termType===`Literal`)return Be(e);if(e.termType===`NamedNode`)return Pe(e);if(e.termType===`Quad`||e.subject&&e.predicate&&e.object&&e.graph)return Ve(e,O);if(e.termType===`Variable`)return He(e);if(e[Symbol.iterator])return Me(e,O);throw Error(`unknown termType ${e.termType}`)}var Ue=class{constructor(e){if(this.index=new Map,e)for(let[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(O(e))}*entries(){for(let[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(let n of this.entries())e.call(t,n[1],n[0],this)}get(e){let t=this.index.get(O(e));return t&&t.value}has(e){return this.index.has(O(e))}*keys(){for(let[,{term:e}]of this.index)yield e}set(e,t){let n=O(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(let[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}},We=class{constructor({dataset:e,end:t,quad:n,start:r}){this.dataset=e,this.end=t,this.quad=n,this.start=r}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}};function Ge(e){try{return O(e)}catch{return null}}var k=class{constructor(e){if(this.index=new Map,e)for(let t of e)this.add(t)}get size(){return this.index.size}add(e){let t=O(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(Ge(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(Ge(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}},Ke=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Ke.prototype.termType=`BlankNode`;var qe=class{equals(e){return!!e&&e.termType===this.termType}};qe.prototype.termType=`DefaultGraph`,qe.prototype.value=``;function Je(e,t){if(!t)return null;if(t.termType===`BlankNode`)return e.blankNode(t.value);if(t.termType===`DefaultGraph`)return e.defaultGraph();if(t.termType===`Literal`)return e.literal(t.value,t.language||e.namedNode(t.datatype.value));if(t.termType===`NamedNode`)return e.namedNode(t.value);if(t.termType===`Quad`){let n=e.fromTerm(t.subject),r=e.fromTerm(t.predicate),i=e.fromTerm(t.object),a=e.fromTerm(t.graph);return e.quad(n,r,i,a)}if(t.termType===`Variable`)return e.variable(t.value);throw Error(`unknown termType ${t.termType}`)}var Ye=class{constructor(e,t,n,r=``){this.value=e,this.language=t,this.datatype=n,this.direction=r}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}};Ye.prototype.termType=`Literal`;var Xe=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Xe.prototype.termType=`NamedNode`;var Ze=class{constructor(e,t,n,r){this.subject=e,this.predicate=t,this.object=n,this.graph=r}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)}};Ze.prototype.termType=`Quad`,Ze.prototype.value=``;var Qe=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Qe.prototype.termType=`Variable`;var $e=new Xe(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),et=new Xe(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),tt=new Xe(`http://www.w3.org/2001/XMLSchema#string`),nt=class{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new qe}}namedNode(e){return new Xe(e)}blankNode(e){return e||=`b`+ ++this._data.blankNodeCounter,new Ke(e)}literal(e,t){return typeof t==`string`?new Ye(e,t,et):typeof t?.language==`string`?new Ye(e,t.language,t.direction?$e:et,t.direction):new Ye(e,``,t||tt)}variable(e){return new Qe(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,r=this.defaultGraph()){return new Ze(e,t,n,r)}fromTerm(e){return Je(this,e)}fromQuad(e){return Je(this,e)}};nt.exports=[`blankNode`,`defaultGraph`,`fromQuad`,`fromTerm`,`literal`,`namedNode`,`quad`,`variable`];var rt=new nt,it={apply:(e,t,n)=>e(n[0]),get:(e,t)=>e(t)};function A(e,{factory:t=rt}={}){let n=(n=``)=>t.namedNode(`${e}${n.raw||n}`);return typeof Proxy>`u`?n:new Proxy(n,it)}A(`http://www.w3.org/2001/XMLSchema#`);var j=A(`http://www.w3.org/1999/02/22-rdf-syntax-ns#`);A(`http://www.w3.org/2000/01/rdf-schema#`);var M=class e{static add({ptr:e,start:t,end:n,subjects:r=[null],predicates:i=[null],objects:a=[null],graphs:o,callback:s}={}){if(!e.factory)throw Error(`add operation requires a factory`);let c=()=>{};s&&(c=r=>{s(new We({dataset:e.dataset,start:t,end:n,quad:r}))});for(let n of r)for(let r of i)for(let i of a)for(let a of o){let o={subject:n,predicate:r,object:i,graph:a};o[t]=e.term;let s=e.factory.quad(o.subject,o.predicate,o.object,o.graph);e.dataset.add(s),c(s)}return e}static addList({ptr:e,predicates:t,items:n,graphs:r}){if(e.isAny())throw Error(`can't attach a list to an any ptr`);for(let i of t)for(let t of r){let r=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,i,r[0]||j.nil,t));for(let i=0;i<r.length;i++)e.dataset.add(e.factory.quad(r[i],j.first,n[i],t)),e.dataset.add(e.factory.quad(r[i],j.rest,r[i+1]||j.nil,t))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:r=[null],objects:i=[null]}){for(let a of n)for(let n of r)for(let r of i){let i={subject:a,predicate:n,object:r};i[t]=e.term;let o=e.dataset.match(i.subject,i.predicate,i.object);for(let t of o)e.dataset.delete(t)}return e}static deleteList({ptr:e,predicates:t}){let n=[];for(let r of t)for(let t of e.dataset.match(e.term,r)){let r=t.object;for(n.push(t);!j.nil.equals(r);){r=n[n.length-1].object;let t=e.dataset.match(r);if(t.size===0)break;for(let e of t)n.push(e)}}for(let t of n)e.dataset.delete(t);return e}static execute({ptr:t,operation:n=`traverse`,quantifier:r,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l,items:u,callback:d}={}){if(n===`add`)return e.add({ptr:t,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l,callback:d});if(n===`addList`)return e.addList({ptr:t,predicates:s,items:u,graphs:l});if(n===`delete`)return e.delete({ptr:t,start:i,subjects:o,predicates:s,objects:c});if(n===`deleteList`)return e.deleteList({ptr:t,predicates:s});if(n===`isList`)return e.isList({ptr:t});if(n===`list`)return e.list({ptr:t});if(n===`traverse`)return e.traverse({ptr:t,quantifier:r,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l});throw Error(`unknown operation ${n}`)}static isList({ptr:t}){return!t.isAny()&&!!(j.nil.equals(t.term)||e.traverse({ptr:t,predicates:[j.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(j.nil);){let t=e.out([j.first]);if(t.length!==1)throw Error(`Invalid list: rdf:first count not equals one on ${e.value}`);let n=e.out([j.rest]);if(n.length!==1)throw Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:t,quantifier:n=`one`,start:r=`subject`,end:i=`object`,subjects:a=[null],predicates:o=[null],objects:s=[null],graphs:c=[null],callback:l}){if(n===`one`)return e.traverseOne({ptr:t,start:r,end:i,subjects:a,predicates:o,objects:s,graphs:c,callback:l});if(n===`oneOrMore`){let n=e.traverse({ptr:t,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l});return e.traverseMore({ptrs:n,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l})}if(n===`zeroOrMore`)return e.traverseMore({ptrs:[t],end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l});if(n===`zeroOrOne`)return[t,...e.traverse({ptr:t,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l})];throw Error(`unknown quantifier ${n}`)}static traverseMore({ptrs:t,end:n,start:r,subjects:i,predicates:a,objects:o,graphs:s,callback:c}={}){let l=[...t],u,d;do{u=[];for(let l of t)u=[...u,...e.traverseOne({ptr:l,end:n,start:r,subjects:i,predicates:a,objects:o,graphs:s,callback:c})];d&&(u=u.filter(e=>!d.has(e.term))),t=u,l=[...l,...u],d=new k(l.map(e=>e.term))}while(u.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:r,predicates:i,objects:a,graphs:o,callback:s=(e,t)=>t.extend(e)}={}){let c=[];for(let l of r)for(let r of i)for(let i of a)for(let a of o){let o={subject:l,predicate:r,object:i,graph:a};o[t]=e.term;for(let r of e.dataset.match(o.subject,o.predicate,o.object,o.graph))c.push(s(new We({dataset:e.dataset,end:n,quad:r,start:t}),e))}return c}};function at(e,t){return t?n=>t(e.extend(n)):()=>{}}var ot=class{constructor({dataset:e,edges:t=[],factory:n,graph:r,term:i}){if(!e&&t.length===0)throw Error(`dataset or edges is required`);if(t.length===0&&i===void 0||t.length>0&&i)throw Error(`edges or term must be given`);this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=r,t.length===0&&(this._term=i)}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?this.edges.length+1:1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term===void 0?this.edge.term:this._term}get value(){let e=this.term;return e===null?void 0:e.value}addIn(e,t,n){return M.add({ptr:this,start:`object`,end:`subject`,subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:at(this,n)})}addList(e,t){return M.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return M.add({ptr:this,start:`subject`,end:`object`,predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:at(this,n)})}deleteIn(e,t){return M.delete({ptr:this,start:`object`,subjects:t,predicates:e})}deleteList(e){return M.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return M.delete({ptr:this,start:`subject`,predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:a,objects:o,graphs:s,items:c,callback:l}){return M.execute({ptr:this,operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:a,objects:o,graphs:s,items:c,callback:l})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return M.traverse({ptr:this,start:`object`,end:`object`,subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return M.traverse({ptr:this,start:`subject`,end:`subject`,predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return M.traverse({ptr:this,start:`object`,end:`subject`,subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return M.isList({ptr:this})}list(){return M.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term===void 0?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}):yield{dataset:this.dataset,term:this._term}}out(e,t){return M.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(let{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 st(e,t){return e?e.equals(t):e===t}function ct(e,t){return!(e.dataset!==t.dataset||!st(e.graph,t.graph)||!st(e.term,t.term))}function lt(e,t){return t?n=>t(new e.constructor({factory:e.factory,ptrs:[n]})):()=>{}}var ut=class{constructor({dataset:e,factory:t,ptrs:n,terms:r,graphs:i}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(let n of r||[null])for(let r of i||[null])this.ptrs.push(new ot({dataset:e,factory:t,graph:r,term:n}))}}get dataset(){let e=new Set(this.datasets);return e.size===1?e[Symbol.iterator]().next().value:null}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){let e=new k(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){return this.term?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,n){let r=lt(this,n);for(let n of this.ptrs)n.addIn(e,t,r);return this}addList(e,t){if(this.isAny())throw Error(`can't attach a list to an any ptr`);for(let n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){let r=lt(this,n);for(let n of this.ptrs)n.addOut(e,t,r);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(let n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(let t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(let n of this.ptrs)n.deleteOut(e,t);return this}distinct(){let e=this.ptrs.reduce((e,t)=>(e.some(e=>ct(e,t))||e.push(t.trim()),e),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(let n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(e=>e.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&&this.ptrs[0].isList()}list(){if(!this.isList())return;let e=this.ptrs[0].list(),t=this;return(function*(){for(let n of e)yield t.clone({ptrs:[n]})})()}map(e){return[...this].map(e)}node(e){let t=this.dataset,n=[...e].map(e=>new ot({dataset:t,factory:this.factory,term:e}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.out(e,t))})}*quads(){for(let{edges:e}of this.ptrs)for(let{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(let e of this.ptrs)yield this.clone({ptrs:[e]})}};A(`http://www.w3.org/2002/07/owl#`);var dt=A(`http://www.w3.org/1999/02/22-rdf-syntax-ns#`),ft=A(`http://www.w3.org/2000/01/rdf-schema#`),N=A(`http://www.w3.org/ns/shacl#`),pt=A(`https://schemas.link/shacl-next#`),mt=A(`http://www.w3.org/2001/XMLSchema#`);function ht(e){return e?`{${[...e.quads()].map(e=>O(e)).join(` `)}}`:`{}`}function gt(e){return e?`{${e.map(e=>ht(e)).join(` `)}}`:`{}`}var _t=x(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),vt=x(((e,t)=>{var n=_t(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),yt=x(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),bt=x(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),xt=x(((e,t)=>{var n=bt(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),St=x(((e,t)=>{t.exports=xt().Symbol})),Ct=x(((e,t)=>{var n=St(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),wt=x(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),Tt=x(((e,t)=>{var n=St(),r=Ct(),i=wt(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),Et=x(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),P=x(((e,t)=>{var n=Tt(),r=Et(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),F=x(((e,t)=>{var n=vt(),r=yt(),i=P(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),Dt=x(((e,t)=>{var n=F(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),Ot=x(((e,t)=>{var n=Dt();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),kt=x(((e,t)=>{var n=Ot(),r=`Expected a function`;function i(e,t){var i;if(typeof t!=`function`)throw TypeError(r);return e=n(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=void 0),i}}t.exports=i})),I=ae(x(((e,t)=>{var n=kt();function r(e){return n(2,e)}t.exports=r}))(),1),R=class{constructor({details:e,factory:t,options:n,results:r=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=r,this._conforms=(0,I.default)(()=>!this.results.some(e=>e.severity.equals(N.Info)||e.severity.equals(N.Violation)||e.severity.equals(N.Warning))),this._ptr=(0,I.default)(()=>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(){let e=new ut({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([dt.type],[N.ValidationReport]).addOut([N.conforms],[this.factory.literal(this.conforms.toString(),mt.boolean)]);for(let t of this.results)e.addOut([N.result],[this.factory.blankNode()],e=>{t.build(e,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function z(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&n.termType&&(n=O(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n)),e)}var At=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:r,message:i=[],path:a,results:o=[],severity:s,shape:c,source:l=[],value:u,valuePaths:d=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=r,this.path=a||c.path,this.results=o,this.severity=s,this.shape=c,this.source=l,this.value=u,this.valuePaths=d,this._message=(0,I.default)(()=>(this.shape.message.length>0&&(i=this.shape.message),i.length===0&&(i=this.shape.ptr.node([this.constraintComponent]).out([N.message]).terms),i.map(t=>n.literal(z(t.value,e,n),t.language||void 0))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([dt.type],[N.ValidationResult]).addOut([N.focusNode],this.focusNode.terms).addOut([N.resultSeverity],[this.severity]).addOut([N.sourceConstraint],this.source).addOut([N.sourceConstraintComponent],[this.constraintComponent]).addOut([N.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([N.resultMessage],this.message);let n=t=>{if(t.quantifier===`one`)return t.predicates.length>1?e.node([this.factory.blankNode()]).addList([N.alternativePath],t.predicates):t.start===`object`?e.node([this.factory.blankNode()]).addOut([N.inversePath],[t.predicates[0]]):e.node([t.predicates[0]]);if(t.quantifier===`oneOrMore`)return e.node([this.factory.blankNode()]).addOut([N.oneOrMorePath],[t.predicates[0]]);if(t.quantifier===`zeroOrMore`)return e.node([this.factory.blankNode()]).addOut([N.zeroOrMorePath],[t.predicates[0]]);if(t.quantifier===`zeroOrOne`)return e.node([this.factory.blankNode()]).addOut([N.zeroOrOnePath],[t.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([N.resultPath],n(this.path[0]).terms):e.addList([N.resultPath],this.path.map(e=>n(e).term))),this.value!==void 0&&e.addOut([N.value],this.value.terms),t)for(let n of this.results)e.addOut([N.detail],[this.factory.blankNode()],e=>{n.build(e,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}},jt=class e{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:r=new Set,report:i=new R({factory:e,options:n}),results:a=new Map,shape:o,value:s,valueOrNode:c,valuePaths:l,values:u}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=r,this.report=i,this.results=a,this.shape=o,this.value=s,this.valuePaths=l,this.valueOrNode=c,this.values=u}create({child:t,focusNode:n=this.focusNode,shape:r=this.shape,value:i=this.value,valueOrNode:a=this.valueOrNode,valuePaths:o=this.valuePaths,values:s=this.values}={}){return new e({factory:this.factory,focusNode:n,options:this.options,processed:this.processed,report:t?new R({factory:this.factory,options:this.options}):this.report,results:this.results,shape:r,value:i,valueOrNode:a,valuePaths:o,values:s})}id({shape:e=this.shape}={}){return`${O(e.ptr.term)} - ${O(this.focusNode.term)} - ${gt(this.valuePaths)}`}result(e){let t=new At({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:pt.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:pt.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||N.Violation,...t})}};function B(){return{generic:Mt()}}function Mt(){return e=>{e.trace(pt.TraversalConstraintComponent,{args:{},message:[e.factory.literal(`Traversal`)],value:e.valueOrNode})}}var Nt=class{constructor(e){this.validations=new Ue(e)}compile(e){let t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1,r=new Set;for(let t of e.ptr.execute({start:`subject`,end:`predicate`})){let e=this.validations.get(t.term);e&&(r.add(e),t.term.equals(N.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&r.add(B),[...r].map(t=>t(e)).filter(Boolean)}},V=x((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Translator=void 0,e.Translator=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(e){throw Error(`Invalid RDF ${e.datatype.value} value: '${e.value}'`)}registerHandler(e,t,n){for(let n of t)this.supportedRdfDatatypes.push(n),this.fromRdfHandlers[n.value]=e;for(let t of n){let n=this.toRdfHandlers[t];n||(this.toRdfHandlers[t]=n=[]),n.push(e)}}fromRdf(e,t){let n=this.fromRdfHandlers[e.datatype.value];return n?n.fromRdf(e,t):e.value}toRdf(e,t){let n=this.toRdfHandlers[typeof e];if(n)for(let r of n){let n=r.toRdf(e,t);if(n)return n}throw Error(`Invalid JavaScript value: '${e}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}}})),H=x((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHandlerBoolean=void 0;var t=V(),n=class e{fromRdf(e,n){switch(e.value){case`true`:return!0;case`false`:return!1;case`1`:return!0;case`0`:return!1}return n&&t.Translator.incorrectRdfDataType(e),!1}toRdf(t,{datatype:n,dataFactory:r}){return r.literal(t?`true`:`false`,n||r.namedNode(e.TYPE))}};e.TypeHandlerBoolean=n,n.TYPE=`http://www.w3.org/2001/XMLSchema#boolean`})),Pt=x((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHandlerDate=void 0;var t=V(),n=class e{fromRdf(n,r){switch(r&&!n.value.match(e.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&t.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`:let e=n.value.split(`-`);return new Date(0,parseInt(e[0],10)-1,parseInt(e[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(t,{datatype:n,dataFactory:r}){if(n||=r.namedNode(e.TYPES[0]),!(t instanceof Date))return null;let i=t,a;switch(n.value){case`http://www.w3.org/2001/XMLSchema#gDay`:a=String(i.getUTCDate());break;case`http://www.w3.org/2001/XMLSchema#gMonthDay`:a=i.getUTCMonth()+1+`-`+i.getUTCDate();break;case`http://www.w3.org/2001/XMLSchema#gYear`:a=String(i.getUTCFullYear());break;case`http://www.w3.org/2001/XMLSchema#gYearMonth`:a=i.getUTCFullYear()+`-`+(i.getUTCMonth()+1);break;case`http://www.w3.org/2001/XMLSchema#date`:a=i.toISOString().replace(/T.*$/,``);break;default:a=i.toISOString()}return r.literal(a,n)}};e.TypeHandlerDate=n,n.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`],n.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]$/}})),Ft=x((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHandlerNumberDouble=void 0;var t=V(),n=class e{fromRdf(e,n){let r=parseFloat(e.value);return n&&isNaN(r)&&t.Translator.incorrectRdfDataType(e),r}toRdf(t,{datatype:n,dataFactory:r}){return n||=r.namedNode(e.TYPES[0]),isNaN(t)?r.literal(`NaN`,n):isFinite(t)?t%1==0?null:r.literal(t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),n):r.literal(t>0?`INF`:`-INF`,n)}};e.TypeHandlerNumberDouble=n,n.TYPES=[`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`,`http://www.w3.org/2001/XMLSchema#float`]})),It=x((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHandlerNumberInteger=void 0;var t=V(),n=class e{fromRdf(e,n){let r=parseInt(e.value,10);return n&&(isNaN(r)||e.value.indexOf(`.`)>=0)&&t.Translator.incorrectRdfDataType(e),r}toRdf(t,{datatype:n,dataFactory:r}){return r.literal(String(t),n||(t<=e.MAX_INT&&t>=e.MIN_INT?r.namedNode(e.TYPES[0]):r.namedNode(e.TYPES[1])))}};e.TypeHandlerNumberInteger=n,n.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`],n.MAX_INT=2147483647,n.MIN_INT=-2147483648})),Lt=x((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHandlerString=void 0;var t=class{fromRdf(e){return e.value}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(e,t)}};e.TypeHandlerString=t,t.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`]})),Rt=x((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(H(),e),n(Pt(),e),n(Ft(),e),n(It(),e),n(Lt(),e)})),zt=x((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),Bt=x((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.fromRdf=l,e.toRdf=u,e.getTermRaw=d,e.getSupportedRdfDatatypes=f,e.getSupportedJavaScriptPrimitives=p;var r=o(),i=Rt(),a=V();n(Rt(),e),n(zt(),e),n(V(),e);var s=new r.DataFactory,c=new a.Translator;c.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(e=>s.namedNode(e)),[`string`]),c.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(e=>s.namedNode(e)),[`boolean`]),c.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(e=>s.namedNode(e)),[`number`]),c.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(e=>s.namedNode(e)),[`number`]),c.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(e=>s.namedNode(e)),[`object`]);function l(e,t){return c.fromRdf(e,t)}function u(e,t){return t&&`namedNode`in t&&(t={dataFactory:t}),t||={},t&&!t.dataFactory&&(t.dataFactory=s),c.toRdf(e,t)}function d(e,t){return e.termType===`Literal`?l(e,t):e.value}function f(){return c.getSupportedRdfDatatypes()}function p(){return c.getSupportedJavaScriptPrimitives()}}))();function Vt(e){if(e.term.termType!==`BlankNode`)return{quantifier:`one`,start:`subject`,end:`object`,predicates:[e.term]};let t=e.out([N.alternativePath]);if(t.ptrs.length===1&&t.ptrs[0].isList())return{quantifier:`one`,start:`subject`,end:`object`,predicates:[...t.list()].map(e=>e.term)};let n=e.out([N.inversePath]);if(n.term)return{quantifier:`one`,start:`object`,end:`subject`,predicates:[n.term]};let r=e.out([N.oneOrMorePath]);if(r.term)return{quantifier:`oneOrMore`,start:`subject`,end:`object`,predicates:[r.term]};let i=e.out([N.zeroOrMorePath]);if(i.term)return{quantifier:`zeroOrMore`,start:`subject`,end:`object`,predicates:[i.term]};let a=e.out([N.zeroOrOnePath]);if(a.term)return{quantifier:`zeroOrOne`,start:`subject`,end:`object`,predicates:[a.term]}}function Ht(e){return e.terms.length===0?null:e.ptrs[0].isList()?[...e.list()].map(e=>Vt(e)):[Vt(e)]}var Ut=class{constructor(e){this.shape=e,this._compiled=(0,I.default)(()=>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){let t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(let e of this.compiled)e.node&&await e.node(t),e.generic&&await e.generic(t)}async validateProperty(e){let t;t=this.shape.isSparqlShape?e.focusNode:e.focusNode.executeAll(this.shape.path);let n=t.node(new k(t.terms)),r=[...t].reduce((e,n)=>{let r=n.term,i=t.node([r]);return e.has(r)||e.set(r,{value:i,valuePaths:[]}),e.get(r).valuePaths.push(n),e},new Ue).values(),i=e.create({shape:this.shape,values:n});for(let e of this.compiled)e.property&&await e.property(i);for(let{value:t,valuePaths:n}of r){let r=e.create({shape:this.shape,value:t,valueOrNode:t,valuePaths:n});for(let e of this.compiled)e.generic&&await e.generic(r)}}};function Wt(e){let t=new k,n=new ut({dataset:e.dataset,terms:e.terms}).execute({quantifier:`zeroOrMore`,start:`object`,end:`subject`,predicates:[ft.subClassOf]});for(let e of n.ptrs)for(let{term:n}of e.nodes())t.add(n);return t}var Gt=class{constructor(e,{registry:t}){this.registry=t,this.targetClass=new k([...Wt(e.hasOut([dt.type],[N.NodeShape])),...Wt(e.out([N.targetClass]))]),this.targetNode=e.out([N.targetNode]).terms,this.targetObjectsOf=e.out([N.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([N.targetSubjectsOf]).terms,this.targets=[...e.out([N.target])]}async resolve(e){let t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([dt.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];for(let t of this.targets)for(let[,r]of this.registry.targetResolvers){let i=await r(t,e);n.push(...e.focusNode.node(i).ptrs)}let r=e.focusNode.clone({ptrs:n});return r.node([...new k(r.terms)])}},Kt=class{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=(0,I.default)(()=>{let e=this.ptr.out([N.deactivated]).term;return e&&(0,Bt.fromRdf)(e)}),this._message=(0,I.default)(()=>this.ptr.out([N.message]).terms),this._path=(0,I.default)(()=>Ht(this.ptr.out([N.path]))),this._severity=(0,I.default)(()=>this.ptr.out([N.severity]).term),this._shapeValidator=(0,I.default)(()=>new Ut(this)),this._sparql=(0,I.default)(()=>this.ptr.out([N.sparql])),this._targetResolver=(0,I.default)(()=>new Gt(this.ptr,{registry:this.validator.targetResolverRegistry}))}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()}async resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){let t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(let n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}},qt=class{constructor(e){this.targetResolvers=new Ue(e)}};function U(e){return{property:Jt(parseInt(e.ptr.out([N.maxCount]).value))}}function Jt(e){return t=>{t.test(t.values.terms.length<=e,N.MaxCountConstraintComponent,{args:{maxCount:e},message:[t.factory.literal(`More than {$maxCount} values`)]})}}function W(e){return{property:Yt(parseInt(e.ptr.out([N.minCount]).value))}}function Yt(e){return t=>{t.test(t.values.terms.length>=e,N.MinCountConstraintComponent,{args:{minCount:e},message:[t.factory.literal(`Less than {$minCount} values`)]})}}async function Xt(e,t){for(let n of e)if(!await t(n))return!1;return!0}async function Zt(e,t){return(await Promise.all(e.map(e=>t(e)))).filter(Boolean)}async function Qt(e,t){return Promise.all(e.map(t))}async function $t(e,t){for(let n of e)if(await t(n))return!0;return!1}function en(e){return{generic:tn([...e.ptr.out([N.and])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function tn(e){return async t=>{let n=await Qt(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report),r=n.every(e=>e.conforms);t.test(r,N.AndConstraintComponent,{results:n.flatMap(e=>e.results),value:t.valueOrNode})}}function G(e){return{generic:nn(e.validator.shape(e.ptr.out([N.not])))}}function nn(e){return async t=>{let n=(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report,r=!n.conforms;t.test(r,N.NotConstraintComponent,{args:{not:e.ptr.term},message:[t.factory.literal(`Value does have shape {$not}`)],results:n.results,value:t.valueOrNode})}}function rn(e){return{generic:an([...e.ptr.out([N.or])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function an(e){return async t=>{let n=[],r;if(t.options.debug||t.options.details){let i=await Qt(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report);n=i.flatMap(e=>e.results),r=i.some(e=>e.conforms)}else r=await $t(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report.conforms);t.test(r,N.OrConstraintComponent,{results:n,value:t.valueOrNode})}}function on(e){return{generic:sn([...e.ptr.out([N.xone])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function sn(e){return async t=>{let n=await Qt(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report),r=n.filter(e=>e.conforms).length===1;t.test(r,N.XoneConstraintComponent,{results:n.flatMap(e=>e.results),value:t.valueOrNode})}}function cn(e){return(0,Bt.fromRdf)(e.ptr.out([N.closed]).term)?{node:ln(new k(e.ptr.out([N.property]).map(t=>e.validator.shape(t)).filter(e=>!e.deactivated).map(e=>e.path[0].predicates[0])),new k([...e.ptr.out([N.ignoredProperties]).list()||[]].map(e=>e.term)))}:null}function ln(e,t){return n=>{let r=n.focusNode.execute({start:`subject`,end:`predicate`}).filter(n=>!t.has(n.term)&&!e.has(n.term));if(r.ptrs.length>0)for(let e of r)n.violation(N.ClosedConstraintComponent,{message:[n.factory.literal(`Predicate is not allowed (closed shape)`)],path:[{quantifier:`one`,start:`subject`,end:`object`,predicates:[e.term]}],value:n.focusNode.node([[...e.quads()][0].object])});else n.debug(N.ClosedConstraintComponent)}}function un(e){let t=e.ptr.out([N.hasValue]).term;return{node:K(t),property:dn(t)}}function K(e){return t=>{t.test(e.equals(t.valueOrNode.term),N.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal(`Value must be {$hasValue}`)]})}}function dn(e){return t=>{let n=[...t.values].some(t=>e.equals(t.term));t.test(n,N.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal(`Missing expected value {$hasValue}`)]})}}function fn(e){return{generic:pn(new k([...e.ptr.out([N.in]).list()].map(e=>e.term)))}}function pn(e){return t=>{t.test(e.has(t.valueOrNode.term),N.InConstraintComponent,{args:{in:[...e].map(e=>e.value).join(`, `)},message:[t.factory.literal(`Value is not in {$in}`)],value:t.valueOrNode})}}function mn(e,t){if(!e||e.termType!==`Literal`||!t||t.termType!==`Literal`||hn(e)!==hn(t))return null;let n=(0,Bt.fromRdf)(e),r=(0,Bt.fromRdf)(t);return typeof n==typeof r?typeof n==`string`?n.localeCompare(r):n-r:null}function hn(e){return mt.dateTime.equals(e.datatype)&&/^.*(((\+|-)\d{2}:\d{2})|Z)$/.test(e.value)}function gn(e){let t=e.ptr.out([N.disjoint]).term;return{generic:_n(t)}}function _n(e){return t=>{let n=t.focusNode.dataset.match(t.focusNode.term,e,t.valueOrNode.term);t.test(n.size===0,N.DisjointConstraintComponent,{args:{disjoint:e},message:[t.factory.literal(`Value node must not also be one of the values of {$disjoint}`)],value:t.valueOrNode})}}function vn(e){let t=e.ptr.out([N.equals]).term;return{node:yn(t),property:bn(t)}}function yn(e){return t=>{let n=t.focusNode.out([e]),r=n.filter(e=>!e.term.equals(t.focusNode.term)),i=n.terms.length!==0&&r.terms.length===0;t.test(i,N.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)],value:r.terms[0]&&t.focusNode.node([r.terms[0]])||t.focusNode})}}function bn(e){return t=>{let n=new k(t.focusNode.out([e]).terms),r=new k(t.values.terms),i=[...r].filter(e=>!n.has(e)),a=[...n].filter(e=>!r.has(e)),o=[...i,...a];for(let n of o)t.violation(N.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)],value:t.focusNode.node([n])});o.length===0&&t.debug(N.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)]})}}function xn(e){let t=e.ptr.out([N.lessThan]).term;return{property:Sn(t)}}function Sn(e){return t=>{let n=t.focusNode.out([e]).terms;for(let r of t.values)for(let i of n){let n=mn(r.term,i);n===null||n>=0?t.violation(N.LessThanConstraintComponent,{args:{lessThan:e},message:[t.factory.literal(`Value is not less than value of {$lessThan}`)],value:r}):t.debug(N.LessThanConstraintComponent,{args:{lessThan:e},message:[t.factory.literal(`Value is not less than value of {$lessThan}`)],value:r})}}}function Cn(e){let t=e.ptr.out([N.lessThanOrEquals]).term;return{property:wn(t)}}function wn(e){return t=>{let n=t.focusNode.out([e]).terms;for(let r of t.values)for(let i of n){let n=mn(r.term,i);n===null||n>0?t.violation(N.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:e},message:[t.factory.literal(`Value is not less than or equal to value of {$lessThanOrEquals}`)],value:r}):t.debug(N.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:e},message:[t.factory.literal(`Value is not less than or equal to value of {$lessThanOrEquals}`)],value:r})}}}function Tn(e){let t=e.ptr.out([N.maxExclusive]).term;return{generic:En(t)}}function En(e){return t=>{let n=mn(t.valueOrNode.term,e);t.test(n!==null&&n<0,N.MaxExclusiveConstraintComponent,{args:{maxExclusive:e},message:[t.factory.literal(`Value is not less than {$maxExclusive}`)],value:t.valueOrNode})}}function Dn(e){let t=e.ptr.out([N.maxInclusive]).term;return{generic:On(t)}}function On(e){return t=>{let n=mn(t.valueOrNode.term,e);t.test(n!==null&&n<=0,N.MaxInclusiveConstraintComponent,{args:{maxInclusive:e},message:[t.factory.literal(`Value is not less than or equal to {$maxInclusive}`)],value:t.valueOrNode})}}function kn(e){let t=e.ptr.out([N.minExclusive]).term;return{generic:An(t)}}function An(e){return t=>{let n=mn(t.valueOrNode.term,e);t.test(n!==null&&n>0,N.MinExclusiveConstraintComponent,{args:{minExclusive:e},message:[t.factory.literal(`Value is not greater than {$minExclusive}`)],value:t.valueOrNode})}}function jn(e){let t=e.ptr.out([N.minInclusive]).term;return{generic:Mn(t)}}function Mn(e){return t=>{let n=mn(t.valueOrNode.term,e);t.test(n!==null&&n>=0,N.MinInclusiveConstraintComponent,{args:{minInclusive:e},message:[t.factory.literal(`Value is not greater than or equal to {$minInclusive}`)],value:t.valueOrNode})}}function Nn(e){return{generic:Pn([...e.ptr.out([N.node])].map(t=>e.validator.shape(t)))}}function Pn(e){return async t=>{for(let n of e){let e=await n.validate(t.create({child:!0,focusNode:t.valueOrNode}));t.test(e.report.conforms,N.NodeConstraintComponent,{args:{node:n.ptr.term},message:[t.factory.literal(`Value does not have shape {$node}`)],results:e.report.results,value:t.valueOrNode})}}}function Fn(e){return{generic:In([...e.ptr.out([N.property])].map(t=>e.validator.shape(t)))}}function In(e){return async t=>{let n=t.create({focusNode:t.valueOrNode});for(let t of e)await t.validate(n)}}function Ln(e){let t=e.validator.shape(e.ptr.out([N.qualifiedValueShape])),n=e.ptr.out([N.qualifiedValueShapesDisjoint]).term,r=n?(0,Bt.fromRdf)(n):!1,i=e.ptr.out([N.qualifiedMaxCount]).term,a=i?parseInt(i.value):null,o=e.ptr.out([N.qualifiedMinCount]).term;return{property:Rn(t,r,a,o?parseInt(o.value):null)}}function Rn(e,t,n,r){return async i=>{let a=[],o=[];t&&(o=new Set(i.shape.ptr.in([N.property]).out([N.property]).out([N.qualifiedValueShape]).filter(t=>!t.term.equals(e.ptr.term)).map(e=>i.shape.validator.shape(e))));let s=(await Zt(i.values,async t=>{let n=(await e.validate(i.create({child:!0,focusNode:t}))).report;if(a.push(n.results),!n.conforms)return!1;if(o.length===0)return!0;if(i.options.debug||i.options.details){let e=await Qt([...o],async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report);return a.push(e.flatMap(e=>e.results)),!e.every(e=>e.conforms)}else return!await Xt([...o],async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report.conforms)})).length;n!==null&&i.test(s<=n,N.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:n,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal(`More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}`)],results:a.flat()}),r!==null&&i.test(s>=r,N.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal(`Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}`)],results:a.flat()})}}function zn(e,t){return t?t.slice(0,e.length)===e:!1}function Bn(e){return{generic:q([...new Set([...e.ptr.out([N.languageIn]).list()].map(e=>e.value))])}}function q(e){return t=>{let n=e.some(e=>zn(e,t.valueOrNode.term.language));t.test(n,N.LanguageInConstraintComponent,{args:{languageIn:e.join(`, `)},message:[t.factory.literal(`Language does not match any of {$languageIn}`)],value:t.valueOrNode})}}function Vn(e){return{generic:Hn(parseInt(e.ptr.out([N.maxLength]).value))}}function Hn(e){return t=>{let n=t.valueOrNode.term.termType!==`BlankNode`&&t.valueOrNode.value.length<=e;t.test(n,N.MaxLengthConstraintComponent,{args:{maxLength:e},message:[t.factory.literal(`Value has more than {$maxLength} characters`)],value:t.valueOrNode})}}function Un(e){return{generic:Wn(parseInt(e.ptr.out([N.minLength]).value))}}function Wn(e){return t=>{let n=t.valueOrNode.term.termType!==`BlankNode`&&t.valueOrNode.value.length>=e;t.test(n,N.MinLengthConstraintComponent,{args:{minLength:e},message:[t.factory.literal(`Value has less than {$minLength} characters`)],value:t.valueOrNode})}}function Gn(e){let t=e.ptr.out([N.pattern]).value,n=e.ptr.out([N.flags]).value;return{generic:Kn(t,n,new RegExp(t,n))}}function Kn(e,t,n){return r=>{r.test(n.test(r.valueOrNode.term.value),N.PatternConstraintComponent,{args:{flags:t,pattern:e},message:[r.factory.literal(`Value does not match pattern "{$pattern}"`)],value:r.valueOrNode})}}function qn(e){let t=e.ptr.out([N.uniqueLang]).term;return t.value===`true`&&mt.boolean.equals(t.datatype)?{property:Jn()}:null}function Jn(){return e=>{let t=Object.entries(e.values.terms.reduce((e,t)=>(t.language&&(e[t.language]=(e[t.language]||0)+1),e),{})).filter(([,e])=>e>1);for(let[n]of t)e.violation(N.UniqueLangConstraintComponent,{args:{lang:n},message:[e.factory.literal(`Language "{?lang}" used more than once`)]});t.length===0&&e.debug(N.UniqueLangConstraintComponent)}}var Yn=A(`http://www.w3.org/ns/shacl#`),J=A(`https://schemas.link/shacl-next#`),Xn=class{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Yn.Info)||e.severity.equals(Yn.Violation)||e.severity.equals(Yn.Warning))}};function Zn(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&n.termType&&(n=O(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n)),e)}var Y=class{constructor({args:e={},factory:t,message:n=[],severity:r=Yn.Violation}={}){this.severity=r,this.message=n.map(n=>t.literal(Zn(n.value,e),n.language||null))}},Qn=class e{constructor({factory:e=rt}={}){this.factory=e}clone({factory:t}={}){return new e({factory:t||this.factory})}validate(){return new Xn}validateSimple(){return!0}},$n=class e extends Qn{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(let t of Array.isArray(e)?e:[e])t&&this.datatypes.push(this.factory.fromTerm(t))}clone({factory:t}={}){return new e({datatypes:this.datatypes,factory:t||this.factory})}},er=class{constructor({factory:e=rt,validations:t}={}){if(this.factory=e,this.validations=new Ue,t)for(let e of Object.values(t)){let t=e.clone({factory:this.factory});for(let e of t.datatypes)this.validations.set(e,t)}}validate(e){let t=this.validations.get(e.datatype);return t?t.validate(e):new Xn}validateSimple(e){let t=this.validations.get(e.datatype);return!t||t.validateSimple(e)}},X=class e extends $n{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:t}={}){return new e(this.patterns,this.datatypes,{factory:t||this.factory})}validate(e){return new Xn({results:this.patterns.map(t=>{let n;return t.test(e.value)&&(n=J.Debug),new Y({args:{pattern:this.factory.literal(t.toString()),this:e},factory:this.factory,message:this.message,severity:n})})})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}},tr=/^([-+]?[0-9]+)$/,Z=class e extends X{constructor(e=null,t=null,n,{factory:r}={}){super(tr,n,{factory:r}),this.maxInclusive=null,this.minInclusive=null,typeof t==`string`&&(this.maxInclusive=BigInt(t)),typeof e==`string`&&(this.minInclusive=BigInt(e))}clone({factory:t}={}){return new e(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:t||this.factory})}validate(e){let t=super.validate(e).results;if(!J.Debug.equals(t[0].severity))return new Xn({results:t});let n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){let n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new Y({factory:this.factory,message:r}))}if(this.maxInclusive!==null&&n>this.maxInclusive){let n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new Y({factory:this.factory,message:r}))}return new Xn({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;let t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}},nr=class e extends $n{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:t}={}){return new e(this.values,this.datatypes,{factory:t||this.factory})}validate(e){let t=[];if(!this.values.has(e.value)){let n=`term value "${e.value}" is not included in the list: ${[...this.values].join(`,`)}`,r=[this.factory.literal(n)];t.push(new Y({factory:this.factory,message:r}))}return new Xn({results:t})}validateSimple(e){return this.values.has(e.value)}},rr=b({anyAtomicType:()=>ar,anySimpleType:()=>ir,anyURI:()=>Ir,base64Binary:()=>Fr,boolean:()=>xr,byte:()=>Qr,date:()=>Or,dateTime:()=>Er,dateTimeStamp:()=>si,dayTimeDuration:()=>oi,decimal:()=>Sr,double:()=>wr,duration:()=>Tr,float:()=>Cr,gDay:()=>Mr,gMonth:()=>Nr,gMonthDay:()=>jr,gYear:()=>Ar,gYearMonth:()=>kr,hexBinary:()=>Pr,int:()=>Xr,integer:()=>Kr,language:()=>Gr,long:()=>Yr,negativeInteger:()=>Jr,nonNegativeInteger:()=>$r,nonPositiveInteger:()=>qr,normalizedString:()=>Ur,positiveInteger:()=>ii,short:()=>Zr,string:()=>br,time:()=>Dr,token:()=>Wr,unsignedByte:()=>ri,unsignedInt:()=>ti,unsignedLong:()=>ei,unsignedShort:()=>ni,yearMonthDuration:()=>ai}),Q={xsd:A(`http://www.w3.org/2001/XMLSchema#`)},ir=new $n({datatypes:Q.xsd.anySimpleType}),ar=new $n({datatypes:Q.xsd.anyAtomicType}),or=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,sr=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,cr=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,lr=/^(-?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)))))$/,ur=/^(-?([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))?)$/,dr=/^((([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))?)$/,fr=/^(-?([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))?)$/,pr=/^(-?([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))?)$/,mr=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,hr=/^(--(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))?)$/,gr=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,_r=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,vr=/^(([0-9a-fA-F]{2})*)$/,yr=/^(((([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] ?= ?=))?)$/,br=new X(or,Q.xsd.string),xr=new nr([`1`,`true`,`0`,`false`],Q.xsd.boolean),Sr=new X(sr,Q.xsd.decimal),Cr=new X(cr,Q.xsd.float),wr=new X(cr,Q.xsd.double),Tr=new X(lr,Q.xsd.duration),Er=new X(ur,Q.xsd.dateTime),Dr=new X(dr,Q.xsd.time),Or=new X(fr,Q.xsd.date),kr=new X(pr,Q.xsd.gYearMonth),Ar=new X(mr,Q.xsd.gYear),jr=new X(hr,Q.xsd.gMonthDay),Mr=new X(gr,Q.xsd.gDay),Nr=new X(_r,Q.xsd.gMonth),Pr=new X(vr,Q.xsd.hexBinary),Fr=new X(yr,Q.xsd.base64Binary),Ir=new X(or,Q.xsd.anyURI),Lr=/^([^\u000d\u000a\u0009]*)$/,Rr=/^([^ ]+( [^ ]+)*)*$/,zr=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Br=/^([^DT]*)$/,Vr=/^([^YM]*[DT].*)$/,Hr=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Ur=new X([or,Lr],Q.xsd.normalizedString),Wr=new X([or,Lr,Rr],Q.xsd.token),Gr=new X(zr,Q.xsd.language),Kr=new Z(null,null,Q.xsd.integer),qr=new Z(null,`0`,Q.xsd.nonPositiveInteger),Jr=new Z(null,`-1`,Q.xsd.negativeInteger),Yr=new Z(`-9223372036854775808`,`9223372036854775807`,Q.xsd.long),Xr=new Z(`-2147483648`,`2147483647`,Q.xsd.int),Zr=new Z(`-32768`,`32767`,Q.xsd.short),Qr=new Z(`-128`,`127`,Q.xsd.byte),$r=new Z(`0`,null,Q.xsd.nonNegativeInteger),ei=new Z(`0`,`18446744073709551615`,Q.xsd.unsignedLong),ti=new Z(`0`,`4294967295`,Q.xsd.unsignedInt),ni=new Z(`0`,`65535`,Q.xsd.unsignedShort),ri=new Z(`0`,`255`,Q.xsd.unsignedByte),ii=new Z(`1`,null,Q.xsd.positiveInteger),ai=new X([lr,Br],Q.xsd.yearMonthDuration),oi=new X([lr,Vr],Q.xsd.dayTimeDuration),si=new X([ur,Hr],Q.xsd.dateTimeStamp),ci=class extends er{constructor({factory:e}={}){super({factory:e,validations:{...rr}})}},li=new Ue([[N.BlankNode,new Set([`BlankNode`])],[N.BlankNodeOrIRI,new Set([`BlankNode`,`NamedNode`])],[N.BlankNodeOrLiteral,new Set([`BlankNode`,`Literal`])],[N.IRI,new Set([`NamedNode`])],[N.IRIOrLiteral,new Set([`NamedNode`,`Literal`])],[N.Literal,new Set([`Literal`])]]);function ui(e){return{generic:di(e.ptr.out([N.class]).map(e=>Wt(e)))}}function di(e){return t=>{let n=new k(t.valueOrNode.out([dt.type]).terms);for(let r of e){let e=[...n].some(e=>r.has(e));t.test(e,N.ClassConstraintComponent,{value:t.valueOrNode})}}}function fi(e){let t=e.ptr.out([N.datatype]).term;return{generic:pi(t,new ci)}}function pi(e,t){return n=>{let r=e.equals(n.valueOrNode.term.datatype)&&t.validateSimple(n.valueOrNode.term);n.test(r,N.DatatypeConstraintComponent,{args:{datatype:e},message:[n.factory.literal(`Value does not have datatype {$datatype}`)],value:n.valueOrNode})}}function mi(e){let t=e.ptr.out([N.nodeKind]).term;return{generic:hi(t,li.get(t))}}function hi(e,t){return n=>{n.test(t.has(n.valueOrNode.term.termType),N.NodeKindConstraintComponent,{args:{nodeKind:e},message:[n.factory.literal(`Value does not have node kind {$nodeKind}`)],value:n.valueOrNode})}}var gi=new Ue([[N.maxCount,U],[N.minCount,W],[N.and,en],[N.not,G],[N.or,rn],[N.xone,on],[N.closed,cn],[N.hasValue,un],[N.in,fn],[N.disjoint,gn],[N.equals,vn],[N.lessThan,xn],[N.lessThanOrEquals,Cn],[N.maxExclusive,Tn],[N.maxInclusive,Dn],[N.minExclusive,kn],[N.minInclusive,jn],[N.node,Nn],[N.property,Fn],[N.qualifiedValueShape,Ln],[N.languageIn,Bn],[N.maxLength,Vn],[N.minLength,Un],[N.pattern,Gn],[N.uniqueLang,qn],[N.class,ui],[N.datatype,fi],[N.nodeKind,mi]]),_i=class{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Nt(gi),this.targetResolverRegistry=new qt(this.options.targetResolvers||[]),this.shapesPtr=new ut({dataset:e,factory:t}),this.shapes=new Ue,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(let[e,t]of this.options.validations)this.registry.validations.set(e,t);let r=[...this.shapesPtr.hasOut([N.targetClass]),...this.shapesPtr.hasOut([N.targetNode]),...this.shapesPtr.hasOut([N.targetObjectsOf]),...this.shapesPtr.hasOut([N.targetSubjectsOf]),...this.shapesPtr.hasOut([N.target]),...this.shapesPtr.hasOut([dt.type],[N.NodeShape]),...this.shapesPtr.hasOut([dt.type],[N.PropertyShape])];for(let e of r)this.shape(e)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Kt(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){let n=new ut({...e,factory:this.factory}),r=new jt({factory:this.factory,focusNode:n,options:this.options,validator:this});t=t?t.map(e=>this.shape(this.shapesPtr.node(e.terms))):this.shapes.values();for(let e of t){let t=r.create({shape:e}),i;i=n.isAny()?await e.resolveTargets(t):n;for(let n of i)await e.validate(t.create({focusNode:n}))}return r.report}},vi=class{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.preserveUnmappedValues=null,this.view=null,this.mode=null,this.language=null,this.loading=`Loading…`,this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.hierarchyColors=null,this.submitButton=null,this.generateNodeShapeReference=re.value,this.showNodeIds=null,this.showRootShapeLabel=null,this.dense=`true`,this.useShadowRoot=`true`}},yi=`#4c93d785, #f85e9a85, #00327385, #87001f85`,bi=class{constructor(e){this.attributes=new vi,this.mode=`edit`,this.lists={},this.groups=[],this.renderedNodes=new Set,this.originalValues=new we,this._store=new we,this._nodeTemplates={},this._propertyTemplates={},this.validator=new _i(this._store,{details:!0,factory:y}),this.providedConformingResourceIds={},this.providedResources={},this.providedResourceLabels={},this.form=e,this._theme=new Ae,this.languages=[...new Set(navigator.languages.flatMap(e=>e.length>2?[e.toLocaleLowerCase(),e.substring(0,2)]:e)),``]}reset(){this.lists={},this.groups=[],this.renderedNodes.clear(),this.providedConformingResourceIds={},this.providedResources={},this.providedResourceLabels={},this.originalValues=new we,this._nodeTemplates={},this._propertyTemplates={}}updateAttributes(e){let t=new vi;if(Object.keys(t).forEach(n=>{let r=e.dataset[n];r!==void 0&&(t[n]=r)}),t.mode!==null&&![`edit`,`view`,`query`].includes(t.mode))throw Error(`invalid shacl-form mode: ${t.mode}`);if(this.mode=t.mode??(t.view===null?`edit`:`view`),this.theme.setDense(t.dense===`true`),this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){let e=this.languages.indexOf(t.language);e>-1&&this.languages.splice(e,1),this.languages.unshift(t.language)}if(t.valuesGraph&&(this.valuesGraphId=y.namedNode(t.valuesGraph)),t.hierarchyColors!=null){let e=t.hierarchyColors.length?t.hierarchyColors:yi,n=`:host { --hierarchy-colors: ${e}; --hierarchy-colors-length: ${e.split(`,`).length} }`;for(let e=8;e>=0;e--){let t=`shacl-property { --hierarchy-level: ${e} }`;for(let n=0;n<e;n++)t=`shacl-property `+t;n=n+`
|
|
10
|
-
`+t}this.hierarchyColorsStyleSheet=new CSSStyleSheet,this.hierarchyColorsStyleSheet.replaceSync(n)}}static dataAttributes(){let e=new vi;return Object.keys(e).map(e=>(e=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),`data-`+e))}buildTemplateKey(e,t){let n=e.value;return t&&(t instanceof w?n+=`*`+t.id.value:n+=`*`+this.buildTemplateKey(t.id,t.parent)),n}registerNodeTemplate(e){this._nodeTemplates[this.buildTemplateKey(e.id,e.parent)]=e}registerPropertyTemplate(e){this._propertyTemplates[this.buildTemplateKey(e.id,e.parent)]=e}getNodeTemplateIds(){let e=new Set;for(let t of Object.values(this._nodeTemplates))e.add(t.id.value);return e}getNodeTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._nodeTemplates[n];return r||=new ve(e,this,t),r}getPropertyTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._propertyTemplates[n];return r||=new w(e,t),r}get nodeTemplates(){return Object.values(this._nodeTemplates)}get theme(){return this._theme}set theme(e){this._theme=e,e.setDense(this.attributes.dense===`true`)}get store(){return this._store}get editMode(){return this.mode===`edit`}get queryMode(){return this.mode===`query`}set store(e){this._store=e,this.lists=g(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(e=>{this.groups.push(e.id)},ye,`${le}PropertyGroup`,null),this.validator=new _i(e,{details:!0,factory:y})}},xi=200,Si=class extends HTMLElement{static get observedAttributes(){return bi.dataAttributes()}constructor(){super(),this.shape=null,this.styleElement=null,this.validationQueue=Promise.resolve(),this.validationGeneration=0,this.form=document.createElement(`form`),this.form.setAttribute(`part`,`form`),this.config=new bi(this.form),this.form.addEventListener(`change`,e=>{e.stopPropagation(),this.config.queryMode?this.queryController?.handleChange():this.config.editMode&&this.validate(!0).then(e=>{this.refreshClassInstanceEditors(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:e.conforms,report:e}}))}).catch(e=>{console.warn(e)})})}connectedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}attributeChangedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.queryController?.dispose(),this.queryController=void 0,this.setAttribute(`loading`,``),this.config.theme.apply(this.form),this.applyStyles([this.config.theme.stylesheet]),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading)),this.initDebounceTimeout=setTimeout(async()=>{try{this.config.reset(),this.config.store=await v({shapes:this.config.attributes.shapes,shapesUrl:this.config.attributes.shapesUrl,values:this.config.attributes.values,valuesUrl:this.config.attributes.valuesUrl,valuesSubject:this.config.attributes.valuesSubject,loadOwlImports:this.config.attributes.ignoreOwlImports===null,classInstanceProvider:this.config.classInstanceProvider,rdfUrlResolver:this.config.rdfUrlResolver,proxy:this.config.attributes.proxy},this.config.originalValues),this.config.resourceLinkProvider&&await be(this.config),this.config.attributes.valuesSubject||(this.config.attributes.valuesSubject=T(this.config.store)||null),this.form.replaceChildren();let t=this.findRootShaclShapeSubject();if(t){if(this.form.classList.forEach(e=>{this.form.classList.remove(e)}),this.form.classList.toggle(`mode-edit`,this.config.editMode),this.form.classList.toggle(`mode-view`,this.config.mode===`view`),this.form.classList.toggle(`mode-query`,this.config.queryMode),this.config.queryMode){let{QueryModeController:t}=await e(async()=>{let{QueryModeController:e}=await import(`./assets/mode-
|
|
10
|
+
`+t}this.hierarchyColorsStyleSheet=new CSSStyleSheet,this.hierarchyColorsStyleSheet.replaceSync(n)}}static dataAttributes(){let e=new vi;return Object.keys(e).map(e=>(e=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),`data-`+e))}buildTemplateKey(e,t){let n=e.value;return t&&(t instanceof w?n+=`*`+t.id.value:n+=`*`+this.buildTemplateKey(t.id,t.parent)),n}registerNodeTemplate(e){this._nodeTemplates[this.buildTemplateKey(e.id,e.parent)]=e}registerPropertyTemplate(e){this._propertyTemplates[this.buildTemplateKey(e.id,e.parent)]=e}getNodeTemplateIds(){let e=new Set;for(let t of Object.values(this._nodeTemplates))e.add(t.id.value);return e}getNodeTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._nodeTemplates[n];return r||=new ve(e,this,t),r}getPropertyTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._propertyTemplates[n];return r||=new w(e,t),r}get nodeTemplates(){return Object.values(this._nodeTemplates)}get theme(){return this._theme}set theme(e){this._theme=e,e.setDense(this.attributes.dense===`true`)}get store(){return this._store}get editMode(){return this.mode===`edit`}get queryMode(){return this.mode===`query`}set store(e){this._store=e,this.lists=g(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(e=>{this.groups.push(e.id)},ye,`${le}PropertyGroup`,null),this.validator=new _i(e,{details:!0,factory:y})}},xi=200,Si=class extends HTMLElement{static get observedAttributes(){return bi.dataAttributes()}constructor(){super(),this.shape=null,this.styleElement=null,this.validationQueue=Promise.resolve(),this.validationGeneration=0,this.form=document.createElement(`form`),this.form.setAttribute(`part`,`form`),this.config=new bi(this.form),this.form.addEventListener(`change`,e=>{e.stopPropagation(),this.config.queryMode?this.queryController?.handleChange():this.config.editMode&&this.validate(!0).then(e=>{this.refreshClassInstanceEditors(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:e.conforms,report:e}}))}).catch(e=>{console.warn(e)})})}connectedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}attributeChangedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.queryController?.dispose(),this.queryController=void 0,this.setAttribute(`loading`,``),this.config.theme.apply(this.form),this.applyStyles([this.config.theme.stylesheet]),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading)),this.initDebounceTimeout=setTimeout(async()=>{try{this.config.reset(),this.config.store=await v({shapes:this.config.attributes.shapes,shapesUrl:this.config.attributes.shapesUrl,values:this.config.attributes.values,valuesUrl:this.config.attributes.valuesUrl,valuesSubject:this.config.attributes.valuesSubject,loadOwlImports:this.config.attributes.ignoreOwlImports===null,classInstanceProvider:this.config.classInstanceProvider,rdfUrlResolver:this.config.rdfUrlResolver,proxy:this.config.attributes.proxy},this.config.originalValues),this.config.resourceLinkProvider&&await be(this.config),this.config.attributes.valuesSubject||(this.config.attributes.valuesSubject=T(this.config.store)||null),this.form.replaceChildren();let t=this.findRootShaclShapeSubject();if(t){if(this.form.classList.forEach(e=>{this.form.classList.remove(e)}),this.form.classList.toggle(`mode-edit`,this.config.editMode),this.form.classList.toggle(`mode-view`,this.config.mode===`view`),this.form.classList.toggle(`mode-query`,this.config.queryMode),this.config.queryMode){let{QueryModeController:t}=await e(async()=>{let{QueryModeController:e}=await import(`./assets/mode-BCJW0E9O.js`);return{QueryModeController:e}},[]);this.queryController=new t(this)}this.config.theme.apply(this.form);let n=[this.config.theme.stylesheet];this.config.hierarchyColorsStyleSheet&&n.push(this.config.hierarchyColorsStyleSheet),this.queryController&&n.push(this.queryController.stylesheet);for(let e of Ee())e.stylesheet&&n.push(e.stylesheet);this.applyStyles(n);let r=new ve(t,this.config);for(let e of this.config.nodeTemplates)S(e);if(this.shape=new me(r,this.config.attributes.valuesSubject?y.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.attributes.showRootShapeLabel!==null&&r.label){let e=document.createElement(`h3`);e.innerText=r.label.value,this.form.prepend(e)}if(this.config.editMode){if(this.config.attributes.submitButton!==null){let e=this.config.theme.createButton(this.config.attributes.submitButton||`Submit`,!0);e.classList.add(`submit-button`);let t=e.getAttribute(`part`);e.setAttribute(`part`,`${t?t+` `:``}submit-button`),e.addEventListener(`click`,e=>{e.preventDefault(),this.form.reportValidity()?this.validate().then(e=>{e?.conforms?this.dispatchEvent(new Event(`submit`,{bubbles:!0,cancelable:!0})):this.focusFirstInvalidElement()}):this.validate().then(()=>{this.focusFirstInvalidElement(!0)})}),this.form.appendChild(e)}await this.shape?.ready,this.config.attributes.valuesSubject&&this.removeFromDataGraph(y.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0),this.refreshClassInstanceEditors()}else this.config.queryMode&&(await this.shape.ready,await this.queryController?.initialize())}else if(this.config.store.countQuads(null,null,null,_)>0)throw Error(`shacl root node shape not found`)}catch(e){console.error(e);let t=document.createElement(`div`);t.innerText=String(e),this.form.replaceChildren(t)}this.config.queryMode&&this.config.queryFacetProvider&&this.queryController||this.removeAttribute(`loading`),await this.shape?.ready,this.dispatchEvent(new Event(`ready`))},200)}ensureRenderRoot(){this.config.attributes.useShadowRoot===`false`?(this.shadowRoot?.contains(this.form)&&this.shadowRoot.removeChild(this.form),this.contains(this.form)||this.prepend(this.form)):(this.shadowRoot||this.attachShadow({mode:`open`}),this.shadowRoot.contains(this.form)||this.shadowRoot.prepend(this.form))}focusFirstInvalidElement(e=!1){let t=this.form.querySelector(`:scope .invalid > .editor`);t?(e&&t.reportValidity?.(),t instanceof D?t.input.inputElement.focus():t.focus()):this.form.querySelector(`:scope .invalid`)?.scrollIntoView()}applyStyles(e){if(this.config.attributes.useShadowRoot!==`false`&&this.shadowRoot){this.shadowRoot.adoptedStyleSheets=e,this.styleElement&&=(this.styleElement.remove(),null);return}let t=e.map(e=>Array.from(e.cssRules).map(e=>e.cssText).join(`
|
|
11
11
|
`).replace(/:host\b/g,`shacl-form`)).join(`
|
|
12
12
|
`);this.styleElement||(this.styleElement=document.createElement(`style`),this.prepend(this.styleElement)),this.styleElement.textContent=t}serialize(e=`text/turtle`,r){return this.assertNotQueryMode(`serialize`),r??=this.toRDF(),n(r.getQuads(null,null,null,null),e,t)}toRDF(e=new we){this.assertNotQueryMode(`toRDF`);let t;return this.config.attributes.preserveUnmappedValues!==null&&(t=this.preparePreservedOutput(e)),this.shape?.toRDF(e,void 0,this.config.attributes.generateNodeShapeReference),t?.size&&this.pruneOrphanedBlankNodes(e,t),e}preparePreservedOutput(e){let t=this.config.originalValues,n=new Map;e.addQuads(t.getQuads(null,null,null,null));for(let r of this.form.querySelectorAll(`shacl-property`))if(!r.parent.linked){for(let i of r.template.pathAlternatives??[r.template.path])if(i)for(let a of t.getQuads(r.parent.nodeId,i,null,null))e.delete(a),a.object.termType===`BlankNode`&&n.set(a.object.id,a.object)}for(let n of this.form.querySelectorAll(`shacl-node:not([part~="linked-node"])`))if(n.template.targetClass)for(let r of t.getQuads(n.nodeId,ye,n.template.targetClass,null))e.delete(r);let r=this.config.attributes.generateNodeShapeReference;if(this.shape&&r)for(let n of t.getQuads(this.shape.nodeId,y.namedNode(r),this.shape.template.id,null))e.delete(n);return n}pruneOrphanedBlankNodes(e,t){let n=new Map(t),r=[...t.values()];for(;r.length;){let t=r.pop();for(let i of e.getQuads(t,null,null,null))i.object.termType===`BlankNode`&&!n.has(i.object.id)&&(n.set(i.object.id,i.object),r.push(i.object))}let i=new Set,a=[],o=e=>{i.has(e.id)||(i.add(e.id),a.push(e))};for(let e of this.form.querySelectorAll(`shacl-node:not([part~="linked-node"])`))e.nodeId.termType===`BlankNode`&&n.has(e.nodeId.id)&&o(e.nodeId);for(let t of n.values())e.getQuads(null,null,t,null).some(e=>e.subject.termType!==`BlankNode`||!n.has(e.subject.id))&&o(t);for(;a.length;){let t=a.pop();for(let r of e.getQuads(t,null,null,null))r.object.termType===`BlankNode`&&n.has(r.object.id)&&o(r.object)}for(let t of n.values())if(!i.has(t.id))for(let n of e.getQuads(t,null,null,null))e.delete(n)}registerPlugin(e){m(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}setRdfUrlResolver(e){this.config.rdfUrlResolver=e,this.initialize()}setResourceLinkProvider(e){this.config.resourceLinkProvider=e,this.initialize()}setQueryFacetProvider(e){this.config.queryFacetProvider=e,this.queryController?.refreshFacets()}getQuery(){return this.shape?this.queryController?.getQuery()??{rootShapeId:this.shape.template.id.value,targetClass:this.shape.template.targetClass?.value,criteria:[]}:{rootShapeId:``,criteria:[]}}refreshQueryFacets(){this.queryController?.refreshFacets()}async validate(e=!1){this.assertNotQueryMode(`validate`);let t=++this.validationGeneration;for(let e of this.form.querySelectorAll(`:scope .validation-error`))e.remove();for(let t of this.form.querySelectorAll(`:scope .property-instance`)){let n=t.querySelector(`:scope > .editor`),r=!!n?.value,i=n?.validity?.valid===!1&&(r||!e);t.classList.toggle(`invalid`,i),r&&!i?t.classList.add(`valid`):t.classList.remove(`valid`),i&&n?.validationMessage&&this.appendValidationErrorDisplay(t,n.validationMessage)}for(let e of this.form.querySelectorAll(`.add-button-wrapper`))e.classList.remove(`invalid`,`validation-error`);if(!this.shape)return{conforms:!0,results:[]};if(!e){let e=this.form.querySelectorAll(`.add-button-wrapper.required`);for(let t of e)t.classList.add(`invalid`),t.after(this.createValidationErrorDisplay(`Value is required`,`node`));if(e.length>0)return{conforms:!1,results:[]}}let n=this.shape,r=()=>new Promise(r=>{this.config.store.deleteGraph(this.config.valuesGraphId||``).on(`end`,async()=>{n.toRDF(this.config.store,void 0,this.config.attributes.generateNodeShapeReference);try{let i=await this.config.validator.validate({dataset:this.config.store,terms:[n.nodeId]},[{terms:[n.template.id]}]);if(t!==this.validationGeneration){r(i);return}let a=[...i.results];for(let t=0;t<a.length;t++){let n=a[t];if(a.push(...n.results??[]),n.focusNode?.ptrs?.length)for(let t of n.focusNode.ptrs){let r=t._term;if(n.path?.length){let t=n.path[0].predicates[0],i=e=>`
|
|
13
13
|
:scope shacl-node[data-node-id='${r.id}'] > shacl-property > .property-instance[${e}='${t.id}'] > .editor,
|
|
@@ -733,6 +733,6 @@ svg.leaflet-image-layer.leaflet-interactive path {\r
|
|
|
733
733
|
<div id="shaclMapDialogContainer"></div>
|
|
734
734
|
<div class="hint">ⓘ Draw a polygon or marker, then close dialog</div>
|
|
735
735
|
<button class="closeButton" type="button">✕</button>
|
|
736
|
-
</dialog>`,Fi={lng:8.657238961696038,lat:49.87627570549512},Ii=`© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>`,Li=`https://tile.openstreetmap.de/{z}/{x}/{y}.png`,Ri=$.icon({iconUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=`,shadowUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC`,iconSize:[25,41],shadowSize:[41,41],iconAnchor:[12,41],shadowAnchor:[14,41],popupAnchor:[-3,-76]});function zi(e,t){return $.map(e,{...t,layers:[$.tileLayer(Li)]})}function Bi(e,t){let n=$.default??$,r=window.L,i=n,a=r;return!i.heatLayer&&a?.heatLayer&&(i.HeatLayer=a.HeatLayer,i.heatLayer=a.heatLayer),window.L=n,i.heatLayer(e,{maxZoom:t})}function Vi(e,t,n){return new($.Control.extend({options:{position:`topleft`},onAdd:()=>{let r=$.DomUtil.create(`div`,`leaflet-control leaflet-bar`),i=$.DomUtil.create(`a`,``,r);return i.href=`#`,i.title=e,i.
|
|
736
|
+
</dialog>`,Fi={lng:8.657238961696038,lat:49.87627570549512},Ii=`© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>`,Li=`https://tile.openstreetmap.de/{z}/{x}/{y}.png`,Ri=$.icon({iconUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=`,shadowUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC`,iconSize:[25,41],shadowSize:[41,41],iconAnchor:[12,41],shadowAnchor:[14,41],popupAnchor:[-3,-76]});function zi(e,t){return $.map(e,{...t,layers:[$.tileLayer(Li)]})}function Bi(e,t){let n=$.default??$,r=window.L,i=n,a=r;return!i.heatLayer&&a?.heatLayer&&(i.HeatLayer=a.HeatLayer,i.heatLayer=a.heatLayer),window.L=n,i.heatLayer(e,{maxZoom:t})}function Vi(e,t,n){return new($.Control.extend({options:{position:`topleft`},onAdd:()=>{let r=$.DomUtil.create(`div`,`leaflet-control leaflet-bar`),i=$.DomUtil.create(`a`,``,r);return i.href=`#`,i.title=e,i.textContent=t,$.DomEvent.on(i,`click`,$.DomEvent.stop).on(i,`click`,n),r}}))}var Hi=class extends De{constructor(e){super(e,Ei+`
|
|
737
737
|
`+Mi+`
|
|
738
|
-
`+Ni)}initEditMode(e){e.insertAdjacentHTML(`beforeend`,Pi);let t=e.querySelector(`#shaclMapDialogContainer`);this.map=zi(t,{fullscreenControl:!0,editable:!0,zoom:5,maxBounds:Yi,center:Fi}),this.map.attributionControl.addAttribution(Ii);let n=this.map;this.map.addControl(Vi(`Create a new polygon`,`▰`,()=>{this.displayedShape?.remove(),this.displayedShape=n.editTools.startPolygon()})),this.map.addControl(Vi(`Create a new marker`,`•`,()=>{this.displayedShape?.remove(),this.displayedShape=n.editTools.startMarker(void 0,{icon:Ri})})),this.map.on(`editable:drawing:end editable:vertex:dragend`,()=>{this.saveChanges()});let r=e.querySelector(`#shaclMapDialog`);return r.addEventListener(`click`,e=>{e.target===r&&r.close()}),r.querySelector(`.closeButton`)?.addEventListener(`click`,()=>r.close()),r.addEventListener(`close`,()=>{let e=document.body.style.top;document.body.style.position=``,document.body.style.top=``,window.scrollTo(0,parseInt(e||`0`)*-1),this.currentEditor&&this.createdGeometry&&(this.currentEditor.value=Qi(this.createdGeometry),this.currentEditor.dispatchEvent(new Event(`change`,{bubbles:!0})))}),r}createEditor(e,t){let n=e.config.form.querySelector(`#shaclMapDialog`);n||=this.initEditMode(e.config.form);let r=e.config.theme.createButton(`Open
|
|
738
|
+
`+Ni)}initEditMode(e){e.insertAdjacentHTML(`beforeend`,Pi);let t=e.querySelector(`#shaclMapDialogContainer`);this.map=zi(t,{fullscreenControl:!0,editable:!0,zoom:5,maxBounds:Yi,center:Fi}),this.map.attributionControl.addAttribution(Ii);let n=this.map;this.map.addControl(Vi(`Create a new polygon`,`▰`,()=>{this.displayedShape?.remove(),this.displayedShape=n.editTools.startPolygon()})),this.map.addControl(Vi(`Create a new marker`,`•`,()=>{this.displayedShape?.remove(),this.displayedShape=n.editTools.startMarker(void 0,{icon:Ri})})),this.map.on(`editable:drawing:end editable:vertex:dragend`,()=>{this.saveChanges()});let r=e.querySelector(`#shaclMapDialog`);return r.addEventListener(`click`,e=>{e.target===r&&r.close()}),r.querySelector(`.closeButton`)?.addEventListener(`click`,()=>r.close()),r.addEventListener(`close`,()=>{let e=document.body.style.top;document.body.style.position=``,document.body.style.top=``,window.scrollTo(0,parseInt(e||`0`)*-1),this.currentEditor&&this.createdGeometry&&(this.currentEditor.value=Qi(this.createdGeometry),this.currentEditor.dispatchEvent(new Event(`change`,{bubbles:!0})))}),r}createEditor(e,t){let n=e.config.form.querySelector(`#shaclMapDialog`);n||=this.initEditMode(e.config.form);let r=e.config.theme.createButton(`Open map...`,!1);r.style.marginLeft=`5px`,r.classList.add(`open-map-button`),r.onclick=()=>{this.currentEditor=i.querySelector(`.editor`),this.createdGeometry=void 0,this.displayedShape?.remove(),this.drawAndZoomToGeometry(Xi(this.currentEditor.value||``),this.map),document.body.style.top=`-${window.scrollY}px`,document.body.style.position=`fixed`,n.showModal()};let i=u(e,t||null,!0);return i.appendChild(r),i}createQueryEditor(e,t){let n=document.createElement(`div`);n.classList.add(`query-editor`,`query-map-editor`),n.dataset.queryFieldId=e.id,n.setAttribute(`part`,`query-editor`);let r=document.createElement(`label`);r.textContent=t.label,t.description&&(r.title=t.description.value),n.appendChild(r);let i=document.createElement(`div`);i.classList.add(`query-controls`),n.appendChild(i);let a=document.createElement(`div`);a.classList.add(`query-map`),i.appendChild(a);let o=new ie;o.classList.add(`clear`,`query-map-clear`),o.title=`Clear`,o.dense=t.config.theme.dense,o.icon=!0,o.hidden=!0,i.appendChild(o);let s=!1,c,l=zi(a,{attributionControl:!1,fullscreenControl:!0,maxBoundsViscosity:1,trackResize:!1,zoom:0});l.fitBounds(Yi).setMaxBounds(Yi),l.on(`moveend`,()=>{s=l.getZoom()>0,o.hidden=!s;let e=s?Wi(l.getBounds()):void 0;e!==c&&(c=e,n.dispatchEvent(new Event(`change`,{bubbles:!0})))}),o.addEventListener(`click`,e=>{e.stopPropagation(),l.fitBounds(Yi,{animate:!1})});let u,d=$.featureGroup().addTo(l),f=e=>{if(d.clearLayers(),u=void 0,e)if(e.heatmap){if(!Ui(l,a)){u=e;return}let t=$i(e.heatmap);t.length&&Bi(t,l.getZoom()||0).addTo(d)}else Ki(e,d)};return new ResizeObserver(()=>{a.clientWidth<=0||a.clientHeight<=0||(l.invalidateSize({debounceMoveend:!0}),u&&f(u))}).observe(a),n.getQueryCriteria=()=>!s||!c?[]:[{field:e,operator:`equals`,value:y.literal(c,t.datatype)}],n.setQueryFacet=f,n}createViewer(e,t){let n=document.createElement(`div`),r=Xi(t.value);if(r){let e=zi(n,{fullscreenControl:!0,zoom:5,center:Fi,maxBounds:Yi});e.attributionControl.addAttribution(Ii),Ji(r,e)}return n}drawAndZoomToGeometry(e,t){this.displayedShape=Ji(e,t)}saveChanges(){if(this.displayedShape instanceof $.Marker){let{lng:e,lat:t}=this.displayedShape.getLatLng();this.createdGeometry={type:`Point`,coordinates:[e,t]};return}if(this.displayedShape instanceof $.Polygon){let e=this.displayedShape.getLatLngs()[0];if(!e.length){this.createdGeometry=void 0;return}let t=e.map(({lng:e,lat:t})=>[e,t]);e[0].equals(e[e.length-1])||t.push([...t[0]]),this.createdGeometry={type:`Polygon`,coordinates:[t]};return}this.createdGeometry=void 0}};function Ui(e,t){let n=t.getBoundingClientRect(),r=e.getSize();return n.width>0&&n.height>0&&r.x>0&&r.y>0}function Wi(e){let t=Gi(e.getSouth(),-90,90),n=Gi(e.getWest(),-180,180),r=Gi(e.getNorth(),-90,90),i=Gi(e.getEast(),-180,180);return`POLYGON((${n} ${t},${i} ${t},${i} ${r},${n} ${r},${n} ${t}))`}function Gi(e,t,n){return Math.min(n,Math.max(t,e))}function Ki(e,t){if(!e.buckets?.length)return;let n=Math.max(...e.buckets.map(e=>e.count));for(let r of e.buckets){let e=Xi(r.value.value);if(!e)continue;let i=n>0?r.count/n:0;if(e.type===`Point`){let[n,r]=e.coordinates;$.circleMarker({lat:r,lng:n},{radius:4+i*16,fillColor:`#3388ff`,fillOpacity:.4+i*.4,color:`#3388ff`,weight:1}).addTo(t)}else $.polygon(qi(e.coordinates[0]),{fillColor:`#3388ff`,fillOpacity:.15+i*.35,color:`#3388ff`,weight:1}).addTo(t)}}function qi(e){return e.map(([e,t])=>({lat:t,lng:e}))}function Ji(e,t){if(setTimeout(()=>t.invalidateSize()),e?.type===`Point`){let[n,r]=e.coordinates,i={lng:n,lat:r},a=$.marker(i,{icon:Ri}).addTo(t);return t.setView(i,15,{animate:!1}),a}if(e?.type===`Polygon`){let n=$.polygon(qi(e.coordinates[0])).addTo(t),r=n.getBounds();return t.fitBounds(r,{animate:!1}),setTimeout(()=>{t.fitBounds(r,{animate:!1}),t.setView(n.getCenter(),void 0,{animate:!1})},1),n}t.setZoom(5)}var Yi=[[-90,-180],[90,180]];function Xi(e){let t=e.match(/^POINT\s*\(\s*([^()]+)\s*\)$/i);if(t){let e=Zi(t[1]);return e?{type:`Point`,coordinates:e}:void 0}let n=e.match(/^POLYGON\s*\(\(\s*(.*?)\s*\)\)$/i);if(!n)return;let r=n[1].split(`,`).map(Zi);if(!(r.length<3||r.some(e=>!e)))return{type:`Polygon`,coordinates:[r]}}function Zi(e){let t=e.trim().split(/\s+/).map(Number);return t.length===2&&t.every(Number.isFinite)?t:void 0}function Qi(e){return e.type===`Point`?`POINT(${e.coordinates.join(` `)})`:`POLYGON((${e.coordinates[0].map(e=>e.join(` `)).join(`,`)}))`}function $i(e){let t=[];if(e.columns<=0||e.rows<=0||!Number.isFinite(e.minX)||!Number.isFinite(e.maxX)||!Number.isFinite(e.minY)||!Number.isFinite(e.maxY))return t;let n=(e.maxX-e.minX)/e.columns,r=(e.maxY-e.minY)/e.rows;for(let i=0;i<Math.min(e.rows,e.counts.length);i++){let a=e.counts[i];if(a!==null)for(let o=0;o<Math.min(e.columns,a.length);o++){if(!Number.isFinite(a[o])||a[o]<=0)continue;let s=e.maxY-(i+.5)*r,c=e.minX+(o+.5)*n;t.push([s,c,a[o]])}}return t}export{bi as Config,Ae as DefaultTheme,Ci as FileUploadPlugin,Hi as LeafletPlugin,De as Plugin,Si as ShaclForm,w as ShaclPropertyTemplate,r as Theme,c as fetchRDF,se as findConformsToShapeSubject,T as findConformsToValuesSubject,_e as findLabel,Qi as geometryToWkt,Ce as importRDF,xi as initTimeout,Se as isRangeQueryField,v as loadGraphs,p as loadRDF,Oe as parseRDF,t as prefixes,d as propertyMappers,h as rdfCache,m as registerPlugin,Xi as wktToGeometry,Yi as worldBounds};
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,E as i,F as a,G as o,H as s,I as c,J as l,M as u,N as d,Q as ee,R as f,S as p,U as m,V as h,X as g,Y as _,Z as te,_ as v,b as y,c as b,d as x,et as S,f as C,g as w,h as T,i as E,j as D,k as O,l as k,m as ne,n as re,r as A,s as j,t as M,u as N,v as P,w as F,y as I,z as L}from"./assets/query-
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,E as i,F as a,G as o,H as s,I as c,J as l,M as u,N as d,Q as ee,R as f,S as p,U as m,V as h,X as g,Y as _,Z as te,_ as v,b as y,c as b,d as x,et as S,f as C,g as w,h as T,i as E,j as D,k as O,l as k,m as ne,n as re,r as A,s as j,t as M,u as N,v as P,w as F,y as I,z as L}from"./assets/query-By3xRVyt.js";import{BlankNode as R,DataFactory as z,Literal as B,NamedNode as V,Store as H}from"n3";import{RokitButton as U,RokitCollapsible as W,RokitInput as G,RokitSelect as K,RokitTextArea as q}from"@ro-kit/ui-widgets";import{Validator as J}from"shacl-engine";var Y=`
|
|
2
2
|
.editor:not([type='checkbox']) { border: 1px solid var(--shacl-border-color, #DDD); }
|
|
3
3
|
.property-instance label { display: inline-flex; align-self: center; word-break: break-word; line-height: 1em; padding-right: 1em; flex-shrink: 0; position: relative; }
|
|
4
4
|
.property-instance:has(> .editor:is(textarea, rokit-textarea)) > label { align-self: flex-start; padding-top: 0.45em; }
|
|
5
5
|
.property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
|
|
6
6
|
.mode-edit .property-instance label { width: var(--label-width); }
|
|
7
|
-
`,X=class extends y{constructor(e){super(e||Y),this.idCtr=0}createDefaultTemplate(e,t,n,r,i){let a=t??i?.defaultValue??null;if(r.id=`e${this.idCtr++}`,r.classList.add(`editor`),r.setAttribute(`part`,`editor`),i?.datatype?r.shaclDatatype=i.datatype:t instanceof B&&(r.shaclDatatype=t.datatype),i&&F(i)>0&&(r.dataset.minCount=String(F(i))),i?.class&&(r.dataset.class=i.class.value),i?.nodeKind)r.dataset.nodeKind=i.nodeKind.value;else if(t&&(t instanceof V||i?.nodeKind?.equals(_))&&(r.dataset.nodeKind=o+`IRI`,i)){let e=f(i.config.store.getQuads(t,null,null,null),i.config.languages);e&&(t=z.literal(e))}(i?.hasValue&&t||i?.readonly)&&(r.disabled=!0);let s=t?.value||i?.defaultValue?.value||``;t instanceof R?s=t.id:t instanceof V&&i?.nodeKind?.value===`http://www.w3.org/ns/shacl#IRIOrLiteral`&&(s=`<${t.value}>`),i?.datatype?.equals(S)?r.checked=t?.value===`true`||i?.defaultValue?.value===`true`:r.type===`file`?r.binaryData=s||void 0:r.value=s,v(r,a);let c=document.createElement(`label`);c.htmlFor=r.id,c.innerText=e,c.setAttribute(`part`,`label`),i?.description&&c.setAttribute(`title`,i.description.value);let l=i?.description?i.description.value:i?.pattern?i.pattern:null;l&&r.setAttribute(`placeholder`,l),n&&(r.setAttribute(`required`,`true`),c.classList.add(`required`));let u=document.createElement(`div`);return u.setAttribute(`part`,`field`),u.appendChild(c),u.appendChild(r),u}createDateEditor(e,t,r,i){let a=new G;i.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?(a.type=`datetime-local`,a.setAttribute(`step`,`1`)):a.type=`date`,a.clearable=!0,a.dense=this.dense,a.classList.add(`pr-0`);let o=this.createDefaultTemplate(e,null,r,a,i);if(t){let e=i.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?L(t.value):n(t.value);e?(a.value=e.value,e.suffix&&(a.dataset.xsdTemporalSuffix=e.suffix)):console.error(`unable to parse xsd date literal`,t),v(a,t)}return o}createTextEditor(e,t,n,r){let i;return r.singleLine===!1?(i=new q,i.resize=`auto`):i=new G,i.dense=this.dense,r.pattern&&(i.pattern=r.pattern),r.minLength&&(i.minLength=r.minLength),r.maxLength&&(i.maxLength=r.maxLength),this.createDefaultTemplate(e,t,n,i,r)}createLangStringEditor(e,t,n,r){let i=this.createTextEditor(e,t,n,r),a=i.querySelector(`:scope .editor`),o;if(r.languageIn?.length){o=document.createElement(`select`);for(let e of r.languageIn){let t=document.createElement(`option`);t.innerText=e.value,o.appendChild(t)}}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.setAttribute(`part`,`lang-chooser`),o.slot=`suffix`,a.addEventListener(`change`,()=>{o.required=a.value!==``}),o.addEventListener(`change`,e=>{e.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event(`change`,{bubbles:!0})))}),t instanceof B&&(o.value=t.language),a.dataset.lang=o.value,v(a,t??r.defaultValue),a.appendChild(o),i}createBooleanEditor(e,t,n,r){let i=document.createElement(`input`);i.type=`checkbox`,i.classList.add(`ml-0`);let a=this.createDefaultTemplate(e,null,n,i,r);return i.removeAttribute(`required`),a.querySelector(`:scope label`)?.classList.remove(`required`),t instanceof B&&(i.checked=t.value===`true`,v(i,t)),a}createFileEditor(e,t,n,r){let i=document.createElement(`input`);return i.type=`file`,i.addEventListener(`change`,e=>{if(i.files?.length){e.stopPropagation();let t=new FileReader;t.readAsDataURL(i.files[0]),t.onload=()=>{i.binaryData=btoa(t.result),i.parentElement?.dispatchEvent(new Event(`change`,{bubbles:!0}))}}else i.binaryData=void 0}),this.createDefaultTemplate(e,t,n,i,r)}createNumberEditor(e,t,n,r){let i=new G,a=m.has(r.datatype?.value??``);i.type=a?`text`:`number`,a&&(i.pattern=r.datatype?.value===`http://www.w3.org/2001/XMLSchema#decimal`?`[+\\-]?(?:[0-9]+(?:[.,][0-9]*)?|[.,][0-9]+)`:`[+\\-]?(?:[0-9]+(?:[.,][0-9]*)?|[.,][0-9]+)(?:[eE][+\\-]?[0-9]+)?`,i.updateComplete.then(()=>{i.inputElement.inputMode=`decimal`})),i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let o=r.minInclusive===void 0?r.minExclusive===void 0?void 0:r.minExclusive+1:r.minInclusive,s=r.maxInclusive===void 0?r.maxExclusive===void 0?void 0:r.maxExclusive-1:r.maxInclusive;return o!==void 0&&(i.min=String(o)),s!==void 0&&(i.max=String(s)),!a&&r.datatype?.value!==`http://www.w3.org/2001/XMLSchema#integer`&&(i.step=`any`),this.createDefaultTemplate(e,t,n,i,r)}createListEditor(e,t,n,r,i){let a=new K;a.clearable=!0,a.dense=this.dense;let o=this.createDefaultTemplate(e,null,n,a,i),s=document.createElement(`ul`),c=[],l=!0,u=(e,t)=>{let n=document.createElement(`li`);if(typeof e.value==`string`?(n.dataset.value=e.value,n.innerText=e.label?e.label:e.value):(n.dataset.value=I(e.value),c.push(e.value),n.innerText=e.label?e.label:e.value.value),t.appendChild(n),e.children?.length){l=!1;let t=document.createElement(`ul`);n.appendChild(t);for(let n of e.children)u(n,t)}};for(let e of r)u(e,s);return l||(a.collapse=!0),a.appendChild(s),P(a,c),t=t??i?.defaultValue??null,t&&(a.value=I(t),v(a,t)),o}createButton(e,t){let n=new U;return n.dense=this.dense,n.
|
|
8
|
-
`+t}this.hierarchyColorsStyleSheet=new CSSStyleSheet,this.hierarchyColorsStyleSheet.replaceSync(n)}}static dataAttributes(){let e=new Z;return Object.keys(e).map(e=>(e=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),`data-`+e))}buildTemplateKey(e,t){let n=e.value;return t&&(t instanceof r?n+=`*`+t.id.value:n+=`*`+this.buildTemplateKey(t.id,t.parent)),n}registerNodeTemplate(e){this._nodeTemplates[this.buildTemplateKey(e.id,e.parent)]=e}registerPropertyTemplate(e){this._propertyTemplates[this.buildTemplateKey(e.id,e.parent)]=e}getNodeTemplateIds(){let e=new Set;for(let t of Object.values(this._nodeTemplates))e.add(t.id.value);return e}getNodeTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._nodeTemplates[n];return r||=new A(e,this,t),r}getPropertyTemplate(e,t){let n=this.buildTemplateKey(e,t),i=this._propertyTemplates[n];return i||=new r(e,t),i}get nodeTemplates(){return Object.values(this._nodeTemplates)}get theme(){return this._theme}set theme(e){this._theme=e,e.setDense(this.attributes.dense===`true`)}get store(){return this._store}get editMode(){return this.mode===`edit`}get queryMode(){return this.mode===`query`}set store(e){this._store=e,this.lists=a(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(e=>{this.groups.push(e.id)},l,`${o}PropertyGroup`,null),this.validator=new J(e,{details:!0,factory:z})}},ae=200,$=class extends HTMLElement{static get observedAttributes(){return Q.dataAttributes()}constructor(){super(),this.shape=null,this.styleElement=null,this.validationQueue=Promise.resolve(),this.validationGeneration=0,this.form=document.createElement(`form`),this.form.setAttribute(`part`,`form`),this.config=new Q(this.form),this.form.addEventListener(`change`,e=>{e.stopPropagation(),this.config.queryMode?this.queryController?.handleChange():this.config.editMode&&this.validate(!0).then(e=>{this.refreshClassInstanceEditors(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:e.conforms,report:e}}))}).catch(e=>{console.warn(e)})})}connectedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}attributeChangedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.queryController?.dispose(),this.queryController=void 0,this.setAttribute(`loading`,``),this.config.theme.apply(this.form),this.applyStyles([this.config.theme.stylesheet]),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading)),this.initDebounceTimeout=setTimeout(async()=>{try{this.config.reset(),this.config.store=await x({shapes:this.config.attributes.shapes,shapesUrl:this.config.attributes.shapesUrl,values:this.config.attributes.values,valuesUrl:this.config.attributes.valuesUrl,valuesSubject:this.config.attributes.valuesSubject,loadOwlImports:this.config.attributes.ignoreOwlImports===null,classInstanceProvider:this.config.classInstanceProvider,rdfUrlResolver:this.config.rdfUrlResolver,proxy:this.config.attributes.proxy},this.config.originalValues),this.config.resourceLinkProvider&&await j(this.config),this.config.attributes.valuesSubject||(this.config.attributes.valuesSubject=k(this.config.store)||null),this.form.replaceChildren();let t=this.findRootShaclShapeSubject();if(t){if(this.form.classList.forEach(e=>{this.form.classList.remove(e)}),this.form.classList.toggle(`mode-edit`,this.config.editMode),this.form.classList.toggle(`mode-view`,this.config.mode===`view`),this.form.classList.toggle(`mode-query`,this.config.queryMode),this.config.queryMode){let{QueryModeController:e}=await p(async()=>{let{QueryModeController:e}=await import(`./assets/mode-
|
|
7
|
+
`,X=class extends y{constructor(e){super(e||Y),this.idCtr=0}createDefaultTemplate(e,t,n,r,i){let a=t??i?.defaultValue??null;if(r.id=`e${this.idCtr++}`,r.classList.add(`editor`),r.setAttribute(`part`,`editor`),i?.datatype?r.shaclDatatype=i.datatype:t instanceof B&&(r.shaclDatatype=t.datatype),i&&F(i)>0&&(r.dataset.minCount=String(F(i))),i?.class&&(r.dataset.class=i.class.value),i?.nodeKind)r.dataset.nodeKind=i.nodeKind.value;else if(t&&(t instanceof V||i?.nodeKind?.equals(_))&&(r.dataset.nodeKind=o+`IRI`,i)){let e=f(i.config.store.getQuads(t,null,null,null),i.config.languages);e&&(t=z.literal(e))}(i?.hasValue&&t||i?.readonly)&&(r.disabled=!0);let s=t?.value||i?.defaultValue?.value||``;t instanceof R?s=t.id:t instanceof V&&i?.nodeKind?.value===`http://www.w3.org/ns/shacl#IRIOrLiteral`&&(s=`<${t.value}>`),i?.datatype?.equals(S)?r.checked=t?.value===`true`||i?.defaultValue?.value===`true`:r.type===`file`?r.binaryData=s||void 0:r.value=s,v(r,a);let c=document.createElement(`label`);c.htmlFor=r.id,c.innerText=e,c.setAttribute(`part`,`label`),i?.description&&c.setAttribute(`title`,i.description.value);let l=i?.description?i.description.value:i?.pattern?i.pattern:null;l&&r.setAttribute(`placeholder`,l),n&&(r.setAttribute(`required`,`true`),c.classList.add(`required`));let u=document.createElement(`div`);return u.setAttribute(`part`,`field`),u.appendChild(c),u.appendChild(r),u}createDateEditor(e,t,r,i){let a=new G;i.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?(a.type=`datetime-local`,a.setAttribute(`step`,`1`)):a.type=`date`,a.clearable=!0,a.dense=this.dense,a.classList.add(`pr-0`);let o=this.createDefaultTemplate(e,null,r,a,i);if(t){let e=i.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?L(t.value):n(t.value);e?(a.value=e.value,e.suffix&&(a.dataset.xsdTemporalSuffix=e.suffix)):console.error(`unable to parse xsd date literal`,t),v(a,t)}return o}createTextEditor(e,t,n,r){let i;return r.singleLine===!1?(i=new q,i.resize=`auto`):i=new G,i.dense=this.dense,r.pattern&&(i.pattern=r.pattern),r.minLength&&(i.minLength=r.minLength),r.maxLength&&(i.maxLength=r.maxLength),this.createDefaultTemplate(e,t,n,i,r)}createLangStringEditor(e,t,n,r){let i=this.createTextEditor(e,t,n,r),a=i.querySelector(`:scope .editor`),o;if(r.languageIn?.length){o=document.createElement(`select`);for(let e of r.languageIn){let t=document.createElement(`option`);t.innerText=e.value,o.appendChild(t)}}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.setAttribute(`part`,`lang-chooser`),o.slot=`suffix`,a.addEventListener(`change`,()=>{o.required=a.value!==``}),o.addEventListener(`change`,e=>{e.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event(`change`,{bubbles:!0})))}),t instanceof B&&(o.value=t.language),a.dataset.lang=o.value,v(a,t??r.defaultValue),a.appendChild(o),i}createBooleanEditor(e,t,n,r){let i=document.createElement(`input`);i.type=`checkbox`,i.classList.add(`ml-0`);let a=this.createDefaultTemplate(e,null,n,i,r);return i.removeAttribute(`required`),a.querySelector(`:scope label`)?.classList.remove(`required`),t instanceof B&&(i.checked=t.value===`true`,v(i,t)),a}createFileEditor(e,t,n,r){let i=document.createElement(`input`);return i.type=`file`,i.addEventListener(`change`,e=>{if(i.files?.length){e.stopPropagation();let t=new FileReader;t.readAsDataURL(i.files[0]),t.onload=()=>{i.binaryData=btoa(t.result),i.parentElement?.dispatchEvent(new Event(`change`,{bubbles:!0}))}}else i.binaryData=void 0}),this.createDefaultTemplate(e,t,n,i,r)}createNumberEditor(e,t,n,r){let i=new G,a=m.has(r.datatype?.value??``);i.type=a?`text`:`number`,a&&(i.pattern=r.datatype?.value===`http://www.w3.org/2001/XMLSchema#decimal`?`[+\\-]?(?:[0-9]+(?:[.,][0-9]*)?|[.,][0-9]+)`:`[+\\-]?(?:[0-9]+(?:[.,][0-9]*)?|[.,][0-9]+)(?:[eE][+\\-]?[0-9]+)?`,i.updateComplete.then(()=>{i.inputElement.inputMode=`decimal`})),i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let o=r.minInclusive===void 0?r.minExclusive===void 0?void 0:r.minExclusive+1:r.minInclusive,s=r.maxInclusive===void 0?r.maxExclusive===void 0?void 0:r.maxExclusive-1:r.maxInclusive;return o!==void 0&&(i.min=String(o)),s!==void 0&&(i.max=String(s)),!a&&r.datatype?.value!==`http://www.w3.org/2001/XMLSchema#integer`&&(i.step=`any`),this.createDefaultTemplate(e,t,n,i,r)}createListEditor(e,t,n,r,i){let a=new K;a.clearable=!0,a.dense=this.dense;let o=this.createDefaultTemplate(e,null,n,a,i),s=document.createElement(`ul`),c=[],l=!0,u=(e,t)=>{let n=document.createElement(`li`);if(typeof e.value==`string`?(n.dataset.value=e.value,n.innerText=e.label?e.label:e.value):(n.dataset.value=I(e.value),c.push(e.value),n.innerText=e.label?e.label:e.value.value),t.appendChild(n),e.children?.length){l=!1;let t=document.createElement(`ul`);n.appendChild(t);for(let n of e.children)u(n,t)}};for(let e of r)u(e,s);return l||(a.collapse=!0),a.appendChild(s),P(a,c),t=t??i?.defaultValue??null,t&&(a.value=I(t),v(a,t)),o}createButton(e,t){let n=new U;return n.dense=this.dense,n.textContent=e,t?(n.setAttribute(`primary`,``),n.setAttribute(`part`,`button primary`)):n.setAttribute(`part`,`button`),n}},Z=class{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.preserveUnmappedValues=null,this.view=null,this.mode=null,this.language=null,this.loading=`Loading…`,this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.hierarchyColors=null,this.submitButton=null,this.generateNodeShapeReference=s.value,this.showNodeIds=null,this.showRootShapeLabel=null,this.dense=`true`,this.useShadowRoot=`true`}},ie=`#4c93d785, #f85e9a85, #00327385, #87001f85`,Q=class{constructor(e){this.attributes=new Z,this.mode=`edit`,this.lists={},this.groups=[],this.renderedNodes=new Set,this.originalValues=new H,this._store=new H,this._nodeTemplates={},this._propertyTemplates={},this.validator=new J(this._store,{details:!0,factory:z}),this.providedConformingResourceIds={},this.providedResources={},this.providedResourceLabels={},this.form=e,this._theme=new X,this.languages=[...new Set(navigator.languages.flatMap(e=>e.length>2?[e.toLocaleLowerCase(),e.substring(0,2)]:e)),``]}reset(){this.lists={},this.groups=[],this.renderedNodes.clear(),this.providedConformingResourceIds={},this.providedResources={},this.providedResourceLabels={},this.originalValues=new H,this._nodeTemplates={},this._propertyTemplates={}}updateAttributes(e){let t=new Z;if(Object.keys(t).forEach(n=>{let r=e.dataset[n];r!==void 0&&(t[n]=r)}),t.mode!==null&&![`edit`,`view`,`query`].includes(t.mode))throw Error(`invalid shacl-form mode: ${t.mode}`);if(this.mode=t.mode??(t.view===null?`edit`:`view`),this.theme.setDense(t.dense===`true`),this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){let e=this.languages.indexOf(t.language);e>-1&&this.languages.splice(e,1),this.languages.unshift(t.language)}if(t.valuesGraph&&(this.valuesGraphId=z.namedNode(t.valuesGraph)),t.hierarchyColors!=null){let e=t.hierarchyColors.length?t.hierarchyColors:ie,n=`:host { --hierarchy-colors: ${e}; --hierarchy-colors-length: ${e.split(`,`).length} }`;for(let e=8;e>=0;e--){let t=`shacl-property { --hierarchy-level: ${e} }`;for(let n=0;n<e;n++)t=`shacl-property `+t;n=n+`
|
|
8
|
+
`+t}this.hierarchyColorsStyleSheet=new CSSStyleSheet,this.hierarchyColorsStyleSheet.replaceSync(n)}}static dataAttributes(){let e=new Z;return Object.keys(e).map(e=>(e=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),`data-`+e))}buildTemplateKey(e,t){let n=e.value;return t&&(t instanceof r?n+=`*`+t.id.value:n+=`*`+this.buildTemplateKey(t.id,t.parent)),n}registerNodeTemplate(e){this._nodeTemplates[this.buildTemplateKey(e.id,e.parent)]=e}registerPropertyTemplate(e){this._propertyTemplates[this.buildTemplateKey(e.id,e.parent)]=e}getNodeTemplateIds(){let e=new Set;for(let t of Object.values(this._nodeTemplates))e.add(t.id.value);return e}getNodeTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._nodeTemplates[n];return r||=new A(e,this,t),r}getPropertyTemplate(e,t){let n=this.buildTemplateKey(e,t),i=this._propertyTemplates[n];return i||=new r(e,t),i}get nodeTemplates(){return Object.values(this._nodeTemplates)}get theme(){return this._theme}set theme(e){this._theme=e,e.setDense(this.attributes.dense===`true`)}get store(){return this._store}get editMode(){return this.mode===`edit`}get queryMode(){return this.mode===`query`}set store(e){this._store=e,this.lists=a(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(e=>{this.groups.push(e.id)},l,`${o}PropertyGroup`,null),this.validator=new J(e,{details:!0,factory:z})}},ae=200,$=class extends HTMLElement{static get observedAttributes(){return Q.dataAttributes()}constructor(){super(),this.shape=null,this.styleElement=null,this.validationQueue=Promise.resolve(),this.validationGeneration=0,this.form=document.createElement(`form`),this.form.setAttribute(`part`,`form`),this.config=new Q(this.form),this.form.addEventListener(`change`,e=>{e.stopPropagation(),this.config.queryMode?this.queryController?.handleChange():this.config.editMode&&this.validate(!0).then(e=>{this.refreshClassInstanceEditors(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:e.conforms,report:e}}))}).catch(e=>{console.warn(e)})})}connectedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}attributeChangedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.queryController?.dispose(),this.queryController=void 0,this.setAttribute(`loading`,``),this.config.theme.apply(this.form),this.applyStyles([this.config.theme.stylesheet]),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading)),this.initDebounceTimeout=setTimeout(async()=>{try{this.config.reset(),this.config.store=await x({shapes:this.config.attributes.shapes,shapesUrl:this.config.attributes.shapesUrl,values:this.config.attributes.values,valuesUrl:this.config.attributes.valuesUrl,valuesSubject:this.config.attributes.valuesSubject,loadOwlImports:this.config.attributes.ignoreOwlImports===null,classInstanceProvider:this.config.classInstanceProvider,rdfUrlResolver:this.config.rdfUrlResolver,proxy:this.config.attributes.proxy},this.config.originalValues),this.config.resourceLinkProvider&&await j(this.config),this.config.attributes.valuesSubject||(this.config.attributes.valuesSubject=k(this.config.store)||null),this.form.replaceChildren();let t=this.findRootShaclShapeSubject();if(t){if(this.form.classList.forEach(e=>{this.form.classList.remove(e)}),this.form.classList.toggle(`mode-edit`,this.config.editMode),this.form.classList.toggle(`mode-view`,this.config.mode===`view`),this.form.classList.toggle(`mode-query`,this.config.queryMode),this.config.queryMode){let{QueryModeController:e}=await p(async()=>{let{QueryModeController:e}=await import(`./assets/mode-DZ8YP6FS.js`);return{QueryModeController:e}},[]);this.queryController=new e(this)}this.config.theme.apply(this.form);let e=[this.config.theme.stylesheet];this.config.hierarchyColorsStyleSheet&&e.push(this.config.hierarchyColorsStyleSheet),this.queryController&&e.push(this.queryController.stylesheet);for(let t of ne())t.stylesheet&&e.push(t.stylesheet);this.applyStyles(e);let n=new A(t,this.config);for(let e of this.config.nodeTemplates)E(e);if(this.shape=new re(n,this.config.attributes.valuesSubject?z.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.attributes.showRootShapeLabel!==null&&n.label){let e=document.createElement(`h3`);e.innerText=n.label.value,this.form.prepend(e)}if(this.config.editMode){if(this.config.attributes.submitButton!==null){let e=this.config.theme.createButton(this.config.attributes.submitButton||`Submit`,!0);e.classList.add(`submit-button`);let t=e.getAttribute(`part`);e.setAttribute(`part`,`${t?t+` `:``}submit-button`),e.addEventListener(`click`,e=>{e.preventDefault(),this.form.reportValidity()?this.validate().then(e=>{e?.conforms?this.dispatchEvent(new Event(`submit`,{bubbles:!0,cancelable:!0})):this.focusFirstInvalidElement()}):this.validate().then(()=>{this.focusFirstInvalidElement(!0)})}),this.form.appendChild(e)}await this.shape?.ready,this.config.attributes.valuesSubject&&this.removeFromDataGraph(z.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0),this.refreshClassInstanceEditors()}else this.config.queryMode&&(await this.shape.ready,await this.queryController?.initialize())}else if(this.config.store.countQuads(null,null,null,e)>0)throw Error(`shacl root node shape not found`)}catch(e){console.error(e);let t=document.createElement(`div`);t.innerText=String(e),this.form.replaceChildren(t)}this.config.queryMode&&this.config.queryFacetProvider&&this.queryController||this.removeAttribute(`loading`),await this.shape?.ready,this.dispatchEvent(new Event(`ready`))},200)}ensureRenderRoot(){this.config.attributes.useShadowRoot===`false`?(this.shadowRoot?.contains(this.form)&&this.shadowRoot.removeChild(this.form),this.contains(this.form)||this.prepend(this.form)):(this.shadowRoot||this.attachShadow({mode:`open`}),this.shadowRoot.contains(this.form)||this.shadowRoot.prepend(this.form))}focusFirstInvalidElement(e=!1){let t=this.form.querySelector(`:scope .invalid > .editor`);t?(e&&t.reportValidity?.(),t instanceof K?t.input.inputElement.focus():t.focus()):this.form.querySelector(`:scope .invalid`)?.scrollIntoView()}applyStyles(e){if(this.config.attributes.useShadowRoot!==`false`&&this.shadowRoot){this.shadowRoot.adoptedStyleSheets=e,this.styleElement&&=(this.styleElement.remove(),null);return}let t=e.map(e=>Array.from(e.cssRules).map(e=>e.cssText).join(`
|
|
9
9
|
`).replace(/:host\b/g,`shacl-form`)).join(`
|
|
10
10
|
`);this.styleElement||(this.styleElement=document.createElement(`style`),this.prepend(this.styleElement)),this.styleElement.textContent=t}serialize(e=`text/turtle`,t){return this.assertNotQueryMode(`serialize`),t??=this.toRDF(),w(t.getQuads(null,null,null,null),e,u)}toRDF(e=new H){this.assertNotQueryMode(`toRDF`);let t;return this.config.attributes.preserveUnmappedValues!==null&&(t=this.preparePreservedOutput(e)),this.shape?.toRDF(e,void 0,this.config.attributes.generateNodeShapeReference),t?.size&&this.pruneOrphanedBlankNodes(e,t),e}preparePreservedOutput(e){let t=this.config.originalValues,n=new Map;e.addQuads(t.getQuads(null,null,null,null));for(let r of this.form.querySelectorAll(`shacl-property`))if(!r.parent.linked){for(let i of r.template.pathAlternatives??[r.template.path])if(i)for(let a of t.getQuads(r.parent.nodeId,i,null,null))e.delete(a),a.object.termType===`BlankNode`&&n.set(a.object.id,a.object)}for(let n of this.form.querySelectorAll(`shacl-node:not([part~="linked-node"])`))if(n.template.targetClass)for(let r of t.getQuads(n.nodeId,l,n.template.targetClass,null))e.delete(r);let r=this.config.attributes.generateNodeShapeReference;if(this.shape&&r)for(let n of t.getQuads(this.shape.nodeId,z.namedNode(r),this.shape.template.id,null))e.delete(n);return n}pruneOrphanedBlankNodes(e,t){let n=new Map(t),r=[...t.values()];for(;r.length;){let t=r.pop();for(let i of e.getQuads(t,null,null,null))i.object.termType===`BlankNode`&&!n.has(i.object.id)&&(n.set(i.object.id,i.object),r.push(i.object))}let i=new Set,a=[],o=e=>{i.has(e.id)||(i.add(e.id),a.push(e))};for(let e of this.form.querySelectorAll(`shacl-node:not([part~="linked-node"])`))e.nodeId.termType===`BlankNode`&&n.has(e.nodeId.id)&&o(e.nodeId);for(let t of n.values())e.getQuads(null,null,t,null).some(e=>e.subject.termType!==`BlankNode`||!n.has(e.subject.id))&&o(t);for(;a.length;){let t=a.pop();for(let r of e.getQuads(t,null,null,null))r.object.termType===`BlankNode`&&n.has(r.object.id)&&o(r.object)}for(let t of n.values())if(!i.has(t.id))for(let n of e.getQuads(t,null,null,null))e.delete(n)}registerPlugin(e){T(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}setRdfUrlResolver(e){this.config.rdfUrlResolver=e,this.initialize()}setResourceLinkProvider(e){this.config.resourceLinkProvider=e,this.initialize()}setQueryFacetProvider(e){this.config.queryFacetProvider=e,this.queryController?.refreshFacets()}getQuery(){return this.shape?this.queryController?.getQuery()??{rootShapeId:this.shape.template.id.value,targetClass:this.shape.template.targetClass?.value,criteria:[]}:{rootShapeId:``,criteria:[]}}refreshQueryFacets(){this.queryController?.refreshFacets()}async validate(e=!1){this.assertNotQueryMode(`validate`);let t=++this.validationGeneration;for(let e of this.form.querySelectorAll(`:scope .validation-error`))e.remove();for(let t of this.form.querySelectorAll(`:scope .property-instance`)){let n=t.querySelector(`:scope > .editor`),r=!!n?.value,i=n?.validity?.valid===!1&&(r||!e);t.classList.toggle(`invalid`,i),r&&!i?t.classList.add(`valid`):t.classList.remove(`valid`),i&&n?.validationMessage&&this.appendValidationErrorDisplay(t,n.validationMessage)}for(let e of this.form.querySelectorAll(`.add-button-wrapper`))e.classList.remove(`invalid`,`validation-error`);if(!this.shape)return{conforms:!0,results:[]};if(!e){let e=this.form.querySelectorAll(`.add-button-wrapper.required`);for(let t of e)t.classList.add(`invalid`),t.after(this.createValidationErrorDisplay(`Value is required`,`node`));if(e.length>0)return{conforms:!1,results:[]}}let n=this.shape,r=()=>new Promise(r=>{this.config.store.deleteGraph(this.config.valuesGraphId||``).on(`end`,async()=>{n.toRDF(this.config.store,void 0,this.config.attributes.generateNodeShapeReference);try{let i=await this.config.validator.validate({dataset:this.config.store,terms:[n.nodeId]},[{terms:[n.template.id]}]);if(t!==this.validationGeneration){r(i);return}let a=[...i.results];for(let t=0;t<a.length;t++){let n=a[t];if(a.push(...n.results??[]),n.focusNode?.ptrs?.length)for(let t of n.focusNode.ptrs){let r=t._term;if(n.path?.length){let t=n.path[0].predicates[0],i=e=>`
|
|
11
11
|
:scope shacl-node[data-node-id='${r.id}'] > shacl-property > .property-instance[${e}='${t.id}'] > .editor,
|
package/dist/node-template.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DataFactory as e}from"n3";import"rdfxml-streaming-parser";import"jsonld";var t=class{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)}},n=`http://www.w3.org/ns/shacl#`,r=`http://datashapes.org/dash#`,i=`http://www.w3.org/2001/XMLSchema#`,a=`http://www.w3.org/ns/oa#`,o=e.namedNode(`loaded-shapes`),s=e.namedNode(`loaded-data`),c=e.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`),l=e.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`);e.namedNode(`http://purl.org/dc/terms/conformsTo`);var u=e.namedNode(`http://www.w3.org/2000/01/rdf-schema#subClassOf`),d=e.namedNode(`http://www.w3.org/2002/07/owl#imports`),f=e.namedNode(`http://www.w3.org/2004/02/skos/core#broader`),p=e.namedNode(`http://www.w3.org/2004/02/skos/core#narrower`);e.namedNode(`http://www.w3.org/ns/shacl#NodeShape`),e.namedNode(`http://www.w3.org/ns/shacl#IRI`),e.namedNode(`http://www.w3.org/ns/shacl#property`);var m=e.namedNode(`http://www.w3.org/ns/shacl#class`);e.namedNode(`http://www.w3.org/ns/shacl#node`),e.namedNode(`http://www.w3.org/ns/shacl#message`),e.namedNode(`http://www.w3.org/ns/shacl#targetClass`),e.namedNode(`http://www.w3.org/ns/shacl#nodeKind`),e.namedNode(`http://www.w3.org/2001/XMLSchema#string`),e.namedNode(`http://www.w3.org/2001/XMLSchema#boolean`);function h(e,t,r=n,i){let a=``,o=g(e,t,r,i);return o&&(a=o.value),a}function g(e,t,r=n,i){let a,o=r+t;if(i?.length){for(let t of i)for(let n of e)if(n.predicate.value===o){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf(`@`)<0?a=n.object:a||=n.object}}else for(let t of e)if(t.predicate.value===o)return t.object;return a}function _(e,t){return h(e,`prefLabel`,`http://www.w3.org/2004/02/skos/core#`,t)||h(e,`label`,`http://www.w3.org/2000/01/rdf-schema#`,t)||h(e,`title`,`http://purl.org/dc/terms/`,t)||h(e,`name`,`http://xmlns.com/foaf/0.1/`,t)}function v(e,t,n){let r=[];for(let i of e)r.push({value:i,label:_(t.getQuads(i,null,null,null),n),children:[]});return r}function y(t,n,r=new Map){r.set(o.id,o),r.set(s.id,s);let i=t.config.valuesGraphId??e.defaultGraph();r.set(i.id,i);for(let e of t.owlImports)b(e,n,r);return t.parent&&y(t.parent,n,r),[...r.values()]}function b(e,t,n){if(!n.has(e.id)){n.set(e.id,e);for(let r of t.getObjects(null,d,e))r.termType===`NamedNode`&&b(r,t,n)}}function x(e,t,n,r){return r.flatMap(r=>e.getSubjects(t,n,r))}function S(e,t,n,r){return r.flatMap(r=>e.getObjects(t,n,r))}function C(e,t){if(t.in){let e=t.config.lists[t.in];return v(e?.length?e:[],t.config.store,t.config.languages)}else{let n=y(t,t.config.store),r=x(t.config.store,c,e,n),i=new Map,a=new Map;for(let e of r)i.set(e.id,{value:e,label:_(t.config.store.getQuads(e,null,null,null),t.config.languages),children:[]});for(let e of r){for(let r of S(t.config.store,e,f,n))i.has(r.id)&&a.set(e.id,r.id);for(let r of S(t.config.store,e,p,n))i.has(r.id)&&a.set(r.id,e.id);for(let r of S(t.config.store,e,u,n))i.has(r.id)&&a.set(e.id,r.id)}for(let[e,t]of a.entries())i.get(t)?.children?.push(i.get(e));let o=[];for(let[e,t]of i.entries())a.has(e)||o.push(t);for(let r of x(t.config.store,u,e,n))o.push(...C(r,t));return o}}`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${r}`,`${r}`,`${a}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,d.id,m.id,`${n}`,`${n}`;function w(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}export{l as a,i,v as n,t as o,C as r,w as t};
|
|
1
|
+
import{DataFactory as e}from"n3";import"rdfxml-streaming-parser";import"jsonld";var t=class{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)}},n=`http://www.w3.org/ns/shacl#`,r=`http://datashapes.org/dash#`,i=`http://www.w3.org/2001/XMLSchema#`,a=`http://www.w3.org/ns/oa#`,o=e.namedNode(`loaded-shapes`),s=e.namedNode(`loaded-data`),c=e.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`),l=e.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`);e.namedNode(`http://purl.org/dc/terms/conformsTo`);var u=e.namedNode(`http://www.w3.org/2000/01/rdf-schema#subClassOf`),d=e.namedNode(`http://www.w3.org/2002/07/owl#imports`),f=e.namedNode(`http://www.w3.org/2004/02/skos/core#broader`),p=e.namedNode(`http://www.w3.org/2004/02/skos/core#narrower`);e.namedNode(`http://www.w3.org/ns/shacl#NodeShape`),e.namedNode(`http://www.w3.org/ns/shacl#IRI`),e.namedNode(`http://www.w3.org/ns/shacl#property`);var m=e.namedNode(`http://www.w3.org/ns/shacl#class`);e.namedNode(`http://www.w3.org/ns/shacl#node`),e.namedNode(`http://www.w3.org/ns/shacl#message`),e.namedNode(`http://www.w3.org/ns/shacl#targetClass`),e.namedNode(`http://www.w3.org/ns/shacl#nodeKind`),e.namedNode(`http://www.w3.org/2001/XMLSchema#string`),e.namedNode(`http://www.w3.org/2001/XMLSchema#boolean`);function h(e,t,r=n,i){let a=``,o=g(e,t,r,i);return o&&(a=o.value),a}function g(e,t,r=n,i){let a,o=r+t;if(i?.length){for(let t of i)for(let n of e)if(n.predicate.value===o){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf(`@`)<0?a=n.object:a||=n.object}}else for(let t of e)if(t.predicate.value===o)return t.object;return a}function _(e,t){return h(e,`prefLabel`,`http://www.w3.org/2004/02/skos/core#`,t)||h(e,`label`,`http://www.w3.org/2000/01/rdf-schema#`,t)||h(e,`title`,`http://purl.org/dc/terms/`,t)||h(e,`name`,`http://xmlns.com/foaf/0.1/`,t)}function v(e,t,n){let r=[];for(let i of e)r.push({value:i,label:_(t.getQuads(i,null,null,null),n),children:[]});return r}function y(t,n,r=new Map){r.set(o.id,o),r.set(s.id,s);let i=t.config.valuesGraphId??e.defaultGraph();r.set(i.id,i);for(let e of t.owlImports)b(e,n,r);return t.parent&&y(t.parent,n,r),[...r.values()]}function b(e,t,n){if(!n.has(e.id)){n.set(e.id,e);for(let r of t.getObjects(null,d,e))r.termType===`NamedNode`&&b(r,t,n)}}function x(e,t,n,r){return r.flatMap(r=>e.getSubjects(t,n,r))}function S(e,t,n,r){return r.flatMap(r=>e.getObjects(t,n,r))}function C(e,t){if(t.in){let e=t.config.lists[t.in];return v(e?.length?e:[],t.config.store,t.config.languages)}else{let n=y(t,t.config.store),r=x(t.config.store,c,e,n),i=new Map,a=new Map;for(let e of r)i.set(e.id,{value:e,label:_(t.config.store.getQuads(e,null,null,null),t.config.languages),children:[]});for(let e of r){for(let r of S(t.config.store,e,f,n))i.has(r.id)&&a.set(e.id,r.id);for(let r of S(t.config.store,e,p,n))i.has(r.id)&&a.set(r.id,e.id);for(let r of S(t.config.store,e,u,n))i.has(r.id)&&a.set(e.id,r.id)}for(let[e,t]of a.entries())i.get(t)?.children?.push(i.get(e));let o=[];for(let[e,t]of i.entries())a.has(e)||o.push(t);for(let r of x(t.config.store,u,e,n))o.push(...C(r,t));return o}}`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${r}`,`${r}`,`${r}`,`${a}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,`${n}`,d.id,m.id,`${n}`,`${n}`;function w(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}export{l as a,i,v as n,t as o,C as r,w as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,t}from"./assets/property-template-
|
|
1
|
+
import{o as e,t}from"./assets/property-template-D3YimlX8.js";var n=class extends e{constructor(e,t,n){super(e),this.onChange=t,this.fileType=n}createEditor(e){let n=t(e)>0,r=e.config.theme.createFileEditor(e.label,null,n,e);return r.addEventListener(`change`,e=>{e.stopPropagation(),this.onChange(e)}),this.fileType&&r.querySelector(`input[type="file"]`)?.setAttribute(`accept`,this.fileType),r}};export{n as FileUploadPlugin};
|
package/dist/plugins/leaflet.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"./assets/property-template-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./assets/property-template-D3YimlX8.js";import*as o from"leaflet";import"leaflet-editable/src/Leaflet.Editable.js";import s from"leaflet/dist/leaflet.css?raw";import c from"leaflet.fullscreen/dist/Control.FullScreen.css?raw";import"leaflet.fullscreen";import"leaflet.heat/dist/leaflet-heat.js";import{RokitButton as l}from"@ro-kit/ui-widgets";import{DataFactory as u,Literal as d}from"n3";function f(r,o,s){if(s){let s=a(r)>0;if(r.class&&!r.hasValue)return r.config.theme.createListEditor(r.label,o,s,i(r.class,r),r);if(r.in){let e=r.config.lists[r.in];if(e?.length){let t=n(e,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,o,s,t,r)}else console.error(`list not found:`,r.in,`existing lists:`,r.config.lists)}if(r.datatype?.equals(e)||r.languageIn?.length||r.datatype===void 0&&o instanceof d&&o.language)return r.config.theme.createLangStringEditor(r.label,o,s,r);switch(r.datatype?.value.replace(t,``)){case`integer`:case`float`:case`double`:case`decimal`:return r.config.theme.createNumberEditor(r.label,o,s,r);case`date`:case`dateTime`:return r.config.theme.createDateEditor(r.label,o,s,r);case`boolean`:return r.config.theme.createBooleanEditor(r.label,o,s,r);case`base64Binary`:return r.config.theme.createFileEditor(r.label,o,s,r)}return r.config.theme.createTextEditor(r.label,o,s,r)}else return o?r.config.theme.createViewer(r.label,o,r):document.createElement(`div`)}var p=c.replace(`:root`,`:host`),m=`
|
|
2
2
|
#shaclMapDialog .closeButton { position: absolute; right: 0; top: 0; z-index: 1000; padding: 6px 8px; cursor: pointer; border: 0; background-color: #FFFA; font-size: 24px; }
|
|
3
3
|
#shaclMapDialog { padding: 0; width:90vw; height: 90vh; margin: auto; }
|
|
4
4
|
#shaclMapDialog::backdrop { background-color: #0007; }
|
|
@@ -20,6 +20,6 @@ import{a as e,i as t,n,o as r,r as i,t as a}from"./assets/property-template-DgV0
|
|
|
20
20
|
<div id="shaclMapDialogContainer"></div>
|
|
21
21
|
<div class="hint">ⓘ Draw a polygon or marker, then close dialog</div>
|
|
22
22
|
<button class="closeButton" type="button">✕</button>
|
|
23
|
-
</dialog>`,g={lng:8.657238961696038,lat:49.87627570549512},_=`© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>`,v=`https://tile.openstreetmap.de/{z}/{x}/{y}.png`,y=o.icon({iconUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=`,shadowUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC`,iconSize:[25,41],shadowSize:[41,41],iconAnchor:[12,41],shadowAnchor:[14,41],popupAnchor:[-3,-76]});function b(e,t){return o.map(e,{...t,layers:[o.tileLayer(v)]})}function x(e,t){let n=o.default??o,r=window.L,i=n,a=r;return!i.heatLayer&&a?.heatLayer&&(i.HeatLayer=a.HeatLayer,i.heatLayer=a.heatLayer),window.L=n,i.heatLayer(e,{maxZoom:t})}function S(e,t,n){return new(o.Control.extend({options:{position:`topleft`},onAdd:()=>{let r=o.DomUtil.create(`div`,`leaflet-control leaflet-bar`),i=o.DomUtil.create(`a`,``,r);return i.href=`#`,i.title=e,i.
|
|
23
|
+
</dialog>`,g={lng:8.657238961696038,lat:49.87627570549512},_=`© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>`,v=`https://tile.openstreetmap.de/{z}/{x}/{y}.png`,y=o.icon({iconUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=`,shadowUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC`,iconSize:[25,41],shadowSize:[41,41],iconAnchor:[12,41],shadowAnchor:[14,41],popupAnchor:[-3,-76]});function b(e,t){return o.map(e,{...t,layers:[o.tileLayer(v)]})}function x(e,t){let n=o.default??o,r=window.L,i=n,a=r;return!i.heatLayer&&a?.heatLayer&&(i.HeatLayer=a.HeatLayer,i.heatLayer=a.heatLayer),window.L=n,i.heatLayer(e,{maxZoom:t})}function S(e,t,n){return new(o.Control.extend({options:{position:`topleft`},onAdd:()=>{let r=o.DomUtil.create(`div`,`leaflet-control leaflet-bar`),i=o.DomUtil.create(`a`,``,r);return i.href=`#`,i.title=e,i.textContent=t,o.DomEvent.on(i,`click`,o.DomEvent.stop).on(i,`click`,n),r}}))}var C=class extends r{constructor(e){super(e,s+`
|
|
24
24
|
`+p+`
|
|
25
|
-
`+m)}initEditMode(e){e.insertAdjacentHTML(`beforeend`,h);let t=e.querySelector(`#shaclMapDialogContainer`);this.map=b(t,{fullscreenControl:!0,editable:!0,zoom:5,maxBounds:A,center:g}),this.map.attributionControl.addAttribution(_);let n=this.map;this.map.addControl(S(`Create a new polygon`,`▰`,()=>{this.displayedShape?.remove(),this.displayedShape=n.editTools.startPolygon()})),this.map.addControl(S(`Create a new marker`,`•`,()=>{this.displayedShape?.remove(),this.displayedShape=n.editTools.startMarker(void 0,{icon:y})})),this.map.on(`editable:drawing:end editable:vertex:dragend`,()=>{this.saveChanges()});let r=e.querySelector(`#shaclMapDialog`);return r.addEventListener(`click`,e=>{e.target===r&&r.close()}),r.querySelector(`.closeButton`)?.addEventListener(`click`,()=>r.close()),r.addEventListener(`close`,()=>{let e=document.body.style.top;document.body.style.position=``,document.body.style.top=``,window.scrollTo(0,parseInt(e||`0`)*-1),this.currentEditor&&this.createdGeometry&&(this.currentEditor.value=N(this.createdGeometry),this.currentEditor.dispatchEvent(new Event(`change`,{bubbles:!0})))}),r}createEditor(e,t){let n=e.config.form.querySelector(`#shaclMapDialog`);n||=this.initEditMode(e.config.form);let r=e.config.theme.createButton(`Open
|
|
25
|
+
`+m)}initEditMode(e){e.insertAdjacentHTML(`beforeend`,h);let t=e.querySelector(`#shaclMapDialogContainer`);this.map=b(t,{fullscreenControl:!0,editable:!0,zoom:5,maxBounds:A,center:g}),this.map.attributionControl.addAttribution(_);let n=this.map;this.map.addControl(S(`Create a new polygon`,`▰`,()=>{this.displayedShape?.remove(),this.displayedShape=n.editTools.startPolygon()})),this.map.addControl(S(`Create a new marker`,`•`,()=>{this.displayedShape?.remove(),this.displayedShape=n.editTools.startMarker(void 0,{icon:y})})),this.map.on(`editable:drawing:end editable:vertex:dragend`,()=>{this.saveChanges()});let r=e.querySelector(`#shaclMapDialog`);return r.addEventListener(`click`,e=>{e.target===r&&r.close()}),r.querySelector(`.closeButton`)?.addEventListener(`click`,()=>r.close()),r.addEventListener(`close`,()=>{let e=document.body.style.top;document.body.style.position=``,document.body.style.top=``,window.scrollTo(0,parseInt(e||`0`)*-1),this.currentEditor&&this.createdGeometry&&(this.currentEditor.value=N(this.createdGeometry),this.currentEditor.dispatchEvent(new Event(`change`,{bubbles:!0})))}),r}createEditor(e,t){let n=e.config.form.querySelector(`#shaclMapDialog`);n||=this.initEditMode(e.config.form);let r=e.config.theme.createButton(`Open map...`,!1);r.style.marginLeft=`5px`,r.classList.add(`open-map-button`),r.onclick=()=>{this.currentEditor=i.querySelector(`.editor`),this.createdGeometry=void 0,this.displayedShape?.remove(),this.drawAndZoomToGeometry(j(this.currentEditor.value||``),this.map),document.body.style.top=`-${window.scrollY}px`,document.body.style.position=`fixed`,n.showModal()};let i=f(e,t||null,!0);return i.appendChild(r),i}createQueryEditor(e,t){let n=document.createElement(`div`);n.classList.add(`query-editor`,`query-map-editor`),n.dataset.queryFieldId=e.id,n.setAttribute(`part`,`query-editor`);let r=document.createElement(`label`);r.textContent=t.label,t.description&&(r.title=t.description.value),n.appendChild(r);let i=document.createElement(`div`);i.classList.add(`query-controls`),n.appendChild(i);let a=document.createElement(`div`);a.classList.add(`query-map`),i.appendChild(a);let s=new l;s.classList.add(`clear`,`query-map-clear`),s.title=`Clear`,s.dense=t.config.theme.dense,s.icon=!0,s.hidden=!0,i.appendChild(s);let c=!1,d,f=b(a,{attributionControl:!1,fullscreenControl:!0,maxBoundsViscosity:1,trackResize:!1,zoom:0});f.fitBounds(A).setMaxBounds(A),f.on(`moveend`,()=>{c=f.getZoom()>0,s.hidden=!c;let e=c?T(f.getBounds()):void 0;e!==d&&(d=e,n.dispatchEvent(new Event(`change`,{bubbles:!0})))}),s.addEventListener(`click`,e=>{e.stopPropagation(),f.fitBounds(A,{animate:!1})});let p,m=o.featureGroup().addTo(f),h=e=>{if(m.clearLayers(),p=void 0,e)if(e.heatmap){if(!w(f,a)){p=e;return}let t=P(e.heatmap);t.length&&x(t,f.getZoom()||0).addTo(m)}else D(e,m)};return new ResizeObserver(()=>{a.clientWidth<=0||a.clientHeight<=0||(f.invalidateSize({debounceMoveend:!0}),p&&h(p))}).observe(a),n.getQueryCriteria=()=>!c||!d?[]:[{field:e,operator:`equals`,value:u.literal(d,t.datatype)}],n.setQueryFacet=h,n}createViewer(e,t){let n=document.createElement(`div`),r=j(t.value);if(r){let e=b(n,{fullscreenControl:!0,zoom:5,center:g,maxBounds:A});e.attributionControl.addAttribution(_),k(r,e)}return n}drawAndZoomToGeometry(e,t){this.displayedShape=k(e,t)}saveChanges(){if(this.displayedShape instanceof o.Marker){let{lng:e,lat:t}=this.displayedShape.getLatLng();this.createdGeometry={type:`Point`,coordinates:[e,t]};return}if(this.displayedShape instanceof o.Polygon){let e=this.displayedShape.getLatLngs()[0];if(!e.length){this.createdGeometry=void 0;return}let t=e.map(({lng:e,lat:t})=>[e,t]);e[0].equals(e[e.length-1])||t.push([...t[0]]),this.createdGeometry={type:`Polygon`,coordinates:[t]};return}this.createdGeometry=void 0}};function w(e,t){let n=t.getBoundingClientRect(),r=e.getSize();return n.width>0&&n.height>0&&r.x>0&&r.y>0}function T(e){let t=E(e.getSouth(),-90,90),n=E(e.getWest(),-180,180),r=E(e.getNorth(),-90,90),i=E(e.getEast(),-180,180);return`POLYGON((${n} ${t},${i} ${t},${i} ${r},${n} ${r},${n} ${t}))`}function E(e,t,n){return Math.min(n,Math.max(t,e))}function D(e,t){if(!e.buckets?.length)return;let n=Math.max(...e.buckets.map(e=>e.count));for(let r of e.buckets){let e=j(r.value.value);if(!e)continue;let i=n>0?r.count/n:0;if(e.type===`Point`){let[n,r]=e.coordinates;o.circleMarker({lat:r,lng:n},{radius:4+i*16,fillColor:`#3388ff`,fillOpacity:.4+i*.4,color:`#3388ff`,weight:1}).addTo(t)}else o.polygon(O(e.coordinates[0]),{fillColor:`#3388ff`,fillOpacity:.15+i*.35,color:`#3388ff`,weight:1}).addTo(t)}}function O(e){return e.map(([e,t])=>({lat:t,lng:e}))}function k(e,t){if(setTimeout(()=>t.invalidateSize()),e?.type===`Point`){let[n,r]=e.coordinates,i={lng:n,lat:r},a=o.marker(i,{icon:y}).addTo(t);return t.setView(i,15,{animate:!1}),a}if(e?.type===`Polygon`){let n=o.polygon(O(e.coordinates[0])).addTo(t),r=n.getBounds();return t.fitBounds(r,{animate:!1}),setTimeout(()=>{t.fitBounds(r,{animate:!1}),t.setView(n.getCenter(),void 0,{animate:!1})},1),n}t.setZoom(5)}var A=[[-90,-180],[90,180]];function j(e){let t=e.match(/^POINT\s*\(\s*([^()]+)\s*\)$/i);if(t){let e=M(t[1]);return e?{type:`Point`,coordinates:e}:void 0}let n=e.match(/^POLYGON\s*\(\(\s*(.*?)\s*\)\)$/i);if(!n)return;let r=n[1].split(`,`).map(M);if(!(r.length<3||r.some(e=>!e)))return{type:`Polygon`,coordinates:[r]}}function M(e){let t=e.trim().split(/\s+/).map(Number);return t.length===2&&t.every(Number.isFinite)?t:void 0}function N(e){return e.type===`Point`?`POINT(${e.coordinates.join(` `)})`:`POLYGON((${e.coordinates[0].map(e=>e.join(` `)).join(`,`)}))`}function P(e){let t=[];if(e.columns<=0||e.rows<=0||!Number.isFinite(e.minX)||!Number.isFinite(e.maxX)||!Number.isFinite(e.minY)||!Number.isFinite(e.maxY))return t;let n=(e.maxX-e.minX)/e.columns,r=(e.maxY-e.minY)/e.rows;for(let i=0;i<Math.min(e.rows,e.counts.length);i++){let a=e.counts[i];if(a!==null)for(let o=0;o<Math.min(e.columns,a.length);o++){if(!Number.isFinite(a[o])||a[o]<=0)continue;let s=e.maxY-(i+.5)*r,c=e.minX+(o+.5)*n;t.push([s,c,a[o]])}}return t}export{C as LeafletPlugin,N as geometryToWkt,j as wktToGeometry,A as worldBounds};
|
|
@@ -25,6 +25,7 @@ export declare class ShaclPropertyTemplate {
|
|
|
25
25
|
maxExclusive: number | undefined;
|
|
26
26
|
singleLine: boolean | undefined;
|
|
27
27
|
readonly: boolean | undefined;
|
|
28
|
+
facet: boolean | undefined;
|
|
28
29
|
cssClass: string | undefined;
|
|
29
30
|
defaultValue: Term | undefined;
|
|
30
31
|
pattern: string | undefined;
|
|
@@ -40,6 +41,7 @@ export declare class ShaclPropertyTemplate {
|
|
|
40
41
|
qualifiedValueShape: ShaclNodeTemplate | undefined;
|
|
41
42
|
nodeShapes: Set<ShaclNodeTemplate>;
|
|
42
43
|
owlImports: Set<NamedNode>;
|
|
44
|
+
queryShapePathId?: string;
|
|
43
45
|
id: Term;
|
|
44
46
|
parent: ShaclNodeTemplate;
|
|
45
47
|
config: Config;
|
package/dist/query/index.d.ts
CHANGED
package/dist/sparql.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,t=`http://www.w3.org/2001/XMLSchema#`,n=`http://www.w3.org/2000/10/swap/`,{rdf:r,xsd:i}={xsd:{decimal:`${t}decimal`,boolean:`${t}boolean`,double:`${t}double`,integer:`${t}integer`,string:`${t}string`},rdf:{type:`${e}type`,nil:`${e}nil`,first:`${e}first`,rest:`${e}rest`,langString:`${e}langString`},owl:{sameAs:`http://www.w3.org/2002/07/owl#sameAs`},r:{forSome:`${n}reify#forSome`,forAll:`${n}reify#forAll`},log:{implies:`${n}log#implies`,isImpliedBy:`${n}log#isImpliedBy`}},a,o=0,s={namedNode:m,blankNode:h,variable:_,literal:g,defaultGraph:v,quad:y,triple:y,fromTerm:b,fromQuad:x},c=class e{constructor(e){this.id=e}get value(){return this.id}equals(t){return t instanceof e?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},l=class extends c{get termType(){return`NamedNode`}},u=class e extends c{get termType(){return`Literal`}get value(){return this.id.substring(1,this.id.lastIndexOf(`"`))}get language(){let e=this.id,t=e.lastIndexOf(`"`)+1;return t<e.length&&e[t++]===`@`?e.substr(t).toLowerCase():``}get datatype(){return new l(this.datatypeString)}get datatypeString(){let e=this.id,t=e.lastIndexOf(`"`)+1,n=t<e.length?e[t]:``;return n===`^`?e.substr(t+2):n===`@`?r.langString:i.string}equals(t){return t instanceof e?this.id===t.id:!!t&&!!t.datatype&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&this.datatype.value===t.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:`NamedNode`,value:this.datatypeString}}}},d=class extends c{constructor(e){super(`_:${e}`)}get termType(){return`BlankNode`}get value(){return this.id.substr(2)}},f=class extends c{constructor(e){super(`?${e}`)}get termType(){return`Variable`}get value(){return this.id.substr(1)}};a=new class extends c{constructor(){return super(``),a||this}get termType(){return`DefaultGraph`}equals(e){return this===e||!!e&&this.termType===e.termType}};var p=class extends c{constructor(e,t,n,r){super(``),this._subject=e,this._predicate=t,this._object=n,this._graph=r||a}get termType(){return`Quad`}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}};function m(e){return new l(e)}function h(e){return new d(e||`n3-${o++}`)}function g(e,t){if(typeof t==`string`)return new u(`"${e}"@${t.toLowerCase()}`);let n=t?t.value:``;return n===``&&(typeof e==`boolean`?n=i.boolean:typeof e==`number`&&(Number.isFinite(e)?n=Number.isInteger(e)?i.integer:i.double:(n=i.double,Number.isNaN(e)||(e=e>0?`INF`:`-INF`)))),n===``||n===i.string?new u(`"${e}"`):new u(`"${e}"^^${n}`)}function _(e){return new f(e)}function v(){return a}function y(e,t,n,r){return new p(e,t,n,r)}function b(e){if(e instanceof c)return e;switch(e.termType){case`NamedNode`:return m(e.value);case`BlankNode`:return h(e.value);case`Variable`:return _(e.value);case`DefaultGraph`:return a;case`Literal`:return g(e.value,e.language||e.datatype);case`Quad`:return x(e);default:throw Error(`Unexpected termType: ${e.termType}`)}}function x(e){if(e instanceof p)return e;if(e.termType!==`Quad`)throw Error(`Unexpected termType: ${e.termType}`);return y(b(e.subject),b(e.predicate),b(e.object),b(e.graph))}s.namedNode(`loaded-shapes`),s.namedNode(`loaded-data`);var S=s.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`);s.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`);var C=s.namedNode(`http://purl.org/dc/terms/conformsTo`);s.namedNode(`http://www.w3.org/2000/01/rdf-schema#subClassOf`),s.namedNode(`http://www.w3.org/2002/07/owl#imports`),s.namedNode(`http://www.w3.org/2004/02/skos/core#broader`),s.namedNode(`http://www.w3.org/2004/02/skos/core#narrower`),s.namedNode(`http://www.w3.org/ns/shacl#NodeShape`),s.namedNode(`http://www.w3.org/ns/shacl#IRI`),s.namedNode(`http://www.w3.org/ns/shacl#property`),s.namedNode(`http://www.w3.org/ns/shacl#class`),s.namedNode(`http://www.w3.org/ns/shacl#node`),s.namedNode(`http://www.w3.org/ns/shacl#message`),s.namedNode(`http://www.w3.org/ns/shacl#targetClass`),s.namedNode(`http://www.w3.org/ns/shacl#nodeKind`),s.namedNode(`http://www.w3.org/2001/XMLSchema#string`),s.namedNode(`http://www.w3.org/2001/XMLSchema#boolean`);var w=new Set([`http://www.w3.org/2001/XMLSchema#integer`,`http://www.w3.org/2001/XMLSchema#int`,`http://www.w3.org/2001/XMLSchema#short`,`http://www.w3.org/2001/XMLSchema#byte`,`http://www.w3.org/2001/XMLSchema#unsignedInt`,`http://www.w3.org/2001/XMLSchema#unsignedShort`,`http://www.w3.org/2001/XMLSchema#unsignedByte`,`http://www.w3.org/2001/XMLSchema#long`,`http://www.w3.org/2001/XMLSchema#unsignedLong`,`http://www.w3.org/2001/XMLSchema#float`,`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`,`http://www.w3.org/2001/XMLSchema#date`,`http://www.w3.org/2001/XMLSchema#dateTime`]);function T(e){return e.datatype!==void 0&&w.has(e.datatype)}var E=`?root`,D=class{constructor(e={}){this.options=e}buildWhere(e){let t=[this.rootPattern(e),...this.criterionPatterns(e)].filter(Boolean).join(`
|
|
1
|
+
var e=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,t=`http://www.w3.org/2001/XMLSchema#`,n=`http://www.w3.org/2000/10/swap/`,{rdf:r,xsd:i}={xsd:{decimal:`${t}decimal`,boolean:`${t}boolean`,double:`${t}double`,integer:`${t}integer`,string:`${t}string`},rdf:{type:`${e}type`,nil:`${e}nil`,first:`${e}first`,rest:`${e}rest`,langString:`${e}langString`},owl:{sameAs:`http://www.w3.org/2002/07/owl#sameAs`},r:{forSome:`${n}reify#forSome`,forAll:`${n}reify#forAll`},log:{implies:`${n}log#implies`,isImpliedBy:`${n}log#isImpliedBy`}},a,o=0,s={namedNode:m,blankNode:h,variable:_,literal:g,defaultGraph:v,quad:y,triple:y,fromTerm:b,fromQuad:x},c=class e{constructor(e){this.id=e}get value(){return this.id}equals(t){return t instanceof e?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},l=class extends c{get termType(){return`NamedNode`}},u=class e extends c{get termType(){return`Literal`}get value(){return this.id.substring(1,this.id.lastIndexOf(`"`))}get language(){let e=this.id,t=e.lastIndexOf(`"`)+1;return t<e.length&&e[t++]===`@`?e.substr(t).toLowerCase():``}get datatype(){return new l(this.datatypeString)}get datatypeString(){let e=this.id,t=e.lastIndexOf(`"`)+1,n=t<e.length?e[t]:``;return n===`^`?e.substr(t+2):n===`@`?r.langString:i.string}equals(t){return t instanceof e?this.id===t.id:!!t&&!!t.datatype&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&this.datatype.value===t.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:`NamedNode`,value:this.datatypeString}}}},d=class extends c{constructor(e){super(`_:${e}`)}get termType(){return`BlankNode`}get value(){return this.id.substr(2)}},f=class extends c{constructor(e){super(`?${e}`)}get termType(){return`Variable`}get value(){return this.id.substr(1)}};a=new class extends c{constructor(){return super(``),a||this}get termType(){return`DefaultGraph`}equals(e){return this===e||!!e&&this.termType===e.termType}};var p=class extends c{constructor(e,t,n,r){super(``),this._subject=e,this._predicate=t,this._object=n,this._graph=r||a}get termType(){return`Quad`}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}};function m(e){return new l(e)}function h(e){return new d(e||`n3-${o++}`)}function g(e,t){if(typeof t==`string`)return new u(`"${e}"@${t.toLowerCase()}`);let n=t?t.value:``;return n===``&&(typeof e==`boolean`?n=i.boolean:typeof e==`number`&&(Number.isFinite(e)?n=Number.isInteger(e)?i.integer:i.double:(n=i.double,Number.isNaN(e)||(e=e>0?`INF`:`-INF`)))),n===``||n===i.string?new u(`"${e}"`):new u(`"${e}"^^${n}`)}function _(e){return new f(e)}function v(){return a}function y(e,t,n,r){return new p(e,t,n,r)}function b(e){if(e instanceof c)return e;switch(e.termType){case`NamedNode`:return m(e.value);case`BlankNode`:return h(e.value);case`Variable`:return _(e.value);case`DefaultGraph`:return a;case`Literal`:return g(e.value,e.language||e.datatype);case`Quad`:return x(e);default:throw Error(`Unexpected termType: ${e.termType}`)}}function x(e){if(e instanceof p)return e;if(e.termType!==`Quad`)throw Error(`Unexpected termType: ${e.termType}`);return y(b(e.subject),b(e.predicate),b(e.object),b(e.graph))}s.namedNode(`loaded-shapes`),s.namedNode(`loaded-data`);var S=s.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`);s.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`);var C=s.namedNode(`http://purl.org/dc/terms/conformsTo`);s.namedNode(`http://www.w3.org/2000/01/rdf-schema#subClassOf`),s.namedNode(`http://www.w3.org/2002/07/owl#imports`),s.namedNode(`http://www.w3.org/2004/02/skos/core#broader`),s.namedNode(`http://www.w3.org/2004/02/skos/core#narrower`),s.namedNode(`http://www.w3.org/ns/shacl#NodeShape`),s.namedNode(`http://www.w3.org/ns/shacl#IRI`),s.namedNode(`http://www.w3.org/ns/shacl#property`),s.namedNode(`http://www.w3.org/ns/shacl#class`),s.namedNode(`http://www.w3.org/ns/shacl#node`),s.namedNode(`http://www.w3.org/ns/shacl#message`),s.namedNode(`http://www.w3.org/ns/shacl#targetClass`),s.namedNode(`http://www.w3.org/ns/shacl#nodeKind`),s.namedNode(`http://www.w3.org/2001/XMLSchema#string`),s.namedNode(`http://www.w3.org/2001/XMLSchema#boolean`);var w=new Set([`http://www.w3.org/2001/XMLSchema#integer`,`http://www.w3.org/2001/XMLSchema#int`,`http://www.w3.org/2001/XMLSchema#short`,`http://www.w3.org/2001/XMLSchema#byte`,`http://www.w3.org/2001/XMLSchema#unsignedInt`,`http://www.w3.org/2001/XMLSchema#unsignedShort`,`http://www.w3.org/2001/XMLSchema#unsignedByte`,`http://www.w3.org/2001/XMLSchema#long`,`http://www.w3.org/2001/XMLSchema#unsignedLong`,`http://www.w3.org/2001/XMLSchema#float`,`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`,`http://www.w3.org/2001/XMLSchema#date`,`http://www.w3.org/2001/XMLSchema#dateTime`]);function T(e){return e.discrete!==!0&&e.datatype!==void 0&&w.has(e.datatype)}var E=`?root`,D=class{constructor(e={}){this.options=e}buildWhere(e){let t=[this.rootPattern(e),...this.criterionPatterns(e)].filter(Boolean).join(`
|
|
2
2
|
`);return this.wrapDataset(t)}buildSelect(e,t={}){let n=t.projection?.length?t.projection.join(` `):E,r=`SELECT ${t.distinct===!1?``:`DISTINCT `}${n} WHERE {\n${L(this.buildWhere(e))}\n}`;return t.orderBy&&(r+=`\nORDER BY ${t.orderBy}`),t.limit!==void 0&&(r+=`\nLIMIT ${z(t.limit,`limit`)}`),t.offset!==void 0&&(r+=`\nOFFSET ${z(t.offset,`offset`)}`),r}buildFacetSelect(e,t,n=100){let r=`?facetValue`,i=[this.rootPattern(e.query),...this.criterionPatterns(e.query),this.pathPattern(t.path,r,`facet_${R(t.id)}`)].filter(Boolean).join(`
|
|
3
3
|
`),a=this.wrapDataset(i);return T(t)?`SELECT (COUNT(DISTINCT ${E}) AS ?count) (MIN(${r}) AS ?min) (MAX(${r}) AS ?max) WHERE {\n${L(a)}\n}`:`SELECT ${r} ?count ?total WHERE {\n { SELECT ${r} (COUNT(DISTINCT ${E}) AS ?count) WHERE {\n${L(L(a))}\n } GROUP BY ${r} }\n { SELECT (COUNT(DISTINCT ${E}) AS ?total) WHERE {\n${L(L(a))}\n } }\n}\nORDER BY DESC(?count)\nLIMIT ${z(n,`bucketLimit`)}`}buildFacetsSelect(e,t=100){return`SELECT ?fieldId ?facetValue ?count ?total ?min ?max WHERE {\n${e.fields.map(n=>{let r=`?facetValue`,i=[this.rootPattern(e.query),...this.criterionPatterns(e.query),this.pathPattern(n.path,r,`facet_${R(n.id)}`)].filter(Boolean).join(`
|
|
4
4
|
`),a=this.wrapDataset(i),o=`BIND(${P(n.id)} AS ?fieldId)`;return T(n)?`{\n ${o}\n { SELECT (COUNT(DISTINCT ${E}) AS ?count) (MIN(${r}) AS ?min) (MAX(${r}) AS ?max) WHERE {\n${L(L(a))}\n } }\n}`:`{\n ${o}\n { SELECT ${r} (COUNT(DISTINCT ${E}) AS ?count) WHERE {\n${L(L(a))}\n } GROUP BY ${r} ORDER BY DESC(?count) LIMIT ${z(t,`bucketLimit`)} }\n { SELECT (COUNT(DISTINCT ${E}) AS ?total) WHERE {\n${L(L(a))}\n } }\n}`}).map(L).join(`
|