@ulb-darmstadt/shacl-form 1.10.1 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ var Er=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"
24
24
  `:`
25
25
  }
26
26
  `),this._subject=null),this._write=this._blockedWrite;let t=e&&((i,n)=>{t=null,e(i,n)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function ns(r){let e=xu[r];return e===void 0&&(r.length===1?(e=r.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var wn={exports:{}},xn={exports:{}},_n,os;function Be(){if(os)return _n;os=1;class r extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let i="";for(let n=0;n<t.length;n++)i+=` ${t[n].stack}
27
- `;super(i),this.name="AggregateError",this.errors=t}}return _n={AggregateError:r,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,i){return e.slice(t,i)},Error,FunctionPrototypeCall(e,t,...i){return e.call(t,...i)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},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,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,i){return Object.defineProperty(e,t,i)},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,i){return e.then(t,i)},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,i){return e.slice(t,i)},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,i){return e.set(t,i)},Boolean,Uint8Array},_n}var kn={exports:{}},En,as;function Zd(){return as||(as=1,En={format(r,...e){return r.replace(/%([sdifj])/g,function(...[t,i]){const n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(r){switch(typeof r){case"string":if(r.includes("'"))if(r.includes('"')){if(!r.includes("`")&&!r.includes("${"))return`\`${r}\``}else return`"${r}"`;return`'${r}'`;case"number":return isNaN(r)?"NaN":Object.is(r,-0)?String(r):r;case"bigint":return`${String(r)}n`;case"boolean":case"undefined":return String(r);case"object":return"{}"}}}),En}var Sn,ss;function nt(){if(ss)return Sn;ss=1;const{format:r,inspect:e}=Zd(),{AggregateError:t}=Be(),i=globalThis.AggregateError||t,n=Symbol("kIsNodeError"),o=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,s="__node_internal_",d={};function l(x,_){if(!x)throw new d.ERR_INTERNAL_ASSERTION(_)}function c(x){let _="",E=x.length;const m=x[0]==="-"?1:0;for(;E>=m+4;E-=3)_=`_${x.slice(E-3,E)}${_}`;return`${x.slice(0,E)}${_}`}function u(x,_,E){if(typeof _=="function")return l(_.length<=E.length,`Code: ${x}; The provided arguments length (${E.length}) does not match the required ones (${_.length}).`),_(...E);const m=(_.match(/%[dfijoOs]/g)||[]).length;return l(m===E.length,`Code: ${x}; The provided arguments length (${E.length}) does not match the required ones (${m}).`),E.length===0?_:r(_,...E)}function v(x,_,E){E||(E=Error);class m extends E{constructor(...b){super(u(x,_,b))}toString(){return`${this.name} [${x}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:E.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${x}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=x,m.prototype[n]=!0,d[x]=m}function g(x){const _=s+x.name;return Object.defineProperty(x,"name",{value:_}),x}function y(x,_){if(x&&_&&x!==_){if(Array.isArray(_.errors))return _.errors.push(x),_;const E=new i([_,x],_.message);return E.code=_.code,E}return x||_}class k extends Error{constructor(_="The operation was aborted",E=void 0){if(E!==void 0&&typeof E!="object")throw new d.ERR_INVALID_ARG_TYPE("options","Object",E);super(_,E),this.code="ABORT_ERR",this.name="AbortError"}}return v("ERR_ASSERTION","%s",Error),v("ERR_INVALID_ARG_TYPE",(x,_,E)=>{l(typeof x=="string","'name' must be a string"),Array.isArray(_)||(_=[_]);let m="The ";x.endsWith(" argument")?m+=`${x} `:m+=`"${x}" ${x.includes(".")?"property":"argument"} `,m+="must be ";const f=[],b=[],R=[];for(const T of _)l(typeof T=="string","All expected entries have to be of type string"),o.includes(T)?f.push(T.toLowerCase()):a.test(T)?b.push(T):(l(T!=="object",'The value "object" should be written as "Object"'),R.push(T));if(b.length>0){const T=f.indexOf("object");T!==-1&&(f.splice(f,T,1),b.push("Object"))}if(f.length>0){switch(f.length){case 1:m+=`of type ${f[0]}`;break;case 2:m+=`one of type ${f[0]} or ${f[1]}`;break;default:{const T=f.pop();m+=`one of type ${f.join(", ")}, or ${T}`}}(b.length>0||R.length>0)&&(m+=" or ")}if(b.length>0){switch(b.length){case 1:m+=`an instance of ${b[0]}`;break;case 2:m+=`an instance of ${b[0]} or ${b[1]}`;break;default:{const T=b.pop();m+=`an instance of ${b.join(", ")}, or ${T}`}}R.length>0&&(m+=" or ")}switch(R.length){case 0:break;case 1:R[0].toLowerCase()!==R[0]&&(m+="an "),m+=`${R[0]}`;break;case 2:m+=`one of ${R[0]} or ${R[1]}`;break;default:{const T=R.pop();m+=`one of ${R.join(", ")}, or ${T}`}}if(E==null)m+=`. Received ${E}`;else if(typeof E=="function"&&E.name)m+=`. Received function ${E.name}`;else if(typeof E=="object"){var L;if((L=E.constructor)!==null&&L!==void 0&&L.name)m+=`. Received an instance of ${E.constructor.name}`;else{const T=e(E,{depth:-1});m+=`. Received ${T}`}}else{let T=e(E,{colors:!1});T.length>25&&(T=`${T.slice(0,25)}...`),m+=`. Received type ${typeof E} (${T})`}return m},TypeError),v("ERR_INVALID_ARG_VALUE",(x,_,E="is invalid")=>{let m=e(_);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${x.includes(".")?"property":"argument"} '${x}' ${E}. Received ${m}`},TypeError),v("ERR_INVALID_RETURN_VALUE",(x,_,E)=>{var m;const f=E!=null&&(m=E.constructor)!==null&&m!==void 0&&m.name?`instance of ${E.constructor.name}`:`type ${typeof E}`;return`Expected ${x} to be returned from the "${_}" function but got ${f}.`},TypeError),v("ERR_MISSING_ARGS",(...x)=>{l(x.length>0,"At least one arg needs to be specified");let _;const E=x.length;switch(x=(Array.isArray(x)?x:[x]).map(m=>`"${m}"`).join(" or "),E){case 1:_+=`The ${x[0]} argument`;break;case 2:_+=`The ${x[0]} and ${x[1]} arguments`;break;default:{const m=x.pop();_+=`The ${x.join(", ")}, and ${m} arguments`}break}return`${_} must be specified`},TypeError),v("ERR_OUT_OF_RANGE",(x,_,E)=>{l(_,'Missing "range" argument');let m;if(Number.isInteger(E)&&Math.abs(E)>2**32)m=c(String(E));else if(typeof E=="bigint"){m=String(E);const f=BigInt(2)**BigInt(32);(E>f||E<-f)&&(m=c(m)),m+="n"}else m=e(E);return`The value of "${x}" is out of range. It must be ${_}. Received ${m}`},RangeError),v("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),v("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),v("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),v("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),v("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),v("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),v("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),v("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),v("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),v("ERR_STREAM_WRITE_AFTER_END","write after end",Error),v("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Sn={AbortError:k,aggregateTwoErrors:g(y),hideStackFrames:g,codes:d},Sn}var Wr={exports:{}},ls;function xi(){if(ls)return Wr.exports;ls=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Wr.exports=r,Wr.exports.AbortSignal=e,Wr.exports.default=r,Wr.exports}var Fi={exports:{}},ds;function an(){if(ds)return Fi.exports;ds=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(b,R,L){return Function.prototype.apply.call(b,R,L)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:t=function(b){return Object.getOwnPropertyNames(b)};function i(f){console&&console.warn&&console.warn(f)}var n=Number.isNaN||function(b){return b!==b};function o(){o.init.call(this)}Fi.exports=o,Fi.exports.once=_,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(f){if(typeof f!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof f)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(f){if(typeof f!="number"||f<0||n(f))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+f+".");a=f}}),o.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},o.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||n(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function d(f){return f._maxListeners===void 0?o.defaultMaxListeners:f._maxListeners}o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(b){for(var R=[],L=1;L<arguments.length;L++)R.push(arguments[L]);var T=b==="error",B=this._events;if(B!==void 0)T=T&&B.error===void 0;else if(!T)return!1;if(T){var I;if(R.length>0&&(I=R[0]),I instanceof Error)throw I;var $=new Error("Unhandled error."+(I?" ("+I.message+")":""));throw $.context=I,$}var q=B[b];if(q===void 0)return!1;if(typeof q=="function")e(q,this,R);else for(var A=q.length,j=y(q,A),L=0;L<A;++L)e(j[L],this,R);return!0};function l(f,b,R,L){var T,B,I;if(s(R),B=f._events,B===void 0?(B=f._events=Object.create(null),f._eventsCount=0):(B.newListener!==void 0&&(f.emit("newListener",b,R.listener?R.listener:R),B=f._events),I=B[b]),I===void 0)I=B[b]=R,++f._eventsCount;else if(typeof I=="function"?I=B[b]=L?[R,I]:[I,R]:L?I.unshift(R):I.push(R),T=d(f),T>0&&I.length>T&&!I.warned){I.warned=!0;var $=new Error("Possible EventEmitter memory leak detected. "+I.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");$.name="MaxListenersExceededWarning",$.emitter=f,$.type=b,$.count=I.length,i($)}return f}o.prototype.addListener=function(b,R){return l(this,b,R,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(b,R){return l(this,b,R,!0)};function c(){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 u(f,b,R){var L={fired:!1,wrapFn:void 0,target:f,type:b,listener:R},T=c.bind(L);return T.listener=R,L.wrapFn=T,T}o.prototype.once=function(b,R){return s(R),this.on(b,u(this,b,R)),this},o.prototype.prependOnceListener=function(b,R){return s(R),this.prependListener(b,u(this,b,R)),this},o.prototype.removeListener=function(b,R){var L,T,B,I,$;if(s(R),T=this._events,T===void 0)return this;if(L=T[b],L===void 0)return this;if(L===R||L.listener===R)--this._eventsCount===0?this._events=Object.create(null):(delete T[b],T.removeListener&&this.emit("removeListener",b,L.listener||R));else if(typeof L!="function"){for(B=-1,I=L.length-1;I>=0;I--)if(L[I]===R||L[I].listener===R){$=L[I].listener,B=I;break}if(B<0)return this;B===0?L.shift():k(L,B),L.length===1&&(T[b]=L[0]),T.removeListener!==void 0&&this.emit("removeListener",b,$||R)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(b){var R,L,T;if(L=this._events,L===void 0)return this;if(L.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):L[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete L[b]),this;if(arguments.length===0){var B=Object.keys(L),I;for(T=0;T<B.length;++T)I=B[T],I!=="removeListener"&&this.removeAllListeners(I);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(R=L[b],typeof R=="function")this.removeListener(b,R);else if(R!==void 0)for(T=R.length-1;T>=0;T--)this.removeListener(b,R[T]);return this};function v(f,b,R){var L=f._events;if(L===void 0)return[];var T=L[b];return T===void 0?[]:typeof T=="function"?R?[T.listener||T]:[T]:R?x(T):y(T,T.length)}o.prototype.listeners=function(b){return v(this,b,!0)},o.prototype.rawListeners=function(b){return v(this,b,!1)},o.listenerCount=function(f,b){return typeof f.listenerCount=="function"?f.listenerCount(b):g.call(f,b)},o.prototype.listenerCount=g;function g(f){var b=this._events;if(b!==void 0){var R=b[f];if(typeof R=="function")return 1;if(R!==void 0)return R.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function y(f,b){for(var R=new Array(b),L=0;L<b;++L)R[L]=f[L];return R}function k(f,b){for(;b+1<f.length;b++)f[b]=f[b+1];f.pop()}function x(f){for(var b=new Array(f.length),R=0;R<b.length;++R)b[R]=f[R].listener||f[R];return b}function _(f,b){return new Promise(function(R,L){function T(I){f.removeListener(b,B),L(I)}function B(){typeof f.removeListener=="function"&&f.removeListener("error",T),R([].slice.call(arguments))}m(f,b,B,{once:!0}),b!=="error"&&E(f,T,{once:!0})})}function E(f,b,R){typeof f.on=="function"&&m(f,"error",b,R)}function m(f,b,R,L){if(typeof f.on=="function")L.once?f.once(b,R):f.on(b,R);else if(typeof f.addEventListener=="function")f.addEventListener(b,function T(B){L.once&&f.removeEventListener(b,T),R(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof f)}return Fi.exports}var cs;function at(){return cs||(cs=1,function(r){const e=Lt(),{format:t,inspect:i}=Zd(),{codes:{ERR_INVALID_ARG_TYPE:n}}=nt(),{kResistStopPropagation:o,AggregateError:a,SymbolDispose:s}=Be(),d=globalThis.AbortSignal||xi().AbortSignal,l=globalThis.AbortController||xi().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,u=globalThis.Blob||e.Blob,v=typeof u<"u"?function(x){return x instanceof u}:function(x){return!1},g=(k,x)=>{if(k!==void 0&&(k===null||typeof k!="object"||!("aborted"in k)))throw new n(x,"AbortSignal",k)},y=(k,x)=>{if(typeof k!="function")throw new n(x,"Function",k)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(k){let x=!1;return function(..._){x||(x=!0,k.apply(this,_))}},createDeferredPromise:function(){let k,x;return{promise:new Promise((E,m)=>{k=E,x=m}),resolve:k,reject:x}},promisify(k){return new Promise((x,_)=>{k((E,...m)=>E?_(E):x(...m))})},debuglog(){return function(){}},format:t,inspect:i,types:{isAsyncFunction(k){return k instanceof c},isArrayBufferView(k){return ArrayBuffer.isView(k)}},isBlob:v,deprecate(k,x){return k},addAbortListener:an().addAbortListener||function(x,_){if(x===void 0)throw new n("signal","AbortSignal",x);g(x,"signal"),y(_,"listener");let E;return x.aborted?queueMicrotask(()=>_()):(x.addEventListener("abort",_,{__proto__:null,once:!0,[o]:!0}),E=()=>{x.removeEventListener("abort",_)}),{__proto__:null,[s](){var m;(m=E)===null||m===void 0||m()}}},AbortSignalAny:d.any||function(x){if(x.length===1)return x[0];const _=new l,E=()=>_.abort();return x.forEach(m=>{g(m,"signals"),m.addEventListener("abort",E,{once:!0})}),_.signal.addEventListener("abort",()=>{x.forEach(m=>m.removeEventListener("abort",E))},{once:!0}),_.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(kn)),kn.exports}var Pi={},Rn,us;function Si(){if(us)return Rn;us=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:i,NumberIsInteger:n,NumberIsNaN:o,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:s,NumberParseInt:d,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:c,String:u,StringPrototypeToUpperCase:v,StringPrototypeTrim:g}=Be(),{hideStackFrames:y,codes:{ERR_SOCKET_BAD_PORT:k,ERR_INVALID_ARG_TYPE:x,ERR_INVALID_ARG_VALUE:_,ERR_OUT_OF_RANGE:E,ERR_UNKNOWN_SIGNAL:m}}=nt(),{normalizeEncoding:f}=at(),{isAsyncFunction:b,isArrayBufferView:R}=at().types,L={};function T(J){return J===(J|0)}function B(J){return J===J>>>0}const I=/^[0-7]+$/,$="must be a 32-bit unsigned integer or an octal string";function q(J,ce,ge){if(typeof J>"u"&&(J=ge),typeof J=="string"){if(c(I,J)===null)throw new _(ce,J,$);J=d(J,8)}return te(J,ce),J}const A=y((J,ce,ge=s,le=a)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);if(J<ge||J>le)throw new E(ce,`>= ${ge} && <= ${le}`,J)}),j=y((J,ce,ge=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);if(J<ge||J>le)throw new E(ce,`>= ${ge} && <= ${le}`,J)}),te=y((J,ce,ge=!1)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);const le=ge?1:0,Ie=4294967295;if(J<le||J>Ie)throw new E(ce,`>= ${le} && <= ${Ie}`,J)});function N(J,ce){if(typeof J!="string")throw new x(ce,"string",J)}function Z(J,ce,ge=void 0,le){if(typeof J!="number")throw new x(ce,"number",J);if(ge!=null&&J<ge||le!=null&&J>le||(ge!=null||le!=null)&&o(J))throw new E(ce,`${ge!=null?`>= ${ge}`:""}${ge!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,J)}const F=y((J,ce,ge)=>{if(!e(ge,J)){const Ie="must be one of: "+t(i(ge,We=>typeof We=="string"?`'${We}'`:u(We)),", ");throw new _(ce,J,Ie)}});function Y(J,ce){if(typeof J!="boolean")throw new x(ce,"boolean",J)}function w(J,ce,ge){return J==null||!l(J,ce)?ge:J[ce]}const U=y((J,ce,ge=null)=>{const le=w(ge,"allowArray",!1),Ie=w(ge,"allowFunction",!1);if(!w(ge,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Ie||typeof J!="function"))throw new x(ce,"Object",J)}),K=y((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new x(ce,"a dictionary",J)}),X=y((J,ce,ge=0)=>{if(!r(J))throw new x(ce,"Array",J);if(J.length<ge){const le=`must be longer than ${ge}`;throw new _(ce,J,le)}});function de(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++)N(J[ge],`${ce}[${ge}]`)}function H(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++)Y(J[ge],`${ce}[${ge}]`)}function G(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++){const le=J[ge],Ie=`${ce}[${ge}]`;if(le==null)throw new x(Ie,"AbortSignal",le);pe(le,Ie)}}function W(J,ce="signal"){if(N(J,ce),L[J]===void 0)throw L[v(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const z=y((J,ce="buffer")=>{if(!R(J))throw new x(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ge=f(ce),le=J.length;if(ge==="hex"&&le%2!==0)throw new _("encoding",ce,`is invalid for data of length ${le}`)}function re(J,ce="Port",ge=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&g(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ge)throw new k(ce,J,ge);return J|0}const pe=y((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new x(ce,"AbortSignal",J)}),be=y((J,ce)=>{if(typeof J!="function")throw new x(ce,"Function",J)}),O=y((J,ce)=>{if(typeof J!="function"||b(J))throw new x(ce,"Function",J)}),V=y((J,ce)=>{if(J!==void 0)throw new x(ce,"undefined",J)});function oe(J,ce,ge){if(!e(ge,J))throw new x(ce,`('${t(ge,"|")}')`,J)}const fe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function he(J,ce){if(typeof J>"u"||!c(fe,J))throw new _(ce,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me(J){if(typeof J=="string")return he(J,"hints"),J;if(r(J)){const ce=J.length;let ge="";if(ce===0)return ge;for(let le=0;le<ce;le++){const Ie=J[le];he(Ie,"hints"),ge+=Ie,le!==ce-1&&(ge+=", ")}return ge}throw new _("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Rn={isInt32:T,isUint32:B,parseFileMode:q,validateArray:X,validateStringArray:de,validateBooleanArray:H,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:z,validateDictionary:K,validateEncoding:ee,validateFunction:be,validateInt32:j,validateInteger:A,validateNumber:Z,validateObject:U,validateOneOf:F,validatePlainFunction:O,validatePort:re,validateSignalName:W,validateString:N,validateUint32:te,validateUndefined:V,validateUnion:oe,validateAbortSignal:pe,validateLinkHeaderValue:me},Rn}var Mi={exports:{}},In={exports:{}},fs;function hr(){if(fs)return In.exports;fs=1;var r=In.exports={},e,t;function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=i}catch{e=i}try{typeof clearTimeout=="function"?t=clearTimeout:t=n}catch{t=n}})();function o(k){if(e===setTimeout)return setTimeout(k,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(k,0);try{return e(k,0)}catch{try{return e.call(null,k,0)}catch{return e.call(this,k,0)}}}function a(k){if(t===clearTimeout)return clearTimeout(k);if((t===n||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(k);try{return t(k)}catch{try{return t.call(null,k)}catch{return t.call(this,k)}}}var s=[],d=!1,l,c=-1;function u(){!d||!l||(d=!1,l.length?s=l.concat(s):c=-1,s.length&&v())}function v(){if(!d){var k=o(u);d=!0;for(var x=s.length;x;){for(l=s,s=[];++c<x;)l&&l[c].run();c=-1,x=s.length}l=null,d=!1,a(k)}}r.nextTick=function(k){var x=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)x[_-1]=arguments[_];s.push(new g(k,x)),s.length===1&&!d&&o(v)};function g(k,x){this.fun=k,this.array=x}g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function y(){}return r.on=y,r.addListener=y,r.once=y,r.off=y,r.removeListener=y,r.removeAllListeners=y,r.emit=y,r.prependListener=y,r.prependOnceListener=y,r.listeners=function(k){return[]},r.binding=function(k){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(k){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},In.exports}var Nn,ps;function Ot(){if(ps)return Nn;ps=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=Be(),i=t("nodejs.stream.destroyed"),n=t("nodejs.stream.errored"),o=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),s=t("nodejs.stream.disturbed"),d=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function c(w,U=!1){var K;return!!(w&&typeof w.pipe=="function"&&typeof w.on=="function"&&(!U||typeof w.pause=="function"&&typeof w.resume=="function")&&(!w._writableState||((K=w._readableState)===null||K===void 0?void 0:K.readable)!==!1)&&(!w._writableState||w._readableState))}function u(w){var U;return!!(w&&typeof w.write=="function"&&typeof w.on=="function"&&(!w._readableState||((U=w._writableState)===null||U===void 0?void 0:U.writable)!==!1))}function v(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function g(w){return w&&(w._readableState||w._writableState||typeof w.write=="function"&&typeof w.on=="function"||typeof w.pipe=="function"&&typeof w.on=="function")}function y(w){return!!(w&&!g(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function k(w){return!!(w&&!g(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function x(w){return!!(w&&!g(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function _(w){return y(w)||k(w)||x(w)}function E(w,U){return w==null?!1:U===!0?typeof w[r]=="function":U===!1?typeof w[e]=="function":typeof w[r]=="function"||typeof w[e]=="function"}function m(w){if(!g(w))return null;const U=w._writableState,K=w._readableState,X=U||K;return!!(w.destroyed||w[i]||X!=null&&X.destroyed)}function f(w){if(!u(w))return null;if(w.writableEnded===!0)return!0;const U=w._writableState;return U!=null&&U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function b(w,U){if(!u(w))return null;if(w.writableFinished===!0)return!0;const K=w._writableState;return K!=null&&K.errored?!1:typeof K?.finished!="boolean"?null:!!(K.finished||U===!1&&K.ended===!0&&K.length===0)}function R(w){if(!c(w))return null;if(w.readableEnded===!0)return!0;const U=w._readableState;return!U||U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function L(w,U){if(!c(w))return null;const K=w._readableState;return K!=null&&K.errored?!1:typeof K?.endEmitted!="boolean"?null:!!(K.endEmitted||U===!1&&K.ended===!0&&K.length===0)}function T(w){return w&&w[o]!=null?w[o]:typeof w?.readable!="boolean"?null:m(w)?!1:c(w)&&w.readable&&!L(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:u(w)&&w.writable&&!f(w)}function I(w,U){return g(w)?m(w)?!0:!(U?.readable!==!1&&T(w)||U?.writable!==!1&&B(w)):null}function $(w){var U,K;return g(w)?w.writableErrored?w.writableErrored:(U=(K=w._writableState)===null||K===void 0?void 0:K.errored)!==null&&U!==void 0?U:null:null}function q(w){var U,K;return g(w)?w.readableErrored?w.readableErrored:(U=(K=w._readableState)===null||K===void 0?void 0:K.errored)!==null&&U!==void 0?U:null:null}function A(w){if(!g(w))return null;if(typeof w.closed=="boolean")return w.closed;const U=w._writableState,K=w._readableState;return typeof U?.closed=="boolean"||typeof K?.closed=="boolean"?U?.closed||K?.closed:typeof w._closed=="boolean"&&j(w)?w._closed:null}function j(w){return typeof w._closed=="boolean"&&typeof w._defaultKeepAlive=="boolean"&&typeof w._removedConnection=="boolean"&&typeof w._removedContLen=="boolean"}function te(w){return typeof w._sent100=="boolean"&&j(w)}function N(w){var U;return typeof w._consuming=="boolean"&&typeof w._dumped=="boolean"&&((U=w.req)===null||U===void 0?void 0:U.upgradeOrConnect)===void 0}function Z(w){if(!g(w))return null;const U=w._writableState,K=w._readableState,X=U||K;return!X&&te(w)||!!(X&&X.autoDestroy&&X.emitClose&&X.closed===!1)}function F(w){var U;return!!(w&&((U=w[s])!==null&&U!==void 0?U:w.readableDidRead||w.readableAborted))}function Y(w){var U,K,X,de,H,G,W,z,ee,re;return!!(w&&((U=(K=(X=(de=(H=(G=w[n])!==null&&G!==void 0?G:w.readableErrored)!==null&&H!==void 0?H:w.writableErrored)!==null&&de!==void 0?de:(W=w._readableState)===null||W===void 0?void 0:W.errorEmitted)!==null&&X!==void 0?X:(z=w._writableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&K!==void 0?K:(ee=w._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&U!==void 0?U:!((re=w._writableState)===null||re===void 0)&&re.errored))}return Nn={isDestroyed:m,kIsDestroyed:i,isDisturbed:F,kIsDisturbed:s,isErrored:Y,kIsErrored:n,isReadable:T,kIsReadable:o,kIsClosedPromise:d,kControllerErrorFunction:l,kIsWritable:a,isClosed:A,isDuplexNodeStream:v,isFinished:I,isIterable:E,isReadableNodeStream:c,isReadableStream:y,isReadableEnded:R,isReadableFinished:L,isReadableErrored:q,isNodeStream:g,isWebStream:_,isWritable:B,isWritableNodeStream:u,isWritableStream:k,isWritableEnded:f,isWritableFinished:b,isWritableErrored:$,isServerRequest:N,isServerResponse:te,willEmitClose:Z,isTransformStream:x},Nn}var hs;function Wt(){if(hs)return Mi.exports;hs=1;const r=hr(),{AbortError:e,codes:t}=nt(),{ERR_INVALID_ARG_TYPE:i,ERR_STREAM_PREMATURE_CLOSE:n}=t,{kEmptyObject:o,once:a}=at(),{validateAbortSignal:s,validateFunction:d,validateObject:l,validateBoolean:c}=Si(),{Promise:u,PromisePrototypeThen:v,SymbolDispose:g}=Be(),{isClosed:y,isReadable:k,isReadableNodeStream:x,isReadableStream:_,isReadableFinished:E,isReadableErrored:m,isWritable:f,isWritableNodeStream:b,isWritableStream:R,isWritableFinished:L,isWritableErrored:T,isNodeStream:B,willEmitClose:I,kIsClosedPromise:$}=Ot();let q;function A(F){return F.setHeader&&typeof F.abort=="function"}const j=()=>{};function te(F,Y,w){var U,K;if(arguments.length===2?(w=Y,Y=o):Y==null?Y=o:l(Y,"options"),d(w,"callback"),s(Y.signal,"options.signal"),w=a(w),_(F)||R(F))return N(F,Y,w);if(!B(F))throw new i("stream",["ReadableStream","WritableStream","Stream"],F);const X=(U=Y.readable)!==null&&U!==void 0?U:x(F),de=(K=Y.writable)!==null&&K!==void 0?K:b(F),H=F._writableState,G=F._readableState,W=()=>{F.writable||re()};let z=I(F)&&x(F)===X&&b(F)===de,ee=L(F,!1);const re=()=>{ee=!0,F.destroyed&&(z=!1),!(z&&(!F.readable||X))&&(!X||pe)&&w.call(F)};let pe=E(F,!1);const be=()=>{pe=!0,F.destroyed&&(z=!1),!(z&&(!F.writable||de))&&(!de||ee)&&w.call(F)},O=J=>{w.call(F,J)};let V=y(F);const oe=()=>{V=!0;const J=T(F)||m(F);if(J&&typeof J!="boolean")return w.call(F,J);if(X&&!pe&&x(F,!0)&&!E(F,!1))return w.call(F,new n);if(de&&!ee&&!L(F,!1))return w.call(F,new n);w.call(F)},fe=()=>{V=!0;const J=T(F)||m(F);if(J&&typeof J!="boolean")return w.call(F,J);w.call(F)},he=()=>{F.req.on("finish",re)};A(F)?(F.on("complete",re),z||F.on("abort",oe),F.req?he():F.on("request",he)):de&&!H&&(F.on("end",W),F.on("close",W)),!z&&typeof F.aborted=="boolean"&&F.on("aborted",oe),F.on("end",be),F.on("finish",re),Y.error!==!1&&F.on("error",O),F.on("close",oe),V?r.nextTick(oe):H!=null&&H.errorEmitted||G!=null&&G.errorEmitted?z||r.nextTick(fe):(!X&&(!z||k(F))&&(ee||f(F)===!1)||!de&&(!z||f(F))&&(pe||k(F)===!1)||G&&F.req&&F.aborted)&&r.nextTick(fe);const me=()=>{w=j,F.removeListener("aborted",oe),F.removeListener("complete",re),F.removeListener("abort",oe),F.removeListener("request",he),F.req&&F.req.removeListener("finish",re),F.removeListener("end",W),F.removeListener("close",W),F.removeListener("finish",re),F.removeListener("end",be),F.removeListener("error",O),F.removeListener("close",oe)};if(Y.signal&&!V){const J=()=>{const ce=w;me(),ce.call(F,new e(void 0,{cause:Y.signal.reason}))};if(Y.signal.aborted)r.nextTick(J);else{q=q||at().addAbortListener;const ce=q(Y.signal,J),ge=w;w=a((...le)=>{ce[g](),ge.apply(F,le)})}}return me}function N(F,Y,w){let U=!1,K=j;if(Y.signal)if(K=()=>{U=!0,w.call(F,new e(void 0,{cause:Y.signal.reason}))},Y.signal.aborted)r.nextTick(K);else{q=q||at().addAbortListener;const de=q(Y.signal,K),H=w;w=a((...G)=>{de[g](),H.apply(F,G)})}const X=(...de)=>{U||r.nextTick(()=>w.apply(F,de))};return v(F[$].promise,X,X),j}function Z(F,Y){var w;let U=!1;return Y===null&&(Y=o),(w=Y)!==null&&w!==void 0&&w.cleanup&&(c(Y.cleanup,"cleanup"),U=Y.cleanup),new u((K,X)=>{const de=te(F,Y,H=>{U&&de(),H?X(H):K()})})}return Mi.exports=te,Mi.exports.finished=Z,Mi.exports}var Tn,bs;function Or(){if(bs)return Tn;bs=1;const r=hr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:i}=nt(),{Symbol:n}=Be(),{kIsDestroyed:o,isDestroyed:a,isFinished:s,isServerRequest:d}=Ot(),l=n("kDestroy"),c=n("kConstruct");function u(I,$,q){I&&(I.stack,$&&!$.errored&&($.errored=I),q&&!q.errored&&(q.errored=I))}function v(I,$){const q=this._readableState,A=this._writableState,j=A||q;return A!=null&&A.destroyed||q!=null&&q.destroyed?(typeof $=="function"&&$(),this):(u(I,A,q),A&&(A.destroyed=!0),q&&(q.destroyed=!0),j.constructed?g(this,I,$):this.once(l,function(te){g(this,e(te,I),$)}),this)}function g(I,$,q){let A=!1;function j(te){if(A)return;A=!0;const N=I._readableState,Z=I._writableState;u(te,Z,N),Z&&(Z.closed=!0),N&&(N.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(y,I,te):r.nextTick(k,I)}try{I._destroy($||null,j)}catch(te){j(te)}}function y(I,$){x(I,$),k(I)}function k(I){const $=I._readableState,q=I._writableState;q&&(q.closeEmitted=!0),$&&($.closeEmitted=!0),(q!=null&&q.emitClose||$!=null&&$.emitClose)&&I.emit("close")}function x(I,$){const q=I._readableState,A=I._writableState;A!=null&&A.errorEmitted||q!=null&&q.errorEmitted||(A&&(A.errorEmitted=!0),q&&(q.errorEmitted=!0),I.emit("error",$))}function _(){const I=this._readableState,$=this._writableState;I&&(I.constructed=!0,I.closed=!1,I.closeEmitted=!1,I.destroyed=!1,I.errored=null,I.errorEmitted=!1,I.reading=!1,I.ended=I.readable===!1,I.endEmitted=I.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 E(I,$,q){const A=I._readableState,j=I._writableState;if(j!=null&&j.destroyed||A!=null&&A.destroyed)return this;A!=null&&A.autoDestroy||j!=null&&j.autoDestroy?I.destroy($):$&&($.stack,j&&!j.errored&&(j.errored=$),A&&!A.errored&&(A.errored=$),q?r.nextTick(x,I,$):x(I,$))}function m(I,$){if(typeof I._construct!="function")return;const q=I._readableState,A=I._writableState;q&&(q.constructed=!1),A&&(A.constructed=!1),I.once(c,$),!(I.listenerCount(c)>1)&&r.nextTick(f,I)}function f(I){let $=!1;function q(A){if($){E(I,A??new t);return}$=!0;const j=I._readableState,te=I._writableState,N=te||j;j&&(j.constructed=!0),te&&(te.constructed=!0),N.destroyed?I.emit(l,A):A?E(I,A,!0):r.nextTick(b,I)}try{I._construct(A=>{r.nextTick(q,A)})}catch(A){r.nextTick(q,A)}}function b(I){I.emit(c)}function R(I){return I?.setHeader&&typeof I.abort=="function"}function L(I){I.emit("close")}function T(I,$){I.emit("error",$),r.nextTick(L,I)}function B(I,$){!I||a(I)||(!$&&!s(I)&&($=new i),d(I)?(I.socket=null,I.destroy($)):R(I)?I.abort():R(I.req)?I.req.abort():typeof I.destroy=="function"?I.destroy($):typeof I.close=="function"?I.close():$?r.nextTick(T,I,$):r.nextTick(L,I),I.destroyed||(I[o]=!0))}return Tn={construct:m,destroyer:B,destroy:v,undestroy:_,errorOrDestroy:E},Tn}var An,ms;function va(){if(ms)return An;ms=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=an();function i(o){t.call(this,o)}e(i.prototype,t.prototype),e(i,t),i.prototype.pipe=function(o,a){const s=this;function d(k){o.writable&&o.write(k)===!1&&s.pause&&s.pause()}s.on("data",d);function l(){s.readable&&s.resume&&s.resume()}o.on("drain",l),!o._isStdio&&(!a||a.end!==!1)&&(s.on("end",u),s.on("close",v));let c=!1;function u(){c||(c=!0,o.end())}function v(){c||(c=!0,typeof o.destroy=="function"&&o.destroy())}function g(k){y(),t.listenerCount(this,"error")===0&&this.emit("error",k)}n(s,"error",g),n(o,"error",g);function y(){s.removeListener("data",d),o.removeListener("drain",l),s.removeListener("end",u),s.removeListener("close",v),s.removeListener("error",g),o.removeListener("error",g),s.removeListener("end",y),s.removeListener("close",y),o.removeListener("close",y)}return s.on("end",y),s.on("close",y),o.on("close",y),o.emit("pipe",s),o};function n(o,a,s){if(typeof o.prependListener=="function")return o.prependListener(a,s);!o._events||!o._events[a]?o.on(a,s):r(o._events[a])?o._events[a].unshift(s):o._events[a]=[s,o._events[a]]}return An={Stream:i,prependListener:n},An}var jn={exports:{}},gs;function sn(){return gs||(gs=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:i}=nt(),{isNodeStream:n,isWebStream:o,kControllerErrorFunction:a}=Ot(),s=Wt(),{ERR_INVALID_ARG_TYPE:d}=i;let l;const c=(u,v)=>{if(typeof u!="object"||!("aborted"in u))throw new d(v,"AbortSignal",u)};r.exports.addAbortSignal=function(v,g){if(c(v,"signal"),!n(g)&&!o(g))throw new d("stream",["ReadableStream","WritableStream","Stream"],g);return r.exports.addAbortSignalNoValidate(v,g)},r.exports.addAbortSignalNoValidate=function(u,v){if(typeof u!="object"||!("aborted"in u))return v;const g=n(v)?()=>{v.destroy(new t(void 0,{cause:u.reason}))}:()=>{v[a](new t(void 0,{cause:u.reason}))};if(u.aborted)g();else{l=l||at().addAbortListener;const y=l(u,g);s(v,y[e])}return v}}(jn)),jn.exports}var Dn,vs;function _u(){if(vs)return Dn;vs=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:i}=Be(),{Buffer:n}=Lt(),{inspect:o}=at();return Dn=class{constructor(){this.head=null,this.tail=null,this.length=0}push(s){const d={data:s,next:null};this.length>0?this.tail.next=d:this.head=d,this.tail=d,++this.length}unshift(s){const d={data:s,next:this.head};this.length===0&&(this.tail=d),this.head=d,++this.length}shift(){if(this.length===0)return;const s=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,s}clear(){this.head=this.tail=null,this.length=0}join(s){if(this.length===0)return"";let d=this.head,l=""+d.data;for(;(d=d.next)!==null;)l+=s+d.data;return l}concat(s){if(this.length===0)return n.alloc(0);const d=n.allocUnsafe(s>>>0);let l=this.head,c=0;for(;l;)t(d,l.data,c),c+=l.data.length,l=l.next;return d}consume(s,d){const l=this.head.data;if(s<l.length){const c=l.slice(0,s);return this.head.data=l.slice(s),c}return s===l.length?this.shift():d?this._getString(s):this._getBuffer(s)}first(){return this.head.data}*[e](){for(let s=this.head;s;s=s.next)yield s.data}_getString(s){let d="",l=this.head,c=0;do{const u=l.data;if(s>u.length)d+=u,s-=u.length;else{s===u.length?(d+=u,++c,l.next?this.head=l.next:this.head=this.tail=null):(d+=r(u,0,s),this.head=l,l.data=r(u,s));break}++c}while((l=l.next)!==null);return this.length-=c,d}_getBuffer(s){const d=n.allocUnsafe(s),l=s;let c=this.head,u=0;do{const v=c.data;if(s>v.length)t(d,v,l-s),s-=v.length;else{s===v.length?(t(d,v,l-s),++u,c.next?this.head=c.next:this.head=this.tail=null):(t(d,new i(v.buffer,v.byteOffset,s),l-s),this.head=c,c.data=v.slice(s));break}++u}while((c=c.next)!==null);return this.length-=u,d}[Symbol.for("nodejs.util.inspect.custom")](s,d){return o(this,{...d,depth:0,customInspect:!1})}},Dn}var Ln,ys;function ln(){if(ys)return Ln;ys=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=Si(),{ERR_INVALID_ARG_VALUE:i}=nt().codes;let n=16*1024,o=16;function a(c,u,v){return c.highWaterMark!=null?c.highWaterMark:u?c[v]:null}function s(c){return c?o:n}function d(c,u){t(u,"value",0),c?o=u:n=u}function l(c,u,v,g){const y=a(u,g,v);if(y!=null){if(!e(y)||y<0){const k=g?`options.${v}`:"options.highWaterMark";throw new i(k,y)}return r(y)}return s(c.objectMode)}return Ln={getHighWaterMark:l,getDefaultHighWaterMark:s,setDefaultHighWaterMark:d},Ln}var On={},Bi={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ws;function ku(){return ws||(ws=1,function(r,e){var t=Lt(),i=t.Buffer;function n(a,s){for(var d in a)s[d]=a[d]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?r.exports=t:(n(t,e),e.Buffer=o);function o(a,s,d){return i(a,s,d)}o.prototype=Object.create(i.prototype),n(i,o),o.from=function(a,s,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return i(a,s,d)},o.alloc=function(a,s,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var l=i(a);return s!==void 0?typeof d=="string"?l.fill(s,d):l.fill(s):l.fill(0),l},o.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return i(a)},o.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(Bi,Bi.exports)),Bi.exports}var xs;function Eu(){if(xs)return On;xs=1;var r=ku().Buffer,e=r.isEncoding||function(_){switch(_=""+_,_&&_.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 t(_){if(!_)return"utf8";for(var E;;)switch(_){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 _;default:if(E)return;_=(""+_).toLowerCase(),E=!0}}function i(_){var E=t(_);if(typeof E!="string"&&(r.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return E||_}On.StringDecoder=n;function n(_){this.encoding=i(_);var E;switch(this.encoding){case"utf16le":this.text=u,this.end=v,E=4;break;case"utf8":this.fillLast=d,E=4;break;case"base64":this.text=g,this.end=y,E=3;break;default:this.write=k,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(E)}n.prototype.write=function(_){if(_.length===0)return"";var E,m;if(this.lastNeed){if(E=this.fillLast(_),E===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<_.length?E?E+this.text(_,m):this.text(_,m):E||""},n.prototype.end=c,n.prototype.text=l,n.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function o(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function a(_,E,m){var f=E.length-1;if(f<m)return 0;var b=o(E[f]);return b>=0?(b>0&&(_.lastNeed=b-1),b):--f<m||b===-2?0:(b=o(E[f]),b>=0?(b>0&&(_.lastNeed=b-2),b):--f<m||b===-2?0:(b=o(E[f]),b>=0?(b>0&&(b===2?b=0:_.lastNeed=b-3),b):0))}function s(_,E,m){if((E[0]&192)!==128)return _.lastNeed=0,"�";if(_.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return _.lastNeed=1,"�";if(_.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return _.lastNeed=2,"�"}}function d(_){var E=this.lastTotal-this.lastNeed,m=s(this,_);if(m!==void 0)return m;if(this.lastNeed<=_.length)return _.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,E,0,_.length),this.lastNeed-=_.length}function l(_,E){var m=a(this,_,E);if(!this.lastNeed)return _.toString("utf8",E);this.lastTotal=m;var f=_.length-(m-this.lastNeed);return _.copy(this.lastChar,0,f),_.toString("utf8",E,f)}function c(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+"�":E}function u(_,E){if((_.length-E)%2===0){var m=_.toString("utf16le",E);if(m){var f=m.charCodeAt(m.length-1);if(f>=55296&&f<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",E,_.length-1)}function v(_){var E=_&&_.length?this.write(_):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,m)}return E}function g(_,E){var m=(_.length-E)%3;return m===0?_.toString("base64",E):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",E,_.length-m))}function y(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function k(_){return _.toString(this.encoding)}function x(_){return _&&_.length?this.write(_):""}return On}var Cn,_s;function ec(){if(_s)return Cn;_s=1;const r=hr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:i}=Be(),{Buffer:n}=Lt(),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_NULL_VALUES:a}=nt().codes;function s(d,l,c){let u;if(typeof l=="string"||l instanceof n)return new d({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let v;if(l&&l[t])v=!0,u=l[t]();else if(l&&l[i])v=!1,u=l[i]();else throw new o("iterable",["Iterable"],l);const g=new d({objectMode:!0,highWaterMark:1,...c});let y=!1;g._read=function(){y||(y=!0,x())},g._destroy=function(_,E){e(k(_),()=>r.nextTick(E,_),m=>r.nextTick(E,m||_))};async function k(_){const E=_!=null,m=typeof u.throw=="function";if(E&&m){const{value:f,done:b}=await u.throw(_);if(await f,b)return}if(typeof u.return=="function"){const{value:f}=await u.return();await f}}async function x(){for(;;){try{const{value:_,done:E}=v?await u.next():u.next();if(E)g.push(null);else{const m=_&&typeof _.then=="function"?await _:_;if(m===null)throw y=!1,new a;if(g.push(m))continue;y=!1}}catch(_){g.destroy(_)}break}}return g}return Cn=s,Cn}var $n,ks;function dn(){if(ks)return $n;ks=1;const r=hr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:i,NumberParseInt:n,ObjectDefineProperties:o,ObjectKeys:a,ObjectSetPrototypeOf:s,Promise:d,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:u,Symbol:v}=Be();$n=le,le.ReadableState=ge;const{EventEmitter:g}=an(),{Stream:y,prependListener:k}=va(),{Buffer:x}=Lt(),{addAbortSignal:_}=sn(),E=Wt();let m=at().debuglog("stream",D=>{m=D});const f=_u(),b=Or(),{getHighWaterMark:R,getDefaultHighWaterMark:L}=ln(),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_OUT_OF_RANGE:$,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:A},AbortError:j}=nt(),{validateObject:te}=Si(),N=v("kPaused"),{StringDecoder:Z}=Eu(),F=ec();s(le.prototype,y.prototype),s(le,y);const Y=()=>{},{errorOrDestroy:w}=b,U=1,K=2,X=4,de=8,H=16,G=32,W=64,z=128,ee=256,re=512,pe=1024,be=2048,O=4096,V=8192,oe=16384,fe=32768,he=65536,me=1<<17,J=1<<18;function ce(D){return{enumerable:!1,get(){return(this.state&D)!==0},set(M){M?this.state|=D:this.state&=~D}}}o(ge.prototype,{objectMode:ce(U),ended:ce(K),endEmitted:ce(X),reading:ce(de),constructed:ce(H),sync:ce(G),needReadable:ce(W),emittedReadable:ce(z),readableListening:ce(ee),resumeScheduled:ce(re),errorEmitted:ce(pe),emitClose:ce(be),autoDestroy:ce(O),destroyed:ce(V),closed:ce(oe),closeEmitted:ce(fe),multiAwaitDrain:ce(he),readingMore:ce(me),dataEmitted:ce(J)});function ge(D,M,ve){typeof ve!="boolean"&&(ve=M instanceof jt()),this.state=be|O|H|G,D&&D.objectMode&&(this.state|=U),ve&&D&&D.readableObjectMode&&(this.state|=U),this.highWaterMark=D?R(this,D,"readableHighWaterMark",ve):L(!1),this.buffer=new f,this.length=0,this.pipes=[],this.flowing=null,this[N]=null,D&&D.emitClose===!1&&(this.state&=~be),D&&D.autoDestroy===!1&&(this.state&=~O),this.errored=null,this.defaultEncoding=D&&D.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,D&&D.encoding&&(this.decoder=new Z(D.encoding),this.encoding=D.encoding)}function le(D){if(!(this instanceof le))return new le(D);const M=this instanceof jt();this._readableState=new ge(D,this,M),D&&(typeof D.read=="function"&&(this._read=D.read),typeof D.destroy=="function"&&(this._destroy=D.destroy),typeof D.construct=="function"&&(this._construct=D.construct),D.signal&&!M&&_(D.signal,this)),y.call(this,D),b.construct(this,()=>{this._readableState.needReadable&&Q(this,this._readableState)})}le.prototype.destroy=b.destroy,le.prototype._undestroy=b.undestroy,le.prototype._destroy=function(D,M){M(D)},le.prototype[g.captureRejectionSymbol]=function(D){this.destroy(D)},le.prototype[c]=function(){let D;return this.destroyed||(D=this.readableEnded?null:new j,this.destroy(D)),new d((M,ve)=>E(this,ye=>ye&&ye!==D?ve(ye):M(null)))},le.prototype.push=function(D,M){return Ie(this,D,M,!1)},le.prototype.unshift=function(D,M){return Ie(this,D,M,!0)};function Ie(D,M,ve,ye){m("readableAddChunk",M);const xe=D._readableState;let Xe;if((xe.state&U)===0&&(typeof M=="string"?(ve=ve||xe.defaultEncoding,xe.encoding!==ve&&(ye&&xe.encoding?M=x.from(M,ve).toString(xe.encoding):(M=x.from(M,ve),ve=""))):M instanceof x?ve="":y._isUint8Array(M)?(M=y._uint8ArrayToBuffer(M),ve=""):M!=null&&(Xe=new B("chunk",["string","Buffer","Uint8Array"],M))),Xe)w(D,Xe);else if(M===null)xe.state&=~de,p(D,xe);else if((xe.state&U)!==0||M&&M.length>0)if(ye)if((xe.state&X)!==0)w(D,new A);else{if(xe.destroyed||xe.errored)return!1;We(D,xe,M,!0)}else if(xe.ended)w(D,new q);else{if(xe.destroyed||xe.errored)return!1;xe.state&=~de,xe.decoder&&!ve?(M=xe.decoder.write(M),xe.objectMode||M.length!==0?We(D,xe,M,!1):Q(D,xe)):We(D,xe,M,!1)}else ye||(xe.state&=~de,Q(D,xe));return!xe.ended&&(xe.length<xe.highWaterMark||xe.length===0)}function We(D,M,ve,ye){M.flowing&&M.length===0&&!M.sync&&D.listenerCount("data")>0?((M.state&he)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,D.emit("data",ve)):(M.length+=M.objectMode?1:ve.length,ye?M.buffer.unshift(ve):M.buffer.push(ve),(M.state&W)!==0&&h(D)),Q(D,M)}le.prototype.isPaused=function(){const D=this._readableState;return D[N]===!0||D.flowing===!1},le.prototype.setEncoding=function(D){const M=new Z(D);this._readableState.decoder=M,this._readableState.encoding=this._readableState.decoder.encoding;const ve=this._readableState.buffer;let ye="";for(const xe of ve)ye+=M.write(xe);return ve.clear(),ye!==""&&ve.push(ye),this._readableState.length=ye.length,this};const Se=1073741824;function Qe(D){if(D>Se)throw new $("size","<= 1GiB",D);return D--,D|=D>>>1,D|=D>>>2,D|=D>>>4,D|=D>>>8,D|=D>>>16,D++,D}function S(D,M){return D<=0||M.length===0&&M.ended?0:(M.state&U)!==0?1:i(D)?M.flowing&&M.length?M.buffer.first().length:M.length:D<=M.length?D:M.ended?M.length:0}le.prototype.read=function(D){m("read",D),D===void 0?D=NaN:t(D)||(D=n(D,10));const M=this._readableState,ve=D;if(D>M.highWaterMark&&(M.highWaterMark=Qe(D)),D!==0&&(M.state&=~z),D===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?Ue(this):h(this),null;if(D=S(D,M),D===0&&M.ended)return M.length===0&&Ue(this),null;let ye=(M.state&W)!==0;if(m("need readable",ye),(M.length===0||M.length-D<M.highWaterMark)&&(ye=!0,m("length less than watermark",ye)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)ye=!1,m("reading, ended or constructing",ye);else if(ye){m("do read"),M.state|=de|G,M.length===0&&(M.state|=W);try{this._read(M.highWaterMark)}catch(Xe){w(this,Xe)}M.state&=~G,M.reading||(D=S(ve,M))}let xe;return D>0?xe=qe(D,M):xe=null,xe===null?(M.needReadable=M.length<=M.highWaterMark,D=0):(M.length-=D,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),ve!==D&&M.ended&&Ue(this)),xe!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",xe)),xe};function p(D,M){if(m("onEofChunk"),!M.ended){if(M.decoder){const ve=M.decoder.end();ve&&ve.length&&(M.buffer.push(ve),M.length+=M.objectMode?1:ve.length)}M.ended=!0,M.sync?h(D):(M.needReadable=!1,M.emittedReadable=!0,C(D))}}function h(D){const M=D._readableState;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick(C,D))}function C(D){const M=D._readableState;m("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(D.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,Ae(D)}function Q(D,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(se,D,M))}function se(D,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const ve=M.length;if(m("maybeReadMore read 0"),D.read(0),ve===M.length)break}M.readingMore=!1}le.prototype._read=function(D){throw new I("_read()")},le.prototype.pipe=function(D,M){const ve=this,ye=this._readableState;ye.pipes.length===1&&(ye.multiAwaitDrain||(ye.multiAwaitDrain=!0,ye.awaitDrainWriters=new l(ye.awaitDrainWriters?[ye.awaitDrainWriters]:[]))),ye.pipes.push(D),m("pipe count=%d opts=%j",ye.pipes.length,M);const Xe=(!M||M.end!==!1)&&D!==r.stdout&&D!==r.stderr?ji:P;ye.endEmitted?r.nextTick(Xe):ve.once("end",Xe),D.on("unpipe",Ye);function Ye(ie,ne){m("onunpipe"),ie===ve&&ne&&ne.hasUnpiped===!1&&(ne.hasUnpiped=!0,It())}function ji(){m("onend"),D.end()}let Rt,Di=!1;function It(){m("cleanup"),D.removeListener("close",Br),D.removeListener("finish",Ve),Rt&&D.removeListener("drain",Rt),D.removeListener("error",gr),D.removeListener("unpipe",Ye),ve.removeListener("end",ji),ve.removeListener("end",P),ve.removeListener("data",mr),Di=!0,Rt&&ye.awaitDrainWriters&&(!D._writableState||D._writableState.needDrain)&&Rt()}function Mr(){Di||(ye.pipes.length===1&&ye.pipes[0]===D?(m("false write response, pause",0),ye.awaitDrainWriters=D,ye.multiAwaitDrain=!1):ye.pipes.length>1&&ye.pipes.includes(D)&&(m("false write response, pause",ye.awaitDrainWriters.size),ye.awaitDrainWriters.add(D)),ve.pause()),Rt||(Rt=ue(ve,D),D.on("drain",Rt))}ve.on("data",mr);function mr(ie){m("ondata");const ne=D.write(ie);m("dest.write",ne),ne===!1&&Mr()}function gr(ie){if(m("onerror",ie),P(),D.removeListener("error",gr),D.listenerCount("error")===0){const ne=D._writableState||D._readableState;ne&&!ne.errorEmitted?w(D,ie):D.emit("error",ie)}}k(D,"error",gr);function Br(){D.removeListener("finish",Ve),P()}D.once("close",Br);function Ve(){m("onfinish"),D.removeListener("close",Br),P()}D.once("finish",Ve);function P(){m("unpipe"),ve.unpipe(D)}return D.emit("pipe",ve),D.writableNeedDrain===!0?Mr():ye.flowing||(m("pipe resume"),ve.resume()),D};function ue(D,M){return function(){const ye=D._readableState;ye.awaitDrainWriters===M?(m("pipeOnDrain",1),ye.awaitDrainWriters=null):ye.multiAwaitDrain&&(m("pipeOnDrain",ye.awaitDrainWriters.size),ye.awaitDrainWriters.delete(M)),(!ye.awaitDrainWriters||ye.awaitDrainWriters.size===0)&&D.listenerCount("data")&&D.resume()}}le.prototype.unpipe=function(D){const M=this._readableState,ve={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!D){const xe=M.pipes;M.pipes=[],this.pause();for(let Xe=0;Xe<xe.length;Xe++)xe[Xe].emit("unpipe",this,{hasUnpiped:!1});return this}const ye=e(M.pipes,D);return ye===-1?this:(M.pipes.splice(ye,1),M.pipes.length===0&&this.pause(),D.emit("unpipe",this,ve),this)},le.prototype.on=function(D,M){const ve=y.prototype.on.call(this,D,M),ye=this._readableState;return D==="data"?(ye.readableListening=this.listenerCount("readable")>0,ye.flowing!==!1&&this.resume()):D==="readable"&&!ye.endEmitted&&!ye.readableListening&&(ye.readableListening=ye.needReadable=!0,ye.flowing=!1,ye.emittedReadable=!1,m("on readable",ye.length,ye.reading),ye.length?h(this):ye.reading||r.nextTick(Fe,this)),ve},le.prototype.addListener=le.prototype.on,le.prototype.removeListener=function(D,M){const ve=y.prototype.removeListener.call(this,D,M);return D==="readable"&&r.nextTick(ke,this),ve},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(D){const M=y.prototype.removeAllListeners.apply(this,arguments);return(D==="readable"||D===void 0)&&r.nextTick(ke,this),M};function ke(D){const M=D._readableState;M.readableListening=D.listenerCount("readable")>0,M.resumeScheduled&&M[N]===!1?M.flowing=!0:D.listenerCount("data")>0?D.resume():M.readableListening||(M.flowing=null)}function Fe(D){m("readable nexttick read 0"),D.read(0)}le.prototype.resume=function(){const D=this._readableState;return D.flowing||(m("resume"),D.flowing=!D.readableListening,je(this,D)),D[N]=!1,this};function je(D,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(De,D,M))}function De(D,M){m("resume",M.reading),M.reading||D.read(0),M.resumeScheduled=!1,D.emit("resume"),Ae(D),M.flowing&&!M.reading&&D.read(0)}le.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[N]=!0,this};function Ae(D){const M=D._readableState;for(m("flow",M.flowing);M.flowing&&D.read()!==null;);}le.prototype.wrap=function(D){let M=!1;D.on("data",ye=>{!this.push(ye)&&D.pause&&(M=!0,D.pause())}),D.on("end",()=>{this.push(null)}),D.on("error",ye=>{w(this,ye)}),D.on("close",()=>{this.destroy()}),D.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&D.resume&&(M=!1,D.resume())};const ve=a(D);for(let ye=1;ye<ve.length;ye++){const xe=ve[ye];this[xe]===void 0&&typeof D[xe]=="function"&&(this[xe]=D[xe].bind(D))}return this},le.prototype[u]=function(){return gt(this)},le.prototype.iterator=function(D){return D!==void 0&&te(D,"options"),gt(this,D)};function gt(D,M){typeof D.read!="function"&&(D=le.wrap(D,{objectMode:!0}));const ve=Pt(D,M);return ve.stream=D,ve}async function*Pt(D,M){let ve=Y;function ye(Ye){this===D?(ve(),ve=Y):ve=Ye}D.on("readable",ye);let xe;const Xe=E(D,{writable:!1},Ye=>{xe=Ye?T(xe,Ye):null,ve(),ve=Y});try{for(;;){const Ye=D.destroyed?null:D.read();if(Ye!==null)yield Ye;else{if(xe)throw xe;if(xe===null)return;await new d(ye)}}}catch(Ye){throw xe=T(xe,Ye),xe}finally{(xe||M?.destroyOnReturn!==!1)&&(xe===void 0||D._readableState.autoDestroy)?b.destroyer(D,null):(D.off("readable",ye),Xe())}}o(le.prototype,{readable:{__proto__:null,get(){const D=this._readableState;return!!D&&D.readable!==!1&&!D.destroyed&&!D.errorEmitted&&!D.endEmitted},set(D){this._readableState&&(this._readableState.readable=!!D)}},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(D){this._readableState&&(this._readableState.flowing=D)}},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(D){this._readableState&&(this._readableState.destroyed=D)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(ge.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[N]!==!1},set(D){this[N]=!!D}}}),le._fromList=qe;function qe(D,M){if(M.length===0)return null;let ve;return M.objectMode?ve=M.buffer.shift():!D||D>=M.length?(M.decoder?ve=M.buffer.join(""):M.buffer.length===1?ve=M.buffer.first():ve=M.buffer.concat(M.length),M.buffer.clear()):ve=M.buffer.consume(D,M.decoder),ve}function Ue(D){const M=D._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Ai,M,D))}function Ai(D,M){if(m("endReadableNT",D.endEmitted,D.length),!D.errored&&!D.closeEmitted&&!D.endEmitted&&D.length===0){if(D.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(Mt,M);else if(D.autoDestroy){const ve=M._writableState;(!ve||ve.autoDestroy&&(ve.finished||ve.writable===!1))&&M.destroy()}}}function Mt(D){D.writable&&!D.writableEnded&&!D.destroyed&&D.end()}le.from=function(D,M){return F(le,D,M)};let br;function Pr(){return br===void 0&&(br={}),br}return le.fromWeb=function(D,M){return Pr().newStreamReadableFromReadableStream(D,M)},le.toWeb=function(D,M){return Pr().newReadableStreamFromStreamReadable(D,M)},le.wrap=function(D,M){var ve,ye;return new le({objectMode:(ve=(ye=D.readableObjectMode)!==null&&ye!==void 0?ye:D.objectMode)!==null&&ve!==void 0?ve:!0,...M,destroy(xe,Xe){b.destroyer(D,xe),Xe(xe)}}).wrap(D)},$n}var Fn,Es;function ya(){if(Es)return Fn;Es=1;const r=hr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:n,ObjectDefineProperties:o,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:s,Symbol:d,SymbolHasInstance:l}=Be();Fn=te,te.WritableState=A;const{EventEmitter:c}=an(),u=va().Stream,{Buffer:v}=Lt(),g=Or(),{addAbortSignal:y}=sn(),{getHighWaterMark:k,getDefaultHighWaterMark:x}=ln(),{ERR_INVALID_ARG_TYPE:_,ERR_METHOD_NOT_IMPLEMENTED:E,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:f,ERR_STREAM_DESTROYED:b,ERR_STREAM_ALREADY_FINISHED:R,ERR_STREAM_NULL_VALUES:L,ERR_STREAM_WRITE_AFTER_END:T,ERR_UNKNOWN_ENCODING:B}=nt().codes,{errorOrDestroy:I}=g;a(te.prototype,u.prototype),a(te,u);function $(){}const q=d("kOnFinished");function A(O,V,oe){typeof oe!="boolean"&&(oe=V instanceof jt()),this.objectMode=!!(O&&O.objectMode),oe&&(this.objectMode=this.objectMode||!!(O&&O.writableObjectMode)),this.highWaterMark=O?k(this,O,"writableHighWaterMark",oe):x(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const fe=!!(O&&O.decodeStrings===!1);this.decodeStrings=!fe,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=w.bind(void 0,V),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,j(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!O||O.emitClose!==!1,this.autoDestroy=!O||O.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function j(O){O.buffered=[],O.bufferedIndex=0,O.allBuffers=!0,O.allNoop=!0}A.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},n(A.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function te(O){const V=this instanceof jt();if(!V&&!i(te,this))return new te(O);this._writableState=new A(O,this,V),O&&(typeof O.write=="function"&&(this._write=O.write),typeof O.writev=="function"&&(this._writev=O.writev),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.final=="function"&&(this._final=O.final),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&y(O.signal,this)),u.call(this,O),g.construct(this,()=>{const oe=this._writableState;oe.writing||de(this,oe),z(this,oe)})}n(te,l,{__proto__:null,value:function(O){return i(this,O)?!0:this!==te?!1:O&&O._writableState instanceof A}}),te.prototype.pipe=function(){I(this,new f)};function N(O,V,oe,fe){const he=O._writableState;if(typeof oe=="function")fe=oe,oe=he.defaultEncoding;else{if(!oe)oe=he.defaultEncoding;else if(oe!=="buffer"&&!v.isEncoding(oe))throw new B(oe);typeof fe!="function"&&(fe=$)}if(V===null)throw new L;if(!he.objectMode)if(typeof V=="string")he.decodeStrings!==!1&&(V=v.from(V,oe),oe="buffer");else if(V instanceof v)oe="buffer";else if(u._isUint8Array(V))V=u._uint8ArrayToBuffer(V),oe="buffer";else throw new _("chunk",["string","Buffer","Uint8Array"],V);let me;return he.ending?me=new T:he.destroyed&&(me=new b("write")),me?(r.nextTick(fe,me),I(O,me,!0),me):(he.pendingcb++,Z(O,he,V,oe,fe))}te.prototype.write=function(O,V,oe){return N(this,O,V,oe)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const O=this._writableState;O.corked&&(O.corked--,O.writing||de(this,O))},te.prototype.setDefaultEncoding=function(V){if(typeof V=="string"&&(V=s(V)),!v.isEncoding(V))throw new B(V);return this._writableState.defaultEncoding=V,this};function Z(O,V,oe,fe,he){const me=V.objectMode?1:oe.length;V.length+=me;const J=V.length<V.highWaterMark;return J||(V.needDrain=!0),V.writing||V.corked||V.errored||!V.constructed?(V.buffered.push({chunk:oe,encoding:fe,callback:he}),V.allBuffers&&fe!=="buffer"&&(V.allBuffers=!1),V.allNoop&&he!==$&&(V.allNoop=!1)):(V.writelen=me,V.writecb=he,V.writing=!0,V.sync=!0,O._write(oe,fe,V.onwrite),V.sync=!1),J&&!V.errored&&!V.destroyed}function F(O,V,oe,fe,he,me,J){V.writelen=fe,V.writecb=J,V.writing=!0,V.sync=!0,V.destroyed?V.onwrite(new b("write")):oe?O._writev(he,V.onwrite):O._write(he,me,V.onwrite),V.sync=!1}function Y(O,V,oe,fe){--V.pendingcb,fe(oe),X(V),I(O,oe)}function w(O,V){const oe=O._writableState,fe=oe.sync,he=oe.writecb;if(typeof he!="function"){I(O,new m);return}oe.writing=!1,oe.writecb=null,oe.length-=oe.writelen,oe.writelen=0,V?(V.stack,oe.errored||(oe.errored=V),O._readableState&&!O._readableState.errored&&(O._readableState.errored=V),fe?r.nextTick(Y,O,oe,V,he):Y(O,oe,V,he)):(oe.buffered.length>oe.bufferedIndex&&de(O,oe),fe?oe.afterWriteTickInfo!==null&&oe.afterWriteTickInfo.cb===he?oe.afterWriteTickInfo.count++:(oe.afterWriteTickInfo={count:1,cb:he,stream:O,state:oe},r.nextTick(U,oe.afterWriteTickInfo)):K(O,oe,1,he))}function U({stream:O,state:V,count:oe,cb:fe}){return V.afterWriteTickInfo=null,K(O,V,oe,fe)}function K(O,V,oe,fe){for(!V.ending&&!O.destroyed&&V.length===0&&V.needDrain&&(V.needDrain=!1,O.emit("drain"));oe-- >0;)V.pendingcb--,fe();V.destroyed&&X(V),z(O,V)}function X(O){if(O.writing)return;for(let he=O.bufferedIndex;he<O.buffered.length;++he){var V;const{chunk:me,callback:J}=O.buffered[he],ce=O.objectMode?1:me.length;O.length-=ce,J((V=O.errored)!==null&&V!==void 0?V:new b("write"))}const oe=O[q].splice(0);for(let he=0;he<oe.length;he++){var fe;oe[he]((fe=O.errored)!==null&&fe!==void 0?fe:new b("end"))}j(O)}function de(O,V){if(V.corked||V.bufferProcessing||V.destroyed||!V.constructed)return;const{buffered:oe,bufferedIndex:fe,objectMode:he}=V,me=oe.length-fe;if(!me)return;let J=fe;if(V.bufferProcessing=!0,me>1&&O._writev){V.pendingcb-=me-1;const ce=V.allNoop?$:le=>{for(let Ie=J;Ie<oe.length;++Ie)oe[Ie].callback(le)},ge=V.allNoop&&J===0?oe:e(oe,J);ge.allBuffers=V.allBuffers,F(O,V,!0,V.length,ge,"",ce),j(V)}else{do{const{chunk:ce,encoding:ge,callback:le}=oe[J];oe[J++]=null;const Ie=he?1:ce.length;F(O,V,!1,Ie,ce,ge,le)}while(J<oe.length&&!V.writing);J===oe.length?j(V):J>256?(oe.splice(0,J),V.bufferedIndex=0):V.bufferedIndex=J}V.bufferProcessing=!1}te.prototype._write=function(O,V,oe){if(this._writev)this._writev([{chunk:O,encoding:V}],oe);else throw new E("_write()")},te.prototype._writev=null,te.prototype.end=function(O,V,oe){const fe=this._writableState;typeof O=="function"?(oe=O,O=null,V=null):typeof V=="function"&&(oe=V,V=null);let he;if(O!=null){const me=N(this,O,V);me instanceof t&&(he=me)}return fe.corked&&(fe.corked=1,this.uncork()),he||(!fe.errored&&!fe.ending?(fe.ending=!0,z(this,fe,!0),fe.ended=!0):fe.finished?he=new R("end"):fe.destroyed&&(he=new b("end"))),typeof oe=="function"&&(he||fe.finished?r.nextTick(oe,he):fe[q].push(oe)),this};function H(O){return O.ending&&!O.destroyed&&O.constructed&&O.length===0&&!O.errored&&O.buffered.length===0&&!O.finished&&!O.writing&&!O.errorEmitted&&!O.closeEmitted}function G(O,V){let oe=!1;function fe(he){if(oe){I(O,he??m());return}if(oe=!0,V.pendingcb--,he){const me=V[q].splice(0);for(let J=0;J<me.length;J++)me[J](he);I(O,he,V.sync)}else H(V)&&(V.prefinished=!0,O.emit("prefinish"),V.pendingcb++,r.nextTick(ee,O,V))}V.sync=!0,V.pendingcb++;try{O._final(fe)}catch(he){fe(he)}V.sync=!1}function W(O,V){!V.prefinished&&!V.finalCalled&&(typeof O._final=="function"&&!V.destroyed?(V.finalCalled=!0,G(O,V)):(V.prefinished=!0,O.emit("prefinish")))}function z(O,V,oe){H(V)&&(W(O,V),V.pendingcb===0&&(oe?(V.pendingcb++,r.nextTick((fe,he)=>{H(he)?ee(fe,he):he.pendingcb--},O,V)):H(V)&&(V.pendingcb++,ee(O,V))))}function ee(O,V){V.pendingcb--,V.finished=!0;const oe=V[q].splice(0);for(let fe=0;fe<oe.length;fe++)oe[fe]();if(O.emit("finish"),V.autoDestroy){const fe=O._readableState;(!fe||fe.autoDestroy&&(fe.endEmitted||fe.readable===!1))&&O.destroy()}}o(te.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(O){this._writableState&&(this._writableState.destroyed=O)}},writable:{__proto__:null,get(){const O=this._writableState;return!!O&&O.writable!==!1&&!O.destroyed&&!O.errored&&!O.ending&&!O.ended},set(O){this._writableState&&(this._writableState.writable=!!O)}},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 O=this._writableState;return O?!O.destroyed&&!O.ending&&O.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 re=g.destroy;te.prototype.destroy=function(O,V){const oe=this._writableState;return!oe.destroyed&&(oe.bufferedIndex<oe.buffered.length||oe[q].length)&&r.nextTick(X,oe),re.call(this,O,V),this},te.prototype._undestroy=g.undestroy,te.prototype._destroy=function(O,V){V(O)},te.prototype[c.captureRejectionSymbol]=function(O){this.destroy(O)};let pe;function be(){return pe===void 0&&(pe={}),pe}return te.fromWeb=function(O,V){return be().newStreamWritableFromWritableStream(O,V)},te.toWeb=function(O){return be().newWritableStreamFromStreamWritable(O)},Fn}var Pn,Ss;function Su(){if(Ss)return Pn;Ss=1;const r=hr(),e=Lt(),{isReadable:t,isWritable:i,isIterable:n,isNodeStream:o,isReadableNodeStream:a,isWritableNodeStream:s,isDuplexNodeStream:d,isReadableStream:l,isWritableStream:c}=Ot(),u=Wt(),{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:y}}=nt(),{destroyer:k}=Or(),x=jt(),_=dn(),E=ya(),{createDeferredPromise:m}=at(),f=ec(),b=globalThis.Blob||e.Blob,R=typeof b<"u"?function(A){return A instanceof b}:function(A){return!1},L=globalThis.AbortController||xi().AbortController,{FunctionPrototypeCall:T}=Be();class B extends x{constructor(A){super(A),A?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),A?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Pn=function q(A,j){if(d(A))return A;if(a(A))return $({readable:A});if(s(A))return $({writable:A});if(o(A))return $({writable:!1,readable:!1});if(l(A))return $({readable:_.fromWeb(A)});if(c(A))return $({writable:E.fromWeb(A)});if(typeof A=="function"){const{value:N,write:Z,final:F,destroy:Y}=I(A);if(n(N))return f(B,N,{objectMode:!0,write:Z,final:F,destroy:Y});const w=N?.then;if(typeof w=="function"){let U;const K=T(w,N,X=>{if(X!=null)throw new y("nully","body",X)},X=>{k(U,X)});return U=new B({objectMode:!0,readable:!1,write:Z,final(X){F(async()=>{try{await K,r.nextTick(X,null)}catch(de){r.nextTick(X,de)}})},destroy:Y})}throw new y("Iterable, AsyncIterable or AsyncFunction",j,N)}if(R(A))return q(A.arrayBuffer());if(n(A))return f(B,A,{objectMode:!0,writable:!1});if(l(A?.readable)&&c(A?.writable))return B.fromWeb(A);if(typeof A?.writable=="object"||typeof A?.readable=="object"){const N=A!=null&&A.readable?a(A?.readable)?A?.readable:q(A.readable):void 0,Z=A!=null&&A.writable?s(A?.writable)?A?.writable:q(A.writable):void 0;return $({readable:N,writable:Z})}const te=A?.then;if(typeof te=="function"){let N;return T(te,A,Z=>{Z!=null&&N.push(Z),N.push(null)},Z=>{k(N,Z)}),N=new B({objectMode:!0,writable:!1,read(){}})}throw new g(j,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],A)};function I(q){let{promise:A,resolve:j}=m();const te=new L,N=te.signal;return{value:q(async function*(){for(;;){const F=A;A=null;const{chunk:Y,done:w,cb:U}=await F;if(r.nextTick(U),w)return;if(N.aborted)throw new v(void 0,{cause:N.reason});({promise:A,resolve:j}=m()),yield Y}}(),{signal:N}),write(F,Y,w){const U=j;j=null,U({chunk:F,done:!1,cb:w})},final(F){const Y=j;j=null,Y({done:!0,cb:F})},destroy(F,Y){te.abort(),Y(F)}}}function $(q){const A=q.readable&&typeof q.readable.read!="function"?_.wrap(q.readable):q.readable,j=q.writable;let te=!!t(A),N=!!i(j),Z,F,Y,w,U;function K(X){const de=w;w=null,de?de(X):X&&U.destroy(X)}return U=new B({readableObjectMode:!!(A!=null&&A.readableObjectMode),writableObjectMode:!!(j!=null&&j.writableObjectMode),readable:te,writable:N}),N&&(u(j,X=>{N=!1,X&&k(A,X),K(X)}),U._write=function(X,de,H){j.write(X,de)?H():Z=H},U._final=function(X){j.end(),F=X},j.on("drain",function(){if(Z){const X=Z;Z=null,X()}}),j.on("finish",function(){if(F){const X=F;F=null,X()}})),te&&(u(A,X=>{te=!1,X&&k(A,X),K(X)}),A.on("readable",function(){if(Y){const X=Y;Y=null,X()}}),A.on("end",function(){U.push(null)}),U._read=function(){for(;;){const X=A.read();if(X===null){Y=U._read;return}if(!U.push(X))return}}),U._destroy=function(X,de){!X&&w!==null&&(X=new v),Y=null,Z=null,F=null,w===null?de(X):(w=de,k(j,X),k(A,X))},U}return Pn}var Mn,Rs;function jt(){if(Rs)return Mn;Rs=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:i}=Be();Mn=a;const n=dn(),o=ya();i(a.prototype,n.prototype),i(a,n);{const c=t(o.prototype);for(let u=0;u<c.length;u++){const v=c[u];a.prototype[v]||(a.prototype[v]=o.prototype[v])}}function a(c){if(!(this instanceof a))return new a(c);n.call(this,c),o.call(this,c),c?(this.allowHalfOpen=c.allowHalfOpen!==!1,c.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),c.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(a.prototype,{writable:{__proto__:null,...e(o.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(o.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(o.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(o.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(o.prototype,"writableLength")},writableFinished:{__proto__:null,...e(o.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(o.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(o.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(o.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(c){this._readableState&&this._writableState&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}});let s;function d(){return s===void 0&&(s={}),s}a.fromWeb=function(c,u){return d().newStreamDuplexFromReadableWritablePair(c,u)},a.toWeb=function(c){return d().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Su()),l(c,"body")},Mn}var Bn,Is;function tc(){if(Is)return Bn;Is=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Bn=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=nt().codes,i=jt(),{getHighWaterMark:n}=ln();r(a.prototype,i.prototype),r(a,i);const o=e("kCallback");function a(l){if(!(this instanceof a))return new a(l);const c=l?n(this,l,"readableHighWaterMark",!0):null;c===0&&(l={...l,highWaterMark:null,readableHighWaterMark:c,writableHighWaterMark:l.writableHighWaterMark||0}),i.call(this,l),this._readableState.sync=!1,this[o]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",d)}function s(l){typeof this._flush=="function"&&!this.destroyed?this._flush((c,u)=>{if(c){l?l(c):this.destroy(c);return}u!=null&&this.push(u),this.push(null),l&&l()}):(this.push(null),l&&l())}function d(){this._final!==s&&s.call(this)}return a.prototype._final=s,a.prototype._transform=function(l,c,u){throw new t("_transform()")},a.prototype._write=function(l,c,u){const v=this._readableState,g=this._writableState,y=v.length;this._transform(l,c,(k,x)=>{if(k){u(k);return}x!=null&&this.push(x),g.ended||y===v.length||v.length<v.highWaterMark?u():this[o]=u})},a.prototype._read=function(){if(this[o]){const l=this[o];this[o]=null,l()}},Bn}var qn,Ns;function rc(){if(Ns)return qn;Ns=1;const{ObjectSetPrototypeOf:r}=Be();qn=t;const e=tc();r(t.prototype,e.prototype),r(t,e);function t(i){if(!(this instanceof t))return new t(i);e.call(this,i)}return t.prototype._transform=function(i,n,o){o(null,i)},qn}var zn,Ts;function wa(){if(Ts)return zn;Ts=1;const r=hr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:i,SymbolDispose:n}=Be(),o=Wt(),{once:a}=at(),s=Or(),d=jt(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:u,ERR_MISSING_ARGS:v,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:k}=nt(),{validateFunction:x,validateAbortSignal:_}=Si(),{isIterable:E,isReadable:m,isReadableNodeStream:f,isNodeStream:b,isTransformStream:R,isWebStream:L,isReadableStream:T,isReadableFinished:B}=Ot(),I=globalThis.AbortController||xi().AbortController;let $,q,A;function j(X,de,H){let G=!1;X.on("close",()=>{G=!0});const W=o(X,{readable:de,writable:H},z=>{G=!z});return{destroy:z=>{G||(G=!0,s.destroyer(X,z||new g("pipe")))},cleanup:W}}function te(X){return x(X[X.length-1],"streams[stream.length - 1]"),X.pop()}function N(X){if(E(X))return X;if(f(X))return Z(X);throw new c("val",["Readable","Iterable","AsyncIterable"],X)}async function*Z(X){q||(q=dn()),yield*q.prototype[i].call(X)}async function F(X,de,H,{end:G}){let W,z=null;const ee=be=>{if(be&&(W=be),z){const O=z;z=null,O()}},re=()=>new t((be,O)=>{W?O(W):z=()=>{W?O(W):be()}});de.on("drain",ee);const pe=o(de,{readable:!1},ee);try{de.writableNeedDrain&&await re();for await(const be of X)de.write(be)||await re();G&&(de.end(),await re()),H()}catch(be){H(W!==be?l(W,be):be)}finally{pe(),de.off("drain",ee)}}async function Y(X,de,H,{end:G}){R(de)&&(de=de.writable);const W=de.getWriter();try{for await(const z of X)await W.ready,W.write(z).catch(()=>{});await W.ready,G&&await W.close(),H()}catch(z){try{await W.abort(z),H(z)}catch(ee){H(ee)}}}function w(...X){return U(X,a(te(X)))}function U(X,de,H){if(X.length===1&&e(X[0])&&(X=X[0]),X.length<2)throw new v("streams");const G=new I,W=G.signal,z=H?.signal,ee=[];_(z,"options.signal");function re(){he(new k)}A=A||at().addAbortListener;let pe;z&&(pe=A(z,re));let be,O;const V=[];let oe=0;function fe(ge){he(ge,--oe===0)}function he(ge,le){var Ie;if(ge&&(!be||be.code==="ERR_STREAM_PREMATURE_CLOSE")&&(be=ge),!(!be&&!le)){for(;V.length;)V.shift()(be);(Ie=pe)===null||Ie===void 0||Ie[n](),G.abort(),le&&(be||ee.forEach(We=>We()),r.nextTick(de,be,O))}}let me;for(let ge=0;ge<X.length;ge++){const le=X[ge],Ie=ge<X.length-1,We=ge>0,Se=Ie||H?.end!==!1,Qe=ge===X.length-1;if(b(le)){let S=function(p){p&&p.name!=="AbortError"&&p.code!=="ERR_STREAM_PREMATURE_CLOSE"&&fe(p)};if(Se){const{destroy:p,cleanup:h}=j(le,Ie,We);V.push(p),m(le)&&Qe&&ee.push(h)}le.on("error",S),m(le)&&Qe&&ee.push(()=>{le.removeListener("error",S)})}if(ge===0)if(typeof le=="function"){if(me=le({signal:W}),!E(me))throw new u("Iterable, AsyncIterable or Stream","source",me)}else E(le)||f(le)||R(le)?me=le:me=d.from(le);else if(typeof le=="function"){if(R(me)){var J;me=N((J=me)===null||J===void 0?void 0:J.readable)}else me=N(me);if(me=le(me,{signal:W}),Ie){if(!E(me,!0))throw new u("AsyncIterable",`transform[${ge-1}]`,me)}else{var ce;$||($=rc());const S=new $({objectMode:!0}),p=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof p=="function")oe++,p.call(me,Q=>{O=Q,Q!=null&&S.write(Q),Se&&S.end(),r.nextTick(fe)},Q=>{S.destroy(Q),r.nextTick(fe,Q)});else if(E(me,!0))oe++,F(me,S,fe,{end:Se});else if(T(me)||R(me)){const Q=me.readable||me;oe++,F(Q,S,fe,{end:Se})}else throw new u("AsyncIterable or Promise","destination",me);me=S;const{destroy:h,cleanup:C}=j(me,!1,!0);V.push(h),Qe&&ee.push(C)}}else if(b(le)){if(f(me)){oe+=2;const S=K(me,le,fe,{end:Se});m(le)&&Qe&&ee.push(S)}else if(R(me)||T(me)){const S=me.readable||me;oe++,F(S,le,fe,{end:Se})}else if(E(me))oe++,F(me,le,fe,{end:Se});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(L(le)){if(f(me))oe++,Y(N(me),le,fe,{end:Se});else if(T(me)||E(me))oe++,Y(me,le,fe,{end:Se});else if(R(me))oe++,Y(me.readable,le,fe,{end:Se});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else me=d.from(le)}return(W!=null&&W.aborted||z!=null&&z.aborted)&&r.nextTick(re),me}function K(X,de,H,{end:G}){let W=!1;if(de.on("close",()=>{W||H(new y)}),X.pipe(de,{end:!1}),G){let z=function(){W=!0,de.end()};B(X)?r.nextTick(z):X.once("end",z)}else H();return o(X,{readable:!0,writable:!1},z=>{const ee=X._readableState;z&&z.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?X.once("end",H).once("error",H):H(z)}),o(de,{readable:!1,writable:!0},H)}return zn={pipelineImpl:U,pipeline:w},zn}var Un,As;function ic(){if(As)return Un;As=1;const{pipeline:r}=wa(),e=jt(),{destroyer:t}=Or(),{isNodeStream:i,isReadable:n,isWritable:o,isWebStream:a,isTransformStream:s,isWritableStream:d,isReadableStream:l}=Ot(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:u,ERR_MISSING_ARGS:v}}=nt(),g=Wt();return Un=function(...k){if(k.length===0)throw new v("streams");if(k.length===1)return e.from(k[0]);const x=[...k];if(typeof k[0]=="function"&&(k[0]=e.from(k[0])),typeof k[k.length-1]=="function"){const $=k.length-1;k[$]=e.from(k[$])}for(let $=0;$<k.length;++$)if(!(!i(k[$])&&!a(k[$]))){if($<k.length-1&&!(n(k[$])||l(k[$])||s(k[$])))throw new u(`streams[${$}]`,x[$],"must be readable");if($>0&&!(o(k[$])||d(k[$])||s(k[$])))throw new u(`streams[${$}]`,x[$],"must be writable")}let _,E,m,f,b;function R($){const q=f;f=null,q?q($):$?b.destroy($):!I&&!B&&b.destroy()}const L=k[0],T=r(k,R),B=!!(o(L)||d(L)||s(L)),I=!!(n(T)||l(T)||s(T));if(b=new e({writableObjectMode:!!(L!=null&&L.writableObjectMode),readableObjectMode:!!(T!=null&&T.readableObjectMode),writable:B,readable:I}),B){if(i(L))b._write=function(q,A,j){L.write(q,A)?j():_=j},b._final=function(q){L.end(),E=q},L.on("drain",function(){if(_){const q=_;_=null,q()}});else if(a(L)){const A=(s(L)?L.writable:L).getWriter();b._write=async function(j,te,N){try{await A.ready,A.write(j).catch(()=>{}),N()}catch(Z){N(Z)}},b._final=async function(j){try{await A.ready,A.close().catch(()=>{}),E=j}catch(te){j(te)}}}const $=s(T)?T.readable:T;g($,()=>{if(E){const q=E;E=null,q()}})}if(I){if(i(T))T.on("readable",function(){if(m){const $=m;m=null,$()}}),T.on("end",function(){b.push(null)}),b._read=function(){for(;;){const $=T.read();if($===null){m=b._read;return}if(!b.push($))return}};else if(a(T)){const q=(s(T)?T.readable:T).getReader();b._read=async function(){for(;;)try{const{value:A,done:j}=await q.read();if(!b.push(A))return;if(j){b.push(null);return}}catch{return}}}}return b._destroy=function($,q){!$&&f!==null&&($=new c),m=null,_=null,E=null,f===null?q($):(f=q,i(T)&&t(T,$))},b},Un}var js;function Ru(){if(js)return Pi;js=1;const r=globalThis.AbortController||xi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:i,ERR_OUT_OF_RANGE:n},AbortError:o}=nt(),{validateAbortSignal:a,validateInteger:s,validateObject:d}=Si(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:u}=Wt(),v=ic(),{addAbortSignalNoValidate:g}=sn(),{isWritable:y,isNodeStream:k}=Ot(),{deprecate:x}=at(),{ArrayPrototypePush:_,Boolean:E,MathFloor:m,Number:f,NumberIsNaN:b,Promise:R,PromiseReject:L,PromiseResolve:T,PromisePrototypeThen:B,Symbol:I}=Be(),$=I("kEmpty"),q=I("kEof");function A(z,ee){if(ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),k(z)&&!y(z))throw new e("stream",z,"must be writable");const re=v(this,z);return ee!=null&&ee.signal&&g(ee.signal,re),re}function j(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal");let re=1;ee?.concurrency!=null&&(re=m(ee.concurrency));let pe=re-1;return ee?.highWaterMark!=null&&(pe=m(ee.highWaterMark)),s(re,"options.concurrency",1),s(pe,"options.highWaterMark",0),pe+=re,(async function*(){const O=at().AbortSignalAny([ee?.signal].filter(E)),V=this,oe=[],fe={signal:O};let he,me,J=!1,ce=0;function ge(){J=!0,le()}function le(){ce-=1,Ie()}function Ie(){me&&!J&&ce<re&&oe.length<pe&&(me(),me=null)}async function We(){try{for await(let Se of V){if(J)return;if(O.aborted)throw new o;try{if(Se=z(Se,fe),Se===$)continue;Se=T(Se)}catch(Qe){Se=L(Qe)}ce+=1,B(Se,le,ge),oe.push(Se),he&&(he(),he=null),!J&&(oe.length>=pe||ce>=re)&&await new R(Qe=>{me=Qe})}oe.push(q)}catch(Se){const Qe=L(Se);B(Qe,le,ge),oe.push(Qe)}finally{J=!0,he&&(he(),he=null)}}We();try{for(;;){for(;oe.length>0;){const Se=await oe[0];if(Se===q)return;if(O.aborted)throw new o;Se!==$&&(yield Se),oe.shift(),Ie()}await new R(Se=>{he=Se})}}finally{J=!0,me&&(me(),me=null)}}).call(this)}function te(z=void 0){return z!=null&&d(z,"options"),z?.signal!=null&&a(z.signal,"options.signal"),(async function*(){let re=0;for await(const be of this){var pe;if(z!=null&&(pe=z.signal)!==null&&pe!==void 0&&pe.aborted)throw new o({cause:z.signal.reason});yield[re++,be]}}).call(this)}async function N(z,ee=void 0){for await(const re of w.call(this,z,ee))return!0;return!1}async function Z(z,ee=void 0){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);return!await N.call(this,async(...re)=>!await z(...re),ee)}async function F(z,ee){for await(const re of w.call(this,z,ee))return re}async function Y(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function re(pe,be){return await z(pe,be),$}for await(const pe of j.call(this,re,ee));}function w(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function re(pe,be){return await z(pe,be)?pe:$}return j.call(this,re,ee)}class U extends i{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function K(z,ee,re){var pe;if(typeof z!="function")throw new t("reducer",["Function","AsyncFunction"],z);re!=null&&d(re,"options"),re?.signal!=null&&a(re.signal,"options.signal");let be=arguments.length>1;if(re!=null&&(pe=re.signal)!==null&&pe!==void 0&&pe.aborted){const he=new o(void 0,{cause:re.signal.reason});throw this.once("error",()=>{}),await u(this.destroy(he)),he}const O=new r,V=O.signal;if(re!=null&&re.signal){const he={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>O.abort(),he)}let oe=!1;try{for await(const he of this){var fe;if(oe=!0,re!=null&&(fe=re.signal)!==null&&fe!==void 0&&fe.aborted)throw new o;be?ee=await z(ee,he,{signal:V}):(ee=he,be=!0)}if(!oe&&!be)throw new U}finally{O.abort()}return ee}async function X(z){z!=null&&d(z,"options"),z?.signal!=null&&a(z.signal,"options.signal");const ee=[];for await(const pe of this){var re;if(z!=null&&(re=z.signal)!==null&&re!==void 0&&re.aborted)throw new o(void 0,{cause:z.signal.reason});_(ee,pe)}return ee}function de(z,ee){const re=j.call(this,z,ee);return(async function*(){for await(const be of re)yield*be}).call(this)}function H(z){if(z=f(z),b(z))return 0;if(z<0)throw new n("number",">= 0",z);return z}function G(z,ee=void 0){return ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),z=H(z),(async function*(){var pe;if(ee!=null&&(pe=ee.signal)!==null&&pe!==void 0&&pe.aborted)throw new o;for await(const O of this){var be;if(ee!=null&&(be=ee.signal)!==null&&be!==void 0&&be.aborted)throw new o;z--<=0&&(yield O)}}).call(this)}function W(z,ee=void 0){return ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),z=H(z),(async function*(){var pe;if(ee!=null&&(pe=ee.signal)!==null&&pe!==void 0&&pe.aborted)throw new o;for await(const O of this){var be;if(ee!=null&&(be=ee.signal)!==null&&be!==void 0&&be.aborted)throw new o;if(z-- >0&&(yield O),z<=0)return}}).call(this)}return Pi.streamReturningOperators={asIndexedPairs:x(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:de,map:j,take:W,compose:A},Pi.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:X,some:N,find:F},Pi}var Hn,Ds;function nc(){if(Ds)return Hn;Ds=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:i,isWebStream:n}=Ot(),{pipelineImpl:o}=wa(),{finished:a}=Wt();oc();function s(...d){return new e((l,c)=>{let u,v;const g=d[d.length-1];if(g&&typeof g=="object"&&!i(g)&&!t(g)&&!n(g)){const y=r(d);u=y.signal,v=y.end}o(d,(y,k)=>{y?c(y):l(k)},{signal:u,end:v})})}return Hn={finished:a,pipeline:s},Hn}var Ls;function oc(){if(Ls)return xn.exports;Ls=1;const{Buffer:r}=Lt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:i}=Be(),{promisify:{custom:n}}=at(),{streamReturningOperators:o,promiseReturningOperators:a}=Ru(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:s}}=nt(),d=ic(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=ln(),{pipeline:u}=wa(),{destroyer:v}=Or(),g=Wt(),y=nc(),k=Ot(),x=xn.exports=va().Stream;x.isDestroyed=k.isDestroyed,x.isDisturbed=k.isDisturbed,x.isErrored=k.isErrored,x.isReadable=k.isReadable,x.isWritable=k.isWritable,x.Readable=dn();for(const E of t(o)){let f=function(...b){if(new.target)throw s();return x.Readable.from(i(m,this,b))};const m=o[E];e(f,"name",{__proto__:null,value:m.name}),e(f,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:f,enumerable:!1,configurable:!0,writable:!0})}for(const E of t(a)){let f=function(...b){if(new.target)throw s();return i(m,this,b)};const m=a[E];e(f,"name",{__proto__:null,value:m.name}),e(f,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:f,enumerable:!1,configurable:!0,writable:!0})}x.Writable=ya(),x.Duplex=jt(),x.Transform=tc(),x.PassThrough=rc(),x.pipeline=u;const{addAbortSignal:_}=sn();return x.addAbortSignal=_,x.finished=g,x.destroy=v,x.compose=d,x.setDefaultHighWaterMark=l,x.getDefaultHighWaterMark=c,e(x,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return y}}),e(u,n,{__proto__:null,enumerable:!0,get(){return y.pipeline}}),e(g,n,{__proto__:null,enumerable:!0,get(){return y.finished}}),x.Stream=x,x._isUint8Array=function(m){return m instanceof Uint8Array},x._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},xn.exports}var Os;function ac(){return Os||(Os=1,function(r){const e=oc(),t=nc(),i=e.Readable.destroy;r.exports=e.Readable,r.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,r.exports._isUint8Array=e._isUint8Array,r.exports.isDisturbed=e.isDisturbed,r.exports.isErrored=e.isErrored,r.exports.isReadable=e.isReadable,r.exports.Readable=e.Readable,r.exports.Writable=e.Writable,r.exports.Duplex=e.Duplex,r.exports.Transform=e.Transform,r.exports.PassThrough=e.PassThrough,r.exports.addAbortSignal=e.addAbortSignal,r.exports.finished=e.finished,r.exports.destroy=e.destroy,r.exports.destroy=i,r.exports.pipeline=e.pipeline,r.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),r.exports.Stream=e.Stream,r.exports.default=r.exports}(wn)),wn.exports}var xa=ac();const Gn=Symbol("iter");function hi(r,e,t=4){if(t===0)return Object.assign(r,e);for(const i in e)r[i]=hi(r[i]||Object.create(null),e[i],t-1);return r}function sc(r,e,t=4){let i=!1;for(const n in r)if(n in e){const o=t===0?null:sc(r[n],e[n],t-1);if(o!==!1)i=i||Object.create(null),i[n]=o;else if(t===3)return!1}return i}function lc(r,e,t=4){let i=!1;for(const n in r)if(!(n in e))i=i||Object.create(null),i[n]=t===0?null:hi({},r[n],t-1);else if(t!==0){const o=lc(r[n],e[n],t-1);if(o!==!1)i=i||Object.create(null),i[n]=o;else if(t===3)return!1}return i}class Iu{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||Re}_termFromId(e){if(e[0]==="."){const t=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(t[i[1]]),this._termFromId(t[i[2]]),this._termFromId(t[i[3]]),i[4]&&this._termFromId(t[i[4]]))}return ci(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),i=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let o;return t&&i&&n&&(oa(e.graph)||(o=this._termToNumericId(e.graph)))&&this._ids[o?`.${t}.${i}.${n}.${o}`:`.${t}.${i}.${n}`]}return this._ids[Sr(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${oa(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Sr(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,i;if(e)for(t=e=`_:${e}`,i=1;this._ids[t];)t=e+i++;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))}}class et{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||Re,this._entityIndex=t.entityIndex||new Iu({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 t=this._graphs;let i,n;for(const o in t)for(const a in i=t[o].subjects)for(const s in n=i[a])e+=Object.keys(n[s]).length;return this._size=e}_addToIndex(e,t,i,n){const o=e[t]||(e[t]={}),a=o[i]||(o[i]={}),s=n in a;return s||(a[n]=null),!s}_removeFromIndex(e,t,i,n){const o=e[t],a=o[i];delete a[n];for(const s in a)return;delete o[i];for(const s in o)return;delete e[t]}*_findInIndex(e,t,i,n,o,a,s,d){let l,c,u;const v=this._entities,g=this._termFromId(v[d]),y={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const k in e)if(c=e[k]){y[o]=this._termFromId(v[k]),i&&((l=c,c={})[i]=l[i]);for(const x in c)if(u=c[x]){y[a]=this._termFromId(v[x]);const _=n?n in u?[n]:[]:Object.keys(u);for(let E=0;E<_.length;E++)y[s]=this._termFromId(v[_[E]]),yield this._factory.quad(y.subject,y.predicate,y.object,g)}}}_loop(e,t){for(const i in e)t(i)}_loopByKey0(e,t,i){let n,o;if(n=e[t])for(o in n)i(o)}_loopByKey1(e,t,i){let n,o;for(n in e)o=e[n],o[t]&&i(n)}_loopBy2Keys(e,t,i,n){let o,a,s;if((o=e[t])&&(a=o[i]))for(s in a)n(s)}_countInIndex(e,t,i,n){let o=0,a,s,d;t&&((a=e,e={})[t]=a[t]);for(const l in e)if(s=e[l]){i&&((a=s,s={})[i]=a[i]);for(const c in s)(d=s[c])&&(n?n in d&&o++:o+=Object.keys(d).length)}return o}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return i=>{i in t||(t[i]=!0,e(this._termFromId(this._entities[i],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,i,n){t||(n=e.graph,i=e.object,t=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let o=this._graphs[n];return o||(o=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(o)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),i=this._termToNewNumericId(i),this._addToIndex(o.subjects,e,t,i)?(this._addToIndex(o.predicates,t,i,e),this._addToIndex(o.objects,i,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,i,n){return e&&e.subject&&({subject:e,predicate:t,object:i,graph:n}=e),!this.readQuads(e,t,i,n).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,i,n){t||({subject:e,predicate:t,object:i,graph:n}=e),n=n?this._termToNumericId(n):1;const o=this._graphs;let a,s,d;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(i=i&&this._termToNumericId(i))||!(a=o[n])||!(s=a.subjects[e])||!(d=s[t])||!(i in d))return!1;this._removeFromIndex(a.subjects,e,t,i),this._removeFromIndex(a.predicates,t,i,e),this._removeFromIndex(a.objects,i,e,t),this._size!==null&&this._size--;for(e in a.subjects)return!0;return delete o[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,i,n){const o=new xa.Readable({objectMode:!0}),a=this.readQuads(e,t,i,n);return o._read=s=>{for(;--s>=0;){const{done:d,value:l}=a.next();if(d){o.push(null);return}o.push(l)}},this.remove(o)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,i,n){return[...this.readQuads(e,t,i,n)]}*readQuads(e,t,i,n){const o=this._getGraphs(n);let a,s,d,l;if(!(e&&!(s=this._termToNumericId(e))||t&&!(d=this._termToNumericId(t))||i&&!(l=this._termToNumericId(i))))for(const c in o)(a=o[c])&&(s?l?yield*this._findInIndex(a.objects,l,s,d,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,s,d,null,"subject","predicate","object",c):d?yield*this._findInIndex(a.predicates,d,l,null,"predicate","object","subject",c):l?yield*this._findInIndex(a.objects,l,null,null,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",c))}match(e,t,i,n){return new qt(this,e,t,i,n,{entityIndex:this._entityIndex})}countQuads(e,t,i,n){const o=this._getGraphs(n);let a=0,s,d,l,c;if(e&&!(d=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||i&&!(c=this._termToNumericId(i)))return 0;for(const u in o)(s=o[u])&&(e?i?a+=this._countInIndex(s.objects,c,d,l):a+=this._countInIndex(s.subjects,d,l,c):t?a+=this._countInIndex(s.predicates,l,c,d):a+=this._countInIndex(s.objects,c,d,l));return a}forEach(e,t,i,n,o){this.some(a=>(e(a,this),!1),t,i,n,o)}every(e,t,i,n,o){return!this.some(a=>!e(a,this),t,i,n,o)}some(e,t,i,n,o){for(const a of this.readQuads(t,i,n,o))if(e(a,this))return!0;return!1}getSubjects(e,t,i){const n=[];return this.forSubjects(o=>{n.push(o)},e,t,i),n}forSubjects(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.predicates,s,d,e):this._loopByKey1(a.subjects,s,e):d?this._loopByKey0(a.objects,d,e):this._loop(a.subjects,e))}getPredicates(e,t,i){const n=[];return this.forPredicates(o=>{n.push(o)},e,t,i),n}forPredicates(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.objects,d,s,e):this._loopByKey0(a.subjects,s,e):d?this._loopByKey1(a.predicates,d,e):this._loop(a.predicates,e))}getObjects(e,t,i){const n=[];return this.forObjects(o=>{n.push(o)},e,t,i),n}forObjects(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.subjects,s,d,e):this._loopByKey1(a.objects,s,e):d?this._loopByKey0(a.predicates,d,e):this._loop(a.objects,e))}getGraphs(e,t,i){const n=[];return this.forGraphs(o=>{n.push(o)},e,t,i),n}forGraphs(e,t,i,n){for(const o in this._graphs)this.some(a=>(e(a.graph),!0),t,i,n,this._termFromId(this._entities[o]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const i={},n=t?()=>!0:(s,d)=>{throw new Error(`${s.value} ${d}`)},o=this.getQuads(null,Ke.rdf.rest,Ke.rdf.nil,null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,u;const v=s.graph;let g=s.subject;for(;g&&!l;){const y=this.getQuads(null,null,g,null),k=this.getQuads(g,null,null,null);let x,_=null,E=null,m=null;for(let f=0;f<k.length&&!l;f++)x=k[f],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===Ke.rdf.first?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===Ke.rdf.rest?E?l=n(g,"has multiple rdf:rest arcs"):a.push(E=x):y.length?l=n(g,"can't be subject and object"):(c=x,u="subject"):l=n(g,"not confined to single graph");for(let f=0;f<y.length&&!l;++f)x=y[f],c?l=n(g,"can't have coreferences"):x.predicate.value===Ke.rdf.rest?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,u="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[u].value]=d)}),e&&this.removeQuads(a),i}addAll(e){if(e instanceof qt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=hi(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof qt&&(e=e.filtered),e===this)return!0;if(!(e instanceof et)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,i=e._graphs;let n,o,a,s,d;for(const l in i){if(!(n=t[l]))return!1;n=n.subjects;for(const c in o=i[l].subjects){if(!(a=n[c]))return!1;for(const u in s=o[c]){if(!(d=a[u]))return!1;for(const v in s[u])if(!(v in d))return!1}}}return!0}deleteMatches(e,t,i,n){for(const o of this.match(e,t,i,n))this.removeQuad(o);return this}difference(e){if(e&&e instanceof qt&&(e=e.filtered),e===this)return new et({entityIndex:this._entityIndex});if(e instanceof et&&e._entityIndex===this._entityIndex){const t=new et({entityIndex:this._entityIndex}),i=lc(this._graphs,e._graphs);return i&&(t._graphs=i,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof qt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new et({entityIndex:this._entityIndex});for(const i of this)e(i,this)&&t.add(i);return t}intersection(e){if(e instanceof qt&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=hi(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof et&&this._entityIndex===e._entityIndex){const t=new et({entityIndex:this._entityIndex}),i=sc(e._graphs,this._graphs);return i&&(t._graphs=i,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new et({entityIndex:this._entityIndex});for(const i of this)t.add(e(i,this));return t}reduce(e,t){const i=this.readQuads();let n=t===void 0?i.next().value:t;for(const o of i)n=e(n,o,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new ga().quadsToString(this)}union(e){const t=new et({entityIndex:this._entityIndex});return t._graphs=hi(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function kt(r,e,t=0){const i=e[t];if(i&&!(i in r))return!1;let n=!1;for(const o in i?{[i]:r[i]}:r){const a=t===2?null:kt(r[o],e,t+1);a!==!1&&(n=n||Object.create(null),n[o]=a)}return n}class qt extends xa.Readable{constructor(e,t,i,n,o,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:i,object:n,graph:o,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:i,predicate:n,subject:o}=this,a=this._filtered=new et({factory:e._factory,entityIndex:this.options.entityIndex});let s,d,l;if(o&&!(s=a._termToNumericId(o))||n&&!(d=a._termToNumericId(n))||i&&!(l=a._termToNumericId(i)))return a;const c=e._getGraphs(t);for(const u in c){let v,g,y,k;(k=c[u])&&(!s&&d?(g=kt(k.predicates,[d,l,s]))&&(v=kt(k.subjects,[s,d,l]),y=kt(k.objects,[l,s,d])):l?(y=kt(k.objects,[l,s,d]))&&(v=kt(k.subjects,[s,d,l]),g=kt(k.predicates,[d,l,s])):(v=kt(k.subjects,[s,d,l]))&&(g=kt(k.predicates,[d,l,s]),y=kt(k.objects,[l,s,d])),v&&(a._graphs[u]={subjects:v,predicates:g,objects:y}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Gn]&&(this[Gn]=this[Symbol.iterator]());const t=this[Gn];for(;--e>=0;){const{done:i,value:n}=t.next();if(i){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,i,n){return this.filtered.deleteMatches(e,t,i,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,i,n,o){return this.filtered.every(e,t,i,n,o)}filter(e){return this.filtered.filter(e)}forEach(e,t,i,n,o){return this.filtered.forEach(e,t,i,n,o)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,i,n,o){return this.filtered.some(e,t,i,n,o)}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 ga().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,t,i,n){return new qt(this.filtered,e,t,i,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Nu extends xa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new Kd(e);let i,n;const o={onQuad:(a,s)=>{a&&this.emit("error",a)||s&&this.push(s)},onPrefix:(a,s)=>{this.emit("prefix",a,s)}};e&&e.comments&&(o.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,s)=>{switch(a){case"data":i=s;break;case"end":n=s;break}}},o),this._transform=(a,s,d)=>{i(a),d()},this._flush=a=>{n(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const _e="http://www.w3.org/ns/shacl#",Cs="http://datashapes.org/dash#",Gt="http://www.w3.org/2001/XMLSchema#",zt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",_a="http://www.w3.org/2000/01/rdf-schema#",ka="http://www.w3.org/2004/02/skos/core#",Tu="http://www.w3.org/2002/07/owl#",Au="http://www.w3.org/ns/oa#",ju="http://purl.org/dc/terms/",Du="http://xmlns.com/foaf/0.1/",bi=Re.namedNode("loaded-shapes"),At=Re.namedNode("loaded-data"),tt=Re.namedNode(zt+"type"),aa=Re.namedNode(ju+"conformsTo"),$s=Re.namedNode(_a+"subClassOf"),Ea=Re.namedNode(Tu+"imports"),Lu=Re.namedNode(ka+"broader"),Ou=Re.namedNode(ka+"narrower"),qi=Re.namedNode(_e+"NodeShape"),Cu=Re.namedNode(_e+"IRI"),Yi=Re.namedNode(_e+"property"),Sa=Re.namedNode(_e+"class"),$u=Re.namedNode(_e+"node"),Rr=Re.namedNode(_e+"targetClass"),Fu=Re.namedNode(_e+"nodeKind"),Pu=Re.namedNode(Gt+"string");function mi(r,e,t=_e,i){let n="";const o=Mu(r,e,t,i);return o&&(n=o.value),n}function Mu(r,e,t=_e,i){let n;const o=t+e;if(i?.length){for(const a of i)for(const s of r)if(s.predicate.value===o){if(s.object.id.endsWith(`@${a}`))return s.object;s.object.id.indexOf("@")<0?n=s.object:n||(n=s.object)}}else for(const a of r)if(a.predicate.value===o)return a.object;return n}function Bu(r){r.querySelector(".editor")?.focus()}function Ri(r,e){return mi(r,"prefLabel",ka,e)||mi(r,"label",_a,e)||mi(r,"name",Du,e)}function dc(r,e,t){const i=[];for(const n of r)i.push({value:n,label:Ri(e.getQuads(n,null,null,null),t),children:[]});return i}function sa(r,e){for(const t in e)r=r.replace(e[t],"");return r}function cc(r,e,t,i,n=new Set){for(const o of e.owlImports)n.has(o.id)||(n.add(o.id),i.push(...t.getSubjects(tt,r,o)));e.parent&&cc(r,e.parent,t,i,n)}function Ra(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return dc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(tt,r,bi);t.push(...e.config.store.getSubjects(tt,r,At)),cc(r,e,e.config.store,t);const i=new Map,n=new Map;for(const a of t)i.set(a.id,{value:a,label:Ri(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t){for(const s of e.config.store.getObjects(a,Lu,null))i.has(s.id)&&n.set(a.id,s.id);for(const s of e.config.store.getObjects(a,Ou,null))i.has(s.id)&&n.set(s.id,a.id);for(const s of e.config.store.getObjects(a,$s,null))i.has(s.id)&&n.set(a.id,s.id)}for(const[a,s]of n.entries())i.get(s)?.children?.push(i.get(a));const o=[];for(const[a,s]of i.entries())n.has(a)||o.push(s);for(const a of e.config.store.getSubjects($s,r,null))o.push(...Ra(a,e));return o}}function la(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function Fs(r,e,t){if(e===void 0)return t;if(t===void 0)return e;const i=r.indexOf(e.language);if(i<0)return t;const n=r.indexOf(t.language);return n<0||n>i?e:t}function qu(r,{remove:e=!1,ignoreErrors:t=!1}={}){const i={},n=t?()=>!0:(s,d)=>{throw new Error(`${s.value} ${d}`)},o=r.getQuads(null,zt+"rest",zt+"nil",null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,u;const v=s.graph;let g=s.subject;for(;g&&!l;){const y=r.getQuads(null,null,g,null),k=r.getQuads(g,null,null,null).filter(f=>!f.predicate.equals(tt));let x,_=null,E=null,m=null;for(let f=0;f<k.length&&!l;f++)x=k[f],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===zt+"first"?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===zt+"rest"?E?l=n(g,"has multiple rdf:rest arcs"):a.push(E=x):y.length?l=n(g,"can't be subject and object"):(c=x,u="subject"):l=n(g,"not confined to single graph");for(let f=0;f<y.length&&!l;++f)x=y[f],c?l=n(g,"can't have coreferences"):x.predicate.value===zt+"rest"?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,u="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[u].value]=d)}),e&&r.removeQuads(a),i}function uc(r,e,t){const i=document.createElement("div");i.classList.add("shacl-or-constraint");const n=[];if(e instanceof Vt){const o=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Yi,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Yi,null),u=[];let v="";for(const g of c){const y=new tn(g,e,t);u.push(y),v+=(v.length>1?" / ":"")+y.template.label}o.push(u),n.push({label:v,value:l.toString()})}else{const c=new tn(r[l],e,t);o.push([c]),n.push({label:c.template.label,value:l.toString()})}const s=t.theme.createListEditor("Please choose",null,!1,n),d=s.querySelector(".editor");d.onchange=()=>{if(d.value){const l=o[parseInt(d.value)];let c;l.length&&(c=l[0],i.replaceWith(l[0]));for(let u=1;u<l.length;u++)c.after(l[u]),c=l[u]}},i.appendChild(s)}else{const o=[];for(let d=0;d<r.length;d++){const l=t.store.getQuads(r[d],null,null,null);l.length&&(o.push(l),n.push({label:Ri(l,t.languages)||sa(l[0].predicate.value,t.prefixes)+" = "+sa(l[0].object.value,t.prefixes),value:d.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,n,e.template),s=a.querySelector(".editor");s.onchange=()=>{s.value&&i.replaceWith(Xi(e.template.clone().merge(o[parseInt(s.value)]),void 0,!0))},i.appendChild(a)}return i}function zu(r,e,t){if(e instanceof ct){const i=e.datatype;for(const n of r){const o=t.store.getQuads(n,null,null,null);for(const a of o)if(a.predicate.value===`${_e}datatype`&&a.object.equals(i))return o}}else{const i=t.store.getObjects(e,tt,null);for(const n of r){const o=t.store.getQuads(n,null,null,null);for(const a of o)if(i.length>0){if(a.predicate.value===`${_e}node`){for(const s of i)if(t.store.getQuads(a.object,Rr,s,null).length>0)return o}if(a.predicate.equals(Sa)){for(const s of i)if(a.object.equals(s))return o}}else if(a.predicate.equals(Fu)&&a.object.equals(Cu))return o}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Uu(r,e,t){for(const i of r){let n=!1;const o=t.store.getObjects(i,Yi,null);for(const a of o){const s=t.store.getObjects(a,`${_e}path`,null);for(const d of s)if(n=t.store.countQuads(e,d,null,null)>0,n)break}if(n)return o}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const Hu={[`${_e}name`]:(r,e)=>{const t=e;r.name=Fs(r.config.languages,r.name,t)},[`${_e}description`]:(r,e)=>{const t=e;r.description=Fs(r.config.languages,r.description,t)},[`${_e}path`]:(r,e)=>{r.path=e.value},[`${_e}node`]:(r,e)=>{r.node=e},[`${_e}datatype`]:(r,e)=>{r.datatype=e},[`${_e}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${_e}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${_e}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${_e}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${_e}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${_e}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${_e}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${_e}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${_e}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${_e}pattern`]:(r,e)=>{r.pattern=e.value},[`${_e}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${Cs}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${Cs}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Au}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${_e}and`]:(r,e)=>{r.shaclAnd=e.value},[`${_e}in`]:(r,e)=>{r.shaclIn=e.value},[`${_e}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=Re.namedNode(zt+"langString")},[`${_e}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${_e}hasValue`]:(r,e)=>{r.hasValue=e},[`${_e}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${_e}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${_e}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[Ea.id]:(r,e)=>{r.owlImports.push(e)},[Sa.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Rr,e,null);t.length>0&&(r.node=t[0])},[`${_e}or`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",r.config.lists)},[`${_e}xone`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",r.config.lists)}};class Gu{constructor(e,t,i){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=i,this.merge(e),this.qualifiedValueShape&&this.merge(i.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)Hu[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Ri(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?sa(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const i of t)this.extendedShapes.push(i)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const Vu=`form { display:block; --label-width: 8em; --caret-size: 10px; }
27
+ `;super(i),this.name="AggregateError",this.errors=t}}return _n={AggregateError:r,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,i){return e.slice(t,i)},Error,FunctionPrototypeCall(e,t,...i){return e.call(t,...i)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},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,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,i){return Object.defineProperty(e,t,i)},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,i){return e.then(t,i)},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,i){return e.slice(t,i)},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,i){return e.set(t,i)},Boolean,Uint8Array},_n}var kn={exports:{}},En,as;function Zd(){return as||(as=1,En={format(r,...e){return r.replace(/%([sdifj])/g,function(...[t,i]){const n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(r){switch(typeof r){case"string":if(r.includes("'"))if(r.includes('"')){if(!r.includes("`")&&!r.includes("${"))return`\`${r}\``}else return`"${r}"`;return`'${r}'`;case"number":return isNaN(r)?"NaN":Object.is(r,-0)?String(r):r;case"bigint":return`${String(r)}n`;case"boolean":case"undefined":return String(r);case"object":return"{}"}}}),En}var Sn,ss;function nt(){if(ss)return Sn;ss=1;const{format:r,inspect:e}=Zd(),{AggregateError:t}=Be(),i=globalThis.AggregateError||t,n=Symbol("kIsNodeError"),o=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,s="__node_internal_",d={};function l(x,_){if(!x)throw new d.ERR_INTERNAL_ASSERTION(_)}function c(x){let _="",E=x.length;const m=x[0]==="-"?1:0;for(;E>=m+4;E-=3)_=`_${x.slice(E-3,E)}${_}`;return`${x.slice(0,E)}${_}`}function u(x,_,E){if(typeof _=="function")return l(_.length<=E.length,`Code: ${x}; The provided arguments length (${E.length}) does not match the required ones (${_.length}).`),_(...E);const m=(_.match(/%[dfijoOs]/g)||[]).length;return l(m===E.length,`Code: ${x}; The provided arguments length (${E.length}) does not match the required ones (${m}).`),E.length===0?_:r(_,...E)}function v(x,_,E){E||(E=Error);class m extends E{constructor(...b){super(u(x,_,b))}toString(){return`${this.name} [${x}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:E.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${x}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=x,m.prototype[n]=!0,d[x]=m}function g(x){const _=s+x.name;return Object.defineProperty(x,"name",{value:_}),x}function y(x,_){if(x&&_&&x!==_){if(Array.isArray(_.errors))return _.errors.push(x),_;const E=new i([_,x],_.message);return E.code=_.code,E}return x||_}class k extends Error{constructor(_="The operation was aborted",E=void 0){if(E!==void 0&&typeof E!="object")throw new d.ERR_INVALID_ARG_TYPE("options","Object",E);super(_,E),this.code="ABORT_ERR",this.name="AbortError"}}return v("ERR_ASSERTION","%s",Error),v("ERR_INVALID_ARG_TYPE",(x,_,E)=>{l(typeof x=="string","'name' must be a string"),Array.isArray(_)||(_=[_]);let m="The ";x.endsWith(" argument")?m+=`${x} `:m+=`"${x}" ${x.includes(".")?"property":"argument"} `,m+="must be ";const f=[],b=[],R=[];for(const T of _)l(typeof T=="string","All expected entries have to be of type string"),o.includes(T)?f.push(T.toLowerCase()):a.test(T)?b.push(T):(l(T!=="object",'The value "object" should be written as "Object"'),R.push(T));if(b.length>0){const T=f.indexOf("object");T!==-1&&(f.splice(f,T,1),b.push("Object"))}if(f.length>0){switch(f.length){case 1:m+=`of type ${f[0]}`;break;case 2:m+=`one of type ${f[0]} or ${f[1]}`;break;default:{const T=f.pop();m+=`one of type ${f.join(", ")}, or ${T}`}}(b.length>0||R.length>0)&&(m+=" or ")}if(b.length>0){switch(b.length){case 1:m+=`an instance of ${b[0]}`;break;case 2:m+=`an instance of ${b[0]} or ${b[1]}`;break;default:{const T=b.pop();m+=`an instance of ${b.join(", ")}, or ${T}`}}R.length>0&&(m+=" or ")}switch(R.length){case 0:break;case 1:R[0].toLowerCase()!==R[0]&&(m+="an "),m+=`${R[0]}`;break;case 2:m+=`one of ${R[0]} or ${R[1]}`;break;default:{const T=R.pop();m+=`one of ${R.join(", ")}, or ${T}`}}if(E==null)m+=`. Received ${E}`;else if(typeof E=="function"&&E.name)m+=`. Received function ${E.name}`;else if(typeof E=="object"){var L;if((L=E.constructor)!==null&&L!==void 0&&L.name)m+=`. Received an instance of ${E.constructor.name}`;else{const T=e(E,{depth:-1});m+=`. Received ${T}`}}else{let T=e(E,{colors:!1});T.length>25&&(T=`${T.slice(0,25)}...`),m+=`. Received type ${typeof E} (${T})`}return m},TypeError),v("ERR_INVALID_ARG_VALUE",(x,_,E="is invalid")=>{let m=e(_);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${x.includes(".")?"property":"argument"} '${x}' ${E}. Received ${m}`},TypeError),v("ERR_INVALID_RETURN_VALUE",(x,_,E)=>{var m;const f=E!=null&&(m=E.constructor)!==null&&m!==void 0&&m.name?`instance of ${E.constructor.name}`:`type ${typeof E}`;return`Expected ${x} to be returned from the "${_}" function but got ${f}.`},TypeError),v("ERR_MISSING_ARGS",(...x)=>{l(x.length>0,"At least one arg needs to be specified");let _;const E=x.length;switch(x=(Array.isArray(x)?x:[x]).map(m=>`"${m}"`).join(" or "),E){case 1:_+=`The ${x[0]} argument`;break;case 2:_+=`The ${x[0]} and ${x[1]} arguments`;break;default:{const m=x.pop();_+=`The ${x.join(", ")}, and ${m} arguments`}break}return`${_} must be specified`},TypeError),v("ERR_OUT_OF_RANGE",(x,_,E)=>{l(_,'Missing "range" argument');let m;if(Number.isInteger(E)&&Math.abs(E)>2**32)m=c(String(E));else if(typeof E=="bigint"){m=String(E);const f=BigInt(2)**BigInt(32);(E>f||E<-f)&&(m=c(m)),m+="n"}else m=e(E);return`The value of "${x}" is out of range. It must be ${_}. Received ${m}`},RangeError),v("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),v("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),v("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),v("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),v("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),v("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),v("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),v("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),v("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),v("ERR_STREAM_WRITE_AFTER_END","write after end",Error),v("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Sn={AbortError:k,aggregateTwoErrors:g(y),hideStackFrames:g,codes:d},Sn}var Wr={exports:{}},ls;function xi(){if(ls)return Wr.exports;ls=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Wr.exports=r,Wr.exports.AbortSignal=e,Wr.exports.default=r,Wr.exports}var Fi={exports:{}},ds;function an(){if(ds)return Fi.exports;ds=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(b,R,L){return Function.prototype.apply.call(b,R,L)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:t=function(b){return Object.getOwnPropertyNames(b)};function i(f){console&&console.warn&&console.warn(f)}var n=Number.isNaN||function(b){return b!==b};function o(){o.init.call(this)}Fi.exports=o,Fi.exports.once=_,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(f){if(typeof f!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof f)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(f){if(typeof f!="number"||f<0||n(f))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+f+".");a=f}}),o.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},o.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||n(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function d(f){return f._maxListeners===void 0?o.defaultMaxListeners:f._maxListeners}o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(b){for(var R=[],L=1;L<arguments.length;L++)R.push(arguments[L]);var T=b==="error",B=this._events;if(B!==void 0)T=T&&B.error===void 0;else if(!T)return!1;if(T){var I;if(R.length>0&&(I=R[0]),I instanceof Error)throw I;var $=new Error("Unhandled error."+(I?" ("+I.message+")":""));throw $.context=I,$}var q=B[b];if(q===void 0)return!1;if(typeof q=="function")e(q,this,R);else for(var A=q.length,j=y(q,A),L=0;L<A;++L)e(j[L],this,R);return!0};function l(f,b,R,L){var T,B,I;if(s(R),B=f._events,B===void 0?(B=f._events=Object.create(null),f._eventsCount=0):(B.newListener!==void 0&&(f.emit("newListener",b,R.listener?R.listener:R),B=f._events),I=B[b]),I===void 0)I=B[b]=R,++f._eventsCount;else if(typeof I=="function"?I=B[b]=L?[R,I]:[I,R]:L?I.unshift(R):I.push(R),T=d(f),T>0&&I.length>T&&!I.warned){I.warned=!0;var $=new Error("Possible EventEmitter memory leak detected. "+I.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");$.name="MaxListenersExceededWarning",$.emitter=f,$.type=b,$.count=I.length,i($)}return f}o.prototype.addListener=function(b,R){return l(this,b,R,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(b,R){return l(this,b,R,!0)};function c(){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 u(f,b,R){var L={fired:!1,wrapFn:void 0,target:f,type:b,listener:R},T=c.bind(L);return T.listener=R,L.wrapFn=T,T}o.prototype.once=function(b,R){return s(R),this.on(b,u(this,b,R)),this},o.prototype.prependOnceListener=function(b,R){return s(R),this.prependListener(b,u(this,b,R)),this},o.prototype.removeListener=function(b,R){var L,T,B,I,$;if(s(R),T=this._events,T===void 0)return this;if(L=T[b],L===void 0)return this;if(L===R||L.listener===R)--this._eventsCount===0?this._events=Object.create(null):(delete T[b],T.removeListener&&this.emit("removeListener",b,L.listener||R));else if(typeof L!="function"){for(B=-1,I=L.length-1;I>=0;I--)if(L[I]===R||L[I].listener===R){$=L[I].listener,B=I;break}if(B<0)return this;B===0?L.shift():k(L,B),L.length===1&&(T[b]=L[0]),T.removeListener!==void 0&&this.emit("removeListener",b,$||R)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(b){var R,L,T;if(L=this._events,L===void 0)return this;if(L.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):L[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete L[b]),this;if(arguments.length===0){var B=Object.keys(L),I;for(T=0;T<B.length;++T)I=B[T],I!=="removeListener"&&this.removeAllListeners(I);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(R=L[b],typeof R=="function")this.removeListener(b,R);else if(R!==void 0)for(T=R.length-1;T>=0;T--)this.removeListener(b,R[T]);return this};function v(f,b,R){var L=f._events;if(L===void 0)return[];var T=L[b];return T===void 0?[]:typeof T=="function"?R?[T.listener||T]:[T]:R?x(T):y(T,T.length)}o.prototype.listeners=function(b){return v(this,b,!0)},o.prototype.rawListeners=function(b){return v(this,b,!1)},o.listenerCount=function(f,b){return typeof f.listenerCount=="function"?f.listenerCount(b):g.call(f,b)},o.prototype.listenerCount=g;function g(f){var b=this._events;if(b!==void 0){var R=b[f];if(typeof R=="function")return 1;if(R!==void 0)return R.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function y(f,b){for(var R=new Array(b),L=0;L<b;++L)R[L]=f[L];return R}function k(f,b){for(;b+1<f.length;b++)f[b]=f[b+1];f.pop()}function x(f){for(var b=new Array(f.length),R=0;R<b.length;++R)b[R]=f[R].listener||f[R];return b}function _(f,b){return new Promise(function(R,L){function T(I){f.removeListener(b,B),L(I)}function B(){typeof f.removeListener=="function"&&f.removeListener("error",T),R([].slice.call(arguments))}m(f,b,B,{once:!0}),b!=="error"&&E(f,T,{once:!0})})}function E(f,b,R){typeof f.on=="function"&&m(f,"error",b,R)}function m(f,b,R,L){if(typeof f.on=="function")L.once?f.once(b,R):f.on(b,R);else if(typeof f.addEventListener=="function")f.addEventListener(b,function T(B){L.once&&f.removeEventListener(b,T),R(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof f)}return Fi.exports}var cs;function at(){return cs||(cs=1,function(r){const e=Lt(),{format:t,inspect:i}=Zd(),{codes:{ERR_INVALID_ARG_TYPE:n}}=nt(),{kResistStopPropagation:o,AggregateError:a,SymbolDispose:s}=Be(),d=globalThis.AbortSignal||xi().AbortSignal,l=globalThis.AbortController||xi().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,u=globalThis.Blob||e.Blob,v=typeof u<"u"?function(x){return x instanceof u}:function(x){return!1},g=(k,x)=>{if(k!==void 0&&(k===null||typeof k!="object"||!("aborted"in k)))throw new n(x,"AbortSignal",k)},y=(k,x)=>{if(typeof k!="function")throw new n(x,"Function",k)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(k){let x=!1;return function(..._){x||(x=!0,k.apply(this,_))}},createDeferredPromise:function(){let k,x;return{promise:new Promise((E,m)=>{k=E,x=m}),resolve:k,reject:x}},promisify(k){return new Promise((x,_)=>{k((E,...m)=>E?_(E):x(...m))})},debuglog(){return function(){}},format:t,inspect:i,types:{isAsyncFunction(k){return k instanceof c},isArrayBufferView(k){return ArrayBuffer.isView(k)}},isBlob:v,deprecate(k,x){return k},addAbortListener:an().addAbortListener||function(x,_){if(x===void 0)throw new n("signal","AbortSignal",x);g(x,"signal"),y(_,"listener");let E;return x.aborted?queueMicrotask(()=>_()):(x.addEventListener("abort",_,{__proto__:null,once:!0,[o]:!0}),E=()=>{x.removeEventListener("abort",_)}),{__proto__:null,[s](){var m;(m=E)===null||m===void 0||m()}}},AbortSignalAny:d.any||function(x){if(x.length===1)return x[0];const _=new l,E=()=>_.abort();return x.forEach(m=>{g(m,"signals"),m.addEventListener("abort",E,{once:!0})}),_.signal.addEventListener("abort",()=>{x.forEach(m=>m.removeEventListener("abort",E))},{once:!0}),_.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(kn)),kn.exports}var Pi={},Rn,us;function Si(){if(us)return Rn;us=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:i,NumberIsInteger:n,NumberIsNaN:o,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:s,NumberParseInt:d,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:c,String:u,StringPrototypeToUpperCase:v,StringPrototypeTrim:g}=Be(),{hideStackFrames:y,codes:{ERR_SOCKET_BAD_PORT:k,ERR_INVALID_ARG_TYPE:x,ERR_INVALID_ARG_VALUE:_,ERR_OUT_OF_RANGE:E,ERR_UNKNOWN_SIGNAL:m}}=nt(),{normalizeEncoding:f}=at(),{isAsyncFunction:b,isArrayBufferView:R}=at().types,L={};function T(J){return J===(J|0)}function B(J){return J===J>>>0}const I=/^[0-7]+$/,$="must be a 32-bit unsigned integer or an octal string";function q(J,ce,ge){if(typeof J>"u"&&(J=ge),typeof J=="string"){if(c(I,J)===null)throw new _(ce,J,$);J=d(J,8)}return te(J,ce),J}const A=y((J,ce,ge=s,le=a)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);if(J<ge||J>le)throw new E(ce,`>= ${ge} && <= ${le}`,J)}),j=y((J,ce,ge=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);if(J<ge||J>le)throw new E(ce,`>= ${ge} && <= ${le}`,J)}),te=y((J,ce,ge=!1)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);const le=ge?1:0,Ie=4294967295;if(J<le||J>Ie)throw new E(ce,`>= ${le} && <= ${Ie}`,J)});function N(J,ce){if(typeof J!="string")throw new x(ce,"string",J)}function Z(J,ce,ge=void 0,le){if(typeof J!="number")throw new x(ce,"number",J);if(ge!=null&&J<ge||le!=null&&J>le||(ge!=null||le!=null)&&o(J))throw new E(ce,`${ge!=null?`>= ${ge}`:""}${ge!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,J)}const F=y((J,ce,ge)=>{if(!e(ge,J)){const Ie="must be one of: "+t(i(ge,We=>typeof We=="string"?`'${We}'`:u(We)),", ");throw new _(ce,J,Ie)}});function Y(J,ce){if(typeof J!="boolean")throw new x(ce,"boolean",J)}function w(J,ce,ge){return J==null||!l(J,ce)?ge:J[ce]}const U=y((J,ce,ge=null)=>{const le=w(ge,"allowArray",!1),Ie=w(ge,"allowFunction",!1);if(!w(ge,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Ie||typeof J!="function"))throw new x(ce,"Object",J)}),K=y((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new x(ce,"a dictionary",J)}),X=y((J,ce,ge=0)=>{if(!r(J))throw new x(ce,"Array",J);if(J.length<ge){const le=`must be longer than ${ge}`;throw new _(ce,J,le)}});function de(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++)N(J[ge],`${ce}[${ge}]`)}function H(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++)Y(J[ge],`${ce}[${ge}]`)}function G(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++){const le=J[ge],Ie=`${ce}[${ge}]`;if(le==null)throw new x(Ie,"AbortSignal",le);pe(le,Ie)}}function W(J,ce="signal"){if(N(J,ce),L[J]===void 0)throw L[v(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const z=y((J,ce="buffer")=>{if(!R(J))throw new x(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ge=f(ce),le=J.length;if(ge==="hex"&&le%2!==0)throw new _("encoding",ce,`is invalid for data of length ${le}`)}function re(J,ce="Port",ge=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&g(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ge)throw new k(ce,J,ge);return J|0}const pe=y((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new x(ce,"AbortSignal",J)}),be=y((J,ce)=>{if(typeof J!="function")throw new x(ce,"Function",J)}),O=y((J,ce)=>{if(typeof J!="function"||b(J))throw new x(ce,"Function",J)}),V=y((J,ce)=>{if(J!==void 0)throw new x(ce,"undefined",J)});function oe(J,ce,ge){if(!e(ge,J))throw new x(ce,`('${t(ge,"|")}')`,J)}const fe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function he(J,ce){if(typeof J>"u"||!c(fe,J))throw new _(ce,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me(J){if(typeof J=="string")return he(J,"hints"),J;if(r(J)){const ce=J.length;let ge="";if(ce===0)return ge;for(let le=0;le<ce;le++){const Ie=J[le];he(Ie,"hints"),ge+=Ie,le!==ce-1&&(ge+=", ")}return ge}throw new _("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Rn={isInt32:T,isUint32:B,parseFileMode:q,validateArray:X,validateStringArray:de,validateBooleanArray:H,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:z,validateDictionary:K,validateEncoding:ee,validateFunction:be,validateInt32:j,validateInteger:A,validateNumber:Z,validateObject:U,validateOneOf:F,validatePlainFunction:O,validatePort:re,validateSignalName:W,validateString:N,validateUint32:te,validateUndefined:V,validateUnion:oe,validateAbortSignal:pe,validateLinkHeaderValue:me},Rn}var Mi={exports:{}},In={exports:{}},fs;function hr(){if(fs)return In.exports;fs=1;var r=In.exports={},e,t;function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=i}catch{e=i}try{typeof clearTimeout=="function"?t=clearTimeout:t=n}catch{t=n}})();function o(k){if(e===setTimeout)return setTimeout(k,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(k,0);try{return e(k,0)}catch{try{return e.call(null,k,0)}catch{return e.call(this,k,0)}}}function a(k){if(t===clearTimeout)return clearTimeout(k);if((t===n||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(k);try{return t(k)}catch{try{return t.call(null,k)}catch{return t.call(this,k)}}}var s=[],d=!1,l,c=-1;function u(){!d||!l||(d=!1,l.length?s=l.concat(s):c=-1,s.length&&v())}function v(){if(!d){var k=o(u);d=!0;for(var x=s.length;x;){for(l=s,s=[];++c<x;)l&&l[c].run();c=-1,x=s.length}l=null,d=!1,a(k)}}r.nextTick=function(k){var x=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)x[_-1]=arguments[_];s.push(new g(k,x)),s.length===1&&!d&&o(v)};function g(k,x){this.fun=k,this.array=x}g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function y(){}return r.on=y,r.addListener=y,r.once=y,r.off=y,r.removeListener=y,r.removeAllListeners=y,r.emit=y,r.prependListener=y,r.prependOnceListener=y,r.listeners=function(k){return[]},r.binding=function(k){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(k){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},In.exports}var Nn,ps;function Ot(){if(ps)return Nn;ps=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=Be(),i=t("nodejs.stream.destroyed"),n=t("nodejs.stream.errored"),o=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),s=t("nodejs.stream.disturbed"),d=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function c(w,U=!1){var K;return!!(w&&typeof w.pipe=="function"&&typeof w.on=="function"&&(!U||typeof w.pause=="function"&&typeof w.resume=="function")&&(!w._writableState||((K=w._readableState)===null||K===void 0?void 0:K.readable)!==!1)&&(!w._writableState||w._readableState))}function u(w){var U;return!!(w&&typeof w.write=="function"&&typeof w.on=="function"&&(!w._readableState||((U=w._writableState)===null||U===void 0?void 0:U.writable)!==!1))}function v(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function g(w){return w&&(w._readableState||w._writableState||typeof w.write=="function"&&typeof w.on=="function"||typeof w.pipe=="function"&&typeof w.on=="function")}function y(w){return!!(w&&!g(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function k(w){return!!(w&&!g(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function x(w){return!!(w&&!g(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function _(w){return y(w)||k(w)||x(w)}function E(w,U){return w==null?!1:U===!0?typeof w[r]=="function":U===!1?typeof w[e]=="function":typeof w[r]=="function"||typeof w[e]=="function"}function m(w){if(!g(w))return null;const U=w._writableState,K=w._readableState,X=U||K;return!!(w.destroyed||w[i]||X!=null&&X.destroyed)}function f(w){if(!u(w))return null;if(w.writableEnded===!0)return!0;const U=w._writableState;return U!=null&&U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function b(w,U){if(!u(w))return null;if(w.writableFinished===!0)return!0;const K=w._writableState;return K!=null&&K.errored?!1:typeof K?.finished!="boolean"?null:!!(K.finished||U===!1&&K.ended===!0&&K.length===0)}function R(w){if(!c(w))return null;if(w.readableEnded===!0)return!0;const U=w._readableState;return!U||U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function L(w,U){if(!c(w))return null;const K=w._readableState;return K!=null&&K.errored?!1:typeof K?.endEmitted!="boolean"?null:!!(K.endEmitted||U===!1&&K.ended===!0&&K.length===0)}function T(w){return w&&w[o]!=null?w[o]:typeof w?.readable!="boolean"?null:m(w)?!1:c(w)&&w.readable&&!L(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:u(w)&&w.writable&&!f(w)}function I(w,U){return g(w)?m(w)?!0:!(U?.readable!==!1&&T(w)||U?.writable!==!1&&B(w)):null}function $(w){var U,K;return g(w)?w.writableErrored?w.writableErrored:(U=(K=w._writableState)===null||K===void 0?void 0:K.errored)!==null&&U!==void 0?U:null:null}function q(w){var U,K;return g(w)?w.readableErrored?w.readableErrored:(U=(K=w._readableState)===null||K===void 0?void 0:K.errored)!==null&&U!==void 0?U:null:null}function A(w){if(!g(w))return null;if(typeof w.closed=="boolean")return w.closed;const U=w._writableState,K=w._readableState;return typeof U?.closed=="boolean"||typeof K?.closed=="boolean"?U?.closed||K?.closed:typeof w._closed=="boolean"&&j(w)?w._closed:null}function j(w){return typeof w._closed=="boolean"&&typeof w._defaultKeepAlive=="boolean"&&typeof w._removedConnection=="boolean"&&typeof w._removedContLen=="boolean"}function te(w){return typeof w._sent100=="boolean"&&j(w)}function N(w){var U;return typeof w._consuming=="boolean"&&typeof w._dumped=="boolean"&&((U=w.req)===null||U===void 0?void 0:U.upgradeOrConnect)===void 0}function Z(w){if(!g(w))return null;const U=w._writableState,K=w._readableState,X=U||K;return!X&&te(w)||!!(X&&X.autoDestroy&&X.emitClose&&X.closed===!1)}function F(w){var U;return!!(w&&((U=w[s])!==null&&U!==void 0?U:w.readableDidRead||w.readableAborted))}function Y(w){var U,K,X,de,H,G,W,z,ee,re;return!!(w&&((U=(K=(X=(de=(H=(G=w[n])!==null&&G!==void 0?G:w.readableErrored)!==null&&H!==void 0?H:w.writableErrored)!==null&&de!==void 0?de:(W=w._readableState)===null||W===void 0?void 0:W.errorEmitted)!==null&&X!==void 0?X:(z=w._writableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&K!==void 0?K:(ee=w._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&U!==void 0?U:!((re=w._writableState)===null||re===void 0)&&re.errored))}return Nn={isDestroyed:m,kIsDestroyed:i,isDisturbed:F,kIsDisturbed:s,isErrored:Y,kIsErrored:n,isReadable:T,kIsReadable:o,kIsClosedPromise:d,kControllerErrorFunction:l,kIsWritable:a,isClosed:A,isDuplexNodeStream:v,isFinished:I,isIterable:E,isReadableNodeStream:c,isReadableStream:y,isReadableEnded:R,isReadableFinished:L,isReadableErrored:q,isNodeStream:g,isWebStream:_,isWritable:B,isWritableNodeStream:u,isWritableStream:k,isWritableEnded:f,isWritableFinished:b,isWritableErrored:$,isServerRequest:N,isServerResponse:te,willEmitClose:Z,isTransformStream:x},Nn}var hs;function Wt(){if(hs)return Mi.exports;hs=1;const r=hr(),{AbortError:e,codes:t}=nt(),{ERR_INVALID_ARG_TYPE:i,ERR_STREAM_PREMATURE_CLOSE:n}=t,{kEmptyObject:o,once:a}=at(),{validateAbortSignal:s,validateFunction:d,validateObject:l,validateBoolean:c}=Si(),{Promise:u,PromisePrototypeThen:v,SymbolDispose:g}=Be(),{isClosed:y,isReadable:k,isReadableNodeStream:x,isReadableStream:_,isReadableFinished:E,isReadableErrored:m,isWritable:f,isWritableNodeStream:b,isWritableStream:R,isWritableFinished:L,isWritableErrored:T,isNodeStream:B,willEmitClose:I,kIsClosedPromise:$}=Ot();let q;function A(F){return F.setHeader&&typeof F.abort=="function"}const j=()=>{};function te(F,Y,w){var U,K;if(arguments.length===2?(w=Y,Y=o):Y==null?Y=o:l(Y,"options"),d(w,"callback"),s(Y.signal,"options.signal"),w=a(w),_(F)||R(F))return N(F,Y,w);if(!B(F))throw new i("stream",["ReadableStream","WritableStream","Stream"],F);const X=(U=Y.readable)!==null&&U!==void 0?U:x(F),de=(K=Y.writable)!==null&&K!==void 0?K:b(F),H=F._writableState,G=F._readableState,W=()=>{F.writable||re()};let z=I(F)&&x(F)===X&&b(F)===de,ee=L(F,!1);const re=()=>{ee=!0,F.destroyed&&(z=!1),!(z&&(!F.readable||X))&&(!X||pe)&&w.call(F)};let pe=E(F,!1);const be=()=>{pe=!0,F.destroyed&&(z=!1),!(z&&(!F.writable||de))&&(!de||ee)&&w.call(F)},O=J=>{w.call(F,J)};let V=y(F);const oe=()=>{V=!0;const J=T(F)||m(F);if(J&&typeof J!="boolean")return w.call(F,J);if(X&&!pe&&x(F,!0)&&!E(F,!1))return w.call(F,new n);if(de&&!ee&&!L(F,!1))return w.call(F,new n);w.call(F)},fe=()=>{V=!0;const J=T(F)||m(F);if(J&&typeof J!="boolean")return w.call(F,J);w.call(F)},he=()=>{F.req.on("finish",re)};A(F)?(F.on("complete",re),z||F.on("abort",oe),F.req?he():F.on("request",he)):de&&!H&&(F.on("end",W),F.on("close",W)),!z&&typeof F.aborted=="boolean"&&F.on("aborted",oe),F.on("end",be),F.on("finish",re),Y.error!==!1&&F.on("error",O),F.on("close",oe),V?r.nextTick(oe):H!=null&&H.errorEmitted||G!=null&&G.errorEmitted?z||r.nextTick(fe):(!X&&(!z||k(F))&&(ee||f(F)===!1)||!de&&(!z||f(F))&&(pe||k(F)===!1)||G&&F.req&&F.aborted)&&r.nextTick(fe);const me=()=>{w=j,F.removeListener("aborted",oe),F.removeListener("complete",re),F.removeListener("abort",oe),F.removeListener("request",he),F.req&&F.req.removeListener("finish",re),F.removeListener("end",W),F.removeListener("close",W),F.removeListener("finish",re),F.removeListener("end",be),F.removeListener("error",O),F.removeListener("close",oe)};if(Y.signal&&!V){const J=()=>{const ce=w;me(),ce.call(F,new e(void 0,{cause:Y.signal.reason}))};if(Y.signal.aborted)r.nextTick(J);else{q=q||at().addAbortListener;const ce=q(Y.signal,J),ge=w;w=a((...le)=>{ce[g](),ge.apply(F,le)})}}return me}function N(F,Y,w){let U=!1,K=j;if(Y.signal)if(K=()=>{U=!0,w.call(F,new e(void 0,{cause:Y.signal.reason}))},Y.signal.aborted)r.nextTick(K);else{q=q||at().addAbortListener;const de=q(Y.signal,K),H=w;w=a((...G)=>{de[g](),H.apply(F,G)})}const X=(...de)=>{U||r.nextTick(()=>w.apply(F,de))};return v(F[$].promise,X,X),j}function Z(F,Y){var w;let U=!1;return Y===null&&(Y=o),(w=Y)!==null&&w!==void 0&&w.cleanup&&(c(Y.cleanup,"cleanup"),U=Y.cleanup),new u((K,X)=>{const de=te(F,Y,H=>{U&&de(),H?X(H):K()})})}return Mi.exports=te,Mi.exports.finished=Z,Mi.exports}var Tn,bs;function Or(){if(bs)return Tn;bs=1;const r=hr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:i}=nt(),{Symbol:n}=Be(),{kIsDestroyed:o,isDestroyed:a,isFinished:s,isServerRequest:d}=Ot(),l=n("kDestroy"),c=n("kConstruct");function u(I,$,q){I&&(I.stack,$&&!$.errored&&($.errored=I),q&&!q.errored&&(q.errored=I))}function v(I,$){const q=this._readableState,A=this._writableState,j=A||q;return A!=null&&A.destroyed||q!=null&&q.destroyed?(typeof $=="function"&&$(),this):(u(I,A,q),A&&(A.destroyed=!0),q&&(q.destroyed=!0),j.constructed?g(this,I,$):this.once(l,function(te){g(this,e(te,I),$)}),this)}function g(I,$,q){let A=!1;function j(te){if(A)return;A=!0;const N=I._readableState,Z=I._writableState;u(te,Z,N),Z&&(Z.closed=!0),N&&(N.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(y,I,te):r.nextTick(k,I)}try{I._destroy($||null,j)}catch(te){j(te)}}function y(I,$){x(I,$),k(I)}function k(I){const $=I._readableState,q=I._writableState;q&&(q.closeEmitted=!0),$&&($.closeEmitted=!0),(q!=null&&q.emitClose||$!=null&&$.emitClose)&&I.emit("close")}function x(I,$){const q=I._readableState,A=I._writableState;A!=null&&A.errorEmitted||q!=null&&q.errorEmitted||(A&&(A.errorEmitted=!0),q&&(q.errorEmitted=!0),I.emit("error",$))}function _(){const I=this._readableState,$=this._writableState;I&&(I.constructed=!0,I.closed=!1,I.closeEmitted=!1,I.destroyed=!1,I.errored=null,I.errorEmitted=!1,I.reading=!1,I.ended=I.readable===!1,I.endEmitted=I.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 E(I,$,q){const A=I._readableState,j=I._writableState;if(j!=null&&j.destroyed||A!=null&&A.destroyed)return this;A!=null&&A.autoDestroy||j!=null&&j.autoDestroy?I.destroy($):$&&($.stack,j&&!j.errored&&(j.errored=$),A&&!A.errored&&(A.errored=$),q?r.nextTick(x,I,$):x(I,$))}function m(I,$){if(typeof I._construct!="function")return;const q=I._readableState,A=I._writableState;q&&(q.constructed=!1),A&&(A.constructed=!1),I.once(c,$),!(I.listenerCount(c)>1)&&r.nextTick(f,I)}function f(I){let $=!1;function q(A){if($){E(I,A??new t);return}$=!0;const j=I._readableState,te=I._writableState,N=te||j;j&&(j.constructed=!0),te&&(te.constructed=!0),N.destroyed?I.emit(l,A):A?E(I,A,!0):r.nextTick(b,I)}try{I._construct(A=>{r.nextTick(q,A)})}catch(A){r.nextTick(q,A)}}function b(I){I.emit(c)}function R(I){return I?.setHeader&&typeof I.abort=="function"}function L(I){I.emit("close")}function T(I,$){I.emit("error",$),r.nextTick(L,I)}function B(I,$){!I||a(I)||(!$&&!s(I)&&($=new i),d(I)?(I.socket=null,I.destroy($)):R(I)?I.abort():R(I.req)?I.req.abort():typeof I.destroy=="function"?I.destroy($):typeof I.close=="function"?I.close():$?r.nextTick(T,I,$):r.nextTick(L,I),I.destroyed||(I[o]=!0))}return Tn={construct:m,destroyer:B,destroy:v,undestroy:_,errorOrDestroy:E},Tn}var An,ms;function va(){if(ms)return An;ms=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=an();function i(o){t.call(this,o)}e(i.prototype,t.prototype),e(i,t),i.prototype.pipe=function(o,a){const s=this;function d(k){o.writable&&o.write(k)===!1&&s.pause&&s.pause()}s.on("data",d);function l(){s.readable&&s.resume&&s.resume()}o.on("drain",l),!o._isStdio&&(!a||a.end!==!1)&&(s.on("end",u),s.on("close",v));let c=!1;function u(){c||(c=!0,o.end())}function v(){c||(c=!0,typeof o.destroy=="function"&&o.destroy())}function g(k){y(),t.listenerCount(this,"error")===0&&this.emit("error",k)}n(s,"error",g),n(o,"error",g);function y(){s.removeListener("data",d),o.removeListener("drain",l),s.removeListener("end",u),s.removeListener("close",v),s.removeListener("error",g),o.removeListener("error",g),s.removeListener("end",y),s.removeListener("close",y),o.removeListener("close",y)}return s.on("end",y),s.on("close",y),o.on("close",y),o.emit("pipe",s),o};function n(o,a,s){if(typeof o.prependListener=="function")return o.prependListener(a,s);!o._events||!o._events[a]?o.on(a,s):r(o._events[a])?o._events[a].unshift(s):o._events[a]=[s,o._events[a]]}return An={Stream:i,prependListener:n},An}var jn={exports:{}},gs;function sn(){return gs||(gs=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:i}=nt(),{isNodeStream:n,isWebStream:o,kControllerErrorFunction:a}=Ot(),s=Wt(),{ERR_INVALID_ARG_TYPE:d}=i;let l;const c=(u,v)=>{if(typeof u!="object"||!("aborted"in u))throw new d(v,"AbortSignal",u)};r.exports.addAbortSignal=function(v,g){if(c(v,"signal"),!n(g)&&!o(g))throw new d("stream",["ReadableStream","WritableStream","Stream"],g);return r.exports.addAbortSignalNoValidate(v,g)},r.exports.addAbortSignalNoValidate=function(u,v){if(typeof u!="object"||!("aborted"in u))return v;const g=n(v)?()=>{v.destroy(new t(void 0,{cause:u.reason}))}:()=>{v[a](new t(void 0,{cause:u.reason}))};if(u.aborted)g();else{l=l||at().addAbortListener;const y=l(u,g);s(v,y[e])}return v}}(jn)),jn.exports}var Dn,vs;function _u(){if(vs)return Dn;vs=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:i}=Be(),{Buffer:n}=Lt(),{inspect:o}=at();return Dn=class{constructor(){this.head=null,this.tail=null,this.length=0}push(s){const d={data:s,next:null};this.length>0?this.tail.next=d:this.head=d,this.tail=d,++this.length}unshift(s){const d={data:s,next:this.head};this.length===0&&(this.tail=d),this.head=d,++this.length}shift(){if(this.length===0)return;const s=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,s}clear(){this.head=this.tail=null,this.length=0}join(s){if(this.length===0)return"";let d=this.head,l=""+d.data;for(;(d=d.next)!==null;)l+=s+d.data;return l}concat(s){if(this.length===0)return n.alloc(0);const d=n.allocUnsafe(s>>>0);let l=this.head,c=0;for(;l;)t(d,l.data,c),c+=l.data.length,l=l.next;return d}consume(s,d){const l=this.head.data;if(s<l.length){const c=l.slice(0,s);return this.head.data=l.slice(s),c}return s===l.length?this.shift():d?this._getString(s):this._getBuffer(s)}first(){return this.head.data}*[e](){for(let s=this.head;s;s=s.next)yield s.data}_getString(s){let d="",l=this.head,c=0;do{const u=l.data;if(s>u.length)d+=u,s-=u.length;else{s===u.length?(d+=u,++c,l.next?this.head=l.next:this.head=this.tail=null):(d+=r(u,0,s),this.head=l,l.data=r(u,s));break}++c}while((l=l.next)!==null);return this.length-=c,d}_getBuffer(s){const d=n.allocUnsafe(s),l=s;let c=this.head,u=0;do{const v=c.data;if(s>v.length)t(d,v,l-s),s-=v.length;else{s===v.length?(t(d,v,l-s),++u,c.next?this.head=c.next:this.head=this.tail=null):(t(d,new i(v.buffer,v.byteOffset,s),l-s),this.head=c,c.data=v.slice(s));break}++u}while((c=c.next)!==null);return this.length-=u,d}[Symbol.for("nodejs.util.inspect.custom")](s,d){return o(this,{...d,depth:0,customInspect:!1})}},Dn}var Ln,ys;function ln(){if(ys)return Ln;ys=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=Si(),{ERR_INVALID_ARG_VALUE:i}=nt().codes;let n=16*1024,o=16;function a(c,u,v){return c.highWaterMark!=null?c.highWaterMark:u?c[v]:null}function s(c){return c?o:n}function d(c,u){t(u,"value",0),c?o=u:n=u}function l(c,u,v,g){const y=a(u,g,v);if(y!=null){if(!e(y)||y<0){const k=g?`options.${v}`:"options.highWaterMark";throw new i(k,y)}return r(y)}return s(c.objectMode)}return Ln={getHighWaterMark:l,getDefaultHighWaterMark:s,setDefaultHighWaterMark:d},Ln}var On={},Bi={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ws;function ku(){return ws||(ws=1,function(r,e){var t=Lt(),i=t.Buffer;function n(a,s){for(var d in a)s[d]=a[d]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?r.exports=t:(n(t,e),e.Buffer=o);function o(a,s,d){return i(a,s,d)}o.prototype=Object.create(i.prototype),n(i,o),o.from=function(a,s,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return i(a,s,d)},o.alloc=function(a,s,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var l=i(a);return s!==void 0?typeof d=="string"?l.fill(s,d):l.fill(s):l.fill(0),l},o.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return i(a)},o.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(Bi,Bi.exports)),Bi.exports}var xs;function Eu(){if(xs)return On;xs=1;var r=ku().Buffer,e=r.isEncoding||function(_){switch(_=""+_,_&&_.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 t(_){if(!_)return"utf8";for(var E;;)switch(_){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 _;default:if(E)return;_=(""+_).toLowerCase(),E=!0}}function i(_){var E=t(_);if(typeof E!="string"&&(r.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return E||_}On.StringDecoder=n;function n(_){this.encoding=i(_);var E;switch(this.encoding){case"utf16le":this.text=u,this.end=v,E=4;break;case"utf8":this.fillLast=d,E=4;break;case"base64":this.text=g,this.end=y,E=3;break;default:this.write=k,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(E)}n.prototype.write=function(_){if(_.length===0)return"";var E,m;if(this.lastNeed){if(E=this.fillLast(_),E===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<_.length?E?E+this.text(_,m):this.text(_,m):E||""},n.prototype.end=c,n.prototype.text=l,n.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function o(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function a(_,E,m){var f=E.length-1;if(f<m)return 0;var b=o(E[f]);return b>=0?(b>0&&(_.lastNeed=b-1),b):--f<m||b===-2?0:(b=o(E[f]),b>=0?(b>0&&(_.lastNeed=b-2),b):--f<m||b===-2?0:(b=o(E[f]),b>=0?(b>0&&(b===2?b=0:_.lastNeed=b-3),b):0))}function s(_,E,m){if((E[0]&192)!==128)return _.lastNeed=0,"�";if(_.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return _.lastNeed=1,"�";if(_.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return _.lastNeed=2,"�"}}function d(_){var E=this.lastTotal-this.lastNeed,m=s(this,_);if(m!==void 0)return m;if(this.lastNeed<=_.length)return _.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,E,0,_.length),this.lastNeed-=_.length}function l(_,E){var m=a(this,_,E);if(!this.lastNeed)return _.toString("utf8",E);this.lastTotal=m;var f=_.length-(m-this.lastNeed);return _.copy(this.lastChar,0,f),_.toString("utf8",E,f)}function c(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+"�":E}function u(_,E){if((_.length-E)%2===0){var m=_.toString("utf16le",E);if(m){var f=m.charCodeAt(m.length-1);if(f>=55296&&f<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",E,_.length-1)}function v(_){var E=_&&_.length?this.write(_):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,m)}return E}function g(_,E){var m=(_.length-E)%3;return m===0?_.toString("base64",E):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",E,_.length-m))}function y(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function k(_){return _.toString(this.encoding)}function x(_){return _&&_.length?this.write(_):""}return On}var Cn,_s;function ec(){if(_s)return Cn;_s=1;const r=hr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:i}=Be(),{Buffer:n}=Lt(),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_NULL_VALUES:a}=nt().codes;function s(d,l,c){let u;if(typeof l=="string"||l instanceof n)return new d({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let v;if(l&&l[t])v=!0,u=l[t]();else if(l&&l[i])v=!1,u=l[i]();else throw new o("iterable",["Iterable"],l);const g=new d({objectMode:!0,highWaterMark:1,...c});let y=!1;g._read=function(){y||(y=!0,x())},g._destroy=function(_,E){e(k(_),()=>r.nextTick(E,_),m=>r.nextTick(E,m||_))};async function k(_){const E=_!=null,m=typeof u.throw=="function";if(E&&m){const{value:f,done:b}=await u.throw(_);if(await f,b)return}if(typeof u.return=="function"){const{value:f}=await u.return();await f}}async function x(){for(;;){try{const{value:_,done:E}=v?await u.next():u.next();if(E)g.push(null);else{const m=_&&typeof _.then=="function"?await _:_;if(m===null)throw y=!1,new a;if(g.push(m))continue;y=!1}}catch(_){g.destroy(_)}break}}return g}return Cn=s,Cn}var $n,ks;function dn(){if(ks)return $n;ks=1;const r=hr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:i,NumberParseInt:n,ObjectDefineProperties:o,ObjectKeys:a,ObjectSetPrototypeOf:s,Promise:d,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:u,Symbol:v}=Be();$n=le,le.ReadableState=ge;const{EventEmitter:g}=an(),{Stream:y,prependListener:k}=va(),{Buffer:x}=Lt(),{addAbortSignal:_}=sn(),E=Wt();let m=at().debuglog("stream",D=>{m=D});const f=_u(),b=Or(),{getHighWaterMark:R,getDefaultHighWaterMark:L}=ln(),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_OUT_OF_RANGE:$,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:A},AbortError:j}=nt(),{validateObject:te}=Si(),N=v("kPaused"),{StringDecoder:Z}=Eu(),F=ec();s(le.prototype,y.prototype),s(le,y);const Y=()=>{},{errorOrDestroy:w}=b,U=1,K=2,X=4,de=8,H=16,G=32,W=64,z=128,ee=256,re=512,pe=1024,be=2048,O=4096,V=8192,oe=16384,fe=32768,he=65536,me=1<<17,J=1<<18;function ce(D){return{enumerable:!1,get(){return(this.state&D)!==0},set(M){M?this.state|=D:this.state&=~D}}}o(ge.prototype,{objectMode:ce(U),ended:ce(K),endEmitted:ce(X),reading:ce(de),constructed:ce(H),sync:ce(G),needReadable:ce(W),emittedReadable:ce(z),readableListening:ce(ee),resumeScheduled:ce(re),errorEmitted:ce(pe),emitClose:ce(be),autoDestroy:ce(O),destroyed:ce(V),closed:ce(oe),closeEmitted:ce(fe),multiAwaitDrain:ce(he),readingMore:ce(me),dataEmitted:ce(J)});function ge(D,M,ve){typeof ve!="boolean"&&(ve=M instanceof jt()),this.state=be|O|H|G,D&&D.objectMode&&(this.state|=U),ve&&D&&D.readableObjectMode&&(this.state|=U),this.highWaterMark=D?R(this,D,"readableHighWaterMark",ve):L(!1),this.buffer=new f,this.length=0,this.pipes=[],this.flowing=null,this[N]=null,D&&D.emitClose===!1&&(this.state&=~be),D&&D.autoDestroy===!1&&(this.state&=~O),this.errored=null,this.defaultEncoding=D&&D.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,D&&D.encoding&&(this.decoder=new Z(D.encoding),this.encoding=D.encoding)}function le(D){if(!(this instanceof le))return new le(D);const M=this instanceof jt();this._readableState=new ge(D,this,M),D&&(typeof D.read=="function"&&(this._read=D.read),typeof D.destroy=="function"&&(this._destroy=D.destroy),typeof D.construct=="function"&&(this._construct=D.construct),D.signal&&!M&&_(D.signal,this)),y.call(this,D),b.construct(this,()=>{this._readableState.needReadable&&Q(this,this._readableState)})}le.prototype.destroy=b.destroy,le.prototype._undestroy=b.undestroy,le.prototype._destroy=function(D,M){M(D)},le.prototype[g.captureRejectionSymbol]=function(D){this.destroy(D)},le.prototype[c]=function(){let D;return this.destroyed||(D=this.readableEnded?null:new j,this.destroy(D)),new d((M,ve)=>E(this,ye=>ye&&ye!==D?ve(ye):M(null)))},le.prototype.push=function(D,M){return Ie(this,D,M,!1)},le.prototype.unshift=function(D,M){return Ie(this,D,M,!0)};function Ie(D,M,ve,ye){m("readableAddChunk",M);const xe=D._readableState;let Xe;if((xe.state&U)===0&&(typeof M=="string"?(ve=ve||xe.defaultEncoding,xe.encoding!==ve&&(ye&&xe.encoding?M=x.from(M,ve).toString(xe.encoding):(M=x.from(M,ve),ve=""))):M instanceof x?ve="":y._isUint8Array(M)?(M=y._uint8ArrayToBuffer(M),ve=""):M!=null&&(Xe=new B("chunk",["string","Buffer","Uint8Array"],M))),Xe)w(D,Xe);else if(M===null)xe.state&=~de,p(D,xe);else if((xe.state&U)!==0||M&&M.length>0)if(ye)if((xe.state&X)!==0)w(D,new A);else{if(xe.destroyed||xe.errored)return!1;We(D,xe,M,!0)}else if(xe.ended)w(D,new q);else{if(xe.destroyed||xe.errored)return!1;xe.state&=~de,xe.decoder&&!ve?(M=xe.decoder.write(M),xe.objectMode||M.length!==0?We(D,xe,M,!1):Q(D,xe)):We(D,xe,M,!1)}else ye||(xe.state&=~de,Q(D,xe));return!xe.ended&&(xe.length<xe.highWaterMark||xe.length===0)}function We(D,M,ve,ye){M.flowing&&M.length===0&&!M.sync&&D.listenerCount("data")>0?((M.state&he)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,D.emit("data",ve)):(M.length+=M.objectMode?1:ve.length,ye?M.buffer.unshift(ve):M.buffer.push(ve),(M.state&W)!==0&&h(D)),Q(D,M)}le.prototype.isPaused=function(){const D=this._readableState;return D[N]===!0||D.flowing===!1},le.prototype.setEncoding=function(D){const M=new Z(D);this._readableState.decoder=M,this._readableState.encoding=this._readableState.decoder.encoding;const ve=this._readableState.buffer;let ye="";for(const xe of ve)ye+=M.write(xe);return ve.clear(),ye!==""&&ve.push(ye),this._readableState.length=ye.length,this};const Se=1073741824;function Qe(D){if(D>Se)throw new $("size","<= 1GiB",D);return D--,D|=D>>>1,D|=D>>>2,D|=D>>>4,D|=D>>>8,D|=D>>>16,D++,D}function S(D,M){return D<=0||M.length===0&&M.ended?0:(M.state&U)!==0?1:i(D)?M.flowing&&M.length?M.buffer.first().length:M.length:D<=M.length?D:M.ended?M.length:0}le.prototype.read=function(D){m("read",D),D===void 0?D=NaN:t(D)||(D=n(D,10));const M=this._readableState,ve=D;if(D>M.highWaterMark&&(M.highWaterMark=Qe(D)),D!==0&&(M.state&=~z),D===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?Ue(this):h(this),null;if(D=S(D,M),D===0&&M.ended)return M.length===0&&Ue(this),null;let ye=(M.state&W)!==0;if(m("need readable",ye),(M.length===0||M.length-D<M.highWaterMark)&&(ye=!0,m("length less than watermark",ye)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)ye=!1,m("reading, ended or constructing",ye);else if(ye){m("do read"),M.state|=de|G,M.length===0&&(M.state|=W);try{this._read(M.highWaterMark)}catch(Xe){w(this,Xe)}M.state&=~G,M.reading||(D=S(ve,M))}let xe;return D>0?xe=qe(D,M):xe=null,xe===null?(M.needReadable=M.length<=M.highWaterMark,D=0):(M.length-=D,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),ve!==D&&M.ended&&Ue(this)),xe!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",xe)),xe};function p(D,M){if(m("onEofChunk"),!M.ended){if(M.decoder){const ve=M.decoder.end();ve&&ve.length&&(M.buffer.push(ve),M.length+=M.objectMode?1:ve.length)}M.ended=!0,M.sync?h(D):(M.needReadable=!1,M.emittedReadable=!0,C(D))}}function h(D){const M=D._readableState;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick(C,D))}function C(D){const M=D._readableState;m("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(D.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,Ae(D)}function Q(D,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(se,D,M))}function se(D,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const ve=M.length;if(m("maybeReadMore read 0"),D.read(0),ve===M.length)break}M.readingMore=!1}le.prototype._read=function(D){throw new I("_read()")},le.prototype.pipe=function(D,M){const ve=this,ye=this._readableState;ye.pipes.length===1&&(ye.multiAwaitDrain||(ye.multiAwaitDrain=!0,ye.awaitDrainWriters=new l(ye.awaitDrainWriters?[ye.awaitDrainWriters]:[]))),ye.pipes.push(D),m("pipe count=%d opts=%j",ye.pipes.length,M);const Xe=(!M||M.end!==!1)&&D!==r.stdout&&D!==r.stderr?ji:P;ye.endEmitted?r.nextTick(Xe):ve.once("end",Xe),D.on("unpipe",Ye);function Ye(ie,ne){m("onunpipe"),ie===ve&&ne&&ne.hasUnpiped===!1&&(ne.hasUnpiped=!0,It())}function ji(){m("onend"),D.end()}let Rt,Di=!1;function It(){m("cleanup"),D.removeListener("close",Br),D.removeListener("finish",Ve),Rt&&D.removeListener("drain",Rt),D.removeListener("error",gr),D.removeListener("unpipe",Ye),ve.removeListener("end",ji),ve.removeListener("end",P),ve.removeListener("data",mr),Di=!0,Rt&&ye.awaitDrainWriters&&(!D._writableState||D._writableState.needDrain)&&Rt()}function Mr(){Di||(ye.pipes.length===1&&ye.pipes[0]===D?(m("false write response, pause",0),ye.awaitDrainWriters=D,ye.multiAwaitDrain=!1):ye.pipes.length>1&&ye.pipes.includes(D)&&(m("false write response, pause",ye.awaitDrainWriters.size),ye.awaitDrainWriters.add(D)),ve.pause()),Rt||(Rt=ue(ve,D),D.on("drain",Rt))}ve.on("data",mr);function mr(ie){m("ondata");const ne=D.write(ie);m("dest.write",ne),ne===!1&&Mr()}function gr(ie){if(m("onerror",ie),P(),D.removeListener("error",gr),D.listenerCount("error")===0){const ne=D._writableState||D._readableState;ne&&!ne.errorEmitted?w(D,ie):D.emit("error",ie)}}k(D,"error",gr);function Br(){D.removeListener("finish",Ve),P()}D.once("close",Br);function Ve(){m("onfinish"),D.removeListener("close",Br),P()}D.once("finish",Ve);function P(){m("unpipe"),ve.unpipe(D)}return D.emit("pipe",ve),D.writableNeedDrain===!0?Mr():ye.flowing||(m("pipe resume"),ve.resume()),D};function ue(D,M){return function(){const ye=D._readableState;ye.awaitDrainWriters===M?(m("pipeOnDrain",1),ye.awaitDrainWriters=null):ye.multiAwaitDrain&&(m("pipeOnDrain",ye.awaitDrainWriters.size),ye.awaitDrainWriters.delete(M)),(!ye.awaitDrainWriters||ye.awaitDrainWriters.size===0)&&D.listenerCount("data")&&D.resume()}}le.prototype.unpipe=function(D){const M=this._readableState,ve={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!D){const xe=M.pipes;M.pipes=[],this.pause();for(let Xe=0;Xe<xe.length;Xe++)xe[Xe].emit("unpipe",this,{hasUnpiped:!1});return this}const ye=e(M.pipes,D);return ye===-1?this:(M.pipes.splice(ye,1),M.pipes.length===0&&this.pause(),D.emit("unpipe",this,ve),this)},le.prototype.on=function(D,M){const ve=y.prototype.on.call(this,D,M),ye=this._readableState;return D==="data"?(ye.readableListening=this.listenerCount("readable")>0,ye.flowing!==!1&&this.resume()):D==="readable"&&!ye.endEmitted&&!ye.readableListening&&(ye.readableListening=ye.needReadable=!0,ye.flowing=!1,ye.emittedReadable=!1,m("on readable",ye.length,ye.reading),ye.length?h(this):ye.reading||r.nextTick(Fe,this)),ve},le.prototype.addListener=le.prototype.on,le.prototype.removeListener=function(D,M){const ve=y.prototype.removeListener.call(this,D,M);return D==="readable"&&r.nextTick(ke,this),ve},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(D){const M=y.prototype.removeAllListeners.apply(this,arguments);return(D==="readable"||D===void 0)&&r.nextTick(ke,this),M};function ke(D){const M=D._readableState;M.readableListening=D.listenerCount("readable")>0,M.resumeScheduled&&M[N]===!1?M.flowing=!0:D.listenerCount("data")>0?D.resume():M.readableListening||(M.flowing=null)}function Fe(D){m("readable nexttick read 0"),D.read(0)}le.prototype.resume=function(){const D=this._readableState;return D.flowing||(m("resume"),D.flowing=!D.readableListening,je(this,D)),D[N]=!1,this};function je(D,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(De,D,M))}function De(D,M){m("resume",M.reading),M.reading||D.read(0),M.resumeScheduled=!1,D.emit("resume"),Ae(D),M.flowing&&!M.reading&&D.read(0)}le.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[N]=!0,this};function Ae(D){const M=D._readableState;for(m("flow",M.flowing);M.flowing&&D.read()!==null;);}le.prototype.wrap=function(D){let M=!1;D.on("data",ye=>{!this.push(ye)&&D.pause&&(M=!0,D.pause())}),D.on("end",()=>{this.push(null)}),D.on("error",ye=>{w(this,ye)}),D.on("close",()=>{this.destroy()}),D.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&D.resume&&(M=!1,D.resume())};const ve=a(D);for(let ye=1;ye<ve.length;ye++){const xe=ve[ye];this[xe]===void 0&&typeof D[xe]=="function"&&(this[xe]=D[xe].bind(D))}return this},le.prototype[u]=function(){return gt(this)},le.prototype.iterator=function(D){return D!==void 0&&te(D,"options"),gt(this,D)};function gt(D,M){typeof D.read!="function"&&(D=le.wrap(D,{objectMode:!0}));const ve=Pt(D,M);return ve.stream=D,ve}async function*Pt(D,M){let ve=Y;function ye(Ye){this===D?(ve(),ve=Y):ve=Ye}D.on("readable",ye);let xe;const Xe=E(D,{writable:!1},Ye=>{xe=Ye?T(xe,Ye):null,ve(),ve=Y});try{for(;;){const Ye=D.destroyed?null:D.read();if(Ye!==null)yield Ye;else{if(xe)throw xe;if(xe===null)return;await new d(ye)}}}catch(Ye){throw xe=T(xe,Ye),xe}finally{(xe||M?.destroyOnReturn!==!1)&&(xe===void 0||D._readableState.autoDestroy)?b.destroyer(D,null):(D.off("readable",ye),Xe())}}o(le.prototype,{readable:{__proto__:null,get(){const D=this._readableState;return!!D&&D.readable!==!1&&!D.destroyed&&!D.errorEmitted&&!D.endEmitted},set(D){this._readableState&&(this._readableState.readable=!!D)}},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(D){this._readableState&&(this._readableState.flowing=D)}},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(D){this._readableState&&(this._readableState.destroyed=D)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(ge.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[N]!==!1},set(D){this[N]=!!D}}}),le._fromList=qe;function qe(D,M){if(M.length===0)return null;let ve;return M.objectMode?ve=M.buffer.shift():!D||D>=M.length?(M.decoder?ve=M.buffer.join(""):M.buffer.length===1?ve=M.buffer.first():ve=M.buffer.concat(M.length),M.buffer.clear()):ve=M.buffer.consume(D,M.decoder),ve}function Ue(D){const M=D._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Ai,M,D))}function Ai(D,M){if(m("endReadableNT",D.endEmitted,D.length),!D.errored&&!D.closeEmitted&&!D.endEmitted&&D.length===0){if(D.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(Mt,M);else if(D.autoDestroy){const ve=M._writableState;(!ve||ve.autoDestroy&&(ve.finished||ve.writable===!1))&&M.destroy()}}}function Mt(D){D.writable&&!D.writableEnded&&!D.destroyed&&D.end()}le.from=function(D,M){return F(le,D,M)};let br;function Pr(){return br===void 0&&(br={}),br}return le.fromWeb=function(D,M){return Pr().newStreamReadableFromReadableStream(D,M)},le.toWeb=function(D,M){return Pr().newReadableStreamFromStreamReadable(D,M)},le.wrap=function(D,M){var ve,ye;return new le({objectMode:(ve=(ye=D.readableObjectMode)!==null&&ye!==void 0?ye:D.objectMode)!==null&&ve!==void 0?ve:!0,...M,destroy(xe,Xe){b.destroyer(D,xe),Xe(xe)}}).wrap(D)},$n}var Fn,Es;function ya(){if(Es)return Fn;Es=1;const r=hr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:n,ObjectDefineProperties:o,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:s,Symbol:d,SymbolHasInstance:l}=Be();Fn=te,te.WritableState=A;const{EventEmitter:c}=an(),u=va().Stream,{Buffer:v}=Lt(),g=Or(),{addAbortSignal:y}=sn(),{getHighWaterMark:k,getDefaultHighWaterMark:x}=ln(),{ERR_INVALID_ARG_TYPE:_,ERR_METHOD_NOT_IMPLEMENTED:E,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:f,ERR_STREAM_DESTROYED:b,ERR_STREAM_ALREADY_FINISHED:R,ERR_STREAM_NULL_VALUES:L,ERR_STREAM_WRITE_AFTER_END:T,ERR_UNKNOWN_ENCODING:B}=nt().codes,{errorOrDestroy:I}=g;a(te.prototype,u.prototype),a(te,u);function $(){}const q=d("kOnFinished");function A(O,V,oe){typeof oe!="boolean"&&(oe=V instanceof jt()),this.objectMode=!!(O&&O.objectMode),oe&&(this.objectMode=this.objectMode||!!(O&&O.writableObjectMode)),this.highWaterMark=O?k(this,O,"writableHighWaterMark",oe):x(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const fe=!!(O&&O.decodeStrings===!1);this.decodeStrings=!fe,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=w.bind(void 0,V),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,j(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!O||O.emitClose!==!1,this.autoDestroy=!O||O.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function j(O){O.buffered=[],O.bufferedIndex=0,O.allBuffers=!0,O.allNoop=!0}A.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},n(A.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function te(O){const V=this instanceof jt();if(!V&&!i(te,this))return new te(O);this._writableState=new A(O,this,V),O&&(typeof O.write=="function"&&(this._write=O.write),typeof O.writev=="function"&&(this._writev=O.writev),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.final=="function"&&(this._final=O.final),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&y(O.signal,this)),u.call(this,O),g.construct(this,()=>{const oe=this._writableState;oe.writing||de(this,oe),z(this,oe)})}n(te,l,{__proto__:null,value:function(O){return i(this,O)?!0:this!==te?!1:O&&O._writableState instanceof A}}),te.prototype.pipe=function(){I(this,new f)};function N(O,V,oe,fe){const he=O._writableState;if(typeof oe=="function")fe=oe,oe=he.defaultEncoding;else{if(!oe)oe=he.defaultEncoding;else if(oe!=="buffer"&&!v.isEncoding(oe))throw new B(oe);typeof fe!="function"&&(fe=$)}if(V===null)throw new L;if(!he.objectMode)if(typeof V=="string")he.decodeStrings!==!1&&(V=v.from(V,oe),oe="buffer");else if(V instanceof v)oe="buffer";else if(u._isUint8Array(V))V=u._uint8ArrayToBuffer(V),oe="buffer";else throw new _("chunk",["string","Buffer","Uint8Array"],V);let me;return he.ending?me=new T:he.destroyed&&(me=new b("write")),me?(r.nextTick(fe,me),I(O,me,!0),me):(he.pendingcb++,Z(O,he,V,oe,fe))}te.prototype.write=function(O,V,oe){return N(this,O,V,oe)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const O=this._writableState;O.corked&&(O.corked--,O.writing||de(this,O))},te.prototype.setDefaultEncoding=function(V){if(typeof V=="string"&&(V=s(V)),!v.isEncoding(V))throw new B(V);return this._writableState.defaultEncoding=V,this};function Z(O,V,oe,fe,he){const me=V.objectMode?1:oe.length;V.length+=me;const J=V.length<V.highWaterMark;return J||(V.needDrain=!0),V.writing||V.corked||V.errored||!V.constructed?(V.buffered.push({chunk:oe,encoding:fe,callback:he}),V.allBuffers&&fe!=="buffer"&&(V.allBuffers=!1),V.allNoop&&he!==$&&(V.allNoop=!1)):(V.writelen=me,V.writecb=he,V.writing=!0,V.sync=!0,O._write(oe,fe,V.onwrite),V.sync=!1),J&&!V.errored&&!V.destroyed}function F(O,V,oe,fe,he,me,J){V.writelen=fe,V.writecb=J,V.writing=!0,V.sync=!0,V.destroyed?V.onwrite(new b("write")):oe?O._writev(he,V.onwrite):O._write(he,me,V.onwrite),V.sync=!1}function Y(O,V,oe,fe){--V.pendingcb,fe(oe),X(V),I(O,oe)}function w(O,V){const oe=O._writableState,fe=oe.sync,he=oe.writecb;if(typeof he!="function"){I(O,new m);return}oe.writing=!1,oe.writecb=null,oe.length-=oe.writelen,oe.writelen=0,V?(V.stack,oe.errored||(oe.errored=V),O._readableState&&!O._readableState.errored&&(O._readableState.errored=V),fe?r.nextTick(Y,O,oe,V,he):Y(O,oe,V,he)):(oe.buffered.length>oe.bufferedIndex&&de(O,oe),fe?oe.afterWriteTickInfo!==null&&oe.afterWriteTickInfo.cb===he?oe.afterWriteTickInfo.count++:(oe.afterWriteTickInfo={count:1,cb:he,stream:O,state:oe},r.nextTick(U,oe.afterWriteTickInfo)):K(O,oe,1,he))}function U({stream:O,state:V,count:oe,cb:fe}){return V.afterWriteTickInfo=null,K(O,V,oe,fe)}function K(O,V,oe,fe){for(!V.ending&&!O.destroyed&&V.length===0&&V.needDrain&&(V.needDrain=!1,O.emit("drain"));oe-- >0;)V.pendingcb--,fe();V.destroyed&&X(V),z(O,V)}function X(O){if(O.writing)return;for(let he=O.bufferedIndex;he<O.buffered.length;++he){var V;const{chunk:me,callback:J}=O.buffered[he],ce=O.objectMode?1:me.length;O.length-=ce,J((V=O.errored)!==null&&V!==void 0?V:new b("write"))}const oe=O[q].splice(0);for(let he=0;he<oe.length;he++){var fe;oe[he]((fe=O.errored)!==null&&fe!==void 0?fe:new b("end"))}j(O)}function de(O,V){if(V.corked||V.bufferProcessing||V.destroyed||!V.constructed)return;const{buffered:oe,bufferedIndex:fe,objectMode:he}=V,me=oe.length-fe;if(!me)return;let J=fe;if(V.bufferProcessing=!0,me>1&&O._writev){V.pendingcb-=me-1;const ce=V.allNoop?$:le=>{for(let Ie=J;Ie<oe.length;++Ie)oe[Ie].callback(le)},ge=V.allNoop&&J===0?oe:e(oe,J);ge.allBuffers=V.allBuffers,F(O,V,!0,V.length,ge,"",ce),j(V)}else{do{const{chunk:ce,encoding:ge,callback:le}=oe[J];oe[J++]=null;const Ie=he?1:ce.length;F(O,V,!1,Ie,ce,ge,le)}while(J<oe.length&&!V.writing);J===oe.length?j(V):J>256?(oe.splice(0,J),V.bufferedIndex=0):V.bufferedIndex=J}V.bufferProcessing=!1}te.prototype._write=function(O,V,oe){if(this._writev)this._writev([{chunk:O,encoding:V}],oe);else throw new E("_write()")},te.prototype._writev=null,te.prototype.end=function(O,V,oe){const fe=this._writableState;typeof O=="function"?(oe=O,O=null,V=null):typeof V=="function"&&(oe=V,V=null);let he;if(O!=null){const me=N(this,O,V);me instanceof t&&(he=me)}return fe.corked&&(fe.corked=1,this.uncork()),he||(!fe.errored&&!fe.ending?(fe.ending=!0,z(this,fe,!0),fe.ended=!0):fe.finished?he=new R("end"):fe.destroyed&&(he=new b("end"))),typeof oe=="function"&&(he||fe.finished?r.nextTick(oe,he):fe[q].push(oe)),this};function H(O){return O.ending&&!O.destroyed&&O.constructed&&O.length===0&&!O.errored&&O.buffered.length===0&&!O.finished&&!O.writing&&!O.errorEmitted&&!O.closeEmitted}function G(O,V){let oe=!1;function fe(he){if(oe){I(O,he??m());return}if(oe=!0,V.pendingcb--,he){const me=V[q].splice(0);for(let J=0;J<me.length;J++)me[J](he);I(O,he,V.sync)}else H(V)&&(V.prefinished=!0,O.emit("prefinish"),V.pendingcb++,r.nextTick(ee,O,V))}V.sync=!0,V.pendingcb++;try{O._final(fe)}catch(he){fe(he)}V.sync=!1}function W(O,V){!V.prefinished&&!V.finalCalled&&(typeof O._final=="function"&&!V.destroyed?(V.finalCalled=!0,G(O,V)):(V.prefinished=!0,O.emit("prefinish")))}function z(O,V,oe){H(V)&&(W(O,V),V.pendingcb===0&&(oe?(V.pendingcb++,r.nextTick((fe,he)=>{H(he)?ee(fe,he):he.pendingcb--},O,V)):H(V)&&(V.pendingcb++,ee(O,V))))}function ee(O,V){V.pendingcb--,V.finished=!0;const oe=V[q].splice(0);for(let fe=0;fe<oe.length;fe++)oe[fe]();if(O.emit("finish"),V.autoDestroy){const fe=O._readableState;(!fe||fe.autoDestroy&&(fe.endEmitted||fe.readable===!1))&&O.destroy()}}o(te.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(O){this._writableState&&(this._writableState.destroyed=O)}},writable:{__proto__:null,get(){const O=this._writableState;return!!O&&O.writable!==!1&&!O.destroyed&&!O.errored&&!O.ending&&!O.ended},set(O){this._writableState&&(this._writableState.writable=!!O)}},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 O=this._writableState;return O?!O.destroyed&&!O.ending&&O.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 re=g.destroy;te.prototype.destroy=function(O,V){const oe=this._writableState;return!oe.destroyed&&(oe.bufferedIndex<oe.buffered.length||oe[q].length)&&r.nextTick(X,oe),re.call(this,O,V),this},te.prototype._undestroy=g.undestroy,te.prototype._destroy=function(O,V){V(O)},te.prototype[c.captureRejectionSymbol]=function(O){this.destroy(O)};let pe;function be(){return pe===void 0&&(pe={}),pe}return te.fromWeb=function(O,V){return be().newStreamWritableFromWritableStream(O,V)},te.toWeb=function(O){return be().newWritableStreamFromStreamWritable(O)},Fn}var Pn,Ss;function Su(){if(Ss)return Pn;Ss=1;const r=hr(),e=Lt(),{isReadable:t,isWritable:i,isIterable:n,isNodeStream:o,isReadableNodeStream:a,isWritableNodeStream:s,isDuplexNodeStream:d,isReadableStream:l,isWritableStream:c}=Ot(),u=Wt(),{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:y}}=nt(),{destroyer:k}=Or(),x=jt(),_=dn(),E=ya(),{createDeferredPromise:m}=at(),f=ec(),b=globalThis.Blob||e.Blob,R=typeof b<"u"?function(A){return A instanceof b}:function(A){return!1},L=globalThis.AbortController||xi().AbortController,{FunctionPrototypeCall:T}=Be();class B extends x{constructor(A){super(A),A?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),A?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Pn=function q(A,j){if(d(A))return A;if(a(A))return $({readable:A});if(s(A))return $({writable:A});if(o(A))return $({writable:!1,readable:!1});if(l(A))return $({readable:_.fromWeb(A)});if(c(A))return $({writable:E.fromWeb(A)});if(typeof A=="function"){const{value:N,write:Z,final:F,destroy:Y}=I(A);if(n(N))return f(B,N,{objectMode:!0,write:Z,final:F,destroy:Y});const w=N?.then;if(typeof w=="function"){let U;const K=T(w,N,X=>{if(X!=null)throw new y("nully","body",X)},X=>{k(U,X)});return U=new B({objectMode:!0,readable:!1,write:Z,final(X){F(async()=>{try{await K,r.nextTick(X,null)}catch(de){r.nextTick(X,de)}})},destroy:Y})}throw new y("Iterable, AsyncIterable or AsyncFunction",j,N)}if(R(A))return q(A.arrayBuffer());if(n(A))return f(B,A,{objectMode:!0,writable:!1});if(l(A?.readable)&&c(A?.writable))return B.fromWeb(A);if(typeof A?.writable=="object"||typeof A?.readable=="object"){const N=A!=null&&A.readable?a(A?.readable)?A?.readable:q(A.readable):void 0,Z=A!=null&&A.writable?s(A?.writable)?A?.writable:q(A.writable):void 0;return $({readable:N,writable:Z})}const te=A?.then;if(typeof te=="function"){let N;return T(te,A,Z=>{Z!=null&&N.push(Z),N.push(null)},Z=>{k(N,Z)}),N=new B({objectMode:!0,writable:!1,read(){}})}throw new g(j,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],A)};function I(q){let{promise:A,resolve:j}=m();const te=new L,N=te.signal;return{value:q(async function*(){for(;;){const F=A;A=null;const{chunk:Y,done:w,cb:U}=await F;if(r.nextTick(U),w)return;if(N.aborted)throw new v(void 0,{cause:N.reason});({promise:A,resolve:j}=m()),yield Y}}(),{signal:N}),write(F,Y,w){const U=j;j=null,U({chunk:F,done:!1,cb:w})},final(F){const Y=j;j=null,Y({done:!0,cb:F})},destroy(F,Y){te.abort(),Y(F)}}}function $(q){const A=q.readable&&typeof q.readable.read!="function"?_.wrap(q.readable):q.readable,j=q.writable;let te=!!t(A),N=!!i(j),Z,F,Y,w,U;function K(X){const de=w;w=null,de?de(X):X&&U.destroy(X)}return U=new B({readableObjectMode:!!(A!=null&&A.readableObjectMode),writableObjectMode:!!(j!=null&&j.writableObjectMode),readable:te,writable:N}),N&&(u(j,X=>{N=!1,X&&k(A,X),K(X)}),U._write=function(X,de,H){j.write(X,de)?H():Z=H},U._final=function(X){j.end(),F=X},j.on("drain",function(){if(Z){const X=Z;Z=null,X()}}),j.on("finish",function(){if(F){const X=F;F=null,X()}})),te&&(u(A,X=>{te=!1,X&&k(A,X),K(X)}),A.on("readable",function(){if(Y){const X=Y;Y=null,X()}}),A.on("end",function(){U.push(null)}),U._read=function(){for(;;){const X=A.read();if(X===null){Y=U._read;return}if(!U.push(X))return}}),U._destroy=function(X,de){!X&&w!==null&&(X=new v),Y=null,Z=null,F=null,w===null?de(X):(w=de,k(j,X),k(A,X))},U}return Pn}var Mn,Rs;function jt(){if(Rs)return Mn;Rs=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:i}=Be();Mn=a;const n=dn(),o=ya();i(a.prototype,n.prototype),i(a,n);{const c=t(o.prototype);for(let u=0;u<c.length;u++){const v=c[u];a.prototype[v]||(a.prototype[v]=o.prototype[v])}}function a(c){if(!(this instanceof a))return new a(c);n.call(this,c),o.call(this,c),c?(this.allowHalfOpen=c.allowHalfOpen!==!1,c.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),c.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(a.prototype,{writable:{__proto__:null,...e(o.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(o.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(o.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(o.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(o.prototype,"writableLength")},writableFinished:{__proto__:null,...e(o.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(o.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(o.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(o.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(c){this._readableState&&this._writableState&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}});let s;function d(){return s===void 0&&(s={}),s}a.fromWeb=function(c,u){return d().newStreamDuplexFromReadableWritablePair(c,u)},a.toWeb=function(c){return d().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Su()),l(c,"body")},Mn}var Bn,Is;function tc(){if(Is)return Bn;Is=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Bn=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=nt().codes,i=jt(),{getHighWaterMark:n}=ln();r(a.prototype,i.prototype),r(a,i);const o=e("kCallback");function a(l){if(!(this instanceof a))return new a(l);const c=l?n(this,l,"readableHighWaterMark",!0):null;c===0&&(l={...l,highWaterMark:null,readableHighWaterMark:c,writableHighWaterMark:l.writableHighWaterMark||0}),i.call(this,l),this._readableState.sync=!1,this[o]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",d)}function s(l){typeof this._flush=="function"&&!this.destroyed?this._flush((c,u)=>{if(c){l?l(c):this.destroy(c);return}u!=null&&this.push(u),this.push(null),l&&l()}):(this.push(null),l&&l())}function d(){this._final!==s&&s.call(this)}return a.prototype._final=s,a.prototype._transform=function(l,c,u){throw new t("_transform()")},a.prototype._write=function(l,c,u){const v=this._readableState,g=this._writableState,y=v.length;this._transform(l,c,(k,x)=>{if(k){u(k);return}x!=null&&this.push(x),g.ended||y===v.length||v.length<v.highWaterMark?u():this[o]=u})},a.prototype._read=function(){if(this[o]){const l=this[o];this[o]=null,l()}},Bn}var qn,Ns;function rc(){if(Ns)return qn;Ns=1;const{ObjectSetPrototypeOf:r}=Be();qn=t;const e=tc();r(t.prototype,e.prototype),r(t,e);function t(i){if(!(this instanceof t))return new t(i);e.call(this,i)}return t.prototype._transform=function(i,n,o){o(null,i)},qn}var zn,Ts;function wa(){if(Ts)return zn;Ts=1;const r=hr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:i,SymbolDispose:n}=Be(),o=Wt(),{once:a}=at(),s=Or(),d=jt(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:u,ERR_MISSING_ARGS:v,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:k}=nt(),{validateFunction:x,validateAbortSignal:_}=Si(),{isIterable:E,isReadable:m,isReadableNodeStream:f,isNodeStream:b,isTransformStream:R,isWebStream:L,isReadableStream:T,isReadableFinished:B}=Ot(),I=globalThis.AbortController||xi().AbortController;let $,q,A;function j(X,de,H){let G=!1;X.on("close",()=>{G=!0});const W=o(X,{readable:de,writable:H},z=>{G=!z});return{destroy:z=>{G||(G=!0,s.destroyer(X,z||new g("pipe")))},cleanup:W}}function te(X){return x(X[X.length-1],"streams[stream.length - 1]"),X.pop()}function N(X){if(E(X))return X;if(f(X))return Z(X);throw new c("val",["Readable","Iterable","AsyncIterable"],X)}async function*Z(X){q||(q=dn()),yield*q.prototype[i].call(X)}async function F(X,de,H,{end:G}){let W,z=null;const ee=be=>{if(be&&(W=be),z){const O=z;z=null,O()}},re=()=>new t((be,O)=>{W?O(W):z=()=>{W?O(W):be()}});de.on("drain",ee);const pe=o(de,{readable:!1},ee);try{de.writableNeedDrain&&await re();for await(const be of X)de.write(be)||await re();G&&(de.end(),await re()),H()}catch(be){H(W!==be?l(W,be):be)}finally{pe(),de.off("drain",ee)}}async function Y(X,de,H,{end:G}){R(de)&&(de=de.writable);const W=de.getWriter();try{for await(const z of X)await W.ready,W.write(z).catch(()=>{});await W.ready,G&&await W.close(),H()}catch(z){try{await W.abort(z),H(z)}catch(ee){H(ee)}}}function w(...X){return U(X,a(te(X)))}function U(X,de,H){if(X.length===1&&e(X[0])&&(X=X[0]),X.length<2)throw new v("streams");const G=new I,W=G.signal,z=H?.signal,ee=[];_(z,"options.signal");function re(){he(new k)}A=A||at().addAbortListener;let pe;z&&(pe=A(z,re));let be,O;const V=[];let oe=0;function fe(ge){he(ge,--oe===0)}function he(ge,le){var Ie;if(ge&&(!be||be.code==="ERR_STREAM_PREMATURE_CLOSE")&&(be=ge),!(!be&&!le)){for(;V.length;)V.shift()(be);(Ie=pe)===null||Ie===void 0||Ie[n](),G.abort(),le&&(be||ee.forEach(We=>We()),r.nextTick(de,be,O))}}let me;for(let ge=0;ge<X.length;ge++){const le=X[ge],Ie=ge<X.length-1,We=ge>0,Se=Ie||H?.end!==!1,Qe=ge===X.length-1;if(b(le)){let S=function(p){p&&p.name!=="AbortError"&&p.code!=="ERR_STREAM_PREMATURE_CLOSE"&&fe(p)};if(Se){const{destroy:p,cleanup:h}=j(le,Ie,We);V.push(p),m(le)&&Qe&&ee.push(h)}le.on("error",S),m(le)&&Qe&&ee.push(()=>{le.removeListener("error",S)})}if(ge===0)if(typeof le=="function"){if(me=le({signal:W}),!E(me))throw new u("Iterable, AsyncIterable or Stream","source",me)}else E(le)||f(le)||R(le)?me=le:me=d.from(le);else if(typeof le=="function"){if(R(me)){var J;me=N((J=me)===null||J===void 0?void 0:J.readable)}else me=N(me);if(me=le(me,{signal:W}),Ie){if(!E(me,!0))throw new u("AsyncIterable",`transform[${ge-1}]`,me)}else{var ce;$||($=rc());const S=new $({objectMode:!0}),p=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof p=="function")oe++,p.call(me,Q=>{O=Q,Q!=null&&S.write(Q),Se&&S.end(),r.nextTick(fe)},Q=>{S.destroy(Q),r.nextTick(fe,Q)});else if(E(me,!0))oe++,F(me,S,fe,{end:Se});else if(T(me)||R(me)){const Q=me.readable||me;oe++,F(Q,S,fe,{end:Se})}else throw new u("AsyncIterable or Promise","destination",me);me=S;const{destroy:h,cleanup:C}=j(me,!1,!0);V.push(h),Qe&&ee.push(C)}}else if(b(le)){if(f(me)){oe+=2;const S=K(me,le,fe,{end:Se});m(le)&&Qe&&ee.push(S)}else if(R(me)||T(me)){const S=me.readable||me;oe++,F(S,le,fe,{end:Se})}else if(E(me))oe++,F(me,le,fe,{end:Se});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(L(le)){if(f(me))oe++,Y(N(me),le,fe,{end:Se});else if(T(me)||E(me))oe++,Y(me,le,fe,{end:Se});else if(R(me))oe++,Y(me.readable,le,fe,{end:Se});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else me=d.from(le)}return(W!=null&&W.aborted||z!=null&&z.aborted)&&r.nextTick(re),me}function K(X,de,H,{end:G}){let W=!1;if(de.on("close",()=>{W||H(new y)}),X.pipe(de,{end:!1}),G){let z=function(){W=!0,de.end()};B(X)?r.nextTick(z):X.once("end",z)}else H();return o(X,{readable:!0,writable:!1},z=>{const ee=X._readableState;z&&z.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?X.once("end",H).once("error",H):H(z)}),o(de,{readable:!1,writable:!0},H)}return zn={pipelineImpl:U,pipeline:w},zn}var Un,As;function ic(){if(As)return Un;As=1;const{pipeline:r}=wa(),e=jt(),{destroyer:t}=Or(),{isNodeStream:i,isReadable:n,isWritable:o,isWebStream:a,isTransformStream:s,isWritableStream:d,isReadableStream:l}=Ot(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:u,ERR_MISSING_ARGS:v}}=nt(),g=Wt();return Un=function(...k){if(k.length===0)throw new v("streams");if(k.length===1)return e.from(k[0]);const x=[...k];if(typeof k[0]=="function"&&(k[0]=e.from(k[0])),typeof k[k.length-1]=="function"){const $=k.length-1;k[$]=e.from(k[$])}for(let $=0;$<k.length;++$)if(!(!i(k[$])&&!a(k[$]))){if($<k.length-1&&!(n(k[$])||l(k[$])||s(k[$])))throw new u(`streams[${$}]`,x[$],"must be readable");if($>0&&!(o(k[$])||d(k[$])||s(k[$])))throw new u(`streams[${$}]`,x[$],"must be writable")}let _,E,m,f,b;function R($){const q=f;f=null,q?q($):$?b.destroy($):!I&&!B&&b.destroy()}const L=k[0],T=r(k,R),B=!!(o(L)||d(L)||s(L)),I=!!(n(T)||l(T)||s(T));if(b=new e({writableObjectMode:!!(L!=null&&L.writableObjectMode),readableObjectMode:!!(T!=null&&T.readableObjectMode),writable:B,readable:I}),B){if(i(L))b._write=function(q,A,j){L.write(q,A)?j():_=j},b._final=function(q){L.end(),E=q},L.on("drain",function(){if(_){const q=_;_=null,q()}});else if(a(L)){const A=(s(L)?L.writable:L).getWriter();b._write=async function(j,te,N){try{await A.ready,A.write(j).catch(()=>{}),N()}catch(Z){N(Z)}},b._final=async function(j){try{await A.ready,A.close().catch(()=>{}),E=j}catch(te){j(te)}}}const $=s(T)?T.readable:T;g($,()=>{if(E){const q=E;E=null,q()}})}if(I){if(i(T))T.on("readable",function(){if(m){const $=m;m=null,$()}}),T.on("end",function(){b.push(null)}),b._read=function(){for(;;){const $=T.read();if($===null){m=b._read;return}if(!b.push($))return}};else if(a(T)){const q=(s(T)?T.readable:T).getReader();b._read=async function(){for(;;)try{const{value:A,done:j}=await q.read();if(!b.push(A))return;if(j){b.push(null);return}}catch{return}}}}return b._destroy=function($,q){!$&&f!==null&&($=new c),m=null,_=null,E=null,f===null?q($):(f=q,i(T)&&t(T,$))},b},Un}var js;function Ru(){if(js)return Pi;js=1;const r=globalThis.AbortController||xi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:i,ERR_OUT_OF_RANGE:n},AbortError:o}=nt(),{validateAbortSignal:a,validateInteger:s,validateObject:d}=Si(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:u}=Wt(),v=ic(),{addAbortSignalNoValidate:g}=sn(),{isWritable:y,isNodeStream:k}=Ot(),{deprecate:x}=at(),{ArrayPrototypePush:_,Boolean:E,MathFloor:m,Number:f,NumberIsNaN:b,Promise:R,PromiseReject:L,PromiseResolve:T,PromisePrototypeThen:B,Symbol:I}=Be(),$=I("kEmpty"),q=I("kEof");function A(z,ee){if(ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),k(z)&&!y(z))throw new e("stream",z,"must be writable");const re=v(this,z);return ee!=null&&ee.signal&&g(ee.signal,re),re}function j(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal");let re=1;ee?.concurrency!=null&&(re=m(ee.concurrency));let pe=re-1;return ee?.highWaterMark!=null&&(pe=m(ee.highWaterMark)),s(re,"options.concurrency",1),s(pe,"options.highWaterMark",0),pe+=re,(async function*(){const O=at().AbortSignalAny([ee?.signal].filter(E)),V=this,oe=[],fe={signal:O};let he,me,J=!1,ce=0;function ge(){J=!0,le()}function le(){ce-=1,Ie()}function Ie(){me&&!J&&ce<re&&oe.length<pe&&(me(),me=null)}async function We(){try{for await(let Se of V){if(J)return;if(O.aborted)throw new o;try{if(Se=z(Se,fe),Se===$)continue;Se=T(Se)}catch(Qe){Se=L(Qe)}ce+=1,B(Se,le,ge),oe.push(Se),he&&(he(),he=null),!J&&(oe.length>=pe||ce>=re)&&await new R(Qe=>{me=Qe})}oe.push(q)}catch(Se){const Qe=L(Se);B(Qe,le,ge),oe.push(Qe)}finally{J=!0,he&&(he(),he=null)}}We();try{for(;;){for(;oe.length>0;){const Se=await oe[0];if(Se===q)return;if(O.aborted)throw new o;Se!==$&&(yield Se),oe.shift(),Ie()}await new R(Se=>{he=Se})}}finally{J=!0,me&&(me(),me=null)}}).call(this)}function te(z=void 0){return z!=null&&d(z,"options"),z?.signal!=null&&a(z.signal,"options.signal"),(async function*(){let re=0;for await(const be of this){var pe;if(z!=null&&(pe=z.signal)!==null&&pe!==void 0&&pe.aborted)throw new o({cause:z.signal.reason});yield[re++,be]}}).call(this)}async function N(z,ee=void 0){for await(const re of w.call(this,z,ee))return!0;return!1}async function Z(z,ee=void 0){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);return!await N.call(this,async(...re)=>!await z(...re),ee)}async function F(z,ee){for await(const re of w.call(this,z,ee))return re}async function Y(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function re(pe,be){return await z(pe,be),$}for await(const pe of j.call(this,re,ee));}function w(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function re(pe,be){return await z(pe,be)?pe:$}return j.call(this,re,ee)}class U extends i{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function K(z,ee,re){var pe;if(typeof z!="function")throw new t("reducer",["Function","AsyncFunction"],z);re!=null&&d(re,"options"),re?.signal!=null&&a(re.signal,"options.signal");let be=arguments.length>1;if(re!=null&&(pe=re.signal)!==null&&pe!==void 0&&pe.aborted){const he=new o(void 0,{cause:re.signal.reason});throw this.once("error",()=>{}),await u(this.destroy(he)),he}const O=new r,V=O.signal;if(re!=null&&re.signal){const he={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>O.abort(),he)}let oe=!1;try{for await(const he of this){var fe;if(oe=!0,re!=null&&(fe=re.signal)!==null&&fe!==void 0&&fe.aborted)throw new o;be?ee=await z(ee,he,{signal:V}):(ee=he,be=!0)}if(!oe&&!be)throw new U}finally{O.abort()}return ee}async function X(z){z!=null&&d(z,"options"),z?.signal!=null&&a(z.signal,"options.signal");const ee=[];for await(const pe of this){var re;if(z!=null&&(re=z.signal)!==null&&re!==void 0&&re.aborted)throw new o(void 0,{cause:z.signal.reason});_(ee,pe)}return ee}function de(z,ee){const re=j.call(this,z,ee);return(async function*(){for await(const be of re)yield*be}).call(this)}function H(z){if(z=f(z),b(z))return 0;if(z<0)throw new n("number",">= 0",z);return z}function G(z,ee=void 0){return ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),z=H(z),(async function*(){var pe;if(ee!=null&&(pe=ee.signal)!==null&&pe!==void 0&&pe.aborted)throw new o;for await(const O of this){var be;if(ee!=null&&(be=ee.signal)!==null&&be!==void 0&&be.aborted)throw new o;z--<=0&&(yield O)}}).call(this)}function W(z,ee=void 0){return ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),z=H(z),(async function*(){var pe;if(ee!=null&&(pe=ee.signal)!==null&&pe!==void 0&&pe.aborted)throw new o;for await(const O of this){var be;if(ee!=null&&(be=ee.signal)!==null&&be!==void 0&&be.aborted)throw new o;if(z-- >0&&(yield O),z<=0)return}}).call(this)}return Pi.streamReturningOperators={asIndexedPairs:x(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:de,map:j,take:W,compose:A},Pi.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:X,some:N,find:F},Pi}var Hn,Ds;function nc(){if(Ds)return Hn;Ds=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:i,isWebStream:n}=Ot(),{pipelineImpl:o}=wa(),{finished:a}=Wt();oc();function s(...d){return new e((l,c)=>{let u,v;const g=d[d.length-1];if(g&&typeof g=="object"&&!i(g)&&!t(g)&&!n(g)){const y=r(d);u=y.signal,v=y.end}o(d,(y,k)=>{y?c(y):l(k)},{signal:u,end:v})})}return Hn={finished:a,pipeline:s},Hn}var Ls;function oc(){if(Ls)return xn.exports;Ls=1;const{Buffer:r}=Lt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:i}=Be(),{promisify:{custom:n}}=at(),{streamReturningOperators:o,promiseReturningOperators:a}=Ru(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:s}}=nt(),d=ic(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=ln(),{pipeline:u}=wa(),{destroyer:v}=Or(),g=Wt(),y=nc(),k=Ot(),x=xn.exports=va().Stream;x.isDestroyed=k.isDestroyed,x.isDisturbed=k.isDisturbed,x.isErrored=k.isErrored,x.isReadable=k.isReadable,x.isWritable=k.isWritable,x.Readable=dn();for(const E of t(o)){let f=function(...b){if(new.target)throw s();return x.Readable.from(i(m,this,b))};const m=o[E];e(f,"name",{__proto__:null,value:m.name}),e(f,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:f,enumerable:!1,configurable:!0,writable:!0})}for(const E of t(a)){let f=function(...b){if(new.target)throw s();return i(m,this,b)};const m=a[E];e(f,"name",{__proto__:null,value:m.name}),e(f,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:f,enumerable:!1,configurable:!0,writable:!0})}x.Writable=ya(),x.Duplex=jt(),x.Transform=tc(),x.PassThrough=rc(),x.pipeline=u;const{addAbortSignal:_}=sn();return x.addAbortSignal=_,x.finished=g,x.destroy=v,x.compose=d,x.setDefaultHighWaterMark=l,x.getDefaultHighWaterMark=c,e(x,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return y}}),e(u,n,{__proto__:null,enumerable:!0,get(){return y.pipeline}}),e(g,n,{__proto__:null,enumerable:!0,get(){return y.finished}}),x.Stream=x,x._isUint8Array=function(m){return m instanceof Uint8Array},x._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},xn.exports}var Os;function ac(){return Os||(Os=1,function(r){const e=oc(),t=nc(),i=e.Readable.destroy;r.exports=e.Readable,r.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,r.exports._isUint8Array=e._isUint8Array,r.exports.isDisturbed=e.isDisturbed,r.exports.isErrored=e.isErrored,r.exports.isReadable=e.isReadable,r.exports.Readable=e.Readable,r.exports.Writable=e.Writable,r.exports.Duplex=e.Duplex,r.exports.Transform=e.Transform,r.exports.PassThrough=e.PassThrough,r.exports.addAbortSignal=e.addAbortSignal,r.exports.finished=e.finished,r.exports.destroy=e.destroy,r.exports.destroy=i,r.exports.pipeline=e.pipeline,r.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),r.exports.Stream=e.Stream,r.exports.default=r.exports}(wn)),wn.exports}var xa=ac();const Gn=Symbol("iter");function hi(r,e,t=4){if(t===0)return Object.assign(r,e);for(const i in e)r[i]=hi(r[i]||Object.create(null),e[i],t-1);return r}function sc(r,e,t=4){let i=!1;for(const n in r)if(n in e){const o=t===0?null:sc(r[n],e[n],t-1);if(o!==!1)i=i||Object.create(null),i[n]=o;else if(t===3)return!1}return i}function lc(r,e,t=4){let i=!1;for(const n in r)if(!(n in e))i=i||Object.create(null),i[n]=t===0?null:hi({},r[n],t-1);else if(t!==0){const o=lc(r[n],e[n],t-1);if(o!==!1)i=i||Object.create(null),i[n]=o;else if(t===3)return!1}return i}class Iu{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||Re}_termFromId(e){if(e[0]==="."){const t=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(t[i[1]]),this._termFromId(t[i[2]]),this._termFromId(t[i[3]]),i[4]&&this._termFromId(t[i[4]]))}return ci(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),i=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let o;return t&&i&&n&&(oa(e.graph)||(o=this._termToNumericId(e.graph)))&&this._ids[o?`.${t}.${i}.${n}.${o}`:`.${t}.${i}.${n}`]}return this._ids[Sr(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${oa(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Sr(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,i;if(e)for(t=e=`_:${e}`,i=1;this._ids[t];)t=e+i++;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))}}class et{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||Re,this._entityIndex=t.entityIndex||new Iu({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 t=this._graphs;let i,n;for(const o in t)for(const a in i=t[o].subjects)for(const s in n=i[a])e+=Object.keys(n[s]).length;return this._size=e}_addToIndex(e,t,i,n){const o=e[t]||(e[t]={}),a=o[i]||(o[i]={}),s=n in a;return s||(a[n]=null),!s}_removeFromIndex(e,t,i,n){const o=e[t],a=o[i];delete a[n];for(const s in a)return;delete o[i];for(const s in o)return;delete e[t]}*_findInIndex(e,t,i,n,o,a,s,d){let l,c,u;const v=this._entities,g=this._termFromId(v[d]),y={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const k in e)if(c=e[k]){y[o]=this._termFromId(v[k]),i&&((l=c,c={})[i]=l[i]);for(const x in c)if(u=c[x]){y[a]=this._termFromId(v[x]);const _=n?n in u?[n]:[]:Object.keys(u);for(let E=0;E<_.length;E++)y[s]=this._termFromId(v[_[E]]),yield this._factory.quad(y.subject,y.predicate,y.object,g)}}}_loop(e,t){for(const i in e)t(i)}_loopByKey0(e,t,i){let n,o;if(n=e[t])for(o in n)i(o)}_loopByKey1(e,t,i){let n,o;for(n in e)o=e[n],o[t]&&i(n)}_loopBy2Keys(e,t,i,n){let o,a,s;if((o=e[t])&&(a=o[i]))for(s in a)n(s)}_countInIndex(e,t,i,n){let o=0,a,s,d;t&&((a=e,e={})[t]=a[t]);for(const l in e)if(s=e[l]){i&&((a=s,s={})[i]=a[i]);for(const c in s)(d=s[c])&&(n?n in d&&o++:o+=Object.keys(d).length)}return o}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return i=>{i in t||(t[i]=!0,e(this._termFromId(this._entities[i],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,i,n){t||(n=e.graph,i=e.object,t=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let o=this._graphs[n];return o||(o=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(o)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),i=this._termToNewNumericId(i),this._addToIndex(o.subjects,e,t,i)?(this._addToIndex(o.predicates,t,i,e),this._addToIndex(o.objects,i,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,i,n){return e&&e.subject&&({subject:e,predicate:t,object:i,graph:n}=e),!this.readQuads(e,t,i,n).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,i,n){t||({subject:e,predicate:t,object:i,graph:n}=e),n=n?this._termToNumericId(n):1;const o=this._graphs;let a,s,d;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(i=i&&this._termToNumericId(i))||!(a=o[n])||!(s=a.subjects[e])||!(d=s[t])||!(i in d))return!1;this._removeFromIndex(a.subjects,e,t,i),this._removeFromIndex(a.predicates,t,i,e),this._removeFromIndex(a.objects,i,e,t),this._size!==null&&this._size--;for(e in a.subjects)return!0;return delete o[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,i,n){const o=new xa.Readable({objectMode:!0}),a=this.readQuads(e,t,i,n);return o._read=s=>{for(;--s>=0;){const{done:d,value:l}=a.next();if(d){o.push(null);return}o.push(l)}},this.remove(o)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,i,n){return[...this.readQuads(e,t,i,n)]}*readQuads(e,t,i,n){const o=this._getGraphs(n);let a,s,d,l;if(!(e&&!(s=this._termToNumericId(e))||t&&!(d=this._termToNumericId(t))||i&&!(l=this._termToNumericId(i))))for(const c in o)(a=o[c])&&(s?l?yield*this._findInIndex(a.objects,l,s,d,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,s,d,null,"subject","predicate","object",c):d?yield*this._findInIndex(a.predicates,d,l,null,"predicate","object","subject",c):l?yield*this._findInIndex(a.objects,l,null,null,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",c))}match(e,t,i,n){return new qt(this,e,t,i,n,{entityIndex:this._entityIndex})}countQuads(e,t,i,n){const o=this._getGraphs(n);let a=0,s,d,l,c;if(e&&!(d=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||i&&!(c=this._termToNumericId(i)))return 0;for(const u in o)(s=o[u])&&(e?i?a+=this._countInIndex(s.objects,c,d,l):a+=this._countInIndex(s.subjects,d,l,c):t?a+=this._countInIndex(s.predicates,l,c,d):a+=this._countInIndex(s.objects,c,d,l));return a}forEach(e,t,i,n,o){this.some(a=>(e(a,this),!1),t,i,n,o)}every(e,t,i,n,o){return!this.some(a=>!e(a,this),t,i,n,o)}some(e,t,i,n,o){for(const a of this.readQuads(t,i,n,o))if(e(a,this))return!0;return!1}getSubjects(e,t,i){const n=[];return this.forSubjects(o=>{n.push(o)},e,t,i),n}forSubjects(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.predicates,s,d,e):this._loopByKey1(a.subjects,s,e):d?this._loopByKey0(a.objects,d,e):this._loop(a.subjects,e))}getPredicates(e,t,i){const n=[];return this.forPredicates(o=>{n.push(o)},e,t,i),n}forPredicates(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.objects,d,s,e):this._loopByKey0(a.subjects,s,e):d?this._loopByKey1(a.predicates,d,e):this._loop(a.predicates,e))}getObjects(e,t,i){const n=[];return this.forObjects(o=>{n.push(o)},e,t,i),n}forObjects(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.subjects,s,d,e):this._loopByKey1(a.objects,s,e):d?this._loopByKey0(a.predicates,d,e):this._loop(a.objects,e))}getGraphs(e,t,i){const n=[];return this.forGraphs(o=>{n.push(o)},e,t,i),n}forGraphs(e,t,i,n){for(const o in this._graphs)this.some(a=>(e(a.graph),!0),t,i,n,this._termFromId(this._entities[o]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const i={},n=t?()=>!0:(s,d)=>{throw new Error(`${s.value} ${d}`)},o=this.getQuads(null,Ke.rdf.rest,Ke.rdf.nil,null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,u;const v=s.graph;let g=s.subject;for(;g&&!l;){const y=this.getQuads(null,null,g,null),k=this.getQuads(g,null,null,null);let x,_=null,E=null,m=null;for(let f=0;f<k.length&&!l;f++)x=k[f],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===Ke.rdf.first?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===Ke.rdf.rest?E?l=n(g,"has multiple rdf:rest arcs"):a.push(E=x):y.length?l=n(g,"can't be subject and object"):(c=x,u="subject"):l=n(g,"not confined to single graph");for(let f=0;f<y.length&&!l;++f)x=y[f],c?l=n(g,"can't have coreferences"):x.predicate.value===Ke.rdf.rest?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,u="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[u].value]=d)}),e&&this.removeQuads(a),i}addAll(e){if(e instanceof qt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=hi(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof qt&&(e=e.filtered),e===this)return!0;if(!(e instanceof et)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,i=e._graphs;let n,o,a,s,d;for(const l in i){if(!(n=t[l]))return!1;n=n.subjects;for(const c in o=i[l].subjects){if(!(a=n[c]))return!1;for(const u in s=o[c]){if(!(d=a[u]))return!1;for(const v in s[u])if(!(v in d))return!1}}}return!0}deleteMatches(e,t,i,n){for(const o of this.match(e,t,i,n))this.removeQuad(o);return this}difference(e){if(e&&e instanceof qt&&(e=e.filtered),e===this)return new et({entityIndex:this._entityIndex});if(e instanceof et&&e._entityIndex===this._entityIndex){const t=new et({entityIndex:this._entityIndex}),i=lc(this._graphs,e._graphs);return i&&(t._graphs=i,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof qt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new et({entityIndex:this._entityIndex});for(const i of this)e(i,this)&&t.add(i);return t}intersection(e){if(e instanceof qt&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=hi(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof et&&this._entityIndex===e._entityIndex){const t=new et({entityIndex:this._entityIndex}),i=sc(e._graphs,this._graphs);return i&&(t._graphs=i,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new et({entityIndex:this._entityIndex});for(const i of this)t.add(e(i,this));return t}reduce(e,t){const i=this.readQuads();let n=t===void 0?i.next().value:t;for(const o of i)n=e(n,o,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new ga().quadsToString(this)}union(e){const t=new et({entityIndex:this._entityIndex});return t._graphs=hi(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function kt(r,e,t=0){const i=e[t];if(i&&!(i in r))return!1;let n=!1;for(const o in i?{[i]:r[i]}:r){const a=t===2?null:kt(r[o],e,t+1);a!==!1&&(n=n||Object.create(null),n[o]=a)}return n}class qt extends xa.Readable{constructor(e,t,i,n,o,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:i,object:n,graph:o,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:i,predicate:n,subject:o}=this,a=this._filtered=new et({factory:e._factory,entityIndex:this.options.entityIndex});let s,d,l;if(o&&!(s=a._termToNumericId(o))||n&&!(d=a._termToNumericId(n))||i&&!(l=a._termToNumericId(i)))return a;const c=e._getGraphs(t);for(const u in c){let v,g,y,k;(k=c[u])&&(!s&&d?(g=kt(k.predicates,[d,l,s]))&&(v=kt(k.subjects,[s,d,l]),y=kt(k.objects,[l,s,d])):l?(y=kt(k.objects,[l,s,d]))&&(v=kt(k.subjects,[s,d,l]),g=kt(k.predicates,[d,l,s])):(v=kt(k.subjects,[s,d,l]))&&(g=kt(k.predicates,[d,l,s]),y=kt(k.objects,[l,s,d])),v&&(a._graphs[u]={subjects:v,predicates:g,objects:y}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Gn]&&(this[Gn]=this[Symbol.iterator]());const t=this[Gn];for(;--e>=0;){const{done:i,value:n}=t.next();if(i){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,i,n){return this.filtered.deleteMatches(e,t,i,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,i,n,o){return this.filtered.every(e,t,i,n,o)}filter(e){return this.filtered.filter(e)}forEach(e,t,i,n,o){return this.filtered.forEach(e,t,i,n,o)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,i,n,o){return this.filtered.some(e,t,i,n,o)}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 ga().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,t,i,n){return new qt(this.filtered,e,t,i,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Nu extends xa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new Kd(e);let i,n;const o={onQuad:(a,s)=>{a&&this.emit("error",a)||s&&this.push(s)},onPrefix:(a,s)=>{this.emit("prefix",a,s)}};e&&e.comments&&(o.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,s)=>{switch(a){case"data":i=s;break;case"end":n=s;break}}},o),this._transform=(a,s,d)=>{i(a),d()},this._flush=a=>{n(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const _e="http://www.w3.org/ns/shacl#",Cs="http://datashapes.org/dash#",Gt="http://www.w3.org/2001/XMLSchema#",zt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",_a="http://www.w3.org/2000/01/rdf-schema#",ka="http://www.w3.org/2004/02/skos/core#",Tu="http://www.w3.org/2002/07/owl#",Au="http://www.w3.org/ns/oa#",ju="http://purl.org/dc/terms/",Du="http://xmlns.com/foaf/0.1/",bi=Re.namedNode("loaded-shapes"),At=Re.namedNode("loaded-data"),tt=Re.namedNode(zt+"type"),aa=Re.namedNode(ju+"conformsTo"),$s=Re.namedNode(_a+"subClassOf"),Ea=Re.namedNode(Tu+"imports"),Lu=Re.namedNode(ka+"broader"),Ou=Re.namedNode(ka+"narrower"),qi=Re.namedNode(_e+"NodeShape"),Cu=Re.namedNode(_e+"IRI"),Yi=Re.namedNode(_e+"property"),Sa=Re.namedNode(_e+"class"),$u=Re.namedNode(_e+"node"),Rr=Re.namedNode(_e+"targetClass"),Fu=Re.namedNode(_e+"nodeKind"),Pu=Re.namedNode(Gt+"string");function mi(r,e,t=_e,i){let n="";const o=Mu(r,e,t,i);return o&&(n=o.value),n}function Mu(r,e,t=_e,i){let n;const o=t+e;if(i?.length){for(const a of i)for(const s of r)if(s.predicate.value===o){if(s.object.id.endsWith(`@${a}`))return s.object;s.object.id.indexOf("@")<0?n=s.object:n||(n=s.object)}}else for(const a of r)if(a.predicate.value===o)return a.object;return n}function Bu(r){r.querySelector(".editor")?.focus()}function Ri(r,e){return mi(r,"prefLabel",ka,e)||mi(r,"label",_a,e)||mi(r,"name",Du,e)}function dc(r,e,t){const i=[];for(const n of r)i.push({value:n,label:Ri(e.getQuads(n,null,null,null),t),children:[]});return i}function sa(r,e){for(const t in e)r=r.replace(e[t],"");return r}function cc(r,e,t,i,n=new Set){for(const o of e.owlImports)n.has(o.id)||(n.add(o.id),i.push(...t.getSubjects(tt,r,o)));e.parent&&cc(r,e.parent,t,i,n)}function Ra(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return dc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(tt,r,bi);t.push(...e.config.store.getSubjects(tt,r,At)),cc(r,e,e.config.store,t);const i=new Map,n=new Map;for(const a of t)i.set(a.id,{value:a,label:Ri(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t){for(const s of e.config.store.getObjects(a,Lu,null))i.has(s.id)&&n.set(a.id,s.id);for(const s of e.config.store.getObjects(a,Ou,null))i.has(s.id)&&n.set(s.id,a.id);for(const s of e.config.store.getObjects(a,$s,null))i.has(s.id)&&n.set(a.id,s.id)}for(const[a,s]of n.entries())i.get(s)?.children?.push(i.get(a));const o=[];for(const[a,s]of i.entries())n.has(a)||o.push(s);for(const a of e.config.store.getSubjects($s,r,null))o.push(...Ra(a,e));return o}}function la(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function Fs(r,e,t){if(e===void 0)return t;if(t===void 0)return e;const i=r.indexOf(e.language);if(i<0)return t;const n=r.indexOf(t.language);return n<0||n>i?e:t}function qu(r,{remove:e=!1,ignoreErrors:t=!1}={}){const i={},n=t?()=>!0:(s,d)=>{throw new Error(`${s.value} ${d}`)},o=r.getQuads(null,zt+"rest",zt+"nil",null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,u;const v=s.graph;let g=s.subject;for(;g&&!l;){const y=r.getQuads(null,null,g,null),k=r.getQuads(g,null,null,null).filter(f=>!f.predicate.equals(tt));let x,_=null,E=null,m=null;for(let f=0;f<k.length&&!l;f++)x=k[f],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===zt+"first"?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===zt+"rest"?E?l=n(g,"has multiple rdf:rest arcs"):a.push(E=x):y.length?l=n(g,"can't be subject and object"):(c=x,u="subject"):l=n(g,"not confined to single graph");for(let f=0;f<y.length&&!l;++f)x=y[f],c?l=n(g,"can't have coreferences"):x.predicate.value===zt+"rest"?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,u="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[u].value]=d)}),e&&r.removeQuads(a),i}function uc(r,e,t){const i=document.createElement("div");i.classList.add("shacl-or-constraint");const n=[];if(e instanceof Vt){const o=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Yi,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Yi,null),u=[];let v="";for(const g of c){const y=new tn(g,e,t);u.push(y),v+=(v.length>1?" / ":"")+y.template.label}o.push(u),n.push({label:v,value:l.toString()})}else{const c=new tn(r[l],e,t);o.push([c]),n.push({label:c.template.label,value:l.toString()})}const s=t.theme.createListEditor("Please choose",null,!1,n),d=s.querySelector(".editor");d.onchange=()=>{if(d.value){const l=o[parseInt(d.value)];let c;l.length&&(c=l[0],i.replaceWith(l[0]));for(let u=1;u<l.length;u++)c.after(l[u]),c=l[u]}},i.appendChild(s)}else{const o=[];for(let d=0;d<r.length;d++){const l=t.store.getQuads(r[d],null,null,null);l.length&&(o.push(l),n.push({label:Ri(l,t.languages)||sa(l[0].predicate.value,t.prefixes)+" = "+sa(l[0].object.value,t.prefixes),value:d.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,n,e.template),s=a.querySelector(".editor");s.onchange=()=>{s.value&&i.replaceWith(Xi(e.template.clone().merge(o[parseInt(s.value)]),void 0,!0))},i.appendChild(a)}return i}function zu(r,e,t){if(e instanceof ct){const i=e.datatype;for(const n of r){const o=t.store.getQuads(n,null,null,null);for(const a of o)if(a.predicate.value===`${_e}datatype`&&a.object.equals(i))return o}}else{const i=t.store.getObjects(e,tt,null);for(const n of r){const o=t.store.getQuads(n,null,null,null);for(const a of o)if(i.length>0){if(a.predicate.value===`${_e}node`){for(const s of i)if(t.store.getQuads(a.object,Rr,s,null).length>0)return o}if(a.predicate.equals(Sa)){for(const s of i)if(a.object.equals(s))return o}}else if(a.predicate.equals(Fu)&&a.object.equals(Cu))return o}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Uu(r,e,t){for(const i of r){let n=!1;const o=t.store.getObjects(i,Yi,null);for(const a of o){const s=t.store.getObjects(a,`${_e}path`,null);for(const d of s)if(n=t.store.countQuads(e,d,null,null)>0,n)break}if(n)return o}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const Hu={[`${_e}name`]:(r,e)=>{const t=e;r.name=Fs(r.config.languages,r.name,t)},[`${_e}description`]:(r,e)=>{const t=e;r.description=Fs(r.config.languages,r.description,t)},[`${_e}path`]:(r,e)=>{r.path=e.value},[`${_e}node`]:(r,e)=>{r.node=e},[`${_e}datatype`]:(r,e)=>{r.datatype=e},[`${_e}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${_e}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${_e}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${_e}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${_e}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${_e}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${_e}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${_e}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${_e}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${_e}pattern`]:(r,e)=>{r.pattern=e.value},[`${_e}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${Cs}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${Cs}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Au}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${_e}and`]:(r,e)=>{r.shaclAnd=e.value},[`${_e}in`]:(r,e)=>{r.shaclIn=e.value},[`${_e}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=Re.namedNode(zt+"langString")},[`${_e}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${_e}hasValue`]:(r,e)=>{r.hasValue=e},[`${_e}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${_e}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${_e}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[Ea.id]:(r,e)=>{r.owlImports.push(e)},[Sa.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Rr,e,null);t.length>0&&(r.node=t[0])},[`${_e}or`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",r.config.lists)},[`${_e}xone`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",r.config.lists)}};class Gu{constructor(e,t,i){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=i,this.merge(e),this.qualifiedValueShape&&this.merge(i.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)Hu[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Ri(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?sa(this.path,this.config.prefixes):"unknown"),this.node&&this.extendedShapes.push(this.node),this.shaclAnd){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const i of t)this.extendedShapes.push(i)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const Vu=`form { display:block; --label-width: 8em; --caret-size: 10px; }
28
28
  form.mode-edit { padding-left: 1em; }
29
29
  form, form * { box-sizing: border-box; }
30
30
  shacl-node, .collapsible::part(content) { display: flex; flex-direction: column; width: 100%; position: relative; }
@@ -299,7 +299,7 @@ a, a:visited { color: inherit; }
299
299
  .title { font-weight: 600; flex-grow: 1; text-align: center; }
300
300
  .clear { justify-self: flex-end; }
301
301
  main { flex-grow: 1; overflow: auto; }
302
- `];Ii([Ee({type:Boolean,reflect:!0})],ur.prototype,"open",2);Ii([Ee({type:Boolean})],ur.prototype,"closable",2);Ii([Ee()],ur.prototype,"title",2);Ii([ht("#dialog")],ur.prototype,"dialogElement",2);ur=Ii([Xt("rokit-dialog")],ur);class tn extends HTMLElement{constructor(e,t,i,n){if(super(),this.template=new Gu(i.store.getQuads(e,null,null,null),t,i),this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const o=new it;o.classList.add("collapsible","shacl-group"),o.open=i.attributes.collapse==="open",o.label=this.template.label,this.container=o}else this.container=this;if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),i.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let o=[];n&&(t.linked?o=i.store.getQuads(n,this.template.path,null,null):o=i.store.getQuads(n,this.template.path,null,At));let a=!1;for(const s of o)this.isValueValid(s.object)&&(this.addPropertyInstance(s.object),this.template.hasValue&&s.object.equals(this.template.hasValue)&&(a=!0));i.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}i.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof it&&(i.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const i=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let n=!1;if(e){const o=zu(i,e,this.template.config);o.length&&(t=Xi(this.template.clone().merge(o),e,!0),n=!0)}n||(t=uc(i,this,this.template.config),Ac(t,""))}else{let i=!1;if(e&&!(e instanceof ct)){const n=this.getRdfClassToLinkOrCreate();n&&this.template.config.store.countQuads(e,tt,n,At)===0&&(i=!0)}t=Xi(this.template,e,void 0,i||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const i=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",i)}toRDF(e,t){for(const i of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const n=Re.namedNode(i.dataset.path);if(i.firstChild instanceof Vt){const o=i.firstChild.toRDF(e);e.addQuad(t,n,o,this.template.config.valuesGraphId)}else for(const o of i.querySelectorAll(":scope > .editor")){const a=Ku(o);a&&e.addQuad(t,n,a,this.template.config.valuesGraphId)}}}getRdfClassToLinkOrCreate(){if(this.template.class&&this.template.node)return this.template.class;for(const e of this.template.extendedShapes){const t=this.template.config.store.getObjects(e,Rr,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const i=this.template.config.store.getObjects(t,Rr,null);for(const n of i)if(this.template.config.store.countQuads(e,tt,n,null)>0)return!0}return!1}createAddButton(){const e=new Ge;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,e.classList.add("add-button");let t=[],i=this.getRdfClassToLinkOrCreate();if(i&&(t=Ra(i,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",n=>{e.blur();const o=this.addPropertyInstance();o.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{Bu(o),o.classList.remove("fadeIn")},200)});else{const n=document.createElement("ul"),o=document.createElement("li");o.innerHTML="&#xFF0B; Create new "+this.template.label+"...",o.dataset.value="new",o.classList.add("large"),n.appendChild(o);const a=document.createElement("li");a.classList.add("divider"),n.appendChild(a);const s=document.createElement("li");s.classList.add("header"),s.innerText="Or link existing:",n.appendChild(s);for(const d of t){const l=document.createElement("li"),c=typeof d.value=="string"?d.value:d.value.value;l.innerText=d.label?d.label:c,l.dataset.value=JSON.stringify(d.value),n.appendChild(l)}e.appendChild(n),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const d=JSON.parse(e.value);this.container.insertBefore(Xi(this.template,d,!0,!0),e)}e.value=""})}return e}}function Xi(r,e,t=!1,i=!1){let n;if(r.extendedShapes.length){n=document.createElement("div"),n.classList.add("property-instance");for(const o of r.extendedShapes)n.appendChild(new Vt(o,r.config,e,r.parent,r.nodeKind,r.label,i))}else{const o=ef(r.path,r.datatype?.value);o?r.config.editMode&&!i?n=o.createEditor(r,e):n=o.createViewer(r,e):n=Xu(r,e||null,r.config.editMode&&!i),n.classList.add("property-instance"),i&&n.classList.add("linked")}return r.config.editMode&&Ac(n,r.label,t),n.dataset.path=r.path,n}function Ac(r,e,t=!1){const i=new Tr;i.classList.add("remove-button","clear"),i.title="Remove "+e,i.dense=!0,i.icon=!0,i.addEventListener("click",n=>{r.classList.remove("fadeIn"),r.classList.add("fadeOut"),setTimeout(()=>{const o=r.parentElement;r.remove(),o?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&i.classList.add("persistent"),r.appendChild(i)}window.customElements.define("shacl-property",tn);function np(r,e){let t=r;const i=e.store.getQuads(r,null,null,null),n=mi(i,"label",_a,e.languages);n&&(t=n);let o;if(e.attributes.collapse!==null)o=new it,o.classList.add("collapsible"),o.open=e.attributes.collapse==="open",o.label=t;else{o=document.createElement("div");const s=document.createElement("h1");s.innerText=t,o.appendChild(s)}o.dataset.subject=r,o.classList.add("shacl-group");const a=mi(i,"order");return a&&(o.style.order=a),o}const Je=[];for(let r=0;r<256;++r)Je.push((r+256).toString(16).slice(1));function op(r,e=0){return(Je[r[e+0]]+Je[r[e+1]]+Je[r[e+2]]+Je[r[e+3]]+"-"+Je[r[e+4]]+Je[r[e+5]]+"-"+Je[r[e+6]]+Je[r[e+7]]+"-"+Je[r[e+8]]+Je[r[e+9]]+"-"+Je[r[e+10]]+Je[r[e+11]]+Je[r[e+12]]+Je[r[e+13]]+Je[r[e+14]]+Je[r[e+15]]).toLowerCase()}let Xn;const ap=new Uint8Array(16);function sp(){if(!Xn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xn=crypto.getRandomValues.bind(crypto)}return Xn(ap)}const lp=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tl={randomUUID:lp};function rl(r,e,t){if(tl.randomUUID&&!r)return tl.randomUUID();r=r||{};const i=r.random??r.rng?.()??sp();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,op(i)}class Vt extends HTMLElement{constructor(e,t,i,n,o,a,s){super(),this.owlImports=[],this.parent=n,this.config=t,this.shaclSubject=e,this.linked=s||!1;let d=i;if(!d){if(!o){const c=t.store.getObjects(e,`${_e}nodeKind`,null);c.length&&(o=c[0])}o===void 0&&t.attributes.valuesNamespace||o?.value===`${_e}IRI`?d=Re.namedNode(t.attributes.valuesNamespace+rl()):d=Re.blankNode(rl())}this.nodeId=d;const l=JSON.stringify([e,i]);if(i&&t.renderedNodes.has(l)){a=a||"Link";const c=document.createElement("label");c.innerText=a,c.classList.add("linked"),this.appendChild(c);const u=document.createElement("a");let v=i.termType==="BlankNode"?"_:"+i.value:i.value;u.innerText=v,u.classList.add("ref-link"),u.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${v}']`)?.scrollIntoView()},this.appendChild(u),this.style.flexDirection="row"}else{if(i&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const c=document.createElement("div");c.innerText=`id: ${this.nodeId.id}`,c.classList.add("node-id-display"),this.appendChild(c)}for(const c of t.store.getQuads(e,Ea,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case Yi.id:this.addPropertyInstance(c.object,t,i);break;case`${_e}and`:const u=t.lists[c.object.value];if(u?.length)for(const v of u)this.prepend(new Vt(v,t,i,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case $u.id:this.prepend(new Vt(c.object,t,i,this));break;case`${_e}targetClass`:this.targetClass=c.object;break;case`${_e}or`:this.tryResolve(c.object,i,t);break;case`${_e}xone`:this.tryResolve(c.object,i,t);break}if(a){const c=document.createElement("h1");c.innerText=a,this.prepend(c)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const i of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))i.toRDF(e,t);this.targetClass&&e.addQuad(t,tt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Re.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,i){let n=this;const o=t.store.getQuads(e,`${_e}group`,null,null);if(o.length>0){const s=o[0].object.value;if(t.groups.indexOf(s)>-1){let d=this.querySelector(`:scope > .shacl-group[data-subject='${s}']`);d||(d=np(s,t),this.appendChild(d)),n=d}else console.warn("ignoring unknown group reference",o[0],"existing groups:",t.groups)}const a=new tn(e,this,t,i);a.childElementCount>0&&n.appendChild(a)}tryResolve(e,t,i){const n=i.lists[e.value];if(n?.length){let o=!1;if(t){const a=Uu(n,t,i);if(a.length){for(const s of a)this.addPropertyInstance(s,i,t);o=!0}}o||this.appendChild(uc(n,this,i))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",i.lists)}}window.customElements.define("shacl-node",Vt);var Yt={},Zt={},er={},Nt={},il;function dp(){if(il)return Nt;il=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.removeDotSegmentsOfPath=Nt.removeDotSegments=Nt.resolve=void 0;function r(n,o){o=o||"";const a=o.indexOf("#");if(a>0&&(o=o.substr(0,a)),!n.length){if(o.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${o}' for value '${n}'`);return o}if(n.startsWith("?")){const g=o.indexOf("?");return g>0&&(o=o.substr(0,g)),o+n}if(n.startsWith("#"))return o+n;if(!o.length){const g=n.indexOf(":");if(g<0)throw new Error(`Found invalid relative IRI '${n}' for a missing baseIRI`);return t(n,g)}const s=n.indexOf(":");if(s>=0)return t(n,s);const d=o.indexOf(":");if(d<0)throw new Error(`Found invalid baseIRI '${o}' for value '${n}'`);const l=o.substr(0,d+1);if(n.indexOf("//")===0)return l+t(n,s);let c;if(o.indexOf("//",d)===d+1){if(c=o.indexOf("/",d+3),c<0)return o.length>d+3?o+"/"+t(n,s):l+t(n,s)}else if(c=o.indexOf("/",d+1),c<0)return l+t(n,s);if(n.indexOf("/")===0)return o.substr(0,c)+e(n);let u=o.substr(c);const v=u.lastIndexOf("/");return v>=0&&v<u.length-1&&(u=u.substr(0,v+1),n[0]==="."&&n[1]!=="."&&n[1]!=="/"&&n[2]&&(n=n.substr(1))),n=u+n,n=e(n),o.substr(0,c)+n}Nt.resolve=r;function e(n){const o=[];let a=0;for(;a<n.length;)switch(n[a]){case"/":if(n[a+1]===".")if(n[a+2]==="."){if(!i(n[a+3])){o.push([]),a++;break}o.pop(),n[a+3]||o.push([]),a+=3}else{if(!i(n[a+2])){o.push([]),a++;break}n[a+2]||o.push([]),a+=2}else o.push([]),a++;break;case"#":case"?":o.length||o.push([]),o[o.length-1].push(n.substr(a)),a=n.length;break;default:o.length||o.push([]),o[o.length-1].push(n[a]),a++;break}return"/"+o.map(s=>s.join("")).join("/")}Nt.removeDotSegments=e;function t(n,o){let a=o+1;o>=0?n[o+1]==="/"&&n[o+2]==="/"&&(a=o+3):n[0]==="/"&&n[1]==="/"&&(a=2);const s=n.indexOf("/",a);if(s<0)return n;const d=n.substr(0,s),l=n.substr(s);return d+e(l)}Nt.removeDotSegmentsOfPath=t;function i(n){return!n||n==="#"||n==="?"||n==="/"}return Nt}var nl;function cp(){return nl||(nl=1,function(r){var e=er&&er.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return n[o]}})}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=er&&er.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(dp(),r)}(er)),er}var tr={},Qn={},ol;function up(){return ol||(ol=1,function(r){/**
302
+ `];Ii([Ee({type:Boolean,reflect:!0})],ur.prototype,"open",2);Ii([Ee({type:Boolean})],ur.prototype,"closable",2);Ii([Ee()],ur.prototype,"title",2);Ii([ht("#dialog")],ur.prototype,"dialogElement",2);ur=Ii([Xt("rokit-dialog")],ur);class tn extends HTMLElement{constructor(e,t,i,n){if(super(),this.template=new Gu(i.store.getQuads(e,null,null,null),t,i),this.container=this,this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const o=new it;o.classList.add("collapsible","shacl-group"),o.open=i.attributes.collapse==="open",o.label=this.template.label,this.container=o}if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),i.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let o=[];n&&(t.linked?o=i.store.getQuads(n,this.template.path,null,null):o=i.store.getQuads(n,this.template.path,null,At));let a=!1;for(const s of o)this.isValueValid(s.object)&&(this.addPropertyInstance(s.object),this.template.hasValue&&s.object.equals(this.template.hasValue)&&(a=!0));i.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}i.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof it&&(i.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const i=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let n=!1;if(e){const o=zu(i,e,this.template.config);o.length&&(t=Xi(this.template.clone().merge(o),e,!0),n=!0)}n||(t=uc(i,this,this.template.config),Ac(t,""))}else{let i=!1;if(e&&!(e instanceof ct)){const n=this.getRdfClassToLinkOrCreate();n&&this.template.config.store.countQuads(e,tt,n,At)===0&&(i=!0)}t=Xi(this.template,e,void 0,i||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const i=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",i)}toRDF(e,t){for(const i of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const n=Re.namedNode(i.dataset.path);if(i.firstChild instanceof Vt){const o=i.firstChild.toRDF(e);e.addQuad(t,n,o,this.template.config.valuesGraphId)}else for(const o of i.querySelectorAll(":scope > .editor")){const a=Ku(o);a&&e.addQuad(t,n,a,this.template.config.valuesGraphId)}}}getRdfClassToLinkOrCreate(){if(this.template.class&&this.template.node)return this.template.class;for(const e of this.template.extendedShapes){const t=this.template.config.store.getObjects(e,Rr,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const i=this.template.config.store.getObjects(t,Rr,null);for(const n of i)if(this.template.config.store.countQuads(e,tt,n,null)>0)return!0}return!1}createAddButton(){const e=new Ge;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,e.classList.add("add-button");let t=[],i=this.getRdfClassToLinkOrCreate();if(i&&(t=Ra(i,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",n=>{e.blur();const o=this.addPropertyInstance();o.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{Bu(o),o.classList.remove("fadeIn")},200)});else{const n=document.createElement("ul"),o=document.createElement("li");o.innerHTML="&#xFF0B; Create new "+this.template.label+"...",o.dataset.value="new",o.classList.add("large"),n.appendChild(o);const a=document.createElement("li");a.classList.add("divider"),n.appendChild(a);const s=document.createElement("li");s.classList.add("header"),s.innerText="Or link existing:",n.appendChild(s);for(const d of t){const l=document.createElement("li"),c=typeof d.value=="string"?d.value:d.value.value;l.innerText=d.label?d.label:c,l.dataset.value=JSON.stringify(d.value),n.appendChild(l)}e.appendChild(n),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const d=JSON.parse(e.value);this.container.insertBefore(Xi(this.template,d,!0,!0),e)}e.value=""})}return e}}function Xi(r,e,t=!1,i=!1){let n;if(r.extendedShapes.length){n=document.createElement("div"),n.classList.add("property-instance");for(const o of r.extendedShapes)n.appendChild(new Vt(o,r.config,e,r.parent,r.nodeKind,r.label,i))}else{const o=ef(r.path,r.datatype?.value);o?r.config.editMode&&!i?n=o.createEditor(r,e):n=o.createViewer(r,e):n=Xu(r,e||null,r.config.editMode&&!i),n.classList.add("property-instance"),i&&n.classList.add("linked")}return r.config.editMode&&Ac(n,r.label,t),n.dataset.path=r.path,n}function Ac(r,e,t=!1){const i=new Tr;i.classList.add("remove-button","clear"),i.title="Remove "+e,i.dense=!0,i.icon=!0,i.addEventListener("click",n=>{r.classList.remove("fadeIn"),r.classList.add("fadeOut"),setTimeout(()=>{const o=r.parentElement;r.remove(),o?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&i.classList.add("persistent"),r.appendChild(i)}window.customElements.define("shacl-property",tn);function np(r,e){let t=r;const i=e.store.getQuads(r,null,null,null),n=mi(i,"label",_a,e.languages);n&&(t=n);let o;if(e.attributes.collapse!==null)o=new it,o.classList.add("collapsible"),o.open=e.attributes.collapse==="open",o.label=t;else{o=document.createElement("div");const s=document.createElement("h1");s.innerText=t,o.appendChild(s)}o.dataset.subject=r,o.classList.add("shacl-group");const a=mi(i,"order");return a&&(o.style.order=a),o}const Je=[];for(let r=0;r<256;++r)Je.push((r+256).toString(16).slice(1));function op(r,e=0){return(Je[r[e+0]]+Je[r[e+1]]+Je[r[e+2]]+Je[r[e+3]]+"-"+Je[r[e+4]]+Je[r[e+5]]+"-"+Je[r[e+6]]+Je[r[e+7]]+"-"+Je[r[e+8]]+Je[r[e+9]]+"-"+Je[r[e+10]]+Je[r[e+11]]+Je[r[e+12]]+Je[r[e+13]]+Je[r[e+14]]+Je[r[e+15]]).toLowerCase()}let Xn;const ap=new Uint8Array(16);function sp(){if(!Xn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xn=crypto.getRandomValues.bind(crypto)}return Xn(ap)}const lp=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tl={randomUUID:lp};function rl(r,e,t){if(tl.randomUUID&&!r)return tl.randomUUID();r=r||{};const i=r.random??r.rng?.()??sp();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,op(i)}class Vt extends HTMLElement{constructor(e,t,i,n,o,a,s){super(),this.owlImports=[],this.parent=n,this.config=t,this.shaclSubject=e,this.linked=s||!1;let d=i;if(!d){if(!o){const c=t.store.getObjects(e,`${_e}nodeKind`,null);c.length&&(o=c[0])}o===void 0&&t.attributes.valuesNamespace||o?.value===`${_e}IRI`?d=Re.namedNode(t.attributes.valuesNamespace+rl()):d=Re.blankNode(rl())}this.nodeId=d;const l=JSON.stringify([e,i]);if(i&&t.renderedNodes.has(l)){a=a||"Link";const c=document.createElement("label");c.innerText=a,c.classList.add("linked"),this.appendChild(c);const u=document.createElement("a");let v=i.termType==="BlankNode"?"_:"+i.value:i.value;u.innerText=v,u.classList.add("ref-link"),u.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${v}']`)?.scrollIntoView()},this.appendChild(u),this.style.flexDirection="row"}else{if(i&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const c=document.createElement("div");c.innerText=`id: ${this.nodeId.id}`,c.classList.add("node-id-display"),this.appendChild(c)}for(const c of t.store.getQuads(e,Ea,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case Yi.id:this.addPropertyInstance(c.object,t,i);break;case`${_e}and`:const u=t.lists[c.object.value];if(u?.length)for(const v of u)this.prepend(new Vt(v,t,i,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case $u.id:this.prepend(new Vt(c.object,t,i,this));break;case`${_e}targetClass`:this.targetClass=c.object;break;case`${_e}or`:this.tryResolve(c.object,i,t);break;case`${_e}xone`:this.tryResolve(c.object,i,t);break}if(a){const c=document.createElement("h1");c.innerText=a,this.prepend(c)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const i of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))i.toRDF(e,t);this.targetClass&&e.addQuad(t,tt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Re.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,i){let n=this;const o=t.store.getQuads(e,`${_e}group`,null,null);if(o.length>0){const s=o[0].object.value;if(t.groups.indexOf(s)>-1){let d=this.querySelector(`:scope > .shacl-group[data-subject='${s}']`);d||(d=np(s,t),this.appendChild(d)),n=d}else console.warn("ignoring unknown group reference",o[0],"existing groups:",t.groups)}const a=new tn(e,this,t,i);a.childElementCount>0&&n.appendChild(a)}tryResolve(e,t,i){const n=i.lists[e.value];if(n?.length){let o=!1;if(t){const a=Uu(n,t,i);if(a.length){for(const s of a)this.addPropertyInstance(s,i,t);o=!0}}o||this.appendChild(uc(n,this,i))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",i.lists)}}window.customElements.define("shacl-node",Vt);var Yt={},Zt={},er={},Nt={},il;function dp(){if(il)return Nt;il=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.removeDotSegmentsOfPath=Nt.removeDotSegments=Nt.resolve=void 0;function r(n,o){o=o||"";const a=o.indexOf("#");if(a>0&&(o=o.substr(0,a)),!n.length){if(o.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${o}' for value '${n}'`);return o}if(n.startsWith("?")){const g=o.indexOf("?");return g>0&&(o=o.substr(0,g)),o+n}if(n.startsWith("#"))return o+n;if(!o.length){const g=n.indexOf(":");if(g<0)throw new Error(`Found invalid relative IRI '${n}' for a missing baseIRI`);return t(n,g)}const s=n.indexOf(":");if(s>=0)return t(n,s);const d=o.indexOf(":");if(d<0)throw new Error(`Found invalid baseIRI '${o}' for value '${n}'`);const l=o.substr(0,d+1);if(n.indexOf("//")===0)return l+t(n,s);let c;if(o.indexOf("//",d)===d+1){if(c=o.indexOf("/",d+3),c<0)return o.length>d+3?o+"/"+t(n,s):l+t(n,s)}else if(c=o.indexOf("/",d+1),c<0)return l+t(n,s);if(n.indexOf("/")===0)return o.substr(0,c)+e(n);let u=o.substr(c);const v=u.lastIndexOf("/");return v>=0&&v<u.length-1&&(u=u.substr(0,v+1),n[0]==="."&&n[1]!=="."&&n[1]!=="/"&&n[2]&&(n=n.substr(1))),n=u+n,n=e(n),o.substr(0,c)+n}Nt.resolve=r;function e(n){const o=[];let a=0;for(;a<n.length;)switch(n[a]){case"/":if(n[a+1]===".")if(n[a+2]==="."){if(!i(n[a+3])){o.push([]),a++;break}o.pop(),n[a+3]||o.push([]),a+=3}else{if(!i(n[a+2])){o.push([]),a++;break}n[a+2]||o.push([]),a+=2}else o.push([]),a++;break;case"#":case"?":o.length||o.push([]),o[o.length-1].push(n.substr(a)),a=n.length;break;default:o.length||o.push([]),o[o.length-1].push(n[a]),a++;break}return"/"+o.map(s=>s.join("")).join("/")}Nt.removeDotSegments=e;function t(n,o){let a=o+1;o>=0?n[o+1]==="/"&&n[o+2]==="/"&&(a=o+3):n[0]==="/"&&n[1]==="/"&&(a=2);const s=n.indexOf("/",a);if(s<0)return n;const d=n.substr(0,s),l=n.substr(s);return d+e(l)}Nt.removeDotSegmentsOfPath=t;function i(n){return!n||n==="#"||n==="?"||n==="/"}return Nt}var nl;function cp(){return nl||(nl=1,function(r){var e=er&&er.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return n[o]}})}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=er&&er.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(dp(),r)}(er)),er}var tr={},Qn={},ol;function up(){return ol||(ol=1,function(r){/**
303
303
  * Character classes and associated utilities for the 5th edition of XML 1.0.
304
304
  *
305
305
  * @author Louis-Dominique Dubeau
@@ -388,7 +388,7 @@ if("@preserve"in f)return f["@preserve"][0];if(e.isValue(f))return f;if(e.isList
388
388
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
389
389
  */var Fo,od;function Hp(){if(od)return Fo;od=1;const r=Ma(),e=Ap(),t=ft(),i=Op(),n=t.IdentifierIssuer,o=bt(),a=zc(),s=Cp(),{expand:d}=$p(),{flatten:l}=Fp(),{fromRDF:c}=Pp(),{toRDF:u}=Bp(),{frameMergedOrDefault:v,cleanupNull:g}=qp(),{isArray:y,isObject:k,isString:x}=dt(),{isSubjectReference:_}=Ft(),{expandIri:E,getInitialContext:m,process:f,processingMode:b}=fr(),{compact:R,compactIri:L}=zp(),{createNodeMap:T,createMergedNodeMap:B,mergeNodeMaps:I}=bn(),{logEventHandler:$,logWarningEventHandler:q,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:te,strictEventHandler:N,unhandledEventHandler:Z}=Ni(),F=function(w){const U={},X=new a({max:100});w.compact=async function(H,G,W){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new o("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(H===null)return null;W=de(W,{base:x(H)?H:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new n("_:b"),contextResolver:new i({sharedCache:X})}),W.link&&(W.skipExpansion=!0),W.compactToRelative||delete W.base;let z;W.skipExpansion?z=H:z=await w.expand(H,W);const ee=await w.processContext(m(W),G,W);let re=await R({activeCtx:ee,element:z,options:W});W.compactArrays&&!W.graph&&y(re)?re.length===1?re=re[0]:re.length===0&&(re={}):W.graph&&k(re)&&(re=[re]),k(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),y(G)||(G=[G]);const pe=G;G=[];for(let O=0;O<pe.length;++O)(!k(pe[O])||Object.keys(pe[O]).length>0)&&G.push(pe[O]);const be=G.length>0;if(G.length===1&&(G=G[0]),y(re)){const O=L({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),V=re;re={},be&&(re["@context"]=G),re[O]=V}else if(k(re)&&be){const O=re;re={"@context":G};for(const V in O)re[V]=O[V]}return re},w.expand=async function(H,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=de(G,{keepFreeFloatingNodes:!1,contextResolver:new i({sharedCache:X})});const W={},z=[];if("expandContext"in G){const be=t.clone(G.expandContext);k(be)&&"@context"in be?W.expandContext=be:W.expandContext={"@context":be},z.push(W.expandContext)}let ee;if(!x(H))W.input=t.clone(H);else{const be=await w.get(H,G);ee=be.documentUrl,W.input=be.document,be.contextUrl&&(W.remoteContext={"@context":be.contextUrl},z.push(W.remoteContext))}"base"in G||(G.base=ee||"");let re=m(G);for(const be of z)re=await f({activeCtx:re,localCtx:be,options:G});let pe=await d({activeCtx:re,element:W.input,options:G});return k(pe)&&"@graph"in pe&&Object.keys(pe).length===1?pe=pe["@graph"]:pe===null&&(pe=[]),y(pe)||(pe=[pe]),pe},w.flatten=async function(H,G,W){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,W=de(W,{base:x(H)?H:"",contextResolver:new i({sharedCache:X})});const z=await w.expand(H,W),ee=l(z);return G===null?ee:(W.graph=!0,W.skipExpansion=!0,await w.compact(ee,G,W))},w.frame=async function(H,G,W){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(W=de(W,{base:x(H)?H:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new i({sharedCache:X})}),x(G)){const fe=await w.get(G,W);if(G=fe.document,fe.contextUrl){let he=G["@context"];he?y(he)?he.push(fe.contextUrl):he=[he,fe.contextUrl]:he=fe.contextUrl,G["@context"]=he}}const z=G?G["@context"]||{}:{},ee=await w.processContext(m(W),z,W);W.hasOwnProperty("omitGraph")||(W.omitGraph=b(ee,1.1)),W.hasOwnProperty("pruneBlankNodeIdentifiers")||(W.pruneBlankNodeIdentifiers=b(ee,1.1));const re=await w.expand(H,W),pe={...W};pe.isFrame=!0,pe.keepFreeFloatingNodes=!0;const be=await w.expand(G,pe),O=Object.keys(G).map(fe=>E(ee,fe,{vocab:!0}));pe.merged=!O.includes("@graph"),pe.is11=b(ee,1.1);const V=v(re,be,pe);pe.graph=!W.omitGraph,pe.skipExpansion=!0,pe.link={},pe.framing=!0;let oe=await w.compact(V,z,pe);return pe.link={},oe=g(oe,pe),oe},w.link=async function(H,G,W){const z={};return G&&(z["@context"]=G),z["@embed"]="@link",w.frame(H,z,W)},w.normalize=w.canonize=async function(H,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=de(G,{base:x(H)?H:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new i({sharedCache:X})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new o("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=s.parse(H);return r.canonize(ee,G)}const W={...G};delete W.format,W.produceGeneralizedRdf=!1;const z=await w.toRDF(H,W);return r.canonize(z,G)},w.fromRDF=async function(H,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=de(G,{format:x(H)?"application/n-quads":void 0});const{format:W}=G;let{rdfParser:z}=G;if(W){if(z=z||U[W],!z)throw new o("Unknown input format.","jsonld.UnknownFormat",{format:W})}else z=()=>H;const ee=await z(H);return c(ee,G)},w.toRDF=async function(H,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=de(G,{base:x(H)?H:"",skipExpansion:!1,contextResolver:new i({sharedCache:X})});let W;G.skipExpansion?W=H:W=await w.expand(H,G);const z=u(W,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return s.serialize(z);throw new o("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return z},w.createNodeMap=async function(H,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=de(G,{base:x(H)?H:"",contextResolver:new i({sharedCache:X})});const W=await w.expand(H,G);return B(W,G)},w.merge=async function(H,G,W){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!y(H))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,W=de(W,{contextResolver:new i({sharedCache:X})});const z=await Promise.all(H.map(fe=>{const he={...W};return w.expand(fe,he)}));let ee=!0;"mergeNodes"in W&&(ee=W.mergeNodes);const re=W.issuer||new n("_:b"),pe={"@default":{}};for(let fe=0;fe<z.length;++fe){const he=t.relabelBlankNodes(z[fe],{issuer:new n("_:b"+fe+"-")}),me=ee||fe===0?pe:{"@default":{}};if(T(he,me,"@default",re),me!==pe)for(const J in me){const ce=me[J];if(!(J in pe)){pe[J]=ce;continue}const ge=pe[J];for(const le in ce)le in ge||(ge[le]=ce[le])}}const be=I(pe),O=[],V=Object.keys(be).sort();for(let fe=0;fe<V.length;++fe){const he=be[V[fe]];_(he)||O.push(he)}return G===null?O:(W.graph=!0,W.skipExpansion=!0,await w.compact(O,G,W))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:H=>w._documentLoader=H}),w.documentLoader=async H=>{throw new o("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:H})},w.get=async function(H,G){let W;typeof G.documentLoader=="function"?W=G.documentLoader:W=w.documentLoader;const z=await W(H);try{if(!z.document)throw new o("No remote document found at the given URL.","jsonld.NullRemoteDocument");x(z.document)&&(z.document=JSON.parse(z.document))}catch(ee){throw new o("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:z})}return z},w.processContext=async function(H,G,W){return W=de(W,{base:"",contextResolver:new i({sharedCache:X})}),G===null?m(W):(G=t.clone(G),k(G)&&"@context"in G||(G={"@context":G}),f({activeCtx:H,localCtx:G,options:W}))},w.getContextValue=fr().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(H){if(!(H in w.documentLoaders))throw new o('Unknown document loader type: "'+H+'"',"jsonld.UnknownDocumentLoader",{type:H});w.documentLoader=w.documentLoaders[H].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(H,G){U[H]=G},w.unregisterRDFParser=function(H){delete U[H]},w.registerRDFParser("application/n-quads",s.parse),w.registerRDFParser("application/nquads",s.parse),w.url=Jt(),w.logEventHandler=$,w.logWarningEventHandler=q,w.safeEventHandler=A,w.setDefaultEventHandler=j,w.strictEventHandler=N,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=qc(),w.JsonLdProcessor=Up()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function de(H,{documentLoader:G=w.documentLoader,...W}){if(H&&"compactionMap"in H)throw new o('"compactionMap" not supported.',"jsonld.OptionsError");if(H&&"expansionMap"in H)throw new o('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},W,H,{eventHandler:te({options:H})})}return w},Y=function(){return F(function(){return Y()})};return F(Y),Fo=Y,Fo}var Gp=Hp();const Po={},Mo={};class Vp{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[],this.config.prefixes={};const e=[],t=new et;if(e.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",t,bi)),e.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,At)),await Promise.all(e),t.countQuads(null,null,null,bi)===0&&this.config.attributes.valuesSubject){const i=[...t.getObjects(this.config.attributes.valuesSubject,aa,At)],n=[];for(const o of i){const a=this.toURL(o.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),n.push(this.importRDF(this.fetchRDF(a),t,bi)))}try{await Promise.allSettled(n)}catch(o){console.warn(o)}}this.config.store=t}async importRDF(e,t,i){const n=async o=>{const a=[];await new Promise((s,d)=>{const l=ad(o)==="xml"?new xp.RdfXmlParser:new Nu;l.on("data",c=>{if(t.add(new on(c.subject,c.predicate,c.object,i)),this.config.attributes.ignoreOwlImports===null&&Ea.equals(c.predicate)){const u=this.toURL(c.object.value);u&&this.loadedExternalUrls.indexOf(u)<0&&(this.loadedExternalUrls.push(u),a.push(this.importRDF(this.fetchRDF(u),t,Re.namedNode(u))))}if(this.config.classInstanceProvider&&(Sa.equals(c.predicate)||Rr.equals(c.predicate))){const u=c.object.value;if(this.loadedClasses.indexOf(u)<0){let v;u in Mo?v=Mo[u]:(v=this.config.classInstanceProvider(u),Mo[u]=v),this.loadedClasses.push(u),a.push(this.importRDF(v,t,i))}}}).on("error",c=>{console.warn("failed parsing graph",i,c.message),d(c)}).on("prefix",(c,u)=>{c&&(this.config.prefixes[c]=u)}).on("end",()=>{s(null)}),l.write(o),l.end()});try{await Promise.allSettled(a)}catch(s){console.warn(s)}};if(e instanceof Promise&&(e=await e),e){if(ad(e)==="json")try{e=await Gp.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(o){console.error(o)}await n(e)}}toURL(e){if(la(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const i=this.config.prefixes[t[0]];if(i&&(e=e.replace(`${t[0]}:`,i),la(e)))return e}}return null}async fetchRDF(e){if(e in Po)return Po[e];let t=e;this.config.attributes.proxy&&(t=this.config.attributes.proxy+encodeURIComponent(e));const i=fetch(t,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(n=>n.text());return Po[e]=i,i}}function ad(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}class Bo{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.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class sd{constructor(e,t){this.attributes=new Bo,this.loader=new Vp(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new et,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(i=>i.length>2?[i.toLocaleLowerCase(),i.substring(0,2)]:i)),""]}updateAttributes(e){const t=new Bo;if(Object.keys(t).forEach(i=>{const n=e.dataset[i];n!==void 0&&(t[i]=n)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const i=this.languages.indexOf(t.language);i>-1&&this.languages.splice(i,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Re.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Bo;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,i=>"-"+i.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=qu(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${_e}PropertyGroup`,null)}}function Wp(r){return"_:"+r.value}function Xp(r,e){return[...r].map(t=>e(t)).join(`
390
390
  `)+`
391
- `}function Qp(){return""}function Uc(r){return"<"+r.value+">"}const Jp=/["\\\\\n\r]/,Kp=/["\\\\\n\r]/g,Yp={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Zp(r){return Yp[r]}function eh(r){return Jp.test(r)?r.replace(Kp,Zp):r}function th(r){const e=eh(r.value);return r.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':r.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+r.language:'"'+e+'"^^'+Uc(r.datatype)}function rh(r,e){const t=e(r.subject),i=e(r.predicate),n=e(r.object),o=e(r.graph);return`${t} ${i} ${n} ${o?o+" ":""}.`}function ih(r){return"?"+r.value}function st(r){if(!r)return null;if(r.termType==="BlankNode")return Wp(r);if(r.termType==="DefaultGraph")return Qp();if(r.termType==="Literal")return th(r);if(r.termType==="NamedNode")return Uc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return rh(r,st);if(r.termType==="Variable")return ih(r);if(r[Symbol.iterator])return Xp(r,st);throw new Error(`unknown termType ${r.termType}`)}class Cr{constructor(e){if(this.index=new Map,e)for(const[t,i]of e)this.set(t,i)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(st(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const i of this.entries())e.call(t,i[1],i[0],this)}get(e){const t=this.index.get(st(e));return t&&t.value}has(e){return this.index.has(st(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const i=st(e);return this.index.set(i,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class ld{constructor({dataset:e,end:t,quad:i,start:n}){this.dataset=e,this.end=t,this.quad=i,this.start=n}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function dd(r){try{return st(r)}catch{return null}}class pt{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=st(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(dd(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(dd(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Hc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Hc.prototype.termType="BlankNode";class qa{equals(e){return!!e&&e.termType===this.termType}}qa.prototype.termType="DefaultGraph";qa.prototype.value="";function cd(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),i=r.fromTerm(e.predicate),n=r.fromTerm(e.object),o=r.fromTerm(e.graph);return r.quad(t,i,n,o)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Ji{constructor(e,t,i,n=""){this.value=e,this.language=t,this.datatype=i,this.direction=n}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}}Ji.prototype.termType="Literal";class Ti{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Ti.prototype.termType="NamedNode";class za{constructor(e,t,i,n){this.subject=e,this.predicate=t,this.object=i,this.graph=n}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)}}za.prototype.termType="Quad";za.prototype.value="";class Gc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Gc.prototype.termType="Variable";const nh=new Ti("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),ud=new Ti("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),oh=new Ti("http://www.w3.org/2001/XMLSchema#string");class Vc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new qa}}namedNode(e){return new Ti(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Hc(e)}literal(e,t){return typeof t=="string"?new Ji(e,t,ud):typeof t?.language=="string"?new Ji(e,t.language,t.direction?nh:ud,t.direction):new Ji(e,"",t||oh)}variable(e){return new Gc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,i,n=this.defaultGraph()){return new za(e,t,i,n)}fromTerm(e){return cd(this,e)}fromQuad(e){return cd(this,e)}}Vc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ua=new Vc,ah={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function mt(r,{factory:e=Ua}={}){const t=(i="")=>e.namedNode(`${r}${i.raw||i}`);return typeof Proxy>"u"?t:new Proxy(t,ah)}mt("http://www.w3.org/2001/XMLSchema#");const _t=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");mt("http://www.w3.org/2000/01/rdf-schema#");class $e{static add({ptr:e,start:t,end:i,subjects:n=[null],predicates:o=[null],objects:a=[null],graphs:s,callback:d}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};d&&(l=c=>{d(new ld({dataset:e.dataset,start:t,end:i,quad:c}))});for(const c of n)for(const u of o)for(const v of a)for(const g of s){const y={subject:c,predicate:u,object:v,graph:g};y[t]=e.term;const k=e.factory.quad(y.subject,y.predicate,y.object,y.graph);e.dataset.add(k),l(k)}return e}static addList({ptr:e,predicates:t,items:i,graphs:n}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const o of t)for(const a of n){const s=i.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,o,s[0]||_t.nil,a));for(let d=0;d<s.length;d++)e.dataset.add(e.factory.quad(s[d],_t.first,i[d],a)),e.dataset.add(e.factory.quad(s[d],_t.rest,s[d+1]||_t.nil,a))}return e}static delete({ptr:e,start:t,subjects:i=[null],predicates:n=[null],objects:o=[null]}){for(const a of i)for(const s of n)for(const d of o){const l={subject:a,predicate:s,object:d};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const u of c)e.dataset.delete(u)}return e}static deleteList({ptr:e,predicates:t}){const i=[];for(const n of t)for(const o of e.dataset.match(e.term,n)){let a=o.object;for(i.push(o);!_t.nil.equals(a);){a=i[i.length-1].object;const s=e.dataset.match(a);if(s.size===0)break;for(const d of s)i.push(d)}}for(const n of i)e.dataset.delete(n);return e}static execute({ptr:e,operation:t="traverse",quantifier:i,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,items:c,callback:u}={}){if(t==="add")return $e.add({ptr:e,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,callback:u});if(t==="addList")return $e.addList({ptr:e,predicates:s,items:c,graphs:l});if(t==="delete")return $e.delete({ptr:e,start:n,subjects:a,predicates:s,objects:d});if(t==="deleteList")return $e.deleteList({ptr:e,predicates:s});if(t==="isList")return $e.isList({ptr:e});if(t==="list")return $e.list({ptr:e});if(t==="traverse")return $e.traverse({ptr:e,quantifier:i,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(_t.nil.equals(e.term)||$e.traverse({ptr:e,predicates:[_t.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(_t.nil);){const t=e.out([_t.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const i=e.out([_t.rest]);if(i.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=i[0]}}}}static traverse({ptr:e,quantifier:t="one",start:i="subject",end:n="object",subjects:o=[null],predicates:a=[null],objects:s=[null],graphs:d=[null],callback:l}){if(t==="one")return $e.traverseOne({ptr:e,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,callback:l});if(t==="oneOrMore"){const c=$e.traverse({ptr:e,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l});return $e.traverseMore({ptrs:c,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l})}if(t==="zeroOrMore")return $e.traverseMore({ptrs:[e],end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l});if(t==="zeroOrOne")return[e,...$e.traverse({ptr:e,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d}={}){let l=[...e],c,u;do{c=[];for(const v of e)c=[...c,...$e.traverseOne({ptr:v,end:t,start:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d})];u&&(c=c.filter(v=>!u.has(v.term))),e=c,l=[...l,...c],u=new pt(l.map(v=>v.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d=(l,c)=>c.extend(l)}={}){const l=[];for(const c of n)for(const u of o)for(const v of a)for(const g of s){const y={subject:c,predicate:u,object:v,graph:g};y[t]=e.term;for(const k of e.dataset.match(y.subject,y.predicate,y.object,y.graph))l.push(d(new ld({dataset:e.dataset,end:i,quad:k,start:t}),e))}return l}}function fd(r,e){return e?t=>e(r.extend(t)):()=>{}}class pd{constructor({dataset:e,edges:t=[],factory:i,graph:n,term:o}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof o>"u")throw new Error("edges or term must be given");if(t.length>0&&o)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=i,this._graph=n,t.length===0&&(this._term=o)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,i){return $e.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:fd(this,i)})}addList(e,t){return $e.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,i){return $e.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:fd(this,i)})}deleteIn(e,t){return $e.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return $e.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return $e.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,items:l,callback:c}){return $e.execute({ptr:this,operation:e,quantifier:t,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return $e.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return $e.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return $e.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return $e.isList({ptr:this})}list(){return $e.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return $e.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function hd(r,e){return r?r.equals(e):r===e}function sh(r,e){return!(r.dataset!==e.dataset||!hd(r.graph,e.graph)||!hd(r.term,e.term))}function bd(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class rn{constructor({dataset:e,factory:t,ptrs:i,terms:n,graphs:o}){if(this.factory=t,i)this.ptrs=[...i];else{this.ptrs=[];for(const a of n||[null])for(const s of o||[null])this.ptrs.push(new pd({dataset:e,factory:t,graph:s,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new pt(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,i){const n=bd(this,i);for(const o of this.ptrs)o.addIn(e,t,n);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const i of this.ptrs)i.addList(e,t);return this}addOut(e,t,i){const n=bd(this,i);for(const o of this.ptrs)o.addOut(e,t,n);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const i of this.ptrs)i.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const i of this.ptrs)i.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,i)=>(t.some(n=>sh(n,i))||t.push(i.trim()),t),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(const i of e)t=t.execute(i);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const i of e)yield t.clone({ptrs:[i]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,i=[...e].map(n=>new pd({dataset:t,factory:this.factory,term:n}));return this.clone({ptrs:i})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}mt("http://www.w3.org/2002/07/owl#");const pr=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),lh=mt("http://www.w3.org/2000/01/rdf-schema#"),ae=mt("http://www.w3.org/ns/shacl#"),pa=mt("https://schemas.link/shacl-next#"),Ha=mt("http://www.w3.org/2001/XMLSchema#");function dh(r){return r?`{${[...r.quads()].map(e=>st(e)).join(" ")}}`:"{}"}function ch(r){return r?`{${r.map(e=>dh(e)).join(" ")}}`:"{}"}var qo,md;function uh(){if(md)return qo;md=1;var r=/\s/;function e(t){for(var i=t.length;i--&&r.test(t.charAt(i)););return i}return qo=e,qo}var zo,gd;function fh(){if(gd)return zo;gd=1;var r=uh(),e=/^\s+/;function t(i){return i&&i.slice(0,r(i)+1).replace(e,"")}return zo=t,zo}var Uo,vd;function ph(){if(vd)return Uo;vd=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Uo=r,Uo}var Ho,yd;function hh(){if(yd)return Ho;yd=1;var r=typeof Er=="object"&&Er&&Er.Object===Object&&Er;return Ho=r,Ho}var Go,wd;function bh(){if(wd)return Go;wd=1;var r=hh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Go=t,Go}var Vo,xd;function Wc(){if(xd)return Vo;xd=1;var r=bh(),e=r.Symbol;return Vo=e,Vo}var Wo,_d;function mh(){if(_d)return Wo;_d=1;var r=Wc(),e=Object.prototype,t=e.hasOwnProperty,i=e.toString,n=r?r.toStringTag:void 0;function o(a){var s=t.call(a,n),d=a[n];try{a[n]=void 0;var l=!0}catch{}var c=i.call(a);return l&&(s?a[n]=d:delete a[n]),c}return Wo=o,Wo}var Xo,kd;function gh(){if(kd)return Xo;kd=1;var r=Object.prototype,e=r.toString;function t(i){return e.call(i)}return Xo=t,Xo}var Qo,Ed;function vh(){if(Ed)return Qo;Ed=1;var r=Wc(),e=mh(),t=gh(),i="[object Null]",n="[object Undefined]",o=r?r.toStringTag:void 0;function a(s){return s==null?s===void 0?n:i:o&&o in Object(s)?e(s):t(s)}return Qo=a,Qo}var Jo,Sd;function yh(){if(Sd)return Jo;Sd=1;function r(e){return e!=null&&typeof e=="object"}return Jo=r,Jo}var Ko,Rd;function wh(){if(Rd)return Ko;Rd=1;var r=vh(),e=yh(),t="[object Symbol]";function i(n){return typeof n=="symbol"||e(n)&&r(n)==t}return Ko=i,Ko}var Yo,Id;function xh(){if(Id)return Yo;Id=1;var r=fh(),e=ph(),t=wh(),i=NaN,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function d(l){if(typeof l=="number")return l;if(t(l))return i;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var u=o.test(l);return u||a.test(l)?s(l.slice(2),u?2:8):n.test(l)?i:+l}return Yo=d,Yo}var Zo,Nd;function _h(){if(Nd)return Zo;Nd=1;var r=xh(),e=1/0,t=17976931348623157e292;function i(n){if(!n)return n===0?n:0;if(n=r(n),n===e||n===-e){var o=n<0?-1:1;return o*t}return n===n?n:0}return Zo=i,Zo}var ea,Td;function kh(){if(Td)return ea;Td=1;var r=_h();function e(t){var i=r(t),n=i%1;return i===i?n?i-n:i:0}return ea=e,ea}var ta,Ad;function Eh(){if(Ad)return ta;Ad=1;var r=kh(),e="Expected a function";function t(i,n){var o;if(typeof n!="function")throw new TypeError(e);return i=r(i),function(){return--i>0&&(o=n.apply(this,arguments)),i<=1&&(n=void 0),o}}return ta=t,ta}var ra,jd;function Sh(){if(jd)return ra;jd=1;var r=Eh();function e(t){return r(2,t)}return ra=e,ra}var Rh=Sh();const yt=tu(Rh);let Dd=class{constructor({details:e,factory:t,options:i,results:n=[]}={}){this.details=e,this.factory=t,this.options=i,this.results=n,this._conforms=yt(()=>!this.results.some(o=>o.severity.equals(ae.Info)||o.severity.equals(ae.Violation)||o.severity.equals(ae.Warning))),this._ptr=yt(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new rn({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([pr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ha.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],i=>{t.build(i,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Ih(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&n.termType&&(n=st(n)),t.replace(`{$${i}}`,n).replace(`{?${i}}`,n)),r)}let Nh=class{constructor({args:e={},constraintComponent:t,factory:i,focusNode:n,message:o=[],path:a,results:s=[],severity:d,shape:l,source:c=[],value:u,valuePaths:v=[]}={}){this.args=e,this.constraintComponent=t,this.factory=i,this.focusNode=n,this.path=a||l.path,this.results=s,this.severity=d,this.shape=l,this.source=c,this.value=u,this.valuePaths=v,this._message=yt(()=>(this.shape.message.length>0&&(o=this.shape.message),o.length===0&&(o=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),o.map(g=>i.literal(Ih(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([pr.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const i=n=>{if(n.quantifier==="one")return n.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],n.predicates):n.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[n.predicates[0]]):e.node([n.predicates[0]]);if(n.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[n.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],i(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(n=>i(n).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const n of this.results)e.addOut([ae.detail],[this.factory.blankNode()],o=>{n.build(o,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Ga{constructor({factory:e,focusNode:t,options:i={debug:!1,details:!1},processed:n=new Set,report:o=new Dd({factory:e,options:i}),results:a=new Map,shape:s,value:d,valueOrNode:l,valuePaths:c,values:u}={}){this.factory=e,this.focusNode=t,this.options=i,this.processed=n,this.report=o,this.results=a,this.shape=s,this.value=d,this.valuePaths=c,this.valueOrNode=l,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:i=this.shape,value:n=this.value,valueOrNode:o=this.valueOrNode,valuePaths:a=this.valuePaths,values:s=this.values}={}){return new Ga({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Dd({factory:this.factory,options:this.options}):this.report,results:this.results,shape:i,value:n,valueOrNode:o,valuePaths:a,values:s})}id({shape:e=this.shape}={}){return`${st(e.ptr.term)} - ${st(this.focusNode.term)} - ${ch(this.valuePaths)}`}result(e){const t=new Nh({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),i=this.id();this.results.has(i)?this.results.get(i).add(t):this.results.set(i,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:pa.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:pa.Trace,constraintComponent:e,...t})}test(e,t,i){e?this.debug(t,i):this.violation(t,i)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ae.Violation,...t})}}function Th(){return{generic:Ah()}}function Ah(){return r=>{r.trace(pa.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class jh{constructor(e){this.validations=new Cr(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let i=!1;const n=new Set;for(const o of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(o.term);a&&(n.add(a),o.term.equals(ae.property)&&(i=!0))}return t&&e.isPropertyShape&&!i&&n.add(Th),[...n].map(o=>o(e)).filter(Boolean)}}var nr={},or={},ni={},oi={},Ld;function jr(){if(Ld)return oi;Ld=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.Translator=void 0;let r=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,i,n){for(const o of i)this.supportedRdfDatatypes.push(o),this.fromRdfHandlers[o.value]=t;for(const o of n){let a=this.toRdfHandlers[o];a||(this.toRdfHandlers[o]=a=[]),a.push(t)}}fromRdf(t,i){const n=this.fromRdfHandlers[t.datatype.value];return n?n.fromRdf(t,i):t.value}toRdf(t,i){const n=this.toRdfHandlers[typeof t];if(n)for(const o of n){const a=o.toRdf(t,i);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return oi.Translator=r,oi}var Od;function Dh(){if(Od)return ni;Od=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.TypeHandlerBoolean=void 0;const r=jr();let e=class Xc{fromRdf(i,n){switch(i.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return n&&r.Translator.incorrectRdfDataType(i),!1}toRdf(i,{datatype:n,dataFactory:o}){return o.literal(i?"true":"false",n||o.namedNode(Xc.TYPE))}};return ni.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",ni}var ai={},Cd;function Lh(){if(Cd)return ai;Cd=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.TypeHandlerDate=void 0;const r=jr();let e=class ha{fromRdf(i,n){switch(n&&!i.value.match(ha.VALIDATORS[i.datatype.value.substr(33,i.datatype.value.length)])&&r.Translator.incorrectRdfDataType(i),i.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(i.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const o=i.value.split("-");return new Date(0,parseInt(o[0],10)-1,parseInt(o[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(i.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(i.value+"-01");default:return new Date(i.value)}}toRdf(i,{datatype:n,dataFactory:o}){if(n=n||o.namedNode(ha.TYPES[0]),!(i instanceof Date))return null;const a=i;let s;switch(n.value){case"http://www.w3.org/2001/XMLSchema#gDay":s=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":s=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":s=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":s=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":s=a.toISOString().replace(/T.*$/,"");break;default:s=a.toISOString()}return o.literal(s,n)}};return ai.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]$/},ai}var si={},$d;function Oh(){if($d)return si;$d=1,Object.defineProperty(si,"__esModule",{value:!0}),si.TypeHandlerNumberDouble=void 0;const r=jr();let e=class Qc{fromRdf(i,n){const o=parseFloat(i.value);return n&&isNaN(o)&&r.Translator.incorrectRdfDataType(i),o}toRdf(i,{datatype:n,dataFactory:o}){return n=n||o.namedNode(Qc.TYPES[0]),isNaN(i)?o.literal("NaN",n):isFinite(i)?i%1===0?null:o.literal(i.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),n):o.literal(i>0?"INF":"-INF",n)}};return si.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"],si}var li={},Fd;function Ch(){if(Fd)return li;Fd=1,Object.defineProperty(li,"__esModule",{value:!0}),li.TypeHandlerNumberInteger=void 0;const r=jr();let e=class pi{fromRdf(i,n){const o=parseInt(i.value,10);return n&&(isNaN(o)||i.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(i),o}toRdf(i,{datatype:n,dataFactory:o}){return o.literal(String(i),n||(i<=pi.MAX_INT&&i>=pi.MIN_INT?o.namedNode(pi.TYPES[0]):o.namedNode(pi.TYPES[1])))}};return li.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,li}var di={},Pd;function $h(){if(Pd)return di;Pd=1,Object.defineProperty(di,"__esModule",{value:!0}),di.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:i,dataFactory:n}){return n.literal(t,i)}};return di.TypeHandlerString=r,r.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],di}var Md;function Bd(){return Md||(Md=1,function(r){var e=or&&or.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=or&&or.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(Dh(),r),t(Lh(),r),t(Oh(),r),t(Ch(),r),t($h(),r)}(or)),or}var ia={},qd;function Fh(){return qd||(qd=1,Object.defineProperty(ia,"__esModule",{value:!0})),ia}var zd;function Ph(){return zd||(zd=1,function(r){var e=nr&&nr.__createBinding||(Object.create?function(g,y,k,x){x===void 0&&(x=k);var _=Object.getOwnPropertyDescriptor(y,k);(!_||("get"in _?!y.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return y[k]}}),Object.defineProperty(g,x,_)}:function(g,y,k,x){x===void 0&&(x=k),g[x]=y[k]}),t=nr&&nr.__exportStar||function(g,y){for(var k in g)k!=="default"&&!Object.prototype.hasOwnProperty.call(y,k)&&e(y,g,k)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=d,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=u,r.getSupportedJavaScriptPrimitives=v;const i=$c(),n=Bd(),o=jr();t(Bd(),r),t(Fh(),r),t(jr(),r);const a=new i.DataFactory,s=new o.Translator;s.registerHandler(new n.TypeHandlerString,n.TypeHandlerString.TYPES.map(g=>a.namedNode(g)),["string"]),s.registerHandler(new n.TypeHandlerBoolean,[n.TypeHandlerBoolean.TYPE].map(g=>a.namedNode(g)),["boolean"]),s.registerHandler(new n.TypeHandlerNumberDouble,n.TypeHandlerNumberDouble.TYPES.map(g=>a.namedNode(g)),["number"]),s.registerHandler(new n.TypeHandlerNumberInteger,n.TypeHandlerNumberInteger.TYPES.map(g=>a.namedNode(g)),["number"]),s.registerHandler(new n.TypeHandlerDate,n.TypeHandlerDate.TYPES.map(g=>a.namedNode(g)),["object"]);function d(g,y){return s.fromRdf(g,y)}function l(g,y){return y&&"namedNode"in y&&(y={dataFactory:y}),y=y||{},y&&!y.dataFactory&&(y.dataFactory=a),s.toRdf(g,y)}function c(g,y){return g.termType==="Literal"?d(g,y):g.value}function u(){return s.getSupportedRdfDatatypes()}function v(){return s.getSupportedJavaScriptPrimitives()}}(nr)),nr}var Ei=Ph();function Ud(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const i=r.out([ae.oneOrMorePath]);if(i.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[i.term]};const n=r.out([ae.zeroOrMorePath]);if(n.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[n.term]};const o=r.out([ae.zeroOrOnePath]);if(o.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[o.term]}}function Mh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Ud(e)):[Ud(r)]}class Bh{constructor(e){this.shape=e,this._compiled=yt(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const i of this.compiled)i.node&&await i.node(t),i.generic&&await i.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const i=t.node(new pt(t.terms)),n=[...t].reduce((a,s)=>{const d=s.term,l=t.node([d]);return a.has(d)||a.set(d,{value:l,valuePaths:[]}),a.get(d).valuePaths.push(s),a},new Cr).values(),o=e.create({shape:this.shape,values:i});for(const a of this.compiled)a.property&&await a.property(o);for(const{value:a,valuePaths:s}of n){const d=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:s});for(const l of this.compiled)l.generic&&await l.generic(d)}}}function ba(r){const e=new pt,i=new rn({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[lh.subClassOf]});for(const n of i.ptrs)for(const{term:o}of n.nodes())e.add(o);return e}class qh{constructor(e){this.targetClass=new pt([...ba(e.hasOut([pr.type],[ae.NodeShape])),...ba(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),i=[...e.focusNode.hasOut([pr.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],n=e.focusNode.clone({ptrs:i});return n.node([...new pt(n.terms)])}}class zh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=yt(()=>{const i=this.ptr.out([ae.deactivated]).term;return i&&Ei.fromRdf(i)}),this._message=yt(()=>this.ptr.out([ae.message]).terms),this._path=yt(()=>Mh(this.ptr.out([ae.path]))),this._severity=yt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=yt(()=>new Bh(this)),this._sparql=yt(()=>this.ptr.out([ae.sparql])),this._targetResolver=yt(()=>new qh(this.ptr))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!this.path}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const i of e.results.get(t))e.report.results.push(i);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Uh(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Hh(e)}}function Hh(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Gh(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Vh(e)}}function Vh(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Wh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Xh(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function mn(r,e){return Promise.all(r.map(e))}async function Qh(r,e){for(const t of r)if(await e(t))return!0;return!1}function Jh(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Kh(e)}}function Kh(r){return async e=>{const t=await mn(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),i=t.every(n=>n.conforms);e.test(i,ae.AndConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function Yh(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Zh(e)}}function Zh(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,i=!t.conforms;e.test(i,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function eb(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tb(e)}}function tb(r){return async e=>{let t=[],i;if(e.options.debug||e.options.details){const n=await mn(r,async o=>(await o.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=n.flatMap(o=>o.results),i=n.some(o=>o.conforms)}else i=await Qh(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(i,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function rb(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:ib(e)}}function ib(r){return async e=>{const t=await mn(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),i=t.filter(n=>n.conforms).length===1;e.test(i,ae.XoneConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function nb(r){if(!Ei.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(o=>r.validator.shape(o)),i=new pt(t.filter(o=>!o.deactivated).map(o=>o.path[0].predicates[0])),n=new pt([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(o=>o.term));return{node:ob(i,n)}}function ob(r,e){return t=>{const i=t.focusNode.execute({start:"subject",end:"predicate"}).filter(n=>e.has(n.term)?!1:!r.has(n.term));if(i.ptrs.length>0)for(const n of i)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[n.term]}],value:t.focusNode.node([[...n.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function ab(r){const e=r.ptr.out([ae.hasValue]).term;return{node:sb(e),property:lb(e)}}function sb(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function lb(r){return e=>{const t=[...e.values].some(i=>r.equals(i.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function db(r){const e=new pt([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:cb(e)}}function cb(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function $r(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Hd(r)!==Hd(e))return null;const t=Ei.fromRdf(r),i=Ei.fromRdf(e);return typeof t!=typeof i?null:typeof t=="string"?t.localeCompare(i):t-i}function Hd(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function ub(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:fb(e)}}function fb(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function pb(r){const e=r.ptr.out([ae.equals]).term;return{node:hb(e),property:bb(e)}}function hb(r){return e=>{const t=e.focusNode.out([r]),i=t.filter(o=>!o.term.equals(e.focusNode.term)),n=t.terms.length!==0&&i.terms.length===0;e.test(n,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:i.terms[0]&&e.focusNode.node([i.terms[0]])||e.focusNode})}}function bb(r){return e=>{const t=new pt(e.focusNode.out([r]).terms),i=new pt(e.values.terms),n=[...i].filter(s=>!t.has(s)),o=[...t].filter(s=>!i.has(s)),a=[...n,...o];for(const s of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([s])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function mb(r){const e=r.ptr.out([ae.lessThan]).term;return{property:gb(e)}}function gb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=$r(i.term,n);o===null||o>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:i}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:i})}}}function vb(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:yb(e)}}function yb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=$r(i.term,n);o===null||o>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:i}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:i})}}}function wb(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:xb(e)}}function xb(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function _b(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:kb(e)}}function kb(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function Eb(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:Sb(e)}}function Sb(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Rb(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Ib(e)}}function Ib(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Nb(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Tb(e)}}function Tb(r){return async e=>{for(const t of r){const i=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(i.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:i.report.results,value:e.valueOrNode})}}}function Ab(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:jb(e)}}function jb(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const i of r)await i.validate(t)}}function Db(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,i=t?Ei.fromRdf(t):!1,n=r.ptr.out([ae.qualifiedMaxCount]).term,o=n?parseInt(n.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,s=a?parseInt(a.value):null;return{property:Lb(e,i,o,s)}}function Lb(r,e,t,i){return async n=>{const o=[];let a=[];e&&(a=new Set(n.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(d=>!d.term.equals(r.ptr.term)).map(d=>n.shape.validator.shape(d))));const s=(await Xh(n.values,async d=>{const l=(await r.validate(n.create({child:!0,focusNode:d}))).report;if(o.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(n.options.debug||n.options.details){const c=await mn([...a],async u=>(await u.validate(n.create({child:!0,focusNode:d}))).report);return o.push(c.flatMap(u=>u.results)),!c.every(u=>u.conforms)}else return!await Wh([...a],async c=>(await c.validate(n.create({child:!0,focusNode:d}))).report.conforms)})).length;t!==null&&n.test(s<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:o.flat()}),i!==null&&n.test(s>=i,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:i,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:o.flat()})}}function Ob(r,e){return e?e.slice(0,r.length)===r:!1}function Cb(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:$b(e)}}function $b(r){return e=>{const t=r.some(i=>Ob(i,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Fb(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:Pb(e)}}function Pb(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Mb(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Bb(e)}}function Bb(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function qb(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,i=new RegExp(e,t);return{generic:zb(e,t,i)}}function zb(r,e,t){return i=>{i.test(t.test(i.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[i.factory.literal('Value does not match pattern "{$pattern}"')],value:i.valueOrNode})}}function Ub(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:Hb()}:null}function Hb(){return r=>{const t=Object.entries(r.values.terms.reduce((i,n)=>(n.language&&(i[n.language]=(i[n.language]||0)+1),i),{})).filter(([,i])=>i>1);for(const[i]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:i},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const Ki=mt("http://www.w3.org/ns/shacl#"),Jc=mt("https://schemas.link/shacl-next#");class Dr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Ki.Info)||e.severity.equals(Ki.Violation)||e.severity.equals(Ki.Warning))}}function Gb(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&n.termType&&(n=st(n)),t.replace(`{$${i}}`,n).replace(`{?${i}}`,n)),r)}class nn{constructor({args:e={},factory:t,message:i=[],severity:n=Ki.Violation}={}){this.severity=n,this.message=i.map(o=>t.literal(Gb(o.value,e),o.language||null))}}class Va{constructor({factory:e=Ua}={}){this.factory=e}clone({factory:e}={}){return new Va({factory:e||this.factory})}validate(){return new Dr}validateSimple(){return!0}}class Fr extends Va{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const i of Array.isArray(e)?e:[e])i&&this.datatypes.push(this.factory.fromTerm(i))}clone({factory:e}={}){return new Fr({datatypes:this.datatypes,factory:e||this.factory})}}class Vb{constructor({factory:e=Ua,validations:t}={}){if(this.factory=e,this.validations=new Cr,t)for(const i of Object.values(t)){const n=i.clone({factory:this.factory});for(const o of n.datatypes)this.validations.set(o,n)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Dr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends Fr{constructor(e,t,{factory:i}={}){super({datatypes:t,factory:i}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(i=>{let n;i.test(e.value)&&(n=Jc.Debug);const o={pattern:this.factory.literal(i.toString()),this:e};return new nn({args:o,factory:this.factory,message:this.message,severity:n})});return new Dr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Wb=/^([-+]?[0-9]+)$/;class ot extends Pe{constructor(e=null,t=null,i,{factory:n}={}){super(Wb,i,{factory:n}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new ot(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Jc.Debug.equals(t[0].severity))return new Dr({results:t});const i=BigInt(e.value);if(this.minInclusive!==null&&i<this.minInclusive){const n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,o=[this.factory.literal(n)];t.push(new nn({factory:this.factory,message:o}))}if(this.maxInclusive!==null&&i>this.maxInclusive){const n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,o=[this.factory.literal(n)];t.push(new nn({factory:this.factory,message:o}))}return new Dr({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Wa extends Fr{constructor(e,t,{factory:i}={}){super({datatypes:t,factory:i}),this.values=new Set(e)}clone({factory:e}={}){return new Wa(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const i=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,n=[this.factory.literal(i)];t.push(new nn({factory:this.factory,message:n}))}return new Dr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Ne={xsd:mt("http://www.w3.org/2001/XMLSchema#")},Xb=new Fr({datatypes:Ne.xsd.anySimpleType}),Qb=new Fr({datatypes:Ne.xsd.anyAtomicType}),gn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Jb=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Kc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Xa=/^(-?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)))))$/,Yc=/^(-?([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))?)$/,Kb=/^((([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))?)$/,Yb=/^(-?([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))?)$/,Zb=/^(-?([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))?)$/,em=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(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))?)$/,rm=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,im=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,nm=/^(([0-9a-fA-F]{2})*)$/,om=/^(((([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] ?= ?=))?)$/,am=new Pe(gn,Ne.xsd.string),sm=new Wa(["1","true","0","false"],Ne.xsd.boolean),lm=new Pe(Jb,Ne.xsd.decimal),dm=new Pe(Kc,Ne.xsd.float),cm=new Pe(Kc,Ne.xsd.double),um=new Pe(Xa,Ne.xsd.duration),fm=new Pe(Yc,Ne.xsd.dateTime),pm=new Pe(Kb,Ne.xsd.time),hm=new Pe(Yb,Ne.xsd.date),bm=new Pe(Zb,Ne.xsd.gYearMonth),mm=new Pe(em,Ne.xsd.gYear),gm=new Pe(tm,Ne.xsd.gMonthDay),vm=new Pe(rm,Ne.xsd.gDay),ym=new Pe(im,Ne.xsd.gMonth),wm=new Pe(nm,Ne.xsd.hexBinary),xm=new Pe(om,Ne.xsd.base64Binary),_m=new Pe(gn,Ne.xsd.anyURI),Zc=/^([^\u000d\u000a\u0009]*)$/,km=/^([^ ]+( [^ ]+)*)*$/,Em=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Sm=/^([^DT]*)$/,Rm=/^([^YM]*[DT].*)$/,Im=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Nm=new Pe([gn,Zc],Ne.xsd.normalizedString),Tm=new Pe([gn,Zc,km],Ne.xsd.token),Am=new Pe(Em,Ne.xsd.language),jm=new ot(null,null,Ne.xsd.integer),Dm=new ot(null,"0",Ne.xsd.nonPositiveInteger),Lm=new ot(null,"-1",Ne.xsd.negativeInteger),Om=new ot("-9223372036854775808","9223372036854775807",Ne.xsd.long),Cm=new ot("-2147483648","2147483647",Ne.xsd.int),$m=new ot("-32768","32767",Ne.xsd.short),Fm=new ot("-128","127",Ne.xsd.byte),Pm=new ot("0",null,Ne.xsd.nonNegativeInteger),Mm=new ot("0","18446744073709551615",Ne.xsd.unsignedLong),Bm=new ot("0","4294967295",Ne.xsd.unsignedInt),qm=new ot("0","65535",Ne.xsd.unsignedShort),zm=new ot("0","255",Ne.xsd.unsignedByte),Um=new ot("1",null,Ne.xsd.positiveInteger),Hm=new Pe([Xa,Sm],Ne.xsd.yearMonthDuration),Gm=new Pe([Xa,Rm],Ne.xsd.dayTimeDuration),Vm=new Pe([Yc,Im],Ne.xsd.dateTimeStamp),Wm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Qb,anySimpleType:Xb,anyURI:_m,base64Binary:xm,boolean:sm,byte:Fm,date:hm,dateTime:fm,dateTimeStamp:Vm,dayTimeDuration:Gm,decimal:lm,double:cm,duration:um,float:dm,gDay:vm,gMonth:ym,gMonthDay:gm,gYear:mm,gYearMonth:bm,hexBinary:wm,int:Cm,integer:jm,language:Am,long:Om,negativeInteger:Lm,nonNegativeInteger:Pm,nonPositiveInteger:Dm,normalizedString:Nm,positiveInteger:Um,short:$m,string:am,time:pm,token:Tm,unsignedByte:zm,unsignedInt:Bm,unsignedLong:Mm,unsignedShort:qm,yearMonthDuration:Hm},Symbol.toStringTag,{value:"Module"}));class Xm extends Vb{constructor({factory:e}={}){super({factory:e,validations:{...Wm}})}}const Qm=new Cr([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function Jm(r){const e=r.ptr.out([ae.class]).map(t=>ba(t));return{generic:Km(e)}}function Km(r){return e=>{const t=new pt(e.valueOrNode.out([pr.type]).terms);for(const i of r){const n=[...t].some(o=>i.has(o));e.test(n,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Ym(r){const e=r.ptr.out([ae.datatype]).term,t=new Xm;return{generic:Zm(e,t)}}function Zm(r,e){return t=>{const i=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(i,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function eg(r){const e=r.ptr.out([ae.nodeKind]).term,t=Qm.get(e);return{generic:tg(e,t)}}function tg(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const rg=new Cr([[ae.maxCount,Uh],[ae.minCount,Gh],[ae.and,Jh],[ae.not,Yh],[ae.or,eb],[ae.xone,rb],[ae.closed,nb],[ae.hasValue,ab],[ae.in,db],[ae.disjoint,ub],[ae.equals,pb],[ae.lessThan,mb],[ae.lessThanOrEquals,vb],[ae.maxExclusive,wb],[ae.maxInclusive,_b],[ae.minExclusive,Eb],[ae.minInclusive,Rb],[ae.node,Nb],[ae.property,Ab],[ae.qualifiedValueShape,Db],[ae.languageIn,Cb],[ae.maxLength,Fb],[ae.minLength,Mb],[ae.pattern,qb],[ae.uniqueLang,Ub],[ae.class,Jm],[ae.datatype,Ym],[ae.nodeKind,eg]]);class ig{constructor(e,{factory:t,...i}){if(this.factory=t,this.options=i,this.registry=new jh(rg),this.shapesPtr=new rn({dataset:e,factory:t}),this.shapes=new Cr,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[o,a]of this.options.validations)this.registry.validations.set(o,a);const n=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([pr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([pr.type],[ae.PropertyShape])];for(const o of n)this.shape(o)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new zh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const i=new rn({...e,factory:this.factory}),n=new Ga({factory:this.factory,focusNode:i,options:this.options,validator:this});t?t=t.map(o=>this.shape(this.shapesPtr.node(o.terms))):t=this.shapes.values();for(const o of t){const a=n.create({shape:o});let s;i.isAny()?s=o.resolveTargets(a):s=i;for(const d of s)await o.validate(a.create({focusNode:d}))}return n.report}}let ng=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new sd(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(i=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:i.conforms,report:i}}))}).catch(i=>{console.warn(i)})})}static get observedAttributes(){return sd.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(i=>{this.form.classList.remove(i)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const i of Zu())i.stylesheet&&t.push(i.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Vt(e,this.config,this.config.attributes.valuesSubject?Re.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const i=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);i.addEventListener("click",n=>{n.preventDefault(),this.form.reportValidity()&&this.validate().then(o=>{if(o?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(i)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Re.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,bi)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}},200)}serialize(e="text/turtle",t=this.toRDF()){const i=t.getQuads(null,null,null,null);return Qu(i,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){Yu(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape&&(this.shape.toRDF(this.config.store),this.config.store.add(new on(this.shape.shaclSubject,Re.namedNode(_e+"targetNode"),this.shape.nodeId,this.config.valuesGraphId)));try{const t=this.config.store,i=await new ig(t,{details:!0,factory:Re}).validate({dataset:t});for(const n of i.results)if(n.focusNode?.ptrs?.length)for(const o of n.focusNode.ptrs){const a=o._term;if(n.path?.length){const s=n.path[0].predicates[0];let d=this.form.querySelectorAll(`
391
+ `}function Qp(){return""}function Uc(r){return"<"+r.value+">"}const Jp=/["\\\\\n\r]/,Kp=/["\\\\\n\r]/g,Yp={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Zp(r){return Yp[r]}function eh(r){return Jp.test(r)?r.replace(Kp,Zp):r}function th(r){const e=eh(r.value);return r.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':r.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+r.language:'"'+e+'"^^'+Uc(r.datatype)}function rh(r,e){const t=e(r.subject),i=e(r.predicate),n=e(r.object),o=e(r.graph);return`${t} ${i} ${n} ${o?o+" ":""}.`}function ih(r){return"?"+r.value}function st(r){if(!r)return null;if(r.termType==="BlankNode")return Wp(r);if(r.termType==="DefaultGraph")return Qp();if(r.termType==="Literal")return th(r);if(r.termType==="NamedNode")return Uc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return rh(r,st);if(r.termType==="Variable")return ih(r);if(r[Symbol.iterator])return Xp(r,st);throw new Error(`unknown termType ${r.termType}`)}class Cr{constructor(e){if(this.index=new Map,e)for(const[t,i]of e)this.set(t,i)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(st(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const i of this.entries())e.call(t,i[1],i[0],this)}get(e){const t=this.index.get(st(e));return t&&t.value}has(e){return this.index.has(st(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const i=st(e);return this.index.set(i,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class ld{constructor({dataset:e,end:t,quad:i,start:n}){this.dataset=e,this.end=t,this.quad=i,this.start=n}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function dd(r){try{return st(r)}catch{return null}}class pt{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=st(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(dd(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(dd(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Hc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Hc.prototype.termType="BlankNode";class qa{equals(e){return!!e&&e.termType===this.termType}}qa.prototype.termType="DefaultGraph";qa.prototype.value="";function cd(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),i=r.fromTerm(e.predicate),n=r.fromTerm(e.object),o=r.fromTerm(e.graph);return r.quad(t,i,n,o)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Ji{constructor(e,t,i,n=""){this.value=e,this.language=t,this.datatype=i,this.direction=n}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}}Ji.prototype.termType="Literal";class Ti{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Ti.prototype.termType="NamedNode";class za{constructor(e,t,i,n){this.subject=e,this.predicate=t,this.object=i,this.graph=n}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)}}za.prototype.termType="Quad";za.prototype.value="";class Gc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Gc.prototype.termType="Variable";const nh=new Ti("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),ud=new Ti("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),oh=new Ti("http://www.w3.org/2001/XMLSchema#string");class Vc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new qa}}namedNode(e){return new Ti(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Hc(e)}literal(e,t){return typeof t=="string"?new Ji(e,t,ud):typeof t?.language=="string"?new Ji(e,t.language,t.direction?nh:ud,t.direction):new Ji(e,"",t||oh)}variable(e){return new Gc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,i,n=this.defaultGraph()){return new za(e,t,i,n)}fromTerm(e){return cd(this,e)}fromQuad(e){return cd(this,e)}}Vc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ua=new Vc,ah={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function mt(r,{factory:e=Ua}={}){const t=(i="")=>e.namedNode(`${r}${i.raw||i}`);return typeof Proxy>"u"?t:new Proxy(t,ah)}mt("http://www.w3.org/2001/XMLSchema#");const _t=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");mt("http://www.w3.org/2000/01/rdf-schema#");class $e{static add({ptr:e,start:t,end:i,subjects:n=[null],predicates:o=[null],objects:a=[null],graphs:s,callback:d}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};d&&(l=c=>{d(new ld({dataset:e.dataset,start:t,end:i,quad:c}))});for(const c of n)for(const u of o)for(const v of a)for(const g of s){const y={subject:c,predicate:u,object:v,graph:g};y[t]=e.term;const k=e.factory.quad(y.subject,y.predicate,y.object,y.graph);e.dataset.add(k),l(k)}return e}static addList({ptr:e,predicates:t,items:i,graphs:n}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const o of t)for(const a of n){const s=i.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,o,s[0]||_t.nil,a));for(let d=0;d<s.length;d++)e.dataset.add(e.factory.quad(s[d],_t.first,i[d],a)),e.dataset.add(e.factory.quad(s[d],_t.rest,s[d+1]||_t.nil,a))}return e}static delete({ptr:e,start:t,subjects:i=[null],predicates:n=[null],objects:o=[null]}){for(const a of i)for(const s of n)for(const d of o){const l={subject:a,predicate:s,object:d};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const u of c)e.dataset.delete(u)}return e}static deleteList({ptr:e,predicates:t}){const i=[];for(const n of t)for(const o of e.dataset.match(e.term,n)){let a=o.object;for(i.push(o);!_t.nil.equals(a);){a=i[i.length-1].object;const s=e.dataset.match(a);if(s.size===0)break;for(const d of s)i.push(d)}}for(const n of i)e.dataset.delete(n);return e}static execute({ptr:e,operation:t="traverse",quantifier:i,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,items:c,callback:u}={}){if(t==="add")return $e.add({ptr:e,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,callback:u});if(t==="addList")return $e.addList({ptr:e,predicates:s,items:c,graphs:l});if(t==="delete")return $e.delete({ptr:e,start:n,subjects:a,predicates:s,objects:d});if(t==="deleteList")return $e.deleteList({ptr:e,predicates:s});if(t==="isList")return $e.isList({ptr:e});if(t==="list")return $e.list({ptr:e});if(t==="traverse")return $e.traverse({ptr:e,quantifier:i,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(_t.nil.equals(e.term)||$e.traverse({ptr:e,predicates:[_t.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(_t.nil);){const t=e.out([_t.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const i=e.out([_t.rest]);if(i.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=i[0]}}}}static traverse({ptr:e,quantifier:t="one",start:i="subject",end:n="object",subjects:o=[null],predicates:a=[null],objects:s=[null],graphs:d=[null],callback:l}){if(t==="one")return $e.traverseOne({ptr:e,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,callback:l});if(t==="oneOrMore"){const c=$e.traverse({ptr:e,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l});return $e.traverseMore({ptrs:c,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l})}if(t==="zeroOrMore")return $e.traverseMore({ptrs:[e],end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l});if(t==="zeroOrOne")return[e,...$e.traverse({ptr:e,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d}={}){let l=[...e],c,u;do{c=[];for(const v of e)c=[...c,...$e.traverseOne({ptr:v,end:t,start:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d})];u&&(c=c.filter(v=>!u.has(v.term))),e=c,l=[...l,...c],u=new pt(l.map(v=>v.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d=(l,c)=>c.extend(l)}={}){const l=[];for(const c of n)for(const u of o)for(const v of a)for(const g of s){const y={subject:c,predicate:u,object:v,graph:g};y[t]=e.term;for(const k of e.dataset.match(y.subject,y.predicate,y.object,y.graph))l.push(d(new ld({dataset:e.dataset,end:i,quad:k,start:t}),e))}return l}}function fd(r,e){return e?t=>e(r.extend(t)):()=>{}}class pd{constructor({dataset:e,edges:t=[],factory:i,graph:n,term:o}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof o>"u")throw new Error("edges or term must be given");if(t.length>0&&o)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=i,this._graph=n,t.length===0&&(this._term=o)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,i){return $e.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:fd(this,i)})}addList(e,t){return $e.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,i){return $e.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:fd(this,i)})}deleteIn(e,t){return $e.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return $e.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return $e.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,items:l,callback:c}){return $e.execute({ptr:this,operation:e,quantifier:t,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return $e.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return $e.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return $e.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return $e.isList({ptr:this})}list(){return $e.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return $e.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function hd(r,e){return r?r.equals(e):r===e}function sh(r,e){return!(r.dataset!==e.dataset||!hd(r.graph,e.graph)||!hd(r.term,e.term))}function bd(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class rn{constructor({dataset:e,factory:t,ptrs:i,terms:n,graphs:o}){if(this.factory=t,i)this.ptrs=[...i];else{this.ptrs=[];for(const a of n||[null])for(const s of o||[null])this.ptrs.push(new pd({dataset:e,factory:t,graph:s,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new pt(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,i){const n=bd(this,i);for(const o of this.ptrs)o.addIn(e,t,n);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const i of this.ptrs)i.addList(e,t);return this}addOut(e,t,i){const n=bd(this,i);for(const o of this.ptrs)o.addOut(e,t,n);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const i of this.ptrs)i.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const i of this.ptrs)i.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,i)=>(t.some(n=>sh(n,i))||t.push(i.trim()),t),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(const i of e)t=t.execute(i);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const i of e)yield t.clone({ptrs:[i]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,i=[...e].map(n=>new pd({dataset:t,factory:this.factory,term:n}));return this.clone({ptrs:i})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}mt("http://www.w3.org/2002/07/owl#");const pr=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),lh=mt("http://www.w3.org/2000/01/rdf-schema#"),ae=mt("http://www.w3.org/ns/shacl#"),pa=mt("https://schemas.link/shacl-next#"),Ha=mt("http://www.w3.org/2001/XMLSchema#");function dh(r){return r?`{${[...r.quads()].map(e=>st(e)).join(" ")}}`:"{}"}function ch(r){return r?`{${r.map(e=>dh(e)).join(" ")}}`:"{}"}var qo,md;function uh(){if(md)return qo;md=1;var r=/\s/;function e(t){for(var i=t.length;i--&&r.test(t.charAt(i)););return i}return qo=e,qo}var zo,gd;function fh(){if(gd)return zo;gd=1;var r=uh(),e=/^\s+/;function t(i){return i&&i.slice(0,r(i)+1).replace(e,"")}return zo=t,zo}var Uo,vd;function ph(){if(vd)return Uo;vd=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Uo=r,Uo}var Ho,yd;function hh(){if(yd)return Ho;yd=1;var r=typeof Er=="object"&&Er&&Er.Object===Object&&Er;return Ho=r,Ho}var Go,wd;function bh(){if(wd)return Go;wd=1;var r=hh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Go=t,Go}var Vo,xd;function Wc(){if(xd)return Vo;xd=1;var r=bh(),e=r.Symbol;return Vo=e,Vo}var Wo,_d;function mh(){if(_d)return Wo;_d=1;var r=Wc(),e=Object.prototype,t=e.hasOwnProperty,i=e.toString,n=r?r.toStringTag:void 0;function o(a){var s=t.call(a,n),d=a[n];try{a[n]=void 0;var l=!0}catch{}var c=i.call(a);return l&&(s?a[n]=d:delete a[n]),c}return Wo=o,Wo}var Xo,kd;function gh(){if(kd)return Xo;kd=1;var r=Object.prototype,e=r.toString;function t(i){return e.call(i)}return Xo=t,Xo}var Qo,Ed;function vh(){if(Ed)return Qo;Ed=1;var r=Wc(),e=mh(),t=gh(),i="[object Null]",n="[object Undefined]",o=r?r.toStringTag:void 0;function a(s){return s==null?s===void 0?n:i:o&&o in Object(s)?e(s):t(s)}return Qo=a,Qo}var Jo,Sd;function yh(){if(Sd)return Jo;Sd=1;function r(e){return e!=null&&typeof e=="object"}return Jo=r,Jo}var Ko,Rd;function wh(){if(Rd)return Ko;Rd=1;var r=vh(),e=yh(),t="[object Symbol]";function i(n){return typeof n=="symbol"||e(n)&&r(n)==t}return Ko=i,Ko}var Yo,Id;function xh(){if(Id)return Yo;Id=1;var r=fh(),e=ph(),t=wh(),i=NaN,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function d(l){if(typeof l=="number")return l;if(t(l))return i;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var u=o.test(l);return u||a.test(l)?s(l.slice(2),u?2:8):n.test(l)?i:+l}return Yo=d,Yo}var Zo,Nd;function _h(){if(Nd)return Zo;Nd=1;var r=xh(),e=1/0,t=17976931348623157e292;function i(n){if(!n)return n===0?n:0;if(n=r(n),n===e||n===-e){var o=n<0?-1:1;return o*t}return n===n?n:0}return Zo=i,Zo}var ea,Td;function kh(){if(Td)return ea;Td=1;var r=_h();function e(t){var i=r(t),n=i%1;return i===i?n?i-n:i:0}return ea=e,ea}var ta,Ad;function Eh(){if(Ad)return ta;Ad=1;var r=kh(),e="Expected a function";function t(i,n){var o;if(typeof n!="function")throw new TypeError(e);return i=r(i),function(){return--i>0&&(o=n.apply(this,arguments)),i<=1&&(n=void 0),o}}return ta=t,ta}var ra,jd;function Sh(){if(jd)return ra;jd=1;var r=Eh();function e(t){return r(2,t)}return ra=e,ra}var Rh=Sh();const yt=tu(Rh);let Dd=class{constructor({details:e,factory:t,options:i,results:n=[]}={}){this.details=e,this.factory=t,this.options=i,this.results=n,this._conforms=yt(()=>!this.results.some(o=>o.severity.equals(ae.Info)||o.severity.equals(ae.Violation)||o.severity.equals(ae.Warning))),this._ptr=yt(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new rn({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([pr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ha.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],i=>{t.build(i,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Ih(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&n.termType&&(n=st(n)),t.replace(`{$${i}}`,n).replace(`{?${i}}`,n)),r)}let Nh=class{constructor({args:e={},constraintComponent:t,factory:i,focusNode:n,message:o=[],path:a,results:s=[],severity:d,shape:l,source:c=[],value:u,valuePaths:v=[]}={}){this.args=e,this.constraintComponent=t,this.factory=i,this.focusNode=n,this.path=a||l.path,this.results=s,this.severity=d,this.shape=l,this.source=c,this.value=u,this.valuePaths=v,this._message=yt(()=>(this.shape.message.length>0&&(o=this.shape.message),o.length===0&&(o=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),o.map(g=>i.literal(Ih(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([pr.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const i=n=>{if(n.quantifier==="one")return n.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],n.predicates):n.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[n.predicates[0]]):e.node([n.predicates[0]]);if(n.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[n.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],i(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(n=>i(n).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const n of this.results)e.addOut([ae.detail],[this.factory.blankNode()],o=>{n.build(o,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Ga{constructor({factory:e,focusNode:t,options:i={debug:!1,details:!1},processed:n=new Set,report:o=new Dd({factory:e,options:i}),results:a=new Map,shape:s,value:d,valueOrNode:l,valuePaths:c,values:u}={}){this.factory=e,this.focusNode=t,this.options=i,this.processed=n,this.report=o,this.results=a,this.shape=s,this.value=d,this.valuePaths=c,this.valueOrNode=l,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:i=this.shape,value:n=this.value,valueOrNode:o=this.valueOrNode,valuePaths:a=this.valuePaths,values:s=this.values}={}){return new Ga({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Dd({factory:this.factory,options:this.options}):this.report,results:this.results,shape:i,value:n,valueOrNode:o,valuePaths:a,values:s})}id({shape:e=this.shape}={}){return`${st(e.ptr.term)} - ${st(this.focusNode.term)} - ${ch(this.valuePaths)}`}result(e){const t=new Nh({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),i=this.id();this.results.has(i)?this.results.get(i).add(t):this.results.set(i,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:pa.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:pa.Trace,constraintComponent:e,...t})}test(e,t,i){e?this.debug(t,i):this.violation(t,i)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ae.Violation,...t})}}function Th(){return{generic:Ah()}}function Ah(){return r=>{r.trace(pa.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class jh{constructor(e){this.validations=new Cr(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let i=!1;const n=new Set;for(const o of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(o.term);a&&(n.add(a),o.term.equals(ae.property)&&(i=!0))}return t&&e.isPropertyShape&&!i&&n.add(Th),[...n].map(o=>o(e)).filter(Boolean)}}var nr={},or={},ni={},oi={},Ld;function jr(){if(Ld)return oi;Ld=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.Translator=void 0;let r=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,i,n){for(const o of i)this.supportedRdfDatatypes.push(o),this.fromRdfHandlers[o.value]=t;for(const o of n){let a=this.toRdfHandlers[o];a||(this.toRdfHandlers[o]=a=[]),a.push(t)}}fromRdf(t,i){const n=this.fromRdfHandlers[t.datatype.value];return n?n.fromRdf(t,i):t.value}toRdf(t,i){const n=this.toRdfHandlers[typeof t];if(n)for(const o of n){const a=o.toRdf(t,i);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return oi.Translator=r,oi}var Od;function Dh(){if(Od)return ni;Od=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.TypeHandlerBoolean=void 0;const r=jr();let e=class Xc{fromRdf(i,n){switch(i.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return n&&r.Translator.incorrectRdfDataType(i),!1}toRdf(i,{datatype:n,dataFactory:o}){return o.literal(i?"true":"false",n||o.namedNode(Xc.TYPE))}};return ni.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",ni}var ai={},Cd;function Lh(){if(Cd)return ai;Cd=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.TypeHandlerDate=void 0;const r=jr();let e=class ha{fromRdf(i,n){switch(n&&!i.value.match(ha.VALIDATORS[i.datatype.value.substr(33,i.datatype.value.length)])&&r.Translator.incorrectRdfDataType(i),i.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(i.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const o=i.value.split("-");return new Date(0,parseInt(o[0],10)-1,parseInt(o[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(i.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(i.value+"-01");default:return new Date(i.value)}}toRdf(i,{datatype:n,dataFactory:o}){if(n=n||o.namedNode(ha.TYPES[0]),!(i instanceof Date))return null;const a=i;let s;switch(n.value){case"http://www.w3.org/2001/XMLSchema#gDay":s=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":s=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":s=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":s=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":s=a.toISOString().replace(/T.*$/,"");break;default:s=a.toISOString()}return o.literal(s,n)}};return ai.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]$/},ai}var si={},$d;function Oh(){if($d)return si;$d=1,Object.defineProperty(si,"__esModule",{value:!0}),si.TypeHandlerNumberDouble=void 0;const r=jr();let e=class Qc{fromRdf(i,n){const o=parseFloat(i.value);return n&&isNaN(o)&&r.Translator.incorrectRdfDataType(i),o}toRdf(i,{datatype:n,dataFactory:o}){return n=n||o.namedNode(Qc.TYPES[0]),isNaN(i)?o.literal("NaN",n):isFinite(i)?i%1===0?null:o.literal(i.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),n):o.literal(i>0?"INF":"-INF",n)}};return si.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"],si}var li={},Fd;function Ch(){if(Fd)return li;Fd=1,Object.defineProperty(li,"__esModule",{value:!0}),li.TypeHandlerNumberInteger=void 0;const r=jr();let e=class pi{fromRdf(i,n){const o=parseInt(i.value,10);return n&&(isNaN(o)||i.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(i),o}toRdf(i,{datatype:n,dataFactory:o}){return o.literal(String(i),n||(i<=pi.MAX_INT&&i>=pi.MIN_INT?o.namedNode(pi.TYPES[0]):o.namedNode(pi.TYPES[1])))}};return li.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,li}var di={},Pd;function $h(){if(Pd)return di;Pd=1,Object.defineProperty(di,"__esModule",{value:!0}),di.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:i,dataFactory:n}){return n.literal(t,i)}};return di.TypeHandlerString=r,r.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],di}var Md;function Bd(){return Md||(Md=1,function(r){var e=or&&or.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=or&&or.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(Dh(),r),t(Lh(),r),t(Oh(),r),t(Ch(),r),t($h(),r)}(or)),or}var ia={},qd;function Fh(){return qd||(qd=1,Object.defineProperty(ia,"__esModule",{value:!0})),ia}var zd;function Ph(){return zd||(zd=1,function(r){var e=nr&&nr.__createBinding||(Object.create?function(g,y,k,x){x===void 0&&(x=k);var _=Object.getOwnPropertyDescriptor(y,k);(!_||("get"in _?!y.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return y[k]}}),Object.defineProperty(g,x,_)}:function(g,y,k,x){x===void 0&&(x=k),g[x]=y[k]}),t=nr&&nr.__exportStar||function(g,y){for(var k in g)k!=="default"&&!Object.prototype.hasOwnProperty.call(y,k)&&e(y,g,k)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=d,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=u,r.getSupportedJavaScriptPrimitives=v;const i=$c(),n=Bd(),o=jr();t(Bd(),r),t(Fh(),r),t(jr(),r);const a=new i.DataFactory,s=new o.Translator;s.registerHandler(new n.TypeHandlerString,n.TypeHandlerString.TYPES.map(g=>a.namedNode(g)),["string"]),s.registerHandler(new n.TypeHandlerBoolean,[n.TypeHandlerBoolean.TYPE].map(g=>a.namedNode(g)),["boolean"]),s.registerHandler(new n.TypeHandlerNumberDouble,n.TypeHandlerNumberDouble.TYPES.map(g=>a.namedNode(g)),["number"]),s.registerHandler(new n.TypeHandlerNumberInteger,n.TypeHandlerNumberInteger.TYPES.map(g=>a.namedNode(g)),["number"]),s.registerHandler(new n.TypeHandlerDate,n.TypeHandlerDate.TYPES.map(g=>a.namedNode(g)),["object"]);function d(g,y){return s.fromRdf(g,y)}function l(g,y){return y&&"namedNode"in y&&(y={dataFactory:y}),y=y||{},y&&!y.dataFactory&&(y.dataFactory=a),s.toRdf(g,y)}function c(g,y){return g.termType==="Literal"?d(g,y):g.value}function u(){return s.getSupportedRdfDatatypes()}function v(){return s.getSupportedJavaScriptPrimitives()}}(nr)),nr}var Ei=Ph();function Ud(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const i=r.out([ae.oneOrMorePath]);if(i.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[i.term]};const n=r.out([ae.zeroOrMorePath]);if(n.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[n.term]};const o=r.out([ae.zeroOrOnePath]);if(o.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[o.term]}}function Mh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Ud(e)):[Ud(r)]}class Bh{constructor(e){this.shape=e,this._compiled=yt(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const i of this.compiled)i.node&&await i.node(t),i.generic&&await i.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const i=t.node(new pt(t.terms)),n=[...t].reduce((a,s)=>{const d=s.term,l=t.node([d]);return a.has(d)||a.set(d,{value:l,valuePaths:[]}),a.get(d).valuePaths.push(s),a},new Cr).values(),o=e.create({shape:this.shape,values:i});for(const a of this.compiled)a.property&&await a.property(o);for(const{value:a,valuePaths:s}of n){const d=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:s});for(const l of this.compiled)l.generic&&await l.generic(d)}}}function ba(r){const e=new pt,i=new rn({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[lh.subClassOf]});for(const n of i.ptrs)for(const{term:o}of n.nodes())e.add(o);return e}class qh{constructor(e){this.targetClass=new pt([...ba(e.hasOut([pr.type],[ae.NodeShape])),...ba(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),i=[...e.focusNode.hasOut([pr.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],n=e.focusNode.clone({ptrs:i});return n.node([...new pt(n.terms)])}}class zh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=yt(()=>{const i=this.ptr.out([ae.deactivated]).term;return i&&Ei.fromRdf(i)}),this._message=yt(()=>this.ptr.out([ae.message]).terms),this._path=yt(()=>Mh(this.ptr.out([ae.path]))),this._severity=yt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=yt(()=>new Bh(this)),this._sparql=yt(()=>this.ptr.out([ae.sparql])),this._targetResolver=yt(()=>new qh(this.ptr))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!this.path}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const i of e.results.get(t))e.report.results.push(i);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Uh(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Hh(e)}}function Hh(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Gh(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Vh(e)}}function Vh(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Wh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Xh(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function mn(r,e){return Promise.all(r.map(e))}async function Qh(r,e){for(const t of r)if(await e(t))return!0;return!1}function Jh(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Kh(e)}}function Kh(r){return async e=>{const t=await mn(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),i=t.every(n=>n.conforms);e.test(i,ae.AndConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function Yh(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Zh(e)}}function Zh(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,i=!t.conforms;e.test(i,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function eb(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tb(e)}}function tb(r){return async e=>{let t=[],i;if(e.options.debug||e.options.details){const n=await mn(r,async o=>(await o.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=n.flatMap(o=>o.results),i=n.some(o=>o.conforms)}else i=await Qh(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(i,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function rb(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:ib(e)}}function ib(r){return async e=>{const t=await mn(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),i=t.filter(n=>n.conforms).length===1;e.test(i,ae.XoneConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function nb(r){if(!Ei.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(o=>r.validator.shape(o)),i=new pt(t.filter(o=>!o.deactivated).map(o=>o.path[0].predicates[0])),n=new pt([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(o=>o.term));return{node:ob(i,n)}}function ob(r,e){return t=>{const i=t.focusNode.execute({start:"subject",end:"predicate"}).filter(n=>e.has(n.term)?!1:!r.has(n.term));if(i.ptrs.length>0)for(const n of i)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[n.term]}],value:t.focusNode.node([[...n.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function ab(r){const e=r.ptr.out([ae.hasValue]).term;return{node:sb(e),property:lb(e)}}function sb(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function lb(r){return e=>{const t=[...e.values].some(i=>r.equals(i.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function db(r){const e=new pt([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:cb(e)}}function cb(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function $r(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Hd(r)!==Hd(e))return null;const t=Ei.fromRdf(r),i=Ei.fromRdf(e);return typeof t!=typeof i?null:typeof t=="string"?t.localeCompare(i):t-i}function Hd(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function ub(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:fb(e)}}function fb(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function pb(r){const e=r.ptr.out([ae.equals]).term;return{node:hb(e),property:bb(e)}}function hb(r){return e=>{const t=e.focusNode.out([r]),i=t.filter(o=>!o.term.equals(e.focusNode.term)),n=t.terms.length!==0&&i.terms.length===0;e.test(n,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:i.terms[0]&&e.focusNode.node([i.terms[0]])||e.focusNode})}}function bb(r){return e=>{const t=new pt(e.focusNode.out([r]).terms),i=new pt(e.values.terms),n=[...i].filter(s=>!t.has(s)),o=[...t].filter(s=>!i.has(s)),a=[...n,...o];for(const s of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([s])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function mb(r){const e=r.ptr.out([ae.lessThan]).term;return{property:gb(e)}}function gb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=$r(i.term,n);o===null||o>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:i}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:i})}}}function vb(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:yb(e)}}function yb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=$r(i.term,n);o===null||o>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:i}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:i})}}}function wb(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:xb(e)}}function xb(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function _b(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:kb(e)}}function kb(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function Eb(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:Sb(e)}}function Sb(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Rb(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Ib(e)}}function Ib(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Nb(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Tb(e)}}function Tb(r){return async e=>{for(const t of r){const i=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(i.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:i.report.results,value:e.valueOrNode})}}}function Ab(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:jb(e)}}function jb(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const i of r)await i.validate(t)}}function Db(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,i=t?Ei.fromRdf(t):!1,n=r.ptr.out([ae.qualifiedMaxCount]).term,o=n?parseInt(n.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,s=a?parseInt(a.value):null;return{property:Lb(e,i,o,s)}}function Lb(r,e,t,i){return async n=>{const o=[];let a=[];e&&(a=new Set(n.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(d=>!d.term.equals(r.ptr.term)).map(d=>n.shape.validator.shape(d))));const s=(await Xh(n.values,async d=>{const l=(await r.validate(n.create({child:!0,focusNode:d}))).report;if(o.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(n.options.debug||n.options.details){const c=await mn([...a],async u=>(await u.validate(n.create({child:!0,focusNode:d}))).report);return o.push(c.flatMap(u=>u.results)),!c.every(u=>u.conforms)}else return!await Wh([...a],async c=>(await c.validate(n.create({child:!0,focusNode:d}))).report.conforms)})).length;t!==null&&n.test(s<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:o.flat()}),i!==null&&n.test(s>=i,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:i,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:o.flat()})}}function Ob(r,e){return e?e.slice(0,r.length)===r:!1}function Cb(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:$b(e)}}function $b(r){return e=>{const t=r.some(i=>Ob(i,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Fb(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:Pb(e)}}function Pb(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Mb(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Bb(e)}}function Bb(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function qb(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,i=new RegExp(e,t);return{generic:zb(e,t,i)}}function zb(r,e,t){return i=>{i.test(t.test(i.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[i.factory.literal('Value does not match pattern "{$pattern}"')],value:i.valueOrNode})}}function Ub(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:Hb()}:null}function Hb(){return r=>{const t=Object.entries(r.values.terms.reduce((i,n)=>(n.language&&(i[n.language]=(i[n.language]||0)+1),i),{})).filter(([,i])=>i>1);for(const[i]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:i},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const Ki=mt("http://www.w3.org/ns/shacl#"),Jc=mt("https://schemas.link/shacl-next#");class Dr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Ki.Info)||e.severity.equals(Ki.Violation)||e.severity.equals(Ki.Warning))}}function Gb(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&n.termType&&(n=st(n)),t.replace(`{$${i}}`,n).replace(`{?${i}}`,n)),r)}class nn{constructor({args:e={},factory:t,message:i=[],severity:n=Ki.Violation}={}){this.severity=n,this.message=i.map(o=>t.literal(Gb(o.value,e),o.language||null))}}class Va{constructor({factory:e=Ua}={}){this.factory=e}clone({factory:e}={}){return new Va({factory:e||this.factory})}validate(){return new Dr}validateSimple(){return!0}}class Fr extends Va{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const i of Array.isArray(e)?e:[e])i&&this.datatypes.push(this.factory.fromTerm(i))}clone({factory:e}={}){return new Fr({datatypes:this.datatypes,factory:e||this.factory})}}class Vb{constructor({factory:e=Ua,validations:t}={}){if(this.factory=e,this.validations=new Cr,t)for(const i of Object.values(t)){const n=i.clone({factory:this.factory});for(const o of n.datatypes)this.validations.set(o,n)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Dr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends Fr{constructor(e,t,{factory:i}={}){super({datatypes:t,factory:i}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(i=>{let n;i.test(e.value)&&(n=Jc.Debug);const o={pattern:this.factory.literal(i.toString()),this:e};return new nn({args:o,factory:this.factory,message:this.message,severity:n})});return new Dr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Wb=/^([-+]?[0-9]+)$/;class ot extends Pe{constructor(e=null,t=null,i,{factory:n}={}){super(Wb,i,{factory:n}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new ot(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Jc.Debug.equals(t[0].severity))return new Dr({results:t});const i=BigInt(e.value);if(this.minInclusive!==null&&i<this.minInclusive){const n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,o=[this.factory.literal(n)];t.push(new nn({factory:this.factory,message:o}))}if(this.maxInclusive!==null&&i>this.maxInclusive){const n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,o=[this.factory.literal(n)];t.push(new nn({factory:this.factory,message:o}))}return new Dr({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Wa extends Fr{constructor(e,t,{factory:i}={}){super({datatypes:t,factory:i}),this.values=new Set(e)}clone({factory:e}={}){return new Wa(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const i=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,n=[this.factory.literal(i)];t.push(new nn({factory:this.factory,message:n}))}return new Dr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Ne={xsd:mt("http://www.w3.org/2001/XMLSchema#")},Xb=new Fr({datatypes:Ne.xsd.anySimpleType}),Qb=new Fr({datatypes:Ne.xsd.anyAtomicType}),gn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Jb=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Kc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Xa=/^(-?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)))))$/,Yc=/^(-?([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))?)$/,Kb=/^((([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))?)$/,Yb=/^(-?([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))?)$/,Zb=/^(-?([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))?)$/,em=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(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))?)$/,rm=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,im=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,nm=/^(([0-9a-fA-F]{2})*)$/,om=/^(((([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] ?= ?=))?)$/,am=new Pe(gn,Ne.xsd.string),sm=new Wa(["1","true","0","false"],Ne.xsd.boolean),lm=new Pe(Jb,Ne.xsd.decimal),dm=new Pe(Kc,Ne.xsd.float),cm=new Pe(Kc,Ne.xsd.double),um=new Pe(Xa,Ne.xsd.duration),fm=new Pe(Yc,Ne.xsd.dateTime),pm=new Pe(Kb,Ne.xsd.time),hm=new Pe(Yb,Ne.xsd.date),bm=new Pe(Zb,Ne.xsd.gYearMonth),mm=new Pe(em,Ne.xsd.gYear),gm=new Pe(tm,Ne.xsd.gMonthDay),vm=new Pe(rm,Ne.xsd.gDay),ym=new Pe(im,Ne.xsd.gMonth),wm=new Pe(nm,Ne.xsd.hexBinary),xm=new Pe(om,Ne.xsd.base64Binary),_m=new Pe(gn,Ne.xsd.anyURI),Zc=/^([^\u000d\u000a\u0009]*)$/,km=/^([^ ]+( [^ ]+)*)*$/,Em=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Sm=/^([^DT]*)$/,Rm=/^([^YM]*[DT].*)$/,Im=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Nm=new Pe([gn,Zc],Ne.xsd.normalizedString),Tm=new Pe([gn,Zc,km],Ne.xsd.token),Am=new Pe(Em,Ne.xsd.language),jm=new ot(null,null,Ne.xsd.integer),Dm=new ot(null,"0",Ne.xsd.nonPositiveInteger),Lm=new ot(null,"-1",Ne.xsd.negativeInteger),Om=new ot("-9223372036854775808","9223372036854775807",Ne.xsd.long),Cm=new ot("-2147483648","2147483647",Ne.xsd.int),$m=new ot("-32768","32767",Ne.xsd.short),Fm=new ot("-128","127",Ne.xsd.byte),Pm=new ot("0",null,Ne.xsd.nonNegativeInteger),Mm=new ot("0","18446744073709551615",Ne.xsd.unsignedLong),Bm=new ot("0","4294967295",Ne.xsd.unsignedInt),qm=new ot("0","65535",Ne.xsd.unsignedShort),zm=new ot("0","255",Ne.xsd.unsignedByte),Um=new ot("1",null,Ne.xsd.positiveInteger),Hm=new Pe([Xa,Sm],Ne.xsd.yearMonthDuration),Gm=new Pe([Xa,Rm],Ne.xsd.dayTimeDuration),Vm=new Pe([Yc,Im],Ne.xsd.dateTimeStamp),Wm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Qb,anySimpleType:Xb,anyURI:_m,base64Binary:xm,boolean:sm,byte:Fm,date:hm,dateTime:fm,dateTimeStamp:Vm,dayTimeDuration:Gm,decimal:lm,double:cm,duration:um,float:dm,gDay:vm,gMonth:ym,gMonthDay:gm,gYear:mm,gYearMonth:bm,hexBinary:wm,int:Cm,integer:jm,language:Am,long:Om,negativeInteger:Lm,nonNegativeInteger:Pm,nonPositiveInteger:Dm,normalizedString:Nm,positiveInteger:Um,short:$m,string:am,time:pm,token:Tm,unsignedByte:zm,unsignedInt:Bm,unsignedLong:Mm,unsignedShort:qm,yearMonthDuration:Hm},Symbol.toStringTag,{value:"Module"}));class Xm extends Vb{constructor({factory:e}={}){super({factory:e,validations:{...Wm}})}}const Qm=new Cr([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function Jm(r){const e=r.ptr.out([ae.class]).map(t=>ba(t));return{generic:Km(e)}}function Km(r){return e=>{const t=new pt(e.valueOrNode.out([pr.type]).terms);for(const i of r){const n=[...t].some(o=>i.has(o));e.test(n,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Ym(r){const e=r.ptr.out([ae.datatype]).term,t=new Xm;return{generic:Zm(e,t)}}function Zm(r,e){return t=>{const i=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(i,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function eg(r){const e=r.ptr.out([ae.nodeKind]).term,t=Qm.get(e);return{generic:tg(e,t)}}function tg(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const rg=new Cr([[ae.maxCount,Uh],[ae.minCount,Gh],[ae.and,Jh],[ae.not,Yh],[ae.or,eb],[ae.xone,rb],[ae.closed,nb],[ae.hasValue,ab],[ae.in,db],[ae.disjoint,ub],[ae.equals,pb],[ae.lessThan,mb],[ae.lessThanOrEquals,vb],[ae.maxExclusive,wb],[ae.maxInclusive,_b],[ae.minExclusive,Eb],[ae.minInclusive,Rb],[ae.node,Nb],[ae.property,Ab],[ae.qualifiedValueShape,Db],[ae.languageIn,Cb],[ae.maxLength,Fb],[ae.minLength,Mb],[ae.pattern,qb],[ae.uniqueLang,Ub],[ae.class,Jm],[ae.datatype,Ym],[ae.nodeKind,eg]]);class ig{constructor(e,{factory:t,...i}){if(this.factory=t,this.options=i,this.registry=new jh(rg),this.shapesPtr=new rn({dataset:e,factory:t}),this.shapes=new Cr,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[o,a]of this.options.validations)this.registry.validations.set(o,a);const n=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([pr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([pr.type],[ae.PropertyShape])];for(const o of n)this.shape(o)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new zh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const i=new rn({...e,factory:this.factory}),n=new Ga({factory:this.factory,focusNode:i,options:this.options,validator:this});t?t=t.map(o=>this.shape(this.shapesPtr.node(o.terms))):t=this.shapes.values();for(const o of t){const a=n.create({shape:o});let s;i.isAny()?s=o.resolveTargets(a):s=i;for(const d of s)await o.validate(a.create({focusNode:d}))}return n.report}}let ng=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new sd(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(i=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:i.conforms,report:i}}))}).catch(i=>{console.warn(i)})})}static get observedAttributes(){return sd.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.setAttribute("loading",""),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(i=>{this.form.classList.remove(i)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const i of Zu())i.stylesheet&&t.push(i.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Vt(e,this.config,this.config.attributes.valuesSubject?Re.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const i=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);i.addEventListener("click",n=>{n.preventDefault(),this.form.reportValidity()&&this.validate().then(o=>{if(o?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(i)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Re.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,bi)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}this.removeAttribute("loading")},200)}serialize(e="text/turtle",t=this.toRDF()){const i=t.getQuads(null,null,null,null);return Qu(i,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){Yu(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape&&(this.shape.toRDF(this.config.store),this.config.store.add(new on(this.shape.shaclSubject,Re.namedNode(_e+"targetNode"),this.shape.nodeId,this.config.valuesGraphId)));try{const t=this.config.store,i=await new ig(t,{details:!0,factory:Re}).validate({dataset:t});for(const n of i.results)if(n.focusNode?.ptrs?.length)for(const o of n.focusNode.ptrs){const a=o._term;if(n.path?.length){const s=n.path[0].predicates[0];let d=this.form.querySelectorAll(`
392
392
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${s.id}'] > .editor,
393
393
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${s.id}'] > .editor,
394
394
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${s.id}'] > .editor,