@opengeospatial/jsonld-ui-utils 0.4.11 → 0.4.12
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.
|
@@ -22,5 +22,5 @@ Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="--�𐀀-",
|
|
|
22
22
|
* @license MIT
|
|
23
23
|
* @copyright Louis-Dominique Dubeau
|
|
24
24
|
*/
|
|
25
|
-
Object.defineProperty(t,"__esModule",{value:!0}),t.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",t.NC_NAME_CHAR="-"+t.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.NC_NAME_START_CHAR_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]$","u"),t.NC_NAME_CHAR_RE=new RegExp("^["+t.NC_NAME_CHAR+"]$","u"),t.NC_NAME_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]["+t.NC_NAME_CHAR+"]*$","u"),t.isNCNameStartChar=e,t.isNCNameChar=function(t){return e(t)||45===t||46===t||t>=48&&t<=57||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Fe)),Fe);var r=t.isS,s=t.isChar,n=t.isNameStartChar,a=t.isNameChar,o=t.S_LIST,h=t.NAME_RE,u=e.isChar,l=i.isNCNameStartChar,c=i.isNCNameChar,d=i.NC_NAME_RE;const f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",_={__proto__:null,xml:f,xmlns:p},g={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},b=-1,m=-2,y=13,x=33,v=10,w=60,T=61,I=62,E=63,R=93,N=t=>34===t||39===t,S=[34,39],j=[...S,91,I],C=[...S,w,R],P=[T,E,...o],k=[...o,I,38,w];function A(t,e,i){switch(e){case"xml":i!==f&&t.fail(`xml prefix must be bound to ${f}.`);break;case"xmlns":i!==p&&t.fail(`xmlns prefix must be bound to ${p}.`)}switch(i){case p:t.fail(""===e?`the default namespace may not be set to ${i}.`:`may not assign a prefix (even "xmlns") to the URI ${p}.`);break;case f:switch(e){case"xml":break;case"":t.fail(`the default namespace may not be set to ${i}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}}}const $=t=>d.test(t),O=t=>h.test(t);je.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const D={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};return je.SaxesParser=class{get closed(){return this._closed}constructor(t){this.opt=null!=t?t:{},this.fragmentOpt=!!this.opt.fragment;const e=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,e){this.nameStartCheck=l,this.nameCheck=c,this.isName=$,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},_);const t=this.opt.additionalNamespaces;null!=t&&(!function(t,e){for(const i of Object.keys(e))A(t,i,e[i])}(this,t),Object.assign(this.ns,t))}else this.nameStartCheck=n,this.nameCheck=a,this.isName=O,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=0,this.attribList=[];const{fragmentOpt:e}=this;this.state=e?y:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=e,this.xmlDeclPossible=!e,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(void 0===i){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(g),null===(t=this.readyHandler)||void 0===t||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,e){this[D[t]]=e}off(t){this[D[t]]=void 0}makeError(t){var e;let i=null!==(e=this.fileName)&&void 0!==e?e:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+t)}fail(t){const e=this.makeError(t),i=this.errorHandler;if(void 0===i)throw e;return i(e),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let e=!1;null===t?(e=!0,t=""):"object"==typeof t&&(t=t.toString()),void 0!==this.carriedFromPrevious&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let i=t.length;const r=t.charCodeAt(i-1);!e&&(13===r||r>=55296&&r<=56319)&&(this.carriedFromPrevious=t[i-1],i--,t=t.slice(0,i));const{stateTable:s}=this;for(this.chunk=t,this.i=0;this.i<i;)s[this.state].call(this);return this.chunkPosition+=i,e?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>=32||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:return t.charCodeAt(e+1)===v&&(this.i=e+2),this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCode11(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>31&&i<127||i>159&&8232!==i||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:{const i=t.charCodeAt(e+1);i!==v&&133!==i||(this.i=e+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCodeNorm(){const t=this.getCode();return t===m?v:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:e}=this;const{chunk:i}=this;for(;;){const r=this.getCode(),s=r===m,n=s?v:r;if(n===b||t.includes(n))return this.text+=i.slice(e,this.prevI),n;s&&(this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i)}}captureToChar(t){let{i:e}=this;const{chunk:i}=this;for(;;){let r=this.getCode();switch(r){case m:this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i,r=v;break;case b:return this.text+=i.slice(e),!1}if(r===t)return this.text+=i.slice(e,this.prevI),!0}}captureNameChars(){const{chunk:t,i:e}=this;for(;;){const i=this.getCode();if(i===b)return this.name+=t.slice(e),b;if(!a(i))return this.name+=t.slice(e,this.prevI),i===m?v:i}}skipSpaces(){for(;;){const t=this.getCodeNorm();if(t===b||!r(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,"1.0"===t?(this.isChar=s,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){const t=this.i,e=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),e){case w:if(this.state=15,0!==this.text.length)throw new Error("no-empty text at start");break;case b:break;default:this.unget(),this.state=y,this.xmlDeclPossible=!1}}sDoctype(){var t;const e=this.captureTo(j);switch(e){case I:null===(t=this.doctypeHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y,this.doctype=!0;break;case b:break;default:this.text+=String.fromCodePoint(e),91===e?this.state=4:N(e)&&(this.state=3,this.q=e)}}sDoctypeQuote(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=2)}sDTD(){const t=this.captureTo(C);t!==b&&(this.text+=String.fromCodePoint(t),t===R?this.state=2:t===w?this.state=6:N(t)&&(this.state=5,this.q=t))}sDTDQuoted(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=4,this.q=null)}sDTDOpenWaka(){const t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case 33:this.state=7,this.openWakaBang="";break;case E:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){const t=String.fromCodePoint(this.getCodeNorm()),e=this.openWakaBang+=t;this.text+=t,"-"!==e&&(this.state="--"===e?8:4,this.openWakaBang="")}sDTDComment(){this.captureToChar(45)&&(this.text+="-",this.state=9)}sDTDCommentEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=45===t?10:8}sDTDCommentEnded(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I?this.state=4:(this.fail("malformed comment."),this.state=8)}sDTDPI(){this.captureToChar(E)&&(this.text+="?",this.state=12)}sDTDPIEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I&&(this.state=4)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this;const{chunk:e}=this;t:for(;;)switch(this.getCode()){case m:this.entity+=`${e.slice(t,this.prevI)}\n`,t=this.i;break;case 59:{const{entityReturnState:i}=this,r=this.entity+e.slice(t,this.prevI);let s;this.state=i,""===r?(this.fail("empty entity name."),s="&;"):(s=this.parseEntity(r),this.entity=""),i===y&&void 0===this.textHandler||(this.text+=s);break t}case b:this.entity+=e.slice(t);break t}}sOpenWaka(){const t=this.getCode();if(n(t))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(t){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang="",this.xmlDeclPossible=!1;break;case E:this.state=23;break;default:this.fail("disallowed character in tag name"),this.state=y,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=20,this.openWakaBang="";break;case"--":this.state=17,this.openWakaBang="";break;case"DOCTYPE":this.state=2,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(45)&&(this.state=18)}sCommentEnding(){var t;const e=this.getCodeNorm();45===e?(this.state=19,null===(t=this.commentHandler)||void 0===t||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(e)}`,this.state=17)}sCommentEnded(){const t=this.getCodeNorm();t!==I?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=17):this.state=y}sCData(){this.captureToChar(R)&&(this.state=21)}sCDataEnding(){const t=this.getCodeNorm();t===R?this.state=22:(this.text+=`]${String.fromCodePoint(t)}`,this.state=20)}sCDataEnding2(){var t;const e=this.getCodeNorm();switch(e){case I:null===(t=this.cdataHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y;break;case R:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(e)}`,this.state=20}}sPIFirstChar(){const t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=24):t===E||r(t)?(this.fail("processing instruction without a target."),this.state=t===E?26:25):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=24)}sPIRest(){const{chunk:t,i:e}=this;for(;;){const i=this.getCodeNorm();if(i===b)return void(this.piTarget+=t.slice(e));if(!this.nameCheck(i)){this.piTarget+=t.slice(e,this.prevI);const s=i===E;s||r(i)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=s?x:27):this.state=s?26:25:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(i));break}}}sPIBody(){if(0===this.text.length){const t=this.getCodeNorm();t===E?this.state=26:r(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(E)&&(this.state=26)}sPIEnding(){var t;const e=this.getCodeNorm();if(e===I){const{piTarget:e}=this;"xml"===e.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(t=this.piHandler)||void 0===t||t.call(this,{target:e,body:this.text}),this.piTarget=this.text="",this.state=y}else e===E?this.text+="?":(this.text+=`?${String.fromCodePoint(e)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const t=this.skipSpaces();t!==E?t!==b&&(this.state=28,this.name=String.fromCodePoint(t)):this.state=x}sXMLDeclName(){const t=this.captureTo(P);if(t===E)return this.state=x,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(r(t)||t===T){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=t===T?30:29}}sXMLDeclEq(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(t!==T&&this.fail("value required."),this.state=30)}sXMLDeclValueStart(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(N(t)?this.q=t:(this.fail("value must be quoted."),this.q=32),this.state=31)}sXMLDeclValue(){const t=this.captureTo([this.q,E]);if(t===E)return this.state=x,this.text="",void this.fail("XML declaration is incomplete.");if(t===b)return;const e=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const t=e;this.xmlDecl.version=t,/^1\.[0-9]+$/.test(t)?this.opt.forceXMLVersion||this.setXMLVersion(t):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(e)||this.fail("encoding value must match \t/^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=e;break;case"standalone":"yes"!==e&&"no"!==e&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=e}this.name="",this.state=32}sXMLDeclSeparator(){const t=this.getCodeNorm();t!==E?(r(t)||(this.fail("whitespace required."),this.unget()),this.state=27):this.state=x}sXMLDeclEnding(){var t;this.getCodeNorm()===I?("xml"!==this.piTarget?this.fail("processing instructions are not allowed before root."):"version"!==this.name&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),null===(t=this.xmldeclHandler)||void 0===t||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=y):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;const e=this.captureNameChars();if(e===b)return;const i=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=i.ns=Object.create(null)),null===(t=this.openTagStartHandler)||void 0===t||t.call(this,i),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),e){case I:this.openTag();break;case 47:this.state=35;break;default:r(e)||this.fail("disallowed character in tag name."),this.state=36}}sOpenTagSlash(){this.getCode()===I?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=36)}sAttrib(){const t=this.skipSpaces();t!==b&&(n(t)?(this.unget(),this.state=37):t===I?this.openTag():47===t?this.state=35:this.fail("disallowed character in attribute name."))}sAttribName(){const t=this.captureNameChars();t===T?this.state=39:r(t)?this.state=38:t===I?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==b&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const t=this.skipSpaces();switch(t){case b:return;case T:this.state=39;break;default:this.fail("attribute without value."),this.text="",this.name="",t===I?this.openTag():n(t)?(this.unget(),this.state=37):(this.fail("disallowed character in attribute name."),this.state=36)}}sAttribValue(){const t=this.getCodeNorm();N(t)?(this.q=t,this.state=40):r(t)||(this.fail("unquoted attribute value."),this.state=42,this.unget())}sAttribValueQuoted(){const{q:t,chunk:e}=this;let{i:i}=this;for(;;)switch(this.getCode()){case t:return this.pushAttrib(this.name,this.text+e.slice(i,this.prevI)),this.name=this.text="",this.q=null,void(this.state=41);case 38:return this.text+=e.slice(i,this.prevI),this.state=14,void(this.entityReturnState=40);case v:case m:case 9:this.text+=`${e.slice(i,this.prevI)} `,i=this.i;break;case w:return this.text+=e.slice(i,this.prevI),void this.fail("disallowed character.");case b:return void(this.text+=e.slice(i))}}sAttribValueClosed(){const t=this.getCodeNorm();r(t)?this.state=36:t===I?this.openTag():47===t?this.state=35:n(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=37):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const t=this.captureTo(k);switch(t){case 38:this.state=14,this.entityReturnState=42;break;case w:this.fail("disallowed character.");break;case b:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===I?this.openTag():this.state=36}}sCloseTag(){const t=this.captureNameChars();t===I?this.closeTag():r(t)?this.state=44:t!==b&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case I:this.closeTag();break;case b:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:e}=this;const{chunk:i,textHandler:r}=this;t:for(;;)switch(this.getCode()){case w:if(this.state=15,void 0!==r){const{text:e}=this,s=i.slice(t,this.prevI);0!==e.length?(r(e+s),this.text=""):0!==s.length&&r(s)}e=0;break t;case 38:this.state=14,this.entityReturnState=y,void 0!==r&&(this.text+=i.slice(t,this.prevI)),e=0;break t;case R:switch(e){case 0:e=1;break;case 1:e=2;break;case 2:break;default:throw new Error("impossible state")}break;case I:2===e&&this.fail('the string "]]>" is disallowed in char data.'),e=0;break;case m:void 0!==r&&(this.text+=`${i.slice(t,this.prevI)}\n`),t=this.i,e=0;break;case b:void 0!==r&&(this.text+=i.slice(t));break t;default:e=0}this.forbiddenState=e}handleTextOutsideRoot(){let{i:t}=this;const{chunk:e,textHandler:i}=this;let s=!1;t:for(;;){const n=this.getCode();switch(n){case w:if(this.state=15,void 0!==i){const{text:r}=this,s=e.slice(t,this.prevI);0!==r.length?(i(r+s),this.text=""):0!==s.length&&i(s)}break t;case 38:this.state=14,this.entityReturnState=y,void 0!==i&&(this.text+=e.slice(t,this.prevI)),s=!0;break t;case m:void 0!==i&&(this.text+=`${e.slice(t,this.prevI)}\n`),t=this.i;break;case b:void 0!==i&&(this.text+=e.slice(t));break t;default:r(n)||(s=!0)}}s&&(this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(t,e){var i;const{prefix:r,local:s}=this.qname(t),n={name:t,prefix:r,local:s,value:e};if(this.attribList.push(n),null===(i=this.attributeHandler)||void 0===i||i.call(this,n),"xmlns"===r){const t=e.trim();"1.0"===this.currentXMLVersion&&""===t&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[s]=t,A(this,s,t)}else if("xmlns"===t){const t=e.trim();this.topNS[""]=t,A(this,"",t)}}pushAttribPlain(t,e){var i;const r={name:t,value:e};this.attribList.push(r),null===(i=this.attributeHandler)||void 0===i||i.call(this,r)}end(){var t,e;this.sawRoot||this.fail("document must contain a root element.");const{tags:i}=this;for(;i.length>0;){const t=i.pop();this.fail(`unclosed tag: ${t.name}`)}0!==this.state&&this.state!==y&&this.fail("unexpected end.");const{text:r}=this;return 0!==r.length&&(null===(t=this.textHandler)||void 0===t||t.call(this,r),this.text=""),this._closed=!0,null===(e=this.endHandler)||void 0===e||e.call(this),this._init(),this}resolve(t){var e,i;let r=this.topNS[t];if(void 0!==r)return r;const{tags:s}=this;for(let e=s.length-1;e>=0;e--)if(r=s[e].ns[t],void 0!==r)return r;return r=this.ns[t],void 0!==r?r:null===(i=(e=this.opt).resolvePrefix)||void 0===i?void 0:i.call(e,t)}qname(t){const e=t.indexOf(":");if(-1===e)return{prefix:"",local:t};const i=t.slice(e+1),r=t.slice(0,e);return(""===r||""===i||i.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:r,local:i}}processAttribsNS(){var t;const{attribList:e}=this,i=this.tag;{const{prefix:e,local:r}=this.qname(i.name);i.prefix=e,i.local=r;const s=i.uri=null!==(t=this.resolve(e))&&void 0!==t?t:"";""!==e&&("xmlns"===e&&this.fail('tags may not have "xmlns" as prefix.'),""===s&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),i.uri=e))}if(0===e.length)return;const{attributes:r}=i,s=new Set;for(const t of e){const{name:e,prefix:i,local:n}=t;let a,o;""===i?(a="xmlns"===e?p:"",o=e):(a=this.resolve(i),void 0===a&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),a=i),o=`{${a}}${n}`),s.has(o)&&this.fail(`duplicate attribute: ${o}.`),s.add(o),t.uri=a,r[e]=t}this.attribList=[]}processAttribsPlain(){const{attribList:t}=this,e=this.tag.attributes;for(const{name:i,value:r}of t)void 0!==e[i]&&this.fail(`duplicate attribute: ${i}.`),e[i]=r;this.attribList=[]}openTag(){var t;this.processAttribs();const{tags:e}=this,i=this.tag;i.isSelfClosing=!1,null===(t=this.openTagHandler)||void 0===t||t.call(this,i),e.push(i),this.state=y,this.name=""}openSelfClosingTag(){var t,e,i;this.processAttribs();const{tags:r}=this,s=this.tag;s.isSelfClosing=!0,null===(t=this.openTagHandler)||void 0===t||t.call(this,s),null===(e=this.closeTagHandler)||void 0===e||e.call(this,s);null===(this.tag=null!==(i=r[r.length-1])&&void 0!==i?i:null)&&(this.closedRoot=!0),this.state=y,this.name=""}closeTag(){const{tags:t,name:e}=this;if(this.state=y,this.name="",""===e)return this.fail("weird empty close tag."),void(this.text+="</>");const i=this.closeTagHandler;let r=t.length;for(;r-- >0;){const r=this.tag=t.pop();if(this.topNS=r.ns,null==i||i(r),r.name===e)break;this.fail("unexpected close tag.")}0===r?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${e}.`),this.text+=`</${e}>`)}parseEntity(t){if("#"!==t[0]){const e=this.ENTITIES[t];return void 0!==e?e:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let e=NaN;return"x"===t[1]&&/^#x[0-9a-f]+$/i.test(t)?e=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(e=parseInt(t.slice(1),10)),this.isChar(e)?String.fromCodePoint(e):(this.fail("malformed character entity."),`&${t};`)}},je}var Me,Be=xe(ce),qe={};function Ue(){if(Me)return qe;Me=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.ParseError=void 0;let t=class extends Error{constructor(t,e){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${e}`:e)}};return qe.ParseError=t,qe}var Ge,He={},Qe={};function ze(){if(Ge)return Qe;Ge=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.BlankNode=void 0;return Qe.BlankNode=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&"BlankNode"===t.termType&&t.value===this.value}},Qe}var Ye,Ve={},Xe={};function We(){if(Ye)return Xe;Ye=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.DefaultGraph=void 0;let t=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&"DefaultGraph"===t.termType}};return Xe.DefaultGraph=t,t.INSTANCE=new t,Xe}var Ze,Je,Ke={},ti={};function ei(){if(Ze)return ti;Ze=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.NamedNode=void 0;return ti.NamedNode=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&"NamedNode"===t.termType&&t.value===this.value}},ti}function ii(){if(Je)return Ke;Je=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.Literal=void 0;const t=ei();let e=class t{constructor(e,i){this.termType="Literal",this.value=e,"string"==typeof i?(this.language=i,this.datatype=t.RDF_LANGUAGE_STRING):i?(this.language="",this.datatype=i):(this.language="",this.datatype=t.XSD_STRING)}equals(t){return!!t&&"Literal"===t.termType&&t.value===this.value&&t.language===this.language&&this.datatype.equals(t.datatype)}};return Ke.Literal=e,e.RDF_LANGUAGE_STRING=new t.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.XSD_STRING=new t.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Ke}var ri,si={};function ni(){if(ri)return si;ri=1,Object.defineProperty(si,"__esModule",{value:!0}),si.Quad=void 0;return si.Quad=class{constructor(t,e,i,r){this.termType="Quad",this.value="",this.subject=t,this.predicate=e,this.object=i,this.graph=r}equals(t){return!!t&&("Quad"===t.termType||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}},si}var ai,oi,hi,ui={};function li(){if(ai)return ui;ai=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.Variable=void 0;return ui.Variable=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&"Variable"===t.termType&&t.value===this.value}},ui}function ci(){return hi||(hi=1,t=He,e=He&&He.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=He&&He.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(ze(),t),i(function(){if(oi)return Ve;oi=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.DataFactory=void 0;const t=ze(),e=We(),i=ii(),r=ei(),s=ni(),n=li();let a=0;return Ve.DataFactory=class{constructor(t){this.blankNodeCounter=0,t=t||{},this.blankNodePrefix=t.blankNodePrefix||`df_${a++}_`}namedNode(t){return new r.NamedNode(t)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(t,e){return new i.Literal(t,e)}variable(t){return new n.Variable(t)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(t,e,i,r){return new s.Quad(t,e,i,r||this.defaultGraph())}fromTerm(t){switch(t.termType){case"NamedNode":return this.namedNode(t.value);case"BlankNode":return this.blankNode(t.value);case"Literal":return t.language?this.literal(t.value,t.language):t.datatype.equals(i.Literal.XSD_STRING)?this.literal(t.value):this.literal(t.value,this.fromTerm(t.datatype));case"Variable":return this.variable(t.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(t.subject),this.fromTerm(t.predicate),this.fromTerm(t.object),this.fromTerm(t.graph))}}fromQuad(t){return this.fromTerm(t)}resetBlankNodeCounter(){this.blankNodeCounter=0}},Ve}(),t),i(We(),t),i(ii(),t),i(ei(),t),i(ni(),t),i(li(),t)),He;var t,e,i}var di,fi,pi,_i,gi={},bi={};function mi(){return fi||(fi=1,t=gi,e=gi&&gi.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=gi&&gi.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i((di||(di=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateIri=t.IriValidationStrategy=void 0;const e=function(){const t="[!$&'()*+,;=]",e="%[a-fA-F0-9]{2}",i="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",r=`${i}\\.${i}\\.${i}\\.${i}`,s="[a-fA-F0-9]{1,4}",n=`(${s}:${s}|${r})`,a="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",o=`(${a}|${e}|${t}|[:@])*`,h=`(${o})+`,u=`(${o})*`;return new RegExp(`^[a-zA-Z][a-zA-Z0-9+\\-.]*:(\\/\\/((${a}|${e}|${t}|:)*@)?(\\[(((${s}:){6}${n}|::(${s}:){5}${n}|(${s})?::(${s}:){4}${n}|((${s}:){0,1}${s})?::(${s}:){3}${n}|((${s}:){0,2}${s})?::(${s}:){2}${n}|((${s}:){0,3}${s})?::${s}:${n}|((${s}:){0,4}${s})?::${n}|((${s}:){0,5}${s})?::${s}|((${s}:){0,6}${s})?::)|v[a-fA-F0-9]+\\.(${t}|${t}|":)+)\\]|${r}|(${a}|${e}|${t})*)(:[0-9]*)?(\\/${u})*|\\/(${h}(\\/${u})*)?|${h}(\\/${u})*|)(\\?(${o}|[---]|[\\/?])*)?(#(${o}|[\\/?])*)?$`,"u")}(),i=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var r;!function(t){t.Strict="strict",t.Pragmatic="pragmatic",t.None="none"}(r=t.IriValidationStrategy||(t.IriValidationStrategy={})),t.validateIri=function(t,s=r.Strict){switch(s){case r.Strict:return e.test(t)?void 0:new Error(`Invalid IRI according to RFC 3987: '${t}'`);case r.Pragmatic:return i.test(t)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${t}'`);case r.None:return;default:return new Error(`Not supported validation strategy "${s}"`)}}}(bi)),bi),t)),gi;var t,e,i}function yi(){if(pi)return Ie;pi=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.ParseType=Ie.RdfXmlParser=void 0;const t=Ne(),e=Le(),i=Be,r=Ue(),s=ci(),n=mi();let a=class a extends i.Transform{constructor(t){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},t&&(Object.assign(this,t),this.options=t),this.dataFactory||(this.dataFactory=new s.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),!1!==this.validateUri&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?n.IriValidationStrategy.Pragmatic:n.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){const e=new i.PassThrough({readableObjectMode:!0});t.on("error",t=>r.emit("error",t)),t.on("data",t=>e.push(t)),t.on("end",()=>e.push(null));const r=e.pipe(new a(this.options));return r}_transform(t,e,i){try{this.saxParser.write(t)}catch(t){return i(t)}i()}newParseError(t){return new r.ParseError(this,t)}valueToUri(e,i){return this.uriToNamedNode((0,t.resolve)(e,i.baseIRI))}uriToNamedNode(t){const e=(0,n.validateIri)(t,this.iriValidationStrategy);if(e instanceof Error)throw this.newParseError(e.message);return this.dataFactory.namedNode(t)}validateNcname(t){if(!a.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}attachSaxListeners(){this.saxParser.on("error",t=>this.emit("error",t)),this.saxParser.on("opentag",this.onTag.bind(this)),this.saxParser.on("text",this.onText.bind(this)),this.saxParser.on("cdata",this.onText.bind(this)),this.saxParser.on("closetag",this.onCloseTag.bind(this)),this.saxParser.on("doctype",this.onDoctype.bind(this))}onTag(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let i=o.RESOURCE;if(e&&(e.hadChildren=!0,i=e.childrenParseType),e&&e.childrenStringTags){const i=t.name;let r="";for(const e in t.attributes)r+=` ${e}="${t.attributes[e].value}"`;const s=`<${`${i}${r}`}>`;e.childrenStringTags.push(s);const n={childrenStringTags:e.childrenStringTags};return n.childrenStringEmitClosingTag=`</${i}>`,void this.activeTagStack.push(n)}const r={};e?(r.language=e.language,r.baseIRI=e.baseIRI):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),i===o.RESOURCE?this.onTagResource(t,r,e,!e):this.onTagProperty(t,r,e)}onTagResource(e,i,r,s){i.childrenParseType=o.PROPERTY;let n=!0;if(e.uri===a.RDF){if(!s&&a.FORBIDDEN_NODE_ELEMENTS.indexOf(e.local)>=0)throw this.newParseError(`Illegal node element name: ${e.local}`);switch(e.local){case"RDF":i.childrenParseType=o.RESOURCE;case"Description":n=!1}}const h=[],u=[];let l=null,c=!1,d=!1,f=null;for(const s in e.attributes){const n=e.attributes[s];if(r&&n.uri===a.RDF)switch(n.local){case"about":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);l=n.value;continue;case"ID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l="#"+n.value,c=!0;continue;case"nodeID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l=n.value,d=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":f=n.value;continue;case"aboutEach":throw this.newParseError("rdf:aboutEach is not supported.");case"aboutEachPrefix":throw this.newParseError("rdf:aboutEachPrefix is not supported.");case"li":throw this.newParseError("rdf:li on node elements are not supported.")}else if(n.uri===a.XML){if("lang"===n.local){i.language=""===n.value?null:n.value.toLowerCase();continue}if("base"===n.local){i.baseIRI=(0,t.resolve)(n.value,i.baseIRI);continue}}"xml"===n.prefix||"xmlns"===n.prefix||""===n.prefix&&"xmlns"===n.local||!n.uri||(h.push(this.uriToNamedNode(n.uri+n.local)),u.push(n.value))}if(null!==l&&(i.subject=d?this.dataFactory.blankNode(l):this.valueToUri(l,i),c&&this.claimNodeId(i.subject)),i.subject||(i.subject=this.dataFactory.blankNode()),n){const t=this.uriToNamedNode(e.uri+e.local);this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),t,r?r.reifiedStatementId:null)}if(r){if(r.predicate)if(r.childrenCollectionSubject){const t=this.dataFactory.blankNode();this.emitTriple(r.childrenCollectionSubject,r.childrenCollectionPredicate,t,r.reifiedStatementId),this.emitTriple(t,this.dataFactory.namedNode(a.RDF+"first"),i.subject,i.reifiedStatementId),r.childrenCollectionSubject=t,r.childrenCollectionPredicate=this.dataFactory.namedNode(a.RDF+"rest")}else{this.emitTriple(r.subject,r.predicate,i.subject,r.reifiedStatementId);for(let t=0;t<r.predicateSubPredicates.length;t++)this.emitTriple(i.subject,r.predicateSubPredicates[t],r.predicateSubObjects[t],null);r.predicateSubPredicates=[],r.predicateSubObjects=[],r.predicateEmitted=!0}for(let t=0;t<h.length;t++){const e=this.dataFactory.literal(u[t],i.datatype||i.language);this.emitTriple(i.subject,h[t],e,r.reifiedStatementId)}f&&this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),this.uriToNamedNode(f),null)}}onTagProperty(t,e,i){if(e.childrenParseType=o.RESOURCE,e.subject=i.subject,t.uri===a.RDF&&"li"===t.local?(i.listItemCounter||(i.listItemCounter=1),e.predicate=this.uriToNamedNode(t.uri+"_"+i.listItemCounter++)):e.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===a.RDF&&a.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);e.predicateSubPredicates=[],e.predicateSubObjects=[];let r=!1,s=!1,n=null,h=!0;const u=[],l=[];for(const i in t.attributes){const c=t.attributes[i];if(c.uri===a.RDF)switch(c.local){case"resource":if(n)throw this.newParseError(`Found both rdf:resource (${c.value}) and rdf:nodeID (${n}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${c.value})`);e.hadChildren=!0,n=c.value,h=!1;continue;case"datatype":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.value})`);e.datatype=this.valueToUri(c.value,e);continue;case"nodeID":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${c.value}).`);if(e.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${c.value})`);this.validateNcname(c.value),e.hadChildren=!0,n=c.value,h=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(s)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(e.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${e.datatype.value})`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${n})`);if("Resource"===c.value){r=!0,e.childrenParseType=o.PROPERTY;const t=this.dataFactory.blankNode();this.emitTriple(e.subject,e.predicate,t,e.reifiedStatementId),e.subject=t,e.predicate=null}else"Collection"===c.value?(r=!0,e.hadChildren=!0,e.childrenCollectionSubject=e.subject,e.childrenCollectionPredicate=e.predicate,h=!1):"Literal"===c.value&&(r=!0,e.childrenTagsToString=!0,e.childrenStringTags=[]);continue;case"ID":this.validateNcname(c.value),e.reifiedStatementId=this.valueToUri("#"+c.value,e),this.claimNodeId(e.reifiedStatementId);continue}else if(c.uri===a.XML&&"lang"===c.local){e.language=""===c.value?null:c.value.toLowerCase();continue}if("xml"!==c.prefix&&"xmlns"!==c.prefix&&(""!==c.prefix||"xmlns"!==c.local)&&c.uri){if(r||e.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${c.value}`);e.hadChildren=!0,s=!0,u.push(this.uriToNamedNode(c.uri+c.local)),l.push(this.dataFactory.literal(c.value,e.datatype||e.language))}}if(null!==n){const t=e.subject;e.subject=h?this.dataFactory.blankNode(n):this.valueToUri(n,e),this.emitTriple(t,e.predicate,e.subject,e.reifiedStatementId);for(let t=0;t<u.length;t++)this.emitTriple(e.subject,u[t],l[t],null);e.predicateEmitted=!0}else h&&(e.predicateSubPredicates=u,e.predicateSubObjects=l,e.predicateEmitted=!1)}emitTriple(t,e,i,r){this.push(this.dataFactory.quad(t,e,i,this.defaultGraph)),r&&(this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"type"),this.dataFactory.namedNode(a.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"subject"),t,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"predicate"),e,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"object"),i,this.defaultGraph)))}claimNodeId(t){if(!this.allowDuplicateRdfIds){if(this.nodeIds[t.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${t.value}'.`);this.nodeIds[t.value]=!0}}onText(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;e&&(e.childrenStringTags?e.childrenStringTags.push(t):e.predicate&&(e.text=t))}onCloseTag(){const t=this.activeTagStack.pop();if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(a.RDF+"XMLLiteral"),t.text=t.childrenStringTags.join(""),t.hadChildren=!1),t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(a.RDF+"nil"),t.reifiedStatementId);else if(t.predicate)if(t.hadChildren||t.childrenParseType===o.PROPERTY){if(!t.predicateEmitted){const e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId);for(let i=0;i<t.predicateSubPredicates.length;i++)this.emitTriple(e,t.predicateSubPredicates[i],t.predicateSubObjects[i],null)}}else this.emitTriple(t.subject,t.predicate,this.dataFactory.literal(t.text||"",t.datatype||t.language),t.reifiedStatementId)}onDoctype(t){t.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(t,e,i)=>(this.saxParser.ENTITIES[e]=i,""))}};var o;return Ie.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,function(t){t[t.RESOURCE=0]="RESOURCE",t[t.PROPERTY=1]="PROPERTY"}(o||(Ie.ParseType=o={})),Ie}function xi(){return _i||(_i=1,t=Te,e=Te&&Te.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Te&&Te.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(yi(),t)),Te;var t,e,i}var vi=xi();const wi={labelPredicates:l,descriptionPredicates:c},Ti={},Ii={},Ei=new Set(["text/turtle","text/n3","application/n-triples","application/n-quads","application/trig","text/anot+turtle"]),Ri=["text/turtle","application/n-triples","application/n-quads","application/trig","application/ld+json","application/rdf+xml"].join(", ");function Ni(t,e,i,r=function(){var t;if("undefined"!=typeof navigator&&(null===(t=navigator.languages)||void 0===t?void 0:t.length))return Array.from(navigator.languages);try{return[Intl.DateTimeFormat().resolvedOptions().locale]}catch(t){return[]}}()){const s=Rt.namedNode(e);for(const e of i){const i=t.getQuads(s,Rt.namedNode(e),null,null).filter(t=>"Literal"===t.object.termType);if(!i.length)continue;for(const t of r){const e=t.split("-")[0].toLowerCase(),r=i.find(i=>{var r;const s=null===(r=i.object.language)||void 0===r?void 0:r.toLowerCase();return s===t.toLowerCase()||(null==s?void 0:s.split("-")[0])===e});if(r)return r.object.value}const n=i.find(t=>!t.object.language);if(n)return n.object.value;const a=i.find(t=>{var e;return"en"===(null===(e=t.object.language)||void 0===e?void 0:e.toLowerCase())});return(null!=a?a:i[0]).object.value}return null}function Si(t,e,i){const r=new be,s=new Gt({baseIRI:e,format:"text/anot+turtle"===i?"text/turtle":i});return new Promise((e,i)=>{s.parse(t,(t,s)=>{if(t)return i(t);s?r.addQuad(s):e(r)})})}const ji=t=>t?Array.isArray(t)?t:[t]:[],Ci=t=>`DESCRIBE <${t}>`,Pi=async(t,e)=>{var i;let r;try{if(r=await t(),!r.ok)return null}catch(t){return null}const s=(null===(i=r.headers.get("content-type"))||void 0===i?void 0:i.split(";")[0].trim())||"text/turtle",n=await r.text();try{if(Ei.has(s))return Si(n,e,s);if("application/ld+json"===s)return async function(t,e){const i=await Promise.resolve().then(function(){return Ji});if(!i)throw new Error("jsonld peer dependency is not available");const r=JSON.parse(t);return Si(await i.toRDF(r,{format:"application/n-quads",base:e}),e,"application/n-quads")}(n,e);if("application/rdf+xml"===s)return async function(t,e){const i=new be;return new Promise((r,s)=>{const n=new vi.RdfXmlParser({baseIRI:e});n.on("data",t=>i.addQuad(t)),n.on("error",s),n.on("end",()=>r(i)),n.write(t),n.end()})}(n,e)}catch(t){}return null},ki=(t,e,i=t)=>(t in Ii||(Ii[t]=Pi(e,i)),Ii[t]),Ai=t=>"undefined"!=typeof location&&"https:"===location.protocol&&t.startsWith("http://")?"https://"+t.slice(7):null,$i=async(t,e,i)=>{const r=await t;if(!r)return null;const s=Ai(e);for(const t of s?[e,s]:[e]){const s=Ni(r,t,i.labelPredicates);if(s)return{uri:e,label:s,description:Ni(r,t,i.descriptionPredicates)}}return null};async function Oi(t,e={}){const i={...wi,...e};return t in Ti||(Ti[t]=(async(t,e)=>{const i=t.includes("#")?t.split("#")[0]:t;let r=null;const s=Ai(i);s&&(r=await $i(ki(s,()=>fetch(s,{headers:{Accept:Ri}}),i),t,e)),r||(r=await $i(ki(i,()=>fetch(i,{headers:{Accept:Ri}})),t,e));const n=t.includes("#");for(const i of[...ji(e.fallbackRainbowInstances),...ji(e.fallbackRainbowInstance)]){if(r||n)break;const s=new URL(i);s.searchParams.set("uri",t);const a=s.toString();r=await $i(ki(a,()=>fetch(a,{headers:{Accept:Ri}})),t,e)}for(const i of[...ji(e.fallbackSparqlEndpoints),...ji(e.fallbackSparqlEndpoint)]){if(r)break;const s=new URLSearchParams({query:Ci(t)});r=await $i(Pi(()=>fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"text/turtle, application/n-triples"},body:s.toString()}),t),t,e)}if(!r)throw new Error(`No label data found for <${t}>`);return r})(t,i)),Ti[t]}const Di={replaceElements:!0,...wi};async function Fi(t,e,i={}){const r={...Di,...i},s=(t,e,i=!0,r=!1)=>{if(-1!==t.indexOf("://"))return{"@id":t};let n=null,a=null;for(let i=e.length-1;i>=0;i--){if(t in e[i]){let r,n=e[i][t];if(null==n||"boolean"==typeof n||Array.isArray(n))continue;if("string"==typeof n){if("@type"===n)return{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"};r=n,n={"@id":n}}else{if("object"!=typeof n||!("@id"in n)||"string"!=typeof n["@id"])continue;r=n["@id"]}const a=r.indexOf(":");if(a>-1){const t=r.substring(0,a),i=r.substring(a+1);if(i.startsWith("//"))return n;const o=s(t,e);return null!==o&&"@id"in o&&"string"==typeof o["@id"]&&(n["@id"]=`${o["@id"]}${i}`),n}}null===n&&e[i]["@vocab"]&&(n=e[i]["@vocab"]),null===a&&e[i]["@base"]&&(a=e[i]["@base"])}if(-1===t.indexOf(":")){if(i&&n)return{"@id":`${n}${t}`};if(r&&a)return{"@id":`${a}${t}`}}else{const i=t.indexOf(":"),r=t.substring(0,i),n=t.substring(i+1);if(!n.startsWith("//")){const t=s(r,e);if(null!==t&&"@id"in t&&"string"==typeof t["@id"])return{"@id":`${t["@id"]}${n}`}}}return null},n=t=>{const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(t){const i=t;return i.classList.contains("object-property")||i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("literal-value")?(e.push(i),NodeFilter.FILTER_REJECT):NodeFilter.FILTER_SKIP}});for(;i.nextNode(););return e},a=(t,e,i=!0)=>{if(t.setAttribute("data-uri",e),t.classList.add("resource-loading"),Oi(e,r).then(e=>{let i=t.querySelector(".resource-link")||t;e.label&&(t.setAttribute("data-label",e.label),r.replaceElements&&(i.textContent=e.label)),e.description&&(t.setAttribute("data-description",e.description),r.replaceElements&&(i.title=e.description)),t.classList.add("resource-resolved")}).catch(i=>{console.error(`Error resolving URI ${e}: ${i}`,{cause:i}),t.classList.add("resource-error")}).finally(()=>{t.classList.remove("resource-loading")}),i){const i=document.createElement("a");for(i.href=e,i.target="_blank",i.classList.add("resource-link");t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i)}},o=(t,e)=>{var i;const h=(t=>{const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(e){const i=e;return e!==t&&i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("object-property")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=[];let r;for(;r=e.nextNode();)i.push(r);return i})(t);for(const t of h){let h=null;h=t.getAttribute("data-property"),h||(h=t.textContent.trim());const u=s(h,e);let l=e;const c=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector(".object-value");if(u&&"@id"in u&&"string"==typeof u["@id"]){const i=u["@id"];if(a(t,i,r.replaceElements),"@context"in u&&(l=[...e,u["@context"]]),"@id"===u["@type"]&&c){n(c).forEach(t=>{const e=s(t.textContent.trim(),l,!1,!0);if(e&&"@id"in e&&"string"==typeof e["@id"]){const i=e["@id"];a(t,i,r.replaceElements)}})}}c&&o(c,l)}};o(t,[e])}const Li=new Set([4326,4979]),Mi=new Map;function Bi(t){let e=t.match(/\/crs\/EPSG\/[^/]+\/(\d+)$/i);return e?parseInt(e[1],10):(e=t.match(/urn:ogc:def:crs:EPSG::(\d+)$/i),e?parseInt(e[1],10):(e=t.match(/^EPSG:(\d+)$/),e?parseInt(e[1],10):null))}function qi(t){const e=Bi(t);return null!==e?Li.has(e):/\/OGC\/[^/]+\/CRS84h?$/i.test(t)||/urn:ogc:def:crs:OGC:[^:]*:CRS84h?$/i.test(t)}function Ui(t){if("string"==typeof t){if(qi(t))return null;const e=Bi(t);return null!==e?{epsgCode:e}:null}if(null!==t&&"object"==typeof t){const e=t;if("Reference"===e.type&&"string"==typeof e.href){if(qi(e.href))return null;const t=Bi(e.href);return null===t?null:{epsgCode:t,epoch:"number"==typeof e.epoch?e.epoch:void 0}}}return null}function Gi(t){if(!t||"object"!=typeof t)return null;const e=t;if("coordRefSys"in e){const t=function(t){if(Array.isArray(t)){for(const e of t){const t=Ui(e);if(null!==t)return t}return null}return Ui(t)}(e.coordRefSys);if(null!==t)return t}if("crs"in e){const t=function(t){if(!t||"object"!=typeof t)return null;const e=t;if("name"!==e.type)return null;const i=e.properties;if(!i||"object"!=typeof i)return null;const r=i.name;if("string"!=typeof r)return null;if(qi(r))return null;const s=Bi(r);return null!==s?{epsgCode:s}:null}(e.crs);if(null!==t)return t}return null}async function Hi(t,e){const i=`EPSG:${t.epsgCode}`;if(void 0!==t.epoch&&console.warn(`CRS epoch ${t.epoch} ignored — proj4js does not support coordinate epochs.`),!e.defs(i)){let r=Mi.get(t.epsgCode);if(!r){const e=await fetch(`https://epsg.io/${t.epsgCode}.proj4`);if(!e.ok)throw new Error(`Unknown CRS EPSG:${t.epsgCode} — could not retrieve a definition from epsg.io (HTTP ${e.status})`);if(r=(await e.text()).trim(),!r)throw new Error(`Unknown CRS EPSG:${t.epsgCode} — epsg.io returned an empty definition`);Mi.set(t.epsgCode,r)}e.defs(i,r)}return e(i,"WGS84")}function Qi(t,e){const i=e.forward(t.slice(0,2));return t.length>2?[i[0],i[1],t[2]]:[i[0],i[1]]}function zi(t,e){if(!t)return t;switch(t.type){case"Point":return{...t,coordinates:Qi(t.coordinates,e)};case"MultiPoint":case"LineString":return{...t,coordinates:t.coordinates.map(t=>Qi(t,e))};case"MultiLineString":case"Polygon":return{...t,coordinates:t.coordinates.map(t=>t.map(t=>Qi(t,e)))};case"MultiPolygon":return{...t,coordinates:t.coordinates.map(t=>t.map(t=>t.map(t=>Qi(t,e))))};case"GeometryCollection":return{...t,geometries:t.geometries.map(t=>zi(t,e))};default:return t}}var Yi="undefined"!=typeof proj4?proj4:void 0;const Vi="jsonld-ui-popup",Xi=`\n.${Vi} .leaflet-popup-content {\n overflow: auto;\n resize: both;\n box-sizing: border-box;\n min-width: 150px;\n min-height: 60px;\n max-width: var(--jsonld-popup-max-width, 90vw) !important;\n max-height: var(--jsonld-popup-max-height, 80vh) !important;\n}\n/* Keep cells readable: property names (often links once resolved) never wrap, values have a\n minimum and maximum width and only break inside a word when they have no other choice.\n Selectors are deliberately specific to win over host page styles for the same classes. */\n.${Vi} .leaflet-popup-content .object-property {\n white-space: nowrap;\n word-break: normal;\n overflow-wrap: normal;\n}\n.${Vi} .leaflet-popup-content .object-value {\n min-width: 10em;\n max-width: 30em;\n word-break: normal;\n overflow-wrap: anywhere;\n}\n/* Let the popup content be the single scroll container (otherwise the table's own\n horizontal scrollbar ends up at the very bottom of a tall popup). */\n.${Vi} .object-properties {\n overflow: visible;\n width: 100%;\n}\n`;let Wi=!1;var Zi="undefined"!=typeof jsonld?jsonld:void 0,Ji=Object.freeze({__proto__:null,default:Zi});return t.createJsonLDGeoJSONLayer=async function(t,e,r={}){const{ldContext:s,popupOptions:n={},augmentOptions:a={},onEachFeature:o,coordRefSys:h,proj4:u,crsAttribution:l=!0,...c}=r;let d=e;const f=Gi(h?{coordRefSys:h}:e);if(null!==f){const t=null!=u?u:Yi;if(!t)throw new Error('proj4js is required for CRS transformation — include it via <script src="..."> or install it as a dependency');d=await async function(t,e,i){var r;const s=await Hi(e,i),n=async t=>{const r=Gi(t);let n=s;return null!==r&&r.epsgCode!==e.epsgCode&&(n=await Hi(r,i)),{...t,geometry:zi(t.geometry,n)}};return"FeatureCollection"===t.type?{...t,features:await Promise.all((null!==(r=t.features)&&void 0!==r?r:[]).map(n))}:"Feature"===t.type?n(t):t}(e,f,t)}const p=l&&null!==f?`Original CRS: EPSG:${f.epsgCode}`:null,_=[c.attribution,p].filter(Boolean).join(" | ")||void 0;return t.geoJSON(d,{...c,...void 0!==_?{attribution:_}:{},onEachFeature(t,r){if(o&&o(t,r),null!=t.id&&r.bindTooltip(String(t.id),{permanent:!1}),!t.properties||0===Object.keys(t.properties).length)return;const h=document.createElement("div");!function(t,e,i={propertiesField:"properties"}){const r=(t,e,i=!1)=>{if(Array.isArray(e)){for(const i of e)r(t,i).classList.add("array-entry");return t}if(null==e||"object"!=typeof e){const i=document.createElement("span");return i.classList.add("literal-value"),i.textContent=""+e,t.appendChild(i),i}{const s=document.createElement("table");s.classList.add("object-table"),i&&(s.innerHTML="<thead><tr><th>Property</th><th>Value</th></tr></thead>");const n=document.createElement("tbody");return Object.entries(e).forEach(([t,e])=>{const i=document.createElement("tr"),s=document.createElement("td");s.classList.add("object-property"),s.setAttribute("data-property",t),s.textContent=t,i.appendChild(s);const a=document.createElement("td");a.classList.add("object-value"),r(a,e),i.appendChild(a),n.appendChild(i)}),s.appendChild(n),t.appendChild(s),s}},s=document.createElement("div");s.classList.add("object-properties"),e.appendChild(s),i.propertiesField?r(s,t[i.propertiesField],!0):r(s,t,!0)}(t,h),function(){if(Wi||"undefined"==typeof document)return;Wi=!0;const t=document.createElement("style");t.setAttribute("data-jsonld-ui-utils","popup"),t.textContent=Xi,document.head.appendChild(t)}();const u=[Vi,n.className].filter(Boolean).join(" ");r.bindPopup(h,{maxWidth:1e4,...n,className:u}),function(t){if("undefined"==typeof ResizeObserver)return;let e=null;t.on("add",()=>{var i,r;const s=t._contentNode;if(!s)return;s.addEventListener("mousedown",()=>{const e=e=>{var i;(null===(i=t._container)||void 0===i?void 0:i.contains(e.target))||e.stopPropagation()};document.addEventListener("click",e,!0),document.addEventListener("mouseup",()=>{setTimeout(()=>document.removeEventListener("click",e,!0),0)},{once:!0,capture:!0})});const n=t._map,a=()=>{var e;const i=null===(e=null==n?void 0:n.getSize)||void 0===e?void 0:e.call(n);i&&t._container&&(t._container.style.setProperty("--jsonld-popup-max-width",`${Math.max(150,Math.min(.6*i.x,i.x-60))}px`),t._container.style.setProperty("--jsonld-popup-max-height",`${Math.max(100,Math.min(.7*i.y,i.y-110))}px`))};a(),t.update(),null==n||n.on("resize",a),t.once("remove",()=>null==n?void 0:n.off("resize",a));const o=null===(i=t.getContent())||void 0===i?void 0:i.firstElementChild;let h=null!==(r=null==o?void 0:o.offsetWidth)&&void 0!==r?r:0,u=!1;const l=o?new ResizeObserver(()=>{u||Math.abs(o.offsetWidth-h)<2||(h=o.offsetWidth,u=!0,requestAnimationFrame(()=>{u=!1,t._container&&!s.style.height&&(t.update(),h=o.offsetWidth)}))}):null;o&&l&&(l.observe(o),t.once("remove",()=>l.disconnect())),e=new ResizeObserver(()=>{t._container&&"function"==typeof t._updatePosition&&(t._containerWidth=t._container.offsetWidth,t._updatePosition())}),e.observe(s)}),t.on("remove",()=>{null==e||e.disconnect(),e=null})}(r.getPopup());const l=[null!=e&&"object"==typeof e&&"@context"in e?e["@context"]:null,s].filter(t=>null!=t);if(l.length>0){i(1===l.length?l[0]:l).then(t=>{Fi(h,t,a)})}}})},t}({});
|
|
25
|
+
Object.defineProperty(t,"__esModule",{value:!0}),t.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",t.NC_NAME_CHAR="-"+t.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.NC_NAME_START_CHAR_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]$","u"),t.NC_NAME_CHAR_RE=new RegExp("^["+t.NC_NAME_CHAR+"]$","u"),t.NC_NAME_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]["+t.NC_NAME_CHAR+"]*$","u"),t.isNCNameStartChar=e,t.isNCNameChar=function(t){return e(t)||45===t||46===t||t>=48&&t<=57||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Fe)),Fe);var r=t.isS,s=t.isChar,n=t.isNameStartChar,a=t.isNameChar,o=t.S_LIST,h=t.NAME_RE,u=e.isChar,l=i.isNCNameStartChar,c=i.isNCNameChar,d=i.NC_NAME_RE;const f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",_={__proto__:null,xml:f,xmlns:p},g={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},b=-1,m=-2,y=13,x=33,v=10,w=60,T=61,I=62,E=63,R=93,N=t=>34===t||39===t,S=[34,39],j=[...S,91,I],C=[...S,w,R],P=[T,E,...o],k=[...o,I,38,w];function A(t,e,i){switch(e){case"xml":i!==f&&t.fail(`xml prefix must be bound to ${f}.`);break;case"xmlns":i!==p&&t.fail(`xmlns prefix must be bound to ${p}.`)}switch(i){case p:t.fail(""===e?`the default namespace may not be set to ${i}.`:`may not assign a prefix (even "xmlns") to the URI ${p}.`);break;case f:switch(e){case"xml":break;case"":t.fail(`the default namespace may not be set to ${i}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}}}const $=t=>d.test(t),O=t=>h.test(t);je.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const D={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};return je.SaxesParser=class{get closed(){return this._closed}constructor(t){this.opt=null!=t?t:{},this.fragmentOpt=!!this.opt.fragment;const e=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,e){this.nameStartCheck=l,this.nameCheck=c,this.isName=$,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},_);const t=this.opt.additionalNamespaces;null!=t&&(!function(t,e){for(const i of Object.keys(e))A(t,i,e[i])}(this,t),Object.assign(this.ns,t))}else this.nameStartCheck=n,this.nameCheck=a,this.isName=O,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=0,this.attribList=[];const{fragmentOpt:e}=this;this.state=e?y:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=e,this.xmlDeclPossible=!e,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(void 0===i){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(g),null===(t=this.readyHandler)||void 0===t||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,e){this[D[t]]=e}off(t){this[D[t]]=void 0}makeError(t){var e;let i=null!==(e=this.fileName)&&void 0!==e?e:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+t)}fail(t){const e=this.makeError(t),i=this.errorHandler;if(void 0===i)throw e;return i(e),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let e=!1;null===t?(e=!0,t=""):"object"==typeof t&&(t=t.toString()),void 0!==this.carriedFromPrevious&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let i=t.length;const r=t.charCodeAt(i-1);!e&&(13===r||r>=55296&&r<=56319)&&(this.carriedFromPrevious=t[i-1],i--,t=t.slice(0,i));const{stateTable:s}=this;for(this.chunk=t,this.i=0;this.i<i;)s[this.state].call(this);return this.chunkPosition+=i,e?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>=32||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:return t.charCodeAt(e+1)===v&&(this.i=e+2),this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCode11(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>31&&i<127||i>159&&8232!==i||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:{const i=t.charCodeAt(e+1);i!==v&&133!==i||(this.i=e+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCodeNorm(){const t=this.getCode();return t===m?v:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:e}=this;const{chunk:i}=this;for(;;){const r=this.getCode(),s=r===m,n=s?v:r;if(n===b||t.includes(n))return this.text+=i.slice(e,this.prevI),n;s&&(this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i)}}captureToChar(t){let{i:e}=this;const{chunk:i}=this;for(;;){let r=this.getCode();switch(r){case m:this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i,r=v;break;case b:return this.text+=i.slice(e),!1}if(r===t)return this.text+=i.slice(e,this.prevI),!0}}captureNameChars(){const{chunk:t,i:e}=this;for(;;){const i=this.getCode();if(i===b)return this.name+=t.slice(e),b;if(!a(i))return this.name+=t.slice(e,this.prevI),i===m?v:i}}skipSpaces(){for(;;){const t=this.getCodeNorm();if(t===b||!r(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,"1.0"===t?(this.isChar=s,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){const t=this.i,e=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),e){case w:if(this.state=15,0!==this.text.length)throw new Error("no-empty text at start");break;case b:break;default:this.unget(),this.state=y,this.xmlDeclPossible=!1}}sDoctype(){var t;const e=this.captureTo(j);switch(e){case I:null===(t=this.doctypeHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y,this.doctype=!0;break;case b:break;default:this.text+=String.fromCodePoint(e),91===e?this.state=4:N(e)&&(this.state=3,this.q=e)}}sDoctypeQuote(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=2)}sDTD(){const t=this.captureTo(C);t!==b&&(this.text+=String.fromCodePoint(t),t===R?this.state=2:t===w?this.state=6:N(t)&&(this.state=5,this.q=t))}sDTDQuoted(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=4,this.q=null)}sDTDOpenWaka(){const t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case 33:this.state=7,this.openWakaBang="";break;case E:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){const t=String.fromCodePoint(this.getCodeNorm()),e=this.openWakaBang+=t;this.text+=t,"-"!==e&&(this.state="--"===e?8:4,this.openWakaBang="")}sDTDComment(){this.captureToChar(45)&&(this.text+="-",this.state=9)}sDTDCommentEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=45===t?10:8}sDTDCommentEnded(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I?this.state=4:(this.fail("malformed comment."),this.state=8)}sDTDPI(){this.captureToChar(E)&&(this.text+="?",this.state=12)}sDTDPIEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I&&(this.state=4)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this;const{chunk:e}=this;t:for(;;)switch(this.getCode()){case m:this.entity+=`${e.slice(t,this.prevI)}\n`,t=this.i;break;case 59:{const{entityReturnState:i}=this,r=this.entity+e.slice(t,this.prevI);let s;this.state=i,""===r?(this.fail("empty entity name."),s="&;"):(s=this.parseEntity(r),this.entity=""),i===y&&void 0===this.textHandler||(this.text+=s);break t}case b:this.entity+=e.slice(t);break t}}sOpenWaka(){const t=this.getCode();if(n(t))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(t){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang="",this.xmlDeclPossible=!1;break;case E:this.state=23;break;default:this.fail("disallowed character in tag name"),this.state=y,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=20,this.openWakaBang="";break;case"--":this.state=17,this.openWakaBang="";break;case"DOCTYPE":this.state=2,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(45)&&(this.state=18)}sCommentEnding(){var t;const e=this.getCodeNorm();45===e?(this.state=19,null===(t=this.commentHandler)||void 0===t||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(e)}`,this.state=17)}sCommentEnded(){const t=this.getCodeNorm();t!==I?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=17):this.state=y}sCData(){this.captureToChar(R)&&(this.state=21)}sCDataEnding(){const t=this.getCodeNorm();t===R?this.state=22:(this.text+=`]${String.fromCodePoint(t)}`,this.state=20)}sCDataEnding2(){var t;const e=this.getCodeNorm();switch(e){case I:null===(t=this.cdataHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y;break;case R:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(e)}`,this.state=20}}sPIFirstChar(){const t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=24):t===E||r(t)?(this.fail("processing instruction without a target."),this.state=t===E?26:25):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=24)}sPIRest(){const{chunk:t,i:e}=this;for(;;){const i=this.getCodeNorm();if(i===b)return void(this.piTarget+=t.slice(e));if(!this.nameCheck(i)){this.piTarget+=t.slice(e,this.prevI);const s=i===E;s||r(i)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=s?x:27):this.state=s?26:25:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(i));break}}}sPIBody(){if(0===this.text.length){const t=this.getCodeNorm();t===E?this.state=26:r(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(E)&&(this.state=26)}sPIEnding(){var t;const e=this.getCodeNorm();if(e===I){const{piTarget:e}=this;"xml"===e.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(t=this.piHandler)||void 0===t||t.call(this,{target:e,body:this.text}),this.piTarget=this.text="",this.state=y}else e===E?this.text+="?":(this.text+=`?${String.fromCodePoint(e)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const t=this.skipSpaces();t!==E?t!==b&&(this.state=28,this.name=String.fromCodePoint(t)):this.state=x}sXMLDeclName(){const t=this.captureTo(P);if(t===E)return this.state=x,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(r(t)||t===T){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=t===T?30:29}}sXMLDeclEq(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(t!==T&&this.fail("value required."),this.state=30)}sXMLDeclValueStart(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(N(t)?this.q=t:(this.fail("value must be quoted."),this.q=32),this.state=31)}sXMLDeclValue(){const t=this.captureTo([this.q,E]);if(t===E)return this.state=x,this.text="",void this.fail("XML declaration is incomplete.");if(t===b)return;const e=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const t=e;this.xmlDecl.version=t,/^1\.[0-9]+$/.test(t)?this.opt.forceXMLVersion||this.setXMLVersion(t):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(e)||this.fail("encoding value must match \t/^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=e;break;case"standalone":"yes"!==e&&"no"!==e&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=e}this.name="",this.state=32}sXMLDeclSeparator(){const t=this.getCodeNorm();t!==E?(r(t)||(this.fail("whitespace required."),this.unget()),this.state=27):this.state=x}sXMLDeclEnding(){var t;this.getCodeNorm()===I?("xml"!==this.piTarget?this.fail("processing instructions are not allowed before root."):"version"!==this.name&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),null===(t=this.xmldeclHandler)||void 0===t||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=y):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;const e=this.captureNameChars();if(e===b)return;const i=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=i.ns=Object.create(null)),null===(t=this.openTagStartHandler)||void 0===t||t.call(this,i),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),e){case I:this.openTag();break;case 47:this.state=35;break;default:r(e)||this.fail("disallowed character in tag name."),this.state=36}}sOpenTagSlash(){this.getCode()===I?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=36)}sAttrib(){const t=this.skipSpaces();t!==b&&(n(t)?(this.unget(),this.state=37):t===I?this.openTag():47===t?this.state=35:this.fail("disallowed character in attribute name."))}sAttribName(){const t=this.captureNameChars();t===T?this.state=39:r(t)?this.state=38:t===I?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==b&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const t=this.skipSpaces();switch(t){case b:return;case T:this.state=39;break;default:this.fail("attribute without value."),this.text="",this.name="",t===I?this.openTag():n(t)?(this.unget(),this.state=37):(this.fail("disallowed character in attribute name."),this.state=36)}}sAttribValue(){const t=this.getCodeNorm();N(t)?(this.q=t,this.state=40):r(t)||(this.fail("unquoted attribute value."),this.state=42,this.unget())}sAttribValueQuoted(){const{q:t,chunk:e}=this;let{i:i}=this;for(;;)switch(this.getCode()){case t:return this.pushAttrib(this.name,this.text+e.slice(i,this.prevI)),this.name=this.text="",this.q=null,void(this.state=41);case 38:return this.text+=e.slice(i,this.prevI),this.state=14,void(this.entityReturnState=40);case v:case m:case 9:this.text+=`${e.slice(i,this.prevI)} `,i=this.i;break;case w:return this.text+=e.slice(i,this.prevI),void this.fail("disallowed character.");case b:return void(this.text+=e.slice(i))}}sAttribValueClosed(){const t=this.getCodeNorm();r(t)?this.state=36:t===I?this.openTag():47===t?this.state=35:n(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=37):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const t=this.captureTo(k);switch(t){case 38:this.state=14,this.entityReturnState=42;break;case w:this.fail("disallowed character.");break;case b:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===I?this.openTag():this.state=36}}sCloseTag(){const t=this.captureNameChars();t===I?this.closeTag():r(t)?this.state=44:t!==b&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case I:this.closeTag();break;case b:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:e}=this;const{chunk:i,textHandler:r}=this;t:for(;;)switch(this.getCode()){case w:if(this.state=15,void 0!==r){const{text:e}=this,s=i.slice(t,this.prevI);0!==e.length?(r(e+s),this.text=""):0!==s.length&&r(s)}e=0;break t;case 38:this.state=14,this.entityReturnState=y,void 0!==r&&(this.text+=i.slice(t,this.prevI)),e=0;break t;case R:switch(e){case 0:e=1;break;case 1:e=2;break;case 2:break;default:throw new Error("impossible state")}break;case I:2===e&&this.fail('the string "]]>" is disallowed in char data.'),e=0;break;case m:void 0!==r&&(this.text+=`${i.slice(t,this.prevI)}\n`),t=this.i,e=0;break;case b:void 0!==r&&(this.text+=i.slice(t));break t;default:e=0}this.forbiddenState=e}handleTextOutsideRoot(){let{i:t}=this;const{chunk:e,textHandler:i}=this;let s=!1;t:for(;;){const n=this.getCode();switch(n){case w:if(this.state=15,void 0!==i){const{text:r}=this,s=e.slice(t,this.prevI);0!==r.length?(i(r+s),this.text=""):0!==s.length&&i(s)}break t;case 38:this.state=14,this.entityReturnState=y,void 0!==i&&(this.text+=e.slice(t,this.prevI)),s=!0;break t;case m:void 0!==i&&(this.text+=`${e.slice(t,this.prevI)}\n`),t=this.i;break;case b:void 0!==i&&(this.text+=e.slice(t));break t;default:r(n)||(s=!0)}}s&&(this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(t,e){var i;const{prefix:r,local:s}=this.qname(t),n={name:t,prefix:r,local:s,value:e};if(this.attribList.push(n),null===(i=this.attributeHandler)||void 0===i||i.call(this,n),"xmlns"===r){const t=e.trim();"1.0"===this.currentXMLVersion&&""===t&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[s]=t,A(this,s,t)}else if("xmlns"===t){const t=e.trim();this.topNS[""]=t,A(this,"",t)}}pushAttribPlain(t,e){var i;const r={name:t,value:e};this.attribList.push(r),null===(i=this.attributeHandler)||void 0===i||i.call(this,r)}end(){var t,e;this.sawRoot||this.fail("document must contain a root element.");const{tags:i}=this;for(;i.length>0;){const t=i.pop();this.fail(`unclosed tag: ${t.name}`)}0!==this.state&&this.state!==y&&this.fail("unexpected end.");const{text:r}=this;return 0!==r.length&&(null===(t=this.textHandler)||void 0===t||t.call(this,r),this.text=""),this._closed=!0,null===(e=this.endHandler)||void 0===e||e.call(this),this._init(),this}resolve(t){var e,i;let r=this.topNS[t];if(void 0!==r)return r;const{tags:s}=this;for(let e=s.length-1;e>=0;e--)if(r=s[e].ns[t],void 0!==r)return r;return r=this.ns[t],void 0!==r?r:null===(i=(e=this.opt).resolvePrefix)||void 0===i?void 0:i.call(e,t)}qname(t){const e=t.indexOf(":");if(-1===e)return{prefix:"",local:t};const i=t.slice(e+1),r=t.slice(0,e);return(""===r||""===i||i.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:r,local:i}}processAttribsNS(){var t;const{attribList:e}=this,i=this.tag;{const{prefix:e,local:r}=this.qname(i.name);i.prefix=e,i.local=r;const s=i.uri=null!==(t=this.resolve(e))&&void 0!==t?t:"";""!==e&&("xmlns"===e&&this.fail('tags may not have "xmlns" as prefix.'),""===s&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),i.uri=e))}if(0===e.length)return;const{attributes:r}=i,s=new Set;for(const t of e){const{name:e,prefix:i,local:n}=t;let a,o;""===i?(a="xmlns"===e?p:"",o=e):(a=this.resolve(i),void 0===a&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),a=i),o=`{${a}}${n}`),s.has(o)&&this.fail(`duplicate attribute: ${o}.`),s.add(o),t.uri=a,r[e]=t}this.attribList=[]}processAttribsPlain(){const{attribList:t}=this,e=this.tag.attributes;for(const{name:i,value:r}of t)void 0!==e[i]&&this.fail(`duplicate attribute: ${i}.`),e[i]=r;this.attribList=[]}openTag(){var t;this.processAttribs();const{tags:e}=this,i=this.tag;i.isSelfClosing=!1,null===(t=this.openTagHandler)||void 0===t||t.call(this,i),e.push(i),this.state=y,this.name=""}openSelfClosingTag(){var t,e,i;this.processAttribs();const{tags:r}=this,s=this.tag;s.isSelfClosing=!0,null===(t=this.openTagHandler)||void 0===t||t.call(this,s),null===(e=this.closeTagHandler)||void 0===e||e.call(this,s);null===(this.tag=null!==(i=r[r.length-1])&&void 0!==i?i:null)&&(this.closedRoot=!0),this.state=y,this.name=""}closeTag(){const{tags:t,name:e}=this;if(this.state=y,this.name="",""===e)return this.fail("weird empty close tag."),void(this.text+="</>");const i=this.closeTagHandler;let r=t.length;for(;r-- >0;){const r=this.tag=t.pop();if(this.topNS=r.ns,null==i||i(r),r.name===e)break;this.fail("unexpected close tag.")}0===r?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${e}.`),this.text+=`</${e}>`)}parseEntity(t){if("#"!==t[0]){const e=this.ENTITIES[t];return void 0!==e?e:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let e=NaN;return"x"===t[1]&&/^#x[0-9a-f]+$/i.test(t)?e=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(e=parseInt(t.slice(1),10)),this.isChar(e)?String.fromCodePoint(e):(this.fail("malformed character entity."),`&${t};`)}},je}var Me,Be=xe(ce),qe={};function Ue(){if(Me)return qe;Me=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.ParseError=void 0;let t=class extends Error{constructor(t,e){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${e}`:e)}};return qe.ParseError=t,qe}var Ge,He={},Qe={};function ze(){if(Ge)return Qe;Ge=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.BlankNode=void 0;return Qe.BlankNode=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&"BlankNode"===t.termType&&t.value===this.value}},Qe}var Ye,Ve={},Xe={};function We(){if(Ye)return Xe;Ye=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.DefaultGraph=void 0;let t=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&"DefaultGraph"===t.termType}};return Xe.DefaultGraph=t,t.INSTANCE=new t,Xe}var Ze,Je,Ke={},ti={};function ei(){if(Ze)return ti;Ze=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.NamedNode=void 0;return ti.NamedNode=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&"NamedNode"===t.termType&&t.value===this.value}},ti}function ii(){if(Je)return Ke;Je=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.Literal=void 0;const t=ei();let e=class t{constructor(e,i){this.termType="Literal",this.value=e,"string"==typeof i?(this.language=i,this.datatype=t.RDF_LANGUAGE_STRING):i?(this.language="",this.datatype=i):(this.language="",this.datatype=t.XSD_STRING)}equals(t){return!!t&&"Literal"===t.termType&&t.value===this.value&&t.language===this.language&&this.datatype.equals(t.datatype)}};return Ke.Literal=e,e.RDF_LANGUAGE_STRING=new t.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.XSD_STRING=new t.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Ke}var ri,si={};function ni(){if(ri)return si;ri=1,Object.defineProperty(si,"__esModule",{value:!0}),si.Quad=void 0;return si.Quad=class{constructor(t,e,i,r){this.termType="Quad",this.value="",this.subject=t,this.predicate=e,this.object=i,this.graph=r}equals(t){return!!t&&("Quad"===t.termType||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}},si}var ai,oi,hi,ui={};function li(){if(ai)return ui;ai=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.Variable=void 0;return ui.Variable=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&"Variable"===t.termType&&t.value===this.value}},ui}function ci(){return hi||(hi=1,t=He,e=He&&He.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=He&&He.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(ze(),t),i(function(){if(oi)return Ve;oi=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.DataFactory=void 0;const t=ze(),e=We(),i=ii(),r=ei(),s=ni(),n=li();let a=0;return Ve.DataFactory=class{constructor(t){this.blankNodeCounter=0,t=t||{},this.blankNodePrefix=t.blankNodePrefix||`df_${a++}_`}namedNode(t){return new r.NamedNode(t)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(t,e){return new i.Literal(t,e)}variable(t){return new n.Variable(t)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(t,e,i,r){return new s.Quad(t,e,i,r||this.defaultGraph())}fromTerm(t){switch(t.termType){case"NamedNode":return this.namedNode(t.value);case"BlankNode":return this.blankNode(t.value);case"Literal":return t.language?this.literal(t.value,t.language):t.datatype.equals(i.Literal.XSD_STRING)?this.literal(t.value):this.literal(t.value,this.fromTerm(t.datatype));case"Variable":return this.variable(t.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(t.subject),this.fromTerm(t.predicate),this.fromTerm(t.object),this.fromTerm(t.graph))}}fromQuad(t){return this.fromTerm(t)}resetBlankNodeCounter(){this.blankNodeCounter=0}},Ve}(),t),i(We(),t),i(ii(),t),i(ei(),t),i(ni(),t),i(li(),t)),He;var t,e,i}var di,fi,pi,_i,gi={},bi={};function mi(){return fi||(fi=1,t=gi,e=gi&&gi.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=gi&&gi.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i((di||(di=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateIri=t.IriValidationStrategy=void 0;const e=function(){const t="[!$&'()*+,;=]",e="%[a-fA-F0-9]{2}",i="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",r=`${i}\\.${i}\\.${i}\\.${i}`,s="[a-fA-F0-9]{1,4}",n=`(${s}:${s}|${r})`,a="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",o=`(${a}|${e}|${t}|[:@])*`,h=`(${o})+`,u=`(${o})*`;return new RegExp(`^[a-zA-Z][a-zA-Z0-9+\\-.]*:(\\/\\/((${a}|${e}|${t}|:)*@)?(\\[(((${s}:){6}${n}|::(${s}:){5}${n}|(${s})?::(${s}:){4}${n}|((${s}:){0,1}${s})?::(${s}:){3}${n}|((${s}:){0,2}${s})?::(${s}:){2}${n}|((${s}:){0,3}${s})?::${s}:${n}|((${s}:){0,4}${s})?::${n}|((${s}:){0,5}${s})?::${s}|((${s}:){0,6}${s})?::)|v[a-fA-F0-9]+\\.(${t}|${t}|":)+)\\]|${r}|(${a}|${e}|${t})*)(:[0-9]*)?(\\/${u})*|\\/(${h}(\\/${u})*)?|${h}(\\/${u})*|)(\\?(${o}|[---]|[\\/?])*)?(#(${o}|[\\/?])*)?$`,"u")}(),i=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var r;!function(t){t.Strict="strict",t.Pragmatic="pragmatic",t.None="none"}(r=t.IriValidationStrategy||(t.IriValidationStrategy={})),t.validateIri=function(t,s=r.Strict){switch(s){case r.Strict:return e.test(t)?void 0:new Error(`Invalid IRI according to RFC 3987: '${t}'`);case r.Pragmatic:return i.test(t)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${t}'`);case r.None:return;default:return new Error(`Not supported validation strategy "${s}"`)}}}(bi)),bi),t)),gi;var t,e,i}function yi(){if(pi)return Ie;pi=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.ParseType=Ie.RdfXmlParser=void 0;const t=Ne(),e=Le(),i=Be,r=Ue(),s=ci(),n=mi();let a=class a extends i.Transform{constructor(t){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},t&&(Object.assign(this,t),this.options=t),this.dataFactory||(this.dataFactory=new s.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),!1!==this.validateUri&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?n.IriValidationStrategy.Pragmatic:n.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){const e=new i.PassThrough({readableObjectMode:!0});t.on("error",t=>r.emit("error",t)),t.on("data",t=>e.push(t)),t.on("end",()=>e.push(null));const r=e.pipe(new a(this.options));return r}_transform(t,e,i){try{this.saxParser.write(t)}catch(t){return i(t)}i()}newParseError(t){return new r.ParseError(this,t)}valueToUri(e,i){return this.uriToNamedNode((0,t.resolve)(e,i.baseIRI))}uriToNamedNode(t){const e=(0,n.validateIri)(t,this.iriValidationStrategy);if(e instanceof Error)throw this.newParseError(e.message);return this.dataFactory.namedNode(t)}validateNcname(t){if(!a.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}attachSaxListeners(){this.saxParser.on("error",t=>this.emit("error",t)),this.saxParser.on("opentag",this.onTag.bind(this)),this.saxParser.on("text",this.onText.bind(this)),this.saxParser.on("cdata",this.onText.bind(this)),this.saxParser.on("closetag",this.onCloseTag.bind(this)),this.saxParser.on("doctype",this.onDoctype.bind(this))}onTag(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let i=o.RESOURCE;if(e&&(e.hadChildren=!0,i=e.childrenParseType),e&&e.childrenStringTags){const i=t.name;let r="";for(const e in t.attributes)r+=` ${e}="${t.attributes[e].value}"`;const s=`<${`${i}${r}`}>`;e.childrenStringTags.push(s);const n={childrenStringTags:e.childrenStringTags};return n.childrenStringEmitClosingTag=`</${i}>`,void this.activeTagStack.push(n)}const r={};e?(r.language=e.language,r.baseIRI=e.baseIRI):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),i===o.RESOURCE?this.onTagResource(t,r,e,!e):this.onTagProperty(t,r,e)}onTagResource(e,i,r,s){i.childrenParseType=o.PROPERTY;let n=!0;if(e.uri===a.RDF){if(!s&&a.FORBIDDEN_NODE_ELEMENTS.indexOf(e.local)>=0)throw this.newParseError(`Illegal node element name: ${e.local}`);switch(e.local){case"RDF":i.childrenParseType=o.RESOURCE;case"Description":n=!1}}const h=[],u=[];let l=null,c=!1,d=!1,f=null;for(const s in e.attributes){const n=e.attributes[s];if(r&&n.uri===a.RDF)switch(n.local){case"about":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);l=n.value;continue;case"ID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l="#"+n.value,c=!0;continue;case"nodeID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l=n.value,d=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":f=n.value;continue;case"aboutEach":throw this.newParseError("rdf:aboutEach is not supported.");case"aboutEachPrefix":throw this.newParseError("rdf:aboutEachPrefix is not supported.");case"li":throw this.newParseError("rdf:li on node elements are not supported.")}else if(n.uri===a.XML){if("lang"===n.local){i.language=""===n.value?null:n.value.toLowerCase();continue}if("base"===n.local){i.baseIRI=(0,t.resolve)(n.value,i.baseIRI);continue}}"xml"===n.prefix||"xmlns"===n.prefix||""===n.prefix&&"xmlns"===n.local||!n.uri||(h.push(this.uriToNamedNode(n.uri+n.local)),u.push(n.value))}if(null!==l&&(i.subject=d?this.dataFactory.blankNode(l):this.valueToUri(l,i),c&&this.claimNodeId(i.subject)),i.subject||(i.subject=this.dataFactory.blankNode()),n){const t=this.uriToNamedNode(e.uri+e.local);this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),t,r?r.reifiedStatementId:null)}if(r){if(r.predicate)if(r.childrenCollectionSubject){const t=this.dataFactory.blankNode();this.emitTriple(r.childrenCollectionSubject,r.childrenCollectionPredicate,t,r.reifiedStatementId),this.emitTriple(t,this.dataFactory.namedNode(a.RDF+"first"),i.subject,i.reifiedStatementId),r.childrenCollectionSubject=t,r.childrenCollectionPredicate=this.dataFactory.namedNode(a.RDF+"rest")}else{this.emitTriple(r.subject,r.predicate,i.subject,r.reifiedStatementId);for(let t=0;t<r.predicateSubPredicates.length;t++)this.emitTriple(i.subject,r.predicateSubPredicates[t],r.predicateSubObjects[t],null);r.predicateSubPredicates=[],r.predicateSubObjects=[],r.predicateEmitted=!0}for(let t=0;t<h.length;t++){const e=this.dataFactory.literal(u[t],i.datatype||i.language);this.emitTriple(i.subject,h[t],e,r.reifiedStatementId)}f&&this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),this.uriToNamedNode(f),null)}}onTagProperty(t,e,i){if(e.childrenParseType=o.RESOURCE,e.subject=i.subject,t.uri===a.RDF&&"li"===t.local?(i.listItemCounter||(i.listItemCounter=1),e.predicate=this.uriToNamedNode(t.uri+"_"+i.listItemCounter++)):e.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===a.RDF&&a.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);e.predicateSubPredicates=[],e.predicateSubObjects=[];let r=!1,s=!1,n=null,h=!0;const u=[],l=[];for(const i in t.attributes){const c=t.attributes[i];if(c.uri===a.RDF)switch(c.local){case"resource":if(n)throw this.newParseError(`Found both rdf:resource (${c.value}) and rdf:nodeID (${n}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${c.value})`);e.hadChildren=!0,n=c.value,h=!1;continue;case"datatype":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.value})`);e.datatype=this.valueToUri(c.value,e);continue;case"nodeID":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${c.value}).`);if(e.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${c.value})`);this.validateNcname(c.value),e.hadChildren=!0,n=c.value,h=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(s)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(e.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${e.datatype.value})`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${n})`);if("Resource"===c.value){r=!0,e.childrenParseType=o.PROPERTY;const t=this.dataFactory.blankNode();this.emitTriple(e.subject,e.predicate,t,e.reifiedStatementId),e.subject=t,e.predicate=null}else"Collection"===c.value?(r=!0,e.hadChildren=!0,e.childrenCollectionSubject=e.subject,e.childrenCollectionPredicate=e.predicate,h=!1):"Literal"===c.value&&(r=!0,e.childrenTagsToString=!0,e.childrenStringTags=[]);continue;case"ID":this.validateNcname(c.value),e.reifiedStatementId=this.valueToUri("#"+c.value,e),this.claimNodeId(e.reifiedStatementId);continue}else if(c.uri===a.XML&&"lang"===c.local){e.language=""===c.value?null:c.value.toLowerCase();continue}if("xml"!==c.prefix&&"xmlns"!==c.prefix&&(""!==c.prefix||"xmlns"!==c.local)&&c.uri){if(r||e.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${c.value}`);e.hadChildren=!0,s=!0,u.push(this.uriToNamedNode(c.uri+c.local)),l.push(this.dataFactory.literal(c.value,e.datatype||e.language))}}if(null!==n){const t=e.subject;e.subject=h?this.dataFactory.blankNode(n):this.valueToUri(n,e),this.emitTriple(t,e.predicate,e.subject,e.reifiedStatementId);for(let t=0;t<u.length;t++)this.emitTriple(e.subject,u[t],l[t],null);e.predicateEmitted=!0}else h&&(e.predicateSubPredicates=u,e.predicateSubObjects=l,e.predicateEmitted=!1)}emitTriple(t,e,i,r){this.push(this.dataFactory.quad(t,e,i,this.defaultGraph)),r&&(this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"type"),this.dataFactory.namedNode(a.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"subject"),t,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"predicate"),e,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"object"),i,this.defaultGraph)))}claimNodeId(t){if(!this.allowDuplicateRdfIds){if(this.nodeIds[t.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${t.value}'.`);this.nodeIds[t.value]=!0}}onText(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;e&&(e.childrenStringTags?e.childrenStringTags.push(t):e.predicate&&(e.text=t))}onCloseTag(){const t=this.activeTagStack.pop();if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(a.RDF+"XMLLiteral"),t.text=t.childrenStringTags.join(""),t.hadChildren=!1),t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(a.RDF+"nil"),t.reifiedStatementId);else if(t.predicate)if(t.hadChildren||t.childrenParseType===o.PROPERTY){if(!t.predicateEmitted){const e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId);for(let i=0;i<t.predicateSubPredicates.length;i++)this.emitTriple(e,t.predicateSubPredicates[i],t.predicateSubObjects[i],null)}}else this.emitTriple(t.subject,t.predicate,this.dataFactory.literal(t.text||"",t.datatype||t.language),t.reifiedStatementId)}onDoctype(t){t.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(t,e,i)=>(this.saxParser.ENTITIES[e]=i,""))}};var o;return Ie.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,function(t){t[t.RESOURCE=0]="RESOURCE",t[t.PROPERTY=1]="PROPERTY"}(o||(Ie.ParseType=o={})),Ie}function xi(){return _i||(_i=1,t=Te,e=Te&&Te.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Te&&Te.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(yi(),t)),Te;var t,e,i}var vi=xi();const wi={labelPredicates:l,descriptionPredicates:c},Ti={},Ii={},Ei=new Set(["text/turtle","text/n3","application/n-triples","application/n-quads","application/trig","text/anot+turtle"]),Ri=["text/turtle","application/n-triples","application/n-quads","application/trig","application/ld+json","application/rdf+xml"].join(", ");function Ni(t,e,i,r=function(){var t;if("undefined"!=typeof navigator&&(null===(t=navigator.languages)||void 0===t?void 0:t.length))return Array.from(navigator.languages);try{return[Intl.DateTimeFormat().resolvedOptions().locale]}catch(t){return[]}}()){const s=Rt.namedNode(e);for(const e of i){const i=t.getQuads(s,Rt.namedNode(e),null,null).filter(t=>"Literal"===t.object.termType);if(!i.length)continue;for(const t of r){const e=t.split("-")[0].toLowerCase(),r=i.find(i=>{var r;const s=null===(r=i.object.language)||void 0===r?void 0:r.toLowerCase();return s===t.toLowerCase()||(null==s?void 0:s.split("-")[0])===e});if(r)return r.object.value}const n=i.find(t=>!t.object.language);if(n)return n.object.value;const a=i.find(t=>{var e;return"en"===(null===(e=t.object.language)||void 0===e?void 0:e.toLowerCase())});return(null!=a?a:i[0]).object.value}return null}function Si(t,e,i){const r=new be,s=new Gt({baseIRI:e,format:"text/anot+turtle"===i?"text/turtle":i});return new Promise((e,i)=>{s.parse(t,(t,s)=>{if(t)return i(t);s?r.addQuad(s):e(r)})})}const ji=t=>t?Array.isArray(t)?t:[t]:[],Ci=t=>`DESCRIBE <${t}>`,Pi=async(t,e)=>{var i;let r;try{if(r=await t(),!r.ok)return null}catch(t){return null}const s=(null===(i=r.headers.get("content-type"))||void 0===i?void 0:i.split(";")[0].trim())||"text/turtle",n=await r.text();try{if(Ei.has(s))return Si(n,e,s);if("application/ld+json"===s)return async function(t,e){const i=await Promise.resolve().then(function(){return Ji});if(!i)throw new Error("jsonld peer dependency is not available");const r=JSON.parse(t);return Si(await i.toRDF(r,{format:"application/n-quads",base:e}),e,"application/n-quads")}(n,e);if("application/rdf+xml"===s)return async function(t,e){const i=new be;return new Promise((r,s)=>{const n=new vi.RdfXmlParser({baseIRI:e});n.on("data",t=>i.addQuad(t)),n.on("error",s),n.on("end",()=>r(i)),n.write(t),n.end()})}(n,e)}catch(t){}return null},ki=(t,e,i=t)=>(t in Ii||(Ii[t]=Pi(e,i)),Ii[t]),Ai=t=>"undefined"!=typeof location&&"https:"===location.protocol&&t.startsWith("http://")?"https://"+t.slice(7):null,$i=async(t,e,i)=>{const r=await t;if(!r)return null;const s=Ai(e);for(const t of s?[e,s]:[e]){const s=Ni(r,t,i.labelPredicates);if(s)return{uri:e,label:s,description:Ni(r,t,i.descriptionPredicates)}}return null};async function Oi(t,e={}){const i={...wi,...e};return t in Ti||(Ti[t]=(async(t,e)=>{const i=t.includes("#")?t.split("#")[0]:t;let r=null;const s=Ai(i);s&&(r=await $i(ki(s,()=>fetch(s,{headers:{Accept:Ri}}),i),t,e)),r||(r=await $i(ki(i,()=>fetch(i,{headers:{Accept:Ri}})),t,e));const n=t.includes("#");for(const i of[...ji(e.fallbackRainbowInstances),...ji(e.fallbackRainbowInstance)]){if(r||n)break;const s=new URL(i);s.searchParams.set("uri",t);const a=s.toString();r=await $i(ki(a,()=>fetch(a,{headers:{Accept:Ri}})),t,e)}for(const i of[...ji(e.fallbackSparqlEndpoints),...ji(e.fallbackSparqlEndpoint)]){if(r)break;const s=new URLSearchParams({query:Ci(t)});r=await $i(Pi(()=>fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"text/turtle, application/n-triples"},body:s.toString()}),t),t,e)}if(!r)throw new Error(`No label data found for <${t}>`);return r})(t,i)),Ti[t]}const Di={replaceElements:!0,...wi};async function Fi(t,e,i={}){const r={...Di,...i},s=(t,e,i=!0,r=!1)=>{if(-1!==t.indexOf("://"))return{"@id":t};let n=null,a=null;for(let i=e.length-1;i>=0;i--){if(t in e[i]){let r,n=e[i][t];if(null==n||"boolean"==typeof n||Array.isArray(n))continue;if("string"==typeof n){if("@type"===n)return{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"};r=n,n={"@id":n}}else{if("object"!=typeof n||!("@id"in n)||"string"!=typeof n["@id"])continue;r=n["@id"]}const a=r.indexOf(":");if(a>-1){const t=r.substring(0,a),i=r.substring(a+1);if(i.startsWith("//"))return n;const o=s(t,e);return null!==o&&"@id"in o&&"string"==typeof o["@id"]&&(n["@id"]=`${o["@id"]}${i}`),n}}null===n&&e[i]["@vocab"]&&(n=e[i]["@vocab"]),null===a&&e[i]["@base"]&&(a=e[i]["@base"])}if(-1===t.indexOf(":")){if(i&&n)return{"@id":`${n}${t}`};if(r&&a)return{"@id":`${a}${t}`}}else{const i=t.indexOf(":"),r=t.substring(0,i),n=t.substring(i+1);if(!n.startsWith("//")){const t=s(r,e);if(null!==t&&"@id"in t&&"string"==typeof t["@id"])return{"@id":`${t["@id"]}${n}`}}}return null},n=t=>{const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(t){const i=t;return i.classList.contains("object-property")||i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("literal-value")?(e.push(i),NodeFilter.FILTER_REJECT):NodeFilter.FILTER_SKIP}});for(;i.nextNode(););return e},a=(t,e,i=!0)=>{if(t.setAttribute("data-uri",e),t.classList.add("resource-loading"),Oi(e,r).then(e=>{let i=t.querySelector(".resource-link")||t;e.label&&(t.setAttribute("data-label",e.label),r.replaceElements&&(i.textContent=e.label)),e.description&&(t.setAttribute("data-description",e.description),r.replaceElements&&(i.title=e.description)),t.classList.add("resource-resolved")}).catch(i=>{console.error(`Error resolving URI ${e}: ${i}`,{cause:i}),t.classList.add("resource-error")}).finally(()=>{t.classList.remove("resource-loading")}),i){const i=document.createElement("a");for(i.href=e,i.target="_blank",i.classList.add("resource-link");t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i)}},o=(t,e)=>{var i;const h=(t=>{const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(e){const i=e;return e!==t&&i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("object-property")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=[];let r;for(;r=e.nextNode();)i.push(r);return i})(t);for(const t of h){let h=null;h=t.getAttribute("data-property"),h||(h=t.textContent.trim());const u=s(h,e);let l=e;const c=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector(".object-value");if(u&&"@id"in u&&"string"==typeof u["@id"]){const i=u["@id"];if(a(t,i,r.replaceElements),"@context"in u&&(l=[...e,u["@context"]]),"@id"===u["@type"]&&c){n(c).forEach(t=>{const e=s(t.textContent.trim(),l,!1,!0);if(e&&"@id"in e&&"string"==typeof e["@id"]){const i=e["@id"];a(t,i,r.replaceElements)}})}}c&&o(c,l)}};o(t,[e])}const Li=new Set([4326,4979]),Mi=new Map;function Bi(t){let e=t.match(/\/crs\/EPSG\/[^/]+\/(\d+)$/i);return e?parseInt(e[1],10):(e=t.match(/urn:ogc:def:crs:EPSG::(\d+)$/i),e?parseInt(e[1],10):(e=t.match(/^EPSG:(\d+)$/),e?parseInt(e[1],10):null))}function qi(t){const e=Bi(t);return null!==e?Li.has(e):/\/OGC\/[^/]+\/CRS84h?$/i.test(t)||/urn:ogc:def:crs:OGC:[^:]*:CRS84h?$/i.test(t)}function Ui(t){if("string"==typeof t){if(qi(t))return null;const e=Bi(t);return null!==e?{epsgCode:e}:null}if(null!==t&&"object"==typeof t){const e=t;if("Reference"===e.type&&"string"==typeof e.href){if(qi(e.href))return null;const t=Bi(e.href);return null===t?null:{epsgCode:t,epoch:"number"==typeof e.epoch?e.epoch:void 0}}}return null}function Gi(t){if(!t||"object"!=typeof t)return null;const e=t;if("coordRefSys"in e){const t=function(t){if(Array.isArray(t)){for(const e of t){const t=Ui(e);if(null!==t)return t}return null}return Ui(t)}(e.coordRefSys);if(null!==t)return t}if("crs"in e){const t=function(t){if(!t||"object"!=typeof t)return null;const e=t;if("name"!==e.type)return null;const i=e.properties;if(!i||"object"!=typeof i)return null;const r=i.name;if("string"!=typeof r)return null;if(qi(r))return null;const s=Bi(r);return null!==s?{epsgCode:s}:null}(e.crs);if(null!==t)return t}return null}async function Hi(t,e){const i=`EPSG:${t.epsgCode}`;if(void 0!==t.epoch&&console.warn(`CRS epoch ${t.epoch} ignored — proj4js does not support coordinate epochs.`),!e.defs(i)){let r=Mi.get(t.epsgCode);if(!r){const e=await fetch(`https://epsg.io/${t.epsgCode}.proj4`);if(!e.ok)throw new Error(`Unknown CRS EPSG:${t.epsgCode} — could not retrieve a definition from epsg.io (HTTP ${e.status})`);if(r=(await e.text()).trim(),!r)throw new Error(`Unknown CRS EPSG:${t.epsgCode} — epsg.io returned an empty definition`);Mi.set(t.epsgCode,r)}e.defs(i,r)}return e(i,"WGS84")}function Qi(t,e){const i=e.forward(t.slice(0,2));return t.length>2?[i[0],i[1],t[2]]:[i[0],i[1]]}function zi(t,e){if(!t)return t;switch(t.type){case"Point":return{...t,coordinates:Qi(t.coordinates,e)};case"MultiPoint":case"LineString":return{...t,coordinates:t.coordinates.map(t=>Qi(t,e))};case"MultiLineString":case"Polygon":return{...t,coordinates:t.coordinates.map(t=>t.map(t=>Qi(t,e)))};case"MultiPolygon":return{...t,coordinates:t.coordinates.map(t=>t.map(t=>t.map(t=>Qi(t,e))))};case"GeometryCollection":return{...t,geometries:t.geometries.map(t=>zi(t,e))};default:return t}}var Yi="undefined"!=typeof proj4?proj4:void 0;const Vi="jsonld-ui-popup",Xi=`\n.${Vi} .leaflet-popup-content {\n overflow: auto;\n resize: both;\n box-sizing: border-box;\n min-width: 150px;\n min-height: 60px;\n max-width: var(--jsonld-popup-max-width, 90vw) !important;\n max-height: var(--jsonld-popup-max-height, 80vh) !important;\n}\n/* Keep cells readable: property names (often links once resolved) never wrap. Width limits apply\n to leaf text only, never to cells that hold nested tables (those must be free to grow, or the\n nested table overflows its cell). Selectors are deliberately specific to win over host page\n styles for the same classes (e.g. max-width / word-break: break-all on .object-value). */\n.${Vi} .leaflet-popup-content .object-property {\n white-space: nowrap;\n word-break: normal;\n overflow-wrap: normal;\n}\n.${Vi} .leaflet-popup-content .object-value {\n min-width: 0;\n max-width: none;\n word-break: normal;\n overflow-wrap: normal;\n}\n.${Vi} .leaflet-popup-content .literal-value {\n display: inline-block;\n vertical-align: top;\n min-width: 10em;\n max-width: 30em;\n overflow-wrap: anywhere;\n}\n/* Let the popup content be the single scroll container (otherwise the table's own\n horizontal scrollbar ends up at the very bottom of a tall popup). */\n.${Vi} .object-properties {\n overflow: visible;\n width: 100%;\n}\n`;let Wi=!1;var Zi="undefined"!=typeof jsonld?jsonld:void 0,Ji=Object.freeze({__proto__:null,default:Zi});return t.createJsonLDGeoJSONLayer=async function(t,e,r={}){const{ldContext:s,popupOptions:n={},augmentOptions:a={},onEachFeature:o,coordRefSys:h,proj4:u,crsAttribution:l=!0,...c}=r;let d=e;const f=Gi(h?{coordRefSys:h}:e);if(null!==f){const t=null!=u?u:Yi;if(!t)throw new Error('proj4js is required for CRS transformation — include it via <script src="..."> or install it as a dependency');d=await async function(t,e,i){var r;const s=await Hi(e,i),n=async t=>{const r=Gi(t);let n=s;return null!==r&&r.epsgCode!==e.epsgCode&&(n=await Hi(r,i)),{...t,geometry:zi(t.geometry,n)}};return"FeatureCollection"===t.type?{...t,features:await Promise.all((null!==(r=t.features)&&void 0!==r?r:[]).map(n))}:"Feature"===t.type?n(t):t}(e,f,t)}const p=l&&null!==f?`Original CRS: EPSG:${f.epsgCode}`:null,_=[c.attribution,p].filter(Boolean).join(" | ")||void 0;return t.geoJSON(d,{...c,...void 0!==_?{attribution:_}:{},onEachFeature(t,r){if(o&&o(t,r),null!=t.id&&r.bindTooltip(String(t.id),{permanent:!1}),!t.properties||0===Object.keys(t.properties).length)return;const h=document.createElement("div");!function(t,e,i={propertiesField:"properties"}){const r=(t,e,i=!1)=>{if(Array.isArray(e)){for(const i of e)r(t,i).classList.add("array-entry");return t}if(null==e||"object"!=typeof e){const i=document.createElement("span");return i.classList.add("literal-value"),i.textContent=""+e,t.appendChild(i),i}{const s=document.createElement("table");s.classList.add("object-table"),i&&(s.innerHTML="<thead><tr><th>Property</th><th>Value</th></tr></thead>");const n=document.createElement("tbody");return Object.entries(e).forEach(([t,e])=>{const i=document.createElement("tr"),s=document.createElement("td");s.classList.add("object-property"),s.setAttribute("data-property",t),s.textContent=t,i.appendChild(s);const a=document.createElement("td");a.classList.add("object-value"),r(a,e),i.appendChild(a),n.appendChild(i)}),s.appendChild(n),t.appendChild(s),s}},s=document.createElement("div");s.classList.add("object-properties"),e.appendChild(s),i.propertiesField?r(s,t[i.propertiesField],!0):r(s,t,!0)}(t,h),function(){if(Wi||"undefined"==typeof document)return;Wi=!0;const t=document.createElement("style");t.setAttribute("data-jsonld-ui-utils","popup"),t.textContent=Xi,document.head.appendChild(t)}();const u=[Vi,n.className].filter(Boolean).join(" ");r.bindPopup(h,{maxWidth:1e4,...n,className:u}),function(t){if("undefined"==typeof ResizeObserver)return;let e=null;t.on("add",()=>{var i,r;const s=t._contentNode;if(!s)return;s.addEventListener("mousedown",()=>{const e=e=>{var i;(null===(i=t._container)||void 0===i?void 0:i.contains(e.target))||e.stopPropagation()};document.addEventListener("click",e,!0),document.addEventListener("mouseup",()=>{setTimeout(()=>document.removeEventListener("click",e,!0),0)},{once:!0,capture:!0})});const n=t._map,a=()=>{var e;const i=null===(e=null==n?void 0:n.getSize)||void 0===e?void 0:e.call(n);i&&t._container&&(t._container.style.setProperty("--jsonld-popup-max-width",`${Math.max(150,Math.min(.6*i.x,i.x-60))}px`),t._container.style.setProperty("--jsonld-popup-max-height",`${Math.max(100,Math.min(.7*i.y,i.y-110))}px`))};a(),t.update(),null==n||n.on("resize",a),t.once("remove",()=>null==n?void 0:n.off("resize",a));const o=null===(i=t.getContent())||void 0===i?void 0:i.firstElementChild;let h=null!==(r=null==o?void 0:o.offsetWidth)&&void 0!==r?r:0,u=!1;const l=o?new ResizeObserver(()=>{u||Math.abs(o.offsetWidth-h)<2||(h=o.offsetWidth,u=!0,requestAnimationFrame(()=>{u=!1,t._container&&!s.style.height&&(t.update(),h=o.offsetWidth)}))}):null;o&&l&&(l.observe(o),t.once("remove",()=>l.disconnect())),e=new ResizeObserver(()=>{t._container&&"function"==typeof t._updatePosition&&(t._containerWidth=t._container.offsetWidth,t._updatePosition())}),e.observe(s)}),t.on("remove",()=>{null==e||e.disconnect(),e=null})}(r.getPopup());const l=[null!=e&&"object"==typeof e&&"@context"in e?e["@context"]:null,s].filter(t=>null!=t);if(l.length>0){i(1===l.length?l[0]:l).then(t=>{Fi(h,t,a)})}}})},t}({});
|
|
26
26
|
//# sourceMappingURL=jsonld-ui-utils-leaflet.min.js.map
|