@ulb-darmstadt/shacl-form 3.0.3 → 3.0.5
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/README.md +2 -2
- package/dist/bundle.js +78 -87
- package/dist/index.js +13 -14
- package/dist/loader.d.ts +2 -0
- package/dist/plugins/assets/property-template-c2vtkOt_.js +1 -0
- package/dist/plugins/file-upload.js +1 -1
- package/dist/plugins/leaflet.js +5 -5
- package/dist/util.d.ts +1 -0
- package/package.json +11 -14
- package/dist/plugins/assets/property-template-BtuDp76T.js +0 -1
package/dist/bundle.js
CHANGED
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
var qi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rf(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Do={},fr={},Yu;function Sg(){if(Yu)return fr;Yu=1,fr.byteLength=u,fr.toByteArray=h,fr.fromByteArray=d;for(var i=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=r.length;o<a;++o)i[o]=r[o],e[r.charCodeAt(o)]=o;e[45]=62,e[95]=63;function l(_){var b=_.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=_.indexOf("=");I===-1&&(I=b);var A=I===b?0:4-I%4;return[I,A]}function u(_){var b=l(_),I=b[0],A=b[1];return(I+A)*3/4-A}function f(_,b,I){return(b+I)*3/4-I}function h(_){var b,I=l(_),A=I[0],N=I[1],P=new n(f(_,A,N)),w=0,y=N>0?A-4:A,S;for(S=0;S<y;S+=4)b=e[_.charCodeAt(S)]<<18|e[_.charCodeAt(S+1)]<<12|e[_.charCodeAt(S+2)]<<6|e[_.charCodeAt(S+3)],P[w++]=b>>16&255,P[w++]=b>>8&255,P[w++]=b&255;return N===2&&(b=e[_.charCodeAt(S)]<<2|e[_.charCodeAt(S+1)]>>4,P[w++]=b&255),N===1&&(b=e[_.charCodeAt(S)]<<10|e[_.charCodeAt(S+1)]<<4|e[_.charCodeAt(S+2)]>>2,P[w++]=b>>8&255,P[w++]=b&255),P}function g(_){return i[_>>18&63]+i[_>>12&63]+i[_>>6&63]+i[_&63]}function m(_,b,I){for(var A,N=[],P=b;P<I;P+=3)A=(_[P]<<16&16711680)+(_[P+1]<<8&65280)+(_[P+2]&255),N.push(g(A));return N.join("")}function d(_){for(var b,I=_.length,A=I%3,N=[],P=16383,w=0,y=I-A;w<y;w+=P)N.push(m(_,w,w+P>y?y:w+P));return A===1?(b=_[I-1],N.push(i[b>>2]+i[b<<4&63]+"==")):A===2&&(b=(_[I-2]<<8)+_[I-1],N.push(i[b>>10]+i[b>>4&63]+i[b<<2&63]+"=")),N.join("")}return fr}var ms={};var ec;function Tg(){return ec||(ec=1,ms.read=function(i,e,n,r,o){var a,l,u=o*8-r-1,f=(1<<u)-1,h=f>>1,g=-7,m=n?o-1:0,d=n?-1:1,_=i[e+m];for(m+=d,a=_&(1<<-g)-1,_>>=-g,g+=u;g>0;a=a*256+i[e+m],m+=d,g-=8);for(l=a&(1<<-g)-1,a>>=-g,g+=r;g>0;l=l*256+i[e+m],m+=d,g-=8);if(a===0)a=1-h;else{if(a===f)return l?NaN:(_?-1:1)*(1/0);l=l+Math.pow(2,r),a=a-h}return(_?-1:1)*l*Math.pow(2,a-r)},ms.write=function(i,e,n,r,o,a){var l,u,f,h=a*8-o-1,g=(1<<h)-1,m=g>>1,d=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=r?0:a-1,b=r?1:-1,I=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,l=g):(l=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-l))<1&&(l--,f*=2),l+m>=1?e+=d/f:e+=d*Math.pow(2,1-m),e*f>=2&&(l++,f/=2),l+m>=g?(u=0,l=g):l+m>=1?(u=(e*f-1)*Math.pow(2,o),l=l+m):(u=e*Math.pow(2,m-1)*Math.pow(2,o),l=0));o>=8;i[n+_]=u&255,_+=b,u/=256,o-=8);for(l=l<<o|u,h+=o;h>0;i[n+_]=l&255,_+=b,l/=256,h-=8);i[n+_-b]|=I*128}),ms}var tc;function Dn(){return tc||(tc=1,(function(i){const e=Sg(),n=Tg(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=u,i.SlowBuffer=P,i.INSPECT_MAX_BYTES=50;const o=2147483647;i.kMaxLength=o,u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{const k=new Uint8Array(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,Uint8Array.prototype),Object.setPrototypeOf(k,v),k.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function l(k){if(k>o)throw new RangeError('The value "'+k+'" is invalid for option "size"');const v=new Uint8Array(k);return Object.setPrototypeOf(v,u.prototype),v}function u(k,v,x){if(typeof k=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return f(k,v,x)}u.poolSize=8192;function f(k,v,x){if(typeof k=="string")return d(k,v);if(ArrayBuffer.isView(k))return b(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(ve(k,ArrayBuffer)||k&&ve(k.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ve(k,SharedArrayBuffer)||k&&ve(k.buffer,SharedArrayBuffer)))return I(k,v,x);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const H=k.valueOf&&k.valueOf();if(H!=null&&H!==k)return u.from(H,v,x);const ae=A(k);if(ae)return ae;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return u.from(k[Symbol.toPrimitive]("string"),v,x);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}u.from=function(k,v,x){return f(k,v,x)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function h(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function g(k,v,x){return h(k),k<=0?l(k):v!==void 0?typeof x=="string"?l(k).fill(v,x):l(k).fill(v):l(k)}u.alloc=function(k,v,x){return g(k,v,x)};function m(k){return h(k),l(k<0?0:N(k)|0)}u.allocUnsafe=function(k){return m(k)},u.allocUnsafeSlow=function(k){return m(k)};function d(k,v){if((typeof v!="string"||v==="")&&(v="utf8"),!u.isEncoding(v))throw new TypeError("Unknown encoding: "+v);const x=w(k,v)|0;let H=l(x);const ae=H.write(k,v);return ae!==x&&(H=H.slice(0,ae)),H}function _(k){const v=k.length<0?0:N(k.length)|0,x=l(v);for(let H=0;H<v;H+=1)x[H]=k[H]&255;return x}function b(k){if(ve(k,Uint8Array)){const v=new Uint8Array(k);return I(v.buffer,v.byteOffset,v.byteLength)}return _(k)}function I(k,v,x){if(v<0||k.byteLength<v)throw new RangeError('"offset" is outside of buffer bounds');if(k.byteLength<v+(x||0))throw new RangeError('"length" is outside of buffer bounds');let H;return v===void 0&&x===void 0?H=new Uint8Array(k):x===void 0?H=new Uint8Array(k,v):H=new Uint8Array(k,v,x),Object.setPrototypeOf(H,u.prototype),H}function A(k){if(u.isBuffer(k)){const v=N(k.length)|0,x=l(v);return x.length===0||k.copy(x,0,0,v),x}if(k.length!==void 0)return typeof k.length!="number"||qe(k.length)?l(0):_(k);if(k.type==="Buffer"&&Array.isArray(k.data))return _(k.data)}function N(k){if(k>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return k|0}function P(k){return+k!=k&&(k=0),u.alloc(+k)}u.isBuffer=function(v){return v!=null&&v._isBuffer===!0&&v!==u.prototype},u.compare=function(v,x){if(ve(v,Uint8Array)&&(v=u.from(v,v.offset,v.byteLength)),ve(x,Uint8Array)&&(x=u.from(x,x.offset,x.byteLength)),!u.isBuffer(v)||!u.isBuffer(x))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(v===x)return 0;let H=v.length,ae=x.length;for(let _e=0,we=Math.min(H,ae);_e<we;++_e)if(v[_e]!==x[_e]){H=v[_e],ae=x[_e];break}return H<ae?-1:ae<H?1:0},u.isEncoding=function(v){switch(String(v).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(v,x){if(!Array.isArray(v))throw new TypeError('"list" argument must be an Array of Buffers');if(v.length===0)return u.alloc(0);let H;if(x===void 0)for(x=0,H=0;H<v.length;++H)x+=v[H].length;const ae=u.allocUnsafe(x);let _e=0;for(H=0;H<v.length;++H){let we=v[H];if(ve(we,Uint8Array))_e+we.length>ae.length?(u.isBuffer(we)||(we=u.from(we)),we.copy(ae,_e)):Uint8Array.prototype.set.call(ae,we,_e);else if(u.isBuffer(we))we.copy(ae,_e);else throw new TypeError('"list" argument must be an Array of Buffers');_e+=we.length}return ae};function w(k,v){if(u.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||ve(k,ArrayBuffer))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const x=k.length,H=arguments.length>2&&arguments[2]===!0;if(!H&&x===0)return 0;let ae=!1;for(;;)switch(v){case"ascii":case"latin1":case"binary":return x;case"utf8":case"utf-8":return Se(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x*2;case"hex":return x>>>1;case"base64":return be(k).length;default:if(ae)return H?-1:Se(k).length;v=(""+v).toLowerCase(),ae=!0}}u.byteLength=w;function y(k,v,x){let H=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((x===void 0||x>this.length)&&(x=this.length),x<=0)||(x>>>=0,v>>>=0,x<=v))return"";for(k||(k="utf8");;)switch(k){case"hex":return oe(this,v,x);case"utf8":case"utf-8":return F(this,v,x);case"ascii":return re(this,v,x);case"latin1":case"binary":return B(this,v,x);case"base64":return j(this,v,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,v,x);default:if(H)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),H=!0}}u.prototype._isBuffer=!0;function S(k,v,x){const H=k[v];k[v]=k[x],k[x]=H}u.prototype.swap16=function(){const v=this.length;if(v%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let x=0;x<v;x+=2)S(this,x,x+1);return this},u.prototype.swap32=function(){const v=this.length;if(v%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let x=0;x<v;x+=4)S(this,x,x+3),S(this,x+1,x+2);return this},u.prototype.swap64=function(){const v=this.length;if(v%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let x=0;x<v;x+=8)S(this,x,x+7),S(this,x+1,x+6),S(this,x+2,x+5),S(this,x+3,x+4);return this},u.prototype.toString=function(){const v=this.length;return v===0?"":arguments.length===0?F(this,0,v):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(v){if(!u.isBuffer(v))throw new TypeError("Argument must be a Buffer");return this===v?!0:u.compare(this,v)===0},u.prototype.inspect=function(){let v="";const x=i.INSPECT_MAX_BYTES;return v=this.toString("hex",0,x).replace(/(.{2})/g,"$1 ").trim(),this.length>x&&(v+=" ... "),"<Buffer "+v+">"},r&&(u.prototype[r]=u.prototype.inspect),u.prototype.compare=function(v,x,H,ae,_e){if(ve(v,Uint8Array)&&(v=u.from(v,v.offset,v.byteLength)),!u.isBuffer(v))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof v);if(x===void 0&&(x=0),H===void 0&&(H=v?v.length:0),ae===void 0&&(ae=0),_e===void 0&&(_e=this.length),x<0||H>v.length||ae<0||_e>this.length)throw new RangeError("out of range index");if(ae>=_e&&x>=H)return 0;if(ae>=_e)return-1;if(x>=H)return 1;if(x>>>=0,H>>>=0,ae>>>=0,_e>>>=0,this===v)return 0;let we=_e-ae,Oe=H-x;const Ye=Math.min(we,Oe),Qe=this.slice(ae,_e),Ge=v.slice(x,H);for(let Ze=0;Ze<Ye;++Ze)if(Qe[Ze]!==Ge[Ze]){we=Qe[Ze],Oe=Ge[Ze];break}return we<Oe?-1:Oe<we?1:0};function O(k,v,x,H,ae){if(k.length===0)return-1;if(typeof x=="string"?(H=x,x=0):x>2147483647?x=2147483647:x<-2147483648&&(x=-2147483648),x=+x,qe(x)&&(x=ae?0:k.length-1),x<0&&(x=k.length+x),x>=k.length){if(ae)return-1;x=k.length-1}else if(x<0)if(ae)x=0;else return-1;if(typeof v=="string"&&(v=u.from(v,H)),u.isBuffer(v))return v.length===0?-1:X(k,v,x,H,ae);if(typeof v=="number")return v=v&255,typeof Uint8Array.prototype.indexOf=="function"?ae?Uint8Array.prototype.indexOf.call(k,v,x):Uint8Array.prototype.lastIndexOf.call(k,v,x):X(k,[v],x,H,ae);throw new TypeError("val must be string, number or Buffer")}function X(k,v,x,H,ae){let _e=1,we=k.length,Oe=v.length;if(H!==void 0&&(H=String(H).toLowerCase(),H==="ucs2"||H==="ucs-2"||H==="utf16le"||H==="utf-16le")){if(k.length<2||v.length<2)return-1;_e=2,we/=2,Oe/=2,x/=2}function Ye(Ge,Ze){return _e===1?Ge[Ze]:Ge.readUInt16BE(Ze*_e)}let Qe;if(ae){let Ge=-1;for(Qe=x;Qe<we;Qe++)if(Ye(k,Qe)===Ye(v,Ge===-1?0:Qe-Ge)){if(Ge===-1&&(Ge=Qe),Qe-Ge+1===Oe)return Ge*_e}else Ge!==-1&&(Qe-=Qe-Ge),Ge=-1}else for(x+Oe>we&&(x=we-Oe),Qe=x;Qe>=0;Qe--){let Ge=!0;for(let Ze=0;Ze<Oe;Ze++)if(Ye(k,Qe+Ze)!==Ye(v,Ze)){Ge=!1;break}if(Ge)return Qe}return-1}u.prototype.includes=function(v,x,H){return this.indexOf(v,x,H)!==-1},u.prototype.indexOf=function(v,x,H){return O(this,v,x,H,!0)},u.prototype.lastIndexOf=function(v,x,H){return O(this,v,x,H,!1)};function C(k,v,x,H){x=Number(x)||0;const ae=k.length-x;H?(H=Number(H),H>ae&&(H=ae)):H=ae;const _e=v.length;H>_e/2&&(H=_e/2);let we;for(we=0;we<H;++we){const Oe=parseInt(v.substr(we*2,2),16);if(qe(Oe))return we;k[x+we]=Oe}return we}function U(k,v,x,H){return Ae(Se(v,k.length-x),k,x,H)}function R(k,v,x,H){return Ae(Ie(v),k,x,H)}function $(k,v,x,H){return Ae(be(v),k,x,H)}function G(k,v,x,H){return Ae(le(v,k.length-x),k,x,H)}u.prototype.write=function(v,x,H,ae){if(x===void 0)ae="utf8",H=this.length,x=0;else if(H===void 0&&typeof x=="string")ae=x,H=this.length,x=0;else if(isFinite(x))x=x>>>0,isFinite(H)?(H=H>>>0,ae===void 0&&(ae="utf8")):(ae=H,H=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const _e=this.length-x;if((H===void 0||H>_e)&&(H=_e),v.length>0&&(H<0||x<0)||x>this.length)throw new RangeError("Attempt to write outside buffer bounds");ae||(ae="utf8");let we=!1;for(;;)switch(ae){case"hex":return C(this,v,x,H);case"utf8":case"utf-8":return U(this,v,x,H);case"ascii":case"latin1":case"binary":return R(this,v,x,H);case"base64":return $(this,v,x,H);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,v,x,H);default:if(we)throw new TypeError("Unknown encoding: "+ae);ae=(""+ae).toLowerCase(),we=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function j(k,v,x){return v===0&&x===k.length?e.fromByteArray(k):e.fromByteArray(k.slice(v,x))}function F(k,v,x){x=Math.min(k.length,x);const H=[];let ae=v;for(;ae<x;){const _e=k[ae];let we=null,Oe=_e>239?4:_e>223?3:_e>191?2:1;if(ae+Oe<=x){let Ye,Qe,Ge,Ze;switch(Oe){case 1:_e<128&&(we=_e);break;case 2:Ye=k[ae+1],(Ye&192)===128&&(Ze=(_e&31)<<6|Ye&63,Ze>127&&(we=Ze));break;case 3:Ye=k[ae+1],Qe=k[ae+2],(Ye&192)===128&&(Qe&192)===128&&(Ze=(_e&15)<<12|(Ye&63)<<6|Qe&63,Ze>2047&&(Ze<55296||Ze>57343)&&(we=Ze));break;case 4:Ye=k[ae+1],Qe=k[ae+2],Ge=k[ae+3],(Ye&192)===128&&(Qe&192)===128&&(Ge&192)===128&&(Ze=(_e&15)<<18|(Ye&63)<<12|(Qe&63)<<6|Ge&63,Ze>65535&&Ze<1114112&&(we=Ze))}}we===null?(we=65533,Oe=1):we>65535&&(we-=65536,H.push(we>>>10&1023|55296),we=56320|we&1023),H.push(we),ae+=Oe}return M(H)}const se=4096;function M(k){const v=k.length;if(v<=se)return String.fromCharCode.apply(String,k);let x="",H=0;for(;H<v;)x+=String.fromCharCode.apply(String,k.slice(H,H+=se));return x}function re(k,v,x){let H="";x=Math.min(k.length,x);for(let ae=v;ae<x;++ae)H+=String.fromCharCode(k[ae]&127);return H}function B(k,v,x){let H="";x=Math.min(k.length,x);for(let ae=v;ae<x;++ae)H+=String.fromCharCode(k[ae]);return H}function oe(k,v,x){const H=k.length;(!v||v<0)&&(v=0),(!x||x<0||x>H)&&(x=H);let ae="";for(let _e=v;_e<x;++_e)ae+=mt[k[_e]];return ae}function T(k,v,x){const H=k.slice(v,x);let ae="";for(let _e=0;_e<H.length-1;_e+=2)ae+=String.fromCharCode(H[_e]+H[_e+1]*256);return ae}u.prototype.slice=function(v,x){const H=this.length;v=~~v,x=x===void 0?H:~~x,v<0?(v+=H,v<0&&(v=0)):v>H&&(v=H),x<0?(x+=H,x<0&&(x=0)):x>H&&(x=H),x<v&&(x=v);const ae=this.subarray(v,x);return Object.setPrototypeOf(ae,u.prototype),ae};function Q(k,v,x){if(k%1!==0||k<0)throw new RangeError("offset is not uint");if(k+v>x)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(v,x,H){v=v>>>0,x=x>>>0,H||Q(v,x,this.length);let ae=this[v],_e=1,we=0;for(;++we<x&&(_e*=256);)ae+=this[v+we]*_e;return ae},u.prototype.readUintBE=u.prototype.readUIntBE=function(v,x,H){v=v>>>0,x=x>>>0,H||Q(v,x,this.length);let ae=this[v+--x],_e=1;for(;x>0&&(_e*=256);)ae+=this[v+--x]*_e;return ae},u.prototype.readUint8=u.prototype.readUInt8=function(v,x){return v=v>>>0,x||Q(v,1,this.length),this[v]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(v,x){return v=v>>>0,x||Q(v,2,this.length),this[v]|this[v+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(v,x){return v=v>>>0,x||Q(v,2,this.length),this[v]<<8|this[v+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(v,x){return v=v>>>0,x||Q(v,4,this.length),(this[v]|this[v+1]<<8|this[v+2]<<16)+this[v+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(v,x){return v=v>>>0,x||Q(v,4,this.length),this[v]*16777216+(this[v+1]<<16|this[v+2]<<8|this[v+3])},u.prototype.readBigUInt64LE=$e(function(v){v=v>>>0,q(v,"offset");const x=this[v],H=this[v+7];(x===void 0||H===void 0)&&te(v,this.length-8);const ae=x+this[++v]*2**8+this[++v]*2**16+this[++v]*2**24,_e=this[++v]+this[++v]*2**8+this[++v]*2**16+H*2**24;return BigInt(ae)+(BigInt(_e)<<BigInt(32))}),u.prototype.readBigUInt64BE=$e(function(v){v=v>>>0,q(v,"offset");const x=this[v],H=this[v+7];(x===void 0||H===void 0)&&te(v,this.length-8);const ae=x*2**24+this[++v]*2**16+this[++v]*2**8+this[++v],_e=this[++v]*2**24+this[++v]*2**16+this[++v]*2**8+H;return(BigInt(ae)<<BigInt(32))+BigInt(_e)}),u.prototype.readIntLE=function(v,x,H){v=v>>>0,x=x>>>0,H||Q(v,x,this.length);let ae=this[v],_e=1,we=0;for(;++we<x&&(_e*=256);)ae+=this[v+we]*_e;return _e*=128,ae>=_e&&(ae-=Math.pow(2,8*x)),ae},u.prototype.readIntBE=function(v,x,H){v=v>>>0,x=x>>>0,H||Q(v,x,this.length);let ae=x,_e=1,we=this[v+--ae];for(;ae>0&&(_e*=256);)we+=this[v+--ae]*_e;return _e*=128,we>=_e&&(we-=Math.pow(2,8*x)),we},u.prototype.readInt8=function(v,x){return v=v>>>0,x||Q(v,1,this.length),this[v]&128?(255-this[v]+1)*-1:this[v]},u.prototype.readInt16LE=function(v,x){v=v>>>0,x||Q(v,2,this.length);const H=this[v]|this[v+1]<<8;return H&32768?H|4294901760:H},u.prototype.readInt16BE=function(v,x){v=v>>>0,x||Q(v,2,this.length);const H=this[v+1]|this[v]<<8;return H&32768?H|4294901760:H},u.prototype.readInt32LE=function(v,x){return v=v>>>0,x||Q(v,4,this.length),this[v]|this[v+1]<<8|this[v+2]<<16|this[v+3]<<24},u.prototype.readInt32BE=function(v,x){return v=v>>>0,x||Q(v,4,this.length),this[v]<<24|this[v+1]<<16|this[v+2]<<8|this[v+3]},u.prototype.readBigInt64LE=$e(function(v){v=v>>>0,q(v,"offset");const x=this[v],H=this[v+7];(x===void 0||H===void 0)&&te(v,this.length-8);const ae=this[v+4]+this[v+5]*2**8+this[v+6]*2**16+(H<<24);return(BigInt(ae)<<BigInt(32))+BigInt(x+this[++v]*2**8+this[++v]*2**16+this[++v]*2**24)}),u.prototype.readBigInt64BE=$e(function(v){v=v>>>0,q(v,"offset");const x=this[v],H=this[v+7];(x===void 0||H===void 0)&&te(v,this.length-8);const ae=(x<<24)+this[++v]*2**16+this[++v]*2**8+this[++v];return(BigInt(ae)<<BigInt(32))+BigInt(this[++v]*2**24+this[++v]*2**16+this[++v]*2**8+H)}),u.prototype.readFloatLE=function(v,x){return v=v>>>0,x||Q(v,4,this.length),n.read(this,v,!0,23,4)},u.prototype.readFloatBE=function(v,x){return v=v>>>0,x||Q(v,4,this.length),n.read(this,v,!1,23,4)},u.prototype.readDoubleLE=function(v,x){return v=v>>>0,x||Q(v,8,this.length),n.read(this,v,!0,52,8)},u.prototype.readDoubleBE=function(v,x){return v=v>>>0,x||Q(v,8,this.length),n.read(this,v,!1,52,8)};function ie(k,v,x,H,ae,_e){if(!u.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>ae||v<_e)throw new RangeError('"value" argument is out of bounds');if(x+H>k.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(v,x,H,ae){if(v=+v,x=x>>>0,H=H>>>0,!ae){const Oe=Math.pow(2,8*H)-1;ie(this,v,x,H,Oe,0)}let _e=1,we=0;for(this[x]=v&255;++we<H&&(_e*=256);)this[x+we]=v/_e&255;return x+H},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(v,x,H,ae){if(v=+v,x=x>>>0,H=H>>>0,!ae){const Oe=Math.pow(2,8*H)-1;ie(this,v,x,H,Oe,0)}let _e=H-1,we=1;for(this[x+_e]=v&255;--_e>=0&&(we*=256);)this[x+_e]=v/we&255;return x+H},u.prototype.writeUint8=u.prototype.writeUInt8=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,1,255,0),this[x]=v&255,x+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,2,65535,0),this[x]=v&255,this[x+1]=v>>>8,x+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,2,65535,0),this[x]=v>>>8,this[x+1]=v&255,x+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,4,4294967295,0),this[x+3]=v>>>24,this[x+2]=v>>>16,this[x+1]=v>>>8,this[x]=v&255,x+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,4,4294967295,0),this[x]=v>>>24,this[x+1]=v>>>16,this[x+2]=v>>>8,this[x+3]=v&255,x+4};function Y(k,v,x,H,ae){Te(v,H,ae,k,x,7);let _e=Number(v&BigInt(4294967295));k[x++]=_e,_e=_e>>8,k[x++]=_e,_e=_e>>8,k[x++]=_e,_e=_e>>8,k[x++]=_e;let we=Number(v>>BigInt(32)&BigInt(4294967295));return k[x++]=we,we=we>>8,k[x++]=we,we=we>>8,k[x++]=we,we=we>>8,k[x++]=we,x}function me(k,v,x,H,ae){Te(v,H,ae,k,x,7);let _e=Number(v&BigInt(4294967295));k[x+7]=_e,_e=_e>>8,k[x+6]=_e,_e=_e>>8,k[x+5]=_e,_e=_e>>8,k[x+4]=_e;let we=Number(v>>BigInt(32)&BigInt(4294967295));return k[x+3]=we,we=we>>8,k[x+2]=we,we=we>>8,k[x+1]=we,we=we>>8,k[x]=we,x+8}u.prototype.writeBigUInt64LE=$e(function(v,x=0){return Y(this,v,x,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=$e(function(v,x=0){return me(this,v,x,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(v,x,H,ae){if(v=+v,x=x>>>0,!ae){const Ye=Math.pow(2,8*H-1);ie(this,v,x,H,Ye-1,-Ye)}let _e=0,we=1,Oe=0;for(this[x]=v&255;++_e<H&&(we*=256);)v<0&&Oe===0&&this[x+_e-1]!==0&&(Oe=1),this[x+_e]=(v/we>>0)-Oe&255;return x+H},u.prototype.writeIntBE=function(v,x,H,ae){if(v=+v,x=x>>>0,!ae){const Ye=Math.pow(2,8*H-1);ie(this,v,x,H,Ye-1,-Ye)}let _e=H-1,we=1,Oe=0;for(this[x+_e]=v&255;--_e>=0&&(we*=256);)v<0&&Oe===0&&this[x+_e+1]!==0&&(Oe=1),this[x+_e]=(v/we>>0)-Oe&255;return x+H},u.prototype.writeInt8=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,1,127,-128),v<0&&(v=255+v+1),this[x]=v&255,x+1},u.prototype.writeInt16LE=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,2,32767,-32768),this[x]=v&255,this[x+1]=v>>>8,x+2},u.prototype.writeInt16BE=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,2,32767,-32768),this[x]=v>>>8,this[x+1]=v&255,x+2},u.prototype.writeInt32LE=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,4,2147483647,-2147483648),this[x]=v&255,this[x+1]=v>>>8,this[x+2]=v>>>16,this[x+3]=v>>>24,x+4},u.prototype.writeInt32BE=function(v,x,H){return v=+v,x=x>>>0,H||ie(this,v,x,4,2147483647,-2147483648),v<0&&(v=4294967295+v+1),this[x]=v>>>24,this[x+1]=v>>>16,this[x+2]=v>>>8,this[x+3]=v&255,x+4},u.prototype.writeBigInt64LE=$e(function(v,x=0){return Y(this,v,x,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=$e(function(v,x=0){return me(this,v,x,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Z(k,v,x,H,ae,_e){if(x+H>k.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("Index out of range")}function W(k,v,x,H,ae){return v=+v,x=x>>>0,ae||Z(k,v,x,4),n.write(k,v,x,H,23,4),x+4}u.prototype.writeFloatLE=function(v,x,H){return W(this,v,x,!0,H)},u.prototype.writeFloatBE=function(v,x,H){return W(this,v,x,!1,H)};function ee(k,v,x,H,ae){return v=+v,x=x>>>0,ae||Z(k,v,x,8),n.write(k,v,x,H,52,8),x+8}u.prototype.writeDoubleLE=function(v,x,H){return ee(this,v,x,!0,H)},u.prototype.writeDoubleBE=function(v,x,H){return ee(this,v,x,!1,H)},u.prototype.copy=function(v,x,H,ae){if(!u.isBuffer(v))throw new TypeError("argument should be a Buffer");if(H||(H=0),!ae&&ae!==0&&(ae=this.length),x>=v.length&&(x=v.length),x||(x=0),ae>0&&ae<H&&(ae=H),ae===H||v.length===0||this.length===0)return 0;if(x<0)throw new RangeError("targetStart out of bounds");if(H<0||H>=this.length)throw new RangeError("Index out of range");if(ae<0)throw new RangeError("sourceEnd out of bounds");ae>this.length&&(ae=this.length),v.length-x<ae-H&&(ae=v.length-x+H);const _e=ae-H;return this===v&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(x,H,ae):Uint8Array.prototype.set.call(v,this.subarray(H,ae),x),_e},u.prototype.fill=function(v,x,H,ae){if(typeof v=="string"){if(typeof x=="string"?(ae=x,x=0,H=this.length):typeof H=="string"&&(ae=H,H=this.length),ae!==void 0&&typeof ae!="string")throw new TypeError("encoding must be a string");if(typeof ae=="string"&&!u.isEncoding(ae))throw new TypeError("Unknown encoding: "+ae);if(v.length===1){const we=v.charCodeAt(0);(ae==="utf8"&&we<128||ae==="latin1")&&(v=we)}}else typeof v=="number"?v=v&255:typeof v=="boolean"&&(v=Number(v));if(x<0||this.length<x||this.length<H)throw new RangeError("Out of range index");if(H<=x)return this;x=x>>>0,H=H===void 0?this.length:H>>>0,v||(v=0);let _e;if(typeof v=="number")for(_e=x;_e<H;++_e)this[_e]=v;else{const we=u.isBuffer(v)?v:u.from(v,ae),Oe=we.length;if(Oe===0)throw new TypeError('The value "'+v+'" is invalid for argument "value"');for(_e=0;_e<H-x;++_e)this[_e+x]=we[_e%Oe]}return this};const K={};function ue(k,v,x){K[k]=class extends x{constructor(){super(),Object.defineProperty(this,"message",{value:v.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${k}]`,this.stack,delete this.name}get code(){return k}set code(ae){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ae,writable:!0})}toString(){return`${this.name} [${k}]: ${this.message}`}}}ue("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ue("ERR_INVALID_ARG_TYPE",function(k,v){return`The "${k}" argument must be of type number. Received type ${typeof v}`},TypeError),ue("ERR_OUT_OF_RANGE",function(k,v,x){let H=`The value of "${k}" is out of range.`,ae=x;return Number.isInteger(x)&&Math.abs(x)>2**32?ae=ce(String(x)):typeof x=="bigint"&&(ae=String(x),(x>BigInt(2)**BigInt(32)||x<-(BigInt(2)**BigInt(32)))&&(ae=ce(ae)),ae+="n"),H+=` It must be ${v}. Received ${ae}`,H},RangeError);function ce(k){let v="",x=k.length;const H=k[0]==="-"?1:0;for(;x>=H+4;x-=3)v=`_${k.slice(x-3,x)}${v}`;return`${k.slice(0,x)}${v}`}function Ee(k,v,x){q(v,"offset"),(k[v]===void 0||k[v+x]===void 0)&&te(v,k.length-(x+1))}function Te(k,v,x,H,ae,_e){if(k>x||k<v){const we=typeof v=="bigint"?"n":"";let Oe;throw v===0||v===BigInt(0)?Oe=`>= 0${we} and < 2${we} ** ${(_e+1)*8}${we}`:Oe=`>= -(2${we} ** ${(_e+1)*8-1}${we}) and < 2 ** ${(_e+1)*8-1}${we}`,new K.ERR_OUT_OF_RANGE("value",Oe,k)}Ee(H,ae,_e)}function q(k,v){if(typeof k!="number")throw new K.ERR_INVALID_ARG_TYPE(v,"number",k)}function te(k,v,x){throw Math.floor(k)!==k?(q(k,x),new K.ERR_OUT_OF_RANGE("offset","an integer",k)):v<0?new K.ERR_BUFFER_OUT_OF_BOUNDS:new K.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${v}`,k)}const fe=/[^+/0-9A-Za-z-_]/g;function xe(k){if(k=k.split("=")[0],k=k.trim().replace(fe,""),k.length<2)return"";for(;k.length%4!==0;)k=k+"=";return k}function Se(k,v){v=v||1/0;let x;const H=k.length;let ae=null;const _e=[];for(let we=0;we<H;++we){if(x=k.charCodeAt(we),x>55295&&x<57344){if(!ae){if(x>56319){(v-=3)>-1&&_e.push(239,191,189);continue}else if(we+1===H){(v-=3)>-1&&_e.push(239,191,189);continue}ae=x;continue}if(x<56320){(v-=3)>-1&&_e.push(239,191,189),ae=x;continue}x=(ae-55296<<10|x-56320)+65536}else ae&&(v-=3)>-1&&_e.push(239,191,189);if(ae=null,x<128){if((v-=1)<0)break;_e.push(x)}else if(x<2048){if((v-=2)<0)break;_e.push(x>>6|192,x&63|128)}else if(x<65536){if((v-=3)<0)break;_e.push(x>>12|224,x>>6&63|128,x&63|128)}else if(x<1114112){if((v-=4)<0)break;_e.push(x>>18|240,x>>12&63|128,x>>6&63|128,x&63|128)}else throw new Error("Invalid code point")}return _e}function Ie(k){const v=[];for(let x=0;x<k.length;++x)v.push(k.charCodeAt(x)&255);return v}function le(k,v){let x,H,ae;const _e=[];for(let we=0;we<k.length&&!((v-=2)<0);++we)x=k.charCodeAt(we),H=x>>8,ae=x%256,_e.push(ae),_e.push(H);return _e}function be(k){return e.toByteArray(xe(k))}function Ae(k,v,x,H){let ae;for(ae=0;ae<H&&!(ae+x>=v.length||ae>=k.length);++ae)v[ae+x]=k[ae];return ae}function ve(k,v){return k instanceof v||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===v.name}function qe(k){return k!==k}const mt=(function(){const k="0123456789abcdef",v=new Array(256);for(let x=0;x<16;++x){const H=x*16;for(let ae=0;ae<16;++ae)v[H+ae]=k[x]+k[ae]}return v})();function $e(k){return typeof BigInt>"u"?ft:k}function ft(){throw new Error("BigInt not supported")}})(Do)),Do}var Lg=Dn();const pr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",gr="http://www.w3.org/2001/XMLSchema#",_s="http://www.w3.org/2000/10/swap/",Lt={xsd:{decimal:`${gr}decimal`,boolean:`${gr}boolean`,double:`${gr}double`,integer:`${gr}integer`,string:`${gr}string`},rdf:{type:`${pr}type`,nil:`${pr}nil`,first:`${pr}first`,rest:`${pr}rest`,langString:`${pr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${_s}reify#forSome`,forAll:`${_s}reify#forAll`},log:{implies:`${_s}log#implies`,isImpliedBy:`${_s}log#isImpliedBy`}},{xsd:ys}=Lt,Ig=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,nc={"\\":"\\","'":"'",'"':'"',n:`
|
|
2
|
-
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Ag=/[\x00-\x20<>\\"\{\}\|\^\`]/,Ng={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Rg=/$0^/;class Cg{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const n in this)!(n in Ng)&&this[n]instanceof RegExp&&(this[n]=Rg)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,n){let r=this._input,o=r.length;for(;;){let u,f;for(;u=this._newline.exec(r);)this.comments&&(f=this._comment.exec(u[0]))&&a("comment",f[1],"",this._line,u[0].length),r=r.substr(u[0].length,r.length),o=r.length,this._line++;if(!u&&(u=this._whitespace.exec(r))&&(r=r.substr(u[0].length,r.length)),this._endOfFile.test(r))return n&&(this.comments&&(f=this._comment.exec(r))&&a("comment",f[1],"",this._line,r.length),r=null,a("eof","","",this._line,0)),this._input=r;const h=this._line,g=r[0];let m="",d="",_="",b=null,I=0,A=!1;switch(g){case"^":if(r.length<3)break;if(r[1]==="^"){if(this._previousMarker="^^",r=r.substr(2),r[0]!=="<"){A=!0;break}}else{this._n3Mode&&(I=1,m="^");break}case"<":if(b=this._unescapedIri.exec(r))m="IRI",d=b[1];else if(b=this._iri.exec(r)){if(d=this._unescape(b[1]),d===null||Ag.test(d))return l(this);m="IRI"}else r.length>1&&r[1]==="<"?(m="<<",I=2):this._n3Mode&&r.length>1&&r[1]==="="&&(I=2,this._isImpliedBy?(m="abbreviation",d="<"):(m="inverse",d=">"));break;case">":r.length>1&&r[1]===">"&&(m=">>",I=2);break;case"_":((b=this._blank.exec(r))||n&&(b=this._blank.exec(`${r} `)))&&(m="blank",_="_",d=b[1]);break;case'"':if(b=this._simpleQuotedString.exec(r))d=b[1];else if({value:d,matchLength:I}=this._parseLiteral(r),d===null)return l(this);(b!==null||I!==0)&&(m="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(b=this._simpleApostropheString.exec(r))d=b[1];else if({value:d,matchLength:I}=this._parseLiteral(r),d===null)return l(this);(b!==null||I!==0)&&(m="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(b=this._variable.exec(r))&&(m="var",d=b[0]);break;case"@":this._previousMarker==="literal"&&(b=this._langcode.exec(r))?(m="langcode",d=b[1]):(b=this._keyword.exec(r))&&(m=b[0]);break;case".":if(r.length===1?n:r[1]<"0"||r[1]>"9"){m=".",I=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(b=this._number.exec(r)||n&&(b=this._number.exec(`${r} `)))&&(m="literal",d=b[0],_=typeof b[1]=="string"?ys.double:typeof b[2]=="string"?ys.decimal:ys.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(b=this._sparqlKeyword.exec(r))?m=b[0].toUpperCase():A=!0;break;case"f":case"t":(b=this._boolean.exec(r))?(m="literal",d=b[0],_=ys.boolean):A=!0;break;case"a":(b=this._shortPredicates.exec(r))?(m="abbreviation",d="a"):A=!0;break;case"=":this._n3Mode&&r.length>1&&(m="abbreviation",r[1]!==">"?(I=1,d="="):(I=2,d=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(I=1,m=g);break;case"{":!this._lineMode&&r.length>=2&&(r[1]==="|"?(m="{|",I=2):(m=g,I=1));break;case"|":r.length>=2&&r[1]==="}"&&(m="|}",I=2);break;default:A=!0}if(A&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(b=this._prefix.exec(r))?(m="prefix",d=b[1]||""):((b=this._prefixed.exec(r))||n&&(b=this._prefixed.exec(`${r} `)))&&(m="prefixed",_=b[1]||"",d=this._unescape(b[2]))),this._previousMarker==="^^")switch(m){case"prefixed":m="type";break;case"IRI":m="typeIRI";break;default:m=""}if(!m)return n||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?l(this):this._input=r;const N=I||b[0].length,P=a(m,d,_,h,N);this.previousToken=P,this._previousMarker=m,r=r.substr(N,r.length)}function a(u,f,h,g,m){const d=r?o-r.length:o,_=d+m,b={type:u,value:f,prefix:h,line:g,start:d,end:_};return e(null,b),b}function l(u){e(u._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(e){let n=!1;const r=e.replace(Ig,(o,a,l,u)=>{if(typeof a=="string")return String.fromCharCode(Number.parseInt(a,16));if(typeof l=="string"){let f=Number.parseInt(l,16);return f<=65535?String.fromCharCode(Number.parseInt(l,16)):String.fromCharCode(55296+((f-=65536)>>10),56320+(f&1023))}return u in nc?nc[u]:(n=!0,"")});return n?null:r}_parseLiteral(e){if(e.length>=3){const n=e.match(/^(?:"""|"|'''|'|)/)[0],r=n.length;let o=Math.max(this._literalClosingPos,r);for(;(o=e.indexOf(n,o))>0;){let a=0;for(;e[o-a-1]==="\\";)a++;if(a%2===0){const l=e.substring(r,o),u=l.split(/\r\n|\r|\n/).length-1,f=o+r;if(r===1&&u!==0||r===3&&this._lineMode)break;return this._line+=u,{value:this._unescape(l),matchLength:f}}o++}this._literalClosingPos=e.length-r+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const n=new Error(`Unexpected "${e}" on line ${this._line}.`);return n.context={token:void 0,line:this._line,previousToken:this.previousToken},n}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,n){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof n=="function")queueMicrotask(()=>this._tokenizeToEnd(n,!0));else{const r=[];let o;if(this._tokenizeToEnd((a,l)=>a?o=a:r.push(l),!0),o)throw o;return r}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",r=>{this._input!==null&&r.length!==0&&(this._pendingBuffer&&(r=Lg.Buffer.concat([this._pendingBuffer,r]),this._pendingBuffer=null),r[r.length-1]&128?this._pendingBuffer=r:(typeof this._input>"u"?this._input=this._readStartingBom(typeof r=="string"?r:r.toString()):this._input+=r,this._tokenizeToEnd(n,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(n,!0)}),e.on("error",n)}}const{rdf:Pg,xsd:_i}=Lt;let Ji,kg=0;const Be={namedNode:af,blankNode:lf,variable:cf,literal:uf,defaultGraph:Fg,quad:vl,triple:vl,fromTerm:Or,fromQuad:df};class un{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof un?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let bi=class extends un{get termType(){return"NamedNode"}},ln=class sf extends un{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let n=e.lastIndexOf('"')+1;return n<e.length&&e[n++]==="@"?e.substr(n).toLowerCase():""}get datatype(){return new bi(this.datatypeString)}get datatypeString(){const e=this.id,n=e.lastIndexOf('"')+1,r=n<e.length?e[n]:"";return r==="^"?e.substr(n+2):r!=="@"?_i.string:Pg.langString}equals(e){return e instanceof sf?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},Dg=class extends un{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Mg=class extends un{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Og=class extends un{constructor(){return super(""),Ji||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Ji=new Og;function Mr(i,e,n){if(e=e||Be,!i)return e.defaultGraph();switch(i[0]){case"?":return e.variable(i.substr(1));case"_":return e.blankNode(i.substr(2));case'"':if(e===Be)return new ln(i);if(i[i.length-1]==='"')return e.literal(i.substr(1,i.length-2));const r=i.lastIndexOf('"',i.length-1);return e.literal(i.substr(1,r-1),i[r+1]==="@"?i.substr(r+2):e.namedNode(i.substr(r+3)));case"[":i=JSON.parse(i);break;default:if(!n||!Array.isArray(i))return e.namedNode(i)}return e.quad(Mr(i[0],e,!0),Mr(i[1],e,!0),Mr(i[2],e,!0),i[3]&&Mr(i[3],e,!0))}function zi(i,e){if(typeof i=="string")return i;if(i instanceof un&&i.termType!=="Quad")return i.id;if(!i)return Ji.id;switch(i.termType){case"NamedNode":return i.value;case"BlankNode":return`_:${i.value}`;case"Variable":return`?${i.value}`;case"DefaultGraph":return"";case"Literal":return`"${i.value}"${i.language?`@${i.language}`:i.datatype&&i.datatype.value!==_i.string?`^^${i.datatype.value}`:""}`;case"Quad":const n=[zi(i.subject,!0),zi(i.predicate,!0),zi(i.object,!0)];return i.graph&&i.graph.termType!=="DefaultGraph"&&n.push(zi(i.graph,!0)),e?n:JSON.stringify(n);default:throw new Error(`Unexpected termType: ${i.termType}`)}}let of=class extends un{constructor(e,n,r,o){super(""),this._subject=e,this._predicate=n,this._object=r,this._graph=o||Ji}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 af(i){return new bi(i)}function lf(i){return new Dg(i||`n3-${kg++}`)}function uf(i,e){if(typeof e=="string")return new ln(`"${i}"@${e.toLowerCase()}`);let n=e?e.value:"";return n===""&&(typeof i=="boolean"?n=_i.boolean:typeof i=="number"&&(Number.isFinite(i)?n=Number.isInteger(i)?_i.integer:_i.double:(n=_i.double,Number.isNaN(i)||(i=i>0?"INF":"-INF")))),n===""||n===_i.string?new ln(`"${i}"`):new ln(`"${i}"^^${n}`)}function cf(i){return new Mg(i)}function Fg(){return Ji}function vl(i,e,n,r){return new of(i,e,n,r)}function Or(i){if(i instanceof un)return i;switch(i.termType){case"NamedNode":return af(i.value);case"BlankNode":return lf(i.value);case"Variable":return cf(i.value);case"DefaultGraph":return Ji;case"Literal":return uf(i.value,i.language||i.datatype);case"Quad":return df(i);default:throw new Error(`Unexpected termType: ${i.termType}`)}}function df(i){if(i instanceof of)return i;if(i.termType!=="Quad")throw new Error(`Unexpected termType: ${i.termType}`);return vl(Or(i.subject),Or(i.predicate),Or(i.object),Or(i.graph))}let ic=0;class hf{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&ff(this,e.factory);const n=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(n),o=/trig/.test(n),a=/triple/.test(n),l=/quad/.test(n),u=this._n3Mode=/n3/.test(n),f=a||l;(this._supportsNamedGraphs=!(r||u))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||o||a||u),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=n===""||/star|\*$/.test(n),f&&(this._resolveRelativeIRI=h=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Cg({lineMode:f,n3:u,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){ic=0}_setBase(e){if(!e)this._base="",this._basePath="";else{const n=e.indexOf("#");n>=0&&(e=e.substr(0,n)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,n,r,o,a){const l=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:o,object:a,graph:n,inverse:l?this._inversePredicate:!1,blankPrefix:l?this._prefixes._:"",quantified:l?this._quantified:null}),l&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,n){const r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${n.type}`,n);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,n){let r;switch(e.type){case"IRI":case"typeIRI":const o=this._resolveIRI(e.value);if(o===null)return this._error("Invalid IRI",e);r=this._factory.namedNode(o);break;case"type":case"prefixed":const a=this._prefixes[e.prefix];if(a===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._factory.namedNode(a+e.value);break;case"blank":r=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!n&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const n=e.type;switch(n){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return this._predicate===null?this._error(`Unexpected ${n}`,e):(this._subject=null,n==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return e.type==="]"?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);const n=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:n?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let n=null,r=null,o=this._readListItem;const a=this._subject,l=this._contextStack,u=l[l.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this._subject=n=this._factory.blankNode()),o=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),l.length!==0&&l[l.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(o=this._readPredicate,this._subject===this.RDF_NIL)return o}else if(o=this._getContextEndReader(),this._object===this.RDF_NIL)return o;r=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,o=this._readListItemDataTypeOrLang):(n=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),o=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if((n=this._readEntity(e))===void 0)return}if(r===null&&(this._subject=r=this._factory.blankNode()),a===null?u.predicate===null?u.subject=r:u.object=r:this._emit(a,this.RDF_REST,r,this._graph),n!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,r,this.RDF_FIRST,n),this._subject=n,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,n,this._graph)}return o}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let n=this._factory.literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(r===void 0)return;n=this._factory.literal(this._literalValue,r),e=null;break;case"langcode":n=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:n}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,n){const r=this._completeLiteral(e);if(r)return this._object=r.literal,n&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),r.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let n,r=this._graph;const o=this._subject,a=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,n=this._contextStack.length?this._readSubject:this._readInTopContext,a&&(this._inversePredicate=!1);break;case";":n=this._readPredicate;break;case",":n=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",e);const l=this._predicate,u=this._object;this._subject=this._factory.quad(o,l,u,this.DEFAULTGRAPH),n=this._readPredicate;break;case"|}":if(this._subject.termType!=="Quad")return this._error("Unexpected asserted triple closing",e);this._subject=null,n=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(r=this._readEntity(e))!==void 0){n=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(o!==null){const l=this._predicate,u=this._object;a?this._emit(u,l,o,r):this._emit(o,l,u,r)}return n}_readBlankNodePunctuation(e){let n;switch(e.type){case";":n=this._readPredicate;break;case",":n=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),n}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const n=this._readEntity(e);return this._prefixes[this._prefix]=n.value,this._prefixCallback(this._prefix,n),this._readDeclarationPunctuation}_readBaseIRI(e){const n=e.type==="IRI"&&this._resolveIRI(e.value);return n?(this._setBase(n),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let n;switch(e.type){case"IRI":case"prefixed":if((n=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,n,this.QUANTIFIERS_GRAPH)):this._quantified[n.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const n=this._contextStack,r=n.length&&n[n.length-1];if(r&&r.type==="item"){const o=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,o,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let n,r;const o=this._factory.blankNode();if((r=this._readEntity(e))!==void 0)return this._predicate===null?(n=this._subject,this._subject=o):(n=this._object,this._object=o),this._emit(n,r,o,this._graph),this._readPath}_readBackwardPath(e){const n=this._factory.blankNode();let r,o;if((r=this._readEntity(e))!==void 0)return this._predicate===null?(o=this._subject,this._subject=n):(o=this._object,this._object=n),this._emit(n,r,o,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);const n=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),this._subject===null?(this._subject=n,this._readPredicate):(this._object=n,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,n,r,o){this._callback(null,this._factory.quad(e,n,r,o||this.DEFAULTGRAPH))}_error(e,n){const r=new Error(`${e} on line ${n.line}.`);r.context={token:n,line:n.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=vs}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const n=e.length;let r="",o=-1,a=-1,l=0,u="/";for(;o<n;){switch(u){case":":if(a<0&&e[++o]==="/"&&e[++o]==="/")for(;(a=o+1)<n&&e[a]!=="/";)o=a;break;case"?":case"#":o=n;break;case"/":if(e[o+1]===".")switch(u=e[++o+1],u){case"/":r+=e.substring(l,o-1),l=o+1;break;case void 0:case"?":case"#":return r+e.substring(l,o)+e.substr(o+1);case".":if(u=e[++o+1],u===void 0||u==="/"||u==="?"||u==="#"){if(r+=e.substring(l,o-2),(l=r.lastIndexOf("/"))>=a&&(r=r.substr(0,l)),u!=="/")return`${r}/${e.substr(o+1)}`;l=o+1}}}u=e[++o]}return r+e.substring(l)}parse(e,n,r){let o,a,l;if(n&&(n.onQuad||n.onPrefix||n.onComment)?(o=n.onQuad,a=n.onPrefix,l=n.onComment):(o=n,a=r),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${ic++}_`,this._prefixCallback=a||vs,this._inversePredicate=!1,this._quantified=Object.create(null),!o){const f=[];let h;if(this._callback=(g,m)=>{g?h=g:m&&f.push(m)},this._lexer.tokenize(e).every(g=>this._readCallback=this._readCallback(g)),h)throw h;return f}let u=(f,h)=>{f!==null?(this._callback(f),this._callback=vs):this._readCallback&&(this._readCallback=this._readCallback(h))};l&&(this._lexer.comments=!0,u=(f,h)=>{f!==null?(this._callback(f),this._callback=vs):this._readCallback&&(h.type==="comment"?l(h.value):this._readCallback=this._readCallback(h))}),this._callback=o,this._lexer.tokenize(e,u)}}function vs(){}function ff(i,e){i._factory=e,i.DEFAULTGRAPH=e.defaultGraph(),i.RDF_FIRST=e.namedNode(Lt.rdf.first),i.RDF_REST=e.namedNode(Lt.rdf.rest),i.RDF_NIL=e.namedNode(Lt.rdf.nil),i.N3_FORALL=e.namedNode(Lt.r.forAll),i.N3_FORSOME=e.namedNode(Lt.r.forSome),i.ABBREVIATIONS={a:e.namedNode(Lt.rdf.type),"=":e.namedNode(Lt.owl.sameAs),">":e.namedNode(Lt.log.implies),"<":e.namedNode(Lt.log.isImpliedBy)},i.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}ff(hf.prototype,Be);function bl(i){return!!i&&i.termType==="DefaultGraph"}function As(i){return i.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const jg=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Bg=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,rc="./",$g="../",Mo="?",sc="#";class Pl{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!jg.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!Pl.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],n=["^",As(e)],r=[],o=[],a=/[^/?#]*([/?#])/y;let l,u=0,f=0,h=a.lastIndex=e.length;for(;!u&&!f&&(l=a.exec(this.base));)l[1]===sc?f=a.lastIndex-1:(n.push(As(l[0]),"(?:"),r.push(")?"),l[1]!==Mo?o.push(h=a.lastIndex):(u=h=a.lastIndex,f=this.base.indexOf(sc,u),this._pathReplacements[u]=Mo));for(let g=0;g<o.length;g++)this._pathReplacements[o[g]]=$g.repeat(o.length-g-1);return this._pathReplacements[o[o.length-1]]=rc,this._baseLength=f>0?f:this.base.length,n.push(As(this.base.substring(h,this._baseLength)),u?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...n,...r].join(""))}toRelative(e){const n=this._getBaseMatcher().exec(e);if(!n)return e;const r=n[0].length;if(r===this._baseLength&&r===e.length)return"";const o=this._pathReplacements[r];if(o){const a=e.substring(r);return o!==Mo&&!Bg.test(a)?e:o===rc&&/^[^?#]/.test(a)?a:o+a}return e.substring(r-1)}}const mr=Be.defaultGraph(),{rdf:qg,xsd:Fi}=Lt,oc=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ac=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,zg={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class _r extends un{equals(e){return e===this}}class kl{constructor(e,n){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(n=e,e=null),n=n||{},this._lists=n.lists,e)this._outputStream=e,this._endStream=n.end===void 0?!0:!!n.end;else{let r="";this._outputStream={write(o,a,l){r+=o,l&&l()},end:o=>{o&&o(null,r)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(n.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=mr,this._prefixIRIs=Object.create(null),n.prefixes&&this.addPrefixes(n.prefixes),n.baseIRI&&(this._baseIri=new Pl(n.baseIRI)))}get _inDefaultGraph(){return mr.equals(this._graph)}_write(e,n){this._outputStream.write(e,"utf8",n)}_writeQuad(e,n,r,o,a){try{o.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),u=o((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),d=o((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),f=o((e=>{var t=u(),n=d(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,`parent`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,`offset`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return p(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return m(e,t);if(ArrayBuffer.isView(e))return g(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(ye(e,ArrayBuffer)||e&&ye(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(ye(e,SharedArrayBuffer)||e&&ye(e.buffer,SharedArrayBuffer)))return _(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=v(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function f(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return f(e,t,n)};function p(e){return l(e),o(e<0?0:y(e)|0)}s.allocUnsafe=function(e){return p(e)},s.allocUnsafeSlow=function(e){return p(e)};function m(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=x(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:y(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function g(e){if(ye(e,Uint8Array)){let t=new Uint8Array(e);return _(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function _(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function v(e){if(s.isBuffer(e)){let t=y(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||H(e.length)?o(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function y(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function b(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(ye(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),ye(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(ye(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function x(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ye(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return me(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return _e(e).length;default:if(i)return r?-1:me(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=x;function S(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return R(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return F(this,t,n);case`latin1`:case`binary`:return I(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return z(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function C(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)C(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)C(this,t,t+3),C(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)C(this,t,t+7),C(this,t+1,t+6),C(this,t+2,t+5),C(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):S.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(ye(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:o<a?1:0};function w(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,H(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(H(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return ve(me(t,e.length-n),e,n,r)}function O(e,t,n,r){return ve(he(t),e,n,r)}function k(e,t,n,r){return ve(_e(t),e,n,r)}function A(e,t,n,r){return ve(ge(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return P(r)}var N=4096;function P(e){let t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}function F(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function I(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function R(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=be[e[r]];return i}function z(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function B(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!1,52,8)};function V(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ee(e,t,n,r,i){le(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function te(e,t,n,r,i){le(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=xe(function(e,t=0){return ee(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=xe(function(e,t=0){return te(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=xe(function(e,t=0){return ee(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=xe(function(e,t=0){return te(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ne(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function re(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return re(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return re(this,e,t,!1,n)};function ie(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return ie(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return ie(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var ae={};function oe(e,t,n){ae[e]=class extends n{constructor(){super(),Object.defineProperty(this,`message`,{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,`code`,{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}oe(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),oe(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),oe(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=se(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=se(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function se(e){let t=``,n=e.length,r=e[0]===`-`?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ce(e,t,n){ue(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&de(t,e.length-(n+1))}function le(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new ae.ERR_OUT_OF_RANGE(`value`,i,e)}ce(r,i,a)}function ue(e,t){if(typeof e!=`number`)throw new ae.ERR_INVALID_ARG_TYPE(t,`number`,e)}function de(e,t,n){throw Math.floor(e)===e?t<0?new ae.ERR_BUFFER_OUT_OF_BOUNDS:new ae.ERR_OUT_OF_RANGE(n||`offset`,`>= ${n?1:0} and <= ${t}`,e):(ue(e,n),new ae.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var fe=/[^+/0-9A-Za-z-_]/g;function pe(e){if(e=e.split(`=`)[0],e=e.trim().replace(fe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function me(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function he(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ge(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function _e(e){return t.toByteArray(pe(e))}function ve(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ye(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function H(e){return e!==e}var be=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function xe(e){return typeof BigInt>`u`?Se:e}function Se(){throw Error(`BigInt not supported`)}})),p=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,m=`http://www.w3.org/2001/XMLSchema#`,h=`http://www.w3.org/2000/10/swap/`,g={xsd:{decimal:`${m}decimal`,boolean:`${m}boolean`,double:`${m}double`,integer:`${m}integer`,string:`${m}string`},rdf:{type:`${p}type`,nil:`${p}nil`,first:`${p}first`,rest:`${p}rest`,langString:`${p}langString`},owl:{sameAs:`http://www.w3.org/2002/07/owl#sameAs`},r:{forSome:`${h}reify#forSome`,forAll:`${h}reify#forAll`},log:{implies:`${h}log#implies`,isImpliedBy:`${h}log#isImpliedBy`}},_=f(),{xsd:v}=g,y=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,b={"\\":`\\`,"'":`'`,'"':`"`,n:`
|
|
2
|
+
`,r:`\r`,t:` `,f:`\f`,b:`\b`,_:`_`,"~":`~`,".":`.`,"-":`-`,"!":`!`,$:`$`,"&":`&`,"(":`(`,")":`)`,"*":`*`,"+":`+`,",":`,`,";":`;`,"=":`=`,"/":`/`,"?":`?`,"#":`#`,"@":`@`,"%":`%`},x=/[\x00-\x20<>\\"\{\}\|\^\`]/,S={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},C=/$0^/,w=class{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e||={},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let e in this)!(e in S)&&this[e]instanceof RegExp&&(this[e]=C)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,r=n.length;for(;;){let e,o;for(;e=this._newline.exec(n);)this.comments&&(o=this._comment.exec(e[0]))&&i(`comment`,o[1],``,this._line,e[0].length),n=n.substr(e[0].length,n.length),r=n.length,this._line++;if(!e&&(e=this._whitespace.exec(n))&&(n=n.substr(e[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(o=this._comment.exec(n))&&i(`comment`,o[1],``,this._line,n.length),n=null,i(`eof`,``,``,this._line,0)),this._input=n;let s=this._line,c=n[0],l=``,u=``,d=``,f=null,p=0,m=!1;switch(c){case`^`:if(n.length<3)break;if(n[1]===`^`){if(this._previousMarker=`^^`,n=n.substr(2),n[0]!==`<`){m=!0;break}}else{this._n3Mode&&(p=1,l=`^`);break}case`<`:if(f=this._unescapedIri.exec(n))l=`IRI`,u=f[1];else if(f=this._iri.exec(n)){if(u=this._unescape(f[1]),u===null||x.test(u))return a(this);l=`IRI`}else n.length>1&&n[1]===`<`?(l=`<<`,p=2):this._n3Mode&&n.length>1&&n[1]===`=`&&(p=2,this._isImpliedBy?(l=`abbreviation`,u=`<`):(l=`inverse`,u=`>`));break;case`>`:n.length>1&&n[1]===`>`&&(l=`>>`,p=2);break;case`_`:((f=this._blank.exec(n))||t&&(f=this._blank.exec(`${n} `)))&&(l=`blank`,d=`_`,u=f[1]);break;case`"`:if(f=this._simpleQuotedString.exec(n))u=f[1];else if({value:u,matchLength:p}=this._parseLiteral(n),u===null)return a(this);(f!==null||p!==0)&&(l=`literal`,this._literalClosingPos=0);break;case`'`:if(!this._lineMode){if(f=this._simpleApostropheString.exec(n))u=f[1];else if({value:u,matchLength:p}=this._parseLiteral(n),u===null)return a(this);(f!==null||p!==0)&&(l=`literal`,this._literalClosingPos=0)}break;case`?`:this._n3Mode&&(f=this._variable.exec(n))&&(l=`var`,u=f[0]);break;case`@`:this._previousMarker===`literal`&&(f=this._langcode.exec(n))?(l=`langcode`,u=f[1]):(f=this._keyword.exec(n))&&(l=f[0]);break;case`.`:if(n.length===1?t:n[1]<`0`||n[1]>`9`){l=`.`,p=1;break}case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:case`+`:case`-`:(f=this._number.exec(n)||t&&(f=this._number.exec(`${n} `)))&&(l=`literal`,u=f[0],d=typeof f[1]==`string`?v.double:typeof f[2]==`string`?v.decimal:v.integer);break;case`B`:case`b`:case`p`:case`P`:case`G`:case`g`:(f=this._sparqlKeyword.exec(n))?l=f[0].toUpperCase():m=!0;break;case`f`:case`t`:(f=this._boolean.exec(n))?(l=`literal`,u=f[0],d=v.boolean):m=!0;break;case`a`:(f=this._shortPredicates.exec(n))?(l=`abbreviation`,u=`a`):m=!0;break;case`=`:this._n3Mode&&n.length>1&&(l=`abbreviation`,n[1]===`>`?(p=2,u=`>`):(p=1,u=`=`));break;case`!`:if(!this._n3Mode)break;case`,`:case`;`:case`[`:case`]`:case`(`:case`)`:case`}`:this._lineMode||(p=1,l=c);break;case`{`:!this._lineMode&&n.length>=2&&(n[1]===`|`?(l=`{|`,p=2):(l=c,p=1));break;case`|`:n.length>=2&&n[1]===`}`&&(l=`|}`,p=2);break;default:m=!0}if(m&&((this._previousMarker===`@prefix`||this._previousMarker===`PREFIX`)&&(f=this._prefix.exec(n))?(l=`prefix`,u=f[1]||``):((f=this._prefixed.exec(n))||t&&(f=this._prefixed.exec(`${n} `)))&&(l=`prefixed`,d=f[1]||``,u=this._unescape(f[2]))),this._previousMarker===`^^`)switch(l){case`prefixed`:l=`type`;break;case`IRI`:l=`typeIRI`;break;default:l=``}if(!l)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;let h=p||f[0].length;this.previousToken=i(l,u,d,s,h),this._previousMarker=l,n=n.substr(h,n.length)}function i(t,i,a,o,s){let c=n?r-n.length:r,l={type:t,value:i,prefix:a,line:o,start:c,end:c+s};return e(null,l),l}function a(t){e(t._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1,n=e.replace(y,(e,n,r,i)=>{if(typeof n==`string`)return String.fromCharCode(Number.parseInt(n,16));if(typeof r==`string`){let e=Number.parseInt(r,16);return e<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(e&1023))}return i in b?b[i]:(t=!0,``)});return t?null:n}_parseLiteral(e){if(e.length>=3){let t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length,r=Math.max(this._literalClosingPos,n);for(;(r=e.indexOf(t,r))>0;){let t=0;for(;e[r-t-1]===`\\`;)t++;if(t%2==0){let t=e.substring(n,r),i=t.split(/\r\n|\r|\n/).length-1,a=r+n;if(n===1&&i!==0||n===3&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:a}}r++}this._literalClosingPos=e.length-n+1}return{value:``,matchLength:0}}_syntaxError(e){this._input=null;let t=Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith(``)?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e==`string`)if(this._input=this._readStartingBom(e),typeof t==`function`)queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{let e=[],t;if(this._tokenizeToEnd((n,r)=>n?t=n:e.push(r),!0),t)throw t;return e}else this._pendingBuffer=null,typeof e.setEncoding==`function`&&e.setEncoding(`utf8`),e.on(`data`,e=>{this._input!==null&&e.length!==0&&(this._pendingBuffer&&=(e=_.Buffer.concat([this._pendingBuffer,e]),null),e[e.length-1]&128?this._pendingBuffer=e:(this._input===void 0?this._input=this._readStartingBom(typeof e==`string`?e:e.toString()):this._input+=e,this._tokenizeToEnd(t,!1)))}),e.on(`end`,()=>{typeof this._input==`string`&&this._tokenizeToEnd(t,!0)}),e.on(`error`,t)}},{rdf:T,xsd:E}=g,D,O=0,k={namedNode:z,blankNode:B,variable:ee,literal:V,defaultGraph:te,quad:ne,triple:ne,fromTerm:re,fromQuad:ie},A=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}}},j=class extends A{get termType(){return`NamedNode`}},M=class e extends A{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 j(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===`@`?T.langString:E.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}}}},N=class extends A{constructor(e){super(`_:${e}`)}get termType(){return`BlankNode`}get value(){return this.id.substr(2)}},P=class extends A{constructor(e){super(`?${e}`)}get termType(){return`Variable`}get value(){return this.id.substr(1)}};D=new class extends A{constructor(){return super(``),D||this}get termType(){return`DefaultGraph`}equals(e){return this===e||!!e&&this.termType===e.termType}};function F(e,t,n){if(t||=k,!e)return t.defaultGraph();switch(e[0]){case`?`:return t.variable(e.substr(1));case`_`:return t.blankNode(e.substr(2));case`"`:if(t===k)return new M(e);if(e[e.length-1]===`"`)return t.literal(e.substr(1,e.length-2));let r=e.lastIndexOf(`"`,e.length-1);return t.literal(e.substr(1,r-1),e[r+1]===`@`?e.substr(r+2):t.namedNode(e.substr(r+3)));case`[`:e=JSON.parse(e);break;default:if(!n||!Array.isArray(e))return t.namedNode(e)}return t.quad(F(e[0],t,!0),F(e[1],t,!0),F(e[2],t,!0),e[3]&&F(e[3],t,!0))}function I(e,t){if(typeof e==`string`)return e;if(e instanceof A&&e.termType!==`Quad`)return e.id;if(!e)return D.id;switch(e.termType){case`NamedNode`:return e.value;case`BlankNode`:return`_:${e.value}`;case`Variable`:return`?${e.value}`;case`DefaultGraph`:return``;case`Literal`:return`"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==E.string?`^^${e.datatype.value}`:``}`;case`Quad`:let n=[I(e.subject,!0),I(e.predicate,!0),I(e.object,!0)];return e.graph&&e.graph.termType!==`DefaultGraph`&&n.push(I(e.graph,!0)),t?n:JSON.stringify(n);default:throw Error(`Unexpected termType: ${e.termType}`)}}var R=class extends A{constructor(e,t,n,r){super(``),this._subject=e,this._predicate=t,this._object=n,this._graph=r||D}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 z(e){return new j(e)}function B(e){return new N(e||`n3-${O++}`)}function V(e,t){if(typeof t==`string`)return new M(`"${e}"@${t.toLowerCase()}`);let n=t?t.value:``;return n===``&&(typeof e==`boolean`?n=E.boolean:typeof e==`number`&&(Number.isFinite(e)?n=Number.isInteger(e)?E.integer:E.double:(n=E.double,Number.isNaN(e)||(e=e>0?`INF`:`-INF`)))),n===``||n===E.string?new M(`"${e}"`):new M(`"${e}"^^${n}`)}function ee(e){return new P(e)}function te(){return D}function ne(e,t,n,r){return new R(e,t,n,r)}function re(e){if(e instanceof A)return e;switch(e.termType){case`NamedNode`:return z(e.value);case`BlankNode`:return B(e.value);case`Variable`:return ee(e.value);case`DefaultGraph`:return D;case`Literal`:return V(e.value,e.language||e.datatype);case`Quad`:return ie(e);default:throw Error(`Unexpected termType: ${e.termType}`)}}function ie(e){if(e instanceof R)return e;if(e.termType!==`Quad`)throw Error(`Unexpected termType: ${e.termType}`);return ne(re(e.subject),re(e.predicate),re(e.object),re(e.graph))}var ae=0,oe=class{constructor(e){this._contextStack=[],this._graph=null,e||={},this._setBase(e.baseIRI),e.factory&&ce(this,e.factory);let t=typeof e.format==`string`?e.format.match(/\w*$/)[0].toLowerCase():``,n=/turtle/.test(t),r=/trig/.test(t),i=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),s=i||a;(this._supportsNamedGraphs=!(n||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||r||i||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===``||/star|\*$/.test(t),s&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix=typeof e.blankNodePrefix==`string`?e.blankNodePrefix.replace(/^(?!_:)/,`_:`):``,this._lexer=e.lexer||new w({lineMode:s,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){ae=0}_setBase(e){if(!e)this._base=``,this._basePath=``;else{let t=e.indexOf(`#`);t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf(`/`)<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,``),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,t,n,r,i){let a=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:r,object:i,graph:t,inverse:a?this._inversePredicate:!1,blankPrefix:a?this._prefixes._:``,quantified:a?this._quantified:null}),a&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:`.`,this._quantified=Object.create(this._quantified))}_restoreContext(e,t){let n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readInTopContext(e){switch(e.type){case`eof`:return this._graph===null?(delete this._prefixes._,this._callback(null,null,this._prefixes)):this._error(`Unclosed graph`,e);case`PREFIX`:this._sparqlStyle=!0;case`@prefix`:return this._readPrefix;case`BASE`:this._sparqlStyle=!0;case`@base`:return this._readBaseIRI;case`{`:if(this._supportsNamedGraphs)return this._graph=``,this._subject=null,this._readSubject;case`GRAPH`:if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let n;switch(e.type){case`IRI`:case`typeIRI`:let t=this._resolveIRI(e.value);if(t===null)return this._error(`Invalid IRI`,e);n=this._factory.namedNode(t);break;case`type`:case`prefixed`:let r=this._prefixes[e.prefix];if(r===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(r+e.value);break;case`blank`:n=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case`var`:n=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(e){switch(this._predicate=null,e.type){case`[`:return this._saveContext(`blank`,this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case`(`:return this._saveContext(`list`,this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case`{`:return this._n3Mode?(this._saveContext(`formula`,this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error(`Unexpected graph`,e);case`}`:return this._readPunctuation(e);case`@forSome`:return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=`blankNode`,this._readQuantifierList):this._error(`Unexpected "@forSome"`,e);case`@forAll`:return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=`variable`,this._readQuantifierList):this._error(`Unexpected "@forAll"`,e);case`literal`:if(!this._n3Mode)return this._error(`Unexpected literal`,e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case`<<`:return this._supportsRDFStar?(this._saveContext(`<<`,this._graph,null,null,null),this._graph=null,this._readSubject):this._error(`Unexpected RDF-star syntax`,e);default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let t=e.type;switch(t){case`inverse`:this._inversePredicate=!0;case`abbreviation`:this._predicate=this.ABBREVIATIONS[e.value];break;case`.`:case`]`:case`}`:return this._predicate===null?this._error(`Unexpected ${t}`,e):(this._subject=null,t===`]`?this._readBlankNodeTail(e):this._readPunctuation(e));case`;`:return this._predicate===null?this._error(`Expected predicate but got ;`,e):this._readPredicate;case`[`:if(this._n3Mode)return this._saveContext(`blank`,this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case`blank`:if(!this._n3Mode)return this._error(`Disallowed blank node as predicate`,e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case`literal`:if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case`[`:return this._saveContext(`blank`,this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case`(`:return this._saveContext(`list`,this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case`{`:return this._n3Mode?(this._saveContext(`formula`,this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error(`Unexpected graph`,e);case`<<`:return this._supportsRDFStar?(this._saveContext(`<<`,this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error(`Unexpected RDF-star syntax`,e);default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type===`{`?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type===`{`?(this._graph=this._subject,this._subject=null,this._readSubject):this._error(`Expected graph but got ${e.type}`,e)}_readBlankNodeHead(e){return e.type===`]`?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!==`]`)return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let t=this._predicate===null;return this._restoreContext(`blank`,e),this._object===null?this._predicate===null?t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank:this._readObject:this._getContextEndReader()}_readPredicateAfterBlank(e){switch(e.type){case`.`:case`}`:return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,n=null,r=this._readListItem,i=this._subject,a=this._contextStack,o=a[a.length-1];switch(e.type){case`[`:this._saveContext(`blank`,this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),r=this._readBlankNodeHead;break;case`(`:this._saveContext(`list`,this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case`)`:if(this._restoreContext(`list`,e),a.length!==0&&a[a.length-1].type===`list`&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;n=this.RDF_NIL;break;case`literal`:e.prefix.length===0?(this._literalValue=e.value,r=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),r=this._getContextEndReader());break;case`{`:return this._n3Mode?(this._saveContext(`formula`,this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error(`Unexpected graph`,e);default:if((t=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),i===null?o.predicate===null?o.subject=n:o.object=n:this._emit(i,this.RDF_REST,n,this._graph),t!==null){if(this._n3Mode&&(e.type===`IRI`||e.type===`prefixed`))return this._saveContext(`item`,this._graph,n,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,t,this._graph)}return r}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._factory.literal(this._literalValue);switch(e.type){case`type`:case`typeIRI`:let n=this._readEntity(e);if(n===void 0)return;t=this._factory.literal(this._literalValue,n),e=null;break;case`langcode`:t=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){let n=this._completeLiteral(e);if(n)return this._object=n.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),n.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}_readFormulaTail(e){return e.type===`}`?(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext(`formula`,e),this._object===null?this._readPredicate:this._getContextEndReader()):this._readPunctuation(e)}_readPunctuation(e){let t,n=this._graph,r=this._subject,i=this._inversePredicate;switch(e.type){case`}`:if(this._graph===null)return this._error(`Unexpected graph closing`,e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case`.`:this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case`;`:t=this._readPredicate;break;case`,`:t=this._readObject;break;case`{|`:if(!this._supportsRDFStar)return this._error(`Unexpected RDF-star syntax`,e);let a=this._predicate,o=this._object;this._subject=this._factory.quad(r,a,o,this.DEFAULTGRAPH),t=this._readPredicate;break;case`|}`:if(this._subject.termType!==`Quad`)return this._error(`Unexpected asserted triple closing`,e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(n=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(r!==null){let e=this._predicate,t=this._object;i?this._emit(t,e,r,n):this._emit(r,e,t,n)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case`;`:t=this._readPredicate;break;case`,`:t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return e.type===`.`?this._readInTopContext:this._error(`Expected dot to follow quad`,e)}_readPrefix(e){return e.type===`prefix`?(this._prefix=e.value,this._readPrefixIRI):this._error(`Expected prefix to follow @prefix`,e)}_readPrefixIRI(e){if(e.type!==`IRI`)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){let t=e.type===`IRI`&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error(`Expected valid IRI to follow base declaration`,e)}_readNamedGraphLabel(e){switch(e.type){case`IRI`:case`blank`:case`prefixed`:return this._readSubject(e),this._readGraph;case`[`:return this._readNamedGraphBlankLabel;default:return this._error(`Invalid graph label`,e)}}_readNamedGraphBlankLabel(e){return e.type===`]`?(this._subject=this._factory.blankNode(),this._readGraph):this._error(`Invalid graph label`,e)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type===`.`?this._readInTopContext:this._error(`Expected declaration to end with a dot`,e)}_readQuantifierList(e){let t;switch(e.type){case`IRI`:case`prefixed`:if((t=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===`,`?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case`!`:return this._readForwardPath;case`^`:return this._readBackwardPath;default:let t=this._contextStack,n=t.length&&t[t.length-1];if(n&&n.type===`item`){let t=this._subject;this._restoreContext(`item`,e),this._emit(this._subject,this.RDF_FIRST,t,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n,r=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=r):(t=this._object,this._object=r),this._emit(t,n,r,this._graph),this._readPath}_readBackwardPath(e){let t=this._factory.blankNode(),n,r;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=t):(r=this._object,this._object=t),this._emit(t,n,r,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type===`>>`?this._readRDFStarTail(e):this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e)}_readRDFStarTail(e){if(e.type!==`>>`)return this._error(`Expected >> but got ${e.type}`,e);let t=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext(`<<`,e),this._subject===null?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case`blank`:return this._readBlankNodeTail;case`list`:return this._readListItem;case`formula`:return this._readFormulaTail;case`<<`:return this._readRDFStarTailOrGraph}}_emit(e,t,n,r){this._callback(null,this._factory.quad(e,t,n,r||this.DEFAULTGRAPH))}_error(e,t){let n=Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=se}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case`#`:return this._base+e;case`?`:return this._base.replace(/(?:\?.*)?$/,e);case`/`:return(e[1]===`/`?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let t=e.length,n=``,r=-1,i=-1,a=0,o=`/`;for(;r<t;){switch(o){case`:`:if(i<0&&e[++r]===`/`&&e[++r]===`/`)for(;(i=r+1)<t&&e[i]!==`/`;)r=i;break;case`?`:case`#`:r=t;break;case`/`:if(e[r+1]===`.`)switch(o=e[++r+1],o){case`/`:n+=e.substring(a,r-1),a=r+1;break;case void 0:case`?`:case`#`:return n+e.substring(a,r)+e.substr(r+1);case`.`:if(o=e[++r+1],o===void 0||o===`/`||o===`?`||o===`#`){if(n+=e.substring(a,r-2),(a=n.lastIndexOf(`/`))>=i&&(n=n.substr(0,a)),o!==`/`)return`${n}/${e.substr(r+1)}`;a=r+1}}}o=e[++r]}return n+e.substring(a)}parse(e,t,n){let r,i,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(r=t.onQuad,i=t.onPrefix,a=t.onComment):(r=t,i=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${ae++}_`,this._prefixCallback=i||se,this._inversePredicate=!1,this._quantified=Object.create(null),!r){let t=[],n;if(this._callback=(e,r)=>{e?n=e:r&&t.push(r)},this._lexer.tokenize(e).every(e=>this._readCallback=this._readCallback(e)),n)throw n;return t}let o=(e,t)=>{e===null?this._readCallback&&=this._readCallback(t):(this._callback(e),this._callback=se)};a&&(this._lexer.comments=!0,o=(e,t)=>{e===null?this._readCallback&&(t.type===`comment`?a(t.value):this._readCallback=this._readCallback(t)):(this._callback(e),this._callback=se)}),this._callback=r,this._lexer.tokenize(e,o)}};function se(){}function ce(e,t){e._factory=t,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=t.namedNode(g.rdf.first),e.RDF_REST=t.namedNode(g.rdf.rest),e.RDF_NIL=t.namedNode(g.rdf.nil),e.N3_FORALL=t.namedNode(g.r.forAll),e.N3_FORSOME=t.namedNode(g.r.forSome),e.ABBREVIATIONS={a:t.namedNode(g.rdf.type),"=":t.namedNode(g.owl.sameAs),">":t.namedNode(g.log.implies),"<":t.namedNode(g.log.isImpliedBy)},e.QUANTIFIERS_GRAPH=t.namedNode(`urn:n3:quantifiers`)}ce(oe.prototype,k);function le(e){return!!e&&e.termType===`DefaultGraph`}function ue(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,`\\$&`)}var de=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,fe=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,pe=`./`,me=`../`,he=`?`,ge=`#`,_e=class e{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=Array(e.length+1)}static supports(e){return!de.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!e.supports(this.base))return this._baseMatcher=/.^/;let t=/^[^:]*:\/*/.exec(this.base)[0],n=[`^`,ue(t)],r=[],i=[],a=/[^/?#]*([/?#])/y,o,s=0,c=0,l=a.lastIndex=t.length;for(;!s&&!c&&(o=a.exec(this.base));)o[1]===ge?c=a.lastIndex-1:(n.push(ue(o[0]),`(?:`),r.push(`)?`),o[1]===he?(s=l=a.lastIndex,c=this.base.indexOf(ge,s),this._pathReplacements[s]=he):i.push(l=a.lastIndex));for(let e=0;e<i.length;e++)this._pathReplacements[i[e]]=me.repeat(i.length-e-1);return this._pathReplacements[i[i.length-1]]=pe,this._baseLength=c>0?c:this.base.length,n.push(ue(this.base.substring(l,this._baseLength)),s?`(?:#|$)`:`(?:[?#]|$)`),this._baseMatcher=new RegExp([...n,...r].join(``))}toRelative(e){let t=this._getBaseMatcher().exec(e);if(!t)return e;let n=t[0].length;if(n===this._baseLength&&n===e.length)return``;let r=this._pathReplacements[n];if(r){let t=e.substring(n);return r!==he&&!fe.test(t)?e:r===pe&&/^[^?#]/.test(t)?t:r+t}return e.substring(n-1)}},ve=k.defaultGraph(),{rdf:ye,xsd:H}=g,be=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,xe=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Se={"\\":`\\\\`,'"':`\\"`," ":`\\t`,"\n":`\\n`,"\r":`\\r`,"\b":`\\b`,"\f":`\\f`},Ce=class extends A{equals(e){return e===this}},we=class{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!=`function`&&(t=e,e=null),t||={},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let e=``;this._outputStream={write(t,n,r){e+=t,r&&r()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=ve,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new _e(t.baseIRI)))}get _inDefaultGraph(){return ve.equals(this._graph)}_write(e,t){this._outputStream.write(e,`utf8`,t)}_writeQuad(e,t,n,r,i){try{r.equals(this._graph)||(this._write((this._subject===null?``:this._inDefaultGraph?`.
|
|
3
3
|
`:`
|
|
4
4
|
}
|
|
5
|
-
`)+(
|
|
6
|
-
`)
|
|
7
|
-
|
|
8
|
-
`)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=n)} ${this._encodeObject(r)}`,a)}catch(l){a&&a(l)}}_writeQuadLine(e,n,r,o,a){delete this._prefixMatch,this._write(this.quadToString(e,n,r,o),a)}quadToString(e,n,r,o){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(n)} ${this._encodeObject(r)}${o&&o.value?` ${this._encodeIriOrBlank(o)} .
|
|
9
|
-
`:` .
|
|
10
|
-
`}`}quadsToString(e){let n="";for(const r of e)n+=this.quadToString(r.subject,r.predicate,r.object,r.graph);return n}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let n=e.value;this._baseIri&&(n=this._baseIri.toRelative(n)),oc.test(n)&&(n=n.replace(ac,lc));const r=this._prefixRegex.exec(n);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:n:`<${n}>`}_encodeLiteral(e){let n=e.value;if(oc.test(n)&&(n=n.replace(ac,lc)),e.language)return`"${n}"@${e.language}`;if(this._lineMode){if(e.datatype.value===Fi.string)return`"${n}"`}else switch(e.datatype.value){case Fi.string:return`"${n}"`;case Fi.boolean:if(n==="true"||n==="false")return n;break;case Fi.integer:if(/^[+-]?\d+$/.test(n))return n;break;case Fi.decimal:if(/^[+-]?\d*\.\d+$/.test(n))return n;break;case Fi.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(n))return n;break}return`"${n}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===qg.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:n,object:r,graph:o}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(n)} ${this._encodeObject(r)}${bl(o)?"":` ${this._encodeIriOrBlank(o)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,n,r,o,a){r===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,n):typeof o=="function"?this._writeQuad(e,n,r,mr,o):this._writeQuad(e,n,r,o||mr,a)}addQuads(e){for(let n=0;n<e.length;n++)this.addQuad(e[n])}addPrefix(e,n,r){const o={};o[e]=n,this.addPrefixes(o,r)}addPrefixes(e,n){if(!this._prefixIRIs)return n&&n();let r=!1;for(let o in e){let a=e[o];typeof a!="string"&&(a=a.value),r=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
5
|
+
`)+(ve.equals(r)?``:`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,i):this._write(`${(this._subject===null?``:`.
|
|
6
|
+
`)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,i)}catch(e){i&&i(e)}}_writeQuadLine(e,t,n,r,i){delete this._prefixMatch,this._write(this.quadToString(e,t,n,r),i)}quadToString(e,t,n,r){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(n)}${r&&r.value?` ${this._encodeIriOrBlank(r)} .\n`:` .
|
|
7
|
+
`}`}quadsToString(e){let t=``;for(let n of e)t+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return t}_encodeSubject(e){return e.termType===`Quad`?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!==`NamedNode`)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),`id`in e?e.id:`_:${e.value}`;let t=e.value;this._baseIri&&(t=this._baseIri.toRelative(t)),be.test(t)&&(t=t.replace(xe,Te));let n=this._prefixRegex.exec(t);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(be.test(t)&&(t=t.replace(xe,Te)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===H.string)return`"${t}"`}else switch(e.datatype.value){case H.string:return`"${t}"`;case H.boolean:if(t===`true`||t===`false`)return t;break;case H.integer:if(/^[+-]?\d+$/.test(t))return t;break;case H.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case H.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===ye.type?`a`:this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case`Quad`:return this._encodeQuad(e);case`Literal`:return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:n,graph:r}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(n)}${le(r)?``:` ${this._encodeIriOrBlank(r)}`}>>`}_blockedWrite(){throw Error(`Cannot write because the writer has been closed.`)}addQuad(e,t,n,r,i){n===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof r==`function`?this._writeQuad(e,t,n,ve,r):this._writeQuad(e,t,n,r||ve,i)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,n){let r={};r[e]=t,this.addPrefixes(r,n)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let n=!1;for(let t in e){let r=e[t];typeof r!=`string`&&(r=r.value),n=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
11
8
|
`:`
|
|
12
9
|
}
|
|
13
|
-
`),this._subject=null,this._graph
|
|
14
|
-
|
|
15
|
-
`:"",n)}blank(e,n){let r=e,o,a;switch(e===void 0?r=[]:e.termType?r=[{predicate:e,object:n}]:"length"in e||(r=[e]),a=r.length){case 0:return new _r("[]");case 1:if(o=r[0],!(o.object instanceof _r))return new _r(`[ ${this._encodePredicate(o.predicate)} ${this._encodeObject(o.object)} ]`);default:let l="[";for(let u=0;u<a;u++)o=r[u],o.predicate.equals(e)?l+=`, ${this._encodeObject(o.object)}`:(l+=`${(u?`;
|
|
10
|
+
`),this._subject=null,this._graph=``),this._prefixIRIs[r]=t+=`:`,this._write(`@prefix ${t} <${r}>.\n`)}if(n){let e=``,t=``;for(let n in this._prefixIRIs)e+=e?`|${n}`:n,t+=(t?`|`:``)+this._prefixIRIs[n];e=ue(e,/[\]\/\(\)\*\+\?\.\\\$]/g,`\\$&`),this._prefixRegex=RegExp(`^(?:${t})[^\/]*$|^(${e})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(n?`
|
|
11
|
+
`:``,t)}blank(e,t){let n=e,r,i;switch(e===void 0?n=[]:e.termType?n=[{predicate:e,object:t}]:`length`in e||(n=[e]),i=n.length){case 0:return new Ce(`[]`);case 1:if(r=n[0],!(r.object instanceof Ce))return new Ce(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t=`[`;for(let a=0;a<i;a++)r=n[a],r.predicate.equals(e)?t+=`, ${this._encodeObject(r.object)}`:(t+=`${(a?`;
|
|
16
12
|
`:`
|
|
17
|
-
`)+this._encodePredicate(
|
|
18
|
-
]`)}}list(e){const n=e&&e.length||0,r=new Array(n);for(let o=0;o<n;o++)r[o]=this._encodeObject(e[o]);return new _r(`(${r.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
13
|
+
`)+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new Ce(`${t}\n]`)}}list(e){let t=e&&e.length||0,n=Array(t);for(let r=0;r<t;r++)n[r]=this._encodeObject(e[r]);return new Ce(`(${n.join(` `)})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
19
14
|
`:`
|
|
20
15
|
}
|
|
21
|
-
`),this._subject=null),this._write=this._blockedWrite;let n=e&&((r,o)=>{n=null,e(r,o)});if(this._endStream)try{return this._outputStream.end(n)}catch{}n&&n()}}function lc(i){let e=zg[i];return e===void 0&&(i.length===1?(e=i.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Oo={exports:{}},Fo={exports:{}},jo,uc;function ct(){if(uc)return jo;uc=1;class i extends Error{constructor(n){if(!Array.isArray(n))throw new TypeError(`Expected input to be an Array, got ${typeof n}`);let r="";for(let o=0;o<n.length;o++)r+=` ${n[o].stack}
|
|
22
|
-
`;super(r),this.name="AggregateError",this.errors=n}}return jo={AggregateError:i,ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,n){return e.includes(n)},ArrayPrototypeIndexOf(e,n){return e.indexOf(n)},ArrayPrototypeJoin(e,n){return e.join(n)},ArrayPrototypeMap(e,n){return e.map(n)},ArrayPrototypePop(e,n){return e.pop(n)},ArrayPrototypePush(e,n){return e.push(n)},ArrayPrototypeSlice(e,n,r){return e.slice(n,r)},Error,FunctionPrototypeCall(e,n,...r){return e.call(n,...r)},FunctionPrototypeSymbolHasInstance(e,n){return Function.prototype[Symbol.hasInstance].call(e,n)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(e,n){return Object.defineProperties(e,n)},ObjectDefineProperty(e,n,r){return Object.defineProperty(e,n,r)},ObjectGetOwnPropertyDescriptor(e,n){return Object.getOwnPropertyDescriptor(e,n)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,n){return Object.setPrototypeOf(e,n)},Promise,PromisePrototypeCatch(e,n){return e.catch(n)},PromisePrototypeThen(e,n,r){return e.then(n,r)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,n){return e.test(n)},SafeSet:Set,String,StringPrototypeSlice(e,n,r){return e.slice(n,r)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(e,n,r){return e.set(n,r)},Boolean,Uint8Array},jo}var Bo={exports:{}},$o,cc;function pf(){return cc||(cc=1,$o={format(i,...e){return i.replace(/%([sdifj])/g,function(...[n,r]){const o=e.shift();return r==="f"?o.toFixed(6):r==="j"?JSON.stringify(o):r==="s"&&typeof o=="object"?`${o.constructor!==Object?o.constructor.name:""} {}`.trim():o.toString()})},inspect(i){switch(typeof i){case"string":if(i.includes("'"))if(i.includes('"')){if(!i.includes("`")&&!i.includes("${"))return`\`${i}\``}else return`"${i}"`;return`'${i}'`;case"number":return isNaN(i)?"NaN":Object.is(i,-0)?String(i):i;case"bigint":return`${String(i)}n`;case"boolean":case"undefined":return String(i);case"object":return"{}"}}}),$o}var qo,dc;function kt(){if(dc)return qo;dc=1;const{format:i,inspect:e}=pf(),{AggregateError:n}=ct(),r=globalThis.AggregateError||n,o=Symbol("kIsNodeError"),a=["string","function","number","object","Function","Object","boolean","bigint","symbol"],l=/^([A-Z][a-z0-9]*)+$/,u="__node_internal_",f={};function h(A,N){if(!A)throw new f.ERR_INTERNAL_ASSERTION(N)}function g(A){let N="",P=A.length;const w=A[0]==="-"?1:0;for(;P>=w+4;P-=3)N=`_${A.slice(P-3,P)}${N}`;return`${A.slice(0,P)}${N}`}function m(A,N,P){if(typeof N=="function")return h(N.length<=P.length,`Code: ${A}; The provided arguments length (${P.length}) does not match the required ones (${N.length}).`),N(...P);const w=(N.match(/%[dfijoOs]/g)||[]).length;return h(w===P.length,`Code: ${A}; The provided arguments length (${P.length}) does not match the required ones (${w}).`),P.length===0?N:i(N,...P)}function d(A,N,P){P||(P=Error);class w extends P{constructor(...S){super(m(A,N,S))}toString(){return`${this.name} [${A}]: ${this.message}`}}Object.defineProperties(w.prototype,{name:{value:P.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${A}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),w.prototype.code=A,w.prototype[o]=!0,f[A]=w}function _(A){const N=u+A.name;return Object.defineProperty(A,"name",{value:N}),A}function b(A,N){if(A&&N&&A!==N){if(Array.isArray(N.errors))return N.errors.push(A),N;const P=new r([N,A],N.message);return P.code=N.code,P}return A||N}class I extends Error{constructor(N="The operation was aborted",P=void 0){if(P!==void 0&&typeof P!="object")throw new f.ERR_INVALID_ARG_TYPE("options","Object",P);super(N,P),this.code="ABORT_ERR",this.name="AbortError"}}return d("ERR_ASSERTION","%s",Error),d("ERR_INVALID_ARG_TYPE",(A,N,P)=>{h(typeof A=="string","'name' must be a string"),Array.isArray(N)||(N=[N]);let w="The ";A.endsWith(" argument")?w+=`${A} `:w+=`"${A}" ${A.includes(".")?"property":"argument"} `,w+="must be ";const y=[],S=[],O=[];for(const C of N)h(typeof C=="string","All expected entries have to be of type string"),a.includes(C)?y.push(C.toLowerCase()):l.test(C)?S.push(C):(h(C!=="object",'The value "object" should be written as "Object"'),O.push(C));if(S.length>0){const C=y.indexOf("object");C!==-1&&(y.splice(y,C,1),S.push("Object"))}if(y.length>0){switch(y.length){case 1:w+=`of type ${y[0]}`;break;case 2:w+=`one of type ${y[0]} or ${y[1]}`;break;default:{const C=y.pop();w+=`one of type ${y.join(", ")}, or ${C}`}}(S.length>0||O.length>0)&&(w+=" or ")}if(S.length>0){switch(S.length){case 1:w+=`an instance of ${S[0]}`;break;case 2:w+=`an instance of ${S[0]} or ${S[1]}`;break;default:{const C=S.pop();w+=`an instance of ${S.join(", ")}, or ${C}`}}O.length>0&&(w+=" or ")}switch(O.length){case 0:break;case 1:O[0].toLowerCase()!==O[0]&&(w+="an "),w+=`${O[0]}`;break;case 2:w+=`one of ${O[0]} or ${O[1]}`;break;default:{const C=O.pop();w+=`one of ${O.join(", ")}, or ${C}`}}if(P==null)w+=`. Received ${P}`;else if(typeof P=="function"&&P.name)w+=`. Received function ${P.name}`;else if(typeof P=="object"){var X;if((X=P.constructor)!==null&&X!==void 0&&X.name)w+=`. Received an instance of ${P.constructor.name}`;else{const C=e(P,{depth:-1});w+=`. Received ${C}`}}else{let C=e(P,{colors:!1});C.length>25&&(C=`${C.slice(0,25)}...`),w+=`. Received type ${typeof P} (${C})`}return w},TypeError),d("ERR_INVALID_ARG_VALUE",(A,N,P="is invalid")=>{let w=e(N);return w.length>128&&(w=w.slice(0,128)+"..."),`The ${A.includes(".")?"property":"argument"} '${A}' ${P}. Received ${w}`},TypeError),d("ERR_INVALID_RETURN_VALUE",(A,N,P)=>{var w;const y=P!=null&&(w=P.constructor)!==null&&w!==void 0&&w.name?`instance of ${P.constructor.name}`:`type ${typeof P}`;return`Expected ${A} to be returned from the "${N}" function but got ${y}.`},TypeError),d("ERR_MISSING_ARGS",(...A)=>{h(A.length>0,"At least one arg needs to be specified");let N;const P=A.length;switch(A=(Array.isArray(A)?A:[A]).map(w=>`"${w}"`).join(" or "),P){case 1:N+=`The ${A[0]} argument`;break;case 2:N+=`The ${A[0]} and ${A[1]} arguments`;break;default:{const w=A.pop();N+=`The ${A.join(", ")}, and ${w} arguments`}break}return`${N} must be specified`},TypeError),d("ERR_OUT_OF_RANGE",(A,N,P)=>{h(N,'Missing "range" argument');let w;if(Number.isInteger(P)&&Math.abs(P)>2**32)w=g(String(P));else if(typeof P=="bigint"){w=String(P);const y=BigInt(2)**BigInt(32);(P>y||P<-y)&&(w=g(w)),w+="n"}else w=e(P);return`The value of "${A}" is out of range. It must be ${N}. Received ${w}`},RangeError),d("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),d("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),d("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),d("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),d("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),d("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),d("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),d("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),d("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),d("ERR_STREAM_WRITE_AFTER_END","write after end",Error),d("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),qo={AbortError:I,aggregateTwoErrors:_(b),hideStackFrames:_,codes:f},qo}var yr={exports:{}},hc;function Hr(){if(hc)return yr.exports;hc=1;const{AbortController:i,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return yr.exports=i,yr.exports.AbortSignal=e,yr.exports.default=i,yr.exports}var bs={exports:{}},fc;function Gs(){if(fc)return bs.exports;fc=1;var i=typeof Reflect=="object"?Reflect:null,e=i&&typeof i.apply=="function"?i.apply:function(S,O,X){return Function.prototype.apply.call(S,O,X)},n;i&&typeof i.ownKeys=="function"?n=i.ownKeys:Object.getOwnPropertySymbols?n=function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:n=function(S){return Object.getOwnPropertyNames(S)};function r(y){console&&console.warn&&console.warn(y)}var o=Number.isNaN||function(S){return S!==S};function a(){a.init.call(this)}bs.exports=a,bs.exports.once=N,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function u(y){if(typeof y!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof y)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(y){if(typeof y!="number"||y<0||o(y))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+y+".");l=y}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(S){if(typeof S!="number"||S<0||o(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this};function f(y){return y._maxListeners===void 0?a.defaultMaxListeners:y._maxListeners}a.prototype.getMaxListeners=function(){return f(this)},a.prototype.emit=function(S){for(var O=[],X=1;X<arguments.length;X++)O.push(arguments[X]);var C=S==="error",U=this._events;if(U!==void 0)C=C&&U.error===void 0;else if(!C)return!1;if(C){var R;if(O.length>0&&(R=O[0]),R instanceof Error)throw R;var $=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw $.context=R,$}var G=U[S];if(G===void 0)return!1;if(typeof G=="function")e(G,this,O);else for(var j=G.length,F=b(G,j),X=0;X<j;++X)e(F[X],this,O);return!0};function h(y,S,O,X){var C,U,R;if(u(O),U=y._events,U===void 0?(U=y._events=Object.create(null),y._eventsCount=0):(U.newListener!==void 0&&(y.emit("newListener",S,O.listener?O.listener:O),U=y._events),R=U[S]),R===void 0)R=U[S]=O,++y._eventsCount;else if(typeof R=="function"?R=U[S]=X?[O,R]:[R,O]:X?R.unshift(O):R.push(O),C=f(y),C>0&&R.length>C&&!R.warned){R.warned=!0;var $=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");$.name="MaxListenersExceededWarning",$.emitter=y,$.type=S,$.count=R.length,r($)}return y}a.prototype.addListener=function(S,O){return h(this,S,O,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(S,O){return h(this,S,O,!0)};function g(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function m(y,S,O){var X={fired:!1,wrapFn:void 0,target:y,type:S,listener:O},C=g.bind(X);return C.listener=O,X.wrapFn=C,C}a.prototype.once=function(S,O){return u(O),this.on(S,m(this,S,O)),this},a.prototype.prependOnceListener=function(S,O){return u(O),this.prependListener(S,m(this,S,O)),this},a.prototype.removeListener=function(S,O){var X,C,U,R,$;if(u(O),C=this._events,C===void 0)return this;if(X=C[S],X===void 0)return this;if(X===O||X.listener===O)--this._eventsCount===0?this._events=Object.create(null):(delete C[S],C.removeListener&&this.emit("removeListener",S,X.listener||O));else if(typeof X!="function"){for(U=-1,R=X.length-1;R>=0;R--)if(X[R]===O||X[R].listener===O){$=X[R].listener,U=R;break}if(U<0)return this;U===0?X.shift():I(X,U),X.length===1&&(C[S]=X[0]),C.removeListener!==void 0&&this.emit("removeListener",S,$||O)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(S){var O,X,C;if(X=this._events,X===void 0)return this;if(X.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):X[S]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete X[S]),this;if(arguments.length===0){var U=Object.keys(X),R;for(C=0;C<U.length;++C)R=U[C],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(O=X[S],typeof O=="function")this.removeListener(S,O);else if(O!==void 0)for(C=O.length-1;C>=0;C--)this.removeListener(S,O[C]);return this};function d(y,S,O){var X=y._events;if(X===void 0)return[];var C=X[S];return C===void 0?[]:typeof C=="function"?O?[C.listener||C]:[C]:O?A(C):b(C,C.length)}a.prototype.listeners=function(S){return d(this,S,!0)},a.prototype.rawListeners=function(S){return d(this,S,!1)},a.listenerCount=function(y,S){return typeof y.listenerCount=="function"?y.listenerCount(S):_.call(y,S)},a.prototype.listenerCount=_;function _(y){var S=this._events;if(S!==void 0){var O=S[y];if(typeof O=="function")return 1;if(O!==void 0)return O.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function b(y,S){for(var O=new Array(S),X=0;X<S;++X)O[X]=y[X];return O}function I(y,S){for(;S+1<y.length;S++)y[S]=y[S+1];y.pop()}function A(y){for(var S=new Array(y.length),O=0;O<S.length;++O)S[O]=y[O].listener||y[O];return S}function N(y,S){return new Promise(function(O,X){function C(R){y.removeListener(S,U),X(R)}function U(){typeof y.removeListener=="function"&&y.removeListener("error",C),O([].slice.call(arguments))}w(y,S,U,{once:!0}),S!=="error"&&P(y,C,{once:!0})})}function P(y,S,O){typeof y.on=="function"&&w(y,"error",S,O)}function w(y,S,O,X){if(typeof y.on=="function")X.once?y.once(S,O):y.on(S,O);else if(typeof y.addEventListener=="function")y.addEventListener(S,function C(U){X.once&&y.removeEventListener(S,C),O(U)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof y)}return bs.exports}var pc;function jt(){return pc||(pc=1,(function(i){const e=Dn(),{format:n,inspect:r}=pf(),{codes:{ERR_INVALID_ARG_TYPE:o}}=kt(),{kResistStopPropagation:a,AggregateError:l,SymbolDispose:u}=ct(),f=globalThis.AbortSignal||Hr().AbortSignal,h=globalThis.AbortController||Hr().AbortController,g=Object.getPrototypeOf(async function(){}).constructor,m=globalThis.Blob||e.Blob,d=typeof m<"u"?function(A){return A instanceof m}:function(A){return!1},_=(I,A)=>{if(I!==void 0&&(I===null||typeof I!="object"||!("aborted"in I)))throw new o(A,"AbortSignal",I)},b=(I,A)=>{if(typeof I!="function")throw new o(A,"Function",I)};i.exports={AggregateError:l,kEmptyObject:Object.freeze({}),once(I){let A=!1;return function(...N){A||(A=!0,I.apply(this,N))}},createDeferredPromise:function(){let I,A;return{promise:new Promise((P,w)=>{I=P,A=w}),resolve:I,reject:A}},promisify(I){return new Promise((A,N)=>{I((P,...w)=>P?N(P):A(...w))})},debuglog(){return function(){}},format:n,inspect:r,types:{isAsyncFunction(I){return I instanceof g},isArrayBufferView(I){return ArrayBuffer.isView(I)}},isBlob:d,deprecate(I,A){return I},addAbortListener:Gs().addAbortListener||function(A,N){if(A===void 0)throw new o("signal","AbortSignal",A);_(A,"signal"),b(N,"listener");let P;return A.aborted?queueMicrotask(()=>N()):(A.addEventListener("abort",N,{__proto__:null,once:!0,[a]:!0}),P=()=>{A.removeEventListener("abort",N)}),{__proto__:null,[u](){var w;(w=P)===null||w===void 0||w()}}},AbortSignalAny:f.any||function(A){if(A.length===1)return A[0];const N=new h,P=()=>N.abort();return A.forEach(w=>{_(w,"signals"),w.addEventListener("abort",P,{once:!0})}),N.signal.addEventListener("abort",()=>{A.forEach(w=>w.removeEventListener("abort",P))},{once:!0}),N.signal}},i.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(Bo)),Bo.exports}var ws={},zo,gc;function Xr(){if(gc)return zo;gc=1;const{ArrayIsArray:i,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:n,ArrayPrototypeMap:r,NumberIsInteger:o,NumberIsNaN:a,NumberMAX_SAFE_INTEGER:l,NumberMIN_SAFE_INTEGER:u,NumberParseInt:f,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:g,String:m,StringPrototypeToUpperCase:d,StringPrototypeTrim:_}=ct(),{hideStackFrames:b,codes:{ERR_SOCKET_BAD_PORT:I,ERR_INVALID_ARG_TYPE:A,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:P,ERR_UNKNOWN_SIGNAL:w}}=kt(),{normalizeEncoding:y}=jt(),{isAsyncFunction:S,isArrayBufferView:O}=jt().types,X={};function C(le){return le===(le|0)}function U(le){return le===le>>>0}const R=/^[0-7]+$/,$="must be a 32-bit unsigned integer or an octal string";function G(le,be,Ae){if(typeof le>"u"&&(le=Ae),typeof le=="string"){if(g(R,le)===null)throw new N(be,le,$);le=f(le,8)}return se(le,be),le}const j=b((le,be,Ae=u,ve=l)=>{if(typeof le!="number")throw new A(be,"number",le);if(!o(le))throw new P(be,"an integer",le);if(le<Ae||le>ve)throw new P(be,`>= ${Ae} && <= ${ve}`,le)}),F=b((le,be,Ae=-2147483648,ve=2147483647)=>{if(typeof le!="number")throw new A(be,"number",le);if(!o(le))throw new P(be,"an integer",le);if(le<Ae||le>ve)throw new P(be,`>= ${Ae} && <= ${ve}`,le)}),se=b((le,be,Ae=!1)=>{if(typeof le!="number")throw new A(be,"number",le);if(!o(le))throw new P(be,"an integer",le);const ve=Ae?1:0,qe=4294967295;if(le<ve||le>qe)throw new P(be,`>= ${ve} && <= ${qe}`,le)});function M(le,be){if(typeof le!="string")throw new A(be,"string",le)}function re(le,be,Ae=void 0,ve){if(typeof le!="number")throw new A(be,"number",le);if(Ae!=null&&le<Ae||ve!=null&&le>ve||(Ae!=null||ve!=null)&&a(le))throw new P(be,`${Ae!=null?`>= ${Ae}`:""}${Ae!=null&&ve!=null?" && ":""}${ve!=null?`<= ${ve}`:""}`,le)}const B=b((le,be,Ae)=>{if(!e(Ae,le)){const qe="must be one of: "+n(r(Ae,mt=>typeof mt=="string"?`'${mt}'`:m(mt)),", ");throw new N(be,le,qe)}});function oe(le,be){if(typeof le!="boolean")throw new A(be,"boolean",le)}function T(le,be,Ae){return le==null||!h(le,be)?Ae:le[be]}const Q=b((le,be,Ae=null)=>{const ve=T(Ae,"allowArray",!1),qe=T(Ae,"allowFunction",!1);if(!T(Ae,"nullable",!1)&&le===null||!ve&&i(le)||typeof le!="object"&&(!qe||typeof le!="function"))throw new A(be,"Object",le)}),ie=b((le,be)=>{if(le!=null&&typeof le!="object"&&typeof le!="function")throw new A(be,"a dictionary",le)}),Y=b((le,be,Ae=0)=>{if(!i(le))throw new A(be,"Array",le);if(le.length<Ae){const ve=`must be longer than ${Ae}`;throw new N(be,le,ve)}});function me(le,be){Y(le,be);for(let Ae=0;Ae<le.length;Ae++)M(le[Ae],`${be}[${Ae}]`)}function Z(le,be){Y(le,be);for(let Ae=0;Ae<le.length;Ae++)oe(le[Ae],`${be}[${Ae}]`)}function W(le,be){Y(le,be);for(let Ae=0;Ae<le.length;Ae++){const ve=le[Ae],qe=`${be}[${Ae}]`;if(ve==null)throw new A(qe,"AbortSignal",ve);Ee(ve,qe)}}function ee(le,be="signal"){if(M(le,be),X[le]===void 0)throw X[d(le)]!==void 0?new w(le+" (signals must use all capital letters)"):new w(le)}const K=b((le,be="buffer")=>{if(!O(le))throw new A(be,["Buffer","TypedArray","DataView"],le)});function ue(le,be){const Ae=y(be),ve=le.length;if(Ae==="hex"&&ve%2!==0)throw new N("encoding",be,`is invalid for data of length ${ve}`)}function ce(le,be="Port",Ae=!0){if(typeof le!="number"&&typeof le!="string"||typeof le=="string"&&_(le).length===0||+le!==+le>>>0||le>65535||le===0&&!Ae)throw new I(be,le,Ae);return le|0}const Ee=b((le,be)=>{if(le!==void 0&&(le===null||typeof le!="object"||!("aborted"in le)))throw new A(be,"AbortSignal",le)}),Te=b((le,be)=>{if(typeof le!="function")throw new A(be,"Function",le)}),q=b((le,be)=>{if(typeof le!="function"||S(le))throw new A(be,"Function",le)}),te=b((le,be)=>{if(le!==void 0)throw new A(be,"undefined",le)});function fe(le,be,Ae){if(!e(Ae,le))throw new A(be,`('${n(Ae,"|")}')`,le)}const xe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Se(le,be){if(typeof le>"u"||!g(xe,le))throw new N(be,le,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Ie(le){if(typeof le=="string")return Se(le,"hints"),le;if(i(le)){const be=le.length;let Ae="";if(be===0)return Ae;for(let ve=0;ve<be;ve++){const qe=le[ve];Se(qe,"hints"),Ae+=qe,ve!==be-1&&(Ae+=", ")}return Ae}throw new N("hints",le,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return zo={isInt32:C,isUint32:U,parseFileMode:G,validateArray:Y,validateStringArray:me,validateBooleanArray:Z,validateAbortSignalArray:W,validateBoolean:oe,validateBuffer:K,validateDictionary:ie,validateEncoding:ue,validateFunction:Te,validateInt32:F,validateInteger:j,validateNumber:re,validateObject:Q,validateOneOf:B,validatePlainFunction:q,validatePort:ce,validateSignalName:ee,validateString:M,validateUint32:se,validateUndefined:te,validateUnion:fe,validateAbortSignal:Ee,validateLinkHeaderValue:Ie},zo}var xs={exports:{}},Ho={exports:{}},mc;function Ti(){if(mc)return Ho.exports;mc=1;var i=Ho.exports={},e,n;function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?n=clearTimeout:n=o}catch{n=o}})();function a(I){if(e===setTimeout)return setTimeout(I,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(I,0);try{return e(I,0)}catch{try{return e.call(null,I,0)}catch{return e.call(this,I,0)}}}function l(I){if(n===clearTimeout)return clearTimeout(I);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(I);try{return n(I)}catch{try{return n.call(null,I)}catch{return n.call(this,I)}}}var u=[],f=!1,h,g=-1;function m(){!f||!h||(f=!1,h.length?u=h.concat(u):g=-1,u.length&&d())}function d(){if(!f){var I=a(m);f=!0;for(var A=u.length;A;){for(h=u,u=[];++g<A;)h&&h[g].run();g=-1,A=u.length}h=null,f=!1,l(I)}}i.nextTick=function(I){var A=new Array(arguments.length-1);if(arguments.length>1)for(var N=1;N<arguments.length;N++)A[N-1]=arguments[N];u.push(new _(I,A)),u.length===1&&!f&&a(d)};function _(I,A){this.fun=I,this.array=A}_.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={};function b(){}return i.on=b,i.addListener=b,i.once=b,i.off=b,i.removeListener=b,i.removeAllListeners=b,i.emit=b,i.prependListener=b,i.prependOnceListener=b,i.listeners=function(I){return[]},i.binding=function(I){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(I){throw new Error("process.chdir is not supported")},i.umask=function(){return 0},Ho.exports}var Uo,_c;function Mn(){if(_c)return Uo;_c=1;const{SymbolAsyncIterator:i,SymbolIterator:e,SymbolFor:n}=ct(),r=n("nodejs.stream.destroyed"),o=n("nodejs.stream.errored"),a=n("nodejs.stream.readable"),l=n("nodejs.stream.writable"),u=n("nodejs.stream.disturbed"),f=n("nodejs.webstream.isClosedPromise"),h=n("nodejs.webstream.controllerErrorFunction");function g(T,Q=!1){var ie;return!!(T&&typeof T.pipe=="function"&&typeof T.on=="function"&&(!Q||typeof T.pause=="function"&&typeof T.resume=="function")&&(!T._writableState||((ie=T._readableState)===null||ie===void 0?void 0:ie.readable)!==!1)&&(!T._writableState||T._readableState))}function m(T){var Q;return!!(T&&typeof T.write=="function"&&typeof T.on=="function"&&(!T._readableState||((Q=T._writableState)===null||Q===void 0?void 0:Q.writable)!==!1))}function d(T){return!!(T&&typeof T.pipe=="function"&&T._readableState&&typeof T.on=="function"&&typeof T.write=="function")}function _(T){return T&&(T._readableState||T._writableState||typeof T.write=="function"&&typeof T.on=="function"||typeof T.pipe=="function"&&typeof T.on=="function")}function b(T){return!!(T&&!_(T)&&typeof T.pipeThrough=="function"&&typeof T.getReader=="function"&&typeof T.cancel=="function")}function I(T){return!!(T&&!_(T)&&typeof T.getWriter=="function"&&typeof T.abort=="function")}function A(T){return!!(T&&!_(T)&&typeof T.readable=="object"&&typeof T.writable=="object")}function N(T){return b(T)||I(T)||A(T)}function P(T,Q){return T==null?!1:Q===!0?typeof T[i]=="function":Q===!1?typeof T[e]=="function":typeof T[i]=="function"||typeof T[e]=="function"}function w(T){if(!_(T))return null;const Q=T._writableState,ie=T._readableState,Y=Q||ie;return!!(T.destroyed||T[r]||Y!=null&&Y.destroyed)}function y(T){if(!m(T))return null;if(T.writableEnded===!0)return!0;const Q=T._writableState;return Q!=null&&Q.errored?!1:typeof Q?.ended!="boolean"?null:Q.ended}function S(T,Q){if(!m(T))return null;if(T.writableFinished===!0)return!0;const ie=T._writableState;return ie!=null&&ie.errored?!1:typeof ie?.finished!="boolean"?null:!!(ie.finished||Q===!1&&ie.ended===!0&&ie.length===0)}function O(T){if(!g(T))return null;if(T.readableEnded===!0)return!0;const Q=T._readableState;return!Q||Q.errored?!1:typeof Q?.ended!="boolean"?null:Q.ended}function X(T,Q){if(!g(T))return null;const ie=T._readableState;return ie!=null&&ie.errored?!1:typeof ie?.endEmitted!="boolean"?null:!!(ie.endEmitted||Q===!1&&ie.ended===!0&&ie.length===0)}function C(T){return T&&T[a]!=null?T[a]:typeof T?.readable!="boolean"?null:w(T)?!1:g(T)&&T.readable&&!X(T)}function U(T){return T&&T[l]!=null?T[l]:typeof T?.writable!="boolean"?null:w(T)?!1:m(T)&&T.writable&&!y(T)}function R(T,Q){return _(T)?w(T)?!0:!(Q?.readable!==!1&&C(T)||Q?.writable!==!1&&U(T)):null}function $(T){var Q,ie;return _(T)?T.writableErrored?T.writableErrored:(Q=(ie=T._writableState)===null||ie===void 0?void 0:ie.errored)!==null&&Q!==void 0?Q:null:null}function G(T){var Q,ie;return _(T)?T.readableErrored?T.readableErrored:(Q=(ie=T._readableState)===null||ie===void 0?void 0:ie.errored)!==null&&Q!==void 0?Q:null:null}function j(T){if(!_(T))return null;if(typeof T.closed=="boolean")return T.closed;const Q=T._writableState,ie=T._readableState;return typeof Q?.closed=="boolean"||typeof ie?.closed=="boolean"?Q?.closed||ie?.closed:typeof T._closed=="boolean"&&F(T)?T._closed:null}function F(T){return typeof T._closed=="boolean"&&typeof T._defaultKeepAlive=="boolean"&&typeof T._removedConnection=="boolean"&&typeof T._removedContLen=="boolean"}function se(T){return typeof T._sent100=="boolean"&&F(T)}function M(T){var Q;return typeof T._consuming=="boolean"&&typeof T._dumped=="boolean"&&((Q=T.req)===null||Q===void 0?void 0:Q.upgradeOrConnect)===void 0}function re(T){if(!_(T))return null;const Q=T._writableState,ie=T._readableState,Y=Q||ie;return!Y&&se(T)||!!(Y&&Y.autoDestroy&&Y.emitClose&&Y.closed===!1)}function B(T){var Q;return!!(T&&((Q=T[u])!==null&&Q!==void 0?Q:T.readableDidRead||T.readableAborted))}function oe(T){var Q,ie,Y,me,Z,W,ee,K,ue,ce;return!!(T&&((Q=(ie=(Y=(me=(Z=(W=T[o])!==null&&W!==void 0?W:T.readableErrored)!==null&&Z!==void 0?Z:T.writableErrored)!==null&&me!==void 0?me:(ee=T._readableState)===null||ee===void 0?void 0:ee.errorEmitted)!==null&&Y!==void 0?Y:(K=T._writableState)===null||K===void 0?void 0:K.errorEmitted)!==null&&ie!==void 0?ie:(ue=T._readableState)===null||ue===void 0?void 0:ue.errored)!==null&&Q!==void 0?Q:!((ce=T._writableState)===null||ce===void 0)&&ce.errored))}return Uo={isDestroyed:w,kIsDestroyed:r,isDisturbed:B,kIsDisturbed:u,isErrored:oe,kIsErrored:o,isReadable:C,kIsReadable:a,kIsClosedPromise:f,kControllerErrorFunction:h,kIsWritable:l,isClosed:j,isDuplexNodeStream:d,isFinished:R,isIterable:P,isReadableNodeStream:g,isReadableStream:b,isReadableEnded:O,isReadableFinished:X,isReadableErrored:G,isNodeStream:_,isWebStream:N,isWritable:U,isWritableNodeStream:m,isWritableStream:I,isWritableEnded:y,isWritableFinished:S,isWritableErrored:$,isServerRequest:M,isServerResponse:se,willEmitClose:re,isTransformStream:A},Uo}var yc;function Qn(){if(yc)return xs.exports;yc=1;const i=Ti(),{AbortError:e,codes:n}=kt(),{ERR_INVALID_ARG_TYPE:r,ERR_STREAM_PREMATURE_CLOSE:o}=n,{kEmptyObject:a,once:l}=jt(),{validateAbortSignal:u,validateFunction:f,validateObject:h,validateBoolean:g}=Xr(),{Promise:m,PromisePrototypeThen:d,SymbolDispose:_}=ct(),{isClosed:b,isReadable:I,isReadableNodeStream:A,isReadableStream:N,isReadableFinished:P,isReadableErrored:w,isWritable:y,isWritableNodeStream:S,isWritableStream:O,isWritableFinished:X,isWritableErrored:C,isNodeStream:U,willEmitClose:R,kIsClosedPromise:$}=Mn();let G;function j(B){return B.setHeader&&typeof B.abort=="function"}const F=()=>{};function se(B,oe,T){var Q,ie;if(arguments.length===2?(T=oe,oe=a):oe==null?oe=a:h(oe,"options"),f(T,"callback"),u(oe.signal,"options.signal"),T=l(T),N(B)||O(B))return M(B,oe,T);if(!U(B))throw new r("stream",["ReadableStream","WritableStream","Stream"],B);const Y=(Q=oe.readable)!==null&&Q!==void 0?Q:A(B),me=(ie=oe.writable)!==null&&ie!==void 0?ie:S(B),Z=B._writableState,W=B._readableState,ee=()=>{B.writable||ce()};let K=R(B)&&A(B)===Y&&S(B)===me,ue=X(B,!1);const ce=()=>{ue=!0,B.destroyed&&(K=!1),!(K&&(!B.readable||Y))&&(!Y||Ee)&&T.call(B)};let Ee=P(B,!1);const Te=()=>{Ee=!0,B.destroyed&&(K=!1),!(K&&(!B.writable||me))&&(!me||ue)&&T.call(B)},q=le=>{T.call(B,le)};let te=b(B);const fe=()=>{te=!0;const le=C(B)||w(B);if(le&&typeof le!="boolean")return T.call(B,le);if(Y&&!Ee&&A(B,!0)&&!P(B,!1))return T.call(B,new o);if(me&&!ue&&!X(B,!1))return T.call(B,new o);T.call(B)},xe=()=>{te=!0;const le=C(B)||w(B);if(le&&typeof le!="boolean")return T.call(B,le);T.call(B)},Se=()=>{B.req.on("finish",ce)};j(B)?(B.on("complete",ce),K||B.on("abort",fe),B.req?Se():B.on("request",Se)):me&&!Z&&(B.on("end",ee),B.on("close",ee)),!K&&typeof B.aborted=="boolean"&&B.on("aborted",fe),B.on("end",Te),B.on("finish",ce),oe.error!==!1&&B.on("error",q),B.on("close",fe),te?i.nextTick(fe):Z!=null&&Z.errorEmitted||W!=null&&W.errorEmitted?K||i.nextTick(xe):(!Y&&(!K||I(B))&&(ue||y(B)===!1)||!me&&(!K||y(B))&&(Ee||I(B)===!1)||W&&B.req&&B.aborted)&&i.nextTick(xe);const Ie=()=>{T=F,B.removeListener("aborted",fe),B.removeListener("complete",ce),B.removeListener("abort",fe),B.removeListener("request",Se),B.req&&B.req.removeListener("finish",ce),B.removeListener("end",ee),B.removeListener("close",ee),B.removeListener("finish",ce),B.removeListener("end",Te),B.removeListener("error",q),B.removeListener("close",fe)};if(oe.signal&&!te){const le=()=>{const be=T;Ie(),be.call(B,new e(void 0,{cause:oe.signal.reason}))};if(oe.signal.aborted)i.nextTick(le);else{G=G||jt().addAbortListener;const be=G(oe.signal,le),Ae=T;T=l((...ve)=>{be[_](),Ae.apply(B,ve)})}}return Ie}function M(B,oe,T){let Q=!1,ie=F;if(oe.signal)if(ie=()=>{Q=!0,T.call(B,new e(void 0,{cause:oe.signal.reason}))},oe.signal.aborted)i.nextTick(ie);else{G=G||jt().addAbortListener;const me=G(oe.signal,ie),Z=T;T=l((...W)=>{me[_](),Z.apply(B,W)})}const Y=(...me)=>{Q||i.nextTick(()=>T.apply(B,me))};return d(B[$].promise,Y,Y),F}function re(B,oe){var T;let Q=!1;return oe===null&&(oe=a),(T=oe)!==null&&T!==void 0&&T.cleanup&&(g(oe.cleanup,"cleanup"),Q=oe.cleanup),new m((ie,Y)=>{const me=se(B,oe,Z=>{Q&&me(),Z?Y(Z):ie()})})}return xs.exports=se,xs.exports.finished=re,xs.exports}var Vo,vc;function Ki(){if(vc)return Vo;vc=1;const i=Ti(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:n},AbortError:r}=kt(),{Symbol:o}=ct(),{kIsDestroyed:a,isDestroyed:l,isFinished:u,isServerRequest:f}=Mn(),h=o("kDestroy"),g=o("kConstruct");function m(R,$,G){R&&(R.stack,$&&!$.errored&&($.errored=R),G&&!G.errored&&(G.errored=R))}function d(R,$){const G=this._readableState,j=this._writableState,F=j||G;return j!=null&&j.destroyed||G!=null&&G.destroyed?(typeof $=="function"&&$(),this):(m(R,j,G),j&&(j.destroyed=!0),G&&(G.destroyed=!0),F.constructed?_(this,R,$):this.once(h,function(se){_(this,e(se,R),$)}),this)}function _(R,$,G){let j=!1;function F(se){if(j)return;j=!0;const M=R._readableState,re=R._writableState;m(se,re,M),re&&(re.closed=!0),M&&(M.closed=!0),typeof G=="function"&&G(se),se?i.nextTick(b,R,se):i.nextTick(I,R)}try{R._destroy($||null,F)}catch(se){F(se)}}function b(R,$){A(R,$),I(R)}function I(R){const $=R._readableState,G=R._writableState;G&&(G.closeEmitted=!0),$&&($.closeEmitted=!0),(G!=null&&G.emitClose||$!=null&&$.emitClose)&&R.emit("close")}function A(R,$){const G=R._readableState,j=R._writableState;j!=null&&j.errorEmitted||G!=null&&G.errorEmitted||(j&&(j.errorEmitted=!0),G&&(G.errorEmitted=!0),R.emit("error",$))}function N(){const R=this._readableState,$=this._writableState;R&&(R.constructed=!0,R.closed=!1,R.closeEmitted=!1,R.destroyed=!1,R.errored=null,R.errorEmitted=!1,R.reading=!1,R.ended=R.readable===!1,R.endEmitted=R.readable===!1),$&&($.constructed=!0,$.destroyed=!1,$.closed=!1,$.closeEmitted=!1,$.errored=null,$.errorEmitted=!1,$.finalCalled=!1,$.prefinished=!1,$.ended=$.writable===!1,$.ending=$.writable===!1,$.finished=$.writable===!1)}function P(R,$,G){const j=R._readableState,F=R._writableState;if(F!=null&&F.destroyed||j!=null&&j.destroyed)return this;j!=null&&j.autoDestroy||F!=null&&F.autoDestroy?R.destroy($):$&&($.stack,F&&!F.errored&&(F.errored=$),j&&!j.errored&&(j.errored=$),G?i.nextTick(A,R,$):A(R,$))}function w(R,$){if(typeof R._construct!="function")return;const G=R._readableState,j=R._writableState;G&&(G.constructed=!1),j&&(j.constructed=!1),R.once(g,$),!(R.listenerCount(g)>1)&&i.nextTick(y,R)}function y(R){let $=!1;function G(j){if($){P(R,j??new n);return}$=!0;const F=R._readableState,se=R._writableState,M=se||F;F&&(F.constructed=!0),se&&(se.constructed=!0),M.destroyed?R.emit(h,j):j?P(R,j,!0):i.nextTick(S,R)}try{R._construct(j=>{i.nextTick(G,j)})}catch(j){i.nextTick(G,j)}}function S(R){R.emit(g)}function O(R){return R?.setHeader&&typeof R.abort=="function"}function X(R){R.emit("close")}function C(R,$){R.emit("error",$),i.nextTick(X,R)}function U(R,$){!R||l(R)||(!$&&!u(R)&&($=new r),f(R)?(R.socket=null,R.destroy($)):O(R)?R.abort():O(R.req)?R.req.abort():typeof R.destroy=="function"?R.destroy($):typeof R.close=="function"?R.close():$?i.nextTick(C,R,$):i.nextTick(X,R),R.destroyed||(R[a]=!0))}return Vo={construct:w,destroyer:U,destroy:d,undestroy:N,errorOrDestroy:P},Vo}var Wo,bc;function Dl(){if(bc)return Wo;bc=1;const{ArrayIsArray:i,ObjectSetPrototypeOf:e}=ct(),{EventEmitter:n}=Gs();function r(a){n.call(this,a)}e(r.prototype,n.prototype),e(r,n),r.prototype.pipe=function(a,l){const u=this;function f(I){a.writable&&a.write(I)===!1&&u.pause&&u.pause()}u.on("data",f);function h(){u.readable&&u.resume&&u.resume()}a.on("drain",h),!a._isStdio&&(!l||l.end!==!1)&&(u.on("end",m),u.on("close",d));let g=!1;function m(){g||(g=!0,a.end())}function d(){g||(g=!0,typeof a.destroy=="function"&&a.destroy())}function _(I){b(),n.listenerCount(this,"error")===0&&this.emit("error",I)}o(u,"error",_),o(a,"error",_);function b(){u.removeListener("data",f),a.removeListener("drain",h),u.removeListener("end",m),u.removeListener("close",d),u.removeListener("error",_),a.removeListener("error",_),u.removeListener("end",b),u.removeListener("close",b),a.removeListener("close",b)}return u.on("end",b),u.on("close",b),a.on("close",b),a.emit("pipe",u),a};function o(a,l,u){if(typeof a.prependListener=="function")return a.prependListener(l,u);!a._events||!a._events[l]?a.on(l,u):i(a._events[l])?a._events[l].unshift(u):a._events[l]=[u,a._events[l]]}return Wo={Stream:r,prependListener:o},Wo}var Go={exports:{}},wc;function Zs(){return wc||(wc=1,(function(i){const{SymbolDispose:e}=ct(),{AbortError:n,codes:r}=kt(),{isNodeStream:o,isWebStream:a,kControllerErrorFunction:l}=Mn(),u=Qn(),{ERR_INVALID_ARG_TYPE:f}=r;let h;const g=(m,d)=>{if(typeof m!="object"||!("aborted"in m))throw new f(d,"AbortSignal",m)};i.exports.addAbortSignal=function(d,_){if(g(d,"signal"),!o(_)&&!a(_))throw new f("stream",["ReadableStream","WritableStream","Stream"],_);return i.exports.addAbortSignalNoValidate(d,_)},i.exports.addAbortSignalNoValidate=function(m,d){if(typeof m!="object"||!("aborted"in m))return d;const _=o(d)?()=>{d.destroy(new n(void 0,{cause:m.reason}))}:()=>{d[l](new n(void 0,{cause:m.reason}))};if(m.aborted)_();else{h=h||jt().addAbortListener;const b=h(m,_);u(d,b[e])}return d}})(Go)),Go.exports}var Zo,xc;function Hg(){if(xc)return Zo;xc=1;const{StringPrototypeSlice:i,SymbolIterator:e,TypedArrayPrototypeSet:n,Uint8Array:r}=ct(),{Buffer:o}=Dn(),{inspect:a}=jt();return Zo=class{constructor(){this.head=null,this.tail=null,this.length=0}push(u){const f={data:u,next:null};this.length>0?this.tail.next=f:this.head=f,this.tail=f,++this.length}unshift(u){const f={data:u,next:this.head};this.length===0&&(this.tail=f),this.head=f,++this.length}shift(){if(this.length===0)return;const u=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,u}clear(){this.head=this.tail=null,this.length=0}join(u){if(this.length===0)return"";let f=this.head,h=""+f.data;for(;(f=f.next)!==null;)h+=u+f.data;return h}concat(u){if(this.length===0)return o.alloc(0);const f=o.allocUnsafe(u>>>0);let h=this.head,g=0;for(;h;)n(f,h.data,g),g+=h.data.length,h=h.next;return f}consume(u,f){const h=this.head.data;if(u<h.length){const g=h.slice(0,u);return this.head.data=h.slice(u),g}return u===h.length?this.shift():f?this._getString(u):this._getBuffer(u)}first(){return this.head.data}*[e](){for(let u=this.head;u;u=u.next)yield u.data}_getString(u){let f="",h=this.head,g=0;do{const m=h.data;if(u>m.length)f+=m,u-=m.length;else{u===m.length?(f+=m,++g,h.next?this.head=h.next:this.head=this.tail=null):(f+=i(m,0,u),this.head=h,h.data=i(m,u));break}++g}while((h=h.next)!==null);return this.length-=g,f}_getBuffer(u){const f=o.allocUnsafe(u),h=u;let g=this.head,m=0;do{const d=g.data;if(u>d.length)n(f,d,h-u),u-=d.length;else{u===d.length?(n(f,d,h-u),++m,g.next?this.head=g.next:this.head=this.tail=null):(n(f,new r(d.buffer,d.byteOffset,u),h-u),this.head=g,g.data=d.slice(u));break}++m}while((g=g.next)!==null);return this.length-=m,f}[Symbol.for("nodejs.util.inspect.custom")](u,f){return a(this,{...f,depth:0,customInspect:!1})}},Zo}var Xo,Ec;function Xs(){if(Ec)return Xo;Ec=1;const{MathFloor:i,NumberIsInteger:e}=ct(),{validateInteger:n}=Xr(),{ERR_INVALID_ARG_VALUE:r}=kt().codes;let o=16*1024,a=16;function l(g,m,d){return g.highWaterMark!=null?g.highWaterMark:m?g[d]:null}function u(g){return g?a:o}function f(g,m){n(m,"value",0),g?a=m:o=m}function h(g,m,d,_){const b=l(m,_,d);if(b!=null){if(!e(b)||b<0){const I=_?`options.${d}`:"options.highWaterMark";throw new r(I,b)}return i(b)}return u(g.objectMode)}return Xo={getHighWaterMark:h,getDefaultHighWaterMark:u,setDefaultHighWaterMark:f},Xo}var Qo={},Es={exports:{}};var Sc;function Ug(){return Sc||(Sc=1,(function(i,e){var n=Dn(),r=n.Buffer;function o(l,u){for(var f in l)u[f]=l[f]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?i.exports=n:(o(n,e),e.Buffer=a);function a(l,u,f){return r(l,u,f)}a.prototype=Object.create(r.prototype),o(r,a),a.from=function(l,u,f){if(typeof l=="number")throw new TypeError("Argument must not be a number");return r(l,u,f)},a.alloc=function(l,u,f){if(typeof l!="number")throw new TypeError("Argument must be a number");var h=r(l);return u!==void 0?typeof f=="string"?h.fill(u,f):h.fill(u):h.fill(0),h},a.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r(l)},a.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(l)}})(Es,Es.exports)),Es.exports}var Tc;function Vg(){if(Tc)return Qo;Tc=1;var i=Ug().Buffer,e=i.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(N){if(!N)return"utf8";for(var P;;)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(P)return;N=(""+N).toLowerCase(),P=!0}}function r(N){var P=n(N);if(typeof P!="string"&&(i.isEncoding===e||!e(N)))throw new Error("Unknown encoding: "+N);return P||N}Qo.StringDecoder=o;function o(N){this.encoding=r(N);var P;switch(this.encoding){case"utf16le":this.text=m,this.end=d,P=4;break;case"utf8":this.fillLast=f,P=4;break;case"base64":this.text=_,this.end=b,P=3;break;default:this.write=I,this.end=A;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(P)}o.prototype.write=function(N){if(N.length===0)return"";var P,w;if(this.lastNeed){if(P=this.fillLast(N),P===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<N.length?P?P+this.text(N,w):this.text(N,w):P||""},o.prototype.end=g,o.prototype.text=h,o.prototype.fillLast=function(N){if(this.lastNeed<=N.length)return N.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,this.lastTotal-this.lastNeed,0,N.length),this.lastNeed-=N.length};function a(N){return N<=127?0:N>>5===6?2:N>>4===14?3:N>>3===30?4:N>>6===2?-1:-2}function l(N,P,w){var y=P.length-1;if(y<w)return 0;var S=a(P[y]);return S>=0?(S>0&&(N.lastNeed=S-1),S):--y<w||S===-2?0:(S=a(P[y]),S>=0?(S>0&&(N.lastNeed=S-2),S):--y<w||S===-2?0:(S=a(P[y]),S>=0?(S>0&&(S===2?S=0:N.lastNeed=S-3),S):0))}function u(N,P,w){if((P[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&P.length>1){if((P[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&P.length>2&&(P[2]&192)!==128)return N.lastNeed=2,"�"}}function f(N){var P=this.lastTotal-this.lastNeed,w=u(this,N);if(w!==void 0)return w;if(this.lastNeed<=N.length)return N.copy(this.lastChar,P,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,P,0,N.length),this.lastNeed-=N.length}function h(N,P){var w=l(this,N,P);if(!this.lastNeed)return N.toString("utf8",P);this.lastTotal=w;var y=N.length-(w-this.lastNeed);return N.copy(this.lastChar,0,y),N.toString("utf8",P,y)}function g(N){var P=N&&N.length?this.write(N):"";return this.lastNeed?P+"�":P}function m(N,P){if((N.length-P)%2===0){var w=N.toString("utf16le",P);if(w){var y=w.charCodeAt(w.length-1);if(y>=55296&&y<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",P,N.length-1)}function d(N){var P=N&&N.length?this.write(N):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return P+this.lastChar.toString("utf16le",0,w)}return P}function _(N,P){var w=(N.length-P)%3;return w===0?N.toString("base64",P):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=N[N.length-1]:(this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1]),N.toString("base64",P,N.length-w))}function b(N){var P=N&&N.length?this.write(N):"";return this.lastNeed?P+this.lastChar.toString("base64",0,3-this.lastNeed):P}function I(N){return N.toString(this.encoding)}function A(N){return N&&N.length?this.write(N):""}return Qo}var Jo,Lc;function gf(){if(Lc)return Jo;Lc=1;const i=Ti(),{PromisePrototypeThen:e,SymbolAsyncIterator:n,SymbolIterator:r}=ct(),{Buffer:o}=Dn(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_NULL_VALUES:l}=kt().codes;function u(f,h,g){let m;if(typeof h=="string"||h instanceof o)return new f({objectMode:!0,...g,read(){this.push(h),this.push(null)}});let d;if(h&&h[n])d=!0,m=h[n]();else if(h&&h[r])d=!1,m=h[r]();else throw new a("iterable",["Iterable"],h);const _=new f({objectMode:!0,highWaterMark:1,...g});let b=!1;_._read=function(){b||(b=!0,A())},_._destroy=function(N,P){e(I(N),()=>i.nextTick(P,N),w=>i.nextTick(P,w||N))};async function I(N){const P=N!=null,w=typeof m.throw=="function";if(P&&w){const{value:y,done:S}=await m.throw(N);if(await y,S)return}if(typeof m.return=="function"){const{value:y}=await m.return();await y}}async function A(){for(;;){try{const{value:N,done:P}=d?await m.next():m.next();if(P)_.push(null);else{const w=N&&typeof N.then=="function"?await N:N;if(w===null)throw b=!1,new l;if(_.push(w))continue;b=!1}}catch(N){_.destroy(N)}break}}return _}return Jo=u,Jo}var Ko,Ic;function Qs(){if(Ic)return Ko;Ic=1;const i=Ti(),{ArrayPrototypeIndexOf:e,NumberIsInteger:n,NumberIsNaN:r,NumberParseInt:o,ObjectDefineProperties:a,ObjectKeys:l,ObjectSetPrototypeOf:u,Promise:f,SafeSet:h,SymbolAsyncDispose:g,SymbolAsyncIterator:m,Symbol:d}=ct();Ko=ve,ve.ReadableState=Ae;const{EventEmitter:_}=Gs(),{Stream:b,prependListener:I}=Dl(),{Buffer:A}=Dn(),{addAbortSignal:N}=Zs(),P=Qn();let w=jt().debuglog("stream",z=>{w=z});const y=Hg(),S=Ki(),{getHighWaterMark:O,getDefaultHighWaterMark:X}=Xs(),{aggregateTwoErrors:C,codes:{ERR_INVALID_ARG_TYPE:U,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:$,ERR_STREAM_PUSH_AFTER_EOF:G,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:j},AbortError:F}=kt(),{validateObject:se}=Xr(),M=d("kPaused"),{StringDecoder:re}=Vg(),B=gf();u(ve.prototype,b.prototype),u(ve,b);const oe=()=>{},{errorOrDestroy:T}=S,Q=1,ie=2,Y=4,me=8,Z=16,W=32,ee=64,K=128,ue=256,ce=512,Ee=1024,Te=2048,q=4096,te=8192,fe=16384,xe=32768,Se=65536,Ie=1<<17,le=1<<18;function be(z){return{enumerable:!1,get(){return(this.state&z)!==0},set(J){J?this.state|=z:this.state&=~z}}}a(Ae.prototype,{objectMode:be(Q),ended:be(ie),endEmitted:be(Y),reading:be(me),constructed:be(Z),sync:be(W),needReadable:be(ee),emittedReadable:be(K),readableListening:be(ue),resumeScheduled:be(ce),errorEmitted:be(Ee),emitClose:be(Te),autoDestroy:be(q),destroyed:be(te),closed:be(fe),closeEmitted:be(xe),multiAwaitDrain:be(Se),readingMore:be(Ie),dataEmitted:be(le)});function Ae(z,J,Ne){typeof Ne!="boolean"&&(Ne=J instanceof Pn()),this.state=Te|q|Z|W,z&&z.objectMode&&(this.state|=Q),Ne&&z&&z.readableObjectMode&&(this.state|=Q),this.highWaterMark=z?O(this,z,"readableHighWaterMark",Ne):X(!1),this.buffer=new y,this.length=0,this.pipes=[],this.flowing=null,this[M]=null,z&&z.emitClose===!1&&(this.state&=~Te),z&&z.autoDestroy===!1&&(this.state&=~q),this.errored=null,this.defaultEncoding=z&&z.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,z&&z.encoding&&(this.decoder=new re(z.encoding),this.encoding=z.encoding)}function ve(z){if(!(this instanceof ve))return new ve(z);const J=this instanceof Pn();this._readableState=new Ae(z,this,J),z&&(typeof z.read=="function"&&(this._read=z.read),typeof z.destroy=="function"&&(this._destroy=z.destroy),typeof z.construct=="function"&&(this._construct=z.construct),z.signal&&!J&&N(z.signal,this)),b.call(this,z),S.construct(this,()=>{this._readableState.needReadable&&ae(this,this._readableState)})}ve.prototype.destroy=S.destroy,ve.prototype._undestroy=S.undestroy,ve.prototype._destroy=function(z,J){J(z)},ve.prototype[_.captureRejectionSymbol]=function(z){this.destroy(z)},ve.prototype[g]=function(){let z;return this.destroyed||(z=this.readableEnded?null:new F,this.destroy(z)),new f((J,Ne)=>P(this,Re=>Re&&Re!==z?Ne(Re):J(null)))},ve.prototype.push=function(z,J){return qe(this,z,J,!1)},ve.prototype.unshift=function(z,J){return qe(this,z,J,!0)};function qe(z,J,Ne,Re){w("readableAddChunk",J);const De=z._readableState;let _t;if((De.state&Q)===0&&(typeof J=="string"?(Ne=Ne||De.defaultEncoding,De.encoding!==Ne&&(Re&&De.encoding?J=A.from(J,Ne).toString(De.encoding):(J=A.from(J,Ne),Ne=""))):J instanceof A?Ne="":b._isUint8Array(J)?(J=b._uint8ArrayToBuffer(J),Ne=""):J!=null&&(_t=new U("chunk",["string","Buffer","Uint8Array"],J))),_t)T(z,_t);else if(J===null)De.state&=~me,v(z,De);else if((De.state&Q)!==0||J&&J.length>0)if(Re)if((De.state&Y)!==0)T(z,new j);else{if(De.destroyed||De.errored)return!1;mt(z,De,J,!0)}else if(De.ended)T(z,new G);else{if(De.destroyed||De.errored)return!1;De.state&=~me,De.decoder&&!Ne?(J=De.decoder.write(J),De.objectMode||J.length!==0?mt(z,De,J,!1):ae(z,De)):mt(z,De,J,!1)}else Re||(De.state&=~me,ae(z,De));return!De.ended&&(De.length<De.highWaterMark||De.length===0)}function mt(z,J,Ne,Re){J.flowing&&J.length===0&&!J.sync&&z.listenerCount("data")>0?((J.state&Se)!==0?J.awaitDrainWriters.clear():J.awaitDrainWriters=null,J.dataEmitted=!0,z.emit("data",Ne)):(J.length+=J.objectMode?1:Ne.length,Re?J.buffer.unshift(Ne):J.buffer.push(Ne),(J.state&ee)!==0&&x(z)),ae(z,J)}ve.prototype.isPaused=function(){const z=this._readableState;return z[M]===!0||z.flowing===!1},ve.prototype.setEncoding=function(z){const J=new re(z);this._readableState.decoder=J,this._readableState.encoding=this._readableState.decoder.encoding;const Ne=this._readableState.buffer;let Re="";for(const De of Ne)Re+=J.write(De);return Ne.clear(),Re!==""&&Ne.push(Re),this._readableState.length=Re.length,this};const $e=1073741824;function ft(z){if(z>$e)throw new $("size","<= 1GiB",z);return z--,z|=z>>>1,z|=z>>>2,z|=z>>>4,z|=z>>>8,z|=z>>>16,z++,z}function k(z,J){return z<=0||J.length===0&&J.ended?0:(J.state&Q)!==0?1:r(z)?J.flowing&&J.length?J.buffer.first().length:J.length:z<=J.length?z:J.ended?J.length:0}ve.prototype.read=function(z){w("read",z),z===void 0?z=NaN:n(z)||(z=o(z,10));const J=this._readableState,Ne=z;if(z>J.highWaterMark&&(J.highWaterMark=ft(z)),z!==0&&(J.state&=~K),z===0&&J.needReadable&&((J.highWaterMark!==0?J.length>=J.highWaterMark:J.length>0)||J.ended))return w("read: emitReadable",J.length,J.ended),J.length===0&&J.ended?at(this):x(this),null;if(z=k(z,J),z===0&&J.ended)return J.length===0&&at(this),null;let Re=(J.state&ee)!==0;if(w("need readable",Re),(J.length===0||J.length-z<J.highWaterMark)&&(Re=!0,w("length less than watermark",Re)),J.ended||J.reading||J.destroyed||J.errored||!J.constructed)Re=!1,w("reading, ended or constructing",Re);else if(Re){w("do read"),J.state|=me|W,J.length===0&&(J.state|=ee);try{this._read(J.highWaterMark)}catch(_t){T(this,_t)}J.state&=~W,J.reading||(z=k(Ne,J))}let De;return z>0?De=st(z,J):De=null,De===null?(J.needReadable=J.length<=J.highWaterMark,z=0):(J.length-=z,J.multiAwaitDrain?J.awaitDrainWriters.clear():J.awaitDrainWriters=null),J.length===0&&(J.ended||(J.needReadable=!0),Ne!==z&&J.ended&&at(this)),De!==null&&!J.errorEmitted&&!J.closeEmitted&&(J.dataEmitted=!0,this.emit("data",De)),De};function v(z,J){if(w("onEofChunk"),!J.ended){if(J.decoder){const Ne=J.decoder.end();Ne&&Ne.length&&(J.buffer.push(Ne),J.length+=J.objectMode?1:Ne.length)}J.ended=!0,J.sync?x(z):(J.needReadable=!1,J.emittedReadable=!0,H(z))}}function x(z){const J=z._readableState;w("emitReadable",J.needReadable,J.emittedReadable),J.needReadable=!1,J.emittedReadable||(w("emitReadable",J.flowing),J.emittedReadable=!0,i.nextTick(H,z))}function H(z){const J=z._readableState;w("emitReadable_",J.destroyed,J.length,J.ended),!J.destroyed&&!J.errored&&(J.length||J.ended)&&(z.emit("readable"),J.emittedReadable=!1),J.needReadable=!J.flowing&&!J.ended&&J.length<=J.highWaterMark,Ze(z)}function ae(z,J){!J.readingMore&&J.constructed&&(J.readingMore=!0,i.nextTick(_e,z,J))}function _e(z,J){for(;!J.reading&&!J.ended&&(J.length<J.highWaterMark||J.flowing&&J.length===0);){const Ne=J.length;if(w("maybeReadMore read 0"),z.read(0),Ne===J.length)break}J.readingMore=!1}ve.prototype._read=function(z){throw new R("_read()")},ve.prototype.pipe=function(z,J){const Ne=this,Re=this._readableState;Re.pipes.length===1&&(Re.multiAwaitDrain||(Re.multiAwaitDrain=!0,Re.awaitDrainWriters=new h(Re.awaitDrainWriters?[Re.awaitDrainWriters]:[]))),Re.pipes.push(z),w("pipe count=%d opts=%j",Re.pipes.length,J);const _t=(!J||J.end!==!1)&&z!==i.stdout&&z!==i.stderr?At:V;Re.endEmitted?i.nextTick(_t):Ne.once("end",_t),z.on("unpipe",wt);function wt(de,pe){w("onunpipe"),de===Ne&&pe&&pe.hasUnpiped===!1&&(pe.hasUnpiped=!0,Wt())}function At(){w("onend"),z.end()}let ke,ti=!1;function Wt(){w("cleanup"),z.removeListener("close",Bn),z.removeListener("finish",it),ke&&z.removeListener("drain",ke),z.removeListener("error",fn),z.removeListener("unpipe",wt),Ne.removeListener("end",At),Ne.removeListener("end",V),Ne.removeListener("data",En),ti=!0,ke&&Re.awaitDrainWriters&&(!z._writableState||z._writableState.needDrain)&&ke()}function jn(){ti||(Re.pipes.length===1&&Re.pipes[0]===z?(w("false write response, pause",0),Re.awaitDrainWriters=z,Re.multiAwaitDrain=!1):Re.pipes.length>1&&Re.pipes.includes(z)&&(w("false write response, pause",Re.awaitDrainWriters.size),Re.awaitDrainWriters.add(z)),Ne.pause()),ke||(ke=we(Ne,z),z.on("drain",ke))}Ne.on("data",En);function En(de){w("ondata");const pe=z.write(de);w("dest.write",pe),pe===!1&&jn()}function fn(de){if(w("onerror",de),V(),z.removeListener("error",fn),z.listenerCount("error")===0){const pe=z._writableState||z._readableState;pe&&!pe.errorEmitted?T(z,de):z.emit("error",de)}}I(z,"error",fn);function Bn(){z.removeListener("finish",it),V()}z.once("close",Bn);function it(){w("onfinish"),z.removeListener("close",Bn),V()}z.once("finish",it);function V(){w("unpipe"),Ne.unpipe(z)}return z.emit("pipe",Ne),z.writableNeedDrain===!0?jn():Re.flowing||(w("pipe resume"),Ne.resume()),z};function we(z,J){return function(){const Re=z._readableState;Re.awaitDrainWriters===J?(w("pipeOnDrain",1),Re.awaitDrainWriters=null):Re.multiAwaitDrain&&(w("pipeOnDrain",Re.awaitDrainWriters.size),Re.awaitDrainWriters.delete(J)),(!Re.awaitDrainWriters||Re.awaitDrainWriters.size===0)&&z.listenerCount("data")&&z.resume()}}ve.prototype.unpipe=function(z){const J=this._readableState,Ne={hasUnpiped:!1};if(J.pipes.length===0)return this;if(!z){const De=J.pipes;J.pipes=[],this.pause();for(let _t=0;_t<De.length;_t++)De[_t].emit("unpipe",this,{hasUnpiped:!1});return this}const Re=e(J.pipes,z);return Re===-1?this:(J.pipes.splice(Re,1),J.pipes.length===0&&this.pause(),z.emit("unpipe",this,Ne),this)},ve.prototype.on=function(z,J){const Ne=b.prototype.on.call(this,z,J),Re=this._readableState;return z==="data"?(Re.readableListening=this.listenerCount("readable")>0,Re.flowing!==!1&&this.resume()):z==="readable"&&!Re.endEmitted&&!Re.readableListening&&(Re.readableListening=Re.needReadable=!0,Re.flowing=!1,Re.emittedReadable=!1,w("on readable",Re.length,Re.reading),Re.length?x(this):Re.reading||i.nextTick(Ye,this)),Ne},ve.prototype.addListener=ve.prototype.on,ve.prototype.removeListener=function(z,J){const Ne=b.prototype.removeListener.call(this,z,J);return z==="readable"&&i.nextTick(Oe,this),Ne},ve.prototype.off=ve.prototype.removeListener,ve.prototype.removeAllListeners=function(z){const J=b.prototype.removeAllListeners.apply(this,arguments);return(z==="readable"||z===void 0)&&i.nextTick(Oe,this),J};function Oe(z){const J=z._readableState;J.readableListening=z.listenerCount("readable")>0,J.resumeScheduled&&J[M]===!1?J.flowing=!0:z.listenerCount("data")>0?z.resume():J.readableListening||(J.flowing=null)}function Ye(z){w("readable nexttick read 0"),z.read(0)}ve.prototype.resume=function(){const z=this._readableState;return z.flowing||(w("resume"),z.flowing=!z.readableListening,Qe(this,z)),z[M]=!1,this};function Qe(z,J){J.resumeScheduled||(J.resumeScheduled=!0,i.nextTick(Ge,z,J))}function Ge(z,J){w("resume",J.reading),J.reading||z.read(0),J.resumeScheduled=!1,z.emit("resume"),Ze(z),J.flowing&&!J.reading&&z.read(0)}ve.prototype.pause=function(){return w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(w("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[M]=!0,this};function Ze(z){const J=z._readableState;for(w("flow",J.flowing);J.flowing&&z.read()!==null;);}ve.prototype.wrap=function(z){let J=!1;z.on("data",Re=>{!this.push(Re)&&z.pause&&(J=!0,z.pause())}),z.on("end",()=>{this.push(null)}),z.on("error",Re=>{T(this,Re)}),z.on("close",()=>{this.destroy()}),z.on("destroy",()=>{this.destroy()}),this._read=()=>{J&&z.resume&&(J=!1,z.resume())};const Ne=l(z);for(let Re=1;Re<Ne.length;Re++){const De=Ne[Re];this[De]===void 0&&typeof z[De]=="function"&&(this[De]=z[De].bind(z))}return this},ve.prototype[m]=function(){return $t(this)},ve.prototype.iterator=function(z){return z!==void 0&&se(z,"options"),$t(this,z)};function $t(z,J){typeof z.read!="function"&&(z=ve.wrap(z,{objectMode:!0}));const Ne=en(z,J);return Ne.stream=z,Ne}async function*en(z,J){let Ne=oe;function Re(wt){this===z?(Ne(),Ne=oe):Ne=wt}z.on("readable",Re);let De;const _t=P(z,{writable:!1},wt=>{De=wt?C(De,wt):null,Ne(),Ne=oe});try{for(;;){const wt=z.destroyed?null:z.read();if(wt!==null)yield wt;else{if(De)throw De;if(De===null)return;await new f(Re)}}}catch(wt){throw De=C(De,wt),De}finally{(De||J?.destroyOnReturn!==!1)&&(De===void 0||z._readableState.autoDestroy)?S.destroyer(z,null):(z.off("readable",Re),_t())}}a(ve.prototype,{readable:{__proto__:null,get(){const z=this._readableState;return!!z&&z.readable!==!1&&!z.destroyed&&!z.errorEmitted&&!z.endEmitted},set(z){this._readableState&&(this._readableState.readable=!!z)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(z){this._readableState&&(this._readableState.flowing=z)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(z){this._readableState&&(this._readableState.destroyed=z)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),a(Ae.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[M]!==!1},set(z){this[M]=!!z}}}),ve._fromList=st;function st(z,J){if(J.length===0)return null;let Ne;return J.objectMode?Ne=J.buffer.shift():!z||z>=J.length?(J.decoder?Ne=J.buffer.join(""):J.buffer.length===1?Ne=J.buffer.first():Ne=J.buffer.concat(J.length),J.buffer.clear()):Ne=J.buffer.consume(z,J.decoder),Ne}function at(z){const J=z._readableState;w("endReadable",J.endEmitted),J.endEmitted||(J.ended=!0,i.nextTick(Ai,J,z))}function Ai(z,J){if(w("endReadableNT",z.endEmitted,z.length),!z.errored&&!z.closeEmitted&&!z.endEmitted&&z.length===0){if(z.endEmitted=!0,J.emit("end"),J.writable&&J.allowHalfOpen===!1)i.nextTick(hn,J);else if(z.autoDestroy){const Ne=J._writableState;(!Ne||Ne.autoDestroy&&(Ne.finished||Ne.writable===!1))&&J.destroy()}}}function hn(z){z.writable&&!z.writableEnded&&!z.destroyed&&z.end()}ve.from=function(z,J){return B(ve,z,J)};let Fn;function ei(){return Fn===void 0&&(Fn={}),Fn}return ve.fromWeb=function(z,J){return ei().newStreamReadableFromReadableStream(z,J)},ve.toWeb=function(z,J){return ei().newReadableStreamFromStreamReadable(z,J)},ve.wrap=function(z,J){var Ne,Re;return new ve({objectMode:(Ne=(Re=z.readableObjectMode)!==null&&Re!==void 0?Re:z.objectMode)!==null&&Ne!==void 0?Ne:!0,...J,destroy(De,_t){S.destroyer(z,De),_t(De)}}).wrap(z)},Ko}var Yo,Ac;function Ml(){if(Ac)return Yo;Ac=1;const i=Ti(),{ArrayPrototypeSlice:e,Error:n,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:o,ObjectDefineProperties:a,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:u,Symbol:f,SymbolHasInstance:h}=ct();Yo=se,se.WritableState=j;const{EventEmitter:g}=Gs(),m=Dl().Stream,{Buffer:d}=Dn(),_=Ki(),{addAbortSignal:b}=Zs(),{getHighWaterMark:I,getDefaultHighWaterMark:A}=Xs(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:P,ERR_MULTIPLE_CALLBACK:w,ERR_STREAM_CANNOT_PIPE:y,ERR_STREAM_DESTROYED:S,ERR_STREAM_ALREADY_FINISHED:O,ERR_STREAM_NULL_VALUES:X,ERR_STREAM_WRITE_AFTER_END:C,ERR_UNKNOWN_ENCODING:U}=kt().codes,{errorOrDestroy:R}=_;l(se.prototype,m.prototype),l(se,m);function $(){}const G=f("kOnFinished");function j(q,te,fe){typeof fe!="boolean"&&(fe=te instanceof Pn()),this.objectMode=!!(q&&q.objectMode),fe&&(this.objectMode=this.objectMode||!!(q&&q.writableObjectMode)),this.highWaterMark=q?I(this,q,"writableHighWaterMark",fe):A(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const xe=!!(q&&q.decodeStrings===!1);this.decodeStrings=!xe,this.defaultEncoding=q&&q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=T.bind(void 0,te),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,F(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!q||q.emitClose!==!1,this.autoDestroy=!q||q.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[G]=[]}function F(q){q.buffered=[],q.bufferedIndex=0,q.allBuffers=!0,q.allNoop=!0}j.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},o(j.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function se(q){const te=this instanceof Pn();if(!te&&!r(se,this))return new se(q);this._writableState=new j(q,this,te),q&&(typeof q.write=="function"&&(this._write=q.write),typeof q.writev=="function"&&(this._writev=q.writev),typeof q.destroy=="function"&&(this._destroy=q.destroy),typeof q.final=="function"&&(this._final=q.final),typeof q.construct=="function"&&(this._construct=q.construct),q.signal&&b(q.signal,this)),m.call(this,q),_.construct(this,()=>{const fe=this._writableState;fe.writing||me(this,fe),K(this,fe)})}o(se,h,{__proto__:null,value:function(q){return r(this,q)?!0:this!==se?!1:q&&q._writableState instanceof j}}),se.prototype.pipe=function(){R(this,new y)};function M(q,te,fe,xe){const Se=q._writableState;if(typeof fe=="function")xe=fe,fe=Se.defaultEncoding;else{if(!fe)fe=Se.defaultEncoding;else if(fe!=="buffer"&&!d.isEncoding(fe))throw new U(fe);typeof xe!="function"&&(xe=$)}if(te===null)throw new X;if(!Se.objectMode)if(typeof te=="string")Se.decodeStrings!==!1&&(te=d.from(te,fe),fe="buffer");else if(te instanceof d)fe="buffer";else if(m._isUint8Array(te))te=m._uint8ArrayToBuffer(te),fe="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],te);let Ie;return Se.ending?Ie=new C:Se.destroyed&&(Ie=new S("write")),Ie?(i.nextTick(xe,Ie),R(q,Ie,!0),Ie):(Se.pendingcb++,re(q,Se,te,fe,xe))}se.prototype.write=function(q,te,fe){return M(this,q,te,fe)===!0},se.prototype.cork=function(){this._writableState.corked++},se.prototype.uncork=function(){const q=this._writableState;q.corked&&(q.corked--,q.writing||me(this,q))},se.prototype.setDefaultEncoding=function(te){if(typeof te=="string"&&(te=u(te)),!d.isEncoding(te))throw new U(te);return this._writableState.defaultEncoding=te,this};function re(q,te,fe,xe,Se){const Ie=te.objectMode?1:fe.length;te.length+=Ie;const le=te.length<te.highWaterMark;return le||(te.needDrain=!0),te.writing||te.corked||te.errored||!te.constructed?(te.buffered.push({chunk:fe,encoding:xe,callback:Se}),te.allBuffers&&xe!=="buffer"&&(te.allBuffers=!1),te.allNoop&&Se!==$&&(te.allNoop=!1)):(te.writelen=Ie,te.writecb=Se,te.writing=!0,te.sync=!0,q._write(fe,xe,te.onwrite),te.sync=!1),le&&!te.errored&&!te.destroyed}function B(q,te,fe,xe,Se,Ie,le){te.writelen=xe,te.writecb=le,te.writing=!0,te.sync=!0,te.destroyed?te.onwrite(new S("write")):fe?q._writev(Se,te.onwrite):q._write(Se,Ie,te.onwrite),te.sync=!1}function oe(q,te,fe,xe){--te.pendingcb,xe(fe),Y(te),R(q,fe)}function T(q,te){const fe=q._writableState,xe=fe.sync,Se=fe.writecb;if(typeof Se!="function"){R(q,new w);return}fe.writing=!1,fe.writecb=null,fe.length-=fe.writelen,fe.writelen=0,te?(te.stack,fe.errored||(fe.errored=te),q._readableState&&!q._readableState.errored&&(q._readableState.errored=te),xe?i.nextTick(oe,q,fe,te,Se):oe(q,fe,te,Se)):(fe.buffered.length>fe.bufferedIndex&&me(q,fe),xe?fe.afterWriteTickInfo!==null&&fe.afterWriteTickInfo.cb===Se?fe.afterWriteTickInfo.count++:(fe.afterWriteTickInfo={count:1,cb:Se,stream:q,state:fe},i.nextTick(Q,fe.afterWriteTickInfo)):ie(q,fe,1,Se))}function Q({stream:q,state:te,count:fe,cb:xe}){return te.afterWriteTickInfo=null,ie(q,te,fe,xe)}function ie(q,te,fe,xe){for(!te.ending&&!q.destroyed&&te.length===0&&te.needDrain&&(te.needDrain=!1,q.emit("drain"));fe-- >0;)te.pendingcb--,xe();te.destroyed&&Y(te),K(q,te)}function Y(q){if(q.writing)return;for(let Se=q.bufferedIndex;Se<q.buffered.length;++Se){var te;const{chunk:Ie,callback:le}=q.buffered[Se],be=q.objectMode?1:Ie.length;q.length-=be,le((te=q.errored)!==null&&te!==void 0?te:new S("write"))}const fe=q[G].splice(0);for(let Se=0;Se<fe.length;Se++){var xe;fe[Se]((xe=q.errored)!==null&&xe!==void 0?xe:new S("end"))}F(q)}function me(q,te){if(te.corked||te.bufferProcessing||te.destroyed||!te.constructed)return;const{buffered:fe,bufferedIndex:xe,objectMode:Se}=te,Ie=fe.length-xe;if(!Ie)return;let le=xe;if(te.bufferProcessing=!0,Ie>1&&q._writev){te.pendingcb-=Ie-1;const be=te.allNoop?$:ve=>{for(let qe=le;qe<fe.length;++qe)fe[qe].callback(ve)},Ae=te.allNoop&&le===0?fe:e(fe,le);Ae.allBuffers=te.allBuffers,B(q,te,!0,te.length,Ae,"",be),F(te)}else{do{const{chunk:be,encoding:Ae,callback:ve}=fe[le];fe[le++]=null;const qe=Se?1:be.length;B(q,te,!1,qe,be,Ae,ve)}while(le<fe.length&&!te.writing);le===fe.length?F(te):le>256?(fe.splice(0,le),te.bufferedIndex=0):te.bufferedIndex=le}te.bufferProcessing=!1}se.prototype._write=function(q,te,fe){if(this._writev)this._writev([{chunk:q,encoding:te}],fe);else throw new P("_write()")},se.prototype._writev=null,se.prototype.end=function(q,te,fe){const xe=this._writableState;typeof q=="function"?(fe=q,q=null,te=null):typeof te=="function"&&(fe=te,te=null);let Se;if(q!=null){const Ie=M(this,q,te);Ie instanceof n&&(Se=Ie)}return xe.corked&&(xe.corked=1,this.uncork()),Se||(!xe.errored&&!xe.ending?(xe.ending=!0,K(this,xe,!0),xe.ended=!0):xe.finished?Se=new O("end"):xe.destroyed&&(Se=new S("end"))),typeof fe=="function"&&(Se||xe.finished?i.nextTick(fe,Se):xe[G].push(fe)),this};function Z(q){return q.ending&&!q.destroyed&&q.constructed&&q.length===0&&!q.errored&&q.buffered.length===0&&!q.finished&&!q.writing&&!q.errorEmitted&&!q.closeEmitted}function W(q,te){let fe=!1;function xe(Se){if(fe){R(q,Se??w());return}if(fe=!0,te.pendingcb--,Se){const Ie=te[G].splice(0);for(let le=0;le<Ie.length;le++)Ie[le](Se);R(q,Se,te.sync)}else Z(te)&&(te.prefinished=!0,q.emit("prefinish"),te.pendingcb++,i.nextTick(ue,q,te))}te.sync=!0,te.pendingcb++;try{q._final(xe)}catch(Se){xe(Se)}te.sync=!1}function ee(q,te){!te.prefinished&&!te.finalCalled&&(typeof q._final=="function"&&!te.destroyed?(te.finalCalled=!0,W(q,te)):(te.prefinished=!0,q.emit("prefinish")))}function K(q,te,fe){Z(te)&&(ee(q,te),te.pendingcb===0&&(fe?(te.pendingcb++,i.nextTick((xe,Se)=>{Z(Se)?ue(xe,Se):Se.pendingcb--},q,te)):Z(te)&&(te.pendingcb++,ue(q,te))))}function ue(q,te){te.pendingcb--,te.finished=!0;const fe=te[G].splice(0);for(let xe=0;xe<fe.length;xe++)fe[xe]();if(q.emit("finish"),te.autoDestroy){const xe=q._readableState;(!xe||xe.autoDestroy&&(xe.endEmitted||xe.readable===!1))&&q.destroy()}}a(se.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(q){this._writableState&&(this._writableState.destroyed=q)}},writable:{__proto__:null,get(){const q=this._writableState;return!!q&&q.writable!==!1&&!q.destroyed&&!q.errored&&!q.ending&&!q.ended},set(q){this._writableState&&(this._writableState.writable=!!q)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){const q=this._writableState;return q?!q.destroyed&&!q.ending&&q.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});const ce=_.destroy;se.prototype.destroy=function(q,te){const fe=this._writableState;return!fe.destroyed&&(fe.bufferedIndex<fe.buffered.length||fe[G].length)&&i.nextTick(Y,fe),ce.call(this,q,te),this},se.prototype._undestroy=_.undestroy,se.prototype._destroy=function(q,te){te(q)},se.prototype[g.captureRejectionSymbol]=function(q){this.destroy(q)};let Ee;function Te(){return Ee===void 0&&(Ee={}),Ee}return se.fromWeb=function(q,te){return Te().newStreamWritableFromWritableStream(q,te)},se.toWeb=function(q){return Te().newWritableStreamFromStreamWritable(q)},Yo}var ea,Nc;function Wg(){if(Nc)return ea;Nc=1;const i=Ti(),e=Dn(),{isReadable:n,isWritable:r,isIterable:o,isNodeStream:a,isReadableNodeStream:l,isWritableNodeStream:u,isDuplexNodeStream:f,isReadableStream:h,isWritableStream:g}=Mn(),m=Qn(),{AbortError:d,codes:{ERR_INVALID_ARG_TYPE:_,ERR_INVALID_RETURN_VALUE:b}}=kt(),{destroyer:I}=Ki(),A=Pn(),N=Qs(),P=Ml(),{createDeferredPromise:w}=jt(),y=gf(),S=globalThis.Blob||e.Blob,O=typeof S<"u"?function(j){return j instanceof S}:function(j){return!1},X=globalThis.AbortController||Hr().AbortController,{FunctionPrototypeCall:C}=ct();class U extends A{constructor(j){super(j),j?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),j?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}ea=function G(j,F){if(f(j))return j;if(l(j))return $({readable:j});if(u(j))return $({writable:j});if(a(j))return $({writable:!1,readable:!1});if(h(j))return $({readable:N.fromWeb(j)});if(g(j))return $({writable:P.fromWeb(j)});if(typeof j=="function"){const{value:M,write:re,final:B,destroy:oe}=R(j);if(o(M))return y(U,M,{objectMode:!0,write:re,final:B,destroy:oe});const T=M?.then;if(typeof T=="function"){let Q;const ie=C(T,M,Y=>{if(Y!=null)throw new b("nully","body",Y)},Y=>{I(Q,Y)});return Q=new U({objectMode:!0,readable:!1,write:re,final(Y){B(async()=>{try{await ie,i.nextTick(Y,null)}catch(me){i.nextTick(Y,me)}})},destroy:oe})}throw new b("Iterable, AsyncIterable or AsyncFunction",F,M)}if(O(j))return G(j.arrayBuffer());if(o(j))return y(U,j,{objectMode:!0,writable:!1});if(h(j?.readable)&&g(j?.writable))return U.fromWeb(j);if(typeof j?.writable=="object"||typeof j?.readable=="object"){const M=j!=null&&j.readable?l(j?.readable)?j?.readable:G(j.readable):void 0,re=j!=null&&j.writable?u(j?.writable)?j?.writable:G(j.writable):void 0;return $({readable:M,writable:re})}const se=j?.then;if(typeof se=="function"){let M;return C(se,j,re=>{re!=null&&M.push(re),M.push(null)},re=>{I(M,re)}),M=new U({objectMode:!0,writable:!1,read(){}})}throw new _(F,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],j)};function R(G){let{promise:j,resolve:F}=w();const se=new X,M=se.signal;return{value:G((async function*(){for(;;){const B=j;j=null;const{chunk:oe,done:T,cb:Q}=await B;if(i.nextTick(Q),T)return;if(M.aborted)throw new d(void 0,{cause:M.reason});({promise:j,resolve:F}=w()),yield oe}})(),{signal:M}),write(B,oe,T){const Q=F;F=null,Q({chunk:B,done:!1,cb:T})},final(B){const oe=F;F=null,oe({done:!0,cb:B})},destroy(B,oe){se.abort(),oe(B)}}}function $(G){const j=G.readable&&typeof G.readable.read!="function"?N.wrap(G.readable):G.readable,F=G.writable;let se=!!n(j),M=!!r(F),re,B,oe,T,Q;function ie(Y){const me=T;T=null,me?me(Y):Y&&Q.destroy(Y)}return Q=new U({readableObjectMode:!!(j!=null&&j.readableObjectMode),writableObjectMode:!!(F!=null&&F.writableObjectMode),readable:se,writable:M}),M&&(m(F,Y=>{M=!1,Y&&I(j,Y),ie(Y)}),Q._write=function(Y,me,Z){F.write(Y,me)?Z():re=Z},Q._final=function(Y){F.end(),B=Y},F.on("drain",function(){if(re){const Y=re;re=null,Y()}}),F.on("finish",function(){if(B){const Y=B;B=null,Y()}})),se&&(m(j,Y=>{se=!1,Y&&I(j,Y),ie(Y)}),j.on("readable",function(){if(oe){const Y=oe;oe=null,Y()}}),j.on("end",function(){Q.push(null)}),Q._read=function(){for(;;){const Y=j.read();if(Y===null){oe=Q._read;return}if(!Q.push(Y))return}}),Q._destroy=function(Y,me){!Y&&T!==null&&(Y=new d),oe=null,re=null,B=null,T===null?me(Y):(T=me,I(F,Y),I(j,Y))},Q}return ea}var ta,Rc;function Pn(){if(Rc)return ta;Rc=1;const{ObjectDefineProperties:i,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:n,ObjectSetPrototypeOf:r}=ct();ta=l;const o=Qs(),a=Ml();r(l.prototype,o.prototype),r(l,o);{const g=n(a.prototype);for(let m=0;m<g.length;m++){const d=g[m];l.prototype[d]||(l.prototype[d]=a.prototype[d])}}function l(g){if(!(this instanceof l))return new l(g);o.call(this,g),a.call(this,g),g?(this.allowHalfOpen=g.allowHalfOpen!==!1,g.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),g.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}i(l.prototype,{writable:{__proto__:null,...e(a.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(a.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(a.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(a.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(a.prototype,"writableLength")},writableFinished:{__proto__:null,...e(a.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(a.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(a.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(a.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(g){this._readableState&&this._writableState&&(this._readableState.destroyed=g,this._writableState.destroyed=g)}}});let u;function f(){return u===void 0&&(u={}),u}l.fromWeb=function(g,m){return f().newStreamDuplexFromReadableWritablePair(g,m)},l.toWeb=function(g){return f().newReadableWritablePairFromDuplex(g)};let h;return l.from=function(g){return h||(h=Wg()),h(g,"body")},ta}var na,Cc;function mf(){if(Cc)return na;Cc=1;const{ObjectSetPrototypeOf:i,Symbol:e}=ct();na=l;const{ERR_METHOD_NOT_IMPLEMENTED:n}=kt().codes,r=Pn(),{getHighWaterMark:o}=Xs();i(l.prototype,r.prototype),i(l,r);const a=e("kCallback");function l(h){if(!(this instanceof l))return new l(h);const g=h?o(this,h,"readableHighWaterMark",!0):null;g===0&&(h={...h,highWaterMark:null,readableHighWaterMark:g,writableHighWaterMark:h.writableHighWaterMark||0}),r.call(this,h),this._readableState.sync=!1,this[a]=null,h&&(typeof h.transform=="function"&&(this._transform=h.transform),typeof h.flush=="function"&&(this._flush=h.flush)),this.on("prefinish",f)}function u(h){typeof this._flush=="function"&&!this.destroyed?this._flush((g,m)=>{if(g){h?h(g):this.destroy(g);return}m!=null&&this.push(m),this.push(null),h&&h()}):(this.push(null),h&&h())}function f(){this._final!==u&&u.call(this)}return l.prototype._final=u,l.prototype._transform=function(h,g,m){throw new n("_transform()")},l.prototype._write=function(h,g,m){const d=this._readableState,_=this._writableState,b=d.length;this._transform(h,g,(I,A)=>{if(I){m(I);return}A!=null&&this.push(A),_.ended||b===d.length||d.length<d.highWaterMark?m():this[a]=m})},l.prototype._read=function(){if(this[a]){const h=this[a];this[a]=null,h()}},na}var ia,Pc;function _f(){if(Pc)return ia;Pc=1;const{ObjectSetPrototypeOf:i}=ct();ia=n;const e=mf();i(n.prototype,e.prototype),i(n,e);function n(r){if(!(this instanceof n))return new n(r);e.call(this,r)}return n.prototype._transform=function(r,o,a){a(null,r)},ia}var ra,kc;function Ol(){if(kc)return ra;kc=1;const i=Ti(),{ArrayIsArray:e,Promise:n,SymbolAsyncIterator:r,SymbolDispose:o}=ct(),a=Qn(),{once:l}=jt(),u=Ki(),f=Pn(),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:m,ERR_MISSING_ARGS:d,ERR_STREAM_DESTROYED:_,ERR_STREAM_PREMATURE_CLOSE:b},AbortError:I}=kt(),{validateFunction:A,validateAbortSignal:N}=Xr(),{isIterable:P,isReadable:w,isReadableNodeStream:y,isNodeStream:S,isTransformStream:O,isWebStream:X,isReadableStream:C,isReadableFinished:U}=Mn(),R=globalThis.AbortController||Hr().AbortController;let $,G,j;function F(Y,me,Z){let W=!1;Y.on("close",()=>{W=!0});const ee=a(Y,{readable:me,writable:Z},K=>{W=!K});return{destroy:K=>{W||(W=!0,u.destroyer(Y,K||new _("pipe")))},cleanup:ee}}function se(Y){return A(Y[Y.length-1],"streams[stream.length - 1]"),Y.pop()}function M(Y){if(P(Y))return Y;if(y(Y))return re(Y);throw new g("val",["Readable","Iterable","AsyncIterable"],Y)}async function*re(Y){G||(G=Qs()),yield*G.prototype[r].call(Y)}async function B(Y,me,Z,{end:W}){let ee,K=null;const ue=Te=>{if(Te&&(ee=Te),K){const q=K;K=null,q()}},ce=()=>new n((Te,q)=>{ee?q(ee):K=()=>{ee?q(ee):Te()}});me.on("drain",ue);const Ee=a(me,{readable:!1},ue);try{me.writableNeedDrain&&await ce();for await(const Te of Y)me.write(Te)||await ce();W&&(me.end(),await ce()),Z()}catch(Te){Z(ee!==Te?h(ee,Te):Te)}finally{Ee(),me.off("drain",ue)}}async function oe(Y,me,Z,{end:W}){O(me)&&(me=me.writable);const ee=me.getWriter();try{for await(const K of Y)await ee.ready,ee.write(K).catch(()=>{});await ee.ready,W&&await ee.close(),Z()}catch(K){try{await ee.abort(K),Z(K)}catch(ue){Z(ue)}}}function T(...Y){return Q(Y,l(se(Y)))}function Q(Y,me,Z){if(Y.length===1&&e(Y[0])&&(Y=Y[0]),Y.length<2)throw new d("streams");const W=new R,ee=W.signal,K=Z?.signal,ue=[];N(K,"options.signal");function ce(){Se(new I)}j=j||jt().addAbortListener;let Ee;K&&(Ee=j(K,ce));let Te,q;const te=[];let fe=0;function xe(Ae){Se(Ae,--fe===0)}function Se(Ae,ve){var qe;if(Ae&&(!Te||Te.code==="ERR_STREAM_PREMATURE_CLOSE")&&(Te=Ae),!(!Te&&!ve)){for(;te.length;)te.shift()(Te);(qe=Ee)===null||qe===void 0||qe[o](),W.abort(),ve&&(Te||ue.forEach(mt=>mt()),i.nextTick(me,Te,q))}}let Ie;for(let Ae=0;Ae<Y.length;Ae++){const ve=Y[Ae],qe=Ae<Y.length-1,mt=Ae>0,$e=qe||Z?.end!==!1,ft=Ae===Y.length-1;if(S(ve)){let k=function(v){v&&v.name!=="AbortError"&&v.code!=="ERR_STREAM_PREMATURE_CLOSE"&&xe(v)};if($e){const{destroy:v,cleanup:x}=F(ve,qe,mt);te.push(v),w(ve)&&ft&&ue.push(x)}ve.on("error",k),w(ve)&&ft&&ue.push(()=>{ve.removeListener("error",k)})}if(Ae===0)if(typeof ve=="function"){if(Ie=ve({signal:ee}),!P(Ie))throw new m("Iterable, AsyncIterable or Stream","source",Ie)}else P(ve)||y(ve)||O(ve)?Ie=ve:Ie=f.from(ve);else if(typeof ve=="function"){if(O(Ie)){var le;Ie=M((le=Ie)===null||le===void 0?void 0:le.readable)}else Ie=M(Ie);if(Ie=ve(Ie,{signal:ee}),qe){if(!P(Ie,!0))throw new m("AsyncIterable",`transform[${Ae-1}]`,Ie)}else{var be;$||($=_f());const k=new $({objectMode:!0}),v=(be=Ie)===null||be===void 0?void 0:be.then;if(typeof v=="function")fe++,v.call(Ie,ae=>{q=ae,ae!=null&&k.write(ae),$e&&k.end(),i.nextTick(xe)},ae=>{k.destroy(ae),i.nextTick(xe,ae)});else if(P(Ie,!0))fe++,B(Ie,k,xe,{end:$e});else if(C(Ie)||O(Ie)){const ae=Ie.readable||Ie;fe++,B(ae,k,xe,{end:$e})}else throw new m("AsyncIterable or Promise","destination",Ie);Ie=k;const{destroy:x,cleanup:H}=F(Ie,!1,!0);te.push(x),ft&&ue.push(H)}}else if(S(ve)){if(y(Ie)){fe+=2;const k=ie(Ie,ve,xe,{end:$e});w(ve)&&ft&&ue.push(k)}else if(O(Ie)||C(Ie)){const k=Ie.readable||Ie;fe++,B(k,ve,xe,{end:$e})}else if(P(Ie))fe++,B(Ie,ve,xe,{end:$e});else throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Ie);Ie=ve}else if(X(ve)){if(y(Ie))fe++,oe(M(Ie),ve,xe,{end:$e});else if(C(Ie)||P(Ie))fe++,oe(Ie,ve,xe,{end:$e});else if(O(Ie))fe++,oe(Ie.readable,ve,xe,{end:$e});else throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Ie);Ie=ve}else Ie=f.from(ve)}return(ee!=null&&ee.aborted||K!=null&&K.aborted)&&i.nextTick(ce),Ie}function ie(Y,me,Z,{end:W}){let ee=!1;if(me.on("close",()=>{ee||Z(new b)}),Y.pipe(me,{end:!1}),W){let K=function(){ee=!0,me.end()};U(Y)?i.nextTick(K):Y.once("end",K)}else Z();return a(Y,{readable:!0,writable:!1},K=>{const ue=Y._readableState;K&&K.code==="ERR_STREAM_PREMATURE_CLOSE"&&ue&&ue.ended&&!ue.errored&&!ue.errorEmitted?Y.once("end",Z).once("error",Z):Z(K)}),a(me,{readable:!1,writable:!0},Z)}return ra={pipelineImpl:Q,pipeline:T},ra}var sa,Dc;function yf(){if(Dc)return sa;Dc=1;const{pipeline:i}=Ol(),e=Pn(),{destroyer:n}=Ki(),{isNodeStream:r,isReadable:o,isWritable:a,isWebStream:l,isTransformStream:u,isWritableStream:f,isReadableStream:h}=Mn(),{AbortError:g,codes:{ERR_INVALID_ARG_VALUE:m,ERR_MISSING_ARGS:d}}=kt(),_=Qn();return sa=function(...I){if(I.length===0)throw new d("streams");if(I.length===1)return e.from(I[0]);const A=[...I];if(typeof I[0]=="function"&&(I[0]=e.from(I[0])),typeof I[I.length-1]=="function"){const $=I.length-1;I[$]=e.from(I[$])}for(let $=0;$<I.length;++$)if(!(!r(I[$])&&!l(I[$]))){if($<I.length-1&&!(o(I[$])||h(I[$])||u(I[$])))throw new m(`streams[${$}]`,A[$],"must be readable");if($>0&&!(a(I[$])||f(I[$])||u(I[$])))throw new m(`streams[${$}]`,A[$],"must be writable")}let N,P,w,y,S;function O($){const G=y;y=null,G?G($):$?S.destroy($):!R&&!U&&S.destroy()}const X=I[0],C=i(I,O),U=!!(a(X)||f(X)||u(X)),R=!!(o(C)||h(C)||u(C));if(S=new e({writableObjectMode:!!(X!=null&&X.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:U,readable:R}),U){if(r(X))S._write=function(G,j,F){X.write(G,j)?F():N=F},S._final=function(G){X.end(),P=G},X.on("drain",function(){if(N){const G=N;N=null,G()}});else if(l(X)){const j=(u(X)?X.writable:X).getWriter();S._write=async function(F,se,M){try{await j.ready,j.write(F).catch(()=>{}),M()}catch(re){M(re)}},S._final=async function(F){try{await j.ready,j.close().catch(()=>{}),P=F}catch(se){F(se)}}}const $=u(C)?C.readable:C;_($,()=>{if(P){const G=P;P=null,G()}})}if(R){if(r(C))C.on("readable",function(){if(w){const $=w;w=null,$()}}),C.on("end",function(){S.push(null)}),S._read=function(){for(;;){const $=C.read();if($===null){w=S._read;return}if(!S.push($))return}};else if(l(C)){const G=(u(C)?C.readable:C).getReader();S._read=async function(){for(;;)try{const{value:j,done:F}=await G.read();if(!S.push(j))return;if(F){S.push(null);return}}catch{return}}}}return S._destroy=function($,G){!$&&y!==null&&($=new g),w=null,N=null,P=null,y===null?G($):(y=G,r(C)&&n(C,$))},S},sa}var Mc;function Gg(){if(Mc)return ws;Mc=1;const i=globalThis.AbortController||Hr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:n,ERR_MISSING_ARGS:r,ERR_OUT_OF_RANGE:o},AbortError:a}=kt(),{validateAbortSignal:l,validateInteger:u,validateObject:f}=Xr(),h=ct().Symbol("kWeak"),g=ct().Symbol("kResistStopPropagation"),{finished:m}=Qn(),d=yf(),{addAbortSignalNoValidate:_}=Zs(),{isWritable:b,isNodeStream:I}=Mn(),{deprecate:A}=jt(),{ArrayPrototypePush:N,Boolean:P,MathFloor:w,Number:y,NumberIsNaN:S,Promise:O,PromiseReject:X,PromiseResolve:C,PromisePrototypeThen:U,Symbol:R}=ct(),$=R("kEmpty"),G=R("kEof");function j(K,ue){if(ue!=null&&f(ue,"options"),ue?.signal!=null&&l(ue.signal,"options.signal"),I(K)&&!b(K))throw new e("stream",K,"must be writable");const ce=d(this,K);return ue!=null&&ue.signal&&_(ue.signal,ce),ce}function F(K,ue){if(typeof K!="function")throw new n("fn",["Function","AsyncFunction"],K);ue!=null&&f(ue,"options"),ue?.signal!=null&&l(ue.signal,"options.signal");let ce=1;ue?.concurrency!=null&&(ce=w(ue.concurrency));let Ee=ce-1;return ue?.highWaterMark!=null&&(Ee=w(ue.highWaterMark)),u(ce,"options.concurrency",1),u(Ee,"options.highWaterMark",0),Ee+=ce,(async function*(){const q=jt().AbortSignalAny([ue?.signal].filter(P)),te=this,fe=[],xe={signal:q};let Se,Ie,le=!1,be=0;function Ae(){le=!0,ve()}function ve(){be-=1,qe()}function qe(){Ie&&!le&&be<ce&&fe.length<Ee&&(Ie(),Ie=null)}async function mt(){try{for await(let $e of te){if(le)return;if(q.aborted)throw new a;try{if($e=K($e,xe),$e===$)continue;$e=C($e)}catch(ft){$e=X(ft)}be+=1,U($e,ve,Ae),fe.push($e),Se&&(Se(),Se=null),!le&&(fe.length>=Ee||be>=ce)&&await new O(ft=>{Ie=ft})}fe.push(G)}catch($e){const ft=X($e);U(ft,ve,Ae),fe.push(ft)}finally{le=!0,Se&&(Se(),Se=null)}}mt();try{for(;;){for(;fe.length>0;){const $e=await fe[0];if($e===G)return;if(q.aborted)throw new a;$e!==$&&(yield $e),fe.shift(),qe()}await new O($e=>{Se=$e})}}finally{le=!0,Ie&&(Ie(),Ie=null)}}).call(this)}function se(K=void 0){return K!=null&&f(K,"options"),K?.signal!=null&&l(K.signal,"options.signal"),(async function*(){let ce=0;for await(const Te of this){var Ee;if(K!=null&&(Ee=K.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new a({cause:K.signal.reason});yield[ce++,Te]}}).call(this)}async function M(K,ue=void 0){for await(const ce of T.call(this,K,ue))return!0;return!1}async function re(K,ue=void 0){if(typeof K!="function")throw new n("fn",["Function","AsyncFunction"],K);return!await M.call(this,async(...ce)=>!await K(...ce),ue)}async function B(K,ue){for await(const ce of T.call(this,K,ue))return ce}async function oe(K,ue){if(typeof K!="function")throw new n("fn",["Function","AsyncFunction"],K);async function ce(Ee,Te){return await K(Ee,Te),$}for await(const Ee of F.call(this,ce,ue));}function T(K,ue){if(typeof K!="function")throw new n("fn",["Function","AsyncFunction"],K);async function ce(Ee,Te){return await K(Ee,Te)?Ee:$}return F.call(this,ce,ue)}class Q extends r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function ie(K,ue,ce){var Ee;if(typeof K!="function")throw new n("reducer",["Function","AsyncFunction"],K);ce!=null&&f(ce,"options"),ce?.signal!=null&&l(ce.signal,"options.signal");let Te=arguments.length>1;if(ce!=null&&(Ee=ce.signal)!==null&&Ee!==void 0&&Ee.aborted){const Se=new a(void 0,{cause:ce.signal.reason});throw this.once("error",()=>{}),await m(this.destroy(Se)),Se}const q=new i,te=q.signal;if(ce!=null&&ce.signal){const Se={once:!0,[h]:this,[g]:!0};ce.signal.addEventListener("abort",()=>q.abort(),Se)}let fe=!1;try{for await(const Se of this){var xe;if(fe=!0,ce!=null&&(xe=ce.signal)!==null&&xe!==void 0&&xe.aborted)throw new a;Te?ue=await K(ue,Se,{signal:te}):(ue=Se,Te=!0)}if(!fe&&!Te)throw new Q}finally{q.abort()}return ue}async function Y(K){K!=null&&f(K,"options"),K?.signal!=null&&l(K.signal,"options.signal");const ue=[];for await(const Ee of this){var ce;if(K!=null&&(ce=K.signal)!==null&&ce!==void 0&&ce.aborted)throw new a(void 0,{cause:K.signal.reason});N(ue,Ee)}return ue}function me(K,ue){const ce=F.call(this,K,ue);return(async function*(){for await(const Te of ce)yield*Te}).call(this)}function Z(K){if(K=y(K),S(K))return 0;if(K<0)throw new o("number",">= 0",K);return K}function W(K,ue=void 0){return ue!=null&&f(ue,"options"),ue?.signal!=null&&l(ue.signal,"options.signal"),K=Z(K),(async function*(){var Ee;if(ue!=null&&(Ee=ue.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new a;for await(const q of this){var Te;if(ue!=null&&(Te=ue.signal)!==null&&Te!==void 0&&Te.aborted)throw new a;K--<=0&&(yield q)}}).call(this)}function ee(K,ue=void 0){return ue!=null&&f(ue,"options"),ue?.signal!=null&&l(ue.signal,"options.signal"),K=Z(K),(async function*(){var Ee;if(ue!=null&&(Ee=ue.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new a;for await(const q of this){var Te;if(ue!=null&&(Te=ue.signal)!==null&&Te!==void 0&&Te.aborted)throw new a;if(K-- >0&&(yield q),K<=0)return}}).call(this)}return ws.streamReturningOperators={asIndexedPairs:A(se,"readable.asIndexedPairs will be removed in a future version."),drop:W,filter:T,flatMap:me,map:F,take:ee,compose:j},ws.promiseReturningOperators={every:re,forEach:oe,reduce:ie,toArray:Y,some:M,find:B},ws}var oa,Oc;function vf(){if(Oc)return oa;Oc=1;const{ArrayPrototypePop:i,Promise:e}=ct(),{isIterable:n,isNodeStream:r,isWebStream:o}=Mn(),{pipelineImpl:a}=Ol(),{finished:l}=Qn();bf();function u(...f){return new e((h,g)=>{let m,d;const _=f[f.length-1];if(_&&typeof _=="object"&&!r(_)&&!n(_)&&!o(_)){const b=i(f);m=b.signal,d=b.end}a(f,(b,I)=>{b?g(b):h(I)},{signal:m,end:d})})}return oa={finished:l,pipeline:u},oa}var Fc;function bf(){if(Fc)return Fo.exports;Fc=1;const{Buffer:i}=Dn(),{ObjectDefineProperty:e,ObjectKeys:n,ReflectApply:r}=ct(),{promisify:{custom:o}}=jt(),{streamReturningOperators:a,promiseReturningOperators:l}=Gg(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=kt(),f=yf(),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:g}=Xs(),{pipeline:m}=Ol(),{destroyer:d}=Ki(),_=Qn(),b=vf(),I=Mn(),A=Fo.exports=Dl().Stream;A.isDestroyed=I.isDestroyed,A.isDisturbed=I.isDisturbed,A.isErrored=I.isErrored,A.isReadable=I.isReadable,A.isWritable=I.isWritable,A.Readable=Qs();for(const P of n(a)){let y=function(...S){if(new.target)throw u();return A.Readable.from(r(w,this,S))};const w=a[P];e(y,"name",{__proto__:null,value:w.name}),e(y,"length",{__proto__:null,value:w.length}),e(A.Readable.prototype,P,{__proto__:null,value:y,enumerable:!1,configurable:!0,writable:!0})}for(const P of n(l)){let y=function(...S){if(new.target)throw u();return r(w,this,S)};const w=l[P];e(y,"name",{__proto__:null,value:w.name}),e(y,"length",{__proto__:null,value:w.length}),e(A.Readable.prototype,P,{__proto__:null,value:y,enumerable:!1,configurable:!0,writable:!0})}A.Writable=Ml(),A.Duplex=Pn(),A.Transform=mf(),A.PassThrough=_f(),A.pipeline=m;const{addAbortSignal:N}=Zs();return A.addAbortSignal=N,A.finished=_,A.destroy=d,A.compose=f,A.setDefaultHighWaterMark=h,A.getDefaultHighWaterMark=g,e(A,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return b}}),e(m,o,{__proto__:null,enumerable:!0,get(){return b.pipeline}}),e(_,o,{__proto__:null,enumerable:!0,get(){return b.finished}}),A.Stream=A,A._isUint8Array=function(w){return w instanceof Uint8Array},A._uint8ArrayToBuffer=function(w){return i.from(w.buffer,w.byteOffset,w.byteLength)},Fo.exports}var jc;function wf(){return jc||(jc=1,(function(i){const e=bf(),n=vf(),r=e.Readable.destroy;i.exports=e.Readable,i.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,i.exports._isUint8Array=e._isUint8Array,i.exports.isDisturbed=e.isDisturbed,i.exports.isErrored=e.isErrored,i.exports.isReadable=e.isReadable,i.exports.Readable=e.Readable,i.exports.Writable=e.Writable,i.exports.Duplex=e.Duplex,i.exports.Transform=e.Transform,i.exports.PassThrough=e.PassThrough,i.exports.addAbortSignal=e.addAbortSignal,i.exports.finished=e.finished,i.exports.destroy=e.destroy,i.exports.destroy=r,i.exports.pipeline=e.pipeline,i.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return n}}),i.exports.Stream=e.Stream,i.exports.default=i.exports})(Oo)),Oo.exports}var Fl=wf();const aa=Symbol("iter");function $r(i,e,n=4){if(n===0)return Object.assign(i,e);for(const r in e)i[r]=$r(i[r]||Object.create(null),e[r],n-1);return i}function xf(i,e,n=4){let r=!1;for(const o in i)if(o in e){const a=n===0?null:xf(i[o],e[o],n-1);if(a!==!1)r=r||Object.create(null),r[o]=a;else if(n===3)return!1}return r}function Ef(i,e,n=4){let r=!1;for(const o in i)if(!(o in e))r=r||Object.create(null),r[o]=n===0?null:$r({},i[o],n-1);else if(n!==0){const a=Ef(i[o],e[o],n-1);if(a!==!1)r=r||Object.create(null),r[o]=a;else if(n===3)return!1}return r}class Zg{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=e.factory||Be}_termFromId(e){if(e[0]==="."){const n=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(n[r[1]]),this._termFromId(n[r[2]]),this._termFromId(n[r[3]]),r[4]&&this._termFromId(n[r[4]]))}return Mr(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const n=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),o=this._termToNumericId(e.object);let a;return n&&r&&o&&(bl(e.graph)||(a=this._termToNumericId(e.graph)))&&this._ids[a?`.${n}.${r}.${o}.${a}`:`.${n}.${r}.${o}`]}return this._ids[zi(e)]}_termToNewNumericId(e){const n=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${bl(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:zi(e);return this._ids[n]||(this._ids[this._entities[++this._id]=n]=this._id)}createBlankNode(e){let n,r;if(e)for(n=e=`_:${e}`,r=1;this._ids[n];)n=e+r++;else do n=`_:b${this._blankNodeIndex++}`;while(this._ids[n]);return this._ids[n]=++this._id,this._entities[this._id]=n,this._factory.blankNode(n.substr(2))}}class It{constructor(e,n){this._size=0,this._graphs=Object.create(null),!n&&e&&!e[0]&&typeof e.match!="function"&&(n=e,e=null),n=n||{},this._factory=n.factory||Be,this._entityIndex=n.entityIndex||new Zg({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;const n=this._graphs;let r,o;for(const a in n)for(const l in r=n[a].subjects)for(const u in o=r[l])e+=Object.keys(o[u]).length;return this._size=e}_addToIndex(e,n,r,o){const a=e[n]||(e[n]={}),l=a[r]||(a[r]={}),u=o in l;return u||(l[o]=null),!u}_removeFromIndex(e,n,r,o){const a=e[n],l=a[r];delete l[o];for(const u in l)return;delete a[r];for(const u in a)return;delete e[n]}*_findInIndex(e,n,r,o,a,l,u,f){let h,g,m;const d=this._entities,_=this._termFromId(d[f]),b={subject:null,predicate:null,object:null};n&&((h=e,e={})[n]=h[n]);for(const I in e)if(g=e[I]){b[a]=this._termFromId(d[I]),r&&((h=g,g={})[r]=h[r]);for(const A in g)if(m=g[A]){b[l]=this._termFromId(d[A]);const N=o?o in m?[o]:[]:Object.keys(m);for(let P=0;P<N.length;P++)b[u]=this._termFromId(d[N[P]]),yield this._factory.quad(b.subject,b.predicate,b.object,_)}}}_loop(e,n){for(const r in e)n(r)}_loopByKey0(e,n,r){let o,a;if(o=e[n])for(a in o)r(a)}_loopByKey1(e,n,r){let o,a;for(o in e)a=e[o],a[n]&&r(o)}_loopBy2Keys(e,n,r,o){let a,l,u;if((a=e[n])&&(l=a[r]))for(u in l)o(u)}_countInIndex(e,n,r,o){let a=0,l,u,f;n&&((l=e,e={})[n]=l[n]);for(const h in e)if(u=e[h]){r&&((l=u,u={})[r]=l[r]);for(const g in u)(f=u[g])&&(o?o in f&&a++:a+=Object.keys(f).length)}return a}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const n=Object.create(null);return r=>{r in n||(n[r]=!0,e(this._termFromId(this._entities[r],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,n,r,o){n||(o=e.graph,r=e.object,n=e.predicate,e=e.subject),o=o?this._termToNewNumericId(o):1;let a=this._graphs[o];return a||(a=this._graphs[o]={subjects:{},predicates:{},objects:{}},Object.freeze(a)),e=this._termToNewNumericId(e),n=this._termToNewNumericId(n),r=this._termToNewNumericId(r),this._addToIndex(a.subjects,e,n,r)?(this._addToIndex(a.predicates,n,r,e),this._addToIndex(a.objects,r,e,n),this._size=null,!0):!1}addQuads(e){for(let n=0;n<e.length;n++)this.addQuad(e[n])}delete(e){return this.removeQuad(e),this}has(e,n,r,o){return e&&e.subject&&({subject:e,predicate:n,object:r,graph:o}=e),!this.readQuads(e,n,r,o).next().done}import(e){return e.on("data",n=>{this.addQuad(n)}),e}removeQuad(e,n,r,o){n||({subject:e,predicate:n,object:r,graph:o}=e),o=o?this._termToNumericId(o):1;const a=this._graphs;let l,u,f;if(!(e=e&&this._termToNumericId(e))||!(n=n&&this._termToNumericId(n))||!(r=r&&this._termToNumericId(r))||!(l=a[o])||!(u=l.subjects[e])||!(f=u[n])||!(r in f))return!1;this._removeFromIndex(l.subjects,e,n,r),this._removeFromIndex(l.predicates,n,r,e),this._removeFromIndex(l.objects,r,e,n),this._size!==null&&this._size--;for(e in l.subjects)return!0;return delete a[o],!0}removeQuads(e){for(let n=0;n<e.length;n++)this.removeQuad(e[n])}remove(e){return e.on("data",n=>{this.removeQuad(n)}),e}removeMatches(e,n,r,o){const a=new Fl.Readable({objectMode:!0}),l=this.readQuads(e,n,r,o);return a._read=u=>{for(;--u>=0;){const{done:f,value:h}=l.next();if(f){a.push(null);return}a.push(h)}},this.remove(a)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,n,r,o){return[...this.readQuads(e,n,r,o)]}*readQuads(e,n,r,o){const a=this._getGraphs(o);let l,u,f,h;if(!(e&&!(u=this._termToNumericId(e))||n&&!(f=this._termToNumericId(n))||r&&!(h=this._termToNumericId(r))))for(const g in a)(l=a[g])&&(u?h?yield*this._findInIndex(l.objects,h,u,f,"object","subject","predicate",g):yield*this._findInIndex(l.subjects,u,f,null,"subject","predicate","object",g):f?yield*this._findInIndex(l.predicates,f,h,null,"predicate","object","subject",g):h?yield*this._findInIndex(l.objects,h,null,null,"object","subject","predicate",g):yield*this._findInIndex(l.subjects,null,null,null,"subject","predicate","object",g))}match(e,n,r,o){return new Un(this,e,n,r,o,{entityIndex:this._entityIndex})}countQuads(e,n,r,o){const a=this._getGraphs(o);let l=0,u,f,h,g;if(e&&!(f=this._termToNumericId(e))||n&&!(h=this._termToNumericId(n))||r&&!(g=this._termToNumericId(r)))return 0;for(const m in a)(u=a[m])&&(e?r?l+=this._countInIndex(u.objects,g,f,h):l+=this._countInIndex(u.subjects,f,h,g):n?l+=this._countInIndex(u.predicates,h,g,f):l+=this._countInIndex(u.objects,g,f,h));return l}forEach(e,n,r,o,a){this.some(l=>(e(l,this),!1),n,r,o,a)}every(e,n,r,o,a){return!this.some(l=>!e(l,this),n,r,o,a)}some(e,n,r,o,a){for(const l of this.readQuads(n,r,o,a))if(e(l,this))return!0;return!1}getSubjects(e,n,r){const o=[];return this.forSubjects(a=>{o.push(a)},e,n,r),o}forSubjects(e,n,r,o){const a=this._getGraphs(o);let l,u,f;if(e=this._uniqueEntities(e),!(n&&!(u=this._termToNumericId(n))||r&&!(f=this._termToNumericId(r))))for(o in a)(l=a[o])&&(u?f?this._loopBy2Keys(l.predicates,u,f,e):this._loopByKey1(l.subjects,u,e):f?this._loopByKey0(l.objects,f,e):this._loop(l.subjects,e))}getPredicates(e,n,r){const o=[];return this.forPredicates(a=>{o.push(a)},e,n,r),o}forPredicates(e,n,r,o){const a=this._getGraphs(o);let l,u,f;if(e=this._uniqueEntities(e),!(n&&!(u=this._termToNumericId(n))||r&&!(f=this._termToNumericId(r))))for(o in a)(l=a[o])&&(u?f?this._loopBy2Keys(l.objects,f,u,e):this._loopByKey0(l.subjects,u,e):f?this._loopByKey1(l.predicates,f,e):this._loop(l.predicates,e))}getObjects(e,n,r){const o=[];return this.forObjects(a=>{o.push(a)},e,n,r),o}forObjects(e,n,r,o){const a=this._getGraphs(o);let l,u,f;if(e=this._uniqueEntities(e),!(n&&!(u=this._termToNumericId(n))||r&&!(f=this._termToNumericId(r))))for(o in a)(l=a[o])&&(u?f?this._loopBy2Keys(l.subjects,u,f,e):this._loopByKey1(l.objects,u,e):f?this._loopByKey0(l.predicates,f,e):this._loop(l.objects,e))}getGraphs(e,n,r){const o=[];return this.forGraphs(a=>{o.push(a)},e,n,r),o}forGraphs(e,n,r,o){for(const a in this._graphs)this.some(l=>(e(l.graph),!0),n,r,o,this._termFromId(this._entities[a]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:n=!1}={}){const r={},o=n?(()=>!0):((u,f)=>{throw new Error(`${u.value} ${f}`)}),a=this.getQuads(null,Lt.rdf.rest,Lt.rdf.nil,null),l=e?[...a]:[];return a.forEach(u=>{const f=[];let h=!1,g,m;const d=u.graph;let _=u.subject;for(;_&&!h;){const b=this.getQuads(null,null,_,null),I=this.getQuads(_,null,null,null);let A,N=null,P=null,w=null;for(let y=0;y<I.length&&!h;y++)A=I[y],A.graph.equals(d)?g?h=o(_,"has non-list arcs out"):A.predicate.value===Lt.rdf.first?N?h=o(_,"has multiple rdf:first arcs"):l.push(N=A):A.predicate.value===Lt.rdf.rest?P?h=o(_,"has multiple rdf:rest arcs"):l.push(P=A):b.length?h=o(_,"can't be subject and object"):(g=A,m="subject"):h=o(_,"not confined to single graph");for(let y=0;y<b.length&&!h;++y)A=b[y],g?h=o(_,"can't have coreferences"):A.predicate.value===Lt.rdf.rest?w?h=o(_,"has incoming rdf:rest arcs"):w=A:(g=A,m="object");N?f.unshift(N.object):h=o(_,"has no list head"),_=w&&w.subject}h?e=!1:g&&(r[g[m].value]=f)}),e&&this.removeQuads(l),r}addAll(e){if(e instanceof Un&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof It&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=$r(this._graphs,e._graphs),this._size=null);else for(const n of e)this.add(n);return this}contains(e){if(e instanceof Un&&(e=e.filtered),e===this)return!0;if(!(e instanceof It)||this._entityIndex!==e._entityIndex)return e.every(h=>this.has(h));const n=this._graphs,r=e._graphs;let o,a,l,u,f;for(const h in r){if(!(o=n[h]))return!1;o=o.subjects;for(const g in a=r[h].subjects){if(!(l=o[g]))return!1;for(const m in u=a[g]){if(!(f=l[m]))return!1;for(const d in u[m])if(!(d in f))return!1}}}return!0}deleteMatches(e,n,r,o){for(const a of this.match(e,n,r,o))this.removeQuad(a);return this}difference(e){if(e&&e instanceof Un&&(e=e.filtered),e===this)return new It({entityIndex:this._entityIndex});if(e instanceof It&&e._entityIndex===this._entityIndex){const n=new It({entityIndex:this._entityIndex}),r=Ef(this._graphs,e._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(n=>!e.has(n))}equals(e){return e instanceof Un&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const n=new It({entityIndex:this._entityIndex});for(const r of this)e(r,this)&&n.add(r);return n}intersection(e){if(e instanceof Un&&(e=e.filtered),e===this){const n=new It({entityIndex:this._entityIndex});return n._graphs=$r(Object.create(null),this._graphs),n._size=this._size,n}else if(e instanceof It&&this._entityIndex===e._entityIndex){const n=new It({entityIndex:this._entityIndex}),r=xf(e._graphs,this._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(n=>e.has(n))}map(e){const n=new It({entityIndex:this._entityIndex});for(const r of this)n.add(e(r,this));return n}reduce(e,n){const r=this.readQuads();let o=n===void 0?r.next().value:n;for(const a of r)o=e(o,a,this);return o}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new kl().quadsToString(this)}union(e){const n=new It({entityIndex:this._entityIndex});return n._graphs=$r(Object.create(null),this._graphs),n._size=this._size,n.addAll(e),n}*[Symbol.iterator](){yield*this.readQuads()}}function yn(i,e,n=0){const r=e[n];if(r&&!(r in i))return!1;let o=!1;for(const a in r?{[r]:i[r]}:i){const l=n===2?null:yn(i[a],e,n+1);l!==!1&&(o=o||Object.create(null),o[a]=l)}return o}class Un extends Fl.Readable{constructor(e,n,r,o,a,l){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:n,predicate:r,object:o,graph:a,options:l})}get filtered(){if(!this._filtered){const{n3Store:e,graph:n,object:r,predicate:o,subject:a}=this,l=this._filtered=new It({factory:e._factory,entityIndex:this.options.entityIndex});let u,f,h;if(a&&!(u=l._termToNumericId(a))||o&&!(f=l._termToNumericId(o))||r&&!(h=l._termToNumericId(r)))return l;const g=e._getGraphs(n);for(const m in g){let d,_,b,I;(I=g[m])&&(!u&&f?(_=yn(I.predicates,[f,h,u]))&&(d=yn(I.subjects,[u,f,h]),b=yn(I.objects,[h,u,f])):h?(b=yn(I.objects,[h,u,f]))&&(d=yn(I.subjects,[u,f,h]),_=yn(I.predicates,[f,h,u])):(d=yn(I.subjects,[u,f,h]))&&(_=yn(I.predicates,[f,h,u]),b=yn(I.objects,[h,u,f])),d&&(l._graphs[m]={subjects:d,predicates:_,objects:b}))}l._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[aa]&&(this[aa]=this[Symbol.iterator]());const n=this[aa];for(;--e>=0;){const{done:r,value:o}=n.next();if(r){this.push(null);return}this.push(o)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,n,r,o){return this.filtered.deleteMatches(e,n,r,o)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,n,r,o,a){return this.filtered.every(e,n,r,o,a)}filter(e){return this.filtered.filter(e)}forEach(e,n,r,o,a){return this.filtered.forEach(e,n,r,o,a)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,n,r,o,a){return this.filtered.some(e,n,r,o,a)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,n){return this.filtered.reduce(e,n)}toString(){return new kl().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,n,r,o){return new Un(this.filtered,e,n,r,o,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Xg extends Fl.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const n=new hf(e);let r,o;const a={onQuad:(l,u)=>{l&&this.emit("error",l)||u&&this.push(u)},onPrefix:(l,u)=>{this.emit("prefix",l,u)}};e&&e.comments&&(a.onComment=l=>{this.emit("comment",l)}),n.parse({on:(l,u)=>{switch(l){case"data":r=u;break;case"end":o=u;break}}},a),this._transform=(l,u,f)=>{r(l),f()},this._flush=l=>{o(),l()}}import(e){return e.on("data",n=>{this.write(n)}),e.on("end",()=>{this.end()}),e.on("error",n=>{this.emit("error",n)}),this}}const Fe="http://www.w3.org/ns/shacl#",Bc="http://datashapes.org/dash#",Cn="http://www.w3.org/2001/XMLSchema#",yi="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Js="http://www.w3.org/2000/01/rdf-schema#",jl="http://www.w3.org/2004/02/skos/core#",Qg="http://www.w3.org/2002/07/owl#",Jg="http://www.w3.org/ns/oa#",Bl="http://purl.org/dc/terms/",Kg="http://xmlns.com/foaf/0.1/",an=Be.namedNode("loaded-shapes"),Ft=Be.namedNode("loaded-data"),Rt=Be.namedNode(yi+"type"),Sf=Be.namedNode(yi+"langString"),Fs=Be.namedNode(Bl+"conformsTo"),$c=Be.namedNode(Js+"subClassOf"),$l=Be.namedNode(Qg+"imports"),Yg=Be.namedNode(jl+"broader"),em=Be.namedNode(jl+"narrower"),la=Be.namedNode(Fe+"NodeShape"),Tf=Be.namedNode(Fe+"IRI"),wl=Be.namedNode(Fe+"property"),ql=Be.namedNode(Fe+"class"),tm=Be.namedNode(Fe+"node"),Ks=Be.namedNode(Fe+"targetClass"),nm=Be.namedNode(Fe+"nodeKind"),im=Be.namedNode(Cn+"string"),rm=Be.namedNode(Cn+"boolean");function Hi(i,e,n=Fe,r){let o="";const a=sm(i,e,n,r);return a&&(o=a.value),o}function sm(i,e,n=Fe,r){let o;const a=n+e;if(r?.length){for(const l of r)for(const u of i)if(u.predicate.value===a){if(u.object.id.endsWith(`@${l}`))return u.object;u.object.id.indexOf("@")<0?o=u.object:o||(o=u.object)}}else for(const l of i)if(l.predicate.value===a)return l.object;return o}function om(i){i.querySelector(".editor")?.focus()}function Zn(i,e){return Hi(i,"prefLabel",jl,e)||Hi(i,"label",Js,e)||Hi(i,"title",Bl,e)||Hi(i,"name",Kg,e)}function Lf(i,e,n){const r=[];for(const o of i)r.push({value:o,label:Zn(e.getQuads(o,null,null,null),n),children:[]});return r}function xl(i,e){for(const n in e){const r=e[n];i.startsWith(r)&&(i=i.slice(r.length))}return i}function If(i,e,n,r,o=new Set){for(const a of e.owlImports)o.has(a.id)||(o.add(a.id),r.push(...n.getSubjects(Rt,i,a)));e.parent&&If(i,e.parent,n,r,o)}function Af(i,e){if(e.in){const n=e.config.lists[e.in];return Lf(n?.length?n:[],e.config.store,e.config.languages)}else{const n=e.config.store.getSubjects(Rt,i,an);n.push(...e.config.store.getSubjects(Rt,i,Ft)),If(i,e,e.config.store,n);const r=new Map,o=new Map;for(const l of n)r.set(l.id,{value:l,label:Zn(e.config.store.getQuads(l,null,null,null),e.config.languages),children:[]});for(const l of n){for(const u of e.config.store.getObjects(l,Yg,null))r.has(u.id)&&o.set(l.id,u.id);for(const u of e.config.store.getObjects(l,em,null))r.has(u.id)&&o.set(u.id,l.id);for(const u of e.config.store.getObjects(l,$c,null))r.has(u.id)&&o.set(l.id,u.id)}for(const[l,u]of o.entries())r.get(u)?.children?.push(r.get(l));const a=[];for(const[l,u]of r.entries())o.has(l)||a.push(u);for(const l of e.config.store.getSubjects($c,i,null))a.push(...Af(l,e));return a}}function El(i){let e;try{e=new URL(i)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function js(i,e,n){if(e===void 0)return n;if(n===void 0)return e;const r=i.indexOf(e.language);if(r<0)return n;const o=i.indexOf(n.language);return o<0||o>r?e:n}function am(i){const e=new Set;for(const n of i.getObjects(null,ql,an))e.add(n.value);for(const n of i.getObjects(null,Ks,an))e.add(n.value);return e}function lm(i,e){return i instanceof Set?[...e].filter(n=>!i.has(n)):[...e].filter(n=>!i.includes(n))}function um(i,{remove:e=!1,ignoreErrors:n=!1}={}){const r={},o=n?(()=>!0):((u,f)=>{throw new Error(`${u.value} ${f}`)}),a=i.getQuads(null,yi+"rest",yi+"nil",null),l=e?[...a]:[];return a.forEach(u=>{const f=[];let h=!1,g,m;const d=u.graph;let _=u.subject;for(;_&&!h;){const b=i.getQuads(null,null,_,null),I=i.getQuads(_,null,null,null).filter(y=>!y.predicate.equals(Rt));let A,N=null,P=null,w=null;for(let y=0;y<I.length&&!h;y++)A=I[y],A.graph.equals(d)?g?h=o(_,"has non-list arcs out"):A.predicate.value===yi+"first"?N?h=o(_,"has multiple rdf:first arcs"):l.push(N=A):A.predicate.value===yi+"rest"?P?h=o(_,"has multiple rdf:rest arcs"):l.push(P=A):b.length?h=o(_,"can't be subject and object"):(g=A,m="subject"):h=o(_,"not confined to single graph");for(let y=0;y<b.length&&!h;++y)A=b[y],g?h=o(_,"can't have coreferences"):A.predicate.value===yi+"rest"?w?h=o(_,"has incoming rdf:rest arcs"):w=A:(g=A,m="object");N?f.unshift(N.object):h=o(_,"has no list head"),_=w&&w.subject}h?e=!1:g&&(r[g[m].value]=f)}),e&&i.removeQuads(l),r}var li={},ui={},ci={},An={},qc;function cm(){if(qc)return An;qc=1,Object.defineProperty(An,"__esModule",{value:!0}),An.removeDotSegmentsOfPath=An.removeDotSegments=An.resolve=void 0;function i(o,a){a=a||"";const l=a.indexOf("#");if(l>0&&(a=a.substr(0,l)),!o.length){if(a.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${a}' for value '${o}'`);return a}if(o.startsWith("?")){const _=a.indexOf("?");return _>0&&(a=a.substr(0,_)),a+o}if(o.startsWith("#"))return a+o;if(!a.length){const _=o.indexOf(":");if(_<0)throw new Error(`Found invalid relative IRI '${o}' for a missing baseIRI`);return n(o,_)}const u=o.indexOf(":");if(u>=0)return n(o,u);const f=a.indexOf(":");if(f<0)throw new Error(`Found invalid baseIRI '${a}' for value '${o}'`);const h=a.substr(0,f+1);if(o.indexOf("//")===0)return h+n(o,u);let g;if(a.indexOf("//",f)===f+1){if(g=a.indexOf("/",f+3),g<0)return a.length>f+3?a+"/"+n(o,u):h+n(o,u)}else if(g=a.indexOf("/",f+1),g<0)return h+n(o,u);if(o.indexOf("/")===0)return a.substr(0,g)+e(o);let m=a.substr(g);const d=m.lastIndexOf("/");return d>=0&&d<m.length-1&&(m=m.substr(0,d+1),o[0]==="."&&o[1]!=="."&&o[1]!=="/"&&o[2]&&(o=o.substr(1))),o=m+o,o=e(o),a.substr(0,g)+o}An.resolve=i;function e(o){const a=[];let l=0;for(;l<o.length;)switch(o[l]){case"/":if(o[l+1]===".")if(o[l+2]==="."){if(!r(o[l+3])){a.push([]),l++;break}a.pop(),o[l+3]||a.push([]),l+=3}else{if(!r(o[l+2])){a.push([]),l++;break}o[l+2]||a.push([]),l+=2}else a.push([]),l++;break;case"#":case"?":a.length||a.push([]),a[a.length-1].push(o.substr(l)),l=o.length;break;default:a.length||a.push([]),a[a.length-1].push(o[l]),l++;break}return"/"+a.map(u=>u.join("")).join("/")}An.removeDotSegments=e;function n(o,a){let l=a+1;a>=0?o[a+1]==="/"&&o[a+2]==="/"&&(l=a+3):o[0]==="/"&&o[1]==="/"&&(l=2);const u=o.indexOf("/",l);if(u<0)return o;const f=o.substr(0,u),h=o.substr(u);return f+e(h)}An.removeDotSegmentsOfPath=n;function r(o){return!o||o==="#"||o==="?"||o==="/"}return An}var zc;function dm(){return zc||(zc=1,(function(i){var e=ci&&ci.__createBinding||(Object.create?(function(r,o,a,l){l===void 0&&(l=a),Object.defineProperty(r,l,{enumerable:!0,get:function(){return o[a]}})}):(function(r,o,a,l){l===void 0&&(l=a),r[l]=o[a]})),n=ci&&ci.__exportStar||function(r,o){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,r,a)};Object.defineProperty(i,"__esModule",{value:!0}),n(cm(),i)})(ci)),ci}var di={},ua={},Hc;function hm(){return Hc||(Hc=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.CHAR=`
|
|
23
|
-
|
|
24
|
-
`,
|
|
25
|
-
`,i.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",i.NAME_CHAR="-"+i.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",i.CHAR_RE=new RegExp("^["+i.CHAR+"]$","u"),i.RESTRICTED_CHAR_RE=new RegExp("^["+i.RESTRICTED_CHAR+"]$","u"),i.S_RE=new RegExp("^["+i.S+"]+$","u"),i.NAME_START_CHAR_RE=new RegExp("^["+i.NAME_START_CHAR+"]$","u"),i.NAME_CHAR_RE=new RegExp("^["+i.NAME_CHAR+"]$","u"),i.NAME_RE=new RegExp("^["+i.NAME_START_CHAR+"]["+i.NAME_CHAR+"]*$","u"),i.NMTOKEN_RE=new RegExp("^["+i.NAME_CHAR+"]+$","u");var e=9,n=10,r=13,o=32;i.S_LIST=[o,n,r,e];function a(m){return m>=1&&m<=55295||m>=57344&&m<=65533||m>=65536&&m<=1114111}i.isChar=a;function l(m){return m>=1&&m<=8||m===11||m===12||m>=14&&m<=31||m>=127&&m<=132||m>=134&&m<=159}i.isRestrictedChar=l;function u(m){return m===9||m===10||m===13||m>31&&m<127||m===133||m>159&&m<=55295||m>=57344&&m<=65533||m>=65536&&m<=1114111}i.isCharAndNotRestricted=u;function f(m){return m===o||m===n||m===r||m===e}i.isS=f;function h(m){return m>=65&&m<=90||m>=97&&m<=122||m===58||m===95||m===8204||m===8205||m>=192&&m<=214||m>=216&&m<=246||m>=248&&m<=767||m>=880&&m<=893||m>=895&&m<=8191||m>=8304&&m<=8591||m>=11264&&m<=12271||m>=12289&&m<=55295||m>=63744&&m<=64975||m>=65008&&m<=65533||m>=65536&&m<=983039}i.isNameStartChar=h;function g(m){return h(m)||m>=48&&m<=57||m===45||m===46||m===183||m>=768&&m<=879||m>=8255&&m<=8256}i.isNameChar=g})(ca)),ca}var da={},Vc;function pm(){return Vc||(Vc=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",i.NC_NAME_CHAR="-"+i.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",i.NC_NAME_START_CHAR_RE=new RegExp("^["+i.NC_NAME_START_CHAR+"]$","u"),i.NC_NAME_CHAR_RE=new RegExp("^["+i.NC_NAME_CHAR+"]$","u"),i.NC_NAME_RE=new RegExp("^["+i.NC_NAME_START_CHAR+"]["+i.NC_NAME_CHAR+"]*$","u");function e(r){return r>=65&&r<=90||r===95||r>=97&&r<=122||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||r>=65536&&r<=983039}i.isNCNameStartChar=e;function n(r){return e(r)||r===45||r===46||r>=48&&r<=57||r===183||r>=768&&r<=879||r>=8255&&r<=8256}i.isNCNameChar=n})(da)),da}var Wc;function gm(){if(Wc)return di;Wc=1,Object.defineProperty(di,"__esModule",{value:!0}),di.SaxesParser=di.EVENTS=void 0;const i=hm(),e=fm(),n=pm();var r=i.isS,o=i.isChar,a=i.isNameStartChar,l=i.isNameChar,u=i.S_LIST,f=i.NAME_RE,h=e.isChar,g=n.isNCNameStartChar,m=n.isNCNameChar,d=n.NC_NAME_RE;const _="http://www.w3.org/XML/1998/namespace",b="http://www.w3.org/2000/xmlns/",I={__proto__:null,xml:_,xmlns:b},A={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},N=-1,P=-2,w=0,y=1,S=2,O=3,X=4,C=5,U=6,R=7,$=8,G=9,j=10,F=11,se=12,M=13,re=14,B=15,oe=16,T=17,Q=18,ie=19,Y=20,me=21,Z=22,W=23,ee=24,K=25,ue=26,ce=27,Ee=28,Te=29,q=30,te=31,fe=32,xe=33,Se=34,Ie=35,le=36,be=37,Ae=38,ve=39,qe=40,mt=41,$e=42,ft=43,k=44,v=9,x=10,H=13,ae=32,_e=33,we=34,Oe=38,Ye=39,Qe=45,Ge=47,Ze=59,$t=60,en=61,st=62,at=63,Ai=91,hn=93,Fn=133,ei=8232,z=it=>it===we||it===Ye,J=[we,Ye],Ne=[...J,Ai,st],Re=[...J,$t,hn],De=[en,at,...u],_t=[...u,st,Oe,$t];function wt(it,V,de){switch(V){case"xml":de!==_&&it.fail(`xml prefix must be bound to ${_}.`);break;case"xmlns":de!==b&&it.fail(`xmlns prefix must be bound to ${b}.`);break}switch(de){case b:it.fail(V===""?`the default namespace may not be set to ${de}.`:`may not assign a prefix (even "xmlns") to the URI ${b}.`);break;case _:switch(V){case"xml":break;case"":it.fail(`the default namespace may not be set to ${de}.`);break;default:it.fail("may not assign the xml namespace to another prefix.")}break}}function At(it,V){for(const de of Object.keys(V))wt(it,de,V[de])}const ke=it=>d.test(it),ti=it=>f.test(it),Wt=0,jn=1,En=2;di.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const fn={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class Bn{get closed(){return this._closed}constructor(V){this.opt=V??{},this.fragmentOpt=!!this.opt.fragment;const de=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,de){this.nameStartCheck=g,this.nameCheck=m,this.isName=ke,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},I);const pe=this.opt.additionalNamespaces;pe!=null&&(At(this,pe),Object.assign(this.ns,pe))}else this.nameStartCheck=a,this.nameCheck=l,this.isName=ti,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var V;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Wt,this.attribList=[];const{fragmentOpt:de}=this;this.state=de?M:w,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=de,this.xmlDeclPossible=!de,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:pe}=this.opt;if(pe===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");pe="1.0"}this.setXMLVersion(pe),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(A),(V=this.readyHandler)===null||V===void 0||V.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(V,de){this[fn[V]]=de}off(V){this[fn[V]]=void 0}makeError(V){var de;let pe=(de=this.fileName)!==null&&de!==void 0?de:"";return this.trackPosition&&(pe.length>0&&(pe+=":"),pe+=`${this.line}:${this.column}`),pe.length>0&&(pe+=": "),new Error(pe+V)}fail(V){const de=this.makeError(V),pe=this.errorHandler;if(pe===void 0)throw de;return pe(de),this}write(V){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let de=!1;V===null?(de=!0,V=""):typeof V=="object"&&(V=V.toString()),this.carriedFromPrevious!==void 0&&(V=`${this.carriedFromPrevious}${V}`,this.carriedFromPrevious=void 0);let pe=V.length;const Pe=V.charCodeAt(pe-1);!de&&(Pe===H||Pe>=55296&&Pe<=56319)&&(this.carriedFromPrevious=V[pe-1],pe--,V=V.slice(0,pe));const{stateTable:Ue}=this;for(this.chunk=V,this.i=0;this.i<pe;)Ue[this.state].call(this);return this.chunkPosition+=pe,de?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:V,i:de}=this;if(this.prevI=de,this.i=de+1,de>=V.length)return N;const pe=V.charCodeAt(de);if(this.column++,pe<55296){if(pe>=ae||pe===v)return pe;switch(pe){case x:return this.line++,this.column=0,this.positionAtNewLine=this.position,x;case H:return V.charCodeAt(de+1)===x&&(this.i=de+2),this.line++,this.column=0,this.positionAtNewLine=this.position,P;default:return this.fail("disallowed character."),pe}}if(pe>56319)return pe>=57344&&pe<=65533||this.fail("disallowed character."),pe;const Pe=65536+(pe-55296)*1024+(V.charCodeAt(de+1)-56320);return this.i=de+2,Pe>1114111&&this.fail("disallowed character."),Pe}getCode11(){const{chunk:V,i:de}=this;if(this.prevI=de,this.i=de+1,de>=V.length)return N;const pe=V.charCodeAt(de);if(this.column++,pe<55296){if(pe>31&&pe<127||pe>159&&pe!==ei||pe===v)return pe;switch(pe){case x:return this.line++,this.column=0,this.positionAtNewLine=this.position,x;case H:{const Ue=V.charCodeAt(de+1);(Ue===x||Ue===Fn)&&(this.i=de+2)}case Fn:case ei:return this.line++,this.column=0,this.positionAtNewLine=this.position,P;default:return this.fail("disallowed character."),pe}}if(pe>56319)return pe>=57344&&pe<=65533||this.fail("disallowed character."),pe;const Pe=65536+(pe-55296)*1024+(V.charCodeAt(de+1)-56320);return this.i=de+2,Pe>1114111&&this.fail("disallowed character."),Pe}getCodeNorm(){const V=this.getCode();return V===P?x:V}unget(){this.i=this.prevI,this.column--}captureTo(V){let{i:de}=this;const{chunk:pe}=this;for(;;){const Pe=this.getCode(),Ue=Pe===P,Je=Ue?x:Pe;if(Je===N||V.includes(Je))return this.text+=pe.slice(de,this.prevI),Je;Ue&&(this.text+=`${pe.slice(de,this.prevI)}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
`,V=this.i;break;case Ze:{const{entityReturnState:pe}=this,Pe=this.entity+de.slice(V,this.prevI);this.state=pe;let Ue;Pe===""?(this.fail("empty entity name."),Ue="&;"):(Ue=this.parseEntity(Pe),this.entity=""),(pe!==M||this.textHandler!==void 0)&&(this.text+=Ue);break e}case N:this.entity+=de.slice(V);break e}}sOpenWaka(){const V=this.getCode();if(a(V))this.state=Se,this.unget(),this.xmlDeclPossible=!1;else switch(V){case Ge:this.state=ft,this.xmlDeclPossible=!1;break;case _e:this.state=oe,this.openWakaBang="",this.xmlDeclPossible=!1;break;case at:this.state=W;break;default:this.fail("disallowed character in tag name"),this.state=M,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=Y,this.openWakaBang="";break;case"--":this.state=T,this.openWakaBang="";break;case"DOCTYPE":this.state=S,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(Qe)&&(this.state=Q)}sCommentEnding(){var V;const de=this.getCodeNorm();de===Qe?(this.state=ie,(V=this.commentHandler)===null||V===void 0||V.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(de)}`,this.state=T)}sCommentEnded(){const V=this.getCodeNorm();V!==st?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(V)}`,this.state=T):this.state=M}sCData(){this.captureToChar(hn)&&(this.state=me)}sCDataEnding(){const V=this.getCodeNorm();V===hn?this.state=Z:(this.text+=`]${String.fromCodePoint(V)}`,this.state=Y)}sCDataEnding2(){var V;const de=this.getCodeNorm();switch(de){case st:{(V=this.cdataHandler)===null||V===void 0||V.call(this,this.text),this.text="",this.state=M;break}case hn:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(de)}`,this.state=Y}}sPIFirstChar(){const V=this.getCodeNorm();this.nameStartCheck(V)?(this.piTarget+=String.fromCodePoint(V),this.state=ee):V===at||r(V)?(this.fail("processing instruction without a target."),this.state=V===at?ue:K):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(V),this.state=ee)}sPIRest(){const{chunk:V,i:de}=this;for(;;){const pe=this.getCodeNorm();if(pe===N){this.piTarget+=V.slice(de);return}if(!this.nameCheck(pe)){this.piTarget+=V.slice(de,this.prevI);const Pe=pe===at;Pe||r(pe)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=Pe?xe:ce):this.state=Pe?ue:K:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(pe));break}}}sPIBody(){if(this.text.length===0){const V=this.getCodeNorm();V===at?this.state=ue:r(V)||(this.text=String.fromCodePoint(V))}else this.captureToChar(at)&&(this.state=ue)}sPIEnding(){var V;const de=this.getCodeNorm();if(de===st){const{piTarget:pe}=this;pe.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(V=this.piHandler)===null||V===void 0||V.call(this,{target:pe,body:this.text}),this.piTarget=this.text="",this.state=M}else de===at?this.text+="?":(this.text+=`?${String.fromCodePoint(de)}`,this.state=K);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const V=this.skipSpaces();if(V===at){this.state=xe;return}V!==N&&(this.state=Ee,this.name=String.fromCodePoint(V))}sXMLDeclName(){const V=this.captureTo(De);if(V===at){this.state=xe,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(r(V)||V===en){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=V===en?q:Te}}sXMLDeclEq(){const V=this.getCodeNorm();if(V===at){this.state=xe,this.fail("XML declaration is incomplete.");return}r(V)||(V!==en&&this.fail("value required."),this.state=q)}sXMLDeclValueStart(){const V=this.getCodeNorm();if(V===at){this.state=xe,this.fail("XML declaration is incomplete.");return}r(V)||(z(V)?this.q=V:(this.fail("value must be quoted."),this.q=ae),this.state=te)}sXMLDeclValue(){const V=this.captureTo([this.q,at]);if(V===at){this.state=xe,this.text="",this.fail("XML declaration is incomplete.");return}if(V===N)return;const de=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const pe=de;this.xmlDecl.version=pe,/^1\.[0-9]+$/.test(pe)?this.opt.forceXMLVersion||this.setXMLVersion(pe):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(de)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=de;break;case"standalone":de!=="yes"&&de!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=de;break}this.name="",this.state=fe}sXMLDeclSeparator(){const V=this.getCodeNorm();if(V===at){this.state=xe;return}r(V)||(this.fail("whitespace required."),this.unget()),this.state=ce}sXMLDeclEnding(){var V;this.getCodeNorm()===st?(this.piTarget!=="xml"?this.fail("processing instructions are not allowed before root."):this.name!=="version"&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),(V=this.xmldeclHandler)===null||V===void 0||V.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=M):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var V;const de=this.captureNameChars();if(de===N)return;const pe=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=pe.ns=Object.create(null)),(V=this.openTagStartHandler)===null||V===void 0||V.call(this,pe),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),de){case st:this.openTag();break;case Ge:this.state=Ie;break;default:r(de)||this.fail("disallowed character in tag name."),this.state=le}}sOpenTagSlash(){this.getCode()===st?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=le)}sAttrib(){const V=this.skipSpaces();V!==N&&(a(V)?(this.unget(),this.state=be):V===st?this.openTag():V===Ge?this.state=Ie:this.fail("disallowed character in attribute name."))}sAttribName(){const V=this.captureNameChars();V===en?this.state=ve:r(V)?this.state=Ae:V===st?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):V!==N&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const V=this.skipSpaces();switch(V){case N:return;case en:this.state=ve;break;default:this.fail("attribute without value."),this.text="",this.name="",V===st?this.openTag():a(V)?(this.unget(),this.state=be):(this.fail("disallowed character in attribute name."),this.state=le)}}sAttribValue(){const V=this.getCodeNorm();z(V)?(this.q=V,this.state=qe):r(V)||(this.fail("unquoted attribute value."),this.state=$e,this.unget())}sAttribValueQuoted(){const{q:V,chunk:de}=this;let{i:pe}=this;for(;;)switch(this.getCode()){case V:this.pushAttrib(this.name,this.text+de.slice(pe,this.prevI)),this.name=this.text="",this.q=null,this.state=mt;return;case Oe:this.text+=de.slice(pe,this.prevI),this.state=re,this.entityReturnState=qe;return;case x:case P:case v:this.text+=`${de.slice(pe,this.prevI)} `,pe=this.i;break;case $t:this.text+=de.slice(pe,this.prevI),this.fail("disallowed character.");return;case N:this.text+=de.slice(pe);return}}sAttribValueClosed(){const V=this.getCodeNorm();r(V)?this.state=le:V===st?this.openTag():V===Ge?this.state=Ie:a(V)?(this.fail("no whitespace between attributes."),this.unget(),this.state=be):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const V=this.captureTo(_t);switch(V){case Oe:this.state=re,this.entityReturnState=$e;break;case $t:this.fail("disallowed character.");break;case N:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",V===st?this.openTag():this.state=le}}sCloseTag(){const V=this.captureNameChars();V===st?this.closeTag():r(V)?this.state=k:V!==N&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case st:this.closeTag();break;case N:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:V,forbiddenState:de}=this;const{chunk:pe,textHandler:Pe}=this;e:for(;;)switch(this.getCode()){case $t:{if(this.state=B,Pe!==void 0){const{text:Ue}=this,Je=pe.slice(V,this.prevI);Ue.length!==0?(Pe(Ue+Je),this.text=""):Je.length!==0&&Pe(Je)}de=Wt;break e}case Oe:this.state=re,this.entityReturnState=M,Pe!==void 0&&(this.text+=pe.slice(V,this.prevI)),de=Wt;break e;case hn:switch(de){case Wt:de=jn;break;case jn:de=En;break;case En:break;default:throw new Error("impossible state")}break;case st:de===En&&this.fail('the string "]]>" is disallowed in char data.'),de=Wt;break;case P:Pe!==void 0&&(this.text+=`${pe.slice(V,this.prevI)}
|
|
29
|
-
|
|
30
|
-
`),V=this.i;break;case N:pe!==void 0&&(this.text+=de.slice(V));break e;default:r(Ue)||(Pe=!0)}}Pe&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(V,de){var pe;const{prefix:Pe,local:Ue}=this.qname(V),Je={name:V,prefix:Pe,local:Ue,value:de};if(this.attribList.push(Je),(pe=this.attributeHandler)===null||pe===void 0||pe.call(this,Je),Pe==="xmlns"){const xt=de.trim();this.currentXMLVersion==="1.0"&&xt===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Ue]=xt,wt(this,Ue,xt)}else if(V==="xmlns"){const xt=de.trim();this.topNS[""]=xt,wt(this,"",xt)}}pushAttribPlain(V,de){var pe;const Pe={name:V,value:de};this.attribList.push(Pe),(pe=this.attributeHandler)===null||pe===void 0||pe.call(this,Pe)}end(){var V,de;this.sawRoot||this.fail("document must contain a root element.");const{tags:pe}=this;for(;pe.length>0;){const Ue=pe.pop();this.fail(`unclosed tag: ${Ue.name}`)}this.state!==w&&this.state!==M&&this.fail("unexpected end.");const{text:Pe}=this;return Pe.length!==0&&((V=this.textHandler)===null||V===void 0||V.call(this,Pe),this.text=""),this._closed=!0,(de=this.endHandler)===null||de===void 0||de.call(this),this._init(),this}resolve(V){var de,pe;let Pe=this.topNS[V];if(Pe!==void 0)return Pe;const{tags:Ue}=this;for(let Je=Ue.length-1;Je>=0;Je--)if(Pe=Ue[Je].ns[V],Pe!==void 0)return Pe;return Pe=this.ns[V],Pe!==void 0?Pe:(pe=(de=this.opt).resolvePrefix)===null||pe===void 0?void 0:pe.call(de,V)}qname(V){const de=V.indexOf(":");if(de===-1)return{prefix:"",local:V};const pe=V.slice(de+1),Pe=V.slice(0,de);return(Pe===""||pe===""||pe.includes(":"))&&this.fail(`malformed name: ${V}.`),{prefix:Pe,local:pe}}processAttribsNS(){var V;const{attribList:de}=this,pe=this.tag;{const{prefix:Je,local:xt}=this.qname(pe.name);pe.prefix=Je,pe.local=xt;const tn=pe.uri=(V=this.resolve(Je))!==null&&V!==void 0?V:"";Je!==""&&(Je==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),tn===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(Je)}.`),pe.uri=Je))}if(de.length===0)return;const{attributes:Pe}=pe,Ue=new Set;for(const Je of de){const{name:xt,prefix:tn,local:ao}=Je;let $n,ni;tn===""?($n=xt==="xmlns"?b:"",ni=xt):($n=this.resolve(tn),$n===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(tn)}.`),$n=tn),ni=`{${$n}}${ao}`),Ue.has(ni)&&this.fail(`duplicate attribute: ${ni}.`),Ue.add(ni),Je.uri=$n,Pe[xt]=Je}this.attribList=[]}processAttribsPlain(){const{attribList:V}=this,de=this.tag.attributes;for(const{name:pe,value:Pe}of V)de[pe]!==void 0&&this.fail(`duplicate attribute: ${pe}.`),de[pe]=Pe;this.attribList=[]}openTag(){var V;this.processAttribs();const{tags:de}=this,pe=this.tag;pe.isSelfClosing=!1,(V=this.openTagHandler)===null||V===void 0||V.call(this,pe),de.push(pe),this.state=M,this.name=""}openSelfClosingTag(){var V,de,pe;this.processAttribs();const{tags:Pe}=this,Ue=this.tag;Ue.isSelfClosing=!0,(V=this.openTagHandler)===null||V===void 0||V.call(this,Ue),(de=this.closeTagHandler)===null||de===void 0||de.call(this,Ue),(this.tag=(pe=Pe[Pe.length-1])!==null&&pe!==void 0?pe:null)===null&&(this.closedRoot=!0),this.state=M,this.name=""}closeTag(){const{tags:V,name:de}=this;if(this.state=M,this.name="",de===""){this.fail("weird empty close tag."),this.text+="</>";return}const pe=this.closeTagHandler;let Pe=V.length;for(;Pe-- >0;){const Ue=this.tag=V.pop();if(this.topNS=Ue.ns,pe?.(Ue),Ue.name===de)break;this.fail("unexpected close tag.")}Pe===0?this.closedRoot=!0:Pe<0&&(this.fail(`unmatched closing tag: ${de}.`),this.text+=`</${de}>`)}parseEntity(V){if(V[0]!=="#"){const pe=this.ENTITIES[V];return pe!==void 0?pe:(this.fail(this.isName(V)?"undefined entity.":"disallowed character in entity name."),`&${V};`)}let de=NaN;return V[1]==="x"&&/^#x[0-9a-f]+$/i.test(V)?de=parseInt(V.slice(2),16):/^#[0-9]+$/.test(V)&&(de=parseInt(V.slice(1),10)),this.isChar(de)?String.fromCodePoint(de):(this.fail("malformed character entity."),`&${V};`)}}return di.SaxesParser=Bn,di}var vr={},Gc;function mm(){if(Gc)return vr;Gc=1,Object.defineProperty(vr,"__esModule",{value:!0}),vr.ParseError=void 0;let i=class extends Error{constructor(n,r){const o=n.saxParser;super(n.trackPosition?`Line ${o.line} column ${o.column+1}: ${r}`:r)}};return vr.ParseError=i,vr}var hi={},br={},Zc;function Nf(){if(Zc)return br;Zc=1,Object.defineProperty(br,"__esModule",{value:!0}),br.BlankNode=void 0;class i{constructor(n){this.termType="BlankNode",this.value=n}equals(n){return!!n&&n.termType==="BlankNode"&&n.value===this.value}}return br.BlankNode=i,br}var wr={},xr={},Xc;function Rf(){if(Xc)return xr;Xc=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.DefaultGraph=void 0;class i{constructor(){this.termType="DefaultGraph",this.value=""}equals(n){return!!n&&n.termType==="DefaultGraph"}}return xr.DefaultGraph=i,i.INSTANCE=new i,xr}var Er={},Sr={},Qc;function zl(){if(Qc)return Sr;Qc=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.NamedNode=void 0;class i{constructor(n){this.termType="NamedNode",this.value=n}equals(n){return!!n&&n.termType==="NamedNode"&&n.value===this.value}}return Sr.NamedNode=i,Sr}var Jc;function Cf(){if(Jc)return Er;Jc=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.Literal=void 0;const i=zl();class e{constructor(r,o){this.termType="Literal",this.value=r,typeof o=="string"?(this.language=o,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=""):o?"termType"in o?(this.language="",this.datatype=o,this.direction=""):(this.language=o.language,this.datatype=o.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=o.direction||""):(this.language="",this.datatype=e.XSD_STRING,this.direction="")}equals(r){return!!r&&r.termType==="Literal"&&r.value===this.value&&r.language===this.language&&(r.direction===this.direction||!r.direction&&this.direction==="")&&this.datatype.equals(r.datatype)}}return Er.Literal=e,e.RDF_LANGUAGE_STRING=new i.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.RDF_DIRECTIONAL_LANGUAGE_STRING=new i.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),e.XSD_STRING=new i.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Er}var Tr={},Kc;function Pf(){if(Kc)return Tr;Kc=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.Quad=void 0;class i{constructor(n,r,o,a){this.termType="Quad",this.value="",this.subject=n,this.predicate=r,this.object=o,this.graph=a}equals(n){return!!n&&(n.termType==="Quad"||!n.termType)&&this.subject.equals(n.subject)&&this.predicate.equals(n.predicate)&&this.object.equals(n.object)&&this.graph.equals(n.graph)}}return Tr.Quad=i,Tr}var Lr={},Yc;function kf(){if(Yc)return Lr;Yc=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.Variable=void 0;class i{constructor(n){this.termType="Variable",this.value=n}equals(n){return!!n&&n.termType==="Variable"&&n.value===this.value}}return Lr.Variable=i,Lr}var ed;function _m(){if(ed)return wr;ed=1,Object.defineProperty(wr,"__esModule",{value:!0}),wr.DataFactory=void 0;const i=Nf(),e=Rf(),n=Cf(),r=zl(),o=Pf(),a=kf();let l=0;class u{constructor(h){this.blankNodeCounter=0,h=h||{},this.blankNodePrefix=h.blankNodePrefix||`df_${l++}_`}namedNode(h){return new r.NamedNode(h)}blankNode(h){return new i.BlankNode(h||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(h,g){return new n.Literal(h,g)}variable(h){return new a.Variable(h)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(h,g,m,d){return new o.Quad(h,g,m,d||this.defaultGraph())}fromTerm(h){switch(h.termType){case"NamedNode":return this.namedNode(h.value);case"BlankNode":return this.blankNode(h.value);case"Literal":return h.language?this.literal(h.value,h.language):h.datatype.equals(n.Literal.XSD_STRING)?this.literal(h.value):this.literal(h.value,this.fromTerm(h.datatype));case"Variable":return this.variable(h.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(h.subject),this.fromTerm(h.predicate),this.fromTerm(h.object),this.fromTerm(h.graph))}}fromQuad(h){return this.fromTerm(h)}resetBlankNodeCounter(){this.blankNodeCounter=0}}return wr.DataFactory=u,wr}var td;function Df(){return td||(td=1,(function(i){var e=hi&&hi.__createBinding||(Object.create?(function(r,o,a,l){l===void 0&&(l=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,l,u)}):(function(r,o,a,l){l===void 0&&(l=a),r[l]=o[a]})),n=hi&&hi.__exportStar||function(r,o){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,r,a)};Object.defineProperty(i,"__esModule",{value:!0}),n(Nf(),i),n(_m(),i),n(Rf(),i),n(Cf(),i),n(zl(),i),n(Pf(),i),n(kf(),i)})(hi)),hi}var fi={},ha={},nd;function ym(){return nd||(nd=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.validateIri=i.IriValidationStrategy=void 0;function e(){const u="[!$&'()*+,;=]",f="%[a-fA-F0-9]{2}",h="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",g=`${h}\\.${h}\\.${h}\\.${h}`,m="[a-fA-F0-9]{1,4}",d=`(${m}:${m}|${g})`,_=`((${m}:){6}${d}|::(${m}:){5}${d}|(${m})?::(${m}:){4}${d}|((${m}:){0,1}${m})?::(${m}:){3}${d}|((${m}:){0,2}${m})?::(${m}:){2}${d}|((${m}:){0,3}${m})?::${m}:${d}|((${m}:){0,4}${m})?::${d}|((${m}:){0,5}${m})?::${m}|((${m}:){0,6}${m})?::)`,b=`v[a-fA-F0-9]+\\.(${u}|${u}|":)+`,I=`\\[(${_}|${b})\\]`,A="[0-9]*",N="[a-zA-Z][a-zA-Z0-9+\\-.]*",w="[---]",O="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",X=`(${O}|${f}|${u}|[:@])*`,C=`(${X}|[\\/?])*`,U=`(${X}|${w}|[\\/?])*`,R=`(${X})+`,$=`(${X})*`,G="",j=`${R}(\\/${$})*`,F=`\\/(${R}(\\/${$})*)?`,se=`(\\/${$})*`,M=`(${O}|${f}|${u})*`,re=`(${I}|${g}|${M})`,T=`(\\/\\/${`(${`(${O}|${f}|${u}|:)*`}@)?${re}(:${A})?`}${se}|${F}|${j}|${G})`,Q=`^${N}:${T}(\\?${U})?(#${C})?$`;return new RegExp(Q,"u")}const n=e(),r=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var o;(function(l){l.Strict="strict",l.Pragmatic="pragmatic",l.None="none"})(o=i.IriValidationStrategy||(i.IriValidationStrategy={}));function a(l,u=o.Strict){switch(u){case o.Strict:return n.test(l)?void 0:new Error(`Invalid IRI according to RFC 3987: '${l}'`);case o.Pragmatic:return r.test(l)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${l}'`);case o.None:return;default:return new Error(`Not supported validation strategy "${u}"`)}}i.validateIri=a})(ha)),ha}var id;function vm(){return id||(id=1,(function(i){var e=fi&&fi.__createBinding||(Object.create?(function(r,o,a,l){l===void 0&&(l=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,l,u)}):(function(r,o,a,l){l===void 0&&(l=a),r[l]=o[a]})),n=fi&&fi.__exportStar||function(r,o){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,r,a)};Object.defineProperty(i,"__esModule",{value:!0}),n(ym(),i)})(fi)),fi}var rd;function bm(){if(rd)return ui;rd=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.ParseType=ui.RdfXmlParser=void 0;const i=dm(),e=gm(),n=wf(),r=mm(),o=Df(),a=vm();let l=class et extends n.Transform{constructor(h){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},h&&(Object.assign(this,h),this.options=h),this.dataFactory||(this.dataFactory=new o.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?a.IriValidationStrategy.Pragmatic:a.IriValidationStrategy.None),this.parseUnsupportedVersions=!!h?.parseUnsupportedVersions,this.version=h?.version,this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(h){const g=new n.PassThrough({readableObjectMode:!0});h.on("error",d=>m.emit("error",d)),h.on("data",d=>g.push(d)),h.on("end",()=>g.push(null));const m=g.pipe(new et(this.options));return m}_transform(h,g,m){if(this.version){const d=this.version;if(this.version=void 0,!this.isValidVersion(d))return m(this.newParseError(`Detected unsupported version as media type parameter: ${d}`))}try{this.saxParser.write(h)}catch(d){return m(d)}m()}newParseError(h){return new r.ParseError(this,h)}valueToUri(h,g){return this.uriToNamedNode((0,i.resolve)(h,g.baseIRI))}uriToNamedNode(h){const g=(0,a.validateIri)(h,this.iriValidationStrategy);if(g instanceof Error)throw this.newParseError(g.message);return this.dataFactory.namedNode(h)}validateNcname(h){if(!et.NCNAME_MATCHER.test(h))throw this.newParseError(`Not a valid NCName: ${h}`)}createLiteral(h,g){return this.dataFactory.literal(h,g.datatype?g.datatype:g.language?{language:g.language,direction:g.rdfVersion?g.direction:void 0}:void 0)}isValidVersion(h){return this.parseUnsupportedVersions||et.SUPPORTED_VERSIONS.includes(h)}attachSaxListeners(){this.saxParser.on("error",h=>this.emit("error",h)),this.saxParser.on("opentag",this.onTag.bind(this)),this.saxParser.on("text",this.onText.bind(this)),this.saxParser.on("cdata",this.onText.bind(this)),this.saxParser.on("closetag",this.onCloseTag.bind(this)),this.saxParser.on("doctype",this.onDoctype.bind(this))}onTag(h){const g=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let m=u.RESOURCE;if(g&&(g.hadChildren=!0,m=g.childrenParseType),g&&g.childrenStringTags){const _=h.name;let b="";for(const{key:P,value:w}of g.namespaces||[])b+=` ${P}="${w}"`;for(const P in h.attributes)b+=` ${P}="${h.attributes[P].value}"`;const A=`<${`${_}${b}`}>`;g.childrenStringTags.push(A);const N={childrenStringTags:g.childrenStringTags};N.childrenStringEmitClosingTag=`</${_}>`,this.activeTagStack.push(N);return}const d={};g?(d.language=g.language,d.direction=g.direction,d.baseIRI=g.baseIRI,d.childrenTripleTerms=g.childrenTripleTerms,d.rdfVersion=g.rdfVersion):d.baseIRI=this.baseIRI,this.activeTagStack.push(d),m===u.RESOURCE?this.onTagResource(h,d,g,!g):this.onTagProperty(h,d,g);for(const _ in h.attributes){const b=h.attributes[_];b.prefix==="xmlns"&&(d.namespaces||(d.namespaces=[]),d.namespaces.push({key:`${b.prefix}:${b.local}`,value:b.value}))}g&&g.namespaces&&(d.namespaces=[...d.namespaces||[],...g.namespaces])}onTagResource(h,g,m,d){g.childrenParseType=u.PROPERTY;let _=!0;if(h.uri===et.RDF){if(!d&&et.FORBIDDEN_NODE_ELEMENTS.indexOf(h.local)>=0)throw this.newParseError(`Illegal node element name: ${h.local}`);switch(h.local){case"RDF":g.childrenParseType=u.RESOURCE;case"Description":_=!1}}const b=[],I=[];let A=null,N=!1,P=!1,w=null;for(const y in h.attributes){const S=h.attributes[y];if(S.uri===et.RDF&&S.local==="version"){this.setVersion(g,S.value);continue}else if(m&&S.uri===et.RDF)switch(S.local){case"about":if(A)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${S.value} and ${A} where found.`);A=S.value;continue;case"ID":if(A)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${S.value} and ${A} where found.`);this.validateNcname(S.value),A="#"+S.value,N=!0;continue;case"nodeID":if(A)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${S.value} and ${A} where found.`);this.validateNcname(S.value),A=S.value,P=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":w=S.value;continue;case"aboutEach":throw this.newParseError("rdf:aboutEach is not supported.");case"aboutEachPrefix":throw this.newParseError("rdf:aboutEachPrefix is not supported.");case"li":throw this.newParseError("rdf:li on node elements are not supported.")}else if(S.uri===et.XML){if(S.local==="lang"){g.language=S.value===""?null:S.value.toLowerCase();continue}else if(S.local==="base"){g.baseIRI=(0,i.resolve)(S.value,g.baseIRI);continue}}else if(S.uri===et.ITS&&S.local==="dir"){this.setDirection(g,S.value);continue}S.prefix!=="xml"&&S.prefix!=="xmlns"&&(S.prefix!==""||S.local!=="xmlns")&&S.uri&&(b.push(this.uriToNamedNode(S.uri+S.local)),I.push(S.value))}if(A!==null&&(g.subject=P?this.dataFactory.blankNode(A):this.valueToUri(A,g),N&&this.claimNodeId(g.subject)),g.subject||(g.subject=this.dataFactory.blankNode()),_){const y=this.uriToNamedNode(h.uri+h.local);this.emitTriple(g.subject,this.dataFactory.namedNode(et.RDF+"type"),y,m?m.reifiedStatementId:null,g.childrenTripleTerms,g.reifier)}if(m){if(m.predicate)if(m.childrenCollectionSubject){const y=this.dataFactory.blankNode(),S=this.dataFactory.namedNode(et.RDF+"rest"),O=m.childrenCollectionPredicate.equals(S);this.emitTriple(m.childrenCollectionSubject,m.childrenCollectionPredicate,y,O?null:m.reifiedStatementId,m.childrenTripleTerms,O?null:m.reifier),this.emitTriple(y,this.dataFactory.namedNode(et.RDF+"first"),g.subject,null,g.childrenTripleTerms),m.childrenCollectionSubject=y,m.childrenCollectionPredicate=S}else{m.childrenTagsToTripleTerms||(this.emitTriple(m.subject,m.predicate,g.subject,m.reifiedStatementId,m.childrenTripleTerms,m.reifier),m.predicateEmitted=!0);for(let y=0;y<m.predicateSubPredicates.length;y++)this.emitTriple(g.subject,m.predicateSubPredicates[y],m.predicateSubObjects[y],null,m.childrenTripleTerms,m.reifier);m.predicateSubPredicates=[],m.predicateSubObjects=[]}for(let y=0;y<b.length;y++){const S=this.createLiteral(I[y],g);this.emitTriple(g.subject,b[y],S,m.reifiedStatementId,m.childrenTripleTerms,m.reifier)}w&&this.emitTriple(g.subject,this.dataFactory.namedNode(et.RDF+"type"),this.uriToNamedNode(w),null,g.childrenTripleTerms,g.reifier)}}onTagProperty(h,g,m){if(g.childrenParseType=u.RESOURCE,g.subject=m.subject,h.uri===et.RDF&&h.local==="li"?(m.listItemCounter||(m.listItemCounter=1),g.predicate=this.uriToNamedNode(h.uri+"_"+m.listItemCounter++)):g.predicate=this.uriToNamedNode(h.uri+h.local),h.uri===et.RDF&&et.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(h.local)>=0)throw this.newParseError(`Illegal property element name: ${h.local}`);g.predicateSubPredicates=[],g.predicateSubObjects=[];let d=!1,_=!1,b=null,I=!0;const A=[],N=[];for(const P in h.attributes){const w=h.attributes[P];if(w.uri===et.RDF&&w.local==="version"){this.setVersion(g,w.value);continue}else if(w.uri===et.RDF)switch(w.local){case"resource":if(b)throw this.newParseError(`Found both rdf:resource (${w.value}) and rdf:nodeID (${b}).`);if(d)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${w.value})`);g.hadChildren=!0,b=w.value,I=!1;continue;case"datatype":if(_)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${w.value}).`);if(d)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${w.value})`);g.datatype=this.valueToUri(w.value,g);continue;case"nodeID":if(_)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${w.value}).`);if(g.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${w.value}).`);if(d)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${w.value})`);this.validateNcname(w.value),g.hadChildren=!0,b=w.value,I=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(_)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(g.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${g.datatype.value})`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${b})`);if(w.value==="Resource"){d=!0,g.childrenParseType=u.PROPERTY;const y=this.dataFactory.blankNode();this.emitTriple(g.subject,g.predicate,y,g.reifiedStatementId,g.childrenTripleTerms,g.reifier),g.subject=y,g.predicate=null}else w.value==="Collection"?(d=!0,g.hadChildren=!0,g.childrenCollectionSubject=g.subject,g.childrenCollectionPredicate=g.predicate,I=!1):w.value==="Literal"?(d=!0,g.childrenTagsToString=!0,g.childrenStringTags=[]):w.value==="Triple"&&(d=!0,g.childrenTagsToTripleTerms=!0,g.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(w.value),g.reifiedStatementId=this.valueToUri("#"+w.value,g),this.claimNodeId(g.reifiedStatementId);continue;case"annotation":g.reifier=this.dataFactory.namedNode(w.value);continue;case"annotationNodeID":g.reifier=this.dataFactory.blankNode(w.value);continue}else if(w.uri===et.XML&&w.local==="lang"){g.language=w.value===""?null:w.value.toLowerCase();continue}else if(w.uri===et.ITS&&w.local==="dir"){this.setDirection(g,w.value);continue}else if(w.uri===et.ITS&&w.local==="version")continue;if(w.prefix!=="xml"&&w.prefix!=="xmlns"&&(w.prefix!==""||w.local!=="xmlns")&&w.uri){if(d||g.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${w.value}`);g.hadChildren=!0,_=!0,A.push(this.uriToNamedNode(w.uri+w.local)),N.push(this.createLiteral(w.value,g))}}if(b!==null){const P=g.subject;g.subject=I?this.dataFactory.blankNode(b):this.valueToUri(b,g),this.emitTriple(P,g.predicate,g.subject,g.reifiedStatementId,g.childrenTripleTerms,g.reifier);for(let w=0;w<A.length;w++)this.emitTriple(g.subject,A[w],N[w],null,g.childrenTripleTerms,g.reifier);g.predicateEmitted=!0}else I&&(g.predicateSubPredicates=A,g.predicateSubObjects=N,g.predicateEmitted=!1)}emitTriple(h,g,m,d,_,b){const I=this.dataFactory.quad(h,g,m,this.defaultGraph);_?_.push(I):this.push(I),b&&this.push(this.dataFactory.quad(b,this.dataFactory.namedNode(et.RDF+"reifies"),I)),d&&(this.push(this.dataFactory.quad(d,this.dataFactory.namedNode(et.RDF+"type"),this.dataFactory.namedNode(et.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(d,this.dataFactory.namedNode(et.RDF+"subject"),h,this.defaultGraph)),this.push(this.dataFactory.quad(d,this.dataFactory.namedNode(et.RDF+"predicate"),g,this.defaultGraph)),this.push(this.dataFactory.quad(d,this.dataFactory.namedNode(et.RDF+"object"),m,this.defaultGraph)))}claimNodeId(h){if(!this.allowDuplicateRdfIds){if(this.nodeIds[h.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${h.value}'.`);this.nodeIds[h.value]=!0}}onText(h){const g=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;g&&(g.childrenStringTags?g.childrenStringTags.push(h):g.predicate&&(g.text=h))}onCloseTag(){const h=this.activeTagStack.pop(),g=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(h.childrenStringEmitClosingTag&&h.childrenStringTags.push(h.childrenStringEmitClosingTag),h.childrenTagsToString&&(h.datatype=this.dataFactory.namedNode(et.RDF+"XMLLiteral"),h.text=h.childrenStringTags.join(""),h.hadChildren=!1),h.childrenTagsToTripleTerms&&h.predicate&&h.rdfVersion){if(h.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${h.childrenTripleTerms.length}`);for(const m of h.childrenTripleTerms)this.emitTriple(h.subject,h.predicate,m,null,g.childrenTripleTerms,g.reifier);h.predicateEmitted=!0}if(h.childrenCollectionSubject)this.emitTriple(h.childrenCollectionSubject,h.childrenCollectionPredicate,this.dataFactory.namedNode(et.RDF+"nil"),null,h.childrenTripleTerms);else if(h.predicate){if(!h.hadChildren&&h.childrenParseType!==u.PROPERTY)this.emitTriple(h.subject,h.predicate,this.createLiteral(h.text||"",h),h.reifiedStatementId,h.childrenTripleTerms,h.reifier);else if(!h.predicateEmitted){const m=this.dataFactory.blankNode();this.emitTriple(h.subject,h.predicate,m,h.reifiedStatementId,h.childrenTripleTerms,h.reifier);for(let d=0;d<h.predicateSubPredicates.length;d++)this.emitTriple(m,h.predicateSubPredicates[d],h.predicateSubObjects[d],null,h.childrenTripleTerms)}}}onDoctype(h){h.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(g,m,d)=>(this.saxParser.ENTITIES[m]=d,""))}setDirection(h,g){if(g){if(g!=="ltr"&&g!=="rtl")throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${g}' was found.`);h.direction=g}else delete h.direction}setVersion(h,g){if(h.rdfVersion=g,this.emit("version",g),!this.isValidVersion(g))throw this.newParseError(`Detected unsupported version: ${g}`)}};ui.RdfXmlParser=l,l.MIME_TYPE="application/rdf+xml",l.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",l.XML="http://www.w3.org/XML/1998/namespace",l.ITS="http://www.w3.org/2005/11/its",l.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],l.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],l.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,l.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];var u;return(function(f){f[f.RESOURCE=0]="RESOURCE",f[f.PROPERTY=1]="PROPERTY"})(u||(ui.ParseType=u={})),ui}var sd;function wm(){return sd||(sd=1,(function(i){var e=li&&li.__createBinding||(Object.create?(function(r,o,a,l){l===void 0&&(l=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,l,u)}):(function(r,o,a,l){l===void 0&&(l=a),r[l]=o[a]})),n=li&&li.__exportStar||function(r,o){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,r,a)};Object.defineProperty(i,"__esModule",{value:!0}),n(bm(),i)})(li)),li}var xm=wm(),fa={},pa,od;function Hl(){return od||(od=1,pa=class Mf{constructor(e,n=new Map,r=0){this.prefix=e,this._existing=n,this.counter=r}clone(){const{prefix:e,_existing:n,counter:r}=this;return new Mf(e,new Map(n),r)}getId(e){const n=e&&this._existing.get(e);if(n)return n;const r=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,r),r}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}),pa}var Ir={},ga={},ad;function Em(){return ad||(ad=1,(function(i,e){if(i.setImmediate)return;var n=1,r={},o=!1,a=i.document,l;function u(P){typeof P!="function"&&(P=new Function(""+P));for(var w=new Array(arguments.length-1),y=0;y<w.length;y++)w[y]=arguments[y+1];var S={callback:P,args:w};return r[n]=S,l(n),n++}function f(P){delete r[P]}function h(P){var w=P.callback,y=P.args;switch(y.length){case 0:w();break;case 1:w(y[0]);break;case 2:w(y[0],y[1]);break;case 3:w(y[0],y[1],y[2]);break;default:w.apply(e,y);break}}function g(P){if(o)setTimeout(g,0,P);else{var w=r[P];if(w){o=!0;try{h(w)}finally{f(P),o=!1}}}}function m(){l=function(P){process.nextTick(function(){g(P)})}}function d(){if(i.postMessage&&!i.importScripts){var P=!0,w=i.onmessage;return i.onmessage=function(){P=!1},i.postMessage("","*"),i.onmessage=w,P}}function _(){var P="setImmediate$"+Math.random()+"$",w=function(y){y.source===i&&typeof y.data=="string"&&y.data.indexOf(P)===0&&g(+y.data.slice(P.length))};i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),l=function(y){i.postMessage(P+y,"*")}}function b(){var P=new MessageChannel;P.port1.onmessage=function(w){var y=w.data;g(y)},l=function(w){P.port2.postMessage(w)}}function I(){var P=a.documentElement;l=function(w){var y=a.createElement("script");y.onreadystatechange=function(){g(w),y.onreadystatechange=null,P.removeChild(y),y=null},P.appendChild(y)}}function A(){l=function(P){setTimeout(g,0,P)}}var N=Object.getPrototypeOf&&Object.getPrototypeOf(i);N=N&&N.setTimeout?N:i,{}.toString.call(i.process)==="[object process]"?m():d()?_():i.MessageChannel?b():a&&"onreadystatechange"in a.createElement("script")?I():A(),N.setImmediate=u,N.clearImmediate=f})(typeof self>"u"?typeof qi>"u"?ga:qi:self)),ga}var ld;function Of(){if(ld)return Ir;ld=1,Em(),Ir.setImmediate=setImmediate,Ir.crypto=globalThis.crypto;const i=[];for(let e=0;e<=255;++e)i.push(e.toString(16).padStart(2,"0"));return Ir.bufferToHex=function(n){let r="";const o=new Uint8Array(n);for(let a=0;a<o.length;++a)r+=i[o[a]];return r},Ir}var ma,ud;function Ff(){if(ud)return ma;ud=1;const{bufferToHex:i,crypto:e}=Of(),n=new Map([["sha256","SHA-256"],["SHA256","SHA-256"],["SHA-256","SHA-256"],["sha384","SHA-384"],["SHA384","SHA-384"],["SHA-384","SHA-384"],["sha512","SHA-512"],["SHA512","SHA-512"],["SHA-512","SHA-512"]]);return ma=class{constructor(o){if(!(e&&e.subtle))throw new Error("crypto.subtle not found.");if(!n.has(o))throw new Error(`Unsupported algorithm "${o}".`);this.algorithm=n.get(o),this._content=""}update(o){this._content+=o}async digest(){const o=new TextEncoder().encode(this._content),a=await e.subtle.digest(this.algorithm,o);return i(a)}},ma}var _a,cd;function jf(){return cd||(cd=1,_a=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let n=0;n<e.length;++n)this.dir.set(e[n],!0)}hasNext(){return!this.done}next(){const{current:e,dir:n}=this,r=e.slice();let o=null,a=0;const l=e.length;for(let u=0;u<l;++u){const f=e[u],h=n.get(f);(o===null||f>o)&&(h&&u>0&&f>e[u-1]||!h&&u<l-1&&f>e[u+1])&&(o=f,a=u)}if(o===null)this.done=!0;else{const u=n.get(o)?a-1:a+1;e[a]=e[u],e[u]=o;for(const f of e)f>o&&n.set(f,!n.get(f))}return r}}),_a}var ya,dd;function Ul(){if(dd)return ya;dd=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+"langString",n="http://www.w3.org/2001/XMLSchema#string",r="NamedNode",o="BlankNode",a="Literal",l="DefaultGraph",u={};(()=>{const y="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�"+"_",S=y+"0-9-·̀-ͯ‿-⁀",O="_:((?:["+y+"0-9])(?:(?:["+S+".])*(?:["+S+"]))?)",U='(?:<((?:[^\0- <>"{}|^`\\\\]|'+"\\\\u[0-9A-Fa-f]{4}"+"|"+"\\\\U[0-9A-Fa-f]{8}"+")*)>)",R=O,$='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',G="(?:\\^\\^"+U+")",F="(?:"+$+"(?:"+G+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",se="[ \\t]+",M="[ \\t]*",re="(?:"+U+"|"+R+")"+se,B=U+se,oe="(?:"+U+"|"+R+"|"+F+")"+M,T="(?:\\.|(?:(?:"+U+"|"+R+")"+M+"\\.))";u.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,u.empty=new RegExp("^"+M+"$"),u.quad=new RegExp("^"+M+re+B+oe+T+M+"$")})(),ya=class Sl{static parse(y){const S=[],O={},X=y.split(u.eoln);let C=0;for(const U of X){if(C++,u.empty.test(U))continue;const R=U.match(u.quad);if(R===null)throw new Error("N-Quads parse error on line "+C+".");const $={subject:null,predicate:null,object:null,graph:null};if(R[1]!==void 0?$.subject={termType:r,value:P(R[1])}:$.subject={termType:o,value:R[2]},$.predicate={termType:r,value:P(R[3])},R[4]!==void 0?$.object={termType:r,value:P(R[4])}:R[5]!==void 0?$.object={termType:o,value:R[5]}:($.object={termType:a,value:void 0,datatype:{termType:r}},R[7]!==void 0?$.object.datatype.value=P(R[7]):R[8]!==void 0?($.object.datatype.value=e,$.object.language=R[8]):$.object.datatype.value=n,$.object.value=_(R[6])),R[9]!==void 0?$.graph={termType:r,value:P(R[9])}:R[10]!==void 0?$.graph={termType:o,value:R[10]}:$.graph={termType:l,value:""},!($.graph.value in O))O[$.graph.value]=[$],S.push($);else{let G=!0;const j=O[$.graph.value];for(const F of j)if(f(F,$)){G=!1;break}G&&(j.push($),S.push($))}}return S}static serialize(y){const S=[];for(const O of y)S.push(Sl.serializeQuad(O));return S.sort().join("")}static serializeQuadComponents(y,S,O,X){let C="";return y.termType===r?C+=`<${A(y.value)}>`:C+=`_:${y.value}`,S.termType===r?C+=` <${A(S.value)}> `:C+=` _:${S.value} `,O.termType===r?C+=`<${A(O.value)}>`:O.termType===o?C+=`_:${O.value}`:(C+=`"${m(O.value)}"`,O.datatype.value===e?O.language&&(C+=`@${O.language}`):O.datatype.value!==n&&(C+=`^^<${A(O.datatype.value)}>`)),X.termType===r?C+=` <${A(X.value)}>`:X.termType===o&&(C+=` _:${X.value}`),C+=` .
|
|
31
|
-
`,C}static serializeQuad(y){return Sl.serializeQuadComponents(y.subject,y.predicate,y.object,y.graph)}};function f(w,y){return!(w.subject.termType===y.subject.termType&&w.object.termType===y.object.termType)||!(w.subject.value===y.subject.value&&w.predicate.value===y.predicate.value&&w.object.value===y.object.value)?!1:w.object.termType!==a?!0:w.object.datatype.termType===y.object.datatype.termType&&w.object.language===y.object.language&&w.object.datatype.value===y.object.datatype.value}const h=/[\u0000-\u001F\u007F"\\]/g,g=[];for(let w=0;w<=127;++w)h.test(String.fromCharCode(w))&&(g[w]="\\u"+w.toString(16).toUpperCase().padStart(4,"0"),h.lastIndex=0);g["\b".codePointAt(0)]="\\b",g[" ".codePointAt(0)]="\\t",g[`
|
|
32
|
-
`.codePointAt(0)]="\\n",g["\f".codePointAt(0)]="\\f",g["\r".codePointAt(0)]="\\r",g['"'.codePointAt(0)]='\\"',g["\\".codePointAt(0)]="\\\\";function m(w){return h.test(w)?w.replace(h,function(y){return g[y.codePointAt(0)]}):w}const d=/(?:\\([btnfr"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function _(w){return d.test(w)?w.replace(d,function(y,S,O,X){if(S)switch(S){case"b":return"\b";case"t":return" ";case"n":return`
|
|
33
|
-
`;case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(O)return String.fromCharCode(parseInt(O,16));if(X)return String.fromCodePoint(parseInt(X,16))}):w}const b=/[\u0000-\u0020<>"{}|^`\\]/g,I=[];for(let w=0;w<=127;++w)b.test(String.fromCharCode(w))&&(I[w]="\\u"+w.toString(16).toUpperCase().padStart(4,"0"),b.lastIndex=0);function A(w){return b.test(w)?w.replace(b,function(y){return I[y.codePointAt(0)]}):w}const N=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function P(w){return N.test(w)?w.replace(N,function(y,S,O){if(S)return String.fromCharCode(parseInt(S,16));if(O)return String.fromCodePoint(parseInt(O,16))}):w}return ya}var va,hd;function Sm(){if(hd)return va;hd=1;const i=Hl(),e=Ff(),n=jf(),r=Ul(),{setImmediate:o}=Of();va=class{constructor({createMessageDigest:u=null,messageDigestAlgorithm:f="sha256",canonicalIdMap:h=new Map,maxWorkFactor:g=1,maxDeepIterations:m=-1,signal:d=null}={}){this.name="RDFC-1.0",this.blankNodeInfo=new Map,this.canonicalIssuer=new i("c14n",h),this.createMessageDigest=u||(()=>new e(f)),this.maxWorkFactor=g,this.maxDeepIterations=m,this.remainingDeepIterations=0,this.signal=d,this.quads=null}async main(u){this.quads=u;for(const b of u)this._addBlankNodeQuadInfo({quad:b,component:b.subject}),this._addBlankNodeQuadInfo({quad:b,component:b.object}),this._addBlankNodeQuadInfo({quad:b,component:b.graph});const f=new Map,h=[...this.blankNodeInfo.keys()];let g=0;for(const b of h)++g%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:b,hashToBlankNodes:f});const m=[...f.keys()].sort(),d=[];for(const b of m){const I=f.get(b);if(I.length>1){d.push(I);continue}const A=I[0];this.canonicalIssuer.getId(A)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{const b=d.reduce((I,A)=>I+A.length,0);this.maxDeepIterations=b**this.maxWorkFactor}this.maxDeepIterations>Number.MAX_SAFE_INTEGER&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(const b of d){const I=[];for(const A of b){if(this.canonicalIssuer.hasId(A))continue;const N=new i("b");N.getId(A);const P=await this.hashNDegreeQuads(A,N);I.push(P)}I.sort(a);for(const A of I){const N=A.issuer.getOldIds();for(const P of N)this.canonicalIssuer.getId(P)}}const _=[];for(const b of this.quads){const I=r.serializeQuadComponents(this._componentWithCanonicalId(b.subject),b.predicate,this._componentWithCanonicalId(b.object),this._componentWithCanonicalId(b.graph));_.push(I)}return _.sort(),_.join("")}async hashFirstDegreeQuads(u){const f=[],h=this.blankNodeInfo.get(u),g=h.quads;for(const d of g)f.push(r.serializeQuadComponents(this.modifyFirstDegreeComponent(u,d.subject,"subject"),d.predicate,this.modifyFirstDegreeComponent(u,d.object,"object"),this.modifyFirstDegreeComponent(u,d.graph,"graph")));f.sort();const m=this.createMessageDigest();for(const d of f)m.update(d);return h.hash=await m.digest(),h.hash}async hashRelatedBlankNode(u,f,h,g){const m=this.createMessageDigest();m.update(g),g!=="g"&&m.update(this.getRelatedPredicate(f));let d;return this.canonicalIssuer.hasId(u)?d="_:"+this.canonicalIssuer.getId(u):h.hasId(u)?d="_:"+h.getId(u):d=this.blankNodeInfo.get(u).hash,m.update(d),m.digest()}async hashNDegreeQuads(u,f){if(this.remainingDeepIterations===0)throw new Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;const h=this.createMessageDigest(),g=await this.createHashToRelated(u,f),m=[...g.keys()].sort();for(const d of m){h.update(d);let _="",b;const I=new n(g.get(d));let A=0;for(;I.hasNext();){const N=I.next();if(++A%3===0){if(this.signal&&this.signal.aborted)throw new Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let P=f.clone(),w="";const y=[];let S=!1;for(const O of N)if(this.canonicalIssuer.hasId(O)?w+="_:"+this.canonicalIssuer.getId(O):(P.hasId(O)||y.push(O),w+="_:"+P.getId(O)),_.length!==0&&w>_){S=!0;break}if(!S){for(const O of y){const X=await this.hashNDegreeQuads(O,P);if(w+="_:"+P.getId(O),w+=`<${X.hash}>`,P=X.issuer,_.length!==0&&w>_){S=!0;break}}S||(_.length===0||w<_)&&(_=w,b=P)}}h.update(_),f=b}return{hash:await h.digest(),issuer:f}}modifyFirstDegreeComponent(u,f){return f.termType!=="BlankNode"?f:{termType:"BlankNode",value:f.value===u?"a":"z"}}getRelatedPredicate(u){return`<${u.predicate.value}>`}async createHashToRelated(u,f){const h=new Map,g=this.blankNodeInfo.get(u).quads;let m=0;for(const d of g)++m%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:d,component:d.subject,position:"s",id:u,issuer:f,hashToRelated:h}),this._addRelatedBlankNodeHash({quad:d,component:d.object,position:"o",id:u,issuer:f,hashToRelated:h}),this._addRelatedBlankNodeHash({quad:d,component:d.graph,position:"g",id:u,issuer:f,hashToRelated:h})]);return h}async _hashAndTrackBlankNode({id:u,hashToBlankNodes:f}){const h=await this.hashFirstDegreeQuads(u),g=f.get(h);g?g.push(u):f.set(h,[u])}_addBlankNodeQuadInfo({quad:u,component:f}){if(f.termType!=="BlankNode")return;const h=f.value,g=this.blankNodeInfo.get(h);g?g.quads.add(u):this.blankNodeInfo.set(h,{quads:new Set([u]),hash:null})}async _addRelatedBlankNodeHash({quad:u,component:f,position:h,id:g,issuer:m,hashToRelated:d}){if(!(f.termType==="BlankNode"&&f.value!==g))return;const _=f.value,b=await this.hashRelatedBlankNode(_,u,m,h),I=d.get(b);I?I.push(_):d.set(b,[_])}_componentWithCanonicalId(u){return u.termType==="BlankNode"&&!u.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(u.value)}:u}async _yield(){return new Promise(u=>o(u))}};function a(l,u){return l.hash<u.hash?-1:l.hash>u.hash?1:0}return va}var ba,fd;function Tm(){if(fd)return ba;fd=1;const i=Hl(),e=Ff(),n=jf(),r=Ul();ba=class{constructor({createMessageDigest:l=null,messageDigestAlgorithm:u="sha256",canonicalIdMap:f=new Map,maxWorkFactor:h=1,maxDeepIterations:g=-1,timeout:m=0}={}){this.name="RDFC-1.0",this.blankNodeInfo=new Map,this.canonicalIssuer=new i("c14n",f),this.createMessageDigest=l||(()=>new e(u)),this.maxWorkFactor=h,this.maxDeepIterations=g,this.remainingDeepIterations=0,this.timeout=m,m>0&&(this.startTime=Date.now()),this.quads=null}main(l){this.quads=l;for(const d of l)this._addBlankNodeQuadInfo({quad:d,component:d.subject}),this._addBlankNodeQuadInfo({quad:d,component:d.object}),this._addBlankNodeQuadInfo({quad:d,component:d.graph});const u=new Map,f=[...this.blankNodeInfo.keys()];for(const d of f)this._hashAndTrackBlankNode({id:d,hashToBlankNodes:u});const h=[...u.keys()].sort(),g=[];for(const d of h){const _=u.get(d);if(_.length>1){g.push(_);continue}const b=_[0];this.canonicalIssuer.getId(b)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{const d=g.reduce((_,b)=>_+b.length,0);this.maxDeepIterations=d**this.maxWorkFactor}this.maxDeepIterations>Number.MAX_SAFE_INTEGER&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(const d of g){const _=[];for(const b of d){if(this.canonicalIssuer.hasId(b))continue;const I=new i("b");I.getId(b);const A=this.hashNDegreeQuads(b,I);_.push(A)}_.sort(o);for(const b of _){const I=b.issuer.getOldIds();for(const A of I)this.canonicalIssuer.getId(A)}}const m=[];for(const d of this.quads){const _=r.serializeQuadComponents(this._componentWithCanonicalId(d.subject),d.predicate,this._componentWithCanonicalId(d.object),this._componentWithCanonicalId(d.graph));m.push(_)}return m.sort(),m.join("")}hashFirstDegreeQuads(l){const u=[],f=this.blankNodeInfo.get(l),h=f.quads;for(const m of h)u.push(r.serializeQuadComponents(this.modifyFirstDegreeComponent(l,m.subject,"subject"),m.predicate,this.modifyFirstDegreeComponent(l,m.object,"object"),this.modifyFirstDegreeComponent(l,m.graph,"graph")));u.sort();const g=this.createMessageDigest();for(const m of u)g.update(m);return f.hash=g.digest(),f.hash}hashRelatedBlankNode(l,u,f,h){const g=this.createMessageDigest();g.update(h),h!=="g"&&g.update(this.getRelatedPredicate(u));let m;return this.canonicalIssuer.hasId(l)?m="_:"+this.canonicalIssuer.getId(l):f.hasId(l)?m="_:"+f.getId(l):m=this.blankNodeInfo.get(l).hash,g.update(m),g.digest()}hashNDegreeQuads(l,u){if(this.remainingDeepIterations===0)throw new Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;const f=this.createMessageDigest(),h=this.createHashToRelated(l,u),g=[...h.keys()].sort();for(const m of g){f.update(m);let d="",_;const b=new n(h.get(m));let I=0;for(;b.hasNext();){const A=b.next();if(++I%3===0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw new Error("Canonize timeout.");let N=u.clone(),P="";const w=[];let y=!1;for(const S of A)if(this.canonicalIssuer.hasId(S)?P+="_:"+this.canonicalIssuer.getId(S):(N.hasId(S)||w.push(S),P+="_:"+N.getId(S)),d.length!==0&&P>d){y=!0;break}if(!y){for(const S of w){const O=this.hashNDegreeQuads(S,N);if(P+="_:"+N.getId(S),P+=`<${O.hash}>`,N=O.issuer,d.length!==0&&P>d){y=!0;break}}y||(d.length===0||P<d)&&(d=P,_=N)}}f.update(d),u=_}return{hash:f.digest(),issuer:u}}modifyFirstDegreeComponent(l,u){return u.termType!=="BlankNode"?u:{termType:"BlankNode",value:u.value===l?"a":"z"}}getRelatedPredicate(l){return`<${l.predicate.value}>`}createHashToRelated(l,u){const f=new Map,h=this.blankNodeInfo.get(l).quads;for(const g of h)this._addRelatedBlankNodeHash({quad:g,component:g.subject,position:"s",id:l,issuer:u,hashToRelated:f}),this._addRelatedBlankNodeHash({quad:g,component:g.object,position:"o",id:l,issuer:u,hashToRelated:f}),this._addRelatedBlankNodeHash({quad:g,component:g.graph,position:"g",id:l,issuer:u,hashToRelated:f});return f}_hashAndTrackBlankNode({id:l,hashToBlankNodes:u}){const f=this.hashFirstDegreeQuads(l),h=u.get(f);h?h.push(l):u.set(f,[l])}_addBlankNodeQuadInfo({quad:l,component:u}){if(u.termType!=="BlankNode")return;const f=u.value,h=this.blankNodeInfo.get(f);h?h.quads.add(l):this.blankNodeInfo.set(f,{quads:new Set([l]),hash:null})}_addRelatedBlankNodeHash({quad:l,component:u,position:f,id:h,issuer:g,hashToRelated:m}){if(!(u.termType==="BlankNode"&&u.value!==h))return;const d=u.value,_=this.hashRelatedBlankNode(d,l,g,f),b=m.get(_);b?b.push(d):m.set(_,[d])}_componentWithCanonicalId(l){return l.termType==="BlankNode"&&!l.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(l.value)}:l}};function o(a,l){return a.hash<l.hash?-1:a.hash>l.hash?1:0}return ba}var pd;function Lm(){return pd||(pd=1,(function(i){const e=Sm(),n=Tm();function r(l,u){if(u.inputFormat){if(u.inputFormat==="application/n-quads"){if(typeof l!="string")throw new Error("N-Quads input must be a string.");return i.NQuads.parse(l)}throw new Error(`Unknown canonicalization input format: "${u.inputFormat}".`)}return l}function o(l){if(l.format&&l.format!=="application/n-quads")throw new Error(`Unknown canonicalization output format: "${l.format}".`)}function a(){globalThis.RDF_CANONIZE_TRACE_URDNA2015&&console.trace("[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0")}i.NQuads=Ul(),i.IdentifierIssuer=Hl(),i.canonize=async function(l,u={}){const f=r(l,u);if(o(u),!("algorithm"in u))throw new Error("No RDF Dataset Canonicalization algorithm specified.");if(u.algorithm==="RDFC-1.0")return new e(u).main(f);if(u.algorithm==="URDNA2015"&&!u.rejectURDNA2015)return a(),new e(u).main(f);throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm)},i._canonizeSync=function(l,u={}){const f=r(l,u);if(o(u),!("algorithm"in u))throw new Error("No RDF Dataset Canonicalization algorithm specified.");if(u.algorithm==="RDFC-1.0")return new n(u).main(f);if(u.algorithm==="URDNA2015"&&!u.rejectURDNA2015)return a(),new n(u).main(f);throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm)}})(fa)),fa}var wa,gd;function Vl(){return gd||(gd=1,wa=Lm()),wa}var xa,md;function zt(){if(md)return xa;md=1;const i={};return xa=i,i.isArray=Array.isArray,i.isBoolean=e=>typeof e=="boolean"||Object.prototype.toString.call(e)==="[object Boolean]",i.isDouble=e=>i.isNumber(e)&&(String(e).indexOf(".")!==-1||Math.abs(e)>=1e21),i.isEmptyObject=e=>i.isObject(e)&&Object.keys(e).length===0,i.isNumber=e=>typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]",i.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),i.isObject=e=>Object.prototype.toString.call(e)==="[object Object]",i.isString=e=>typeof e=="string"||Object.prototype.toString.call(e)==="[object String]",i.isUndefined=e=>typeof e>"u",xa}var Ea,_d;function On(){if(_d)return Ea;_d=1;const i=zt(),e={};return Ea=e,e.isSubject=n=>i.isObject(n)&&!("@value"in n||"@set"in n||"@list"in n)?Object.keys(n).length>1||!("@id"in n):!1,e.isSubjectReference=n=>i.isObject(n)&&Object.keys(n).length===1&&"@id"in n,e.isValue=n=>i.isObject(n)&&"@value"in n,e.isList=n=>i.isObject(n)&&"@list"in n,e.isGraph=n=>i.isObject(n)&&"@graph"in n&&Object.keys(n).filter(r=>r!=="@id"&&r!=="@index").length===1,e.isSimpleGraph=n=>e.isGraph(n)&&!("@id"in n),e.isBlankNode=n=>{if(i.isObject(n)){if("@id"in n){const r=n["@id"];return!i.isString(r)||r.indexOf("_:")===0}return Object.keys(n).length===0||!("@value"in n||"@set"in n||"@list"in n)}return!1},Ea}var Sa,yd;function Kt(){return yd||(yd=1,Sa=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",n="jsonld.Error",r={}){super(e),this.name=n,this.message=e,this.details=r}}),Sa}var Ta,vd;function Qt(){if(vd)return Ta;vd=1;const i=On(),e=zt(),n=Vl().IdentifierIssuer,r=Kt(),o=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,a=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,l=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,u=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,f=/^@[a-zA-Z]+$/,h={headers:{accept:"application/ld+json, application/json"}},g={};Ta=g,g.IdentifierIssuer=n,g.REGEX_BCP47=o,g.REGEX_KEYWORD=f,g.clone=function(d){if(d&&typeof d=="object"){let _;if(e.isArray(d)){_=[];for(let b=0;b<d.length;++b)_[b]=g.clone(d[b])}else if(d instanceof Map){_=new Map;for(const[b,I]of d)_.set(b,g.clone(I))}else if(d instanceof Set){_=new Set;for(const b of d)_.add(g.clone(b))}else if(e.isObject(d)){_={};for(const b in d)_[b]=g.clone(d[b])}else _=d.toString();return _}return d},g.asArray=function(d){return Array.isArray(d)?d:[d]},g.buildHeaders=(d={})=>{if(Object.keys(d).some(b=>b.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+h.headers.accept+'" is supported.');return Object.assign({Accept:h.headers.accept},d)},g.parseLinkHeader=d=>{const _={},b=d.match(a);for(let I=0;I<b.length;++I){let A=b[I].match(l);if(!A)continue;const N={target:A[1]},P=A[2];for(;A=u.exec(P);)N[A[1]]=A[2]===void 0?A[3]:A[2];const w=N.rel||"";Array.isArray(_[w])?_[w].push(N):_.hasOwnProperty(w)?_[w]=[_[w],N]:_[w]=N}return _},g.validateTypeValue=(d,_)=>{if(!e.isString(d)&&!(e.isArray(d)&&d.every(b=>e.isString(b)))){if(_&&e.isObject(d))switch(Object.keys(d).length){case 0:return;case 1:if("@default"in d&&g.asArray(d["@default"]).every(b=>e.isString(b)))return}throw new r('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.',"jsonld.SyntaxError",{code:"invalid type value",value:d})}},g.hasProperty=(d,_)=>{if(d.hasOwnProperty(_)){const b=d[_];return!e.isArray(b)||b.length>0}return!1},g.hasValue=(d,_,b)=>{if(g.hasProperty(d,_)){let I=d[_];const A=i.isList(I);if(e.isArray(I)||A){A&&(I=I["@list"]);for(let N=0;N<I.length;++N)if(g.compareValues(b,I[N]))return!0}else if(!e.isArray(b))return g.compareValues(b,I)}return!1},g.addValue=(d,_,b,I)=>{if(I=I||{},"propertyIsArray"in I||(I.propertyIsArray=!1),"valueIsArray"in I||(I.valueIsArray=!1),"allowDuplicate"in I||(I.allowDuplicate=!0),"prependValue"in I||(I.prependValue=!1),I.valueIsArray)d[_]=b;else if(e.isArray(b)){b.length===0&&I.propertyIsArray&&!d.hasOwnProperty(_)&&(d[_]=[]),I.prependValue&&(b=b.concat(d[_]),d[_]=[]);for(let A=0;A<b.length;++A)g.addValue(d,_,b[A],I)}else if(d.hasOwnProperty(_)){const A=!I.allowDuplicate&&g.hasValue(d,_,b);!e.isArray(d[_])&&(!A||I.propertyIsArray)&&(d[_]=[d[_]]),A||(I.prependValue?d[_].unshift(b):d[_].push(b))}else d[_]=I.propertyIsArray?[b]:b},g.getValues=(d,_)=>[].concat(d[_]||[]),g.removeProperty=(d,_)=>{delete d[_]},g.removeValue=(d,_,b,I)=>{I=I||{},"propertyIsArray"in I||(I.propertyIsArray=!1);const A=g.getValues(d,_).filter(N=>!g.compareValues(N,b));A.length===0?g.removeProperty(d,_):A.length===1&&!I.propertyIsArray?d[_]=A[0]:d[_]=A},g.relabelBlankNodes=(d,_)=>{_=_||{};const b=_.issuer||new n("_:b");return m(b,d)},g.compareValues=(d,_)=>d===_||i.isValue(d)&&i.isValue(_)&&d["@value"]===_["@value"]&&d["@type"]===_["@type"]&&d["@language"]===_["@language"]&&d["@index"]===_["@index"]?!0:e.isObject(d)&&"@id"in d&&e.isObject(_)&&"@id"in _?d["@id"]===_["@id"]:!1,g.compareShortestLeast=(d,_)=>d.length<_.length?-1:_.length<d.length?1:d===_?0:d<_?-1:1;function m(d,_){if(e.isArray(_))for(let b=0;b<_.length;++b)_[b]=m(d,_[b]);else if(i.isList(_))_["@list"]=m(d,_["@list"]);else if(e.isObject(_)){i.isBlankNode(_)&&(_["@id"]=d.getId(_["@id"]));const b=Object.keys(_).sort();for(let I=0;I<b.length;++I){const A=b[I];A!=="@id"&&(_[A]=m(d,_[A]))}}return _}return Ta}var La,bd;function Wl(){if(bd)return La;bd=1;const i="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return La={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:i,RDF_LIST:i+"List",RDF_FIRST:i+"first",RDF_REST:i+"rest",RDF_NIL:i+"nil",RDF_TYPE:i+"type",RDF_PLAIN_LITERAL:i+"PlainLiteral",RDF_XML_LITERAL:i+"XMLLiteral",RDF_JSON_LITERAL:i+"JSON",RDF_OBJECT:i+"object",RDF_LANGSTRING:i+"langString",XSD:e,XSD_BOOLEAN:e+"boolean",XSD_DOUBLE:e+"double",XSD_INTEGER:e+"integer",XSD_STRING:e+"string"},La}var Ia,wd;function Bf(){return wd||(wd=1,Ia=class{constructor(){this._requests={}}wrapLoader(e){const n=this;return n._loader=e,function(){return n.add.apply(n,arguments)}}async add(e){let n=this._requests[e];if(n)return Promise.resolve(n);n=this._requests[e]=this._loader(e);try{return await n}finally{delete this._requests[e]}}}),Ia}var Aa,xd;function Jn(){if(xd)return Aa;xd=1;const i=zt(),e={};Aa=e,e.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},e.parse=(r,o)=>{const a={},l=e.parsers[o||"full"],u=l.regex.exec(r);let f=l.keys.length;for(;f--;)a[l.keys[f]]=u[f]===void 0?null:u[f];return(a.scheme==="https"&&a.port==="443"||a.scheme==="http"&&a.port==="80")&&(a.href=a.href.replace(":"+a.port,""),a.authority=a.authority.replace(":"+a.port,""),a.port=null),a.normalizedPath=e.removeDotSegments(a.path),a},e.prependBase=(r,o)=>{if(r===null||e.isAbsolute(o))return o;(!r||i.isString(r))&&(r=e.parse(r||""));const a=e.parse(o),l={protocol:r.protocol||""};if(a.authority!==null)l.authority=a.authority,l.path=a.path,l.query=a.query;else if(l.authority=r.authority,a.path==="")l.path=r.path,a.query!==null?l.query=a.query:l.query=r.query;else{if(a.path.indexOf("/")===0)l.path=a.path;else{let f=r.path;f=f.substr(0,f.lastIndexOf("/")+1),(f.length>0||r.authority)&&f.substr(-1)!=="/"&&(f+="/"),f+=a.path,l.path=f}l.query=a.query}a.path!==""&&(l.path=e.removeDotSegments(l.path));let u=l.protocol;return l.authority!==null&&(u+="//"+l.authority),u+=l.path,l.query!==null&&(u+="?"+l.query),a.fragment!==null&&(u+="#"+a.fragment),u===""&&(u="./"),u},e.removeBase=(r,o)=>{if(r===null)return o;(!r||i.isString(r))&&(r=e.parse(r||""));let a="";if(r.href!==""?a+=(r.protocol||"")+"//"+(r.authority||""):o.indexOf("//")&&(a+="//"),o.indexOf(a)!==0)return o;const l=e.parse(o.substr(a.length)),u=r.normalizedPath.split("/"),f=l.normalizedPath.split("/"),h=l.fragment||l.query?0:1;for(;u.length>0&&f.length>h&&u[0]===f[0];)u.shift(),f.shift();let g="";if(u.length>0){u.pop();for(let m=0;m<u.length;++m)g+="../"}return g+=f.join("/"),l.query!==null&&(g+="?"+l.query),l.fragment!==null&&(g+="#"+l.fragment),g===""&&(g="./"),g},e.removeDotSegments=r=>{if(r.length===0)return"";const o=r.split("/"),a=[];for(;o.length>0;){const l=o.shift(),u=o.length===0;if(l==="."){u&&a.push("");continue}if(l===".."){a.pop(),u&&a.push("");continue}a.push(l)}return r[0]==="/"&&a.length>0&&a[0]!==""&&a.unshift(""),a.length===1&&a[0]===""?"/":a.join("/")};const n=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;return e.isAbsolute=r=>i.isString(r)&&n.test(r),e.isRelative=r=>i.isString(r),Aa}var Na,Ed;function Im(){if(Ed)return Na;Ed=1;const{parseLinkHeader:i,buildHeaders:e}=Qt(),{LINK_HEADER_CONTEXT:n}=Wl(),r=Kt(),o=Bf(),{prependBase:a}=Jn(),l=/(^|(\r\n))link:/i;Na=({secure:f,headers:h={},xhr:g}={headers:{}})=>{return h=e(h),new o().wrapLoader(d);async function d(_){if(_.indexOf("http:")!==0&&_.indexOf("https:")!==0)throw new r('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:_});if(f&&_.indexOf("https")!==0)throw new r(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,"jsonld.InvalidUrl",{code:"loading document failed",url:_});let b;try{b=await u(g,_,h)}catch(w){throw new r("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:_,cause:w})}if(b.status>=400)throw new r("URL could not be dereferenced: "+b.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:_,httpStatusCode:b.status});let I={contextUrl:null,documentUrl:_,document:b.response},A=null;const N=b.getResponseHeader("Content-Type");let P;if(l.test(b.getAllResponseHeaders())&&(P=b.getResponseHeader("Link")),P&&N!=="application/ld+json"){const w=i(P),y=w[n];if(Array.isArray(y))throw new r("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:_});y&&(I.contextUrl=y.target),A=w.alternate,A&&A.type=="application/ld+json"&&!(N||"").match(/^application\/(\w*\+)?json$/)&&(I=await d(a(_,A.target)))}return I}};function u(f,h,g){f=f||XMLHttpRequest;const m=new f;return new Promise((d,_)=>{m.onload=()=>d(m),m.onerror=b=>_(b),m.open("GET",h,!0);for(const b in g)m.setRequestHeader(b,g[b]);m.send()})}return Na}var Ra,Sd;function Am(){if(Sd)return Ra;Sd=1;const i=Im(),e={};return Ra=e,e.setupDocumentLoaders=function(n){typeof XMLHttpRequest<"u"&&(n.documentLoaders.xhr=i,n.useDocumentLoader("xhr"))},e.setupGlobals=function(n){typeof globalThis.JsonLdProcessor>"u"&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:n.JsonLdProcessor})},Ra}var Ca,Td;function Nm(){return Td||(Td=1,Ca=function(i){i.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Ca}var Pa,Ld;function Rm(){if(Ld)return Pa;Ld=1,Pa=i,i.Node=o,i.create=i;function i(a){var l=this;if(l instanceof i||(l=new i),l.tail=null,l.head=null,l.length=0,a&&typeof a.forEach=="function")a.forEach(function(h){l.push(h)});else if(arguments.length>0)for(var u=0,f=arguments.length;u<f;u++)l.push(arguments[u]);return l}i.prototype.removeNode=function(a){if(a.list!==this)throw new Error("removing node which does not belong to this list");var l=a.next,u=a.prev;return l&&(l.prev=u),u&&(u.next=l),a===this.head&&(this.head=l),a===this.tail&&(this.tail=u),a.list.length--,a.next=null,a.prev=null,a.list=null,l},i.prototype.unshiftNode=function(a){if(a!==this.head){a.list&&a.list.removeNode(a);var l=this.head;a.list=this,a.next=l,l&&(l.prev=a),this.head=a,this.tail||(this.tail=a),this.length++}},i.prototype.pushNode=function(a){if(a!==this.tail){a.list&&a.list.removeNode(a);var l=this.tail;a.list=this,a.prev=l,l&&(l.next=a),this.tail=a,this.head||(this.head=a),this.length++}},i.prototype.push=function(){for(var a=0,l=arguments.length;a<l;a++)n(this,arguments[a]);return this.length},i.prototype.unshift=function(){for(var a=0,l=arguments.length;a<l;a++)r(this,arguments[a]);return this.length},i.prototype.pop=function(){if(this.tail){var a=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,a}},i.prototype.shift=function(){if(this.head){var a=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,a}},i.prototype.forEach=function(a,l){l=l||this;for(var u=this.head,f=0;u!==null;f++)a.call(l,u.value,f,this),u=u.next},i.prototype.forEachReverse=function(a,l){l=l||this;for(var u=this.tail,f=this.length-1;u!==null;f--)a.call(l,u.value,f,this),u=u.prev},i.prototype.get=function(a){for(var l=0,u=this.head;u!==null&&l<a;l++)u=u.next;if(l===a&&u!==null)return u.value},i.prototype.getReverse=function(a){for(var l=0,u=this.tail;u!==null&&l<a;l++)u=u.prev;if(l===a&&u!==null)return u.value},i.prototype.map=function(a,l){l=l||this;for(var u=new i,f=this.head;f!==null;)u.push(a.call(l,f.value,this)),f=f.next;return u},i.prototype.mapReverse=function(a,l){l=l||this;for(var u=new i,f=this.tail;f!==null;)u.push(a.call(l,f.value,this)),f=f.prev;return u},i.prototype.reduce=function(a,l){var u,f=this.head;if(arguments.length>1)u=l;else if(this.head)f=this.head.next,u=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=0;f!==null;h++)u=a(u,f.value,h),f=f.next;return u},i.prototype.reduceReverse=function(a,l){var u,f=this.tail;if(arguments.length>1)u=l;else if(this.tail)f=this.tail.prev,u=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=this.length-1;f!==null;h--)u=a(u,f.value,h),f=f.prev;return u},i.prototype.toArray=function(){for(var a=new Array(this.length),l=0,u=this.head;u!==null;l++)a[l]=u.value,u=u.next;return a},i.prototype.toArrayReverse=function(){for(var a=new Array(this.length),l=0,u=this.tail;u!==null;l++)a[l]=u.value,u=u.prev;return a},i.prototype.slice=function(a,l){l=l||this.length,l<0&&(l+=this.length),a=a||0,a<0&&(a+=this.length);var u=new i;if(l<a||l<0)return u;a<0&&(a=0),l>this.length&&(l=this.length);for(var f=0,h=this.head;h!==null&&f<a;f++)h=h.next;for(;h!==null&&f<l;f++,h=h.next)u.push(h.value);return u},i.prototype.sliceReverse=function(a,l){l=l||this.length,l<0&&(l+=this.length),a=a||0,a<0&&(a+=this.length);var u=new i;if(l<a||l<0)return u;a<0&&(a=0),l>this.length&&(l=this.length);for(var f=this.length,h=this.tail;h!==null&&f>l;f--)h=h.prev;for(;h!==null&&f>a;f--,h=h.prev)u.push(h.value);return u},i.prototype.splice=function(a,l,...u){a>this.length&&(a=this.length-1),a<0&&(a=this.length+a);for(var f=0,h=this.head;h!==null&&f<a;f++)h=h.next;for(var g=[],f=0;h&&f<l;f++)g.push(h.value),h=this.removeNode(h);h===null&&(h=this.tail),h!==this.head&&h!==this.tail&&(h=h.prev);for(var f=0;f<u.length;f++)h=e(this,h,u[f]);return g},i.prototype.reverse=function(){for(var a=this.head,l=this.tail,u=a;u!==null;u=u.prev){var f=u.prev;u.prev=u.next,u.next=f}return this.head=l,this.tail=a,this};function e(a,l,u){var f=l===a.head?new o(u,null,l,a):new o(u,l,l.next,a);return f.next===null&&(a.tail=f),f.prev===null&&(a.head=f),a.length++,f}function n(a,l){a.tail=new o(l,a.tail,null,a),a.head||(a.head=a.tail),a.length++}function r(a,l){a.head=new o(l,null,a.head,a),a.tail||(a.tail=a.head),a.length++}function o(a,l,u,f){if(!(this instanceof o))return new o(a,l,u,f);this.list=f,this.value=a,l?(l.next=this,this.prev=l):this.prev=null,u?(u.prev=this,this.next=u):this.next=null}try{Nm()(i)}catch{}return Pa}var ka,Id;function $f(){if(Id)return ka;Id=1;const i=Rm(),e=Symbol("max"),n=Symbol("length"),r=Symbol("lengthCalculator"),o=Symbol("allowStale"),a=Symbol("maxAge"),l=Symbol("dispose"),u=Symbol("noDisposeOnSet"),f=Symbol("lruList"),h=Symbol("cache"),g=Symbol("updateAgeOnGet"),m=()=>1;class d{constructor(y){if(typeof y=="number"&&(y={max:y}),y||(y={}),y.max&&(typeof y.max!="number"||y.max<0))throw new TypeError("max must be a non-negative number");this[e]=y.max||1/0;const S=y.length||m;if(this[r]=typeof S!="function"?m:S,this[o]=y.stale||!1,y.maxAge&&typeof y.maxAge!="number")throw new TypeError("maxAge must be a number");this[a]=y.maxAge||0,this[l]=y.dispose,this[u]=y.noDisposeOnSet||!1,this[g]=y.updateAgeOnGet||!1,this.reset()}set max(y){if(typeof y!="number"||y<0)throw new TypeError("max must be a non-negative number");this[e]=y||1/0,I(this)}get max(){return this[e]}set allowStale(y){this[o]=!!y}get allowStale(){return this[o]}set maxAge(y){if(typeof y!="number")throw new TypeError("maxAge must be a non-negative number");this[a]=y,I(this)}get maxAge(){return this[a]}set lengthCalculator(y){typeof y!="function"&&(y=m),y!==this[r]&&(this[r]=y,this[n]=0,this[f].forEach(S=>{S.length=this[r](S.value,S.key),this[n]+=S.length})),I(this)}get lengthCalculator(){return this[r]}get length(){return this[n]}get itemCount(){return this[f].length}rforEach(y,S){S=S||this;for(let O=this[f].tail;O!==null;){const X=O.prev;P(this,y,O,S),O=X}}forEach(y,S){S=S||this;for(let O=this[f].head;O!==null;){const X=O.next;P(this,y,O,S),O=X}}keys(){return this[f].toArray().map(y=>y.key)}values(){return this[f].toArray().map(y=>y.value)}reset(){this[l]&&this[f]&&this[f].length&&this[f].forEach(y=>this[l](y.key,y.value)),this[h]=new Map,this[f]=new i,this[n]=0}dump(){return this[f].map(y=>b(this,y)?!1:{k:y.key,v:y.value,e:y.now+(y.maxAge||0)}).toArray().filter(y=>y)}dumpLru(){return this[f]}set(y,S,O){if(O=O||this[a],O&&typeof O!="number")throw new TypeError("maxAge must be a number");const X=O?Date.now():0,C=this[r](S,y);if(this[h].has(y)){if(C>this[e])return A(this,this[h].get(y)),!1;const $=this[h].get(y).value;return this[l]&&(this[u]||this[l](y,$.value)),$.now=X,$.maxAge=O,$.value=S,this[n]+=C-$.length,$.length=C,this.get(y),I(this),!0}const U=new N(y,S,C,X,O);return U.length>this[e]?(this[l]&&this[l](y,S),!1):(this[n]+=U.length,this[f].unshift(U),this[h].set(y,this[f].head),I(this),!0)}has(y){if(!this[h].has(y))return!1;const S=this[h].get(y).value;return!b(this,S)}get(y){return _(this,y,!0)}peek(y){return _(this,y,!1)}pop(){const y=this[f].tail;return y?(A(this,y),y.value):null}del(y){A(this,this[h].get(y))}load(y){this.reset();const S=Date.now();for(let O=y.length-1;O>=0;O--){const X=y[O],C=X.e||0;if(C===0)this.set(X.k,X.v);else{const U=C-S;U>0&&this.set(X.k,X.v,U)}}}prune(){this[h].forEach((y,S)=>_(this,S,!1))}}const _=(w,y,S)=>{const O=w[h].get(y);if(O){const X=O.value;if(b(w,X)){if(A(w,O),!w[o])return}else S&&(w[g]&&(O.value.now=Date.now()),w[f].unshiftNode(O));return X.value}},b=(w,y)=>{if(!y||!y.maxAge&&!w[a])return!1;const S=Date.now()-y.now;return y.maxAge?S>y.maxAge:w[a]&&S>w[a]},I=w=>{if(w[n]>w[e])for(let y=w[f].tail;w[n]>w[e]&&y!==null;){const S=y.prev;A(w,y),y=S}},A=(w,y)=>{if(y){const S=y.value;w[l]&&w[l](S.key,S.value),w[n]-=S.length,w[h].delete(S.key),w[f].removeNode(y)}};class N{constructor(y,S,O,X,C){this.key=y,this.value=S,this.length=O,this.now=X,this.maxAge=C||0}}const P=(w,y,S,O)=>{let X=S.value;b(w,X)&&(A(w,S),w[o]||(X=void 0)),X&&y.call(O,X.value,X.key,w)};return ka=d,ka}var Da,Ad;function Cm(){if(Ad)return Da;Ad=1;const i=$f(),e=10;return Da=class{constructor({document:r}){this.document=r,this.cache=new i({max:e})}getProcessed(r){return this.cache.get(r)}setProcessed(r,o){this.cache.set(r,o)}},Da}var Ma,Nd;function Pm(){if(Nd)return Ma;Nd=1;const{isArray:i,isObject:e,isString:n}=zt(),{asArray:r}=Qt(),{prependBase:o}=Jn(),a=Kt(),l=Cm(),u=10;Ma=class{constructor({sharedCache:m}){this.perOpCache=new Map,this.sharedCache=m}async resolve({activeCtx:m,context:d,documentLoader:_,base:b,cycles:I=new Set}){d&&e(d)&&d["@context"]&&(d=d["@context"]),d=r(d);const A=[];for(const N of d){if(n(N)){let y=this._get(N);y||(y=await this._resolveRemoteContext({activeCtx:m,url:N,documentLoader:_,base:b,cycles:I})),i(y)?A.push(...y):A.push(y);continue}if(N===null){A.push(new l({document:null}));continue}e(N)||f(d);const P=JSON.stringify(N);let w=this._get(P);w||(w=new l({document:N}),this._cacheResolvedContext({key:P,resolved:w,tag:"static"})),A.push(w)}return A}_get(m){let d=this.perOpCache.get(m);if(!d){const _=this.sharedCache.get(m);_&&(d=_.get("static"),d&&this.perOpCache.set(m,d))}return d}_cacheResolvedContext({key:m,resolved:d,tag:_}){if(this.perOpCache.set(m,d),_!==void 0){let b=this.sharedCache.get(m);b||(b=new Map,this.sharedCache.set(m,b)),b.set(_,d)}return d}async _resolveRemoteContext({activeCtx:m,url:d,documentLoader:_,base:b,cycles:I}){d=o(b,d);const{context:A,remoteDoc:N}=await this._fetchContext({activeCtx:m,url:d,documentLoader:_,cycles:I});b=N.documentUrl||d,h({context:A,base:b});const P=await this.resolve({activeCtx:m,context:A,documentLoader:_,base:b,cycles:I});return this._cacheResolvedContext({key:d,resolved:P,tag:N.tag}),P}async _fetchContext({activeCtx:m,url:d,documentLoader:_,cycles:b}){if(b.size>u)throw new a("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:m.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:u});if(b.has(d))throw new a("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:m.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:d});b.add(d);let I,A;try{A=await _(d),I=A.document||null,n(I)&&(I=JSON.parse(I))}catch(N){throw new a(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${d}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:d,cause:N})}if(!e(I))throw new a(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${d}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:d});return"@context"in I?I={"@context":I["@context"]}:I={"@context":{}},A.contextUrl&&(i(I["@context"])||(I["@context"]=[I["@context"]]),I["@context"].push(A.contextUrl)),{context:I,remoteDoc:A}}};function f(g){throw new a("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:g})}function h({context:g,base:m}){if(!g)return;const d=g["@context"];if(n(d)){g["@context"]=o(m,d);return}if(i(d)){for(let _=0;_<d.length;++_){const b=d[_];if(n(b)){d[_]=o(m,b);continue}e(b)&&h({context:{"@context":b},base:m})}return}if(e(d))for(const _ in d)h({context:d[_],base:m})}return Ma}var Oa,Rd;function km(){return Rd||(Rd=1,Oa=Vl().NQuads),Oa}var Fa,Cd;function Qr(){if(Cd)return Fa;Cd=1;const i=Kt(),{isArray:e}=zt(),{asArray:n}=Qt(),r={};Fa=r,r.defaultEventHandler=null,r.setupEventHandler=({options:l={}})=>{const u=[].concat(l.safe?r.safeEventHandler:[],l.eventHandler?n(l.eventHandler):[],r.defaultEventHandler?r.defaultEventHandler:[]);return u.length===0?null:u},r.handleEvent=({event:l,options:u})=>{o({event:l,handlers:u.eventHandler})};function o({event:l,handlers:u}){let f=!0;for(let h=0;f&&h<u.length;++h){f=!1;const g=u[h];if(e(g))f=o({event:l,handlers:g});else if(typeof g=="function")g({event:l,next:()=>{f=!0}});else if(typeof g=="object")l.code in g?g[l.code]({event:l,next:()=>{f=!0}}):f=!0;else throw new i("Invalid event handler.","jsonld.InvalidEventHandler",{event:l})}return f}const a=new Set(["empty object","free-floating scalar","invalid @language value","invalid property","null @id value","null @value value","object with only @id","object with only @language","object with only @list","object with only @value","relative @id reference","relative @type reference","relative @vocab reference","reserved @id value","reserved @reverse value","reserved term","blank node predicate","relative graph reference","relative object reference","relative predicate reference","relative subject reference","rdfDirection not set"]);return r.safeEventHandler=function({event:u,next:f}){if(u.level==="warning"&&a.has(u.code))throw new i("Safe mode validation error.","jsonld.ValidationError",{event:u});f()},r.logEventHandler=function({event:u,next:f}){console.log(`EVENT: ${u.message}`,{event:u}),f()},r.logWarningEventHandler=function({event:u,next:f}){u.level==="warning"&&console.warn(`WARNING: ${u.message}`,{event:u}),f()},r.unhandledEventHandler=function({event:u}){throw new i("No handler for event.","jsonld.UnhandledEvent",{event:u})},r.setDefaultEventHandler=function({eventHandler:l}={}){r.defaultEventHandler=l?n(l):null},Fa}var ja,Pd;function wi(){if(Pd)return ja;Pd=1;const i=Qt(),e=Kt(),{isArray:n,isObject:r,isString:o,isUndefined:a}=zt(),{isAbsolute:l,isRelative:u,prependBase:f}=Jn(),{handleEvent:h}=Qr(),{REGEX_BCP47:g,REGEX_KEYWORD:m,asArray:d,compareShortestLeast:_}=Qt(),b=new Map,I=1e4,A={};ja=A,A.process=async({activeCtx:w,localCtx:y,options:S,propagate:O=!0,overrideProtected:X=!1,cycles:C=new Set})=>{if(r(y)&&"@context"in y&&n(y["@context"])&&(y=y["@context"]),d(y).length===0)return w;const R=[],$=[({event:se,next:M})=>{R.push(se),M()}];S.eventHandler&&$.push(S.eventHandler);const G=S;S={...S,eventHandler:$};const j=await S.contextResolver.resolve({activeCtx:w,context:y,documentLoader:S.documentLoader,base:S.base});r(j[0].document)&&typeof j[0].document["@propagate"]=="boolean"&&(O=j[0].document["@propagate"]);let F=w;!O&&!F.previousContext&&(F=F.clone(),F.previousContext=w);for(const se of j){let{document:M}=se;if(w=F,M===null){if(!X&&Object.keys(w.protected).length!==0)throw new e("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});F=w=A.getInitialContext(S).clone();continue}const re=se.getProcessed(w);if(re){if(G.eventHandler)for(const oe of re.events)h({event:oe,options:G});F=w=re.context;continue}if(r(M)&&"@context"in M&&(M=M["@context"]),!r(M))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:M});F=F.clone();const B=new Map;if("@version"in M){if(M["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+M["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:M});if(w.processingMode&&w.processingMode==="json-ld-1.0")throw new e("@version: "+M["@version"]+" not compatible with "+w.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:M});F.processingMode="json-ld-1.1",F["@version"]=M["@version"],B.set("@version",!0)}if(F.processingMode=F.processingMode||w.processingMode,"@base"in M){let oe=M["@base"];if(!(oe===null||l(oe)))if(u(oe))oe=f(F["@base"],oe);else throw new e('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:M});F["@base"]=oe,B.set("@base",!0)}if("@vocab"in M){const oe=M["@vocab"];if(oe===null)delete F["@vocab"];else if(o(oe)){if(!l(oe)&&A.processingMode(F,1))throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:M});{const T=N(F,oe,{vocab:!0,base:!0},void 0,void 0,S);l(T)||S.eventHandler&&h({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:T}},options:S}),F["@vocab"]=T}}else throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:M});B.set("@vocab",!0)}if("@language"in M){const oe=M["@language"];if(oe===null)delete F["@language"];else if(o(oe))oe.match(g)||S.eventHandler&&h({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:oe}},options:S}),F["@language"]=oe.toLowerCase();else throw new e('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:M});B.set("@language",!0)}if("@direction"in M){const oe=M["@direction"];if(w.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+w.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:M});if(oe===null)delete F["@direction"];else{if(oe!=="ltr"&&oe!=="rtl")throw new e('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:M});F["@direction"]=oe}B.set("@direction",!0)}if("@propagate"in M){const oe=M["@propagate"];if(w.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+w.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:M});if(typeof oe!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:y});B.set("@propagate",!0)}if("@import"in M){const oe=M["@import"];if(w.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+w.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:M});if(!o(oe))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:y});const T=await S.contextResolver.resolve({activeCtx:w,context:oe,documentLoader:S.documentLoader,base:S.base});if(T.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:y});const Q=T[0].getProcessed(w);if(Q)M=Q;else{const ie=T[0].document;if("@import"in ie)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:y});for(const Y in ie)M.hasOwnProperty(Y)||(M[Y]=ie[Y]);T[0].setProcessed(w,M)}B.set("@import",!0)}B.set("@protected",M["@protected"]||!1);for(const oe in M)if(A.createTermDefinition({activeCtx:F,localCtx:M,term:oe,defined:B,options:S,overrideProtected:X}),r(M[oe])&&"@context"in M[oe]){const T=M[oe]["@context"];let Q=!0;if(o(T)){const ie=f(S.base,T);C.has(ie)?Q=!1:C.add(ie)}if(Q)try{await A.process({activeCtx:F.clone(),localCtx:M[oe]["@context"],overrideProtected:!0,options:S,cycles:C})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:M[oe]["@context"],term:oe})}}se.setProcessed(w,{context:F,events:R})}return F},A.createTermDefinition=({activeCtx:w,localCtx:y,term:S,defined:O,options:X,overrideProtected:C=!1})=>{if(O.has(S)){if(O.get(S))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:y,term:S})}O.set(S,!1);let U;if(y.hasOwnProperty(S)&&(U=y[S]),S==="@type"&&r(U)&&(U["@container"]||"@set")==="@set"&&A.processingMode(w,1.1)){const M=["@container","@id","@protected"],re=Object.keys(U);if(re.length===0||re.some(B=>!M.includes(B)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:y,term:S})}else{if(A.isKeyword(S))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:y,term:S});if(S.match(m)){X.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:S}},options:X});return}else if(S==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:y})}const R=w.mappings.get(S);w.mappings.has(S)&&w.mappings.delete(S);let $=!1;if((o(U)||U===null)&&($=!0,U={"@id":U}),!r(U))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:y});const G={};w.mappings.set(S,G),G.reverse=!1;const j=["@container","@id","@language","@reverse","@type"];A.processingMode(w,1.1)&&j.push("@context","@direction","@index","@nest","@prefix","@protected");for(const M in U)if(!j.includes(M))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+M,"jsonld.SyntaxError",{code:"invalid term definition",context:y});const F=S.indexOf(":");if(G._termHasColon=F>0,"@reverse"in U){if("@id"in U)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:y});if("@nest"in U)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:y});const M=U["@reverse"];if(!o(M))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:y});if(M.match(m)){X.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:M}},options:X}),R?w.mappings.set(S,R):w.mappings.delete(S);return}const re=N(w,M,{vocab:!0,base:!1},y,O,X);if(!l(re))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:y});G["@id"]=re,G.reverse=!0}else if("@id"in U){let M=U["@id"];if(M&&!o(M))throw new e("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:y});if(M===null)G["@id"]=null;else if(!A.isKeyword(M)&&M.match(m)){X.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:M}},options:X}),R?w.mappings.set(S,R):w.mappings.delete(S);return}else if(M!==S){if(M=N(w,M,{vocab:!0,base:!1},y,O,X),!l(M)&&!A.isKeyword(M))throw new e("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:y});if(S.match(/(?::[^:])|\//)){const re=new Map(O).set(S,!0);if(N(w,S,{vocab:!0,base:!1},y,re,X)!==M)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:y})}G["@id"]=M,G._prefix=$&&!G._termHasColon&&M.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in G))if(G._termHasColon){const M=S.substr(0,F);if(y.hasOwnProperty(M)&&A.createTermDefinition({activeCtx:w,localCtx:y,term:M,defined:O,options:X}),w.mappings.has(M)){const re=S.substr(F+1);G["@id"]=w.mappings.get(M)["@id"]+re}else G["@id"]=S}else if(S==="@type")G["@id"]=S;else{if(!("@vocab"in w))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:y,term:S});G["@id"]=w["@vocab"]+S}if((U["@protected"]===!0||O.get("@protected")===!0&&U["@protected"]!==!1)&&(w.protected[S]=!0,G.protected=!0),O.set(S,!0),"@type"in U){let M=U["@type"];if(!o(M))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:y});if(M==="@json"||M==="@none"){if(A.processingMode(w,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${M}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:y})}else if(M!=="@id"&&M!=="@vocab"){if(M=N(w,M,{vocab:!0,base:!1},y,O,X),!l(M))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:y});if(M.indexOf("_:")===0)throw new e("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:y})}G["@type"]=M}if("@container"in U){const M=o(U["@container"])?[U["@container"]]:U["@container"]||[],re=["@list","@set","@index","@language"];let B=!0;const oe=M.includes("@set");if(A.processingMode(w,1.1)){if(re.push("@graph","@id","@type"),M.includes("@list")){if(M.length!==1)throw new e("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:y})}else if(M.includes("@graph")){if(M.some(T=>T!=="@graph"&&T!=="@id"&&T!=="@index"&&T!=="@set"))throw new e("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:y})}else B&=M.length<=(oe?2:1);if(M.includes("@type")&&(G["@type"]=G["@type"]||"@id",!["@id","@vocab"].includes(G["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:y})}else B&=!n(U["@container"]),B&=M.length<=1;if(B&=M.every(T=>re.includes(T)),B&=!(oe&&M.includes("@list")),!B)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+re.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:y});if(G.reverse&&!M.every(T=>["@index","@set"].includes(T)))throw new e("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:y});G["@container"]=M}if("@index"in U){if(!("@container"in U)||!G["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${U["@index"]}" on term "${S}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:y});if(!o(U["@index"])||U["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${U["@index"]}" on term "${S}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:y});G["@index"]=U["@index"]}if("@context"in U&&(G["@context"]=U["@context"]),"@language"in U&&!("@type"in U)){let M=U["@language"];if(M!==null&&!o(M))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:y});M!==null&&(M=M.toLowerCase()),G["@language"]=M}if("@prefix"in U){if(S.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:y});if(A.isKeyword(G["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:y});if(typeof U["@prefix"]=="boolean")G._prefix=U["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:y})}if("@direction"in U){const M=U["@direction"];if(M!==null&&M!=="ltr"&&M!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:y});G["@direction"]=M}if("@nest"in U){const M=U["@nest"];if(!o(M)||M!=="@nest"&&M.indexOf("@")===0)throw new e("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:y});G["@nest"]=M}const se=G["@id"];if(se==="@context"||se==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:y});if(R&&R.protected&&!C&&(w.protected[S]=!0,G.protected=!0,!P(R,G)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:y,term:S})},A.expandIri=(w,y,S,O)=>N(w,y,S,void 0,void 0,O);function N(w,y,S,O,X,C){if(y===null||!o(y)||A.isKeyword(y))return y;if(y.match(m))return null;if(O&&O.hasOwnProperty(y)&&X.get(y)!==!0&&A.createTermDefinition({activeCtx:w,localCtx:O,term:y,defined:X,options:C}),S=S||{},S.vocab){const R=w.mappings.get(y);if(R===null)return null;if(r(R)&&"@id"in R)return R["@id"]}const U=y.indexOf(":");if(U>0){const R=y.substr(0,U),$=y.substr(U+1);if(R==="_"||$.indexOf("//")===0)return y;O&&O.hasOwnProperty(R)&&A.createTermDefinition({activeCtx:w,localCtx:O,term:R,defined:X,options:C});const G=w.mappings.get(R);if(G&&G._prefix)return G["@id"]+$;if(l(y))return y}if(S.vocab&&"@vocab"in w)y=w["@vocab"]+y;else if(S.base){let R,$;"@base"in w?w["@base"]?($=f(C.base,w["@base"]),R=f($,y)):($=w["@base"],R=y):($=C.base,R=f(C.base,y)),y=R}return y}A.getInitialContext=w=>{const y=JSON.stringify({processingMode:w.processingMode}),S=b.get(y);if(S)return S;const O={processingMode:w.processingMode,mappings:new Map,inverse:null,getInverse:X,clone:R,revertToPreviousContext:$,protected:{}};return b.size===I&&b.clear(),b.set(y,O),O;function X(){const G=this;if(G.inverse)return G.inverse;const j=G.inverse={},F=G.fastCurieMap={},se={},M=(G["@language"]||"@none").toLowerCase(),re=G["@direction"],B=G.mappings,oe=[...B.keys()].sort(_);for(const T of oe){const Q=B.get(T);if(Q===null)continue;let ie=Q["@container"]||"@none";if(ie=[].concat(ie).sort().join(""),Q["@id"]===null)continue;const Y=d(Q["@id"]);for(const me of Y){let Z=j[me];const W=A.isKeyword(me);if(Z)!W&&!Q._termHasColon&&se[me].push(T);else if(j[me]=Z={},!W&&!Q._termHasColon){se[me]=[T];const ee={iri:me,terms:se[me]};me[0]in F?F[me[0]].push(ee):F[me[0]]=[ee]}if(Z[ie]||(Z[ie]={"@language":{},"@type":{},"@any":{}}),Z=Z[ie],U(T,Z["@any"],"@none"),Q.reverse)U(T,Z["@type"],"@reverse");else if(Q["@type"]==="@none")U(T,Z["@any"],"@none"),U(T,Z["@language"],"@none"),U(T,Z["@type"],"@none");else if("@type"in Q)U(T,Z["@type"],Q["@type"]);else if("@language"in Q&&"@direction"in Q){const ee=Q["@language"],K=Q["@direction"];ee&&K?U(T,Z["@language"],`${ee}_${K}`.toLowerCase()):ee?U(T,Z["@language"],ee.toLowerCase()):K?U(T,Z["@language"],`_${K}`):U(T,Z["@language"],"@null")}else"@language"in Q?U(T,Z["@language"],(Q["@language"]||"@null").toLowerCase()):"@direction"in Q?Q["@direction"]?U(T,Z["@language"],`_${Q["@direction"]}`):U(T,Z["@language"],"@none"):re?(U(T,Z["@language"],`_${re}`),U(T,Z["@language"],"@none"),U(T,Z["@type"],"@none")):(U(T,Z["@language"],M),U(T,Z["@language"],"@none"),U(T,Z["@type"],"@none"))}}for(const T in F)C(F,T,1);return j}function C(G,j,F){const se=G[j],M=G[j]={};let re,B;for(const oe of se)re=oe.iri,F>=re.length?B="":B=re[F],B in M?M[B].push(oe):M[B]=[oe];for(const oe in M)oe!==""&&C(M,oe,F+1)}function U(G,j,F){j.hasOwnProperty(F)||(j[F]=G)}function R(){const G={};return G.mappings=i.clone(this.mappings),G.clone=this.clone,G.inverse=null,G.getInverse=this.getInverse,G.protected=i.clone(this.protected),this.previousContext&&(G.previousContext=this.previousContext.clone()),G.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(G["@base"]=this["@base"]),"@language"in this&&(G["@language"]=this["@language"]),"@vocab"in this&&(G["@vocab"]=this["@vocab"]),G}function $(){return this.previousContext?this.previousContext.clone():this}},A.getContextValue=(w,y,S)=>{if(y===null)return S==="@context"?void 0:null;if(w.mappings.has(y)){const O=w.mappings.get(y);if(a(S))return O;if(O.hasOwnProperty(S))return O[S]}if(S==="@language"&&S in w||S==="@direction"&&S in w)return w[S];if(S!=="@context")return null},A.processingMode=(w,y)=>y.toString()>="1.1"?!w.processingMode||w.processingMode>="json-ld-"+y.toString():w.processingMode==="json-ld-1.0",A.isKeyword=w=>{if(!o(w)||w[0]!=="@")return!1;switch(w){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1};function P(w,y){if(!(w&&typeof w=="object")||!(y&&typeof y=="object"))return w===y;const S=Array.isArray(w);if(S!==Array.isArray(y))return!1;if(S){if(w.length!==y.length)return!1;for(let C=0;C<w.length;++C)if(!P(w[C],y[C]))return!1;return!0}const O=Object.keys(w),X=Object.keys(y);if(O.length!==X.length)return!1;for(const C in w){let U=w[C],R=y[C];if(C==="@container"&&Array.isArray(U)&&Array.isArray(R)&&(U=U.slice().sort(),R=R.slice().sort()),!P(U,R))return!1}return!0}return ja}var Ba,kd;function Dm(){if(kd)return Ba;kd=1;const i=Kt(),{isArray:e,isObject:n,isEmptyObject:r,isString:o,isUndefined:a}=zt(),{isList:l,isValue:u,isGraph:f,isSubject:h}=On(),{expandIri:g,getContextValue:m,isKeyword:d,process:_,processingMode:b}=wi(),{isAbsolute:I}=Jn(),{REGEX_BCP47:A,REGEX_KEYWORD:N,addValue:P,asArray:w,getValues:y,validateTypeValue:S}=Qt(),{handleEvent:O}=Qr(),X={};Ba=X,X.expand=async({activeCtx:j,activeProperty:F=null,element:se,options:M={},insideList:re=!1,insideIndex:B=!1,typeScopedContext:oe=null})=>{if(se==null)return null;if(F==="@default"&&(M=Object.assign({},M,{isFrame:!1})),!e(se)&&!n(se))return!re&&(F===null||g(j,F,{vocab:!0},M)==="@graph")?(M.eventHandler&&O({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:se}},options:M}),null):R({activeCtx:j,activeProperty:F,value:se,options:M});if(e(se)){let ee=[];const K=m(j,F,"@container")||[];re=re||K.includes("@list");for(let ue=0;ue<se.length;++ue){let ce=await X.expand({activeCtx:j,activeProperty:F,element:se[ue],options:M,insideIndex:B,typeScopedContext:oe});re&&e(ce)&&(ce={"@list":ce}),ce!==null&&(e(ce)?ee=ee.concat(ce):ee.push(ce))}return ee}const T=g(j,F,{vocab:!0},M),Q=m(j,F,"@context");oe=oe||(j.previousContext?j:null);let ie=Object.keys(se).sort(),Y=!B;if(Y&&oe&&ie.length<=2&&!ie.includes("@context"))for(const ee of ie){const K=g(oe,ee,{vocab:!0},M);if(K==="@value"){Y=!1,j=oe;break}if(K==="@id"&&ie.length===1){Y=!1;break}}Y&&(j=j.revertToPreviousContext()),a(Q)||(j=await _({activeCtx:j,localCtx:Q,propagate:!0,overrideProtected:!0,options:M})),"@context"in se&&(j=await _({activeCtx:j,localCtx:se["@context"],options:M})),oe=j;let me=null;for(const ee of ie)if(g(j,ee,{vocab:!0},M)==="@type"){me=me||ee;const ue=se[ee],ce=Array.isArray(ue)?ue.length>1?ue.slice().sort():ue:[ue];for(const Ee of ce){const Te=m(oe,Ee,"@context");a(Te)||(j=await _({activeCtx:j,localCtx:Te,options:M,propagate:!1}))}}let Z={};await U({activeCtx:j,activeProperty:F,expandedActiveProperty:T,element:se,expandedParent:Z,options:M,insideList:re,typeKey:me,typeScopedContext:oe}),ie=Object.keys(Z);let W=ie.length;if("@value"in Z){if("@type"in Z&&("@language"in Z||"@direction"in Z))throw new i('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:Z});let ee=W-1;if("@type"in Z&&(ee-=1),"@index"in Z&&(ee-=1),"@language"in Z&&(ee-=1),"@direction"in Z&&(ee-=1),ee!==0)throw new i('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:Z});const K=Z["@value"]===null?[]:w(Z["@value"]),ue=y(Z,"@type");if(!(b(j,1.1)&&ue.includes("@json")&&ue.length===1))if(K.length===0)M.eventHandler&&O({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:Z}},options:M}),Z=null;else{if(!K.every(ce=>o(ce)||r(ce))&&"@language"in Z)throw new i("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:Z});if(!ue.every(ce=>I(ce)&&!(o(ce)&&ce.indexOf("_:")===0)||r(ce)))throw new i('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:Z})}}else if("@type"in Z&&!e(Z["@type"]))Z["@type"]=[Z["@type"]];else if("@set"in Z||"@list"in Z){if(W>1&&!(W===2&&"@index"in Z))throw new i('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:Z});"@set"in Z&&(Z=Z["@set"],ie=Object.keys(Z),W=ie.length)}else W===1&&"@language"in Z&&(M.eventHandler&&O({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:Z}},options:M}),Z=null);return n(Z)&&!M.keepFreeFloatingNodes&&!re&&(F===null||T==="@graph"||(m(j,F,"@container")||[]).includes("@graph"))&&(Z=C({value:Z,count:W,options:M})),Z};function C({value:j,count:F,options:se}){if(F===0||"@value"in j||"@list"in j||F===1&&"@id"in j){if(se.eventHandler){let M,re;F===0?(M="empty object",re="Dropping empty object."):"@value"in j?(M="object with only @value",re="Dropping object with only @value."):"@list"in j?(M="object with only @list",re="Dropping object with only @list."):F===1&&"@id"in j&&(M="object with only @id",re="Dropping object with only @id."),O({event:{type:["JsonLdEvent"],code:M,level:"warning",message:re,details:{value:j}},options:se})}return null}return j}async function U({activeCtx:j,activeProperty:F,expandedActiveProperty:se,element:M,expandedParent:re,options:B={},insideList:oe,typeKey:T,typeScopedContext:Q}){const ie=Object.keys(M).sort(),Y=[];let me;const Z=M[T]&&g(j,e(M[T])?M[T][0]:M[T],{vocab:!0},{...B,typeExpansion:!0})==="@json";for(const W of ie){let ee=M[W],K;if(W==="@context")continue;const ue=g(j,W,{vocab:!0},B);if(ue===null||!(I(ue)||d(ue))){B.eventHandler&&O({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:W,expandedProperty:ue}},options:B});continue}if(d(ue)){if(se==="@reverse")throw new i("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:ee});if(ue in re&&ue!=="@included"&&ue!=="@type")throw new i("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:ue})}if(ue==="@id"){if(!o(ee)){if(!B.isFrame)throw new i('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:ee});if(n(ee)){if(!r(ee))throw new i('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:ee})}else if(e(ee)){if(!ee.every(q=>o(q)))throw new i('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:ee})}else throw new i('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:ee})}P(re,"@id",w(ee).map(q=>{if(o(q)){const te=g(j,q,{base:!0},B);return B.eventHandler&&(te===null?O(q===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:q}},options:B}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:q}},options:B}):I(te)||O({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:q,expandedId:te}},options:B})),te}return q}),{propertyIsArray:B.isFrame});continue}if(ue==="@type"){n(ee)&&(ee=Object.fromEntries(Object.entries(ee).map(([q,te])=>[g(Q,q,{vocab:!0}),w(te).map(fe=>g(Q,fe,{base:!0,vocab:!0},{...B,typeExpansion:!0}))]))),S(ee,B.isFrame),P(re,"@type",w(ee).map(q=>{if(o(q)){const te=g(Q,q,{base:!0,vocab:!0},{...B,typeExpansion:!0});return te!=="@json"&&!I(te)&&B.eventHandler&&O({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:q}},options:B}),te}return q}),{propertyIsArray:!!B.isFrame});continue}if(ue==="@included"&&b(j,1.1)){const q=w(await X.expand({activeCtx:j,activeProperty:F,element:ee,options:B}));if(!q.every(te=>h(te)))throw new i("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:ee});P(re,"@included",q,{propertyIsArray:!0});continue}if(ue==="@graph"&&!(n(ee)||e(ee)))throw new i('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:ee});if(ue==="@value"){me=ee,Z&&b(j,1.1)?re["@value"]=ee:P(re,"@value",ee,{propertyIsArray:B.isFrame});continue}if(ue==="@language"){if(ee===null)continue;if(!o(ee)&&!B.isFrame)throw new i('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:ee});ee=w(ee).map(q=>o(q)?q.toLowerCase():q);for(const q of ee)o(q)&&!q.match(A)&&B.eventHandler&&O({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:q}},options:B});P(re,"@language",ee,{propertyIsArray:B.isFrame});continue}if(ue==="@direction"){if(!o(ee)&&!B.isFrame)throw new i('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:ee});ee=w(ee);for(const q of ee)if(o(q)&&q!=="ltr"&&q!=="rtl")throw new i('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:ee});P(re,"@direction",ee,{propertyIsArray:B.isFrame});continue}if(ue==="@index"){if(!o(ee))throw new i('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:ee});P(re,"@index",ee);continue}if(ue==="@reverse"){if(!n(ee))throw new i('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:ee});if(K=await X.expand({activeCtx:j,activeProperty:"@reverse",element:ee,options:B}),"@reverse"in K)for(const te in K["@reverse"])P(re,te,K["@reverse"][te],{propertyIsArray:!0});let q=re["@reverse"]||null;for(const te in K){if(te==="@reverse")continue;q===null&&(q=re["@reverse"]={}),P(q,te,[],{propertyIsArray:!0});const fe=K[te];for(let xe=0;xe<fe.length;++xe){const Se=fe[xe];if(u(Se)||l(Se))throw new i('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:K});P(q,te,Se,{propertyIsArray:!0})}}continue}if(ue==="@nest"){Y.push(W);continue}let ce=j;const Ee=m(j,W,"@context");a(Ee)||(ce=await _({activeCtx:j,localCtx:Ee,propagate:!0,overrideProtected:!0,options:B}));const Te=m(j,W,"@container")||[];if(Te.includes("@language")&&n(ee)){const q=m(ce,W,"@direction");K=$(ce,ee,q,B)}else if(Te.includes("@index")&&n(ee)){const q=Te.includes("@graph"),te=m(ce,W,"@index")||"@index",fe=te!=="@index"&&g(j,te,{vocab:!0},B);K=await G({activeCtx:ce,options:B,activeProperty:W,value:ee,asGraph:q,indexKey:te,propertyIndex:fe})}else if(Te.includes("@id")&&n(ee)){const q=Te.includes("@graph");K=await G({activeCtx:ce,options:B,activeProperty:W,value:ee,asGraph:q,indexKey:"@id"})}else if(Te.includes("@type")&&n(ee))K=await G({activeCtx:ce.revertToPreviousContext(),options:B,activeProperty:W,value:ee,asGraph:!1,indexKey:"@type"});else{const q=ue==="@list";if(q||ue==="@set"){let te=F;q&&se==="@graph"&&(te=null),K=await X.expand({activeCtx:ce,activeProperty:te,element:ee,options:B,insideList:q})}else m(j,W,"@type")==="@json"?K={"@type":"@json","@value":ee}:K=await X.expand({activeCtx:ce,activeProperty:W,element:ee,options:B,insideList:!1})}if(!(K===null&&ue!=="@value")){if(ue!=="@list"&&!l(K)&&Te.includes("@list")&&(K={"@list":w(K)}),Te.includes("@graph")&&!Te.some(q=>q==="@id"||q==="@index")){if(K=w(K),B.isFrame||(K=K.filter(q=>{const te=Object.keys(q).length;return C({value:q,count:te,options:B})!==null})),K.length===0)continue;K=K.map(q=>({"@graph":w(q)}))}if(ce.mappings.has(W)&&ce.mappings.get(W).reverse){const q=re["@reverse"]=re["@reverse"]||{};K=w(K);for(let te=0;te<K.length;++te){const fe=K[te];if(u(fe)||l(fe))throw new i('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:K});P(q,ue,fe,{propertyIsArray:!0})}continue}P(re,ue,K,{propertyIsArray:!0})}}if("@value"in re&&!(re["@type"]==="@json"&&b(j,1.1))){if((n(me)||e(me))&&!B.isFrame)throw new i('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:me})}for(const W of Y){const ee=e(M[W])?M[W]:[M[W]];for(const K of ee){if(!n(K)||Object.keys(K).some(ue=>g(j,ue,{vocab:!0},B)==="@value"))throw new i("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:K});await U({activeCtx:j,activeProperty:F,expandedActiveProperty:se,element:K,expandedParent:re,options:B,insideList:oe,typeScopedContext:Q,typeKey:T})}}}function R({activeCtx:j,activeProperty:F,value:se,options:M}){if(se==null)return null;const re=g(j,F,{vocab:!0},M);if(re==="@id")return g(j,se,{base:!0},M);if(re==="@type")return g(j,se,{vocab:!0,base:!0},{...M,typeExpansion:!0});const B=m(j,F,"@type");if((B==="@id"||re==="@graph")&&o(se)){const T=g(j,se,{base:!0},M);return T===null&&se.match(N)&&M.eventHandler&&O({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:F}},options:M}),{"@id":T}}if(B==="@vocab"&&o(se))return{"@id":g(j,se,{vocab:!0,base:!0},M)};if(d(re))return se;const oe={};if(B&&!["@id","@vocab","@none"].includes(B))oe["@type"]=B;else if(o(se)){const T=m(j,F,"@language");T!==null&&(oe["@language"]=T);const Q=m(j,F,"@direction");Q!==null&&(oe["@direction"]=Q)}return["boolean","number","string"].includes(typeof se)||(se=se.toString()),oe["@value"]=se,oe}function $(j,F,se,M){const re=[],B=Object.keys(F).sort();for(const oe of B){const T=g(j,oe,{vocab:!0},M);let Q=F[oe];e(Q)||(Q=[Q]);for(const ie of Q){if(ie===null)continue;if(!o(ie))throw new i("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:F});const Y={"@value":ie};T!=="@none"&&(oe.match(A)||M.eventHandler&&O({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:oe}},options:M}),Y["@language"]=oe.toLowerCase()),se&&(Y["@direction"]=se),re.push(Y)}}return re}async function G({activeCtx:j,options:F,activeProperty:se,value:M,asGraph:re,indexKey:B,propertyIndex:oe}){const T=[],Q=Object.keys(M).sort(),ie=B==="@type";for(let Y of Q){if(ie){const W=m(j,Y,"@context");a(W)||(j=await _({activeCtx:j,localCtx:W,propagate:!1,options:F}))}let me=M[Y];e(me)||(me=[me]),me=await X.expand({activeCtx:j,activeProperty:se,element:me,options:F,insideList:!1,insideIndex:!0});let Z;oe?Y==="@none"?Z="@none":Z=R({activeCtx:j,activeProperty:B,value:Y,options:F}):Z=g(j,Y,{vocab:!0},F),B==="@id"?Y=g(j,Y,{base:!0},F):ie&&(Y=Z);for(let W of me){if(re&&!f(W)&&(W={"@graph":[W]}),B==="@type")Z==="@none"||(W["@type"]?W["@type"]=[Y].concat(W["@type"]):W["@type"]=[Y]);else{if(u(W)&&!["@language","@type","@index"].includes(B))throw new i(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${B}".`,"jsonld.SyntaxError",{code:"invalid value object",value:W});oe?Z!=="@none"&&P(W,oe,Z,{propertyIsArray:!0,prependValue:!0}):Z!=="@none"&&!(B in W)&&(W[B]=Y)}T.push(W)}}return T}return Ba}var $a,Dd;function Ys(){if(Dd)return $a;Dd=1;const{isKeyword:i}=wi(),e=On(),n=zt(),r=Qt(),o=Kt(),a={};return $a=a,a.createMergedNodeMap=(l,u)=>{u=u||{};const f=u.issuer||new r.IdentifierIssuer("_:b"),h={"@default":{}};return a.createNodeMap(l,h,"@default",f),a.mergeNodeMaps(h)},a.createNodeMap=(l,u,f,h,g,m)=>{if(n.isArray(l)){for(const I of l)a.createNodeMap(I,u,f,h,void 0,m);return}if(!n.isObject(l)){m&&m.push(l);return}if(e.isValue(l)){if("@type"in l){let I=l["@type"];I.indexOf("_:")===0&&(l["@type"]=I=h.getId(I))}m&&m.push(l);return}else if(m&&e.isList(l)){const I=[];a.createNodeMap(l["@list"],u,f,h,g,I),m.push({"@list":I});return}if("@type"in l){const I=l["@type"];for(const A of I)A.indexOf("_:")===0&&h.getId(A)}n.isUndefined(g)&&(g=e.isBlankNode(l)?h.getId(l["@id"]):l["@id"]),m&&m.push({"@id":g});const d=u[f],_=d[g]=d[g]||{};_["@id"]=g;const b=Object.keys(l).sort();for(let I of b){if(I==="@id")continue;if(I==="@reverse"){const N={"@id":g},P=l["@reverse"];for(const w in P){const y=P[w];for(const S of y){let O=S["@id"];e.isBlankNode(S)&&(O=h.getId(O)),a.createNodeMap(S,u,f,h,O),r.addValue(d[O],w,N,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(I==="@graph"){g in u||(u[g]={}),a.createNodeMap(l[I],u,g,h);continue}if(I==="@included"){a.createNodeMap(l[I],u,f,h);continue}if(I!=="@type"&&i(I)){if(I==="@index"&&I in _&&(l[I]!==_[I]||l[I]["@id"]!==_[I]["@id"]))throw new o("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:_});_[I]=l[I];continue}const A=l[I];if(I.indexOf("_:")===0&&(I=h.getId(I)),A.length===0){r.addValue(_,I,[],{propertyIsArray:!0});continue}for(let N of A)if(I==="@type"&&(N=N.indexOf("_:")===0?h.getId(N):N),e.isSubject(N)||e.isSubjectReference(N)){if("@id"in N&&!N["@id"])continue;const P=e.isBlankNode(N)?h.getId(N["@id"]):N["@id"];r.addValue(_,I,{"@id":P},{propertyIsArray:!0,allowDuplicate:!1}),a.createNodeMap(N,u,f,h,P)}else if(e.isValue(N))r.addValue(_,I,N,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(N)){const P=[];a.createNodeMap(N["@list"],u,f,h,g,P),N={"@list":P},r.addValue(_,I,N,{propertyIsArray:!0,allowDuplicate:!1})}else a.createNodeMap(N,u,f,h,g),r.addValue(_,I,N,{propertyIsArray:!0,allowDuplicate:!1})}},a.mergeNodeMapGraphs=l=>{const u={};for(const f of Object.keys(l).sort())for(const h of Object.keys(l[f]).sort()){const g=l[f][h];h in u||(u[h]={"@id":h});const m=u[h];for(const d of Object.keys(g).sort())if(i(d)&&d!=="@type")m[d]=r.clone(g[d]);else for(const _ of g[d])r.addValue(m,d,r.clone(_),{propertyIsArray:!0,allowDuplicate:!1})}return u},a.mergeNodeMaps=l=>{const u=l["@default"],f=Object.keys(l).sort();for(const h of f){if(h==="@default")continue;const g=l[h];let m=u[h];m?"@graph"in m||(m["@graph"]=[]):u[h]=m={"@id":h,"@graph":[]};const d=m["@graph"];for(const _ of Object.keys(g).sort()){const b=g[_];e.isSubjectReference(b)||d.push(b)}}return u},$a}var qa,Md;function Mm(){if(Md)return qa;Md=1;const{isSubjectReference:i}=On(),{createMergedNodeMap:e}=Ys(),n={};return qa=n,n.flatten=r=>{const o=e(r),a=[],l=Object.keys(o).sort();for(let u=0;u<l.length;++u){const f=o[l[u]];i(f)||a.push(f)}return a},qa}var za,Od;function Om(){if(Od)return za;Od=1;const i=Kt(),e=On(),n=zt(),{REGEX_BCP47:r,addValue:o}=Qt(),{handleEvent:a}=Qr(),{RDF_LIST:l,RDF_FIRST:u,RDF_REST:f,RDF_NIL:h,RDF_TYPE:g,RDF_JSON_LITERAL:m,XSD_BOOLEAN:d,XSD_DOUBLE:_,XSD_INTEGER:b,XSD_STRING:I}=Wl(),A={};za=A,A.fromRDF=async(w,y)=>{const{useRdfType:S=!1,useNativeTypes:O=!1,rdfDirection:X=null}=y,C={},U={"@default":C},R={};if(X){if(X==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:X});if(X!=="i18n-datatype")throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:X})}for(const j of w){const F=j.graph.termType==="DefaultGraph"?"@default":j.graph.value;F in U||(U[F]={}),F!=="@default"&&!(F in C)&&(C[F]={"@id":F});const se=U[F],M=P(j.subject),re=j.predicate.value,B=j.object;M in se||(se[M]={"@id":M});const oe=se[M],T=P(B),Q=!!T;if(Q&&!(T in se)&&(se[T]={"@id":T}),re===g&&!S&&Q){o(oe,"@type",T,{propertyIsArray:!0});continue}const ie=N(B,O,X,y);if(o(oe,re,ie,{propertyIsArray:!0}),Q)if(T===h){const Y=se[T];"usages"in Y||(Y.usages=[]),Y.usages.push({node:oe,property:re,value:ie})}else T in R?R[T]=!1:R[T]={node:oe,property:re,value:ie}}for(const j in U){const F=U[j];if(!(h in F))continue;const se=F[h];if(se.usages){for(let M of se.usages){let re=M.node,B=M.property,oe=M.value;const T=[],Q=[];let ie=Object.keys(re).length;for(;B===f&&n.isObject(R[re["@id"]])&&n.isArray(re[u])&&re[u].length===1&&n.isArray(re[f])&&re[f].length===1&&(ie===3||ie===4&&n.isArray(re["@type"])&&re["@type"].length===1&&re["@type"][0]===l)&&(T.push(re[u][0]),Q.push(re["@id"]),M=R[re["@id"]],re=M.node,B=M.property,oe=M.value,ie=Object.keys(re).length,!!e.isBlankNode(re)););delete oe["@id"],oe["@list"]=T.reverse();for(const Y of Q)delete F[Y]}delete se.usages}}const $=[],G=Object.keys(C).sort();for(const j of G){const F=C[j];if(j in U){const se=F["@graph"]=[],M=U[j],re=Object.keys(M).sort();for(const B of re){const oe=M[B];e.isSubjectReference(oe)||se.push(oe)}}e.isSubjectReference(F)||$.push(F)}return $};function N(w,y,S,O){const X=P(w);if(X)return{"@id":X};const C={"@value":w.value};if(w.language)w.language.match(r)||O.eventHandler&&a({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:w.language}},options:O}),C["@language"]=w.language;else{let U=w.datatype.value;if(U||(U=I),U===m){U="@json";try{C["@value"]=JSON.parse(C["@value"])}catch(R){throw new i("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:C["@value"],cause:R})}}if(y)if(U===d)C["@value"]==="true"||C["@value"]==="1"?C["@value"]=!0:C["@value"]==="false"||C["@value"]==="0"?C["@value"]=!1:C["@type"]=U;else if(U===b)if(n.isNumeric(C["@value"])){const R=parseInt(C["@value"],10);R.toFixed(0)===C["@value"]&&(C["@value"]=R)}else C["@type"]=U;else U===_&&n.isNumeric(C["@value"])?C["@value"]=parseFloat(C["@value"]):C["@type"]=U;else if(S==="i18n-datatype"&&U.startsWith("https://www.w3.org/ns/i18n#")){const[,R,$]=U.split(/[#_]/);R.length>0&&(C["@language"]=R,R.match(r)||O.eventHandler&&a({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:R}},options:O})),C["@direction"]=$}else U!==I&&(C["@type"]=U)}return C}function P(w){return w.termType==="NamedNode"?w.value:w.termType==="BlankNode"?"_:"+w.value:null}return za}var Ha,Fd;function Fm(){return Fd||(Fd=1,Ha=function i(e){if(typeof e=="number"&&isNaN(e))throw new Error("NaN is not allowed");if(typeof e=="number"&&!isFinite(e))throw new Error("Infinity is not allowed");return e===null||typeof e!="object"?JSON.stringify(e):e.toJSON instanceof Function?i(e.toJSON()):Array.isArray(e)?`[${e.reduce((o,a,l)=>`${o}${l===0?"":","}${i(a===void 0||typeof a=="symbol"?null:a)}`,"")}]`:`{${Object.keys(e).sort().reduce((r,o)=>{if(e[o]===void 0||typeof e[o]=="symbol")return r;const a=r.length===0?"":",";return`${r}${a}${i(o)}:${i(e[o])}`},"")}}`}),Ha}var Ua,jd;function jm(){if(jd)return Ua;jd=1;const{createNodeMap:i}=Ys(),{isKeyword:e}=wi(),n=On(),r=Fm(),o=Kt(),a=zt(),l=Qt(),{handleEvent:u}=Qr(),{RDF_FIRST:f,RDF_REST:h,RDF_NIL:g,RDF_TYPE:m,RDF_JSON_LITERAL:d,RDF_LANGSTRING:_,XSD_BOOLEAN:b,XSD_DOUBLE:I,XSD_INTEGER:A,XSD_STRING:N}=Wl(),{isAbsolute:P}=Jn(),w={};Ua=w,w.toRDF=(C,U)=>{const R=new l.IdentifierIssuer("_:b"),$={"@default":{}};i(C,$,"@default",R);const G=[],j=Object.keys($).sort();for(const F of j){let se;if(F==="@default")se={termType:"DefaultGraph",value:""};else if(P(F))se=X(F);else{U.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:F}},options:U});continue}y(G,$[F],se,R,U)}return G};function y(C,U,R,$,G){const j=Object.keys(U).sort();for(const F of j){const se=U[F],M=Object.keys(se).sort();for(let re of M){const B=se[re];if(re==="@type")re=m;else if(e(re))continue;for(const oe of B){const T=X(F);if(!P(F)){G.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:F}},options:G});continue}const Q=X(re);if(!P(re)){G.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:re}},options:G});continue}if(Q.termType==="BlankNode"&&!G.produceGeneralizedRdf){G.eventHandler&&u({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:$.getOldIds().find(Y=>$.getId(Y)===re)}},options:G});continue}const ie=O(oe,$,C,R,G.rdfDirection,G);ie&&C.push({subject:T,predicate:Q,object:ie,graph:R})}}}}function S(C,U,R,$,G,j){const F={termType:"NamedNode",value:f},se={termType:"NamedNode",value:h},M={termType:"NamedNode",value:g},re=C.pop(),B=re?{termType:"BlankNode",value:U.getId().slice(2)}:M;let oe=B;for(const T of C){const Q=O(T,U,R,$,G,j),ie={termType:"BlankNode",value:U.getId().slice(2)};R.push({subject:oe,predicate:F,object:Q,graph:$}),R.push({subject:oe,predicate:se,object:ie,graph:$}),oe=ie}if(re){const T=O(re,U,R,$,G,j);R.push({subject:oe,predicate:F,object:T,graph:$}),R.push({subject:oe,predicate:se,object:M,graph:$})}return B}function O(C,U,R,$,G,j){let F;if(n.isValue(C)){F={termType:"Literal",value:void 0,datatype:{termType:"NamedNode"}};let se=C["@value"];const M=C["@type"]||null;if(M==="@json")F.value=r(se),F.datatype.value=d;else if(a.isBoolean(se))F.value=se.toString(),F.datatype.value=M||b;else if(a.isDouble(se)||M===I)a.isDouble(se)||(se=parseFloat(se)),F.value=se.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),F.datatype.value=M||I;else if(a.isNumber(se))F.value=se.toFixed(0),F.datatype.value=M||A;else if("@direction"in C&&G==="i18n-datatype"){const re=(C["@language"]||"").toLowerCase(),B=C["@direction"],oe=`https://www.w3.org/ns/i18n#${re}_${B}`;F.datatype.value=oe,F.value=se}else{if("@direction"in C&&G==="compound-literal")throw new o("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:G});if("@direction"in C&&G)throw new o("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:G});"@language"in C?("@direction"in C&&!G&&j.eventHandler&&u({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:F.value}},options:j}),F.value=se,F.datatype.value=M||_,F.language=C["@language"]):("@direction"in C&&!G&&j.eventHandler&&u({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:F.value}},options:j}),F.value=se,F.datatype.value=M||N)}}else if(n.isList(C)){const se=S(C["@list"],U,R,$,G,j);F={termType:se.termType,value:se.value}}else{const se=a.isObject(C)?C["@id"]:C;F=X(se)}return F.termType==="NamedNode"&&!P(F.value)?(j.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:F.value}},options:j}),null):F}function X(C){return C.startsWith("_:")?{termType:"BlankNode",value:C.slice(2)}:{termType:"NamedNode",value:C}}return Ua}var Va,Bd;function Bm(){if(Bd)return Va;Bd=1;const{isKeyword:i}=wi(),e=On(),n=zt(),r=Qt(),o=Jn(),a=Kt(),{createNodeMap:l,mergeNodeMapGraphs:u}=Ys(),f={};Va=f,f.frameMergedOrDefault=(y,S,O)=>{const X={options:O,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},C=new r.IdentifierIssuer("_:b");l(y,X.graphMap,"@default",C),O.merged&&(X.graphMap["@merged"]=u(X.graphMap),X.graph="@merged"),X.subjects=X.graphMap[X.graph];const U=[];f.frame(X,Object.keys(X.subjects).sort(),S,U),O.pruneBlankNodeIdentifiers&&(O.bnodesToClear=Object.keys(X.bnodeMap).filter(R=>X.bnodeMap[R].length===1));return O.link={},A(U,O)},f.frame=(y,S,O,X,C=null)=>{d(O),O=O[0];const U=y.options,R={embed:m(O,U,"embed"),explicit:m(O,U,"explicit"),requireAll:m(O,U,"requireAll")};y.link.hasOwnProperty(y.graph)||(y.link[y.graph]={});const $=y.link[y.graph],G=_(y,S,O,R),j=Object.keys(G).sort();for(const F of j){const se=G[F];if(C===null?y.uniqueEmbeds={[y.graph]:{}}:y.uniqueEmbeds[y.graph]=y.uniqueEmbeds[y.graph]||{},R.embed==="@link"&&F in $){N(X,C,$[F]);continue}const M={"@id":F};if(F.indexOf("_:")===0&&r.addValue(y.bnodeMap,F,M,{propertyIsArray:!0}),$[F]=M,(R.embed==="@first"||R.embed==="@last")&&y.is11)throw new a("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:O});if(!(!y.embedded&&y.uniqueEmbeds[y.graph].hasOwnProperty(F))){if(y.embedded&&(R.embed==="@never"||g(se,y.graph,y.subjectStack))){N(X,C,M);continue}if(y.embedded&&(R.embed=="@first"||R.embed=="@once")&&y.uniqueEmbeds[y.graph].hasOwnProperty(F)){N(X,C,M);continue}if(R.embed==="@last"&&F in y.uniqueEmbeds[y.graph]&&I(y,F),y.uniqueEmbeds[y.graph][F]={parent:X,property:C},y.subjectStack.push({subject:se,graph:y.graph}),F in y.graphMap){let re=!1,B=null;"@graph"in O?(B=O["@graph"][0],re=!(F==="@merged"||F==="@default"),n.isObject(B)||(B={})):(re=y.graph!=="@merged",B={}),re&&f.frame({...y,graph:F,embedded:!1},Object.keys(y.graphMap[F]).sort(),[B],M,"@graph")}"@included"in O&&f.frame({...y,embedded:!1},S,O["@included"],M,"@included");for(const re of Object.keys(se).sort()){if(i(re)){if(M[re]=r.clone(se[re]),re==="@type")for(const B of se["@type"])B.indexOf("_:")===0&&r.addValue(y.bnodeMap,B,M,{propertyIsArray:!0});continue}if(!(R.explicit&&!(re in O)))for(const B of se[re]){const oe=re in O?O[re]:h(R);if(e.isList(B)){const T=O[re]&&O[re][0]&&O[re][0]["@list"]?O[re][0]["@list"]:h(R),Q={"@list":[]};N(M,re,Q);const ie=B["@list"];for(const Y of ie)e.isSubjectReference(Y)?f.frame({...y,embedded:!0},[Y["@id"]],T,Q,"@list"):N(Q,"@list",r.clone(Y))}else e.isSubjectReference(B)?f.frame({...y,embedded:!0},[B["@id"]],oe,M,re):w(oe[0],B)&&N(M,re,r.clone(B))}}for(const re of Object.keys(O).sort()){if(re==="@type"){if(!n.isObject(O[re][0])||!("@default"in O[re][0]))continue}else if(i(re))continue;const B=O[re][0]||{};if(!m(B,U,"omitDefault")&&!(re in M)){let T="@null";"@default"in B&&(T=r.clone(B["@default"])),n.isArray(T)||(T=[T]),M[re]=[{"@preserve":T}]}}for(const re of Object.keys(O["@reverse"]||{}).sort()){const B=O["@reverse"][re];for(const oe of Object.keys(y.subjects))r.getValues(y.subjects[oe],re).some(Q=>Q["@id"]===F)&&(M["@reverse"]=M["@reverse"]||{},r.addValue(M["@reverse"],re,[],{propertyIsArray:!0}),f.frame({...y,embedded:!0},[oe],B,M["@reverse"][re],C))}N(X,C,M),y.subjectStack.pop()}}},f.cleanupNull=(y,S)=>{if(n.isArray(y))return y.map(X=>f.cleanupNull(X,S)).filter(X=>X);if(y==="@null")return null;if(n.isObject(y)){if("@id"in y){const O=y["@id"];if(S.link.hasOwnProperty(O)){const X=S.link[O].indexOf(y);if(X!==-1)return S.link[O][X];S.link[O].push(y)}else S.link[O]=[y]}for(const O in y)y[O]=f.cleanupNull(y[O],S)}return y};function h(y){const S={};for(const O in y)y[O]!==void 0&&(S["@"+O]=[y[O]]);return[S]}function g(y,S,O){for(let X=O.length-1;X>=0;--X){const C=O[X];if(C.graph===S&&C.subject["@id"]===y["@id"])return!0}return!1}function m(y,S,O){const X="@"+O;let C=X in y?y[X][0]:S[O];if(O==="embed"){if(C===!0)C="@once";else if(C===!1)C="@never";else if(C!=="@always"&&C!=="@never"&&C!=="@link"&&C!=="@first"&&C!=="@last"&&C!=="@once")throw new a("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:y})}return C}function d(y){if(!n.isArray(y)||y.length!==1||!n.isObject(y[0]))throw new a("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:y});if("@id"in y[0]){for(const S of r.asArray(y[0]["@id"]))if(!(n.isObject(S)||o.isAbsolute(S))||n.isString(S)&&S.indexOf("_:")===0)throw new a("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:y})}if("@type"in y[0]){for(const S of r.asArray(y[0]["@type"]))if(!(n.isObject(S)||o.isAbsolute(S)||S==="@json")||n.isString(S)&&S.indexOf("_:")===0)throw new a("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:y})}}function _(y,S,O,X){const C={};for(const U of S){const R=y.graphMap[y.graph][U];b(y,R,O,X)&&(C[U]=R)}return C}function b(y,S,O,X){let C=!0,U=!1;for(const R in O){let $=!1;const G=r.getValues(S,R),j=r.getValues(O,R).length===0;if(R==="@id"){if(n.isEmptyObject(O["@id"][0]||{})?$=!0:O["@id"].length>=0&&($=O["@id"].includes(G[0])),!X.requireAll)return $}else if(R==="@type"){if(C=!1,j){if(G.length>0)return!1;$=!0}else if(O["@type"].length===1&&n.isEmptyObject(O["@type"][0]))$=G.length>0;else for(const F of O["@type"])n.isObject(F)&&"@default"in F?$=!0:$=$||G.some(se=>se===F);if(!X.requireAll)return $}else{if(i(R))continue;{const F=r.getValues(O,R)[0];let se=!1;if(F&&(d([F]),se="@default"in F),C=!1,G.length===0&&se)continue;if(G.length>0&&j)return!1;if(F===void 0){if(G.length>0)return!1;$=!0}else if(e.isList(F)){const M=F["@list"][0];if(e.isList(G[0])){const re=G[0]["@list"];e.isValue(M)?$=re.some(B=>w(M,B)):(e.isSubject(M)||e.isSubjectReference(M))&&($=re.some(B=>P(y,M,B,X)))}}else e.isValue(F)?$=G.some(M=>w(F,M)):e.isSubjectReference(F)?$=G.some(M=>P(y,F,M,X)):n.isObject(F)?$=G.length>0:$=!1}}if(!$&&X.requireAll)return!1;U=U||$}return C||U}function I(y,S){const O=y.uniqueEmbeds[y.graph],X=O[S],C=X.parent,U=X.property,R={"@id":S};if(n.isArray(C)){for(let G=0;G<C.length;++G)if(r.compareValues(C[G],R)){C[G]=R;break}}else{const G=n.isArray(C[U]);r.removeValue(C,U,R,{propertyIsArray:G}),r.addValue(C,U,R,{propertyIsArray:G})}const $=G=>{const j=Object.keys(O);for(const F of j)F in O&&n.isObject(O[F].parent)&&O[F].parent["@id"]===G&&(delete O[F],$(F))};$(S)}function A(y,S){if(n.isArray(y))return y.map(O=>A(O,S));if(n.isObject(y)){if("@preserve"in y)return y["@preserve"][0];if(e.isValue(y))return y;if(e.isList(y))return y["@list"]=A(y["@list"],S),y;if("@id"in y){const O=y["@id"];if(S.link.hasOwnProperty(O)){const X=S.link[O].indexOf(y);if(X!==-1)return S.link[O][X];S.link[O].push(y)}else S.link[O]=[y]}for(const O in y){if(O==="@id"&&S.bnodesToClear.includes(y[O])){delete y["@id"];continue}y[O]=A(y[O],S)}}return y}function N(y,S,O){n.isObject(y)?r.addValue(y,S,O,{propertyIsArray:!0}):y.push(O)}function P(y,S,O,X){if(!("@id"in O))return!1;const C=y.subjects[O["@id"]];return C&&b(y,C,S,X)}function w(y,S){const O=S["@value"],X=S["@type"],C=S["@language"],U=y["@value"]?n.isArray(y["@value"])?y["@value"]:[y["@value"]]:[],R=y["@type"]?n.isArray(y["@type"])?y["@type"]:[y["@type"]]:[],$=y["@language"]?n.isArray(y["@language"])?y["@language"]:[y["@language"]]:[];return U.length===0&&R.length===0&&$.length===0?!0:!(!(U.includes(O)||n.isEmptyObject(U[0]))||!(!X&&R.length===0||R.includes(X)||X&&n.isEmptyObject(R[0]))||!(!C&&$.length===0||$.includes(C)||C&&n.isEmptyObject($[0])))}return Va}var Wa,$d;function $m(){if($d)return Wa;$d=1;const i=Kt(),{isArray:e,isObject:n,isString:r,isUndefined:o}=zt(),{isList:a,isValue:l,isGraph:u,isSimpleGraph:f,isSubjectReference:h}=On(),{expandIri:g,getContextValue:m,isKeyword:d,process:_,processingMode:b}=wi(),{removeBase:I,prependBase:A}=Jn(),{REGEX_KEYWORD:N,addValue:P,asArray:w,compareShortestLeast:y}=Qt(),S={};Wa=S,S.compact=async({activeCtx:C,activeProperty:U=null,element:R,options:$={}})=>{if(e(R)){let j=[];for(let F=0;F<R.length;++F){const se=await S.compact({activeCtx:C,activeProperty:U,element:R[F],options:$});se!==null&&j.push(se)}return $.compactArrays&&j.length===1&&(m(C,U,"@container")||[]).length===0&&(j=j[0]),j}const G=m(C,U,"@context");if(o(G)||(C=await _({activeCtx:C,localCtx:G,propagate:!0,overrideProtected:!0,options:$})),n(R)){if($.link&&"@id"in R&&$.link.hasOwnProperty(R["@id"])){const T=$.link[R["@id"]];for(let Q=0;Q<T.length;++Q)if(T[Q].expanded===R)return T[Q].compacted}if(l(R)||h(R)){const T=S.compactValue({activeCtx:C,activeProperty:U,value:R,options:$});return $.link&&h(R)&&($.link.hasOwnProperty(R["@id"])||($.link[R["@id"]]=[]),$.link[R["@id"]].push({expanded:R,compacted:T})),T}if(a(R)&&(m(C,U,"@container")||[]).includes("@list"))return S.compact({activeCtx:C,activeProperty:U,element:R["@list"],options:$});const j=U==="@reverse",F={},se=C;!l(R)&&!h(R)&&(C=C.revertToPreviousContext());const M=m(se,U,"@context");o(M)||(C=await _({activeCtx:C,localCtx:M,propagate:!0,overrideProtected:!0,options:$})),$.link&&"@id"in R&&($.link.hasOwnProperty(R["@id"])||($.link[R["@id"]]=[]),$.link[R["@id"]].push({expanded:R,compacted:F}));let re=R["@type"]||[];re.length>1&&(re=Array.from(re).sort());const B=C;for(const T of re){const Q=S.compactIri({activeCtx:B,iri:T,relativeTo:{vocab:!0}}),ie=m(se,Q,"@context");o(ie)||(C=await _({activeCtx:C,localCtx:ie,options:$,propagate:!1}))}const oe=Object.keys(R).sort();for(const T of oe){const Q=R[T];if(T==="@id"){let ie=w(Q).map(me=>S.compactIri({activeCtx:C,iri:me,relativeTo:{vocab:!1},base:$.base}));ie.length===1&&(ie=ie[0]);const Y=S.compactIri({activeCtx:C,iri:"@id",relativeTo:{vocab:!0}});F[Y]=ie;continue}if(T==="@type"){let ie=w(Q).map(ee=>S.compactIri({activeCtx:se,iri:ee,relativeTo:{vocab:!0}}));ie.length===1&&(ie=ie[0]);const Y=S.compactIri({activeCtx:C,iri:"@type",relativeTo:{vocab:!0}}),W=(m(C,Y,"@container")||[]).includes("@set")&&b(C,1.1)||e(ie)&&Q.length===0;P(F,Y,ie,{propertyIsArray:W});continue}if(T==="@reverse"){const ie=await S.compact({activeCtx:C,activeProperty:"@reverse",element:Q,options:$});for(const Y in ie)if(C.mappings.has(Y)&&C.mappings.get(Y).reverse){const me=ie[Y],W=(m(C,Y,"@container")||[]).includes("@set")||!$.compactArrays;P(F,Y,me,{propertyIsArray:W}),delete ie[Y]}if(Object.keys(ie).length>0){const Y=S.compactIri({activeCtx:C,iri:T,relativeTo:{vocab:!0}});P(F,Y,ie)}continue}if(T==="@preserve"){const ie=await S.compact({activeCtx:C,activeProperty:U,element:Q,options:$});e(ie)&&ie.length===0||P(F,T,ie);continue}if(T==="@index"){if((m(C,U,"@container")||[]).includes("@index"))continue;const Y=S.compactIri({activeCtx:C,iri:T,relativeTo:{vocab:!0}});P(F,Y,Q);continue}if(T!=="@graph"&&T!=="@list"&&T!=="@included"&&d(T)){const ie=S.compactIri({activeCtx:C,iri:T,relativeTo:{vocab:!0}});P(F,ie,Q);continue}if(!e(Q))throw new i("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(Q.length===0){const ie=S.compactIri({activeCtx:C,iri:T,value:Q,relativeTo:{vocab:!0},reverse:j}),Y=C.mappings.has(ie)?C.mappings.get(ie)["@nest"]:null;let me=F;Y&&(X(C,Y,$),n(F[Y])||(F[Y]={}),me=F[Y]),P(me,ie,Q,{propertyIsArray:!0})}for(const ie of Q){const Y=S.compactIri({activeCtx:C,iri:T,value:ie,relativeTo:{vocab:!0},reverse:j}),me=C.mappings.has(Y)?C.mappings.get(Y)["@nest"]:null;let Z=F;me&&(X(C,me,$),n(F[me])||(F[me]={}),Z=F[me]);const W=m(C,Y,"@container")||[],ee=u(ie),K=a(ie);let ue;K?ue=ie["@list"]:ee&&(ue=ie["@graph"]);let ce=await S.compact({activeCtx:C,activeProperty:Y,element:K||ee?ue:ie,options:$});if(K)if(e(ce)||(ce=[ce]),!W.includes("@list"))ce={[S.compactIri({activeCtx:C,iri:"@list",relativeTo:{vocab:!0}})]:ce},"@index"in ie&&(ce[S.compactIri({activeCtx:C,iri:"@index",relativeTo:{vocab:!0}})]=ie["@index"]);else{P(Z,Y,ce,{valueIsArray:!0,allowDuplicate:!0});continue}if(ee)if(W.includes("@graph")&&(W.includes("@id")||W.includes("@index")&&f(ie))){let Ee;Z.hasOwnProperty(Y)?Ee=Z[Y]:Z[Y]=Ee={};const Te=(W.includes("@id")?ie["@id"]:ie["@index"])||S.compactIri({activeCtx:C,iri:"@none",relativeTo:{vocab:!0}});P(Ee,Te,ce,{propertyIsArray:!$.compactArrays||W.includes("@set")})}else W.includes("@graph")&&f(ie)?(e(ce)&&ce.length>1&&(ce={"@included":ce}),P(Z,Y,ce,{propertyIsArray:!$.compactArrays||W.includes("@set")})):(e(ce)&&ce.length===1&&$.compactArrays&&(ce=ce[0]),ce={[S.compactIri({activeCtx:C,iri:"@graph",relativeTo:{vocab:!0}})]:ce},"@id"in ie&&(ce[S.compactIri({activeCtx:C,iri:"@id",relativeTo:{vocab:!0}})]=ie["@id"]),"@index"in ie&&(ce[S.compactIri({activeCtx:C,iri:"@index",relativeTo:{vocab:!0}})]=ie["@index"]),P(Z,Y,ce,{propertyIsArray:!$.compactArrays||W.includes("@set")}));else if(W.includes("@language")||W.includes("@index")||W.includes("@id")||W.includes("@type")){let Ee;Z.hasOwnProperty(Y)?Ee=Z[Y]:Z[Y]=Ee={};let Te;if(W.includes("@language"))l(ce)&&(ce=ce["@value"]),Te=ie["@language"];else if(W.includes("@index")){const q=m(C,Y,"@index")||"@index",te=S.compactIri({activeCtx:C,iri:q,relativeTo:{vocab:!0}});if(q==="@index")Te=ie["@index"],delete ce[te];else{let fe;if([Te,...fe]=w(ce[q]||[]),!r(Te))Te=null;else switch(fe.length){case 0:delete ce[q];break;case 1:ce[q]=fe[0];break;default:ce[q]=fe;break}}}else if(W.includes("@id")){const q=S.compactIri({activeCtx:C,iri:"@id",relativeTo:{vocab:!0}});Te=ce[q],delete ce[q]}else if(W.includes("@type")){const q=S.compactIri({activeCtx:C,iri:"@type",relativeTo:{vocab:!0}});let te;switch([Te,...te]=w(ce[q]||[]),te.length){case 0:delete ce[q];break;case 1:ce[q]=te[0];break;default:ce[q]=te;break}Object.keys(ce).length===1&&"@id"in ie&&(ce=await S.compact({activeCtx:C,activeProperty:Y,element:{"@id":ie["@id"]},options:$}))}Te||(Te=S.compactIri({activeCtx:C,iri:"@none",relativeTo:{vocab:!0}})),P(Ee,Te,ce,{propertyIsArray:W.includes("@set")})}else{const Ee=!$.compactArrays||W.includes("@set")||W.includes("@list")||e(ce)&&ce.length===0||T==="@list"||T==="@graph";P(Z,Y,ce,{propertyIsArray:Ee})}}}return F}return R},S.compactIri=({activeCtx:C,iri:U,value:R=null,relativeTo:$={vocab:!1},reverse:G=!1,base:j=null})=>{if(U===null)return U;C.isPropertyTermScoped&&C.previousContext&&(C=C.previousContext);const F=C.getInverse();if(d(U)&&U in F&&"@none"in F[U]&&"@type"in F[U]["@none"]&&"@none"in F[U]["@none"]["@type"])return F[U]["@none"]["@type"]["@none"];if($.vocab&&U in F){const oe=C["@language"]||"@none",T=[];n(R)&&"@index"in R&&!("@graph"in R)&&T.push("@index","@index@set"),n(R)&&"@preserve"in R&&(R=R["@preserve"][0]),u(R)?("@index"in R&&T.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R&&T.push("@graph@id","@graph@id@set"),T.push("@graph","@graph@set","@set"),"@index"in R||T.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R||T.push("@graph@id","@graph@id@set")):n(R)&&!l(R)&&T.push("@id","@id@set","@type","@set@type");let Q="@language",ie="@null";if(G)Q="@type",ie="@reverse",T.push("@set");else if(a(R)){"@index"in R||T.push("@list");const me=R["@list"];if(me.length===0)Q="@any",ie="@none";else{let Z=me.length===0?oe:null,W=null;for(let ee=0;ee<me.length;++ee){const K=me[ee];let ue="@none",ce="@none";if(l(K))if("@direction"in K){const Ee=(K["@language"]||"").toLowerCase(),Te=K["@direction"];ue=`${Ee}_${Te}`}else"@language"in K?ue=K["@language"].toLowerCase():"@type"in K?ce=K["@type"]:ue="@null";else ce="@id";if(Z===null?Z=ue:ue!==Z&&l(K)&&(Z="@none"),W===null?W=ce:ce!==W&&(W="@none"),Z==="@none"&&W==="@none")break}Z=Z||"@none",W=W||"@none",W!=="@none"?(Q="@type",ie=W):ie=Z}}else{if(l(R))if("@language"in R&&!("@index"in R)){T.push("@language","@language@set"),ie=R["@language"];const me=R["@direction"];me&&(ie=`${ie}_${me}`)}else"@direction"in R&&!("@index"in R)?ie=`_${R["@direction"]}`:"@type"in R&&(Q="@type",ie=R["@type"]);else Q="@type",ie="@id";T.push("@set")}T.push("@none"),n(R)&&!("@index"in R)&&T.push("@index","@index@set"),l(R)&&Object.keys(R).length===1&&T.push("@language","@language@set");const Y=O(C,U,R,T,Q,ie);if(Y!==null)return Y}if($.vocab&&"@vocab"in C){const oe=C["@vocab"];if(U.indexOf(oe)===0&&U!==oe){const T=U.substr(oe.length);if(!C.mappings.has(T))return T}}let se=null;const M=[];let re=C.fastCurieMap;const B=U.length-1;for(let oe=0;oe<B&&U[oe]in re;++oe)re=re[U[oe]],""in re&&M.push(re[""][0]);for(let oe=M.length-1;oe>=0;--oe){const T=M[oe],Q=T.terms;for(const ie of Q){const Y=ie+":"+U.substr(T.iri.length);C.mappings.get(ie)._prefix&&(!C.mappings.has(Y)||R===null&&C.mappings.get(Y)["@id"]===U)&&(se===null||y(Y,se)<0)&&(se=Y)}}if(se!==null)return se;for(const[oe,T]of C.mappings)if(T&&T._prefix&&U.startsWith(oe+":"))throw new i(`Absolute IRI "${U}" confused with prefix "${oe}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:C});if(!$.vocab)if("@base"in C)if(C["@base"]){const oe=I(A(j,C["@base"]),U);return N.test(oe)?`./${oe}`:oe}else return U;else return I(j,U);return U},S.compactValue=({activeCtx:C,activeProperty:U,value:R,options:$})=>{if(l(R)){const se=m(C,U,"@type"),M=m(C,U,"@language"),re=m(C,U,"@direction"),B=m(C,U,"@container")||[],oe="@index"in R&&!B.includes("@index");if(!oe&&se!=="@none"&&(R["@type"]===se||"@language"in R&&R["@language"]===M&&"@direction"in R&&R["@direction"]===re||"@language"in R&&R["@language"]===M||"@direction"in R&&R["@direction"]===re))return R["@value"];const T=Object.keys(R).length,Q=T===1||T===2&&"@index"in R&&!oe,ie="@language"in C,Y=r(R["@value"]),me=C.mappings.has(U)&&C.mappings.get(U)["@language"]===null;if(Q&&se!=="@none"&&(!ie||!Y||me))return R["@value"];const Z={};return oe&&(Z[S.compactIri({activeCtx:C,iri:"@index",relativeTo:{vocab:!0}})]=R["@index"]),"@type"in R?Z[S.compactIri({activeCtx:C,iri:"@type",relativeTo:{vocab:!0}})]=S.compactIri({activeCtx:C,iri:R["@type"],relativeTo:{vocab:!0}}):"@language"in R&&(Z[S.compactIri({activeCtx:C,iri:"@language",relativeTo:{vocab:!0}})]=R["@language"]),"@direction"in R&&(Z[S.compactIri({activeCtx:C,iri:"@direction",relativeTo:{vocab:!0}})]=R["@direction"]),Z[S.compactIri({activeCtx:C,iri:"@value",relativeTo:{vocab:!0}})]=R["@value"],Z}const G=g(C,U,{vocab:!0},$),j=m(C,U,"@type"),F=S.compactIri({activeCtx:C,iri:R["@id"],relativeTo:{vocab:j==="@vocab"},base:$.base});return j==="@id"||j==="@vocab"||G==="@graph"?F:{[S.compactIri({activeCtx:C,iri:"@id",relativeTo:{vocab:!0}})]:F}};function O(C,U,R,$,G,j){j===null&&(j="@null");const F=[];if((j==="@id"||j==="@reverse")&&n(R)&&"@id"in R){j==="@reverse"&&F.push("@reverse");const M=S.compactIri({activeCtx:C,iri:R["@id"],relativeTo:{vocab:!0}});C.mappings.has(M)&&C.mappings.get(M)&&C.mappings.get(M)["@id"]===R["@id"]?F.push.apply(F,["@vocab","@id"]):F.push.apply(F,["@id","@vocab"])}else{F.push(j);const M=F.find(re=>re.includes("_"));M&&F.push(M.replace(/^[^_]+_/,"_"))}F.push("@none");const se=C.inverse[U];for(const M of $){if(!(M in se))continue;const re=se[M][G];for(const B of F)if(B in re)return re[B]}return null}function X(C,U,R){if(g(C,U,{vocab:!0},R)!=="@nest")throw new i("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}return Wa}var Ga,qd;function qm(){return qd||(qd=1,Ga=i=>{class e{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(e,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(e.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:e}),e.compact=function(n,r){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):i.compact(n,r)},e.expand=function(n){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):i.expand(n)},e.flatten=function(n){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):i.flatten(n)},e}),Ga}var Za,zd;function zm(){if(zd)return Za;zd=1;const i=Vl(),e=Am(),n=Qt(),r=Pm(),o=n.IdentifierIssuer,a=Kt(),l=$f(),u=km(),{expand:f}=Dm(),{flatten:h}=Mm(),{fromRDF:g}=Om(),{toRDF:m}=jm(),{frameMergedOrDefault:d,cleanupNull:_}=Bm(),{isArray:b,isObject:I,isString:A}=zt(),{isSubjectReference:N}=On(),{expandIri:P,getInitialContext:w,process:y,processingMode:S}=wi(),{compact:O,compactIri:X}=$m(),{createNodeMap:C,createMergedNodeMap:U,mergeNodeMaps:R}=Ys(),{logEventHandler:$,logWarningEventHandler:G,safeEventHandler:j,setDefaultEventHandler:F,setupEventHandler:se,strictEventHandler:M,unhandledEventHandler:re}=Qr(),B=function(T){const Q={},Y=new l({max:100});T.compact=async function(Z,W,ee){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(W===null)throw new a("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(Z===null)return null;ee=me(ee,{base:A(Z)?Z:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o("_:b"),contextResolver:new r({sharedCache:Y})}),ee.link&&(ee.skipExpansion=!0),ee.compactToRelative||delete ee.base;let K;ee.skipExpansion?K=Z:K=await T.expand(Z,ee);const ue=await T.processContext(w(ee),W,ee);let ce=await O({activeCtx:ue,element:K,options:ee});ee.compactArrays&&!ee.graph&&b(ce)?ce.length===1?ce=ce[0]:ce.length===0&&(ce={}):ee.graph&&I(ce)&&(ce=[ce]),I(W)&&"@context"in W&&(W=W["@context"]),W=n.clone(W),b(W)||(W=[W]);const Ee=W;W=[];for(let q=0;q<Ee.length;++q)(!I(Ee[q])||Object.keys(Ee[q]).length>0)&&W.push(Ee[q]);const Te=W.length>0;if(W.length===1&&(W=W[0]),b(ce)){const q=X({activeCtx:ue,iri:"@graph",relativeTo:{vocab:!0}}),te=ce;ce={},Te&&(ce["@context"]=W),ce[q]=te}else if(I(ce)&&Te){const q=ce;ce={"@context":W};for(const te in q)ce[te]=q[te]}return ce},T.expand=async function(Z,W){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");W=me(W,{keepFreeFloatingNodes:!1,contextResolver:new r({sharedCache:Y})});const ee={},K=[];if("expandContext"in W){const Te=n.clone(W.expandContext);I(Te)&&"@context"in Te?ee.expandContext=Te:ee.expandContext={"@context":Te},K.push(ee.expandContext)}let ue;if(!A(Z))ee.input=n.clone(Z);else{const Te=await T.get(Z,W);ue=Te.documentUrl,ee.input=Te.document,Te.contextUrl&&(ee.remoteContext={"@context":Te.contextUrl},K.push(ee.remoteContext))}"base"in W||(W.base=ue||"");let ce=w(W);for(const Te of K)ce=await y({activeCtx:ce,localCtx:Te,options:W});let Ee=await f({activeCtx:ce,element:ee.input,options:W});return I(Ee)&&"@graph"in Ee&&Object.keys(Ee).length===1?Ee=Ee["@graph"]:Ee===null&&(Ee=[]),b(Ee)||(Ee=[Ee]),Ee},T.flatten=async function(Z,W,ee){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof W=="function"?W=null:W=W||null,ee=me(ee,{base:A(Z)?Z:"",contextResolver:new r({sharedCache:Y})});const K=await T.expand(Z,ee),ue=h(K);return W===null?ue:(ee.graph=!0,ee.skipExpansion=!0,await T.compact(ue,W,ee))},T.frame=async function(Z,W,ee){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(ee=me(ee,{base:A(Z)?Z:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new r({sharedCache:Y})}),A(W)){const xe=await T.get(W,ee);if(W=xe.document,xe.contextUrl){let Se=W["@context"];Se?b(Se)?Se.push(xe.contextUrl):Se=[Se,xe.contextUrl]:Se=xe.contextUrl,W["@context"]=Se}}const K=W?W["@context"]||{}:{},ue=await T.processContext(w(ee),K,ee);ee.hasOwnProperty("omitGraph")||(ee.omitGraph=S(ue,1.1)),ee.hasOwnProperty("pruneBlankNodeIdentifiers")||(ee.pruneBlankNodeIdentifiers=S(ue,1.1));const ce=await T.expand(Z,ee),Ee={...ee};Ee.isFrame=!0,Ee.keepFreeFloatingNodes=!0;const Te=await T.expand(W,Ee),q=Object.keys(W).map(xe=>P(ue,xe,{vocab:!0}));Ee.merged=!q.includes("@graph"),Ee.is11=S(ue,1.1);const te=d(ce,Te,Ee);Ee.graph=!ee.omitGraph,Ee.skipExpansion=!0,Ee.link={},Ee.framing=!0;let fe=await T.compact(te,K,Ee);return Ee.link={},fe=_(fe,Ee),fe},T.link=async function(Z,W,ee){const K={};return W&&(K["@context"]=W),K["@embed"]="@link",T.frame(Z,K,ee)},T.normalize=T.canonize=async function(Z,W){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");W=me(W,{skipExpansion:!1,safe:!0,contextResolver:new r({sharedCache:Y})});const ee=Object.assign({},{algorithm:"RDFC-1.0"},W.canonizeOptions||null);if("inputFormat"in W){if(W.inputFormat!=="application/n-quads")throw new a("Unknown canonicalization input format.","jsonld.CanonizeError");const ce=u.parse(Z);return i.canonize(ce,ee)}const K={...W};delete K.format,delete K.canonizeOptions,K.produceGeneralizedRdf=!1;const ue=await T.toRDF(Z,K);return i.canonize(ue,ee)},T.fromRDF=async function(Z,W){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");W=me(W,{format:A(Z)?"application/n-quads":void 0});const{format:ee}=W;let{rdfParser:K}=W;if(ee){if(K=K||Q[ee],!K)throw new a("Unknown input format.","jsonld.UnknownFormat",{format:ee})}else K=()=>Z;const ue=await K(Z);return g(ue,W)},T.toRDF=async function(Z,W){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");W=me(W,{skipExpansion:!1,contextResolver:new r({sharedCache:Y})});let ee;W.skipExpansion?ee=Z:ee=await T.expand(Z,W);const K=m(ee,W);if(W.format){if(W.format==="application/n-quads")return u.serialize(K);throw new a("Unknown output format.","jsonld.UnknownFormat",{format:W.format})}return K},T.createNodeMap=async function(Z,W){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");W=me(W,{base:A(Z)?Z:"",contextResolver:new r({sharedCache:Y})});const ee=await T.expand(Z,W);return U(ee,W)},T.merge=async function(Z,W,ee){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!b(Z))throw new TypeError('Could not merge, "docs" must be an array.');typeof W=="function"?W=null:W=W||null,ee=me(ee,{contextResolver:new r({sharedCache:Y})});const K=await Promise.all(Z.map(xe=>{const Se={...ee};return T.expand(xe,Se)}));let ue=!0;"mergeNodes"in ee&&(ue=ee.mergeNodes);const ce=ee.issuer||new o("_:b"),Ee={"@default":{}};for(let xe=0;xe<K.length;++xe){const Se=n.relabelBlankNodes(K[xe],{issuer:new o("_:b"+xe+"-")}),Ie=ue||xe===0?Ee:{"@default":{}};if(C(Se,Ie,"@default",ce),Ie!==Ee)for(const le in Ie){const be=Ie[le];if(!(le in Ee)){Ee[le]=be;continue}const Ae=Ee[le];for(const ve in be)ve in Ae||(Ae[ve]=be[ve])}}const Te=R(Ee),q=[],te=Object.keys(Te).sort();for(let xe=0;xe<te.length;++xe){const Se=Te[te[xe]];N(Se)||q.push(Se)}return W===null?q:(ee.graph=!0,ee.skipExpansion=!0,await T.compact(q,W,ee))},Object.defineProperty(T,"documentLoader",{get:()=>T._documentLoader,set:Z=>T._documentLoader=Z}),T.documentLoader=async Z=>{throw new a("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:Z})},T.get=async function(Z,W){let ee;typeof W.documentLoader=="function"?ee=W.documentLoader:ee=T.documentLoader;const K=await ee(Z);try{if(!K.document)throw new a("No remote document found at the given URL.","jsonld.NullRemoteDocument");A(K.document)&&(K.document=JSON.parse(K.document))}catch(ue){throw new a("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ue,remoteDoc:K})}return K},T.processContext=async function(Z,W,ee){return ee=me(ee,{base:"",contextResolver:new r({sharedCache:Y})}),W===null?w(ee):(W=n.clone(W),I(W)&&"@context"in W||(W={"@context":W}),y({activeCtx:Z,localCtx:W,options:ee}))},T.getContextValue=wi().getContextValue,T.documentLoaders={},T.useDocumentLoader=function(Z){if(!(Z in T.documentLoaders))throw new a('Unknown document loader type: "'+Z+'"',"jsonld.UnknownDocumentLoader",{type:Z});T.documentLoader=T.documentLoaders[Z].apply(T,Array.prototype.slice.call(arguments,1))},T.registerRDFParser=function(Z,W){Q[Z]=W},T.unregisterRDFParser=function(Z){delete Q[Z]},T.registerRDFParser("application/n-quads",u.parse),T.url=Jn(),T.logEventHandler=$,T.logWarningEventHandler=G,T.safeEventHandler=j,T.setDefaultEventHandler=F,T.strictEventHandler=M,T.unhandledEventHandler=re,T.util=n,Object.assign(T,n),T.promises=T,T.RequestQueue=Bf(),T.JsonLdProcessor=qm()(T),e.setupGlobals(T),e.setupDocumentLoaders(T);function me(Z,{documentLoader:W=T.documentLoader,...ee}){if(Z&&"compactionMap"in Z)throw new a('"compactionMap" not supported.',"jsonld.OptionsError");if(Z&&"expansionMap"in Z)throw new a('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:W},ee,Z,{eventHandler:se({options:Z})})}return T},oe=function(){return B(function(){return oe()})};return B(oe),Za=oe,Za}var Hm=zm();const Um=rf(Hm),Ss={},Vi={};async function Vm(i){const e={store:new It,importedUrls:[],atts:i},n=[];if(i.shapes?n.push(Rn(Ui(i.shapes),e,an)):i.shapesUrl&&n.push(Rn(Ns(i.shapesUrl,e.atts.proxy),e,an)),i.values?n.push(Rn(Ui(i.values),e,Ft)):i.valuesUrl&&n.push(Rn(Ns(i.valuesUrl,e.atts.proxy),e,Ft)),await Promise.all(n),i.classInstanceProvider)try{const r=am(e.store),o=await i.classInstanceProvider(r);o&&await Rn(Ui(o),e,an)}catch(r){console.error("failed loading class instances",r)}if(i.valuesSubject&&e.store.countQuads(null,null,null,an)===0){const r=[...e.store.getObjects(i.valuesSubject,Rt,Ft),...e.store.getObjects(i.valuesSubject,Fs,Ft)],o=[];for(const a of r){let l=qf(a.value);!l&&a.value.startsWith("urn:")&&e.atts.proxy&&(l=a.value),l&&e.importedUrls.indexOf(l)<0&&(e.importedUrls.push(l),o.push(Rn(Ns(l,e.atts.proxy),e,an)))}try{await Promise.allSettled(o)}catch(a){console.warn(a)}}return e.store}async function Rn(i,e,n){const r=await i,o=[];for(const a of r){let l=n;if(e.atts.valuesSubject&&Ft.equals(n)&&a.graph.id&&a.graph.id!==e.atts.valuesSubject&&(l=a.graph),e.store.add(Be.quad(a.subject,a.predicate,a.object,l)),e.atts.loadOwlImports&&$l.equals(a.predicate)){const u=qf(a.object.value);u&&e.importedUrls.indexOf(u)<0&&(e.importedUrls.push(u),o.push(Rn(Ns(u,e.atts.proxy),e,Be.namedNode(u))))}}await Promise.allSettled(o)}async function Ns(i,e){return i in Ss||(Ss[i]=(async()=>{let n=i;e&&(n=e+encodeURIComponent(i));const r=await fetch(n,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}});if(r.ok){const o=await r.text();return Ui(o)}else return console.warn("failed fetching RDF from",i),[]})()),Ss[i]}async function Ui(i){if(!i.trim())return[];const e=Wm(i);if(e==="json")try{i=await Um.toRDF(JSON.parse(i),{format:"application/n-quads"})}catch(r){console.error(r)}const n=[];return await new Promise((r,o)=>{const a=e==="xml"?new xm.RdfXmlParser:new Xg;a.on("data",l=>{n.push(Be.quad(l.subject,l.predicate,l.object,l.graph))}).on("error",l=>{o(l)}).on("prefix",(l,u)=>{l&&(Vi[l]=u)}).on("end",()=>{r(null)}),a.write(i),a.end()}),n}function qf(i){if(El(i))return i;const e=i.split(":");if(e.length===2){const n=Vi[e[0]];if(n&&(i=i.replace(`${e[0]}:`,n),El(i)))return i}return null}function Wm(i){return/^\s*[\\[{]/.test(i)?"json":/^\s*<\?xml/.test(i)?"xml":"ttl"}const Gm={[`${Fe}name`]:(i,e)=>{const n=e;i.name=js(i.config.languages,i.name,n)},[`${Fe}description`]:(i,e)=>{const n=e;i.description=js(i.config.languages,i.description,n)},[`${Fe}path`]:(i,e)=>{i.path=e.value},[`${Fe}group`]:(i,e)=>{i.group=e.id},[`${Fe}datatype`]:(i,e)=>{i.datatype=e},[`${Fe}nodeKind`]:(i,e)=>{i.nodeKind=e},[`${Fe}minCount`]:(i,e)=>{i.minCount=parseInt(e.value)},[`${Fe}maxCount`]:(i,e)=>{i.maxCount=parseInt(e.value)},[`${Fe}minLength`]:(i,e)=>{i.minLength=parseInt(e.value)},[`${Fe}maxLength`]:(i,e)=>{i.maxLength=parseInt(e.value)},[`${Fe}minInclusive`]:(i,e)=>{i.minInclusive=parseInt(e.value)},[`${Fe}maxInclusive`]:(i,e)=>{i.maxInclusive=parseInt(e.value)},[`${Fe}minExclusive`]:(i,e)=>{i.minExclusive=parseInt(e.value)},[`${Fe}maxExclusive`]:(i,e)=>{i.maxExclusive=parseInt(e.value)},[`${Fe}pattern`]:(i,e)=>{i.pattern=e.value},[`${Fe}order`]:(i,e)=>{i.order=parseInt(e.value)},[`${Bc}singleLine`]:(i,e)=>{i.singleLine=e.value==="true"},[`${Bc}readonly`]:(i,e)=>{i.readonly=e.value==="true"},[`${Jg}styleClass`]:(i,e)=>{i.cssClass=e.value},[`${Fe}in`]:(i,e)=>{i.in=e.value},[`${Fe}languageIn`]:(i,e)=>{i.languageIn=i.config.lists[e.value],i.datatype=Sf},[`${Fe}defaultValue`]:(i,e)=>{i.defaultValue=e},[`${Fe}hasValue`]:(i,e)=>{i.hasValue=e},[`${Fe}node`]:(i,e)=>{i.node=e,i.nodeShapes.add(i.config.getNodeTemplate(e,i))},[`${Fe}and`]:(i,e)=>{i.and=e.value;const n=i.config.lists[i.and];if(n?.length)for(const r of n)i.nodeShapes.add(i.config.getNodeTemplate(r,i))},[`${Fe}qualifiedValueShape`]:(i,e)=>{const n=i.config.getNodeTemplate(e,i);i.qualifiedValueShape=n,i.nodeShapes.add(n)},[`${Fe}qualifiedMinCount`]:(i,e)=>{i.qualifiedMinCount=parseInt(e.value)},[`${Fe}qualifiedMaxCount`]:(i,e)=>{i.qualifiedMaxCount=parseInt(e.value)},[$l.id]:(i,e)=>{i.owlImports.add(e)},[ql.id]:(i,e)=>{i.class=e;const n=i.config.store.getSubjects(Ks,e,null);n.length>0&&(i.node=n[0])},[`${Fe}or`]:(i,e)=>{const n=i.config.lists[e.value];n?.length?i.or=n:console.error("list for sh:or not found:",e.value,"existing lists:",i.config.lists)},[`${Fe}xone`]:(i,e)=>{const n=i.config.lists[e.value];n?.length?i.xone=n:console.error("list for sh:xone not found:",e.value,"existing lists:",i.config.lists)}};class Hd{constructor(e,n){this.label="",this.nodeShapes=new Set,this.owlImports=new Set,this.id=e,this.parent=n,this.config=n.config,this.config.registerPropertyTemplate(this),Gl(this,this.config.store.getQuads(e,null,null,null))}}function Ur(i){return Math.max(i.minCount??0,i.qualifiedMinCount??0)}function Zm(i){return Math.min(i.maxCount??Number.MAX_SAFE_INTEGER,i.qualifiedMaxCount??Number.MAX_SAFE_INTEGER)}function zf(i){const e=Object.assign({},i);return e.nodeShapes=new Set(i.nodeShapes),e.owlImports=new Set(i.owlImports),i.languageIn&&(e.languageIn=[...i.languageIn]),i.or&&(e.or=[...i.or]),i.xone&&(e.xone=[...i.xone]),e}function Gl(i,e){for(const n of e)Gm[n.predicate.id]?.call(i,i,n.object);return i.label=i.name?.value||Zn(e,i.config.languages),i.label||(i.label=i.path?xl(i.path,Vi):"unknown"),i}function Hf(i,e){const n=e,r=i;for(const o in e)if(o!=="parent"&&o!=="config"&&o!=="id"){const a=n[o];if(a!==void 0&&a!=="")if(Array.isArray(a)){const l=r[o];Array.isArray(l)?l.push(...a):r[o]=[...a]}else if(a instanceof Set&&a.size){const l=r[o];r[o]=new Set([...l instanceof Set?l:[],...a])}else r[o]=a}}function Uf(i,e,n){const r=document.createElement("div");r.classList.add("shacl-or-constraint"),r.setAttribute("part","constraint");const o=[];if(e instanceof Li){const a=[];let l=!1;i.length&&(l=n.store.countQuads(i[0],wl,null,null)>0);for(let h=0;h<i.length;h++)if(l){const g=n.store.getObjects(i[h],wl,null),m=[];let d="";for(const _ of g){const b=n.getPropertyTemplate(_,e.template),I=new zs(b,e);m.push(I),d+=(d.length>0?" / ":"")+I.template.label}a.push(m),o.push({label:d,value:h.toString()})}else{const g=i[h],m=n.getPropertyTemplate(g,e.template),d=new zs(m,e);a.push([d]),o.push({label:d.template.label,value:h.toString()})}const u=n.theme.createListEditor("Please choose",null,!1,o);u.setAttribute("part","constraint-editor");const f=u.querySelector(".editor");f.onchange=()=>{if(f.value){const h=a[parseInt(f.value)];let g;h.length&&(g=h[0],r.replaceWith(h[0]),g.updateControls());for(let m=1;m<h.length;m++)g.after(h[m]),g=h[m],g.updateControls()}},r.appendChild(u)}else{const a=[];for(let f=0;f<i.length;f++){const h=n.store.getQuads(i[f],null,null,null);if(h.length){a.push(h);let g=Zn(h,n.languages);for(const m of h)m.predicate.equals(tm)&&(g=Zn(n.store.getQuads(m.object,null,null,null),n.languages));o.push({label:g||xl(h[0].predicate.value,Vi)+" = "+xl(h[0].object.value,Vi),value:f.toString()})}}const l=n.theme.createListEditor(e.template.label+"?",null,!1,o,e.template);l.setAttribute("part","constraint-editor");const u=l.querySelector(".editor");u.onchange=async()=>{if(u.value){const f=Gl(zf(e.template),a[parseInt(u.value)]),h=await Hs(f,void 0,!0),g=h.querySelector(":scope > label");g&&g.classList.add("persistent"),r.replaceWith(h)}},r.appendChild(l)}return r}function Xm(i,e,n){if(e.termType==="Literal"){const r=e.datatype;for(const o of i){const a=n.store.getQuads(o,null,null,null);for(const l of a)if(l.predicate.value===`${Fe}datatype`&&l.object.equals(r))return a}}else{const r=n.store.getObjects(e,Rt,null);for(const o of i){const a=n.store.getQuads(o,null,null,null);for(const l of a)if(r.length>0){if(l.predicate.value===`${Fe}node`){for(const u of r)if(n.store.getQuads(l.object,Ks,u,null).length>0)return a}if(l.predicate.equals(ql)){for(const u of r)if(l.object.equals(u))return a}}else if(l.predicate.equals(nm)&&l.object.equals(Tf))return a}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Qm(i,e,n){for(const r of i){let o=!1;const a=n.store.getObjects(r,wl,null);for(const l of a){const u=n.store.getObjects(l,`${Fe}path`,null);for(const f of u)if(o=n.store.countQuads(e,f,null,null)>0,o)break}if(o)return a}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const Jm=`:host {
|
|
16
|
+
`),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,r)=>{t=null,e(n,r)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}};function Te(e){let t=Se[e];return t===void 0&&(e.length===1?(t=e.charCodeAt(0).toString(16),t=`\\u0000`.substr(0,6-t.length)+t):(t=((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)+9216).toString(16),t=`\\U00000000`.substr(0,10-t.length)+t)),t}var Ee=o(((e,t)=>{t.exports={AggregateError:class extends Error{constructor(e){if(!Array.isArray(e))throw TypeError(`Expected input to be an Array, got ${typeof e}`);let t=``;for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name=`AggregateError`,this.errors=e}},ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:2**53-1,NumberMIN_SAFE_INTEGER:-(2**53-1),NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,n){return Object.defineProperty(e,t,n)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,n){return e.then(t,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,n){return e.slice(t,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol(`Symbol.dispose`),SymbolAsyncDispose:Symbol.asyncDispose||Symbol(`Symbol.asyncDispose`),TypedArrayPrototypeSet(e,t,n){return e.set(t,n)},Boolean,Uint8Array}})),De=o(((e,t)=>{t.exports={format(e,...t){return e.replace(/%([sdifj])/g,function(...[e,n]){let r=t.shift();return n===`f`?r.toFixed(6):n===`j`?JSON.stringify(r):n===`s`&&typeof r==`object`?`${r.constructor===Object?``:r.constructor.name} {}`.trim():r.toString()})},inspect(e){switch(typeof e){case`string`:if(e.includes(`'`)){if(!e.includes(`"`))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case`number`:return isNaN(e)?`NaN`:Object.is(e,-0)?String(e):e;case`bigint`:return`${String(e)}n`;case`boolean`:case`undefined`:return String(e);case`object`:return`{}`}}}})),Oe=o(((e,t)=>{var{format:n,inspect:r}=De(),{AggregateError:i}=Ee(),a=globalThis.AggregateError||i,o=Symbol(`kIsNodeError`),s=[`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`],c=/^([A-Z][a-z0-9]*)+$/,l=`__node_internal_`,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function f(e){let t=``,n=e.length,r=e[0]===`-`?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function p(e,t,r){if(typeof t==`function`)return d(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);let i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:n(t,...r)}function m(e,t,n){n||=Error;class r extends n{constructor(...n){super(p(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[o]=!0,u[e]=r}function h(e){let t=l+e.name;return Object.defineProperty(e,`name`,{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let n=new a([t,e],t.message);return n.code=t.code,n}return e||t}var _=class extends Error{constructor(e=`The operation was aborted`,t=void 0){if(t!==void 0&&typeof t!=`object`)throw new u.ERR_INVALID_ARG_TYPE(`options`,`Object`,t);super(e,t),this.code=`ABORT_ERR`,this.name=`AbortError`}};m(`ERR_ASSERTION`,`%s`,Error),m(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{d(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let i=`The `;e.endsWith(` argument`)?i+=`${e} `:i+=`"${e}" ${e.includes(`.`)?`property`:`argument`} `,i+=`must be `;let a=[],o=[],l=[];for(let e of t)d(typeof e==`string`,`All expected entries have to be of type string`),s.includes(e)?a.push(e.toLowerCase()):c.test(e)?o.push(e):(d(e!==`object`,`The value "object" should be written as "Object"`),l.push(e));if(o.length>0){let e=a.indexOf(`object`);e!==-1&&(a.splice(a,e,1),o.push(`Object`))}if(a.length>0){switch(a.length){case 1:i+=`of type ${a[0]}`;break;case 2:i+=`one of type ${a[0]} or ${a[1]}`;break;default:{let e=a.pop();i+=`one of type ${a.join(`, `)}, or ${e}`}}(o.length>0||l.length>0)&&(i+=` or `)}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let e=o.pop();i+=`an instance of ${o.join(`, `)}, or ${e}`}}l.length>0&&(i+=` or `)}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(i+=`an `),i+=`${l[0]}`;break;case 2:i+=`one of ${l[0]} or ${l[1]}`;break;default:{let e=l.pop();i+=`one of ${l.join(`, `)}, or ${e}`}}if(n==null)i+=`. Received ${n}`;else if(typeof n==`function`&&n.name)i+=`. Received function ${n.name}`;else if(typeof n==`object`){var u;if((u=n.constructor)!=null&&u.name)i+=`. Received an instance of ${n.constructor.name}`;else{let e=r(n,{depth:-1});i+=`. Received ${e}`}}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i},TypeError),m(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let i=r(t);return i.length>128&&(i=i.slice(0,128)+`...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${i}`},TypeError),m(`ERR_INVALID_RETURN_VALUE`,(e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${n!=null&&(r=n.constructor)!=null&&r.name?`instance of ${n.constructor.name}`:`type ${typeof n}`}.`},TypeError),m(`ERR_MISSING_ARGS`,(...e)=>{d(e.length>0,`At least one arg needs to be specified`);let t,n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(e=>`"${e}"`).join(` or `),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let n=e.pop();t+=`The ${e.join(`, `)}, and ${n} arguments`}break}return`${t} must be specified`},TypeError),m(`ERR_OUT_OF_RANGE`,(e,t,n)=>{d(t,`Missing "range" argument`);let i;if(Number.isInteger(n)&&Math.abs(n)>2**32)i=f(String(n));else if(typeof n==`bigint`){i=String(n);let e=BigInt(2)**BigInt(32);(n>e||n<-e)&&(i=f(i)),i+=`n`}else i=r(n);return`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError),m(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`,Error),m(`ERR_METHOD_NOT_IMPLEMENTED`,`The %s method is not implemented`,Error),m(`ERR_STREAM_ALREADY_FINISHED`,`Cannot call %s after a stream was finished`,Error),m(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`,Error),m(`ERR_STREAM_DESTROYED`,`Cannot call %s after a stream was destroyed`,Error),m(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),m(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`,Error),m(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`,Error),m(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`,Error),m(`ERR_STREAM_WRITE_AFTER_END`,`write after end`,Error),m(`ERR_UNKNOWN_ENCODING`,`Unknown encoding: %s`,TypeError),t.exports={AbortError:_,aggregateTwoErrors:h(g),hideStackFrames:h,codes:u}})),ke=o(((e,t)=>{var{AbortController:n,AbortSignal:r}=typeof self<`u`?self:typeof window<`u`?window:void 0;t.exports=n,t.exports.AbortSignal=r,t.exports.default=n})),Ae=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),je=o(((e,t)=>{var n=f(),{format:r,inspect:i}=De(),{codes:{ERR_INVALID_ARG_TYPE:a}}=Oe(),{kResistStopPropagation:o,AggregateError:s,SymbolDispose:c}=Ee(),l=globalThis.AbortSignal||ke().AbortSignal,u=globalThis.AbortController||ke().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||n.Blob,m=p===void 0?function(e){return!1}:function(e){return e instanceof p},h=(e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new a(t,`AbortSignal`,e)},g=(e,t)=>{if(typeof e!=`function`)throw new a(t,`Function`,e)};t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},promisify(e){return new Promise((t,n)=>{e((e,...r)=>e?n(e):t(...r))})},debuglog(){return function(){}},format:r,inspect:i,types:{isAsyncFunction(e){return e instanceof d},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:m,deprecate(e,t){return e},addAbortListener:Ae().addAbortListener||function(e,t){if(e===void 0)throw new a(`signal`,`AbortSignal`,e);h(e,`signal`),g(t,`listener`);let n;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener(`abort`,t,{__proto__:null,once:!0,[o]:!0}),n=()=>{e.removeEventListener(`abort`,t)}),{__proto__:null,[c](){var e;(e=n)==null||e()}}},AbortSignalAny:l.any||function(e){if(e.length===1)return e[0];let t=new u,n=()=>t.abort();return e.forEach(e=>{h(e,`signals`),e.addEventListener(`abort`,n,{once:!0})}),t.signal.addEventListener(`abort`,()=>{e.forEach(e=>e.removeEventListener(`abort`,n))},{once:!0}),t.signal}},t.exports.promisify.custom=Symbol.for(`nodejs.util.promisify.custom`)})),Me=o(((e,t)=>{var{ArrayIsArray:n,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:i,ArrayPrototypeMap:a,NumberIsInteger:o,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:l,NumberParseInt:u,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:h}=Ee(),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:y,ERR_OUT_OF_RANGE:b,ERR_UNKNOWN_SIGNAL:x}}=Oe(),{normalizeEncoding:S}=je(),{isAsyncFunction:C,isArrayBufferView:w}=je().types,T={};function E(e){return e===(e|0)}function D(e){return e===e>>>0}var O=/^[0-7]+$/,k=`must be a 32-bit unsigned integer or an octal string`;function A(e,t,n){if(e===void 0&&(e=n),typeof e==`string`){if(f(O,e)===null)throw new y(t,e,k);e=u(e,8)}return N(e,t),e}var j=g((e,t,n=l,r=c)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),M=g((e,t,n=-2147483648,r=2147483647)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),N=g((e,t,n=!1)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);let r=n?1:0,i=4294967295;if(e<r||e>i)throw new b(t,`>= ${r} && <= ${i}`,e)});function P(e,t){if(typeof e!=`string`)throw new v(t,`string`,e)}function F(e,t,n=void 0,r){if(typeof e!=`number`)throw new v(t,`number`,e);if(n!=null&&e<n||r!=null&&e>r||(n!=null||r!=null)&&s(e))throw new b(t,`${n==null?``:`>= ${n}`}${n!=null&&r!=null?` && `:``}${r==null?``:`<= ${r}`}`,e)}var I=g((e,t,n)=>{if(!r(n,e))throw new y(t,e,`must be one of: `+i(a(n,e=>typeof e==`string`?`'${e}'`:p(e)),`, `))});function R(e,t){if(typeof e!=`boolean`)throw new v(t,`boolean`,e)}function z(e,t,n){return e==null||!d(e,t)?n:e[t]}var B=g((e,t,r=null)=>{let i=z(r,`allowArray`,!1),a=z(r,`allowFunction`,!1);if(!z(r,`nullable`,!1)&&e===null||!i&&n(e)||typeof e!=`object`&&(!a||typeof e!=`function`))throw new v(t,`Object`,e)}),V=g((e,t)=>{if(e!=null&&typeof e!=`object`&&typeof e!=`function`)throw new v(t,`a dictionary`,e)}),ee=g((e,t,r=0)=>{if(!n(e))throw new v(t,`Array`,e);if(e.length<r)throw new y(t,e,`must be longer than ${r}`)});function te(e,t){ee(e,t);for(let n=0;n<e.length;n++)P(e[n],`${t}[${n}]`)}function ne(e,t){ee(e,t);for(let n=0;n<e.length;n++)R(e[n],`${t}[${n}]`)}function re(e,t){ee(e,t);for(let n=0;n<e.length;n++){let r=e[n],i=`${t}[${n}]`;if(r==null)throw new v(i,`AbortSignal`,r);ce(r,i)}}function ie(e,t=`signal`){if(P(e,t),T[e]===void 0)throw T[m(e)]===void 0?new x(e):new x(e+` (signals must use all capital letters)`)}var ae=g((e,t=`buffer`)=>{if(!w(e))throw new v(t,[`Buffer`,`TypedArray`,`DataView`],e)});function oe(e,t){let n=S(t),r=e.length;if(n===`hex`&&r%2!=0)throw new y(`encoding`,t,`is invalid for data of length ${r}`)}function se(e,t=`Port`,n=!0){if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&h(e).length===0||+e!=e>>>0||e>65535||e===0&&!n)throw new _(t,e,n);return e|0}var ce=g((e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new v(t,`AbortSignal`,e)}),le=g((e,t)=>{if(typeof e!=`function`)throw new v(t,`Function`,e)}),ue=g((e,t)=>{if(typeof e!=`function`||C(e))throw new v(t,`Function`,e)}),de=g((e,t)=>{if(e!==void 0)throw new v(t,`undefined`,e)});function fe(e,t,n){if(!r(n,e))throw new v(t,`('${i(n,`|`)}')`,e)}var pe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function me(e,t){if(e===void 0||!f(pe,e))throw new y(t,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}function he(e){if(typeof e==`string`)return me(e,`hints`),e;if(n(e)){let t=e.length,n=``;if(t===0)return n;for(let r=0;r<t;r++){let i=e[r];me(i,`hints`),n+=i,r!==t-1&&(n+=`, `)}return n}throw new y(`hints`,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}t.exports={isInt32:E,isUint32:D,parseFileMode:A,validateArray:ee,validateStringArray:te,validateBooleanArray:ne,validateAbortSignalArray:re,validateBoolean:R,validateBuffer:ae,validateDictionary:V,validateEncoding:oe,validateFunction:le,validateInt32:M,validateInteger:j,validateNumber:F,validateObject:B,validateOneOf:I,validatePlainFunction:ue,validatePort:se,validateSignalName:ie,validateString:P,validateUint32:N,validateUndefined:de,validateUnion:fe,validateAbortSignal:ce,validateLinkHeaderValue:he}})),Ne=o(((e,t)=>{var n=t.exports={},r,i;function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}(function(){try{r=typeof setTimeout==`function`?setTimeout:a}catch{r=a}try{i=typeof clearTimeout==`function`?clearTimeout:o}catch{i=o}})();function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch{try{return r.call(null,e,0)}catch{return r.call(this,e,0)}}}function c(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch{try{return i.call(null,e)}catch{return i.call(this,e)}}}var l=[],u=!1,d,f=-1;function p(){!u||!d||(u=!1,d.length?l=d.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(d=l,l=[];++f<t;)d&&d[f].run();f=-1,t=l.length}d=null,u=!1,c(e)}}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),l.length===1&&!u&&s(m)};function h(e,t){this.fun=e,this.array=t}h.prototype.run=function(){this.fun.apply(null,this.array)},n.title=`browser`,n.browser=!0,n.env={},n.argv=[],n.version=``,n.versions={};function g(){}n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw Error(`process.binding is not supported`)},n.cwd=function(){return`/`},n.chdir=function(e){throw Error(`process.chdir is not supported`)},n.umask=function(){return 0}})),Pe=o(((e,t)=>{var{SymbolAsyncIterator:n,SymbolIterator:r,SymbolFor:i}=Ee(),a=i(`nodejs.stream.destroyed`),o=i(`nodejs.stream.errored`),s=i(`nodejs.stream.readable`),c=i(`nodejs.stream.writable`),l=i(`nodejs.stream.disturbed`),u=i(`nodejs.webstream.isClosedPromise`),d=i(`nodejs.webstream.controllerErrorFunction`);function f(e,t=!1){return!!(e&&typeof e.pipe==`function`&&typeof e.on==`function`&&(!t||typeof e.pause==`function`&&typeof e.resume==`function`)&&(!e._writableState||e._readableState?.readable!==!1)&&(!e._writableState||e._readableState))}function p(e){return!!(e&&typeof e.write==`function`&&typeof e.on==`function`&&(!e._readableState||e._writableState?.writable!==!1))}function m(e){return!!(e&&typeof e.pipe==`function`&&e._readableState&&typeof e.on==`function`&&typeof e.write==`function`)}function h(e){return e&&(e._readableState||e._writableState||typeof e.write==`function`&&typeof e.on==`function`||typeof e.pipe==`function`&&typeof e.on==`function`)}function g(e){return!!(e&&!h(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`&&typeof e.cancel==`function`)}function _(e){return!!(e&&!h(e)&&typeof e.getWriter==`function`&&typeof e.abort==`function`)}function v(e){return!!(e&&!h(e)&&typeof e.readable==`object`&&typeof e.writable==`object`)}function y(e){return g(e)||_(e)||v(e)}function b(e,t){return e==null?!1:t===!0?typeof e[n]==`function`:t===!1?typeof e[r]==`function`:typeof e[n]==`function`||typeof e[r]==`function`}function x(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||r!=null&&r.destroyed)}function S(e){if(!p(e))return null;if(e.writableEnded===!0)return!0;let t=e._writableState;return t!=null&&t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function C(e,t){if(!p(e))return null;if(e.writableFinished===!0)return!0;let n=e._writableState;return n!=null&&n.errored?!1:typeof n?.finished==`boolean`?!!(n.finished||t===!1&&n.ended===!0&&n.length===0):null}function w(e){if(!f(e))return null;if(e.readableEnded===!0)return!0;let t=e._readableState;return!t||t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function T(e,t){if(!f(e))return null;let n=e._readableState;return n!=null&&n.errored?!1:typeof n?.endEmitted==`boolean`?!!(n.endEmitted||t===!1&&n.ended===!0&&n.length===0):null}function E(e){return e&&e[s]!=null?e[s]:typeof e?.readable==`boolean`?x(e)?!1:f(e)&&e.readable&&!T(e):null}function D(e){return e&&e[c]!=null?e[c]:typeof e?.writable==`boolean`?x(e)?!1:p(e)&&e.writable&&!S(e):null}function O(e,t){return h(e)?x(e)?!0:!(t?.readable!==!1&&E(e)||t?.writable!==!1&&D(e)):null}function k(e){return h(e)?e.writableErrored?e.writableErrored:e._writableState?.errored??null:null}function A(e){return h(e)?e.readableErrored?e.readableErrored:e._readableState?.errored??null:null}function j(e){if(!h(e))return null;if(typeof e.closed==`boolean`)return e.closed;let t=e._writableState,n=e._readableState;return typeof t?.closed==`boolean`||typeof n?.closed==`boolean`?t?.closed||n?.closed:typeof e._closed==`boolean`&&M(e)?e._closed:null}function M(e){return typeof e._closed==`boolean`&&typeof e._defaultKeepAlive==`boolean`&&typeof e._removedConnection==`boolean`&&typeof e._removedContLen==`boolean`}function N(e){return typeof e._sent100==`boolean`&&M(e)}function P(e){return typeof e._consuming==`boolean`&&typeof e._dumped==`boolean`&&e.req?.upgradeOrConnect===void 0}function F(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!r&&N(e)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function I(e){return!!(e&&(e[l]??(e.readableDidRead||e.readableAborted)))}function R(e){return!!(e&&(e[o]??e.readableErrored??e.writableErrored??e._readableState?.errorEmitted??e._writableState?.errorEmitted??e._readableState?.errored??e._writableState?.errored))}t.exports={isDestroyed:x,kIsDestroyed:a,isDisturbed:I,kIsDisturbed:l,isErrored:R,kIsErrored:o,isReadable:E,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:d,kIsWritable:c,isClosed:j,isDuplexNodeStream:m,isFinished:O,isIterable:b,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:w,isReadableFinished:T,isReadableErrored:A,isNodeStream:h,isWebStream:y,isWritable:D,isWritableNodeStream:p,isWritableStream:_,isWritableEnded:S,isWritableFinished:C,isWritableErrored:k,isServerRequest:P,isServerResponse:N,willEmitClose:F,isTransformStream:v}})),Fe=o(((e,t)=>{var n=Ne(),{AbortError:r,codes:i}=Oe(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:o}=i,{kEmptyObject:s,once:c}=je(),{validateAbortSignal:l,validateFunction:u,validateObject:d,validateBoolean:f}=Me(),{Promise:p,PromisePrototypeThen:m,SymbolDispose:h}=Ee(),{isClosed:g,isReadable:_,isReadableNodeStream:v,isReadableStream:y,isReadableFinished:b,isReadableErrored:x,isWritable:S,isWritableNodeStream:C,isWritableStream:w,isWritableFinished:T,isWritableErrored:E,isNodeStream:D,willEmitClose:O,kIsClosedPromise:k}=Pe(),A;function j(e){return e.setHeader&&typeof e.abort==`function`}var M=()=>{};function N(e,t,i){if(arguments.length===2?(i=t,t=s):t==null?t=s:d(t,`options`),u(i,`callback`),l(t.signal,`options.signal`),i=c(i),y(e)||w(e))return P(e,t,i);if(!D(e))throw new a(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],e);let f=t.readable??v(e),p=t.writable??C(e),m=e._writableState,k=e._readableState,N=()=>{e.writable||R()},F=O(e)&&v(e)===f&&C(e)===p,I=T(e,!1),R=()=>{I=!0,e.destroyed&&(F=!1),!(F&&(!e.readable||f))&&(!f||z)&&i.call(e)},z=b(e,!1),B=()=>{z=!0,e.destroyed&&(F=!1),!(F&&(!e.writable||p))&&(!p||I)&&i.call(e)},V=t=>{i.call(e,t)},ee=g(e),te=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);if(f&&!z&&v(e,!0)&&!b(e,!1)||p&&!I&&!T(e,!1))return i.call(e,new o);i.call(e)},ne=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);i.call(e)},re=()=>{e.req.on(`finish`,R)};j(e)?(e.on(`complete`,R),F||e.on(`abort`,te),e.req?re():e.on(`request`,re)):p&&!m&&(e.on(`end`,N),e.on(`close`,N)),!F&&typeof e.aborted==`boolean`&&e.on(`aborted`,te),e.on(`end`,B),e.on(`finish`,R),t.error!==!1&&e.on(`error`,V),e.on(`close`,te),ee?n.nextTick(te):m!=null&&m.errorEmitted||k!=null&&k.errorEmitted?F||n.nextTick(ne):(!f&&(!F||_(e))&&(I||S(e)===!1)||!p&&(!F||S(e))&&(z||_(e)===!1)||k&&e.req&&e.aborted)&&n.nextTick(ne);let ie=()=>{i=M,e.removeListener(`aborted`,te),e.removeListener(`complete`,R),e.removeListener(`abort`,te),e.removeListener(`request`,re),e.req&&e.req.removeListener(`finish`,R),e.removeListener(`end`,N),e.removeListener(`close`,N),e.removeListener(`finish`,R),e.removeListener(`end`,B),e.removeListener(`error`,V),e.removeListener(`close`,te)};if(t.signal&&!ee){let a=()=>{let n=i;ie(),n.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(a);else{A||=je().addAbortListener;let n=A(t.signal,a),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}}return ie}function P(e,t,i){let a=!1,o=M;if(t.signal)if(o=()=>{a=!0,i.call(e,new r(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(o);else{A||=je().addAbortListener;let n=A(t.signal,o),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}let s=(...t)=>{a||n.nextTick(()=>i.apply(e,t))};return m(e[k].promise,s,s),M}function F(e,t){var n;let r=!1;return t===null&&(t=s),(n=t)!=null&&n.cleanup&&(f(t.cleanup,`cleanup`),r=t.cleanup),new p((n,i)=>{let a=N(e,t,e=>{r&&a(),e?i(e):n()})})}t.exports=N,t.exports.finished=F})),Ie=o(((e,t)=>{var n=Ne(),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:i},AbortError:a}=Oe(),{Symbol:o}=Ee(),{kIsDestroyed:s,isDestroyed:c,isFinished:l,isServerRequest:u}=Pe(),d=o(`kDestroy`),f=o(`kConstruct`);function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t){let n=this._readableState,i=this._writableState,a=i||n;return i!=null&&i.destroyed||n!=null&&n.destroyed?(typeof t==`function`&&t(),this):(p(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),a.constructed?h(this,e,t):this.once(d,function(n){h(this,r(n,e),t)}),this)}function h(e,t,r){let i=!1;function a(t){if(i)return;i=!0;let a=e._readableState,o=e._writableState;p(t,o,a),o&&(o.closed=!0),a&&(a.closed=!0),typeof r==`function`&&r(t),t?n.nextTick(g,e,t):n.nextTick(_,e)}try{e._destroy(t||null,a)}catch(e){a(e)}}function g(e,t){v(e,t),_(e)}function _(e){let t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&e.emit(`close`)}function v(e,t){let n=e._readableState,r=e._writableState;r!=null&&r.errorEmitted||n!=null&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit(`error`,t))}function y(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function b(e,t,r){let i=e._readableState,a=e._writableState;if(a!=null&&a.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||a!=null&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function x(e,t){if(typeof e._construct!=`function`)return;let r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),!(e.listenerCount(f)>1)&&n.nextTick(S,e)}function S(e){let t=!1;function r(r){if(t){b(e,r??new i);return}t=!0;let a=e._readableState,o=e._writableState,s=o||a;a&&(a.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(d,r):r?b(e,r,!0):n.nextTick(C,e)}try{e._construct(e=>{n.nextTick(r,e)})}catch(e){n.nextTick(r,e)}}function C(e){e.emit(f)}function w(e){return e?.setHeader&&typeof e.abort==`function`}function T(e){e.emit(`close`)}function E(e,t){e.emit(`error`,t),n.nextTick(T,e)}function D(e,t){!e||c(e)||(!t&&!l(e)&&(t=new a),u(e)?(e.socket=null,e.destroy(t)):w(e)?e.abort():w(e.req)?e.req.abort():typeof e.destroy==`function`?e.destroy(t):typeof e.close==`function`?e.close():t?n.nextTick(E,e,t):n.nextTick(T,e),e.destroyed||(e[s]=!0))}t.exports={construct:x,destroyer:D,destroy:m,undestroy:y,errorOrDestroy:b}})),Le=o(((e,t)=>{var{ArrayIsArray:n,ObjectSetPrototypeOf:r}=Ee(),{EventEmitter:i}=Ae();function a(e){i.call(this,e)}r(a.prototype,i.prototype),r(a,i),a.prototype.pipe=function(e,t){let n=this;function r(t){e.writable&&e.write(t)===!1&&n.pause&&n.pause()}n.on(`data`,r);function a(){n.readable&&n.resume&&n.resume()}e.on(`drain`,a),!e._isStdio&&(!t||t.end!==!1)&&(n.on(`end`,c),n.on(`close`,l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,typeof e.destroy==`function`&&e.destroy())}function u(e){d(),i.listenerCount(this,`error`)===0&&this.emit(`error`,e)}o(n,`error`,u),o(e,`error`,u);function d(){n.removeListener(`data`,r),e.removeListener(`drain`,a),n.removeListener(`end`,c),n.removeListener(`close`,l),n.removeListener(`error`,u),e.removeListener(`error`,u),n.removeListener(`end`,d),n.removeListener(`close`,d),e.removeListener(`close`,d)}return n.on(`end`,d),n.on(`close`,d),e.on(`close`,d),e.emit(`pipe`,n),e};function o(e,t,r){if(typeof e.prependListener==`function`)return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}t.exports={Stream:a,prependListener:o}})),Re=o(((e,t)=>{var{SymbolDispose:n}=Ee(),{AbortError:r,codes:i}=Oe(),{isNodeStream:a,isWebStream:o,kControllerErrorFunction:s}=Pe(),c=Fe(),{ERR_INVALID_ARG_TYPE:l}=i,u,d=(e,t)=>{if(typeof e!=`object`||!(`aborted`in e))throw new l(t,`AbortSignal`,e)};t.exports.addAbortSignal=function(e,n){if(d(e,`signal`),!a(n)&&!o(n))throw new l(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],n);return t.exports.addAbortSignalNoValidate(e,n)},t.exports.addAbortSignalNoValidate=function(e,t){if(typeof e!=`object`||!(`aborted`in e))return t;let i=a(t)?()=>{t.destroy(new r(void 0,{cause:e.reason}))}:()=>{t[s](new r(void 0,{cause:e.reason}))};return e.aborted?i():(u||=je().addAbortListener,c(t,u(e,i)[n])),t}})),ze=o(((e,t)=>{var{StringPrototypeSlice:n,SymbolIterator:r,TypedArrayPrototypeSet:i,Uint8Array:a}=Ee(),{Buffer:o}=f(),{inspect:s}=je();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){let t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return``;let t=this.head,n=``+t.data;for(;(t=t.next)!==null;)n+=e+t.data;return n}concat(e){if(this.length===0)return o.alloc(0);let t=o.allocUnsafe(e>>>0),n=this.head,r=0;for(;n;)i(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){let n=this.head.data;if(e<n.length){let t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[r](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t=``,r=this.head,i=0;do{let a=r.data;if(e>a.length)t+=a,e-=a.length;else{e===a.length?(t+=a,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(a,0,e),this.head=r,r.data=n(a,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){let t=o.allocUnsafe(e),n=e,r=this.head,s=0;do{let o=r.data;if(e>o.length)i(t,o,n-e),e-=o.length;else{e===o.length?(i(t,o,n-e),++s,r.next?this.head=r.next:this.head=this.tail=null):(i(t,new a(o.buffer,o.byteOffset,e),n-e),this.head=r,r.data=o.slice(e));break}++s}while((r=r.next)!==null);return this.length-=s,t}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return s(this,{...t,depth:0,customInspect:!1})}}})),Be=o(((e,t)=>{var{MathFloor:n,NumberIsInteger:r}=Ee(),{validateInteger:i}=Me(),{ERR_INVALID_ARG_VALUE:a}=Oe().codes,o=16*1024,s=16;function c(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function l(e){return e?s:o}function u(e,t){i(t,`value`,0),e?s=t:o=t}function d(e,t,i,o){let s=c(t,o,i);if(s!=null){if(!r(s)||s<0)throw new a(o?`options.${i}`:`options.highWaterMark`,s);return n(s)}return l(e.objectMode)}t.exports={getHighWaterMark:d,getDefaultHighWaterMark:l,setDefaultHighWaterMark:u}})),Ve=o(((e,t)=>{var n=f(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),He=o((e=>{var t=Ve().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function r(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),Ue=o(((e,t)=>{var n=Ne(),{PromisePrototypeThen:r,SymbolAsyncIterator:i,SymbolIterator:a}=Ee(),{Buffer:o}=f(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:c}=Oe().codes;function l(e,t,l){let u;if(typeof t==`string`||t instanceof o)return new e({objectMode:!0,...l,read(){this.push(t),this.push(null)}});let d;if(t&&t[i])d=!0,u=t[i]();else if(t&&t[a])d=!1,u=t[a]();else throw new s(`iterable`,[`Iterable`],t);let f=new e({objectMode:!0,highWaterMark:1,...l}),p=!1;f._read=function(){p||(p=!0,h())},f._destroy=function(e,t){r(m(e),()=>n.nextTick(t,e),r=>n.nextTick(t,r||e))};async function m(e){let t=e!=null,n=typeof u.throw==`function`;if(t&&n){let{value:t,done:n}=await u.throw(e);if(await t,n)return}if(typeof u.return==`function`){let{value:e}=await u.return();await e}}async function h(){for(;;){try{let{value:e,done:t}=d?await u.next():u.next();if(t)f.push(null);else{let t=e&&typeof e.then==`function`?await e:e;if(t===null)throw p=!1,new c;if(f.push(t))continue;p=!1}}catch(e){f.destroy(e)}break}}return f}t.exports=l})),We=o(((e,t)=>{var n=Ne(),{ArrayPrototypeIndexOf:r,NumberIsInteger:i,NumberIsNaN:a,NumberParseInt:o,ObjectDefineProperties:s,ObjectKeys:c,ObjectSetPrototypeOf:l,Promise:u,SafeSet:d,SymbolAsyncDispose:p,SymbolAsyncIterator:m,Symbol:h}=Ee();t.exports=H,H.ReadableState=ye;var{EventEmitter:g}=Ae(),{Stream:_,prependListener:v}=Le(),{Buffer:y}=f(),{addAbortSignal:b}=Re(),x=Fe(),S=je().debuglog(`stream`,e=>{S=e}),C=ze(),w=Ie(),{getHighWaterMark:T,getDefaultHighWaterMark:E}=Be(),{aggregateTwoErrors:D,codes:{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:A,ERR_STREAM_PUSH_AFTER_EOF:j,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:M},AbortError:N}=Oe(),{validateObject:P}=Me(),F=h(`kPaused`),{StringDecoder:I}=He(),R=Ue();l(H.prototype,_.prototype),l(H,_);var z=()=>{},{errorOrDestroy:B}=w,V=1,ee=2,te=4,ne=8,re=16,ie=32,ae=64,oe=128,se=256,ce=512,le=1024,ue=2048,de=4096,fe=8192,pe=16384,me=32768,he=65536,ge=1<<17,_e=1<<18;function ve(e){return{enumerable:!1,get(){return(this.state&e)!==0},set(t){t?this.state|=e:this.state&=~e}}}s(ye.prototype,{objectMode:ve(V),ended:ve(ee),endEmitted:ve(te),reading:ve(ne),constructed:ve(re),sync:ve(ie),needReadable:ve(ae),emittedReadable:ve(oe),readableListening:ve(se),resumeScheduled:ve(ce),errorEmitted:ve(le),emitClose:ve(ue),autoDestroy:ve(de),destroyed:ve(fe),closed:ve(pe),closeEmitted:ve(me),multiAwaitDrain:ve(he),readingMore:ve(ge),dataEmitted:ve(_e)});function ye(e,t,n){typeof n!=`boolean`&&(n=t instanceof U()),this.state=6192,e&&e.objectMode&&(this.state|=V),n&&e&&e.readableObjectMode&&(this.state|=V),this.highWaterMark=e?T(this,e,`readableHighWaterMark`,n):E(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this[F]=null,e&&e.emitClose===!1&&(this.state&=~ue),e&&e.autoDestroy===!1&&(this.state&=~de),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new I(e.encoding),this.encoding=e.encoding)}function H(e){if(!(this instanceof H))return new H(e);let t=this instanceof U();this._readableState=new ye(e,this,t),e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&!t&&b(e.signal,this)),_.call(this,e),w.construct(this,()=>{this._readableState.needReadable&&Pe(this,this._readableState)})}H.prototype.destroy=w.destroy,H.prototype._undestroy=w.undestroy,H.prototype._destroy=function(e,t){t(e)},H.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},H.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new N,this.destroy(e)),new u((t,n)=>x(this,r=>r&&r!==e?n(r):t(null)))},H.prototype.push=function(e,t){return be(this,e,t,!1)},H.prototype.unshift=function(e,t){return be(this,e,t,!0)};function be(e,t,n,r){S(`readableAddChunk`,t);let i=e._readableState,a;if((i.state&V)===0&&(typeof t==`string`?(n||=i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=y.from(t,n).toString(i.encoding):(t=y.from(t,n),n=``))):t instanceof y?n=``:_._isUint8Array(t)?(t=_._uint8ArrayToBuffer(t),n=``):t!=null&&(a=new O(`chunk`,[`string`,`Buffer`,`Uint8Array`],t))),a)B(e,a);else if(t===null)i.state&=~ne,Te(e,i);else if((i.state&V)!==0||t&&t.length>0)if(r)if((i.state&te)!==0)B(e,new M);else if(i.destroyed||i.errored)return!1;else xe(e,i,t,!0);else if(i.ended)B(e,new j);else if(i.destroyed||i.errored)return!1;else i.state&=~ne,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||t.length!==0?xe(e,i,t,!1):Pe(e,i)):xe(e,i,t,!1);else r||(i.state&=~ne,Pe(e,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function xe(e,t,n,r){t.flowing&&t.length===0&&!t.sync&&e.listenerCount(`data`)>0?((t.state&he)===0?t.awaitDrainWriters=null:t.awaitDrainWriters.clear(),t.dataEmitted=!0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),(t.state&ae)!==0&&De(e)),Pe(e,t)}H.prototype.isPaused=function(){let e=this._readableState;return e[F]===!0||e.flowing===!1},H.prototype.setEncoding=function(e){let t=new I(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let n=this._readableState.buffer,r=``;for(let e of n)r+=t.write(e);return n.clear(),r!==``&&n.push(r),this._readableState.length=r.length,this};var Se=1073741824;function Ce(e){if(e>Se)throw new A(`size`,`<= 1GiB`,e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++,e}function we(e,t){return e<=0||t.length===0&&t.ended?0:(t.state&V)===0?a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0:1}H.prototype.read=function(e){S(`read`,e),e===void 0?e=NaN:i(e)||(e=o(e,10));let t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=Ce(e)),e!==0&&(t.state&=~oe),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return S(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?$e(this):De(this),null;if(e=we(e,t),e===0&&t.ended)return t.length===0&&$e(this),null;let r=(t.state&ae)!==0;if(S(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,S(`length less than watermark`,r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,S(`reading, ended or constructing`,r);else if(r){S(`do read`),t.state|=ne|ie,t.length===0&&(t.state|=ae);try{this._read(t.highWaterMark)}catch(e){B(this,e)}t.state&=~ie,t.reading||(e=we(n,t))}let a;return a=e>0?Qe(e,t):null,a===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&$e(this)),a!==null&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit(`data`,a)),a};function Te(e,t){if(S(`onEofChunk`),!t.ended){if(t.decoder){let e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?De(e):(t.needReadable=!1,t.emittedReadable=!0,ke(e))}}function De(e){let t=e._readableState;S(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S(`emitReadable`,t.flowing),t.emittedReadable=!0,n.nextTick(ke,e))}function ke(e){let t=e._readableState;S(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Ye(e)}function Pe(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(Ve,e,t))}function Ve(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){let n=t.length;if(S(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}H.prototype._read=function(e){throw new k(`_read()`)},H.prototype.pipe=function(e,t){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new d(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S(`pipe count=%d opts=%j`,i.pipes.length,t);let a=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr?s:_;i.endEmitted?n.nextTick(a):r.once(`end`,a),e.on(`unpipe`,o);function o(e,t){S(`onunpipe`),e===r&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,u())}function s(){S(`onend`),e.end()}let c,l=!1;function u(){S(`cleanup`),e.removeListener(`close`,h),e.removeListener(`finish`,g),c&&e.removeListener(`drain`,c),e.removeListener(`error`,m),e.removeListener(`unpipe`,o),r.removeListener(`end`,s),r.removeListener(`end`,_),r.removeListener(`data`,p),l=!0,c&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&c()}function f(){l||(i.pipes.length===1&&i.pipes[0]===e?(S(`false write response, pause`,0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S(`false write response, pause`,i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),c||(c=We(r,e),e.on(`drain`,c))}r.on(`data`,p);function p(t){S(`ondata`);let n=e.write(t);S(`dest.write`,n),n===!1&&f()}function m(t){if(S(`onerror`,t),_(),e.removeListener(`error`,m),e.listenerCount(`error`)===0){let n=e._writableState||e._readableState;n&&!n.errorEmitted?B(e,t):e.emit(`error`,t)}}v(e,`error`,m);function h(){e.removeListener(`finish`,g),_()}e.once(`close`,h);function g(){S(`onfinish`),e.removeListener(`close`,h),_()}e.once(`finish`,g);function _(){S(`unpipe`),r.unpipe(e)}return e.emit(`pipe`,r),e.writableNeedDrain===!0?f():i.flowing||(S(`pipe resume`),r.resume()),e};function We(e,t){return function(){let n=e._readableState;n.awaitDrainWriters===t?(S(`pipeOnDrain`,1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(S(`pipeOnDrain`,n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&e.listenerCount(`data`)&&e.resume()}}H.prototype.unpipe=function(e){let t=this._readableState,n={hasUnpiped:!1};if(t.pipes.length===0)return this;if(!e){let e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit(`unpipe`,this,{hasUnpiped:!1});return this}let i=r(t.pipes,e);return i===-1?this:(t.pipes.splice(i,1),t.pipes.length===0&&this.pause(),e.emit(`unpipe`,this,n),this)},H.prototype.on=function(e,t){let r=_.prototype.on.call(this,e,t),i=this._readableState;return e===`data`?(i.readableListening=this.listenerCount(`readable`)>0,i.flowing!==!1&&this.resume()):e===`readable`&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S(`on readable`,i.length,i.reading),i.length?De(this):i.reading||n.nextTick(Ke,this)),r},H.prototype.addListener=H.prototype.on,H.prototype.removeListener=function(e,t){let r=_.prototype.removeListener.call(this,e,t);return e===`readable`&&n.nextTick(Ge,this),r},H.prototype.off=H.prototype.removeListener,H.prototype.removeAllListeners=function(e){let t=_.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&n.nextTick(Ge,this),t};function Ge(e){let t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&t[F]===!1?t.flowing=!0:e.listenerCount(`data`)>0?e.resume():t.readableListening||(t.flowing=null)}function Ke(e){S(`readable nexttick read 0`),e.read(0)}H.prototype.resume=function(){let e=this._readableState;return e.flowing||(S(`resume`),e.flowing=!e.readableListening,qe(this,e)),e[F]=!1,this};function qe(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(Je,e,t))}function Je(e,t){S(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),Ye(e),t.flowing&&!t.reading&&e.read(0)}H.prototype.pause=function(){return S(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(S(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState[F]=!0,this};function Ye(e){let t=e._readableState;for(S(`flow`,t.flowing);t.flowing&&e.read()!==null;);}H.prototype.wrap=function(e){let t=!1;e.on(`data`,n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on(`end`,()=>{this.push(null)}),e.on(`error`,e=>{B(this,e)}),e.on(`close`,()=>{this.destroy()}),e.on(`destroy`,()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let n=c(e);for(let t=1;t<n.length;t++){let r=n[t];this[r]===void 0&&typeof e[r]==`function`&&(this[r]=e[r].bind(e))}return this},H.prototype[m]=function(){return Xe(this)},H.prototype.iterator=function(e){return e!==void 0&&P(e,`options`),Xe(this,e)};function Xe(e,t){typeof e.read!=`function`&&(e=H.wrap(e,{objectMode:!0}));let n=Ze(e,t);return n.stream=e,n}async function*Ze(e,t){let n=z;function r(t){this===e?(n(),n=z):n=t}e.on(`readable`,r);let i,a=x(e,{writable:!1},e=>{i=e?D(i,e):null,n(),n=z});try{for(;;){let t=e.destroyed?null:e.read();if(t!==null)yield t;else if(i)throw i;else if(i===null)return;else await new u(r)}}catch(e){throw i=D(i,e),i}finally{(i||t?.destroyOnReturn!==!1)&&(i===void 0||e._readableState.autoDestroy)?w.destroyer(e,null):(e.off(`readable`,r),a())}}s(H.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!!e&&e.readable!==!1&&!e.destroyed&&!e.errorEmitted&&!e.endEmitted},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(ye.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[F]!==!1},set(e){this[F]=!!e}}}),H._fromList=Qe;function Qe(e,t){if(t.length===0)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function $e(e){let t=e._readableState;S(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(et,t,e))}function et(e,t){if(S(`endReadableNT`,e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.emit(`end`),t.writable&&t.allowHalfOpen===!1)n.nextTick(tt,t);else if(e.autoDestroy){let e=t._writableState;(!e||e.autoDestroy&&(e.finished||e.writable===!1))&&t.destroy()}}}function tt(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}H.from=function(e,t){return R(H,e,t)};var nt;function rt(){return nt===void 0&&(nt={}),nt}H.fromWeb=function(e,t){return rt().newStreamReadableFromReadableStream(e,t)},H.toWeb=function(e,t){return rt().newReadableStreamFromStreamReadable(e,t)},H.wrap=function(e,t){return new H({objectMode:e.readableObjectMode??e.objectMode??!0,...t,destroy(t,n){w.destroyer(e,t),n(t)}}).wrap(e)}})),Ge=o(((e,t)=>{var n=Ne(),{ArrayPrototypeSlice:r,Error:i,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:o,ObjectDefineProperties:s,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:l,Symbol:u,SymbolHasInstance:d}=Ee();t.exports=P,P.WritableState=M;var{EventEmitter:p}=Ae(),m=Le().Stream,{Buffer:h}=f(),g=Ie(),{addAbortSignal:_}=Re(),{getHighWaterMark:v,getDefaultHighWaterMark:y}=Be(),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_MULTIPLE_CALLBACK:S,ERR_STREAM_CANNOT_PIPE:C,ERR_STREAM_DESTROYED:w,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:E,ERR_STREAM_WRITE_AFTER_END:D,ERR_UNKNOWN_ENCODING:O}=Oe().codes,{errorOrDestroy:k}=g;c(P.prototype,m.prototype),c(P,m);function A(){}var j=u(`kOnFinished`);function M(e,t,n){typeof n!=`boolean`&&(n=t instanceof U()),this.objectMode=!!(e&&e.objectMode),n&&(this.objectMode=this.objectMode||!!(e&&e.writableObjectMode)),this.highWaterMark=e?v(this,e,`writableHighWaterMark`,n):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1,this.decodeStrings=!(e&&e.decodeStrings===!1),this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=B.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,N(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||e.emitClose!==!1,this.autoDestroy=!e||e.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[j]=[]}function N(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}M.prototype.getBuffer=function(){return r(this.buffered,this.bufferedIndex)},o(M.prototype,`bufferedRequestCount`,{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function P(e){let t=this instanceof U();if(!t&&!a(P,this))return new P(e);this._writableState=new M(e,this,t),e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&_(e.signal,this)),m.call(this,e),g.construct(this,()=>{let e=this._writableState;e.writing||ne(this,e),oe(this,e)})}o(P,d,{__proto__:null,value:function(e){return a(this,e)?!0:this===P?e&&e._writableState instanceof M:!1}}),P.prototype.pipe=function(){k(this,new C)};function F(e,t,r,i){let a=e._writableState;if(typeof r==`function`)i=r,r=a.defaultEncoding;else{if(!r)r=a.defaultEncoding;else if(r!==`buffer`&&!h.isEncoding(r))throw new O(r);typeof i!=`function`&&(i=A)}if(t===null)throw new E;if(!a.objectMode)if(typeof t==`string`)a.decodeStrings!==!1&&(t=h.from(t,r),r=`buffer`);else if(t instanceof h)r=`buffer`;else if(m._isUint8Array(t))t=m._uint8ArrayToBuffer(t),r=`buffer`;else throw new b(`chunk`,[`string`,`Buffer`,`Uint8Array`],t);let o;return a.ending?o=new D:a.destroyed&&(o=new w(`write`)),o?(n.nextTick(i,o),k(e,o,!0),o):(a.pendingcb++,I(e,a,t,r,i))}P.prototype.write=function(e,t,n){return F(this,e,t,n)===!0},P.prototype.cork=function(){this._writableState.corked++},P.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||ne(this,e))},P.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=l(e)),!h.isEncoding(e))throw new O(e);return this._writableState.defaultEncoding=e,this};function I(e,t,n,r,i){let a=t.objectMode?1:n.length;t.length+=a;let o=t.length<t.highWaterMark;return o||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&r!==`buffer`&&(t.allBuffers=!1),t.allNoop&&i!==A&&(t.allNoop=!1)):(t.writelen=a,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),o&&!t.errored&&!t.destroyed}function R(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function z(e,t,n,r){--t.pendingcb,r(n),te(t),k(e,n)}function B(e,t){let r=e._writableState,i=r.sync,a=r.writecb;if(typeof a!=`function`){k(e,new S);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||=t,e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(z,e,r,t,a):z(e,r,t,a)):(r.buffered.length>r.bufferedIndex&&ne(e,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===a?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:a,stream:e,state:r},n.nextTick(V,r.afterWriteTickInfo)):ee(e,r,1,a))}function V({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,ee(e,t,n,r)}function ee(e,t,n,r){for(!t.ending&&!e.destroyed&&t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`));n-- >0;)t.pendingcb--,r();t.destroyed&&te(t),oe(e,t)}function te(e){if(e.writing)return;for(let t=e.bufferedIndex;t<e.buffered.length;++t){let{chunk:n,callback:r}=e.buffered[t],i=e.objectMode?1:n.length;e.length-=i,r(e.errored??new w(`write`))}let t=e[j].splice(0);for(let n=0;n<t.length;n++)t[n](e.errored??new w(`end`));N(e)}function ne(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:n,bufferedIndex:i,objectMode:a}=t,o=n.length-i;if(!o)return;let s=i;if(t.bufferProcessing=!0,o>1&&e._writev){t.pendingcb-=o-1;let i=t.allNoop?A:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},a=t.allNoop&&s===0?n:r(n,s);a.allBuffers=t.allBuffers,R(e,t,!0,t.length,a,``,i),N(t)}else{do{let{chunk:r,encoding:i,callback:o}=n[s];n[s++]=null,R(e,t,!1,a?1:r.length,r,i,o)}while(s<n.length&&!t.writing);s===n.length?N(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}P.prototype._write=function(e,t,n){if(this._writev)this._writev([{chunk:e,encoding:t}],n);else throw new x(`_write()`)},P.prototype._writev=null,P.prototype.end=function(e,t,r){let a=this._writableState;typeof e==`function`?(r=e,e=null,t=null):typeof t==`function`&&(r=t,t=null);let o;if(e!=null){let n=F(this,e,t);n instanceof i&&(o=n)}return a.corked&&(a.corked=1,this.uncork()),o||(!a.errored&&!a.ending?(a.ending=!0,oe(this,a,!0),a.ended=!0):a.finished?o=new T(`end`):a.destroyed&&(o=new w(`end`))),typeof r==`function`&&(o||a.finished?n.nextTick(r,o):a[j].push(r)),this};function re(e){return e.ending&&!e.destroyed&&e.constructed&&e.length===0&&!e.errored&&e.buffered.length===0&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function ie(e,t){let r=!1;function i(i){if(r){k(e,i??S());return}if(r=!0,t.pendingcb--,i){let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e](i);k(e,i,t.sync)}else re(t)&&(t.prefinished=!0,e.emit(`prefinish`),t.pendingcb++,n.nextTick(se,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}function ae(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.finalCalled=!0,ie(e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function oe(e,t,r){re(t)&&(ae(e,t),t.pendingcb===0&&(r?(t.pendingcb++,n.nextTick((e,t)=>{re(t)?se(e,t):t.pendingcb--},e,t)):re(t)&&(t.pendingcb++,se(e,t))))}function se(e,t){t.pendingcb--,t.finished=!0;let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit(`finish`),t.autoDestroy){let t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))&&e.destroy()}}s(P.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!!e&&e.writable!==!1&&!e.destroyed&&!e.errored&&!e.ending&&!e.ended},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return e?!e.destroyed&&!e.ending&&e.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var ce=g.destroy;P.prototype.destroy=function(e,t){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[j].length)&&n.nextTick(te,r),ce.call(this,e,t),this},P.prototype._undestroy=g.undestroy,P.prototype._destroy=function(e,t){t(e)},P.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)};var le;function ue(){return le===void 0&&(le={}),le}P.fromWeb=function(e,t){return ue().newStreamWritableFromWritableStream(e,t)},P.toWeb=function(e){return ue().newWritableStreamFromStreamWritable(e)}})),Ke=o(((e,t)=>{var n=Ne(),r=f(),{isReadable:i,isWritable:a,isIterable:o,isNodeStream:s,isReadableNodeStream:c,isWritableNodeStream:l,isDuplexNodeStream:u,isReadableStream:d,isWritableStream:p}=Pe(),m=Fe(),{AbortError:h,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_}}=Oe(),{destroyer:v}=Ie(),y=U(),b=We(),x=Ge(),{createDeferredPromise:S}=je(),C=Ue(),w=globalThis.Blob||r.Blob,T=w===void 0?function(e){return!1}:function(e){return e instanceof w},E=globalThis.AbortController||ke().AbortController,{FunctionPrototypeCall:D}=Ee(),O=class extends y{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function e(t,r){if(u(t))return t;if(c(t))return A({readable:t});if(l(t))return A({writable:t});if(s(t))return A({writable:!1,readable:!1});if(d(t))return A({readable:b.fromWeb(t)});if(p(t))return A({writable:x.fromWeb(t)});if(typeof t==`function`){let{value:e,write:i,final:a,destroy:s}=k(t);if(o(e))return C(O,e,{objectMode:!0,write:i,final:a,destroy:s});let c=e?.then;if(typeof c==`function`){let t,r=D(c,e,e=>{if(e!=null)throw new _(`nully`,`body`,e)},e=>{v(t,e)});return t=new O({objectMode:!0,readable:!1,write:i,final(e){a(async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}})},destroy:s})}throw new _(`Iterable, AsyncIterable or AsyncFunction`,r,e)}if(T(t))return e(t.arrayBuffer());if(o(t))return C(O,t,{objectMode:!0,writable:!1});if(d(t?.readable)&&p(t?.writable))return O.fromWeb(t);if(typeof t?.writable==`object`||typeof t?.readable==`object`)return A({readable:t!=null&&t.readable?c(t?.readable)?t?.readable:e(t.readable):void 0,writable:t!=null&&t.writable?l(t?.writable)?t?.writable:e(t.writable):void 0});let i=t?.then;if(typeof i==`function`){let e;return D(i,t,t=>{t!=null&&e.push(t),e.push(null)},t=>{v(e,t)}),e=new O({objectMode:!0,writable:!1,read(){}})}throw new g(r,[`Blob`,`ReadableStream`,`WritableStream`,`Stream`,`Iterable`,`AsyncIterable`,`Function`,`{ readable, writable } pair`,`Promise`],t)};function k(e){let{promise:t,resolve:r}=S(),i=new E,a=i.signal;return{value:e((async function*(){for(;;){let e=t;t=null;let{chunk:i,done:o,cb:s}=await e;if(n.nextTick(s),o)return;if(a.aborted)throw new h(void 0,{cause:a.reason});({promise:t,resolve:r}=S()),yield i}})(),{signal:a}),write(e,t,n){let i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){let t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}function A(e){let t=e.readable&&typeof e.readable.read!=`function`?b.wrap(e.readable):e.readable,n=e.writable,r=!!i(t),o=!!a(n),s,c,l,u,d;function f(e){let t=u;u=null,t?t(e):e&&d.destroy(e)}return d=new O({readableObjectMode:!!(t!=null&&t.readableObjectMode),writableObjectMode:!!(n!=null&&n.writableObjectMode),readable:r,writable:o}),o&&(m(n,e=>{o=!1,e&&v(t,e),f(e)}),d._write=function(e,t,r){n.write(e,t)?r():s=r},d._final=function(e){n.end(),c=e},n.on(`drain`,function(){if(s){let e=s;s=null,e()}}),n.on(`finish`,function(){if(c){let e=c;c=null,e()}})),r&&(m(t,e=>{r=!1,e&&v(t,e),f(e)}),t.on(`readable`,function(){if(l){let e=l;l=null,e()}}),t.on(`end`,function(){d.push(null)}),d._read=function(){for(;;){let e=t.read();if(e===null){l=d._read;return}if(!d.push(e))return}}),d._destroy=function(e,r){!e&&u!==null&&(e=new h),l=null,s=null,c=null,u===null?r(e):(u=r,v(n,e),v(t,e))},d}})),U=o(((e,t)=>{var{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:i,ObjectSetPrototypeOf:a}=Ee();t.exports=c;var o=We(),s=Ge();a(c.prototype,o.prototype),a(c,o);{let e=i(s.prototype);for(let t=0;t<e.length;t++){let n=e[t];c.prototype[n]||(c.prototype[n]=s.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),e?(this.allowHalfOpen=e.allowHalfOpen!==!1,e.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(c.prototype,{writable:{__proto__:null,...r(s.prototype,`writable`)},writableHighWaterMark:{__proto__:null,...r(s.prototype,`writableHighWaterMark`)},writableObjectMode:{__proto__:null,...r(s.prototype,`writableObjectMode`)},writableBuffer:{__proto__:null,...r(s.prototype,`writableBuffer`)},writableLength:{__proto__:null,...r(s.prototype,`writableLength`)},writableFinished:{__proto__:null,...r(s.prototype,`writableFinished`)},writableCorked:{__proto__:null,...r(s.prototype,`writableCorked`)},writableEnded:{__proto__:null,...r(s.prototype,`writableEnded`)},writableNeedDrain:{__proto__:null,...r(s.prototype,`writableNeedDrain`)},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}});var l;function u(){return l===void 0&&(l={}),l}c.fromWeb=function(e,t){return u().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return u().newReadableWritablePairFromDuplex(e)};var d;c.from=function(e){return d||=Ke(),d(e,`body`)}})),qe=o(((e,t)=>{var{ObjectSetPrototypeOf:n,Symbol:r}=Ee();t.exports=c;var{ERR_METHOD_NOT_IMPLEMENTED:i}=Oe().codes,a=U(),{getHighWaterMark:o}=Be();n(c.prototype,a.prototype),n(c,a);var s=r(`kCallback`);function c(e){if(!(this instanceof c))return new c(e);let t=e?o(this,e,`readableHighWaterMark`,!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[s]=null,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function l(e){typeof this._flush==`function`&&!this.destroyed?this._flush((t,n)=>{if(t){e?e(t):this.destroy(t);return}n!=null&&this.push(n),this.push(null),e&&e()}):(this.push(null),e&&e())}function u(){this._final!==l&&l.call(this)}c.prototype._final=l,c.prototype._transform=function(e,t,n){throw new i(`_transform()`)},c.prototype._write=function(e,t,n){let r=this._readableState,i=this._writableState,a=r.length;this._transform(e,t,(e,t)=>{if(e){n(e);return}t!=null&&this.push(t),i.ended||a===r.length||r.length<r.highWaterMark?n():this[s]=n})},c.prototype._read=function(){if(this[s]){let e=this[s];this[s]=null,e()}}})),Je=o(((e,t)=>{var{ObjectSetPrototypeOf:n}=Ee();t.exports=i;var r=qe();n(i.prototype,r.prototype),n(i,r);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),Ye=o(((e,t)=>{var n=Ne(),{ArrayIsArray:r,Promise:i,SymbolAsyncIterator:a,SymbolDispose:o}=Ee(),s=Fe(),{once:c}=je(),l=Ie(),u=U(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:h,ERR_STREAM_PREMATURE_CLOSE:g},AbortError:_}=Oe(),{validateFunction:v,validateAbortSignal:y}=Me(),{isIterable:b,isReadable:x,isReadableNodeStream:S,isNodeStream:C,isTransformStream:w,isWebStream:T,isReadableStream:E,isReadableFinished:D}=Pe(),O=globalThis.AbortController||ke().AbortController,k,A,j;function M(e,t,n){let r=!1;return e.on(`close`,()=>{r=!0}),{destroy:t=>{r||(r=!0,l.destroyer(e,t||new h(`pipe`)))},cleanup:s(e,{readable:t,writable:n},e=>{r=!e})}}function N(e){return v(e[e.length-1],`streams[stream.length - 1]`),e.pop()}function P(e){if(b(e))return e;if(S(e))return F(e);throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`],e)}async function*F(e){A||=We(),yield*A.prototype[a].call(e)}async function I(e,t,n,{end:r}){let a,o=null,c=e=>{if(e&&(a=e),o){let e=o;o=null,e()}},l=()=>new i((e,t)=>{a?t(a):o=()=>{a?t(a):e()}});t.on(`drain`,c);let u=s(t,{readable:!1},c);try{t.writableNeedDrain&&await l();for await(let n of e)t.write(n)||await l();r&&(t.end(),await l()),n()}catch(e){n(a===e?e:d(a,e))}finally{u(),t.off(`drain`,c)}}async function R(e,t,n,{end:r}){w(t)&&(t=t.writable);let i=t.getWriter();try{for await(let t of e)await i.ready,i.write(t).catch(()=>{});await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function z(...e){return B(e,c(N(e)))}function B(e,t,i){if(e.length===1&&r(e[0])&&(e=e[0]),e.length<2)throw new m(`streams`);let a=new O,s=a.signal,c=i?.signal,l=[];y(c,`options.signal`);function d(){F(new _)}j||=je().addAbortListener;let h;c&&(h=j(c,d));let g,v,D=[],A=0;function N(e){F(e,--A===0)}function F(e,r){var i;if(e&&(!g||g.code===`ERR_STREAM_PREMATURE_CLOSE`)&&(g=e),!(!g&&!r)){for(;D.length;)D.shift()(g);(i=h)==null||i[o](),a.abort(),r&&(g||l.forEach(e=>e()),n.nextTick(t,g,v))}}let z;for(let t=0;t<e.length;t++){let r=e[t],a=t<e.length-1,o=t>0,c=a||i?.end!==!1,d=t===e.length-1;if(C(r)){if(c){let{destroy:e,cleanup:t}=M(r,a,o);D.push(e),x(r)&&d&&l.push(t)}function e(e){e&&e.name!==`AbortError`&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&N(e)}r.on(`error`,e),x(r)&&d&&l.push(()=>{r.removeListener(`error`,e)})}if(t===0)if(typeof r==`function`){if(z=r({signal:s}),!b(z))throw new p(`Iterable, AsyncIterable or Stream`,`source`,z)}else z=b(r)||S(r)||w(r)?r:u.from(r);else if(typeof r==`function`)if(z=w(z)?P(z?.readable):P(z),z=r(z,{signal:s}),a){if(!b(z,!0))throw new p(`AsyncIterable`,`transform[${t-1}]`,z)}else{k||=Je();let e=new k({objectMode:!0}),t=z?.then;if(typeof t==`function`)A++,t.call(z,t=>{v=t,t!=null&&e.write(t),c&&e.end(),n.nextTick(N)},t=>{e.destroy(t),n.nextTick(N,t)});else if(b(z,!0))A++,I(z,e,N,{end:c});else if(E(z)||w(z)){let t=z.readable||z;A++,I(t,e,N,{end:c})}else throw new p(`AsyncIterable or Promise`,`destination`,z);z=e;let{destroy:r,cleanup:i}=M(z,!1,!0);D.push(r),d&&l.push(i)}else if(C(r)){if(S(z)){A+=2;let e=V(z,r,N,{end:c});x(r)&&d&&l.push(e)}else if(w(z)||E(z)){let e=z.readable||z;A++,I(e,r,N,{end:c})}else if(b(z))A++,I(z,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],z);z=r}else if(T(r)){if(S(z))A++,R(P(z),r,N,{end:c});else if(E(z)||b(z))A++,R(z,r,N,{end:c});else if(w(z))A++,R(z.readable,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],z);z=r}else z=u.from(r)}return(s!=null&&s.aborted||c!=null&&c.aborted)&&n.nextTick(d),z}function V(e,t,r,{end:i}){let a=!1;if(t.on(`close`,()=>{a||r(new g)}),e.pipe(t,{end:!1}),i){function r(){a=!0,t.end()}D(e)?n.nextTick(r):e.once(`end`,r)}else r();return s(e,{readable:!0,writable:!1},t=>{let n=e._readableState;t&&t.code===`ERR_STREAM_PREMATURE_CLOSE`&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once(`end`,r).once(`error`,r):r(t)}),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:B,pipeline:z}})),Xe=o(((e,t)=>{var{pipeline:n}=Ye(),r=U(),{destroyer:i}=Ie(),{isNodeStream:a,isReadable:o,isWritable:s,isWebStream:c,isTransformStream:l,isWritableStream:u,isReadableStream:d}=Pe(),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=Oe(),h=Fe();t.exports=function(...e){if(e.length===0)throw new m(`streams`);if(e.length===1)return r.from(e[0]);let t=[...e];if(typeof e[0]==`function`&&(e[0]=r.from(e[0])),typeof e[e.length-1]==`function`){let t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(!(!a(e[n])&&!c(e[n]))){if(n<e.length-1&&!(o(e[n])||d(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be readable`);if(n>0&&!(s(e[n])||u(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be writable`)}let g,_,v,y,b;function x(e){let t=y;y=null,t?t(e):e?b.destroy(e):!T&&!w&&b.destroy()}let S=e[0],C=n(e,x),w=!!(s(S)||u(S)||l(S)),T=!!(o(C)||d(C)||l(C));if(b=new r({writableObjectMode:!!(S!=null&&S.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:w,readable:T}),w){if(a(S))b._write=function(e,t,n){S.write(e,t)?n():g=n},b._final=function(e){S.end(),_=e},S.on(`drain`,function(){if(g){let e=g;g=null,e()}});else if(c(S)){let e=(l(S)?S.writable:S).getWriter();b._write=async function(t,n,r){try{await e.ready,e.write(t).catch(()=>{}),r()}catch(e){r(e)}},b._final=async function(t){try{await e.ready,e.close().catch(()=>{}),_=t}catch(e){t(e)}}}h(l(C)?C.readable:C,()=>{if(_){let e=_;_=null,e()}})}if(T){if(a(C))C.on(`readable`,function(){if(v){let e=v;v=null,e()}}),C.on(`end`,function(){b.push(null)}),b._read=function(){for(;;){let e=C.read();if(e===null){v=b._read;return}if(!b.push(e))return}};else if(c(C)){let e=(l(C)?C.readable:C).getReader();b._read=async function(){for(;;)try{let{value:t,done:n}=await e.read();if(!b.push(t))return;if(n){b.push(null);return}}catch{return}}}}return b._destroy=function(e,t){!e&&y!==null&&(e=new f),v=null,g=null,_=null,y===null?t(e):(y=t,a(C)&&i(C,e))},b}})),Ze=o(((e,t)=>{var n=globalThis.AbortController||ke().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:o},AbortError:s}=Oe(),{validateAbortSignal:c,validateInteger:l,validateObject:u}=Me(),d=Ee().Symbol(`kWeak`),f=Ee().Symbol(`kResistStopPropagation`),{finished:p}=Fe(),m=Xe(),{addAbortSignalNoValidate:h}=Re(),{isWritable:g,isNodeStream:_}=Pe(),{deprecate:v}=je(),{ArrayPrototypePush:y,Boolean:b,MathFloor:x,Number:S,NumberIsNaN:C,Promise:w,PromiseReject:T,PromiseResolve:E,PromisePrototypeThen:D,Symbol:O}=Ee(),k=O(`kEmpty`),A=O(`kEof`);function j(e,t){if(t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),_(e)&&!g(e))throw new r(`stream`,e,`must be writable`);let n=m(this,e);return t!=null&&t.signal&&h(t.signal,n),n}function M(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`);let n=1;t?.concurrency!=null&&(n=x(t.concurrency));let r=n-1;return t?.highWaterMark!=null&&(r=x(t.highWaterMark)),l(n,`options.concurrency`,1),l(r,`options.highWaterMark`,0),r+=n,async function*(){let i=je().AbortSignalAny([t?.signal].filter(b)),a=this,o=[],c={signal:i},l,u,d=!1,f=0;function p(){d=!0,m()}function m(){--f,h()}function h(){u&&!d&&f<n&&o.length<r&&(u(),u=null)}async function g(){try{for await(let t of a){if(d)return;if(i.aborted)throw new s;try{if(t=e(t,c),t===k)continue;t=E(t)}catch(e){t=T(e)}f+=1,D(t,m,p),o.push(t),l&&=(l(),null),!d&&(o.length>=r||f>=n)&&await new w(e=>{u=e})}o.push(A)}catch(e){let t=T(e);D(t,m,p),o.push(t)}finally{d=!0,l&&=(l(),null)}}g();try{for(;;){for(;o.length>0;){let e=await o[0];if(e===A)return;if(i.aborted)throw new s;e!==k&&(yield e),o.shift(),h()}await new w(e=>{l=e})}}finally{d=!0,u&&=(u(),null)}}.call(this)}function N(e=void 0){return e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`),async function*(){let t=0;for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s({cause:e.signal.reason});yield[t++,r]}}.call(this)}async function P(e,t=void 0){for await(let n of z.call(this,e,t))return!0;return!1}async function F(e,t=void 0){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);return!await P.call(this,async(...t)=>!await e(...t),t)}async function I(e,t){for await(let n of z.call(this,e,t))return n}async function R(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n),k}for await(let e of M.call(this,n,t));}function z(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n)?t:k}return M.call(this,n,t)}var B=class extends a{constructor(){super(`reduce`),this.message=`Reduce of an empty stream requires an initial value`}};async function V(e,t,r){var a;if(typeof e!=`function`)throw new i(`reducer`,[`Function`,`AsyncFunction`],e);r!=null&&u(r,`options`),r?.signal!=null&&c(r.signal,`options.signal`);let o=arguments.length>1;if(r!=null&&(a=r.signal)!=null&&a.aborted){let e=new s(void 0,{cause:r.signal.reason});throw this.once(`error`,()=>{}),await p(this.destroy(e)),e}let l=new n,m=l.signal;if(r!=null&&r.signal){let e={once:!0,[d]:this,[f]:!0};r.signal.addEventListener(`abort`,()=>l.abort(),e)}let h=!1;try{for await(let n of this){var g;if(h=!0,r!=null&&(g=r.signal)!=null&&g.aborted)throw new s;o?t=await e(t,n,{signal:m}):(t=n,o=!0)}if(!h&&!o)throw new B}finally{l.abort()}return t}async function ee(e){e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`);let t=[];for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s(void 0,{cause:e.signal.reason});y(t,r)}return t}function te(e,t){let n=M.call(this,e,t);return async function*(){for await(let e of n)yield*e}.call(this)}function ne(e){if(e=S(e),C(e))return 0;if(e<0)throw new o(`number`,`>= 0`,e);return e}function re(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;e--<=0&&(yield n)}}.call(this)}function ie(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;if(e-- >0&&(yield n),e<=0)return}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:v(N,`readable.asIndexedPairs will be removed in a future version.`),drop:re,filter:z,flatMap:te,map:M,take:ie,compose:j},t.exports.promiseReturningOperators={every:F,forEach:R,reduce:V,toArray:ee,some:P,find:I}})),Qe=o(((e,t)=>{var{ArrayPrototypePop:n,Promise:r}=Ee(),{isIterable:i,isNodeStream:a,isWebStream:o}=Pe(),{pipelineImpl:s}=Ye(),{finished:c}=Fe();$e();function l(...e){return new r((t,r)=>{let c,l,u=e[e.length-1];if(u&&typeof u==`object`&&!a(u)&&!i(u)&&!o(u)){let t=n(e);c=t.signal,l=t.end}s(e,(e,n)=>{e?r(e):t(n)},{signal:c,end:l})})}t.exports={finished:c,pipeline:l}})),$e=o(((e,t)=>{var{Buffer:n}=f(),{ObjectDefineProperty:r,ObjectKeys:i,ReflectApply:a}=Ee(),{promisify:{custom:o}}=je(),{streamReturningOperators:s,promiseReturningOperators:c}=Ze(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:l}}=Oe(),u=Xe(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:p}=Be(),{pipeline:m}=Ye(),{destroyer:h}=Ie(),g=Fe(),_=Qe(),v=Pe(),y=t.exports=Le().Stream;y.isDestroyed=v.isDestroyed,y.isDisturbed=v.isDisturbed,y.isErrored=v.isErrored,y.isReadable=v.isReadable,y.isWritable=v.isWritable,y.Readable=We();for(let e of i(s)){let t=s[e];function n(...e){if(new.target)throw l();return y.Readable.from(a(t,this,e))}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}for(let e of i(c)){let t=c[e];function n(...e){if(new.target)throw l();return a(t,this,e)}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}y.Writable=Ge(),y.Duplex=U(),y.Transform=qe(),y.PassThrough=Je(),y.pipeline=m;var{addAbortSignal:b}=Re();y.addAbortSignal=b,y.finished=g,y.destroy=h,y.compose=u,y.setDefaultHighWaterMark=d,y.getDefaultHighWaterMark=p,r(y,`promises`,{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),r(m,o,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),r(g,o,{__proto__:null,enumerable:!0,get(){return _.finished}}),y.Stream=y,y._isUint8Array=function(e){return e instanceof Uint8Array},y._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}})),et=o(((e,t)=>{var n=$e(),r=Qe(),i=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=i,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,`promises`,{configurable:!0,enumerable:!0,get(){return r}}),t.exports.Stream=n.Stream,t.exports.default=t.exports})),tt=et(),nt=Symbol(`iter`);function rt(e,t,n=4){if(n===0)return Object.assign(e,t);for(let r in t)e[r]=rt(e[r]||Object.create(null),t[r],n-1);return e}function it(e,t,n=4){let r=!1;for(let i in e)if(i in t){let a=n===0?null:it(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}function at(e,t,n=4){let r=!1;for(let i in e)if(!(i in t))r||=Object.create(null),r[i]=n===0?null:rt({},e[i],n-1);else if(n!==0){let a=at(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}var ot=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[``]=1,this._entities=Object.create(null),this._entities[1]=``,this._blankNodeIndex=0,this._factory=e.factory||k}_termFromId(e){if(e[0]===`.`){let t=this._entities,n=e.split(`.`);return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return F(e,this._factory)}_termToNumericId(e){if(e.termType===`Quad`){let t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),r=this._termToNumericId(e.object),i;return t&&n&&r&&(le(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${n}.${r}.${i}`:`.${t}.${n}.${r}`]}return this._ids[I(e)]}_termToNewNumericId(e){let t=e&&e.termType===`Quad`?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${le(e.graph)?``:`.${this._termToNewNumericId(e.graph)}`}`:I(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+ n++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}},st=class e{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!=`function`&&(t=e,e=null),t||={},this._factory=t.factory||k,this._entityIndex=t.entityIndex||new ot({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let t=this._graphs,n,r;for(let i in t)for(let a in n=t[i].subjects)for(let t in r=n[a])e+=Object.keys(r[t]).length;return this._size=e}_addToIndex(e,t,n,r){let i=e[t]||(e[t]={}),a=i[n]||(i[n]={}),o=r in a;return o||(a[r]=null),!o}_removeFromIndex(e,t,n,r){let i=e[t],a=i[n];delete a[r];for(let e in a)return;delete i[n];for(let e in i)return;delete e[t]}*_findInIndex(e,t,n,r,i,a,o,s){let c,l,u,d=this._entities,f=this._termFromId(d[s]),p={subject:null,predicate:null,object:null};t&&((c=e,e={})[t]=c[t]);for(let t in e)if(l=e[t]){p[i]=this._termFromId(d[t]),n&&((c=l,l={})[n]=c[n]);for(let e in l)if(u=l[e]){p[a]=this._termFromId(d[e]);let t=r?r in u?[r]:[]:Object.keys(u);for(let e=0;e<t.length;e++)p[o]=this._termFromId(d[t[e]]),yield this._factory.quad(p.subject,p.predicate,p.object,f)}}}_loop(e,t){for(let n in e)t(n)}_loopByKey0(e,t,n){let r,i;if(r=e[t])for(i in r)n(i)}_loopByKey1(e,t,n){let r,i;for(r in e)i=e[r],i[t]&&n(r)}_loopBy2Keys(e,t,n,r){let i,a,o;if((i=e[t])&&(a=i[n]))for(o in a)r(o)}_countInIndex(e,t,n,r){let i=0,a,o,s;t&&((a=e,e={})[t]=a[t]);for(let t in e)if(o=e[t]){n&&((a=o,o={})[n]=a[n]);for(let e in o)(s=o[e])&&(r?r in s&&i++:i+=Object.keys(s).length)}return i}_getGraphs(e){return e=e===``?1:e&&(this._termToNumericId(e)||-1),typeof e==`number`?{[e]:this._graphs[e]}:this._graphs}_uniqueEntities(e){let t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r?this._termToNewNumericId(r):1;let i=this._graphs[r];return i||(i=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(i)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(i.subjects,e,t,n)?(this._addToIndex(i.predicates,t,n,e),this._addToIndex(i.objects,n,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,n,r){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:r}=e),!this.readQuads(e,t,n,r).next().done}import(e){return e.on(`data`,e=>{this.addQuad(e)}),e}removeQuad(e,t,n,r){t||({subject:e,predicate:t,object:n,graph:r}=e),r=r?this._termToNumericId(r):1;let i=this._graphs,a,o,s;if(!(e&&=this._termToNumericId(e))||!(t&&=this._termToNumericId(t))||!(n&&=this._termToNumericId(n))||!(a=i[r])||!(o=a.subjects[e])||!(s=o[t])||!(n in s))return!1;for(e in this._removeFromIndex(a.subjects,e,t,n),this._removeFromIndex(a.predicates,t,n,e),this._removeFromIndex(a.objects,n,e,t),this._size!==null&&this._size--,a.subjects)return!0;return delete i[r],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on(`data`,e=>{this.removeQuad(e)}),e}removeMatches(e,t,n,r){let i=new tt.Readable({objectMode:!0}),a=this.readQuads(e,t,n,r);return i._read=e=>{for(;--e>=0;){let{done:e,value:t}=a.next();if(e){i.push(null);return}i.push(t)}},this.remove(i)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,r){return[...this.readQuads(e,t,n,r)]}*readQuads(e,t,n,r){let i=this._getGraphs(r),a,o,s,c;if(!(e&&!(o=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n))))for(let e in i)(a=i[e])&&(o?c?yield*this._findInIndex(a.objects,c,o,s,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,o,s,null,`subject`,`predicate`,`object`,e):s?yield*this._findInIndex(a.predicates,s,c,null,`predicate`,`object`,`subject`,e):c?yield*this._findInIndex(a.objects,c,null,null,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,null,null,null,`subject`,`predicate`,`object`,e))}match(e,t,n,r){return new lt(this,e,t,n,r,{entityIndex:this._entityIndex})}countQuads(e,t,n,r){let i=this._getGraphs(r),a=0,o,s,c,l;if(e&&!(s=this._termToNumericId(e))||t&&!(c=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n)))return 0;for(let r in i)(o=i[r])&&(e?n?a+=this._countInIndex(o.objects,l,s,c):a+=this._countInIndex(o.subjects,s,c,l):t?a+=this._countInIndex(o.predicates,c,l,s):a+=this._countInIndex(o.objects,l,s,c));return a}forEach(e,t,n,r,i){this.some(t=>(e(t,this),!1),t,n,r,i)}every(e,t,n,r,i){return!this.some(t=>!e(t,this),t,n,r,i)}some(e,t,n,r,i){for(let a of this.readQuads(t,n,r,i))if(e(a,this))return!0;return!1}getSubjects(e,t,n){let r=[];return this.forSubjects(e=>{r.push(e)},e,t,n),r}forSubjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.predicates,o,s,e):this._loopByKey1(a.subjects,o,e):s?this._loopByKey0(a.objects,s,e):this._loop(a.subjects,e))}getPredicates(e,t,n){let r=[];return this.forPredicates(e=>{r.push(e)},e,t,n),r}forPredicates(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.objects,s,o,e):this._loopByKey0(a.subjects,o,e):s?this._loopByKey1(a.predicates,s,e):this._loop(a.predicates,e))}getObjects(e,t,n){let r=[];return this.forObjects(e=>{r.push(e)},e,t,n),r}forObjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.subjects,o,s,e):this._loopByKey1(a.objects,o,e):s?this._loopByKey0(a.predicates,s,e):this._loop(a.objects,e))}getGraphs(e,t,n){let r=[];return this.forGraphs(e=>{r.push(e)},e,t,n),r}forGraphs(e,t,n,r){for(let i in this._graphs)this.some(t=>(e(t.graph),!0),t,n,r,this._termFromId(this._entities[i]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){let n={},r=t?(()=>!0):((e,t)=>{throw Error(`${e.value} ${t}`)}),i=this.getQuads(null,g.rdf.rest,g.rdf.nil,null),a=e?[...i]:[];return i.forEach(t=>{let i=[],o=!1,s,c,l=t.graph,u=t.subject;for(;u&&!o;){let e=this.getQuads(null,null,u,null),t=this.getQuads(u,null,null,null),n,d=null,f=null,p=null;for(let i=0;i<t.length&&!o;i++)n=t[i],n.graph.equals(l)?s?o=r(u,`has non-list arcs out`):n.predicate.value===g.rdf.first?d?o=r(u,`has multiple rdf:first arcs`):a.push(d=n):n.predicate.value===g.rdf.rest?f?o=r(u,`has multiple rdf:rest arcs`):a.push(f=n):e.length?o=r(u,`can't be subject and object`):(s=n,c=`subject`):o=r(u,`not confined to single graph`);for(let t=0;t<e.length&&!o;++t)n=e[t],s?o=r(u,`can't have coreferences`):n.predicate.value===g.rdf.rest?p?o=r(u,`has incoming rdf:rest arcs`):p=n:(s=n,c=`object`);d?i.unshift(d.object):o=r(u,`has no list head`),u=p&&p.subject}o?e=!1:s&&(n[s[c].value]=i)}),e&&this.removeQuads(a),n}addAll(t){if(t instanceof lt&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof e&&t._entityIndex===this._entityIndex)t._size!==0&&(this._graphs=rt(this._graphs,t._graphs),this._size=null);else for(let e of t)this.add(e);return this}contains(t){if(t instanceof lt&&(t=t.filtered),t===this)return!0;if(!(t instanceof e)||this._entityIndex!==t._entityIndex)return t.every(e=>this.has(e));let n=this._graphs,r=t._graphs,i,a,o,s,c;for(let e in r){if(!(i=n[e]))return!1;i=i.subjects;for(let t in a=r[e].subjects){if(!(o=i[t]))return!1;for(let e in s=a[t]){if(!(c=o[e]))return!1;for(let t in s[e])if(!(t in c))return!1}}}return!0}deleteMatches(e,t,n,r){for(let i of this.match(e,t,n,r))this.removeQuad(i);return this}difference(t){if(t&&t instanceof lt&&(t=t.filtered),t===this)return new e({entityIndex:this._entityIndex});if(t instanceof e&&t._entityIndex===this._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=at(this._graphs,t._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>!t.has(e))}equals(e){return e instanceof lt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)t(e,this)&&n.add(e);return n}intersection(t){if(t instanceof lt&&(t=t.filtered),t===this){let t=new e({entityIndex:this._entityIndex});return t._graphs=rt(Object.create(null),this._graphs),t._size=this._size,t}else if(t instanceof e&&this._entityIndex===t._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=it(t._graphs,this._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>t.has(e))}map(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)n.add(t(e,this));return n}reduce(e,t){let n=this.readQuads(),r=t===void 0?n.next().value:t;for(let t of n)r=e(r,t,this);return r}toArray(){return this.getQuads()}toCanonical(){throw Error(`not implemented`)}toStream(){return this.match()}toString(){return new we().quadsToString(this)}union(t){let n=new e({entityIndex:this._entityIndex});return n._graphs=rt(Object.create(null),this._graphs),n._size=this._size,n.addAll(t),n}*[Symbol.iterator](){yield*this.readQuads()}};function ct(e,t,n=0){let r=t[n];if(r&&!(r in e))return!1;let i=!1;for(let a in r?{[r]:e[r]}:e){let r=n===2?null:ct(e[a],t,n+1);r!==!1&&(i||=Object.create(null),i[a]=r)}return i}var lt=class e extends tt.Readable{constructor(e,t,n,r,i,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:r,graph:i,options:a})}get filtered(){if(!this._filtered){let{n3Store:e,graph:t,object:n,predicate:r,subject:i}=this,a=this._filtered=new st({factory:e._factory,entityIndex:this.options.entityIndex}),o,s,c;if(i&&!(o=a._termToNumericId(i))||r&&!(s=a._termToNumericId(r))||n&&!(c=a._termToNumericId(n)))return a;let l=e._getGraphs(t);for(let e in l){let t,n,r,i;(i=l[e])&&(!o&&s?(n=ct(i.predicates,[s,c,o]))&&(t=ct(i.subjects,[o,s,c]),r=ct(i.objects,[c,o,s])):c?(r=ct(i.objects,[c,o,s]))&&(t=ct(i.subjects,[o,s,c]),n=ct(i.predicates,[s,c,o])):(t=ct(i.subjects,[o,s,c]))&&(n=ct(i.predicates,[s,c,o]),r=ct(i.objects,[c,o,s])),t&&(a._graphs[e]={subjects:t,predicates:n,objects:r}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[nt]&&(this[nt]=this[Symbol.iterator]());let t=this[nt];for(;--e>=0;){let{done:e,value:n}=t.next();if(e){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,r){return this.filtered.deleteMatches(e,t,n,r)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,r,i){return this.filtered.every(e,t,n,r,i)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,r,i){return this.filtered.forEach(e,t,n,r,i)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,r,i){return this.filtered.some(e,t,n,r,i)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,t){return this.filtered.reduce(e,t)}toString(){return new we().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(t,n,r,i){return new e(this.filtered,t,n,r,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}},ut=class extends tt.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let t=new oe(e),n,r,i={onQuad:(e,t)=>{e&&this.emit(`error`,e)||t&&this.push(t)},onPrefix:(e,t)=>{this.emit(`prefix`,e,t)}};e&&e.comments&&(i.onComment=e=>{this.emit(`comment`,e)}),t.parse({on:(e,t)=>{switch(e){case`data`:n=t;break;case`end`:r=t;break}}},i),this._transform=(e,t,r)=>{n(e),r()},this._flush=e=>{r(),e()}}import(e){return e.on(`data`,e=>{this.write(e)}),e.on(`end`,()=>{this.end()}),e.on(`error`,e=>{this.emit(`error`,e)}),this}},W=`http://www.w3.org/ns/shacl#`,dt=`http://datashapes.org/dash#`,ft=`http://www.w3.org/2001/XMLSchema#`,pt=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,mt=`http://www.w3.org/2000/01/rdf-schema#`,ht=`http://www.w3.org/2004/02/skos/core#`,gt=`http://www.w3.org/2002/07/owl#`,G=`http://www.w3.org/ns/oa#`,_t=`http://purl.org/dc/terms/`,vt=k.namedNode(`loaded-shapes`),yt=k.namedNode(`loaded-data`),bt=k.namedNode(pt+`type`),xt=k.namedNode(pt+`langString`),K=k.namedNode(_t+`conformsTo`),St=k.namedNode(mt+`subClassOf`),Ct=k.namedNode(gt+`imports`),wt=k.namedNode(ht+`broader`),Tt=k.namedNode(ht+`narrower`),Et=k.namedNode(W+`NodeShape`),Dt=k.namedNode(W+`IRI`),Ot=k.namedNode(W+`property`),kt=k.namedNode(W+`class`),At=k.namedNode(W+`node`),jt=k.namedNode(W+`targetClass`),Mt=k.namedNode(W+`nodeKind`),Nt=k.namedNode(ft+`string`),Pt=k.namedNode(ft+`boolean`);function Ft(e,t,n=W,r){let i=``,a=It(e,t,n,r);return a&&(i=a.value),i}function It(e,t,n=W,r){let i,a=n+t;if(r?.length){for(let t of r)for(let n of e)if(n.predicate.value===a){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf(`@`)<0?i=n.object:i||=n.object}}else for(let t of e)if(t.predicate.value===a)return t.object;return i}function Lt(e){e.querySelector(`.editor`)?.focus()}function Rt(e,t){return Ft(e,`prefLabel`,`http://www.w3.org/2004/02/skos/core#`,t)||Ft(e,`label`,`http://www.w3.org/2000/01/rdf-schema#`,t)||Ft(e,`title`,`http://purl.org/dc/terms/`,t)||Ft(e,`name`,`http://xmlns.com/foaf/0.1/`,t)}function zt(e,t,n){let r=[];for(let i of e)r.push({value:i,label:Rt(t.getQuads(i,null,null,null),n),children:[]});return r}function Bt(e,t){for(let n in t){let r=t[n];e.startsWith(r)&&(e=e.slice(r.length))}return e}function Vt(e,t,n,r,i=new Set){for(let a of t.owlImports)i.has(a.id)||(i.add(a.id),r.push(...n.getSubjects(bt,e,a)));t.parent&&Vt(e,t.parent,n,r,i)}function Ht(e,t){if(t.in){let e=t.config.lists[t.in];return zt(e?.length?e:[],t.config.store,t.config.languages)}else{let n=t.config.store.getSubjects(bt,e,vt);n.push(...t.config.store.getSubjects(bt,e,yt)),Vt(e,t,t.config.store,n);let r=new Map,i=new Map;for(let e of n)r.set(e.id,{value:e,label:Rt(t.config.store.getQuads(e,null,null,null),t.config.languages),children:[]});for(let e of n){for(let n of t.config.store.getObjects(e,wt,null))r.has(n.id)&&i.set(e.id,n.id);for(let n of t.config.store.getObjects(e,Tt,null))r.has(n.id)&&i.set(n.id,e.id);for(let n of t.config.store.getObjects(e,St,null))r.has(n.id)&&i.set(e.id,n.id)}for(let[e,t]of i.entries())r.get(t)?.children?.push(r.get(e));let a=[];for(let[e,t]of r.entries())i.has(e)||a.push(t);for(let n of t.config.store.getSubjects(St,e,null))a.push(...Ht(n,t));return a}}function Ut(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`}function q(e,t,n){if(t===void 0)return n;if(n===void 0)return t;let r=e.indexOf(t.language);if(r<0)return n;let i=e.indexOf(n.language);return i<0||i>r?t:n}function Wt(e,t){let n;for(let r of t)n=q(e,n,r);return n?n.value:``}function Gt(e){let t=new Set;for(let n of e.getObjects(null,kt,vt))t.add(n.value);for(let n of e.getObjects(null,jt,vt))t.add(n.value);return t}function Kt(e,t){return e instanceof Set?[...t].filter(t=>!e.has(t)):[...t].filter(t=>!e.includes(t))}function qt(e,{remove:t=!1,ignoreErrors:n=!1}={}){let r={},i=n?(()=>!0):((e,t)=>{throw Error(`${e.value} ${t}`)}),a=e.getQuads(null,pt+`rest`,pt+`nil`,null),o=t?[...a]:[];return a.forEach(n=>{let a=[],s=!1,c,l,u=n.graph,d=n.subject;for(;d&&!s;){let t=e.getQuads(null,null,d,null),n=e.getQuads(d,null,null,null).filter(e=>!e.predicate.equals(bt)),r,f=null,p=null,m=null;for(let e=0;e<n.length&&!s;e++)r=n[e],r.graph.equals(u)?c?s=i(d,`has non-list arcs out`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`?f?s=i(d,`has multiple rdf:first arcs`):o.push(f=r):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?p?s=i(d,`has multiple rdf:rest arcs`):o.push(p=r):t.length?s=i(d,`can't be subject and object`):(c=r,l=`subject`):s=i(d,`not confined to single graph`);for(let e=0;e<t.length&&!s;++e)r=t[e],c?s=i(d,`can't have coreferences`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?m?s=i(d,`has incoming rdf:rest arcs`):m=r:(c=r,l=`object`);f?a.unshift(f.object):s=i(d,`has no list head`),d=m&&m.subject}s?t=!1:c&&(r[c[l].value]=a)}),t&&e.removeQuads(o),r}var Jt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.removeDotSegmentsOfPath=e.removeDotSegments=e.resolve=void 0;function t(e,t){t||=``;let i=t.indexOf(`#`);if(i>0&&(t=t.substr(0,i)),!e.length){if(t.indexOf(`:`)<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);return t}if(e.startsWith(`?`)){let n=t.indexOf(`?`);return n>0&&(t=t.substr(0,n)),t+e}if(e.startsWith(`#`))return t+e;if(!t.length){let t=e.indexOf(`:`);if(t<0)throw Error(`Found invalid relative IRI '${e}' for a missing baseIRI`);return r(e,t)}let a=e.indexOf(`:`);if(a>=0)return r(e,a);let o=t.indexOf(`:`);if(o<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);let s=t.substr(0,o+1);if(e.indexOf(`//`)===0)return s+r(e,a);let c;if(t.indexOf(`//`,o)===o+1){if(c=t.indexOf(`/`,o+3),c<0)return t.length>o+3?t+`/`+r(e,a):s+r(e,a)}else if(c=t.indexOf(`/`,o+1),c<0)return s+r(e,a);if(e.indexOf(`/`)===0)return t.substr(0,c)+n(e);let l=t.substr(c),u=l.lastIndexOf(`/`);return u>=0&&u<l.length-1&&(l=l.substr(0,u+1),e[0]===`.`&&e[1]!==`.`&&e[1]!==`/`&&e[2]&&(e=e.substr(1))),e=l+e,e=n(e),t.substr(0,c)+e}e.resolve=t;function n(e){let t=[],n=0;for(;n<e.length;)switch(e[n]){case`/`:if(e[n+1]===`.`)if(e[n+2]===`.`){if(!i(e[n+3])){t.push([]),n++;break}t.pop(),e[n+3]||t.push([]),n+=3}else{if(!i(e[n+2])){t.push([]),n++;break}e[n+2]||t.push([]),n+=2}else t.push([]),n++;break;case`#`:case`?`:t.length||t.push([]),t[t.length-1].push(e.substr(n)),n=e.length;break;default:t.length||t.push([]),t[t.length-1].push(e[n]),n++;break}return`/`+t.map(e=>e.join(``)).join(`/`)}e.removeDotSegments=n;function r(e,t){let r=t+1;t>=0?e[t+1]===`/`&&e[t+2]===`/`&&(r=t+3):e[0]===`/`&&e[1]===`/`&&(r=2);let i=e.indexOf(`/`,r);return i<0?e:e.substr(0,i)+n(e.substr(i))}e.removeDotSegmentsOfPath=r;function i(e){return!e||e===`#`||e===`?`||e===`/`}})),Yt=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(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(Jt(),e)})),Xt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`
|
|
17
|
+
\r --�𐀀-`,e.S=` \r
|
|
18
|
+
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),Zt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`--�𐀀-`,e.RESTRICTED_CHAR=`-\b\v\f---`,e.S=` \r
|
|
19
|
+
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),Qt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NC_NAME_CHAR=`-`+e.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.NC_NAME_START_CHAR_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`]$`,`u`),e.NC_NAME_CHAR_RE=RegExp(`^[`+e.NC_NAME_CHAR+`]$`,`u`),e.NC_NAME_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`][`+e.NC_NAME_CHAR+`]*$`,`u`);function t(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNCNameStartChar=t;function n(e){return t(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNCNameChar=n})),$t=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SaxesParser=e.EVENTS=void 0;var t=Xt(),n=Zt(),r=Qt(),i=t.isS,a=t.isChar,o=t.isNameStartChar,s=t.isNameChar,c=t.S_LIST,l=t.NAME_RE,u=n.isChar,d=r.isNCNameStartChar,f=r.isNCNameChar,p=r.NC_NAME_RE,m=`http://www.w3.org/XML/1998/namespace`,h=`http://www.w3.org/2000/xmlns/`,g={__proto__:null,xml:m,xmlns:h},_={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},v=-1,y=-2,b=0,x=1,S=2,C=3,w=4,T=5,E=6,D=7,O=8,k=9,A=10,j=11,M=12,N=13,P=14,F=15,I=16,R=17,z=18,B=19,V=20,ee=21,te=22,ne=23,re=24,ie=25,ae=26,oe=27,se=28,ce=29,le=30,ue=31,de=32,fe=33,pe=34,me=35,he=36,ge=37,_e=38,ve=39,ye=40,H=41,be=42,xe=43,Se=44,Ce=9,we=10,Te=13,Ee=32,De=33,Oe=34,ke=38,Ae=39,je=45,Me=47,Ne=59,Pe=60,Fe=61,Ie=62,Le=63,Re=91,ze=93,Be=133,Ve=8232,He=e=>e===Oe||e===Ae,Ue=[Oe,Ae],We=[...Ue,Re,Ie],Ge=[...Ue,Pe,ze],Ke=[Fe,Le,...c],U=[...c,Ie,ke,Pe];function qe(e,t,n){switch(t){case`xml`:n!==m&&e.fail(`xml prefix must be bound to ${m}.`);break;case`xmlns`:n!==h&&e.fail(`xmlns prefix must be bound to ${h}.`);break;default:}switch(n){case h:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI \
|
|
20
|
+
${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}break;default:}}function Je(e,t){for(let n of Object.keys(t))qe(e,n,t[n])}var Ye=e=>p.test(e),Xe=e=>l.test(e),Ze=0,Qe=1,$e=2;e.EVENTS=[`xmldecl`,`text`,`processinginstruction`,`doctype`,`comment`,`opentagstart`,`attribute`,`opentag`,`closetag`,`cdata`,`error`,`end`,`ready`];var et={xmldecl:`xmldeclHandler`,text:`textHandler`,processinginstruction:`piHandler`,doctype:`doctypeHandler`,comment:`commentHandler`,opentagstart:`openTagStartHandler`,attribute:`attributeHandler`,opentag:`openTagHandler`,closetag:`closeTagHandler`,cdata:`cdataHandler`,error:`errorHandler`,end:`endHandler`,ready:`readyHandler`};e.SaxesParser=class{get closed(){return this._closed}constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,t){this.nameStartCheck=d,this.nameCheck=f,this.isName=Ye,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},g);let e=this.opt.additionalNamespaces;e!=null&&(Je(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=o,this.nameCheck=s,this.isName=Xe,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var e;this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Ze,this.attribList=[];let{fragmentOpt:t}=this;this.state=t?N:b,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);n=`1.0`}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(_),(e=this.readyHandler)==null||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[et[e]]=t}off(e){this[et[e]]=void 0}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close; assign an onready handler.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===Te||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>=Ee||n===Ce)return n;switch(n){case we:return this.line++,this.column=0,this.positionAtNewLine=this.position,we;case Te:return e.charCodeAt(t+1)===we&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==Ve||n===Ce)return n;switch(n){case we:return this.line++,this.column=0,this.positionAtNewLine=this.position,we;case Te:{let n=e.charCodeAt(t+1);(n===we||n===Be)&&(this.i=t+2)}case Be:case Ve:return this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===y?we:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===y,a=i?we:r;if(a===v||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case y:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=we;break;case v:return this.text+=n.slice(t),!1;default:}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===v)return this.name+=e.slice(t),v;if(!s(n))return this.name+=e.slice(t,this.prevI),n===y?we:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===v||!i(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=a,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=x}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case Pe:if(this.state=F,this.text.length!==0)throw Error(`no-empty text at start`);break;case v:break;default:this.unget(),this.state=N,this.xmlDeclPossible=!1}}sDoctype(){var e;let t=this.captureTo(We);switch(t){case Ie:(e=this.doctypeHandler)==null||e.call(this,this.text),this.text=``,this.state=N,this.doctype=!0;break;case v:break;default:this.text+=String.fromCodePoint(t),t===Re?this.state=w:He(t)&&(this.state=C,this.q=t)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=S)}sDTD(){let e=this.captureTo(Ge);e!==v&&(this.text+=String.fromCodePoint(e),e===ze?this.state=S:e===Pe?this.state=E:He(e)&&(this.state=T,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=w,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case De:this.state=D,this.openWakaBang=``;break;case Le:this.state=j;break;default:this.state=w}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?O:w,this.openWakaBang=``)}sDTDComment(){this.captureToChar(je)&&(this.text+=`-`,this.state=k)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===je?A:O}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===Ie?this.state=w:(this.fail(`malformed comment.`),this.state=O)}sDTDPI(){this.captureToChar(Le)&&(this.text+=`?`,this.state=M)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===Ie&&(this.state=w)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;loop:for(;;)switch(this.getCode()){case y:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case Ne:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI);this.state=n;let i;r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),(n!==N||this.textHandler!==void 0)&&(this.text+=i);break loop}case v:this.entity+=t.slice(e);break loop;default:}}sOpenWaka(){let e=this.getCode();if(o(e))this.state=pe,this.unget(),this.xmlDeclPossible=!1;else switch(e){case Me:this.state=xe,this.xmlDeclPossible=!1;break;case De:this.state=I,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case Le:this.state=ne;break;default:this.fail(`disallowed character in tag name`),this.state=N,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case`[CDATA[`:!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0),this.state=V,this.openWakaBang=``;break;case`--`:this.state=R,this.openWakaBang=``;break;case`DOCTYPE`:this.state=S,(this.doctype||this.sawRoot)&&this.fail(`inappropriately located doctype declaration.`),this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&this.fail(`incorrect syntax.`)}}sComment(){this.captureToChar(je)&&(this.state=z)}sCommentEnding(){var e;let t=this.getCodeNorm();t===je?(this.state=B,(e=this.commentHandler)==null||e.call(this,this.text),this.text=``):(this.text+=`-${String.fromCodePoint(t)}`,this.state=R)}sCommentEnded(){let e=this.getCodeNorm();e===Ie?this.state=N:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=R)}sCData(){this.captureToChar(ze)&&(this.state=ee)}sCDataEnding(){let e=this.getCodeNorm();e===ze?this.state=te:(this.text+=`]${String.fromCodePoint(e)}`,this.state=V)}sCDataEnding2(){var e;let t=this.getCodeNorm();switch(t){case Ie:(e=this.cdataHandler)==null||e.call(this,this.text),this.text=``,this.state=N;break;case ze:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=V}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=re):e===Le||i(e)?(this.fail(`processing instruction without a target.`),this.state=e===Le?ae:ie):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=re)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===v){this.piTarget+=e.slice(t);return}if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===Le;r||i(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?fe:oe):this.state=r?ae:ie:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===Le?this.state=ae:i(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(Le)&&(this.state=ae)}sPIEnding(){var e;let t=this.getCodeNorm();if(t===Ie){let{piTarget:t}=this;t.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),(e=this.piHandler)==null||e.call(this,{target:t,body:this.text}),this.piTarget=this.text=``,this.state=N}else t===Le?this.text+=`?`:(this.text+=`?${String.fromCodePoint(t)}`,this.state=ie);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===Le){this.state=fe;return}e!==v&&(this.state=se,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(Ke);if(e===Le){this.state=fe,this.name+=this.text,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(i(e)||e===Fe){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===Fe?le:ce}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===Le){this.state=fe,this.fail(`XML declaration is incomplete.`);return}i(e)||(e!==Fe&&this.fail(`value required.`),this.state=le)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===Le){this.state=fe,this.fail(`XML declaration is incomplete.`);return}i(e)||(He(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=Ee),this.state=ue)}sXMLDeclValue(){let e=this.captureTo([this.q,Le]);if(e===Le){this.state=fe,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(e===v)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t;break;default:}this.name=``,this.state=de}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===Le){this.state=fe;return}i(e)||(this.fail(`whitespace required.`),this.unget()),this.state=oe}sXMLDeclEnding(){var e;this.getCodeNorm()===Ie?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),(e=this.xmldeclHandler)==null||e.call(this,this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=N):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){var e;let t=this.captureNameChars();if(t===v)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(e=this.openTagStartHandler)==null||e.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),t){case Ie:this.openTag();break;case Me:this.state=me;break;default:i(t)||this.fail(`disallowed character in tag name.`),this.state=he}}sOpenTagSlash(){this.getCode()===Ie?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=he)}sAttrib(){let e=this.skipSpaces();e!==v&&(o(e)?(this.unget(),this.state=ge):e===Ie?this.openTag():e===Me?this.state=me:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===Fe?this.state=ve:i(e)?this.state=_e:e===Ie?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==v&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case v:return;case Fe:this.state=ve;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===Ie?this.openTag():o(e)?(this.unget(),this.state=ge):(this.fail(`disallowed character in attribute name.`),this.state=he)}}sAttribValue(){let e=this.getCodeNorm();He(e)?(this.q=e,this.state=ye):i(e)||(this.fail(`unquoted attribute value.`),this.state=be,this.unget())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=H;return;case ke:this.text+=t.slice(n,this.prevI),this.state=P,this.entityReturnState=ye;return;case we:case y:case Ce:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case Pe:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case v:this.text+=t.slice(n);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();i(e)?this.state=he:e===Ie?this.openTag():e===Me?this.state=me:o(e)?(this.fail(`no whitespace between attributes.`),this.unget(),this.state=ge):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(U);switch(e){case ke:this.state=P,this.entityReturnState=be;break;case Pe:this.fail(`disallowed character.`);break;case v:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===Ie?this.openTag():this.state=he}}sCloseTag(){let e=this.captureNameChars();e===Ie?this.closeTag():i(e)?this.state=Se:e!==v&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case Ie:this.closeTag();break;case v:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;scanLoop:for(;;)switch(this.getCode()){case Pe:if(this.state=F,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=Ze;break scanLoop;case ke:this.state=P,this.entityReturnState=N,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=Ze;break scanLoop;case ze:switch(t){case Ze:t=Qe;break;case Qe:t=$e;break;case $e:break;default:throw Error(`impossible state`)}break;case Ie:t===$e&&this.fail(`the string "]]>" is disallowed in char data.`),t=Ze;break;case y:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=Ze;break;case v:r!==void 0&&(this.text+=n.slice(e));break scanLoop;default:t=Ze}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;outRootLoop:for(;;){let a=this.getCode();switch(a){case Pe:if(this.state=F,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break outRootLoop;case ke:this.state=P,this.entityReturnState=N,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break outRootLoop;case y:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case v:n!==void 0&&(this.text+=t.slice(e));break outRootLoop;default:i(a)||(r=!0)}}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){var n;let{prefix:r,local:i}=this.qname(e),a={name:e,prefix:r,local:i,value:t};if(this.attribList.push(a),(n=this.attributeHandler)==null||n.call(this,a),r===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[i]=e,qe(this,i,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,qe(this,``,e)}}pushAttribPlain(e,t){var n;let r={name:e,value:t};this.attribList.push(r),(n=this.attributeHandler)==null||n.call(this,r)}end(){var e,t;this.sawRoot||this.fail(`document must contain a root element.`);let{tags:n}=this;for(;n.length>0;){let e=n.pop();this.fail(`unclosed tag: ${e.name}`)}this.state!==b&&this.state!==N&&this.fail(`unexpected end.`);let{text:r}=this;return r.length!==0&&((e=this.textHandler)==null||e.call(this,r),this.text=``),this._closed=!0,(t=this.endHandler)==null||t.call(this),this._init(),this}resolve(e){var t;let n=this.topNS[e];if(n!==void 0)return n;let{tags:r}=this;for(let t=r.length-1;t>=0;t--)if(n=r[t].ns[e],n!==void 0)return n;return n=this.ns[e],n===void 0?(t=this.opt).resolvePrefix?.call(t,e):n}qname(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qname(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?h:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:t}=this,n=this.tag;n.isSelfClosing=!1,(e=this.openTagHandler)==null||e.call(this,n),t.push(n),this.state=N,this.name=``}openSelfClosingTag(){var e,t;this.processAttribs();let{tags:n}=this,r=this.tag;r.isSelfClosing=!0,(e=this.openTagHandler)==null||e.call(this,r),(t=this.closeTagHandler)==null||t.call(this,r),(this.tag=n[n.length-1]??null)===null&&(this.closedRoot=!0),this.state=N,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=N,this.name=``,t===``){this.fail(`weird empty close tag.`),this.text+=`</>`;return}let n=this.closeTagHandler,r=e.length;for(;r-- >0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}}})),en=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ParseError=void 0,e.ParseError=class extends Error{constructor(e,t){let n=e.saxParser;super(e.trackPosition?`Line ${n.line} column ${n.column+1}: ${t}`:t)}}})),tn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BlankNode=void 0,e.BlankNode=class{constructor(e){this.termType=`BlankNode`,this.value=e}equals(e){return!!e&&e.termType===`BlankNode`&&e.value===this.value}}})),nn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DefaultGraph=void 0;var t=class{constructor(){this.termType=`DefaultGraph`,this.value=``}equals(e){return!!e&&e.termType===`DefaultGraph`}};e.DefaultGraph=t,t.INSTANCE=new t})),rn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NamedNode=void 0,e.NamedNode=class{constructor(e){this.termType=`NamedNode`,this.value=e}equals(e){return!!e&&e.termType===`NamedNode`&&e.value===this.value}}})),an=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Literal=void 0;var t=rn(),n=class e{constructor(t,n){this.termType=`Literal`,this.value=t,typeof n==`string`?(this.language=n,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=``):n?`termType`in n?(this.language=``,this.datatype=n,this.direction=``):(this.language=n.language,this.datatype=n.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=n.direction||``):(this.language=``,this.datatype=e.XSD_STRING,this.direction=``)}equals(e){return!!e&&e.termType===`Literal`&&e.value===this.value&&e.language===this.language&&(e.direction===this.direction||!e.direction&&this.direction===``)&&this.datatype.equals(e.datatype)}};e.Literal=n,n.RDF_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),n.RDF_DIRECTIONAL_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),n.XSD_STRING=new t.NamedNode(`http://www.w3.org/2001/XMLSchema#string`)})),on=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Quad=void 0,e.Quad=class{constructor(e,t,n,r){this.termType=`Quad`,this.value=``,this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&(e.termType===`Quad`||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}})),sn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Variable=void 0,e.Variable=class{constructor(e){this.termType=`Variable`,this.value=e}equals(e){return!!e&&e.termType===`Variable`&&e.value===this.value}}})),cn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DataFactory=void 0;var t=tn(),n=nn(),r=an(),i=rn(),a=on(),o=sn(),s=0;e.DataFactory=class{constructor(e){this.blankNodeCounter=0,e||={},this.blankNodePrefix=e.blankNodePrefix||`df_${s++}_`}namedNode(e){return new i.NamedNode(e)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new r.Literal(e,t)}variable(e){return new o.Variable(e)}defaultGraph(){return n.DefaultGraph.INSTANCE}quad(e,t,n,r){return new a.Quad(e,t,n,r||this.defaultGraph())}fromTerm(e){switch(e.termType){case`NamedNode`:return this.namedNode(e.value);case`BlankNode`:return this.blankNode(e.value);case`Literal`:return e.language?this.literal(e.value,e.language):e.datatype.equals(r.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case`Variable`:return this.variable(e.value);case`DefaultGraph`:return this.defaultGraph();case`Quad`:return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}})),J=o((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(tn(),e),n(cn(),e),n(nn(),e),n(an(),e),n(rn(),e),n(on(),e),n(sn(),e)})),ln=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateIri=e.IriValidationStrategy=void 0;function t(){let e=`[!$&'()*+,;=]`,t=`%[a-fA-F0-9]{2}`,n=`([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,r=`${n}\\.${n}\\.${n}\\.${n}`,i=`[a-fA-F0-9]{1,4}`,a=`(${i}:${i}|${r})`,o=`\\[(${`((${i}:){6}${a}|::(${i}:){5}${a}|(${i})?::(${i}:){4}${a}|((${i}:){0,1}${i})?::(${i}:){3}${a}|((${i}:){0,2}${i})?::(${i}:){2}${a}|((${i}:){0,3}${i})?::${i}:${a}|((${i}:){0,4}${i})?::${a}|((${i}:){0,5}${i})?::${i}|((${i}:){0,6}${i})?::)`}|${`v[a-fA-F0-9]+\\.(${e}|${e}|":)+`})\\]`,s=`[a-zA-Z0-9\\-._~\xA0-豈-﷏ﷰ-𐀀-𠀀-𰀀------------]`,c=`(${s}|${t}|${e}|[:@])*`,l=`(${c}|[\\/?])*`,u=`(${c}|[---]|[\\/?])*`,d=`(${c})+`,f=`(${c})*`,p=`${d}(\\/${f})*`,m=`\\/(${d}(\\/${f})*)?`,h=`(\\/${f})*`,g=`(${o}|${r}|${`(${s}|${t}|${e})*`})`,_=`^[a-zA-Z][a-zA-Z0-9+\\-.]*:${`(\\/\\/${`(${`(${s}|${t}|${e}|:)*`}@)?${g}(:[0-9]*)?`}${h}|${m}|${p}|)`}(\\?${u})?(#${l})?$`;return new RegExp(_,`u`)}var n=t(),r=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u,i;(function(e){e.Strict=`strict`,e.Pragmatic=`pragmatic`,e.None=`none`})(i=e.IriValidationStrategy||={});function a(e,t=i.Strict){switch(t){case i.Strict:return n.test(e)?void 0:Error(`Invalid IRI according to RFC 3987: '${e}'`);case i.Pragmatic:return r.test(e)?void 0:Error(`Invalid IRI according to RDF Turtle: '${e}'`);case i.None:return;default:return Error(`Not supported validation strategy "${t}"`)}}e.validateIri=a})),un=o((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(ln(),e)})),dn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ParseType=e.RdfXmlParser=void 0;var t=Yt(),n=$t(),r=et(),i=en(),a=J(),o=un(),s=class e extends r.Transform{constructor(e){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},e&&(Object.assign(this,e),this.options=e),this.dataFactory||=new a.DataFactory,this.baseIRI||=``,this.defaultGraph||=this.dataFactory.defaultGraph(),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||=this.validateUri?o.IriValidationStrategy.Pragmatic:o.IriValidationStrategy.None,this.parseUnsupportedVersions=!!e?.parseUnsupportedVersions,this.version=e?.version,this.saxParser=new n.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){let n=new r.PassThrough({readableObjectMode:!0});t.on(`error`,e=>i.emit(`error`,e)),t.on(`data`,e=>n.push(e)),t.on(`end`,()=>n.push(null));let i=n.pipe(new e(this.options));return i}_transform(e,t,n){if(this.version){let e=this.version;if(this.version=void 0,!this.isValidVersion(e))return n(this.newParseError(`Detected unsupported version as media type parameter: ${e}`))}try{this.saxParser.write(e)}catch(e){return n(e)}n()}newParseError(e){return new i.ParseError(this,e)}valueToUri(e,n){return this.uriToNamedNode((0,t.resolve)(e,n.baseIRI))}uriToNamedNode(e){let t=(0,o.validateIri)(e,this.iriValidationStrategy);if(t instanceof Error)throw this.newParseError(t.message);return this.dataFactory.namedNode(e)}validateNcname(t){if(!e.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}createLiteral(e,t){return this.dataFactory.literal(e,t.datatype?t.datatype:t.language?{language:t.language,direction:t.rdfVersion?t.direction:void 0}:void 0)}isValidVersion(t){return this.parseUnsupportedVersions||e.SUPPORTED_VERSIONS.includes(t)}attachSaxListeners(){this.saxParser.on(`error`,e=>this.emit(`error`,e)),this.saxParser.on(`opentag`,this.onTag.bind(this)),this.saxParser.on(`text`,this.onText.bind(this)),this.saxParser.on(`cdata`,this.onText.bind(this)),this.saxParser.on(`closetag`,this.onCloseTag.bind(this)),this.saxParser.on(`doctype`,this.onDoctype.bind(this))}onTag(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null,n=c.RESOURCE;if(t&&(t.hadChildren=!0,n=t.childrenParseType),t&&t.childrenStringTags){let n=e.name,r=``;for(let{key:e,value:n}of t.namespaces||[])r+=` ${e}="${n}"`;for(let t in e.attributes)r+=` ${t}="${e.attributes[t].value}"`;let i=`<${`${n}${r}`}>`;t.childrenStringTags.push(i);let a={childrenStringTags:t.childrenStringTags};a.childrenStringEmitClosingTag=`</${n}>`,this.activeTagStack.push(a);return}let r={};t?(r.language=t.language,r.direction=t.direction,r.baseIRI=t.baseIRI,r.childrenTripleTerms=t.childrenTripleTerms,r.rdfVersion=t.rdfVersion):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),n===c.RESOURCE?this.onTagResource(e,r,t,!t):this.onTagProperty(e,r,t);for(let t in e.attributes){let n=e.attributes[t];n.prefix===`xmlns`&&(r.namespaces||=[],r.namespaces.push({key:`${n.prefix}:${n.local}`,value:n.value}))}t&&t.namespaces&&(r.namespaces=[...r.namespaces||[],...t.namespaces])}onTagResource(n,r,i,a){r.childrenParseType=c.PROPERTY;let o=!0;if(n.uri===e.RDF){if(!a&&e.FORBIDDEN_NODE_ELEMENTS.indexOf(n.local)>=0)throw this.newParseError(`Illegal node element name: ${n.local}`);switch(n.local){case`RDF`:r.childrenParseType=c.RESOURCE;case`Description`:o=!1}}let s=[],l=[],u=null,d=!1,f=!1,p=null;for(let a in n.attributes){let o=n.attributes[a];if(o.uri===e.RDF&&o.local===`version`){this.setVersion(r,o.value);continue}else if(i&&o.uri===e.RDF)switch(o.local){case`about`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
|
|
21
|
+
while ${o.value} and ${u} where found.`);u=o.value;continue;case`ID`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
|
|
22
|
+
while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=`#`+o.value,d=!0;continue;case`nodeID`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
|
|
23
|
+
while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=o.value,f=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`type`:p=o.value;continue;case`aboutEach`:throw this.newParseError(`rdf:aboutEach is not supported.`);case`aboutEachPrefix`:throw this.newParseError(`rdf:aboutEachPrefix is not supported.`);case`li`:throw this.newParseError(`rdf:li on node elements are not supported.`)}else if(o.uri===e.XML){if(o.local===`lang`){r.language=o.value===``?null:o.value.toLowerCase();continue}else if(o.local===`base`){r.baseIRI=(0,t.resolve)(o.value,r.baseIRI);continue}}else if(o.uri===e.ITS&&o.local===`dir`){this.setDirection(r,o.value);continue}o.prefix!==`xml`&&o.prefix!==`xmlns`&&(o.prefix!==``||o.local!==`xmlns`)&&o.uri&&(s.push(this.uriToNamedNode(o.uri+o.local)),l.push(o.value))}if(u!==null&&(r.subject=f?this.dataFactory.blankNode(u):this.valueToUri(u,r),d&&this.claimNodeId(r.subject)),r.subject||=this.dataFactory.blankNode(),o){let t=this.uriToNamedNode(n.uri+n.local);this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),t,i?i.reifiedStatementId:null,r.childrenTripleTerms,r.reifier)}if(i){if(i.predicate)if(i.childrenCollectionSubject){let t=this.dataFactory.blankNode(),n=this.dataFactory.namedNode(e.RDF+`rest`),a=i.childrenCollectionPredicate.equals(n);this.emitTriple(i.childrenCollectionSubject,i.childrenCollectionPredicate,t,a?null:i.reifiedStatementId,i.childrenTripleTerms,a?null:i.reifier),this.emitTriple(t,this.dataFactory.namedNode(e.RDF+`first`),r.subject,null,r.childrenTripleTerms),i.childrenCollectionSubject=t,i.childrenCollectionPredicate=n}else{i.childrenTagsToTripleTerms||(this.emitTriple(i.subject,i.predicate,r.subject,i.reifiedStatementId,i.childrenTripleTerms,i.reifier),i.predicateEmitted=!0);for(let e=0;e<i.predicateSubPredicates.length;e++)this.emitTriple(r.subject,i.predicateSubPredicates[e],i.predicateSubObjects[e],null,i.childrenTripleTerms,i.reifier);i.predicateSubPredicates=[],i.predicateSubObjects=[]}for(let e=0;e<s.length;e++){let t=this.createLiteral(l[e],r);this.emitTriple(r.subject,s[e],t,i.reifiedStatementId,i.childrenTripleTerms,i.reifier)}p&&this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),this.uriToNamedNode(p),null,r.childrenTripleTerms,r.reifier)}}onTagProperty(t,n,r){if(n.childrenParseType=c.RESOURCE,n.subject=r.subject,t.uri===e.RDF&&t.local===`li`?(r.listItemCounter||=1,n.predicate=this.uriToNamedNode(t.uri+`_`+ r.listItemCounter++)):n.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===e.RDF&&e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);n.predicateSubPredicates=[],n.predicateSubObjects=[];let i=!1,a=!1,o=null,s=!0,l=[],u=[];for(let r in t.attributes){let d=t.attributes[r];if(d.uri===e.RDF&&d.local===`version`){this.setVersion(n,d.value);continue}else if(d.uri===e.RDF)switch(d.local){case`resource`:if(o)throw this.newParseError(`Found both rdf:resource (${d.value}) and rdf:nodeID (${o}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${d.value})`);n.hadChildren=!0,o=d.value,s=!1;continue;case`datatype`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${d.value})`);n.datatype=this.valueToUri(d.value,n);continue;case`nodeID`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${d.value}).`);if(n.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${d.value})`);this.validateNcname(d.value),n.hadChildren=!0,o=d.value,s=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`parseType`:if(a)throw this.newParseError(`rdf:parseType is not allowed when non-rdf:* property attributes are present`);if(n.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${n.datatype.value})`);if(o)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${o})`);if(d.value===`Resource`){i=!0,n.childrenParseType=c.PROPERTY;let e=this.dataFactory.blankNode();this.emitTriple(n.subject,n.predicate,e,n.reifiedStatementId,n.childrenTripleTerms,n.reifier),n.subject=e,n.predicate=null}else d.value===`Collection`?(i=!0,n.hadChildren=!0,n.childrenCollectionSubject=n.subject,n.childrenCollectionPredicate=n.predicate,s=!1):d.value===`Literal`?(i=!0,n.childrenTagsToString=!0,n.childrenStringTags=[]):d.value===`Triple`&&(i=!0,n.childrenTagsToTripleTerms=!0,n.childrenTripleTerms=[]);continue;case`ID`:this.validateNcname(d.value),n.reifiedStatementId=this.valueToUri(`#`+d.value,n),this.claimNodeId(n.reifiedStatementId);continue;case`annotation`:n.reifier=this.dataFactory.namedNode(d.value);continue;case`annotationNodeID`:n.reifier=this.dataFactory.blankNode(d.value);continue}else if(d.uri===e.XML&&d.local===`lang`){n.language=d.value===``?null:d.value.toLowerCase();continue}else if(d.uri===e.ITS&&d.local===`dir`){this.setDirection(n,d.value);continue}else if(d.uri===e.ITS&&d.local===`version`)continue;if(d.prefix!==`xml`&&d.prefix!==`xmlns`&&(d.prefix!==``||d.local!==`xmlns`)&&d.uri){if(i||n.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${d.value}`);n.hadChildren=!0,a=!0,l.push(this.uriToNamedNode(d.uri+d.local)),u.push(this.createLiteral(d.value,n))}}if(o!==null){let e=n.subject;n.subject=s?this.dataFactory.blankNode(o):this.valueToUri(o,n),this.emitTriple(e,n.predicate,n.subject,n.reifiedStatementId,n.childrenTripleTerms,n.reifier);for(let e=0;e<l.length;e++)this.emitTriple(n.subject,l[e],u[e],null,n.childrenTripleTerms,n.reifier);n.predicateEmitted=!0}else s&&(n.predicateSubPredicates=l,n.predicateSubObjects=u,n.predicateEmitted=!1)}emitTriple(t,n,r,i,a,o){let s=this.dataFactory.quad(t,n,r,this.defaultGraph);a?a.push(s):this.push(s),o&&this.push(this.dataFactory.quad(o,this.dataFactory.namedNode(e.RDF+`reifies`),s)),i&&(this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`type`),this.dataFactory.namedNode(e.RDF+`Statement`),this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`subject`),t,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`predicate`),n,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`object`),r,this.defaultGraph)))}claimNodeId(e){if(!this.allowDuplicateRdfIds){if(this.nodeIds[e.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${e.value}'.`);this.nodeIds[e.value]=!0}}onText(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;t&&(t.childrenStringTags?t.childrenStringTags.push(e):t.predicate&&(t.text=e))}onCloseTag(){let t=this.activeTagStack.pop(),n=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(e.RDF+`XMLLiteral`),t.text=t.childrenStringTags.join(``),t.hadChildren=!1),t.childrenTagsToTripleTerms&&t.predicate&&t.rdfVersion){if(t.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${t.childrenTripleTerms.length}`);for(let e of t.childrenTripleTerms)this.emitTriple(t.subject,t.predicate,e,null,n.childrenTripleTerms,n.reifier);t.predicateEmitted=!0}if(t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(e.RDF+`nil`),null,t.childrenTripleTerms);else if(t.predicate){if(!t.hadChildren&&t.childrenParseType!==c.PROPERTY)this.emitTriple(t.subject,t.predicate,this.createLiteral(t.text||``,t),t.reifiedStatementId,t.childrenTripleTerms,t.reifier);else if(!t.predicateEmitted){let e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId,t.childrenTripleTerms,t.reifier);for(let n=0;n<t.predicateSubPredicates.length;n++)this.emitTriple(e,t.predicateSubPredicates[n],t.predicateSubObjects[n],null,t.childrenTripleTerms)}}}onDoctype(e){e.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(e,t,n)=>(this.saxParser.ENTITIES[t]=n,``))}setDirection(e,t){if(t){if(t!==`ltr`&&t!==`rtl`)throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${t}' was found.`);e.direction=t}else delete e.direction}setVersion(e,t){if(e.rdfVersion=t,this.emit(`version`,t),!this.isValidVersion(t))throw this.newParseError(`Detected unsupported version: ${t}`)}};e.RdfXmlParser=s,s.MIME_TYPE=`application/rdf+xml`,s.RDF=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,s.XML=`http://www.w3.org/XML/1998/namespace`,s.ITS=`http://www.w3.org/2005/11/its`,s.FORBIDDEN_NODE_ELEMENTS=[`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`li`,`aboutEach`,`aboutEachPrefix`],s.FORBIDDEN_PROPERTY_ELEMENTS=[`Description`,`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`aboutEach`,`aboutEachPrefix`],s.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,s.SUPPORTED_VERSIONS=[`1.2`,`1.2-basic`,`1.1`];var c;(function(e){e[e.RESOURCE=0]=`RESOURCE`,e[e.PROPERTY=1]=`PROPERTY`})(c||(e.ParseType=c={}))})),fn=o((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(dn(),e)})),pn=o(((e,t)=>{t.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){let{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){let t=e&&this._existing.get(e);if(t)return t;let n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}})),mn=o((()=>{(function(e,t){if(e.setImmediate)return;var n=1,r={},i=!1,a=e.document,o;function s(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];return r[n]={callback:e,args:t},o(n),n++}function c(e){delete r[e]}function l(e){var n=e.callback,r=e.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(t,r);break}}function u(e){if(i)setTimeout(u,0,e);else{var t=r[e];if(t){i=!0;try{l(t)}finally{c(e),i=!1}}}}function d(){o=function(e){process.nextTick(function(){u(e)})}}function f(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}function p(){var t=`setImmediate$`+Math.random()+`$`,n=function(n){n.source===e&&typeof n.data==`string`&&n.data.indexOf(t)===0&&u(+n.data.slice(t.length))};e.addEventListener?e.addEventListener(`message`,n,!1):e.attachEvent(`onmessage`,n),o=function(n){e.postMessage(t+n,`*`)}}function m(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;u(t)},o=function(t){e.port2.postMessage(t)}}function h(){var e=a.documentElement;o=function(t){var n=a.createElement(`script`);n.onreadystatechange=function(){u(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function g(){o=function(e){setTimeout(u,0,e)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(e);_=_&&_.setTimeout?_:e,{}.toString.call(e.process)===`[object process]`?d():f()?p():e.MessageChannel?m():a&&`onreadystatechange`in a.createElement(`script`)?h():g(),_.setImmediate=s,_.clearImmediate=c})(typeof self>`u`?typeof global>`u`?void 0:global:self)})),hn=o((e=>{mn(),e.setImmediate=setImmediate,e.crypto=globalThis.crypto;var t=[];for(let e=0;e<=255;++e)t.push(e.toString(16).padStart(2,`0`));e.bufferToHex=function(e){let n=``,r=new Uint8Array(e);for(let e=0;e<r.length;++e)n+=t[r[e]];return n}})),gn=o(((e,t)=>{var{bufferToHex:n,crypto:r}=hn(),i=new Map([[`sha256`,`SHA-256`],[`SHA256`,`SHA-256`],[`SHA-256`,`SHA-256`],[`sha384`,`SHA-384`],[`SHA384`,`SHA-384`],[`SHA-384`,`SHA-384`],[`sha512`,`SHA-512`],[`SHA512`,`SHA-512`],[`SHA-512`,`SHA-512`]]);t.exports=class{constructor(e){if(!(r&&r.subtle))throw Error(`crypto.subtle not found.`);if(!i.has(e))throw Error(`Unsupported algorithm "${e}".`);this.algorithm=i.get(e),this._content=``}update(e){this._content+=e}async digest(){let e=new TextEncoder().encode(this._content);return n(await r.subtle.digest(this.algorithm,e))}}})),_n=o(((e,t)=>{t.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){let{current:e,dir:t}=this,n=e.slice(),r=null,i=0,a=e.length;for(let n=0;n<a;++n){let o=e[n],s=t.get(o);(r===null||o>r)&&(s&&n>0&&o>e[n-1]||!s&&n<a-1&&o>e[n+1])&&(r=o,i=n)}if(r===null)this.done=!0;else{let n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(let n of e)n>r&&t.set(n,!t.get(n))}return n}}})),vn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,r=`http://www.w3.org/2001/XMLSchema#string`,i=`NamedNode`,a=`BlankNode`,o=`Literal`,s=`DefaultGraph`,c={};(()=>{let e=`A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_`;e+``,``+e;let t='(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)';``+t;let n=`[ \\t]*`;``+t,t+``,``+t,``+t,c.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,c.empty=RegExp(`^`+n+`$`),c.quad=RegExp(`^`+n+'(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)[ \\t]+(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$')})(),t.exports=class e{static parse(e){let t=[],u={},d=e.split(c.eoln),f=0;for(let e of d){if(f++,c.empty.test(e))continue;let d=e.match(c.quad);if(d===null)throw Error(`N-Quads parse error on line `+f+`.`);let p={subject:null,predicate:null,object:null,graph:null};if(d[1]===void 0?p.subject={termType:a,value:d[2]}:p.subject={termType:i,value:y(d[1])},p.predicate={termType:i,value:y(d[3])},d[4]===void 0?d[5]===void 0?(p.object={termType:o,value:void 0,datatype:{termType:i}},d[7]===void 0?d[8]===void 0?p.object.datatype.value=r:(p.object.datatype.value=n,p.object.language=d[8]):p.object.datatype.value=y(d[7]),p.object.value=m(d[6])):p.object={termType:a,value:d[5]}:p.object={termType:i,value:y(d[4])},d[9]===void 0?d[10]===void 0?p.graph={termType:s,value:``}:p.graph={termType:a,value:d[10]}:p.graph={termType:i,value:y(d[9])},!(p.graph.value in u))u[p.graph.value]=[p],t.push(p);else{let e=!0,n=u[p.graph.value];for(let t of n)if(l(t,p)){e=!1;break}e&&(n.push(p),t.push(p))}}return t}static serialize(t){let n=[];for(let r of t)n.push(e.serializeQuad(r));return n.sort().join(``)}static serializeQuadComponents(e,t,o,s){let c=``;return e.termType===i?c+=`<${_(e.value)}>`:c+=`_:${e.value}`,t.termType===i?c+=` <${_(t.value)}> `:c+=` _:${t.value} `,o.termType===i?c+=`<${_(o.value)}>`:o.termType===a?c+=`_:${o.value}`:(c+=`"${f(o.value)}"`,o.datatype.value===n?o.language&&(c+=`@${o.language}`):o.datatype.value!==r&&(c+=`^^<${_(o.datatype.value)}>`)),s.termType===i?c+=` <${_(s.value)}>`:s.termType===a&&(c+=` _:${s.value}`),c+=` .
|
|
24
|
+
`,c}static serializeQuad(t){return e.serializeQuadComponents(t.subject,t.predicate,t.object,t.graph)}};function l(e,t){return!(e.subject.termType===t.subject.termType&&e.object.termType===t.object.termType)||!(e.subject.value===t.subject.value&&e.predicate.value===t.predicate.value&&e.object.value===t.object.value)?!1:e.object.termType===o?e.object.datatype.termType===t.object.datatype.termType&&e.object.language===t.object.language&&e.object.datatype.value===t.object.datatype.value:!0}var u=/[\u0000-\u001F\u007F"\\]/g,d=[];for(let e=0;e<=127;++e)u.test(String.fromCharCode(e))&&(d[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),u.lastIndex=0);d[`\b`.codePointAt(0)]=`\\b`,d[` `.codePointAt(0)]=`\\t`,d[`
|
|
25
|
+
`.codePointAt(0)]=`\\n`,d[`\f`.codePointAt(0)]=`\\f`,d[`\r`.codePointAt(0)]=`\\r`,d[`"`.codePointAt(0)]=`\\"`,d[`\\`.codePointAt(0)]=`\\\\`;function f(e){return u.test(e)?e.replace(u,function(e){return d[e.codePointAt(0)]}):e}var p=/(?:\\([btnfr"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function m(e){return p.test(e)?e.replace(p,function(e,t,n,r){if(t)switch(t){case`b`:return`\b`;case`t`:return` `;case`n`:return`
|
|
26
|
+
`;case`f`:return`\f`;case`r`:return`\r`;case`"`:return`"`;case`'`:return`'`;case`\\`:return`\\`}if(n)return String.fromCharCode(parseInt(n,16));if(r)return String.fromCodePoint(parseInt(r,16))}):e}var h=/[\u0000-\u0020<>"{}|^`\\]/g,g=[];for(let e=0;e<=127;++e)h.test(String.fromCharCode(e))&&(g[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),h.lastIndex=0);function _(e){return h.test(e)?e.replace(h,function(e){return g[e.codePointAt(0)]}):e}var v=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function y(e){return v.test(e)?e.replace(v,function(e,t,n){if(t)return String.fromCharCode(parseInt(t,16));if(n)return String.fromCodePoint(parseInt(n,16))}):e}})),yn=o(((e,t)=>{var n=pn(),r=gn(),i=_n(),a=vn(),{setImmediate:o}=hn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,signal:s=null}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.signal=s,this.quads=null}async main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()],i=0;for(let e of r)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let o=[...t.keys()].sort(),c=[];for(let e of o){let n=t.get(e);if(n.length>1){c.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}this.maxDeepIterations<0&&(this.maxWorkFactor===0?this.maxDeepIterations=0:this.maxWorkFactor===1/0?this.maxDeepIterations=1/0:this.maxDeepIterations=c.reduce((e,t)=>e+t.length,0)**this.maxWorkFactor),this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of c){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=await this.hashNDegreeQuads(r,e);t.push(i)}t.sort(s);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let l=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));l.push(t)}return l.sort(),l.join(``)}async hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}async hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=await this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0){if(this.signal&&this.signal.aborted)throw Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=await this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads,i=0;for(let a of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:`g`,id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}async _yield(){return new Promise(e=>o(e))}};function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}})),bn=o(((e,t)=>{var n=pn(),r=gn(),i=_n(),a=vn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,timeout:s=0}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.timeout=s,s>0&&(this.startTime=Date.now()),this.quads=null}main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()];for(let e of r)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let i=[...t.keys()].sort(),s=[];for(let e of i){let n=t.get(e);if(n.length>1){s.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}this.maxDeepIterations<0&&(this.maxWorkFactor===0?this.maxDeepIterations=0:this.maxWorkFactor===1/0?this.maxDeepIterations=1/0:this.maxDeepIterations=s.reduce((e,t)=>e+t.length,0)**this.maxWorkFactor),this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of s){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=this.hashNDegreeQuads(r,e);t.push(i)}t.sort(o);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let c=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join(``)}hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw Error(`Canonize timeout.`);let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads;for(let i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:`g`,id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}};function o(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}})),xn=o((e=>{var t=yn(),n=bn();function r(t,n){if(n.inputFormat){if(n.inputFormat===`application/n-quads`){if(typeof t!=`string`)throw Error(`N-Quads input must be a string.`);return e.NQuads.parse(t)}throw Error(`Unknown canonicalization input format: "${n.inputFormat}".`)}return t}function i(e){if(e.format&&e.format!==`application/n-quads`)throw Error(`Unknown canonicalization output format: "${e.format}".`)}function a(){globalThis.RDF_CANONIZE_TRACE_URDNA2015&&console.trace(`[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0`)}e.NQuads=vn(),e.IdentifierIssuer=pn(),e.canonize=async function(e,n={}){let o=r(e,n);if(i(n),!(`algorithm`in n))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(n.algorithm===`RDFC-1.0`)return new t(n).main(o);if(n.algorithm===`URDNA2015`&&!n.rejectURDNA2015)return a(),new t(n).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+n.algorithm)},e._canonizeSync=function(e,t={}){let o=r(e,t);if(i(t),!(`algorithm`in t))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(t.algorithm===`RDFC-1.0`)return new n(t).main(o);if(t.algorithm===`URDNA2015`&&!t.rejectURDNA2015)return a(),new n(t).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+t.algorithm)}})),Sn=o(((e,t)=>{t.exports=xn()})),Cn=o(((e,t)=>{var n={};t.exports=n,n.isArray=Array.isArray,n.isBoolean=e=>typeof e==`boolean`||Object.prototype.toString.call(e)===`[object Boolean]`,n.isDouble=e=>n.isNumber(e)&&(String(e).indexOf(`.`)!==-1||Math.abs(e)>=1e21),n.isEmptyObject=e=>n.isObject(e)&&Object.keys(e).length===0,n.isNumber=e=>typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`,n.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),n.isObject=e=>Object.prototype.toString.call(e)===`[object Object]`,n.isString=e=>typeof e==`string`||Object.prototype.toString.call(e)===`[object String]`,n.isUndefined=e=>e===void 0})),wn=o(((e,t)=>{var n=Cn(),r={};t.exports=r,r.isSubject=e=>n.isObject(e)&&!(`@value`in e||`@set`in e||`@list`in e)?Object.keys(e).length>1||!(`@id`in e):!1,r.isSubjectReference=e=>n.isObject(e)&&Object.keys(e).length===1&&`@id`in e,r.isValue=e=>n.isObject(e)&&`@value`in e,r.isList=e=>n.isObject(e)&&`@list`in e,r.isGraph=e=>n.isObject(e)&&`@graph`in e&&Object.keys(e).filter(e=>e!==`@id`&&e!==`@index`).length===1,r.isSimpleGraph=e=>r.isGraph(e)&&!(`@id`in e),r.isBlankNode=e=>{if(n.isObject(e)){if(`@id`in e){let t=e[`@id`];return!n.isString(t)||t.indexOf(`_:`)===0}return Object.keys(e).length===0||!(`@value`in e||`@set`in e||`@list`in e)}return!1}})),Tn=o(((e,t)=>{t.exports=class extends Error{constructor(e=`An unspecified JSON-LD error occurred.`,t=`jsonld.Error`,n={}){super(e),this.name=t,this.message=e,this.details=n}}})),En=o(((e,t)=>{var n=wn(),r=Cn(),i=Sn().IdentifierIssuer,a=Tn(),o=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,c=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,l=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,d={headers:{accept:`application/ld+json, application/json`}},f={};t.exports=f,f.IdentifierIssuer=i,f.REGEX_BCP47=o,f.REGEX_KEYWORD=u,f.clone=function(e){if(e&&typeof e==`object`){let t;if(r.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=f.clone(e[n])}else if(e instanceof Map){t=new Map;for(let[n,r]of e)t.set(n,f.clone(r))}else if(e instanceof Set){t=new Set;for(let n of e)t.add(f.clone(n))}else if(r.isObject(e)){t={};for(let n in e)t[n]=f.clone(e[n])}else t=e.toString();return t}return e},f.asArray=function(e){return Array.isArray(e)?e:[e]},f.buildHeaders=(e={})=>{if(Object.keys(e).some(e=>e.toLowerCase()===`accept`))throw RangeError(`Accept header may not be specified; only "`+d.headers.accept+`" is supported.`);return Object.assign({Accept:d.headers.accept},e)},f.parseLinkHeader=e=>{let t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(c);if(!r)continue;let i={target:r[1]},a=r[2];for(;r=l.exec(a);)i[r[1]]=r[2]===void 0?r[3]:r[2];let o=i.rel||``;Array.isArray(t[o])?t[o].push(i):t.hasOwnProperty(o)?t[o]=[t[o],i]:t[o]=i}return t},f.validateTypeValue=(e,t)=>{if(!r.isString(e)&&!(r.isArray(e)&&e.every(e=>r.isString(e)))){if(t&&r.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if(`@default`in e&&f.asArray(e[`@default`]).every(e=>r.isString(e)))return}throw new a(`Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.`,`jsonld.SyntaxError`,{code:`invalid type value`,value:e})}},f.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){let n=e[t];return!r.isArray(n)||n.length>0}return!1},f.hasValue=(e,t,i)=>{if(f.hasProperty(e,t)){let a=e[t],o=n.isList(a);if(r.isArray(a)||o){o&&(a=a[`@list`]);for(let e=0;e<a.length;++e)if(f.compareValues(i,a[e]))return!0}else if(!r.isArray(i))return f.compareValues(i,a)}return!1},f.addValue=(e,t,n,i)=>{if(i||={},`propertyIsArray`in i||(i.propertyIsArray=!1),`valueIsArray`in i||(i.valueIsArray=!1),`allowDuplicate`in i||(i.allowDuplicate=!0),`prependValue`in i||(i.prependValue=!1),i.valueIsArray)e[t]=n;else if(r.isArray(n)){n.length===0&&i.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),i.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let r=0;r<n.length;++r)f.addValue(e,t,n[r],i)}else if(e.hasOwnProperty(t)){let a=!i.allowDuplicate&&f.hasValue(e,t,n);!r.isArray(e[t])&&(!a||i.propertyIsArray)&&(e[t]=[e[t]]),a||(i.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=i.propertyIsArray?[n]:n},f.getValues=(e,t)=>[].concat(e[t]||[]),f.removeProperty=(e,t)=>{delete e[t]},f.removeValue=(e,t,n,r)=>{r||={},`propertyIsArray`in r||(r.propertyIsArray=!1);let i=f.getValues(e,t).filter(e=>!f.compareValues(e,n));i.length===0?f.removeProperty(e,t):i.length===1&&!r.propertyIsArray?e[t]=i[0]:e[t]=i},f.relabelBlankNodes=(e,t)=>(t||={},p(t.issuer||new i(`_:b`),e)),f.compareValues=(e,t)=>e===t||n.isValue(e)&&n.isValue(t)&&e[`@value`]===t[`@value`]&&e[`@type`]===t[`@type`]&&e[`@language`]===t[`@language`]&&e[`@index`]===t[`@index`]?!0:r.isObject(e)&&`@id`in e&&r.isObject(t)&&`@id`in t?e[`@id`]===t[`@id`]:!1,f.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1;function p(e,t){if(r.isArray(t))for(let n=0;n<t.length;++n)t[n]=p(e,t[n]);else if(n.isList(t))t[`@list`]=p(e,t[`@list`]);else if(r.isObject(t)){n.isBlankNode(t)&&(t[`@id`]=e.getId(t[`@id`]));let r=Object.keys(t).sort();for(let n=0;n<r.length;++n){let i=r[n];i!==`@id`&&(t[i]=p(e,t[i]))}}return t}})),Dn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,r=`http://www.w3.org/2001/XMLSchema#`;t.exports={LINK_HEADER_REL:`http://www.w3.org/ns/json-ld#context`,LINK_HEADER_CONTEXT:`http://www.w3.org/ns/json-ld#context`,RDF:n,RDF_LIST:n+`List`,RDF_FIRST:n+`first`,RDF_REST:n+`rest`,RDF_NIL:n+`nil`,RDF_TYPE:n+`type`,RDF_PLAIN_LITERAL:n+`PlainLiteral`,RDF_XML_LITERAL:n+`XMLLiteral`,RDF_JSON_LITERAL:n+`JSON`,RDF_OBJECT:n+`object`,RDF_LANGSTRING:n+`langString`,XSD:r,XSD_BOOLEAN:r+`boolean`,XSD_DOUBLE:r+`double`,XSD_INTEGER:r+`integer`,XSD_STRING:r+`string`}})),On=o(((e,t)=>{t.exports=class{constructor(){this._requests={}}wrapLoader(e){let t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}})),kn=o(((e,t)=>{var n=Cn(),r={};t.exports=r,r.parsers={simple:{keys:[`href`,`scheme`,`authority`,`path`,`query`,`fragment`],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:[`href`,`protocol`,`scheme`,`authority`,`auth`,`user`,`password`,`hostname`,`port`,`path`,`directory`,`file`,`query`,`fragment`],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(e,t)=>{let n={},i=r.parsers[t||`full`],a=i.regex.exec(e),o=i.keys.length;for(;o--;)n[i.keys[o]]=a[o]===void 0?null:a[o];return(n.scheme===`https`&&n.port===`443`||n.scheme===`http`&&n.port===`80`)&&(n.href=n.href.replace(`:`+n.port,``),n.authority=n.authority.replace(`:`+n.port,``),n.port=null),n.normalizedPath=r.removeDotSegments(n.path),n},r.prependBase=(e,t)=>{if(e===null||r.isAbsolute(t))return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=r.parse(t),a={protocol:e.protocol||``};if(i.authority!==null)a.authority=i.authority,a.path=i.path,a.query=i.query;else if(a.authority=e.authority,i.path===``)a.path=e.path,i.query===null?a.query=e.query:a.query=i.query;else{if(i.path.indexOf(`/`)===0)a.path=i.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf(`/`)+1),(t.length>0||e.authority)&&t.substr(-1)!==`/`&&(t+=`/`),t+=i.path,a.path=t}a.query=i.query}i.path!==``&&(a.path=r.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+=`//`+a.authority),o+=a.path,a.query!==null&&(o+=`?`+a.query),i.fragment!==null&&(o+=`#`+i.fragment),o===``&&(o=`./`),o},r.removeBase=(e,t)=>{if(e===null)return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=``;if(e.href===``?t.indexOf(`//`)&&(i+=`//`):i+=(e.protocol||``)+`//`+(e.authority||``),t.indexOf(i)!==0)return t;let a=r.parse(t.substr(i.length)),o=e.normalizedPath.split(`/`),s=a.normalizedPath.split(`/`),c=a.fragment||a.query?0:1;for(;o.length>0&&s.length>c&&o[0]===s[0];)o.shift(),s.shift();let l=``;if(o.length>0){o.pop();for(let e=0;e<o.length;++e)l+=`../`}return l+=s.join(`/`),a.query!==null&&(l+=`?`+a.query),a.fragment!==null&&(l+=`#`+a.fragment),l===``&&(l=`./`),l},r.removeDotSegments=e=>{if(e.length===0)return``;let t=e.split(`/`),n=[];for(;t.length>0;){let e=t.shift(),r=t.length===0;if(e===`.`){r&&n.push(``);continue}if(e===`..`){n.pop(),r&&n.push(``);continue}n.push(e)}return e[0]===`/`&&n.length>0&&n[0]!==``&&n.unshift(``),n.length===1&&n[0]===``?`/`:n.join(`/`)};var i=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=e=>n.isString(e)&&i.test(e),r.isRelative=e=>n.isString(e)})),An=o(((e,t)=>{var{parseLinkHeader:n,buildHeaders:r}=En(),{LINK_HEADER_CONTEXT:i}=Dn(),a=Tn(),o=On(),{prependBase:s}=kn(),c=/(^|(\r\n))link:/i;t.exports=({secure:e,headers:t={},xhr:u}={headers:{}})=>{return t=r(t),new o().wrapLoader(d);async function d(r){if(r.indexOf(`http:`)!==0&&r.indexOf(`https:`)!==0)throw new a(`URL could not be dereferenced; only "http" and "https" URLs are supported.`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});if(e&&r.indexOf(`https`)!==0)throw new a(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});let o;try{o=await l(u,r,t)}catch(e){throw new a(`URL could not be dereferenced, an error occurred.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,cause:e})}if(o.status>=400)throw new a(`URL could not be dereferenced: `+o.statusText,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,httpStatusCode:o.status});let f={contextUrl:null,documentUrl:r,document:o.response},p=null,m=o.getResponseHeader(`Content-Type`),h;if(c.test(o.getAllResponseHeaders())&&(h=o.getResponseHeader(`Link`)),h&&m!==`application/ld+json`){let e=n(h),t=e[i];if(Array.isArray(t))throw new a(`URL could not be dereferenced, it has more than one associated HTTP Link Header.`,`jsonld.InvalidUrl`,{code:`multiple context link headers`,url:r});t&&(f.contextUrl=t.target),p=e.alternate,p&&p.type==`application/ld+json`&&!(m||``).match(/^application\/(\w*\+)?json$/)&&(f=await d(s(r,p.target)))}return f}};function l(e,t,n){e||=XMLHttpRequest;let r=new e;return new Promise((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open(`GET`,t,!0);for(let e in n)r.setRequestHeader(e,n[e]);r.send()})}})),jn=o(((e,t)=>{var n=An(),r={};t.exports=r,r.setupDocumentLoaders=function(e){typeof XMLHttpRequest<`u`&&(e.documentLoaders.xhr=n,e.useDocumentLoader(`xhr`))},r.setupGlobals=function(e){globalThis.JsonLdProcessor===void 0&&Object.defineProperty(globalThis,`JsonLdProcessor`,{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}})),Mn=o(((e,t)=>{t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}})),Nn=o(((e,t)=>{t.exports=n,n.Node=o,n.create=n;function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==`function`)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}n.prototype.removeNode=function(e){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||=e,this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t||=this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t||=this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value},n.prototype.map=function(e,t){t||=this;for(var r=new n,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t||=this;for(var r=new n,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=0;r!==null;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=this.length-1;r!==null;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(;a!==null&&i<t;i++,a=a.next)r.push(a.value);return r},n.prototype.sliceReverse=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(var o=[],i=0;a&&i<t;i++)o.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var i=0;i<n.length;i++)a=r(this,a,n[i]);return o},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function r(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||=e.tail,e.length++}function a(e,t){e.head=new o(t,null,e.head,e),e.tail||=e.head,e.length++}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Mn()(n)}catch{}})),Pn=o(((e,t)=>{var n=Nn(),r=Symbol(`max`),i=Symbol(`length`),a=Symbol(`lengthCalculator`),o=Symbol(`allowStale`),s=Symbol(`maxAge`),c=Symbol(`dispose`),l=Symbol(`noDisposeOnSet`),u=Symbol(`lruList`),d=Symbol(`cache`),f=Symbol(`updateAgeOnGet`),p=()=>1,m=class{constructor(e){if(typeof e==`number`&&(e={max:e}),e||={},e.max&&(typeof e.max!=`number`||e.max<0))throw TypeError(`max must be a non-negative number`);this[r]=e.max||1/0;let t=e.length||p;if(this[a]=typeof t==`function`?t:p,this[o]=e.stale||!1,e.maxAge&&typeof e.maxAge!=`number`)throw TypeError(`maxAge must be a number`);this[s]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!=`number`||e<0)throw TypeError(`max must be a non-negative number`);this[r]=e||1/0,_(this)}get max(){return this[r]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=`number`)throw TypeError(`maxAge must be a non-negative number`);this[s]=e,_(this)}get maxAge(){return this[s]}set lengthCalculator(e){typeof e!=`function`&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach(e=>{e.length=this[a](e.value,e.key),this[i]+=e.length})),_(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t||=this;for(let n=this[u].tail;n!==null;){let r=n.prev;b(this,e,n,t),n=r}}forEach(e,t){t||=this;for(let n=this[u].head;n!==null;){let r=n.next;b(this,e,n,t),n=r}}keys(){return this[u].toArray().map(e=>e.key)}values(){return this[u].toArray().map(e=>e.value)}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[u]=new n,this[i]=0}dump(){return this[u].map(e=>g(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[u]}set(e,t,n){if(n||=this[s],n&&typeof n!=`number`)throw TypeError(`maxAge must be a number`);let o=n?Date.now():0,f=this[a](t,e);if(this[d].has(e)){if(f>this[r])return v(this,this[d].get(e)),!1;let a=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,a.value)),a.now=o,a.maxAge=n,a.value=t,this[i]+=f-a.length,a.length=f,this.get(e),_(this),!0}let p=new y(e,t,f,o,n);return p.length>this[r]?(this[c]&&this[c](e,t),!1):(this[i]+=p.length,this[u].unshift(p),this[d].set(e,this[u].head),_(this),!0)}has(e){if(!this[d].has(e))return!1;let t=this[d].get(e).value;return!g(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){let e=this[u].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[d].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(i===0)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>h(this,t,!1))}},h=(e,t,n)=>{let r=e[d].get(t);if(r){let t=r.value;if(g(e,t)){if(v(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[s]&&n>e[s]},_=e=>{if(e[i]>e[r])for(let t=e[u].tail;e[i]>e[r]&&t!==null;){let n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){let n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[d].delete(n.key),e[u].removeNode(t)}},y=class{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}},b=(e,t,n,r)=>{let i=n.value;g(e,i)&&(v(e,n),e[o]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};t.exports=m})),Fn=o(((e,t)=>{var n=Pn(),r=10;t.exports=class{constructor({document:e}){this.document=e,this.cache=new n({max:r})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}})),In=o(((e,t)=>{var{isArray:n,isObject:r,isString:i}=Cn(),{asArray:a}=En(),{prependBase:o}=kn(),s=Tn(),c=Fn(),l=10;t.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:o,base:s,cycles:l=new Set}){t&&r(t)&&t[`@context`]&&(t=t[`@context`]),t=a(t);let d=[];for(let a of t){if(i(a)){let t=this._get(a);t||=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:o,base:s,cycles:l}),n(t)?d.push(...t):d.push(t);continue}if(a===null){d.push(new c({document:null}));continue}r(a)||u(t);let f=JSON.stringify(a),p=this._get(f);p||(p=new c({document:a}),this._cacheResolvedContext({key:f,resolved:p,tag:`static`})),d.push(p)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){let n=this.sharedCache.get(e);n&&(t=n.get(`static`),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),n!==void 0){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=o(r,t);let{context:a,remoteDoc:s}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});r=s.documentUrl||t,d({context:a,base:r});let c=await this.resolve({activeCtx:e,context:a,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:c,tag:s.tag}),c}async _fetchContext({activeCtx:e,url:t,documentLoader:a,cycles:o}){if(o.size>l)throw new s(`Maximum number of @context URLs exceeded.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`loading remote context failed`:`context overflow`,max:l});if(o.has(t))throw new s(`Cyclical @context URLs detected.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`recursive context inclusion`:`context overflow`,url:t});o.add(t);let c,u;try{u=await a(t),c=u.document||null,i(c)&&(c=JSON.parse(c))}catch(e){throw new s(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`loading remote context failed`,url:t,cause:e})}if(!r(c))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`invalid remote context`,url:t});return c=`@context`in c?{"@context":c[`@context`]}:{"@context":{}},u.contextUrl&&(n(c[`@context`])||(c[`@context`]=[c[`@context`]]),c[`@context`].push(u.contextUrl)),{context:c,remoteDoc:u}}};function u(e){throw new s(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:e})}function d({context:e,base:t}){if(!e)return;let a=e[`@context`];if(i(a)){e[`@context`]=o(t,a);return}if(n(a)){for(let e=0;e<a.length;++e){let n=a[e];if(i(n)){a[e]=o(t,n);continue}r(n)&&d({context:{"@context":n},base:t})}return}if(r(a))for(let e in a)d({context:a[e],base:t})}})),Ln=o(((e,t)=>{t.exports=Sn().NQuads})),Rn=o(((e,t)=>{var n=Tn(),{isArray:r}=Cn(),{asArray:i}=En(),a={};t.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{let t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?i(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return t.length===0?null:t},a.handleEvent=({event:e,options:t})=>{o({event:e,handlers:t.eventHandler})};function o({event:e,handlers:t}){let i=!0;for(let a=0;i&&a<t.length;++a){i=!1;let s=t[a];if(r(s))i=o({event:e,handlers:s});else if(typeof s==`function`)s({event:e,next:()=>{i=!0}});else if(typeof s==`object`)e.code in s?s[e.code]({event:e,next:()=>{i=!0}}):i=!0;else throw new n(`Invalid event handler.`,`jsonld.InvalidEventHandler`,{event:e})}return i}var s=new Set([`empty object`,`free-floating scalar`,`invalid @language value`,`invalid property`,`null @id value`,`null @value value`,`object with only @id`,`object with only @language`,`object with only @list`,`object with only @value`,`relative @id reference`,`relative @type reference`,`relative @vocab reference`,`reserved @id value`,`reserved @reverse value`,`reserved term`,`blank node predicate`,`relative graph reference`,`relative object reference`,`relative predicate reference`,`relative subject reference`,`rdfDirection not set`]);a.safeEventHandler=function({event:e,next:t}){if(e.level===`warning`&&s.has(e.code))throw new n(`Safe mode validation error.`,`jsonld.ValidationError`,{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){e.level===`warning`&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new n(`No handler for event.`,`jsonld.UnhandledEvent`,{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?i(e):null}})),zn=o(((e,t)=>{var n=En(),r=Tn(),{isArray:i,isObject:a,isString:o,isUndefined:s}=Cn(),{isAbsolute:c,isRelative:l,prependBase:u}=kn(),{handleEvent:d}=Rn(),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:m,compareShortestLeast:h}=En(),g=new Map,_=1e4,v={};t.exports=v,v.process=async({activeCtx:e,localCtx:t,options:n,propagate:s=!0,overrideProtected:p=!1,cycles:h=new Set})=>{if(a(t)&&`@context`in t&&i(t[`@context`])&&(t=t[`@context`]),m(t).length===0)return e;let g=[],_=[({event:e,next:t})=>{g.push(e),t()}];n.eventHandler&&_.push(n.eventHandler);let b=n;n={...n,eventHandler:_};let x=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(x[0].document)&&typeof x[0].document[`@propagate`]==`boolean`&&(s=x[0].document[`@propagate`]);let S=e;!s&&!S.previousContext&&(S=S.clone(),S.previousContext=e);for(let i of x){let{document:s}=i;if(e=S,s===null){if(!p&&Object.keys(e.protected).length!==0)throw new r(`Tried to nullify a context with protected terms outside of a term definition.`,`jsonld.SyntaxError`,{code:`invalid context nullification`});S=e=v.getInitialContext(n).clone();continue}let m=i.getProcessed(e);if(m){if(b.eventHandler)for(let e of m.events)d({event:e,options:b});S=e=m.context;continue}if(a(s)&&`@context`in s&&(s=s[`@context`]),!a(s))throw new r(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:s});S=S.clone();let _=new Map;if(`@version`in s){if(s[`@version`]!==1.1)throw new r(`Unsupported JSON-LD version: `+s[`@version`],`jsonld.UnsupportedVersion`,{code:`invalid @version value`,context:s});if(e.processingMode&&e.processingMode===`json-ld-1.0`)throw new r(`@version: `+s[`@version`]+` not compatible with `+e.processingMode,`jsonld.ProcessingModeConflict`,{code:`processing mode conflict`,context:s});S.processingMode=`json-ld-1.1`,S[`@version`]=s[`@version`],_.set(`@version`,!0)}if(S.processingMode=S.processingMode||e.processingMode,`@base`in s){let e=s[`@base`];if(!(e===null||c(e)))if(l(e))e=u(S[`@base`],e);else throw new r(`Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.`,`jsonld.SyntaxError`,{code:`invalid base IRI`,context:s});S[`@base`]=e,_.set(`@base`,!0)}if(`@vocab`in s){let e=s[`@vocab`];if(e===null)delete S[`@vocab`];else if(!o(e))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else if(!c(e)&&v.processingMode(S,1))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else{let t=y(S,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`relative @vocab reference`,level:`warning`,message:`Relative @vocab reference found.`,details:{vocab:t}},options:n}),S[`@vocab`]=t}_.set(`@vocab`,!0)}if(`@language`in s){let e=s[`@language`];if(e===null)delete S[`@language`];else if(o(e))e.match(f)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:n}),S[`@language`]=e.toLowerCase();else throw new r(`Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid default language`,context:s});_.set(`@language`,!0)}if(`@direction`in s){let t=s[`@direction`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @direction not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context member`,context:s});if(t===null)delete S[`@direction`];else if(t!==`ltr`&&t!==`rtl`)throw new r(`Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:s});else S[`@direction`]=t;_.set(`@direction`,!0)}if(`@propagate`in s){let n=s[`@propagate`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @propagate not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(typeof n!=`boolean`)throw new r(`Invalid JSON-LD syntax; @propagate value must be a boolean.`,`jsonld.SyntaxError`,{code:`invalid @propagate value`,context:t});_.set(`@propagate`,!0)}if(`@import`in s){let i=s[`@import`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @import not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(!o(i))throw new r(`Invalid JSON-LD syntax; @import must be a string.`,`jsonld.SyntaxError`,{code:`invalid @import value`,context:t});let a=await n.contextResolver.resolve({activeCtx:e,context:i,documentLoader:n.documentLoader,base:n.base});if(a.length!==1)throw new r(`Invalid JSON-LD syntax; @import must reference a single context.`,`jsonld.SyntaxError`,{code:`invalid remote context`,context:t});let c=a[0].getProcessed(e);if(c)s=c;else{let n=a[0].document;if(`@import`in n)throw new r(`Invalid JSON-LD syntax: imported context must not include @import.`,`jsonld.SyntaxError`,{code:`invalid context entry`,context:t});for(let e in n)s.hasOwnProperty(e)||(s[e]=n[e]);a[0].setProcessed(e,s)}_.set(`@import`,!0)}_.set(`@protected`,s[`@protected`]||!1);for(let e in s)if(v.createTermDefinition({activeCtx:S,localCtx:s,term:e,defined:_,options:n,overrideProtected:p}),a(s[e])&&`@context`in s[e]){let t=s[e][`@context`],i=!0;if(o(t)){let e=u(n.base,t);h.has(e)?i=!1:h.add(e)}if(i)try{await v.process({activeCtx:S.clone(),localCtx:s[e][`@context`],overrideProtected:!0,options:n,cycles:h})}catch{throw new r(`Invalid JSON-LD syntax; invalid scoped context.`,`jsonld.SyntaxError`,{code:`invalid scoped context`,context:s[e][`@context`],term:e})}}i.setProcessed(e,{context:S,events:g})}return S},v.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:s,options:l,overrideProtected:u=!1})=>{if(s.has(n)){if(s.get(n))return;throw new r(`Cyclical context definition detected.`,`jsonld.CyclicalContext`,{code:`cyclic IRI mapping`,context:t,term:n})}s.set(n,!1);let f;if(t.hasOwnProperty(n)&&(f=t[n]),n===`@type`&&a(f)&&(f[`@container`]||`@set`)===`@set`&&v.processingMode(e,1.1)){let e=[`@container`,`@id`,`@protected`],i=Object.keys(f);if(i.length===0||i.some(t=>!e.includes(t)))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n})}else if(v.isKeyword(n))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n});else if(n.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved term`,level:`warning`,message:`Terms beginning with "@" are reserved for future use and dropped.`,details:{term:n}},options:l});return}else if(n===``)throw new r(`Invalid JSON-LD syntax; a term cannot be an empty string.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let m=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let h=!1;if((o(f)||f===null)&&(h=!0,f={"@id":f}),!a(f))throw new r(`Invalid JSON-LD syntax; @context term values must be strings or objects.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let g={};e.mappings.set(n,g),g.reverse=!1;let _=[`@container`,`@id`,`@language`,`@reverse`,`@type`];v.processingMode(e,1.1)&&_.push(`@context`,`@direction`,`@index`,`@nest`,`@prefix`,`@protected`);for(let e in f)if(!_.includes(e))throw new r(`Invalid JSON-LD syntax; a term definition must not contain `+e,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let x=n.indexOf(`:`);if(g._termHasColon=x>0,`@reverse`in f){if(`@id`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @id.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});if(`@nest`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});let i=f[`@reverse`];if(!o(i))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @reverse value`,level:`warning`,message:`@reverse values beginning with "@" are reserved for future use and dropped.`,details:{reverse:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}let a=y(e,i,{vocab:!0,base:!1},t,s,l);if(!c(a))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=a,g.reverse=!0}else if(`@id`in f){let i=f[`@id`];if(i&&!o(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i===null)g[`@id`]=null;else if(!v.isKeyword(i)&&i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`@id values beginning with "@" are reserved for future use and dropped.`,details:{id:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}else if(i!==n){if(i=y(e,i,{vocab:!0,base:!1},t,s,l),!c(i)&&!v.isKeyword(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(n.match(/(?::[^:])|\//)&&y(e,n,{vocab:!0,base:!1},t,new Map(s).set(n,!0),l)!==i)throw new r(`Invalid JSON-LD syntax; term in form of IRI must expand to definition.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=i,g._prefix=h&&!g._termHasColon&&i.match(/[:\/\?#\[\]@]$/)!==null}}if(!(`@id`in g))if(g._termHasColon){let r=n.substr(0,x);if(t.hasOwnProperty(r)&&v.createTermDefinition({activeCtx:e,localCtx:t,term:r,defined:s,options:l}),e.mappings.has(r)){let t=n.substr(x+1);g[`@id`]=e.mappings.get(r)[`@id`]+t}else g[`@id`]=n}else if(n===`@type`)g[`@id`]=n;else{if(!(`@vocab`in e))throw new r(`Invalid JSON-LD syntax; @context terms must define an @id.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t,term:n});g[`@id`]=e[`@vocab`]+n}if((f[`@protected`]===!0||s.get(`@protected`)===!0&&f[`@protected`]!==!1)&&(e.protected[n]=!0,g.protected=!0),s.set(n,!0),`@type`in f){let n=f[`@type`];if(!o(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be a string.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n===`@json`||n===`@none`){if(v.processingMode(e,1))throw new r(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else if(n!==`@id`&&n!==`@vocab`){if(n=y(e,n,{vocab:!0,base:!1},t,s,l),!c(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n.indexOf(`_:`)===0)throw new r(`Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}g[`@type`]=n}if(`@container`in f){let n=o(f[`@container`])?[f[`@container`]]:f[`@container`]||[],a=[`@list`,`@set`,`@index`,`@language`],s=!0,c=n.includes(`@set`);if(v.processingMode(e,1.1)){if(a.push(`@graph`,`@id`,`@type`),n.includes(`@list`)){if(n.length!==1)throw new r(`Invalid JSON-LD syntax; @context @container with @list must have no other values`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else if(n.includes(`@graph`)){if(n.some(e=>e!==`@graph`&&e!==`@id`&&e!==`@index`&&e!==`@set`))throw new r(`Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else s&=n.length<=(c?2:1);if(n.includes(`@type`)&&(g[`@type`]=g[`@type`]||`@id`,![`@id`,`@vocab`].includes(g[`@type`])))throw new r(`Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else s&=!i(f[`@container`]),s&=n.length<=1;if(s&=n.every(e=>a.includes(e)),s&=!(c&&n.includes(`@list`)),!s)throw new r(`Invalid JSON-LD syntax; @context @container value must be one of the following: `+a.join(`, `),`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t});if(g.reverse&&!n.every(e=>[`@index`,`@set`].includes(e)))throw new r(`Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});g[`@container`]=n}if(`@index`in f){if(!(`@container`in f)||!g[`@container`].includes(`@index`))throw new r(`Invalid JSON-LD syntax; @index without @index in @container: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(!o(f[`@index`])||f[`@index`].indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @index must expand to an IRI: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});g[`@index`]=f[`@index`]}if(`@context`in f&&(g[`@context`]=f[`@context`]),`@language`in f&&!(`@type`in f)){let e=f[`@language`];if(e!==null&&!o(e))throw new r(`Invalid JSON-LD syntax; @context @language value must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid language mapping`,context:t});e!==null&&(e=e.toLowerCase()),g[`@language`]=e}if(`@prefix`in f){if(n.match(/:|\//))throw new r(`Invalid JSON-LD syntax; @context @prefix used on a compact IRI term`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(v.isKeyword(g[`@id`]))throw new r(`Invalid JSON-LD syntax; keywords may not be used as prefixes`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(typeof f[`@prefix`]==`boolean`)g._prefix=f[`@prefix`]===!0;else throw new r(`Invalid JSON-LD syntax; @context value for @prefix must be boolean`,`jsonld.SyntaxError`,{code:`invalid @prefix value`,context:t})}if(`@direction`in f){let e=f[`@direction`];if(e!==null&&e!==`ltr`&&e!==`rtl`)throw new r(`Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:t});g[`@direction`]=e}if(`@nest`in f){let e=f[`@nest`];if(!o(e)||e!==`@nest`&&e.indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,context:t});g[`@nest`]=e}let S=g[`@id`];if(S===`@context`||S===`@preserve`)throw new r(`Invalid JSON-LD syntax; @context and @preserve cannot be aliased.`,`jsonld.SyntaxError`,{code:`invalid keyword alias`,context:t});if(m&&m.protected&&!u&&(e.protected[n]=!0,g.protected=!0,!b(m,g)))throw new r(`Invalid JSON-LD syntax; tried to redefine a protected term.`,`jsonld.SyntaxError`,{code:`protected term redefinition`,context:t,term:n})},v.expandIri=(e,t,n,r)=>y(e,t,n,void 0,void 0,r);function y(e,t,n,r,i,s){if(t===null||!o(t)||v.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&i.get(t)!==!0&&v.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:s}),n||={},n.vocab){let n=e.mappings.get(t);if(n===null)return null;if(a(n)&&`@id`in n)return n[`@id`]}let l=t.indexOf(`:`);if(l>0){let n=t.substr(0,l),a=t.substr(l+1);if(n===`_`||a.indexOf(`//`)===0)return t;r&&r.hasOwnProperty(n)&&v.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:s});let o=e.mappings.get(n);if(o&&o._prefix)return o[`@id`]+a;if(c(t))return t}if(n.vocab&&`@vocab`in e)t=e[`@vocab`]+t;else if(n.base){let n,r;`@base`in e?e[`@base`]?(r=u(s.base,e[`@base`]),n=u(r,t)):(r=e[`@base`],n=t):(r=s.base,n=u(s.base,t)),t=n}return t}v.getInitialContext=e=>{let t=JSON.stringify({processingMode:e.processingMode}),r=g.get(t);if(r)return r;let i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:a,clone:c,revertToPreviousContext:l,protected:{}};return g.size===_&&g.clear(),g.set(t,i),i;function a(){let e=this;if(e.inverse)return e.inverse;let t=e.inverse={},n=e.fastCurieMap={},r={},i=(e[`@language`]||`@none`).toLowerCase(),a=e[`@direction`],c=e.mappings,l=[...c.keys()].sort(h);for(let e of l){let o=c.get(e);if(o===null)continue;let l=o[`@container`]||`@none`;if(l=[].concat(l).sort().join(``),o[`@id`]===null)continue;let u=m(o[`@id`]);for(let c of u){let u=t[c],d=v.isKeyword(c);if(u)!d&&!o._termHasColon&&r[c].push(e);else if(t[c]=u={},!d&&!o._termHasColon){r[c]=[e];let t={iri:c,terms:r[c]};c[0]in n?n[c[0]].push(t):n[c[0]]=[t]}if(u[l]||(u[l]={"@language":{},"@type":{},"@any":{}}),u=u[l],s(e,u[`@any`],`@none`),o.reverse)s(e,u[`@type`],`@reverse`);else if(o[`@type`]===`@none`)s(e,u[`@any`],`@none`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`);else if(`@type`in o)s(e,u[`@type`],o[`@type`]);else if(`@language`in o&&`@direction`in o){let t=o[`@language`],n=o[`@direction`];t&&n?s(e,u[`@language`],`${t}_${n}`.toLowerCase()):t?s(e,u[`@language`],t.toLowerCase()):n?s(e,u[`@language`],`_${n}`):s(e,u[`@language`],`@null`)}else `@language`in o?s(e,u[`@language`],(o[`@language`]||`@null`).toLowerCase()):`@direction`in o?o[`@direction`]?s(e,u[`@language`],`_${o[`@direction`]}`):s(e,u[`@language`],`@none`):a?(s(e,u[`@language`],`_${a}`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`)):(s(e,u[`@language`],i),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`))}}for(let e in n)o(n,e,1);return t}function o(e,t,n){let r=e[t],i=e[t]={},a,s;for(let e of r)a=e.iri,s=n>=a.length?``:a[n],s in i?i[s].push(e):i[s]=[e];for(let e in i)e!==``&&o(i,e,n+1)}function s(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}function c(){let e={};return e.mappings=n.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=n.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,`@base`in this&&(e[`@base`]=this[`@base`]),`@language`in this&&(e[`@language`]=this[`@language`]),`@vocab`in this&&(e[`@vocab`]=this[`@vocab`]),e}function l(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(e,t,n)=>{if(t===null)return n===`@context`?void 0:null;if(e.mappings.has(t)){let r=e.mappings.get(t);if(s(n))return r;if(r.hasOwnProperty(n))return r[n]}if(n===`@language`&&n in e||n===`@direction`&&n in e)return e[n];if(n!==`@context`)return null},v.processingMode=(e,t)=>t.toString()>=`1.1`?!e.processingMode||e.processingMode>=`json-ld-`+t.toString():e.processingMode===`json-ld-1.0`,v.isKeyword=e=>{if(!o(e)||e[0]!==`@`)return!1;switch(e){case`@base`:case`@container`:case`@context`:case`@default`:case`@direction`:case`@embed`:case`@explicit`:case`@graph`:case`@id`:case`@included`:case`@index`:case`@json`:case`@language`:case`@list`:case`@nest`:case`@none`:case`@omitDefault`:case`@prefix`:case`@preserve`:case`@protected`:case`@requireAll`:case`@reverse`:case`@set`:case`@type`:case`@value`:case`@version`:case`@vocab`:return!0}return!1};function b(e,t){if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return e===t;let n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!b(e[n],t[n]))return!1;return!0}let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let n in e){let r=e[n],i=t[n];if(n===`@container`&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!b(r,i))return!1}return!0}})),Bn=o(((e,t)=>{var n=Tn(),{isArray:r,isObject:i,isEmptyObject:a,isString:o,isUndefined:s}=Cn(),{isList:c,isValue:l,isGraph:u,isSubject:d}=wn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=zn(),{isAbsolute:_}=kn(),{REGEX_BCP47:v,REGEX_KEYWORD:y,addValue:b,asArray:x,getValues:S,validateTypeValue:C}=En(),{handleEvent:w}=Rn(),T={};t.exports=T,T.expand=async({activeCtx:e,activeProperty:t=null,element:c,options:l={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:m=null})=>{if(c==null)return null;if(t===`@default`&&(l=Object.assign({},l,{isFrame:!1})),!r(c)&&!i(c))return!u&&(t===null||f(e,t,{vocab:!0},l)===`@graph`)?(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`free-floating scalar`,level:`warning`,message:`Dropping free-floating scalar not in a list.`,details:{value:c}},options:l}),null):O({activeCtx:e,activeProperty:t,value:c,options:l});if(r(c)){let n=[],i=p(e,t,`@container`)||[];u||=i.includes(`@list`);for(let i=0;i<c.length;++i){let a=await T.expand({activeCtx:e,activeProperty:t,element:c[i],options:l,insideIndex:d,typeScopedContext:m});u&&r(a)&&(a={"@list":a}),a!==null&&(r(a)?n=n.concat(a):n.push(a))}return n}let v=f(e,t,{vocab:!0},l),y=p(e,t,`@context`);m||=e.previousContext?e:null;let b=Object.keys(c).sort(),C=!d;if(C&&m&&b.length<=2&&!b.includes(`@context`))for(let t of b){let n=f(m,t,{vocab:!0},l);if(n===`@value`){C=!1,e=m;break}if(n===`@id`&&b.length===1){C=!1;break}}C&&(e=e.revertToPreviousContext()),s(y)||(e=await h({activeCtx:e,localCtx:y,propagate:!0,overrideProtected:!0,options:l})),`@context`in c&&(e=await h({activeCtx:e,localCtx:c[`@context`],options:l})),m=e;let k=null;for(let t of b)if(f(e,t,{vocab:!0},l)===`@type`){k||=t;let n=c[t],r=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(let t of r){let n=p(m,t,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,options:l,propagate:!1}))}}let A={};await D({activeCtx:e,activeProperty:t,expandedActiveProperty:v,element:c,expandedParent:A,options:l,insideList:u,typeKey:k,typeScopedContext:m}),b=Object.keys(A);let j=b.length;if(`@value`in A){if(`@type`in A&&(`@language`in A||`@direction`in A))throw new n(`Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let t=j-1;if(`@type`in A&&--t,`@index`in A&&--t,`@language`in A&&--t,`@direction`in A&&--t,t!==0)throw new n(`Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let r=A[`@value`]===null?[]:x(A[`@value`]),i=S(A,`@type`);if(!(g(e,1.1)&&i.includes(`@json`)&&i.length===1)){if(r.length===0)l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`null @value value`,level:`warning`,message:`Dropping null @value value.`,details:{value:A}},options:l}),A=null;else if(!r.every(e=>o(e)||a(e))&&`@language`in A)throw new n(`Invalid JSON-LD syntax; only strings may be language-tagged.`,`jsonld.SyntaxError`,{code:`invalid language-tagged value`,element:A});else if(!i.every(e=>_(e)&&!(o(e)&&e.indexOf(`_:`)===0)||a(e)))throw new n(`Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".`,`jsonld.SyntaxError`,{code:`invalid typed value`,element:A})}}else if(`@type`in A&&!r(A[`@type`]))A[`@type`]=[A[`@type`]];else if(`@set`in A||`@list`in A){if(j>1&&!(j===2&&`@index`in A))throw new n(`Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".`,`jsonld.SyntaxError`,{code:`invalid set or list object`,element:A});`@set`in A&&(A=A[`@set`],b=Object.keys(A),j=b.length)}else j===1&&`@language`in A&&(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`object with only @language`,level:`warning`,message:`Dropping object with only @language.`,details:{value:A}},options:l}),A=null);return i(A)&&!l.keepFreeFloatingNodes&&!u&&(t===null||v===`@graph`||(p(e,t,`@container`)||[]).includes(`@graph`))&&(A=E({value:A,count:j,options:l})),A};function E({value:e,count:t,options:n}){if(t===0||`@value`in e||`@list`in e||t===1&&`@id`in e){if(n.eventHandler){let r,i;t===0?(r=`empty object`,i=`Dropping empty object.`):`@value`in e?(r=`object with only @value`,i=`Dropping object with only @value.`):`@list`in e?(r=`object with only @list`,i=`Dropping object with only @list.`):t===1&&`@id`in e&&(r=`object with only @id`,i=`Dropping object with only @id.`),w({event:{type:[`JsonLdEvent`],code:r,level:`warning`,message:i,details:{value:e}},options:n})}return null}return e}async function D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:y,expandedParent:S,options:O={},insideList:j,typeKey:M,typeScopedContext:N}){let P=Object.keys(y).sort(),F=[],I,R=y[M]&&f(e,r(y[M])?y[M][0]:y[M],{vocab:!0},{...O,typeExpansion:!0})===`@json`;for(let D of P){let j=y[D],M;if(D===`@context`)continue;let P=f(e,D,{vocab:!0},O);if(P===null||!(_(P)||m(P))){O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid property`,level:`warning`,message:`Dropping property that did not expand into an absolute IRI or keyword.`,details:{property:D,expandedProperty:P}},options:O});continue}if(m(P)){if(u===`@reverse`)throw new n(`Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.`,`jsonld.SyntaxError`,{code:`invalid reverse property map`,value:j});if(P in S&&P!==`@included`&&P!==`@type`)throw new n(`Invalid JSON-LD syntax; colliding keywords detected.`,`jsonld.SyntaxError`,{code:`colliding keywords`,keyword:P})}if(P===`@id`){if(!o(j)){if(!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@id" value must a string.`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j});if(i(j)){if(!a(j))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else if(r(j)){if(!j.every(e=>o(e)))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}b(S,`@id`,x(j).map(t=>{if(o(t)){let n=f(e,t,{base:!0},O);return O.eventHandler&&(n===null?w(t===null?{event:{type:[`JsonLdEvent`],code:`null @id value`,level:`warning`,message:`Null @id found.`,details:{id:t}},options:O}:{event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:O}):_(n)||w({event:{type:[`JsonLdEvent`],code:`relative @id reference`,level:`warning`,message:`Relative @id reference found.`,details:{id:t,expandedId:n}},options:O})),n}return t}),{propertyIsArray:O.isFrame});continue}if(P===`@type`){i(j)&&(j=Object.fromEntries(Object.entries(j).map(([e,t])=>[f(N,e,{vocab:!0}),x(t).map(e=>f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0}))]))),C(j,O.isFrame),b(S,`@type`,x(j).map(e=>{if(o(e)){let t=f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0});return t!==`@json`&&!_(t)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`relative @type reference`,level:`warning`,message:`Relative @type reference found.`,details:{type:e}},options:O}),t}return e}),{propertyIsArray:!!O.isFrame});continue}if(P===`@included`&&g(e,1.1)){let r=x(await T.expand({activeCtx:e,activeProperty:t,element:j,options:O}));if(!r.every(e=>d(e)))throw new n(`Invalid JSON-LD syntax; values of @included must expand to node objects.`,`jsonld.SyntaxError`,{code:`invalid @included value`,value:j});b(S,`@included`,r,{propertyIsArray:!0});continue}if(P===`@graph`&&!(i(j)||r(j)))throw new n(`Invalid JSON-LD syntax; "@graph" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid @graph value`,value:j});if(P===`@value`){I=j,R&&g(e,1.1)?S[`@value`]=j:b(S,`@value`,j,{propertyIsArray:O.isFrame});continue}if(P===`@language`){if(j===null)continue;if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@language" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid language-tagged string`,value:j});j=x(j).map(e=>o(e)?e.toLowerCase():e);for(let e of j)o(e)&&!e.match(v)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:O});b(S,`@language`,j,{propertyIsArray:O.isFrame});continue}if(P===`@direction`){if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@direction" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});j=x(j);for(let e of j)if(o(e)&&e!==`ltr`&&e!==`rtl`)throw new n(`Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});b(S,`@direction`,j,{propertyIsArray:O.isFrame});continue}if(P===`@index`){if(!o(j))throw new n(`Invalid JSON-LD syntax; "@index" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid @index value`,value:j});b(S,`@index`,j);continue}if(P===`@reverse`){if(!i(j))throw new n(`Invalid JSON-LD syntax; "@reverse" value must be an object.`,`jsonld.SyntaxError`,{code:`invalid @reverse value`,value:j});if(M=await T.expand({activeCtx:e,activeProperty:`@reverse`,element:j,options:O}),`@reverse`in M)for(let e in M[`@reverse`])b(S,e,M[`@reverse`][e],{propertyIsArray:!0});let t=S[`@reverse`]||null;for(let e in M){if(e===`@reverse`)continue;t===null&&(t=S[`@reverse`]={}),b(t,e,[],{propertyIsArray:!0});let r=M[e];for(let i=0;i<r.length;++i){let a=r[i];if(l(a)||c(a))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(t,e,a,{propertyIsArray:!0})}}continue}if(P===`@nest`){F.push(D);continue}let z=e,B=p(e,D,`@context`);s(B)||(z=await h({activeCtx:e,localCtx:B,propagate:!0,overrideProtected:!0,options:O}));let V=p(e,D,`@container`)||[];if(V.includes(`@language`)&&i(j)){let e=p(z,D,`@direction`);M=k(z,j,e,O)}else if(V.includes(`@index`)&&i(j)){let t=V.includes(`@graph`),n=p(z,D,`@index`)||`@index`,r=n!==`@index`&&f(e,n,{vocab:!0},O);M=await A({activeCtx:z,options:O,activeProperty:D,value:j,asGraph:t,indexKey:n,propertyIndex:r})}else if(V.includes(`@id`)&&i(j)){let e=V.includes(`@graph`);M=await A({activeCtx:z,options:O,activeProperty:D,value:j,asGraph:e,indexKey:`@id`})}else if(V.includes(`@type`)&&i(j))M=await A({activeCtx:z.revertToPreviousContext(),options:O,activeProperty:D,value:j,asGraph:!1,indexKey:`@type`});else{let n=P===`@list`;if(n||P===`@set`){let e=t;n&&u===`@graph`&&(e=null),M=await T.expand({activeCtx:z,activeProperty:e,element:j,options:O,insideList:n})}else M=p(e,D,`@type`)===`@json`?{"@type":`@json`,"@value":j}:await T.expand({activeCtx:z,activeProperty:D,element:j,options:O,insideList:!1})}if(!(M===null&&P!==`@value`)){if(P!==`@list`&&!c(M)&&V.includes(`@list`)&&(M={"@list":x(M)}),V.includes(`@graph`)&&!V.some(e=>e===`@id`||e===`@index`)){if(M=x(M),O.isFrame||(M=M.filter(e=>{let t=Object.keys(e).length;return E({value:e,count:t,options:O})!==null})),M.length===0)continue;M=M.map(e=>({"@graph":x(e)}))}if(z.mappings.has(D)&&z.mappings.get(D).reverse){let e=S[`@reverse`]=S[`@reverse`]||{};M=x(M);for(let t=0;t<M.length;++t){let r=M[t];if(l(r)||c(r))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(e,P,r,{propertyIsArray:!0})}continue}b(S,P,M,{propertyIsArray:!0})}}if(`@value`in S&&!(S[`@type`]===`@json`&&g(e,1.1))&&(i(I)||r(I))&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@value" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid value object value`,value:I});for(let a of F){let o=r(y[a])?y[a]:[y[a]];for(let r of o){if(!i(r)||Object.keys(r).some(t=>f(e,t,{vocab:!0},O)===`@value`))throw new n(`Invalid JSON-LD syntax; nested value must be a node object.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,value:r});await D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:r,expandedParent:S,options:O,insideList:j,typeScopedContext:N,typeKey:M})}}}function O({activeCtx:e,activeProperty:t,value:n,options:r}){if(n==null)return null;let i=f(e,t,{vocab:!0},r);if(i===`@id`)return f(e,n,{base:!0},r);if(i===`@type`)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});let a=p(e,t,`@type`);if((a===`@id`||i===`@graph`)&&o(n)){let i=f(e,n,{base:!0},r);return i===null&&n.match(y)&&r.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:r}),{"@id":i}}if(a===`@vocab`&&o(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(m(i))return n;let s={};if(a&&![`@id`,`@vocab`,`@none`].includes(a))s[`@type`]=a;else if(o(n)){let n=p(e,t,`@language`);n!==null&&(s[`@language`]=n);let r=p(e,t,`@direction`);r!==null&&(s[`@direction`]=r)}return[`boolean`,`number`,`string`].includes(typeof n)||(n=n.toString()),s[`@value`]=n,s}function k(e,t,i,a){let s=[],c=Object.keys(t).sort();for(let l of c){let c=f(e,l,{vocab:!0},a),u=t[l];r(u)||(u=[u]);for(let e of u){if(e===null)continue;if(!o(e))throw new n(`Invalid JSON-LD syntax; language map values must be strings.`,`jsonld.SyntaxError`,{code:`invalid language map value`,languageMap:t});let r={"@value":e};c!==`@none`&&(l.match(v)||a.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:l}},options:a}),r[`@language`]=l.toLowerCase()),i&&(r[`@direction`]=i),s.push(r)}}return s}async function A({activeCtx:e,options:t,activeProperty:i,value:a,asGraph:o,indexKey:c,propertyIndex:d}){let m=[],g=Object.keys(a).sort(),_=c===`@type`;for(let v of g){if(_){let n=p(e,v,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g=a[v];r(g)||(g=[g]),g=await T.expand({activeCtx:e,activeProperty:i,element:g,options:t,insideList:!1,insideIndex:!0});let y;y=d?v===`@none`?`@none`:O({activeCtx:e,activeProperty:c,value:v,options:t}):f(e,v,{vocab:!0},t),c===`@id`?v=f(e,v,{base:!0},t):_&&(v=y);for(let e of g){if(o&&!u(e)&&(e={"@graph":[e]}),c===`@type`)y===`@none`||(e[`@type`]?e[`@type`]=[v].concat(e[`@type`]):e[`@type`]=[v]);else if(l(e)&&![`@language`,`@type`,`@index`].includes(c))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${c}".`,`jsonld.SyntaxError`,{code:`invalid value object`,value:e});else d?y!==`@none`&&b(e,d,y,{propertyIsArray:!0,prependValue:!0}):y!==`@none`&&!(c in e)&&(e[c]=v);m.push(e)}}return m}})),Vn=o(((e,t)=>{var{isKeyword:n}=zn(),r=wn(),i=Cn(),a=En(),o=Tn(),s={};t.exports=s,s.createMergedNodeMap=(e,t)=>{t||={};let n=t.issuer||new a.IdentifierIssuer(`_:b`),r={"@default":{}};return s.createNodeMap(e,r,`@default`,n),s.mergeNodeMaps(r)},s.createNodeMap=(e,t,c,l,u,d)=>{if(i.isArray(e)){for(let n of e)s.createNodeMap(n,t,c,l,void 0,d);return}if(!i.isObject(e)){d&&d.push(e);return}if(r.isValue(e)){if(`@type`in e){let t=e[`@type`];t.indexOf(`_:`)===0&&(e[`@type`]=t=l.getId(t))}d&&d.push(e);return}else if(d&&r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),d.push({"@list":n});return}if(`@type`in e){let t=e[`@type`];for(let e of t)e.indexOf(`_:`)===0&&l.getId(e)}i.isUndefined(u)&&(u=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`]),d&&d.push({"@id":u});let f=t[c],p=f[u]=f[u]||{};p[`@id`]=u;let m=Object.keys(e).sort();for(let i of m){if(i===`@id`)continue;if(i===`@reverse`){let n={"@id":u},i=e[`@reverse`];for(let e in i){let o=i[e];for(let i of o){let o=i[`@id`];r.isBlankNode(i)&&(o=l.getId(o)),s.createNodeMap(i,t,c,l,o),a.addValue(f[o],e,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(i===`@graph`){u in t||(t[u]={}),s.createNodeMap(e[i],t,u,l);continue}if(i===`@included`){s.createNodeMap(e[i],t,c,l);continue}if(i!==`@type`&&n(i)){if(i===`@index`&&i in p&&(e[i]!==p[i]||e[i][`@id`]!==p[i][`@id`]))throw new o(`Invalid JSON-LD syntax; conflicting @index property detected.`,`jsonld.SyntaxError`,{code:`conflicting indexes`,subject:p});p[i]=e[i];continue}let d=e[i];if(i.indexOf(`_:`)===0&&(i=l.getId(i)),d.length===0){a.addValue(p,i,[],{propertyIsArray:!0});continue}for(let e of d)if(i===`@type`&&(e=e.indexOf(`_:`)===0?l.getId(e):e),r.isSubject(e)||r.isSubjectReference(e)){if(`@id`in e&&!e[`@id`])continue;let n=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`];a.addValue(p,i,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(e,t,c,l,n)}else if(r.isValue(e))a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),e={"@list":n},a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(e,t,c,l,u),a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=e=>{let t={};for(let r of Object.keys(e).sort())for(let i of Object.keys(e[r]).sort()){let o=e[r][i];i in t||(t[i]={"@id":i});let s=t[i];for(let e of Object.keys(o).sort())if(n(e)&&e!==`@type`)s[e]=a.clone(o[e]);else for(let t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},s.mergeNodeMaps=e=>{let t=e[`@default`],n=Object.keys(e).sort();for(let i of n){if(i===`@default`)continue;let n=e[i],a=t[i];a?`@graph`in a||(a[`@graph`]=[]):t[i]=a={"@id":i,"@graph":[]};let o=a[`@graph`];for(let e of Object.keys(n).sort()){let t=n[e];r.isSubjectReference(t)||o.push(t)}}return t}})),Hn=o(((e,t)=>{var{isSubjectReference:n}=wn(),{createMergedNodeMap:r}=Vn(),i={};t.exports=i,i.flatten=e=>{let t=r(e),i=[],a=Object.keys(t).sort();for(let e=0;e<a.length;++e){let r=t[a[e]];n(r)||i.push(r)}return i}})),Un=o(((e,t)=>{var n=Tn(),r=wn(),i=Cn(),{REGEX_BCP47:a,addValue:o}=En(),{handleEvent:s}=Rn(),{RDF_LIST:c,RDF_FIRST:l,RDF_REST:u,RDF_NIL:d,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:m,XSD_DOUBLE:h,XSD_INTEGER:g,XSD_STRING:_}=Dn(),v={};t.exports=v,v.fromRDF=async(e,t)=>{let{useRdfType:a=!1,useNativeTypes:s=!1,rdfDirection:p=null}=t,m={},h={"@default":m},g={};if(p){if(p===`compound-literal`)throw new n(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p});if(p!==`i18n-datatype`)throw new n(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p})}for(let n of e){let e=n.graph.termType===`DefaultGraph`?`@default`:n.graph.value;e in h||(h[e]={}),e!==`@default`&&!(e in m)&&(m[e]={"@id":e});let r=h[e],i=b(n.subject),c=n.predicate.value,l=n.object;i in r||(r[i]={"@id":i});let u=r[i],_=b(l),v=!!_;if(v&&!(_ in r)&&(r[_]={"@id":_}),c===f&&!a&&v){o(u,`@type`,_,{propertyIsArray:!0});continue}let x=y(l,s,p,t);if(o(u,c,x,{propertyIsArray:!0}),v)if(_===d){let e=r[_];`usages`in e||(e.usages=[]),e.usages.push({node:u,property:c,value:x})}else _ in g?g[_]=!1:g[_]={node:u,property:c,value:x}}for(let e in h){let t=h[e];if(!(d in t))continue;let n=t[d];if(n.usages){for(let e of n.usages){let n=e.node,a=e.property,o=e.value,s=[],d=[],f=Object.keys(n).length;for(;a===u&&i.isObject(g[n[`@id`]])&&i.isArray(n[l])&&n[l].length===1&&i.isArray(n[u])&&n[u].length===1&&(f===3||f===4&&i.isArray(n[`@type`])&&n[`@type`].length===1&&n[`@type`][0]===c)&&(s.push(n[l][0]),d.push(n[`@id`]),e=g[n[`@id`]],n=e.node,a=e.property,o=e.value,f=Object.keys(n).length,r.isBlankNode(n)););delete o[`@id`],o[`@list`]=s.reverse();for(let e of d)delete t[e]}delete n.usages}}let _=[],v=Object.keys(m).sort();for(let e of v){let t=m[e];if(e in h){let n=t[`@graph`]=[],i=h[e],a=Object.keys(i).sort();for(let e of a){let t=i[e];r.isSubjectReference(t)||n.push(t)}}r.isSubjectReference(t)||_.push(t)}return _};function y(e,t,r,o){let c=b(e);if(c)return{"@id":c};let l={"@value":e.value};if(e.language)e.language.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e.language}},options:o}),l[`@language`]=e.language;else{let c=e.datatype.value;if(c||=_,c===p){c=`@json`;try{l[`@value`]=JSON.parse(l[`@value`])}catch(e){throw new n(`JSON literal could not be parsed.`,`jsonld.InvalidJsonLiteral`,{code:`invalid JSON literal`,value:l[`@value`],cause:e})}}if(t)if(c===m)l[`@value`]===`true`||l[`@value`]===`1`?l[`@value`]=!0:l[`@value`]===`false`||l[`@value`]===`0`?l[`@value`]=!1:l[`@type`]=c;else if(c===g)if(i.isNumeric(l[`@value`])){let e=parseInt(l[`@value`],10);e.toFixed(0)===l[`@value`]&&(l[`@value`]=e)}else l[`@type`]=c;else c===h&&i.isNumeric(l[`@value`])?l[`@value`]=parseFloat(l[`@value`]):l[`@type`]=c;else if(r===`i18n-datatype`&&c.startsWith(`https://www.w3.org/ns/i18n#`)){let[,e,t]=c.split(/[#_]/);e.length>0&&(l[`@language`]=e,e.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:o})),l[`@direction`]=t}else c!==_&&(l[`@type`]=c)}return l}function b(e){return e.termType===`NamedNode`?e.value:e.termType===`BlankNode`?`_:`+e.value:null}})),Wn=o(((e,t)=>{t.exports=function e(t){if(typeof t==`number`&&isNaN(t))throw Error(`NaN is not allowed`);if(typeof t==`number`&&!isFinite(t))throw Error(`Infinity is not allowed`);return typeof t!=`object`||!t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${r===0?``:`,`}${e(n===void 0||typeof n==`symbol`?null:n)}`,``)}]`:`{${Object.keys(t).sort().reduce((n,r)=>t[r]===void 0||typeof t[r]==`symbol`?n:`${n}${n.length===0?``:`,`}${e(r)}:${e(t[r])}`,``)}}`}})),Gn=o(((e,t)=>{var{createNodeMap:n}=Vn(),{isKeyword:r}=zn(),i=wn(),a=Wn(),o=Tn(),s=Cn(),c=En(),{handleEvent:l}=Rn(),{RDF_FIRST:u,RDF_REST:d,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:m,RDF_LANGSTRING:h,XSD_BOOLEAN:g,XSD_DOUBLE:_,XSD_INTEGER:v,XSD_STRING:y}=Dn(),{isAbsolute:b}=kn(),x={};t.exports=x,x.toRDF=(e,t)=>{let r=new c.IdentifierIssuer(`_:b`),i={"@default":{}};n(e,i,`@default`,r);let a=[],o=Object.keys(i).sort();for(let e of o){let n;if(e===`@default`)n={termType:`DefaultGraph`,value:``};else if(b(e))n=T(e);else{t.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative graph reference`,level:`warning`,message:`Relative graph reference found.`,details:{graph:e}},options:t});continue}S(a,i[e],n,r,t)}return a};function S(e,t,n,i,a){let o=Object.keys(t).sort();for(let s of o){let o=t[s],c=Object.keys(o).sort();for(let t of c){let c=o[t];if(t===`@type`)t=p;else if(r(t))continue;for(let r of c){let o=T(s);if(!b(s)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative subject reference`,level:`warning`,message:`Relative subject reference found.`,details:{subject:s}},options:a});continue}let c=T(t);if(!b(t)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative predicate reference`,level:`warning`,message:`Relative predicate reference found.`,details:{predicate:t}},options:a});continue}if(c.termType===`BlankNode`&&!a.produceGeneralizedRdf){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`blank node predicate`,level:`warning`,message:`Dropping blank node predicate.`,details:{property:i.getOldIds().find(e=>i.getId(e)===t)}},options:a});continue}let u=w(r,i,e,n,a.rdfDirection,a);u&&e.push({subject:o,predicate:c,object:u,graph:n})}}}}function C(e,t,n,r,i,a){let o={termType:`NamedNode`,value:u},s={termType:`NamedNode`,value:d},c={termType:`NamedNode`,value:f},l=e.pop(),p=l?{termType:`BlankNode`,value:t.getId().slice(2)}:c,m=p;for(let c of e){let e=w(c,t,n,r,i,a),l={termType:`BlankNode`,value:t.getId().slice(2)};n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:l,graph:r}),m=l}if(l){let e=w(l,t,n,r,i,a);n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:c,graph:r})}return p}function w(e,t,n,r,c,u){let d;if(i.isValue(e)){d={termType:`Literal`,value:void 0,datatype:{termType:`NamedNode`}};let t=e[`@value`],n=e[`@type`]||null;if(n===`@json`)d.value=a(t),d.datatype.value=m;else if(s.isBoolean(t))d.value=t.toString(),d.datatype.value=n||g;else if(s.isDouble(t)||n===_)s.isDouble(t)||(t=parseFloat(t)),d.value=t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),d.datatype.value=n||_;else if(s.isNumber(t))d.value=t.toFixed(0),d.datatype.value=n||v;else if(`@direction`in e&&c===`i18n-datatype`){let n=`https://www.w3.org/ns/i18n#${(e[`@language`]||``).toLowerCase()}_${e[`@direction`]}`;d.datatype.value=n,d.value=t}else if(`@direction`in e&&c===`compound-literal`)throw new o(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else if(`@direction`in e&&c)throw new o(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else `@language`in e?(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||h,d.language=e[`@language`]):(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||y)}else if(i.isList(e)){let i=C(e[`@list`],t,n,r,c,u);d={termType:i.termType,value:i.value}}else d=T(s.isObject(e)?e[`@id`]:e);return d.termType===`NamedNode`&&!b(d.value)?(u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative object reference`,level:`warning`,message:`Relative object reference found.`,details:{object:d.value}},options:u}),null):d}function T(e){return e.startsWith(`_:`)?{termType:`BlankNode`,value:e.slice(2)}:{termType:`NamedNode`,value:e}}})),Kn=o(((e,t)=>{var{isKeyword:n}=zn(),r=wn(),i=Cn(),a=En(),o=kn(),s=Tn(),{createNodeMap:c,mergeNodeMapGraphs:l}=Vn(),u={};t.exports=u,u.frameMergedOrDefault=(e,t,n)=>{let r={options:n,embedded:!1,graph:`@default`,graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer(`_:b`);c(e,r.graphMap,`@default`,i),n.merged&&(r.graphMap[`@merged`]=l(r.graphMap),r.graph=`@merged`),r.subjects=r.graphMap[r.graph];let o=[];return u.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter(e=>r.bnodeMap[e].length===1)),n.link={},v(o,n)},u.frame=(e,t,o,c,l=null)=>{m(o),o=o[0];let g=e.options,v={embed:p(o,g,`embed`),explicit:p(o,g,`explicit`),requireAll:p(o,g,`requireAll`)};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});let b=e.link[e.graph],S=h(e,t,o,v),C=Object.keys(S).sort();for(let m of C){let h=S[m];if(l===null?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},v.embed===`@link`&&m in b){y(c,l,b[m]);continue}let C={"@id":m};if(m.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,m,C,{propertyIsArray:!0}),b[m]=C,(v.embed===`@first`||v.embed===`@last`)&&e.is11)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:o});if(!(!e.embedded&&e.uniqueEmbeds[e.graph].hasOwnProperty(m))){if(e.embedded&&(v.embed===`@never`||f(h,e.graph,e.subjectStack))){y(c,l,C);continue}if(e.embedded&&(v.embed==`@first`||v.embed==`@once`)&&e.uniqueEmbeds[e.graph].hasOwnProperty(m)){y(c,l,C);continue}if(v.embed===`@last`&&m in e.uniqueEmbeds[e.graph]&&_(e,m),e.uniqueEmbeds[e.graph][m]={parent:c,property:l},e.subjectStack.push({subject:h,graph:e.graph}),m in e.graphMap){let t=!1,n=null;`@graph`in o?(n=o[`@graph`][0],t=!(m===`@merged`||m===`@default`),i.isObject(n)||(n={})):(t=e.graph!==`@merged`,n={}),t&&u.frame({...e,graph:m,embedded:!1},Object.keys(e.graphMap[m]).sort(),[n],C,`@graph`)}`@included`in o&&u.frame({...e,embedded:!1},t,o[`@included`],C,`@included`);for(let t of Object.keys(h).sort()){if(n(t)){if(C[t]=a.clone(h[t]),t===`@type`)for(let t of h[`@type`])t.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,t,C,{propertyIsArray:!0});continue}if(!(v.explicit&&!(t in o)))for(let n of h[t]){let i=t in o?o[t]:d(v);if(r.isList(n)){let i=o[t]&&o[t][0]&&o[t][0][`@list`]?o[t][0][`@list`]:d(v),s={"@list":[]};y(C,t,s);let c=n[`@list`];for(let t of c)r.isSubjectReference(t)?u.frame({...e,embedded:!0},[t[`@id`]],i,s,`@list`):y(s,`@list`,a.clone(t))}else r.isSubjectReference(n)?u.frame({...e,embedded:!0},[n[`@id`]],i,C,t):x(i[0],n)&&y(C,t,a.clone(n))}}for(let e of Object.keys(o).sort()){if(e===`@type`){if(!i.isObject(o[e][0])||!(`@default`in o[e][0]))continue}else if(n(e))continue;let t=o[e][0]||{};if(!p(t,g,`omitDefault`)&&!(e in C)){let n=`@null`;`@default`in t&&(n=a.clone(t[`@default`])),i.isArray(n)||(n=[n]),C[e]=[{"@preserve":n}]}}for(let t of Object.keys(o[`@reverse`]||{}).sort()){let n=o[`@reverse`][t];for(let r of Object.keys(e.subjects))a.getValues(e.subjects[r],t).some(e=>e[`@id`]===m)&&(C[`@reverse`]=C[`@reverse`]||{},a.addValue(C[`@reverse`],t,[],{propertyIsArray:!0}),u.frame({...e,embedded:!0},[r],n,C[`@reverse`][t],l))}y(c,l,C),e.subjectStack.pop()}}},u.cleanupNull=(e,t)=>{if(i.isArray(e))return e.map(e=>u.cleanupNull(e,t)).filter(e=>e);if(e===`@null`)return null;if(i.isObject(e)){if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e)e[n]=u.cleanupNull(e[n],t)}return e};function d(e){let t={};for(let n in e)e[n]!==void 0&&(t[`@`+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){let i=n[r];if(i.graph===t&&i.subject[`@id`]===e[`@id`])return!0}return!1}function p(e,t,n){let r=`@`+n,i=r in e?e[r][0]:t[n];if(n===`embed`){if(i===!0)i=`@once`;else if(i===!1)i=`@never`;else if(i!==`@always`&&i!==`@never`&&i!==`@link`&&i!==`@first`&&i!==`@last`&&i!==`@once`)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:e})}return i}function m(e){if(!i.isArray(e)||e.length!==1||!i.isObject(e[0]))throw new s(`Invalid JSON-LD syntax; a JSON-LD frame must be a single object.`,`jsonld.SyntaxError`,{frame:e});if(`@id`in e[0]){for(let t of a.asArray(e[0][`@id`]))if(!(i.isObject(t)||o.isAbsolute(t))||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @id in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}if(`@type`in e[0]){for(let t of a.asArray(e[0][`@type`]))if(!(i.isObject(t)||o.isAbsolute(t)||t===`@json`)||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @type in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}}function h(e,t,n,r){let i={};for(let a of t){let t=e.graphMap[e.graph][a];g(e,t,n,r)&&(i[a]=t)}return i}function g(e,t,o,s){let c=!0,l=!1;for(let u in o){let d=!1,f=a.getValues(t,u),p=a.getValues(o,u).length===0;if(u===`@id`){if(i.isEmptyObject(o[`@id`][0]||{})?d=!0:o[`@id`].length>=0&&(d=o[`@id`].includes(f[0])),!s.requireAll)return d}else if(u===`@type`){if(c=!1,p){if(f.length>0)return!1;d=!0}else if(o[`@type`].length===1&&i.isEmptyObject(o[`@type`][0]))d=f.length>0;else for(let e of o[`@type`])i.isObject(e)&&`@default`in e?d=!0:d||=f.some(t=>t===e);if(!s.requireAll)return d}else if(n(u))continue;else{let t=a.getValues(o,u)[0],n=!1;if(t&&(m([t]),n=`@default`in t),c=!1,f.length===0&&n)continue;if(f.length>0&&p)return!1;if(t===void 0){if(f.length>0)return!1;d=!0}else if(r.isList(t)){let n=t[`@list`][0];if(r.isList(f[0])){let t=f[0][`@list`];r.isValue(n)?d=t.some(e=>x(n,e)):(r.isSubject(n)||r.isSubjectReference(n))&&(d=t.some(t=>b(e,n,t,s)))}}else d=r.isValue(t)?f.some(e=>x(t,e)):r.isSubjectReference(t)?f.some(n=>b(e,t,n,s)):i.isObject(t)?f.length>0:!1}if(!d&&s.requireAll)return!1;l||=d}return c||l}function _(e,t){let n=e.uniqueEmbeds[e.graph],r=n[t],o=r.parent,s=r.property,c={"@id":t};if(i.isArray(o)){for(let e=0;e<o.length;++e)if(a.compareValues(o[e],c)){o[e]=c;break}}else{let e=i.isArray(o[s]);a.removeValue(o,s,c,{propertyIsArray:e}),a.addValue(o,s,c,{propertyIsArray:e})}let l=e=>{let t=Object.keys(n);for(let r of t)r in n&&i.isObject(n[r].parent)&&n[r].parent[`@id`]===e&&(delete n[r],l(r))};l(t)}function v(e,t){if(i.isArray(e))return e.map(e=>v(e,t));if(i.isObject(e)){if(`@preserve`in e)return e[`@preserve`][0];if(r.isValue(e))return e;if(r.isList(e))return e[`@list`]=v(e[`@list`],t),e;if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e){if(n===`@id`&&t.bnodesToClear.includes(e[n])){delete e[`@id`];continue}e[n]=v(e[n],t)}}return e}function y(e,t,n){i.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function b(e,t,n,r){if(!(`@id`in n))return!1;let i=e.subjects[n[`@id`]];return i&&g(e,i,t,r)}function x(e,t){let n=t[`@value`],r=t[`@type`],a=t[`@language`],o=e[`@value`]?i.isArray(e[`@value`])?e[`@value`]:[e[`@value`]]:[],s=e[`@type`]?i.isArray(e[`@type`])?e[`@type`]:[e[`@type`]]:[],c=e[`@language`]?i.isArray(e[`@language`])?e[`@language`]:[e[`@language`]]:[];return o.length===0&&s.length===0&&c.length===0?!0:!(!(o.includes(n)||i.isEmptyObject(o[0]))||!(!r&&s.length===0||s.includes(r)||r&&i.isEmptyObject(s[0]))||!(!a&&c.length===0||c.includes(a)||a&&i.isEmptyObject(c[0])))}})),qn=o(((e,t)=>{var n=Tn(),{isArray:r,isObject:i,isString:a,isUndefined:o}=Cn(),{isList:s,isValue:c,isGraph:l,isSimpleGraph:u,isSubjectReference:d}=wn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=zn(),{removeBase:_,prependBase:v}=kn(),{REGEX_KEYWORD:y,addValue:b,asArray:x,compareShortestLeast:S}=En(),C={};t.exports=C,C.compact=async({activeCtx:e,activeProperty:t=null,element:f,options:_={}})=>{if(r(f)){let n=[];for(let r=0;r<f.length;++r){let i=await C.compact({activeCtx:e,activeProperty:t,element:f[r],options:_});i!==null&&n.push(i)}return _.compactArrays&&n.length===1&&(p(e,t,`@container`)||[]).length===0&&(n=n[0]),n}let v=p(e,t,`@context`);if(o(v)||(e=await h({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:_})),i(f)){if(_.link&&`@id`in f&&_.link.hasOwnProperty(f[`@id`])){let e=_.link[f[`@id`]];for(let t=0;t<e.length;++t)if(e[t].expanded===f)return e[t].compacted}if(c(f)||d(f)){let n=C.compactValue({activeCtx:e,activeProperty:t,value:f,options:_});return _.link&&d(f)&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:n})),n}if(s(f)&&(p(e,t,`@container`)||[]).includes(`@list`))return C.compact({activeCtx:e,activeProperty:t,element:f[`@list`],options:_});let v=t===`@reverse`,y={},S=e;!c(f)&&!d(f)&&(e=e.revertToPreviousContext());let w=p(S,t,`@context`);o(w)||(e=await h({activeCtx:e,localCtx:w,propagate:!0,overrideProtected:!0,options:_})),_.link&&`@id`in f&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:y}));let E=f[`@type`]||[];E.length>1&&(E=Array.from(E).sort());let D=e;for(let t of E){let n=p(S,C.compactIri({activeCtx:D,iri:t,relativeTo:{vocab:!0}}),`@context`);o(n)||(e=await h({activeCtx:e,localCtx:n,options:_,propagate:!1}))}let O=Object.keys(f).sort();for(let o of O){let d=f[o];if(o===`@id`){let t=x(d).map(t=>C.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:_.base}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});y[n]=t;continue}if(o===`@type`){let t=x(d).map(e=>C.compactIri({activeCtx:S,iri:e,relativeTo:{vocab:!0}}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),i=(p(e,n,`@container`)||[]).includes(`@set`)&&g(e,1.1)||r(t)&&d.length===0;b(y,n,t,{propertyIsArray:i});continue}if(o===`@reverse`){let t=await C.compact({activeCtx:e,activeProperty:`@reverse`,element:d,options:_});for(let n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){let r=t[n];b(y,n,r,{propertyIsArray:(p(e,n,`@container`)||[]).includes(`@set`)||!_.compactArrays}),delete t[n]}Object.keys(t).length>0&&b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),t);continue}if(o===`@preserve`){let n=await C.compact({activeCtx:e,activeProperty:t,element:d,options:_});r(n)&&n.length===0||b(y,o,n);continue}if(o===`@index`){if((p(e,t,`@container`)||[]).includes(`@index`))continue;b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(o!==`@graph`&&o!==`@list`&&o!==`@included`&&m(o)){b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(!r(d))throw new n(`JSON-LD expansion error; expanded value must be an array.`,`jsonld.SyntaxError`);if(d.length===0){let t=C.compactIri({activeCtx:e,iri:o,value:d,relativeTo:{vocab:!0},reverse:v}),n=e.mappings.has(t)?e.mappings.get(t)[`@nest`]:null,r=y;n&&(T(e,n,_),i(y[n])||(y[n]={}),r=y[n]),b(r,t,d,{propertyIsArray:!0})}for(let t of d){let n=C.compactIri({activeCtx:e,iri:o,value:t,relativeTo:{vocab:!0},reverse:v}),d=e.mappings.has(n)?e.mappings.get(n)[`@nest`]:null,f=y;d&&(T(e,d,_),i(y[d])||(y[d]={}),f=y[d]);let m=p(e,n,`@container`)||[],h=l(t),g=s(t),S;g?S=t[`@list`]:h&&(S=t[`@graph`]);let w=await C.compact({activeCtx:e,activeProperty:n,element:g||h?S:t,options:_});if(g)if(r(w)||(w=[w]),!m.includes(`@list`))w={[C.compactIri({activeCtx:e,iri:`@list`,relativeTo:{vocab:!0}})]:w},`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]);else{b(f,n,w,{valueIsArray:!0,allowDuplicate:!0});continue}if(h)if(m.includes(`@graph`)&&(m.includes(`@id`)||m.includes(`@index`)&&u(t))){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i=(m.includes(`@id`)?t[`@id`]:t[`@index`])||C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}});b(r,i,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})}else m.includes(`@graph`)&&u(t)?(r(w)&&w.length>1&&(w={"@included":w}),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})):(r(w)&&w.length===1&&_.compactArrays&&(w=w[0]),w={[C.compactIri({activeCtx:e,iri:`@graph`,relativeTo:{vocab:!0}})]:w},`@id`in t&&(w[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]=t[`@id`]),`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)}));else if(m.includes(`@language`)||m.includes(`@index`)||m.includes(`@id`)||m.includes(`@type`)){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i;if(m.includes(`@language`))c(w)&&(w=w[`@value`]),i=t[`@language`];else if(m.includes(`@index`)){let r=p(e,n,`@index`)||`@index`,o=C.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if(r===`@index`)i=t[`@index`],delete w[o];else{let e;if([i,...e]=x(w[r]||[]),!a(i))i=null;else switch(e.length){case 0:delete w[r];break;case 1:w[r]=e[0];break;default:w[r]=e;break}}}else if(m.includes(`@id`)){let t=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});i=w[t],delete w[t]}else if(m.includes(`@type`)){let r=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),a;switch([i,...a]=x(w[r]||[]),a.length){case 0:delete w[r];break;case 1:w[r]=a[0];break;default:w[r]=a;break}Object.keys(w).length===1&&`@id`in t&&(w=await C.compact({activeCtx:e,activeProperty:n,element:{"@id":t[`@id`]},options:_}))}i||=C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}}),b(r,i,w,{propertyIsArray:m.includes(`@set`)})}else{let e=!_.compactArrays||m.includes(`@set`)||m.includes(`@list`)||r(w)&&w.length===0||o===`@list`||o===`@graph`;b(f,n,w,{propertyIsArray:e})}}}return y}return f},C.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:a={vocab:!1},reverse:o=!1,base:u=null})=>{if(t===null)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);let d=e.getInverse();if(m(t)&&t in d&&`@none`in d[t]&&`@type`in d[t][`@none`]&&`@none`in d[t][`@none`][`@type`])return d[t][`@none`][`@type`][`@none`];if(a.vocab&&t in d){let n=e[`@language`]||`@none`,a=[];i(r)&&`@index`in r&&!(`@graph`in r)&&a.push(`@index`,`@index@set`),i(r)&&`@preserve`in r&&(r=r[`@preserve`][0]),l(r)?(`@index`in r&&a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r&&a.push(`@graph@id`,`@graph@id@set`),a.push(`@graph`,`@graph@set`,`@set`),`@index`in r||a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r||a.push(`@graph@id`,`@graph@id@set`)):i(r)&&!c(r)&&a.push(`@id`,`@id@set`,`@type`,`@set@type`);let u=`@language`,d=`@null`;if(o)u=`@type`,d=`@reverse`,a.push(`@set`);else if(s(r)){`@index`in r||a.push(`@list`);let e=r[`@list`];if(e.length===0)u=`@any`,d=`@none`;else{let t=e.length===0?n:null,r=null;for(let n=0;n<e.length;++n){let i=e[n],a=`@none`,o=`@none`;if(c(i)?`@direction`in i?a=`${(i[`@language`]||``).toLowerCase()}_${i[`@direction`]}`:`@language`in i?a=i[`@language`].toLowerCase():`@type`in i?o=i[`@type`]:a=`@null`:o=`@id`,t===null?t=a:a!==t&&c(i)&&(t=`@none`),r===null?r=o:o!==r&&(r=`@none`),t===`@none`&&r===`@none`)break}t||=`@none`,r||=`@none`,r===`@none`?d=t:(u=`@type`,d=r)}}else{if(c(r))if(`@language`in r&&!(`@index`in r)){a.push(`@language`,`@language@set`),d=r[`@language`];let e=r[`@direction`];e&&(d=`${d}_${e}`)}else `@direction`in r&&!(`@index`in r)?d=`_${r[`@direction`]}`:`@type`in r&&(u=`@type`,d=r[`@type`]);else u=`@type`,d=`@id`;a.push(`@set`)}a.push(`@none`),i(r)&&!(`@index`in r)&&a.push(`@index`,`@index@set`),c(r)&&Object.keys(r).length===1&&a.push(`@language`,`@language@set`);let f=w(e,t,r,a,u,d);if(f!==null)return f}if(a.vocab&&`@vocab`in e){let n=e[`@vocab`];if(t.indexOf(n)===0&&t!==n){let r=t.substr(n.length);if(!e.mappings.has(r))return r}}let f=null,p=[],h=e.fastCurieMap,g=t.length-1;for(let e=0;e<g&&t[e]in h;++e)h=h[t[e]],``in h&&p.push(h[``][0]);for(let n=p.length-1;n>=0;--n){let i=p[n],a=i.terms;for(let n of a){let a=n+`:`+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(a)||r===null&&e.mappings.get(a)[`@id`]===t)&&(f===null||S(a,f)<0)&&(f=a)}}if(f!==null)return f;for(let[r,i]of e.mappings)if(i&&i._prefix&&t.startsWith(r+`:`))throw new n(`Absolute IRI "${t}" confused with prefix "${r}".`,`jsonld.SyntaxError`,{code:`IRI confused with prefix`,context:e});if(!a.vocab)if(`@base`in e)if(e[`@base`]){let n=_(v(u,e[`@base`]),t);return y.test(n)?`./${n}`:n}else return t;else return _(u,t);return t},C.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){let r=p(e,t,`@type`),i=p(e,t,`@language`),o=p(e,t,`@direction`),s=p(e,t,`@container`)||[],c=`@index`in n&&!s.includes(`@index`);if(!c&&r!==`@none`&&(n[`@type`]===r||`@language`in n&&n[`@language`]===i&&`@direction`in n&&n[`@direction`]===o||`@language`in n&&n[`@language`]===i||`@direction`in n&&n[`@direction`]===o))return n[`@value`];let l=Object.keys(n).length,u=l===1||l===2&&`@index`in n&&!c,d=`@language`in e,f=a(n[`@value`]),m=e.mappings.has(t)&&e.mappings.get(t)[`@language`]===null;if(u&&r!==`@none`&&(!d||!f||m))return n[`@value`];let h={};return c&&(h[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=n[`@index`]),`@type`in n?h[C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}})]=C.compactIri({activeCtx:e,iri:n[`@type`],relativeTo:{vocab:!0}}):`@language`in n&&(h[C.compactIri({activeCtx:e,iri:`@language`,relativeTo:{vocab:!0}})]=n[`@language`]),`@direction`in n&&(h[C.compactIri({activeCtx:e,iri:`@direction`,relativeTo:{vocab:!0}})]=n[`@direction`]),h[C.compactIri({activeCtx:e,iri:`@value`,relativeTo:{vocab:!0}})]=n[`@value`],h}let i=f(e,t,{vocab:!0},r),o=p(e,t,`@type`),s=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:o===`@vocab`},base:r.base});return o===`@id`||o===`@vocab`||i===`@graph`?s:{[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]:s}};function w(e,t,n,r,a,o){o===null&&(o=`@null`);let s=[];if((o===`@id`||o===`@reverse`)&&i(n)&&`@id`in n){o===`@reverse`&&s.push(`@reverse`);let t=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)[`@id`]===n[`@id`]?s.push.apply(s,[`@vocab`,`@id`]):s.push.apply(s,[`@id`,`@vocab`])}else{s.push(o);let e=s.find(e=>e.includes(`_`));e&&s.push(e.replace(/^[^_]+_/,`_`))}s.push(`@none`);let c=e.inverse[t];for(let e of r){if(!(e in c))continue;let t=c[e][a];for(let e of s)if(e in t)return t[e]}return null}function T(e,t,r){if(f(e,t,{vocab:!0},r)!==`@nest`)throw new n(`JSON-LD compact error; nested property must have an @nest value resolving to @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`})}})),Jn=o(((e,t)=>{t.exports=e=>{class t{toString(){return`[object JsonLdProcessor]`}}return Object.defineProperty(t,`prototype`,{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,`constructor`,{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(TypeError(`Could not compact, too few arguments.`)):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not expand, too few arguments.`)):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not flatten, too few arguments.`)):e.flatten(t)},t}})),Yn=o(((e,t)=>{var n=Sn(),r=jn(),i=En(),a=In(),o=i.IdentifierIssuer,s=Tn(),c=Pn(),l=Ln(),{expand:u}=Bn(),{flatten:d}=Hn(),{fromRDF:f}=Un(),{toRDF:p}=Gn(),{frameMergedOrDefault:m,cleanupNull:h}=Kn(),{isArray:g,isObject:_,isString:v}=Cn(),{isSubjectReference:y}=wn(),{expandIri:b,getInitialContext:x,process:S,processingMode:C}=zn(),{compact:w,compactIri:T}=qn(),{createNodeMap:E,createMergedNodeMap:D,mergeNodeMaps:O}=Vn(),{logEventHandler:k,logWarningEventHandler:A,safeEventHandler:j,setDefaultEventHandler:M,setupEventHandler:N,strictEventHandler:P,unhandledEventHandler:F}=Rn(),I=function(e){let t={},I=new c({max:100});e.compact=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not compact, too few arguments.`);if(n===null)throw new s(`The compaction context must not be null.`,`jsonld.CompactError`,{code:`invalid local context`});if(t===null)return null;r=R(r,{base:v(t)?t:``,compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o(`_:b`),contextResolver:new a({sharedCache:I})}),r.link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base;let c;c=r.skipExpansion?t:await e.expand(t,r);let l=await e.processContext(x(r),n,r),u=await w({activeCtx:l,element:c,options:r});r.compactArrays&&!r.graph&&g(u)?u.length===1?u=u[0]:u.length===0&&(u={}):r.graph&&_(u)&&(u=[u]),_(n)&&`@context`in n&&(n=n[`@context`]),n=i.clone(n),g(n)||(n=[n]);let d=n;n=[];for(let e=0;e<d.length;++e)(!_(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);let f=n.length>0;if(n.length===1&&(n=n[0]),g(u)){let e=T({activeCtx:l,iri:`@graph`,relativeTo:{vocab:!0}}),t=u;u={},f&&(u[`@context`]=n),u[e]=t}else if(_(u)&&f){let e=u;u={"@context":n};for(let t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw TypeError(`Could not expand, too few arguments.`);n=R(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:I})});let r={},o=[];if(`expandContext`in n){let e=i.clone(n.expandContext);_(e)&&`@context`in e?r.expandContext=e:r.expandContext={"@context":e},o.push(r.expandContext)}let s;if(!v(t))r.input=i.clone(t);else{let i=await e.get(t,n);s=i.documentUrl,r.input=i.document,i.contextUrl&&(r.remoteContext={"@context":i.contextUrl},o.push(r.remoteContext))}`base`in n||(n.base=s||``);let c=x(n);for(let e of o)c=await S({activeCtx:c,localCtx:e,options:n});let l=await u({activeCtx:c,element:r.input,options:n});return _(l)&&`@graph`in l&&Object.keys(l).length===1?l=l[`@graph`]:l===null&&(l=[]),g(l)||(l=[l]),l},e.flatten=async function(t,n,r){if(arguments.length<1)return TypeError(`Could not flatten, too few arguments.`);typeof n==`function`?n=null:n||=null,r=R(r,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})});let i=d(await e.expand(t,r));return n===null?i:(r.graph=!0,r.skipExpansion=!0,await e.compact(i,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not frame, too few arguments.`);if(r=R(r,{base:v(t)?t:``,embed:`@once`,explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:I})}),v(n)){let t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n[`@context`];e?g(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n[`@context`]=e}}let i=n&&n[`@context`]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty(`omitGraph`)||(r.omitGraph=C(o,1.1)),r.hasOwnProperty(`pruneBlankNodeIdentifiers`)||(r.pruneBlankNodeIdentifiers=C(o,1.1));let s=await e.expand(t,r),c={...r};c.isFrame=!0,c.keepFreeFloatingNodes=!0;let l=await e.expand(n,c);c.merged=!Object.keys(n).map(e=>b(o,e,{vocab:!0})).includes(`@graph`),c.is11=C(o,1.1);let u=m(s,l,c);c.graph=!r.omitGraph,c.skipExpansion=!0,c.link={},c.framing=!0;let d=await e.compact(u,i,c);return c.link={},d=h(d,c),d},e.link=async function(t,n,r){let i={};return n&&(i[`@context`]=n),i[`@embed`]=`@link`,e.frame(t,i,r)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw TypeError(`Could not canonize, too few arguments.`);r=R(r,{skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:I})});let i=Object.assign({},{algorithm:`RDFC-1.0`},r.canonizeOptions||null);if(`inputFormat`in r){if(r.inputFormat!==`application/n-quads`)throw new s(`Unknown canonicalization input format.`,`jsonld.CanonizeError`);let e=l.parse(t);return n.canonize(e,i)}let o={...r};delete o.format,delete o.canonizeOptions,o.produceGeneralizedRdf=!1;let c=await e.toRDF(t,o);return n.canonize(c,i)},e.fromRDF=async function(e,n){if(arguments.length<1)throw TypeError(`Could not convert from RDF, too few arguments.`);n=R(n,{format:v(e)?`application/n-quads`:void 0});let{format:r}=n,{rdfParser:i}=n;if(r){if(i||=t[r],!i)throw new s(`Unknown input format.`,`jsonld.UnknownFormat`,{format:r})}else i=()=>e;return f(await i(e),n)},e.toRDF=async function(t,n){if(arguments.length<1)throw TypeError(`Could not convert to RDF, too few arguments.`);n=R(n,{skipExpansion:!1,contextResolver:new a({sharedCache:I})});let r;r=n.skipExpansion?t:await e.expand(t,n);let i=p(r,n);if(n.format){if(n.format===`application/n-quads`)return l.serialize(i);throw new s(`Unknown output format.`,`jsonld.UnknownFormat`,{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw TypeError(`Could not create node map, too few arguments.`);return n=R(n,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})}),D(await e.expand(t,n),n)},e.merge=async function(t,n,r){if(arguments.length<1)throw TypeError(`Could not merge, too few arguments.`);if(!g(t))throw TypeError(`Could not merge, "docs" must be an array.`);typeof n==`function`?n=null:n||=null,r=R(r,{contextResolver:new a({sharedCache:I})});let s=await Promise.all(t.map(t=>{let n={...r};return e.expand(t,n)})),c=!0;`mergeNodes`in r&&(c=r.mergeNodes);let l=r.issuer||new o(`_:b`),u={"@default":{}};for(let e=0;e<s.length;++e){let t=i.relabelBlankNodes(s[e],{issuer:new o(`_:b`+e+`-`)}),n=c||e===0?u:{"@default":{}};if(E(t,n,`@default`,l),n!==u)for(let e in n){let t=n[e];if(!(e in u)){u[e]=t;continue}let r=u[e];for(let e in t)e in r||(r[e]=t[e])}}let d=O(u),f=[],p=Object.keys(d).sort();for(let e=0;e<p.length;++e){let t=d[p[e]];y(t)||f.push(t)}return n===null?f:(r.graph=!0,r.skipExpansion=!0,await e.compact(f,n,r))},Object.defineProperty(e,`documentLoader`,{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new s(`Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:e})},e.get=async function(t,n){let r;r=typeof n.documentLoader==`function`?n.documentLoader:e.documentLoader;let i=await r(t);try{if(!i.document)throw new s(`No remote document found at the given URL.`,`jsonld.NullRemoteDocument`);v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new s(`Could not retrieve a JSON-LD document from the URL.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=R(n,{base:``,contextResolver:new a({sharedCache:I})}),t===null?x(n):(t=i.clone(t),_(t)&&`@context`in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=zn().getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new s(`Unknown document loader type: "`+t+`"`,`jsonld.UnknownDocumentLoader`,{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser(`application/n-quads`,l.parse),e.url=kn(),e.logEventHandler=k,e.logWarningEventHandler=A,e.safeEventHandler=j,e.setDefaultEventHandler=M,e.strictEventHandler=P,e.unhandledEventHandler=F,e.util=i,Object.assign(e,i),e.promises=e,e.RequestQueue=On(),e.JsonLdProcessor=Jn()(e),r.setupGlobals(e),r.setupDocumentLoaders(e);function R(t,{documentLoader:n=e.documentLoader,...r}){if(t&&`compactionMap`in t)throw new s(`"compactionMap" not supported.`,`jsonld.OptionsError`);if(t&&`expansionMap`in t)throw new s(`"expansionMap" not supported.`,`jsonld.OptionsError`);return Object.assign({},{documentLoader:n},r,t,{eventHandler:N({options:t})})}return e},R=function(){return I(function(){return R()})};I(R),t.exports=R})),Xn=fn(),Zn=l(Yn(),1),Qn={},$n={};function er(e){let t=new Set;for(let n of e.getQuads(null,K,null,yt))n.subject.termType===`NamedNode`&&t.add(n.subject.value);if(t.size===1)return t.values().next().value}function tr(e,t){let n=k.namedNode(t);for(let t of e.getObjects(n,K,yt))if(t.termType===`NamedNode`&&e.getQuads(t,bt,Et,null).length>0)return t}async function nr(e){let t={store:new st,importedUrls:[],atts:e},n=[];if(e.shapes?n.push(rr(ar(e.shapes),t,vt)):e.shapesUrl&&n.push(rr(ir(e.shapesUrl,t.atts.proxy),t,vt)),e.values?n.push(rr(ar(e.values),t,yt)):e.valuesUrl&&n.push(rr(ir(e.valuesUrl,t.atts.proxy),t,yt)),await Promise.all(n),e.classInstanceProvider)try{let n=Gt(t.store),r=await e.classInstanceProvider(n);r&&await rr(ar(r),t,vt)}catch(e){console.error(`failed loading class instances`,e)}if(e.valuesSubject||=er(t.store)||null,e.valuesSubject&&t.store.countQuads(null,null,null,vt)===0){let n=[...t.store.getObjects(e.valuesSubject,bt,yt),...t.store.getObjects(e.valuesSubject,K,yt)],r=[];for(let e of n){let n=or(e.value);!n&&e.value.startsWith(`urn:`)&&t.atts.proxy&&(n=e.value),n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),r.push(rr(ir(n,t.atts.proxy),t,vt)))}try{await Promise.allSettled(r)}catch(e){console.warn(e)}}return t.store}async function rr(e,t,n){let r=await e,i=[];for(let e of r){let r=n;if(t.atts.valuesSubject&&yt.equals(n)&&e.graph.id&&e.graph.id!==t.atts.valuesSubject&&(r=e.graph),t.store.add(k.quad(e.subject,e.predicate,e.object,r)),t.atts.loadOwlImports&&Ct.equals(e.predicate)){let n=or(e.object.value);n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),i.push(rr(ir(n,t.atts.proxy),t,k.namedNode(n))))}}await Promise.allSettled(i)}async function ir(e,t){return e in Qn||(Qn[e]=(async()=>{let n=e;t&&(n=t+encodeURIComponent(e));let r=await fetch(n,{headers:{Accept:`text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json`}});return r.ok?ar(await r.text()):(console.warn(`failed fetching RDF from`,e),[])})()),Qn[e]}async function ar(e){if(!e.trim())return[];let t=sr(e);if(t===`json`)try{e=await Zn.default.toRDF(JSON.parse(e),{format:`application/n-quads`})}catch(e){console.error(e)}let n=[];return await new Promise((r,i)=>{let a=t===`xml`?new Xn.RdfXmlParser:new ut;a.on(`data`,e=>{n.push(k.quad(e.subject,e.predicate,e.object,e.graph))}).on(`error`,e=>{i(e)}).on(`prefix`,(e,t)=>{e&&($n[e]=t)}).on(`end`,()=>{r(null)}),a.write(e),a.end()}),n}function or(e){if(Ut(e))return e;let t=e.split(`:`);if(t.length===2){let n=$n[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),Ut(e)))return e}return null}function sr(e){return/^\s*[\\[{]/.test(e)?`json`:/^\s*<\?xml/.test(e)?`xml`:`ttl`}var cr={[`${W}name`]:(e,t)=>{let n=t;e.name=q(e.config.languages,e.name,n)},[`${W}description`]:(e,t)=>{let n=t;e.description=q(e.config.languages,e.description,n)},[`${W}path`]:(e,t)=>{e.path=t.value},[`${W}group`]:(e,t)=>{e.group=t.id},[`${W}datatype`]:(e,t)=>{e.datatype=t},[`${W}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${W}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${W}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${W}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${W}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${W}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${W}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${W}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${W}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${W}pattern`]:(e,t)=>{e.pattern=t.value},[`${W}order`]:(e,t)=>{e.order=parseInt(t.value)},[`${dt}singleLine`]:(e,t)=>{e.singleLine=t.value===`true`},[`${dt}readonly`]:(e,t)=>{e.readonly=t.value===`true`},[`${G}styleClass`]:(e,t)=>{e.cssClass=t.value},[`${W}in`]:(e,t)=>{e.in=t.value},[`${W}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=xt},[`${W}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${W}hasValue`]:(e,t)=>{e.hasValue=t},[`${W}node`]:(e,t)=>{e.node=t,e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${W}and`]:(e,t)=>{e.and=t.value;let n=e.config.lists[e.and];if(n?.length)for(let t of n)e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${W}qualifiedValueShape`]:(e,t)=>{let n=e.config.getNodeTemplate(t,e);e.qualifiedValueShape=n,e.nodeShapes.add(n)},[`${W}qualifiedMinCount`]:(e,t)=>{e.qualifiedMinCount=parseInt(t.value)},[`${W}qualifiedMaxCount`]:(e,t)=>{e.qualifiedMaxCount=parseInt(t.value)},[Ct.id]:(e,t)=>{e.owlImports.add(t)},[kt.id]:(e,t)=>{e.class=t;let n=e.config.store.getSubjects(jt,t,null);n.length>0&&(e.node=n[0])},[`${W}or`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.or=n:console.error(`list for sh:or not found:`,t.value,`existing lists:`,e.config.lists)},[`${W}xone`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.xone=n:console.error(`list for sh:xone not found:`,t.value,`existing lists:`,e.config.lists)}},lr=class{constructor(e,t){this.label=``,this.nodeShapes=new Set,this.owlImports=new Set,this.id=e,this.parent=t,this.config=t.config,this.config.registerPropertyTemplate(this),pr(this,this.config.store.getQuads(e,null,null,null))}};function ur(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}function dr(e){return Math.min(e.maxCount??2**53-1,e.qualifiedMaxCount??2**53-1)}function fr(e){let t=Object.assign({},e);return t.nodeShapes=new Set(e.nodeShapes),t.owlImports=new Set(e.owlImports),e.languageIn&&(t.languageIn=[...e.languageIn]),e.or&&(t.or=[...e.or]),e.xone&&(t.xone=[...e.xone]),t}function pr(e,t){for(let n of t)cr[n.predicate.id]?.call(e,e,n.object);return e.label=e.name?.value||Rt(t,e.config.languages),e.label||=e.path?Bt(e.path,$n):`unknown`,e}function mr(e,t){let n=t,r=e;for(let e in t)if(e!==`parent`&&e!==`config`&&e!==`id`){let t=n[e];if(t!==void 0&&t!==``)if(Array.isArray(t)){let n=r[e];Array.isArray(n)?n.push(...t):r[e]=[...t]}else if(t instanceof Set&&t.size){let n=r[e];r[e]=new Set([...n instanceof Set?n:[],...t])}else r[e]=t}}function hr(e,t,n){let r=document.createElement(`div`);r.classList.add(`shacl-or-constraint`),r.setAttribute(`part`,`constraint`);let i=[];if(t instanceof ls){let a=[],o=!1;e.length&&(o=n.store.countQuads(e[0],Ot,null,null)>0);for(let r=0;r<e.length;r++)if(o){let o=n.store.getObjects(e[r],Ot,null),s=[],c=``;for(let e of o){let r=new Xo(n.getPropertyTemplate(e,t.template),t);s.push(r),c+=(c.length>0?` / `:``)+r.template.label}a.push(s),i.push({label:c,value:r.toString()})}else{let o=e[r],s=new Xo(n.getPropertyTemplate(o,t.template),t);a.push([s]),i.push({label:s.template.label,value:r.toString()})}let s=n.theme.createListEditor(`Please choose`,null,!1,i);s.setAttribute(`part`,`constraint-editor`);let c=s.querySelector(`.editor`);c.onchange=()=>{if(c.value){let e=a[parseInt(c.value)],t;e.length&&(t=e[0],r.replaceWith(e[0]),t.updateControls());for(let n=1;n<e.length;n++)t.after(e[n]),t=e[n],t.updateControls()}},r.appendChild(s)}else{let a=[];for(let t=0;t<e.length;t++){let r=n.store.getQuads(e[t],null,null,null);if(r.length){a.push(r);let e=Rt(r,n.languages);for(let t of r)t.predicate.equals(At)&&(e=Rt(n.store.getQuads(t.object,null,null,null),n.languages));i.push({label:e||Bt(r[0].predicate.value,$n)+` = `+Bt(r[0].object.value,$n),value:t.toString()})}}let o=n.theme.createListEditor(t.template.label+`?`,null,!1,i,t.template);o.setAttribute(`part`,`constraint-editor`);let s=o.querySelector(`.editor`);s.onchange=async()=>{if(s.value){let e=await Zo(pr(fr(t.template),a[parseInt(s.value)]),void 0,!0),n=e.querySelector(`:scope > label`);n&&n.classList.add(`persistent`),r.replaceWith(e)}},r.appendChild(o)}return r}function gr(e,t,n){if(t.termType===`Literal`){let r=t.datatype;for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(t.predicate.value===`http://www.w3.org/ns/shacl#datatype`&&t.object.equals(r))return e}}else{let r=n.store.getObjects(t,bt,null);for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(r.length>0){if(t.predicate.value===`http://www.w3.org/ns/shacl#node`){for(let i of r)if(n.store.getQuads(t.object,jt,i,null).length>0)return e}if(t.predicate.equals(kt)){for(let n of r)if(t.object.equals(n))return e}}else if(t.predicate.equals(Mt)&&t.object.equals(Dt))return e}}return console.error(`couldn't resolve sh:or/sh:xone on property for value`,t),[]}function _r(e,t,n){for(let r of e){let e=!1,i=n.store.getObjects(r,Ot,null);for(let r of i){let i=n.store.getObjects(r,`${W}path`,null);for(let r of i)if(e=n.store.countQuads(t,r,null,null)>0,e)break}if(e)return i}return console.error(`couldn't resolve sh:or/sh:xone on node for value`,t),[]}var vr=`:host {
|
|
34
27
|
--shacl-font-family: inherit;
|
|
35
28
|
--shacl-font-size: 14px;
|
|
36
29
|
--shacl-text-color: #333;
|
|
@@ -111,10 +104,9 @@ h3 { margin-top: 0; }
|
|
|
111
104
|
.link-option { padding: 10px; }
|
|
112
105
|
.link-option:hover { background-color: #F5F5F5; cursor: pointer; }
|
|
113
106
|
rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: min(90vw, 600px); }
|
|
114
|
-
|
|
115
|
-
`+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(n)}apply(e){}setDense(e){this.dense=e}createViewer(e,n,r){const o=document.createElement("div"),a=document.createElement("label");a.textContent=`${e}:`,r.description&&a.setAttribute("title",r.description.value),o.appendChild(a);let l=n.value,u=null;if(n instanceof bi){const h=r.config.store.getQuads(l,null,null,null);if(h.length){const g=Zn(h,r.config.languages);g&&(l=g)}}else n instanceof ln&&(n.language?(u=document.createElement("span"),u.classList.add("lang"),u.innerText=`@${n.language}`):n.datatype.value===`${Cn}date`?l=new Date(Date.parse(n.value)).toDateString():n.datatype.value===`${Cn}dateTime`&&(l=new Date(Date.parse(n.value)).toLocaleString()));let f;return El(n.value)?(f=document.createElement("a"),f.setAttribute("href",n.value)):f=document.createElement("div"),f.classList.add("d-flex"),f.innerText=l,u&&f.appendChild(u),o.appendChild(f),o}}function Vf(i,e,n){if(n){const r=Ur(i)>0;if(i.class&&!i.hasValue)return i.config.theme.createListEditor(i.label,e,r,Af(i.class,i),i);if(i.in){const o=i.config.lists[i.in];if(o?.length){const a=Lf(o,i.config.store,i.config.languages);return i.config.theme.createListEditor(i.label,e,r,a,i)}else console.error("list not found:",i.in,"existing lists:",i.config.lists)}if(i.datatype?.equals(Sf)||i.languageIn?.length||i.datatype===void 0&&e instanceof ln&&e.language)return i.config.theme.createLangStringEditor(i.label,e,r,i);switch(i.datatype?.value.replace(Cn,"")){case"integer":case"float":case"double":case"decimal":return i.config.theme.createNumberEditor(i.label,e,r,i);case"date":case"dateTime":return i.config.theme.createDateEditor(i.label,e,r,i);case"boolean":return i.config.theme.createBooleanEditor(i.label,e,r,i);case"base64Binary":return i.config.theme.createFileEditor(i.label,e,r,i)}return i.config.theme.createTextEditor(i.label,e,r,i)}else return e?i.config.theme.createViewer(i.label,e,i):document.createElement("div")}function Ym(i,e,n){if(e==="application/ld+json")return e_(i);{const r=new kl({format:e,prefixes:n});r.addQuads(i);let o="";return r.end((a,l)=>{a&&console.error(a),o=l}),o}}function e_(i){const e=[];for(const n of i){const r={"@id":n.subject.id};if(n.predicate===Rt)r["@type"]=n.object.id;else{let o=n.object.value;n.object instanceof ln?n.object.language?o={"@language":n.object.language,"@value":n.object.value}:n.object.datatype&&n.object.datatype.value!==`${Cn}#string`&&(o={"@type":n.object.datatype.value,"@value":n.object.value}):o={"@id":n.object.id},r[n.predicate.value]=o}e.push(r)}return JSON.stringify(e)}function Ud(i){let e=i.shaclDatatype,n=i.dataset.value||i.value;if(i.type==="checkbox"||i.getAttribute("type")==="checkbox"){if(i.checked||parseInt(i.dataset.minCount||"0")>0)return Be.literal(i.checked?"true":"false",e)}else if(n){if(n.startsWith("<")&&n.endsWith(">")&&n.indexOf(":")>-1)return Be.namedNode(n.substring(1,n.length-1));if(i.dataset.class||i.dataset.nodeKind===Fe+"IRI")return Be.namedNode(n);if(i.dataset.link)return JSON.parse(i.dataset.link);if(i.dataset.lang?e=i.dataset.lang:i.type==="number"?n=parseFloat(n):i.type==="file"&&i.binaryData?n=i.binaryData:i.type==="datetime-local"&&(n=new Date(n).toISOString().slice(0,19)),(!e||e instanceof bi&&im.equals(e))&&typeof n=="string"){let r=n.split("^^");r.length===2&&r[0].startsWith('"')&&r[0].endsWith('"')&&r[1].split(":").length===2?(n=r[0].substring(1,r[0].length-1),e=Be.namedNode(r[1])):(r=n.split("@"),r.length===2&&r[0].startsWith('"')&&r[0].endsWith('"')?(n=r[0].substring(1,r[0].length-1),e=r[1]):n.startsWith('"')&&n.endsWith('"')&&(n=n.substring(1,n.length-1)))}return Be.literal(n,e)}}const qr={};function t_(i){i.predicate===void 0&&i.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',i):qr[`${i.predicate}^${i.datatype}`]=i}function n_(){return Object.entries(qr).map(i=>i[1])}function i_(i,e){let n=qr[`${i}^${e}`];return n||(n=qr[`${i}^undefined`],n)?n:qr[`undefined^${e}`]}class Wf{constructor(e,n){this.predicate=e.predicate,this.datatype=e.datatype,n&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(n))}createViewer(e,n){return e.config.theme.createViewer(e.label,n,e)}}const Rs=globalThis,Zl=Rs.ShadowRoot&&(Rs.ShadyCSS===void 0||Rs.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Xl=Symbol(),Vd=new WeakMap;let Gf=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==Xl)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o;const n=this.t;if(Zl&&e===void 0){const r=n!==void 0&&n.length===1;r&&(e=Vd.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Vd.set(n,e))}return e}toString(){return this.cssText}};const Zf=i=>new Gf(typeof i=="string"?i:i+"",void 0,Xl),Ht=(i,...e)=>{const n=i.length===1?i[0]:e.reduce((r,o,a)=>r+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[a+1],i[0]);return new Gf(n,i,Xl)},r_=(i,e)=>{if(Zl)i.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of e){const r=document.createElement("style"),o=Rs.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=n.cssText,i.appendChild(r)}},Wd=Zl?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let n="";for(const r of e.cssRules)n+=r.cssText;return Zf(n)})(i):i;const{is:s_,defineProperty:o_,getOwnPropertyDescriptor:a_,getOwnPropertyNames:l_,getOwnPropertySymbols:u_,getPrototypeOf:c_}=Object,eo=globalThis,Gd=eo.trustedTypes,d_=Gd?Gd.emptyScript:"",h_=eo.reactiveElementPolyfillSupport,zr=(i,e)=>i,Bs={toAttribute(i,e){switch(e){case Boolean:i=i?d_:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let n=i;switch(e){case Boolean:n=i!==null;break;case Number:n=i===null?null:Number(i);break;case Object:case Array:try{n=JSON.parse(i)}catch{n=null}}return n}},Ql=(i,e)=>!s_(i,e),Zd={attribute:!0,type:String,converter:Bs,reflect:!1,useDefault:!1,hasChanged:Ql};Symbol.metadata??=Symbol("metadata"),eo.litPropertyMetadata??=new WeakMap;let ji=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=Zd){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){const r=Symbol(),o=this.getPropertyDescriptor(e,r,n);o!==void 0&&o_(this.prototype,e,o)}}static getPropertyDescriptor(e,n,r){const{get:o,set:a}=a_(this.prototype,e)??{get(){return this[n]},set(l){this[n]=l}};return{get:o,set(l){const u=o?.call(this);a?.call(this,l),this.requestUpdate(e,u,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Zd}static _$Ei(){if(this.hasOwnProperty(zr("elementProperties")))return;const e=c_(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(zr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(zr("properties"))){const n=this.properties,r=[...l_(n),...u_(n)];for(const o of r)this.createProperty(o,n[o])}const e=this[Symbol.metadata];if(e!==null){const n=litPropertyMetadata.get(e);if(n!==void 0)for(const[r,o]of n)this.elementProperties.set(r,o)}this._$Eh=new Map;for(const[n,r]of this.elementProperties){const o=this._$Eu(n,r);o!==void 0&&this._$Eh.set(o,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const n=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const o of r)n.unshift(Wd(o))}else e!==void 0&&n.push(Wd(e));return n}static _$Eu(e,n){const r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,n=this.constructor.elementProperties;for(const r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return r_(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,n,r){this._$AK(e,r)}_$ET(e,n){const r=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,r);if(o!==void 0&&r.reflect===!0){const a=(r.converter?.toAttribute!==void 0?r.converter:Bs).toAttribute(n,r.type);this._$Em=e,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(e,n){const r=this.constructor,o=r._$Eh.get(e);if(o!==void 0&&this._$Em!==o){const a=r.getPropertyOptions(o),l=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Bs;this._$Em=o;const u=l.fromAttribute(n,a.type);this[o]=u??this._$Ej?.get(o)??u,this._$Em=null}}requestUpdate(e,n,r,o=!1,a){if(e!==void 0){const l=this.constructor;if(o===!1&&(a=this[e]),r??=l.getPropertyOptions(e),!((r.hasChanged??Ql)(a,n)||r.useDefault&&r.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(l._$Eu(e,r))))return;this.C(e,n,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,n,{useDefault:r,reflect:o,wrapped:a},l){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,l??n??this[e]),a!==!0||l!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(n=void 0),this._$AL.set(e,n)),o===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[o,a]of r){const{wrapped:l}=a,u=this[o];l!==!0||this._$AL.has(o)||u===void 0||this.C(o,void 0,a,u)}}let e=!1;const n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(n)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(n)}willUpdate(e){}_$AE(e){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(e){}firstUpdated(e){}};ji.elementStyles=[],ji.shadowRootOptions={mode:"open"},ji[zr("elementProperties")]=new Map,ji[zr("finalized")]=new Map,h_?.({ReactiveElement:ji}),(eo.reactiveElementVersions??=[]).push("2.1.2");const Jl=globalThis,Xd=i=>i,$s=Jl.trustedTypes,Qd=$s?$s.createPolicy("lit-html",{createHTML:i=>i}):void 0,Xf="$lit$",Vn=`lit$${Math.random().toFixed(9).slice(2)}$`,Qf="?"+Vn,f_=`<${Qf}>`,xi=document,Vr=()=>xi.createComment(""),Wr=i=>i===null||typeof i!="object"&&typeof i!="function",Kl=Array.isArray,p_=i=>Kl(i)||typeof i?.[Symbol.iterator]=="function",Xa=`[
|
|
116
|
-
\f\r]`,
|
|
117
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Yd=/'/g,eh=/"/g,Jf=/^(?:script|style|textarea|title)$/i,g_=i=>(e,...n)=>({_$litType$:i,strings:e,values:n}),Ct=g_(1),Wi=Symbol.for("lit-noChange"),gt=Symbol.for("lit-nothing"),th=new WeakMap,vi=xi.createTreeWalker(xi,129);function Kf(i,e){if(!Kl(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qd!==void 0?Qd.createHTML(e):e}const m_=(i,e)=>{const n=i.length-1,r=[];let o,a=e===2?"<svg>":e===3?"<math>":"",l=Ar;for(let u=0;u<n;u++){const f=i[u];let h,g,m=-1,d=0;for(;d<f.length&&(l.lastIndex=d,g=l.exec(f),g!==null);)d=l.lastIndex,l===Ar?g[1]==="!--"?l=Jd:g[1]!==void 0?l=Kd:g[2]!==void 0?(Jf.test(g[2])&&(o=RegExp("</"+g[2],"g")),l=pi):g[3]!==void 0&&(l=pi):l===pi?g[0]===">"?(l=o??Ar,m=-1):g[1]===void 0?m=-2:(m=l.lastIndex-g[2].length,h=g[1],l=g[3]===void 0?pi:g[3]==='"'?eh:Yd):l===eh||l===Yd?l=pi:l===Jd||l===Kd?l=Ar:(l=pi,o=void 0);const _=l===pi&&i[u+1].startsWith("/>")?" ":"";a+=l===Ar?f+f_:m>=0?(r.push(h),f.slice(0,m)+Xf+f.slice(m)+Vn+_):f+Vn+(m===-2?u:_)}return[Kf(i,a+(i[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};let Tl=class Yf{constructor({strings:e,_$litType$:n},r){let o;this.parts=[];let a=0,l=0;const u=e.length-1,f=this.parts,[h,g]=m_(e,n);if(this.el=Yf.createElement(h,r),vi.currentNode=this.el.content,n===2||n===3){const m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(o=vi.nextNode())!==null&&f.length<u;){if(o.nodeType===1){if(o.hasAttributes())for(const m of o.getAttributeNames())if(m.endsWith(Xf)){const d=g[l++],_=o.getAttribute(m).split(Vn),b=/([.?@])?(.*)/.exec(d);f.push({type:1,index:a,name:b[2],strings:_,ctor:b[1]==="."?y_:b[1]==="?"?v_:b[1]==="@"?b_:to}),o.removeAttribute(m)}else m.startsWith(Vn)&&(f.push({type:6,index:a}),o.removeAttribute(m));if(Jf.test(o.tagName)){const m=o.textContent.split(Vn),d=m.length-1;if(d>0){o.textContent=$s?$s.emptyScript:"";for(let _=0;_<d;_++)o.append(m[_],Vr()),vi.nextNode(),f.push({type:2,index:++a});o.append(m[d],Vr())}}}else if(o.nodeType===8)if(o.data===Qf)f.push({type:2,index:a});else{let m=-1;for(;(m=o.data.indexOf(Vn,m+1))!==-1;)f.push({type:7,index:a}),m+=Vn.length-1}a++}}static createElement(e,n){const r=xi.createElement("template");return r.innerHTML=e,r}};function Gi(i,e,n=i,r){if(e===Wi)return e;let o=r!==void 0?n._$Co?.[r]:n._$Cl;const a=Wr(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,n,r)),r!==void 0?(n._$Co??=[])[r]=o:n._$Cl=o),o!==void 0&&(e=Gi(i,o._$AS(i,e.values),o,r)),e}let __=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:n},parts:r}=this._$AD,o=(e?.creationScope??xi).importNode(n,!0);vi.currentNode=o;let a=vi.nextNode(),l=0,u=0,f=r[0];for(;f!==void 0;){if(l===f.index){let h;f.type===2?h=new Yl(a,a.nextSibling,this,e):f.type===1?h=new f.ctor(a,f.name,f.strings,this,e):f.type===6&&(h=new w_(a,this,e)),this._$AV.push(h),f=r[++u]}l!==f?.index&&(a=vi.nextNode(),l++)}return vi.currentNode=xi,o}p(e){let n=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},Yl=class ep{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,o){this.type=2,this._$AH=gt,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=Gi(this,e,n),Wr(e)?e===gt||e==null||e===""?(this._$AH!==gt&&this._$AR(),this._$AH=gt):e!==this._$AH&&e!==Wi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):p_(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==gt&&Wr(this._$AH)?this._$AA.nextSibling.data=e:this.T(xi.createTextNode(e)),this._$AH=e}$(e){const{values:n,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Tl.createElement(Kf(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(n);else{const a=new __(o,this),l=a.u(this.options);a.p(n),this.T(l),this._$AH=a}}_$AC(e){let n=th.get(e.strings);return n===void 0&&th.set(e.strings,n=new Tl(e)),n}k(e){Kl(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let r,o=0;for(const a of e)o===n.length?n.push(r=new ep(this.O(Vr()),this.O(Vr()),this,this.options)):r=n[o],r._$AI(a),o++;o<n.length&&(this._$AR(r&&r._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){const r=Xd(e).nextSibling;Xd(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},to=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,o,a){this.type=1,this._$AH=gt,this._$AN=void 0,this.element=e,this.name=n,this._$AM=o,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=gt}_$AI(e,n=this,r,o){const a=this.strings;let l=!1;if(a===void 0)e=Gi(this,e,n,0),l=!Wr(e)||e!==this._$AH&&e!==Wi,l&&(this._$AH=e);else{const u=e;let f,h;for(e=a[0],f=0;f<a.length-1;f++)h=Gi(this,u[r+f],n,f),h===Wi&&(h=this._$AH[f]),l||=!Wr(h)||h!==this._$AH[f],h===gt?e=gt:e!==gt&&(e+=(h??"")+a[f+1]),this._$AH[f]=h}l&&!o&&this.j(e)}j(e){e===gt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},y_=class extends to{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===gt?void 0:e}},v_=class extends to{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==gt)}},b_=class extends to{constructor(e,n,r,o,a){super(e,n,r,o,a),this.type=5}_$AI(e,n=this){if((e=Gi(this,e,n,0)??gt)===Wi)return;const r=this._$AH,o=e===gt&&r!==gt||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==gt&&(r===gt||o);o&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}};class w_{constructor(e,n,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Gi(this,e)}}const x_=Jl.litHtmlPolyfillSupport;x_?.(Tl,Yl),(Jl.litHtmlVersions??=[]).push("3.3.2");const E_=(i,e,n)=>{const r=n?.renderBefore??e;let o=r._$litPart$;if(o===void 0){const a=n?.renderBefore??null;r._$litPart$=o=new Yl(e.insertBefore(Vr(),a),a,void 0,n??{})}return o._$AI(i),o};const eu=globalThis;class Gn extends ji{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=E_(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Wi}}Gn._$litElement$=!0,Gn.finalized=!0,eu.litElementHydrateSupport?.({LitElement:Gn});const S_=eu.litElementPolyfillSupport;S_?.({LitElement:Gn});(eu.litElementVersions??=[]).push("4.2.2");const cn=i=>(e,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};const T_={attribute:!0,type:String,converter:Bs,reflect:!1,hasChanged:Ql},L_=(i=T_,e,n)=>{const{kind:r,metadata:o}=n;let a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),a.set(n.name,i),r==="accessor"){const{name:l}=n;return{set(u){const f=e.get.call(this);e.set.call(this,u),this.requestUpdate(l,f,i,!0,u)},init(u){return u!==void 0&&this.C(l,void 0,i,u),u}}}if(r==="setter"){const{name:l}=n;return function(u){const f=this[l];e.call(this,u),this.requestUpdate(l,f,i,!0,u)}}throw Error("Unsupported decorator location: "+r)};function Me(i){return(e,n)=>typeof n=="object"?L_(i,e,n):((r,o,a)=>{const l=o.hasOwnProperty(a);return o.constructor.createProperty(a,r),l?Object.getOwnPropertyDescriptor(o,a):void 0})(i,e,n)}function no(i){return Me({...i,state:!0,attribute:!1})}const I_=(i,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(i,e,n),n);function Ut(i,e){return(n,r,o)=>{const a=l=>l.renderRoot?.querySelector(i)??null;return I_(n,r,{get(){return a(this)}})}}var tp=i=>{throw TypeError(i)},np=(i,e,n)=>e.has(i)||tp("Cannot "+n),Hn=(i,e,n)=>(np(i,e,"read from private field"),n?n.call(i):e.get(i)),A_=(i,e,n)=>e.has(i)?tp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,n),N_=(i,e,n,r)=>(np(i,e,"write to private field"),e.set(i,n),n),R_=Object.defineProperty,Kn=(i,e,n,r)=>{for(var o=void 0,a=i.length-1,l;a>=0;a--)(l=i[a])&&(o=l(e,n,o)||o);return o&&R_(e,n,o),o};const Ll=class extends Gn{constructor(){super(...arguments),this.dense=!1}};Ll.shadowRootOptions={...Gn.shadowRootOptions,delegatesFocus:!0},Ll.styles=[Ht`
|
|
107
|
+
`,yr=class{constructor(e){this.dense=!0;let t=vr;e&&(t+=`
|
|
108
|
+
`+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}setDense(e){this.dense=e}createViewer(e,t,n){let r=document.createElement(`div`),i=document.createElement(`label`);i.textContent=`${e}:`,n.description&&i.setAttribute(`title`,n.description.value),r.appendChild(i);let a=t.value,o=null;if(t instanceof j){let e=n.config.store.getQuads(a,null,null,null);if(e.length){let t=Rt(e,n.config.languages);t&&(a=t)}}else t instanceof M&&(t.language?(o=document.createElement(`span`),o.classList.add(`lang`),o.innerText=`@${t.language}`):t.datatype.value===`http://www.w3.org/2001/XMLSchema#date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`http://www.w3.org/2001/XMLSchema#dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let s;return Ut(t.value)?(s=document.createElement(`a`),s.setAttribute(`href`,t.value)):s=document.createElement(`div`),s.classList.add(`d-flex`),s.innerText=a,o&&s.appendChild(o),r.appendChild(s),r}};function br(e,t,n){if(n){let n=ur(e)>0;if(e.class&&!e.hasValue)return e.config.theme.createListEditor(e.label,t,n,Ht(e.class,e),e);if(e.in){let r=e.config.lists[e.in];if(r?.length){let i=zt(r,e.config.store,e.config.languages);return e.config.theme.createListEditor(e.label,t,n,i,e)}else console.error(`list not found:`,e.in,`existing lists:`,e.config.lists)}if(e.datatype?.equals(xt)||e.languageIn?.length||e.datatype===void 0&&t instanceof M&&t.language)return e.config.theme.createLangStringEditor(e.label,t,n,e);switch(e.datatype?.value.replace(ft,``)){case`integer`:case`float`:case`double`:case`decimal`:return e.config.theme.createNumberEditor(e.label,t,n,e);case`date`:case`dateTime`:return e.config.theme.createDateEditor(e.label,t,n,e);case`boolean`:return e.config.theme.createBooleanEditor(e.label,t,n,e);case`base64Binary`:return e.config.theme.createFileEditor(e.label,t,n,e)}return e.config.theme.createTextEditor(e.label,t,n,e)}else return t?e.config.theme.createViewer(e.label,t,e):document.createElement(`div`)}function xr(e,t,n){if(t===`application/ld+json`)return Sr(e);{let r=new we({format:t,prefixes:n});r.addQuads(e);let i=``;return r.end((e,t)=>{e&&console.error(e),i=t}),i}}function Sr(e){let t=[];for(let n of e){let e={"@id":n.subject.id};if(n.predicate===bt)e[`@type`]=n.object.id;else{let t=n.object.value;n.object instanceof M?n.object.language?t={"@language":n.object.language,"@value":n.object.value}:n.object.datatype&&n.object.datatype.value!==`http://www.w3.org/2001/XMLSchema##string`&&(t={"@type":n.object.datatype.value,"@value":n.object.value}):t={"@id":n.object.id},e[n.predicate.value]=t}t.push(e)}return JSON.stringify(t)}function Cr(e){let t=e.shaclDatatype,n=e.dataset.value||e.value;if(e.type===`checkbox`||e.getAttribute(`type`)===`checkbox`){if(e.checked||parseInt(e.dataset.minCount||`0`)>0)return k.literal(e.checked?`true`:`false`,t)}else if(n){if(n.startsWith(`<`)&&n.endsWith(`>`)&&n.indexOf(`:`)>-1)return k.namedNode(n.substring(1,n.length-1));if(e.dataset.class||e.dataset.nodeKind===`http://www.w3.org/ns/shacl#IRI`)return k.namedNode(n);if(e.dataset.link)return JSON.parse(e.dataset.link);if(e.dataset.lang?t=e.dataset.lang:e.type===`number`?n=parseFloat(n):e.type===`file`&&e.binaryData?n=e.binaryData:e.type===`datetime-local`&&(n=new Date(n).toISOString().slice(0,19)),(!t||t instanceof j&&Nt.equals(t))&&typeof n==`string`){let e=n.split(`^^`);e.length===2&&e[0].startsWith(`"`)&&e[0].endsWith(`"`)&&e[1].split(`:`).length===2?(n=e[0].substring(1,e[0].length-1),t=k.namedNode(e[1])):(e=n.split(`@`),e.length===2&&e[0].startsWith(`"`)&&e[0].endsWith(`"`)?(n=e[0].substring(1,e[0].length-1),t=e[1]):n.startsWith(`"`)&&n.endsWith(`"`)&&(n=n.substring(1,n.length-1)))}return k.literal(n,t)}}var wr={};function Tr(e){e.predicate===void 0&&e.datatype===void 0?console.warn(`not registering plugin because it does neither define "predicate" nor "datatype"`,e):wr[`${e.predicate}^${e.datatype}`]=e}function Er(){return Object.entries(wr).map(e=>e[1])}function Dr(e,t){let n=wr[`${e}^${t}`];return n||(n=wr[`${e}^undefined`],n)?n:wr[`undefined^${t}`]}var Or=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)}},kr=globalThis,Ar=kr.ShadowRoot&&(kr.ShadyCSS===void 0||kr.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,jr=Symbol(),Mr=new WeakMap,Nr=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==jr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Ar&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Mr.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Mr.set(t,e))}return e}toString(){return this.cssText}},Pr=e=>new Nr(typeof e==`string`?e:e+``,void 0,jr),Fr=(e,...t)=>new Nr(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,jr),Ir=(e,t)=>{if(Ar)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=kr.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},Lr=Ar?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return Pr(t)})(e):e,{is:Rr,defineProperty:zr,getOwnPropertyDescriptor:Br,getOwnPropertyNames:Vr,getOwnPropertySymbols:Hr,getPrototypeOf:Ur}=Object,Wr=globalThis,Gr=Wr.trustedTypes,Kr=Gr?Gr.emptyScript:``,qr=Wr.reactiveElementPolyfillSupport,Jr=(e,t)=>e,Yr={toAttribute(e,t){switch(t){case Boolean:e=e?Kr:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Xr=(e,t)=>!Rr(e,t),Zr={attribute:!0,type:String,converter:Yr,reflect:!1,useDefault:!1,hasChanged:Xr};Symbol.metadata??=Symbol(`metadata`),Wr.litPropertyMetadata??=new WeakMap;var Qr=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Zr){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&zr(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=Br(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Zr}static _$Ei(){if(this.hasOwnProperty(Jr(`elementProperties`)))return;let e=Ur(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Jr(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Jr(`properties`))){let e=this.properties,t=[...Vr(e),...Hr(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(Lr(e))}else e!==void 0&&t.push(Lr(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ir(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?Yr:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?Yr:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??Xr)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};Qr.elementStyles=[],Qr.shadowRootOptions={mode:`open`},Qr[Jr(`elementProperties`)]=new Map,Qr[Jr(`finalized`)]=new Map,qr?.({ReactiveElement:Qr}),(Wr.reactiveElementVersions??=[]).push(`2.1.2`);var $r=globalThis,ei=e=>e,ti=$r.trustedTypes,ni=ti?ti.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ri=`$lit$`,ii=`lit$${Math.random().toFixed(9).slice(2)}$`,ai=`?`+ii,oi=`<${ai}>`,si=document,ci=()=>si.createComment(``),li=e=>e===null||typeof e!=`object`&&typeof e!=`function`,ui=Array.isArray,di=e=>ui(e)||typeof e?.[Symbol.iterator]==`function`,fi=`[
|
|
109
|
+
\f\r]`,pi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mi=/-->/g,hi=/>/g,gi=RegExp(`>|${fi}(?:([^\\s"'>=/]+)(${fi}*=${fi}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),_i=/'/g,vi=/"/g,yi=/^(?:script|style|textarea|title)$/i,bi=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),xi=Symbol.for(`lit-noChange`),Si=Symbol.for(`lit-nothing`),Ci=new WeakMap,wi=si.createTreeWalker(si,129);function Ti(e,t){if(!ui(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return ni===void 0?t:ni.createHTML(t)}var Ei=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=pi;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===pi?c[1]===`!--`?o=mi:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=gi):(yi.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=gi):o=hi:o===gi?c[0]===`>`?(o=i??pi,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?gi:c[3]===`"`?vi:_i):o===vi||o===_i?o=gi:o===mi||o===hi?o=pi:(o=gi,i=void 0);let d=o===gi&&e[t+1].startsWith(`/>`)?` `:``;a+=o===pi?n+oi:l>=0?(r.push(s),n.slice(0,l)+ri+n.slice(l)+ii+d):n+ii+(l===-2?t:d)}return[Ti(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},Di=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Ei(t,n);if(this.el=e.createElement(l,r),wi.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=wi.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ri)){let t=u[o++],n=i.getAttribute(e).split(ii),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?Mi:r[1]===`?`?Ni:r[1]===`@`?Pi:ji}),i.removeAttribute(e)}else e.startsWith(ii)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(yi.test(i.tagName)){let e=i.textContent.split(ii),t=e.length-1;if(t>0){i.textContent=ti?ti.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],ci()),wi.nextNode(),c.push({type:2,index:++a});i.append(e[t],ci())}}}else if(i.nodeType===8)if(i.data===ai)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(ii,e+1))!==-1;)c.push({type:7,index:a}),e+=ii.length-1}a++}}static createElement(e,t){let n=si.createElement(`template`);return n.innerHTML=e,n}};function Oi(e,t,n=e,r){if(t===xi)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=li(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=Oi(e,i._$AS(e,t.values),i,r)),t}var ki=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??si).importNode(t,!0);wi.currentNode=r;let i=wi.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new Ai(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Fi(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=wi.nextNode(),a++)}return wi.currentNode=si,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},Ai=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=Si,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Oi(this,e,t),li(e)?e===Si||e==null||e===``?(this._$AH!==Si&&this._$AR(),this._$AH=Si):e!==this._$AH&&e!==xi&&this._(e):e._$litType$===void 0?e.nodeType===void 0?di(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Si&&li(this._$AH)?this._$AA.nextSibling.data=e:this.T(si.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Di.createElement(Ti(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new ki(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Ci.get(e.strings);return t===void 0&&Ci.set(e.strings,t=new Di(e)),t}k(t){ui(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(ci()),this.O(ci()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=ei(e).nextSibling;ei(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ji=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=Si,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Si}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=Oi(this,e,t,0),a=!li(e)||e!==this._$AH&&e!==xi,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=Oi(this,r[n+o],t,o),s===xi&&(s=this._$AH[o]),a||=!li(s)||s!==this._$AH[o],s===Si?e=Si:e!==Si&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===Si?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},Mi=class extends ji{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Si?void 0:e}},Ni=class extends ji{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Si)}},Pi=class extends ji{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=Oi(this,e,t,0)??Si)===xi)return;let n=this._$AH,r=e===Si&&n!==Si||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==Si&&(n===Si||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Fi=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Oi(this,e)}},Ii=$r.litHtmlPolyfillSupport;Ii?.(Di,Ai),($r.litHtmlVersions??=[]).push(`3.3.2`);var Li=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new Ai(t.insertBefore(ci(),e),e,void 0,n??{})}return i._$AI(e),i},Ri=globalThis,zi=class extends Qr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Li(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return xi}};zi._$litElement$=!0,zi.finalized=!0,Ri.litElementHydrateSupport?.({LitElement:zi});var Bi=Ri.litElementPolyfillSupport;Bi?.({LitElement:zi}),(Ri.litElementVersions??=[]).push(`4.2.2`);var Vi=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},Hi={attribute:!0,type:String,converter:Yr,reflect:!1,hasChanged:Xr},Ui=(e=Hi,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function Y(e){return(t,n)=>typeof n==`object`?Ui(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function Wi(e){return Y({...e,state:!0,attribute:!1})}var Gi=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function Ki(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return Gi(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return Gi(n,r,{get(){return a(this)}})}}var qi=e=>{throw TypeError(e)},Ji=(e,t,n)=>t.has(e)||qi(`Cannot `+n),Yi=(e,t,n)=>(Ji(e,t,`read from private field`),n?n.call(e):t.get(e)),Xi=(e,t,n)=>t.has(e)?qi(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Zi=(e,t,n,r)=>(Ji(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),Qi=Object.defineProperty,$i=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Qi(t,n,i),i},ea=class extends zi{constructor(){super(...arguments),this.dense=!1}};ea.shadowRootOptions={...zi.shadowRootOptions,delegatesFocus:!0},ea.styles=[Fr`
|
|
118
110
|
:host {
|
|
119
111
|
--rokit-primary-color-inner: var(--rokit-primary-color, #008877);
|
|
120
112
|
--rokit-primary-color-transparent-inner: color-mix(in srgb, var(--rokit-primary-color-inner) 40%, transparent);
|
|
@@ -145,11 +137,11 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
145
137
|
0% { transform: rotate(0deg); }
|
|
146
138
|
100% { transform: rotate(360deg); }
|
|
147
139
|
}
|
|
148
|
-
`];
|
|
140
|
+
`];var ta=ea;$i([Y({type:Boolean,reflect:!0})],ta.prototype,`dense`);var na,ra=class extends ta{constructor(){super(),Xi(this,na),this.value=``,this.clearable=!1,this.required=!1,this.disabled=!1,Zi(this,na,this.attachInternals())}checkValidity(){return Yi(this,na).checkValidity()}reportValidity(){let e=Yi(this,na).reportValidity();return this.classList.toggle(`invalid`,!e),e}get validity(){return Yi(this,na).validity}get validationMessage(){return Yi(this,na).validationMessage}setCustomValidity(e,t){e?Yi(this,na).setValidity({customError:!0},e,t):Yi(this,na).setValidity({})}updateValidity(e,t,n){Yi(this,na).setValidity(e,t,n)}setFormValue(e,t){Yi(this,na).setFormValue(e,t)}};na=new WeakMap,ra.formAssociated=!0,ra.styles=[...ta.styles,Fr`
|
|
149
141
|
:host { align-items: center; padding: 6px 8px; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); box-sizing: border-box; }
|
|
150
142
|
:host(:focus) { border-color: var(--rokit-primary-color-inner); }
|
|
151
143
|
:host(.invalid) { border-color: var(--rokit-error-color-inner); }
|
|
152
|
-
`];
|
|
144
|
+
`];var ia=ra;$i([Y()],ia.prototype,`name`),$i([Y()],ia.prototype,`value`),$i([Y({type:Boolean})],ia.prototype,`clearable`),$i([Y({type:Boolean})],ia.prototype,`required`),$i([Y({type:Boolean})],ia.prototype,`disabled`),$i([Y()],ia.prototype,`label`),$i([Y()],ia.prototype,`placeholder`);function aa(e){let t=e.trim();if(t.endsWith(`ms`)){let e=Number(t.slice(0,-2));return Number.isFinite(e)?e:0}if(t.endsWith(`s`)){let e=Number(t.slice(0,-1));return Number.isFinite(e)?e*1e3:0}return 0}var oa=Object.defineProperty,sa=Object.getOwnPropertyDescriptor,ca=(e,t,n,r)=>{for(var i=r>1?void 0:r?sa(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&oa(t,n,i),i},la=class extends ta{constructor(){super(...arguments),this.icon=!1,this.disabled=!1,this.href=``}render(){return this.href&&!this.disabled?bi`<a part="button loader" class="button" href="${this.href}"><slot></slot></a>`:bi`<button part="button loader" class="button" type="button" ?disabled="${this.disabled}"><slot></slot></button>`}};la.styles=[...ta.styles,Fr`
|
|
153
145
|
:host { display: inline-flex; align-items: center; }
|
|
154
146
|
:host([disabled]) { pointer-events: none; opacity: 0.5; }
|
|
155
147
|
:host([rounded]) .button { border-radius: 200px; }
|
|
@@ -194,18 +186,18 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
194
186
|
border-radius: 3px;
|
|
195
187
|
}
|
|
196
188
|
.button:hover { filter: brightness(102%); }
|
|
197
|
-
`]
|
|
189
|
+
`],ca([Y({type:Boolean,reflect:!0})],la.prototype,`icon`,2),ca([Y({type:Boolean,reflect:!0})],la.prototype,`disabled`,2),ca([Y()],la.prototype,`href`,2),la=ca([Vi(`rokit-button`)],la);var ua=Object.defineProperty,da=Object.getOwnPropertyDescriptor,fa=e=>{throw TypeError(e)},pa=(e,t,n,r)=>{for(var i=r>1?void 0:r?da(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ua(t,n,i),i},ma=(e,t,n)=>t.has(e)||fa(`Cannot `+n),ha=(e,t,n)=>(ma(e,t,`read from private field`),n?n.call(e):t.get(e)),ga=(e,t,n)=>t.has(e)?fa(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),_a=(e,t,n)=>(ma(e,t,`access private method`),n),va,ya,ba,xa,Sa,Ca=class extends ta{constructor(){super(...arguments),ga(this,ba),this.open=!1,this.disabled=!1,this.headerInactive=!1,this.transitioning=!1,this.closedBeforeTransition=!1,ga(this,va,new MutationObserver(()=>this.updateContentHeight())),ga(this,ya,new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.updateContentHeight()})),this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClickToggles=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this),this.onClickOpens=(()=>{this.toggle(!0,!0)}).bind(this)}firstUpdated(){this.transitionDuration=aa(getComputedStyle(this).getPropertyValue(`--rokit-transition-duration-inner`)),ha(this,ya).observe(this),_a(this,ba,Sa).call(this)}disconnectedCallback(){super.disconnectedCallback(),ha(this,va).disconnect(),ha(this,ya).disconnect(),_a(this,ba,xa).call(this)}updated(e){e.has(`transitioning`)&&this.classList.toggle(`transitioning`,this.transitioning),(e.has(`disabled`)||e.has(`headerInactive`))&&(this.toggleButton.disabled=this.disabled,_a(this,ba,Sa).call(this)),e.has(`open`)&&!this.transitioning&&!this.disabled&&this.toggle(this.open)}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight===void 0?this.content.scrollHeight:Math.min(this.maxHeight,this.content.scrollHeight))+`px`,this.classList.toggle(`has-content`,this.content.style.maxHeight!==`0px`)})}onSlotChange(){let e=this.shadowRoot.querySelector(`#content > slot`).assignedElements({flatten:!0});ha(this,va).disconnect();for(let t of e)ha(this,va).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0});this.updateContentHeight()}toggle(e=!this.open,t=!1){this.disabled||(this.transitioning=this.open!==e,this.open=e,this.toggleButton.classList.toggle(`down`,e),setTimeout(()=>{this.transitioning=!1,this.open&&t&&this.content.scrollIntoView({block:`nearest`})},this.transitionDuration))}render(){return bi`
|
|
198
190
|
<header part="header">
|
|
199
191
|
<slot name="prefix" part="prefix"></slot>
|
|
200
192
|
<span class="label"><slot name="label" part="label">${this.label}</slot></span>
|
|
201
193
|
<slot name="pre-suffix" part="suffix"></slot>
|
|
202
|
-
<rokit-button id="toggle" part="toggle" class="caret" icon ?dense="${this.dense}" title="${this.open
|
|
194
|
+
<rokit-button id="toggle" part="toggle" class="caret" icon ?dense="${this.dense}" title="${this.open?`Collapse`:`Expand`}"></rokit-button>
|
|
203
195
|
<slot name="suffix" part="suffix loader"></slot>
|
|
204
196
|
</header>
|
|
205
197
|
<div id="content" part="content">
|
|
206
198
|
<slot @slotchange=${this.onSlotChange}></slot>
|
|
207
199
|
</div>
|
|
208
|
-
`}};
|
|
200
|
+
`}};va=new WeakMap,ya=new WeakMap,ba=new WeakSet,xa=function(){this.header.removeEventListener(`mousedown`,this.onMouseDown),this.header.removeEventListener(`click`,this.onClickToggles),this.header.removeEventListener(`click`,this.onClickOpens),this.toggleButton.removeEventListener(`mousedown`,this.onMouseDown),this.toggleButton.removeEventListener(`click`,this.onClickToggles)},Sa=function(){if(_a(this,ba,xa).call(this),!this.disabled){if(this.headerInactive){this.toggleButton.addEventListener(`mousedown`,this.onMouseDown),this.toggleButton.addEventListener(`click`,this.onClickToggles),this.header.addEventListener(`click`,this.onClickOpens);return}this.header.addEventListener(`mousedown`,this.onMouseDown),this.header.addEventListener(`click`,this.onClickToggles)}},Ca.styles=[...ta.styles,Fr`
|
|
209
201
|
:host { display: flex; flex-direction: column; align-items: stretch; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); }
|
|
210
202
|
:host header { cursor: pointer; }
|
|
211
203
|
:host([dense]) header { padding: 2px 4px; }
|
|
@@ -217,20 +209,20 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
217
209
|
.label { flex-grow: 1; overflow: hidden; }
|
|
218
210
|
#content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
|
|
219
211
|
#toggle { margin-left: 3px; }
|
|
220
|
-
`]
|
|
212
|
+
`],pa([Y({type:Boolean,reflect:!0})],Ca.prototype,`open`,2),pa([Y()],Ca.prototype,`label`,2),pa([Y({reflect:!0})],Ca.prototype,`maxHeight`,2),pa([Y({type:Boolean})],Ca.prototype,`disabled`,2),pa([Y({type:Boolean})],Ca.prototype,`headerInactive`,2),pa([Ki(`#content`)],Ca.prototype,`content`,2),pa([Ki(`#toggle`)],Ca.prototype,`toggleButton`,2),pa([Ki(`header`)],Ca.prototype,`header`,2),pa([Wi()],Ca.prototype,`transitioning`,2),Ca=pa([Vi(`rokit-collapsible`)],Ca);var wa=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,Ea=e=>{throw TypeError(e)},Da=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ta(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&wa(t,n,i),i},Oa=(e,t,n)=>t.has(e)||Ea(`Cannot `+n),ka=(e,t,n)=>(Oa(e,t,`read from private field`),n?n.call(e):t.get(e)),Aa=(e,t,n)=>t.has(e)?Ea(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),ja=(e,t,n,r)=>(Oa(e,t,`write to private field`),t.set(e,n),n),Ma,Na,Pa=class extends ia{constructor(){super(),this.type=`text`,this.readonly=!1,this.sticky=!1,this.minWidth=80,this.autoGrowLabelWidth=!1,Aa(this,Ma,``),Aa(this,Na),this.addEventListener(`keydown`,e=>{e.code===`Escape`&&this.blur()}),this.addEventListener(`focus`,()=>{this.classList.add(`has-focus`)}),this.addEventListener(`blur`,()=>{this.inputElement.scrollLeft=0,this.classList.remove(`has-focus`)})}firstUpdated(){ja(this,Ma,this.value),this.inputElement.addEventListener(`input`,()=>{this.value=this.inputElement.value,this.updateValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0}))}),this.inputElement.addEventListener(`change`,()=>{this.value=this.inputElement.value,this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))}),this.autoGrowLabelWidth&&(ja(this,Na,new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.updateMinWidth()})),ka(this,Na).observe(this))}disconnectedCallback(){ka(this,Na)?.disconnect(),ja(this,Na,void 0),super.disconnectedCallback()}updateMinWidth(){let e=this.shadowRoot.querySelector(`.wrapper`);if(e){let t=this.shadowRoot?.querySelector(`label`)?.scrollWidth||0,n=this.minWidth>t?this.minWidth:t;e.style.minWidth=n>0?n+`px`:``}}updated(e){e.has(`label`)&&(this.classList.toggle(`has-label`,this.label!==void 0&&this.label!==``),this.autoGrowLabelWidth&&this.updateMinWidth()),e.has(`min`)&&(this.inputElement.min=this.min||``),e.has(`max`)&&(this.inputElement.max=this.max||``),e.has(`step`)&&(this.inputElement.step=this.step||``),e.has(`placeholder`)&&(this.inputElement.placeholder=this.placeholder||``),e.has(`pattern`)&&(this.inputElement.pattern=this.pattern||``),e.has(`minLength`)&&(this.inputElement.minLength=this.minLength===void 0?-1:this.minLength),e.has(`maxLength`)&&(this.inputElement.maxLength=this.maxLength===void 0?-1:this.maxLength),e.has(`value`)&&(this.classList.toggle(`has-value`,this.value!==``),this.setFormValue(this.value),this.updateValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement),this.value!==ka(this,Ma)&&ja(this,Ma,this.value))}clear(){this.disabled||(this.inputElement.value=``,this.value=``,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,composed:!0})),this.blur())}renderInput(){return bi`<input id="input" part="input" size="1" name="${this.name}" type="${this.type}" autocomplete="off" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.type===`file`?``:this.value}">`}render(){return bi`
|
|
221
213
|
<slot name="prefix" part="prefix"></slot>
|
|
222
214
|
<div class="wrapper">
|
|
223
215
|
<label for="input" part="label">${this.label}</label>
|
|
224
216
|
${this.renderInput()}
|
|
225
|
-
${this.clearable?
|
|
226
|
-
<rokit-button class="clear" icon ?dense="${this.dense}" @mousedown="${
|
|
227
|
-
`:
|
|
217
|
+
${this.clearable?bi`
|
|
218
|
+
<rokit-button class="clear" icon ?dense="${this.dense}" @mousedown="${e=>{e.preventDefault()}}" @click="${e=>{e.stopPropagation(),this.clear()}}" title="Clear"></rokit-button>
|
|
219
|
+
`:Si}
|
|
228
220
|
</div>
|
|
229
221
|
<slot name="suffix" part="suffix loader"></slot>
|
|
230
222
|
<div class="supporting-text" part="supportingText">
|
|
231
223
|
<slot name="supportingText">${this.supportingText}</slot>
|
|
232
224
|
</div>
|
|
233
|
-
`}};
|
|
225
|
+
`}};Ma=new WeakMap,Na=new WeakMap,Pa.styles=[...ia.styles,Fr`
|
|
234
226
|
:host { background-color: var(--rokit-light-background-color-inner); user-select: none; flex-wrap: wrap; }
|
|
235
227
|
:host([dense]) { padding: 2px 4px; }
|
|
236
228
|
:host(.has-focus:not([readonly])) label, :host(.has-value) label, :host([sticky]) label { font-size: 0.75em; top: 0.5em; font-weight: 600; }
|
|
@@ -245,26 +237,26 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
245
237
|
:host(.has-label:not(.has-focus):not(.has-value):not([sticky])) #input { clip-path: polygon(0 0, 0 0, 0 0, 0 0); }
|
|
246
238
|
:host(:not(.has-value)) .clear { visibility: hidden; }
|
|
247
239
|
.supporting-text { width: 100%; font-size: 0.8em; }
|
|
248
|
-
`]
|
|
240
|
+
`],Da([Y()],Pa.prototype,`type`,2),Da([Y({type:Boolean,reflect:!0})],Pa.prototype,`readonly`,2),Da([Y({type:Boolean,reflect:!0})],Pa.prototype,`sticky`,2),Da([Y()],Pa.prototype,`pattern`,2),Da([Y()],Pa.prototype,`minLength`,2),Da([Y()],Pa.prototype,`maxLength`,2),Da([Y()],Pa.prototype,`min`,2),Da([Y()],Pa.prototype,`max`,2),Da([Y()],Pa.prototype,`step`,2),Da([Y()],Pa.prototype,`minWidth`,2),Da([Y({type:Boolean})],Pa.prototype,`autoGrowLabelWidth`,2),Da([Y()],Pa.prototype,`supportingText`,2),Da([Ki(`#input`)],Pa.prototype,`inputElement`,2),Pa=Da([Vi(`rokit-input`)],Pa);var Fa=Object.defineProperty,Ia=Object.getOwnPropertyDescriptor,La=e=>{throw TypeError(e)},Ra=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ia(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Fa(t,n,i),i},za=(e,t,n)=>t.has(e)||La(`Cannot `+n),Ba=(e,t,n)=>(za(e,t,`read from private field`),n?n.call(e):t.get(e)),Va=(e,t,n)=>t.has(e)?La(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Ha=(e,t,n,r)=>(za(e,t,`write to private field`),t.set(e,n),n),Ua,Wa,Ga,Ka,qa,Ja,Ya=class extends ia{constructor(){super(),this.emptyMessage=`Nothing to select`,this.collapsibleOrientationLeft=`0`,this.collapsibleOrientationRight=`0`,this.collapsibleWidth=``,this.autoGrowLabelWidth=!1,this.fixedOpen=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,this.toggleOnHeaderClick=!0,Va(this,Ua,``),Va(this,Wa,``),Va(this,Ga,new MutationObserver(()=>this.onSlotChange())),Va(this,Ka,()=>{this.collapsible?.toggle(!0)}),Va(this,qa,e=>{let t=e.relatedTarget;t&&(t===this||this.shadowRoot?.contains(t))||(this.checkInputValue(),this.collapsible?.toggle(!1))}),Va(this,Ja,()=>{this.collapsible?.toggle(!0)}),this.addEventListener(`focusin`,Ba(this,Ka)),this.addEventListener(`focusout`,Ba(this,qa)),this.addEventListener(`input`,Ba(this,Ja))}disconnectedCallback(){Ba(this,Ga).disconnect(),this.removeEventListener(`focusin`,Ba(this,Ka)),this.removeEventListener(`focusout`,Ba(this,qa)),this.removeEventListener(`input`,Ba(this,Ja)),super.disconnectedCallback()}firstUpdated(){Ha(this,Ua,this.value),Ha(this,Wa,getComputedStyle(this).getPropertyValue(`--rokit-list-indent-inner`)),this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight===void 0?getComputedStyle(this).getPropertyValue(`--rokit-list-max-height-inner`):this.collapsibleMaxHeight),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(e){if(e.has(`selectedItem`)){let e=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):``,this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.title||(this.input.title=this.input.value),this.classList.toggle(`has-value`,this.value!==``),this.setFormValue(this.value),this.required&&this.value===``?this.updateValidity({valueMissing:!0},`Please select a value`,this.listContainer):this.updateValidity(),e!==this.value&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0}))}e.has(`value`)&&this.selectItem(this.findItem(this.value)),e.has(`disabled`)&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled),e.has(`supportingText`)&&(this.input.supportingText=this.supportingText),(e.has(`filterableThreshold`)||e.has(`itemCount`))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold,this.toggleOnHeaderClick=this.input.readonly),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?`none`:``),e.has(`fixedOpen`)&&(this.collapsible.open=this.fixedOpen,this.collapsible.disabled=this.fixedOpen)}checkInputValue(e=!0){if(this.input.value){if(this.selectedItem&&this.itemText(this.selectedItem)===this.input.value)return;let e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}e&&(this.input.value=``,this.input.title=``,Ha(this,Ua,``),this.selectItem(null,!1))}filter(e){e=e.toLowerCase();let t=!0;for(let n of this.listContainer.querySelectorAll(`li`))if(n.id!==`noresult`){let r=this.itemText(n).toLowerCase().indexOf(e)==-1&&(!n.dataset.value||n.dataset.value.toLowerCase().indexOf(e)==-1);n.classList.toggle(`hidden`,r),this.collapse&&(n.classList.remove(`open`),n.querySelector(`ul`)?.classList.remove(`open`)),r||(t=!1)}for(let n of this.listContainer.querySelectorAll(`li:has(li:not(.hidden))`))n.classList.remove(`hidden`),e&&this.collapse&&(n.classList.add(`open`),n.querySelector(`ul`)?.classList.add(`open`)),t=!1;this.highlightItem(null),this.listContainer.querySelector(`#noresult`)?.classList.toggle(`hidden`,!t)}selectItem(e,t=!0,n=!1){e?.getAttribute(`disabled`)!==null&&(e=null),this.selectedItem=e,this.filter(``),this.highlightItem(e,!1),t&&this.value&&Ha(this,Ua,this.value),n&&setTimeout(()=>this.blur())}findItem(e){let t=null;if(e)for(let n of this.listContainer.querySelectorAll(`li`)){if(n.dataset.value===e)return n;this.itemText(n)===e&&(t=n)}return t}highlightItem(e,t=!0){if(this.listContainer.querySelector(`li.active`)?.classList.remove(`active`),e){if(t&&this.listContainer.focus(),e.classList.add(`active`),this.collapse)for(let t=e.closest(`ul`);t;t=t.parentElement.closest(`ul`))t.classList.add(`open`),t.closest(`li`)?.classList.add(`open`);this.collapsible.open&&e.scrollIntoView({block:`nearest`})}}highlightNextItem(){let e=this.listContainer.querySelector(`li.active`),t=e,n=this.listContainer.querySelectorAll(`ul.open > li:not([disabled]):not(.hidden):not(.divider)`);if(e){for(let r=0;r<n.length;r++)if(n[r]===e&&r<n.length-1){t=n[r+1];break}}else n.length>0&&(t=n[0]);this.highlightItem(t)}highlightPreviousItem(){let e=this.listContainer.querySelector(`li.active`),t=null;if(e){let n=this.listContainer.querySelectorAll(`ul.open > li:not([disabled]):not(.hidden):not(.divider)`);for(let r=0;r<n.length;r++)if(n[r]===e&&r>0){t=n[r-1];break}}this.highlightItem(t),t||this.input.focus()}itemValue(e){return e.dataset.value||this.itemText(e)||``}itemText(e){return e.querySelector(`div > div`)?.innerText||``}elementText(e){let t=``;for(let n of e.childNodes)n.nodeType==3&&(t+=n.nodeValue?.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let e=null,t=this.shadowRoot.querySelector(`#list-container-slot`).assignedElements();if(t?.length===1&&(e=Array.prototype.slice.call(t[0].querySelectorAll(`:scope > li`)),this.copyItems(e,this.listContainer),Ba(this,Ga).disconnect(),Ba(this,Ga).observe(t[0],{subtree:!0,childList:!0,characterData:!0,attributes:!0})),this.emptyMessage){let t=document.createElement(`li`);t.id=`noresult`,t.setAttribute(`disabled`,``),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),e&&e.length>0&&t.classList.add(`hidden`)}this.value=this.value||Ba(this,Ua),this.selectItem(this.findItem(this.value))}copyItems(e,t,n=0){if(this.sort!==void 0){let t=this.sort||`asc`;e=e.sort((e,n)=>t===`desc`?(this.elementText(n)||this.itemValue(n)).localeCompare(this.elementText(e)||this.itemValue(e)):(this.elementText(e)||this.itemValue(e)).localeCompare(this.elementText(n)||this.itemValue(n)))}let r=``;n>0&&(r=`calc(0.3em + ${n}*${Ba(this,Wa)})`);for(let i of e){let e=i.cloneNode();e.replaceChildren();let a=document.createElement(`div`);r&&(a.style.paddingLeft=r);let o=document.createElement(`div`);a.appendChild(o);for(let e of i.childNodes)if(e.nodeName!==`UL`){let t=e.cloneNode(!0);t.nodeType===3&&t.nodeValue&&(t.nodeValue=t.nodeValue.trim()),o.appendChild(t)}e.appendChild(a),e.title=e.title||this.itemText(e);let s=i.querySelector(`ul`);if(s?.childElementCount){let t=document.createElement(`ul`);if(e.appendChild(t),this.copyItems(Array.prototype.slice.call(s.children),t,n+1),this.collapse){let n=new la;n.dense=!0,n.icon=!0,n.classList.add(`toggle-node`,`caret`),n.addEventListener(`click`,n=>{n.stopPropagation(),e.classList.toggle(`open`),t.classList.toggle(`open`),this.collapsible.updateContentHeight()}),a.prepend(n)}else t.classList.add(`open`)}t.appendChild(e),this.itemCount++}}render(){return bi`
|
|
249
241
|
<rokit-collapsible ?dense="${this.dense}" part="collapsible" ?headerInactive="${!this.toggleOnHeaderClick}">
|
|
250
242
|
<slot name="prefix" part="prefix" slot="prefix"></slot>
|
|
251
243
|
<slot name="suffix" part="suffix loader" slot="suffix"></slot>
|
|
252
244
|
<rokit-input id="input" slot="label" exportparts="supportingText"
|
|
253
245
|
?clearable="${this.clearable}"
|
|
254
246
|
?dense="${this.dense}"
|
|
255
|
-
@change="${()=>{this.checkInputValue(this.input.inputElement.value
|
|
247
|
+
@change="${()=>{this.checkInputValue(this.input.inputElement.value===``||!this.collapsible.open)}}"
|
|
256
248
|
@input="${()=>{this.filter(this.input.inputElement.value)}}"
|
|
257
249
|
?autoGrowLabelWidth="${this.autoGrowLabelWidth}"
|
|
258
|
-
@keydown="${
|
|
250
|
+
@keydown="${e=>{switch(e.code){case`ArrowDown`:e.preventDefault(),this.highlightNextItem();break;case`Enter`:{let e=this.findItem(this.input.value);e?this.selectItem(e,!0,!0):this.filter(this.input.value);break}}}}"
|
|
259
251
|
></rokit-input>
|
|
260
252
|
<ul id="list-container" tabindex="-1" part="list" class="open"
|
|
261
|
-
@mousedown="${
|
|
262
|
-
@click="${
|
|
263
|
-
@keydown="${
|
|
253
|
+
@mousedown="${e=>{e.preventDefault()}}"
|
|
254
|
+
@click="${e=>{let t=e.target.closest(`li`);t&&t.getAttribute(`disabled`)===null&&!t.classList.contains(`divider`)&&this.selectItem(t,!0,!0)}}"
|
|
255
|
+
@keydown="${e=>{switch(e.code){case`Enter`:this.selectItem(this.listContainer.querySelector(`li.active`),!0,!0);break;case`ArrowDown`:e.preventDefault(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.highlightPreviousItem();break;case`ArrowRight`:if(this.collapse){let t=this.listContainer.querySelector(`li.active`);t&&(e.preventDefault(),t.classList.add(`open`),t.querySelector(`ul`)?.classList.add(`open`),this.collapsible.updateContentHeight())}break;case`ArrowLeft`:if(this.collapse){let t=this.listContainer.querySelector(`li.active`);t&&(e.preventDefault(),t.classList.remove(`open`),t.querySelector(`ul`)?.classList.remove(`open`),this.collapsible.updateContentHeight())}break;case`Escape`:this.listContainer.blur();break}}}">
|
|
264
256
|
</ul>
|
|
265
257
|
<slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
|
|
266
258
|
</rokit-collapsible>
|
|
267
|
-
`}};
|
|
259
|
+
`}};Ua=new WeakMap,Wa=new WeakMap,Ga=new WeakMap,Ka=new WeakMap,qa=new WeakMap,Ja=new WeakMap,Ya.styles=[...ia.styles,Fr`
|
|
268
260
|
:host { background-color: var(--rokit-light-background-color-inner); user-select: none; padding: 0; }
|
|
269
261
|
:host([dense]) {
|
|
270
262
|
li > div { padding: 4px 2px; }
|
|
@@ -295,37 +287,37 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
295
287
|
:host([collapse]) li > div > div { padding-left: 1.8em; }
|
|
296
288
|
:host([collapse]) ul:not(.open) { display: none; }
|
|
297
289
|
:host([collapse]) li:not(.open) > div > .toggle-node::part(button):before { transform: translate(0, 0) rotate(-45deg); }
|
|
298
|
-
`]
|
|
290
|
+
`],Ra([Y()],Ya.prototype,`emptyMessage`,2),Ra([Y()],Ya.prototype,`sort`,2),Ra([Y()],Ya.prototype,`collapsibleMaxHeight`,2),Ra([Y()],Ya.prototype,`collapsibleOrientationLeft`,2),Ra([Y()],Ya.prototype,`collapsibleOrientationRight`,2),Ra([Y()],Ya.prototype,`collapsibleWidth`,2),Ra([Y({type:Boolean})],Ya.prototype,`autoGrowLabelWidth`,2),Ra([Y({type:Boolean,reflect:!0})],Ya.prototype,`fixedOpen`,2),Ra([Y()],Ya.prototype,`inputMinWidth`,2),Ra([Y({type:Boolean,reflect:!0})],Ya.prototype,`collapse`,2),Ra([Y()],Ya.prototype,`filterableThreshold`,2),Ra([Y()],Ya.prototype,`supportingText`,2),Ra([Ki(`rokit-collapsible`)],Ya.prototype,`collapsible`,2),Ra([Ki(`#input`)],Ya.prototype,`input`,2),Ra([Ki(`#list-container`)],Ya.prototype,`listContainer`,2),Ra([Wi()],Ya.prototype,`selectedItem`,2),Ra([Wi()],Ya.prototype,`itemCount`,2),Ra([Wi()],Ya.prototype,`toggleOnHeaderClick`,2),Ya=Ra([Vi(`rokit-select`)],Ya);var Xa=Object.defineProperty,Za=Object.getOwnPropertyDescriptor,Qa=e=>{throw TypeError(e)},$a=(e,t,n,r)=>{for(var i=r>1?void 0:r?Za(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Xa(t,n,i),i},eo=(e,t,n)=>t.has(e)||Qa(`Cannot `+n),to=(e,t,n)=>(eo(e,t,`read from private field`),n?n.call(e):t.get(e)),no=(e,t,n)=>t.has(e)?Qa(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),ro=(e,t,n,r)=>(eo(e,t,`write to private field`),t.set(e,n),n),io,ao,oo=class extends Pa{constructor(){super(...arguments),this.resize=`none`,this.rows=3,no(this,io),no(this,ao,()=>this.autoResize())}firstUpdated(){super.firstUpdated(),this.applyDimensions(),this.applyResizeBehavior()}updated(e){super.updated(e),(e.has(`rows`)||e.has(`cols`))&&this.applyDimensions(),e.has(`resize`)&&this.applyResizeBehavior(),this.resize===`auto`&&e.has(`value`)&&this.autoResize()}disconnectedCallback(){this.inputElement?.removeEventListener(`input`,to(this,ao)),to(this,io)?.disconnect(),ro(this,io,void 0),super.disconnectedCallback()}applyDimensions(){this.inputElement.rows=this.rows,this.inputElement.cols=this.cols===void 0?20:this.cols}applyResizeBehavior(){if(this.inputElement.removeEventListener(`input`,to(this,ao)),to(this,io)?.disconnect(),ro(this,io,void 0),this.resize===`auto`){this.inputElement.style.resize=`none`,this.inputElement.addEventListener(`input`,to(this,ao)),ro(this,io,new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.autoResize()})),to(this,io).observe(this),this.autoResize();return}this.inputElement.style.resize=this.resize,this.inputElement.style.height=``}autoResize(){this.inputElement.style.height=``,this.inputElement.style.height=this.inputElement.scrollHeight+`px`}onSlotChange(){let e=this.shadowRoot.querySelector(`#content`).assignedNodes().map(e=>e.textContent).join(``);e.trim()!==``&&(this.value=e)}renderInput(){return bi`
|
|
299
291
|
<textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
|
|
300
292
|
<slot id="content" @slotchange=${this.onSlotChange}></slot>
|
|
301
|
-
`}};
|
|
293
|
+
`}};io=new WeakMap,ao=new WeakMap,oo.styles=[...Pa.styles,Fr`
|
|
302
294
|
:host, .wrapper { align-items: flex-start; }
|
|
303
295
|
#input { height: initial; }
|
|
304
296
|
#content { display: none; }
|
|
305
|
-
`]
|
|
297
|
+
`],$a([Y()],oo.prototype,`resize`,2),$a([Y({type:Number})],oo.prototype,`rows`,2),$a([Y({type:Number})],oo.prototype,`cols`,2),oo=$a([Vi(`rokit-textarea`)],oo);var so=Object.defineProperty,co=Object.getOwnPropertyDescriptor,lo=e=>{throw TypeError(e)},uo=(e,t,n,r)=>{for(var i=r>1?void 0:r?co(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&so(t,n,i),i},fo=(e,t,n)=>t.has(e)||lo(`Cannot `+n),X=(e,t,n)=>(fo(e,t,`read from private field`),n?n.call(e):t.get(e)),po=(e,t,n)=>t.has(e)?lo(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),mo=(e,t,n,r)=>(fo(e,t,`write to private field`),t.set(e,n),n),Z,ho,go,_o=18,vo=class extends Pa{constructor(){super(...arguments),this.labelFormatter=e=>String(Math.round(e*1e3)/1e3),po(this,Z,[0,1]),po(this,ho,[X(this,Z)[0],X(this,Z)[1]]),po(this,go)}firstUpdated(){super.firstUpdated(),this.sliderElement.addEventListener(`mousedown`,e=>this.onKnobDrag(e)),this.sliderElement.addEventListener(`touchstart`,e=>this.onKnobDrag(e)),new ResizeObserver(()=>{this.updateKnobPositions()}).observe(this.sliderElement)}updated(e){if(super.updated(e),e.has(`min`)&&(X(this,Z)[0]=parseFloat(this.min||`0`),X(this,Z)[1]=Math.max(X(this,Z)[0],X(this,Z)[1])),e.has(`max`)&&(X(this,Z)[1]=parseFloat(this.max||`1`),X(this,Z)[0]=Math.min(X(this,Z)[0],X(this,Z)[1])),e.has(`step`)&&mo(this,go,this.step?parseFloat(this.step):void 0),e.has(`value`)||e.has(`min`)||e.has(`max`)||e.has(`step`))if(this.value!==void 0&&this.value!==``)if(this.range!==void 0)try{let e=JSON.parse(this.value);Array.isArray(e)&&e.length===2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?mo(this,ho,[this.applyConstraints(Number(e[0])),this.applyConstraints(Number(e[1]))]):mo(this,ho,[X(this,Z)[0],X(this,Z)[1]])}catch{mo(this,ho,[X(this,Z)[0],X(this,Z)[1]])}else{let e=parseFloat(this.value);mo(this,ho,[this.applyConstraints(Number.isFinite(e)?e:X(this,Z)[0])])}else mo(this,ho,this.range===void 0?[X(this,Z)[0]]:[X(this,Z)[0],X(this,Z)[1]]);this.updateKnobPositions()}updateValidity(e,t){super.updateValidity(e,t,this.sliderElement)}chooseKnob(e){if(!this.endKnob)return this.startKnob;let t=Math.abs(e-this.startKnob.offsetLeft)<Math.abs(e-this.endKnob.offsetLeft)?this.startKnob:this.endKnob;return this.startKnob.value===this.endKnob.value&&(t.id===`start`&&t.value===X(this,Z)[0]?t=this.endKnob:t.id===`end`&&t.value===X(this,Z)[1]&&(t=this.startKnob)),t}toScreenSpace(e){let t=this.track.offsetWidth,n=X(this,Z)[1]-X(this,Z)[0];return t<=0||n<=0?0:(e-X(this,Z)[0])/n*t}toValueSpace(e){let t=this.track.offsetWidth,n=X(this,Z)[1]-X(this,Z)[0];return t<=0||n<=0?X(this,Z)[0]:e/t*n+X(this,Z)[0]}applyConstraints(e,t){let n=Math.min(Math.max(e,X(this,Z)[0]),X(this,Z)[1]);return X(this,go)&&(n=X(this,Z)[0]+Math.round((n-X(this,Z)[0])/X(this,go))*X(this,go)),t!==void 0&&this.endKnob&&(n=t?Math.min(n,this.endKnob.value):Math.max(n,this.startKnob.value)),n}updateKnob(e,t){e.id===`start`?X(this,ho)[0]=t:X(this,ho)[1]=t,e.value=t,e.offset=this.toScreenSpace(t),e.label=this.labelFormatter(t),this.endKnob&&(e.id===`start`?this.track.style.borderLeftWidth=e.offset+`px`:this.track.style.borderRightWidth=this.track.offsetWidth-e.offset+`px`)}updateKnobPositions(){this.updateKnob(this.startKnob,X(this,ho)[0]),this.endKnob&&this.updateKnob(this.endKnob,X(this,ho)[1])}onKnobDrag(e){if(e.target instanceof yo||this.classList.contains(`has-value`)||this.classList.contains(`has-focus`)){let t=this.value,n,r=e=>{let t=0;t=e.type===`touchmove`||e.type===`touchstart`?e.touches[0].clientX:e.clientX,t-=this.track.getBoundingClientRect().left,n||(n=this.chooseKnob(t),n.classList.add(`focus`)),this.updateKnob(n,this.applyConstraints(this.toValueSpace(t),n.id===`start`));let r=this.range===void 0?String(X(this,ho)[0]):JSON.stringify([X(this,ho)[0],X(this,ho)[1]]);this.value!==r&&(this.value=r,this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`touchmove`,r),document.removeEventListener(`mouseup`,i),document.removeEventListener(`touchend`,i),n&&(n.classList.remove(`focus`),this.value!==t&&this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))),n=void 0};this.sliderElement.focus(),document.addEventListener(`mousemove`,r),document.addEventListener(`touchmove`,r),document.addEventListener(`mouseup`,i),document.addEventListener(`touchend`,i),r(e)}}renderInput(){return bi`
|
|
306
298
|
${super.renderInput()}
|
|
307
299
|
<div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
|
|
308
300
|
<div id="track"></div>
|
|
309
301
|
<rokit-slider-knob id="start"></rokit-slider-knob>
|
|
310
|
-
${this.range===void 0?
|
|
302
|
+
${this.range===void 0?Si:bi`
|
|
311
303
|
<rokit-slider-knob id="end"></rokit-slider-knob>
|
|
312
304
|
`}
|
|
313
305
|
</div>
|
|
314
|
-
`}};
|
|
306
|
+
`}};Z=new WeakMap,ho=new WeakMap,go=new WeakMap,vo.styles=[...Pa.styles,Fr`
|
|
315
307
|
:host(.has-label:not(:focus):not(.has-value):not([sticky])) #slider > * { visibility: hidden; }
|
|
316
308
|
:host(.has-label) .wrapper { padding-top: 1em; }
|
|
317
|
-
:host([sticky]) #slider { margin-top: ${.25*
|
|
309
|
+
:host([sticky]) #slider { margin-top: ${.25*_o+22}px; }
|
|
318
310
|
#input { display: none; }
|
|
319
|
-
#slider { display: flex; position: relative; align-items: center; width: 100%; height: ${
|
|
311
|
+
#slider { display: flex; position: relative; align-items: center; width: 100%; height: ${_o}px; padding: 0 ${_o/2}px; outline: 0; }
|
|
320
312
|
:host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
|
|
321
313
|
#track { height: 2px; flex-grow: 1; background-color: #CCC; }
|
|
322
314
|
#slider[range] #track { background-color: color-mix(in srgb, var(--rokit-primary-color-inner) 60%, transparent); border-width: 0; border-color: #CCC; border-style: solid; }
|
|
323
|
-
`]
|
|
324
|
-
:host { position: absolute; width: ${
|
|
325
|
-
:host(.focus), :host(:hover) { box-shadow: 0 0 0 ${
|
|
315
|
+
`],uo([Y()],vo.prototype,`range`,2),uo([Y()],vo.prototype,`labelFormatter`,2),uo([Ki(`#slider`)],vo.prototype,`sliderElement`,2),uo([Ki(`#track`)],vo.prototype,`track`,2),uo([Ki(`#start`)],vo.prototype,`startKnob`,2),uo([Ki(`#end`)],vo.prototype,`endKnob`,2),vo=uo([Vi(`rokit-slider`)],vo);var yo=class extends zi{constructor(){super(...arguments),this.offset=0,this.label=``,this.value=0}updated(e){e.has(`offset`)&&(this.style.left=this.offset+`px`)}render(){return bi`<label part="label">${this.label}</label>`}};yo.styles=[Fr`
|
|
316
|
+
:host { position: absolute; width: ${_o}px; height: ${_o}px; border-radius: ${_o}px; background-color: var(--rokit-primary-color-inner); }
|
|
317
|
+
:host(.focus), :host(:hover) { box-shadow: 0 0 0 ${_o/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
|
|
326
318
|
label {
|
|
327
319
|
position: absolute;
|
|
328
|
-
top: calc(-2em - ${
|
|
320
|
+
top: calc(-2em - ${_o/4}px);
|
|
329
321
|
left: 50%;
|
|
330
322
|
transform: translate(-50%, 0);
|
|
331
323
|
white-space: nowrap;
|
|
@@ -350,51 +342,51 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
350
342
|
background-color: inherit;
|
|
351
343
|
clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
|
|
352
344
|
}
|
|
353
|
-
`]
|
|
345
|
+
`],uo([Y()],yo.prototype,`offset`,2),uo([Y()],yo.prototype,`label`,2),yo=uo([Vi(`rokit-slider-knob`)],yo);var bo=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,So=(e,t,n,r)=>{for(var i=r>1?void 0:r?xo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&bo(t,n,i),i},Co=class extends ta{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.title=``,this.previousBodyOverflow=``,this.layoutLocked=!1,this.onDialogClose=()=>{this.unlockLayout(),this.open=!1,this.dispatchEvent(new Event(`close`))}}lockLayout(){this.layoutLocked||(this.layoutLocked=!0,this.previousBodyOverflow=document.body.style.overflow,document.body.classList.add(`dialog-open`),document.body.style.overflow=`hidden`)}unlockLayout(){this.layoutLocked&&(this.layoutLocked=!1,document.body.classList.remove(`dialog-open`),document.body.style.overflow=this.previousBodyOverflow,this.previousBodyOverflow=``)}firstUpdated(){this.dialogElement.addEventListener(`close`,this.onDialogClose)}disconnectedCallback(){this.dialogElement?.removeEventListener(`close`,this.onDialogClose),this.unlockLayout(),super.disconnectedCallback()}updated(e){if(e.has(`open`)){if(this.open){this.lockLayout(),this.dialogElement.open||this.dialogElement.showModal();return}this.unlockLayout(),this.dialogElement.open&&this.dialogElement.close()}}render(){return bi`
|
|
354
346
|
<dialog id="dialog" part="dialog">
|
|
355
347
|
<header>
|
|
356
348
|
<div class="title" part="title">
|
|
357
349
|
<slot name="header">${this.title}</slot>
|
|
358
350
|
</div>
|
|
359
|
-
${this.closable?
|
|
351
|
+
${this.closable?bi`
|
|
360
352
|
<rokit-button class="clear" icon ?dense="${this.dense}" @click="${()=>{this.open=!1}}" title="Close"></rokit-button>
|
|
361
|
-
`:
|
|
353
|
+
`:Si}
|
|
362
354
|
</header>
|
|
363
355
|
<main part="main">
|
|
364
356
|
<slot></slot>
|
|
365
357
|
</main>
|
|
366
358
|
</dialog>
|
|
367
|
-
`}};
|
|
359
|
+
`}};Co.styles=[...ta.styles,Fr`
|
|
368
360
|
dialog[open] { display: flex; flex-direction: column; width: 100%; max-width: 90vw; max-height: 90vh; margin: auto; outline: 0; border: 0; border-radius: 1em; padding: 0; }
|
|
369
361
|
dialog::backdrop { background-color: #0007; }
|
|
370
362
|
header { display: flex; align-items: center; padding: 14px; }
|
|
371
363
|
.title { font-weight: 600; flex-grow: 1; text-align: center; }
|
|
372
364
|
.clear { justify-self: flex-end; }
|
|
373
365
|
main { flex-grow: 1; overflow: auto; display: flex; flex-direction: column; padding: 0 16px 14px 16px; }
|
|
374
|
-
`]
|
|
366
|
+
`],So([Y({type:Boolean,reflect:!0})],Co.prototype,`open`,2),So([Y({type:Boolean})],Co.prototype,`closable`,2),So([Y()],Co.prototype,`title`,2),So([Ki(`#dialog`)],Co.prototype,`dialogElement`,2),Co=So([Vi(`rokit-dialog`)],Co);var wo=Object.defineProperty,To=Object.getOwnPropertyDescriptor,Eo=(e,t,n,r)=>{for(var i=r>1?void 0:r?To(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&wo(t,n,i),i},Do=class extends ta{updated(e){if(e.has(`percent`)){let e=Number(this.percent);if(Number.isFinite(e)){let t=Math.min(100,Math.max(0,e));this.bar.style.width=`${t}%`}else this.bar.style.width=``}}render(){return bi`<div part="bar" class="bar ${Number.isFinite(Number(this.percent))?``:`indeterminate`}"></div>`}};Do.styles=[...ta.styles,Fr`
|
|
375
367
|
:host { display: flex; background-color: var(--rokit-primary-color-transparent-inner); color: var(--rokit-primary-color-inner); }
|
|
376
368
|
.bar { height: 3px; background-color: var(--rokit-primary-color-inner); }
|
|
377
|
-
|
|
369
|
+
.bar.indeterminate { width: 100%; --c: no-repeat linear-gradient(currentColor 0 0); background: var(--c), var(--c); background-size: 60% 100%; animation: indeterminate 3s infinite; }
|
|
378
370
|
@keyframes indeterminate {
|
|
379
371
|
0% { background-position:-150% 0,-150% 0 }
|
|
380
372
|
66% { background-position: 250% 0,-150% 0 }
|
|
381
373
|
100% { background-position: 250% 0, 250% 0 }
|
|
382
374
|
}
|
|
383
|
-
`]
|
|
375
|
+
`],Eo([Y({type:Number})],Do.prototype,`percent`,2),Eo([Ki(`.bar`)],Do.prototype,`bar`,2),Do=Eo([Vi(`rokit-progressbar`)],Do);var Oo=Object.getOwnPropertyDescriptor,ko=(e,t,n,r)=>{for(var i=r>1?void 0:r?Oo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Ao=`RokitSnackbarEvent`,jo=`0.2s`,Mo=aa(jo),No=3e3,Po=class extends zi{constructor(){super(),this.listener=e=>{e.stopImmediatePropagation(),Fo(e.detail,this)},this.container=document.createElement(`div`),this.container.classList.add(`snackbar`),this.container.setAttribute(`part`,`snackbar`)}connectedCallback(){super.connectedCallback(),this.shadowRoot.appendChild(this.container),document.addEventListener(Ao,this.listener)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(Ao,this.listener)}};Po.styles=Fr`
|
|
384
376
|
:host { display: flex; justify-content: center; width: 100%; position: fixed; bottom: 10px; pointer-events: none; }
|
|
385
377
|
:host(.left) { right: auto; left: 10px; width: auto; }
|
|
386
378
|
:host(.right) { right: 10px; left: auto; width: auto; }
|
|
387
379
|
:host(.top) { top: 10px; bottom: auto; }
|
|
388
380
|
:host(.top) .snackbar { flex-direction: column-reverse; }
|
|
389
381
|
.snackbar { display: flex; flex-direction: column; width: 300px; }
|
|
390
|
-
.message { max-height: 0; margin-bottom: 0; overflow: hidden; background-color: #333; color: #FFF; border-radius: 4px; transition: all ${
|
|
382
|
+
.message { max-height: 0; margin-bottom: 0; overflow: hidden; background-color: #333; color: #FFF; border-radius: 4px; transition: all ${Pr(jo)} ease-in-out; font-weight: 500; pointer-events: auto; }
|
|
391
383
|
.message.error { background-color: #C22; }
|
|
392
384
|
.message.success { background-color: #0a8f0a; }
|
|
393
385
|
.message:not(.closable) .text { text-align: center; }
|
|
394
386
|
.inner { display: flex; padding: 10px; }
|
|
395
387
|
.text { flex-grow: 1; word-break: break-all; }
|
|
396
388
|
.text a { color: inherit; }
|
|
397
|
-
|
|
389
|
+
`,Po=ko([Vi(`rokit-snackbar`)],Po);function Fo(e,t){t||(t=document.querySelector(`rokit-snackbar`)||void 0,t||(t=new Po,document.body.appendChild(t)));let n=document.createElement(`div`);n.classList.add(`message`);let r=document.createElement(`div`);r.classList.add(`inner`);let i=document.createElement(`div`);if(i.classList.add(`text`),i.innerHTML=e.message,r.appendChild(i),n.appendChild(r),e.closable===void 0?e.ttl===0:e.closable){n.classList.add(`closable`);let e=new la;e.setAttribute(`icon`,``),e.setAttribute(`dense`,``),e.classList.add(`clear`),e.title=`Dismiss`,e.addEventListener(`click`,()=>{a(n)}),r.append(e)}e.cssStyle&&(n.style.cssText=e.cssStyle),e.cssClass&&n.classList.add(e.cssClass),t.container.appendChild(n),setTimeout(()=>{n.style.maxHeight=n.scrollHeight+`px`,n.style.marginBottom=`10px`}),e.ttl!==0&&setTimeout(()=>{a(n)},e.ttl||No);let a=e=>{e.style.maxHeight=``,e.style.marginBottom=``,setTimeout(()=>{e.remove()},Mo)}}var Io=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Ro=(e,t,n,r)=>{for(var i=r>1?void 0:r?Lo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Io(t,n,i),i},zo=class extends ta{constructor(){super(...arguments),this.pos=`50%`,this.minPos=10,this.maxPos=90,this.dir=`horizontal`,this.sep=`4px`,this.dragging=!1,this.storageKey=``,this._restoredKey=``,this._activePointerId=null,this.posFromPointer=e=>{let t=this.getBoundingClientRect(),n=this.dir===`horizontal`?e.clientX-t.left:e.clientY-t.top,r=this.dir===`horizontal`?t.width:t.height,i=r>0?n/r*100:50;return`${Math.min(this.maxPos,Math.max(this.minPos,i))}%`},this.startDrag=e=>{e.button==0&&(this.dragging=!0,this._activePointerId=e.pointerId,e.currentTarget.setPointerCapture(e.pointerId),this.pos=this.posFromPointer(e))},this.drag=e=>{this.dragging&&this._activePointerId==e.pointerId&&(this.pos=this.posFromPointer(e))},this.endDrag=e=>{this._activePointerId==e.pointerId&&(this.dragging=!1,this._activePointerId=null)}}updated(e){if(this.storageKey||=`rokit-splitpane:${this.id||`default`}`,this.storageKey&&this.storageKey!==this._restoredKey){try{let e=localStorage.getItem(this.storageKey);e&&(this.pos=e)}catch{}this._restoredKey=this.storageKey}if(e.has(`minPos`)&&(this.minPos=Math.max(0,Math.min(100,this.minPos))),e.has(`maxPos`)&&(this.maxPos=Math.max(0,Math.min(100,this.maxPos))),this.minPos>this.maxPos&&([this.minPos,this.maxPos]=[this.maxPos,this.minPos]),(e.has(`pos`)||e.has(`dir`))&&(this.dir===`horizontal`?(this.style.gridTemplateColumns=this.template(),this.style.gridTemplateRows=``):(this.style.gridTemplateRows=this.template(),this.style.gridTemplateColumns=``),this.storageKey))try{localStorage.setItem(this.storageKey,this.pos)}catch{}}template(){return`${this.pos} ${this.sep} 1fr`}render(){return bi`
|
|
398
390
|
<div><slot name="pane1"></slot></div>
|
|
399
391
|
<div
|
|
400
392
|
id="separator"
|
|
@@ -407,7 +399,7 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
407
399
|
@pointercancel="${this.endDrag}">
|
|
408
400
|
</div>
|
|
409
401
|
<div><slot name="pane2"></slot></div>
|
|
410
|
-
`}};
|
|
402
|
+
`}};zo.styles=[...ta.styles,Fr`
|
|
411
403
|
:host { display: grid; }
|
|
412
404
|
:host([dragging]) { user-select: none; }
|
|
413
405
|
:host([dragging][dir="horizontal"]) { cursor: col-resize; }
|
|
@@ -419,24 +411,23 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
419
411
|
#separator { cursor: row-resize; }
|
|
420
412
|
}
|
|
421
413
|
#separator { background-color: var(--rokit-light-background-darker-color-inner); }
|
|
422
|
-
`];Yn([Me()],bn.prototype,"pos",2);Yn([Me()],bn.prototype,"minPos",2);Yn([Me()],bn.prototype,"maxPos",2);Yn([Me({reflect:!0})],bn.prototype,"dir",2);Yn([Me()],bn.prototype,"sep",2);Yn([Me({reflect:!0,type:Boolean})],bn.prototype,"dragging",2);Yn([Me()],bn.prototype,"storageKey",2);bn=Yn([cn("rokit-splitpane")],bn);async function iy(i){if(i.template.nodeShapes.size===0)return;const e=i.template.config.resourceLinkProvider;if((!e||e&&!e.lazyLoad)&&(await oh(i.template),sh(i).length===0))return;const n=i.template.config.theme.createButton(i.template.label,!1);n.title="Link existing "+i.template.label,n.classList.add("link-button"),n.setAttribute("text","");const r=n.getAttribute("part");return n.setAttribute("part",`${r?r+" ":""}link-button`),n.addEventListener("click",async()=>{e?.lazyLoad&&(n.classList.add("loading"),await oh(i.template),n.classList.remove("loading"));const o=sh(i);if(o.length===0)n.innerText="No linkable resources found",n.setAttribute("disabled",""),setTimeout(()=>n.remove(),2e3);else{let a=i.template.config.form.querySelector("#dialog");a||(a=new Xn,a.classList.add("link-chooser"),a.closable=!0,i.template.config.form.appendChild(a)),a.title="Link existing "+i.template.label,ry(a,i,o),a.open=!0}}),n}function ry(i,e,n){const r=document.createElement("div");for(const o of n){const a=document.createElement("div");a.classList.add("link-option"),a.title="Link this resource",a.innerText=o.label||o.value,a.addEventListener("click",()=>{sy(o.value,e),i.open=!1}),r.appendChild(a)}i.replaceChildren(r)}function sh(i){const e=[];if(i.template.config.resourceLinkProvider){for(const n of i.template.nodeShapes)if(i.template.config.providedConformingResourceIds[n.id.value])for(const r of i.template.config.providedConformingResourceIds[n.id.value])i.querySelector(`:scope > .property-instance > shacl-node[data-node-id='${r}'], :scope > .collapsible > .property-instance > shacl-node[data-node-id='${r}']`)===null&&e.push({value:r,label:Zn(i.template.config.store.getQuads(Be.namedNode(r),null,null,null),i.template.config.languages),children:[]})}return e}async function sy(i,e){const n=Be.namedNode(i);if(fp(n,e.template.config.store)){if(e.template.config.providedResources[i]?.length>0){const o={store:e.template.config.store,importedUrls:[],atts:{loadOwlImports:!1}};await Rn(Ui(e.template.config.providedResources[i]),o,an),e.template.config.providedResources[i]=""}const r=await Hs(e.template,n,!0,!0);e.container.insertBefore(r,e.querySelector(":scope > .add-button-wrapper")),await e.updateControls()}}async function oh(i){const e=i.config.resourceLinkProvider;if(!e)return;const n=new Set(Array.from(i.nodeShapes).map(o=>o.id.value));if(n.size===0)return;const r=lm(Object.keys(i.config.providedConformingResourceIds),n);if(r.length!==0)try{const o=await e.listConformingResources(r,i);if(o){for(const a of Object.keys(o)){const l=new Set(o[a]);i.config.providedConformingResourceIds[a]=l,await hp(l,!1,i.config)}for(const a of r)i.config.providedConformingResourceIds[a]||(i.config.providedConformingResourceIds[a]=new Set)}}catch(o){console.error("failed loading conforming resources",o)}}async function hp(i,e,n){if(n.resourceLinkProvider&&i.size>0){const r=[];for(const o of i)n.providedResources[o]||r.push(o);if(r.length===0)return[];try{const o=await n.resourceLinkProvider.loadResources(r);if(o){const a={store:n.store,importedUrls:[],atts:{loadOwlImports:!1}};for(const l of o)n.providedResources[l.resourceId]=l.resourceRDF,e&&await Rn(Ui(l.resourceRDF),a,an);return o}for(const a of r)n.providedResources[a]||(n.providedResources[a]="")}catch(o){console.error("failed loading resources",o)}}return[]}async function oy(i){const e=new Set;for(const n of i.store.getQuads(null,null,null,Ft))fp(n.object,i.store)&&e.add(n.object.value);await hp(e,!0,i)}function fp(i,e){return i.termType==="NamedNode"&&e.countQuads(i,null,null,null)===0}const Ka=":scope > .add-button-wrapper, :scope > .collapsible > .add-button-wrapper",ay=":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node, :scope > .collapsible > .property-instance";class zs extends HTMLElement{constructor(e,n){if(super(),this.template=e,this.parent=n,this.container=this,this.setAttribute("part","property"),this.template.nodeShapes.size&&this.template.config.attributes.collapse!==null&&(this.template.maxCount===void 0||this.template.maxCount>1)){const r=new Pt;r.classList.add("collapsible","shacl-group"),r.open=e.config.attributes.collapse==="open",r.label=this.template.label,r.setAttribute("part","collapsible"),this.container=r,this.appendChild(this.container)}this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),e.config.editMode&&!n.linked&&this.addEventListener("change",async()=>{await this.updateControls()})}async bindValues(e,n){if(this.template.path){let r=!1;if(e){let o=this.template.config.store.getQuads(e,this.template.path,null,this.parent.linked?null:Ft);n&&(o=await this.filterValidValues(o,e));for(const a of o)this.parent.linked||this.template.config.store.delete(a),await this.addPropertyInstance(a.object,!Ft.equals(a.graph)||this.template.config.providedResources[a.object.value]!==void 0,this.template.config.providedResources[a.object.value]!==void 0),this.template.hasValue&&a.object.equals(this.template.hasValue)&&(r=!0)}this.template.config.editMode&&this.template.hasValue&&!r&&!this.parent.linked&&await this.addPropertyInstance(this.template.hasValue)}}async addPropertyInstance(e,n,r=!1){let o;if(this.template.or?.length||this.template.xone?.length){const a=this.template.or?.length?this.template.or:this.template.xone;let l=!1;if(e){const u=Xm(a,e,this.template.config);if(u.length){const f=Gl(zf(this.template),u);o=await Hs(f,e,!this.parent.linked,this.parent.linked,this.parent),l=!0}}!l&&this.template.config.editMode&&(o=Uf(a,this,this.template.config),pp(o,"",this.template.config.theme.dense,this.template.config.hierarchyColorsStyleSheet!==void 0))}else o=await Hs(this.template,e,r,n||this.parent.linked,this.parent);return o&&this.container.insertBefore(o,this.querySelector(Ka)),o}async updateControls(){this.template.config.editMode&&!this.parent.linked&&!this.querySelector(Ka)&&this.container.appendChild(await this.createAddControls());const e=Ur(this.template),n=this.template.nodeShapes.size===0,r=this.querySelector(":scope > .add-button-wrapper > .link-button, :scope > .collapsible > .add-button-wrapper > .link-button")===null,o=n||!this.hasRecursiveNodeShape();let a=this.instanceCount();a===0&&o&&(n||r&&e>0)&&(await this.addPropertyInstance(),a=1),n||this.querySelector(Ka)?.classList.toggle("required",a<e);let l;e>0?l=a>e:l=!n||a>1;const u=a<Zm(this.template);this.classList.toggle("may-remove",l),this.classList.toggle("may-add",u)}instanceCount(){return this.querySelectorAll(ay).length}hasRecursiveNodeShape(){const e=new Set;this.parent.ancestorShapeIds.forEach(n=>e.add(n)),e.add(this.parent.template.id.value);for(const n of this.template.nodeShapes)if(e.has(n.id.value))return!0;return!1}toRDF(e,n){const r=Be.namedNode(this.template.path);for(const o of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance"))if(o.firstChild instanceof Li){const a=o.firstChild.toRDF(e);e.addQuad(n,r,a,this.template.config.valuesGraphId)}else if(this.template.config.editMode)for(const a of o.querySelectorAll(":scope > .editor")){const l=Ud(a);l&&e.addQuad(n,r,l,this.template.config.valuesGraphId)}else{const a=Ud(o);a&&e.addQuad(n,r,a,this.template.config.valuesGraphId)}}async filterValidValues(e,n){let r=this.template.id,o=[n];if(this.template.qualifiedValueShape){r=this.template.qualifiedValueShape.id,o=[];for(const u of e)o.push(u.object)}const a=await this.template.config.validator.validate({dataset:this.template.config.store,terms:o},[{terms:[r]}]),l=new Set;for(const u of a.results){const f=this.template.qualifiedValueShape?u.focusNode:u.value;f?.ptrs?.length&&l.add(f.ptrs[0]._term.id)}return e.filter(u=>!l.has(u.object.id))}async createAddControls(){const e=document.createElement("div");e.classList.add("add-button-wrapper"),e.setAttribute("part","add-controls");const n=await iy(this);n&&e.appendChild(n);const r=this.template.config.theme.createButton(this.template.label,!1);r.title="Add "+this.template.label,r.classList.add("add-button"),r.setAttribute("text","");const o=r.getAttribute("part");return r.setAttribute("part",`${o?o+" ":""}add-button`),r.addEventListener("click",async()=>{const a=await this.addPropertyInstance();a&&(a.classList.add("fadeIn"),await this.updateControls(),setTimeout(()=>{om(a),a.classList.remove("fadeIn")},200))}),e.appendChild(r),e}}async function Hs(i,e,n=!1,r=!1,o){let a;if(i.nodeShapes.size){a=document.createElement("div"),a.classList.add("property-instance"),a.setAttribute("part","property-instance");const l=new Set(o?.ancestorShapeIds??[]);o&&l.add(o.template.id.value);for(const u of i.nodeShapes){const f=new Li(u,e,i.nodeKind,i.label,r,l);a.appendChild(f),await f.ready}}else{const l=i_(i.path,i.datatype?.value);l?i.config.editMode&&!r?a=l.createEditor(i,e):a=l.createViewer(i,e):a=Vf(i,e||null,i.config.editMode&&!r),a.childNodes.length>0&&(a.classList.add("property-instance"),a.setAttribute("part","property-instance")),r&&a.classList.add("linked")}return i.config.editMode&&(!r||n)?pp(a,i.label,i.config.theme.dense,i.config.hierarchyColorsStyleSheet!==void 0,n):i.config.hierarchyColorsStyleSheet!==void 0&&a.appendChild(gp(!0)),e&&!i.config.editMode&&(e instanceof ln?(a.dataset.value=e.value,e.language.length>0?a.dataset.lang=e.language:a.shaclDatatype=e.datatype):a.dataset.value="<"+e.value+">"),a.dataset.path=i.path,a}function pp(i,e,n,r,o=!1){const a=gp(r),l=new vn;l.classList.add("remove-button","clear"),l.title="Remove "+e,l.dense=n,l.icon=!0;const u=l.getAttribute("part");l.setAttribute("part",`${u?u+" ":""}remove-button`),l.addEventListener("click",()=>{i.classList.remove("fadeIn"),i.classList.add("fadeOut"),setTimeout(()=>{const f=i.parentElement;i.remove(),f?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),o&&l.classList.add("persistent"),a.appendChild(l),i.appendChild(a)}function gp(i){const e=document.createElement("div");return e.className="remove-button-wrapper",e.setAttribute("part","remove-controls"),i&&e.classList.add("colorize"),e}window.customElements.define("shacl-property",zs);function ly(i,e){let n=i;const r=e.store.getQuads(i,null,null,null),o=Hi(r,"label",Js,e.languages);o&&(n=o);let a;if(e.attributes.collapse!==null)a=new Pt,a.classList.add("collapsible"),a.open=e.attributes.collapse==="open",a.label=n,a.setAttribute("part","group collapsible");else{a=document.createElement("div");const u=document.createElement("h1");u.innerText=n,u.setAttribute("part","group-title"),a.appendChild(u),a.setAttribute("part","group")}a.dataset.subject=i,a.classList.add("shacl-group");const l=Hi(r,"order");return l&&(a.style.order=l),a}const Tt=[];for(let i=0;i<256;++i)Tt.push((i+256).toString(16).slice(1));function uy(i,e=0){return(Tt[i[e+0]]+Tt[i[e+1]]+Tt[i[e+2]]+Tt[i[e+3]]+"-"+Tt[i[e+4]]+Tt[i[e+5]]+"-"+Tt[i[e+6]]+Tt[i[e+7]]+"-"+Tt[i[e+8]]+Tt[i[e+9]]+"-"+Tt[i[e+10]]+Tt[i[e+11]]+Tt[i[e+12]]+Tt[i[e+13]]+Tt[i[e+14]]+Tt[i[e+15]]).toLowerCase()}let Ya;const cy=new Uint8Array(16);function dy(){if(!Ya){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ya=crypto.getRandomValues.bind(crypto)}return Ya(cy)}const hy=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ah={randomUUID:hy};function fy(i,e,n){i=i||{};const r=i.random??i.rng?.()??dy();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,uy(r)}function lh(i,e,n){return ah.randomUUID&&!i?ah.randomUUID():fy(i)}class Li extends HTMLElement{constructor(e,n,r,o,a,l=new Set){super(),this.template=e,this.linked=a??!1,this.ancestorShapeIds=l,this.setAttribute("part","node");let u=n;u||(!r&&e.nodeKind&&(r=e.nodeKind),r===void 0&&e.config.attributes.valuesNamespace||r?.value===`${Fe}IRI`?u=Be.namedNode(e.config.attributes.valuesNamespace+lh()):u=Be.blankNode(lh())),this.nodeId=u;const f=JSON.stringify([e.id,n]);if(n&&e.config.renderedNodes.has(f)){o=o||"Link";const h=document.createElement("label");h.innerText=o,h.classList.add("linked"),this.appendChild(h);const g=this.getAttribute("part");this.setAttribute("part",`${g?g+" ":""}linked-node`);const m=document.createElement("a"),d=n.termType==="BlankNode"?"_:"+n.value:n.value;m.innerText=d,m.classList.add("ref-link"),m.onclick=()=>{this.template.config.form.querySelector(`shacl-node[data-node-id='${d}']`)?.scrollIntoView()},this.appendChild(m),this.style.flexDirection="row",this.ready=Promise.resolve()}else{n&&e.config.renderedNodes.add(f);const h=this.ancestorShapeIds,g=this.template.id.value;if(this.dataset.nodeId=this.nodeId.id,this.template.config.attributes.showNodeIds!==null){const m=document.createElement("div");m.innerText=`id: ${this.nodeId.id}`,m.classList.add("node-id-display"),this.appendChild(m)}this.ready=(async()=>{const m=new Set(h);m.add(g);for(const[d,_]of Object.entries(e.properties))for(const b of _)await this.addPropertyInstance(b,n,_.length>1);for(const d of e.extendedShapes){const _=new Li(d,n,void 0,void 0,a,m);this.prepend(_),await _.ready}if(e.or?.length&&await this.tryResolve(e.or,n,e.config),e.xone?.length&&await this.tryResolve(e.xone,n,e.config),o){const d=document.createElement("h1");d.innerText=o,d.setAttribute("part","node-title"),this.prepend(d)}})()}}toRDF(e,n,r=""){if(n||(n=this.nodeId),!this.linked){for(const o of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))o.toRDF(e,n);this.template.targetClass&&e.addQuad(n,Rt,this.template.targetClass,this.template.config.valuesGraphId),r&&e.addQuad(n,Be.namedNode(r),this.template.id,this.template.config.valuesGraphId)}return n}async addPropertyInstance(e,n,r){let o=null;if(e.group)if(e.config.groups.indexOf(e.group)>-1){let l=this.querySelector(`:scope > .shacl-group[data-subject='${e.group}']`);l||(l=ly(e.group,e.config),this.appendChild(l)),o=l}else console.warn("ignoring unknown group reference",e.group,"existing groups:",e.config.groups);const a=new zs(e,this);await a.bindValues(n,r),(e.config.editMode||a.instanceCount()>0)&&(o?o.appendChild(a):this.appendChild(a),await a.updateControls())}async tryResolve(e,n,r){let o=!1;if(n){const a=Qm(e,n,r);if(a.length){for(const l of a)await this.addPropertyInstance(r.getPropertyTemplate(l,this.template),n);o=!0}}o||this.appendChild(Uf(e,this,r))}}window.customElements.define("shacl-node",Li);const py=`
|
|
414
|
+
`],Ro([Y()],zo.prototype,`pos`,2),Ro([Y()],zo.prototype,`minPos`,2),Ro([Y()],zo.prototype,`maxPos`,2),Ro([Y({reflect:!0})],zo.prototype,`dir`,2),Ro([Y()],zo.prototype,`sep`,2),Ro([Y({reflect:!0,type:Boolean})],zo.prototype,`dragging`,2),Ro([Y()],zo.prototype,`storageKey`,2),zo=Ro([Vi(`rokit-splitpane`)],zo);async function Bo(e){if(e.template.nodeShapes.size===0)return;let t=e.template.config.resourceLinkProvider;if((!t||t&&!t.lazyLoad)&&(await Wo(e.template),Ho(e).length===0))return;let n=e.template.config.theme.createButton(e.template.label,!1);n.title=`Link existing `+e.template.label,n.classList.add(`link-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}link-button`),n.addEventListener(`click`,async()=>{t?.lazyLoad&&(n.classList.add(`loading`),await Wo(e.template),n.classList.remove(`loading`));let r=Ho(e);if(r.length===0)n.innerText=`No linkable resources found`,n.setAttribute(`disabled`,``),setTimeout(()=>n.remove(),2e3);else{let t=e.template.config.form.querySelector(`#dialog`);t||(t=new Co,t.classList.add(`link-chooser`),t.closable=!0,e.template.config.form.appendChild(t)),t.title=`Link existing `+e.template.label,Vo(t,e,r),t.open=!0}}),n}function Vo(e,t,n){let r=document.createElement(`div`);for(let i of n){let n=document.createElement(`div`);n.classList.add(`link-option`),n.title=`Link this resource`,n.innerText=i.label||i.value,n.addEventListener(`click`,()=>{Uo(i.value,t),e.open=!1}),r.appendChild(n)}e.replaceChildren(r)}function Ho(e){let t=[];if(e.template.config.resourceLinkProvider){for(let n of e.template.nodeShapes)if(e.template.config.providedConformingResourceIds[n.id.value])for(let r of e.template.config.providedConformingResourceIds[n.id.value])e.querySelector(`:scope > .property-instance > shacl-node[data-node-id='${r}'], :scope > .collapsible > .property-instance > shacl-node[data-node-id='${r}']`)===null&&t.push({value:r,label:Rt(e.template.config.store.getQuads(k.namedNode(r),null,null,null),e.template.config.languages),children:[]})}return t}async function Uo(e,t){let n=k.namedNode(e);if(qo(n,t.template.config.store)){if(t.template.config.providedResources[e]?.length>0){let n={store:t.template.config.store,importedUrls:[],atts:{loadOwlImports:!1}};await rr(ar(t.template.config.providedResources[e]),n,vt),t.template.config.providedResources[e]=``}let r=await Zo(t.template,n,!0,!0);t.container.insertBefore(r,t.querySelector(`:scope > .add-button-wrapper`)),await t.updateControls()}}async function Wo(e){let t=e.config.resourceLinkProvider;if(!t)return;let n=new Set(Array.from(e.nodeShapes).map(e=>e.id.value));if(n.size===0)return;let r=Kt(Object.keys(e.config.providedConformingResourceIds),n);if(r.length!==0)try{let n=await t.listConformingResources(r,e);if(n){for(let t of Object.keys(n)){let r=new Set(n[t]);e.config.providedConformingResourceIds[t]=r,await Go(r,!1,e.config)}for(let t of r)e.config.providedConformingResourceIds[t]||(e.config.providedConformingResourceIds[t]=new Set)}}catch(e){console.error(`failed loading conforming resources`,e)}}async function Go(e,t,n){if(n.resourceLinkProvider&&e.size>0){let r=[];for(let t of e)n.providedResources[t]||r.push(t);if(r.length===0)return[];try{let e=await n.resourceLinkProvider.loadResources(r);if(e){let r={store:n.store,importedUrls:[],atts:{loadOwlImports:!1}};for(let i of e)n.providedResources[i.resourceId]=i.resourceRDF,t&&await rr(ar(i.resourceRDF),r,vt);return e}for(let e of r)n.providedResources[e]||(n.providedResources[e]=``)}catch(e){console.error(`failed loading resources`,e)}}return[]}async function Ko(e){let t=new Set;for(let n of e.store.getQuads(null,null,null,yt))qo(n.object,e.store)&&t.add(n.object.value);await Go(t,!0,e)}function qo(e,t){return e.termType===`NamedNode`&&t.countQuads(e,null,null,null)===0}var Jo=`:scope > .add-button-wrapper, :scope > .collapsible > .add-button-wrapper`,Yo=`:scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node, :scope > .collapsible > .property-instance`,Xo=class extends HTMLElement{constructor(e,t){if(super(),this.template=e,this.parent=t,this.container=this,this.setAttribute(`part`,`property`),this.template.nodeShapes.size&&this.template.config.attributes.collapse!==null&&(this.template.maxCount===void 0||this.template.maxCount>1)){let t=new Ca;t.classList.add(`collapsible`,`shacl-group`),t.open=e.config.attributes.collapse===`open`,t.label=this.template.label,t.setAttribute(`part`,`collapsible`),this.container=t,this.appendChild(this.container)}this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),e.config.editMode&&!t.linked&&this.addEventListener(`change`,async()=>{await this.updateControls()})}async bindValues(e,t){if(this.template.path){let n=!1;if(e){let r=this.template.config.store.getQuads(e,this.template.path,null,this.parent.linked?null:yt);t&&(r=await this.filterValidValues(r,e));for(let e of r)this.parent.linked||this.template.config.store.delete(e),await this.addPropertyInstance(e.object,!yt.equals(e.graph)||this.template.config.providedResources[e.object.value]!==void 0,this.template.config.providedResources[e.object.value]!==void 0),this.template.hasValue&&e.object.equals(this.template.hasValue)&&(n=!0)}this.template.config.editMode&&this.template.hasValue&&!n&&!this.parent.linked&&await this.addPropertyInstance(this.template.hasValue)}}async addPropertyInstance(e,t,n=!1){let r;if(this.template.or?.length||this.template.xone?.length){let t=this.template.or?.length?this.template.or:this.template.xone,n=!1;if(e){let i=gr(t,e,this.template.config);i.length&&(r=await Zo(pr(fr(this.template),i),e,!this.parent.linked,this.parent.linked,this.parent),n=!0)}!n&&this.template.config.editMode&&(r=hr(t,this,this.template.config),Qo(r,``,this.template.config.theme.dense,this.template.config.hierarchyColorsStyleSheet!==void 0))}else r=await Zo(this.template,e,n,t||this.parent.linked,this.parent);return r&&this.container.insertBefore(r,this.querySelector(Jo)),r}async updateControls(){this.template.config.editMode&&!this.parent.linked&&!this.querySelector(Jo)&&this.container.appendChild(await this.createAddControls());let e=ur(this.template),t=this.template.nodeShapes.size===0,n=this.querySelector(`:scope > .add-button-wrapper > .link-button, :scope > .collapsible > .add-button-wrapper > .link-button`)===null,r=t||!this.hasRecursiveNodeShape(),i=this.instanceCount();i===0&&r&&(t||n&&e>0)&&(await this.addPropertyInstance(),i=1),t||this.querySelector(Jo)?.classList.toggle(`required`,i<e);let a;a=e>0?i>e:!t||i>1;let o=i<dr(this.template);this.classList.toggle(`may-remove`,a),this.classList.toggle(`may-add`,o)}instanceCount(){return this.querySelectorAll(Yo).length}hasRecursiveNodeShape(){let e=new Set;this.parent.ancestorShapeIds.forEach(t=>e.add(t)),e.add(this.parent.template.id.value);for(let t of this.template.nodeShapes)if(e.has(t.id.value))return!0;return!1}toRDF(e,t){let n=k.namedNode(this.template.path);for(let r of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`))if(r.firstChild instanceof ls){let i=r.firstChild.toRDF(e);e.addQuad(t,n,i,this.template.config.valuesGraphId)}else if(this.template.config.editMode)for(let i of r.querySelectorAll(`:scope > .editor`)){let r=Cr(i);r&&e.addQuad(t,n,r,this.template.config.valuesGraphId)}else{let i=Cr(r);i&&e.addQuad(t,n,i,this.template.config.valuesGraphId)}}async filterValidValues(e,t){let n=this.template.id,r=[t];if(this.template.qualifiedValueShape){n=this.template.qualifiedValueShape.id,r=[];for(let t of e)r.push(t.object)}let i=await this.template.config.validator.validate({dataset:this.template.config.store,terms:r},[{terms:[n]}]),a=new Set;for(let e of i.results){let t=this.template.qualifiedValueShape?e.focusNode:e.value;t?.ptrs?.length&&a.add(t.ptrs[0]._term.id)}return e.filter(e=>!a.has(e.object.id))}async createAddControls(){let e=document.createElement(`div`);e.classList.add(`add-button-wrapper`),e.setAttribute(`part`,`add-controls`);let t=await Bo(this);t&&e.appendChild(t);let n=this.template.config.theme.createButton(this.template.label,!1);n.title=`Add `+this.template.label,n.classList.add(`add-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}add-button`),n.addEventListener(`click`,async()=>{let e=await this.addPropertyInstance();e&&(e.classList.add(`fadeIn`),await this.updateControls(),setTimeout(()=>{Lt(e),e.classList.remove(`fadeIn`)},200))}),e.appendChild(n),e}};async function Zo(e,t,n=!1,r=!1,i){let a;if(e.nodeShapes.size){a=document.createElement(`div`),a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`);let n=new Set(i?.ancestorShapeIds??[]);i&&n.add(i.template.id.value);for(let i of e.nodeShapes){let o=new ls(i,t,e.nodeKind,e.label,r,n);a.appendChild(o),await o.ready}}else{let n=Dr(e.path,e.datatype?.value);a=n?e.config.editMode&&!r?n.createEditor(e,t):n.createViewer(e,t):br(e,t||null,e.config.editMode&&!r),a.childNodes.length>0&&(a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`)),r&&a.classList.add(`linked`)}return e.config.editMode&&(!r||n)?Qo(a,e.label,e.config.theme.dense,e.config.hierarchyColorsStyleSheet!==void 0,n):e.config.hierarchyColorsStyleSheet!==void 0&&a.appendChild($o(!0)),t&&!e.config.editMode&&(t instanceof M?(a.dataset.value=t.value,t.language.length>0?a.dataset.lang=t.language:a.shaclDatatype=t.datatype):a.dataset.value=`<`+t.value+`>`),a.dataset.path=e.path,a}function Qo(e,t,n,r,i=!1){let a=$o(r),o=new la;o.classList.add(`remove-button`,`clear`),o.title=`Remove `+t,o.dense=n,o.icon=!0;let s=o.getAttribute(`part`);o.setAttribute(`part`,`${s?s+` `:``}remove-button`),o.addEventListener(`click`,()=>{e.classList.remove(`fadeIn`),e.classList.add(`fadeOut`),setTimeout(()=>{let t=e.parentElement;e.remove(),t?.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}))},200)}),i&&o.classList.add(`persistent`),a.appendChild(o),e.appendChild(a)}function $o(e){let t=document.createElement(`div`);return t.className=`remove-button-wrapper`,t.setAttribute(`part`,`remove-controls`),e&&t.classList.add(`colorize`),t}window.customElements.define(`shacl-property`,Xo);function es(e,t){let n=e,r=t.store.getQuads(e,null,null,null),i=Ft(r,`label`,mt,t.languages);i&&(n=i);let a;if(t.attributes.collapse!==null)a=new Ca,a.classList.add(`collapsible`),a.open=t.attributes.collapse===`open`,a.label=n,a.setAttribute(`part`,`group collapsible`);else{a=document.createElement(`div`);let e=document.createElement(`h1`);e.innerText=n,e.setAttribute(`part`,`group-title`),a.appendChild(e),a.setAttribute(`part`,`group`)}a.dataset.subject=e,a.classList.add(`shacl-group`);let o=Ft(r,`order`);return o&&(a.style.order=o),a}var ts=[];for(let e=0;e<256;++e)ts.push((e+256).toString(16).slice(1));function ns(e,t=0){return(ts[e[t+0]]+ts[e[t+1]]+ts[e[t+2]]+ts[e[t+3]]+`-`+ts[e[t+4]]+ts[e[t+5]]+`-`+ts[e[t+6]]+ts[e[t+7]]+`-`+ts[e[t+8]]+ts[e[t+9]]+`-`+ts[e[t+10]]+ts[e[t+11]]+ts[e[t+12]]+ts[e[t+13]]+ts[e[t+14]]+ts[e[t+15]]).toLowerCase()}var rs,is=new Uint8Array(16);function as(){if(!rs){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);rs=crypto.getRandomValues.bind(crypto)}return rs(is)}var os={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ss(e,t,n){e||={};let r=e.random??e.rng?.()??as();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return ns(r)}function cs(e,t,n){return os.randomUUID&&!t&&!e?os.randomUUID():ss(e,t,n)}var ls=class e extends HTMLElement{constructor(t,n,r,i,a,o=new Set){super(),this.template=t,this.linked=a??!1,this.ancestorShapeIds=o,this.setAttribute(`part`,`node`);let s=n;s||=(!r&&t.nodeKind&&(r=t.nodeKind),r===void 0&&t.config.attributes.valuesNamespace||r?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(t.config.attributes.valuesNamespace+cs()):k.blankNode(cs())),this.nodeId=s;let c=JSON.stringify([t.id,n]);if(n&&t.config.renderedNodes.has(c)){i||=`Link`;let e=document.createElement(`label`);e.innerText=i,e.classList.add(`linked`),this.appendChild(e);let t=this.getAttribute(`part`);this.setAttribute(`part`,`${t?t+` `:``}linked-node`);let r=document.createElement(`a`),a=n.termType===`BlankNode`?`_:`+n.value:n.value;r.innerText=a,r.classList.add(`ref-link`),r.onclick=()=>{this.template.config.form.querySelector(`shacl-node[data-node-id='${a}']`)?.scrollIntoView()},this.appendChild(r),this.style.flexDirection=`row`,this.ready=Promise.resolve()}else{n&&t.config.renderedNodes.add(c);let r=this.ancestorShapeIds,o=this.template.id.value;if(this.dataset.nodeId=this.nodeId.id,this.template.config.attributes.showNodeIds!==null){let e=document.createElement(`div`);e.innerText=`id: ${this.nodeId.id}`,e.classList.add(`node-id-display`),this.appendChild(e)}this.ready=(async()=>{let s=new Set(r);s.add(o);for(let[e,r]of Object.entries(t.properties))for(let e of r)await this.addPropertyInstance(e,n,r.length>1);for(let r of t.extendedShapes){let t=new e(r,n,void 0,void 0,a,s);this.prepend(t),await t.ready}if(t.or?.length&&await this.tryResolve(t.or,n,t.config),t.xone?.length&&await this.tryResolve(t.xone,n,t.config),i){let e=document.createElement(`h1`);e.innerText=i,e.setAttribute(`part`,`node-title`),this.prepend(e)}})()}}toRDF(e,t,n=``){if(t||=this.nodeId,!this.linked){for(let n of this.querySelectorAll(`:scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property`))n.toRDF(e,t);this.template.targetClass&&e.addQuad(t,bt,this.template.targetClass,this.template.config.valuesGraphId),n&&e.addQuad(t,k.namedNode(n),this.template.id,this.template.config.valuesGraphId)}return t}async addPropertyInstance(e,t,n){let r=null;if(e.group)if(e.config.groups.indexOf(e.group)>-1){let t=this.querySelector(`:scope > .shacl-group[data-subject='${e.group}']`);t||(t=es(e.group,e.config),this.appendChild(t)),r=t}else console.warn(`ignoring unknown group reference`,e.group,`existing groups:`,e.config.groups);let i=new Xo(e,this);await i.bindValues(t,n),(e.config.editMode||i.instanceCount()>0)&&(r?r.appendChild(i):this.appendChild(i),await i.updateControls())}async tryResolve(e,t,n){let r=!1;if(t){let i=_r(e,t,n);if(i.length){for(let e of i)await this.addPropertyInstance(n.getPropertyTemplate(e,this.template),t);r=!0}}r||this.appendChild(hr(e,this,n))}};window.customElements.define(`shacl-node`,ls);var us=`
|
|
423
415
|
.editor:not([type='checkbox']) { border: 1px solid var(--shacl-border-color, #DDD); }
|
|
424
416
|
.property-instance label { display: inline-flex; word-break: break-word; line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }
|
|
425
417
|
.property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
|
|
426
418
|
.mode-edit .property-instance label { width: var(--label-width); }
|
|
427
|
-
|
|
419
|
+
`,ds=class extends yr{constructor(e){super(e||us),this.idCtr=0}createDefaultTemplate(e,t,n,r,i){if(r.id=`e${this.idCtr++}`,r.classList.add(`editor`),r.setAttribute(`part`,`editor`),i?.datatype?r.shaclDatatype=i.datatype:t instanceof M&&(r.shaclDatatype=t.datatype),i&&ur(i)>0&&(r.dataset.minCount=String(ur(i))),i?.class&&(r.dataset.class=i.class.value),i?.nodeKind)r.dataset.nodeKind=i.nodeKind.value;else if(t&&(t instanceof j||i?.nodeKind?.equals(Dt))&&(r.dataset.nodeKind=W+`IRI`,i)){let e=Rt(i.config.store.getQuads(t,null,null,null),i.config.languages);e&&(r.dataset.value=`<`+t.value+`>`,t=k.literal(e))}(i?.hasValue&&t||i?.readonly)&&(r.disabled=!0),i?.datatype?.equals(Pt)?r.checked=t?.value===`true`||i?.defaultValue?.value===`true`:r.value=t?.value||i?.defaultValue?.value||``;let a=document.createElement(`label`);a.htmlFor=r.id,a.innerText=e,a.setAttribute(`part`,`label`),i?.description&&a.setAttribute(`title`,i.description.value);let o=i?.description?i.description.value:i?.pattern?i.pattern:null;o&&r.setAttribute(`placeholder`,o),n&&(r.setAttribute(`required`,`true`),a.classList.add(`required`));let s=document.createElement(`div`);return s.setAttribute(`part`,`field`),s.appendChild(a),s.appendChild(r),s}createDateEditor(e,t,n,r){let i=new Pa;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)try{let e=new Date(t.value).toISOString();e=r.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?e.slice(0,19):e.slice(0,10),i.value=e}catch(e){console.error(e,t)}return a}createTextEditor(e,t,n,r){let i;return r.singleLine===!1?(i=new oo,i.resize=`auto`):i=new Pa,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 M&&(o.value=t.language),a.dataset.lang=o.value,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 M&&(i.checked=t.value===`true`),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 Pa;i.type=`number`,i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let a=r.minInclusive===void 0?r.minExclusive===void 0?void 0:r.minExclusive+1:r.minInclusive,o=r.maxInclusive===void 0?r.maxExclusive===void 0?void 0:r.maxExclusive-1:r.maxInclusive;return a!==void 0&&(i.min=String(a)),o!==void 0&&(i.max=String(o)),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 Ya;a.clearable=!0,a.dense=this.dense;let o=this.createDefaultTemplate(e,null,n,a,i),s=document.createElement(`ul`),c=!0,l=(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=e.value.id,e.value instanceof j&&(n.dataset.value=`<`+n.dataset.value+`>`),n.innerText=e.label?e.label:e.value.value),t.appendChild(n),e.children?.length){c=!1;let t=document.createElement(`ul`);n.appendChild(t);for(let n of e.children)l(n,t)}};for(let e of r)l(e,s);return c||(a.collapse=!0),a.appendChild(s),t=t??i?.defaultValue??null,t&&(a.value=t.id,t instanceof j&&(a.value=`<`+a.value+`>`)),o}createButton(e,t){let n=new la;return n.dense=this.dense,n.innerHTML=e,t?(n.setAttribute(`primary`,``),n.setAttribute(`part`,`button primary`)):n.setAttribute(`part`,`button`),n}};function fs(e){return`_:`+e.value}function ps(e,t){return[...e].map(e=>t(e)).join(`
|
|
428
420
|
`)+`
|
|
429
|
-
`}function yy(){return""}function mp(i){return"<"+i.value+">"}const vy=/["\\\\\n\r]/,by=/["\\\\\n\r]/g,wy={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function xy(i){return wy[i]}function Ey(i){return vy.test(i)?i.replace(by,xy):i}function Sy(i){const e=Ey(i.value);return i.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':i.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+i.language:'"'+e+'"^^'+mp(i.datatype)}function Ty(i,e){const n=e(i.subject),r=e(i.predicate),o=e(i.object),a=e(i.graph);return`${n} ${r} ${o} ${a?a+" ":""}.`}function Ly(i){return"?"+i.value}function qt(i){if(!i)return null;if(i.termType==="BlankNode")return my(i);if(i.termType==="DefaultGraph")return yy();if(i.termType==="Literal")return Sy(i);if(i.termType==="NamedNode")return mp(i);if(i.termType==="Quad"||i.subject&&i.predicate&&i.object&&i.graph)return Ty(i,qt);if(i.termType==="Variable")return Ly(i);if(i[Symbol.iterator])return _y(i,qt);throw new Error(`unknown termType ${i.termType}`)}class Ii{constructor(e){if(this.index=new Map,e)for(const[n,r]of e)this.set(n,r)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(qt(e))}*entries(){for(const[,{term:e,value:n}]of this.index)yield[e,n]}forEach(e,n){for(const r of this.entries())e.call(n,r[1],r[0],this)}get(e){const n=this.index.get(qt(e));return n&&n.value}has(e){return this.index.has(qt(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,n){const r=qt(e);return this.index.set(r,{term:e,value:n}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class uh{constructor({dataset:e,end:n,quad:r,start:o}){this.dataset=e,this.end=n,this.quad=r,this.start=o}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function ch(i){try{return qt(i)}catch{return null}}class Jt{constructor(e){if(this.index=new Map,e)for(const n of e)this.add(n)}get size(){return this.index.size}add(e){const n=qt(e);return this.index.has(n)||this.index.set(n,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(ch(e)):!1}entries(){return this.values().entries()}forEach(e,n){return this.values().forEach(e,n)}has(e){return e?this.index.has(ch(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class _p{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}_p.prototype.termType="BlankNode";class nu{equals(e){return!!e&&e.termType===this.termType}}nu.prototype.termType="DefaultGraph";nu.prototype.value="";function dh(i,e){if(!e)return null;if(e.termType==="BlankNode")return i.blankNode(e.value);if(e.termType==="DefaultGraph")return i.defaultGraph();if(e.termType==="Literal")return i.literal(e.value,e.language||i.namedNode(e.datatype.value));if(e.termType==="NamedNode")return i.namedNode(e.value);if(e.termType==="Quad"){const n=i.fromTerm(e.subject),r=i.fromTerm(e.predicate),o=i.fromTerm(e.object),a=i.fromTerm(e.graph);return i.quad(n,r,o,a)}if(e.termType==="Variable")return i.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Ds{constructor(e,n,r,o=""){this.value=e,this.language=n,this.datatype=r,this.direction=o}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}}Ds.prototype.termType="Literal";class Kr{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Kr.prototype.termType="NamedNode";class iu{constructor(e,n,r,o){this.subject=e,this.predicate=n,this.object=r,this.graph=o}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)}}iu.prototype.termType="Quad";iu.prototype.value="";class yp{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}yp.prototype.termType="Variable";const Iy=new Kr("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),hh=new Kr("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),Ay=new Kr("http://www.w3.org/2001/XMLSchema#string");class vp{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new nu}}namedNode(e){return new Kr(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new _p(e)}literal(e,n){return typeof n=="string"?new Ds(e,n,hh):typeof n?.language=="string"?new Ds(e,n.language,n.direction?Iy:hh,n.direction):new Ds(e,"",n||Ay)}variable(e){return new yp(e)}defaultGraph(){return this._data.defaultGraph}quad(e,n,r,o=this.defaultGraph()){return new iu(e,n,r,o)}fromTerm(e){return dh(this,e)}fromQuad(e){return dh(this,e)}}vp.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const ru=new vp,Ny={apply:(i,e,n)=>i(n[0]),get:(i,e)=>i(e)};function Yt(i,{factory:e=ru}={}){const n=(r="")=>e.namedNode(`${i}${r.raw||r}`);return typeof Proxy>"u"?n:new Proxy(n,Ny)}Yt("http://www.w3.org/2001/XMLSchema#");const _n=Yt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");Yt("http://www.w3.org/2000/01/rdf-schema#");class nt{static add({ptr:e,start:n,end:r,subjects:o=[null],predicates:a=[null],objects:l=[null],graphs:u,callback:f}={}){if(!e.factory)throw new Error("add operation requires a factory");let h=()=>{};f&&(h=g=>{f(new uh({dataset:e.dataset,start:n,end:r,quad:g}))});for(const g of o)for(const m of a)for(const d of l)for(const _ of u){const b={subject:g,predicate:m,object:d,graph:_};b[n]=e.term;const I=e.factory.quad(b.subject,b.predicate,b.object,b.graph);e.dataset.add(I),h(I)}return e}static addList({ptr:e,predicates:n,items:r,graphs:o}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const a of n)for(const l of o){const u=r.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,a,u[0]||_n.nil,l));for(let f=0;f<u.length;f++)e.dataset.add(e.factory.quad(u[f],_n.first,r[f],l)),e.dataset.add(e.factory.quad(u[f],_n.rest,u[f+1]||_n.nil,l))}return e}static delete({ptr:e,start:n,subjects:r=[null],predicates:o=[null],objects:a=[null]}){for(const l of r)for(const u of o)for(const f of a){const h={subject:l,predicate:u,object:f};h[n]=e.term;const g=e.dataset.match(h.subject,h.predicate,h.object);for(const m of g)e.dataset.delete(m)}return e}static deleteList({ptr:e,predicates:n}){const r=[];for(const o of n)for(const a of e.dataset.match(e.term,o)){let l=a.object;for(r.push(a);!_n.nil.equals(l);){l=r[r.length-1].object;const u=e.dataset.match(l);if(u.size===0)break;for(const f of u)r.push(f)}}for(const o of r)e.dataset.delete(o);return e}static execute({ptr:e,operation:n="traverse",quantifier:r,start:o,end:a,subjects:l,predicates:u,objects:f,graphs:h,items:g,callback:m}={}){if(n==="add")return nt.add({ptr:e,start:o,end:a,subjects:l,predicates:u,objects:f,graphs:h,callback:m});if(n==="addList")return nt.addList({ptr:e,predicates:u,items:g,graphs:h});if(n==="delete")return nt.delete({ptr:e,start:o,subjects:l,predicates:u,objects:f});if(n==="deleteList")return nt.deleteList({ptr:e,predicates:u});if(n==="isList")return nt.isList({ptr:e});if(n==="list")return nt.list({ptr:e});if(n==="traverse")return nt.traverse({ptr:e,quantifier:r,start:o,end:a,subjects:l,predicates:u,objects:f,graphs:h});throw new Error(`unknown operation ${n}`)}static isList({ptr:e}){return e.isAny()?!1:!!(_n.nil.equals(e.term)||nt.traverse({ptr:e,predicates:[_n.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(_n.nil);){const n=e.out([_n.first]);if(n.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const r=e.out([_n.rest]);if(r.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield n[0],e=r[0]}}}}static traverse({ptr:e,quantifier:n="one",start:r="subject",end:o="object",subjects:a=[null],predicates:l=[null],objects:u=[null],graphs:f=[null],callback:h}){if(n==="one")return nt.traverseOne({ptr:e,start:r,end:o,subjects:a,predicates:l,objects:u,graphs:f,callback:h});if(n==="oneOrMore"){const g=nt.traverse({ptr:e,end:o,start:r,subjects:a,predicates:l,objects:u,graphs:f,callback:h});return nt.traverseMore({ptrs:g,end:o,start:r,subjects:a,predicates:l,objects:u,graphs:f,callback:h})}if(n==="zeroOrMore")return nt.traverseMore({ptrs:[e],end:o,start:r,subjects:a,predicates:l,objects:u,graphs:f,callback:h});if(n==="zeroOrOne")return[e,...nt.traverse({ptr:e,end:o,start:r,subjects:a,predicates:l,objects:u,graphs:f,callback:h})];throw new Error(`unknown quantifier ${n}`)}static traverseMore({ptrs:e,end:n,start:r,subjects:o,predicates:a,objects:l,graphs:u,callback:f}={}){let h=[...e],g,m;do{g=[];for(const d of e)g=[...g,...nt.traverseOne({ptr:d,end:n,start:r,subjects:o,predicates:a,objects:l,graphs:u,callback:f})];m&&(g=g.filter(d=>!m.has(d.term))),e=g,h=[...h,...g],m=new Jt(h.map(d=>d.term))}while(g.length>0);return h}static traverseOne({ptr:e,start:n,end:r,subjects:o,predicates:a,objects:l,graphs:u,callback:f=(h,g)=>g.extend(h)}={}){const h=[];for(const g of o)for(const m of a)for(const d of l)for(const _ of u){const b={subject:g,predicate:m,object:d,graph:_};b[n]=e.term;for(const I of e.dataset.match(b.subject,b.predicate,b.object,b.graph))h.push(f(new uh({dataset:e.dataset,end:r,quad:I,start:n}),e))}return h}}function fh(i,e){return e?n=>e(i.extend(n)):()=>{}}class ph{constructor({dataset:e,edges:n=[],factory:r,graph:o,term:a}){if(!e&&n.length===0)throw new Error("dataset or edges is required");if(n.length===0&&typeof a>"u")throw new Error("edges or term must be given");if(n.length>0&&a)throw new Error("edges or term must be given");this.dataset=e||n[n.length-1].dataset,this.edges=n,this.factory=r,this._graph=o,n.length===0&&(this._term=a)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,n,r){return nt.add({ptr:this,start:"object",end:"subject",subjects:n,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:fh(this,r)})}addList(e,n){return nt.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:n})}addOut(e,n,r){return nt.add({ptr:this,start:"subject",end:"object",predicates:e,objects:n,graphs:[this.graph||this.factory.defaultGraph()],callback:fh(this,r)})}deleteIn(e,n){return nt.delete({ptr:this,start:"object",subjects:n,predicates:e})}deleteList(e){return nt.deleteList({ptr:this,predicates:e})}deleteOut(e,n){return nt.delete({ptr:this,start:"subject",predicates:e,objects:n})}execute({operation:e,quantifier:n,start:r,end:o,subjects:a,predicates:l,objects:u,graphs:f,items:h,callback:g}){return nt.execute({ptr:this,operation:e,quantifier:n,start:r,end:o,subjects:a,predicates:l,objects:u,graphs:f,items:h,callback:g})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,n){return nt.traverse({ptr:this,start:"object",end:"object",subjects:n,predicates:e,graphs:[this.graph]})}hasOut(e,n){return nt.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:n,graphs:[this.graph]})}in(e,n){return nt.traverse({ptr:this,start:"object",end:"subject",subjects:n,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return nt.isList({ptr:this})}list(){return nt.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,n){return nt.traverse({ptr:this,predicates:e,objects:n,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function gh(i,e){return i?i.equals(e):i===e}function Ry(i,e){return!(i.dataset!==e.dataset||!gh(i.graph,e.graph)||!gh(i.term,e.term))}function mh(i,e){return e?n=>e(new i.constructor({factory:i.factory,ptrs:[n]})):()=>{}}class Us{constructor({dataset:e,factory:n,ptrs:r,terms:o,graphs:a}){if(this.factory=n,r)this.ptrs=[...r];else{this.ptrs=[];for(const l of o||[null])for(const u of a||[null])this.ptrs.push(new ph({dataset:e,factory:n,graph:u,term:l}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new Jt(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,n,r){const o=mh(this,r);for(const a of this.ptrs)a.addIn(e,n,o);return this}addList(e,n){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const r of this.ptrs)r.addList(e,n);return this}addOut(e,n,r){const o=mh(this,r);for(const a of this.ptrs)a.addOut(e,n,o);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,n){for(const r of this.ptrs)r.deleteIn(e,n);return this}deleteList(e){for(const n of this.ptrs)n.deleteList(e);return this}deleteOut(e,n){for(const r of this.ptrs)r.deleteOut(e,n);return this}distinct(){const e=this.ptrs.reduce((n,r)=>(n.some(o=>Ry(o,r))||n.push(r.trim()),n),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(n=>n.execute(e))})}executeAll(e){let n=this;for(const r of e)n=n.execute(r);return n}filter(e){return this.clone({ptrs:[...this].filter(e).map(n=>n.ptrs[0])})}hasIn(e,n){return this.clone({ptrs:this.ptrs.flatMap(r=>r.hasIn(e,n))})}hasOut(e,n){return this.clone({ptrs:this.ptrs.flatMap(r=>r.hasOut(e,n))})}in(e,n){return this.clone({ptrs:this.ptrs.flatMap(r=>r.in(e,n))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),n=this;return(function*(){for(const r of e)yield n.clone({ptrs:[r]})})()}map(e){return[...this].map(e)}node(e){const n=this.dataset,r=[...e].map(o=>new ph({dataset:n,factory:this.factory,term:o}));return this.clone({ptrs:r})}out(e,n){return this.clone({ptrs:this.ptrs.flatMap(r=>r.out(e,n))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:n}of e)yield n}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}Yt("http://www.w3.org/2002/07/owl#");const Si=Yt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),Cy=Yt("http://www.w3.org/2000/01/rdf-schema#"),ge=Yt("http://www.w3.org/ns/shacl#"),Al=Yt("https://schemas.link/shacl-next#"),su=Yt("http://www.w3.org/2001/XMLSchema#");function Py(i){return i?`{${[...i.quads()].map(e=>qt(e)).join(" ")}}`:"{}"}function ky(i){return i?`{${i.map(e=>Py(e)).join(" ")}}`:"{}"}var el,_h;function Dy(){if(_h)return el;_h=1;var i=/\s/;function e(n){for(var r=n.length;r--&&i.test(n.charAt(r)););return r}return el=e,el}var tl,yh;function My(){if(yh)return tl;yh=1;var i=Dy(),e=/^\s+/;function n(r){return r&&r.slice(0,i(r)+1).replace(e,"")}return tl=n,tl}var nl,vh;function Oy(){if(vh)return nl;vh=1;function i(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}return nl=i,nl}var il,bh;function Fy(){if(bh)return il;bh=1;var i=typeof qi=="object"&&qi&&qi.Object===Object&&qi;return il=i,il}var rl,wh;function jy(){if(wh)return rl;wh=1;var i=Fy(),e=typeof self=="object"&&self&&self.Object===Object&&self,n=i||e||Function("return this")();return rl=n,rl}var sl,xh;function bp(){if(xh)return sl;xh=1;var i=jy(),e=i.Symbol;return sl=e,sl}var ol,Eh;function By(){if(Eh)return ol;Eh=1;var i=bp(),e=Object.prototype,n=e.hasOwnProperty,r=e.toString,o=i?i.toStringTag:void 0;function a(l){var u=n.call(l,o),f=l[o];try{l[o]=void 0;var h=!0}catch{}var g=r.call(l);return h&&(u?l[o]=f:delete l[o]),g}return ol=a,ol}var al,Sh;function $y(){if(Sh)return al;Sh=1;var i=Object.prototype,e=i.toString;function n(r){return e.call(r)}return al=n,al}var ll,Th;function qy(){if(Th)return ll;Th=1;var i=bp(),e=By(),n=$y(),r="[object Null]",o="[object Undefined]",a=i?i.toStringTag:void 0;function l(u){return u==null?u===void 0?o:r:a&&a in Object(u)?e(u):n(u)}return ll=l,ll}var ul,Lh;function zy(){if(Lh)return ul;Lh=1;function i(e){return e!=null&&typeof e=="object"}return ul=i,ul}var cl,Ih;function Hy(){if(Ih)return cl;Ih=1;var i=qy(),e=zy(),n="[object Symbol]";function r(o){return typeof o=="symbol"||e(o)&&i(o)==n}return cl=r,cl}var dl,Ah;function Uy(){if(Ah)return dl;Ah=1;var i=My(),e=Oy(),n=Hy(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function f(h){if(typeof h=="number")return h;if(n(h))return r;if(e(h)){var g=typeof h.valueOf=="function"?h.valueOf():h;h=e(g)?g+"":g}if(typeof h!="string")return h===0?h:+h;h=i(h);var m=a.test(h);return m||l.test(h)?u(h.slice(2),m?2:8):o.test(h)?r:+h}return dl=f,dl}var hl,Nh;function Vy(){if(Nh)return hl;Nh=1;var i=Uy(),e=1/0,n=17976931348623157e292;function r(o){if(!o)return o===0?o:0;if(o=i(o),o===e||o===-e){var a=o<0?-1:1;return a*n}return o===o?o:0}return hl=r,hl}var fl,Rh;function Wy(){if(Rh)return fl;Rh=1;var i=Vy();function e(n){var r=i(n),o=r%1;return r===r?o?r-o:r:0}return fl=e,fl}var pl,Ch;function Gy(){if(Ch)return pl;Ch=1;var i=Wy(),e="Expected a function";function n(r,o){var a;if(typeof o!="function")throw new TypeError(e);return r=i(r),function(){return--r>0&&(a=o.apply(this,arguments)),r<=1&&(o=void 0),a}}return pl=n,pl}var gl,Ph;function Zy(){if(Ph)return gl;Ph=1;var i=Gy();function e(n){return i(2,n)}return gl=e,gl}var Xy=Zy();const on=rf(Xy);let kh=class{constructor({details:e,factory:n,options:r,results:o=[]}={}){this.details=e,this.factory=n,this.options=r,this.results=o,this._conforms=on(()=>!this.results.some(a=>a.severity.equals(ge.Info)||a.severity.equals(ge.Violation)||a.severity.equals(ge.Warning))),this._ptr=on(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new Us({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Si.type],[ge.ValidationReport]).addOut([ge.conforms],[this.factory.literal(this.conforms.toString(),su.boolean)]);for(const n of this.results)e.addOut([ge.result],[this.factory.blankNode()],r=>{n.build(r,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Qy(i,e){return Object.entries(e).reduce((n,[r,o])=>(o&&o.termType&&(o=qt(o)),n.replace(`{$${r}}`,o).replace(`{?${r}}`,o)),i)}let Jy=class{constructor({args:e={},constraintComponent:n,factory:r,focusNode:o,message:a=[],path:l,results:u=[],severity:f,shape:h,source:g=[],value:m,valuePaths:d=[]}={}){this.args=e,this.constraintComponent=n,this.factory=r,this.focusNode=o,this.path=l||h.path,this.results=u,this.severity=f,this.shape=h,this.source=g,this.value=m,this.valuePaths=d,this._message=on(()=>(this.shape.message.length>0&&(a=this.shape.message),a.length===0&&(a=this.shape.ptr.node([this.constraintComponent]).out([ge.message]).terms),a.map(_=>r.literal(Qy(_.value,e),_.language||null))))}get message(){return this._message()}build(e,{details:n}={}){e.addOut([Si.type],[ge.ValidationResult]).addOut([ge.focusNode],this.focusNode.terms).addOut([ge.resultSeverity],[this.severity]).addOut([ge.sourceConstraint],this.source).addOut([ge.sourceConstraintComponent],[this.constraintComponent]).addOut([ge.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ge.resultMessage],this.message);const r=o=>{if(o.quantifier==="one")return o.predicates.length>1?e.node([this.factory.blankNode()]).addList([ge.alternativePath],o.predicates):o.start==="object"?e.node([this.factory.blankNode()]).addOut([ge.inversePath],[o.predicates[0]]):e.node([o.predicates[0]]);if(o.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ge.oneOrMorePath],[o.predicates[0]]);if(o.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ge.zeroOrMorePath],[o.predicates[0]]);if(o.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ge.zeroOrOnePath],[o.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ge.resultPath],r(this.path[0]).terms):e.addList([ge.resultPath],this.path.map(o=>r(o).term))),typeof this.value<"u"&&e.addOut([ge.value],this.value.terms),n)for(const o of this.results)e.addOut([ge.detail],[this.factory.blankNode()],a=>{o.build(a,{details:n})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class ou{constructor({factory:e,focusNode:n,options:r={debug:!1,details:!1},processed:o=new Set,report:a=new kh({factory:e,options:r}),results:l=new Map,shape:u,value:f,valueOrNode:h,valuePaths:g,values:m}={}){this.factory=e,this.focusNode=n,this.options=r,this.processed=o,this.report=a,this.results=l,this.shape=u,this.value=f,this.valuePaths=g,this.valueOrNode=h,this.values=m}create({child:e,focusNode:n=this.focusNode,shape:r=this.shape,value:o=this.value,valueOrNode:a=this.valueOrNode,valuePaths:l=this.valuePaths,values:u=this.values}={}){return new ou({factory:this.factory,focusNode:n,options:this.options,processed:this.processed,report:e?new kh({factory:this.factory,options:this.options}):this.report,results:this.results,shape:r,value:o,valueOrNode:a,valuePaths:l,values:u})}id({shape:e=this.shape}={}){return`${qt(e.ptr.term)} - ${qt(this.focusNode.term)} - ${ky(this.valuePaths)}`}result(e){const n=new Jy({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),r=this.id();this.results.has(r)?this.results.get(r).add(n):this.results.set(r,new Set([n])),this.report.results.push(n)}debug(e,n){this.options.debug&&this.result({severity:Al.Debug,constraintComponent:e,...n})}trace(e,n){this.options.trace&&this.result({severity:Al.Trace,constraintComponent:e,...n})}test(e,n,r){e?this.debug(n,r):this.violation(n,r)}violation(e,n){this.result({constraintComponent:e,severity:this.shape.severity||ge.Violation,...n})}}function Ky(){return{generic:Yy()}}function Yy(){return i=>{i.trace(Al.TraversalConstraintComponent,{args:{},message:[i.factory.literal("Traversal")],value:i.valueOrNode})}}class ev{constructor(e){this.validations=new Ii(e)}compile(e){const n=e.validator.options.coverage;if(e.deactivated)return[];let r=!1;const o=new Set;for(const a of e.ptr.execute({start:"subject",end:"predicate"})){const l=this.validations.get(a.term);l&&(o.add(l),a.term.equals(ge.property)&&(r=!0))}return n&&e.isPropertyShape&&!r&&o.add(Ky),[...o].map(a=>a(e)).filter(Boolean)}}var gi={},mi={},Nr={},Rr={},Dh;function Xi(){if(Dh)return Rr;Dh=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.Translator=void 0;let i=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(n){throw new Error(`Invalid RDF ${n.datatype.value} value: '${n.value}'`)}registerHandler(n,r,o){for(const a of r)this.supportedRdfDatatypes.push(a),this.fromRdfHandlers[a.value]=n;for(const a of o){let l=this.toRdfHandlers[a];l||(this.toRdfHandlers[a]=l=[]),l.push(n)}}fromRdf(n,r){const o=this.fromRdfHandlers[n.datatype.value];return o?o.fromRdf(n,r):n.value}toRdf(n,r){const o=this.toRdfHandlers[typeof n];if(o)for(const a of o){const l=a.toRdf(n,r);if(l)return l}throw new Error(`Invalid JavaScript value: '${n}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return Rr.Translator=i,Rr}var Mh;function tv(){if(Mh)return Nr;Mh=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.TypeHandlerBoolean=void 0;const i=Xi();let e=class wp{fromRdf(r,o){switch(r.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return o&&i.Translator.incorrectRdfDataType(r),!1}toRdf(r,{datatype:o,dataFactory:a}){return a.literal(r?"true":"false",o||a.namedNode(wp.TYPE))}};return Nr.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",Nr}var Cr={},Oh;function nv(){if(Oh)return Cr;Oh=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.TypeHandlerDate=void 0;const i=Xi();let e=class Nl{fromRdf(r,o){switch(o&&!r.value.match(Nl.VALIDATORS[r.datatype.value.substr(33,r.datatype.value.length)])&&i.Translator.incorrectRdfDataType(r),r.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(r.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const a=r.value.split("-");return new Date(0,parseInt(a[0],10)-1,parseInt(a[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(r.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(r.value+"-01");default:return new Date(r.value)}}toRdf(r,{datatype:o,dataFactory:a}){if(o=o||a.namedNode(Nl.TYPES[0]),!(r instanceof Date))return null;const l=r;let u;switch(o.value){case"http://www.w3.org/2001/XMLSchema#gDay":u=String(l.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":u=l.getUTCMonth()+1+"-"+l.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":u=String(l.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":u=l.getUTCFullYear()+"-"+(l.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":u=l.toISOString().replace(/T.*$/,"");break;default:u=l.toISOString()}return a.literal(u,o)}};return Cr.TypeHandlerDate=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#dateTime","http://www.w3.org/2001/XMLSchema#date","http://www.w3.org/2001/XMLSchema#gDay","http://www.w3.org/2001/XMLSchema#gMonthDay","http://www.w3.org/2001/XMLSchema#gYear","http://www.w3.org/2001/XMLSchema#gYearMonth"],e.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/},Cr}var Pr={},Fh;function iv(){if(Fh)return Pr;Fh=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.TypeHandlerNumberDouble=void 0;const i=Xi();let e=class xp{fromRdf(r,o){const a=parseFloat(r.value);return o&&isNaN(a)&&i.Translator.incorrectRdfDataType(r),a}toRdf(r,{datatype:o,dataFactory:a}){return o=o||a.namedNode(xp.TYPES[0]),isNaN(r)?a.literal("NaN",o):isFinite(r)?r%1===0?null:a.literal(r.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),o):a.literal(r>0?"INF":"-INF",o)}};return Pr.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],Pr}var kr={},jh;function rv(){if(jh)return kr;jh=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.TypeHandlerNumberInteger=void 0;const i=Xi();let e=class jr{fromRdf(r,o){const a=parseInt(r.value,10);return o&&(isNaN(a)||r.value.indexOf(".")>=0)&&i.Translator.incorrectRdfDataType(r),a}toRdf(r,{datatype:o,dataFactory:a}){return a.literal(String(r),o||(r<=jr.MAX_INT&&r>=jr.MIN_INT?a.namedNode(jr.TYPES[0]):a.namedNode(jr.TYPES[1])))}};return kr.TypeHandlerNumberInteger=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#positiveInteger","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedShort"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,kr}var Dr={},Bh;function sv(){if(Bh)return Dr;Bh=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.TypeHandlerString=void 0;let i=class{fromRdf(n){return n.value}toRdf(n,{datatype:r,dataFactory:o}){return o.literal(n,r)}};return Dr.TypeHandlerString=i,i.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"],Dr}var $h;function qh(){return $h||($h=1,(function(i){var e=mi&&mi.__createBinding||(Object.create?(function(r,o,a,l){l===void 0&&(l=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,l,u)}):(function(r,o,a,l){l===void 0&&(l=a),r[l]=o[a]})),n=mi&&mi.__exportStar||function(r,o){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,r,a)};Object.defineProperty(i,"__esModule",{value:!0}),n(tv(),i),n(nv(),i),n(iv(),i),n(rv(),i),n(sv(),i)})(mi)),mi}var ml={},zh;function ov(){return zh||(zh=1,Object.defineProperty(ml,"__esModule",{value:!0})),ml}var Hh;function av(){return Hh||(Hh=1,(function(i){var e=gi&&gi.__createBinding||(Object.create?(function(_,b,I,A){A===void 0&&(A=I);var N=Object.getOwnPropertyDescriptor(b,I);(!N||("get"in N?!b.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return b[I]}}),Object.defineProperty(_,A,N)}):(function(_,b,I,A){A===void 0&&(A=I),_[A]=b[I]})),n=gi&&gi.__exportStar||function(_,b){for(var I in _)I!=="default"&&!Object.prototype.hasOwnProperty.call(b,I)&&e(b,_,I)};Object.defineProperty(i,"__esModule",{value:!0}),i.fromRdf=f,i.toRdf=h,i.getTermRaw=g,i.getSupportedRdfDatatypes=m,i.getSupportedJavaScriptPrimitives=d;const r=Df(),o=qh(),a=Xi();n(qh(),i),n(ov(),i),n(Xi(),i);const l=new r.DataFactory,u=new a.Translator;u.registerHandler(new o.TypeHandlerString,o.TypeHandlerString.TYPES.map(_=>l.namedNode(_)),["string"]),u.registerHandler(new o.TypeHandlerBoolean,[o.TypeHandlerBoolean.TYPE].map(_=>l.namedNode(_)),["boolean"]),u.registerHandler(new o.TypeHandlerNumberDouble,o.TypeHandlerNumberDouble.TYPES.map(_=>l.namedNode(_)),["number"]),u.registerHandler(new o.TypeHandlerNumberInteger,o.TypeHandlerNumberInteger.TYPES.map(_=>l.namedNode(_)),["number"]),u.registerHandler(new o.TypeHandlerDate,o.TypeHandlerDate.TYPES.map(_=>l.namedNode(_)),["object"]);function f(_,b){return u.fromRdf(_,b)}function h(_,b){return b&&"namedNode"in b&&(b={dataFactory:b}),b=b||{},b&&!b.dataFactory&&(b.dataFactory=l),u.toRdf(_,b)}function g(_,b){return _.termType==="Literal"?f(_,b):_.value}function m(){return u.getSupportedRdfDatatypes()}function d(){return u.getSupportedJavaScriptPrimitives()}})(gi)),gi}var Zr=av();function Uh(i){if(i.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[i.term]};const e=i.out([ge.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(l=>l.term)};const n=i.out([ge.inversePath]);if(n.term)return{quantifier:"one",start:"object",end:"subject",predicates:[n.term]};const r=i.out([ge.oneOrMorePath]);if(r.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[r.term]};const o=i.out([ge.zeroOrMorePath]);if(o.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[o.term]};const a=i.out([ge.zeroOrOnePath]);if(a.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[a.term]}}function lv(i){return i.terms.length===0?null:i.ptrs[0].isList()?[...i.list()].map(e=>Uh(e)):[Uh(i)]}class uv{constructor(e){this.shape=e,this._compiled=on(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const n=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const r of this.compiled)r.node&&await r.node(n),r.generic&&await r.generic(n)}async validateProperty(e){let n;this.shape.isSparqlShape?n=e.focusNode:n=e.focusNode.executeAll(this.shape.path);const r=n.node(new Jt(n.terms)),o=[...n].reduce((l,u)=>{const f=u.term,h=n.node([f]);return l.has(f)||l.set(f,{value:h,valuePaths:[]}),l.get(f).valuePaths.push(u),l},new Ii).values(),a=e.create({shape:this.shape,values:r});for(const l of this.compiled)l.property&&await l.property(a);for(const{value:l,valuePaths:u}of o){const f=e.create({shape:this.shape,value:l,valueOrNode:l,valuePaths:u});for(const h of this.compiled)h.generic&&await h.generic(f)}}}function Rl(i){const e=new Jt,r=new Us({dataset:i.dataset,terms:i.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[Cy.subClassOf]});for(const o of r.ptrs)for(const{term:a}of o.nodes())e.add(a);return e}class cv{constructor(e,{registry:n}){this.registry=n,this.targetClass=new Jt([...Rl(e.hasOut([Si.type],[ge.NodeShape])),...Rl(e.out([ge.targetClass]))]),this.targetNode=e.out([ge.targetNode]).terms,this.targetObjectsOf=e.out([ge.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ge.targetSubjectsOf]).terms,this.targets=[...e.out([ge.target])]}async resolve(e){const n=e.focusNode.node([null]),r=[...e.focusNode.hasOut([Si.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...n.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...n.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs];for(const a of this.targets)for(const[,l]of this.registry.targetResolvers){const u=await l(a,e);r.push(...e.focusNode.node(u).ptrs)}const o=e.focusNode.clone({ptrs:r});return o.node([...new Jt(o.terms)])}}class dv{constructor(e,{validator:n}){this.ptr=e,this.validator=n,this._deactivated=on(()=>{const r=this.ptr.out([ge.deactivated]).term;return r&&Zr.fromRdf(r)}),this._message=on(()=>this.ptr.out([ge.message]).terms),this._path=on(()=>lv(this.ptr.out([ge.path]))),this._severity=on(()=>this.ptr.out([ge.severity]).term),this._shapeValidator=on(()=>new uv(this)),this._sparql=on(()=>this.ptr.out([ge.sparql])),this._targetResolver=on(()=>new cv(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){const n=e.id({shape:this});if(e.processed.has(n)){if(e.results.has(n))for(const r of e.results.get(n))e.report.results.push(r);return e}return e.processed.add(n),this.shapeValidator.validate(e)}}class hv{constructor(e){this.targetResolvers=new Ii(e)}}function fv(i){const e=parseInt(i.ptr.out([ge.maxCount]).value);return{property:pv(e)}}function pv(i){return e=>{e.test(e.values.terms.length<=i,ge.MaxCountConstraintComponent,{args:{maxCount:i},message:[e.factory.literal("More than {$maxCount} values")]})}}function gv(i){const e=parseInt(i.ptr.out([ge.minCount]).value);return{property:mv(e)}}function mv(i){return e=>{e.test(e.values.terms.length>=i,ge.MinCountConstraintComponent,{args:{minCount:i},message:[e.factory.literal("Less than {$minCount} values")]})}}async function _v(i,e){for(const n of i)if(!await e(n))return!1;return!0}async function yv(i,e){return(await Promise.all(i.map(n=>e(n)))).filter(Boolean)}async function so(i,e){return Promise.all(i.map(e))}async function vv(i,e){for(const n of i)if(await e(n))return!0;return!1}function bv(i){const e=[...i.ptr.out([ge.and])].flatMap(n=>[...n.list()]).map(n=>i.validator.shape(n));return{generic:wv(e)}}function wv(i){return async e=>{const n=await so(i,async o=>(await o.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),r=n.every(o=>o.conforms);e.test(r,ge.AndConstraintComponent,{results:n.flatMap(o=>o.results),value:e.valueOrNode})}}function xv(i){const e=i.validator.shape(i.ptr.out([ge.not]));return{generic:Ev(e)}}function Ev(i){return async e=>{const n=(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,r=!n.conforms;e.test(r,ge.NotConstraintComponent,{args:{not:i.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:n.results,value:e.valueOrNode})}}function Sv(i){const e=[...i.ptr.out([ge.or])].flatMap(n=>[...n.list()]).map(n=>i.validator.shape(n));return{generic:Tv(e)}}function Tv(i){return async e=>{let n=[],r;if(e.options.debug||e.options.details){const o=await so(i,async a=>(await a.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);n=o.flatMap(a=>a.results),r=o.some(a=>a.conforms)}else r=await vv(i,async o=>(await o.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(r,ge.OrConstraintComponent,{results:n,value:e.valueOrNode})}}function Lv(i){const e=[...i.ptr.out([ge.xone])].flatMap(n=>[...n.list()]).map(n=>i.validator.shape(n));return{generic:Iv(e)}}function Iv(i){return async e=>{const n=await so(i,async o=>(await o.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),r=n.filter(o=>o.conforms).length===1;e.test(r,ge.XoneConstraintComponent,{results:n.flatMap(o=>o.results),value:e.valueOrNode})}}function Av(i){if(!Zr.fromRdf(i.ptr.out([ge.closed]).term))return null;const n=i.ptr.out([ge.property]).map(a=>i.validator.shape(a)),r=new Jt(n.filter(a=>!a.deactivated).map(a=>a.path[0].predicates[0])),o=new Jt([...i.ptr.out([ge.ignoredProperties]).list()||[]].map(a=>a.term));return{node:Nv(r,o)}}function Nv(i,e){return n=>{const r=n.focusNode.execute({start:"subject",end:"predicate"}).filter(o=>e.has(o.term)?!1:!i.has(o.term));if(r.ptrs.length>0)for(const o of r)n.violation(ge.ClosedConstraintComponent,{message:[n.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[o.term]}],value:n.focusNode.node([[...o.quads()][0].object])});else n.debug(ge.ClosedConstraintComponent)}}function Rv(i){const e=i.ptr.out([ge.hasValue]).term;return{node:Cv(e),property:Pv(e)}}function Cv(i){return e=>{e.test(i.equals(e.valueOrNode.term),ge.HasValueConstraintComponent,{args:{hasValue:i},message:[e.factory.literal("Value must be {$hasValue}")]})}}function Pv(i){return e=>{const n=[...e.values].some(r=>i.equals(r.term));e.test(n,ge.HasValueConstraintComponent,{args:{hasValue:i},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function kv(i){const e=new Jt([...i.ptr.out([ge.in]).list()].map(n=>n.term));return{generic:Dv(e)}}function Dv(i){return e=>{e.test(i.has(e.valueOrNode.term),ge.InConstraintComponent,{args:{in:[...i].map(n=>n.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function Yi(i,e){if(!i||i.termType!=="Literal"||!e||e.termType!=="Literal"||Vh(i)!==Vh(e))return null;const n=Zr.fromRdf(i),r=Zr.fromRdf(e);return typeof n!=typeof r?null:typeof n=="string"?n.localeCompare(r):n-r}function Vh(i){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return su.dateTime.equals(i.datatype)&&e.test(i.value)}function Mv(i){const e=i.ptr.out([ge.disjoint]).term;return{generic:Ov(e)}}function Ov(i){return e=>{const n=e.focusNode.dataset.match(e.focusNode.term,i,e.valueOrNode.term);e.test(n.size===0,ge.DisjointConstraintComponent,{args:{disjoint:i},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function Fv(i){const e=i.ptr.out([ge.equals]).term;return{node:jv(e),property:Bv(e)}}function jv(i){return e=>{const n=e.focusNode.out([i]),r=n.filter(a=>!a.term.equals(e.focusNode.term)),o=n.terms.length!==0&&r.terms.length===0;e.test(o,ge.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")],value:r.terms[0]&&e.focusNode.node([r.terms[0]])||e.focusNode})}}function Bv(i){return e=>{const n=new Jt(e.focusNode.out([i]).terms),r=new Jt(e.values.terms),o=[...r].filter(u=>!n.has(u)),a=[...n].filter(u=>!r.has(u)),l=[...o,...a];for(const u of l)e.violation(ge.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([u])});l.length===0&&e.debug(ge.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")]})}}function $v(i){const e=i.ptr.out([ge.lessThan]).term;return{property:qv(e)}}function qv(i){return e=>{const n=e.focusNode.out([i]).terms;for(const r of e.values)for(const o of n){const a=Yi(r.term,o);a===null||a>=0?e.violation(ge.LessThanConstraintComponent,{args:{lessThan:i},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r}):e.debug(ge.LessThanConstraintComponent,{args:{lessThan:i},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r})}}}function zv(i){const e=i.ptr.out([ge.lessThanOrEquals]).term;return{property:Hv(e)}}function Hv(i){return e=>{const n=e.focusNode.out([i]).terms;for(const r of e.values)for(const o of n){const a=Yi(r.term,o);a===null||a>0?e.violation(ge.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:i},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r}):e.debug(ge.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:i},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r})}}}function Uv(i){const e=i.ptr.out([ge.maxExclusive]).term;return{generic:Vv(e)}}function Vv(i){return e=>{const n=Yi(e.valueOrNode.term,i);e.test(n!==null&&n<0,ge.MaxExclusiveConstraintComponent,{args:{maxExclusive:i},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function Wv(i){const e=i.ptr.out([ge.maxInclusive]).term;return{generic:Gv(e)}}function Gv(i){return e=>{const n=Yi(e.valueOrNode.term,i);e.test(n!==null&&n<=0,ge.MaxInclusiveConstraintComponent,{args:{maxInclusive:i},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function Zv(i){const e=i.ptr.out([ge.minExclusive]).term;return{generic:Xv(e)}}function Xv(i){return e=>{const n=Yi(e.valueOrNode.term,i);e.test(n!==null&&n>0,ge.MinExclusiveConstraintComponent,{args:{minExclusive:i},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Qv(i){const e=i.ptr.out([ge.minInclusive]).term;return{generic:Jv(e)}}function Jv(i){return e=>{const n=Yi(e.valueOrNode.term,i);e.test(n!==null&&n>=0,ge.MinInclusiveConstraintComponent,{args:{minInclusive:i},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Kv(i){const e=[...i.ptr.out([ge.node])].map(n=>i.validator.shape(n));return{generic:Yv(e)}}function Yv(i){return async e=>{for(const n of i){const r=await n.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(r.report.conforms,ge.NodeConstraintComponent,{args:{node:n.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:r.report.results,value:e.valueOrNode})}}}function eb(i){const e=[...i.ptr.out([ge.property])].map(n=>i.validator.shape(n));return{generic:tb(e)}}function tb(i){return async e=>{const n=e.create({focusNode:e.valueOrNode});for(const r of i)await r.validate(n)}}function nb(i){const e=i.validator.shape(i.ptr.out([ge.qualifiedValueShape])),n=i.ptr.out([ge.qualifiedValueShapesDisjoint]).term,r=n?Zr.fromRdf(n):!1,o=i.ptr.out([ge.qualifiedMaxCount]).term,a=o?parseInt(o.value):null,l=i.ptr.out([ge.qualifiedMinCount]).term,u=l?parseInt(l.value):null;return{property:ib(e,r,a,u)}}function ib(i,e,n,r){return async o=>{const a=[];let l=[];e&&(l=new Set(o.shape.ptr.in([ge.property]).out([ge.property]).out([ge.qualifiedValueShape]).filter(f=>!f.term.equals(i.ptr.term)).map(f=>o.shape.validator.shape(f))));const u=(await yv(o.values,async f=>{const h=(await i.validate(o.create({child:!0,focusNode:f}))).report;if(a.push(h.results),!h.conforms)return!1;if(l.length===0)return!0;if(o.options.debug||o.options.details){const g=await so([...l],async m=>(await m.validate(o.create({child:!0,focusNode:f}))).report);return a.push(g.flatMap(m=>m.results)),!g.every(m=>m.conforms)}else return!await _v([...l],async g=>(await g.validate(o.create({child:!0,focusNode:f}))).report.conforms)})).length;n!==null&&o.test(u<=n,ge.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:n,qualifiedValueShape:i.ptr.term,qualifiedValueShapesDisjoint:e},message:[o.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:a.flat()}),r!==null&&o.test(u>=r,ge.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:i.ptr.term,qualifiedValueShapesDisjoint:e},message:[o.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:a.flat()})}}function rb(i,e){return e?e.slice(0,i.length)===i:!1}function sb(i){const e=[...new Set([...i.ptr.out([ge.languageIn]).list()].map(n=>n.value))];return{generic:ob(e)}}function ob(i){return e=>{const n=i.some(r=>rb(r,e.valueOrNode.term.language));e.test(n,ge.LanguageInConstraintComponent,{args:{languageIn:i.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function ab(i){const e=parseInt(i.ptr.out([ge.maxLength]).value);return{generic:lb(e)}}function lb(i){return e=>{const n=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=i;e.test(n,ge.MaxLengthConstraintComponent,{args:{maxLength:i},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function ub(i){const e=parseInt(i.ptr.out([ge.minLength]).value);return{generic:cb(e)}}function cb(i){return e=>{const n=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=i;e.test(n,ge.MinLengthConstraintComponent,{args:{minLength:i},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function db(i){const e=i.ptr.out([ge.pattern]).value,n=i.ptr.out([ge.flags]).value,r=new RegExp(e,n);return{generic:hb(e,n,r)}}function hb(i,e,n){return r=>{r.test(n.test(r.valueOrNode.term.value),ge.PatternConstraintComponent,{args:{flags:e,pattern:i},message:[r.factory.literal('Value does not match pattern "{$pattern}"')],value:r.valueOrNode})}}function fb(i){const e=i.ptr.out([ge.uniqueLang]).term;return e.value==="true"&&su.boolean.equals(e.datatype)?{property:pb()}:null}function pb(){return i=>{const n=Object.entries(i.values.terms.reduce((r,o)=>(o.language&&(r[o.language]=(r[o.language]||0)+1),r),{})).filter(([,r])=>r>1);for(const[r]of n)i.violation(ge.UniqueLangConstraintComponent,{args:{lang:r},message:[i.factory.literal('Language "{?lang}" used more than once')]});n.length===0&&i.debug(ge.UniqueLangConstraintComponent)}}const Ms=Yt("http://www.w3.org/ns/shacl#"),Ep=Yt("https://schemas.link/shacl-next#");class Qi{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Ms.Info)||e.severity.equals(Ms.Violation)||e.severity.equals(Ms.Warning))}}function gb(i,e){return Object.entries(e).reduce((n,[r,o])=>(o&&o.termType&&(o=qt(o)),n.replace(`{$${r}}`,o).replace(`{?${r}}`,o)),i)}class Vs{constructor({args:e={},factory:n,message:r=[],severity:o=Ms.Violation}={}){this.severity=o,this.message=r.map(a=>n.literal(gb(a.value,e),a.language||null))}}class au{constructor({factory:e=ru}={}){this.factory=e}clone({factory:e}={}){return new au({factory:e||this.factory})}validate(){return new Qi}validateSimple(){return!0}}class er extends au{constructor({datatypes:e,factory:n}={}){super({factory:n}),this.datatypes=[];for(const r of Array.isArray(e)?e:[e])r&&this.datatypes.push(this.factory.fromTerm(r))}clone({factory:e}={}){return new er({datatypes:this.datatypes,factory:e||this.factory})}}class mb{constructor({factory:e=ru,validations:n}={}){if(this.factory=e,this.validations=new Ii,n)for(const r of Object.values(n)){const o=r.clone({factory:this.factory});for(const a of o.datatypes)this.validations.set(a,o)}}validate(e){const n=this.validations.get(e.datatype);return n?n.validate(e):new Qi}validateSimple(e){const n=this.validations.get(e.datatype);return n?n.validateSimple(e):!0}}class ot extends er{constructor(e,n,{factory:r}={}){super({datatypes:n,factory:r}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new ot(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const n=this.patterns.map(r=>{let o;r.test(e.value)&&(o=Ep.Debug);const a={pattern:this.factory.literal(r.toString()),this:e};return new Vs({args:a,factory:this.factory,message:this.message,severity:o})});return new Qi({results:n})}validateSimple(e){return this.patterns.every(n=>n.test(e.value))}}const _b=/^([-+]?[0-9]+)$/;class Dt extends ot{constructor(e=null,n=null,r,{factory:o}={}){super(_b,r,{factory:o}),this.maxInclusive=null,this.minInclusive=null,typeof n=="string"&&(this.maxInclusive=BigInt(n)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new Dt(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const n=super.validate(e).results;if(!Ep.Debug.equals(n[0].severity))return new Qi({results:n});const r=BigInt(e.value);if(this.minInclusive!==null&&r<this.minInclusive){const o=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,a=[this.factory.literal(o)];n.push(new Vs({factory:this.factory,message:a}))}if(this.maxInclusive!==null&&r>this.maxInclusive){const o=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,a=[this.factory.literal(o)];n.push(new Vs({factory:this.factory,message:a}))}return new Qi({results:n})}validateSimple(e){if(!super.validateSimple(e))return!1;const n=BigInt(e.value);return!(this.minInclusive!==null&&n<this.minInclusive||this.maxInclusive!==null&&n>this.maxInclusive)}}class lu extends er{constructor(e,n,{factory:r}={}){super({datatypes:n,factory:r}),this.values=new Set(e)}clone({factory:e}={}){return new lu(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const n=[];if(!this.values.has(e.value)){const r=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,o=[this.factory.literal(r)];n.push(new Vs({factory:this.factory,message:o}))}return new Qi({results:n})}validateSimple(e){return this.values.has(e.value)}}const We={xsd:Yt("http://www.w3.org/2001/XMLSchema#")},yb=new er({datatypes:We.xsd.anySimpleType}),vb=new er({datatypes:We.xsd.anyAtomicType}),oo=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,bb=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Sp=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,uu=/^(-?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)))))$/,Tp=/^(-?([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))?)$/,wb=/^((([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))?)$/,xb=/^(-?([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))?)$/,Eb=/^(-?([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))?)$/,Sb=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Tb=/^(--(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))?)$/,Lb=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Ib=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Ab=/^(([0-9a-fA-F]{2})*)$/,Nb=/^(((([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] ?= ?=))?)$/,Rb=new ot(oo,We.xsd.string),Cb=new lu(["1","true","0","false"],We.xsd.boolean),Pb=new ot(bb,We.xsd.decimal),kb=new ot(Sp,We.xsd.float),Db=new ot(Sp,We.xsd.double),Mb=new ot(uu,We.xsd.duration),Ob=new ot(Tp,We.xsd.dateTime),Fb=new ot(wb,We.xsd.time),jb=new ot(xb,We.xsd.date),Bb=new ot(Eb,We.xsd.gYearMonth),$b=new ot(Sb,We.xsd.gYear),qb=new ot(Tb,We.xsd.gMonthDay),zb=new ot(Lb,We.xsd.gDay),Hb=new ot(Ib,We.xsd.gMonth),Ub=new ot(Ab,We.xsd.hexBinary),Vb=new ot(Nb,We.xsd.base64Binary),Wb=new ot(oo,We.xsd.anyURI),Lp=/^([^\u000d\u000a\u0009]*)$/,Gb=/^([^ ]+( [^ ]+)*)*$/,Zb=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Xb=/^([^DT]*)$/,Qb=/^([^YM]*[DT].*)$/,Jb=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Kb=new ot([oo,Lp],We.xsd.normalizedString),Yb=new ot([oo,Lp,Gb],We.xsd.token),e0=new ot(Zb,We.xsd.language),t0=new Dt(null,null,We.xsd.integer),n0=new Dt(null,"0",We.xsd.nonPositiveInteger),i0=new Dt(null,"-1",We.xsd.negativeInteger),r0=new Dt("-9223372036854775808","9223372036854775807",We.xsd.long),s0=new Dt("-2147483648","2147483647",We.xsd.int),o0=new Dt("-32768","32767",We.xsd.short),a0=new Dt("-128","127",We.xsd.byte),l0=new Dt("0",null,We.xsd.nonNegativeInteger),u0=new Dt("0","18446744073709551615",We.xsd.unsignedLong),c0=new Dt("0","4294967295",We.xsd.unsignedInt),d0=new Dt("0","65535",We.xsd.unsignedShort),h0=new Dt("0","255",We.xsd.unsignedByte),f0=new Dt("1",null,We.xsd.positiveInteger),p0=new ot([uu,Xb],We.xsd.yearMonthDuration),g0=new ot([uu,Qb],We.xsd.dayTimeDuration),m0=new ot([Tp,Jb],We.xsd.dateTimeStamp),_0=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:vb,anySimpleType:yb,anyURI:Wb,base64Binary:Vb,boolean:Cb,byte:a0,date:jb,dateTime:Ob,dateTimeStamp:m0,dayTimeDuration:g0,decimal:Pb,double:Db,duration:Mb,float:kb,gDay:zb,gMonth:Hb,gMonthDay:qb,gYear:$b,gYearMonth:Bb,hexBinary:Ub,int:s0,integer:t0,language:e0,long:r0,negativeInteger:i0,nonNegativeInteger:l0,nonPositiveInteger:n0,normalizedString:Kb,positiveInteger:f0,short:o0,string:Rb,time:Fb,token:Yb,unsignedByte:h0,unsignedInt:c0,unsignedLong:u0,unsignedShort:d0,yearMonthDuration:p0},Symbol.toStringTag,{value:"Module"}));class y0 extends mb{constructor({factory:e}={}){super({factory:e,validations:{..._0}})}}const v0=new Ii([[ge.BlankNode,new Set(["BlankNode"])],[ge.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ge.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ge.IRI,new Set(["NamedNode"])],[ge.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ge.Literal,new Set(["Literal"])]]);function b0(i){const e=i.ptr.out([ge.class]).map(n=>Rl(n));return{generic:w0(e)}}function w0(i){return e=>{const n=new Jt(e.valueOrNode.out([Si.type]).terms);for(const r of i){const o=[...n].some(a=>r.has(a));e.test(o,ge.ClassConstraintComponent,{value:e.valueOrNode})}}}function x0(i){const e=i.ptr.out([ge.datatype]).term,n=new y0;return{generic:E0(e,n)}}function E0(i,e){return n=>{const r=i.equals(n.valueOrNode.term.datatype)&&e.validateSimple(n.valueOrNode.term);n.test(r,ge.DatatypeConstraintComponent,{args:{datatype:i},message:[n.factory.literal("Value does not have datatype {$datatype}")],value:n.valueOrNode})}}function S0(i){const e=i.ptr.out([ge.nodeKind]).term,n=v0.get(e);return{generic:T0(e,n)}}function T0(i,e){return n=>{n.test(e.has(n.valueOrNode.term.termType),ge.NodeKindConstraintComponent,{args:{nodeKind:i},message:[n.factory.literal("Value does not have node kind {$nodeKind}")],value:n.valueOrNode})}}const L0=new Ii([[ge.maxCount,fv],[ge.minCount,gv],[ge.and,bv],[ge.not,xv],[ge.or,Sv],[ge.xone,Lv],[ge.closed,Av],[ge.hasValue,Rv],[ge.in,kv],[ge.disjoint,Mv],[ge.equals,Fv],[ge.lessThan,$v],[ge.lessThanOrEquals,zv],[ge.maxExclusive,Uv],[ge.maxInclusive,Wv],[ge.minExclusive,Zv],[ge.minInclusive,Qv],[ge.node,Kv],[ge.property,eb],[ge.qualifiedValueShape,nb],[ge.languageIn,sb],[ge.maxLength,ab],[ge.minLength,ub],[ge.pattern,db],[ge.uniqueLang,fb],[ge.class,b0],[ge.datatype,x0],[ge.nodeKind,S0]]);class Wh{constructor(e,{factory:n,...r}){if(this.factory=n,this.options=r,this.registry=new ev(L0),this.targetResolverRegistry=new hv(this.options.targetResolvers||[]),this.shapesPtr=new Us({dataset:e,factory:n}),this.shapes=new Ii,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[a,l]of this.options.validations)this.registry.validations.set(a,l);const o=[...this.shapesPtr.hasOut([ge.targetClass]),...this.shapesPtr.hasOut([ge.targetNode]),...this.shapesPtr.hasOut([ge.targetObjectsOf]),...this.shapesPtr.hasOut([ge.targetSubjectsOf]),...this.shapesPtr.hasOut([ge.target]),...this.shapesPtr.hasOut([Si.type],[ge.NodeShape]),...this.shapesPtr.hasOut([Si.type],[ge.PropertyShape])];for(const a of o)this.shape(a)}shape(e){if(!e.term)return null;let n=this.shapes.get(e.term);return n||(n=new dv(e,{validator:this}),this.shapes.set(e.term,n)),n}async validate(e,n){const r=new Us({...e,factory:this.factory}),o=new ou({factory:this.factory,focusNode:r,options:this.options,validator:this});n?n=n.map(a=>this.shape(this.shapesPtr.node(a.terms))):n=this.shapes.values();for(const a of n){const l=o.create({shape:a});let u;r.isAny()?u=await a.resolveTargets(l):u=r;for(const f of u)await a.validate(l.create({focusNode:f}))}return o.report}}const I0={[`${Fe}node`]:(i,e)=>{i.extendedShapes.add(new Ws(e,i.config,i))},[`${Fe}and`]:(i,e)=>{for(const n of i.config.lists[e.value])i.extendedShapes.add(new Ws(n,i.config,i))},[`${Fe}property`]:(i,e)=>{const n=i.config.getPropertyTemplate(e,i);if(n.path){let r=i.properties[n.path];if(r||(r=[],i.properties[n.path]=r),n.qualifiedValueShape)r.push(n);else{let o;for(let a=0;a<i.properties[n.path].length&&!o;a++)i.properties[n.path][a].qualifiedValueShape||(o=i.properties[n.path][a]);o?Hf(o,n):r.push(n)}}},[`${Fe}nodeKind`]:(i,e)=>{i.nodeKind=e},[`${Fe}targetClass`]:(i,e)=>{i.targetClass=e},[`${Fe}or`]:(i,e)=>{i.or=i.config.lists[e.value]},[`${Fe}xone`]:(i,e)=>{i.xone=i.config.lists[e.value]},[$l.id]:(i,e)=>{i.owlImports.add(e)},[`${Bl}title`]:(i,e)=>{const n=e;i.label=js(i.config.languages,i.label,n)},[`${Js}label`]:(i,e)=>{const n=e;i.label=js(i.config.languages,i.label,n)}};class Ws{constructor(e,n,r){this.extendedShapes=new Set,this.properties={},this.owlImports=new Set,this.id=e,this.config=n,this.parent=r,n.registerNodeTemplate(this),A0(this,this.config.store.getQuads(e,null,null,null))}}function A0(i,e){for(const n of e)I0[n.predicate.id]?.call(i,i,n.object);return i}function N0(i){for(const e of Object.values(i.properties))for(const n of e){const[r,o]=Cl(i,n.path);if(r.length>1&&o){const a=r[r.length-1];for(let l=r.length-2;l>=0;l--){const u=r[l];delete u.parent.properties[u.path],Hf(a,u)}}}}function Cl(i,e,n=new Set,r=[],o=!1){if(!n.has(i.id.value)){n.add(i.id.value);const a=i.properties[e];if(a?.length===1){r.push(a[0]),o=o||a[0].maxCount===1;for(const l of a[0].nodeShapes){const[u,f]=Cl(l,e,n,r,o);o=o||f}}for(const l of i.extendedShapes){const[u,f]=Cl(l,e,n,r,o);o=o||f}}return[r,o]}class _l{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.hierarchyColors=null,this.submitButton=null,this.generateNodeShapeReference=Fs.value,this.showNodeIds=null,this.showRootShapeLabel=null,this.dense="true",this.useShadowRoot="true"}}const R0="#4c93d785, #f85e9a85, #00327385, #87001f85";class Gh{constructor(e){this.attributes=new _l,this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new It,this._nodeTemplates={},this._propertyTemplates={},this.validator=new Wh(this._store,{details:!0,factory:Be}),this.providedConformingResourceIds={},this.providedResources={},this.form=e,this._theme=new gy,this.languages=[...new Set(navigator.languages.flatMap(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}reset(){this.lists={},this.groups=[],this.renderedNodes.clear(),this.providedConformingResourceIds={},this.providedResources={},this._nodeTemplates={},this._propertyTemplates={}}updateAttributes(e){const n=new _l;if(Object.keys(n).forEach(r=>{const o=e.dataset[r];o!==void 0&&(n[r]=o)}),this.editMode=n.view===null,this.theme.setDense(n.dense==="true"),this.attributes=n,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),n.language){const r=this.languages.indexOf(n.language);r>-1&&this.languages.splice(r,1),this.languages.unshift(n.language)}if(n.valuesGraph&&(this.valuesGraphId=Be.namedNode(n.valuesGraph)),n.hierarchyColors!=null){const r=n.hierarchyColors.length?n.hierarchyColors:R0;let o=`:host { --hierarchy-colors: ${r}; --hierarchy-colors-length: ${r.split(",").length} }`;for(let a=8;a>=0;a--){let l=`shacl-property { --hierarchy-level: ${a} }`;for(let u=0;u<a;u++)l="shacl-property "+l;o=o+`
|
|
430
|
-
`+
|
|
431
|
-
`).replace(/:host\b/g
|
|
432
|
-
`);this.styleElement||(this.styleElement=document.createElement(
|
|
433
|
-
:scope shacl-node[data-node-id='${
|
|
434
|
-
:scope shacl-node[data-node-id='${
|
|
435
|
-
:scope shacl-node[data-node-id='${
|
|
436
|
-
:scope shacl-node[data-node-id='${
|
|
437
|
-
:scope [data-node-id='${
|
|
438
|
-
:scope [data-node-id='${f.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${h.id}']`));for(const m of g)if(m.classList.contains("editor")){if(!e||m.value){let d=m.parentElement;d.classList.add("invalid"),d.classList.remove("valid"),d.appendChild(this.createValidationErrorDisplay(l));do d instanceof Pt&&(d.open=!0),d=d.parentElement;while(d)}}else e||(m.classList.add("invalid"),m.classList.remove("valid"),m.appendChild(this.createValidationErrorDisplay(l,"node")))}else e||this.form.querySelector(`:scope [data-node-id='${f.id}']`)?.prepend(this.createValidationErrorDisplay(l,"node"))}o(a)}catch(a){console.error(a),o({conforms:!1,results:[]})}})})}createValidationErrorDisplay(e,n){const r=document.createElement("span");r.classList.add("validation-error"),n&&r.classList.add(n);const o=typeof e=="object"&&e!==null?e:null;if(o)if(o.message?.length)for(const a of o.message)r.title+=a.value+`
|
|
439
|
-
`;else o.sourceConstraintComponent?.value&&(r.title=o.sourceConstraintComponent.value);else typeof e=="string"&&(r.title=e);return r}findRootShaclShapeSubject(){if(this.config.attributes.shapeSubject){const e=Be.namedNode(this.config.attributes.shapeSubject);if(this.config.store.getQuads(e,Rt,la,null).length===0){console.warn(`shapes graph does not contain requested node shape ${this.config.attributes.shapeSubject}`);return}else return e}else{if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,Ft)>0){const n=Be.namedNode(this.config.attributes.valuesSubject),r=[...this.config.store.getQuads(n,Rt,null,Ft),...this.config.store.getQuads(n,Fs,null,Ft)];if(r.length===0)console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${Rt.id} nor ${Fs.id} statement`);else for(const a of r)if(this.config.store.getQuads(a.object,Rt,la,null).length>0)return a.object;const o=this.config.store.getObjects(n,Rt,Ft);for(const a of o)for(const l of this.config.store.getQuads(null,Ks,a,null))return l.subject}const e=this.config.store.getQuads(null,Rt,la,null);if(e.length==0){console.warn("shapes graph does not contain any node shapes");return}return e.length>1&&(console.warn("shapes graph contains",e.length,"node shapes. choosing first found which is",e[0].subject.value),console.info('hint: set the node shape to use with element attribute "data-shape-subject"')),e[0].subject}}removeFromDataGraph(e){for(const n of this.config.store.getQuads(e,null,null,Ft))this.config.store.delete(n),(n.object.termType==="NamedNode"||n.object.termType==="BlankNode")&&this.removeFromDataGraph(n.object)}}window.customElements.define("shacl-form",P0);class yw extends Wf{constructor(e,n,r){super(e),this.onChange=n,this.fileType=r}createEditor(e){const n=Ur(e)>0,r=e.config.theme.createFileEditor(e.label,null,n,e);return r.addEventListener("change",o=>{o.stopPropagation(),this.onChange(o)}),this.fileType&&r.querySelector('input[type="file"]')?.setAttribute("accept",this.fileType),r}}var Br={exports:{}};var k0=Br.exports,Zh;function cu(){return Zh||(Zh=1,(function(i,e){(function(n,r){r(e)})(k0,(function(n){var r="1.9.4";function o(t){var s,c,p,E;for(c=1,p=arguments.length;c<p;c++){E=arguments[c];for(s in E)t[s]=E[s]}return t}var a=Object.create||(function(){function t(){}return function(s){return t.prototype=s,new t}})();function l(t,s){var c=Array.prototype.slice;if(t.bind)return t.bind.apply(t,c.call(arguments,1));var p=c.call(arguments,2);return function(){return t.apply(s,p.length?p.concat(c.call(arguments)):arguments)}}var u=0;function f(t){return"_leaflet_id"in t||(t._leaflet_id=++u),t._leaflet_id}function h(t,s,c){var p,E,D,ne;return ne=function(){p=!1,E&&(D.apply(c,E),E=!1)},D=function(){p?E=arguments:(t.apply(c,arguments),setTimeout(ne,s),p=!0)},D}function g(t,s,c){var p=s[1],E=s[0],D=p-E;return t===p&&c?t:((t-E)%D+D)%D+E}function m(){return!1}function d(t,s){if(s===!1)return t;var c=Math.pow(10,s===void 0?6:s);return Math.round(t*c)/c}function _(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function b(t){return _(t).split(/\s+/)}function I(t,s){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?a(t.options):{});for(var c in s)t.options[c]=s[c];return t.options}function A(t,s,c){var p=[];for(var E in t)p.push(encodeURIComponent(c?E.toUpperCase():E)+"="+encodeURIComponent(t[E]));return(!s||s.indexOf("?")===-1?"?":"&")+p.join("&")}var N=/\{ *([\w_ -]+) *\}/g;function P(t,s){return t.replace(N,function(c,p){var E=s[p];if(E===void 0)throw new Error("No value provided for variable "+c);return typeof E=="function"&&(E=E(s)),E})}var w=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function y(t,s){for(var c=0;c<t.length;c++)if(t[c]===s)return c;return-1}var S="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function O(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var X=0;function C(t){var s=+new Date,c=Math.max(0,16-(s-X));return X=s+c,window.setTimeout(t,c)}var U=window.requestAnimationFrame||O("RequestAnimationFrame")||C,R=window.cancelAnimationFrame||O("CancelAnimationFrame")||O("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function $(t,s,c){if(c&&U===C)t.call(s);else return U.call(window,l(t,s))}function G(t){t&&R.call(window,t)}var j={__proto__:null,extend:o,create:a,bind:l,get lastId(){return u},stamp:f,throttle:h,wrapNum:g,falseFn:m,formatNum:d,trim:_,splitWords:b,setOptions:I,getParamString:A,template:P,isArray:w,indexOf:y,emptyImageUrl:S,requestFn:U,cancelFn:R,requestAnimFrame:$,cancelAnimFrame:G};function F(){}F.extend=function(t){var s=function(){I(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},c=s.__super__=this.prototype,p=a(c);p.constructor=s,s.prototype=p;for(var E in this)Object.prototype.hasOwnProperty.call(this,E)&&E!=="prototype"&&E!=="__super__"&&(s[E]=this[E]);return t.statics&&o(s,t.statics),t.includes&&(se(t.includes),o.apply(null,[p].concat(t.includes))),o(p,t),delete p.statics,delete p.includes,p.options&&(p.options=c.options?a(c.options):{},o(p.options,t.options)),p._initHooks=[],p.callInitHooks=function(){if(!this._initHooksCalled){c.callInitHooks&&c.callInitHooks.call(this),this._initHooksCalled=!0;for(var D=0,ne=p._initHooks.length;D<ne;D++)p._initHooks[D].call(this)}},s},F.include=function(t){var s=this.prototype.options;return o(this.prototype,t),t.options&&(this.prototype.options=s,this.mergeOptions(t.options)),this},F.mergeOptions=function(t){return o(this.prototype.options,t),this},F.addInitHook=function(t){var s=Array.prototype.slice.call(arguments,1),c=typeof t=="function"?t:function(){this[t].apply(this,s)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(c),this};function se(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=w(t)?t:[t];for(var s=0;s<t.length;s++)t[s]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var M={on:function(t,s,c){if(typeof t=="object")for(var p in t)this._on(p,t[p],s);else{t=b(t);for(var E=0,D=t.length;E<D;E++)this._on(t[E],s,c)}return this},off:function(t,s,c){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var p in t)this._off(p,t[p],s);else{t=b(t);for(var E=arguments.length===1,D=0,ne=t.length;D<ne;D++)E?this._off(t[D]):this._off(t[D],s,c)}return this},_on:function(t,s,c,p){if(typeof s!="function"){console.warn("wrong listener type: "+typeof s);return}if(this._listens(t,s,c)===!1){c===this&&(c=void 0);var E={fn:s,ctx:c};p&&(E.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(E)}},_off:function(t,s,c){var p,E,D;if(this._events&&(p=this._events[t],!!p)){if(arguments.length===1){if(this._firingCount)for(E=0,D=p.length;E<D;E++)p[E].fn=m;delete this._events[t];return}if(typeof s!="function"){console.warn("wrong listener type: "+typeof s);return}var ne=this._listens(t,s,c);if(ne!==!1){var he=p[ne];this._firingCount&&(he.fn=m,this._events[t]=p=p.slice()),p.splice(ne,1)}}},fire:function(t,s,c){if(!this.listens(t,c))return this;var p=o({},s,{type:t,target:this,sourceTarget:s&&s.sourceTarget||this});if(this._events){var E=this._events[t];if(E){this._firingCount=this._firingCount+1||1;for(var D=0,ne=E.length;D<ne;D++){var he=E[D],ye=he.fn;he.once&&this.off(t,ye,he.ctx),ye.call(he.ctx||this,p)}this._firingCount--}}return c&&this._propagateEvent(p),this},listens:function(t,s,c,p){typeof t!="string"&&console.warn('"string" type argument expected');var E=s;typeof s!="function"&&(p=!!s,E=void 0,c=void 0);var D=this._events&&this._events[t];if(D&&D.length&&this._listens(t,E,c)!==!1)return!0;if(p){for(var ne in this._eventParents)if(this._eventParents[ne].listens(t,s,c,p))return!0}return!1},_listens:function(t,s,c){if(!this._events)return!1;var p=this._events[t]||[];if(!s)return!!p.length;c===this&&(c=void 0);for(var E=0,D=p.length;E<D;E++)if(p[E].fn===s&&p[E].ctx===c)return E;return!1},once:function(t,s,c){if(typeof t=="object")for(var p in t)this._on(p,t[p],s,!0);else{t=b(t);for(var E=0,D=t.length;E<D;E++)this._on(t[E],s,c,!0)}return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[f(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[f(t)],this},_propagateEvent:function(t){for(var s in this._eventParents)this._eventParents[s].fire(t.type,o({layer:t.target,propagatedFrom:t.target},t),!0)}};M.addEventListener=M.on,M.removeEventListener=M.clearAllEventListeners=M.off,M.addOneTimeEventListener=M.once,M.fireEvent=M.fire,M.hasEventListeners=M.listens;var re=F.extend(M);function B(t,s,c){this.x=c?Math.round(t):t,this.y=c?Math.round(s):s}var oe=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};B.prototype={clone:function(){return new B(this.x,this.y)},add:function(t){return this.clone()._add(T(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(T(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new B(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new B(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=oe(this.x),this.y=oe(this.y),this},distanceTo:function(t){t=T(t);var s=t.x-this.x,c=t.y-this.y;return Math.sqrt(s*s+c*c)},equals:function(t){return t=T(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=T(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+d(this.x)+", "+d(this.y)+")"}};function T(t,s,c){return t instanceof B?t:w(t)?new B(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new B(t.x,t.y):new B(t,s,c)}function Q(t,s){if(t)for(var c=s?[t,s]:t,p=0,E=c.length;p<E;p++)this.extend(c[p])}Q.prototype={extend:function(t){var s,c;if(!t)return this;if(t instanceof B||typeof t[0]=="number"||"x"in t)s=c=T(t);else if(t=ie(t),s=t.min,c=t.max,!s||!c)return this;return!this.min&&!this.max?(this.min=s.clone(),this.max=c.clone()):(this.min.x=Math.min(s.x,this.min.x),this.max.x=Math.max(c.x,this.max.x),this.min.y=Math.min(s.y,this.min.y),this.max.y=Math.max(c.y,this.max.y)),this},getCenter:function(t){return T((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return T(this.min.x,this.max.y)},getTopRight:function(){return T(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var s,c;return typeof t[0]=="number"||t instanceof B?t=T(t):t=ie(t),t instanceof Q?(s=t.min,c=t.max):s=c=t,s.x>=this.min.x&&c.x<=this.max.x&&s.y>=this.min.y&&c.y<=this.max.y},intersects:function(t){t=ie(t);var s=this.min,c=this.max,p=t.min,E=t.max,D=E.x>=s.x&&p.x<=c.x,ne=E.y>=s.y&&p.y<=c.y;return D&&ne},overlaps:function(t){t=ie(t);var s=this.min,c=this.max,p=t.min,E=t.max,D=E.x>s.x&&p.x<c.x,ne=E.y>s.y&&p.y<c.y;return D&&ne},isValid:function(){return!!(this.min&&this.max)},pad:function(t){var s=this.min,c=this.max,p=Math.abs(s.x-c.x)*t,E=Math.abs(s.y-c.y)*t;return ie(T(s.x-p,s.y-E),T(c.x+p,c.y+E))},equals:function(t){return t?(t=ie(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight())):!1}};function ie(t,s){return!t||t instanceof Q?t:new Q(t,s)}function Y(t,s){if(t)for(var c=s?[t,s]:t,p=0,E=c.length;p<E;p++)this.extend(c[p])}Y.prototype={extend:function(t){var s=this._southWest,c=this._northEast,p,E;if(t instanceof Z)p=t,E=t;else if(t instanceof Y){if(p=t._southWest,E=t._northEast,!p||!E)return this}else return t?this.extend(W(t)||me(t)):this;return!s&&!c?(this._southWest=new Z(p.lat,p.lng),this._northEast=new Z(E.lat,E.lng)):(s.lat=Math.min(p.lat,s.lat),s.lng=Math.min(p.lng,s.lng),c.lat=Math.max(E.lat,c.lat),c.lng=Math.max(E.lng,c.lng)),this},pad:function(t){var s=this._southWest,c=this._northEast,p=Math.abs(s.lat-c.lat)*t,E=Math.abs(s.lng-c.lng)*t;return new Y(new Z(s.lat-p,s.lng-E),new Z(c.lat+p,c.lng+E))},getCenter:function(){return new Z((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new Z(this.getNorth(),this.getWest())},getSouthEast:function(){return new Z(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){typeof t[0]=="number"||t instanceof Z||"lat"in t?t=W(t):t=me(t);var s=this._southWest,c=this._northEast,p,E;return t instanceof Y?(p=t.getSouthWest(),E=t.getNorthEast()):p=E=t,p.lat>=s.lat&&E.lat<=c.lat&&p.lng>=s.lng&&E.lng<=c.lng},intersects:function(t){t=me(t);var s=this._southWest,c=this._northEast,p=t.getSouthWest(),E=t.getNorthEast(),D=E.lat>=s.lat&&p.lat<=c.lat,ne=E.lng>=s.lng&&p.lng<=c.lng;return D&&ne},overlaps:function(t){t=me(t);var s=this._southWest,c=this._northEast,p=t.getSouthWest(),E=t.getNorthEast(),D=E.lat>s.lat&&p.lat<c.lat,ne=E.lng>s.lng&&p.lng<c.lng;return D&&ne},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,s){return t?(t=me(t),this._southWest.equals(t.getSouthWest(),s)&&this._northEast.equals(t.getNorthEast(),s)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function me(t,s){return t instanceof Y?t:new Y(t,s)}function Z(t,s,c){if(isNaN(t)||isNaN(s))throw new Error("Invalid LatLng object: ("+t+", "+s+")");this.lat=+t,this.lng=+s,c!==void 0&&(this.alt=+c)}Z.prototype={equals:function(t,s){if(!t)return!1;t=W(t);var c=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return c<=(s===void 0?1e-9:s)},toString:function(t){return"LatLng("+d(this.lat,t)+", "+d(this.lng,t)+")"},distanceTo:function(t){return K.distance(this,W(t))},wrap:function(){return K.wrapLatLng(this)},toBounds:function(t){var s=180*t/40075017,c=s/Math.cos(Math.PI/180*this.lat);return me([this.lat-s,this.lng-c],[this.lat+s,this.lng+c])},clone:function(){return new Z(this.lat,this.lng,this.alt)}};function W(t,s,c){return t instanceof Z?t:w(t)&&typeof t[0]!="object"?t.length===3?new Z(t[0],t[1],t[2]):t.length===2?new Z(t[0],t[1]):null:t==null?t:typeof t=="object"&&"lat"in t?new Z(t.lat,"lng"in t?t.lng:t.lon,t.alt):s===void 0?null:new Z(t,s,c)}var ee={latLngToPoint:function(t,s){var c=this.projection.project(t),p=this.scale(s);return this.transformation._transform(c,p)},pointToLatLng:function(t,s){var c=this.scale(s),p=this.transformation.untransform(t,c);return this.projection.unproject(p)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var s=this.projection.bounds,c=this.scale(t),p=this.transformation.transform(s.min,c),E=this.transformation.transform(s.max,c);return new Q(p,E)},infinite:!1,wrapLatLng:function(t){var s=this.wrapLng?g(t.lng,this.wrapLng,!0):t.lng,c=this.wrapLat?g(t.lat,this.wrapLat,!0):t.lat,p=t.alt;return new Z(c,s,p)},wrapLatLngBounds:function(t){var s=t.getCenter(),c=this.wrapLatLng(s),p=s.lat-c.lat,E=s.lng-c.lng;if(p===0&&E===0)return t;var D=t.getSouthWest(),ne=t.getNorthEast(),he=new Z(D.lat-p,D.lng-E),ye=new Z(ne.lat-p,ne.lng-E);return new Y(he,ye)}},K=o({},ee,{wrapLng:[-180,180],R:6371e3,distance:function(t,s){var c=Math.PI/180,p=t.lat*c,E=s.lat*c,D=Math.sin((s.lat-t.lat)*c/2),ne=Math.sin((s.lng-t.lng)*c/2),he=D*D+Math.cos(p)*Math.cos(E)*ne*ne,ye=2*Math.atan2(Math.sqrt(he),Math.sqrt(1-he));return this.R*ye}}),ue=6378137,ce={R:ue,MAX_LATITUDE:85.0511287798,project:function(t){var s=Math.PI/180,c=this.MAX_LATITUDE,p=Math.max(Math.min(c,t.lat),-c),E=Math.sin(p*s);return new B(this.R*t.lng*s,this.R*Math.log((1+E)/(1-E))/2)},unproject:function(t){var s=180/Math.PI;return new Z((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*s,t.x*s/this.R)},bounds:(function(){var t=ue*Math.PI;return new Q([-t,-t],[t,t])})()};function Ee(t,s,c,p){if(w(t)){this._a=t[0],this._b=t[1],this._c=t[2],this._d=t[3];return}this._a=t,this._b=s,this._c=c,this._d=p}Ee.prototype={transform:function(t,s){return this._transform(t.clone(),s)},_transform:function(t,s){return s=s||1,t.x=s*(this._a*t.x+this._b),t.y=s*(this._c*t.y+this._d),t},untransform:function(t,s){return s=s||1,new B((t.x/s-this._b)/this._a,(t.y/s-this._d)/this._c)}};function Te(t,s,c,p){return new Ee(t,s,c,p)}var q=o({},K,{code:"EPSG:3857",projection:ce,transformation:(function(){var t=.5/(Math.PI*ce.R);return Te(t,.5,-t,.5)})()}),te=o({},q,{code:"EPSG:900913"});function fe(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function xe(t,s){var c="",p,E,D,ne,he,ye;for(p=0,D=t.length;p<D;p++){for(he=t[p],E=0,ne=he.length;E<ne;E++)ye=he[E],c+=(E?"L":"M")+ye.x+" "+ye.y;c+=s?ke.svg?"z":"x":""}return c||"M0 0"}var Se=document.documentElement.style,Ie="ActiveXObject"in window,le=Ie&&!document.addEventListener,be="msLaunchUri"in navigator&&!("documentMode"in document),Ae=At("webkit"),ve=At("android"),qe=At("android 2")||At("android 3"),mt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),$e=ve&&At("Google")&&mt<537&&!("AudioNode"in window),ft=!!window.opera,k=!be&&At("chrome"),v=At("gecko")&&!Ae&&!ft&&!Ie,x=!k&&At("safari"),H=At("phantom"),ae="OTransition"in Se,_e=navigator.platform.indexOf("Win")===0,we=Ie&&"transition"in Se,Oe="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!qe,Ye="MozPerspective"in Se,Qe=!window.L_DISABLE_3D&&(we||Oe||Ye)&&!ae&&!H,Ge=typeof orientation<"u"||At("mobile"),Ze=Ge&&Ae,$t=Ge&&Oe,en=!window.PointerEvent&&window.MSPointerEvent,st=!!(window.PointerEvent||en),at="ontouchstart"in window||!!window.TouchEvent,Ai=!window.L_NO_TOUCH&&(at||st),hn=Ge&&ft,Fn=Ge&&v,ei=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,z=(function(){var t=!1;try{var s=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",m,s),window.removeEventListener("testPassiveEventSupport",m,s)}catch{}return t})(),J=(function(){return!!document.createElement("canvas").getContext})(),Ne=!!(document.createElementNS&&fe("svg").createSVGRect),Re=!!Ne&&(function(){var t=document.createElement("div");return t.innerHTML="<svg/>",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),De=!Ne&&(function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var s=t.firstChild;return s.style.behavior="url(#default#VML)",s&&typeof s.adj=="object"}catch{return!1}})(),_t=navigator.platform.indexOf("Mac")===0,wt=navigator.platform.indexOf("Linux")===0;function At(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var ke={ie:Ie,ielt9:le,edge:be,webkit:Ae,android:ve,android23:qe,androidStock:$e,opera:ft,chrome:k,gecko:v,safari:x,phantom:H,opera12:ae,win:_e,ie3d:we,webkit3d:Oe,gecko3d:Ye,any3d:Qe,mobile:Ge,mobileWebkit:Ze,mobileWebkit3d:$t,msPointer:en,pointer:st,touch:Ai,touchNative:at,mobileOpera:hn,mobileGecko:Fn,retina:ei,passiveEvents:z,canvas:J,svg:Ne,vml:De,inlineSvg:Re,mac:_t,linux:wt},ti=ke.msPointer?"MSPointerDown":"pointerdown",Wt=ke.msPointer?"MSPointerMove":"pointermove",jn=ke.msPointer?"MSPointerUp":"pointerup",En=ke.msPointer?"MSPointerCancel":"pointercancel",fn={touchstart:ti,touchmove:Wt,touchend:jn,touchcancel:En},Bn={touchstart:ao,touchmove:tn,touchend:tn,touchcancel:tn},it={},V=!1;function de(t,s,c){return s==="touchstart"&&xt(),Bn[s]?(c=Bn[s].bind(this,c),t.addEventListener(fn[s],c,!1),c):(console.warn("wrong event specified:",s),m)}function pe(t,s,c){if(!fn[s]){console.warn("wrong event specified:",s);return}t.removeEventListener(fn[s],c,!1)}function Pe(t){it[t.pointerId]=t}function Ue(t){it[t.pointerId]&&(it[t.pointerId]=t)}function Je(t){delete it[t.pointerId]}function xt(){V||(document.addEventListener(ti,Pe,!0),document.addEventListener(Wt,Ue,!0),document.addEventListener(jn,Je,!0),document.addEventListener(En,Je,!0),V=!0)}function tn(t,s){if(s.pointerType!==(s.MSPOINTER_TYPE_MOUSE||"mouse")){s.touches=[];for(var c in it)s.touches.push(it[c]);s.changedTouches=[s],t(s)}}function ao(t,s){s.MSPOINTER_TYPE_TOUCH&&s.pointerType===s.MSPOINTER_TYPE_TOUCH&&St(s),tn(t,s)}function $n(t){var s={},c,p;for(p in t)c=t[p],s[p]=c&&c.bind?c.bind(t):c;return t=s,s.type="dblclick",s.detail=2,s.isTrusted=!1,s._simulated=!0,s}var ni=200;function Ip(t,s){t.addEventListener("dblclick",s);var c=0,p;function E(D){if(D.detail!==1){p=D.detail;return}if(!(D.pointerType==="mouse"||D.sourceCapabilities&&!D.sourceCapabilities.firesTouchEvents)){var ne=gu(D);if(!(ne.some(function(ye){return ye instanceof HTMLLabelElement&&ye.attributes.for})&&!ne.some(function(ye){return ye instanceof HTMLInputElement||ye instanceof HTMLSelectElement}))){var he=Date.now();he-c<=ni?(p++,p===2&&s($n(D))):p=1,c=he}}}return t.addEventListener("click",E),{dblclick:s,simDblclick:E}}function Ap(t,s){t.removeEventListener("dblclick",s.dblclick),t.removeEventListener("click",s.simDblclick)}var lo=ts(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),tr=ts(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),du=tr==="webkitTransition"||tr==="OTransition"?tr+"End":"transitionend";function hu(t){return typeof t=="string"?document.getElementById(t):t}function nr(t,s){var c=t.style[s]||t.currentStyle&&t.currentStyle[s];if((!c||c==="auto")&&document.defaultView){var p=document.defaultView.getComputedStyle(t,null);c=p?p[s]:null}return c==="auto"?null:c}function Ke(t,s,c){var p=document.createElement(t);return p.className=s||"",c&&c.appendChild(p),p}function ut(t){var s=t.parentNode;s&&s.removeChild(t)}function Yr(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function Ni(t){var s=t.parentNode;s&&s.lastChild!==t&&s.appendChild(t)}function Ri(t){var s=t.parentNode;s&&s.firstChild!==t&&s.insertBefore(t,s.firstChild)}function uo(t,s){if(t.classList!==void 0)return t.classList.contains(s);var c=es(t);return c.length>0&&new RegExp("(^|\\s)"+s+"(\\s|$)").test(c)}function He(t,s){if(t.classList!==void 0)for(var c=b(s),p=0,E=c.length;p<E;p++)t.classList.add(c[p]);else if(!uo(t,s)){var D=es(t);co(t,(D?D+" ":"")+s)}}function pt(t,s){t.classList!==void 0?t.classList.remove(s):co(t,_((" "+es(t)+" ").replace(" "+s+" "," ")))}function co(t,s){t.className.baseVal===void 0?t.className=s:t.className.baseVal=s}function es(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal}function Gt(t,s){"opacity"in t.style?t.style.opacity=s:"filter"in t.style&&Np(t,s)}function Np(t,s){var c=!1,p="DXImageTransform.Microsoft.Alpha";try{c=t.filters.item(p)}catch{if(s===1)return}s=Math.round(s*100),c?(c.Enabled=s!==100,c.Opacity=s):t.style.filter+=" progid:"+p+"(opacity="+s+")"}function ts(t){for(var s=document.documentElement.style,c=0;c<t.length;c++)if(t[c]in s)return t[c];return!1}function ii(t,s,c){var p=s||new B(0,0);t.style[lo]=(ke.ie3d?"translate("+p.x+"px,"+p.y+"px)":"translate3d("+p.x+"px,"+p.y+"px,0)")+(c?" scale("+c+")":"")}function yt(t,s){t._leaflet_pos=s,ke.any3d?ii(t,s):(t.style.left=s.x+"px",t.style.top=s.y+"px")}function ri(t){return t._leaflet_pos||new B(0,0)}var ir,rr,ho;if("onselectstart"in document)ir=function(){ze(window,"selectstart",St)},rr=function(){rt(window,"selectstart",St)};else{var sr=ts(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ir=function(){if(sr){var t=document.documentElement.style;ho=t[sr],t[sr]="none"}},rr=function(){sr&&(document.documentElement.style[sr]=ho,ho=void 0)}}function fo(){ze(window,"dragstart",St)}function po(){rt(window,"dragstart",St)}var ns,go;function mo(t){for(;t.tabIndex===-1;)t=t.parentNode;t.style&&(is(),ns=t,go=t.style.outlineStyle,t.style.outlineStyle="none",ze(window,"keydown",is))}function is(){ns&&(ns.style.outlineStyle=go,ns=void 0,go=void 0,rt(window,"keydown",is))}function fu(t){do t=t.parentNode;while((!t.offsetWidth||!t.offsetHeight)&&t!==document.body);return t}function _o(t){var s=t.getBoundingClientRect();return{x:s.width/t.offsetWidth||1,y:s.height/t.offsetHeight||1,boundingClientRect:s}}var Rp={__proto__:null,TRANSFORM:lo,TRANSITION:tr,TRANSITION_END:du,get:hu,getStyle:nr,create:Ke,remove:ut,empty:Yr,toFront:Ni,toBack:Ri,hasClass:uo,addClass:He,removeClass:pt,setClass:co,getClass:es,setOpacity:Gt,testProp:ts,setTransform:ii,setPosition:yt,getPosition:ri,get disableTextSelection(){return ir},get enableTextSelection(){return rr},disableImageDrag:fo,enableImageDrag:po,preventOutline:mo,restoreOutline:is,getSizedParentNode:fu,getScale:_o};function ze(t,s,c,p){if(s&&typeof s=="object")for(var E in s)vo(t,E,s[E],c);else{s=b(s);for(var D=0,ne=s.length;D<ne;D++)vo(t,s[D],c,p)}return this}var pn="_leaflet_events";function rt(t,s,c,p){if(arguments.length===1)pu(t),delete t[pn];else if(s&&typeof s=="object")for(var E in s)bo(t,E,s[E],c);else if(s=b(s),arguments.length===2)pu(t,function(he){return y(s,he)!==-1});else for(var D=0,ne=s.length;D<ne;D++)bo(t,s[D],c,p);return this}function pu(t,s){for(var c in t[pn]){var p=c.split(/\d/)[0];(!s||s(p))&&bo(t,p,null,null,c)}}var yo={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function vo(t,s,c,p){var E=s+f(c)+(p?"_"+f(p):"");if(t[pn]&&t[pn][E])return this;var D=function(he){return c.call(p||t,he||window.event)},ne=D;!ke.touchNative&&ke.pointer&&s.indexOf("touch")===0?D=de(t,s,D):ke.touch&&s==="dblclick"?D=Ip(t,D):"addEventListener"in t?s==="touchstart"||s==="touchmove"||s==="wheel"||s==="mousewheel"?t.addEventListener(yo[s]||s,D,ke.passiveEvents?{passive:!1}:!1):s==="mouseenter"||s==="mouseleave"?(D=function(he){he=he||window.event,xo(t,he)&&ne(he)},t.addEventListener(yo[s],D,!1)):t.addEventListener(s,ne,!1):t.attachEvent("on"+s,D),t[pn]=t[pn]||{},t[pn][E]=D}function bo(t,s,c,p,E){E=E||s+f(c)+(p?"_"+f(p):"");var D=t[pn]&&t[pn][E];if(!D)return this;!ke.touchNative&&ke.pointer&&s.indexOf("touch")===0?pe(t,s,D):ke.touch&&s==="dblclick"?Ap(t,D):"removeEventListener"in t?t.removeEventListener(yo[s]||s,D,!1):t.detachEvent("on"+s,D),t[pn][E]=null}function si(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function wo(t){return vo(t,"wheel",si),this}function or(t){return ze(t,"mousedown touchstart dblclick contextmenu",si),t._leaflet_disable_click=!0,this}function St(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function oi(t){return St(t),si(t),this}function gu(t){if(t.composedPath)return t.composedPath();for(var s=[],c=t.target;c;)s.push(c),c=c.parentNode;return s}function mu(t,s){if(!s)return new B(t.clientX,t.clientY);var c=_o(s),p=c.boundingClientRect;return new B((t.clientX-p.left)/c.x-s.clientLeft,(t.clientY-p.top)/c.y-s.clientTop)}var Cp=ke.linux&&ke.chrome?window.devicePixelRatio:ke.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function _u(t){return ke.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/Cp:t.deltaY&&t.deltaMode===1?-t.deltaY*20:t.deltaY&&t.deltaMode===2?-t.deltaY*60:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?-t.detail*20:t.detail?t.detail/-32765*60:0}function xo(t,s){var c=s.relatedTarget;if(!c)return!0;try{for(;c&&c!==t;)c=c.parentNode}catch{return!1}return c!==t}var Pp={__proto__:null,on:ze,off:rt,stopPropagation:si,disableScrollPropagation:wo,disableClickPropagation:or,preventDefault:St,stop:oi,getPropagationPath:gu,getMousePosition:mu,getWheelDelta:_u,isExternalTarget:xo,addListener:ze,removeListener:rt},yu=re.extend({run:function(t,s,c,p){this.stop(),this._el=t,this._inProgress=!0,this._duration=c||.25,this._easeOutPower=1/Math.max(p||.5,.2),this._startPos=ri(t),this._offset=s.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=$(this._animate,this),this._step()},_step:function(t){var s=+new Date-this._startTime,c=this._duration*1e3;s<c?this._runFrame(this._easeOut(s/c),t):(this._runFrame(1),this._complete())},_runFrame:function(t,s){var c=this._startPos.add(this._offset.multiplyBy(t));s&&c._round(),yt(this._el,c),this.fire("step")},_complete:function(){G(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),Xe=re.extend({options:{crs:q,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,s){s=I(this,s),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=l(this._onResize,this),this._initEvents(),s.maxBounds&&this.setMaxBounds(s.maxBounds),s.zoom!==void 0&&(this._zoom=this._limitZoom(s.zoom)),s.center&&s.zoom!==void 0&&this.setView(W(s.center),s.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=tr&&ke.any3d&&!ke.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),ze(this._proxy,du,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,s,c){if(s=s===void 0?this._zoom:this._limitZoom(s),t=this._limitCenter(W(t),s,this.options.maxBounds),c=c||{},this._stop(),this._loaded&&!c.reset&&c!==!0){c.animate!==void 0&&(c.zoom=o({animate:c.animate},c.zoom),c.pan=o({animate:c.animate,duration:c.duration},c.pan));var p=this._zoom!==s?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,s,c.zoom):this._tryAnimatedPan(t,c.pan);if(p)return clearTimeout(this._sizeTimer),this}return this._resetView(t,s,c.pan&&c.pan.noMoveStart),this},setZoom:function(t,s){return this._loaded?this.setView(this.getCenter(),t,{zoom:s}):(this._zoom=t,this)},zoomIn:function(t,s){return t=t||(ke.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,s)},zoomOut:function(t,s){return t=t||(ke.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,s)},setZoomAround:function(t,s,c){var p=this.getZoomScale(s),E=this.getSize().divideBy(2),D=t instanceof B?t:this.latLngToContainerPoint(t),ne=D.subtract(E).multiplyBy(1-1/p),he=this.containerPointToLatLng(E.add(ne));return this.setView(he,s,{zoom:c})},_getBoundsCenterZoom:function(t,s){s=s||{},t=t.getBounds?t.getBounds():me(t);var c=T(s.paddingTopLeft||s.padding||[0,0]),p=T(s.paddingBottomRight||s.padding||[0,0]),E=this.getBoundsZoom(t,!1,c.add(p));if(E=typeof s.maxZoom=="number"?Math.min(s.maxZoom,E):E,E===1/0)return{center:t.getCenter(),zoom:E};var D=p.subtract(c).divideBy(2),ne=this.project(t.getSouthWest(),E),he=this.project(t.getNorthEast(),E),ye=this.unproject(ne.add(he).divideBy(2).add(D),E);return{center:ye,zoom:E}},fitBounds:function(t,s){if(t=me(t),!t.isValid())throw new Error("Bounds are not valid.");var c=this._getBoundsCenterZoom(t,s);return this.setView(c.center,c.zoom,s)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,s){return this.setView(t,this._zoom,{pan:s})},panBy:function(t,s){if(t=T(t).round(),s=s||{},!t.x&&!t.y)return this.fire("moveend");if(s.animate!==!0&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new yu,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),s.noMoveStart||this.fire("movestart"),s.animate!==!1){He(this._mapPane,"leaflet-pan-anim");var c=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,c,s.duration||.25,s.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,s,c){if(c=c||{},c.animate===!1||!ke.any3d)return this.setView(t,s,c);this._stop();var p=this.project(this.getCenter()),E=this.project(t),D=this.getSize(),ne=this._zoom;t=W(t),s=s===void 0?ne:s;var he=Math.max(D.x,D.y),ye=he*this.getZoomScale(ne,s),Le=E.distanceTo(p)||1,Ce=1.42,je=Ce*Ce;function Ve(vt){var gs=vt?-1:1,bg=vt?ye:he,wg=ye*ye-he*he+gs*je*je*Le*Le,xg=2*bg*je*Le,ko=wg/xg,Ku=Math.sqrt(ko*ko+1)-ko,Eg=Ku<1e-9?-18:Math.log(Ku);return Eg}function Nt(vt){return(Math.exp(vt)-Math.exp(-vt))/2}function Et(vt){return(Math.exp(vt)+Math.exp(-vt))/2}function Xt(vt){return Nt(vt)/Et(vt)}var Mt=Ve(0);function Oi(vt){return he*(Et(Mt)/Et(Mt+Ce*vt))}function mg(vt){return he*(Et(Mt)*Xt(Mt+Ce*vt)-Nt(Mt))/je}function _g(vt){return 1-Math.pow(1-vt,1.5)}var yg=Date.now(),Qu=(Ve(1)-Mt)/Ce,vg=c.duration?1e3*c.duration:1e3*Qu*.8;function Ju(){var vt=(Date.now()-yg)/vg,gs=_g(vt)*Qu;vt<=1?(this._flyToFrame=$(Ju,this),this._move(this.unproject(p.add(E.subtract(p).multiplyBy(mg(gs)/Le)),ne),this.getScaleZoom(he/Oi(gs),ne),{flyTo:!0})):this._move(t,s)._moveEnd(!0)}return this._moveStart(!0,c.noMoveStart),Ju.call(this),this},flyToBounds:function(t,s){var c=this._getBoundsCenterZoom(t,s);return this.flyTo(c.center,c.zoom,s)},setMaxBounds:function(t){return t=me(t),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),t.isValid()?(this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(t){var s=this.options.minZoom;return this.options.minZoom=t,this._loaded&&s!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var s=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&s!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,s){this._enforcingBounds=!0;var c=this.getCenter(),p=this._limitCenter(c,this._zoom,me(t));return c.equals(p)||this.panTo(p,s),this._enforcingBounds=!1,this},panInside:function(t,s){s=s||{};var c=T(s.paddingTopLeft||s.padding||[0,0]),p=T(s.paddingBottomRight||s.padding||[0,0]),E=this.project(this.getCenter()),D=this.project(t),ne=this.getPixelBounds(),he=ie([ne.min.add(c),ne.max.subtract(p)]),ye=he.getSize();if(!he.contains(D)){this._enforcingBounds=!0;var Le=D.subtract(he.getCenter()),Ce=he.extend(D).getSize().subtract(ye);E.x+=Le.x<0?-Ce.x:Ce.x,E.y+=Le.y<0?-Ce.y:Ce.y,this.panTo(this.unproject(E),s),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=o({animate:!1,pan:!0},t===!0?{animate:!0}:t);var s=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var c=this.getSize(),p=s.divideBy(2).round(),E=c.divideBy(2).round(),D=p.subtract(E);return!D.x&&!D.y?this:(t.animate&&t.pan?this.panBy(D):(t.pan&&this._rawPanBy(D),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(l(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:s,newSize:c}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=o({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var s=l(this._handleGeolocationResponse,this),c=l(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(s,c,t):navigator.geolocation.getCurrentPosition(s,c,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){if(this._container._leaflet_id){var s=t.code,c=t.message||(s===1?"permission denied":s===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:s,message:"Geolocation error: "+c+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var s=t.coords.latitude,c=t.coords.longitude,p=new Z(s,c),E=p.toBounds(t.coords.accuracy*2),D=this._locateOptions;if(D.setView){var ne=this.getBoundsZoom(E);this.setView(p,D.maxZoom?Math.min(ne,D.maxZoom):ne)}var he={latlng:p,bounds:E,timestamp:t.timestamp};for(var ye in t.coords)typeof t.coords[ye]=="number"&&(he[ye]=t.coords[ye]);this.fire("locationfound",he)}},addHandler:function(t,s){if(!s)return this;var c=this[t]=new s(this);return this._handlers.push(c),this.options[t]&&c.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),ut(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(G(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)ut(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,s){var c="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),p=Ke("div",c,s||this._mapPane);return t&&(this._panes[t]=p),p},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),s=this.unproject(t.getBottomLeft()),c=this.unproject(t.getTopRight());return new Y(s,c)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,s,c){t=me(t),c=T(c||[0,0]);var p=this.getZoom()||0,E=this.getMinZoom(),D=this.getMaxZoom(),ne=t.getNorthWest(),he=t.getSouthEast(),ye=this.getSize().subtract(c),Le=ie(this.project(he,p),this.project(ne,p)).getSize(),Ce=ke.any3d?this.options.zoomSnap:1,je=ye.x/Le.x,Ve=ye.y/Le.y,Nt=s?Math.max(je,Ve):Math.min(je,Ve);return p=this.getScaleZoom(Nt,p),Ce&&(p=Math.round(p/(Ce/100))*(Ce/100),p=s?Math.ceil(p/Ce)*Ce:Math.floor(p/Ce)*Ce),Math.max(E,Math.min(D,p))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new B(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,s){var c=this._getTopLeftPoint(t,s);return new Q(c,c.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(t===void 0?this.getZoom():t)},getPane:function(t){return typeof t=="string"?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,s){var c=this.options.crs;return s=s===void 0?this._zoom:s,c.scale(t)/c.scale(s)},getScaleZoom:function(t,s){var c=this.options.crs;s=s===void 0?this._zoom:s;var p=c.zoom(t*c.scale(s));return isNaN(p)?1/0:p},project:function(t,s){return s=s===void 0?this._zoom:s,this.options.crs.latLngToPoint(W(t),s)},unproject:function(t,s){return s=s===void 0?this._zoom:s,this.options.crs.pointToLatLng(T(t),s)},layerPointToLatLng:function(t){var s=T(t).add(this.getPixelOrigin());return this.unproject(s)},latLngToLayerPoint:function(t){var s=this.project(W(t))._round();return s._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(W(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(me(t))},distance:function(t,s){return this.options.crs.distance(W(t),W(s))},containerPointToLayerPoint:function(t){return T(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return T(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var s=this.containerPointToLayerPoint(T(t));return this.layerPointToLatLng(s)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(W(t)))},mouseEventToContainerPoint:function(t){return mu(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var s=this._container=hu(t);if(s){if(s._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");ze(s,"scroll",this._onScroll,this),this._containerId=f(s)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&ke.any3d,He(t,"leaflet-container"+(ke.touch?" leaflet-touch":"")+(ke.retina?" leaflet-retina":"")+(ke.ielt9?" leaflet-oldie":"")+(ke.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var s=nr(t,"position");s!=="absolute"&&s!=="relative"&&s!=="fixed"&&s!=="sticky"&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),yt(this._mapPane,new B(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(He(t.markerPane,"leaflet-zoom-hide"),He(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,s,c){yt(this._mapPane,new B(0,0));var p=!this._loaded;this._loaded=!0,s=this._limitZoom(s),this.fire("viewprereset");var E=this._zoom!==s;this._moveStart(E,c)._move(t,s)._moveEnd(E),this.fire("viewreset"),p&&this.fire("load")},_moveStart:function(t,s){return t&&this.fire("zoomstart"),s||this.fire("movestart"),this},_move:function(t,s,c,p){s===void 0&&(s=this._zoom);var E=this._zoom!==s;return this._zoom=s,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),p?c&&c.pinch&&this.fire("zoom",c):((E||c&&c.pinch)&&this.fire("zoom",c),this.fire("move",c)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return G(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){yt(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[f(this._container)]=this;var s=t?rt:ze;s(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&s(window,"resize",this._onResize,this),ke.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){G(this._resizeRequest),this._resizeRequest=$(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,s){for(var c=[],p,E=s==="mouseout"||s==="mouseover",D=t.target||t.srcElement,ne=!1;D;){if(p=this._targets[f(D)],p&&(s==="click"||s==="preclick")&&this._draggableMoved(p)){ne=!0;break}if(p&&p.listens(s,!0)&&(E&&!xo(D,t)||(c.push(p),E))||D===this._container)break;D=D.parentNode}return!c.length&&!ne&&!E&&this.listens(s,!0)&&(c=[this]),c},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var s=t.target||t.srcElement;if(!(!this._loaded||s._leaflet_disable_events||t.type==="click"&&this._isClickDisabled(s))){var c=t.type;c==="mousedown"&&mo(s),this._fireDOMEvent(t,c)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,s,c){if(t.type==="click"){var p=o({},t);p.type="preclick",this._fireDOMEvent(p,p.type,c)}var E=this._findEventTargets(t,s);if(c){for(var D=[],ne=0;ne<c.length;ne++)c[ne].listens(s,!0)&&D.push(c[ne]);E=D.concat(E)}if(E.length){s==="contextmenu"&&St(t);var he=E[0],ye={originalEvent:t};if(t.type!=="keypress"&&t.type!=="keydown"&&t.type!=="keyup"){var Le=he.getLatLng&&(!he._radius||he._radius<=10);ye.containerPoint=Le?this.latLngToContainerPoint(he.getLatLng()):this.mouseEventToContainerPoint(t),ye.layerPoint=this.containerPointToLayerPoint(ye.containerPoint),ye.latlng=Le?he.getLatLng():this.layerPointToLatLng(ye.layerPoint)}for(ne=0;ne<E.length;ne++)if(E[ne].fire(s,ye,!0),ye.originalEvent._stopped||E[ne].options.bubblingMouseEvents===!1&&y(this._mouseEvents,s)!==-1)return}},_draggableMoved:function(t){return t=t.dragging&&t.dragging.enabled()?t:this,t.dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,s=this._handlers.length;t<s;t++)this._handlers[t].disable()},whenReady:function(t,s){return this._loaded?t.call(s||this,{target:this}):this.on("load",t,s),this},_getMapPanePos:function(){return ri(this._mapPane)||new B(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,s){var c=t&&s!==void 0?this._getNewPixelOrigin(t,s):this.getPixelOrigin();return c.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,s){var c=this.getSize()._divideBy(2);return this.project(t,s)._subtract(c)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,s,c){var p=this._getNewPixelOrigin(c,s);return this.project(t,s)._subtract(p)},_latLngBoundsToNewLayerBounds:function(t,s,c){var p=this._getNewPixelOrigin(c,s);return ie([this.project(t.getSouthWest(),s)._subtract(p),this.project(t.getNorthWest(),s)._subtract(p),this.project(t.getSouthEast(),s)._subtract(p),this.project(t.getNorthEast(),s)._subtract(p)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,s,c){if(!c)return t;var p=this.project(t,s),E=this.getSize().divideBy(2),D=new Q(p.subtract(E),p.add(E)),ne=this._getBoundsOffset(D,c,s);return Math.abs(ne.x)<=1&&Math.abs(ne.y)<=1?t:this.unproject(p.add(ne),s)},_limitOffset:function(t,s){if(!s)return t;var c=this.getPixelBounds(),p=new Q(c.min.add(t),c.max.add(t));return t.add(this._getBoundsOffset(p,s))},_getBoundsOffset:function(t,s,c){var p=ie(this.project(s.getNorthEast(),c),this.project(s.getSouthWest(),c)),E=p.min.subtract(t.min),D=p.max.subtract(t.max),ne=this._rebound(E.x,-D.x),he=this._rebound(E.y,-D.y);return new B(ne,he)},_rebound:function(t,s){return t+s>0?Math.round(t-s)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(s))},_limitZoom:function(t){var s=this.getMinZoom(),c=this.getMaxZoom(),p=ke.any3d?this.options.zoomSnap:1;return p&&(t=Math.round(t/p)*p),Math.max(s,Math.min(c,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){pt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,s){var c=this._getCenterOffset(t)._trunc();return(s&&s.animate)!==!0&&!this.getSize().contains(c)?!1:(this.panBy(c,s),!0)},_createAnimProxy:function(){var t=this._proxy=Ke("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(s){var c=lo,p=this._proxy.style[c];ii(this._proxy,this.project(s.center,s.zoom),this.getZoomScale(s.zoom,1)),p===this._proxy.style[c]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ut(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),s=this.getZoom();ii(this._proxy,this.project(t,s),this.getZoomScale(s,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,s,c){if(this._animatingZoom)return!0;if(c=c||{},!this._zoomAnimated||c.animate===!1||this._nothingToAnimate()||Math.abs(s-this._zoom)>this.options.zoomAnimationThreshold)return!1;var p=this.getZoomScale(s),E=this._getCenterOffset(t)._divideBy(1-1/p);return c.animate!==!0&&!this.getSize().contains(E)?!1:($(function(){this._moveStart(!0,c.noMoveStart||!1)._animateZoom(t,s,!0)},this),!0)},_animateZoom:function(t,s,c,p){this._mapPane&&(c&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=s,He(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:s,noUpdate:p}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(l(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&pt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function kp(t,s){return new Xe(t,s)}var nn=F.extend({options:{position:"topright"},initialize:function(t){I(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var s=this._map;return s&&s.removeControl(this),this.options.position=t,s&&s.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var s=this._container=this.onAdd(t),c=this.getPosition(),p=t._controlCorners[c];return He(s,"leaflet-control"),c.indexOf("bottom")!==-1?p.insertBefore(s,p.firstChild):p.appendChild(s),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ut(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),ar=function(t){return new nn(t)};Xe.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},s="leaflet-",c=this._controlContainer=Ke("div",s+"control-container",this._container);function p(E,D){var ne=s+E+" "+s+D;t[E+D]=Ke("div",ne,c)}p("top","left"),p("top","right"),p("bottom","left"),p("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ut(this._controlCorners[t]);ut(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var vu=nn.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,s,c,p){return c<p?-1:p<c?1:0}},initialize:function(t,s,c){I(this,c),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var p in t)this._addLayer(t[p],p);for(p in s)this._addLayer(s[p],p,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var s=0;s<this._layers.length;s++)this._layers[s].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return nn.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,s){return this._addLayer(t,s),this._map?this._update():this},addOverlay:function(t,s){return this._addLayer(t,s,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var s=this._getLayer(f(t));return s&&this._layers.splice(this._layers.indexOf(s),1),this._map?this._update():this},expand:function(){He(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(He(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):pt(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return pt(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",s=this._container=Ke("div",t),c=this.options.collapsed;s.setAttribute("aria-haspopup",!0),or(s),wo(s);var p=this._section=Ke("section",t+"-list");c&&(this._map.on("click",this.collapse,this),ze(s,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var E=this._layersLink=Ke("a",t+"-toggle",s);E.href="#",E.title="Layers",E.setAttribute("role","button"),ze(E,{keydown:function(D){D.keyCode===13&&this._expandSafely()},click:function(D){St(D),this._expandSafely()}},this),c||this.expand(),this._baseLayersList=Ke("div",t+"-base",p),this._separator=Ke("div",t+"-separator",p),this._overlaysList=Ke("div",t+"-overlays",p),s.appendChild(p)},_getLayer:function(t){for(var s=0;s<this._layers.length;s++)if(this._layers[s]&&f(this._layers[s].layer)===t)return this._layers[s]},_addLayer:function(t,s,c){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:s,overlay:c}),this.options.sortLayers&&this._layers.sort(l(function(p,E){return this.options.sortFunction(p.layer,E.layer,p.name,E.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Yr(this._baseLayersList),Yr(this._overlaysList),this._layerControlInputs=[];var t,s,c,p,E=0;for(c=0;c<this._layers.length;c++)p=this._layers[c],this._addItem(p),s=s||p.overlay,t=t||!p.overlay,E+=p.overlay?0:1;return this.options.hideSingleBase&&(t=t&&E>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=s&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var s=this._getLayer(f(t.target)),c=s.overlay?t.type==="add"?"overlayadd":"overlayremove":t.type==="add"?"baselayerchange":null;c&&this._map.fire(c,s)},_createRadioElement:function(t,s){var c='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(s?' checked="checked"':"")+"/>",p=document.createElement("div");return p.innerHTML=c,p.firstChild},_addItem:function(t){var s=document.createElement("label"),c=this._map.hasLayer(t.layer),p;t.overlay?(p=document.createElement("input"),p.type="checkbox",p.className="leaflet-control-layers-selector",p.defaultChecked=c):p=this._createRadioElement("leaflet-base-layers_"+f(this),c),this._layerControlInputs.push(p),p.layerId=f(t.layer),ze(p,"click",this._onInputClick,this);var E=document.createElement("span");E.innerHTML=" "+t.name;var D=document.createElement("span");s.appendChild(D),D.appendChild(p),D.appendChild(E);var ne=t.overlay?this._overlaysList:this._baseLayersList;return ne.appendChild(s),this._checkDisabledLayers(),s},_onInputClick:function(){if(!this._preventClick){var t=this._layerControlInputs,s,c,p=[],E=[];this._handlingClick=!0;for(var D=t.length-1;D>=0;D--)s=t[D],c=this._getLayer(s.layerId).layer,s.checked?p.push(c):s.checked||E.push(c);for(D=0;D<E.length;D++)this._map.hasLayer(E[D])&&this._map.removeLayer(E[D]);for(D=0;D<p.length;D++)this._map.hasLayer(p[D])||this._map.addLayer(p[D]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var t=this._layerControlInputs,s,c,p=this._map.getZoom(),E=t.length-1;E>=0;E--)s=t[E],c=this._getLayer(s.layerId).layer,s.disabled=c.options.minZoom!==void 0&&p<c.options.minZoom||c.options.maxZoom!==void 0&&p>c.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,ze(t,"click",St),this.expand();var s=this;setTimeout(function(){rt(t,"click",St),s._preventClick=!1})}}),Dp=function(t,s,c){return new vu(t,s,c)},Eo=nn.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(t){var s="leaflet-control-zoom",c=Ke("div",s+" leaflet-bar"),p=this.options;return this._zoomInButton=this._createButton(p.zoomInText,p.zoomInTitle,s+"-in",c,this._zoomIn),this._zoomOutButton=this._createButton(p.zoomOutText,p.zoomOutTitle,s+"-out",c,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),c},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,s,c,p,E){var D=Ke("a",c,p);return D.innerHTML=t,D.href="#",D.title=s,D.setAttribute("role","button"),D.setAttribute("aria-label",s),or(D),ze(D,"click",oi),ze(D,"click",E,this),ze(D,"click",this._refocusOnMap,this),D},_updateDisabled:function(){var t=this._map,s="leaflet-disabled";pt(this._zoomInButton,s),pt(this._zoomOutButton,s),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(He(this._zoomOutButton,s),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(He(this._zoomInButton,s),this._zoomInButton.setAttribute("aria-disabled","true"))}});Xe.mergeOptions({zoomControl:!0}),Xe.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Eo,this.addControl(this.zoomControl))});var Mp=function(t){return new Eo(t)},bu=nn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var s="leaflet-control-scale",c=Ke("div",s),p=this.options;return this._addScales(p,s+"-line",c),t.on(p.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),c},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,s,c){t.metric&&(this._mScale=Ke("div",s,c)),t.imperial&&(this._iScale=Ke("div",s,c))},_update:function(){var t=this._map,s=t.getSize().y/2,c=t.distance(t.containerPointToLatLng([0,s]),t.containerPointToLatLng([this.options.maxWidth,s]));this._updateScales(c)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var s=this._getRoundNum(t),c=s<1e3?s+" m":s/1e3+" km";this._updateScale(this._mScale,c,s/t)},_updateImperial:function(t){var s=t*3.2808399,c,p,E;s>5280?(c=s/5280,p=this._getRoundNum(c),this._updateScale(this._iScale,p+" mi",p/c)):(E=this._getRoundNum(s),this._updateScale(this._iScale,E+" ft",E/s))},_updateScale:function(t,s,c){t.style.width=Math.round(this.options.maxWidth*c)+"px",t.innerHTML=s},_getRoundNum:function(t){var s=Math.pow(10,(Math.floor(t)+"").length-1),c=t/s;return c=c>=10?10:c>=5?5:c>=3?3:c>=2?2:1,s*c}}),Op=function(t){return new bu(t)},Fp='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',So=nn.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(ke.inlineSvg?Fp+" ":"")+"Leaflet</a>"},initialize:function(t){I(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=Ke("div","leaflet-control-attribution"),or(this._container);for(var s in t._layers)t._layers[s].getAttribution&&this.addAttribution(t._layers[s].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var s in this._attributions)this._attributions[s]&&t.push(s);var c=[];this.options.prefix&&c.push(this.options.prefix),t.length&&c.push(t.join(", ")),this._container.innerHTML=c.join(' <span aria-hidden="true">|</span> ')}}});Xe.mergeOptions({attributionControl:!0}),Xe.addInitHook(function(){this.options.attributionControl&&new So().addTo(this)});var jp=function(t){return new So(t)};nn.Layers=vu,nn.Zoom=Eo,nn.Scale=bu,nn.Attribution=So,ar.layers=Dp,ar.zoom=Mp,ar.scale=Op,ar.attribution=jp;var gn=F.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});gn.addTo=function(t,s){return t.addHandler(s,this),this};var Bp={Events:M},wu=ke.touch?"touchstart mousedown":"mousedown",qn=re.extend({options:{clickTolerance:3},initialize:function(t,s,c,p){I(this,p),this._element=t,this._dragStartTarget=s||t,this._preventOutline=c},enable:function(){this._enabled||(ze(this._dragStartTarget,wu,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(qn._dragging===this&&this.finishDrag(!0),rt(this._dragStartTarget,wu,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!uo(this._element,"leaflet-zoom-anim"))){if(t.touches&&t.touches.length!==1){qn._dragging===this&&this.finishDrag();return}if(!(qn._dragging||t.shiftKey||t.which!==1&&t.button!==1&&!t.touches)&&(qn._dragging=this,this._preventOutline&&mo(this._element),fo(),ir(),!this._moving)){this.fire("down");var s=t.touches?t.touches[0]:t,c=fu(this._element);this._startPoint=new B(s.clientX,s.clientY),this._startPos=ri(this._element),this._parentScale=_o(c);var p=t.type==="mousedown";ze(document,p?"mousemove":"touchmove",this._onMove,this),ze(document,p?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(t){if(this._enabled){if(t.touches&&t.touches.length>1){this._moved=!0;return}var s=t.touches&&t.touches.length===1?t.touches[0]:t,c=new B(s.clientX,s.clientY)._subtract(this._startPoint);!c.x&&!c.y||Math.abs(c.x)+Math.abs(c.y)<this.options.clickTolerance||(c.x/=this._parentScale.x,c.y/=this._parentScale.y,St(t),this._moved||(this.fire("dragstart"),this._moved=!0,He(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),He(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(c),this._moving=!0,this._lastEvent=t,this._updatePosition())}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),yt(this._element,this._newPos),this.fire("drag",t)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(t){pt(document.body,"leaflet-dragging"),this._lastTarget&&(pt(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),rt(document,"mousemove touchmove",this._onMove,this),rt(document,"mouseup touchend touchcancel",this._onUp,this),po(),rr();var s=this._moved&&this._moving;this._moving=!1,qn._dragging=!1,s&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)})}});function xu(t,s,c){var p,E=[1,4,2,8],D,ne,he,ye,Le,Ce,je,Ve;for(D=0,Ce=t.length;D<Ce;D++)t[D]._code=ai(t[D],s);for(he=0;he<4;he++){for(je=E[he],p=[],D=0,Ce=t.length,ne=Ce-1;D<Ce;ne=D++)ye=t[D],Le=t[ne],ye._code&je?Le._code&je||(Ve=rs(Le,ye,je,s,c),Ve._code=ai(Ve,s),p.push(Ve)):(Le._code&je&&(Ve=rs(Le,ye,je,s,c),Ve._code=ai(Ve,s),p.push(Ve)),p.push(ye));t=p}return t}function Eu(t,s){var c,p,E,D,ne,he,ye,Le,Ce;if(!t||t.length===0)throw new Error("latlngs not passed");Zt(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var je=W([0,0]),Ve=me(t),Nt=Ve.getNorthWest().distanceTo(Ve.getSouthWest())*Ve.getNorthEast().distanceTo(Ve.getNorthWest());Nt<1700&&(je=To(t));var Et=t.length,Xt=[];for(c=0;c<Et;c++){var Mt=W(t[c]);Xt.push(s.project(W([Mt.lat-je.lat,Mt.lng-je.lng])))}for(he=ye=Le=0,c=0,p=Et-1;c<Et;p=c++)E=Xt[c],D=Xt[p],ne=E.y*D.x-D.y*E.x,ye+=(E.x+D.x)*ne,Le+=(E.y+D.y)*ne,he+=ne*3;he===0?Ce=Xt[0]:Ce=[ye/he,Le/he];var Oi=s.unproject(T(Ce));return W([Oi.lat+je.lat,Oi.lng+je.lng])}function To(t){for(var s=0,c=0,p=0,E=0;E<t.length;E++){var D=W(t[E]);s+=D.lat,c+=D.lng,p++}return W([s/p,c/p])}var $p={__proto__:null,clipPolygon:xu,polygonCenter:Eu,centroid:To};function Su(t,s){if(!s||!t.length)return t.slice();var c=s*s;return t=Hp(t,c),t=zp(t,c),t}function Tu(t,s,c){return Math.sqrt(lr(t,s,c,!0))}function qp(t,s,c){return lr(t,s,c)}function zp(t,s){var c=t.length,p=typeof Uint8Array<"u"?Uint8Array:Array,E=new p(c);E[0]=E[c-1]=1,Lo(t,E,s,0,c-1);var D,ne=[];for(D=0;D<c;D++)E[D]&&ne.push(t[D]);return ne}function Lo(t,s,c,p,E){var D=0,ne,he,ye;for(he=p+1;he<=E-1;he++)ye=lr(t[he],t[p],t[E],!0),ye>D&&(ne=he,D=ye);D>c&&(s[ne]=1,Lo(t,s,c,p,ne),Lo(t,s,c,ne,E))}function Hp(t,s){for(var c=[t[0]],p=1,E=0,D=t.length;p<D;p++)Up(t[p],t[E])>s&&(c.push(t[p]),E=p);return E<D-1&&c.push(t[D-1]),c}var Lu;function Iu(t,s,c,p,E){var D=p?Lu:ai(t,c),ne=ai(s,c),he,ye,Le;for(Lu=ne;;){if(!(D|ne))return[t,s];if(D&ne)return!1;he=D||ne,ye=rs(t,s,he,c,E),Le=ai(ye,c),he===D?(t=ye,D=Le):(s=ye,ne=Le)}}function rs(t,s,c,p,E){var D=s.x-t.x,ne=s.y-t.y,he=p.min,ye=p.max,Le,Ce;return c&8?(Le=t.x+D*(ye.y-t.y)/ne,Ce=ye.y):c&4?(Le=t.x+D*(he.y-t.y)/ne,Ce=he.y):c&2?(Le=ye.x,Ce=t.y+ne*(ye.x-t.x)/D):c&1&&(Le=he.x,Ce=t.y+ne*(he.x-t.x)/D),new B(Le,Ce,E)}function ai(t,s){var c=0;return t.x<s.min.x?c|=1:t.x>s.max.x&&(c|=2),t.y<s.min.y?c|=4:t.y>s.max.y&&(c|=8),c}function Up(t,s){var c=s.x-t.x,p=s.y-t.y;return c*c+p*p}function lr(t,s,c,p){var E=s.x,D=s.y,ne=c.x-E,he=c.y-D,ye=ne*ne+he*he,Le;return ye>0&&(Le=((t.x-E)*ne+(t.y-D)*he)/ye,Le>1?(E=c.x,D=c.y):Le>0&&(E+=ne*Le,D+=he*Le)),ne=t.x-E,he=t.y-D,p?ne*ne+he*he:new B(E,D)}function Zt(t){return!w(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function Au(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Zt(t)}function Nu(t,s){var c,p,E,D,ne,he,ye,Le;if(!t||t.length===0)throw new Error("latlngs not passed");Zt(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var Ce=W([0,0]),je=me(t),Ve=je.getNorthWest().distanceTo(je.getSouthWest())*je.getNorthEast().distanceTo(je.getNorthWest());Ve<1700&&(Ce=To(t));var Nt=t.length,Et=[];for(c=0;c<Nt;c++){var Xt=W(t[c]);Et.push(s.project(W([Xt.lat-Ce.lat,Xt.lng-Ce.lng])))}for(c=0,p=0;c<Nt-1;c++)p+=Et[c].distanceTo(Et[c+1])/2;if(p===0)Le=Et[0];else for(c=0,D=0;c<Nt-1;c++)if(ne=Et[c],he=Et[c+1],E=ne.distanceTo(he),D+=E,D>p){ye=(D-p)/E,Le=[he.x-ye*(he.x-ne.x),he.y-ye*(he.y-ne.y)];break}var Mt=s.unproject(T(Le));return W([Mt.lat+Ce.lat,Mt.lng+Ce.lng])}var Vp={__proto__:null,simplify:Su,pointToSegmentDistance:Tu,closestPointOnSegment:qp,clipSegment:Iu,_getEdgeIntersection:rs,_getBitCode:ai,_sqClosestPointOnSegment:lr,isFlat:Zt,_flat:Au,polylineCenter:Nu},Io={project:function(t){return new B(t.lng,t.lat)},unproject:function(t){return new Z(t.y,t.x)},bounds:new Q([-180,-90],[180,90])},Ao={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Q([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var s=Math.PI/180,c=this.R,p=t.lat*s,E=this.R_MINOR/c,D=Math.sqrt(1-E*E),ne=D*Math.sin(p),he=Math.tan(Math.PI/4-p/2)/Math.pow((1-ne)/(1+ne),D/2);return p=-c*Math.log(Math.max(he,1e-10)),new B(t.lng*s*c,p)},unproject:function(t){for(var s=180/Math.PI,c=this.R,p=this.R_MINOR/c,E=Math.sqrt(1-p*p),D=Math.exp(-t.y/c),ne=Math.PI/2-2*Math.atan(D),he=0,ye=.1,Le;he<15&&Math.abs(ye)>1e-7;he++)Le=E*Math.sin(ne),Le=Math.pow((1-Le)/(1+Le),E/2),ye=Math.PI/2-2*Math.atan(D*Le)-ne,ne+=ye;return new Z(ne*s,t.x*s/c)}},Wp={__proto__:null,LonLat:Io,Mercator:Ao,SphericalMercator:ce},Gp=o({},K,{code:"EPSG:3395",projection:Ao,transformation:(function(){var t=.5/(Math.PI*Ao.R);return Te(t,.5,-t,.5)})()}),Ru=o({},K,{code:"EPSG:4326",projection:Io,transformation:Te(1/180,1,-1/180,.5)}),Zp=o({},ee,{projection:Io,transformation:Te(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,s){var c=s.lng-t.lng,p=s.lat-t.lat;return Math.sqrt(c*c+p*p)},infinite:!0});ee.Earth=K,ee.EPSG3395=Gp,ee.EPSG3857=q,ee.EPSG900913=te,ee.EPSG4326=Ru,ee.Simple=Zp;var rn=re.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[f(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[f(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var s=t.target;if(s.hasLayer(this)){if(this._map=s,this._zoomAnimated=s._zoomAnimated,this.getEvents){var c=this.getEvents();s.on(c,this),this.once("remove",function(){s.off(c,this)},this)}this.onAdd(s),this.fire("add"),s.fire("layeradd",{layer:this})}}});Xe.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var s=f(t);return this._layers[s]?this:(this._layers[s]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var s=f(t);return this._layers[s]?(this._loaded&&t.onRemove(this),delete this._layers[s],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return f(t)in this._layers},eachLayer:function(t,s){for(var c in this._layers)t.call(s,this._layers[c]);return this},_addLayers:function(t){t=t?w(t)?t:[t]:[];for(var s=0,c=t.length;s<c;s++)this.addLayer(t[s])},_addZoomLimit:function(t){(!isNaN(t.options.maxZoom)||!isNaN(t.options.minZoom))&&(this._zoomBoundLayers[f(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var s=f(t);this._zoomBoundLayers[s]&&(delete this._zoomBoundLayers[s],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,s=-1/0,c=this._getZoomSpan();for(var p in this._zoomBoundLayers){var E=this._zoomBoundLayers[p].options;t=E.minZoom===void 0?t:Math.min(t,E.minZoom),s=E.maxZoom===void 0?s:Math.max(s,E.maxZoom)}this._layersMaxZoom=s===-1/0?void 0:s,this._layersMinZoom=t===1/0?void 0:t,c!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Ci=rn.extend({initialize:function(t,s){I(this,s),this._layers={};var c,p;if(t)for(c=0,p=t.length;c<p;c++)this.addLayer(t[c])},addLayer:function(t){var s=this.getLayerId(t);return this._layers[s]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var s=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[s]&&this._map.removeLayer(this._layers[s]),delete this._layers[s],this},hasLayer:function(t){var s=typeof t=="number"?t:this.getLayerId(t);return s in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var s=Array.prototype.slice.call(arguments,1),c,p;for(c in this._layers)p=this._layers[c],p[t]&&p[t].apply(p,s);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,s){for(var c in this._layers)t.call(s,this._layers[c]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return f(t)}}),Xp=function(t,s){return new Ci(t,s)},Sn=Ci.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Ci.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Ci.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new Y;for(var s in this._layers){var c=this._layers[s];t.extend(c.getBounds?c.getBounds():c.getLatLng())}return t}}),Qp=function(t,s){return new Sn(t,s)},Pi=F.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(t){I(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,s){var c=this._getIconUrl(t);if(!c){if(t==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var p=this._createImg(c,s&&s.tagName==="IMG"?s:null);return this._setIconStyles(p,t),(this.options.crossOrigin||this.options.crossOrigin==="")&&(p.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),p},_setIconStyles:function(t,s){var c=this.options,p=c[s+"Size"];typeof p=="number"&&(p=[p,p]);var E=T(p),D=T(s==="shadow"&&c.shadowAnchor||c.iconAnchor||E&&E.divideBy(2,!0));t.className="leaflet-marker-"+s+" "+(c.className||""),D&&(t.style.marginLeft=-D.x+"px",t.style.marginTop=-D.y+"px"),E&&(t.style.width=E.x+"px",t.style.height=E.y+"px")},_createImg:function(t,s){return s=s||document.createElement("img"),s.src=t,s},_getIconUrl:function(t){return ke.retina&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Jp(t){return new Pi(t)}var ur=Pi.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return typeof ur.imagePath!="string"&&(ur.imagePath=this._detectIconPath()),(this.options.imagePath||ur.imagePath)+Pi.prototype._getIconUrl.call(this,t)},_stripUrl:function(t){var s=function(c,p,E){var D=p.exec(c);return D&&D[E]};return t=s(t,/^url\((['"])?(.+)\1\)$/,2),t&&s(t,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var t=Ke("div","leaflet-default-icon-path",document.body),s=nr(t,"background-image")||nr(t,"backgroundImage");if(document.body.removeChild(t),s=this._stripUrl(s),s)return s;var c=document.querySelector('link[href$="leaflet.css"]');return c?c.href.substring(0,c.href.length-11-1):""}}),Cu=gn.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new qn(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),He(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&pt(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var s=this._marker,c=s._map,p=this._marker.options.autoPanSpeed,E=this._marker.options.autoPanPadding,D=ri(s._icon),ne=c.getPixelBounds(),he=c.getPixelOrigin(),ye=ie(ne.min._subtract(he).add(E),ne.max._subtract(he).subtract(E));if(!ye.contains(D)){var Le=T((Math.max(ye.max.x,D.x)-ye.max.x)/(ne.max.x-ye.max.x)-(Math.min(ye.min.x,D.x)-ye.min.x)/(ne.min.x-ye.min.x),(Math.max(ye.max.y,D.y)-ye.max.y)/(ne.max.y-ye.max.y)-(Math.min(ye.min.y,D.y)-ye.min.y)/(ne.min.y-ye.min.y)).multiplyBy(p);c.panBy(Le,{animate:!1}),this._draggable._newPos._add(Le),this._draggable._startPos._add(Le),yt(s._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=$(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(G(this._panRequest),this._panRequest=$(this._adjustPan.bind(this,t)))},_onDrag:function(t){var s=this._marker,c=s._shadow,p=ri(s._icon),E=s._map.layerPointToLatLng(p);c&&yt(c,p),s._latlng=E,t.latlng=E,t.oldLatLng=this._oldLatLng,s.fire("move",t).fire("drag",t)},_onDragEnd:function(t){G(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),ss=rn.extend({options:{icon:new ur,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,s){I(this,s),this._latlng=W(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var s=this._latlng;return this._latlng=W(t),this.update(),this.fire("move",{oldLatLng:s,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,s="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),c=t.icon.createIcon(this._icon),p=!1;c!==this._icon&&(this._icon&&this._removeIcon(),p=!0,t.title&&(c.title=t.title),c.tagName==="IMG"&&(c.alt=t.alt||"")),He(c,s),t.keyboard&&(c.tabIndex="0",c.setAttribute("role","button")),this._icon=c,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&ze(c,"focus",this._panOnFocus,this);var E=t.icon.createShadow(this._shadow),D=!1;E!==this._shadow&&(this._removeShadow(),D=!0),E&&(He(E,s),E.alt=""),this._shadow=E,t.opacity<1&&this._updateOpacity(),p&&this.getPane().appendChild(this._icon),this._initInteraction(),E&&D&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&rt(this._icon,"focus",this._panOnFocus,this),ut(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ut(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&yt(this._icon,t),this._shadow&&yt(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(this._icon.style.zIndex=this._zIndex+t)},_animateZoom:function(t){var s=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(s)},_initInteraction:function(){if(this.options.interactive&&(He(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Cu)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Cu(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&Gt(this._icon,t),this._shadow&&Gt(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var t=this._map;if(t){var s=this.options.icon.options,c=s.iconSize?T(s.iconSize):T(0,0),p=s.iconAnchor?T(s.iconAnchor):T(0,0);t.panInside(this._latlng,{paddingTopLeft:p,paddingBottomRight:c.subtract(p)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Kp(t,s){return new ss(t,s)}var zn=rn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return I(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),os=zn.extend({options:{fill:!0,radius:10},initialize:function(t,s){I(this,s),this._latlng=W(t),this._radius=this.options.radius},setLatLng:function(t){var s=this._latlng;return this._latlng=W(t),this.redraw(),this.fire("move",{oldLatLng:s,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var s=t&&t.radius||this._radius;return zn.prototype.setStyle.call(this,t),this.setRadius(s),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,s=this._radiusY||t,c=this._clickTolerance(),p=[t+c,s+c];this._pxBounds=new Q(this._point.subtract(p),this._point.add(p))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function Yp(t,s){return new os(t,s)}var No=os.extend({initialize:function(t,s,c){if(typeof s=="number"&&(s=o({},c,{radius:s})),I(this,s),this._latlng=W(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new Y(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:zn.prototype.setStyle,_project:function(){var t=this._latlng.lng,s=this._latlng.lat,c=this._map,p=c.options.crs;if(p.distance===K.distance){var E=Math.PI/180,D=this._mRadius/K.R/E,ne=c.project([s+D,t]),he=c.project([s-D,t]),ye=ne.add(he).divideBy(2),Le=c.unproject(ye).lat,Ce=Math.acos((Math.cos(D*E)-Math.sin(s*E)*Math.sin(Le*E))/(Math.cos(s*E)*Math.cos(Le*E)))/E;(isNaN(Ce)||Ce===0)&&(Ce=D/Math.cos(Math.PI/180*s)),this._point=ye.subtract(c.getPixelOrigin()),this._radius=isNaN(Ce)?0:ye.x-c.project([Le,t-Ce]).x,this._radiusY=ye.y-ne.y}else{var je=p.unproject(p.project(this._latlng).subtract([this._mRadius,0]));this._point=c.latLngToLayerPoint(this._latlng),this._radius=this._point.x-c.latLngToLayerPoint(je).x}this._updateBounds()}});function eg(t,s,c){return new No(t,s,c)}var Tn=zn.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,s){I(this,s),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var s=1/0,c=null,p=lr,E,D,ne=0,he=this._parts.length;ne<he;ne++)for(var ye=this._parts[ne],Le=1,Ce=ye.length;Le<Ce;Le++){E=ye[Le-1],D=ye[Le];var je=p(t,E,D,!0);je<s&&(s=je,c=p(t,E,D))}return c&&(c.distance=Math.sqrt(s)),c},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Nu(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(t,s){return s=s||this._defaultShape(),t=W(t),s.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new Y,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Zt(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var s=[],c=Zt(t),p=0,E=t.length;p<E;p++)c?(s[p]=W(t[p]),this._bounds.extend(s[p])):s[p]=this._convertLatLngs(t[p]);return s},_project:function(){var t=new Q;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),s=new B(t,t);this._rawPxBounds&&(this._pxBounds=new Q([this._rawPxBounds.min.subtract(s),this._rawPxBounds.max.add(s)]))},_projectLatlngs:function(t,s,c){var p=t[0]instanceof Z,E=t.length,D,ne;if(p){for(ne=[],D=0;D<E;D++)ne[D]=this._map.latLngToLayerPoint(t[D]),c.extend(ne[D]);s.push(ne)}else for(D=0;D<E;D++)this._projectLatlngs(t[D],s,c)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}var s=this._parts,c,p,E,D,ne,he,ye;for(c=0,E=0,D=this._rings.length;c<D;c++)for(ye=this._rings[c],p=0,ne=ye.length;p<ne-1;p++)he=Iu(ye[p],ye[p+1],t,p,!0),he&&(s[E]=s[E]||[],s[E].push(he[0]),(he[1]!==ye[p+1]||p===ne-2)&&(s[E].push(he[1]),E++))}},_simplifyPoints:function(){for(var t=this._parts,s=this.options.smoothFactor,c=0,p=t.length;c<p;c++)t[c]=Su(t[c],s)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,s){var c,p,E,D,ne,he,ye=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(c=0,D=this._parts.length;c<D;c++)for(he=this._parts[c],p=0,ne=he.length,E=ne-1;p<ne;E=p++)if(!(!s&&p===0)&&Tu(t,he[E],he[p])<=ye)return!0;return!1}});function tg(t,s){return new Tn(t,s)}Tn._flat=Au;var ki=Tn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Eu(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(t){var s=Tn.prototype._convertLatLngs.call(this,t),c=s.length;return c>=2&&s[0]instanceof Z&&s[0].equals(s[c-1])&&s.pop(),s},_setLatLngs:function(t){Tn.prototype._setLatLngs.call(this,t),Zt(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Zt(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,s=this.options.weight,c=new B(s,s);if(t=new Q(t.min.subtract(c),t.max.add(c)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var p=0,E=this._rings.length,D;p<E;p++)D=xu(this._rings[p],t,!0),D.length&&this._parts.push(D)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var s=!1,c,p,E,D,ne,he,ye,Le;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(D=0,ye=this._parts.length;D<ye;D++)for(c=this._parts[D],ne=0,Le=c.length,he=Le-1;ne<Le;he=ne++)p=c[ne],E=c[he],p.y>t.y!=E.y>t.y&&t.x<(E.x-p.x)*(t.y-p.y)/(E.y-p.y)+p.x&&(s=!s);return s||Tn.prototype._containsPoint.call(this,t,!0)}});function ng(t,s){return new ki(t,s)}var Ln=Sn.extend({initialize:function(t,s){I(this,s),this._layers={},t&&this.addData(t)},addData:function(t){var s=w(t)?t:t.features,c,p,E;if(s){for(c=0,p=s.length;c<p;c++)E=s[c],(E.geometries||E.geometry||E.features||E.coordinates)&&this.addData(E);return this}var D=this.options;if(D.filter&&!D.filter(t))return this;var ne=as(t,D);return ne?(ne.feature=cs(t),ne.defaultOptions=ne.options,this.resetStyle(ne),D.onEachFeature&&D.onEachFeature(t,ne),this.addLayer(ne)):this},resetStyle:function(t){return t===void 0?this.eachLayer(this.resetStyle,this):(t.options=o({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this)},setStyle:function(t){return this.eachLayer(function(s){this._setLayerStyle(s,t)},this)},_setLayerStyle:function(t,s){t.setStyle&&(typeof s=="function"&&(s=s(t.feature)),t.setStyle(s))}});function as(t,s){var c=t.type==="Feature"?t.geometry:t,p=c?c.coordinates:null,E=[],D=s&&s.pointToLayer,ne=s&&s.coordsToLatLng||Ro,he,ye,Le,Ce;if(!p&&!c)return null;switch(c.type){case"Point":return he=ne(p),Pu(D,t,he,s);case"MultiPoint":for(Le=0,Ce=p.length;Le<Ce;Le++)he=ne(p[Le]),E.push(Pu(D,t,he,s));return new Sn(E);case"LineString":case"MultiLineString":return ye=ls(p,c.type==="LineString"?0:1,ne),new Tn(ye,s);case"Polygon":case"MultiPolygon":return ye=ls(p,c.type==="Polygon"?1:2,ne),new ki(ye,s);case"GeometryCollection":for(Le=0,Ce=c.geometries.length;Le<Ce;Le++){var je=as({geometry:c.geometries[Le],type:"Feature",properties:t.properties},s);je&&E.push(je)}return new Sn(E);case"FeatureCollection":for(Le=0,Ce=c.features.length;Le<Ce;Le++){var Ve=as(c.features[Le],s);Ve&&E.push(Ve)}return new Sn(E);default:throw new Error("Invalid GeoJSON object.")}}function Pu(t,s,c,p){return t?t(s,c):new ss(c,p&&p.markersInheritOptions&&p)}function Ro(t){return new Z(t[1],t[0],t[2])}function ls(t,s,c){for(var p=[],E=0,D=t.length,ne;E<D;E++)ne=s?ls(t[E],s-1,c):(c||Ro)(t[E]),p.push(ne);return p}function Co(t,s){return t=W(t),t.alt!==void 0?[d(t.lng,s),d(t.lat,s),d(t.alt,s)]:[d(t.lng,s),d(t.lat,s)]}function us(t,s,c,p){for(var E=[],D=0,ne=t.length;D<ne;D++)E.push(s?us(t[D],Zt(t[D])?0:s-1,c,p):Co(t[D],p));return!s&&c&&E.length>0&&E.push(E[0].slice()),E}function Di(t,s){return t.feature?o({},t.feature,{geometry:s}):cs(s)}function cs(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var Po={toGeoJSON:function(t){return Di(this,{type:"Point",coordinates:Co(this.getLatLng(),t)})}};ss.include(Po),No.include(Po),os.include(Po),Tn.include({toGeoJSON:function(t){var s=!Zt(this._latlngs),c=us(this._latlngs,s?1:0,!1,t);return Di(this,{type:(s?"Multi":"")+"LineString",coordinates:c})}}),ki.include({toGeoJSON:function(t){var s=!Zt(this._latlngs),c=s&&!Zt(this._latlngs[0]),p=us(this._latlngs,c?2:s?1:0,!0,t);return s||(p=[p]),Di(this,{type:(c?"Multi":"")+"Polygon",coordinates:p})}}),Ci.include({toMultiPoint:function(t){var s=[];return this.eachLayer(function(c){s.push(c.toGeoJSON(t).geometry.coordinates)}),Di(this,{type:"MultiPoint",coordinates:s})},toGeoJSON:function(t){var s=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(s==="MultiPoint")return this.toMultiPoint(t);var c=s==="GeometryCollection",p=[];return this.eachLayer(function(E){if(E.toGeoJSON){var D=E.toGeoJSON(t);if(c)p.push(D.geometry);else{var ne=cs(D);ne.type==="FeatureCollection"?p.push.apply(p,ne.features):p.push(ne)}}}),c?Di(this,{geometries:p,type:"GeometryCollection"}):{type:"FeatureCollection",features:p}}});function ku(t,s){return new Ln(t,s)}var ig=ku,ds=rn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,s,c){this._url=t,this._bounds=me(s),I(this,c)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(He(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ut(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&Ni(this._image),this},bringToBack:function(){return this._map&&Ri(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=me(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t=this._url.tagName==="IMG",s=this._image=t?this._url:Ke("img");if(He(s,"leaflet-image-layer"),this._zoomAnimated&&He(s,"leaflet-zoom-animated"),this.options.className&&He(s,this.options.className),s.onselectstart=m,s.onmousemove=m,s.onload=l(this.fire,this,"load"),s.onerror=l(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(s.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=s.src;return}s.src=this._url,s.alt=this.options.alt},_animateZoom:function(t){var s=this._map.getZoomScale(t.zoom),c=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;ii(this._image,c,s)},_reset:function(){var t=this._image,s=new Q(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),c=s.getSize();yt(t,s.min),t.style.width=c.x+"px",t.style.height=c.y+"px"},_updateOpacity:function(){Gt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),rg=function(t,s,c){return new ds(t,s,c)},Du=ds.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",s=this._image=t?this._url:Ke("video");if(He(s,"leaflet-image-layer"),this._zoomAnimated&&He(s,"leaflet-zoom-animated"),this.options.className&&He(s,this.options.className),s.onselectstart=m,s.onmousemove=m,s.onloadeddata=l(this.fire,this,"load"),t){for(var c=s.getElementsByTagName("source"),p=[],E=0;E<c.length;E++)p.push(c[E].src);this._url=c.length>0?p:[s.src];return}w(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(s.style,"objectFit")&&(s.style.objectFit="fill"),s.autoplay=!!this.options.autoplay,s.loop=!!this.options.loop,s.muted=!!this.options.muted,s.playsInline=!!this.options.playsInline;for(var D=0;D<this._url.length;D++){var ne=Ke("source");ne.src=this._url[D],s.appendChild(ne)}}});function sg(t,s,c){return new Du(t,s,c)}var Mu=ds.extend({_initImage:function(){var t=this._image=this._url;He(t,"leaflet-image-layer"),this._zoomAnimated&&He(t,"leaflet-zoom-animated"),this.options.className&&He(t,this.options.className),t.onselectstart=m,t.onmousemove=m}});function og(t,s,c){return new Mu(t,s,c)}var mn=rn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(t,s){t&&(t instanceof Z||w(t))?(this._latlng=W(t),I(this,s)):(I(this,t),this._source=s),this.options.content&&(this._content=this.options.content)},openOn:function(t){return t=arguments.length?t:this._source._map,t.hasLayer(this)||t.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(t){return this._map?this.close():(arguments.length?this._source=t:t=this._source,this._prepareOpen(),this.openOn(t._map)),this},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&Gt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&Gt(this._container,1),this.bringToFront(),this.options.interactive&&(He(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(t){t._fadeAnimated?(Gt(this._container,0),this._removeTimeout=setTimeout(l(ut,void 0,this._container),200)):ut(this._container),this.options.interactive&&(pt(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=W(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&Ni(this._container),this},bringToBack:function(){return this._map&&Ri(this._container),this},_prepareOpen:function(t){var s=this._source;if(!s._map)return!1;if(s instanceof Sn){s=null;var c=this._source._layers;for(var p in c)if(c[p]._map){s=c[p];break}if(!s)return!1;this._source=s}if(!t)if(s.getCenter)t=s.getCenter();else if(s.getLatLng)t=s.getLatLng();else if(s.getBounds)t=s.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(t),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var t=this._contentNode,s=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof s=="string")t.innerHTML=s;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(s)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),s=T(this.options.offset),c=this._getAnchor();this._zoomAnimated?yt(this._container,t.add(c)):s=s.add(t).add(c);var p=this._containerBottom=-s.y,E=this._containerLeft=-Math.round(this._containerWidth/2)+s.x;this._container.style.bottom=p+"px",this._container.style.left=E+"px"}},_getAnchor:function(){return[0,0]}});Xe.include({_initOverlay:function(t,s,c,p){var E=s;return E instanceof t||(E=new t(p).setContent(s)),c&&E.setLatLng(c),E}}),rn.include({_initOverlay:function(t,s,c,p){var E=c;return E instanceof t?(I(E,p),E._source=this):(E=s&&!p?s:new t(p,this),E.setContent(c)),E}});var hs=mn.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t=arguments.length?t:this._source._map,!t.hasLayer(this)&&t._popup&&t._popup.options.autoClose&&t.removeLayer(t._popup),t._popup=this,mn.prototype.openOn.call(this,t)},onAdd:function(t){mn.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof zn||this._source.on("preclick",si))},onRemove:function(t){mn.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof zn||this._source.off("preclick",si))},getEvents:function(){var t=mn.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this.close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_initLayout:function(){var t="leaflet-popup",s=this._container=Ke("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),c=this._wrapper=Ke("div",t+"-content-wrapper",s);if(this._contentNode=Ke("div",t+"-content",c),or(s),wo(this._contentNode),ze(s,"contextmenu",si),this._tipContainer=Ke("div",t+"-tip-container",s),this._tip=Ke("div",t+"-tip",this._tipContainer),this.options.closeButton){var p=this._closeButton=Ke("a",t+"-close-button",s);p.setAttribute("role","button"),p.setAttribute("aria-label","Close popup"),p.href="#close",p.innerHTML='<span aria-hidden="true">×</span>',ze(p,"click",function(E){St(E),this.close()},this)}},_updateLayout:function(){var t=this._contentNode,s=t.style;s.width="",s.whiteSpace="nowrap";var c=t.offsetWidth;c=Math.min(c,this.options.maxWidth),c=Math.max(c,this.options.minWidth),s.width=c+1+"px",s.whiteSpace="",s.height="";var p=t.offsetHeight,E=this.options.maxHeight,D="leaflet-popup-scrolled";E&&p>E?(s.height=E+"px",He(t,D)):pt(t,D),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var s=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),c=this._getAnchor();yt(this._container,s.add(c))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,s=parseInt(nr(this._container,"marginBottom"),10)||0,c=this._container.offsetHeight+s,p=this._containerWidth,E=new B(this._containerLeft,-c-this._containerBottom);E._add(ri(this._container));var D=t.layerPointToContainerPoint(E),ne=T(this.options.autoPanPadding),he=T(this.options.autoPanPaddingTopLeft||ne),ye=T(this.options.autoPanPaddingBottomRight||ne),Le=t.getSize(),Ce=0,je=0;D.x+p+ye.x>Le.x&&(Ce=D.x+p-Le.x+ye.x),D.x-Ce-he.x<0&&(Ce=D.x-he.x),D.y+c+ye.y>Le.y&&(je=D.y+c-Le.y+ye.y),D.y-je-he.y<0&&(je=D.y-he.y),(Ce||je)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([Ce,je]))}},_getAnchor:function(){return T(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),ag=function(t,s){return new hs(t,s)};Xe.mergeOptions({closePopupOnClick:!0}),Xe.include({openPopup:function(t,s,c){return this._initOverlay(hs,t,s,c).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),rn.include({bindPopup:function(t,s){return this._popup=this._initOverlay(hs,this._popup,t,s),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof Sn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){oi(t);var s=t.layer||t.target;if(this._popup._source===s&&!(s instanceof zn)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=s,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var fs=mn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){mn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){mn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=mn.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",s=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Ke("div",s),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+f(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var s,c,p=this._map,E=this._container,D=p.latLngToContainerPoint(p.getCenter()),ne=p.layerPointToContainerPoint(t),he=this.options.direction,ye=E.offsetWidth,Le=E.offsetHeight,Ce=T(this.options.offset),je=this._getAnchor();he==="top"?(s=ye/2,c=Le):he==="bottom"?(s=ye/2,c=0):he==="center"?(s=ye/2,c=Le/2):he==="right"?(s=0,c=Le/2):he==="left"?(s=ye,c=Le/2):ne.x<D.x?(he="right",s=0,c=Le/2):(he="left",s=ye+(Ce.x+je.x)*2,c=Le/2),t=t.subtract(T(s,c,!0)).add(Ce).add(je),pt(E,"leaflet-tooltip-right"),pt(E,"leaflet-tooltip-left"),pt(E,"leaflet-tooltip-top"),pt(E,"leaflet-tooltip-bottom"),He(E,"leaflet-tooltip-"+he),yt(E,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&Gt(this._container,t)},_animateZoom:function(t){var s=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(s)},_getAnchor:function(){return T(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),lg=function(t,s){return new fs(t,s)};Xe.include({openTooltip:function(t,s,c){return this._initOverlay(fs,t,s,c).openOn(this),this},closeTooltip:function(t){return t.close(),this}}),rn.include({bindTooltip:function(t,s){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(fs,this._tooltip,t,s),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(!(!t&&this._tooltipHandlersAdded)){var s=t?"off":"on",c={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?c.add=this._openTooltip:(c.mouseover=this._openTooltip,c.mouseout=this.closeTooltip,c.click=this._openTooltip,this._map?this._addFocusListeners():c.add=this._addFocusListeners),this._tooltip.options.sticky&&(c.mousemove=this._moveTooltip),this[s](c),this._tooltipHandlersAdded=!t}},openTooltip:function(t){return this._tooltip&&(this instanceof Sn||(this._tooltip._source=this),this._tooltip._prepareOpen(t)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(t){var s=typeof t.getElement=="function"&&t.getElement();s&&(ze(s,"focus",function(){this._tooltip._source=t,this.openTooltip()},this),ze(s,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(t){var s=typeof t.getElement=="function"&&t.getElement();s&&s.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(t){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var s=this;this._map.once("moveend",function(){s._openOnceFlag=!1,s._openTooltip(t)});return}this._tooltip._source=t.layer||t.target,this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0)}},_moveTooltip:function(t){var s=t.latlng,c,p;this._tooltip.options.sticky&&t.originalEvent&&(c=this._map.mouseEventToContainerPoint(t.originalEvent),p=this._map.containerPointToLayerPoint(c),s=this._map.layerPointToLatLng(p)),this._tooltip.setLatLng(s)}});var Ou=Pi.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var s=t&&t.tagName==="DIV"?t:document.createElement("div"),c=this.options;if(c.html instanceof Element?(Yr(s),s.appendChild(c.html)):s.innerHTML=c.html!==!1?c.html:"",c.bgPos){var p=T(c.bgPos);s.style.backgroundPosition=-p.x+"px "+-p.y+"px"}return this._setIconStyles(s,"icon"),s},createShadow:function(){return null}});function ug(t){return new Ou(t)}Pi.Default=ur;var cr=rn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:ke.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){I(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ut(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Ni(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Ri(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var t=this._clampZoom(this._map.getZoom());t!==this._tileZoom&&(this._tileZoom=t,this._updateLevels()),this._update()}return this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=h(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof B?t:new B(t,t)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var s=this.getPane().children,c=-t(-1/0,1/0),p=0,E=s.length,D;p<E;p++)D=s[p].style.zIndex,s[p]!==this._container&&D&&(c=t(c,+D));isFinite(c)&&(this.options.zIndex=c+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!ke.ielt9){Gt(this._container,this.options.opacity);var t=+new Date,s=!1,c=!1;for(var p in this._tiles){var E=this._tiles[p];if(!(!E.current||!E.loaded)){var D=Math.min(1,(t-E.loaded)/200);Gt(E.el,D),D<1?s=!0:(E.active?c=!0:this._onOpaqueTile(E),E.active=!0)}}c&&!this._noPrune&&this._pruneTiles(),s&&(G(this._fadeFrame),this._fadeFrame=$(this._updateOpacity,this))}},_onOpaqueTile:m,_initContainer:function(){this._container||(this._container=Ke("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,s=this.options.maxZoom;if(t!==void 0){for(var c in this._levels)c=Number(c),this._levels[c].el.children.length||c===t?(this._levels[c].el.style.zIndex=s-Math.abs(t-c),this._onUpdateLevel(c)):(ut(this._levels[c].el),this._removeTilesAtZoom(c),this._onRemoveLevel(c),delete this._levels[c]);var p=this._levels[t],E=this._map;return p||(p=this._levels[t]={},p.el=Ke("div","leaflet-tile-container leaflet-zoom-animated",this._container),p.el.style.zIndex=s,p.origin=E.project(E.unproject(E.getPixelOrigin()),t).round(),p.zoom=t,this._setZoomTransform(p,E.getCenter(),E.getZoom()),m(p.el.offsetWidth),this._onCreateLevel(p)),this._level=p,p}},_onUpdateLevel:m,_onRemoveLevel:m,_onCreateLevel:m,_pruneTiles:function(){if(this._map){var t,s,c=this._map.getZoom();if(c>this.options.maxZoom||c<this.options.minZoom){this._removeAllTiles();return}for(t in this._tiles)s=this._tiles[t],s.retain=s.current;for(t in this._tiles)if(s=this._tiles[t],s.current&&!s.active){var p=s.coords;this._retainParent(p.x,p.y,p.z,p.z-5)||this._retainChildren(p.x,p.y,p.z,p.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}},_removeTilesAtZoom:function(t){for(var s in this._tiles)this._tiles[s].coords.z===t&&this._removeTile(s)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ut(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,s,c,p){var E=Math.floor(t/2),D=Math.floor(s/2),ne=c-1,he=new B(+E,+D);he.z=+ne;var ye=this._tileCoordsToKey(he),Le=this._tiles[ye];return Le&&Le.active?(Le.retain=!0,!0):(Le&&Le.loaded&&(Le.retain=!0),ne>p?this._retainParent(E,D,ne,p):!1)},_retainChildren:function(t,s,c,p){for(var E=2*t;E<2*t+2;E++)for(var D=2*s;D<2*s+2;D++){var ne=new B(E,D);ne.z=c+1;var he=this._tileCoordsToKey(ne),ye=this._tiles[he];if(ye&&ye.active){ye.retain=!0;continue}else ye&&ye.loaded&&(ye.retain=!0);c+1<p&&this._retainChildren(E,D,c+1,p)}},_resetView:function(t){var s=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),s,s)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var s=this.options;return s.minNativeZoom!==void 0&&t<s.minNativeZoom?s.minNativeZoom:s.maxNativeZoom!==void 0&&s.maxNativeZoom<t?s.maxNativeZoom:t},_setView:function(t,s,c,p){var E=Math.round(s);this.options.maxZoom!==void 0&&E>this.options.maxZoom||this.options.minZoom!==void 0&&E<this.options.minZoom?E=void 0:E=this._clampZoom(E);var D=this.options.updateWhenZooming&&E!==this._tileZoom;(!p||D)&&(this._tileZoom=E,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),E!==void 0&&this._update(t),c||this._pruneTiles(),this._noPrune=!!c),this._setZoomTransforms(t,s)},_setZoomTransforms:function(t,s){for(var c in this._levels)this._setZoomTransform(this._levels[c],t,s)},_setZoomTransform:function(t,s,c){var p=this._map.getZoomScale(c,t.zoom),E=t.origin.multiplyBy(p).subtract(this._map._getNewPixelOrigin(s,c)).round();ke.any3d?ii(t.el,E,p):yt(t.el,E)},_resetGrid:function(){var t=this._map,s=t.options.crs,c=this._tileSize=this.getTileSize(),p=this._tileZoom,E=this._map.getPixelWorldBounds(this._tileZoom);E&&(this._globalTileRange=this._pxBoundsToTileRange(E)),this._wrapX=s.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,s.wrapLng[0]],p).x/c.x),Math.ceil(t.project([0,s.wrapLng[1]],p).x/c.y)],this._wrapY=s.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([s.wrapLat[0],0],p).y/c.x),Math.ceil(t.project([s.wrapLat[1],0],p).y/c.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(t){var s=this._map,c=s._animatingZoom?Math.max(s._animateToZoom,s.getZoom()):s.getZoom(),p=s.getZoomScale(c,this._tileZoom),E=s.project(t,this._tileZoom).floor(),D=s.getSize().divideBy(p*2);return new Q(E.subtract(D),E.add(D))},_update:function(t){var s=this._map;if(s){var c=this._clampZoom(s.getZoom());if(t===void 0&&(t=s.getCenter()),this._tileZoom!==void 0){var p=this._getTiledPixelBounds(t),E=this._pxBoundsToTileRange(p),D=E.getCenter(),ne=[],he=this.options.keepBuffer,ye=new Q(E.getBottomLeft().subtract([he,-he]),E.getTopRight().add([he,-he]));if(!(isFinite(E.min.x)&&isFinite(E.min.y)&&isFinite(E.max.x)&&isFinite(E.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var Le in this._tiles){var Ce=this._tiles[Le].coords;(Ce.z!==this._tileZoom||!ye.contains(new B(Ce.x,Ce.y)))&&(this._tiles[Le].current=!1)}if(Math.abs(c-this._tileZoom)>1){this._setView(t,c);return}for(var je=E.min.y;je<=E.max.y;je++)for(var Ve=E.min.x;Ve<=E.max.x;Ve++){var Nt=new B(Ve,je);if(Nt.z=this._tileZoom,!!this._isValidTile(Nt)){var Et=this._tiles[this._tileCoordsToKey(Nt)];Et?Et.current=!0:ne.push(Nt)}}if(ne.sort(function(Mt,Oi){return Mt.distanceTo(D)-Oi.distanceTo(D)}),ne.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Xt=document.createDocumentFragment();for(Ve=0;Ve<ne.length;Ve++)this._addTile(ne[Ve],Xt);this._level.el.appendChild(Xt)}}}},_isValidTile:function(t){var s=this._map.options.crs;if(!s.infinite){var c=this._globalTileRange;if(!s.wrapLng&&(t.x<c.min.x||t.x>c.max.x)||!s.wrapLat&&(t.y<c.min.y||t.y>c.max.y))return!1}if(!this.options.bounds)return!0;var p=this._tileCoordsToBounds(t);return me(this.options.bounds).overlaps(p)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var s=this._map,c=this.getTileSize(),p=t.scaleBy(c),E=p.add(c),D=s.unproject(p,t.z),ne=s.unproject(E,t.z);return[D,ne]},_tileCoordsToBounds:function(t){var s=this._tileCoordsToNwSe(t),c=new Y(s[0],s[1]);return this.options.noWrap||(c=this._map.wrapLatLngBounds(c)),c},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var s=t.split(":"),c=new B(+s[0],+s[1]);return c.z=+s[2],c},_removeTile:function(t){var s=this._tiles[t];s&&(ut(s.el),delete this._tiles[t],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){He(t,"leaflet-tile");var s=this.getTileSize();t.style.width=s.x+"px",t.style.height=s.y+"px",t.onselectstart=m,t.onmousemove=m,ke.ielt9&&this.options.opacity<1&&Gt(t,this.options.opacity)},_addTile:function(t,s){var c=this._getTilePos(t),p=this._tileCoordsToKey(t),E=this.createTile(this._wrapCoords(t),l(this._tileReady,this,t));this._initTile(E),this.createTile.length<2&&$(l(this._tileReady,this,t,null,E)),yt(E,c),this._tiles[p]={el:E,coords:t,current:!0},s.appendChild(E),this.fire("tileloadstart",{tile:E,coords:t})},_tileReady:function(t,s,c){s&&this.fire("tileerror",{error:s,tile:c,coords:t});var p=this._tileCoordsToKey(t);c=this._tiles[p],c&&(c.loaded=+new Date,this._map._fadeAnimated?(Gt(c.el,0),G(this._fadeFrame),this._fadeFrame=$(this._updateOpacity,this)):(c.active=!0,this._pruneTiles()),s||(He(c.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:c.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),ke.ielt9||!this._map._fadeAnimated?$(this._pruneTiles,this):setTimeout(l(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var s=new B(this._wrapX?g(t.x,this._wrapX):t.x,this._wrapY?g(t.y,this._wrapY):t.y);return s.z=t.z,s},_pxBoundsToTileRange:function(t){var s=this.getTileSize();return new Q(t.min.unscaleBy(s).floor(),t.max.unscaleBy(s).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function cg(t){return new cr(t)}var Mi=cr.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,s){this._url=t,s=I(this,s),s.detectRetina&&ke.retina&&s.maxZoom>0?(s.tileSize=Math.floor(s.tileSize/2),s.zoomReverse?(s.zoomOffset--,s.minZoom=Math.min(s.maxZoom,s.minZoom+1)):(s.zoomOffset++,s.maxZoom=Math.max(s.minZoom,s.maxZoom-1)),s.minZoom=Math.max(0,s.minZoom)):s.zoomReverse?s.minZoom=Math.min(s.maxZoom,s.minZoom):s.maxZoom=Math.max(s.minZoom,s.maxZoom),typeof s.subdomains=="string"&&(s.subdomains=s.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,s){return this._url===t&&s===void 0&&(s=!0),this._url=t,s||this.redraw(),this},createTile:function(t,s){var c=document.createElement("img");return ze(c,"load",l(this._tileOnLoad,this,s,c)),ze(c,"error",l(this._tileOnError,this,s,c)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(c.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(c.referrerPolicy=this.options.referrerPolicy),c.alt="",c.src=this.getTileUrl(t),c},getTileUrl:function(t){var s={r:ke.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var c=this._globalTileRange.max.y-t.y;this.options.tms&&(s.y=c),s["-y"]=c}return P(this._url,o(s,this.options))},_tileOnLoad:function(t,s){ke.ielt9?setTimeout(l(t,this,null,s),0):t(null,s)},_tileOnError:function(t,s,c){var p=this.options.errorTileUrl;p&&s.getAttribute("src")!==p&&(s.src=p),t(c,s)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,s=this.options.maxZoom,c=this.options.zoomReverse,p=this.options.zoomOffset;return c&&(t=s-t),t+p},_getSubdomain:function(t){var s=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[s]},_abortLoading:function(){var t,s;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&(s=this._tiles[t].el,s.onload=m,s.onerror=m,!s.complete)){s.src=S;var c=this._tiles[t].coords;ut(s),delete this._tiles[t],this.fire("tileabort",{tile:s,coords:c})}},_removeTile:function(t){var s=this._tiles[t];if(s)return s.el.setAttribute("src",S),cr.prototype._removeTile.call(this,t)},_tileReady:function(t,s,c){if(!(!this._map||c&&c.getAttribute("src")===S))return cr.prototype._tileReady.call(this,t,s,c)}});function Fu(t,s){return new Mi(t,s)}var ju=Mi.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,s){this._url=t;var c=o({},this.defaultWmsParams);for(var p in s)p in this.options||(c[p]=s[p]);s=I(this,s);var E=s.detectRetina&&ke.retina?2:1,D=this.getTileSize();c.width=D.x*E,c.height=D.y*E,this.wmsParams=c},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var s=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[s]=this._crs.code,Mi.prototype.onAdd.call(this,t)},getTileUrl:function(t){var s=this._tileCoordsToNwSe(t),c=this._crs,p=ie(c.project(s[0]),c.project(s[1])),E=p.min,D=p.max,ne=(this._wmsVersion>=1.3&&this._crs===Ru?[E.y,E.x,D.y,D.x]:[E.x,E.y,D.x,D.y]).join(","),he=Mi.prototype.getTileUrl.call(this,t);return he+A(this.wmsParams,he,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+ne},setParams:function(t,s){return o(this.wmsParams,t),s||this.redraw(),this}});function dg(t,s){return new ju(t,s)}Mi.WMS=ju,Fu.wms=dg;var In=rn.extend({options:{padding:.1},initialize:function(t){I(this,t),f(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),He(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,s){var c=this._map.getZoomScale(s,this._zoom),p=this._map.getSize().multiplyBy(.5+this.options.padding),E=this._map.project(this._center,s),D=p.multiplyBy(-c).add(E).subtract(this._map._getNewPixelOrigin(t,s));ke.any3d?ii(this._container,D,c):yt(this._container,D)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,s=this._map.getSize(),c=this._map.containerPointToLayerPoint(s.multiplyBy(-t)).round();this._bounds=new Q(c,c.add(s.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Bu=In.extend({options:{tolerance:0},getEvents:function(){var t=In.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){In.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");ze(t,"mousemove",this._onMouseMove,this),ze(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),ze(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){G(this._redrawRequest),delete this._ctx,ut(this._container),rt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var s in this._layers)t=this._layers[s],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){In.prototype._update.call(this);var t=this._bounds,s=this._container,c=t.getSize(),p=ke.retina?2:1;yt(s,t.min),s.width=p*c.x,s.height=p*c.y,s.style.width=c.x+"px",s.style.height=c.y+"px",ke.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){In.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[f(t)]=t;var s=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=s),this._drawLast=s,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var s=t._order,c=s.next,p=s.prev;c?c.prev=p:this._drawLast=p,p?p.next=c:this._drawFirst=c,delete t._order,delete this._layers[f(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if(typeof t.options.dashArray=="string"){var s=t.options.dashArray.split(/[, ]+/),c=[],p,E;for(E=0;E<s.length;E++){if(p=Number(s[E]),isNaN(p))return;c.push(p)}t.options._dashArray=c}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||$(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var s=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new Q,this._redrawBounds.extend(t._pxBounds.min.subtract([s,s])),this._redrawBounds.extend(t._pxBounds.max.add([s,s]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var s=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,s.x,s.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var t,s=this._redrawBounds;if(this._ctx.save(),s){var c=s.getSize();this._ctx.beginPath(),this._ctx.rect(s.min.x,s.min.y,c.x,c.y),this._ctx.clip()}this._drawing=!0;for(var p=this._drawFirst;p;p=p.next)t=p.layer,(!s||t._pxBounds&&t._pxBounds.intersects(s))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,s){if(this._drawing){var c,p,E,D,ne=t._parts,he=ne.length,ye=this._ctx;if(he){for(ye.beginPath(),c=0;c<he;c++){for(p=0,E=ne[c].length;p<E;p++)D=ne[c][p],ye[p?"lineTo":"moveTo"](D.x,D.y);s&&ye.closePath()}this._fillStroke(ye,t)}}},_updateCircle:function(t){if(!(!this._drawing||t._empty())){var s=t._point,c=this._ctx,p=Math.max(Math.round(t._radius),1),E=(Math.max(Math.round(t._radiusY),1)||p)/p;E!==1&&(c.save(),c.scale(1,E)),c.beginPath(),c.arc(s.x,s.y/E,p,0,Math.PI*2,!1),E!==1&&c.restore(),this._fillStroke(c,t)}},_fillStroke:function(t,s){var c=s.options;c.fill&&(t.globalAlpha=c.fillOpacity,t.fillStyle=c.fillColor||c.color,t.fill(c.fillRule||"evenodd")),c.stroke&&c.weight!==0&&(t.setLineDash&&t.setLineDash(s.options&&s.options._dashArray||[]),t.globalAlpha=c.opacity,t.lineWidth=c.weight,t.strokeStyle=c.color,t.lineCap=c.lineCap,t.lineJoin=c.lineJoin,t.stroke())},_onClick:function(t){for(var s=this._map.mouseEventToLayerPoint(t),c,p,E=this._drawFirst;E;E=E.next)c=E.layer,c.options.interactive&&c._containsPoint(s)&&(!(t.type==="click"||t.type==="preclick")||!this._map._draggableMoved(c))&&(p=c);this._fireEvent(p?[p]:!1,t)},_onMouseMove:function(t){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var s=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,s)}},_handleMouseOut:function(t){var s=this._hoveredLayer;s&&(pt(this._container,"leaflet-interactive"),this._fireEvent([s],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,s){if(!this._mouseHoverThrottled){for(var c,p,E=this._drawFirst;E;E=E.next)c=E.layer,c.options.interactive&&c._containsPoint(s)&&(p=c);p!==this._hoveredLayer&&(this._handleMouseOut(t),p&&(He(this._container,"leaflet-interactive"),this._fireEvent([p],t,"mouseover"),this._hoveredLayer=p)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,t),this._mouseHoverThrottled=!0,setTimeout(l(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(t,s,c){this._map._fireDOMEvent(s,c||s.type,t)},_bringToFront:function(t){var s=t._order;if(s){var c=s.next,p=s.prev;if(c)c.prev=p;else return;p?p.next=c:c&&(this._drawFirst=c),s.prev=this._drawLast,this._drawLast.next=s,s.next=null,this._drawLast=s,this._requestRedraw(t)}},_bringToBack:function(t){var s=t._order;if(s){var c=s.next,p=s.prev;if(p)p.next=c;else return;c?c.prev=p:p&&(this._drawLast=p),s.prev=null,s.next=this._drawFirst,this._drawFirst.prev=s,this._drawFirst=s,this._requestRedraw(t)}}});function $u(t){return ke.canvas?new Bu(t):null}var dr=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),hg={_initContainer:function(){this._container=Ke("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(In.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var s=t._container=dr("shape");He(s,"leaflet-vml-shape "+(this.options.className||"")),s.coordsize="1 1",t._path=dr("path"),s.appendChild(t._path),this._updateStyle(t),this._layers[f(t)]=t},_addPath:function(t){var s=t._container;this._container.appendChild(s),t.options.interactive&&t.addInteractiveTarget(s)},_removePath:function(t){var s=t._container;ut(s),t.removeInteractiveTarget(s),delete this._layers[f(t)]},_updateStyle:function(t){var s=t._stroke,c=t._fill,p=t.options,E=t._container;E.stroked=!!p.stroke,E.filled=!!p.fill,p.stroke?(s||(s=t._stroke=dr("stroke")),E.appendChild(s),s.weight=p.weight+"px",s.color=p.color,s.opacity=p.opacity,p.dashArray?s.dashStyle=w(p.dashArray)?p.dashArray.join(" "):p.dashArray.replace(/( *, *)/g," "):s.dashStyle="",s.endcap=p.lineCap.replace("butt","flat"),s.joinstyle=p.lineJoin):s&&(E.removeChild(s),t._stroke=null),p.fill?(c||(c=t._fill=dr("fill")),E.appendChild(c),c.color=p.fillColor||p.color,c.opacity=p.fillOpacity):c&&(E.removeChild(c),t._fill=null)},_updateCircle:function(t){var s=t._point.round(),c=Math.round(t._radius),p=Math.round(t._radiusY||c);this._setPath(t,t._empty()?"M0 0":"AL "+s.x+","+s.y+" "+c+","+p+" 0,"+65535*360)},_setPath:function(t,s){t._path.v=s},_bringToFront:function(t){Ni(t._container)},_bringToBack:function(t){Ri(t._container)}},ps=ke.vml?dr:fe,hr=In.extend({_initContainer:function(){this._container=ps("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=ps("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ut(this._container),rt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){In.prototype._update.call(this);var t=this._bounds,s=t.getSize(),c=this._container;(!this._svgSize||!this._svgSize.equals(s))&&(this._svgSize=s,c.setAttribute("width",s.x),c.setAttribute("height",s.y)),yt(c,t.min),c.setAttribute("viewBox",[t.min.x,t.min.y,s.x,s.y].join(" ")),this.fire("update")}},_initPath:function(t){var s=t._path=ps("path");t.options.className&&He(s,t.options.className),t.options.interactive&&He(s,"leaflet-interactive"),this._updateStyle(t),this._layers[f(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ut(t._path),t.removeInteractiveTarget(t._path),delete this._layers[f(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var s=t._path,c=t.options;s&&(c.stroke?(s.setAttribute("stroke",c.color),s.setAttribute("stroke-opacity",c.opacity),s.setAttribute("stroke-width",c.weight),s.setAttribute("stroke-linecap",c.lineCap),s.setAttribute("stroke-linejoin",c.lineJoin),c.dashArray?s.setAttribute("stroke-dasharray",c.dashArray):s.removeAttribute("stroke-dasharray"),c.dashOffset?s.setAttribute("stroke-dashoffset",c.dashOffset):s.removeAttribute("stroke-dashoffset")):s.setAttribute("stroke","none"),c.fill?(s.setAttribute("fill",c.fillColor||c.color),s.setAttribute("fill-opacity",c.fillOpacity),s.setAttribute("fill-rule",c.fillRule||"evenodd")):s.setAttribute("fill","none"))},_updatePoly:function(t,s){this._setPath(t,xe(t._parts,s))},_updateCircle:function(t){var s=t._point,c=Math.max(Math.round(t._radius),1),p=Math.max(Math.round(t._radiusY),1)||c,E="a"+c+","+p+" 0 1,0 ",D=t._empty()?"M0 0":"M"+(s.x-c)+","+s.y+E+c*2+",0 "+E+-c*2+",0 ";this._setPath(t,D)},_setPath:function(t,s){t._path.setAttribute("d",s)},_bringToFront:function(t){Ni(t._path)},_bringToBack:function(t){Ri(t._path)}});ke.vml&&hr.include(hg);function qu(t){return ke.svg||ke.vml?new hr(t):null}Xe.include({getRenderer:function(t){var s=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return s||(s=this._renderer=this._createRenderer()),this.hasLayer(s)||this.addLayer(s),s},_getPaneRenderer:function(t){if(t==="overlayPane"||t===void 0)return!1;var s=this._paneRenderers[t];return s===void 0&&(s=this._createRenderer({pane:t}),this._paneRenderers[t]=s),s},_createRenderer:function(t){return this.options.preferCanvas&&$u(t)||qu(t)}});var zu=ki.extend({initialize:function(t,s){ki.prototype.initialize.call(this,this._boundsToLatLngs(t),s)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=me(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function fg(t,s){return new zu(t,s)}hr.create=ps,hr.pointsToPath=xe,Ln.geometryToLayer=as,Ln.coordsToLatLng=Ro,Ln.coordsToLatLngs=ls,Ln.latLngToCoords=Co,Ln.latLngsToCoords=us,Ln.getFeature=Di,Ln.asFeature=cs,Xe.mergeOptions({boxZoom:!0});var Hu=gn.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){ze(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){rt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ut(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),ir(),fo(),this._startPoint=this._map.mouseEventToContainerPoint(t),ze(document,{contextmenu:oi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=Ke("div","leaflet-zoom-box",this._container),He(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var s=new Q(this._point,this._startPoint),c=s.getSize();yt(this._box,s.min),this._box.style.width=c.x+"px",this._box.style.height=c.y+"px"},_finish:function(){this._moved&&(ut(this._box),pt(this._container,"leaflet-crosshair")),rr(),po(),rt(document,{contextmenu:oi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(l(this._resetState,this),0);var s=new Y(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(s).fire("boxzoomend",{boxZoomBounds:s})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Xe.addInitHook("addHandler","boxZoom",Hu),Xe.mergeOptions({doubleClickZoom:!0});var Uu=gn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var s=this._map,c=s.getZoom(),p=s.options.zoomDelta,E=t.originalEvent.shiftKey?c-p:c+p;s.options.doubleClickZoom==="center"?s.setZoom(E):s.setZoomAround(t.containerPoint,E)}});Xe.addInitHook("addHandler","doubleClickZoom",Uu),Xe.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Vu=gn.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new qn(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}He(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){pt(this._map._container,"leaflet-grab"),pt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var s=me(this._map.options.maxBounds);this._offsetLimit=ie(this._map.latLngToContainerPoint(s.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(s.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var s=this._lastTime=+new Date,c=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(c),this._times.push(s),this._prunePositions(s)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),s=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=s.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,s){return t-(t-s)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var t=this._draggable._newPos.subtract(this._draggable._startPos),s=this._offsetLimit;t.x<s.min.x&&(t.x=this._viscousLimit(t.x,s.min.x)),t.y<s.min.y&&(t.y=this._viscousLimit(t.y,s.min.y)),t.x>s.max.x&&(t.x=this._viscousLimit(t.x,s.max.x)),t.y>s.max.y&&(t.y=this._viscousLimit(t.y,s.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,s=Math.round(t/2),c=this._initialWorldOffset,p=this._draggable._newPos.x,E=(p-s+c)%t+s-c,D=(p+s+c)%t-s-c,ne=Math.abs(E+c)<Math.abs(D+c)?E:D;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=ne},_onDragEnd:function(t){var s=this._map,c=s.options,p=!c.inertia||t.noInertia||this._times.length<2;if(s.fire("dragend",t),p)s.fire("moveend");else{this._prunePositions(+new Date);var E=this._lastPos.subtract(this._positions[0]),D=(this._lastTime-this._times[0])/1e3,ne=c.easeLinearity,he=E.multiplyBy(ne/D),ye=he.distanceTo([0,0]),Le=Math.min(c.inertiaMaxSpeed,ye),Ce=he.multiplyBy(Le/ye),je=Le/(c.inertiaDeceleration*ne),Ve=Ce.multiplyBy(-je/2).round();!Ve.x&&!Ve.y?s.fire("moveend"):(Ve=s._limitOffset(Ve,s.options.maxBounds),$(function(){s.panBy(Ve,{duration:je,easeLinearity:ne,noMoveStart:!0,animate:!0})}))}}});Xe.addInitHook("addHandler","dragging",Vu),Xe.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Wu=gn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),ze(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),rt(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,s=document.documentElement,c=t.scrollTop||s.scrollTop,p=t.scrollLeft||s.scrollLeft;this._map._container.focus(),window.scrollTo(p,c)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var s=this._panKeys={},c=this.keyCodes,p,E;for(p=0,E=c.left.length;p<E;p++)s[c.left[p]]=[-1*t,0];for(p=0,E=c.right.length;p<E;p++)s[c.right[p]]=[t,0];for(p=0,E=c.down.length;p<E;p++)s[c.down[p]]=[0,t];for(p=0,E=c.up.length;p<E;p++)s[c.up[p]]=[0,-1*t]},_setZoomDelta:function(t){var s=this._zoomKeys={},c=this.keyCodes,p,E;for(p=0,E=c.zoomIn.length;p<E;p++)s[c.zoomIn[p]]=t;for(p=0,E=c.zoomOut.length;p<E;p++)s[c.zoomOut[p]]=-t},_addHooks:function(){ze(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){rt(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var s=t.keyCode,c=this._map,p;if(s in this._panKeys){if(!c._panAnim||!c._panAnim._inProgress)if(p=this._panKeys[s],t.shiftKey&&(p=T(p).multiplyBy(3)),c.options.maxBounds&&(p=c._limitOffset(T(p),c.options.maxBounds)),c.options.worldCopyJump){var E=c.wrapLatLng(c.unproject(c.project(c.getCenter()).add(p)));c.panTo(E)}else c.panBy(p)}else if(s in this._zoomKeys)c.setZoom(c.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[s]);else if(s===27&&c._popup&&c._popup.options.closeOnEscapeKey)c.closePopup();else return;oi(t)}}});Xe.addInitHook("addHandler","keyboard",Wu),Xe.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Gu=gn.extend({addHooks:function(){ze(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){rt(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var s=_u(t),c=this._map.options.wheelDebounceTime;this._delta+=s,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var p=Math.max(c-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(l(this._performZoom,this),p),oi(t)},_performZoom:function(){var t=this._map,s=t.getZoom(),c=this._map.options.zoomSnap||0;t._stop();var p=this._delta/(this._map.options.wheelPxPerZoomLevel*4),E=4*Math.log(2/(1+Math.exp(-Math.abs(p))))/Math.LN2,D=c?Math.ceil(E/c)*c:E,ne=t._limitZoom(s+(this._delta>0?D:-D))-s;this._delta=0,this._startTime=null,ne&&(t.options.scrollWheelZoom==="center"?t.setZoom(s+ne):t.setZoomAround(this._lastMousePos,s+ne))}});Xe.addInitHook("addHandler","scrollWheelZoom",Gu);var pg=600;Xe.mergeOptions({tapHold:ke.touchNative&&ke.safari&&ke.mobile,tapTolerance:15});var Zu=gn.extend({addHooks:function(){ze(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){rt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var s=t.touches[0];this._startPos=this._newPos=new B(s.clientX,s.clientY),this._holdTimeout=setTimeout(l(function(){this._cancel(),this._isTapValid()&&(ze(document,"touchend",St),ze(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",s))},this),pg),ze(document,"touchend touchcancel contextmenu",this._cancel,this),ze(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){rt(document,"touchend",St),rt(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),rt(document,"touchend touchcancel contextmenu",this._cancel,this),rt(document,"touchmove",this._onMove,this)},_onMove:function(t){var s=t.touches[0];this._newPos=new B(s.clientX,s.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,s){var c=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:s.screenX,screenY:s.screenY,clientX:s.clientX,clientY:s.clientY});c._simulated=!0,s.target.dispatchEvent(c)}});Xe.addInitHook("addHandler","tapHold",Zu),Xe.mergeOptions({touchZoom:ke.touch,bounceAtZoomLimits:!0});var Xu=gn.extend({addHooks:function(){He(this._map._container,"leaflet-touch-zoom"),ze(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){pt(this._map._container,"leaflet-touch-zoom"),rt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var s=this._map;if(!(!t.touches||t.touches.length!==2||s._animatingZoom||this._zooming)){var c=s.mouseEventToContainerPoint(t.touches[0]),p=s.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=s.getSize()._divideBy(2),this._startLatLng=s.containerPointToLatLng(this._centerPoint),s.options.touchZoom!=="center"&&(this._pinchStartLatLng=s.containerPointToLatLng(c.add(p)._divideBy(2))),this._startDist=c.distanceTo(p),this._startZoom=s.getZoom(),this._moved=!1,this._zooming=!0,s._stop(),ze(document,"touchmove",this._onTouchMove,this),ze(document,"touchend touchcancel",this._onTouchEnd,this),St(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var s=this._map,c=s.mouseEventToContainerPoint(t.touches[0]),p=s.mouseEventToContainerPoint(t.touches[1]),E=c.distanceTo(p)/this._startDist;if(this._zoom=s.getScaleZoom(E,this._startZoom),!s.options.bounceAtZoomLimits&&(this._zoom<s.getMinZoom()&&E<1||this._zoom>s.getMaxZoom()&&E>1)&&(this._zoom=s._limitZoom(this._zoom)),s.options.touchZoom==="center"){if(this._center=this._startLatLng,E===1)return}else{var D=c._add(p)._divideBy(2)._subtract(this._centerPoint);if(E===1&&D.x===0&&D.y===0)return;this._center=s.unproject(s.project(this._pinchStartLatLng,this._zoom).subtract(D),this._zoom)}this._moved||(s._moveStart(!0,!1),this._moved=!0),G(this._animRequest);var ne=l(s._move,s,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=$(ne,this,!0),St(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,G(this._animRequest),rt(document,"touchmove",this._onTouchMove,this),rt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Xe.addInitHook("addHandler","touchZoom",Xu),Xe.BoxZoom=Hu,Xe.DoubleClickZoom=Uu,Xe.Drag=Vu,Xe.Keyboard=Wu,Xe.ScrollWheelZoom=Gu,Xe.TapHold=Zu,Xe.TouchZoom=Xu,n.Bounds=Q,n.Browser=ke,n.CRS=ee,n.Canvas=Bu,n.Circle=No,n.CircleMarker=os,n.Class=F,n.Control=nn,n.DivIcon=Ou,n.DivOverlay=mn,n.DomEvent=Pp,n.DomUtil=Rp,n.Draggable=qn,n.Evented=re,n.FeatureGroup=Sn,n.GeoJSON=Ln,n.GridLayer=cr,n.Handler=gn,n.Icon=Pi,n.ImageOverlay=ds,n.LatLng=Z,n.LatLngBounds=Y,n.Layer=rn,n.LayerGroup=Ci,n.LineUtil=Vp,n.Map=Xe,n.Marker=ss,n.Mixin=Bp,n.Path=zn,n.Point=B,n.PolyUtil=$p,n.Polygon=ki,n.Polyline=Tn,n.Popup=hs,n.PosAnimation=yu,n.Projection=Wp,n.Rectangle=zu,n.Renderer=In,n.SVG=hr,n.SVGOverlay=Mu,n.TileLayer=Mi,n.Tooltip=fs,n.Transformation=Ee,n.Util=j,n.VideoOverlay=Du,n.bind=l,n.bounds=ie,n.canvas=$u,n.circle=eg,n.circleMarker=Yp,n.control=ar,n.divIcon=ug,n.extend=o,n.featureGroup=Qp,n.geoJSON=ku,n.geoJson=ig,n.gridLayer=cg,n.icon=Jp,n.imageOverlay=rg,n.latLng=W,n.latLngBounds=me,n.layerGroup=Xp,n.map=kp,n.marker=Kp,n.point=T,n.polygon=ng,n.polyline=tg,n.popup=ag,n.rectangle=fg,n.setOptions=I,n.stamp=f,n.svg=qu,n.svgOverlay=og,n.tileLayer=Fu,n.tooltip=lg,n.transformation=Te,n.version=r,n.videoOverlay=sg;var gg=window.L;n.noConflict=function(){return window.L=gg,this},window.L=n}))})(Br,Br.exports)),Br.exports}var Ot=cu(),yl={exports:{}},Xh;function D0(){return Xh||(Xh=1,(function(i,e){((n,r)=>{i.exports=n(cu()),typeof r<"u"&&r.L&&n(r.L)})(n=>{n.Editable=n.Evented.extend({statics:{FORWARD:1,BACKWARD:-1},options:{zIndex:1e3,polygonClass:n.Polygon,polylineClass:n.Polyline,markerClass:n.Marker,circleMarkerClass:n.CircleMarker,rectangleClass:n.Rectangle,circleClass:n.Circle,drawingCSSClass:"leaflet-editable-drawing",drawingCursor:"crosshair",editLayer:void 0,featuresLayer:void 0,polylineEditorClass:void 0,polygonEditorClass:void 0,markerEditorClass:void 0,circleMarkerEditorClass:void 0,rectangleEditorClass:void 0,circleEditorClass:void 0,lineGuideOptions:{},skipMiddleMarkers:!1},initialize:function(d,_){n.setOptions(this,_),this._lastZIndex=this.options.zIndex,this.map=d,this.editLayer=this.createEditLayer(),this.featuresLayer=this.createFeaturesLayer(),this.forwardLineGuide=this.createLineGuide(),this.backwardLineGuide=this.createLineGuide()},fireAndForward:function(d,_){_=_||{},_.editTools=this,this.fire(d,_),this.map.fire(d,_)},createLineGuide:function(){const d=n.extend({dashArray:"5,10",weight:1,interactive:!1},this.options.lineGuideOptions);return n.polyline([],d)},createVertexIcon:d=>n.Browser.mobile&&n.Browser.touch?new n.Editable.TouchVertexIcon(d):new n.Editable.VertexIcon(d),createEditLayer:function(){return this.options.editLayer||new n.LayerGroup().addTo(this.map)},createFeaturesLayer:function(){return this.options.featuresLayer||new n.LayerGroup().addTo(this.map)},moveForwardLineGuide:function(d){this.forwardLineGuide._latlngs.length&&(this.forwardLineGuide._latlngs[1]=d,this.forwardLineGuide._bounds.extend(d),this.forwardLineGuide.redraw())},moveBackwardLineGuide:function(d){this.backwardLineGuide._latlngs.length&&(this.backwardLineGuide._latlngs[1]=d,this.backwardLineGuide._bounds.extend(d),this.backwardLineGuide.redraw())},anchorForwardLineGuide:function(d){this.forwardLineGuide._latlngs[0]=d,this.forwardLineGuide._bounds.extend(d),this.forwardLineGuide.redraw()},anchorBackwardLineGuide:function(d){this.backwardLineGuide._latlngs[0]=d,this.backwardLineGuide._bounds.extend(d),this.backwardLineGuide.redraw()},attachForwardLineGuide:function(){this.editLayer.addLayer(this.forwardLineGuide)},attachBackwardLineGuide:function(){this.editLayer.addLayer(this.backwardLineGuide)},detachForwardLineGuide:function(){this.forwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.forwardLineGuide)},detachBackwardLineGuide:function(){this.backwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.backwardLineGuide)},blockEvents:function(){this._oldTargets||(this._oldTargets=this.map._targets,this.map._targets={})},unblockEvents:function(){this._oldTargets&&(this.map._targets=n.extend(this.map._targets,this._oldTargets),delete this._oldTargets)},registerForDrawing:function(d){this._drawingEditor&&this.unregisterForDrawing(this._drawingEditor),this.blockEvents(),d.reset(),this._drawingEditor=d,this.map.on("mousemove touchmove",d.onDrawingMouseMove,d),this.map.on("mousedown",this.onMousedown,this),this.map.on("mouseup",this.onMouseup,this),n.DomUtil.addClass(this.map._container,this.options.drawingCSSClass),this.defaultMapCursor=this.map._container.style.cursor,this.map._container.style.cursor=this.options.drawingCursor},unregisterForDrawing:function(d){this.unblockEvents(),n.DomUtil.removeClass(this.map._container,this.options.drawingCSSClass),this.map._container.style.cursor=this.defaultMapCursor,d=d||this._drawingEditor,d&&(this.map.off("mousemove touchmove",d.onDrawingMouseMove,d),this.map.off("mousedown",this.onMousedown,this),this.map.off("mouseup",this.onMouseup,this),d===this._drawingEditor&&(delete this._drawingEditor,d._drawing&&d.cancelDrawing()))},onMousedown:function(d){d.originalEvent.which==1&&(this._mouseDown=d,this._drawingEditor.onDrawingMouseDown(d))},onMouseup:function(d){if(this._mouseDown){const _=this._drawingEditor,b=this._mouseDown;if(this._mouseDown=null,_.onDrawingMouseUp(d),this._drawingEditor!==_)return;const I=n.point(b.originalEvent.clientX,b.originalEvent.clientY),A=n.point(d.originalEvent.clientX,d.originalEvent.clientY).distanceTo(I);Math.abs(A)<9*(window.devicePixelRatio||1)&&this._drawingEditor.onDrawingClick(d)}},drawing:function(){return this._drawingEditor?.drawing()},stopDrawing:function(){this.unregisterForDrawing()},commitDrawing:function(d){this._drawingEditor&&this._drawingEditor.commitDrawing(d)},connectCreatedToMap:function(d){return this.featuresLayer.addLayer(d)},startPolyline:function(d,_){const b=this.createPolyline([],_);return b.enableEdit(this.map).newShape(d),b},startPolygon:function(d,_){const b=this.createPolygon([],_);return b.enableEdit(this.map).newShape(d),b},startMarker:function(d,_){d=d||this.map.getCenter().clone();const b=this.createMarker(d,_);return b.enableEdit(this.map).startDrawing(),b},startCircleMarker:function(d,_){d=d||this.map.getCenter().clone();const b=this.createCircleMarker(d,_);return b.enableEdit(this.map).startDrawing(),b},startRectangle:function(d,_){const b=d||n.latLng([0,0]),I=new n.LatLngBounds(b,b),A=this.createRectangle(I,_);return A.enableEdit(this.map).startDrawing(),A},startCircle:function(d,_){d=d||this.map.getCenter().clone();const b=this.createCircle(d,_);return b.enableEdit(this.map).startDrawing(),b},startHole:(d,_)=>{d.newHole(_)},createLayer:function(d,_,b){b=n.Util.extend({editOptions:{editTools:this}},b);const I=new d(_,b);return this.fireAndForward("editable:created",{layer:I}),I},createPolyline:function(d,_){return this.createLayer(_?.polylineClass||this.options.polylineClass,d,_)},createPolygon:function(d,_){return this.createLayer(_?.polygonClass||this.options.polygonClass,d,_)},createMarker:function(d,_){return this.createLayer(_?.markerClass||this.options.markerClass,d,_)},createCircleMarker:function(d,_){return this.createLayer(_?.circleMarkerClass||this.options.circleMarkerClass,d,_)},createRectangle:function(d,_){return this.createLayer(_?.rectangleClass||this.options.rectangleClass,d,_)},createCircle:function(d,_){return this.createLayer(_?.circleClass||this.options.circleClass,d,_)}}),n.extend(n.Editable,{makeCancellable:d=>{d.cancel=()=>{d._cancelled=!0}}}),n.Map.mergeOptions({editToolsClass:n.Editable,editable:!1,editOptions:{}}),n.Map.addInitHook(function(){this.whenReady(function(){this.options.editable&&(this.editTools=new this.options.editToolsClass(this,this.options.editOptions))})}),n.Editable.VertexIcon=n.DivIcon.extend({options:{iconSize:new n.Point(8,8)}}),n.Editable.TouchVertexIcon=n.Editable.VertexIcon.extend({options:{iconSize:new n.Point(20,20)}}),n.Editable.VertexMarker=n.Marker.extend({options:{draggable:!0,className:"leaflet-div-icon leaflet-vertex-icon"},initialize:function(d,_,b,I){this.latlng=d,this.latlngs=_,this.editor=b,n.Marker.prototype.initialize.call(this,d,I),this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.latlng.__vertex=this,this.connect(),this.setZIndexOffset(b.tools._lastZIndex+1)},connect:function(){this.editor.editLayer.addLayer(this)},onAdd:function(d){n.Marker.prototype.onAdd.call(this,d),this.on("drag",this.onDrag),this.on("dragstart",this.onDragStart),this.on("dragend",this.onDragEnd),this.on("mouseup",this.onMouseup),this.on("click",this.onClick),this.on("contextmenu",this.onContextMenu),this.on("mousedown touchstart",this.onMouseDown),this.on("mouseover",this.onMouseOver),this.on("mouseout",this.onMouseOut),this.addMiddleMarkers()},onRemove:function(d){this.middleMarker&&this.middleMarker.delete(),delete this.latlng.__vertex,this.off("drag",this.onDrag),this.off("dragstart",this.onDragStart),this.off("dragend",this.onDragEnd),this.off("mouseup",this.onMouseup),this.off("click",this.onClick),this.off("contextmenu",this.onContextMenu),this.off("mousedown touchstart",this.onMouseDown),this.off("mouseover",this.onMouseOver),this.off("mouseout",this.onMouseOut),n.Marker.prototype.onRemove.call(this,d)},onDrag:function(d){d.vertex=this,this.editor.onVertexMarkerDrag(d);const _=n.DomUtil.getPosition(this._icon),b=this._map.layerPointToLatLng(_);this.latlng.update(b),this._latlng=this.latlng,this.editor.refresh(),this.middleMarker&&this.middleMarker.updateLatLng();const I=this.getNext();I?.middleMarker&&I.middleMarker.updateLatLng()},onDragStart:function(d){d.vertex=this,this.editor.onVertexMarkerDragStart(d)},onDragEnd:function(d){d.vertex=this,this.editor.onVertexMarkerDragEnd(d)},onClick:function(d){d.vertex=this,this.editor.onVertexMarkerClick(d)},onMouseup:function(d){n.DomEvent.stop(d),d.vertex=this,this.editor.map.fire("mouseup",d)},onContextMenu:function(d){d.vertex=this,this.editor.onVertexMarkerContextMenu(d)},onMouseDown:function(d){d.vertex=this,this.editor.onVertexMarkerMouseDown(d)},onMouseOver:function(d){d.vertex=this,this.editor.onVertexMarkerMouseOver(d)},onMouseOut:function(d){d.vertex=this,this.editor.onVertexMarkerMouseOut(d)},delete:function(){const d=this.getNext();this.latlngs.splice(this.getIndex(),1),this.editor.editLayer.removeLayer(this),this.editor.onVertexDeleted({latlng:this.latlng,vertex:this}),this.latlngs.length||this.editor.deleteShape(this.latlngs),d&&d.resetMiddleMarker(),this.editor.refresh()},getIndex:function(){return this.latlngs.indexOf(this.latlng)},getLastIndex:function(){return this.latlngs.length-1},getPrevious:function(){if(this.latlngs.length<2)return;const d=this.getIndex();let _=d-1;d===0&&this.editor.CLOSED&&(_=this.getLastIndex());const b=this.latlngs[_];if(b)return b.__vertex},getNext:function(){if(this.latlngs.length<2)return;const d=this.getIndex();let _=d+1;d===this.getLastIndex()&&this.editor.CLOSED&&(_=0);const b=this.latlngs[_];if(b)return b.__vertex},addMiddleMarker:function(d){this.editor.hasMiddleMarkers()&&(d=d||this.getPrevious(),d&&!this.middleMarker&&(this.middleMarker=this.editor.addMiddleMarker(d,this,this.latlngs,this.editor)))},addMiddleMarkers:function(){if(!this.editor.hasMiddleMarkers())return;const d=this.getPrevious();d&&this.addMiddleMarker(d);const _=this.getNext();_&&_.resetMiddleMarker()},resetMiddleMarker:function(){this.middleMarker&&this.middleMarker.delete(),this.addMiddleMarker()},split:function(){this.editor.splitShape&&this.editor.splitShape(this.latlngs,this.getIndex())},continue:function(){if(!this.editor.continueBackward)return;const d=this.getIndex();d===0?this.editor.continueBackward(this.latlngs):d===this.getLastIndex()&&this.editor.continueForward(this.latlngs)}}),n.Editable.mergeOptions({vertexMarkerClass:n.Editable.VertexMarker}),n.Editable.MiddleMarker=n.Marker.extend({options:{opacity:.5,className:"leaflet-div-icon leaflet-middle-icon",draggable:!0},initialize:function(d,_,b,I,A){this.left=d,this.right=_,this.editor=I,this.latlngs=b,n.Marker.prototype.initialize.call(this,this.computeLatLng(),A),this._opacity=this.options.opacity,this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.editor.editLayer.addLayer(this),this.setVisibility()},setVisibility:function(){const d=this._map.latLngToContainerPoint(this.left.latlng),_=this._map.latLngToContainerPoint(this.right.latlng),b=n.point(this.options.icon.options.iconSize);d.distanceTo(_)<b.x*3?this.hide():this.show()},show:function(){this.setOpacity(this._opacity)},hide:function(){this.setOpacity(0)},updateLatLng:function(){this.setLatLng(this.computeLatLng()),this.setVisibility()},computeLatLng:function(){const d=this.editor.map.latLngToContainerPoint(this.left.latlng),_=this.editor.map.latLngToContainerPoint(this.right.latlng),b=(d.y+_.y)/2,I=(d.x+_.x)/2;return this.editor.map.containerPointToLatLng([I,b])},onAdd:function(d){n.Marker.prototype.onAdd.call(this,d),n.DomEvent.on(this._icon,"mousedown touchstart",this.onMouseDown,this),d.on("zoomend",this.setVisibility,this)},onRemove:function(d){delete this.right.middleMarker,n.DomEvent.off(this._icon,"mousedown touchstart",this.onMouseDown,this),d.off("zoomend",this.setVisibility,this),n.Marker.prototype.onRemove.call(this,d)},onMouseDown:function(d){const _=n.DomUtil.getPosition(this._icon),b=this.editor.map.layerPointToLatLng(_);if(d={originalEvent:d,latlng:b},this.options.opacity===0||(n.Editable.makeCancellable(d),this.editor.onMiddleMarkerMouseDown(d),d._cancelled))return;this.latlngs.splice(this.index(),0,d.latlng),this.editor.refresh();const I=this._icon,A=this.editor.addVertexMarker(d.latlng,this.latlngs);this.editor.onNewVertex(A);const N=A._icon.parentNode;N.removeChild(A._icon),A._icon=I,N.appendChild(A._icon),A._initIcon(),A._initInteraction(),A.setOpacity(1),n.Draggable._dragging=!1,A.dragging._draggable._onDown(d.originalEvent),this.delete()},delete:function(){this.editor.editLayer.removeLayer(this)},index:function(){return this.latlngs.indexOf(this.right.latlng)}}),n.Editable.mergeOptions({middleMarkerClass:n.Editable.MiddleMarker}),n.Editable.BaseEditor=n.Handler.extend({initialize:function(d,_,b){n.setOptions(this,b),this.map=d,this.feature=_,this.feature.editor=this,this.editLayer=new n.LayerGroup,this.tools=this.options.editTools||d.editTools},addHooks:function(){this.isConnected()?this.onFeatureAdd():this.feature.once("add",this.onFeatureAdd,this),this.onEnable(),this.feature.on(this._getEvents(),this)},removeHooks:function(){this.feature.off(this._getEvents(),this),this.feature.dragging&&this.feature.dragging.disable(),this.editLayer.clearLayers(),this.tools.editLayer.removeLayer(this.editLayer),this.onDisable(),this._drawing&&this.cancelDrawing()},drawing:function(){return!!this._drawing},reset:()=>{},onFeatureAdd:function(){this.tools.editLayer.addLayer(this.editLayer),this.feature.dragging&&this.options.draggable!=!1&&this.feature.dragging.enable()},hasMiddleMarkers:function(){return!this.options.skipMiddleMarkers&&!this.tools.options.skipMiddleMarkers},fireAndForward:function(d,_){_=_||{},_.layer=this.feature,this.feature.fire(d,_),this.tools.fireAndForward(d,_)},onEnable:function(){this.fireAndForward("editable:enable")},onDisable:function(){this.fireAndForward("editable:disable")},onEditing:function(){this.fireAndForward("editable:editing")},onEdited:function(){this.fireAndForward("editable:edited")},onStartDrawing:function(){this.fireAndForward("editable:drawing:start")},onEndDrawing:function(){this.fireAndForward("editable:drawing:end")},onCancelDrawing:function(){this.fireAndForward("editable:drawing:cancel")},onCommitDrawing:function(d){this.fireAndForward("editable:drawing:commit",d),this.onEdited()},onDrawingMouseDown:function(d){this.fireAndForward("editable:drawing:mousedown",d)},onDrawingMouseUp:function(d){this.fireAndForward("editable:drawing:mouseup",d)},startDrawing:function(){this._drawing||(this._drawing=n.Editable.FORWARD),this.tools.registerForDrawing(this),this.onStartDrawing()},commitDrawing:function(d){this.onCommitDrawing(d),this.endDrawing()},cancelDrawing:function(){n.Draggable._dragging=!1,this.onCancelDrawing(),this.endDrawing()},endDrawing:function(){this._drawing=!1,this.tools.unregisterForDrawing(this),this.onEndDrawing()},onDrawingClick:function(d){this.drawing()&&(n.Editable.makeCancellable(d),this.fireAndForward("editable:drawing:click",d),!d._cancelled&&(this.isConnected()||this.connect(d),this.processDrawingClick(d)))},isConnected:function(){return this.map.hasLayer(this.feature)},connect:function(){this.tools.connectCreatedToMap(this.feature),this.tools.editLayer.addLayer(this.editLayer)},onMove:function(d){this.fireAndForward("editable:drawing:move",d)},onDrawingMouseMove:function(d){this.onMove(d)},_getEvents:function(){return{dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd,remove:this.disable}},onDragStart:function(d){this.onEditing(),this.fireAndForward("editable:dragstart",d)},onDrag:function(d){this.onMove(d),this.fireAndForward("editable:drag",d)},onDragEnd:function(d){this.fireAndForward("editable:dragend",d),this.onEdited()}}),n.Editable.MarkerEditor=n.Editable.BaseEditor.extend({onDrawingMouseMove:function(d){n.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,d),this._drawing&&this.feature.setLatLng(d.latlng)},processDrawingClick:function(d){this.fireAndForward("editable:drawing:clicked",d),this.commitDrawing(d)},connect:function(d){d&&(this.feature._latlng=d.latlng),n.Editable.BaseEditor.prototype.connect.call(this,d)}}),n.Editable.CircleMarkerEditor=n.Editable.BaseEditor.extend({onDrawingMouseMove:function(d){n.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,d),this._drawing&&this.feature.setLatLng(d.latlng)},processDrawingClick:function(d){this.fireAndForward("editable:drawing:clicked",d),this.commitDrawing(d)},connect:function(d){d&&(this.feature._latlng=d.latlng),n.Editable.BaseEditor.prototype.connect.call(this,d)}}),n.Editable.PathEditor=n.Editable.BaseEditor.extend({CLOSED:!1,MIN_VERTEX:2,addHooks:function(){return n.Editable.BaseEditor.prototype.addHooks.call(this),this.feature&&(this.initVertexMarkers(),this.map.on("moveend",this.onMoveEnd,this)),this},removeHooks:function(){n.Editable.BaseEditor.prototype.removeHooks.call(this),this.feature&&this.map.off("moveend",this.onMoveEnd,this)},onMoveEnd:function(){this.initVertexMarkers()},initVertexMarkers:function(d){if(this.enabled())if(d=d||this.getLatLngs(),m(d))this.addVertexMarkers(d);else for(const _ of d)this.initVertexMarkers(_)},getLatLngs:function(){return this.feature.getLatLngs()},reset:function(){this.editLayer.clearLayers(),this.initVertexMarkers()},addVertexMarker:function(d,_){return d.__vertex?(d.__vertex.connect(),d.__vertex):new this.tools.options.vertexMarkerClass(d,_,this)},onNewVertex:function(d){this.fireAndForward("editable:vertex:new",{latlng:d.latlng,vertex:d})},addVertexMarkers:function(d){const _=this.map.getBounds();for(const b of d)_.contains(b)&&this.addVertexMarker(b,d)},refreshVertexMarkers:function(d){d=d||this.getDefaultLatLngs();for(const _ of d)_.__vertex.update()},addMiddleMarker:function(d,_,b){return new this.tools.options.middleMarkerClass(d,_,b,this)},onVertexMarkerClick:function(d){if(n.Editable.makeCancellable(d),this.fireAndForward("editable:vertex:click",d),d._cancelled||this.tools.drawing()&&this.tools._drawingEditor!==this)return;const _=d.vertex.getIndex();let b;d.originalEvent.ctrlKey?this.onVertexMarkerCtrlClick(d):d.originalEvent.altKey?this.onVertexMarkerAltClick(d):d.originalEvent.shiftKey?this.onVertexMarkerShiftClick(d):d.originalEvent.metaKey?this.onVertexMarkerMetaKeyClick(d):_===d.vertex.getLastIndex()&&this._drawing===n.Editable.FORWARD?_>=this.MIN_VERTEX-1&&(b=!0):_===0&&this._drawing===n.Editable.BACKWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX||_===0&&this._drawing===n.Editable.FORWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX&&this.CLOSED?b=!0:this.onVertexRawMarkerClick(d),this.fireAndForward("editable:vertex:clicked",d),b&&this.commitDrawing(d)},onVertexRawMarkerClick:function(d){this.fireAndForward("editable:vertex:rawclick",d),!d._cancelled&&this.vertexCanBeDeleted(d.vertex)&&d.vertex.delete()},vertexCanBeDeleted:function(d){return d.latlngs.length>this.MIN_VERTEX},onVertexDeleted:function(d){this.fireAndForward("editable:vertex:deleted",d),this.onEdited()},onVertexMarkerCtrlClick:function(d){this.fireAndForward("editable:vertex:ctrlclick",d)},onVertexMarkerShiftClick:function(d){this.fireAndForward("editable:vertex:shiftclick",d)},onVertexMarkerMetaKeyClick:function(d){this.fireAndForward("editable:vertex:metakeyclick",d)},onVertexMarkerAltClick:function(d){this.fireAndForward("editable:vertex:altclick",d)},onVertexMarkerContextMenu:function(d){this.fireAndForward("editable:vertex:contextmenu",d)},onVertexMarkerMouseDown:function(d){this.fireAndForward("editable:vertex:mousedown",d)},onVertexMarkerMouseOver:function(d){this.fireAndForward("editable:vertex:mouseover",d)},onVertexMarkerMouseOut:function(d){this.fireAndForward("editable:vertex:mouseout",d)},onMiddleMarkerMouseDown:function(d){this.fireAndForward("editable:middlemarker:mousedown",d)},onVertexMarkerDrag:function(d){this.onMove(d),this.feature._bounds&&this.extendBounds(d),this.fireAndForward("editable:vertex:drag",d)},onVertexMarkerDragStart:function(d){this.fireAndForward("editable:vertex:dragstart",d)},onVertexMarkerDragEnd:function(d){this.fireAndForward("editable:vertex:dragend",d),this.onEdited()},setDrawnLatLngs:function(d){this._drawnLatLngs=d||this.getDefaultLatLngs()},startDrawing:function(){this._drawnLatLngs||this.setDrawnLatLngs(),n.Editable.BaseEditor.prototype.startDrawing.call(this)},startDrawingForward:function(){this.startDrawing()},endDrawing:function(){this.tools.detachForwardLineGuide(),this.tools.detachBackwardLineGuide(),this._drawnLatLngs&&this._drawnLatLngs.length<this.MIN_VERTEX&&this.deleteShape(this._drawnLatLngs),n.Editable.BaseEditor.prototype.endDrawing.call(this),delete this._drawnLatLngs},addLatLng:function(d){this._drawing===n.Editable.FORWARD?this._drawnLatLngs.push(d):this._drawnLatLngs.unshift(d),this.feature._bounds.extend(d);const _=this.addVertexMarker(d,this._drawnLatLngs);this.onNewVertex(_),this.refresh()},newPointForward:function(d){this.addLatLng(d),this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(d)},newPointBackward:function(d){this.addLatLng(d),this.tools.anchorBackwardLineGuide(d)},push:function(d){if(!d)return console.error("L.Editable.PathEditor.push expect a valid latlng as parameter");this._drawing===n.Editable.FORWARD?this.newPointForward(d):this.newPointBackward(d)},removeLatLng:function(d){d.__vertex.delete(),this.refresh()},pop:function(){if(this._drawnLatLngs.length<=1)return;let d;return this._drawing===n.Editable.FORWARD?d=this._drawnLatLngs[this._drawnLatLngs.length-1]:d=this._drawnLatLngs[0],this.removeLatLng(d),this._drawing===n.Editable.FORWARD?this.tools.anchorForwardLineGuide(this._drawnLatLngs[this._drawnLatLngs.length-1]):this.tools.anchorForwardLineGuide(this._drawnLatLngs[0]),d},processDrawingClick:function(d){d.vertex&&d.vertex.editor===this||(this._drawing===n.Editable.FORWARD?this.newPointForward(d.latlng):this.newPointBackward(d.latlng),this.fireAndForward("editable:drawing:clicked",d))},onDrawingMouseMove:function(d){n.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,d),this._drawing&&(this.tools.moveForwardLineGuide(d.latlng),this.tools.moveBackwardLineGuide(d.latlng))},refresh:function(){this.feature.redraw(),this.onEditing()},newShape:function(d){const _=this.addNewEmptyShape();_&&(this.setDrawnLatLngs(_[0]||_),this.startDrawingForward(),this.fireAndForward("editable:shape:new",{shape:_}),d&&this.newPointForward(d))},deleteShape:function(d,_){const b={shape:d};if(n.Editable.makeCancellable(b),this.fireAndForward("editable:shape:delete",b),!b._cancelled)return d=this._deleteShape(d,_),this.ensureNotFlat&&this.ensureNotFlat(),this.feature.setLatLngs(this.getLatLngs()),this.refresh(),this.reset(),this.fireAndForward("editable:shape:deleted",{shape:d}),this.onEdited(),d},_deleteShape:function(d,_){if(_=_||this.getLatLngs(),!_.length)return;const b=(A,N)=>A.splice(0,Number.MAX_VALUE),I=(A,N)=>(A.splice(A.indexOf(N),1),A.length||this._deleteShape(A),N);if(_===d)return b(_);for(const A of _){if(A===d)return I(_,d);if(A.indexOf(d)!==-1)return I(A,d)}},deleteShapeAt:function(d){const _=this.feature.shapeAt(d);if(_)return this.deleteShape(_)},appendShape:function(d){this.insertShape(d)},prependShape:function(d){this.insertShape(d,0)},insertShape:function(d,_){this.ensureMulti(),d=this.formatShape(d),_===void 0&&(_=this.feature._latlngs.length),this.feature._latlngs.splice(_,0,d),this.feature.redraw(),this._enabled&&this.reset()},extendBounds:function(d){this.feature._bounds.extend(d.vertex.latlng)},onDragStart:function(d){this.editLayer.clearLayers(),n.Editable.BaseEditor.prototype.onDragStart.call(this,d)},onDragEnd:function(d){this.initVertexMarkers(),n.Editable.BaseEditor.prototype.onDragEnd.call(this,d)}}),n.Editable.PolylineEditor=n.Editable.PathEditor.extend({startDrawingBackward:function(){this._drawing=n.Editable.BACKWARD,this.startDrawing()},continueBackward:function(d){this.drawing()||(d=d||this.getDefaultLatLngs(),this.setDrawnLatLngs(d),d.length>0&&(this.tools.attachBackwardLineGuide(),this.tools.anchorBackwardLineGuide(d[0])),this.startDrawingBackward())},continueForward:function(d){this.drawing()||(d=d||this.getDefaultLatLngs(),this.setDrawnLatLngs(d),d.length>0&&(this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(d[d.length-1])),this.startDrawingForward())},getDefaultLatLngs:function(d){return d=d||this.feature._latlngs,!d.length||d[0]instanceof n.LatLng?d:this.getDefaultLatLngs(d[0])},ensureMulti:function(){this.feature._latlngs.length&&m(this.feature._latlngs)&&(this.feature._latlngs=[this.feature._latlngs])},addNewEmptyShape:function(){if(this.feature._latlngs.length){const d=[];return this.appendShape(d),d}return this.feature._latlngs},formatShape:function(d){if(m(d))return d;if(d[0])return this.formatShape(d[0])},splitShape:function(d,_){if(!_||_>=d.length-1)return;this.ensureMulti();const b=this.feature._latlngs.indexOf(d);if(b===-1)return;const I=d.slice(0,_+1),A=d.slice(_);A[0]=n.latLng(A[0].lat,A[0].lng,A[0].alt),this.feature._latlngs.splice(b,1,I,A),this.refresh(),this.reset(),this.onEdited()}}),n.Editable.PolygonEditor=n.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:3,newPointForward:function(d){n.Editable.PathEditor.prototype.newPointForward.call(this,d),this.tools.backwardLineGuide._latlngs.length||this.tools.anchorBackwardLineGuide(d),this._drawnLatLngs.length===2&&this.tools.attachBackwardLineGuide()},addNewEmptyHole:function(d){this.ensureNotFlat();const _=this.feature.shapeAt(d);if(!_)return;const b=[];return _.push(b),b},newHole:function(d){const _=this.addNewEmptyHole(d);_&&(this.setDrawnLatLngs(_),this.startDrawingForward(),d&&this.newPointForward(d))},addNewEmptyShape:function(){if(this.feature._latlngs.length&&this.feature._latlngs[0].length){const d=[];return this.appendShape(d),d}return this.feature._latlngs},ensureMulti:function(){this.feature._latlngs.length&&m(this.feature._latlngs[0])&&(this.feature._latlngs=[this.feature._latlngs])},ensureNotFlat:function(){(!this.feature._latlngs.length||m(this.feature._latlngs))&&(this.feature._latlngs=[this.feature._latlngs])},vertexCanBeDeleted:function(d){const _=this.feature.parentShape(d.latlngs);return n.Util.indexOf(_,d.latlngs)>0?!0:n.Editable.PathEditor.prototype.vertexCanBeDeleted.call(this,d)},getDefaultLatLngs:function(){return this.feature._latlngs.length||this.feature._latlngs.push([]),this.feature._latlngs[0]},formatShape:d=>m(d)&&(!d[0]||d[0].length!==0)?[d]:d}),n.Editable.RectangleEditor=n.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:4,options:{skipMiddleMarkers:!0},extendBounds:function(d){const _=d.vertex.getIndex(),b=d.vertex.getNext(),I=d.vertex.getPrevious(),A=(_+2)%4,N=d.vertex.latlngs[A],P=new n.LatLngBounds(d.latlng,N);I.latlng.update([d.latlng.lat,N.lng]),b.latlng.update([N.lat,d.latlng.lng]),this.updateBounds(P),this.refreshVertexMarkers()},onDrawingMouseDown:function(d){n.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,d),this.connect();const _=this.getDefaultLatLngs();_.length===3&&_.push(d.latlng);const b=new n.LatLngBounds(d.latlng,d.latlng);this.updateBounds(b),this.updateLatLngs(b),this.refresh(),this.reset(),d.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(d.originalEvent),_[3].__vertex.dragging._draggable._onDown(d.originalEvent)},onDrawingMouseUp:function(d){this.commitDrawing(d),d.originalEvent._simulated=!1,n.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,d)},onDrawingMouseMove:function(d){d.originalEvent._simulated=!1,n.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,d)},getDefaultLatLngs:function(d){return d||this.feature._latlngs[0]},updateBounds:function(d){this.feature._bounds=d},updateLatLngs:function(d){const _=this.getDefaultLatLngs(),b=this.feature._boundsToLatLngs(d);for(let I=0;I<_.length;I++)_[I].update(b[I])}}),n.Editable.CircleEditor=n.Editable.PathEditor.extend({MIN_VERTEX:2,options:{skipMiddleMarkers:!0},initialize:function(d,_,b){n.Editable.PathEditor.prototype.initialize.call(this,d,_,b),this._resizeLatLng=this.computeResizeLatLng()},computeResizeLatLng:function(){const d=(this.feature._radius||this.feature._mRadius)*Math.cos(Math.PI/4),_=this.map.project(this.feature._latlng);return this.map.unproject([_.x+d,_.y-d])},updateResizeLatLng:function(){this._resizeLatLng.update(this.computeResizeLatLng()),this._resizeLatLng.__vertex.update()},getLatLngs:function(){return[this.feature._latlng,this._resizeLatLng]},getDefaultLatLngs:function(){return this.getLatLngs()},onVertexMarkerDrag:function(d){d.vertex.getIndex()===1?this.resize(d):this.updateResizeLatLng(d),n.Editable.PathEditor.prototype.onVertexMarkerDrag.call(this,d)},resize:function(d){let _;this.map.options.crs?_=this.map.options.crs.distance(this.feature._latlng,d.latlng):_=this.feature._latlng.distanceTo(d.latlng),this.feature.setRadius(_)},onDrawingMouseDown:function(d){n.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,d),this._resizeLatLng.update(d.latlng),this.feature._latlng.update(d.latlng),this.connect(),d.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(d.originalEvent),this._resizeLatLng.__vertex.dragging._draggable._onDown(d.originalEvent)},onDrawingMouseUp:function(d){this.commitDrawing(d),d.originalEvent._simulated=!1,n.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,d)},onDrawingMouseMove:function(d){d.originalEvent._simulated=!1,n.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,d)},onDrag:function(d){n.Editable.PathEditor.prototype.onDrag.call(this,d),this.feature.dragging.updateLatLng(this._resizeLatLng)}});const r={createEditor:function(d){d=d||this._map;const _=this.options.editOptions?.editTools||d.editTools;if(!_)throw Error("Unable to detect Editable instance.");const b=this.options.editorClass||this.getEditorClass(_);return new b(d,this,this.options.editOptions)},enableEdit:function(d){return this.editor||this.createEditor(d),this.editor.enable(),this.editor},editEnabled:function(){return this.editor?.enabled()},disableEdit:function(){this.editor&&(this.editor.disable(),delete this.editor)},toggleEdit:function(){this.editEnabled()?this.disableEdit():this.enableEdit()},_onEditableAdd:function(){this.editor&&this.enableEdit()}},o={getEditorClass:d=>d?.options?.polylineEditorClass||n.Editable.PolylineEditor,shapeAt:function(d,_){let b=null;if(_=_||this._latlngs,!_.length)return b;if(m(_)&&this.isInLatLngs(d,_))b=_;else for(const I of _)if(this.isInLatLngs(d,I))return I;return b},isInLatLngs:function(d,_){if(!_)return!1;let b,I,A,N=[],P;const w=this._clickTolerance();if(this._projectLatlngs(_,N,this._pxBounds),N=N[0],P=this._map.latLngToLayerPoint(d),!this._pxBounds.contains(P))return!1;for(b=1,A=N.length,I=0;b<A;I=b++)if(n.LineUtil.pointToSegmentDistance(P,N[I],N[b])<=w)return!0;return!1}},a={getEditorClass:d=>d?.options?.polygonEditorClass||n.Editable.PolygonEditor,shapeAt:function(d,_){let b=null;if(_=_||this._latlngs,!_.length)return b;if(m(_)&&this.isInLatLngs(d,_)&&(b=_),m(_[0])&&this.isInLatLngs(d,_[0]))b=_;else for(const I of _)if(this.isInLatLngs(d,I[0]))return I;return b},isInLatLngs:(d,_)=>{let b=!1,I,A,N,P,w;for(N=0,w=_.length,P=w-1;N<w;P=N++)I=_[N],A=_[P],I.lat>d.lat!=A.lat>d.lat&&d.lng<(A.lng-I.lng)*(d.lat-I.lat)/(A.lat-I.lat)+I.lng&&(b=!b);return b},parentShape:function(d,_){if(_=_||this._latlngs,!_)return;let b=n.Util.indexOf(_,d);if(b!==-1)return _;for(const I of _)if(b=n.Util.indexOf(I,d),b!==-1)return I}},l={getEditorClass:d=>d?.options?.markerEditorClass||n.Editable.MarkerEditor},u={getEditorClass:d=>d?.options?.circleMarkerEditorClass||n.Editable.CircleMarkerEditor},f={getEditorClass:d=>d?.options?.rectangleEditorClass||n.Editable.RectangleEditor},h={getEditorClass:d=>d?.options?.circleEditorClass||n.Editable.CircleEditor},g=function(){this.on("add",this._onEditableAdd)},m=n.LineUtil.isFlat||n.LineUtil._flat||n.Polyline._flat;n.Polyline&&(n.Polyline.include(r),n.Polyline.include(o),n.Polyline.addInitHook(g)),n.Polygon&&(n.Polygon.include(r),n.Polygon.include(a)),n.Marker&&(n.Marker.include(r),n.Marker.include(l),n.Marker.addInitHook(g)),n.CircleMarker&&(n.CircleMarker.include(r),n.CircleMarker.include(u),n.CircleMarker.addInitHook(g)),n.Rectangle&&(n.Rectangle.include(r),n.Rectangle.include(f)),n.Circle&&(n.Circle.include(r),n.Circle.include(h)),n.LatLng.prototype.update=function(d){d=n.latLng(d),this.lat=d.lat,this.lng=d.lng}},window)})(yl)),yl.exports}D0();const M0=`/* required styles */\r
|
|
421
|
+
`}function ms(){return``}function hs(e){return`<`+e.value+`>`}var gs=/["\\\\\n\r]/,_s=/["\\\\\n\r]/g,vs={'"':`\\"`,"\\":`\\\\`,"\n":`\\n`,"\r":`\\r`};function ys(e){return vs[e]}function bs(e){return gs.test(e)?e.replace(_s,ys):e}function xs(e){let t=bs(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+`"^^`+hs(e.datatype)}function Ss(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 Cs(e){return`?`+e.value}function ws(e){if(!e)return null;if(e.termType===`BlankNode`)return fs(e);if(e.termType===`DefaultGraph`)return ms();if(e.termType===`Literal`)return xs(e);if(e.termType===`NamedNode`)return hs(e);if(e.termType===`Quad`||e.subject&&e.predicate&&e.object&&e.graph)return Ss(e,ws);if(e.termType===`Variable`)return Cs(e);if(e[Symbol.iterator])return ps(e,ws);throw Error(`unknown termType ${e.termType}`)}var Ts=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(ws(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(ws(e));return t&&t.value}has(e){return this.index.has(ws(e))}*keys(){for(let[,{term:e}]of this.index)yield e}set(e,t){let n=ws(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]()}},Es=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 Ds(e){try{return ws(e)}catch{return null}}var Os=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=ws(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(Ds(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(Ds(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}},ks=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};ks.prototype.termType=`BlankNode`;var As=class{equals(e){return!!e&&e.termType===this.termType}};As.prototype.termType=`DefaultGraph`,As.prototype.value=``;function js(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 Ms=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}};Ms.prototype.termType=`Literal`;var Ns=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Ns.prototype.termType=`NamedNode`;var Ps=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)}};Ps.prototype.termType=`Quad`,Ps.prototype.value=``;var Fs=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Fs.prototype.termType=`Variable`;var Is=new Ns(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),Ls=new Ns(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),Rs=new Ns(`http://www.w3.org/2001/XMLSchema#string`),zs=class{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new As}}namedNode(e){return new Ns(e)}blankNode(e){return e||=`b`+ ++this._data.blankNodeCounter,new ks(e)}literal(e,t){return typeof t==`string`?new Ms(e,t,Ls):typeof t?.language==`string`?new Ms(e,t.language,t.direction?Is:Ls,t.direction):new Ms(e,``,t||Rs)}variable(e){return new Fs(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,r=this.defaultGraph()){return new Ps(e,t,n,r)}fromTerm(e){return js(this,e)}fromQuad(e){return js(this,e)}};zs.exports=[`blankNode`,`defaultGraph`,`fromQuad`,`fromTerm`,`literal`,`namedNode`,`quad`,`variable`];var Bs=new zs,Vs={apply:(e,t,n)=>e(n[0]),get:(e,t)=>e(t)};function Hs(e,{factory:t=Bs}={}){let n=(n=``)=>t.namedNode(`${e}${n.raw||n}`);return typeof Proxy>`u`?n:new Proxy(n,Vs)}Hs(`http://www.w3.org/2001/XMLSchema#`);var Us=Hs(`http://www.w3.org/1999/02/22-rdf-syntax-ns#`);Hs(`http://www.w3.org/2000/01/rdf-schema#`);var Ws=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 Es({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]||Us.nil,t));for(let i=0;i<r.length;i++)e.dataset.add(e.factory.quad(r[i],Us.first,n[i],t)),e.dataset.add(e.factory.quad(r[i],Us.rest,r[i+1]||Us.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);!Us.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()?!1:!!(Us.nil.equals(t.term)||e.traverse({ptr:t,predicates:[Us.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(Us.nil);){let t=e.out([Us.first]);if(t.length!==1)throw Error(`Invalid list: rdf:first count not equals one on ${e.value}`);let n=e.out([Us.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 Os(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 Es({dataset:e.dataset,end:n,quad:r,start:t}),e))}return c}};function Gs(e,t){return t?n=>t(e.extend(n)):()=>{}}var Ks=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 Ws.add({ptr:this,start:`object`,end:`subject`,subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:Gs(this,n)})}addList(e,t){return Ws.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Ws.add({ptr:this,start:`subject`,end:`object`,predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:Gs(this,n)})}deleteIn(e,t){return Ws.delete({ptr:this,start:`object`,subjects:t,predicates:e})}deleteList(e){return Ws.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Ws.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 Ws.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 Ws.traverse({ptr:this,start:`object`,end:`object`,subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Ws.traverse({ptr:this,start:`subject`,end:`subject`,predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Ws.traverse({ptr:this,start:`object`,end:`subject`,subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Ws.isList({ptr:this})}list(){return Ws.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 Ws.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 qs(e,t){return e?e.equals(t):e===t}function Js(e,t){return!(e.dataset!==t.dataset||!qs(e.graph,t.graph)||!qs(e.term,t.term))}function Ys(e,t){return t?n=>t(new e.constructor({factory:e.factory,ptrs:[n]})):()=>{}}var Xs=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 Ks({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 Os(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=Ys(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=Ys(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=>Js(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():!1}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 Ks({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]})}};Hs(`http://www.w3.org/2002/07/owl#`);var Zs=Hs(`http://www.w3.org/1999/02/22-rdf-syntax-ns#`),Qs=Hs(`http://www.w3.org/2000/01/rdf-schema#`),Q=Hs(`http://www.w3.org/ns/shacl#`),$s=Hs(`https://schemas.link/shacl-next#`),ec=Hs(`http://www.w3.org/2001/XMLSchema#`);function tc(e){return e?`{${[...e.quads()].map(e=>ws(e)).join(` `)}}`:`{}`}function nc(e){return e?`{${e.map(e=>tc(e)).join(` `)}}`:`{}`}var rc=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),ic=o(((e,t)=>{var n=rc(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),ac=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),oc=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),sc=o(((e,t)=>{var n=oc(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),cc=o(((e,t)=>{t.exports=sc().Symbol})),lc=o(((e,t)=>{var n=cc(),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})),uc=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),dc=o(((e,t)=>{var n=cc(),r=lc(),i=uc(),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})),fc=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),pc=o(((e,t)=>{var n=dc(),r=fc(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),mc=o(((e,t)=>{var n=ic(),r=ac(),i=pc(),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})),hc=o(((e,t)=>{var n=mc(),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})),gc=o(((e,t)=>{var n=hc();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),_c=o(((e,t)=>{var n=gc(),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})),vc=l(o(((e,t)=>{var n=_c();function r(e){return n(2,e)}t.exports=r}))(),1),yc=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,vc.default)(()=>!this.results.some(e=>e.severity.equals(Q.Info)||e.severity.equals(Q.Violation)||e.severity.equals(Q.Warning))),this._ptr=(0,vc.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 Xs({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Zs.type],[Q.ValidationReport]).addOut([Q.conforms],[this.factory.literal(this.conforms.toString(),ec.boolean)]);for(let t of this.results)e.addOut([Q.result],[this.factory.blankNode()],e=>{t.build(e,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function bc(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&n.termType&&(n=ws(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n)),e)}var xc=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,vc.default)(()=>(this.shape.message.length>0&&(i=this.shape.message),i.length===0&&(i=this.shape.ptr.node([this.constraintComponent]).out([Q.message]).terms),i.map(t=>n.literal(bc(t.value,e,n),t.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Zs.type],[Q.ValidationResult]).addOut([Q.focusNode],this.focusNode.terms).addOut([Q.resultSeverity],[this.severity]).addOut([Q.sourceConstraint],this.source).addOut([Q.sourceConstraintComponent],[this.constraintComponent]).addOut([Q.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([Q.resultMessage],this.message);let n=t=>{if(t.quantifier===`one`)return t.predicates.length>1?e.node([this.factory.blankNode()]).addList([Q.alternativePath],t.predicates):t.start===`object`?e.node([this.factory.blankNode()]).addOut([Q.inversePath],[t.predicates[0]]):e.node([t.predicates[0]]);if(t.quantifier===`oneOrMore`)return e.node([this.factory.blankNode()]).addOut([Q.oneOrMorePath],[t.predicates[0]]);if(t.quantifier===`zeroOrMore`)return e.node([this.factory.blankNode()]).addOut([Q.zeroOrMorePath],[t.predicates[0]]);if(t.quantifier===`zeroOrOne`)return e.node([this.factory.blankNode()]).addOut([Q.zeroOrOnePath],[t.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([Q.resultPath],n(this.path[0]).terms):e.addList([Q.resultPath],this.path.map(e=>n(e).term))),this.value!==void 0&&e.addOut([Q.value],this.value.terms),t)for(let n of this.results)e.addOut([Q.detail],[this.factory.blankNode()],e=>{n.build(e,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}},Sc=class e{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:r=new Set,report:i=new yc({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 yc({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`${ws(e.ptr.term)} - ${ws(this.focusNode.term)} - ${nc(this.valuePaths)}`}result(e){let t=new xc({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:$s.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:$s.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||Q.Violation,...t})}};function Cc(){return{generic:wc()}}function wc(){return e=>{e.trace($s.TraversalConstraintComponent,{args:{},message:[e.factory.literal(`Traversal`)],value:e.valueOrNode})}}var Tc=class{constructor(e){this.validations=new Ts(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(Q.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&r.add(Cc),[...r].map(t=>t(e)).filter(Boolean)}},Ec=o((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)}}})),Dc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerBoolean=void 0;var t=Ec(),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`})),Oc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerDate=void 0;var t=Ec(),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]$/}})),kc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerNumberDouble=void 0;var t=Ec(),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`]})),Ac=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerNumberInteger=void 0;var t=Ec(),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})),jc=o((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`]})),Mc=o((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(Dc(),e),n(Oc(),e),n(kc(),e),n(Ac(),e),n(jc(),e)})),Nc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),Pc=o((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=c,e.toRdf=l,e.getTermRaw=u,e.getSupportedRdfDatatypes=d,e.getSupportedJavaScriptPrimitives=f;var r=J(),i=Mc(),a=Ec();n(Mc(),e),n(Nc(),e),n(Ec(),e);var o=new r.DataFactory,s=new a.Translator;s.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(e=>o.namedNode(e)),[`string`]),s.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(e=>o.namedNode(e)),[`boolean`]),s.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(e=>o.namedNode(e)),[`number`]),s.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(e=>o.namedNode(e)),[`number`]),s.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(e=>o.namedNode(e)),[`object`]);function c(e,t){return s.fromRdf(e,t)}function l(e,t){return t&&`namedNode`in t&&(t={dataFactory:t}),t||={},t&&!t.dataFactory&&(t.dataFactory=o),s.toRdf(e,t)}function u(e,t){return e.termType===`Literal`?c(e,t):e.value}function d(){return s.getSupportedRdfDatatypes()}function f(){return s.getSupportedJavaScriptPrimitives()}}))();function Fc(e){if(e.term.termType!==`BlankNode`)return{quantifier:`one`,start:`subject`,end:`object`,predicates:[e.term]};let t=e.out([Q.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([Q.inversePath]);if(n.term)return{quantifier:`one`,start:`object`,end:`subject`,predicates:[n.term]};let r=e.out([Q.oneOrMorePath]);if(r.term)return{quantifier:`oneOrMore`,start:`subject`,end:`object`,predicates:[r.term]};let i=e.out([Q.zeroOrMorePath]);if(i.term)return{quantifier:`zeroOrMore`,start:`subject`,end:`object`,predicates:[i.term]};let a=e.out([Q.zeroOrOnePath]);if(a.term)return{quantifier:`zeroOrOne`,start:`subject`,end:`object`,predicates:[a.term]}}function Ic(e){return e.terms.length===0?null:e.ptrs[0].isList()?[...e.list()].map(e=>Fc(e)):[Fc(e)]}var Lc=class{constructor(e){this.shape=e,this._compiled=(0,vc.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 Os(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 Ts).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 Rc(e){let t=new Os,n=new Xs({dataset:e.dataset,terms:e.terms}).execute({quantifier:`zeroOrMore`,start:`object`,end:`subject`,predicates:[Qs.subClassOf]});for(let e of n.ptrs)for(let{term:n}of e.nodes())t.add(n);return t}var zc=class{constructor(e,{registry:t}){this.registry=t,this.targetClass=new Os([...Rc(e.hasOut([Zs.type],[Q.NodeShape])),...Rc(e.out([Q.targetClass]))]),this.targetNode=e.out([Q.targetNode]).terms,this.targetObjectsOf=e.out([Q.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([Q.targetSubjectsOf]).terms,this.targets=[...e.out([Q.target])]}async resolve(e){let t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([Zs.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 Os(r.terms)])}},Bc=class{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=(0,vc.default)(()=>{let e=this.ptr.out([Q.deactivated]).term;return e&&(0,Pc.fromRdf)(e)}),this._message=(0,vc.default)(()=>this.ptr.out([Q.message]).terms),this._path=(0,vc.default)(()=>Ic(this.ptr.out([Q.path]))),this._severity=(0,vc.default)(()=>this.ptr.out([Q.severity]).term),this._shapeValidator=(0,vc.default)(()=>new Lc(this)),this._sparql=(0,vc.default)(()=>this.ptr.out([Q.sparql])),this._targetResolver=(0,vc.default)(()=>new zc(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)}},Vc=class{constructor(e){this.targetResolvers=new Ts(e)}};function Hc(e){return{property:Uc(parseInt(e.ptr.out([Q.maxCount]).value))}}function Uc(e){return t=>{t.test(t.values.terms.length<=e,Q.MaxCountConstraintComponent,{args:{maxCount:e},message:[t.factory.literal(`More than {$maxCount} values`)]})}}function Wc(e){return{property:Gc(parseInt(e.ptr.out([Q.minCount]).value))}}function Gc(e){return t=>{t.test(t.values.terms.length>=e,Q.MinCountConstraintComponent,{args:{minCount:e},message:[t.factory.literal(`Less than {$minCount} values`)]})}}async function Kc(e,t){for(let n of e)if(!await t(n))return!1;return!0}async function qc(e,t){return(await Promise.all(e.map(e=>t(e)))).filter(Boolean)}async function Jc(e,t){return Promise.all(e.map(t))}async function Yc(e,t){for(let n of e)if(await t(n))return!0;return!1}function Xc(e){return{generic:Zc([...e.ptr.out([Q.and])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function Zc(e){return async t=>{let n=await Jc(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report),r=n.every(e=>e.conforms);t.test(r,Q.AndConstraintComponent,{results:n.flatMap(e=>e.results),value:t.valueOrNode})}}function Qc(e){return{generic:$c(e.validator.shape(e.ptr.out([Q.not])))}}function $c(e){return async t=>{let n=(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report,r=!n.conforms;t.test(r,Q.NotConstraintComponent,{args:{not:e.ptr.term},message:[t.factory.literal(`Value does have shape {$not}`)],results:n.results,value:t.valueOrNode})}}function el(e){return{generic:tl([...e.ptr.out([Q.or])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function tl(e){return async t=>{let n=[],r;if(t.options.debug||t.options.details){let i=await Jc(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 Yc(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report.conforms);t.test(r,Q.OrConstraintComponent,{results:n,value:t.valueOrNode})}}function nl(e){return{generic:rl([...e.ptr.out([Q.xone])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function rl(e){return async t=>{let n=await Jc(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,Q.XoneConstraintComponent,{results:n.flatMap(e=>e.results),value:t.valueOrNode})}}function il(e){return(0,Pc.fromRdf)(e.ptr.out([Q.closed]).term)?{node:al(new Os(e.ptr.out([Q.property]).map(t=>e.validator.shape(t)).filter(e=>!e.deactivated).map(e=>e.path[0].predicates[0])),new Os([...e.ptr.out([Q.ignoredProperties]).list()||[]].map(e=>e.term)))}:null}function al(e,t){return n=>{let r=n.focusNode.execute({start:`subject`,end:`predicate`}).filter(n=>t.has(n.term)?!1:!e.has(n.term));if(r.ptrs.length>0)for(let e of r)n.violation(Q.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(Q.ClosedConstraintComponent)}}function ol(e){let t=e.ptr.out([Q.hasValue]).term;return{node:sl(t),property:cl(t)}}function sl(e){return t=>{t.test(e.equals(t.valueOrNode.term),Q.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal(`Value must be {$hasValue}`)]})}}function cl(e){return t=>{let n=[...t.values].some(t=>e.equals(t.term));t.test(n,Q.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal(`Missing expected value {$hasValue}`)]})}}function ll(e){return{generic:ul(new Os([...e.ptr.out([Q.in]).list()].map(e=>e.term)))}}function ul(e){return t=>{t.test(e.has(t.valueOrNode.term),Q.InConstraintComponent,{args:{in:[...e].map(e=>e.value).join(`, `)},message:[t.factory.literal(`Value is not in {$in}`)],value:t.valueOrNode})}}function dl(e,t){if(!e||e.termType!==`Literal`||!t||t.termType!==`Literal`||fl(e)!==fl(t))return null;let n=(0,Pc.fromRdf)(e),r=(0,Pc.fromRdf)(t);return typeof n==typeof r?typeof n==`string`?n.localeCompare(r):n-r:null}function fl(e){return ec.dateTime.equals(e.datatype)&&/^.*(((\+|-)\d{2}:\d{2})|Z)$/.test(e.value)}function pl(e){let t=e.ptr.out([Q.disjoint]).term;return{generic:ml(t)}}function ml(e){return t=>{let n=t.focusNode.dataset.match(t.focusNode.term,e,t.valueOrNode.term);t.test(n.size===0,Q.DisjointConstraintComponent,{args:{disjoint:e},message:[t.factory.literal(`Value node must not also be one of the values of {$disjoint}`)],value:t.valueOrNode})}}function hl(e){let t=e.ptr.out([Q.equals]).term;return{node:gl(t),property:_l(t)}}function gl(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,Q.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 _l(e){return t=>{let n=new Os(t.focusNode.out([e]).terms),r=new Os(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(Q.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)],value:t.focusNode.node([n])});o.length===0&&t.debug(Q.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)]})}}function vl(e){let t=e.ptr.out([Q.lessThan]).term;return{property:yl(t)}}function yl(e){return t=>{let n=t.focusNode.out([e]).terms;for(let r of t.values)for(let i of n){let n=dl(r.term,i);n===null||n>=0?t.violation(Q.LessThanConstraintComponent,{args:{lessThan:e},message:[t.factory.literal(`Value is not less than value of {$lessThan}`)],value:r}):t.debug(Q.LessThanConstraintComponent,{args:{lessThan:e},message:[t.factory.literal(`Value is not less than value of {$lessThan}`)],value:r})}}}function bl(e){let t=e.ptr.out([Q.lessThanOrEquals]).term;return{property:xl(t)}}function xl(e){return t=>{let n=t.focusNode.out([e]).terms;for(let r of t.values)for(let i of n){let n=dl(r.term,i);n===null||n>0?t.violation(Q.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:e},message:[t.factory.literal(`Value is not less than or equal to value of {$lessThanOrEquals}`)],value:r}):t.debug(Q.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:e},message:[t.factory.literal(`Value is not less than or equal to value of {$lessThanOrEquals}`)],value:r})}}}function Sl(e){let t=e.ptr.out([Q.maxExclusive]).term;return{generic:Cl(t)}}function Cl(e){return t=>{let n=dl(t.valueOrNode.term,e);t.test(n!==null&&n<0,Q.MaxExclusiveConstraintComponent,{args:{maxExclusive:e},message:[t.factory.literal(`Value is not less than {$maxExclusive}`)],value:t.valueOrNode})}}function wl(e){let t=e.ptr.out([Q.maxInclusive]).term;return{generic:Tl(t)}}function Tl(e){return t=>{let n=dl(t.valueOrNode.term,e);t.test(n!==null&&n<=0,Q.MaxInclusiveConstraintComponent,{args:{maxInclusive:e},message:[t.factory.literal(`Value is not less than or equal to {$maxInclusive}`)],value:t.valueOrNode})}}function El(e){let t=e.ptr.out([Q.minExclusive]).term;return{generic:Dl(t)}}function Dl(e){return t=>{let n=dl(t.valueOrNode.term,e);t.test(n!==null&&n>0,Q.MinExclusiveConstraintComponent,{args:{minExclusive:e},message:[t.factory.literal(`Value is not greater than {$minExclusive}`)],value:t.valueOrNode})}}function Ol(e){let t=e.ptr.out([Q.minInclusive]).term;return{generic:kl(t)}}function kl(e){return t=>{let n=dl(t.valueOrNode.term,e);t.test(n!==null&&n>=0,Q.MinInclusiveConstraintComponent,{args:{minInclusive:e},message:[t.factory.literal(`Value is not greater than or equal to {$minInclusive}`)],value:t.valueOrNode})}}function Al(e){return{generic:jl([...e.ptr.out([Q.node])].map(t=>e.validator.shape(t)))}}function jl(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,Q.NodeConstraintComponent,{args:{node:n.ptr.term},message:[t.factory.literal(`Value does not have shape {$node}`)],results:e.report.results,value:t.valueOrNode})}}}function Ml(e){return{generic:Nl([...e.ptr.out([Q.property])].map(t=>e.validator.shape(t)))}}function Nl(e){return async t=>{let n=t.create({focusNode:t.valueOrNode});for(let t of e)await t.validate(n)}}function Pl(e){let t=e.validator.shape(e.ptr.out([Q.qualifiedValueShape])),n=e.ptr.out([Q.qualifiedValueShapesDisjoint]).term,r=n?(0,Pc.fromRdf)(n):!1,i=e.ptr.out([Q.qualifiedMaxCount]).term,a=i?parseInt(i.value):null,o=e.ptr.out([Q.qualifiedMinCount]).term;return{property:Fl(t,r,a,o?parseInt(o.value):null)}}function Fl(e,t,n,r){return async i=>{let a=[],o=[];t&&(o=new Set(i.shape.ptr.in([Q.property]).out([Q.property]).out([Q.qualifiedValueShape]).filter(t=>!t.term.equals(e.ptr.term)).map(e=>i.shape.validator.shape(e))));let s=(await qc(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 Jc([...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 Kc([...o],async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report.conforms)})).length;n!==null&&i.test(s<=n,Q.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,Q.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 Il(e,t){return t?t.slice(0,e.length)===e:!1}function Ll(e){return{generic:Rl([...new Set([...e.ptr.out([Q.languageIn]).list()].map(e=>e.value))])}}function Rl(e){return t=>{let n=e.some(e=>Il(e,t.valueOrNode.term.language));t.test(n,Q.LanguageInConstraintComponent,{args:{languageIn:e.join(`, `)},message:[t.factory.literal(`Language does not match any of {$languageIn}`)],value:t.valueOrNode})}}function zl(e){return{generic:Bl(parseInt(e.ptr.out([Q.maxLength]).value))}}function Bl(e){return t=>{let n=t.valueOrNode.term.termType!==`BlankNode`&&t.valueOrNode.value.length<=e;t.test(n,Q.MaxLengthConstraintComponent,{args:{maxLength:e},message:[t.factory.literal(`Value has more than {$maxLength} characters`)],value:t.valueOrNode})}}function Vl(e){return{generic:Hl(parseInt(e.ptr.out([Q.minLength]).value))}}function Hl(e){return t=>{let n=t.valueOrNode.term.termType!==`BlankNode`&&t.valueOrNode.value.length>=e;t.test(n,Q.MinLengthConstraintComponent,{args:{minLength:e},message:[t.factory.literal(`Value has less than {$minLength} characters`)],value:t.valueOrNode})}}function Ul(e){let t=e.ptr.out([Q.pattern]).value,n=e.ptr.out([Q.flags]).value;return{generic:Wl(t,n,new RegExp(t,n))}}function Wl(e,t,n){return r=>{r.test(n.test(r.valueOrNode.term.value),Q.PatternConstraintComponent,{args:{flags:t,pattern:e},message:[r.factory.literal(`Value does not match pattern "{$pattern}"`)],value:r.valueOrNode})}}function Gl(e){let t=e.ptr.out([Q.uniqueLang]).term;return t.value===`true`&&ec.boolean.equals(t.datatype)?{property:Kl()}:null}function Kl(){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(Q.UniqueLangConstraintComponent,{args:{lang:n},message:[e.factory.literal(`Language "{?lang}" used more than once`)]});t.length===0&&e.debug(Q.UniqueLangConstraintComponent)}}var ql=Hs(`http://www.w3.org/ns/shacl#`),Jl=Hs(`https://schemas.link/shacl-next#`),Yl=class{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(ql.Info)||e.severity.equals(ql.Violation)||e.severity.equals(ql.Warning))}};function Xl(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&n.termType&&(n=ws(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n)),e)}var Zl=class{constructor({args:e={},factory:t,message:n=[],severity:r=ql.Violation}={}){this.severity=r,this.message=n.map(n=>t.literal(Xl(n.value,e),n.language||null))}},Ql=class e{constructor({factory:e=Bs}={}){this.factory=e}clone({factory:t}={}){return new e({factory:t||this.factory})}validate(){return new Yl}validateSimple(){return!0}},$l=class e extends Ql{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})}},eu=class{constructor({factory:e=Bs,validations:t}={}){if(this.factory=e,this.validations=new Ts,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 Yl}validateSimple(e){let t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}},tu=class e extends $l{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 Yl({results:this.patterns.map(t=>{let n;return t.test(e.value)&&(n=Jl.Debug),new Zl({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))}},nu=/^([-+]?[0-9]+)$/,ru=class e extends tu{constructor(e=null,t=null,n,{factory:r}={}){super(nu,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(!Jl.Debug.equals(t[0].severity))return new Yl({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 Zl({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 Zl({factory:this.factory,message:r}))}return new Yl({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)}},iu=class e extends $l{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 Zl({factory:this.factory,message:r}))}return new Yl({results:t})}validateSimple(e){return this.values.has(e.value)}},au=s({anyAtomicType:()=>su,anySimpleType:()=>ou,anyURI:()=>Ru,base64Binary:()=>Lu,boolean:()=>Cu,byte:()=>ed,date:()=>Au,dateTime:()=>Ou,dateTimeStamp:()=>ld,dayTimeDuration:()=>cd,decimal:()=>wu,double:()=>Eu,duration:()=>Du,float:()=>Tu,gDay:()=>Pu,gMonth:()=>Fu,gMonthDay:()=>Nu,gYear:()=>Mu,gYearMonth:()=>ju,hexBinary:()=>Iu,int:()=>Qu,integer:()=>Ju,language:()=>qu,long:()=>Zu,negativeInteger:()=>Xu,nonNegativeInteger:()=>td,nonPositiveInteger:()=>Yu,normalizedString:()=>Gu,positiveInteger:()=>od,short:()=>$u,string:()=>Su,time:()=>ku,token:()=>Ku,unsignedByte:()=>ad,unsignedInt:()=>rd,unsignedLong:()=>nd,unsignedShort:()=>id,yearMonthDuration:()=>sd}),$={xsd:Hs(`http://www.w3.org/2001/XMLSchema#`)},ou=new $l({datatypes:$.xsd.anySimpleType}),su=new $l({datatypes:$.xsd.anyAtomicType}),cu=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,lu=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,uu=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,du=/^(-?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)))))$/,fu=/^(-?([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))?)$/,pu=/^((([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))?)$/,mu=/^(-?([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))?)$/,hu=/^(-?([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))?)$/,gu=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,_u=/^(--(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))?)$/,vu=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,yu=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,bu=/^(([0-9a-fA-F]{2})*)$/,xu=/^(((([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] ?= ?=))?)$/,Su=new tu(cu,$.xsd.string),Cu=new iu([`1`,`true`,`0`,`false`],$.xsd.boolean),wu=new tu(lu,$.xsd.decimal),Tu=new tu(uu,$.xsd.float),Eu=new tu(uu,$.xsd.double),Du=new tu(du,$.xsd.duration),Ou=new tu(fu,$.xsd.dateTime),ku=new tu(pu,$.xsd.time),Au=new tu(mu,$.xsd.date),ju=new tu(hu,$.xsd.gYearMonth),Mu=new tu(gu,$.xsd.gYear),Nu=new tu(_u,$.xsd.gMonthDay),Pu=new tu(vu,$.xsd.gDay),Fu=new tu(yu,$.xsd.gMonth),Iu=new tu(bu,$.xsd.hexBinary),Lu=new tu(xu,$.xsd.base64Binary),Ru=new tu(cu,$.xsd.anyURI),zu=/^([^\u000d\u000a\u0009]*)$/,Bu=/^([^ ]+( [^ ]+)*)*$/,Vu=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Hu=/^([^DT]*)$/,Uu=/^([^YM]*[DT].*)$/,Wu=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Gu=new tu([cu,zu],$.xsd.normalizedString),Ku=new tu([cu,zu,Bu],$.xsd.token),qu=new tu(Vu,$.xsd.language),Ju=new ru(null,null,$.xsd.integer),Yu=new ru(null,`0`,$.xsd.nonPositiveInteger),Xu=new ru(null,`-1`,$.xsd.negativeInteger),Zu=new ru(`-9223372036854775808`,`9223372036854775807`,$.xsd.long),Qu=new ru(`-2147483648`,`2147483647`,$.xsd.int),$u=new ru(`-32768`,`32767`,$.xsd.short),ed=new ru(`-128`,`127`,$.xsd.byte),td=new ru(`0`,null,$.xsd.nonNegativeInteger),nd=new ru(`0`,`18446744073709551615`,$.xsd.unsignedLong),rd=new ru(`0`,`4294967295`,$.xsd.unsignedInt),id=new ru(`0`,`65535`,$.xsd.unsignedShort),ad=new ru(`0`,`255`,$.xsd.unsignedByte),od=new ru(`1`,null,$.xsd.positiveInteger),sd=new tu([du,Hu],$.xsd.yearMonthDuration),cd=new tu([du,Uu],$.xsd.dayTimeDuration),ld=new tu([fu,Wu],$.xsd.dateTimeStamp),ud=class extends eu{constructor({factory:e}={}){super({factory:e,validations:{...au}})}},dd=new Ts([[Q.BlankNode,new Set([`BlankNode`])],[Q.BlankNodeOrIRI,new Set([`BlankNode`,`NamedNode`])],[Q.BlankNodeOrLiteral,new Set([`BlankNode`,`Literal`])],[Q.IRI,new Set([`NamedNode`])],[Q.IRIOrLiteral,new Set([`NamedNode`,`Literal`])],[Q.Literal,new Set([`Literal`])]]);function fd(e){return{generic:pd(e.ptr.out([Q.class]).map(e=>Rc(e)))}}function pd(e){return t=>{let n=new Os(t.valueOrNode.out([Zs.type]).terms);for(let r of e){let e=[...n].some(e=>r.has(e));t.test(e,Q.ClassConstraintComponent,{value:t.valueOrNode})}}}function md(e){let t=e.ptr.out([Q.datatype]).term;return{generic:hd(t,new ud)}}function hd(e,t){return n=>{let r=e.equals(n.valueOrNode.term.datatype)&&t.validateSimple(n.valueOrNode.term);n.test(r,Q.DatatypeConstraintComponent,{args:{datatype:e},message:[n.factory.literal(`Value does not have datatype {$datatype}`)],value:n.valueOrNode})}}function gd(e){let t=e.ptr.out([Q.nodeKind]).term;return{generic:_d(t,dd.get(t))}}function _d(e,t){return n=>{n.test(t.has(n.valueOrNode.term.termType),Q.NodeKindConstraintComponent,{args:{nodeKind:e},message:[n.factory.literal(`Value does not have node kind {$nodeKind}`)],value:n.valueOrNode})}}var vd=new Ts([[Q.maxCount,Hc],[Q.minCount,Wc],[Q.and,Xc],[Q.not,Qc],[Q.or,el],[Q.xone,nl],[Q.closed,il],[Q.hasValue,ol],[Q.in,ll],[Q.disjoint,pl],[Q.equals,hl],[Q.lessThan,vl],[Q.lessThanOrEquals,bl],[Q.maxExclusive,Sl],[Q.maxInclusive,wl],[Q.minExclusive,El],[Q.minInclusive,Ol],[Q.node,Al],[Q.property,Ml],[Q.qualifiedValueShape,Pl],[Q.languageIn,Ll],[Q.maxLength,zl],[Q.minLength,Vl],[Q.pattern,Ul],[Q.uniqueLang,Gl],[Q.class,fd],[Q.datatype,md],[Q.nodeKind,gd]]),yd=class{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Tc(vd),this.targetResolverRegistry=new Vc(this.options.targetResolvers||[]),this.shapesPtr=new Xs({dataset:e,factory:t}),this.shapes=new Ts,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([Q.targetClass]),...this.shapesPtr.hasOut([Q.targetNode]),...this.shapesPtr.hasOut([Q.targetObjectsOf]),...this.shapesPtr.hasOut([Q.targetSubjectsOf]),...this.shapesPtr.hasOut([Q.target]),...this.shapesPtr.hasOut([Zs.type],[Q.NodeShape]),...this.shapesPtr.hasOut([Zs.type],[Q.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 Bc(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){let n=new Xs({...e,factory:this.factory}),r=new Sc({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}},bd={[`${W}node`]:(e,t)=>{e.extendedShapes.add(new xd(t,e.config,e))},[`${W}and`]:(e,t)=>{for(let n of e.config.lists[t.value])e.extendedShapes.add(new xd(n,e.config,e))},[`${W}property`]:(e,t)=>{let n=e.config.getPropertyTemplate(t,e);if(n.path){let t=e.properties[n.path];if(t||(t=[],e.properties[n.path]=t),n.qualifiedValueShape)t.push(n);else{let r;for(let t=0;t<e.properties[n.path].length&&!r;t++)e.properties[n.path][t].qualifiedValueShape||(r=e.properties[n.path][t]);r?mr(r,n):t.push(n)}}},[`${W}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${W}targetClass`]:(e,t)=>{e.targetClass=t},[`${W}or`]:(e,t)=>{e.or=e.config.lists[t.value]},[`${W}xone`]:(e,t)=>{e.xone=e.config.lists[t.value]},[Ct.id]:(e,t)=>{e.owlImports.add(t)},[`${_t}title`]:(e,t)=>{let n=t;e.label=q(e.config.languages,e.label,n)},[`${mt}label`]:(e,t)=>{let n=t;e.label=q(e.config.languages,e.label,n)}},xd=class{constructor(e,t,n){this.extendedShapes=new Set,this.properties={},this.owlImports=new Set,this.id=e,this.config=t,this.parent=n,t.registerNodeTemplate(this),Sd(this,this.config.store.getQuads(e,null,null,null))}};function Sd(e,t){for(let n of t)bd[n.predicate.id]?.call(e,e,n.object);return e}function Cd(e){for(let t of Object.values(e.properties))for(let n of t){let[t,r]=wd(e,n.path);if(t.length>1&&r){let e=t[t.length-1];for(let n=t.length-2;n>=0;n--){let r=t[n];delete r.parent.properties[r.path],mr(e,r)}}}}function wd(e,t,n=new Set,r=[],i=!1){if(!n.has(e.id.value)){n.add(e.id.value);let a=e.properties[t];if(a?.length===1){r.push(a[0]),i||=a[0].maxCount===1;for(let e of a[0].nodeShapes){let[a,o]=wd(e,t,n,r,i);i||=o}}for(let a of e.extendedShapes){let[e,o]=wd(a,t,n,r,i);i||=o}}return[r,i]}var Td=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.view=null,this.language=null,this.loading=`Loading…`,this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.hierarchyColors=null,this.submitButton=null,this.generateNodeShapeReference=K.value,this.showNodeIds=null,this.showRootShapeLabel=null,this.dense=`true`,this.useShadowRoot=`true`}},Ed=`#4c93d785, #f85e9a85, #00327385, #87001f85`,Dd=class{constructor(e){this.attributes=new Td,this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new st,this._nodeTemplates={},this._propertyTemplates={},this.validator=new yd(this._store,{details:!0,factory:k}),this.providedConformingResourceIds={},this.providedResources={},this.form=e,this._theme=new ds,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._nodeTemplates={},this._propertyTemplates={}}updateAttributes(e){let t=new Td;if(Object.keys(t).forEach(n=>{let r=e.dataset[n];r!==void 0&&(t[n]=r)}),this.editMode=t.view===null,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=k.namedNode(t.valuesGraph)),t.hierarchyColors!=null){let e=t.hierarchyColors.length?t.hierarchyColors:Ed,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+`
|
|
422
|
+
`+t}this.hierarchyColorsStyleSheet=new CSSStyleSheet,this.hierarchyColorsStyleSheet.replaceSync(n)}}static dataAttributes(){let e=new Td;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 lr?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 xd(e,this,t),r}getPropertyTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._propertyTemplates[n];return r||=new lr(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}set store(e){this._store=e,this.lists=qt(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(e=>{this.groups.push(e.id)},bt,`${W}PropertyGroup`,null),this.validator=new yd(e,{details:!0,factory:k})}},Od=200,kd=class extends HTMLElement{static get observedAttributes(){return Dd.dataAttributes()}constructor(){super(),this.shape=null,this.styleElement=null,this.form=document.createElement(`form`),this.form.setAttribute(`part`,`form`),this.config=new Dd(this.form),this.form.addEventListener(`change`,e=>{e.stopPropagation(),this.config.editMode&&this.validate(!0).then(e=>{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.setAttribute(`loading`,``),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading)),this.initDebounceTimeout=setTimeout(async()=>{try{this.config.reset(),this.config.store=await nr({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,proxy:this.config.attributes.proxy}),this.config.resourceLinkProvider&&await Ko(this.config),this.config.attributes.valuesSubject||(this.config.attributes.valuesSubject=er(this.config.store)||null),this.form.replaceChildren();let e=this.findRootShaclShapeSubject();if(e){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.editMode),this.config.theme.apply(this.form);let t=[this.config.theme.stylesheet];this.config.hierarchyColorsStyleSheet&&t.push(this.config.hierarchyColorsStyleSheet);for(let e of Er())e.stylesheet&&t.push(e.stylesheet);this.applyStyles(t);let n=new xd(e,this.config);for(let e of this.config.nodeTemplates)Cd(e);if(this.shape=new ls(n,this.config.attributes.valuesSubject?k.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=>{if(e?.conforms)this.dispatchEvent(new Event(`submit`,{bubbles:!0,cancelable:!0}));else{let e=this.form.querySelector(`:scope .invalid > .editor`);e?e.focus():this.form.querySelector(`:scope .invalid`)?.scrollIntoView()}})}),this.form.appendChild(e)}(async()=>{await this.shape?.ready,this.config.attributes.valuesSubject&&this.removeFromDataGraph(k.namedNode(this.config.attributes.valuesSubject)),this.validate(!0)})()}}else if(this.config.store.countQuads(null,null,null,vt)>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.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))}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(`
|
|
423
|
+
`).replace(/:host\b/g,`shacl-form`)).join(`
|
|
424
|
+
`);this.styleElement||(this.styleElement=document.createElement(`style`),this.prepend(this.styleElement)),this.styleElement.textContent=t}serialize(e=`text/turtle`,t=this.toRDF()){return xr(t.getQuads(null,null,null,null),e,$n)}toRDF(e=new st){return this.shape?.toRDF(e,void 0,this.config.attributes.generateNodeShapeReference),e}registerPlugin(e){Tr(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}setResourceLinkProvider(e){this.config.resourceLinkProvider=e,this.initialize()}async validate(e=!1){for(let e of this.form.querySelectorAll(`:scope .validation-error`))e.remove();for(let e of this.form.querySelectorAll(`:scope .property-instance`))e.classList.remove(`invalid`),e.querySelector(`:scope > .editor`)?.value?e.classList.add(`valid`):e.classList.remove(`valid`);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 t=this.shape;return new Promise(n=>{this.config.store.deleteGraph(this.config.valuesGraphId||``).on(`end`,async()=>{t.toRDF(this.config.store,void 0,this.config.attributes.generateNodeShapeReference);try{let r=await this.config.validator.validate({dataset:this.config.store,terms:[t.nodeId]},[{terms:[t.template.id]}]);for(let t of r.results)if(t.focusNode?.ptrs?.length)for(let n of t.focusNode.ptrs){let r=n._term;if(t.path?.length){let n=t.path[0].predicates[0],i=this.form.querySelectorAll(`
|
|
425
|
+
:scope shacl-node[data-node-id='${r.id}'] > shacl-property > .property-instance[data-path='${n.id}'] > .editor,
|
|
426
|
+
:scope shacl-node[data-node-id='${r.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${n.id}'] > .editor,
|
|
427
|
+
:scope shacl-node[data-node-id='${r.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${n.id}'] > .editor,
|
|
428
|
+
:scope shacl-node[data-node-id='${r.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${n.id}'] > .editor`);i.length===0&&(i=this.form.querySelectorAll(`
|
|
429
|
+
:scope [data-node-id='${r.id}'] > shacl-property > .property-instance[data-path='${n.id}'],
|
|
430
|
+
:scope [data-node-id='${r.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${n.id}']`));for(let n of i)if(n.classList.contains(`editor`)){if(!e||n.value){let e=n.parentElement;e.classList.add(`invalid`),e.classList.remove(`valid`),e.appendChild(this.createValidationErrorDisplay(t));do e instanceof Ca&&(e.open=!0),e=e.parentElement;while(e)}}else e||(n.classList.add(`invalid`),n.classList.remove(`valid`),n.appendChild(this.createValidationErrorDisplay(t,`node`)))}else e||this.form.querySelector(`:scope [data-node-id='${r.id}']`)?.prepend(this.createValidationErrorDisplay(t,`node`))}n(r)}catch(e){console.error(e),n({conforms:!1,results:[]})}})})}createValidationErrorDisplay(e,t){let n=document.createElement(`span`);n.classList.add(`validation-error`),t&&n.classList.add(t);let r=typeof e==`object`&&e?e:null;return r?r.message?.length?n.title+=Wt(this.config.languages,r.message):r.sourceConstraintComponent?.value&&(n.title=r.sourceConstraintComponent.value):typeof e==`string`&&(n.title=e),n}findRootShaclShapeSubject(){if(this.config.attributes.shapeSubject){let e=k.namedNode(this.config.attributes.shapeSubject);if(this.config.store.getQuads(e,bt,Et,null).length===0){console.warn(`shapes graph does not contain requested node shape ${this.config.attributes.shapeSubject}`);return}else return e}else{if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,yt)>0){let e=k.namedNode(this.config.attributes.valuesSubject),t=tr(this.config.store,this.config.attributes.valuesSubject),n=this.config.store.getQuads(e,bt,null,yt);if(n.length===0&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${bt.id} nor ${K.id} statement`),t)return t;for(let e of n)if(this.config.store.getQuads(e.object,bt,Et,null).length>0)return e.object;let r=this.config.store.getObjects(e,bt,yt);for(let e of r)for(let t of this.config.store.getQuads(null,jt,e,null))return t.subject}let e=this.config.store.getQuads(null,bt,Et,null);if(e.length==0){console.warn(`shapes graph does not contain any node shapes`);return}return e.length>1&&(console.warn(`shapes graph contains`,e.length,`node shapes. choosing first found which is`,e[0].subject.value),console.info(`hint: set the node shape to use with element attribute "data-shape-subject"`)),e[0].subject}}removeFromDataGraph(e){for(let t of this.config.store.getQuads(e,null,null,yt))this.config.store.delete(t),(t.object.termType===`NamedNode`||t.object.termType===`BlankNode`)&&this.removeFromDataGraph(t.object)}};window.customElements.define(`shacl-form`,kd);var Ad=class extends Or{constructor(e,t,n){super(e),this.onChange=t,this.fileType=n}createEditor(e){let t=ur(e)>0,n=e.config.theme.createFileEditor(e.label,null,t,e);return n.addEventListener(`change`,e=>{e.stopPropagation(),this.onChange(e)}),this.fileType&&n.querySelector(`input[type="file"]`)?.setAttribute(`accept`,this.fileType),n}},jd=o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.leaflet={}))})(e,(function(e){var t=`1.9.4`;function n(e){var t,n,r,i;for(n=1,r=arguments.length;n<r;n++)for(t in i=arguments[n],i)e[t]=i[t];return e}var r=Object.create||(function(){function e(){}return function(t){return e.prototype=t,new e}})();function i(e,t){var n=Array.prototype.slice;if(e.bind)return e.bind.apply(e,n.call(arguments,1));var r=n.call(arguments,2);return function(){return e.apply(t,r.length?r.concat(n.call(arguments)):arguments)}}var a=0;function o(e){return`_leaflet_id`in e||(e._leaflet_id=++a),e._leaflet_id}function s(e,t,n){var r,i,a,o=function(){r=!1,i&&=(a.apply(n,i),!1)};return a=function(){r?i=arguments:(e.apply(n,arguments),setTimeout(o,t),r=!0)},a}function c(e,t,n){var r=t[1],i=t[0],a=r-i;return e===r&&n?e:((e-i)%a+a)%a+i}function l(){return!1}function u(e,t){if(t===!1)return e;var n=10**(t===void 0?6:t);return Math.round(e*n)/n}function d(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function f(e){return d(e).split(/\s+/)}function p(e,t){for(var n in Object.prototype.hasOwnProperty.call(e,`options`)||(e.options=e.options?r(e.options):{}),t)e.options[n]=t[n];return e.options}function m(e,t,n){var r=[];for(var i in e)r.push(encodeURIComponent(n?i.toUpperCase():i)+`=`+encodeURIComponent(e[i]));return(!t||t.indexOf(`?`)===-1?`?`:`&`)+r.join(`&`)}var h=/\{ *([\w_ -]+) *\}/g;function g(e,t){return e.replace(h,function(e,n){var r=t[n];if(r===void 0)throw Error(`No value provided for variable `+e);return typeof r==`function`&&(r=r(t)),r})}var _=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`};function v(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}var y=`data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=`;function b(e){return window[`webkit`+e]||window[`moz`+e]||window[`ms`+e]}var x=0;function S(e){var t=+new Date,n=Math.max(0,16-(t-x));return x=t+n,window.setTimeout(e,n)}var C=window.requestAnimationFrame||b(`RequestAnimationFrame`)||S,w=window.cancelAnimationFrame||b(`CancelAnimationFrame`)||b(`CancelRequestAnimationFrame`)||function(e){window.clearTimeout(e)};function T(e,t,n){if(n&&C===S)e.call(t);else return C.call(window,i(e,t))}function E(e){e&&w.call(window,e)}var D={__proto__:null,extend:n,create:r,bind:i,get lastId(){return a},stamp:o,throttle:s,wrapNum:c,falseFn:l,formatNum:u,trim:d,splitWords:f,setOptions:p,getParamString:m,template:g,isArray:_,indexOf:v,emptyImageUrl:y,requestFn:C,cancelFn:w,requestAnimFrame:T,cancelAnimFrame:E};function O(){}O.extend=function(e){var t=function(){p(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=t.__super__=this.prototype,a=r(i);for(var o in a.constructor=t,t.prototype=a,this)Object.prototype.hasOwnProperty.call(this,o)&&o!==`prototype`&&o!==`__super__`&&(t[o]=this[o]);return e.statics&&n(t,e.statics),e.includes&&(k(e.includes),n.apply(null,[a].concat(e.includes))),n(a,e),delete a.statics,delete a.includes,a.options&&(a.options=i.options?r(i.options):{},n(a.options,e.options)),a._initHooks=[],a.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var e=0,t=a._initHooks.length;e<t;e++)a._initHooks[e].call(this)}},t},O.include=function(e){var t=this.prototype.options;return n(this.prototype,e),e.options&&(this.prototype.options=t,this.mergeOptions(e.options)),this},O.mergeOptions=function(e){return n(this.prototype.options,e),this},O.addInitHook=function(e){var t=Array.prototype.slice.call(arguments,1),n=typeof e==`function`?e:function(){this[e].apply(this,t)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};function k(e){if(!(typeof L>`u`||!L||!L.Mixin)){e=_(e)?e:[e];for(var t=0;t<e.length;t++)e[t]===L.Mixin.Events&&console.warn(`Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.`,Error().stack)}}var A={on:function(e,t,n){if(typeof e==`object`)for(var r in e)this._on(r,e[r],t);else{e=f(e);for(var i=0,a=e.length;i<a;i++)this._on(e[i],t,n)}return this},off:function(e,t,n){if(!arguments.length)delete this._events;else if(typeof e==`object`)for(var r in e)this._off(r,e[r],t);else{e=f(e);for(var i=arguments.length===1,a=0,o=e.length;a<o;a++)i?this._off(e[a]):this._off(e[a],t,n)}return this},_on:function(e,t,n,r){if(typeof t!=`function`){console.warn(`wrong listener type: `+typeof t);return}if(this._listens(e,t,n)===!1){n===this&&(n=void 0);var i={fn:t,ctx:n};r&&(i.once=!0),this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(i)}},_off:function(e,t,n){var r,i,a;if(this._events&&(r=this._events[e],r)){if(arguments.length===1){if(this._firingCount)for(i=0,a=r.length;i<a;i++)r[i].fn=l;delete this._events[e];return}if(typeof t!=`function`){console.warn(`wrong listener type: `+typeof t);return}var o=this._listens(e,t,n);if(o!==!1){var s=r[o];this._firingCount&&(s.fn=l,this._events[e]=r=r.slice()),r.splice(o,1)}}},fire:function(e,t,r){if(!this.listens(e,r))return this;var i=n({},t,{type:e,target:this,sourceTarget:t&&t.sourceTarget||this});if(this._events){var a=this._events[e];if(a){this._firingCount=this._firingCount+1||1;for(var o=0,s=a.length;o<s;o++){var c=a[o],l=c.fn;c.once&&this.off(e,l,c.ctx),l.call(c.ctx||this,i)}this._firingCount--}}return r&&this._propagateEvent(i),this},listens:function(e,t,n,r){typeof e!=`string`&&console.warn(`"string" type argument expected`);var i=t;typeof t!=`function`&&(r=!!t,i=void 0,n=void 0);var a=this._events&&this._events[e];if(a&&a.length&&this._listens(e,i,n)!==!1)return!0;if(r){for(var o in this._eventParents)if(this._eventParents[o].listens(e,t,n,r))return!0}return!1},_listens:function(e,t,n){if(!this._events)return!1;var r=this._events[e]||[];if(!t)return!!r.length;n===this&&(n=void 0);for(var i=0,a=r.length;i<a;i++)if(r[i].fn===t&&r[i].ctx===n)return i;return!1},once:function(e,t,n){if(typeof e==`object`)for(var r in e)this._on(r,e[r],t,!0);else{e=f(e);for(var i=0,a=e.length;i<a;i++)this._on(e[i],t,n,!0)}return this},addEventParent:function(e){return this._eventParents=this._eventParents||{},this._eventParents[o(e)]=e,this},removeEventParent:function(e){return this._eventParents&&delete this._eventParents[o(e)],this},_propagateEvent:function(e){for(var t in this._eventParents)this._eventParents[t].fire(e.type,n({layer:e.target,propagatedFrom:e.target},e),!0)}};A.addEventListener=A.on,A.removeEventListener=A.clearAllEventListeners=A.off,A.addOneTimeEventListener=A.once,A.fireEvent=A.fire,A.hasEventListeners=A.listens;var j=O.extend(A);function M(e,t,n){this.x=n?Math.round(e):e,this.y=n?Math.round(t):t}var N=Math.trunc||function(e){return e>0?Math.floor(e):Math.ceil(e)};M.prototype={clone:function(){return new M(this.x,this.y)},add:function(e){return this.clone()._add(P(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(P(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new M(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new M(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=N(this.x),this.y=N(this.y),this},distanceTo:function(e){e=P(e);var t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)},equals:function(e){return e=P(e),e.x===this.x&&e.y===this.y},contains:function(e){return e=P(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return`Point(`+u(this.x)+`, `+u(this.y)+`)`}};function P(e,t,n){return e instanceof M?e:_(e)?new M(e[0],e[1]):e==null?e:typeof e==`object`&&`x`in e&&`y`in e?new M(e.x,e.y):new M(e,t,n)}function F(e,t){if(e)for(var n=t?[e,t]:e,r=0,i=n.length;r<i;r++)this.extend(n[r])}F.prototype={extend:function(e){var t,n;if(!e)return this;if(e instanceof M||typeof e[0]==`number`||`x`in e)t=n=P(e);else if(e=I(e),t=e.min,n=e.max,!t||!n)return this;return!this.min&&!this.max?(this.min=t.clone(),this.max=n.clone()):(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(n.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(n.y,this.max.y)),this},getCenter:function(e){return P((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,e)},getBottomLeft:function(){return P(this.min.x,this.max.y)},getTopRight:function(){return P(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(e){var t,n;return e=typeof e[0]==`number`||e instanceof M?P(e):I(e),e instanceof F?(t=e.min,n=e.max):t=n=e,t.x>=this.min.x&&n.x<=this.max.x&&t.y>=this.min.y&&n.y<=this.max.y},intersects:function(e){e=I(e);var t=this.min,n=this.max,r=e.min,i=e.max,a=i.x>=t.x&&r.x<=n.x,o=i.y>=t.y&&r.y<=n.y;return a&&o},overlaps:function(e){e=I(e);var t=this.min,n=this.max,r=e.min,i=e.max,a=i.x>t.x&&r.x<n.x,o=i.y>t.y&&r.y<n.y;return a&&o},isValid:function(){return!!(this.min&&this.max)},pad:function(e){var t=this.min,n=this.max,r=Math.abs(t.x-n.x)*e,i=Math.abs(t.y-n.y)*e;return I(P(t.x-r,t.y-i),P(n.x+r,n.y+i))},equals:function(e){return e?(e=I(e),this.min.equals(e.getTopLeft())&&this.max.equals(e.getBottomRight())):!1}};function I(e,t){return!e||e instanceof F?e:new F(e,t)}function R(e,t){if(e)for(var n=t?[e,t]:e,r=0,i=n.length;r<i;r++)this.extend(n[r])}R.prototype={extend:function(e){var t=this._southWest,n=this._northEast,r,i;if(e instanceof B)r=e,i=e;else if(e instanceof R){if(r=e._southWest,i=e._northEast,!r||!i)return this}else return e?this.extend(V(e)||z(e)):this;return!t&&!n?(this._southWest=new B(r.lat,r.lng),this._northEast=new B(i.lat,i.lng)):(t.lat=Math.min(r.lat,t.lat),t.lng=Math.min(r.lng,t.lng),n.lat=Math.max(i.lat,n.lat),n.lng=Math.max(i.lng,n.lng)),this},pad:function(e){var t=this._southWest,n=this._northEast,r=Math.abs(t.lat-n.lat)*e,i=Math.abs(t.lng-n.lng)*e;return new R(new B(t.lat-r,t.lng-i),new B(n.lat+r,n.lng+i))},getCenter:function(){return new B((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new B(this.getNorth(),this.getWest())},getSouthEast:function(){return new B(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(e){e=typeof e[0]==`number`||e instanceof B||`lat`in e?V(e):z(e);var t=this._southWest,n=this._northEast,r,i;return e instanceof R?(r=e.getSouthWest(),i=e.getNorthEast()):r=i=e,r.lat>=t.lat&&i.lat<=n.lat&&r.lng>=t.lng&&i.lng<=n.lng},intersects:function(e){e=z(e);var t=this._southWest,n=this._northEast,r=e.getSouthWest(),i=e.getNorthEast(),a=i.lat>=t.lat&&r.lat<=n.lat,o=i.lng>=t.lng&&r.lng<=n.lng;return a&&o},overlaps:function(e){e=z(e);var t=this._southWest,n=this._northEast,r=e.getSouthWest(),i=e.getNorthEast(),a=i.lat>t.lat&&r.lat<n.lat,o=i.lng>t.lng&&r.lng<n.lng;return a&&o},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(`,`)},equals:function(e,t){return e?(e=z(e),this._southWest.equals(e.getSouthWest(),t)&&this._northEast.equals(e.getNorthEast(),t)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function z(e,t){return e instanceof R?e:new R(e,t)}function B(e,t,n){if(isNaN(e)||isNaN(t))throw Error(`Invalid LatLng object: (`+e+`, `+t+`)`);this.lat=+e,this.lng=+t,n!==void 0&&(this.alt=+n)}B.prototype={equals:function(e,t){return e?(e=V(e),Math.max(Math.abs(this.lat-e.lat),Math.abs(this.lng-e.lng))<=(t===void 0?1e-9:t)):!1},toString:function(e){return`LatLng(`+u(this.lat,e)+`, `+u(this.lng,e)+`)`},distanceTo:function(e){return te.distance(this,V(e))},wrap:function(){return te.wrapLatLng(this)},toBounds:function(e){var t=180*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return z([this.lat-t,this.lng-n],[this.lat+t,this.lng+n])},clone:function(){return new B(this.lat,this.lng,this.alt)}};function V(e,t,n){return e instanceof B?e:_(e)&&typeof e[0]!=`object`?e.length===3?new B(e[0],e[1],e[2]):e.length===2?new B(e[0],e[1]):null:e==null?e:typeof e==`object`&&`lat`in e?new B(e.lat,`lng`in e?e.lng:e.lon,e.alt):t===void 0?null:new B(e,t,n)}var ee={latLngToPoint:function(e,t){var n=this.projection.project(e),r=this.scale(t);return this.transformation._transform(n,r)},pointToLatLng:function(e,t){var n=this.scale(t),r=this.transformation.untransform(e,n);return this.projection.unproject(r)},project:function(e){return this.projection.project(e)},unproject:function(e){return this.projection.unproject(e)},scale:function(e){return 256*2**e},zoom:function(e){return Math.log(e/256)/Math.LN2},getProjectedBounds:function(e){if(this.infinite)return null;var t=this.projection.bounds,n=this.scale(e);return new F(this.transformation.transform(t.min,n),this.transformation.transform(t.max,n))},infinite:!1,wrapLatLng:function(e){var t=this.wrapLng?c(e.lng,this.wrapLng,!0):e.lng,n=this.wrapLat?c(e.lat,this.wrapLat,!0):e.lat,r=e.alt;return new B(n,t,r)},wrapLatLngBounds:function(e){var t=e.getCenter(),n=this.wrapLatLng(t),r=t.lat-n.lat,i=t.lng-n.lng;if(r===0&&i===0)return e;var a=e.getSouthWest(),o=e.getNorthEast();return new R(new B(a.lat-r,a.lng-i),new B(o.lat-r,o.lng-i))}},te=n({},ee,{wrapLng:[-180,180],R:6371e3,distance:function(e,t){var n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=Math.sin((t.lat-e.lat)*n/2),o=Math.sin((t.lng-e.lng)*n/2),s=a*a+Math.cos(r)*Math.cos(i)*o*o,c=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return this.R*c}}),ne=6378137,re={R:ne,MAX_LATITUDE:85.0511287798,project:function(e){var t=Math.PI/180,n=this.MAX_LATITUDE,r=Math.max(Math.min(n,e.lat),-n),i=Math.sin(r*t);return new M(this.R*e.lng*t,this.R*Math.log((1+i)/(1-i))/2)},unproject:function(e){var t=180/Math.PI;return new B((2*Math.atan(Math.exp(e.y/this.R))-Math.PI/2)*t,e.x*t/this.R)},bounds:(function(){var e=ne*Math.PI;return new F([-e,-e],[e,e])})()};function ie(e,t,n,r){if(_(e)){this._a=e[0],this._b=e[1],this._c=e[2],this._d=e[3];return}this._a=e,this._b=t,this._c=n,this._d=r}ie.prototype={transform:function(e,t){return this._transform(e.clone(),t)},_transform:function(e,t){return t||=1,e.x=t*(this._a*e.x+this._b),e.y=t*(this._c*e.y+this._d),e},untransform:function(e,t){return t||=1,new M((e.x/t-this._b)/this._a,(e.y/t-this._d)/this._c)}};function ae(e,t,n,r){return new ie(e,t,n,r)}var oe=n({},te,{code:`EPSG:3857`,projection:re,transformation:function(){var e=.5/(Math.PI*re.R);return ae(e,.5,-e,.5)}()}),se=n({},oe,{code:`EPSG:900913`});function ce(e){return document.createElementNS(`http://www.w3.org/2000/svg`,e)}function le(e,t){var n=``,r,i,a,o,s,c;for(r=0,a=e.length;r<a;r++){for(s=e[r],i=0,o=s.length;i<o;i++)c=s[i],n+=(i?`L`:`M`)+c.x+` `+c.y;n+=t?U.svg?`z`:`x`:``}return n||`M0 0`}var ue=document.documentElement.style,de=`ActiveXObject`in window,fe=de&&!document.addEventListener,pe=`msLaunchUri`in navigator&&!(`documentMode`in document),me=Ke(`webkit`),he=Ke(`android`),ge=Ke(`android 2`)||Ke(`android 3`),_e=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ve=he&&Ke(`Google`)&&_e<537&&!(`AudioNode`in window),ye=!!window.opera,H=!pe&&Ke(`chrome`),be=Ke(`gecko`)&&!me&&!ye&&!de,xe=!H&&Ke(`safari`),Se=Ke(`phantom`),Ce=`OTransition`in ue,we=navigator.platform.indexOf(`Win`)===0,Te=de&&`transition`in ue,Ee=`WebKitCSSMatrix`in window&&`m11`in new window.WebKitCSSMatrix&&!ge,De=`MozPerspective`in ue,Oe=!window.L_DISABLE_3D&&(Te||Ee||De)&&!Ce&&!Se,ke=typeof orientation<`u`||Ke(`mobile`),Ae=ke&&me,je=ke&&Ee,Me=!window.PointerEvent&&window.MSPointerEvent,Ne=!!(window.PointerEvent||Me),Pe=`ontouchstart`in window||!!window.TouchEvent,Fe=!window.L_NO_TOUCH&&(Pe||Ne),Ie=ke&&ye,Le=ke&&be,Re=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ze=function(){var e=!1;try{var t=Object.defineProperty({},`passive`,{get:function(){e=!0}});window.addEventListener(`testPassiveEventSupport`,l,t),window.removeEventListener(`testPassiveEventSupport`,l,t)}catch{}return e}(),Be=function(){return!!document.createElement(`canvas`).getContext}(),Ve=!!(document.createElementNS&&ce(`svg`).createSVGRect),He=!!Ve&&(function(){var e=document.createElement(`div`);return e.innerHTML=`<svg/>`,(e.firstChild&&e.firstChild.namespaceURI)===`http://www.w3.org/2000/svg`})(),Ue=!Ve&&function(){try{var e=document.createElement(`div`);e.innerHTML=`<v:shape adj="1"/>`;var t=e.firstChild;return t.style.behavior=`url(#default#VML)`,t&&typeof t.adj==`object`}catch{return!1}}(),We=navigator.platform.indexOf(`Mac`)===0,Ge=navigator.platform.indexOf(`Linux`)===0;function Ke(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var U={ie:de,ielt9:fe,edge:pe,webkit:me,android:he,android23:ge,androidStock:ve,opera:ye,chrome:H,gecko:be,safari:xe,phantom:Se,opera12:Ce,win:we,ie3d:Te,webkit3d:Ee,gecko3d:De,any3d:Oe,mobile:ke,mobileWebkit:Ae,mobileWebkit3d:je,msPointer:Me,pointer:Ne,touch:Fe,touchNative:Pe,mobileOpera:Ie,mobileGecko:Le,retina:Re,passiveEvents:ze,canvas:Be,svg:Ve,vml:Ue,inlineSvg:He,mac:We,linux:Ge},qe=U.msPointer?`MSPointerDown`:`pointerdown`,Je=U.msPointer?`MSPointerMove`:`pointermove`,Ye=U.msPointer?`MSPointerUp`:`pointerup`,Xe=U.msPointer?`MSPointerCancel`:`pointercancel`,Ze={touchstart:qe,touchmove:Je,touchend:Ye,touchcancel:Xe},Qe={touchstart:ct,touchmove:st,touchend:st,touchcancel:st},$e={},et=!1;function tt(e,t,n){return t===`touchstart`&&ot(),Qe[t]?(n=Qe[t].bind(this,n),e.addEventListener(Ze[t],n,!1),n):(console.warn(`wrong event specified:`,t),l)}function nt(e,t,n){if(!Ze[t]){console.warn(`wrong event specified:`,t);return}e.removeEventListener(Ze[t],n,!1)}function rt(e){$e[e.pointerId]=e}function it(e){$e[e.pointerId]&&($e[e.pointerId]=e)}function at(e){delete $e[e.pointerId]}function ot(){et||=(document.addEventListener(qe,rt,!0),document.addEventListener(Je,it,!0),document.addEventListener(Ye,at,!0),document.addEventListener(Xe,at,!0),!0)}function st(e,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||`mouse`)){for(var n in t.touches=[],$e)t.touches.push($e[n]);t.changedTouches=[t],e(t)}}function ct(e,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&$t(t),st(e,t)}function lt(e){var t={},n,r;for(r in e)n=e[r],t[r]=n&&n.bind?n.bind(e):n;return e=t,t.type=`dblclick`,t.detail=2,t.isTrusted=!1,t._simulated=!0,t}var ut=200;function W(e,t){e.addEventListener(`dblclick`,t);var n=0,r;function i(e){if(e.detail!==1){r=e.detail;return}if(!(e.pointerType===`mouse`||e.sourceCapabilities&&!e.sourceCapabilities.firesTouchEvents)){var i=tn(e);if(!(i.some(function(e){return e instanceof HTMLLabelElement&&e.attributes.for})&&!i.some(function(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement}))){var a=Date.now();a-n<=ut?(r++,r===2&&t(lt(e))):r=1,n=a}}}return e.addEventListener(`click`,i),{dblclick:t,simDblclick:i}}function dt(e,t){e.removeEventListener(`dblclick`,t.dblclick),e.removeEventListener(`click`,t.simDblclick)}var ft=Dt([`transform`,`webkitTransform`,`OTransform`,`MozTransform`,`msTransform`]),pt=Dt([`webkitTransition`,`transition`,`OTransition`,`MozTransition`,`msTransition`]),mt=pt===`webkitTransition`||pt===`OTransition`?pt+`End`:`transitionend`;function ht(e){return typeof e==`string`?document.getElementById(e):e}function gt(e,t){var n=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!n||n===`auto`)&&document.defaultView){var r=document.defaultView.getComputedStyle(e,null);n=r?r[t]:null}return n===`auto`?null:n}function G(e,t,n){var r=document.createElement(e);return r.className=t||``,n&&n.appendChild(r),r}function _t(e){var t=e.parentNode;t&&t.removeChild(e)}function vt(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function yt(e){var t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)}function bt(e){var t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)}function xt(e,t){if(e.classList!==void 0)return e.classList.contains(t);var n=wt(e);return n.length>0&&RegExp(`(^|\\s)`+t+`(\\s|$)`).test(n)}function K(e,t){if(e.classList!==void 0)for(var n=f(t),r=0,i=n.length;r<i;r++)e.classList.add(n[r]);else if(!xt(e,t)){var a=wt(e);Ct(e,(a?a+` `:``)+t)}}function St(e,t){e.classList===void 0?Ct(e,d((` `+wt(e)+` `).replace(` `+t+` `,` `))):e.classList.remove(t)}function Ct(e,t){e.className.baseVal===void 0?e.className=t:e.className.baseVal=t}function wt(e){return e.correspondingElement&&(e=e.correspondingElement),e.className.baseVal===void 0?e.className:e.className.baseVal}function Tt(e,t){`opacity`in e.style?e.style.opacity=t:`filter`in e.style&&Et(e,t)}function Et(e,t){var n=!1,r=`DXImageTransform.Microsoft.Alpha`;try{n=e.filters.item(r)}catch{if(t===1)return}t=Math.round(t*100),n?(n.Enabled=t!==100,n.Opacity=t):e.style.filter+=` progid:`+r+`(opacity=`+t+`)`}function Dt(e){for(var t=document.documentElement.style,n=0;n<e.length;n++)if(e[n]in t)return e[n];return!1}function Ot(e,t,n){var r=t||new M(0,0);e.style[ft]=(U.ie3d?`translate(`+r.x+`px,`+r.y+`px)`:`translate3d(`+r.x+`px,`+r.y+`px,0)`)+(n?` scale(`+n+`)`:``)}function kt(e,t){e._leaflet_pos=t,U.any3d?Ot(e,t):(e.style.left=t.x+`px`,e.style.top=t.y+`px`)}function At(e){return e._leaflet_pos||new M(0,0)}var jt,Mt,Nt;if(`onselectstart`in document)jt=function(){q(window,`selectstart`,$t)},Mt=function(){Gt(window,`selectstart`,$t)};else{var Pt=Dt([`userSelect`,`WebkitUserSelect`,`OUserSelect`,`MozUserSelect`,`msUserSelect`]);jt=function(){if(Pt){var e=document.documentElement.style;Nt=e[Pt],e[Pt]=`none`}},Mt=function(){Pt&&(document.documentElement.style[Pt]=Nt,Nt=void 0)}}function Ft(){q(window,`dragstart`,$t)}function It(){Gt(window,`dragstart`,$t)}var Lt,Rt;function zt(e){for(;e.tabIndex===-1;)e=e.parentNode;e.style&&(Bt(),Lt=e,Rt=e.style.outlineStyle,e.style.outlineStyle=`none`,q(window,`keydown`,Bt))}function Bt(){Lt&&(Lt.style.outlineStyle=Rt,Lt=void 0,Rt=void 0,Gt(window,`keydown`,Bt))}function Vt(e){do e=e.parentNode;while((!e.offsetWidth||!e.offsetHeight)&&e!==document.body);return e}function Ht(e){var t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}var Ut={__proto__:null,TRANSFORM:ft,TRANSITION:pt,TRANSITION_END:mt,get:ht,getStyle:gt,create:G,remove:_t,empty:vt,toFront:yt,toBack:bt,hasClass:xt,addClass:K,removeClass:St,setClass:Ct,getClass:wt,setOpacity:Tt,testProp:Dt,setTransform:Ot,setPosition:kt,getPosition:At,get disableTextSelection(){return jt},get enableTextSelection(){return Mt},disableImageDrag:Ft,enableImageDrag:It,preventOutline:zt,restoreOutline:Bt,getSizedParentNode:Vt,getScale:Ht};function q(e,t,n,r){if(t&&typeof t==`object`)for(var i in t)Jt(e,i,t[i],n);else{t=f(t);for(var a=0,o=t.length;a<o;a++)Jt(e,t[a],n,r)}return this}var Wt=`_leaflet_events`;function Gt(e,t,n,r){if(arguments.length===1)Kt(e),delete e[Wt];else if(t&&typeof t==`object`)for(var i in t)Yt(e,i,t[i],n);else if(t=f(t),arguments.length===2)Kt(e,function(e){return v(t,e)!==-1});else for(var a=0,o=t.length;a<o;a++)Yt(e,t[a],n,r);return this}function Kt(e,t){for(var n in e[Wt]){var r=n.split(/\d/)[0];(!t||t(r))&&Yt(e,r,null,null,n)}}var qt={mouseenter:`mouseover`,mouseleave:`mouseout`,wheel:!(`onwheel`in window)&&`mousewheel`};function Jt(e,t,n,r){var i=t+o(n)+(r?`_`+o(r):``);if(e[Wt]&&e[Wt][i])return this;var a=function(t){return n.call(r||e,t||window.event)},s=a;!U.touchNative&&U.pointer&&t.indexOf(`touch`)===0?a=tt(e,t,a):U.touch&&t===`dblclick`?a=W(e,a):`addEventListener`in e?t===`touchstart`||t===`touchmove`||t===`wheel`||t===`mousewheel`?e.addEventListener(qt[t]||t,a,U.passiveEvents?{passive:!1}:!1):t===`mouseenter`||t===`mouseleave`?(a=function(t){t||=window.event,on(e,t)&&s(t)},e.addEventListener(qt[t],a,!1)):e.addEventListener(t,s,!1):e.attachEvent(`on`+t,a),e[Wt]=e[Wt]||{},e[Wt][i]=a}function Yt(e,t,n,r,i){i||=t+o(n)+(r?`_`+o(r):``);var a=e[Wt]&&e[Wt][i];if(!a)return this;!U.touchNative&&U.pointer&&t.indexOf(`touch`)===0?nt(e,t,a):U.touch&&t===`dblclick`?dt(e,a):`removeEventListener`in e?e.removeEventListener(qt[t]||t,a,!1):e.detachEvent(`on`+t,a),e[Wt][i]=null}function Xt(e){return e.stopPropagation?e.stopPropagation():e.originalEvent?e.originalEvent._stopped=!0:e.cancelBubble=!0,this}function Zt(e){return Jt(e,`wheel`,Xt),this}function Qt(e){return q(e,`mousedown touchstart dblclick contextmenu`,Xt),e._leaflet_disable_click=!0,this}function $t(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this}function en(e){return $t(e),Xt(e),this}function tn(e){if(e.composedPath)return e.composedPath();for(var t=[],n=e.target;n;)t.push(n),n=n.parentNode;return t}function nn(e,t){if(!t)return new M(e.clientX,e.clientY);var n=Ht(t),r=n.boundingClientRect;return new M((e.clientX-r.left)/n.x-t.clientLeft,(e.clientY-r.top)/n.y-t.clientTop)}var rn=U.linux&&U.chrome?window.devicePixelRatio:U.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function an(e){return U.edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/rn:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}function on(e,t){var n=t.relatedTarget;if(!n)return!0;try{for(;n&&n!==e;)n=n.parentNode}catch{return!1}return n!==e}var sn={__proto__:null,on:q,off:Gt,stopPropagation:Xt,disableScrollPropagation:Zt,disableClickPropagation:Qt,preventDefault:$t,stop:en,getPropagationPath:tn,getMousePosition:nn,getWheelDelta:an,isExternalTarget:on,addListener:q,removeListener:Gt},cn=j.extend({run:function(e,t,n,r){this.stop(),this._el=e,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(r||.5,.2),this._startPos=At(e),this._offset=t.subtract(this._startPos),this._startTime=+new Date,this.fire(`start`),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=T(this._animate,this),this._step()},_step:function(e){var t=+new Date-this._startTime,n=this._duration*1e3;t<n?this._runFrame(this._easeOut(t/n),e):(this._runFrame(1),this._complete())},_runFrame:function(e,t){var n=this._startPos.add(this._offset.multiplyBy(e));t&&n._round(),kt(this._el,n),this.fire(`step`)},_complete:function(){E(this._animId),this._inProgress=!1,this.fire(`end`)},_easeOut:function(e){return 1-(1-e)**this._easeOutPower}}),J=j.extend({options:{crs:oe,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(e,t){t=p(this,t),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(e),this._initLayout(),this._onResize=i(this._onResize,this),this._initEvents(),t.maxBounds&&this.setMaxBounds(t.maxBounds),t.zoom!==void 0&&(this._zoom=this._limitZoom(t.zoom)),t.center&&t.zoom!==void 0&&this.setView(V(t.center),t.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=pt&&U.any3d&&!U.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),q(this._proxy,mt,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(e,t,r){return t=t===void 0?this._zoom:this._limitZoom(t),e=this._limitCenter(V(e),t,this.options.maxBounds),r||={},this._stop(),this._loaded&&!r.reset&&r!==!0&&(r.animate!==void 0&&(r.zoom=n({animate:r.animate},r.zoom),r.pan=n({animate:r.animate,duration:r.duration},r.pan)),this._zoom===t?this._tryAnimatedPan(e,r.pan):this._tryAnimatedZoom&&this._tryAnimatedZoom(e,t,r.zoom))?(clearTimeout(this._sizeTimer),this):(this._resetView(e,t,r.pan&&r.pan.noMoveStart),this)},setZoom:function(e,t){return this._loaded?this.setView(this.getCenter(),e,{zoom:t}):(this._zoom=e,this)},zoomIn:function(e,t){return e||=U.any3d?this.options.zoomDelta:1,this.setZoom(this._zoom+e,t)},zoomOut:function(e,t){return e||=U.any3d?this.options.zoomDelta:1,this.setZoom(this._zoom-e,t)},setZoomAround:function(e,t,n){var r=this.getZoomScale(t),i=this.getSize().divideBy(2),a=(e instanceof M?e:this.latLngToContainerPoint(e)).subtract(i).multiplyBy(1-1/r),o=this.containerPointToLatLng(i.add(a));return this.setView(o,t,{zoom:n})},_getBoundsCenterZoom:function(e,t){t||={},e=e.getBounds?e.getBounds():z(e);var n=P(t.paddingTopLeft||t.padding||[0,0]),r=P(t.paddingBottomRight||t.padding||[0,0]),i=this.getBoundsZoom(e,!1,n.add(r));if(i=typeof t.maxZoom==`number`?Math.min(t.maxZoom,i):i,i===1/0)return{center:e.getCenter(),zoom:i};var a=r.subtract(n).divideBy(2),o=this.project(e.getSouthWest(),i),s=this.project(e.getNorthEast(),i);return{center:this.unproject(o.add(s).divideBy(2).add(a),i),zoom:i}},fitBounds:function(e,t){if(e=z(e),!e.isValid())throw Error(`Bounds are not valid.`);var n=this._getBoundsCenterZoom(e,t);return this.setView(n.center,n.zoom,t)},fitWorld:function(e){return this.fitBounds([[-90,-180],[90,180]],e)},panTo:function(e,t){return this.setView(e,this._zoom,{pan:t})},panBy:function(e,t){if(e=P(e).round(),t||={},!e.x&&!e.y)return this.fire(`moveend`);if(t.animate!==!0&&!this.getSize().contains(e))return this._resetView(this.unproject(this.project(this.getCenter()).add(e)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new cn,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),t.noMoveStart||this.fire(`movestart`),t.animate!==!1){K(this._mapPane,`leaflet-pan-anim`);var n=this._getMapPanePos().subtract(e).round();this._panAnim.run(this._mapPane,n,t.duration||.25,t.easeLinearity)}else this._rawPanBy(e),this.fire(`move`).fire(`moveend`);return this},flyTo:function(e,t,n){if(n||={},n.animate===!1||!U.any3d)return this.setView(e,t,n);this._stop();var r=this.project(this.getCenter()),i=this.project(e),a=this.getSize(),o=this._zoom;e=V(e),t=t===void 0?o:t;var s=Math.max(a.x,a.y),c=s*this.getZoomScale(o,t),l=i.distanceTo(r)||1,u=1.42,d=u*u;function f(e){var t=e?-1:1,n=e?c:s,r=(c*c-s*s+t*d*d*l*l)/(2*n*d*l),i=Math.sqrt(r*r+1)-r;return i<1e-9?-18:Math.log(i)}function p(e){return(Math.exp(e)-Math.exp(-e))/2}function m(e){return(Math.exp(e)+Math.exp(-e))/2}function h(e){return p(e)/m(e)}var g=f(0);function _(e){return s*(m(g)/m(g+u*e))}function v(e){return s*(m(g)*h(g+u*e)-p(g))/d}function y(e){return 1-(1-e)**1.5}var b=Date.now(),x=(f(1)-g)/u,S=n.duration?1e3*n.duration:1e3*x*.8;function C(){var n=(Date.now()-b)/S,a=y(n)*x;n<=1?(this._flyToFrame=T(C,this),this._move(this.unproject(r.add(i.subtract(r).multiplyBy(v(a)/l)),o),this.getScaleZoom(s/_(a),o),{flyTo:!0})):this._move(e,t)._moveEnd(!0)}return this._moveStart(!0,n.noMoveStart),C.call(this),this},flyToBounds:function(e,t){var n=this._getBoundsCenterZoom(e,t);return this.flyTo(n.center,n.zoom,t)},setMaxBounds:function(e){return e=z(e),this.listens(`moveend`,this._panInsideMaxBounds)&&this.off(`moveend`,this._panInsideMaxBounds),e.isValid()?(this.options.maxBounds=e,this._loaded&&this._panInsideMaxBounds(),this.on(`moveend`,this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(e){var t=this.options.minZoom;return this.options.minZoom=e,this._loaded&&t!==e&&(this.fire(`zoomlevelschange`),this.getZoom()<this.options.minZoom)?this.setZoom(e):this},setMaxZoom:function(e){var t=this.options.maxZoom;return this.options.maxZoom=e,this._loaded&&t!==e&&(this.fire(`zoomlevelschange`),this.getZoom()>this.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,t){this._enforcingBounds=!0;var n=this.getCenter(),r=this._limitCenter(n,this._zoom,z(e));return n.equals(r)||this.panTo(r,t),this._enforcingBounds=!1,this},panInside:function(e,t){t||={};var n=P(t.paddingTopLeft||t.padding||[0,0]),r=P(t.paddingBottomRight||t.padding||[0,0]),i=this.project(this.getCenter()),a=this.project(e),o=this.getPixelBounds(),s=I([o.min.add(n),o.max.subtract(r)]),c=s.getSize();if(!s.contains(a)){this._enforcingBounds=!0;var l=a.subtract(s.getCenter()),u=s.extend(a).getSize().subtract(c);i.x+=l.x<0?-u.x:u.x,i.y+=l.y<0?-u.y:u.y,this.panTo(this.unproject(i),t),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=n({animate:!1,pan:!0},e===!0?{animate:!0}:e);var t=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var r=this.getSize(),a=t.divideBy(2).round(),o=r.divideBy(2).round(),s=a.subtract(o);return!s.x&&!s.y?this:(e.animate&&e.pan?this.panBy(s):(e.pan&&this._rawPanBy(s),this.fire(`move`),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(i(this.fire,this,`moveend`),200)):this.fire(`moveend`)),this.fire(`resize`,{oldSize:t,newSize:r}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire(`viewreset`),this._stop()},locate:function(e){if(e=this._locateOptions=n({timeout:1e4,watch:!1},e),!(`geolocation`in navigator))return this._handleGeolocationError({code:0,message:`Geolocation not supported.`}),this;var t=i(this._handleGeolocationResponse,this),r=i(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,r,e):navigator.geolocation.getCurrentPosition(t,r,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var t=e.code,n=e.message||(t===1?`permission denied`:t===2?`position unavailable`:`timeout`);this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire(`locationerror`,{code:t,message:`Geolocation error: `+n+`.`})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var t=e.coords.latitude,n=e.coords.longitude,r=new B(t,n),i=r.toBounds(e.coords.accuracy*2),a=this._locateOptions;if(a.setView){var o=this.getBoundsZoom(i);this.setView(r,a.maxZoom?Math.min(o,a.maxZoom):o)}var s={latlng:r,bounds:i,timestamp:e.timestamp};for(var c in e.coords)typeof e.coords[c]==`number`&&(s[c]=e.coords[c]);this.fire(`locationfound`,s)}},addHandler:function(e,t){if(!t)return this;var n=this[e]=new t(this);return this._handlers.push(n),this.options[e]&&n.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off(`moveend`,this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw Error(`Map container is being reused by another instance`);try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}for(var e in this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),_t(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&=(E(this._resizeRequest),null),this._clearHandlers(),this._loaded&&this.fire(`unload`),this._layers)this._layers[e].remove();for(e in this._panes)_t(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,t){var n=G(`div`,`leaflet-pane`+(e?` leaflet-`+e.replace(`Pane`,``)+`-pane`:``),t||this._mapPane);return e&&(this._panes[e]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds();return new R(this.unproject(e.getBottomLeft()),this.unproject(e.getTopRight()))},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,n){e=z(e),n=P(n||[0,0]);var r=this.getZoom()||0,i=this.getMinZoom(),a=this.getMaxZoom(),o=e.getNorthWest(),s=e.getSouthEast(),c=this.getSize().subtract(n),l=I(this.project(s,r),this.project(o,r)).getSize(),u=U.any3d?this.options.zoomSnap:1,d=c.x/l.x,f=c.y/l.y,p=t?Math.max(d,f):Math.min(d,f);return r=this.getScaleZoom(p,r),u&&(r=Math.round(r/(u/100))*(u/100),r=t?Math.ceil(r/u)*u:Math.floor(r/u)*u),Math.max(i,Math.min(a,r))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new M(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,t){var n=this._getTopLeftPoint(e,t);return new F(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(e===void 0?this.getZoom():e)},getPane:function(e){return typeof e==`string`?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,t){var n=this.options.crs;return t=t===void 0?this._zoom:t,n.scale(e)/n.scale(t)},getScaleZoom:function(e,t){var n=this.options.crs;t=t===void 0?this._zoom:t;var r=n.zoom(e*n.scale(t));return isNaN(r)?1/0:r},project:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.latLngToPoint(V(e),t)},unproject:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.pointToLatLng(P(e),t)},layerPointToLatLng:function(e){var t=P(e).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(e){return this.project(V(e))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(V(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(z(e))},distance:function(e,t){return this.options.crs.distance(V(e),V(t))},containerPointToLayerPoint:function(e){return P(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return P(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(P(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(V(e)))},mouseEventToContainerPoint:function(e){return nn(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=ht(e);if(!t)throw Error(`Map container not found.`);if(t._leaflet_id)throw Error(`Map container is already initialized.`);q(t,`scroll`,this._onScroll,this),this._containerId=o(t)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&U.any3d,K(e,`leaflet-container`+(U.touch?` leaflet-touch`:``)+(U.retina?` leaflet-retina`:``)+(U.ielt9?` leaflet-oldie`:``)+(U.safari?` leaflet-safari`:``)+(this._fadeAnimated?` leaflet-fade-anim`:``));var t=gt(e,`position`);t!==`absolute`&&t!==`relative`&&t!==`fixed`&&t!==`sticky`&&(e.style.position=`relative`),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane(`mapPane`,this._container),kt(this._mapPane,new M(0,0)),this.createPane(`tilePane`),this.createPane(`overlayPane`),this.createPane(`shadowPane`),this.createPane(`markerPane`),this.createPane(`tooltipPane`),this.createPane(`popupPane`),this.options.markerZoomAnimation||(K(e.markerPane,`leaflet-zoom-hide`),K(e.shadowPane,`leaflet-zoom-hide`))},_resetView:function(e,t,n){kt(this._mapPane,new M(0,0));var r=!this._loaded;this._loaded=!0,t=this._limitZoom(t),this.fire(`viewprereset`);var i=this._zoom!==t;this._moveStart(i,n)._move(e,t)._moveEnd(i),this.fire(`viewreset`),r&&this.fire(`load`)},_moveStart:function(e,t){return e&&this.fire(`zoomstart`),t||this.fire(`movestart`),this},_move:function(e,t,n,r){t===void 0&&(t=this._zoom);var i=this._zoom!==t;return this._zoom=t,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),r?n&&n.pinch&&this.fire(`zoom`,n):((i||n&&n.pinch)&&this.fire(`zoom`,n),this.fire(`move`,n)),this},_moveEnd:function(e){return e&&this.fire(`zoomend`),this.fire(`moveend`)},_stop:function(){return E(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){kt(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw Error(`Set map center and zoom first.`)},_initEvents:function(e){this._targets={},this._targets[o(this._container)]=this;var t=e?Gt:q;t(this._container,`click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup`,this._handleDOMEvent,this),this.options.trackResize&&t(window,`resize`,this._onResize,this),U.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,`moveend`,this._onMoveEnd)},_onResize:function(){E(this._resizeRequest),this._resizeRequest=T(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,t){for(var n=[],r,i=t===`mouseout`||t===`mouseover`,a=e.target||e.srcElement,s=!1;a;){if(r=this._targets[o(a)],r&&(t===`click`||t===`preclick`)&&this._draggableMoved(r)){s=!0;break}if(r&&r.listens(t,!0)&&(i&&!on(a,e)||(n.push(r),i))||a===this._container)break;a=a.parentNode}return!n.length&&!s&&!i&&this.listens(t,!0)&&(n=[this]),n},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var t=e.target||e.srcElement;if(!(!this._loaded||t._leaflet_disable_events||e.type===`click`&&this._isClickDisabled(t))){var n=e.type;n===`mousedown`&&zt(t),this._fireDOMEvent(e,n)}},_mouseEvents:[`click`,`dblclick`,`mouseover`,`mouseout`,`contextmenu`],_fireDOMEvent:function(e,t,r){if(e.type===`click`){var i=n({},e);i.type=`preclick`,this._fireDOMEvent(i,i.type,r)}var a=this._findEventTargets(e,t);if(r){for(var o=[],s=0;s<r.length;s++)r[s].listens(t,!0)&&o.push(r[s]);a=o.concat(a)}if(a.length){t===`contextmenu`&&$t(e);var c=a[0],l={originalEvent:e};if(e.type!==`keypress`&&e.type!==`keydown`&&e.type!==`keyup`){var u=c.getLatLng&&(!c._radius||c._radius<=10);l.containerPoint=u?this.latLngToContainerPoint(c.getLatLng()):this.mouseEventToContainerPoint(e),l.layerPoint=this.containerPointToLayerPoint(l.containerPoint),l.latlng=u?c.getLatLng():this.layerPointToLatLng(l.layerPoint)}for(s=0;s<a.length;s++)if(a[s].fire(t,l,!0),l.originalEvent._stopped||a[s].options.bubblingMouseEvents===!1&&v(this._mouseEvents,t)!==-1)return}},_draggableMoved:function(e){return e=e.dragging&&e.dragging.enabled()?e:this,e.dragging&&e.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var e=0,t=this._handlers.length;e<t;e++)this._handlers[e].disable()},whenReady:function(e,t){return this._loaded?e.call(t||this,{target:this}):this.on(`load`,e,t),this},_getMapPanePos:function(){return At(this._mapPane)||new M(0,0)},_moved:function(){var e=this._getMapPanePos();return e&&!e.equals([0,0])},_getTopLeftPoint:function(e,t){return(e&&t!==void 0?this._getNewPixelOrigin(e,t):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(e,t){var n=this.getSize()._divideBy(2);return this.project(e,t)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(e,t,n){var r=this._getNewPixelOrigin(n,t);return this.project(e,t)._subtract(r)},_latLngBoundsToNewLayerBounds:function(e,t,n){var r=this._getNewPixelOrigin(n,t);return I([this.project(e.getSouthWest(),t)._subtract(r),this.project(e.getNorthWest(),t)._subtract(r),this.project(e.getSouthEast(),t)._subtract(r),this.project(e.getNorthEast(),t)._subtract(r)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(e){return this.latLngToLayerPoint(e).subtract(this._getCenterLayerPoint())},_limitCenter:function(e,t,n){if(!n)return e;var r=this.project(e,t),i=this.getSize().divideBy(2),a=new F(r.subtract(i),r.add(i)),o=this._getBoundsOffset(a,n,t);return Math.abs(o.x)<=1&&Math.abs(o.y)<=1?e:this.unproject(r.add(o),t)},_limitOffset:function(e,t){if(!t)return e;var n=this.getPixelBounds(),r=new F(n.min.add(e),n.max.add(e));return e.add(this._getBoundsOffset(r,t))},_getBoundsOffset:function(e,t,n){var r=I(this.project(t.getNorthEast(),n),this.project(t.getSouthWest(),n)),i=r.min.subtract(e.min),a=r.max.subtract(e.max);return new M(this._rebound(i.x,-a.x),this._rebound(i.y,-a.y))},_rebound:function(e,t){return e+t>0?Math.round(e-t)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(t))},_limitZoom:function(e){var t=this.getMinZoom(),n=this.getMaxZoom(),r=U.any3d?this.options.zoomSnap:1;return r&&(e=Math.round(e/r)*r),Math.max(t,Math.min(n,e))},_onPanTransitionStep:function(){this.fire(`move`)},_onPanTransitionEnd:function(){St(this._mapPane,`leaflet-pan-anim`),this.fire(`moveend`)},_tryAnimatedPan:function(e,t){var n=this._getCenterOffset(e)._trunc();return(t&&t.animate)!==!0&&!this.getSize().contains(n)?!1:(this.panBy(n,t),!0)},_createAnimProxy:function(){var e=this._proxy=G(`div`,`leaflet-proxy leaflet-zoom-animated`);this._panes.mapPane.appendChild(e),this.on(`zoomanim`,function(e){var t=ft,n=this._proxy.style[t];Ot(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[t]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on(`load moveend`,this._animMoveEnd,this),this._on(`unload`,this._destroyAnimProxy,this)},_destroyAnimProxy:function(){_t(this._proxy),this.off(`load moveend`,this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),t=this.getZoom();Ot(this._proxy,this.project(e,t),this.getZoomScale(t,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf(`transform`)>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName(`leaflet-zoom-animated`).length},_tryAnimatedZoom:function(e,t,n){if(this._animatingZoom)return!0;if(n||={},!this._zoomAnimated||n.animate===!1||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(t),i=this._getCenterOffset(e)._divideBy(1-1/r);return n.animate!==!0&&!this.getSize().contains(i)?!1:(T(function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(e,t,!0)},this),!0)},_animateZoom:function(e,t,n,r){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=t,K(this._mapPane,`leaflet-zoom-anim`)),this.fire(`zoomanim`,{center:e,zoom:t,noUpdate:r}),this._tempFireZoomEvent||=this._zoom!==this._animateToZoom,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(i(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&St(this._mapPane,`leaflet-zoom-anim`),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire(`zoom`),delete this._tempFireZoomEvent,this.fire(`move`),this._moveEnd(!0))}});function ln(e,t){return new J(e,t)}var un=O.extend({options:{position:`topright`},initialize:function(e){p(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var t=this._map;return t&&t.removeControl(this),this.options.position=e,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var t=this._container=this.onAdd(e),n=this.getPosition(),r=e._controlCorners[n];return K(t,`leaflet-control`),n.indexOf(`bottom`)===-1?r.appendChild(t):r.insertBefore(t,r.firstChild),this._map.on(`unload`,this.remove,this),this},remove:function(){return this._map?(_t(this._container),this.onRemove&&this.onRemove(this._map),this._map.off(`unload`,this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),dn=function(e){return new un(e)};J.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},t=`leaflet-`,n=this._controlContainer=G(`div`,t+`control-container`,this._container);function r(r,i){var a=t+r+` `+t+i;e[r+i]=G(`div`,a,n)}r(`top`,`left`),r(`top`,`right`),r(`bottom`,`left`),r(`bottom`,`right`)},_clearControlPos:function(){for(var e in this._controlCorners)_t(this._controlCorners[e]);_t(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var fn=un.extend({options:{collapsed:!0,position:`topright`,autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,t,n,r){return n<r?-1:r<n?1:0}},initialize:function(e,t,n){for(var r in p(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,e)this._addLayer(e[r],r);for(r in t)this._addLayer(t[r],r,!0)},onAdd:function(e){this._initLayout(),this._update(),this._map=e,e.on(`zoomend`,this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.on(`add remove`,this._onLayerChange,this);return this._container},addTo:function(e){return un.prototype.addTo.call(this,e),this._expandIfNotCollapsed()},onRemove:function(){this._map.off(`zoomend`,this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off(`add remove`,this._onLayerChange,this)},addBaseLayer:function(e,t){return this._addLayer(e,t),this._map?this._update():this},addOverlay:function(e,t){return this._addLayer(e,t,!0),this._map?this._update():this},removeLayer:function(e){e.off(`add remove`,this._onLayerChange,this);var t=this._getLayer(o(e));return t&&this._layers.splice(this._layers.indexOf(t),1),this._map?this._update():this},expand:function(){K(this._container,`leaflet-control-layers-expanded`),this._section.style.height=null;var e=this._map.getSize().y-(this._container.offsetTop+50);return e<this._section.clientHeight?(K(this._section,`leaflet-control-layers-scrollbar`),this._section.style.height=e+`px`):St(this._section,`leaflet-control-layers-scrollbar`),this._checkDisabledLayers(),this},collapse:function(){return St(this._container,`leaflet-control-layers-expanded`),this},_initLayout:function(){var e=`leaflet-control-layers`,t=this._container=G(`div`,e),n=this.options.collapsed;t.setAttribute(`aria-haspopup`,!0),Qt(t),Zt(t);var r=this._section=G(`section`,e+`-list`);n&&(this._map.on(`click`,this.collapse,this),q(t,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var i=this._layersLink=G(`a`,e+`-toggle`,t);i.href=`#`,i.title=`Layers`,i.setAttribute(`role`,`button`),q(i,{keydown:function(e){e.keyCode===13&&this._expandSafely()},click:function(e){$t(e),this._expandSafely()}},this),n||this.expand(),this._baseLayersList=G(`div`,e+`-base`,r),this._separator=G(`div`,e+`-separator`,r),this._overlaysList=G(`div`,e+`-overlays`,r),t.appendChild(r)},_getLayer:function(e){for(var t=0;t<this._layers.length;t++)if(this._layers[t]&&o(this._layers[t].layer)===e)return this._layers[t]},_addLayer:function(e,t,n){this._map&&e.on(`add remove`,this._onLayerChange,this),this._layers.push({layer:e,name:t,overlay:n}),this.options.sortLayers&&this._layers.sort(i(function(e,t){return this.options.sortFunction(e.layer,t.layer,e.name,t.name)},this)),this.options.autoZIndex&&e.setZIndex&&(this._lastZIndex++,e.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;vt(this._baseLayersList),vt(this._overlaysList),this._layerControlInputs=[];var e,t,n,r,i=0;for(n=0;n<this._layers.length;n++)r=this._layers[n],this._addItem(r),t||=r.overlay,e||=!r.overlay,i+=r.overlay?0:1;return this.options.hideSingleBase&&(e&&=i>1,this._baseLayersList.style.display=e?``:`none`),this._separator.style.display=t&&e?``:`none`,this},_onLayerChange:function(e){this._handlingClick||this._update();var t=this._getLayer(o(e.target)),n=t.overlay?e.type===`add`?`overlayadd`:`overlayremove`:e.type===`add`?`baselayerchange`:null;n&&this._map.fire(n,t)},_createRadioElement:function(e,t){var n=`<input type="radio" class="leaflet-control-layers-selector" name="`+e+`"`+(t?` checked="checked"`:``)+`/>`,r=document.createElement(`div`);return r.innerHTML=n,r.firstChild},_addItem:function(e){var t=document.createElement(`label`),n=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement(`input`),r.type=`checkbox`,r.className=`leaflet-control-layers-selector`,r.defaultChecked=n):r=this._createRadioElement(`leaflet-base-layers_`+o(this),n),this._layerControlInputs.push(r),r.layerId=o(e.layer),q(r,`click`,this._onInputClick,this);var i=document.createElement(`span`);i.innerHTML=` `+e.name;var a=document.createElement(`span`);return t.appendChild(a),a.appendChild(r),a.appendChild(i),(e.overlay?this._overlaysList:this._baseLayersList).appendChild(t),this._checkDisabledLayers(),t},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,t,n,r=[],i=[];this._handlingClick=!0;for(var a=e.length-1;a>=0;a--)t=e[a],n=this._getLayer(t.layerId).layer,t.checked?r.push(n):t.checked||i.push(n);for(a=0;a<i.length;a++)this._map.hasLayer(i[a])&&this._map.removeLayer(i[a]);for(a=0;a<r.length;a++)this._map.hasLayer(r[a])||this._map.addLayer(r[a]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var e=this._layerControlInputs,t,n,r=this._map.getZoom(),i=e.length-1;i>=0;i--)t=e[i],n=this._getLayer(t.layerId).layer,t.disabled=n.options.minZoom!==void 0&&r<n.options.minZoom||n.options.maxZoom!==void 0&&r>n.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,q(e,`click`,$t),this.expand();var t=this;setTimeout(function(){Gt(e,`click`,$t),t._preventClick=!1})}}),pn=function(e,t,n){return new fn(e,t,n)},mn=un.extend({options:{position:`topleft`,zoomInText:`<span aria-hidden="true">+</span>`,zoomInTitle:`Zoom in`,zoomOutText:`<span aria-hidden="true">−</span>`,zoomOutTitle:`Zoom out`},onAdd:function(e){var t=`leaflet-control-zoom`,n=G(`div`,t+` leaflet-bar`),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,t+`-in`,n,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,t+`-out`,n,this._zoomOut),this._updateDisabled(),e.on(`zoomend zoomlevelschange`,this._updateDisabled,this),n},onRemove:function(e){e.off(`zoomend zoomlevelschange`,this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(e.shiftKey?3:1))},_zoomOut:function(e){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,n,r,i){var a=G(`a`,n,r);return a.innerHTML=e,a.href=`#`,a.title=t,a.setAttribute(`role`,`button`),a.setAttribute(`aria-label`,t),Qt(a),q(a,`click`,en),q(a,`click`,i,this),q(a,`click`,this._refocusOnMap,this),a},_updateDisabled:function(){var e=this._map,t=`leaflet-disabled`;St(this._zoomInButton,t),St(this._zoomOutButton,t),this._zoomInButton.setAttribute(`aria-disabled`,`false`),this._zoomOutButton.setAttribute(`aria-disabled`,`false`),(this._disabled||e._zoom===e.getMinZoom())&&(K(this._zoomOutButton,t),this._zoomOutButton.setAttribute(`aria-disabled`,`true`)),(this._disabled||e._zoom===e.getMaxZoom())&&(K(this._zoomInButton,t),this._zoomInButton.setAttribute(`aria-disabled`,`true`))}});J.mergeOptions({zoomControl:!0}),J.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new mn,this.addControl(this.zoomControl))});var hn=function(e){return new mn(e)},gn=un.extend({options:{position:`bottomleft`,maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t=`leaflet-control-scale`,n=G(`div`,t),r=this.options;return this._addScales(r,t+`-line`,n),e.on(r.updateWhenIdle?`moveend`:`move`,this._update,this),e.whenReady(this._update,this),n},onRemove:function(e){e.off(this.options.updateWhenIdle?`moveend`:`move`,this._update,this)},_addScales:function(e,t,n){e.metric&&(this._mScale=G(`div`,t,n)),e.imperial&&(this._iScale=G(`div`,t,n))},_update:function(){var e=this._map,t=e.getSize().y/2,n=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(n)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),n=t<1e3?t+` m`:t/1e3+` km`;this._updateScale(this._mScale,n,t/e)},_updateImperial:function(e){var t=e*3.2808399,n,r,i;t>5280?(n=t/5280,r=this._getRoundNum(n),this._updateScale(this._iScale,r+` mi`,r/n)):(i=this._getRoundNum(t),this._updateScale(this._iScale,i+` ft`,i/t))},_updateScale:function(e,t,n){e.style.width=Math.round(this.options.maxWidth*n)+`px`,e.innerHTML=t},_getRoundNum:function(e){var t=10**((Math.floor(e)+``).length-1),n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1,t*n}}),_n=function(e){return new gn(e)},vn=un.extend({options:{position:`bottomright`,prefix:`<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">`+(U.inlineSvg?`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg> `:``)+`Leaflet</a>`},initialize:function(e){p(this,e),this._attributions={}},onAdd:function(e){for(var t in e.attributionControl=this,this._container=G(`div`,`leaflet-control-attribution`),Qt(this._container),e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on(`layeradd`,this._addAttribution,this),this._container},onRemove:function(e){e.off(`layeradd`,this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once(`remove`,function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e&&this._attributions[e]&&(this._attributions[e]--,this._update()),this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var n=[];this.options.prefix&&n.push(this.options.prefix),e.length&&n.push(e.join(`, `)),this._container.innerHTML=n.join(` <span aria-hidden="true">|</span> `)}}});J.mergeOptions({attributionControl:!0}),J.addInitHook(function(){this.options.attributionControl&&new vn().addTo(this)}),un.Layers=fn,un.Zoom=mn,un.Scale=gn,un.Attribution=vn,dn.layers=pn,dn.zoom=hn,dn.scale=_n,dn.attribution=function(e){return new vn(e)};var yn=O.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});yn.addTo=function(e,t){return e.addHandler(t,this),this};var bn={Events:A},xn=U.touch?`touchstart mousedown`:`mousedown`,Sn=j.extend({options:{clickTolerance:3},initialize:function(e,t,n,r){p(this,r),this._element=e,this._dragStartTarget=t||e,this._preventOutline=n},enable:function(){this._enabled||=(q(this._dragStartTarget,xn,this._onDown,this),!0)},disable:function(){this._enabled&&(Sn._dragging===this&&this.finishDrag(!0),Gt(this._dragStartTarget,xn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!xt(this._element,`leaflet-zoom-anim`))){if(e.touches&&e.touches.length!==1){Sn._dragging===this&&this.finishDrag();return}if(!(Sn._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(Sn._dragging=this,this._preventOutline&&zt(this._element),Ft(),jt(),!this._moving)){this.fire(`down`);var t=e.touches?e.touches[0]:e,n=Vt(this._element);this._startPoint=new M(t.clientX,t.clientY),this._startPos=At(this._element),this._parentScale=Ht(n);var r=e.type===`mousedown`;q(document,r?`mousemove`:`touchmove`,this._onMove,this),q(document,r?`mouseup`:`touchend touchcancel`,this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var t=e.touches&&e.touches.length===1?e.touches[0]:e,n=new M(t.clientX,t.clientY)._subtract(this._startPoint);!n.x&&!n.y||Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,$t(e),this._moved||(this.fire(`dragstart`),this._moved=!0,K(document.body,`leaflet-dragging`),this._lastTarget=e.target||e.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),K(this._lastTarget,`leaflet-drag-target`)),this._newPos=this._startPos.add(n),this._moving=!0,this._lastEvent=e,this._updatePosition())}},_updatePosition:function(){var e={originalEvent:this._lastEvent};this.fire(`predrag`,e),kt(this._element,this._newPos),this.fire(`drag`,e)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(e){St(document.body,`leaflet-dragging`),this._lastTarget&&=(St(this._lastTarget,`leaflet-drag-target`),null),Gt(document,`mousemove touchmove`,this._onMove,this),Gt(document,`mouseup touchend touchcancel`,this._onUp,this),It(),Mt();var t=this._moved&&this._moving;this._moving=!1,Sn._dragging=!1,t&&this.fire(`dragend`,{noInertia:e,distance:this._newPos.distanceTo(this._startPos)})}});function Cn(e,t,n){var r,i=[1,4,2,8],a,o,s,c,l,u,d,f;for(a=0,u=e.length;a<u;a++)e[a]._code=In(e[a],t);for(s=0;s<4;s++){for(d=i[s],r=[],a=0,u=e.length,o=u-1;a<u;o=a++)c=e[a],l=e[o],c._code&d?l._code&d||(f=Fn(l,c,d,t,n),f._code=In(f,t),r.push(f)):(l._code&d&&(f=Fn(l,c,d,t,n),f._code=In(f,t),r.push(f)),r.push(c));e=r}return e}function wn(e,t){var n,r,i,a,o,s,c,l,u;if(!e||e.length===0)throw Error(`latlngs not passed`);zn(e)||(console.warn(`latlngs are not flat! Only the first ring will be used`),e=e[0]);var d=V([0,0]),f=z(e);f.getNorthWest().distanceTo(f.getSouthWest())*f.getNorthEast().distanceTo(f.getNorthWest())<1700&&(d=Tn(e));var p=e.length,m=[];for(n=0;n<p;n++){var h=V(e[n]);m.push(t.project(V([h.lat-d.lat,h.lng-d.lng])))}for(s=c=l=0,n=0,r=p-1;n<p;r=n++)i=m[n],a=m[r],o=i.y*a.x-a.y*i.x,c+=(i.x+a.x)*o,l+=(i.y+a.y)*o,s+=o*3;u=s===0?m[0]:[c/s,l/s];var g=t.unproject(P(u));return V([g.lat+d.lat,g.lng+d.lng])}function Tn(e){for(var t=0,n=0,r=0,i=0;i<e.length;i++){var a=V(e[i]);t+=a.lat,n+=a.lng,r++}return V([t/r,n/r])}var En={__proto__:null,clipPolygon:Cn,polygonCenter:wn,centroid:Tn};function Dn(e,t){if(!t||!e.length)return e.slice();var n=t*t;return e=Mn(e,n),e=An(e,n),e}function On(e,t,n){return Math.sqrt(Rn(e,t,n,!0))}function kn(e,t,n){return Rn(e,t,n)}function An(e,t){var n=e.length,r=new(typeof Uint8Array<`u`?Uint8Array:Array)(n);r[0]=r[n-1]=1,jn(e,r,t,0,n-1);var i,a=[];for(i=0;i<n;i++)r[i]&&a.push(e[i]);return a}function jn(e,t,n,r,i){var a=0,o,s,c;for(s=r+1;s<=i-1;s++)c=Rn(e[s],e[r],e[i],!0),c>a&&(o=s,a=c);a>n&&(t[o]=1,jn(e,t,n,r,o),jn(e,t,n,o,i))}function Mn(e,t){for(var n=[e[0]],r=1,i=0,a=e.length;r<a;r++)Ln(e[r],e[i])>t&&(n.push(e[r]),i=r);return i<a-1&&n.push(e[a-1]),n}var Nn;function Pn(e,t,n,r,i){var a=r?Nn:In(e,n),o=In(t,n),s,c,l;for(Nn=o;;){if(!(a|o))return[e,t];if(a&o)return!1;s=a||o,c=Fn(e,t,s,n,i),l=In(c,n),s===a?(e=c,a=l):(t=c,o=l)}}function Fn(e,t,n,r,i){var a=t.x-e.x,o=t.y-e.y,s=r.min,c=r.max,l,u;return n&8?(l=e.x+a*(c.y-e.y)/o,u=c.y):n&4?(l=e.x+a*(s.y-e.y)/o,u=s.y):n&2?(l=c.x,u=e.y+o*(c.x-e.x)/a):n&1&&(l=s.x,u=e.y+o*(s.x-e.x)/a),new M(l,u,i)}function In(e,t){var n=0;return e.x<t.min.x?n|=1:e.x>t.max.x&&(n|=2),e.y<t.min.y?n|=4:e.y>t.max.y&&(n|=8),n}function Ln(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function Rn(e,t,n,r){var i=t.x,a=t.y,o=n.x-i,s=n.y-a,c=o*o+s*s,l;return c>0&&(l=((e.x-i)*o+(e.y-a)*s)/c,l>1?(i=n.x,a=n.y):l>0&&(i+=o*l,a+=s*l)),o=e.x-i,s=e.y-a,r?o*o+s*s:new M(i,a)}function zn(e){return!_(e[0])||typeof e[0][0]!=`object`&&e[0][0]!==void 0}function Bn(e){return console.warn(`Deprecated use of _flat, please use L.LineUtil.isFlat instead.`),zn(e)}function Vn(e,t){var n,r,i,a,o,s,c,l;if(!e||e.length===0)throw Error(`latlngs not passed`);zn(e)||(console.warn(`latlngs are not flat! Only the first ring will be used`),e=e[0]);var u=V([0,0]),d=z(e);d.getNorthWest().distanceTo(d.getSouthWest())*d.getNorthEast().distanceTo(d.getNorthWest())<1700&&(u=Tn(e));var f=e.length,p=[];for(n=0;n<f;n++){var m=V(e[n]);p.push(t.project(V([m.lat-u.lat,m.lng-u.lng])))}for(n=0,r=0;n<f-1;n++)r+=p[n].distanceTo(p[n+1])/2;if(r===0)l=p[0];else for(n=0,a=0;n<f-1;n++)if(o=p[n],s=p[n+1],i=o.distanceTo(s),a+=i,a>r){c=(a-r)/i,l=[s.x-c*(s.x-o.x),s.y-c*(s.y-o.y)];break}var h=t.unproject(P(l));return V([h.lat+u.lat,h.lng+u.lng])}var Hn={__proto__:null,simplify:Dn,pointToSegmentDistance:On,closestPointOnSegment:kn,clipSegment:Pn,_getEdgeIntersection:Fn,_getBitCode:In,_sqClosestPointOnSegment:Rn,isFlat:zn,_flat:Bn,polylineCenter:Vn},Un={project:function(e){return new M(e.lng,e.lat)},unproject:function(e){return new B(e.y,e.x)},bounds:new F([-180,-90],[180,90])},Wn={R:6378137,R_MINOR:6356752.314245179,bounds:new F([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(e){var t=Math.PI/180,n=this.R,r=e.lat*t,i=this.R_MINOR/n,a=Math.sqrt(1-i*i),o=a*Math.sin(r),s=Math.tan(Math.PI/4-r/2)/((1-o)/(1+o))**(a/2);return r=-n*Math.log(Math.max(s,1e-10)),new M(e.lng*t*n,r)},unproject:function(e){for(var t=180/Math.PI,n=this.R,r=this.R_MINOR/n,i=Math.sqrt(1-r*r),a=Math.exp(-e.y/n),o=Math.PI/2-2*Math.atan(a),s=0,c=.1,l;s<15&&Math.abs(c)>1e-7;s++)l=i*Math.sin(o),l=((1-l)/(1+l))**(i/2),c=Math.PI/2-2*Math.atan(a*l)-o,o+=c;return new B(o*t,e.x*t/n)}},Gn={__proto__:null,LonLat:Un,Mercator:Wn,SphericalMercator:re},Kn=n({},te,{code:`EPSG:3395`,projection:Wn,transformation:function(){var e=.5/(Math.PI*Wn.R);return ae(e,.5,-e,.5)}()}),qn=n({},te,{code:`EPSG:4326`,projection:Un,transformation:ae(1/180,1,-1/180,.5)}),Jn=n({},ee,{projection:Un,transformation:ae(1,0,-1,0),scale:function(e){return 2**e},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var n=t.lng-e.lng,r=t.lat-e.lat;return Math.sqrt(n*n+r*r)},infinite:!0});ee.Earth=te,ee.EPSG3395=Kn,ee.EPSG3857=oe,ee.EPSG900913=se,ee.EPSG4326=qn,ee.Simple=Jn;var Yn=j.extend({options:{pane:`overlayPane`,attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[o(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[o(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var n=this.getEvents();t.on(n,this),this.once(`remove`,function(){t.off(n,this)},this)}this.onAdd(t),this.fire(`add`),t.fire(`layeradd`,{layer:this})}}});J.include({addLayer:function(e){if(!e._layerAdd)throw Error(`The provided object is not a Layer.`);var t=o(e);return this._layers[t]?this:(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var t=o(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire(`layerremove`,{layer:e}),e.fire(`remove`)),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return o(e)in this._layers},eachLayer:function(e,t){for(var n in this._layers)e.call(t,this._layers[n]);return this},_addLayers:function(e){e=e?_(e)?e:[e]:[];for(var t=0,n=e.length;t<n;t++)this.addLayer(e[t])},_addZoomLimit:function(e){(!isNaN(e.options.maxZoom)||!isNaN(e.options.minZoom))&&(this._zoomBoundLayers[o(e)]=e,this._updateZoomLevels())},_removeZoomLimit:function(e){var t=o(e);this._zoomBoundLayers[t]&&(delete this._zoomBoundLayers[t],this._updateZoomLevels())},_updateZoomLevels:function(){var e=1/0,t=-1/0,n=this._getZoomSpan();for(var r in this._zoomBoundLayers){var i=this._zoomBoundLayers[r].options;e=i.minZoom===void 0?e:Math.min(e,i.minZoom),t=i.maxZoom===void 0?t:Math.max(t,i.maxZoom)}this._layersMaxZoom=t===-1/0?void 0:t,this._layersMinZoom=e===1/0?void 0:e,n!==this._getZoomSpan()&&this.fire(`zoomlevelschange`),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Xn=Yn.extend({initialize:function(e,t){p(this,t),this._layers={};var n,r;if(e)for(n=0,r=e.length;n<r;n++)this.addLayer(e[n])},addLayer:function(e){var t=this.getLayerId(e);return this._layers[t]=e,this._map&&this._map.addLayer(e),this},removeLayer:function(e){var t=e in this._layers?e:this.getLayerId(e);return this._map&&this._layers[t]&&this._map.removeLayer(this._layers[t]),delete this._layers[t],this},hasLayer:function(e){return(typeof e==`number`?e:this.getLayerId(e))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(e){var t=Array.prototype.slice.call(arguments,1),n,r;for(n in this._layers)r=this._layers[n],r[e]&&r[e].apply(r,t);return this},onAdd:function(e){this.eachLayer(e.addLayer,e)},onRemove:function(e){this.eachLayer(e.removeLayer,e)},eachLayer:function(e,t){for(var n in this._layers)e.call(t,this._layers[n]);return this},getLayer:function(e){return this._layers[e]},getLayers:function(){var e=[];return this.eachLayer(e.push,e),e},setZIndex:function(e){return this.invoke(`setZIndex`,e)},getLayerId:function(e){return o(e)}}),Zn=function(e,t){return new Xn(e,t)},Qn=Xn.extend({addLayer:function(e){return this.hasLayer(e)?this:(e.addEventParent(this),Xn.prototype.addLayer.call(this,e),this.fire(`layeradd`,{layer:e}))},removeLayer:function(e){return this.hasLayer(e)?(e in this._layers&&(e=this._layers[e]),e.removeEventParent(this),Xn.prototype.removeLayer.call(this,e),this.fire(`layerremove`,{layer:e})):this},setStyle:function(e){return this.invoke(`setStyle`,e)},bringToFront:function(){return this.invoke(`bringToFront`)},bringToBack:function(){return this.invoke(`bringToBack`)},getBounds:function(){var e=new R;for(var t in this._layers){var n=this._layers[t];e.extend(n.getBounds?n.getBounds():n.getLatLng())}return e}}),$n=function(e,t){return new Qn(e,t)},er=O.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(e){p(this,e)},createIcon:function(e){return this._createIcon(`icon`,e)},createShadow:function(e){return this._createIcon(`shadow`,e)},_createIcon:function(e,t){var n=this._getIconUrl(e);if(!n){if(e===`icon`)throw Error(`iconUrl not set in Icon options (see the docs).`);return null}var r=this._createImg(n,t&&t.tagName===`IMG`?t:null);return this._setIconStyles(r,e),(this.options.crossOrigin||this.options.crossOrigin===``)&&(r.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),r},_setIconStyles:function(e,t){var n=this.options,r=n[t+`Size`];typeof r==`number`&&(r=[r,r]);var i=P(r),a=P(t===`shadow`&&n.shadowAnchor||n.iconAnchor||i&&i.divideBy(2,!0));e.className=`leaflet-marker-`+t+` `+(n.className||``),a&&(e.style.marginLeft=-a.x+`px`,e.style.marginTop=-a.y+`px`),i&&(e.style.width=i.x+`px`,e.style.height=i.y+`px`)},_createImg:function(e,t){return t||=document.createElement(`img`),t.src=e,t},_getIconUrl:function(e){return U.retina&&this.options[e+`RetinaUrl`]||this.options[e+`Url`]}});function tr(e){return new er(e)}var nr=er.extend({options:{iconUrl:`marker-icon.png`,iconRetinaUrl:`marker-icon-2x.png`,shadowUrl:`marker-shadow.png`,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(e){return typeof nr.imagePath!=`string`&&(nr.imagePath=this._detectIconPath()),(this.options.imagePath||nr.imagePath)+er.prototype._getIconUrl.call(this,e)},_stripUrl:function(e){var t=function(e,t,n){var r=t.exec(e);return r&&r[n]};return e=t(e,/^url\((['"])?(.+)\1\)$/,2),e&&t(e,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var e=G(`div`,`leaflet-default-icon-path`,document.body),t=gt(e,`background-image`)||gt(e,`backgroundImage`);if(document.body.removeChild(e),t=this._stripUrl(t),t)return t;var n=document.querySelector(`link[href$="leaflet.css"]`);return n?n.href.substring(0,n.href.length-11-1):``}}),rr=yn.extend({initialize:function(e){this._marker=e},addHooks:function(){var e=this._marker._icon;this._draggable||=new Sn(e,e,!0),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),K(e,`leaflet-marker-draggable`)},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&St(this._marker._icon,`leaflet-marker-draggable`)},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(e){var t=this._marker,n=t._map,r=this._marker.options.autoPanSpeed,i=this._marker.options.autoPanPadding,a=At(t._icon),o=n.getPixelBounds(),s=n.getPixelOrigin(),c=I(o.min._subtract(s).add(i),o.max._subtract(s).subtract(i));if(!c.contains(a)){var l=P((Math.max(c.max.x,a.x)-c.max.x)/(o.max.x-c.max.x)-(Math.min(c.min.x,a.x)-c.min.x)/(o.min.x-c.min.x),(Math.max(c.max.y,a.y)-c.max.y)/(o.max.y-c.max.y)-(Math.min(c.min.y,a.y)-c.min.y)/(o.min.y-c.min.y)).multiplyBy(r);n.panBy(l,{animate:!1}),this._draggable._newPos._add(l),this._draggable._startPos._add(l),kt(t._icon,this._draggable._newPos),this._onDrag(e),this._panRequest=T(this._adjustPan.bind(this,e))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire(`movestart`).fire(`dragstart`)},_onPreDrag:function(e){this._marker.options.autoPan&&(E(this._panRequest),this._panRequest=T(this._adjustPan.bind(this,e)))},_onDrag:function(e){var t=this._marker,n=t._shadow,r=At(t._icon),i=t._map.layerPointToLatLng(r);n&&kt(n,r),t._latlng=i,e.latlng=i,e.oldLatLng=this._oldLatLng,t.fire(`move`,e).fire(`drag`,e)},_onDragEnd:function(e){E(this._panRequest),delete this._oldLatLng,this._marker.fire(`moveend`).fire(`dragend`,e)}}),ir=Yn.extend({options:{icon:new nr,interactive:!0,keyboard:!0,title:``,alt:`Marker`,zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:`markerPane`,shadowPane:`shadowPane`,bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(e,t){p(this,t),this._latlng=V(e)},onAdd:function(e){this._zoomAnimated=this._zoomAnimated&&e.options.markerZoomAnimation,this._zoomAnimated&&e.on(`zoomanim`,this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(e){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&e.off(`zoomanim`,this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(e){var t=this._latlng;return this._latlng=V(e),this.update(),this.fire(`move`,{oldLatLng:t,latlng:this._latlng})},setZIndexOffset:function(e){return this.options.zIndexOffset=e,this.update()},getIcon:function(){return this.options.icon},setIcon:function(e){return this.options.icon=e,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var e=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(e)}return this},_initIcon:function(){var e=this.options,t=`leaflet-zoom-`+(this._zoomAnimated?`animated`:`hide`),n=e.icon.createIcon(this._icon),r=!1;n!==this._icon&&(this._icon&&this._removeIcon(),r=!0,e.title&&(n.title=e.title),n.tagName===`IMG`&&(n.alt=e.alt||``)),K(n,t),e.keyboard&&(n.tabIndex=`0`,n.setAttribute(`role`,`button`)),this._icon=n,e.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&q(n,`focus`,this._panOnFocus,this);var i=e.icon.createShadow(this._shadow),a=!1;i!==this._shadow&&(this._removeShadow(),a=!0),i&&(K(i,t),i.alt=``),this._shadow=i,e.opacity<1&&this._updateOpacity(),r&&this.getPane().appendChild(this._icon),this._initInteraction(),i&&a&&this.getPane(e.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Gt(this._icon,`focus`,this._panOnFocus,this),_t(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&_t(this._shadow),this._shadow=null},_setPos:function(e){this._icon&&kt(this._icon,e),this._shadow&&kt(this._shadow,e),this._zIndex=e.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(e){this._icon&&(this._icon.style.zIndex=this._zIndex+e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center).round();this._setPos(t)},_initInteraction:function(){if(this.options.interactive&&(K(this._icon,`leaflet-interactive`),this.addInteractiveTarget(this._icon),rr)){var e=this.options.draggable;this.dragging&&(e=this.dragging.enabled(),this.dragging.disable()),this.dragging=new rr(this),e&&this.dragging.enable()}},setOpacity:function(e){return this.options.opacity=e,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var e=this.options.opacity;this._icon&&Tt(this._icon,e),this._shadow&&Tt(this._shadow,e)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var e=this._map;if(e){var t=this.options.icon.options,n=t.iconSize?P(t.iconSize):P(0,0),r=t.iconAnchor?P(t.iconAnchor):P(0,0);e.panInside(this._latlng,{paddingTopLeft:r,paddingBottomRight:n.subtract(r)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function ar(e,t){return new ir(e,t)}var or=Yn.extend({options:{stroke:!0,color:`#3388ff`,weight:3,opacity:1,lineCap:`round`,lineJoin:`round`,dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:`evenodd`,interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(e){this._renderer=e.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(e){return p(this,e),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&e&&Object.prototype.hasOwnProperty.call(e,`weight`)&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),sr=or.extend({options:{fill:!0,radius:10},initialize:function(e,t){p(this,t),this._latlng=V(e),this._radius=this.options.radius},setLatLng:function(e){var t=this._latlng;return this._latlng=V(e),this.redraw(),this.fire(`move`,{oldLatLng:t,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(e){return this.options.radius=this._radius=e,this.redraw()},getRadius:function(){return this._radius},setStyle:function(e){var t=e&&e.radius||this._radius;return or.prototype.setStyle.call(this,e),this.setRadius(t),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var e=this._radius,t=this._radiusY||e,n=this._clickTolerance(),r=[e+n,t+n];this._pxBounds=new F(this._point.subtract(r),this._point.add(r))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(e){return e.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function cr(e,t){return new sr(e,t)}var lr=sr.extend({initialize:function(e,t,r){if(typeof t==`number`&&(t=n({},r,{radius:t})),p(this,t),this._latlng=V(e),isNaN(this.options.radius))throw Error(`Circle radius cannot be NaN`);this._mRadius=this.options.radius},setRadius:function(e){return this._mRadius=e,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var e=[this._radius,this._radiusY||this._radius];return new R(this._map.layerPointToLatLng(this._point.subtract(e)),this._map.layerPointToLatLng(this._point.add(e)))},setStyle:or.prototype.setStyle,_project:function(){var e=this._latlng.lng,t=this._latlng.lat,n=this._map,r=n.options.crs;if(r.distance===te.distance){var i=Math.PI/180,a=this._mRadius/te.R/i,o=n.project([t+a,e]),s=n.project([t-a,e]),c=o.add(s).divideBy(2),l=n.unproject(c).lat,u=Math.acos((Math.cos(a*i)-Math.sin(t*i)*Math.sin(l*i))/(Math.cos(t*i)*Math.cos(l*i)))/i;(isNaN(u)||u===0)&&(u=a/Math.cos(Math.PI/180*t)),this._point=c.subtract(n.getPixelOrigin()),this._radius=isNaN(u)?0:c.x-n.project([l,e-u]).x,this._radiusY=c.y-o.y}else{var d=r.unproject(r.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(d).x}this._updateBounds()}});function ur(e,t,n){return new lr(e,t,n)}var dr=or.extend({options:{smoothFactor:1,noClip:!1},initialize:function(e,t){p(this,t),this._setLatLngs(e)},getLatLngs:function(){return this._latlngs},setLatLngs:function(e){return this._setLatLngs(e),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(e){for(var t=1/0,n=null,r=Rn,i,a,o=0,s=this._parts.length;o<s;o++)for(var c=this._parts[o],l=1,u=c.length;l<u;l++){i=c[l-1],a=c[l];var d=r(e,i,a,!0);d<t&&(t=d,n=r(e,i,a))}return n&&(n.distance=Math.sqrt(t)),n},getCenter:function(){if(!this._map)throw Error(`Must add layer to map before using getCenter()`);return Vn(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(e,t){return t||=this._defaultShape(),e=V(e),t.push(e),this._bounds.extend(e),this.redraw()},_setLatLngs:function(e){this._bounds=new R,this._latlngs=this._convertLatLngs(e)},_defaultShape:function(){return zn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(e){for(var t=[],n=zn(e),r=0,i=e.length;r<i;r++)n?(t[r]=V(e[r]),this._bounds.extend(t[r])):t[r]=this._convertLatLngs(e[r]);return t},_project:function(){var e=new F;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,e),this._bounds.isValid()&&e.isValid()&&(this._rawPxBounds=e,this._updateBounds())},_updateBounds:function(){var e=this._clickTolerance(),t=new M(e,e);this._rawPxBounds&&(this._pxBounds=new F([this._rawPxBounds.min.subtract(t),this._rawPxBounds.max.add(t)]))},_projectLatlngs:function(e,t,n){var r=e[0]instanceof B,i=e.length,a,o;if(r){for(o=[],a=0;a<i;a++)o[a]=this._map.latLngToLayerPoint(e[a]),n.extend(o[a]);t.push(o)}else for(a=0;a<i;a++)this._projectLatlngs(e[a],t,n)},_clipPoints:function(){var e=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}var t=this._parts,n,r,i,a,o,s,c;for(n=0,i=0,a=this._rings.length;n<a;n++)for(c=this._rings[n],r=0,o=c.length;r<o-1;r++)s=Pn(c[r],c[r+1],e,r,!0),s&&(t[i]=t[i]||[],t[i].push(s[0]),(s[1]!==c[r+1]||r===o-2)&&(t[i].push(s[1]),i++))}},_simplifyPoints:function(){for(var e=this._parts,t=this.options.smoothFactor,n=0,r=e.length;n<r;n++)e[n]=Dn(e[n],t)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(e,t){var n,r,i,a,o,s,c=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(n=0,a=this._parts.length;n<a;n++)for(s=this._parts[n],r=0,o=s.length,i=o-1;r<o;i=r++)if(!(!t&&r===0)&&On(e,s[i],s[r])<=c)return!0;return!1}});function fr(e,t){return new dr(e,t)}dr._flat=Bn;var pr=dr.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw Error(`Must add layer to map before using getCenter()`);return wn(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(e){var t=dr.prototype._convertLatLngs.call(this,e),n=t.length;return n>=2&&t[0]instanceof B&&t[0].equals(t[n-1])&&t.pop(),t},_setLatLngs:function(e){dr.prototype._setLatLngs.call(this,e),zn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return zn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,n=new M(t,t);if(e=new F(e.min.subtract(n),e.max.add(n)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,i=this._rings.length,a;r<i;r++)a=Cn(this._rings[r],e,!0),a.length&&this._parts.push(a)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(e){var t=!1,n,r,i,a,o,s,c,l;if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(a=0,c=this._parts.length;a<c;a++)for(n=this._parts[a],o=0,l=n.length,s=l-1;o<l;s=o++)r=n[o],i=n[s],r.y>e.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(t=!t);return t||dr.prototype._containsPoint.call(this,e,!0)}});function mr(e,t){return new pr(e,t)}var hr=Qn.extend({initialize:function(e,t){p(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t=_(e)?e:e.features,n,r,i;if(t){for(n=0,r=t.length;n<r;n++)i=t[n],(i.geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var a=this.options;if(a.filter&&!a.filter(e))return this;var o=gr(e,a);return o?(o.feature=Cr(e),o.defaultOptions=o.options,this.resetStyle(o),a.onEachFeature&&a.onEachFeature(e,o),this.addLayer(o)):this},resetStyle:function(e){return e===void 0?this.eachLayer(this.resetStyle,this):(e.options=n({},e.defaultOptions),this._setLayerStyle(e,this.options.style),this)},setStyle:function(e){return this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(e,t){e.setStyle&&(typeof t==`function`&&(t=t(e.feature)),e.setStyle(t))}});function gr(e,t){var n=e.type===`Feature`?e.geometry:e,r=n?n.coordinates:null,i=[],a=t&&t.pointToLayer,o=t&&t.coordsToLatLng||vr,s,c,l,u;if(!r&&!n)return null;switch(n.type){case`Point`:return s=o(r),_r(a,e,s,t);case`MultiPoint`:for(l=0,u=r.length;l<u;l++)s=o(r[l]),i.push(_r(a,e,s,t));return new Qn(i);case`LineString`:case`MultiLineString`:return c=yr(r,n.type===`LineString`?0:1,o),new dr(c,t);case`Polygon`:case`MultiPolygon`:return c=yr(r,n.type===`Polygon`?1:2,o),new pr(c,t);case`GeometryCollection`:for(l=0,u=n.geometries.length;l<u;l++){var d=gr({geometry:n.geometries[l],type:`Feature`,properties:e.properties},t);d&&i.push(d)}return new Qn(i);case`FeatureCollection`:for(l=0,u=n.features.length;l<u;l++){var f=gr(n.features[l],t);f&&i.push(f)}return new Qn(i);default:throw Error(`Invalid GeoJSON object.`)}}function _r(e,t,n,r){return e?e(t,n):new ir(n,r&&r.markersInheritOptions&&r)}function vr(e){return new B(e[1],e[0],e[2])}function yr(e,t,n){for(var r=[],i=0,a=e.length,o;i<a;i++)o=t?yr(e[i],t-1,n):(n||vr)(e[i]),r.push(o);return r}function br(e,t){return e=V(e),e.alt===void 0?[u(e.lng,t),u(e.lat,t)]:[u(e.lng,t),u(e.lat,t),u(e.alt,t)]}function xr(e,t,n,r){for(var i=[],a=0,o=e.length;a<o;a++)i.push(t?xr(e[a],zn(e[a])?0:t-1,n,r):br(e[a],r));return!t&&n&&i.length>0&&i.push(i[0].slice()),i}function Sr(e,t){return e.feature?n({},e.feature,{geometry:t}):Cr(t)}function Cr(e){return e.type===`Feature`||e.type===`FeatureCollection`?e:{type:`Feature`,properties:{},geometry:e}}var wr={toGeoJSON:function(e){return Sr(this,{type:`Point`,coordinates:br(this.getLatLng(),e)})}};ir.include(wr),lr.include(wr),sr.include(wr),dr.include({toGeoJSON:function(e){var t=!zn(this._latlngs),n=xr(this._latlngs,t?1:0,!1,e);return Sr(this,{type:(t?`Multi`:``)+`LineString`,coordinates:n})}}),pr.include({toGeoJSON:function(e){var t=!zn(this._latlngs),n=t&&!zn(this._latlngs[0]),r=xr(this._latlngs,n?2:t?1:0,!0,e);return t||(r=[r]),Sr(this,{type:(n?`Multi`:``)+`Polygon`,coordinates:r})}}),Xn.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(n){t.push(n.toGeoJSON(e).geometry.coordinates)}),Sr(this,{type:`MultiPoint`,coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(t===`MultiPoint`)return this.toMultiPoint(e);var n=t===`GeometryCollection`,r=[];return this.eachLayer(function(t){if(t.toGeoJSON){var i=t.toGeoJSON(e);if(n)r.push(i.geometry);else{var a=Cr(i);a.type===`FeatureCollection`?r.push.apply(r,a.features):r.push(a)}}}),n?Sr(this,{geometries:r,type:`GeometryCollection`}):{type:`FeatureCollection`,features:r}}});function Tr(e,t){return new hr(e,t)}var Er=Tr,Dr=Yn.extend({options:{opacity:1,alt:``,interactive:!1,crossOrigin:!1,errorOverlayUrl:``,zIndex:1,className:``},initialize:function(e,t,n){this._url=e,this._bounds=z(t),p(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(K(this._image,`leaflet-interactive`),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){_t(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&&yt(this._image),this},bringToBack:function(){return this._map&&bt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=z(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName===`IMG`,t=this._image=e?this._url:G(`img`);if(K(t,`leaflet-image-layer`),this._zoomAnimated&&K(t,`leaflet-zoom-animated`),this.options.className&&K(t,this.options.className),t.onselectstart=l,t.onmousemove=l,t.onload=i(this.fire,this,`load`),t.onerror=i(this._overlayOnError,this,`error`),(this.options.crossOrigin||this.options.crossOrigin===``)&&(t.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=t.src;return}t.src=this._url,t.alt=this.options.alt},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Ot(this._image,n,t)},_reset:function(){var e=this._image,t=new F(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=t.getSize();kt(e,t.min),e.style.width=n.x+`px`,e.style.height=n.y+`px`},_updateOpacity:function(){Tt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire(`error`);var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),Or=function(e,t,n){return new Dr(e,t,n)},kr=Dr.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName===`VIDEO`,t=this._image=e?this._url:G(`video`);if(K(t,`leaflet-image-layer`),this._zoomAnimated&&K(t,`leaflet-zoom-animated`),this.options.className&&K(t,this.options.className),t.onselectstart=l,t.onmousemove=l,t.onloadeddata=i(this.fire,this,`load`),e){for(var n=t.getElementsByTagName(`source`),r=[],a=0;a<n.length;a++)r.push(n[a].src);this._url=n.length>0?r:[t.src];return}_(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,`objectFit`)&&(t.style.objectFit=`fill`),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var o=0;o<this._url.length;o++){var s=G(`source`);s.src=this._url[o],t.appendChild(s)}}});function Ar(e,t,n){return new kr(e,t,n)}var jr=Dr.extend({_initImage:function(){var e=this._image=this._url;K(e,`leaflet-image-layer`),this._zoomAnimated&&K(e,`leaflet-zoom-animated`),this.options.className&&K(e,this.options.className),e.onselectstart=l,e.onmousemove=l}});function Mr(e,t,n){return new jr(e,t,n)}var Nr=Yn.extend({options:{interactive:!1,offset:[0,0],className:``,pane:void 0,content:``},initialize:function(e,t){e&&(e instanceof B||_(e))?(this._latlng=V(e),p(this,t)):(p(this,e),this._source=t),this.options.content&&(this._content=this.options.content)},openOn:function(e){return e=arguments.length?e:this._source._map,e.hasLayer(this)||e.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(e){return this._map?this.close():(arguments.length?this._source=e:e=this._source,this._prepareOpen(),this.openOn(e._map)),this},onAdd:function(e){this._zoomAnimated=e._zoomAnimated,this._container||this._initLayout(),e._fadeAnimated&&Tt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),e._fadeAnimated&&Tt(this._container,1),this.bringToFront(),this.options.interactive&&(K(this._container,`leaflet-interactive`),this.addInteractiveTarget(this._container))},onRemove:function(e){e._fadeAnimated?(Tt(this._container,0),this._removeTimeout=setTimeout(i(_t,void 0,this._container),200)):_t(this._container),this.options.interactive&&(St(this._container,`leaflet-interactive`),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(e){return this._latlng=V(e),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(e){return this._content=e,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility=`hidden`,this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility=``,this._adjustPan())},getEvents:function(){var e={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&yt(this._container),this},bringToBack:function(){return this._map&&bt(this._container),this},_prepareOpen:function(e){var t=this._source;if(!t._map)return!1;if(t instanceof Qn){t=null;var n=this._source._layers;for(var r in n)if(n[r]._map){t=n[r];break}if(!t)return!1;this._source=t}if(!e)if(t.getCenter)e=t.getCenter();else if(t.getLatLng)e=t.getLatLng();else if(t.getBounds)e=t.getBounds().getCenter();else throw Error(`Unable to get source layer LatLng.`);return this.setLatLng(e),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var e=this._contentNode,t=typeof this._content==`function`?this._content(this._source||this):this._content;if(typeof t==`string`)e.innerHTML=t;else{for(;e.hasChildNodes();)e.removeChild(e.firstChild);e.appendChild(t)}this.fire(`contentupdate`)}},_updatePosition:function(){if(this._map){var e=this._map.latLngToLayerPoint(this._latlng),t=P(this.options.offset),n=this._getAnchor();this._zoomAnimated?kt(this._container,e.add(n)):t=t.add(e).add(n);var r=this._containerBottom=-t.y,i=this._containerLeft=-Math.round(this._containerWidth/2)+t.x;this._container.style.bottom=r+`px`,this._container.style.left=i+`px`}},_getAnchor:function(){return[0,0]}});J.include({_initOverlay:function(e,t,n,r){var i=t;return i instanceof e||(i=new e(r).setContent(t)),n&&i.setLatLng(n),i}}),Yn.include({_initOverlay:function(e,t,n,r){var i=n;return i instanceof e?(p(i,r),i._source=this):(i=t&&!r?t:new e(r,this),i.setContent(n)),i}});var Pr=Nr.extend({options:{pane:`popupPane`,offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:``},openOn:function(e){return e=arguments.length?e:this._source._map,!e.hasLayer(this)&&e._popup&&e._popup.options.autoClose&&e.removeLayer(e._popup),e._popup=this,Nr.prototype.openOn.call(this,e)},onAdd:function(e){Nr.prototype.onAdd.call(this,e),e.fire(`popupopen`,{popup:this}),this._source&&(this._source.fire(`popupopen`,{popup:this},!0),this._source instanceof or||this._source.on(`preclick`,Xt))},onRemove:function(e){Nr.prototype.onRemove.call(this,e),e.fire(`popupclose`,{popup:this}),this._source&&(this._source.fire(`popupclose`,{popup:this},!0),this._source instanceof or||this._source.off(`preclick`,Xt))},getEvents:function(){var e=Nr.prototype.getEvents.call(this);return(this.options.closeOnClick===void 0?this._map.options.closePopupOnClick:this.options.closeOnClick)&&(e.preclick=this.close),this.options.keepInView&&(e.moveend=this._adjustPan),e},_initLayout:function(){var e=`leaflet-popup`,t=this._container=G(`div`,e+` `+(this.options.className||``)+` leaflet-zoom-animated`),n=this._wrapper=G(`div`,e+`-content-wrapper`,t);if(this._contentNode=G(`div`,e+`-content`,n),Qt(t),Zt(this._contentNode),q(t,`contextmenu`,Xt),this._tipContainer=G(`div`,e+`-tip-container`,t),this._tip=G(`div`,e+`-tip`,this._tipContainer),this.options.closeButton){var r=this._closeButton=G(`a`,e+`-close-button`,t);r.setAttribute(`role`,`button`),r.setAttribute(`aria-label`,`Close popup`),r.href=`#close`,r.innerHTML=`<span aria-hidden="true">×</span>`,q(r,`click`,function(e){$t(e),this.close()},this)}},_updateLayout:function(){var e=this._contentNode,t=e.style;t.width=``,t.whiteSpace=`nowrap`;var n=e.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),t.width=n+1+`px`,t.whiteSpace=``,t.height=``;var r=e.offsetHeight,i=this.options.maxHeight,a=`leaflet-popup-scrolled`;i&&r>i?(t.height=i+`px`,K(e,a)):St(e,a),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),n=this._getAnchor();kt(this._container,t.add(n))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,t=parseInt(gt(this._container,`marginBottom`),10)||0,n=this._container.offsetHeight+t,r=this._containerWidth,i=new M(this._containerLeft,-n-this._containerBottom);i._add(At(this._container));var a=e.layerPointToContainerPoint(i),o=P(this.options.autoPanPadding),s=P(this.options.autoPanPaddingTopLeft||o),c=P(this.options.autoPanPaddingBottomRight||o),l=e.getSize(),u=0,d=0;a.x+r+c.x>l.x&&(u=a.x+r-l.x+c.x),a.x-u-s.x<0&&(u=a.x-s.x),a.y+n+c.y>l.y&&(d=a.y+n-l.y+c.y),a.y-d-s.y<0&&(d=a.y-s.y),(u||d)&&(this.options.keepInView&&(this._autopanning=!0),e.fire(`autopanstart`).panBy([u,d]))}},_getAnchor:function(){return P(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Fr=function(e,t){return new Pr(e,t)};J.mergeOptions({closePopupOnClick:!0}),J.include({openPopup:function(e,t,n){return this._initOverlay(Pr,e,t,n).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),Yn.include({bindPopup:function(e,t){return this._popup=this._initOverlay(Pr,this._popup,e,t),this._popupHandlersAdded||=(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),!0),this},unbindPopup:function(){return this._popup&&=(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,null),this},openPopup:function(e){return this._popup&&(this instanceof Qn||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){en(e);var t=e.layer||e.target;if(this._popup._source===t&&!(t instanceof or)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=t,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var Ir=Nr.extend({options:{pane:`tooltipPane`,offset:[0,0],direction:`auto`,permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Nr.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire(`tooltipopen`,{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire(`tooltipopen`,{tooltip:this},!0))},onRemove:function(e){Nr.prototype.onRemove.call(this,e),e.fire(`tooltipclose`,{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire(`tooltipclose`,{tooltip:this},!0))},getEvents:function(){var e=Nr.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){this._contentNode=this._container=G(`div`,`leaflet-tooltip `+(this.options.className||``)+` leaflet-zoom-`+(this._zoomAnimated?`animated`:`hide`)),this._container.setAttribute(`role`,`tooltip`),this._container.setAttribute(`id`,`leaflet-tooltip-`+o(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,n,r=this._map,i=this._container,a=r.latLngToContainerPoint(r.getCenter()),o=r.layerPointToContainerPoint(e),s=this.options.direction,c=i.offsetWidth,l=i.offsetHeight,u=P(this.options.offset),d=this._getAnchor();s===`top`?(t=c/2,n=l):s===`bottom`?(t=c/2,n=0):s===`center`?(t=c/2,n=l/2):s===`right`?(t=0,n=l/2):s===`left`?(t=c,n=l/2):o.x<a.x?(s=`right`,t=0,n=l/2):(s=`left`,t=c+(u.x+d.x)*2,n=l/2),e=e.subtract(P(t,n,!0)).add(u).add(d),St(i,`leaflet-tooltip-right`),St(i,`leaflet-tooltip-left`),St(i,`leaflet-tooltip-top`),St(i,`leaflet-tooltip-bottom`),K(i,`leaflet-tooltip-`+s),kt(i,e)},_updatePosition:function(){var e=this._map.latLngToLayerPoint(this._latlng);this._setPosition(e)},setOpacity:function(e){this.options.opacity=e,this._container&&Tt(this._container,e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);this._setPosition(t)},_getAnchor:function(){return P(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Lr=function(e,t){return new Ir(e,t)};J.include({openTooltip:function(e,t,n){return this._initOverlay(Ir,e,t,n).openOn(this),this},closeTooltip:function(e){return e.close(),this}}),Yn.include({bindTooltip:function(e,t){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Ir,this._tooltip,e,t),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&=(this._initTooltipInteractions(!0),this.closeTooltip(),null),this},_initTooltipInteractions:function(e){if(!(!e&&this._tooltipHandlersAdded)){var t=e?`off`:`on`,n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,n.click=this._openTooltip,this._map?this._addFocusListeners():n.add=this._addFocusListeners),this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),this[t](n),this._tooltipHandlersAdded=!e}},openTooltip:function(e){return this._tooltip&&(this instanceof Qn||(this._tooltip._source=this),this._tooltip._prepareOpen(e)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(e){return this._tooltip&&this._tooltip.setContent(e),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(e){var t=typeof e.getElement==`function`&&e.getElement();t&&(q(t,`focus`,function(){this._tooltip._source=e,this.openTooltip()},this),q(t,`blur`,this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(e){var t=typeof e.getElement==`function`&&e.getElement();t&&t.setAttribute(`aria-describedby`,this._tooltip._container.id)},_openTooltip:function(e){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var t=this;this._map.once(`moveend`,function(){t._openOnceFlag=!1,t._openTooltip(e)});return}this._tooltip._source=e.layer||e.target,this.openTooltip(this._tooltip.options.sticky?e.latlng:void 0)}},_moveTooltip:function(e){var t=e.latlng,n,r;this._tooltip.options.sticky&&e.originalEvent&&(n=this._map.mouseEventToContainerPoint(e.originalEvent),r=this._map.containerPointToLayerPoint(n),t=this._map.layerPointToLatLng(r)),this._tooltip.setLatLng(t)}});var Rr=er.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:`leaflet-div-icon`},createIcon:function(e){var t=e&&e.tagName===`DIV`?e:document.createElement(`div`),n=this.options;if(n.html instanceof Element?(vt(t),t.appendChild(n.html)):t.innerHTML=n.html===!1?``:n.html,n.bgPos){var r=P(n.bgPos);t.style.backgroundPosition=-r.x+`px `+-r.y+`px`}return this._setIconStyles(t,`icon`),t},createShadow:function(){return null}});function zr(e){return new Rr(e)}er.Default=nr;var Br=Yn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:U.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:`tilePane`,className:``,keepBuffer:2},initialize:function(e){p(this,e)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(e){e._addZoomLimit(this)},onRemove:function(e){this._removeAllTiles(),_t(this._container),e._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(yt(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(bt(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(e){return this.options.opacity=e,this._updateOpacity(),this},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var e=this._clampZoom(this._map.getZoom());e!==this._tileZoom&&(this._tileZoom=e,this._updateLevels()),this._update()}return this},getEvents:function(){var e={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||=s(this._onMoveEnd,this.options.updateInterval,this),e.move=this._onMove),this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},createTile:function(){return document.createElement(`div`)},getTileSize:function(){var e=this.options.tileSize;return e instanceof M?e:new M(e,e)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(e){for(var t=this.getPane().children,n=-e(-1/0,1/0),r=0,i=t.length,a;r<i;r++)a=t[r].style.zIndex,t[r]!==this._container&&a&&(n=e(n,+a));isFinite(n)&&(this.options.zIndex=n+e(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!U.ielt9){Tt(this._container,this.options.opacity);var e=+new Date,t=!1,n=!1;for(var r in this._tiles){var i=this._tiles[r];if(!(!i.current||!i.loaded)){var a=Math.min(1,(e-i.loaded)/200);Tt(i.el,a),a<1?t=!0:(i.active?n=!0:this._onOpaqueTile(i),i.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),t&&(E(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this))}},_onOpaqueTile:l,_initContainer:function(){this._container||(this._container=G(`div`,`leaflet-layer `+(this.options.className||``)),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var e=this._tileZoom,t=this.options.maxZoom;if(e!==void 0){for(var n in this._levels)n=Number(n),this._levels[n].el.children.length||n===e?(this._levels[n].el.style.zIndex=t-Math.abs(e-n),this._onUpdateLevel(n)):(_t(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var r=this._levels[e],i=this._map;return r||(r=this._levels[e]={},r.el=G(`div`,`leaflet-tile-container leaflet-zoom-animated`,this._container),r.el.style.zIndex=t,r.origin=i.project(i.unproject(i.getPixelOrigin()),e).round(),r.zoom=e,this._setZoomTransform(r,i.getCenter(),i.getZoom()),r.el.offsetWidth,this._onCreateLevel(r)),this._level=r,r}},_onUpdateLevel:l,_onRemoveLevel:l,_onCreateLevel:l,_pruneTiles:function(){if(this._map){var e,t,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom){this._removeAllTiles();return}for(e in this._tiles)t=this._tiles[e],t.retain=t.current;for(e in this._tiles)if(t=this._tiles[e],t.current&&!t.active){var r=t.coords;this._retainParent(r.x,r.y,r.z,r.z-5)||this._retainChildren(r.x,r.y,r.z,r.z+2)}for(e in this._tiles)this._tiles[e].retain||this._removeTile(e)}},_removeTilesAtZoom:function(e){for(var t in this._tiles)this._tiles[t].coords.z===e&&this._removeTile(t)},_removeAllTiles:function(){for(var e in this._tiles)this._removeTile(e)},_invalidateAll:function(){for(var e in this._levels)_t(this._levels[e].el),this._onRemoveLevel(Number(e)),delete this._levels[e];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(e,t,n,r){var i=Math.floor(e/2),a=Math.floor(t/2),o=n-1,s=new M(+i,+a);s.z=+o;var c=this._tileCoordsToKey(s),l=this._tiles[c];return l&&l.active?(l.retain=!0,!0):(l&&l.loaded&&(l.retain=!0),o>r?this._retainParent(i,a,o,r):!1)},_retainChildren:function(e,t,n,r){for(var i=2*e;i<2*e+2;i++)for(var a=2*t;a<2*t+2;a++){var o=new M(i,a);o.z=n+1;var s=this._tileCoordsToKey(o),c=this._tiles[s];if(c&&c.active){c.retain=!0;continue}else c&&c.loaded&&(c.retain=!0);n+1<r&&this._retainChildren(i,a,n+1,r)}},_resetView:function(e){var t=e&&(e.pinch||e.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),t,t)},_animateZoom:function(e){this._setView(e.center,e.zoom,!0,e.noUpdate)},_clampZoom:function(e){var t=this.options;return t.minNativeZoom!==void 0&&e<t.minNativeZoom?t.minNativeZoom:t.maxNativeZoom!==void 0&&t.maxNativeZoom<e?t.maxNativeZoom:e},_setView:function(e,t,n,r){var i=Math.round(t);i=this.options.maxZoom!==void 0&&i>this.options.maxZoom||this.options.minZoom!==void 0&&i<this.options.minZoom?void 0:this._clampZoom(i);var a=this.options.updateWhenZooming&&i!==this._tileZoom;(!r||a)&&(this._tileZoom=i,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),i!==void 0&&this._update(e),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(e,t)},_setZoomTransforms:function(e,t){for(var n in this._levels)this._setZoomTransform(this._levels[n],e,t)},_setZoomTransform:function(e,t,n){var r=this._map.getZoomScale(n,e.zoom),i=e.origin.multiplyBy(r).subtract(this._map._getNewPixelOrigin(t,n)).round();U.any3d?Ot(e.el,i,r):kt(e.el,i)},_resetGrid:function(){var e=this._map,t=e.options.crs,n=this._tileSize=this.getTileSize(),r=this._tileZoom,i=this._map.getPixelWorldBounds(this._tileZoom);i&&(this._globalTileRange=this._pxBoundsToTileRange(i)),this._wrapX=t.wrapLng&&!this.options.noWrap&&[Math.floor(e.project([0,t.wrapLng[0]],r).x/n.x),Math.ceil(e.project([0,t.wrapLng[1]],r).x/n.y)],this._wrapY=t.wrapLat&&!this.options.noWrap&&[Math.floor(e.project([t.wrapLat[0],0],r).y/n.x),Math.ceil(e.project([t.wrapLat[1],0],r).y/n.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(e){var t=this._map,n=t._animatingZoom?Math.max(t._animateToZoom,t.getZoom()):t.getZoom(),r=t.getZoomScale(n,this._tileZoom),i=t.project(e,this._tileZoom).floor(),a=t.getSize().divideBy(r*2);return new F(i.subtract(a),i.add(a))},_update:function(e){var t=this._map;if(t){var n=this._clampZoom(t.getZoom());if(e===void 0&&(e=t.getCenter()),this._tileZoom!==void 0){var r=this._getTiledPixelBounds(e),i=this._pxBoundsToTileRange(r),a=i.getCenter(),o=[],s=this.options.keepBuffer,c=new F(i.getBottomLeft().subtract([s,-s]),i.getTopRight().add([s,-s]));if(!(isFinite(i.min.x)&&isFinite(i.min.y)&&isFinite(i.max.x)&&isFinite(i.max.y)))throw Error(`Attempted to load an infinite number of tiles`);for(var l in this._tiles){var u=this._tiles[l].coords;(u.z!==this._tileZoom||!c.contains(new M(u.x,u.y)))&&(this._tiles[l].current=!1)}if(Math.abs(n-this._tileZoom)>1){this._setView(e,n);return}for(var d=i.min.y;d<=i.max.y;d++)for(var f=i.min.x;f<=i.max.x;f++){var p=new M(f,d);if(p.z=this._tileZoom,this._isValidTile(p)){var m=this._tiles[this._tileCoordsToKey(p)];m?m.current=!0:o.push(p)}}if(o.sort(function(e,t){return e.distanceTo(a)-t.distanceTo(a)}),o.length!==0){this._loading||(this._loading=!0,this.fire(`loading`));var h=document.createDocumentFragment();for(f=0;f<o.length;f++)this._addTile(o[f],h);this._level.el.appendChild(h)}}}},_isValidTile:function(e){var t=this._map.options.crs;if(!t.infinite){var n=this._globalTileRange;if(!t.wrapLng&&(e.x<n.min.x||e.x>n.max.x)||!t.wrapLat&&(e.y<n.min.y||e.y>n.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return z(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,n=this.getTileSize(),r=e.scaleBy(n),i=r.add(n);return[t.unproject(r,e.z),t.unproject(i,e.z)]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),n=new R(t[0],t[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(e){return e.x+`:`+e.y+`:`+e.z},_keyToTileCoords:function(e){var t=e.split(`:`),n=new M(+t[0],+t[1]);return n.z=+t[2],n},_removeTile:function(e){var t=this._tiles[e];t&&(_t(t.el),delete this._tiles[e],this.fire(`tileunload`,{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){K(e,`leaflet-tile`);var t=this.getTileSize();e.style.width=t.x+`px`,e.style.height=t.y+`px`,e.onselectstart=l,e.onmousemove=l,U.ielt9&&this.options.opacity<1&&Tt(e,this.options.opacity)},_addTile:function(e,t){var n=this._getTilePos(e),r=this._tileCoordsToKey(e),a=this.createTile(this._wrapCoords(e),i(this._tileReady,this,e));this._initTile(a),this.createTile.length<2&&T(i(this._tileReady,this,e,null,a)),kt(a,n),this._tiles[r]={el:a,coords:e,current:!0},t.appendChild(a),this.fire(`tileloadstart`,{tile:a,coords:e})},_tileReady:function(e,t,n){t&&this.fire(`tileerror`,{error:t,tile:n,coords:e});var r=this._tileCoordsToKey(e);n=this._tiles[r],n&&(n.loaded=+new Date,this._map._fadeAnimated?(Tt(n.el,0),E(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),t||(K(n.el,`leaflet-tile-loaded`),this.fire(`tileload`,{tile:n.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire(`load`),U.ielt9||!this._map._fadeAnimated?T(this._pruneTiles,this):setTimeout(i(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new M(this._wrapX?c(e.x,this._wrapX):e.x,this._wrapY?c(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new F(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function Vr(e){return new Br(e)}var Hr=Br.extend({options:{minZoom:0,maxZoom:18,subdomains:`abc`,errorTileUrl:``,zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,t=p(this,t),t.detectRetina&&U.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),typeof t.subdomains==`string`&&(t.subdomains=t.subdomains.split(``)),this.on(`tileunload`,this._onTileRemove)},setUrl:function(e,t){return this._url===e&&t===void 0&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var n=document.createElement(`img`);return q(n,`load`,i(this._tileOnLoad,this,t,n)),q(n,`error`,i(this._tileOnError,this,t,n)),(this.options.crossOrigin||this.options.crossOrigin===``)&&(n.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),typeof this.options.referrerPolicy==`string`&&(n.referrerPolicy=this.options.referrerPolicy),n.alt=``,n.src=this.getTileUrl(e),n},getTileUrl:function(e){var t={r:U.retina?`@2x`:``,s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var r=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=r),t[`-y`]=r}return g(this._url,n(t,this.options))},_tileOnLoad:function(e,t){U.ielt9?setTimeout(i(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,n){var r=this.options.errorTileUrl;r&&t.getAttribute(`src`)!==r&&(t.src=r),e(n,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom,n=this.options.zoomReverse,r=this.options.zoomOffset;return n&&(e=t-e),e+r},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(t=this._tiles[e].el,t.onload=l,t.onerror=l,!t.complete)){t.src=y;var n=this._tiles[e].coords;_t(t),delete this._tiles[e],this.fire(`tileabort`,{tile:t,coords:n})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute(`src`,y),Br.prototype._removeTile.call(this,e)},_tileReady:function(e,t,n){if(!(!this._map||n&&n.getAttribute(`src`)===y))return Br.prototype._tileReady.call(this,e,t,n)}});function Ur(e,t){return new Hr(e,t)}var Wr=Hr.extend({defaultWmsParams:{service:`WMS`,request:`GetMap`,layers:``,styles:``,format:`image/jpeg`,transparent:!1,version:`1.1.1`},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var r=n({},this.defaultWmsParams);for(var i in t)i in this.options||(r[i]=t[i]);t=p(this,t);var a=t.detectRetina&&U.retina?2:1,o=this.getTileSize();r.width=o.x*a,r.height=o.y*a,this.wmsParams=r},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?`crs`:`srs`;this.wmsParams[t]=this._crs.code,Hr.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),n=this._crs,r=I(n.project(t[0]),n.project(t[1])),i=r.min,a=r.max,o=(this._wmsVersion>=1.3&&this._crs===qn?[i.y,i.x,a.y,a.x]:[i.x,i.y,a.x,a.y]).join(`,`),s=Hr.prototype.getTileUrl.call(this,e);return s+m(this.wmsParams,s,this.options.uppercase)+(this.options.uppercase?`&BBOX=`:`&bbox=`)+o},setParams:function(e,t){return n(this.wmsParams,e),t||this.redraw(),this}});function Gr(e,t){return new Wr(e,t)}Hr.WMS=Wr,Ur.wms=Gr;var Kr=Yn.extend({options:{padding:.1},initialize:function(e){p(this,e),o(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),K(this._container,`leaflet-zoom-animated`)),this.getPane().appendChild(this._container),this._update(),this.on(`update`,this._updatePaths,this)},onRemove:function(){this.off(`update`,this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var n=this._map.getZoomScale(t,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),i=this._map.project(this._center,t),a=r.multiplyBy(-n).add(i).subtract(this._map._getNewPixelOrigin(e,t));U.any3d?Ot(this._container,a,n):kt(this._container,a)},_reset:function(){for(var e in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),n=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new F(n,n.add(t.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),qr=Kr.extend({options:{tolerance:0},getEvents:function(){var e=Kr.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Kr.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement(`canvas`);q(e,`mousemove`,this._onMouseMove,this),q(e,`click dblclick mousedown mouseup contextmenu`,this._onClick,this),q(e,`mouseout`,this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext(`2d`)},_destroyContainer:function(){E(this._redrawRequest),delete this._ctx,_t(this._container),Gt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;for(var t in this._redrawBounds=null,this._layers)e=this._layers[t],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Kr.prototype._update.call(this);var e=this._bounds,t=this._container,n=e.getSize(),r=U.retina?2:1;kt(t,e.min),t.width=r*n.x,t.height=r*n.y,t.style.width=n.x+`px`,t.style.height=n.y+`px`,U.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire(`update`)}},_reset:function(){Kr.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[o(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,n=t.next,r=t.prev;n?n.prev=r:this._drawLast=r,r?r.next=n:this._drawFirst=n,delete e._order,delete this._layers[o(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray==`string`){var t=e.options.dashArray.split(/[, ]+/),n=[],r,i;for(i=0;i<t.length;i++){if(r=Number(t[i]),isNaN(r))return;n.push(r)}e.options._dashArray=n}else e.options._dashArray=e.options.dashArray},_requestRedraw:function(e){this._map&&(this._extendRedrawBounds(e),this._redrawRequest=this._redrawRequest||T(this._redraw,this))},_extendRedrawBounds:function(e){if(e._pxBounds){var t=(e.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new F,this._redrawBounds.extend(e._pxBounds.min.subtract([t,t])),this._redrawBounds.extend(e._pxBounds.max.add([t,t]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var e=this._redrawBounds;if(e){var t=e.getSize();this._ctx.clearRect(e.min.x,e.min.y,t.x,t.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var e,t=this._redrawBounds;if(this._ctx.save(),t){var n=t.getSize();this._ctx.beginPath(),this._ctx.rect(t.min.x,t.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var r=this._drawFirst;r;r=r.next)e=r.layer,(!t||e._pxBounds&&e._pxBounds.intersects(t))&&e._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(e,t){if(this._drawing){var n,r,i,a,o=e._parts,s=o.length,c=this._ctx;if(s){for(c.beginPath(),n=0;n<s;n++){for(r=0,i=o[n].length;r<i;r++)a=o[n][r],c[r?`lineTo`:`moveTo`](a.x,a.y);t&&c.closePath()}this._fillStroke(c,e)}}},_updateCircle:function(e){if(!(!this._drawing||e._empty())){var t=e._point,n=this._ctx,r=Math.max(Math.round(e._radius),1),i=(Math.max(Math.round(e._radiusY),1)||r)/r;i!==1&&(n.save(),n.scale(1,i)),n.beginPath(),n.arc(t.x,t.y/i,r,0,Math.PI*2,!1),i!==1&&n.restore(),this._fillStroke(n,e)}},_fillStroke:function(e,t){var n=t.options;n.fill&&(e.globalAlpha=n.fillOpacity,e.fillStyle=n.fillColor||n.color,e.fill(n.fillRule||`evenodd`)),n.stroke&&n.weight!==0&&(e.setLineDash&&e.setLineDash(t.options&&t.options._dashArray||[]),e.globalAlpha=n.opacity,e.lineWidth=n.weight,e.strokeStyle=n.color,e.lineCap=n.lineCap,e.lineJoin=n.lineJoin,e.stroke())},_onClick:function(e){for(var t=this._map.mouseEventToLayerPoint(e),n,r,i=this._drawFirst;i;i=i.next)n=i.layer,n.options.interactive&&n._containsPoint(t)&&(!(e.type===`click`||e.type===`preclick`)||!this._map._draggableMoved(n))&&(r=n);this._fireEvent(r?[r]:!1,e)},_onMouseMove:function(e){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var t=this._map.mouseEventToLayerPoint(e);this._handleMouseHover(e,t)}},_handleMouseOut:function(e){var t=this._hoveredLayer;t&&(St(this._container,`leaflet-interactive`),this._fireEvent([t],e,`mouseout`),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(e,t){if(!this._mouseHoverThrottled){for(var n,r,a=this._drawFirst;a;a=a.next)n=a.layer,n.options.interactive&&n._containsPoint(t)&&(r=n);r!==this._hoveredLayer&&(this._handleMouseOut(e),r&&(K(this._container,`leaflet-interactive`),this._fireEvent([r],e,`mouseover`),this._hoveredLayer=r)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,e),this._mouseHoverThrottled=!0,setTimeout(i(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(e,t,n){this._map._fireDOMEvent(t,n||t.type,e)},_bringToFront:function(e){var t=e._order;if(t){var n=t.next,r=t.prev;if(n)n.prev=r;else return;r?r.next=n:n&&(this._drawFirst=n),t.prev=this._drawLast,this._drawLast.next=t,t.next=null,this._drawLast=t,this._requestRedraw(e)}},_bringToBack:function(e){var t=e._order;if(t){var n=t.next,r=t.prev;if(r)r.next=n;else return;n?n.prev=r:r&&(this._drawLast=r),t.prev=null,t.next=this._drawFirst,this._drawFirst.prev=t,this._drawFirst=t,this._requestRedraw(e)}}});function Jr(e){return U.canvas?new qr(e):null}var Yr=(function(){try{return document.namespaces.add(`lvml`,`urn:schemas-microsoft-com:vml`),function(e){return document.createElement(`<lvml:`+e+` class="lvml">`)}}catch{}return function(e){return document.createElement(`<`+e+` xmlns="urn:schemas-microsoft.com:vml" class="lvml">`)}})(),Xr={_initContainer:function(){this._container=G(`div`,`leaflet-vml-container`)},_update:function(){this._map._animatingZoom||(Kr.prototype._update.call(this),this.fire(`update`))},_initPath:function(e){var t=e._container=Yr(`shape`);K(t,`leaflet-vml-shape `+(this.options.className||``)),t.coordsize=`1 1`,e._path=Yr(`path`),t.appendChild(e._path),this._updateStyle(e),this._layers[o(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;_t(t),e.removeInteractiveTarget(t),delete this._layers[o(e)]},_updateStyle:function(e){var t=e._stroke,n=e._fill,r=e.options,i=e._container;i.stroked=!!r.stroke,i.filled=!!r.fill,r.stroke?(t||=e._stroke=Yr(`stroke`),i.appendChild(t),t.weight=r.weight+`px`,t.color=r.color,t.opacity=r.opacity,r.dashArray?t.dashStyle=_(r.dashArray)?r.dashArray.join(` `):r.dashArray.replace(/( *, *)/g,` `):t.dashStyle=``,t.endcap=r.lineCap.replace(`butt`,`flat`),t.joinstyle=r.lineJoin):t&&(i.removeChild(t),e._stroke=null),r.fill?(n||=e._fill=Yr(`fill`),i.appendChild(n),n.color=r.fillColor||r.color,n.opacity=r.fillOpacity):n&&(i.removeChild(n),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),n=Math.round(e._radius),r=Math.round(e._radiusY||n);this._setPath(e,e._empty()?`M0 0`:`AL `+t.x+`,`+t.y+` `+n+`,`+r+` 0,23592600`)},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){yt(e._container)},_bringToBack:function(e){bt(e._container)}},Zr=U.vml?Yr:ce,Qr=Kr.extend({_initContainer:function(){this._container=Zr(`svg`),this._container.setAttribute(`pointer-events`,`none`),this._rootGroup=Zr(`g`),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){_t(this._container),Gt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Kr.prototype._update.call(this);var e=this._bounds,t=e.getSize(),n=this._container;(!this._svgSize||!this._svgSize.equals(t))&&(this._svgSize=t,n.setAttribute(`width`,t.x),n.setAttribute(`height`,t.y)),kt(n,e.min),n.setAttribute(`viewBox`,[e.min.x,e.min.y,t.x,t.y].join(` `)),this.fire(`update`)}},_initPath:function(e){var t=e._path=Zr(`path`);e.options.className&&K(t,e.options.className),e.options.interactive&&K(t,`leaflet-interactive`),this._updateStyle(e),this._layers[o(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){_t(e._path),e.removeInteractiveTarget(e._path),delete this._layers[o(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,n=e.options;t&&(n.stroke?(t.setAttribute(`stroke`,n.color),t.setAttribute(`stroke-opacity`,n.opacity),t.setAttribute(`stroke-width`,n.weight),t.setAttribute(`stroke-linecap`,n.lineCap),t.setAttribute(`stroke-linejoin`,n.lineJoin),n.dashArray?t.setAttribute(`stroke-dasharray`,n.dashArray):t.removeAttribute(`stroke-dasharray`),n.dashOffset?t.setAttribute(`stroke-dashoffset`,n.dashOffset):t.removeAttribute(`stroke-dashoffset`)):t.setAttribute(`stroke`,`none`),n.fill?(t.setAttribute(`fill`,n.fillColor||n.color),t.setAttribute(`fill-opacity`,n.fillOpacity),t.setAttribute(`fill-rule`,n.fillRule||`evenodd`)):t.setAttribute(`fill`,`none`))},_updatePoly:function(e,t){this._setPath(e,le(e._parts,t))},_updateCircle:function(e){var t=e._point,n=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||n,i=`a`+n+`,`+r+` 0 1,0 `,a=e._empty()?`M0 0`:`M`+(t.x-n)+`,`+t.y+i+n*2+`,0 `+i+-n*2+`,0 `;this._setPath(e,a)},_setPath:function(e,t){e._path.setAttribute(`d`,t)},_bringToFront:function(e){yt(e._path)},_bringToBack:function(e){bt(e._path)}});U.vml&&Qr.include(Xr);function $r(e){return U.svg||U.vml?new Qr(e):null}J.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||=this._renderer=this._createRenderer(),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if(e===`overlayPane`||e===void 0)return!1;var t=this._paneRenderers[e];return t===void 0&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&Jr(e)||$r(e)}});var ei=pr.extend({initialize:function(e,t){pr.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=z(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function ti(e,t){return new ei(e,t)}Qr.create=Zr,Qr.pointsToPath=le,hr.geometryToLayer=gr,hr.coordsToLatLng=vr,hr.coordsToLatLngs=yr,hr.latLngToCoords=br,hr.latLngsToCoords=xr,hr.getFeature=Sr,hr.asFeature=Cr,J.mergeOptions({boxZoom:!0});var ni=yn.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on(`unload`,this._destroy,this)},addHooks:function(){q(this._container,`mousedown`,this._onMouseDown,this)},removeHooks:function(){Gt(this._container,`mousedown`,this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){_t(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),jt(),Ft(),this._startPoint=this._map.mouseEventToContainerPoint(e),q(document,{contextmenu:en,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=G(`div`,`leaflet-zoom-box`,this._container),K(this._container,`leaflet-crosshair`),this._map.fire(`boxzoomstart`)),this._point=this._map.mouseEventToContainerPoint(e);var t=new F(this._point,this._startPoint),n=t.getSize();kt(this._box,t.min),this._box.style.width=n.x+`px`,this._box.style.height=n.y+`px`},_finish:function(){this._moved&&(_t(this._box),St(this._container,`leaflet-crosshair`)),Mt(),It(),Gt(document,{contextmenu:en,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(i(this._resetState,this),0);var t=new R(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire(`boxzoomend`,{boxZoomBounds:t})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});J.addInitHook(`addHandler`,`boxZoom`,ni),J.mergeOptions({doubleClickZoom:!0});var ri=yn.extend({addHooks:function(){this._map.on(`dblclick`,this._onDoubleClick,this)},removeHooks:function(){this._map.off(`dblclick`,this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,n=t.getZoom(),r=t.options.zoomDelta,i=e.originalEvent.shiftKey?n-r:n+r;t.options.doubleClickZoom===`center`?t.setZoom(i):t.setZoomAround(e.containerPoint,i)}});J.addInitHook(`addHandler`,`doubleClickZoom`,ri),J.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var ii=yn.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new Sn(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on(`predrag`,this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on(`predrag`,this._onPreDragWrap,this),e.on(`zoomend`,this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}K(this._map._container,`leaflet-grab leaflet-touch-drag`),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){St(this._map._container,`leaflet-grab`),St(this._map._container,`leaflet-touch-drag`),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=z(this._map.options.maxBounds);this._offsetLimit=I(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire(`movestart`).fire(`dragstart`),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(t),this._prunePositions(t)}this._map.fire(`move`,e).fire(`drag`,e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2);this._initialWorldOffset=this._map.latLngToLayerPoint([0,0]).subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.x<t.min.x&&(e.x=this._viscousLimit(e.x,t.min.x)),e.y<t.min.y&&(e.y=this._viscousLimit(e.y,t.min.y)),e.x>t.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),n=this._initialWorldOffset,r=this._draggable._newPos.x,i=(r-t+n)%e+t-n,a=(r+t+n)%e-t-n,o=Math.abs(i+n)<Math.abs(a+n)?i:a;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=o},_onDragEnd:function(e){var t=this._map,n=t.options,r=!n.inertia||e.noInertia||this._times.length<2;if(t.fire(`dragend`,e),r)t.fire(`moveend`);else{this._prunePositions(+new Date);var i=this._lastPos.subtract(this._positions[0]),a=(this._lastTime-this._times[0])/1e3,o=n.easeLinearity,s=i.multiplyBy(o/a),c=s.distanceTo([0,0]),l=Math.min(n.inertiaMaxSpeed,c),u=s.multiplyBy(l/c),d=l/(n.inertiaDeceleration*o),f=u.multiplyBy(-d/2).round();!f.x&&!f.y?t.fire(`moveend`):(f=t._limitOffset(f,t.options.maxBounds),T(function(){t.panBy(f,{duration:d,easeLinearity:o,noMoveStart:!0,animate:!0})}))}}});J.addInitHook(`addHandler`,`dragging`,ii),J.mergeOptions({keyboard:!0,keyboardPanDelta:80});var ai=yn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(e){this._map=e,this._setPanDelta(e.options.keyboardPanDelta),this._setZoomDelta(e.options.zoomDelta)},addHooks:function(){var e=this._map._container;e.tabIndex<=0&&(e.tabIndex=`0`),q(e,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Gt(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var e=document.body,t=document.documentElement,n=e.scrollTop||t.scrollTop,r=e.scrollLeft||t.scrollLeft;this._map._container.focus(),window.scrollTo(r,n)}},_onFocus:function(){this._focused=!0,this._map.fire(`focus`)},_onBlur:function(){this._focused=!1,this._map.fire(`blur`)},_setPanDelta:function(e){var t=this._panKeys={},n=this.keyCodes,r,i;for(r=0,i=n.left.length;r<i;r++)t[n.left[r]]=[-1*e,0];for(r=0,i=n.right.length;r<i;r++)t[n.right[r]]=[e,0];for(r=0,i=n.down.length;r<i;r++)t[n.down[r]]=[0,e];for(r=0,i=n.up.length;r<i;r++)t[n.up[r]]=[0,-1*e]},_setZoomDelta:function(e){var t=this._zoomKeys={},n=this.keyCodes,r,i;for(r=0,i=n.zoomIn.length;r<i;r++)t[n.zoomIn[r]]=e;for(r=0,i=n.zoomOut.length;r<i;r++)t[n.zoomOut[r]]=-e},_addHooks:function(){q(document,`keydown`,this._onKeyDown,this)},_removeHooks:function(){Gt(document,`keydown`,this._onKeyDown,this)},_onKeyDown:function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var t=e.keyCode,n=this._map,r;if(t in this._panKeys){if(!n._panAnim||!n._panAnim._inProgress)if(r=this._panKeys[t],e.shiftKey&&(r=P(r).multiplyBy(3)),n.options.maxBounds&&(r=n._limitOffset(P(r),n.options.maxBounds)),n.options.worldCopyJump){var i=n.wrapLatLng(n.unproject(n.project(n.getCenter()).add(r)));n.panTo(i)}else n.panBy(r)}else if(t in this._zoomKeys)n.setZoom(n.getZoom()+(e.shiftKey?3:1)*this._zoomKeys[t]);else if(t===27&&n._popup&&n._popup.options.closeOnEscapeKey)n.closePopup();else return;en(e)}}});J.addInitHook(`addHandler`,`keyboard`,ai),J.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var oi=yn.extend({addHooks:function(){q(this._map._container,`wheel`,this._onWheelScroll,this),this._delta=0},removeHooks:function(){Gt(this._map._container,`wheel`,this._onWheelScroll,this)},_onWheelScroll:function(e){var t=an(e),n=this._map.options.wheelDebounceTime;this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._startTime||=+new Date;var r=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(i(this._performZoom,this),r),en(e)},_performZoom:function(){var e=this._map,t=e.getZoom(),n=this._map.options.zoomSnap||0;e._stop();var r=this._delta/(this._map.options.wheelPxPerZoomLevel*4),i=4*Math.log(2/(1+Math.exp(-Math.abs(r))))/Math.LN2,a=n?Math.ceil(i/n)*n:i,o=e._limitZoom(t+(this._delta>0?a:-a))-t;this._delta=0,this._startTime=null,o&&(e.options.scrollWheelZoom===`center`?e.setZoom(t+o):e.setZoomAround(this._lastMousePos,t+o))}});J.addInitHook(`addHandler`,`scrollWheelZoom`,oi);var si=600;J.mergeOptions({tapHold:U.touchNative&&U.safari&&U.mobile,tapTolerance:15});var ci=yn.extend({addHooks:function(){q(this._map._container,`touchstart`,this._onDown,this)},removeHooks:function(){Gt(this._map._container,`touchstart`,this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var t=e.touches[0];this._startPos=this._newPos=new M(t.clientX,t.clientY),this._holdTimeout=setTimeout(i(function(){this._cancel(),this._isTapValid()&&(q(document,`touchend`,$t),q(document,`touchend touchcancel`,this._cancelClickPrevent),this._simulateEvent(`contextmenu`,t))},this),si),q(document,`touchend touchcancel contextmenu`,this._cancel,this),q(document,`touchmove`,this._onMove,this)}},_cancelClickPrevent:function e(){Gt(document,`touchend`,$t),Gt(document,`touchend touchcancel`,e)},_cancel:function(){clearTimeout(this._holdTimeout),Gt(document,`touchend touchcancel contextmenu`,this._cancel,this),Gt(document,`touchmove`,this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new M(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var n=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});n._simulated=!0,t.target.dispatchEvent(n)}});J.addInitHook(`addHandler`,`tapHold`,ci),J.mergeOptions({touchZoom:U.touch,bounceAtZoomLimits:!0});var li=yn.extend({addHooks:function(){K(this._map._container,`leaflet-touch-zoom`),q(this._map._container,`touchstart`,this._onTouchStart,this)},removeHooks:function(){St(this._map._container,`leaflet-touch-zoom`),Gt(this._map._container,`touchstart`,this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(!(!e.touches||e.touches.length!==2||t._animatingZoom||this._zooming)){var n=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),t.options.touchZoom!==`center`&&(this._pinchStartLatLng=t.containerPointToLatLng(n.add(r)._divideBy(2))),this._startDist=n.distanceTo(r),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),q(document,`touchmove`,this._onTouchMove,this),q(document,`touchend touchcancel`,this._onTouchEnd,this),$t(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var t=this._map,n=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]),a=n.distanceTo(r)/this._startDist;if(this._zoom=t.getScaleZoom(a,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoom<t.getMinZoom()&&a<1||this._zoom>t.getMaxZoom()&&a>1)&&(this._zoom=t._limitZoom(this._zoom)),t.options.touchZoom===`center`){if(this._center=this._startLatLng,a===1)return}else{var o=n._add(r)._divideBy(2)._subtract(this._centerPoint);if(a===1&&o.x===0&&o.y===0)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(o),this._zoom)}this._moved||=(t._moveStart(!0,!1),!0),E(this._animRequest),this._animRequest=T(i(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0),this,!0),$t(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,E(this._animRequest),Gt(document,`touchmove`,this._onTouchMove,this),Gt(document,`touchend touchcancel`,this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});J.addInitHook(`addHandler`,`touchZoom`,li),J.BoxZoom=ni,J.DoubleClickZoom=ri,J.Drag=ii,J.Keyboard=ai,J.ScrollWheelZoom=oi,J.TapHold=ci,J.TouchZoom=li,e.Bounds=F,e.Browser=U,e.CRS=ee,e.Canvas=qr,e.Circle=lr,e.CircleMarker=sr,e.Class=O,e.Control=un,e.DivIcon=Rr,e.DivOverlay=Nr,e.DomEvent=sn,e.DomUtil=Ut,e.Draggable=Sn,e.Evented=j,e.FeatureGroup=Qn,e.GeoJSON=hr,e.GridLayer=Br,e.Handler=yn,e.Icon=er,e.ImageOverlay=Dr,e.LatLng=B,e.LatLngBounds=R,e.Layer=Yn,e.LayerGroup=Xn,e.LineUtil=Hn,e.Map=J,e.Marker=ir,e.Mixin=bn,e.Path=or,e.Point=M,e.PolyUtil=En,e.Polygon=pr,e.Polyline=dr,e.Popup=Pr,e.PosAnimation=cn,e.Projection=Gn,e.Rectangle=ei,e.Renderer=Kr,e.SVG=Qr,e.SVGOverlay=jr,e.TileLayer=Hr,e.Tooltip=Ir,e.Transformation=ie,e.Util=D,e.VideoOverlay=kr,e.bind=i,e.bounds=I,e.canvas=Jr,e.circle=ur,e.circleMarker=cr,e.control=dn,e.divIcon=zr,e.extend=n,e.featureGroup=$n,e.geoJSON=Tr,e.geoJson=Er,e.gridLayer=Vr,e.icon=tr,e.imageOverlay=Or,e.latLng=V,e.latLngBounds=z,e.layerGroup=Zn,e.map=ln,e.marker=ar,e.point=P,e.polygon=mr,e.polyline=fr,e.popup=Fr,e.rectangle=ti,e.setOptions=p,e.stamp=o,e.svg=$r,e.svgOverlay=Mr,e.tileLayer=Ur,e.tooltip=Lr,e.transformation=ae,e.version=t,e.videoOverlay=Ar;var ui=window.L;e.noConflict=function(){return window.L=ui,this},window.L=e}))})),Md=o(((e,t)=>{((n,r)=>{typeof define==`function`&&define.amd?define([`leaflet`],n):typeof e==`object`&&(t.exports=n(jd())),r!==void 0&&r.L&&n(r.L)})(e=>{e.Editable=e.Evented.extend({statics:{FORWARD:1,BACKWARD:-1},options:{zIndex:1e3,polygonClass:e.Polygon,polylineClass:e.Polyline,markerClass:e.Marker,circleMarkerClass:e.CircleMarker,rectangleClass:e.Rectangle,circleClass:e.Circle,drawingCSSClass:`leaflet-editable-drawing`,drawingCursor:`crosshair`,editLayer:void 0,featuresLayer:void 0,polylineEditorClass:void 0,polygonEditorClass:void 0,markerEditorClass:void 0,circleMarkerEditorClass:void 0,rectangleEditorClass:void 0,circleEditorClass:void 0,lineGuideOptions:{},skipMiddleMarkers:!1},initialize:function(t,n){e.setOptions(this,n),this._lastZIndex=this.options.zIndex,this.map=t,this.editLayer=this.createEditLayer(),this.featuresLayer=this.createFeaturesLayer(),this.forwardLineGuide=this.createLineGuide(),this.backwardLineGuide=this.createLineGuide()},fireAndForward:function(e,t){t||={},t.editTools=this,this.fire(e,t),this.map.fire(e,t)},createLineGuide:function(){let t=e.extend({dashArray:`5,10`,weight:1,interactive:!1},this.options.lineGuideOptions);return e.polyline([],t)},createVertexIcon:t=>e.Browser.mobile&&e.Browser.touch?new e.Editable.TouchVertexIcon(t):new e.Editable.VertexIcon(t),createEditLayer:function(){return this.options.editLayer||new e.LayerGroup().addTo(this.map)},createFeaturesLayer:function(){return this.options.featuresLayer||new e.LayerGroup().addTo(this.map)},moveForwardLineGuide:function(e){this.forwardLineGuide._latlngs.length&&(this.forwardLineGuide._latlngs[1]=e,this.forwardLineGuide._bounds.extend(e),this.forwardLineGuide.redraw())},moveBackwardLineGuide:function(e){this.backwardLineGuide._latlngs.length&&(this.backwardLineGuide._latlngs[1]=e,this.backwardLineGuide._bounds.extend(e),this.backwardLineGuide.redraw())},anchorForwardLineGuide:function(e){this.forwardLineGuide._latlngs[0]=e,this.forwardLineGuide._bounds.extend(e),this.forwardLineGuide.redraw()},anchorBackwardLineGuide:function(e){this.backwardLineGuide._latlngs[0]=e,this.backwardLineGuide._bounds.extend(e),this.backwardLineGuide.redraw()},attachForwardLineGuide:function(){this.editLayer.addLayer(this.forwardLineGuide)},attachBackwardLineGuide:function(){this.editLayer.addLayer(this.backwardLineGuide)},detachForwardLineGuide:function(){this.forwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.forwardLineGuide)},detachBackwardLineGuide:function(){this.backwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.backwardLineGuide)},blockEvents:function(){this._oldTargets||(this._oldTargets=this.map._targets,this.map._targets={})},unblockEvents:function(){this._oldTargets&&(this.map._targets=e.extend(this.map._targets,this._oldTargets),delete this._oldTargets)},registerForDrawing:function(t){this._drawingEditor&&this.unregisterForDrawing(this._drawingEditor),this.blockEvents(),t.reset(),this._drawingEditor=t,this.map.on(`mousemove touchmove`,t.onDrawingMouseMove,t),this.map.on(`mousedown`,this.onMousedown,this),this.map.on(`mouseup`,this.onMouseup,this),e.DomUtil.addClass(this.map._container,this.options.drawingCSSClass),this.defaultMapCursor=this.map._container.style.cursor,this.map._container.style.cursor=this.options.drawingCursor},unregisterForDrawing:function(t){this.unblockEvents(),e.DomUtil.removeClass(this.map._container,this.options.drawingCSSClass),this.map._container.style.cursor=this.defaultMapCursor,t||=this._drawingEditor,t&&(this.map.off(`mousemove touchmove`,t.onDrawingMouseMove,t),this.map.off(`mousedown`,this.onMousedown,this),this.map.off(`mouseup`,this.onMouseup,this),t===this._drawingEditor&&(delete this._drawingEditor,t._drawing&&t.cancelDrawing()))},onMousedown:function(e){e.originalEvent.which==1&&(this._mouseDown=e,this._drawingEditor.onDrawingMouseDown(e))},onMouseup:function(t){if(this._mouseDown){let n=this._drawingEditor,r=this._mouseDown;if(this._mouseDown=null,n.onDrawingMouseUp(t),this._drawingEditor!==n)return;let i=e.point(r.originalEvent.clientX,r.originalEvent.clientY),a=e.point(t.originalEvent.clientX,t.originalEvent.clientY).distanceTo(i);Math.abs(a)<9*(window.devicePixelRatio||1)&&this._drawingEditor.onDrawingClick(t)}},drawing:function(){return this._drawingEditor?.drawing()},stopDrawing:function(){this.unregisterForDrawing()},commitDrawing:function(e){this._drawingEditor&&this._drawingEditor.commitDrawing(e)},connectCreatedToMap:function(e){return this.featuresLayer.addLayer(e)},startPolyline:function(e,t){let n=this.createPolyline([],t);return n.enableEdit(this.map).newShape(e),n},startPolygon:function(e,t){let n=this.createPolygon([],t);return n.enableEdit(this.map).newShape(e),n},startMarker:function(e,t){e||=this.map.getCenter().clone();let n=this.createMarker(e,t);return n.enableEdit(this.map).startDrawing(),n},startCircleMarker:function(e,t){e||=this.map.getCenter().clone();let n=this.createCircleMarker(e,t);return n.enableEdit(this.map).startDrawing(),n},startRectangle:function(t,n){let r=t||e.latLng([0,0]),i=new e.LatLngBounds(r,r),a=this.createRectangle(i,n);return a.enableEdit(this.map).startDrawing(),a},startCircle:function(e,t){e||=this.map.getCenter().clone();let n=this.createCircle(e,t);return n.enableEdit(this.map).startDrawing(),n},startHole:(e,t)=>{e.newHole(t)},createLayer:function(t,n,r){r=e.Util.extend({editOptions:{editTools:this}},r);let i=new t(n,r);return this.fireAndForward(`editable:created`,{layer:i}),i},createPolyline:function(e,t){return this.createLayer(t?.polylineClass||this.options.polylineClass,e,t)},createPolygon:function(e,t){return this.createLayer(t?.polygonClass||this.options.polygonClass,e,t)},createMarker:function(e,t){return this.createLayer(t?.markerClass||this.options.markerClass,e,t)},createCircleMarker:function(e,t){return this.createLayer(t?.circleMarkerClass||this.options.circleMarkerClass,e,t)},createRectangle:function(e,t){return this.createLayer(t?.rectangleClass||this.options.rectangleClass,e,t)},createCircle:function(e,t){return this.createLayer(t?.circleClass||this.options.circleClass,e,t)}}),e.extend(e.Editable,{makeCancellable:e=>{e.cancel=()=>{e._cancelled=!0}}}),e.Map.mergeOptions({editToolsClass:e.Editable,editable:!1,editOptions:{}}),e.Map.addInitHook(function(){this.whenReady(function(){this.options.editable&&(this.editTools=new this.options.editToolsClass(this,this.options.editOptions))})}),e.Editable.VertexIcon=e.DivIcon.extend({options:{iconSize:new e.Point(8,8)}}),e.Editable.TouchVertexIcon=e.Editable.VertexIcon.extend({options:{iconSize:new e.Point(20,20)}}),e.Editable.VertexMarker=e.Marker.extend({options:{draggable:!0,className:`leaflet-div-icon leaflet-vertex-icon`},initialize:function(t,n,r,i){this.latlng=t,this.latlngs=n,this.editor=r,e.Marker.prototype.initialize.call(this,t,i),this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.latlng.__vertex=this,this.connect(),this.setZIndexOffset(r.tools._lastZIndex+1)},connect:function(){this.editor.editLayer.addLayer(this)},onAdd:function(t){e.Marker.prototype.onAdd.call(this,t),this.on(`drag`,this.onDrag),this.on(`dragstart`,this.onDragStart),this.on(`dragend`,this.onDragEnd),this.on(`mouseup`,this.onMouseup),this.on(`click`,this.onClick),this.on(`contextmenu`,this.onContextMenu),this.on(`mousedown touchstart`,this.onMouseDown),this.on(`mouseover`,this.onMouseOver),this.on(`mouseout`,this.onMouseOut),this.addMiddleMarkers()},onRemove:function(t){this.middleMarker&&this.middleMarker.delete(),delete this.latlng.__vertex,this.off(`drag`,this.onDrag),this.off(`dragstart`,this.onDragStart),this.off(`dragend`,this.onDragEnd),this.off(`mouseup`,this.onMouseup),this.off(`click`,this.onClick),this.off(`contextmenu`,this.onContextMenu),this.off(`mousedown touchstart`,this.onMouseDown),this.off(`mouseover`,this.onMouseOver),this.off(`mouseout`,this.onMouseOut),e.Marker.prototype.onRemove.call(this,t)},onDrag:function(t){t.vertex=this,this.editor.onVertexMarkerDrag(t);let n=e.DomUtil.getPosition(this._icon),r=this._map.layerPointToLatLng(n);this.latlng.update(r),this._latlng=this.latlng,this.editor.refresh(),this.middleMarker&&this.middleMarker.updateLatLng();let i=this.getNext();i?.middleMarker&&i.middleMarker.updateLatLng()},onDragStart:function(e){e.vertex=this,this.editor.onVertexMarkerDragStart(e)},onDragEnd:function(e){e.vertex=this,this.editor.onVertexMarkerDragEnd(e)},onClick:function(e){e.vertex=this,this.editor.onVertexMarkerClick(e)},onMouseup:function(t){e.DomEvent.stop(t),t.vertex=this,this.editor.map.fire(`mouseup`,t)},onContextMenu:function(e){e.vertex=this,this.editor.onVertexMarkerContextMenu(e)},onMouseDown:function(e){e.vertex=this,this.editor.onVertexMarkerMouseDown(e)},onMouseOver:function(e){e.vertex=this,this.editor.onVertexMarkerMouseOver(e)},onMouseOut:function(e){e.vertex=this,this.editor.onVertexMarkerMouseOut(e)},delete:function(){let e=this.getNext();this.latlngs.splice(this.getIndex(),1),this.editor.editLayer.removeLayer(this),this.editor.onVertexDeleted({latlng:this.latlng,vertex:this}),this.latlngs.length||this.editor.deleteShape(this.latlngs),e&&e.resetMiddleMarker(),this.editor.refresh()},getIndex:function(){return this.latlngs.indexOf(this.latlng)},getLastIndex:function(){return this.latlngs.length-1},getPrevious:function(){if(this.latlngs.length<2)return;let e=this.getIndex(),t=e-1;e===0&&this.editor.CLOSED&&(t=this.getLastIndex());let n=this.latlngs[t];if(n)return n.__vertex},getNext:function(){if(this.latlngs.length<2)return;let e=this.getIndex(),t=e+1;e===this.getLastIndex()&&this.editor.CLOSED&&(t=0);let n=this.latlngs[t];if(n)return n.__vertex},addMiddleMarker:function(e){this.editor.hasMiddleMarkers()&&(e||=this.getPrevious(),e&&!this.middleMarker&&(this.middleMarker=this.editor.addMiddleMarker(e,this,this.latlngs,this.editor)))},addMiddleMarkers:function(){if(!this.editor.hasMiddleMarkers())return;let e=this.getPrevious();e&&this.addMiddleMarker(e);let t=this.getNext();t&&t.resetMiddleMarker()},resetMiddleMarker:function(){this.middleMarker&&this.middleMarker.delete(),this.addMiddleMarker()},split:function(){this.editor.splitShape&&this.editor.splitShape(this.latlngs,this.getIndex())},continue:function(){if(!this.editor.continueBackward)return;let e=this.getIndex();e===0?this.editor.continueBackward(this.latlngs):e===this.getLastIndex()&&this.editor.continueForward(this.latlngs)}}),e.Editable.mergeOptions({vertexMarkerClass:e.Editable.VertexMarker}),e.Editable.MiddleMarker=e.Marker.extend({options:{opacity:.5,className:`leaflet-div-icon leaflet-middle-icon`,draggable:!0},initialize:function(t,n,r,i,a){this.left=t,this.right=n,this.editor=i,this.latlngs=r,e.Marker.prototype.initialize.call(this,this.computeLatLng(),a),this._opacity=this.options.opacity,this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.editor.editLayer.addLayer(this),this.setVisibility()},setVisibility:function(){let t=this._map.latLngToContainerPoint(this.left.latlng),n=this._map.latLngToContainerPoint(this.right.latlng),r=e.point(this.options.icon.options.iconSize);t.distanceTo(n)<r.x*3?this.hide():this.show()},show:function(){this.setOpacity(this._opacity)},hide:function(){this.setOpacity(0)},updateLatLng:function(){this.setLatLng(this.computeLatLng()),this.setVisibility()},computeLatLng:function(){let e=this.editor.map.latLngToContainerPoint(this.left.latlng),t=this.editor.map.latLngToContainerPoint(this.right.latlng),n=(e.y+t.y)/2,r=(e.x+t.x)/2;return this.editor.map.containerPointToLatLng([r,n])},onAdd:function(t){e.Marker.prototype.onAdd.call(this,t),e.DomEvent.on(this._icon,`mousedown touchstart`,this.onMouseDown,this),t.on(`zoomend`,this.setVisibility,this)},onRemove:function(t){delete this.right.middleMarker,e.DomEvent.off(this._icon,`mousedown touchstart`,this.onMouseDown,this),t.off(`zoomend`,this.setVisibility,this),e.Marker.prototype.onRemove.call(this,t)},onMouseDown:function(t){let n=e.DomUtil.getPosition(this._icon),r=this.editor.map.layerPointToLatLng(n);if(t={originalEvent:t,latlng:r},this.options.opacity===0||(e.Editable.makeCancellable(t),this.editor.onMiddleMarkerMouseDown(t),t._cancelled))return;this.latlngs.splice(this.index(),0,t.latlng),this.editor.refresh();let i=this._icon,a=this.editor.addVertexMarker(t.latlng,this.latlngs);this.editor.onNewVertex(a);let o=a._icon.parentNode;o.removeChild(a._icon),a._icon=i,o.appendChild(a._icon),a._initIcon(),a._initInteraction(),a.setOpacity(1),e.Draggable._dragging=!1,a.dragging._draggable._onDown(t.originalEvent),this.delete()},delete:function(){this.editor.editLayer.removeLayer(this)},index:function(){return this.latlngs.indexOf(this.right.latlng)}}),e.Editable.mergeOptions({middleMarkerClass:e.Editable.MiddleMarker}),e.Editable.BaseEditor=e.Handler.extend({initialize:function(t,n,r){e.setOptions(this,r),this.map=t,this.feature=n,this.feature.editor=this,this.editLayer=new e.LayerGroup,this.tools=this.options.editTools||t.editTools},addHooks:function(){this.isConnected()?this.onFeatureAdd():this.feature.once(`add`,this.onFeatureAdd,this),this.onEnable(),this.feature.on(this._getEvents(),this)},removeHooks:function(){this.feature.off(this._getEvents(),this),this.feature.dragging&&this.feature.dragging.disable(),this.editLayer.clearLayers(),this.tools.editLayer.removeLayer(this.editLayer),this.onDisable(),this._drawing&&this.cancelDrawing()},drawing:function(){return!!this._drawing},reset:()=>{},onFeatureAdd:function(){this.tools.editLayer.addLayer(this.editLayer),this.feature.dragging&&this.options.draggable!=0&&this.feature.dragging.enable()},hasMiddleMarkers:function(){return!this.options.skipMiddleMarkers&&!this.tools.options.skipMiddleMarkers},fireAndForward:function(e,t){t||={},t.layer=this.feature,this.feature.fire(e,t),this.tools.fireAndForward(e,t)},onEnable:function(){this.fireAndForward(`editable:enable`)},onDisable:function(){this.fireAndForward(`editable:disable`)},onEditing:function(){this.fireAndForward(`editable:editing`)},onEdited:function(){this.fireAndForward(`editable:edited`)},onStartDrawing:function(){this.fireAndForward(`editable:drawing:start`)},onEndDrawing:function(){this.fireAndForward(`editable:drawing:end`)},onCancelDrawing:function(){this.fireAndForward(`editable:drawing:cancel`)},onCommitDrawing:function(e){this.fireAndForward(`editable:drawing:commit`,e),this.onEdited()},onDrawingMouseDown:function(e){this.fireAndForward(`editable:drawing:mousedown`,e)},onDrawingMouseUp:function(e){this.fireAndForward(`editable:drawing:mouseup`,e)},startDrawing:function(){this._drawing||=e.Editable.FORWARD,this.tools.registerForDrawing(this),this.onStartDrawing()},commitDrawing:function(e){this.onCommitDrawing(e),this.endDrawing()},cancelDrawing:function(){e.Draggable._dragging=!1,this.onCancelDrawing(),this.endDrawing()},endDrawing:function(){this._drawing=!1,this.tools.unregisterForDrawing(this),this.onEndDrawing()},onDrawingClick:function(t){this.drawing()&&(e.Editable.makeCancellable(t),this.fireAndForward(`editable:drawing:click`,t),!t._cancelled&&(this.isConnected()||this.connect(t),this.processDrawingClick(t)))},isConnected:function(){return this.map.hasLayer(this.feature)},connect:function(){this.tools.connectCreatedToMap(this.feature),this.tools.editLayer.addLayer(this.editLayer)},onMove:function(e){this.fireAndForward(`editable:drawing:move`,e)},onDrawingMouseMove:function(e){this.onMove(e)},_getEvents:function(){return{dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd,remove:this.disable}},onDragStart:function(e){this.onEditing(),this.fireAndForward(`editable:dragstart`,e)},onDrag:function(e){this.onMove(e),this.fireAndForward(`editable:drag`,e)},onDragEnd:function(e){this.fireAndForward(`editable:dragend`,e),this.onEdited()}}),e.Editable.MarkerEditor=e.Editable.BaseEditor.extend({onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&this.feature.setLatLng(t.latlng)},processDrawingClick:function(e){this.fireAndForward(`editable:drawing:clicked`,e),this.commitDrawing(e)},connect:function(t){t&&(this.feature._latlng=t.latlng),e.Editable.BaseEditor.prototype.connect.call(this,t)}}),e.Editable.CircleMarkerEditor=e.Editable.BaseEditor.extend({onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&this.feature.setLatLng(t.latlng)},processDrawingClick:function(e){this.fireAndForward(`editable:drawing:clicked`,e),this.commitDrawing(e)},connect:function(t){t&&(this.feature._latlng=t.latlng),e.Editable.BaseEditor.prototype.connect.call(this,t)}}),e.Editable.PathEditor=e.Editable.BaseEditor.extend({CLOSED:!1,MIN_VERTEX:2,addHooks:function(){return e.Editable.BaseEditor.prototype.addHooks.call(this),this.feature&&(this.initVertexMarkers(),this.map.on(`moveend`,this.onMoveEnd,this)),this},removeHooks:function(){e.Editable.BaseEditor.prototype.removeHooks.call(this),this.feature&&this.map.off(`moveend`,this.onMoveEnd,this)},onMoveEnd:function(){this.initVertexMarkers()},initVertexMarkers:function(e){if(this.enabled())if(e||=this.getLatLngs(),l(e))this.addVertexMarkers(e);else for(let t of e)this.initVertexMarkers(t)},getLatLngs:function(){return this.feature.getLatLngs()},reset:function(){this.editLayer.clearLayers(),this.initVertexMarkers()},addVertexMarker:function(e,t){return e.__vertex?(e.__vertex.connect(),e.__vertex):new this.tools.options.vertexMarkerClass(e,t,this)},onNewVertex:function(e){this.fireAndForward(`editable:vertex:new`,{latlng:e.latlng,vertex:e})},addVertexMarkers:function(e){let t=this.map.getBounds();for(let n of e)t.contains(n)&&this.addVertexMarker(n,e)},refreshVertexMarkers:function(e){e||=this.getDefaultLatLngs();for(let t of e)t.__vertex.update()},addMiddleMarker:function(e,t,n){return new this.tools.options.middleMarkerClass(e,t,n,this)},onVertexMarkerClick:function(t){if(e.Editable.makeCancellable(t),this.fireAndForward(`editable:vertex:click`,t),t._cancelled||this.tools.drawing()&&this.tools._drawingEditor!==this)return;let n=t.vertex.getIndex(),r;t.originalEvent.ctrlKey?this.onVertexMarkerCtrlClick(t):t.originalEvent.altKey?this.onVertexMarkerAltClick(t):t.originalEvent.shiftKey?this.onVertexMarkerShiftClick(t):t.originalEvent.metaKey?this.onVertexMarkerMetaKeyClick(t):n===t.vertex.getLastIndex()&&this._drawing===e.Editable.FORWARD?n>=this.MIN_VERTEX-1&&(r=!0):n===0&&this._drawing===e.Editable.BACKWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX||n===0&&this._drawing===e.Editable.FORWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX&&this.CLOSED?r=!0:this.onVertexRawMarkerClick(t),this.fireAndForward(`editable:vertex:clicked`,t),r&&this.commitDrawing(t)},onVertexRawMarkerClick:function(e){this.fireAndForward(`editable:vertex:rawclick`,e),!e._cancelled&&this.vertexCanBeDeleted(e.vertex)&&e.vertex.delete()},vertexCanBeDeleted:function(e){return e.latlngs.length>this.MIN_VERTEX},onVertexDeleted:function(e){this.fireAndForward(`editable:vertex:deleted`,e),this.onEdited()},onVertexMarkerCtrlClick:function(e){this.fireAndForward(`editable:vertex:ctrlclick`,e)},onVertexMarkerShiftClick:function(e){this.fireAndForward(`editable:vertex:shiftclick`,e)},onVertexMarkerMetaKeyClick:function(e){this.fireAndForward(`editable:vertex:metakeyclick`,e)},onVertexMarkerAltClick:function(e){this.fireAndForward(`editable:vertex:altclick`,e)},onVertexMarkerContextMenu:function(e){this.fireAndForward(`editable:vertex:contextmenu`,e)},onVertexMarkerMouseDown:function(e){this.fireAndForward(`editable:vertex:mousedown`,e)},onVertexMarkerMouseOver:function(e){this.fireAndForward(`editable:vertex:mouseover`,e)},onVertexMarkerMouseOut:function(e){this.fireAndForward(`editable:vertex:mouseout`,e)},onMiddleMarkerMouseDown:function(e){this.fireAndForward(`editable:middlemarker:mousedown`,e)},onVertexMarkerDrag:function(e){this.onMove(e),this.feature._bounds&&this.extendBounds(e),this.fireAndForward(`editable:vertex:drag`,e)},onVertexMarkerDragStart:function(e){this.fireAndForward(`editable:vertex:dragstart`,e)},onVertexMarkerDragEnd:function(e){this.fireAndForward(`editable:vertex:dragend`,e),this.onEdited()},setDrawnLatLngs:function(e){this._drawnLatLngs=e||this.getDefaultLatLngs()},startDrawing:function(){this._drawnLatLngs||this.setDrawnLatLngs(),e.Editable.BaseEditor.prototype.startDrawing.call(this)},startDrawingForward:function(){this.startDrawing()},endDrawing:function(){this.tools.detachForwardLineGuide(),this.tools.detachBackwardLineGuide(),this._drawnLatLngs&&this._drawnLatLngs.length<this.MIN_VERTEX&&this.deleteShape(this._drawnLatLngs),e.Editable.BaseEditor.prototype.endDrawing.call(this),delete this._drawnLatLngs},addLatLng:function(t){this._drawing===e.Editable.FORWARD?this._drawnLatLngs.push(t):this._drawnLatLngs.unshift(t),this.feature._bounds.extend(t);let n=this.addVertexMarker(t,this._drawnLatLngs);this.onNewVertex(n),this.refresh()},newPointForward:function(e){this.addLatLng(e),this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(e)},newPointBackward:function(e){this.addLatLng(e),this.tools.anchorBackwardLineGuide(e)},push:function(t){if(!t)return console.error(`L.Editable.PathEditor.push expect a valid latlng as parameter`);this._drawing===e.Editable.FORWARD?this.newPointForward(t):this.newPointBackward(t)},removeLatLng:function(e){e.__vertex.delete(),this.refresh()},pop:function(){if(this._drawnLatLngs.length<=1)return;let t;return t=this._drawing===e.Editable.FORWARD?this._drawnLatLngs[this._drawnLatLngs.length-1]:this._drawnLatLngs[0],this.removeLatLng(t),this._drawing===e.Editable.FORWARD?this.tools.anchorForwardLineGuide(this._drawnLatLngs[this._drawnLatLngs.length-1]):this.tools.anchorForwardLineGuide(this._drawnLatLngs[0]),t},processDrawingClick:function(t){t.vertex&&t.vertex.editor===this||(this._drawing===e.Editable.FORWARD?this.newPointForward(t.latlng):this.newPointBackward(t.latlng),this.fireAndForward(`editable:drawing:clicked`,t))},onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&(this.tools.moveForwardLineGuide(t.latlng),this.tools.moveBackwardLineGuide(t.latlng))},refresh:function(){this.feature.redraw(),this.onEditing()},newShape:function(e){let t=this.addNewEmptyShape();t&&(this.setDrawnLatLngs(t[0]||t),this.startDrawingForward(),this.fireAndForward(`editable:shape:new`,{shape:t}),e&&this.newPointForward(e))},deleteShape:function(t,n){let r={shape:t};if(e.Editable.makeCancellable(r),this.fireAndForward(`editable:shape:delete`,r),!r._cancelled)return t=this._deleteShape(t,n),this.ensureNotFlat&&this.ensureNotFlat(),this.feature.setLatLngs(this.getLatLngs()),this.refresh(),this.reset(),this.fireAndForward(`editable:shape:deleted`,{shape:t}),this.onEdited(),t},_deleteShape:function(e,t){if(t||=this.getLatLngs(),!t.length)return;let n=(e,t)=>e.splice(0,Number.MAX_VALUE),r=(e,t)=>(e.splice(e.indexOf(t),1),e.length||this._deleteShape(e),t);if(t===e)return n(t,e);for(let n of t){if(n===e)return r(t,e);if(n.indexOf(e)!==-1)return r(n,e)}},deleteShapeAt:function(e){let t=this.feature.shapeAt(e);if(t)return this.deleteShape(t)},appendShape:function(e){this.insertShape(e)},prependShape:function(e){this.insertShape(e,0)},insertShape:function(e,t){this.ensureMulti(),e=this.formatShape(e),t===void 0&&(t=this.feature._latlngs.length),this.feature._latlngs.splice(t,0,e),this.feature.redraw(),this._enabled&&this.reset()},extendBounds:function(e){this.feature._bounds.extend(e.vertex.latlng)},onDragStart:function(t){this.editLayer.clearLayers(),e.Editable.BaseEditor.prototype.onDragStart.call(this,t)},onDragEnd:function(t){this.initVertexMarkers(),e.Editable.BaseEditor.prototype.onDragEnd.call(this,t)}}),e.Editable.PolylineEditor=e.Editable.PathEditor.extend({startDrawingBackward:function(){this._drawing=e.Editable.BACKWARD,this.startDrawing()},continueBackward:function(e){this.drawing()||(e||=this.getDefaultLatLngs(),this.setDrawnLatLngs(e),e.length>0&&(this.tools.attachBackwardLineGuide(),this.tools.anchorBackwardLineGuide(e[0])),this.startDrawingBackward())},continueForward:function(e){this.drawing()||(e||=this.getDefaultLatLngs(),this.setDrawnLatLngs(e),e.length>0&&(this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(e[e.length-1])),this.startDrawingForward())},getDefaultLatLngs:function(t){return t||=this.feature._latlngs,!t.length||t[0]instanceof e.LatLng?t:this.getDefaultLatLngs(t[0])},ensureMulti:function(){this.feature._latlngs.length&&l(this.feature._latlngs)&&(this.feature._latlngs=[this.feature._latlngs])},addNewEmptyShape:function(){if(this.feature._latlngs.length){let e=[];return this.appendShape(e),e}return this.feature._latlngs},formatShape:function(e){if(l(e))return e;if(e[0])return this.formatShape(e[0])},splitShape:function(t,n){if(!n||n>=t.length-1)return;this.ensureMulti();let r=this.feature._latlngs.indexOf(t);if(r===-1)return;let i=t.slice(0,n+1),a=t.slice(n);a[0]=e.latLng(a[0].lat,a[0].lng,a[0].alt),this.feature._latlngs.splice(r,1,i,a),this.refresh(),this.reset(),this.onEdited()}}),e.Editable.PolygonEditor=e.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:3,newPointForward:function(t){e.Editable.PathEditor.prototype.newPointForward.call(this,t),this.tools.backwardLineGuide._latlngs.length||this.tools.anchorBackwardLineGuide(t),this._drawnLatLngs.length===2&&this.tools.attachBackwardLineGuide()},addNewEmptyHole:function(e){this.ensureNotFlat();let t=this.feature.shapeAt(e);if(!t)return;let n=[];return t.push(n),n},newHole:function(e){let t=this.addNewEmptyHole(e);t&&(this.setDrawnLatLngs(t),this.startDrawingForward(),e&&this.newPointForward(e))},addNewEmptyShape:function(){if(this.feature._latlngs.length&&this.feature._latlngs[0].length){let e=[];return this.appendShape(e),e}return this.feature._latlngs},ensureMulti:function(){this.feature._latlngs.length&&l(this.feature._latlngs[0])&&(this.feature._latlngs=[this.feature._latlngs])},ensureNotFlat:function(){(!this.feature._latlngs.length||l(this.feature._latlngs))&&(this.feature._latlngs=[this.feature._latlngs])},vertexCanBeDeleted:function(t){let n=this.feature.parentShape(t.latlngs);return e.Util.indexOf(n,t.latlngs)>0?!0:e.Editable.PathEditor.prototype.vertexCanBeDeleted.call(this,t)},getDefaultLatLngs:function(){return this.feature._latlngs.length||this.feature._latlngs.push([]),this.feature._latlngs[0]},formatShape:e=>l(e)&&(!e[0]||e[0].length!==0)?[e]:e}),e.Editable.RectangleEditor=e.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:4,options:{skipMiddleMarkers:!0},extendBounds:function(t){let n=t.vertex.getIndex(),r=t.vertex.getNext(),i=t.vertex.getPrevious(),a=(n+2)%4,o=t.vertex.latlngs[a],s=new e.LatLngBounds(t.latlng,o);i.latlng.update([t.latlng.lat,o.lng]),r.latlng.update([o.lat,t.latlng.lng]),this.updateBounds(s),this.refreshVertexMarkers()},onDrawingMouseDown:function(t){e.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this.connect();let n=this.getDefaultLatLngs();n.length===3&&n.push(t.latlng);let r=new e.LatLngBounds(t.latlng,t.latlng);this.updateBounds(r),this.updateLatLngs(r),this.refresh(),this.reset(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),n[3].__vertex.dragging._draggable._onDown(t.originalEvent)},onDrawingMouseUp:function(t){this.commitDrawing(t),t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,t)},onDrawingMouseMove:function(t){t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,t)},getDefaultLatLngs:function(e){return e||this.feature._latlngs[0]},updateBounds:function(e){this.feature._bounds=e},updateLatLngs:function(e){let t=this.getDefaultLatLngs(),n=this.feature._boundsToLatLngs(e);for(let e=0;e<t.length;e++)t[e].update(n[e])}}),e.Editable.CircleEditor=e.Editable.PathEditor.extend({MIN_VERTEX:2,options:{skipMiddleMarkers:!0},initialize:function(t,n,r){e.Editable.PathEditor.prototype.initialize.call(this,t,n,r),this._resizeLatLng=this.computeResizeLatLng()},computeResizeLatLng:function(){let e=(this.feature._radius||this.feature._mRadius)*Math.cos(Math.PI/4),t=this.map.project(this.feature._latlng);return this.map.unproject([t.x+e,t.y-e])},updateResizeLatLng:function(){this._resizeLatLng.update(this.computeResizeLatLng()),this._resizeLatLng.__vertex.update()},getLatLngs:function(){return[this.feature._latlng,this._resizeLatLng]},getDefaultLatLngs:function(){return this.getLatLngs()},onVertexMarkerDrag:function(t){t.vertex.getIndex()===1?this.resize(t):this.updateResizeLatLng(t),e.Editable.PathEditor.prototype.onVertexMarkerDrag.call(this,t)},resize:function(e){let t;t=this.map.options.crs?this.map.options.crs.distance(this.feature._latlng,e.latlng):this.feature._latlng.distanceTo(e.latlng),this.feature.setRadius(t)},onDrawingMouseDown:function(t){e.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this._resizeLatLng.update(t.latlng),this.feature._latlng.update(t.latlng),this.connect(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),this._resizeLatLng.__vertex.dragging._draggable._onDown(t.originalEvent)},onDrawingMouseUp:function(t){this.commitDrawing(t),t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,t)},onDrawingMouseMove:function(t){t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,t)},onDrag:function(t){e.Editable.PathEditor.prototype.onDrag.call(this,t),this.feature.dragging.updateLatLng(this._resizeLatLng)}});let t={createEditor:function(e){e||=this._map;let t=this.options.editOptions?.editTools||e.editTools;if(!t)throw Error(`Unable to detect Editable instance.`);return new(this.options.editorClass||(this.getEditorClass(t)))(e,this,this.options.editOptions)},enableEdit:function(e){return this.editor||this.createEditor(e),this.editor.enable(),this.editor},editEnabled:function(){return this.editor?.enabled()},disableEdit:function(){this.editor&&(this.editor.disable(),delete this.editor)},toggleEdit:function(){this.editEnabled()?this.disableEdit():this.enableEdit()},_onEditableAdd:function(){this.editor&&this.enableEdit()}},n={getEditorClass:t=>t?.options?.polylineEditorClass||e.Editable.PolylineEditor,shapeAt:function(e,t){let n=null;if(t||=this._latlngs,!t.length)return n;if(l(t)&&this.isInLatLngs(e,t))n=t;else for(let n of t)if(this.isInLatLngs(e,n))return n;return n},isInLatLngs:function(t,n){if(!n)return!1;let r,i,a,o=[],s,c=this._clickTolerance();if(this._projectLatlngs(n,o,this._pxBounds),o=o[0],s=this._map.latLngToLayerPoint(t),!this._pxBounds.contains(s))return!1;for(r=1,a=o.length,i=0;r<a;i=r++)if(e.LineUtil.pointToSegmentDistance(s,o[i],o[r])<=c)return!0;return!1}},r={getEditorClass:t=>t?.options?.polygonEditorClass||e.Editable.PolygonEditor,shapeAt:function(e,t){let n=null;if(t||=this._latlngs,!t.length)return n;if(l(t)&&this.isInLatLngs(e,t)&&(n=t),l(t[0])&&this.isInLatLngs(e,t[0]))n=t;else for(let n of t)if(this.isInLatLngs(e,n[0]))return n;return n},isInLatLngs:(e,t)=>{let n=!1,r,i,a,o,s;for(a=0,s=t.length,o=s-1;a<s;o=a++)r=t[a],i=t[o],r.lat>e.lat!=i.lat>e.lat&&e.lng<(i.lng-r.lng)*(e.lat-r.lat)/(i.lat-r.lat)+r.lng&&(n=!n);return n},parentShape:function(t,n){if(n||=this._latlngs,!n)return;let r=e.Util.indexOf(n,t);if(r!==-1)return n;for(let i of n)if(r=e.Util.indexOf(i,t),r!==-1)return i}},i={getEditorClass:t=>t?.options?.markerEditorClass||e.Editable.MarkerEditor},a={getEditorClass:t=>t?.options?.circleMarkerEditorClass||e.Editable.CircleMarkerEditor},o={getEditorClass:t=>t?.options?.rectangleEditorClass||e.Editable.RectangleEditor},s={getEditorClass:t=>t?.options?.circleEditorClass||e.Editable.CircleEditor},c=function(){this.on(`add`,this._onEditableAdd)},l=e.LineUtil.isFlat||e.LineUtil._flat||e.Polyline._flat;e.Polyline&&(e.Polyline.include(t),e.Polyline.include(n),e.Polyline.addInitHook(c)),e.Polygon&&(e.Polygon.include(t),e.Polygon.include(r)),e.Marker&&(e.Marker.include(t),e.Marker.include(i),e.Marker.addInitHook(c)),e.CircleMarker&&(e.CircleMarker.include(t),e.CircleMarker.include(a),e.CircleMarker.addInitHook(c)),e.Rectangle&&(e.Rectangle.include(t),e.Rectangle.include(o)),e.Circle&&(e.Circle.include(t),e.Circle.include(s)),e.LatLng.prototype.update=function(t){t=e.latLng(t),this.lat=t.lat,this.lng=t.lng}},window)})),Nd=l(jd(),1);Md();var Pd=`/* required styles */\r
|
|
440
431
|
\r
|
|
441
432
|
.leaflet-pane,\r
|
|
442
433
|
.leaflet-tile,\r
|
|
@@ -1097,7 +1088,7 @@ svg.leaflet-image-layer.leaflet-interactive path {\r
|
|
|
1097
1088
|
print-color-adjust: exact;\r
|
|
1098
1089
|
}\r
|
|
1099
1090
|
}\r
|
|
1100
|
-
`,
|
|
1091
|
+
`,Fd=`.leaflet-fullscreen-icon {
|
|
1101
1092
|
background-image: url('icon-fullscreen.svg');
|
|
1102
1093
|
background-size: 26px 52px;
|
|
1103
1094
|
}
|
|
@@ -1136,7 +1127,7 @@ svg.leaflet-image-layer.leaflet-interactive path {\r
|
|
|
1136
1127
|
left: 0 !important;
|
|
1137
1128
|
z-index: 99999;
|
|
1138
1129
|
}
|
|
1139
|
-
`;
|
|
1130
|
+
`;o(((e,t)=>{(function(e,n){typeof define==`function`&&define.amd?define(`leafletFullScreen`,[`leaflet`],n):typeof t==`object`&&t.exports?t.exports=n(jd()):n(e.L)})(typeof self<`u`?self:e,e=>{if(typeof document>`u`)return console.warn(`"window.document" is undefined; leaflet.fullscreen requires this object to access the DOM`),!1;let t=(()=>{let e=[[`requestFullscreen`,`exitFullscreen`,`fullscreenElement`,`fullscreenEnabled`,`fullscreenchange`,`fullscreenerror`],[`webkitRequestFullscreen`,`webkitExitFullscreen`,`webkitFullscreenElement`,`webkitFullscreenEnabled`,`webkitfullscreenchange`,`webkitfullscreenerror`]],t=e[0],n={};for(let r of e)if(r[1]in document){for(let e=0;e<r.length;e++)n[t[e]]=r[e];return n}return!1})(),n={change:t.fullscreenchange,error:t.fullscreenerror},r={request(e,n){return new Promise((r,i)=>{let a=function(){this.off(`change`,a),r()}.bind(this);this.on(`change`,a),e||=document.documentElement;let o=e[t.requestFullscreen](n);o instanceof Promise&&o.then(a).catch(i)})},exit(){return new Promise((e,n)=>{if(!this.isFullscreen){e();return}let r=function(){this.off(`change`,r),e()}.bind(this);this.on(`change`,r);let i=document[t.exitFullscreen]();i instanceof Promise&&i.then(r).catch(n)})},on(e,t){let r=n[e];r&&document.addEventListener(r,t,!1)},off(e,t){let r=n[e];r&&document.removeEventListener(r,t,!1)},nativeAPI:t};return Object.defineProperties(r,{isFullscreen:{get(){return!!document[t.fullscreenElement]}},isEnabled:{enumerable:!0,get(){return!!document[t.fullscreenEnabled]}}}),e.Control.FullScreen=e.Control.extend({options:{position:`topleft`,title:`Full Screen`,titleCancel:`Exit Full Screen`,forceSeparateButton:!1,forcePseudoFullscreen:!1,fullscreenElement:!1},_screenfull:r,onAdd(t){let n=`leaflet-control-zoom-fullscreen`,r,i=``;return r=t.zoomControl&&!this.options.forceSeparateButton?t.zoomControl._container:e.DomUtil.create(`div`,`leaflet-bar`),this.options.content?i=this.options.content:n+=` leaflet-fullscreen-icon`,this._createButton(this.options.title,n,i,r,this.toggleFullScreen,this),this._map.fullscreenControl=this,this._map.on(`enterFullscreen exitFullscreen`,this._toggleState,this),r},onRemove(){e.DomEvent.off(this.link,`click`,e.DomEvent.stop).off(this.link,`click`,this.toggleFullScreen,this),this._screenfull.isEnabled&&(e.DomEvent.off(this._container,this._screenfull.nativeAPI.fullscreenchange,e.DomEvent.stop).off(this._container,this._screenfull.nativeAPI.fullscreenchange,this._handleFullscreenChange,this),e.DomEvent.off(document,this._screenfull.nativeAPI.fullscreenchange,e.DomEvent.stop).off(document,this._screenfull.nativeAPI.fullscreenchange,this._handleFullscreenChange,this))},_createButton(t,n,r,i,a,o){return this.link=e.DomUtil.create(`a`,n,i),this.link.href=`#`,this.link.title=t,this.link.innerHTML=r,this.link.setAttribute(`role`,`button`),this.link.setAttribute(`aria-label`,t),L.DomEvent.disableClickPropagation(i),e.DomEvent.on(this.link,`click`,e.DomEvent.stop).on(this.link,`click`,a,o),this._screenfull.isEnabled&&(e.DomEvent.on(i,this._screenfull.nativeAPI.fullscreenchange,e.DomEvent.stop).on(i,this._screenfull.nativeAPI.fullscreenchange,this._handleFullscreenChange,o),e.DomEvent.on(document,this._screenfull.nativeAPI.fullscreenchange,e.DomEvent.stop).on(document,this._screenfull.nativeAPI.fullscreenchange,this._handleFullscreenChange,o)),this.link},toggleFullScreen(){let t=this._map;t._exitFired=!1,t._isFullscreen?(this._screenfull.isEnabled&&!this.options.forcePseudoFullscreen?this._screenfull.exit().then(()=>t.invalidateSize()):(e.DomUtil.removeClass(this.options.fullscreenElement?this.options.fullscreenElement:t._container,`leaflet-pseudo-fullscreen`),t.invalidateSize()),t.fire(`exitFullscreen`),t._exitFired=!0,t._isFullscreen=!1):(this._screenfull.isEnabled&&!this.options.forcePseudoFullscreen?this._screenfull.request(this.options.fullscreenElement?this.options.fullscreenElement:t._container).then(()=>t.invalidateSize()):(e.DomUtil.addClass(this.options.fullscreenElement?this.options.fullscreenElement:t._container,`leaflet-pseudo-fullscreen`),t.invalidateSize()),t.fire(`enterFullscreen`),t._isFullscreen=!0)},_toggleState(){this.link.title=this._map._isFullscreen?this.options.title:this.options.titleCancel,this._map._isFullscreen?L.DomUtil.removeClass(this.link,`leaflet-fullscreen-on`):L.DomUtil.addClass(this.link,`leaflet-fullscreen-on`)},_handleFullscreenChange(e){let t=this._map;e.target===t.getContainer()&&!this._screenfull.isFullscreen&&!t._exitFired&&(this._screenfull.exit().then(()=>t.invalidateSize()),t.fire(`exitFullscreen`),t._exitFired=!0,t._isFullscreen=!1)}}),e.Map.include({toggleFullscreen(){this.fullscreenControl.toggleFullScreen()}}),e.Map.addInitHook(function(){this.options.fullscreenControl&&this.addControl(e.control.fullscreen(this.options.fullscreenControlOptions))}),e.control.fullscreen=function(t){return new e.Control.FullScreen(t)},{leaflet:e}})}))();var Id=`
|
|
1140
1131
|
#shaclMapDialog .closeButton { position: absolute; right: 0; top: 0; z-index: 1; padding: 6px 8px; cursor: pointer; border: 0; background-color: #FFFA; font-size: 24px; z-index: 1000; }
|
|
1141
1132
|
#shaclMapDialog { padding: 0; width:90vw; height: 90vh; margin: auto; }
|
|
1142
1133
|
#shaclMapDialog::backdrop { background-color: #0007; }
|
|
@@ -1145,11 +1136,11 @@ svg.leaflet-image-layer.leaflet-interactive path {\r
|
|
|
1145
1136
|
.leaflet-container { min-height: 300px; }
|
|
1146
1137
|
.fullscreen-icon { background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjYgNTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIwLjYgMzYuN0gxNmEuOS45IDAgMCAxLS44LS44di00LjVjMC0uMi4yLS40LjQtLjRoMS40Yy4zIDAgLjUuMi41LjR2M2gzYy4yIDAgLjQuMi40LjV2MS40YzAgLjItLjIuNC0uNC40em0tOS45LS44di00LjVjMC0uMi0uMi0uNC0uNC0uNEg4LjljLS4zIDAtLjUuMi0uNS40djNoLTNjLS4yIDAtLjQuMi0uNC41djEuNGMwIC4yLjIuNC40LjRIMTBjLjQgMCAuOC0uNC44LS44em0wIDEwLjdWNDJjMC0uNC0uNC0uOC0uOC0uOEg1LjRjLS4yIDAtLjQuMi0uNC40djEuNGMwIC4zLjIuNS40LjVoM3YzYzAgLjIuMi40LjUuNGgxLjRjLjIgMCAuNC0uMi40LS40em02LjkgMHYtM2gzYy4yIDAgLjQtLjIuNC0uNXYtMS40YzAtLjItLjItLjQtLjQtLjRIMTZjLS40IDAtLjguNC0uOC44djQuNWMwIC4yLjIuNC40LjRoMS40Yy4zIDAgLjUtLjIuNS0uNHpNNSAxMC4zVjUuOWMwLS41LjQtLjkuOS0uOWg0LjRjLjIgMCAuNC4yLjQuNFY3YzAgLjItLjIuNC0uNC40aC0zdjNjMCAuMi0uMi40LS40LjRINS40YS40LjQgMCAwIDEtLjQtLjR6bTEwLjMtNC45VjdjMCAuMi4yLjQuNC40aDN2M2MwIC4yLjIuNC40LjRoMS41Yy4yIDAgLjQtLjIuNC0uNFY1LjljMC0uNS0uNC0uOS0uOS0uOWgtNC40Yy0uMiAwLS40LjItLjQuNHptNS4zIDkuOUgxOWMtLjIgMC0uNC4yLS40LjR2M2gtM2MtLjIgMC0uNC4yLS40LjR2MS41YzAgLjIuMi40LjQuNGg0LjRjLjUgMCAuOS0uNC45LS45di00LjRjMC0uMi0uMi0uNC0uNC0uNHptLTkuOSA1LjNWMTljMC0uMi0uMi0uNC0uNC0uNGgtM3YtM2MwLS4yLS4yLS40LS40LS40SDUuNGMtLjIgMC0uNC4yLS40LjR2NC40YzAgLjUuNC45LjkuOWg0LjRjLjIgMCAuNC0uMi40LS40eiIgZmlsbD0iY3VycmVudENvbG9yIi8+PC9zdmc+); }
|
|
1147
1138
|
#shaclMapDialogContainer { width:100%; height: 100%; }
|
|
1148
|
-
|
|
1139
|
+
`,Ld=`
|
|
1149
1140
|
<dialog id="shaclMapDialog" onclick="event.target==this && this.close()">
|
|
1150
1141
|
<div id="shaclMapDialogContainer"></div>
|
|
1151
1142
|
<div class="hint">ⓘ Draw a polygon or marker, then close dialog</div>
|
|
1152
1143
|
<button class="closeButton" type="button" onclick="this.parentElement.close()">✕</button>
|
|
1153
|
-
</dialog>`,
|
|
1154
|
-
`+
|
|
1155
|
-
`+
|
|
1144
|
+
</dialog>`,Rd={lng:8.657238961696038,lat:49.87627570549512},zd=`© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>`,Bd=`https://tile.openstreetmap.de/{z}/{x}/{y}.png`,Vd=Nd.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]}),Hd=class extends Or{constructor(e){super(e,Pd+`
|
|
1145
|
+
`+Fd+`
|
|
1146
|
+
`+Id)}initEditMode(e){e.insertAdjacentHTML(`beforeend`,Ld);let t=e.querySelector(`#shaclMapDialogContainer`);this.map=Nd.map(t,{fullscreenControl:!0,editable:!0,layers:[Nd.tileLayer(Bd)],zoom:5,maxBounds:Ud,center:Rd}),this.map.attributionControl.addAttribution(zd);let n=Nd.Control.extend({options:{position:`topleft`,callback:null,kind:``,html:``},onAdd:function(e){let t=Nd.DomUtil.create(`div`,`leaflet-control leaflet-bar`),n=Nd.DomUtil.create(`a`,``,t);return n.href=`#`,n.title=`Create a new `+this.options.kind,n.innerHTML=this.options.html,Nd.DomEvent.on(n,`click`,Nd.DomEvent.stop).on(n,`click`,()=>{window.LAYER=this.options.callback.call(e.editTools)},this),t}});this.map.addControl(new(n.extend({options:{callback:()=>{this.displayedShape?.remove(),this.displayedShape=this.map?.editTools.startPolygon()},kind:`polygon`,html:`▰`}}))),this.map.addControl(new(n.extend({options:{callback:()=>{this.displayedShape?.remove(),this.displayedShape=this.map?.editTools.startMarker(void 0,{icon:Vd})},kind:`marker`,html:`•`}}))),this.map.on(`editable:drawing:end`,()=>{this.saveChanges()}),this.map.on(`editable:vertex:dragend`,()=>{this.saveChanges()});let r=e.querySelector(`#shaclMapDialog`);return 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=Gd(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(Wd(this.currentEditor.value||``),this.map),document.body.style.top=`-${window.scrollY}px`,document.body.style.position=`fixed`,n.showModal()};let i=br(e,t||null,!0);return i.appendChild(r),i}createViewer(e,t){let n=document.createElement(`div`),r=Wd(t.value);if(r?.coordinates?.length){let e=Nd.map(n,{fullscreenControl:!0,layers:[Nd.tileLayer(Bd)],zoom:5,center:Rd,maxBounds:Ud});e.attributionControl.addAttribution(zd),this.drawAndZoomToGeometry(r,e)}return n}drawAndZoomToGeometry(e,t){if(setTimeout(()=>{t.invalidateSize()}),e?.type===`Point`){let n={lng:e.coordinates[0],lat:e.coordinates[1]};this.displayedShape=Nd.marker(n,{icon:Vd}).addTo(t),t.setView(n,15,{animate:!1})}else if(e?.type===`Polygon`){let n=e.coordinates[0].map(e=>({lng:e[0],lat:e[1]})),r=Nd.polygon(n).addTo(t);this.displayedShape=r,t.fitBounds(r.getBounds(),{animate:!1}),setTimeout(()=>{t.fitBounds(r.getBounds(),{animate:!1}),t.setView(r.getCenter(),void 0,{animate:!1})},1)}else t.setZoom(5)}saveChanges(){if(this.displayedShape instanceof Nd.Marker){let e=this.displayedShape.getLatLng();this.createdGeometry={type:`Point`,coordinates:[e.lng,e.lat]}}else if(this.displayedShape instanceof Nd.Polygon){let e=this.displayedShape.getLatLngs();e[0][0].equals(e[0][e[0].length-1])||e[0].push(e[0][0]),this.createdGeometry={type:`Polygon`,coordinates:[e[0].map(e=>[e.lng,e.lat])]}}else this.createdGeometry=void 0}},Ud=[[-90,-180],[90,180]];function Wd(e){let t=e.match(/^POINT\((.*)\)$/);if(t?.length==2){let e=t[1].split(` `);if(e.length===2)return{type:`Point`,coordinates:[parseFloat(e[0]),parseFloat(e[1])]}}let n=e.match(/^POLYGON[(]{2}(.*)[)]{2}$/);if(n?.length==2){let e=n[1].split(`,`);if(e.length>2){let t=[],n=[];t.push(n);for(let t of e){let e=t.split(` `);e.length===2&&n.push([parseFloat(e[0]),parseFloat(e[1])])}return{type:`Polygon`,coordinates:t}}}}function Gd(e){return e.type===`Point`?`POINT(${e.coordinates.join(` `)})`:e.type===`Polygon`?`POLYGON((${e.coordinates[0].map(e=>e.join(` `)).join(`,`)}))`:``}export{Dd as Config,ds as DefaultTheme,Ad as FileUploadPlugin,Hd as LeafletPlugin,Or as Plugin,kd as ShaclForm,lr as ShaclPropertyTemplate,yr as Theme,ir as fetchRDF,tr as findConformsToShapeSubject,er as findConformsToValuesSubject,Rt as findLabel,Gd as geometryToWkt,rr as importRDF,Od as initTimeout,nr as loadGraphs,ar as parseRDF,$n as prefixes,cr as propertyMappers,Qn as rdfCache,Tr as registerPlugin,Wd as wktToGeometry,Ud as worldBounds};
|